diff --git a/404.html b/404.html new file mode 100644 index 0000000000000000000000000000000000000000..51be3ad245ad06eb03126f369a217a73bc7ba9dc --- /dev/null +++ b/404.html @@ -0,0 +1 @@ +404: This page could not be found.Rakis

    404

    This page could not be found.

    \ No newline at end of file diff --git a/_next/static/chunks/0e5ce63c-06490805b4fe70ef.js b/_next/static/chunks/0e5ce63c-06490805b4fe70ef.js new file mode 100644 index 0000000000000000000000000000000000000000..e01d35fe5d88e8d51cf90ee4f0f8ac33dc095aa4 --- /dev/null +++ b/_next/static/chunks/0e5ce63c-06490805b4fe70ef.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[310],{4867:function(e,r,n){n.d(r,{H4u:function(){return L},Pxu:function(){return a},Ymj:function(){return h},_Ve:function(){return m},g8U:function(){return v},jnn:function(){return i},nQG:function(){return c},v4q:function(){return u}});var t=n(2265);function l(e,r){if(null==e)return{};var n,t,l={},o=Object.keys(e);for(t=0;t=0||(l[n]=e[n]);return l}var o=["color"],i=(0,t.forwardRef)(function(e,r){var n=e.color,i=l(e,o);return(0,t.createElement)("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:r}),(0,t.createElement)("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:void 0===n?"currentColor":n,fillRule:"evenodd",clipRule:"evenodd"}))}),C=["color"],c=(0,t.forwardRef)(function(e,r){var n=e.color,o=l(e,C);return(0,t.createElement)("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),(0,t.createElement)("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:void 0===n?"currentColor":n,fillRule:"evenodd",clipRule:"evenodd"}))}),f=["color"],u=(0,t.forwardRef)(function(e,r){var n=e.color,o=l(e,f);return(0,t.createElement)("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),(0,t.createElement)("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:void 0===n?"currentColor":n,fillRule:"evenodd",clipRule:"evenodd"}))}),d=["color"],v=(0,t.forwardRef)(function(e,r){var n=e.color,o=l(e,d);return(0,t.createElement)("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),(0,t.createElement)("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:void 0===n?"currentColor":n,fillRule:"evenodd",clipRule:"evenodd"}))}),w=["color"],a=(0,t.forwardRef)(function(e,r){var n=e.color,o=l(e,w);return(0,t.createElement)("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),(0,t.createElement)("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:void 0===n?"currentColor":n,fillRule:"evenodd",clipRule:"evenodd"}))}),s=["color"],h=(0,t.forwardRef)(function(e,r){var n=e.color,o=l(e,s);return(0,t.createElement)("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),(0,t.createElement)("path",{d:"M3.29227 0.048984C3.47033 -0.032338 3.67946 -0.00228214 3.8274 0.125891L12.8587 7.95026C13.0134 8.08432 13.0708 8.29916 13.0035 8.49251C12.9362 8.68586 12.7578 8.81866 12.5533 8.82768L9.21887 8.97474L11.1504 13.2187C11.2648 13.47 11.1538 13.7664 10.9026 13.8808L8.75024 14.8613C8.499 14.9758 8.20255 14.8649 8.08802 14.6137L6.15339 10.3703L3.86279 12.7855C3.72196 12.934 3.50487 12.9817 3.31479 12.9059C3.1247 12.8301 3 12.6461 3 12.4414V0.503792C3 0.308048 3.11422 0.130306 3.29227 0.048984ZM4 1.59852V11.1877L5.93799 9.14425C6.05238 9.02363 6.21924 8.96776 6.38319 8.99516C6.54715 9.02256 6.68677 9.12965 6.75573 9.2809L8.79056 13.7441L10.0332 13.178L8.00195 8.71497C7.93313 8.56376 7.94391 8.38824 8.03072 8.24659C8.11753 8.10494 8.26903 8.01566 8.435 8.00834L11.2549 7.88397L4 1.59852Z",fill:void 0===n?"currentColor":n,fillRule:"evenodd",clipRule:"evenodd"}))}),g=["color"],L=(0,t.forwardRef)(function(e,r){var n=e.color,o=l(e,g);return(0,t.createElement)("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),(0,t.createElement)("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z",fill:void 0===n?"currentColor":n,fillRule:"evenodd",clipRule:"evenodd"}))}),p=["color"],m=(0,t.forwardRef)(function(e,r){var n=e.color,o=l(e,p);return(0,t.createElement)("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),(0,t.createElement)("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:void 0===n?"currentColor":n,fillRule:"evenodd",clipRule:"evenodd"}))})}}]); \ No newline at end of file diff --git a/_next/static/chunks/122.0b40314ff1634299.js b/_next/static/chunks/122.0b40314ff1634299.js new file mode 100644 index 0000000000000000000000000000000000000000..635255c8900a9c0da300eb114ee23855010e09bb --- /dev/null +++ b/_next/static/chunks/122.0b40314ff1634299.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[122],{95122:function(e,t,s){s.r(t);var i=s(57437),l=s(2265),a=s(42008),n=s(5778),o=s(81810);t.default=e=>{let{embeddings:t}=e,[s,u]=(0,l.useState)([]);return(0,l.useEffect)(()=>{let e=[],s=[],i=[],l=[],a=[];if(t.length>=6){let u=new n.u({nComponents:3,nNeighbors:3,minDist:.1,spread:1});u.fit(t.map(e=>e.embedding));let h=u.getEmbedding();console.log("Computed Points",h),h.forEach((n,u)=>{e.push(n[0]),s.push(n[1]),i.push(n[2]),l.push(t[u].text);let h=o.Q[t[u].modelName],r=o.m[h];a.push(r)})}u([{x:e,y:s,z:i,text:l.map((e,s)=>"".concat(t[s].modelName.slice(0,100),": ").concat(e.slice(0,100))),mode:"markers",marker:{size:5,color:a},type:"scatter3d"}])},[t]),(0,i.jsx)("div",{style:{position:"relative",width:"100vw",height:"100vh"},children:(0,i.jsx)(a.Z,{data:s,layout:{autosize:!0,title:"Clusters",scene:{xaxis:{title:"X Axis"},yaxis:{title:"Y Axis"},zaxis:{title:"Z Axis"}}},useResizeHandler:!0,style:{width:"100%",height:"100%"}})})}}}]); \ No newline at end of file diff --git a/_next/static/chunks/141-3a9c8eec94898f8e.js b/_next/static/chunks/141-3a9c8eec94898f8e.js new file mode 100644 index 0000000000000000000000000000000000000000..33324f4da1034f856f1695ca917f082a253bf256 --- /dev/null +++ b/_next/static/chunks/141-3a9c8eec94898f8e.js @@ -0,0 +1,2 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[141],{53185:function(e,t,n){var r;r=function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)},t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n.",eQ="String expected.",eJ=[],eZ="__dbnames",e0="readonly",e1="readwrite";function e6(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var e2={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function e3(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=j(t))[e],t}}function e8(){throw G.Type()}function e4(e,t){try{var n=e5(e),r=e5(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return tu+a&&n(u+d)})})})(0).then(function(){if(0i(e[s],n[s])?e.substr(0,s)+n[s]+n.substr(s+1):0>i(e[s],r[s])?e.substr(0,s)+r[s]+n.substr(s+1):0<=a?e.substr(0,a)+t[a]+n.substr(a+1):null;0>i(e[s],c)&&(a=s)}return u=i(e[0],e[1])}))return tm(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",G.InvalidArgument);var s,c=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,f=i;function h(e,t){return f(e[0],t[0])}try{(s=e.reduce(function(e,t){for(var n=0,i=e.length;nr(t[0],o[1])&&0e4(n,e.from))return i?t2(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},t5(e);if(0e4(t,e.from)&&(e.from=t,e.l=null,e.d=r?r.d+1:1),0=e4(a.from,i.to)&&0<=e4(a.to,i.from))return!0;0>e4(i.from,a.from)?i=(r=n.next(a.from)).value:a=(u=o.next(i.from)).value}return!1}function t4(e){var t=t1(e)?null:{s:0,n:e};return{next:function(e){for(var n=0e4(e,t.n.from);)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||0>=e4(e,t.n.to))return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function t5(e){var n,r,i=((null===(n=e.r)||void 0===n?void 0:n.d)||0)-((null===(r=e.l)||void 0===r?void 0:r.d)||0),o=1e4(e,t.upper):0>=e4(e,t.upper)))}function nw(e,t,n,r,i,o){if(!n||0===n.length)return e;var a=t.query.index,s=a.multiEntry,c=t.query.range,l=r.schema.primaryKey.extractKey,f=a.extractKey,h=(a.lowLevelIndex||a).extractKey,n=n.reduce(function(e,n){var r=e,i="add"===n.type||"put"===n.type?n.values.filter(function(e){return e=f(e),s&&u(e)?e.some(function(e){return ng(e,c)}):ng(e,c)}).map(function(e){return e=j(e),o&&Object.freeze(e),e}):[];switch(n.type){case"add":r=e.concat(t.values?i:i.map(function(e){return l(e)}));break;case"put":var a=(new t6).addKeys(n.values.map(function(e){return l(e)})),r=e.filter(function(e){return!t8(new t6(e=t.values?l(e):e),a)}).concat(t.values?i:i.map(function(e){return l(e)}));break;case"delete":var h=(new t6).addKeys(n.keys);r=e.filter(function(e){return!t8(new t6(e=t.values?l(e):e),h)});break;case"deleteRange":var d=n.range;r=e.filter(function(e){return!ng(l(e),d)})}return r},e);return n===e?e:(n.sort(function(e,t){return e4(h(e),h(t))||e4(l(e),l(t))}),t.limit&&t.limit<1/0&&(n.length>t.limit?n.length=t.limit:e.length===t.limit&&n.length=r.limit&&(!r.values||e.req.values)&&(t=e.req.query.range,n=r.query.range,0>=function(e,t,n,r){if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;if(0===(t=e4(e,t))){if(n&&r)return 0;if(n)return 1;if(r)return -1}return t}(t.lower,n.lower,t.lowerOpen,n.lowerOpen)&&0<=function(e,t,n,r){if(void 0===e)return void 0!==t?1:0;if(void 0===t)return -1;if(0===(t=e4(e,t))){if(n&&r)return 0;if(n)return -1;if(r)return 1}return t}(t.upper,n.upper,t.upperOpen,n.upperOpen))}),!1,i,o];case"count":return[u=o.find(function(e){return n_(e.req.query.range,r.query.range)}),!!u,i,o]}}(n,r,"query",e),f=l[0],a=l[1],h=l[2],d=l[3];return f&&a?f.obsSet=e.obsSet:(a=i.query(e).then(function(e){var t=e.result;if(f&&(f.res=t),u){for(var n=0,r=t.length;n0x4000000000000000?0:r.oldVersion)<1,e.idbdb=d.result,u&&function(e,t){tV(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=tW(0,e.idbdb,t);tY(e,e._dbSchema,t);for(var r=0,i=tU(n,e._dbSchema).change;r=n})).length?(t.forEach(function(t){r.push(function(){var r=i,u=t._cfg.dbschema;tY(e,r,s),tY(e,u,s),i=e._dbSchema=u;var a=tU(r,u);a.add.forEach(function(e){tL(s,e[0],e[1].primKey,e[1].indexes)}),a.change.forEach(function(e){if(e.recreate)throw new G.Upgrade("Not yet support for changing primary key");var t=s.objectStore(e.name);e.add.forEach(function(e){return tG(t,e)}),e.change.forEach(function(e){t.deleteIndex(e.name),tG(t,e)}),e.del.forEach(function(e){return t.deleteIndex(e)})});var c=t._cfg.contentUpgrade;if(c&&t._cfg.version>n){tM(e,s),y._memoizedTables={};var l=k(u);a.del.forEach(function(e){l[e]=r[e]}),t$(e,[e.Transaction.prototype]),tF(e,[e.Transaction.prototype],o(l),l),y.schema=l;var f,h=D(c);return h&&eM(),a=eg.follow(function(){var e;(f=c(y))&&h&&(e=eF.bind(null,null),f.then(e,e))}),f&&"function"==typeof f.then?eg.resolve(f):a.then(function(){return f})}}),r.push(function(n){var r=t._cfg.dbschema;[].slice.call(n.db.objectStoreNames).forEach(function(e){return null==r[e]&&n.db.deleteObjectStore(e)}),t$(e,[e.Transaction.prototype]),tF(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),y.schema=e._dbSchema}),r.push(function(n){e.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(e.idbdb.version/10)===t._cfg.version?(e.idbdb.deleteObjectStore("$meta"),delete e._dbSchema.$meta,e._storeNames=e._storeNames.filter(function(e){return"$meta"!==e})):n.objectStore("$meta").put(t._cfg.version,"version"))})}),(function e(){return r.length?eg.resolve(r.shift()(y.idbtrans)).then(e):eg.resolve()})().then(function(){tV(i,s)})):eg.resolve()}).catch(v)):(o(p).forEach(function(e){tL(s,e,p[e].primKey,p[e].indexes)}),tM(e,s),void eg.follow(function(){return e.on.populate.fire(y)}).catch(v))}))},c),d.onsuccess=eC(function(){l=null;var n,a,c,p=e.idbdb=d.result,y=m(p.objectStoreNames);if(0e4(e,t)?e:t},this._IDBKeyRange=c._deps.IDBKeyRange,!this._IDBKeyRange)throw new G.MissingAPI})),this.on("versionchange",function(e){0=t||n<0||v&&r>=l}function w(){var e,n,r,o=i();if(g(o))return _(o);h=setTimeout(w,(e=o-d,n=o-p,r=t-e,v?a(r,l-n):r))}function _(e){return(h=void 0,m&&s)?b(e):(s=c=void 0,f)}function x(){var e,n=i(),r=g(n);if(s=arguments,c=this,d=n,r){if(void 0===h)return p=e=d,h=setTimeout(w,t),y?b(e):f;if(v)return clearTimeout(h),h=setTimeout(w,t),b(d)}return void 0===h&&(h=setTimeout(w,t)),f}return t=o(t)||0,r(n)&&(y=!!n.leading,l=(v="maxWait"in n)?u(o(n.maxWait)||0,t):l,m="trailing"in n?!!n.trailing:m),x.cancel=function(){void 0!==h&&clearTimeout(h),p=0,s=d=c=h=void 0},x.flush=function(){return void 0===h?f:_(i())},x}},63117:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},50561:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},41108:function(e,t,n){var r=n(12731),i=n(50561);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==r(e)}},49423:function(e,t,n){var r=n(2381);e.exports=function(){return r.Date.now()}},49666:function(e,t,n){var r=n(19334),i=n(63117),o=n(41108),u=0/0,a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return u;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):a.test(e)?u:+e}},69893:function(e,t,n){"use strict";let r,i;n.d(t,{$3:function(){return T},P6:function(){return U},T:function(){return F},UG:function(){return z},Xx:function(){return D}});/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */let o=2n**255n-19n,u=2n**252n+0x14def9dea2f79cd65812631a5cf5d3edn,a={a:-1n,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,p:o,n:u,h:8,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},s=(e="")=>{throw Error(e)},c=e=>"string"==typeof e,l=e=>e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name,f=(e,t)=>!l(e)||"number"==typeof t&&t>0&&e.length!==t?s("Uint8Array of valid length expected"):e,h=e=>new Uint8Array(e),d=(e,t)=>f(c(e)?_(e):h(f(e)),t),p=(e,t=o)=>{let n=e%t;return n>=0n?n:t+n},y=e=>e instanceof v?e:s("Point expected");class v{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r}static fromAffine(e){return new v(e.x,e.y,1n,p(e.x*e.y))}static fromHex(e,t=!1){let{d:n}=a,r=(e=d(e,32)).slice(),i=e[31];r[31]=-129&i;let u=k(r);t&&!(0n<=u&&u<2n**256n)&&s("bad y coord 1"),t||0n<=u&&u0n;i=i.double(),e>>=1n)1n&e?n=n.add(i):t&&(r=r.add(i));return n}multiply(e){return this.mul(e)}clearCofactor(){return this.mul(BigInt(a.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(u/2n,!1).double();return u%2n&&(e=e.add(this)),e.is0()}toAffine(){let{ex:e,ey:t,ez:n}=this;if(this.equals(b))return{x:0n,y:1n};let r=E(n);return 1n!==p(n*r)&&s("invalid inverse"),{x:p(e*r),y:p(t*r)}}toRawBytes(){let{x:e,y:t}=this.toAffine(),n=x(t);return n[31]|=1n&e?128:0,n}toHex(){return w(this.toRawBytes())}}v.BASE=new v(0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,0x6666666666666666666666666666666666666666666666666666666666666658n,1n,p(0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an*0x6666666666666666666666666666666666666666666666666666666666666658n)),v.ZERO=new v(0n,1n,1n,0n);let{BASE:m,ZERO:b}=v,g=(e,t)=>e.toString(16).padStart(t,"0"),w=e=>Array.from(e).map(e=>g(e,2)).join(""),_=e=>{let t=e.length;(!c(e)||t%2)&&s("hex invalid 1");let n=h(t/2);for(let t=0;t_(g(e,64)).reverse(),k=e=>BigInt("0x"+w(h(f(e)).reverse())),O=(...e)=>{let t=h(e.reduce((e,t)=>e+f(t).length,0)),n=0;return e.forEach(e=>{t.set(e,n),n+=e.length}),t},E=(e,t=o)=>{(0n===e||t<=0n)&&s("no inverse n="+e+" mod="+t);let n=p(e,t),r=t,i=0n,u=1n,a=1n,c=0n;for(;0n!==n;){let e=r/n,t=r%n,o=i-a*e,s=u-c*e;r=n,n=t,i=a,u=c,a=o,c=s}return 1n===r?p(i,t):s("no inverse")},P=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=o;return n},A=e=>{let t=e*e%o*e%o,n=P(t,2n)*t%o,r=P(n,1n)*e%o,i=P(r,5n)*r%o,u=P(i,10n)*i%o,a=P(u,20n)*u%o,s=P(a,40n)*a%o,c=P(s,80n)*s%o,l=P(c,80n)*s%o,f=P(l,10n)*i%o;return{pow_p_5_8:P(f,2n)*e%o,b2:t}},S=(e,t)=>{let n=p(t*t*t),r=A(e*p(n*n*t)).pow_p_5_8,i=p(e*n*r),o=p(t*i*i),u=i,a=p(0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n*i),s=o===e,c=o===p(-e),l=o===p(-(0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n*e));return s&&(i=u),(c||l)&&(i=a),(1n&p(i))===1n&&(i=p(-i)),{isValid:s||c,value:i}},j=e=>p(k(e),u),K=(...e)=>z.sha512Async(...e),C=(...e)=>"function"==typeof r?r(...e):s("etc.sha512Sync not set"),I=e=>{let t=e.slice(0,32);t[0]&=248,t[31]&=127,t[31]|=64;let n=e.slice(32,64),r=j(t),i=m.mul(r),o=i.toRawBytes();return{head:t,prefix:n,scalar:r,point:i,pointBytes:o}},B=e=>I(C(d(e,32))),T=e=>B(e).pointBytes;function q(e,t){return e?K(t.hashable).then(t.finish):t.finish(C(t.hashable))}let R=(e,t,n)=>{let{pointBytes:r,scalar:i}=e,o=j(t),a=m.mul(o).toRawBytes();return{hashable:O(a,r,n),finish:e=>f(O(a,x(p(o+j(e)*i,u))),64)}},D=(e,t)=>{let n=d(e),r=B(t),i=C(r.prefix,n);return q(!1,R(r,i,n))},N={zip215:!0},M=(e,t,n,r=N)=>{t=d(t),e=d(e,64);let{zip215:i}=r,o,u,a,s,c=new Uint8Array;try{o=v.fromHex(n,i),u=v.fromHex(e.slice(0,32),i),a=k(e.slice(32,64)),s=m.mul(a,!1),c=O(u.toRawBytes(),o.toRawBytes(),t)}catch(e){}return{hashable:c,finish:e=>{if(null==s||!i&&o.isSmallOrder())return!1;let t=j(e);return u.add(o.mul(t,!1)).add(s.negate()).clearCofactor().is0()}}},F=(e,t,n,r=N)=>q(!1,M(e,t,n,r)),$=()=>"object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,z={bytesToHex:w,hexToBytes:_,concatBytes:O,mod:p,invert:E,randomBytes:(e=32)=>{let t=$();return t&&t.getRandomValues||s("crypto.getRandomValues must be defined"),t.getRandomValues(h(e))},sha512Async:async(...e)=>{let t=$();t&&t.subtle||s("crypto.subtle or etc.sha512Async must be defined");let n=O(...e);return h(await t.subtle.digest("SHA-512",n.buffer))},sha512Sync:void 0};Object.defineProperties(z,{sha512Sync:{configurable:!1,get:()=>r,set(e){r||(r=e)}}});let U={getExtendedPublicKeyAsync:e=>K(d(e,32)).then(I),getExtendedPublicKey:B,randomPrivateKey:()=>z.randomBytes(32),precompute:(e=8,t=m)=>(t.multiply(3n),t)},L=()=>{let e=[],t=m,n=t;for(let r=0;r<33;r++){n=t,e.push(n);for(let r=1;r<128;r++)n=n.add(t),e.push(n);t=n.double()}return e},V=e=>{let t=i||(i=L()),n=(e,t)=>{let n=t.negate();return e?n:t},r=b,o=m,u=BigInt(255),a=BigInt(8);for(let i=0;i<33;i++){let s=128*i,c=Number(e&u);e>>=a,c>128&&(c-=256,e+=1n);let l=s+Math.abs(c)-1,f=i%2!=0,h=c<0;0===c?o=o.add(n(f,t[s])):r=r.add(n(h,t[l]))}return{p:r,f:o}}},14635:function(e,t,n){"use strict";var r=n(53185);let i=Symbol.for("Dexie"),o=globalThis[i]||(globalThis[i]=r);if(r.semVer!==o.semVer)throw Error(`Two different versions of Dexie loaded in the same app: ${r.semVer} and ${o.semVer}`);let{liveQuery:u,mergeRanges:a,rangesOverlap:s,RangeSet:c,cmp:l,Entity:f,PropModSymbol:h,PropModification:d,replacePrefix:p,add:y,remove:v}=o;t.ZP=o},51359:function(e,t,n){"use strict";n.d(t,{b:function(){return i}});var r=n(48926);class i extends r.G{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}}},48926:function(e,t,n){"use strict";n.d(t,{G:function(){return i}});var r=n(94290);class i extends Error{constructor(e,t={}){super(),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:(0,r.bo)()});let n=t.cause instanceof i?t.cause.details:t.cause?.message?t.cause.message:t.details,o=t.cause instanceof i&&t.cause.docsPath||t.docsPath;this.message=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...o?[`Docs: https://viem.sh${o}${t.docsSlug?`#${t.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join("\n"),t.cause&&(this.cause=t.cause),this.details=n,this.docsPath=o,this.metaMessages=t.metaMessages,this.shortMessage=e}walk(e){return function e(t,n){return n?.(t)?t:t&&"object"==typeof t&&"cause"in t?e(t.cause,n):n?null:t}(this,e)}}},74188:function(e,t,n){"use strict";n.d(t,{J5:function(){return i},M6:function(){return o}});var r=n(48926);class i extends r.G{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${8*r}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}}class o extends r.G{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}}},94290:function(e,t,n){"use strict";n.d(t,{Gr:function(){return r},bo:function(){return i}});let r=e=>e,i=()=>"viem@2.13.8"},99112:function(e,t,n){"use strict";n.d(t,{K:function(){return l},x:function(){return c}});var r=n(51359),i=n(82361),o=n(45626),u=n(98992),a=n(64113);let s=new u.k(8192);function c(e,t){if(s.has(`${e}.${t}`))return s.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=(0,o.w)((0,i.qX)(n),"bytes"),u=(t?n.substring(`${t}0x`.length):n).split("");for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&u[e]&&(u[e]=u[e].toUpperCase()),(15&r[e>>1])>=8&&u[e+1]&&(u[e+1]=u[e+1].toUpperCase());let a=`0x${u.join("")}`;return s.set(`${e}.${t}`,a),a}function l(e,t){if(!(0,a.U)(e,{strict:!1}))throw new r.b({address:e});return c(e,t)}},64113:function(e,t,n){"use strict";n.d(t,{U:function(){return a}});var r=n(98992),i=n(99112);let o=/^0x[a-fA-F0-9]{40}$/,u=new r.k(8192);function a(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(u.has(r))return u.get(r);let a=!!o.test(e)&&(e.toLowerCase()===e||!n||(0,i.x)(e)===e);return u.set(r,a),a}},40369:function(e,t,n){"use strict";function r(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}n.d(t,{v:function(){return r}})},685:function(e,t,n){"use strict";n.d(t,{vk:function(){return o}});var r=n(48926);class i extends r.G{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeExceedsPaddingSizeError"})}}function o(e,{dir:t,size:n=32}={}){return"string"==typeof e?function(e,{dir:t,size:n=32}={}){if(null===n)return e;let r=e.replace("0x","");if(r.length>2*n)throw new i({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r["right"===t?"padEnd":"padStart"](2*n,"0")}`}(e,{dir:t,size:n}):function(e,{dir:t,size:n=32}={}){if(null===n)return e;if(e.length>n)throw new i({size:e.length,targetSize:n,type:"bytes"});let r=new Uint8Array(n);for(let i=0;it)throw new r.M6({givenSize:o(e),maxSize:t})}function a(e,t={}){let{signed:n}=t;t.size&&u(e,{size:t.size});let r=BigInt(e);if(!n)return r;let i=(e.length-2)/2;return r<=(1n<<8n*BigInt(i)-1n)-1n?r:r-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function s(e,t={}){return Number(a(e,t))}},82361:function(e,t,n){"use strict";n.d(t,{O0:function(){return c},qX:function(){return d}});var r=n(48926),i=n(40369),o=n(685),u=n(88294),a=n(95046);let s=new TextEncoder;function c(e,t={}){return"number"==typeof e||"bigint"==typeof e?h((0,a.eC)(e,t)):"boolean"==typeof e?function(e,t={}){let n=new Uint8Array(1);return(n[0]=Number(e),"number"==typeof t.size)?((0,u.Yf)(n,{size:t.size}),(0,o.vk)(n,{size:t.size})):n}(e,t):(0,i.v)(e)?h(e,t):d(e,t)}let l={zero:48,nine:57,A:65,F:70,a:97,f:102};function f(e){return e>=l.zero&&e<=l.nine?e-l.zero:e>=l.A&&e<=l.F?e-(l.A-10):e>=l.a&&e<=l.f?e-(l.a-10):void 0}function h(e,t={}){let n=e;t.size&&((0,u.Yf)(n,{size:t.size}),n=(0,o.vk)(n,{dir:"right",size:t.size}));let i=n.slice(2);i.length%2&&(i=`0${i}`);let a=i.length/2,s=new Uint8Array(a);for(let e=0,t=0;et.toString(16).padStart(2,"0"));function a(e,t={}){return"number"==typeof e||"bigint"==typeof e?c(e,t):"string"==typeof e?f(e,t):"boolean"==typeof e?function(e,t={}){let n=`0x${Number(e)}`;return"number"==typeof t.size?((0,o.Yf)(n,{size:t.size}),(0,i.vk)(n,{size:t.size})):n}(e,t):s(e,t)}function s(e,t={}){let n="";for(let t=0;tn||ae<>>32-n,a=(e,t,n)=>t<>>32-n,s=(e,t,n)=>t<>>64-n,c=(e,t,n)=>e<>>64-n;var l=n(12403);let[f,h,d]=[[],[],[]],p=BigInt(0),y=BigInt(1),v=BigInt(2),m=BigInt(7),b=BigInt(256),g=BigInt(113);for(let e=0,t=y,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],f.push(2*(5*r+n)),h.push((e+1)*(e+2)/2%64);let i=p;for(let e=0;e<7;e++)(t=(t<>m)*g)%b)&v&&(i^=y<<(y<>o&i)}:{h:0|Number(e>>o&i),l:0|Number(e&i)}}(e[u],t);[n[u],r[u]]=[a,s]}return[n,r]}(d,!0),x=(e,t,n)=>n>32?s(e,t,n):u(e,t,n),k=(e,t,n)=>n>32?c(e,t,n):a(e,t,n);class O extends l.kb{constructor(e,t,n,i=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,r.Rx)(n),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,l.Jq)(this.state)}keccak(){!function(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,o=n[i],u=n[i+1],a=x(o,u,1)^n[r],s=k(o,u,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=a,e[t+n+1]^=s}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=h[n],o=x(t,i,r),u=k(t,i,r),a=f[n];t=e[a],i=e[a+1],e[a]=o,e[a+1]=u}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=w[r],e[1]^=_[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){(0,r.Gg)(this);let{blockLen:t,state:n}=this,i=(e=(0,l.O0)(e)).length;for(let r=0;r=n&&this.keccak();let o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,r.Rx)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,r.J8)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new O(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}let E=(0,l.hE)(()=>new O(136,1,32));var P=n(40369),A=n(82361),S=n(95046);function j(e,t){let n=E((0,P.v)(e,{strict:!1})?(0,A.O0)(e):e);return"bytes"===(t||"hex")?n:(0,S.NC)(n)}},98992:function(e,t,n){"use strict";n.d(t,{k:function(){return r}});class r extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}set(e,t){return super.set(e,t),this.maxSize&&this.size>this.maxSize&&this.delete(this.keys().next().value),this}}},2342:function(e,t,n){"use strict";n.d(t,{k:function(){return h}});var r=n(82361),i=n(45626),o=n(99112),u=n(40369),a=n(88294),s=n(95046);async function c({hash:e,signature:t}){let r=(0,u.v)(e)?e:(0,s.NC)(e),{secp256k1:i}=await n.e(600).then(n.bind(n,35600)),o=(()=>{if("object"==typeof t&&"r"in t&&"s"in t){let{r:e,s:n,v:r,yParity:o}=t,u=l(Number(o??r));return new i.Signature((0,a.y_)(e),(0,a.y_)(n)).addRecoveryBit(u)}let e=(0,u.v)(t)?t:(0,s.NC)(t),n=l((0,a.ly)(`0x${e.slice(130)}`));return i.Signature.fromCompact(e.substring(2,130)).addRecoveryBit(n)})().recoverPublicKey(r.substring(2)).toHex(!1);return`0x${o}`}function l(e){if(0===e||1===e)return e;if(27===e)return 0;if(28===e)return 1;throw Error("Invalid yParityOrV value")}async function f({hash:e,signature:t}){return function(e){let t=(0,i.w)(`0x${e.substring(4)}`).substring(26);return(0,o.x)(`0x${t}`)}(await c({hash:e,signature:t}))}async function h({message:e,signature:t}){return f({hash:function(e,t){var n;let o="string"==typeof e?(0,r.qX)(e):e.raw instanceof Uint8Array?e.raw:(0,r.O0)(e.raw),u=(0,r.qX)(`\x19Ethereum Signed Message: +${o.length}`);return(0,i.w)("string"==typeof(n=[u,o])[0]?`0x${n.reduce((e,t)=>e+t.replace("0x",""),"")}`:function(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}(n),void 0)}(e),signature:t})}},25645:function(e,t,n){"use strict";n.d(t,{n:function(){return a}});var r=n(99112),i=n(51359),o=n(64113),u=n(2342);async function a({address:e,message:t,signature:n}){return function(e,t){if(!(0,o.U)(e,{strict:!1}))throw new i.b({address:e});if(!(0,o.U)(t,{strict:!1}))throw new i.b({address:t});return e.toLowerCase()===t.toLowerCase()}((0,r.K)(e),await (0,u.k)({message:t,signature:n}))}},95861:function(e,t,n){"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`Wrong positive integer: ${e}`)}function i(e,...t){if(!(e instanceof Uint8Array))throw Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function o(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function u(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function a(e,t){i(e);let n=t.outputLen;if(e.lengthe instanceof Uint8Array,o=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),u=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),a=(e,t)=>e<<32-t|e>>>t;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw Error("Non little-endian hardware is not supported");function s(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}(e)),!i(e))throw Error(`expected Uint8Array, got ${typeof e}`);return e}function c(...e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;return e.forEach(e=>{if(!i(e))throw Error("Uint8Array expected");t.set(e,n),n+=e.length}),t}class l{clone(){return this._cloneInto()}}function f(e){let t=t=>e().update(s(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function h(e=32){if(r&&"function"==typeof r.getRandomValues)return r.getRandomValues(new Uint8Array(e));throw Error("crypto.getRandomValues must be defined")}}}]); \ No newline at end of file diff --git a/_next/static/chunks/23-c30270c4d93da1b8.js b/_next/static/chunks/23-c30270c4d93da1b8.js new file mode 100644 index 0000000000000000000000000000000000000000..83268af76de5fa4ad30d5c669e000bdfe6879660 --- /dev/null +++ b/_next/static/chunks/23-c30270c4d93da1b8.js @@ -0,0 +1,2 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[23],{29492:function(e,t){"use strict";function n(){return""}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getDeploymentIdQueryOrEmptyString",{enumerable:!0,get:function(){return n}})},57108:function(){"trimStart"in String.prototype||(String.prototype.trimStart=String.prototype.trimLeft),"trimEnd"in String.prototype||(String.prototype.trimEnd=String.prototype.trimRight),"description"in Symbol.prototype||Object.defineProperty(Symbol.prototype,"description",{configurable:!0,get:function(){var e=/\((.*)\)/.exec(this.toString());return e?e[1]:void 0}}),Array.prototype.flat||(Array.prototype.flat=function(e,t){return t=this.concat.apply([],this),e>1&&t.some(Array.isArray)?t.flat(e-1):t},Array.prototype.flatMap=function(e,t){return this.map(e,t).flat()}),Promise.prototype.finally||(Promise.prototype.finally=function(e){if("function"!=typeof e)return this.then(e,e);var t=this.constructor||Promise;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})}),Object.fromEntries||(Object.fromEntries=function(e){return Array.from(e).reduce(function(e,t){return e[t[0]]=t[1],e},{})}),Array.prototype.at||(Array.prototype.at=function(e){var t=Math.trunc(e)||0;if(t<0&&(t+=this.length),!(t<0||t>=this.length))return this[t]}),Object.hasOwn||(Object.hasOwn=function(e,t){if(null==e)throw TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(e),t)})},4897:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addBasePath",{enumerable:!0,get:function(){return u}});let r=n(22707),o=n(18157);function u(e,t){return(0,o.normalizePathTrailingSlash)((0,r.addPathPrefix)(e,""))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},75684:function(e,t){"use strict";function n(e){var t,n;t=self.__next_s,n=()=>{e()},t&&t.length?t.reduce((e,t)=>{let[n,r]=t;return e.then(()=>new Promise((e,t)=>{let o=document.createElement("script");if(r)for(let e in r)"children"!==e&&o.setAttribute(e,r[e]);n?(o.src=n,o.onload=()=>e(),o.onerror=t):r&&(o.innerHTML=r.children,setTimeout(e)),document.head.appendChild(o)}))},Promise.resolve()).catch(e=>{console.error(e)}).then(()=>{n()}):n()}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"appBootstrap",{enumerable:!0,get:function(){return n}}),window.next={version:"14.2.3",appDir:!0},("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},74590:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"callServer",{enumerable:!0,get:function(){return o}});let r=n(95751);async function o(e,t){let n=(0,r.getServerActionDispatcher)();if(!n)throw Error("Invariant: missing action dispatcher.");return new Promise((r,o)=>{n({actionId:e,actionArgs:t,resolve:r,reject:o})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},10353:function(e,t,n){"use strict";let r,o;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hydrate",{enumerable:!0,get:function(){return x}});let u=n(99920),l=n(41452),a=n(57437);n(57108);let i=u._(n(34040)),c=l._(n(2265)),s=n(6671),f=n(36590),d=u._(n(16124)),p=n(74590),h=n(42128),y=n(21427);n(63243);let _=window.console.error;window.console.error=function(){for(var e=arguments.length,t=Array(e),n=0;n{if((0,h.isNextRouterError)(e.error)){e.preventDefault();return}});let v=document,b=new TextEncoder,g=!1,m=!1,R=null;function P(e){if(0===e[0])r=[];else if(1===e[0]){if(!r)throw Error("Unexpected server data: missing bootstrap script.");o?o.enqueue(b.encode(e[1])):r.push(e[1])}else 2===e[0]&&(R=e[1])}let j=function(){o&&!m&&(o.close(),m=!0,r=void 0),g=!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",j,!1):j();let O=self.__next_f=self.__next_f||[];O.forEach(P),O.push=P;let S=new ReadableStream({start(e){r&&(r.forEach(t=>{e.enqueue(b.encode(t))}),g&&!m&&(e.close(),m=!0,r=void 0)),o=e}}),E=(0,s.createFromReadableStream)(S,{callServer:p.callServer});function w(){return(0,c.use)(E)}let T=c.default.StrictMode;function M(e){let{children:t}=e;return t}function x(){let e=(0,y.createMutableActionQueue)(),t=(0,a.jsx)(T,{children:(0,a.jsx)(f.HeadManagerContext.Provider,{value:{appDir:!0},children:(0,a.jsx)(y.ActionQueueContext.Provider,{value:e,children:(0,a.jsx)(M,{children:(0,a.jsx)(w,{})})})})}),n=window.__next_root_layout_missing_tags,r=!!(null==n?void 0:n.length),o={onRecoverableError:d.default};"__next_error__"===document.documentElement.id||r?i.default.createRoot(v,o).render(t):c.default.startTransition(()=>i.default.hydrateRoot(v,t,{...o,formState:R}))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},11028:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(65820),(0,n(75684).appBootstrap)(()=>{let{hydrate:e}=n(10353);n(95751),n(39275),e()}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},65820:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(29492);{let e=n.u;n.u=function(){for(var t=arguments.length,n=Array(t),r=0;r(l(function(){var e;let t=document.getElementsByName(u)[0];if(null==t?void 0:null==(e=t.shadowRoot)?void 0:e.childNodes[0])return t.shadowRoot.childNodes[0];{let e=document.createElement(u);e.style.cssText="position:absolute";let t=document.createElement("div");return t.ariaLive="assertive",t.id="__next-route-announcer__",t.role="alert",t.style.cssText="position:absolute;border:0;height:1px;margin:-1px;padding:0;width:1px;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap;word-wrap:normal",e.attachShadow({mode:"open"}).appendChild(t),document.body.appendChild(e),t}}()),()=>{let e=document.getElementsByTagName(u)[0];(null==e?void 0:e.isConnected)&&document.body.removeChild(e)}),[]);let[a,i]=(0,r.useState)(""),c=(0,r.useRef)();return(0,r.useEffect)(()=>{let e="";if(document.title)e=document.title;else{let t=document.querySelector("h1");t&&(e=t.innerText||t.textContent||"")}void 0!==c.current&&c.current!==e&&i(e),c.current=e},[t]),n?(0,o.createPortal)(a,n):null}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77325:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ACTION:function(){return r},FLIGHT_PARAMETERS:function(){return i},NEXT_DID_POSTPONE_HEADER:function(){return s},NEXT_ROUTER_PREFETCH_HEADER:function(){return u},NEXT_ROUTER_STATE_TREE:function(){return o},NEXT_RSC_UNION_QUERY:function(){return c},NEXT_URL:function(){return l},RSC_CONTENT_TYPE_HEADER:function(){return a},RSC_HEADER:function(){return n}});let n="RSC",r="Next-Action",o="Next-Router-State-Tree",u="Next-Router-Prefetch",l="Next-Url",a="text/x-component",i=[[n],[o],[u]],c="_rsc",s="x-nextjs-postponed";("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},95751:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createEmptyCacheNode:function(){return C},default:function(){return I},getServerActionDispatcher:function(){return E},urlToUrlWithoutFlightMarker:function(){return T}});let r=n(41452),o=n(57437),u=r._(n(2265)),l=n(44467),a=n(51507),i=n(53174),c=n(68056),s=n(42114),f=n(76130),d=n(50322),p=n(74092),h=n(4897),y=n(41012),_=n(36585),v=n(30315),b=n(91108),g=n(77325),m=n(97599),R=n(49404),P=n(8e4),j="undefined"==typeof window,O=j?null:new Map,S=null;function E(){return S}let w={};function T(e){let t=new URL(e,location.origin);if(t.searchParams.delete(g.NEXT_RSC_UNION_QUERY),t.pathname.endsWith(".txt")){let{pathname:e}=t,n=e.endsWith("/index.txt")?10:4;t.pathname=e.slice(0,-n)}return t}function M(e){return e.origin!==window.location.origin}function x(e){let{appRouterState:t,sync:n}=e;return(0,u.useInsertionEffect)(()=>{let{tree:e,pushRef:r,canonicalUrl:o}=t,u={...r.preserveCustomHistoryState?window.history.state:{},__NA:!0,__PRIVATE_NEXTJS_INTERNALS_TREE:e};r.pendingPush&&(0,i.createHrefFromUrl)(new URL(window.location.href))!==o?(r.pendingPush=!1,window.history.pushState(u,"",o)):window.history.replaceState(u,"",o),n(t)},[t,n]),null}function C(){return{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null}}function A(e){null==e&&(e={});let t=window.history.state,n=null==t?void 0:t.__NA;n&&(e.__NA=n);let r=null==t?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE;return r&&(e.__PRIVATE_NEXTJS_INTERNALS_TREE=r),e}function N(e){let{headCacheNode:t}=e,n=null!==t?t.head:null,r=null!==t?t.prefetchHead:null,o=null!==r?r:n;return(0,u.useDeferredValue)(n,o)}function D(e){let t,{buildId:n,initialHead:r,initialTree:i,initialCanonicalUrl:f,initialSeedData:g,couldBeIntercepted:E,assetPrefix:T,missingSlots:C}=e,D=(0,u.useMemo)(()=>(0,d.createInitialRouterState)({buildId:n,initialSeedData:g,initialCanonicalUrl:f,initialTree:i,initialParallelRoutes:O,location:j?null:window.location,initialHead:r,couldBeIntercepted:E}),[n,g,f,i,r,E]),[I,k,U]=(0,s.useReducerWithReduxDevtools)(D);(0,u.useEffect)(()=>{O=null},[]);let{canonicalUrl:F}=(0,s.useUnwrapState)(I),{searchParams:L,pathname:H}=(0,u.useMemo)(()=>{let e=new URL(F,"undefined"==typeof window?"http://n":window.location.href);return{searchParams:e.searchParams,pathname:(0,R.hasBasePath)(e.pathname)?(0,m.removeBasePath)(e.pathname):e.pathname}},[F]),$=(0,u.useCallback)(e=>{let{previousTree:t,serverResponse:n}=e;(0,u.startTransition)(()=>{k({type:a.ACTION_SERVER_PATCH,previousTree:t,serverResponse:n})})},[k]),G=(0,u.useCallback)((e,t,n)=>{let r=new URL((0,h.addBasePath)(e),location.href);return k({type:a.ACTION_NAVIGATE,url:r,isExternalUrl:M(r),locationSearch:location.search,shouldScroll:null==n||n,navigateType:t})},[k]);S=(0,u.useCallback)(e=>{(0,u.startTransition)(()=>{k({...e,type:a.ACTION_SERVER_ACTION})})},[k]);let z=(0,u.useMemo)(()=>({back:()=>window.history.back(),forward:()=>window.history.forward(),prefetch:(e,t)=>{if((0,p.isBot)(window.navigator.userAgent))return;let n=new URL((0,h.addBasePath)(e),window.location.href);M(n)||(0,u.startTransition)(()=>{var e;k({type:a.ACTION_PREFETCH,url:n,kind:null!=(e=null==t?void 0:t.kind)?e:a.PrefetchKind.FULL})})},replace:(e,t)=>{void 0===t&&(t={}),(0,u.startTransition)(()=>{var n;G(e,"replace",null==(n=t.scroll)||n)})},push:(e,t)=>{void 0===t&&(t={}),(0,u.startTransition)(()=>{var n;G(e,"push",null==(n=t.scroll)||n)})},refresh:()=>{(0,u.startTransition)(()=>{k({type:a.ACTION_REFRESH,origin:window.location.origin})})},fastRefresh:()=>{throw Error("fastRefresh can only be used in development mode. Please use refresh instead.")}}),[k,G]);(0,u.useEffect)(()=>{window.next&&(window.next.router=z)},[z]),(0,u.useEffect)(()=>{function e(e){var t;e.persisted&&(null==(t=window.history.state)?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE)&&(w.pendingMpaPath=void 0,k({type:a.ACTION_RESTORE,url:new URL(window.location.href),tree:window.history.state.__PRIVATE_NEXTJS_INTERNALS_TREE}))}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}},[k]);let{pushRef:B}=(0,s.useUnwrapState)(I);if(B.mpaNavigation){if(w.pendingMpaPath!==F){let e=window.location;B.pendingPush?e.assign(F):e.replace(F),w.pendingMpaPath=F}(0,u.use)(b.unresolvedThenable)}(0,u.useEffect)(()=>{let e=window.history.pushState.bind(window.history),t=window.history.replaceState.bind(window.history),n=e=>{var t;let n=window.location.href,r=null==(t=window.history.state)?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE;(0,u.startTransition)(()=>{k({type:a.ACTION_RESTORE,url:new URL(null!=e?e:n,n),tree:r})})};window.history.pushState=function(t,r,o){return(null==t?void 0:t.__NA)||(null==t?void 0:t._N)||(t=A(t),o&&n(o)),e(t,r,o)},window.history.replaceState=function(e,r,o){return(null==e?void 0:e.__NA)||(null==e?void 0:e._N)||(e=A(e),o&&n(o)),t(e,r,o)};let r=e=>{let{state:t}=e;if(t){if(!t.__NA){window.location.reload();return}(0,u.startTransition)(()=>{k({type:a.ACTION_RESTORE,url:new URL(window.location.href),tree:t.__PRIVATE_NEXTJS_INTERNALS_TREE})})}};return window.addEventListener("popstate",r),()=>{window.history.pushState=e,window.history.replaceState=t,window.removeEventListener("popstate",r)}},[k]);let{cache:W,tree:K,nextUrl:V,focusAndScrollRef:Y}=(0,s.useUnwrapState)(I),X=(0,u.useMemo)(()=>(0,v.findHeadInCache)(W,K[1]),[W,K]),q=(0,u.useMemo)(()=>(function e(t,n){for(let r of(void 0===n&&(n={}),Object.values(t[1]))){let t=r[0],o=Array.isArray(t),u=o?t[1]:t;!u||u.startsWith(P.PAGE_SEGMENT_KEY)||(o&&("c"===t[2]||"oc"===t[2])?n[t[0]]=t[1].split("/"):o&&(n[t[0]]=t[1]),n=e(r,n))}return n})(K),[K]);if(null!==X){let[e,n]=X;t=(0,o.jsx)(N,{headCacheNode:e},n)}else t=null;let J=(0,o.jsxs)(_.RedirectBoundary,{children:[t,W.rsc,(0,o.jsx)(y.AppRouterAnnouncer,{tree:K})]});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(x,{appRouterState:(0,s.useUnwrapState)(I),sync:U}),(0,o.jsx)(c.PathParamsContext.Provider,{value:q,children:(0,o.jsx)(c.PathnameContext.Provider,{value:H,children:(0,o.jsx)(c.SearchParamsContext.Provider,{value:L,children:(0,o.jsx)(l.GlobalLayoutRouterContext.Provider,{value:{buildId:n,changeByServerResponse:$,tree:K,focusAndScrollRef:Y,nextUrl:V},children:(0,o.jsx)(l.AppRouterContext.Provider,{value:z,children:(0,o.jsx)(l.LayoutRouterContext.Provider,{value:{childNodes:W.parallelRoutes,tree:K,url:F,loading:W.loading},children:J})})})})})})]})}function I(e){let{globalErrorComponent:t,...n}=e;return(0,o.jsx)(f.ErrorBoundary,{errorComponent:t,children:(0,o.jsx)(D,{...n})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},24804:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"bailoutToClientRendering",{enumerable:!0,get:function(){return u}});let r=n(55592),o=n(44936);function u(e){let t=o.staticGenerationAsyncStorage.getStore();if((null==t||!t.forceStatic)&&(null==t?void 0:t.isStaticGeneration))throw new r.BailoutToCSRError(e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},66513:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ClientPageRoot",{enumerable:!0,get:function(){return u}});let r=n(57437),o=n(8897);function u(e){let{Component:t,props:n}=e;return n.searchParams=(0,o.createDynamicallyTrackedSearchParams)(n.searchParams||{}),(0,r.jsx)(t,{...n})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},76130:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ErrorBoundary:function(){return h},ErrorBoundaryHandler:function(){return f},GlobalError:function(){return d},default:function(){return p}});let r=n(99920),o=n(57437),u=r._(n(2265)),l=n(71169),a=n(42128),i=n(44936),c={error:{fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},text:{fontSize:"14px",fontWeight:400,lineHeight:"28px",margin:"0 8px"}};function s(e){let{error:t}=e,n=i.staticGenerationAsyncStorage.getStore();if((null==n?void 0:n.isRevalidate)||(null==n?void 0:n.isStaticGeneration))throw console.error(t),t;return null}class f extends u.default.Component{static getDerivedStateFromError(e){if((0,a.isNextRouterError)(e))throw e;return{error:e}}static getDerivedStateFromProps(e,t){return e.pathname!==t.previousPathname&&t.error?{error:null,previousPathname:e.pathname}:{error:t.error,previousPathname:e.pathname}}render(){return this.state.error?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s,{error:this.state.error}),this.props.errorStyles,this.props.errorScripts,(0,o.jsx)(this.props.errorComponent,{error:this.state.error,reset:this.reset})]}):this.props.children}constructor(e){super(e),this.reset=()=>{this.setState({error:null})},this.state={error:null,previousPathname:this.props.pathname}}}function d(e){let{error:t}=e,n=null==t?void 0:t.digest;return(0,o.jsxs)("html",{id:"__next_error__",children:[(0,o.jsx)("head",{}),(0,o.jsxs)("body",{children:[(0,o.jsx)(s,{error:t}),(0,o.jsx)("div",{style:c.error,children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{style:c.text,children:"Application error: a "+(n?"server":"client")+"-side exception has occurred (see the "+(n?"server logs":"browser console")+" for more information)."}),n?(0,o.jsx)("p",{style:c.text,children:"Digest: "+n}):null]})})]})]})}let p=d;function h(e){let{errorComponent:t,errorStyles:n,errorScripts:r,children:u}=e,a=(0,l.usePathname)();return t?(0,o.jsx)(f,{pathname:a,errorComponent:t,errorStyles:n,errorScripts:r,children:u}):(0,o.jsx)(o.Fragment,{children:u})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},57910:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{DynamicServerError:function(){return r},isDynamicServerError:function(){return o}});let n="DYNAMIC_SERVER_USAGE";class r extends Error{constructor(e){super("Dynamic server usage: "+e),this.description=e,this.digest=n}}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&"string"==typeof e.digest&&e.digest===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},42128:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isNextRouterError",{enumerable:!0,get:function(){return u}});let r=n(52496),o=n(67909);function u(e){return e&&e.digest&&((0,o.isRedirectError)(e)||(0,r.isNotFoundError)(e))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},39275:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return S}});let r=n(99920),o=n(41452),u=n(57437),l=o._(n(2265)),a=r._(n(54887)),i=n(44467),c=n(41283),s=n(91108),f=n(76130),d=n(16237),p=n(86180),h=n(36585),y=n(16585),_=n(44640),v=n(81784),b=n(35914),g=["bottom","height","left","right","top","width","x","y"];function m(e,t){let n=e.getBoundingClientRect();return n.top>=0&&n.top<=t}class R extends l.default.Component{componentDidMount(){this.handlePotentialScroll()}componentDidUpdate(){this.props.focusAndScrollRef.apply&&this.handlePotentialScroll()}render(){return this.props.children}constructor(...e){super(...e),this.handlePotentialScroll=()=>{let{focusAndScrollRef:e,segmentPath:t}=this.props;if(e.apply){var n;if(0!==e.segmentPaths.length&&!e.segmentPaths.some(e=>t.every((t,n)=>(0,d.matchSegment)(t,e[n]))))return;let r=null,o=e.hashFragment;if(o&&(r="top"===o?document.body:null!=(n=document.getElementById(o))?n:document.getElementsByName(o)[0]),r||(r="undefined"==typeof window?null:a.default.findDOMNode(this)),!(r instanceof Element))return;for(;!(r instanceof HTMLElement)||function(e){if(["sticky","fixed"].includes(getComputedStyle(e).position))return!0;let t=e.getBoundingClientRect();return g.every(e=>0===t[e])}(r);){if(null===r.nextElementSibling)return;r=r.nextElementSibling}e.apply=!1,e.hashFragment=null,e.segmentPaths=[],(0,p.handleSmoothScroll)(()=>{if(o){r.scrollIntoView();return}let e=document.documentElement,t=e.clientHeight;!m(r,t)&&(e.scrollTop=0,m(r,t)||r.scrollIntoView())},{dontForceLayout:!0,onlyHashChange:e.onlyHashChange}),e.onlyHashChange=!1,r.focus()}}}}function P(e){let{segmentPath:t,children:n}=e,r=(0,l.useContext)(i.GlobalLayoutRouterContext);if(!r)throw Error("invariant global layout router not mounted");return(0,u.jsx)(R,{segmentPath:t,focusAndScrollRef:r.focusAndScrollRef,children:n})}function j(e){let{parallelRouterKey:t,url:n,childNodes:r,segmentPath:o,tree:a,cacheKey:f}=e,p=(0,l.useContext)(i.GlobalLayoutRouterContext);if(!p)throw Error("invariant global layout router not mounted");let{buildId:h,changeByServerResponse:y,tree:_}=p,v=r.get(f);if(void 0===v){let e={lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null};v=e,r.set(f,e)}let g=null!==v.prefetchRsc?v.prefetchRsc:v.rsc,m=(0,l.useDeferredValue)(v.rsc,g),R="object"==typeof m&&null!==m&&"function"==typeof m.then?(0,l.use)(m):m;if(!R){let e=v.lazyData;if(null===e){let t=function e(t,n){if(t){let[r,o]=t,u=2===t.length;if((0,d.matchSegment)(n[0],r)&&n[1].hasOwnProperty(o)){if(u){let t=e(void 0,n[1][o]);return[n[0],{...n[1],[o]:[t[0],t[1],t[2],"refetch"]}]}return[n[0],{...n[1],[o]:e(t.slice(2),n[1][o])}]}}return n}(["",...o],_),r=(0,b.hasInterceptionRouteInCurrentTree)(_);v.lazyData=e=(0,c.fetchServerResponse)(new URL(n,location.origin),t,r?p.nextUrl:null,h),v.lazyDataResolved=!1}let t=(0,l.use)(e);v.lazyDataResolved||(setTimeout(()=>{(0,l.startTransition)(()=>{y({previousTree:_,serverResponse:t})})}),v.lazyDataResolved=!0,(0,l.use)(s.unresolvedThenable))}return(0,u.jsx)(i.LayoutRouterContext.Provider,{value:{tree:a[1][t],childNodes:v.parallelRoutes,url:n,loading:v.loading},children:R})}function O(e){let{children:t,hasLoading:n,loading:r,loadingStyles:o,loadingScripts:a}=e;return n?(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(u.Fragment,{children:[o,a,r]}),children:t}):(0,u.jsx)(u.Fragment,{children:t})}function S(e){let{parallelRouterKey:t,segmentPath:n,error:r,errorStyles:o,errorScripts:a,templateStyles:c,templateScripts:s,template:d,notFound:p,notFoundStyles:b,styles:g}=e,m=(0,l.useContext)(i.LayoutRouterContext);if(!m)throw Error("invariant expected layout router to be mounted");let{childNodes:R,tree:S,url:E,loading:w}=m,T=R.get(t);T||(T=new Map,R.set(t,T));let M=S[1][t][0],x=(0,_.getSegmentValue)(M),C=[M];return(0,u.jsxs)(u.Fragment,{children:[g,C.map(e=>{let l=(0,_.getSegmentValue)(e),g=(0,v.createRouterCacheKey)(e);return(0,u.jsxs)(i.TemplateContext.Provider,{value:(0,u.jsx)(P,{segmentPath:n,children:(0,u.jsx)(f.ErrorBoundary,{errorComponent:r,errorStyles:o,errorScripts:a,children:(0,u.jsx)(O,{hasLoading:!!w,loading:null==w?void 0:w[0],loadingStyles:null==w?void 0:w[1],loadingScripts:null==w?void 0:w[2],children:(0,u.jsx)(y.NotFoundBoundary,{notFound:p,notFoundStyles:b,children:(0,u.jsx)(h.RedirectBoundary,{children:(0,u.jsx)(j,{parallelRouterKey:t,url:E,tree:S,childNodes:T,segmentPath:n,cacheKey:g,isActive:x===l})})})})})}),children:[c,s,d]},(0,v.createRouterCacheKey)(e,!0))})]})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},16237:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{canSegmentBeOverridden:function(){return u},matchSegment:function(){return o}});let r=n(24286),o=(e,t)=>"string"==typeof e?"string"==typeof t&&e===t:"string"!=typeof t&&e[0]===t[0]&&e[1]===t[1],u=(e,t)=>{var n;return!Array.isArray(e)&&!!Array.isArray(t)&&(null==(n=(0,r.getSegmentParam)(e))?void 0:n.param)===t[0]};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},71169:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ReadonlyURLSearchParams:function(){return i.ReadonlyURLSearchParams},RedirectType:function(){return i.RedirectType},ServerInsertedHTMLContext:function(){return c.ServerInsertedHTMLContext},notFound:function(){return i.notFound},permanentRedirect:function(){return i.permanentRedirect},redirect:function(){return i.redirect},useParams:function(){return p},usePathname:function(){return f},useRouter:function(){return d},useSearchParams:function(){return s},useSelectedLayoutSegment:function(){return y},useSelectedLayoutSegments:function(){return h},useServerInsertedHTML:function(){return c.useServerInsertedHTML}});let r=n(2265),o=n(44467),u=n(68056),l=n(44640),a=n(8e4),i=n(52152),c=n(8005);function s(){let e=(0,r.useContext)(u.SearchParamsContext),t=(0,r.useMemo)(()=>e?new i.ReadonlyURLSearchParams(e):null,[e]);if("undefined"==typeof window){let{bailoutToClientRendering:e}=n(24804);e("useSearchParams()")}return t}function f(){return(0,r.useContext)(u.PathnameContext)}function d(){let e=(0,r.useContext)(o.AppRouterContext);if(null===e)throw Error("invariant expected app router to be mounted");return e}function p(){return(0,r.useContext)(u.PathParamsContext)}function h(e){void 0===e&&(e="children");let t=(0,r.useContext)(o.LayoutRouterContext);return t?function e(t,n,r,o){let u;if(void 0===r&&(r=!0),void 0===o&&(o=[]),r)u=t[1][n];else{var i;let e=t[1];u=null!=(i=e.children)?i:Object.values(e)[0]}if(!u)return o;let c=u[0],s=(0,l.getSegmentValue)(c);return!s||s.startsWith(a.PAGE_SEGMENT_KEY)?o:(o.push(s),e(u,n,!1,o))}(t.tree,e):null}function y(e){void 0===e&&(e="children");let t=h(e);if(!t||0===t.length)return null;let n="children"===e?t[0]:t[t.length-1];return n===a.DEFAULT_SEGMENT_KEY?null:n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},52152:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ReadonlyURLSearchParams:function(){return l},RedirectType:function(){return r.RedirectType},notFound:function(){return o.notFound},permanentRedirect:function(){return r.permanentRedirect},redirect:function(){return r.redirect}});let r=n(67909),o=n(52496);class u extends Error{constructor(){super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams")}}class l extends URLSearchParams{append(){throw new u}delete(){throw new u}set(){throw new u}sort(){throw new u}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},16585:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"NotFoundBoundary",{enumerable:!0,get:function(){return s}});let r=n(41452),o=n(57437),u=r._(n(2265)),l=n(71169),a=n(52496);n(72301);let i=n(44467);class c extends u.default.Component{componentDidCatch(){}static getDerivedStateFromError(e){if((0,a.isNotFoundError)(e))return{notFoundTriggered:!0};throw e}static getDerivedStateFromProps(e,t){return e.pathname!==t.previousPathname&&t.notFoundTriggered?{notFoundTriggered:!1,previousPathname:e.pathname}:{notFoundTriggered:t.notFoundTriggered,previousPathname:e.pathname}}render(){return this.state.notFoundTriggered?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("meta",{name:"robots",content:"noindex"}),!1,this.props.notFoundStyles,this.props.notFound]}):this.props.children}constructor(e){super(e),this.state={notFoundTriggered:!!e.asNotFound,previousPathname:e.pathname}}}function s(e){let{notFound:t,notFoundStyles:n,asNotFound:r,children:a}=e,s=(0,l.usePathname)(),f=(0,u.useContext)(i.MissingSlotContext);return t?(0,o.jsx)(c,{pathname:s,notFound:t,notFoundStyles:n,asNotFound:r,missingSlots:f,children:a}):(0,o.jsx)(o.Fragment,{children:a})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},52496:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{isNotFoundError:function(){return o},notFound:function(){return r}});let n="NEXT_NOT_FOUND";function r(){let e=Error(n);throw e.digest=n,e}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},43858:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PromiseQueue",{enumerable:!0,get:function(){return c}});let r=n(93449),o=n(57614);var u=o._("_maxConcurrency"),l=o._("_runningCount"),a=o._("_queue"),i=o._("_processNext");class c{enqueue(e){let t,n;let o=new Promise((e,r)=>{t=e,n=r}),u=async()=>{try{r._(this,l)[l]++;let n=await e();t(n)}catch(e){n(e)}finally{r._(this,l)[l]--,r._(this,i)[i]()}};return r._(this,a)[a].push({promiseFn:o,task:u}),r._(this,i)[i](),o}bump(e){let t=r._(this,a)[a].findIndex(t=>t.promiseFn===e);if(t>-1){let e=r._(this,a)[a].splice(t,1)[0];r._(this,a)[a].unshift(e),r._(this,i)[i](!0)}}constructor(e=5){Object.defineProperty(this,i,{value:s}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,a,{writable:!0,value:void 0}),r._(this,u)[u]=e,r._(this,l)[l]=0,r._(this,a)[a]=[]}}function s(e){if(void 0===e&&(e=!1),(r._(this,l)[l]0){var t;null==(t=r._(this,a)[a].shift())||t.task()}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},36585:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{RedirectBoundary:function(){return s},RedirectErrorBoundary:function(){return c}});let r=n(41452),o=n(57437),u=r._(n(2265)),l=n(71169),a=n(67909);function i(e){let{redirect:t,reset:n,redirectType:r}=e,o=(0,l.useRouter)();return(0,u.useEffect)(()=>{u.default.startTransition(()=>{r===a.RedirectType.push?o.push(t,{}):o.replace(t,{}),n()})},[t,r,n,o]),null}class c extends u.default.Component{static getDerivedStateFromError(e){if((0,a.isRedirectError)(e))return{redirect:(0,a.getURLFromRedirectError)(e),redirectType:(0,a.getRedirectTypeFromError)(e)};throw e}render(){let{redirect:e,redirectType:t}=this.state;return null!==e&&null!==t?(0,o.jsx)(i,{redirect:e,redirectType:t,reset:()=>this.setState({redirect:null})}):this.props.children}constructor(e){super(e),this.state={redirect:null,redirectType:null}}}function s(e){let{children:t}=e,n=(0,l.useRouter)();return(0,o.jsx)(c,{router:n,children:t})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},84785:function(e,t){"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RedirectStatusCode",{enumerable:!0,get:function(){return n}}),(r=n||(n={}))[r.SeeOther=303]="SeeOther",r[r.TemporaryRedirect=307]="TemporaryRedirect",r[r.PermanentRedirect=308]="PermanentRedirect",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},67909:function(e,t,n){"use strict";var r,o;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{RedirectType:function(){return r},getRedirectError:function(){return c},getRedirectStatusCodeFromError:function(){return y},getRedirectTypeFromError:function(){return h},getURLFromRedirectError:function(){return p},isRedirectError:function(){return d},permanentRedirect:function(){return f},redirect:function(){return s}});let u=n(58512),l=n(99440),a=n(84785),i="NEXT_REDIRECT";function c(e,t,n){void 0===n&&(n=a.RedirectStatusCode.TemporaryRedirect);let r=Error(i);r.digest=i+";"+t+";"+e+";"+n+";";let o=u.requestAsyncStorage.getStore();return o&&(r.mutableCookies=o.mutableCookies),r}function s(e,t){void 0===t&&(t="replace");let n=l.actionAsyncStorage.getStore();throw c(e,t,(null==n?void 0:n.isAction)?a.RedirectStatusCode.SeeOther:a.RedirectStatusCode.TemporaryRedirect)}function f(e,t){void 0===t&&(t="replace");let n=l.actionAsyncStorage.getStore();throw c(e,t,(null==n?void 0:n.isAction)?a.RedirectStatusCode.SeeOther:a.RedirectStatusCode.PermanentRedirect)}function d(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let[t,n,r,o]=e.digest.split(";",4),u=Number(o);return t===i&&("replace"===n||"push"===n)&&"string"==typeof r&&!isNaN(u)&&u in a.RedirectStatusCode}function p(e){return d(e)?e.digest.split(";",3)[2]:null}function h(e){if(!d(e))throw Error("Not a redirect error");return e.digest.split(";",2)[1]}function y(e){if(!d(e))throw Error("Not a redirect error");return Number(e.digest.split(";",4)[3])}(o=r||(r={})).push="push",o.replace="replace",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},61343:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let r=n(41452),o=n(57437),u=r._(n(2265)),l=n(44467);function a(){let e=(0,u.useContext)(l.TemplateContext);return(0,o.jsx)(o.Fragment,{children:e})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},58512:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{getExpectedRequestStore:function(){return o},requestAsyncStorage:function(){return r.requestAsyncStorage}});let r=n(70038);function o(e){let t=r.requestAsyncStorage.getStore();if(t)return t;throw Error("`"+e+"` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},39607:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"applyFlightData",{enumerable:!0,get:function(){return u}});let r=n(13821),o=n(41133);function u(e,t,n,u){let[l,a,i]=n.slice(-3);if(null===a)return!1;if(3===n.length){let n=a[2],o=a[3];t.loading=o,t.rsc=n,t.prefetchRsc=null,(0,r.fillLazyItemsTillLeafWithHead)(t,e,l,a,i,u)}else t.rsc=e.rsc,t.prefetchRsc=e.prefetchRsc,t.parallelRoutes=new Map(e.parallelRoutes),t.loading=e.loading,(0,o.fillCacheWithNewSubTreeData)(t,e,n,u);return!0}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},69684:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"applyRouterStatePatchToTree",{enumerable:!0,get:function(){return function e(t,n,r,a){let i;let[c,s,f,d,p]=n;if(1===t.length){let e=l(n,r,t);return(0,u.addRefreshMarkerToActiveParallelSegments)(e,a),e}let[h,y]=t;if(!(0,o.matchSegment)(h,c))return null;if(2===t.length)i=l(s[y],r,t);else if(null===(i=e(t.slice(2),s[y],r,a)))return null;let _=[t[0],{...s,[y]:i},f,d];return p&&(_[4]=!0),(0,u.addRefreshMarkerToActiveParallelSegments)(_,a),_}}});let r=n(8e4),o=n(16237),u=n(74922);function l(e,t,n){let[u,a]=e,[i,c]=t;if(i===r.DEFAULT_SEGMENT_KEY&&u!==r.DEFAULT_SEGMENT_KEY)return e;if((0,o.matchSegment)(u,i)){let t={};for(let e in a)void 0!==c[e]?t[e]=l(a[e],c[e],n):t[e]=a[e];for(let e in c)t[e]||(t[e]=c[e]);let r=[u,t];return e[2]&&(r[2]=e[2]),e[3]&&(r[3]=e[3]),e[4]&&(r[4]=e[4]),r}return t}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},99559:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"clearCacheNodeDataForSegmentPath",{enumerable:!0,get:function(){return function e(t,n,o){let u=o.length<=2,[l,a]=o,i=(0,r.createRouterCacheKey)(a),c=n.parallelRoutes.get(l),s=t.parallelRoutes.get(l);s&&s!==c||(s=new Map(c),t.parallelRoutes.set(l,s));let f=null==c?void 0:c.get(i),d=s.get(i);if(u){d&&d.lazyData&&d!==f||s.set(i,{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null});return}if(!d||!f){d||s.set(i,{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null});return}return d===f&&(d={lazyData:d.lazyData,rsc:d.rsc,prefetchRsc:d.prefetchRsc,head:d.head,prefetchHead:d.prefetchHead,parallelRoutes:new Map(d.parallelRoutes),lazyDataResolved:d.lazyDataResolved,loading:d.loading},s.set(i,d)),e(d,f,o.slice(2))}}});let r=n(81784);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},96626:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{computeChangedPath:function(){return s},extractPathFromFlightRouterState:function(){return c}});let r=n(82269),o=n(8e4),u=n(16237),l=e=>"/"===e[0]?e.slice(1):e,a=e=>"string"==typeof e?"children"===e?"":e:e[1];function i(e){return e.reduce((e,t)=>""===(t=l(t))||(0,o.isGroupSegment)(t)?e:e+"/"+t,"")||"/"}function c(e){var t;let n=Array.isArray(e[0])?e[0][1]:e[0];if(n===o.DEFAULT_SEGMENT_KEY||r.INTERCEPTION_ROUTE_MARKERS.some(e=>n.startsWith(e)))return;if(n.startsWith(o.PAGE_SEGMENT_KEY))return"";let u=[a(n)],l=null!=(t=e[1])?t:{},s=l.children?c(l.children):void 0;if(void 0!==s)u.push(s);else for(let[e,t]of Object.entries(l)){if("children"===e)continue;let n=c(t);void 0!==n&&u.push(n)}return i(u)}function s(e,t){let n=function e(t,n){let[o,l]=t,[i,s]=n,f=a(o),d=a(i);if(r.INTERCEPTION_ROUTE_MARKERS.some(e=>f.startsWith(e)||d.startsWith(e)))return"";if(!(0,u.matchSegment)(o,i)){var p;return null!=(p=c(n))?p:""}for(let t in l)if(s[t]){let n=e(l[t],s[t]);if(null!==n)return a(i)+"/"+n}return null}(e,t);return null==n||"/"===n?n:i(n.split("/"))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},53174:function(e,t){"use strict";function n(e,t){return void 0===t&&(t=!0),e.pathname+e.search+(t?e.hash:"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createHrefFromUrl",{enumerable:!0,get:function(){return n}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},50322:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createInitialRouterState",{enumerable:!0,get:function(){return c}});let r=n(53174),o=n(13821),u=n(96626),l=n(86004),a=n(51507),i=n(74922);function c(e){var t;let{buildId:n,initialTree:c,initialSeedData:s,initialCanonicalUrl:f,initialParallelRoutes:d,location:p,initialHead:h,couldBeIntercepted:y}=e,_=!p,v={lazyData:null,rsc:s[2],prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:_?new Map:d,lazyDataResolved:!1,loading:s[3]},b=p?(0,r.createHrefFromUrl)(p):f;(0,i.addRefreshMarkerToActiveParallelSegments)(c,b);let g=new Map;(null===d||0===d.size)&&(0,o.fillLazyItemsTillLeafWithHead)(v,void 0,c,s,h);let m={buildId:n,tree:c,cache:v,prefetchCache:g,pushRef:{pendingPush:!1,mpaNavigation:!1,preserveCustomHistoryState:!0},focusAndScrollRef:{apply:!1,onlyHashChange:!1,hashFragment:null,segmentPaths:[]},canonicalUrl:b,nextUrl:null!=(t=(0,u.extractPathFromFlightRouterState)(c)||(null==p?void 0:p.pathname))?t:null};if(p){let e=new URL(p.pathname,p.origin),t=[["",c,null,null]];(0,l.createPrefetchCacheEntryForInitialLoad)({url:e,kind:a.PrefetchKind.AUTO,data:[t,void 0,!1,y],tree:m.tree,prefetchCache:m.prefetchCache,nextUrl:m.nextUrl})}return m}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},81784:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createRouterCacheKey",{enumerable:!0,get:function(){return o}});let r=n(8e4);function o(e,t){return(void 0===t&&(t=!1),Array.isArray(e))?e[0]+"|"+e[1]+"|"+e[2]:t&&e.startsWith(r.PAGE_SEGMENT_KEY)?r.PAGE_SEGMENT_KEY:e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},41283:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fetchServerResponse",{enumerable:!0,get:function(){return s}});let r=n(77325),o=n(95751),u=n(74590),l=n(51507),a=n(54736),{createFromFetch:i}=n(6671);function c(e){return[(0,o.urlToUrlWithoutFlightMarker)(e).toString(),void 0,!1,!1]}async function s(e,t,n,s,f){let d={[r.RSC_HEADER]:"1",[r.NEXT_ROUTER_STATE_TREE]:encodeURIComponent(JSON.stringify(t))};f===l.PrefetchKind.AUTO&&(d[r.NEXT_ROUTER_PREFETCH_HEADER]="1"),n&&(d[r.NEXT_URL]=n);let p=(0,a.hexHash)([d[r.NEXT_ROUTER_PREFETCH_HEADER]||"0",d[r.NEXT_ROUTER_STATE_TREE],d[r.NEXT_URL]].join(","));try{var h;let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="index.txt":t.pathname+=".txt",t.searchParams.set(r.NEXT_RSC_UNION_QUERY,p);let n=await fetch(t,{credentials:"same-origin",headers:d}),l=(0,o.urlToUrlWithoutFlightMarker)(n.url),a=n.redirected?l:void 0,f=n.headers.get("content-type")||"",y=!!n.headers.get(r.NEXT_DID_POSTPONE_HEADER),_=!!(null==(h=n.headers.get("vary"))?void 0:h.includes(r.NEXT_URL)),v=f===r.RSC_CONTENT_TYPE_HEADER;if(v||(v=f.startsWith("text/plain")),!v||!n.ok)return e.hash&&(l.hash=e.hash),c(l.toString());let[b,g]=await i(Promise.resolve(n),{callServer:u.callServer});if(s!==b)return c(n.url);return[g,a,y,_]}catch(t){return console.error("Failed to fetch RSC payload for "+e+". Falling back to browser navigation.",t),[e.toString(),void 0,!1,!1]}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},41133:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fillCacheWithNewSubTreeData",{enumerable:!0,get:function(){return function e(t,n,l,a){let i=l.length<=5,[c,s]=l,f=(0,u.createRouterCacheKey)(s),d=n.parallelRoutes.get(c);if(!d)return;let p=t.parallelRoutes.get(c);p&&p!==d||(p=new Map(d),t.parallelRoutes.set(c,p));let h=d.get(f),y=p.get(f);if(i){if(!y||!y.lazyData||y===h){let e=l[3];y={lazyData:null,rsc:e[2],prefetchRsc:null,head:null,prefetchHead:null,loading:e[3],parallelRoutes:h?new Map(h.parallelRoutes):new Map,lazyDataResolved:!1},h&&(0,r.invalidateCacheByRouterState)(y,h,l[2]),(0,o.fillLazyItemsTillLeafWithHead)(y,h,l[2],e,l[4],a),p.set(f,y)}return}y&&h&&(y===h&&(y={lazyData:y.lazyData,rsc:y.rsc,prefetchRsc:y.prefetchRsc,head:y.head,prefetchHead:y.prefetchHead,parallelRoutes:new Map(y.parallelRoutes),lazyDataResolved:!1,loading:y.loading},p.set(f,y)),e(y,h,l.slice(2),a))}}});let r=n(74213),o=n(13821),u=n(81784);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},13821:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fillLazyItemsTillLeafWithHead",{enumerable:!0,get:function(){return function e(t,n,u,l,a,i){if(0===Object.keys(u[1]).length){t.head=a;return}for(let c in u[1]){let s;let f=u[1][c],d=f[0],p=(0,r.createRouterCacheKey)(d),h=null!==l&&void 0!==l[1][c]?l[1][c]:null;if(n){let r=n.parallelRoutes.get(c);if(r){let n;let u=(null==i?void 0:i.kind)==="auto"&&i.status===o.PrefetchCacheEntryStatus.reusable,l=new Map(r),s=l.get(p);n=null!==h?{lazyData:null,rsc:h[2],prefetchRsc:null,head:null,prefetchHead:null,loading:h[3],parallelRoutes:new Map(null==s?void 0:s.parallelRoutes),lazyDataResolved:!1}:u&&s?{lazyData:s.lazyData,rsc:s.rsc,prefetchRsc:s.prefetchRsc,head:s.head,prefetchHead:s.prefetchHead,parallelRoutes:new Map(s.parallelRoutes),lazyDataResolved:s.lazyDataResolved,loading:s.loading}:{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map(null==s?void 0:s.parallelRoutes),lazyDataResolved:!1,loading:null},l.set(p,n),e(n,s,f,h||null,a,i),t.parallelRoutes.set(c,l);continue}}if(null!==h){let e=h[2],t=h[3];s={lazyData:null,rsc:e,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:t}}else s={lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null};let y=t.parallelRoutes.get(c);y?y.set(p,s):t.parallelRoutes.set(c,new Map([[p,s]])),e(s,void 0,f,h,a,i)}}}});let r=n(81784),o=n(51507);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},36416:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleMutable",{enumerable:!0,get:function(){return u}});let r=n(96626);function o(e){return void 0!==e}function u(e,t){var n,u,l;let a=null==(u=t.shouldScroll)||u,i=e.nextUrl;if(o(t.patchedTree)){let n=(0,r.computeChangedPath)(e.tree,t.patchedTree);n?i=n:i||(i=e.canonicalUrl)}return{buildId:e.buildId,canonicalUrl:o(t.canonicalUrl)?t.canonicalUrl===e.canonicalUrl?e.canonicalUrl:t.canonicalUrl:e.canonicalUrl,pushRef:{pendingPush:o(t.pendingPush)?t.pendingPush:e.pushRef.pendingPush,mpaNavigation:o(t.mpaNavigation)?t.mpaNavigation:e.pushRef.mpaNavigation,preserveCustomHistoryState:o(t.preserveCustomHistoryState)?t.preserveCustomHistoryState:e.pushRef.preserveCustomHistoryState},focusAndScrollRef:{apply:!!a&&(!!o(null==t?void 0:t.scrollableSegments)||e.focusAndScrollRef.apply),onlyHashChange:!!t.hashFragment&&e.canonicalUrl.split("#",1)[0]===(null==(n=t.canonicalUrl)?void 0:n.split("#",1)[0]),hashFragment:a?t.hashFragment&&""!==t.hashFragment?decodeURIComponent(t.hashFragment.slice(1)):e.focusAndScrollRef.hashFragment:null,segmentPaths:a?null!=(l=null==t?void 0:t.scrollableSegments)?l:e.focusAndScrollRef.segmentPaths:[]},cache:t.cache?t.cache:e.cache,prefetchCache:t.prefetchCache?t.prefetchCache:e.prefetchCache,tree:o(t.patchedTree)?t.patchedTree:e.tree,nextUrl:i}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},40774:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleSegmentMismatch",{enumerable:!0,get:function(){return o}});let r=n(51294);function o(e,t,n){return(0,r.handleExternalUrl)(e,{},e.canonicalUrl,!0)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},9863:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"invalidateCacheBelowFlightSegmentPath",{enumerable:!0,get:function(){return function e(t,n,o){let u=o.length<=2,[l,a]=o,i=(0,r.createRouterCacheKey)(a),c=n.parallelRoutes.get(l);if(!c)return;let s=t.parallelRoutes.get(l);if(s&&s!==c||(s=new Map(c),t.parallelRoutes.set(l,s)),u){s.delete(i);return}let f=c.get(i),d=s.get(i);d&&f&&(d===f&&(d={lazyData:d.lazyData,rsc:d.rsc,prefetchRsc:d.prefetchRsc,head:d.head,prefetchHead:d.prefetchHead,parallelRoutes:new Map(d.parallelRoutes),lazyDataResolved:d.lazyDataResolved},s.set(i,d)),e(d,f,o.slice(2)))}}});let r=n(81784);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},74213:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"invalidateCacheByRouterState",{enumerable:!0,get:function(){return o}});let r=n(81784);function o(e,t,n){for(let o in n[1]){let u=n[1][o][0],l=(0,r.createRouterCacheKey)(u),a=t.parallelRoutes.get(o);if(a){let t=new Map(a);t.delete(l),e.parallelRoutes.set(o,t)}}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},10139:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isNavigatingToNewRootLayout",{enumerable:!0,get:function(){return function e(t,n){let r=t[0],o=n[0];if(Array.isArray(r)&&Array.isArray(o)){if(r[0]!==o[0]||r[2]!==o[2])return!0}else if(r!==o)return!0;if(t[4])return!n[4];if(n[4])return!0;let u=Object.values(t[1])[0],l=Object.values(n[1])[0];return!u||!l||e(u,l)}}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},93060:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{abortTask:function(){return c},listenForDynamicRequest:function(){return a},updateCacheNodeOnNavigation:function(){return function e(t,n,a,c,s){let f=n[1],d=a[1],p=c[1],h=t.parallelRoutes,y=new Map(h),_={},v=null;for(let t in d){let n;let a=d[t],c=f[t],b=h.get(t),g=p[t],m=a[0],R=(0,u.createRouterCacheKey)(m),P=void 0!==c?c[0]:void 0,j=void 0!==b?b.get(R):void 0;if(null!==(n=m===r.PAGE_SEGMENT_KEY?l(a,void 0!==g?g:null,s):m===r.DEFAULT_SEGMENT_KEY?void 0!==c?{route:c,node:null,children:null}:l(a,void 0!==g?g:null,s):void 0!==P&&(0,o.matchSegment)(m,P)&&void 0!==j&&void 0!==c?null!=g?e(j,c,a,g,s):function(e){let t=i(e,null,null);return{route:e,node:t,children:null}}(a):l(a,void 0!==g?g:null,s))){null===v&&(v=new Map),v.set(t,n);let e=n.node;if(null!==e){let n=new Map(b);n.set(R,e),y.set(t,n)}_[t]=n.route}else _[t]=a}if(null===v)return null;let b={lazyData:null,rsc:t.rsc,prefetchRsc:t.prefetchRsc,head:t.head,prefetchHead:t.prefetchHead,loading:t.loading,parallelRoutes:y,lazyDataResolved:!1};return{route:function(e,t){let n=[e[0],t];return 2 in e&&(n[2]=e[2]),3 in e&&(n[3]=e[3]),4 in e&&(n[4]=e[4]),n}(a,_),node:b,children:v}}},updateCacheNodeOnPopstateRestoration:function(){return function e(t,n){let r=n[1],o=t.parallelRoutes,l=new Map(o);for(let t in r){let n=r[t],a=n[0],i=(0,u.createRouterCacheKey)(a),c=o.get(t);if(void 0!==c){let r=c.get(i);if(void 0!==r){let o=e(r,n),u=new Map(c);u.set(i,o),l.set(t,u)}}}let a=t.rsc,i=d(a)&&"pending"===a.status;return{lazyData:null,rsc:a,head:t.head,prefetchHead:i?t.prefetchHead:null,prefetchRsc:i?t.prefetchRsc:null,loading:i?t.loading:null,parallelRoutes:l,lazyDataResolved:!1}}}});let r=n(8e4),o=n(16237),u=n(81784);function l(e,t,n){let r=i(e,t,n);return{route:e,node:r,children:null}}function a(e,t){t.then(t=>{for(let n of t[0]){let t=n.slice(0,-3),r=n[n.length-3],l=n[n.length-2],a=n[n.length-1];"string"!=typeof t&&function(e,t,n,r,l){let a=e;for(let e=0;e{c(e,t)})}function i(e,t,n){let r=e[1],o=null!==t?t[1]:null,l=new Map;for(let e in r){let t=r[e],a=null!==o?o[e]:null,c=t[0],s=(0,u.createRouterCacheKey)(c),f=i(t,void 0===a?null:a,n),d=new Map;d.set(s,f),l.set(e,d)}let a=0===l.size,c=null!==t?t[2]:null,s=null!==t?t[3]:null;return{lazyData:null,parallelRoutes:l,prefetchRsc:void 0!==c?c:null,prefetchHead:a?n:null,loading:void 0!==s?s:null,rsc:p(),head:a?p():null,lazyDataResolved:!1}}function c(e,t){let n=e.node;if(null===n)return;let r=e.children;if(null===r)s(e.route,n,t);else for(let e of r.values())c(e,t);e.node=null}function s(e,t,n){let r=e[1],o=t.parallelRoutes;for(let e in r){let t=r[e],l=o.get(e);if(void 0===l)continue;let a=t[0],i=(0,u.createRouterCacheKey)(a),c=l.get(i);void 0!==c&&s(t,c,n)}let l=t.rsc;d(l)&&(null===n?l.resolve(null):l.reject(n));let a=t.head;d(a)&&a.resolve(null)}let f=Symbol();function d(e){return e&&e.tag===f}function p(){let e,t;let n=new Promise((n,r)=>{e=n,t=r});return n.status="pending",n.resolve=t=>{"pending"===n.status&&(n.status="fulfilled",n.value=t,e(t))},n.reject=e=>{"pending"===n.status&&(n.status="rejected",n.reason=e,t(e))},n.tag=f,n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},86004:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createPrefetchCacheEntryForInitialLoad:function(){return c},getOrCreatePrefetchCacheEntry:function(){return i},prunePrefetchCache:function(){return f}});let r=n(53174),o=n(41283),u=n(51507),l=n(59218);function a(e,t){let n=(0,r.createHrefFromUrl)(e,!1);return t?t+"%"+n:n}function i(e){let t,{url:n,nextUrl:r,tree:o,buildId:l,prefetchCache:i,kind:c}=e,f=a(n,r),d=i.get(f);if(d)t=d;else{let e=a(n),r=i.get(e);r&&(t=r)}return t?(t.status=h(t),t.kind!==u.PrefetchKind.FULL&&c===u.PrefetchKind.FULL)?s({tree:o,url:n,buildId:l,nextUrl:r,prefetchCache:i,kind:null!=c?c:u.PrefetchKind.TEMPORARY}):(c&&t.kind===u.PrefetchKind.TEMPORARY&&(t.kind=c),t):s({tree:o,url:n,buildId:l,nextUrl:r,prefetchCache:i,kind:c||u.PrefetchKind.TEMPORARY})}function c(e){let{nextUrl:t,tree:n,prefetchCache:r,url:o,kind:l,data:i}=e,[,,,c]=i,s=c?a(o,t):a(o),f={treeAtTimeOfPrefetch:n,data:Promise.resolve(i),kind:l,prefetchTime:Date.now(),lastUsedTime:Date.now(),key:s,status:u.PrefetchCacheEntryStatus.fresh};return r.set(s,f),f}function s(e){let{url:t,kind:n,tree:r,nextUrl:i,buildId:c,prefetchCache:s}=e,f=a(t),d=l.prefetchQueue.enqueue(()=>(0,o.fetchServerResponse)(t,r,i,c,n).then(e=>{let[,,,n]=e;return n&&function(e){let{url:t,nextUrl:n,prefetchCache:r}=e,o=a(t),u=r.get(o);if(!u)return;let l=a(t,n);r.set(l,u),r.delete(o)}({url:t,nextUrl:i,prefetchCache:s}),e})),p={treeAtTimeOfPrefetch:r,data:d,kind:n,prefetchTime:Date.now(),lastUsedTime:null,key:f,status:u.PrefetchCacheEntryStatus.fresh};return s.set(f,p),p}function f(e){for(let[t,n]of e)h(n)===u.PrefetchCacheEntryStatus.expired&&e.delete(t)}let d=1e3*Number("30"),p=1e3*Number("300");function h(e){let{kind:t,prefetchTime:n,lastUsedTime:r}=e;return Date.now()<(null!=r?r:n)+d?r?u.PrefetchCacheEntryStatus.reusable:u.PrefetchCacheEntryStatus.fresh:"auto"===t&&Date.now(){let[n,f]=t,h=!1;if(S.lastUsedTime||(S.lastUsedTime=Date.now(),h=!0),"string"==typeof n)return _(e,R,n,O);if(document.getElementById("__next-page-redirect"))return _(e,R,j,O);let b=e.tree,g=e.cache,w=[];for(let t of n){let n=t.slice(0,-4),r=t.slice(-3)[0],c=["",...n],f=(0,u.applyRouterStatePatchToTree)(c,b,r,j);if(null===f&&(f=(0,u.applyRouterStatePatchToTree)(c,E,r,j)),null!==f){if((0,a.isNavigatingToNewRootLayout)(b,f))return _(e,R,j,O);let u=(0,d.createEmptyCacheNode)(),m=!1;for(let e of(S.status!==i.PrefetchCacheEntryStatus.stale||h?m=(0,s.applyFlightData)(g,u,t,S):(m=function(e,t,n,r){let o=!1;for(let u of(e.rsc=t.rsc,e.prefetchRsc=t.prefetchRsc,e.loading=t.loading,e.parallelRoutes=new Map(t.parallelRoutes),v(r).map(e=>[...n,...e])))(0,y.clearCacheNodeDataForSegmentPath)(e,t,u),o=!0;return o}(u,g,n,r),S.lastUsedTime=Date.now()),(0,l.shouldHardNavigate)(c,b)?(u.rsc=g.rsc,u.prefetchRsc=g.prefetchRsc,(0,o.invalidateCacheBelowFlightSegmentPath)(u,g,n),R.cache=u):m&&(R.cache=u),b=f,v(r))){let t=[...n,...e];t[t.length-1]!==p.DEFAULT_SEGMENT_KEY&&w.push(t)}}}return R.patchedTree=b,R.canonicalUrl=f?(0,r.createHrefFromUrl)(f):j,R.pendingPush=O,R.scrollableSegments=w,R.hashFragment=P,R.shouldScroll=m,(0,c.handleMutable)(e,R)},()=>e)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},59218:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{prefetchQueue:function(){return l},prefetchReducer:function(){return a}});let r=n(77325),o=n(43858),u=n(86004),l=new o.PromiseQueue(5);function a(e,t){(0,u.prunePrefetchCache)(e.prefetchCache);let{url:n}=t;return n.searchParams.delete(r.NEXT_RSC_UNION_QUERY),(0,u.getOrCreatePrefetchCacheEntry)({url:n,nextUrl:e.nextUrl,prefetchCache:e.prefetchCache,kind:t.kind,tree:e.tree,buildId:e.buildId}),e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},75239:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"refreshReducer",{enumerable:!0,get:function(){return h}});let r=n(41283),o=n(53174),u=n(69684),l=n(10139),a=n(51294),i=n(36416),c=n(13821),s=n(95751),f=n(40774),d=n(35914),p=n(74922);function h(e,t){let{origin:n}=t,h={},y=e.canonicalUrl,_=e.tree;h.preserveCustomHistoryState=!1;let v=(0,s.createEmptyCacheNode)(),b=(0,d.hasInterceptionRouteInCurrentTree)(e.tree);return v.lazyData=(0,r.fetchServerResponse)(new URL(y,n),[_[0],_[1],_[2],"refetch"],b?e.nextUrl:null,e.buildId),v.lazyData.then(async n=>{let[r,s]=n;if("string"==typeof r)return(0,a.handleExternalUrl)(e,h,r,e.pushRef.pendingPush);for(let n of(v.lazyData=null,r)){if(3!==n.length)return console.log("REFRESH FAILED"),e;let[r]=n,i=(0,u.applyRouterStatePatchToTree)([""],_,r,e.canonicalUrl);if(null===i)return(0,f.handleSegmentMismatch)(e,t,r);if((0,l.isNavigatingToNewRootLayout)(_,i))return(0,a.handleExternalUrl)(e,h,y,e.pushRef.pendingPush);let d=s?(0,o.createHrefFromUrl)(s):void 0;s&&(h.canonicalUrl=d);let[g,m]=n.slice(-2);if(null!==g){let e=g[2];v.rsc=e,v.prefetchRsc=null,(0,c.fillLazyItemsTillLeafWithHead)(v,void 0,r,g,m),h.prefetchCache=new Map}await (0,p.refreshInactiveParallelSegments)({state:e,updatedTree:i,updatedCache:v,includeNextUrl:b}),h.cache=v,h.patchedTree=i,h.canonicalUrl=y,_=i}return(0,i.handleMutable)(e,h)},()=>e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6131:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"restoreReducer",{enumerable:!0,get:function(){return u}});let r=n(53174),o=n(96626);function u(e,t){var n;let{url:u,tree:l}=t,a=(0,r.createHrefFromUrl)(u),i=l||e.tree,c=e.cache;return{buildId:e.buildId,canonicalUrl:a,pushRef:{pendingPush:!1,mpaNavigation:!1,preserveCustomHistoryState:!0},focusAndScrollRef:e.focusAndScrollRef,cache:c,prefetchCache:e.prefetchCache,tree:i,nextUrl:null!=(n=(0,o.extractPathFromFlightRouterState)(i))?n:u.pathname}}n(93060),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},64549:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"serverActionReducer",{enumerable:!0,get:function(){return g}});let r=n(74590),o=n(77325),u=n(4897),l=n(53174),a=n(51294),i=n(69684),c=n(10139),s=n(36416),f=n(13821),d=n(95751),p=n(35914),h=n(40774),y=n(74922),{createFromFetch:_,encodeReply:v}=n(6671);async function b(e,t,n){let l,{actionId:a,actionArgs:i}=n,c=await v(i),s=await fetch("",{method:"POST",headers:{Accept:o.RSC_CONTENT_TYPE_HEADER,[o.ACTION]:a,[o.NEXT_ROUTER_STATE_TREE]:encodeURIComponent(JSON.stringify(e.tree)),...t?{[o.NEXT_URL]:t}:{}},body:c}),f=s.headers.get("x-action-redirect");try{let e=JSON.parse(s.headers.get("x-action-revalidated")||"[[],0,0]");l={paths:e[0]||[],tag:!!e[1],cookie:e[2]}}catch(e){l={paths:[],tag:!1,cookie:!1}}let d=f?new URL((0,u.addBasePath)(f),new URL(e.canonicalUrl,window.location.href)):void 0;if(s.headers.get("content-type")===o.RSC_CONTENT_TYPE_HEADER){let e=await _(Promise.resolve(s),{callServer:r.callServer});if(f){let[,t]=null!=e?e:[];return{actionFlightData:t,redirectLocation:d,revalidatedParts:l}}let[t,[,n]]=null!=e?e:[];return{actionResult:t,actionFlightData:n,redirectLocation:d,revalidatedParts:l}}return{redirectLocation:d,revalidatedParts:l}}function g(e,t){let{resolve:n,reject:r}=t,o={},u=e.canonicalUrl,_=e.tree;o.preserveCustomHistoryState=!1;let v=e.nextUrl&&(0,p.hasInterceptionRouteInCurrentTree)(e.tree)?e.nextUrl:null;return o.inFlightServerAction=b(e,v,t),o.inFlightServerAction.then(async r=>{let{actionResult:p,actionFlightData:b,redirectLocation:g}=r;if(g&&(e.pushRef.pendingPush=!0,o.pendingPush=!0),!b)return(n(p),g)?(0,a.handleExternalUrl)(e,o,g.href,e.pushRef.pendingPush):e;if("string"==typeof b)return(0,a.handleExternalUrl)(e,o,b,e.pushRef.pendingPush);for(let n of(o.inFlightServerAction=null,b)){if(3!==n.length)return console.log("SERVER ACTION APPLY FAILED"),e;let[r]=n,s=(0,i.applyRouterStatePatchToTree)([""],_,r,g?(0,l.createHrefFromUrl)(g):e.canonicalUrl);if(null===s)return(0,h.handleSegmentMismatch)(e,t,r);if((0,c.isNavigatingToNewRootLayout)(_,s))return(0,a.handleExternalUrl)(e,o,u,e.pushRef.pendingPush);let[p,b]=n.slice(-2),m=null!==p?p[2]:null;if(null!==m){let t=(0,d.createEmptyCacheNode)();t.rsc=m,t.prefetchRsc=null,(0,f.fillLazyItemsTillLeafWithHead)(t,void 0,r,p,b),await (0,y.refreshInactiveParallelSegments)({state:e,updatedTree:s,updatedCache:t,includeNextUrl:!!v}),o.cache=t,o.prefetchCache=new Map}o.patchedTree=s,o.canonicalUrl=u,_=s}if(g){let e=(0,l.createHrefFromUrl)(g,!1);o.canonicalUrl=e}return n(p),(0,s.handleMutable)(e,o)},t=>(r(t),e))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},98289:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"serverPatchReducer",{enumerable:!0,get:function(){return f}});let r=n(53174),o=n(69684),u=n(10139),l=n(51294),a=n(39607),i=n(36416),c=n(95751),s=n(40774);function f(e,t){let{serverResponse:n}=t,[f,d]=n,p={};if(p.preserveCustomHistoryState=!1,"string"==typeof f)return(0,l.handleExternalUrl)(e,p,f,e.pushRef.pendingPush);let h=e.tree,y=e.cache;for(let n of f){let i=n.slice(0,-4),[f]=n.slice(-3,-2),_=(0,o.applyRouterStatePatchToTree)(["",...i],h,f,e.canonicalUrl);if(null===_)return(0,s.handleSegmentMismatch)(e,t,f);if((0,u.isNavigatingToNewRootLayout)(h,_))return(0,l.handleExternalUrl)(e,p,e.canonicalUrl,e.pushRef.pendingPush);let v=d?(0,r.createHrefFromUrl)(d):void 0;v&&(p.canonicalUrl=v);let b=(0,c.createEmptyCacheNode)();(0,a.applyFlightData)(y,b,n),p.patchedTree=_,p.cache=b,y=b,h=_}return(0,i.handleMutable)(e,p)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},74922:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{addRefreshMarkerToActiveParallelSegments:function(){return function e(t,n){let[r,o,,l]=t;for(let a in r.includes(u.PAGE_SEGMENT_KEY)&&"refresh"!==l&&(t[2]=n,t[3]="refresh"),o)e(o[a],n)}},refreshInactiveParallelSegments:function(){return l}});let r=n(39607),o=n(41283),u=n(8e4);async function l(e){let t=new Set;await a({...e,rootTree:e.updatedTree,fetchedSegments:t})}async function a(e){let{state:t,updatedTree:n,updatedCache:u,includeNextUrl:l,fetchedSegments:i,rootTree:c=n}=e,[,s,f,d]=n,p=[];if(f&&f!==location.pathname+location.search&&"refresh"===d&&!i.has(f)){i.add(f);let e=(0,o.fetchServerResponse)(new URL(f,location.origin),[c[0],c[1],c[2],"refetch"],l?t.nextUrl:null,t.buildId).then(e=>{let t=e[0];if("string"!=typeof t)for(let e of t)(0,r.applyFlightData)(u,u,e)});p.push(e)}for(let e in s){let n=a({state:t,updatedTree:s[e],updatedCache:u,includeNextUrl:l,fetchedSegments:i,rootTree:c});p.push(n)}await Promise.all(p)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},51507:function(e,t){"use strict";var n,r,o,u;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ACTION_FAST_REFRESH:function(){return f},ACTION_NAVIGATE:function(){return a},ACTION_PREFETCH:function(){return s},ACTION_REFRESH:function(){return l},ACTION_RESTORE:function(){return i},ACTION_SERVER_ACTION:function(){return d},ACTION_SERVER_PATCH:function(){return c},PrefetchCacheEntryStatus:function(){return r},PrefetchKind:function(){return n},isThenable:function(){return p}});let l="refresh",a="navigate",i="restore",c="server-patch",s="prefetch",f="fast-refresh",d="server-action";function p(e){return e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}(o=n||(n={})).AUTO="auto",o.FULL="full",o.TEMPORARY="temporary",(u=r||(r={})).fresh="fresh",u.reusable="reusable",u.expired="expired",u.stale="stale",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},80643:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"reducer",{enumerable:!0,get:function(){return f}});let r=n(51507),o=n(51294),u=n(98289),l=n(6131),a=n(75239),i=n(59218),c=n(51129),s=n(64549),f="undefined"==typeof window?function(e,t){return e}:function(e,t){switch(t.type){case r.ACTION_NAVIGATE:return(0,o.navigateReducer)(e,t);case r.ACTION_SERVER_PATCH:return(0,u.serverPatchReducer)(e,t);case r.ACTION_RESTORE:return(0,l.restoreReducer)(e,t);case r.ACTION_REFRESH:return(0,a.refreshReducer)(e,t);case r.ACTION_FAST_REFRESH:return(0,c.fastRefreshReducer)(e,t);case r.ACTION_PREFETCH:return(0,i.prefetchReducer)(e,t);case r.ACTION_SERVER_ACTION:return(0,s.serverActionReducer)(e,t);default:throw Error("Unknown action")}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},54740:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"shouldHardNavigate",{enumerable:!0,get:function(){return function e(t,n){let[o,u]=n,[l,a]=t;return(0,r.matchSegment)(l,o)?!(t.length<=2)&&e(t.slice(2),u[a]):!!Array.isArray(l)}}});let r=n(16237);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8897:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createDynamicallyTrackedSearchParams:function(){return a},createUntrackedSearchParams:function(){return l}});let r=n(44936),o=n(62441),u=n(67991);function l(e){let t=r.staticGenerationAsyncStorage.getStore();return t&&t.forceStatic?{}:e}function a(e){let t=r.staticGenerationAsyncStorage.getStore();return t?t.forceStatic?{}:t.isStaticGeneration||t.dynamicShouldError?new Proxy({},{get:(e,n,r)=>("string"==typeof n&&(0,o.trackDynamicDataAccessed)(t,"searchParams."+n),u.ReflectAdapter.get(e,n,r)),has:(e,n)=>("string"==typeof n&&(0,o.trackDynamicDataAccessed)(t,"searchParams."+n),Reflect.has(e,n)),ownKeys:e=>((0,o.trackDynamicDataAccessed)(t,"searchParams"),Reflect.ownKeys(e))}):e:e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},44936:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"staticGenerationAsyncStorage",{enumerable:!0,get:function(){return r.staticGenerationAsyncStorage}});let r=n(77685);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},85108:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{StaticGenBailoutError:function(){return r},isStaticGenBailoutError:function(){return o}});let n="NEXT_STATIC_GEN_BAILOUT";class r extends Error{constructor(...e){super(...e),this.code=n}}function o(e){return"object"==typeof e&&null!==e&&"code"in e&&e.code===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},91108:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unresolvedThenable",{enumerable:!0,get:function(){return n}});let n={then:()=>{}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},42114:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{useReducerWithReduxDevtools:function(){return i},useUnwrapState:function(){return a}});let r=n(41452)._(n(2265)),o=n(51507),u=n(21427);function l(e){if(e instanceof Map){let t={};for(let[n,r]of e.entries()){if("function"==typeof r){t[n]="fn()";continue}if("object"==typeof r&&null!==r){if(r.$$typeof){t[n]=r.$$typeof.toString();continue}if(r._bundlerConfig){t[n]="FlightData";continue}}t[n]=l(r)}return t}if("object"==typeof e&&null!==e){let t={};for(let n in e){let r=e[n];if("function"==typeof r){t[n]="fn()";continue}if("object"==typeof r&&null!==r){if(r.$$typeof){t[n]=r.$$typeof.toString();continue}if(r.hasOwnProperty("_bundlerConfig")){t[n]="FlightData";continue}}t[n]=l(r)}return t}return Array.isArray(e)?e.map(l):e}function a(e){return(0,o.isThenable)(e)?(0,r.use)(e):e}let i="undefined"!=typeof window?function(e){let[t,n]=r.default.useState(e),o=(0,r.useContext)(u.ActionQueueContext);if(!o)throw Error("Invariant: Missing ActionQueueContext");let a=(0,r.useRef)(),i=(0,r.useRef)();return(0,r.useEffect)(()=>{if(!a.current&&!1!==i.current){if(void 0===i.current&&void 0===window.__REDUX_DEVTOOLS_EXTENSION__){i.current=!1;return}return a.current=window.__REDUX_DEVTOOLS_EXTENSION__.connect({instanceId:8e3,name:"next-router"}),a.current&&(a.current.init(l(e)),o&&(o.devToolsInstance=a.current)),()=>{a.current=void 0}}},[e,o]),[t,(0,r.useCallback)(t=>{o.state||(o.state=e),o.dispatch(t,n)},[o,e]),(0,r.useCallback)(e=>{a.current&&a.current.send({type:"RENDER_SYNC"},l(e))},[])]}:function(e){return[e,()=>{},()=>{}]};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},49404:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hasBasePath",{enumerable:!0,get:function(){return o}});let r=n(55121);function o(e){return(0,r.pathHasPrefix)(e,"")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},18157:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"normalizePathTrailingSlash",{enumerable:!0,get:function(){return u}});let r=n(67741),o=n(31465),u=e=>{if(!e.startsWith("/"))return e;let{pathname:t,query:n,hash:u}=(0,o.parsePath)(e);return""+(0,r.removeTrailingSlash)(t)+n+u};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},16124:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o}});let r=n(55592);function o(e){let t="function"==typeof reportError?reportError:e=>{window.console.error(e)};(0,r.isBailoutToCSRError)(e)||t(e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},97599:function(e,t,n){"use strict";function r(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeBasePath",{enumerable:!0,get:function(){return r}}),n(49404),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},99176:function(e,t){"use strict";function n(e,t){var n=e.length;for(e.push(t);0>>1,o=e[r];if(0>>1;ru(i,n))cu(s,i)?(e[r]=s,e[c]=n,r=c):(e[r]=i,e[a]=n,r=a);else if(cu(s,n))e[r]=s,e[c]=n,r=c;else break}}return t}function u(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,a=performance;t.unstable_now=function(){return a.now()}}else{var i=Date,c=i.now();t.unstable_now=function(){return i.now()-c}}var s=[],f=[],d=1,p=null,h=3,y=!1,_=!1,v=!1,b="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,m="undefined"!=typeof setImmediate?setImmediate:null;function R(e){for(var t=r(f);null!==t;){if(null===t.callback)o(f);else if(t.startTime<=e)o(f),t.sortIndex=t.expirationTime,n(s,t);else break;t=r(f)}}function P(e){if(v=!1,R(e),!_){if(null!==r(s))_=!0,C();else{var t=r(f);null!==t&&A(P,t.startTime-e)}}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var j=!1,O=-1,S=5,E=-1;function w(){return!(t.unstable_now()-Ee&&w());){var a=p.callback;if("function"==typeof a){p.callback=null,h=p.priorityLevel;var i=a(p.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof i){p.callback=i,R(e),n=!0;break t}p===r(s)&&o(s),R(e)}else o(s);p=r(s)}if(null!==p)n=!0;else{var c=r(f);null!==c&&A(P,c.startTime-e),n=!1}}break e}finally{p=null,h=u,y=!1}n=void 0}}finally{n?l():j=!1}}}if("function"==typeof m)l=function(){m(T)};else if("undefined"!=typeof MessageChannel){var M=new MessageChannel,x=M.port2;M.port1.onmessage=T,l=function(){x.postMessage(null)}}else l=function(){b(T,0)};function C(){j||(j=!0,l())}function A(e,n){O=b(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){_||y||(_=!0,C())},t.unstable_forceFrameRate=function(e){0>e||125l?(e.sortIndex=u,n(f,e),null===r(s)&&e===r(f)&&(v?(g(O),O=-1):v=!0,A(P,u-l))):(e.sortIndex=a,n(s,e),_||y||(_=!0,C())),e},t.unstable_shouldYield=w,t.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}},85689:function(e,t,n){"use strict";e.exports=n(99176)},11358:function(e,t){"use strict";function n(e){return new URL(e,"http://n").pathname}function r(e){return/https?:\/\//.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{getPathname:function(){return n},isFullStringUrl:function(){return r}})},62441:function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{Postpone:function(){return d},createPostponedAbortSignal:function(){return b},createPrerenderState:function(){return c},formatDynamicAPIAccesses:function(){return _},markCurrentScopeAsDynamic:function(){return s},trackDynamicDataAccessed:function(){return f},trackDynamicFetch:function(){return p},usedDynamicAPIs:function(){return y}});let o=(r=n(2265))&&r.__esModule?r:{default:r},u=n(57910),l=n(85108),a=n(11358),i="function"==typeof o.default.unstable_postpone;function c(e){return{isDebugSkeleton:e,dynamicAccesses:[]}}function s(e,t){let n=(0,a.getPathname)(e.urlPathname);if(!e.isUnstableCacheCallback){if(e.dynamicShouldError)throw new l.StaticGenBailoutError(`Route ${n} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);if(e.prerenderState)h(e.prerenderState,t,n);else if(e.revalidate=0,e.isStaticGeneration){let r=new u.DynamicServerError(`Route ${n} couldn't be rendered statically because it used ${t}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`);throw e.dynamicUsageDescription=t,e.dynamicUsageStack=r.stack,r}}}function f(e,t){let n=(0,a.getPathname)(e.urlPathname);if(e.isUnstableCacheCallback)throw Error(`Route ${n} used "${t}" inside a function cached with "unstable_cache(...)". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "${t}" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`);if(e.dynamicShouldError)throw new l.StaticGenBailoutError(`Route ${n} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);if(e.prerenderState)h(e.prerenderState,t,n);else if(e.revalidate=0,e.isStaticGeneration){let r=new u.DynamicServerError(`Route ${n} couldn't be rendered statically because it used ${t}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`);throw e.dynamicUsageDescription=t,e.dynamicUsageStack=r.stack,r}}function d({reason:e,prerenderState:t,pathname:n}){h(t,e,n)}function p(e,t){e.prerenderState&&h(e.prerenderState,t,e.urlPathname)}function h(e,t,n){v();let r=`Route ${n} needs to bail out of prerendering at this point because it used ${t}. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`;e.dynamicAccesses.push({stack:e.isDebugSkeleton?Error().stack:void 0,expression:t}),o.default.unstable_postpone(r)}function y(e){return e.dynamicAccesses.length>0}function _(e){return e.dynamicAccesses.filter(e=>"string"==typeof e.stack&&e.stack.length>0).map(({expression:e,stack:t})=>(t=t.split("\n").slice(4).filter(e=>!(e.includes("node_modules/next/")||e.includes(" ()")||e.includes(" (node:"))).join("\n"),`Dynamic API Usage Debug - ${e}: +${t}`))}function v(){if(!i)throw Error("Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js")}function b(e){v();let t=new AbortController;try{o.default.unstable_postpone(e)}catch(e){t.abort(e)}return t.signal}},24286:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getSegmentParam",{enumerable:!0,get:function(){return o}});let r=n(82269);function o(e){let t=r.INTERCEPTION_ROUTE_MARKERS.find(t=>e.startsWith(t));return(t&&(e=e.slice(t.length)),e.startsWith("[[...")&&e.endsWith("]]"))?{type:"optional-catchall",param:e.slice(5,-2)}:e.startsWith("[...")&&e.endsWith("]")?{type:t?"catchall-intercepted":"catchall",param:e.slice(4,-1)}:e.startsWith("[")&&e.endsWith("]")?{type:t?"dynamic-intercepted":"dynamic",param:e.slice(1,-1)}:null}},63243:function(e,t){"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HMR_ACTIONS_SENT_TO_BROWSER",{enumerable:!0,get:function(){return n}}),(r=n||(n={})).ADDED_PAGE="addedPage",r.REMOVED_PAGE="removedPage",r.RELOAD_PAGE="reloadPage",r.SERVER_COMPONENT_CHANGES="serverComponentChanges",r.MIDDLEWARE_CHANGES="middlewareChanges",r.CLIENT_CHANGES="clientChanges",r.SERVER_ONLY_CHANGES="serverOnlyChanges",r.SYNC="sync",r.BUILT="built",r.BUILDING="building",r.DEV_PAGES_MANIFEST_UPDATE="devPagesManifestUpdate",r.TURBOPACK_MESSAGE="turbopack-message",r.SERVER_ERROR="serverError",r.TURBOPACK_CONNECTED="turbopack-connected"},82269:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{INTERCEPTION_ROUTE_MARKERS:function(){return o},extractInterceptionRouteInformation:function(){return l},isInterceptionRouteAppPath:function(){return u}});let r=n(3330),o=["(..)(..)","(.)","(..)","(...)"];function u(e){return void 0!==e.split("/").find(e=>o.find(t=>e.startsWith(t)))}function l(e){let t,n,u;for(let r of e.split("/"))if(n=o.find(e=>r.startsWith(e))){[t,u]=e.split(n,2);break}if(!t||!n||!u)throw Error(`Invalid interception route: ${e}. Must be in the format //(..|...|..)(..)/`);switch(t=(0,r.normalizeAppPath)(t),n){case"(.)":u="/"===t?`/${u}`:t+"/"+u;break;case"(..)":if("/"===t)throw Error(`Invalid interception route: ${e}. Cannot use (..) marker at the root level, use (.) instead.`);u=t.split("/").slice(0,-1).concat(u).join("/");break;case"(...)":u="/"+u;break;case"(..)(..)":let l=t.split("/");if(l.length<=2)throw Error(`Invalid interception route: ${e}. Cannot use (..)(..) marker at the root level or one level up.`);u=l.slice(0,-2).concat(u).join("/");break;default:throw Error("Invariant: unexpected marker")}return{interceptingRoute:t,interceptedRoute:u}}},67991:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ReflectAdapter",{enumerable:!0,get:function(){return n}});class n{static get(e,t,n){let r=Reflect.get(e,t,n);return"function"==typeof r?r.bind(e):r}static set(e,t,n,r){return Reflect.set(e,t,n,r)}static has(e,t){return Reflect.has(e,t)}static deleteProperty(e,t){return Reflect.deleteProperty(e,t)}}},44467:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{AppRouterContext:function(){return o},GlobalLayoutRouterContext:function(){return l},LayoutRouterContext:function(){return u},MissingSlotContext:function(){return i},TemplateContext:function(){return a}});let r=n(99920)._(n(2265)),o=r.default.createContext(null),u=r.default.createContext(null),l=r.default.createContext(null),a=r.default.createContext(null),i=r.default.createContext(new Set)},54736:function(e,t){"use strict";function n(e){let t=5381;for(let n=0;n>>0}function r(e){return n(e).toString(36).slice(0,5)}Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{djb2Hash:function(){return n},hexHash:function(){return r}})},36590:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HeadManagerContext",{enumerable:!0,get:function(){return r}});let r=n(99920)._(n(2265)).default.createContext({})},68056:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{PathParamsContext:function(){return l},PathnameContext:function(){return u},SearchParamsContext:function(){return o}});let r=n(2265),o=(0,r.createContext)(null),u=(0,r.createContext)(null),l=(0,r.createContext)(null)},55592:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{BailoutToCSRError:function(){return r},isBailoutToCSRError:function(){return o}});let n="BAILOUT_TO_CLIENT_SIDE_RENDERING";class r extends Error{constructor(e){super("Bail out to client-side rendering: "+e),this.reason=e,this.digest=n}}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===n}},78558:function(e,t){"use strict";function n(e){return e.startsWith("/")?e:"/"+e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ensureLeadingSlash",{enumerable:!0,get:function(){return n}})},21427:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ActionQueueContext:function(){return a},createMutableActionQueue:function(){return s}});let r=n(41452),o=n(51507),u=n(80643),l=r._(n(2265)),a=l.default.createContext(null);function i(e,t){null!==e.pending&&(e.pending=e.pending.next,null!==e.pending?c({actionQueue:e,action:e.pending,setState:t}):e.needsRefresh&&(e.needsRefresh=!1,e.dispatch({type:o.ACTION_REFRESH,origin:window.location.origin},t)))}async function c(e){let{actionQueue:t,action:n,setState:r}=e,u=t.state;if(!u)throw Error("Invariant: Router state not initialized");t.pending=n;let l=n.payload,a=t.action(u,l);function c(e){n.discarded||(t.state=e,t.devToolsInstance&&t.devToolsInstance.send(l,e),i(t,r),n.resolve(e))}(0,o.isThenable)(a)?a.then(c,e=>{i(t,r),n.reject(e)}):c(a)}function s(){let e={state:null,dispatch:(t,n)=>(function(e,t,n){let r={resolve:n,reject:()=>{}};if(t.type!==o.ACTION_RESTORE){let e=new Promise((e,t)=>{r={resolve:e,reject:t}});(0,l.startTransition)(()=>{n(e)})}let u={payload:t,next:null,resolve:r.resolve,reject:r.reject};null===e.pending?(e.last=u,c({actionQueue:e,action:u,setState:n})):t.type===o.ACTION_NAVIGATE||t.type===o.ACTION_RESTORE?(e.pending.discarded=!0,e.last=u,e.pending.payload.type===o.ACTION_SERVER_ACTION&&(e.needsRefresh=!0),c({actionQueue:e,action:u,setState:n})):(null!==e.last&&(e.last.next=u),e.last=u)})(e,t,n),action:async(e,t)=>{if(null===e)throw Error("Invariant: Router state not initialized");return(0,u.reducer)(e,t)},pending:null,last:null};return e}},22707:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addPathPrefix",{enumerable:!0,get:function(){return o}});let r=n(31465);function o(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:n,query:o,hash:u}=(0,r.parsePath)(e);return""+t+n+o+u}},3330:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{normalizeAppPath:function(){return u},normalizeRscURL:function(){return l}});let r=n(78558),o=n(8e4);function u(e){return(0,r.ensureLeadingSlash)(e.split("/").reduce((e,t,n,r)=>!t||(0,o.isGroupSegment)(t)||"@"===t[0]||("page"===t||"route"===t)&&n===r.length-1?e:e+"/"+t,""))}function l(e){return e.replace(/\.rsc($|\?)/,"$1")}},86180:function(e,t){"use strict";function n(e,t){if(void 0===t&&(t={}),t.onlyHashChange){e();return}let n=document.documentElement,r=n.style.scrollBehavior;n.style.scrollBehavior="auto",t.dontForceLayout||n.getClientRects(),e(),n.style.scrollBehavior=r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleSmoothScroll",{enumerable:!0,get:function(){return n}})},74092:function(e,t){"use strict";function n(e){return/Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isBot",{enumerable:!0,get:function(){return n}})},31465:function(e,t){"use strict";function n(e){let t=e.indexOf("#"),n=e.indexOf("?"),r=n>-1&&(t<0||n-1?{pathname:e.substring(0,r?n:t),query:r?e.substring(n,t>-1?t:void 0):"",hash:t>-1?e.slice(t):""}:{pathname:e,query:"",hash:""}}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"parsePath",{enumerable:!0,get:function(){return n}})},55121:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"pathHasPrefix",{enumerable:!0,get:function(){return o}});let r=n(31465);function o(e,t){if("string"!=typeof e)return!1;let{pathname:n}=(0,r.parsePath)(e);return n===t||n.startsWith(t+"/")}},67741:function(e,t){"use strict";function n(e){return e.replace(/\/$/,"")||"/"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeTrailingSlash",{enumerable:!0,get:function(){return n}})},8e4:function(e,t){"use strict";function n(e){return"("===e[0]&&e.endsWith(")")}Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{DEFAULT_SEGMENT_KEY:function(){return o},PAGE_SEGMENT_KEY:function(){return r},isGroupSegment:function(){return n}});let r="__PAGE__",o="__DEFAULT__"},8005:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ServerInsertedHTMLContext:function(){return o},useServerInsertedHTML:function(){return u}});let r=n(41452)._(n(2265)),o=r.default.createContext(null);function u(e){let t=(0,r.useContext)(o);t&&t(e)}},72301:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"warnOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},8293:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"actionAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(66713).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},66713:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createAsyncLocalStorage",{enumerable:!0,get:function(){return u}});let n=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class r{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}}let o=globalThis.AsyncLocalStorage;function u(){return o?new o:new r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},70038:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"requestAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(66713).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77685:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"staticGenerationAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(66713).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},34040:function(e,t,n){"use strict";var r=n(54887);t.createRoot=r.createRoot,t.hydrateRoot=r.hydrateRoot},54887:function(e,t,n){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(84417)},97950:function(e,t,n){"use strict";var r=n(54887),o={stream:!0},u=new Map;function l(e){var t=n(e);return"function"!=typeof t.then||"fulfilled"===t.status?null:(t.then(function(e){t.status="fulfilled",t.value=e},function(e){t.status="rejected",t.reason=e}),t)}function a(){}var i=new Map,c=n.u;n.u=function(e){var t=i.get(e);return void 0!==t?t:c(e)};var s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher,f=Symbol.for("react.element"),d=Symbol.for("react.lazy"),p=Symbol.iterator,h=Array.isArray,y=Object.getPrototypeOf,_=Object.prototype,v=new WeakMap;function b(e,t,n,r){this.status=e,this.value=t,this.reason=n,this._response=r}function g(e){switch(e.status){case"resolved_model":E(e);break;case"resolved_module":w(e)}switch(e.status){case"fulfilled":return e.value;case"pending":case"blocked":case"cyclic":throw e;default:throw e.reason}}function m(e,t){for(var n=0;nh?(_=h,h=3,p++):(_=0,h=3);continue;case 2:44===(m=d[p++])?h=4:v=v<<4|(96d.length&&(m=-1)}var O=d.byteOffset+p;if(-1e.forEach(e=>{"function"==typeof e?e(n):null!=e&&(e.current=n)})}function l(...e){return(0,r.useCallback)(u(...e),e)}},98324:function(e,n,t){t.d(n,{b:function(){return l},k:function(){return u}});var r=t(2265);function u(e,n){let t=(0,r.createContext)(n);function u(e){let{children:n,...u}=e,l=(0,r.useMemo)(()=>u,Object.values(u));return(0,r.createElement)(t.Provider,{value:l},n)}return u.displayName=e+"Provider",[u,function(u){let l=(0,r.useContext)(t);if(l)return l;if(void 0!==n)return n;throw Error(`\`${u}\` must be used within \`${e}\``)}]}function l(e,n=[]){let t=[],u=()=>{let n=t.map(e=>(0,r.createContext)(e));return function(t){let u=(null==t?void 0:t[e])||n;return(0,r.useMemo)(()=>({[`__scope${e}`]:{...t,[e]:u}}),[t,u])}};return u.scopeName=e,[function(n,u){let l=(0,r.createContext)(u),o=t.length;function i(n){let{scope:t,children:u,...i}=n,c=(null==t?void 0:t[e][o])||l,f=(0,r.useMemo)(()=>i,Object.values(i));return(0,r.createElement)(c.Provider,{value:f},u)}return t=[...t,u],i.displayName=n+"Provider",[i,function(t,i){let c=(null==i?void 0:i[e][o])||l,f=(0,r.useContext)(c);if(f)return f;if(void 0!==u)return u;throw Error(`\`${t}\` must be used within \`${n}\``)}]},function(...e){let n=e[0];if(1===e.length)return n;let t=()=>{let t=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let u=t.reduce((n,{useScope:t,scopeName:r})=>{let u=t(e)[`__scope${r}`];return{...n,...u}},{});return(0,r.useMemo)(()=>({[`__scope${n.scopeName}`]:u}),[u])}};return t.scopeName=n.scopeName,t}(u,...n)]}},25171:function(e,n,t){t.d(n,{WV:function(){return i},jH:function(){return c}});var r=t(22988),u=t(2265),l=t(54887),o=t(71538);let i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((e,n)=>{let t=(0,u.forwardRef)((e,t)=>{let{asChild:l,...i}=e,c=l?o.g7:n;return(0,u.useEffect)(()=>{window[Symbol.for("radix-ui")]=!0},[]),(0,u.createElement)(c,(0,r.Z)({},i,{ref:t}))});return t.displayName=`Primitive.${n}`,{...e,[n]:t}},{});function c(e,n){e&&(0,l.flushSync)(()=>e.dispatchEvent(n))}},71538:function(e,n,t){t.d(n,{A4:function(){return c},g7:function(){return o}});var r=t(22988),u=t(2265),l=t(1584);let o=(0,u.forwardRef)((e,n)=>{let{children:t,...l}=e,o=u.Children.toArray(t),c=o.find(f);if(c){let e=c.props.children,t=o.map(n=>n!==c?n:u.Children.count(e)>1?u.Children.only(null):(0,u.isValidElement)(e)?e.props.children:null);return(0,u.createElement)(i,(0,r.Z)({},l,{ref:n}),(0,u.isValidElement)(e)?(0,u.cloneElement)(e,void 0,t):null)}return(0,u.createElement)(i,(0,r.Z)({},l,{ref:n}),t)});o.displayName="Slot";let i=(0,u.forwardRef)((e,n)=>{let{children:t,...r}=e;return(0,u.isValidElement)(t)?(0,u.cloneElement)(t,{...function(e,n){let t={...n};for(let r in n){let u=e[r],l=n[r];/^on[A-Z]/.test(r)?u&&l?t[r]=(...e)=>{l(...e),u(...e)}:u&&(t[r]=u):"style"===r?t[r]={...u,...l}:"className"===r&&(t[r]=[u,l].filter(Boolean).join(" "))}return{...e,...t}}(r,t.props),ref:n?(0,l.F)(n,t.ref):t.ref}):u.Children.count(t)>1?u.Children.only(null):null});i.displayName="SlotClone";let c=({children:e})=>(0,u.createElement)(u.Fragment,null,e);function f(e){return(0,u.isValidElement)(e)&&e.type===c}},75137:function(e,n,t){t.d(n,{W:function(){return u}});var r=t(2265);function u(e){let n=(0,r.useRef)(e);return(0,r.useEffect)(()=>{n.current=e}),(0,r.useMemo)(()=>(...e)=>{var t;return null===(t=n.current)||void 0===t?void 0:t.call(n,...e)},[])}},91715:function(e,n,t){t.d(n,{T:function(){return l}});var r=t(2265),u=t(75137);function l({prop:e,defaultProp:n,onChange:t=()=>{}}){let[l,o]=function({defaultProp:e,onChange:n}){let t=(0,r.useState)(e),[l]=t,o=(0,r.useRef)(l),i=(0,u.W)(n);return(0,r.useEffect)(()=>{o.current!==l&&(i(l),o.current=l)},[l,o,i]),t}({defaultProp:n,onChange:t}),i=void 0!==e,c=i?e:l,f=(0,u.W)(t);return[c,(0,r.useCallback)(n=>{if(i){let t="function"==typeof n?n(e):n;t!==e&&f(t)}else o(n)},[i,e,o,f])]}},1336:function(e,n,t){t.d(n,{b:function(){return u}});var r=t(2265);let u=(null==globalThis?void 0:globalThis.document)?r.useLayoutEffect:()=>{}},47250:function(e,n,t){t.d(n,{D:function(){return u}});var r=t(2265);function u(e){let n=(0,r.useRef)({value:e,previous:e});return(0,r.useMemo)(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}},75238:function(e,n,t){t.d(n,{t:function(){return l}});var r=t(2265),u=t(1336);function l(e){let[n,t]=(0,r.useState)(void 0);return(0,u.b)(()=>{if(e){t({width:e.offsetWidth,height:e.offsetHeight});let n=new ResizeObserver(n=>{let r,u;if(!Array.isArray(n)||!n.length)return;let l=n[0];if("borderBoxSize"in l){let e=l.borderBoxSize,n=Array.isArray(e)?e[0]:e;r=n.inlineSize,u=n.blockSize}else r=e.offsetWidth,u=e.offsetHeight;t({width:r,height:u})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}t(void 0)},[e]),n}},12218:function(e,n,t){t.d(n,{j:function(){return l}});let r=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,u=function(){for(var e,n,t=0,r="";tt=>{var l;if((null==n?void 0:n.variants)==null)return u(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:o,defaultVariants:i}=n,c=Object.keys(o).map(e=>{let n=null==t?void 0:t[e],u=null==i?void 0:i[e];if(null===n)return null;let l=r(n)||r(u);return o[e][l]}),f=t&&Object.entries(t).reduce((e,n)=>{let[t,r]=n;return void 0===r||(e[t]=r),e},{});return u(e,c,null==n?void 0:null===(l=n.compoundVariants)||void 0===l?void 0:l.reduce((e,n)=>{let{class:t,className:r,...u}=n;return Object.entries(u).every(e=>{let[n,t]=e;return Array.isArray(t)?t.includes({...i,...f}[n]):({...i,...f})[n]===t})?[...e,t,r]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]); \ No newline at end of file diff --git a/_next/static/chunks/483-89e4495ce79573dc.js b/_next/static/chunks/483-89e4495ce79573dc.js new file mode 100644 index 0000000000000000000000000000000000000000..a135e8f1d42e348e55deca7ebed31635dde30e77 --- /dev/null +++ b/_next/static/chunks/483-89e4495ce79573dc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[483],{89733:function(e,r,n){n.d(r,{z:function(){return a}});var t=n(57437),o=n(2265),s=n(71538),i=n(12218),l=n(49354);let d=(0,i.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),a=o.forwardRef((e,r)=>{let{className:n,variant:o,size:i,asChild:a=!1,...g}=e,m=a?s.g7:"button";return(0,t.jsx)(m,{className:(0,l.cn)(d({variant:o,size:i,className:n})),ref:r,...g})});a.displayName="Button"},4919:function(e,r,n){n.d(r,{g:function(){return i}});var t=n(57437),o=n(2265),s=n(49354);let i=o.forwardRef((e,r)=>{let{className:n,...o}=e;return(0,t.jsx)("textarea",{className:(0,s.cn)("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",n),ref:r,...o})});i.displayName="Textarea"},80018:function(e,r,n){n.d(r,{X:function(){return d}});var t=n(28580),o=n(36393),s=n(13201),i=n(62052);let l=(0,i.hu)("Embedding Engine",i.$5.embeddingEngine.main);class d extends o.Z{getEmbeddingEngineLogs(e){return this.embeddingEngineLog.slice(-e)}getAvailableModels(){return Array.from(new Set(Object.keys(this.embeddingWorkers).map(e=>this.embeddingWorkers[e].modelName)))}logEngineEvent(e){e.at||(e.at=new Date);let r=this.embeddingEngineLog.length;return l.debug("Embedding engine event ".concat(e.type)),this.embeddingEngineLog.push(e),r}async scaleEmbeddingWorkers(e,r){let n=Object.values(this.embeddingWorkers).filter(r=>r.modelName===e).length;if(n!==r){if(nthis.embeddingWorkers[e].busy===this.embeddingWorkers[r].busy?0:this.embeddingWorkers[e].busy?-1:1).slice(0,n-r)))this.deleteEmbeddingWorker(t)}}addEmbeddingWorker(e,r){if(this.embeddingWorkers[r])return;l.debug("Trying to create new embedding worker ".concat(r," for model ").concat(e));let o=new Worker(n.tu(new URL(n.p+n.u(99),n.b)));o.onmessage=n=>{let t=n.data;switch(l.debug("Received message from worker ".concat(r,": ").concat(t.type)),t.type){case"workerLoaded":this.embeddingWorkers[r].status="loaded",this.embeddingWorkers[r].busy=!1,this.logEngineEvent({type:"embeddings_worker_loaded",modelName:e,workerId:r}),this.embeddingWorkers[r].workerLoadedPromise.resolve(!0),this.emit("workerFree",{modelName:e,workerId:r});break;case"workerLoadFailure":this.embeddingWorkers[r].status="failed",this.logEngineEvent({type:"engine_loading_error",modelName:e,error:"Failed to load embedding worker",workerId:r}),this.embeddingWorkers[r].workerLoadedPromise.resolve(!1),this.logEngineEvent({type:"embeddings_worker_unload",workerId:r}),delete this.embeddingWorkers[r];break;case"embeddingSuccess":let o=this.embeddingJobQueue.find(e=>e.batchId===t.batchId);o?o.completionPromise.resolve(t.results):l.error("EMBEDDING ENGINE ERROR: SHOUDLNT HAPPEN, couldn't find job to resolve"),this.emit("workerFree",{modelName:e,workerId:r});break;case"embeddingFailure":let s=this.embeddingJobQueue.find(e=>e.assignedWorkerId===r);s&&s.completionPromise.resolve(!1),this.emit("workerFree",{modelName:e,workerId:r});break;case"workerBusyEmbedding":this.embeddingWorkers[r].busy=!0;break;case"workerIdle":this.embeddingWorkers[r].busy=!1,this.runJobFromQueue()}},o.postMessage({type:"loadWorker",modelName:e,workerId:r}),this.embeddingWorkers[r]={busy:!0,worker:o,modelName:e,status:"loading",workerLoadedPromise:new t.C}}deleteEmbeddingWorker(e){this.embeddingWorkers[e]&&(this.embeddingWorkers[e].worker.terminate(),delete this.embeddingWorkers[e],this.logEngineEvent({type:"embeddings_worker_unload",workerId:e}))}async embedText(e,r){let n=new t.C;return this.embeddingJobQueue.push({batchId:"".concat(this.embeddingBatchCounter++),modelName:r,params:{texts:e},completionPromise:n}),this.queuesRunning!e.assignedWorkerId);if(0===e.length){l.debug("No jobs left, queue is going to sleep"),this.queuesRunning--;return}let r=e.shift(),n=Object.keys(this.embeddingWorkers).filter(e=>this.embeddingWorkers[e].modelName===r.modelName);if(0===n.length)l.error("No workers loaded with embedding model ".concat(r.modelName,", ignoring job")),r.completionPromise.resolve(!1);else{l.debug("".concat(n.length," workers available for embedding ").concat(r.params.texts));let t=n.filter(e=>this.embeddingWorkers[e]&&this.embeddingWorkers[e].modelName===r.modelName&&"loaded"===this.embeddingWorkers[e].status&&!this.embeddingWorkers[e].busy);if(0===t.length){e.unshift(r),l.debug("No free workers available, wait to be called on idle"),this.queuesRunning--;return}let o=t[Math.floor(Math.random()*t.length)];r.assignedWorkerId=o,this.embeddingJobQueue.push(r),r.params.texts.forEach((e,n)=>{this.logEngineEvent({type:"engine_embedding_start",text:e,batchId:r.batchId,workerId:o})}),l.debug("Embedding ".concat(r.batchId,": ").concat(r.params.texts.length," texts with ").concat(r.modelName," on worker ").concat(o));try{this.embeddingWorkers[o].worker.postMessage({type:"embedText",texts:r.params.texts,batchId:r.batchId});let e=await r.completionPromise.promise;return e?e.forEach((e,n)=>{this.logEngineEvent({type:"engine_embedding_success",bEmbeddingHash:e.bEmbeddingHash,batchId:r.batchId,workerId:o})}):r.params.texts.forEach((e,n)=>{this.logEngineEvent({type:"engine_embedding_error",error:"Failed to embed text, returned false",batchId:r.batchId,workerId:o})}),this.queuesRunning--,e}catch(e){r.params.texts.forEach((n,t)=>{this.logEngineEvent({type:"engine_embedding_error",error:e,batchId:r.batchId,workerId:o})}),r.completionPromise.resolve(!1),this.queuesRunning--}}}catch(e){l.error("Error running job from queue",e),this.logEngineEvent({type:"engine_embedding_error",error:e,batchId:"unassigned",workerId:"unassigned"}),this.queuesRunning--}}constructor(...e){super(...e),this.embeddingEngineLog=[],this.embeddingBatchCounter=0,this.queuesRunning=0,this.embeddingWorkers={},this.embeddingJobQueue=[]}}},89183:function(e,r,n){n.d(r,{g:function(){return u}});var t=n(28580),o=n(31561),s=n(36393),i=n(13201),l=n(62052),d=n(89028),a=n(22170),g=n.n(a);let m=(0,l.hu)("LLM Engine",l.$5.llmEngine.main),c=(0,d.ri)().llmEngineSettings;class u extends s.Z{logEngineEvent(e){e.at||(e.at=new Date);let r=this.engineLog.length;return m.debug("Engine event ".concat(e.type),e),this.engineLog.push(e),this.engineLog.length>c.engineLogLimit&&(this.engineLog=this.engineLog.slice(-c.engineLogLimit)),r}parseCustomLoadingProgress(e){let r=/Loading model from cache\[(\d+)\/(\d+)\]/.exec(e);if(r)try{let e=parseInt(r[1]),n=parseInt(r[2]);return e/n-.01}catch(e){return}}searchEngineLogs(e,r){return this.engineLog.filter(n=>n.type===e&&n.workerId===r)}getEngineLogs(e){return this.engineLog.slice(-e)}updateStreamingLogResult(e,r){let n=this.engineLog[r];"engine_inference_streaming_result"===n.type&&("token"===e.type?(n.result+=e.token,n.tokenCount++):"fullMessage"===e.type?(n.result=e.message,n.completed=!0):"tokenCount"===e.type&&(n.tokenCount=e.tokenCount))}getWorkerStates(){return Object.keys(this.llmWorkers).reduce((e,r)=>(e[r]={modelName:this.llmWorkers[r].modelName,state:this.llmWorkers[r].inferenceInProgress?"inference-in-progress":this.llmWorkers[r].modelLoadingProgress<1?"loading":"idle",loadingProgress:this.llmWorkers[r].modelLoadingProgress},e),{})}getWorkerAvailability(e){return Object.values(this.llmWorkers).reduce((r,n)=>{if(e.includes(n.modelName)){var t,o;null!==(o=r[t=n.modelName])&&void 0!==o||(r[t]={count:0,free:0}),r[n.modelName].count++,!n.inferenceInProgress&&n.modelLoadingProgress>=1&&r[n.modelName].free++}return r},{})}async unloadWorker(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.llmWorkers[e]){var n,t;r||await (null===(n=this.llmWorkers[e].inferencePromise)||void 0===n?void 0:n.promise),null===(t=this.llmWorkers[e].llmEngine)||void 0===t||t.unload(),delete this.llmWorkers[e],this.logEngineEvent({type:"engine_unload",workerId:e}),this.emit("workerUnloaded",{workerId:e}),this.saveWorkersToSettings()}}saveWorkersToSettings(){let e=Object.values(Object.values(this.llmWorkers).filter(e=>e.modelLoadingProgress>=1).reduce((e,r)=>(e[r.modelName]?e[r.modelName].count++:e[r.modelName]={modelName:r.modelName,count:1},e),{}));(0,d.zQ)({workerSettings:{initialLLMWorkers:e}})}async getWorkerState(e){return this.llmWorkers[e]?this.llmWorkers[e].modelLoadingProgress<1?{state:"loading",loadingProgress:this.llmWorkers[e].modelLoadingProgress}:this.llmWorkers[e].inferenceInProgress?{state:"inference-in-progress"}:{state:"idle"}:null}async loadWorker(e,r){var s,i,l;if(null!==(i=(s=this.llmWorkers)[r])&&void 0!==i||(s[r]={modelName:e,modelLoadingProgress:0}),this.llmWorkers[r].modelLoadingPromise)return m.debug("Tried to create worker ".concat(r,", but creation is already done or in progress")),await this.llmWorkers[r].modelLoadingPromise.promise;this.llmWorkers[r].modelLoadingPromise=new t.C;try{this.logEngineEvent({type:"engine_loading",modelName:e,workerId:r}),this.emit("workerLoading",{modelName:e,workerId:r}),this.llmWorkers[r].llmEngine=await o.F0(new Worker(n.tu(new URL(n.p+n.u(661),n.b)),{type:void 0}),e,{initProgressCallback:n=>{if(m.debug("Worker ".concat(r,": Loading ").concat(e," progress - "),n),this.emitModelLoadingProgress(),0===n.progress){let e=this.parseCustomLoadingProgress(n.text);e?(this.llmWorkers[r].modelLoadingProgress=e,m.debug("Worker ".concat(r,": Custom progress parsed - ").concat(e))):this.llmWorkers[r].modelLoadingProgress=n.progress}else this.llmWorkers[r].modelLoadingProgress=n.progress;if(1===n.progress&&!this.searchEngineLogs("engine_loaded",r).filter(r=>r.modelName===e).length){var t;this.logEngineEvent({type:"engine_loaded",modelName:e,workerId:r}),this.emit("workerLoaded",{modelName:e,workerId:r}),this.emit("workerFree",{workerId:r}),this.saveWorkersToSettings(),null===(t=this.llmWorkers[r].modelLoadingPromise)||void 0===t||t.resolve(r)}}})}catch(n){this.emit("workerLoadFailed",{modelName:e,workerId:r,error:n}),this.logEngineEvent({type:"engine_loading_error",modelName:e,workerId:r,error:n}),m.error("Worker ".concat(r,": Error loading ").concat(e,": ").concat(n),n),null===(l=this.llmWorkers[r].modelLoadingPromise)||void 0===l||l.reject(n),this.unloadWorker(r,!0)}return this.llmWorkers[r]&&await this.llmWorkers[r].modelLoadingPromise.promise||!1}getMatchingWorkers(e,r){return Object.keys(this.llmWorkers).filter(n=>this.llmWorkers[n].modelName===e.modelName&&this.llmWorkers[n].modelLoadingProgress>=1&&(!r||!this.llmWorkers[n].inferenceInProgress)).reduce((e,r)=>(e[r]=this.llmWorkers[r],e),{})}async runInferenceNonStreaming(e){let r=await this.runInference(e),n="",t=0;for await(let e of r)if("fullMessage"===e.type)n=e.message;else{if("error"===e.type)return{success:!1,error:e.error};"tokenCount"===e.type?t=e.tokenCount:"token"===e.type&&(n+=e.token,t++)}return{success:!0,result:n,tokenCount:t}}async *runInference(e,r){let n=this.getMatchingWorkers(e,!0);if(0===Object.keys(n).length)throw Error("No free workers available");let t=Object.keys(n)[Math.floor(Math.random()*Object.keys(n).length)];for await(let n of(await this.runInferenceOnWorker(e,t,r)))yield n}abortWorkerInference(e){let r=this.llmWorkers[e];if(r&&r.llmEngine&&r.inferenceInProgress){var n;r.llmEngine.interruptGenerate(),r.inferenceInProgress=!1,null===(n=r.inferencePromise)||void 0===n||n.resolve(!1),this.logEngineEvent({type:"engine_inference_error",workerId:e,inferenceId:this.inferenceCounter,error:"Inference manually aborted with control signal from the engine"})}}async *runInferenceOnWorker(e,r,n){if(!this.llmWorkers[r]||!this.llmWorkers[r].llmEngine||!this.llmWorkers[r].modelLoadingPromise)throw Error("Engine not loaded");if(await this.llmWorkers[r].modelLoadingPromise.promise,this.llmWorkers[r].inferenceInProgress)throw Error("Inference already in progress");let o=this.inferenceCounter++;this.logEngineEvent({type:"engine_inference_start",workerId:r,inferenceId:o,params:e}),this.emit("workerBusy",{workerId:r}),this.llmWorkers[r].inferenceInProgress=!0,this.llmWorkers[r].inferencePromise=new t.C;let s=this.logEngineEvent({type:"engine_inference_streaming_result",workerId:r,inferenceId:o,completed:!1,tokenCount:0,result:""});try{let t=await this.llmWorkers[r].llmEngine.chat.completions.create({stream:!0,messages:e.messages,temperature:1,max_gen_len:2048}),i="",l=0;for await(let e of t){if(null==n?void 0:n.aborted){this.llmWorkers[r].llmEngine.interruptGenerate(),this.llmWorkers[r].inferenceInProgress=!1,this.llmWorkers[r].inferencePromise.resolve(!1),this.logEngineEvent({type:"engine_inference_error",workerId:r,inferenceId:o,error:"Inference manually aborted with control signal during inference"}),yield{type:"error",error:"Inference manually aborted with control signal"};return}if(e.choices[0].delta.content){let r={type:"token",token:e.choices[0].delta.content};i+=e.choices[0].delta.content,l++,this.updateStreamingLogResult(r,s),yield r}}let d={type:"tokenCount",tokenCount:l};this.updateStreamingLogResult(d,s),yield d;let a={type:"fullMessage",message:i};this.updateStreamingLogResult(a,s),yield a,this.llmWorkers[r].inferenceInProgress=!1,this.llmWorkers[r].inferencePromise.resolve(!0)}catch(e){m.error("Worker ".concat(r,": Error running inference"),e),this.llmWorkers[r].inferenceInProgress=!1,this.llmWorkers[r].inferencePromise.resolve(!1),this.logEngineEvent({type:"engine_inference_error",workerId:r,inferenceId:o,error:e}),yield{type:"error",error:e}}this.emit("workerFree",{workerId:r})}async scaleLLMWorkers(e,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{let t=Object.values(this.llmWorkers).filter(r=>r.modelName===e).length;if(t===r)return;if(tthis.llmWorkers[e].inferenceInProgress===this.llmWorkers[r].inferenceInProgress?0:this.llmWorkers[e].inferenceInProgress?-1:1).slice(0,t-r),s=[];for(let e of o)s.push(this.unloadWorker(e,n))}}catch(e){m.error("Error updating LLM workers",e)}}constructor(...e){super(...e),this.llmWorkers={},this.engineLog=[],this.inferenceCounter=0,this.emitModelLoadingProgress=g()(()=>{this.emit("modelLoadingProgress")},c.debounceLoadingProgressEventMs)}}},79798:function(e,r,n){n.d(r,{o:function(){return t}});let t=["Llama-3-8B-Instruct-q4f32_1","Llama-2-7b-chat-hf-q4f16_1","Llama-2-13b-chat-hf-q4f16_1","Mistral-7B-Instruct-v0.2-q4f16_1","Hermes-2-Pro-Mistral-7B-q4f16_1","gemma-2b-it-q4f16_1","TinyLlama-1.1B-Chat-v0.4-q0f16"]}}]); \ No newline at end of file diff --git a/_next/static/chunks/556-188289cdaafedc35.js b/_next/static/chunks/556-188289cdaafedc35.js new file mode 100644 index 0000000000000000000000000000000000000000..d0030a917333af9844db7f106fbd3975d8195b7d --- /dev/null +++ b/_next/static/chunks/556-188289cdaafedc35.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[556],{3592:function(e){function t(e){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=function(){return[]},t.resolve=t,t.id=3592,e.exports=t},42480:function(){},75992:function(){},78110:function(){},55024:function(){},49354:function(e,t,n){"use strict";n.d(t,{cn:function(){return s}});var r=n(44839),i=n(96164);function s(){for(var e=arguments.length,t=Array(e),n=0;n{e.find(e=>e.chain===n.chain&&e.address===n.address)||(await (0,o.N1)(t,n.synthientIdSignature)?e.push(n):d.error("Could not verify identity for ".concat(t," on chain ").concat(n.chain," with address ").concat(n.address)))})),e}async getNetworkTotalTokens(){return(await this.db.peers.toArray()).reduce((e,t)=>e+t.totalTokens,0)}async getLastPeers(e,t){return this.db.peers.where("lastSeen").aboveOrEqual(e).limit(t).toArray()}async getPeerCount(e){return e?this.db.peers.where("lastSeen").aboveOrEqual(e).count():this.db.peers.count()}async processPackets(e){let t=e.map(e=>e.synthientId),n=(await this.db.peers.bulkGet(t)).filter(e=>!!e),r=!1,i=await Promise.all(Array.from(new Set(t)).map(async t=>{let i=e.filter(e=>e.synthientId===t).sort((e,t)=>{var n,r;return((null===(n=t.receivedTime)||void 0===n?void 0:n.getTime())||0)-((null===(r=e.receivedTime)||void 0===r?void 0:r.getTime())||0)}),s=n.find(e=>e.synthientId===t);s||(r=!0);let o=i.filter(e=>"peerConnectedChain"===e.packet.type).flatMap(e=>e.packet.identities),a=i.map(e=>"peerStatusUpdate"===e.packet.type&&("completed_inference"===e.packet.status||"boot"===e.packet.status)?e.packet.totalTokens:0).concat([(null==s?void 0:s.totalTokens)||0]).filter(e=>!isNaN(e)&&e>0),c=a.length>0?Math.max(...a):0,d=s||{synthientId:t,seenOn:[],totalTokens:c,lastSeen:i[0].receivedTime||new Date,chainIds:[]};return d.seenOn=Array.from(new Set([...d.seenOn,...i.map(e=>e.deliveredThrough).filter(e=>!!e)])),d.chainIds=await this.updateChainIdentities(d.chainIds,t,o),d}));await this.db.peers.bulkPut(i);let s=e.filter(e=>"knownPeers"===e.packet.type);return s.length>0&&this.loadKnownPeerPackets(s),r}async loadKnownPeerPackets(e){let t=e.flatMap(e=>e.packet.peerList.map(e=>e.synthientId)),n=(await this.db.peers.bulkGet(t)).filter(e=>!!e),r={},i={};e.forEach(e=>{e.packet.peerList.forEach(t=>{i[t.synthientId]&&i[t.synthientId].latestUpdate>=new Date(e.packet.createdAt)||(i[t.synthientId]={peer:{totalTokens:t.totalTokens,synthientId:t.synthientId,seenOn:t.seenOn,lastSeen:new Date(t.lastSeen),chainIds:t.identities||[]},latestUpdate:new Date(e.packet.createdAt)})})}),await Promise.all(Object.values(i).map(async e=>{let{peer:t}=e,i=n.find(e=>e.synthientId===t.synthientId)||r[t.synthientId]||{synthientId:t.synthientId,seenOn:t.seenOn,lastSeen:new Date(t.lastSeen),chainIds:[]};i.seenOn=Array.from(new Set([...i.seenOn,...t.seenOn])),i.chainIds=await this.updateChainIdentities(i.chainIds,t.synthientId,t.chainIds),i.lastSeen=i.lastSeen&&new Date(Math.max(i.lastSeen.getTime(),new Date(t.lastSeen).getTime())||new Date(t.lastSeen)),d.debug("UpdatedPeer totalTokens: ".concat(t.totalTokens," ").concat(i.totalTokens));let s=[t.totalTokens,i.totalTokens].filter(e=>!isNaN(e)&&e>0);i.totalTokens=s.length>0?Math.max(...s):0,r[t.synthientId]=i})),await this.db.peers.bulkPut(Object.values(r))}async getPeer(e){return this.db.peers.get(e)}async getAllPeers(){return this.db.peers.toArray()}async deletePeer(e){await this.db.peers.delete(e)}constructor(e={}){this.db=new l(e)}}var h=n(22170),p=n.n(h),g=n(13201),f=n(89028);let m=(0,c.hu)("PacketDB",c.$5.databases.packetDB);i.UG.sha512Sync=function(){for(var e=arguments.length,t=Array(e),n=0;ne.synthientId===this.clientInfo.synthientId)&&(m.debug("Received inferenceRevealRequest for own synthientId"),this.emit("newInferenceRevealRequest",e))}async transmitPacket(e){let t={synthientId:this.clientInfo.synthientId,signature:"",packet:e};t.signature=(0,o.K4)(this.clientInfo.synthientPrivKey,e),await this.db.packets.add({...t,receivedTime:new Date}),this.emitNewPacketEvents(t),m.debug("Transmitting packet ".concat(t.packet.type),t),await this.sendPacketOverP2P(t)}async getAllPackets(){return await this.db.packets.toArray()}fixEmbeddingArraysInPackets(e){"inferenceReveal"===e.packet.type?(e.packet.embedding=Object.values(e.packet.embedding),e.packet.bEmbedding=Object.values(e.packet.bEmbedding)):"inferenceRevealRejected"===e.packet.type&&("computed_bembedding_fails_threshold"===e.packet.rejectReason.type&&(e.packet.rejectReason.computedBEmbedding=Object.values(e.packet.rejectReason.computedBEmbedding)),e.packet.rejectReason.revealedBEmbedding=Object.values(e.packet.rejectReason.revealedBEmbedding))}async getPacket(e,t){return await this.db.packets.get({synthientId:e,signature:t})}verifyAndDedupeReceivedPacketQueue(e){let t=e.filter(e=>{let t=(0,o.yj)(e.synthientId,e.signature,e.packet);return t||m.debug("Invalid signature on packet, dropping packet from ".concat(e.synthientId),e),t}),n={};return t.forEach(e=>{let t=e.synthientId+e.signature;n[t]||(n[t]=e)}),Object.values(n)}async transmitPeerList(){let e=new Date(Date.now()-432e5),t=await this.peerDB.getLastPeers(e,200);if(Math.random()({synthientId:e.synthientId,identities:e.chainIds,totalTokens:!isNaN(e.totalTokens)&&e.totalTokens||0,lastSeen:e.lastSeen&&(0,g.MQ)(e.lastSeen),seenOn:e.seenOn})),createdAt:(0,g.MQ)(new Date)};m.debug("Transmitting peer list with ".concat(Object.values(e).length),e),await this.transmitPacket(e)}}emitPeerHeart(e){this.emit("peerHeart",e)}receivePacket(e){m.trace("Queued received packet: ",e),this.receivedPacketQueue.push(e),this.processReceivedPacketQueue(),this.receivedPacketQueue.length>=y.maxReceivedPacketQueueSize&&this.processReceivedPacketQueue.flush()}async printPackets(){await this.db.packets.toArray()}async dropOldPackets(e){let t=new Date(Date.now()-e);await this.db.packets.where("receivedTime").below(t).delete(),m.debug("Dropped packets older than ".concat(e,"ms"))}async clearPackets(){await this.db.packets.clear(),m.debug("Cleared all packets from the database.")}constructor(e,t,n={}){super(),this.clientInfo=e,this.sendPacketOverP2P=t,this.receivedPacketQueue=[],this.cleanUpOldPackets=p()(async()=>{m.debug("Cleaning up old packets."),await this.db.packets.orderBy("receivedTime").reverse().offset(y.maxPacketDBSize+50).delete()},5e3),this.processReceivedPacketQueue=p()(async()=>{let e=this.receivedPacketQueue;this.receivedPacketQueue=[];let t=this.verifyAndDedupeReceivedPacketQueue(e),n=await this.db.packets.where("[synthientId+signature]").anyOf(t.map(e=>[e.synthientId,e.signature])).toArray(),i=t.filter(e=>!n.some(t=>t.synthientId===e.synthientId&&t.signature===e.signature)).map(e=>(this.fixEmbeddingArraysInPackets(e),e));try{await this.db.packets.bulkPut(i).catch(r.ZP.BulkError,function(e){m.error("".concat(e.failures.length," packets were added successfully, but some others could not be. Check console for errors"),e)})}catch(e){m.error("Different error adding packets to the database",e)}let s=!!i.some(e=>"peerStatusUpdate"===e.packet.type&&"boot"===e.packet.status);this.peerDB.processPackets(i).then(e=>{(e||s)&&this.transmitPeerList()}),i.forEach(e=>this.emitNewPacketEvents(e)),i.filter(e=>"peerHeart"===e.packet.type).slice(0,y.peerHeartLimit).forEach(e=>this.emitPeerHeart(e)),setTimeout(()=>this.cleanUpOldPackets(),0)},y.receivePacketQueueDebounceMs,{trailing:!0}),this.db=new k(n),this.peerDB=new u,this.clientInfo=e,this.sendPacketOverP2P=t}}},18951:function(e,t,n){"use strict";let r;n.d(t,{K6:function(){return u},il:function(){return l}});var i=n(3682),s=n(69893),o=n(78967),a=n(13201),c=n(89028);s.UG.sha512Sync=function(){for(var e=arguments.length,t=Array(e),n=0;n1&&void 0!==arguments[1]&&arguments[1];if(r)return r;if(!t&&localStorage.getItem(d)&&e)try{let t=localStorage.getItem(d),n=await (0,i.ow)(t,e);n.synthientId||console.log("Could not properly decrypt with this password"),r=n}catch(e){throw console.error("Could not decrypt saved identity",e),e}else{let t=function(){let e=s.P6.randomPrivateKey(),t=s.$3(e);return{synthientId:s.UG.bytesToHex(t),synthientPrivKey:s.UG.bytesToHex(e),chainIds:[],deviceInfo:(0,a.dz)()}}();await l(t,e),r=t}return r}},12683:function(e,t,n){"use strict";n.d(t,{t:function(){return c}});var r=n(2105),i=n(33987),s=n(28580),o=n(62052);let a=(0,o.hu)("P2P: NKN",o.$5.p2pNetworks.nkn);class c extends i.l{async waitForReady(){return this.loadingPromise.promise}async broadcastPacket(e){if(this.nknClient){a.debug("Sending message",e);try{return await this.nknClient.publish(this.nknTopic,JSON.stringify(e),{txPool:!0}),!0}catch(e){a.error("Error sending message",e),this.transmissionErrorCount++,this.transmissionErrorCount>this.p2pNKNSettings.maxSendErrorsBeforeRestart&&this.errorHandlers.forEach(t=>t(e,!0))}}return!1}listenForPacket(e){return this.packetReceivedCallbacks.push(e),()=>{this.packetReceivedCallbacks=this.packetReceivedCallbacks.filter(t=>t!==e)}}registerErrorHandler(e){return this.errorHandlers.push(e),()=>{this.errorHandlers=this.errorHandlers.filter(t=>t!==e)}}async gracefulShutdown(){this.renewalIntervalId&&clearInterval(this.renewalIntervalId),await this.nknClient.close()}constructor(e,t,n){super(e,t),this.p2pNKNSettings=n,this.loadingPromise=new s.C,this.transmissionErrorCount=0,this.packetReceivedCallbacks=[],this.errorHandlers=[],this.nknTopic=t.nknTopic;let i=new r.Wallet({password:t.nknWalletPassword});this.nknClient=new r.MultiClient({identifier:e,seed:i.getSeed()}),a.debug("NKN client created with id ".concat(e)),this.nknClient.onMessage(e=>{let{src:t,payload:n}=e,r=JSON.parse(n);r.receivedTime=new Date,r.deliveredThrough="nkn",this.packetReceivedCallbacks.forEach(e=>{e(r,{nknAddress:t})})}),this.nknClient.onConnect(e=>{let{addr:t}=e;a.debug("Connected"),this.loadingPromise.resolve(!0)}),this.nknClient.onConnectFailed(()=>{a.debug("Connection failed"),this.loadingPromise.resolve(!1),this.errorHandlers.forEach(e=>{e(Error("Connection failed"),!0)})}),i.subscribe(this.nknTopic,1e3,this.synthientId,"").then(e=>{a.debug("Subscribed to events in tx ".concat(e)),this.renewalIntervalId=setInterval(async()=>{await i.subscribe(this.nknTopic,1e3,this.synthientId,"").then(e=>{a.debug("Renewed subscription in tx ".concat(e))})},198e5)})}}},30701:function(e,t,n){"use strict";function r(e){return i.PEWPEW.topic=e.topic,i.NKN.topic=e.topic,i.TRYSTERO.appId=e.topic,i.TRYSTERO.topic=e.topic+"T",i.NKN.maxSendErrorsBeforeRestart=e.maxTransmissionErrorsBeforeRestart,i.TRYSTERO.maxTransmissionErrorsBeforeRestart=e.maxTransmissionErrorsBeforeRestart,i}n.d(t,{e:function(){return r}});let i={PEWPEW:{topic:"rakis0",bootFixedDelayMs:1e3,bootstrapPeers:["https://gun-manhattan.herokuapp.com/gun","https://peer.wallie.io/gun","https://plankton-app-6qfp3.ondigitalocean.app/"]},NKN:{maxSendErrorsBeforeRestart:5,topic:"rakis0"},TRYSTERO:{maxTransmissionErrorsBeforeRestart:5,appId:"rakis",topic:"rakis0",relayRedundancy:4,rtcConfig:{iceServers:[{urls:"stun:stun.relay.metered.ca:80"},{urls:"turn:a.relay.metered.ca:80",username:"fd396a3275680a085c4d66cd",credential:"hFQmauZyx0Mv0bCK"},{urls:"turn:a.relay.metered.ca:80?transport=tcp",username:"fd396a3275680a085c4d66cd",credential:"hFQmauZyx0Mv0bCK"},{urls:"turn:a.relay.metered.ca:443",username:"fd396a3275680a085c4d66cd",credential:"hFQmauZyx0Mv0bCK"},{urls:"turn:a.relay.metered.ca:443?transport=tcp",username:"fd396a3275680a085c4d66cd",credential:"hFQmauZyx0Mv0bCK"}]}}}},33987:function(e,t,n){"use strict";n.d(t,{l:function(){return r}});class r{constructor(e,t){this.synthientId=e,this.options=t}}},37678:function(e,t,n){"use strict";n.d(t,{p:function(){return d}});var r=n(24364),i=n.n(r),s=n(33987),o=n(28580),a=n(62052);let c=(0,a.hu)("P2P: PewPewDB",a.$5.p2pNetworks.pewpewdb);class d extends s.l{async waitForReady(){return await this.loadingPromise.promise,!0}async broadcastPacket(e){let t={...e,packet:JSON.stringify(e.packet)};return c.debug("Transmitting packet with gun",t),new Promise(e=>{this.gun.get(this.gunTopic).put(t,t=>t.err?(c.error("Error sending gun message: ",t.err),e(!1)):e(!0))})}listenForPacket(e){let t=this.packetHandlerIdCouinter++;return this.packetHandlerIds.push(t),this.gun.get(this.gunTopic).on((n,r,i,s)=>{if(!this.packetHandlerIds.includes(t)){s.off();return}c.debug("Received packet",n),e({...n,receivedTime:new Date,deliveredThrough:"gun",packet:JSON.parse(n.packet)},{})}),()=>{this.packetHandlerIds=this.packetHandlerIds.filter(e=>e!==t)}}registerErrorHandler(e){return this.errorHandlers.push(e),()=>{this.errorHandlers=this.errorHandlers.filter(t=>t!==e)}}gracefulShutdown(){}constructor(e,t){super(e,t),this.packetHandlerIds=[],this.packetHandlerIdCouinter=0,this.loadingPromise=new o.C,this.errorHandlers=[],this.gunTopic=t.gunTopic,this.gun=i()({peers:t.gunPeers,localStorage:!1}),setTimeout(()=>{this.loadingPromise.resolve()},t.startupDelayMs)}}},31406:function(e,t,n){"use strict";n.d(t,{f:function(){return c}});var r=n(18210),i=n(97481),s=n(33987),o=n(28580),a=n(62052);class c extends s.l{async waitForReady(){return this.loadingPromise.promise}async broadcastPacket(e){if(this.trysteroRoom)try{let[t]=this.trysteroRoom.makeAction(this.options.trysteroTopic);return t(e),!0}catch(e){this.transmissionErrorCount++,this.logger.error("Error sending message",e),this.errorHandlers.forEach(t=>t(e,this.transmissionErrorCount>this.trysteroP2PSettings.maxTransmissionErrorsBeforeRestart))}return!1}listenForPacket(e){return this.packetReceivedCallbacks.push(e),()=>{this.packetReceivedCallbacks=this.packetReceivedCallbacks.filter(t=>t!==e)}}registerErrorHandler(e){return this.errorHandlers.push(e),()=>{this.errorHandlers=this.errorHandlers.filter(t=>t!==e)}}async gracefulShutdown(){this.trysteroRoom.leave()}constructor(e,t,n){super(e,t),this.trysteroP2PSettings=n,this.loadingPromise=new o.C,this.transmissionErrorCount=0,this.packetReceivedCallbacks=[],this.errorHandlers=[],this.logger=(0,a.hu)("P2P: ".concat(t.trysteroType," (trystero)"),a.$5.p2pNetworks[t.trysteroType]);try{this.trysteroRoom="nostr"===this.options.trysteroType?(0,i.Ls)({appId:this.options.trysteroAppId,relayRedundancy:this.options.relayRedundancy,rtcConfig:this.options.rtcConfig},this.options.trysteroTopic):(0,r.Ls)({appId:this.options.trysteroAppId,relayRedundancy:this.options.relayRedundancy,rtcConfig:this.options.rtcConfig},this.options.trysteroTopic),this.logger.debug("Trystero client created",this.trysteroRoom);let[,e]=this.trysteroRoom.makeAction(this.options.trysteroTopic);e((e,t)=>{let n={...e,receivedTime:new Date,deliveredThrough:this.options.trysteroType};this.packetReceivedCallbacks.forEach(e=>{e(n,{peerId:t})})}),this.loadingPromise.resolve(!0)}catch(e){throw this.logger.error("Error setting up Trystero",e),this.loadingPromise.resolve(!1),this.errorHandlers.forEach(t=>t(e,!0)),e}}}},89028:function(e,t,n){"use strict";n.d(t,{ri:function(){return s},wK:function(){return u},zQ:function(){return o}});let r="rakisSettings",i=null;function s(){let e={};try{window.localStorage&&window.localStorage&&window.localStorage.getItem(r)&&(i=e=JSON.parse(window.localStorage.getItem(r)))}catch(t){console.error("Error loading settings from localStorage, loading saved settings if we have them",i),i&&(console.log("Using last loaded settings - ",i),e=i)}return e.packetDBSettings={...c,...e.packetDBSettings},e.p2pSettings={...d,...e.p2pSettings},e.chainConnectionSettings={...l,...e.chainConnectionSettings},e.loggerSettings={...h,...e.loggerSettings},e.theDomainSettings={...p,...e.theDomainSettings},e.quorumSettings={...g,...e.quorumSettings},e.llmEngineSettings={...f,...e.llmEngineSettings},e.workerSettings={...a,...e.workerSettings},e}function o(e){{let t={};try{t=JSON.parse(window.localStorage.getItem(r))}catch(e){console.error("Error parsing existing settings",e)}window.localStorage.setItem(r,JSON.stringify({...t,...e}))}}let a={initialLLMWorkers:[{modelName:"gemma-2b-it-q4f16_1",count:2}],initialEmbeddingWorkers:[{modelName:"nomic-ai/nomic-embed-text-v1.5",count:1}]},c={maxReceivedPacketQueueSize:100,receivePacketQueueDebounceMs:100,peerHeartLimit:20,peerCommunicationCount:40,maxPacketDBSize:5e3},d={topic:"rakis1",maxTransmissionErrorsBeforeRestart:5},l={dAppName:"Rakis",url:"https://rakis.ai"},u="encSynthientId",h={maxLogsInMemory:1e3,loggersToSkipForInMemoryLog:["P2P: NKN","P2P: PewPewDB","P2P: nostr (trystero)","P2P: torrent (trystero)","PacketDB"],newLogEventDebounceMs:150},p={enabledP2PNetworks:["nostr","gun","torrent","nkn"],waitForP2PBootupMs:5e3,inferencePollingIntervalMs:5e3,inferenceRequestQueueDebounceMs:1e3,embeddingsQueueDebounceMs:100,requestSimilarityTimeWindowMs:2e3},g={quorumRevealRequestIssueTimeoutMs:1e4,quorumRevealTimeoutMs:2e4,quorumConsensusWindowMs:3e4,bEmbeddingThreshold:0},f={engineLogLimit:2e3,debounceLoadingProgressEventMs:50}},28580:function(e,t,n){"use strict";n.d(t,{C:function(){return r}});class r{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}},62052:function(e,t,n){"use strict";n.d(t,{$5:function(){return a},HQ:function(){return d},hu:function(){return l}});var r=n(36393),i=n(22170),s=n.n(i);let o=(0,n(89028).ri)().loggerSettings,a={llmEngine:{main:"background: #f0f8ff; color: #1e90ff; font-weight: bold;",worker:"background: #f0f8ff; color: #87cefa;"},embeddingEngine:{main:"background: #f0fff0; color: #2e8b57; font-weight: bold;",worker:"background: #f0fff0; color: #90ee90;"},theDomain:"background: #fff0f5; color: #ff69b4; font-weight: bold;",consensusCore:"background: #f5f5f5; color: #4682b4; font-weight: bold;",databases:{inferenceDB:"background: #f5f5f5; color: #a9a9a9;",packetDB:"background: #f5f5f5; color: #708090;",peerDB:"background: #f5f5f5; color: #778899;",quorumDB:"background: #f5f5f5; color: #696969;"},p2pNetworks:{nkn:"background: #fffacd; color: #ffa500;",torrent:"background: #fffacd; color: #ff8c00;",pewpewdb:"background: #fffacd; color: #ff7f50;",nostr:"background: #fffacd; color: #ff6347;"}},c=0;class d extends r.Z{static getInstance(){return d.instance||(d.instance=new d),d.instance}static addLog(e,t,n){d.getInstance().logs.push({at:new Date,logger:e,type:t,id:c++,message:n}),d.getInstance().logs=d.getInstance().logs.slice(-o.maxLogsInMemory).sort((e,t)=>t.at.getTime()-e.at.getTime()),d.getInstance().emitNewLogs()}constructor(){super(),this.logs=[],this.emitNewLogs=s()(()=>{this.emit("newLog")},o.newLogEventDebounceMs)}}function l(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!n&&window&&(window.blockedLogLevels=localStorage.getItem("blockedLogLevels")||[],window.blockedLoggers=localStorage.getItem("blockedLoggers")||[]),{trace:function(r){for(var i,s,o,a,c=arguments.length,d=Array(c>1?c-1:0),l=1;l1?l-1:0),h=1;h1?l-1:0),h=1;h1?l-1:0),h=1;h1?l-1:0),h=1;he.toString(16).padStart(2,"0")).join("")}async function u(e){let t=new TextEncoder().encode(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>e.toString(16).padStart(2,"0")).join("")}function h(e,t,n){let r=JSON.stringify(n),s=new Uint8Array(new TextEncoder().encode(r));return i.T(t,s,e)}function p(e,t){let n=JSON.stringify(t),r=new Uint8Array(new TextEncoder().encode(n)),s=i.Xx(r,e);return i.UG.bytesToHex(s)}async function g(e,t){console.time("Encrypting info for storage");let n=new TextEncoder,i=n.encode(t),s=crypto.getRandomValues(new Uint8Array(16)),o=crypto.getRandomValues(new Uint8Array(12)),a=await crypto.subtle.importKey("raw",i,{name:"PBKDF2"},!1,["deriveKey"]),c=await crypto.subtle.deriveKey({name:"PBKDF2",salt:s,iterations:1e5,hash:"SHA-256"},a,{name:"AES-GCM",length:256},!1,["encrypt"]),d=n.encode(JSON.stringify(e)),l=await crypto.subtle.encrypt({name:"AES-GCM",iv:o},c,d),u=r.Buffer.from(l).toString("base64"),h=r.Buffer.from(o).toString("hex"),p=r.Buffer.from(s).toString("hex");return console.timeEnd("Encrypting info for storage"),"".concat(u,".").concat(h,".").concat(p)}async function f(e,t){console.time("Decrypting info from storage");let[n,i,s]=e.split("."),o=r.Buffer.from(n,"base64"),a=r.Buffer.from(i,"hex"),c=r.Buffer.from(s,"hex"),d=new TextEncoder().encode(t),l=await crypto.subtle.importKey("raw",d,{name:"PBKDF2"},!1,["deriveKey"]),u=await crypto.subtle.deriveKey({name:"PBKDF2",salt:c,iterations:1e5,hash:"SHA-256"},l,{name:"AES-GCM",length:256},!1,["decrypt"]),h=await crypto.subtle.decrypt({name:"AES-GCM",iv:a},u,o),p=new TextDecoder().decode(h);return console.timeEnd("Decrypting info from storage"),JSON.parse(p)}i.UG.sha512Sync=function(){for(var e=arguments.length,t=Array(e),n=0;n0?"-":"+").concat(r,":").concat(i)}function i(){return"undefined"==typeof navigator||"undefined"==typeof screen?"not-client":window.disableAnalytics?"disabled-analytics":Object.values({userAgent:navigator.userAgent,browserVersion:navigator.appVersion,platform:navigator.platform,language:navigator.language,screenWidth:screen.width,screenHeight:screen.height,colorDepth:screen.colorDepth,timezoneOffset:new Date().getTimezoneOffset(),cpuCores:navigator.hardwareConcurrency,touchSupport:"ontouchstart"in window}).map(e=>"".concat(e)).join("#")}async function s(e){return new Promise(t=>{setTimeout(()=>t("timeout"),e)})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",n="";for(let r=0;rthis.tokens_to_ids.get(e)??this.unk_token_id)}convert_ids_to_tokens(e){return e.map(e=>this.vocab[e]??this.unk_token)}}class x extends k{constructor(e){for(let[t,s]of(super(e),this.tokens_to_ids=u(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.max_input_chars_per_word=e.max_input_chars_per_word??100,this.vocab=Array(this.tokens_to_ids.size),this.tokens_to_ids))this.vocab[s]=t}encode(e){let t=[];for(let s of e){let e=[...s];if(e.length>this.max_input_chars_per_word){t.push(this.unk_token);continue}let n=!1,i=0,r=[];for(;i0&&(n=this.config.continuing_subword_prefix+n),this.tokens_to_ids.has(n)){s=n;break}--t}if(null===s){n=!0;break}r.push(s),i=t}n?t.push(this.unk_token):t.push(...r)}return t}}class w extends k{constructor(e,t){super(e);let s=e.vocab.length;this.vocab=Array(s),this.scores=Array(s);for(let t=0;t[e,t])),this.bosToken=" ",this.bosTokenId=this.tokens_to_ids.get(this.bosToken),this.eosToken=t.eos_token,this.eosTokenId=this.tokens_to_ids.get(this.eosToken),this.unkToken=this.vocab[this.unk_token_id],this.minScore=(0,r.VV)(this.scores)[0],this.unkScore=this.minScore-10,this.scores[this.unk_token_id]=this.unkScore,this.trie=new a.GA,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(e){let t=e.sentence,s=t.length,n=0;for(;n{let e=[...Array.from({length:94},(e,t)=>t+33),...Array.from({length:12},(e,t)=>t+161),...Array.from({length:82},(e,t)=>t+174)],t=e.slice(),s=0;for(let n=0;n<256;++n)e.includes(n)||(e.push(n),t.push(256+s),s+=1);let n=t.map(e=>String.fromCharCode(e));return Object.fromEntries(e.map((e,t)=>[e,n[t]]))})(),b=(0,n.$2)(y);class v extends k{constructor(e){for(let[t,s]of(super(e),this.BPE_SPLIT_TOKEN=" ",this.tokens_to_ids=u(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.vocab=Array(this.tokens_to_ids.size),this.tokens_to_ids))this.vocab[s]=t;this.bpe_ranks=new Map(e.merges.map((e,t)=>[e,t])),this.merges=e.merges.map(e=>e.split(this.BPE_SPLIT_TOKEN)),this.end_of_word_suffix=e.end_of_word_suffix,this.continuing_subword_suffix=e.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.ignore_merges=this.config.ignore_merges??!1,this.cache=new Map}bpe(e){if(0===e.length)return[];let t=this.cache.get(e);if(void 0!==t)return t;let s=Array.from(e);this.end_of_word_suffix&&(s[s.length-1]+=this.end_of_word_suffix);let n=[];if(s.length>1){let e=new a.Z3((e,t)=>e.score`<0x${e.toString(16).toUpperCase().padStart(2,"0")}>`)):t.push(this.unk_token)}return t}}class z extends k{constructor(e,t){for(let[s,n]of(super(e),this.tokens_to_ids=u(t.target_lang?e.vocab[t.target_lang]:e.vocab),this.bos_token=t.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=t.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=t.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=t.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=Array(this.tokens_to_ids.size),this.tokens_to_ids))this.vocab[n]=s}encode(e){return e}}class A extends n.Ag{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"BertNormalizer":return new N(e);case"Precompiled":return new eo(e);case"Sequence":return new R(e);case"Replace":return new S(e);case"NFC":return new E(e);case"NFKC":return new T(e);case"NFKD":return new C(e);case"Strip":return new j(e);case"StripAccents":return new M(e);case"Lowercase":return new P(e);case"Prepend":return new $(e);default:throw Error(`Unknown Normalizer type: ${e.type}`)}}normalize(e){throw Error("normalize should be implemented in subclass.")}_call(e){return this.normalize(e)}}class S extends A{normalize(e){let t=h(this.config.pattern);return null===t?e:e.replaceAll(t,this.config.content)}}class E extends A{normalize(e){return e=e.normalize("NFC")}}class T extends A{normalize(e){return e=e.normalize("NFKC")}}class C extends A{normalize(e){return e=e.normalize("NFKD")}}class j extends A{normalize(e){return this.config.strip_left&&this.config.strip_right?e=e.trim():(this.config.strip_left&&(e=e.trimStart()),this.config.strip_right&&(e=e.trimEnd())),e}}class M extends A{normalize(e){return e=p(e)}}class P extends A{normalize(e){return e=e.toLowerCase()}}class $ extends A{normalize(e){return e=this.config.prepend+e}}class R extends A{constructor(e){super(e),this.normalizers=e.normalizers.map(e=>A.fromConfig(e))}normalize(e){return this.normalizers.reduce((e,t)=>t.normalize(e),e)}}class N extends A{_tokenize_chinese_chars(e){let t=[];for(let s=0;s=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=63744&&e<=64255||e>=194560&&e<=195103}stripAccents(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}_is_control(e){switch(e){case" ":case"\n":case"\r":return!1;default:return/^\p{Cc}|\p{Cf}|\p{Co}|\p{Cs}$/u.test(e)}}_clean_text(e){let t=[];for(let s of e){let e=s.charCodeAt(0);0===e||65533===e||this._is_control(s)||(/^\s$/.test(s)?t.push(" "):t.push(s))}return t.join("")}normalize(e){return this.config.clean_text&&(e=this._clean_text(e)),this.config.handle_chinese_chars&&(e=this._tokenize_chinese_chars(e)),this.config.lowercase?(e=e.toLowerCase(),!1!==this.config.strip_accents&&(e=this.stripAccents(e))):this.config.strip_accents&&(e=this.stripAccents(e)),e}}class F extends n.Ag{static fromConfig(e){if(null===e)return null;switch(e.type){case"BertPreTokenizer":return new L(e);case"Sequence":return new ea(e);case"Whitespace":return new el(e);case"WhitespaceSplit":return new ec(e);case"Metaspace":return new ei(e);case"ByteLevel":return new O(e);case"Split":return new U(e);case"Punctuation":return new W(e);case"Digits":return new G(e);case"Replace":return new eh(e);default:throw Error(`Unknown PreTokenizer type: ${e.type}`)}}pre_tokenize_text(e,t){throw Error("pre_tokenize_text should be implemented in subclass.")}pre_tokenize(e,t){return(Array.isArray(e)?e.map(e=>this.pre_tokenize_text(e,t)):this.pre_tokenize_text(e,t)).flat()}_call(e,t){return this.pre_tokenize(e,t)}}class L extends F{constructor(e){super(),this.pattern=RegExp(`[^\\s${f}]+|[${f}]`,"gu")}pre_tokenize_text(e,t){return e.trim().match(this.pattern)||[]}}class O extends F{constructor(e){super(),this.config=e,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,this.byte_encoder=y,this.text_encoder=new TextEncoder}pre_tokenize_text(e,t){return this.add_prefix_space&&!e.startsWith(" ")&&(e=" "+e),(this.use_regex?e.match(this.pattern)||[]:[e]).map(e=>Array.from(this.text_encoder.encode(e),e=>this.byte_encoder[e]).join(""))}}class U extends F{constructor(e){super(),this.config=e,this.pattern=h(this.config.pattern,this.config.invert)}pre_tokenize_text(e,t){return null===this.pattern?[]:this.config.invert?e.match(this.pattern)||[]:function(e,t){let s=[],n=0;for(let i of e.matchAll(t)){let t=i[0];n0&&s.push(t),n=i.index+t.length}return ne.replaceAll(t,this.config.content))}}class V extends K{constructor(e){super(e),this.text_decoder=new TextDecoder}decode_chain(e){let t=[],s=[];for(let n of e){let e=null;if(6===n.length&&n.startsWith("<0x")&&n.endsWith(">")){let t=parseInt(n.slice(3,5),16);isNaN(t)||(e=t)}if(null!==e)s.push(e);else{if(s.length>0){let e=this.text_decoder.decode(Uint8Array.from(s));t.push(e),s=[]}t.push(n)}}if(s.length>0){let e=this.text_decoder.decode(Uint8Array.from(s));t.push(e),s=[]}return t}}class H extends K{decode_chain(e){return[e.join("")]}}class J extends K{constructor(e){super(e),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(e){return e.map(e=>{let t=0;for(let s=0;s(0!==t&&(e=e.startsWith(this.config.prefix)?e.replace(this.config.prefix,""):" "+e),this.cleanup&&(e=_(e)),e))}}class X extends K{constructor(e){super(e),this.byte_decoder=b,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(e){let t=new Uint8Array([...e.join("")].map(e=>this.byte_decoder[e]));return this.text_decoder.decode(t)}decode_chain(e){let t=[],s=[];for(let n of e)void 0!==this.added_tokens.find(e=>e.content===n)?(s.length>0&&(t.push(this.convert_tokens_to_string(s)),s=[]),t.push(n)):s.push(n);return s.length>0&&t.push(this.convert_tokens_to_string(s)),t}}class ee extends K{constructor(e){super(e),this.pad_token=this.config.pad_token,this.word_delimiter_token=this.config.word_delimiter_token,this.cleanup=this.config.cleanup}convert_tokens_to_string(e){if(0===e.length)return"";let t=[e[0]];for(let s=1;se!==this.pad_token).join("");return this.cleanup&&(s=_(s).replaceAll(this.word_delimiter_token," ").trim()),s}decode_chain(e){return[this.convert_tokens_to_string(e)]}}class et extends K{constructor(e){super(e),this.decoders=e.decoders.map(e=>K.fromConfig(e))}decode_chain(e){return this.decoders.reduce((e,t)=>t.decode_chain(e),e)}}class es extends K{constructor(e){super(e),this.suffix=this.config.suffix}decode_chain(e){return e.map((t,s)=>t.replaceAll(this.suffix,s===e.length-1?"":" "))}}class en extends K{decode_chain(e){let t="";for(let s=1;se.normalize("NFKC")).join("~"):e.normalize("NFKC")}}class ea extends F{constructor(e){super(),this.tokenizers=e.pretokenizers.map(e=>F.fromConfig(e))}pre_tokenize_text(e,t){return this.tokenizers.reduce((e,s)=>s.pre_tokenize(e,t),[e])}}class el extends F{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\w+|[^\w\s]+/g)||[]}}class ec extends F{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\S+/g)||[]}}class eh extends F{constructor(e){super(),this.config=e,this.pattern=h(this.config.pattern),this.content=this.config.content}pre_tokenize_text(e,t){return null===this.pattern?[e]:[e.replaceAll(this.pattern,this.config.content)]}}let eu=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];class ed extends n.Ag{return_token_type_ids=!1;_default_chat_template=`{% for message in messages %}{{'<|im_start|>' + message['role'] + ' +' + message['content'] + '<|im_end|>' + ' +'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant +' }}{% endif %}`;constructor(e,t){for(let s of(super(),this._tokenizer_config=t,this.normalizer=A.fromConfig(e.normalizer),this.pre_tokenizer=F.fromConfig(e.pre_tokenizer),this.model=k.fromConfig(e.model,t),this.post_processor=I.fromConfig(e.post_processor),this.decoder=K.fromConfig(e.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[],e.added_tokens)){let e=new m(s);this.added_tokens.push(e),this.model.tokens_to_ids.set(e.content,e.id),this.model.vocab[e.id]=e.content,e.special&&(this.special_tokens.push(e.content),this.all_special_ids.push(e.id))}if(this.additional_special_tokens=t.additional_special_tokens??[],this.special_tokens.push(...this.additional_special_tokens),this.special_tokens=[...new Set(this.special_tokens)],this.decoder&&(this.decoder.added_tokens=this.added_tokens,this.decoder.end_of_word_suffix=this.model.end_of_word_suffix),this.added_tokens_regex=this.added_tokens.length>0?new RegExp(this.added_tokens.map(e=>`${e.lstrip?"\\s*":""}(${(0,n.hr)(e.content)})${e.rstrip?"\\s*":""}`).join("|")):null,this.mask_token=this.getToken("mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken("pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken("sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.unk_token=this.getToken("unk_token"),this.unk_token_id=this.model.tokens_to_ids.get(this.unk_token),this.model_max_length=t.model_max_length,this.remove_space=t.remove_space,this.clean_up_tokenization_spaces=t.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=t.do_lowercase_and_remove_accent??!1,this.padding_side="right",this.legacy=!1,this.chat_template=t.chat_template??null,Array.isArray(this.chat_template)){let e=Object.create(null);for(let{name:t,template:s}of this.chat_template){if("string"!=typeof t||"string"!=typeof s)throw Error('Chat template must be a list of objects with "name" and "template" properties');e[t]=s}this.chat_template=e}this._compiled_template_cache=new Map}getToken(...e){for(let t of e){let e=this._tokenizer_config[t];if(e){if("object"!=typeof e)return e;if("AddedToken"===e.__type)return e.content;throw Error(`Unknown token: ${e}`)}}return null}static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:n=null,local_files_only:i=!1,revision:r="main",legacy:o=null}={}){return new this(...await c(e,{progress_callback:t,config:s,cache_dir:n,local_files_only:i,revision:r,legacy:o}))}_call(e,{text_pair:t=null,add_special_tokens:s=!0,padding:i=!1,truncation:a=null,max_length:l=null,return_tensor:c=!0}={}){let h;let u=Array.isArray(e);if(u){if(0===e.length)throw Error("text array must be non-empty");if(null!==t){if(Array.isArray(t)){if(e.length!==t.length)throw Error("text and text_pair must have the same length")}else throw Error("text_pair must also be an array");h=e.map((e,n)=>this._encode_plus(e,t[n],{add_special_tokens:s}))}else h=e.map(e=>this._encode_plus(e,null,{add_special_tokens:s}))}else{if(null==e)throw Error("text may not be null or undefined");if(Array.isArray(t))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");h=[this._encode_plus(e,t,{add_special_tokens:s})]}if(null===l?l="max_length"===i?this.model_max_length:(0,r.Fp)(h.map(e=>e.input_ids.length))[0]:a||console.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation=true` to explicitly truncate examples to max length."),l=Math.min(l,this.model_max_length),i||a)for(let e=0;el?a&&function(e,t){for(let s of Object.keys(e))e[s].length=t}(h[e],l):i&&function(e,t,s,i){for(let r of Object.keys(e)){let o=t-e[r].length,a=s(r),l=Array(o).fill(a);e[r]="right"===i?(0,n.eG)(e[r],l):(0,n.eG)(l,e[r])}}(h[e],l,e=>"input_ids"===e?this.pad_token_id:0,this.padding_side));let d={};if(c){if(!(i&&a)&&h.some(e=>{for(let t of Object.keys(e))if(e[t].length!==h[0][t]?.length)return!0;return!1}))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");let e=[h.length,h[0].input_ids.length];for(let t of Object.keys(h[0]))d[t]=new o.es("int64",BigInt64Array.from(h.flatMap(e=>e[t]).map(BigInt)),e)}else{for(let e of Object.keys(h[0]))d[e]=h.map(t=>t[e]);if(!u)for(let e of Object.keys(d))d[e]=d[e][0]}return d}_encode_text(e){return null===e?null:(this.added_tokens_regex?e.split(this.added_tokens_regex).filter(e=>e):[e]).map((e,t)=>{if(void 0!==this.added_tokens.find(t=>t.content===e))return e;{if(!0===this.remove_space&&(e=e.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(e=p(e.toLowerCase())),null!==this.normalizer&&(e=this.normalizer(e)),0===e.length)return[];let s=null!==this.pre_tokenizer?this.pre_tokenizer(e,{section_index:t}):[e];return this.model(s)}}).flat()}_encode_plus(e,t=null,{add_special_tokens:s=!0}={}){let i=this._encode_text(e),r=this._encode_text(t),o=this.post_processor?this.post_processor(i,r,{add_special_tokens:s}):{tokens:(0,n.eG)(i??[],r??[])},a=this.model.convert_tokens_to_ids(o.tokens),l={input_ids:a,attention_mask:Array(a.length).fill(1)};return this.return_token_type_ids&&o.token_type_ids&&(l.token_type_ids=o.token_type_ids),l}encode(e,t=null,{add_special_tokens:s=!0}={}){let{input_ids:n}=this._encode_plus(e,t,{add_special_tokens:s});return n}batch_decode(e,t={}){return e instanceof o.es&&(e=e.tolist()),e.map(e=>this.decode(e,t))}decode(e,t={}){if(e instanceof o.es&&(e=d(e)),!Array.isArray(e)||0===e.length||!(0,n.Wy)(e[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(e,t)}decode_single(e,{skip_special_tokens:t=!1,clean_up_tokenization_spaces:s=null}){let n=this.model.convert_ids_to_tokens(e);t&&(n=n.filter(e=>!this.special_tokens.includes(e)));let i=this.decoder?this.decoder(n):n.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(i=i.replaceAll(this.decoder.end_of_word_suffix," "),t&&(i=i.trim())),(s??this.clean_up_tokenization_spaces)&&(i=_(i)),i}get default_chat_template(){return this._warned_about_chat_template||(console.warn("No chat template is defined for this tokenizer - using a default chat template that implements the ChatML format. If the default is not appropriate for your model, please set `tokenizer.chat_template` to an appropriate template. See https://huggingface.co/docs/transformers/main/chat_templating for more information."),this._warned_about_chat_template=!0),this._default_chat_template}apply_chat_template(e,{chat_template:t=null,add_generation_prompt:s=!1,tokenize:n=!0,padding:i=!1,truncation:r=!1,max_length:o=null,return_tensor:a=!0,tokenizer_kwargs:c={},...h}={}){if(this.chat_template&&"object"==typeof this.chat_template||null===this.chat_template&&this.default_chat_template&&"object"==typeof this.default_chat_template){let e=this.chat_template??this.default_chat_template;if(null!==t&&Object.hasOwn(e,t))t=e[t];else if(null===t&&"default"in e)t=e.default;else if(null===t)throw Error(`This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(e).sort()}.`)}else t??=this.chat_template??this.default_chat_template;if("string"!=typeof t)throw Error(`chat_template must be a string, but got ${typeof t}`);let u=this._compiled_template_cache.get(t);void 0===u&&(u=new l.YS(t),this._compiled_template_cache.set(t,u));let d=Object.create(null);for(let e of eu){let t=this.getToken(e);t&&(d[e]=t)}let _=u.render({messages:e,add_generation_prompt:s,...d,...h});return n?this._call(_,{add_special_tokens:!1,padding:i,truncation:r,max_length:o,return_tensor:a,...c}).input_ids:_}}class e_ extends ed{return_token_type_ids=!0}class ep extends ed{return_token_type_ids=!0}class ef extends ed{return_token_type_ids=!0}class eg extends ed{return_token_type_ids=!0}class em extends ed{return_token_type_ids=!0}class ek extends ed{return_token_type_ids=!0}class ex extends ed{return_token_type_ids=!0}class ew extends ed{return_token_type_ids=!0}class ey extends ed{return_token_type_ids=!0}class eb extends ed{}class ev extends ed{}class ez extends ed{return_token_type_ids=!0;constructor(e,t){super(e,t),console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}}class eA extends ed{return_token_type_ids=!0}class eS extends ed{}class eE extends ed{_default_chat_template='{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}'}class eT extends ed{}class eC extends ed{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter(e=>this.languageRegex.test(e)),this.lang_to_token=e=>e}_build_translation_inputs(e,t,s){return eB(this,e,t,s)}}class ej extends eC{}class eM extends ed{}class eP extends eE{constructor(e,t){let s=".,!?…。,、।۔،",n=e.pre_tokenizer?.pretokenizers[0]?.pattern;n&&n.Regex===` ?[^(\\s|[${s}])]+`&&(n.Regex=` ?[^\\s${s}]+`),super(e,t)}}class e$ extends ed{_default_chat_template=`{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% elif USE_DEFAULT_PROMPT == true and not '<>' in messages[0]['content'] %}{% set loop_messages = messages %}{% set system_message = 'DEFAULT_SYSTEM_MESSAGE' %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<> +' + system_message + ' +<> + +' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ bos_token + '[INST] ' + content.strip() + ' [/INST]' }}{% elif message['role'] == 'system' %}{{ '<> +' + content.strip() + ' +<> + +' }}{% elif message['role'] == 'assistant' %}{{ ' ' + content.strip() + ' ' + eos_token }}{% endif %}{% endfor %}`;DEFAULT_SYSTEM_PROMPT="You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.";constructor(e,t){super(e,t),this.use_default_system_prompt=t.use_default_system_prompt??!1,this.legacy=t.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new ei({replacement:"▁",add_prefix_space:!0,prepend_scheme:"first"}))}_encode_text(e){if(null===e)return null;if(this.legacy||0===e.length)return super._encode_text(e);let t=super._encode_text("▁"+e.replaceAll("▁"," "));return t.length>1&&"▁"===t[0]&&this.special_tokens.includes(t[1])&&(t=t.slice(1)),t}get default_chat_template(){return super.default_chat_template.replaceAll("USE_DEFAULT_PROMPT",this.use_default_system_prompt?"true":"false").replaceAll("DEFAULT_SYSTEM_MESSAGE",this.DEFAULT_SYSTEM_PROMPT.replaceAll("\n","\\n").replaceAll("'","\\'"))}}class eR extends e${}class eN extends ed{}class eF extends ed{}class eL extends ed{}class eO extends ed{}class eU extends ed{}class eW extends ed{}class eG extends ed{_default_chat_template="{% if messages[0]['role'] == 'system' %}{{ raise_exception('System role not supported') }}{% endif %}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '' + role + '\n' + message['content'] | trim + '\n' }}{% endfor %}{% if add_generation_prompt %}{{'model\n'}}{% endif %}"}class eI extends ed{}function eB(e,t,s,n){if(!("language_codes"in e)||!Array.isArray(e.language_codes))throw Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in e)||!(e.languageRegex instanceof RegExp))throw Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in e)||"function"!=typeof e.lang_to_token)throw Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");let i=n.src_lang,r=n.tgt_lang;if(!e.language_codes.includes(r))throw Error(`Target language code "${r}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);if(void 0!==i){if(!e.language_codes.includes(i))throw Error(`Source language code "${i}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);for(let t of e.post_processor.config.single)if("SpecialToken"in t&&e.languageRegex.test(t.SpecialToken.id)){t.SpecialToken.id=e.lang_to_token(i);break}}return n.forced_bos_token_id=e.model.convert_tokens_to_ids([e.lang_to_token(r)])[0],e._call(t,s)}class eD extends ed{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter(e=>this.languageRegex.test(e)),this.lang_to_token=e=>e}_build_translation_inputs(e,t,s){return eB(this,e,t,s)}}class eq extends ed{constructor(e,t){super(e,t),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter(e=>this.languageRegex.test(e)).map(e=>e.slice(2,-2)),this.lang_to_token=e=>`__${e}__`}_build_translation_inputs(e,t,s){return eB(this,e,t,s)}}let eY=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedish"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],eK=new Map(eY),eZ=new Map([...eY.map(([e,t])=>[t,e]),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);class eV extends ed{_default_chat_template='{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}';_decode_asr(e,{return_timestamps:t=!1,return_language:s=!1,time_precision:n=null,force_full_sequences:i=!0}={}){if(null===n)throw Error("Must specify time_precision");let o=null,a="word"===t;function l(){return{language:o,timestamp:[null,null],text:""}}let c=[],h=l(),u=0,d=this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1,_=[],p=[],f=!1,g=null,m=new Set(this.all_special_ids);for(let s of e){let e=s.tokens,i=a?s.token_timestamps:null,k=null,x=d;if("stride"in s){let[t,i,r]=s.stride;if(u-=i,g=t-r,i&&(x=i/n+d),r)for(let t=e.length-1;t>=0;--t){let s=e[t];if(s>=d){if(null!==k&&(s-d)*n=d){let e=(g-d)*n+u,t=(0,r.NM)(e,2);if(null!==k&&g>=k)f=!0;else if(f||_.length>0&&g0?(_.push(w),a&&p.push(y)):_.every(e=>0===e.length)&&(h=l(),_=[],w=[],p=[],y=[])}if(_.length>0){if(i&&t)throw Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");let[e,s]=this.findLongestCommonSequence(_,p),n=this.decode(e);h.text=n,a&&(h.words=this.collateWordTimestamps(e,s,o)),c.push(h)}let k=Object.create(null),x=c.map(e=>e.text).join("");if(t||s){for(let e=0;e0,o=r?[]:null,a=r?t[0]:null;for(let l=1;le===_[t]).length,f=p/e+t;p>1&&f>h&&(h=f,u=[i,r,a,l])}let[_,p,f,g]=u,m=Math.floor((p+_)/2),k=Math.floor((g+f)/2);i.push(...s.slice(0,m)),n=(s=c.slice(k)).length,r&&(o.push(...a.slice(0,m)),a=t[l].slice(k))}return(i.push(...s),r)?(o.push(...a),[i,o]):[i,[]]}collateWordTimestamps(e,t,s){let[n,i,r]=this.combineTokensIntoWords(e,s),o=[];for(let e=0;e=n){let e=(0,r.NM)((t-n)*s,2);i.push(`<|${e}|>`),i.push([])}else i[i.length-1].push(t);return(i=i.map(e=>"string"==typeof e?e:super.decode(e,t))).join("")}splitTokensOnUnicode(e){let t=this.decode(e,{decode_with_timestamps:!0}),s=[],n=[],i=[],r=[],o=[],a=0;for(let l=0;l=this.model.tokens_to_ids.get("<|endoftext|>"),d=l.startsWith(" "),_=l.trim(),p=a.test(_);if(u||d||p||0===i.length)i.push(l),r.push(c),o.push(h);else{let e=i.length-1;i[e]+=l,r[e].push(...c),o[e].push(...h)}}return[i,r,o]}mergePunctuations(e,t,s,i,r){let o=structuredClone(e),a=structuredClone(t),l=structuredClone(s),c=o.length-2,h=o.length-1;for(;c>=0;)o[c].startsWith(" ")&&i.includes(o[c].trim())?(o[h]=o[c]+o[h],a[h]=(0,n.eG)(a[c],a[h]),l[h]=(0,n.eG)(l[c],l[h]),o[c]="",a[c]=[],l[c]=[]):h=c,--c;for(c=0,h=1;he),a.filter(e=>e.length>0),l.filter(e=>e.length>0)]}get_decoder_prompt_ids({language:e=null,task:t=null,no_timestamps:s=!0}={}){let n=[];if(e){e=e.toLowerCase();let t=eZ.get(e);if(void 0===t){if(eK.has(e))t=e;else{let t=2===e.length?eK.keys():eK.values();throw Error(`Language "${e}" is not supported. Must be one of: ${JSON.stringify(t)}`)}}let s=this.model.tokens_to_ids.get(`<|${t}|>`);if(void 0===s)throw Error(`Unable to find language "${t}" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.`);n.push(s)}else n.push(null);if(t){if("transcribe"!==(t=t.toLowerCase())&&"translate"!==t)throw Error(`Task "${t}" is not supported. Must be one of: ["transcribe", "translate"]`);let e=this.model.tokens_to_ids.get(`<|${t}|>`);if(void 0===e)throw Error(`Unable to find task "${t}" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.`);n.push(e)}else n.push(null);if(s){let e=this.model.tokens_to_ids.get("<|notimestamps|>");if(void 0===e)throw Error('Unable to find "<|notimestamps|>" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.');n.push(e)}return n.map((e,t)=>[t+1,e]).filter(e=>null!==e[1])}}class eH extends ed{}class eJ extends ed{}class eQ extends ed{}class eX extends ed{constructor(e,t){super(e,t),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter(e=>this.languageRegex.test(e)),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(e){if(null===e)return null;let[t,...s]=e.trim().split(this.languageRegex);if(0===s.length)return super._encode_text(t);if(2===s.length){let[e,t]=s;return this.supported_language_codes.includes(e)||console.warn(`Unsupported language code "${e}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),(0,n.eG)([e],super._encode_text(t))}}}class e0 extends ed{}class e1 extends ed{_default_chat_template="{% for message in messages %}{% if message['role'] == 'user' %}{{ ' ' }}{% endif %}{{ message['content'] }}{% if not loop.last %}{{ ' ' }}{% endif %}{% endfor %}{{ eos_token }}"}class e2 extends e1{}class e3 extends ed{}class e6 extends ed{}class e8 extends ed{constructor(e,t){super(e,t),this.decoder=new en({})}}class e7 extends ed{}class e9{static TOKENIZER_CLASS_MAPPING={T5Tokenizer:eS,DistilBertTokenizer:eb,CamembertTokenizer:ev,DebertaTokenizer:em,DebertaV2Tokenizer:ek,BertTokenizer:e_,HerbertTokenizer:ex,ConvBertTokenizer:ew,RoFormerTokenizer:ey,XLMTokenizer:ez,ElectraTokenizer:eA,MobileBertTokenizer:ef,SqueezeBertTokenizer:eg,AlbertTokenizer:ep,GPT2Tokenizer:eE,BartTokenizer:eT,MBartTokenizer:eC,MBart50Tokenizer:ej,RobertaTokenizer:eM,WhisperTokenizer:eV,CodeGenTokenizer:eH,CLIPTokenizer:eJ,SiglipTokenizer:eQ,MarianTokenizer:eX,BloomTokenizer:eP,NllbTokenizer:eD,M2M100Tokenizer:eq,LlamaTokenizer:e$,CodeLlamaTokenizer:eR,XLMRobertaTokenizer:eN,MPNetTokenizer:eF,FalconTokenizer:eL,GPTNeoXTokenizer:eO,EsmTokenizer:eU,Wav2Vec2CTCTokenizer:e0,BlenderbotTokenizer:e1,BlenderbotSmallTokenizer:e2,SpeechT5Tokenizer:e3,NougatTokenizer:e6,VitsTokenizer:e8,Qwen2Tokenizer:eW,GemmaTokenizer:eG,Grok1Tokenizer:eI,CohereTokenizer:e7,PreTrainedTokenizer:ed};static async from_pretrained(e,{quantized:t=!0,progress_callback:s=null,config:n=null,cache_dir:i=null,local_files_only:r=!1,revision:o="main",legacy:a=null}={}){let[l,h]=await c(e,{quantized:t,progress_callback:s,config:n,cache_dir:i,local_files_only:r,revision:o,legacy:a}),u=h.tokenizer_class?.replace(/Fast$/,"")??"PreTrainedTokenizer",d=this.TOKENIZER_CLASS_MAPPING[u];return d||(console.warn(`Unknown tokenizer class "${u}", attempting to construct from base class.`),d=ed),new d(l,h)}}}}]); \ No newline at end of file diff --git a/_next/static/chunks/600.1a3187cf8347a55a.js b/_next/static/chunks/600.1a3187cf8347a55a.js new file mode 100644 index 0000000000000000000000000000000000000000..b52ceb9096f3198e6d4b33669feb1735ff0d5bf3 --- /dev/null +++ b/_next/static/chunks/600.1a3187cf8347a55a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[600],{35600:function(t,e,r){r.d(e,{secp256k1:function(){return ta}});var n={};r.r(n),r.d(n,{dQ:function(){return O},ci:function(){return w},bytesToNumberBE:function(){return B},ty:function(){return I},eV:function(){return S},n$:function(){return R},ql:function(){return A},hexToBytes:function(){return b},tL:function(){return x},S5:function(){return v},FF:function(){return U}});var i=r(95861),o=r(12403);class s extends o.kb{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,o.GL)(this.buffer)}update(t){(0,i.Gg)(this);let{view:e,buffer:r,blockLen:n}=this,s=(t=(0,o.O0)(t)).length;for(let i=0;in-f&&(this.process(r,0),f=0);for(let t=f;t>i&o),f=Number(r&o),l=n?4:0,u=n?0:4;t.setUint32(e+l,s,n),t.setUint32(e+u,f,n)}(r,n-8,BigInt(8*this.length),s),this.process(r,0);let l=(0,o.GL)(t),u=this.outputLen;if(u%4)throw Error("_sha2: outputLen should be aligned to 32bit");let a=u/4,h=this.get();if(a>h.length)throw Error("_sha2: outputLen bigger than state");for(let t=0;tt&e^~t&r,l=(t,e,r)=>t&e^t&r^e&r,u=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]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),h=new Uint32Array(64);class d extends s{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){let{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:f}=this;return[t,e,r,n,i,o,s,f]}set(t,e,r,n,i,o,s,f){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|f}process(t,e){for(let r=0;r<16;r++,e+=4)h[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){let e=h[t-15],r=h[t-2],n=(0,o.np)(e,7)^(0,o.np)(e,18)^e>>>3,i=(0,o.np)(r,17)^(0,o.np)(r,19)^r>>>10;h[t]=i+h[t-7]+n+h[t-16]|0}let{A:r,B:n,C:i,D:s,E:a,F:d,G:c,H:p}=this;for(let t=0;t<64;t++){let e=p+((0,o.np)(a,6)^(0,o.np)(a,11)^(0,o.np)(a,25))+f(a,d,c)+u[t]+h[t]|0,g=((0,o.np)(r,2)^(0,o.np)(r,13)^(0,o.np)(r,22))+l(r,n,i)|0;p=c,c=d,d=a,a=s+e|0,s=i,i=n,n=r,r=e+g|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,s=s+this.D|0,a=a+this.E|0,d=d+this.F|0,c=c+this.G|0,p=p+this.H|0,this.set(r,n,i,s,a,d,c,p)}roundClean(){h.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let c=(0,o.hE)(()=>new d);BigInt(0);let p=BigInt(1),g=BigInt(2),y=t=>t instanceof Uint8Array,m=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function w(t){if(!y(t))throw Error("Uint8Array expected");let e="";for(let r=0;rt+e.length,0)),r=0;return t.forEach(t=>{if(!y(t))throw Error("Uint8Array expected");e.set(t,r),r+=t.length}),e}let O=t=>(g<new Uint8Array(t),N=t=>Uint8Array.from(t);function R(t,e,r){if("number"!=typeof t||t<2)throw Error("hashLen must be a number");if("number"!=typeof e||e<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let n=q(t),i=q(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},f=(...t)=>r(i,n,...t),l=(t=q())=>{i=f(N([0]),t),n=f(),0!==t.length&&(i=f(N([1]),t),n=f())},u=()=>{if(o++>=1e3)throw Error("drbg: tried 1000 values");let t=0,r=[];for(;t{let r;for(s(),l(t);!(r=e(u()));)l();return s(),r}}let L={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function U(t,e,r={}){let n=(e,r,n)=>{let i=L[r];if("function"!=typeof i)throw Error(`Invalid validator "${r}", expected function`);let o=t[e];if((!n||void 0!==o)&&!i(o,t))throw Error(`Invalid param ${String(e)}=${o} (${typeof o}), expected ${r}`)};for(let[t,r]of Object.entries(e))n(t,r,!1);for(let[t,e]of Object.entries(r))n(t,e,!0);return t}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let H=BigInt(0),$=BigInt(1),z=BigInt(2),F=BigInt(3),P=BigInt(4),Z=BigInt(5),C=BigInt(8);function T(t,e){let r=t%e;return r>=H?r:e+r}function _(t,e,r){let n=t;for(;e-- >H;)n*=n,n%=r;return n}function V(t,e){if(t===H||e<=H)throw Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=T(t,e),n=e,i=H,o=$,s=$,f=H;for(;r!==H;){let t=n/r,e=n%r,l=i-s*t,u=o-f*t;n=r,r=e,i=s,o=f,s=l,f=u}if(n!==$)throw Error("invert: does not exist");return T(i,e)}BigInt(9),BigInt(16);let k=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function j(t,e){let r=void 0!==e?e:t.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function G(t){if("bigint"!=typeof t)throw Error("field order must be bigint");return Math.ceil(t.toString(2).length/8)}function D(t){let e=G(t);return e+Math.ceil(e/2)}class K extends o.kb{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,(0,i.vp)(t);let r=(0,o.O0)(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?t.create().update(r).digest():r);for(let t=0;tnew K(t,e).update(r).digest();Y.create=(t,e)=>new K(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let M=BigInt(0),W=BigInt(1);function J(t){return U(t.Fp,k.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),U(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...j(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}let{bytesToNumberBE:Q,hexToBytes:X}=n,tt={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){let{Err:e}=tt;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");let r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(128&n[0])throw new e("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Q(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=tt,r="string"==typeof t?X(t):t;if(!(r instanceof Uint8Array))throw Error("ui8a expected");let n=r.length;if(n<2||48!=r[0])throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:i,l:o}=tt._parseInt(r.subarray(2)),{d:s,l:f}=tt._parseInt(o);if(f.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,r=t=>{let e=t.toString(16);return 1&e.length?`0${e}`:e},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,f=r(o),l=r(s);return`30${r(s+o+4)}02${l}${i}02${f}${n}`}},te=BigInt(0),tr=BigInt(1),tn=(BigInt(2),BigInt(3));BigInt(4);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let ti=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),to=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ts=BigInt(1),tf=BigInt(2),tl=(t,e)=>(t+e/tf)/e,tu=function(t,e,r=!1,n={}){if(t<=H)throw Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=j(t,e);if(o>2048)throw Error("Field lengths over 2048 bytes are not supported");let s=function(t){if(t%P===F){let e=(t+$)/P;return function(t,r){let n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw Error("Cannot find square root");return n}}if(t%C===Z){let e=(t-Z)/C;return function(t,r){let n=t.mul(r,z),i=t.pow(n,e),o=t.mul(r,i),s=t.mul(t.mul(o,z),i),f=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(f),r))throw Error("Cannot find square root");return f}}return function(t){let e,r,n;let i=(t-$)/z;for(e=t-$,r=0;e%z===H;e/=z,r++);for(n=z;n 0");if(r===$)return H;let n=$;for(;e>H;)e&$&&(n=n*t%r),t=t*t%r,e>>=$;return n}(n,i,t)!==t-$;n++);if(1===r){let e=(t+$)/P;return function(t,r){let n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw Error("Cannot find square root");return n}}let o=(e+$)/z;return function(t,s){if(t.pow(s,i)===t.neg(t.ONE))throw Error("Cannot find square root");let f=r,l=t.pow(t.mul(t.ONE,n),e),u=t.pow(s,o),a=t.pow(s,e);for(;!t.eql(a,t.ONE);){if(t.eql(a,t.ZERO))return t.ZERO;let e=1;for(let r=t.sqr(a);eT(e,t),isValid:e=>{if("bigint"!=typeof e)throw Error(`Invalid field element: expected bigint, got ${typeof e}`);return H<=e&&et===H,isOdd:t=>(t&$)===$,neg:e=>T(-e,t),eql:(t,e)=>t===e,sqr:e=>T(e*e,t),add:(e,r)=>T(e+r,t),sub:(e,r)=>T(e-r,t),mul:(e,r)=>T(e*r,t),pow:(t,e)=>(function(t,e,r){if(r 0");if(r===H)return t.ONE;if(r===$)return e;let n=t.ONE,i=e;for(;r>H;)r&$&&(n=t.mul(n,i)),i=t.sqr(i),r>>=$;return n})(f,t,e),div:(e,r)=>T(e*V(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>V(e,t),sqrt:n.sqrt||(t=>s(f,t)),invertBatch:t=>(function(t,e){let r=Array(e.length),n=e.reduce((e,n,i)=>t.is0(n)?e:(r[i]=e,t.mul(e,n)),t.ONE),i=t.inv(n);return e.reduceRight((e,n,i)=>t.is0(n)?e:(r[i]=t.mul(e,r[i]),t.mul(e,n)),i),r})(f,t),cmov:(t,e,r)=>r?e:t,toBytes:t=>r?v(t,o):x(t,o),fromBytes:t=>{if(t.length!==o)throw Error(`Fp.fromBytes: expected ${o}, got ${t.length}`);return r?I(t):B(t)}});return Object.freeze(f)}(ti,void 0,void 0,{sqrt:function(t){let e=BigInt(3),r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),f=BigInt(88),l=t*t*t%ti,u=l*l*t%ti,a=_(u,e,ti)*u%ti,h=_(a,e,ti)*u%ti,d=_(h,tf,ti)*l%ti,c=_(d,n,ti)*d%ti,p=_(c,i,ti)*c%ti,g=_(p,s,ti)*p%ti,y=_(g,f,ti)*g%ti,m=_(y,s,ti)*p%ti,w=_(m,e,ti)*u%ti,E=_(w,o,ti)*c%ti,b=_(E,r,ti)*l%ti,B=_(b,tf,ti);if(!tu.eql(tu.sqr(B),t))throw Error("Cannot find square root");return B}}),ta=function(t,e){let r=e=>(function(t){let e=function(t){let e=J(t);return U(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:r,n:n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(t){return T(t,n)}let{ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:u,isWithinCurveOrder:a}=function(t){let e=/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function(t){let e=J(t);U(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:r}=e,n=e.toBytes||((t,e,n)=>{let i=e.toAffine();return S(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),i=e.fromBytes||(t=>{let e=t.subarray(1);return{x:r.fromBytes(e.subarray(0,r.BYTES)),y:r.fromBytes(e.subarray(r.BYTES,2*r.BYTES))}});function o(t){let{a:n,b:i}=e,o=r.sqr(t),s=r.mul(o,t);return r.add(r.add(s,r.mul(t,n)),i)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw Error("bad generator point: equation left != right");function s(t){return"bigint"==typeof t&&ter.eql(t,r.ZERO);return i(e)&&i(n)?h.ZERO:new h(e,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){let e=r.invertBatch(t.map(t=>t.pz));return t.map((t,r)=>t.toAffine(e[r])).map(h.fromAffine)}static fromHex(t){let e=h.fromAffine(i(A("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return h.BASE.multiply(l(t))}_setWindowSize(t){this._WINDOW_SIZE=t,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw Error("bad point: ZERO")}let{x:t,y:n}=this.toAffine();if(!r.isValid(t)||!r.isValid(n))throw Error("bad point: x or y not FE");let i=r.sqr(n),s=o(t);if(!r.eql(i,s))throw Error("bad point: equation left != right");if(!this.isTorsionFree())throw Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:t}=this.toAffine();if(r.isOdd)return!r.isOdd(t);throw Error("Field doesn't support isOdd")}equals(t){a(t);let{px:e,py:n,pz:i}=this,{px:o,py:s,pz:f}=t,l=r.eql(r.mul(e,f),r.mul(o,i)),u=r.eql(r.mul(n,f),r.mul(s,i));return l&&u}negate(){return new h(this.px,r.neg(this.py),this.pz)}double(){let{a:t,b:n}=e,i=r.mul(n,tn),{px:o,py:s,pz:f}=this,l=r.ZERO,u=r.ZERO,a=r.ZERO,d=r.mul(o,o),c=r.mul(s,s),p=r.mul(f,f),g=r.mul(o,s);return g=r.add(g,g),a=r.mul(o,f),a=r.add(a,a),l=r.mul(t,a),u=r.mul(i,p),u=r.add(l,u),l=r.sub(c,u),u=r.add(c,u),u=r.mul(l,u),l=r.mul(g,l),a=r.mul(i,a),p=r.mul(t,p),g=r.sub(d,p),g=r.mul(t,g),g=r.add(g,a),a=r.add(d,d),d=r.add(a,d),d=r.add(d,p),d=r.mul(d,g),u=r.add(u,d),p=r.mul(s,f),p=r.add(p,p),d=r.mul(p,g),l=r.sub(l,d),a=r.mul(p,c),a=r.add(a,a),new h(l,u,a=r.add(a,a))}add(t){a(t);let{px:n,py:i,pz:o}=this,{px:s,py:f,pz:l}=t,u=r.ZERO,d=r.ZERO,c=r.ZERO,p=e.a,g=r.mul(e.b,tn),y=r.mul(n,s),m=r.mul(i,f),w=r.mul(o,l),E=r.add(n,i),b=r.add(s,f);E=r.mul(E,b),b=r.add(y,m),E=r.sub(E,b),b=r.add(n,o);let B=r.add(s,l);return b=r.mul(b,B),B=r.add(y,w),b=r.sub(b,B),B=r.add(i,o),u=r.add(f,l),B=r.mul(B,u),u=r.add(m,w),B=r.sub(B,u),c=r.mul(p,b),u=r.mul(g,w),c=r.add(u,c),u=r.sub(m,c),c=r.add(m,c),d=r.mul(u,c),m=r.add(y,y),m=r.add(m,y),w=r.mul(p,w),b=r.mul(g,b),m=r.add(m,w),w=r.sub(y,w),w=r.mul(p,w),b=r.add(b,w),y=r.mul(m,b),d=r.add(d,y),y=r.mul(B,b),u=r.mul(E,u),u=r.sub(u,y),y=r.mul(E,m),c=r.mul(B,c),new h(u,d,c=r.add(c,y))}subtract(t){return this.add(t.negate())}is0(){return this.equals(h.ZERO)}wNAF(t){return c.wNAFCached(this,u,t,t=>{let e=r.invertBatch(t.map(t=>t.pz));return t.map((t,r)=>t.toAffine(e[r])).map(h.fromAffine)})}multiplyUnsafe(t){let n=h.ZERO;if(t===te)return n;if(f(t),t===tr)return this;let{endo:i}=e;if(!i)return c.unsafeLadder(this,t);let{k1neg:o,k1:s,k2neg:l,k2:u}=i.splitScalar(t),a=n,d=n,p=this;for(;s>te||u>te;)s&tr&&(a=a.add(p)),u&tr&&(d=d.add(p)),p=p.double(),s>>=tr,u>>=tr;return o&&(a=a.negate()),l&&(d=d.negate()),d=new h(r.mul(d.px,i.beta),d.py,d.pz),a.add(d)}multiply(t){let n,i;f(t);let{endo:o}=e;if(o){let{k1neg:e,k1:s,k2neg:f,k2:l}=o.splitScalar(t),{p:u,f:a}=this.wNAF(s),{p:d,f:p}=this.wNAF(l);u=c.constTimeNegate(e,u),d=c.constTimeNegate(f,d),d=new h(r.mul(d.px,o.beta),d.py,d.pz),n=u.add(d),i=a.add(p)}else{let{p:e,f:r}=this.wNAF(t);n=e,i=r}return h.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(t,e,r){let n=h.BASE,i=(t,e)=>e!==te&&e!==tr&&t.equals(n)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,r));return o.is0()?void 0:o}toAffine(t){let{px:e,py:n,pz:i}=this,o=this.is0();null==t&&(t=o?r.ONE:r.inv(i));let s=r.mul(e,t),f=r.mul(n,t),l=r.mul(i,t);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(l,r.ONE))throw Error("invZ was invalid");return{x:s,y:f}}isTorsionFree(){let{h:t,isTorsionFree:r}=e;if(t===tr)return!0;if(r)return r(h,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:t,clearCofactor:r}=e;return t===tr?this:r?r(h,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),n(h,this,t)}toHex(t=!0){return w(this.toRawBytes(t))}}h.BASE=new h(e.Gx,e.Gy,r.ONE),h.ZERO=new h(r.ZERO,r.ONE,r.ZERO);let d=e.nBitLength,c=function(t,e){let r=(t,e)=>{let r=e.negate();return t?r:e},n=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:r,unsafeLadder(e,r){let n=t.ZERO,i=e;for(;r>M;)r&W&&(n=n.add(i)),i=i.double(),r>>=W;return n},precomputeWindow(t,e){let{windows:r,windowSize:i}=n(e),o=[],s=t,f=s;for(let t=0;t>=d,n>f&&(n-=h,o+=W);let s=e+Math.abs(n)-1,c=t%2!=0,p=n<0;0===n?u=u.add(r(c,i[e])):l=l.add(r(p,i[s]))}return{p:l,f:u}},wNAFCached(t,e,r,n){let i=t._WINDOW_SIZE||1,o=e.get(t);return o||(o=this.precomputeWindow(t,i),1!==i&&e.set(t,n(o))),this.wNAF(i,o,r)}}}(h,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:s}}({...e,toBytes(t,e,n){let i=e.toAffine(),o=r.toBytes(i.x),s=S;return n?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(t){let e=t.length,n=t[0],s=t.subarray(1);if(e===i&&(2===n||3===n)){let t=B(s);if(!(tew(x(t,e.nByteLength)),d=(t,e,r)=>B(t.slice(e,r));class c{constructor(t,e,r){this.r=t,this.s=e,this.recovery=r,this.assertValidity()}static fromCompact(t){let r=e.nByteLength;return new c(d(t=A("compactSignature",t,2*r),0,r),d(t,r,2*r))}static fromDER(t){let{r:e,s:r}=tt.toSig(A("DER",t));return new c(e,r)}assertValidity(){if(!a(this.r))throw Error("r must be 0 < r < CURVE.n");if(!a(this.s))throw Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new c(this.r,this.s,t)}recoverPublicKey(t){let{r:i,s:o,recovery:l}=this,u=y(A("msgHash",t));if(null==l||![0,1,2,3].includes(l))throw Error("recovery id invalid");let a=2===l||3===l?i+e.n:i;if(a>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let d=(1&l)==0?"02":"03",c=f.fromHex(d+h(a)),p=V(a,n),g=s(-u*p),m=s(o*p),w=f.BASE.multiplyAndAddUnsafe(c,g,m);if(!w)throw Error("point at infinify");return w.assertValidity(),w}hasHighS(){return this.s>n>>tr}normalizeS(){return this.hasHighS()?new c(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return b(this.toDERHex())}toDERHex(){return tt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return b(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}function p(t){let e=t instanceof Uint8Array,r="string"==typeof t,n=(e||r)&&t.length;return e?n===i||n===o:r?n===2*i||n===2*o:t instanceof f}let g=e.bits2int||function(t){let r=B(t),n=8*t.length-e.nBitLength;return n>0?r>>BigInt(n):r},y=e.bits2int_modN||function(t){return s(g(t))},m=O(e.nBitLength);function E(t){if("bigint"!=typeof t)throw Error("bigint expected");if(!(te<=t&&tt in o))throw Error("sign() legacy options not supported");let{hash:u,randomBytes:h}=e,{lowS:d,prehash:p,extraEntropy:m}=o;null==d&&(d=!0),t=A("msgHash",t),p&&(t=A("prehashed msgHash",u(t)));let w=y(t),b=l(i),B=[E(b),E(w)];if(null!=m){let t=!0===m?h(r.BYTES):m;B.push(A("extraEntropy",t))}return{seed:S(...B),k2sig:function(t){let e=g(t);if(!a(e))return;let r=V(e,n),i=f.BASE.multiply(e).toAffine(),o=s(i.x);if(o===te)return;let l=s(r*s(w+o*b));if(l===te)return;let u=(i.x===o?0:2)|Number(i.y&tr),h=l;if(d&&l>n>>tr)h=l>n>>tr?s(-l):l,u^=1;return new c(o,h,u)}}}(t,i,o);return R(e.hash.outputLen,e.nByteLength,e.hmac)(u,h)},verify:function(t,r,i,o=N){let l,u;if(r=A("msgHash",r),i=A("publicKey",i),"strict"in o)throw Error("options.strict was renamed to lowS");let{lowS:a,prehash:h}=o;try{if("string"==typeof t||t instanceof Uint8Array)try{u=c.fromDER(t)}catch(e){if(!(e instanceof tt.Err))throw e;u=c.fromCompact(t)}else if("object"==typeof t&&"bigint"==typeof t.r&&"bigint"==typeof t.s){let{r:e,s:r}=t;u=new c(e,r)}else throw Error("PARSE");l=f.fromHex(i)}catch(t){if("PARSE"===t.message)throw Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(a&&u.hasHighS())return!1;h&&(r=e.hash(r));let{r:d,s:p}=u,g=y(r),m=V(p,n),w=s(g*m),E=s(d*m),b=f.BASE.multiplyAndAddUnsafe(l,w,E)?.toAffine();return!!b&&s(b.x)===d},ProjectivePoint:f,Signature:c,utils:{isValidPrivateKey(t){try{return l(t),!0}catch(t){return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{let t=D(e.n);return function(t,e,r=!1){let n=t.length,i=G(e),o=D(e);if(n<16||n1024)throw Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=T(r?B(t):I(t),e-$)+$;return r?v(s,i):x(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=f.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}})({...t,hash:e,hmac:(t,...r)=>Y(e,t,(0,o.eV)(...r)),randomBytes:o.O6});return Object.freeze({...r(e),create:r})}({a:BigInt(0),b:BigInt(7),Fp:tu,n:to,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-ts*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),n=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=BigInt("0x100000000000000000000000000000000"),o=tl(e*t,to),s=tl(-r*t,to),f=T(t-o*e-s*n,to),l=T(-o*r-s*e,to),u=f>i,a=l>i;if(u&&(f=to-f),a&&(l=to-l),f>i||l>i)throw Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:u,k1:f,k2neg:a,k2:l}}}},c);BigInt(0),ta.ProjectivePoint}}]); \ No newline at end of file diff --git a/_next/static/chunks/6139e184.f7be02f919211e5d.js b/_next/static/chunks/6139e184.f7be02f919211e5d.js new file mode 100644 index 0000000000000000000000000000000000000000..4ad61351dda985922e08e93d6b1f43f8f9f1aa84 --- /dev/null +++ b/_next/static/chunks/6139e184.f7be02f919211e5d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[132],{99454:function(e,s,t){t.d(s,{$Bv:function(){return ia},$Sz:function(){return a2},DcG:function(){return ic},ENH:function(){return ir},En$:function(){return is},Hqk:function(){return a7},IFL:function(){return iu},K2m:function(){return il},Kf0:function(){return a4},LdW:function(){return io},OjJ:function(){return a1},S2d:function(){return id},U$$:function(){return it},Zn:function(){return ii},hY6:function(){return i_},hZO:function(){return a3},lbf:function(){return a5},o$X:function(){return a0},t78:function(){return a9},tLj:function(){return ie},wiU:function(){return a8},z6E:function(){return a6}});var n=t(90016),a=t(20761),i=t(40911),o=t(45774),r=t(62414),l=t(71542),c=t(78703);let{InferenceSession:d,Tensor:_,env:u}=l.ONNX,h={EncoderOnly:0,EncoderDecoder:1,Seq2Seq:2,Vision2Seq:3,DecoderOnly:4,MaskGeneration:5},m=new Map,p=new Map,f=new Map;async function g(e,s,t){let n=`onnx/${s}${t.quantized?"_quantized":""}.onnx`,a=await (0,i.st)(e,n,!0,t);try{return await d.create(a,{executionProviders:l.p})}catch(e){if(1===l.p.length&&"wasm"===l.p[0])throw e;return console.warn(e),console.warn("Something went wrong during model construction (most likely a missing operation). Using `wasm` as a fallback. "),await d.create(a,{executionProviders:["wasm"]})}}async function w(e,s){let t=function(e,s){let t=Object.create(null),n=[];for(let a of e.inputNames){let e=s[a];if(!(e instanceof r.es)){n.push(a);continue}t[a]=u.wasm.proxy?e.clone():e}if(n.length>0)throw Error(`An error occurred during model execution: "Missing the following inputs: ${n.join(", ")}.`);let a=Object.keys(s).length,i=e.inputNames.length;if(a>i){let t=Object.keys(s).filter(s=>!e.inputNames.includes(s));console.warn(`WARNING: Too many inputs were provided (${a} > ${i}). The following inputs will be ignored: "${t.join(", ")}".`)}return t}(e,s);try{let s=await e.run(t);return s=function e(s){for(let t in s)s[t]instanceof _?s[t]=new r.es(s[t]):"object"==typeof s[t]&&e(s[t]);return s}(s)}catch(e){throw console.error(`An error occurred during model execution: "${e}".`),console.error("Inputs given to model:",t),e}}function x(e,s){let t=e.config.pad_token_id??null,n=e.config.eos_token_id??null;(0,a.Wy)(n)&&(n=[n]);let i=-1!==s.indexOf(t),o=null===n||!n.includes(t);if(!i||!o)return(0,r.r6)(s);{let e=BigInt64Array.from(s.data.map(e=>e!=t));return new r.es("int64",e,s.dims)}}function y(e,s,t){if(!e.inputNames.includes("position_ids"))return;let n=new BigInt64Array(s.attention_mask.data.length);for(let e=0;eBigInt(e))),[1,e.length]);if(e.some(s=>s.length!==e[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new r.es("int64",BigInt64Array.from(e.flat().map(e=>BigInt(e))),[e.length,e[0].length])}(n),encoder_outputs:s.encoder_outputs,past_key_values:s.prev_model_outputs?.past_key_values};s.attention_mask&&(a.attention_mask=s.attention_mask);let i=await e.forward(a);return s.prev_model_outputs=i,s.encoder_outputs=i.encoder_outputs,i}function S(e,s){e.output_token_ids=[...e.output_token_ids,s]}async function C(e,s){let t=Object.create(null);for(let n of e.session.inputNames)t[n]=s[n];return e.session.inputNames.includes("token_type_ids")&&!t.token_type_ids&&(t.token_type_ids=new r.es("int64",new BigInt64Array(t.input_ids.data.length),t.input_ids.dims)),await w(e.session,t)}async function F(e,s){let{input_ids:t,past_key_values:n,attention_mask:a}=s,i={input_ids:t,attention_mask:a??x(e,t)},o=!!n;e.session.inputNames.includes("use_cache_branch")&&(i.use_cache_branch=M(o)),y(e.session,i,o),e.addPastKeyValues(i,n);let r=await w(e.session,i);return{logits:r.logits,past_key_values:n=e.getPastKeyValues(r,n)}}function L(e,s,t,n,a){let i=[],o=0;for(let t of s){let s,r=t.tolist().map(Number);t.dims=[1,...t.dims],a?(s=a[o]).dims=[1,...s.dims]:s=x(e,t);let l={input:t,model_input_ids:t,attention_mask:s,prev_model_outputs:null,output_token_ids:r,num_output_tokens:n,done:!1,score:0,id:o++};i.push(l)}return i}async function A(e,s){let t=new BigInt64Array(s.output_token_ids.length).fill(1n),n={input_ids:s.model_input_ids,attention_mask:new r.es("int64",t,[1,t.length]),past_key_values:s.prev_model_outputs?.past_key_values},a=await e.forward(n);return s.prev_model_outputs=a,a}function P(e,s){e.output_token_ids=[...e.output_token_ids,s],e.model_input_ids=new r.es("int64",[BigInt(s)],[1,1])}class E extends a.Ag{main_input_name="input_ids";constructor(e,s){super(),this.config=e,this.session=s;let t=f.get(this.constructor),n=m.get(t);this.can_generate=!1,this._runBeam=null,this._getStartBeams=null,this._updateBeam=null,this._forward=null,n===h.DecoderOnly?(this.can_generate=!0,this._runBeam=A,this._getStartBeams=L,this._updateBeam=P,this._forward=F):n===h.Seq2Seq||n===h.Vision2Seq?(this.can_generate=!0,this._runBeam=v,this._getStartBeams=b,this._updateBeam=S,this._forward=k):(h.EncoderDecoder,this._forward=C)}async dispose(){let e=[];for(let s of Object.keys(this)){let t=this[s];t instanceof d&&e.push(t.handler.dispose())}return await Promise.all(e)}static async from_pretrained(e,{quantized:s=!0,progress_callback:t=null,config:a=null,cache_dir:o=null,local_files_only:r=!1,revision:l="main",model_file_name:c=null}={}){let d,_={quantized:s,progress_callback:t,config:a,cache_dir:o,local_files_only:r,revision:l,model_file_name:c},u=f.get(this),p=m.get(u);return p===h.DecoderOnly?d=await Promise.all([n.z.from_pretrained(e,_),g(e,_.model_file_name??"decoder_model_merged",_),(0,i.yM)(e,"generation_config.json",!1,_)]):p===h.Seq2Seq||p===h.Vision2Seq?d=await Promise.all([n.z.from_pretrained(e,_),g(e,"encoder_model",_),g(e,"decoder_model_merged",_),(0,i.yM)(e,"generation_config.json",!1,_)]):p===h.MaskGeneration?d=await Promise.all([n.z.from_pretrained(e,_),g(e,"vision_encoder",_),g(e,"prompt_encoder_mask_decoder",_)]):p===h.EncoderDecoder?d=await Promise.all([n.z.from_pretrained(e,_),g(e,"encoder_model",_),g(e,"decoder_model_merged",_)]):(p!==h.EncoderOnly&&console.warn(`Model type for '${u??a?.model_type}' not found, assuming encoder-only architecture. Please report this at https://github.com/xenova/transformers.js/issues/new/choose.`),d=await Promise.all([n.z.from_pretrained(e,_),g(e,_.model_file_name??"model",_)])),new this(...d)}async _call(e){return await this.forward(e)}async forward(e){return await this._forward(this,e)}_get_logits_processor(e,s,t=null){let n=new o.Jm;if(null!==e.repetition_penalty&&1!==e.repetition_penalty&&n.push(new o.Jj(e.repetition_penalty)),null!==e.no_repeat_ngram_size&&e.no_repeat_ngram_size>0&&n.push(new o.jF(e.no_repeat_ngram_size)),null!==e.bad_words_ids&&n.push(new o.AE(e.bad_words_ids,e.eos_token_id)),null!==e.min_length&&null!==e.eos_token_id&&e.min_length>0&&n.push(new o.ez(e.min_length,e.eos_token_id)),null!==e.min_new_tokens&&null!==e.eos_token_id&&e.min_new_tokens>0&&n.push(new o.CJ(s,e.min_new_tokens,e.eos_token_id)),null!==e.forced_bos_token_id&&n.push(new o.C9(e.forced_bos_token_id)),null!==e.forced_eos_token_id&&n.push(new o.dZ(e.max_length,e.forced_eos_token_id)),null!==e.begin_suppress_tokens){let t=s>1||null===e.forced_bos_token_id?s:s+1;null!==e.forced_decoder_ids&&(t+=e.forced_decoder_ids[e.forced_decoder_ids.length-1][0]),n.push(new o.GU(e.begin_suppress_tokens,t))}return null!==e.forced_decoder_ids&&n.push(new o.E(e.forced_decoder_ids)),null!==t&&n.extend(t),n}_get_generation_config(e){let s=new o.aP(this.config);return"generation_config"in this&&Object.assign(s,this.generation_config),null!==e&&Object.assign(s,e),s}async generate(e,s=null,t=null,{inputs_attention_mask:n=null}={}){let i;if(!this.can_generate){let e=f.get(this.constructor),s=`The current model class (${e}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`,t=this.config.model_type,n=aT.get(t)??aB.get(t)??aL.get(t)??aq.get(t);throw n&&(s+=` Please use the following class instead: '${n[0]}'`),Error(s)}if(!(e instanceof r.es)&&!(0,a.fU)(e)&&!Array.isArray(e))throw Error(`\`inputs\` must be a Tensor, TypedArray, or Array, but is "${e.constructor.name}".`);if(this.config.is_encoder_decoder)i=0;else if(0===(i=e instanceof r.es?e.dims.at(-1):e.length))throw Error("Must supply a non-empty array of input token ids.");s=this._get_generation_config(s),t=t??new o.Jm,t=this._get_logits_processor(s,i,t);let l=s.eos_token_id;null===l||Array.isArray(l)||(l=[l]);let c=1,d=1+(s.max_new_tokens??1/0),_=Number.isInteger(s.max_length)&&(s.max_new_tokens??null)===null,u=o.Z4.getSampler(s),h=this.getStartBeams(e,s,c,n);for(;h.some(e=>!e.done)&&c=s.max_length){n.done=!0,e.push(n);continue}let a=await this.runBeam(n);s.output_attentions&&this.addAttentionsToBeam(n,a),s.output_scores;let i=a.logits.slice(null,-1,null);for(let[s,a]of(t(n.output_token_ids,i),u(i))){let t={...n};this.updateBeam(t,s),t.score+=a,l&&l.includes(s)&&(t.done=!0),e.push(t)}}++c,h=(e=this.groupBeams(e).map(e=>e.sort((e,s)=>s.score-e.score).slice(0,s.num_beams))).flat(),s.callback_function&&s.callback_function(h)}let m=this.groupBeams(h),p=e=>m.map(t=>s.num_return_sequences>1?t.slice(0,s.num_return_sequences).map(s=>s[e]):[t[0][e]]).flat(),g=p("output_token_ids");return s.return_dict_in_generate?{sequences:g,decoder_attentions:p("decoder_attentions"),cross_attentions:p("cross_attentions")}:g}addAttentionsToBeam(e,s){if(this.config.is_encoder_decoder){if(!s.cross_attentions||0===s.cross_attentions.length)throw Error("`output_attentions` is true, but the model did not produce cross-attentions. This is most likely because the model was not exported with `output_attentions=True`.");e.cross_attentions||(e.cross_attentions=[]),e.cross_attentions.push(s.cross_attentions)}if(!s.decoder_attentions||0===s.decoder_attentions.length)throw Error("`output_attentions` is true, but the model did not produce decoder-attentions. This is most likely because the model was not exported with `output_attentions=True`.");e.decoder_attentions||(e.decoder_attentions=[]),e.decoder_attentions.push(s.decoder_attentions)}groupBeams(e){let s=Object.create(null);for(let t of e)void 0===s[t.id]?s[t.id]=[t]:s[t.id].push(t);return Object.values(s)}getPastKeyValues(e,s){let t=Object.create(null);for(let n in e)if(n.startsWith("present")){let a=n.replace("present","past_key_values");s&&n.includes("encoder")?t[a]=s[a]:t[a]=e[n]}return t}getAttentions(e){let s=Object.create(null);for(let t of["cross_attentions","decoder_attentions"]){let n=[];for(let s in e)s.startsWith(t)&&(n[s.split(".").pop()]=e[s]);s[t]=n}return s}addPastKeyValues(e,s){if(s)Object.assign(e,s);else if(this.config.is_encoder_decoder&&(this.add_encoder_pkv??!0)){let s=[1,this.num_encoder_heads,0,this.encoder_dim_kv],t=[1,this.num_decoder_heads,0,this.decoder_dim_kv];for(let n=0;n{let n=Array.from({length:this.config.decoder_layers},(s,t)=>(0,r.d3)(e.map(e=>e[t]),2)),a=(0,r.kn)(s.map(([e,s])=>t?n[e].slice(null,s,null,[0,t]):n[e].slice(null,s)));a=a.transpose(1,0,2,3);let[o,l]=(0,r.f3)(a,-2,0,!0),d=a.clone();for(let e=0;et[s+1]-t[s]),c=(0,a.eG)([1],l).map(e=>!!e),_=[];for(let e=0;ee*s,1);e.input_labels=new r.es("int64",new BigInt64Array(t).fill(1n),s)}return await w(this.prompt_encoder_mask_decoder,{input_points:e.input_points,input_labels:e.input_labels,image_embeddings:e.image_embeddings,image_positional_embeddings:e.image_positional_embeddings})}async _call(e){return new nS(await super._call(e))}}class nS extends O{constructor({iou_scores:e,pred_masks:s}){super(),this.iou_scores=e,this.pred_masks=s}}class nC extends E{}class nF extends nC{}class nL extends nC{constructor(e,s,t,n){super(e,s),this.decoder_merged_session=t,this.generation_config=n,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class nA extends E{}class nP extends nA{}class nE extends nA{constructor(e,s,t,n){super(e,s),this.decoder_merged_session=t,this.generation_config=n,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class nO extends E{}class nB extends nO{}class nT extends nO{async _call(e){return new iy(await super._call(e))}}class nD extends nO{async _call(e){return new im(await super._call(e))}}class nI extends nO{async _call(e){return new ig(await super._call(e))}}class nq extends E{}class nN extends nq{}class nG extends nq{async _call(e){return new iy(await super._call(e))}}class nV extends nq{async _call(e){return new im(await super._call(e))}}class nz extends E{}class nj extends nz{}class n$ extends nz{async _call(e){return new iy(await super._call(e))}}class nW extends nz{async _call(e){return new im(await super._call(e))}}class nR extends nz{async _call(e){return new ig(await super._call(e))}}class nQ extends E{}class nU extends nQ{}class nX extends nQ{async _call(e){return new iy(await super._call(e))}}class nK extends nQ{async _call(e){return new im(await super._call(e))}}class nH extends nO{}class nJ extends nO{async _call(e){return new iy(await super._call(e))}}class nZ extends nO{async _call(e){return new im(await super._call(e))}}class nY extends E{}class n2 extends nY{}class n0 extends nY{async _call(e){return new iy(await super._call(e))}}class n1 extends nY{async _call(e){return new im(await super._call(e))}}class n4 extends nY{async _call(e){return new ip(await super._call(e))}}class n3 extends nY{async _call(e){return new ig(await super._call(e))}}class n5 extends E{}class n6 extends n5{}class n7 extends n5{constructor(e,s,t,n){super(e,s),this.decoder_merged_session=t,this.generation_config=n,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.hidden_size/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.hidden_size/this.num_encoder_heads}async generate_speech(e,s,{threshold:t=.5,minlenratio:n=0,maxlenratio:a=20,vocoder:i=null}={}){let{encoder_outputs:o,encoder_attention_mask:l}=await C(this,{input_ids:e}),c=o.dims[1]/this.config.reduction_factor,d=Math.floor(c*a),_=Math.floor(c*n),u=this.config.num_mel_bins,h=[],m=null,p=null,f=0;for(;;){++f;let e={use_cache_branch:M(!!p),output_sequence:p?p.output_sequence_out:new r.es("float32",new Float32Array(u),[1,1,u]),encoder_attention_mask:l,speaker_embeddings:s,encoder_hidden_states:o};this.addPastKeyValues(e,m),p=await w(this.decoder_merged_session,e),m=this.getPastKeyValues(p,m);let{prob:n,spectrum:a}=p;if(h.push(a),f>=_&&(Array.from(n.data).filter(e=>e>=t).length>0||f>=d))break}let g=(0,r.d3)(h),{waveform:x}=await w(i.session,{spectrogram:g});return{spectrogram:g,waveform:x}}}class n9 extends E{main_input_name="spectrogram"}class n8 extends E{constructor(e,s,t){super(e,s),this.generation_config=t,this.config.pad_token_id=this.config.eos_token_id,this.num_encoder_layers=this.num_decoder_layers=this.config.decoder_layers,this.num_encoder_heads=this.num_decoder_heads=this.config.decoder_attention_heads,this.encoder_dim_kv=this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads}}class ae extends n8{}class as extends E{constructor(e,s,t){super(e,s),this.generation_config=t,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_key_value_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class at extends as{}class an extends as{}class aa extends E{constructor(e,s,t){super(e,s),this.generation_config=t,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_key_value_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class ai extends aa{}class ao extends aa{}class ar extends E{constructor(e,s,t){super(e,s),this.generation_config=t,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class al extends ar{}class ac extends ar{}class ad extends E{}class a_ extends ad{}class au extends ad{static async from_pretrained(e,s={}){return s.model_file_name??="text_model",super.from_pretrained(e,s)}}class ah extends ad{static async from_pretrained(e,s={}){return s.model_file_name??="audio_model",super.from_pretrained(e,s)}}class am extends E{}class ap extends am{async _call(e){return new ik(await super._call(e))}}class af extends E{}class ag extends af{}class aw extends af{}class ax extends E{constructor(e,s,t){super(e,s),this.generation_config=t,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.num_heads}}class ay extends ax{}class aM extends E{}class ak extends aM{}class ab extends aM{async _call(e){return new im(await super._call(e))}}class av{static MODEL_CLASS_MAPPINGS=null;static BASE_IF_FAIL=!1;static async from_pretrained(e,{quantized:s=!0,progress_callback:t=null,config:a=null,cache_dir:i=null,local_files_only:o=!1,revision:r="main",model_file_name:l=null}={}){let c={quantized:s,progress_callback:t,config:a,cache_dir:i,local_files_only:o,revision:r,model_file_name:l};if(a=await n.z.from_pretrained(e,c),c.config||(c.config=a),!this.MODEL_CLASS_MAPPINGS)throw Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);for(let s of this.MODEL_CLASS_MAPPINGS){let t=s.get(a.model_type);if(t)return await t[1].from_pretrained(e,c)}if(this.BASE_IF_FAIL)return console.warn(`Unknown model class "${a.model_type}", attempting to construct from base class.`),await E.from_pretrained(e,c);throw Error(`Unsupported model type: ${a.model_type}`)}}let aS=new Map([["bert",["BertModel",T]],["nomic_bert",["NomicBertModel",V]],["roformer",["RoFormerModel",j]],["electra",["ElectraModel",ee]],["esm",["EsmModel",eP]],["convbert",["ConvBertModel",X]],["camembert",["CamembertModel",eo]],["deberta",["DebertaModel",eu]],["deberta-v2",["DebertaV2Model",ew]],["mpnet",["MPNetModel",eV]],["albert",["AlbertModel",eJ]],["distilbert",["DistilBertModel",ev]],["roberta",["RobertaModel",sf]],["xlm",["XLMModel",sk]],["xlm-roberta",["XLMRobertaModel",sL]],["clap",["ClapModel",a_]],["clip",["CLIPModel",sz]],["clipseg",["CLIPSegModel",sJ]],["chinese_clip",["ChineseCLIPModel",sK]],["siglip",["SiglipModel",sR]],["mobilebert",["MobileBertModel",eD]],["squeezebert",["SqueezeBertModel",eQ]],["wav2vec2",["Wav2Vec2Model",nB]],["wav2vec2-bert",["Wav2Vec2BertModel",nU]],["unispeech",["UniSpeechModel",nN]],["unispeech-sat",["UniSpeechSatModel",nj]],["hubert",["HubertModel",nH]],["wavlm",["WavLMModel",n2]],["audio-spectrogram-transformer",["ASTModel",sT]],["vits",["VitsModel",ap]],["detr",["DetrModel",t$]],["table-transformer",["TableTransformerModel",tK]],["vit",["ViTModel",tC]],["mobilevit",["MobileViTModel",tE]],["owlvit",["OwlViTModel",tT]],["owlv2",["Owlv2Model",tq]],["beit",["BeitModel",tV]],["deit",["DeiTModel",tY]],["convnext",["ConvNextModel",n_]],["convnextv2",["ConvNextV2Model",nm]],["dinov2",["Dinov2Model",ng]],["resnet",["ResNetModel",t1]],["swin",["SwinModel",t5]],["swin2sr",["Swin2SRModel",t9]],["donut-swin",["DonutSwinModel",nc]],["yolos",["YolosModel",ny]],["dpt",["DPTModel",ns]],["glpn",["GLPNModel",no]],["hifigan",["SpeechT5HifiGan",n9]],["efficientnet",["EfficientNetModel",ak]]]),aC=new Map([["t5",["T5Model",e1]],["longt5",["LongT5Model",e5]],["mt5",["MT5Model",e9]],["bart",["BartModel",ss]],["mbart",["MBartModel",si]],["marian",["MarianModel",nF]],["whisper",["WhisperModel",sq]],["m2m_100",["M2M100Model",nP]],["blenderbot",["BlenderbotModel",sd]],["blenderbot-small",["BlenderbotSmallModel",sh]]]),aF=new Map([["bloom",["BloomModel",tg]],["gpt2",["GPT2Model",s2]],["gptj",["GPTJModel",s8]],["gpt_bigcode",["GPTBigCodeModel",tt]],["gpt_neo",["GPTNeoModel",s4]],["gpt_neox",["GPTNeoXModel",s6]],["codegen",["CodeGenModel",ti]],["llama",["LlamaModel",tl]],["qwen2",["Qwen2Model",t_]],["phi",["PhiModel",tm]],["mpt",["MptModel",ty]],["opt",["OPTModel",tb]],["mistral",["MistralModel",at]],["starcoder2",["Starcoder2Model",ai]],["falcon",["FalconModel",al]]]),aL=new Map([["speecht5",["SpeechT5ForSpeechToText",n6]],["whisper",["WhisperForConditionalGeneration",sN]]]),aA=new Map([["speecht5",["SpeechT5ForTextToSpeech",n7]]]),aP=new Map([["vits",["VitsModel",ap]]]),aE=new Map([["bert",["BertForSequenceClassification",I]],["roformer",["RoFormerForSequenceClassification",W]],["electra",["ElectraForSequenceClassification",et]],["esm",["EsmForSequenceClassification",eO]],["convbert",["ConvBertForSequenceClassification",H]],["camembert",["CamembertForSequenceClassification",el]],["deberta",["DebertaForSequenceClassification",em]],["deberta-v2",["DebertaV2ForSequenceClassification",ey]],["mpnet",["MPNetForSequenceClassification",ej]],["albert",["AlbertForSequenceClassification",eZ]],["distilbert",["DistilBertForSequenceClassification",eS]],["roberta",["RobertaForSequenceClassification",sw]],["xlm",["XLMForSequenceClassification",sv]],["xlm-roberta",["XLMRobertaForSequenceClassification",sP]],["bart",["BartForSequenceClassification",sn]],["mbart",["MBartForSequenceClassification",sr]],["mobilebert",["MobileBertForSequenceClassification",eq]],["squeezebert",["SqueezeBertForSequenceClassification",eX]]]),aO=new Map([["bert",["BertForTokenClassification",q]],["roformer",["RoFormerForTokenClassification",R]],["electra",["ElectraForTokenClassification",en]],["esm",["EsmForTokenClassification",eB]],["convbert",["ConvBertForTokenClassification",J]],["camembert",["CamembertForTokenClassification",ec]],["deberta",["DebertaForTokenClassification",ep]],["deberta-v2",["DebertaV2ForTokenClassification",eM]],["mpnet",["MPNetForTokenClassification",e$]],["distilbert",["DistilBertForTokenClassification",eC]],["roberta",["RobertaForTokenClassification",sx]],["xlm",["XLMForTokenClassification",sS]],["xlm-roberta",["XLMRobertaForTokenClassification",sE]]]),aB=new Map([["t5",["T5ForConditionalGeneration",e4]],["longt5",["LongT5ForConditionalGeneration",e6]],["mt5",["MT5ForConditionalGeneration",e8]],["bart",["BartForConditionalGeneration",st]],["mbart",["MBartForConditionalGeneration",so]],["marian",["MarianMTModel",nL]],["m2m_100",["M2M100ForConditionalGeneration",nE]],["blenderbot",["BlenderbotForConditionalGeneration",s_]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",sm]]]),aT=new Map([["bloom",["BloomForCausalLM",tw]],["gpt2",["GPT2LMHeadModel",s0]],["gptj",["GPTJForCausalLM",te]],["gpt_bigcode",["GPTBigCodeForCausalLM",tn]],["gpt_neo",["GPTNeoForCausalLM",s3]],["gpt_neox",["GPTNeoXForCausalLM",s7]],["codegen",["CodeGenForCausalLM",to]],["llama",["LlamaForCausalLM",tc]],["qwen2",["Qwen2ForCausalLM",tu]],["phi",["PhiForCausalLM",tp]],["mpt",["MptForCausalLM",tM]],["opt",["OPTForCausalLM",tv]],["mbart",["MBartForCausalLM",sl]],["mistral",["MistralForCausalLM",an]],["starcoder2",["Starcoder2ForCausalLM",ao]],["falcon",["FalconForCausalLM",ac]],["trocr",["TrOCRForCausalLM",ae]],["stablelm",["StableLmForCausalLM",ay]]]),aD=new Map([["bert",["BertForMaskedLM",D]],["roformer",["RoFormerForMaskedLM",$]],["electra",["ElectraForMaskedLM",es]],["esm",["EsmForMaskedLM",eE]],["convbert",["ConvBertForMaskedLM",K]],["camembert",["CamembertForMaskedLM",er]],["deberta",["DebertaForMaskedLM",eh]],["deberta-v2",["DebertaV2ForMaskedLM",ex]],["mpnet",["MPNetForMaskedLM",ez]],["albert",["AlbertForMaskedLM",e2]],["distilbert",["DistilBertForMaskedLM",eL]],["roberta",["RobertaForMaskedLM",sg]],["xlm",["XLMWithLMHeadModel",sb]],["xlm-roberta",["XLMRobertaForMaskedLM",sA]],["mobilebert",["MobileBertForMaskedLM",eI]],["squeezebert",["SqueezeBertForMaskedLM",eU]]]),aI=new Map([["bert",["BertForQuestionAnswering",N]],["roformer",["RoFormerForQuestionAnswering",Q]],["electra",["ElectraForQuestionAnswering",ea]],["convbert",["ConvBertForQuestionAnswering",Z]],["camembert",["CamembertForQuestionAnswering",ed]],["deberta",["DebertaForQuestionAnswering",ef]],["deberta-v2",["DebertaV2ForQuestionAnswering",ek]],["mpnet",["MPNetForQuestionAnswering",eW]],["albert",["AlbertForQuestionAnswering",eY]],["distilbert",["DistilBertForQuestionAnswering",eF]],["roberta",["RobertaForQuestionAnswering",sy]],["xlm",["XLMForQuestionAnswering",sC]],["xlm-roberta",["XLMRobertaForQuestionAnswering",sO]],["mobilebert",["MobileBertForQuestionAnswering",eN]],["squeezebert",["SqueezeBertForQuestionAnswering",eK]]]),aq=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",sG]]]),aN=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",sG]]]),aG=new Map([["vit",["ViTForImageClassification",tF]],["mobilevit",["MobileViTForImageClassification",tO]],["beit",["BeitForImageClassification",tz]],["deit",["DeiTForImageClassification",t2]],["convnext",["ConvNextForImageClassification",nu]],["convnextv2",["ConvNextV2ForImageClassification",np]],["dinov2",["Dinov2ForImageClassification",nw]],["resnet",["ResNetForImageClassification",t4]],["swin",["SwinForImageClassification",t6]],["segformer",["SegformerForImageClassification",ag]],["efficientnet",["EfficientNetForImageClassification",ab]]]),aV=new Map([["detr",["DetrForObjectDetection",tW]],["table-transformer",["TableTransformerForObjectDetection",tH]],["yolos",["YolosForObjectDetection",nM]]]),az=new Map([["owlvit",["OwlViTForObjectDetection",tD]],["owlv2",["Owlv2ForObjectDetection",tN]]]),aj=new Map([["detr",["DetrForSegmentation",tR]],["clipseg",["CLIPSegForImageSegmentation",sZ]]]),a$=new Map([["segformer",["SegformerForSemanticSegmentation",aw]]]),aW=new Map([["sam",["SamModel",nv]]]),aR=new Map([["wav2vec2",["Wav2Vec2ForCTC",nT]],["wav2vec2-bert",["Wav2Vec2BertForCTC",nX]],["unispeech",["UniSpeechForCTC",nG]],["unispeech-sat",["UniSpeechSatForCTC",n$]],["wavlm",["WavLMForCTC",n0]],["hubert",["HubertForCTC",nJ]]]),aQ=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",nD]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",nK]],["unispeech",["UniSpeechForSequenceClassification",nV]],["unispeech-sat",["UniSpeechSatForSequenceClassification",nW]],["wavlm",["WavLMForSequenceClassification",n1]],["hubert",["HubertForSequenceClassification",nZ]],["audio-spectrogram-transformer",["ASTForAudioClassification",sD]]]),aU=new Map([["wavlm",["WavLMForXVector",n4]]]),aX=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",nR]],["wavlm",["WavLMForAudioFrameClassification",n3]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",nI]]]),aK=new Map([["vitmatte",["VitMatteForImageMatting",tA]]]),aH=new Map([["swin2sr",["Swin2SRForImageSuperResolution",t8]]]),aJ=new Map([["dpt",["DPTForDepthEstimation",nt]],["depth_anything",["DepthAnythingForDepthEstimation",na]],["glpn",["GLPNForDepthEstimation",nr]]]),aZ=new Map([["clip",["CLIPVisionModelWithProjection",s$]],["siglip",["SiglipVisionModel",sU]]]),aY=[[aS,h.EncoderOnly],[aC,h.EncoderDecoder],[aF,h.DecoderOnly],[aE,h.EncoderOnly],[aO,h.EncoderOnly],[aB,h.Seq2Seq],[aL,h.Seq2Seq],[aT,h.DecoderOnly],[aD,h.EncoderOnly],[aI,h.EncoderOnly],[aq,h.Vision2Seq],[aG,h.EncoderOnly],[aj,h.EncoderOnly],[a$,h.EncoderOnly],[aK,h.EncoderOnly],[aH,h.EncoderOnly],[aJ,h.EncoderOnly],[aV,h.EncoderOnly],[az,h.EncoderOnly],[aW,h.MaskGeneration],[aR,h.EncoderOnly],[aQ,h.EncoderOnly],[aA,h.Seq2Seq],[aP,h.EncoderOnly],[aU,h.EncoderOnly],[aX,h.EncoderOnly],[aZ,h.EncoderOnly]];for(let[e,s]of aY)for(let[t,n]of e.values())m.set(t,s),f.set(n,t),p.set(t,n);for(let[e,s,t]of[["CLIPTextModelWithProjection",sj,h.EncoderOnly],["SiglipTextModel",sQ,h.EncoderOnly],["ClapTextModelWithProjection",au,h.EncoderOnly],["ClapAudioModelWithProjection",ah,h.EncoderOnly]])m.set(e,t),f.set(s,e),p.set(e,s);class a2 extends av{static MODEL_CLASS_MAPPINGS=aY.map(e=>e[0]);static BASE_IF_FAIL=!0}class a0 extends av{static MODEL_CLASS_MAPPINGS=[aE]}class a1 extends av{static MODEL_CLASS_MAPPINGS=[aO]}class a4 extends av{static MODEL_CLASS_MAPPINGS=[aB]}class a3 extends av{static MODEL_CLASS_MAPPINGS=[aL]}class a5 extends av{static MODEL_CLASS_MAPPINGS=[aA]}class a6 extends av{static MODEL_CLASS_MAPPINGS=[aP]}class a7 extends av{static MODEL_CLASS_MAPPINGS=[aT]}class a9 extends av{static MODEL_CLASS_MAPPINGS=[aD]}class a8 extends av{static MODEL_CLASS_MAPPINGS=[aI]}class ie extends av{static MODEL_CLASS_MAPPINGS=[aq]}class is extends av{static MODEL_CLASS_MAPPINGS=[aG]}class it extends av{static MODEL_CLASS_MAPPINGS=[aj]}class ia extends av{static MODEL_CLASS_MAPPINGS=[a$]}class ii extends av{static MODEL_CLASS_MAPPINGS=[aV]}class io extends av{static MODEL_CLASS_MAPPINGS=[az]}class ir extends av{static MODEL_CLASS_MAPPINGS=[aR]}class il extends av{static MODEL_CLASS_MAPPINGS=[aQ]}class ic extends av{static MODEL_CLASS_MAPPINGS=[aN]}class id extends av{static MODEL_CLASS_MAPPINGS=[aH]}class i_ extends av{static MODEL_CLASS_MAPPINGS=[aJ]}class iu extends av{static MODEL_CLASS_MAPPINGS=[aZ]}class ih extends O{constructor({logits:e,past_key_values:s,encoder_outputs:t,decoder_attentions:n=null,cross_attentions:a=null}){super(),this.logits=e,this.past_key_values=s,this.encoder_outputs=t,this.decoder_attentions=n,this.cross_attentions=a}}class im extends O{constructor({logits:e}){super(),this.logits=e}}class ip extends O{constructor({logits:e,embeddings:s}){super(),this.logits=e,this.embeddings=s}}class ig extends O{constructor({logits:e}){super(),this.logits=e}}class iw extends O{constructor({logits:e}){super(),this.logits=e}}class ix extends O{constructor({start_logits:e,end_logits:s}){super(),this.start_logits=e,this.end_logits=s}}class iy extends O{constructor({logits:e}){super(),this.logits=e}}class iM extends O{constructor({alphas:e}){super(),this.alphas=e}}class ik extends O{constructor({waveform:e,spectrogram:s}){super(),this.waveform=e,this.spectrogram=s}}}}]); \ No newline at end of file diff --git a/_next/static/chunks/631-4a742885cf0d6748.js b/_next/static/chunks/631-4a742885cf0d6748.js new file mode 100644 index 0000000000000000000000000000000000000000..091c6f6ec2d4c0e21c37ec8d3a3c3376a115eee4 --- /dev/null +++ b/_next/static/chunks/631-4a742885cf0d6748.js @@ -0,0 +1,26 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[631],{13414:function(e,t,n){var r=n(2381).Symbol;e.exports=r},12731:function(e,t,n){var r=n(13414),o=n(37363),i=n(68391),l=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":l&&l in Object(e)?o(e):i(e)}},19334:function(e,t,n){var r=n(25788),o=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},93330:function(e,t,n){var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},37363:function(e,t,n){var r=n(13414),o=Object.prototype,i=o.hasOwnProperty,l=o.toString,a=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch(e){}var o=l.call(e);return r&&(t?e[a]=n:delete e[a]),o}},68391:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},2381:function(e,t,n){var r=n(93330),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},25788:function(e){var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},22170:function(e,t,n){var r=n(63117),o=n(49423),i=n(49666),l=Math.max,a=Math.min;e.exports=function(e,t,n){var u,c,s,f,d,p,b=0,v=!1,m=!1,y=!0;if("function"!=typeof e)throw TypeError("Expected a function");function h(t){var n=u,r=c;return u=c=void 0,b=t,f=e.apply(r,n)}function g(e){var n=e-p,r=e-b;return void 0===p||n>=t||n<0||m&&r>=s}function x(){var e,n,r,i=o();if(g(i))return j(i);d=setTimeout(x,(e=i-p,n=i-b,r=t-e,m?a(r,s-n):r))}function j(e){return(d=void 0,y&&u)?h(e):(u=c=void 0,f)}function w(){var e,n=o(),r=g(n);if(u=arguments,c=this,p=n,r){if(void 0===d)return b=e=p,d=setTimeout(x,t),v?h(e):f;if(m)return clearTimeout(d),d=setTimeout(x,t),h(p)}return void 0===d&&(d=setTimeout(x,t)),f}return t=i(t)||0,r(n)&&(v=!!n.leading,s=(m="maxWait"in n)?l(i(n.maxWait)||0,t):s,y="trailing"in n?!!n.trailing:y),w.cancel=function(){void 0!==d&&clearTimeout(d),b=0,u=p=c=d=void 0},w.flush=function(){return void 0===d?f:j(o())},w}},63117:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},50561:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},41108:function(e,t,n){var r=n(12731),o=n(50561);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},49423:function(e,t,n){var r=n(2381);e.exports=function(){return r.Date.now()}},49666:function(e,t,n){var r=n(19334),o=n(63117),i=n(41108),l=0/0,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,s=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return l;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=u.test(e);return n||c.test(e)?s(e.slice(2),n?2:8):a.test(e)?l:+e}},78030:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(2265);/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let o=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:o=24,strokeWidth:a=2,absoluteStrokeWidth:u,className:c="",children:s,iconNode:f,...d}=e;return(0,r.createElement)("svg",{ref:t,...l,width:o,height:o,stroke:n,strokeWidth:u?24*Number(a)/Number(o):a,className:i("lucide",c),...d},[...f.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(s)?s:[s]])}),u=(e,t)=>{let n=(0,r.forwardRef)((n,l)=>{let{className:u,...c}=n;return(0,r.createElement)(a,{ref:l,iconNode:t,className:i("lucide-".concat(o(e)),u),...c})});return n.displayName="".concat(e),n}},1282:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,n(78030).Z)("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]])},74697:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,n(78030).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},57818:function(e,t,n){"use strict";n.d(t,{default:function(){return o.a}});var r=n(50551),o=n.n(r)},50551:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let r=n(99920);n(57437),n(2265);let o=r._(n(40148));function i(e,t){var n;let r={loading:e=>{let{error:t,isLoading:n,pastDelay:r}=e;return null}};"function"==typeof e&&(r.loader=e);let i={...r,...t};return(0,o.default)({...i,modules:null==(n=i.loadableGenerated)?void 0:n.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},10912:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return o}});let r=n(55592);function o(e){let{reason:t,children:n}=e;if("undefined"==typeof window)throw new r.BailoutToCSRError(t);return n}},40148:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return c}});let r=n(57437),o=n(2265),i=n(10912),l=n(61481);function a(e){return{default:e&&"default"in e?e.default:e}}let u={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},c=function(e){let t={...u,...e},n=(0,o.lazy)(()=>t.loader().then(a)),c=t.loading;function s(e){let a=c?(0,r.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,u=t.ssr?(0,r.jsxs)(r.Fragment,{children:["undefined"==typeof window?(0,r.jsx)(l.PreloadCss,{moduleIds:t.modules}):null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(i.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(o.Suspense,{fallback:a,children:u})}return s.displayName="LoadableComponent",s}},61481:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadCss",{enumerable:!0,get:function(){return i}});let r=n(57437),o=n(58512);function i(e){let{moduleIds:t}=e;if("undefined"!=typeof window)return null;let n=(0,o.getExpectedRequestStore)("next/dynamic css"),i=[];if(n.reactLoadableManifest&&t){let e=n.reactLoadableManifest;for(let n of t){if(!e[n])continue;let t=e[n].files.filter(e=>e.endsWith(".css"));i.push(...t)}}return 0===i.length?null:(0,r.jsx)(r.Fragment,{children:i.map(e=>(0,r.jsx)("link",{precedence:"dynamic",rel:"stylesheet",href:n.assetPrefix+"/_next/"+encodeURI(e),as:"style"},e))})}},40882:function(e,t,n){"use strict";n.d(t,{Fw:function(){return j},fC:function(){return _},wy:function(){return g}});var r=n(22988),o=n(2265),i=n(78149),l=n(98324),a=n(91715),u=n(1336),c=n(1584),s=n(25171),f=n(31383),d=n(53201);let p="Collapsible",[b,v]=(0,l.b)(p),[m,y]=b(p),h=(0,o.forwardRef)((e,t)=>{let{__scopeCollapsible:n,open:i,defaultOpen:l,disabled:u,onOpenChange:c,...f}=e,[p=!1,b]=(0,a.T)({prop:i,defaultProp:l,onChange:c});return(0,o.createElement)(m,{scope:n,disabled:u,contentId:(0,d.M)(),open:p,onOpenToggle:(0,o.useCallback)(()=>b(e=>!e),[b])},(0,o.createElement)(s.WV.div,(0,r.Z)({"data-state":C(p),"data-disabled":u?"":void 0},f,{ref:t})))}),g=(0,o.forwardRef)((e,t)=>{let{__scopeCollapsible:n,...l}=e,a=y("CollapsibleTrigger",n);return(0,o.createElement)(s.WV.button,(0,r.Z)({type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":C(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled},l,{ref:t,onClick:(0,i.M)(e.onClick,a.onOpenToggle)}))}),x="CollapsibleContent",j=(0,o.forwardRef)((e,t)=>{let{forceMount:n,...i}=e,l=y(x,e.__scopeCollapsible);return(0,o.createElement)(f.z,{present:n||l.open},({present:e})=>(0,o.createElement)(w,(0,r.Z)({},i,{ref:t,present:e})))}),w=(0,o.forwardRef)((e,t)=>{let{__scopeCollapsible:n,present:i,children:l,...a}=e,f=y(x,n),[d,p]=(0,o.useState)(i),b=(0,o.useRef)(null),v=(0,c.e)(t,b),m=(0,o.useRef)(0),h=m.current,g=(0,o.useRef)(0),j=g.current,w=f.open||d,_=(0,o.useRef)(w),O=(0,o.useRef)();return(0,o.useEffect)(()=>{let e=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,u.b)(()=>{let e=b.current;if(e){O.current=O.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();m.current=t.height,g.current=t.width,_.current||(e.style.transitionDuration=O.current.transitionDuration,e.style.animationName=O.current.animationName),p(i)}},[f.open,i]),(0,o.createElement)(s.WV.div,(0,r.Z)({"data-state":C(f.open),"data-disabled":f.disabled?"":void 0,id:f.contentId,hidden:!w},a,{ref:v,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":j?`${j}px`:void 0,...e.style}}),w&&l)});function C(e){return e?"open":"closed"}let _=h}}]); \ No newline at end of file diff --git a/_next/static/chunks/659-26d3e22fcd77f788.js b/_next/static/chunks/659-26d3e22fcd77f788.js new file mode 100644 index 0000000000000000000000000000000000000000..6a78140a84aa89b87927e98582be9f1bcdcd0b59 --- /dev/null +++ b/_next/static/chunks/659-26d3e22fcd77f788.js @@ -0,0 +1,47 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[659],{55022:function(e,t,r){let n;var i=r(25566);t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==i&&"env"in i&&(e=i.env.DEBUG),e},t.useColors=function(){return"undefined"!=typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(n=!1,()=>{n||(n=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(11810)(t);let{formatters:s}=e.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},11810:function(e,t,r){e.exports=function(e){function t(e){let r,i,s;let o=null;function a(...e){if(!a.enabled)return;let n=Number(new Date),i=n-(r||n);a.diff=i,a.prev=r,a.curr=n,r=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,n)=>{if("%%"===r)return"%";s++;let i=t.formatters[n];if("function"==typeof i){let t=e[s];r=i.call(a,t),e.splice(s,1),s--}return r}),t.formatArgs.call(a,e),(a.log||t.log).apply(a,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,r){let n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names.map(i),...t.skips.map(i).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];let n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t=r)&&!(t<-r))return t<0&&(t+=r),t=this._head+t&this._capacityMask,this._list[t]}},t.prototype.get=function(e){return this.peekAt(e)},t.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},t.prototype.peekFront=function(){return this.peek()},t.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(t.prototype,"length",{get:function(){return this.size()}}),t.prototype.size=function(){return this._head===this._tail?0:this._headthis._capacity&&this.pop(),this._head1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),t}},t.prototype.push=function(e){if(0==arguments.length)return this.size();var t=this._tail;return(this._list[t]=e,this._tail=t+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head1e4&&e<=t>>>2&&this._shrinkArray(),r}},t.prototype.removeOne=function(e){var t,r=e;if(r===(0|r)&&this._head!==this._tail){var n=this.size(),i=this._list.length;if(!(r>=n)&&!(r<-n)){r<0&&(r+=n),r=this._head+r&this._capacityMask;var s=this._list[r];if(e0;t--)this._list[r]=this._list[r=r-1+i&this._capacityMask];this._list[r]=void 0,this._head=this._head+1+i&this._capacityMask}else{for(t=n-1-e;t>0;t--)this._list[r]=this._list[r=r+1+i&this._capacityMask];this._list[r]=void 0,this._tail=this._tail-1+i&this._capacityMask}return s}}},t.prototype.remove=function(e,t){var r,n,i=e,s=t;if(i===(0|i)&&this._head!==this._tail){var o=this.size(),a=this._list.length;if(!(i>=o)&&!(i<-o)&&!(t<1)){if(i<0&&(i+=o),1===t||!t)return(r=[,])[0]=this.removeOne(i),r;if(0===i&&i+t>=o)return r=this.toArray(),this.clear(),r;for(i+t>o&&(t=o-i),r=Array(t),n=0;n0;n--)this._list[i=i+1+a&this._capacityMask]=void 0;return r}if(0===e){for(this._head=this._head+t+a&this._capacityMask,n=t-1;n>0;n--)this._list[i=i+1+a&this._capacityMask]=void 0;return r}if(i0;n--)this.unshift(this._list[i=i-1+a&this._capacityMask]);for(i=this._head-1+a&this._capacityMask;s>0;)this._list[i=i-1+a&this._capacityMask]=void 0,s--;e<0&&(this._tail=i)}else{for(this._tail=i,i=i+t+a&this._capacityMask,n=o-(t+e);n>0;n--)this.push(this._list[i++]);for(i=this._tail;s>0;)this._list[i=i+1+a&this._capacityMask]=void 0,s--}return this._head<2&&this._tail>1e4&&this._tail<=a>>>2&&this._shrinkArray(),r}}},t.prototype.splice=function(e,t){var r=e;if(r===(0|r)){var n=this.size();if(r<0&&(r+=n),!(r>n)){if(!(arguments.length>2))return this.remove(r,t);var i,s,o,a=arguments.length,l=this._list.length,c=2;if(!n||r0&&(this._head=this._head+r+l&this._capacityMask)):(o=this.remove(r,t),this._head=this._head+r+l&this._capacityMask);a>c;)this.unshift(arguments[--a]);for(i=r;i>0;i--)this.unshift(s[i-1])}else{var u=(s=Array(n-(r+t))).length;for(i=0;ithis._tail){for(r=this._head;r>>=1,this._capacityMask>>>=1},t.prototype._nextPowerOf2=function(e){return Math.max(1<=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn(`EventIterator queue reached ${this.pushQueue.length} items`))}stop(){if(!this.isStopped){for(let e of(this.isStopped=!0,this.remove(),this.pullQueue))e.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(e){if(!this.isStopped){if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(let t of this.pullQueue)t.reject(e);this.pullQueue.length=0}else{let t=Promise.reject(e);t.catch(()=>{}),this.pushQueue.push(t)}}}remove(){Promise.resolve().then(()=>{this.removeCallback&&this.removeCallback()})}[Symbol.asyncIterator](){return{next:e=>{let t=this.pushQueue.shift();return t?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),t):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise((e,t)=>{this.pullQueue.push({resolve:e,reject:t})})},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class n{constructor(e,{highWaterMark:t=100,lowWaterMark:n=1}={}){let i=new r;i.highWaterMark=t,i.lowWaterMark=n,i.removeCallback=e({push:e=>i.push(e),stop:()=>i.stop(),fail:e=>i.fail(e),on:(e,t)=>{i.eventHandlers[e]=t}})||(()=>{}),this[Symbol.asyncIterator]=()=>i[Symbol.asyncIterator](),Object.freeze(this)}}t.EventIterator=n,t.default=n},50762:function(e){e.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,r=Object.create(null),n=Object.create(null);function i(i,s){r[i]=s,++t>=e&&(t=0,n=r,r=Object.create(null))}return{has:function(e){return void 0!==r[e]||void 0!==n[e]},remove:function(e){void 0!==r[e]&&(r[e]=void 0),void 0!==n[e]&&(n[e]=void 0)},get:function(e){var t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==r[e]?r[e]=t:i(e,t)},clear:function(){r=Object.create(null),n=Object.create(null)}}}},37017:function(e,t,r){var n,i,s,o,a,l,c,u,h,d,p,f,g,m,y,b=r(25566);!(n="object"==typeof window?window:{}).HI_BASE32_NO_NODE_JS&&"object"==typeof b&&b.versions&&b.versions.node&&(n=r.g),i=!n.HI_BASE32_NO_COMMON_JS&&e.exports,s=r.amdO,o="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),a={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},l=[0,0,0,0,0,0,0,0],c=function(e,t){t.length>10&&(t="..."+t.substr(-10));var r=Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw r.position=e,r},u=function(e){for(var t,r,n="",i=e.length,s=0,o=0;s191&&t<=223?(r=31&t,o=1):t<=239?(r=15&t,o=2):t<=247?(r=7&t,o=3):c(s,n);for(var a=0;a191)&&c(s,n),r<<=6,r+=63&t;r>=55296&&r<=57343&&c(s,n),r>1114111&&c(s,n),r<=65535?n+=String.fromCharCode(r):(r-=65536,n+=String.fromCharCode((r>>10)+55296)+String.fromCharCode((1023&r)+56320))}return n},h=function(e){if(""===e)return[];if(!/^[A-Z2-7=]+$/.test(e))throw Error("Invalid base32 characters");e=e.replace(/=/g,"");for(var t,r,n,i,s,o,l,c,u=[],h=0,d=e.length,p=0,f=d>>3<<3;p>>2)&255,u[h++]=(r<<6|n<<1|i>>>4)&255,u[h++]=(i<<4|s>>>1)&255,u[h++]=(s<<7|o<<2|l>>>3)&255,u[h++]=(l<<5|c)&255;var g=d-f;return 2===g?(t=a[e.charAt(p++)],r=a[e.charAt(p++)],u[h++]=(t<<3|r>>>2)&255):4===g?(t=a[e.charAt(p++)],r=a[e.charAt(p++)],n=a[e.charAt(p++)],i=a[e.charAt(p++)],u[h++]=(t<<3|r>>>2)&255,u[h++]=(r<<6|n<<1|i>>>4)&255):5===g?(t=a[e.charAt(p++)],r=a[e.charAt(p++)],n=a[e.charAt(p++)],i=a[e.charAt(p++)],s=a[e.charAt(p++)],u[h++]=(t<<3|r>>>2)&255,u[h++]=(r<<6|n<<1|i>>>4)&255,u[h++]=(i<<4|s>>>1)&255):7===g&&(t=a[e.charAt(p++)],r=a[e.charAt(p++)],n=a[e.charAt(p++)],i=a[e.charAt(p++)],s=a[e.charAt(p++)],o=a[e.charAt(p++)],l=a[e.charAt(p++)],u[h++]=(t<<3|r>>>2)&255,u[h++]=(r<<6|n<<1|i>>>4)&255,u[h++]=(i<<4|s>>>1)&255,u[h++]=(s<<7|o<<2|l>>>3)&255),u},d=function(e){for(var t,r,n,i,s,a="",l=e.length,c=0,u=5*parseInt(l/5);c>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[(r<<4|n>>>4)&31]+o[(n<<1|i>>>7)&31]+o[i>>>2&31]+o[(i<<3|s>>>5)&31]+o[31&s];var h=l-u;return 1===h?a+=o[(t=e.charCodeAt(c))>>>3]+o[t<<2&31]+"======":2===h?(t=e.charCodeAt(c++),r=e.charCodeAt(c),a+=o[t>>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[r<<4&31]+"===="):3===h?(t=e.charCodeAt(c++),r=e.charCodeAt(c++),n=e.charCodeAt(c),a+=o[t>>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[(r<<4|n>>>4)&31]+o[n<<1&31]+"==="):4===h&&(t=e.charCodeAt(c++),r=e.charCodeAt(c++),n=e.charCodeAt(c++),i=e.charCodeAt(c),a+=o[t>>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[(r<<4|n>>>4)&31]+o[(n<<1|i>>>7)&31]+o[i>>>2&31]+o[i<<3&31]+"="),a},p=function(e){var t,r,n,i,s,a,c,u=!1,h="",d=0,p=0,f=e.length;if(""===e)return h;do{for(l[0]=l[5],l[1]=l[6],l[2]=l[7],c=p;d>6:(a<55296||a>=57344?l[c++]=224|a>>12:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++d)),l[c++]=240|a>>18,l[c++]=128|a>>12&63),l[c++]=128|a>>6&63),l[c++]=128|63&a);p=c-5,d===f&&++d,d>f&&c<6&&(u=!0),t=l[0],c>4?(r=l[1],n=l[2],i=l[3],s=l[4],h+=o[t>>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[(r<<4|n>>>4)&31]+o[(n<<1|i>>>7)&31]+o[i>>>2&31]+o[(i<<3|s>>>5)&31]+o[31&s]):1===c?h+=o[t>>>3]+o[t<<2&31]+"======":2===c?(r=l[1],h+=o[t>>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[r<<4&31]+"===="):3===c?(r=l[1],n=l[2],h+=o[t>>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[(r<<4|n>>>4)&31]+o[n<<1&31]+"==="):(r=l[1],n=l[2],i=l[3],h+=o[t>>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[(r<<4|n>>>4)&31]+o[(n<<1|i>>>7)&31]+o[i>>>2&31]+o[i<<3&31]+"=")}while(!u);return h},f=function(e){for(var t,r,n,i,s,a="",l=e.length,c=0,u=5*parseInt(l/5);c>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[(r<<4|n>>>4)&31]+o[(n<<1|i>>>7)&31]+o[i>>>2&31]+o[(i<<3|s>>>5)&31]+o[31&s];var h=l-u;return 1===h?a+=o[(t=e[c])>>>3]+o[t<<2&31]+"======":2===h?(t=e[c++],r=e[c],a+=o[t>>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[r<<4&31]+"===="):3===h?(t=e[c++],r=e[c++],n=e[c],a+=o[t>>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[(r<<4|n>>>4)&31]+o[n<<1&31]+"==="):4===h&&(t=e[c++],r=e[c++],n=e[c++],i=e[c],a+=o[t>>>3]+o[(t<<2|r>>>6)&31]+o[r>>>1&31]+o[(r<<4|n>>>4)&31]+o[(n<<1|i>>>7)&31]+o[i>>>2&31]+o[i<<3&31]+"="),a},m={encode:function(e,t){var r="string"!=typeof e;return(r&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),r)?f(e):t?d(e):p(e)},decode:g=function(e,t){if(!t)return u(h(e));if(""===e)return"";if(!/^[A-Z2-7=]+$/.test(e))throw Error("Invalid base32 characters");var r,n,i,s,o,l,c,d,p="",f=e.indexOf("=");-1===f&&(f=e.length);for(var g=0,m=f>>3<<3;g>>2)&255)+String.fromCharCode((n<<6|i<<1|s>>>4)&255)+String.fromCharCode((s<<4|o>>>1)&255)+String.fromCharCode((o<<7|l<<2|c>>>3)&255)+String.fromCharCode((c<<5|d)&255);var y=f-m;return 2===y?p+=String.fromCharCode(((r=a[e.charAt(g++)])<<3|(n=a[e.charAt(g++)])>>>2)&255):4===y?(r=a[e.charAt(g++)],n=a[e.charAt(g++)],i=a[e.charAt(g++)],s=a[e.charAt(g++)],p+=String.fromCharCode((r<<3|n>>>2)&255)+String.fromCharCode((n<<6|i<<1|s>>>4)&255)):5===y?(r=a[e.charAt(g++)],n=a[e.charAt(g++)],i=a[e.charAt(g++)],s=a[e.charAt(g++)],o=a[e.charAt(g++)],p+=String.fromCharCode((r<<3|n>>>2)&255)+String.fromCharCode((n<<6|i<<1|s>>>4)&255)+String.fromCharCode((s<<4|o>>>1)&255)):7===y&&(r=a[e.charAt(g++)],n=a[e.charAt(g++)],i=a[e.charAt(g++)],s=a[e.charAt(g++)],o=a[e.charAt(g++)],l=a[e.charAt(g++)],c=a[e.charAt(g++)],p+=String.fromCharCode((r<<3|n>>>2)&255)+String.fromCharCode((n<<6|i<<1|s>>>4)&255)+String.fromCharCode((s<<4|o>>>1)&255)+String.fromCharCode((o<<7|l<<2|c>>>3)&255)),p}},g.asBytes=h,i?e.exports=m:(n.base32=m,s&&void 0!==(y=(function(){return m}).call(m,r,m,e))&&(e.exports=y))},12471:function(e,t,r){var n=r(25566);e.exports=function(){return!!("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||void 0!==n&&"object"==typeof n.versions&&n.versions.electron||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}},83524:function(e,t,r){var n,i=r(25566);!function(){"use strict";var s="input is invalid type",o="object"==typeof window,a=o?window:{};a.JS_SHA3_NO_WINDOW&&(o=!1);var l=!o&&"object"==typeof self;!a.JS_SHA3_NO_NODE_JS&&"object"==typeof i&&i.versions&&i.versions.node?a=r.g:l&&(a=self);for(var c=!a.JS_SHA3_NO_COMMON_JS&&e.exports,u=r.amdO,h=!a.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),p=[4,1024,262144,67108864],f=[0,8,16,24],g=[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],y=[128,256],b=["hex","buffer","arrayBuffer","array","digest"],v={128:168,256:136},w=a.JS_SHA3_NO_NODE_JS||!Array.isArray?function(e){return"[object Array]"===Object.prototype.toString.call(e)}:Array.isArray,E=h&&(a.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,S=function(e){var t=typeof e;if("string"===t)return[e,!0];if("object"!==t||null===e)throw Error(s);if(h&&e.constructor===ArrayBuffer)return[new Uint8Array(e),!1];if(!w(e)&&!E(e))throw Error(s);return[e,!1]},A=function(e){return 0===S(e)[0].length},I=function(e){for(var t=[],r=0;r>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 V(e,t,r){K.call(this,e,t,r)}K.prototype.update=function(e){if(this.finalized)throw Error("finalize already called");var t=S(e);e=t[0];for(var r,n,i=t[1],s=this.blocks,o=this.byteCount,a=e.length,l=this.blockCount,c=0,u=this.s;c>2]|=n<>2]|=(192|n>>6)<=57344?s[r>>2]|=(224|n>>12)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=e[c]<=o){for(this.start=r-o,this.block=s[l],r=0;r>=8,r=255&e;r>0;)i.unshift(r),e>>=8,r=255&e,++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},K.prototype.encodeString=function(e){var t=S(e);e=t[0];var r=t[1],n=0,i=e.length;if(r)for(var s=0;s=57344?n+=3:(o=65536+((1023&o)<<10|1023&e.charCodeAt(++s)),n+=4)}else n=i;return n+=this.encode(8*n),this.update(e),n},K.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(t=1,e[0]=e[r];t>4&15]+d[15&e]+d[e>>12&15]+d[e>>8&15]+d[e>>20&15]+d[e>>16&15]+d[e>>28&15]+d[e>>24&15];o%t==0&&(H(r=I(r)),s=0)}return i&&(a+=d[(e=r[s])>>4&15]+d[15&e],i>1&&(a+=d[e>>12&15]+d[e>>8&15]),i>2&&(a+=d[e>>20&15]+d[e>>16&15])),a},K.prototype.arrayBuffer=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,o=0,a=this.outputBits>>3,l=new Uint32Array(e=new ArrayBuffer(i?n+1<<2:a));o>8&255,l[e+2]=t>>16&255,l[e+3]=t>>24&255;a%r==0&&H(n=I(n))}return s&&(e=a<<2,t=n[o],l[e]=255&t,s>1&&(l[e+1]=t>>8&255),s>2&&(l[e+2]=t>>16&255)),l},V.prototype=new K,V.prototype.finalize=function(){return this.encode(this.outputBits,!0),K.prototype.finalize.call(this)};var H=function(e){var t,r,n,i,s,o,a,l,c,u,h,d,p,f,m,y,b,v,w,E,S,A,I,_,T,C,R,k,P,D,B,N,L,x,O,M,U,F,K,V,H,$,q,z,j,G,W,Y,Q,J,X,Z,ee,et,er,en,ei,es,eo,ea,el,ec,eu;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],s=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],l=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],d=e[8]^e[18]^e[28]^e[38]^e[48],p=e[9]^e[19]^e[29]^e[39]^e[49],t=d^(o<<1|a>>>31),r=p^(a<<1|o>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(l<<1|c>>>31),r=s^(c<<1|l>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=o^(u<<1|h>>>31),r=a^(h<<1|u>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=l^(d<<1|p>>>31),r=c^(p<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=u^(i<<1|s>>>31),r=h^(s<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,f=e[0],m=e[1],G=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,k=e[20]<<3|e[21]>>>29,P=e[21]<<3|e[20]>>>29,ea=e[31]<<9|e[30]>>>23,el=e[30]<<9|e[31]>>>23,$=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,x=e[2]<<1|e[3]>>>31,O=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,Q=e[23]<<10|e[22]>>>22,D=e[33]<<13|e[32]>>>19,B=e[32]<<13|e[33]>>>19,ec=e[42]<<2|e[43]>>>30,eu=e[43]<<2|e[42]>>>30,et=e[5]<<30|e[4]>>>2,er=e[4]<<30|e[5]>>>2,M=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,N=e[45]<<29|e[44]>>>3,L=e[44]<<29|e[45]>>>3,_=e[6]<<28|e[7]>>>4,T=e[7]<<28|e[6]>>>4,en=e[17]<<23|e[16]>>>9,ei=e[16]<<23|e[17]>>>9,F=e[26]<<25|e[27]>>>7,K=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,z=e[8]<<27|e[9]>>>5,j=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,es=e[29]<<7|e[28]>>>25,eo=e[28]<<7|e[29]>>>25,V=e[38]<<8|e[39]>>>24,H=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,I=e[49]<<14|e[48]>>>18,e[0]=f^~y&v,e[1]=m^~b&w,e[10]=_^~C&k,e[11]=T^~R&P,e[20]=x^~M&F,e[21]=O^~U&K,e[30]=z^~G&Y,e[31]=j^~W&Q,e[40]=et^~en&es,e[41]=er^~ei&eo,e[2]=y^~v&E,e[3]=b^~w&S,e[12]=C^~k&D,e[13]=R^~P&B,e[22]=M^~F&V,e[23]=U^~K&H,e[32]=G^~Y&J,e[33]=W^~Q&X,e[42]=en^~es&ea,e[43]=ei^~eo&el,e[4]=v^~E&A,e[5]=w^~S&I,e[14]=k^~D&N,e[15]=P^~B&L,e[24]=F^~V&$,e[25]=K^~H&q,e[34]=Y^~J&Z,e[35]=Q^~X&ee,e[44]=es^~ea&ec,e[45]=eo^~el&eu,e[6]=E^~A&f,e[7]=S^~I&m,e[16]=D^~N&_,e[17]=B^~L&T,e[26]=V^~$&x,e[27]=H^~q&O,e[36]=J^~Z&z,e[37]=X^~ee&j,e[46]=ea^~ec&et,e[47]=el^~eu&er,e[8]=A^~f&y,e[9]=I^~m&b,e[18]=N^~_&C,e[19]=L^~T&R,e[28]=$^~x&M,e[29]=q^~O&U,e[38]=Z^~z&G,e[39]=ee^~j&W,e[48]=ec^~et&en,e[49]=eu^~er&ei,e[0]^=g[n],e[1]^=g[n+1]};if(c)e.exports=B;else{for(L=0;LObject.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,l={concatArrays:!1,ignoreUndefined:!1},c=e=>{let t=[];for(let r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols)for(let r of Object.getOwnPropertySymbols(e))s.call(e,r)&&t.push(r);return t};function u(e){return Array.isArray(e)?function(e){let t=e.slice(0,0);return c(e).forEach(r=>{o(t,r,u(e[r]))}),t}(e):n(e)?function(e){let t=null===Object.getPrototypeOf(e)?Object.create(null):{};return c(e).forEach(r=>{o(t,r,u(e[r]))}),t}(e):e}let h=(e,t,r,n)=>(r.forEach(r=>{void 0===t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?o(e,r,p(e[r],t[r],n)):o(e,r,u(t[r])))}),e),d=(e,t,r)=>{let n=e.slice(0,0),s=0;return[e,t].forEach(t=>{let a=[];for(let r=0;r!a.includes(e)),r)}),n};function p(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?d(e,t,r):n(t)&&n(e)?h(e,t,c(t),r):u(t)}e.exports=function(...e){let t=p(u(l),this!==a&&this||{},l),r={_:{}};for(let i of e)if(void 0!==i){if(!n(i))throw TypeError("`"+i+"` is not an Option Object");r=p(r,{_:i},t)}return r._}},33388:function(e){"use strict";e.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},44378:function(e){function t(e,t,r,n){return Math.round(e/r)+" "+n+(t>=1.5*r?"s":"")}e.exports=function(e,r){r=r||{};var n,i,s=typeof e;if("string"===s&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return 864e5*r;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*r;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*r;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===s&&isFinite(e))return r.long?(n=Math.abs(e))>=864e5?t(e,n,864e5,"day"):n>=36e5?t(e,n,36e5,"hour"):n>=6e4?t(e,n,6e4,"minute"):n>=1e3?t(e,n,1e3,"second"):e+" ms":(i=Math.abs(e))>=864e5?Math.round(e/864e5)+"d":i>=36e5?Math.round(e/36e5)+"h":i>=6e4?Math.round(e/6e4)+"m":i>=1e3?Math.round(e/1e3)+"s":e+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},37491:function(e,t){(function(){var e,r,n,i,s,o,a,l;l=function(e){return[(-16777216&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e].join(".")},a=function(e){var t,n,i,s,o,a;for(t=[],i=s=0;s<=3&&0!==e.length;i=++s){if(i>0){if("."!==e[0])throw Error("Invalid IP");e=e.substring(1)}o=(a=r(e))[0],n=a[1],e=e.substring(n),t.push(o)}if(0!==e.length)throw Error("Invalid IP");switch(t.length){case 1:if(t[0]>4294967295)throw Error("Invalid IP");return t[0]>>>0;case 2:if(t[0]>255||t[1]>16777215)throw Error("Invalid IP");return(t[0]<<24|t[1])>>>0;case 3:if(t[0]>255||t[1]>255||t[2]>65535)throw Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2])>>>0;case 4:if(t[0]>255||t[1]>255||t[2]>255||t[3]>255)throw Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0;default:throw Error("Invalid IP")}},i=(n=function(e){return e.charCodeAt(0)})("0"),o=n("a"),s=n("A"),r=function(e){var t,r,a,l,c;for(l=0,t=10,r="9",a=0,e.length>1&&"0"===e[a]&&("x"===e[a+1]||"X"===e[a+1]?(a+=2,t=16):"0"<=e[a+1]&&e[a+1]<="9"&&(a++,t=8,r="7")),c=a;a>>0;else if(16===t){if("a"<=e[a]&&e[a]<="f")l=l*t+(10+n(e[a])-o)>>>0;else if("A"<=e[a]&&e[a]<="F")l=l*t+(10+n(e[a])-s)>>>0;else break}else break;if(l>4294967295)throw Error("too large");a++}if(a===c)throw Error("empty octet");return[l,a]},e=function(){function e(e,t){var r,n,i;if("string"!=typeof e)throw Error("Missing `net' parameter");if(t||(e=(i=e.split("/",2))[0],t=i[1]),t||(t=32),"string"==typeof t&&t.indexOf(".")>-1){try{this.maskLong=a(t)}catch(e){throw Error("Invalid mask: "+t)}for(r=n=32;n>=0;r=--n)if(this.maskLong===4294967295<<32-r>>>0){this.bitmask=r;break}}else if(t||0===t)this.bitmask=parseInt(t,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw Error("Invalid mask: empty");try{this.netLong=(a(e)&this.maskLong)>>>0}catch(t){throw Error("Invalid net address: "+e)}if(!(this.bitmask<=32))throw Error("Invalid mask for ip4: "+t);this.size=Math.pow(2,32-this.bitmask),this.base=l(this.netLong),this.mask=l(this.maskLong),this.hostmask=l(~this.maskLong),this.first=this.bitmask<=30?l(this.netLong+1):this.base,this.last=this.bitmask<=30?l(this.netLong+this.size-2):l(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?l(this.netLong+this.size-1):void 0}return e.prototype.contains=function(t){return("string"==typeof t&&(t.indexOf("/")>0||4!==t.split(".").length)&&(t=new e(t)),t instanceof e)?this.contains(t.base)&&this.contains(t.broadcast||t.last):(a(t)&this.maskLong)>>>0==(this.netLong&this.maskLong)>>>0},e.prototype.next=function(t){return null==t&&(t=1),new e(l(this.netLong+this.size*t),this.mask)},e.prototype.forEach=function(e){var t,r,n;for(n=a(this.first),r=a(this.last),t=0;n<=r;)e(l(n),n,t),t++,n++},e.prototype.toString=function(){return this.base+"/"+this.bitmask},e}(),t.ip2long=a,t.long2ip=l,t.Netmask=e}).call(this)},66648:function(e,t,r){"use strict";r.d(t,{default:function(){return i.a}});var n=r(61669),i=r.n(n)},38173:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return v}});let n=r(99920),i=r(41452),s=r(57437),o=i._(r(2265)),a=n._(r(54887)),l=n._(r(28321)),c=r(80497),u=r(7103),h=r(93938);r(72301);let d=r(60291),p=n._(r(21241)),f={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function g(e,t,r,n,i,s,o){let a=null==e?void 0:e.src;e&&e["data-loaded-src"]!==a&&(e["data-loaded-src"]=a,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&i(!0),null==r?void 0:r.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let n=!1,i=!1;r.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>n,isPropagationStopped:()=>i,persist:()=>{},preventDefault:()=>{n=!0,t.preventDefault()},stopPropagation:()=>{i=!0,t.stopPropagation()}})}(null==n?void 0:n.current)&&n.current(e)}}))}function m(e){let[t,r]=o.version.split(".",2),n=parseInt(t,10),i=parseInt(r,10);return n>18||18===n&&i>=3?{fetchPriority:e}:{fetchpriority:e}}"undefined"==typeof window&&(globalThis.__NEXT_IMAGE_IMPORTED=!0);let y=(0,o.forwardRef)((e,t)=>{let{src:r,srcSet:n,sizes:i,height:a,width:l,decoding:c,className:u,style:h,fetchPriority:d,placeholder:p,loading:f,unoptimized:y,fill:b,onLoadRef:v,onLoadingCompleteRef:w,setBlurComplete:E,setShowAltText:S,sizesInput:A,onLoad:I,onError:_,...T}=e;return(0,s.jsx)("img",{...T,...m(d),loading:f,width:l,height:a,decoding:c,"data-nimg":b?"fill":"1",className:u,style:h,sizes:i,srcSet:n,src:r,ref:(0,o.useCallback)(e=>{t&&("function"==typeof t?t(e):"object"==typeof t&&(t.current=e)),e&&(_&&(e.src=e.src),e.complete&&g(e,p,v,w,E,y,A))},[r,p,v,w,E,_,y,A,t]),onLoad:e=>{g(e.currentTarget,p,v,w,E,y,A)},onError:e=>{S(!0),"empty"!==p&&E(!0),_&&_(e)}})});function b(e){let{isAppRouter:t,imgAttributes:r}=e,n={as:"image",imageSrcSet:r.srcSet,imageSizes:r.sizes,crossOrigin:r.crossOrigin,referrerPolicy:r.referrerPolicy,...m(r.fetchPriority)};return t&&a.default.preload?(a.default.preload(r.src,n),null):(0,s.jsx)(l.default,{children:(0,s.jsx)("link",{rel:"preload",href:r.srcSet?void 0:r.src,...n},"__nimg-"+r.src+r.srcSet+r.sizes)})}let v=(0,o.forwardRef)((e,t)=>{let r=(0,o.useContext)(d.RouterContext),n=(0,o.useContext)(h.ImageConfigContext),i=(0,o.useMemo)(()=>{let e=f||n||u.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>e-t),r=e.deviceSizes.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:r}},[n]),{onLoad:a,onLoadingComplete:l}=e,g=(0,o.useRef)(a);(0,o.useEffect)(()=>{g.current=a},[a]);let m=(0,o.useRef)(l);(0,o.useEffect)(()=>{m.current=l},[l]);let[v,w]=(0,o.useState)(!1),[E,S]=(0,o.useState)(!1),{props:A,meta:I}=(0,c.getImgProps)(e,{defaultLoader:p.default,imgConf:i,blurComplete:v,showAltText:E});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(y,{...A,unoptimized:I.unoptimized,placeholder:I.placeholder,fill:I.fill,onLoadRef:g,onLoadingCompleteRef:m,setBlurComplete:w,setShowAltText:S,sizesInput:e.sizes,ref:t}),I.priority?(0,s.jsx)(b,{isAppRouter:!r,imgAttributes:A}):null]})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},82901:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AmpStateContext",{enumerable:!0,get:function(){return n}});let n=r(99920)._(r(2265)).default.createContext({})},40687:function(e,t){"use strict";function r(e){let{ampFirst:t=!1,hybrid:r=!1,hasQuery:n=!1}=void 0===e?{}:e;return t||r&&n}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isInAmpMode",{enumerable:!0,get:function(){return r}})},80497:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return a}}),r(72301);let n=r(51564),i=r(7103);function s(e){return void 0!==e.default}function o(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function a(e,t){var r;let a,l,c,{src:u,sizes:h,unoptimized:d=!1,priority:p=!1,loading:f,className:g,quality:m,width:y,height:b,fill:v=!1,style:w,overrideSrc:E,onLoad:S,onLoadingComplete:A,placeholder:I="empty",blurDataURL:_,fetchPriority:T,layout:C,objectFit:R,objectPosition:k,lazyBoundary:P,lazyRoot:D,...B}=e,{imgConf:N,showAltText:L,blurComplete:x,defaultLoader:O}=t,M=N||i.imageConfigDefault;if("allSizes"in M)a=M;else{let e=[...M.deviceSizes,...M.imageSizes].sort((e,t)=>e-t),t=M.deviceSizes.sort((e,t)=>e-t);a={...M,allSizes:e,deviceSizes:t}}if(void 0===O)throw Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config");let U=B.loader||O;delete B.loader,delete B.srcSet;let F="__next_img_default"in U;if(F){if("custom"===a.loader)throw Error('Image with src "'+u+'" is missing "loader" prop.\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader')}else{let e=U;U=t=>{let{config:r,...n}=t;return e(n)}}if(C){"fill"===C&&(v=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[C];e&&(w={...w,...e});let t={responsive:"100vw",fill:"100vw"}[C];t&&!h&&(h=t)}let K="",V=o(y),H=o(b);if("object"==typeof(r=u)&&(s(r)||void 0!==r.src)){let e=s(u)?u.default:u;if(!e.src)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received "+JSON.stringify(e));if(!e.height||!e.width)throw Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received "+JSON.stringify(e));if(l=e.blurWidth,c=e.blurHeight,_=_||e.blurDataURL,K=e.src,!v){if(V||H){if(V&&!H){let t=V/e.width;H=Math.round(e.height*t)}else if(!V&&H){let t=H/e.height;V=Math.round(e.width*t)}}else V=e.width,H=e.height}}let $=!p&&("lazy"===f||void 0===f);(!(u="string"==typeof u?u:K)||u.startsWith("data:")||u.startsWith("blob:"))&&(d=!0,$=!1),a.unoptimized&&(d=!0),F&&u.endsWith(".svg")&&!a.dangerouslyAllowSVG&&(d=!0),p&&(T="high");let q=o(m),z=Object.assign(v?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:R,objectPosition:k}:{},L?{}:{color:"transparent"},w),j=x||"empty"===I?null:"blur"===I?'url("data:image/svg+xml;charset=utf-8,'+(0,n.getImageBlurSvg)({widthInt:V,heightInt:H,blurWidth:l,blurHeight:c,blurDataURL:_||"",objectFit:z.objectFit})+'")':'url("'+I+'")',G=j?{backgroundSize:z.objectFit||"cover",backgroundPosition:z.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:j}:{},W=function(e){let{config:t,src:r,unoptimized:n,width:i,quality:s,sizes:o,loader:a}=e;if(n)return{src:r,srcSet:void 0,sizes:void 0};let{widths:l,kind:c}=function(e,t,r){let{deviceSizes:n,allSizes:i}=e;if(r){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let n;n=e.exec(r);n)t.push(parseInt(n[2]));if(t.length){let e=.01*Math.min(...t);return{widths:i.filter(t=>t>=n[0]*e),kind:"w"}}return{widths:i,kind:"w"}}return"number"!=typeof t?{widths:n,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>i.find(t=>t>=e)||i[i.length-1]))],kind:"x"}}(t,i,o),u=l.length-1;return{sizes:o||"w"!==c?o:"100vw",srcSet:l.map((e,n)=>a({config:t,src:r,quality:s,width:e})+" "+("w"===c?e:n+1)+c).join(", "),src:a({config:t,src:r,quality:s,width:l[u]})}}({config:a,src:u,unoptimized:d,width:V,quality:q,sizes:h,loader:U});return{props:{...B,loading:$?"lazy":f,fetchPriority:T,width:V,height:H,decoding:"async",className:g,style:{...z,...G},sizes:W.sizes,srcSet:W.srcSet,src:E||W.src},meta:{unoptimized:d,priority:p,placeholder:I,fill:v}}}},28321:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return g},defaultHead:function(){return h}});let n=r(99920),i=r(41452),s=r(57437),o=i._(r(2265)),a=n._(r(65960)),l=r(82901),c=r(36590),u=r(40687);function h(e){void 0===e&&(e=!1);let t=[(0,s.jsx)("meta",{charSet:"utf-8"})];return e||t.push((0,s.jsx)("meta",{name:"viewport",content:"width=device-width"})),t}function d(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===o.default.Fragment?e.concat(o.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}r(72301);let p=["name","httpEquiv","charSet","itemProp"];function f(e,t){let{inAmpMode:r}=t;return e.reduce(d,[]).reverse().concat(h(r).reverse()).filter(function(){let e=new Set,t=new Set,r=new Set,n={};return i=>{let s=!0,o=!1;if(i.key&&"number"!=typeof i.key&&i.key.indexOf("$")>0){o=!0;let t=i.key.slice(i.key.indexOf("$")+1);e.has(t)?s=!1:e.add(t)}switch(i.type){case"title":case"base":t.has(i.type)?s=!1:t.add(i.type);break;case"meta":for(let e=0,t=p.length;e{let n=e.key||t;if(!r&&"link"===e.type&&e.props.href&&["https://fonts.googleapis.com/css","https://use.typekit.net/"].some(t=>e.props.href.startsWith(t))){let t={...e.props||{}};return t["data-href"]=t.href,t.href=void 0,t["data-optimized-fonts"]=!0,o.default.cloneElement(e,t)}return o.default.cloneElement(e,{key:n})})}let g=function(e){let{children:t}=e,r=(0,o.useContext)(l.AmpStateContext),n=(0,o.useContext)(c.HeadManagerContext);return(0,s.jsx)(a.default,{reduceComponentsToState:f,headManager:n,inAmpMode:(0,u.isInAmpMode)(r),children:t})};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},51564:function(e,t){"use strict";function r(e){let{widthInt:t,heightInt:r,blurWidth:n,blurHeight:i,blurDataURL:s,objectFit:o}=e,a=n?40*n:t,l=i?40*i:r,c=a&&l?"viewBox='0 0 "+a+" "+l+"'":"";return"%3Csvg xmlns='http://www.w3.org/2000/svg' "+c+"%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='"+(c?"none":"contain"===o?"xMidYMid":"cover"===o?"xMidYMid slice":"none")+"' style='filter: url(%23b);' href='"+s+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},93938:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ImageConfigContext",{enumerable:!0,get:function(){return s}});let n=r(99920)._(r(2265)),i=r(7103),s=n.default.createContext(i.imageConfigDefault)},7103:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{VALID_LOADERS:function(){return r},imageConfigDefault:function(){return n}});let r=["default","imgix","cloudinary","akamai","custom"],n={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:60,formats:["image/webp"],dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"inline",remotePatterns:[],unoptimized:!1}},61669:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return l},getImageProps:function(){return a}});let n=r(99920),i=r(80497),s=r(38173),o=n._(r(21241));function a(e){let{props:t}=(0,i.getImgProps)(e,{defaultLoader:o.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}}let l=s.Image},21241:function(e,t){"use strict";function r(e){let{config:t,src:r,width:n,quality:i}=e;return t.path+"?url="+encodeURIComponent(r)+"&w="+n+"&q="+(i||75)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}}),r.__next_img_default=!0;let n=r},60291:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RouterContext",{enumerable:!0,get:function(){return n}});let n=r(99920)._(r(2265)).default.createContext(null)},65960:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let n=r(2265),i="undefined"==typeof window,s=i?()=>{}:n.useLayoutEffect,o=i?()=>{}:n.useEffect;function a(e){let{headManager:t,reduceComponentsToState:r}=e;function a(){if(t&&t.mountedInstances){let i=n.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(r(i,e))}}if(i){var l;null==t||null==(l=t.mountedInstances)||l.add(e.children),a()}return s(()=>{var r;return null==t||null==(r=t.mountedInstances)||r.add(e.children),()=>{var r;null==t||null==(r=t.mountedInstances)||r.delete(e.children)}}),s(()=>(t&&(t._pendingUpdate=a),()=>{t&&(t._pendingUpdate=a)})),o(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},98258:function(e,t,r){var n,i,s,o,a,l=r(95482);function c(e,t){l.cipher.registerAlgorithm(e,function(){return new l.aes.Algorithm(e,t)})}r(62474),r(39648),r(77939),e.exports=l.aes=l.aes||{},l.aes.startEncrypting=function(e,t,r,n){var i=f({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},l.aes.createEncryptionCipher=function(e,t){return f({key:e,output:null,decrypt:!1,mode:t})},l.aes.startDecrypting=function(e,t,r,n){var i=f({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},l.aes.createDecryptionCipher=function(e,t){return f({key:e,output:null,decrypt:!0,mode:t})},l.aes.Algorithm=function(e,t){u||h();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return p(r._w,e,t,!1)},decrypt:function(e,t){return p(r._w,e,t,!0)}}}),r._init=!1},l.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"==typeof r&&(16===r.length||24===r.length||32===r.length))r=l.util.createBuffer(r);else if(l.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=l.util.createBuffer();for(var n=0;n>>=2;for(var n=0;n>8^255&h^99,n[g]=h,i[h]=g,d=e[h],r=e[g],l=e[r],c=e[l],p=d<<24^h<<16^h<<8^(h^d),f=(r^l^c)<<24^(g^c)<<16^(g^l^c)<<8^(g^r^c);for(var y=0;y<4;++y)o[y][g]=p,a[y][h]=f,p=p<<24|p>>>8,f=f<<24|f>>>8;0===g?g=m=1:(g=r^e[e[e[r^c]]],m^=e[e[m]])}}function d(e,t){for(var r,i=e.slice(0),o=1,l=i.length,c=4*(l+6+1),u=l;u>>16&255]<<24^n[r>>>8&255]<<16^n[255&r]<<8^n[r>>>24]^s[o]<<24,o++):l>6&&u%l==4&&(r=n[r>>>24]<<24^n[r>>>16&255]<<16^n[r>>>8&255]<<8^n[255&r]),i[u]=i[u-l]^r;if(t){var h,d=a[0],p=a[1],f=a[2],g=a[3],m=i.slice(0);c=i.length;for(var u=0,y=c-4;u>>24]]^p[n[h>>>16&255]]^f[n[h>>>8&255]]^g[n[255&h]];i=m}return i}function p(e,t,r,s){var l,c,u,h,d,p,f,g,m,y,b,v,w=e.length/4-1;s?(l=a[0],c=a[1],u=a[2],h=a[3],d=i):(l=o[0],c=o[1],u=o[2],h=o[3],d=n),p=t[0]^e[0],f=t[s?3:1]^e[1],g=t[2]^e[2],m=t[s?1:3]^e[3];for(var E=3,S=1;S>>24]^c[f>>>16&255]^u[g>>>8&255]^h[255&m]^e[++E],b=l[f>>>24]^c[g>>>16&255]^u[m>>>8&255]^h[255&p]^e[++E],v=l[g>>>24]^c[m>>>16&255]^u[p>>>8&255]^h[255&f]^e[++E],m=l[m>>>24]^c[p>>>16&255]^u[f>>>8&255]^h[255&g]^e[++E],p=y,f=b,g=v;r[0]=d[p>>>24]<<24^d[f>>>16&255]<<16^d[g>>>8&255]<<8^d[255&m]^e[++E],r[s?3:1]=d[f>>>24]<<24^d[g>>>16&255]<<16^d[m>>>8&255]<<8^d[255&p]^e[++E],r[2]=d[g>>>24]<<24^d[m>>>16&255]<<16^d[p>>>8&255]<<8^d[255&f]^e[++E],r[s?1:3]=d[m>>>24]<<24^d[p>>>16&255]<<16^d[f>>>8&255]<<8^d[255&g]^e[++E]}function f(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?l.cipher.createDecipher(r,e.key):l.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof l.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,n.call(t,r)},t}},86047:function(e,t,r){var n=r(95482);r(77939),r(72822);var i=e.exports=n.asn1=n.asn1||{};function s(e,t,r){if(r>t){var n=Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,s,o){if(n.util.isArray(s)){for(var a=[],l=0;lr){if(a.strict){var g=Error("Too few bytes to read ASN.1 value.");throw g.available=t.length(),g.remaining=r,g.requested=f,g}f=r}var m=(32&h)==32;if(m){if(c=[],void 0===f)for(;;){if(s(t,r,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),r-=2;break}l=t.length(),c.push(e(t,r,n+1,a)),r-=l-t.length()}else for(;f>0;)l=t.length(),c.push(e(t,f,n+1,a)),r-=l-t.length(),f-=l-t.length()}if(void 0===c&&d===i.Class.UNIVERSAL&&p===i.Type.BITSTRING&&(u=t.bytes(f)),void 0===c&&a.decodeBitStrings&&d===i.Class.UNIVERSAL&&p===i.Type.BITSTRING&&f>1){var y=t.read,b=r,v=0;if(p===i.Type.BITSTRING&&(s(t,r,1),v=t.getByte(),r--),0===v)try{l=t.length();var w=e(t,r,n+1,{strict:!0,decodeBitStrings:!0}),E=l-t.length();r-=E,p==i.Type.BITSTRING&&E++;var S=w.tagClass;E===f&&(S===i.Class.UNIVERSAL||S===i.Class.CONTEXT_SPECIFIC)&&(c=[w])}catch(e){}void 0===c&&(t.read=y,r=b)}if(void 0===c){if(void 0===f){if(a.strict)throw Error("Non-constructed ASN.1 object of indefinite length.");f=r}if(p===i.Type.BMPSTRING)for(c="";f>0;f-=2)s(t,r,2),c+=String.fromCharCode(t.getInt16()),r-=2;else c=t.getBytes(f),r-=f}var A=void 0===u?null:{bitStringContents:u};return i.create(d,p,m,c,A)}(e,e.length(),0,t);if(t.parseAllBytes&&0!==e.length()){var l=Error("Unparsed DER bytes remain after ASN.1 parsing.");throw l.byteCount=r,l.remaining=e.length(),l}return a},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,s=n.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=i.equals(e,e.original))),o)s.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:s.putByte(0);for(var a=0;a1&&(0===e.value.charCodeAt(0)&&(128&e.value.charCodeAt(1))==0||255===e.value.charCodeAt(0)&&(128&e.value.charCodeAt(1))==128)?s.putBytes(e.value.substr(1)):s.putBytes(e.value);if(t.putByte(r),127>=s.length())t.putByte(127&s.length());else{var l=s.length(),c="";do c+=String.fromCharCode(255&l),l>>>=8;while(l>0);t.putByte(128|c.length);for(var a=c.length-1;a>=0;--a)t.putByte(c.charCodeAt(a))}return t.putBuffer(s),t},i.oidToDer=function(e){var t,r,i,s,o=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var l=2;l>>=7,t||(s|=128),r.push(s),t=!1;while(i>0);for(var c=r.length-1;c>=0;--c)a.putByte(r[c])}return a},i.derToOid=function(e){"string"==typeof e&&(e=n.util.createBuffer(e));var t,r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)r=e.getByte(),i<<=7,128&r?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var l=e.charAt(10),c=10;"+"!==l&&"-"!==l&&(a=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(s,o,a,0),c&&("+"===(l=e.charAt(c))||"-"===l)){var u=60*parseInt(e.substr(c+1,2),10)+parseInt(e.substr(c+4,2),10);u*=6e4,"+"===l?t.setTime(+t-u):t.setTime(+t+u)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),l=0,c=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var h=e.length-5,d=e.charAt(h);return("+"===d||"-"===d)&&(c=(60*parseInt(e.substr(h+1,2),10)+parseInt(e.substr(h+4,2),10))*6e4,"+"===d&&(c*=-1),u=!0),"."===e.charAt(14)&&(l=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,n,i),t.setUTCHours(s,o,a,l),t.setTime(+t+c)):(t.setFullYear(r,n,i),t.setHours(s,o,a,l)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"==typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,s){var o=!1;if((e.tagClass===t.tagClass||void 0===t.tagClass)&&(e.type===t.type||void 0===t.type)){if(e.constructed===t.constructed||void 0===t.constructed){if(o=!0,t.value&&n.util.isArray(t.value))for(var a=0,l=0;o&&l0&&(s+="\n");for(var o="",l=0;l1?s+="0x"+n.util.bytesToHex(e.value.slice(1)):s+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?s+=" (1 unused bit shown)":d>1&&(s+=" ("+d+" unused bits shown)")}}else if(e.type===i.Type.OCTETSTRING)a.test(e.value)||(s+="("+e.value+") "),s+="0x"+n.util.bytesToHex(e.value);else if(e.type===i.Type.UTF8)try{s+=n.util.decodeUtf8(e.value)}catch(t){if("URI malformed"===t.message)s+="0x"+n.util.bytesToHex(e.value)+" (malformed UTF8)";else throw t}else e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?s+=e.value:a.test(e.value)?s+="0x"+n.util.bytesToHex(e.value):0===e.value.length?s+="[null]":s+=e.value}return s}},16994:function(e,t,r){var n=r(62678).Buffer,i={};e.exports=i;var s={};i.encode=function(e,t,r){if("string"!=typeof t)throw TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,s=t.length,o=t.charAt(0),a=[0];for(i=0;i0;)a.push(c%s),c=c/s|0}for(i=0;0===e[i]&&i=0;--i)n+=t[a[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),s=[0];for(r=0;r0;)s.push(a%n),a=a/n|0}var l="";for(r=0;0===e.at(r)&&r=0;--r)l+=t[s[r]];return l}(e,t);if(r){var u=RegExp(".{1,"+r+"}","g");n=n.match(u).join("\r\n")}return n},i.decode=function(e,t){if("string"!=typeof e)throw TypeError('"input" must be a string.');if("string"!=typeof t)throw TypeError('"alphabet" must be a string.');var r=s[t];if(!r){r=s[t]=[];for(var i=0;i>=8;for(;h>0;)l.push(255&h),h>>=8}for(var d=0;e[d]===a&&d4){var r=e;e=n.util.createBuffer();for(var i=0;i0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=Array(this._ints),this._outBlock=Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in e)this._iv=s(e.iv,this.blockSize),this._prev=this._iv.slice(0);else throw Error("Invalid IV parameter.")},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=Array(this._ints),this._partialBlock=Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0)e.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=Array(this._ints),this._outBlock=Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),"tagLength"in e?this._tagLength=e.tagLength:this._tagLength=128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw Error("Authentication tag does not match tag length.");this._hashBlock=Array(this._ints),this.tag=null,this._hashSubkey=Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>(7-r%8)*4&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,s=Array(i),o=0;o>>1,i=Array(r);i[n]=e.slice(0);for(var s=n>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s8?3:1,y=[],b=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,w=0;w>>4^S)&252645135,S^=t,E^=t<<4,t=(S>>>-16^E)&65535,E^=t,S^=t<<-16,t=(E>>>2^S)&858993459,S^=t,E^=t<<2,t=(S>>>-16^E)&65535,E^=t,S^=t<<-16,t=(E>>>1^S)&1431655765,S^=t,E^=t<<1,t=(S>>>8^E)&16711935,E^=t,S^=t<<8,t=(E>>>1^S)&1431655765,S^=t,E^=t<<1,t=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var A=0;A>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),S&=-15;var I=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|s[E>>>16&15]|o[E>>>12&15]|a[E>>>8&15]|l[E>>>4&15],_=c[S>>>28]|u[S>>>24&15]|h[S>>>20&15]|d[S>>>16&15]|p[S>>>12&15]|f[S>>>8&15]|g[S>>>4&15];t=(_>>>16^I)&65535,y[v++]=I^t,y[v++]=_^t<<16}}return y}(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],o=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],l=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],c=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],u=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],h=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],d=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function p(e,t,r,n){var i,p,f=32===e.length?3:9;i=3===f?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var g=t[0],m=t[1];p=(g>>>4^m)&252645135,m^=p,g^=p<<4,p=(g>>>16^m)&65535,m^=p,g^=p<<16,p=(m>>>2^g)&858993459,g^=p,m^=p<<2,p=(m>>>8^g)&16711935,g^=p,m^=p<<8,p=(g>>>1^m)&1431655765,m^=p,g^=p<<1,g=g<<1|g>>>31,m=m<<1|m>>>31;for(var y=0;y>>4|m<<28)^e[w+1];p=g,g=m,m=p^(o[E>>>24&63]|l[E>>>16&63]|u[E>>>8&63]|d[63&E]|s[S>>>24&63]|a[S>>>16&63]|c[S>>>8&63]|h[63&S])}p=g,g=m,m=p}p=((g=g>>>1|g<<31)>>>1^(m=m>>>1|m<<31))&1431655765,m^=p,g^=p<<1,p=(m>>>8^g)&16711935,g^=p,m^=p<<8,p=(m>>>2^g)&858993459,g^=p,m^=p<<2,p=(g>>>16^m)&65535,m^=p,g^=p<<16,p=(g>>>4^m)&252645135,m^=p,g^=p<<4,r[0]=g,r[1]=m}function f(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,i.call(t,r)},t}},95482:function(e){e.exports={options:{usePureJavaScript:!1}}},44215:function(e,t,r){var n=r(95482);r(3654),r(77939),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,s={};return s.start=function(s,o){if(null!==s){if("string"==typeof s){if((s=s.toLowerCase())in n.md.algorithms)t=n.md.algorithms[s].create();else throw Error('Unknown hash algorithm "'+s+'"')}else t=s}if(null===o)o=e;else{if("string"==typeof o)o=n.util.createBuffer(o);else if(n.util.isArray(o)){var a=o;o=n.util.createBuffer();for(var l=0;lt.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),c=o.length();for(var l=0;l>14;--s>=0;){var l=16383&this.data[e],c=this.data[e++]>>14,u=a*l+c*o;i=((l=o*l+((16383&u)<<14)+r.data[n]+i)>>28)+(u>>14)+a*c,r.data[n++]=268435455&l}return i}e.exports=o.jsbn=o.jsbn||{},o.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=c,n=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=function(e,t,r,n,i,s){for(var o=32767&t,a=t>>15;--s>=0;){var l=32767&this.data[e],c=this.data[e++]>>15,u=a*l+c*o;i=((l=o*l+((32767&u)<<15)+r.data[n]+(1073741823&i))>>>30)+(u>>>15)+a*c+(i>>>30),r.data[n++]=1073741823&l}return i},n=30):"Netscape"!=navigator.appName?(a.prototype.am=function(e,t,r,n,i,s){for(;--s>=0;){var o=t*this.data[e++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=67108863&o}return i},n=26):(a.prototype.am=c,n=28),a.prototype.DB=n,a.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function g(e){this.m=e}function m(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<=0?e.mod(this.m):e},g.prototype.revert=function(e){return e},g.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},m.prototype.convert=function(e){var t=l();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(a.ZERO)>0&&this.m.subTo(t,t),t},m.prototype.revert=function(e){var t=l();return e.copyTo(t),this.reduce(t),t},m.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},m.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},m.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},a.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},a.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},a.prototype.fromString=function(e,t){if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else if(4==t)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r,n=e.length,i=!1,s=0;--n>=0;){var o=8==r?255&e[n]:d(e,n);if(o<0){"-"==e.charAt(n)&&(i=!0);continue}i=!1,0==s?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<>this.DB-s):this.data[this.t-1]|=o<=this.DB&&(s-=this.DB)}8==r&&(128&e[0])!=0&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t},a.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},a.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>i|a,a=(this.data[r]&s)<=0;--r)t.data[r]=0;t.data[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},a.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var n=e%this.DB,i=this.DB-n,s=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&s)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},a.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},a.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(u,s),i.lShiftTo(u,r)):(n.copyTo(s),i.copyTo(r));var h=s.t,d=s.data[h-1];if(0!=d){var p=d*(1<1?s.data[h-2]>>this.F2:0),g=this.FV/p,m=(1<=0&&(r.data[r.t++]=1,r.subTo(w,r)),a.ONE.dlShiftTo(h,w),w.subTo(s,s);s.t=0;){var E=r.data[--b]==d?this.DM:Math.floor(r.data[b]*g+(r.data[b-1]+y)*m);if((r.data[b]+=s.am(0,E,r,v,0,h))0&&r.rShiftTo(u,r),o<0&&a.ZERO.subTo(r,r)}}},a.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if((1&e)==0)return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},a.prototype.isEven=function(){return(this.t>0?1&this.data[0]:this.s)==0},a.prototype.exp=function(e,t){if(e>4294967295||e<1)return a.ONE;var r=l(),n=l(),i=t.convert(this),s=f(e)-1;for(i.copyTo(r);--s>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var o=r;r=n,n=o}return t.revert(r)},a.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var t,r,n=(1<0)for(a>a)>0&&(i=!0,s=h(r));o>=0;)a>(a+=this.DB-t):(r=this.data[o]>>(a-=t)&n,a<=0&&(a+=this.DB,--o)),r>0&&(i=!0),i&&(s+=h(r));return i?s:"0"},a.prototype.negate=function(){var e=l();return a.ZERO.subTo(this,e),e},a.prototype.abs=function(){return this.s<0?this.negate():this},a.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},a.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+f(this.data[this.t-1]^this.s&this.DM)},a.prototype.mod=function(e){var t=l();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(a.ZERO)>0&&e.subTo(t,t),t},a.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new g(t):new m(t),this.exp(e,r)},a.ZERO=p(0),a.ONE=p(1),E.prototype.convert=S,E.prototype.revert=S,E.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},E.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(0>e.compareTo(this.m))return e;var t=l();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>e.compareTo(this.r2);)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var I=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],_=67108864/I[I.length-1];a.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},a.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=p(r),i=l(),s=l(),o="";for(this.divRemTo(n,i,s);i.signum()>0;)o=(r+s.intValue()).toString(e).substr(1)+o,i.divRemTo(n,i,s);return s.intValue().toString(e)+o},a.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,o=0,l=0;l=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0)}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),i&&a.ZERO.subTo(this,this)},a.prototype.fromNumber=function(e,t,r){if("number"==typeof t){if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(a.ONE.shiftLeft(e-1),b,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(a.ONE.shiftLeft(e-1),this)}else{var n=[],i=7&e;n.length=(e>>3)+1,t.nextBytes(n),i>0?n[0]&=(1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},a.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},a.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},a.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n0){if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e}return r},a.prototype.millerRabin=function(e){var t,r=this.subtract(a.ONE),n=r.getLowestSetBit();if(n<=0)return!1;for(var i=r.shiftRight(n),s={nextBytes:function(e){for(var t=0;t=t.compareTo(a.ONE)||t.compareTo(r)>=0);var l=t.modPow(i,this);if(0!=l.compareTo(a.ONE)&&0!=l.compareTo(r)){for(var c=1;c++>24},a.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},a.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},a.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?r=(this.data[e]&(1<>(n+=this.DB-8):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),(128&r)!=0&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},a.prototype.equals=function(e){return 0==this.compareTo(e)},a.prototype.min=function(e){return 0>this.compareTo(e)?this:e},a.prototype.max=function(e){return this.compareTo(e)>0?this:e},a.prototype.and=function(e){var t=l();return this.bitwiseTo(e,y,t),t},a.prototype.or=function(e){var t=l();return this.bitwiseTo(e,b,t),t},a.prototype.xor=function(e){var t=l();return this.bitwiseTo(e,v,t),t},a.prototype.andNot=function(e){var t=l();return this.bitwiseTo(e,w,t),t},a.prototype.not=function(){for(var e=l(),t=0;t>=16,t+=16),(255&e)==0&&(e>>=8,t+=8),(15&e)==0&&(e>>=4,t+=4),(3&e)==0&&(e>>=2,t+=2),(1&e)==0&&++t,t}(this.data[e]);return this.s<0?this.t*this.DB:-1},a.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r=this.t?0!=this.s:(this.data[t]&1<1){var h=l();for(n.sqrTo(o[1],h);a<=u;)o[a]=l(),n.mulTo(h,o[a-2],o[a]),a+=2}var d,y,b=e.t-1,v=!0,w=l();for(i=f(e.data[b])-1;b>=0;){for(i>=c?d=e.data[b]>>i-c&u:(d=(e.data[b]&(1<0&&(d|=e.data[b-1]>>this.DB+i-c)),a=r;(1&d)==0;)d>>=1,--a;if((i-=a)<0&&(i+=this.DB,--b),v)o[d].copyTo(s),v=!1;else{for(;a>1;)n.sqrTo(s,w),n.sqrTo(w,s),a-=2;a>0?n.sqrTo(s,w):(y=s,s=w,w=y),n.mulTo(w,o[d],s)}for(;b>=0&&(e.data[b]&1<=0?(r.subTo(n,r),t&&i.subTo(o,i),s.subTo(l,s)):(n.subTo(r,n),t&&o.subTo(i,o),l.subTo(s,l))}return 0!=n.compareTo(a.ONE)?a.ZERO:l.compareTo(e)>=0?l.subtract(e):0>l.signum()&&(l.addTo(e,l),0>l.signum())?l.add(e):l},a.prototype.pow=function(e){return this.exp(e,new E)},a.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(0>t.compareTo(r)){var n=t;t=r,r=n}var i=t.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return t;for(i0&&(t.rShiftTo(s,t),r.rShiftTo(s,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},a.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=I[I.length-1]){for(t=0;t=0;l--)k>>=8,k+=_.at(l)+R.at(l),R.setAt(l,255&k);C.putBuffer(R)}w=C,h.putBuffer(A)}return h.truncate(h.length()-s),h},o.pbe.getCipher=function(e,t,r){switch(e){case o.oids.pkcs5PBES2:return o.pbe.getCipherForPBES2(e,t,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},o.pbe.getCipherForPBES2=function(e,t,r){var i,a,l={},u=[];if(!s.validate(t,c,l,u)){var h=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw h.errors=u,h}if((e=s.derToOid(l.kdfOid))!==o.oids.pkcs5PBKDF2){var h=Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw h.oid=e,h.supportedOids=["pkcs5PBKDF2"],h}if((e=s.derToOid(l.encOid))!==o.oids["aes128-CBC"]&&e!==o.oids["aes192-CBC"]&&e!==o.oids["aes256-CBC"]&&e!==o.oids["des-EDE3-CBC"]&&e!==o.oids.desCBC){var h=Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw h.oid=e,h.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],h}var p=l.kdfSalt,f=n.util.createBuffer(l.kdfIterationCount);switch(f=f.getInt(f.length()<<3),o.oids[e]){case"aes128-CBC":i=16,a=n.aes.createDecryptionCipher;break;case"aes192-CBC":i=24,a=n.aes.createDecryptionCipher;break;case"aes256-CBC":i=32,a=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":i=24,a=n.des.createDecryptionCipher;break;case"desCBC":i=8,a=n.des.createDecryptionCipher}var g=d(l.prfOid),m=n.pkcs5.pbkdf2(r,p,f,i,g),y=l.encIv,b=a(m);return b.start(y),b},o.pbe.getCipherForPKCS12PBE=function(e,t,r){var i,a,l,c={},h=[];if(!s.validate(t,u,c,h)){var p=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw p.errors=h,p}var f=n.util.createBuffer(c.salt),g=n.util.createBuffer(c.iterations);switch(g=g.getInt(g.length()<<3),e){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:i=24,a=8,l=n.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:i=5,a=8,l=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var p=Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw p.oid=e,p}var m=d(c.prfOid),y=o.pbe.generatePkcs12Key(r,f,1,g,i,m);return m.start(),l(y,o.pbe.generatePkcs12Key(r,f,2,g,a,m))},o.pbe.opensslDeriveBytes=function(e,t,r,i){if(null==i){if(!("md5"in n.md))throw Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var s=[h(i,e+t)],o=16,a=1;o4||!a||"sha1"===a))return("string"!=typeof a&&(a="sha1"),e=i.from(e,"binary"),t=i.from(t,"binary"),l)?4===n.pbkdf2Sync.length?n.pbkdf2(e,t,r,o,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):n.pbkdf2(e,t,r,o,a,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):4===n.pbkdf2Sync.length?n.pbkdf2Sync(e,t,r,o).toString("binary"):n.pbkdf2Sync(e,t,r,o,a).toString("binary");if(null==a&&(a="sha1"),"string"==typeof a){if(!(a in s.md.algorithms))throw Error("Unknown hash algorithm: "+a);a=s.md[a].create()}var c=a.digestLength;if(o>4294967295*c){var u=Error("Derived key is too long.");if(l)return l(u);throw u}var h=Math.ceil(o/c),d=o-(h-1)*c,p=s.hmac.create();p.start(a,e);var f="";if(!l){for(var g=1;g<=h;++g){p.start(null,null),p.update(t),p.update(s.util.int32ToBytes(g)),y=v=p.digest().getBytes();for(var m=2;m<=r;++m)p.start(null,null),p.update(v),b=p.digest().getBytes(),y=s.util.xorBytes(y,b,c),v=b;f+=gh)return l(null,f);p.start(null,null),p.update(t),p.update(s.util.int32ToBytes(g)),y=v=p.digest().getBytes(),m=2,function t(){if(m<=r)return p.start(null,null),p.update(v),b=p.digest().getBytes(),y=s.util.xorBytes(y,b,c),v=b,++m,s.util.setImmediate(t);f+=g65&&-1!==o){var a=t[o];","===a?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+a+t.substr(o+1),s=i-o-1,o=-1,++i}else(" "===t[i]||" "===t[i]||","===t[i])&&(o=i);return t}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=s(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=s(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=s(r)),e.headers)for(var o=0;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){"string"==typeof r?(i=r,o=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(l=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),l||(l=a);var i,o,a,l,c=Math.ceil(e.n.bitLength()/8),u=c-2*a.digestLength-2;if(t.length>u){var h=Error("RSAES-OAEP input message length is too long.");throw h.length=t.length,h.maxLength=u,h}i||(i=""),a.update(i,"raw");for(var d=a.digest(),p="",f=u-t.length,g=0;gr&&(t=l(r,s)),t.isProbablePrime(a))return u(null,t);t.dAddOffset(i[o++%8],0)}while(c<0||+new Date-he&&(o=l(e,t));var f=o.toString(16);i.target.postMessage({hex:f,workLoad:u}),o.dAddOffset(h,0)}}}p()}(e,s,o,c):a(e,s,o,c);throw Error("Invalid prime generation algorithm: "+u.name)}}()},35824:function(e,t,r){var n=r(24112),i=r(95482);r(77939);var s=null;!i.util.isNodejs||i.options.usePureJavaScript||n.versions["node-webkit"]||(s=r(25819)),(e.exports=i.prng=i.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,n=Array(32),o=0;o<32;++o)n[o]=r.create();function a(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function l(e){var t=null,r=i.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)});var s=i.util.createBuffer();if(t)for(;s.length()>16)))<<16)+(l>>15))))+(c>>31));for(var a=0;a<3;++a)u=h>>>(a<<3)^Math.floor(256*Math.random()),s.putByte(255&u)}return s.getBytes(e)}return t.pools=n,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,s=t.plugin.increment,o=t.plugin.formatKey,l=t.plugin.formatSeed,c=i.util.createBuffer();t.key=null,function u(h){if(h)return r(h);if(c.length()>=e)return r(null,c.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return i.util.nextTick(function(){(function(e){if(t.pools[0].messageLength>=32)return a(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,function(r,n){if(r)return e(r);t.collect(n),a(),e()})})(u)});var d=n(t.key,t.seed);t.generated+=d.length,c.putBytes(d),t.key=o(n(t.key,s(t.seed))),t.seed=l(n(t.key,t.seed)),i.util.setImmediate(u)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed;t.key=null;for(var l=i.util.createBuffer();l.length()1048575&&(t.key=null),null===t.key&&function(){if(t.pools[0].messageLength>=32)return a();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),a()}();var c=r(t.key,t.seed);t.generated+=c.length,l.putBytes(c),t.key=s(r(t.key,n(t.seed))),t.seed=o(r(t.key,t.seed))}return l.getBytes(e)},s?(t.seedFile=function(e,t){s.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},t.seedFileSync=function(e){return s.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,l(e))}catch(e){t(e)}},t.seedFileSync=l),t.collect=function(e){for(var r=e.length,n=0;n>i&255);t.collect(n)},t.registerWorker=function(e){e===self?t.seedFile=function(e,t){self.addEventListener("message",function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:e}}})}:e.addEventListener("message",function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})})},t}},20576:function(e,t,r){var n=r(95482);r(98258),r(22541),r(35824),r(77939),function(){if(n.random&&n.random.getBytes){e.exports=n.random;return}!function(t){var r={},i=[,,,,],s=n.util.createBuffer();function o(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=[,,,,])[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=[,,,,])[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),s.putInt32(i[0]),s.putInt32(i[1]),s.putInt32(i[2]),s.putInt32(i[3]),s.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=o(),l=null,c=n.util.globalScope,u=c.crypto||c.msCrypto;if(u&&u.getRandomValues&&(l=function(e){return u.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!l){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var h="";for(var d in navigator)try{"string"==typeof navigator[d]&&(h+=navigator[d])}catch(e){}a.collect(h),h=null}t&&(t().mousemove(function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)}),t().keypress(function(e){a.collectInt(e.charCode,8)}))}if(n.random)for(var d in a)n.random[d]=a[d];else n.random=a;n.random.createInstance=o,e.exports=n.random}("undefined"!=typeof jQuery?jQuery:null)}()},62068:function(e,t,r){var n=r(95482);r(77939);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],s=[1,2,3,5];e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,s=e,o=e.length(),a=t,l=Math.ceil(a/8);for(r=o;r<128;r++)s.putByte(i[s.at(r-1)+s.at(r-o)&255]);for(s.setAt(128-l,i[s.at(128-l)&255>>(7&a)]),r=127-l;r>=0;r--)s.setAt(r,i[s.at(r+1)^s.at(r+l)]);return s};var o=function(e,t,r){var i,o,a,l,c=!1,u=null,h=null,d=null,p=[];for(a=0,e=n.rc2.expandKey(e,t);a<64;a++)p.push(e.getInt16Le());r?(i=function(e){for(a=0;a<4;a++){var t,r;e[a]+=p[l]+(e[(a+3)%4]&e[(a+2)%4])+(~e[(a+3)%4]&e[(a+1)%4]),e[a]=(t=e[a])<<(r=s[a])&65535|(65535&t)>>16-r,l++}},o=function(e){for(a=0;a<4;a++)e[a]+=p[63&e[(a+3)%4]]}):(i=function(e){for(a=3;a>=0;a--){var t,r;e[a]=(65535&(t=e[a]))>>(r=s[a])|t<<16-r&65535,e[a]-=p[l]+(e[(a+3)%4]&e[(a+2)%4])+(~e[(a+3)%4]&e[(a+1)%4]),l--}},o=function(e){for(a=3;a>=0;a--)e[a]-=p[63&e[(a+3)%4]]});var f=function(e){var t=[];for(a=0;a<4;a++){var n=u.getInt16Le();null!==d&&(r?n^=d.getInt16Le():d.putInt16Le(n)),t.push(65535&n)}l=r?0:63;for(var i=0;i=8;)f([[5,i],[1,o],[6,i],[1,o],[5,i]])},finish:function(e){var t=!0;if(r){if(e)t=e(8,u,!r);else{var n=8===u.length()?8:8-u.length();u.fillWithByte(n,n)}}if(t&&(c=!0,g.update()),!r&&(t=0===u.length())){if(e)t=e(8,h,!r);else{var i=h.length(),s=h.at(i-1);s>i?t=!1:h.truncate(s)}}return t}}};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return o(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return o(e,t,!1)}},87821:function(e,t,r){var n=r(95482);if(r(86047),r(51275),r(72822),r(36866),r(43365),r(20576),r(77939),void 0===i)var i=n.jsbn.BigInteger;var s=n.util.isNodejs?r(25819):null,o=n.asn1,a=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var l=n.pki,c=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},h={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},d={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},p=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},f={name:"DigestInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},g=function(e){if(e.algorithm in l.oids)t=l.oids[e.algorithm];else{var t,r=Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}var n=o.oidToDer(t).getBytes(),i=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),s=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);s.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,n)),s.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var a=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(s),i.value.push(a),o.toDer(i).getBytes()},m=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do s=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16);while(s.compareTo(t.n)>=0||!s.gcd(t.n).equals(i.ONE));for(var s,o=(e=e.multiply(s.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);0>o.compareTo(a);)o=o.add(t.p);return o.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a).multiply(s.modInverse(t.n)).mod(t.n)};function y(e,t,r){var i,s=n.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var a=Error("Message is too long for PKCS#1 v1.5 padding.");throw a.length=e.length,a.max=o-11,a}s.putByte(0),s.putByte(r);var l=o-3-e.length;if(0===r||1===r){i=0===r?0:255;for(var c=0;c0;){for(var u=0,h=n.random.getBytes(l),c=0;c1;){if(255!==o.getByte()){--o.read;break}++c}else if(2===l)for(c=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++c}if(0!==o.getByte()||c!==s-3-o.length())throw Error("Encryption block is invalid.");return o.getBytes()}function v(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&(128&r.charCodeAt(1))==0||255===r.charCodeAt(0)&&(128&r.charCodeAt(1))==128)?r.substr(1):r}function w(e){return n.util.isNodejs&&"function"==typeof s[e]}function E(e){return void 0!==a.globalScope&&"object"==typeof a.globalScope.crypto&&"object"==typeof a.globalScope.crypto.subtle&&"function"==typeof a.globalScope.crypto.subtle[e]}function S(e){return void 0!==a.globalScope&&"object"==typeof a.globalScope.msCrypto&&"object"==typeof a.globalScope.msCrypto.subtle&&"function"==typeof a.globalScope.msCrypto.subtle[e]}function A(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i0;)c.putByte(0),--u;return c.putBytes(n.util.hexToBytes(l)),c.getBytes()},l.rsa.decrypt=function(e,t,r,s){var o=Math.ceil(t.n.bitLength()/8);if(e.length!==o){var a=Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=o,a}var l=new i(n.util.createBuffer(e).toHex(),16);if(l.compareTo(t.n)>=0)throw Error("Encrypted message is invalid.");for(var c=m(l,t,r).toString(16),u=n.util.createBuffer(),h=o-Math.ceil(c.length/2);h>0;)u.putByte(0),--h;return(u.putBytes(n.util.hexToBytes(c)),!1!==s)?b(u.getBytes(),t,r):u.getBytes()},l.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var s,o=(r=r||{}).prng||n.random,a=r.algorithm||"PRIMEINC";if("PRIMEINC"===a)(s={algorithm:a,state:0,bits:e,rng:{nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(s.eInt);else throw Error("Invalid key generation algorithm: "+a);return s},l.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r,n=new i(null);n.fromInt(30);for(var s=0,o=function(e,t){return e|t},a=+new Date,u=0;null===e.keys&&(t<=0||ud?e.pqState=0:e.num.isProbablePrime((h=e.num.bitLength())<=100?27:h<=150?18:h<=200?15:h<=250?12:h<=300?9:h<=350?8:h<=400?7:h<=500?6:h<=600?5:h<=800?4:h<=1250?3:2)?++e.pqState:e.num.dAddOffset(c[s++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)0>e.p.compareTo(e.q)&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:l.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:l.rsa.setPublicKey(e.n,e.e)}}u+=(r=+new Date)-a,a=r}return null!==e.keys},l.rsa.generateKeyPair=function(e,t,r,c){if(1==arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(c=e,e=void 0):2==arguments.length?"number"==typeof e?"function"==typeof t?(c=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,c=t,e=void 0,t=void 0):3==arguments.length&&("number"==typeof t?"function"==typeof r&&(c=r,r=void 0):(c=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t)){if(c){if(w("generateKeyPair"))return s.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(e,t,r){if(e)return c(e);c(null,{privateKey:l.privateKeyFromPem(r),publicKey:l.publicKeyFromPem(t)})});if(E("generateKey")&&E("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return a.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){c(e)}).then(function(e){if(e){var t=l.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(e)));c(null,{privateKey:t,publicKey:l.setRsaPublicKey(t.n,t.e)})}});if(S("generateKey")&&S("exportKey")){var u=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);u.oncomplete=function(e){var t=e.target.result,r=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=l.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(t)));c(null,{privateKey:r,publicKey:l.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){c(e)}},u.onerror=function(e){c(e)};return}}else if(w("generateKeyPairSync")){var h=s.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:l.privateKeyFromPem(h.privateKey),publicKey:l.publicKeyFromPem(h.publicKey)}}}var d=l.rsa.createKeyPairGenerationState(e,t,r);if(!c)return l.rsa.stepKeyPairGenerationState(d,0),d.keys;(function(e,t,r){"function"==typeof t&&(r=t,t={});var s={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function o(){a(e.pBits,function(t,n){return t?r(t):(e.p=n,null!==e.q)?c(t,e.q):void a(e.qBits,c)})}function a(e,t){n.prime.generateProbablePrime(e,s,t)}function c(t,n){if(t)return r(t);if(e.q=n,0>e.p.compareTo(e.q)){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)){e.p=null,o();return}if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)){e.q=null,a(e.qBits,c);return}if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE)){e.p=e.q=null,o();return}if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits){e.q=null,a(e.qBits,c);return}var u=e.e.modInverse(e.phi);e.keys={privateKey:l.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:l.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(s.prng=t.prng),o()})(d,r,c)},l.setRsaPublicKey=l.rsa.setPublicKey=function(e,t){var r={n:e,e:t};return r.encrypt=function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return y(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw Error('Unsupported encryption scheme: "'+t+'".');var s=t.encode(e,r,!0);return l.rsa.encrypt(s,r,!0)},r.verify=function(e,t,i,s){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===s&&(s={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in s||(s._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(e,t){t=b(t,r,!0);var i=o.fromDer(t,{parseAllBytes:s._parseAllDigestBytes}),a={},l=[];if(!o.validate(i,f,a,l)){var c=Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw c.errors=l,c}var u=o.derToOid(a.algorithmIdentifier);if(!(u===n.oids.md2||u===n.oids.md5||u===n.oids.sha1||u===n.oids.sha224||u===n.oids.sha256||u===n.oids.sha384||u===n.oids.sha512||u===n.oids["sha512-224"]||u===n.oids["sha512-256"])){var c=Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw c.oid=u,c}if((u===n.oids.md2||u===n.oids.md5)&&!("parameters"in a))throw Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return e===a.digest}}:("NONE"===i||"NULL"===i||null===i)&&(i={verify:function(e,t){return e===(t=b(t,r,!0))}});var a=l.rsa.decrypt(t,r,!0,!1);return i.verify(e,a,r.n.bitLength())},r},l.setRsaPrivateKey=l.rsa.setPrivateKey=function(e,t,r,i,s,o,a,c){var u={n:e,e:t,d:r,p:i,q:s,dP:o,dQ:a,qInv:c};return u.decrypt=function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=l.rsa.decrypt(e,u,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:b};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={decode:function(e){return e}};else throw Error('Unsupported encryption scheme: "'+t+'".');return t.decode(i,u,!1)},u.sign=function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:g},r=1):("NONE"===t||"NULL"===t||null===t)&&(t={encode:function(){return e}},r=1);var n=t.encode(e,u.n.bitLength());return l.rsa.encrypt(n,u,r)},u},l.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(l.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},l.privateKeyFromAsn1=function(e){var t,r,s,a,c,d,p,f,g={},m=[];if(o.validate(e,u,g,m)&&(e=o.fromDer(n.util.createBuffer(g.privateKey))),g={},m=[],!o.validate(e,h,g,m)){var y=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw y.errors=m,y}return t=n.util.createBuffer(g.privateKeyModulus).toHex(),r=n.util.createBuffer(g.privateKeyPublicExponent).toHex(),s=n.util.createBuffer(g.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(g.privateKeyPrime1).toHex(),c=n.util.createBuffer(g.privateKeyPrime2).toHex(),d=n.util.createBuffer(g.privateKeyExponent1).toHex(),p=n.util.createBuffer(g.privateKeyExponent2).toHex(),f=n.util.createBuffer(g.privateKeyCoefficient).toHex(),l.setRsaPrivateKey(new i(t,16),new i(r,16),new i(s,16),new i(a,16),new i(c,16),new i(d,16),new i(p,16),new i(f,16))},l.privateKeyToAsn1=l.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.qInv))])},l.publicKeyFromAsn1=function(e){var t={},r=[];if(o.validate(e,p,t,r)){var s=o.derToOid(t.publicKeyOid);if(s!==l.oids.rsaEncryption){var a=Error("Cannot read public key. Unknown OID.");throw a.oid=s,a}e=t.rsaPublicKey}if(r=[],!o.validate(e,d,t,r)){var a=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw a.errors=r,a}var c=n.util.createBuffer(t.publicKeyModulus).toHex(),u=n.util.createBuffer(t.publicKeyExponent).toHex();return l.setRsaPublicKey(new i(c,16),new i(u,16))},l.publicKeyToAsn1=l.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(l.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[l.publicKeyToRSAPublicKey(e)])])},l.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,v(e.e))])}},44092:function(e,t,r){var n=r(95482);r(3654),r(77939);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){o||(s=String.fromCharCode(128)+n.util.fillString("\0",64),o=!0);var e=null,t=n.util.createBuffer(),r=Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return i.start=function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s>>0,l>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=l[1],l[1]=l[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,l[0]=l[1]/4294967296>>>0;return t.putBytes(s),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o,l=n.util.createBuffer();l.putBytes(t.bytes());var c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;l.putBytes(s.substr(0,i.blockLength-c));for(var u=8*i.fullMessageLength[0],h=0;h>>0,l.putInt32(u>>>0),u=o>>>0;l.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(d,r,l);var p=n.util.createBuffer();return p.putInt32(d.h0),p.putInt32(d.h1),p.putInt32(d.h2),p.putInt32(d.h3),p.putInt32(d.h4),p},i};var s=null,o=!1;function a(e,t,r){for(var n,i,s,o,a,l,c,u=r.length();u>=64;){for(c=0,i=e.h0,s=e.h1,o=e.h2,a=e.h3,l=e.h4;c<16;++c)n=r.getInt32(),t[c]=n,n=(i<<5|i>>>27)+(a^s&(o^a))+l+1518500249+n,l=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;c<20;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(a^s&(o^a))+l+1518500249+n,l=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;c<32;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(s^o^a)+l+1859775393+n,l=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;c<40;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(s^o^a)+l+1859775393+n,l=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;c<60;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(s&o|a&(s^o))+l+2400959708+n,l=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;c<80;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(s^o^a)+l+3395469782+n,l=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+s|0,e.h2=e.h2+o|0,e.h3=e.h3+a|0,e.h4=e.h4+l|0,u-=64}}},22541:function(e,t,r){var n=r(95482);r(3654),r(77939);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){o||(s=String.fromCharCode(128)+n.util.fillString("\0",64),a=[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],o=!0);var e=null,t=n.util.createBuffer(),r=Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return i.start=function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s>>0,a>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=a[1],a[1]=a[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(s),l(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o,a=n.util.createBuffer();a.putBytes(t.bytes());var c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;a.putBytes(s.substr(0,i.blockLength-c));for(var u=8*i.fullMessageLength[0],h=0;h>>0,a.putInt32(u>>>0),u=o>>>0;a.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};l(d,r,a);var p=n.util.createBuffer();return p.putInt32(d.h0),p.putInt32(d.h1),p.putInt32(d.h2),p.putInt32(d.h3),p.putInt32(d.h4),p.putInt32(d.h5),p.putInt32(d.h6),p.putInt32(d.h7),p},i};var s=null,o=!1,a=null;function l(e,t,r){for(var n,i,s,o,l,c,u,h,d,p,f,g,m,y,b,v=r.length();v>=64;){for(u=0;u<16;++u)t[u]=r.getInt32();for(;u<64;++u)n=((n=t[u-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[u-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[u]=n+t[u-7]+i+t[u-16]|0;for(u=0,h=e.h0,d=e.h1,p=e.h2,f=e.h3,g=e.h4,m=e.h5,y=e.h6,b=e.h7;u<64;++u)o=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),l=y^g&(m^y),s=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),c=h&d|p&(h^d),n=b+o+l+a[u]+t[u],i=s+c,b=y,y=m,m=g,g=f+n>>>0,f=p,p=d,d=h,h=n+i>>>0;e.h0=e.h0+h|0,e.h1=e.h1+d|0,e.h2=e.h2+p|0,e.h3=e.h3+f|0,e.h4=e.h4+g|0,e.h5=e.h5+m|0,e.h6=e.h6+y|0,e.h7=e.h7+b|0,v-=64}}},56334:function(e,t,r){var n=r(95482);r(3654),r(77939);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var s=n.sha384=n.sha512.sha384=n.sha512.sha384||{};s.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=s,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(a||(o=String.fromCharCode(128)+n.util.fillString("\0",128),l=[[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]],(c={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],c["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],c["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],c["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),void 0===e&&(e="SHA-512"),!(e in c))throw Error("Invalid SHA-512 algorithm: "+e);for(var t=c[e],r=null,i=n.util.createBuffer(),s=Array(80),h=0;h<80;++h)s[h]=[,,];var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var p={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16};return p.start=function(){p.messageLength=0,p.fullMessageLength=p.messageLength128=[];for(var e=p.messageLengthSize/4,s=0;s>>0,o>>>0];for(var a=p.fullMessageLength.length-1;a>=0;--a)p.fullMessageLength[a]+=o[1],o[1]=o[0]+(p.fullMessageLength[a]/4294967296>>>0),p.fullMessageLength[a]=p.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return i.putBytes(e),u(r,s,i),(i.read>2048||0===i.length())&&i.compact(),p},p.digest=function(){var t,a,l=n.util.createBuffer();l.putBytes(i.bytes());var c=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize&p.blockLength-1;l.putBytes(o.substr(0,p.blockLength-c));for(var h=8*p.fullMessageLength[0],d=0;d>>0,l.putInt32(h>>>0),h=t>>>0;l.putInt32(h);for(var f=Array(r.length),d=0;d=128;){for(B=0;B<16;++B)t[B][0]=r.getInt32()>>>0,t[B][1]=r.getInt32()>>>0;for(;B<80;++B)n=(((N=(x=t[B-2])[0])>>>19|(L=x[1])<<13)^(L>>>29|N<<3)^N>>>6)>>>0,i=((N<<13|L>>>19)^(L<<3|N>>>29)^(N<<26|L>>>6))>>>0,s=(((N=(M=t[B-15])[0])>>>1|(L=M[1])<<31)^(N>>>8|L<<24)^N>>>7)>>>0,o=((N<<31|L>>>1)^(N<<24|L>>>8)^(N<<25|L>>>7))>>>0,O=t[B-7],U=t[B-16],L=i+O[1]+o+U[1],t[B][0]=n+O[0]+s+U[0]+(L/4294967296>>>0)>>>0,t[B][1]=L>>>0;for(B=0,m=e[0][0],y=e[0][1],b=e[1][0],v=e[1][1],w=e[2][0],E=e[2][1],S=e[3][0],A=e[3][1],I=e[4][0],_=e[4][1],T=e[5][0],C=e[5][1],R=e[6][0],k=e[6][1],P=e[7][0],D=e[7][1];B<80;++B)u=((I>>>14|_<<18)^(I>>>18|_<<14)^(_>>>9|I<<23))>>>0,h=((I<<18|_>>>14)^(I<<14|_>>>18)^(_<<23|I>>>9))>>>0,d=(R^I&(T^R))>>>0,p=(k^_&(C^k))>>>0,a=((m>>>28|y<<4)^(y>>>2|m<<30)^(y>>>7|m<<25))>>>0,c=((m<<4|y>>>28)^(y<<30|m>>>2)^(y<<25|m>>>7))>>>0,f=(m&b|w&(m^b))>>>0,g=(y&v|E&(y^v))>>>0,L=D+h+p+l[B][1]+t[B][1],n=P+u+d+l[B][0]+t[B][0]+(L/4294967296>>>0)>>>0,i=L>>>0,s=a+f+((L=c+g)/4294967296>>>0)>>>0,o=L>>>0,P=R,D=k,R=T,k=C,T=I,C=_,I=S+n+((L=A+i)/4294967296>>>0)>>>0,_=L>>>0,S=w,A=E,w=b,E=v,b=m,v=y,m=n+s+((L=i+o)/4294967296>>>0)>>>0,y=L>>>0;L=e[0][1]+y,e[0][0]=e[0][0]+m+(L/4294967296>>>0)>>>0,e[0][1]=L>>>0,L=e[1][1]+v,e[1][0]=e[1][0]+b+(L/4294967296>>>0)>>>0,e[1][1]=L>>>0,L=e[2][1]+E,e[2][0]=e[2][0]+w+(L/4294967296>>>0)>>>0,e[2][1]=L>>>0,L=e[3][1]+A,e[3][0]=e[3][0]+S+(L/4294967296>>>0)>>>0,e[3][1]=L>>>0,L=e[4][1]+_,e[4][0]=e[4][0]+I+(L/4294967296>>>0)>>>0,e[4][1]=L>>>0,L=e[5][1]+C,e[5][0]=e[5][0]+T+(L/4294967296>>>0)>>>0,e[5][1]=L>>>0,L=e[6][1]+k,e[6][0]=e[6][0]+R+(L/4294967296>>>0)>>>0,e[6][1]=L>>>0,L=e[7][1]+D,e[7][0]=e[7][0]+P+(L/4294967296>>>0)>>>0,e[7][1]=L>>>0,F-=128}}},77939:function(e,t,r){var n=r(24112),i=r(62678).Buffer,s=r(95482),o=r(16994),a=e.exports=s.util=s.util||{};function l(e){if(!(8===e||16===e||24===e||32===e))throw Error("Only 8, 16, 24, or 32 bits supported: "+e)}function c(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(a.isArrayBuffer(e)||a.isArrayBufferView(e)){if(void 0!==i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(r=Date.now(),o(e)):(t.push(e),1===t.length&&s.setAttribute("a",i=!i))}}a.nextTick=a.setImmediate}(),a.isNodejs=void 0!==n&&n.versions&&n.versions.node,a.globalScope=a.isNodejs?r.g:"undefined"==typeof self?window:self,a.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},a.isArrayBufferView=function(e){return e&&a.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},a.ByteBuffer=c,a.ByteStringBuffer=c,a.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},a.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},a.ByteStringBuffer.prototype.isEmpty=function(){return 0>=this.length()},a.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},a.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},a.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},a.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(a.encodeUtf8(e))},a.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},a.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},a.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},a.ByteStringBuffer.prototype.putInt=function(e,t){l(t);var r="";do t-=8,r+=String.fromCharCode(e>>t&255);while(t>0);return this.putBytes(r)},a.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},a.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},a.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},a.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},a.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},a.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},a.ByteStringBuffer.prototype.copy=function(){var e=a.createBuffer(this.data);return e.read=this.read,e},a.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},a.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},a.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},a.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=this.length()},a.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},a.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},a.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},a.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},a.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},a.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},a.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},a.DataBuffer.prototype.putInt=function(e,t){l(t),this.accommodate(t/8);do t-=8,this.data.setInt8(this.write++,e>>t&255);while(t>0);return this},a.DataBuffer.prototype.putSignedInt=function(e,t){return l(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},a.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},a.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},a.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},a.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},a.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},a.DataBuffer.prototype.copy=function(){return new a.DataBuffer(this)},a.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},a.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},a.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},a.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},a.xorBytes=function(e,t,r){for(var n="",i="",s="",o=0,a=0;r>0;--r,++o)i=e.charCodeAt(o)^t.charCodeAt(o),a>=10&&(n+=s,s="",a=0),s+=String.fromCharCode(i),++a;return n+s},a.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";a.encode64=function(e,t){for(var r,n,i,s="",o="",a=0;a>2)+u.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":s+=u.charAt((15&n)<<2|i>>6)+(isNaN(i)?"=":u.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+s},a.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,s="",o=0;o>4),64!==n&&(s+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(s+=String.fromCharCode((3&n)<<6|i)));return s},a.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},a.decodeUtf8=function(e){return decodeURIComponent(escape(e))},a.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},a.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},a.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s>2)+u.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":s+=u.charAt((15&n)<<2|i>>6)+(isNaN(i)?"=":u.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+s},a.binary.base64.decode=function(e,t,r){var n,i,s,o,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var l=0,c=r=r||0;l>4,64!==s&&(a[c++]=(15&i)<<4|s>>2,64!==o&&(a[c++]=(3&s)<<6|o));return t?c-r:a.subarray(0,c)},a.binary.base58.encode=function(e,t){return a.binary.baseN.encode(e,d,t)},a.binary.base58.decode=function(e,t){return a.binary.baseN.decode(e,d,t)},a.text={utf8:{},utf16:{}},a.text.utf8.encode=function(e,t,r){e=a.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s0&&s.push(r),o=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(e.substring(o)),s.join("")},a.formatNumber=function(e,t,r,n){var i=e,s=isNaN(t=Math.abs(t))?2:t,o=void 0===n?".":n,a=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",c=l.length>3?l.length%3:0;return a+(c?l.substr(0,c)+o:"")+l.substr(c).replace(/(\d{3})(?=\d)/g,"$1"+o)+(s?(void 0===r?",":r)+Math.abs(i-l).toFixed(s).slice(2):"")},a.formatSize=function(e){return e=e>=1073741824?a.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?a.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?a.formatNumber(e/1024,0)+" KiB":a.formatNumber(e,0)+" bytes"},a.bytesFromIP=function(e){return -1!==e.indexOf(".")?a.bytesFromIPv4(e):-1!==e.indexOf(":")?a.bytesFromIPv6(e):null},a.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=a.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:l,end:l})}t.push(s)}if(r.length>0){var c=r[n];c.end-c.start>0&&(t.splice(c.start,c.end-c.start+1,""),0===c.start&&t.unshift(""),7===c.end&&t.push(""))}return t.join(":")},a.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in a&&!e.update)return t(null,a.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return a.cores=navigator.hardwareConcurrency,t(null,a.cores);if("undefined"==typeof Worker)return a.cores=1,t(null,a.cores);if("undefined"==typeof Blob)return a.cores=2,t(null,a.cores);var r=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()a.st&&i.sti.st&&a.st=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let t=this.readChar();if(t===e)return t})}readSeparator(e,t,r){return this.readAtomically(()=>{if(!(t>0)||void 0!==this.readGivenChar(e))return r()})}readNumber(e,t,r,n){return this.readAtomically(()=>{let i=0,s=0,o=this.peekChar();if(void 0===o)return;let a=2**(8*n)-1;for(;;){let r=this.readAtomically(()=>{let t=this.readChar();if(void 0===t)return;let r=Number.parseInt(t,e);if(!Number.isNaN(r))return r});if(void 0===r)break;if(i*=e,(i+=r)>a||(s+=1,void 0!==t&&s>t))return}return 0===s?void 0:!r&&"0"===o&&s>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;tthis.readNumber(10,3,!1,1));if(void 0===r)return;e[t]=r}return e})}readIPv6Addr(){let e=e=>{for(let t=0;tthis.readIPv4Addr());if(void 0!==n)return e[r]=n[0],e[r+1]=n[1],e[r+2]=n[2],e[r+3]=n[3],[r+4,!0]}let n=this.readSeparator(":",t,()=>this.readNumber(16,4,!0,2));if(void 0===n)return[r,!1];e[r]=n>>8,e[r+1]=255&n}return[e.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[r,n]=e(t);if(16===r)return t;if(n||void 0===this.readGivenChar(":")||void 0===this.readGivenChar(":"))return;let i=new Uint8Array(14),[s]=e(i.subarray(0,16-(r+2)));return t.set(i.subarray(0,s),16-s),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}}let i=new n;function s(e){if(!(e.length>15))return i.new(e).parseWith(()=>i.readIPv4Addr())}function o(e){if(e.includes("%")&&(e=e.split("%")[0]),!(e.length>45))return i.new(e).parseWith(()=>i.readIPv6Addr())}function a(e){if(e.includes("%")&&(e=e.split("%")[0]),!(e.length>45))return i.new(e).parseWith(()=>i.readIPAddr())}},36408:function(e,t,r){"use strict";let n,i;r.d(t,{Au:function(){return tD},m2:function(){return tx},Re:function(){return tN},xO:function(){return tR},r3:function(){return tL},lR:function(){return tB}});var s,o,a,l,c,u,h,d,p={};r.r(p),r.d(p,{Ed25519PrivateKey:function(){return B},Ed25519PublicKey:function(){return D},generateKeyPair:function(){return x},generateKeyPairFromSeed:function(){return O},unmarshalEd25519PrivateKey:function(){return N},unmarshalEd25519PublicKey:function(){return L}});var f={};r.r(f),r.d(f,{MAX_RSA_KEY_SIZE:function(){return tf},RsaPrivateKey:function(){return tm},RsaPublicKey:function(){return tg},fromJwk:function(){return tv},generateKeyPair:function(){return tw},unmarshalRsaPrivateKey:function(){return ty},unmarshalRsaPublicKey:function(){return tb}});var g={};r.r(g),r.d(g,{Secp256k1PrivateKey:function(){return tI},Secp256k1PublicKey:function(){return tA},generateKeyPair:function(){return tC},unmarshalSecp256k1PrivateKey:function(){return t_},unmarshalSecp256k1PublicKey:function(){return tT}});var m=r(22852),y=r(75360),b=r(60575),v=r(30024),w=r(38856),E=r(60565);function S(e){return null!=e&&"function"==typeof e.then&&"function"==typeof e.catch&&"function"==typeof e.finally}var A=r(36562);function I(e,t){let r=new Uint8Array(64);for(let n=0;n<32;n++)r[n]=e[n],r[32+n]=t[n];return r}var _=r(84018),T=r(83508),C={get(e=globalThis){let t=e.crypto;if(null==t||null==t.subtle)throw Object.assign(Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return t}};let R={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};async function k(e,t){let r=function(e){let t=(void 0)??"AES-GCM",r=(void 0)??16,n=(void 0)??12,i=e?.digest??"SHA-256",s=e?.saltLength??16,o=e?.iterations??32767,a=C.get();async function l(e,l){let c;let u=a.getRandomValues(new Uint8Array(s)),h={name:t,iv:a.getRandomValues(new Uint8Array(n))};if("string"==typeof l&&(l=(0,E.m)(l)),0===l.length){c=await a.subtle.importKey("jwk",R,{name:"AES-GCM"},!0,["encrypt"]);try{let e=await a.subtle.importKey("raw",l,{name:"PBKDF2"},!1,["deriveKey"]);c=await a.subtle.deriveKey({name:"PBKDF2",salt:u,iterations:o,hash:{name:i}},e,{name:t,length:r},!0,["encrypt"])}catch{c=await a.subtle.importKey("jwk",R,{name:"AES-GCM"},!0,["encrypt"])}}else{let e=await a.subtle.importKey("raw",l,{name:"PBKDF2"},!1,["deriveKey"]);c=await a.subtle.deriveKey({name:"PBKDF2",salt:u,iterations:o,hash:{name:i}},e,{name:t,length:r},!0,["encrypt"])}let d=await a.subtle.encrypt(h,c,e);return(0,T.z)([u,h.iv,new Uint8Array(d)])}async function c(e,l){let c;let u=e.subarray(0,s),h=e.subarray(s,s+n),d=e.subarray(s+n);if("string"==typeof l&&(l=(0,E.m)(l)),0===l.length)try{let e=await a.subtle.importKey("raw",l,{name:"PBKDF2"},!1,["deriveKey"]);c=await a.subtle.deriveKey({name:"PBKDF2",salt:u,iterations:o,hash:{name:i}},e,{name:t,length:r},!0,["decrypt"])}catch{c=await a.subtle.importKey("jwk",R,{name:"AES-GCM"},!0,["decrypt"])}else{let e=await a.subtle.importKey("raw",l,{name:"PBKDF2"},!1,["deriveKey"]);c=await a.subtle.deriveKey({name:"PBKDF2",salt:u,iterations:o,hash:{name:i}},e,{name:t,length:r},!0,["decrypt"])}return new Uint8Array(await a.subtle.decrypt({name:t,iv:h},c,d))}return r*=8,{encrypt:l,decrypt:c}}(),n=await r.encrypt(e,t);return _.base64.encode(n)}var P=r(47971);(s=c||(c={})).RSA="RSA",s.Ed25519="Ed25519",s.Secp256k1="Secp256k1",(o=u||(u={}))[o.RSA=0]="RSA",o[o.Ed25519=1]="Ed25519",o[o.Secp256k1=2]="Secp256k1",(c||(c={})).codec=()=>(0,P.Ji)(u),(a=h||(h={})).codec=()=>(null==n&&(n=(0,P.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.Type&&(t.uint32(8),c.codec().encode(e.Type,t)),null!=e.Data&&(t.uint32(18),t.bytes(e.Data)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.Type=c.codec().decode(e);break;case 2:r.Data=e.bytes();break;default:e.skipType(7&t)}}return r})),n),a.encode=e=>(0,P.LE)(e,a.codec()),a.decode=e=>(0,P.C6)(e,a.codec()),(l=d||(d={})).codec=()=>(null==i&&(i=(0,P.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.Type&&(t.uint32(8),c.codec().encode(e.Type,t)),null!=e.Data&&(t.uint32(18),t.bytes(e.Data)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.Type=c.codec().decode(e);break;case 2:r.Data=e.bytes();break;default:e.skipType(7&t)}}return r})),i),l.encode=e=>(0,P.LE)(e,l.codec()),l.decode=e=>(0,P.C6)(e,l.codec());class D{_key;constructor(e){this._key=M(e,32)}verify(e,t){var r;return r=this._key,A.UN.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}marshal(){return this._key}get bytes(){return h.encode({Type:c.Ed25519,Data:this.marshal()}).subarray()}equals(e){return(0,w.f)(this.bytes,e.bytes)}hash(){let e=v.sha256.digest(this.bytes);return S(e)?e.then(({bytes:e})=>e):e.bytes}}class B{_key;_publicKey;constructor(e,t){this._key=M(e,64),this._publicKey=M(t,32)}sign(e){return function(e,t){let r=e.subarray(0,32);return A.UN.sign(t instanceof Uint8Array?t:t.subarray(),r)}(this._key,e)}get public(){return new D(this._publicKey)}marshal(){return this._key}get bytes(){return d.encode({Type:c.Ed25519,Data:this.marshal()}).subarray()}equals(e){return(0,w.f)(this.bytes,e.bytes)}async hash(){let e;let t=v.sha256.digest(this.bytes);return S(t)?{bytes:e}=await t:e=t.bytes,e}async id(){let e=b.identity.digest(this.public.bytes);return y.base58btc.encode(e.bytes).substring(1)}async export(e,t="libp2p-key"){if("libp2p-key"===t)return k(this.bytes,e);throw new m.sv(`export format '${t}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}function N(e){return e.length>64?new B((e=M(e,96)).subarray(0,64),e.subarray(64,e.length)):new B((e=M(e,64)).subarray(0,64),e.subarray(32))}function L(e){return new D(e=M(e,32))}async function x(){let{privateKey:e,publicKey:t}=function(){let e=A.UN.utils.randomPrivateKey(),t=A.UN.getPublicKey(e);return{privateKey:I(e,t),publicKey:t}}();return new B(e,t)}async function O(e){let{privateKey:t,publicKey:r}=function(e){if(32!==e.length)throw TypeError('"seed" must be 32 bytes in length.');if(!(e instanceof Uint8Array))throw TypeError('"seed" must be a node.js Buffer, or Uint8Array.');let t=A.UN.getPublicKey(e);return{privateKey:I(e,t),publicKey:t}}(e);return new B(t,r)}function M(e,t){if((e=Uint8Array.from(e??[])).length!==t)throw new m.sv(`Key must be a Uint8Array of length ${t}, got ${e.length}`,"ERR_INVALID_KEY_TYPE");return e}var U=r(12528);async function F(e){let t=await C.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await $(t);return{privateKey:r[0],publicKey:r[1]}}async function K(e){let t=[await C.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await q(e)],r=await $({privateKey:t[0],publicKey:t[1]});return{privateKey:r[0],publicKey:r[1]}}async function V(e,t){let r=await C.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await C.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,t instanceof Uint8Array?t:t.subarray());return new Uint8Array(n,0,n.byteLength)}async function H(e,t,r){let n=await C.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return C.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,t,r instanceof Uint8Array?r:r.subarray())}async function $(e){if(null==e.privateKey||null==e.publicKey)throw new m.sv("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([C.get().subtle.exportKey("jwk",e.privateKey),C.get().subtle.exportKey("jwk",e.publicKey)])}async function q(e){return C.get().subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}function z(e){if("RSA"!==e.kty)throw new m.sv("invalid key type","ERR_INVALID_KEY_TYPE");if(null==e.n)throw new m.sv("invalid key modulus","ERR_INVALID_KEY_MODULUS");return 8*(0,E.m)(e.n,"base64url").length}var j=r(65376),G=r(93557),W=r(93560);async function Y(e,t,r,n){var i;let s;let{c:o,dkLen:a,asyncTick:l,DK:c,PRF:u,PRFSalt:h}=function(e,t,r,n){(0,j.vp)(e);let{c:i,dkLen:s,asyncTick:o}=(0,W.U5)({dkLen:32,asyncTick:10},n);if((0,j.Rx)(i),(0,j.Rx)(s),(0,j.Rx)(o),i<1)throw Error("PBKDF2: iterations (c) should be >= 1");let a=(0,W.O0)(t),l=(0,W.O0)(r),c=new Uint8Array(s),u=G.b.create(e,a),h=u._cloneInto().update(l);return{c:i,dkLen:s,asyncTick:o,DK:c,PRF:u,PRFSalt:h}}(e,t,r,n),d=new Uint8Array(4),p=(0,W.GL)(d),f=new Uint8Array(u.outputLen);for(let e=1,t=0;t{u._cloneInto(s).update(f).digestInto(f);for(let e=0;e=0;n--)r+=e[e.length-1-n]*Math.pow(2,t*n);return r}function Z(e,t,r=-1){let n=e,i=0,s=Math.pow(2,t);for(let o=1;o<8;o++){if(e=0;e--){let r=Math.pow(2,e*t);s[i-e-1]=Math.floor(n/r),n-=s[i-e-1]*r}return e}s*=Math.pow(2,t)}return new ArrayBuffer(0)}function ee(...e){let t=0,r=0;for(let r of e)t+=r.length;let n=new Uint8Array(new ArrayBuffer(t));for(let t of e)n.set(t,r),r+=t.length;return n}function et(){let e=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let t=255===e[0]&&128&e[1],r=0===e[0]&&(128&e[1])==0;(t||r)&&this.warnings.push("Needlessly long format")}let t=new Uint8Array(new ArrayBuffer(this.valueHex.byteLength));for(let e=0;e=i.length)return this.error="End of input reached before message was fully decoded",-1;if(e===r){let e=new Uint8Array(r+=255);for(let r=0;r8)return this.error="Too big integer",-1;if(s+1>i.length)return this.error="End of input reached before message was fully decoded",-1;let o=t+1,a=n.subarray(o,o+s);return 0===a[s-1]&&this.warnings.push("Needlessly long encoded length"),this.length=X(a,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=s+1,t+this.blockLength}toBER(e=!1){let t,r;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),!1===e&&((r=new Uint8Array(t))[0]=128),t;if(this.longFormUsed){let n=Z(this.length,8);if(n.byteLength>127)return this.error="Too big length",ec;if(t=new ArrayBuffer(n.byteLength+1),e)return t;let i=new Uint8Array(n);(r=new Uint8Array(t))[0]=128|n.byteLength;for(let e=0;e=37&&!1===i.idBlock.isHexOnly)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};a=ev.EndOfContent;break;case 1:a=ev.Boolean;break;case 2:a=ev.Integer;break;case 3:a=ev.BitString;break;case 4:a=ev.OctetString;break;case 5:a=ev.Null;break;case 6:a=ev.ObjectIdentifier;break;case 10:a=ev.Enumerated;break;case 12:a=ev.Utf8String;break;case 13:a=ev.RelativeObjectIdentifier;break;case 14:a=ev.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:a=ev.Sequence;break;case 17:a=ev.Set;break;case 18:a=ev.NumericString;break;case 19:a=ev.PrintableString;break;case 20:a=ev.TeletexString;break;case 21:a=ev.VideotexString;break;case 22:a=ev.IA5String;break;case 23:a=ev.UTCTime;break;case 24:a=ev.GeneralizedTime;break;case 25:a=ev.GraphicString;break;case 26:a=ev.VisibleString;break;case 27:a=ev.GeneralString;break;case 28:a=ev.UniversalString;break;case 29:a=ev.CharacterString;break;case 30:a=ev.BmpString;break;case 31:a=ev.DATE;break;case 32:a=ev.TimeOfDay;break;case 33:a=ev.DateTime;break;case 34:a=ev.Duration;break;default:{let e=i.idBlock.isConstructed?new ev.Constructed:new ev.Primitive;e.idBlock=i.idBlock,e.lenBlock=i.lenBlock,e.warnings=i.warnings,i=e}}}else a=i.idBlock.isConstructed?ev.Constructed:ev.Primitive;return o=(i=function(e,t){if(e instanceof t)return e;let r=new t;return r.idBlock=e.idBlock,r.lenBlock=e.lenBlock,r.warnings=e.warnings,r.valueBeforeDecodeView=e.valueBeforeDecodeView,r}(i,a)).fromBER(e,t,i.lenBlock.isIndefiniteForm?r:i.lenBlock.length),i.valueBeforeDecodeView=e.subarray(n,n+i.blockLength),{offset:o,result:i}}function e_(e){if(!e.byteLength){let e=new ew({},em);return e.error="Input buffer has zero length",{offset:-1,result:e}}return eI(J.vJ.toUint8Array(e).slice(),0,e.byteLength)}ev.Primitive=eA,eA.NAME="PRIMITIVE";class eT extends em{constructor({value:e=[],isIndefiniteForm:t=!1,...r}={}){super(r),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,r){var n,i;let s=J.vJ.toUint8Array(e);if(!es(this,s,t,r))return -1;if(this.valueBeforeDecodeView=s.subarray(t,t+r),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),t;let o=t;for(;n=this.isIndefiniteForm,i=r,(n?1:i)>0;){let e=eI(s,o,r);if(-1===e.offset)return this.error=e.result.error,this.warnings.concat(e.result.warnings),-1;if(o=e.offset,this.blockLength+=e.result.blockLength,r-=e.result.blockLength,this.value.push(e.result),this.isIndefiniteForm&&e.result.constructor.NAME===eh)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===eh?this.value.pop():this.warnings.push("No EndOfContent block encoded")),o}toBER(e,t){let r=t||new eo;for(let t=0;t` ${e}`).join("\n"));let t=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} : +${e.join("\n")}`:`${t} :`}}ev.Constructed=eC,eC.NAME="CONSTRUCTED";class eR extends em{fromBER(e,t,r){return t}toBER(e){return ec}}eR.override="EndOfContentValueBlock";class ek extends ew{constructor(e={}){super(e,eR),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}ev.EndOfContent=ek,ek.NAME=eh;class eP extends ew{constructor(e={}){super(e,em),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,r){return(this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=r,t+r>e.byteLength)?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+r}toBER(e,t){let r=new ArrayBuffer(2);if(!e){let e=new Uint8Array(r);e[0]=5,e[1]=0}return t&&t.write(r),r}onAsciiEncoding(){return`${this.constructor.NAME}`}}ev.Null=eP,eP.NAME="NULL";class eD extends ef(em){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=J.vJ.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(let e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,r){let n=J.vJ.toUint8Array(e);return es(this,n,t,r)?(this.valueHexView=n.subarray(t,t+r),r>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,et.call(this),this.blockLength=r,t+r):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}eD.NAME="BooleanValueBlock";class eB extends ew{constructor(e={}){super(e,eD),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}}ev.Boolean=eB,eB.NAME="BOOLEAN";class eN extends ef(eT){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,r){let n=0;if(this.isConstructed){if(this.isHexOnly=!1,-1===(n=eT.prototype.fromBER.call(this,e,t,r)))return n;for(let e=0;e0&&r.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=r.unusedBits}return n}let i=J.vJ.toUint8Array(e);if(!es(this,i,t,r))return -1;let s=i.subarray(t,t+r);if(this.unusedBits=s[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){let e=s.subarray(1);try{if(e.byteLength){let t=eI(e,0,e.byteLength);-1!==t.offset&&t.offset===r-1&&(this.value=[t.result])}}catch(e){}}return this.valueHexView=s.subarray(1),this.blockLength=s.length,t+r}toBER(e,t){if(this.isConstructed)return eT.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return ec;let r=new Uint8Array(this.valueHexView.length+1);return r[0]=this.unusedBits,r.set(this.valueHexView,1),r.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}ex.NAME="BitStringValueBlock";class eO extends ew{constructor({idBlock:e={},lenBlock:t={},...r}={}){var n,i;null!==(n=r.isConstructed)&&void 0!==n||(r.isConstructed=!!(null===(i=r.value)||void 0===i?void 0:i.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!r.isIndefiniteForm},...r},ex),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,r){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,r)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return eC.prototype.onAsciiEncoding.call(this);{let e=[];for(let t of this.valueBlock.valueHexView)e.push(t.toString(2).padStart(8,"0"));let t=e.join("");return`${this.constructor.NAME} : ${t.substring(0,t.length-this.valueBlock.unusedBits)}`}}}function eM(e){if(e>=ea.length)for(let t=ea.length;t<=e;t++){let e=new Uint8Array([0]),r=ea[t-1].slice(0);for(let t=r.length-1;t>=0;t--){let n=new Uint8Array([(r[t]<<1)+e[0]]);e[0]=n[0]/10,r[t]=n[0]%10}e[0]>0&&(r=ee(e,r)),ea.push(r)}return ea[e]}ev.BitString=eO,eO.NAME=ep;class eU extends ef(em){constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),void 0!==e&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=et.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(function(e){let t=e<0?-1*e:e,r=128;for(let n=1;n<8;n++){if(t<=r){if(e<0){let e=Z(r-t,8,n),i=new Uint8Array(e);return i[0]|=128,e}let i=Z(t,8,n),s=new Uint8Array(i);if(128&s[0]){let e=i.slice(0),t=new Uint8Array(e);s=new Uint8Array(i=new ArrayBuffer(i.byteLength+1));for(let r=0;r1&&(n=s.length+1),this.valueHexView=s.subarray(n-s.length)),i}toDER(e=!1){let t=this.valueHexView;switch(!0){case(128&t[0])!=0:{let e=new Uint8Array(this.valueHexView.length+1);e[0]=0,e.set(t,1),this.valueHexView=e}break;case 0===t[0]&&(128&t[1])==0:this.valueHexView=this.valueHexView.subarray(1)}return this.toBER(e)}fromBER(e,t,r){let n=super.fromBER(e,t,r);return -1===n||this.setValueHex(),n}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){let e;let t=8*this.valueHexView.length-1,r=new Uint8Array(8*this.valueHexView.length/3),n=0,i=this.valueHexView,s="",o=!1;for(let o=i.byteLength-1;o>=0;o--){e=i[o];for(let i=0;i<8;i++)(1&e)==1&&(n===t?(r=function(e,t){let r,n=0,i=new Uint8Array(e),s=new Uint8Array(t),o=i.slice(0),a=o.length-1,l=s.slice(0),c=l.length-1,u=0;for(let e=c;e>=0;e--,u++)!0==(r=o[a-u]-l[c-u]-n)<0?(n=1,o[a-u]=r+10):(n=0,o[a-u]=r);if(n>0)for(let e=a-c+1;e>=0;e--,u++)if((r=o[a-u]-n)<0)n=1,o[a-u]=r+10;else{n=0,o[a-u]=r;break}return o.slice()}(eM(n),r),s="-"):r=function(e,t){let r=new Uint8Array([0]),n=new Uint8Array(e),i=new Uint8Array(t),s=n.slice(0),o=s.length-1,a=i.slice(0),l=a.length-1,c=0,u=l=0;e--,h++)c=!0==h=s.length)?s=ee(new Uint8Array([c%10]),s):s[o-h]=c%10;return r[0]>0&&(s=ee(r,s)),s}(r,eM(n))),n++,e>>=1}for(let e=0;e0;){let t=new eV;if(-1===(n=t.fromBER(e,n,r))){this.blockLength=0,this.error=t.error;break}0===this.value.length&&(t.isFirstSid=!0),this.blockLength+=t.blockLength,r-=t.blockLength,this.value.push(t)}return n}toBER(e){let t=[];for(let r=0;rNumber.MAX_SAFE_INTEGER){en();let t=BigInt(n);e.valueBigInt=t}else if(e.valueDec=parseInt(n,10),isNaN(e.valueDec))return;this.value.length||(e.isFirstSid=!0,i=!0),this.value.push(e)}while(-1!==r)}toString(){let e="",t=!1;for(let r=0;r0;){let t=new eq;if(-1===(n=t.fromBER(e,n,r))){this.blockLength=0,this.error=t.error;break}this.blockLength+=t.blockLength,r-=t.blockLength,this.value.push(t)}return n}toBER(e,t){let r=[];for(let t=0;t4)continue;let i=4-t.length;for(let e=t.length-1;e>=0;e--)r[4*n+e+i]=t[e]}this.valueBlock.value=e}}e2.NAME="UniversalStringValueBlock";class e3 extends e2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}ev.UniversalString=e3,e3.NAME="UniversalString";class e4 extends eJ{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}ev.NumericString=e4,e4.NAME="NumericString";class e6 extends eJ{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}ev.PrintableString=e6,e6.NAME="PrintableString";class e5 extends eJ{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}ev.TeletexString=e5,e5.NAME="TeletexString";class e8 extends eJ{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}ev.VideotexString=e8,e8.NAME="VideotexString";class e9 extends eJ{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}ev.IA5String=e9,e9.NAME="IA5String";class e7 extends eJ{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}ev.GraphicString=e7,e7.NAME="GraphicString";class te extends eJ{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}ev.VisibleString=te,te.NAME="VisibleString";class tt extends eJ{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}ev.GeneralString=tt,tt.NAME="GeneralString";class tr extends eJ{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}ev.CharacterString=tr,tr.NAME="CharacterString";class tn extends te{constructor({value:e,valueDate:t,...r}={}){if(super(r),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let t=0;t=50?this.year=1900+r:this.year=2e3+r,this.month=parseInt(t[2],10),this.day=parseInt(t[3],10),this.hour=parseInt(t[4],10),this.minute=parseInt(t[5],10),this.second=parseInt(t[6],10)}toString(e="iso"){if("iso"===e){let e=Array(7);return e[0]=er(this.year<2e3?this.year-1900:this.year-2e3,2),e[1]=er(this.month,2),e[2]=er(this.day,2),e[3]=er(this.hour,2),e[4]=er(this.minute,2),e[5]=er(this.second,2),e[6]="Z",e.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}ev.UTCTime=tn,tn.NAME="UTCTime";class ti extends tn{constructor(e={}){var t;super(e),null!==(t=this.millisecond)&&void 0!==t||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t,r=!1,n="",i="",s=0,o=0,a=0;if("Z"===e[e.length-1])n=e.substring(0,e.length-1),r=!0;else{if(isNaN(new Number(e[e.length-1]).valueOf()))throw Error("Wrong input string for conversion");n=e}if(r){if(-1!==n.indexOf("+")||-1!==n.indexOf("-"))throw Error("Wrong input string for conversion")}else{let e=1,t=n.indexOf("+"),r="";if(-1===t&&(t=n.indexOf("-"),e=-1),-1!==t){if(r=n.substring(t+1),n=n.substring(0,t),2!==r.length&&4!==r.length)throw Error("Wrong input string for conversion");let i=parseInt(r.substring(0,2),10);if(isNaN(i.valueOf()))throw Error("Wrong input string for conversion");if(o=e*i,4===r.length){if(isNaN((i=parseInt(r.substring(2,4),10)).valueOf()))throw Error("Wrong input string for conversion");a=e*i}}}let l=n.indexOf(".");if(-1===l&&(l=n.indexOf(",")),-1!==l){let e=new Number(`0${n.substring(l)}`);if(isNaN(e.valueOf()))throw Error("Wrong input string for conversion");s=e.valueOf(),i=n.substring(0,l)}else i=n;switch(!0){case 8===i.length:if(t=/(\d{4})(\d{2})(\d{2})/ig,-1!==l)throw Error("Wrong input string for conversion");break;case 10===i.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,-1!==l){let e=60*s;this.minute=Math.floor(e),e=60*(e-this.minute),this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 12===i.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,-1!==l){let e=60*s;this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 14===i.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,-1!==l){let e=1e3*s;this.millisecond=Math.floor(e)}break;default:throw Error("Wrong input string for conversion")}let c=t.exec(i);if(null===c)throw Error("Wrong input string for conversion");for(let e=1;e0&&(t=`0${t}`);let r=t.length/2,n=new Uint8Array(r),i=0,s=0;for(;i0&&(r=`0${r}`),t.push(r)}),BigInt("0x"+t.join(""))}async function tp(e,t){let r=C.get(),n=new eG({value:[new eF({value:0}),new eG({value:[new e$({value:"1.2.840.113549.1.1.1"}),new eP]}),new eL({valueHex:e.marshal()})]}).toBER(),i=new Uint8Array(n,0,n.byteLength),s=(0,tu.Z)(16),o=await Y(Q.o,t,s,{c:1e4,dkLen:32}),a=(0,tu.Z)(16),l=await r.subtle.importKey("raw",o,"AES-CBC",!1,["encrypt"]),c=await r.subtle.encrypt({name:"AES-CBC",iv:a},l,i),u=new eG({value:[new eL({valueHex:s}),new eF({value:1e4}),new eF({value:32}),new eG({value:[new e$({value:"1.2.840.113549.2.11"}),new eP]})]}),h=new eG({value:[new e$({value:"1.2.840.113549.1.5.13"}),new eG({value:[new eG({value:[new e$({value:"1.2.840.113549.1.5.12"}),u]}),new eG({value:[new e$({value:"2.16.840.1.101.3.4.1.42"}),new eL({valueHex:a})]})]})]}),d=new eG({value:[h,new eL({valueHex:c})]}).toBER(),p=new Uint8Array(d,0,d.byteLength);return["-----BEGIN ENCRYPTED PRIVATE KEY-----",...(0,U.B)(p,"base64pad").split(/(.{64})/).filter(Boolean),"-----END ENCRYPTED PRIVATE KEY-----"].join("\n")}let tf=8192;class tg{_key;constructor(e){this._key=e}verify(e,t){return H(this._key,t,e)}marshal(){return function(e){if(null==e.n||null==e.e)throw new m.sv("JWK was missing components","ERR_INVALID_PARAMETERS");let t=new eG({value:[new eG({value:[new e$({value:"1.2.840.113549.1.1.1"}),new eP]}),new eO({valueHex:new eG({value:[eF.fromBigInt(td((0,E.m)(e.n,"base64url"))),eF.fromBigInt(td((0,E.m)(e.e,"base64url")))]}).toBER()})]}).toBER();return new Uint8Array(t,0,t.byteLength)}(this._key)}get bytes(){return h.encode({Type:c.RSA,Data:this.marshal()}).subarray()}equals(e){return(0,w.f)(this.bytes,e.bytes)}hash(){let e=v.sha256.digest(this.bytes);return S(e)?e.then(({bytes:e})=>e):e.bytes}}class tm{_key;_publicKey;constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return tu.Z(16)}sign(e){return V(this._key,e)}get public(){if(null==this._publicKey)throw new m.sv("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new tg(this._publicKey)}marshal(){return function(e){if(null==e.n||null==e.e||null==e.d||null==e.p||null==e.q||null==e.dp||null==e.dq||null==e.qi)throw new m.sv("JWK was missing components","ERR_INVALID_PARAMETERS");let t=new eG({value:[new eF({value:0}),eF.fromBigInt(td((0,E.m)(e.n,"base64url"))),eF.fromBigInt(td((0,E.m)(e.e,"base64url"))),eF.fromBigInt(td((0,E.m)(e.d,"base64url"))),eF.fromBigInt(td((0,E.m)(e.p,"base64url"))),eF.fromBigInt(td((0,E.m)(e.q,"base64url"))),eF.fromBigInt(td((0,E.m)(e.dp,"base64url"))),eF.fromBigInt(td((0,E.m)(e.dq,"base64url"))),eF.fromBigInt(td((0,E.m)(e.qi,"base64url")))]}).toBER();return new Uint8Array(t,0,t.byteLength)}(this._key)}get bytes(){return d.encode({Type:c.RSA,Data:this.marshal()}).subarray()}equals(e){return(0,w.f)(this.bytes,e.bytes)}hash(){let e=v.sha256.digest(this.bytes);return S(e)?e.then(({bytes:e})=>e):e.bytes}async id(){let e=await this.public.hash();return(0,U.B)(e,"base58btc")}async export(e,t="pkcs-8"){if("pkcs-8"===t)return tp(this,e);if("libp2p-key"===t)return k(this.bytes,e);throw new m.sv(`export format '${t}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}async function ty(e){let t=function(e){let{result:t}=e_(e),r=t.valueBlock.value;return{n:(0,U.B)(th(r[1].toBigInt()),"base64url"),e:(0,U.B)(th(r[2].toBigInt()),"base64url"),d:(0,U.B)(th(r[3].toBigInt()),"base64url"),p:(0,U.B)(th(r[4].toBigInt()),"base64url"),q:(0,U.B)(th(r[5].toBigInt()),"base64url"),dp:(0,U.B)(th(r[6].toBigInt()),"base64url"),dq:(0,U.B)(th(r[7].toBigInt()),"base64url"),qi:(0,U.B)(th(r[8].toBigInt()),"base64url"),kty:"RSA",alg:"RS256"}}(e);if(z(t)>tf)throw new m.sv("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let r=await K(t);return new tm(r.privateKey,r.publicKey)}function tb(e){let t=function(e){let{result:t}=e_(e),r=t.valueBlock.value[1].valueBlock.value[0].valueBlock.value;return{kty:"RSA",n:(0,U.B)(th(r[0].toBigInt()),"base64url"),e:(0,U.B)(th(r[1].toBigInt()),"base64url")}}(e);if(z(t)>tf)throw new m.sv("key size is too large","ERR_KEY_SIZE_TOO_LARGE");return new tg(t)}async function tv(e){if(z(e)>tf)throw new m.sv("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let t=await K(e);return new tm(t.privateKey,t.publicKey)}async function tw(e){if(e>tf)throw new m.sv("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let t=await F(e);return new tm(t.privateKey,t.publicKey)}var tE=r(14374);function tS(e){try{tE.kA.ProjectivePoint.fromHex(e)}catch(e){throw new m.sv(String(e),"ERR_INVALID_PUBLIC_KEY")}}class tA{_key;constructor(e){tS(e),this._key=e}verify(e,t){return function(e,t,r){let n=v.sha256.digest(r instanceof Uint8Array?r:r.subarray());if(S(n))return n.then(({digest:r})=>tE.kA.verify(t,r,e)).catch(e=>{throw new m.sv(String(e),"ERR_INVALID_INPUT")});try{return tE.kA.verify(t,n.digest,e)}catch(e){throw new m.sv(String(e),"ERR_INVALID_INPUT")}}(this._key,t,e)}marshal(){var e;return e=this._key,tE.kA.ProjectivePoint.fromHex(e).toRawBytes(!0)}get bytes(){return h.encode({Type:c.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return(0,w.f)(this.bytes,e.bytes)}async hash(){let e;let t=v.sha256.digest(this.bytes);return S(t)?{bytes:e}=await t:e=t.bytes,e}}class tI{_key;_publicKey;constructor(e,t){this._key=e,this._publicKey=t??function(e){try{return tE.kA.getPublicKey(e,!0)}catch(e){throw new m.sv(String(e),"ERR_INVALID_PRIVATE_KEY")}}(e),function(e){try{tE.kA.getPublicKey(e,!0)}catch(e){throw new m.sv(String(e),"ERR_INVALID_PRIVATE_KEY")}}(this._key),tS(this._publicKey)}sign(e){return function(e,t){let r=v.sha256.digest(t instanceof Uint8Array?t:t.subarray());if(S(r))return r.then(({digest:t})=>tE.kA.sign(t,e).toDERRawBytes()).catch(e=>{throw new m.sv(String(e),"ERR_INVALID_INPUT")});try{return tE.kA.sign(r.digest,e).toDERRawBytes()}catch(e){throw new m.sv(String(e),"ERR_INVALID_INPUT")}}(this._key,e)}get public(){return new tA(this._publicKey)}marshal(){return this._key}get bytes(){return d.encode({Type:c.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return(0,w.f)(this.bytes,e.bytes)}hash(){let e=v.sha256.digest(this.bytes);return S(e)?e.then(({bytes:e})=>e):e.bytes}async id(){let e=await this.public.hash();return(0,U.B)(e,"base58btc")}async export(e,t="libp2p-key"){if("libp2p-key"===t)return k(this.bytes,e);throw new m.sv(`export format '${t}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}function t_(e){return new tI(e)}function tT(e){return new tA(e)}async function tC(){return new tI(tE.kA.utils.randomPrivateKey())}let tR={rsa:f,ed25519:p,secp256k1:g};function tk(e){let t=Object.keys(tR).join(" / ");return new m.sv(`invalid or unsupported key type ${e}. Must be ${t}`,"ERR_UNSUPPORTED_KEY_TYPE")}function tP(e){if("rsa"===(e=e.toLowerCase())||"ed25519"===e||"secp256k1"===e)return tR[e];throw tk(e)}async function tD(e,t){return tP(e).generateKeyPair(t??2048)}function tB(e){let t=h.decode(e),r=t.Data??new Uint8Array;switch(t.Type){case c.RSA:return tR.rsa.unmarshalRsaPublicKey(r);case c.Ed25519:return tR.ed25519.unmarshalEd25519PublicKey(r);case c.Secp256k1:return tR.secp256k1.unmarshalSecp256k1PublicKey(r);default:throw tk(t.Type??"unknown")}}function tN(e,t){return tP(t=(t??"rsa").toLowerCase()),e.bytes}async function tL(e){let t=d.decode(e),r=t.Data??new Uint8Array;switch(t.Type){case c.RSA:return tR.rsa.unmarshalRsaPrivateKey(r);case c.Ed25519:return tR.ed25519.unmarshalEd25519PrivateKey(r);case c.Secp256k1:return tR.secp256k1.unmarshalSecp256k1PrivateKey(r);default:throw tk(t.Type??"RSA")}}function tx(e,t){return tP(t=(t??"rsa").toLowerCase()),e.bytes}},34018:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(22852),i=r(93560);function s(e){if(isNaN(e)||e<=0)throw new n.sv("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return(0,i.O6)(e)}},22852:function(e,t,r){"use strict";r.d(t,{J5:function(){return s},Vc:function(){return a},_L:function(){return n},l9:function(){return o},sv:function(){return i}});class n extends Error{code;type;constructor(e="The operation was aborted"){super(e),this.name="AbortError",this.code=n.code,this.type=n.type}static code="ABORT_ERR";static type="aborted"}class i extends Error{code;props;constructor(e,t,r){super(e),this.code=t,this.name=r?.name??"CodeError",this.props=r??{}}}class s extends AggregateError{code;props;constructor(e,t,r,n){super(e,t),this.code=r,this.name=n?.name??"AggregateCodeError",this.props=n??{}}}let o="ERR_TIMEOUT",a="ERR_NOT_FOUND"},85931:function(e,t,r){"use strict";r.d(t,{A:function(){return o},L:function(){return i}});var n=r(5036);class i extends EventTarget{#e=new Map;constructor(){super(),(0,n.W)(1/0,this)}listenerCount(e){let t=this.#e.get(e);return null==t?0:t.length}addEventListener(e,t,r){super.addEventListener(e,t,r);let n=this.#e.get(e);null==n&&(n=[],this.#e.set(e,n)),n.push({callback:t,once:(!0!==r&&!1!==r&&r?.once)??!1})}removeEventListener(e,t,r){super.removeEventListener(e.toString(),t??null,r);let n=this.#e.get(e);null!=n&&(n=n.filter(({callback:e})=>e!==t),this.#e.set(e,n))}dispatchEvent(e){let t=super.dispatchEvent(e),r=this.#e.get(e.type);return null==r||(r=r.filter(({once:e})=>!e),this.#e.set(e.type,r)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new o(e,t))}}class s extends Event{detail;constructor(e,t){super(e,t),this.detail=t?.detail}}let o=globalThis.CustomEvent??s},5036:function(e,t,r){"use strict";r.d(t,{W:function(){return n}});let n=(e,...t)=>{}},5846:function(e,t,r){"use strict";r.d(t,{J:function(){return n}});let n=Symbol.for("@libp2p/peer-discovery")},25906:function(e,t,r){"use strict";r.d(t,{C:function(){return n},I:function(){return i}});let n=Symbol.for("@libp2p/peer-id");function i(e){return null!=e&&!!e[n]}},90678:function(e,t,r){"use strict";r.d(t,{n9:function(){return o},pG:function(){return c}});var n=r(36408),i=r(65301),s=r(60565);let o=async()=>{let e=await (0,n.Au)("Ed25519"),t=await l(e);if("Ed25519"===t.type)return t;throw Error(`Generated unexpected PeerId type "${t.type}"`)};async function a(e){return(0,i.y5)((0,n.Re)(e))}async function l(e){return(0,i.y5)((0,n.Re)(e.public),(0,n.m2)(e))}async function c(e){return u((0,s.m)(e.id,"base58btc"),null!=e.privKey?(0,s.m)(e.privKey,"base64pad"):void 0,null!=e.pubKey?(0,s.m)(e.pubKey,"base64pad"):void 0)}async function u(e,t,r){return null!=t?l(await (0,n.r3)(t)):null!=r?a((0,n.lR)(r)):(0,i.cv)(e)}},65301:function(e,t,r){"use strict";r.d(t,{cv:function(){return w},jE:function(){return v},vL:function(){return b},y5:function(){return E}});var n=r(22852),i=r(25906),s=r(75360),o=r(74006),a=r(45193),l=r(2780),c=r(60575),u=r(30024),h=r(38856);let d=Symbol.for("nodejs.util.inspect.custom"),p=Object.values(o.gh).map(e=>e.decoder).reduce((e,t)=>e.or(t),o.gh.identity.decoder);class f{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[i.C]=!0;toString(){return null==this.string&&(this.string=s.base58btc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return a.k0.createV1(114,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(null==e)return!1;if(e instanceof Uint8Array)return(0,h.f)(this.multihash.bytes,e);if("string"==typeof e)return v(e).equals(this);if(e?.multihash?.bytes!=null)return(0,h.f)(this.multihash.bytes,e.multihash.bytes);throw Error("not valid Id")}[d](){return`PeerId(${this.toString()})`}}class g extends f{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}}class m extends f{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}}class y extends f{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}}function b(e){if("RSA"===e.type)return new g(e);if("Ed25519"===e.type)return new m(e);if("secp256k1"===e.type)return new y(e);throw new n.sv("Not a PeerId","ERR_INVALID_PARAMETERS")}function v(e,t){if(t=t??p,"1"===e.charAt(0)||"Q"===e.charAt(0)){let t=l.Jx(s.base58btc.decode(`z${e}`));return e.startsWith("12D")?new m({multihash:t}):e.startsWith("16U")?new y({multihash:t}):new g({multihash:t})}return w(p.decode(e))}function w(e){try{let t=l.Jx(e);if(t.code===c.identity.code){if(36===t.digest.length)return new m({multihash:t});if(37===t.digest.length)return new y({multihash:t})}if(t.code===u.sha256.code)return new g({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&114!==e.code)throw Error("Supplied PeerID CID is invalid");let t=e.multihash;if(t.code===u.sha256.code)return new g({multihash:e.multihash});if(t.code===c.identity.code){if(36===t.digest.length)return new m({multihash:e.multihash});if(37===t.digest.length)return new y({multihash:e.multihash})}throw Error("Supplied PeerID CID is invalid")}(a.k0.decode(e))}throw Error("Supplied PeerID CID is invalid")}async function E(e,t){return 36===e.length?new m({multihash:l.Ue(c.identity.code,e),privateKey:t}):37===e.length?new y({multihash:l.Ue(c.identity.code,e),privateKey:t}):new g({multihash:await u.sha256.digest(e),publicKey:e,privateKey:t})}},88695:function(e,t,r){"use strict";let n;r.d(t,{Fm:function(){return w},xV:function(){return v}}),r(12143),parseInt("0xFFFF",16),new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var i=r(60522),s=r(75360),o=r(74006),a=r(45193),l=r(2780),c=r(17954),u=r(83508),h=r(60565),d=r(12528),p=r(74369);let f=p.C,g=p.aY,m=function(e){let t=0;if(f(e=e.toString().trim())){let r=new Uint8Array(t+4);return e.split(/\./g).forEach(e=>{r[t++]=255&parseInt(e,10)}),r}if(g(e)){let r;let n=e.split(":",8);for(r=0;r0;r--)e.push("0");n.splice.apply(n,e)}let i=new Uint8Array(t+16);for(r=0;r>8&255,i[t++]=255&e}return i}throw Error("invalid ip address")},y=function(e,t=0,r){t=~~t,r=r??e.length-t;let n=new DataView(e.buffer);if(4===r){let n=[];for(let i=0;i65536)throw Error("Port number is not in range(1, 65536)");let s=A(n);return(0,u.z)([r,s],r.length+s.length)}(t);case 445:return function(e){let t=e.split(":");if(2!==t.length)throw Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(56!==t[0].length)throw Error(`failed to parse onion addr: ${t[0]} not a Tor onion3 address.`);let r=i.base32.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw Error("Port number is not in range(1, 65536)");let s=A(n);return(0,u.z)([r,s],r.length+s.length)}(t);case 466:return function(e){let t=S.decode(e),r=Uint8Array.from(c.cv(t.length));return(0,u.z)([r,t],r.length+t.length)}(t);default:return(0,h.m)(t,"base16")}}(0,b.Ev)("ip4"),(0,b.Ev)("ip6"),(0,b.Ev)("ipcidr");let E=Object.values(o.gh).map(e=>e.decoder),S=(n=E[0].or(E[1]),E.slice(2).forEach(e=>n=n.or(e)),n);function A(e){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function I(e){return new DataView(e.buffer).getUint16(e.byteOffset)}},40914:function(e,t,r){"use strict";r.d(t,{h2:function(){return S},HM:function(){return A},a_:function(){return h.Ev},s_:function(){return E}});var n=r(22852),i=r(75360),s=r(45193),o=r(38856),a=r(12528),l=r(17954),c=r(83508),u=r(88695),h=r(27304);function d(e){let t=[],r=[],n=null,i=0;for(;i0)return e.size/8;if(0===e.size)return 0;{let e=l.Jx(t instanceof Uint8Array?t:Uint8Array.from(t));return e+l.P$(e)}}(c,e.slice(i+o));if(0===d){t.push([s]),r.push([s]),i+=o;continue}let p=e.slice(i+o,i+o+d);if((i+=d+o)>e.length)throw m("Invalid address Uint8Array: "+(0,a.B)(e,"base16"));t.push([s,p]);let f=(0,u.xV)(s,p);if(r.push([s,f]),!0===c.path){n=f;break}}return{bytes:Uint8Array.from(e),string:p(r),tuples:t,stringTuples:r,path:n}}function p(e){let t=[];return e.map(e=>{let r=(0,h.Ev)(e[0]);return t.push(r.name),e.length>1&&null!=e[1]&&t.push(e[1]),null}),g(t.join("/"))}function f(e){return(0,c.z)(e.map(e=>{let t=(0,h.Ev)(e[0]),r=Uint8Array.from(l.cv(t.code));return e.length>1&&null!=e[1]&&(r=(0,c.z)([r,e[1]])),r}))}function g(e){return"/"+e.trim().split("/").filter(e=>e).join("/")}function m(e){return Error("Error parsing address: "+e)}let y=Symbol.for("nodejs.util.inspect.custom"),b=Symbol.for("@multiformats/js-multiaddr/multiaddr"),v=[(0,h.Ev)("dns").code,(0,h.Ev)("dns4").code,(0,h.Ev)("dns6").code,(0,h.Ev)("dnsaddr").code];class w{bytes;#t;#r;#n;#i;[b]=!0;constructor(e){let t;if(null==e&&(e=""),e instanceof Uint8Array)t=d(e);else if("string"==typeof e){if(e.length>0&&"/"!==e.charAt(0))throw Error(`multiaddr "${e}" must start with a "/"`);t=function(e){e=g(e);let t=[],r=[],n=null,i=e.split("/").slice(1);if(1===i.length&&""===i[0])return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let s=0;s=i.length)throw m("invalid address: "+e);if(!0===a.path){n=g(i.slice(s).join("/")),t.push([a.code,(0,u.Fm)(a.code,n)]),r.push([a.code,n]);break}let l=(0,u.Fm)(a.code,i[s]);t.push([a.code,l]),r.push([a.code,(0,u.xV)(a.code,l)])}return{string:p(r),bytes:f(t),tuples:t,stringTuples:r,path:n}}(e)}else if(S(e))t=d(e.bytes);else throw Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=t.bytes,this.#t=t.string,this.#r=t.tuples,this.#n=t.stringTuples,this.#i=t.path}toString(){return this.#t}toJSON(){return this.toString()}toOptions(){let e,t,r,n;let i="",s=(0,h.Ev)("tcp"),o=(0,h.Ev)("udp"),a=(0,h.Ev)("ip4"),l=(0,h.Ev)("ip6"),c=(0,h.Ev)("dns6"),u=(0,h.Ev)("ip6zone");for(let[d,p]of this.stringTuples())d===u.code&&(i=`%${p??""}`),v.includes(d)&&(t=s.name,n=443,r=`${p??""}${i}`,e=d===c.code?6:4),(d===s.code||d===o.code)&&(t=(0,h.Ev)(d).name,n=parseInt(p??"")),(d===a.code||d===l.code)&&(t=(0,h.Ev)(d).name,r=`${p??""}${i}`,e=d===l.code?6:4);if(null==e||null==t||null==r||null==n)throw Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:r,transport:t,port:n}}protos(){return this.#r.map(([e])=>Object.assign({},(0,h.Ev)(e)))}protoCodes(){return this.#r.map(([e])=>e)}protoNames(){return this.#r.map(([e])=>(0,h.Ev)(e).name)}tuples(){return this.#r}stringTuples(){return this.#n}encapsulate(e){return e=new w(e),new w(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new w(r.slice(0,n))}decapsulateCode(e){let t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new w(f(t.slice(0,r)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([t,r])=>{t===h.R5.p2p.code&&e.push([t,r]),t===h.R5["p2p-circuit"].code&&(e=[])});let t=e.pop();if(t?.[1]!=null){let e=t[1];if("Q"===e[0]||"1"===e[0])return(0,a.B)(i.base58btc.decode(`z${e}`),"base58btc");return(0,a.B)(s.k0.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){return this.#i}equals(e){return(0,o.f)(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(e=>e.resolvable);if(null==t)return[this];let r=E.get(t.name);if(null==r)throw new n.sv(`no available resolver for ${t.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await r(this,e)).map(e=>A(e))}nodeAddress(){let e=this.toOptions();if("tcp"!==e.transport&&"udp"!==e.transport)throw Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return 2===t.length&&(4===t[0].code||41===t[0].code)&&(6===t[1].code||273===t[1].code)}[y](){return`Multiaddr(${this.#t})`}}let E=new Map;function S(e){return!!e?.[b]}function A(e){return new w(e)}},27304:function(e,t,r){"use strict";r.d(t,{Ev:function(){return s},R5:function(){return n}});let n={},i={};function s(e){if("number"==typeof e){if(null!=i[e])return i[e];throw Error(`no protocol with code: ${e}`)}if("string"==typeof e){if(null!=n[e])return n[e];throw Error(`no protocol with name: ${e}`)}throw Error(`invalid protocol id type: ${typeof e}`)}[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]].forEach(e=>{let t=function(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:!!n,path:!!i}}(...e);i[t.code]=t,n[t.name]=t})},36562:function(e,t,r){"use strict";r.d(t,{UN:function(){return P},Sg:function(){return D}});var n=r(78967),i=r(93560),s=r(53554),o=r(91678),a=r(65332);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let l=BigInt(0),c=BigInt(1),u=BigInt(2),h=BigInt(8),d={zip215:!0},p=BigInt(0),f=BigInt(1),g=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),m=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),y=BigInt(0),b=BigInt(1),v=BigInt(2),w=BigInt(5),E=BigInt(10),S=BigInt(20),A=BigInt(40),I=BigInt(80);function _(e){let t=e*e%g*e%g,r=(0,s.oA)(t,v,g)*t%g,n=(0,s.oA)(r,b,g)*e%g,i=(0,s.oA)(n,w,g)*n%g,o=(0,s.oA)(i,E,g)*i%g,a=(0,s.oA)(o,S,g)*o%g,l=(0,s.oA)(a,A,g)*a%g,c=(0,s.oA)(l,I,g)*l%g,u=(0,s.oA)(c,I,g)*l%g,h=(0,s.oA)(u,E,g)*i%g;return{pow_p_5_8:(0,s.oA)(h,v,g)*e%g,b2:t}}function T(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function C(e,t){let r=(0,s.wQ)(t*t*t,g),n=_(e*(0,s.wQ)(r*r*t,g)).pow_p_5_8,i=(0,s.wQ)(e*r*n,g),o=(0,s.wQ)(t*i*i,g),a=i,l=(0,s.wQ)(i*m,g),c=o===e,u=o===(0,s.wQ)(-e,g),h=o===(0,s.wQ)(-e*m,g);return c&&(i=a),(u||h)&&(i=l),(0,s.Tu)(i,g)&&(i=(0,s.wQ)(-i,g)),{isValid:c||u,value:i}}let R=(0,s.gN)(g,void 0,!0),k={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:R,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:n.o,randomBytes:i.O6,adjustScalarBytes:T,uvRatio:C},P=function(e){let t=function(e){let t=(0,a.K)(e);return o.FF(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:r,n:n,prehash:i,hash:p,randomBytes:f,nByteLength:g,h:m}=t,y=u<{try{return{isValid:!0,value:r.sqrt(e*r.inv(t))}}catch(e){return{isValid:!1,value:l}}}),w=t.adjustScalarBytes||(e=>e),E=t.domain||((e,t,r)=>{if(t.length||r)throw Error("Contexts/pre-hash are not supported");return e}),S=e=>"bigint"==typeof e&&lS(e)&&S(t)&&ee===l||A(e,y);function _(e,t){if(A(e,t))return e;throw Error(`Expected valid scalar < ${t}, got ${typeof e} ${e}`)}function T(e){return e===l?e:_(e,n)}let C=new Map;function R(e){if(!(e instanceof k))throw Error("ExtendedPoint expected")}class k{constructor(e,t,r,n){if(this.ex=e,this.ey=t,this.ez=r,this.et=n,!I(e))throw Error("x required");if(!I(t))throw Error("y required");if(!I(r))throw Error("z required");if(!I(n))throw Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof k)throw Error("extended point not allowed");let{x:t,y:r}=e||{};if(!I(t)||!I(r))throw Error("invalid affine point");return new k(t,r,c,b(t*r))}static normalizeZ(e){let t=r.invertBatch(e.map(e=>e.ez));return e.map((e,r)=>e.toAffine(t[r])).map(k.fromAffine)}_setWindowSize(e){this._WINDOW_SIZE=e,C.delete(this)}assertValidity(){let{a:e,d:r}=t;if(this.is0())throw Error("bad point: ZERO");let{ex:n,ey:i,ez:s,et:o}=this,a=b(n*n),l=b(i*i),c=b(s*s),u=b(c*c),h=b(a*e);if(b(c*b(h+l))!==b(u+b(r*b(a*l))))throw Error("bad point: equation left != right (1)");if(b(n*i)!==b(s*o))throw Error("bad point: equation left != right (2)")}equals(e){R(e);let{ex:t,ey:r,ez:n}=this,{ex:i,ey:s,ez:o}=e,a=b(t*o),l=b(i*n),c=b(r*o),u=b(s*n);return a===l&&c===u}is0(){return this.equals(k.ZERO)}negate(){return new k(b(-this.ex),this.ey,this.ez,b(-this.et))}double(){let{a:e}=t,{ex:r,ey:n,ez:i}=this,s=b(r*r),o=b(n*n),a=b(u*b(i*i)),l=b(e*s),c=r+n,h=b(b(c*c)-s-o),d=l+o,p=d-a,f=l-o,g=b(h*p),m=b(d*f),y=b(h*f);return new k(g,m,b(p*d),y)}add(e){R(e);let{a:r,d:n}=t,{ex:i,ey:s,ez:o,et:a}=this,{ex:c,ey:h,ez:d,et:p}=e;if(r===BigInt(-1)){let e=b((s-i)*(h+c)),t=b((s+i)*(h-c)),r=b(t-e);if(r===l)return this.double();let n=b(o*u*p),f=b(a*u*d),g=f+n,m=t+e,y=f-n,v=b(g*r),w=b(m*y),E=b(g*y);return new k(v,w,b(r*m),E)}let f=b(i*c),g=b(s*h),m=b(a*n*p),y=b(o*d),v=b((i+s)*(c+h)-f-g),w=y-m,E=y+m,S=b(g-r*f),A=b(v*w),I=b(E*S),_=b(v*S);return new k(A,I,b(w*E),_)}subtract(e){return this.add(e.negate())}wNAF(e){return B.wNAFCached(this,C,e,k.normalizeZ)}multiply(e){let{p:t,f:r}=this.wNAF(_(e,n));return k.normalizeZ([t,r])[0]}multiplyUnsafe(e){let t=T(e);return t===l?D:this.equals(D)||t===c?this:this.equals(P)?this.wNAF(t).p:B.unsafeLadder(this,t)}isSmallOrder(){return this.multiplyUnsafe(m).is0()}isTorsionFree(){return B.unsafeLadder(this,n).is0()}toAffine(e){let{ex:t,ey:n,ez:i}=this,s=this.is0();null==e&&(e=s?h:r.inv(i));let o=b(t*e),a=b(n*e),u=b(i*e);if(s)return{x:l,y:c};if(u!==c)throw Error("invZ was invalid");return{x:o,y:a}}clearCofactor(){let{h:e}=t;return e===c?this:this.multiplyUnsafe(e)}static fromHex(e,n=!1){let{d:i,a:s}=t,a=r.BYTES,u=(e=(0,o.ql)("pointHex",e,a)).slice(),h=e[a-1];u[a-1]=-129&h;let d=o.ty(u);d===l||(n?_(d,y):_(d,r.ORDER));let p=b(d*d),{isValid:f,value:g}=v(b(p-c),b(i*p-s));if(!f)throw Error("Point.fromHex: invalid y coordinate");let m=(g&c)===c,w=(128&h)!=0;if(!n&&g===l&&w)throw Error("Point.fromHex: x=0 and x_0=1");return w!==m&&(g=b(-g)),k.fromAffine({x:g,y:d})}static fromPrivateKey(e){return L(e).point}toRawBytes(){let{x:e,y:t}=this.toAffine(),n=o.S5(t,r.BYTES);return n[n.length-1]|=e&c?128:0,n}toHex(){return o.ci(this.toRawBytes())}}k.BASE=new k(t.Gx,t.Gy,c,b(t.Gx*t.Gy)),k.ZERO=new k(l,c,c,l);let{BASE:P,ZERO:D}=k,B=(0,a.M)(k,8*g);function N(e){var t;return t=o.ty(e),(0,s.wQ)(t,n)}function L(e){e=(0,o.ql)("private key",e,g);let t=(0,o.ql)("hashed private key",p(e),2*g),r=w(t.slice(0,g)),n=t.slice(g,2*g),i=N(r),s=P.multiply(i),a=s.toRawBytes();return{head:r,prefix:n,scalar:i,point:s,pointBytes:a}}function x(e=new Uint8Array,...t){return N(p(E(o.eV(...t),(0,o.ql)("context",e),!!i)))}return P._setWindowSize(8),{CURVE:t,getPublicKey:function(e){return L(e).pointBytes},sign:function(e,t,a={}){var l;e=(0,o.ql)("message",e),i&&(e=i(e));let{prefix:c,scalar:u,pointBytes:h}=L(t),d=x(a.context,c,e),p=P.multiply(d).toRawBytes(),f=(l=d+x(a.context,p,h,e)*u,(0,s.wQ)(l,n));T(f);let m=o.eV(p,o.S5(f,r.BYTES));return(0,o.ql)("result",m,2*g)},verify:function(e,t,n,s=d){let a,l,c;let{context:u,zip215:h}=s,p=r.BYTES;e=(0,o.ql)("signature",e,2*p),t=(0,o.ql)("message",t),i&&(t=i(t));let f=o.ty(e.slice(p,2*p));try{a=k.fromHex(n,h),l=k.fromHex(e.slice(0,p),h),c=P.multiplyUnsafe(f)}catch(e){return!1}if(!h&&a.isSmallOrder())return!1;let g=x(u,l.toRawBytes(),a.toRawBytes(),t);return l.add(a.multiplyUnsafe(g)).subtract(c).clearCofactor().equals(k.ZERO)},ExtendedPoint:k,utils:{getExtendedPublicKey:L,randomPrivateKey:()=>f(r.BYTES),precompute:(e=8,t=k.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}(k);({...k,prehash:n.o});let D=function(e){let t=((0,o.FF)(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})),{P:r}=t,n=e=>(0,s.wQ)(e,r),i=t.montgomeryBits,a=Math.ceil(i/8),l=t.nByteLength,c=t.adjustScalarBytes||(e=>e),u=t.powPminus2||(e=>(0,s.sQ)(e,r-BigInt(2),r));function h(e,t,r){let i=n(e*(t-r));return[t=n(t-i),r=n(r+i)]}function d(e){if("bigint"==typeof e&&p<=e&&e=p;e--){let t=o>>e&f;y^=t,a=(r=h(y,a,c))[0],c=r[1],l=(r=h(y,l,m))[0],m=r[1],y=t;let i=a+l,u=n(i*i),d=a-l,p=n(d*d),b=u-p,v=c+m,w=n((c-m)*i),E=n(v*d),S=w+E,A=w-E;c=n(S*S),m=n(s*n(A*A)),a=n(u*p),l=n(b*(u+n(g*b)))}return a=(r=h(y,a,c))[0],c=r[1],l=(r=h(y,l,m))[0],m=r[1],n(a*u(l))}(function(e){let t=(0,o.ql)("u coordinate",e,a);return 32===l&&(t[31]&=127),(0,o.ty)(t)}(t),function(e){let t=(0,o.ql)("scalar",e),r=t.length;if(r!==a&&r!==l)throw Error(`Expected ${a} or ${l} bytes, got ${r}`);return(0,o.ty)(c(t))}(e));if(r===p)throw Error("Invalid private or public key received");return m(r)}let b=m(t.Gu);function v(e){return y(e,b)}return{scalarMult:y,scalarMultBase:v,getSharedSecret:(e,t)=>y(e,t),getPublicKey:e=>v(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:b}}({P:g,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{let{pow_p_5_8:t,b2:r}=_(e);return(0,s.wQ)((0,s.oA)(t,BigInt(3),g)*r,g)},adjustScalarBytes:T,randomBytes:i.O6}),B=(R.ORDER+BigInt(3))/BigInt(8);function N(e){if(!(e instanceof H))throw Error("RistrettoPoint expected")}R.pow(v,B),R.sqrt(R.neg(R.ONE)),R.ORDER,BigInt(5),BigInt(8),BigInt(486662),(0,s.DV)(R,R.neg(BigInt(486664)));let L=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),x=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),O=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),M=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),U=e=>C(b,e),F=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),K=e=>P.CURVE.Fp.create(bytesToNumberLE(e)&F);function V(e){let{d:t}=P.CURVE,r=P.CURVE.Fp.ORDER,n=P.CURVE.Fp.create,i=n(null*e*e),s=n((i+b)*O),o=BigInt(-1),a=n((o-t*i)*n(i+t)),{isValid:l,value:c}=C(s,a),u=n(c*e);isNegativeLE(u,r)||(u=n(-u)),l||(c=u),l||(o=i);let h=n(o*(i-b)*M-a),d=c*c,p=n((c+c)*a),f=n(h*L),g=n(b-d),m=n(b+d);return new P.ExtendedPoint(n(p*m),n(g*f),n(f*m),n(p*g))}class H{constructor(e){this.ep=e}static fromAffine(e){return new H(P.ExtendedPoint.fromAffine(e))}static hashToCurve(e){let t=V(K((e=ensureBytes("ristrettoHash",e,64)).slice(0,32))),r=V(K(e.slice(32,64)));return new H(t.add(r))}static fromHex(e){e=ensureBytes("ristrettoHex",e,32);let{a:t,d:r}=P.CURVE,n=P.CURVE.Fp.ORDER,i=P.CURVE.Fp.create,s="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",o=K(e);if(!equalBytes(numberToBytesLE(o,32),e)||isNegativeLE(o,n))throw Error(s);let a=i(o*o),l=i(b+t*a),c=i(b-t*a),u=i(l*l),h=i(c*c),d=i(t*r*u-h),{isValid:p,value:f}=U(i(d*h)),g=i(f*c),m=i(f*g*d),v=i((o+o)*g);isNegativeLE(v,n)&&(v=i(-v));let w=i(l*m),E=i(v*w);if(!p||isNegativeLE(E,n)||w===y)throw Error(s);return new H(new P.ExtendedPoint(v,w,b,E))}toRawBytes(){let e,{ex:t,ey:r,ez:n,et:i}=this.ep,s=P.CURVE.Fp.ORDER,o=P.CURVE.Fp.create,a=o(o(n+r)*o(n-r)),l=o(t*r),c=o(l*l),{value:u}=U(o(a*c)),h=o(u*a),d=o(u*l),p=o(h*d*i);if(isNegativeLE(i*p,s)){let n=o(null*r),i=o(null*t);t=n,r=i,e=o(h*x)}else e=d;isNegativeLE(t*p,s)&&(r=o(-r));let f=o((n-r)*e);return isNegativeLE(f,s)&&(f=o(-f)),numberToBytesLE(f,32)}toHex(){return bytesToHex(this.toRawBytes())}toString(){return this.toHex()}equals(e){N(e);let{ex:t,ey:r}=this.ep,{ex:n,ey:i}=e.ep,s=P.CURVE.Fp.create,o=s(t*i)===s(r*n),a=s(r*i)===s(t*n);return o||a}add(e){return N(e),new H(this.ep.add(e.ep))}subtract(e){return N(e),new H(this.ep.subtract(e.ep))}multiply(e){return new H(this.ep.multiply(e))}multiplyUnsafe(e){return new H(this.ep.multiplyUnsafe(e))}double(){return new H(this.ep.double())}negate(){return new H(this.ep.negate())}}},44458:function(e,t,r){"use strict";r.d(t,{Ee:function(){return b},NY:function(){return v},fC:function(){return y}});var n=r(22988),i=r(2265),s=r(98324),o=r(75137),a=r(1336),l=r(25171);let c="Avatar",[u,h]=(0,s.b)(c),[d,p]=u(c),f=(0,i.forwardRef)((e,t)=>{let{__scopeAvatar:r,...s}=e,[o,a]=(0,i.useState)("idle");return(0,i.createElement)(d,{scope:r,imageLoadingStatus:o,onImageLoadingStatusChange:a},(0,i.createElement)(l.WV.span,(0,n.Z)({},s,{ref:t})))}),g=(0,i.forwardRef)((e,t)=>{let{__scopeAvatar:r,src:s,onLoadingStatusChange:c=()=>{},...u}=e,h=p("AvatarImage",r),d=function(e){let[t,r]=(0,i.useState)("idle");return(0,a.b)(()=>{if(!e){r("error");return}let t=!0,n=new window.Image,i=e=>()=>{t&&r(e)};return r("loading"),n.onload=i("loaded"),n.onerror=i("error"),n.src=e,()=>{t=!1}},[e]),t}(s),f=(0,o.W)(e=>{c(e),h.onImageLoadingStatusChange(e)});return(0,a.b)(()=>{"idle"!==d&&f(d)},[d,f]),"loaded"===d?(0,i.createElement)(l.WV.img,(0,n.Z)({},u,{ref:t,src:s})):null}),m=(0,i.forwardRef)((e,t)=>{let{__scopeAvatar:r,delayMs:s,...o}=e,a=p("AvatarFallback",r),[c,u]=(0,i.useState)(void 0===s);return(0,i.useEffect)(()=>{if(void 0!==s){let e=window.setTimeout(()=>u(!0),s);return()=>window.clearTimeout(e)}},[s]),c&&"loaded"!==a.imageLoadingStatus?(0,i.createElement)(l.WV.span,(0,n.Z)({},o,{ref:t})):null}),y=f,b=g,v=m},9646:function(e,t,r){"use strict";r.d(t,{bU:function(){return S},fC:function(){return E}});var n=r(22988),i=r(2265),s=r(78149),o=r(1584),a=r(98324),l=r(91715),c=r(47250),u=r(75238),h=r(25171);let d="Switch",[p,f]=(0,a.b)(d),[g,m]=p(d),y=(0,i.forwardRef)((e,t)=>{let{__scopeSwitch:r,name:a,checked:c,defaultChecked:u,required:d,disabled:p,value:f="on",onCheckedChange:m,...y}=e,[b,E]=(0,i.useState)(null),S=(0,o.e)(t,e=>E(e)),A=(0,i.useRef)(!1),I=!b||!!b.closest("form"),[_=!1,T]=(0,l.T)({prop:c,defaultProp:u,onChange:m});return(0,i.createElement)(g,{scope:r,checked:_,disabled:p},(0,i.createElement)(h.WV.button,(0,n.Z)({type:"button",role:"switch","aria-checked":_,"aria-required":d,"data-state":w(_),"data-disabled":p?"":void 0,disabled:p,value:f},y,{ref:S,onClick:(0,s.M)(e.onClick,e=>{T(e=>!e),I&&(A.current=e.isPropagationStopped(),A.current||e.stopPropagation())})})),I&&(0,i.createElement)(v,{control:b,bubbles:!A.current,name:a,value:f,checked:_,required:d,disabled:p,style:{transform:"translateX(-100%)"}}))}),b=(0,i.forwardRef)((e,t)=>{let{__scopeSwitch:r,...s}=e,o=m("SwitchThumb",r);return(0,i.createElement)(h.WV.span,(0,n.Z)({"data-state":w(o.checked),"data-disabled":o.disabled?"":void 0},s,{ref:t}))}),v=e=>{let{control:t,checked:r,bubbles:s=!0,...o}=e,a=(0,i.useRef)(null),l=(0,c.D)(r),h=(0,u.t)(t);return(0,i.useEffect)(()=>{let e=a.current,t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(l!==r&&t){let n=new Event("click",{bubbles:s});t.call(e,r),e.dispatchEvent(n)}},[l,r,s]),(0,i.createElement)("input",(0,n.Z)({type:"checkbox","aria-hidden":!0,defaultChecked:r},o,{tabIndex:-1,ref:a,style:{...e.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function w(e){return e?"checked":"unchecked"}let E=y,S=b},97540:function(e,t,r){"use strict";r.d(t,{p:function(){return a}});var n=r(33126),i=r(85419),s=r(75354),o=r(47651);class a{multicodec;components;log;pubsubTopics;options;addLibp2pEventListener;removeLibp2pEventListener;streamManager;constructor(e,t,r,n,i){this.multicodec=e,this.components=t,this.log=r,this.pubsubTopics=n,this.options=i,this.addLibp2pEventListener=t.events.addEventListener.bind(t.events),this.removeLibp2pEventListener=t.events.removeEventListener.bind(t.events),this.streamManager=new o.a(e,t.connectionManager.getConnections.bind(t.connectionManager),this.addLibp2pEventListener)}async getStream(e){return this.streamManager.getStream(e)}get peerStore(){return this.components.peerStore}async allPeers(){return(0,i.RB)(this.peerStore,[this.multicodec])}async connectedPeers(){return(await this.allPeers()).filter(e=>this.components.connectionManager.getConnections(e.id).length>0)}async getPeers({numPeers:e,maxBootstrapPeers:t}={maxBootstrapPeers:1,numPeers:0}){let r=function(e,t,r){let n=e.filter(e=>e.tags.has(s.$G.BOOTSTRAP)).slice(0,r);t>0&&t!e.tags.has(s.$G.BOOTSTRAP));if(0===t)return[...n,...i];let o=[...n];for(;o.length0;){let e=Math.floor(Math.random()*i.length),t=i.splice(e,1)[0];o.push(t)}return o}(await (0,i._4)(this.components.connectionManager.getConnections(),this.peerStore,[this.multicodec],this.options?.shardInfo?(0,n.Ao)(this.options.shardInfo).shardInfo:void 0),e,t),o=await (0,i.tf)(this.peerStore,r);return 0===o.length&&this.log.warn("No peers found. Ensure you have a connection to the network."),o.length{this.log.error(`Failed to prepare a new stream for ${e.id.toString()}`)});this.streamPool.set(e.id.toString(),t)}handlePeerUpdateStreamPool=e=>{let t=e.detail.peer;t.protocols.includes(this.multicodec)&&(this.log.info(`Preemptively opening a stream to ${t.id.toString()}`),this.prepareNewStream(t))}}},18976:function(e,t,r){"use strict";let n,i;r.d(t,{Qy:function(){return m},Lk:function(){return rF},C0:function(){return r5},PZ:function(){return r0}});var s,o,a,l,c,u,h,d,p=r(85931),f=r(5846),g=r(33126);let m={TEST:"enrtree://AOGYWMBYOUIMOENHXCHILPKY3ZRFEULMFI4DOM442QSZ73TT2A7VI@test.waku.nodes.status.im",SANDBOX:"enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im"},y="bootstrap",b={store:2,filter:1,lightPush:1};var v=r(48215),w=r(95856),E=r.t(w,2);/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */let S=BigInt(0),A=BigInt(1),I=BigInt(2),_=BigInt(3),T=BigInt(8),C=Object.freeze({a:S,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:A,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),R=(e,t)=>(e+t/I)/t,k={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(e){let{n:t}=C,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-A*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=BigInt("0x100000000000000000000000000000000"),o=R(r*e,t),a=R(-n*e,t),l=Z(e-o*r-a*i,t),c=Z(-o*n-a*r,t),u=l>s,h=c>s;if(u&&(l=t-l),h&&(c=t-c),l>s||c>s)throw Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:u,k1:l,k2neg:h,k2:c}}};function P(e){let{a:t,b:r}=C,n=Z(e*e),i=Z(n*e);return Z(i+t*e+r)}let D=C.a===S;class B extends Error{constructor(e){super(e)}}function N(e){if(!(e instanceof L))throw TypeError("JacobianPoint expected")}class L{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof M))throw TypeError("JacobianPoint#fromAffine: expected Point");return e.equals(M.ZERO)?L.ZERO:new L(e.x,e.y,A)}static toAffineBatch(e){let t=function(e,t=C.P){let r=Array(e.length),n=et(e.reduce((e,n,i)=>n===S?e:(r[i]=e,Z(e*n,t)),A),t);return e.reduceRight((e,n,i)=>n===S?e:(r[i]=Z(e*r[i],t),Z(e*n,t)),n),r}(e.map(e=>e.z));return e.map((e,r)=>e.toAffine(t[r]))}static normalizeZ(e){return L.toAffineBatch(e).map(L.fromAffine)}equals(e){N(e);let{x:t,y:r,z:n}=this,{x:i,y:s,z:o}=e,a=Z(n*n),l=Z(o*o),c=Z(t*l),u=Z(i*a),h=Z(Z(r*o)*l),d=Z(Z(s*n)*a);return c===u&&h===d}negate(){return new L(this.x,Z(-this.y),this.z)}double(){let{x:e,y:t,z:r}=this,n=Z(e*e),i=Z(t*t),s=Z(i*i),o=e+i,a=Z(I*(Z(o*o)-n-s)),l=Z(_*n),c=Z(l*l),u=Z(c-I*a),h=Z(l*(a-u)-T*s);return new L(u,h,Z(I*t*r))}add(e){N(e);let{x:t,y:r,z:n}=this,{x:i,y:s,z:o}=e;if(i===S||s===S)return this;if(t===S||r===S)return e;let a=Z(n*n),l=Z(o*o),c=Z(t*l),u=Z(i*a),h=Z(Z(r*o)*l),d=Z(Z(s*n)*a),p=Z(u-c),f=Z(d-h);if(p===S)return f===S?this.double():L.ZERO;let g=Z(p*p),m=Z(p*g),y=Z(c*g),b=Z(f*f-m-I*y),v=Z(f*(y-b)-h*m);return new L(b,v,Z(n*o*p))}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){let t=L.ZERO;if("bigint"==typeof e&&e===S)return t;let r=X(e);if(r===A)return this;if(!D){let e=t,n=this;for(;r>S;)r&A&&(e=e.add(n)),n=n.double(),r>>=A;return e}let{k1neg:n,k1:i,k2neg:s,k2:o}=k.splitScalar(r),a=t,l=t,c=this;for(;i>S||o>S;)i&A&&(a=a.add(c)),o&A&&(l=l.add(c)),c=c.double(),i>>=A,o>>=A;return n&&(a=a.negate()),s&&(l=l.negate()),l=new L(Z(l.x*k.beta),l.y,l.z),a.add(l)}precomputeWindow(e){let t=D?128/e+1:256/e+1,r=[],n=this,i=n;for(let s=0;s>=u,o>a&&(o-=c,e+=A);let h=r+Math.abs(o)-1,d=t%2!=0,p=o<0;0===o?s=s.add(x(d,n[r])):i=i.add(x(p,n[h]))}return{p:i,f:s}}multiply(e,t){let r,n,i=X(e);if(D){let{k1neg:e,k1:s,k2neg:o,k2:a}=k.splitScalar(i),{p:l,f:c}=this.wNAF(s,t),{p:u,f:h}=this.wNAF(a,t);l=x(e,l),u=new L(Z((u=x(o,u)).x*k.beta),u.y,u.z),r=l.add(u),n=c.add(h)}else{let{p:e,f:s}=this.wNAF(i,t);r=e,n=s}return L.normalizeZ([r,n])[0]}toAffine(e){let{x:t,y:r,z:n}=this,i=this.equals(L.ZERO);null==e&&(e=i?T:et(n));let s=e,o=Z(s*s),a=Z(o*s),l=Z(t*o),c=Z(r*a),u=Z(n*s);if(i)return M.ZERO;if(u!==A)throw Error("invZ was invalid");return new M(l,c)}}function x(e,t){let r=t.negate();return e?r:t}L.BASE=new L(C.Gx,C.Gy,A),L.ZERO=new L(S,A,S);let O=new WeakMap;class M{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,O.delete(this)}hasEvenY(){return this.y%I===S}static fromCompressedHex(e){let t=32===e.length,r=Q(t?e:e.subarray(1));if(!es(r))throw Error("Point is not on curve");let n=function(e){let{P:t}=C,r=BigInt(6),n=BigInt(11),i=BigInt(22),s=BigInt(23),o=BigInt(44),a=BigInt(88),l=e*e*e%t,c=l*l*e%t,u=ee(c,_)*c%t,h=ee(u,_)*c%t,d=ee(h,I)*l%t,p=ee(d,n)*d%t,f=ee(p,i)*p%t,g=ee(f,o)*f%t,m=ee(g,a)*g%t,y=ee(m,o)*f%t,b=ee(y,_)*c%t,v=ee(b,s)*p%t,w=ee(v,r)*l%t,E=ee(w,I);if(E*E%t!==e)throw Error("Cannot find square root");return E}(P(r)),i=(n&A)===A;t?i&&(n=Z(-n)):(1&e[0])==1!==i&&(n=Z(-n));let s=new M(r,n);return s.assertValidity(),s}static fromUncompressedHex(e){let t=new M(Q(e.subarray(1,33)),Q(e.subarray(33,65)));return t.assertValidity(),t}static fromHex(e){let t=J(e),r=t.length,n=t[0];if(32===r||33===r&&(2===n||3===n))return this.fromCompressedHex(t);if(65===r&&4===n)return this.fromUncompressedHex(t);throw Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r}`)}static fromPrivateKey(e){return M.BASE.multiply(eo(e))}static fromSignature(e,t,r){let{r:n,s:i}=ea(t);if(![0,1,2,3].includes(r))throw Error("Cannot recover: invalid recovery bit");let s=er(J(e)),{n:o}=C,a=2===r||3===r?n+o:n,l=et(a,o),c=Z(-s*l,o),u=Z(i*l,o),h=1&r?"03":"02",d=M.fromHex(h+z(a)),p=M.BASE.multiplyAndAddUnsafe(d,c,u);if(!p)throw Error("Cannot recover signature: point at infinify");return p.assertValidity(),p}toRawBytes(e=!1){return Y(this.toHex(e))}toHex(e=!1){let t=z(this.x);if(!e)return`04${t}${z(this.y)}`;{let e=this.hasEvenY()?"02":"03";return`${e}${t}`}}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){let e="Point is not on elliptic curve",{x:t,y:r}=this;if(!es(t)||!es(r))throw Error(e);let n=Z(r*r);if(Z(n-P(t))!==S)throw Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new M(this.x,Z(-this.y))}double(){return L.fromAffine(this).double().toAffine()}add(e){return L.fromAffine(this).add(L.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return L.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,r){let n=L.fromAffine(this),i=t===S||t===A||this!==M.BASE?n.multiplyUnsafe(t):n.multiply(t),s=L.fromAffine(e).multiplyUnsafe(r),o=i.add(s);return o.equals(L.ZERO)?void 0:o.toAffine()}}function U(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function F(e){if(e.length<2||2!==e[0])throw Error(`Invalid signature integer tag: ${$(e)}`);let t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw Error("Invalid signature integer: trailing length");return{data:Q(r),left:e.subarray(t+2)}}M.BASE=new M(C.Gx,C.Gy),M.ZERO=new M(S,S);class K{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){let t=e instanceof Uint8Array,r="Signature.fromCompact";if("string"!=typeof e&&!t)throw TypeError(`${r}: Expected string or Uint8Array`);let n=t?$(e):e;if(128!==n.length)throw Error(`${r}: Expected 64-byte hex`);return new K(W(n.slice(0,64)),W(n.slice(64,128)))}static fromDER(e){let t=e instanceof Uint8Array;if("string"!=typeof e&&!t)throw TypeError("Signature.fromDER: Expected string or Uint8Array");let{r,s:n}=function(e){if(e.length<2||48!=e[0])throw Error(`Invalid signature tag: ${$(e)}`);if(e[1]!==e.length-2)throw Error("Invalid signature: incorrect length");let{data:t,left:r}=F(e.subarray(2)),{data:n,left:i}=F(r);if(i.length)throw Error(`Invalid signature: left bytes after parsing: ${$(i)}`);return{r:t,s:n}}(t?e:Y(e));return new K(r,n)}static fromHex(e){return this.fromDER(e)}assertValidity(){let{r:e,s:t}=this;if(!ei(e))throw Error("Invalid Signature: r must be 0 < r < n");if(!ei(t))throw Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){let e=C.n>>A;return this.s>e}normalizeS(){return this.hasHighS()?new K(this.r,Z(-this.s,C.n)):this}toDERRawBytes(){return Y(this.toDERHex())}toDERHex(){let e=U(G(this.s)),t=U(G(this.r)),r=e.length/2,n=t.length/2,i=G(r),s=G(n),o=G(n+r+4);return`30${o}02${s}${t}02${i}${e}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return Y(this.toCompactHex())}toCompactHex(){return z(this.r)+z(this.s)}}function V(...e){if(!e.every(e=>e instanceof Uint8Array))throw Error("Uint8Array list expected");if(1===e.length)return e[0];let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));for(let r=0,n=0;rt.toString(16).padStart(2,"0"));function $(e){if(!(e instanceof Uint8Array))throw Error("Expected Uint8Array");let t="";for(let r=0;r0)return BigInt(e);if("bigint"==typeof e&&ei(e))return e;throw TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function Z(e,t=C.P){let r=e%t;return r>=S?r:t+r}function ee(e,t){let{P:r}=C,n=e;for(;t-- >S;)n*=n,n%=r;return n}function et(e,t=C.P){if(e===S||t<=S)throw Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=Z(e,t),n=t,i=S,s=A,o=A,a=S;for(;r!==S;){let e=n/r,t=n%r,l=i-o*e,c=s-a*e;n=r,r=t,i=o,s=a,o=l,a=c}if(n!==A)throw Error("invert: does not exist");return Z(i,t)}function er(e,t=!1){let r=function(e){let t=8*e.length-256,r=Q(e);return t>0?r>>BigInt(t):r}(e);if(t)return r;let{n}=C;return r>=n?r-n:r}class en{constructor(e,t){if(this.hashLen=e,this.qByteLen=t,"number"!=typeof e||e<2)throw Error("hashLen must be a number");if("number"!=typeof t||t<2)throw Error("qByteLen must be a number");this.v=new Uint8Array(e).fill(1),this.k=new Uint8Array(e).fill(0),this.counter=0}hmac(...e){return ep.hmacSha256(this.k,...e)}hmacSync(...e){return i(this.k,...e)}checkSync(){if("function"!=typeof i)throw new B("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(e=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),e),this.v=await this.hmac(this.v),0!==e.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),e),this.v=await this.hmac(this.v))}reseedSync(e=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}async generate(){this.incr();let e=0,t=[];for(;e0)t=BigInt(e);else if("string"==typeof e){if(64!==e.length)throw Error("Expected 32 bytes of private key");t=W(e)}else if(e instanceof Uint8Array){if(32!==e.length)throw Error("Expected 32 bytes of private key");t=Q(e)}else throw TypeError("Expected valid private key");if(!ei(t))throw Error("Expected private key: 0 < key < n");return t}function ea(e){if(e instanceof K)return e.assertValidity(),e;try{return K.fromDER(e)}catch(t){return K.fromCompact(e)}}function el(e){return Q(e.length>32?e.slice(0,32):e)}async function ec(e,t,r={}){let n;let{seed:i,m:s,d:o}=function(e,t,r){if(null==e)throw Error(`sign: expected valid message hash, not "${e}"`);let n=J(e),i=eo(t),s=[j(i),function(e){let t=el(e),r=Z(t,C.n);return j(r{if((e=J(e)).length<40||e.length>1024)throw Error("Expected valid bytes of private key as per FIPS 186");return j(Z(Q(e),C.n-A)+A)},randomBytes:(e=32)=>{if(eh.web)return eh.web.getRandomValues(new Uint8Array(e));if(eh.node){let{randomBytes:t}=eh.node;return Uint8Array.from(t(e))}throw Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>ep.hashToPrivateKey(ep.randomBytes(40)),precompute(e=8,t=M.BASE){let r=t===M.BASE?t:new M(t.x,t.y);return r._setWindowSize(e),r.multiply(_),r},sha256:async(...e)=>{if(eh.web)return new Uint8Array(await eh.web.subtle.digest("SHA-256",V(...e)));if(eh.node){let{createHash:t}=eh.node,r=t("sha256");return e.forEach(e=>r.update(e)),Uint8Array.from(r.digest())}throw Error("The environment doesn't have sha256 function")},hmacSha256:async(e,...t)=>{if(eh.web){let r=await eh.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=V(...t);return new Uint8Array(await eh.web.subtle.sign("HMAC",r,n))}if(eh.node){let{createHmac:r}=eh.node,n=r("sha256",e);return t.forEach(e=>n.update(e)),Uint8Array.from(n.digest())}throw Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(e,...t)=>{let r=ed[e];if(void 0===r){let t=await ep.sha256(Uint8Array.from(e,e=>e.charCodeAt(0)));r=V(t,t),ed[e]=r}return ep.sha256(r,...t)},taggedHashSync:(e,...t)=>{if("function"!=typeof n)throw new B("sha256Sync is undefined, you need to set it");let r=ed[e];if(void 0===r){let t=n(Uint8Array.from(e,e=>e.charCodeAt(0)));r=V(t,t),ed[e]=r}return n(r,...t)},_JacobianPoint:L};Object.defineProperties(ep,{sha256Sync:{configurable:!1,get:()=>n,set(e){n||(n=e)}},hmacSha256Sync:{configurable:!1,get:()=>i,set(e){i||(i=e)}}});var ef=r(83524);function eg(e){return new Uint8Array(ef.keccak256.arrayBuffer(e))}function em(e,t,r){try{let n=K.fromCompact(e.slice(0,64));return function(e,t,r,n=eu){let i,s;try{i=ea(e),t=J(t)}catch(e){return!1}let{r:o,s:a}=i;if(n.strict&&i.hasHighS())return!1;let l=er(t);try{s=r instanceof M?(r.assertValidity(),r):M.fromHex(r)}catch(e){return!1}let{n:c}=C,u=et(a,c),h=Z(l*u,c),d=Z(o*u,c),p=M.BASE.multiplyAndAddUnsafe(s,h,d);return!!p&&Z(p.x,c)===o}(n,t,r)}catch{return!1}}let ey="Invalid record id";var eb=r(40914),ev=r(88695),ew=r(36408),eE=r(65301);function eS(e){let t=new Uint8Array(e.reduce((e,t)=>e+2+t.bytes.length,0)),r=new DataView(t.buffer),n=0;return e.forEach(e=>{if(e.getPeerId())throw Error("`multiaddr` field MUST not contain peer id");r.setUint16(n,e.bytes.length),n+=2,t.set(e.bytes,n),n+=e.bytes.length}),t}class eA extends Map{seq;signature;constructor(e={},t=BigInt(1),r){super(Object.entries(e)),this.seq=t,this.signature=r}set(e,t){return this.signature=void 0,this.seq++,super.set(e,t)}get id(){let e=this.get("id");if(!e)throw Error("id not found.");return(0,v.Md)(e)}get publicKey(){if("v4"===this.id)return this.get("secp256k1");throw Error(ey)}get rs(){let e=this.get("rs");if(e)return(0,g.Ix)(e)}get rsv(){let e=this.get("rsv");if(e)return(0,g.Ix)(e)}get ip(){return eI(this,"ip","ip4")}set ip(e){eT(this,"ip","ip4",e)}get tcp(){return e_(this,"tcp","tcp")}set tcp(e){eC(this,"tcp","tcp",e)}get udp(){return e_(this,"udp","udp")}set udp(e){eC(this,"udp","udp",e)}get ip6(){return eI(this,"ip6","ip6")}set ip6(e){eT(this,"ip6","ip6",e)}get tcp6(){return e_(this,"tcp6","tcp")}set tcp6(e){eC(this,"tcp6","tcp",e)}get udp6(){return e_(this,"udp6","udp")}set udp6(e){eC(this,"udp6","udp",e)}get multiaddrs(){let e=this.get("multiaddrs");if(e)return function(e){let t=[],r=0;for(;r>=1)%2&&(t.store=!0),(e>>=1)%2&&(t.filter=!0),(e>>=1)%2&&(t.lightPush=!0),t}(e[0])}set waku2(e){eR(this,"waku2",e,e=>{let t;return new Uint8Array([(t=0,e.lightPush&&(t+=1),t<<=1,e.filter&&(t+=1),t<<=1,e.store&&(t+=1),t<<=1,e.relay&&(t+=1),t)])})}}function eI(e,t,r){let n=e.get(t);if(n)return(0,ev.xV)(r,n)}function e_(e,t,r){let n=e.get(t);if(n)return Number((0,ev.xV)(r,n))}function eT(e,t,r,n){eR(e,t,n,ev.Fm.bind({},r))}function eC(e,t,r,n){eT(e,t,r,n?.toString(10))}function eR(e,t,r,n){void 0!==r?e.set(t,n(r)):e.delete(t)}async function ek(e,t){return ec(eg(t),e,{der:!1})}let eP=new g.Yd("enr");(s=c||(c={})).TCP="tcp",s.UDP="udp",(o=u||(u={})).TCP4="tcp4",o.UDP4="udp4",o.TCP6="tcp6",o.UDP6="udp6";class eD extends eA{static RECORD_PREFIX="enr:";peerId;static async create(e={},t=BigInt(1),r){let n=new eD(e,t,r);try{let e=n.publicKey;e&&(n.peerId=await function(e){let t=new ew.xO.secp256k1.Secp256k1PublicKey(e);return(0,eE.y5)(t.bytes,void 0)}(e))}catch(e){eP.error("Could not calculate peer id for ENR",e)}return n}get nodeId(){if("v4"===this.id)return this.publicKey?function(e){let t=M.fromHex(e).toRawBytes(!1);return(0,v.ci)(eg(t.slice(1)))}(this.publicKey):void 0;throw Error(ey)}getLocationMultiaddr=(function e(t,r){let n;switch(r){case"udp":return e(t,"udp4")||e(t,"udp6");case"tcp":return e(t,"tcp4")||e(t,"tcp6")}let i=r.endsWith("6"),s=t.get(i?"ip6":"ip");if(!s)return;let o=r.slice(0,3);switch(o){case"udp":n=i?t.get("udp6"):t.get("udp");break;case"tcp":n=i?t.get("tcp6"):t.get("tcp");break;default:return}if(n){var a,l;return a=i?"ip6":"ip4",l=n,(0,eb.HM)("/"+a+"/"+(0,ev.xV)(a,s)).encapsulate((0,eb.HM)("/"+o+"/"+(0,ev.xV)(o,l)))}}).bind({},this);get shardInfo(){return this.rs&&this.rsv&&eP.warn("ENR contains both `rs` and `rsv` fields."),this.rs||this.rsv}setLocationMultiaddr(e){let t=e.protoNames();if(2!==t.length&&"udp"!==t[1]&&"tcp"!==t[1])throw Error("Invalid multiaddr");let r=e.tuples();if(!r[0][1]||!r[1][1])throw Error("Invalid multiaddr");4===r[0][0]?(this.set("ip",r[0][1]),this.set(t[1],r[1][1])):(this.set("ip6",r[0][1]),this.set(t[1]+"6",r[1][1]))}getAllLocationMultiaddrs(){let e=[];for(let t of Object.values(u)){let r=this.getLocationMultiaddr(t);r&&e.push(r)}let t=this.multiaddrs??[];return e.concat(t).map(e=>this.peerId?e.encapsulate(`/p2p/${this.peerId.toString()}`):e)}get peerInfo(){let e=this.peerId;if(e)return{id:e,multiaddrs:this.getAllLocationMultiaddrs()}}getFullMultiaddr(e){if(this.peerId){let t=this.getLocationMultiaddr(e);if(t)return t.encapsulate(`/p2p/${this.peerId.toString()}`)}}getFullMultiaddrs(){if(this.peerId&&this.multiaddrs){let e=this.peerId;return this.multiaddrs.map(t=>t.encapsulate(`/p2p/${e.toString()}`))}return[]}verify(e,t){if(!this.get("id")||"v4"!==this.id)throw Error(ey);if(!this.publicKey)throw Error("Failed to verify ENR: No public key");return em(t,eg(e),this.publicKey)}async sign(e,t){if("v4"===this.id)this.signature=await ek(t,e);else throw Error(ey);return this.signature}}let eB=!1,eN=!1,eL={debug:1,default:2,info:2,warning:3,error:4,off:5},ex=eL.default,eO=null,eM=function(){try{let e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test"!=="test".normalize(t))throw Error("bad normalize")}catch(r){e.push(t)}}),e.length)throw Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw Error("broken implementation")}catch(e){return e.message}return null}();(a=h||(h={})).DEBUG="DEBUG",a.INFO="INFO",a.WARNING="WARNING",a.ERROR="ERROR",a.OFF="OFF",(l=d||(d={})).UNKNOWN_ERROR="UNKNOWN_ERROR",l.NOT_IMPLEMENTED="NOT_IMPLEMENTED",l.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",l.NETWORK_ERROR="NETWORK_ERROR",l.SERVER_ERROR="SERVER_ERROR",l.TIMEOUT="TIMEOUT",l.BUFFER_OVERRUN="BUFFER_OVERRUN",l.NUMERIC_FAULT="NUMERIC_FAULT",l.MISSING_NEW="MISSING_NEW",l.INVALID_ARGUMENT="INVALID_ARGUMENT",l.MISSING_ARGUMENT="MISSING_ARGUMENT",l.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",l.CALL_EXCEPTION="CALL_EXCEPTION",l.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",l.NONCE_EXPIRED="NONCE_EXPIRED",l.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",l.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",l.TRANSACTION_REPLACED="TRANSACTION_REPLACED",l.ACTION_REJECTED="ACTION_REJECTED";let eU="0123456789abcdef";class eF{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){let r=e.toLowerCase();null==eL[r]&&this.throwArgumentError("invalid log level name","logLevel",e),ex>eL[r]||console.log.apply(console,t)}debug(...e){this._log(eF.levels.DEBUG,e)}info(...e){this._log(eF.levels.INFO,e)}warn(...e){this._log(eF.levels.WARNING,e)}makeError(e,t,r){if(eN)return this.makeError("censored error",t,{});t||(t=eF.errors.UNKNOWN_ERROR),r||(r={});let n=[];Object.keys(r).forEach(e=>{let t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e>4]+eU[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(t){n.push(e+"="+JSON.stringify(r[e].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);let i=e,s="";switch(t){case d.NUMERIC_FAULT:{s="NUMERIC_FAULT";let t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case d.CALL_EXCEPTION:case d.INSUFFICIENT_FUNDS:case d.MISSING_NEW:case d.NONCE_EXPIRED:case d.REPLACEMENT_UNDERPRICED:case d.TRANSACTION_REPLACED:case d.UNPREDICTABLE_GAS_LIMIT:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),n.length&&(e+=" ("+n.join(", ")+")");let o=Error(e);return o.reason=i,o.code=t,Object.keys(r).forEach(function(e){o[e]=r[e]}),o}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,eF.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),eM&&this.throwError("platform missing String.prototype.normalize",eF.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:eM})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,eF.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,eF.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",et&&this.throwError("too many arguments"+r,eF.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||null==e)&&this.throwError("missing new",eF.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",eF.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||null==e)&&this.throwError("missing new",eF.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return eO||(eO=new eF("logger/5.7.0")),eO}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",eF.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),eB){if(!e)return;this.globalLogger().throwError("error censorship permanent",eF.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}eN=!!e,eB=!!t}static setLogLevel(e){let t=eL[e.toLowerCase()];if(null==t){eF.globalLogger().warn("invalid log level - "+e);return}ex=t}static from(e){return new eF(e)}}eF.errors=d,eF.levels=h;let eK=new eF("bytes/5.7.0");function eV(e){return!!e.toHexString}function eH(e){return e.slice||(e.slice=function(){let t=Array.prototype.slice.call(arguments);return eH(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function e$(e){return"number"==typeof e&&e==e&&e%1==0}function eq(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e||!e$(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function ez(e,t){if(t||(t={}),"number"==typeof e){eK.checkSafeUint53(e,"invalid arrayify value");let t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),eH(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),eV(e)&&(e=e.toHexString()),ej(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":eK.throwArgumentError("hex data is odd-length","value",e));let n=[];for(let e=0;e>4]+eG[15&n]}return t}return eK.throwArgumentError("invalid hexlify value","value",e)}let eY=new eF("rlp/5.7.0");function eQ(e){let t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function eJ(e,t,r){let n=0;for(let i=0;it+1+n&&eY.throwError("child data too short",eF.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function eZ(e,t){if(0===e.length&&eY.throwError("data too short",eF.errors.BUFFER_OVERRUN,{}),e[t]>=248){let r=e[t]-247;t+1+r>e.length&&eY.throwError("data short segment too short",eF.errors.BUFFER_OVERRUN,{});let n=eJ(e,t+1,r);return t+1+r+n>e.length&&eY.throwError("data long segment too short",eF.errors.BUFFER_OVERRUN,{}),eX(e,t,t+1+r,r+n)}if(e[t]>=192){let r=e[t]-192;return t+1+r>e.length&&eY.throwError("data array too short",eF.errors.BUFFER_OVERRUN,{}),eX(e,t,t+1,r)}if(e[t]>=184){let r=e[t]-183;t+1+r>e.length&&eY.throwError("data array too short",eF.errors.BUFFER_OVERRUN,{});let n=eJ(e,t+1,r);t+1+r+n>e.length&&eY.throwError("data array too short",eF.errors.BUFFER_OVERRUN,{});let i=eW(e.slice(t+1+r,t+1+r+n));return{consumed:1+r+n,result:i}}if(e[t]>=128){let r=e[t]-128;t+1+r>e.length&&eY.throwError("data too short",eF.errors.BUFFER_OVERRUN,{});let n=eW(e.slice(t+1,t+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:eW(e[t])}}var e0=r(60565);let e1=new g.Yd("enr:decoder");class e2{static fromString(e){if(!e.startsWith(eD.RECORD_PREFIX))throw Error(`"string encoded ENR must start with '${eD.RECORD_PREFIX}'`);return e2.fromRLP((0,e0.m)(e.slice(4),"base64url"))}static fromRLP(e){return e3((function(e){let t=ez(e),r=eZ(t,0);return r.consumed!==t.length&&eY.throwArgumentError("invalid rlp data","data",e),r.result})(e).map(v.nr))}}async function e3(e){let{signature:t,seq:r,kvs:n}=function(e){if(!Array.isArray(e))throw Error("Decoded ENR must be an array");if(e.length%2!=0)throw Error("Decoded ENR must have an even number of elements");let[t,r,...n]=e;if(!t||Array.isArray(t))throw Error("Decoded ENR invalid signature: must be a byte array");if(!r||Array.isArray(r))throw Error("Decoded ENR invalid sequence number: must be a byte array");return{signature:t,seq:r,kvs:n}}(e),i={};for(let e=0;ee4.test(e),encode(e,t,r){r=~~r,t=t||new Uint8Array(r+4);let n=e.length,i=0;for(let s=0;s(t=~~t,`${e[t++]}.${e[t++]}.${e[t++]}.${e[t]}`)},e8={name:"v6",size:16,isFormat:e=>e.length>0&&e6.test(e),encode(e,t,r){let n=(r=~~r)+16,i=-1,s=0,o=0,a=!0,l=!1;t=t||new Uint8Array(r+16);for(let c=0;c>8),r=97?u-=87:u>=65?u-=55:(u-=48,o=10*o+u),s=(s<<4)+u)}if(!1===a)!0===l?(r>8),r=i+2;e--)t[e]=t[e-2];t[i]=0,t[i+1]=0,i=r}if(i!==r&&-1!==i)for(r>n-2&&(r=n-2);n>i;)t[--n]=ri?t[--r]:0;else for(;r=56320?t+=3:(64512&e.charCodeAt(s))!=56320?t+=3:(n=s,t+=4)}}return t}function ts(e,t,r){let n=e.length;null==r&&(r=0),void 0===t&&(t=new Uint8Array(ti(e)+r));let i=r;for(let r=0;r>6,t[i++]=128|63&s;else if((63488&s)!=55296)t[i++]=224|(61440&s)>>12,t[i++]=128|(4032&s)>>6,t[i++]=128|63&s;else{let o=r+1;if(o===n||s>=56320)t[i++]=239,t[i++]=191,t[i++]=189;else{let n=e.charCodeAt(o);(64512&n)!=56320?(t[i++]=239,t[i++]=191,t[i++]=189):(r=o,s=65536|(1023&s)<<10|1023&n,t[i++]=240|(1835008&s)>>18,t[i++]=128|(258048&s)>>12,t[i++]=128|(4032&s)>>6,t[i++]=128|63&s)}}}return ts.bytes=i-r,t}function to(e,t,r){let n="";null==t&&(t=0),null==r&&(r=e.length);for(let i=t;i191&&r<224?t=(31&r)<<6|63&e[i++]:r>239&&r<365?(n+=String.fromCharCode(55296|(t=((7&r)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536)>>10&1023),t=56320|1023&t):t=(15&r)<<12|(63&e[i++])<<6|63&e[i++],n+=String.fromCharCode(t)}return to.bytes=r-t,n}ts.bytes=0,to.bytes=0;let ta=e=>e instanceof Uint8Array;function tl(e){return"string"==typeof e?ti(e):e.byteLength}function tc(e){return e instanceof Uint8Array?e:Array.isArray(e)?new Uint8Array(e):ts(e)}function tu(e,t,r){if("string"!=typeof t)throw Error("unknown input type");return ts(t,e,r),ts.bytes}let th=(e,t)=>16777216*e[t]+65536*e[t+1]+256*e[t+2]+e[t+3],td=(e,t)=>e[t]<<8|e[t+1],tp=(e,t,r)=>(t=+t,e[r+3]=t,t>>>=8,e[r+2]=t,t>>>=8,e[r+1]=t,t>>>=8,e[r]=t,r+4),tf=(e,t,r)=>(e[r]=t>>8,e[r+1]=255&t,r+2);function tg(e,t,r,n,i){return(r<0&&(n-=r,r=0),n<0&&(n=0),i<0)?new Uint8Array(0):r>=t.length||n>=i?0:function(e,t,r,n,i){i-n>t.length-r&&(i=n+t.length-r);let s=i-n,o=e.length-n;return s>o&&(s=o),(0!==n||ie)}}let ty=tm({encode(e,t,r){t||(t=new Uint8Array(ty.encodingLength(e))),r||(r=0);let n=r,i=e.replace(/^\.|\.$/gm,"");if(i.length){let e=i.split(".");for(let n=0;n=e.length)throw Error("Cannot decode name (buffer overflow)");let a=e[t++];if(s+=o?0:1,0===a)break;if((192&a)==0){if(t+a>e.length)throw Error("Cannot decode name (buffer overflow)");if((i+=a+1)>254)throw Error("Cannot decode name (name too long)");r.push(to(e,t,t+a)),t+=a,s+=o?0:a}else if((192&a)==192){if(t+1>e.length)throw Error("Cannot decode name (buffer overflow)");let r=td(e,t-1)-49152;if(r>=n)throw Error("Cannot decode name (bad pointer)");t=r,n=r,s+=o?0:1,o=!0}else throw Error("Cannot decode name (bad label)")}return ty.decode.bytes=s,0===r.length?".":r.join(".")},encodingLength:e=>"."===e||".."===e?1:tl(e.replace(/^\.|\.$/gm,""))+2}),tb=tm({encode(e,t,r){t||(t=new Uint8Array(tb.encodingLength(e))),r||(r=0);let n=tu(t,e,r+1);return t[r]=n,tb.encode.bytes=n+1,t},decode(e,t){t||(t=0);let r=e[t],n=to(e,t+1,t+1+r);return tb.decode.bytes=r+1,n},encodingLength:e=>tl(e)+1}),tv=tm({bytes:12,encode(e,t,r){t||(t=new Uint8Array(tv.encodingLength(e))),r||(r=0);let n=32767&(e.flags||0),i="response"===e.type?32768:0;return tf(t,e.id||0,r),tf(t,n|i,r+2),tf(t,e.questions.length,r+4),tf(t,e.answers.length,r+6),tf(t,e.authorities.length,r+8),tf(t,e.additionals.length,r+10),t},decode(e,t){if(t||(t=0),e.length<12)throw Error("Header must be 12 bytes");let r=td(e,t+2);return{id:td(e,t),type:32768&r?"response":"query",flags:32767&r,flag_qr:(r>>15&1)==1,opcode:function(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e}(r>>11&15),flag_aa:(r>>10&1)==1,flag_tc:(r>>9&1)==1,flag_rd:(r>>8&1)==1,flag_ra:(r>>7&1)==1,flag_z:(r>>6&1)==1,flag_ad:(r>>5&1)==1,flag_cd:(r>>4&1)==1,rcode:function(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e}(15&r),questions:Array(td(e,t+4)),answers:Array(td(e,t+6)),authorities:Array(td(e,t+8)),additionals:Array(td(e,t+10))}},encodingLength:()=>12}),tw=tm({encode(e,t,r){t||(t=new Uint8Array(tw.encodingLength(e))),r||(r=0);let n=e.length;return tf(t,n,r),tg(e,t,r+2,0,n),tw.encode.bytes=n+2,t},decode(e,t){t||(t=0);let r=td(e,t),n=e.slice(t+2,t+2+r);return tw.decode.bytes=r+2,n},encodingLength:e=>e.length+2}),tE=tm({encode:(e,t,r)=>(t||(t=new Uint8Array(tE.encodingLength(e))),r||(r=0),ty.encode(e,t,r+2),tf(t,ty.encode.bytes,r),tE.encode.bytes=ty.encode.bytes+2,t),decode(e,t){t||(t=0);let r=td(e,t),n=ty.decode(e,t+2);return tE.decode.bytes=r+2,n},encodingLength:e=>ty.encodingLength(e)+2}),tS=tm({encode(e,t,r){t||(t=new Uint8Array(tS.encodingLength(e))),r||(r=0);let n=r;return r+=2,ty.encode(e.mname,t,r),r+=ty.encode.bytes,ty.encode(e.rname,t,r),r+=ty.encode.bytes,tp(t,e.serial||0,r),r+=4,tp(t,e.refresh||0,r),r+=4,tp(t,e.retry||0,r),r+=4,tp(t,e.expire||0,r),r+=4,tp(t,e.minimum||0,r),r+=4,tf(t,r-n-2,n),tS.encode.bytes=r-n,t},decode(e,t){t||(t=0);let r=t,n={};return t+=2,n.mname=ty.decode(e,t),t+=ty.decode.bytes,n.rname=ty.decode(e,t),t+=ty.decode.bytes,n.serial=th(e,t),t+=4,n.refresh=th(e,t),t+=4,n.retry=th(e,t),t+=4,n.expire=th(e,t),t+=4,n.minimum=th(e,t),t+=4,tS.decode.bytes=t-r,n},encodingLength:e=>22+ty.encodingLength(e.mname)+ty.encodingLength(e.rname)}),tA=tm({encode(e,t,r){Array.isArray(e)||(e=[e]);for(let t=0;t0;){let r=e[t++];if(--ne?(ta(e)?e.length:tl(e))+2:2}),t_=tm({encode(e,t,r){t||(t=new Uint8Array(t_.encodingLength(e))),r||(r=0);let n=r;return r+=2,tb.encode(e.cpu,t,r),r+=tb.encode.bytes,tb.encode(e.os,t,r),r+=tb.encode.bytes,tf(t,r-n-2,n),t_.encode.bytes=r-n,t},decode(e,t){t||(t=0);let r=t,n={};return t+=2,n.cpu=tb.decode(e,t),t+=tb.decode.bytes,n.os=tb.decode(e,t),t+=tb.decode.bytes,t_.decode.bytes=t-r,n},encodingLength:e=>tb.encodingLength(e.cpu)+tb.encodingLength(e.os)+2}),tT=tm({encode:(e,t,r)=>(t||(t=new Uint8Array(tT.encodingLength(e))),r||(r=0),ty.encode(e,t,r+2),tf(t,ty.encode.bytes,r),tT.encode.bytes=ty.encode.bytes+2,t),decode(e,t){t||(t=0);let r=ty.decode(e,t+2);return tT.decode.bytes=ty.decode.bytes+2,r},encodingLength:e=>ty.encodingLength(e)+2}),tC=tm({encode(e,t,r){t||(t=new Uint8Array(tC.encodingLength(e))),r||(r=0),tf(t,e.priority||0,r+2),tf(t,e.weight||0,r+4),tf(t,e.port||0,r+6),ty.encode(e.target,t,r+8);let n=ty.encode.bytes+6;return tf(t,n,r),tC.encode.bytes=n+2,t},decode(e,t){t||(t=0);let r=td(e,t),n={};return n.priority=td(e,t+2),n.weight=td(e,t+4),n.port=td(e,t+6),n.target=ty.decode(e,t+8),tC.decode.bytes=r+2,n},encodingLength:e=>8+ty.encodingLength(e.target)}),tR=tm({encode(e,t,r){let n=tR.encodingLength(e);return t||(t=new Uint8Array(tR.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=tR.ISSUER_CRITICAL),tf(t,n-2,r),t[r+=2]=e.flags||0,r+=1,tb.encode(e.tag,t,r),r+=tb.encode.bytes,tu(t,e.value,r),r+=tl(e.value),tR.encode.bytes=n,t},decode(e,t){t||(t=0);let r=td(e,t),n=t+=2,i={};return i.flags=e[t],t+=1,i.tag=tb.decode(e,t),t+=tb.decode.bytes,i.value=to(e,t,n+r),i.issuerCritical=!!(i.flags&tR.ISSUER_CRITICAL),tR.decode.bytes=r+2,i},encodingLength:e=>tb.encodingLength(e.tag)+tb.encodingLength(e.value)+2});tR.ISSUER_CRITICAL=128;let tk=tm({encode(e,t,r){t||(t=new Uint8Array(tk.encodingLength(e))),r||(r=0);let n=r;return r+=2,tf(t,e.preference||0,r),r+=2,ty.encode(e.exchange,t,r),r+=ty.encode.bytes,tf(t,r-n-2,n),tk.encode.bytes=r-n,t},decode(e,t){t||(t=0);let r=t,n={};return t+=2,n.preference=td(e,t),t+=2,n.exchange=ty.decode(e,t),t+=ty.decode.bytes,tk.decode.bytes=t-r,n},encodingLength:e=>4+ty.encodingLength(e.exchange)}),tP=tm({encode:(e,t,r)=>(t||(t=new Uint8Array(tP.encodingLength(e))),r||(r=0),tf(t,4,r),r+=2,e5.encode(e,t,r),t),decode:(e,t)=>(t||(t=0),t+=2,e5.decode(e,t)),bytes:6}),tD=tm({encode:(e,t,r)=>(t||(t=new Uint8Array(tD.encodingLength(e))),r||(r=0),tf(t,16,r),r+=2,e8.encode(e,t,r),tD.encode.bytes=18,t),decode(e,t){t||(t=0),t+=2;let r=e8.decode(e,t);return tD.decode.bytes=18,r},bytes:18}),tB=e=>new Uint8Array(e),tN=tm({encode(e,t,r){t||(t=new Uint8Array(tN.encodingLength(e))),r||(r=0);let n=r,i=tn(e.code);if(tf(t,i,r),r+=2,e.data)tf(t,e.data.length,r),r+=2,tg(e.data,t,r),r+=e.data.length;else switch(i){case 8:{let n=e.sourcePrefixLength||0,i=e.family||(e9(e.ip)===e5.size?1:2),s=function(e,t,r){r=~~r;let n=e9(e);return("function"==typeof t&&(t=t(r+n)),n===e5.size)?e5.encode(e,t,r):e8.encode(e,t,r)}(e.ip,tB),o=Math.ceil(n/8);tf(t,o+4,r),r+=2,tf(t,i,r),r+=2,t[r++]=n,t[r++]=e.scopePrefixLength||0,tg(s,t,r,0,o),r+=o}break;case 11:e.timeout?(tf(t,2,r),r+=2,tf(t,e.timeout,r)):tf(t,0,r),r+=2;break;case 12:{let n=e.length||0;tf(t,n,r),r+=2,t.fill(0,r,r+n),r+=n}break;case 14:{let n=2*e.tags.length;for(let i of(tf(t,n,r),r+=2,e.tags))tf(t,i,r),r+=2}break;default:throw Error(`Unknown roption code: ${e.code}`)}return tN.encode.bytes=r-n,t},decode(e,t){t||(t=0);let r={};r.code=td(e,t),r.type=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:`OPTION_${e}`}(r.code);let n=td(e,t+=2);switch(t+=2,r.data=e.slice(t,t+n),r.code){case 8:r.family=td(e,t),t+=2,r.sourcePrefixLength=e[t++],r.scopePrefixLength=e[t++];{let i=new Uint8Array(1===r.family?4:16);tg(e,i,0,t,t+n-4),r.ip=function(e,t,r){if(t=~~t,(r=r||e.length-t)===e5.size)return e5.decode(e,t,r);if(r===e8.size)return e8.decode(e,t,r);throw Error(`Invalid buffer size needs to be ${e5.size} for v4 or ${e8.size} for v6.`)}(i)}break;case 11:n>0&&(r.timeout=td(e,t),t+=2);break;case 14:r.tags=[];for(let i=0;i0;)n[s++]=tN.decode(e,t),t+=tN.decode.bytes,i-=tN.decode.bytes;return tL.decode.bytes=t-r,n},encodingLength:e=>2+tX(e||[],tN)}),tx=tm({encode(e,t,r){t||(t=new Uint8Array(tx.encodingLength(e))),r||(r=0);let n=r,i=e.key;if(!ta(i))throw Error("Key must be a Buffer");return r+=2,tf(t,e.flags,r),t[r+=2]=tx.PROTOCOL_DNSSEC,t[r+=1]=e.algorithm,r+=1,tg(i,t,r,0,i.length),r+=i.length,tx.encode.bytes=r-n,tf(t,tx.encode.bytes-2,n),t},decode(e,t){t||(t=0);let r=t,n={},i=td(e,t);if(t+=2,n.flags=td(e,t),e[t+=2]!==tx.PROTOCOL_DNSSEC)throw Error("Protocol must be 3");return t+=1,n.algorithm=e[t],t+=1,n.key=e.slice(t,r+i+2),t+=n.key.length,tx.decode.bytes=t-r,n},encodingLength:e=>6+tl(e.key)});tx.PROTOCOL_DNSSEC=3,tx.ZONE_KEY=128,tx.SECURE_ENTRYPOINT=32768;let tO=tm({encode(e,t,r){t||(t=new Uint8Array(tO.encodingLength(e))),r||(r=0);let n=r,i=e.signature;if(!ta(i))throw Error("Signature must be a Buffer");return r+=2,tf(t,te(e.typeCovered),r),t[r+=2]=e.algorithm,t[r+=1]=e.labels,r+=1,tp(t,e.originalTTL,r),r+=4,tp(t,e.expiration,r),r+=4,tp(t,e.inception,r),r+=4,tf(t,e.keyTag,r),r+=2,ty.encode(e.signersName,t,r),r+=ty.encode.bytes,tg(i,t,r,0,i.length),r+=i.length,tO.encode.bytes=r-n,tf(t,tO.encode.bytes-2,n),t},decode(e,t){t||(t=0);let r=t,n={},i=td(e,t);return t+=2,n.typeCovered=e7(td(e,t)),t+=2,n.algorithm=e[t],t+=1,n.labels=e[t],t+=1,n.originalTTL=th(e,t),t+=4,n.expiration=th(e,t),t+=4,n.inception=th(e,t),t+=4,n.keyTag=td(e,t),t+=2,n.signersName=ty.decode(e,t),t+=ty.decode.bytes,n.signature=e.slice(t,r+i+2),t+=n.signature.length,tO.decode.bytes=t-r,n},encodingLength:e=>20+ty.encodingLength(e.signersName)+tl(e.signature)}),tM=tm({encode(e,t,r){t||(t=new Uint8Array(tM.encodingLength(e))),r||(r=0);let n=r;return r+=2,ty.encode(e.mbox||".",t,r),r+=ty.encode.bytes,ty.encode(e.txt||".",t,r),r+=ty.encode.bytes,tM.encode.bytes=r-n,tf(t,tM.encode.bytes-2,n),t},decode(e,t){t||(t=0);let r=t,n={};return t+=2,n.mbox=ty.decode(e,t)||".",t+=ty.decode.bytes,n.txt=ty.decode(e,t)||".",t+=ty.decode.bytes,tM.decode.bytes=t-r,n},encodingLength:e=>2+ty.encodingLength(e.mbox||".")+ty.encodingLength(e.txt||".")}),tU=tm({encode(e,t,r){t||(t=new Uint8Array(tU.encodingLength(e))),r||(r=0);let n=r,i=[];for(let t=0;t>8]&&(i[r>>8]=[]),i[r>>8][r>>3&31]|=1<<7-(7&r)}for(let e=0;e>8]=Math.max(t[n>>8]||0,255&n)}let r=0;for(let e=0;e2+ty.encodingLength(e.nextDomain)+tU.encodingLength(e.rrtypes)}),tK=tm({encode(e,t,r){t||(t=new Uint8Array(tK.encodingLength(e))),r||(r=0);let n=r,i=e.salt;if(!ta(i))throw Error("salt must be a Buffer");let s=e.nextDomain;if(!ta(s))throw Error("nextDomain must be a Buffer");return t[r+=2]=e.algorithm,t[r+=1]=e.flags,r+=1,tf(t,e.iterations,r),t[r+=2]=i.length,r+=1,tg(i,t,r,0,i.length),t[r+=i.length]=s.length,r+=1,tg(s,t,r,0,s.length),r+=s.length,tU.encode(e.rrtypes,t,r),r+=tU.encode.bytes,tK.encode.bytes=r-n,tf(t,tK.encode.bytes-2,n),t},decode(e,t){t||(t=0);let r=t,n={},i=td(e,t);t+=2,n.algorithm=e[t],t+=1,n.flags=e[t],t+=1,n.iterations=td(e,t);let s=e[t+=2];t+=1,n.salt=e.slice(t,t+s);let o=e[t+=s];return t+=1,n.nextDomain=e.slice(t,t+o),t+=o,n.rrtypes=tU.decode(e,t,i-(t-r)),t+=tU.decode.bytes,tK.decode.bytes=t-r,n},encodingLength:e=>8+e.salt.length+e.nextDomain.length+tU.encodingLength(e.rrtypes)}),tV=tm({encode(e,t,r){t||(t=new Uint8Array(tV.encodingLength(e))),r||(r=0);let n=r,i=e.digest;if(!ta(i))throw Error("Digest must be a Buffer");return r+=2,tf(t,e.keyTag,r),t[r+=2]=e.algorithm,t[r+=1]=e.digestType,r+=1,tg(i,t,r,0,i.length),r+=i.length,tV.encode.bytes=r-n,tf(t,tV.encode.bytes-2,n),t},decode(e,t){t||(t=0);let r=t,n={},i=td(e,t);return t+=2,n.keyTag=td(e,t),t+=2,n.algorithm=e[t],t+=1,n.digestType=e[t],t+=1,n.digest=e.slice(t,r+i+2),t+=n.digest.length,tV.decode.bytes=t-r,n},encodingLength:e=>6+tl(e.digest)});function tH(e){switch(e.toUpperCase()){case"A":return tP;case"PTR":case"CNAME":case"DNAME":return tT;case"TXT":return tA;case"NULL":return tI;case"AAAA":return tD;case"SRV":return tC;case"HINFO":return t_;case"CAA":return tR;case"NS":return tE;case"SOA":return tS;case"MX":return tk;case"OPT":return tL;case"DNSKEY":return tx;case"RRSIG":return tO;case"RP":return tM;case"NSEC":return tF;case"NSEC3":return tK;case"DS":return tV}return tw}let t$=tm({encode(e,t,r){t||(t=new Uint8Array(t$.encodingLength(e))),r||(r=0);let n=r;if(ty.encode(e.name,t,r),r+=ty.encode.bytes,tf(t,te(e.type),r),"OPT"===e.type.toUpperCase()){if("."!==e.name)throw Error("OPT name must be root.");tf(t,e.udpPayloadSize||4096,r+2),t[r+4]=e.extendedRcode||0,t[r+5]=e.ednsVersion||0,tf(t,e.flags||0,r+6),r+=8,tL.encode(e.options||[],t,r),r+=tL.encode.bytes}else{let n=tr(void 0===e.class?"IN":e.class);e.flush&&(n|=32768),tf(t,n,r+2),tp(t,e.ttl||0,r+4),r+=8;let i=tH(e.type);i.encode(e.data,t,r),r+=i.encode.bytes}return t$.encode.bytes=r-n,t},decode(e,t){t||(t=0);let r={},n=t;if(r.name=ty.decode(e,t),t+=ty.decode.bytes,r.type=e7(td(e,t)),"OPT"===r.type)r.udpPayloadSize=td(e,t+2),r.extendedRcode=e[t+4],r.ednsVersion=e[t+5],r.flags=td(e,t+6),r.flag_do=(r.flags>>15&1)==1,r.options=tL.decode(e,t+8),t+=8+tL.decode.bytes;else{let n=td(e,t+2);r.ttl=th(e,t+4),r.class=tt(-32769&n),r.flush=!!(32768&n);let i=tH(r.type);r.data=i.decode(e,t+8),t+=8+i.decode.bytes}return t$.decode.bytes=t-n,r},encodingLength(e){let t=null!==e.data&&void 0!==e.data?e.data:e.options;return ty.encodingLength(e.name)+8+tH(e.type).encodingLength(t)}}),tq=tm({encode(e,t,r){t||(t=new Uint8Array(tq.encodingLength(e))),r||(r=0);let n=r;return ty.encode(e.name,t,r),r+=ty.encode.bytes,tf(t,te(e.type),r),r+=2,tf(t,tr(void 0===e.class?"IN":e.class),r),r+=2,tq.encode.bytes=r-n,e},decode(e,t){t||(t=0);let r=t,n={};return n.name=ty.decode(e,t),t+=ty.decode.bytes,n.type=e7(td(e,t)),t+=2,n.class=tt(td(e,t)),t+=2,32768&n.class&&(n.class&=-32769),tq.decode.bytes=t-r,n},encodingLength:e=>ty.encodingLength(e.name)+4}),tz={encode:function(e,t,r){let n=!t;n&&(t=new Uint8Array(tJ(e))),r||(r=0);let i=r;return(e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),tv.encode(e,t,r),r+=tv.encode.bytes,r=tZ(e.questions,tq,t,r),r=tZ(e.answers,t$,t,r),r=tZ(e.authorities,t$,t,r),r=tZ(e.additionals,t$,t,r),tz.encode.bytes=r-i,n&&tY.bytes!==t.length)?t.slice(0,tY.bytes):t},decode:function(e,t){t||(t=0);let r=t,n=tv.decode(e,t);return t+=tv.decode.bytes,t=t0(n.questions,tq,e,t),t=t0(n.answers,t$,e,t),t=t0(n.authorities,t$,e,t),t=t0(n.additionals,t$,e,t),tz.decode.bytes=t-r,n},encodingLength:function(e){return tv.encodingLength(e)+tX(e.questions||[],tq)+tX(e.answers||[],t$)+tX(e.authorities||[],t$)+tX(e.additionals||[],t$)}};function tj(e,t){if(e.questions)throw Error("Only one .question object expected instead of a .questions array!");let r=Object.assign({type:t},e);return r.question&&(r.questions=[r.question],delete r.question),r}tz.encode.bytes=0,tz.decode.bytes=0;let tG={encode:function(e,t,r){return t=tz.encode(tj(e,"query"),t,r),tG.encode.bytes=tz.encode.bytes,t},decode:function(e,t){let r=tz.decode(e,t);return tG.decode.bytes=tz.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(e){return tz.encodingLength(tj(e,"query"))}};tG.encode.bytes=0,tG.decode.bytes=0;let tW={encode:function(e,t,r){return t=tz.encode(tj(e,"response"),t,r),tW.encode.bytes=tz.encode.bytes,t},decode:function(e,t){let r=tz.decode(e,t);return tW.decode.bytes=tz.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(e){return tz.encodingLength(tj(e,"response"))}};tW.encode.bytes=0,tW.decode.bytes=0;let tY=tz.encode,tQ=tz.decode,tJ=tz.encodingLength;function tX(e,t){let r=0;for(let n=0;n255)throw Error(`Character #${e} in charset [code=${r}, char=${t.charAt(e)}] is too high! (max=255)`);if(0!==i[r])throw Error(`Character [code=${r}, char=${t.charAt(e)}] is more than once in the charset!`);i[r]=e,s[e]=r}let o=r.charCodeAt(0),a={name:e,encodingLength(e){let t=e.length,r=.75*t|0;return e.charCodeAt(t-1)===o?e.charCodeAt(t-2)===o?r-2:r-1:r},encode(e,t,r){null==t&&(t=new Uint8Array(a.encodingLength(e))),null==r&&(r=0);let n=e.length;e.charCodeAt(n-1)===o&&(e.charCodeAt(n-2)===o?n-=2:n-=1);let s=n%4,l=n-s,c=r,u=0;for(;u>16,t[c++]=r>>8,t[c++]=r,u+=4}if(3===s){let r=i[e.charCodeAt(u)]<<10|i[e.charCodeAt(u+1)]<<4|i[e.charCodeAt(u+2)]>>2;t[c++]=r>>8,t[c++]=r}else 2===s&&(t[c++]=i[e.charCodeAt(u)]<<2|i[e.charCodeAt(u+1)]>>4);return a.encode.bytes=c-r,t},decode(e,t,r){null==t&&(t=0),null==r&&(r=e.length);let i=r-t,l=i%3,c=t+i-l,u=[];for(let r=t;r>18&63],s[t>>12&63],s[t>>6&63],s[63&t])}if(2===l){let t=(e[r-2]<<8)+e[r-1];u.push(s[t>>10],s[t>>4&63],s[t<<2&63]),1===n&&u.push(o)}else if(1===l){let t=e[r-1];u.push(s[t>>2],s[t<<4&63]),1===n&&u.push(o,o)}return a.decode.bytes=i,String.fromCharCode.apply(String,u)}};return a}t1("base64","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","=",1);let t2=t1("base64-url","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_","=",2),t3="undefined"!=typeof global?global.AbortError:"undefined"!=typeof window?window.AbortError:null;t3||(t3=class extends Error{constructor(e="Request aborted."){super(e)}}),t3.prototype.name="AbortError",t3.prototype.code="ABORT_ERR";let t4="undefined"!=typeof globalThis&&globalThis.URL||require("url").URL;class t6 extends Error{constructor(e,t,r){super("status="+t+" while requesting "+e+" ["+r+"]"),this.uri=e,this.status=t,this.method=r}toJSON(){return{code:this.code,uri:this.uri,status:this.status,method:this.method,endpoint:this.endpoint}}}t6.prototype.name="HTTPStatusError",t6.prototype.code="HTTP_STATUS";class t5 extends Error{constructor(e,t){super(e),this.cause=t}toJSON(){return{message:this.message,endpoint:this.endpoint,code:this.code,cause:function(e){if("string"==typeof e)return{message:e};try{let t=JSON.stringify(e);if("{}"!==t)return JSON.parse(t)}catch(e){}let t={message:String(e.message||e)};return void 0!==e.code&&(t.code=String(e.code)),t}(this.cause)}}}t5.prototype.name="ResponseError",t5.prototype.code="RESPONSE_ERR";class t8 extends Error{constructor(e){super("Timeout (t="+e+")."),this.timeout=e}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}t8.prototype.name="TimeoutError",t8.prototype.code="ETIMEOUT";let t9=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,t7=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i,re=/^(([a-z0-9]+:)\/\/)?([^/[\s:]+|\[[^\]]+\])?(:([^/\s]+))?(\/[^\s]*)?(.*)$/,rt=/\[(post|get|((ipv4|ipv6|name)=([^\]]+)))\]/ig,rr=/\[(((pk|name)=([^\]]+)))\]/ig;function rn(e,t){t.lastIndex=0;let r={};for(;;){let n=t.exec(e);if(!n)break;n[2]?r[n[3].toLowerCase()]=n[4]:r[n[1].toLowerCase()]=!0}return r}class ri extends Error{constructor(e,t){super(`Invalid Endpoint: unsupported protocol "${e}" for endpoint: ${t}, supported protocols: ${rs.join(", ")}`),this.protocol=e,this.endpoint=t}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}ri.prototype.name="InvalidProtocolError",ri.prototype.code="EPROTOCOL";let rs=["http:","https:","udp4:","udp6:"];class ro{constructor(e,t){this.name=e.name||null,this.protocol=e.protocol;let r="string"==typeof e.port?e.port=parseInt(e.port,10):e.port;if(null==r)this.port=t?"https:"===this.protocol?443:80:e.pk?443:53;else if("number"==typeof r||isNaN(r))this.port=r;else throw Error(`Invalid Endpoint: port "${e.port}" needs to be a number: ${JSON.stringify(e)}`)}toJSON(){return this.toString()}}class ra extends ro{constructor(e){super(e,!1),this.pk=e.pk||null}toString(){let e=this.port!==(this.pk?443:53)?`:${this.port}`:"",t=this.pk?` [pk=${this.pk}]`:"",r=this.name?` [name=${this.name}]`:"";return`udp://${this.ipv4||`[${this.ipv6}]`}${e}${t}${r}`}}class rl extends ra{constructor(e){if(super(Object.assign({protocol:"udp4:"},e)),!e.ipv4||"string"!=typeof e.ipv4)throw Error(`Invalid Endpoint: .ipv4 "${e.ipv4}" needs to be set: ${JSON.stringify(e)}`);this.ipv4=e.ipv4}}class rc extends ra{constructor(e){if(super(Object.assign({protocol:"udp6:"},e)),!e.ipv6||"string"!=typeof e.ipv6)throw Error(`Invalid Endpoint: .ipv6 "${e.ipv6}" needs to be set: ${JSON.stringify(e)}`);this.ipv6=e.ipv6}}function ru(e){return t7.test(e)&&!t9.test(e)?`[${e}]`:e}class rh extends ro{constructor(e){if(super(Object.assign({protocol:"https:"},e),!0),!e.host&&(e.ipv4&&(e.host=e.ipv4),e.ipv6&&(e.host=`[${e.ipv6}]`)),!e.host||"string"!=typeof e.host)throw Error(`Invalid Endpoint: host "${e.path}" needs to be set: ${JSON.stringify(e)}`);if(this.host=e.host,this.path=e.path||"/dns-query",this.method=/^post$/i.test(e.method)?"POST":"GET",this.ipv4=e.ipv4,this.ipv6=e.ipv6,!this.ipv6){let e=t7.exec(this.host);e&&(this.ipv6=e[1])}!this.ipv4&&t9.test(this.host)&&(this.ipv4=this.host);let t=`${this.protocol}//${ru(this.host)}:${this.port}${this.path}`;try{this.url=new t4(t)}catch(e){throw Error(e.message+` [${t}]`)}}toString(){let e="https:"===this.protocol?"":"http://",t=this.port!==("https:"===this.protocol?443:80)?`:${this.port}`:"",r="GET"!==this.method?" [post]":"",n="/dns-query"===this.path?"":this.path,i=this.name?` [name=${this.name}]`:"",s=this.ipv4&&this.ipv4!==this.host?` [ipv4=${this.ipv4}]`:"",o=this.ipv6&&this.ipv6!==this.host?` [ipv6=${this.ipv6}]`:"";return`${e}${ru(this.host)}${t}${n}${r}${s}${o}${i}`}}function rd(e){let t;if("string"==typeof e)t=function(e){let t=re.exec(e),r=t[2]||"https:",n=t[3],i=t[5],s=t[6],o=t[7];if("https:"===r||"http:"===r){let e=rn(o,rt);return{name:e.name,protocol:r,ipv4:e.ipv4,ipv6:e.ipv6,host:n,port:i,path:s,method:e.post?"POST":"GET"}}if("udp:"===r||"udp4:"===r||"udp6:"===r){let t=rn(o,rr),s=/^\[(.*)\]$/.exec(n);if(s&&"udp4:"===r)throw Error(`Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=${e})`);if(!s&&"udp6:"===r)throw Error(`Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=${e})`);return s?new rc({protocol:"udp6:",ipv6:s[1],port:i,pk:t.pk,name:t.name}):new rl({protocol:"udp4:",ipv4:n,port:i,pk:t.pk,name:t.name})}throw new ri(r,e)}(e);else{if("object"!=typeof e||null===e||Array.isArray(e))throw Error(`Can not convert ${e} to an endpoint`);if(e instanceof ro)return e;t=e}(null===t.protocol||void 0===t.protocol)&&(t.protocol="https:");let r=t.protocol;if("udp4:"===r)return new rl(t);if("udp6:"===r)return new rc(t);if("https:"===r||"http:"===r)return new rh(t);throw new ri(r,JSON.stringify(t))}let rp="application/dns-message";function rf(){}async function rg(e,t,r,n){let i=t?t.localStoragePrefix+t.name:null;if(i)try{let e=JSON.parse(localStorage.getItem(i));if(e&&e.time>t.maxTime)return e}catch(e){}let{data:s}=await rm(e,"GET",null,r,n),o={time:Date.now(),data:JSON.parse(to(s))};if(i)try{localStorage.setItem(i,JSON.stringify(o))}catch(e){o.time=null}return o}function rm(e,t,r,n,i){return new Promise((s,o)=>{let a=new t4(e);"GET"===t&&r&&(a.search="?dns="+t2.decode(r));let l=a.toString(),c=new XMLHttpRequest;c.open(t,l,!0),c.setRequestHeader("Accept",rp),"POST"===t&&c.setRequestHeader("Content-Type",rp),c.responseType="arraybuffer",c.timeout=n,c.ontimeout=function(){u(new t8(n));try{c.abort()}catch(e){}},c.onreadystatechange=function(){if(c.readyState>1&&200!==c.status&&0!==c.status){u(new t6(l,c.status,t));try{c.abort()}catch(e){}}},c.onerror=function(){u(200===c.status?Error("Inexplicable XHR Error"):new t6(l,c.status,t))},c.onload=function(){if(200!==c.status)u(new t6(l,c.status,t));else{let e;if("string"==typeof c.response)e=ts(c.response);else if(c.response instanceof Uint8Array)e=c.response;else if(Array.isArray(c.response)||c.response instanceof ArrayBuffer)e=new Uint8Array(c.response);else throw Error("Unprocessable response "+c.response);u(null,e)}},"POST"===t?c.send(r):c.send(),i&&i.addEventListener("abort",h);let u=function(e,t){u=rf,i&&i.removeEventListener("abort",h),e?s({error:e,response:c}):s({data:t,response:c})};function h(){u(new t3);try{c.abort()}catch(e){}}})}function ry(e){let t=null===e.time||void 0===e.time?Date.now():e.time,r=e.data.map(e=>(e.endpoint=rd(Object.assign({name:e.name},e.endpoint)),e)).filter(e=>e.cors||e.endpoint.cors),n=r.map(e=>e.endpoint);return{data:{resolvers:r,resolverByName:r.reduce((e,t)=>(e[t.name]=t,e),{}),endpoints:n,endpointByName:n.reduce((e,t)=>(e[t.name]=t,e),{})},time:t}}let rb=ry({data:[{name:"adfree.usableprivacy.net",endpoint:{protocol:"https:",host:"adfree.usableprivacy.net"},description:"Public updns DoH service with advertising, tracker and malware filters.\nHosted in Europe by @usableprivacy, details see: https://docs.usableprivacy.com",country:"Germany",location:{lat:51.2993,long:9.491},filter:!0},{name:"adguard-dns-doh",endpoint:{protocol:"https:",host:"dns.adguard.com",ipv4:"94.140.15.15"},description:"Remove ads and protect your computer from malware (over DoH)",country:"France",location:{lat:48.8582,long:2.3387},filter:!0},{name:"adguard-dns-family-doh",endpoint:{protocol:"https:",host:"dns-family.adguard.com",ipv4:"94.140.15.16"},description:"Adguard DNS with safesearch and adult content blocking (over DoH)",country:"France",location:{lat:48.8582,long:2.3387},filter:!0},{name:"adguard-dns-unfiltered-doh",endpoint:{protocol:"https:",host:"dns-unfiltered.adguard.com",ipv4:"94.140.14.140"},description:"AdGuard public DNS servers without filters (over DoH)",country:"France",location:{lat:48.8582,long:2.3387}},{name:"ahadns-doh-chi",endpoint:{protocol:"https:",host:"doh.chi.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Chicago, USA. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=chi",country:"United States",location:{lat:41.8483,long:-87.6517},filter:!0,cors:!0},{name:"ahadns-doh-in",endpoint:{protocol:"https:",host:"doh.in.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Mumbai, India. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=in",country:"India",location:{lat:19.0748,long:72.8856},filter:!0,cors:!0},{name:"ahadns-doh-la",endpoint:{protocol:"https:",host:"doh.la.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Los Angeles, USA. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=la",country:"United States",location:{lat:34.0549,long:-118.2578},filter:!0,cors:!0},{name:"ahadns-doh-nl",endpoint:{protocol:"https:",host:"doh.nl.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Amsterdam, Netherlands. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=nl",country:"Netherlands",location:{lat:52.3824,long:4.8995},filter:!0,cors:!0},{name:"ahadns-doh-ny",endpoint:{protocol:"https:",host:"doh.ny.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in New York. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=ny",country:"United States",location:{lat:40.7308,long:-73.9975},filter:!0,cors:!0},{name:"ahadns-doh-pl",endpoint:{protocol:"https:",host:"doh.pl.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Poland. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=pl",country:"Netherlands",location:{lat:52.3824,long:4.8995},filter:!0,cors:!0},{name:"alidns-doh",endpoint:{protocol:"https:",host:"dns.alidns.com",ipv4:"223.5.5.5",cors:!0},description:"A public DNS resolver that supports DoH/DoT in mainland China, provided by Alibaba-Cloud.\nWarning: GFW filtering rules are applied by that resolver.\nHomepage: https://alidns.com/",country:"China",location:{lat:34.7725,long:113.7266},filter:!0,log:!0,cors:!0},{name:"ams-ads-doh-nl",endpoint:{protocol:"https:",host:"dnsnl-noads.alekberg.net"},description:"Resolver in Amsterdam. DoH protocol. Non-logging. Blocks ads, malware and trackers. DNSSEC enabled.",country:"Romania",location:{lat:45.9968,long:24.997},filter:!0},{name:"ams-doh-nl",endpoint:{protocol:"https:",host:"dnsnl.alekberg.net"},description:"Resolver in Amsterdam. DoH protocol. Non-logging, non-filtering, DNSSEC.",country:"Romania",location:{lat:45.9968,long:24.997}},{name:"att",endpoint:{protocol:"https:",host:"dohtrial.att.net"},description:"AT&T test DoH server.",log:!0},{name:"bcn-ads-doh",endpoint:{protocol:"https:",host:"dnses-noads.alekberg.net"},description:"Resolver in Spain. DoH protocol. Non-logging, remove ads and malware, DNSSEC.",country:"Spain",location:{lat:41.3891,long:2.1611},filter:!0},{name:"bcn-doh",endpoint:{protocol:"https:",host:"dnses.alekberg.net"},description:"Resolver in Spain. DoH protocol. Non-logging, non-filtering, DNSSEC.",country:"Spain",location:{lat:41.3891,long:2.1611}},{name:"brahma-world",endpoint:{protocol:"https:",host:"dns.brahma.world"},description:"DNS-over-HTTPS server. Non Logging, filters ads, trackers and malware. DNSSEC ready, QNAME Minimization, No EDNS Client-Subnet.\nHosted in Stockholm, Sweden. (https://dns.brahma.world)",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"cisco-doh",endpoint:{protocol:"https:",host:"doh.opendns.com",ipv4:"146.112.41.2"},description:"Remove your DNS blind spot (DoH protocol)\nWarning: modifies your queries to include a copy of your network\naddress when forwarding them to a selection of companies and organizations.",country:"United States",location:{lat:37.751,long:-97.822},filter:!0,log:!0},{name:"cloudflare",endpoint:{protocol:"https:",host:"dns.cloudflare.com",ipv4:"1.0.0.1",cors:!0},description:"Cloudflare DNS (anycast) - aka 1.1.1.1 / 1.0.0.1",country:"Australia",location:{lat:-33.494,long:143.2104},cors:!0},{name:"cloudflare-family",endpoint:{protocol:"https:",host:"family.cloudflare-dns.com",ipv4:"1.0.0.3",cors:!0},description:"Cloudflare DNS (anycast) with malware protection and parental control - aka 1.1.1.3 / 1.0.0.3",country:"Australia",location:{lat:-33.494,long:143.2104},filter:!0,cors:!0},{name:"cloudflare-ipv6",endpoint:{protocol:"https:",host:"1dot1dot1dot1.cloudflare-dns.com",cors:!0},description:"Cloudflare DNS over IPv6 (anycast)",country:"United States",location:{lat:37.751,long:-97.822},cors:!0},{name:"cloudflare-security",endpoint:{protocol:"https:",host:"security.cloudflare-dns.com",ipv4:"1.0.0.2",cors:!0},description:"Cloudflare DNS (anycast) with malware blocking - aka 1.1.1.2 / 1.0.0.2",country:"Australia",location:{lat:-33.494,long:143.2104},filter:!0,cors:!0},{name:"controld-block-malware",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/p1"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis DNS blocks Malware domains.",country:"Canada",location:{lat:43.6319,long:-79.3716},filter:!0},{name:"controld-block-malware-ad",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/p2"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis DNS blocks Malware, Ads & Tracking domains.",country:"Canada",location:{lat:43.6319,long:-79.3716},filter:!0},{name:"controld-block-malware-ad-social",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/p3"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis DNS blocks Malware, Ads & Tracking and Social Networks domains.",country:"Canada",location:{lat:43.6319,long:-79.3716},filter:!0},{name:"controld-family-friendly",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/family"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis DNS blocks Malware, Ads & Tracking, Adult Content and Drugs domains.",country:"Canada",location:{lat:43.6319,long:-79.3716},filter:!0},{name:"controld-uncensored",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/uncensored"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis DNS unblocks censored domains from various countries.",country:"Canada",location:{lat:43.6319,long:-79.3716}},{name:"controld-unfiltered",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/p0"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis is a Unfiltered DNS, no DNS record blocking or manipulation here, if you want to block Malware, Ads & Tracking or Social Network domains, use the other ControlD DNS configs.",country:"Canada",location:{lat:43.6319,long:-79.3716}},{name:"dns.digitale-gesellschaft.ch",endpoint:{protocol:"https:",host:"dns.digitale-gesellschaft.ch"},description:"Public DoH resolver operated by the Digital Society (https://www.digitale-gesellschaft.ch).\nHosted in Zurich, Switzerland.\nNon-logging, non-filtering, supports DNSSEC.",country:"Switzerland",location:{lat:47.1449,long:8.1551}},{name:"dns.ryan-palmer",endpoint:{protocol:"https:",host:"dns1.ryan-palmer.com"},description:"Non-logging, non-filtering, DNSSEC DoH Server. Hosted in the UK.",country:"United Kingdom",location:{lat:51.5164,long:-.093}},{name:"dns.sb",endpoint:{protocol:"https:",host:"doh.sb",ipv4:"185.222.222.222",cors:!0},description:"DNSSEC-enabled DoH server by https://xtom.com/\nhttps://dns.sb/doh/",country:"Unknown",location:{lat:47,long:8},cors:!0},{name:"dns.therifleman.name",endpoint:{protocol:"https:",host:"dns.therifleman.name"},description:"DNS-over-HTTPS DNS forwarder from Mumbai, India. Blocks web and Android trackers and ads.\nIP addresses are not logged, but queries are logged for 24 hours for debugging.\nReport issues, send suggestions @ joker349 at protonmail.com.\nAlso supports DoT (for android) @ dns.therifleman.name and plain DNS @ 172.104.206.174",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"dnsforfamily-doh",endpoint:{protocol:"https:",host:"dns-doh.dnsforfamily.com"},description:"(DoH Protocol) (Now supports DNSSEC). Block adult websites, gambling websites, malwares and advertisements.\nIt also enforces safe search in: Google, YouTube, Bing, DuckDuckGo and Yandex.\nSocial websites like Facebook and Instagram are not blocked. No DNS queries are logged.\nAs of 26-May-2022 5.9 million websites are blocked and new websites are added to blacklist daily.\nCompletely free, no ads or any commercial motive. Operating for 4 years now.\nProvided by: https://dnsforfamily.com",country:"Finland",location:{lat:60.1758,long:24.9349},filter:!0},{name:"dnsforfamily-doh-no-safe-search",endpoint:{protocol:"https:",host:"dns-doh-no-safe-search.dnsforfamily.com"},description:"(DoH Protocol) (Now supports DNSSEC) Block adult websites, gambling websites, malwares and advertisements.\nUnlike other dnsforfamily servers, this one does not enforces safe search. So Google, YouTube, Bing, DuckDuckGo and Yandex are completely accessible without any restriction.\nSocial websites like Facebook and Instagram are not blocked. No DNS queries are logged.\nAs of 26-May-2022 5.9 million websites are blocked and new websites are added to blacklist daily.\nCompletely free, no ads or any commercial motive. Operating for 4 years now.\nWarning: This server is incompatible with anonymization.\nProvided by: https://dnsforfamily.com",country:"Finland",location:{lat:60.1758,long:24.9349},filter:!0},{name:"dnsforge.de",endpoint:{protocol:"https:",host:"dnsforge.de",cors:!0},description:"Public DoH resolver running with Pihole for Adblocking (https://dnsforge.de).\nNon-logging, AD-filtering, supports DNSSEC. Hosted in Germany.",country:"Germany",location:{lat:52.2998,long:9.447},filter:!0,cors:!0},{name:"dnshome-doh",endpoint:{protocol:"https:",host:"dns.dnshome.de"},description:"https://www.dnshome.de/ public resolver in Germany"},{name:"dnspod-doh",endpoint:{protocol:"https:",host:"doh.pub",cors:!0},description:"A public DNS resolver in mainland China provided by DNSPod (Tencent Cloud).\nhttps://www.dnspod.cn/Products/Public.DNS?lang=en",filter:!0,log:!0,cors:!0},{name:"dnswarden-asia-adblock-dohv4",endpoint:{protocol:"https:",host:"doh.asia.dnswarden.com",path:"/adblock"},description:"Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).",country:"Singapore",location:{lat:1.2929,long:103.8547},filter:!0},{name:"dnswarden-asia-adultfilter-dohv4",endpoint:{protocol:"https:",host:"doh.asia.dnswarden.com",path:"/adultfilter"},description:"Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).",country:"Singapore",location:{lat:1.2929,long:103.8547},filter:!0},{name:"dnswarden-asia-uncensor-dohv4",endpoint:{protocol:"https:",host:"doh.asia.dnswarden.com",path:"/uncensored"},description:"Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).",country:"Singapore",location:{lat:1.2929,long:103.8547}},{name:"dnswarden-eu-adblock-dohv4",endpoint:{protocol:"https:",host:"doh.eu.dnswarden.com"},description:"Hosted in Germany. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).",country:"Germany",location:{lat:50.1103,long:8.7147},filter:!0},{name:"dnswarden-us-adblock-dohv4",endpoint:{protocol:"https:",host:"doh.us.dnswarden.com"},description:"Hosted in USA (Dallas) . For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).",country:"United States",location:{lat:32.7889,long:-96.8021},filter:!0},{name:"doh-ch-blahdns",endpoint:{protocol:"https:",host:"doh-ch.blahdns.com",cors:!0},description:"Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Switzerland. By https://blahdns.com/",country:"Netherlands",location:{lat:52.3824,long:4.8995},filter:!0,cors:!0},{name:"doh-cleanbrowsing-adult",endpoint:{protocol:"https:",host:"doh.cleanbrowsing.org",path:"/doh/adult-filter/",cors:!0},description:"Blocks access to all adult, pornographic and explicit sites. It does\nnot block proxy or VPNs, nor mixed-content sites. Sites like Reddit\nare allowed. Google and Bing are set to the Safe Mode.\nBy https://cleanbrowsing.org/",filter:!0,cors:!0},{name:"doh-cleanbrowsing-family",endpoint:{protocol:"https:",host:"doh.cleanbrowsing.org",path:"/doh/family-filter/",cors:!0},description:"Blocks access to all adult, pornographic and explicit sites. It also\nblocks proxy and VPN domains that are used to bypass the filters.\nMixed content sites (like Reddit) are also blocked. Google, Bing and\nYoutube are set to the Safe Mode.\nBy https://cleanbrowsing.org/",filter:!0,cors:!0},{name:"doh-cleanbrowsing-security",endpoint:{protocol:"https:",host:"doh.cleanbrowsing.org",path:"/doh/security-filter/",cors:!0},description:"Block access to phishing, malware and malicious domains. It does not block adult content.\nBy https://cleanbrowsing.org/",filter:!0,cors:!0},{name:"doh-crypto-sx",endpoint:{protocol:"https:",host:"doh.crypto.sx",cors:!0},description:"DNS-over-HTTPS server. Anycast, no logs, no censorship, DNSSEC.\nBackend hosted by Scaleway, globally cached via Cloudflare.\nMaintained by Frank Denis.",country:"United States",location:{lat:37.751,long:-97.822},cors:!0},{name:"doh-crypto-sx-ipv6",endpoint:{protocol:"https:",host:"doh-ipv6.crypto.sx",cors:!0},description:"DNS-over-HTTPS server accessible over IPv6. Anycast, no logs, no censorship, DNSSEC.\nBackend hosted by Scaleway, globally cached via Cloudflare.\nMaintained by Frank Denis.",country:"United States",location:{lat:37.751,long:-97.822},cors:!0},{name:"doh-de-blahdns",endpoint:{protocol:"https:",host:"doh-de.blahdns.com",cors:!0},description:"Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Germany. By https://blahdns.com/",country:"Germany",location:{lat:51.2993,long:9.491},filter:!0,cors:!0},{name:"doh-fi-blahdns",endpoint:{protocol:"https:",host:"doh-fi.blahdns.com",cors:!0},description:"Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Finland. By https://blahdns.com/",country:"Finland",location:{lat:60.1758,long:24.9349},filter:!0,cors:!0},{name:"doh-ibksturm",endpoint:{protocol:"https:",host:"ibksturm.synology.me"},description:"DoH & DoT Server, No Logging, No Filters, DNSSEC\nRunning privately by ibksturm in Thurgau, Switzerland"},{name:"doh-jp-blahdns",endpoint:{protocol:"https:",host:"doh-jp.blahdns.com",cors:!0},description:"Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Japan. By https://blahdns.com/",country:"Japan",location:{lat:35.6882,long:139.7532},filter:!0,cors:!0},{name:"doh.ffmuc.net",endpoint:{protocol:"https:",host:"doh.ffmuc.net"},description:"An open (non-logging, non-filtering, non-censoring) DoH resolver operated by Freifunk Munich with nodes in DE.\nhttps://ffmuc.net/",country:"Germany",location:{lat:51.2993,long:9.491}},{name:"doh.tiarap.org",endpoint:{protocol:"https:",host:"doh.tiarap.org"},description:"Non-Logging DNS-over-HTTPS server, cached via Cloudflare.\nFilters out ads, trackers and malware, NO ECS, supports DNSSEC.",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"google",endpoint:{protocol:"https:",host:"dns.google",ipv4:"8.8.8.8",cors:!0},description:"Google DNS (anycast)",country:"United States",location:{lat:37.751,long:-97.822},log:!0,cors:!0},{name:"hdns",endpoint:{protocol:"https:",host:"query.hdns.io",cors:!0},description:"HDNS is a public DNS resolver that supports Handshake domains.\nhttps://www.hdns.io",country:"United States",location:{lat:37.7771,long:-122.406},cors:!0},{name:"he",endpoint:{protocol:"https:",host:"ordns.he.net"},description:"Hurricane Electric DoH server (anycast)\nUnknown logging policy.",country:"United States",location:{lat:37.751,long:-97.822},log:!0},{name:"id-gmail-doh",endpoint:{protocol:"https:",host:"doh.tiar.app"},description:"Non-Logging DNS-over-HTTPS server located in Singapore.\nFilters out ads, trackers and malware, supports DNSSEC, provided by id-gmail.",country:"Singapore",location:{lat:1.2929,long:103.8547},filter:!0},{name:"iij",endpoint:{protocol:"https:",host:"public.dns.iij.jp"},description:"DoH server operated by Internet Initiative Japan in Tokyo.\nhttps://www.iij.ad.jp/",country:"Japan",location:{lat:35.69,long:139.69},log:!0},{name:"iqdns-doh",endpoint:{protocol:"https:",host:"a.passcloud.xyz"},description:'Non-logging DoH service runned by V2EX.com user johnsonwil.\nReturns "no such domain" for anti-Chinese government websites. Supports DNSSEC.\nFor more information: https://www.v2ex.com/t/785666',filter:!0},{name:"jp.tiar.app-doh",endpoint:{protocol:"https:",host:"jp.tiar.app"},description:"Non-Logging, Non-Filtering DNS-over-HTTPS server in Japan.\nNo ECS, Support DNSSEC",country:"Japan",location:{lat:35.6882,long:139.7532}},{name:"jp.tiarap.org",endpoint:{protocol:"https:",host:"jp.tiarap.org"},description:"DNS-over-HTTPS Server. Non-Logging, Non-Filtering, No ECS, Support DNSSEC.\nCached via Cloudflare."},{name:"libredns",endpoint:{protocol:"https:",host:"doh.libredns.gr"},description:"DoH server in Germany. No logging, but no DNS padding and no DNSSEC support.\nhttps://libredns.gr/",country:"Germany",location:{lat:51.2993,long:9.491}},{name:"nextdns",endpoint:{protocol:"https:",host:"anycsast.dns.nextdns.io"},description:"NextDNS is a cloud-based private DNS service that gives you full control\nover what is allowed and what is blocked on the Internet.\nDNSSEC, Anycast, Non-logging, NoFilters\nhttps://www.nextdns.io/",country:"Netherlands",location:{lat:52.3891,long:4.6563}},{name:"nextdns-ultralow",endpoint:{protocol:"https:",host:"dns.nextdns.io",path:"/dnscrypt-proxy"},description:'NextDNS is a cloud-based private DNS service that gives you full control\nover what is allowed and what is blocked on the Internet.\nhttps://www.nextdns.io/\nTo select the server location, the "-ultralow" variant relies on bootstrap servers\ninstead of anycast.'},{name:"njalla-doh",endpoint:{protocol:"https:",host:"dns.njal.la",cors:!0},description:"Non-logging DoH server in Sweden operated by Njalla.\nhttps://dns.njal.la/",country:"Sweden",location:{lat:59.3247,long:18.056},cors:!0},{name:"odoh-cloudflare",endpoint:{protocol:"https:",host:"odoh.cloudflare-dns.com",cors:!0},description:"Cloudflare ODoH server.\nhttps://cloudflare.com",cors:!0},{name:"odoh-crypto-sx",endpoint:{protocol:"https:",host:"odoh.crypto.sx",cors:!0},description:"ODoH target server. Anycast, no logs.\nBackend hosted by Scaleway. Maintained by Frank Denis.",cors:!0},{name:"odoh-id-gmail",endpoint:{protocol:"https:",host:"doh.tiar.app",path:"/odoh"},description:"ODoH target server. Based in Singapore, no logs.\nFilter ads, trackers and malware.",filter:!0},{name:"odoh-jp.tiar.app",endpoint:{protocol:"https:",host:"jp.tiar.app",path:"/odoh"},description:"ODoH target server. no logs."},{name:"odoh-jp.tiarap.org",endpoint:{protocol:"https:",host:"jp.tiarap.org",path:"/odoh"},description:"ODoH target server via Cloudflare, no logs."},{name:"odoh-resolver4.dns.openinternet.io",endpoint:{protocol:"https:",host:"resolver4.dns.openinternet.io"},description:"ODoH target server. no logs, no filter, DNSSEC.\nRunning on dedicated hardware colocated at Sonic.net in Santa Rosa, CA in the United States.\nUses Sonic's recusrive DNS servers as upstream resolvers (but is not affiliated with Sonic\nin any way). Provided by https://openinternet.io"},{name:"odoh-tiarap.org",endpoint:{protocol:"https:",host:"doh.tiarap.org",path:"/odoh"},description:"ODoH target server via Cloudflare, no logs.\nFilter ads, trackers and malware.",filter:!0},{name:"publicarray-au2-doh",endpoint:{protocol:"https:",host:"doh-2.seby.io",cors:!0},description:"DNSSEC • OpenNIC • Non-logging • Uncensored - hosted on ovh.com.au\nMaintained by publicarray - https://dns.seby.io",country:"Australia",location:{lat:-33.8591,long:151.2002},cors:!0},{name:"puredns-doh",endpoint:{protocol:"https:",host:"puredns.org",ipv4:"146.190.6.13",cors:!0},description:"Public uncensored DNS resolver in Singapore - https://puredns.org\n** Only available in Indonesia and Singapore **",country:"United States",location:{lat:37.751,long:-97.822},cors:!0},{name:"quad101",endpoint:{protocol:"https:",host:"dns.twnic.tw",cors:!0},description:"DNSSEC-aware public resolver by the Taiwan Network Information Center (TWNIC)\nhttps://101.101.101.101/index_en.html",cors:!0},{name:"quad9-doh-ip4-port443-filter-ecs-pri",endpoint:{protocol:"https:",host:"dns11.quad9.net",ipv4:"149.112.112.11"},description:"Quad9 (anycast) dnssec/no-log/filter/ecs 9.9.9.11 - 149.112.112.11",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"quad9-doh-ip4-port443-filter-pri",endpoint:{protocol:"https:",host:"dns.quad9.net",ipv4:"149.112.112.112"},description:"Quad9 (anycast) dnssec/no-log/filter 9.9.9.9 - 149.112.112.9 - 149.112.112.112",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"quad9-doh-ip4-port443-nofilter-ecs-pri",endpoint:{protocol:"https:",host:"dns12.quad9.net",ipv4:"9.9.9.12"},description:"Quad9 (anycast) no-dnssec/no-log/no-filter/ecs 9.9.9.12 - 149.112.112.12",country:"United States",location:{lat:37.751,long:-97.822}},{name:"quad9-doh-ip4-port443-nofilter-pri",endpoint:{protocol:"https:",host:"dns10.quad9.net",ipv4:"149.112.112.10"},description:"Quad9 (anycast) no-dnssec/no-log/no-filter 9.9.9.10 - 149.112.112.10",country:"United States",location:{lat:37.751,long:-97.822}},{name:"quad9-doh-ip6-port5053-filter-pri",endpoint:{protocol:"https:",host:"dns9.quad9.net"},description:"Quad9 (anycast) dnssec/no-log/filter 2620:fe::fe - 2620:fe::9 - 2620:fe::fe:9",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"safesurfer-doh",endpoint:{protocol:"https:",host:"doh.safesurfer.io"},description:"Family safety focused blocklist for over 2 million adult sites, as well as phishing and malware and more.\nFree to use, paid for customizing blocking for more categories+sites and viewing usage at my.safesurfer.io. Logs taken for viewing\nusage, data never sold - https://safesurfer.io",filter:!0,log:!0},{name:"sth-ads-doh-se",endpoint:{protocol:"https:",host:"dnsse-noads.alekberg.net"},description:"Resolver in Stockholm, Sweden. DoH server. Non-logging, remove ads and malware, DNSSEC.",country:"Bulgaria",location:{lat:42.696,long:23.332},filter:!0},{name:"sth-doh-se",endpoint:{protocol:"https:",host:"dnsse.alekberg.net"},description:"Resolver in Stockholm, Sweden. DoH server. Non-logging, non-filtering, DNSSEC.",country:"Bulgaria",location:{lat:42.696,long:23.332}},{name:"switch",endpoint:{protocol:"https:",host:"dns.switch.ch"},description:"Public DoH service provided by SWITCH in Switzerland\nhttps://www.switch.ch\nProvides protection against malware, but does not block ads.",filter:!0},{name:"uncensoreddns-dk-ipv4",endpoint:{protocol:"https:",host:"unicast.uncensoreddns.org"},description:"Also known as censurfridns.\nDoH, no logs, no filter, DNSSEC, unicast hosted in Denmark - https://blog.uncensoreddns.org",country:"Denmark",location:{lat:55.7123,long:12.0564}},{name:"uncensoreddns-ipv4",endpoint:{protocol:"https:",host:"anycast.uncensoreddns.org"},description:"Also known as censurfridns.\nDoH, no logs, no filter, DNSSEC, anycast - https://blog.uncensoreddns.org",country:"Denmark",location:{lat:55.7123,long:12.0564}},{name:"v.dnscrypt.uk-doh-ipv4",endpoint:{protocol:"https:",host:"v.dnscrypt.uk"},description:"DoH, no logs, uncensored, DNSSEC. Hosted in London UK on Digital Ocean\nhttps://www.dnscrypt.uk",country:"United Kingdom",location:{lat:51.4964,long:-.1224}}],time:1654187067783}),rv=new t4("https://martinheidegger.github.io/dns-query/resolvers.json");function rw(e){return/^@/.test(e)}class rE{constructor(e){this.opts=Object.assign({timeout:5e3,update:!0,updateURL:rv,persist:!1,localStoragePrefix:"dnsquery_",maxAge:3e5},e),this._dataP=null}_data(e,t){return e||null===this._dataP?(this._dataP=this.opts.update?rg(this.opts.updateURL,this.opts.persist?{name:"resolvers.json",localStoragePrefix:this.opts.localStoragePrefix,maxTime:Date.now()-this.opts.maxAge}:null,this.opts.timeout).then(e=>ry({data:e.data.resolvers,time:e.time})).catch(()=>t||rb):Promise.resolve(rb),this._dataP):this._dataP.then(e=>e.timee.data)}endpoints(e){if(null==e)return this.data().then(e=>e.endpoints);if("doh"===e&&(e=rA),"dns"===e&&(e=rI),"function"==typeof e)return this.data().then(t=>t.endpoints.filter(e));if("string"==typeof e||"function"!=typeof e[Symbol.iterator])return Promise.reject(Error(`Endpoints (${e}) needs to be iterable (array).`));if(-1===(e=Array.from(e).filter(Boolean)).findIndex(rw))try{return Promise.resolve(e.map(rd))}catch(e){return Promise.reject(e)}return this.data().then(t=>e.map(e=>{if(rw(e)){let r=t.endpointByName[e.substring(1)];if(!r)throw Error(`Endpoint ${e} is not known.`);return r}return rd(e)}))}}let rS=new rE;function rA(e){return"https:"===e.protocol||"http:"===e.protocol}function rI(e){return"udp4:"===e.protocol||"udp6:"===e.protocol}let r_=new g.Yd("dns-over-https");class rT{endpoints;retries;static async create(e,t){return new rT(e??await rS.endpoints("doh"),t)}constructor(e,t=3){this.endpoints=e,this.retries=t}async resolveTXT(e){let t;try{var r,n,i,s;t=(await (r={question:{type:"TXT",name:e}},n={endpoints:this.endpoints,retries:this.retries},(n=Object.assign({retries:5,timeout:3e4},n),r.question)?(null!==(s=i=n.endpoints)&&"object"==typeof s&&"function"==typeof s.then?i:Promise.resolve(i)).then(e=>{if(!Array.isArray(e)||0===e.length)throw Error("No endpoints defined to lookup dns records.");return function e(t,r,n){var i,s,o,a,l;let c=1===t.length?t[0]:t[Math.floor(Math.random()*t.length)%t.length];return(i=n.timeout,(s=n.signal)&&s.aborted?Promise.reject(new t3):"udp4:"===c.protocol||"udp6:"===c.protocol?function(){throw Error('Only "doh" endpoints are supported in the browser')}(c,r,i,s):(o=c.url,a=c.method,l=tY(Object.assign({flags:256},r)),rm(o,a,l,i,s)).then(function(e){let t=e.data,r=e.response,n=e.error;if(void 0===n){if(0===t.length)n=new t5("Empty.");else try{let e=tQ(t);return e.response=r,e}catch(e){n=new t5("Invalid packet (cause="+e.message+")",e)}}throw Object.assign(n,{response:r})})).then(e=>(e.endpoint=c.toString(),e),i=>{if("AbortError"===i.name||0===n.retries)throw i.endpoint=c.toString(),i;return n.retries>0&&(n.retries-=1),e(t,r,n)})}(e.map(rd),function(e){let t=Object.assign({type:"query"},e);return delete t.question,t.questions=[],e.question&&t.questions.push(e.question),t}(r),n)}).then(e=>(e.question=e.questions[0],delete e.questions,e)):Promise.reject(Error("To request data you need to specify a .question!")))).answers}catch(e){throw r_.error("query failed: ",e),Error("DNS query failed")}if(!t)throw Error(`Could not resolve ${e}`);let o=t.map(e=>e.data),a=[];return o.forEach(e=>{"string"==typeof e?a.push(e):Array.isArray(e)?e.forEach(e=>{"string"==typeof e?a.push(e):a.push((0,v.Md)(e))}):a.push((0,v.Md)(e))}),a}}var rC=r(37017);class rR{static RECORD_PREFIX=eD.RECORD_PREFIX;static TREE_PREFIX="enrtree:";static BRANCH_PREFIX="enrtree-branch:";static ROOT_PREFIX="enrtree-root:";static parseAndVerifyRoot(e,t){if(!e.startsWith(this.ROOT_PREFIX))throw Error(`ENRTree root entry must start with '${this.ROOT_PREFIX}'`);let r=rR.parseRootValues(e),n=rC.decode.asBytes(t),i=e.split(" sig")[0],s=(0,v.iY)(i);if(!em((0,e0.m)(r.signature,"base64url").slice(0,64),eg(s),new Uint8Array(n)))throw Error("Unable to verify ENRTree root signature");return r.eRoot}static parseRootValues(e){let t=e.match(/^enrtree-root:v1 e=([^ ]+) l=([^ ]+) seq=(\d+) sig=([^ ]+)$/);if(!Array.isArray(t))throw Error("Could not parse ENRTree root entry");t.shift();let[r,n,i,s]=t;if(!r)throw Error("Could not parse 'e' value from ENRTree root entry");if(!n)throw Error("Could not parse 'l' value from ENRTree root entry");if(!i)throw Error("Could not parse 'seq' value from ENRTree root entry");if(!s)throw Error("Could not parse 'sig' value from ENRTree root entry");return{eRoot:r,lRoot:n,seq:Number(i),signature:s}}static parseTree(e){if(!e.startsWith(this.TREE_PREFIX))throw Error(`ENRTree tree entry must start with '${this.TREE_PREFIX}'`);let t=e.match(/^enrtree:\/\/([^@]+)@(.+)$/);if(!Array.isArray(t))throw Error("Could not parse ENRTree tree entry");t.shift();let[r,n]=t;if(!r)throw Error("Could not parse public key from ENRTree tree entry");if(!n)throw Error("Could not parse domain from ENRTree tree entry");return{publicKey:r,domain:n}}static parseBranch(e){if(!e.startsWith(this.BRANCH_PREFIX))throw Error(`ENRTree branch entry must start with '${this.BRANCH_PREFIX}'`);return e.split(this.BRANCH_PREFIX)[1].split(",")}}let rk=new g.Yd("discovery:fetch_nodes");async function rP(e,t,r){let n={relay:e.relay??0,store:e.store??0,filter:e.filter??0,lightPush:e.lightPush??0},i=n.relay+n.store+n.filter+n.lightPush,s={relay:0,store:0,filter:0,lightPush:0},o=0,a=[];for(;!rB(n,s)&&o=e.relay&&t.store>=e.store&&t.filter>=e.filter&&t.lightPush>=e.lightPush}function rN(e,t){e.relay&&(t.relay+=1),e.store&&(t.store+=1),e.filter&&(t.filter+=1),e.lightPush&&(t.lightPush+=1)}function rL(e,t,r){if(rB(t,r))throw"Internal Error: Waku2 wanted capabilities are already fulfilled";let n={relay:r.relaythis._search(i,s));return rx.info("retrieved peers: ",o.map(e=>({id:e.peerId?.toString(),multiaddrs:e.multiaddrs?.map(e=>e.toString())}))),o}constructor(e){this._DNSTreeCache={},this.dns=e}async *getNextPeer(e,t){let r=Math.floor(Math.random()*e.length),{publicKey:n,domain:i}=rR.parseTree(e[r]),s={domain:i,publicKey:n,visits:{}};for await(let e of rD(t,this._errorTolerance,()=>this._search(i,s)))yield e}async _search(e,t){try{let r,n;let i=await this._getTXTRecord(e,t);t.visits[e]=!0;let s=i.startsWith(rR.ROOT_PREFIX)?rR.ROOT_PREFIX:i.startsWith(rR.BRANCH_PREFIX)?rR.BRANCH_PREFIX:i.startsWith(rR.RECORD_PREFIX)?rR.RECORD_PREFIX:"";try{switch(s){case rR.ROOT_PREFIX:return r=rR.parseAndVerifyRoot(i,t.publicKey),await this._search(r,t);case rR.BRANCH_PREFIX:return n=rR.parseBranch(i),r=function(e,t){let r;let n={};for(let[r,i]of e.entries())t.visits[i]&&(n[r]=!0);if(Object.keys(n).length===e.length)throw Error("Unresolvable circular path detected");do r=Math.floor(Math.random()*e.length);while(n[r]);return e[r]}(n,t),await this._search(r,t);case rR.RECORD_PREFIX:return e2.fromString(i);default:return null}}catch(t){return rx.error(`Failed to search DNS tree ${s} at subdomain ${e}: ${t}`),null}}catch(t){return rx.error(`Failed to retrieve TXT record at subdomain ${e}: ${t}`),null}}async _getTXTRecord(e,t){if(this._DNSTreeCache[e])return this._DNSTreeCache[e];let r=e!==t.domain?`${e}.${t.domain}`:t.domain,n=await this.dns.resolveTXT(r);if(!n.length)throw Error("Received empty result array while fetching TXT record");if(!n[0].length)throw Error("Received empty TXT record");let i=n.join("");return this._DNSTreeCache[e]=i,i}}let rM=new g.Yd("peer-discovery-dns");class rU extends p.L{nextPeer;_started;_components;_options;constructor(e,t){super(),this._started=!1,this._components=e,this._options=t;let{enrUrls:r}=t;rM.info("Use following EIP-1459 ENR Tree URLs: ",r)}async start(){if(rM.info("Starting peer discovery via dns"),this._started=!0,void 0===this.nextPeer){let{enrUrls:e}=this._options;Array.isArray(e)||(e=[e]);let{wantedNodeCapabilityCount:t}=this._options,r=await rO.dnsOverHttp();this.nextPeer=r.getNextPeer.bind(r,e,t)}for await(let e of this.nextPeer()){if(!this._started)return;let{peerInfo:t,shardInfo:r}=e;if(!t)continue;let n={[y]:{value:this._options.tagValue??50,ttl:this._options.tagTTL??1e8}},i=!1;await this._components.peerStore.has(t.id)?(await this._components.peerStore.get(t.id)).tags.has(y)||(i=!0,await this._components.peerStore.merge(t.id,{tags:n})):(i=!0,await this._components.peerStore.save(t.id,{tags:n,...r&&{metadata:{shardInfo:(0,g.kL)(r)}}})),i&&this.dispatchEvent(new p.A("peer",{detail:t}))}}stop(){this._started=!1}get[f.J](){return!0}get[Symbol.toStringTag](){return"@waku/bootstrap"}}function rF(e,t=b){return r=>new rU(r,{enrUrls:e,wantedNodeCapabilityCount:t})}var rK=r(97540),rV=r(75354),rH=r(83431),r$=r(21679),rq=r(37804),rz=r(54164),rj=r(35311);class rG{proto;constructor(e){this.proto=e}static createRequest(e){let{numPeers:t}=e;return new rG({query:{numPeers:t},response:void 0})}encode(){return rj._G.Zj.encode(this.proto)}static decode(e){return new rG(rj._G.Zj.decode(e))}get query(){return this.proto.query}get response(){return this.proto.response}}let rW="/vac/waku/peer-exchange/2.0.0-alpha1",rY=new g.Yd("peer-exchange");class rQ extends rK.p{constructor(e,t){super(rW,e,rY,t)}async query(e){let{numPeers:t}=e,r=rG.createRequest({numPeers:BigInt(t)}),n=await this.peerStore.get(e.peerId);if(!n)return{peerInfos:null,error:rV.K1.NO_PEER_AVAILABLE};let i=await this.getStream(n),s=await (0,rq.z)([r.encode()],r$.c,i,r$.J,async e=>await (0,rH.Z)(e));try{let e=new rz.H;s.forEach(t=>{e.append(t)});let{response:t}=rG.decode(e);if(!t)return rY.error("PeerExchangeRPC message did not contains a `response` field"),{peerInfos:null,error:rV.K1.EMPTY_PAYLOAD};return{peerInfos:await Promise.all(t.peerInfos.map(e=>e.enr).filter(g.$K).map(async e=>({ENR:await e2.fromRLP(e)}))),error:null}}catch(e){return rY.error("Failed to decode push reply",e),{peerInfos:null,error:rV.K1.DECODE_FAILED}}}}let rJ=new g.Yd("peer-exchange-discovery"),rX=rV.$G.PEER_EXCHANGE;class rZ extends p.L{components;peerExchange;options;isStarted;queryingPeers=new Set;queryAttempts=new Map;handleDiscoveredPeer=e=>{let{protocols:t,peerId:r}=e.detail;!t.includes(rW)||this.queryingPeers.has(r.toString())||(this.queryingPeers.add(r.toString()),this.startRecurringQueries(r).catch(e=>rJ.error(`Error querying peer ${e}`)))};constructor(e,t,r={}){super(),this.components=e,this.peerExchange=new rQ(e,t),this.options=r,this.isStarted=!1}start(){this.isStarted||(rJ.info("Starting peer exchange node discovery, discovering peers"),this.components.events.addEventListener("peer:identify",this.handleDiscoveredPeer))}stop(){this.isStarted&&(rJ.info("Stopping peer exchange node discovery"),this.isStarted=!1,this.queryingPeers.clear(),this.components.events.removeEventListener("peer:identify",this.handleDiscoveredPeer))}get[f.J](){return!0}get[Symbol.toStringTag](){return"@waku/peer-exchange"}startRecurringQueries=async e=>{let t=e.toString(),{queryInterval:r=1e4,maxRetries:n=3}=this.options;rJ.info(`Querying peer: ${t} (attempt ${this.queryAttempts.get(t)??1})`),await this.query(e);let i=this.queryAttempts.get(t)??1;if(i>n){this.abortQueriesForPeer(t);return}setTimeout(()=>{this.queryAttempts.set(t,i+1),this.startRecurringQueries(e).catch(e=>{rJ.error(`Error in startRecurringQueries: ${e}`)})},r*i)};async query(e){let{error:t,peerInfos:r}=await this.peerExchange.query({numPeers:10,peerId:e});if(t)return rJ.error("Peer exchange query failed",t),{error:t,peerInfos:null};for(let e of r){let{ENR:t}=e;if(!t){rJ.warn("No ENR in peerInfo object, skipping");continue}let{peerId:r,peerInfo:n,shardInfo:i}=t;!r||!n||await this.components.peerStore.has(r)||(await this.components.peerStore.save(r,{tags:{[rX]:{value:this.options.tagValue??50,ttl:this.options.tagTTL??1e8}},...i&&{metadata:{shardInfo:(0,g.kL)(i)}}}),rJ.info(`Discovered peer: ${r.toString()}`),this.dispatchEvent(new p.A("peer",{detail:{id:r,multiaddrs:n.multiaddrs}})))}return{error:null,peerInfos:r}}abortQueriesForPeer(e){rJ.info(`Aborting queries for peer: ${e}`),this.queryingPeers.delete(e),this.queryAttempts.delete(e)}}function r0(e){return t=>new rZ(t,e)}var r1=r(90678);let r2=new g.Yd("peer-exchange-discovery"),r3=rV.$G.LOCAL;class r4 extends p.L{components;options;isStarted;peers=[];constructor(e,t){super(),this.components=e,this.options=t,this.isStarted=!1,this.peers=this.getPeersFromLocalStorage()}get[Symbol.toStringTag](){return"@waku/local-peer-cache-discovery"}async start(){if(!this.isStarted){for(let{id:e,address:t}of(r2.info("Starting Local Storage Discovery"),this.components.events.addEventListener("peer:identify",this.handleNewPeers),this.peers)){let r=await (0,r1.pG)({id:e});await this.components.peerStore.has(r)||(await this.components.peerStore.save(r,{multiaddrs:[(0,eb.HM)(t)],tags:{[this.options?.tagName??r3]:{value:this.options?.tagValue??50,ttl:this.options?.tagTTL??1e8}}}),this.dispatchEvent(new p.A("peer",{detail:{id:r,multiaddrs:[(0,eb.HM)(t)]}})))}r2.info(`Discovered ${this.peers.length} peers`),this.isStarted=!0}}stop(){this.isStarted&&(r2.info("Stopping Local Storage Discovery"),this.components.events.removeEventListener("peer:identify",this.handleNewPeers),this.isStarted=!1,this.savePeersToLocalStorage())}handleNewPeers=e=>{let{peerId:t,listenAddrs:r}=e.detail,n=(0,g.Yl)(r),i=this.getPeersFromLocalStorage(),s=i.findIndex(e=>e.id===t.toString());s>=0?i[s].address=n.toString():i.push({id:t.toString(),address:n.toString()}),this.peers=i,this.savePeersToLocalStorage()};getPeersFromLocalStorage(){try{let e=localStorage.getItem("waku:peers");if(!e)return[];return JSON.parse(e).filter(r6)}catch(e){return r2.error("Error parsing peers from local storage:",e),[]}}savePeersToLocalStorage(){try{localStorage.setItem("waku:peers",JSON.stringify(this.peers))}catch(e){r2.error("Error saving peers to local storage:",e)}}}function r6(e){return e&&"object"==typeof e&&"string"==typeof e.id&&"string"==typeof e.address}function r5(){return(e,t)=>new r4(e,t)}},75354:function(e,t,r){"use strict";var n,i,s,o,a,l,c,u,h,d,p;r.d(t,{eZ:function(){return g},nf:function(){return f},wh:function(){return l},Wq:function(){return a},$Q:function(){return s},K1:function(){return i},Uw:function(){return n},$G:function(){return o}}),(c=n||(n={})).Relay="relay",c.Store="store",c.LightPush="lightpush",c.Filter="filter",(u=i||(i={})).GENERIC_FAIL="Generic error",u.ENCODE_FAILED="Failed to encode",u.DECODE_FAILED="Failed to decode",u.EMPTY_PAYLOAD="Payload is empty",u.SIZE_TOO_BIG="Size is too big",u.TOPIC_NOT_CONFIGURED="Topic not configured",u.NO_PEER_AVAILABLE="No peer available",u.REMOTE_PEER_FAULT="Remote peer fault",u.REMOTE_PEER_REJECTED="Remote peer rejected",u.REQUEST_TIMEOUT="Request timeout",(h=s||(s={})).BACKWARD="backward",h.FORWARD="forward",(d=o||(o={})).BOOTSTRAP="bootstrap",d.PEER_EXCHANGE="peer-exchange",d.LOCAL="local-peer-cache",(p=a||(a={})).PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",p.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",p.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",p.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange",(l||(l={})).CONNECTION_STATUS="waku:connection";let f="/waku/2/default-waku/proto",g=1},35311:function(e,t,r){"use strict";let n,i,s,o,a,l,c,u,h,d,p,f,g,m,y,b,v,w,E,S,A,I,_,T,C,R,k,P,D,B,N,L,x,O,M,U,F,K;r.d(t,{aF:function(){return eN},kB:function(){return e6},WS:function(){return e5},u:function(){return e4},fi:function(){return e7},_G:function(){return e9},eW:function(){return e8}});var V,H,$,q,z,j,G,W,Y,Q,J,X,Z,ee,et,er,en,ei,es,eo,ea,el,ec,eu,eh,ed,ep,ef,eg,em,ey,eb,ev,ew,eE,eS,eA,eI,e_,eT,eC,eR,ek,eP,eD,eB,eN,eL,ex,eO,eM,eU,eF,eK,eV,eH,e$,eq,ez,ej,eG,eW,eY,eQ,eJ,eX,eZ,e0,e1,e2,e3,e4={};r.r(e4),r.d(e4,{H:function(){return eC}});var e6={};r.r(e6),r.d(e6,{ep:function(){return eL},hO:function(){return ex},$p:function(){return eO}});var e5={};r.r(e5),r.d(e5,{xx:function(){return eV}});var e8={};r.r(e8),r.d(e8,{TA:function(){return eW},e9:function(){return eY},BI:function(){return ez}});var e9={};r.r(e9),r.d(e9,{Zj:function(){return e1}});var e7={};r.r(e7),r.d(e7,{v:function(){return e2},_:function(){return e3}});var te=r(47971),tt=r(1514);(V=eT||(eT={})).codec=()=>(null==n&&(n=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={proof:(0,tt.u)(0),merkleRoot:(0,tt.u)(0),epoch:(0,tt.u)(0),shareX:(0,tt.u)(0),shareY:(0,tt.u)(0),nullifier:(0,tt.u)(0),rlnIdentifier:(0,tt.u)(0)},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.proof=e.bytes();break;case 2:n.merkleRoot=e.bytes();break;case 3:n.epoch=e.bytes();break;case 4:n.shareX=e.bytes();break;case 5:n.shareY=e.bytes();break;case 6:n.nullifier=e.bytes();break;case 7:n.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return n})),n),V.encode=e=>(0,te.LE)(e,V.codec()),V.decode=(e,t)=>(0,te.C6)(e,V.codec(),t),(H=eC||(eC={})).codec=()=>(null==i&&(i=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),eT.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={payload:(0,tt.u)(0),contentTopic:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.payload=e.bytes();break;case 2:n.contentTopic=e.string();break;case 3:n.version=e.uint32();break;case 10:n.timestamp=e.sint64();break;case 11:n.meta=e.bytes();break;case 21:n.rateLimitProof=eT.codec().decode(e,e.uint32(),{limits:r.limits?.rateLimitProof});break;case 31:n.ephemeral=e.bool();break;default:e.skipType(7&t)}}return n})),i),H.encode=e=>(0,te.LE)(e,H.codec()),H.decode=(e,t)=>(0,te.C6)(e,H.codec(),t),(q=($=eR||(eR={})).ContentFilter||($.ContentFilter={})).codec=()=>(null==o&&(o=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(10),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={contentTopic:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3==1?n.contentTopic=e.string():e.skipType(7&t)}return n})),o),q.encode=e=>(0,te.LE)(e,q.codec()),q.decode=(e,t)=>(0,te.C6)(e,q.codec(),t),$.codec=()=>(null==s&&(s=(0,te.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.subscribe&&!1!==e.subscribe&&(t.uint32(8),t.bool(e.subscribe)),null!=e.topic&&""!==e.topic&&(t.uint32(18),t.string(e.topic)),null!=e.contentFilters)for(let r of e.contentFilters)t.uint32(26),$.ContentFilter.codec().encode(r,t);!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={subscribe:!1,topic:"",contentFilters:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.subscribe=e.bool();break;case 2:n.topic=e.string();break;case 3:if(r.limits?.contentFilters!=null&&n.contentFilters.length===r.limits.contentFilters)throw new te.sv('decode error - map field "contentFilters" had too many elements',"ERR_MAX_LENGTH");n.contentFilters.push($.ContentFilter.codec().decode(e,e.uint32(),{limits:r.limits?.contentFilters$}));break;default:e.skipType(7&t)}}return n})),s),$.encode=e=>(0,te.LE)(e,$.codec()),$.decode=(e,t)=>(0,te.C6)(e,$.codec(),t),(z=ek||(ek={})).codec=()=>(null==a&&(a=(0,te.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.messages)for(let r of e.messages)t.uint32(10),eB.codec().encode(r,t);!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={messages:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3==1){if(r.limits?.messages!=null&&n.messages.length===r.limits.messages)throw new te.sv('decode error - map field "messages" had too many elements',"ERR_MAX_LENGTH");n.messages.push(eB.codec().decode(e,e.uint32(),{limits:r.limits?.messages$}))}else e.skipType(7&t)}return n})),a),z.encode=e=>(0,te.LE)(e,z.codec()),z.decode=(e,t)=>(0,te.C6)(e,z.codec(),t),(j=eP||(eP={})).codec=()=>(null==l&&(l=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.request&&(t.uint32(18),eR.codec().encode(e.request,t)),null!=e.push&&(t.uint32(26),ek.codec().encode(e.push,t)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={requestId:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.requestId=e.string();break;case 2:n.request=eR.codec().decode(e,e.uint32(),{limits:r.limits?.request});break;case 3:n.push=ek.codec().decode(e,e.uint32(),{limits:r.limits?.push});break;default:e.skipType(7&t)}}return n})),l),j.encode=e=>(0,te.LE)(e,j.codec()),j.decode=(e,t)=>(0,te.C6)(e,j.codec(),t),(G=eD||(eD={})).codec=()=>(null==c&&(c=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={proof:(0,tt.u)(0),merkleRoot:(0,tt.u)(0),epoch:(0,tt.u)(0),shareX:(0,tt.u)(0),shareY:(0,tt.u)(0),nullifier:(0,tt.u)(0),rlnIdentifier:(0,tt.u)(0)},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.proof=e.bytes();break;case 2:n.merkleRoot=e.bytes();break;case 3:n.epoch=e.bytes();break;case 4:n.shareX=e.bytes();break;case 5:n.shareY=e.bytes();break;case 6:n.nullifier=e.bytes();break;case 7:n.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return n})),c),G.encode=e=>(0,te.LE)(e,G.codec()),G.decode=(e,t)=>(0,te.C6)(e,G.codec(),t),(W=eB||(eB={})).codec=()=>(null==u&&(u=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),eD.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={payload:(0,tt.u)(0),contentTopic:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.payload=e.bytes();break;case 2:n.contentTopic=e.string();break;case 3:n.version=e.uint32();break;case 10:n.timestamp=e.sint64();break;case 11:n.meta=e.bytes();break;case 21:n.rateLimitProof=eD.codec().decode(e,e.uint32(),{limits:r.limits?.rateLimitProof});break;case 31:n.ephemeral=e.bool();break;default:e.skipType(7&t)}}return n})),u),W.encode=e=>(0,te.LE)(e,W.codec()),W.decode=(e,t)=>(0,te.C6)(e,W.codec(),t),(Y=eN||(eN={})).codec=()=>(null==h&&(h=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={contentTopic:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3==2?n.contentTopic=e.string():e.skipType(7&t)}return n})),h),Y.encode=e=>(0,te.LE)(e,Y.codec()),Y.decode=(e,t)=>(0,te.C6)(e,Y.codec(),t),(J=d=(Q=eL||(eL={})).FilterSubscribeType||(Q.FilterSubscribeType={})).SUBSCRIBER_PING="SUBSCRIBER_PING",J.SUBSCRIBE="SUBSCRIBE",J.UNSUBSCRIBE="UNSUBSCRIBE",J.UNSUBSCRIBE_ALL="UNSUBSCRIBE_ALL",(X=p||(p={}))[X.SUBSCRIBER_PING=0]="SUBSCRIBER_PING",X[X.SUBSCRIBE=1]="SUBSCRIBE",X[X.UNSUBSCRIBE=2]="UNSUBSCRIBE",X[X.UNSUBSCRIBE_ALL=3]="UNSUBSCRIBE_ALL",(d=Q.FilterSubscribeType||(Q.FilterSubscribeType={})).codec=()=>(0,te.Ji)(p),Q.codec=()=>(null==f&&(f=(0,te.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.filterSubscribeType&&0!==p[e.filterSubscribeType]&&(t.uint32(16),Q.FilterSubscribeType.codec().encode(e.filterSubscribeType,t)),null!=e.pubsubTopic&&(t.uint32(82),t.string(e.pubsubTopic)),null!=e.contentTopics)for(let r of e.contentTopics)t.uint32(90),t.string(r);!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={requestId:"",filterSubscribeType:d.SUBSCRIBER_PING,contentTopics:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.requestId=e.string();break;case 2:n.filterSubscribeType=Q.FilterSubscribeType.codec().decode(e);break;case 10:n.pubsubTopic=e.string();break;case 11:if(r.limits?.contentTopics!=null&&n.contentTopics.length===r.limits.contentTopics)throw new te.sv('decode error - map field "contentTopics" had too many elements',"ERR_MAX_LENGTH");n.contentTopics.push(e.string());break;default:e.skipType(7&t)}}return n})),f),Q.encode=e=>(0,te.LE)(e,Q.codec()),Q.decode=(e,t)=>(0,te.C6)(e,Q.codec(),t),(Z=ex||(ex={})).codec=()=>(null==g&&(g=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.statusCode&&0!==e.statusCode&&(t.uint32(80),t.uint32(e.statusCode)),null!=e.statusDesc&&(t.uint32(90),t.string(e.statusDesc)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={requestId:"",statusCode:0},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.requestId=e.string();break;case 10:n.statusCode=e.uint32();break;case 11:n.statusDesc=e.string();break;default:e.skipType(7&t)}}return n})),g),Z.encode=e=>(0,te.LE)(e,Z.codec()),Z.decode=(e,t)=>(0,te.C6)(e,Z.codec(),t),(ee=eO||(eO={})).codec=()=>(null==m&&(m=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.wakuMessage&&(t.uint32(10),eU.codec().encode(e.wakuMessage,t)),null!=e.pubsubTopic&&(t.uint32(18),t.string(e.pubsubTopic)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.wakuMessage=eU.codec().decode(e,e.uint32(),{limits:r.limits?.wakuMessage});break;case 2:n.pubsubTopic=e.string();break;default:e.skipType(7&t)}}return n})),m),ee.encode=e=>(0,te.LE)(e,ee.codec()),ee.decode=(e,t)=>(0,te.C6)(e,ee.codec(),t),(et=eM||(eM={})).codec=()=>(null==y&&(y=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={proof:(0,tt.u)(0),merkleRoot:(0,tt.u)(0),epoch:(0,tt.u)(0),shareX:(0,tt.u)(0),shareY:(0,tt.u)(0),nullifier:(0,tt.u)(0),rlnIdentifier:(0,tt.u)(0)},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.proof=e.bytes();break;case 2:n.merkleRoot=e.bytes();break;case 3:n.epoch=e.bytes();break;case 4:n.shareX=e.bytes();break;case 5:n.shareY=e.bytes();break;case 6:n.nullifier=e.bytes();break;case 7:n.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return n})),y),et.encode=e=>(0,te.LE)(e,et.codec()),et.decode=(e,t)=>(0,te.C6)(e,et.codec(),t),(er=eU||(eU={})).codec=()=>(null==b&&(b=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),eM.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={payload:(0,tt.u)(0),contentTopic:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.payload=e.bytes();break;case 2:n.contentTopic=e.string();break;case 3:n.version=e.uint32();break;case 10:n.timestamp=e.sint64();break;case 11:n.meta=e.bytes();break;case 21:n.rateLimitProof=eM.codec().decode(e,e.uint32(),{limits:r.limits?.rateLimitProof});break;case 31:n.ephemeral=e.bool();break;default:e.skipType(7&t)}}return n})),b),er.encode=e=>(0,te.LE)(e,er.codec()),er.decode=(e,t)=>(0,te.C6)(e,er.codec(),t),(en=eF||(eF={})).codec=()=>(null==v&&(v=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.pubsubTopic&&""!==e.pubsubTopic&&(t.uint32(10),t.string(e.pubsubTopic)),null!=e.message&&(t.uint32(18),e$.codec().encode(e.message,t)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={pubsubTopic:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.pubsubTopic=e.string();break;case 2:n.message=e$.codec().decode(e,e.uint32(),{limits:r.limits?.message});break;default:e.skipType(7&t)}}return n})),v),en.encode=e=>(0,te.LE)(e,en.codec()),en.decode=(e,t)=>(0,te.C6)(e,en.codec(),t),(ei=eK||(eK={})).codec=()=>(null==w&&(w=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.isSuccess&&!1!==e.isSuccess&&(t.uint32(8),t.bool(e.isSuccess)),null!=e.info&&(t.uint32(18),t.string(e.info)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={isSuccess:!1},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.isSuccess=e.bool();break;case 2:n.info=e.string();break;default:e.skipType(7&t)}}return n})),w),ei.encode=e=>(0,te.LE)(e,ei.codec()),ei.decode=(e,t)=>(0,te.C6)(e,ei.codec(),t),(es=eV||(eV={})).codec=()=>(null==E&&(E=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.request&&(t.uint32(18),eF.codec().encode(e.request,t)),null!=e.response&&(t.uint32(26),eK.codec().encode(e.response,t)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={requestId:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.requestId=e.string();break;case 2:n.request=eF.codec().decode(e,e.uint32(),{limits:r.limits?.request});break;case 3:n.response=eK.codec().decode(e,e.uint32(),{limits:r.limits?.response});break;default:e.skipType(7&t)}}return n})),E),es.encode=e=>(0,te.LE)(e,es.codec()),es.decode=(e,t)=>(0,te.C6)(e,es.codec(),t),(eo=eH||(eH={})).codec=()=>(null==S&&(S=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={proof:(0,tt.u)(0),merkleRoot:(0,tt.u)(0),epoch:(0,tt.u)(0),shareX:(0,tt.u)(0),shareY:(0,tt.u)(0),nullifier:(0,tt.u)(0),rlnIdentifier:(0,tt.u)(0)},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.proof=e.bytes();break;case 2:n.merkleRoot=e.bytes();break;case 3:n.epoch=e.bytes();break;case 4:n.shareX=e.bytes();break;case 5:n.shareY=e.bytes();break;case 6:n.nullifier=e.bytes();break;case 7:n.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return n})),S),eo.encode=e=>(0,te.LE)(e,eo.codec()),eo.decode=(e,t)=>(0,te.C6)(e,eo.codec(),t),(ea=e$||(e$={})).codec=()=>(null==A&&(A=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),eH.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={payload:(0,tt.u)(0),contentTopic:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.payload=e.bytes();break;case 2:n.contentTopic=e.string();break;case 3:n.version=e.uint32();break;case 10:n.timestamp=e.sint64();break;case 11:n.meta=e.bytes();break;case 21:n.rateLimitProof=eH.codec().decode(e,e.uint32(),{limits:r.limits?.rateLimitProof});break;case 31:n.ephemeral=e.bool();break;default:e.skipType(7&t)}}return n})),A),ea.encode=e=>(0,te.LE)(e,ea.codec()),ea.decode=(e,t)=>(0,te.C6)(e,ea.codec(),t),(el=eq||(eq={})).codec=()=>(null==I&&(I=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.digest&&e.digest.byteLength>0&&(t.uint32(10),t.bytes(e.digest)),null!=e.receiverTime&&0n!==e.receiverTime&&(t.uint32(16),t.sint64(e.receiverTime)),null!=e.senderTime&&0n!==e.senderTime&&(t.uint32(24),t.sint64(e.senderTime)),null!=e.pubsubTopic&&""!==e.pubsubTopic&&(t.uint32(34),t.string(e.pubsubTopic)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={digest:(0,tt.u)(0),receiverTime:0n,senderTime:0n,pubsubTopic:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.digest=e.bytes();break;case 2:n.receiverTime=e.sint64();break;case 3:n.senderTime=e.sint64();break;case 4:n.pubsubTopic=e.string();break;default:e.skipType(7&t)}}return n})),I),el.encode=e=>(0,te.LE)(e,el.codec()),el.decode=(e,t)=>(0,te.C6)(e,el.codec(),t),(eu=(ec=ez||(ez={})).Direction||(ec.Direction={})).BACKWARD="BACKWARD",eu.FORWARD="FORWARD",(eh=_||(_={}))[eh.BACKWARD=0]="BACKWARD",eh[eh.FORWARD=1]="FORWARD",(ec.Direction||(ec.Direction={})).codec=()=>(0,te.Ji)(_),ec.codec=()=>(null==T&&(T=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.pageSize&&(t.uint32(8),t.uint64(e.pageSize)),null!=e.cursor&&(t.uint32(18),eq.codec().encode(e.cursor,t)),null!=e.direction&&(t.uint32(24),ec.Direction.codec().encode(e.direction,t)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.pageSize=e.uint64();break;case 2:n.cursor=eq.codec().decode(e,e.uint32(),{limits:r.limits?.cursor});break;case 3:n.direction=ec.Direction.codec().decode(e);break;default:e.skipType(7&t)}}return n})),T),ec.encode=e=>(0,te.LE)(e,ec.codec()),ec.decode=(e,t)=>(0,te.C6)(e,ec.codec(),t),(ed=ej||(ej={})).codec=()=>(null==C&&(C=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(10),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={contentTopic:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3==1?n.contentTopic=e.string():e.skipType(7&t)}return n})),C),ed.encode=e=>(0,te.LE)(e,ed.codec()),ed.decode=(e,t)=>(0,te.C6)(e,ed.codec(),t),(ep=eG||(eG={})).codec=()=>(null==R&&(R=(0,te.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.pubsubTopic&&(t.uint32(18),t.string(e.pubsubTopic)),null!=e.contentFilters)for(let r of e.contentFilters)t.uint32(26),ej.codec().encode(r,t);null!=e.pagingInfo&&(t.uint32(34),ez.codec().encode(e.pagingInfo,t)),null!=e.startTime&&(t.uint32(40),t.sint64(e.startTime)),null!=e.endTime&&(t.uint32(48),t.sint64(e.endTime)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={contentFilters:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 2:n.pubsubTopic=e.string();break;case 3:if(r.limits?.contentFilters!=null&&n.contentFilters.length===r.limits.contentFilters)throw new te.sv('decode error - map field "contentFilters" had too many elements',"ERR_MAX_LENGTH");n.contentFilters.push(ej.codec().decode(e,e.uint32(),{limits:r.limits?.contentFilters$}));break;case 4:n.pagingInfo=ez.codec().decode(e,e.uint32(),{limits:r.limits?.pagingInfo});break;case 5:n.startTime=e.sint64();break;case 6:n.endTime=e.sint64();break;default:e.skipType(7&t)}}return n})),R),ep.encode=e=>(0,te.LE)(e,ep.codec()),ep.decode=(e,t)=>(0,te.C6)(e,ep.codec(),t),(eg=k=(ef=eW||(eW={})).HistoryError||(ef.HistoryError={})).NONE="NONE",eg.INVALID_CURSOR="INVALID_CURSOR",eg.TOO_MANY_REQUESTS="TOO_MANY_REQUESTS",eg.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",(em=P||(P={}))[em.NONE=0]="NONE",em[em.INVALID_CURSOR=1]="INVALID_CURSOR",em[em.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",em[em.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",(k=ef.HistoryError||(ef.HistoryError={})).codec=()=>(0,te.Ji)(P),ef.codec=()=>(null==D&&(D=(0,te.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.messages)for(let r of e.messages)t.uint32(18),eJ.codec().encode(r,t);null!=e.pagingInfo&&(t.uint32(26),ez.codec().encode(e.pagingInfo,t)),null!=e.error&&0!==P[e.error]&&(t.uint32(32),ef.HistoryError.codec().encode(e.error,t)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={messages:[],error:k.NONE},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 2:if(r.limits?.messages!=null&&n.messages.length===r.limits.messages)throw new te.sv('decode error - map field "messages" had too many elements',"ERR_MAX_LENGTH");n.messages.push(eJ.codec().decode(e,e.uint32(),{limits:r.limits?.messages$}));break;case 3:n.pagingInfo=ez.codec().decode(e,e.uint32(),{limits:r.limits?.pagingInfo});break;case 4:n.error=ef.HistoryError.codec().decode(e);break;default:e.skipType(7&t)}}return n})),D),ef.encode=e=>(0,te.LE)(e,ef.codec()),ef.decode=(e,t)=>(0,te.C6)(e,ef.codec(),t),(ey=eY||(eY={})).codec=()=>(null==B&&(B=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.query&&(t.uint32(18),eG.codec().encode(e.query,t)),null!=e.response&&(t.uint32(26),eW.codec().encode(e.response,t)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={requestId:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.requestId=e.string();break;case 2:n.query=eG.codec().decode(e,e.uint32(),{limits:r.limits?.query});break;case 3:n.response=eW.codec().decode(e,e.uint32(),{limits:r.limits?.response});break;default:e.skipType(7&t)}}return n})),B),ey.encode=e=>(0,te.LE)(e,ey.codec()),ey.decode=(e,t)=>(0,te.C6)(e,ey.codec(),t),(eb=eQ||(eQ={})).codec=()=>(null==N&&(N=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={proof:(0,tt.u)(0),merkleRoot:(0,tt.u)(0),epoch:(0,tt.u)(0),shareX:(0,tt.u)(0),shareY:(0,tt.u)(0),nullifier:(0,tt.u)(0),rlnIdentifier:(0,tt.u)(0)},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.proof=e.bytes();break;case 2:n.merkleRoot=e.bytes();break;case 3:n.epoch=e.bytes();break;case 4:n.shareX=e.bytes();break;case 5:n.shareY=e.bytes();break;case 6:n.nullifier=e.bytes();break;case 7:n.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return n})),N),eb.encode=e=>(0,te.LE)(e,eb.codec()),eb.decode=(e,t)=>(0,te.C6)(e,eb.codec(),t),(ev=eJ||(eJ={})).codec=()=>(null==L&&(L=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),eQ.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={payload:(0,tt.u)(0),contentTopic:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.payload=e.bytes();break;case 2:n.contentTopic=e.string();break;case 3:n.version=e.uint32();break;case 10:n.timestamp=e.sint64();break;case 11:n.meta=e.bytes();break;case 21:n.rateLimitProof=eQ.codec().decode(e,e.uint32(),{limits:r.limits?.rateLimitProof});break;case 31:n.ephemeral=e.bool();break;default:e.skipType(7&t)}}return n})),L),ev.encode=e=>(0,te.LE)(e,ev.codec()),ev.decode=(e,t)=>(0,te.C6)(e,ev.codec(),t),(ew=eX||(eX={})).codec=()=>(null==x&&(x=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.enr&&(t.uint32(10),t.bytes(e.enr)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={},i=null==t?e.len:e.pos+t;for(;e.pos>>3==1?n.enr=e.bytes():e.skipType(7&t)}return n})),x),ew.encode=e=>(0,te.LE)(e,ew.codec()),ew.decode=(e,t)=>(0,te.C6)(e,ew.codec(),t),(eE=eZ||(eZ={})).codec=()=>(null==O&&(O=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.numPeers&&(t.uint32(8),t.uint64(e.numPeers)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={},i=null==t?e.len:e.pos+t;for(;e.pos>>3==1?n.numPeers=e.uint64():e.skipType(7&t)}return n})),O),eE.encode=e=>(0,te.LE)(e,eE.codec()),eE.decode=(e,t)=>(0,te.C6)(e,eE.codec(),t),(eS=e0||(e0={})).codec=()=>(null==M&&(M=(0,te.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.peerInfos)for(let r of e.peerInfos)t.uint32(10),eX.codec().encode(r,t);!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={peerInfos:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3==1){if(r.limits?.peerInfos!=null&&n.peerInfos.length===r.limits.peerInfos)throw new te.sv('decode error - map field "peerInfos" had too many elements',"ERR_MAX_LENGTH");n.peerInfos.push(eX.codec().decode(e,e.uint32(),{limits:r.limits?.peerInfos$}))}else e.skipType(7&t)}return n})),M),eS.encode=e=>(0,te.LE)(e,eS.codec()),eS.decode=(e,t)=>(0,te.C6)(e,eS.codec(),t),(eA=e1||(e1={})).codec=()=>(null==U&&(U=(0,te.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.query&&(t.uint32(10),eZ.codec().encode(e.query,t)),null!=e.response&&(t.uint32(18),e0.codec().encode(e.response,t)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.query=eZ.codec().decode(e,e.uint32(),{limits:r.limits?.query});break;case 2:n.response=e0.codec().decode(e,e.uint32(),{limits:r.limits?.response});break;default:e.skipType(7&t)}}return n})),U),eA.encode=e=>(0,te.LE)(e,eA.codec()),eA.decode=(e,t)=>(0,te.C6)(e,eA.codec(),t),(eI=e2||(e2={})).codec=()=>(null==F&&(F=(0,te.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.clusterId&&(t.uint32(8),t.uint32(e.clusterId)),null!=e.shards)for(let r of e.shards)t.uint32(16),t.uint32(r);!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={shards:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.clusterId=e.uint32();break;case 2:if(r.limits?.shards!=null&&n.shards.length===r.limits.shards)throw new te.sv('decode error - map field "shards" had too many elements',"ERR_MAX_LENGTH");n.shards.push(e.uint32());break;default:e.skipType(7&t)}}return n})),F),eI.encode=e=>(0,te.LE)(e,eI.codec()),eI.decode=(e,t)=>(0,te.C6)(e,eI.codec(),t),(e_=e3||(e3={})).codec=()=>(null==K&&(K=(0,te.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.clusterId&&(t.uint32(8),t.uint32(e.clusterId)),null!=e.shards)for(let r of e.shards)t.uint32(16),t.uint32(r);!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={shards:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.clusterId=e.uint32();break;case 2:if(r.limits?.shards!=null&&n.shards.length===r.limits.shards)throw new te.sv('decode error - map field "shards" had too many elements',"ERR_MAX_LENGTH");n.shards.push(e.uint32());break;default:e.skipType(7&t)}}return n})),K),e_.encode=e=>(0,te.LE)(e,e_.codec()),e_.decode=(e,t)=>(0,te.C6)(e,e_.codec(),t)},92358:function(e,t,r){"use strict";let n,i,s,o,a,l,c,u,h,d,p,f,g,m,y,b,v,w,E,S,A,I,_,T;r.d(t,{Uw:function(){return tC.Uw},Md:function(){return tJ.Md},UF:function(){return td},Mf:function(){return tu},pq:function(){return lH},iY:function(){return tJ.iY},gT:function(){return tz}});var C,R,k,P,D,B,N,L,x,O,M,U,F,K,V,H,$,q,z,j,G,W,Y,Q,J,X,Z,ee,et,er,en,ei,es,eo,ea,el,ec,eu,eh,ed,ep,ef,eg,em,ey,eb,ev,ew,eE,eS,eA,eI,e_,eT,eC,eR,ek,eP,eD,eB,eN,eL,ex,eO,eM,eU,eF,eK,eV,eH,e$,eq,ez,ej,eG,eW,eY,eQ,eJ,eX,eZ,e0,e1,e2,e3,e4,e6,e5,e8,e9,e7,te,tt={};r.r(tt),r.d(tt,{Ed25519PrivateKey:function(){return na},Ed25519PublicKey:function(){return no},generateKeyPair:function(){return nu},generateKeyPairFromSeed:function(){return nh},unmarshalEd25519PrivateKey:function(){return nl},unmarshalEd25519PublicKey:function(){return nc}});var tr={};r.r(tr),r.d(tr,{MAX_KEY_SIZE:function(){return nS},RsaPrivateKey:function(){return nI},RsaPublicKey:function(){return nA},fromJwk:function(){return nC},generateKeyPair:function(){return nR},unmarshalRsaPrivateKey:function(){return n_},unmarshalRsaPublicKey:function(){return nT}});var tn={};r.r(tn),r.d(tn,{Secp256k1PrivateKey:function(){return nB},Secp256k1PublicKey:function(){return nD},generateKeyPair:function(){return nx},unmarshalSecp256k1PrivateKey:function(){return nN},unmarshalSecp256k1PublicKey:function(){return nL}});var ti=r(35311),ts=r(33126);let to=new ts.Yd("message:version-0"),ta=BigInt(1e6);class tl{pubsubTopic;proto;constructor(e,t){this.pubsubTopic=e,this.proto=t}get ephemeral(){return!!this.proto.ephemeral}get payload(){return this.proto.payload}get contentTopic(){return this.proto.contentTopic}get _rawTimestamp(){return this.proto.timestamp}get timestamp(){try{if(this.proto.timestamp){let e=this.proto.timestamp/ta;return new Date(Number(e))}return}catch(e){return}}get meta(){return this.proto.meta}get version(){return this.proto.version??0}get rateLimitProof(){return this.proto.rateLimitProof}}class tc{contentTopic;ephemeral;pubsubTopic;metaSetter;constructor(e,t=!1,r,n){if(this.contentTopic=e,this.ephemeral=t,this.pubsubTopic=r,this.metaSetter=n,!e||""===e)throw Error("Content topic must be specified")}async toWire(e){return ti.u.H.encode(await this.toProtoObj(e))}async toProtoObj(e){let t=e.timestamp??new Date,r={payload:e.payload,version:0,contentTopic:this.contentTopic,timestamp:BigInt(t.valueOf())*ta,meta:void 0,rateLimitProof:e.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){let e=this.metaSetter(r);return{...r,meta:e}}return r}}function tu({pubsubTopic:e,pubsubTopicShardInfo:t,contentTopic:r,ephemeral:n,metaSetter:i}){return new tc(r,n,(0,ts.IY)(r,e??t),i)}class th{pubsubTopic;contentTopic;constructor(e,t){if(this.pubsubTopic=e,this.contentTopic=t,!t||""===t)throw Error("Content topic must be specified")}fromWireToProtoObj(e){let t=ti.u.H.decode(e);return Promise.resolve({payload:t.payload,contentTopic:t.contentTopic,version:t.version??void 0,timestamp:t.timestamp??void 0,meta:t.meta??void 0,rateLimitProof:t.rateLimitProof??void 0,ephemeral:t.ephemeral??!1})}async fromProtoObj(e,t){return t.version?(to.error("Failed to decode due to incorrect version, expected:",0,", actual:",t.version),Promise.resolve(void 0)):new tl(e,t)}}function td(e,t){return new th((0,ts.IY)(e,t),e)}var tp=r(83431),tf=r(21679),tg=r(37804),tm=r(97540),ty={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let tb=new Uint8Array(16),tv=[];for(let e=0;e<256;++e)tv.push((e+256).toString(16).slice(1));var tw=function(e,t,r){if(ty.randomUUID&&!t&&!e)return ty.randomUUID();let i=(e=e||{}).random||(e.rng||function(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(tb)})();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=i[e];return t}return function(e,t=0){return tv[e[t+0]]+tv[e[t+1]]+tv[e[t+2]]+tv[e[t+3]]+"-"+tv[e[t+4]]+tv[e[t+5]]+"-"+tv[e[t+6]]+tv[e[t+7]]+"-"+tv[e[t+8]]+tv[e[t+9]]+"-"+tv[e[t+10]]+tv[e[t+11]]+tv[e[t+12]]+tv[e[t+13]]+tv[e[t+14]]+tv[e[t+15]]}(i)};class tE{proto;constructor(e){this.proto=e}static decode(e){return new tE(ti.kB.$p.decode(e))}encode(){return ti.kB.$p.encode(this.proto)}get wakuMessage(){return this.proto.wakuMessage}get pubsubTopic(){return this.proto.pubsubTopic}}class tS{proto;constructor(e){this.proto=e}static createSubscribeRequest(e,t){return new tS({requestId:tw(),filterSubscribeType:ti.kB.ep.FilterSubscribeType.SUBSCRIBE,pubsubTopic:e,contentTopics:t})}static createUnsubscribeRequest(e,t){return new tS({requestId:tw(),filterSubscribeType:ti.kB.ep.FilterSubscribeType.UNSUBSCRIBE,pubsubTopic:e,contentTopics:t})}static createUnsubscribeAllRequest(e){return new tS({requestId:tw(),filterSubscribeType:ti.kB.ep.FilterSubscribeType.UNSUBSCRIBE_ALL,pubsubTopic:e,contentTopics:[]})}static createSubscriberPingRequest(){return new tS({requestId:tw(),filterSubscribeType:ti.kB.ep.FilterSubscribeType.SUBSCRIBER_PING,pubsubTopic:"",contentTopics:[]})}static decode(e){return new tS(ti.kB.ep.decode(e))}encode(){return ti.kB.ep.encode(this.proto)}get filterSubscribeType(){return this.proto.filterSubscribeType}get requestId(){return this.proto.requestId}get pubsubTopic(){return this.proto.pubsubTopic}get contentTopics(){return this.proto.contentTopics}}class tA{proto;constructor(e){this.proto=e}static decode(e){return new tA(ti.kB.hO.decode(e))}encode(){return ti.kB.hO.encode(this.proto)}get statusCode(){return this.proto.statusCode}get statusDesc(){return this.proto.statusDesc}get requestId(){return this.proto.requestId}}let tI=new ts.Yd("filter:v2"),t_="/vac/waku/filter-push/2.0.0-beta1";class tT extends tm.p{handleIncomingMessage;constructor(e,t,r){super("/vac/waku/filter-subscribe/2.0.0-beta1",t.components,tI,r.pubsubTopics,r),this.handleIncomingMessage=e,t.handle(t_,this.onRequest.bind(this)).catch(e=>{tI.error("Failed to register ",t_,e)})}onRequest(e){let{connection:t,stream:r}=e,{remotePeer:n}=t;tI.info(`Received message from ${n.toString()}`);try{(0,tg.z)(r,tf.J,async e=>{for await(let t of e){let{pubsubTopic:e,wakuMessage:r}=tE.decode(t.slice());if(!r){tI.error("Received empty message");return}if(!e){tI.error("Pubsub topic missing from push message");return}await this.handleIncomingMessage(e,r)}}).then(()=>{tI.info("Receiving pipe closed.")},e=>{tI.error("Error with receiving pipe",e)})}catch(e){tI.error("Error decoding message",e)}}async subscribe(e,t,r){let n=await this.getStream(t),i=tS.createSubscribeRequest(e,r),s=await (0,tg.z)([i.encode()],tf.c,n,tf.J,async e=>await (0,tp.Z)(e));if(!s||!s.length)throw Error(`No response received for request ${i.requestId}: ${s}`);let{statusCode:o,requestId:a,statusDesc:l}=tA.decode(s[0].slice());if(o<200||o>=300)throw Error(`Filter subscribe request ${a} failed with status code ${o}: ${l}`)}async unsubscribe(e,t,r){let n=await this.getStream(t),i=tS.createUnsubscribeRequest(e,r);await (0,tg.z)([i.encode()],tf.c,n.sink)}async unsubscribeAll(e,t){let r=await this.getStream(t),n=tS.createUnsubscribeAllRequest(e),i=await (0,tg.z)([n.encode()],tf.c,r,tf.J,async e=>await (0,tp.Z)(e));if(!i||!i.length)throw Error(`No response received for request ${n.requestId}: ${i}`);let{statusCode:s,requestId:o,statusDesc:a}=tA.decode(i[0].slice());if(s<200||s>=300)throw Error(`Filter unsubscribe all request ${o} failed with status code ${s}: ${a}`)}async ping(e){let t=await this.getStream(e),r=tS.createSubscriberPingRequest();try{let n=await (0,tg.z)([r.encode()],tf.c,t,tf.J,async e=>await (0,tp.Z)(e));if(!n||!n.length)throw Error(`No response received for request ${r.requestId}: ${n}`);let{statusCode:i,requestId:s,statusDesc:o}=tA.decode(n[0].slice());if(i<200||i>=300)throw Error(`Filter ping request ${s} failed with status code ${i}: ${o}`);tI.info(`Ping successful for peer ${e.id.toString()}`)}catch(e){throw tI.error("Error pinging: ",e),e}}}var tC=r(75354),tR=r(54164);class tk{proto;constructor(e){this.proto=e}static createRequest(e,t){return new tk({requestId:tw(),request:{message:e,pubsubTopic:t},response:void 0})}static decode(e){return new tk(ti.WS.xx.decode(e))}encode(){return ti.WS.xx.encode(this.proto)}get query(){return this.proto.request}get response(){return this.proto.response}}let tP=new ts.Yd("light-push");class tD extends tm.p{constructor(e,t){super("/vac/waku/lightpush/2.0.0-beta1",e.components,tP,t.pubsubTopics,t)}async preparePushMessage(e,t){try{if(!t.payload||0===t.payload.length)return tP.error("Failed to send waku light push: payload is empty"),{query:null,error:tC.K1.EMPTY_PAYLOAD};if(!await (0,ts.eh)(e,t))return tP.error("Failed to send waku light push: message is bigger than 1MB"),{query:null,error:tC.K1.SIZE_TOO_BIG};let r=await e.toProtoObj(t);if(!r)return tP.error("Failed to encode to protoMessage, aborting push"),{query:null,error:tC.K1.ENCODE_FAILED};return{query:tk.createRequest(r,e.pubsubTopic),error:null}}catch(e){return tP.error("Failed to prepare push message",e),{query:null,error:tC.K1.GENERIC_FAIL}}}async send(e,t,r){let n,i,s;let{query:o,error:a}=await this.preparePushMessage(e,t);if(a||!o)return{success:null,failure:{error:a,peerId:r.id}};try{n=await this.getStream(r)}catch(e){return tP.error(`Failed to get a stream for remote peer${r.id.toString()}`,e),{success:null,failure:{error:tC.K1.REMOTE_PEER_FAULT,peerId:r.id}}}try{i=await (0,tg.z)([o.encode()],tf.c,n,tf.J,async e=>await (0,tp.Z)(e))}catch(e){return tP.error("Failed to send waku light push request",e),{success:null,failure:{error:tC.K1.GENERIC_FAIL,peerId:r.id}}}let l=new tR.H;i.forEach(e=>{l.append(e)});try{s=tk.decode(l).response}catch(e){return tP.error("Failed to decode push reply",e),{success:null,failure:{error:tC.K1.DECODE_FAILED,peerId:r.id}}}return s?s.isSuccess?{success:r.id,failure:null}:(tP.error("Remote peer rejected the message: ",s.info),{success:null,failure:{error:tC.K1.REMOTE_PEER_REJECTED,peerId:r.id}}):(tP.error("Remote peer fault: No response in PushRPC"),{success:null,failure:{error:tC.K1.REMOTE_PEER_FAULT,peerId:r.id}})}}let tB={payload:new Uint8Array,contentTopic:"",version:void 0,timestamp:void 0,meta:void 0,rateLimitProof:void 0,ephemeral:void 0},tN=BigInt(1e6);(C=e_||(e_={})).BACKWARD="backward",C.FORWARD="forward";class tL{proto;constructor(e){this.proto=e}get query(){return this.proto.query}get response(){return this.proto.response}static createQuery(e){let t,r;let n=e.contentTopics.map(e=>({contentTopic:e})),i=function(e){switch(e){case e_.BACKWARD:return ti.eW.BI.Direction.BACKWARD;case e_.FORWARD:return ti.eW.BI.Direction.FORWARD;default:return ti.eW.BI.Direction.BACKWARD}}(e.pageDirection),s={pageSize:BigInt(e.pageSize),cursor:e.cursor,direction:i};return e.startTime&&(t=BigInt(e.startTime.valueOf())*tN),e.endTime&&(r=BigInt(e.endTime.valueOf())*tN),new tL({requestId:tw(),query:{pubsubTopic:e.pubsubTopic,contentFilters:n,pagingInfo:s,startTime:t,endTime:r},response:void 0})}decode(e){return new tL(ti.eW.e9.decode(e))}encode(){return ti.eW.e9.encode(this.proto)}}var tx=ti.eW.TA.HistoryError;let tO=new ts.Yd("store");class tM extends tm.p{constructor(e,t){super("/vac/waku/store/2.0.0-beta4",e.components,tO,t.pubsubTopics,t)}async *queryPerPage(e,t,r){if(e.contentTopics.toString()!==Array.from(t.keys()).toString())throw Error("Internal error, the decoders should match the query's content topics");let n=e.cursor;for(;;){e.cursor=n;let i=tL.createQuery(e),s=await this.getStream(r),o=await (0,tg.z)([i.encode()],tf.c,s,tf.J,async e=>await (0,tp.Z)(e)),a=new tR.H;o.forEach(e=>{a.append(e)});let l=i.decode(a);if(!l.response){tO.warn("Stopping pagination due to store `response` field missing");break}let c=l.response;if(c.error&&c.error!==tx.NONE)throw"History response contains an Error: "+c.error;if(!c.messages||!c.messages.length){tO.warn("Stopping pagination due to store `response.messages` field missing or empty");break}tO.error(`${c.messages.length} messages retrieved from store`),yield c.messages.map(r=>{let n=r.contentTopic;if(void 0!==n){let i=t.get(n);if(i)return i.fromProtoObj(e.pubsubTopic,{...tB,...r})}return Promise.resolve(void 0)});let u=c.pagingInfo?.cursor;if(void 0===u){tO.warn("Stopping pagination due to `response.pagingInfo.cursor` missing from store response");break}n=u;let h=c.pagingInfo?.pageSize,d=i.query?.pagingInfo?.pageSize;if(h&&d&&hvoid 0===globalThis.DOMException?new tF(e):new DOMException(e),tV=e=>{let t=void 0===e.reason?tK("This operation was aborted."):e.reason;return t instanceof Error?t:tK(t)};function tH(e,t){let r;let{milliseconds:n,fallback:i,message:s,customTimers:o={setTimeout,clearTimeout}}=t,a=new Promise((a,l)=>{if("number"!=typeof n||1!==Math.sign(n))throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){let{signal:e}=t;e.aborted&&l(tV(e)),e.addEventListener("abort",()=>{l(tV(e))})}if(n===Number.POSITIVE_INFINITY){e.then(a,l);return}let c=new tU;r=o.setTimeout.call(void 0,()=>{if(i){try{a(i())}catch(e){l(e)}return}"function"==typeof e.cancel&&e.cancel(),!1===s?a():s instanceof Error?l(s):(c.message=s??`Promise timed out after ${n} milliseconds`,l(c))},n),(async()=>{try{a(await e)}catch(e){l(e)}})()}).finally(()=>{a.clear()});return a.clear=()=>{o.clearTimeout.call(void 0,r),r=void 0},a}let t$=e=>{let t=e.addEventListener||e.on||e.addListener,r=e.removeEventListener||e.off||e.removeListener;if(!t||!r)throw TypeError("Emitter is not compatible");return{addListener:t.bind(e),removeListener:r.bind(e)}},tq=new ts.Yd("wait-for-remote-peer");async function tz(e,t,r){if(t=t??function(e){let t=[];return e.relay&&t.push(tC.Uw.Relay),e.filter&&t.push(tC.Uw.Filter),e.store&&t.push(tC.Uw.Store),e.lightPush&&t.push(tC.Uw.LightPush),t}(e),!e.isStarted())return Promise.reject("Waku node is not started");let n=[];if(t.includes(tC.Uw.Relay)){if(!e.relay)throw Error("Cannot wait for Relay peer: protocol not mounted");n.push(tG(e.relay))}if(t.includes(tC.Uw.Store)){if(!e.store)throw Error("Cannot wait for Store peer: protocol not mounted");n.push(tj(e.store.protocol,e.libp2p.services.metadata))}if(t.includes(tC.Uw.LightPush)){if(!e.lightPush)throw Error("Cannot wait for LightPush peer: protocol not mounted");n.push(tj(e.lightPush.protocol,e.libp2p.services.metadata))}if(t.includes(tC.Uw.Filter)){if(!e.filter)throw Error("Cannot wait for Filter peer: protocol not mounted");n.push(tj(e.filter.protocol,e.libp2p.services.metadata))}r?await tY(Promise.all(n),r,"Timed out waiting for a remote peer."):await Promise.all(n)}async function tj(e,t){let r=e.multicodec,n=await e.connectedPeers();if(n.length){if(!t){tq.info(`${r} peer found: `,n[0].id.toString());return}try{await Promise.any(n.map(e=>t.confirmOrAttemptHandshake(e.id)));return}catch(e){"ERR_CONNECTION_BEING_CLOSED"===e.code&&tq.error(`Connection with the peer was closed and possibly because it's on a different shard. Error: ${e}`),tq.error(`Error waiting for handshake confirmation: ${e}`)}}tq.info(`Waiting for ${r} peer`),await new Promise(n=>{let i=s=>{s.detail?.protocols?.includes(r)&&(t?t.confirmOrAttemptHandshake(s.detail.peerId).then(()=>{e.removeLibp2pEventListener("peer:identify",i),n()}).catch(e=>{"ERR_CONNECTION_BEING_CLOSED"===e.code&&tq.error(`Connection with the peer was closed and possibly because it's on a different shard. Error: ${e}`),tq.error(`Error waiting for handshake confirmation: ${e}`)}):(e.removeLibp2pEventListener("peer:identify",i),n()))};e.addLibp2pEventListener("peer:identify",i)})}async function tG(e){let t=e.getMeshPeers();for(let r of e.pubsubTopics)for(;0==t.length;)await function(e,t,r){"function"==typeof r&&(r={filter:r});let n=function(e,t,r){let n;let i=new Promise((i,s)=>{if(!((r={rejectionEvents:["error"],multiArgs:!1,resolveImmediately:!1,...r}).count>=0&&(r.count===Number.POSITIVE_INFINITY||Number.isInteger(r.count))))throw TypeError("The `count` option should be at least 0 or more");r.signal?.throwIfAborted();let o=[t].flat(),a=[],{addListener:l,removeListener:c}=t$(e),u=(...e)=>{let t=r.multiArgs?e:e[0];(!r.filter||r.filter(t))&&(a.push(t),r.count===a.length&&(n(),i(a)))},h=e=>{n(),s(e)};for(let e of(n=()=>{for(let e of o)c(e,u);for(let e of r.rejectionEvents)c(e,h)},o))l(e,u);for(let e of r.rejectionEvents)l(e,h);r.signal&&r.signal.addEventListener("abort",()=>{h(r.signal.reason)},{once:!0}),r.resolveImmediately&&i(a)});if(i.cancel=n,"number"==typeof r.timeout){let e=tH(i,{milliseconds:r.timeout});return e.cancel=n,e}return i}(e,t,r={...r,count:1,resolveImmediately:!1}),i=n.then(e=>e[0]);return i.cancel=n.cancel,i}(e.gossipSub,"gossipsub:heartbeat"),t=e.getMeshPeers(r)}let tW=(e,t)=>new Promise((r,n)=>setTimeout(()=>n(t),e));async function tY(e,t,r){await Promise.race([e,tW(t,r)])}var tQ=r(85931),tJ=r(48215);let tX=new ts.Yd("keep-alive");class tZ{pingKeepAliveTimers;relayKeepAliveTimers;options;relay;constructor(e,t){this.pingKeepAliveTimers=new Map,this.relayKeepAliveTimers=new Map,this.options=e,this.relay=t}start(e,t,r){this.stop(e);let{pingKeepAlive:n,relayKeepAlive:i}=this.options,s=e.toString();if(0!==n){let i=setInterval(()=>{(async()=>{let i;try{try{i=await t.ping(e),tX.info(`Ping succeeded (${s})`,i)}catch(e){tX.error(`Ping failed for peer (${s}). + Next ping will be attempted in ${n} seconds. + `);return}try{await r.patch(e,{metadata:{ping:(0,tJ.iY)(i.toString())}})}catch(e){tX.error("Failed to update ping",e)}}catch(e){tX.error(`Ping failed (${s})`,e)}})()},1e3*n);this.pingKeepAliveTimers.set(s,i)}let o=this.relay;if(o&&0!==i){let t=this.scheduleRelayPings(o,i,e.toString());this.relayKeepAliveTimers.set(e,t)}}stop(e){let t=e.toString();this.pingKeepAliveTimers.has(t)&&(clearInterval(this.pingKeepAliveTimers.get(t)),this.pingKeepAliveTimers.delete(t)),this.relayKeepAliveTimers.has(e)&&(this.relayKeepAliveTimers.get(e)?.map(clearInterval),this.relayKeepAliveTimers.delete(e))}stopAll(){for(let e of[...Object.values(this.pingKeepAliveTimers),...Object.values(this.relayKeepAliveTimers)])clearInterval(e);this.pingKeepAliveTimers.clear(),this.relayKeepAliveTimers.clear()}connectionsExist(){return this.pingKeepAliveTimers.size>0||this.relayKeepAliveTimers.size>0}scheduleRelayPings(e,t,r){let n=[];for(let i of e.pubsubTopics){if(!e.getMeshPeers(i).includes(r))continue;let s=tu({pubsubTopicShardInfo:(0,ts.Tf)(i),contentTopic:"/relay-ping/1/ping/null",ephemeral:!0}),o=setInterval(()=>{tX.info("Sending Waku Relay ping message"),e.send(s,{payload:new Uint8Array([1])}).catch(e=>tX.error("Failed to send relay ping",e))},1e3*t);n.push(o)}return n}}let t0=new ts.Yd("connection-manager");class t1 extends tQ.L{configuredPubsubTopics;static instances=new Map;keepAliveManager;options;libp2p;dialAttemptsForPeer=new Map;dialErrorsForPeer=new Map;currentActiveParallelDialCount=0;pendingPeerDialQueue=[];online=!1;isConnected(){return this.online}toggleOnline(){this.online||(this.online=!0,this.dispatchEvent(new tQ.A(tC.wh.CONNECTION_STATUS,{detail:this.online})))}toggleOffline(){this.online&&0==this.libp2p.getConnections().length&&(this.online=!1,this.dispatchEvent(new tQ.A(tC.wh.CONNECTION_STATUS,{detail:this.online})))}static create(e,t,r,n,i,s){let o=t1.instances.get(e);return o||(o=new t1(t,r,n,i,s),t1.instances.set(e,o)),o}async getPeersByDiscovery(){let e=await this.libp2p.peerStore.all(),t=this.libp2p.getConnections().map(e=>e.remotePeer),r=[],n=[],i=[],s=[],o=[],a=[];for(let t of e){let e=await this.getTagNamesForPeer(t.id);e.includes(tC.$G.BOOTSTRAP)?r.push(t):e.includes(tC.$G.PEER_EXCHANGE)?n.push(t):e.includes(tC.$G.LOCAL)&&i.push(t)}for(let e of t){let t=await this.libp2p.peerStore.get(e),r=await this.getTagNamesForPeer(e);r.includes(tC.$G.BOOTSTRAP)?s.push(t):r.includes(tC.$G.PEER_EXCHANGE)?o.push(t):r.includes(tC.$G.LOCAL)&&a.push(t)}return{DISCOVERED:{[tC.$G.BOOTSTRAP]:r,[tC.$G.PEER_EXCHANGE]:n,[tC.$G.LOCAL]:i},CONNECTED:{[tC.$G.BOOTSTRAP]:s,[tC.$G.PEER_EXCHANGE]:o,[tC.$G.LOCAL]:a}}}constructor(e,t,r,n,i){super(),this.configuredPubsubTopics=r,this.libp2p=e,this.configuredPubsubTopics=r,this.options={maxDialAttemptsForPeer:3,maxBootstrapPeersAllowed:1,maxParallelDials:3,...i},this.keepAliveManager=new tZ(t,n),this.run().then(()=>t0.info("Connection Manager is now running")).catch(e=>t0.error("Unexpected error while running service",e)),this.dialPeerStorePeers().catch(e=>t0.error("Unexpected error while dialing peer store peers",e))}async dialPeerStorePeers(){let e=await this.libp2p.peerStore.all(),t=[];for(let r of e)this.libp2p.getConnections().find(e=>e.remotePeer===r.id)||t.push(this.attemptDial(r.id));try{await Promise.all(t)}catch(e){t0.error("Unexpected error while dialing peer store peers",e)}}async run(){this.startPeerDiscoveryListener(),this.startPeerConnectionListener(),this.startPeerDisconnectionListener()}stop(){this.keepAliveManager.stopAll(),this.libp2p.removeEventListener("peer:connect",this.onEventHandlers["peer:connect"]),this.libp2p.removeEventListener("peer:disconnect",this.onEventHandlers["peer:disconnect"]),this.libp2p.removeEventListener("peer:discovery",this.onEventHandlers["peer:discovery"])}async dialPeer(e){this.currentActiveParallelDialCount+=1;let t=0;for(;t{e.tags=Array.from(new Set([...e.tags,...r]))}),this.dialAttemptsForPeer.set(e.toString(),-1);break}catch(r){r instanceof AggregateError?t0.error(`Error dialing peer ${e.toString()} - ${r.errors}`):t0.error(`Error dialing peer ${e.toString()} - ${r.message}`),this.dialErrorsForPeer.set(e.toString(),r),t++,this.dialAttemptsForPeer.set(e.toString(),t)}if(this.currentActiveParallelDialCount--,this.processDialQueue(),t===this.options.maxDialAttemptsForPeer)try{let t=this.dialErrorsForPeer.get(e.toString());if(t){let r;t instanceof AggregateError?t.errors?0===t.errors.length?t0.warn("Errors array is empty for AggregateError"):r=JSON.stringify(t.errors[0]):t0.warn("No errors array found for AggregateError"):r=t.message,t0.info(`Deleting undialable peer ${e.toString()} from peer store. Reason: ${r}`)}this.dialErrorsForPeer.delete(e.toString()),await this.libp2p.peerStore.delete(e)}catch(t){throw Error(`Error deleting undialable peer ${e.toString()} from peer store - ${t}`)}}async dropConnection(e){try{this.keepAliveManager.stop(e),await this.libp2p.hangUp(e),t0.info(`Dropped connection with peer ${e.toString()}`)}catch(t){t0.error(`Error dropping connection with peer ${e.toString()} - ${t}`)}}processDialQueue(){if(this.pendingPeerDialQueue.length>0&&this.currentActiveParallelDialCount{t0.error(e)})}}startPeerDiscoveryListener(){this.libp2p.addEventListener("peer:discovery",this.onEventHandlers["peer:discovery"])}startPeerConnectionListener(){this.libp2p.addEventListener("peer:connect",this.onEventHandlers["peer:connect"])}startPeerDisconnectionListener(){this.libp2p.addEventListener("peer:disconnect",this.onEventHandlers["peer:disconnect"])}async attemptDial(e){if(await this.shouldDialPeer(e)){if(this.currentActiveParallelDialCount>=this.options.maxParallelDials){this.pendingPeerDialQueue.push(e);return}this.dialPeer(e).catch(t=>{t0.error(`Error dialing peer ${e.toString()} : ${t}`)})}}onEventHandlers={"peer:discovery":e=>{(async()=>{let{id:t}=e.detail;await this.dispatchDiscoveryEvent(t);try{await this.attemptDial(t)}catch(e){t0.error(`Error dialing peer ${t.toString()} : ${e}`)}})()},"peer:connect":e=>{(async()=>{t0.info(`Connected to peer ${e.detail.toString()}`);let t=e.detail;this.keepAliveManager.start(t,this.libp2p.services.ping,this.libp2p.peerStore),(await this.getTagNamesForPeer(t)).includes(tC.$G.BOOTSTRAP)?this.libp2p.getConnections().filter(e=>e.tags.includes(tC.$G.BOOTSTRAP)).length>this.options.maxBootstrapPeersAllowed?await this.dropConnection(t):this.dispatchEvent(new tQ.A(tC.Wq.PEER_CONNECT_BOOTSTRAP,{detail:t})):this.dispatchEvent(new tQ.A(tC.Wq.PEER_CONNECT_PEER_EXCHANGE,{detail:t})),this.toggleOnline()})()},"peer:disconnect":e=>{(async()=>{this.keepAliveManager.stop(e.detail),this.toggleOffline()})()}};async shouldDialPeer(e){if(this.libp2p.getConnections(e).length>0)return t0.warn(`Already connected to peer ${e.toString()}. Not dialing.`),!1;if(!await this.isPeerTopicConfigured(e)){let t=await this.getPeerShardInfo(e,this.libp2p.peerStore);return t0.warn(`Discovered peer ${e.toString()} with ShardInfo ${t} is not part of any of the configured pubsub topics (${this.configuredPubsubTopics}). + Not dialing.`),!1}return await this.isPeerDialableBasedOnBootstrapStatus(e)?!this.dialAttemptsForPeer.has(e.toString())||(t0.warn(`Peer ${e.toString()} has already been attempted dial before, or already has a dial attempt in progress, skipping dial`),!1):(t0.warn(`Peer ${e.toString()} is not dialable based on bootstrap status. Not dialing.`),!1)}async isPeerDialableBasedOnBootstrapStatus(e){return!(await this.getTagNamesForPeer(e)).some(e=>e===tC.$G.BOOTSTRAP)||this.libp2p.getConnections().filter(e=>e.tags.find(e=>e===tC.$G.BOOTSTRAP)).lengththis.configuredPubsubTopics.includes(e))}async getPeerShardInfo(e,t){let r=(await t.get(e)).metadata.get("shardInfo");if(r)return(0,ts.Ix)(r)}}r(47651);let t2=new ts.Yd("metadata"),t3="/vac/waku/metadata/1.0.0";class t4 extends tm.p{shardInfo;libp2pComponents;handshakesConfirmed=new Map;constructor(e,t){super(t3,t.components,t2,(0,ts.yf)(e)),this.shardInfo=e,this.libp2pComponents=t,t.registrar.handle(t3,e=>{this.onRequest(e)})}async onRequest(e){try{let{stream:t,connection:r}=e,n=ti.fi._.encode(this.shardInfo),i=await (0,tg.z)([n],tf.c,t,tf.J,async e=>await (0,tp.Z)(e)),{error:s,shardInfo:o}=this.decodeMetadataResponse(i);if(s)return;await this.savePeerShardInfo(r.remotePeer,o)}catch(e){t2.error("Error handling metadata request",e)}}async query(e){let t=ti.fi.v.encode(this.shardInfo),r=await this.peerStore.get(e);if(!r)return{shardInfo:null,error:tC.K1.NO_PEER_AVAILABLE};let n=await this.getStream(r),i=await (0,tg.z)([t],tf.c,n,tf.J,async e=>await (0,tp.Z)(e)),{error:s,shardInfo:o}=this.decodeMetadataResponse(i);return s?{shardInfo:null,error:s}:(await this.savePeerShardInfo(e,o),{shardInfo:o,error:null})}async confirmOrAttemptHandshake(e){let t=this.handshakesConfirmed.get(e.toString());return t?{shardInfo:t,error:null}:await this.query(e)}decodeMetadataResponse(e){let t=new tR.H;e.forEach(e=>{t.append(e)});let r=ti.fi._.decode(t);return r?{shardInfo:r,error:null}:(t2.error("Error decoding metadata response"),{shardInfo:null,error:tC.K1.DECODE_FAILED})}async savePeerShardInfo(e,t){await this.libp2pComponents.peerStore.merge(e,{metadata:{shardInfo:(0,ts.kL)(t)}}),this.handshakesConfirmed.set(e.toString(),t)}}var t6=r(60117);class t5 extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.name="AbortError",this.code=t??"ABORT_ERR"}}async function t8(e,t,r){let n;if(null==t)return e;if(t.aborted)return Promise.reject(new t5(r?.errorMessage,r?.errorCode));let i=new t5(r?.errorMessage,r?.errorCode);try{return await Promise.race([e,new Promise((e,r)=>{n=()=>{r(i)},t.addEventListener("abort",n)})])}finally{null!=n&&t.removeEventListener("abort",n)}}class t9{readNext;haveNext;ended;nextResult;constructor(){this.ended=!1,this.readNext=(0,t6.Z)(),this.haveNext=(0,t6.Z)()}[Symbol.asyncIterator](){return this}async next(){if(null==this.nextResult&&await this.haveNext.promise,null==this.nextResult)throw Error("HaveNext promise resolved but nextResult was undefined");let e=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=(0,t6.Z)(),e}async throw(e){return this.ended=!0,null!=e&&this.haveNext.reject(e),{done:!0,value:void 0}}async return(){return await this._push(void 0),{done:!0,value:void 0}}async push(e,t){await this._push(e,t)}async end(e,t){null!=e?await this.throw(e):await this._push(void 0,t)}async _push(e,t){if(null!=e&&this.ended)throw Error("Cannot push value onto an ended pushable");if(null!=this.nextResult&&(await this.readNext.promise,null!=this.nextResult))throw Error("NeedNext promise resolved but nextResult was not consumed");null!=e?this.nextResult={done:!1,value:e}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=(0,t6.Z)(),await t8(this.readNext.promise,t?.signal,t)}}class t7 extends Error{code;constructor(e,t){super(e),this.code=t}}class re extends t7{type;constructor(e){super(e,"ABORT_ERR"),this.type="aborted"}}var rt=r(17954);class rr extends Error{code;constructor(e,t){super(e),this.code=t}}function rn(e,t={}){let r=function(e,t){let r=new t9;e.sink(r).catch(async e=>{await r.end(e)}),e.sink=async e=>{for await(let t of e)await r.push(t);await r.end()};let n=e.source;null!=e.source[Symbol.iterator]?n=e.source[Symbol.iterator]():null!=e.source[Symbol.asyncIterator]&&(n=e.source[Symbol.asyncIterator]());let i=new tR.H;return{read:async(e,t)=>{let r;t?.signal?.throwIfAborted();let s=new Promise((e,n)=>{r=()=>{n(new re("Read aborted"))},t?.signal?.addEventListener("abort",r)});try{if(null==e){let{done:e,value:t}=await Promise.race([n.next(),s]);if(!0===e)return new tR.H;return t}for(;i.byteLength{t?.signal?.throwIfAborted(),e instanceof Uint8Array?await r.push(e,t):await r.push(e.subarray(),t)},unwrap:()=>{if(i.byteLength>0){let r=e.source;e.source=async function*(){t?.yieldBytes===!1?yield i:yield*i,yield*r}()}return e}}}(e,t);null!=t.maxDataLength&&null==t.maxLengthLength&&(t.maxLengthLength=rt.P$(t.maxDataLength));let n=t?.lengthDecoder??rt.Jx,i=t?.lengthEncoder??rt.cv;return{read:async e=>{let i=-1,s=new tR.H;for(;;){s.append(await r.read(1,e));try{i=n(s)}catch(e){if(e instanceof RangeError)continue;throw e}if(t?.maxLengthLength!=null&&s.byteLength>t.maxLengthLength)throw new rr("message length length too long","ERR_MSG_LENGTH_TOO_LONG");if(i>-1)break}if(t?.maxDataLength!=null&&i>t.maxDataLength)throw new rr("message length too long","ERR_MSG_DATA_TOO_LONG");return r.read(i,e)},write:async(e,t)=>{await r.write(new tR.H(i(e.byteLength),e),t)},writeV:async(e,t)=>{let n=new tR.H(...e.flatMap(e=>[i(e.byteLength),e]));await r.write(n,t)},unwrap:()=>r.unwrap()}}function ri(){let e=(0,t6.Z)(),t=!1;return{sink:async r=>{if(t)throw Error("already piped");t=!0,e.resolve(r)},source:async function*(){let t=await e.promise;yield*t}()}}var rs=r(1514);let ro=!!globalThis.process?.env?.DUMP_SESSION_KEYS,ra=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));function rl(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}let rc=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw Error("Non little-endian hardware is not supported");function ru(e){if("string"!=typeof e)throw Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function rh(e){if("string"==typeof e)e=ru(e);else if(rl(e))e=e.slice();else throw Error(`expected Uint8Array, got ${typeof e}`);return e}let rd=e=>"[object Object]"===Object.prototype.toString.call(e)&&e.constructor===Object;function rp(e,t){if(!rl(e))throw Error("Uint8Array expected");if("number"==typeof t&&e.length!==t)throw Error(`Uint8Array length ${t} expected`)}function rf(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),l=n?4:0,c=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+c,a,n)}function rg(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`wrong positive integer: ${e}`)}function rm(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}function ry(e,...t){if(!(null!=e&&"object"==typeof e&&(e instanceof Uint8Array||"Uint8Array"===e.constructor.name)))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function rb(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}let rv=(e,t)=>255&e[t++]|(255&e[t++])<<8;class rw{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,rp(e=rh(e),32);let t=rv(e,0),r=rv(e,2),n=rv(e,4),i=rv(e,6),s=rv(e,8),o=rv(e,10),a=rv(e,12),l=rv(e,14);this.r[0]=8191&t,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|n<<6)&7939,this.r[3]=(n>>>7|i<<9)&8191,this.r[4]=(i>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|o<<2)&8191,this.r[7]=(o>>>11|a<<5)&8065,this.r[8]=(a>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let t=0;t<8;t++)this.pad[t]=rv(e,16+2*t)}process(e,t,r=!1){let{h:n,r:i}=this,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],h=i[6],d=i[7],p=i[8],f=i[9],g=rv(e,t+0),m=rv(e,t+2),y=rv(e,t+4),b=rv(e,t+6),v=rv(e,t+8),w=rv(e,t+10),E=rv(e,t+12),S=rv(e,t+14),A=n[0]+(8191&g),I=n[1]+((g>>>13|m<<3)&8191),_=n[2]+((m>>>10|y<<6)&8191),T=n[3]+((y>>>7|b<<9)&8191),C=n[4]+((b>>>4|v<<12)&8191),R=n[5]+(v>>>1&8191),k=n[6]+((v>>>14|w<<2)&8191),P=n[7]+((w>>>11|E<<5)&8191),D=n[8]+((E>>>8|S<<8)&8191),B=n[9]+(S>>>5|(r?0:2048)),N=0,L=0+A*s+5*f*I+5*p*_+5*d*T+5*h*C;N=L>>>13,L&=8191,L+=5*u*R+5*c*k+5*l*P+5*a*D+5*o*B,N+=L>>>13,L&=8191;let x=N+A*o+I*s+5*f*_+5*p*T+5*d*C;N=x>>>13,x&=8191,x+=5*h*R+5*u*k+5*c*P+5*l*D+5*a*B,N+=x>>>13,x&=8191;let O=N+A*a+I*o+_*s+5*f*T+5*p*C;N=O>>>13,O&=8191,O+=5*d*R+5*h*k+5*u*P+5*c*D+5*l*B,N+=O>>>13,O&=8191;let M=N+A*l+I*a+_*o+T*s+5*f*C;N=M>>>13,M&=8191,M+=5*p*R+5*d*k+5*h*P+5*u*D+5*c*B,N+=M>>>13,M&=8191;let U=N+A*c+I*l+_*a+T*o+C*s;N=U>>>13,U&=8191,U+=5*f*R+5*p*k+5*d*P+5*h*D+5*u*B,N+=U>>>13,U&=8191;let F=N+A*u+I*c+_*l+T*a+C*o;N=F>>>13,F&=8191,F+=R*s+5*f*k+5*p*P+5*d*D+5*h*B,N+=F>>>13,F&=8191;let K=N+A*h+I*u+_*c+T*l+C*a;N=K>>>13,K&=8191,K+=R*o+k*s+5*f*P+5*p*D+5*d*B,N+=K>>>13,K&=8191;let V=N+A*d+I*h+_*u+T*c+C*l;N=V>>>13,V&=8191,V+=R*a+k*o+P*s+5*f*D+5*p*B,N+=V>>>13,V&=8191;let H=N+A*p+I*d+_*h+T*u+C*c;N=H>>>13,H&=8191,H+=R*l+k*a+P*o+D*s+5*f*B,N+=H>>>13,H&=8191;let $=N+A*f+I*p+_*d+T*h+C*u;N=$>>>13,$&=8191,$+=R*c+k*l+P*a+D*o+B*s,N+=$>>>13,$&=8191,L=8191&(N=(N=(N<<2)+N|0)+L|0),N>>>=13,x+=N,n[0]=L,n[1]=x,n[2]=O,n[3]=M,n[4]=U,n[5]=F,n[6]=K,n[7]=V,n[8]=H,n[9]=$}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),n=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=n,n=e[t]>>>13,e[t]&=8191;e[0]+=5*n,n=e[0]>>>13,e[0]&=8191,e[1]+=n,n=e[1]>>>13,e[1]&=8191,e[2]+=n,r[0]=e[0]+5,n=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=e[t]+n,n=r[t]>>>13,r[t]&=8191;r[9]-=8192;let i=(1^n)-1;for(let e=0;e<10;e++)r[e]&=i;i=~i;for(let t=0;t<10;t++)e[t]=e[t]&i|r[t];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+t[0];e[0]=65535&s;for(let r=1;r<8;r++)s=(e[r]+t[r]|0)+(s>>>16)|0,e[r]=65535&s}update(e){rb(this);let{buffer:t,blockLen:r}=this,n=(e=rh(e)).length;for(let i=0;i>>0,e[i++]=r[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}}let rE=function(e){let t=(t,r)=>e(r).update(rh(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>new rw(e)),rS=ru("expand 16-byte k"),rA=ru("expand 32-byte k"),rI=ra(rS),r_=ra(rA);function rT(e,t){return e<>>32-t}function rC(e){return e.byteOffset%4==0}let rR=4294967296-1,rk=new Uint32Array;function rP(e,t){let{allowShortKeys:r,extendNonceFn:n,counterLength:i,counterRight:s,rounds:o}=function(e,t){if(void 0!==t&&("object"!=typeof t||!rd(t)))throw Error("options must be object or undefined");return Object.assign(e,t)}({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw Error("core must be a function");return rg(i),rg(o),rm(s),rm(r),(t,a,l,c,u=0)=>{ry(t),ry(a),ry(l);let h=l.length;if(c||(c=new Uint8Array(h)),ry(c),rg(u),u<0||u>=rR)throw Error("arx: counter overflow");if(c.length=rR)throw Error("arx: counter overflow");let g=Math.min(64,l-f);if(h&&64===g){let e=f/4;if(f%4!=0)throw Error("arx: invalid block position");for(let t=0,r;t<16;t++)p[r=e+t]=d[r]^u[t];f+=64;continue}for(let e=0,t;e0;)d.pop().fill(0);return c}}function rD(e,t,r,n,i,s=20){let o=e[0],a=e[1],l=e[2],c=e[3],u=t[0],h=t[1],d=t[2],p=t[3],f=t[4],g=t[5],m=t[6],y=t[7],b=r[0],v=r[1],w=r[2],E=o,S=a,A=l,I=c,_=u,T=h,C=d,R=p,k=f,P=g,D=m,B=y,N=i,L=b,x=v,O=w;for(let e=0;e{e.update(t);let r=t.length%16;r&&e.update(rL.subarray(r))},rO=new Uint8Array(32);function rM(e,t,r,n,i){let s=e(t,r,rO),o=rE.create(s);i&&rx(o,i),rx(o,n);let a=new Uint8Array(16),l=rc(a);rf(l,0,BigInt(i?i.length:0),!0),rf(l,8,BigInt(n.length),!0),o.update(a);let c=o.digest();return s.fill(0),c}let rU=e=>(t,r,n)=>(rp(t,32),rp(r),{encrypt:(i,s)=>{let o=i.length,a=o+16;s?rp(s,a):s=new Uint8Array(a),e(t,r,i,s,1);let l=rM(e,t,r,s.subarray(0,-16),n);return s.set(l,o),s},decrypt:(i,s)=>{let o=i.length,a=o-16;if(o<16)throw Error("encrypted data must be at least 16 bytes");s?rp(s,a):s=new Uint8Array(a);let l=i.subarray(0,-16);if(!function(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n(0,rj.J)(e.subarray()),getHKDF(e,t){var r,n;let i=(r=rj.J,n=e,(0,rV.vp)(r),void 0===n&&(n=new Uint8Array(r.outputLen)),(0,r$.b)(r,(0,rH.O0)(n),(0,rH.O0)(t))),s=function(e,t,r,n=32){if((0,rV.vp)(e),(0,rV.Rx)(n),n>255*e.outputLen)throw Error("Length should be <= 255*HashLen");let i=Math.ceil(n/e.outputLen);void 0===r&&(r=rz);let s=new Uint8Array(i*e.outputLen),o=r$.b.create(e,t),a=o._cloneInto(),l=new Uint8Array(o.outputLen);for(let t=0;t({publicKey:rK.Sg.getPublicKey(e),privateKey:e}),generateX25519SharedKey:(e,t)=>rK.Sg.getSharedSecret(e.subarray(),t.subarray()),chaCha20Poly1305Encrypt:(e,t,r,n)=>rF(n,t,r).encrypt(e.subarray()),chaCha20Poly1305Decrypt:(e,t,r,n,i)=>rF(n,t,r).decrypt(e.subarray(),i)},rW=e=>{let t=(0,rs.E)(2);return new DataView(t.buffer,t.byteOffset,t.byteLength).setUint16(0,e,!1),t};rW.bytes=2;let rY=e=>{if(e.length<2)throw RangeError("Could not decode int16BE");return e instanceof Uint8Array?new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0,!1):e.getUint16(0)};rY.bytes=2;class rQ extends Error{code;constructor(e="Unexpected Peer"){super(e),this.code=rQ.code}static code="ERR_UNEXPECTED_PEER"}class rJ extends Error{code;constructor(e="Invalid crypto exchange"){super(e),this.code=rJ.code}static code="ERR_INVALID_CRYPTO_EXCHANGE"}r(86047),r(89113);var rX=r(22852),rZ=r(95482),r0=r(60565),r1=r(75360),r2=r(60575),r3=r(30024),r4=r(38856);r(77939),r(51275);var r6=r(83508),r5=r(12528);function r8(e,t){let r=Uint8Array.from(e.abs().toByteArray());if(r=0===r[0]?r.subarray(1):r,null!=t){if(r.length>t)throw Error("byte array longer than desired length");r=(0,r6.z)([new Uint8Array(t-r.length),r])}return(0,r5.B)(r,"base64url")}function r9(e){var t,r;let n=(t=e,(0,r0.m)(t,"base64urlpad"));return new rZ.jsbn.BigInteger((0,r5.B)(n,"base16"),16)}function r7(e){return null!=e&&"function"==typeof e.then&&"function"==typeof e.catch&&"function"==typeof e.finally}function ne(e,t){let r=new Uint8Array(64);for(let n=0;n<32;n++)r[n]=e[n],r[32+n]=t[n];return r}var nt=r(84018),nr={get(e=globalThis){let t=e.crypto;if(null==t||null==t.subtle)throw Object.assign(Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return t}};let nn={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};async function ni(e,t){let r=function(e){let t=(void 0)??"AES-GCM",r=(void 0)??16,n=(void 0)??12,i=e?.digest??"SHA-256",s=e?.saltLength??16,o=e?.iterations??32767,a=nr.get();async function l(e,l){let c;let u=a.getRandomValues(new Uint8Array(s)),h={name:t,iv:a.getRandomValues(new Uint8Array(n))};if("string"==typeof l&&(l=(0,r0.m)(l)),0===l.length){c=await a.subtle.importKey("jwk",nn,{name:"AES-GCM"},!0,["encrypt"]);try{let e=await a.subtle.importKey("raw",l,{name:"PBKDF2"},!1,["deriveKey"]);c=await a.subtle.deriveKey({name:"PBKDF2",salt:u,iterations:o,hash:{name:i}},e,{name:t,length:r},!0,["encrypt"])}catch{c=await a.subtle.importKey("jwk",nn,{name:"AES-GCM"},!0,["encrypt"])}}else{let e=await a.subtle.importKey("raw",l,{name:"PBKDF2"},!1,["deriveKey"]);c=await a.subtle.deriveKey({name:"PBKDF2",salt:u,iterations:o,hash:{name:i}},e,{name:t,length:r},!0,["encrypt"])}let d=await a.subtle.encrypt(h,c,e);return(0,r6.z)([u,h.iv,new Uint8Array(d)])}async function c(e,l){let c;let u=e.subarray(0,s),h=e.subarray(s,s+n),d=e.subarray(s+n);if("string"==typeof l&&(l=(0,r0.m)(l)),0===l.length)try{let e=await a.subtle.importKey("raw",l,{name:"PBKDF2"},!1,["deriveKey"]);c=await a.subtle.deriveKey({name:"PBKDF2",salt:u,iterations:o,hash:{name:i}},e,{name:t,length:r},!0,["decrypt"])}catch{c=await a.subtle.importKey("jwk",nn,{name:"AES-GCM"},!0,["decrypt"])}else{let e=await a.subtle.importKey("raw",l,{name:"PBKDF2"},!1,["deriveKey"]);c=await a.subtle.deriveKey({name:"PBKDF2",salt:u,iterations:o,hash:{name:i}},e,{name:t,length:r},!0,["decrypt"])}return new Uint8Array(await a.subtle.decrypt({name:t,iv:h},c,d))}return r*=8,{encrypt:l,decrypt:c}}(),n=await r.encrypt(e,t);return nt.base64.encode(n)}var ns=r(47971);(P=eT||(eT={})).RSA="RSA",P.Ed25519="Ed25519",P.Secp256k1="Secp256k1",(D=eC||(eC={}))[D.RSA=0]="RSA",D[D.Ed25519=1]="Ed25519",D[D.Secp256k1=2]="Secp256k1",(eT||(eT={})).codec=()=>(0,ns.Ji)(eC),(B=eR||(eR={})).codec=()=>(null==s&&(s=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.Type&&(t.uint32(8),eT.codec().encode(e.Type,t)),null!=e.Data&&(t.uint32(18),t.bytes(e.Data)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.Type=eT.codec().decode(e);break;case 2:r.Data=e.bytes();break;default:e.skipType(7&t)}}return r})),s),B.encode=e=>(0,ns.LE)(e,B.codec()),B.decode=e=>(0,ns.C6)(e,B.codec()),(N=ek||(ek={})).codec=()=>(null==o&&(o=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.Type&&(t.uint32(8),eT.codec().encode(e.Type,t)),null!=e.Data&&(t.uint32(18),t.bytes(e.Data)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.Type=eT.codec().decode(e);break;case 2:r.Data=e.bytes();break;default:e.skipType(7&t)}}return r})),o),N.encode=e=>(0,ns.LE)(e,N.codec()),N.decode=e=>(0,ns.C6)(e,N.codec());class no{_key;constructor(e){this._key=nd(e,32)}verify(e,t){var r;return r=this._key,rK.UN.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}marshal(){return this._key}get bytes(){return eR.encode({Type:eT.Ed25519,Data:this.marshal()}).subarray()}equals(e){return(0,r4.f)(this.bytes,e.bytes)}hash(){let e=r3.sha256.digest(this.bytes);return r7(e)?e.then(({bytes:e})=>e):e.bytes}}class na{_key;_publicKey;constructor(e,t){this._key=nd(e,64),this._publicKey=nd(t,32)}sign(e){return function(e,t){let r=e.subarray(0,32);return rK.UN.sign(t instanceof Uint8Array?t:t.subarray(),r)}(this._key,e)}get public(){return new no(this._publicKey)}marshal(){return this._key}get bytes(){return ek.encode({Type:eT.Ed25519,Data:this.marshal()}).subarray()}equals(e){return(0,r4.f)(this.bytes,e.bytes)}async hash(){let e;let t=r3.sha256.digest(this.bytes);return r7(t)?{bytes:e}=await t:e=t.bytes,e}async id(){let e=r2.identity.digest(this.public.bytes);return r1.base58btc.encode(e.bytes).substring(1)}async export(e,t="libp2p-key"){if("libp2p-key"===t)return ni(this.bytes,e);throw new rX.sv(`export format '${t}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}function nl(e){return e.length>64?new na((e=nd(e,96)).subarray(0,64),e.subarray(64,e.length)):new na((e=nd(e,64)).subarray(0,64),e.subarray(32))}function nc(e){return new no(e=nd(e,32))}async function nu(){let{privateKey:e,publicKey:t}=function(){let e=rK.UN.utils.randomPrivateKey(),t=rK.UN.getPublicKey(e);return{privateKey:ne(e,t),publicKey:t}}();return new na(e,t)}async function nh(e){let{privateKey:t,publicKey:r}=function(e){if(32!==e.length)throw TypeError('"seed" must be 32 bytes in length.');if(!(e instanceof Uint8Array))throw TypeError('"seed" must be a node.js Buffer, or Uint8Array.');let t=rK.UN.getPublicKey(e);return{privateKey:ne(e,t),publicKey:t}}(e);return new na(t,r)}function nd(e,t){if((e=Uint8Array.from(e??[])).length!==t)throw new rX.sv(`Key must be a Uint8Array of length ${t}, got ${e.length}`,"ERR_INVALID_KEY_TYPE");return e}function np(e,t){return t.map(t=>r9(e[t]))}async function nf(e){let t=await nr.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await nb(t);return{privateKey:r[0],publicKey:r[1]}}async function ng(e){let t=[await nr.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await nv(e)],r=await nb({privateKey:t[0],publicKey:t[1]});return{privateKey:r[0],publicKey:r[1]}}async function nm(e,t){let r=await nr.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await nr.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,t instanceof Uint8Array?t:t.subarray());return new Uint8Array(n,0,n.byteLength)}async function ny(e,t,r){let n=await nr.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return nr.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,t,r instanceof Uint8Array?r:r.subarray())}async function nb(e){if(null==e.privateKey||null==e.publicKey)throw new rX.sv("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([nr.get().subtle.exportKey("jwk",e.privateKey),nr.get().subtle.exportKey("jwk",e.publicKey)])}async function nv(e){return nr.get().subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}function nw(e,t,r,n){let i=t?rZ.pki.setRsaPublicKey(...np(e,["n","e"])):rZ.pki.setRsaPrivateKey(...np(e,["n","e","d","p","q","dp","dq","qi"])),s=n((0,r5.B)(r instanceof Uint8Array?r:r.subarray(),"ascii"),i);return(0,r0.m)(s,"ascii")}function nE(e){if("RSA"!==e.kty)throw new rX.sv("invalid key type","ERR_INVALID_KEY_TYPE");if(null==e.n)throw new rX.sv("invalid key modulus","ERR_INVALID_KEY_MODULUS");return 8*(0,r0.m)(e.n,"base64url").length}r(56334),r(87821);let nS=8192;class nA{_key;constructor(e){this._key=e}verify(e,t){return ny(this._key,t,e)}marshal(){return function(e){if(null==e.n||null==e.e)throw new rX.sv("JWK was missing components","ERR_INVALID_PARAMETERS");let t=rZ.pki.publicKeyToAsn1({n:r9(e.n),e:r9(e.e)});return(0,r0.m)(rZ.asn1.toDer(t).getBytes(),"ascii")}(this._key)}get bytes(){return eR.encode({Type:eT.RSA,Data:this.marshal()}).subarray()}encrypt(e){return nw(this._key,!0,e,(e,t)=>t.encrypt(e))}equals(e){return(0,r4.f)(this.bytes,e.bytes)}hash(){let e=r3.sha256.digest(this.bytes);return r7(e)?e.then(({bytes:e})=>e):e.bytes}}class nI{_key;_publicKey;constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return function(e){if(isNaN(16))throw new rX.sv("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return(0,rH.O6)(16)}(16)}sign(e){return nm(this._key,e)}get public(){if(null==this._publicKey)throw new rX.sv("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new nA(this._publicKey)}decrypt(e){return nw(this._key,!1,e,(e,t)=>t.decrypt(e))}marshal(){return function(e){if(null==e.n||null==e.e||null==e.d||null==e.p||null==e.q||null==e.dp||null==e.dq||null==e.qi)throw new rX.sv("JWK was missing components","ERR_INVALID_PARAMETERS");let t=rZ.pki.privateKeyToAsn1({n:r9(e.n),e:r9(e.e),d:r9(e.d),p:r9(e.p),q:r9(e.q),dP:r9(e.dp),dQ:r9(e.dq),qInv:r9(e.qi)});return(0,r0.m)(rZ.asn1.toDer(t).getBytes(),"ascii")}(this._key)}get bytes(){return ek.encode({Type:eT.RSA,Data:this.marshal()}).subarray()}equals(e){return(0,r4.f)(this.bytes,e.bytes)}hash(){let e=r3.sha256.digest(this.bytes);return r7(e)?e.then(({bytes:e})=>e):e.bytes}async id(){let e=await this.public.hash();return(0,r5.B)(e,"base58btc")}async export(e,t="pkcs-8"){if("pkcs-8"===t){let t=new rZ.util.ByteBuffer(this.marshal()),r=rZ.asn1.fromDer(t),n=rZ.pki.privateKeyFromAsn1(r);return rZ.pki.encryptRsaPrivateKey(n,e,{algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"})}if("libp2p-key"===t)return ni(this.bytes,e);throw new rX.sv(`export format '${t}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}async function n_(e){let t=function(e){let t=rZ.asn1.fromDer((0,r5.B)(e,"ascii")),r=rZ.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:r8(r.n),e:r8(r.e),d:r8(r.d),p:r8(r.p),q:r8(r.q),dp:r8(r.dP),dq:r8(r.dQ),qi:r8(r.qInv),alg:"RS256"}}(e);if(nE(t)>nS)throw new rX.sv("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let r=await ng(t);return new nI(r.privateKey,r.publicKey)}function nT(e){let t=function(e){let t=rZ.asn1.fromDer((0,r5.B)(e,"ascii")),r=rZ.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:r8(r.n),e:r8(r.e)}}(e);if(nE(t)>nS)throw new rX.sv("key size is too large","ERR_KEY_SIZE_TOO_LARGE");return new nA(t)}async function nC(e){if(nE(e)>nS)throw new rX.sv("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let t=await ng(e);return new nI(t.privateKey,t.publicKey)}async function nR(e){if(e>nS)throw new rX.sv("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let t=await nf(e);return new nI(t.privateKey,t.publicKey)}var nk=r(14374);function nP(e){try{nk.kA.ProjectivePoint.fromHex(e)}catch(e){throw new rX.sv(String(e),"ERR_INVALID_PUBLIC_KEY")}}class nD{_key;constructor(e){nP(e),this._key=e}verify(e,t){return function(e,t,r){let n=r3.sha256.digest(r instanceof Uint8Array?r:r.subarray());if(r7(n))return n.then(({digest:r})=>nk.kA.verify(t,r,e)).catch(e=>{throw new rX.sv(String(e),"ERR_INVALID_INPUT")});try{return nk.kA.verify(t,n.digest,e)}catch(e){throw new rX.sv(String(e),"ERR_INVALID_INPUT")}}(this._key,t,e)}marshal(){var e;return e=this._key,nk.kA.ProjectivePoint.fromHex(e).toRawBytes(!0)}get bytes(){return eR.encode({Type:eT.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return(0,r4.f)(this.bytes,e.bytes)}async hash(){let e;let t=r3.sha256.digest(this.bytes);return r7(t)?{bytes:e}=await t:e=t.bytes,e}}class nB{_key;_publicKey;constructor(e,t){this._key=e,this._publicKey=t??function(e){try{return nk.kA.getPublicKey(e,!0)}catch(e){throw new rX.sv(String(e),"ERR_INVALID_PRIVATE_KEY")}}(e),function(e){try{nk.kA.getPublicKey(e,!0)}catch(e){throw new rX.sv(String(e),"ERR_INVALID_PRIVATE_KEY")}}(this._key),nP(this._publicKey)}sign(e){return function(e,t){let r=r3.sha256.digest(t instanceof Uint8Array?t:t.subarray());if(r7(r))return r.then(({digest:t})=>nk.kA.sign(t,e).toDERRawBytes()).catch(e=>{throw new rX.sv(String(e),"ERR_INVALID_INPUT")});try{return nk.kA.sign(r.digest,e).toDERRawBytes()}catch(e){throw new rX.sv(String(e),"ERR_INVALID_INPUT")}}(this._key,e)}get public(){return new nD(this._publicKey)}marshal(){return this._key}get bytes(){return ek.encode({Type:eT.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return(0,r4.f)(this.bytes,e.bytes)}hash(){let e=r3.sha256.digest(this.bytes);return r7(e)?e.then(({bytes:e})=>e):e.bytes}async id(){let e=await this.public.hash();return(0,r5.B)(e,"base58btc")}async export(e,t="libp2p-key"){if("libp2p-key"===t)return ni(this.bytes,e);throw new rX.sv(`export format '${t}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}function nN(e){return new nB(e)}function nL(e){return new nD(e)}async function nx(){return new nB(nk.kA.utils.randomPrivateKey())}let nO={rsa:tr,ed25519:tt,secp256k1:tn};function nM(e){let t=Object.keys(nO).join(" / ");return new rX.sv(`invalid or unsupported key type ${e}. Must be ${t}`,"ERR_UNSUPPORTED_KEY_TYPE")}async function nU(e){let t=ek.decode(e),r=t.Data??new Uint8Array;switch(t.Type){case eT.RSA:return nO.rsa.unmarshalRsaPrivateKey(r);case eT.Ed25519:return nO.ed25519.unmarshalEd25519PrivateKey(r);case eT.Secp256k1:return nO.secp256k1.unmarshalSecp256k1PrivateKey(r);default:throw nM(t.Type??"RSA")}}var nF=r(65301);async function nK(e,t,r){var n;let i=await nV(e,n$(t));if(null==e.publicKey)throw Error("PublicKey was missing from local PeerId");return n=e.publicKey,eD.encode({identityKey:n,identitySig:i,extensions:r??{webtransportCerthashes:[]}}).subarray()}async function nV(e,t){if(null==e.privateKey)throw Error("PrivateKey was missing from PeerId");return(await nU(e.privateKey)).sign(t)}async function nH(e){return(0,nF.y5)(e.identityKey)}function n$(e){let t=(0,r0.m)("noise-libp2p-static-key:");return e instanceof Uint8Array?(0,r6.z)([t,e],t.length+e.length):(e.prepend(t),e)}async function nq(e,t,r){let n=await (0,nF.y5)(t.identityKey);if(!n.equals(r))throw Error(`Payload identity key ${n.toString()} does not match expected remote peer ${r.toString()}`);let i=n$(e);if(null==n.publicKey)throw Error("PublicKey was missing from PeerId");if(null==t.identitySig)throw Error("Signature was missing from message");let s=function(e){let t=eR.decode(e),r=t.Data??new Uint8Array;switch(t.Type){case eT.RSA:return nO.rsa.unmarshalRsaPublicKey(r);case eT.Ed25519:return nO.ed25519.unmarshalEd25519PublicKey(r);case eT.Secp256k1:return nO.secp256k1.unmarshalSecp256k1PublicKey(r);default:throw nM(t.Type??"unknown")}}(n.publicKey);if(!await s.verify(i,t.identitySig))throw Error("Static key doesn't match to peer that signed payload!");return n}function nz(e){return!!(e instanceof Uint8Array||(0,tR.Z)(e))&&32===e.byteLength}(L=eP||(eP={})).codec=()=>(null==a&&(a=(0,ns.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.webtransportCerthashes)for(let r of e.webtransportCerthashes)t.uint32(10),t.bytes(r);!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={webtransportCerthashes:[]},n=null==t?e.len:e.pos+t;for(;e.pos>>3==1?r.webtransportCerthashes.push(e.bytes()):e.skipType(7&t)}return r})),a),L.encode=e=>(0,ns.LE)(e,L.codec()),L.decode=e=>(0,ns.C6)(e,L.codec()),(x=eD||(eD={})).codec=()=>(null==l&&(l=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.identityKey&&e.identityKey.byteLength>0&&(t.uint32(10),t.bytes(e.identityKey)),null!=e.identitySig&&e.identitySig.byteLength>0&&(t.uint32(18),t.bytes(e.identitySig)),null!=e.extensions&&(t.uint32(34),eP.codec().encode(e.extensions,t)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={identityKey:(0,rs.u)(0),identitySig:(0,rs.u)(0)},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.identityKey=e.bytes();break;case 2:r.identitySig=e.bytes();break;case 4:r.extensions=eP.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r})),l),x.encode=e=>(0,ns.LE)(e,x.codec()),x.decode=e=>(0,ns.C6)(e,x.codec());class nj{n;bytes;view;constructor(e=0){this.n=e,this.bytes=(0,rs.u)(12),this.view=new DataView(this.bytes.buffer,this.bytes.byteOffset,this.bytes.byteLength),this.view.setUint32(4,e,!0)}increment(){this.n++,this.view.setUint32(4,this.n,!0)}getBytes(){return this.bytes}getUint64(){return this.n}assertValue(){if(this.n>4294967295)throw Error("Cipherstate has reached maximum n, a new handshake must be performed")}}class nG{crypto;log;constructor(e,t){this.log=e.logger.forComponent("libp2p:noise:abstract-handshake"),this.crypto=t}encryptWithAd(e,t,r){let n=this.encrypt(e.k,e.n,t,r);return e.n.increment(),n}decryptWithAd(e,t,r,n){let{plaintext:i,valid:s}=this.decrypt(e.k,e.n,t,r,n);return s&&e.n.increment(),{plaintext:i,valid:s}}hasKey(e){return!this.isEmptyKey(e.k)}createEmptyKey(){return(0,rs.u)(32)}isEmptyKey(e){let t=this.createEmptyKey();return(0,r4.f)(t,e)}encrypt(e,t,r,n){return t.assertValue(),this.crypto.chaCha20Poly1305Encrypt(n,t.getBytes(),r,e)}encryptAndHash(e,t){let r;return r=this.hasKey(e.cs)?this.encryptWithAd(e.cs,e.h,t):t,this.mixHash(e,r),r}decrypt(e,t,r,n,i){t.assertValue();let s=this.crypto.chaCha20Poly1305Decrypt(n,t.getBytes(),r,e,i);return s?{plaintext:s,valid:!0}:{plaintext:(0,rs.u)(0),valid:!1}}decryptAndHash(e,t){let r;let n=!0;return this.hasKey(e.cs)?{plaintext:r,valid:n}=this.decryptWithAd(e.cs,e.h,t):r=t,this.mixHash(e,t),{plaintext:r,valid:n}}dh(e,t){try{let r=this.crypto.generateX25519SharedKey(e,t);if(32===r.length)return r;return r.subarray(0,32)}catch(e){return this.log.error("error deriving shared key",e),(0,rs.u)(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){return this.crypto.hashSHA256(new tR.H(e,t))}mixKey(e,t){let[r,n]=this.crypto.getHKDF(e.ck,t);e.cs=this.initializeKey(n),e.ck=r}initializeKey(e){return{k:e,n:new nj}}initializeSymmetric(e){let t=(0,r0.m)(e,"utf-8"),r=this.hashProtocolName(t),n=this.createEmptyKey();return{cs:this.initializeKey(n),ck:r,h:r}}hashProtocolName(e){if(!(e.length<=32))return this.getHash(e,(0,rs.u)(0));{let t=(0,rs.u)(32);return t.set(e),t}}split(e){let[t,r]=this.crypto.getHKDF(e.ck,(0,rs.u)(0));return{cs1:this.initializeKey(t),cs2:this.initializeKey(r)}}writeMessageRegular(e,t){let r=this.encryptWithAd(e,(0,rs.u)(0),t);return{ne:this.createEmptyKey(),ns:(0,rs.u)(0),ciphertext:r}}readMessageRegular(e,t){return this.decryptWithAd(e,(0,rs.u)(0),t.ciphertext)}}class nW extends nG{initializeInitiator(e,t,r,n){let i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(i,e),{ss:i,s:t,rs:r,psk:n,re:(0,rs.u)(32)}}initializeResponder(e,t,r,n){let i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(i,e),{ss:i,s:t,rs:r,psk:n,re:(0,rs.u)(32)}}writeMessageA(e,t,r){let n=(0,rs.u)(0);void 0!==r?e.e=r:e.e=this.crypto.generateX25519KeyPair();let i=e.e.publicKey;return this.mixHash(e.ss,i),{ne:i,ns:n,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=this.crypto.generateX25519KeyPair();let r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));let n=e.s.publicKey,i=this.encryptAndHash(e.ss,n);return this.mixKey(e.ss,this.dh(e.s.privateKey,e.re)),{ne:r,ns:i,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){let r=e.s.publicKey,n=this.encryptAndHash(e.ss,r);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));let i=this.encryptAndHash(e.ss,t),s=this.createEmptyKey(),{cs1:o,cs2:a}=this.split(e.ss);return{h:e.ss.h,messageBuffer:{ne:s,ns:n,ciphertext:i},cs1:o,cs2:a}}readMessageA(e,t){return nz(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if(nz(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));let{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);n&&nz(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));let{plaintext:i,valid:s}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:i,valid:n&&s}}readMessageC(e,t){let{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);if(n&&nz(r)&&(e.rs=r),!e.e)throw Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));let{plaintext:i,valid:s}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:o,cs2:a}=this.split(e.ss);return{h:e.ss.h,plaintext:i,valid:n&&s,cs1:o,cs2:a}}initSession(e,t,r){let n=this.createEmptyKey(),i=(0,rs.u)(32);return{hs:e?this.initializeInitiator(t,r,i,n):this.initializeResponder(t,r,i,n),i:e,mc:0}}sendMessage(e,t,r){let n;if(0===e.mc)n=this.writeMessageA(e.hs,t,r);else if(1===e.mc)n=this.writeMessageB(e.hs,t);else if(2===e.mc){let{h:r,messageBuffer:i,cs1:s,cs2:o}=this.writeMessageC(e.hs,t);n=i,e.h=r,e.cs1=s,e.cs2=o}else if(e.mc>2){if(e.i){if(!e.cs1)throw Error("CS1 (cipher state) is not defined");n=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw Error("CS2 (cipher state) is not defined");n=this.writeMessageRegular(e.cs2,t)}}else throw Error("Session invalid.");return e.mc++,n}recvMessage(e,t){let r=(0,rs.u)(0),n=!1;if(0===e.mc)({plaintext:r,valid:n}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:r,valid:n}=this.readMessageB(e.hs,t));else if(2===e.mc){let{h:i,plaintext:s,valid:o,cs1:a,cs2:l}=this.readMessageC(e.hs,t);r=s,n=o,e.h=i,e.cs1=a,e.cs2=l}return e.mc++,{plaintext:r,valid:n}}}function nY(e,t){t.enabled&&ro&&(e?(t(`LOCAL_PUBLIC_EPHEMERAL_KEY ${(0,r5.B)(e.publicKey,"hex")}`),t(`LOCAL_PRIVATE_EPHEMERAL_KEY ${(0,r5.B)(e.privateKey,"hex")}`)):t("Missing local ephemeral keys."))}function nQ(e,t){t.enabled&&ro&&t(`REMOTE_EPHEMERAL_PUBLIC_KEY ${(0,r5.B)(e.subarray(),"hex")}`)}class nJ{isInitiator;session;remotePeer;remoteExtensions={webtransportCerthashes:[]};payload;connection;xx;staticKeypair;prologue;log;constructor(e,t,r,n,i,s,o,a,l){this.log=e.logger.forComponent("libp2p:noise:xxhandshake"),this.isInitiator=t,this.payload=r,this.prologue=n,this.staticKeypair=s,this.connection=o,a&&(this.remotePeer=a),this.xx=l??new nW(e,i),this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair)}async propose(){var e,t;if(e=this.session.hs.s,(t=this.log).enabled&&ro&&(t(`LOCAL_STATIC_PUBLIC_KEY ${(0,r5.B)(e.publicKey,"hex")}`),t(`LOCAL_STATIC_PRIVATE_KEY ${(0,r5.B)(e.privateKey,"hex")}`)),this.isInitiator){this.log.trace("Stage 0 - Initiator starting to send first message.");let e=this.xx.sendMessage(this.session,(0,rs.u)(0));await this.connection.write(new tR.H(e.ne,e.ciphertext)),this.log.trace("Stage 0 - Initiator finished sending first message."),nY(this.session.hs.e,this.log)}else{this.log.trace("Stage 0 - Responder waiting to receive first message...");let e=function(e){if(e.length<32)throw Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:e.subarray(0,32),ciphertext:e.subarray(32,e.length),ns:(0,rs.u)(0)}}((await this.connection.read()).subarray()),{valid:t}=this.xx.recvMessage(this.session,e);if(!t)throw new rJ("xx handshake stage 0 validation fail");this.log.trace("Stage 0 - Responder received first message."),nQ(this.session.hs.re,this.log)}}async exchange(){if(this.isInitiator){var e,t;this.log.trace("Stage 1 - Initiator waiting to receive first message from responder...");let r=function(e){if(e.length<80)throw Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:e.subarray(0,32),ns:e.subarray(32,80),ciphertext:e.subarray(80,e.length)}}((await this.connection.read()).subarray()),{plaintext:n,valid:i}=this.xx.recvMessage(this.session,r);if(!i)throw new rJ("xx handshake stage 1 validation fail");this.log.trace("Stage 1 - Initiator received the message."),nQ(this.session.hs.re,this.log),e=this.session.hs.rs,(t=this.log).enabled&&ro&&t(`REMOTE_STATIC_PUBLIC_KEY ${(0,r5.B)(e.subarray(),"hex")}`),this.log.trace("Initiator going to check remote's signature...");try{let e=eD.decode(n);this.remotePeer=this.remotePeer||await nH(e),await nq(this.session.hs.rs,e,this.remotePeer),this.setRemoteNoiseExtension(e.extensions)}catch(e){throw new rQ(`Error occurred while verifying signed payload: ${e.message}`)}this.log.trace("All good with the signature!")}else{this.log.trace("Stage 1 - Responder sending out first message with signed payload and static key.");let e=this.xx.sendMessage(this.session,this.payload);await this.connection.write(new tR.H(e.ne,e.ns,e.ciphertext)),this.log.trace("Stage 1 - Responder sent the second handshake message with signed payload."),nY(this.session.hs.e,this.log)}}async finish(){var e,t;if(this.isInitiator){this.log.trace("Stage 2 - Initiator sending third handshake message.");let e=this.xx.sendMessage(this.session,this.payload);await this.connection.write(new tR.H(e.ns,e.ciphertext)),this.log.trace("Stage 2 - Initiator sent message with signed payload.")}else{this.log.trace("Stage 2 - Responder waiting for third handshake message...");let e=function(e){if(e.length<48)throw Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:(0,rs.u)(0),ns:e.subarray(0,48),ciphertext:e.subarray(48,e.length)}}((await this.connection.read()).subarray()),{plaintext:t,valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new rJ("xx handshake stage 2 validation fail");this.log.trace("Stage 2 - Responder received the message, finished handshake.");try{let e=eD.decode(t);this.remotePeer=this.remotePeer||await nH(e),await nq(this.session.hs.rs,e,this.remotePeer),this.setRemoteNoiseExtension(e.extensions)}catch(e){throw new rQ(`Error occurred while verifying signed payload: ${e.message}`)}}e=this.session,(t=this.log).enabled&&ro&&(e.cs1&&e.cs2?(t(`CIPHER_STATE_1 ${e.cs1.n.getUint64()} ${(0,r5.B)(e.cs1.k,"hex")}`),t(`CIPHER_STATE_2 ${e.cs2.n.getUint64()} ${(0,r5.B)(e.cs2.k,"hex")}`)):t("Missing cipher state."))}encrypt(e,t){let r=this.getCS(t);return this.xx.encryptWithAd(r,(0,rs.u)(0),e)}decrypt(e,t,r){let n=this.getCS(t,!1);return this.xx.decryptWithAd(n,(0,rs.u)(0),e,r)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new rJ("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteNoiseExtension(e){e&&(this.remoteExtensions=e)}}class nX{protocol="/noise";crypto;prologue;staticKeys;extensions;metrics;components;constructor(e,t={}){let{staticNoiseKey:r,extensions:n,crypto:i,prologueBytes:s}=t,{metrics:o}=e;this.components=e,this.crypto=i??rG,this.extensions=n,this.metrics=o?{xxHandshakeSuccesses:o.registerCounter("libp2p_noise_xxhandshake_successes_total",{help:"Total count of noise xxHandshakes successes_"}),xxHandshakeErrors:o.registerCounter("libp2p_noise_xxhandshake_error_total",{help:"Total count of noise xxHandshakes errors"}),encryptedPackets:o.registerCounter("libp2p_noise_encrypted_packets_total",{help:"Total count of noise encrypted packets successfully"}),decryptedPackets:o.registerCounter("libp2p_noise_decrypted_packets_total",{help:"Total count of noise decrypted packets"}),decryptErrors:o.registerCounter("libp2p_noise_decrypt_errors_total",{help:"Total count of noise decrypt errors"})}:void 0,r?this.staticKeys=this.crypto.generateX25519KeyPairFromSeed(r):this.staticKeys=this.crypto.generateX25519KeyPair(),this.prologue=s??(0,rs.u)(0)}async secureOutbound(e,t,r){let n=rn(t,{lengthEncoder:rW,lengthDecoder:rY,maxDataLength:65535}),i=await this.performHandshake({connection:n,isInitiator:!0,localPeer:e,remotePeer:r}),s=await this.createSecureConnection(n,i);return t.source=s.source,t.sink=s.sink,{conn:t,remoteExtensions:i.remoteExtensions,remotePeer:i.remotePeer}}async secureInbound(e,t,r){let n=rn(t,{lengthEncoder:rW,lengthDecoder:rY,maxDataLength:65535}),i=await this.performHandshake({connection:n,isInitiator:!1,localPeer:e,remotePeer:r}),s=await this.createSecureConnection(n,i);return t.source=s.source,t.sink=s.sink,{conn:t,remotePeer:i.remotePeer,remoteExtensions:i.remoteExtensions}}async performHandshake(e){let t=await nK(e.localPeer,this.staticKeys.publicKey,this.extensions);return this.performXXHandshake(e,t)}async performXXHandshake(e,t){let{isInitiator:r,remotePeer:n,connection:i}=e,s=new nJ(this.components,r,t,this.prologue,this.crypto,this.staticKeys,i,n);try{await s.propose(),await s.exchange(),await s.finish(),this.metrics?.xxHandshakeSuccesses.increment()}catch(e){if(this.metrics?.xxHandshakeErrors.increment(),e instanceof Error)throw e.message=`Error occurred during XX handshake: ${e.message}`,e}return s}async createSecureConnection(e,t){var r,n;let[i,s]=function(){let e=ri(),t=ri();return[{source:e.source,sink:t.sink},{source:t.source,sink:e.sink}]}(),o=e.unwrap();return await (0,tg.z)(i,(r=this.metrics,async function*(e){for await(let n of e)for(let e=0;en.length&&(s=n.length),n instanceof Uint8Array?i=t.encrypt(n.subarray(e,s),t.session):i=t.encrypt(n.sublist(e,s),t.session),r?.encryptedPackets.increment(),yield new tR.H(rW(i.byteLength),i)}}),o,e=>(0,tf.J)(e,{lengthDecoder:rY}),(n=this.metrics,async function*(e){for await(let r of e)for(let e=0;er.length&&(i=r.length),i-16iA(iS(iy,ib),iy),iv=ib(),iw=iA(iS(iv,im,iv),iS(im,iv),iS(iv,im),iv,im);function iE(e){return function(t){let r;try{r=(0,n0.HM)(t)}catch(e){return!1}let n=e(r.protoNames());return null!==n&&(!0===n||!1===n?n:0===n.length)}}function iS(...e){function t(t){if(t.length(Array.isArray(r="function"==typeof e?e().partialMatch(t):e.partialMatch(t))&&(t=r),null===r)),r}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:iE(t),partialMatch:t}}function iA(...e){function t(t){let r=null;return e.some(e=>{let n="function"==typeof e?e().partialMatch(t):e.partialMatch(t);return null!=n&&(r=n,!0)}),r}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:iE(t),partialMatch:t}}function iI(e){return{toString:function(){return e},matches:function(t){let r;try{r=(0,n0.HM)(t)}catch(e){return!1}let n=r.protoNames();return 1===n.length&&n[0]===e},partialMatch:function(t){return 0===t.length?null:t[0]===e?t.slice(1):null}}}iA(iS(iv,iI("webrtc"),iI("p2p")),iS(iv,iI("webrtc")),iS(ig,iI("webrtc"),iI("p2p")),iS(ig,iI("webrtc")),iI("webrtc"));class i_ extends tQ.L{static tag="bootstrap";log;timer;list;timeout;components;_init;constructor(e,t={list:[]}){if(null==t.list||0===t.list.length)throw Error("Bootstrap requires a list of peer addresses");for(let r of(super(),this.components=e,this.log=e.logger.forComponent("libp2p:bootstrap"),this.timeout=t.timeout??1e3,this.list=[],t.list)){if(!iw.matches(r)){this.log.error("Invalid multiaddr");continue}let e=(0,n0.HM)(r),t=e.getPeerId();if(null==t){this.log.error("Invalid bootstrap multiaddr without peer id");continue}let n={id:(0,nF.jE)(t),multiaddrs:[e]};this.list.push(n)}this._init=t}[nZ.J]=this;[Symbol.toStringTag]="@libp2p/bootstrap";isStarted(){return!!this.timer}start(){this.isStarted()||(this.log("Starting bootstrap node discovery, discovering peers after %s ms",this.timeout),this.timer=setTimeout(()=>{this._discoverBootstrapPeers().catch(e=>{this.log.error(e)})},this.timeout))}async _discoverBootstrapPeers(){if(null!=this.timer)for(let e of this.list){if(await this.components.peerStore.merge(e.id,{tags:{[this._init.tagName??"bootstrap"]:{value:this._init.tagValue??50,ttl:this._init.tagTTL??12e4}}}),null==this.timer)return;this.safeDispatchEvent("peer",{detail:e})}}stop(){null!=this.timer&&clearTimeout(this.timer),this.timer=void 0}}var iT=r(5036);let iC=Uint8Array.from([3,1]);(M=(O=eB||(eB={})).AddressInfo||(O.AddressInfo={})).codec=()=>(null==u&&(u=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.multiaddr&&e.multiaddr.byteLength>0&&(t.uint32(10),t.bytes(e.multiaddr)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={multiaddr:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos>>3==1?r.multiaddr=e.bytes():e.skipType(7&t)}return r})),u),M.encode=e=>(0,ns.LE)(e,M.codec()),M.decode=e=>(0,ns.C6)(e,M.codec()),O.codec=()=>(null==c&&(c=(0,ns.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.peerId&&e.peerId.byteLength>0&&(t.uint32(10),t.bytes(e.peerId)),null!=e.seq&&0n!==e.seq&&(t.uint32(16),t.uint64(e.seq)),null!=e.addresses)for(let r of e.addresses)t.uint32(26),O.AddressInfo.codec().encode(r,t);!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={peerId:new Uint8Array(0),seq:0n,addresses:[]},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.peerId=e.bytes();break;case 2:r.seq=e.uint64();break;case 3:r.addresses.push(O.AddressInfo.codec().decode(e,e.uint32()));break;default:e.skipType(7&t)}}return r})),c),O.encode=e=>(0,ns.LE)(e,O.codec()),O.decode=e=>(0,ns.C6)(e,O.codec());class iR{static createFromProtobuf=e=>{let t=eB.decode(e);return new iR({peerId:(0,nF.cv)(t.peerId),multiaddrs:(t.addresses??[]).map(e=>(0,n0.HM)(e.multiaddr)),seqNumber:t.seq})};static DOMAIN="libp2p-peer-record";static CODEC=iC;peerId;multiaddrs;seqNumber;domain=iR.DOMAIN;codec=iR.CODEC;marshaled;constructor(e){let{peerId:t,multiaddrs:r,seqNumber:n}=e;this.peerId=t,this.multiaddrs=r??[],this.seqNumber=n??BigInt(Date.now())}marshal(){return null==this.marshaled&&(this.marshaled=eB.encode({peerId:this.peerId.toBytes(),seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map(e=>({multiaddr:e.bytes}))})),this.marshaled}equals(e){return!!(e instanceof iR&&this.peerId.equals(e.peerId)&&this.seqNumber===e.seqNumber&&function(e,t){let r=(e,t)=>e.toString().localeCompare(t.toString());return e.length===t.length&&(t.sort(r),e.sort(r).every((e,r)=>t[r].equals(e)))}(this.multiaddrs,e.multiaddrs))}}var ik=r(36408);let iP={ERR_SIGNATURE_NOT_VALID:"ERR_SIGNATURE_NOT_VALID"};(U=eN||(eN={})).codec=()=>(null==h&&(h=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.publicKey&&e.publicKey.byteLength>0&&(t.uint32(10),t.bytes(e.publicKey)),null!=e.payloadType&&e.payloadType.byteLength>0&&(t.uint32(18),t.bytes(e.payloadType)),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(26),t.bytes(e.payload)),null!=e.signature&&e.signature.byteLength>0&&(t.uint32(42),t.bytes(e.signature)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={publicKey:new Uint8Array(0),payloadType:new Uint8Array(0),payload:new Uint8Array(0),signature:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.publicKey=e.bytes();break;case 2:r.payloadType=e.bytes();break;case 3:r.payload=e.bytes();break;case 5:r.signature=e.bytes();break;default:e.skipType(7&t)}}return r})),h),U.encode=e=>(0,ns.LE)(e,U.codec()),U.decode=e=>(0,ns.C6)(e,U.codec());class iD{static createFromProtobuf=async e=>{let t=eN.decode(e);return new iD({peerId:await (0,nF.y5)(t.publicKey),payloadType:t.payloadType,payload:t.payload,signature:t.signature})};static seal=async(e,t)=>{if(null==t.privateKey)throw Error("Missing private key");let r=e.domain,n=e.codec,i=e.marshal(),s=iB(r,n,i),o=await (0,ik.r3)(t.privateKey);return new iD({peerId:t,payloadType:n,payload:i,signature:await o.sign(s.subarray())})};static openAndCertify=async(e,t)=>{let r=await iD.createFromProtobuf(e);if(!await r.validate(t))throw new rX.sv("envelope signature is not valid for the given domain",iP.ERR_SIGNATURE_NOT_VALID);return r};peerId;payloadType;payload;signature;marshaled;constructor(e){let{peerId:t,payloadType:r,payload:n,signature:i}=e;this.peerId=t,this.payloadType=r,this.payload=n,this.signature=i}marshal(){if(null==this.peerId.publicKey)throw Error("Missing public key");return null==this.marshaled&&(this.marshaled=eN.encode({publicKey:this.peerId.publicKey,payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(e){return(0,r4.f)(this.marshal(),e.marshal())}async validate(e){let t=iB(e,this.payloadType,this.payload);if(null==this.peerId.publicKey)throw Error("Missing public key");return(0,ik.lR)(this.peerId.publicKey).verify(t.subarray(),this.signature)}}let iB=(e,t,r)=>{let n=(0,r0.m)(e),i=rt.cv(n.byteLength),s=rt.cv(t.length),o=rt.cv(r.length);return new tR.H(i,n,s,t,o,r)};var iN=r(74369);let iL=e=>e.toString().split("/").slice(1),ix=e=>({match:t=>!(t.length<1)&&!!e(t[0])&&t.slice(1),pattern:"fn"}),iO=e=>({match:t=>ix(t=>t===e).match(t),pattern:e}),iM=()=>({match:e=>ix(e=>"string"==typeof e).match(e),pattern:"{string}"}),iU=()=>({match:e=>ix(e=>!isNaN(parseInt(e))).match(e),pattern:"{number}"}),iF=()=>({match:e=>{if(e.length<2||"p2p"!==e[0]&&"ipfs"!==e[0]||!(e[1].startsWith("Q")||e[1].startsWith("1")))return!1;try{r1.base58btc.decode(`z${e[1]}`)}catch(e){return!1}return e.slice(2)},pattern:"/p2p/{peerid}"}),iK=()=>({match:e=>{if(e.length<2||"certhash"!==e[0])return!1;try{nt.base64url.decode(e[1])}catch{return!1}return e.slice(2)},pattern:"/certhash/{certhash}"}),iV=e=>({match:t=>{let r=e.match(t);return!1===r?t:r},pattern:`optional(${e.pattern})`}),iH=(...e)=>({match:t=>{let r;for(let n of e){let e=n.match(t);!1!==e&&(null==r||e.lengthe.pattern).join(", ")})`}),i$=(...e)=>({match:t=>{for(let r of e){let e=r.match(t);if(!1===e)return!1;t=e}return t},pattern:`and(${e.map(e=>e.pattern).join(", ")})`});function iq(...e){function t(t){let r=iL(t);for(let t of e){let e=t.match(r);if(!1===e)return!1;r=e}return r}return{matches:function(e){return!1!==t(e)},exactMatch:function(e){let r=t(e);return!1!==r&&0===r.length}}}let iz=i$(iO("dns4"),iM()),ij=i$(iO("dns6"),iM()),iG=i$(iO("dnsaddr"),iM()),iW=i$(iO("dns"),iM());iq(iz),iq(ij),iq(iG),iq(iH(iW,iG,iz,ij));let iY=i$(iO("ip4"),ix(iN.C)),iQ=i$(iO("ip6"),ix(iN.aY)),iJ=iH(iY,iQ),iX=iH(iJ,iW,iz,ij,iG),iZ=iq(iX);iq(iY),iq(iQ),iq(iJ);let i0=i$(iX,iO("tcp"),iU()),i1=i$(iX,iO("udp"),iU()),i2=iH(i0,i1);iq(i0),iq(i1);let i3=i$(i1,iO("quic")),i4=i$(i1,iO("quic-v1")),i6=iH(i3,i4);iq(i3),iq(i4);let i5=iH(iX,i0,i1,i3,i4),i8=iH(i$(i5,iO("ws"),iV(iF())));iq(i8);let i9=iH(i$(i5,iO("wss"),iV(iF())),i$(i5,iO("tls"),iO("ws"),iV(iF())));iq(i9);let i7=i$(i2,iO("webrtc-direct"),iK(),iV(iK()),iV(iF()));iq(i7);let se=i$(i4,iO("webtransport"),iV(iK()),iV(iK()),iV(iF()));iq(se);let st=iH(i8,i9,i$(i0,iV(iF())),i$(i6,iV(iF())),i$(iX,iV(iF())),i7,se,iF());iq(st);let sr=iq(i$(st,iO("p2p-circuit"),iF()));function sn(e,t){let r=rn(e,t),n={read:async(e,t)=>{let n=await r.read(t);return e.decode(n)},write:async(e,t,n)=>{await r.write(t.encode(e),n)},writeV:async(e,t,n)=>{await r.writeV(e.map(e=>t.encode(e)),n)},pb:e=>({read:async t=>n.read(e,t),write:async(t,r)=>n.write(t,e,r),writeV:async(t,r)=>n.writeV(t,e,r),unwrap:()=>n}),unwrap:()=>r.unwrap()};return n}iq(iH(i$(st,iO("p2p-circuit"),iO("webrtc"),iF()),i$(st,iO("webrtc"),iV(iF())),iO("webrtc"))),iq(iH(i$(iX,iO("tcp"),iU(),iO("http"),iV(iF())),i$(iX,iO("http"),iV(iF())))),iq(iH(i$(iX,iO("tcp"),iH(i$(iO("443"),iO("http")),i$(iU(),iO("https"))),iV(iF())),i$(iX,iO("tls"),iO("http"),iV(iF())),i$(iX,iO("https"),iV(iF()))));var si=r(12471);let ss="object"==typeof window&&"object"==typeof document&&9===document.nodeType,so=si(),sa=ss&&!so,sl=so&&!ss,sc=so&&ss,su=void 0!==globalThis.process&&void 0!==globalThis.process.release&&"node"===globalThis.process.release.name&&!so,sh="function"==typeof importScripts&&"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;void 0!==globalThis.process&&void 0!==globalThis.process.env&&globalThis.process.env.NODE_ENV;let sd="undefined"!=typeof navigator&&"ReactNative"===navigator.product;(F=eL||(eL={})).codec=()=>(null==d&&(d=(0,ns.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.protocolVersion&&(t.uint32(42),t.string(e.protocolVersion)),null!=e.agentVersion&&(t.uint32(50),t.string(e.agentVersion)),null!=e.publicKey&&(t.uint32(10),t.bytes(e.publicKey)),null!=e.listenAddrs)for(let r of e.listenAddrs)t.uint32(18),t.bytes(r);if(null!=e.observedAddr&&(t.uint32(34),t.bytes(e.observedAddr)),null!=e.protocols)for(let r of e.protocols)t.uint32(26),t.string(r);null!=e.signedPeerRecord&&(t.uint32(66),t.bytes(e.signedPeerRecord)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={listenAddrs:[],protocols:[]},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 5:r.protocolVersion=e.string();break;case 6:r.agentVersion=e.string();break;case 1:r.publicKey=e.bytes();break;case 2:r.listenAddrs.push(e.bytes());break;case 4:r.observedAddr=e.bytes();break;case 3:r.protocols.push(e.string());break;case 8:r.signedPeerRecord=e.bytes();break;default:e.skipType(7&t)}}return r})),d),F.encode=e=>(0,ns.LE)(e,F.codec()),F.decode=e=>(0,ns.C6)(e,F.codec());let sp={protocolPrefix:"ipfs",timeout:6e4,maxInboundStreams:1,maxOutboundStreams:1,maxPushIncomingStreams:1,maxPushOutgoingStreams:1,maxObservedAddresses:10,maxIdentifyMessageSize:8192,runOnConnectionOpen:!0,runOnTransientConnection:!0};class sf{identifyProtocolStr;identifyPushProtocolStr;host;started;timeout;peerId;peerStore;registrar;connectionManager;addressManager;maxInboundStreams;maxOutboundStreams;maxPushIncomingStreams;maxPushOutgoingStreams;maxIdentifyMessageSize;maxObservedAddresses;events;runOnTransientConnection;log;constructor(e,t={}){this.started=!1,this.peerId=e.peerId,this.peerStore=e.peerStore,this.registrar=e.registrar,this.addressManager=e.addressManager,this.connectionManager=e.connectionManager,this.events=e.events,this.log=e.logger.forComponent("libp2p:identify"),this.identifyProtocolStr=`/${t.protocolPrefix??sp.protocolPrefix}/id/1.0.0`,this.identifyPushProtocolStr=`/${t.protocolPrefix??sp.protocolPrefix}/id/push/1.0.0`,this.timeout=t.timeout??sp.timeout,this.maxInboundStreams=t.maxInboundStreams??sp.maxInboundStreams,this.maxOutboundStreams=t.maxOutboundStreams??sp.maxOutboundStreams,this.maxPushIncomingStreams=t.maxPushIncomingStreams??sp.maxPushIncomingStreams,this.maxPushOutgoingStreams=t.maxPushOutgoingStreams??sp.maxPushOutgoingStreams,this.maxIdentifyMessageSize=t.maxIdentifyMessageSize??sp.maxIdentifyMessageSize,this.maxObservedAddresses=t.maxObservedAddresses??sp.maxObservedAddresses,this.runOnTransientConnection=t.runOnTransientConnection??sp.runOnTransientConnection,this.host={protocolVersion:`${t.protocolPrefix??sp.protocolPrefix}/0.1.0`,agentVersion:t.agentVersion??`${e.nodeInfo.name}/${e.nodeInfo.version}`},(t.runOnConnectionOpen??sp.runOnConnectionOpen)&&e.events.addEventListener("connection:open",e=>{let t=e.detail;this.identify(t).catch(e=>{this.log.error("error during identify trigged by connection:open",e)})}),e.events.addEventListener("self:peer:update",e=>{this.push().catch(e=>{this.log.error(e)})}),this.host.agentVersion===`${e.nodeInfo.name}/${e.nodeInfo.version}`&&(su||sl?this.host.agentVersion+=` UserAgent=${globalThis.process.version}`:(sa||sh||sc||sd)&&(this.host.agentVersion+=` UserAgent=${globalThis.navigator.userAgent}`))}isStarted(){return this.started}async start(){this.started||(await this.peerStore.merge(this.peerId,{metadata:{AgentVersion:(0,r0.m)(this.host.agentVersion),ProtocolVersion:(0,r0.m)(this.host.protocolVersion)}}),await this.registrar.handle(this.identifyProtocolStr,e=>{this._handleIdentify(e).catch(e=>{this.log.error(e)})},{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnTransientConnection:this.runOnTransientConnection}),await this.registrar.handle(this.identifyPushProtocolStr,e=>{this._handlePush(e).catch(e=>{this.log.error(e)})},{maxInboundStreams:this.maxPushIncomingStreams,maxOutboundStreams:this.maxPushOutgoingStreams,runOnTransientConnection:this.runOnTransientConnection}),this.started=!0)}async stop(){await this.registrar.unhandle(this.identifyProtocolStr),await this.registrar.unhandle(this.identifyPushProtocolStr),this.started=!1}async pushToConnections(e){let t=this.addressManager.getAddresses().map(e=>e.decapsulateCode((0,n0.a_)("p2p").code)),r=new iR({peerId:this.peerId,multiaddrs:t}),n=await iD.seal(r,this.peerId),i=this.registrar.getProtocols(),s=await this.peerStore.get(this.peerId),o=(0,r5.B)(s.metadata.get("AgentVersion")??(0,r0.m)(this.host.agentVersion)),a=(0,r5.B)(s.metadata.get("ProtocolVersion")??(0,r0.m)(this.host.protocolVersion)),l=e.map(async e=>{let r;let s=AbortSignal.timeout(this.timeout);(0,iT.W)(1/0,s);try{r=await e.newStream(this.identifyPushProtocolStr,{signal:s,runOnTransientConnection:this.runOnTransientConnection});let l=sn(r,{maxDataLength:this.maxIdentifyMessageSize??8192}).pb(eL);await l.write({listenAddrs:t.map(e=>e.bytes),signedPeerRecord:n.marshal(),protocols:i,agentVersion:o,protocolVersion:a},{signal:s}),await r.close({signal:s})}catch(e){this.log.error("could not push identify update to peer",e),r?.abort(e)}});await Promise.all(l)}async push(){if(!this.isStarted())return;let e=[];await Promise.all(this.connectionManager.getConnections().map(async t=>{try{if(!(await this.peerStore.get(t.remotePeer)).protocols.includes(this.identifyPushProtocolStr))return;e.push(t)}catch(e){if(e.code!==rX.Vc)throw e}})),await this.pushToConnections(e)}async _identify(e,t={}){let r;if(null==t.signal){let e=AbortSignal.timeout(this.timeout);(0,iT.W)(1/0,e),t={...t,signal:e}}try{r=await e.newStream(this.identifyProtocolStr,{...t,runOnTransientConnection:this.runOnTransientConnection});let n=sn(r,{maxDataLength:this.maxIdentifyMessageSize??8192}).pb(eL),i=await n.read(t);return await r.close(t),i}catch(e){throw this.log.error("error while reading identify message",e),r?.abort(e),e}}async identify(e,t={}){let r=await this._identify(e,t),{publicKey:n,protocols:i,observedAddr:s}=r;if(null==n)throw new rX.sv("public key was missing from identify message","ERR_MISSING_PUBLIC_KEY");let o=await (0,nF.y5)(n);if(!e.remotePeer.equals(o))throw new rX.sv("identified peer does not match the expected peer","ERR_INVALID_PEER");if(this.peerId.equals(o))throw new rX.sv("identified peer is our own peer id?","ERR_INVALID_PEER");let a=function(e){if(null!=e&&e.length>0)try{return(0,n0.HM)(e)}catch{}}(s);return this.log("identify completed for peer %p and protocols %o",o,i),this.log("our observed address is %a",a),null!=a&&this.addressManager.getObservedAddrs().length<(this.maxObservedAddresses??1/0)&&(this.log("storing our observed address %a",a),this.addressManager.addObservedAddr(a)),this.#s(e,r)}async _handleIdentify(e){let{connection:t,stream:r}=e,n=AbortSignal.timeout(this.timeout);(0,iT.W)(1/0,n);try{let e=this.peerId.publicKey??new Uint8Array(0),i=await this.peerStore.get(this.peerId),s=this.addressManager.getAddresses().map(e=>e.decapsulateCode((0,n0.a_)("p2p").code)),o=i.peerRecordEnvelope;if(s.length>0&&null==o){let e=new iR({peerId:this.peerId,multiaddrs:s});o=(await iD.seal(e,this.peerId)).marshal().subarray()}let a=t.remoteAddr.bytes;iZ.matches(t.remoteAddr)||(a=void 0);let l=sn(r).pb(eL);await l.write({protocolVersion:this.host.protocolVersion,agentVersion:this.host.agentVersion,publicKey:e,listenAddrs:s.map(e=>e.bytes),signedPeerRecord:o,observedAddr:a,protocols:i.protocols},{signal:n}),await r.close({signal:n})}catch(e){this.log.error("could not respond to identify request",e),r.abort(e)}}async _handlePush(e){let{connection:t,stream:r}=e;try{if(this.peerId.equals(t.remotePeer))throw Error("received push from ourselves?");let e={signal:AbortSignal.timeout(this.timeout)},n=sn(r,{maxDataLength:this.maxIdentifyMessageSize??8192}).pb(eL),i=await n.read(e);await r.close(e),await this.#s(t,i)}catch(e){this.log.error("received invalid message",e),r.abort(e);return}this.log("handled push from %p",t.remotePeer)}async #s(e,t){let r;if(this.log("received identify from %p",e.remotePeer),null==t)throw new rX.sv("message was null or undefined","ERR_INVALID_MESSAGE");let n={};if(t.listenAddrs.length>0&&(n.addresses=t.listenAddrs.map(e=>({isCertified:!1,multiaddr:(0,n0.HM)(e)}))),t.protocols.length>0&&(n.protocols=t.protocols),null!=t.publicKey&&(n.publicKey=t.publicKey,!(await (0,nF.y5)(t.publicKey)).equals(e.remotePeer)))throw new rX.sv("public key did not match remote PeerId","ERR_INVALID_PUBLIC_KEY");if(null!=t.signedPeerRecord){let i;this.log("received signedPeerRecord from %p",e.remotePeer);let s=t.signedPeerRecord,o=await iD.openAndCertify(s,iR.DOMAIN),a=iR.createFromProtobuf(o.payload);if(!a.peerId.equals(o.peerId))throw new rX.sv("signing key does not match PeerId in the PeerRecord","ERR_INVALID_SIGNING_KEY");if(!e.remotePeer.equals(a.peerId))throw new rX.sv("signing key does not match remote PeerId","ERR_INVALID_PEER_RECORD_KEY");try{i=await this.peerStore.get(a.peerId)}catch(e){if("ERR_NOT_FOUND"!==e.code)throw e}if(null!=i&&(n.metadata=i.metadata,null!=i.peerRecordEnvelope)){let e=await iD.createFromProtobuf(i.peerRecordEnvelope),t=iR.createFromProtobuf(e.payload);t.seqNumber>=a.seqNumber&&(this.log("sequence number was lower or equal to existing sequence number - stored: %d received: %d",t.seqNumber,a.seqNumber),a=t,s=i.peerRecordEnvelope)}n.peerRecordEnvelope=s,n.addresses=a.multiaddrs.map(e=>({isCertified:!0,multiaddr:e})),r={seq:a.seqNumber,addresses:a.multiaddrs}}else this.log("%p did not send a signed peer record",e.remotePeer);if(this.log("patching %p with",e.remotePeer,n),await this.peerStore.patch(e.remotePeer,n),null!=t.agentVersion||null!=t.protocolVersion){let r={};null!=t.agentVersion&&(r.AgentVersion=(0,r0.m)(t.agentVersion)),null!=t.protocolVersion&&(r.ProtocolVersion=(0,r0.m)(t.protocolVersion)),this.log("merging %p metadata",e.remotePeer,r),await this.peerStore.merge(e.remotePeer,{metadata:r})}let i={peerId:e.remotePeer,protocolVersion:t.protocolVersion,agentVersion:t.agentVersion,publicKey:t.publicKey,listenAddrs:t.listenAddrs.map(e=>(0,n0.HM)(e)),observedAddr:null==t.observedAddr?void 0:(0,n0.HM)(t.observedAddr),protocols:t.protocols,signedPeerRecord:r,connection:e};return this.events.safeDispatchEvent("peer:identify",{detail:i}),i}}function sg(e,t){let r=(function(e){if(null!=e){if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();if("function"==typeof e.next)return e}throw Error("argument is not an iterator or iterable")})(e).return?.();null!=r&&"function"==typeof r.then&&"function"==typeof r.catch&&"function"==typeof r.finally&&r.catch(e=>{t.error("could not cause iterator to return",e)})}let sm=()=>{let e=Error("Delay aborted");return e.name="AbortError",e},sy=new WeakMap,sb=function({clearTimeout:e,setTimeout:t}={}){return(r,{value:n,signal:i}={})=>{let s,o,a;if(i?.aborted)return Promise.reject(sm());let l=e??clearTimeout,c=()=>{l(s),a(sm())},u=()=>{i&&i.removeEventListener("abort",c)},h=new Promise((e,i)=>{o=()=>{u(),e(n)},a=i,s=(t??setTimeout)(o,r)});return i&&i.addEventListener("abort",c,{once:!0}),sy.set(h,()=>{l(s),s=null,o()}),h}}();class sv{memoryStorage;points;duration;blockDuration;execEvenly;execEvenlyMinDelayMs;keyPrefix;constructor(e={}){this.points=e.points??4,this.duration=e.duration??1,this.blockDuration=e.blockDuration??0,this.execEvenly=e.execEvenly??!1,this.execEvenlyMinDelayMs=e.execEvenlyMinDelayMs??1e3*this.duration/this.points,this.keyPrefix=e.keyPrefix??"rlflx",this.memoryStorage=new sw}async consume(e,t=1,r={}){let n=this.getKey(e),i=this._getKeySecDuration(r),s=this.memoryStorage.incrby(n,t,i);if(s.remainingPoints=Math.max(this.points-s.consumedPoints,0),s.consumedPoints>this.points)throw this.blockDuration>0&&s.consumedPoints<=this.points+t&&(s=this.memoryStorage.set(n,s.consumedPoints,this.blockDuration)),new rX.sv("Rate limit exceeded","ERR_RATE_LIMIT_EXCEEDED",s);if(this.execEvenly&&s.msBeforeNext>0&&!s.isFirstInDuration){let e=Math.ceil(s.msBeforeNext/(s.remainingPoints+2));e=0?r:this.duration)*1e3;return this.memoryStorage.set(this.getKey(e),t,r),{remainingPoints:0,msBeforeNext:0===n?-1:n,consumedPoints:t,isFirstInDuration:!1}}get(e){let t=this.memoryStorage.get(this.getKey(e));return null!=t&&(t.remainingPoints=Math.max(this.points-t.consumedPoints,0)),t}delete(e){this.memoryStorage.delete(this.getKey(e))}_getKeySecDuration(e){return e?.customDuration!=null&&e.customDuration>=0?e.customDuration:this.duration}getKey(e){return this.keyPrefix.length>0?`${this.keyPrefix}:${e}`:e}parseKey(e){return e.substring(this.keyPrefix.length)}}class sw{storage;constructor(){this.storage=new Map}incrby(e,t,r){let n=this.storage.get(e);if(null!=n){let e=null!=n.expiresAt?n.expiresAt.getTime()-new Date().getTime():-1;if(null==n.expiresAt||e>0)return n.value+=t,{remainingPoints:0,msBeforeNext:e,consumedPoints:n.value,isFirstInDuration:!1}}return this.set(e,t,r)}set(e,t,r){let n=1e3*r,i=this.storage.get(e);null!=i&&clearTimeout(i.timeoutId);let s={value:t,expiresAt:n>0?new Date(Date.now()+n):void 0};return this.storage.set(e,s),n>0&&(s.timeoutId=setTimeout(()=>{this.storage.delete(e)},n),null!=s.timeoutId.unref&&s.timeoutId.unref()),{remainingPoints:0,msBeforeNext:0===n?-1:n,consumedPoints:s.value,isFirstInDuration:!0}}get(e){let t=this.storage.get(e);if(null!=t)return{remainingPoints:0,msBeforeNext:null!=t.expiresAt?t.expiresAt.getTime()-new Date().getTime():-1,consumedPoints:t.value,isFirstInDuration:!1}}delete(e){let t=this.storage.get(e);return null!=t&&(null!=t.timeoutId&&clearTimeout(t.timeoutId),this.storage.delete(e),!0)}}var sE=r(35605);(K=ex||(ex={}))[K.NEW_STREAM=0]="NEW_STREAM",K[K.MESSAGE_RECEIVER=1]="MESSAGE_RECEIVER",K[K.MESSAGE_INITIATOR=2]="MESSAGE_INITIATOR",K[K.CLOSE_RECEIVER=3]="CLOSE_RECEIVER",K[K.CLOSE_INITIATOR=4]="CLOSE_INITIATOR",K[K.RESET_RECEIVER=5]="RESET_RECEIVER",K[K.RESET_INITIATOR=6]="RESET_INITIATOR";let sS=Object.freeze({0:"NEW_STREAM",1:"MESSAGE_RECEIVER",2:"MESSAGE_INITIATOR",3:"CLOSE_RECEIVER",4:"CLOSE_INITIATOR",5:"RESET_RECEIVER",6:"RESET_INITIATOR"}),sA=Object.freeze({NEW_STREAM:ex.NEW_STREAM,MESSAGE:ex.MESSAGE_INITIATOR,CLOSE:ex.CLOSE_INITIATOR,RESET:ex.RESET_INITIATOR}),sI=Object.freeze({MESSAGE:ex.MESSAGE_RECEIVER,CLOSE:ex.CLOSE_RECEIVER,RESET:ex.RESET_RECEIVER});class s_{_buffer;_headerInfo;_maxMessageSize;_maxUnprocessedMessageQueueSize;constructor(e=1048576,t=4194304){this._buffer=new tR.H,this._headerInfo=null,this._maxMessageSize=e,this._maxUnprocessedMessageQueueSize=t}write(e){if(null==e||0===e.length)return[];if(this._buffer.append(e),this._buffer.byteLength>this._maxUnprocessedMessageQueueSize)throw Object.assign(Error("unprocessed message queue size too large!"),{code:"ERR_MSG_QUEUE_TOO_BIG"});let t=[];for(;0!==this._buffer.length;){if(null==this._headerInfo)try{this._headerInfo=this._decodeHeader(this._buffer)}catch(e){if("ERR_MSG_TOO_BIG"===e.code)throw e;break}let{id:e,type:r,length:n,offset:i}=this._headerInfo;if(this._buffer.length-ithis._maxMessageSize)throw Object.assign(Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"});return{id:t>>3,type:s,offset:r+i,length:n}}}function sT(e,t=0){let r,n=0,i=0,s=t,o=e.length;do{if(s>=o||i>49)throw t=0,RangeError("Could not decode varint");r=e.get(s++),n+=i<28?(127&r)<=128);return{value:n,offset:t=s-t}}class sC{_pool;_poolOffset;constructor(){this._pool=(0,rs.E)(10240),this._poolOffset=0}write(e,t){let r=this._pool,n=this._poolOffset;rt.cv(e.id<<3|e.type,r,n),n+=rt.P$(e.id<<3|e.type),(e.type===ex.NEW_STREAM||e.type===ex.MESSAGE_INITIATOR||e.type===ex.MESSAGE_RECEIVER)&&null!=e.data?(rt.cv(e.data.length,r,n),n+=rt.P$(e.data.length)):(rt.cv(0,r,n),n+=rt.P$(0));let i=r.subarray(this._poolOffset,n);10240-n<100?(this._pool=(0,rs.E)(10240),this._poolOffset=0):this._poolOffset=n,t.append(i),(e.type===ex.NEW_STREAM||e.type===ex.MESSAGE_INITIATOR||e.type===ex.MESSAGE_RECEIVER)&&null!=e.data&&t.append(e.data)}}let sR=new sC;async function*sk(e){for await(let t of e){let e=new tR.H;sR.write(t,e),yield e}}function sP(e){return null!=e&&"function"==typeof e.then&&"function"==typeof e.catch&&"function"==typeof e.finally}class sD{id;direction;timeline;protocol;metadata;source;status;readStatus;writeStatus;log;sinkController;sinkEnd;closed;endErr;streamSource;onEnd;onCloseRead;onCloseWrite;onReset;onAbort;sendCloseWriteTimeout;sendingData;constructor(e){this.sinkController=new AbortController,this.sinkEnd=(0,t6.Z)(),this.closed=(0,t6.Z)(),this.log=e.log,this.status="open",this.readStatus="ready",this.writeStatus="ready",this.id=e.id,this.metadata=e.metadata??{},this.direction=e.direction,this.timeline={open:Date.now()},this.sendCloseWriteTimeout=e.sendCloseWriteTimeout??5e3,this.onEnd=e.onEnd,this.onCloseRead=e?.onCloseRead,this.onCloseWrite=e?.onCloseWrite,this.onReset=e?.onReset,this.onAbort=e?.onAbort,this.source=this.streamSource=(0,sE.dT)({onEnd:e=>{null!=e?this.log.trace("source ended with error",e):this.log.trace("source ended"),this.onSourceEnd(e)}}),this.sink=this.sink.bind(this)}async sink(e){if("ready"!==this.writeStatus)throw new rX.sv(`writable end state is "${this.writeStatus}" not "ready"`,"ERR_SINK_INVALID_STATE");try{this.writeStatus="writing";let t={signal:this.sinkController.signal};if("outbound"===this.direction){let e=this.sendNewStream(t);sP(e)&&await e}let r=()=>{sg(e,this.log)};try{for await(let n of(this.sinkController.signal.addEventListener("abort",r),this.log.trace("sink reading from source"),e)){n=n instanceof Uint8Array?new tR.H(n):n;let e=this.sendData(n,t);sP(e)&&(this.sendingData=(0,t6.Z)(),await e,this.sendingData.resolve(),this.sendingData=void 0)}}finally{this.sinkController.signal.removeEventListener("abort",r)}this.log.trace('sink finished reading from source, write status is "%s"',this.writeStatus),"writing"===this.writeStatus&&(this.writeStatus="closing",this.log.trace("send close write to remote"),await this.sendCloseWrite({signal:AbortSignal.timeout(this.sendCloseWriteTimeout)}),this.writeStatus="closed"),this.onSinkEnd()}catch(e){throw this.log.trace("sink ended with error, calling abort with error",e),this.abort(e),e}finally{this.log.trace("resolve sink end"),this.sinkEnd.resolve()}}onSourceEnd(e){null==this.timeline.closeRead&&(this.timeline.closeRead=Date.now(),this.readStatus="closed",null!=e&&null==this.endErr&&(this.endErr=e),this.onCloseRead?.(),null!=this.timeline.closeWrite?(this.log.trace("source and sink ended"),this.timeline.close=Date.now(),"aborted"!==this.status&&"reset"!==this.status&&(this.status="closed"),null!=this.onEnd&&this.onEnd(this.endErr),this.closed.resolve()):this.log.trace("source ended, waiting for sink to end"))}onSinkEnd(e){null==this.timeline.closeWrite&&(this.timeline.closeWrite=Date.now(),this.writeStatus="closed",null!=e&&null==this.endErr&&(this.endErr=e),this.onCloseWrite?.(),null!=this.timeline.closeRead?(this.log.trace("sink and source ended"),this.timeline.close=Date.now(),"aborted"!==this.status&&"reset"!==this.status&&(this.status="closed"),null!=this.onEnd&&this.onEnd(this.endErr),this.closed.resolve()):this.log.trace("sink ended, waiting for source to end"))}async close(e){this.log.trace("closing gracefully"),this.status="closing",await t8(Promise.all([this.closeWrite(e),this.closeRead(e),this.closed.promise]),e?.signal),this.status="closed",this.log.trace("closed gracefully")}async closeRead(e={}){if("closing"===this.readStatus||"closed"===this.readStatus)return;this.log.trace('closing readable end of stream with starting read status "%s"',this.readStatus);let t=this.readStatus;this.readStatus="closing","reset"!==this.status&&"aborted"!==this.status&&null==this.timeline.closeRead&&(this.log.trace("send close read to remote"),await this.sendCloseRead(e)),"ready"===t&&(this.log.trace("ending internal source queue with %d queued bytes",this.streamSource.readableLength),this.streamSource.end()),this.log.trace("closed readable end of stream")}async closeWrite(e={}){"closing"!==this.writeStatus&&"closed"!==this.writeStatus&&(this.log.trace('closing writable end of stream with starting write status "%s"',this.writeStatus),"ready"===this.writeStatus&&(this.log.trace("sink was never sunk, sink an empty array"),await t8(this.sink([]),e.signal)),"writing"===this.writeStatus&&(null!=this.sendingData&&await t8(this.sendingData.promise,e.signal),this.log.trace("aborting source passed to .sink"),this.sinkController.abort(),await t8(this.sinkEnd.promise,e.signal)),this.writeStatus="closed",this.log.trace("closed writable end of stream"))}abort(e){if("closed"===this.status||"aborted"===this.status||"reset"===this.status)return;this.log("abort with error",e),this.log("try to send reset to remote");let t=this.sendReset();sP(t)&&t.catch(e=>{this.log.error("error sending reset message",e)}),this.status="aborted",this.timeline.abort=Date.now(),this._closeSinkAndSource(e),this.onAbort?.(e)}reset(){if("closed"===this.status||"aborted"===this.status||"reset"===this.status)return;let e=new rX.sv("stream reset","ERR_STREAM_RESET");this.status="reset",this.timeline.reset=Date.now(),this._closeSinkAndSource(e),this.onReset?.()}_closeSinkAndSource(e){this._closeSink(e),this._closeSource(e)}_closeSink(e){"writing"===this.writeStatus&&(this.log.trace("end sink source"),this.sinkController.abort()),this.onSinkEnd(e)}_closeSource(e){"closing"!==this.readStatus&&"closed"!==this.readStatus&&(this.log.trace("ending source with %d bytes to be read by consumer",this.streamSource.readableLength),this.readStatus="closing",this.streamSource.end(e))}remoteCloseWrite(){if("closing"===this.readStatus||"closed"===this.readStatus){this.log("received remote close write but local source is already closed");return}this.log.trace("remote close write"),this._closeSource()}remoteCloseRead(){if("closing"===this.writeStatus||"closed"===this.writeStatus){this.log("received remote close read but local sink is already closed");return}this.log.trace("remote close read"),this._closeSink()}destroy(){if("closed"===this.status||"aborted"===this.status||"reset"===this.status){this.log("received destroy but we are already closed");return}this.log.trace("stream destroyed"),this._closeSinkAndSource()}sourcePush(e){this.streamSource.push(e)}sourceReadableLength(){return this.streamSource.readableLength}}class sB extends sD{name;streamId;send;types;maxDataSize;constructor(e){super(e),this.types="outbound"===e.direction?sA:sI,this.send=e.send,this.name=e.name,this.streamId=e.streamId,this.maxDataSize=e.maxDataSize}async sendNewStream(){await this.send({id:this.streamId,type:sA.NEW_STREAM,data:new tR.H((0,r0.m)(this.name))})}async sendData(e){for(e=e.sublist();e.byteLength>0;){let t=Math.min(e.byteLength,this.maxDataSize);await this.send({id:this.streamId,type:this.types.MESSAGE,data:e.sublist(0,t)}),e.consume(t)}}async sendReset(){await this.send({id:this.streamId,type:this.types.RESET})}async sendCloseWrite(){await this.send({id:this.streamId,type:this.types.CLOSE})}async sendCloseRead(){}}function sN(e){let t={...e,type:`${sS[e.type]} (${e.type})`};return e.type===ex.NEW_STREAM&&(t.data=(0,r5.B)(e.data instanceof Uint8Array?e.data:e.data.subarray())),(e.type===ex.MESSAGE_INITIATOR||e.type===ex.MESSAGE_RECEIVER)&&(t.data=(0,r5.B)(e.data instanceof Uint8Array?e.data:e.data.subarray(),"base16")),t}class sL{protocol="/mplex/6.7.0";sink;source;log;_streamId;_streams;_init;_source;closeController;rateLimiter;closeTimeout;logger;constructor(e,t){t=t??{},this.log=e.logger.forComponent("libp2p:mplex"),this.logger=e.logger,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._init=t,this.closeTimeout=t.closeTimeout??500,this.sink=this._createSink(),this._source=(0,sE.dT)({objectMode:!0,onEnd:()=>{for(let e of this._streams.initiators.values())e.destroy();for(let e of this._streams.receivers.values())e.destroy()}}),this.source=(0,tg.z)(this._source,e=>sk(e)),this.closeController=new AbortController,this.rateLimiter=new sv({points:t.disconnectThreshold??5,duration:1})}get streams(){let e=[];for(let t of this._streams.initiators.values())e.push(t);for(let t of this._streams.receivers.values())e.push(t);return e}newStream(e){if(this.closeController.signal.aborted)throw Error("Muxer already closed");let t=this._streamId++;e=null==e?t.toString():e.toString();let r=this._streams.initiators;return this._newStream({id:t,name:e,type:"initiator",registry:r})}async close(e){if(this.closeController.signal.aborted)return;let t=e?.signal??AbortSignal.timeout(this.closeTimeout);try{await Promise.all(this.streams.map(async e=>e.close({signal:t}))),this._source.end(),await this._source.onEmpty({signal:t}),this.closeController.abort()}catch(e){this.abort(e)}}abort(e){this.closeController.signal.aborted||(this.streams.forEach(t=>{t.abort(e)}),this.closeController.abort(e))}_newReceiverStream(e){let{id:t,name:r}=e,n=this._streams.receivers;return this._newStream({id:t,name:r,type:"receiver",registry:n})}_newStream(e){let{id:t,name:r,type:n,registry:i}=e;if(this.log("new %s stream %s",n,t),"initiator"===n&&this._streams.initiators.size===(this._init.maxOutboundStreams??1024))throw new rX.sv("Too many outbound streams open","ERR_TOO_MANY_OUTBOUND_STREAMS");if(i.has(t))throw Error(`${n} stream ${t} already exists!`);let s=async e=>{this.log.enabled&&this.log.trace("%s stream %s send",n,t,sN(e)),this._source.push(e)},o=function(e){let{id:t,name:r,send:n,onEnd:i,type:s="initiator",maxMsgSize:o=1048576}=e;return new sB({id:"initiator"===s?`i${t}`:`r${t}`,streamId:t,name:`${null==r?t:r}`,direction:"initiator"===s?"outbound":"inbound",maxDataSize:o,onEnd:i,send:n,log:e.logger.forComponent(`libp2p:mplex:stream:${s}:${t}`)})}({id:t,name:r,send:s,type:n,onEnd:()=>{this.log("%s stream with id %s and protocol %s ended",n,t,o.protocol),i.delete(t),null!=this._init.onStreamEnd&&this._init.onStreamEnd(o)},maxMsgSize:this._init.maxMsgSize,logger:this.logger});return i.set(t,o),o}_createSink(){return async e=>{let t=()=>{sg(e,this.log)};this.closeController.signal.addEventListener("abort",t);try{let t=new s_(this._init.maxMsgSize,this._init.maxUnprocessedMessageQueueSize);for await(let r of e)for(let e of t.write(r))await this._handleIncoming(e);this._source.end()}catch(e){this.log("error in sink",e),this._source.end(e)}finally{this.closeController.signal.removeEventListener("abort",t)}}}async _handleIncoming(e){let{id:t,type:r}=e;if(this.log.enabled&&this.log.trace("incoming message",sN(e)),e.type===ex.NEW_STREAM){if(this._streams.receivers.size===(this._init.maxInboundStreams??1024)){this.log("too many inbound streams open"),this._source.push({id:t,type:ex.RESET_RECEIVER});try{await this.rateLimiter.consume("new-stream",1)}catch{this.log("rate limit hit when opening too many new streams over the inbound stream limit - closing remote connection"),this.abort(Error("Too many open streams"))}return}let r=this._newReceiverStream({id:t,name:(0,r5.B)(e.data instanceof Uint8Array?e.data:e.data.subarray())});null!=this._init.onIncomingStream&&this._init.onIncomingStream(r);return}let n=((1&r)==1?this._streams.initiators:this._streams.receivers).get(t);if(null==n){this.log("missing stream %s for message type %s",t,sS[r]);try{await this.rateLimiter.consume("missing-stream",1)}catch{this.log("rate limit hit when receiving messages for streams that do not exist - closing remote connection"),this.abort(Error("Too many messages for missing streams"))}return}let i=this._init.maxStreamBufferSize??4194304;try{switch(r){case ex.MESSAGE_INITIATOR:case ex.MESSAGE_RECEIVER:if(n.sourceReadableLength()>i)throw this._source.push({id:e.id,type:r===ex.MESSAGE_INITIATOR?ex.RESET_RECEIVER:ex.RESET_INITIATOR}),new rX.sv("Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers","ERR_STREAM_INPUT_BUFFER_FULL");n.sourcePush(e.data);break;case ex.CLOSE_INITIATOR:case ex.CLOSE_RECEIVER:n.remoteCloseWrite();break;case ex.RESET_INITIATOR:case ex.RESET_RECEIVER:n.reset();break;default:this.log("unknown message type %s",r)}}catch(e){this.log.error("error while processing message",e),n.abort(e)}}}class sx{protocol="/mplex/6.7.0";_init;components;constructor(e,t={}){this.components=e,this._init=t}createStreamMuxer(e={}){return new sL(this.components,{...e,...this._init})}}var sO=r(34018),sM=function(e){if(null!=e[Symbol.asyncIterator])return(async()=>{for await(let t of e)return t})();for(let t of e)return t};let sU="ERR_WRONG_PING_ACK";class sF{protocol;components;started;timeout;maxInboundStreams;maxOutboundStreams;runOnTransientConnection;log;constructor(e,t={}){this.components=e,this.log=e.logger.forComponent("libp2p:ping"),this.started=!1,this.protocol=`/${t.protocolPrefix??"ipfs"}/ping/1.0.0`,this.timeout=t.timeout??1e4,this.maxInboundStreams=t.maxInboundStreams??2,this.maxOutboundStreams=t.maxOutboundStreams??1,this.runOnTransientConnection=t.runOnTransientConnection??!0,this.handleMessage=this.handleMessage.bind(this)}async start(){await this.components.registrar.handle(this.protocol,this.handleMessage,{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnTransientConnection:this.runOnTransientConnection}),this.started=!0}async stop(){await this.components.registrar.unhandle(this.protocol),this.started=!1}isStarted(){return this.started}handleMessage(e){this.log("incoming ping from %p",e.connection.remotePeer);let{stream:t}=e,r=Date.now();(0,tg.z)(t,t).catch(t=>{this.log.error("incoming ping from %p failed with error",e.connection.remotePeer,t)}).finally(()=>{let t=Date.now()-r;this.log("incoming ping from %p complete in %dms",e.connection.remotePeer,t)})}async ping(e,t={}){let r;this.log("pinging %p",e);let n=Date.now(),i=(0,sO.Z)(32),s=await this.components.connectionManager.openConnection(e,t),o=()=>{};if(null==t.signal){let e=AbortSignal.timeout(this.timeout);t={...t,signal:e}}try{r=await s.newStream(this.protocol,{...t,runOnTransientConnection:this.runOnTransientConnection}),o=()=>{r?.abort(new rX.sv("ping timeout",rX.l9))},t.signal?.addEventListener("abort",o,{once:!0});let e=await (0,tg.z)([i],r,async e=>sM(e)),a=Date.now()-n;if(null==e)throw new rX.sv(`Did not receive a ping ack after ${a}ms`,sU);if(!(0,r4.f)(i,e.subarray()))throw new rX.sv(`Received wrong ping ack after ${a}ms`,sU);return this.log("ping %p complete in %dms",s.remotePeer,a),a}catch(e){throw this.log.error("error while pinging %p",s.remotePeer,e),r?.abort(e),e}finally{t.signal?.removeEventListener("abort",o),null!=r&&await r.close()}}}let sK=Symbol.for("@libp2p/transport");(V=eO||(eO={}))[V.FATAL_ALL=0]="FATAL_ALL",V[V.NO_FATAL=1]="NO_FATAL";let sV=[(0,n0.a_)("tcp").code,(0,n0.a_)("dns").code,(0,n0.a_)("dnsaddr").code,(0,n0.a_)("dns4").code,(0,n0.a_)("dns6").code];function sH(e){let t;try{t=(0,n0.a_)("sni").code}catch(e){return null}for(let[r,n]of e)if(r===t&&void 0!==n)return n;return null}function s$(e){return e.some(([e,t])=>e===(0,n0.a_)("tls").code)}function sq(e,t,r){let n=sz[(0,n0.a_)(e).name];if(void 0===n)throw Error(`Can't interpret protocol ${(0,n0.a_)(e).name}`);let i=n(t,r);return e===(0,n0.a_)("ip6").code?`[${i}]`:i}let sz={ip4:(e,t)=>e,ip6:(e,t)=>0===t.length?e:`[${e}]`,tcp:(e,t)=>{let r=t.pop();if(void 0===r)throw Error("Unexpected end of multiaddr");return`tcp://${sq(r[0],r[1]??"",t)}:${e}`},udp:(e,t)=>{let r=t.pop();if(void 0===r)throw Error("Unexpected end of multiaddr");return`udp://${sq(r[0],r[1]??"",t)}:${e}`},dnsaddr:(e,t)=>e,dns4:(e,t)=>e,dns6:(e,t)=>e,dns:(e,t)=>e,ipfs:(e,t)=>{let r=t.pop();if(void 0===r)throw Error("Unexpected end of multiaddr");return`${sq(r[0],r[1]??"",t)}/ipfs/${e}`},p2p:(e,t)=>{let r=t.pop();if(void 0===r)throw Error("Unexpected end of multiaddr");return`${sq(r[0],r[1]??"",t)}/p2p/${e}`},http:(e,t)=>{let r=s$(t),n=sH(t);if(r&&null!==n)return`https://${n}`;let i=t.pop();if(void 0===i)throw Error("Unexpected end of multiaddr");let s=sq(i[0],i[1]??"",t);return s=s.replace("tcp://",""),`${r?"https://":"http://"}${s}`},tls:(e,t)=>{let r=t.pop();if(void 0===r)throw Error("Unexpected end of multiaddr");return sq(r[0],r[1]??"",t)},sni:(e,t)=>{let r=t.pop();if(void 0===r)throw Error("Unexpected end of multiaddr");return sq(r[0],r[1]??"",t)},https:(e,t)=>{let r=t.pop();if(void 0===r)throw Error("Unexpected end of multiaddr");let n=sq(r[0],r[1]??"",t);return n=n.replace("tcp://",""),`https://${n}`},ws:(e,t)=>{let r=s$(t),n=sH(t);if(r&&null!==n)return`wss://${n}`;let i=t.pop();if(void 0===i)throw Error("Unexpected end of multiaddr");let s=sq(i[0],i[1]??"",t);return s=s.replace("tcp://",""),`${r?"wss://":"ws://"}${s}`},wss:(e,t)=>{let r=t.pop();if(void 0===r)throw Error("Unexpected end of multiaddr");let n=sq(r[0],r[1]??"",t);return n=n.replace("tcp://",""),`wss://${n}`},"p2p-websocket-star":(e,t)=>{let r=t.pop();if(void 0===r)throw Error("Unexpected end of multiaddr");return`${sq(r[0],r[1]??"",t)}/p2p-websocket-star`},"p2p-webrtc-star":(e,t)=>{let r=t.pop();if(void 0===r)throw Error("Unexpected end of multiaddr");return`${sq(r[0],r[1]??"",t)}/p2p-webrtc-star`},"p2p-webrtc-direct":(e,t)=>{let r=t.pop();if(void 0===r)throw Error("Unexpected end of multiaddr");return`${sq(r[0],r[1]??"",t)}/p2p-webrtc-direct`}};var sj=async e=>{if(e.readyState>=2)throw Error("socket closed");1!==e.readyState&&await new Promise((t,r)=>{function n(){e.removeEventListener("open",i),e.removeEventListener("error",s)}function i(){n(),t()}function s(t){n(),r(t.error??Error(`connect ECONNREFUSED ${e.url}`))}e.addEventListener("open",i),e.addEventListener("error",s)})},sG=(e,t)=>((t=t??{}).closeOnEnd=!1!==t.closeOnEnd,async r=>{for await(let t of r){try{await sj(e)}catch(e){if("socket closed"===e.message)break;throw e}if(e.readyState===e.CLOSING||e.readyState===e.CLOSED)break;e.send(t)}null!=t.closeOnEnd&&e.readyState<=1&&await new Promise((t,r)=>{e.addEventListener("close",e=>{e.wasClean||1006===e.code?t():r(Object.assign(Error("ws error"),{event:e}))}),setTimeout(()=>{e.close()})})}),sW=r(44377);function sY(e){return e instanceof ArrayBuffer||e?.constructor?.name==="ArrayBuffer"&&"number"==typeof e?.byteLength}var sQ=e=>{let t;e.binaryType="arraybuffer";let r=async()=>{await new Promise((r,n)=>{if(i){r();return}if(null!=t){n(t);return}let s=t=>{e.removeEventListener("open",o),e.removeEventListener("error",a),t()},o=()=>{s(r)},a=t=>{s(()=>{n(t.error??Error(`connect ECONNREFUSED ${e.url}`))})};e.addEventListener("open",o),e.addEventListener("error",a)})},n=async function*(){let t=new sW.zN(({push:t,stop:r,fail:n})=>{let i=e=>{let r=null;"string"==typeof e.data&&(r=(0,r0.m)(e.data)),sY(e.data)&&(r=new Uint8Array(e.data)),e.data instanceof Uint8Array&&(r=e.data),null!=r&&t(r)},s=e=>{n(e.error??Error("Socket error"))};return e.addEventListener("message",i),e.addEventListener("error",s),e.addEventListener("close",r),()=>{e.removeEventListener("message",i),e.removeEventListener("error",s),e.removeEventListener("close",r)}},{highWaterMark:1/0});for await(let e of(await r(),t))yield sY(e)?new Uint8Array(e):e}(),i=1===e.readyState;return e.addEventListener("open",()=>{i=!0,t=null}),e.addEventListener("close",()=>{i=!1,t=null}),e.addEventListener("error",r=>{i||(t=r.error??Error(`connect ECONNREFUSED ${e.url}`))}),Object.assign(n,{connected:r})},sJ=(e,t)=>{t=t??{};let r=sQ(e),n=t.remoteAddress,i=t.remotePort;if(null!=e.url)try{let t=new URL(e.url);n=t.hostname,i=parseInt(t.port,10)}catch{}if(null==n||null==i)throw Error("Remote connection did not have address and/or port");return{sink:sG(e,t),source:r,connected:async()=>{await r.connected()},close:async()=>{(e.readyState===e.CONNECTING||e.readyState===e.OPEN)&&await new Promise(t=>{e.addEventListener("close",()=>{t()}),e.close()})},destroy:()=>{null!=e.terminate?e.terminate():e.close()},remoteAddress:n,remotePort:i,socket:e}},sX=WebSocket;let sZ={"http:":"ws:","https:":"wss:"};var s0=(e,t)=>{if(e.startsWith("//")&&(e=`${t?.protocol??"ws:"}${e}`),e.startsWith("/")&&null!=t){let r=t.protocol??"ws:",n=t.host,i=null!=t.port&&n?.endsWith(`:${t.port}`)!==!0?`:${t.port}`:"";e=`${r}//${n}${i}${e}`}let r=new URL(e);for(let[e,t]of Object.entries(sZ))r.protocol===e&&(r.protocol=t);return r};function s1(e){return e.filter(e=>{if(e.protoCodes().includes(290))return!1;let t=e.decapsulateCode(421);return ir.matches(t)||is.matches(t)})}class s2{log;init;logger;constructor(e,t){this.log=e.logger.forComponent("libp2p:websockets"),this.logger=e.logger,this.init=t}[Symbol.toStringTag]="@libp2p/websockets";[sK]=!0;async dial(e,t){this.log("dialing %s",e),t=t??{};let r=function(e,t,r){let n=r.logger.forComponent("libp2p:websockets:maconn"),i={log:n,async sink(t){try{await e.sink(async function*(){for await(let e of t)e instanceof Uint8Array?yield e:yield e.subarray()}())}catch(e){"aborted"!==e.type&&n.error(e)}},source:e.source,remoteAddr:t,timeline:{open:Date.now()},async close(t={}){let r=Date.now();if(null==t.signal){let e=AbortSignal.timeout(500);t={...t,signal:e}}let s=()=>{let{host:e,port:t}=i.remoteAddr.toOptions();n("timeout closing stream to %s:%s after %dms, destroying it manually",e,t,Date.now()-r),this.abort(new rX.sv("Socket close timeout","ERR_SOCKET_CLOSE_TIMEOUT"))};t.signal?.addEventListener("abort",s);try{await e.close()}catch(e){n.error("error closing WebSocket gracefully",e),this.abort(e)}finally{t.signal?.removeEventListener("abort",s),i.timeline.close=Date.now()}},abort(t){let{host:r,port:s}=i.remoteAddr.toOptions();n("timeout closing stream to %s:%s due to error",r,s,t),e.destroy(),i.timeline.close=Date.now()}};return e.socket.addEventListener("close",()=>{null==i.timeline.close&&(i.timeline.close=Date.now())},{once:!0}),i}(await this._connect(e,t),e,{logger:this.logger});this.log("new outbound connection %s",r.remoteAddr);let n=await t.upgrader.upgradeOutbound(r);return this.log("outbound connection %s upgraded",r.remoteAddr),n}async _connect(e,t){var r,n;let i;if(t?.signal?.aborted===!0)throw new rX._L;let s=e.toOptions();this.log("dialing %s:%s",s.host,s.port);let o=(0,t6.Z)(),a=(r=function(e,t){let r=(0,n0.HM)(e).stringTuples(),n=r.pop();if(void 0===n)throw Error("Unexpected end of multiaddr");let i=(0,n0.a_)(n[0]),s=sz[i.name];if(null==s)throw Error(`No interpreter found for ${i.name}`);let o=s(n[1]??"",r);return sV.includes(n[0])&&(o=o.replace(/^.*:\/\//,""),o="443"===n[1]?`https://${o}`:`http://${o}`),(o.startsWith("http://")||o.startsWith("https://"))&&(o=new URL(o).toString()).endsWith("/")&&(o=o.substring(0,o.length-1)),o}(e),n=(n=this.init)??{},sJ(new sX(s0(r,"undefined"==typeof window?void 0:window.location).toString(),n.websocket),n));if(a.socket.addEventListener("error",()=>{let t=new rX.sv(`Could not connect to ${e.toString()}`,"ERR_CONNECTION_FAILED");this.log.error("connection error:",t),o.reject(t)}),null==t.signal)return await Promise.race([a.connected(),o.promise]),this.log("connected %s",e),a;let l=new Promise((e,r)=>{if(i=()=>{r(new rX._L),a.close().catch(e=>{this.log.error("error closing raw socket",e)})},t?.signal?.aborted===!0){i();return}t?.signal?.addEventListener("abort",i)});try{await Promise.race([l,o.promise,a.connected()])}finally{null!=i&&t?.signal?.removeEventListener("abort",i)}return this.log("connected %s",e),a}createListener(e){return function(){throw Error("WebSocket Servers can not be created in the browser!")}({logger:this.logger},{...this.init,...e})}listenFilter(e){return(e=Array.isArray(e)?e:[e],this.init?.filter!=null)?this.init?.filter(e):sa||sh?e.filter(e=>{if(e.protoCodes().includes(290))return!1;let t=e.decapsulateCode(421);return is.matches(t)}):s1(e)}dialFilter(e){return this.listenFilter(e)}}let s3="StrictSign",s4="StrictNoSign";(H=eM||(eM={})).Accept="accept",H.Ignore="ignore",H.Reject="reject";let s6="/floodsub/1.0.0",s5="/meshsub/1.0.0",s8="/meshsub/1.1.0",s9={maxSubscriptions:1/0,maxMessages:1/0,maxIhaveMessageIDs:1/0,maxIwantMessageIDs:1/0,maxControlMessages:1/0,maxPeerInfos:1/0};(q=($=eU||(eU={})).SubOpts||($.SubOpts={})).codec=()=>(null==f&&(f=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.subscribe&&(t.uint32(8),t.bool(e.subscribe)),null!=e.topic&&(t.uint32(18),t.string(e.topic)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.subscribe=e.bool();break;case 2:n.topic=e.string();break;default:e.skipType(7&t)}}return n})),f),q.encode=e=>(0,ns.LE)(e,q.codec()),q.decode=(e,t)=>(0,ns.C6)(e,q.codec(),t),(z=$.Message||($.Message={})).codec=()=>(null==g&&(g=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.from&&(t.uint32(10),t.bytes(e.from)),null!=e.data&&(t.uint32(18),t.bytes(e.data)),null!=e.seqno&&(t.uint32(26),t.bytes(e.seqno)),null!=e.topic&&""!==e.topic&&(t.uint32(34),t.string(e.topic)),null!=e.signature&&(t.uint32(42),t.bytes(e.signature)),null!=e.key&&(t.uint32(50),t.bytes(e.key)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={topic:""},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.from=e.bytes();break;case 2:n.data=e.bytes();break;case 3:n.seqno=e.bytes();break;case 4:n.topic=e.string();break;case 5:n.signature=e.bytes();break;case 6:n.key=e.bytes();break;default:e.skipType(7&t)}}return n})),g),z.encode=e=>(0,ns.LE)(e,z.codec()),z.decode=(e,t)=>(0,ns.C6)(e,z.codec(),t),(j=$.ControlMessage||($.ControlMessage={})).codec=()=>(null==m&&(m=(0,ns.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.ihave)for(let r of e.ihave)t.uint32(10),$.ControlIHave.codec().encode(r,t);if(null!=e.iwant)for(let r of e.iwant)t.uint32(18),$.ControlIWant.codec().encode(r,t);if(null!=e.graft)for(let r of e.graft)t.uint32(26),$.ControlGraft.codec().encode(r,t);if(null!=e.prune)for(let r of e.prune)t.uint32(34),$.ControlPrune.codec().encode(r,t);!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={ihave:[],iwant:[],graft:[],prune:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:if(r.limits?.ihave!=null&&n.ihave.length===r.limits.ihave)throw new ns.sv('decode error - map field "ihave" had too many elements',"ERR_MAX_LENGTH");n.ihave.push($.ControlIHave.codec().decode(e,e.uint32()));break;case 2:if(r.limits?.iwant!=null&&n.iwant.length===r.limits.iwant)throw new ns.sv('decode error - map field "iwant" had too many elements',"ERR_MAX_LENGTH");n.iwant.push($.ControlIWant.codec().decode(e,e.uint32()));break;case 3:if(r.limits?.graft!=null&&n.graft.length===r.limits.graft)throw new ns.sv('decode error - map field "graft" had too many elements',"ERR_MAX_LENGTH");n.graft.push($.ControlGraft.codec().decode(e,e.uint32()));break;case 4:if(r.limits?.prune!=null&&n.prune.length===r.limits.prune)throw new ns.sv('decode error - map field "prune" had too many elements',"ERR_MAX_LENGTH");n.prune.push($.ControlPrune.codec().decode(e,e.uint32()));break;default:e.skipType(7&t)}}return n})),m),j.encode=e=>(0,ns.LE)(e,j.codec()),j.decode=(e,t)=>(0,ns.C6)(e,j.codec(),t),(G=$.ControlIHave||($.ControlIHave={})).codec=()=>(null==y&&(y=(0,ns.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.topicID&&(t.uint32(10),t.string(e.topicID)),null!=e.messageIDs)for(let r of e.messageIDs)t.uint32(18),t.bytes(r);!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={messageIDs:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.topicID=e.string();break;case 2:if(r.limits?.messageIDs!=null&&n.messageIDs.length===r.limits.messageIDs)throw new ns.sv('decode error - map field "messageIDs" had too many elements',"ERR_MAX_LENGTH");n.messageIDs.push(e.bytes());break;default:e.skipType(7&t)}}return n})),y),G.encode=e=>(0,ns.LE)(e,G.codec()),G.decode=(e,t)=>(0,ns.C6)(e,G.codec(),t),(W=$.ControlIWant||($.ControlIWant={})).codec=()=>(null==b&&(b=(0,ns.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.messageIDs)for(let r of e.messageIDs)t.uint32(10),t.bytes(r);!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={messageIDs:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3==1){if(r.limits?.messageIDs!=null&&n.messageIDs.length===r.limits.messageIDs)throw new ns.sv('decode error - map field "messageIDs" had too many elements',"ERR_MAX_LENGTH");n.messageIDs.push(e.bytes())}else e.skipType(7&t)}return n})),b),W.encode=e=>(0,ns.LE)(e,W.codec()),W.decode=(e,t)=>(0,ns.C6)(e,W.codec(),t),(Y=$.ControlGraft||($.ControlGraft={})).codec=()=>(null==v&&(v=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.topicID&&(t.uint32(10),t.string(e.topicID)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={},i=null==t?e.len:e.pos+t;for(;e.pos>>3==1?n.topicID=e.string():e.skipType(7&t)}return n})),v),Y.encode=e=>(0,ns.LE)(e,Y.codec()),Y.decode=(e,t)=>(0,ns.C6)(e,Y.codec(),t),(Q=$.ControlPrune||($.ControlPrune={})).codec=()=>(null==w&&(w=(0,ns.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.topicID&&(t.uint32(10),t.string(e.topicID)),null!=e.peers)for(let r of e.peers)t.uint32(18),$.PeerInfo.codec().encode(r,t);null!=e.backoff&&(t.uint32(24),t.uint64Number(e.backoff)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={peers:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.topicID=e.string();break;case 2:if(r.limits?.peers!=null&&n.peers.length===r.limits.peers)throw new ns.sv('decode error - map field "peers" had too many elements',"ERR_MAX_LENGTH");n.peers.push($.PeerInfo.codec().decode(e,e.uint32()));break;case 3:n.backoff=e.uint64Number();break;default:e.skipType(7&t)}}return n})),w),Q.encode=e=>(0,ns.LE)(e,Q.codec()),Q.decode=(e,t)=>(0,ns.C6)(e,Q.codec(),t),(J=$.PeerInfo||($.PeerInfo={})).codec=()=>(null==E&&(E=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.peerID&&(t.uint32(10),t.bytes(e.peerID)),null!=e.signedPeerRecord&&(t.uint32(18),t.bytes(e.signedPeerRecord)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:n.peerID=e.bytes();break;case 2:n.signedPeerRecord=e.bytes();break;default:e.skipType(7&t)}}return n})),E),J.encode=e=>(0,ns.LE)(e,J.codec()),J.decode=(e,t)=>(0,ns.C6)(e,J.codec(),t),$.codec=()=>(null==p&&(p=(0,ns.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.subscriptions)for(let r of e.subscriptions)t.uint32(10),$.SubOpts.codec().encode(r,t);if(null!=e.messages)for(let r of e.messages)t.uint32(18),$.Message.codec().encode(r,t);null!=e.control&&(t.uint32(26),$.ControlMessage.codec().encode(e.control,t)),!1!==r.lengthDelimited&&t.ldelim()},(e,t,r={})=>{let n={subscriptions:[],messages:[]},i=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:if(r.limits?.subscriptions!=null&&n.subscriptions.length===r.limits.subscriptions)throw new ns.sv('decode error - map field "subscriptions" had too many elements',"ERR_MAX_LENGTH");n.subscriptions.push($.SubOpts.codec().decode(e,e.uint32()));break;case 2:if(r.limits?.messages!=null&&n.messages.length===r.limits.messages)throw new ns.sv('decode error - map field "messages" had too many elements',"ERR_MAX_LENGTH");n.messages.push($.Message.codec().decode(e,e.uint32()));break;case 3:n.control=$.ControlMessage.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return n})),p),$.encode=e=>(0,ns.LE)(e,$.codec()),$.decode=(e,t)=>(0,ns.C6)(e,$.codec(),t);class s7{gossip;msgs=new Map;msgIdToStrFn;history=[];notValidatedCount=0;constructor(e,t,r){this.gossip=e,this.msgIdToStrFn=r;for(let e=0;e{let n=this.msgs.get(r.msgIdStr);if(n?.validated&&e.has(r.topic)){let e=t.get(r.topic);null==e&&(e=[],t.set(r.topic,e)),e.push(r.msgId)}});return t}validate(e){let t=this.msgs.get(e);if(null==t)return null;!t.validated&&this.notValidatedCount--;let{message:r,originatingPeers:n}=t;return t.validated=!0,t.originatingPeers=new Set,{message:r,originatingPeers:n}}shift(){this.history[this.history.length-1].forEach(e=>{let t=this.msgs.get(e.msgIdStr);null!=t&&(this.msgs.delete(e.msgIdStr),!t.validated&&this.notValidatedCount--)}),this.history.pop(),this.history.unshift([])}remove(e){let t=this.msgs.get(e);return null==t?null:(this.msgs.delete(e),t)}}function oe(e){switch(e){case eM.Ignore:return eV.Ignore;case eM.Reject:return eV.Reject;default:throw Error("Unreachable")}}(X=eF||(eF={})).StrictSign="StrictSign",X.StrictNoSign="StrictNoSign",(Z=eK||(eK={}))[Z.Signing=0]="Signing",Z[Z.Anonymous=1]="Anonymous",(ee=eV||(eV={})).Error="error",ee.Ignore="ignore",ee.Reject="reject",ee.Blacklisted="blacklisted",(et=eH||(eH={})).InvalidSignature="invalid_signature",et.InvalidSeqno="invalid_seqno",et.InvalidPeerId="invalid_peerid",et.SignaturePresent="signature_present",et.SeqnoPresent="seqno_present",et.FromPresent="from_present",et.TransformFailed="transform_failed",(er=e$||(e$={})).duplicate="duplicate",er.invalid="invalid",er.valid="valid",(en=eq||(eq={})).forward="forward",en.publish="publish",(ei=ez||(ez={})).Fanout="fanout",ei.Random="random",ei.Subscribed="subscribed",ei.Outbound="outbound",ei.NotEnough="not_enough",ei.Opportunistic="opportunistic",(es=ej||(ej={})).Dc="disconnected",es.BadScore="bad_score",es.Prune="prune",es.Excess="excess",(eo=eG||(eG={})).GraftBackoff="graft_backoff",eo.BrokenPromise="broken_promise",eo.MessageDeficit="message_deficit",eo.IPColocation="IP_colocation",(ea=eW||(eW={})).LowScore="low_score",ea.MaxIhave="max_ihave",ea.MaxIasked="max_iasked",(el=eY||(eY={})).graylist="graylist",el.publish="publish",el.gossip="gossip",el.mesh="mesh";let ot="ERR_INVALID_PEER_SCORE_PARAMS",or={topics:{},topicScoreCap:10,appSpecificScore:()=>0,appSpecificWeight:10,IPColocationFactorWeight:-5,IPColocationFactorThreshold:10,IPColocationFactorWhitelist:new Set,behaviourPenaltyWeight:-10,behaviourPenaltyThreshold:0,behaviourPenaltyDecay:.2,decayInterval:1e3,decayToZero:.1,retainScore:36e5},on={topicWeight:.5,timeInMeshWeight:1,timeInMeshQuantum:1,timeInMeshCap:3600,firstMessageDeliveriesWeight:1,firstMessageDeliveriesDecay:.5,firstMessageDeliveriesCap:2e3,meshMessageDeliveriesWeight:-1,meshMessageDeliveriesDecay:.5,meshMessageDeliveriesCap:100,meshMessageDeliveriesThreshold:20,meshMessageDeliveriesWindow:10,meshMessageDeliveriesActivation:5e3,meshFailurePenaltyWeight:-1,meshFailurePenaltyDecay:.5,invalidMessageDeliveriesWeight:-1,invalidMessageDeliveriesDecay:.3},oi={gossipThreshold:-10,publishThreshold:-50,graylistThreshold:-80,acceptPXThreshold:10,opportunisticGraftThreshold:20};function os(e,t,r=()=>!0){let n=new Set;if(t<=0)return n;for(let i of e){if(n.size>=t)break;r(i)&&(n.add(i),e.delete(i))}return n}class oo extends Map{getDefault;constructor(e){super(),this.getDefault=e}getOrDefault(e){let t=super.get(e);return void 0===t&&(t=this.getDefault(),this.set(e,t)),t}}function oa(e,t,r,n){let i=0;Object.entries(t.topics).forEach(([e,t])=>{let n=r.topics[e];if(void 0===n)return;let s=0;if(t.inMesh){let e=t.meshTime/n.timeInMeshQuantum;e>n.timeInMeshCap&&(e=n.timeInMeshCap),s+=e*n.timeInMeshWeight}let o=t.firstMessageDeliveries;if(o>n.firstMessageDeliveriesCap&&(o=n.firstMessageDeliveriesCap),s+=o*n.firstMessageDeliveriesWeight,t.meshMessageDeliveriesActive&&t.meshMessageDeliveries0&&i>r.topicScoreCap&&(i=r.topicScoreCap);let s=r.appSpecificScore(e);if(i+=s*r.appSpecificWeight,t.knownIPs.forEach(e=>{if(r.IPColocationFactorWhitelist.has(e))return;let t=n.get(e),s=null!=t?t.size:0;if(s>r.IPColocationFactorThreshold){let e=s-r.IPColocationFactorThreshold;i+=e*e*r.IPColocationFactorWeight}}),t.behaviourPenalty>r.behaviourPenaltyThreshold){let e=t.behaviourPenalty-r.behaviourPenaltyThreshold;i+=e*e*r.behaviourPenaltyWeight}return i}var ol=r(64170);(ec=eQ||(eQ={}))[ec.unknown=0]="unknown",ec[ec.valid=1]="valid",ec[ec.invalid=2]="invalid",ec[ec.ignored=3]="ignored";class oc{records;queue;constructor(){this.records=new Map,this.queue=new ol}getRecord(e){return this.records.get(e)}ensureRecord(e){let t=this.records.get(e);if(null!=t)return t;t={status:eQ.unknown,firstSeenTsMs:Date.now(),validated:0,peers:new Set},this.records.set(e,t);let r={msgId:e,expire:Date.now()+12e4};return this.queue.push(r),t}gc(){let e=Date.now(),t=this.queue.peekFront();for(;null!=t&&t.expirenew Set);scoreCache=new Map;deliveryRecords=new oc;_backgroundInterval;scoreCacheValidityMs;computeScore;log;constructor(e,t,r,n){this.params=e,this.metrics=t,function(e){for(let[t,r]of Object.entries(e.topics))try{(function(e){if(e.topicWeight<0)throw new rX.sv("invalid topic weight; must be >= 0",ot);if(0===e.timeInMeshQuantum)throw new rX.sv("invalid TimeInMeshQuantum; must be non zero",ot);if(e.timeInMeshWeight<0)throw new rX.sv("invalid TimeInMeshWeight; must be positive (or 0 to disable)",ot);if(0!==e.timeInMeshWeight&&e.timeInMeshQuantum<=0)throw new rX.sv("invalid TimeInMeshQuantum; must be positive",ot);if(0!==e.timeInMeshWeight&&e.timeInMeshCap<=0)throw new rX.sv("invalid TimeInMeshCap; must be positive",ot);if(e.firstMessageDeliveriesWeight<0)throw new rX.sv("invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)",ot);if(0!==e.firstMessageDeliveriesWeight&&(e.firstMessageDeliveriesDecay<=0||e.firstMessageDeliveriesDecay>=1))throw new rX.sv("invalid FirstMessageDeliveriesDecay; must be between 0 and 1",ot);if(0!==e.firstMessageDeliveriesWeight&&e.firstMessageDeliveriesCap<=0)throw new rX.sv("invalid FirstMessageDeliveriesCap; must be positive",ot);if(e.meshMessageDeliveriesWeight>0)throw new rX.sv("invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)",ot);if(0!==e.meshMessageDeliveriesWeight&&(e.meshMessageDeliveriesDecay<=0||e.meshMessageDeliveriesDecay>=1))throw new rX.sv("invalid MeshMessageDeliveriesDecay; must be between 0 and 1",ot);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesCap<=0)throw new rX.sv("invalid MeshMessageDeliveriesCap; must be positive",ot);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesThreshold<=0)throw new rX.sv("invalid MeshMessageDeliveriesThreshold; must be positive",ot);if(e.meshMessageDeliveriesWindow<0)throw new rX.sv("invalid MeshMessageDeliveriesWindow; must be non-negative",ot);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesActivation<1e3)throw new rX.sv("invalid MeshMessageDeliveriesActivation; must be at least 1s",ot);if(e.meshFailurePenaltyWeight>0)throw new rX.sv("invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)",ot);if(0!==e.meshFailurePenaltyWeight&&(e.meshFailurePenaltyDecay<=0||e.meshFailurePenaltyDecay>=1))throw new rX.sv("invalid MeshFailurePenaltyDecay; must be between 0 and 1",ot);if(e.invalidMessageDeliveriesWeight>0)throw new rX.sv("invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)",ot);if(e.invalidMessageDeliveriesDecay<=0||e.invalidMessageDeliveriesDecay>=1)throw new rX.sv("invalid InvalidMessageDeliveriesDecay; must be between 0 and 1",ot)})(r)}catch(e){throw new rX.sv(`invalid score parameters for topic ${t}: ${e.message}`,ot)}if(e.topicScoreCap<0)throw new rX.sv("invalid topic score cap; must be positive (or 0 for no cap)",ot);if(null===e.appSpecificScore||void 0===e.appSpecificScore)throw new rX.sv("missing application specific score function",ot);if(e.IPColocationFactorWeight>0)throw new rX.sv("invalid IPColocationFactorWeight; must be negative (or 0 to disable)",ot);if(0!==e.IPColocationFactorWeight&&e.IPColocationFactorThreshold<1)throw new rX.sv("invalid IPColocationFactorThreshold; must be at least 1",ot);if(e.behaviourPenaltyWeight>0)throw new rX.sv("invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)",ot);if(0!==e.behaviourPenaltyWeight&&(e.behaviourPenaltyDecay<=0||e.behaviourPenaltyDecay>=1))throw new rX.sv("invalid BehaviourPenaltyDecay; must be between 0 and 1",ot);if(e.decayInterval<1e3)throw new rX.sv("invalid DecayInterval; must be at least 1s",ot);if(e.decayToZero<=0||e.decayToZero>=1)throw new rX.sv("invalid DecayToZero; must be between 0 and 1",ot)}(e),this.scoreCacheValidityMs=n.scoreCacheValidityMs,this.computeScore=n.computeScore??oa,this.log=r.forComponent("libp2p:gossipsub:score")}get size(){return this.peerStats.size}start(){if(null!=this._backgroundInterval){this.log("Peer score already running");return}this._backgroundInterval=setInterval(()=>{this.background()},this.params.decayInterval),this.log("started")}stop(){if(null==this._backgroundInterval){this.log("Peer score already stopped");return}clearInterval(this._backgroundInterval),delete this._backgroundInterval,this.peerIPs.clear(),this.peerStats.clear(),this.deliveryRecords.clear(),this.log("stopped")}background(){this.refreshScores(),this.deliveryRecords.gc()}dumpPeerScoreStats(){return Object.fromEntries(Array.from(this.peerStats.entries()).map(([e,t])=>[e,t]))}messageFirstSeenTimestampMs(e){let t=this.deliveryRecords.getRecord(e);return null!=t?t.firstSeenTsMs:null}refreshScores(){let e=Date.now(),t=this.params.decayToZero;this.peerStats.forEach((r,n)=>{if(!r.connected){e>r.expire&&(this.removeIPsForPeer(n,r.knownIPs),this.peerStats.delete(n),this.scoreCache.delete(n));return}Object.entries(r.topics).forEach(([r,n])=>{let i=this.params.topics[r];void 0!==i&&(n.firstMessageDeliveries*=i.firstMessageDeliveriesDecay,n.firstMessageDeliveriesi.meshMessageDeliveriesActivation&&(n.meshMessageDeliveriesActive=!0)))}),r.behaviourPenalty*=this.params.behaviourPenaltyDecay,r.behaviourPenaltyr)return n.score;this.metrics?.scoreFnRuns.inc();let i=this.computeScore(e,t,this.params,this.peerIPs),s=r+this.scoreCacheValidityMs;return null!=n?(this.metrics?.scoreCachedDelta.observe(Math.abs(i-n.score)),n.score=i,n.cacheUntil=s):this.scoreCache.set(e,{score:i,cacheUntil:s}),i}addPenalty(e,t,r){let n=this.peerStats.get(e);null!=n&&(n.behaviourPenalty+=t,this.metrics?.onScorePenalty(r))}addPeer(e){let t={connected:!0,expire:0,topics:{},knownIPs:new Set,behaviourPenalty:0};this.peerStats.set(e,t)}addIP(e,t){let r=this.peerStats.get(e);null!=r&&r.knownIPs.add(t),this.peerIPs.getOrDefault(t).add(e)}removeIP(e,t){let r=this.peerStats.get(e);null!=r&&r.knownIPs.delete(t);let n=this.peerIPs.get(t);null!=n&&(n.delete(e),0===n.size&&this.peerIPs.delete(t))}removePeer(e){let t=this.peerStats.get(e);if(null!=t){if(this.score(e)>0){this.removeIPsForPeer(e,t.knownIPs),this.peerStats.delete(e);return}Object.entries(t.topics).forEach(([e,t])=>{t.firstMessageDeliveries=0;let r=this.params.topics[e].meshMessageDeliveriesThreshold;if(t.inMesh&&t.meshMessageDeliveriesActive&&t.meshMessageDeliveries{t!==e.toString()&&this.markDuplicateMessageDelivery(t,r)})}rejectInvalidMessage(e,t){this.markInvalidMessageDelivery(e,t)}rejectMessage(e,t,r,n){switch(n){case eV.Error:this.markInvalidMessageDelivery(e,r);return;case eV.Blacklisted:return}let i=this.deliveryRecords.ensureRecord(t);if(i.status!==eQ.unknown){this.log("unexpected rejection: message from %s was first seen %s ago and has delivery status %d",e,Date.now()-i.firstSeenTsMs,eQ[i.status]);return}if(n===eV.Ignore){i.status=eQ.ignored,i.peers.clear();return}i.status=eQ.invalid,this.markInvalidMessageDelivery(e,r),i.peers.forEach(e=>{this.markInvalidMessageDelivery(e,r)}),i.peers.clear()}duplicateMessage(e,t,r){let n=this.deliveryRecords.ensureRecord(t);if(!n.peers.has(e))switch(n.status){case eQ.unknown:n.peers.add(e);break;case eQ.valid:n.peers.add(e),this.markDuplicateMessageDelivery(e,r,n.validated);break;case eQ.invalid:this.markInvalidMessageDelivery(e,r);case eQ.ignored:}}markInvalidMessageDelivery(e,t){let r=this.peerStats.get(e);if(null!=r){let e=this.getPtopicStats(r,t);null!=e&&(e.invalidMessageDeliveries+=1)}}markFirstMessageDelivery(e,t){let r=this.peerStats.get(e);if(null!=r){let e=this.getPtopicStats(r,t);if(null!=e){let r=this.params.topics[t].firstMessageDeliveriesCap;e.firstMessageDeliveries=Math.min(r,e.firstMessageDeliveries+1),e.inMesh&&(r=this.params.topics[t].meshMessageDeliveriesCap,e.meshMessageDeliveries=Math.min(r,e.meshMessageDeliveries+1))}}}markDuplicateMessageDelivery(e,t,r){let n=this.peerStats.get(e);if(null!=n){let e=void 0!==r?Date.now():0,i=this.getPtopicStats(n,t);if(null!=i&&i.inMesh){let n=this.params.topics[t];if(void 0!==r){let i=e-r,s=i>n.meshMessageDeliveriesWindow;if(this.metrics?.onDuplicateMsgDelivery(t,i,s),s)return}let s=n.meshMessageDeliveriesCap;i.meshMessageDeliveries=Math.min(s,i.meshMessageDeliveries+1)}}}removeIPsForPeer(e,t){for(let r of t){let t=this.peerIPs.get(r);null!=t&&(t.delete(e),0===t.size&&this.peerIPs.delete(r))}}getPtopicStats(e,t){let r=e.topics[t];return void 0!==r?r:void 0!==this.params.topics[t]?(r={inMesh:!1,graftTime:0,meshTime:0,firstMessageDeliveries:0,meshMessageDeliveries:0,meshMessageDeliveriesActive:!1,meshFailurePenalty:0,invalidMessageDeliveries:0},e.topics[t]=r,r):null}}class oh{rawStream;pushable;closeController;maxBufferSize;constructor(e,t,r){this.rawStream=e,this.pushable=(0,sE.dT)(),this.closeController=new AbortController,this.maxBufferSize=r.maxBufferSize??1/0,this.closeController.signal.addEventListener("abort",()=>{e.close().catch(t=>{e.abort(t)})}),(0,tg.z)(this.pushable,this.rawStream).catch(t)}get protocol(){return this.rawStream.protocol}push(e){if(this.pushable.readableLength>this.maxBufferSize)throw Error(`OutboundStream buffer full, size > ${this.maxBufferSize}`);this.pushable.push(tf.c.single(e))}pushPrefixed(e){if(this.pushable.readableLength>this.maxBufferSize)throw Error(`OutboundStream buffer full, size > ${this.maxBufferSize}`);this.pushable.push(e)}async close(){this.closeController.abort(),await this.pushable.return()}}class od{source;rawStream;closeController;constructor(e,t={}){this.rawStream=e,this.closeController=new AbortController,this.closeController.signal.addEventListener("abort",()=>{e.close().catch(t=>{e.abort(t)})}),this.source=(0,tg.z)(this.rawStream,e=>(0,tf.J)(e,t))}async close(){this.closeController.abort()}}class op{gossipsubIWantFollowupMs;msgIdToStrFn;metrics;promises=new Map;requestMsByMsg=new Map;requestMsByMsgExpire;constructor(e,t,r){this.gossipsubIWantFollowupMs=e,this.msgIdToStrFn=t,this.metrics=r,this.requestMsByMsgExpire=10*e}get size(){return this.promises.size}get requestMsByMsgSize(){return this.requestMsByMsg.size}addPromise(e,t){let r=Math.floor(Math.random()*t.length),n=t[r],i=this.msgIdToStrFn(n),s=this.promises.get(i);null==s&&(s=new Map,this.promises.set(i,s));let o=Date.now();s.has(e)||(s.set(e,o+this.gossipsubIWantFollowupMs),null==this.metrics||(this.metrics.iwantPromiseStarted.inc(1),this.requestMsByMsg.has(i)||this.requestMsByMsg.set(i,o)))}getBrokenPromises(){let e=Date.now(),t=new Map,r=0;return this.promises.forEach((n,i)=>{n.forEach((i,s)=>{iMath.floor(Math.random()*Math.floor(e.length));for(let r=0;r{let r=(0,r0.m)(t.toString(16).padStart(16,"0"),"base16"),n=new Uint8Array(e.length+r.length);return n.set(e,0),n.set(r,e.length),n};function oS(e){if("signed"!==e.type)throw Error("expected signed message type");if(null==e.sequenceNumber)throw Error("missing seqno field");return oE(e.from.toBytes(),e.sequenceNumber)}async function oA(e){return r3.sha256.encode(e.data)}var oI=r(88695);async function o_(e,t){switch(e){case s3:{if(null==t)throw Error("Must provide PeerId");if(null==t.privateKey)throw Error("Cannot sign message, no private key present");if(null==t.publicKey)throw Error("Cannot sign message, no public key present");let e=await (0,ik.r3)(t.privateKey);return{type:eK.Signing,author:t,key:t.publicKey,privateKey:e}}case s4:return{type:eK.Anonymous};default:throw Error(`Unknown signature policy "${e}"`)}}(eu=eJ||(eJ={}))[eu.ip4=4]="ip4",eu[eu.ip6=41]="ip6";class oT{entries=new Map;validityMs;constructor(e){this.validityMs=e.validityMs}get size(){return this.entries.size}put(e,t){return!!this.entries.has(e)||(this.entries.set(e,{value:t,validUntilMs:Date.now()+this.validityMs}),!1)}prune(){let e=Date.now();for(let[t,r]of this.entries.entries())if(r.validUntilMs=Date.now()?t.value:void 0}clear(){this.entries.clear()}}(eh=eX||(eX={}))[eh.started=0]="started",eh[eh.stopped=1]="stopped";class oC extends tQ.L{globalSignaturePolicy;multicodecs=[s8,s5];publishConfig;dataTransform;peers=new Set;streamsInbound=new Map;streamsOutbound=new Map;outboundInflightQueue=(0,sE.dT)({objectMode:!0});direct=new Set;floodsubPeers=new Set;seenCache;acceptFromWhitelist=new Map;topics=new Map;subscriptions=new Set;mesh=new Map;fanout=new Map;fanoutLastpub=new Map;gossip=new Map;control=new Map;peerhave=new Map;iasked=new Map;backoff=new Map;outbound=new Map;msgIdFn;fastMsgIdFn;msgIdToStrFn;fastMsgIdCache;publishedMessageIds;mcache;score;topicValidators=new Map;log;heartbeatTicks=0;gossipTracer;components;directPeerInitial=null;static multicodec=s8;opts;decodeRpcLimits;metrics;status={code:eX.stopped};maxInboundStreams;maxOutboundStreams;runOnTransientConnection;allowedTopics;heartbeatTimer=null;constructor(e,t={}){super();let r={fallbackToFloodsub:!0,floodPublish:!0,batchPublish:!1,doPX:!1,directPeers:[],D:6,Dlo:4,Dhi:12,Dscore:4,Dout:2,Dlazy:6,heartbeatInterval:1e3,fanoutTTL:6e4,mcacheLength:5,mcacheGossip:3,seenTTL:12e4,gossipsubIWantFollowupMs:3e3,prunePeers:16,pruneBackoff:6e4,unsubcribeBackoff:1e4,graftFloodThreshold:1e4,opportunisticGraftPeers:2,opportunisticGraftTicks:60,directConnectTicks:300,...t,scoreParams:function(e={}){return{...or,...e,topics:null!=e.topics?Object.entries(e.topics).reduce((e,[t,r])=>(e[t]=function(e={}){return{...on,...e}}(r),e),{}):{}}}(t.scoreParams),scoreThresholds:function(e={}){return{...oi,...e}}(t.scoreThresholds)};if(this.components=e,this.decodeRpcLimits=r.decodeRpcLimits??s9,this.globalSignaturePolicy=r.globalSignaturePolicy??s3,r.fallbackToFloodsub&&this.multicodecs.push(s6),this.log=e.logger.forComponent(r.debugName??"libp2p:gossipsub"),this.opts=r,this.direct=new Set(r.directPeers.map(e=>e.id.toString())),this.seenCache=new oT({validityMs:r.seenTTL}),this.publishedMessageIds=new oT({validityMs:r.seenTTL}),null!=t.msgIdFn)this.msgIdFn=t.msgIdFn;else switch(this.globalSignaturePolicy){case s3:this.msgIdFn=oS;break;case s4:this.msgIdFn=oA;break;default:throw Error(`Invalid globalSignaturePolicy: ${this.globalSignaturePolicy}`)}if(null!=t.fastMsgIdFn&&(this.fastMsgIdFn=t.fastMsgIdFn,this.fastMsgIdCache=new oT({validityMs:r.seenTTL})),this.msgIdToStrFn=t.msgIdToStrFn??ov,this.mcache=t.messageCache??new s7(r.mcacheGossip,r.mcacheLength,this.msgIdToStrFn),null!=t.dataTransform&&(this.dataTransform=t.dataTransform),null!=t.metricsRegister){var n,i,s;if(null==t.metricsTopicStrToLabel)throw Error("Must set metricsTopicStrToLabel with metrics");let e=Math.max(...Object.values(r.scoreParams.topics).map(e=>e.meshMessageDeliveriesWindow),1e3),o=(n=t.metricsRegister,i=t.metricsTopicStrToLabel,s={gossipPromiseExpireSec:this.opts.gossipsubIWantFollowupMs/1e3,behaviourPenaltyThreshold:r.scoreParams.behaviourPenaltyThreshold,maxMeshMessageDeliveriesWindowSec:e/1e3},{protocolsEnabled:n.gauge({name:"gossipsub_protocol",help:"Status of enabled protocols",labelNames:["protocol"]}),topicSubscriptionStatus:n.gauge({name:"gossipsub_topic_subscription_status",help:"Status of our subscription to this topic",labelNames:["topicStr"]}),topicPeersCount:n.gauge({name:"gossipsub_topic_peer_count",help:"Number of peers subscribed to each topic",labelNames:["topicStr"]}),meshPeerCounts:n.gauge({name:"gossipsub_mesh_peer_count",help:"Number of peers in our mesh",labelNames:["topicStr"]}),meshPeerInclusionEventsFanout:n.gauge({name:"gossipsub_mesh_peer_inclusion_events_fanout_total",help:"Number of times we include peers in a topic mesh for fanout reasons",labelNames:["topic"]}),meshPeerInclusionEventsRandom:n.gauge({name:"gossipsub_mesh_peer_inclusion_events_random_total",help:"Number of times we include peers in a topic mesh for random reasons",labelNames:["topic"]}),meshPeerInclusionEventsSubscribed:n.gauge({name:"gossipsub_mesh_peer_inclusion_events_subscribed_total",help:"Number of times we include peers in a topic mesh for subscribed reasons",labelNames:["topic"]}),meshPeerInclusionEventsOutbound:n.gauge({name:"gossipsub_mesh_peer_inclusion_events_outbound_total",help:"Number of times we include peers in a topic mesh for outbound reasons",labelNames:["topic"]}),meshPeerInclusionEventsNotEnough:n.gauge({name:"gossipsub_mesh_peer_inclusion_events_not_enough_total",help:"Number of times we include peers in a topic mesh for not_enough reasons",labelNames:["topic"]}),meshPeerInclusionEventsOpportunistic:n.gauge({name:"gossipsub_mesh_peer_inclusion_events_opportunistic_total",help:"Number of times we include peers in a topic mesh for opportunistic reasons",labelNames:["topic"]}),meshPeerInclusionEventsUnknown:n.gauge({name:"gossipsub_mesh_peer_inclusion_events_unknown_total",help:"Number of times we include peers in a topic mesh for unknown reasons",labelNames:["topic"]}),meshPeerChurnEventsDisconnected:n.gauge({name:"gossipsub_peer_churn_events_disconnected_total",help:"Number of times we remove peers in a topic mesh for disconnected reasons",labelNames:["topic"]}),meshPeerChurnEventsBadScore:n.gauge({name:"gossipsub_peer_churn_events_bad_score_total",help:"Number of times we remove peers in a topic mesh for bad_score reasons",labelNames:["topic"]}),meshPeerChurnEventsPrune:n.gauge({name:"gossipsub_peer_churn_events_prune_total",help:"Number of times we remove peers in a topic mesh for prune reasons",labelNames:["topic"]}),meshPeerChurnEventsExcess:n.gauge({name:"gossipsub_peer_churn_events_excess_total",help:"Number of times we remove peers in a topic mesh for excess reasons",labelNames:["topic"]}),meshPeerChurnEventsUnknown:n.gauge({name:"gossipsub_peer_churn_events_unknown_total",help:"Number of times we remove peers in a topic mesh for unknown reasons",labelNames:["topic"]}),peersPerProtocol:n.gauge({name:"gossipsub_peers_per_protocol_count",help:"Peers connected for each topic",labelNames:["protocol"]}),heartbeatDuration:n.histogram({name:"gossipsub_heartbeat_duration_seconds",help:"The time it takes to complete one iteration of the heartbeat",buckets:[.01,.1,1]}),heartbeatSkipped:n.gauge({name:"gossipsub_heartbeat_skipped",help:"Heartbeat run took longer than heartbeat interval so next is skipped"}),acceptedMessagesTotal:n.gauge({name:"gossipsub_accepted_messages_total",help:"Total accepted messages for each topic",labelNames:["topic"]}),ignoredMessagesTotal:n.gauge({name:"gossipsub_ignored_messages_total",help:"Total ignored messages for each topic",labelNames:["topic"]}),rejectedMessagesTotal:n.gauge({name:"gossipsub_rejected_messages_total",help:"Total rejected messages for each topic",labelNames:["topic"]}),unknownValidationResultsTotal:n.gauge({name:"gossipsub_unknown_validation_results_total",help:"Total unknown validation results for each topic",labelNames:["topic"]}),asyncValidationMcacheHit:n.gauge({name:"gossipsub_async_validation_mcache_hit_total",help:"Async validation result reported by the user layer",labelNames:["hit"]}),asyncValidationDelayFromFirstSeenSec:n.histogram({name:"gossipsub_async_validation_delay_from_first_seen",help:"Async validation report delay from first seen in second",buckets:[.01,.03,.1,.3,1,3,10]}),asyncValidationUnknownFirstSeen:n.gauge({name:"gossipsub_async_validation_unknown_first_seen_count_total",help:"Async validation report unknown first seen value for message"}),peerReadStreamError:n.gauge({name:"gossipsub_peer_read_stream_err_count_total",help:"Peer read stream error"}),rpcRecvBytes:n.gauge({name:"gossipsub_rpc_recv_bytes_total",help:"RPC recv"}),rpcRecvCount:n.gauge({name:"gossipsub_rpc_recv_count_total",help:"RPC recv"}),rpcRecvSubscription:n.gauge({name:"gossipsub_rpc_recv_subscription_total",help:"RPC recv"}),rpcRecvMessage:n.gauge({name:"gossipsub_rpc_recv_message_total",help:"RPC recv"}),rpcRecvControl:n.gauge({name:"gossipsub_rpc_recv_control_total",help:"RPC recv"}),rpcRecvIHave:n.gauge({name:"gossipsub_rpc_recv_ihave_total",help:"RPC recv"}),rpcRecvIWant:n.gauge({name:"gossipsub_rpc_recv_iwant_total",help:"RPC recv"}),rpcRecvGraft:n.gauge({name:"gossipsub_rpc_recv_graft_total",help:"RPC recv"}),rpcRecvPrune:n.gauge({name:"gossipsub_rpc_recv_prune_total",help:"RPC recv"}),rpcDataError:n.gauge({name:"gossipsub_rpc_data_err_count_total",help:"RPC data error"}),rpcRecvError:n.gauge({name:"gossipsub_rpc_recv_err_count_total",help:"RPC recv error"}),rpcRecvNotAccepted:n.gauge({name:"gossipsub_rpc_rcv_not_accepted_total",help:"Total count of RPC dropped because acceptFrom() == false"}),rpcSentBytes:n.gauge({name:"gossipsub_rpc_sent_bytes_total",help:"RPC sent"}),rpcSentCount:n.gauge({name:"gossipsub_rpc_sent_count_total",help:"RPC sent"}),rpcSentSubscription:n.gauge({name:"gossipsub_rpc_sent_subscription_total",help:"RPC sent"}),rpcSentMessage:n.gauge({name:"gossipsub_rpc_sent_message_total",help:"RPC sent"}),rpcSentControl:n.gauge({name:"gossipsub_rpc_sent_control_total",help:"RPC sent"}),rpcSentIHave:n.gauge({name:"gossipsub_rpc_sent_ihave_total",help:"RPC sent"}),rpcSentIWant:n.gauge({name:"gossipsub_rpc_sent_iwant_total",help:"RPC sent"}),rpcSentGraft:n.gauge({name:"gossipsub_rpc_sent_graft_total",help:"RPC sent"}),rpcSentPrune:n.gauge({name:"gossipsub_rpc_sent_prune_total",help:"RPC sent"}),msgPublishCount:n.gauge({name:"gossipsub_msg_publish_count_total",help:"Total count of msg published by topic",labelNames:["topic"]}),msgPublishPeersByTopic:n.gauge({name:"gossipsub_msg_publish_peers_total",help:"Total count of peers that we publish a msg to",labelNames:["topic"]}),directPeersPublishedTotal:n.gauge({name:"gossipsub_direct_peers_published_total",help:"Total direct peers that we publish a msg to",labelNames:["topic"]}),floodsubPeersPublishedTotal:n.gauge({name:"gossipsub_floodsub_peers_published_total",help:"Total floodsub peers that we publish a msg to",labelNames:["topic"]}),meshPeersPublishedTotal:n.gauge({name:"gossipsub_mesh_peers_published_total",help:"Total mesh peers that we publish a msg to",labelNames:["topic"]}),fanoutPeersPublishedTotal:n.gauge({name:"gossipsub_fanout_peers_published_total",help:"Total fanout peers that we publish a msg to",labelNames:["topic"]}),msgPublishBytes:n.gauge({name:"gossipsub_msg_publish_bytes_total",help:"Total count of msg publish data.length bytes",labelNames:["topic"]}),msgPublishTime:n.histogram({name:"gossipsub_msg_publish_seconds",help:"Total time in seconds to publish a message",buckets:[.001,.002,.005,.01,.1,.5,1],labelNames:["topic"]}),msgForwardCount:n.gauge({name:"gossipsub_msg_forward_count_total",help:"Total count of msg forwarded by topic",labelNames:["topic"]}),msgForwardPeers:n.gauge({name:"gossipsub_msg_forward_peers_total",help:"Total count of peers that we forward a msg to",labelNames:["topic"]}),msgReceivedPreValidation:n.gauge({name:"gossipsub_msg_received_prevalidation_total",help:"Total count of recv msgs before any validation",labelNames:["topic"]}),msgReceivedError:n.gauge({name:"gossipsub_msg_received_error_total",help:"Total count of recv msgs error",labelNames:["topic"]}),prevalidationInvalidTotal:n.gauge({name:"gossipsub_pre_validation_invalid_total",help:"Total count of invalid messages received",labelNames:["topic"]}),prevalidationValidTotal:n.gauge({name:"gossipsub_pre_validation_valid_total",help:"Total count of valid messages received",labelNames:["topic"]}),prevalidationDuplicateTotal:n.gauge({name:"gossipsub_pre_validation_duplicate_total",help:"Total count of duplicate messages received",labelNames:["topic"]}),prevalidationUnknownTotal:n.gauge({name:"gossipsub_pre_validation_unknown_status_total",help:"Total count of unknown_status messages received",labelNames:["topic"]}),msgReceivedInvalid:n.gauge({name:"gossipsub_msg_received_invalid_total",help:"Tracks specific reason of invalid",labelNames:["error"]}),msgReceivedInvalidByTopic:n.gauge({name:"gossipsub_msg_received_invalid_by_topic_total",help:"Tracks specific invalid message by topic",labelNames:["topic"]}),duplicateMsgDeliveryDelay:n.histogram({name:"gossisub_duplicate_msg_delivery_delay_seconds",help:"Time since the 1st duplicated message validated",labelNames:["topic"],buckets:[.25*s.maxMeshMessageDeliveriesWindowSec,.5*s.maxMeshMessageDeliveriesWindowSec,Number(s.maxMeshMessageDeliveriesWindowSec),2*s.maxMeshMessageDeliveriesWindowSec,4*s.maxMeshMessageDeliveriesWindowSec]}),duplicateMsgLateDelivery:n.gauge({name:"gossisub_duplicate_msg_late_delivery_total",help:"Total count of late duplicate message delivery by topic, which triggers P3 penalty",labelNames:["topic"]}),duplicateMsgIgnored:n.gauge({name:"gossisub_ignored_published_duplicate_msgs_total",help:"Total count of published duplicate message ignored by topic",labelNames:["topic"]}),scoreFnCalls:n.gauge({name:"gossipsub_score_fn_calls_total",help:"Total times score() is called"}),scoreFnRuns:n.gauge({name:"gossipsub_score_fn_runs_total",help:"Total times score() call actually computed computeScore(), no cache"}),scoreCachedDelta:n.histogram({name:"gossipsub_score_cache_delta",help:"Delta of score between cached values that expired",buckets:[10,100,1e3]}),peersByScoreThreshold:n.gauge({name:"gossipsub_peers_by_score_threshold_count",help:"Current count of peers by score threshold",labelNames:["threshold"]}),score:n.avgMinMax({name:"gossipsub_score",help:"Avg min max of gossip scores"}),scoreWeights:n.avgMinMax({name:"gossipsub_score_weights",help:"Separate score weights",labelNames:["topic","p"]}),scorePerMesh:n.avgMinMax({name:"gossipsub_score_per_mesh",help:"Histogram of the scores for each mesh topic",labelNames:["topic"]}),scoringPenalties:n.gauge({name:"gossipsub_scoring_penalties_total",help:"A counter of the kind of penalties being applied to peers",labelNames:["penalty"]}),behaviourPenalty:n.histogram({name:"gossipsub_peer_stat_behaviour_penalty",help:"Current peer stat behaviour_penalty at each scrape",buckets:[.25*s.behaviourPenaltyThreshold,.5*s.behaviourPenaltyThreshold,Number(s.behaviourPenaltyThreshold),2*s.behaviourPenaltyThreshold,4*s.behaviourPenaltyThreshold]}),ihaveRcvIgnored:n.gauge({name:"gossipsub_ihave_rcv_ignored_total",help:"Total received IHAVE messages that we ignore for some reason",labelNames:["reason"]}),ihaveRcvMsgids:n.gauge({name:"gossipsub_ihave_rcv_msgids_total",help:"Total received IHAVE messages by topic",labelNames:["topic"]}),ihaveRcvNotSeenMsgids:n.gauge({name:"gossipsub_ihave_rcv_not_seen_msgids_total",help:"Total messages per topic we do not have, not actual requests",labelNames:["topic"]}),iwantRcvMsgids:n.gauge({name:"gossipsub_iwant_rcv_msgids_total",help:"Total received IWANT messages by topic",labelNames:["topic"]}),iwantRcvDonthaveMsgids:n.gauge({name:"gossipsub_iwant_rcv_dont_have_msgids_total",help:"Total requested messageIDs that we do not have"}),iwantPromiseStarted:n.gauge({name:"gossipsub_iwant_promise_sent_total",help:"Total count of started IWANT promises"}),iwantPromiseResolved:n.gauge({name:"gossipsub_iwant_promise_resolved_total",help:"Total count of resolved IWANT promises"}),iwantPromiseResolvedFromDuplicate:n.gauge({name:"gossipsub_iwant_promise_resolved_from_duplicate_total",help:"Total count of resolved IWANT promises from duplicate messages"}),iwantPromiseResolvedPeers:n.gauge({name:"gossipsub_iwant_promise_resolved_peers",help:"Total count of peers we have asked IWANT promises that are resolved"}),iwantPromiseBroken:n.gauge({name:"gossipsub_iwant_promise_broken",help:"Total count of broken IWANT promises"}),iwantMessagePruned:n.gauge({name:"gossipsub_iwant_message_pruned",help:"Total count of pruned IWANT messages"}),iwantPromiseDeliveryTime:n.histogram({name:"gossipsub_iwant_promise_delivery_seconds",help:"Histogram of delivery time of resolved IWANT promises",buckets:[.5*s.gossipPromiseExpireSec,Number(s.gossipPromiseExpireSec),2*s.gossipPromiseExpireSec,4*s.gossipPromiseExpireSec]}),iwantPromiseUntracked:n.gauge({name:"gossip_iwant_promise_untracked",help:"Total count of untracked IWANT promise"}),connectedPeersBackoffSec:n.histogram({name:"gossipsub_connected_peers_backoff_seconds",help:"Backoff time in seconds",buckets:[1,2,4,10,20,60,120]}),cacheSize:n.gauge({name:"gossipsub_cache_size",help:"Unbounded cache sizes",labelNames:["cache"]}),mcacheSize:n.gauge({name:"gossipsub_mcache_size",help:"Current mcache msg count"}),mcacheNotValidatedCount:n.gauge({name:"gossipsub_mcache_not_validated_count",help:"Current mcache msg count not validated"}),fastMsgIdCacheCollision:n.gauge({name:"gossipsub_fastmsgid_cache_collision_total",help:"Total count of key collisions on fastmsgid cache put"}),newConnectionCount:n.gauge({name:"gossipsub_new_connection_total",help:"Total new connection by status",labelNames:["status"]}),topicStrToLabel:i,toTopic(e){return this.topicStrToLabel.get(e)??e},onJoin(e){this.topicSubscriptionStatus.set({topicStr:e},1),this.meshPeerCounts.set({topicStr:e},0)},onLeave(e){this.topicSubscriptionStatus.set({topicStr:e},0),this.meshPeerCounts.set({topicStr:e},0)},onAddToMesh(e,t,r){let n=this.toTopic(e);switch(t){case ez.Fanout:this.meshPeerInclusionEventsFanout.inc({topic:n},r);break;case ez.Random:this.meshPeerInclusionEventsRandom.inc({topic:n},r);break;case ez.Subscribed:this.meshPeerInclusionEventsSubscribed.inc({topic:n},r);break;case ez.Outbound:this.meshPeerInclusionEventsOutbound.inc({topic:n},r);break;case ez.NotEnough:this.meshPeerInclusionEventsNotEnough.inc({topic:n},r);break;case ez.Opportunistic:this.meshPeerInclusionEventsOpportunistic.inc({topic:n},r);break;default:this.meshPeerInclusionEventsUnknown.inc({topic:n},r)}},onRemoveFromMesh(e,t,r){let n=this.toTopic(e);switch(t){case ej.Dc:this.meshPeerChurnEventsDisconnected.inc({topic:n},r);break;case ej.BadScore:this.meshPeerChurnEventsBadScore.inc({topic:n},r);break;case ej.Prune:this.meshPeerChurnEventsPrune.inc({topic:n},r);break;case ej.Excess:this.meshPeerChurnEventsExcess.inc({topic:n},r);break;default:this.meshPeerChurnEventsUnknown.inc({topic:n},r)}},onReportValidation(e,t,r){if(this.asyncValidationMcacheHit.inc({hit:null!=e?"hit":"miss"}),null!=e){let r=this.toTopic(e.message.topic);switch(t){case eM.Accept:this.acceptedMessagesTotal.inc({topic:r});break;case eM.Ignore:this.ignoredMessagesTotal.inc({topic:r});break;case eM.Reject:this.rejectedMessagesTotal.inc({topic:r});break;default:this.unknownValidationResultsTotal.inc({topic:r})}}null!=r?this.asyncValidationDelayFromFirstSeenSec.observe((Date.now()-r)/1e3):this.asyncValidationUnknownFirstSeen.inc()},onScorePenalty(e){this.scoringPenalties.inc({penalty:e},1)},onIhaveRcv(e,t,r){let n=this.toTopic(e);this.ihaveRcvMsgids.inc({topic:n},t),this.ihaveRcvNotSeenMsgids.inc({topic:n},r)},onIwantRcv(e,t){for(let[t,r]of e){let e=this.toTopic(t);this.iwantRcvMsgids.inc({topic:e},r)}this.iwantRcvDonthaveMsgids.inc(t)},onForwardMsg(e,t){let r=this.toTopic(e);this.msgForwardCount.inc({topic:r},1),this.msgForwardPeers.inc({topic:r},t)},onPublishMsg(e,t,r,n,i){let s=this.toTopic(e);this.msgPublishCount.inc({topic:s},1),this.msgPublishBytes.inc({topic:s},r*n),this.msgPublishPeersByTopic.inc({topic:s},r),this.directPeersPublishedTotal.inc({topic:s},t.direct),this.floodsubPeersPublishedTotal.inc({topic:s},t.floodsub),this.meshPeersPublishedTotal.inc({topic:s},t.mesh),this.fanoutPeersPublishedTotal.inc({topic:s},t.fanout),this.msgPublishTime.observe({topic:s},i/1e3)},onMsgRecvPreValidation(e){let t=this.toTopic(e);this.msgReceivedPreValidation.inc({topic:t},1)},onMsgRecvError(e){let t=this.toTopic(e);this.msgReceivedError.inc({topic:t},1)},onPrevalidationResult(e,t){let r=this.toTopic(e);switch(t){case e$.duplicate:this.prevalidationDuplicateTotal.inc({topic:r});break;case e$.invalid:this.prevalidationInvalidTotal.inc({topic:r});break;case e$.valid:this.prevalidationValidTotal.inc({topic:r});break;default:this.prevalidationUnknownTotal.inc({topic:r})}},onMsgRecvInvalid(e,t){let r=this.toTopic(e),n=t.reason===eV.Error?t.error:t.reason;this.msgReceivedInvalid.inc({error:n},1),this.msgReceivedInvalidByTopic.inc({topic:r},1)},onDuplicateMsgDelivery(e,t,r){let n=this.toTopic(e);this.duplicateMsgDeliveryDelay.observe({topic:n},t/1e3),r&&this.duplicateMsgLateDelivery.inc({topic:n},1)},onPublishDuplicateMsg(e){let t=this.toTopic(e);this.duplicateMsgIgnored.inc({topic:t},1)},onPeerReadStreamError(){this.peerReadStreamError.inc(1)},onRpcRecvError(){this.rpcRecvError.inc(1)},onRpcDataError(){this.rpcDataError.inc(1)},onRpcRecv(e,t){this.rpcRecvBytes.inc(t),this.rpcRecvCount.inc(1),null!=e.subscriptions&&this.rpcRecvSubscription.inc(e.subscriptions.length),null!=e.messages&&this.rpcRecvMessage.inc(e.messages.length),null!=e.control&&(this.rpcRecvControl.inc(1),null!=e.control.ihave&&this.rpcRecvIHave.inc(e.control.ihave.length),null!=e.control.iwant&&this.rpcRecvIWant.inc(e.control.iwant.length),null!=e.control.graft&&this.rpcRecvGraft.inc(e.control.graft.length),null!=e.control.prune&&this.rpcRecvPrune.inc(e.control.prune.length))},onRpcSent(e,t){if(this.rpcSentBytes.inc(t),this.rpcSentCount.inc(1),null!=e.subscriptions&&this.rpcSentSubscription.inc(e.subscriptions.length),null!=e.messages&&this.rpcSentMessage.inc(e.messages.length),null!=e.control){let t=e.control.ihave?.length??0,r=e.control.iwant?.length??0,n=e.control.graft?.length??0,i=e.control.prune?.length??0;t>0&&this.rpcSentIHave.inc(t),r>0&&this.rpcSentIWant.inc(r),n>0&&this.rpcSentGraft.inc(n),i>0&&this.rpcSentPrune.inc(i),(t>0||r>0||n>0||i>0)&&this.rpcSentControl.inc(1)}},registerScores(e,t){let r=0,n=0,i=0,s=0;for(let o of e)o>=t.graylistThreshold&&r++,o>=t.publishThreshold&&n++,o>=t.gossipThreshold&&i++,o>=0&&s++;this.peersByScoreThreshold.set({threshold:eY.graylist},r),this.peersByScoreThreshold.set({threshold:eY.publish},n),this.peersByScoreThreshold.set({threshold:eY.gossip},i),this.peersByScoreThreshold.set({threshold:eY.mesh},s),this.score.set(e)},registerScoreWeights(e){for(let[t,r]of e.byTopic)this.scoreWeights.set({topic:t,p:"p1"},r.p1w),this.scoreWeights.set({topic:t,p:"p2"},r.p2w),this.scoreWeights.set({topic:t,p:"p3"},r.p3w),this.scoreWeights.set({topic:t,p:"p3b"},r.p3bw),this.scoreWeights.set({topic:t,p:"p4"},r.p4w);this.scoreWeights.set({p:"p5"},e.p5w),this.scoreWeights.set({p:"p6"},e.p6w),this.scoreWeights.set({p:"p7"},e.p7w)},registerScorePerMesh(e,t){let r=new Map;for(let[n,i]of(e.forEach((e,t)=>{let n=this.topicStrToLabel.get(t)??"unknown",i=r.get(n);null==i&&(i=new Set,r.set(n,i)),e.forEach(e=>i?.add(e))}),r)){let e=[];i.forEach(r=>{e.push(t.get(r)??0)}),this.scorePerMesh.set({topic:n},e)}}});for(let e of(o.mcacheSize.addCollect(()=>{this.onScrapeMetrics(o)}),this.multicodecs))o.protocolsEnabled.set({protocol:e},1);this.metrics=o}else this.metrics=null;this.gossipTracer=new op(this.opts.gossipsubIWantFollowupMs,this.msgIdToStrFn,this.metrics),this.score=new ou(this.opts.scoreParams,this.metrics,this.components.logger,{scoreCacheValidityMs:r.heartbeatInterval}),this.maxInboundStreams=t.maxInboundStreams,this.maxOutboundStreams=t.maxOutboundStreams,this.runOnTransientConnection=t.runOnTransientConnection,this.allowedTopics=null!=r.allowedTopics?new Set(r.allowedTopics):null}getPeers(){return[...this.peers.keys()].map(e=>(0,nF.jE)(e))}isStarted(){return this.status.code===eX.started}async start(){if(this.isStarted())return;this.log("starting"),this.publishConfig=await o_(this.globalSignaturePolicy,this.components.peerId),this.outboundInflightQueue=(0,sE.dT)({objectMode:!0}),(0,tg.z)(this.outboundInflightQueue,async e=>{for await(let{peerId:t,connection:r}of e)await this.createOutboundStream(t,r)}).catch(e=>{this.log.error("outbound inflight queue error",e)}),await Promise.all(this.opts.directPeers.map(async e=>{await this.components.peerStore.merge(e.id,{multiaddrs:e.addrs})}));let e=this.components.registrar;await Promise.all(this.multicodecs.map(async t=>e.handle(t,this.onIncomingStream.bind(this),{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnTransientConnection:this.runOnTransientConnection})));let t={onConnect:this.onPeerConnected.bind(this),onDisconnect:this.onPeerDisconnected.bind(this),notifyOnTransient:this.runOnTransientConnection},r=await Promise.all(this.multicodecs.map(async r=>e.register(r,t))),n=setTimeout(this.runHeartbeat,100);this.status={code:eX.started,registrarTopologyIds:r,heartbeatTimeout:n,hearbeatStartMs:Date.now()+100},this.score.start(),this.directPeerInitial=setTimeout(()=>{Promise.resolve().then(async()=>{await Promise.all(Array.from(this.direct).map(async e=>this.connect(e)))}).catch(e=>{this.log(e)})},1e3),this.log("started")}async stop(){if(this.log("stopping"),this.status.code!==eX.started)return;let{registrarTopologyIds:e}=this.status;this.status={code:eX.stopped};let t=this.components.registrar;await Promise.all(this.multicodecs.map(async e=>t.unhandle(e))),e.forEach(e=>{t.unregister(e)}),this.outboundInflightQueue.end();let r=[];for(let e of this.streamsOutbound.values())r.push(e.close());for(let e of(this.streamsOutbound.clear(),this.streamsInbound.values()))r.push(e.close());this.streamsInbound.clear(),await Promise.all(r),this.peers.clear(),this.subscriptions.clear(),null!=this.heartbeatTimer&&(this.heartbeatTimer.cancel(),this.heartbeatTimer=null),this.score.stop(),this.mesh.clear(),this.fanout.clear(),this.fanoutLastpub.clear(),this.gossip.clear(),this.control.clear(),this.peerhave.clear(),this.iasked.clear(),this.backoff.clear(),this.outbound.clear(),this.gossipTracer.clear(),this.seenCache.clear(),null!=this.fastMsgIdCache&&this.fastMsgIdCache.clear(),null!=this.directPeerInitial&&clearTimeout(this.directPeerInitial),this.log("stopped")}dumpPeerScoreStats(){return this.score.dumpPeerScoreStats()}onIncomingStream({stream:e,connection:t}){if(!this.isStarted())return;let r=t.remotePeer;this.addPeer(r,t.direction,t.remoteAddr),this.createInboundStream(r,e),this.outboundInflightQueue.push({peerId:r,connection:t})}onPeerConnected(e,t){this.metrics?.newConnectionCount.inc({status:t.status}),this.isStarted()&&"open"===t.status&&(this.addPeer(e,t.direction,t.remoteAddr),this.outboundInflightQueue.push({peerId:e,connection:t}))}onPeerDisconnected(e){this.log("connection ended %p",e),this.removePeer(e)}async createOutboundStream(e,t){if(!this.isStarted())return;let r=e.toString();if(!(!this.peers.has(r)||this.streamsOutbound.has(r)))try{let n=new oh(await t.newStream(this.multicodecs,{runOnTransientConnection:this.runOnTransientConnection}),e=>{this.log.error("outbound pipe error",e)},{maxBufferSize:this.opts.maxOutboundBufferSize});this.log("create outbound stream %p",e),this.streamsOutbound.set(r,n);let i=n.protocol;i===s6&&this.floodsubPeers.add(r),this.metrics?.peersPerProtocol.inc({protocol:i},1),this.subscriptions.size>0&&(this.log("send subscriptions to",r),this.sendSubscriptions(r,Array.from(this.subscriptions),!0))}catch(e){this.log.error("createOutboundStream error",e)}}createInboundStream(e,t){if(!this.isStarted())return;let r=e.toString();if(!this.peers.has(r))return;let n=this.streamsInbound.get(r);void 0!==n&&(this.log("replacing existing inbound steam %s",r),n.close().catch(e=>{this.log.error(e)})),this.log("create inbound stream %s",r);let i=new od(t,{maxDataLength:this.opts.maxInboundDataLength});this.streamsInbound.set(r,i),this.pipePeerReadStream(e,i.source).catch(e=>{this.log(e)})}addPeer(e,t,r){let n=e.toString();if(!this.peers.has(n)){this.log("new peer %p",e),this.peers.add(n),this.score.addPeer(n);let i=function(e){for(let t of e.tuples())switch(t[0]){case eJ.ip4:case eJ.ip6:return(0,oI.xV)(t[0],t[1])}return null}(r);null!==i?this.score.addIP(n,i):this.log("Added peer has no IP in current address %s %s",n,r.toString()),this.outbound.has(n)||this.outbound.set(n,"outbound"===t)}}removePeer(e){let t=e.toString();if(!this.peers.has(t))return;this.log("delete peer %p",e),this.peers.delete(t);let r=this.streamsOutbound.get(t),n=this.streamsInbound.get(t);for(let e of(null!=r&&this.metrics?.peersPerProtocol.inc({protocol:r.protocol},-1),r?.close().catch(e=>{this.log.error(e)}),n?.close().catch(e=>{this.log.error(e)}),this.streamsOutbound.delete(t),this.streamsInbound.delete(t),this.topics.values()))e.delete(t);for(let[e,r]of this.mesh)r.delete(t)&&this.metrics?.onRemoveFromMesh(e,ej.Dc,1);for(let e of this.fanout.values())e.delete(t);this.floodsubPeers.delete(t),this.gossip.delete(t),this.control.delete(t),this.outbound.delete(t),this.score.removePeer(t),this.acceptFromWhitelist.delete(t)}get started(){return this.status.code===eX.started}getMeshPeers(e){let t=this.mesh.get(e);return null!=t?Array.from(t):[]}getSubscribers(e){let t=this.topics.get(e);return(null!=t?Array.from(t):[]).map(e=>(0,nF.jE)(e))}getTopics(){return Array.from(this.subscriptions)}async pipePeerReadStream(e,t){try{await (0,tg.z)(t,async t=>{for await(let r of t)try{let t=r.subarray(),n=eU.decode(t,{limits:{subscriptions:this.decodeRpcLimits.maxSubscriptions,messages:this.decodeRpcLimits.maxMessages,control$:{ihave:this.decodeRpcLimits.maxIhaveMessageIDs,iwant:this.decodeRpcLimits.maxIwantMessageIDs,graft:this.decodeRpcLimits.maxControlMessages,prune:this.decodeRpcLimits.maxControlMessages,prune$:{peers:this.decodeRpcLimits.maxPeerInfos}}}});if(this.metrics?.onRpcRecv(n,t.length),this.opts.awaitRpcHandler)try{await this.handleReceivedRpc(e,n)}catch(e){this.metrics?.onRpcRecvError(),this.log(e)}else this.handleReceivedRpc(e,n).catch(e=>{this.metrics?.onRpcRecvError(),this.log(e)})}catch(e){this.metrics?.onRpcDataError(),this.log(e)}})}catch(t){this.metrics?.onPeerReadStreamError(),this.handlePeerReadStreamError(t,e)}}handlePeerReadStreamError(e,t){this.log.error(e),this.onPeerDisconnected(t)}async handleReceivedRpc(e,t){if(!this.acceptFrom(e.toString())){this.log("received message from unacceptable peer %p",e),this.metrics?.rpcRecvNotAccepted.inc();return}let r=null!=t.subscriptions?t.subscriptions.length:0,n=null!=t.messages?t.messages.length:0,i=0,s=0,o=0,a=0;if(null!=t.control&&(null!=t.control.ihave&&(i=t.control.ihave.length),null!=t.control.iwant&&(s=t.control.iwant.length),null!=t.control.graft&&(o=t.control.graft.length),null!=t.control.prune&&(a=t.control.prune.length)),this.log(`rpc.from ${e.toString()} subscriptions ${r} messages ${n} ihave ${i} iwant ${s} graft ${o} prune ${a}`),null!=t.subscriptions&&t.subscriptions.length>0){let r=[];t.subscriptions.forEach(t=>{let n=t.topic,i=!0===t.subscribe;if(null!=n){if(null!=this.allowedTopics&&!this.allowedTopics.has(n))return;this.handleReceivedSubscription(e,n,i),r.push({topic:n,subscribe:i})}}),this.safeDispatchEvent("subscription-change",{detail:{peerId:e,subscriptions:r}})}for(let r of t.messages){if(null!=this.allowedTopics&&!this.allowedTopics.has(r.topic))continue;let t=this.handleReceivedMessage(e,r).catch(e=>{this.metrics?.onMsgRecvError(r.topic),this.log(e)});this.opts.awaitRpcMessageHandler&&await t}null!=t.control&&await this.handleControlMessage(e.toString(),t.control)}handleReceivedSubscription(e,t,r){this.log("subscription update from %p topic %s",e,t);let n=this.topics.get(t);null==n&&(n=new Set,this.topics.set(t,n)),r?n.add(e.toString()):n.delete(e.toString())}async handleReceivedMessage(e,t){this.metrics?.onMsgRecvPreValidation(t.topic);let r=await this.validateReceivedMessage(e,t);this.metrics?.onPrevalidationResult(t.topic,r.code);let n=r.code;switch(n){case e$.duplicate:this.score.duplicateMessage(e.toString(),r.msgIdStr,t.topic),this.gossipTracer.deliverMessage(r.msgIdStr,!0),this.mcache.observeDuplicate(r.msgIdStr,e.toString());return;case e$.invalid:if(null!=r.msgIdStr){let n=r.msgIdStr;this.score.rejectMessage(e.toString(),n,t.topic,r.reason),this.gossipTracer.rejectMessage(n,r.reason)}else this.score.rejectInvalidMessage(e.toString(),t.topic);this.metrics?.onMsgRecvInvalid(t.topic,r);return;case e$.valid:this.score.validateMessage(r.messageId.msgIdStr),this.gossipTracer.deliverMessage(r.messageId.msgIdStr),this.mcache.put(r.messageId,t,!this.opts.asyncValidation),this.subscriptions.has(t.topic)&&(!this.components.peerId.equals(e)||this.opts.emitSelf)&&(super.dispatchEvent(new tQ.A("gossipsub:message",{detail:{propagationSource:e,msgId:r.messageId.msgIdStr,msg:r.msg}})),super.dispatchEvent(new tQ.A("message",{detail:r.msg}))),this.opts.asyncValidation||this.forwardMessage(r.messageId.msgIdStr,t,e.toString());break;default:throw Error(`Invalid validation result: ${n}`)}}async validateReceivedMessage(e,t){let r=this.fastMsgIdFn?.(t),n=void 0!==r?this.fastMsgIdCache?.get(r):void 0;if(null!=n)return{code:e$.duplicate,msgIdStr:n};let i=await om(this.globalSignaturePolicy,t);if(!i.valid)return{code:e$.invalid,reason:eV.Error,error:i.error};let s=i.message;try{null!=this.dataTransform&&(s.data=this.dataTransform.inboundTransform(t.topic,s.data))}catch(e){return this.log("Invalid message, transform failed",e),{code:e$.invalid,reason:eV.Error,error:eH.TransformFailed}}let o=await this.msgIdFn(s),a=this.msgIdToStrFn(o);if(void 0!==r&&null!=this.fastMsgIdCache&&this.fastMsgIdCache.put(r,a)&&this.metrics?.fastMsgIdCacheCollision.inc(),this.seenCache.has(a))return{code:e$.duplicate,msgIdStr:a};this.seenCache.put(a);let l=this.topicValidators.get(t.topic);if(null!=l){let t;try{t=await l(e,s)}catch(r){let e=r.code;"ERR_TOPIC_VALIDATOR_IGNORE"===e&&(t=eM.Ignore),t="ERR_TOPIC_VALIDATOR_REJECT"===e?eM.Reject:eM.Ignore}if(t!==eM.Accept)return{code:e$.invalid,reason:oe(t),msgIdStr:a}}return{code:e$.valid,messageId:{msgId:o,msgIdStr:a},msg:s}}getScore(e){return this.score.score(e)}sendSubscriptions(e,t,r){this.sendRpc(e,{subscriptions:t.map(e=>({topic:e,subscribe:r})),messages:[]})}async handleControlMessage(e,t){if(void 0===t)return;let r=null!=t.ihave?this.handleIHave(e,t.ihave):[],n=null!=t.iwant?this.handleIWant(e,t.iwant):[],i=null!=t.graft?await this.handleGraft(e,t.graft):[];if(null!=t.prune&&await this.handlePrune(e,t.prune),0===r.length&&0===n.length&&0===i.length)return;let s=this.sendRpc(e,oy(n,{iwant:r,prune:i})),o=r[0]?.messageIDs;null!=o&&(s?this.gossipTracer.addPromise(e,o):this.metrics?.iwantPromiseUntracked.inc(1))}acceptFrom(e){if(this.direct.has(e))return!0;let t=Date.now(),r=this.acceptFromWhitelist.get(e);if(null!=r&&r.messagesAccepted<128&&r.acceptUntil>=t)return r.messagesAccepted+=1,!0;let n=this.score.score(e);return n>=0?this.acceptFromWhitelist.set(e,{messagesAccepted:0,acceptUntil:t+1e3}):this.acceptFromWhitelist.delete(e),n>=this.opts.scoreThresholds.graylistThreshold}handleIHave(e,t){if(0===t.length)return[];let r=this.score.score(e);if(r10)return this.log("IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring",e,n),this.metrics?.ihaveRcvIgnored.inc({reason:eW.MaxIhave}),[];let i=this.iasked.get(e)??0;if(i>=5e3)return this.log("IHAVE: peer %s has already advertised too many messages (%d); ignoring",e,i),this.metrics?.ihaveRcvIgnored.inc({reason:eW.MaxIasked}),[];let s=new Map;if(t.forEach(({topicID:e,messageIDs:t})=>{if(null==e||null==t||!this.mesh.has(e))return;let r=0;t.forEach(e=>{let t=this.msgIdToStrFn(e);!this.seenCache.has(t)&&(s.set(t,e),r++)}),this.metrics?.onIhaveRcv(e,t.length,r)}),0===s.size)return[];let o=s.size;o+i>5e3&&(o=5e3-i),this.log("IHAVE: Asking for %d out of %d messages from %s",o,s.size,e);let a=Array.from(s.values());return ow(a),a=a.slice(0,o),this.iasked.set(e,i+o),[{messageIDs:a}]}handleIWant(e,t){if(0===t.length)return[];let r=this.score.score(e);if(r{t?.forEach(t=>{let r=this.msgIdToStrFn(t),o=this.mcache.getWithIWantCount(r,e);if(null==o){s++;return}if(i.set(o.msg.topic,1+(i.get(o.msg.topic)??0)),o.count>3){this.log("IWANT: Peer %s has asked for message %s too many times: ignoring request",e,t);return}n.set(r,o.msg)})}),this.metrics?.onIwantRcv(i,s),0===n.size)?(this.log("IWANT: Could not provide any wanted messages to %s",e),[]):(this.log("IWANT: Sending %d messages to %s",n.size,e),Array.from(n.values()))}async handleGraft(e,t){let r=[],n=this.score.score(e),i=Date.now(),s=this.opts.doPX;return(t.forEach(({topicID:t})=>{if(null==t)return;let o=this.mesh.get(t);if(null==o){s=!1;return}if(o.has(e))return;if(this.direct.has(e)){this.log("GRAFT: ignoring request from direct peer %s",e),r.push(t),s=!1;return}let a=this.backoff.get(t)?.get(e);if("number"==typeof a&&i=this.opts.Dhi&&!this.outbound.get(e)){r.push(t),this.addBackoff(e,t);return}this.log("GRAFT: Add mesh link from %s in %s",e,t),this.score.graft(e,t),o.add(e),this.metrics?.onAddToMesh(t,ez.Subscribed,1)}),0===r.length)?[]:Promise.all(r.map(async t=>this.makePrune(e,t,s,!1)))}async handlePrune(e,t){let r=this.score.score(e);for(let{topicID:n,backoff:i,peers:s}of t){if(null==n)continue;let t=this.mesh.get(n);if(null==t)return;if(this.log("PRUNE: Remove mesh link to %s in %s",e,n),this.score.prune(e,n),t.has(e)&&(t.delete(e),this.metrics?.onRemoveFromMesh(n,ej.Prune,1)),"number"==typeof i&&i>0?this.doAddBackoff(e,n,1e3*i):this.addBackoff(e,n),null!=s&&s.length>0){if(r{this.log("peer %s didn't follow up in %d IWANT requests; adding penalty",t,e),this.score.addPenalty(t,e,eG.BrokenPromise)})}clearBackoff(){if(this.heartbeatTicks%15!=0)return;let e=Date.now();this.backoff.forEach((t,r)=>{t.forEach((r,n)=>{r+1*this.opts.heartbeatInterval{this.streamsOutbound.has(t)||e.push(t)}),await Promise.all(e.map(async e=>this.connect(e)))}async pxConnect(e){e.length>this.opts.prunePeers&&(ow(e),e=e.slice(0,this.opts.prunePeers));let t=[];await Promise.all(e.map(async e=>{if(null==e.peerID)return;let r=(0,nF.cv)(e.peerID),n=r.toString();if(!this.peers.has(n)){if(null==e.signedPeerRecord){t.push(n);return}try{if(!await this.components.peerStore.consumePeerRecord(e.signedPeerRecord,r)){this.log("bogus peer record obtained through px: could not add peer record to address book");return}t.push(n)}catch(e){this.log("bogus peer record obtained through px: invalid signature or not a peer record")}}})),0!==t.length&&await Promise.all(t.map(async e=>this.connect(e)))}async connect(e){this.log("Initiating connection with %s",e);let t=(0,nF.jE)(e),r=await this.components.connectionManager.openConnection(t);for(let e of this.multicodecs)for(let n of this.components.registrar.getTopologies(e))n.onConnect?.(t,r)}subscribe(e){if(this.status.code!==eX.started)throw Error("Pubsub has not started");if(!this.subscriptions.has(e))for(let t of(this.subscriptions.add(e),this.peers.keys()))this.sendSubscriptions(t,[e],!0);this.join(e)}unsubscribe(e){if(this.status.code!==eX.started)throw Error("Pubsub is not started");let t=this.subscriptions.delete(e);if(this.log("unsubscribe from %s - am subscribed %s",e,t),t)for(let t of this.peers.keys())this.sendSubscriptions(t,[e],!1);this.leave(e)}join(e){if(this.status.code!==eX.started)throw Error("Gossipsub has not started");if(this.mesh.has(e))return;this.log("JOIN %s",e),this.metrics?.onJoin(e);let t=new Set,r=this.backoff.get(e),n=this.fanout.get(e);if(null!=n&&(this.fanout.delete(e),this.fanoutLastpub.delete(e),n.forEach(e=>{!this.direct.has(e)&&this.score.score(e)>=0&&(null==r||!r.has(e))&&t.add(e)}),this.metrics?.onAddToMesh(e,ez.Fanout,t.size)),t.size!t.has(e)&&!this.direct.has(e)&&this.score.score(e)>=0&&(null==r||!r.has(e))).forEach(e=>{t.add(e)}),this.metrics?.onAddToMesh(e,ez.Random,t.size-n)}this.mesh.set(e,t),t.forEach(t=>{this.log("JOIN: Add mesh link to %s in %s",t,e),this.sendGraft(t,e)})}leave(e){if(this.status.code!==eX.started)throw Error("Gossipsub has not started");this.log("LEAVE %s",e),this.metrics?.onLeave(e);let t=this.mesh.get(e);null!=t&&(Promise.all(Array.from(t).map(async t=>{this.log("LEAVE: Remove mesh link to %s in %s",t,e),await this.sendPrune(t,e)})).catch(e=>{this.log("Error sending prunes to mesh peers",e)}),this.mesh.delete(e))}selectPeersToForward(e,t,r){let n=new Set,i=this.topics.get(e);null!=i&&(this.direct.forEach(e=>{i.has(e)&&t!==e&&!r?.has(e)&&n.add(e)}),this.floodsubPeers.forEach(e=>{i.has(e)&&t!==e&&!r?.has(e)&&this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&n.add(e)}));let s=this.mesh.get(e);return null!=s&&s.size>0&&s.forEach(e=>{t===e||r?.has(e)||n.add(e)}),n}selectPeersToPublish(e){let t=new Set,r={direct:0,floodsub:0,mesh:0,fanout:0},n=this.topics.get(e);if(null!=n){if(this.opts.floodPublish)n.forEach(e=>{this.direct.has(e)?(t.add(e),r.direct++):this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&(t.add(e),r.floodsub++)});else{this.direct.forEach(e=>{n.has(e)&&(t.add(e),r.direct++)}),this.floodsubPeers.forEach(e=>{n.has(e)&&this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&(t.add(e),r.floodsub++)});let i=this.mesh.get(e);if(null!=i&&i.size>0)i.forEach(e=>{t.add(e),r.mesh++});else{let n=this.fanout.get(e);if(null!=n&&n.size>0)n.forEach(e=>{t.add(e),r.fanout++});else{let n=this.getRandomGossipPeers(e,this.opts.D,e=>this.score.score(e)>=this.opts.scoreThresholds.publishThreshold);n.size>0&&(this.fanout.set(e,n),n.forEach(e=>{t.add(e),r.fanout++}))}this.fanoutLastpub.set(e,Date.now())}}}return{tosend:t,tosendCount:r}}forwardMessage(e,t,r,n){null!=r&&this.score.deliverMessage(r,e,t.topic);let i=this.selectPeersToForward(t.topic,r,n);i.forEach(e=>{this.sendRpc(e,oy([t]))}),this.metrics?.onForwardMsg(t.topic,i.size)}async publish(e,t,r){let n=Date.now(),i=null!=this.dataTransform?this.dataTransform.outboundTransform(e,t):t;if(null==this.publishConfig)throw Error("PublishError.Uninitialized");let{raw:s,msg:o}=await og(this.publishConfig,e,t,i),a=await this.msgIdFn(o),l=this.msgIdToStrFn(a),c=r?.ignoreDuplicatePublishError??this.opts.ignoreDuplicatePublishError;if(this.seenCache.has(l)){if(c)return this.metrics?.onPublishDuplicateMsg(e),{recipients:[]};throw Error("PublishError.Duplicate")}let{tosend:u,tosendCount:h}=this.selectPeersToPublish(e),d=this.opts.emitSelf&&this.subscriptions.has(e),p=r?.allowPublishToZeroPeers??this.opts.allowPublishToZeroPeers;if(0===u.size&&!p&&!d)throw Error("PublishError.InsufficientPeers");this.seenCache.put(l),this.mcache.put({msgId:a,msgIdStr:l},s,!0),this.publishedMessageIds.put(l);let f=r?.batchPublish??this.opts.batchPublish,g=oy([s]);if(f)this.sendRpcInBatch(u,g);else for(let e of u)this.sendRpc(e,g)||u.delete(e);let m=Date.now()-n;return this.metrics?.onPublishMsg(e,h,u.size,null!=s.data?s.data.length:0,m),d&&(u.add(this.components.peerId.toString()),super.dispatchEvent(new tQ.A("gossipsub:message",{detail:{propagationSource:this.components.peerId,msgId:l,msg:o}})),super.dispatchEvent(new tQ.A("message",{detail:o}))),{recipients:Array.from(u.values()).map(e=>(0,nF.jE)(e))}}sendRpcInBatch(e,t){let r=eU.encode(t),n=tf.c.single(r);for(let i of e){let s=this.streamsOutbound.get(i);if(null==s){this.log(`Cannot send RPC to ${i} as there is no open stream to it available`),e.delete(i);continue}try{s.pushPrefixed(n)}catch(t){e.delete(i),this.log.error(`Cannot send rpc to ${i}`,t)}this.metrics?.onRpcSent(t,r.length)}}reportMessageValidationResult(e,t,r){let n;if(r===eM.Accept){if(null!=(n=this.mcache.validate(e))){let{message:r,originatingPeers:i}=n;this.score.deliverMessage(t,e,r.topic),this.forwardMessage(e,n.message,t,i)}}else if(null!=(n=this.mcache.remove(e))){let i=oe(r),{message:s,originatingPeers:o}=n;for(let r of(this.score.rejectMessage(t,e,s.topic,i),o))this.score.rejectMessage(r,e,s.topic,i)}let i=this.score.messageFirstSeenTimestampMs(e);this.metrics?.onReportValidation(n,r,i)}sendGraft(e,t){let r=oy([],{graft:[{topicID:t}]});this.sendRpc(e,r)}async sendPrune(e,t){let r=oy([],{prune:[await this.makePrune(e,t,this.opts.doPX,!0)]});this.sendRpc(e,r)}sendRpc(e,t){let r=this.streamsOutbound.get(e);if(null==r)return this.log(`Cannot send RPC to ${e} as there is no open stream to it available`),!1;let n=this.control.get(e);null!=n&&(this.piggybackControl(e,t,n),this.control.delete(e));let i=this.gossip.get(e);null!=i&&(this.piggybackGossip(e,t,i),this.gossip.delete(e));let s=eU.encode(t);try{r.push(s)}catch(t){return this.log.error(`Cannot send rpc to ${e}`,t),null!=n&&this.control.set(e,n),null!=i&&this.gossip.set(e,i),!1}return this.metrics?.onRpcSent(t,s.length),!0}piggybackControl(e,t,r){let n=ob(t);for(let t of r.graft)null!=t.topicID&&this.mesh.get(t.topicID)?.has(e)&&n.control.graft.push(t);for(let t of r.prune)null==t.topicID||this.mesh.get(t.topicID)?.has(e)||n.control.prune.push(t)}piggybackGossip(e,t,r){ob(t).control.ihave=r}async sendGraftPrune(e,t,r){let n=this.opts.doPX;for(let[i,s]of e){let e=s.map(e=>({topicID:e})),o=[],a=t.get(i);null!=a&&(o=await Promise.all(a.map(async e=>this.makePrune(i,e,n&&!r.get(i),!1))),t.delete(i)),this.sendRpc(i,oy([],{graft:e,prune:o}))}for(let[e,i]of t){let t=await Promise.all(i.map(async t=>this.makePrune(e,t,n&&!r.get(e),!1)));this.sendRpc(e,oy([],{prune:t}))}}emitGossip(e){let t=this.mcache.getGossipIDs(new Set(e.keys()));for(let[r,n]of e)this.doEmitGossip(r,n,t.get(r)??[])}doEmitGossip(e,t,r){if(0===r.length||(ow(r),r.length>5e3&&this.log("too many messages for gossip; will truncate IHAVE list (%d messages)",r.length),0===t.size))return;let n=this.opts.Dlazy,i=.25*t.size,s=t;i>n&&(n=i),n>s.size?n=s.size:s=ow(Array.from(s)).slice(0,n),s.forEach(t=>{let n=r;r.length>5e3&&(n=ow(n.slice()).slice(0,5e3)),this.pushGossip(t,{topicID:e,messageIDs:n})})}flush(){for(let[e,t]of this.gossip.entries())this.gossip.delete(e),this.sendRpc(e,oy([],{ihave:t}));for(let[e,t]of this.control.entries()){this.control.delete(e);let r=oy([],{graft:t.graft,prune:t.prune});this.sendRpc(e,r)}}pushGossip(e,t){this.log("Add gossip to %s",e);let r=this.gossip.get(e)??[];this.gossip.set(e,r.concat(t))}async makePrune(e,t,r,n){if(this.score.prune(e,t),this.streamsOutbound.get(e)?.protocol===s5)return{topicID:t,peers:[]};let i=n?this.opts.unsubcribeBackoff:this.opts.pruneBackoff,s=i/1e3;if(this.doAddBackoff(e,t,i),!r)return{topicID:t,peers:[],backoff:s};let o=this.getRandomGossipPeers(t,this.opts.prunePeers,t=>t!==e&&this.score.score(t)>=0);return{topicID:t,peers:await Promise.all(Array.from(o).map(async e=>{let t;let r=(0,nF.jE)(e);try{t=await this.components.peerStore.get(r)}catch(e){if("ERR_NOT_FOUND"!==e.code)throw e}return{peerID:r.toBytes(),signedPeerRecord:t?.peerRecordEnvelope}})),backoff:s}}runHeartbeat=()=>{let e=this.metrics?.heartbeatDuration.startTimer();this.heartbeat().catch(e=>{this.log("Error running heartbeat",e)}).finally(()=>{if(null!=e&&e(),this.status.code===eX.started){clearTimeout(this.status.heartbeatTimeout);let e=this.opts.heartbeatInterval-(Date.now()-this.status.hearbeatStartMs)%this.opts.heartbeatInterval;e<.25*this.opts.heartbeatInterval&&(e+=this.opts.heartbeatInterval,this.metrics?.heartbeatSkipped.inc()),this.status.heartbeatTimeout=setTimeout(this.runHeartbeat,e)}})};async heartbeat(){let{D:e,Dlo:t,Dhi:r,Dscore:n,Dout:i,fanoutTTL:s}=this.opts;this.heartbeatTicks++;let o=new Map,a=e=>{let t=o.get(e);return void 0===t&&(t=this.score.score(e),o.set(e,t)),t},l=new Map,c=new Map,u=new Map;this.clearBackoff(),this.peerhave.clear(),this.metrics?.cacheSize.set({cache:"iasked"},this.iasked.size),this.iasked.clear(),this.applyIwantPenalties(),this.heartbeatTicks%this.opts.directConnectTicks==0&&await this.directConnect(),this.fastMsgIdCache?.prune(),this.seenCache.prune(),this.gossipTracer.prune(),this.publishedMessageIds.prune();let h=new Map;this.mesh.forEach((s,o)=>{let d=this.topics.get(o),p=new Set,f=new Set;if(h.set(o,f),null!=d){let e=ow(Array.from(d)),t=this.backoff.get(o);for(let r of e){let e=this.streamsOutbound.get(r);if(null!=e&&this.multicodecs.includes(e.protocol)&&!s.has(r)&&!this.direct.has(r)){let e=a(r);(null==t||!t.has(r))&&e>=0&&p.add(r),e>=this.opts.scoreThresholds.gossipThreshold&&f.add(r)}}}let g=(e,t)=>{this.log("HEARTBEAT: Remove mesh link to %s in %s",e,o),this.addBackoff(e,o),s.delete(e),a(e)>=this.opts.scoreThresholds.gossipThreshold&&f.add(e),this.metrics?.onRemoveFromMesh(o,t,1);let r=c.get(e);null==r?c.set(e,[o]):r.push(o)},m=(e,t)=>{this.log("HEARTBEAT: Add mesh link to %s in %s",e,o),this.score.graft(e,o),s.add(e),f.delete(e),this.metrics?.onAddToMesh(o,t,1);let r=l.get(e);null==r?l.set(e,[o]):r.push(o)};if(s.forEach(e=>{let t=a(e);t<0&&(this.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",e,t,o),g(e,ej.BadScore),u.set(e,!0))}),s.size!0).forEach(e=>{m(e,ez.NotEnough)}),s.size>r){let t=Array.from(s);t.sort((e,t)=>a(t)-a(e));let r=0;if((t=t.slice(0,n).concat(ow(t.slice(n)))).slice(0,e).forEach(e=>{this.outbound.get(e)&&r++}),r{let r=t[e];for(let r=e;r>0;r--)t[r]=t[r-1];t[0]=r};if(r>0){let i=r;for(let r=1;r0;r++)this.outbound.get(t[r])&&(n(r),i--)}let i=e-r;for(let r=e;r0;r++)this.outbound.get(t[r])&&(n(r),i--)}t.slice(e).forEach(e=>{g(e,ej.Excess)})}if(s.size>=t){let e=0;s.forEach(t=>{this.outbound.get(t)&&e++}),e!0===this.outbound.get(e)).forEach(e=>{m(e,ez.Outbound)})}if(this.heartbeatTicks%this.opts.opportunisticGraftTicks==0&&s.size>1){let e=Array.from(s).sort((e,t)=>a(e)-a(t)),t=a(e[Math.floor(s.size/2)]);if(ta(e)>t))this.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",e,o),m(e,ez.Opportunistic)}});let d=Date.now();this.fanoutLastpub.forEach((e,t)=>{e+s{let n=this.topics.get(r);t.forEach(e=>{(!n?.has(e)||a(e)=this.opts.scoreThresholds.publishThreshold&&s.push(e),t>=this.opts.scoreThresholds.gossipThreshold&&o.add(e)}}if(t.size{t.add(e),o?.delete(e)})}}),this.emitGossip(h),await this.sendGraftPrune(l,c,u),this.flush(),this.mcache.shift(),this.dispatchEvent(new tQ.A("gossipsub:heartbeat"))}getRandomGossipPeers(e,t,r=()=>!0){let n=this.topics.get(e);if(null==n)return new Set;let i=[];return n.forEach(e=>{let t=this.streamsOutbound.get(e);null!=t&&this.multicodecs.includes(t.protocol)&&r(e)&&i.push(e)}),i=ow(i),t>0&&i.length>t&&(i=i.slice(0,t)),new Set(i)}onScrapeMetrics(e){e.mcacheSize.set(this.mcache.size),e.mcacheNotValidatedCount.set(this.mcache.notValidatedCount),e.cacheSize.set({cache:"direct"},this.direct.size),e.cacheSize.set({cache:"seenCache"},this.seenCache.size),e.cacheSize.set({cache:"fastMsgIdCache"},this.fastMsgIdCache?.size??0),e.cacheSize.set({cache:"publishedMessageIds"},this.publishedMessageIds.size),e.cacheSize.set({cache:"mcache"},this.mcache.size),e.cacheSize.set({cache:"score"},this.score.size),e.cacheSize.set({cache:"gossipTracer.promises"},this.gossipTracer.size),e.cacheSize.set({cache:"gossipTracer.requests"},this.gossipTracer.requestMsByMsgSize),e.cacheSize.set({cache:"topics"},this.topics.size),e.cacheSize.set({cache:"subscriptions"},this.subscriptions.size),e.cacheSize.set({cache:"mesh"},this.mesh.size),e.cacheSize.set({cache:"fanout"},this.fanout.size),e.cacheSize.set({cache:"peers"},this.peers.size),e.cacheSize.set({cache:"streamsOutbound"},this.streamsOutbound.size),e.cacheSize.set({cache:"streamsInbound"},this.streamsInbound.size),e.cacheSize.set({cache:"acceptFromWhitelist"},this.acceptFromWhitelist.size),e.cacheSize.set({cache:"gossip"},this.gossip.size),e.cacheSize.set({cache:"control"},this.control.size),e.cacheSize.set({cache:"peerhave"},this.peerhave.size),e.cacheSize.set({cache:"outbound"},this.outbound.size);let t=0,r=Date.now();for(let n of(e.connectedPeersBackoffSec.reset(),this.backoff.values()))for(let[i,s]of(t+=n.size,n.entries()))this.peers.has(i)&&e.connectedPeersBackoffSec.observe(Math.max(0,s-r)/1e3);for(let[r,n]of(e.cacheSize.set({cache:"backoff"},t),this.topics))e.topicPeersCount.set({topicStr:r},n.size);for(let[t,r]of this.mesh)e.meshPeerCounts.set({topicStr:t},r.size);let n=[],i=new Map;for(let t of(e.behaviourPenalty.reset(),this.peers.keys())){let r=this.score.score(t);n.push(r),i.set(t,r),e.behaviourPenalty.observe(this.score.peerStats.get(t)?.behaviourPenalty??0)}e.registerScores(n,this.opts.scoreThresholds),e.registerScorePerMesh(this.mesh,i);let s=function(e,t,r,n,i){let s={byTopic:new Map,p5w:[],p6w:[],p7w:[],score:[]};for(let o of e){let e=t.get(o);if(null!=e){let t=function(e,t,r,n,i){let s,o=0,a=new Map;if(Object.entries(t.topics).forEach(([e,t])=>{let n=i.get(e)??"unknown",s=r.topics[e];if(void 0===s)return;let l=a.get(n);null==l&&(l={p1w:0,p2w:0,p3w:0,p3bw:0,p4w:0},a.set(n,l));let c=0,u=0,h=0,d=0,p=0;t.inMesh&&(c+=Math.max(t.meshTime/s.timeInMeshQuantum,s.timeInMeshCap)*s.timeInMeshWeight);let f=t.firstMessageDeliveries;if(f>s.firstMessageDeliveriesCap&&(f=s.firstMessageDeliveriesCap),u+=f*s.firstMessageDeliveriesWeight,t.meshMessageDeliveriesActive&&t.meshMessageDeliveries0&&o>r.topicScoreCap){o=r.topicScoreCap;let e=r.topicScoreCap/o;for(let t of a.values())t.p1w*=e,t.p2w*=e,t.p3w*=e,t.p3bw*=e,t.p4w*=e}let l=0,c=0;return s=0+r.appSpecificScore(e)*r.appSpecificWeight,t.knownIPs.forEach(e=>{if(r.IPColocationFactorWhitelist.has(e))return;let t=n.get(e),i=null!=t?t.size:0;if(i>r.IPColocationFactorThreshold){let e=i-r.IPColocationFactorThreshold;l+=e*e*r.IPColocationFactorWeight}}),c+=t.behaviourPenalty*t.behaviourPenalty*r.behaviourPenaltyWeight,o+=s+l+c,{byTopic:a,p5w:s,p6w:l,p7w:c,score:o}}(o,e,r,n,i);for(let[e,r]of t.byTopic){let t=s.byTopic.get(e);null==t&&(t={p1w:[],p2w:[],p3w:[],p3bw:[],p4w:[]},s.byTopic.set(e,t)),t.p1w.push(r.p1w),t.p2w.push(r.p2w),t.p3w.push(r.p3w),t.p3bw.push(r.p3bw),t.p4w.push(r.p4w)}s.p5w.push(t.p5w),s.p6w.push(t.p6w),s.p7w.push(t.p7w),s.score.push(t.score)}else s.p5w.push(0),s.p6w.push(0),s.p7w.push(0),s.score.push(0)}return s}(this.peers.keys(),this.score.peerStats,this.score.params,this.score.peerIPs,e.topicStrToLabel);e.registerScoreWeights(s)}}let oR=["/vac/waku/relay/2.0.0"],ok=new ts.Yd("relay");function oP(e,t){let r=performance.now();ok.info(`validating message from ${e} received on ${t.topic}`);let n=eM.Accept;try{let e=ti.u.H.decode(t.data);e.contentTopic&&e.contentTopic.length&&e.payload&&e.payload.length||(n=eM.Reject)}catch(e){n=eM.Reject}let i=performance.now()-r;return i>100?ok.warn(`message validation took ${i}ms for peer ${e} on topic ${t.topic}. This should be less than 100ms.`):ok.info(`message validation took ${i}ms for peer ${e} on topic ${t.topic}`),n}class oD{pubsubTopic;proto;payload=new Uint8Array;rateLimitProof;timestamp;meta;ephemeral;constructor(e,t){this.pubsubTopic=e,this.proto=t}get contentTopic(){return this.proto.contentTopic}}class oB{pubsubTopic=tC.nf;contentTopic="";fromWireToProtoObj(e){return Promise.resolve({contentTopic:ti.aF.decode(e).contentTopic,payload:new Uint8Array,rateLimitProof:void 0,timestamp:void 0,meta:void 0,version:void 0,ephemeral:void 0})}async fromProtoObj(e,t){return new oD(e,t)}}let oN=new ts.Yd("relay");class oL{pubsubTopics;defaultDecoder;static multicodec="/vac/waku/relay/2.0.0";gossipSub;observers;constructor(e,t){if(!this.isRelayPubsub(e.services.pubsub))throw Error(`Failed to initialize Relay. libp2p.pubsub does not support ${oL.multicodec}`);this.gossipSub=e.services.pubsub,this.pubsubTopics=new Set(t),this.gossipSub.isStarted()&&this.subscribeToAllTopics(),this.observers=new Map,this.defaultDecoder=new oB}async start(){if(this.gossipSub.isStarted())throw Error("GossipSub already started.");await this.gossipSub.start(),this.subscribeToAllTopics()}async send(e,t){let r=[],{pubsubTopic:n}=e;if(!this.pubsubTopics.has(n))return oN.error("Failed to send waku relay: topic not configured"),{successes:r,failures:[{error:tC.K1.TOPIC_NOT_CONFIGURED}]};let i=await e.toWire(t);if(!i)return oN.error("Failed to encode message, aborting publish"),{successes:r,failures:[{error:tC.K1.ENCODE_FAILED}]};if(!(0,ts.qc)(i))return oN.error("Failed to send waku relay: message is bigger that 1MB"),{successes:r,failures:[{error:tC.K1.SIZE_TOO_BIG}]};let{recipients:s}=await this.gossipSub.publish(n,i);return{successes:s}}subscribe(e,t){let r=[];for(let n of Array.isArray(e)?e:[e]){let{pubsubTopic:e}=n,i=this.observers.get(e)??new Map,s={pubsubTopic:e,decoder:n,callback:t};(0,ts.IC)(i,n.contentTopic,s),this.observers.set(e,i),r.push([e,s])}return()=>{this.removeObservers(r)}}removeObservers(e){for(let[t,r]of e){let e=this.observers.get(t);if(!e)continue;let n=r.decoder.contentTopic,i=e.get(n);i&&(i.delete(r),e.set(n,i),this.observers.set(t,e))}}toSubscriptionIterator(e){return(0,ts.B2)(this,e)}getActiveSubscriptions(){let e=new Map;for(let t of this.pubsubTopics)e.set(t,Array.from(this.observers.keys()));return e}getMeshPeers(e=tC.nf){return this.gossipSub.getMeshPeers(e)}subscribeToAllTopics(){for(let e of this.pubsubTopics)this.gossipSubSubscribe(e)}async processIncomingMessage(e,t){let r=await this.defaultDecoder.fromWireToProtoObj(t);if(!r||!r.contentTopic){oN.warn("Message does not have a content topic, skipping");return}let n=this.observers.get(e);if(!n)return;let i=n.get(r.contentTopic);i&&await Promise.all(Array.from(i).map(({decoder:n,callback:i})=>(async()=>{try{let s=await n.fromWireToProtoObj(t);if(!s){oN.error("Internal error: message previously decoded failed on 2nd pass.");return}let o=await n.fromProtoObj(e,s);o?await i(o):oN.error("Failed to decode messages on",r.contentTopic)}catch(e){oN.error("Error while decoding message:",e)}})()))}gossipSubSubscribe(e){this.gossipSub.addEventListener("gossipsub:message",t=>{t.detail.msg.topic===e&&this.processIncomingMessage(t.detail.msg.topic,t.detail.msg.data).catch(e=>oN.error("Failed to process incoming message",e))}),this.gossipSub.topicValidators.set(e,oP),this.gossipSub.subscribe(e)}isRelayPubsub(e){return e?.multicodecs?.includes(oL.multicodec)??!1}}let ox=Symbol.for("@libp2p/content-routing"),oO=Symbol.for("@libp2p/peer-routing");var oM=r(55022),oU=r(60522);function oF(){return{forComponent:e=>{let t;return t=function(e){let t=()=>{};return t.enabled=!1,t.color="",t.diff=0,t.log=()=>{},t.namespace=e,t.destroy=()=>!0,t.extend=()=>t,t}(`${e}:trace`),oM.enabled(`${e}:trace`)&&null!=oM.names.map(e=>e.toString()).find(e=>e.includes(":trace"))&&(t=oM(`${e}:trace`)),Object.assign(oM(e),{error:oM(`${e}:error`),trace:t})}}}function oK(e,t){let r={[Symbol.iterator]:()=>r,next:()=>{let r=e.next(),n=r.value;return!0===r.done||null==n?{done:!0,value:void 0}:{done:!1,value:t(n)}}};return r}oM.formatters.b=e=>null==e?"undefined":r1.base58btc.baseEncode(e),oM.formatters.t=e=>null==e?"undefined":oU.base32.baseEncode(e),oM.formatters.m=e=>null==e?"undefined":nt.base64.baseEncode(e),oM.formatters.p=e=>null==e?"undefined":e.toString(),oM.formatters.c=e=>null==e?"undefined":e.toString(),oM.formatters.k=e=>null==e?"undefined":e.toString(),oM.formatters.a=e=>null==e?"undefined":e.toString();class oV{set;constructor(e){if(this.set=new Set,null!=e)for(let t of e)this.set.add(t.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(e){this.set.add(e.toString())}clear(){this.set.clear()}delete(e){this.set.delete(e.toString())}entries(){return oK(this.set.entries(),e=>{let t=(0,nF.jE)(e[0]);return[t,t]})}forEach(e){this.set.forEach(t=>{let r=(0,nF.jE)(t);e(r,r,this)})}has(e){return this.set.has(e.toString())}values(){return oK(this.set.values(),e=>(0,nF.jE)(e))}intersection(e){let t=new oV;for(let r of e)this.has(r)&&t.add(r);return t}difference(e){let t=new oV;for(let r of this)e.has(r)||t.add(r);return t}union(e){let t=new oV;for(let r of e)t.add(r);for(let e of this)t.add(e);return t}}var oH=r(90678);class o${map;constructor(e){if(this.map=new Map,null!=e)for(let[t,r]of e.entries())this.map.set(t.toString(),r)}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(e){return this.map.delete(e.toString())}entries(){return oK(this.map.entries(),e=>[(0,nF.jE)(e[0]),e[1]])}forEach(e){this.map.forEach((t,r)=>{e(t,(0,nF.jE)(r),this)})}get(e){return this.map.get(e.toString())}has(e){return this.map.has(e.toString())}set(e,t){this.map.set(e.toString(),t)}keys(){return oK(this.map.keys(),e=>(0,nF.jE)(e))}values(){return this.map.values()}get size(){return this.map.size}}var oq=r(36393);class oz{#o=[];enqueue(e,t){let r={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#o[this.size-1].priority>=t.priority){this.#o.push(r);return}let n=function(e,t,r){let n=0,i=e.length;for(;i>0;){let s=Math.trunc(i/2),o=n+s;0>=r(e[o],t)?(n=++o,i-=s+1):i=s}return n}(this.#o,r,(e,t)=>t.priority-e.priority);this.#o.splice(n,0,r)}dequeue(){let e=this.#o.shift();return e?.run}filter(e){return this.#o.filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return this.#o.length}}class oj extends oq.v{#a;#l;#c=0;#u;#h;#d=0;#p;#f;#o;#g;#m=0;#y;#b;#v;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:oz,...e}).intervalCap&&e.intervalCap>=1))throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#a=e.carryoverConcurrencyCount,this.#l=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#u=e.intervalCap,this.#h=e.interval,this.#o=new e.queueClass,this.#g=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#v=!0===e.throwOnTimeout,this.#b=!1===e.autoStart}get #w(){return this.#l||this.#c{this.#I()},t)),!0;this.#c=this.#a?this.#m:0}return!1}#A(){if(0===this.#o.size)return this.#p&&clearInterval(this.#p),this.#p=void 0,this.emit("empty"),0===this.#m&&this.emit("idle"),!1;if(!this.#b){let e=!this.#C;if(this.#w&&this.#E){let t=this.#o.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#T(),!0)}}return!1}#T(){this.#l||void 0!==this.#p||(this.#p=setInterval(()=>{this.#_()},this.#h),this.#d=Date.now()+this.#h)}#_(){0===this.#c&&0===this.#m&&this.#p&&(clearInterval(this.#p),this.#p=void 0),this.#c=this.#a?this.#m:0,this.#R()}#R(){for(;this.#A(););}get concurrency(){return this.#y}set concurrency(e){if(!("number"==typeof e&&e>=1))throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#y=e,this.#R()}async #k(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#v,...t},new Promise((r,n)=>{this.#o.enqueue(async()=>{this.#m++,this.#c++;try{t.signal?.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=tH(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,this.#k(t.signal)]));let i=await n;r(i),this.emit("completed",i)}catch(e){if(e instanceof tU&&!t.throwOnTimeout){r();return}n(e),this.emit("error",e)}finally{this.#S()}},t),this.emit("add"),this.#A()})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return this.#b&&(this.#b=!1,this.#R()),this}pause(){this.#b=!0}clear(){this.#o=new this.#g}async onEmpty(){0!==this.#o.size&&await this.#P("empty")}async onSizeLessThan(e){this.#o.sizethis.#o.size{let n=()=>{(!t||t())&&(this.off(e,n),r())};this.on(e,n)})}get size(){return this.#o.size}sizeBy(e){return this.#o.filter(e).length}get pending(){return this.#m}get isPaused(){return this.#b}}let oG={},oW=e=>{e.addEventListener("message",t=>{oW.dispatchEvent("message",e,t)}),null!=e.port&&e.port.addEventListener("message",t=>{oW.dispatchEvent("message",e,t)})};oW.addEventListener=(e,t)=>{null==oG[e]&&(oG[e]=[]),oG[e].push(t)},oW.removeEventListener=(e,t)=>{null!=oG[e]&&(oG[e]=oG[e].filter(e=>e===t))},oW.dispatchEvent=function(e,t,r){null!=oG[e]&&oG[e].forEach(e=>e(t,r))};let oY="lock:worker:request-read",oQ="lock:worker:release-read",oJ="lock:master:grant-read",oX="lock:worker:request-write",oZ="lock:worker:release-write",o0="lock:master:grant-write",o1=(e=21)=>Math.random().toString().substring(2),o2=(e,t,r,n,i)=>(s,o)=>{if(o.data.type!==r)return;let a={type:o.data.type,name:o.data.name,identifier:o.data.identifier};e.dispatchEvent(new MessageEvent(t,{data:{name:a.name,handler:async()=>{s.postMessage({type:i,name:a.name,identifier:a.identifier}),await new Promise(e=>{let t=r=>{if(null==r||null==r.data)return;let i={type:r.data.type,name:r.data.name,identifier:r.data.identifier};i.type===n&&i.identifier===a.identifier&&(s.removeEventListener("message",t),e())};s.addEventListener("message",t)})}}}))},o3=(e,t,r,n)=>async()=>{let i=o1();return globalThis.postMessage({type:t,identifier:i,name:e}),new Promise(t=>{let s=o=>{if(null==o||null==o.data)return;let a={type:o.data.type,identifier:o.data.identifier};a.type===r&&a.identifier===i&&(globalThis.removeEventListener("message",s),t(()=>{globalThis.postMessage({type:n,identifier:i,name:e})}))};globalThis.addEventListener("message",s)})},o4={singleProcess:!1};var o6=e=>{if(e=Object.assign({},o4,e),globalThis.document||e.singleProcess){let e=new EventTarget;return oW.addEventListener("message",o2(e,"requestReadLock",oY,oQ,oJ)),oW.addEventListener("message",o2(e,"requestWriteLock",oX,oZ,o0)),e}return{isWorker:!0,readLock:e=>o3(e,oY,oJ,oQ),writeLock:e=>o3(e,oX,o0,oZ)}};let o5={};async function o8(e,t){let r;let n=new Promise(e=>{r=e});return e.add(async()=>tH((async()=>{await new Promise(e=>{r(()=>{e()})})})(),{milliseconds:t.timeout})),n}let o9=(e,t)=>{let r;if(!0===i.isWorker)return{readLock:i.readLock(e,t),writeLock:i.writeLock(e,t)};let n=new oj({concurrency:1});return{async readLock(){if(null!=r)return o8(r,t);let e=r=new oj({concurrency:t.concurrency,autoStart:!1}),i=o8(r,t);return n.add(async()=>{e.start(),await e.onIdle().then(()=>{r===e&&(r=null)})}),i},writeLock:async()=>(r=null,o8(n,t))}},o7={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1},ae={ERR_INVALID_PARAMETERS:"ERR_INVALID_PARAMETERS"};function at(e,t){let r=eZ.decode(t);null!=r.publicKey&&null==e.publicKey&&(e=(0,nF.vL)({...e,publicKey:e.publicKey}));let n=new Map,i=BigInt(Date.now());for(let[e,t]of r.tags.entries())null!=t.expiry&&t.expiry({multiaddr:(0,n0.HM)(e),isCertified:t??!1})),metadata:r.metadata,peerRecordEnvelope:r.peerRecordEnvelope??void 0,tags:n}}(ep=(ed=eZ||(eZ={})).Peer$metadataEntry||(ed.Peer$metadataEntry={})).codec=()=>(null==A&&(A=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.key&&""!==e.key&&(t.uint32(10),t.string(e.key)),null!=e.value&&e.value.byteLength>0&&(t.uint32(18),t.bytes(e.value)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={key:"",value:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.key=e.string();break;case 2:r.value=e.bytes();break;default:e.skipType(7&t)}}return r})),A),ep.encode=e=>(0,ns.LE)(e,ep.codec()),ep.decode=e=>(0,ns.C6)(e,ep.codec()),(ef=ed.Peer$tagsEntry||(ed.Peer$tagsEntry={})).codec=()=>(null==I&&(I=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.key&&""!==e.key&&(t.uint32(10),t.string(e.key)),null!=e.value&&(t.uint32(18),e1.codec().encode(e.value,t)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={key:""},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.key=e.string();break;case 2:r.value=e1.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r})),I),ef.encode=e=>(0,ns.LE)(e,ef.codec()),ef.decode=e=>(0,ns.C6)(e,ef.codec()),ed.codec=()=>(null==S&&(S=(0,ns.yw)((e,t,r={})=>{if(!1!==r.lengthDelimited&&t.fork(),null!=e.addresses)for(let r of e.addresses)t.uint32(10),e0.codec().encode(r,t);if(null!=e.protocols)for(let r of e.protocols)t.uint32(18),t.string(r);if(null!=e.publicKey&&(t.uint32(34),t.bytes(e.publicKey)),null!=e.peerRecordEnvelope&&(t.uint32(42),t.bytes(e.peerRecordEnvelope)),null!=e.metadata&&0!==e.metadata.size)for(let[r,n]of e.metadata.entries())t.uint32(50),ed.Peer$metadataEntry.codec().encode({key:r,value:n},t);if(null!=e.tags&&0!==e.tags.size)for(let[r,n]of e.tags.entries())t.uint32(58),ed.Peer$tagsEntry.codec().encode({key:r,value:n},t);!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={addresses:[],protocols:[],metadata:new Map,tags:new Map},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.addresses.push(e0.codec().decode(e,e.uint32()));break;case 2:r.protocols.push(e.string());break;case 4:r.publicKey=e.bytes();break;case 5:r.peerRecordEnvelope=e.bytes();break;case 6:{let t=ed.Peer$metadataEntry.codec().decode(e,e.uint32());r.metadata.set(t.key,t.value);break}case 7:{let t=ed.Peer$tagsEntry.codec().decode(e,e.uint32());r.tags.set(t.key,t.value);break}default:e.skipType(7&t)}}return r})),S),ed.encode=e=>(0,ns.LE)(e,ed.codec()),ed.decode=e=>(0,ns.C6)(e,ed.codec()),(eg=e0||(e0={})).codec=()=>(null==_&&(_=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.multiaddr&&e.multiaddr.byteLength>0&&(t.uint32(10),t.bytes(e.multiaddr)),null!=e.isCertified&&(t.uint32(16),t.bool(e.isCertified)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={multiaddr:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.multiaddr=e.bytes();break;case 2:r.isCertified=e.bool();break;default:e.skipType(7&t)}}return r})),_),eg.encode=e=>(0,ns.LE)(e,eg.codec()),eg.decode=e=>(0,ns.C6)(e,eg.codec()),(em=e1||(e1={})).codec=()=>(null==T&&(T=(0,ns.yw)((e,t,r={})=>{!1!==r.lengthDelimited&&t.fork(),null!=e.value&&0!==e.value&&(t.uint32(8),t.uint32(e.value)),null!=e.expiry&&(t.uint32(16),t.uint64(e.expiry)),!1!==r.lengthDelimited&&t.ldelim()},(e,t)=>{let r={value:0},n=null==t?e.len:e.pos+t;for(;e.pos>>3){case 1:r.value=e.uint32();break;case 2:r.expiry=e.uint64();break;default:e.skipType(7&t)}}return r})),T),em.encode=e=>(0,ns.LE)(e,em.codec()),em.decode=e=>(0,ns.C6)(e,em.codec());var ar=r(25906);let an=new TextEncoder().encode("/"),ai=an[0];class as{_buf;constructor(e,t){if("string"==typeof e)this._buf=(0,r0.m)(e);else if(e instanceof Uint8Array)this._buf=e;else throw Error("Invalid key, should be String of Uint8Array");if(null==t&&(t=!0),t&&this.clean(),0===this._buf.byteLength||this._buf[0]!==ai)throw Error("Invalid key")}toString(e="utf8"){return(0,r5.B)(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new as(e.join("/"))}static random(){return new as(Math.random().toString().substring(2))}static asKey(e){return e instanceof Uint8Array||"string"==typeof e?new as(e):"function"==typeof e.uint8Array?new as(e.uint8Array()):null}clean(){if((null==this._buf||0===this._buf.byteLength)&&(this._buf=an),this._buf[0]!==ai){let e=new Uint8Array(this._buf.byteLength+1);e.fill(ai,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===ai;)this._buf=this._buf.subarray(0,-1)}less(e){let t=this.list(),r=e.list();for(let e=0;ei)return!1}return t.lengthe.namespaces()))])}}let ao="/peers/";function aa(e){if(!(0,ar.I)(e)||null==e.type)throw new rX.sv("Invalid PeerId",ae.ERR_INVALID_PARAMETERS);let t=e.toCID().toString();return new as(`${ao}${t}`)}async function al(e,t,r){let n=new Map;for(let i of r){if(null==i)continue;if(i.multiaddr instanceof Uint8Array&&(i.multiaddr=(0,n0.HM)(i.multiaddr)),!(0,n0.h2)(i.multiaddr))throw new rX.sv("Multiaddr was invalid",ae.ERR_INVALID_PARAMETERS);if(!await t(e,i.multiaddr))continue;let r=i.isCertified??!1,s=i.multiaddr.toString(),o=n.get(s);null!=o?i.isCertified=o.isCertified||r:n.set(s,{multiaddr:i.multiaddr,isCertified:r})}return[...n.values()].sort((e,t)=>e.multiaddr.toString().localeCompare(t.multiaddr.toString())).map(({isCertified:e,multiaddr:t})=>({isCertified:e,multiaddr:t.bytes}))}async function ac(e,t,r,n){if(null==t)throw new rX.sv("Invalid PeerData",ae.ERR_INVALID_PARAMETERS);if(null!=t.publicKey&&null!=e.publicKey&&!(0,r4.f)(t.publicKey,e.publicKey))throw new rX.sv("publicKey bytes do not match peer id publicKey bytes",ae.ERR_INVALID_PARAMETERS);let i=n.existingPeer;if(null!=i&&!e.equals(i.id))throw new rX.sv("peer id did not match existing peer id",ae.ERR_INVALID_PARAMETERS);let s=i?.addresses??[],o=new Set(i?.protocols??[]),a=i?.metadata??new Map,l=i?.tags??new Map,c=i?.peerRecordEnvelope;if("patch"===r&&((null!=t.multiaddrs||null!=t.addresses)&&(s=[],null!=t.multiaddrs&&s.push(...t.multiaddrs.map(e=>({isCertified:!1,multiaddr:e}))),null!=t.addresses&&s.push(...t.addresses)),null!=t.protocols&&(o=new Set(t.protocols)),null!=t.metadata&&(a=au(t.metadata instanceof Map?[...t.metadata.entries()]:Object.entries(t.metadata),{validate:ah})),null!=t.tags&&(l=au(t.tags instanceof Map?[...t.tags.entries()]:Object.entries(t.tags),{validate:ad,map:ap})),null!=t.peerRecordEnvelope&&(c=t.peerRecordEnvelope)),"merge"===r){if(null!=t.multiaddrs&&s.push(...t.multiaddrs.map(e=>({isCertified:!1,multiaddr:e}))),null!=t.addresses&&s.push(...t.addresses),null!=t.protocols&&(o=new Set([...o,...t.protocols])),null!=t.metadata){for(let[e,r]of t.metadata instanceof Map?[...t.metadata.entries()]:Object.entries(t.metadata))null==r?a.delete(e):a.set(e,r);a=au([...a.entries()],{validate:ah})}if(null!=t.tags){let e=t.tags instanceof Map?[...t.tags.entries()]:Object.entries(t.tags),r=new Map(l);for(let[t,n]of e)null==n?r.delete(t):r.set(t,n);l=au([...r.entries()],{validate:ad,map:ap})}null!=t.peerRecordEnvelope&&(c=t.peerRecordEnvelope)}let u={addresses:await al(e,n.addressFilter??(async()=>!0),s),protocols:[...o.values()].sort((e,t)=>e.localeCompare(t)),metadata:a,tags:l,publicKey:i?.id.publicKey??t.publicKey??e.publicKey,peerRecordEnvelope:c};return"RSA"!==e.type&&delete u.publicKey,u}function au(e,t){let r=new Map;for(let[r,n]of e)null!=n&&t.validate(r,n);for(let[n,i]of e.sort(([e],[t])=>e.localeCompare(t)))null!=i&&r.set(n,t.map?.(n,i)??i);return r}function ah(e,t){if("string"!=typeof e)throw new rX.sv("Metadata key must be a string",ae.ERR_INVALID_PARAMETERS);if(!(t instanceof Uint8Array))throw new rX.sv("Metadata value must be a Uint8Array",ae.ERR_INVALID_PARAMETERS)}function ad(e,t){if("string"!=typeof e)throw new rX.sv("Tag name must be a string",ae.ERR_INVALID_PARAMETERS);if(null!=t.value){if(parseInt(`${t.value}`,10)!==t.value)throw new rX.sv("Tag value must be an integer",ae.ERR_INVALID_PARAMETERS);if(t.value<0||t.value>100)throw new rX.sv("Tag value must be between 0-100",ae.ERR_INVALID_PARAMETERS)}if(null!=t.ttl){if(parseInt(`${t.ttl}`,10)!==t.ttl)throw new rX.sv("Tag ttl must be an integer",ae.ERR_INVALID_PARAMETERS);if(t.ttl<0)throw new rX.sv("Tag ttl must be between greater than 0",ae.ERR_INVALID_PARAMETERS)}}function ap(e,t){let r;return null!=t.expiry&&(r=t.expiry),null!=t.ttl&&(r=BigInt(Date.now()+Number(t.ttl))),{value:t.value??0,expiry:r}}function af(e,t,r){let n=e.toString().split("/")[2],i=oU.base32.decode(n),s=(0,nF.cv)(i),o=r.get(s);if(null!=o)return o;let a=at(s,t);return r.set(s,a),a}class ag{peerId;datastore;lock;addressFilter;constructor(e,t={}){this.peerId=e.peerId,this.datastore=e.datastore,this.addressFilter=t.addressFilter,this.lock=function(e){let t=Object.assign({},o7,e);return null==i&&!0!==(i=o6(t)).isWorker&&(i.addEventListener("requestReadLock",e=>{null!=o5[e.data.name]&&o5[e.data.name].readLock().then(async t=>e.data.handler().finally(()=>{t()}))}),i.addEventListener("requestWriteLock",async e=>{null!=o5[e.data.name]&&o5[e.data.name].writeLock().then(async t=>e.data.handler().finally(()=>{t()}))})),null==o5[t.name]&&(o5[t.name]=o9(t.name,t)),o5[t.name]}({name:"peer-store",singleProcess:!0})}async has(e){return this.datastore.has(aa(e))}async delete(e){if(this.peerId.equals(e))throw new rX.sv("Cannot delete self peer",ae.ERR_INVALID_PARAMETERS);await this.datastore.delete(aa(e))}async load(e){let t=await this.datastore.get(aa(e));return at(e,t)}async save(e,t){let{existingBuf:r,existingPeer:n}=await this.#D(e),i=await ac(e,t,"patch",{addressFilter:this.addressFilter});return this.#B(e,i,r,n)}async patch(e,t){let{existingBuf:r,existingPeer:n}=await this.#D(e),i=await ac(e,t,"patch",{addressFilter:this.addressFilter,existingPeer:n});return this.#B(e,i,r,n)}async merge(e,t){let{existingBuf:r,existingPeer:n}=await this.#D(e),i=await ac(e,t,"merge",{addressFilter:this.addressFilter,existingPeer:n});return this.#B(e,i,r,n)}async *all(e){var t;let r=new o$;for await(let{key:n,value:i}of this.datastore.query(null==(t=e??{})?{}:{prefix:ao,filters:(t.filters??[]).map(e=>({key:t,value:n})=>e(af(t,n,r))),orders:(t.orders??[]).map(e=>(t,n)=>e(af(t.key,t.value,r),af(n.key,n.value,r)))})){let e=af(n,i,r);e.id.equals(this.peerId)||(yield e)}}async #D(e){try{let t=await this.datastore.get(aa(e)),r=at(e,t);return{existingBuf:t,existingPeer:r}}catch(e){if("ERR_NOT_FOUND"!==e.code)throw e}return{}}async #B(e,t,r,n){let i=eZ.encode(t);return null!=r&&(0,r4.f)(i,r)?{peer:at(e,i),previous:n,updated:!1}:(await this.datastore.put(aa(e),i),{peer:at(e,i),previous:n,updated:!0})}}class am{store;events;peerId;log;constructor(e,t={}){this.log=e.logger.forComponent("libp2p:peer-store"),this.events=e.events,this.peerId=e.peerId,this.store=new ag(e,t)}async forEach(e,t){this.log.trace("forEach await read lock");let r=await this.store.lock.readLock();this.log.trace("forEach got read lock");try{for await(let r of this.store.all(t))e(r)}finally{this.log.trace("forEach release read lock"),r()}}async all(e){this.log.trace("all await read lock");let t=await this.store.lock.readLock();this.log.trace("all got read lock");try{return await (0,tp.Z)(this.store.all(e))}finally{this.log.trace("all release read lock"),t()}}async delete(e){this.log.trace("delete await write lock");let t=await this.store.lock.writeLock();this.log.trace("delete got write lock");try{await this.store.delete(e)}finally{this.log.trace("delete release write lock"),t()}}async has(e){this.log.trace("has await read lock");let t=await this.store.lock.readLock();this.log.trace("has got read lock");try{return await this.store.has(e)}finally{this.log.trace("has release read lock"),t()}}async get(e){this.log.trace("get await read lock");let t=await this.store.lock.readLock();this.log.trace("get got read lock");try{return await this.store.load(e)}finally{this.log.trace("get release read lock"),t()}}async save(e,t){this.log.trace("save await write lock");let r=await this.store.lock.writeLock();this.log.trace("save got write lock");try{let r=await this.store.save(e,t);return this.#N(e,r),r.peer}finally{this.log.trace("save release write lock"),r()}}async patch(e,t){this.log.trace("patch await write lock");let r=await this.store.lock.writeLock();this.log.trace("patch got write lock");try{let r=await this.store.patch(e,t);return this.#N(e,r),r.peer}finally{this.log.trace("patch release write lock"),r()}}async merge(e,t){this.log.trace("merge await write lock");let r=await this.store.lock.writeLock();this.log.trace("merge got write lock");try{let r=await this.store.merge(e,t);return this.#N(e,r),r.peer}finally{this.log.trace("merge release write lock"),r()}}async consumePeerRecord(e,t){let r;let n=await iD.openAndCertify(e,iR.DOMAIN);if(t?.equals(n.peerId)===!1)return this.log("envelope peer id was not the expected peer id - expected: %p received: %p",t,n.peerId),!1;let i=iR.createFromProtobuf(n.payload);try{r=await this.get(n.peerId)}catch(e){if("ERR_NOT_FOUND"!==e.code)throw e}if(r?.peerRecordEnvelope!=null){let e=await iD.createFromProtobuf(r.peerRecordEnvelope),t=iR.createFromProtobuf(e.payload);if(t.seqNumber>=i.seqNumber)return this.log("sequence number was lower or equal to existing sequence number - stored: %d received: %d",t.seqNumber,i.seqNumber),!1}return await this.patch(i.peerId,{peerRecordEnvelope:e,addresses:i.multiaddrs.map(e=>({isCertified:!0,multiaddr:e}))}),!0}#N(e,t){t.updated&&(this.peerId.equals(e)?this.events.safeDispatchEvent("self:peer:update",{detail:t}):this.events.safeDispatchEvent("peer:update",{detail:t}))}}var ay=function(e){if(null!=e[Symbol.asyncIterator])return(async()=>{for await(let t of e);})();for(let t of e);},ab=function(e){let[t,r]=null!=e[Symbol.asyncIterator]?[e[Symbol.asyncIterator](),Symbol.asyncIterator]:[e[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>t.next(),push:e=>{n.push(e)},next:()=>n.length>0?{done:!1,value:n.shift()}:t.next(),[r](){return this}}},av=function(e,t){let r=0;if(null!=e[Symbol.asyncIterator])return async function*(){for await(let n of e)await t(n,r++)&&(yield n)}();let n=ab(e),{value:i,done:s}=n.next();if(!0===s)return function*(){}();let o=t(i,r++);return"function"==typeof o.then?async function*(){for await(let e of(await o&&(yield i),n))await t(e,r++)&&(yield e)}():function*(){for(let e of(!0===o&&(yield i),n))t(e,r++)&&(yield e)}()},aw=function(e,t){return null!=e[Symbol.asyncIterator]?async function*(){let r=await (0,tp.Z)(e);yield*r.sort(t)}():function*(){let r=(0,tp.Z)(e);yield*r.sort(t)}()},aE=function(e,t){return null!=e[Symbol.asyncIterator]?async function*(){let r=0;if(!(t<1)){for await(let n of e)if(yield n,++r===t)return}}():function*(){let r=0;if(!(t<1)){for(let n of e)if(yield n,++r===t)return}}()};class aS{put(e,t,r){return Promise.reject(Error(".put is not implemented"))}get(e,t){return Promise.reject(Error(".get is not implemented"))}has(e,t){return Promise.reject(Error(".has is not implemented"))}delete(e,t){return Promise.reject(Error(".delete is not implemented"))}async *putMany(e,t={}){for await(let{key:r,value:n}of e)await this.put(r,n,t),yield r}async *getMany(e,t={}){for await(let r of e)yield{key:r,value:await this.get(r,t)}}async *deleteMany(e,t={}){for await(let r of e)await this.delete(r,t),yield r}batch(){let e=[],t=[];return{put(t,r){e.push({key:t,value:r})},delete(e){t.push(e)},commit:async r=>{await ay(this.putMany(e,r)),e=[],await ay(this.deleteMany(t,r)),t=[]}}}async *_all(e,t){throw Error("._all is not implemented")}async *_allKeys(e,t){throw Error("._allKeys is not implemented")}query(e,t){let r=this._all(e,t);if(null!=e.prefix){let t=e.prefix;r=av(r,e=>e.key.toString().startsWith(t))}if(Array.isArray(e.filters)&&(r=e.filters.reduce((e,t)=>av(e,t),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((e,t)=>aw(e,t),r)),null!=e.offset){let t=0,n=e.offset;r=av(r,()=>t++>=n)}return null!=e.limit&&(r=aE(r,e.limit)),r}queryKeys(e,t){let r=this._allKeys(e,t);if(null!=e.prefix){let t=e.prefix;r=av(r,e=>e.toString().startsWith(t))}if(Array.isArray(e.filters)&&(r=e.filters.reduce((e,t)=>av(e,t),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((e,t)=>aw(e,t),r)),null!=e.offset){let t=e.offset,n=0;r=av(r,()=>n++>=t)}return null!=e.limit&&(r=aE(r,e.limit)),r}}var aA=r(15862);class aI extends aS{data;constructor(){super(),this.data=new Map}put(e,t){return this.data.set(e.toString(),t),e}get(e){let t=this.data.get(e.toString());if(null==t){var r;throw aA(r=r??Error("Not Found"),"ERR_NOT_FOUND")}return t}has(e){return this.data.has(e.toString())}delete(e){this.data.delete(e.toString())}*_all(){for(let[e,t]of this.data.entries())yield{key:new as(e),value:t}}*_allKeys(){for(let e of this.data.keys())yield new as(e)}}let a_=e=>e;function aT(e,t){let r=e.getPeerId();return null!=r&&(0,nF.jE)(r).equals(t)&&(e=e.decapsulate((0,n0.HM)(`/p2p/${t.toString()}`))),e}class aC{log;components;listen;announce;observed;announceFilter;constructor(e,t={}){var r;let n;let{listen:i=[],announce:s=[]}=t;this.components=e,this.log=e.logger.forComponent("libp2p:address-manager"),this.listen=i.map(e=>e.toString()),this.announce=new Set(s.map(e=>e.toString())),this.observed=new Map,this.announceFilter=t.announceFilter??a_,this._updatePeerStoreAddresses=(r=this._updatePeerStoreAddresses.bind(this),function(){clearTimeout(n),n=setTimeout(function(){n=void 0,r()},1e3)}),e.events.addEventListener("transport:listening",()=>{this._updatePeerStoreAddresses()}),e.events.addEventListener("transport:close",()=>{this._updatePeerStoreAddresses()})}_updatePeerStoreAddresses(){let e=this.getAnnounceAddrs().concat(this.components.transportManager.getAddrs()).concat([...this.observed.entries()].filter(([e,t])=>t.confident).map(([e])=>(0,n0.HM)(e))).map(e=>e.getPeerId()===this.components.peerId.toString()?e.decapsulate(`/p2p/${this.components.peerId.toString()}`):e);this.components.peerStore.patch(this.components.peerId,{multiaddrs:e}).catch(e=>{this.log.error("error updating addresses",e)})}getListenAddrs(){return Array.from(this.listen).map(e=>(0,n0.HM)(e))}getAnnounceAddrs(){return Array.from(this.announce).map(e=>(0,n0.HM)(e))}getObservedAddrs(){return Array.from(this.observed).map(([e])=>(0,n0.HM)(e))}addObservedAddr(e){let t=(e=aT(e,this.components.peerId)).toString();this.observed.has(t)||this.observed.set(t,{confident:!1})}confirmObservedAddr(e){let t=(e=aT(e,this.components.peerId)).toString(),r=(this.observed.get(t)??{confident:!1}).confident;this.observed.set(t,{confident:!0}),r||this._updatePeerStoreAddresses()}removeObservedAddr(e){let t=(e=aT(e,this.components.peerId)).toString();this.observed.delete(t)}getAddresses(){let e=this.getAnnounceAddrs().map(e=>e.toString());0===e.length&&(e=this.components.transportManager.getAddrs().map(e=>e.toString()));let t=new Set(e=e.concat(Array.from(this.observed).filter(([e,t])=>t.confident).map(([e])=>e)));return this.announceFilter(Array.from(t).map(e=>(0,n0.HM)(e))).map(e=>e.protos().pop()?.path===!0||e.getPeerId()===this.components.peerId.toString()?e:e.encapsulate(`/p2p/${this.components.peerId.toString()}`))}}class aR{components={};_started=!1;constructor(e={}){for(let[t,r]of(this.components={},Object.entries(e)))this.components[t]=r;null==this.components.logger&&(this.components.logger=oF())}isStarted(){return this._started}async _invokeStartableMethod(e){await Promise.all(Object.values(this.components).filter(e=>null!=e&&"function"==typeof e.start&&"function"==typeof e.stop).map(async t=>{await t[e]?.()}))}async beforeStart(){await this._invokeStartableMethod("beforeStart")}async start(){await this._invokeStartableMethod("start"),this._started=!0}async afterStart(){await this._invokeStartableMethod("afterStart")}async beforeStop(){await this._invokeStartableMethod("beforeStop")}async stop(){await this._invokeStartableMethod("stop"),this._started=!1}async afterStop(){await this._invokeStartableMethod("afterStop")}}let ak=["metrics","connectionProtector","dns"],aP=["components","isStarted","beforeStart","start","afterStart","beforeStop","stop","afterStop","then","_invokeStartableMethod"];var aD=r(37491);let aB=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"].map(e=>new aD.Netmask(e));function aN(e){return(0,iN.C)(e)?function(e){for(let t of aB)if(t.contains(e))return!0;return!1}(e):(0,iN.aY)(e)?/^::$/.test(e)||/^::1$/.test(e)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(e)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(e)||/^ff([0-9a-fA-F]{2,2}):/i.test(e):void 0}function aL(e){try{let{address:t}=e.nodeAddress();return!!aN(t)}catch{return!0}}function ax(e,t){let r=function(e,t){let r=aL(e.multiaddr),n=aL(t.multiaddr);return r&&!n?1:!r&&n?-1:0}(e,t);if(0!==r)return r;let n=function(e,t){let r=sr.exactMatch(e.multiaddr),n=sr.exactMatch(t.multiaddr);return r&&!n?1:!r&&n?-1:0}(e,t);return 0!==n?n:e.isCertified&&!t.isCertified?-1:!e.isCertified&&t.isCertified?1:0}class aO extends Event{constructor(e,t){super(e),this.detail=t}}function aM(e){let t=[e2.A];return null==e?t:Array.isArray(e)?0===e.length?t:e:[e]}function aU(e){return{Status:e.Status??0,TC:e.TC??e.flag_tc??!1,RD:e.RD??e.flag_rd??!1,RA:e.RA??e.flag_ra??!1,AD:e.AD??e.flag_ad??!1,CD:e.CD??e.flag_cd??!1,Question:(e.Question??e.questions??[]).map(e=>({name:e.name,type:e2[e.type]})),Answer:(e.Answer??e.answers??[]).map(e=>({name:e.name,type:e2[e.type],TTL:e.TTL??e.ttl??60,data:e.data instanceof Uint8Array?(0,r5.B)(e.data):e.data}))}}function aF(e,t={}){let r=new oj({concurrency:t.queryConcurrency??4});return async(t,n={})=>{let i=new URLSearchParams;i.set("name",t),aM(n.types).forEach(e=>{i.append("type",e2[e])}),n.onProgress?.(new aO("dns:query",{detail:t}));let s=await r.add(async()=>{let t=await fetch(`${e}?${i}`,{headers:{accept:"application/dns-json"},signal:n?.signal});if(200!==t.status)throw Error(`Unexpected HTTP status: ${t.status} - ${t.statusText}`);let r=aU(await t.json());return n.onProgress?.(new aO("dns:response",{detail:r})),r},{signal:n.signal});if(null==s)throw Error("No DNS response received");return s}}var aK=r(50762);class aV{lru;constructor(e){this.lru=aK(e)}get(e,t){let r=!0,n=[];for(let i of t){let t=this.getAnswers(e,i);if(0===t.length){r=!1;break}n.push(...t)}if(r)return aU({answers:n})}getAnswers(e,t){let r=`${e.toLowerCase()}-${t}`,n=this.lru.get(r);if(null!=n){let e=n.filter(e=>e.expires>Date.now()).map(({expires:e,value:t})=>({...t,TTL:Math.round((e-Date.now())/1e3),type:e2[t.type]}));return 0===e.length&&this.lru.remove(r),e}return[]}add(e,t){let r=`${e.toLowerCase()}-${t.type}`,n=this.lru.get(r)??[];n.push({expires:Date.now()+(t.TTL??60)*1e3,value:t}),this.lru.set(r,n)}remove(e,t){let r=`${e.toLowerCase()}-${t}`;this.lru.remove(r)}clear(){this.lru.clear()}}class aH{resolvers;cache;constructor(e){this.resolvers={},this.cache=new aV(e.cacheSize??1e3),Object.entries(e.resolvers??{}).forEach(([e,t])=>{Array.isArray(t)||(t=[t]),e.endsWith(".")||(e=`${e}.`),this.resolvers[e]=t}),null==this.resolvers["."]&&(this.resolvers["."]=[aF("https://cloudflare-dns.com/dns-query"),aF("https://dns.google/resolve")])}async query(e,t={}){let r=aM(t.types),n=!1!==t.cached?this.cache.get(e,r):void 0;if(null!=n)return t.onProgress?.(new aO("dns:cache",{detail:n})),n;let i=`${e.split(".").pop()}.`,s=(this.resolvers[i]??this.resolvers["."]).sort(()=>Math.random()>.5?-1:1),o=[];for(let n of s){if(t.signal?.aborted===!0)break;try{let i=await n(e,{...t,types:r});for(let t of i.Answer)this.cache.add(e,t);return i}catch(e){o.push(e),t.onProgress?.(new aO("dns:error",{detail:e}))}}if(1===o.length)throw o[0];throw AggregateError(o,`DNS lookup of ${e} ${r} failed`)}}(ey=e2||(e2={}))[ey.A=1]="A",ey[ey.CNAME=5]="CNAME",ey[ey.TXT=16]="TXT",ey[ey.AAAA=28]="AAAA";let{code:a$}=(0,r(27304).Ev)("dnsaddr"),aq=async function(e,t={}){let r=t.maxRecursiveDepth??32;if(0===r)throw new rX.sv("Max recursive depth reached","ERR_MAX_RECURSIVE_DEPTH_REACHED");let[,n]=e.stringTuples().find(([e])=>e===a$)??[],i=t?.dns??function(e={}){return new aH(e)}(),s=await i.query(`_dnsaddr.${n}`,{signal:t?.signal,types:[e2.TXT]}),o=e.getPeerId(),a=[];for(let e of s.Answer){let n=e.data.replace(/["']/g,"").trim().split("=")[1];if(null==n||null!=o&&!n.includes(o))continue;let i=(0,n0.HM)(n);if(n.startsWith("/dnsaddr")){let e=await i.resolve({...t,maxRecursiveDepth:r-1});a.push(...e.map(e=>e.toString()))}else a.push(i.toString())}return a};var az=r(18350);(eb=e3||(e3={})).NOT_STARTED_YET="The libp2p node is not started yet",eb.ERR_PROTECTOR_REQUIRED="Private network is enforced, but no protector was provided",eb.NOT_FOUND="Not found",(ev=e4||(e4={})).ERR_PROTECTOR_REQUIRED="ERR_PROTECTOR_REQUIRED",ev.ERR_PEER_DIAL_INTERCEPTED="ERR_PEER_DIAL_INTERCEPTED",ev.ERR_CONNECTION_INTERCEPTED="ERR_CONNECTION_INTERCEPTED",ev.ERR_INVALID_PROTOCOLS_FOR_STREAM="ERR_INVALID_PROTOCOLS_FOR_STREAM",ev.ERR_CONNECTION_ENDED="ERR_CONNECTION_ENDED",ev.ERR_CONNECTION_FAILED="ERR_CONNECTION_FAILED",ev.ERR_NODE_NOT_STARTED="ERR_NODE_NOT_STARTED",ev.ERR_ALREADY_ABORTED="ERR_ALREADY_ABORTED",ev.ERR_TOO_MANY_ADDRESSES="ERR_TOO_MANY_ADDRESSES",ev.ERR_NO_VALID_ADDRESSES="ERR_NO_VALID_ADDRESSES",ev.ERR_RELAYED_DIAL="ERR_RELAYED_DIAL",ev.ERR_DIALED_SELF="ERR_DIALED_SELF",ev.ERR_DISCOVERED_SELF="ERR_DISCOVERED_SELF",ev.ERR_DUPLICATE_TRANSPORT="ERR_DUPLICATE_TRANSPORT",ev.ERR_ENCRYPTION_FAILED="ERR_ENCRYPTION_FAILED",ev.ERR_HOP_REQUEST_FAILED="ERR_HOP_REQUEST_FAILED",ev.ERR_INVALID_KEY="ERR_INVALID_KEY",ev.ERR_INVALID_MESSAGE="ERR_INVALID_MESSAGE",ev.ERR_INVALID_PARAMETERS="ERR_INVALID_PARAMETERS",ev.ERR_INVALID_PEER="ERR_INVALID_PEER",ev.ERR_MUXER_UNAVAILABLE="ERR_MUXER_UNAVAILABLE",ev.ERR_NOT_FOUND="ERR_NOT_FOUND",ev.ERR_TRANSPORT_UNAVAILABLE="ERR_TRANSPORT_UNAVAILABLE",ev.ERR_TRANSPORT_DIAL_FAILED="ERR_TRANSPORT_DIAL_FAILED",ev.ERR_UNSUPPORTED_PROTOCOL="ERR_UNSUPPORTED_PROTOCOL",ev.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED="ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED",ev.ERR_INVALID_MULTIADDR="ERR_INVALID_MULTIADDR",ev.ERR_SIGNATURE_NOT_VALID="ERR_SIGNATURE_NOT_VALID",ev.ERR_FIND_SELF="ERR_FIND_SELF",ev.ERR_NO_ROUTERS_AVAILABLE="ERR_NO_ROUTERS_AVAILABLE",ev.ERR_CONNECTION_NOT_MULTIPLEXED="ERR_CONNECTION_NOT_MULTIPLEXED",ev.ERR_NO_DIAL_TOKENS="ERR_NO_DIAL_TOKENS",ev.ERR_INVALID_CMS="ERR_INVALID_CMS",ev.ERR_MISSING_KEYS="ERR_MISSING_KEYS",ev.ERR_NO_KEY="ERR_NO_KEY",ev.ERR_INVALID_KEY_NAME="ERR_INVALID_KEY_NAME",ev.ERR_INVALID_KEY_TYPE="ERR_INVALID_KEY_TYPE",ev.ERR_KEY_ALREADY_EXISTS="ERR_KEY_ALREADY_EXISTS",ev.ERR_INVALID_KEY_SIZE="ERR_INVALID_KEY_SIZE",ev.ERR_KEY_NOT_FOUND="ERR_KEY_NOT_FOUND",ev.ERR_OLD_KEY_NAME_INVALID="ERR_OLD_KEY_NAME_INVALID",ev.ERR_NEW_KEY_NAME_INVALID="ERR_NEW_KEY_NAME_INVALID",ev.ERR_PASSWORD_REQUIRED="ERR_PASSWORD_REQUIRED",ev.ERR_PEM_REQUIRED="ERR_PEM_REQUIRED",ev.ERR_CANNOT_READ_KEY="ERR_CANNOT_READ_KEY",ev.ERR_MISSING_PRIVATE_KEY="ERR_MISSING_PRIVATE_KEY",ev.ERR_MISSING_PUBLIC_KEY="ERR_MISSING_PUBLIC_KEY",ev.ERR_INVALID_OLD_PASS_TYPE="ERR_INVALID_OLD_PASS_TYPE",ev.ERR_INVALID_NEW_PASS_TYPE="ERR_INVALID_NEW_PASS_TYPE",ev.ERR_INVALID_PASS_LENGTH="ERR_INVALID_PASS_LENGTH",ev.ERR_NOT_IMPLEMENTED="ERR_NOT_IMPLEMENTED",ev.ERR_WRONG_PING_ACK="ERR_WRONG_PING_ACK",ev.ERR_INVALID_RECORD="ERR_INVALID_RECORD",ev.ERR_ALREADY_SUCCEEDED="ERR_ALREADY_SUCCEEDED",ev.ERR_NO_HANDLER_FOR_PROTOCOL="ERR_NO_HANDLER_FOR_PROTOCOL",ev.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS",ev.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS",ev.ERR_CONNECTION_DENIED="ERR_CONNECTION_DENIED",ev.ERR_TRANSFER_LIMIT_EXCEEDED="ERR_TRANSFER_LIMIT_EXCEEDED";let aj={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:e=>e},connectionManager:{resolvers:{dnsaddr:aq},addressSorter:ax},transportManager:{faultTolerance:eO.FATAL_ALL}};async function aG(e){let t=az(aj,e);if(null===t.connectionProtector&&globalThis.process?.env?.LIBP2P_FORCE_PNET!=null)throw new rX.sv(e3.ERR_PROTECTOR_REQUIRED,e4.ERR_PROTECTOR_REQUIRED);if(!(await (0,nF.y5)(t.privateKey.public.bytes,t.privateKey.bytes)).equals(t.peerId))throw new rX.sv("Private key doesn't match peer id",e4.ERR_INVALID_KEY);return t}function aW(e){let t;if((0,ar.I)(e))return{peerId:e,multiaddrs:[]};if(Array.isArray(e)||(e=[e]),e.length>0){let r=e[0].getPeerId();t=null==r?void 0:(0,nF.jE)(r),e.forEach(e=>{if(!(0,n0.h2)(e))throw new rX.sv("Invalid Multiaddr",e4.ERR_INVALID_MULTIADDR);let r=e.getPeerId();if(null==r){if(null!=t)throw new rX.sv("Multiaddrs must all have the same peer id or have no peer id",e4.ERR_INVALID_PARAMETERS)}else{let e=(0,nF.jE)(r);if(null==t||!t.equals(e))throw new rX.sv("Multiaddrs must all have the same peer id or have no peer id",e4.ERR_INVALID_PARAMETERS)}})}return{peerId:t,multiaddrs:e}}class aY extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.name="AbortError",this.code=t??"ABORT_ERR"}}async function aQ(e,t,r,n){let i=new aY(n?.errorMessage,n?.errorCode);return r?.aborted===!0?Promise.reject(i):new Promise((s,o)=>{function a(){r?.removeEventListener("abort",u),e.removeEventListener(t,l),n?.errorEvent!=null&&e.removeEventListener(n.errorEvent,c)}let l=e=>{try{if(n?.filter?.(e)===!1)return}catch(e){a(),o(e);return}a(),s(e)},c=e=>{a(),o(e.detail)},u=()=>{a(),o(i)};r?.addEventListener("abort",u),e.addEventListener(t,l),n?.errorEvent!=null&&e.addEventListener(n.errorEvent,c)})}class aJ{deferred;signal;where;constructor(e,t){this.signal=t,this.deferred=(0,t6.Z)(),this.where=e,this.onAbort=this.onAbort.bind(this),this.signal?.addEventListener("abort",this.onAbort)}onAbort(){this.deferred.reject(this.signal?.reason??new rX._L)}cleanup(){this.signal?.removeEventListener("abort",this.onAbort)}}class aX{id;fn;options;recipients;status;timeline;controller;constructor(e,t){this.id=`${parseInt(String(1e9*Math.random()),10).toString()}${Date.now()}`,this.status="queued",this.fn=e,this.options=t,this.recipients=[],this.timeline={created:Date.now()},this.controller=new AbortController,(0,iT.W)(1/0,this.controller.signal),this.onAbort=this.onAbort.bind(this)}abort(e){this.controller.abort(e)}onAbort(){this.recipients.reduce((e,t)=>e&&t.signal?.aborted===!0,!0)&&(this.controller.abort(new rX._L),this.cleanup())}async join(e={}){let t=new aJ(Error("where").stack,e.signal);return this.recipients.push(t),e.signal?.addEventListener("abort",this.onAbort),t.deferred.promise}async run(){this.status="running",this.timeline.started=Date.now();try{this.controller.signal.throwIfAborted();let e=await t8(this.fn({...this.options??{},signal:this.controller.signal}),this.controller.signal);this.recipients.forEach(t=>{t.deferred.resolve(e)}),this.status="complete"}catch(e){this.recipients.forEach(t=>{t.deferred.reject(e)}),this.status="errored"}finally{this.timeline.finished=Date.now(),this.cleanup()}}cleanup(){this.recipients.forEach(e=>{e.cleanup(),e.signal?.removeEventListener("abort",this.onAbort)})}}class aZ extends tQ.L{concurrency;queue;pending;sort;constructor(e={}){super(),this.concurrency=e.concurrency??Number.POSITIVE_INFINITY,this.pending=0,null!=e.metricName&&e.metrics?.registerMetricGroup(e.metricName,{calculate:()=>({size:this.queue.length,running:this.pending,queued:this.queue.length-this.pending})}),this.sort=e.sort,this.queue=[]}tryToStartAnother(){if(0===this.size)return queueMicrotask(()=>{this.safeDispatchEvent("empty")}),0===this.running&&queueMicrotask(()=>{this.safeDispatchEvent("idle")}),!1;if(this.pending{for(let t=0;t(this.safeDispatchEvent("completed",{detail:e}),this.safeDispatchEvent("success",{detail:{job:r,result:e}}),e)).catch(e=>{if("queued"===r.status){for(let e=0;e{e.abort(new rX._L)}),this.clear()}async onEmpty(e){0!==this.size&&await aQ(this,"empty",e?.signal)}async onSizeLessThan(e,t){this.sizethis.size{null!=e?this.abort():this.clear(),t.end(e)},n=e=>{null!=e.detail&&t.push(e.detail)},i=e=>{r(e.detail)},s=()=>{r()},o=()=>{r(new rX.sv("Queue aborted","ERR_QUEUE_ABORTED"))};this.addEventListener("completed",n),this.addEventListener("error",i),this.addEventListener("idle",s),e?.signal?.addEventListener("abort",o);try{yield*t}finally{this.removeEventListener("completed",n),this.removeEventListener("error",i),this.removeEventListener("idle",s),e?.signal?.removeEventListener("abort",o),r()}}}class a0 extends aZ{has(e){return null!=this.find(e)}find(e){return this.queue.find(t=>e.equals(t.options.peerId))}}let a1="last-dial-failure",a2={minConnections:5,maxQueueLength:100,autoDialConcurrency:25,autoDialPriority:0,autoDialInterval:5e3,autoDialPeerRetryThreshold:42e4,autoDialDiscoveredPeersDebounce:10};class a3{connectionManager;peerStore;queue;minConnections;autoDialPriority;autoDialIntervalMs;autoDialMaxQueueLength;autoDialPeerRetryThresholdMs;autoDialDiscoveredPeersDebounce;autoDialInterval;started;running;log;constructor(e,t){let r;this.connectionManager=e.connectionManager,this.peerStore=e.peerStore,this.minConnections=t.minConnections??a2.minConnections,this.autoDialPriority=t.autoDialPriority??a2.autoDialPriority,this.autoDialIntervalMs=t.autoDialInterval??a2.autoDialInterval,this.autoDialMaxQueueLength=t.maxQueueLength??a2.maxQueueLength,this.autoDialPeerRetryThresholdMs=t.autoDialPeerRetryThreshold??a2.autoDialPeerRetryThreshold,this.autoDialDiscoveredPeersDebounce=t.autoDialDiscoveredPeersDebounce??a2.autoDialDiscoveredPeersDebounce,this.log=e.logger.forComponent("libp2p:connection-manager:auto-dial"),this.started=!1,this.running=!1,this.queue=new a0({concurrency:t.autoDialConcurrency??a2.autoDialConcurrency,metricName:"libp2p_autodial_queue",metrics:e.metrics}),this.queue.addEventListener("error",e=>{this.log.error("error during auto-dial",e.detail)}),e.events.addEventListener("connection:close",()=>{this.autoDial().catch(e=>{this.log.error(e)})}),e.events.addEventListener("peer:discovery",()=>{clearTimeout(r),r=setTimeout(()=>{this.autoDial().catch(e=>{this.log.error(e)})},this.autoDialDiscoveredPeersDebounce)})}isStarted(){return this.started}start(){this.started=!0}afterStart(){this.autoDial().catch(e=>{this.log.error("error while autodialing",e)})}stop(){this.queue.clear(),clearTimeout(this.autoDialInterval),this.started=!1,this.running=!1}async autoDial(){if(!this.started||this.running)return;let e=this.connectionManager.getConnectionsMap(),t=e.size;if(t>=this.minConnections){this.minConnections>0&&this.log.trace("have enough connections %d/%d",t,this.minConnections);return}if(this.queue.size>this.autoDialMaxQueueLength){this.log("not enough connections %d/%d but auto dial queue is full",t,this.minConnections),this.sheduleNextAutodial();return}this.running=!0,this.log("not enough connections %d/%d - will dial peers to increase the number of connections",t,this.minConnections);let r=new oV(this.connectionManager.getDialQueue().map(e=>e.peerId).filter(Boolean)),n=await this.peerStore.all({filters:[t=>0===t.addresses.length?(this.log.trace("not autodialing %p because they have no addresses",t.id),!1):e.has(t.id)?(this.log.trace("not autodialing %p because they are already connected",t.id),!1):r.has(t.id)?(this.log.trace("not autodialing %p because they are already being dialed",t.id),!1):!this.queue.has(t.id)||(this.log.trace("not autodialing %p because they are already being autodialed",t.id),!1)]}),i=n.sort(()=>Math.random()>.5?1:-1),s=new o$;for(let e of i)s.has(e.id)||s.set(e.id,[...e.tags.values()].reduce((e,t)=>e+t.value,0));let o=i.sort((e,t)=>{let r=s.get(e.id)??0,n=s.get(t.id)??0;return r>n?-1:r{let t=e.metadata.get(a1);if(null==t)return!0;let r=parseInt((0,r5.B)(t));return!!isNaN(r)||Date.now()-r>this.autoDialPeerRetryThresholdMs});for(let e of(this.log("selected %d/%d peers to dial",o.length,n.length),o))this.queue.add(async()=>{let t=this.connectionManager.getConnectionsMap().size;if(t>=this.minConnections){this.log("got enough connections now %d/%d",t,this.minConnections),this.queue.clear();return}this.log("connecting to a peerStore stored peer %p",e.id),await this.connectionManager.openConnection(e.id,{priority:this.autoDialPriority})},{peerId:e.id}).catch(e=>{this.log.error("could not connect to peerStore stored peer",e)});this.running=!1,this.sheduleNextAutodial()}sheduleNextAutodial(){this.started&&(this.autoDialInterval=setTimeout(()=>{this.autoDial().catch(e=>{this.log.error("error while autodialing",e)})},this.autoDialIntervalMs))}}let a4=["/ipfs/id/1.0.0","/ipfs/id/push/1.0.0","/libp2p/autonat/1.0.0","/libp2p/dcutr"];async function a6(e,t){let r=e?.streams?.map(e=>e.protocol)??[],n=t?.closableProtocols??a4;if(!(r.filter(e=>null!=e&&!n.includes(e)).length>0))try{await e?.close(t)}catch(t){e?.abort(t)}}let a5={maxConnections:100,allow:[]};class a8{maxConnections;connectionManager;peerStore;allow;events;log;constructor(e,t={}){this.maxConnections=t.maxConnections??a5.maxConnections,this.allow=t.allow??a5.allow,this.connectionManager=e.connectionManager,this.peerStore=e.peerStore,this.events=e.events,this.log=e.logger.forComponent("libp2p:connection-manager:connection-pruner"),e.events.addEventListener("connection:open",()=>{this.maybePruneConnections().catch(e=>{this.log.error(e)})})}async maybePruneConnections(){let e=this.connectionManager.getConnections(),t=e.length;if(this.log("checking max connections limit %d/%d",t,this.maxConnections),t<=this.maxConnections)return;let r=new o$;for(let t of e){let e=t.remotePeer;if(!r.has(e)){r.set(e,0);try{let t=await this.peerStore.get(e);r.set(e,[...t.tags.values()].reduce((e,t)=>e+t.value,0))}catch(e){"ERR_NOT_FOUND"!==e.code&&this.log.error("error loading peer tags",e)}}}let n=this.sortConnections(e,r),i=Math.max(t-this.maxConnections,0),s=[];for(let e of n)if(this.log("too many connections open - closing a connection to %p",e.remotePeer),this.allow.some(t=>e.remoteAddr.toString().startsWith(t.toString()))||s.push(e),s.length===i)break;await Promise.all(s.map(async e=>{await a6(e,{signal:AbortSignal.timeout(1e3)})})),this.events.safeDispatchEvent("connection:prune",{detail:s})}sortConnections(e,t){return e.sort((e,t)=>{let r=e.timeline.open,n=t.timeline.open;return rn?-1:0}).sort((e,t)=>"outbound"===e.direction&&"inbound"===t.direction?1:"inbound"===e.direction&&"outbound"===t.direction?-1:0).sort((e,t)=>e.streams.length>t.streams.length?1:e.streams.length{let n=t.get(e.remotePeer)??0,i=t.get(r.remotePeer)??0;return n>i?1:ne.options.priority>t.options.priority?-1:e.options.prioritye.toString())),n}let lt={addressSorter:ax,maxParallelDials:50,maxDialQueueLength:500,maxPeerAddrsToDial:25,dialTimeout:5e3};class lr{queue;components;addressSorter;maxPeerAddrsToDial;maxDialQueueLength;dialTimeout;shutDownController;connections;log;constructor(e,t={}){for(let[r,n]of(this.addressSorter=t.addressSorter??lt.addressSorter,this.maxPeerAddrsToDial=t.maxPeerAddrsToDial??lt.maxPeerAddrsToDial,this.maxDialQueueLength=t.maxDialQueueLength??lt.maxDialQueueLength,this.dialTimeout=t.dialTimeout??lt.dialTimeout,this.connections=t.connections??new o$,this.log=e.logger.forComponent("libp2p:connection-manager:dial-queue"),this.components=e,this.shutDownController=new AbortController,(0,iT.W)(1/0,this.shutDownController.signal),Object.entries(t.resolvers??{})))n0.s_.set(r,n);this.queue=new a9({concurrency:t.maxParallelDials??lt.maxParallelDials,metricName:"libp2p_dial_queue",metrics:e.metrics}),this.queue.addEventListener("error",e=>{this.log.error("error in dial queue",e.detail)})}start(){this.shutDownController=new AbortController,(0,iT.W)(1/0,this.shutDownController.signal)}stop(){this.shutDownController.abort(),this.queue.abort()}async dial(e,t={}){let{peerId:r,multiaddrs:n}=aW(e),i=Array.from(this.connections.values()).flat().find(e=>!0!==t.force&&(!!e.remotePeer.equals(r)||n.find(t=>t.equals(e.remoteAddr))));if(null!=i)return this.log("already connected to %a",i.remoteAddr),i;let s=this.queue.queue.find(e=>{if(r?.equals(e.options.peerId)===!0)return!0;let t=e.options.multiaddrs;if(null==t)return!1;for(let e of n)if(t.has(e.toString()))return!0;return!1});if(null!=s){for(let e of(this.log("joining existing dial target for %p",r),n))s.options.multiaddrs.add(e.toString());return s.join(t)}if(this.queue.size>=this.maxDialQueueLength)throw new rX.sv("Dial queue is full","ERR_DIAL_QUEUE_FULL");return this.log("creating dial target for %p",r,n.map(e=>e.toString())),this.queue.add(async e=>{let t;let n=this.createDialAbortController(e?.signal);try{(t=await this.calculateMultiaddrs(r,e?.multiaddrs,{...e,signal:n})).map(({multiaddr:e})=>e.toString()).forEach(t=>{e?.multiaddrs.add(t)})}catch(e){throw n.clear(),e}try{let i=0,s=[];for(let o of t){if(i===this.maxPeerAddrsToDial)throw this.log("dialed maxPeerAddrsToDial (%d) addresses for %p, not trying any others",i,r),new rX.sv("Peer had more than maxPeerAddrsToDial",e4.ERR_TOO_MANY_ADDRESSES);i++;try{let t=await this.components.transportManager.dial(o.multiaddr,{...e,signal:n});return this.log("dial to %a succeeded",o.multiaddr),t}catch(e){if(this.log.error("dial failed to %a",o.multiaddr,e),null!=r)try{await this.components.peerStore.patch(r,{metadata:{[a1]:(0,r0.m)(Date.now().toString())}})}catch(e){this.log.error("could not update last dial failure key for %p",r,e)}if(n.aborted)throw new rX.sv(e.message,rX.l9);s.push(e)}}if(1===s.length)throw s[0];throw new rX.J5(s,"All multiaddr dials failed",e4.ERR_TRANSPORT_DIAL_FAILED)}finally{n.clear()}},{peerId:r,priority:t.priority??ln,multiaddrs:new Set(n.map(e=>e.toString())),signal:t.signal})}createDialAbortController(e){let t=a7([AbortSignal.timeout(this.dialTimeout),this.shutDownController.signal,e]);return(0,iT.W)(1/0,t),t}async calculateMultiaddrs(e,t=new Set,r={}){let n=[...t].map(e=>({multiaddr:(0,n0.HM)(e),isCertified:!1}));if(null!=e){if(this.components.peerId.equals(e))throw new rX.sv("Tried to dial self",e4.ERR_DIALED_SELF);if(await this.components.connectionGater.denyDialPeer?.(e)===!0)throw new rX.sv("The dial request is blocked by gater.allowDialPeer",e4.ERR_PEER_DIAL_INTERCEPTED);if(0===n.length){this.log("loading multiaddrs for %p",e);try{let t=await this.components.peerStore.get(e);n.push(...t.addresses),this.log("loaded multiaddrs for %p",e,n.map(({multiaddr:e})=>e.toString()))}catch(e){if(e.code!==e4.ERR_NOT_FOUND)throw e}}if(0===n.length){this.log("looking up multiaddrs for %p in the peer routing",e);try{let t=await this.components.peerRouting.findPeer(e);this.log("found multiaddrs for %p in the peer routing",e,n.map(({multiaddr:e})=>e.toString())),n.push(...t.multiaddrs.map(e=>({multiaddr:e,isCertified:!1})))}catch(t){t.code!==e4.ERR_NO_ROUTERS_AVAILABLE&&this.log.error("looking up multiaddrs for %p in the peer routing failed",e,t)}}}let i=(await Promise.all(n.map(async e=>{let t=await le(e.multiaddr,{dns:this.components.dns,...r,log:this.log});return 1===t.length&&t[0].equals(e.multiaddr)?e:t.map(e=>({multiaddr:e,isCertified:!1}))}))).flat();if(null!=e){let t=`/p2p/${e.toString()}`;i=i.map(e=>{let r=e.multiaddr.protos().pop();return r?.path===!0?e:null==e.multiaddr.getPeerId()?{multiaddr:e.multiaddr.encapsulate(t),isCertified:e.isCertified}:e})}let s=i.filter(t=>{if(null==this.components.transportManager.dialTransportForMultiaddr(t.multiaddr))return!1;let r=t.multiaddr.getPeerId();return null==e||null==r||e.equals(r)}),o=new Map;for(let e of s){let t=e.multiaddr.toString(),r=o.get(t);if(null!=r){r.isCertified=r.isCertified||e.isCertified||!1;continue}o.set(t,e)}let a=[...o.values()];if(0===a.length)throw new rX.sv("The dial request has no valid addresses",e4.ERR_NO_VALID_ADDRESSES);let l=[];for(let e of a)null!=this.components.connectionGater.denyDialMultiaddr&&await this.components.connectionGater.denyDialMultiaddr(e.multiaddr)||l.push(e);let c=l.sort(this.addressSorter);if(0===c.length)throw new rX.sv("The connection gater denied all addresses in the dial request",e4.ERR_NO_VALID_ADDRESSES);return this.log.trace("addresses for %p before filtering",e??"unknown peer",i.map(({multiaddr:e})=>e.toString())),this.log.trace("addresses for %p after filtering",e??"unknown peer",c.map(({multiaddr:e})=>e.toString())),c}async isDialable(e,t={}){Array.isArray(e)||(e=[e]);try{let r=await this.calculateMultiaddrs(void 0,new Set(e.map(e=>e.toString())),t);if(!1===t.runOnTransientConnection)return null!=r.find(e=>!sr.matches(e.multiaddr));return!0}catch(e){this.log.trace("error calculating if multiaddr(s) were dialable",e)}return!1}}let ln=50,li={minConnections:5,maxConnections:100,inboundConnectionThreshold:5,maxIncomingPendingConnections:10,autoDialConcurrency:25,autoDialPriority:0,autoDialMaxQueueLength:100,autoDialPeerRetryThreshold:42e4,autoDialDiscoveredPeersDebounce:10};class ls{started;connections;allow;deny;maxIncomingPendingConnections;incomingPendingConnections;maxConnections;dialQueue;autoDial;connectionPruner;inboundConnectionRateLimiter;peerStore;metrics;events;log;constructor(e,t={}){this.maxConnections=t.maxConnections??li.maxConnections;let r=t.minConnections??li.minConnections;if(this.maxConnections(0,n0.HM)(e)),this.deny=(t.deny??[]).map(e=>(0,n0.HM)(e)),this.incomingPendingConnections=0,this.maxIncomingPendingConnections=t.maxIncomingPendingConnections??li.maxIncomingPendingConnections,this.inboundConnectionRateLimiter=new sv({points:t.inboundConnectionThreshold??li.inboundConnectionThreshold,duration:1}),this.autoDial=new a3({connectionManager:this,peerStore:e.peerStore,events:e.events,logger:e.logger},{minConnections:r,autoDialConcurrency:t.autoDialConcurrency??li.autoDialConcurrency,autoDialPriority:t.autoDialPriority??li.autoDialPriority,autoDialPeerRetryThreshold:t.autoDialPeerRetryThreshold??li.autoDialPeerRetryThreshold,autoDialDiscoveredPeersDebounce:t.autoDialDiscoveredPeersDebounce??li.autoDialDiscoveredPeersDebounce,maxQueueLength:t.autoDialMaxQueueLength??li.autoDialMaxQueueLength}),this.connectionPruner=new a8({connectionManager:this,peerStore:e.peerStore,events:e.events,logger:e.logger},{maxConnections:this.maxConnections,allow:this.allow}),this.dialQueue=new lr(e,{addressSorter:t.addressSorter??ax,maxParallelDials:t.maxParallelDials??50,maxDialQueueLength:t.maxDialQueueLength??500,maxPeerAddrsToDial:t.maxPeerAddrsToDial??25,dialTimeout:t.dialTimeout??5e3,resolvers:t.resolvers??{dnsaddr:aq},connections:this.connections})}isStarted(){return this.started}async start(){this.metrics?.registerMetricGroup("libp2p_connection_manager_connections",{calculate:()=>{let e={inbound:0,outbound:0};for(let t of this.connections.values())for(let r of t)"inbound"===r.direction?e.inbound++:e.outbound++;return e}}),this.metrics?.registerMetricGroup("libp2p_protocol_streams_total",{label:"protocol",calculate:()=>{let e={};for(let t of this.connections.values())for(let r of t)for(let t of r.streams){let r=`${t.direction} ${t.protocol??"unnegotiated"}`;e[r]=(e[r]??0)+1}return e}}),this.metrics?.registerMetricGroup("libp2p_connection_manager_protocol_streams_per_connection_90th_percentile",{label:"protocol",calculate:()=>{let e={};for(let t of this.connections.values())for(let r of t){let t={};for(let e of r.streams){let r=`${e.direction} ${e.protocol??"unnegotiated"}`;t[r]=(t[r]??0)+1}for(let[r,n]of Object.entries(t))e[r]=e[r]??[],e[r].push(n)}let t={};for(let[r,n]of Object.entries(e)){let e=Math.floor(.9*(n=n.sort((e,t)=>e-t)).length);t[r]=n[e]}return t}}),this.dialQueue.start(),this.autoDial.start(),this.started=!0,this.log("started")}async afterStart(){Promise.resolve().then(async()=>{let e=await this.peerStore.all({filters:[e=>e.tags.has("keep-alive")]});await Promise.all(e.map(async e=>{await this.openConnection(e.id).catch(e=>{this.log.error(e)})}))}).catch(e=>{this.log.error(e)}),this.autoDial.afterStart()}async stop(){this.dialQueue.stop(),this.autoDial.stop();let e=[];for(let t of this.connections.values())for(let r of t)e.push((async()=>{try{await r.close()}catch(e){this.log.error(e)}})());this.log("closing %d connections",e.length),await Promise.all(e),this.connections.clear(),this.log("stopped")}onConnect(e){this._onConnect(e).catch(e=>{this.log.error(e)})}async _onConnect(e){let{detail:t}=e;if(!this.started){await t.close();return}let r=t.remotePeer,n=this.connections.get(r),i=!1;null!=n?n.push(t):(i=!0,this.connections.set(r,[t])),null!=r.publicKey&&"RSA"===r.type&&await this.peerStore.patch(r,{publicKey:r.publicKey}),i&&this.events.safeDispatchEvent("peer:connect",{detail:t.remotePeer})}onDisconnect(e){let{detail:t}=e;if(!this.started)return;let r=t.remotePeer,n=this.connections.get(r);null!=n&&n.length>1?(n=n.filter(e=>e.id!==t.id),this.connections.set(r,n)):null!=n&&(this.connections.delete(r),this.events.safeDispatchEvent("peer:disconnect",{detail:t.remotePeer}))}getConnections(e){if(null!=e)return this.connections.get(e)??[];let t=[];for(let e of this.connections.values())t=t.concat(e);return t}getConnectionsMap(){return this.connections}async openConnection(e,t={}){if(!this.isStarted())throw new rX.sv("Not started",e4.ERR_NODE_NOT_STARTED);t.signal?.throwIfAborted();let{peerId:r}=aW(e);if(null!=r&&!0!==t.force){this.log("dial %p",r);let e=this.getConnections(r).find(e=>!e.transient);if(null!=e)return this.log("had an existing non-transient connection to %p",r),e}let n=await this.dialQueue.dial(e,{...t,priority:t.priority??ln}),i=this.connections.get(n.remotePeer);null==i&&(i=[],this.connections.set(n.remotePeer,i));let s=!1;for(let e of i)e.id===n.id&&(s=!0);return s||i.push(n),n}async closeConnections(e,t={}){let r=this.connections.get(e)??[];await Promise.all(r.map(async e=>{try{await e.close(t)}catch(t){e.abort(t)}}))}async acceptIncomingConnection(e){if(this.deny.some(t=>e.remoteAddr.toString().startsWith(t.toString())))return this.log("connection from %a refused - connection remote address was in deny list",e.remoteAddr),!1;if(this.allow.some(t=>e.remoteAddr.toString().startsWith(t.toString())))return this.incomingPendingConnections++,!0;if(this.incomingPendingConnections===this.maxIncomingPendingConnections)return this.log("connection from %a refused - incomingPendingConnections exceeded by host",e.remoteAddr),!1;if(e.remoteAddr.isThinWaistAddress()){let t=e.remoteAddr.nodeAddress().address;try{await this.inboundConnectionRateLimiter.consume(t,1)}catch{return this.log("connection from %a refused - inboundConnectionThreshold exceeded by host %s",e.remoteAddr,t),!1}}return this.getConnections().length({id:t.id,status:e[t.status],peerId:t.options.peerId,multiaddrs:[...t.options.multiaddrs].map(e=>(0,n0.HM)(e))}))}async isDialable(e,t={}){return this.dialQueue.isDialable(e,t)}}var lo=r(10637);class la{routers;started;components;constructor(e,t){this.routers=t.routers??[],this.started=!1,this.components=e}isStarted(){return this.started}async start(){this.started=!0}async stop(){this.started=!1}async *findProviders(e,t={}){if(0===this.routers.length)throw new rX.sv("No content routers available",e4.ERR_NO_ROUTERS_AVAILABLE);let r=new oV;for await(let n of(0,lo.Z)(...this.routers.map(r=>r.findProviders(e,t))))null!=n&&(n.multiaddrs.length>0&&await this.components.peerStore.merge(n.id,{multiaddrs:n.multiaddrs}),r.has(n.id)||(r.add(n.id),yield n))}async provide(e,t={}){if(0===this.routers.length)throw new rX.sv("No content routers available",e4.ERR_NO_ROUTERS_AVAILABLE);await Promise.all(this.routers.map(async r=>{await r.provide(e,t)}))}async put(e,t,r){if(!this.isStarted())throw new rX.sv(e3.NOT_STARTED_YET,e4.ERR_NODE_NOT_STARTED);await Promise.all(this.routers.map(async n=>{await n.put(e,t,r)}))}async get(e,t){if(!this.isStarted())throw new rX.sv(e3.NOT_STARTED_YET,e4.ERR_NODE_NOT_STARTED);return Promise.any(this.routers.map(async r=>r.get(e,t)))}}let ll=globalThis.CustomEvent??Event;async function*lc(e,t={}){let r,n=t.concurrency??1/0;n<1&&(n=1/0);let i=null!=t.ordered&&t.ordered,s=new EventTarget,o=[],a=(0,t6.Z)(),l=(0,t6.Z)(),c=!1,u=!1;function h(){return i?o[0]?.done:!!o.find(e=>e.done)}for(s.addEventListener("task-complete",()=>{l.resolve()}),Promise.resolve().then(async()=>{try{for await(let t of e){if(o.length===n&&(a=(0,t6.Z)(),await a.promise),u)break;let e={done:!1};o.push(e),t().then(t=>{e.done=!0,e.ok=!0,e.value=t,s.dispatchEvent(new ll("task-complete"))},t=>{e.done=!0,e.err=t,s.dispatchEvent(new ll("task-complete"))})}c=!0,s.dispatchEvent(new ll("task-complete"))}catch(e){r=e,s.dispatchEvent(new ll("task-complete"))}});;){if(h()||(l=(0,t6.Z)(),await l.promise),null!=r)throw r;if(i?yield*function*(){for(;o.length>0&&o[0].done;){let e=o[0];if(o.shift(),e.ok)yield e.value;else throw u=!0,a.resolve(),e.err;a.resolve()}}():yield*function*(){for(;h();)for(let e=0;e(async function*(){try{yield await n.findPeer(e,t)}catch(e){r.log.error(e)}})())))if(null!=n)return n.multiaddrs.length>0&&await this.peerStore.merge(n.id,{multiaddrs:n.multiaddrs}),n;throw new rX.sv(e3.NOT_FOUND,e4.ERR_NOT_FOUND)}async *getClosestPeers(e,t={}){if(0===this.routers.length)throw new rX.sv("No peer routers available",e4.ERR_NO_ROUTERS_AVAILABLE);let r=this,n=new oV;for await(let i of lc(async function*(){for await(let n of(0,lo.Z)(...r.routers.map(r=>r.getClosestPeers(e,t))))yield async()=>{if(0===n.multiaddrs.length)try{n=await r.findPeer(n.id,{...t,useCache:!1})}catch(e){r.log.error("could not find peer multiaddrs",e);return}return n}}()))null!=i&&(i.multiaddrs.length>0&&await this.peerStore.merge(i.id,{multiaddrs:i.multiaddrs}),n.has(i.id)||(n.add(i.id),yield i))}}class lh extends tQ.L{peerRouting;log;walking;walkers;shutdownController;walkController;needNext;constructor(e){super(),this.log=e.logger.forComponent("libp2p:random-walk"),this.peerRouting=e.peerRouting,this.walkers=0,this.walking=!1,this.shutdownController=new AbortController,(0,iT.W)(1/0,this.shutdownController.signal)}start(){this.shutdownController=new AbortController,(0,iT.W)(1/0,this.shutdownController.signal)}stop(){this.shutdownController.abort()}async *walk(e){this.walking||this.startWalk(),this.walkers++;let t=a7([this.shutdownController.signal,e?.signal]);(0,iT.W)(1/0,t);try{for(;;){this.needNext?.resolve(),this.needNext=(0,t6.Z)();let e=await aQ(this,"walk:peer",t,{errorEvent:"walk:error"});yield e.detail}}finally{t.clear(),this.walkers--,0===this.walkers&&(this.walkController?.abort(),this.walkController=void 0)}}startWalk(){this.walking=!0,this.walkController=new AbortController,(0,iT.W)(1/0,this.walkController.signal);let e=a7([this.walkController.signal,this.shutdownController.signal]);(0,iT.W)(1/0,e);let t=Date.now(),r=0;Promise.resolve().then(async()=>{for(this.log("start walk");this.walkers>0;)try{for await(let t of this.peerRouting.getClosestPeers((0,sO.Z)(32),{signal:e}))e.throwIfAborted(),this.log("found peer %p",t.id),r++,this.safeDispatchEvent("walk:peer",{detail:t}),1===this.walkers&&null!=this.needNext&&await t8(this.needNext.promise,e)}catch(e){this.log.error("randomwalk errored",e),this.safeDispatchEvent("walk:error",{detail:e})}}).catch(e=>{this.log.error("randomwalk errored",e)}).finally(()=>{this.log("finished walk, found %d peers after %dms",r,Date.now()-t),this.walking=!1})}}class ld{log;topologies;handlers;components;constructor(e){this.log=e.logger.forComponent("libp2p:registrar"),this.topologies=new Map,this.handlers=new Map,this.components=e,this._onDisconnect=this._onDisconnect.bind(this),this._onPeerUpdate=this._onPeerUpdate.bind(this),this._onPeerIdentify=this._onPeerIdentify.bind(this),this.components.events.addEventListener("peer:disconnect",this._onDisconnect),this.components.events.addEventListener("peer:update",this._onPeerUpdate),this.components.events.addEventListener("peer:identify",this._onPeerIdentify)}getProtocols(){return Array.from(new Set([...this.handlers.keys()])).sort()}getHandler(e){let t=this.handlers.get(e);if(null==t)throw new rX.sv(`No handler registered for protocol ${e}`,e4.ERR_NO_HANDLER_FOR_PROTOCOL);return t}getTopologies(e){let t=this.topologies.get(e);return null==t?[]:[...t.values()]}async handle(e,t,r){if(this.handlers.has(e))throw new rX.sv(`Handler already registered for protocol ${e}`,e4.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED);let n=az.bind({ignoreUndefined:!0})({maxInboundStreams:32,maxOutboundStreams:64},r);this.handlers.set(e,{handler:t,options:n}),await this.components.peerStore.merge(this.components.peerId,{protocols:[e]})}async unhandle(e){(Array.isArray(e)?e:[e]).forEach(e=>{this.handlers.delete(e)}),await this.components.peerStore.patch(this.components.peerId,{protocols:this.getProtocols()})}async register(e,t){if(null==t)throw new rX.sv("invalid topology",e4.ERR_INVALID_PARAMETERS);let r=`${(1e9*Math.random()).toString(36)}${Date.now()}`,n=this.topologies.get(e);return null==n&&(n=new Map,this.topologies.set(e,n)),n.set(r,t),r}unregister(e){for(let[t,r]of this.topologies.entries())r.has(e)&&(r.delete(e),0===r.size&&this.topologies.delete(t))}_onDisconnect(e){let t=e.detail;this.components.peerStore.get(t).then(e=>{for(let r of e.protocols){let e=this.topologies.get(r);if(null!=e)for(let r of e.values())r.filter?.has(t)!==!1&&(r.filter?.remove(t),r.onDisconnect?.(t))}}).catch(e=>{e.code!==e4.ERR_NOT_FOUND&&this.log.error("could not inform topologies of disconnecting peer %p",t,e)})}_onPeerUpdate(e){let{peer:t,previous:r}=e.detail;for(let e of(r?.protocols??[]).filter(e=>!t.protocols.includes(e))){let r=this.topologies.get(e);if(null!=r)for(let e of r.values())e.filter?.has(t.id)!==!1&&(e.filter?.remove(t.id),e.onDisconnect?.(t.id))}}_onPeerIdentify(e){let t=e.detail.protocols,r=e.detail.connection,n=e.detail.peerId;for(let e of t){let t=this.topologies.get(e);if(null!=t)for(let e of t.values())r.transient&&!0!==e.notifyOnTransient||e.filter?.has(n)===!0||(e.filter?.add(n),e.onConnect?.(n,r))}}}class lp extends Map{metric;constructor(e){super();let{name:t,metrics:r}=e;this.metric=r.registerMetric(t),this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){let t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}}class lf{log;components;transports;listeners;faultTolerance;started;constructor(e,t={}){this.log=e.logger.forComponent("libp2p:transports"),this.components=e,this.started=!1,this.transports=new Map,this.listeners=function(e){let{name:t,metrics:r}=e;return null!=r?new lp({name:t,metrics:r}):new Map}({name:"libp2p_transport_manager_listeners",metrics:this.components.metrics}),this.faultTolerance=t.faultTolerance??eO.FATAL_ALL}add(e){let t=e[Symbol.toStringTag];if(null==t)throw new rX.sv("Transport must have a valid tag",e4.ERR_INVALID_KEY);if(this.transports.has(t))throw new rX.sv(`There is already a transport with the tag ${t}`,e4.ERR_DUPLICATE_TRANSPORT);this.log("adding transport %s",t),this.transports.set(t,e),this.listeners.has(t)||this.listeners.set(t,[])}isStarted(){return this.started}start(){this.started=!0}async afterStart(){let e=this.components.addressManager.getListenAddrs();await this.listen(e)}async stop(){let e=[];for(let[t,r]of this.listeners)for(this.log("closing listeners for %s",t);r.length>0;){let t=r.pop();null!=t&&e.push(t.close())}for(let t of(await Promise.all(e),this.log("all listeners closed"),this.listeners.keys()))this.listeners.set(t,[]);this.started=!1}async dial(e,t){let r=this.dialTransportForMultiaddr(e);if(null==r)throw new rX.sv(`No transport available for address ${String(e)}`,e4.ERR_TRANSPORT_UNAVAILABLE);try{return await r.dial(e,{...t,upgrader:this.components.upgrader})}catch(e){throw null==e.code&&(e.code=e4.ERR_TRANSPORT_DIAL_FAILED),e}}getAddrs(){let e=[];for(let t of this.listeners.values())for(let r of t)e=[...e,...r.getAddrs()];return e}getTransports(){return Array.of(...this.transports.values())}getListeners(){return Array.of(...this.listeners.values()).flat()}dialTransportForMultiaddr(e){for(let t of this.transports.values())if(t.dialFilter([e]).length>0)return t}listenTransportForMultiaddr(e){for(let t of this.transports.values())if(t.listenFilter([e]).length>0)return t}async listen(e){if(!this.isStarted())throw new rX.sv("Not started",e4.ERR_NODE_NOT_STARTED);if(null==e||0===e.length){this.log("no addresses were provided for listening, this node is dial only");return}let t=[];for(let[r,n]of this.transports.entries()){let i=n.listenFilter(e),s=[];for(let e of i){this.log("creating listener for %s on %a",r,e);let t=n.createListener({upgrader:this.components.upgrader}),i=this.listeners.get(r)??[];null==i&&(i=[],this.listeners.set(r,i)),i.push(t),t.addEventListener("listening",()=>{this.components.events.safeDispatchEvent("transport:listening",{detail:t})}),t.addEventListener("close",()=>{let e=i.findIndex(e=>e===t);i.splice(e,1),this.components.events.safeDispatchEvent("transport:close",{detail:t})}),s.push(t.listen(e))}if(0===s.length){t.push(r);continue}if(null==(await Promise.allSettled(s)).find(e=>"fulfilled"===e.status)&&this.faultTolerance!==eO.NO_FATAL)throw new rX.sv(`Transport (${r}) could not listen on any available address`,e4.ERR_NO_VALID_ADDRESSES)}if(t.length===this.transports.size){let e=`no valid addresses were provided for transports [${t.join(", ")}]`;if(this.faultTolerance===eO.FATAL_ALL)throw new rX.sv(e,e4.ERR_NO_VALID_ADDRESSES);this.log(`libp2p in dial mode only: ${e}`)}}async remove(e){let t=this.listeners.get(e)??[];this.log.trace("removing transport %s",e);let r=[];for(this.log.trace("closing listeners for %s",e);t.length>0;){let e=t.pop();null!=e&&r.push(e.close())}await Promise.all(r),this.transports.delete(e),this.listeners.delete(e)}async removeAll(){let e=[];for(let t of this.transports.keys())e.push(this.remove(t));await Promise.all(e)}}let lg="/multistream/1.0.0",lm=(0,r0.m)("\n");async function ly(e,t,r){await e.write(t,r)}async function lb(e,t,r){await e.writeV(t,r)}async function lv(e,t){let r=await e.read(t);if(0===r.byteLength||r.get(r.byteLength-1)!==lm[0])throw t.log.error("Invalid mss message - missing newline",r),new rX.sv("missing newline","ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return r.sublist(0,-1)}async function lw(e,t){let r=await lv(e,t);return(0,r5.B)(r.subarray())}async function lE(e,t,r){t=Array.isArray(t)?t:[t],r.log.trace("handle: available protocols %s",t);let n=rn(e,{...r,maxDataLength:1024,maxLengthLength:2});for(;;){r.log.trace("handle: reading incoming string");let e=await lw(n,r);if(r.log.trace('handle: read "%s"',e),e===lg){r.log.trace('handle: respond with "%s" for "%s"',lg,e),await ly(n,(0,r0.m)(`${lg} +`),r),r.log.trace('handle: responded with "%s" for "%s"',lg,e);continue}if(t.includes(e))return r.log.trace('handle: respond with "%s" for "%s"',e,e),await ly(n,(0,r0.m)(`${e} +`),r),r.log.trace('handle: responded with "%s" for "%s"',e,e),{stream:n.unwrap(),protocol:e};if("ls"===e){let i=new tR.H(...t.map(e=>tf.c.single((0,r0.m)(`${e} +`))),(0,r0.m)("\n"));r.log.trace('handle: respond with "%s" for %s',t,e),await ly(n,i,r),r.log.trace('handle: responded with "%s" for %s',t,e);continue}r.log('handle: respond with "na" for "%s"',e),await ly(n,(0,r0.m)("na\n"),r),r.log('handle: responded with "na" for "%s"',e)}}async function lS(e,t,r){if(1===(t=Array.isArray(t)?[...t]:[t]).length&&!1===r.negotiateFully)return function(e,t,r){let n=e.sink.bind(e),i=e.source,s=!1,o=!1,a=(0,t6.Z)(),l=!1,c=!1,u=(0,t6.Z)(),h=!1,d=!1,p=(0,t6.Z)(),f=rn({sink:n,source:i},{...r,maxDataLength:1024});async function g(){if(o){r.log.trace("optimistic: already negotiating %s stream",t),await a.promise;return}o=!0;try{l||(r.log.trace("optimistic: doing send protocol for %s stream",t),await m()),h||(r.log.trace("optimistic: doing read protocol for %s stream",t),await y())}finally{o=!1,s=!0,a.resolve()}}async function m(){if(c){await u.promise;return}c=!0;try{r.log.trace('optimistic: write ["%s", "%s", data] in source',lg,t),await f.writeV([(0,r0.m)(`${lg} +`),(0,r0.m)(`${t} +`)]),r.log.trace('optimistic: wrote ["%s", "%s", data] in source',lg,t)}finally{l=!0,c=!1,u.resolve()}}async function y(){if(d){await p.promise;return}d=!0;try{r.log.trace("optimistic: reading multistream select header");let e=await lw(f,r);if(r.log.trace('optimistic: read multistream select header "%s"',e),e===lg&&(e=await lw(f,r)),r.log.trace('optimistic: read protocol "%s", expecting "%s"',e,t),e!==t)throw new rX.sv("protocol selection failed","ERR_UNSUPPORTED_PROTOCOL")}finally{h=!0,d=!1,p.resolve()}}if(e.sink=async e=>{let{sink:n}=f.unwrap();await n(async function*(){let n=!1;for await(let i of e){if(c&&await u.promise,l)yield i;else{c=!0,r.log.trace('optimistic: write ["%s", "%s", data(%d)] in sink',lg,t,i.byteLength);let e=`${t} +`;yield new tR.H(Uint8Array.from([19]),(0,r0.m)(`${lg} +`),rt.cv(e.length),(0,r0.m)(e),i).subarray(),r.log.trace('optimistic: wrote ["%s", "%s", data(%d)] in sink',lg,t,i.byteLength),l=!0,c=!1,u.resolve(),g().catch(e=>{r.log.error("could not finish optimistic protocol negotiation of %s",t,e)})}n=!0}n||await g()}())},e.source=async function*(){await g(),r.log.trace('optimistic: reading data from "%s" stream',t),yield*f.unwrap().source}(),null!=e.closeRead){let t=e.closeRead.bind(e);e.closeRead=async e=>{s||await g().catch(e=>{r.log.error("could not negotiate protocol before close read",e)}),await t(e)}}if(null!=e.closeWrite){let t=e.closeWrite.bind(e);e.closeWrite=async e=>{s||await g().catch(e=>{r.log.error("could not negotiate protocol before close write",e)}),await t(e)}}if(null!=e.close){let t=e.close.bind(e);e.close=async e=>{let r=[];c&&r.push(u.promise),d&&r.push(p.promise),r.length>0?await t8(Promise.all(r),e?.signal):(s=!0,o=!1,a.resolve()),await t(e)}}return{stream:e,protocol:t}}(e,t[0],r);let n=rn(e,{...r,maxDataLength:1024}),i=t.shift();if(null==i)throw Error("At least one protocol must be specified");r.log.trace('select: write ["%s", "%s"]',lg,i);let s=(0,r0.m)(`${lg} +`),o=(0,r0.m)(`${i} +`);await lb(n,[s,o],r),r.log.trace("select: reading multistream-select header");let a=await lw(n,r);if(r.log.trace('select: read "%s"',a),a===lg&&(r.log.trace("select: reading protocol response"),a=await lw(n,r),r.log.trace('select: read "%s"',a)),a===i)return{stream:n.unwrap(),protocol:i};for(let e of t){r.log.trace('select: write "%s"',e),await ly(n,(0,r0.m)(`${e} +`),r),r.log.trace("select: reading protocol response");let t=await lw(n,r);if(r.log.trace('select: read "%s" for "%s"',t,e),t===e)return{stream:n.unwrap(),protocol:e}}throw new rX.sv("protocol selection failed","ERR_UNSUPPORTED_PROTOCOL")}let lA=Symbol.for("@libp2p/connection");class lI{id;remoteAddr;remotePeer;direction;timeline;multiplexer;encryption;status;transient;log;tags;_newStream;_close;_abort;_getStreams;constructor(e){let{remoteAddr:t,remotePeer:r,newStream:n,close:i,abort:s,getStreams:o}=e;this.id=`${parseInt(String(1e9*Math.random())).toString(36)}${Date.now()}`,this.remoteAddr=t,this.remotePeer=r,this.direction=e.direction,this.status="open",this.timeline=e.timeline,this.multiplexer=e.multiplexer,this.encryption=e.encryption,this.transient=e.transient??!1,this.log=e.logger.forComponent(`libp2p:connection:${this.direction}:${this.id}`),null==this.remoteAddr.getPeerId()&&(this.remoteAddr=this.remoteAddr.encapsulate(`/p2p/${this.remotePeer}`)),this._newStream=n,this._close=i,this._abort=s,this._getStreams=o,this.tags=[]}[Symbol.toStringTag]="Connection";[lA]=!0;get streams(){return this._getStreams()}async newStream(e,t){if("closing"===this.status)throw new rX.sv("the connection is being closed","ERR_CONNECTION_BEING_CLOSED");if("closed"===this.status)throw new rX.sv("the connection is closed","ERR_CONNECTION_CLOSED");if(Array.isArray(e)||(e=[e]),this.transient&&t?.runOnTransientConnection!==!0)throw new rX.sv("Cannot open protocol stream on transient connection","ERR_TRANSIENT_CONNECTION");let r=await this._newStream(e,t);return r.direction="outbound",r}async close(e={}){if("closed"!==this.status&&"closing"!==this.status){if(this.log("closing connection to %a",this.remoteAddr),this.status="closing",null==e.signal){let t=AbortSignal.timeout(500);(0,iT.W)(1/0,t),e={...e,signal:t}}try{this.log.trace("closing all streams"),await Promise.all(this.streams.map(async t=>t.close(e))),this.log.trace("closing underlying transport"),await this._close(e),this.log.trace("updating timeline with close time"),this.status="closed",this.timeline.close=Date.now()}catch(e){this.log.error("error encountered during graceful close of connection to %a",this.remoteAddr,e),this.abort(e)}}}abort(e){this.log.error("aborting connection to %a due to error",this.remoteAddr,e),this.status="closing",this.streams.forEach(t=>{t.abort(e)}),this.log.error("all streams aborted",this.streams.length),this._abort(e),this.timeline.close=Date.now(),this.status="closed"}}function l_(e,t,r){let n=0;return r.streams.forEach(r=>{r.direction===t&&r.protocol===e&&n++}),n}class lT{components;connectionEncryption;muxers;inboundUpgradeTimeout;events;constructor(e,t){this.components=e,this.connectionEncryption=new Map,t.connectionEncryption.forEach(e=>{this.connectionEncryption.set(e.protocol,e)}),this.muxers=new Map,t.muxers.forEach(e=>{this.muxers.set(e.protocol,e)}),this.inboundUpgradeTimeout=t.inboundUpgradeTimeout??2e3,this.events=e.events}async shouldBlockConnection(e,t,r){let n=this.components.connectionGater[r];if(void 0!==n&&await n(e,t))throw new rX.sv(`The multiaddr connection is blocked by gater.${r}`,e4.ERR_CONNECTION_INTERCEPTED)}async upgradeInbound(e,t){let r,n,i,s,o;if(!await this.components.connectionManager.acceptIncomingConnection(e))throw new rX.sv("connection denied",e4.ERR_CONNECTION_DENIED);let a=AbortSignal.timeout(this.inboundUpgradeTimeout),l=()=>{e.abort(new rX.sv("inbound upgrade timeout",rX.l9))};a.addEventListener("abort",l,{once:!0}),(0,iT.W)(1/0,a);try{if(await this.components.connectionGater.denyInboundConnection?.(e)===!0)throw new rX.sv("The multiaddr connection is blocked by gater.acceptConnection",e4.ERR_CONNECTION_INTERCEPTED);this.components.metrics?.trackMultiaddrConnection(e),e.log("starting the inbound connection upgrade");let a=e;if(t?.skipProtection!==!0){let t=this.components.connectionProtector;null!=t&&(e.log("protecting the inbound connection"),a=await t.protect(e))}try{if(r=a,t?.skipEncryption!==!0){({conn:r,remotePeer:n,protocol:o}=await this._encryptInbound(a));let e={...a,...r};await this.shouldBlockConnection(n,e,"denyInboundEncryptedConnection")}else{let t=e.remoteAddr.getPeerId();if(null==t)throw new rX.sv("inbound connection that skipped encryption must have a peer id",e4.ERR_INVALID_MULTIADDR);let r=(0,nF.jE)(t);o="native",n=r}if(i=r,t?.muxerFactory!=null)s=t.muxerFactory;else if(this.muxers.size>0){let e=await this._multiplexInbound({...a,...r},this.muxers);s=e.muxerFactory,i=e.stream}}catch(t){throw e.log.error("failed to upgrade inbound connection",t),t}return await this.shouldBlockConnection(n,e,"denyInboundUpgradedConnection"),e.log("successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:o,direction:"inbound",maConn:e,upgradedConn:i,muxerFactory:s,remotePeer:n,transient:t?.transient})}finally{a.removeEventListener("abort",l),this.components.connectionManager.afterUpgradeInbound()}}async upgradeOutbound(e,t){let r,n,i,s,o,a;let l=e.remoteAddr.getPeerId();null!=l&&(r=(0,nF.jE)(l),await this.shouldBlockConnection(r,e,"denyOutboundConnection")),this.components.metrics?.trackMultiaddrConnection(e),e.log("starting the outbound connection upgrade");let c=e;if(t?.skipProtection!==!0){let t=this.components.connectionProtector;null!=t&&(c=await t.protect(e))}try{if(n=c,t?.skipEncryption!==!0){({conn:n,remotePeer:i,protocol:o}=await this._encryptOutbound(c,r));let e={...c,...n};await this.shouldBlockConnection(i,e,"denyOutboundEncryptedConnection")}else{if(null==r)throw new rX.sv("Encryption was skipped but no peer id was passed",e4.ERR_INVALID_PEER);o="native",i=r}if(s=n,t?.muxerFactory!=null)a=t.muxerFactory;else if(this.muxers.size>0){let e=await this._multiplexOutbound({...c,...n},this.muxers);a=e.muxerFactory,s=e.stream}}catch(t){throw e.log.error("failed to upgrade outbound connection",t),await e.close(t),t}return await this.shouldBlockConnection(i,e,"denyOutboundUpgradedConnection"),e.log("successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:o,direction:"outbound",maConn:e,upgradedConn:s,muxerFactory:a,remotePeer:i,transient:t?.transient})}_createConnection(e){let t,r,n;let{cryptoProtocol:i,direction:s,maConn:o,upgradedConn:a,remotePeer:l,muxerFactory:c,transient:u}=e;null!=c&&(t=c.createStreamMuxer({direction:s,onIncomingStream:e=>{null!=n&&Promise.resolve().then(async()=>{let t=this.components.registrar.getProtocols(),{stream:r,protocol:i}=await lE(e,t,{log:e.log,yieldBytes:!1});if(null==n)return;n.log("incoming stream opened on %s",i);let s=function(e,t){try{let{options:r}=t.getHandler(e);return r.maxInboundStreams}catch(e){if(e.code!==e4.ERR_NO_HANDLER_FOR_PROTOCOL)throw e}return 32}(i,this.components.registrar);if(l_(i,"inbound",n)===s){let t=new rX.sv(`Too many inbound protocol streams for protocol "${i}" - limit ${s}`,e4.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS);throw e.abort(t),t}e.source=r.source,e.sink=r.sink,e.protocol=i,null!=r.closeWrite&&(e.closeWrite=r.closeWrite),null!=r.closeRead&&(e.closeRead=r.closeRead),null!=r.close&&(e.close=r.close),await this.components.peerStore.merge(l,{protocols:[i]}),this.components.metrics?.trackProtocolStream(e,n),this._onStream({connection:n,stream:e,protocol:i})}).catch(async t=>{n.log.error("error handling incoming stream id %s",e.id,t.message,t.code,t.stack),null==e.timeline.close&&await e.close()})}}),r=async(e,r={})=>{if(null==t)throw new rX.sv("Stream is not multiplexed",e4.ERR_MUXER_UNAVAILABLE);n.log("starting new stream for protocols %s",e);let i=await t.newStream();n.log.trace("started new stream %s for protocols %s",i.id,e);try{if(null==r.signal){i.log("no abort signal was passed while trying to negotiate protocols %s falling back to default timeout",e);let t=AbortSignal.timeout(3e4);(0,iT.W)(1/0,t),r={...r,signal:t}}i.log.trace("selecting protocol from protocols %s",e);let{stream:t,protocol:s}=await lS(i,e,{...r,log:i.log,yieldBytes:!0});i.log("selected protocol %s",s);let o=function(e,t,r={}){try{let{options:r}=t.getHandler(e);if(null!=r.maxOutboundStreams)return r.maxOutboundStreams}catch(e){if(e.code!==e4.ERR_NO_HANDLER_FOR_PROTOCOL)throw e}return r.maxOutboundStreams??64}(s,this.components.registrar,r),a=l_(s,"outbound",n);if(a>=o){let e=new rX.sv(`Too many outbound protocol streams for protocol "${s}" - ${a}/${o}`,e4.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);throw i.abort(e),e}return await this.components.peerStore.merge(l,{protocols:[s]}),i.source=t.source,i.sink=t.sink,i.protocol=s,null!=t.closeWrite&&(i.closeWrite=t.closeWrite),null!=t.closeRead&&(i.closeRead=t.closeRead),null!=t.close&&(i.close=t.close),this.components.metrics?.trackProtocolStream(i,n),i}catch(t){if(n.log.error("could not create new stream for protocols %s",e,t),null==i.timeline.close&&i.abort(t),null!=t.code)throw t;throw new rX.sv(String(t),e4.ERR_UNSUPPORTED_PROTOCOL)}},Promise.all([t.sink(a.source),a.sink(t.source)]).catch(e=>{n.log.error("error piping data through muxer",e)}));let h=o.timeline;return o.timeline=new Proxy(h,{set:(...e)=>(null!=n&&"close"===e[1]&&null!=e[2]&&null==h.close&&(async()=>{try{"open"===n.status&&await n.close()}catch(e){n.log.error("error closing connection after timeline close",e)}finally{this.events.safeDispatchEvent("connection:close",{detail:n})}})().catch(e=>{n.log.error("error thrown while dispatching connection:close event",e)}),Reflect.set(...e))}),o.timeline.upgraded=Date.now(),n=new lI({remoteAddr:o.remoteAddr,remotePeer:l,status:"open",direction:s,timeline:o.timeline,multiplexer:t?.protocol,encryption:i,transient:u,logger:this.components.logger,newStream:r??(()=>{throw new rX.sv("connection is not multiplexed",e4.ERR_CONNECTION_NOT_MULTIPLEXED)}),getStreams:()=>null!=t?t.streams:[],close:async e=>{null!=t&&(n.log.trace("close muxer"),await t.close(e)),n.log.trace("close maconn"),await o.close(e),n.log.trace("closed maconn")},abort:e=>{o.abort(e),null!=t&&t.abort(e)}}),this.events.safeDispatchEvent("connection:open",{detail:n}),n}_onStream(e){let{connection:t,stream:r,protocol:n}=e,{handler:i,options:s}=this.components.registrar.getHandler(n);if(t.transient&&!0!==s.runOnTransientConnection)throw new rX.sv("Cannot open protocol stream on transient connection","ERR_TRANSIENT_CONNECTION");i({connection:t,stream:r})}async _encryptInbound(e){let t=Array.from(this.connectionEncryption.keys());e.log("handling inbound crypto protocol selection",t);try{let{stream:r,protocol:n}=await lE(e,t,{log:e.log}),i=this.connectionEncryption.get(n);if(null==i)throw Error(`no crypto module found for ${n}`);return e.log("encrypting inbound connection using",n),{...await i.secureInbound(this.components.peerId,r),protocol:n}}catch(t){throw e.log.error("encrypting inbound connection failed",t),new rX.sv(t.message,e4.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,t){let r=Array.from(this.connectionEncryption.keys());e.log("selecting outbound crypto protocol",r);try{e.log.trace("selecting encrypter from %s",r);let{stream:n,protocol:i}=await lS(e,r,{log:e.log,yieldBytes:!0}),s=this.connectionEncryption.get(i);if(null==s)throw Error(`no crypto module found for ${i}`);return e.log("encrypting outbound connection to %p using %s",t,s),{...await s.secureOutbound(this.components.peerId,n,t),protocol:i}}catch(r){throw e.log.error("encrypting outbound connection to %p failed",t,r),new rX.sv(r.message,e4.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,t){let r=Array.from(t.keys());e.log("outbound selecting muxer %s",r);try{e.log.trace("selecting stream muxer from %s",r);let{stream:n,protocol:i}=await lS(e,r,{log:e.log,yieldBytes:!0});e.log("selected %s as muxer protocol",i);let s=t.get(i);return{stream:n,muxerFactory:s}}catch(t){throw e.log.error("error multiplexing outbound connection",t),new rX.sv(String(t),e4.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,t){let r=Array.from(t.keys());e.log("inbound handling muxers %s",r);try{let{stream:n,protocol:i}=await lE(e,r,{log:e.log}),s=t.get(i);return{stream:n,muxerFactory:s}}catch(t){throw e.log.error("error multiplexing inbound connection",t),new rX.sv(String(t),e4.ERR_MUXER_UNAVAILABLE)}}}class lC extends tQ.L{peerId;peerStore;contentRouting;peerRouting;metrics;services;logger;status;components;log;constructor(e){super(),this.status="stopped";let t=new tQ.L,r=t.dispatchEvent.bind(t);t.dispatchEvent=e=>{let t=r(e),n=this.dispatchEvent(new tQ.A(e.type,{detail:e.detail}));return t||n},(0,iT.W)(1/0,t),this.peerId=e.peerId,this.logger=e.logger??oF(),this.log=this.logger.forComponent("libp2p"),this.services={};let n=this.components=function(e={}){let t=new aR(e);return new Proxy(t,{get(e,r,n){if("string"==typeof r&&!aP.includes(r)){let e=t.components[r];if(null==e&&!ak.includes(r))throw new rX.sv(`${r} not set`,"ERR_SERVICE_MISSING");return e}return Reflect.get(e,r,n)},set:(e,r,n)=>("string"==typeof r?t.components[r]=n:Reflect.set(e,r,n),!0)})}({peerId:e.peerId,privateKey:e.privateKey,nodeInfo:e.nodeInfo??{name:"libp2p",version:"1.6.0"},logger:this.logger,events:t,datastore:e.datastore??new aI,connectionGater:function(e={}){return{denyDialPeer:async()=>!1,denyDialMultiaddr:async e=>{let t=e.stringTuples();return(4===t[0][0]||41===t[0][0])&&!!aN(`${t[0][1]}`)},denyInboundConnection:async()=>!1,denyOutboundConnection:async()=>!1,denyInboundEncryptedConnection:async()=>!1,denyOutboundEncryptedConnection:async()=>!1,denyInboundUpgradedConnection:async()=>!1,denyOutboundUpgradedConnection:async()=>!1,filterMultiaddrForPeer:async()=>!0,...e}}(e.connectionGater),dns:e.dns});this.peerStore=this.configureComponent("peerStore",new am(n,{addressFilter:this.components.connectionGater.filterMultiaddrForPeer,...e.peerStore})),null!=e.metrics&&(this.metrics=this.configureComponent("metrics",e.metrics(this.components))),n.events.addEventListener("peer:update",e=>{if(null==e.detail.previous){let t={id:e.detail.peer.id,multiaddrs:e.detail.peer.addresses.map(e=>e.multiaddr)};n.events.safeDispatchEvent("peer:discovery",{detail:t})}}),null!=e.connectionProtector&&this.configureComponent("connectionProtector",e.connectionProtector(n)),this.components.upgrader=new lT(this.components,{connectionEncryption:(e.connectionEncryption??[]).map((e,t)=>this.configureComponent(`connection-encryption-${t}`,e(this.components))),muxers:(e.streamMuxers??[]).map((e,t)=>this.configureComponent(`stream-muxers-${t}`,e(this.components))),inboundUpgradeTimeout:e.connectionManager.inboundUpgradeTimeout}),this.configureComponent("transportManager",new lf(this.components,e.transportManager)),this.configureComponent("connectionManager",new ls(this.components,e.connectionManager)),this.configureComponent("registrar",new ld(this.components)),this.configureComponent("addressManager",new aC(this.components,e.addresses));let i=(e.peerRouters??[]).map((e,t)=>this.configureComponent(`peer-router-${t}`,e(this.components)));this.peerRouting=this.components.peerRouting=this.configureComponent("peerRouting",new lu(this.components,{routers:i}));let s=(e.contentRouters??[]).map((e,t)=>this.configureComponent(`content-router-${t}`,e(this.components)));if(this.contentRouting=this.components.contentRouting=this.configureComponent("contentRouting",new la(this.components,{routers:s})),this.configureComponent("randomWalk",new lh(this.components)),(e.peerDiscovery??[]).forEach((e,t)=>{this.configureComponent(`peer-discovery-${t}`,e(this.components)).addEventListener("peer",e=>{this.#L(e)})}),e.transports?.forEach((e,t)=>{this.components.transportManager.add(this.configureComponent(`transport-${t}`,e(this.components)))}),null!=e.services)for(let t of Object.keys(e.services)){let r=(0,e.services[t])(this.components);if(null==r){this.log.error("service factory %s returned null or undefined instance",t);continue}this.services[t]=r,this.configureComponent(t,r),null!=r[ox]&&(this.log("registering service %s for content routing",t),s.push(r[ox])),null!=r[oO]&&(this.log("registering service %s for peer routing",t),i.push(r[oO])),null!=r[nZ.J]&&(this.log("registering service %s for peer discovery",t),r[nZ.J].addEventListener?.("peer",e=>{this.#L(e)}))}}configureComponent(e,t){return null==t&&this.log.error("component %s was null or undefined",e),this.components[e]=t,t}async start(){if("stopped"===this.status){this.status="starting",this.log("libp2p is starting");try{await this.components.beforeStart?.(),await this.components.start(),await this.components.afterStart?.(),this.status="started",this.safeDispatchEvent("start",{detail:this}),this.log("libp2p has started")}catch(e){throw this.log.error("An error occurred starting libp2p",e),this.status="started",await this.stop(),e}}}async stop(){"started"===this.status&&(this.log("libp2p is stopping"),this.status="stopping",await this.components.beforeStop?.(),await this.components.stop(),await this.components.afterStop?.(),this.status="stopped",this.safeDispatchEvent("stop",{detail:this}),this.log("libp2p has stopped"))}getConnections(e){return this.components.connectionManager.getConnections(e)}getDialQueue(){return this.components.connectionManager.getDialQueue()}getPeers(){let e=new oV;for(let t of this.components.connectionManager.getConnections())e.add(t.remotePeer);return Array.from(e)}async dial(e,t={}){return this.components.connectionManager.openConnection(e,{priority:75,...t})}async dialProtocol(e,t,r={}){if(null==t||0===(t=Array.isArray(t)?t:[t]).length)throw new rX.sv("no protocols were provided to open a stream",e4.ERR_INVALID_PROTOCOLS_FOR_STREAM);return(await this.dial(e,r)).newStream(t,r)}getMultiaddrs(){return this.components.addressManager.getAddresses()}getProtocols(){return this.components.registrar.getProtocols()}async hangUp(e,t={}){(0,n0.h2)(e)&&(e=(0,nF.jE)(e.getPeerId()??"")),await this.components.connectionManager.closeConnections(e,t)}async getPublicKey(e,t={}){if(this.log("getPublicKey %p",e),null!=e.publicKey)return e.publicKey;try{let t=await this.peerStore.get(e);if(null!=t.id.publicKey)return t.id.publicKey}catch(e){if(e.code!==e4.ERR_NOT_FOUND)throw e}let r=(0,r6.z)([(0,r0.m)("/pk/"),e.multihash.digest]),n=await this.contentRouting.get(r,t);return(0,ik.lR)(n),await this.peerStore.patch(e,{publicKey:n}),n}async handle(e,t,r){Array.isArray(e)||(e=[e]),await Promise.all(e.map(async e=>{await this.components.registrar.handle(e,t,r)}))}async unhandle(e){Array.isArray(e)||(e=[e]),await Promise.all(e.map(async e=>{await this.components.registrar.unhandle(e)}))}async register(e,t){return this.components.registrar.register(e,t)}unregister(e){this.components.registrar.unregister(e)}async isDialable(e,t={}){return this.components.connectionManager.isDialable(e,t)}#L(e){let{detail:t}=e;if(t.id.toString()===this.peerId.toString()){this.log.error(Error(e4.ERR_DISCOVERED_SELF));return}this.components.peerStore.merge(t.id,{multiaddrs:t.multiaddrs}).catch(e=>{this.log.error(e)})}}async function lR(e={}){let t=e.peerId??=await (0,oH.n9)();if(null==t.privateKey)throw new rX.sv("peer id was missing private key","ERR_MISSING_PRIVATE_KEY");return e.privateKey??=await (0,ik.r3)(t.privateKey),new lC(await aG(e))}async function lk(e={}){let t=await lR(e);return!1!==e.start&&await t.start(),t}function lP(e){return!!e}(ew=e6||(e6={})).Relay="relay",ew.Store="store",ew.LightPush="lightpush",ew.Filter="filter",(eE=e5||(e5={})).GENERIC_FAIL="Generic error",eE.ENCODE_FAILED="Failed to encode",eE.DECODE_FAILED="Failed to decode",eE.EMPTY_PAYLOAD="Payload is empty",eE.SIZE_TOO_BIG="Size is too big",eE.TOPIC_NOT_CONFIGURED="Topic not configured",eE.NO_PEER_AVAILABLE="No peer available",eE.REMOTE_PEER_FAULT="Remote peer fault",eE.REMOTE_PEER_REJECTED="Remote peer rejected",eE.REQUEST_TIMEOUT="Request timeout",(eS=e8||(e8={})).BACKWARD="backward",eS.FORWARD="forward",(eA=e9||(e9={})).BOOTSTRAP="bootstrap",eA.PEER_EXCHANGE="peer-exchange",eA.LOCAL="local-peer-cache",(eI=e7||(e7={})).PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",eI.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",eI.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",eI.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange",(te||(te={})).CONNECTION_STATUS="waku:connection";let lD=e=>(0,r5.B)(e,"utf8"),lB=e=>(0,r0.m)(e,"utf8");class lN{numPeers;constructor(e){this.numPeers=e?.numPeersToUse??3}}let lL=new ts.Yd("sdk:filter");class lx{protocol;pubsubTopic;peers;receivedMessagesHashStr=[];subscriptionCallbacks;constructor(e,t,r){this.protocol=r,this.peers=t,this.pubsubTopic=e,this.subscriptionCallbacks=new Map}async subscribe(e,t){let r=Array.isArray(e)?e:[e];r.forEach(e=>{if(e.pubsubTopic!==this.pubsubTopic)throw Error(`Pubsub topic not configured: decoder is configured for pubsub topic ${e.pubsubTopic} but this subscription is for pubsub topic ${this.pubsubTopic}. Please create a new Subscription for the different pubsub topic.`)});let n=(0,ts.p3)(r),i=Array.from(n.keys()),s=this.peers.map(async e=>{await this.protocol.subscribe(this.pubsubTopic,e,i)}),o=await Promise.allSettled(s);this.handleErrors(o,"subscribe"),n.forEach((e,r)=>{this.subscriptionCallbacks.set(r,{decoders:e,callback:t})})}async unsubscribe(e){let t=this.peers.map(async t=>{await this.protocol.unsubscribe(this.pubsubTopic,t,e),e.forEach(e=>{this.subscriptionCallbacks.delete(e)})}),r=await Promise.allSettled(t);this.handleErrors(r,"unsubscribe")}async ping(){let e=this.peers.map(async e=>{await this.protocol.ping(e)}),t=await Promise.allSettled(e);this.handleErrors(t,"ping")}async unsubscribeAll(){let e=this.peers.map(async e=>{await this.protocol.unsubscribeAll(this.pubsubTopic,e)}),t=await Promise.allSettled(e);this.subscriptionCallbacks.clear(),this.handleErrors(t,"unsubscribeAll")}async processIncomingMessage(e){let t=lD(function(e,t){let r=lB(e),n=lB(t.contentTopic),i=function(e){if(e)return function(e){let t=new ArrayBuffer(8),r=new DataView(t);return"number"==typeof e?r.setFloat64(0,e,!1):r.setBigInt64(0,e,!1),new Uint8Array(t)}(e.valueOf())}(t.timestamp),s=function(e,t){let r=new Uint8Array((void 0)??e.reduce((e,t)=>e+t.length,0)),n=0;for(let t of e)r.set(t,n),n+=t.length;return r}([r,t.payload,n,t.meta,i].filter(lP));return(0,rj.J)(s)}(this.pubsubTopic,e));if(this.receivedMessagesHashStr.includes(t)){lL.info("Message already received, skipping");return}this.receivedMessagesHashStr.push(t);let{contentTopic:r}=e,n=this.subscriptionCallbacks.get(r);if(!n){lL.error("No subscription callback available for ",r);return}lL.info("Processing message with content topic ",r," on pubsub topic ",this.pubsubTopic),await lM(n,this.pubsubTopic,e)}handleErrors(e,t){let r=e.filter(e=>"rejected"===e.status).map(e=>e.reason);if(r.length===this.peers.length){let e=new Map;r.forEach(t=>{let r=t instanceof Error?t.message:String(t);e.set(r,(e.get(r)||0)+1)});let n=Array.from(e,([e,t])=>`${e} (occurred ${t} times)`).join(", ");throw Error(`Error ${t} all peers: ${n}`)}r.length>0?lL.warn(`Some ${t} failed. These will be refreshed with new peers`,r):lL.info(`${t} successful for all peers`)}}class lO extends lN{protocol;activeSubscriptions=new Map;async handleIncomingMessage(e,t){let r=this.getActiveSubscription(e);if(!r){lL.error(`No subscription locally registered for topic ${e}`);return}await r.processIncomingMessage(t)}constructor(e,t){super({numPeersToUse:t?.numPeersToUse}),this.protocol=new tT(this.handleIncomingMessage.bind(this),e,t),this.activeSubscriptions=new Map}getActiveSubscription(e){return this.activeSubscriptions.get(e)}setActiveSubscription(e,t){return this.activeSubscriptions.set(e,t),t}async createSubscription(e){let t="string"==typeof e?e:ts.yf(e)?.[0];(0,ts.Qu)(t,this.protocol.pubsubTopics);let r=await this.protocol.getPeers();if(0===r.length)throw Error("No peer found to initiate subscription.");return lL.info(`Creating filter subscription with ${r.length} peers: `,r.map(e=>e.id.toString())),this.getActiveSubscription(t)??this.setActiveSubscription(t,new lx(t,r,this.protocol))}async subscribe(e,t){let r=this.getPubsubTopics(e);if(0===r.length)throw Error("Failed to subscribe: no pubsubTopic found on decoders provided.");if(r.length>1)throw Error("Failed to subscribe: all decoders should have the same pubsub topic. Use createSubscription to be more agile.");let n=await this.createSubscription(r[0]);await n.subscribe(e,t);let i=Array.from((0,ts.p3)(Array.isArray(e)?e:[e]).keys());return async()=>{await n.unsubscribe(i)}}toSubscriptionIterator(e){return(0,ts.B2)(this,e)}getPubsubTopics(e){return Array.isArray(e)?0===e.length?[]:[...new Set(e.map(e=>e.pubsubTopic))]:[e.pubsubTopic]}}async function lM(e,t,r){let{decoders:n,callback:i}=e,{contentTopic:s}=r;if(!s){lL.warn("Message has no content topic, skipping");return}try{let e=n.map(e=>e.fromProtoObj(t,r).then(e=>e||Promise.reject("Decoding failed"))),s=await Promise.any(e);await i(s)}catch(e){lL.error("Error decoding message",e)}}let lU=new ts.Yd("sdk:light-push");class lF extends lN{protocol;constructor(e,t){super({numPeersToUse:t?.numPeersToUse}),this.protocol=new tD(e,t)}async send(e,t){let r=[],n=[],{pubsubTopic:i}=e;try{(0,ts.Qu)(i,this.protocol.pubsubTopics)}catch(e){return lU.error("Failed to send waku light push: pubsub topic not configured"),{failures:[{error:tC.K1.TOPIC_NOT_CONFIGURED}],successes:[]}}let s=await this.protocol.getPeers();if(!s.length)return{successes:r,failures:[{error:tC.K1.NO_PEER_AVAILABLE}]};let o=s.map(r=>this.protocol.send(e,t,r));for(let e of(await Promise.allSettled(o)))if("fulfilled"===e.status){let{failure:t,success:i}=e.value;i&&r.push(i),t&&n.push(t)}else lU.error("Failed to send message to peer",e.reason),n.push({error:tC.K1.GENERIC_FAIL});return{successes:r,failures:n}}}let lK=new ts.Yd("waku:store:protocol");class lV extends lN{protocol;constructor(e,t){super({numPeersToUse:1}),this.protocol=new tM(e,t)}async *queryGenerator(e,t){let{pubsubTopic:r,contentTopics:n,decodersAsMap:i}=this.validateDecodersAndPubsubTopic(e,t),s=this.constructOptions(r,n,t),o=(await this.protocol.getPeers({numPeers:this.numPeers,maxBootstrapPeers:1}))[0];if(!o)throw Error("No peers available to query");for await(let e of this.protocol.queryPerPage(s,i,o))yield e}async queryWithOrderedCallback(e,t,r){for await(let n of this.queryGenerator(e,r))if(await this.processMessages(n,t,r))break}async queryWithPromiseCallback(e,t,r){let n=!1;for await(let i of this.queryGenerator(e,r)){let e=i.map(async e=>{n||(n=!!await t(e))});if(await Promise.all(e),n)break}}createCursor(e){if(!e||!e.timestamp||!e.payload||!e.contentTopic)throw Error("Message is missing required fields");let t=(0,tJ.iY)(e.contentTopic),r=(0,rj.J)((0,tJ.zo)([t,e.payload])),n=BigInt(e.timestamp.getTime())*BigInt(1e6);return{digest:r,pubsubTopic:e.pubsubTopic,senderTime:n,receiverTime:n}}validateDecodersAndPubsubTopic(e,t){if(0===e.length)throw Error("No decoders provided");let r=Array.from(new Set(e.map(e=>e.pubsubTopic)));if(r.length>1)throw Error("API does not support querying multiple pubsub topics at once");let n=r[0];if((0,ts.Qu)(n,this.protocol.pubsubTopics),t?.cursor?.pubsubTopic&&t.cursor.pubsubTopic!==n)throw Error(`Cursor pubsub topic (${t?.cursor?.pubsubTopic}) does not match decoder pubsub topic (${n})`);let i=new Map;e.forEach(e=>{if(i.has(e.contentTopic))throw Error("API does not support different decoder per content topic");i.set(e.contentTopic,e)});let s=e.filter(e=>e.pubsubTopic===n).map(e=>e.contentTopic);if(0===s.length)throw Error("No decoders found for topic "+n);return{pubsubTopic:n,contentTopics:s,decodersAsMap:i}}constructOptions(e,t,r={}){let n,i;return r?.timeFilter&&(n=r.timeFilter.startTime,i=r.timeFilter.endTime),n||lK.warn("No start time provided"),i||lK.warn("No end time provided"),Object.assign({pubsubTopic:e,pageDirection:tC.$Q.BACKWARD,pageSize:10},r,{contentTopics:t,startTime:n,endTime:i})}async processMessages(e,t,r){let n=!1,i=(await Promise.all(e)).filter(ts.$K);return this.shouldReverseOrder(r)&&(i=i.reverse()),await Promise.all(i.map(async e=>{e&&!n&&(n=!!await t(e))})),n}shouldReverseOrder(e){return void 0===e?.pageDirection||e?.pageDirection===tC.$Q.BACKWARD}}async function lH(e={}){let t=await lQ(e),r=function(e={}){return t=>new lV(t,e)}(e),n=function(e={}){return t=>new lF(t,e)}(e);return new lj(e,t,r,n,t=>new lO(t,e))}async function l$(e,t,r){if(!e.filter)throw Error("Filter protocol missing from Waku node");let{shardInfo:n}=e.libp2p.components.metadata;if(!n)throw Error("Shard info missing from Waku node.");let i=(0,ts.yf)(n),s=(0,ts.L3)(t);if(!i.includes(s))throw Error("Content topic does not match any pubsub topic in shard info.");await e.dial(r),await tz(e,[tC.Uw.Filter]);let o=td(t,s);return o&&(o=o??o),{decoder:o,subscription:await e.filter.createSubscription(s)}}async function lq(e,t,r){r.waku=r.waku??await lH({shardInfo:{contentTopics:[e]}});let{decoder:n,subscription:i}=await l$(r.waku,e,r.peer);return await i.subscribe(n,t),{subscription:i,waku:r.waku}}let lz=new ts.Yd("waku");class lj{libp2p;relay;store;filter;lightPush;connectionManager;pubsubTopics;constructor(e,t,r,n,i,s){if(0==e.pubsubTopics.length)throw Error("At least one pubsub topic must be provided");this.pubsubTopics=e.pubsubTopics,this.libp2p=t,r&&(this.store=r(t)),i&&(this.filter=i(t)),n&&(this.lightPush=n(t)),s&&(this.relay=s(t));let o=e.pingKeepAlive||300,a=this.relay?e.relayKeepAlive||300:0,l=this.libp2p.peerId.toString();this.connectionManager=t1.create(l,t,{pingKeepAlive:o,relayKeepAlive:a},this.pubsubTopics,this.relay),lz.info("Waku node created",l,`relay: ${!!this.relay}, store: ${!!this.store}, light push: ${!!this.lightPush}, filter: ${!!this.filter}`)}async dial(e,t){let r=t??[],n=(0,ar.I)(e)?e:(0,n0.HM)(e);void 0===t&&(this.relay&&r.push(tC.Uw.Relay),this.store&&r.push(tC.Uw.Store),this.filter&&r.push(tC.Uw.Filter),this.lightPush&&r.push(tC.Uw.LightPush));let i=[];return r.includes(tC.Uw.Relay)&&(this.relay?this.relay.gossipSub.multicodecs.forEach(e=>i.push(e)):lz.error("Relay codec not included in dial codec: protocol not mounted locally")),r.includes(tC.Uw.Store)&&(this.store?i.push(this.store.protocol.multicodec):lz.error("Store codec not included in dial codec: protocol not mounted locally")),r.includes(tC.Uw.LightPush)&&(this.lightPush?i.push(this.lightPush.protocol.multicodec):lz.error("Light Push codec not included in dial codec: protocol not mounted locally")),r.includes(tC.Uw.Filter)&&(this.filter?i.push(this.filter.protocol.multicodec):lz.error("Filter codec not included in dial codec: protocol not mounted locally")),lz.info(`Dialing to ${n.toString()} with protocols ${r}`),this.libp2p.dialProtocol(n,i)}async start(){await this.libp2p.start()}async stop(){this.connectionManager.stop(),await this.libp2p.stop()}async subscribeToContentTopic(e,t,r){return(await lq(e,r,{waku:this,peer:t})).subscription}isStarted(){return"started"==this.libp2p.status}isConnected(){return this.connectionManager.isConnected()}getLocalMultiaddrWithID(){let e=this.libp2p.getMultiaddrs().find(e=>e.toString().match(/127\.0\.0\.1/));if(!e||""===e.toString())throw"Not listening on localhost";return e+"/p2p/"+this.libp2p.peerId.toString()}}var lG=r(18976);let lW={lightPush:1,filter:1,store:1};async function lY(e,t,r,n){r?.hideWebSocketInfo||(console.info("%cIgnore WebSocket connection failures","background: gray; color: white; font-size: x-large"),console.info("%cWaku tries to discover peers and some of them are expected to fail","background: gray; color: white; font-size: x-large"));let i=e?{metadata:t=>new t4(e,t)}:{};return lk({connectionManager:{minConnections:1},transports:[function(e={}){return t=>new s2(t,e)}({filter:s1})],streamMuxers:[function(e={}){return t=>new sx(t,e)}()],connectionEncryption:[function(e={}){return t=>new nX(t,e)}()],...r,services:{identify:function(e={}){return t=>new sf(t,e)}({agentVersion:n??"js-waku"}),ping:function(e={}){return t=>new sF(t,e)}(),...i,...t?{pubsub:t}:{},...r?.services}})}async function lQ(e){var t,r;let n=e.shardInfo?(0,ts.Ao)(e.shardInfo):void 0;e.pubsubTopics=n?.pubsubTopics??e.pubsubTopics??[tC.nf];let i=e?.libp2p??{},s=i.peerDiscovery??[];return e?.defaultBootstrap&&s.push(...(t=e.pubsubTopics,[(0,lG.Lk)([lG.Qy.SANDBOX],lW),(0,lG.C0)(),(0,lG.PZ)(t)])),e?.bootstrapPeers&&s.push((r={list:e.bootstrapPeers},e=>new i_(e,r))),i.peerDiscovery=s,await lY(n?.shardInfo,function(e={}){return t=>{let r=new oC(t,e={...e,msgIdFn:({data:e})=>(0,rj.J)(e),globalSignaturePolicy:eF.StrictNoSign,fallbackToFloodsub:!1});return r.multicodecs=oR,r}}(e),i,e?.userAgent)}},48215:function(e,t,r){"use strict";r.d(t,{Md:function(){return a},ci:function(){return o},iY:function(){return l},nr:function(){return s},zo:function(){return c}});var n=r(60565),i=r(12528);function s(e){if("string"==typeof e){let t=e.replace(/^0x/i,"");return(0,n.m)(t.toLowerCase(),"base16")}return e}let o=e=>(0,i.B)(e,"base16"),a=e=>(0,i.B)(e,"utf8"),l=e=>(0,n.m)(e,"utf8");function c(e,t){let r=new Uint8Array(t??e.reduce((e,t)=>e+t.length,0)),n=0;for(let t of e)r.set(t,n),n+=t.length;return r}},98676:function(e,t,r){"use strict";r.d(t,{I:function(){return n},k:function(){return i}});let n=e=>{if((e=new Uint8Array(e)).length<3)throw Error("Insufficient data");let t=new DataView(e.buffer),r=t.getUint16(0),n=[];if(130===e.length)for(let e=0;e<1024;e++){let r=Math.floor(e/8)+2,i=7-e%8;t.getUint8(r)&1<=e.length)throw Error("Unexpected end of data");n.push(t.getUint16(s))}}return{clusterId:r,shards:n}},i=e=>{let{clusterId:t,shards:r}=e,n=new ArrayBuffer(r.length>=64?130:3+2*r.length),i=new DataView(n);if(i.setUint16(0,t),r.length>=64)for(let e of r){let t=Math.floor(e/8)+2,r=7-e%8;i.setUint8(t,i.getUint8(t)|1<{let r=t.get(e.contentTopic);r||(t.set(e.contentTopic,[]),r=t.get(e.contentTopic)),r.push(e)}),t}async function s(e,t,r){let n;let i=r?.iteratorDelay??60,s=[];n=await e.subscribe(t,e=>{s.push(e)});let o=Number.isInteger(r?.timeoutMs),a=r?.timeoutMs??0,l=Date.now();return{iterator:async function*(){for(;;){if(o&&Date.now()-l>=a)return;await function(e){return new Promise(t=>{setTimeout(t,e)})}(i);let e=s.shift();if(!n&&0===s.length)return e;(e||!n)&&(yield e)}}(),async stop(){n&&(await n(),n=void 0)}}}async function o(e,t){let r=await e.toWire(t);return!!r&&a(r)}r.d(t,{Yd:function(){return I},L3:function(){return m},Ix:function(){return w.I},IY:function(){return y},kL:function(){return w.k},Qu:function(){return f},Ao:function(){return b},Yl:function(){return E},p3:function(){return i},$K:function(){return n},eh:function(){return o},qc:function(){return a},Tf:function(){return p},IC:function(){return v},yf:function(){return d},B2:function(){return s}});let a=e=>e.length/1048576<=1;var l=r(65530),c=r(75354),u=r(48215);let h=e=>{if(void 0===e.shard)throw Error("Invalid shard");return`/waku/2/rs/${e.clusterId??c.eZ}/${e.shard}`},d=e=>{if("contentTopics"in e&&e.contentTopics)return Array.from(new Set(e.contentTopics.map(t=>m(t,e.clusterId))));if("shards"in e){if(void 0===e.shards)throw Error("Invalid shard");return Array.from(new Set(e.shards.map(t=>`/waku/2/rs/${e.clusterId??c.eZ}/${t}`)))}if("application"in e&&"version"in e)return[m(`/${e.application}/${e.version}/default/default`,e.clusterId)];throw Error("Missing required configuration in shard parameters")},p=e=>{let t=e.split("/");if(6!=t.length||"waku"!==t[1]||"2"!==t[2]||"rs"!==t[3])throw Error("Invalid pubsub topic");let r=parseInt(t[4]),n=parseInt(t[5]);if(isNaN(r)||isNaN(n))throw Error("Invalid clusterId or shard");return{clusterId:r,shard:n}};function f(e,t){if(!t.includes(e))throw Error(`Pubsub topic ${e} has not been configured on this instance. Configured topics are: ${t}. Please update your configuration by passing in the topic during Waku node instantiation.`)}function g(e,t=8){let{application:r,version:n}=function(e){let t=e.split("/");if(t.length<5||t.length>6)throw Error("Content topic format is invalid");let r=0;if(6==t.length){if(isNaN(r=parseInt(t[1])))throw Error("Invalid generation field in content topic");if(r>0)throw Error("Generation greater than 0 is not supported")}let n=t.splice(-4);if(0==n[0].length)throw Error("Application field cannot be empty");if(0==n[1].length)throw Error("Version field cannot be empty");if(0==n[2].length)throw Error("Topic name field cannot be empty");if(0==n[3].length)throw Error("Encoding field cannot be empty");return{generation:r,application:n[0],version:n[1],topicName:n[2],encoding:n[3]}}(e);return Number(new DataView((0,l.J)((0,u.zo)([(0,u.iY)(r),(0,u.iY)(n)])).buffer.slice(-8)).getBigUint64(0,!1)%BigInt(t))}function m(e,t=c.eZ,r=8){if(!e)throw Error("Content topic must be specified");let n=g(e,r);return`/waku/2/rs/${t}/${n}`}function y(e,t){return"string"==typeof t?t:t?.shard!==void 0?h(t):m(e,t?.clusterId??c.eZ)}let b=e=>{let t=e.clusterId??c.eZ,r="shards"in e?e.shards:[],n="contentTopics"in e?e.contentTopics:[],[i,s]="application"in e&&"version"in e?[e.application,e.version]:[void 0,void 0],o=r&&r.length>0,a=n&&n.length>0,l=i&&s;if(o)return{shardingParams:{clusterId:t,shards:r},shardInfo:{clusterId:t,shards:r},pubsubTopics:d({clusterId:t,shards:r})};if(a){let e=Array.from(new Set(n.map(e=>m(e,t)))),r=Array.from(new Set(n.map(e=>g(e))));return{shardingParams:{clusterId:t,contentTopics:n},shardInfo:{clusterId:t,shards:r},pubsubTopics:e}}if(l){let e=m(`/${i}/${s}/default/default`,t);return{shardingParams:{clusterId:t,application:i,version:s},shardInfo:{clusterId:t,shards:[p(e).shard]},pubsubTopics:[e]}}throw Error("Missing minimum required configuration options for static sharding or autosharding.")};function v(e,t,r){let n=e.get(t);void 0===n&&(e.set(t,new Set),n=e.get(t)),n.add(r)}var w=r(98676);function E(e){let t=e.find(e=>e.toString().includes("ws")||e.toString().includes("wss"));if(!t)throw Error("No ws multiaddr found in the given addresses");return t}var S=r(55022);let A="waku";class I{_info;_warn;_error;static createDebugNamespace(e,t){return t?`${A}:${e}:${t}`:`${A}:${e}`}constructor(e){this._info=S(I.createDebugNamespace("info",e)),this._warn=S(I.createDebugNamespace("warn",e)),this._error=S(I.createDebugNamespace("error",e))}get info(){return this._info}get warn(){return this._warn}get error(){return this._error}log(e,...t){(0,this[e])(...t)}}},85419:function(e,t,r){"use strict";r.d(t,{RB:function(){return o},_4:function(){return a},s_:function(){return l},tf:function(){return s}});var n=r(48215),i=r(98676);async function s(e,t){return 0===t.length?[]:(await Promise.all(t.map(async t=>{try{let r=(await e.get(t.id)).metadata.get("ping");if(!r)return{peer:t,ping:1/0};let i=Number((0,n.Md)(r));return{peer:t,ping:i}}catch(e){return{peer:t,ping:1/0}}}))).filter(e=>null!==e).sort((e,t)=>e.ping-t.ping).map(e=>e.peer)}async function o(e,t){let r=[];return await e.forEach(e=>{for(let n=0;n"open"===e.status).map(async e=>{let s=await t.get(e.remotePeer);if(r.some(e=>s.protocols.includes(e))){if(!n)return s;{let e=s.metadata.get("shardInfo"),t=e&&(0,i.I)(e);if(t&&n.clusterId===t.clusterId)return s}}return null});return(await Promise.all(s)).filter(e=>null!==e)}function l(e){let t;if(e.length)return 1===e.length?e[0]:(e.forEach(e=>{"open"===e.status&&(t?e.timeline.open>t.timeline.open&&(t=e):t=e)}),t)}},83431:function(e,t){"use strict";t.Z=function(e){if(null!=e[Symbol.asyncIterator])return(async()=>{let t=[];for await(let r of e)t.push(r);return t})();let t=[];for(let r of e)t.push(r);return t}},21679:function(e,t,r){"use strict";r.d(t,{J:function(){return p},c:function(){return u}});var n,i,s=r(17954),o=r(54164),a=r(1514);function l(e){return null!=e[Symbol.asyncIterator]}let c=e=>{let t=s.P$(e),r=(0,a.E)(t);return s.cv(e,r),c.bytes=t,r};function u(e,t){let r=(t=t??{}).lengthEncoder??c;function*n(e){let t=r(e.byteLength);t instanceof Uint8Array?yield t:yield*t,e instanceof Uint8Array?yield e:yield*e}return l(e)?async function*(){for await(let t of e)yield*n(t)}():function*(){for(let t of e)yield*n(t)}()}c.bytes=0,u.single=(e,t)=>{let r=(t=t??{}).lengthEncoder??c;return new o.H(r(e.byteLength),e)};var h=r(15862);(n=i||(i={}))[n.LENGTH=0]="LENGTH",n[n.DATA=1]="DATA";let d=e=>{let t=s.Jx(e);return d.bytes=s.P$(t),t};function p(e,t){let r=new o.H,n=i.LENGTH,s=-1,a=t?.lengthDecoder??d,c=t?.maxLengthLength??8,u=t?.maxDataLength??4194304;function*p(){for(;r.byteLength>0;){if(n===i.LENGTH)try{if((s=a(r))<0)throw h(Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(s>u)throw h(Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let e=a.bytes;r.consume(e),t?.onLength!=null&&t.onLength(s),n=i.DATA}catch(e){if(e instanceof RangeError){if(r.byteLength>c)throw h(Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw e}if(n===i.DATA){if(r.byteLength0)throw h(Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let t of e)r.append(t),yield*p();if(r.byteLength>0)throw h(Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}d.bytes=0,p.fromReader=(e,t)=>{let r=1;return p(async function*(){for(;;)try{let{done:t,value:n}=await e.next(r);if(!0===t)return;null!=n&&(yield n)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}(),{...t??{},onLength:e=>{r=e}})}},10637:function(e,t,r){"use strict";var n=r(35605);t.Z=function(...e){let t=[];for(let r of e)null!=r[Symbol.asyncIterator]||t.push(r);return t.length===e.length?function*(){for(let e of t)yield*e}():async function*(){let t=(0,n.dT)({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(e.map(async e=>{for await(let r of e)t.push(r)})),t.end()}catch(e){t.end(e)}}),yield*t}()}},37804:function(e,t,r){"use strict";r.d(t,{z:function(){return s}});var n=r(35605),i=r(10637);function s(e,...t){if(null==e)throw Error("Empty pipeline");if(c(e)){let t=e;e=()=>t.source}else if(l(e)||a(e)){let t=e;e=()=>t}let r=[e,...t];if(r.length>1&&c(r[r.length-1])&&(r[r.length-1]=r[r.length-1].sink),r.length>2)for(let e=1;e{let t;for(;e.length>0;)t=e.shift()(t);return t},a=e=>e?.[Symbol.asyncIterator]!=null,l=e=>e?.[Symbol.iterator]!=null,c=e=>null!=e&&null!=e.sink&&null!=e.source,u=e=>t=>{let r=e.sink(t);if(r?.then!=null){let t;let s=(0,n.dT)({objectMode:!0});r.then(()=>{s.end()},e=>{s.end(e)});let o=e.source;if(a(o))t=async function*(){yield*o,s.end()};else if(l(o))t=function*(){yield*o,s.end()};else throw Error("Unknown duplex source type - must be Iterable or AsyncIterable");return(0,i.Z)(s,t())}return e.source}},35605:function(e,t,r){"use strict";r.d(t,{dT:function(){return a}});var n=r(60117);class i{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||(e-1&e)!=0)throw Error("Max size for a FixedFIFO should be a power of two");this.buffer=Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return void 0===this.buffer[this.btm]}}class s{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new i(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let t=this.head;this.head=t.next=new i(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(void 0===e&&null!=this.tail.next){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}}class o extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}}function a(e={}){return function(e,t){let r,i,a;let l=(t=t??{}).onEnd,c=new s,u=(0,n.Z)(),h=e=>null!=i?i(e):(c.push(e),r),d=e=>(c=new s,null!=i)?i({error:e}):(c.push({error:e}),r),p=e=>{if(a)return r;if(t?.objectMode!==!0&&e?.byteLength==null)throw Error("objectMode was not true but tried to push non-Uint8Array value");return h({done:!1,value:e})},f=e=>a?r:(a=!0,null!=e?d(e):h({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:async()=>{try{if(!c.isEmpty())return e(c);if(a)return{done:!0};return await new Promise((t,n)=>{i=s=>{i=null,c.push(s);try{t(e(c))}catch(e){n(e)}return r}})}finally{c.isEmpty()&&queueMicrotask(()=>{u.resolve(),u=(0,n.Z)()})}},return:()=>(c=new s,f(),{done:!0}),throw:e=>(f(e),{done:!0}),push:p,end:f,get readableLength(){return c.size},onEmpty:async e=>{let t,r;let n=e?.signal;if(n?.throwIfAborted(),!c.isEmpty()){null!=n&&(t=new Promise((e,t)=>{r=()=>{t(new o)},n.addEventListener("abort",r)}));try{await Promise.race([u.promise,t])}finally{null!=r&&null!=n&&n?.removeEventListener("abort",r)}}}},null==l)return r;let g=r;return r={[Symbol.asyncIterator](){return this},next:()=>g.next(),throw:e=>(g.throw(e),null!=l&&(l(e),l=void 0),{done:!0}),return:()=>(g.return(),null!=l&&(l(),l=void 0),{done:!0}),push:p,end:e=>(g.end(e),null!=l&&(l(e),l=void 0),r),get readableLength(){return g.readableLength},onEmpty:e=>g.onEmpty(e)}}(e=>{let t=e.shift();if(null==t)return{done:!0};if(null!=t.error)throw t.error;return{done:!0===t.done,value:t.value}},e)}},6240:function(e,t,r){"use strict";r.d(t,{kU:function(){return h},Dp:function(){return u},ET:function(){return d}});var n=r(21786),i=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=s-1;(0!==u||h>>0,o[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var p=s-i;p!==s&&0===o[p];)p++;for(var f=new Uint8Array(n+(s-p)),g=n;p!==s;)f[g++]=o[p++];return f}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,s=t.length;i!==s&&0===t[i];)i++,r++;for(var o=(s-i)*u+1>>>0,c=new Uint8Array(o);i!==s;){for(var h=t[i],d=0,p=o-1;(0!==h||d>>0,c[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw Error("Non-zero carry");n=d,i++}for(var f=o-n;f!==o&&0===c[f];)f++;for(var g=l.repeat(r);f(0,n.oQ)(o(e))})}function d({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return u({prefix:t,name:e,encode:e=>(function(e,t,r){let n="="===t[t.length-1],i=(1<r;)o-=r,s+=t[i&a>>o];if(0!==o&&(s+=t[i&a<(function(e,t,r,n){let i={};for(let e=0;e=8&&(a-=8,o[c++]=255&l>>a)}if(a>=r||(255&l<<8-a)!=0)throw SyntaxError("Unexpected end of data");return o})(t,n,r,e)})}},60522:function(e,t,r){"use strict";r.r(t),r.d(t,{base32:function(){return i},base32hex:function(){return l},base32hexpad:function(){return u},base32hexpadupper:function(){return h},base32hexupper:function(){return c},base32pad:function(){return o},base32padupper:function(){return a},base32upper:function(){return s},base32z:function(){return d}});var n=r(6240);let i=(0,n.ET)({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),s=(0,n.ET)({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),o=(0,n.ET)({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),a=(0,n.ET)({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),l=(0,n.ET)({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),c=(0,n.ET)({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),u=(0,n.ET)({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),h=(0,n.ET)({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),d=(0,n.ET)({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})},75360:function(e,t,r){"use strict";r.r(t),r.d(t,{base58btc:function(){return i},base58flickr:function(){return s}});var n=r(6240);let i=(0,n.kU)({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),s=(0,n.kU)({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})},84018:function(e,t,r){"use strict";r.r(t),r.d(t,{base64:function(){return i},base64pad:function(){return s},base64url:function(){return o},base64urlpad:function(){return a}});var n=r(6240);let i=(0,n.ET)({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),s=(0,n.ET)({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),o=(0,n.ET)({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),a=(0,n.ET)({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})},74006:function(e,t,r){"use strict";r.d(t,{gh:function(){return V}});var n={};r.r(n),r.d(n,{base10:function(){return p}});var i={};r.r(i),r.d(i,{base16:function(){return f},base16upper:function(){return g}});var s={};r.r(s),r.d(s,{base2:function(){return m}});var o={};r.r(o),r.d(o,{base256emoji:function(){return w}});var a={};r.r(a),r.d(a,{base36:function(){return S},base36upper:function(){return A}});var l={};r.r(l),r.d(l,{base8:function(){return T}});var c={};r.r(c),r.d(c,{identity:function(){return R}});var u={};r.r(u),r.d(u,{code:function(){return B},decode:function(){return L},encode:function(){return N},name:function(){return D}});var h={};r.r(h),r.d(h,{code:function(){return O},decode:function(){return U},encode:function(){return M},name:function(){return x}});var d=r(6240);let p=(0,d.kU)({prefix:"9",name:"base10",alphabet:"0123456789"}),f=(0,d.ET)({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),g=(0,d.ET)({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),m=(0,d.ET)({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),y=Array.from("\uD83D\uDE80\uD83E\uDE90☄\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09☀\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02❤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09☺\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9E✌✨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2D❣\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33✋\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13⭐✅\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6✔\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90☹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20☝\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2B⚽\uD83E\uDD19☕\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81⚡\uD83C\uDF1E\uD83C\uDF88❌✊\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2C✈\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74▶➡❓\uD83D\uDC8E\uD83D\uDCB8⬇\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7A⚠\uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37☎\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51❄\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),b=y.reduce((e,t,r)=>(e[r]=t,e),[]),v=y.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]),w=(0,d.Dp)({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+=b[t],"")},decode:function(e){let t=[];for(let r of e){let e=v[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}});var E=r(60522);let S=(0,d.kU)({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),A=(0,d.kU)({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var I=r(75360),_=r(84018);let T=(0,d.ET)({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var C=r(21786);let R=(0,d.Dp)({prefix:"\0",name:"identity",encode:e=>(0,C.BB)(e),decode:e=>(0,C.mL)(e)}),k=new TextEncoder,P=new TextDecoder,D="json",B=512;function N(e){return k.encode(JSON.stringify(e))}function L(e){return JSON.parse(P.decode(e))}let x="raw",O=85;function M(e){return(0,C.oQ)(e)}function U(e){return(0,C.oQ)(e)}var F=r(60575),K=r(30024);r(45193),r(2780),r(40291),r(83695);let V={...c,...s,...l,...n,...i,...E,...a,...I,..._,...o};({...K,...F})},21786:function(e,t,r){"use strict";function n(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r{let[r,n]=a.Jx(e.subarray(t));return t+=n,r},n=r(),i=d;if(18===n?(n=0,t=0):i=r(),0!==n&&1!==n)throw RangeError(`Invalid CID version ${n}`);let s=t,o=r(),l=r(),c=t+l;return{version:n,codec:i,multihashCode:o,digestSize:l,multihashSize:c-s,size:c}}static parse(e,t){let[r,s]=function(e,t){switch(e[0]){case"Q":{let r=t??i.base58btc;return[i.base58btc.prefix,r.decode(`${i.base58btc.prefix}${e}`)]}case i.base58btc.prefix:{let r=t??i.base58btc;return[i.base58btc.prefix,r.decode(e)]}case n.base32.prefix:{let r=t??n.base32;return[n.base32.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}(e,t),o=h.decode(s);if(0===o.version&&"Q"!==e[0])throw Error("Version 0 CID string must not include multibase prefix");return u(o).set(r,e),o}}let d=112,p=18;function f(e,t,r){let n=a.P$(e),i=n+a.P$(t),s=new Uint8Array(i+r.byteLength);return a.mL(e,s,0),a.mL(t,s,n),s.set(r,i),s}let g=Symbol.for("@ipld/js-cid/CID")},2780:function(e,t,r){"use strict";r.d(t,{Jx:function(){return o},Ue:function(){return s},fS:function(){return a},zZ:function(){return l}});var n=r(21786),i=r(83695);function s(e,t){let r=t.byteLength,n=i.P$(e),s=n+i.P$(r),o=new Uint8Array(s+r);return i.mL(e,o,0),i.mL(r,o,n),o.set(t,s),new l(e,r,t,o)}function o(e){let t=(0,n.oQ)(e),[r,s]=i.Jx(t),[o,a]=i.Jx(t.subarray(s)),c=t.subarray(s+a);if(c.byteLength!==o)throw Error("Incorrect length");return new l(r,o,c,t)}function a(e,t){return e===t||e.code===t.code&&e.size===t.size&&t.bytes instanceof Uint8Array&&(0,n.fS)(e.bytes,t.bytes)}class l{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}},40291:function(e,t,r){"use strict";r.d(t,{D:function(){return i}});var n=r(2780);function i({name:e,code:t,encode:r}){return new s(e,t,r)}class s{name;code;encode;constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?n.Ue(this.code,t):t.then(e=>n.Ue(this.code,e))}throw Error("Unknown type, must be binary type")}}},60575:function(e,t,r){"use strict";r.r(t),r.d(t,{identity:function(){return o}});var n=r(21786),i=r(2780);let s=n.oQ,o={code:0,name:"identity",encode:s,digest:function(e){return i.Ue(0,s(e))}}},30024:function(e,t,r){"use strict";r.r(t),r.d(t,{sha256:function(){return s},sha512:function(){return o}});var n=r(40291);function i(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}let s=(0,n.D)({name:"sha2-256",code:18,encode:i("SHA-256")}),o=(0,n.D)({name:"sha2-512",code:19,encode:i("SHA-512")})},83695:function(e,t,r){"use strict";r.d(t,{Jx:function(){return s},mL:function(){return o},P$:function(){return a}});var n=function e(t,r,n){r=r||[];for(var i=n=n||0;t>=2147483648;)r[n++]=255&t|128,t/=128;for(;-128&t;)r[n++]=255&t|128,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},i=function e(t,r){var n,i=0,r=r||0,s=0,o=r,a=t.length;do{if(o>=a)throw e.bytes=0,RangeError("Could not decode varint");n=t[o++],i+=s<28?(127&n)<=128);return e.bytes=o-r,i};function s(e,t=0){return[i(e,t),i.bytes]}function o(e,t,r=0){return n(e,t,r),t}function a(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:e<34359738368?5:e<4398046511104?6:e<562949953421312?7:e<72057594037927940?8:e<0x7fffffffffffffff?9:10}},60117:function(e,t,r){"use strict";function n(){let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e}r.d(t,{Z:function(){return n}})},47971:function(e,t,r){"use strict";r.d(t,{sv:function(){return V},C6:function(){return E},LE:function(){return M},Ji:function(){return F},yw:function(){return K}});var n,i,s=r(17954);let o=new Float32Array([-0]),a=new Uint8Array(o.buffer);function l(e,t,r){o[0]=e,t[r]=a[0],t[r+1]=a[1],t[r+2]=a[2],t[r+3]=a[3]}let c=new Float64Array([-0]),u=new Uint8Array(c.buffer);function h(e,t,r){c[0]=e,t[r]=u[0],t[r+1]=u[1],t[r+2]=u[2],t[r+3]=u[3],t[r+4]=u[4],t[r+5]=u[5],t[r+6]=u[6],t[r+7]=u[7]}let d=BigInt(Number.MAX_SAFE_INTEGER),p=BigInt(Number.MIN_SAFE_INTEGER);class f{lo;hi;constructor(e,t){this.lo=0|e,this.hi=0|t}toNumber(e=!1){if(!e&&this.hi>>>31>0){let e=~this.lo+1>>>0,t=~this.hi>>>0;return 0===e&&(t=t+1>>>0),-(e+4294967296*t)}return this.lo+4294967296*this.hi}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31!=0){let e=~this.lo+1>>>0,t=~this.hi>>>0;return 0===e&&(t=t+1>>>0),-(BigInt(e)+(BigInt(t)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}static fromBigInt(e){if(0n===e)return g;if(ep)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let r=e>>32n,n=e-(r<<32n);return t&&(r=0n|~r,n=0n|~n,++n>m&&(n=0n,++r>m&&(r=0n))),new f(Number(n),Number(r))}static fromNumber(e){if(0===e)return g;let t=e<0;t&&(e=-e);let r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new f(r,n)}static from(e){return"number"==typeof e?f.fromNumber(e):"bigint"==typeof e?f.fromBigInt(e):"string"==typeof e?f.fromBigInt(BigInt(e)):null!=e.low||null!=e.high?new f(e.low>>>0,e.high>>>0):g}}let g=new f(0,0);g.toBigInt=function(){return 0n},g.zzEncode=g.zzDecode=function(){return this},g.length=function(){return 1};let m=4294967296n;function y(e,t,r){let n,i;let s=r;for(let s=0;s>6|192:((64512&n)==55296&&(64512&(i=e.charCodeAt(s+1)))==56320?(n=65536+((1023&n)<<10)+(1023&i),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128):t[r++]=n>>12|224,t[r++]=n>>6&63|128),t[r++]=63&n|128);return r-s}function b(e,t){return RangeError(`index out of range: ${e.pos} + ${t??1} > ${e.len}`)}function v(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}class w{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,b(this,10);return e}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)|0}bool(){return 0!==this.uint32()}fixed32(){if(this.pos+4>this.len)throw b(this,4);return v(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw b(this,4);return 0|v(this.buf,this.pos+=4)}float(){var e,t;if(this.pos+4>this.len)throw b(this,4);let r=(e=this.buf,t=this.pos,a[0]=e[t],a[1]=e[t+1],a[2]=e[t+2],a[3]=e[t+3],o[0]);return this.pos+=4,r}double(){var e,t;if(this.pos+8>this.len)throw b(this,4);let r=(e=this.buf,t=this.pos,u[0]=e[t],u[1]=e[t+1],u[2]=e[t+2],u[3]=e[t+3],u[4]=e[t+4],u[5]=e[t+5],u[6]=e[t+6],u[7]=e[t+7],c[0]);return this.pos+=8,r}bytes(){let e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw b(this,e);return this.pos+=e,t===r?new Uint8Array(0):this.buf.subarray(t,r)}string(){let e=this.bytes();return function(e,t,r){let n,i;if(r-t<1)return"";let s=[],o=0;for(;t191&&i<224?s[o++]=(31&i)<<6|63&e[t++]:i>239&&i<365?(i=((7&i)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(i>>10),s[o++]=56320+(1023&i)):s[o++]=(15&i)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((n??(n=[])).push(String.fromCharCode.apply(String,s)),o=0);return null!=n?(o>0&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))}(e,0,e.length)}skip(e){if("number"==typeof e){if(this.pos+e>this.len)throw b(this,e);this.pos+=e}else do if(this.pos>=this.len)throw b(this);while((128&this.buf[this.pos++])!=0);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new f(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw b(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw b(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw b(this,8);return new f(v(this.buf,this.pos+=4),v(this.buf,this.pos+=4))}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=(0,s.CJ)(this.buf,this.pos);return this.pos+=(0,s.P$)(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}}function E(e,t,r){let n=new w(e instanceof Uint8Array?e:e.subarray());return t.decode(n,void 0,r)}var S=r(1514),A=r(60565);class I{fn;len;next;val;constructor(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}}function _(){}class T{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}}let C=function(e){let t;let r=(void 0)??8192,n=r>>>1,i=r;return function(e){if(e<1||e>n)return(0,S.E)(e);i+e>r&&(t=(0,S.E)(r),i=0);let s=t.subarray(i,i+=e);return(7&i)!=0&&(i=(7|i)+1),s}}();class R{len;head;tail;states;constructor(){this.len=0,this.head=new I(_,0,0),this.tail=this.head,this.states=null}_push(e,t,r){return this.tail=this.tail.next=new I(e,t,r),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new D((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(B,10,f.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=f.fromBigInt(e);return this._push(B,t.length(),t)}uint64Number(e){return this._push(s.lN,(0,s.P$)(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let t=f.fromBigInt(e).zzEncode();return this._push(B,t.length(),t)}sint64Number(e){let t=f.fromNumber(e).zzEncode();return this._push(B,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(k,1,e?1:0)}fixed32(e){return this._push(N,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=f.fromBigInt(e);return this._push(N,4,t.lo)._push(N,4,t.hi)}fixed64Number(e){let t=f.fromNumber(e);return this._push(N,4,t.lo)._push(N,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(l,4,e)}double(e){return this._push(h,8,e)}bytes(e){let t=e.length>>>0;return 0===t?this._push(k,1,0):this.uint32(t)._push(L,t,e)}string(e){let t=function(e){let t=0,r=0;for(let n=0;n127;)t[r++]=127&e|128,e>>>=7;t[r]=e}class D extends I{next;constructor(e,t){super(P,e,t),this.next=void 0}}function B(e,t,r){for(;0!==e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function N(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function L(e,t,r){t.set(e,r)}function x(e,t,r){t.set(e,r)}function O(e,t,r){e.length<40?y(e,t,r):null!=t.utf8Write?t.utf8Write(e,r):t.set((0,A.m)(e),r)}function M(e,t){let r=new R;return t.encode(e,r,{lengthDelimited:!1}),r.finish()}function U(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}function F(e){function t(t){if(null==e[t.toString()])throw Error("Invalid enum value");return e[t]}return U("enum",i.VARINT,function(e,r){let n=t(e);r.int32(n)},function(e){return t(e.int32())})}function K(e,t){return U("message",i.LENGTH_DELIMITED,e,t)}null!=globalThis.Buffer&&(R.prototype.bytes=function(e){let t=e.length>>>0;return this.uint32(t),t>0&&this._push(x,t,e),this},R.prototype.string=function(e){let t=globalThis.Buffer.byteLength(e);return this.uint32(t),t>0&&this._push(O,t,e),this}),(n=i||(i={}))[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32";class V extends Error{code;constructor(e,t,r){super(e,r),this.code=t}}},17954:function(e,t,r){"use strict";r.d(t,{CJ:function(){return o},Jx:function(){return l},P$:function(){return i},cv:function(){return a},lN:function(){return s}});var n=r(1514);function i(e){if(e<128)return 1;if(e<16384)return 2;if(e<2097152)return 3;if(e<268435456)return 4;if(e<34359738368)return 5;if(e<4398046511104)return 6;if(e<562949953421312)return 7;if(null!=Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw RangeError("Could not encode varint");return 8}function s(e,t,r=0){switch(i(e)){case 8:t[r++]=255&e|128,e/=128;case 7:t[r++]=255&e|128,e/=128;case 6:t[r++]=255&e|128,e/=128;case 5:t[r++]=255&e|128,e/=128;case 4:t[r++]=255&e|128,e>>>=7;case 3:t[r++]=255&e|128,e>>>=7;case 2:t[r++]=255&e|128,e>>>=7;case 1:t[r++]=255&e,e>>>=7;break;default:throw Error("unreachable")}return t}function o(e,t){let r,n=e[t];if(r=0+(127&n),n<128||(r+=(127&(n=e[t+1]))<<7,n<128)||(r+=(127&(n=e[t+2]))<<14,n<128)||(r+=(127&(n=e[t+3]))<<21,n<128)||(r+=(127&(n=e[t+4]))*268435456,n<128)||(r+=(127&(n=e[t+5]))*34359738368,n<128)||(r+=(127&(n=e[t+6]))*4398046511104,n<128)||(r+=(127&(n=e[t+7]))*562949953421312,n<128))return r;throw RangeError("Could not decode varint")}function a(e,t,r=0){return(null==t&&(t=(0,n.E)(i(e))),t instanceof Uint8Array)?s(e,t,r):function(e,t,r=0){switch(i(e)){case 8:t.set(r++,255&e|128),e/=128;case 7:t.set(r++,255&e|128),e/=128;case 6:t.set(r++,255&e|128),e/=128;case 5:t.set(r++,255&e|128),e/=128;case 4:t.set(r++,255&e|128),e>>>=7;case 3:t.set(r++,255&e|128),e>>>=7;case 2:t.set(r++,255&e|128),e>>>=7;case 1:t.set(r++,255&e),e>>>=7;break;default:throw Error("unreachable")}return t}(e,t,r)}function l(e,t=0){return e instanceof Uint8Array?o(e,t):function(e,t){let r,n=e.get(t);if(r=0+(127&n),n<128||(r+=(127&(n=e.get(t+1)))<<7,n<128)||(r+=(127&(n=e.get(t+2)))<<14,n<128)||(r+=(127&(n=e.get(t+3)))<<21,n<128)||(r+=(127&(n=e.get(t+4)))*268435456,n<128)||(r+=(127&(n=e.get(t+5)))*34359738368,n<128)||(r+=(127&(n=e.get(t+6)))*4398046511104,n<128)||(r+=(127&(n=e.get(t+7)))*562949953421312,n<128))return r;throw RangeError("Could not decode varint")}(e,t)}},54164:function(e,t,r){"use strict";r.d(t,{H:function(){return c},Z:function(){return l}});var n=r(1514),i=r(83508),s=r(38856);let o=Symbol.for("@achingbrain/uint8arraylist");function a(e,t){if(null==t||t<0)throw RangeError("index is out of bounds");let r=0;for(let n of e){let e=r+n.byteLength;if(t0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(let r of e)if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.push(r);else if(l(r))t+=r.byteLength,this.bufs.push(...r.bufs);else throw Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(let r of e.reverse())if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.unshift(r);else if(l(r))t+=r.byteLength,this.bufs.unshift(...r.bufs);else throw Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}get(e){let t=a(this.bufs,e);return t.buf[t.index]}set(e,t){let r=a(this.bufs,e);r.buf[r.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let r=0;r0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,t){let{bufs:r,length:n}=this._subList(e,t);return(0,i.z)(r,n)}subarray(e,t){let{bufs:r,length:n}=this._subList(e,t);return 1===r.length?r[0]:(0,i.z)(r,n)}sublist(e,t){let{bufs:r,length:n}=this._subList(e,t),i=new c;return i.length=n,i.bufs=[...r],i}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(0===e&&t===this.length)return{bufs:this.bufs,length:this.length};let r=[],n=0;for(let i=0;i=a)continue;let l=e>=o&&eo&&t<=a;if(l&&c){if(e===o&&t===a){r.push(s);break}let n=e-o;r.push(s.subarray(n,n+(t-e)));break}if(l){if(0===e){r.push(s);continue}r.push(s.subarray(e-o));continue}if(c){if(t===a){r.push(s);break}r.push(s.subarray(0,t-o));break}r.push(s)}return{bufs:r,length:t-e}}indexOf(e,t=0){let r;if(!l(e)&&!(e instanceof Uint8Array))throw TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(isNaN(t=Number(t??0))&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;let i=n.byteLength;if(0===i)throw TypeError("search must be at least 1 byte long");let s=new Int32Array(256);for(let e=0;e<256;e++)s[e]=-1;for(let e=0;e=0;t--){let i=this.get(e+t);if(n[t]!==i){r=Math.max(1,t-s[i]);break}}if(0===r)return e}return -1}getInt8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){let r=(0,n.E)(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt8(0,t),this.write(r,e)}getInt16(e,t){let r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt16(0,t)}setInt16(e,t,r){let i=(0,n.u)(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,t,r),this.write(i,e)}getInt32(e,t){let r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt32(0,t)}setInt32(e,t,r){let i=(0,n.u)(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,t,r),this.write(i,e)}getBigInt64(e,t){let r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigInt64(0,t)}setBigInt64(e,t,r){let i=(0,n.u)(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,t,r),this.write(i,e)}getUint8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){let r=(0,n.E)(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint8(0,t),this.write(r,e)}getUint16(e,t){let r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint16(0,t)}setUint16(e,t,r){let i=(0,n.u)(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,t,r),this.write(i,e)}getUint32(e,t){let r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,t)}setUint32(e,t,r){let i=(0,n.u)(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,t,r),this.write(i,e)}getBigUint64(e,t){let r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigUint64(0,t)}setBigUint64(e,t,r){let i=(0,n.u)(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,t,r),this.write(i,e)}getFloat32(e,t){let r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat32(0,t)}setFloat32(e,t,r){let i=(0,n.u)(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,t,r),this.write(i,e)}getFloat64(e,t){let r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat64(0,t)}setFloat64(e,t,r){let i=(0,n.u)(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,t,r),this.write(i,e)}equals(e){if(null==e||!(e instanceof c)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;te+t.byteLength,0)),r.length=t,r}}},1514:function(e,t,r){"use strict";function n(e=0){return new Uint8Array(e)}function i(e=0){return new Uint8Array(e)}r.d(t,{E:function(){return i},u:function(){return n}})},83508:function(e,t,r){"use strict";r.d(t,{z:function(){return i}});var n=r(1514);function i(e,t){null==t&&(t=e.reduce((e,t)=>e+t.length,0));let r=(0,n.E)(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return r}},38856:function(e,t,r){"use strict";function n(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),a=s("ascii","a",e=>{let t="a";for(let r=0;r{e=e.substring(1);let t=(0,i.E)(e.length);for(let r=0;r{o.onmessage(e)}}},c={};function f(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}},r=!0;try{i[e](n,n.exports,f),r=!1}finally{r&&delete c[e]}return n.exports}f.m=i,f.x=function(){var e=f.O(void 0,[333,78],function(){return f(22661)});return f.O(e)},e=[],f.O=function(t,n,r,u){if(n){u=u||0;for(var o=e.length;o>0&&e[o-1][2]>u;o--)e[o]=e[o-1];e[o]=[n,r,u];return}for(var i=1/0,o=0;o=u&&Object.keys(f.O).every(function(e){return f.O[e](n[s])})?n.splice(s--,1):(c=!1,u + * @license MIT + */let n=r(48738),i=r(6868),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return u(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!a.isEncoding(t))throw TypeError("Unknown encoding: "+t);let r=0|p(e,t),n=o(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(R(e,Uint8Array)){let t=new Uint8Array(e);return c(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(R(e,ArrayBuffer)||e&&R(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(R(e,SharedArrayBuffer)||e&&R(e.buffer,SharedArrayBuffer)))return c(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return a.from(n,t,r);let i=function(e){var t;if(a.isBuffer(e)){let t=0|d(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||(t=e.length)!=t?o(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return h(e),o(e<0?0:0|d(e))}function f(e){let t=e.length<0?0:0|d(e.length),r=o(t);for(let n=0;n=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||R(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return T(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(e).length;default:if(i)return n?-1:T(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(s=r=+r)!=s&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return -1;r=e.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:_(e,t,r,n,i);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):_(e,[t],r,n,i);throw TypeError("val must be string, number or Buffer")}function _(e,t,r,n,i){let s,o=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,a/=2,l/=2,r/=2}function h(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let n=-1;for(s=r;sa&&(r=a-l),s=r;s>=0;s--){let r=!0;for(let n=0;n239?4:t>223?3:t>191?2:1;if(i+o<=r){let r,n,a,l;switch(o){case 1:t<128&&(s=t);break;case 2:(192&(r=e[i+1]))==128&&(l=(31&t)<<6|63&r)>127&&(s=l);break;case 3:r=e[i+1],n=e[i+2],(192&r)==128&&(192&n)==128&&(l=(15&t)<<12|(63&r)<<6|63&n)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],(192&r)==128&&(192&n)==128&&(192&a)==128&&(l=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=o}return function(e){let t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nr)throw RangeError("Trying to access beyond buffer length")}function v(e,t,r,n,i,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function x(e,t,r,n,i){S(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function E(e,t,r,n,i){S(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function A(e,t,r,n,i,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,n,s){return t=+t,r>>>=0,s||A(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function B(e,t,r,n,s){return t=+t,r>>>=0,s||A(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.Buffer=a,t.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(h(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return u(e)},a.allocUnsafeSlow=function(e){return u(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(R(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),R(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,s=Math.min(r,n);in.length?(a.isBuffer(t)||(t=a.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else if(a.isBuffer(t))t.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=t.length}return n},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(R(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;let s=i-n,o=r-t,l=Math.min(s,o),h=this.slice(n,i),u=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let c=this.length-t;if((void 0===r||r>c)&&(r=c),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let d=!1;for(;;)switch(n){case"hex":return function(e,t,r,n){let i;r=Number(r)||0;let s=e.length-r;n?(n=Number(n))>s&&(n=s):n=s;let o=t.length;for(n>o/2&&(n=o/2),i=0;i>8,i.push(r%256),i.push(n);return i}(e,this.length-u),this,u,f);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){let r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||b(e,t,this.length);let n=this[e],i=1,s=0;for(;++s>>=0,t>>>=0,r||b(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=F(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&U(e,this.length-8);let n=t+256*this[++e]+65536*this[++e]+16777216*this[++e],i=this[++e]+256*this[++e]+65536*this[++e]+16777216*r;return BigInt(n)+(BigInt(i)<>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&U(e,this.length-8);let n=16777216*t+65536*this[++e]+256*this[++e]+this[++e],i=16777216*this[++e]+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||b(e,t,this.length);let n=this[e],i=1,s=0;for(;++s=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);let n=t,i=1,s=this[e+--n];for(;n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=F(function(e){O(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&U(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24))<>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&U(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;v(this,e,t,r,n,0)}let i=1,s=0;for(this[t]=255&e;++s>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;v(this,e,t,r,n,0)}let i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigUInt64LE=F(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=F(function(e,t=0){return E(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);v(this,e,t,r,n-1,-n)}let i=0,s=1,o=0;for(this[t]=255&e;++i>0)-o&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);v(this,e,t,r,n-1,-n)}let i=r-1,s=1,o=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/s>>0)-o&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||v(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigInt64LE=F(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=F(function(e,t=0){return E(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function S(e,t,r,n,i,s){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${(s+1)*8}${i}`:`>= -(2${i} ** ${(s+1)*8-1}${i}) and < 2 ** ${(s+1)*8-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new I.ERR_OUT_OF_RANGE("value",n,e)}O(i,"offset"),(void 0===n[i]||void 0===n[i+s])&&U(i,n.length-(s+1))}function O(e,t){if("number"!=typeof e)throw new I.ERR_INVALID_ARG_TYPE(t,"number",e)}function U(e,t,r){if(Math.floor(e)!==e)throw O(e,r),new I.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new I.ERR_BUFFER_OUT_OF_BOUNDS;throw new I.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}z("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),z("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),z("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>4294967296?i=C(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=C(i)),i+="n"),n+=` It must be ${t}. Received ${i}`},RangeError);let M=/[^+/0-9A-Za-z-_]/g;function T(e,t){let r;t=t||1/0;let n=e.length,i=null,s=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function $(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function L(e,t,r,n){let i;for(i=0;i=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function R(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}let j=function(){let e="0123456789abcdef",t=Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function F(e){return"undefined"==typeof BigInt?N:e}function N(){throw Error("BigInt not supported")}},13414:function(e,t,r){var n=r(2381).Symbol;e.exports=n},12731:function(e,t,r){var n=r(13414),i=r(37363),s=r(68391),o=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?i(e):s(e)}},19334:function(e,t,r){var n=r(25788),i=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(i,""):e}},93330:function(e,t,r){var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},37363:function(e,t,r){var n=r(13414),i=Object.prototype,s=i.hasOwnProperty,o=i.toString,a=n?n.toStringTag:void 0;e.exports=function(e){var t=s.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var i=o.call(e);return n&&(t?e[a]=r:delete e[a]),i}},68391:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},2381:function(e,t,r){var n=r(93330),i="object"==typeof self&&self&&self.Object===Object&&self,s=n||i||Function("return this")();e.exports=s},25788:function(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},22170:function(e,t,r){var n=r(63117),i=r(49423),s=r(49666),o=Math.max,a=Math.min;e.exports=function(e,t,r){var l,h,u,f,c,d,p=0,g=!1,m=!1,y=!0;if("function"!=typeof e)throw TypeError("Expected a function");function _(t){var r=l,n=h;return l=h=void 0,p=t,f=e.apply(n,r)}function w(e){var r=e-d,n=e-p;return void 0===d||r>=t||r<0||m&&n>=u}function b(){var e,r,n,s=i();if(w(s))return v(s);c=setTimeout(b,(e=s-d,r=s-p,n=t-e,m?a(n,u-r):n))}function v(e){return(c=void 0,y&&l)?_(e):(l=h=void 0,f)}function x(){var e,r=i(),n=w(r);if(l=arguments,h=this,d=r,n){if(void 0===c)return p=e=d,c=setTimeout(b,t),g?_(e):f;if(m)return clearTimeout(c),c=setTimeout(b,t),_(d)}return void 0===c&&(c=setTimeout(b,t)),f}return t=s(t)||0,n(r)&&(g=!!r.leading,u=(m="maxWait"in r)?o(s(r.maxWait)||0,t):u,y="trailing"in r?!!r.trailing:y),x.cancel=function(){void 0!==c&&clearTimeout(c),p=0,l=d=h=c=void 0},x.flush=function(){return void 0===c?f:v(i())},x}},63117:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},50561:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},41108:function(e,t,r){var n=r(12731),i=r(50561);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==n(e)}},49423:function(e,t,r){var n=r(2381);e.exports=function(){return n.Date.now()}},49666:function(e,t,r){var n=r(19334),i=r(63117),s=r(41108),o=0/0,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,h=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(s(e))return o;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=l.test(e);return r||h.test(e)?u(e.slice(2),r?2:8):a.test(e)?o:+e}},48464:function(e,t,r){!function(){var t={452:function(e){"use strict";e.exports=r(46405)}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var s=n[e]={exports:{}},o=!0;try{t[e](s,s.exports,i),o=!1}finally{o&&delete n[e]}return s.exports}i.ab="//";var s={};!function(){var e,t=(e=i(452))&&"object"==typeof e&&"default"in e?e.default:e,r=/https?|ftp|gopher|file/;function n(e){"string"==typeof e&&(e=y(e));var n,i,s,o,a,l,h,u,f,c=(i=(n=e).auth,s=n.hostname,o=n.protocol||"",a=n.pathname||"",l=n.hash||"",h=n.query||"",u=!1,i=i?encodeURIComponent(i).replace(/%3A/i,":")+"@":"",n.host?u=i+n.host:s&&(u=i+(~s.indexOf(":")?"["+s+"]":s),n.port&&(u+=":"+n.port)),h&&"object"==typeof h&&(h=t.encode(h)),f=n.search||h&&"?"+h||"",o&&":"!==o.substr(-1)&&(o+=":"),n.slashes||(!o||r.test(o))&&!1!==u?(u="//"+(u||""),a&&"/"!==a[0]&&(a="/"+a)):u||(u=""),l&&"#"!==l[0]&&(l="#"+l),f&&"?"!==f[0]&&(f="?"+f),{protocol:o,host:u,pathname:a=a.replace(/[?#]/g,encodeURIComponent),search:f=f.replace("#","%23"),hash:l});return""+c.protocol+c.host+c.pathname+c.search+c.hash}var o="http://",a=o+"w.w",l=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,h=/https?|ftp|gopher|file/;function u(e,t){var r="string"==typeof e?y(e):e;e="object"==typeof e?n(e):e;var i=y(t),s="";r.protocol&&!r.slashes&&(s=r.protocol,e=e.replace(r.protocol,""),s+="/"===t[0]||"/"===e[0]?"/":""),s&&i.protocol&&(s="",i.slashes||(s=i.protocol,t=t.replace(i.protocol,"")));var u=e.match(l);u&&!i.protocol&&(e=e.substr((s=u[1]+(u[2]||"")).length),/^\/\/[^/]/.test(t)&&(s=s.slice(0,-1)));var f=new URL(e,a+"/"),c=new URL(t,f).toString().replace(a,""),d=i.protocol||r.protocol;return d+=r.slashes||i.slashes?"//":"",!s&&d?c=c.replace(o,d):s&&(c=c.replace(o,"")),h.test(c)||~t.indexOf(".")||"/"===e.slice(-1)||"/"===t.slice(-1)||"/"!==c.slice(-1)||(c=c.slice(0,-1)),s&&(c=s+("/"===c[0]?c.substr(1):c)),c}function f(){}f.prototype.parse=y,f.prototype.format=n,f.prototype.resolve=u,f.prototype.resolveObject=u;var c=/^https?|ftp|gopher|file/,d=/^(.*?)([#?].*)/,p=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,g=/^([a-z0-9.+-]*:)?\/\/\/*/i,m=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function y(e,r,i){if(void 0===r&&(r=!1),void 0===i&&(i=!1),e&&"object"==typeof e&&e instanceof f)return e;var s=(e=e.trim()).match(d);e=s?s[1].replace(/\\/g,"/")+s[2]:e.replace(/\\/g,"/"),m.test(e)&&"/"!==e.slice(-1)&&(e+="/");var o=!/(^javascript)/.test(e)&&e.match(p),l=g.test(e),h="";o&&(c.test(o[1])||(h=o[1].toLowerCase(),e=""+o[2]+o[3]),o[2]||(l=!1,c.test(o[1])?(h=o[1],e=""+o[3]):e="//"+o[3]),3!==o[2].length&&1!==o[2].length||(h=o[1],e="/"+o[3]));var u,y=(s?s[1]:e).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),_=y&&y[1],w=new f,b="",v="";try{u=new URL(e)}catch(t){b=t,h||i||!/^\/\//.test(e)||/^\/\/.+[@.]/.test(e)||(v="/",e=e.substr(1));try{u=new URL(e,a)}catch(e){return w.protocol=h,w.href=h,w}}w.slashes=l&&!v,w.host="w.w"===u.host?"":u.host,w.hostname="w.w"===u.hostname?"":u.hostname.replace(/(\[|\])/g,""),w.protocol=b?h||null:u.protocol,w.search=u.search.replace(/\\/g,"%5C"),w.hash=u.hash.replace(/\\/g,"%5C");var x=e.split("#");!w.search&&~x[0].indexOf("?")&&(w.search="?"),w.hash||""!==x[1]||(w.hash="#"),w.query=r?t.decode(u.search.substr(1)):w.search.substr(1),w.pathname=v+(o?u.pathname.replace(/['^|`]/g,function(e){return"%"+e.charCodeAt().toString(16).toUpperCase()}).replace(/((?:%[0-9A-F]{2})+)/g,function(e,t){try{return decodeURIComponent(t).split("").map(function(e){var t=e.charCodeAt();return t>256||/^[a-z0-9]$/i.test(e)?e:"%"+t.toString(16).toUpperCase()}).join("")}catch(e){return t}}):u.pathname),"about:"===w.protocol&&"blank"===w.pathname&&(w.protocol="",w.pathname=""),b&&"/"!==e[0]&&(w.pathname=w.pathname.substr(1)),h&&!c.test(h)&&"/"!==e.slice(-1)&&"/"===w.pathname&&(w.pathname=""),w.path=w.pathname+w.search,w.auth=[u.username,u.password].map(decodeURIComponent).filter(Boolean).join(":"),w.port=u.port,_&&!w.host.endsWith(_)&&(w.host+=_,w.port=_.slice(1)),w.href=v?""+w.pathname+w.search+w.hash:n(w);var E=/^(file)/.test(w.href)?["host","hostname"]:[];return Object.keys(w).forEach(function(e){~E.indexOf(e)||(w[e]=w[e]||null)}),w}s.parse=y,s.format=n,s.resolve=u,s.resolveObject=function(e,t){return y(u(e,t))},s.Url=f}(),e.exports=s}()},46405:function(e){!function(){"use strict";var t={815:function(e){e.exports=function(e,r,n,i){r=r||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var o=/\+/g;e=e.split(r);var a=1e3;i&&"number"==typeof i.maxKeys&&(a=i.maxKeys);var l=e.length;a>0&&l>a&&(l=a);for(var h=0;h=0?(u=p.substr(0,g),f=p.substr(g+1)):(u=p,f=""),c=decodeURIComponent(u),d=decodeURIComponent(f),Object.prototype.hasOwnProperty.call(s,c))?t(s[c])?s[c].push(d):s[c]=[s[c],d]:s[c]=d}return s};var t=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},577:function(e){var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,s,o,a){return(s=s||"&",o=o||"=",null===e&&(e=void 0),"object"==typeof e)?n(i(e),function(i){var a=encodeURIComponent(t(i))+o;return r(e[i])?n(e[i],function(e){return a+encodeURIComponent(t(e))}).join(s):a+encodeURIComponent(t(e[i]))}).join(s):a?encodeURIComponent(t(a))+o+encodeURIComponent(t(e)):""};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function n(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n{if(t&&"function"==typeof t.init&&"function"==typeof t.createSessionHandler){let s=n[e];if(void 0===s)n[e]={backend:t,priority:r};else if(s.priority>r)return;else if(s.priority===r&&s.backend!==t)throw Error(`cannot register backend "${e}" using priority ${r}`);if(r>=0){let t=i.indexOf(e);-1!==t&&i.splice(t,1);for(let t=0;t{let t=0===e.length?i:e,r=[];for(let e of t){let t=n[e];if(t){if(t.initialized)return t.backend;if(t.aborted)continue;let n=!!t.initPromise;try{return n||(t.initPromise=t.backend.init()),await t.initPromise,t.initialized=!0,t.backend}catch(i){n||r.push({name:e,err:i}),t.aborted=!0}finally{delete t.initPromise}}}throw Error(`no available backend found. ERR: ${r.map(e=>`[${e.name}] ${e.err}`).join(", ")}`)};class a{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(e){if(void 0!==e){if("string"!=typeof e||-1===["verbose","info","warning","error","fatal"].indexOf(e))throw Error(`Unsupported logging level: ${e}`);this.logLevelInternal=e}}get logLevel(){return this.logLevelInternal}}let l=new a,h="undefined"!=typeof BigInt64Array&&"function"==typeof BigInt64Array.from,u="undefined"!=typeof BigUint64Array&&"function"==typeof BigUint64Array.from,f=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),c=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);h&&(f.set("int64",BigInt64Array),c.set(BigInt64Array,"int64")),u&&(f.set("uint64",BigUint64Array),c.set(BigUint64Array,"uint64"));let d=e=>{let t=1;for(let r=0;r{let i=document.createElement("canvas"),s=i.getContext("2d");if(!e||!s)return n();let o=new Image;o.crossOrigin="Anonymous",o.src=e,o.onload=()=>{i.width=o.width,i.height=o.height,s.drawImage(o,0,0,i.width,i.height);let e=s.getImageData(0,0,i.width,i.height);if(void 0!==t){if(void 0!==t.height&&t.height!==i.height)throw Error("Image input config height doesn't match ImageBitmap height");if(a.height=i.height,void 0!==t.width&&t.width!==i.width)throw Error("Image input config width doesn't match ImageBitmap width");a.width=i.width}else a.height=i.height,a.width=i.width;r(p.bufferToTensor(e.data,a))}});else throw Error("Input data provided is not supported - aborted tensor creation");if(void 0!==r)return p.bufferToTensor(r,a);throw Error("Input data provided is not supported - aborted tensor creation")}toImageData(e){var t,r;let n;let i=document.createElement("canvas").getContext("2d");if(null!=i){let s=this.dims[3],o=this.dims[2],a=this.dims[1],l=void 0!==e&&void 0!==e.format?e.format:"RGB",h=void 0!==e&&(null===(t=e.norm)||void 0===t?void 0:t.mean)!==void 0?e.norm.mean:255,u=void 0!==e&&(null===(r=e.norm)||void 0===r?void 0:r.bias)!==void 0?e.norm.bias:0,f=o*s;if(void 0!==e){if(void 0!==e.height&&e.height!==o)throw Error("Image output config height doesn't match tensor height");if(void 0!==e.width&&e.width!==s)throw Error("Image output config width doesn't match tensor width");if(void 0!==e.format&&4===a&&"RGBA"!==e.format||3===a&&"RGB"!==e.format&&"BGR"!==e.format)throw Error("Tensor format doesn't match input tensor dims")}let c=0,d=1,p=2,g=3,m=0,y=f,_=2*f,w=-1;"RGBA"===l?(m=0,y=f,_=2*f,w=3*f):"RGB"===l?(m=0,y=f,_=2*f):"RBG"===l&&(m=0,_=f,y=2*f),n=i.createImageData(s,o);for(let e=0;e=e.byteLength)throw RangeError(`'byteOffset' is out of range [0, ${e.byteLength}).`);if(a=e.byteLength-o,"number"==typeof r){if(!Number.isSafeInteger(a=r))throw RangeError("'byteLength' must be an integer.");if(a<=0||o+a>e.byteLength)throw RangeError(`'byteLength' is out of range (0, ${e.byteLength-o}].`);if("object"==typeof n&&null!==n)s=n;else if(void 0!==n)throw TypeError("'options' must be an object.")}else if(void 0!==r)throw TypeError("'byteLength' must be a number.")}else if(void 0!==t)throw TypeError("'options' must be an object.");i=new Uint8Array(e,o,a)}else throw TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let a=(s.executionProviders||[]).map(e=>"string"==typeof e?e:e.name),l=await o(a);return new m(await l.createSessionHandler(i,s))}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}let y=m},24087:function(e,t,r){"use strict";r.d(t,{YS:function(){return X}});var n=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",StringLiteral:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator"}),i=Object.freeze({set:n.Set,for:n.For,in:n.In,is:n.Is,if:n.If,else:n.Else,endif:n.EndIf,elif:n.ElseIf,endfor:n.EndFor,and:n.And,or:n.Or,not:n.Not,"not in":n.NotIn,true:n.BooleanLiteral,false:n.BooleanLiteral}),s=class{constructor(e,t){this.value=e,this.type=t}};function o(e){return/\w/.test(e)}function a(e){return/[0-9]/.test(e)}var l=[["{%",n.OpenStatement],["%}",n.CloseStatement],["{{",n.OpenExpression],["}}",n.CloseExpression],["(",n.OpenParen],[")",n.CloseParen],["{",n.OpenCurlyBracket],["}",n.CloseCurlyBracket],["[",n.OpenSquareBracket],["]",n.CloseSquareBracket],[",",n.Comma],[".",n.Dot],[":",n.Colon],["|",n.Pipe],["<=",n.ComparisonBinaryOperator],[">=",n.ComparisonBinaryOperator],["==",n.ComparisonBinaryOperator],["!=",n.ComparisonBinaryOperator],["<",n.ComparisonBinaryOperator],[">",n.ComparisonBinaryOperator],["+",n.AdditiveBinaryOperator],["-",n.AdditiveBinaryOperator],["*",n.MultiplicativeBinaryOperator],["/",n.MultiplicativeBinaryOperator],["%",n.MultiplicativeBinaryOperator],["=",n.Equals]],h=new Map([["n","\n"],["t"," "],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]),u=class{type="Statement"},f=class extends u{constructor(e){super(),this.body=e}type="Program"},c=class extends u{constructor(e,t,r){super(),this.test=e,this.body=t,this.alternate=r}type="If"},d=class extends u{constructor(e,t,r){super(),this.loopvar=e,this.iterable=t,this.body=r}type="For"},p=class extends u{constructor(e,t){super(),this.assignee=e,this.value=t}type="Set"},g=class extends u{type="Expression"},m=class extends g{constructor(e,t,r){super(),this.object=e,this.property=t,this.computed=r}type="MemberExpression"},y=class extends g{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},_=class extends g{constructor(e){super(),this.value=e}type="Identifier"},w=class extends g{constructor(e){super(),this.value=e}type="Literal"},b=class extends w{type="NumericLiteral"},v=class extends w{type="StringLiteral"},x=class extends w{type="BooleanLiteral"},E=class extends w{type="ArrayLiteral"},A=class extends w{type="TupleLiteral"},k=class extends w{type="ObjectLiteral"},B=class extends g{constructor(e,t,r){super(),this.operator=e,this.left=t,this.right=r}type="BinaryExpression"},I=class extends g{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},z=class extends g{constructor(e,t,r){super(),this.operand=e,this.negate=t,this.test=r}type="TestExpression"},C=class extends g{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},S=class extends g{constructor(e,t,r){super(),this.start=e,this.stop=t,this.step=r}type="SliceExpression"},O=class extends g{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"};function U(e,t,r=1){void 0===t&&(t=e,e=0);let n=[];for(let i=e;i=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),r=(r??=e.length)<0?Math.max(e.length+r,0):Math.min(r,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),r=(r??=-1)<-1?Math.max(e.length+r,-1):Math.min(r,e.length-1));let s=[];for(let o=t;i*oe.toUpperCase())}var $=class{type="RuntimeValue";value;builtins=new Map;constructor(e){this.value=e}__bool__(){return new j(!!this.value)}},L=class extends ${type="NumericValue"},R=class extends ${type="StringValue";builtins=new Map([["upper",new q(()=>new R(this.value.toUpperCase()))],["lower",new q(()=>new R(this.value.toLowerCase()))],["strip",new q(()=>new R(this.value.trim()))],["title",new q(()=>new R(T(this.value)))],["length",new L(this.value.length)]])},j=class extends ${type="BooleanValue"},F=class extends ${type="ObjectValue";__bool__(){return new j(this.value.size>0)}builtins=new Map([["get",new q(([e,t])=>{if(!(e instanceof R))throw Error(`Object key must be a string: got ${e.type}`);return this.value.get(e.value)??t??new H})],["items",new q(()=>new N(Array.from(this.value.entries()).map(([e,t])=>new N([new R(e),t]))))]])},N=class extends ${type="ArrayValue";builtins=new Map([["length",new L(this.value.length)]]);__bool__(){return new j(this.value.length>0)}},P=class extends N{type="TupleValue"},q=class extends ${type="FunctionValue"},H=class extends ${type="NullValue"},G=class extends ${type="UndefinedValue"},V=class{constructor(e){this.parent=e}variables=new Map([["namespace",new q(e=>{if(0===e.length)return new F(new Map);if(1!==e.length||!(e[0]instanceof F))throw Error("`namespace` expects either zero arguments or a single object argument");return e[0]})]]);tests=new Map([["boolean",e=>"BooleanValue"===e.type],["callable",e=>e instanceof q],["odd",e=>{if("NumericValue"!==e.type)throw Error(`Cannot apply test "odd" to type: ${e.type}`);return e.value%2!=0}],["even",e=>{if("NumericValue"!==e.type)throw Error(`Cannot apply test "even" to type: ${e.type}`);return e.value%2==0}],["false",e=>"BooleanValue"===e.type&&!e.value],["true",e=>"BooleanValue"===e.type&&e.value],["number",e=>"NumericValue"===e.type],["integer",e=>"NumericValue"===e.type&&Number.isInteger(e.value)],["iterable",e=>e instanceof N||e instanceof R],["lower",e=>{let t=e.value;return"StringValue"===e.type&&t===t.toLowerCase()}],["upper",e=>{let t=e.value;return"StringValue"===e.type&&t===t.toUpperCase()}],["none",e=>"NullValue"===e.type],["defined",e=>"UndefinedValue"!==e.type],["undefined",e=>"UndefinedValue"===e.type],["equalto",(e,t)=>e.value===t.value]]);set(e,t){return this.declareVariable(e,function e(t){switch(typeof t){case"number":return new L(t);case"string":return new R(t);case"boolean":return new j(t);case"object":if(null===t)return new H;if(Array.isArray(t))return new N(t.map(e));return new F(new Map(Object.entries(t).map(([t,r])=>[t,e(r)])));case"function":return new q((r,n)=>e(t(...r.map(e=>e.value))??null));default:throw Error(`Cannot convert to runtime value: ${t}`)}}(t))}declareVariable(e,t){if(this.variables.has(e))throw SyntaxError(`Variable already declared: ${e}`);return this.variables.set(e,t),t}setVariable(e,t){return this.variables.set(e,t),t}resolve(e){if(this.variables.has(e))return this;if(this.parent)return this.parent.resolve(e);throw Error(`Unknown variable: ${e}`)}lookupVariable(e){try{return this.resolve(e).variables.get(e)??new G}catch{return new G}}},D=class{global;constructor(e){this.global=e??new V}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){let r=this.evaluate(e.left,t);switch(e.operator.value){case"and":return r.__bool__().value?this.evaluate(e.right,t):r;case"or":return r.__bool__().value?r:this.evaluate(e.right,t)}let n=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new j(r.value==n.value);case"!=":return new j(r.value!=n.value)}if(r instanceof G||n instanceof G)throw Error("Cannot perform operation on undefined values");if(r instanceof H||n instanceof H)throw Error("Cannot perform operation on null values");if(r instanceof L&&n instanceof L)switch(e.operator.value){case"+":return new L(r.value+n.value);case"-":return new L(r.value-n.value);case"*":return new L(r.value*n.value);case"/":return new L(r.value/n.value);case"%":return new L(r.value%n.value);case"<":return new j(r.value":return new j(r.value>n.value);case">=":return new j(r.value>=n.value);case"<=":return new j(r.value<=n.value)}else if(r instanceof N&&n instanceof N){if("+"===e.operator.value)return new N(r.value.concat(n.value))}else if(n instanceof N){let t=void 0!==n.value.find(e=>e.value===r.value);switch(e.operator.value){case"in":return new j(t);case"not in":return new j(!t)}}if((r instanceof R||n instanceof R)&&"+"===e.operator.value)return new R(r.value.toString()+n.value.toString());if(r instanceof R&&n instanceof R)switch(e.operator.value){case"in":return new j(n.value.includes(r.value));case"not in":return new j(!n.value.includes(r.value))}if(r instanceof R&&n instanceof F)switch(e.operator.value){case"in":return new j(n.value.has(r.value));case"not in":return new j(!n.value.has(r.value))}throw SyntaxError(`Unknown operator "${e.operator.value}" between ${r.type} and ${n.type}`)}evaluateFilterExpression(e,t){let r=this.evaluate(e.operand,t);if("Identifier"===e.filter.type){let t=e.filter;if(r instanceof N)switch(t.value){case"list":return r;case"first":return r.value[0];case"last":return r.value[r.value.length-1];case"length":return new L(r.value.length);case"reverse":return new N(r.value.reverse());case"sort":return new N(r.value.sort((e,t)=>{if(e.type!==t.type)throw Error(`Cannot compare different types: ${e.type} and ${t.type}`);switch(e.type){case"NumericValue":return e.value-t.value;case"StringValue":return e.value.localeCompare(t.value);default:throw Error(`Cannot compare type: ${e.type}`)}}));default:throw Error(`Unknown ArrayValue filter: ${t.value}`)}else if(r instanceof R)switch(t.value){case"length":return new L(r.value.length);case"upper":return new R(r.value.toUpperCase());case"lower":return new R(r.value.toLowerCase());case"title":return new R(T(r.value));case"capitalize":return new R(r.value.charAt(0).toUpperCase()+r.value.slice(1));case"trim":return new R(r.value.trim());default:throw Error(`Unknown StringValue filter: ${t.value}`)}else if(r instanceof L){if("abs"===t.value)return new L(Math.abs(r.value));throw Error(`Unknown NumericValue filter: ${t.value}`)}else if(r instanceof F)switch(t.value){case"items":return new N(Array.from(r.value.entries()).map(([e,t])=>new N([new R(e),t])));case"length":return new L(r.value.size);default:throw Error(`Unknown ObjectValue filter: ${t.value}`)}throw Error(`Cannot apply filter "${t.value}" to type: ${r.type}`)}if("CallExpression"===e.filter.type){let n=e.filter;if("Identifier"!==n.callee.type)throw Error(`Unknown filter: ${n.callee.type}`);let i=n.callee.value;if(r instanceof N){if("selectattr"===i){let e;if(r.value.some(e=>!(e instanceof F)))throw Error("`selectattr` can only be applied to array of objects");if(n.args.some(e=>"StringLiteral"!==e.type))throw Error("arguments of `selectattr` must be strings");let[i,s,o]=n.args.map(e=>this.evaluate(e,t));if(s){let r=t.tests.get(s.value);if(!r)throw Error(`Unknown test: ${s.value}`);e=r}else e=(...e)=>e[0].__bool__().value;return new N(r.value.filter(t=>{let r=t.value.get(i.value);return!!r&&e(r,o)}))}throw Error(`Unknown ArrayValue filter: ${i}`)}throw Error(`Cannot apply filter "${i}" to type: ${r.type}`)}throw Error(`Unknown filter: ${e.filter.type}`)}evaluateTestExpression(e,t){let r=this.evaluate(e.operand,t),n=t.tests.get(e.test.value);if(!n)throw Error(`Unknown test: ${e.test.value}`);let i=n(r);return new j(e.negate?!i:i)}evaluateUnaryExpression(e,t){let r=this.evaluate(e.argument,t);if("not"===e.operator.value)return new j(!r.value);throw SyntaxError(`Unknown operator: ${e.operator.value}`)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let r="";for(let n of e){let e=this.evaluate(n,t);"NullValue"!==e.type&&"UndefinedValue"!==e.type&&(r+=e.value)}return new R(r)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){let r=[],n=new Map;for(let i of e.args)"KeywordArgumentExpression"===i.type?n.set(i.key.value,this.evaluate(i.value,t)):r.push(this.evaluate(i,t));n.size>0&&r.push(new F(n));let i=this.evaluate(e.callee,t);if("FunctionValue"!==i.type)throw Error(`Cannot call something that is not a function: got ${i.type}`);return i.value(r,t)}evaluateSliceExpression(e,t,r){if(!(e instanceof N||e instanceof R))throw Error("Slice object must be an array or string");let n=this.evaluate(t.start,r),i=this.evaluate(t.stop,r),s=this.evaluate(t.step,r);if(!(n instanceof L||n instanceof G))throw Error("Slice start must be numeric or undefined");if(!(i instanceof L||i instanceof G))throw Error("Slice stop must be numeric or undefined");if(!(s instanceof L||s instanceof G))throw Error("Slice step must be numeric or undefined");return e instanceof N?new N(M(e.value,n.value,i.value,s.value)):new R(M(Array.from(e.value),n.value,i.value,s.value).join(""))}evaluateMemberExpression(e,t){let r,n;let i=this.evaluate(e.object,t);if(e.computed){if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(i,e.property,t);r=this.evaluate(e.property,t)}else r=new R(e.property.value);if(i instanceof F){if(!(r instanceof R))throw Error(`Cannot access property with non-string: got ${r.type}`);n=i.value.get(r.value)??i.builtins.get(r.value)}else if(i instanceof N||i instanceof R){if(r instanceof L)n=i.value.at(r.value),i instanceof R&&(n=new R(i.value.at(r.value)));else if(r instanceof R)n=i.builtins.get(r.value);else throw Error(`Cannot access property with non-string/non-number: got ${r.type}`)}else{if(!(r instanceof R))throw Error(`Cannot access property with non-string: got ${r.type}`);n=i.builtins.get(r.value)}return n instanceof $?n:new G}evaluateSet(e,t){let r=this.evaluate(e.value,t);if("Identifier"===e.assignee.type){let n=e.assignee.value;t.setVariable(n,r)}else if("MemberExpression"===e.assignee.type){let n=e.assignee,i=this.evaluate(n.object,t);if(!(i instanceof F))throw Error("Cannot assign to member of non-object");if("Identifier"!==n.property.type)throw Error("Cannot assign to member with non-identifier property");i.value.set(n.property.value,r)}else throw Error(`Invalid LHS inside assignment expression: ${JSON.stringify(e.assignee)}`);return new H}evaluateIf(e,t){let r=this.evaluate(e.test,t);return this.evaluateBlock(r.__bool__().value?e.body:e.alternate,t)}evaluateFor(e,t){let r=new V(t),n=this.evaluate(e.iterable,r);if(!(n instanceof N))throw Error(`Expected iterable type in for loop: got ${n.type}`);let i="";for(let t=0;t0?n.value[t-1]:new G],["nextitem",to.value.length?"few":"many"} items to unpack`);for(let e=0;ethis.evaluate(e,t)));case"TupleLiteral":return new P(e.value.map(e=>this.evaluate(e,t)));case"ObjectLiteral":{let r=new Map;for(let[n,i]of e.value){let e=this.evaluate(n,t);if(!(e instanceof R))throw Error(`Object keys must be strings: got ${e.type}`);r.set(e.value,this.evaluate(i,t))}return new F(r)}case"Identifier":return this.evaluateIdentifier(e,t);case"CallExpression":return this.evaluateCallExpression(e,t);case"MemberExpression":return this.evaluateMemberExpression(e,t);case"UnaryExpression":return this.evaluateUnaryExpression(e,t);case"BinaryExpression":return this.evaluateBinaryExpression(e,t);case"FilterExpression":return this.evaluateFilterExpression(e,t);case"TestExpression":return this.evaluateTestExpression(e,t);default:throw SyntaxError(`Unknown node type: ${e.type}`)}}},X=class{parsed;constructor(e){let t=function(e,t={}){let r=[],u=function(e,t={}){return e.endsWith("\n")&&(e=e.slice(0,-1)),e=e.replace(/{#.*?#}/gs,"{##}"),t.lstrip_blocks&&(e=e.replace(/^[ \t]*({[#%])/gm,"$1")),t.trim_blocks&&(e=e.replace(/([#%]})\n/g,"$1")),e.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}(e,t),f=0,c=e=>{let t="";for(;e(u[f]);){if("\\"===u[f]){if(++f>=u.length)throw SyntaxError("Unexpected end of input");let e=u[f++],r=h.get(e);if(void 0===r)throw SyntaxError(`Unexpected escaped character: ${e}`);t+=r;continue}if(t+=u[f++],f>=u.length)throw SyntaxError("Unexpected end of input")}return t};e:for(;f0){r.push(new s(e,n.Text));continue}}c(e=>/\s/.test(e));let t=u[f];if("-"===t||"+"===t){let e=r.at(-1)?.type;if(e===n.Text||void 0===e)throw SyntaxError(`Unexpected character: ${t}`);switch(e){case n.Identifier:case n.NumericLiteral:case n.BooleanLiteral:case n.StringLiteral:case n.CloseParen:case n.CloseSquareBracket:break;default:{++f;let e=c(a);r.push(new s(`${t}${e}`,e.length>0?n.NumericLiteral:n.UnaryOperator));continue}}}for(let[e,t]of l)if(u.slice(f,f+e.length)===e){r.push(new s(e,t)),f+=e.length;continue e}if("'"===t||'"'===t){++f;let e=c(e=>e!==t);r.push(new s(e,n.StringLiteral)),++f;continue}if(a(t)){let e=c(a);r.push(new s(e,n.NumericLiteral));continue}if(o(t)){let e=c(o),t=Object.hasOwn(i,e)?i[e]:n.Identifier;t===n.In&&r.at(-1)?.type===n.Not?(r.pop(),r.push(new s("not in",n.NotIn))):r.push(new s(e,t));continue}throw SyntaxError(`Unexpected character: ${t}`)}return r}(e,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=function(e){let t=new f([]),r=0;function i(t,n){let i=e[r++];if(!i||i.type!==t)throw Error(`Parser Error: ${n}. ${i.type} !== ${t}.`);return i}function s(...t){return r+t.length<=e.length&&t.every((t,n)=>t===e[r+n].type)}function o(e=!1){let t=e?T:a,i=[t()],o=s(n.Comma);for(;o&&(++r,i.push(t()),s(n.Comma)););return o?new A(i):i[0]}function a(){return function(){let e=l();if(s(n.If)){++r;let t=l();return i(n.Else,"Expected else token"),new c(t,[e],[l()])}return e}()}function l(){let t=h();for(;s(n.Or);){let n=e[r];++r,t=new B(n,t,h())}return t}function h(){let t=u();for(;s(n.And);){let n=e[r];++r,t=new B(n,t,u())}return t}function u(){let t;for(;s(n.Not);){let n=e[r];++r,t=new C(n,u())}return t??function(){let t=g();for(;s(n.ComparisonBinaryOperator)||s(n.In)||s(n.NotIn);){let n=e[r];++r,t=new B(n,t,g())}return t}()}function g(){let t=U();for(;s(n.AdditiveBinaryOperator);){let n=e[r];++r,t=new B(n,t,U())}return t}function w(e){let t=new y(e,function(){i(n.OpenParen,"Expected opening parenthesis for arguments list");let e=function(){let e=[];for(;!s(n.CloseParen);){let t=a();if(s(n.Equals)){if(++r,!(t instanceof _))throw SyntaxError("Expected identifier for keyword argument");t=new O(t,a())}e.push(t),s(n.Comma)&&++r}return e}();return i(n.CloseParen,"Expected closing parenthesis for arguments list"),e}());return s(n.OpenParen)&&(t=w(t)),t}function U(){let t=M();for(;s(n.MultiplicativeBinaryOperator);){let n=e[r];++r,t=new B(n,t,M())}return t}function M(){let t=function(){let t=function(){let t=function(){let t=T();for(;s(n.Dot)||s(n.OpenSquareBracket);){let o;let l=e[r];++r;let h=l.type!==n.Dot;if(h)o=function(){let e=[],t=!1;for(;!s(n.CloseSquareBracket);)s(n.Colon)?(e.push(void 0),++r,t=!0):(e.push(a()),s(n.Colon)&&(++r,t=!0));if(0===e.length)throw SyntaxError("Expected at least one argument for member/slice expression");if(t){if(e.length>3)throw SyntaxError("Expected 0-3 arguments for slice expression");return new S(...e)}return e[0]}(),i(n.CloseSquareBracket,"Expected closing square bracket");else if("Identifier"!==(o=T()).type)throw SyntaxError("Expected identifier following dot operator");t=new m(t,o,h)}return t}();return s(n.OpenParen)?w(t):t}();for(;s(n.Pipe);){++r;let e=T();if(!(e instanceof _))throw SyntaxError("Expected identifier for the filter");s(n.OpenParen)&&(e=w(e)),t=new I(t,e)}return t}();for(;s(n.Is);){++r;let e=s(n.Not);e&&++r;let i=T();if(i instanceof x&&(i=new _(i.value.toString())),!(i instanceof _))throw SyntaxError("Expected identifier for the test");t=new z(t,e,i)}return t}function T(){let t=e[r];switch(t.type){case n.NumericLiteral:return++r,new b(Number(t.value));case n.StringLiteral:return++r,new v(t.value);case n.BooleanLiteral:return++r,new x("true"===t.value);case n.Identifier:return++r,new _(t.value);case n.OpenParen:{++r;let t=o();if(e[r].type!==n.CloseParen)throw SyntaxError(`Expected closing parenthesis, got ${e[r].type} instead`);return++r,t}case n.OpenSquareBracket:{++r;let e=[];for(;!s(n.CloseSquareBracket);)e.push(a()),s(n.Comma)&&++r;return++r,new E(e)}case n.OpenCurlyBracket:{++r;let e=new Map;for(;!s(n.CloseCurlyBracket);){let t=a();i(n.Colon,"Expected colon between key and value in object literal");let o=a();e.set(t,o),s(n.Comma)&&++r}return++r,new k(e)}default:throw SyntaxError(`Unexpected token: ${t.type}`)}}for(;rt!==e[r+n].type)}(n.OpenStatement,n.EndFor);)h.push(t());return new d(s,l,h)}(),i(n.OpenStatement,"Expected {% token"),i(n.EndFor,"Expected endfor token"),i(n.CloseStatement,"Expected %} token");break;default:throw SyntaxError(`Unknown statement type: ${e[r].type}`)}return l}();case n.OpenExpression:return function(){i(n.OpenExpression,"Expected opening expression token");let e=a();return i(n.CloseExpression,"Expected closing expression token"),e}();default:throw SyntaxError(`Unexpected token type: ${e[r].type}`)}}());return t}(t)}render(e){let t=new V;for(let[r,n]of(t.set("false",!1),t.set("true",!0),t.set("raise_exception",e=>{throw Error(e)}),t.set("range",U),Object.entries(e)))t.set(r,n);return new D(t).run(this.parsed).value}}},69893:function(e,t,r){"use strict";let n,i;r.d(t,{UG:function(){return S}});/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */let s=2n**255n-19n,o=2n**252n+0x14def9dea2f79cd65812631a5cf5d3edn,a={a:-1n,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,p:s,n:o,h:8,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},l=(e="")=>{throw Error(e)},h=e=>"string"==typeof e,u=e=>e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name,f=(e,t)=>!u(e)||"number"==typeof t&&t>0&&e.length!==t?l("Uint8Array of valid length expected"):e,c=e=>new Uint8Array(e),d=(e,t)=>f(h(e)?v(e):c(f(e)),t),p=(e,t=s)=>{let r=e%t;return r>=0n?r:t+r},g=e=>e instanceof m?e:l("Point expected");class m{constructor(e,t,r,n){this.ex=e,this.ey=t,this.ez=r,this.et=n}static fromAffine(e){return new m(e.x,e.y,1n,p(e.x*e.y))}static fromHex(e,t=!1){let{d:r}=a,n=(e=d(e,32)).slice(),i=e[31];n[31]=-129&i;let o=E(n);t&&!(0n<=o&&o<2n**256n)&&l("bad y coord 1"),t||0n<=o&&o0n;i=i.double(),e>>=1n)1n&e?r=r.add(i):t&&(n=n.add(i));return r}multiply(e){return this.mul(e)}clearCofactor(){return this.mul(BigInt(a.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(o/2n,!1).double();return o%2n&&(e=e.add(this)),e.is0()}toAffine(){let{ex:e,ey:t,ez:r}=this;if(this.equals(_))return{x:0n,y:1n};let n=k(r);return 1n!==p(r*n)&&l("invalid inverse"),{x:p(e*n),y:p(t*n)}}toRawBytes(){let{x:e,y:t}=this.toAffine(),r=x(t);return r[31]|=1n&e?128:0,r}toHex(){return b(this.toRawBytes())}}m.BASE=new m(0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,0x6666666666666666666666666666666666666666666666666666666666666658n,1n,p(0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an*0x6666666666666666666666666666666666666666666666666666666666666658n)),m.ZERO=new m(0n,1n,1n,0n);let{BASE:y,ZERO:_}=m,w=(e,t)=>e.toString(16).padStart(t,"0"),b=e=>Array.from(e).map(e=>w(e,2)).join(""),v=e=>{let t=e.length;(!h(e)||t%2)&&l("hex invalid 1");let r=c(t/2);for(let t=0;tv(w(e,64)).reverse(),E=e=>BigInt("0x"+b(c(f(e)).reverse())),A=(...e)=>{let t=c(e.reduce((e,t)=>e+f(t).length,0)),r=0;return e.forEach(e=>{t.set(e,r),r+=e.length}),t},k=(e,t=s)=>{(0n===e||t<=0n)&&l("no inverse n="+e+" mod="+t);let r=p(e,t),n=t,i=0n,o=1n,a=1n,h=0n;for(;0n!==r;){let e=n/r,t=n%r,s=i-a*e,l=o-h*e;n=r,r=t,i=a,o=h,a=s,h=l}return 1n===n?p(i,t):l("no inverse")},B=(e,t)=>{let r=e;for(;t-- >0n;)r*=r,r%=s;return r},I=e=>{let t=e*e%s*e%s,r=B(t,2n)*t%s,n=B(r,1n)*e%s,i=B(n,5n)*n%s,o=B(i,10n)*i%s,a=B(o,20n)*o%s,l=B(a,40n)*a%s,h=B(l,80n)*l%s,u=B(h,80n)*l%s,f=B(u,10n)*i%s;return{pow_p_5_8:B(f,2n)*e%s,b2:t}},z=(e,t)=>{let r=p(t*t*t),n=I(e*p(r*r*t)).pow_p_5_8,i=p(e*r*n),s=p(t*i*i),o=i,a=p(0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n*i),l=s===e,h=s===p(-e),u=s===p(-(0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n*e));return l&&(i=o),(h||u)&&(i=a),(1n&p(i))===1n&&(i=p(-i)),{isValid:l||h,value:i}},C=()=>"object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,S={bytesToHex:b,hexToBytes:v,concatBytes:A,mod:p,invert:k,randomBytes:(e=32)=>{let t=C();return t&&t.getRandomValues||l("crypto.getRandomValues must be defined"),t.getRandomValues(c(e))},sha512Async:async(...e)=>{let t=C();t&&t.subtle||l("crypto.subtle or etc.sha512Async must be defined");let r=A(...e);return c(await t.subtle.digest("SHA-512",r.buffer))},sha512Sync:void 0};Object.defineProperties(S,{sha512Sync:{configurable:!1,get:()=>n,set(e){n||(n=e)}}});let O=()=>{let e=[],t=y,r=t;for(let n=0;n<33;n++){r=t,e.push(r);for(let n=1;n<128;n++)r=r.add(t),e.push(r);t=r.double()}return e},U=e=>{let t=i||(i=O()),r=(e,t)=>{let r=t.negate();return e?r:t},n=_,s=y,o=BigInt(255),a=BigInt(8);for(let i=0;i<33;i++){let l=128*i,h=Number(e&o);e>>=a,h>128&&(h-=256,e+=1n);let u=l+Math.abs(h)-1,f=i%2!=0,c=h<0;0===h?s=s.add(r(f,t[l])):n=n.add(r(c,t[u]))}return{p:n,f:s}}},65376:function(e,t,r){"use strict";function n(e,...t){if(!(e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function i(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function s(e,t){n(e);let r=t.outputLen;if(e.lengths-a&&(this.process(r,0),a=0);for(let e=a;e>i&s),a=Number(r&s),l=n?4:0,h=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+h,a,n)}(r,s-8,BigInt(8*this.length),o),this.process(r,0);let l=(0,i.GL)(e),h=this.outputLen;if(h%4)throw Error("_sha2: outputLen should be aligned to 32bit");let u=h/4,f=this.get();if(u>f.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e>s&i)}:{h:0|Number(e>>s&i),l:0|Number(e&i)}}(e[o],t);[r[o],n[o]]=[a,l]}return[r,n]},shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,add:function(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/4294967296|0)|0,l:0|i}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/4294967296|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/4294967296|0)|0,add5H:(e,t,r,n,i,s)=>t+r+n+i+s+(e/4294967296|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},a=r(93560);let[l,h]=o.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),u=new Uint32Array(80),f=new Uint32Array(80);class c extends n.VR{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:s,Dh:o,Dl:a,Eh:l,El:h,Fh:u,Fl:f,Gh:c,Gl:d,Hh:p,Hl:g}=this;return[e,t,r,n,i,s,o,a,l,h,u,f,c,d,p,g]}set(e,t,r,n,i,s,o,a,l,h,u,f,c,d,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|s,this.Dh=0|o,this.Dl=0|a,this.Eh=0|l,this.El=0|h,this.Fh=0|u,this.Fl=0|f,this.Gh=0|c,this.Gl=0|d,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)u[r]=e.getUint32(t),f[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|u[e-15],r=0|f[e-15],n=o.rotrSH(t,r,1)^o.rotrSH(t,r,8)^o.shrSH(t,r,7),i=o.rotrSL(t,r,1)^o.rotrSL(t,r,8)^o.shrSL(t,r,7),s=0|u[e-2],a=0|f[e-2],l=o.rotrSH(s,a,19)^o.rotrBH(s,a,61)^o.shrSH(s,a,6),h=o.rotrSL(s,a,19)^o.rotrBL(s,a,61)^o.shrSL(s,a,6),c=o.add4L(i,h,f[e-7],f[e-16]),d=o.add4H(c,n,l,u[e-7],u[e-16]);u[e]=0|d,f[e]=0|c}let{Ah:r,Al:n,Bh:i,Bl:s,Ch:a,Cl:c,Dh:d,Dl:p,Eh:g,El:m,Fh:y,Fl:_,Gh:w,Gl:b,Hh:v,Hl:x}=this;for(let e=0;e<80;e++){let t=o.rotrSH(g,m,14)^o.rotrSH(g,m,18)^o.rotrBH(g,m,41),E=o.rotrSL(g,m,14)^o.rotrSL(g,m,18)^o.rotrBL(g,m,41),A=g&y^~g&w,k=m&_^~m&b,B=o.add5L(x,E,k,h[e],f[e]),I=o.add5H(B,v,t,A,l[e],u[e]),z=0|B,C=o.rotrSH(r,n,28)^o.rotrBH(r,n,34)^o.rotrBH(r,n,39),S=o.rotrSL(r,n,28)^o.rotrBL(r,n,34)^o.rotrBL(r,n,39),O=r&i^r&a^i&a,U=n&s^n&c^s&c;v=0|w,x=0|b,w=0|y,b=0|_,y=0|g,_=0|m,({h:g,l:m}=o.add(0|d,0|p,0|I,0|z)),d=0|a,p=0|c,a=0|i,c=0|s,i=0|r,s=0|n;let M=o.add3L(z,S,U);r=o.add3H(M,I,C,O),n=0|M}({h:r,l:n}=o.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:s}=o.add(0|this.Bh,0|this.Bl,0|i,0|s)),({h:a,l:c}=o.add(0|this.Ch,0|this.Cl,0|a,0|c)),({h:d,l:p}=o.add(0|this.Dh,0|this.Dl,0|d,0|p)),({h:g,l:m}=o.add(0|this.Eh,0|this.El,0|g,0|m)),({h:y,l:_}=o.add(0|this.Fh,0|this.Fl,0|y,0|_)),({h:w,l:b}=o.add(0|this.Gh,0|this.Gl,0|w,0|b)),({h:v,l:x}=o.add(0|this.Hh,0|this.Hl,0|v,0|x)),this.set(r,n,i,s,a,c,d,p,g,m,y,_,w,b,v,x)}roundClean(){u.fill(0),f.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}let d=(0,a.hE)(()=>new c)},93560:function(e,t,r){"use strict";r.d(t,{GL:function(){return i},O0:function(){return s},hE:function(){return a},kb:function(){return o}});var n=r(65376);let i=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);function s(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}(e)),(0,n.aI)(e),e}new Uint8Array(new Uint32Array([287454020]).buffer)[0];class o{clone(){return this._cloneInto()}}function a(e){let t=t=>e().update(s(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}},71542:function(e,t,r){"use strict";let n;r.d(t,{ONNX:function(){return n},p:function(){return h}});var i,s,o=r(50495),a=r(97004),l=r(25566);let h=["wasm"];void 0!==l&&l?.release?.name==="node"?(n=o??(i||(i=r.t(o,2))),h.unshift("cpu")):(n=a??(s||(s=r.t(a,2))),"undefined"!=typeof navigator&&/iP(hone|od|ad).+16_4.+AppleWebKit/.test(navigator.userAgent)&&(n.env.wasm.simd=!1))},90016:function(e,t,r){"use strict";r.d(t,{z:function(){return o}});var n=r(40911);async function i(e,t){return await (0,n.yM)(e,"config.json",!0,t)}class s{constructor(e){this.model_type=null,this.is_encoder_decoder=!1,Object.assign(this,e)}static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:n=null,local_files_only:s=!1,revision:o="main"}={}){return new this(r??await i(e,{progress_callback:t,config:r,cache_dir:n,local_files_only:s,revision:o}))}}class o{static async from_pretrained(...e){return s.from_pretrained(...e)}}},50851:function(e,t,r){"use strict";r.d(t,{O:function(){return m}});var n=r(78386),i=r(73342),s=r(48464);let{env:o}=r(71542).ONNX,a="2.17.1",l="undefined"!=typeof self&&"caches"in self,h=!y(n),u=!y(i),f=h&&u,c=f?i.dirname(i.dirname(s.fileURLToPath("file:///Users/hrishioa/Dropbox/Projects/ChatGPT/Synthient/rakis/node_modules/@xenova/transformers/src/env.js"))):"./",d=f?i.join(c,"/.cache/"):null,p="/models/",g=f?i.join(c,p):p;o?.wasm&&(o.wasm.wasmPaths=f?i.join(c,"/dist/"):`https://cdn.jsdelivr.net/npm/@xenova/transformers@${a}/dist/`);let m={backends:{onnx:o,tfjs:{}},__dirname:c,version:a,allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!0,localModelPath:g,useFS:h,useBrowserCache:l,useFSCache:h,cacheDir:d,useCustomCache:!1,customCache:null};function y(e){return 0===Object.keys(e).length}},78703:function(e,t,r){"use strict";let n,i,s;r.d(t,{qCb:function(){return u.qC},EUT:function(){return eK},eaU:function(){return f.e}});var o=r(9046),a=r(99454),l=r(20761),h=r(40911),u=r(68709),f=r(62414),c=r(50851),d=r(68741);let p="undefined"!=typeof self,g=p&&"DedicatedWorkerGlobalScope"===self.constructor.name;if(p)n=(e,t)=>{if(!self.OffscreenCanvas)throw Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(e,t)},s=self.createImageBitmap,i=self.ImageData;else if(d)s=async e=>{let t=(await e.metadata()).channels,{data:r,info:n}=await e.raw().toBuffer({resolveWithObject:!0}),i=new _(new Uint8ClampedArray(r),n.width,n.height,n.channels);return void 0!==t&&t!==n.channels&&i.convert(t),i};else throw Error("Unable to load image processing library.");let m={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},y=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class _{constructor(e,t,r,n){this.data=e,this.width=t,this.height=r,this.channels=n}get size(){return[this.width,this.height]}static async read(e){if(e instanceof _)return e;if("string"==typeof e||e instanceof URL)return await this.fromURL(e);throw Error(`Unsupported input type: ${typeof e}`)}static async fromURL(e){let t=await (0,h.hn)(e);if(200!==t.status)throw Error(`Unable to read image from "${e}" (${t.status} ${t.statusText})`);let r=await t.blob();return this.fromBlob(r)}static async fromBlob(e){if(p){let t=await s(e),r=n(t.width,t.height).getContext("2d");return r.drawImage(t,0,0),new this(r.getImageData(0,0,t.width,t.height).data,t.width,t.height,4)}{let t=d(await e.arrayBuffer());return await s(t)}}static fromTensor(e,t="CHW"){if(3!==e.dims.length)throw Error(`Tensor should have 3 dimensions, but has ${e.dims.length} dimensions.`);if("CHW"===t)e=e.transpose(1,2,0);else if("HWC"===t);else throw Error(`Unsupported channel format: ${t}`);if(!(e.data instanceof Uint8ClampedArray||e.data instanceof Uint8Array))throw Error(`Unsupported tensor type: ${e.type}`);switch(e.dims[2]){case 1:case 2:case 3:case 4:return new _(e.data,e.dims[1],e.dims[0],e.dims[2]);default:throw Error(`Unsupported number of channels: ${e.dims[2]}`)}}grayscale(){if(1===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let t=0,r=0;t=0?l=r:u=-r,i>=0?h=i:f=-i,a.drawImage(o,l,h,e,t,u,f,e,t),new _(a.getImageData(0,0,e,t).data,e,t,4).convert(s)}{let n=this.toSharp();if(r>=0&&i>=0)n=n.extract({left:Math.floor(r),top:Math.floor(i),width:e,height:t});else if(r<=0&&i<=0){let s=Math.floor(-i),o=Math.floor(-r);n=n.extend({top:s,left:o,right:e-this.width-o,bottom:t-this.height-s})}else{let s=[0,0],o=0;i<0?(s[0]=Math.floor(-i),s[1]=t-this.height-s[0]):o=Math.floor(i);let a=[0,0],l=0;r<0?(a[0]=Math.floor(-r),a[1]=e-this.width-a[0]):l=Math.floor(r),n=n.extend({top:s[0],bottom:s[1],left:a[0],right:a[1]}).extract({left:l,top:o,width:e,height:t})}return await s(n)}}async toBlob(e="image/png",t=1){if(!p)throw Error("toBlob() is only supported in browser environments.");let r=this.toCanvas();return await r.convertToBlob({type:e,quality:t})}toTensor(e="CHW"){let t=new f.es("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if("HWC"===e);else if("CHW"===e)t=t.permute(2,0,1);else throw Error(`Unsupported channel format: ${e}`);return t}toCanvas(){if(!p)throw Error("toCanvas() is only supported in browser environments.");let e=this.clone().rgba(),t=n(e.width,e.height),r=new i(e.data,e.width,e.height);return t.getContext("2d").putImageData(r,0,0),t}_update(e,t,r,n=null){return this.data=e,this.width=t,this.height=r,null!==n&&(this.channels=n),this}clone(){return new _(this.data.slice(),this.width,this.height,this.channels)}convert(e){if(this.channels===e)return this;switch(e){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(e){if(p){if(g)throw Error("Unable to save an image from a Web Worker.");let t=e.split(".").pop().toLowerCase(),r=y.get(t)??"image/png",n=await this.toBlob(r),i=URL.createObjectURL(n),s=document.createElement("a");s.href=i,s.download=e,s.click(),s.remove()}else if(c.O.useFS){let t=this.toSharp();return await t.toFile(e)}else throw Error("Unable to save the image because filesystem is disabled in this environment.")}toSharp(){if(p)throw Error("toSharp() is only supported in server-side environments.");return d(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}async function w(e,t){let r;if("undefined"==typeof AudioContext)throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");let n=await (await (0,h.hn)(e)).arrayBuffer(),i=new AudioContext({sampleRate:t});void 0===t&&console.warn(`No sampling rate provided, using default of ${i.sampleRate}Hz.`);let s=await i.decodeAudioData(n);if(2===s.numberOfChannels){let e=Math.sqrt(2),t=s.getChannelData(0),n=s.getChannelData(1);r=new Float32Array(t.length);for(let i=0;i2595*Math.log10(1+e/700),kaldi:e=>1127*Math.log(1+e/700),slaney:(e,t=1e3,r=15,n=27/Math.log(6.4))=>e>=t?r+Math.log(e/t)*n:3*e/200};function x(e,t="htk"){let r=v[t];if(!r)throw Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map(e=>r(e))}let E={htk:e=>700*(10**(e/2595)-1),kaldi:e=>700*(Math.exp(e/1127)-1),slaney:(e,t=1e3,r=15,n=Math.log(6.4)/27)=>e>=r?t*Math.exp(n*(e-r)):200*e/3};function A(e,t,r){let n=(t-e)/(r-1);return Float64Array.from({length:r},(t,r)=>e+n*r)}function k(e,t,r,n,i,s=null,o="htk",a=!1){let l;if(null!==s&&"slaney"!==s)throw Error('norm must be one of null or "slaney"');let h=A(x(r,o),x(n,o),t+2),u=function(e,t="htk"){let r=E[t];if(!r)throw Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map(e=>r(e))}(h,o);if(a){let t=i/(2*e);l=x(Float64Array.from({length:e},(e,r)=>r*t),o),u=h}else l=A(0,Math.floor(i/2),e);let f=function(e,t){let r=Float64Array.from({length:t.length-1},(e,r)=>t[r+1]-t[r]),n=Array.from({length:e.length},()=>Array(t.length));for(let r=0;rArray(e.length));for(let t=0;ti)throw Error(`frame_length (${r}) may not be larger than fft_length (${i})`);if(x!==r)throw Error(`Length of the window (${x}) must equal frame_length (${r})`);if(n<=0)throw Error("hop_length must be greater than zero");if(o){if("reflect"!==a)throw Error(`pad_mode="${a}" not implemented yet.`);let t=Math.floor((i-1)/2)+1;e=function(e,t,r){let n=new e.constructor(e.length+t+r),i=e.length-1;for(let r=0;rE?b&&(I=w):I=k=w);let z=new u.vw(i),C=new Float64Array(i),S=new Float64Array(z.outputBufferSize),O=Array(k);for(let i=0;i=1;--e)C[e]-=f*C[e-1];C[0]*=1-f}for(let e=0;eMath.pow(e,.85));break;default:throw Error(`Unknown window type ${t}.`)}if(r&&(s=s.subarray(0,e)),null===n)return s;if(e>n)throw Error(`Length of the window (${e}) may not be larger than frame_length (${n})`);return s}function C(e,t=.5,r=null,n=!1){let i=e.logits,s=e.pred_boxes,[o,a,l]=i.dims;if(null!==r&&r.length!==o)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let h=[];for(let e=0;et&&s.push(e)}else{let e=(0,u.Fp)(i.data)[1];if(e===l-1)continue;s.push(e),r=(0,u.XA)(i.data)}for(let t of s){let n=d[e].data;n=function([e,t,r,n]){return[e-r/2,t-n/2,e+r/2,t+n/2]}(n),null!==o&&(n=n.map((e,t)=>e*o[(t+1)%2])),f.boxes.push(n),f.classes.push(t),f.scores.push(r[t])}}h.push(f)}return h}function S(e,t){if(!(e instanceof Float32Array||e instanceof Float64Array))throw Error(`${t} expects input to be a Float32Array or a Float64Array, but got ${e?.constructor?.name??typeof e} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}function O(e,t,r=0,n=null){let i=e/t,s=(0,u.eT)(i)*t;return null!==n&&s>n&&(s=Math.floor(i)*t),si?l=Math.floor(i*a/n):i>n&&(a=Math.floor(n*l/i)),await e.resize(l,a,{resample:r}))}async crop_margin(e,t=200){let r=e.clone().grayscale(),n=(0,u.VV)(r.data)[0],i=(0,u.Fp)(r.data)[0]-n;if(0===i)return e;let s=t/255,o=r.width,a=r.height,l=0,h=0;for(let e=0;ethis.preprocess(e)));return{pixel_values:(0,f.kn)(r.map(e=>e.pixel_values),0),original_sizes:r.map(e=>e.original_size),reshaped_input_sizes:r.map(e=>e.reshaped_input_size)}}}class $ extends T{post_process_semantic_segmentation(e,t=null){let r=e.logits,n=r.dims[0];if(null!==t&&t.length!==n)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let i=[];for(let e=0;eh[r]&&(h[r]=t[r],l.data[r]=e)}let u=Array(s.dims[0]),c=l.data;for(let e=0;evoid 0!==e);i.push({segmentation:l,labels:d})}return i}}class L extends T{}class R extends L{}class j extends T{}class F extends T{}class N extends T{}class P extends T{}class q extends T{}class H extends T{constructor(e){super(e),this.crop_pct=this.config.crop_pct??.875}async resize(e){let t=this.size?.shortest_edge;if(void 0===t)throw Error("Size dictionary must contain 'shortest_edge' key.");if(t<384){let r=Math.floor(t/this.crop_pct),[n,i]=this.get_resize_output_image_size(e,{shortest_edge:r});e=await e.resize(n,i,{resample:this.resample}),e=await e.center_crop(t,t)}else e=await e.resize(t,t,{resample:this.resample});return e}}class G extends H{}class V extends T{}class D extends T{}class X extends T{constructor(e){super(e),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map(e=>e*e))}}class W extends T{}class J extends T{post_process_object_detection(...e){return C(...e)}}class K extends J{}class Y extends T{}class Z extends T{}class Q extends T{pad_image(e,t,r,n={}){let[i,s,o]=t,a=this.image_mean;Array.isArray(this.image_mean)||(a=Array(o).fill(a));let l=this.image_std;Array.isArray(l)||(l=Array(o).fill(a));let h=a.map((e,t)=>-e/l[t]);return super.pad_image(e,t,r,{center:!0,constant_values:h,...n})}}class ee extends Q{}class et extends T{async _call(e){let t=await super._call(e),r=[t.pixel_values.dims[0],64,64],n=new f.es("int64",new BigInt64Array(r.reduce((e,t)=>e*t)).fill(1n),r);return{...t,pixel_mask:n}}post_process_object_detection(...e){return C(...e)}remove_low_and_no_objects(e,t,r,n){let i=[],s=[],o=[];for(let a=0;ar&&(i.push(h),s.push(c),o.push(f))}return[i,s,o]}check_segment_validity(e,t,r,n=.5,i=.8){let s=[],o=0,a=0;for(let i=0;i=n&&++a;let l=o>0&&a>0;return l&&(l=o/a>i),[l,s]}compute_segments(e,t,r,n,i,s=null,o=null){let[a,l]=o??e[0].dims,h=new f.es("int32",new Int32Array(a*l),[a,l]),u=[];if(null!==o)for(let t=0;td[t]&&(c[t]=r,d[t]=e[r].data[t])}let p=0;for(let s=0;se!==t.dims[r]))throw Error(`The first ${r.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new f.es("int64",e.flat(1/0).map(BigInt),r)}async _call(e,t=null,r=null){let n=await super._call(e);if(t&&(n.input_points=this.reshape_input_points(t,n.original_sizes,n.reshaped_input_sizes)),r){if(!n.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");n.input_labels=this.add_input_labels(r,n.input_points)}return n}post_process_masks(e,t,r,{mask_threshold:n=0,binarize:i=!0,pad_size:s=null}={}){let o=[],a=[(s=s??this.pad_size).height,s.width];for(let s=0;sn&&(e[t]=1);r=new f.es("bool",e,r.dims)}c.push(r)}o.push((0,f.kn)(c))}return o}}class ei extends T{pad_image(e,t,r,n={}){let[i,s,o]=t;return super.pad_image(e,t,{width:s+(r-s%r)%r,height:i+(r-i%r)%r},{mode:"symmetric",center:!1,constant_values:-1,...n})}}class es extends T{async _call(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);let r=await Promise.all(e.map(e=>this.preprocess(e))),n=await Promise.all(t.map(e=>this.preprocess(e,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0})));return{pixel_values:(0,f.kn)(r.map((e,t)=>(0,f.d3)([e.pixel_values,n[t].pixel_values],0)),0),original_sizes:r.map(e=>e.original_size),reshaped_input_sizes:r.map(e=>e.reshaped_input_size)}}}class eo extends M{constructor(e){super(e),this.config.mel_filters??=k(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney"),this.window=z(this.config.n_fft,"hann")}_extract_fbank_features(e){let{data:t,dims:r}=I(e,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:this.config.nb_max_frames}),n=(0,u.Fp)(t)[0];for(let e=0;ethis.config.n_samples?(console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),t=e.slice(0,this.config.n_samples)):(t=new Float32Array(this.config.n_samples)).set(e);let{data:r,dims:n}=this._extract_fbank_features(t);return{input_features:new f.es("float32",r,[1,...n])}}}class ea extends M{_zero_mean_unit_var_norm(e){let t=e.reduce((e,t)=>e+t,0)/e.length,r=e.reduce((e,r)=>e+(r-t)**2,0)/e.length;return e.map(e=>(e-t)/Math.sqrt(r+1e-7))}async _call(e){S(e,"Wav2Vec2FeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=e;this.config.do_normalize&&(t=this._zero_mean_unit_var_norm(t));let r=[1,t.length];return{input_values:new f.es("float32",t,r),attention_mask:new f.es("int64",new BigInt64Array(t.length).fill(1n),r)}}}class el extends M{constructor(e){super(e);let t=this.config.sampling_rate,r=k(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e32768*e),this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e,{padding:t=!0,pad_to_multiple_of:r=2,do_normalize_per_mel_bins:n=!0,return_attention_mask:i=!0}={}){let s;S(e,"SeamlessM4TFeatureExtractor");let o=this._extract_fbank_features(e,this.config.max_length);if(n){let[e,t]=o.dims;for(let r=0;r0){let r=new Float32Array(t*(e+n));r.set(o.data),r.fill(this.config.padding_value,o.data.length);let a=e+n;o={data:r,dims:[a,t]},i&&(s=new f.es("int64",new BigInt64Array(a),[1,a])).data.fill(1n,0,e)}}let[a,l]=o.dims,h=this.config.stride;if(0!=a%h)throw Error(`The number of frames (${a}) must be a multiple of the stride (${h}).`);let u=new f.es("float32",o.data,o.dims).view(1,Math.floor(a/h),l*h),c={input_features:u};if(i){let e=u.dims[1],t=new f.es("int64",new BigInt64Array(e),[1,e]);if(s)for(let e=1,r=0;e0){if("rand_trunc"===r){s=!0;let r=Math.floor(Math.random()*(o+1));e=e.subarray(r,r+t),(i=this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)).dims=[1,...i.dims]}else throw Error(`Truncation strategy "${r}" not implemented`)}else{if(o<0){let r=new Float64Array(t);if(r.set(e),"repeat"===n)for(let n=e.length;n_.read(e)))}async function eb(e,t){return Array.isArray(e)||(e=[e]),await Promise.all(e.map(e=>"string"==typeof e||e instanceof URL?w(e,t):e instanceof Float64Array?new Float32Array(e):e))}function ev(e,t){t&&(e=e.map(e=>0|e));let[r,n,i,s]=e;return{xmin:r,ymin:n,xmax:i,ymax:s}}class ex extends l.Ag{constructor({task:e,model:t,tokenizer:r=null,processor:n=null}){super(),this.task=e,this.model=t,this.tokenizer=r,this.processor=n}async dispose(){await this.model.dispose()}}class eE extends ex{constructor(e){super(e)}async _call(e,{topk:t=1}={}){let r=this.tokenizer(e,{padding:!0,truncation:!0}),n=await this.model(r),i="multi_label_classification"===this.model.config.problem_type?e=>e.sigmoid().data:e=>(0,u.XA)(e.data),s=this.model.config.id2label,o=[];for(let e of n.logits){let r=i(e),n=(0,u.em)(r,t).map(e=>({label:s[e[0]],score:e[1]}));1===t?o.push(...n):o.push(n)}return Array.isArray(e)||1===t?o:o[0]}}class eA extends ex{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){let r=Array.isArray(e),n=this.tokenizer(r?e:[e],{padding:!0,truncation:!0}),i=(await this.model(n)).logits,s=this.model.config.id2label,o=[];for(let e=0;e[e,t]).filter(e=>e[1]>o),h=Array.from((0,u.XA)(i.end_logits[e].data)).map((e,t)=>[e,t]).filter(e=>e[1]>o),f=(0,l.O7)(a,h).filter(e=>e[0][1]<=e[1][1]).map(e=>[e[0][1],e[1][1],e[0][0]*e[1][0]]).sort((e,t)=>t[2]-e[2]);for(let e=0;e{let t=[...s];return t[o]=e[0],{score:e[1],token:e[0],token_str:this.tokenizer.model.vocab[e[0]],sequence:this.tokenizer.decode(t,{skip_special_tokens:!0})}}))}return Array.isArray(e)?i:i[0]}}class eI extends ex{_key="generated_text";constructor(e){super(e)}async _call(e,t={}){let r;Array.isArray(e)||(e=[e]),this.model.config.prefix&&(e=e.map(e=>this.model.config.prefix+e));let n=this.model.config.task_specific_params;n&&n[this.task]&&n[this.task].prefix&&(e=e.map(e=>n[this.task].prefix+e));let i=this.tokenizer,s={padding:!0,truncation:!0};r=this instanceof eC&&"_build_translation_inputs"in i?i._build_translation_inputs(e,s,t).input_ids:i(e,s).input_ids;let o=await this.model.generate(r,t);return i.batch_decode(o,{skip_special_tokens:!0}).map(e=>({[this._key]:e}))}}class ez extends eI{_key="summary_text";constructor(e){super(e)}}class eC extends eI{_key="translation_text";constructor(e){super(e)}}function eS(e){return Array.isArray(e)&&e.every(e=>"role"in e&&"content"in e)}class eO extends ex{constructor(e){super(e)}async _call(e,t={}){let r,n,i=!1,s=!1;if("string"==typeof e)r=e=[e];else if(Array.isArray(e)&&e.every(e=>"string"==typeof e))i=!0,r=e;else{if(eS(e))e=[e];else if(Array.isArray(e)&&e.every(eS))i=!0;else throw Error("Input must be a string, an array of strings, a Chat, or an array of Chats");s=!0,r=e.map(e=>this.tokenizer.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0}))}let o=t.add_special_tokens??!1,a=!s&&(t.return_full_text??!0);this.tokenizer.padding_side="left";let{input_ids:l,attention_mask:h}=this.tokenizer(r,{add_special_tokens:o,padding:!0,truncation:!0}),u=await this.model.generate(l,t,null,{inputs_attention_mask:h}),f=this.tokenizer.batch_decode(u,{skip_special_tokens:!0});!a&&l.dims.at(-1)>0&&(n=this.tokenizer.batch_decode(l,{skip_special_tokens:!0}).map(e=>e.length));let c=Array.from({length:e.length},e=>[]);for(let t=0;t[e.toLowerCase(),t])),this.entailment_id=this.label2id.entailment,void 0===this.entailment_id&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,void 0===this.contradiction_id&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(e,t,{hypothesis_template:r="This example is {}.",multi_label:n=!1}={}){let i=Array.isArray(e);i||(e=[e]),Array.isArray(t)||(t=[t]);let s=t.map(e=>r.replace("{}",e)),o=n||1===t.length,a=[];for(let r of e){let e=[];for(let t of s){let n=this.tokenizer(r,{text_pair:t,padding:!0,truncation:!0}),i=await this.model(n);o?e.push([i.logits.data[this.contradiction_id],i.logits.data[this.entailment_id]]):e.push(i.logits.data[this.entailment_id])}let n=(o?e.map(e=>(0,u.XA)(e)[1]):(0,u.XA)(e)).map((e,t)=>[e,t]).sort((e,t)=>t[0]-e[0]);a.push({sequence:r,labels:n.map(e=>t[e[1]]),scores:n.map(e=>e[0])})}return i?a:a[0]}}class eM extends ex{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:r=!1,quantize:n=!1,precision:i="binary"}={}){let s=this.tokenizer(e,{padding:!0,truncation:!0}),o=await this.model(s),a=o.last_hidden_state??o.logits;if("none"===t);else if("mean"===t)a=(0,f.v6)(a,s.attention_mask);else if("cls"===t)a=a.slice(null,0);else throw Error(`Pooling method '${t}' not supported.`);return r&&(a=a.normalize(2,-1)),n&&(a=(0,f.e)(a,i)),a}}class eT extends ex{constructor(e){super(e)}async _call(e,{pool:t=null}={}){let r;let n=await ew(e),{pixel_values:i}=await this.processor(n),s=await this.model({pixel_values:i});if(t){if(!("pooler_output"in s))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");r=s.pooler_output}else r=s.last_hidden_state??s.logits??s.image_embeds;return r}}class e$ extends ex{constructor(e){super(e)}async _call(e,{topk:t=null}={}){let r=!Array.isArray(e),n=this.processor.feature_extractor.config.sampling_rate,i=await eb(e,n),s=this.model.config.id2label,o=[];for(let e of i){let r=await this.processor(e),n=(await this.model(r)).logits[0],i=(0,u.em)((0,u.XA)(n.data),t).map(e=>({label:s[e[0]],score:e[1]}));1===t?o.push(...i):o.push(i)}return r&&1!==t?o[0]:o}}class eL extends ex{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a sound of {}."}={}){let n=!Array.isArray(e);n&&(e=[e]);let i=t.map(e=>r.replace("{}",e)),s=this.tokenizer(i,{padding:!0,truncation:!0}),o=this.processor.feature_extractor.config.sampling_rate,a=await eb(e,o),l=[];for(let e of a){let r=await this.processor(e),n=await this.model({...s,...r}),i=(0,u.XA)(n.logits_per_audio.data);l.push([...i].map((e,r)=>({score:e,label:t[r]})))}return n?l[0]:l}}class eR extends ex{constructor(e){super(e)}async _call(e,t={}){switch(this.model.config.model_type){case"whisper":return this._call_whisper(e,t);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":return this._call_wav2vec2(e,t);default:throw Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(e,t={}){t.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),t.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');let r=!Array.isArray(e);r&&(e=[e]);let n=this.processor.feature_extractor.config.sampling_rate,i=await eb(e,n),s=[];for(let e of i){let t=await this.processor(e),r=(await this.model(t)).logits[0],n=[];for(let e of r)n.push((0,u.Fp)(e.data)[1]);let i=this.tokenizer.decode(n);s.push({text:i})}return r?s[0]:s}async _call_whisper(e,t={}){let r=t.return_timestamps??!1,n=t.chunk_length_s??0,i=t.chunk_callback??null,s=t.force_full_sequences??!1,o=t.stride_length_s??null;"word"===r&&(t.return_token_timestamps=!0);let a=(0,l.Sw)(t,"language",null),h=(0,l.Sw)(t,"task",null);if(a||h||r){if(t.forced_decoder_ids)throw Error("Cannot specify `language`/`task`/`return_timestamps` and `forced_decoder_ids` at the same time.");let e=this.tokenizer.get_decoder_prompt_ids({language:a,task:h,no_timestamps:!r});e.length>0&&(t.forced_decoder_ids=e)}let f=!Array.isArray(e);f&&(e=[e]);let c=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,d=this.processor.feature_extractor.config.hop_length,p=this.processor.feature_extractor.config.sampling_rate,g=await eb(e,p),m=[];for(let e of g){let a=[];if(n>0){if(null===o)o=n/6;else if(n<=o)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");let t=p*n,r=p*o,i=t-2*r,s=0;for(;s=e.length;a.push({stride:[n.length,l?0:r,h?0:r],input_features:o.input_features,is_last:h}),s+=i}}else a=[{stride:[e.length,0,0],input_features:(await this.processor(e)).input_features,is_last:!0}];for(let e of a){t.num_frames=Math.floor(e.stride[0]/d);let n=await this.model.generate(e.input_features,t);"word"===r?(e.tokens=n.sequences[0],e.token_timestamps=n.token_timestamps.tolist()[0].map(e=>(0,u.NM)(e,2))):e.tokens=n[0],e.stride=e.stride.map(e=>e/p),null!==i&&i(e)}let[l,h]=this.tokenizer._decode_asr(a,{time_precision:c,return_timestamps:r,force_full_sequences:s});m.push({text:l,...h})}return f?m[0]:m}}class ej extends ex{constructor(e){super(e)}async _call(e,t={}){let r=Array.isArray(e),n=await ew(e),{pixel_values:i}=await this.processor(n),s=[];for(let e of i){e.dims=[1,...e.dims];let r=await this.model.generate(e,t),n=this.tokenizer.batch_decode(r,{skip_special_tokens:!0}).map(e=>({generated_text:e.trim()}));s.push(n)}return r?s:s[0]}}class eF extends ex{constructor(e){super(e)}async _call(e,{topk:t=1}={}){let r=Array.isArray(e),n=await ew(e),{pixel_values:i}=await this.processor(n),s=await this.model({pixel_values:i}),o=this.model.config.id2label,a=[];for(let e of s.logits){let r=(0,u.em)((0,u.XA)(e.data),t).map(e=>({label:o[e[0]],score:e[1]}));1===t?a.push(...r):a.push(r)}return r||1===t?a:a[0]}}class eN extends ex{constructor(e){super(e),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(e,{threshold:t=.5,mask_threshold:r=.5,overlap_mask_area_threshold:n=.8,label_ids_to_fuse:i=null,target_sizes:s=null,subtask:o=null}={}){if(Array.isArray(e)&&1!==e.length)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");let a=await ew(e),l=a.map(e=>[e.height,e.width]),{pixel_values:h,pixel_mask:u}=await this.processor(a),f=await this.model({pixel_values:h,pixel_mask:u}),c=null;if(null!==o)c=this.subtasks_mapping[o];else for(let[e,t]of Object.entries(this.subtasks_mapping))if(t in this.processor.feature_extractor){c=this.processor.feature_extractor[t].bind(this.processor.feature_extractor),o=e;break}let d=this.model.config.id2label,p=[];if("panoptic"===o||"instance"===o){let e=c(f,t,r,n,i,s??l)[0],o=e.segmentation;for(let t of e.segments_info){let e=new Uint8ClampedArray(o.data.length);for(let r=0;rr.replace("{}",e)),o=this.tokenizer(s,{padding:"siglip"!==this.model.config.model_type||"max_length",truncation:!0}),{pixel_values:a}=await this.processor(i),l=await this.model({...o,pixel_values:a}),h="siglip"===this.model.config.model_type?e=>e.sigmoid().data:e=>(0,u.XA)(e.data),f=[];for(let e of l.logits_per_image){let r=[...h(e)].map((e,r)=>({score:e,label:t[r]}));r.sort((e,t)=>t.score-e.score),f.push(r)}return n?f:f[0]}}class eq extends ex{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:r=!1}={}){let n=Array.isArray(e);if(n&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");let i=await ew(e),s=r?null:i.map(e=>[e.height,e.width]),{pixel_values:o,pixel_mask:a}=await this.processor(i),l=await this.model({pixel_values:o,pixel_mask:a}),h=this.processor.feature_extractor.post_process_object_detection(l,t,s),u=this.model.config.id2label,f=h.map(e=>e.boxes.map((t,n)=>({score:e.scores[n],label:u[e.classes[n]],box:ev(t,!r)})));return n?f:f[0]}}class eH extends ex{constructor(e){super(e)}async _call(e,t,{threshold:r=.1,topk:n=null,percentage:i=!1}={}){let s=Array.isArray(e),o=await ew(e),a=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(o),h=[];for(let e=0;e({score:d.scores[r],label:t[d.classes[r]],box:ev(e,!i)})).sort((e,t)=>t.score-e.score);null!==n&&(p=p.slice(0,n)),h.push(p)}return s?h:h[0]}}class eG extends ex{constructor(e){super(e)}async _call(e,t,r={}){let n=(await ew(e))[0],{pixel_values:i}=await this.processor(n),s=`${t}`,o=this.tokenizer(s,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,a=await this.model.generate(i,{...r,decoder_input_ids:o,max_length:this.model.config.decoder.max_position_embeddings}),l=this.tokenizer.batch_decode(a)[0].match(/(.*?)<\/s_answer>/),h=null;return l&&l.length>=2&&(h=l[1].trim()),[{answer:h}]}}class eV extends ex{DEFAULT_VOCODER_ID="Xenova/speecht5_hifigan";constructor(e){super(e),this.vocoder=e.vocoder??null}async _call(e,{speaker_embeddings:t=null}={}){return this.processor?this._call_text_to_spectrogram(e,{speaker_embeddings:t}):this._call_text_to_waveform(e)}async _call_text_to_waveform(e){let t=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:r}=await this.model(t),n=this.model.config.sampling_rate;return{audio:r.data,sampling_rate:n}}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await a.$Sz.from_pretrained(this.DEFAULT_VOCODER_ID,{quantized:!1})),("string"==typeof t||t instanceof URL)&&(t=new Float32Array(await (await fetch(t)).arrayBuffer())),t instanceof Float32Array)t=new f.es("float32",t,[1,t.length]);else if(!(t instanceof f.es))throw Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");let{input_ids:r}=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:n}=await this.model.generate_speech(r,t,{vocoder:this.vocoder}),i=this.processor.feature_extractor.config.sampling_rate;return{audio:n.data,sampling_rate:i}}}class eD extends ex{constructor(e){super(e)}async _call(e){let t=await ew(e),r=await this.processor(t),n=await this.model(r),i=[];for(let e of n.reconstruction){let t=e.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");i.push(_.fromTensor(t))}return i.length>1?i:i[0]}}class eX extends ex{constructor(e){super(e)}async _call(e){let t=await ew(e),r=await this.processor(t),{predicted_depth:n}=await this.model(r),i=[];for(let e=0;e1?i:i[0]}}let eW=Object.freeze({"text-classification":{tokenizer:o.t2,pipeline:eE,model:a.o$X,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:o.t2,pipeline:eA,model:a.OjJ,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:o.t2,pipeline:ek,model:a.wiU,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:o.t2,pipeline:eB,model:a.t78,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:o.t2,pipeline:ez,model:a.Kf0,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:o.t2,pipeline:eC,model:a.Kf0,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:o.t2,pipeline:eI,model:a.Kf0,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:o.t2,pipeline:eO,model:a.Hqk,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:o.t2,pipeline:eU,model:a.o$X,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:e$,model:a.K2m,processor:e_,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:o.t2,pipeline:eL,model:a.$Sz,processor:e_,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:o.t2,pipeline:eR,model:[a.hZO,a.ENH],processor:e_,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:o.t2,pipeline:eV,model:[a.z6E,a.lbf],processor:[e_,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:o.t2,pipeline:ej,model:a.tLj,processor:e_,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:eF,model:a.En$,processor:e_,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:eN,model:[a.U$$,a.$Bv],processor:e_,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"zero-shot-image-classification":{tokenizer:o.t2,pipeline:eP,model:a.$Sz,processor:e_,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:eq,model:a.Zn,processor:e_,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:o.t2,pipeline:eH,model:a.LdW,processor:e_,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:o.t2,pipeline:eG,model:a.DcG,processor:e_,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:eD,model:a.S2d,processor:e_,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:eX,model:a.hY6,processor:e_,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:o.t2,pipeline:eM,model:a.$Sz,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:e_,pipeline:eT,model:[a.IFL,a.$Sz],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),eJ=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function eK(e,t=null,{quantized:r=!0,progress_callback:n=null,config:i=null,cache_dir:s=null,local_files_only:o=!1,revision:a="main"}={}){let h=eW[(e=eJ[e]??e).split("_",1)[0]];if(!h)throw Error(`Unsupported pipeline: ${e}. Must be one of [${Object.keys(eW)}]`);t||(t=h.default.model,console.log(`No model specified. Using default model: "${t}".`));let u=new Map([["tokenizer",h.tokenizer],["model",h.model],["processor",h.processor]]),f=await eY(u,t,{quantized:r,progress_callback:n,config:i,cache_dir:s,local_files_only:o,revision:a});return f.task=e,(0,l.T2)(n,{status:"ready",task:e,model:t}),new h.pipeline(f)}async function eY(e,t,r){let n=Object.create(null),i=[];for(let[s,o]of e.entries()){let e;o&&(e=Array.isArray(o)?new Promise(async(e,n)=>{let i;for(let n of o){if(null===n){e(null);return}try{e(await n.from_pretrained(t,r));return}catch(e){i=e}}n(i)}):o.from_pretrained(t,r),n[s]=e,i.push(e))}for(let[e,t]of(await Promise.all(i),Object.entries(n)))n[e]=await t;return n}r(90016)},20761:function(e,t,r){"use strict";function n(e,t){e&&e(t)}function i(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e]))}function s(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}r.d(t,{$2:function(){return i},Ag:function(){return o},Gg:function(){return h},O7:function(){return d},Sw:function(){return f},T2:function(){return n},Wy:function(){return l},eG:function(){return c},fU:function(){return a},hr:function(){return s},hs:function(){return p},jg:function(){return u}});let o=class{constructor(){let e=function(...t){return e._call(...t)};return Object.setPrototypeOf(e,new.target.prototype)}_call(...e){throw Error("Must implement _call method in subclass")}};function a(e){return e?.prototype?.__proto__?.constructor?.name==="TypedArray"}function l(e){return Number.isInteger(e)||"bigint"==typeof e}function h(e){return null!=e}function u(e){let t=[],r=e;for(;Array.isArray(r);)t.push(r.length),r=r[0];return t}function f(e,t,r){let n=e[t];if(void 0!==n)return delete e[t],n;if(void 0===r)throw Error(`Key ${t} does not exist in object.`);return r}function c(...e){return Array.prototype.concat.apply([],e)}function d(...e){return e.reduce((e,t)=>e.flatMap(e=>t.map(t=>[e,t])))}function p(e,t){return Math.abs((e+t)%(2*t)-t)}},81510:function(e,t,r){"use strict";r.d(t,{GA:function(){return i},Z3:function(){return n},pQ:function(){return o}});class n{constructor(e=(e,t)=>e>t){this._heap=[],this._comparator=e}get size(){return this._heap.length}isEmpty(){return 0===this.size}peek(){return this._heap[0]}push(...e){return this.extend(e)}extend(e){for(let t of e)this._heap.push(t),this._siftUp();return this.size}pop(){let e=this.peek(),t=this.size-1;return t>0&&this._swap(0,t),this._heap.pop(),this._siftDown(),e}replace(e){let t=this.peek();return this._heap[0]=e,this._siftDown(),t}_parent(e){return(e+1>>>1)-1}_left(e){return(e<<1)+1}_right(e){return e+1<<1}_greater(e,t){return this._comparator(this._heap[e],this._heap[t])}_swap(e,t){let r=this._heap[e];this._heap[e]=this._heap[t],this._heap[t]=r}_siftUp(){let e=this.size-1;for(;e>0&&this._greater(e,this._parent(e));)this._swap(e,this._parent(e)),e=this._parent(e)}_siftDown(){let e=0;for(;this._left(e)[]),this.endNodes=Array.from({length:this.len+1},()=>[]);let n=new a(this.bosTokenId,0,0,0,0),i=new a(this.eosTokenId,1,this.len,0,0);this.nodes.push(n.clone()),this.nodes.push(i.clone()),this.beginNodes[this.len].push(i),this.endNodes[0].push(n)}insert(e,t,r,n){let i=new a(n,this.nodes.length,e,t,r);this.beginNodes[e].push(i),this.endNodes[e+t].push(i),this.nodes.push(i)}viterbi(){let e=this.len,t=0;for(;t<=e;){if(0==this.beginNodes[t].length)return[];for(let e of this.beginNodes[t]){e.prev=null;let r=0,n=null;for(let i of this.endNodes[t]){let t=i.backtraceScore+e.score;(null===n||t>r)&&(n=i.clone(),r=t)}if(null===n)return[];e.prev=n,e.backtraceScore=r}++t}let r=[],n=this.beginNodes[e][0].prev;if(null===n)return[];let i=n.clone();for(;null!==i.prev;)r.push(i.clone()),i=i.clone().prev.clone();return r.reverse(),r}piece(e){return this.sentence.slice(e.pos,e.pos+e.length)}tokens(){return this.viterbi().map(e=>this.piece(e))}tokenIds(){return this.viterbi().map(e=>e.tokenId)}}class a{constructor(e,t,r,n,i){this.tokenId=e,this.nodeId=t,this.pos=r,this.length=n,this.score=i,this.prev=null,this.backtraceScore=0}clone(){let e=new a(this.tokenId,this.nodeId,this.pos,this.length,this.score);return e.prev=this.prev,e.backtraceScore=this.backtraceScore,e}}},45774:function(e,t,r){"use strict";r.d(t,{AE:function(){return m},C9:function(){return l},CJ:function(){return g},E:function(){return a},GU:function(){return u},Jj:function(){return d},Jm:function(){return s},Pg:function(){return f},Z4:function(){return _},aP:function(){return y},dZ:function(){return h},ez:function(){return p},jF:function(){return c}}),r(62414);var n=r(20761),i=r(68709);class s extends n.Ag{constructor(){super(),this.processors=[]}push(e){this.processors.push(e)}extend(e){this.processors.push(...e)}_call(e,t){for(let r of t)this.processors.forEach(t=>t(e,r))}[Symbol.iterator](){return this.processors.values()}}class o extends n.Ag{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class a extends o{constructor(e){super(),this.force_token_map=Object.fromEntries(e??[])}_call(e,t){let r=this.force_token_map[e.length];return(0,n.Gg)(r)&&(t.data.fill(-1/0),t.data[r]=0),t}}class l extends o{constructor(e){super(),this.bos_token_id=e}_call(e,t){return 1===e.length&&(t.data.fill(-1/0),t.data[this.bos_token_id]=0),t}}class h extends o{constructor(e,t){super(),this.max_length=e,this.forced_eos_token_id=t}_call(e,t){}}class u extends o{constructor(e,t){super(),this.begin_suppress_tokens=e,this.begin_index=t}_call(e,t){if(e.length===this.begin_index)for(let e of this.begin_suppress_tokens)t.data[e]=-1/0;return t}}class f extends o{constructor(e){super(),this.eos_token_id=e.eos_token_id,this.no_timestamps_token_id=e.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=(e.forced_decoder_ids||[]).length+2,e.forced_decoder_ids.slice(-1)[0][1]===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=e.max_initial_timestamp_index}_call(e,t){let r=t.data;if(r[this.no_timestamps_token_id]=-1/0,e.length===this.begin_index-1)return r.fill(-1/0),r[this.timestamp_begin]=0,t;let n=e.slice(this.begin_index),s=n.length>=1&&n[n.length-1]>=this.timestamp_begin,o=n.length<2||n[n.length-2]>=this.timestamp_begin;if(s&&(o?r.subarray(this.timestamp_begin).fill(-1/0):r.subarray(0,this.eos_token_id).fill(-1/0)),e.length===this.begin_index&&null!==this.max_initial_timestamp_index){let e=this.timestamp_begin+this.max_initial_timestamp_index;r.subarray(e+1).fill(-1/0)}let a=(0,i.CI)(r);return Math.log(a.subarray(this.timestamp_begin).map(Math.exp).reduce((e,t)=>e+t))>(0,i.Fp)(a.subarray(0,this.timestamp_begin))[0]&&r.subarray(0,this.timestamp_begin).fill(-1/0),t}}class c extends o{constructor(e){super(),this.no_repeat_ngram_size=e}getNgrams(e){let t=e.length,r=[];for(let n=0;n0&&(n=n.map(e=>e/this.generation_config.temperature)),n}randomSelect(e){let t=Math.random()*e.reduce((e,t)=>e+t,0);for(let r=0;r1)return new v(e);if(e.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${e.num_return_sequences}.`);return new w(e)}}class w extends _{sample(e,t=-1){let r=this.getLogits(e,t);return[[(0,i.Fp)(r)[1],0]]}}class b extends _{sample(e,t=-1){let r=e.dims.at(-1);this.generation_config.top_k>0&&(r=Math.min(this.generation_config.top_k,r));let n=this.getLogits(e,t),s=(0,i.em)(n,r),o=(0,i.XA)(s.map(e=>e[1]));return Array.from({length:this.generation_config.num_beams},()=>{let e=this.randomSelect(o);return[s[e][0],Math.log(o[e])]})}}class v extends _{sample(e,t=-1){let r=e.dims.at(-1);this.generation_config.top_k>0&&(r=Math.min(this.generation_config.top_k,r));let n=this.getLogits(e,t),s=(0,i.em)(n,r),o=(0,i.XA)(s.map(e=>e[1]));return Array.from({length:this.generation_config.num_beams},(e,t)=>[s[t][0],Math.log(o[t])])}}},40911:function(e,t,r){"use strict";r.d(t,{hn:function(){return c},st:function(){return m},yM:function(){return y}});var n=r(27147),i=r(31418),s=r(70319),o=r(50851),a=r(20761),l=r(25566),h=r(9109).Buffer;globalThis.ReadableStream||(globalThis.ReadableStream=s.ReadableStream);class u{_CONTENT_TYPE_MAP={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};constructor(e){if(this.filePath=e,this.headers=new Headers,this.exists=n.existsSync(e),this.exists){this.status=200,this.statusText="OK";let t=n.statSync(e);this.headers.set("content-length",t.size.toString()),this.updateContentType();let r=this;this.body=new ReadableStream({start(e){r.arrayBuffer().then(t=>{e.enqueue(new Uint8Array(t)),e.close()})}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){let e=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",this._CONTENT_TYPE_MAP[e]??"application/octet-stream")}clone(){let e=new u(this.filePath);return e.exists=this.exists,e.status=this.status,e.statusText=this.statusText,e.headers=new Headers(this.headers),e}async arrayBuffer(){return(await n.promises.readFile(this.filePath)).buffer}async blob(){return new Blob([await n.promises.readFile(this.filePath)],{type:this.headers.get("content-type")})}async text(){return await n.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function f(e,t=null){let r;try{r=new URL(e)}catch(e){return!1}return(!t||!!t.includes(r.hostname))&&("http:"===r.protocol||"https:"===r.protocol)}async function c(e){if(o.O.useFS&&!f(e))return new u(e);if(void 0===l||l?.release?.name!=="node")return fetch(e);{let t=!!l.env?.TESTING_REMOTELY,r=o.O.version,n=new Headers;if(n.set("User-Agent",`transformers.js/${r}; is_ci/${t};`),f(e,["huggingface.co","hf.co"])){let e=l.env?.HF_TOKEN??l.env?.HF_ACCESS_TOKEN;e&&n.set("Authorization",`Bearer ${e}`)}return fetch(e,{headers:n})}}let d={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};class p{constructor(e){this.path=e}async match(e){let t=new u(i.join(this.path,e));return t.exists?t:void 0}async put(e,t){let r=h.from(await t.arrayBuffer()),s=i.join(this.path,e);try{await n.promises.mkdir(i.dirname(s),{recursive:!0}),await n.promises.writeFile(s,r)}catch(e){console.warn("An error occurred while writing the file to cache:",e)}}}async function g(e,...t){for(let r of t)try{let t=await e.match(r);if(t)return t}catch(e){continue}}async function m(e,t,r=!0,n={}){let i,s,l,h;if(!o.O.allowLocalModels){if(n.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!o.O.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}if((0,a.T2)(n.progress_callback,{status:"initiate",name:e,file:t}),!i&&o.O.useBrowserCache){if("undefined"==typeof caches)throw Error("Browser cache is not available in this environment.");try{i=await caches.open("transformers-cache")}catch(e){console.warn("An error occurred while opening the browser cache:",e)}}if(!i&&o.O.useFSCache&&(i=new p(n.cache_dir??o.O.cacheDir)),!i&&o.O.useCustomCache){if(!o.O.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!o.O.customCache.match||!o.O.customCache.put)throw Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");i=o.O.customCache}let u=n.revision??"main",m=w(e,t),y=w(o.O.localModelPath,m),b=w(o.O.remoteHost,o.O.remotePathTemplate.replaceAll("{model}",e).replaceAll("{revision}",encodeURIComponent(u)),t),v="main"===u?m:w(e,u,t),x=i instanceof p?v:b,E=!1;i&&(l=await g(i,y,x));let A=void 0!==l;if(void 0===l){if(o.O.allowLocalModels){if(f(m)){if(n.local_files_only)throw Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${m}.`);if(!o.O.allowRemoteModels)throw Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${m}.`)}else try{l=await c(y),s=y}catch(e){console.warn(`Unable to load from local path "${y}": "${e}"`)}}if(void 0===l||404===l.status){if(n.local_files_only||!o.O.allowRemoteModels){if(!r)return null;throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${y}".`)}if(200!==(l=await c(b)).status)return function(e,t,r){if(!r)return null;let n=d[e]??`Error (${e}) occurred while trying to load file`;throw Error(`${n}: "${t}".`)}(l.status,b,r);s=x}E=i&&"undefined"!=typeof Response&&l instanceof Response&&200===l.status}(0,a.T2)(n.progress_callback,{status:"download",name:e,file:t});let k={status:"progress",name:e,file:t};return n.progress_callback?A&&"undefined"!=typeof navigator&&/firefox/i.test(navigator.userAgent)?(h=new Uint8Array(await l.arrayBuffer()),(0,a.T2)(n.progress_callback,{...k,progress:100,loaded:h.length,total:h.length})):h=await _(l,e=>{(0,a.T2)(n.progress_callback,{...k,...e})}):h=new Uint8Array(await l.arrayBuffer()),E&&s&&await i.match(s)===void 0&&await i.put(s,new Response(h,{headers:l.headers})).catch(e=>{console.warn(`Unable to add response to browser cache: ${e}.`)}),(0,a.T2)(n.progress_callback,{status:"done",name:e,file:t}),h}async function y(e,t,r=!0,n={}){let i=await m(e,t,r,n);return null===i?{}:JSON.parse(new TextDecoder("utf-8").decode(i))}async function _(e,t){let r=e.headers.get("Content-Length");null===r&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let n=parseInt(r??"0"),i=new Uint8Array(n),s=0,o=e.body.getReader();async function a(){let{done:e,value:r}=await o.read();if(e)return;let l=s+r.length;if(l>n){let e=new Uint8Array(n=l);e.set(i),i=e}return i.set(r,s),t({progress:(s=l)/n*100,loaded:s,total:n}),a()}return await a(),i}function w(...e){return(e=e.map((t,r)=>(r&&(t=t.replace(RegExp("^/"),"")),r!==e.length-1&&(t=t.replace(RegExp("/$"),"")),t))).join("/")}},68709:function(e,t,r){"use strict";function n(e,[t,r,n],[i,s],o="bilinear",a=!1){let l=s/n,h=i/r,u=new e.constructor(i*s*t),f=r*n,c=i*s;for(let o=0;o=0;--e)i[e]=s,n[e]=t[r[e]],s*=n[e];let s=r.map((e,t)=>i[r.indexOf(t)]),o=new e.constructor(e.length);for(let r=0;r=0;--e)n+=i%t[e]*s[e],i=Math.floor(i/t[e]);o[n]=e[r]}return[o,n]}function s(e){let t=h(e)[0],r=e.map(e=>Math.exp(e-t)),n=r.reduce((e,t)=>e+t,0);return r.map(e=>e/n)}function o(e){return s(e).map(e=>Math.log(e))}function a(e,t=0){return e=Array.from(e).map((e,t)=>[t,e]).sort((e,t)=>t[1]-e[1]),null!==t&&t>0&&(e=e.slice(0,t)),e}function l(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],r=0;for(let n=1;nt&&(t=e[n],r=n);return[Number(t),r]}function u(e){return e>0&&(e&e-1)==0}r.d(t,{CI:function(){return o},Fp:function(){return h},NM:function(){return g},Nq:function(){return n},VV:function(){return l},XA:function(){return s},eT:function(){return m},em:function(){return a},nu:function(){return i},qC:function(){return p},vw:function(){return d}});class f{constructor(e){if(this.size=0|e,this.size<=1||!u(this.size))throw Error("FFT size must be a power of two larger than 1");this._csize=e<<1,this.table=new Float64Array(2*this.size);for(let e=0;ee;e<<=1)++t;this._width=t%2==0?t-1:t,this._bitrev=new Int32Array(1<>>t&3)<>>1);for(let t=0;t>>1]=e[t];return r}toComplexArray(e,t){let r=t||this.createComplexArray();for(let t=0;t>>1],r[t+1]=0;return r}completeSpectrum(e){let t=this._csize,r=t>>>1;for(let n=2;n>=2;o>=2;o>>=2){let t=(a=s/o<<1)>>>2;for(n=0;n>>1,o>>>1)}else for(n=0,i=0;n>>1,o>>>1,r)}for(o>>=2;o>=2;o>>=2){let t=(a=s/o<<1)>>>2;for(n=0;n>1;++t){let r=(t+1-e)**2/2,n=Math.sqrt(a**2+l**2)**r,o=r*Math.atan2(l,a),h=2*t;i[h]=n*Math.cos(o),i[h+1]=n*Math.sin(o),s[h]=i[h],s[h+1]=-i[h+1]}this._slicedChirpBuffer=i.subarray(t,r),this._f=new f(n>>1),this._f.transform(this._chirpBuffer,s)}_transform(e,t,r){let n=this._buffer1,i=this._buffer2,s=this._outBuffer1,o=this._outBuffer2,a=this._chirpBuffer,l=this._slicedChirpBuffer,h=this._a;if(r)for(let e=0;e>1];n[e]=i*l[e],n[r]=i*l[r]}else for(let e=0;e=e.length&&(i=2*(e.length-1)-i),n[s++]=e[i]}n.sort(),r[t]=n[i]}return r}function g(e,t){let r=Math.pow(10,t);return Math.round(e*r)/r}function m(e){let t=Math.round(e);return Math.abs(e)%1==.5?t%2==0?t:t-1:t}},62414:function(e,t,r){"use strict";r.d(t,{J6:function(){return m},Ks:function(){return y},d3:function(){return d},e:function(){return w},es:function(){return a},f3:function(){return g},kn:function(){return p},r6:function(){return _},sX:function(){return l},v6:function(){return h}});var n=r(71542),i=r(68709);let s=Object.freeze({float32:Float32Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array}),o=n.ONNX.Tensor;class a{dims;type;data;size;constructor(...e){return e[0]instanceof o?Object.assign(this,e[0]):Object.assign(this,new o(e[0],e[1],e[2])),new Proxy(this,{get:(e,t)=>{if("string"==typeof t){let r=Number(t);if(Number.isInteger(r))return e._getitem(r)}return e[t]},set:(e,t,r)=>e[t]=r})}*[Symbol.iterator](){let[e,...t]=this.dims;if(t.length>0){let r=t.reduce((e,t)=>e*t);for(let n=0;n0))return new a(this.type,[this.data[e]],r);{let t=r.reduce((e,t)=>e*t);return this._subarray(e,t,r)}}indexOf(e){for(let t=0;te*t))throw Error(`cannot reshape array of size ${r} into shape (${t})`);let n=e;for(let e=t.length-1;e>=0;e--)n=n.reduce((r,n)=>{let i=r[r.length-1];return i.lengthi[1])throw Error(`Invalid slice: ${i}`);let e=[Math.max(i[0],0),Math.min(i[1],this.dims[n])];r.push(e),t.push(e[1]-e[0])}else throw Error(`Invalid slice: ${i}`)}let n=r.map(([e,t])=>t-e),i=n.reduce((e,t)=>e*t),s=new this.data.constructor(i),o=this.stride();for(let e=0;e=0;--i){let e=n[i];t+=(s%e+r[i][0])*o[i],s=Math.floor(s/e)}s[e]=this.data[t]}return new a(this.type,s,t)}permute(...e){return function(e,t){let[r,n]=(0,i.nu)(e.data,e.dims,t);return new a(e.type,r,n)}(this,e)}transpose(...e){return this.permute(...e)}sum(e=null,t=!1){return this.norm(1,e,t)}norm(e="fro",t=null,r=!1){if("fro"===e)e=2;else if("string"==typeof e)throw Error(`Unsupported norm: ${e}`);if(null===t){let t=this.data.reduce((t,r)=>t+r**e,0)**(1/e);return new a(this.type,[t],[])}t=c(t,this.dims.length);let n=this.dims.slice();n[t]=1;let i=new this.data.constructor(this.data.length/this.dims[t]);for(let r=0;r=0;--e){let r=this.dims[e];e!==t&&(s+=i%r*o,o*=n[e]),i=Math.floor(i/r)}i[s]+=this.data[r]**e}if(1!==e)for(let t=0;t=0;--r){let e=this.dims[r];r!==t&&(n+=i%e*s,s*=this.dims[r]),i=Math.floor(i/e)}this.data[e]/=r.data[n]}return this}normalize(e=2,t=1){return this.clone().normalize_(e,t)}stride(){return function(e){let t=Array(e.length);for(let r=e.length-1,n=1;r>=0;--r)t[r]=n,n*=e[r];return t}(this.dims)}squeeze(e=null){return new a(this.type,this.data,u(this.dims,e))}squeeze_(e=null){return this.dims=u(this.dims,e),this}unsqueeze(e=null){return new a(this.type,this.data,f(this.dims,e))}unsqueeze_(e=null){return this.dims=f(this.dims,e),this}flatten_(e=0,t=-1){t=(t+this.dims.length)%this.dims.length;let r=this.dims.slice(0,e),n=this.dims.slice(e,t+1),i=this.dims.slice(t+1);return this.dims=[...r,n.reduce((e,t)=>e*t,1),...i],this}flatten(e=0,t=-1){return this.clone().flatten_(e,t)}view(...e){let t=-1;for(let r=0;rn!==t?e*r:e,1);e[t]=this.data.length/r}return new a(this.type,this.data,e)}neg_(){for(let e=0;e1!==e):"number"==typeof t?1===e[t]&&e.splice(t,1):Array.isArray(t)&&(e=e.filter((e,r)=>1!==e||!t.includes(r))),e}function f(e,t){return t=c(t,e.length+1),(e=e.slice()).splice(t,0,1),e}function c(e,t,r=null){if(e<-t||e>=t)throw Error(`IndexError: index ${e} is out of bounds for dimension${null===r?"":" "+r} with size ${t}`);return e<0&&(e=(e%t+t)%t),e}function d(e,t=0){t=c(t,e[0].dims.length);let r=e[0].dims.slice();r[t]=e.reduce((e,r)=>e+r.dims[t],0);let n=r.reduce((e,t)=>e*t,1),i=new e[0].data.constructor(n),s=e[0].type;if(0===t){let t=0;for(let r of e)i.set(r.data,t),t+=r.data.length}else{let n=0;for(let s=0;s=0;--i){let e=o.dims[i],h=a%e;i===t&&(h+=n),s+=h*l,l*=r[i],a=Math.floor(a/e)}i[s]=o.data[e]}n+=o.dims[t]}}return new a(s,i,r)}function p(e,t=0){return d(e.map(e=>e.unsqueeze(t)),t)}function g(e,t=null,r=1,n=!1){if(null===t){let t=e.data.reduce((e,t)=>e+t,0)/e.data.length,n=Math.sqrt(e.data.reduce((e,r)=>e+(r-t)**2,0)/(e.data.length-r)),i=new a(e.type,[t],[]);return[new a(e.type,[n],[]),i]}t=c(t,e.dims.length);let i=m(e,t,n),s=e.dims.slice();s[t]=1;let o=new e.data.constructor(e.data.length/e.dims[t]);for(let r=0;r=0;--i){let r=e.dims[i];i!==t&&(n+=o%r*a,a*=s[i]),o=Math.floor(o/r)}o[n]+=(e.data[r]-i.data[n])**2}for(let n=0;ne+t,0);return new a(e.type,[t/e.data.length],[])}t=c(t,e.dims.length);let n=e.dims.slice();n[t]=1;let i=new e.data.constructor(e.data.length/e.dims[t]);for(let r=0;r=0;--i){let r=e.dims[i];i!==t&&(s+=o%r*a,a*=n[i]),o=Math.floor(o/r)}i[s]+=e.data[r]}if(1!==e.dims[t])for(let r=0;r0||l>0;)switch(h.push(o-1),u.push(l-1),s[o][l].item()){case 0:--o,--l;break;case 1:--o;break;case 2:--l;break;default:throw Error(`Internal error in dynamic time warping. Unexpected trace[${o}, ${l}]. Please file a bug report.`)}return h.reverse(),u.reverse(),[h,u]}function _(e){var t;return new a("int64",new BigInt64Array((t=e.dims).reduce((e,t)=>e*t,1)).fill(1n),t)}function w(e,t){if(2!==e.dims.length)throw Error("The tensor must have 2 dimensions");if(e.dims.at(-1)%8!=0)throw Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(t))throw Error("The precision must be either 'binary' or 'ubinary'");let r="binary"===t,n=r?Int8Array:Uint8Array,i=e.data,s=new n(i.length/8);for(let e=0;e0?1:0,n=Math.floor(e/8),o=e%8;s[n]|=t<<7-o,r&&0===o&&(s[n]-=128)}return new a(r?"int8":"uint8",s,[e.dims[0],e.dims[1]/8])}},36393:function(e,t,r){"use strict";var n=r(37836);t.Z=n}}]); \ No newline at end of file diff --git a/_next/static/chunks/708-689e257ca99149f8.js b/_next/static/chunks/708-689e257ca99149f8.js new file mode 100644 index 0000000000000000000000000000000000000000..51f6a7599de3e11ebd1e2c539a4c7ba2e8bd0cb5 --- /dev/null +++ b/_next/static/chunks/708-689e257ca99149f8.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[708],{48738:function(t,e){"use strict";e.byteLength=function(t){var e=u(t),n=e[0],r=e[1];return(n+r)*3/4-r},e.toByteArray=function(t){var e,n,i=u(t),c=i[0],s=i[1],a=new o((c+s)*3/4-s),f=0,h=s>0?c-4:c;for(n=0;n>16&255,a[f++]=e>>8&255,a[f++]=255&e;return 2===s&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,a[f++]=255&e),1===s&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,a[f++]=e>>8&255,a[f++]=255&e),a},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],c=0,s=r-o;c>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return i.join("")}(t,c,c+16383>s?s:c+16383));return 1===o?i.push(n[(e=t[r-1])>>2]+n[e<<4&63]+"=="):2===o&&i.push(n[(e=(t[r-2]<<8)+t[r-1])>>10]+n[e>>4&63]+n[e<<2&63]+"="),i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,s=i.length;c0)throw Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");-1===n&&(n=e);var r=n===e?0:4-n%4;return[n,r]}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},37836:function(t){"use strict";var e=Object.prototype.hasOwnProperty,n="~";function r(){}function o(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,r,i,c){if("function"!=typeof r)throw TypeError("The listener must be a function");var s=new o(r,i||t,c),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],s]:t._events[u].push(s):(t._events[u]=s,t._eventsCount++),t}function c(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,o=[];if(0===this._eventsCount)return o;for(r in t=this._events)e.call(t,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,c=Array(i);o */e.read=function(t,e,n,r,o){var i,c,s=8*o-r-1,u=(1<>1,f=-7,h=n?o-1:0,l=n?-1:1,p=t[e+h];for(h+=l,i=p&(1<<-f)-1,p>>=-f,f+=s;f>0;i=256*i+t[e+h],h+=l,f-=8);for(c=i&(1<<-f)-1,i>>=-f,f+=r;f>0;c=256*c+t[e+h],h+=l,f-=8);if(0===i)i=1-a;else{if(i===u)return c?NaN:1/0*(p?-1:1);c+=Math.pow(2,r),i-=a}return(p?-1:1)*c*Math.pow(2,i-r)},e.write=function(t,e,n,r,o,i){var c,s,u,a=8*i-o-1,f=(1<>1,l=23===o?5960464477539062e-23:0,p=r?0:i-1,v=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(isNaN(e=Math.abs(e))||e===1/0?(s=isNaN(e)?1:0,c=f):(c=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-c))<1&&(c--,u*=2),c+h>=1?e+=l/u:e+=l*Math.pow(2,1-h),e*u>=2&&(c++,u/=2),c+h>=f?(s=0,c=f):c+h>=1?(s=(e*u-1)*Math.pow(2,o),c+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,o),c=0));o>=8;t[n+p]=255&s,p+=v,s/=256,o-=8);for(c=c<0;t[n+p]=255&c,p+=v,c/=256,a-=8);t[n+p-v]|=128*y}},25566:function(t){var e,n,r,o=t.exports={};function i(){throw Error("setTimeout has not been defined")}function c(){throw Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:c}catch(t){n=c}}();var u=[],a=!1,f=-1;function h(){a&&r&&(a=!1,r.length?u=r.concat(u):f=-1,u.length&&l())}function l(){if(!a){var t=s(h);a=!0;for(var e=u.length;e;){for(r=u,u=[];++f1)for(var n=1;n0?f-4:f;for(r=0;r>16&255,h[l++]=e>>8&255,h[l++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,h[l++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,h[l++]=e>>8&255,h[l++]=255&e),h},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],f=0,u=n-i;f>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}(t,f,f+16383>u?u:f+16383));return 1===i?o.push(r[(e=t[n-1])>>2]+r[e<<4&63]+"=="):2===i&&o.push(r[(e=(t[n-2]<<8)+t[n-1])>>10]+r[e>>4&63]+r[e<<2&63]+"="),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,u=o.length;f0)throw Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");-1===r&&(r=e);var n=r===e?0:4-r%4;return[r,n]}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},9109:function(t,e,r){"use strict";/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */let n=r(48738),i=r(6868),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function f(t){if(t>2147483647)throw RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw TypeError('The "string" argument must be of type string. Received type number');return l(t)}return s(t,e,r)}function s(t,e,r){if("string"==typeof t)return function(t,e){if(("string"!=typeof e||""===e)&&(e="utf8"),!u.isEncoding(e))throw TypeError("Unknown encoding: "+e);let r=0|y(t,e),n=f(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(k(t,Uint8Array)){let e=new Uint8Array(t);return c(e.buffer,e.byteOffset,e.byteLength)}return a(t)}(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(k(t,ArrayBuffer)||t&&k(t.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(k(t,SharedArrayBuffer)||t&&k(t.buffer,SharedArrayBuffer)))return c(t,e,r);if("number"==typeof t)throw TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);let i=function(t){var e;if(u.isBuffer(t)){let e=0|p(t.length),r=f(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||(e=t.length)!=e?f(0):a(t):"Buffer"===t.type&&Array.isArray(t.data)?a(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw TypeError('"size" argument must be of type number');if(t<0)throw RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return h(t),f(t<0?0:0|p(t))}function a(t){let e=t.length<0?0:0|p(t.length),r=f(e);for(let n=0;n=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||k(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return N(t).length;default:if(i)return n?-1:$(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){let i=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(e>>>=0)))return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(o=r=+r)!=o&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return -1;r=t.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e)return(e&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,i);throw TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){let o,f=1,u=t.length,s=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return -1;f=2,u/=2,s/=2,r/=2}function h(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){let n=-1;for(o=r;ou&&(r=u-s),o=r;o>=0;o--){let r=!0;for(let n=0;n239?4:e>223?3:e>191?2:1;if(i+f<=r){let r,n,u,s;switch(f){case 1:e<128&&(o=e);break;case 2:(192&(r=t[i+1]))==128&&(s=(31&e)<<6|63&r)>127&&(o=s);break;case 3:r=t[i+1],n=t[i+2],(192&r)==128&&(192&n)==128&&(s=(15&e)<<12|(63&r)<<6|63&n)>2047&&(s<55296||s>57343)&&(o=s);break;case 4:r=t[i+1],n=t[i+2],u=t[i+3],(192&r)==128&&(192&n)==128&&(192&u)==128&&(s=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&u)>65535&&s<1114112&&(o=s)}}null===o?(o=65533,f=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=f}return function(t){let e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nr)throw RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,i,o){if(!u.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw RangeError("Index out of range")}function A(t,e,r,n,i){_(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,r}function v(t,e,r,n,i){_(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=f,f>>=8,t[r+2]=f,f>>=8,t[r+1]=f,f>>=8,t[r]=f,r+8}function I(t,e,r,n,i,o){if(r+n>t.length||r<0)throw RangeError("Index out of range")}function U(t,e,r,n,o){return e=+e,r>>>=0,o||I(t,e,r,4,34028234663852886e22,-34028234663852886e22),i.write(t,e,r,n,23,4),r+4}function T(t,e,r,n,o){return e=+e,r>>>=0,o||I(t,e,r,8,17976931348623157e292,-17976931348623157e292),i.write(t,e,r,n,52,8),r+8}e.Buffer=u,e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=function(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return s(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return(h(t),t<=0)?f(t):void 0!==e?"string"==typeof r?f(t).fill(e,r):f(t).fill(e):f(t)},u.allocUnsafe=function(t){return l(t)},u.allocUnsafeSlow=function(t){return l(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(k(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),k(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);in.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else if(u.isBuffer(e))e.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=e.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){let t=this.length;if(t%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;er&&(t+=" ... "),""},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(k(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;let o=i-n,f=r-e,s=Math.min(o,f),h=this.slice(n,i),l=t.slice(e,r);for(let t=0;t>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let c=this.length-e;if((void 0===r||r>c)&&(r=c),t.length>0&&(r<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let p=!1;for(;;)switch(n){case"hex":return function(t,e,r,n){let i;r=Number(r)||0;let o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;let f=e.length;for(n>f/2&&(n=f/2),i=0;i>8,i.push(r%256),i.push(n);return i}(t,this.length-l),this,l,a);default:if(p)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},u.prototype.slice=function(t,e){let r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||E(t,e,this.length);let n=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,r||E(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=j(function(t){S(t>>>=0,"offset");let e=this[t],r=this[t+7];(void 0===e||void 0===r)&&C(t,this.length-8);let n=e+256*this[++t]+65536*this[++t]+16777216*this[++t],i=this[++t]+256*this[++t]+65536*this[++t]+16777216*r;return BigInt(n)+(BigInt(i)<>>=0,"offset");let e=this[t],r=this[t+7];(void 0===e||void 0===r)&&C(t,this.length-8);let n=16777216*e+65536*this[++t]+256*this[++t]+this[++t],i=16777216*this[++t]+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<>>=0,e>>>=0,r||E(t,e,this.length);let n=this[t],i=1,o=0;for(;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return(t>>>=0,e||E(t,1,this.length),128&this[t])?-((255-this[t]+1)*1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||E(t,2,this.length);let r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||E(t,2,this.length);let r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=j(function(t){S(t>>>=0,"offset");let e=this[t],r=this[t+7];return(void 0===e||void 0===r)&&C(t,this.length-8),(BigInt(this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24))<>>=0,"offset");let e=this[t],r=this[t+7];return(void 0===e||void 0===r)&&C(t,this.length-8),(BigInt((e<<24)+65536*this[++t]+256*this[++t]+this[++t])<>>=0,e||E(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||E(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||E(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||E(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;B(this,t,e,r,n,0)}let i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;B(this,t,e,r,n,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=j(function(t,e=0){return A(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=j(function(t,e=0){return v(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){let n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}let i=0,o=1,f=0;for(this[e]=255&t;++i>0)-f&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){let n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}let i=r-1,o=1,f=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===f&&0!==this[e+i+1]&&(f=1),this[e+i]=(t/o>>0)-f&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=j(function(t,e=0){return A(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=j(function(t,e=0){return v(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return T(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return T(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function _(t,e,r,n,i,o){if(t>r||t3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${(o+1)*8}${i}`:`>= -(2${i} ** ${(o+1)*8-1}${i}) and < 2 ** ${(o+1)*8-1}${i}`:`>= ${e}${i} and <= ${r}${i}`,new R.ERR_OUT_OF_RANGE("value",n,t)}S(i,"offset"),(void 0===n[i]||void 0===n[i+o])&&C(i,n.length-(o+1))}function S(t,e){if("number"!=typeof t)throw new R.ERR_INVALID_ARG_TYPE(e,"number",t)}function C(t,e,r){if(Math.floor(t)!==t)throw S(t,r),new R.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new R.ERR_BUFFER_OUT_OF_BOUNDS;throw new R.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}L("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),L("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),L("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>4294967296?i=O(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=O(i)),i+="n"),n+=` It must be ${e}. Received ${i}`},RangeError);let x=/[^+/0-9A-Za-z-_]/g;function $(t,e){let r;e=e||1/0;let n=t.length,i=null,o=[];for(let f=0;f55295&&r<57344){if(!i){if(r>56319||f+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function N(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(x,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function M(t,e,r,n){let i;for(i=0;i=e.length)&&!(i>=t.length);++i)e[i+r]=t[i];return i}function k(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}let P=function(){let t="0123456789abcdef",e=Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function j(t){return"undefined"==typeof BigInt?F:t}function F(){throw Error("BigInt not supported")}},6868:function(t,e){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */e.read=function(t,e,r,n,i){var o,f,u=8*i-n-1,s=(1<>1,l=-7,a=r?i-1:0,c=r?-1:1,p=t[e+a];for(a+=c,o=p&(1<<-l)-1,p>>=-l,l+=u;l>0;o=256*o+t[e+a],a+=c,l-=8);for(f=o&(1<<-l)-1,o>>=-l,l+=n;l>0;f=256*f+t[e+a],a+=c,l-=8);if(0===o)o=1-h;else{if(o===s)return f?NaN:1/0*(p?-1:1);f+=Math.pow(2,n),o-=h}return(p?-1:1)*f*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var f,u,s,h=8*o-i-1,l=(1<>1,c=23===i?5960464477539062e-23:0,p=n?0:o-1,y=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(isNaN(e=Math.abs(e))||e===1/0?(u=isNaN(e)?1:0,f=l):(f=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-f))<1&&(f--,s*=2),f+a>=1?e+=c/s:e+=c*Math.pow(2,1-a),e*s>=2&&(f++,s/=2),f+a>=l?(u=0,f=l):f+a>=1?(u=(e*s-1)*Math.pow(2,i),f+=a):(u=e*Math.pow(2,a-1)*Math.pow(2,i),f=0));i>=8;t[r+p]=255&u,p+=y,u/=256,i-=8);for(f=f<0;t[r+p]=255&f,p+=y,f/=256,h-=8);t[r+p-y]|=128*g}},25566:function(t){var e,r,n,i=t.exports={};function o(){throw Error("setTimeout has not been defined")}function f(){throw Error("clearTimeout has not been defined")}function u(t){if(e===setTimeout)return setTimeout(t,0);if((e===o||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:o}catch(t){e=o}try{r="function"==typeof clearTimeout?clearTimeout:f}catch(t){r=f}}();var s=[],h=!1,l=-1;function a(){h&&n&&(h=!1,n.length?s=n.concat(s):l=-1,s.length&&c())}function c(){if(!h){var t=u(a);h=!0;for(var e=s.length;e;){for(n=s,s=[];++l1)for(var r=1;rt.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);ot.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}"function"==typeof SuppressedError&&SuppressedError;var f=n(2265),p="right-scroll-bar-position",m="width-before-scroll-bar";function v(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var h="undefined"!=typeof window?f.useLayoutEffect:f.useEffect,g=new WeakMap,w=(void 0===o&&(o={}),(void 0===i&&(i=function(e){return e}),l=[],a=!1,u={read:function(){if(a)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return l.length?l[l.length-1]:null},useMedium:function(e){var t=i(e,a);return l.push(t),function(){l=l.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(a=!0;l.length;){var t=l;l=[],t.forEach(e)}l={push:function(t){return e(t)},filter:function(){return l}}},assignMedium:function(e){a=!0;var t=[];if(l.length){var n=l;l=[],n.forEach(e),t=l}var r=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(r)};o(),l={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),l}}}}).options=s({async:!0,ssr:!1},o),u),y=function(){},b=f.forwardRef(function(e,t){var n,r,o,i,l=f.useRef(null),a=f.useState({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:y}),u=a[0],c=a[1],p=e.forwardProps,m=e.children,b=e.className,E=e.removeScrollBar,x=e.enabled,S=e.shards,C=e.sideCar,R=e.noIsolation,T=e.inert,P=e.allowPinchZoom,A=e.as,L=d(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),M=(n=[l,t],r=function(e){return n.forEach(function(t){return v(t,e)})},(o=(0,f.useState)(function(){return{value:null,callback:r,facade:{get current(){return o.value},set current(value){var e=o.value;e!==value&&(o.value=value,o.callback(value,e))}}}})[0]).callback=r,i=o.facade,h(function(){var e=g.get(i);if(e){var t=new Set(e),r=new Set(n),o=i.current;t.forEach(function(e){r.has(e)||v(e,null)}),r.forEach(function(e){t.has(e)||v(e,o)})}g.set(i,n)},[n]),i),O=s(s({},L),u);return f.createElement(f.Fragment,null,x&&f.createElement(C,{sideCar:w,removeScrollBar:E,shards:S,noIsolation:R,inert:T,setCallbacks:c,allowPinchZoom:!!P,lockRef:l}),p?f.cloneElement(f.Children.only(m),s(s({},O),{ref:M})):f.createElement(void 0===A?"div":A,s({},O,{className:b,ref:M}),m))});b.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},b.classNames={fullWidth:m,zeroRight:p};var E=function(e){var t=e.sideCar,n=d(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error("Sidecar medium not found");return f.createElement(r,s({},n))};E.isSideCarExport=!0;var x=function(){var e=0,t=null;return{add:function(o){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=r||n.nc;return t&&e.setAttribute("nonce",t),e}())){var i,l;(i=t).styleSheet?i.styleSheet.cssText=o:i.appendChild(document.createTextNode(o)),l=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(l)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},S=function(){var e=x();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},C=function(){var e=S();return function(t){return e(t.styles,t.dynamic),null}},R={left:0,top:0,right:0,gap:0},T=function(e){return parseInt(e||"",10)||0},P=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[T(n),T(r),T(o)]},A=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return R;var t=P(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},L=C(),M="data-scroll-locked",O=function(e,t,n,r){var o=e.left,i=e.top,l=e.right,a=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(a,"px ").concat(r,";\n }\n body[").concat(M,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(i,"px;\n padding-right: ").concat(l,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(a,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(p," {\n right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(m," {\n margin-right: ").concat(a,"px ").concat(r,";\n }\n \n .").concat(p," .").concat(p," {\n right: 0 ").concat(r,";\n }\n \n .").concat(m," .").concat(m," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(M,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n }\n")},k=function(){var e=parseInt(document.body.getAttribute(M)||"0",10);return isFinite(e)?e:0},D=function(){f.useEffect(function(){return document.body.setAttribute(M,(k()+1).toString()),function(){var e=k()-1;e<=0?document.body.removeAttribute(M):document.body.setAttribute(M,e.toString())}},[])},I=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r;D();var i=f.useMemo(function(){return A(o)},[o]);return f.createElement(L,{styles:O(i,!t,o,n?"":"!important")})},W=!1;if("undefined"!=typeof window)try{var N=Object.defineProperty({},"passive",{get:function(){return W=!0,!0}});window.addEventListener("test",N,N),window.removeEventListener("test",N,N)}catch(e){W=!1}var _=!!W&&{passive:!1},V=function(e,t){var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&"TEXTAREA"!==e.tagName&&"visible"===n[t])},H=function(e,t){var n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),F(e,n)){var r=B(e,n);if(r[1]>r[2])return!0}n=n.parentNode}while(n&&n!==document.body);return!1},F=function(e,t){return"v"===e?V(t,"overflowY"):V(t,"overflowX")},B=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},Z=function(e,t,n,r,o){var i,l=(i=window.getComputedStyle(t).direction,"h"===e&&"rtl"===i?-1:1),a=l*r,u=n.target,c=t.contains(u),s=!1,d=a>0,f=0,p=0;do{var m=B(e,u),v=m[0],h=m[1]-m[2]-l*v;(v||h)&&F(e,u)&&(f+=h,p+=v),u=u.parentNode}while(!c&&u!==document.body||c&&(t.contains(u)||t===u));return d&&(o&&0===f||!o&&a>f)?s=!0:!d&&(o&&0===p||!o&&-a>p)&&(s=!0),s},K=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},$=function(e){return[e.deltaX,e.deltaY]},z=function(e){return e&&"current"in e?e.current:e},U=0,j=[],Y=(c=function(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),o=f.useState(U++)[0],i=f.useState(function(){return C()})[0],l=f.useRef(e);f.useEffect(function(){l.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=(function(e,t,n){if(n||2==arguments.length)for(var r,o=0,i=t.length;oMath.abs(c)?"h":"v";if("touches"in e&&"h"===d&&"range"===s.type)return!1;var f=H(d,s);if(!f)return!0;if(f?o=d:(o="v"===d?"h":"v",f=H(d,s)),!f)return!1;if(!r.current&&"changedTouches"in e&&(u||c)&&(r.current=o),!o)return!0;var p=r.current||o;return Z(p,t,e,"h"===p?u:c,!0)},[]),u=f.useCallback(function(e){if(j.length&&j[j.length-1]===i){var n="deltaY"in e?$(e):K(e),r=t.current.filter(function(t){var r;return t.name===e.type&&t.target===e.target&&(r=t.delta)[0]===n[0]&&r[1]===n[1]})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var o=(l.current.shards||[]).map(z).filter(Boolean).filter(function(t){return t.contains(e.target)});(o.length>0?a(e,o[0]):!l.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=f.useCallback(function(e,n,r,o){var i={name:e,delta:n,target:r,should:o};t.current.push(i),setTimeout(function(){t.current=t.current.filter(function(e){return e!==i})},1)},[]),s=f.useCallback(function(e){n.current=K(e),r.current=void 0},[]),d=f.useCallback(function(t){c(t.type,$(t),t.target,a(t,e.lockRef.current))},[]),p=f.useCallback(function(t){c(t.type,K(t),t.target,a(t,e.lockRef.current))},[]);f.useEffect(function(){return j.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",u,_),document.addEventListener("touchmove",u,_),document.addEventListener("touchstart",s,_),function(){j=j.filter(function(e){return e!==i}),document.removeEventListener("wheel",u,_),document.removeEventListener("touchmove",u,_),document.removeEventListener("touchstart",s,_)}},[]);var m=e.removeScrollBar,v=e.inert;return f.createElement(f.Fragment,null,v?f.createElement(i,{styles:"\n .block-interactivity-".concat(o," {pointer-events: none;}\n .allow-interactivity-").concat(o," {pointer-events: all;}\n")}):null,m?f.createElement(I,{gapMode:"margin"}):null)},w.useMedium(c),E),X=f.forwardRef(function(e,t){return f.createElement(b,s({},e,{ref:t,sideCar:Y}))});X.classNames=b.classNames;var q=X},62361:function(e,t,n){n.d(t,{u:function(){return r}});function r(e,[t,n]){return Math.min(n,Math.max(t,e))}},90976:function(e,t,n){n.d(t,{B:function(){return a}});var r=n(2265),o=n(98324),i=n(1584),l=n(71538);function a(e){let t=e+"CollectionProvider",[n,a]=(0,o.b)(t),[u,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=e+"CollectionSlot",d=r.forwardRef((e,t)=>{let{scope:n,children:o}=e,a=c(s,n),u=(0,i.e)(t,a.collectionRef);return r.createElement(l.g7,{ref:u},o)}),f=e+"CollectionItemSlot",p="data-radix-collection-item";return[{Provider:e=>{let{scope:t,children:n}=e,o=r.useRef(null),i=r.useRef(new Map).current;return r.createElement(u,{scope:t,itemMap:i,collectionRef:o},n)},Slot:d,ItemSlot:r.forwardRef((e,t)=>{let{scope:n,children:o,...a}=e,u=r.useRef(null),s=(0,i.e)(t,u),d=c(f,n);return r.useEffect(()=>(d.itemMap.set(u,{ref:u,...a}),()=>void d.itemMap.delete(u))),r.createElement(l.g7,{[p]:"",ref:s},o)})},function(t){let n=c(e+"CollectionConsumer",t);return r.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},a]}},87513:function(e,t,n){n.d(t,{_9:function(){return i},gm:function(){return l}});var r=n(2265);let o=(0,r.createContext)(void 0),i=e=>{let{dir:t,children:n}=e;return(0,r.createElement)(o.Provider,{value:t},n)};function l(e){let t=(0,r.useContext)(o);return e||t||"ltr"}},53938:function(e,t,n){let r;n.d(t,{I0:function(){return g},XB:function(){return f},fC:function(){return h}});var o=n(22988),i=n(2265),l=n(78149),a=n(25171),u=n(1584),c=n(75137);let s="dismissableLayer.update",d=(0,i.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),f=(0,i.forwardRef)((e,t)=>{var n;let{disableOutsidePointerEvents:f=!1,onEscapeKeyDown:p,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:w,onDismiss:y,...b}=e,E=(0,i.useContext)(d),[x,S]=(0,i.useState)(null),C=null!==(n=null==x?void 0:x.ownerDocument)&&void 0!==n?n:null==globalThis?void 0:globalThis.document,[,R]=(0,i.useState)({}),T=(0,u.e)(t,e=>S(e)),P=Array.from(E.layers),[A]=[...E.layersWithOutsidePointerEventsDisabled].slice(-1),L=P.indexOf(A),M=x?P.indexOf(x):-1,O=E.layersWithOutsidePointerEventsDisabled.size>0,k=M>=L,D=function(e,t=null==globalThis?void 0:globalThis.document){let n=(0,c.W)(e),r=(0,i.useRef)(!1),o=(0,i.useRef)(()=>{});return(0,i.useEffect)(()=>{let e=e=>{if(e.target&&!r.current){let r={originalEvent:e};function i(){v("dismissableLayer.pointerDownOutside",n,r,{discrete:!0})}"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=i,t.addEventListener("click",o.current,{once:!0})):i()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{let t=e.target,n=[...E.branches].some(e=>e.contains(t));!k||n||(null==h||h(e),null==w||w(e),e.defaultPrevented||null==y||y())},C),I=function(e,t=null==globalThis?void 0:globalThis.document){let n=(0,c.W)(e),r=(0,i.useRef)(!1);return(0,i.useEffect)(()=>{let e=e=>{e.target&&!r.current&&v("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{let t=e.target;[...E.branches].some(e=>e.contains(t))||(null==g||g(e),null==w||w(e),e.defaultPrevented||null==y||y())},C);return!function(e,t=null==globalThis?void 0:globalThis.document){let n=(0,c.W)(e);(0,i.useEffect)(()=>{let e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e),()=>t.removeEventListener("keydown",e)},[n,t])}(e=>{M!==E.layers.size-1||(null==p||p(e),!e.defaultPrevented&&y&&(e.preventDefault(),y()))},C),(0,i.useEffect)(()=>{if(x)return f&&(0===E.layersWithOutsidePointerEventsDisabled.size&&(r=C.body.style.pointerEvents,C.body.style.pointerEvents="none"),E.layersWithOutsidePointerEventsDisabled.add(x)),E.layers.add(x),m(),()=>{f&&1===E.layersWithOutsidePointerEventsDisabled.size&&(C.body.style.pointerEvents=r)}},[x,C,f,E]),(0,i.useEffect)(()=>()=>{x&&(E.layers.delete(x),E.layersWithOutsidePointerEventsDisabled.delete(x),m())},[x,E]),(0,i.useEffect)(()=>{let e=()=>R({});return document.addEventListener(s,e),()=>document.removeEventListener(s,e)},[]),(0,i.createElement)(a.WV.div,(0,o.Z)({},b,{ref:T,style:{pointerEvents:O?k?"auto":"none":void 0,...e.style},onFocusCapture:(0,l.M)(e.onFocusCapture,I.onFocusCapture),onBlurCapture:(0,l.M)(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:(0,l.M)(e.onPointerDownCapture,D.onPointerDownCapture)}))}),p=(0,i.forwardRef)((e,t)=>{let n=(0,i.useContext)(d),r=(0,i.useRef)(null),l=(0,u.e)(t,r);return(0,i.useEffect)(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,i.createElement)(a.WV.div,(0,o.Z)({},e,{ref:l}))});function m(){let e=new CustomEvent(s);document.dispatchEvent(e)}function v(e,t,n,{discrete:r}){let o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?(0,a.jH)(o,i):o.dispatchEvent(i)}let h=f,g=p},20589:function(e,t,n){n.d(t,{EW:function(){return i}});var r=n(2265);let o=0;function i(){(0,r.useEffect)(()=>{var e,t;let n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=n[0])&&void 0!==e?e:l()),document.body.insertAdjacentElement("beforeend",null!==(t=n[1])&&void 0!==t?t:l()),o++,()=>{1===o&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),o--}},[])}function l(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}},80467:function(e,t,n){let r;n.d(t,{M:function(){return f}});var o=n(22988),i=n(2265),l=n(1584),a=n(25171),u=n(75137);let c="focusScope.autoFocusOnMount",s="focusScope.autoFocusOnUnmount",d={bubbles:!1,cancelable:!0},f=(0,i.forwardRef)((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:f,onUnmountAutoFocus:g,...w}=e,[y,b]=(0,i.useState)(null),E=(0,u.W)(f),x=(0,u.W)(g),S=(0,i.useRef)(null),C=(0,l.e)(t,e=>b(e)),R=(0,i.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,i.useEffect)(()=>{if(r){function e(e){if(R.paused||!y)return;let t=e.target;y.contains(t)?S.current=t:v(S.current,{select:!0})}function t(e){if(R.paused||!y)return;let t=e.relatedTarget;null===t||y.contains(t)||v(S.current,{select:!0})}document.addEventListener("focusin",e),document.addEventListener("focusout",t);let n=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&v(y)});return y&&n.observe(y,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[r,y,R.paused]),(0,i.useEffect)(()=>{if(y){h.add(R);let e=document.activeElement;if(!y.contains(e)){let t=new CustomEvent(c,d);y.addEventListener(c,E),y.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(v(r,{select:t}),document.activeElement!==n)return}(p(y).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&v(y))}return()=>{y.removeEventListener(c,E),setTimeout(()=>{let t=new CustomEvent(s,d);y.addEventListener(s,x),y.dispatchEvent(t),t.defaultPrevented||v(null!=e?e:document.body,{select:!0}),y.removeEventListener(s,x),h.remove(R)},0)}}},[y,E,x,R]);let T=(0,i.useCallback)(e=>{if(!n&&!r||R.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){let t=e.currentTarget,[r,i]=function(e){let t=p(e);return[m(t,e),m(t.reverse(),e)]}(t);r&&i?e.shiftKey||o!==i?e.shiftKey&&o===r&&(e.preventDefault(),n&&v(i,{select:!0})):(e.preventDefault(),n&&v(r,{select:!0})):o===t&&e.preventDefault()}},[n,r,R.paused]);return(0,i.createElement)(a.WV.div,(0,o.Z)({tabIndex:-1},w,{ref:C,onKeyDown:T}))});function p(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function m(e,t){for(let n of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(n,{upTo:t}))return n}function v(e,{select:t=!1}={}){if(e&&e.focus){var n;let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&(n=e)instanceof HTMLInputElement&&"select"in n&&t&&e.select()}}let h=(r=[],{add(e){let t=r[0];e!==t&&(null==t||t.pause()),(r=g(r,e)).unshift(e)},remove(e){var t;null===(t=(r=g(r,e))[0])||void 0===t||t.resume()}});function g(e,t){let n=[...e],r=n.indexOf(t);return -1!==r&&n.splice(r,1),n}},53201:function(e,t,n){n.d(t,{M:function(){return u}});var r,o=n(2265),i=n(1336);let l=(r||(r=n.t(o,2)))["useId".toString()]||(()=>void 0),a=0;function u(e){let[t,n]=o.useState(l());return(0,i.b)(()=>{e||n(e=>null!=e?e:String(a++))},[e]),e||(t?`radix-${t}`:"")}},25510:function(e,t,n){n.d(t,{ee:function(){return e$},Eh:function(){return eU},VY:function(){return ez},fC:function(){return eK},D7:function(){return eM}});var r=n(22988),o=n(2265);let i=["top","right","bottom","left"],l=Math.min,a=Math.max,u=Math.round,c=Math.floor,s=e=>({x:e,y:e}),d={left:"right",right:"left",bottom:"top",top:"bottom"},f={start:"end",end:"start"};function p(e,t){return"function"==typeof e?e(t):e}function m(e){return e.split("-")[0]}function v(e){return e.split("-")[1]}function h(e){return"x"===e?"y":"x"}function g(e){return"y"===e?"height":"width"}function w(e){return["top","bottom"].includes(m(e))?"y":"x"}function y(e){return e.replace(/start|end/g,e=>f[e])}function b(e){return e.replace(/left|right|bottom|top/g,e=>d[e])}function E(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function x(e){let{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function S(e,t,n){let r,{reference:o,floating:i}=e,l=w(t),a=h(w(t)),u=g(a),c=m(t),s="y"===l,d=o.x+o.width/2-i.width/2,f=o.y+o.height/2-i.height/2,p=o[u]/2-i[u]/2;switch(c){case"top":r={x:d,y:o.y-i.height};break;case"bottom":r={x:d,y:o.y+o.height};break;case"right":r={x:o.x+o.width,y:f};break;case"left":r={x:o.x-i.width,y:f};break;default:r={x:o.x,y:o.y}}switch(v(t)){case"start":r[a]-=p*(n&&s?-1:1);break;case"end":r[a]+=p*(n&&s?-1:1)}return r}let C=async(e,t,n)=>{let{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,a=i.filter(Boolean),u=await (null==l.isRTL?void 0:l.isRTL(t)),c=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:s,y:d}=S(c,r,u),f=r,p={},m=0;for(let n=0;ne[t]>=0)}async function A(e,t){let{placement:n,platform:r,elements:o}=e,i=await (null==r.isRTL?void 0:r.isRTL(o.floating)),l=m(n),a=v(n),u="y"===w(n),c=["left","top"].includes(l)?-1:1,s=i&&u?-1:1,d=p(t,e),{mainAxis:f,crossAxis:h,alignmentAxis:g}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&"number"==typeof g&&(h="end"===a?-1*g:g),u?{x:h*s,y:f*c}:{x:f*c,y:h*s}}function L(e){return k(e)?(e.nodeName||"").toLowerCase():"#document"}function M(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function O(e){var t;return null==(t=(k(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function k(e){return e instanceof Node||e instanceof M(e).Node}function D(e){return e instanceof Element||e instanceof M(e).Element}function I(e){return e instanceof HTMLElement||e instanceof M(e).HTMLElement}function W(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof M(e).ShadowRoot)}function N(e){let{overflow:t,overflowX:n,overflowY:r,display:o}=F(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function _(e){let t=V(),n=F(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some(e=>(n.willChange||"").includes(e))||["paint","layout","strict","content"].some(e=>(n.contain||"").includes(e))}function V(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}function H(e){return["html","body","#document"].includes(L(e))}function F(e){return M(e).getComputedStyle(e)}function B(e){return D(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Z(e){if("html"===L(e))return e;let t=e.assignedSlot||e.parentNode||W(e)&&e.host||O(e);return W(t)?t.host:t}function K(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let o=function e(t){let n=Z(t);return H(n)?t.ownerDocument?t.ownerDocument.body:t.body:I(n)&&N(n)?n:e(n)}(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=M(o);return i?t.concat(l,l.visualViewport||[],N(o)?o:[],l.frameElement&&n?K(l.frameElement):[]):t.concat(o,K(o,[],n))}function $(e){let t=F(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,o=I(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,a=u(n)!==i||u(r)!==l;return a&&(n=i,r=l),{width:n,height:r,$:a}}function z(e){return D(e)?e:e.contextElement}function U(e){let t=z(e);if(!I(t))return s(1);let n=t.getBoundingClientRect(),{width:r,height:o,$:i}=$(t),l=(i?u(n.width):n.width)/r,a=(i?u(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}let j=s(0);function Y(e){let t=M(e);return V()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:j}function X(e,t,n,r){var o;void 0===t&&(t=!1),void 0===n&&(n=!1);let i=e.getBoundingClientRect(),l=z(e),a=s(1);t&&(r?D(r)&&(a=U(r)):a=U(e));let u=(void 0===(o=n)&&(o=!1),r&&(!o||r===M(l))&&o)?Y(l):s(0),c=(i.left+u.x)/a.x,d=(i.top+u.y)/a.y,f=i.width/a.x,p=i.height/a.y;if(l){let e=M(l),t=r&&D(r)?M(r):r,n=e,o=n.frameElement;for(;o&&r&&t!==n;){let e=U(o),t=o.getBoundingClientRect(),r=F(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,d*=e.y,f*=e.x,p*=e.y,c+=i,d+=l,o=(n=M(o)).frameElement}}return x({width:f,height:p,x:c,y:d})}let q=[":popover-open",":modal"];function G(e){return q.some(t=>{try{return e.matches(t)}catch(e){return!1}})}function J(e){return X(O(e)).left+B(e).scrollLeft}function Q(e,t,n){let r;if("viewport"===t)r=function(e,t){let n=M(e),r=O(e),o=n.visualViewport,i=r.clientWidth,l=r.clientHeight,a=0,u=0;if(o){i=o.width,l=o.height;let e=V();(!e||e&&"fixed"===t)&&(a=o.offsetLeft,u=o.offsetTop)}return{width:i,height:l,x:a,y:u}}(e,n);else if("document"===t)r=function(e){let t=O(e),n=B(e),r=e.ownerDocument.body,o=a(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=a(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),l=-n.scrollLeft+J(e),u=-n.scrollTop;return"rtl"===F(r).direction&&(l+=a(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}(O(e));else if(D(t))r=function(e,t){let n=X(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=I(e)?U(e):s(1),l=e.clientWidth*i.x;return{width:l,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{let n=Y(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return x(r)}function ee(e){return"static"===F(e).position}function et(e,t){return I(e)&&"fixed"!==F(e).position?t?t(e):e.offsetParent:null}function en(e,t){let n=M(e);if(G(e))return n;if(!I(e)){let t=Z(e);for(;t&&!H(t);){if(D(t)&&!ee(t))return t;t=Z(t)}return n}let r=et(e,t);for(;r&&["table","td","th"].includes(L(r))&&ee(r);)r=et(r,t);return r&&H(r)&&ee(r)&&!_(r)?n:r||function(e){let t=Z(e);for(;I(t)&&!H(t);){if(_(t))return t;t=Z(t)}return null}(e)||n}let er=async function(e){let t=this.getOffsetParent||en,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=I(t),o=O(t),i="fixed"===n,l=X(e,!0,i,t),a={scrollLeft:0,scrollTop:0},u=s(0);if(r||!r&&!i){if(("body"!==L(t)||N(o))&&(a=B(t)),r){let e=X(t,!0,i,t);u.x=e.x+t.clientLeft,u.y=e.y+t.clientTop}else o&&(u.x=J(o))}return{x:l.left+a.scrollLeft-u.x,y:l.top+a.scrollTop-u.y,width:l.width,height:l.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},eo={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e,i="fixed"===o,l=O(r),a=!!t&&G(t.floating);if(r===l||a&&i)return n;let u={scrollLeft:0,scrollTop:0},c=s(1),d=s(0),f=I(r);if((f||!f&&!i)&&(("body"!==L(r)||N(l))&&(u=B(r)),I(r))){let e=X(r);c=U(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-u.scrollLeft*c.x+d.x,y:n.y*c.y-u.scrollTop*c.y+d.y}},getDocumentElement:O,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e,i=[..."clippingAncestors"===n?G(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=K(e,[],!1).filter(e=>D(e)&&"body"!==L(e)),o=null,i="fixed"===F(e).position,l=i?Z(e):e;for(;D(l)&&!H(l);){let t=F(l),n=_(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&!!o&&["absolute","fixed"].includes(o.position)||N(l)&&!n&&function e(t,n){let r=Z(t);return!(r===n||!D(r)||H(r))&&("fixed"===F(r).position||e(r,n))}(e,l))?r=r.filter(e=>e!==l):o=t,l=Z(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],u=i[0],c=i.reduce((e,n)=>{let r=Q(t,n,o);return e.top=a(r.top,e.top),e.right=l(r.right,e.right),e.bottom=l(r.bottom,e.bottom),e.left=a(r.left,e.left),e},Q(t,u,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:en,getElementRects:er,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=$(e);return{width:t,height:n}},getScale:U,isElement:D,isRTL:function(e){return"rtl"===F(e).direction}},ei=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:o,rects:i,platform:u,elements:c,middlewareData:s}=t,{element:d,padding:f=0}=p(e,t)||{};if(null==d)return{};let m=E(f),y={x:n,y:r},b=h(w(o)),x=g(b),S=await u.getDimensions(d),C="y"===b,R=C?"clientHeight":"clientWidth",T=i.reference[x]+i.reference[b]-y[b]-i.floating[x],P=y[b]-i.reference[b],A=await (null==u.getOffsetParent?void 0:u.getOffsetParent(d)),L=A?A[R]:0;L&&await (null==u.isElement?void 0:u.isElement(A))||(L=c.floating[R]||i.floating[x]);let M=L/2-S[x]/2-1,O=l(m[C?"top":"left"],M),k=l(m[C?"bottom":"right"],M),D=L-S[x]-k,I=L/2-S[x]/2+(T/2-P/2),W=a(O,l(I,D)),N=!s.arrow&&null!=v(o)&&I!==W&&i.reference[x]/2-(I{let r=new Map,o={platform:eo,...n},i={...o.platform,_c:r};return C(e,t,{...o,platform:i})};var ea=n(54887),eu="undefined"!=typeof document?o.useLayoutEffect:o.useEffect;function ec(e,t){let n,r,o;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!ec(e[r],t[r]))return!1;return!0}if((n=(o=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){let n=o[r];if(("_owner"!==n||!e.$$typeof)&&!ec(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function es(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ed(e,t){let n=es(e);return Math.round(t*n)/n}function ef(e){let t=o.useRef(e);return eu(()=>{t.current=e}),t}let ep=e=>({name:"arrow",options:e,fn(t){let{element:n,padding:r}="function"==typeof e?e(t):e;return n&&({}).hasOwnProperty.call(n,"current")?null!=n.current?ei({element:n.current,padding:r}).fn(t):{}:n?ei({element:n,padding:r}).fn(t):{}}}),em=(e,t)=>{var n;return{...(void 0===(n=e)&&(n=0),{name:"offset",options:n,async fn(e){var t,r;let{x:o,y:i,placement:l,middlewareData:a}=e,u=await A(e,n);return l===(null==(t=a.offset)?void 0:t.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:l}}}}),options:[e,t]}},ev=(e,t)=>{var n;return{...(void 0===(n=e)&&(n={}),{name:"shift",options:n,async fn(e){let{x:t,y:r,placement:o}=e,{mainAxis:i=!0,crossAxis:u=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=p(n,e),d={x:t,y:r},f=await R(e,s),v=w(m(o)),g=h(v),y=d[g],b=d[v];if(i){let e="y"===g?"top":"left",t="y"===g?"bottom":"right",n=y+f[e],r=y-f[t];y=a(n,l(y,r))}if(u){let e="y"===v?"top":"left",t="y"===v?"bottom":"right",n=b+f[e],r=b-f[t];b=a(n,l(b,r))}let E=c.fn({...e,[g]:y,[v]:b});return{...E,data:{x:E.x-t,y:E.y-r}}}}),options:[e,t]}},eh=(e,t)=>{var n;return{...(void 0===(n=e)&&(n={}),{options:n,fn(e){let{x:t,y:r,placement:o,rects:i,middlewareData:l}=e,{offset:a=0,mainAxis:u=!0,crossAxis:c=!0}=p(n,e),s={x:t,y:r},d=w(o),f=h(d),v=s[f],g=s[d],y=p(a,e),b="number"==typeof y?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(u){let e="y"===f?"height":"width",t=i.reference[f]-i.floating[e]+b.mainAxis,n=i.reference[f]+i.reference[e]-b.mainAxis;vn&&(v=n)}if(c){var E,x;let e="y"===f?"width":"height",t=["top","left"].includes(m(o)),n=i.reference[d]-i.floating[e]+(t&&(null==(E=l.offset)?void 0:E[d])||0)+(t?0:b.crossAxis),r=i.reference[d]+i.reference[e]+(t?0:(null==(x=l.offset)?void 0:x[d])||0)-(t?b.crossAxis:0);gr&&(g=r)}return{[f]:v,[d]:g}}}),options:[e,t]}},eg=(e,t)=>{var n;return{...(void 0===(n=e)&&(n={}),{name:"flip",options:n,async fn(e){var t,r,o,i,l;let{placement:a,middlewareData:u,rects:c,initialPlacement:s,platform:d,elements:f}=e,{mainAxis:E=!0,crossAxis:x=!0,fallbackPlacements:S,fallbackStrategy:C="bestFit",fallbackAxisSideDirection:T="none",flipAlignment:P=!0,...A}=p(n,e);if(null!=(t=u.arrow)&&t.alignmentOffset)return{};let L=m(a),M=m(s)===s,O=await (null==d.isRTL?void 0:d.isRTL(f.floating)),k=S||(M||!P?[b(s)]:function(e){let t=b(e);return[y(e),t,y(t)]}(s));S||"none"===T||k.push(...function(e,t,n,r){let o=v(e),i=function(e,t,n){let r=["left","right"],o=["right","left"];switch(e){case"top":case"bottom":if(n)return t?o:r;return t?r:o;case"left":case"right":return t?["top","bottom"]:["bottom","top"];default:return[]}}(m(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(y)))),i}(s,P,T,O));let D=[s,...k],I=await R(e,A),W=[],N=(null==(r=u.flip)?void 0:r.overflows)||[];if(E&&W.push(I[L]),x){let e=function(e,t,n){void 0===n&&(n=!1);let r=v(e),o=h(w(e)),i=g(o),l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=b(l)),[l,b(l)]}(a,c,O);W.push(I[e[0]],I[e[1]])}if(N=[...N,{placement:a,overflows:W}],!W.every(e=>e<=0)){let e=((null==(o=u.flip)?void 0:o.index)||0)+1,t=D[e];if(t)return{data:{index:e,overflows:N},reset:{placement:t}};let n=null==(i=N.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:i.placement;if(!n)switch(C){case"bestFit":{let e=null==(l=N.map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:l[0];e&&(n=e);break}case"initialPlacement":n=s}if(a!==n)return{reset:{placement:n}}}return{}}}),options:[e,t]}},ew=(e,t)=>{var n;return{...(void 0===(n=e)&&(n={}),{name:"size",options:n,async fn(e){let t,r;let{placement:o,rects:i,platform:u,elements:c}=e,{apply:s=()=>{},...d}=p(n,e),f=await R(e,d),h=m(o),g=v(o),y="y"===w(o),{width:b,height:E}=i.floating;"top"===h||"bottom"===h?(t=h,r=g===(await (null==u.isRTL?void 0:u.isRTL(c.floating))?"start":"end")?"left":"right"):(r=h,t="end"===g?"top":"bottom");let x=E-f.top-f.bottom,S=b-f.left-f.right,C=l(E-f[t],x),T=l(b-f[r],S),P=!e.middlewareData.shift,A=C,L=T;if(y?L=g||P?l(T,S):S:A=g||P?l(C,x):x,P&&!g){let e=a(f.left,0),t=a(f.right,0),n=a(f.top,0),r=a(f.bottom,0);y?L=b-2*(0!==e||0!==t?e+t:a(f.left,f.right)):A=E-2*(0!==n||0!==r?n+r:a(f.top,f.bottom))}await s({...e,availableWidth:L,availableHeight:A});let M=await u.getDimensions(c.floating);return b!==M.width||E!==M.height?{reset:{rects:!0}}:{}}}),options:[e,t]}},ey=(e,t)=>{var n;return{...(void 0===(n=e)&&(n={}),{name:"hide",options:n,async fn(e){let{rects:t}=e,{strategy:r="referenceHidden",...o}=p(n,e);switch(r){case"referenceHidden":{let n=T(await R(e,{...o,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:n,referenceHidden:P(n)}}}case"escaped":{let n=T(await R(e,{...o,altBoundary:!0}),t.floating);return{data:{escapedOffsets:n,escaped:P(n)}}}default:return{}}}}),options:[e,t]}},eb=(e,t)=>({...ep(e),options:[e,t]});var eE=n(25171);let ex=(0,o.forwardRef)((e,t)=>{let{children:n,width:i=10,height:l=5,...a}=e;return(0,o.createElement)(eE.WV.svg,(0,r.Z)({},a,{ref:t,width:i,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),e.asChild?n:(0,o.createElement)("polygon",{points:"0,0 30,0 15,10"}))});var eS=n(1584),eC=n(98324),eR=n(75137),eT=n(1336),eP=n(75238);let eA="Popper",[eL,eM]=(0,eC.b)(eA),[eO,ek]=eL(eA),eD=(0,o.forwardRef)((e,t)=>{let{__scopePopper:n,virtualRef:i,...l}=e,a=ek("PopperAnchor",n),u=(0,o.useRef)(null),c=(0,eS.e)(t,u);return(0,o.useEffect)(()=>{a.onAnchorChange((null==i?void 0:i.current)||u.current)}),i?null:(0,o.createElement)(eE.WV.div,(0,r.Z)({},l,{ref:c}))}),eI="PopperContent",[eW,eN]=eL(eI),e_=(0,o.forwardRef)((e,t)=>{var n,i,u,s,d,f,p,m;let{__scopePopper:v,side:h="bottom",sideOffset:g=0,align:w="center",alignOffset:y=0,arrowPadding:b=0,avoidCollisions:E=!0,collisionBoundary:x=[],collisionPadding:S=0,sticky:C="partial",hideWhenDetached:R=!1,updatePositionStrategy:T="optimized",onPlaced:P,...A}=e,L=ek(eI,v),[M,k]=(0,o.useState)(null),D=(0,eS.e)(t,e=>k(e)),[I,W]=(0,o.useState)(null),N=(0,eP.t)(I),_=null!==(n=null==N?void 0:N.width)&&void 0!==n?n:0,V=null!==(i=null==N?void 0:N.height)&&void 0!==i?i:0,H="number"==typeof S?S:{top:0,right:0,bottom:0,left:0,...S},F=Array.isArray(x)?x:[x],B=F.length>0,Z={padding:H,boundary:F.filter(eF),altBoundary:B},{refs:$,floatingStyles:U,placement:j,isPositioned:Y,middlewareData:q}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:l,floating:a}={},transform:u=!0,whileElementsMounted:c,open:s}=e,[d,f]=o.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=o.useState(r);ec(p,r)||m(r);let[v,h]=o.useState(null),[g,w]=o.useState(null),y=o.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),b=o.useCallback(e=>{e!==C.current&&(C.current=e,w(e))},[]),E=l||v,x=a||g,S=o.useRef(null),C=o.useRef(null),R=o.useRef(d),T=null!=c,P=ef(c),A=ef(i),L=o.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:p};A.current&&(e.platform=A.current),el(S.current,C.current,e).then(e=>{let t={...e,isPositioned:!0};M.current&&!ec(R.current,t)&&(R.current=t,ea.flushSync(()=>{f(t)}))})},[p,t,n,A]);eu(()=>{!1===s&&R.current.isPositioned&&(R.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[s]);let M=o.useRef(!1);eu(()=>(M.current=!0,()=>{M.current=!1}),[]),eu(()=>{if(E&&(S.current=E),x&&(C.current=x),E&&x){if(P.current)return P.current(E,x,L);L()}},[E,x,L,P,T]);let O=o.useMemo(()=>({reference:S,floating:C,setReference:y,setFloating:b}),[y,b]),k=o.useMemo(()=>({reference:E,floating:x}),[E,x]),D=o.useMemo(()=>{let e={position:n,left:0,top:0};if(!k.floating)return e;let t=ed(k.floating,d.x),r=ed(k.floating,d.y);return u?{...e,transform:"translate("+t+"px, "+r+"px)",...es(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,u,k.floating,d.x,d.y]);return o.useMemo(()=>({...d,update:L,refs:O,elements:k,floatingStyles:D}),[d,L,O,k,D])}({strategy:"fixed",placement:h+("center"!==w?"-"+w:""),whileElementsMounted:(...e)=>(function(e,t,n,r){let o;void 0===r&&(r={});let{ancestorScroll:i=!0,ancestorResize:u=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:d="function"==typeof IntersectionObserver,animationFrame:f=!1}=r,p=z(e),m=i||u?[...p?K(p):[],...K(t)]:[];m.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),u&&e.addEventListener("resize",n)});let v=p&&d?function(e,t){let n,r=null,o=O(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return!function u(s,d){void 0===s&&(s=!1),void 0===d&&(d=1),i();let{left:f,top:p,width:m,height:v}=e.getBoundingClientRect();if(s||t(),!m||!v)return;let h=c(p),g=c(o.clientWidth-(f+m)),w={rootMargin:-h+"px "+-g+"px "+-c(o.clientHeight-(p+v))+"px "+-c(f)+"px",threshold:a(0,l(1,d))||1},y=!0;function b(e){let t=e[0].intersectionRatio;if(t!==d){if(!y)return u();t?u(!1,t):n=setTimeout(()=>{u(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...w,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(b,w)}r.observe(e)}(!0),i}(p,n):null,h=-1,g=null;s&&(g=new ResizeObserver(e=>{let[r]=e;r&&r.target===p&&g&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=g)||e.observe(t)})),n()}),p&&!f&&g.observe(p),g.observe(t));let w=f?X(e):null;return f&&function t(){let r=X(e);w&&(r.x!==w.x||r.y!==w.y||r.width!==w.width||r.height!==w.height)&&n(),w=r,o=requestAnimationFrame(t)}(),n(),()=>{var e;m.forEach(e=>{i&&e.removeEventListener("scroll",n),u&&e.removeEventListener("resize",n)}),null==v||v(),null==(e=g)||e.disconnect(),g=null,f&&cancelAnimationFrame(o)}})(...e,{animationFrame:"always"===T}),elements:{reference:L.anchor},middleware:[em({mainAxis:g+V,alignmentAxis:y}),E&&ev({mainAxis:!0,crossAxis:!1,limiter:"partial"===C?eh():void 0,...Z}),E&&eg({...Z}),ew({...Z,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:o,height:i}=t.reference,l=e.floating.style;l.setProperty("--radix-popper-available-width",`${n}px`),l.setProperty("--radix-popper-available-height",`${r}px`),l.setProperty("--radix-popper-anchor-width",`${o}px`),l.setProperty("--radix-popper-anchor-height",`${i}px`)}}),I&&eb({element:I,padding:b}),eB({arrowWidth:_,arrowHeight:V}),R&&ey({strategy:"referenceHidden",...Z})]}),[G,J]=eZ(j),Q=(0,eR.W)(P);(0,eT.b)(()=>{Y&&(null==Q||Q())},[Y,Q]);let ee=null===(u=q.arrow)||void 0===u?void 0:u.x,et=null===(s=q.arrow)||void 0===s?void 0:s.y,en=(null===(d=q.arrow)||void 0===d?void 0:d.centerOffset)!==0,[er,eo]=(0,o.useState)();return(0,eT.b)(()=>{M&&eo(window.getComputedStyle(M).zIndex)},[M]),(0,o.createElement)("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:Y?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:er,"--radix-popper-transform-origin":[null===(f=q.transformOrigin)||void 0===f?void 0:f.x,null===(p=q.transformOrigin)||void 0===p?void 0:p.y].join(" ")},dir:e.dir},(0,o.createElement)(eW,{scope:v,placedSide:G,onArrowChange:W,arrowX:ee,arrowY:et,shouldHideArrow:en},(0,o.createElement)(eE.WV.div,(0,r.Z)({"data-side":G,"data-align":J},A,{ref:D,style:{...A.style,animation:Y?void 0:"none",opacity:null!==(m=q.hide)&&void 0!==m&&m.referenceHidden?0:void 0}}))))}),eV={top:"bottom",right:"left",bottom:"top",left:"right"},eH=(0,o.forwardRef)(function(e,t){let{__scopePopper:n,...i}=e,l=eN("PopperArrow",n),a=eV[l.placedSide];return(0,o.createElement)("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0}},(0,o.createElement)(ex,(0,r.Z)({},i,{ref:t,style:{...i.style,display:"block"}})))});function eF(e){return null!==e}let eB=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,l;let{placement:a,rects:u,middlewareData:c}=t,s=(null===(n=c.arrow)||void 0===n?void 0:n.centerOffset)!==0,d=s?0:e.arrowWidth,f=s?0:e.arrowHeight,[p,m]=eZ(a),v={start:"0%",center:"50%",end:"100%"}[m],h=(null!==(r=null===(o=c.arrow)||void 0===o?void 0:o.x)&&void 0!==r?r:0)+d/2,g=(null!==(i=null===(l=c.arrow)||void 0===l?void 0:l.y)&&void 0!==i?i:0)+f/2,w="",y="";return"bottom"===p?(w=s?v:`${h}px`,y=`${-f}px`):"top"===p?(w=s?v:`${h}px`,y=`${u.floating.height+f}px`):"right"===p?(w=`${-f}px`,y=s?v:`${g}px`):"left"===p&&(w=`${u.floating.width+f}px`,y=s?v:`${g}px`),{data:{x:w,y:y}}}});function eZ(e){let[t,n="center"]=e.split("-");return[t,n]}let eK=e=>{let{__scopePopper:t,children:n}=e,[r,i]=(0,o.useState)(null);return(0,o.createElement)(eO,{scope:t,anchor:r,onAnchorChange:i},n)},e$=eD,ez=e_,eU=eH},56935:function(e,t,n){n.d(t,{h:function(){return a}});var r=n(22988),o=n(2265),i=n(54887),l=n(25171);let a=(0,o.forwardRef)((e,t)=>{var n;let{container:a=null==globalThis?void 0:null===(n=globalThis.document)||void 0===n?void 0:n.body,...u}=e;return a?i.createPortal((0,o.createElement)(l.WV.div,(0,r.Z)({},u,{ref:t})),a):null})},31383:function(e,t,n){n.d(t,{z:function(){return a}});var r=n(2265),o=n(54887),i=n(1584),l=n(1336);let a=e=>{let{present:t,children:n}=e,a=function(e){var t,n;let[i,a]=(0,r.useState)(),c=(0,r.useRef)({}),s=(0,r.useRef)(e),d=(0,r.useRef)("none"),[f,p]=(t=e?"mounted":"unmounted",n={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},(0,r.useReducer)((e,t)=>{let r=n[e][t];return null!=r?r:e},t));return(0,r.useEffect)(()=>{let e=u(c.current);d.current="mounted"===f?e:"none"},[f]),(0,l.b)(()=>{let t=c.current,n=s.current;if(n!==e){let r=d.current,o=u(t);e?p("MOUNT"):"none"===o||(null==t?void 0:t.display)==="none"?p("UNMOUNT"):n&&r!==o?p("ANIMATION_OUT"):p("UNMOUNT"),s.current=e}},[e,p]),(0,l.b)(()=>{if(i){let e=e=>{let t=u(c.current).includes(e.animationName);e.target===i&&t&&(0,o.flushSync)(()=>p("ANIMATION_END"))},t=e=>{e.target===i&&(d.current=u(c.current))};return i.addEventListener("animationstart",t),i.addEventListener("animationcancel",e),i.addEventListener("animationend",e),()=>{i.removeEventListener("animationstart",t),i.removeEventListener("animationcancel",e),i.removeEventListener("animationend",e)}}p("ANIMATION_END")},[i,p]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:(0,r.useCallback)(e=>{e&&(c.current=getComputedStyle(e)),a(e)},[])}}(t),c="function"==typeof n?n({present:a.isPresent}):r.Children.only(n),s=(0,i.e)(a.ref,c.ref);return"function"==typeof n||a.isPresent?(0,r.cloneElement)(c,{ref:s}):null};function u(e){return(null==e?void 0:e.animationName)||"none"}a.displayName="Presence"},52431:function(e,t,n){n.d(t,{fC:function(){return y},z$:function(){return b}});var r=n(22988),o=n(2265),i=n(98324),l=n(25171);let a="Progress",[u,c]=(0,i.b)(a),[s,d]=u(a),f=(0,o.forwardRef)((e,t)=>{let{__scopeProgress:n,value:i,max:a,getValueLabel:u=m,...c}=e,d=g(a)?a:100,f=w(i,d)?i:null,p=h(f)?u(f,d):void 0;return(0,o.createElement)(s,{scope:n,value:f,max:d},(0,o.createElement)(l.WV.div,(0,r.Z)({"aria-valuemax":d,"aria-valuemin":0,"aria-valuenow":h(f)?f:void 0,"aria-valuetext":p,role:"progressbar","data-state":v(f,d),"data-value":null!=f?f:void 0,"data-max":d},c,{ref:t})))});f.propTypes={max(e,t,n){let r=e[t],o=String(r);return r&&!g(r)?Error(`Invalid prop \`max\` of value \`${o}\` supplied to \`${n}\`. Only numbers greater than 0 are valid max values. Defaulting to \`100\`.`):null},value(e,t,n){let r=e[t],o=String(r),i=g(e.max)?e.max:100;return null==r||w(r,i)?null:Error(`Invalid prop \`value\` of value \`${o}\` supplied to \`${n}\`. The \`value\` prop must be: + - a positive number + - less than the value passed to \`max\` (or 100 if no \`max\` prop is set) + - \`null\` if the progress is indeterminate. + +Defaulting to \`null\`.`)}};let p=(0,o.forwardRef)((e,t)=>{var n;let{__scopeProgress:i,...a}=e,u=d("ProgressIndicator",i);return(0,o.createElement)(l.WV.div,(0,r.Z)({"data-state":v(u.value,u.max),"data-value":null!==(n=u.value)&&void 0!==n?n:void 0,"data-max":u.max},a,{ref:t}))});function m(e,t){return`${Math.round(e/t*100)}%`}function v(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function h(e){return"number"==typeof e}function g(e){return h(e)&&!isNaN(e)&&e>0}function w(e,t){return h(e)&&!isNaN(e)&&e<=t&&e>=0}let y=f,b=p},17549:function(e,t,n){n.d(t,{$G:function(){return eI},B4:function(){return eS},JO:function(){return eC},VY:function(){return eT},Z0:function(){return eW},ZA:function(){return eA},__:function(){return eL},ck:function(){return eM},eT:function(){return eO},fC:function(){return eE},h_:function(){return eR},l_:function(){return eP},u_:function(){return eD},wU:function(){return ek},xz:function(){return ex}});var r=n(22988),o=n(2265),i=n(54887),l=n(62361),a=n(78149),u=n(90976),c=n(1584),s=n(98324),d=n(87513),f=n(53938),p=n(20589),m=n(80467),v=n(53201),h=n(25510),g=n(56935),w=n(25171),y=n(71538),b=n(75137),E=n(91715),x=n(1336),S=n(47250),C=n(31725),R=n(78369),T=n(6088);let P=[" ","Enter","ArrowUp","ArrowDown"],A=[" ","Enter"],L="Select",[M,O,k]=(0,u.B)(L),[D,I]=(0,s.b)(L,[k,h.D7]),W=(0,h.D7)(),[N,_]=D(L),[V,H]=D(L),F=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,disabled:i=!1,...l}=e,u=W(n),s=_("SelectTrigger",n),d=s.disabled||i,f=(0,c.e)(t,s.onTriggerChange),p=O(n),[m,v,g]=ey(e=>{let t=p().filter(e=>!e.disabled),n=t.find(e=>e.value===s.value),r=eb(t,e,n);void 0!==r&&s.onValueChange(r.value)}),y=()=>{d||(s.onOpenChange(!0),g())};return(0,o.createElement)(h.ee,(0,r.Z)({asChild:!0},u),(0,o.createElement)(w.WV.button,(0,r.Z)({type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":eg(s.value)?"":void 0},l,{ref:f,onClick:(0,a.M)(l.onClick,e=>{e.currentTarget.focus()}),onPointerDown:(0,a.M)(l.onPointerDown,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&(y(),s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)},e.preventDefault())}),onKeyDown:(0,a.M)(l.onKeyDown,e=>{let t=""!==m.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||v(e.key),(!t||" "!==e.key)&&P.includes(e.key)&&(y(),e.preventDefault())})})))}),B=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,className:i,style:l,children:a,placeholder:u="",...s}=e,d=_("SelectValue",n),{onValueNodeHasChildrenChange:f}=d,p=void 0!==a,m=(0,c.e)(t,d.onValueNodeChange);return(0,x.b)(()=>{f(p)},[f,p]),(0,o.createElement)(w.WV.span,(0,r.Z)({},s,{ref:m,style:{pointerEvents:"none"}}),eg(d.value)?(0,o.createElement)(o.Fragment,null,u):a)}),Z=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,children:i,...l}=e;return(0,o.createElement)(w.WV.span,(0,r.Z)({"aria-hidden":!0},l,{ref:t}),i||"▼")}),K="SelectContent",$=(0,o.forwardRef)((e,t)=>{let n=_(K,e.__scopeSelect),[l,a]=(0,o.useState)();return((0,x.b)(()=>{a(new DocumentFragment)},[]),n.open)?(0,o.createElement)(j,(0,r.Z)({},e,{ref:t})):l?(0,i.createPortal)((0,o.createElement)(z,{scope:e.__scopeSelect},(0,o.createElement)(M.Slot,{scope:e.__scopeSelect},(0,o.createElement)("div",null,e.children))),l):null}),[z,U]=D(K),j=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,position:i="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:u,onPointerDownOutside:s,side:d,sideOffset:v,align:h,alignOffset:g,arrowPadding:w,collisionBoundary:b,collisionPadding:E,sticky:x,hideWhenDetached:S,avoidCollisions:C,...P}=e,A=_(K,n),[L,M]=(0,o.useState)(null),[k,D]=(0,o.useState)(null),I=(0,c.e)(t,e=>M(e)),[W,N]=(0,o.useState)(null),[V,H]=(0,o.useState)(null),F=O(n),[B,Z]=(0,o.useState)(!1),$=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(L)return(0,R.Ry)(L)},[L]),(0,p.EW)();let U=(0,o.useCallback)(e=>{let[t,...n]=F().map(e=>e.ref.current),[r]=n.slice(-1),o=document.activeElement;for(let n of e)if(n===o||(null==n||n.scrollIntoView({block:"nearest"}),n===t&&k&&(k.scrollTop=0),n===r&&k&&(k.scrollTop=k.scrollHeight),null==n||n.focus(),document.activeElement!==o))return},[F,k]),j=(0,o.useCallback)(()=>U([W,L]),[U,W,L]);(0,o.useEffect)(()=>{B&&j()},[B,j]);let{onOpenChange:q,triggerPointerDownPosRef:G}=A;(0,o.useEffect)(()=>{if(L){let e={x:0,y:0},t=t=>{var n,r,o,i;e={x:Math.abs(Math.round(t.pageX)-(null!==(n=null===(r=G.current)||void 0===r?void 0:r.x)&&void 0!==n?n:0)),y:Math.abs(Math.round(t.pageY)-(null!==(o=null===(i=G.current)||void 0===i?void 0:i.y)&&void 0!==o?o:0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():L.contains(n.target)||q(!1),document.removeEventListener("pointermove",t),G.current=null};return null!==G.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[L,q,G]),(0,o.useEffect)(()=>{let e=()=>q(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[q]);let[J,Q]=ey(e=>{let t=F().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=eb(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),ee=(0,o.useCallback)((e,t,n)=>{let r=!$.current&&!n;(void 0!==A.value&&A.value===t||r)&&(N(e),r&&($.current=!0))},[A.value]),et=(0,o.useCallback)(()=>null==L?void 0:L.focus(),[L]),en=(0,o.useCallback)((e,t,n)=>{let r=!$.current&&!n;(void 0!==A.value&&A.value===t||r)&&H(e)},[A.value]),er="popper"===i?X:Y;return(0,o.createElement)(z,{scope:n,content:L,viewport:k,onViewportChange:D,itemRefCallback:ee,selectedItem:W,onItemLeave:et,itemTextRefCallback:en,focusSelectedItem:j,selectedItemText:V,position:i,isPositioned:B,searchRef:J},(0,o.createElement)(T.Z,{as:y.g7,allowPinchZoom:!0},(0,o.createElement)(m.M,{asChild:!0,trapped:A.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:(0,a.M)(l,e=>{var t;null===(t=A.trigger)||void 0===t||t.focus({preventScroll:!0}),e.preventDefault()})},(0,o.createElement)(f.XB,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>A.onOpenChange(!1)},(0,o.createElement)(er,(0,r.Z)({role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:e=>e.preventDefault()},P,er===X?{side:d,sideOffset:v,align:h,alignOffset:g,arrowPadding:w,collisionBoundary:b,collisionPadding:E,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{},{onPlaced:()=>Z(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...P.style},onKeyDown:(0,a.M)(P.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||Q(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=F().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>U(t)),e.preventDefault()}})}))))))}),Y=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,onPlaced:i,...a}=e,u=_(K,n),s=U(K,n),[d,f]=(0,o.useState)(null),[p,m]=(0,o.useState)(null),v=(0,c.e)(t,e=>m(e)),h=O(n),g=(0,o.useRef)(!1),y=(0,o.useRef)(!0),{viewport:b,selectedItem:E,selectedItemText:S,focusSelectedItem:C}=s,R=(0,o.useCallback)(()=>{if(u.trigger&&u.valueNode&&d&&p&&b&&E&&S){let e=u.trigger.getBoundingClientRect(),t=p.getBoundingClientRect(),n=u.valueNode.getBoundingClientRect(),r=S.getBoundingClientRect();if("rtl"!==u.dir){let o=r.left-t.left,i=n.left-o,a=e.left-i,u=e.width+a,c=Math.max(u,t.width),s=window.innerWidth-10,f=(0,l.u)(i,[10,s-c]);d.style.minWidth=u+"px",d.style.left=f+"px"}else{let o=t.right-r.right,i=window.innerWidth-n.right-o,a=window.innerWidth-e.right-i,u=e.width+a,c=Math.max(u,t.width),s=window.innerWidth-10,f=(0,l.u)(i,[10,s-c]);d.style.minWidth=u+"px",d.style.right=f+"px"}let o=h(),a=window.innerHeight-20,c=b.scrollHeight,s=window.getComputedStyle(p),f=parseInt(s.borderTopWidth,10),m=parseInt(s.paddingTop,10),v=parseInt(s.borderBottomWidth,10),w=f+m+c+parseInt(s.paddingBottom,10)+v,y=Math.min(5*E.offsetHeight,w),x=window.getComputedStyle(b),C=parseInt(x.paddingTop,10),R=parseInt(x.paddingBottom,10),T=e.top+e.height/2-10,P=E.offsetHeight/2,A=f+m+(E.offsetTop+P);if(A<=T){let e=E===o[o.length-1].ref.current;d.style.bottom="0px";let t=p.clientHeight-b.offsetTop-b.offsetHeight;d.style.height=A+Math.max(a-T,P+(e?R:0)+t+v)+"px"}else{let e=E===o[0].ref.current;d.style.top="0px";let t=Math.max(T,f+b.offsetTop+(e?C:0)+P);d.style.height=t+(w-A)+"px",b.scrollTop=A-T+b.offsetTop}d.style.margin="10px 0",d.style.minHeight=y+"px",d.style.maxHeight=a+"px",null==i||i(),requestAnimationFrame(()=>g.current=!0)}},[h,u.trigger,u.valueNode,d,p,b,E,S,u.dir,i]);(0,x.b)(()=>R(),[R]);let[T,P]=(0,o.useState)();(0,x.b)(()=>{p&&P(window.getComputedStyle(p).zIndex)},[p]);let A=(0,o.useCallback)(e=>{e&&!0===y.current&&(R(),null==C||C(),y.current=!1)},[R,C]);return(0,o.createElement)(q,{scope:n,contentWrapper:d,shouldExpandOnScrollRef:g,onScrollButtonChange:A},(0,o.createElement)("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T}},(0,o.createElement)(w.WV.div,(0,r.Z)({},a,{ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}}))))}),X=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,align:i="start",collisionPadding:l=10,...a}=e,u=W(n);return(0,o.createElement)(h.VY,(0,r.Z)({},u,a,{ref:t,align:i,collisionPadding:l,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}))}),[q,G]=D(K,{}),J="SelectViewport",Q=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,...i}=e,l=U(J,n),u=G(J,n),s=(0,c.e)(t,l.onViewportChange),d=(0,o.useRef)(0);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),(0,o.createElement)(M.Slot,{scope:n},(0,o.createElement)(w.WV.div,(0,r.Z)({"data-radix-select-viewport":"",role:"presentation"},i,{ref:s,style:{position:"relative",flex:1,overflow:"auto",...i.style},onScroll:(0,a.M)(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=u;if(null!=r&&r.current&&n){let e=Math.abs(d.current-t.scrollTop);if(e>0){let r=window.innerHeight-20,o=Math.max(parseFloat(n.style.minHeight),parseFloat(n.style.height));if(o0?a:0,n.style.justifyContent="flex-end")}}}d.current=t.scrollTop})}))))}),[ee,et]=D("SelectGroup"),en=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,...i}=e,l=(0,v.M)();return(0,o.createElement)(ee,{scope:n,id:l},(0,o.createElement)(w.WV.div,(0,r.Z)({role:"group","aria-labelledby":l},i,{ref:t})))}),er=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,...i}=e,l=et("SelectLabel",n);return(0,o.createElement)(w.WV.div,(0,r.Z)({id:l.id},i,{ref:t}))}),eo="SelectItem",[ei,el]=D(eo),ea=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,value:i,disabled:l=!1,textValue:u,...s}=e,d=_(eo,n),f=U(eo,n),p=d.value===i,[m,h]=(0,o.useState)(null!=u?u:""),[g,y]=(0,o.useState)(!1),b=(0,c.e)(t,e=>{var t;return null===(t=f.itemRefCallback)||void 0===t?void 0:t.call(f,e,i,l)}),E=(0,v.M)(),x=()=>{l||(d.onValueChange(i),d.onOpenChange(!1))};if(""===i)throw Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,o.createElement)(ei,{scope:n,value:i,disabled:l,textId:E,isSelected:p,onItemTextChange:(0,o.useCallback)(e=>{h(t=>{var n;return t||(null!==(n=null==e?void 0:e.textContent)&&void 0!==n?n:"").trim()})},[])},(0,o.createElement)(M.ItemSlot,{scope:n,value:i,disabled:l,textValue:m},(0,o.createElement)(w.WV.div,(0,r.Z)({role:"option","aria-labelledby":E,"data-highlighted":g?"":void 0,"aria-selected":p&&g,"data-state":p?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1},s,{ref:b,onFocus:(0,a.M)(s.onFocus,()=>y(!0)),onBlur:(0,a.M)(s.onBlur,()=>y(!1)),onPointerUp:(0,a.M)(s.onPointerUp,x),onPointerMove:(0,a.M)(s.onPointerMove,e=>{if(l){var t;null===(t=f.onItemLeave)||void 0===t||t.call(f)}else e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:(0,a.M)(s.onPointerLeave,e=>{if(e.currentTarget===document.activeElement){var t;null===(t=f.onItemLeave)||void 0===t||t.call(f)}}),onKeyDown:(0,a.M)(s.onKeyDown,e=>{var t;(null===(t=f.searchRef)||void 0===t?void 0:t.current)!==""&&" "===e.key||(A.includes(e.key)&&x()," "===e.key&&e.preventDefault())})}))))}),eu="SelectItemText",ec=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,className:l,style:a,...u}=e,s=_(eu,n),d=U(eu,n),f=el(eu,n),p=H(eu,n),[m,v]=(0,o.useState)(null),h=(0,c.e)(t,e=>v(e),f.onItemTextChange,e=>{var t;return null===(t=d.itemTextRefCallback)||void 0===t?void 0:t.call(d,e,f.value,f.disabled)}),g=null==m?void 0:m.textContent,y=(0,o.useMemo)(()=>(0,o.createElement)("option",{key:f.value,value:f.value,disabled:f.disabled},g),[f.disabled,f.value,g]),{onNativeOptionAdd:b,onNativeOptionRemove:E}=p;return(0,x.b)(()=>(b(y),()=>E(y)),[b,E,y]),(0,o.createElement)(o.Fragment,null,(0,o.createElement)(w.WV.span,(0,r.Z)({id:f.textId},u,{ref:h})),f.isSelected&&s.valueNode&&!s.valueNodeHasChildren?(0,i.createPortal)(u.children,s.valueNode):null)}),es=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,...i}=e;return el("SelectItemIndicator",n).isSelected?(0,o.createElement)(w.WV.span,(0,r.Z)({"aria-hidden":!0},i,{ref:t})):null}),ed="SelectScrollUpButton",ef=(0,o.forwardRef)((e,t)=>{let n=U(ed,e.__scopeSelect),i=G(ed,e.__scopeSelect),[l,a]=(0,o.useState)(!1),u=(0,c.e)(t,i.onScrollButtonChange);return(0,x.b)(()=>{if(n.viewport&&n.isPositioned){let t=n.viewport;function e(){a(t.scrollTop>0)}return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),l?(0,o.createElement)(ev,(0,r.Z)({},e,{ref:u,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}})):null}),ep="SelectScrollDownButton",em=(0,o.forwardRef)((e,t)=>{let n=U(ep,e.__scopeSelect),i=G(ep,e.__scopeSelect),[l,a]=(0,o.useState)(!1),u=(0,c.e)(t,i.onScrollButtonChange);return(0,x.b)(()=>{if(n.viewport&&n.isPositioned){let t=n.viewport;function e(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),l?(0,o.createElement)(ev,(0,r.Z)({},e,{ref:u,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}})):null}),ev=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,onAutoScroll:i,...l}=e,u=U("SelectScrollButton",n),c=(0,o.useRef)(null),s=O(n),d=(0,o.useCallback)(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return(0,o.useEffect)(()=>()=>d(),[d]),(0,x.b)(()=>{var e;let t=s().find(e=>e.ref.current===document.activeElement);null==t||null===(e=t.ref.current)||void 0===e||e.scrollIntoView({block:"nearest"})},[s]),(0,o.createElement)(w.WV.div,(0,r.Z)({"aria-hidden":!0},l,{ref:t,style:{flexShrink:0,...l.style},onPointerDown:(0,a.M)(l.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(i,50))}),onPointerMove:(0,a.M)(l.onPointerMove,()=>{var e;null===(e=u.onItemLeave)||void 0===e||e.call(u),null===c.current&&(c.current=window.setInterval(i,50))}),onPointerLeave:(0,a.M)(l.onPointerLeave,()=>{d()})}))}),eh=(0,o.forwardRef)((e,t)=>{let{__scopeSelect:n,...i}=e;return(0,o.createElement)(w.WV.div,(0,r.Z)({"aria-hidden":!0},i,{ref:t}))});function eg(e){return""===e||void 0===e}let ew=(0,o.forwardRef)((e,t)=>{let{value:n,...i}=e,l=(0,o.useRef)(null),a=(0,c.e)(t,l),u=(0,S.D)(n);return(0,o.useEffect)(()=>{let e=l.current,t=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(u!==n&&t){let r=new Event("change",{bubbles:!0});t.call(e,n),e.dispatchEvent(r)}},[u,n]),(0,o.createElement)(C.T,{asChild:!0},(0,o.createElement)("select",(0,r.Z)({},i,{ref:a,defaultValue:n})))});function ey(e){let t=(0,b.W)(e),n=(0,o.useRef)(""),r=(0,o.useRef)(0),i=(0,o.useCallback)(e=>{let o=n.current+e;t(o),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout(()=>e(""),1e3))}(o)},[t]),l=(0,o.useCallback)(()=>{n.current="",window.clearTimeout(r.current)},[]);return(0,o.useEffect)(()=>()=>window.clearTimeout(r.current),[]),[n,i,l]}function eb(e,t,n){var r;let o=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=(r=Math.max(n?e.indexOf(n):-1,0),e.map((t,n)=>e[(r+n)%e.length]));1===o.length&&(i=i.filter(e=>e!==n));let l=i.find(e=>e.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}ew.displayName="BubbleSelect";let eE=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:l,value:a,defaultValue:u,onValueChange:c,dir:s,name:f,autoComplete:p,disabled:m,required:g}=e,w=W(t),[y,b]=(0,o.useState)(null),[x,S]=(0,o.useState)(null),[C,R]=(0,o.useState)(!1),T=(0,d.gm)(s),[P=!1,A]=(0,E.T)({prop:r,defaultProp:i,onChange:l}),[L,O]=(0,E.T)({prop:a,defaultProp:u,onChange:c}),k=(0,o.useRef)(null),D=!y||!!y.closest("form"),[I,_]=(0,o.useState)(new Set),H=Array.from(I).map(e=>e.props.value).join(";");return(0,o.createElement)(h.fC,w,(0,o.createElement)(N,{required:g,scope:t,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:R,contentId:(0,v.M)(),value:L,onValueChange:O,open:P,onOpenChange:A,dir:T,triggerPointerDownPosRef:k,disabled:m},(0,o.createElement)(M.Provider,{scope:t},(0,o.createElement)(V,{scope:e.__scopeSelect,onNativeOptionAdd:(0,o.useCallback)(e=>{_(t=>new Set(t).add(e))},[]),onNativeOptionRemove:(0,o.useCallback)(e=>{_(t=>{let n=new Set(t);return n.delete(e),n})},[])},n)),D?(0,o.createElement)(ew,{key:H,"aria-hidden":!0,required:g,tabIndex:-1,name:f,autoComplete:p,value:L,onChange:e=>O(e.target.value),disabled:m},void 0===L?(0,o.createElement)("option",{value:""}):null,Array.from(I)):null))},ex=F,eS=B,eC=Z,eR=e=>(0,o.createElement)(g.h,(0,r.Z)({asChild:!0},e)),eT=$,eP=Q,eA=en,eL=er,eM=ea,eO=ec,ek=es,eD=ef,eI=em,eW=eh},31725:function(e,t,n){n.d(t,{T:function(){return l},f:function(){return a}});var r=n(22988),o=n(2265),i=n(25171);let l=(0,o.forwardRef)((e,t)=>(0,o.createElement)(i.WV.span,(0,r.Z)({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}))),a=l}}]); \ No newline at end of file diff --git a/_next/static/chunks/813-2d6d2c33c642dc38.js b/_next/static/chunks/813-2d6d2c33c642dc38.js new file mode 100644 index 0000000000000000000000000000000000000000..cb5eddf0ea6b5beca6bbcf0cd242054a28d17cb4 --- /dev/null +++ b/_next/static/chunks/813-2d6d2c33c642dc38.js @@ -0,0 +1,5 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[813],{56800:function(e,t){var r;/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e="",t=0;t{let{__scopeAvatar:r,...o}=e,[l,i]=(0,a.useState)("idle");return(0,a.createElement)(m,{scope:r,imageLoadingStatus:l,onImageLoadingStatusChange:i},(0,a.createElement)(s.WV.span,(0,n.Z)({},o,{ref:t})))}),v=(0,a.forwardRef)((e,t)=>{let{__scopeAvatar:r,src:o,onLoadingStatusChange:c=()=>{},...u}=e,d=f("AvatarImage",r),m=function(e){let[t,r]=(0,a.useState)("idle");return(0,i.b)(()=>{if(!e){r("error");return}let t=!0,n=new window.Image,a=e=>()=>{t&&r(e)};return r("loading"),n.onload=a("loaded"),n.onerror=a("error"),n.src=e,()=>{t=!1}},[e]),t}(o),p=(0,l.W)(e=>{c(e),d.onImageLoadingStatusChange(e)});return(0,i.b)(()=>{"idle"!==m&&p(m)},[m,p]),"loaded"===m?(0,a.createElement)(s.WV.img,(0,n.Z)({},u,{ref:t,src:o})):null}),h=(0,a.forwardRef)((e,t)=>{let{__scopeAvatar:r,delayMs:o,...l}=e,i=f("AvatarFallback",r),[c,u]=(0,a.useState)(void 0===o);return(0,a.useEffect)(()=>{if(void 0!==o){let e=window.setTimeout(()=>u(!0),o);return()=>window.clearTimeout(e)}},[o]),c&&"loaded"!==i.imageLoadingStatus?(0,a.createElement)(s.WV.span,(0,n.Z)({},l,{ref:t})):null}),g=p,C=v,E=h},69324:function(e,t,r){"use strict";r.d(t,{Ed:function(){return v},fC:function(){return N},z$:function(){return R}});var n=r(22988),a=r(2265),o=r(1584),l=r(98324),i=r(78149),s=r(91715),c=r(47250),u=r(75238),d=r(31383),m=r(25171);let f="Checkbox",[p,v]=(0,l.b)(f),[h,g]=p(f),C=(0,a.forwardRef)((e,t)=>{let{__scopeCheckbox:r,name:l,checked:c,defaultChecked:u,required:d,disabled:f,value:p="on",onCheckedChange:v,...g}=e,[C,E]=(0,a.useState)(null),N=(0,o.e)(t,e=>E(e)),R=(0,a.useRef)(!1),x=!C||!!C.closest("form"),[M=!1,T]=(0,s.T)({prop:c,defaultProp:u,onChange:v}),_=(0,a.useRef)(M);return(0,a.useEffect)(()=>{let e=null==C?void 0:C.form;if(e){let t=()=>T(_.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[C,T]),(0,a.createElement)(h,{scope:r,state:M,disabled:f},(0,a.createElement)(m.WV.button,(0,n.Z)({type:"button",role:"checkbox","aria-checked":w(M)?"mixed":M,"aria-required":d,"data-state":b(M),"data-disabled":f?"":void 0,disabled:f,value:p},g,{ref:N,onKeyDown:(0,i.M)(e.onKeyDown,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,i.M)(e.onClick,e=>{T(e=>!!w(e)||!e),x&&(R.current=e.isPropagationStopped(),R.current||e.stopPropagation())})})),x&&(0,a.createElement)(y,{control:C,bubbles:!R.current,name:l,value:p,checked:M,required:d,disabled:f,style:{transform:"translateX(-100%)"}}))}),E=(0,a.forwardRef)((e,t)=>{let{__scopeCheckbox:r,forceMount:o,...l}=e,i=g("CheckboxIndicator",r);return(0,a.createElement)(d.z,{present:o||w(i.state)||!0===i.state},(0,a.createElement)(m.WV.span,(0,n.Z)({"data-state":b(i.state),"data-disabled":i.disabled?"":void 0},l,{ref:t,style:{pointerEvents:"none",...e.style}})))}),y=e=>{let{control:t,checked:r,bubbles:o=!0,...l}=e,i=(0,a.useRef)(null),s=(0,c.D)(r),d=(0,u.t)(t);return(0,a.useEffect)(()=>{let e=i.current,t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(s!==r&&t){let n=new Event("click",{bubbles:o});e.indeterminate=w(r),t.call(e,!w(r)&&r),e.dispatchEvent(n)}},[s,r,o]),(0,a.createElement)("input",(0,n.Z)({type:"checkbox","aria-hidden":!0,defaultChecked:!w(r)&&r},l,{tabIndex:-1,ref:i,style:{...e.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function w(e){return"indeterminate"===e}function b(e){return w(e)?"indeterminate":e?"checked":"unchecked"}let N=C,R=E},13304:function(e,t,r){"use strict";r.d(t,{Dx:function(){return X},VY:function(){return j},aV:function(){return U},dk:function(){return Y},fC:function(){return G},h_:function(){return K},jm:function(){return B},p8:function(){return w},x8:function(){return q},xz:function(){return H}});var n=r(22988),a=r(2265),o=r(78149),l=r(1584),i=r(98324),s=r(53201),c=r(91715),u=r(53938),d=r(80467),m=r(56935),f=r(31383),p=r(25171),v=r(20589),h=r(6088),g=r(78369),C=r(71538);let E="Dialog",[y,w]=(0,i.b)(E),[b,N]=y(E),R=(0,a.forwardRef)((e,t)=>{let{__scopeDialog:r,...i}=e,s=N("DialogTrigger",r),c=(0,l.e)(t,s.triggerRef);return(0,a.createElement)(p.WV.button,(0,n.Z)({type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":F(s.open)},i,{ref:c,onClick:(0,o.M)(e.onClick,s.onOpenToggle)}))}),x="DialogPortal",[M,T]=y(x,{forceMount:void 0}),_="DialogOverlay",S=(0,a.forwardRef)((e,t)=>{let r=T(_,e.__scopeDialog),{forceMount:o=r.forceMount,...l}=e,i=N(_,e.__scopeDialog);return i.modal?(0,a.createElement)(f.z,{present:o||i.open},(0,a.createElement)(k,(0,n.Z)({},l,{ref:t}))):null}),k=(0,a.forwardRef)((e,t)=>{let{__scopeDialog:r,...o}=e,l=N(_,r);return(0,a.createElement)(h.Z,{as:C.g7,allowPinchZoom:!0,shards:[l.contentRef]},(0,a.createElement)(p.WV.div,(0,n.Z)({"data-state":F(l.open)},o,{ref:t,style:{pointerEvents:"auto",...o.style}})))}),D="DialogContent",P=(0,a.forwardRef)((e,t)=>{let r=T(D,e.__scopeDialog),{forceMount:o=r.forceMount,...l}=e,i=N(D,e.__scopeDialog);return(0,a.createElement)(f.z,{present:o||i.open},i.modal?(0,a.createElement)(I,(0,n.Z)({},l,{ref:t})):(0,a.createElement)(L,(0,n.Z)({},l,{ref:t})))}),I=(0,a.forwardRef)((e,t)=>{let r=N(D,e.__scopeDialog),i=(0,a.useRef)(null),s=(0,l.e)(t,r.contentRef,i);return(0,a.useEffect)(()=>{let e=i.current;if(e)return(0,g.Ry)(e)},[]),(0,a.createElement)(A,(0,n.Z)({},e,{ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,o.M)(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),null===(t=r.triggerRef.current)||void 0===t||t.focus()}),onPointerDownOutside:(0,o.M)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:(0,o.M)(e.onFocusOutside,e=>e.preventDefault())}))}),L=(0,a.forwardRef)((e,t)=>{let r=N(D,e.__scopeDialog),o=(0,a.useRef)(!1),l=(0,a.useRef)(!1);return(0,a.createElement)(A,(0,n.Z)({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var n,a;null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,t),t.defaultPrevented||(o.current||null===(a=r.triggerRef.current)||void 0===a||a.focus(),t.preventDefault()),o.current=!1,l.current=!1},onInteractOutside:t=>{var n,a;null===(n=e.onInteractOutside)||void 0===n||n.call(e,t),t.defaultPrevented||(o.current=!0,"pointerdown"!==t.detail.originalEvent.type||(l.current=!0));let i=t.target;(null===(a=r.triggerRef.current)||void 0===a?void 0:a.contains(i))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&l.current&&t.preventDefault()}}))}),A=(0,a.forwardRef)((e,t)=>{let{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,...c}=e,m=N(D,r),f=(0,a.useRef)(null),p=(0,l.e)(t,f);return(0,v.EW)(),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(d.M,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:s},(0,a.createElement)(u.XB,(0,n.Z)({role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":F(m.open)},c,{ref:p,onDismiss:()=>m.onOpenChange(!1)}))),!1)}),z="DialogTitle",O=(0,a.forwardRef)((e,t)=>{let{__scopeDialog:r,...o}=e,l=N(z,r);return(0,a.createElement)(p.WV.h2,(0,n.Z)({id:l.titleId},o,{ref:t}))}),Z=(0,a.forwardRef)((e,t)=>{let{__scopeDialog:r,...o}=e,l=N("DialogDescription",r);return(0,a.createElement)(p.WV.p,(0,n.Z)({id:l.descriptionId},o,{ref:t}))}),V=(0,a.forwardRef)((e,t)=>{let{__scopeDialog:r,...l}=e,i=N("DialogClose",r);return(0,a.createElement)(p.WV.button,(0,n.Z)({type:"button"},l,{ref:t,onClick:(0,o.M)(e.onClick,()=>i.onOpenChange(!1))}))});function F(e){return e?"open":"closed"}let[B,W]=(0,i.k)("DialogTitleWarning",{contentName:D,titleName:z,docsSlug:"dialog"}),G=e=>{let{__scopeDialog:t,children:r,open:n,defaultOpen:o,onOpenChange:l,modal:i=!0}=e,u=(0,a.useRef)(null),d=(0,a.useRef)(null),[m=!1,f]=(0,c.T)({prop:n,defaultProp:o,onChange:l});return(0,a.createElement)(b,{scope:t,triggerRef:u,contentRef:d,contentId:(0,s.M)(),titleId:(0,s.M)(),descriptionId:(0,s.M)(),open:m,onOpenChange:f,onOpenToggle:(0,a.useCallback)(()=>f(e=>!e),[f]),modal:i},r)},H=R,K=e=>{let{__scopeDialog:t,forceMount:r,children:n,container:o}=e,l=N(x,t);return(0,a.createElement)(M,{scope:t,forceMount:r},a.Children.map(n,e=>(0,a.createElement)(f.z,{present:r||l.open},(0,a.createElement)(m.h,{asChild:!0,container:o},e))))},U=S,j=P,X=O,Y=Z,q=V},6461:function(e,t,r){"use strict";r.d(t,{Ee:function(){return eP},Eh:function(){return ez},Rk:function(){return eI},Tr:function(){return eO},VY:function(){return eT},Wf:function(){return I},Z0:function(){return eA},ZA:function(){return e_},__:function(){return eS},ck:function(){return ek},ee:function(){return ex},fC:function(){return eR},fF:function(){return eZ},h_:function(){return eM},oC:function(){return eD},tu:function(){return eV},wU:function(){return eL}});var n=r(22988),a=r(2265),o=r(78149),l=r(90976),i=r(1584),s=r(98324),c=r(87513),u=r(53938),d=r(20589),m=r(80467),f=r(53201),p=r(25510),v=r(56935),h=r(31383),g=r(25171),C=r(53398),E=r(71538),y=r(75137),w=r(78369),b=r(6088);let N=["Enter"," "],R=["ArrowUp","PageDown","End"],x=["ArrowDown","PageUp","Home",...R],M={ltr:[...N,"ArrowRight"],rtl:[...N,"ArrowLeft"]},T={ltr:["ArrowLeft"],rtl:["ArrowRight"]},_="Menu",[S,k,D]=(0,l.B)(_),[P,I]=(0,s.b)(_,[D,p.D7,C.Pc]),L=(0,p.D7)(),A=(0,C.Pc)(),[z,O]=P(_),[Z,V]=P(_),F=(0,a.forwardRef)((e,t)=>{let{__scopeMenu:r,...o}=e,l=L(r);return(0,a.createElement)(p.ee,(0,n.Z)({},l,o,{ref:t}))}),B="MenuPortal",[W,G]=P(B,{forceMount:void 0}),H="MenuContent",[K,U]=P(H),j=(0,a.forwardRef)((e,t)=>{let r=G(H,e.__scopeMenu),{forceMount:o=r.forceMount,...l}=e,i=O(H,e.__scopeMenu),s=V(H,e.__scopeMenu);return(0,a.createElement)(S.Provider,{scope:e.__scopeMenu},(0,a.createElement)(h.z,{present:o||i.open},(0,a.createElement)(S.Slot,{scope:e.__scopeMenu},s.modal?(0,a.createElement)(X,(0,n.Z)({},l,{ref:t})):(0,a.createElement)(Y,(0,n.Z)({},l,{ref:t})))))}),X=(0,a.forwardRef)((e,t)=>{let r=O(H,e.__scopeMenu),l=(0,a.useRef)(null),s=(0,i.e)(t,l);return(0,a.useEffect)(()=>{let e=l.current;if(e)return(0,w.Ry)(e)},[]),(0,a.createElement)(q,(0,n.Z)({},e,{ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:(0,o.M)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)}))}),Y=(0,a.forwardRef)((e,t)=>{let r=O(H,e.__scopeMenu);return(0,a.createElement)(q,(0,n.Z)({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)}))}),q=(0,a.forwardRef)((e,t)=>{let{__scopeMenu:r,loop:l=!1,trapFocus:s,onOpenAutoFocus:c,onCloseAutoFocus:f,disableOutsidePointerEvents:v,onEntryFocus:h,onEscapeKeyDown:g,onPointerDownOutside:y,onFocusOutside:w,onInteractOutside:N,onDismiss:M,disableOutsideScroll:T,..._}=e,S=O(H,r),D=V(H,r),P=L(r),I=A(r),z=k(r),[Z,F]=(0,a.useState)(null),B=(0,a.useRef)(null),W=(0,i.e)(t,B,S.onContentChange),G=(0,a.useRef)(0),U=(0,a.useRef)(""),j=(0,a.useRef)(0),X=(0,a.useRef)(null),Y=(0,a.useRef)("right"),q=(0,a.useRef)(0),$=T?b.Z:a.Fragment,J=T?{as:E.g7,allowPinchZoom:!0}:void 0,Q=e=>{var t,r;let n=U.current+e,a=z().filter(e=>!e.disabled),o=document.activeElement,l=null===(t=a.find(e=>e.ref.current===o))||void 0===t?void 0:t.textValue,i=function(e,t,r){var n;let a=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=(n=Math.max(r?e.indexOf(r):-1,0),e.map((t,r)=>e[(n+r)%e.length]));1===a.length&&(o=o.filter(e=>e!==r));let l=o.find(e=>e.toLowerCase().startsWith(a.toLowerCase()));return l!==r?l:void 0}(a.map(e=>e.textValue),n,l),s=null===(r=a.find(e=>e.textValue===i))||void 0===r?void 0:r.ref.current;!function e(t){U.current=t,window.clearTimeout(G.current),""!==t&&(G.current=window.setTimeout(()=>e(""),1e3))}(n),s&&setTimeout(()=>s.focus())};(0,a.useEffect)(()=>()=>window.clearTimeout(G.current),[]),(0,d.EW)();let ee=(0,a.useCallback)(e=>{var t,r,n;return Y.current===(null===(t=X.current)||void 0===t?void 0:t.side)&&!!(n=null===(r=X.current)||void 0===r?void 0:r.area)&&function(e,t){let{x:r,y:n}=e,a=!1;for(let e=0,o=t.length-1;en!=c>n&&r<(s-l)*(n-i)/(c-i)+l&&(a=!a)}return a}({x:e.clientX,y:e.clientY},n)},[]);return(0,a.createElement)(K,{scope:r,searchRef:U,onItemEnter:(0,a.useCallback)(e=>{ee(e)&&e.preventDefault()},[ee]),onItemLeave:(0,a.useCallback)(e=>{var t;ee(e)||(null===(t=B.current)||void 0===t||t.focus(),F(null))},[ee]),onTriggerLeave:(0,a.useCallback)(e=>{ee(e)&&e.preventDefault()},[ee]),pointerGraceTimerRef:j,onPointerGraceIntentChange:(0,a.useCallback)(e=>{X.current=e},[])},(0,a.createElement)($,J,(0,a.createElement)(m.M,{asChild:!0,trapped:s,onMountAutoFocus:(0,o.M)(c,e=>{var t;e.preventDefault(),null===(t=B.current)||void 0===t||t.focus()}),onUnmountAutoFocus:f},(0,a.createElement)(u.XB,{asChild:!0,disableOutsidePointerEvents:v,onEscapeKeyDown:g,onPointerDownOutside:y,onFocusOutside:w,onInteractOutside:N,onDismiss:M},(0,a.createElement)(C.fC,(0,n.Z)({asChild:!0},I,{dir:D.dir,orientation:"vertical",loop:l,currentTabStopId:Z,onCurrentTabStopIdChange:F,onEntryFocus:(0,o.M)(h,e=>{D.isUsingKeyboardRef.current||e.preventDefault()})}),(0,a.createElement)(p.VY,(0,n.Z)({role:"menu","aria-orientation":"vertical","data-state":ey(S.open),"data-radix-menu-content":"",dir:D.dir},P,_,{ref:W,style:{outline:"none",..._.style},onKeyDown:(0,o.M)(_.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!r&&n&&Q(e.key));let a=B.current;if(e.target!==a||!x.includes(e.key))return;e.preventDefault();let o=z().filter(e=>!e.disabled).map(e=>e.ref.current);R.includes(e.key)&&o.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(o)}),onBlur:(0,o.M)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(G.current),U.current="")}),onPointerMove:(0,o.M)(e.onPointerMove,eN(e=>{let t=e.target,r=q.current!==e.clientX;if(e.currentTarget.contains(t)&&r){let t=e.clientX>q.current?"right":"left";Y.current=t,q.current=e.clientX}}))})))))))}),$=(0,a.forwardRef)((e,t)=>{let{__scopeMenu:r,...o}=e;return(0,a.createElement)(g.WV.div,(0,n.Z)({role:"group"},o,{ref:t}))}),J=(0,a.forwardRef)((e,t)=>{let{__scopeMenu:r,...o}=e;return(0,a.createElement)(g.WV.div,(0,n.Z)({},o,{ref:t}))}),Q="MenuItem",ee="menu.itemSelect",et=(0,a.forwardRef)((e,t)=>{let{disabled:r=!1,onSelect:l,...s}=e,c=(0,a.useRef)(null),u=V(Q,e.__scopeMenu),d=U(Q,e.__scopeMenu),m=(0,i.e)(t,c),f=(0,a.useRef)(!1);return(0,a.createElement)(er,(0,n.Z)({},s,{ref:m,disabled:r,onClick:(0,o.M)(e.onClick,()=>{let e=c.current;if(!r&&e){let t=new CustomEvent(ee,{bubbles:!0,cancelable:!0});e.addEventListener(ee,e=>null==l?void 0:l(e),{once:!0}),(0,g.jH)(e,t),t.defaultPrevented?f.current=!1:u.onClose()}}),onPointerDown:t=>{var r;null===(r=e.onPointerDown)||void 0===r||r.call(e,t),f.current=!0},onPointerUp:(0,o.M)(e.onPointerUp,e=>{var t;f.current||null===(t=e.currentTarget)||void 0===t||t.click()}),onKeyDown:(0,o.M)(e.onKeyDown,e=>{let t=""!==d.searchRef.current;!r&&(!t||" "!==e.key)&&N.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})}))}),er=(0,a.forwardRef)((e,t)=>{let{__scopeMenu:r,disabled:l=!1,textValue:s,...c}=e,u=U(Q,r),d=A(r),m=(0,a.useRef)(null),f=(0,i.e)(t,m),[p,v]=(0,a.useState)(!1),[h,E]=(0,a.useState)("");return(0,a.useEffect)(()=>{let e=m.current;if(e){var t;E((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}},[c.children]),(0,a.createElement)(S.ItemSlot,{scope:r,disabled:l,textValue:null!=s?s:h},(0,a.createElement)(C.ck,(0,n.Z)({asChild:!0},d,{focusable:!l}),(0,a.createElement)(g.WV.div,(0,n.Z)({role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":l||void 0,"data-disabled":l?"":void 0},c,{ref:f,onPointerMove:(0,o.M)(e.onPointerMove,eN(e=>{l?u.onItemLeave(e):(u.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus())})),onPointerLeave:(0,o.M)(e.onPointerLeave,eN(e=>u.onItemLeave(e))),onFocus:(0,o.M)(e.onFocus,()=>v(!0)),onBlur:(0,o.M)(e.onBlur,()=>v(!1))}))))}),en=(0,a.forwardRef)((e,t)=>{let{checked:r=!1,onCheckedChange:l,...i}=e;return(0,a.createElement)(ec,{scope:e.__scopeMenu,checked:r},(0,a.createElement)(et,(0,n.Z)({role:"menuitemcheckbox","aria-checked":ew(r)?"mixed":r},i,{ref:t,"data-state":eb(r),onSelect:(0,o.M)(i.onSelect,()=>null==l?void 0:l(!!ew(r)||!r),{checkForDefaultPrevented:!1})})))}),[ea,eo]=P("MenuRadioGroup",{value:void 0,onValueChange:()=>{}}),el=(0,a.forwardRef)((e,t)=>{let{value:r,onValueChange:o,...l}=e,i=(0,y.W)(o);return(0,a.createElement)(ea,{scope:e.__scopeMenu,value:r,onValueChange:i},(0,a.createElement)($,(0,n.Z)({},l,{ref:t})))}),ei=(0,a.forwardRef)((e,t)=>{let{value:r,...l}=e,i=eo("MenuRadioItem",e.__scopeMenu),s=r===i.value;return(0,a.createElement)(ec,{scope:e.__scopeMenu,checked:s},(0,a.createElement)(et,(0,n.Z)({role:"menuitemradio","aria-checked":s},l,{ref:t,"data-state":eb(s),onSelect:(0,o.M)(l.onSelect,()=>{var e;return null===(e=i.onValueChange)||void 0===e?void 0:e.call(i,r)},{checkForDefaultPrevented:!1})})))}),es="MenuItemIndicator",[ec,eu]=P(es,{checked:!1}),ed=(0,a.forwardRef)((e,t)=>{let{__scopeMenu:r,forceMount:o,...l}=e,i=eu(es,r);return(0,a.createElement)(h.z,{present:o||ew(i.checked)||!0===i.checked},(0,a.createElement)(g.WV.span,(0,n.Z)({},l,{ref:t,"data-state":eb(i.checked)})))}),em=(0,a.forwardRef)((e,t)=>{let{__scopeMenu:r,...o}=e;return(0,a.createElement)(g.WV.div,(0,n.Z)({role:"separator","aria-orientation":"horizontal"},o,{ref:t}))}),ef=(0,a.forwardRef)((e,t)=>{let{__scopeMenu:r,...o}=e,l=L(r);return(0,a.createElement)(p.Eh,(0,n.Z)({},l,o,{ref:t}))}),ep="MenuSub",[ev,eh]=P(ep),eg="MenuSubTrigger",eC=(0,a.forwardRef)((e,t)=>{let r=O(eg,e.__scopeMenu),l=V(eg,e.__scopeMenu),s=eh(eg,e.__scopeMenu),c=U(eg,e.__scopeMenu),u=(0,a.useRef)(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=c,f={__scopeMenu:e.__scopeMenu},p=(0,a.useCallback)(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return(0,a.useEffect)(()=>p,[p]),(0,a.useEffect)(()=>{let e=d.current;return()=>{window.clearTimeout(e),m(null)}},[d,m]),(0,a.createElement)(F,(0,n.Z)({asChild:!0},f),(0,a.createElement)(er,(0,n.Z)({id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":ey(r.open)},e,{ref:(0,i.F)(t,s.onTriggerChange),onClick:t=>{var n;null===(n=e.onClick)||void 0===n||n.call(e,t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:(0,o.M)(e.onPointerMove,eN(t=>{c.onItemEnter(t),t.defaultPrevented||e.disabled||r.open||u.current||(c.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),p()},100))})),onPointerLeave:(0,o.M)(e.onPointerLeave,eN(e=>{var t,n;p();let a=null===(t=r.content)||void 0===t?void 0:t.getBoundingClientRect();if(a){let t=null===(n=r.content)||void 0===n?void 0:n.dataset.side,o="right"===t,l=a[o?"left":"right"],i=a[o?"right":"left"];c.onPointerGraceIntentChange({area:[{x:e.clientX+(o?-5:5),y:e.clientY},{x:l,y:a.top},{x:i,y:a.top},{x:i,y:a.bottom},{x:l,y:a.bottom}],side:t}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(e),e.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:(0,o.M)(e.onKeyDown,t=>{let n=""!==c.searchRef.current;if(!e.disabled&&(!n||" "!==t.key)&&M[l.dir].includes(t.key)){var a;r.onOpenChange(!0),null===(a=r.content)||void 0===a||a.focus(),t.preventDefault()}})})))}),eE=(0,a.forwardRef)((e,t)=>{let r=G(H,e.__scopeMenu),{forceMount:l=r.forceMount,...s}=e,c=O(H,e.__scopeMenu),u=V(H,e.__scopeMenu),d=eh("MenuSubContent",e.__scopeMenu),m=(0,a.useRef)(null),f=(0,i.e)(t,m);return(0,a.createElement)(S.Provider,{scope:e.__scopeMenu},(0,a.createElement)(h.z,{present:l||c.open},(0,a.createElement)(S.Slot,{scope:e.__scopeMenu},(0,a.createElement)(q,(0,n.Z)({id:d.contentId,"aria-labelledby":d.triggerId},s,{ref:f,align:"start",side:"rtl"===u.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var t;u.isUsingKeyboardRef.current&&(null===(t=m.current)||void 0===t||t.focus()),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,o.M)(e.onFocusOutside,e=>{e.target!==d.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:(0,o.M)(e.onEscapeKeyDown,e=>{u.onClose(),e.preventDefault()}),onKeyDown:(0,o.M)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=T[u.dir].includes(e.key);if(t&&r){var n;c.onOpenChange(!1),null===(n=d.trigger)||void 0===n||n.focus(),e.preventDefault()}})})))))});function ey(e){return e?"open":"closed"}function ew(e){return"indeterminate"===e}function eb(e){return ew(e)?"indeterminate":e?"checked":"unchecked"}function eN(e){return t=>"mouse"===t.pointerType?e(t):void 0}let eR=e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:o,onOpenChange:l,modal:i=!0}=e,s=L(t),[u,d]=(0,a.useState)(null),m=(0,a.useRef)(!1),f=(0,y.W)(l),v=(0,c.gm)(o);return(0,a.useEffect)(()=>{let e=()=>{m.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>m.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,a.createElement)(p.fC,s,(0,a.createElement)(z,{scope:t,open:r,onOpenChange:f,content:u,onContentChange:d},(0,a.createElement)(Z,{scope:t,onClose:(0,a.useCallback)(()=>f(!1),[f]),isUsingKeyboardRef:m,dir:v,modal:i},n)))},ex=F,eM=e=>{let{__scopeMenu:t,forceMount:r,children:n,container:o}=e,l=O(B,t);return(0,a.createElement)(W,{scope:t,forceMount:r},(0,a.createElement)(h.z,{present:r||l.open},(0,a.createElement)(v.h,{asChild:!0,container:o},n)))},eT=j,e_=$,eS=J,ek=et,eD=en,eP=el,eI=ei,eL=ed,eA=em,ez=ef,eO=e=>{let{__scopeMenu:t,children:r,open:n=!1,onOpenChange:o}=e,l=O(ep,t),i=L(t),[s,c]=(0,a.useState)(null),[u,d]=(0,a.useState)(null),m=(0,y.W)(o);return(0,a.useEffect)(()=>(!1===l.open&&m(!1),()=>m(!1)),[l.open,m]),(0,a.createElement)(p.fC,i,(0,a.createElement)(z,{scope:t,open:n,onOpenChange:m,content:u,onContentChange:d},(0,a.createElement)(ev,{scope:t,contentId:(0,f.M)(),triggerId:(0,f.M)(),trigger:s,onTriggerChange:c},r)))},eZ=eC,eV=eE},61485:function(e,t,r){"use strict";r.d(t,{VY:function(){return W},ee:function(){return V},fC:function(){return Z},h_:function(){return B},x8:function(){return G},xz:function(){return F}});var n=r(22988),a=r(2265),o=r(78149),l=r(1584),i=r(98324),s=r(53938),c=r(20589),u=r(80467),d=r(53201),m=r(25510),f=r(56935),p=r(31383),v=r(25171),h=r(71538),g=r(91715),C=r(78369),E=r(6088);let y="Popover",[w,b]=(0,i.b)(y,[m.D7]),N=(0,m.D7)(),[R,x]=w(y),M=(0,a.forwardRef)((e,t)=>{let{__scopePopover:r,...o}=e,l=x("PopoverAnchor",r),i=N(r),{onCustomAnchorAdd:s,onCustomAnchorRemove:c}=l;return(0,a.useEffect)(()=>(s(),()=>c()),[s,c]),(0,a.createElement)(m.ee,(0,n.Z)({},i,o,{ref:t}))}),T=(0,a.forwardRef)((e,t)=>{let{__scopePopover:r,...i}=e,s=x("PopoverTrigger",r),c=N(r),u=(0,l.e)(t,s.triggerRef),d=(0,a.createElement)(v.WV.button,(0,n.Z)({type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":O(s.open)},i,{ref:u,onClick:(0,o.M)(e.onClick,s.onOpenToggle)}));return s.hasCustomAnchor?d:(0,a.createElement)(m.ee,(0,n.Z)({asChild:!0},c),d)}),_="PopoverPortal",[S,k]=w(_,{forceMount:void 0}),D="PopoverContent",P=(0,a.forwardRef)((e,t)=>{let r=k(D,e.__scopePopover),{forceMount:o=r.forceMount,...l}=e,i=x(D,e.__scopePopover);return(0,a.createElement)(p.z,{present:o||i.open},i.modal?(0,a.createElement)(I,(0,n.Z)({},l,{ref:t})):(0,a.createElement)(L,(0,n.Z)({},l,{ref:t})))}),I=(0,a.forwardRef)((e,t)=>{let r=x(D,e.__scopePopover),i=(0,a.useRef)(null),s=(0,l.e)(t,i),c=(0,a.useRef)(!1);return(0,a.useEffect)(()=>{let e=i.current;if(e)return(0,C.Ry)(e)},[]),(0,a.createElement)(E.Z,{as:h.g7,allowPinchZoom:!0},(0,a.createElement)(A,(0,n.Z)({},e,{ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,o.M)(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),c.current||null===(t=r.triggerRef.current)||void 0===t||t.focus()}),onPointerDownOutside:(0,o.M)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;c.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:(0,o.M)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})))}),L=(0,a.forwardRef)((e,t)=>{let r=x(D,e.__scopePopover),o=(0,a.useRef)(!1),l=(0,a.useRef)(!1);return(0,a.createElement)(A,(0,n.Z)({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var n,a;null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,t),t.defaultPrevented||(o.current||null===(a=r.triggerRef.current)||void 0===a||a.focus(),t.preventDefault()),o.current=!1,l.current=!1},onInteractOutside:t=>{var n,a;null===(n=e.onInteractOutside)||void 0===n||n.call(e,t),t.defaultPrevented||(o.current=!0,"pointerdown"!==t.detail.originalEvent.type||(l.current=!0));let i=t.target;(null===(a=r.triggerRef.current)||void 0===a?void 0:a.contains(i))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&l.current&&t.preventDefault()}}))}),A=(0,a.forwardRef)((e,t)=>{let{__scopePopover:r,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:i,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:v,onInteractOutside:h,...g}=e,C=x(D,r),E=N(r);return(0,c.EW)(),(0,a.createElement)(u.M,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:l,onUnmountAutoFocus:i},(0,a.createElement)(s.XB,{asChild:!0,disableOutsidePointerEvents:d,onInteractOutside:h,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:v,onDismiss:()=>C.onOpenChange(!1)},(0,a.createElement)(m.VY,(0,n.Z)({"data-state":O(C.open),role:"dialog",id:C.contentId},E,g,{ref:t,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}))))}),z=(0,a.forwardRef)((e,t)=>{let{__scopePopover:r,...l}=e,i=x("PopoverClose",r);return(0,a.createElement)(v.WV.button,(0,n.Z)({type:"button"},l,{ref:t,onClick:(0,o.M)(e.onClick,()=>i.onOpenChange(!1))}))});function O(e){return e?"open":"closed"}let Z=e=>{let{__scopePopover:t,children:r,open:n,defaultOpen:o,onOpenChange:l,modal:i=!1}=e,s=N(t),c=(0,a.useRef)(null),[u,f]=(0,a.useState)(!1),[p=!1,v]=(0,g.T)({prop:n,defaultProp:o,onChange:l});return(0,a.createElement)(m.fC,s,(0,a.createElement)(R,{scope:t,contentId:(0,d.M)(),triggerRef:c,open:p,onOpenChange:v,onOpenToggle:(0,a.useCallback)(()=>v(e=>!e),[v]),hasCustomAnchor:u,onCustomAnchorAdd:(0,a.useCallback)(()=>f(!0),[]),onCustomAnchorRemove:(0,a.useCallback)(()=>f(!1),[]),modal:i},r))},V=M,F=T,B=e=>{let{__scopePopover:t,forceMount:r,children:n,container:o}=e,l=x(_,t);return(0,a.createElement)(S,{scope:t,forceMount:r},(0,a.createElement)(p.z,{present:r||l.open},(0,a.createElement)(f.h,{asChild:!0,container:o},n)))},W=P,G=z},99497:function(e,t,r){"use strict";r.d(t,{ck:function(){return L},fC:function(){return I},oo:function(){return M}});var n=r(22988),a=r(2265),o=r(78149),l=r(1584),i=r(98324),s=r(25171),c=r(53398),u=r(91715),d=r(87513),m=r(75238),f=r(47250),p=r(31383);let v="Radio",[h,g]=(0,i.b)(v),[C,E]=h(v),y=(0,a.forwardRef)((e,t)=>{let{__scopeRadio:r,name:i,checked:c=!1,required:u,disabled:d,value:m="on",onCheck:f,...p}=e,[v,h]=(0,a.useState)(null),g=(0,l.e)(t,e=>h(e)),E=(0,a.useRef)(!1),y=!v||!!v.closest("form");return(0,a.createElement)(C,{scope:r,checked:c,disabled:d},(0,a.createElement)(s.WV.button,(0,n.Z)({type:"button",role:"radio","aria-checked":c,"data-state":b(c),"data-disabled":d?"":void 0,disabled:d,value:m},p,{ref:g,onClick:(0,o.M)(e.onClick,e=>{c||null==f||f(),y&&(E.current=e.isPropagationStopped(),E.current||e.stopPropagation())})})),y&&(0,a.createElement)(w,{control:v,bubbles:!E.current,name:i,value:m,checked:c,required:u,disabled:d,style:{transform:"translateX(-100%)"}}))}),w=((e,t)=>{let{__scopeRadio:r,forceMount:o,...l}=e,i=E("RadioIndicator",r);return(0,a.createElement)(p.z,{present:o||i.checked},(0,a.createElement)(s.WV.span,(0,n.Z)({"data-state":b(i.checked),"data-disabled":i.disabled?"":void 0},l,{ref:t})))},e=>{let{control:t,checked:r,bubbles:o=!0,...l}=e,i=(0,a.useRef)(null),s=(0,f.D)(r),c=(0,m.t)(t);return(0,a.useEffect)(()=>{let e=i.current,t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(s!==r&&t){let n=new Event("click",{bubbles:o});t.call(e,r),e.dispatchEvent(n)}},[s,r,o]),(0,a.createElement)("input",(0,n.Z)({type:"radio","aria-hidden":!0,defaultChecked:r},l,{tabIndex:-1,ref:i,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))});function b(e){return e?"checked":"unchecked"}let N=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],R="RadioGroup",[x,M]=(0,i.b)(R,[c.Pc,g]),T=(0,c.Pc)(),_=g(),[S,k]=x(R),D=(0,a.forwardRef)((e,t)=>{let{__scopeRadioGroup:r,name:o,defaultValue:l,value:i,required:m=!1,disabled:f=!1,orientation:p,dir:v,loop:h=!0,onValueChange:g,...C}=e,E=T(r),y=(0,d.gm)(v),[w,b]=(0,u.T)({prop:i,defaultProp:l,onChange:g});return(0,a.createElement)(S,{scope:r,name:o,required:m,disabled:f,value:w,onValueChange:b},(0,a.createElement)(c.fC,(0,n.Z)({asChild:!0},E,{orientation:p,dir:y,loop:h}),(0,a.createElement)(s.WV.div,(0,n.Z)({role:"radiogroup","aria-required":m,"aria-orientation":p,"data-disabled":f?"":void 0,dir:y},C,{ref:t}))))}),P=(0,a.forwardRef)((e,t)=>{let{__scopeRadioGroup:r,disabled:i,...s}=e,u=k("RadioGroupItem",r),d=u.disabled||i,m=T(r),f=_(r),p=(0,a.useRef)(null),v=(0,l.e)(t,p),h=u.value===s.value,g=(0,a.useRef)(!1);return(0,a.useEffect)(()=>{let e=e=>{N.includes(e.key)&&(g.current=!0)},t=()=>g.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),(0,a.createElement)(c.ck,(0,n.Z)({asChild:!0},m,{focusable:!d,active:h}),(0,a.createElement)(y,(0,n.Z)({disabled:d,required:u.required,checked:h},f,s,{name:u.name,ref:v,onCheck:()=>u.onValueChange(s.value),onKeyDown:(0,o.M)(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:(0,o.M)(s.onFocus,()=>{var e;g.current&&(null===(e=p.current)||void 0===e||e.click())})})))}),I=D,L=P},53398:function(e,t,r){"use strict";r.d(t,{Pc:function(){return w},ck:function(){return k},fC:function(){return S}});var n=r(22988),a=r(2265),o=r(78149),l=r(90976),i=r(1584),s=r(98324),c=r(53201),u=r(25171),d=r(75137),m=r(91715),f=r(87513);let p="rovingFocusGroup.onEntryFocus",v={bubbles:!1,cancelable:!0},h="RovingFocusGroup",[g,C,E]=(0,l.B)(h),[y,w]=(0,s.b)(h,[E]),[b,N]=y(h),R=(0,a.forwardRef)((e,t)=>(0,a.createElement)(g.Provider,{scope:e.__scopeRovingFocusGroup},(0,a.createElement)(g.Slot,{scope:e.__scopeRovingFocusGroup},(0,a.createElement)(x,(0,n.Z)({},e,{ref:t}))))),x=(0,a.forwardRef)((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:l,loop:s=!1,dir:c,currentTabStopId:h,defaultCurrentTabStopId:g,onCurrentTabStopIdChange:E,onEntryFocus:y,...w}=e,N=(0,a.useRef)(null),R=(0,i.e)(t,N),x=(0,f.gm)(c),[M=null,T]=(0,m.T)({prop:h,defaultProp:g,onChange:E}),[S,k]=(0,a.useState)(!1),D=(0,d.W)(y),P=C(r),I=(0,a.useRef)(!1),[L,A]=(0,a.useState)(0);return(0,a.useEffect)(()=>{let e=N.current;if(e)return e.addEventListener(p,D),()=>e.removeEventListener(p,D)},[D]),(0,a.createElement)(b,{scope:r,orientation:l,dir:x,loop:s,currentTabStopId:M,onItemFocus:(0,a.useCallback)(e=>T(e),[T]),onItemShiftTab:(0,a.useCallback)(()=>k(!0),[]),onFocusableItemAdd:(0,a.useCallback)(()=>A(e=>e+1),[]),onFocusableItemRemove:(0,a.useCallback)(()=>A(e=>e-1),[])},(0,a.createElement)(u.WV.div,(0,n.Z)({tabIndex:S||0===L?-1:0,"data-orientation":l},w,{ref:R,style:{outline:"none",...e.style},onMouseDown:(0,o.M)(e.onMouseDown,()=>{I.current=!0}),onFocus:(0,o.M)(e.onFocus,e=>{let t=!I.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(p,v);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=P().filter(e=>e.focusable);_([e.find(e=>e.active),e.find(e=>e.id===M),...e].filter(Boolean).map(e=>e.ref.current))}}I.current=!1}),onBlur:(0,o.M)(e.onBlur,()=>k(!1))})))}),M=(0,a.forwardRef)((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:l=!0,active:i=!1,tabStopId:s,...d}=e,m=(0,c.M)(),f=s||m,p=N("RovingFocusGroupItem",r),v=p.currentTabStopId===f,h=C(r),{onFocusableItemAdd:E,onFocusableItemRemove:y}=p;return(0,a.useEffect)(()=>{if(l)return E(),()=>y()},[l,E,y]),(0,a.createElement)(g.ItemSlot,{scope:r,id:f,focusable:l,active:i},(0,a.createElement)(u.WV.span,(0,n.Z)({tabIndex:v?0:-1,"data-orientation":p.orientation},d,{ref:t,onMouseDown:(0,o.M)(e.onMouseDown,e=>{l?p.onItemFocus(f):e.preventDefault()}),onFocus:(0,o.M)(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:(0,o.M)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey){p.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let a=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(a))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)))return T[a]}(e,p.orientation,p.dir);if(void 0!==t){e.preventDefault();let a=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)a.reverse();else if("prev"===t||"next"===t){var r,n;"prev"===t&&a.reverse();let o=a.indexOf(e.currentTarget);a=p.loop?(r=a,n=o+1,r.map((e,t)=>r[(n+t)%r.length])):a.slice(o+1)}setTimeout(()=>_(a))}})})))}),T={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function _(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}let S=R,k=M},80023:function(e,t,r){"use strict";r.d(t,{LW:function(){return X},Ns:function(){return q},bU:function(){return Y},fC:function(){return U},l_:function(){return j}});var n=r(22988),a=r(2265),o=r(25171),l=r(31383),i=r(98324),s=r(1584),c=r(75137),u=r(87513),d=r(1336),m=r(62361),f=r(78149);let p="ScrollArea",[v,h]=(0,i.b)(p),[g,C]=v(p),E=(0,a.forwardRef)((e,t)=>{let{__scopeScrollArea:r,type:l="hover",dir:i,scrollHideDelay:c=600,...d}=e,[m,f]=(0,a.useState)(null),[p,v]=(0,a.useState)(null),[h,C]=(0,a.useState)(null),[E,y]=(0,a.useState)(null),[w,b]=(0,a.useState)(null),[N,R]=(0,a.useState)(0),[x,M]=(0,a.useState)(0),[T,_]=(0,a.useState)(!1),[S,k]=(0,a.useState)(!1),D=(0,s.e)(t,e=>f(e)),P=(0,u.gm)(i);return(0,a.createElement)(g,{scope:r,type:l,dir:P,scrollHideDelay:c,scrollArea:m,viewport:p,onViewportChange:v,content:h,onContentChange:C,scrollbarX:E,onScrollbarXChange:y,scrollbarXEnabled:T,onScrollbarXEnabledChange:_,scrollbarY:w,onScrollbarYChange:b,scrollbarYEnabled:S,onScrollbarYEnabledChange:k,onCornerWidthChange:R,onCornerHeightChange:M},(0,a.createElement)(o.WV.div,(0,n.Z)({dir:P},d,{ref:D,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})))}),y=(0,a.forwardRef)((e,t)=>{let{__scopeScrollArea:r,children:l,...i}=e,c=C("ScrollAreaViewport",r),u=(0,a.useRef)(null),d=(0,s.e)(t,u,c.onViewportChange);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),(0,a.createElement)(o.WV.div,(0,n.Z)({"data-radix-scroll-area-viewport":""},i,{ref:d,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...e.style}}),(0,a.createElement)("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"}},l)))}),w="ScrollAreaScrollbar",b=(0,a.forwardRef)((e,t)=>{let{forceMount:r,...o}=e,l=C(w,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=l,c="horizontal"===e.orientation;return(0,a.useEffect)(()=>(c?i(!0):s(!0),()=>{c?i(!1):s(!1)}),[c,i,s]),"hover"===l.type?(0,a.createElement)(N,(0,n.Z)({},o,{ref:t,forceMount:r})):"scroll"===l.type?(0,a.createElement)(R,(0,n.Z)({},o,{ref:t,forceMount:r})):"auto"===l.type?(0,a.createElement)(x,(0,n.Z)({},o,{ref:t,forceMount:r})):"always"===l.type?(0,a.createElement)(M,(0,n.Z)({},o,{ref:t})):null}),N=(0,a.forwardRef)((e,t)=>{let{forceMount:r,...o}=e,i=C(w,e.__scopeScrollArea),[s,c]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=i.scrollArea,t=0;if(e){let r=()=>{window.clearTimeout(t),c(!0)},n=()=>{t=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),(0,a.createElement)(l.z,{present:r||s},(0,a.createElement)(x,(0,n.Z)({"data-state":s?"visible":"hidden"},o,{ref:t})))}),R=(0,a.forwardRef)((e,t)=>{var r,o;let{forceMount:i,...s}=e,c=C(w,e.__scopeScrollArea),u="horizontal"===e.orientation,d=H(()=>p("SCROLL_END"),100),[m,p]=(r="hidden",o={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},(0,a.useReducer)((e,t)=>{let r=o[e][t];return null!=r?r:e},r));return(0,a.useEffect)(()=>{if("idle"===m){let e=window.setTimeout(()=>p("HIDE"),c.scrollHideDelay);return()=>window.clearTimeout(e)}},[m,c.scrollHideDelay,p]),(0,a.useEffect)(()=>{let e=c.viewport,t=u?"scrollLeft":"scrollTop";if(e){let r=e[t],n=()=>{let n=e[t];r!==n&&(p("SCROLL"),d()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[c.viewport,u,p,d]),(0,a.createElement)(l.z,{present:i||"hidden"!==m},(0,a.createElement)(M,(0,n.Z)({"data-state":"hidden"===m?"hidden":"visible"},s,{ref:t,onPointerEnter:(0,f.M)(e.onPointerEnter,()=>p("POINTER_ENTER")),onPointerLeave:(0,f.M)(e.onPointerLeave,()=>p("POINTER_LEAVE"))})))}),x=(0,a.forwardRef)((e,t)=>{let r=C(w,e.__scopeScrollArea),{forceMount:o,...i}=e,[s,c]=(0,a.useState)(!1),u="horizontal"===e.orientation,d=H(()=>{if(r.viewport){let e=r.viewport.offsetWidth{let{orientation:r="vertical",...o}=e,l=C(w,e.__scopeScrollArea),i=(0,a.useRef)(null),s=(0,a.useRef)(0),[c,u]=(0,a.useState)({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=V(c.viewport,c.content),m={...o,sizes:c,onSizesChange:u,hasThumb:!!(d>0&&d<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:e=>s.current=e};function f(e,t){return function(e,t,r,n="ltr"){let a=F(r),o=t||a/2,l=r.scrollbar.paddingStart+o,i=r.scrollbar.size-r.scrollbar.paddingEnd-(a-o),s=r.content-r.viewport;return W([l,i],"ltr"===n?[0,s]:[-1*s,0])(e)}(e,s.current,c,t)}return"horizontal"===r?(0,a.createElement)(T,(0,n.Z)({},m,{ref:t,onThumbPositionChange:()=>{if(l.viewport&&i.current){let e=B(l.viewport.scrollLeft,c,l.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{l.viewport&&(l.viewport.scrollLeft=e)},onDragScroll:e=>{l.viewport&&(l.viewport.scrollLeft=f(e,l.dir))}})):"vertical"===r?(0,a.createElement)(_,(0,n.Z)({},m,{ref:t,onThumbPositionChange:()=>{if(l.viewport&&i.current){let e=B(l.viewport.scrollTop,c);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{l.viewport&&(l.viewport.scrollTop=e)},onDragScroll:e=>{l.viewport&&(l.viewport.scrollTop=f(e))}})):null}),T=(0,a.forwardRef)((e,t)=>{let{sizes:r,onSizesChange:o,...l}=e,i=C(w,e.__scopeScrollArea),[c,u]=(0,a.useState)(),d=(0,a.useRef)(null),m=(0,s.e)(t,d,i.onScrollbarXChange);return(0,a.useEffect)(()=>{d.current&&u(getComputedStyle(d.current))},[d]),(0,a.createElement)(D,(0,n.Z)({"data-orientation":"horizontal"},l,{ref:m,sizes:r,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":F(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(i.viewport){let n=i.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),n>0&&n{d.current&&i.viewport&&c&&o({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Z(c.paddingLeft),paddingEnd:Z(c.paddingRight)}})}}))}),_=(0,a.forwardRef)((e,t)=>{let{sizes:r,onSizesChange:o,...l}=e,i=C(w,e.__scopeScrollArea),[c,u]=(0,a.useState)(),d=(0,a.useRef)(null),m=(0,s.e)(t,d,i.onScrollbarYChange);return(0,a.useEffect)(()=>{d.current&&u(getComputedStyle(d.current))},[d]),(0,a.createElement)(D,(0,n.Z)({"data-orientation":"vertical"},l,{ref:m,sizes:r,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":F(r)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(i.viewport){let n=i.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),n>0&&n{d.current&&i.viewport&&c&&o({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Z(c.paddingTop),paddingEnd:Z(c.paddingBottom)}})}}))}),[S,k]=v(w),D=(0,a.forwardRef)((e,t)=>{let{__scopeScrollArea:r,sizes:l,hasThumb:i,onThumbChange:u,onThumbPointerUp:d,onThumbPointerDown:m,onThumbPositionChange:p,onDragScroll:v,onWheelScroll:h,onResize:g,...E}=e,y=C(w,r),[b,N]=(0,a.useState)(null),R=(0,s.e)(t,e=>N(e)),x=(0,a.useRef)(null),M=(0,a.useRef)(""),T=y.viewport,_=l.content-l.viewport,k=(0,c.W)(h),D=(0,c.W)(p),P=H(g,10);function I(e){x.current&&v({x:e.clientX-x.current.left,y:e.clientY-x.current.top})}return(0,a.useEffect)(()=>{let e=e=>{let t=e.target;(null==b?void 0:b.contains(t))&&k(e,_)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[T,b,_,k]),(0,a.useEffect)(D,[l,D]),K(b,P),K(y.content,P),(0,a.createElement)(S,{scope:r,scrollbar:b,hasThumb:i,onThumbChange:(0,c.W)(u),onThumbPointerUp:(0,c.W)(d),onThumbPositionChange:D,onThumbPointerDown:(0,c.W)(m)},(0,a.createElement)(o.WV.div,(0,n.Z)({},E,{ref:R,style:{position:"absolute",...E.style},onPointerDown:(0,f.M)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),x.current=b.getBoundingClientRect(),M.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),I(e))}),onPointerMove:(0,f.M)(e.onPointerMove,I),onPointerUp:(0,f.M)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=M.current,y.viewport&&(y.viewport.style.scrollBehavior=""),x.current=null})})))}),P="ScrollAreaThumb",I=(0,a.forwardRef)((e,t)=>{let{forceMount:r,...o}=e,i=k(P,e.__scopeScrollArea);return(0,a.createElement)(l.z,{present:r||i.hasThumb},(0,a.createElement)(L,(0,n.Z)({ref:t},o)))}),L=(0,a.forwardRef)((e,t)=>{let{__scopeScrollArea:r,style:l,...i}=e,c=C(P,r),u=k(P,r),{onThumbPositionChange:d}=u,m=(0,s.e)(t,e=>u.onThumbChange(e)),p=(0,a.useRef)(),v=H(()=>{p.current&&(p.current(),p.current=void 0)},100);return(0,a.useEffect)(()=>{let e=c.viewport;if(e){let t=()=>{if(v(),!p.current){let t=G(e,d);p.current=t,d()}};return d(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[c.viewport,v,d]),(0,a.createElement)(o.WV.div,(0,n.Z)({"data-state":u.hasThumb?"visible":"hidden"},i,{ref:m,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:(0,f.M)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;u.onThumbPointerDown({x:r,y:n})}),onPointerUp:(0,f.M)(e.onPointerUp,u.onThumbPointerUp)}))}),A="ScrollAreaCorner",z=(0,a.forwardRef)((e,t)=>{let r=C(A,e.__scopeScrollArea),o=!!(r.scrollbarX&&r.scrollbarY);return"scroll"!==r.type&&o?(0,a.createElement)(O,(0,n.Z)({},e,{ref:t})):null}),O=(0,a.forwardRef)((e,t)=>{let{__scopeScrollArea:r,...l}=e,i=C(A,r),[s,c]=(0,a.useState)(0),[u,d]=(0,a.useState)(0),m=!!(s&&u);return K(i.scrollbarX,()=>{var e;let t=(null===(e=i.scrollbarX)||void 0===e?void 0:e.offsetHeight)||0;i.onCornerHeightChange(t),d(t)}),K(i.scrollbarY,()=>{var e;let t=(null===(e=i.scrollbarY)||void 0===e?void 0:e.offsetWidth)||0;i.onCornerWidthChange(t),c(t)}),m?(0,a.createElement)(o.WV.div,(0,n.Z)({},l,{ref:t,style:{width:s,height:u,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}})):null});function Z(e){return e?parseInt(e,10):0}function V(e,t){let r=e/t;return isNaN(r)?0:r}function F(e){let t=V(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-r)*t,18)}function B(e,t,r="ltr"){let n=F(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,l=t.content-t.viewport,i=(0,m.u)(e,"ltr"===r?[0,l]:[-1*l,0]);return W([0,l],[0,o-n])(i)}function W(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}let G=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return!function a(){let o={left:e.scrollLeft,top:e.scrollTop},l=r.left!==o.left,i=r.top!==o.top;(l||i)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function H(e,t){let r=(0,c.W)(e),n=(0,a.useRef)(0);return(0,a.useEffect)(()=>()=>window.clearTimeout(n.current),[]),(0,a.useCallback)(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function K(e,t){let r=(0,c.W)(t);(0,d.b)(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}let U=E,j=y,X=b,Y=I,q=z},9646:function(e,t,r){"use strict";r.d(t,{bU:function(){return b},fC:function(){return w}});var n=r(22988),a=r(2265),o=r(78149),l=r(1584),i=r(98324),s=r(91715),c=r(47250),u=r(75238),d=r(25171);let m="Switch",[f,p]=(0,i.b)(m),[v,h]=f(m),g=(0,a.forwardRef)((e,t)=>{let{__scopeSwitch:r,name:i,checked:c,defaultChecked:u,required:m,disabled:f,value:p="on",onCheckedChange:h,...g}=e,[C,w]=(0,a.useState)(null),b=(0,l.e)(t,e=>w(e)),N=(0,a.useRef)(!1),R=!C||!!C.closest("form"),[x=!1,M]=(0,s.T)({prop:c,defaultProp:u,onChange:h});return(0,a.createElement)(v,{scope:r,checked:x,disabled:f},(0,a.createElement)(d.WV.button,(0,n.Z)({type:"button",role:"switch","aria-checked":x,"aria-required":m,"data-state":y(x),"data-disabled":f?"":void 0,disabled:f,value:p},g,{ref:b,onClick:(0,o.M)(e.onClick,e=>{M(e=>!e),R&&(N.current=e.isPropagationStopped(),N.current||e.stopPropagation())})})),R&&(0,a.createElement)(E,{control:C,bubbles:!N.current,name:i,value:p,checked:x,required:m,disabled:f,style:{transform:"translateX(-100%)"}}))}),C=(0,a.forwardRef)((e,t)=>{let{__scopeSwitch:r,...o}=e,l=h("SwitchThumb",r);return(0,a.createElement)(d.WV.span,(0,n.Z)({"data-state":y(l.checked),"data-disabled":l.disabled?"":void 0},o,{ref:t}))}),E=e=>{let{control:t,checked:r,bubbles:o=!0,...l}=e,i=(0,a.useRef)(null),s=(0,c.D)(r),d=(0,u.t)(t);return(0,a.useEffect)(()=>{let e=i.current,t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(s!==r&&t){let n=new Event("click",{bubbles:o});t.call(e,r),e.dispatchEvent(n)}},[s,r,o]),(0,a.createElement)("input",(0,n.Z)({type:"checkbox","aria-hidden":!0,defaultChecked:r},l,{tabIndex:-1,ref:i,style:{...e.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function y(e){return e?"checked":"unchecked"}let w=g,b=C},27071:function(e,t,r){"use strict";r.d(t,{Eh:function(){return G},VY:function(){return W},fC:function(){return V},h_:function(){return B},xz:function(){return F},zt:function(){return Z}});var n=r(22988),a=r(2265),o=r(78149),l=r(1584),i=r(98324),s=r(53938),c=r(53201),u=r(25510),d=r(56935),m=r(31383),f=r(25171),p=r(71538),v=r(91715),h=r(31725);let[g,C]=(0,i.b)("Tooltip",[u.D7]),E=(0,u.D7)(),y="tooltip.open",[w,b]=g("TooltipProvider"),N="Tooltip",[R,x]=g(N),M="TooltipTrigger",T=(0,a.forwardRef)((e,t)=>{let{__scopeTooltip:r,...i}=e,s=x(M,r),c=b(M,r),d=E(r),m=(0,a.useRef)(null),p=(0,l.e)(t,m,s.onTriggerChange),v=(0,a.useRef)(!1),h=(0,a.useRef)(!1),g=(0,a.useCallback)(()=>v.current=!1,[]);return(0,a.useEffect)(()=>()=>document.removeEventListener("pointerup",g),[g]),(0,a.createElement)(u.ee,(0,n.Z)({asChild:!0},d),(0,a.createElement)(f.WV.button,(0,n.Z)({"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute},i,{ref:p,onPointerMove:(0,o.M)(e.onPointerMove,e=>{"touch"===e.pointerType||h.current||c.isPointerInTransitRef.current||(s.onTriggerEnter(),h.current=!0)}),onPointerLeave:(0,o.M)(e.onPointerLeave,()=>{s.onTriggerLeave(),h.current=!1}),onPointerDown:(0,o.M)(e.onPointerDown,()=>{v.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:(0,o.M)(e.onFocus,()=>{v.current||s.onOpen()}),onBlur:(0,o.M)(e.onBlur,s.onClose),onClick:(0,o.M)(e.onClick,s.onClose)})))}),_="TooltipPortal",[S,k]=g(_,{forceMount:void 0}),D="TooltipContent",P=(0,a.forwardRef)((e,t)=>{let r=k(D,e.__scopeTooltip),{forceMount:o=r.forceMount,side:l="top",...i}=e,s=x(D,e.__scopeTooltip);return(0,a.createElement)(m.z,{present:o||s.open},s.disableHoverableContent?(0,a.createElement)(z,(0,n.Z)({side:l},i,{ref:t})):(0,a.createElement)(I,(0,n.Z)({side:l},i,{ref:t})))}),I=(0,a.forwardRef)((e,t)=>{let r=x(D,e.__scopeTooltip),o=b(D,e.__scopeTooltip),i=(0,a.useRef)(null),s=(0,l.e)(t,i),[c,u]=(0,a.useState)(null),{trigger:d,onClose:m}=r,f=i.current,{onPointerInTransitChange:p}=o,v=(0,a.useCallback)(()=>{u(null),p(!1)},[p]),h=(0,a.useCallback)((e,t)=>{let r=e.currentTarget,n={x:e.clientX,y:e.clientY},a=function(e,t){let r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,a,o)){case o:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw Error("unreachable")}}(n,r.getBoundingClientRect());u(function(e){let t=e.slice();return t.sort((e,t)=>e.xt.x?1:e.yt.y?1:0),function(e){if(e.length<=1)return e.slice();let t=[];for(let r=0;r=2;){let e=t[t.length-1],r=t[t.length-2];if((e.x-r.x)*(n.y-r.y)>=(e.y-r.y)*(n.x-r.x))t.pop();else break}t.push(n)}t.pop();let r=[];for(let t=e.length-1;t>=0;t--){let n=e[t];for(;r.length>=2;){let e=r[r.length-1],t=r[r.length-2];if((e.x-t.x)*(n.y-t.y)>=(e.y-t.y)*(n.x-t.x))r.pop();else break}r.push(n)}return(r.pop(),1===t.length&&1===r.length&&t[0].x===r[0].x&&t[0].y===r[0].y)?t:t.concat(r)}(t)}([...function(e,t,r=5){let n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r})}return n}(n,a),...function(e){let{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}(t.getBoundingClientRect())])),p(!0)},[p]);return(0,a.useEffect)(()=>()=>v(),[v]),(0,a.useEffect)(()=>{if(d&&f){let e=e=>h(e,f),t=e=>h(e,d);return d.addEventListener("pointerleave",e),f.addEventListener("pointerleave",t),()=>{d.removeEventListener("pointerleave",e),f.removeEventListener("pointerleave",t)}}},[d,f,h,v]),(0,a.useEffect)(()=>{if(c){let e=e=>{let t=e.target,r={x:e.clientX,y:e.clientY},n=(null==d?void 0:d.contains(t))||(null==f?void 0:f.contains(t)),a=!function(e,t){let{x:r,y:n}=e,a=!1;for(let e=0,o=t.length-1;en!=c>n&&r<(s-l)*(n-i)/(c-i)+l&&(a=!a)}return a}(r,c);n?v():a&&(v(),m())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[d,f,c,m,v]),(0,a.createElement)(z,(0,n.Z)({},e,{ref:s}))}),[L,A]=g(N,{isInside:!1}),z=(0,a.forwardRef)((e,t)=>{let{__scopeTooltip:r,children:o,"aria-label":l,onEscapeKeyDown:i,onPointerDownOutside:c,...d}=e,m=x(D,r),f=E(r),{onClose:v}=m;return(0,a.useEffect)(()=>(document.addEventListener(y,v),()=>document.removeEventListener(y,v)),[v]),(0,a.useEffect)(()=>{if(m.trigger){let e=e=>{let t=e.target;null!=t&&t.contains(m.trigger)&&v()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[m.trigger,v]),(0,a.createElement)(s.XB,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:v},(0,a.createElement)(u.VY,(0,n.Z)({"data-state":m.stateAttribute},f,d,{ref:t,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),(0,a.createElement)(p.A4,null,o),(0,a.createElement)(L,{scope:r,isInside:!0},(0,a.createElement)(h.f,{id:m.contentId,role:"tooltip"},l||o))))}),O=(0,a.forwardRef)((e,t)=>{let{__scopeTooltip:r,...o}=e,l=E(r);return A("TooltipArrow",r).isInside?null:(0,a.createElement)(u.Eh,(0,n.Z)({},l,o,{ref:t}))}),Z=e=>{let{__scopeTooltip:t,delayDuration:r=700,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:l}=e,[i,s]=(0,a.useState)(!0),c=(0,a.useRef)(!1),u=(0,a.useRef)(0);return(0,a.useEffect)(()=>{let e=u.current;return()=>window.clearTimeout(e)},[]),(0,a.createElement)(w,{scope:t,isOpenDelayed:i,delayDuration:r,onOpen:(0,a.useCallback)(()=>{window.clearTimeout(u.current),s(!1)},[]),onClose:(0,a.useCallback)(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>s(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:(0,a.useCallback)(e=>{c.current=e},[]),disableHoverableContent:o},l)},V=e=>{let{__scopeTooltip:t,children:r,open:n,defaultOpen:o=!1,onOpenChange:l,disableHoverableContent:i,delayDuration:s}=e,d=b(N,e.__scopeTooltip),m=E(t),[f,p]=(0,a.useState)(null),h=(0,c.M)(),g=(0,a.useRef)(0),C=null!=i?i:d.disableHoverableContent,w=null!=s?s:d.delayDuration,x=(0,a.useRef)(!1),[M=!1,T]=(0,v.T)({prop:n,defaultProp:o,onChange:e=>{e?(d.onOpen(),document.dispatchEvent(new CustomEvent(y))):d.onClose(),null==l||l(e)}}),_=(0,a.useMemo)(()=>M?x.current?"delayed-open":"instant-open":"closed",[M]),S=(0,a.useCallback)(()=>{window.clearTimeout(g.current),x.current=!1,T(!0)},[T]),k=(0,a.useCallback)(()=>{window.clearTimeout(g.current),T(!1)},[T]),D=(0,a.useCallback)(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{x.current=!0,T(!0)},w)},[w,T]);return(0,a.useEffect)(()=>()=>window.clearTimeout(g.current),[]),(0,a.createElement)(u.fC,m,(0,a.createElement)(R,{scope:t,contentId:h,open:M,stateAttribute:_,trigger:f,onTriggerChange:p,onTriggerEnter:(0,a.useCallback)(()=>{d.isOpenDelayed?D():S()},[d.isOpenDelayed,D,S]),onTriggerLeave:(0,a.useCallback)(()=>{C?k():window.clearTimeout(g.current)},[k,C]),onOpen:S,onClose:k,disableHoverableContent:C},r))},F=T,B=e=>{let{__scopeTooltip:t,forceMount:r,children:n,container:o}=e,l=x(_,t);return(0,a.createElement)(S,{scope:t,forceMount:r},(0,a.createElement)(m.z,{present:r||l.open},(0,a.createElement)(d.h,{asChild:!0,container:o},n)))},W=P,G=O},91048:function(e,t,r){"use strict";r.r(t),r.d(t,{AccessibleIcon:function(){return o}});var n=r(2265),a=r(31725);let o=({children:e,label:t})=>{let r=n.Children.only(e);return(0,n.createElement)(n.Fragment,null,(0,n.cloneElement)(r,{"aria-hidden":"true",focusable:"false"}),(0,n.createElement)(a.f,null,t))}},16502:function(e,t,r){"use strict";r.r(t),r.d(t,{Action:function(){return Z},Cancel:function(){return V},Content:function(){return A},Description:function(){return O},Root:function(){return I},Title:function(){return z},Trigger:function(){return L}});var n=r(2265),a=r(56800),o=r(22988),l=r(98324),i=r(1584),s=r(13304),c=r(78149),u=r(71538);let[d,m]=(0,l.b)("AlertDialog",[s.p8]),f=(0,s.p8)(),p=(0,n.forwardRef)((e,t)=>{let{__scopeAlertDialog:r,...a}=e,l=f(r);return(0,n.createElement)(s.xz,(0,o.Z)({},l,a,{ref:t}))}),v=(0,n.forwardRef)((e,t)=>{let{__scopeAlertDialog:r,...a}=e,l=f(r);return(0,n.createElement)(s.aV,(0,o.Z)({},l,a,{ref:t}))}),h="AlertDialogContent",[g,C]=d(h),E=(0,n.forwardRef)((e,t)=>{let{__scopeAlertDialog:r,children:a,...l}=e,d=f(r),m=(0,n.useRef)(null),p=(0,i.e)(t,m),v=(0,n.useRef)(null);return(0,n.createElement)(s.jm,{contentName:h,titleName:y,docsSlug:"alert-dialog"},(0,n.createElement)(g,{scope:r,cancelRef:v},(0,n.createElement)(s.VY,(0,o.Z)({role:"alertdialog"},d,l,{ref:p,onOpenAutoFocus:(0,c.M)(l.onOpenAutoFocus,e=>{var t;e.preventDefault(),null===(t=v.current)||void 0===t||t.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()}),(0,n.createElement)(u.A4,null,a),!1)))}),y="AlertDialogTitle",w=(0,n.forwardRef)((e,t)=>{let{__scopeAlertDialog:r,...a}=e,l=f(r);return(0,n.createElement)(s.Dx,(0,o.Z)({},l,a,{ref:t}))}),b=(0,n.forwardRef)((e,t)=>{let{__scopeAlertDialog:r,...a}=e,l=f(r);return(0,n.createElement)(s.dk,(0,o.Z)({},l,a,{ref:t}))}),N=(0,n.forwardRef)((e,t)=>{let{__scopeAlertDialog:r,...a}=e,l=f(r);return(0,n.createElement)(s.x8,(0,o.Z)({},l,a,{ref:t}))}),R=(0,n.forwardRef)((e,t)=>{let{__scopeAlertDialog:r,...a}=e,{cancelRef:l}=C("AlertDialogCancel",r),c=f(r),u=(0,i.e)(t,l);return(0,n.createElement)(s.x8,(0,o.Z)({},c,a,{ref:u}))}),x=e=>{let{__scopeAlertDialog:t,...r}=e,a=f(t);return(0,n.createElement)(s.fC,(0,o.Z)({},a,r,{modal:!0}))},M=e=>{let{__scopeAlertDialog:t,...r}=e,a=f(t);return(0,n.createElement)(s.h_,(0,o.Z)({},a,r))};var T=r(6963),_=r(68890),S=r(19078),k=r(29340),D=r(19594),P=r(9766);let I=e=>n.createElement(x,{...e});I.displayName="AlertDialog.Root";let L=n.forwardRef((e,t)=>{let{children:r,...a}=e;return n.createElement(p,{...a,ref:t,asChild:!0},(0,P.O)(r))});L.displayName="AlertDialog.Trigger";let A=n.forwardRef((e,t)=>{let{align:r,...o}=e,{align:l,...i}=T.x,{className:s}=(0,D.y)({align:r},{align:l}),{className:c,forceMount:u,container:d,...m}=(0,D.y)(o,i);return n.createElement(M,{container:d,forceMount:u},n.createElement(k.Theme,{asChild:!0},n.createElement(v,{className:"rt-BaseDialogOverlay rt-AlertDialogOverlay"},n.createElement("div",{className:"rt-BaseDialogScroll rt-AlertDialogScroll"},n.createElement("div",{className:"rt-BaseDialogScrollPadding rt-AlertDialogScrollPadding ".concat(s)},n.createElement(E,{...m,ref:t,className:a("rt-BaseDialogContent","rt-AlertDialogContent",c)}))))))});A.displayName="AlertDialog.Content";let z=n.forwardRef((e,t)=>n.createElement(w,{asChild:!0},n.createElement(_.X,{size:"5",mb:"3",trim:"start",...e,asChild:!1,ref:t})));z.displayName="AlertDialog.Title";let O=n.forwardRef((e,t)=>n.createElement(b,{asChild:!0},n.createElement(S.x,{as:"p",size:"3",...e,asChild:!1,ref:t})));O.displayName="AlertDialog.Description";let Z=n.forwardRef((e,t)=>{let{children:r,...a}=e;return n.createElement(N,{...a,ref:t,asChild:!0},(0,P.O)(r))});Z.displayName="AlertDialog.Action";let V=n.forwardRef((e,t)=>{let{children:r,...a}=e;return n.createElement(R,{...a,ref:t,asChild:!0},(0,P.O)(r))});V.displayName="AlertDialog.Cancel"},38507:function(e,t,r){"use strict";r.r(t),r.d(t,{Avatar:function(){return p}});var n=r(2265),a=r(56800),o=r(44458),l=r(38460),i=r(17534),s=r(75073),c=r(66176);let u={...l.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3","4","5","6","7","8","9"],default:"3",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["solid","soft"],default:"soft"},...i.o3,...s.K,...c.I,fallback:{type:"ReactNode",required:!0}};var d=r(19594),m=r(81271),f=r(66188);let p=n.forwardRef((e,t)=>{let{asChild:r,children:l,className:i,style:s,color:c,radius:p,...h}=(0,d.y)(e,u,f.E);return n.createElement(o.fC,{"data-accent-color":c,"data-radius":p,className:a("rt-reset","rt-AvatarRoot",i),style:s,asChild:r},(0,m.x)({asChild:r,children:l},n.createElement(v,{ref:t,...h})))});p.displayName="Avatar";let v=n.forwardRef((e,t)=>{let{fallback:r,...l}=e,[i,s]=n.useState("idle");return n.createElement(n.Fragment,null,"idle"===i||"loading"===i?n.createElement("span",{className:"rt-AvatarFallback"}):null,"error"===i?n.createElement(o.NY,{className:a("rt-AvatarFallback",{"rt-one-letter":"string"==typeof r&&1===r.length,"rt-two-letters":"string"==typeof r&&2===r.length}),delayMs:0},r):null,n.createElement(o.Ee,{ref:t,className:"rt-AvatarImage",...l,onLoadingStatusChange:e=>{var t;null===(t=l.onLoadingStatusChange)||void 0===t||t.call(l,e),s(e)}}))});v.displayName="AvatarImpl"},58022:function(e,t,r){"use strict";r.d(t,{C:function(){return i}});var n=r(38460),a=r(17534),o=r(75073),l=r(66176);let i={...n.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3","4"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["classic","solid","soft","surface","outline","ghost"],default:"solid"},...a.o3,...o.K,...l.I,loading:{type:"boolean",className:"rt-loading",default:!1}}},5233:function(e,t,r){"use strict";r.d(t,{m:function(){return o}});var n=r(17534),a=r(75073);let o={size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["classic","surface","soft"],default:"surface"},...n.EG,...a.K}},93518:function(e,t,r){"use strict";r.d(t,{JD:function(){return l},QN:function(){return c},km:function(){return s},nj:function(){return i}});var n=r(38460),a=r(17534),o=r(75073);let l={size:{type:"enum",className:"rt-r-size",values:["1","2"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["solid","soft"],default:"solid"},...a.EG,...o.K},i={...n.C,...a.EG,shortcut:{type:"string"}},s={...a.EG,shortcut:{type:"string"}},c={...a.EG}},13384:function(e,t,r){"use strict";r.d(t,{U:function(){return o}});var n=r(17534),a=r(75073);let o={size:{type:"enum",className:"rt-r-size",values:["1","2"],default:"2",responsive:!0},wrap:{type:"enum",className:"rt-r-fw",values:["nowrap","wrap","wrap-reverse"],responsive:!0},justify:{type:"enum",className:"rt-r-jc",values:["start","center","end"],responsive:!0},...n.EG,...a.K}},44581:function(e,t,r){"use strict";r.r(t),r.d(t,{Icon:function(){return f},Root:function(){return m},Text:function(){return p}});var n=r(2265),a=r(56800),o=r(71538),l=r(19078),i=r(31861),s=r(19594),c=r(6717),u=r(66188);let d=n.createContext({}),m=n.forwardRef((e,t)=>{let{size:r=i.n.size.default}=e,{asChild:l,children:c,className:m,color:f,...p}=(0,s.y)(e,i.n,u.E);return n.createElement(l?o.g7:"div",{"data-accent-color":f,...p,className:a("rt-CalloutRoot",m),ref:t},n.createElement(d.Provider,{value:n.useMemo(()=>({size:r}),[r])},c))});m.displayName="Callout.Root";let f=n.forwardRef((e,t)=>{let{className:r,...o}=e;return n.createElement("div",{...o,className:a("rt-CalloutIcon",r),ref:t})});f.displayName="Callout.Icon";let p=n.forwardRef((e,t)=>{let{className:r,...o}=e,{size:i}=n.useContext(d);return n.createElement(l.x,{as:"p",size:(0,c.qz)(i,c.uJ),...o,asChild:!1,ref:t,className:a("rt-CalloutText",r)})});p.displayName="Callout.Text"},31861:function(e,t,r){"use strict";r.d(t,{n:function(){return l}});var n=r(38460),a=r(17534),o=r(75073);let l={...n.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["soft","surface","outline"],default:"soft"},...a.o3,...o.K}},36756:function(e,t,r){"use strict";r.r(t),r.d(t,{Item:function(){return N},Root:function(){return b}});var n=r(2265),a=r(56800),o=r(98324),l=r(91740),i=r(38460),s=r(17534),c=r(75073),u=r(26624);let d={...i.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["surface","classic"],default:"surface"},...s.EG,...c.K,columns:{...u.L.columns,default:"repeat(auto-fit, minmax(200px, 1fr))"},gap:{...u.L.gap,default:"4"}};var m=r(5233),f=r(61395),p=r(52777),v=r(19594),h=r(66188);let g="CheckboxCards",[C]=(0,o.b)(g,[l.hm]),E=(0,l.hm)(),[y,w]=C(g),b=n.forwardRef((e,t)=>{let{__scopeCheckboxCards:r,className:o,color:i,...s}=(0,v.y)(e,d,h.E),c=E(r);return n.createElement(y,{scope:r,size:e.size,highContrast:e.highContrast},n.createElement(f.r,{asChild:!0},n.createElement(l.fC,{...c,"data-accent-color":i,...s,ref:t,className:a("rt-CheckboxCardsRoot",o)})))});b.displayName="CheckboxCards.Root";let N=n.forwardRef((e,t)=>{let{__scopeCheckboxCards:r,children:o,className:i,style:s,...c}=e,u=w("CheckboxCardsItem",r),d=E(r),{className:f}=(0,v.y)({size:null==u?void 0:u.size,variant:"surface",highContrast:null==u?void 0:u.highContrast},m.m);return n.createElement("label",{className:a("rt-BaseCard","rt-CheckboxCardsItem",i),style:s},o,n.createElement(l.ck,{...d,...c,ref:t,className:a("rt-reset","rt-BaseCheckboxRoot","rt-CheckboxCardCheckbox",f)},n.createElement(l.z$,{...d,asChild:!0,className:"rt-BaseCheckboxIndicator"},n.createElement(p.dc,null))))});N.displayName="CheckboxCards.Item"},76895:function(e,t,r){"use strict";r.r(t),r.d(t,{Item:function(){return y},Root:function(){return E}});var n=r(2265),a=r(56800),o=r(98324),l=r(91740),i=r(38460),s=r(5233);let c={...i.C,...s.m};var u=r(52777),d=r(19078),m=r(19594),f=r(66188);let p="CheckboxGroup",[v]=(0,o.b)(p,[l.hm]),h=(0,l.hm)(),[g,C]=v(p),E=n.forwardRef((e,t)=>{let{color:r=c.color.default,highContrast:o=c.highContrast.default,size:i=c.size.default,variant:s=c.variant.default,...u}=e,{__scopeCheckboxGroup:d,className:p,...v}=(0,m.y)(u,f.E),C=h(d);return n.createElement(g,{scope:d,color:r,size:i,highContrast:o,variant:s},n.createElement(l.fC,{...C,...v,ref:t,className:a("rt-CheckboxGroupRoot",p)}))});E.displayName="CheckboxGroup.Root";let y=n.forwardRef((e,t)=>{let{__scopeCheckboxGroup:r,children:o,className:l,style:i,...s}=e,{size:c}=C("CheckboxGroupItem",r);return o?n.createElement(d.x,{as:"label",size:c,className:a("rt-CheckboxGroupItem",l),style:i},n.createElement(w,{__scopeCheckboxGroup:r,...s,ref:t}),o&&n.createElement("span",{className:"rt-CheckboxGroupItemInner"},o)):n.createElement(w,{__scopeCheckboxGroup:r,...s,ref:t,className:l,style:i})});y.displayName="CheckboxGroup.Item";let w=n.forwardRef((e,t)=>{let{__scopeCheckboxGroup:r,...o}=e,i=C("CheckboxGroupItemCheckbox",r),s=h(r),{color:d,className:p}=(0,m.y)({...o,...i},c,f.E);return n.createElement(l.ck,{...s,"data-accent-color":d,...o,ref:t,className:a("rt-reset","rt-BaseCheckboxRoot","rt-CheckboxGroupItemCheckbox",p)},n.createElement(l.z$,{...s,asChild:!0,className:"rt-BaseCheckboxIndicator"},n.createElement(u.dc,null)))});w.displayName="CheckboxGroup.ItemCheckbox"},91740:function(e,t,r){"use strict";r.d(t,{ck:function(){return N},fC:function(){return b},hm:function(){return f},z$:function(){return R}});var n=r(2265),a=r(69324),o=r(1584),l=r(98324),i=r(25171),s=r(53398),c=r(91715),u=r(87513);let d="CheckboxGroup",[m,f]=(0,l.b)(d,[s.Pc,a.Ed]),p=(0,s.Pc)(),v=(0,a.Ed)(),[h,g]=m(d),C=n.forwardRef((e,t)=>{let{__scopeCheckboxGroup:r,name:a,defaultValue:o,value:l,required:d=!1,disabled:m=!1,orientation:f,dir:v,loop:g=!0,onValueChange:C,...E}=e,y=p(r),w=(0,u.gm)(v),[b=[],N]=(0,c.T)({prop:l,defaultProp:o,onChange:C}),R=n.useCallback(e=>N((t=[])=>[...t,e]),[N]),x=n.useCallback(e=>N((t=[])=>t.filter(t=>t!==e)),[N]);return n.createElement(h,{scope:r,name:a,required:d,disabled:m,value:b,onItemCheck:R,onItemUncheck:x},n.createElement(s.fC,{asChild:!0,...y,orientation:f,dir:w,loop:g},n.createElement(i.WV.div,{role:"group","data-disabled":m?"":void 0,dir:w,...E,ref:t})))});C.displayName=d;let E="CheckboxGroupItem",y=n.forwardRef((e,t)=>{let{__scopeCheckboxGroup:r,disabled:l,...i}=e,c=g(E,r),u=c.disabled||l,d=p(r),m=v(r),f=n.useRef(null),h=(0,o.e)(t,f),C=c.value?.includes(i.value);return n.createElement(s.ck,{asChild:!0,...d,focusable:!u,active:C},n.createElement(a.fC,{name:c.name,disabled:u,required:c.required,checked:C,...m,...i,ref:h,onCheckedChange:t=>{t?c.onItemCheck(e.value):c.onItemUncheck(e.value)}}))});y.displayName=E;let w=n.forwardRef((e,t)=>{let{__scopeCheckboxGroup:r,...o}=e,l=v(r);return n.createElement(a.z$,{...l,...o,ref:t})});w.displayName="CheckboxGroupIndicator";let b=C,N=y,R=w},2738:function(e,t,r){"use strict";r.r(t),r.d(t,{Checkbox:function(){return u}});var n=r(2265),a=r(56800),o=r(69324),l=r(5233),i=r(52777),s=r(19594),c=r(66188);let u=n.forwardRef((e,t)=>{let{className:r,color:u,...d}=(0,s.y)(e,l.m,c.E);return n.createElement(o.fC,{"data-accent-color":u,...d,asChild:!1,ref:t,className:a("rt-reset","rt-BaseCheckboxRoot","rt-CheckboxRoot",r)},n.createElement(o.z$,{asChild:!0,className:"rt-BaseCheckboxIndicator rt-CheckboxIndicator"},n.createElement(i.dc,null)))});u.displayName="Checkbox"},23195:function(e,t,r){"use strict";r.r(t),r.d(t,{CheckboxItem:function(){return q},Content:function(){return H},Group:function(){return j},Item:function(){return U},Label:function(){return K},RadioGroup:function(){return X},RadioItem:function(){return Y},Root:function(){return B},Separator:function(){return ee},Sub:function(){return $},SubContent:function(){return Q},SubTrigger:function(){return J},Trigger:function(){return W}});var n=r(2265),a=r(56800),o=r(22988),l=r(78149),i=r(98324),s=r(25171),c=r(6461),u=r(75137),d=r(91715);let m="ContextMenu",[f,p]=(0,i.b)(m,[c.Wf]),v=(0,c.Wf)(),[h,g]=f(m),C=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,disabled:a=!1,...i}=e,u=g("ContextMenuTrigger",r),d=v(r),m=(0,n.useRef)({x:0,y:0}),f=(0,n.useRef)({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...m.current})}),p=(0,n.useRef)(0),h=(0,n.useCallback)(()=>window.clearTimeout(p.current),[]),C=e=>{m.current={x:e.clientX,y:e.clientY},u.onOpenChange(!0)};return(0,n.useEffect)(()=>h,[h]),(0,n.useEffect)(()=>void(a&&h()),[a,h]),(0,n.createElement)(n.Fragment,null,(0,n.createElement)(c.ee,(0,o.Z)({},d,{virtualRef:f})),(0,n.createElement)(s.WV.span,(0,o.Z)({"data-state":u.open?"open":"closed","data-disabled":a?"":void 0},i,{ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:a?e.onContextMenu:(0,l.M)(e.onContextMenu,e=>{h(),C(e),e.preventDefault()}),onPointerDown:a?e.onPointerDown:(0,l.M)(e.onPointerDown,k(e=>{h(),p.current=window.setTimeout(()=>C(e),700)})),onPointerMove:a?e.onPointerMove:(0,l.M)(e.onPointerMove,k(h)),onPointerCancel:a?e.onPointerCancel:(0,l.M)(e.onPointerCancel,k(h)),onPointerUp:a?e.onPointerUp:(0,l.M)(e.onPointerUp,k(h))})))}),E=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,...a}=e,l=g("ContextMenuContent",r),i=v(r),s=(0,n.useRef)(!1);return(0,n.createElement)(c.VY,(0,o.Z)({},i,a,{ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:t=>{var r;null===(r=e.onCloseAutoFocus)||void 0===r||r.call(e,t),!t.defaultPrevented&&s.current&&t.preventDefault(),s.current=!1},onInteractOutside:t=>{var r;null===(r=e.onInteractOutside)||void 0===r||r.call(e,t),t.defaultPrevented||l.modal||(s.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),y=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,...a}=e,l=v(r);return(0,n.createElement)(c.ZA,(0,o.Z)({},l,a,{ref:t}))}),w=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,...a}=e,l=v(r);return(0,n.createElement)(c.__,(0,o.Z)({},l,a,{ref:t}))}),b=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,...a}=e,l=v(r);return(0,n.createElement)(c.ck,(0,o.Z)({},l,a,{ref:t}))}),N=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,...a}=e,l=v(r);return(0,n.createElement)(c.oC,(0,o.Z)({},l,a,{ref:t}))}),R=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,...a}=e,l=v(r);return(0,n.createElement)(c.Ee,(0,o.Z)({},l,a,{ref:t}))}),x=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,...a}=e,l=v(r);return(0,n.createElement)(c.Rk,(0,o.Z)({},l,a,{ref:t}))}),M=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,...a}=e,l=v(r);return(0,n.createElement)(c.wU,(0,o.Z)({},l,a,{ref:t}))}),T=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,...a}=e,l=v(r);return(0,n.createElement)(c.Z0,(0,o.Z)({},l,a,{ref:t}))}),_=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,...a}=e,l=v(r);return(0,n.createElement)(c.fF,(0,o.Z)({},l,a,{ref:t}))}),S=(0,n.forwardRef)((e,t)=>{let{__scopeContextMenu:r,...a}=e,l=v(r);return(0,n.createElement)(c.tu,(0,o.Z)({},l,a,{ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))});function k(e){return t=>"mouse"!==t.pointerType?e(t):void 0}let D=e=>{let{__scopeContextMenu:t,children:r,onOpenChange:a,dir:l,modal:i=!0}=e,[s,d]=(0,n.useState)(!1),m=v(t),f=(0,u.W)(a),p=(0,n.useCallback)(e=>{d(e),f(e)},[f]);return(0,n.createElement)(h,{scope:t,open:s,onOpenChange:p,modal:i},(0,n.createElement)(c.fC,(0,o.Z)({},m,{dir:l,open:s,onOpenChange:p,modal:i}),r))},P=e=>{let{__scopeContextMenu:t,...r}=e,a=v(t);return(0,n.createElement)(c.h_,(0,o.Z)({},a,r))},I=e=>{let{__scopeContextMenu:t,children:r,onOpenChange:a,open:l,defaultOpen:i}=e,s=v(t),[u,m]=(0,d.T)({prop:l,defaultProp:i,onChange:a});return(0,n.createElement)(c.Tr,(0,o.Z)({},s,{open:u,onOpenChange:m}),r)};var L=r(71538),A=r(19829),z=r(93518),O=r(29340),Z=r(52777),V=r(19594),F=r(9766);let B=e=>n.createElement(D,{...e});B.displayName="ContextMenu.Root";let W=n.forwardRef((e,t)=>{let{children:r,...a}=e;return n.createElement(C,{...a,ref:t,asChild:!0},(0,F.O)(r))});W.displayName="ContextMenu.Trigger";let G=n.createContext({}),H=n.forwardRef((e,t)=>{let r=(0,O.useThemeContext)(),{size:o=z.JD.size.default,variant:l=z.JD.variant.default,highContrast:i=z.JD.highContrast.default}=e,{className:s,children:c,color:u,container:d,forceMount:m,...f}=(0,V.y)(e,z.JD),p=u||r.accentColor;return n.createElement(P,{container:d,forceMount:m},n.createElement(O.Theme,{asChild:!0},n.createElement(E,{"data-accent-color":p,alignOffset:-(4*Number(o)),collisionPadding:10,...f,asChild:!1,ref:t,className:a("rt-PopperContent","rt-BaseMenuContent","rt-ContextMenuContent",s)},n.createElement(A.ScrollArea,{type:"auto"},n.createElement("div",{className:a("rt-BaseMenuViewport","rt-ContextMenuViewport")},n.createElement(G.Provider,{value:n.useMemo(()=>({size:o,variant:l,color:p,highContrast:i}),[o,l,p,i])},c))))))});H.displayName="ContextMenu.Content";let K=n.forwardRef((e,t)=>{let{className:r,...o}=e;return n.createElement(w,{...o,asChild:!1,ref:t,className:a("rt-BaseMenuLabel","rt-ContextMenuLabel",r)})});K.displayName="ContextMenu.Label";let U=n.forwardRef((e,t)=>{let{className:r,children:o,color:l=z.nj.color.default,shortcut:i,...s}=e;return n.createElement(b,{"data-accent-color":l,...s,ref:t,className:a("rt-reset","rt-BaseMenuItem","rt-ContextMenuItem",r)},n.createElement(L.A4,null,o),i&&n.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},i))});U.displayName="ContextMenu.Item";let j=n.forwardRef((e,t)=>{let{className:r,...o}=e;return n.createElement(y,{...o,asChild:!1,ref:t,className:a("rt-BaseMenuGroup","rt-ContextMenuGroup",r)})});j.displayName="ContextMenu.Group";let X=n.forwardRef((e,t)=>{let{className:r,...o}=e;return n.createElement(R,{...o,asChild:!1,ref:t,className:a("rt-BaseMenuRadioGroup","rt-ContextMenuRadioGroup",r)})});X.displayName="ContextMenu.RadioGroup";let Y=n.forwardRef((e,t)=>{let{children:r,className:o,color:l=z.QN.color.default,...i}=e;return n.createElement(x,{...i,asChild:!1,ref:t,"data-accent-color":l,className:a("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-ContextMenuItem","rt-ContextMenuRadioItem",o)},n.createElement(L.A4,null,r),n.createElement(M,{className:"rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator"},n.createElement(Z.dc,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})))});Y.displayName="ContextMenu.RadioItem";let q=n.forwardRef((e,t)=>{let{children:r,className:o,shortcut:l,color:i=z.km.color.default,...s}=e;return n.createElement(N,{...s,asChild:!1,ref:t,"data-accent-color":i,className:a("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-ContextMenuItem","rt-ContextMenuCheckboxItem",o)},n.createElement(L.A4,null,r),n.createElement(M,{className:"rt-BaseMenuItemIndicator rt-ContextMenuItemIndicator"},n.createElement(Z.dc,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),l&&n.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},l))});q.displayName="ContextMenu.CheckboxItem";let $=e=>n.createElement(I,{...e});$.displayName="ContextMenu.Sub";let J=n.forwardRef((e,t)=>{let{className:r,children:o,...l}=e;return n.createElement(_,{...l,asChild:!1,ref:t,className:a("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-ContextMenuItem","rt-ContextMenuSubTrigger",r)},o,n.createElement("div",{className:"rt-BaseMenuShortcut rt-ContextMenuShortcut"},n.createElement(Z.OW,{className:"rt-BaseMenuSubTriggerIcon rt-ContextMenuSubTriggerIcon"})))});J.displayName="ContextMenu.SubTrigger";let Q=n.forwardRef((e,t)=>{let{size:r,variant:o,color:l,highContrast:i}=n.useContext(G),{className:s,children:c,container:u,forceMount:d,...m}=(0,V.y)({size:r,variant:o,color:l,highContrast:i,...e},z.JD);return n.createElement(P,{container:u,forceMount:d},n.createElement(O.Theme,{asChild:!0},n.createElement(S,{"data-accent-color":l,alignOffset:-(4*Number(r)),sideOffset:1,collisionPadding:10,...m,asChild:!1,ref:t,className:a("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-ContextMenuContent","rt-ContextMenuSubContent",s)},n.createElement(A.ScrollArea,{type:"auto"},n.createElement("div",{className:a("rt-BaseMenuViewport","rt-ContextMenuViewport")},c)))))});Q.displayName="ContextMenu.SubContent";let ee=n.forwardRef((e,t)=>{let{className:r,...o}=e;return n.createElement(T,{...o,asChild:!1,ref:t,className:a("rt-BaseMenuSeparator","rt-ContextMenuSeparator",r)})});ee.displayName="ContextMenu.Separator"},17584:function(e,t,r){"use strict";r.r(t),r.d(t,{Close:function(){return g},Content:function(){return p},Description:function(){return h},Root:function(){return m},Title:function(){return v},Trigger:function(){return f}});var n=r(2265),a=r(56800),o=r(13304),l=r(6963),i=r(68890),s=r(19078),c=r(29340),u=r(19594),d=r(9766);let m=e=>n.createElement(o.fC,{...e,modal:!0});m.displayName="Dialog.Root";let f=n.forwardRef((e,t)=>{let{children:r,...a}=e;return n.createElement(o.xz,{...a,ref:t,asChild:!0},(0,d.O)(r))});f.displayName="Dialog.Trigger";let p=n.forwardRef((e,t)=>{let{align:r,...i}=e,{align:s,...d}=l.x,{className:m}=(0,u.y)({align:r},{align:s}),{className:f,forceMount:p,container:v,...h}=(0,u.y)(i,d);return n.createElement(o.h_,{container:v,forceMount:p},n.createElement(c.Theme,{asChild:!0},n.createElement(o.aV,{className:"rt-BaseDialogOverlay rt-DialogOverlay"},n.createElement("div",{className:"rt-BaseDialogScroll rt-DialogScroll"},n.createElement("div",{className:"rt-BaseDialogScrollPadding rt-DialogScrollPadding ".concat(m)},n.createElement(o.VY,{...h,ref:t,className:a("rt-BaseDialogContent","rt-DialogContent",f)}))))))});p.displayName="Dialog.Content";let v=n.forwardRef((e,t)=>n.createElement(o.Dx,{asChild:!0},n.createElement(i.X,{size:"5",mb:"3",trim:"start",...e,asChild:!1,ref:t})));v.displayName="Dialog.Title";let h=n.forwardRef((e,t)=>n.createElement(o.dk,{asChild:!0},n.createElement(s.x,{as:"p",size:"3",...e,asChild:!1,ref:t})));h.displayName="Dialog.Description";let g=n.forwardRef((e,t)=>{let{children:r,...a}=e;return n.createElement(o.x8,{...a,ref:t,asChild:!0},(0,d.O)(r))});g.displayName="Dialog.Close"},6963:function(e,t,r){"use strict";r.d(t,{x:function(){return l}});var n=r(38460),a=r(74577),o=r(64791);let l={...n.C,align:{type:"enum",className:"rt-r-align",values:["start","center"],default:"center"},size:{type:"enum",className:"rt-r-size",values:["1","2","3","4"],default:"3",responsive:!0},width:a.n.width,minWidth:a.n.minWidth,maxWidth:{...a.n.maxWidth,default:"600px"},...o.F}},62187:function(e,t,r){"use strict";r.r(t),r.d(t,{CheckboxItem:function(){return q},Content:function(){return H},Group:function(){return j},Item:function(){return U},Label:function(){return K},RadioGroup:function(){return X},RadioItem:function(){return Y},Root:function(){return B},Separator:function(){return ee},Sub:function(){return $},SubContent:function(){return Q},SubTrigger:function(){return J},Trigger:function(){return W},TriggerIcon:function(){return Z.v4}});var n=r(2265),a=r(56800),o=r(22988),l=r(78149),i=r(1584),s=r(98324),c=r(91715),u=r(25171),d=r(6461),m=r(53201);let f="DropdownMenu",[p,v]=(0,s.b)(f,[d.Wf]),h=(0,d.Wf)(),[g,C]=p(f),E=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,disabled:a=!1,...s}=e,c=C("DropdownMenuTrigger",r),m=h(r);return(0,n.createElement)(d.ee,(0,o.Z)({asChild:!0},m),(0,n.createElement)(u.WV.button,(0,o.Z)({type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":a?"":void 0,disabled:a},s,{ref:(0,i.F)(t,c.triggerRef),onPointerDown:(0,l.M)(e.onPointerDown,e=>{a||0!==e.button||!1!==e.ctrlKey||(c.onOpenToggle(),c.open||e.preventDefault())}),onKeyDown:(0,l.M)(e.onKeyDown,e=>{!a&&(["Enter"," "].includes(e.key)&&c.onOpenToggle(),"ArrowDown"===e.key&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})))}),y=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,...a}=e,i=C("DropdownMenuContent",r),s=h(r),c=(0,n.useRef)(!1);return(0,n.createElement)(d.VY,(0,o.Z)({id:i.contentId,"aria-labelledby":i.triggerId},s,a,{ref:t,onCloseAutoFocus:(0,l.M)(e.onCloseAutoFocus,e=>{var t;c.current||null===(t=i.triggerRef.current)||void 0===t||t.focus(),c.current=!1,e.preventDefault()}),onInteractOutside:(0,l.M)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!i.modal||n)&&(c.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),w=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,...a}=e,l=h(r);return(0,n.createElement)(d.ZA,(0,o.Z)({},l,a,{ref:t}))}),b=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,...a}=e,l=h(r);return(0,n.createElement)(d.__,(0,o.Z)({},l,a,{ref:t}))}),N=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,...a}=e,l=h(r);return(0,n.createElement)(d.ck,(0,o.Z)({},l,a,{ref:t}))}),R=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,...a}=e,l=h(r);return(0,n.createElement)(d.oC,(0,o.Z)({},l,a,{ref:t}))}),x=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,...a}=e,l=h(r);return(0,n.createElement)(d.Ee,(0,o.Z)({},l,a,{ref:t}))}),M=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,...a}=e,l=h(r);return(0,n.createElement)(d.Rk,(0,o.Z)({},l,a,{ref:t}))}),T=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,...a}=e,l=h(r);return(0,n.createElement)(d.wU,(0,o.Z)({},l,a,{ref:t}))}),_=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,...a}=e,l=h(r);return(0,n.createElement)(d.Z0,(0,o.Z)({},l,a,{ref:t}))}),S=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,...a}=e,l=h(r);return(0,n.createElement)(d.fF,(0,o.Z)({},l,a,{ref:t}))}),k=(0,n.forwardRef)((e,t)=>{let{__scopeDropdownMenu:r,...a}=e,l=h(r);return(0,n.createElement)(d.tu,(0,o.Z)({},l,a,{ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),D=e=>{let{__scopeDropdownMenu:t,children:r,dir:a,open:l,defaultOpen:i,onOpenChange:s,modal:u=!0}=e,f=h(t),p=(0,n.useRef)(null),[v=!1,C]=(0,c.T)({prop:l,defaultProp:i,onChange:s});return(0,n.createElement)(g,{scope:t,triggerId:(0,m.M)(),triggerRef:p,contentId:(0,m.M)(),open:v,onOpenChange:C,onOpenToggle:(0,n.useCallback)(()=>C(e=>!e),[C]),modal:u},(0,n.createElement)(d.fC,(0,o.Z)({},f,{open:v,onOpenChange:C,dir:a,modal:u}),r))},P=e=>{let{__scopeDropdownMenu:t,...r}=e,a=h(t);return(0,n.createElement)(d.h_,(0,o.Z)({},a,r))},I=e=>{let{__scopeDropdownMenu:t,children:r,open:a,onOpenChange:l,defaultOpen:i}=e,s=h(t),[u=!1,m]=(0,c.T)({prop:a,defaultProp:i,onChange:l});return(0,n.createElement)(d.Tr,(0,o.Z)({},s,{open:u,onOpenChange:m}),r)};var L=r(71538),A=r(19829),z=r(93518),O=r(29340),Z=r(52777),V=r(19594),F=r(9766);let B=e=>n.createElement(D,{...e});B.displayName="DropdownMenu.Root";let W=n.forwardRef((e,t)=>{let{children:r,...a}=e;return n.createElement(E,{...a,ref:t,asChild:!0},(0,F.O)(r))});W.displayName="DropdownMenu.Trigger";let G=n.createContext({}),H=n.forwardRef((e,t)=>{let r=(0,O.useThemeContext)(),{size:o=z.JD.size.default,variant:l=z.JD.variant.default,highContrast:i=z.JD.highContrast.default}=e,{className:s,children:c,color:u,container:d,forceMount:m,...f}=(0,V.y)(e,z.JD),p=u||r.accentColor;return n.createElement(P,{container:d,forceMount:m},n.createElement(O.Theme,{asChild:!0},n.createElement(y,{"data-accent-color":p,align:"start",sideOffset:4,collisionPadding:10,...f,asChild:!1,ref:t,className:a("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",s)},n.createElement(A.ScrollArea,{type:"auto"},n.createElement("div",{className:a("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n.createElement(G.Provider,{value:n.useMemo(()=>({size:o,variant:l,color:p,highContrast:i}),[o,l,p,i])},c))))))});H.displayName="DropdownMenu.Content";let K=n.forwardRef((e,t)=>{let{className:r,...o}=e;return n.createElement(b,{...o,asChild:!1,ref:t,className:a("rt-BaseMenuLabel","rt-DropdownMenuLabel",r)})});K.displayName="DropdownMenu.Label";let U=n.forwardRef((e,t)=>{let{className:r,children:o,color:l=z.nj.color.default,shortcut:i,...s}=e;return n.createElement(N,{"data-accent-color":l,...s,ref:t,className:a("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},n.createElement(L.A4,null,o),i&&n.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});U.displayName="DropdownMenu.Item";let j=n.forwardRef((e,t)=>{let{className:r,...o}=e;return n.createElement(w,{...o,asChild:!1,ref:t,className:a("rt-BaseMenuGroup","rt-DropdownMenuGroup",r)})});j.displayName="DropdownMenu.Group";let X=n.forwardRef((e,t)=>{let{className:r,...o}=e;return n.createElement(x,{...o,asChild:!1,ref:t,className:a("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",r)})});X.displayName="DropdownMenu.RadioGroup";let Y=n.forwardRef((e,t)=>{let{children:r,className:o,color:l=z.QN.color.default,...i}=e;return n.createElement(M,{...i,asChild:!1,ref:t,"data-accent-color":l,className:a("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",o)},r,n.createElement(T,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},n.createElement(Z.dc,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});Y.displayName="DropdownMenu.RadioItem";let q=n.forwardRef((e,t)=>{let{children:r,className:o,shortcut:l,color:i=z.km.color.default,...s}=e;return n.createElement(R,{...s,asChild:!1,ref:t,"data-accent-color":i,className:a("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",o)},r,n.createElement(T,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},n.createElement(Z.dc,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),l&&n.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},l))});q.displayName="DropdownMenu.CheckboxItem";let $=e=>n.createElement(I,{...e});$.displayName="DropdownMenu.Sub";let J=n.forwardRef((e,t)=>{let{className:r,children:o,...l}=e;return n.createElement(S,{...l,asChild:!1,ref:t,className:a("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},o,n.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},n.createElement(Z.OW,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});J.displayName="DropdownMenu.SubTrigger";let Q=n.forwardRef((e,t)=>{let{size:r,variant:o,color:l,highContrast:i}=n.useContext(G),{className:s,children:c,container:u,forceMount:d,...m}=(0,V.y)({size:r,variant:o,color:l,highContrast:i,...e},z.JD);return n.createElement(P,{container:u,forceMount:d},n.createElement(O.Theme,{asChild:!0},n.createElement(k,{"data-accent-color":l,alignOffset:-(4*Number(r)),sideOffset:1,collisionPadding:10,...m,asChild:!1,ref:t,className:a("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",s)},n.createElement(A.ScrollArea,{type:"auto"},n.createElement("div",{className:a("rt-BaseMenuViewport","rt-DropdownMenuViewport")},c)))))});Q.displayName="DropdownMenu.SubContent";let ee=n.forwardRef((e,t)=>{let{className:r,...o}=e;return n.createElement(_,{...o,asChild:!1,ref:t,className:a("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",r)})});ee.displayName="DropdownMenu.Separator"},20611:function(e,t,r){"use strict";r.d(t,{l:function(){return o}});var n=r(38460),a=r(75232);let o={as:{type:"enum",values:["div","span"],default:"div"},...n.C,display:{type:"enum",className:"rt-r-display",values:["none","inline-flex","flex"],responsive:!0},direction:{type:"enum",className:"rt-r-fd",values:["row","column","row-reverse","column-reverse"],responsive:!0},align:{type:"enum",className:"rt-r-ai",values:["start","center","end","baseline","stretch"],responsive:!0},justify:{type:"enum",className:"rt-r-jc",values:["start","center","end","between"],parseValue:function(e){return"between"===e?"space-between":e},responsive:!0},wrap:{type:"enum",className:"rt-r-fw",values:["nowrap","wrap","wrap-reverse"],responsive:!0},...a.c}},61395:function(e,t,r){"use strict";r.d(t,{r:function(){return u}});var n=r(2265),a=r(56800),o=r(71538),l=r(26624),i=r(19594),s=r(85706),c=r(66188);let u=n.forwardRef((e,t)=>{let{className:r,asChild:u,as:d="div",...m}=(0,i.y)(e,l.L,s.P,c.E);return n.createElement(u?o.g7:d,{...m,ref:t,className:a("rt-Grid",r)})});u.displayName="Grid"},26624:function(e,t,r){"use strict";r.d(t,{L:function(){return o}});var n=r(38460),a=r(75232);let o={as:{type:"enum",values:["div","span"],default:"div"},...n.C,display:{type:"enum",className:"rt-r-display",values:["none","inline-grid","grid"],responsive:!0},columns:{type:"enum | string",className:"rt-r-gtc",customProperties:["--grid-template-columns"],values:["1","2","3","4","5","6","7","8","9"],parseValue:l,responsive:!0},rows:{type:"enum | string",className:"rt-r-gtr",customProperties:["--grid-template-rows"],values:["1","2","3","4","5","6","7","8","9"],parseValue:l,responsive:!0},flow:{type:"enum",className:"rt-r-gaf",values:["row","column","dense","row-dense","column-dense"],responsive:!0},align:{type:"enum",className:"rt-r-ai",values:["start","center","end","baseline","stretch"],responsive:!0},justify:{type:"enum",className:"rt-r-jc",values:["start","center","end","between"],parseValue:function(e){return"between"===e?"space-between":e},responsive:!0},...a.c};function l(e){return o.columns.values.includes(e)?e:e?.match(/^\d+$/)?`repeat(${e}, minmax(0, 1fr))`:e}},68890:function(e,t,r){"use strict";r.d(t,{X:function(){return g}});var n=r(2265),a=r(56800),o=r(71538),l=r(38460),i=r(17534),s=r(75073),c=r(76148),u=r(16532),d=r(91279),m=r(58489),f=r(53773);let p={as:{type:"enum",values:["h1","h2","h3","h4","h5","h6"],default:"h1"},...l.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3","4","5","6","7","8","9"],default:"6",responsive:!0},...f.x,...u.O,...c.E,...m.w,...d.u,...i.EG,...s.K};var v=r(19594),h=r(66188);let g=n.forwardRef((e,t)=>{let{children:r,className:l,asChild:i,as:s="h1",color:c,...u}=(0,v.y)(e,p,h.E);return n.createElement(o.g7,{"data-accent-color":c,...u,ref:t,className:a("rt-Heading",l)},i?r:n.createElement(s,null,r))});g.displayName="Heading"},16808:function(e,t,r){"use strict";let n;r.r(t),r.d(t,{Content:function(){return B},Root:function(){return V},Trigger:function(){return F}});var a=r(2265),o=r(56800),l=r(22988),i=r(78149),s=r(98324),c=r(91715),u=r(1584),d=r(25510),m=r(56935),f=r(31383),p=r(25171),v=r(53938);let h="HoverCard",[g,C]=(0,s.b)(h,[d.D7]),E=(0,d.D7)(),[y,w]=g(h),b=(0,a.forwardRef)((e,t)=>{let{__scopeHoverCard:r,...n}=e,o=w("HoverCardTrigger",r),s=E(r);return(0,a.createElement)(d.ee,(0,l.Z)({asChild:!0},s),(0,a.createElement)(p.WV.a,(0,l.Z)({"data-state":o.open?"open":"closed"},n,{ref:t,onPointerEnter:(0,i.M)(e.onPointerEnter,S(o.onOpen)),onPointerLeave:(0,i.M)(e.onPointerLeave,S(o.onClose)),onFocus:(0,i.M)(e.onFocus,o.onOpen),onBlur:(0,i.M)(e.onBlur,o.onClose),onTouchStart:(0,i.M)(e.onTouchStart,e=>e.preventDefault())})))}),N="HoverCardPortal",[R,x]=g(N,{forceMount:void 0}),M="HoverCardContent",T=(0,a.forwardRef)((e,t)=>{let r=x(M,e.__scopeHoverCard),{forceMount:n=r.forceMount,...o}=e,s=w(M,e.__scopeHoverCard);return(0,a.createElement)(f.z,{present:n||s.open},(0,a.createElement)(_,(0,l.Z)({"data-state":s.open?"open":"closed"},o,{onPointerEnter:(0,i.M)(e.onPointerEnter,S(s.onOpen)),onPointerLeave:(0,i.M)(e.onPointerLeave,S(s.onClose)),ref:t})))}),_=(0,a.forwardRef)((e,t)=>{let{__scopeHoverCard:r,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:m,...f}=e,p=w(M,r),h=E(r),g=(0,a.useRef)(null),C=(0,u.e)(t,g),[y,b]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if(y){let e=document.body;return n=e.style.userSelect||e.style.webkitUserSelect,e.style.userSelect="none",e.style.webkitUserSelect="none",()=>{e.style.userSelect=n,e.style.webkitUserSelect=n}}},[y]),(0,a.useEffect)(()=>{if(g.current){let e=()=>{b(!1),p.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var e;(null===(e=document.getSelection())||void 0===e?void 0:e.toString())!==""&&(p.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",e),()=>{document.removeEventListener("pointerup",e),p.hasSelectionRef.current=!1,p.isPointerDownOnContentRef.current=!1}}},[p.isPointerDownOnContentRef,p.hasSelectionRef]),(0,a.useEffect)(()=>{g.current&&(function(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)t.push(r.currentNode);return t})(g.current).forEach(e=>e.setAttribute("tabindex","-1"))}),(0,a.createElement)(v.XB,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:m,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:(0,i.M)(c,e=>{e.preventDefault()}),onDismiss:p.onDismiss},(0,a.createElement)(d.VY,(0,l.Z)({},h,f,{onPointerDown:(0,i.M)(f.onPointerDown,e=>{e.currentTarget.contains(e.target)&&b(!0),p.hasSelectionRef.current=!1,p.isPointerDownOnContentRef.current=!0}),ref:C,style:{...f.style,userSelect:y?"text":void 0,WebkitUserSelect:y?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})))});function S(e){return t=>"touch"===t.pointerType?void 0:e()}let k=e=>{let{__scopeHoverCard:t,children:r,open:n,defaultOpen:o,onOpenChange:l,openDelay:i=700,closeDelay:s=300}=e,u=E(t),m=(0,a.useRef)(0),f=(0,a.useRef)(0),p=(0,a.useRef)(!1),v=(0,a.useRef)(!1),[h=!1,g]=(0,c.T)({prop:n,defaultProp:o,onChange:l}),C=(0,a.useCallback)(()=>{clearTimeout(f.current),m.current=window.setTimeout(()=>g(!0),i)},[i,g]),w=(0,a.useCallback)(()=>{clearTimeout(m.current),p.current||v.current||(f.current=window.setTimeout(()=>g(!1),s))},[s,g]),b=(0,a.useCallback)(()=>g(!1),[g]);return(0,a.useEffect)(()=>()=>{clearTimeout(m.current),clearTimeout(f.current)},[]),(0,a.createElement)(y,{scope:t,open:h,onOpenChange:g,onOpen:C,onClose:w,onDismiss:b,hasSelectionRef:p,isPointerDownOnContentRef:v},(0,a.createElement)(d.fC,u,r))},D=e=>{let{__scopeHoverCard:t,forceMount:r,children:n,container:o}=e,l=w(N,t);return(0,a.createElement)(R,{scope:t,forceMount:r},(0,a.createElement)(f.z,{present:r||l.open},(0,a.createElement)(m.h,{asChild:!0,container:o},n)))};var P=r(38460),I=r(64791),L=r(74577);let A={...P.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},width:L.n.width,minWidth:L.n.minWidth,maxWidth:{...L.n.maxWidth,default:"480px"},...I.F};var z=r(19594),O=r(9766),Z=r(29340);let V=e=>a.createElement(k,{closeDelay:150,openDelay:200,...e});V.displayName="HoverCard.Root";let F=a.forwardRef((e,t)=>{let{children:r,className:n,...l}=e;return a.createElement(b,{ref:t,className:o("rt-HoverCardTrigger",n),...l,asChild:!0},(0,O.O)(r))});F.displayName="HoverCard.Trigger";let B=a.forwardRef((e,t)=>{let{className:r,forceMount:n,container:l,...i}=(0,z.y)(e,A);return a.createElement(D,{container:l,forceMount:n},a.createElement(Z.Theme,{asChild:!0},a.createElement(T,{align:"start",sideOffset:8,collisionPadding:10,...i,ref:t,className:o("rt-PopperContent","rt-HoverCardContent",r)})))});B.displayName="HoverCard.Content"},52777:function(e,t,r){"use strict";r.d(t,{OW:function(){return l},dc:function(){return a},v4:function(){return o}});var n=r(2265);let a=n.forwardRef((e,t)=>n.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z"})));a.displayName="ThickCheckIcon";let o=n.forwardRef((e,t)=>n.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},n.createElement("path",{d:"M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z"})));o.displayName="ChevronDownIcon";let l=n.forwardRef((e,t)=>n.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.23826 0.201711C3.54108 -0.0809141 4.01567 -0.0645489 4.29829 0.238264L7.79829 3.98826C8.06724 4.27642 8.06724 4.72359 7.79829 5.01174L4.29829 8.76174C4.01567 9.06455 3.54108 9.08092 3.23826 8.79829C2.93545 8.51567 2.91909 8.04108 3.20171 7.73826L6.22409 4.5L3.20171 1.26174C2.91909 0.958928 2.93545 0.484337 3.23826 0.201711Z"})));l.displayName="ThickChevronRightIcon"},84285:function(e,t,r){"use strict";r.r(t),r.d(t,{Close:function(){return h},Content:function(){return v},Root:function(){return f},Trigger:function(){return p}});var n=r(2265),a=r(56800),o=r(61485),l=r(19594),i=r(9766),s=r(38460),c=r(64791),u=r(74577);let d={...s.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3","4"],default:"2",responsive:!0},width:u.n.width,minWidth:u.n.minWidth,maxWidth:{...u.n.maxWidth,default:"480px"},...c.F};var m=r(29340);let f=e=>n.createElement(o.fC,{...e});f.displayName="Popover.Root";let p=n.forwardRef((e,t)=>{let{children:r,...a}=e;return n.createElement(o.xz,{...a,ref:t,asChild:!0},(0,i.O)(r))});p.displayName="Popover.Trigger";let v=n.forwardRef((e,t)=>{let{className:r,forceMount:i,container:s,...c}=(0,l.y)(e,d);return n.createElement(o.h_,{container:s,forceMount:i},n.createElement(m.Theme,{asChild:!0},n.createElement(o.VY,{align:"start",sideOffset:8,collisionPadding:10,...c,ref:t,className:a("rt-PopperContent","rt-PopoverContent",r)})))});v.displayName="Popover.Content";let h=n.forwardRef((e,t)=>{let{children:r,...a}=e;return n.createElement(o.x8,{...a,ref:t,asChild:!0},(0,i.O)(r))});h.displayName="Popover.Close"},37654:function(e,t,r){"use strict";r.r(t),r.d(t,{Progress:function(){return f}});var n=r(2265),a=r(56800),o=r(52431),l=r(17534),i=r(75073),s=r(66176);let c={size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["classic","surface","soft"],default:"surface"},...l.EG,...i.K,...s.I,duration:{type:"string"}};var u=r(19594),d=r(36291),m=r(66188);let f=n.forwardRef((e,t)=>{let{className:r,style:l,color:i,radius:s,duration:f,...p}=(0,u.y)(e,c,m.E);return n.createElement(o.fC,{"data-accent-color":i,"data-radius":s,ref:t,className:a("rt-ProgressRoot",r),style:(0,d.y)({"--progress-duration":"value"in p?void 0:f,"--progress-value":"value"in p?p.value:void 0,"--progress-max":"max"in p?p.max:void 0},l),...p,asChild:!1},n.createElement(o.z$,{className:"rt-ProgressIndicator"}))});f.displayName="Progress"},11416:function(e,t,r){"use strict";r.r(t),r.d(t,{Item:function(){return v},Root:function(){return p}});var n=r(2265),a=r(56800),o=r(99497),l=r(38460),i=r(17534),s=r(75073),c=r(26624);let u={...l.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["surface","classic"],default:"surface"},...i.EG,...s.K,columns:{...c.L.columns,default:"repeat(auto-fit, minmax(160px, 1fr))"},gap:{...c.L.gap,default:"4"}};var d=r(61395),m=r(19594),f=r(66188);let p=n.forwardRef((e,t)=>{let{className:r,color:l,...i}=(0,m.y)(e,u,f.E);return n.createElement(d.r,{asChild:!0},n.createElement(o.fC,{"data-accent-color":l,...i,ref:t,className:a("rt-RadioCardsRoot",r)}))});p.displayName="RadioCards.Root";let v=n.forwardRef((e,t)=>{let{className:r,...l}=e;return n.createElement(o.ck,{...l,asChild:!1,ref:t,className:a("rt-reset","rt-BaseCard","rt-RadioCardsItem",r)})});v.displayName="RadioCards.Item"},76484:function(e,t,r){"use strict";r.r(t),r.d(t,{Item:function(){return y},Root:function(){return E}});var n=r(2265),a=r(56800),o=r(98324),l=r(99497),i=r(38460),s=r(17534),c=r(75073);let u={...i.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["classic","surface","soft"],default:"surface"},...s.EG,...c.K};var d=r(19078),m=r(19594),f=r(66188);let p="RadioGroup",[v]=(0,o.b)(p,[l.oo]),h=(0,l.oo)(),[g,C]=v(p),E=n.forwardRef((e,t)=>{let{color:r=u.color.default,highContrast:o=u.highContrast.default,size:i=u.size.default,variant:s=u.variant.default,...c}=e,{__scopeRadioGroup:d,className:p,...v}=(0,m.y)(c,f.E),C=h(d);return n.createElement(g,{scope:d,color:r,highContrast:o,size:i,variant:s},n.createElement(l.fC,{...C,...v,ref:t,className:a("rt-RadioGroupRoot",p)}))});E.displayName="RadioGroup.Root";let y=n.forwardRef((e,t)=>{let{__scopeRadioGroup:r,children:o,className:l,style:i,...s}=e,{size:c}=C("RadioGroupItem",r);return o?n.createElement(d.x,{as:"label",size:c,className:a("rt-RadioGroupItem",l),style:i},n.createElement(w,{__scopeRadioGroup:r,...s,ref:t}),o&&n.createElement("span",{className:"rt-RadioGroupItemInner"},o)):n.createElement(w,{__scopeRadioGroup:r,...s,ref:t,className:l,style:i})});y.displayName="RadioGroup.Item";let w=n.forwardRef((e,t)=>{let{__scopeRadioGroup:r,...o}=e,i=C("RadioGroupItemRadio",r),s=h(r),{color:c,className:d}=(0,m.y)({...o,...i},u,f.E);return n.createElement(l.ck,{...s,"data-accent-color":c,...o,asChild:!1,ref:t,className:a("rt-reset","rt-BaseRadioRoot",d)})});w.displayName="RadioGroup.ItemRadio"},62381:function(e,t,r){"use strict";r.r(t),r.d(t,{Radio:function(){return m}});var n=r(2265),a=r(56800),o=r(78149),l=r(1584),i=r(17534),s=r(75073);let c={size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["classic","surface","soft"],default:"surface"},...i.EG,...s.K};var u=r(66188),d=r(19594);let m=n.forwardRef((e,t)=>{let r=n.useRef(null),{className:i,color:s,onChange:m,onValueChange:f,...p}=(0,d.y)(e,c,u.E);return n.createElement("input",{type:"radio","data-accent-color":s,...p,onChange:(0,o.M)(m,e=>null==f?void 0:f(e.currentTarget.value)),ref:(0,l.F)(r,t),className:a("rt-reset","rt-BaseRadioRoot","rt-RadioRoot",i)})});m.displayName="Radio"},19829:function(e,t,r){"use strict";r.r(t),r.d(t,{ScrollArea:function(){return f}});var n=r(2265),a=r(56800),o=r(80023),l=r(38460),i=r(66176);let s={...l.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"1",responsive:!0},...i.I,scrollbars:{type:"enum",values:["vertical","horizontal","both"],default:"both"}};var c=r(28978),u=r(36291);let d=r(66188).E.m.values;var m=r(81271);let f=n.forwardRef((e,t)=>{let{rest:r,...l}=function(e){let{m:t,mx:r,my:n,mt:a,mr:o,mb:l,ml:i,...s}=e;return{m:t,mx:r,my:n,mt:a,mr:o,mb:l,ml:i,rest:s}}(e),[i,f]=function(e){let[t,r]=(0,c.uq)({className:"rt-r-m",customProperties:["--margin"],propValues:d,value:e.m}),[n,o]=(0,c.uq)({className:"rt-r-mx",customProperties:["--margin-left","--margin-right"],propValues:d,value:e.mx}),[l,i]=(0,c.uq)({className:"rt-r-my",customProperties:["--margin-top","--margin-bottom"],propValues:d,value:e.my}),[s,m]=(0,c.uq)({className:"rt-r-mt",customProperties:["--margin-top"],propValues:d,value:e.mt}),[f,p]=(0,c.uq)({className:"rt-r-mr",customProperties:["--margin-right"],propValues:d,value:e.mr}),[v,h]=(0,c.uq)({className:"rt-r-mb",customProperties:["--margin-bottom"],propValues:d,value:e.mb}),[g,C]=(0,c.uq)({className:"rt-r-ml",customProperties:["--margin-left"],propValues:d,value:e.ml});return[a(t,n,l,s,f,v,g),(0,u.y)(r,o,i,m,p,h,C)]}(l),{asChild:p,children:v,className:h,style:g,type:C,scrollHideDelay:E="scroll"!==C?0:void 0,dir:y,size:w=s.size.default,radius:b=s.radius.default,scrollbars:N=s.scrollbars.default,...R}=r;return n.createElement(o.fC,{type:C,scrollHideDelay:E,className:a("rt-ScrollAreaRoot",i,h),style:(0,u.y)(f,g),asChild:p},(0,m.x)({asChild:p,children:v},e=>n.createElement(n.Fragment,null,n.createElement(o.l_,{...R,ref:t,className:"rt-ScrollAreaViewport"},e),n.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),"vertical"!==N?n.createElement(o.LW,{"data-radius":b,orientation:"horizontal",className:a("rt-ScrollAreaScrollbar",(0,c.RE)({className:"rt-r-size",value:w,propValues:s.size.values}))},n.createElement(o.bU,{className:"rt-ScrollAreaThumb"})):null,"horizontal"!==N?n.createElement(o.LW,{"data-radius":b,orientation:"vertical",className:a("rt-ScrollAreaScrollbar",(0,c.RE)({className:"rt-r-size",value:w,propValues:s.size.values}))},n.createElement(o.bU,{className:"rt-ScrollAreaThumb"})):null,"both"===N?n.createElement(o.Ns,{className:"rt-ScrollAreaCorner"}):null)))});f.displayName="ScrollArea"},90393:function(e,t,r){"use strict";r.r(t),r.d(t,{Item:function(){return P},Root:function(){return D}});var n=r(2265),a=r(56800),o=r(22988),l=r(98324),i=r(25171),s=r(53398),c=r(78149),u=r(91715);let d=(0,n.forwardRef)((e,t)=>{let{pressed:r,defaultPressed:a=!1,onPressedChange:l,...s}=e,[d=!1,m]=(0,u.T)({prop:r,onChange:l,defaultProp:a});return(0,n.createElement)(i.WV.button,(0,o.Z)({type:"button","aria-pressed":d,"data-state":d?"on":"off","data-disabled":e.disabled?"":void 0},s,{ref:t,onClick:(0,c.M)(e.onClick,()=>{e.disabled||m(!d)})}))});var m=r(87513);let f="ToggleGroup",[p,v]=(0,l.b)(f,[s.Pc]),h=(0,s.Pc)(),g=n.forwardRef((e,t)=>{let{type:r,...a}=e;if("single"===r)return n.createElement(y,(0,o.Z)({},a,{ref:t}));if("multiple"===r)return n.createElement(w,(0,o.Z)({},a,{ref:t}));throw Error(`Missing prop \`type\` expected on \`${f}\``)}),[C,E]=p(f),y=n.forwardRef((e,t)=>{let{value:r,defaultValue:a,onValueChange:l=()=>{},...i}=e,[s,c]=(0,u.T)({prop:r,defaultProp:a,onChange:l});return n.createElement(C,{scope:e.__scopeToggleGroup,type:"single",value:s?[s]:[],onItemActivate:c,onItemDeactivate:n.useCallback(()=>c(""),[c])},n.createElement(R,(0,o.Z)({},i,{ref:t})))}),w=n.forwardRef((e,t)=>{let{value:r,defaultValue:a,onValueChange:l=()=>{},...i}=e,[s=[],c]=(0,u.T)({prop:r,defaultProp:a,onChange:l}),d=n.useCallback(e=>c((t=[])=>[...t,e]),[c]),m=n.useCallback(e=>c((t=[])=>t.filter(t=>t!==e)),[c]);return n.createElement(C,{scope:e.__scopeToggleGroup,type:"multiple",value:s,onItemActivate:d,onItemDeactivate:m},n.createElement(R,(0,o.Z)({},i,{ref:t})))}),[b,N]=p(f),R=n.forwardRef((e,t)=>{let{__scopeToggleGroup:r,disabled:a=!1,rovingFocus:l=!0,orientation:c,dir:u,loop:d=!0,...f}=e,p=h(r),v=(0,m.gm)(u),g={role:"group",dir:v,...f};return n.createElement(b,{scope:r,rovingFocus:l,disabled:a},l?n.createElement(s.fC,(0,o.Z)({asChild:!0},p,{orientation:c,dir:v,loop:d}),n.createElement(i.WV.div,(0,o.Z)({},g,{ref:t}))):n.createElement(i.WV.div,(0,o.Z)({},g,{ref:t})))}),x="ToggleGroupItem",M=n.forwardRef((e,t)=>{let r=E(x,e.__scopeToggleGroup),a=N(x,e.__scopeToggleGroup),l=h(e.__scopeToggleGroup),i=r.value.includes(e.value),c=a.disabled||e.disabled,u={...e,pressed:i,disabled:c},d=n.useRef(null);return a.rovingFocus?n.createElement(s.ck,(0,o.Z)({asChild:!0},l,{focusable:!c,active:i,ref:d}),n.createElement(T,(0,o.Z)({},u,{ref:t}))):n.createElement(T,(0,o.Z)({},u,{ref:t}))}),T=n.forwardRef((e,t)=>{let{__scopeToggleGroup:r,value:a,...l}=e,i=E(x,r),s={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},c="single"===i.type?s:void 0;return n.createElement(d,(0,o.Z)({},c,l,{ref:t,onPressedChange:e=>{e?i.onItemActivate(a):i.onItemDeactivate(a)}}))}),_={size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["surface","classic"],default:"surface"},...r(66176).I};var S=r(19594),k=r(66188);let D=n.forwardRef((e,t)=>{let{className:r,children:o,radius:l,value:i,defaultValue:s,onValueChange:c,...d}=(0,S.y)(e,_,k.E),[m,f]=(0,u.T)({prop:i,onChange:c,defaultProp:s});return n.createElement(g,{"data-radius":l,ref:t,className:a("rt-SegmentedControlRoot",r),onValueChange:e=>{e&&f(e)},...d,type:"single",value:m,asChild:!1,disabled:!1},o,n.createElement("div",{className:"rt-SegmentedControlIndicator"}))});D.displayName="SegmentedControl.Root";let P=n.forwardRef((e,t)=>{let{children:r,className:o,...l}=e;return n.createElement(M,{ref:t,className:a("rt-reset","rt-SegmentedControlItem",o),...l,disabled:!1,asChild:!1},n.createElement("span",{className:"rt-SegmentedControlItemSeparator"}),n.createElement("span",{className:"rt-SegmentedControlItemLabel"},n.createElement("span",{className:"rt-SegmentedControlItemLabelActive"},r),n.createElement("span",{className:"rt-SegmentedControlItemLabelInactive"},r)))});P.displayName="SegmentedControl.Item"},37967:function(e,t,r){"use strict";r.r(t),r.d(t,{Content:function(){return y},Group:function(){return b},Item:function(){return w},Label:function(){return N},Root:function(){return C},Separator:function(){return R},Trigger:function(){return E}});var n=r(2265),a=r(56800),o=r(17549),l=r(80023),i=r(19594),s=r(66188),c=r(52777),u=r(17534),d=r(75073),m=r(66176);let f={type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},p={variant:{type:"enum",className:"rt-variant",values:["classic","surface","soft","ghost"],default:"surface"},...u.EG,...m.I,placeholder:{type:"string"}},v={variant:{type:"enum",className:"rt-variant",values:["solid","soft"],default:"solid"},...u.EG,...d.K};var h=r(29340);let g=n.createContext({}),C=e=>{let{children:t,size:r=f.default,...a}=e;return n.createElement(o.fC,{...a},n.createElement(g.Provider,{value:n.useMemo(()=>({size:r}),[r])},t))};C.displayName="Select.Root";let E=n.forwardRef((e,t)=>{let r=n.useContext(g),{children:l,className:u,color:d,radius:m,placeholder:v,...h}=(0,i.y)({size:null==r?void 0:r.size,...e},{size:f},p,s.E);return n.createElement(o.xz,{asChild:!0},n.createElement("button",{"data-accent-color":d,"data-radius":m,...h,ref:t,className:a("rt-reset","rt-SelectTrigger",u)},n.createElement("span",{className:"rt-SelectTriggerInner"},n.createElement(o.B4,{placeholder:v},l)),n.createElement(o.JO,{asChild:!0},n.createElement(c.v4,{className:"rt-SelectIcon"}))))});E.displayName="Select.Trigger";let y=n.forwardRef((e,t)=>{let r=n.useContext(g),{className:s,children:c,color:u,container:d,...m}=(0,i.y)({size:null==r?void 0:r.size,...e},{size:f},v),p=(0,h.useThemeContext)(),C=u||p.accentColor;return n.createElement(o.h_,{container:d},n.createElement(h.Theme,{asChild:!0},n.createElement(o.VY,{"data-accent-color":C,sideOffset:4,...m,asChild:!1,ref:t,className:a({"rt-PopperContent":"popper"===m.position},"rt-SelectContent",s)},n.createElement(l.fC,{type:"auto",className:"rt-ScrollAreaRoot"},n.createElement(o.l_,{asChild:!0,className:"rt-SelectViewport"},n.createElement(l.l_,{className:"rt-ScrollAreaViewport",style:{overflowY:void 0}},c)),n.createElement(l.LW,{className:"rt-ScrollAreaScrollbar rt-r-size-1",orientation:"vertical"},n.createElement(l.bU,{className:"rt-ScrollAreaThumb"}))))))});y.displayName="Select.Content";let w=n.forwardRef((e,t)=>{let{className:r,children:l,...i}=e;return n.createElement(o.ck,{...i,asChild:!1,ref:t,className:a("rt-SelectItem",r)},n.createElement(o.wU,{className:"rt-SelectItemIndicator"},n.createElement(c.dc,{className:"rt-SelectItemIndicatorIcon"})),n.createElement(o.eT,null,l))});w.displayName="Select.Item";let b=n.forwardRef((e,t)=>{let{className:r,...l}=e;return n.createElement(o.ZA,{...l,asChild:!1,ref:t,className:a("rt-SelectGroup",r)})});b.displayName="Select.Group";let N=n.forwardRef((e,t)=>{let{className:r,...l}=e;return n.createElement(o.__,{...l,asChild:!1,ref:t,className:a("rt-SelectLabel",r)})});N.displayName="Select.Label";let R=n.forwardRef((e,t)=>{let{className:r,...l}=e;return n.createElement(o.Z0,{...l,asChild:!1,ref:t,className:a("rt-SelectSeparator",r)})});R.displayName="Select.Separator"},63817:function(e,t,r){"use strict";r.r(t),r.d(t,{Separator:function(){return s}});var n=r(2265),a=r(56800);let o={orientation:{type:"enum",className:"rt-r-orientation",values:["horizontal","vertical"],default:"horizontal",responsive:!0},size:{type:"enum",className:"rt-r-size",values:["1","2","3","4"],default:"1",responsive:!0},color:{...r(17534).EG.color,default:"gray"},decorative:{type:"boolean",default:!0}};var l=r(19594),i=r(66188);let s=n.forwardRef((e,t)=>{let{className:r,color:s,decorative:c,...u}=(0,l.y)(e,o,i.E);return n.createElement("span",{"data-accent-color":s,role:c?void 0:"separator",...u,ref:t,className:a("rt-Separator",r)})});s.displayName="Separator"},32039:function(e,t,r){"use strict";r.r(t),r.d(t,{Slider:function(){return X}});var n=r(2265),a=r(56800),o=r(22988),l=r(62361),i=r(78149),s=r(1584),c=r(98324),u=r(91715),d=r(87513),m=r(47250),f=r(75238),p=r(25171),v=r(90976);let h=["PageUp","PageDown"],g=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],C={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},E="Slider",[y,w,b]=(0,v.B)(E),[N,R]=(0,c.b)(E,[b]),[x,M]=N(E),T=(0,n.forwardRef)((e,t)=>{let{name:r,min:a=0,max:c=100,step:d=1,orientation:m="horizontal",disabled:f=!1,minStepsBetweenThumbs:p=0,defaultValue:v=[a],value:C,onValueChange:E=()=>{},onValueCommit:w=()=>{},inverted:b=!1,...N}=e,[R,M]=(0,n.useState)(null),T=(0,s.e)(t,e=>M(e)),_=(0,n.useRef)(new Set),S=(0,n.useRef)(0),P="horizontal"===m,I=!R||!!R.closest("form"),[L=[],A]=(0,u.T)({prop:C,defaultProp:v,onChange:e=>{var t;null===(t=[..._.current][S.current])||void 0===t||t.focus(),E(e)}}),z=(0,n.useRef)(L);function O(e,t,{commit:r}={commit:!1}){let n=(String(d).split(".")[1]||"").length,o=function(e,t){let r=Math.pow(10,t);return Math.round(e*r)/r}(Math.round((e-a)/d)*d+a,n),i=(0,l.u)(o,[a,c]);A((e=[])=>{var n,a;let o=function(e=[],t,r){let n=[...e];return n[r]=t,n.sort((e,t)=>e-t)}(e,i,t);if(n=o,!(!((a=p*d)>0)||Math.min(...n.slice(0,-1).map((e,t)=>n[t+1]-e))>=a))return e;{S.current=o.indexOf(i);let t=String(o)!==String(e);return t&&r&&w(o),t?o:e}})}return(0,n.createElement)(x,{scope:e.__scopeSlider,disabled:f,min:a,max:c,valueIndexToChangeRef:S,thumbs:_.current,values:L,orientation:m},(0,n.createElement)(y.Provider,{scope:e.__scopeSlider},(0,n.createElement)(y.Slot,{scope:e.__scopeSlider},(0,n.createElement)(P?k:D,(0,o.Z)({"aria-disabled":f,"data-disabled":f?"":void 0},N,{ref:T,onPointerDown:(0,i.M)(N.onPointerDown,()=>{f||(z.current=L)}),min:a,max:c,inverted:b,onSlideStart:f?void 0:function(e){let t=function(e,t){if(1===e.length)return 0;let r=e.map(e=>Math.abs(e-t));return r.indexOf(Math.min(...r))}(L,e);O(e,t)},onSlideMove:f?void 0:function(e){O(e,S.current)},onSlideEnd:f?void 0:function(){let e=z.current[S.current];L[S.current]!==e&&w(L)},onHomeKeyDown:()=>!f&&O(a,0,{commit:!0}),onEndKeyDown:()=>!f&&O(c,L.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!f){let r=h.includes(e.key)||e.shiftKey&&g.includes(e.key),n=S.current;O(L[n]+d*(r?10:1)*t,n,{commit:!0})}}})))),I&&L.map((e,t)=>(0,n.createElement)(V,{key:t,name:r?r+(L.length>1?"[]":""):void 0,value:e})))}),[_,S]=N(E,{startEdge:"left",endEdge:"right",size:"width",direction:1}),k=(0,n.forwardRef)((e,t)=>{let{min:r,max:a,dir:l,inverted:i,onSlideStart:c,onSlideMove:u,onSlideEnd:m,onStepKeyDown:f,...p}=e,[v,h]=(0,n.useState)(null),g=(0,s.e)(t,e=>h(e)),E=(0,n.useRef)(),y=(0,d.gm)(l),w="ltr"===y,b=w&&!i||!w&&i;function N(e){let t=E.current||v.getBoundingClientRect(),n=B([0,t.width],b?[r,a]:[a,r]);return E.current=t,n(e-t.left)}return(0,n.createElement)(_,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width"},(0,n.createElement)(P,(0,o.Z)({dir:y,"data-orientation":"horizontal"},p,{ref:g,style:{...p.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{let t=N(e.clientX);null==c||c(t)},onSlideMove:e=>{let t=N(e.clientX);null==u||u(t)},onSlideEnd:()=>{E.current=void 0,null==m||m()},onStepKeyDown:e=>{let t=C[b?"from-left":"from-right"].includes(e.key);null==f||f({event:e,direction:t?-1:1})}})))}),D=(0,n.forwardRef)((e,t)=>{let{min:r,max:a,inverted:l,onSlideStart:i,onSlideMove:c,onSlideEnd:u,onStepKeyDown:d,...m}=e,f=(0,n.useRef)(null),p=(0,s.e)(t,f),v=(0,n.useRef)(),h=!l;function g(e){let t=v.current||f.current.getBoundingClientRect(),n=B([0,t.height],h?[a,r]:[r,a]);return v.current=t,n(e-t.top)}return(0,n.createElement)(_,{scope:e.__scopeSlider,startEdge:h?"bottom":"top",endEdge:h?"top":"bottom",size:"height",direction:h?1:-1},(0,n.createElement)(P,(0,o.Z)({"data-orientation":"vertical"},m,{ref:p,style:{...m.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{let t=g(e.clientY);null==i||i(t)},onSlideMove:e=>{let t=g(e.clientY);null==c||c(t)},onSlideEnd:()=>{v.current=void 0,null==u||u()},onStepKeyDown:e=>{let t=C[h?"from-bottom":"from-top"].includes(e.key);null==d||d({event:e,direction:t?-1:1})}})))}),P=(0,n.forwardRef)((e,t)=>{let{__scopeSlider:r,onSlideStart:a,onSlideMove:l,onSlideEnd:s,onHomeKeyDown:c,onEndKeyDown:u,onStepKeyDown:d,...m}=e,f=M(E,r);return(0,n.createElement)(p.WV.span,(0,o.Z)({},m,{ref:t,onKeyDown:(0,i.M)(e.onKeyDown,e=>{"Home"===e.key?(c(e),e.preventDefault()):"End"===e.key?(u(e),e.preventDefault()):h.concat(g).includes(e.key)&&(d(e),e.preventDefault())}),onPointerDown:(0,i.M)(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),f.thumbs.has(t)?t.focus():a(e)}),onPointerMove:(0,i.M)(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&l(e)}),onPointerUp:(0,i.M)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),s(e))})}))}),I=(0,n.forwardRef)((e,t)=>{let{__scopeSlider:r,...a}=e,l=M("SliderTrack",r);return(0,n.createElement)(p.WV.span,(0,o.Z)({"data-disabled":l.disabled?"":void 0,"data-orientation":l.orientation},a,{ref:t}))}),L="SliderRange",A=(0,n.forwardRef)((e,t)=>{let{__scopeSlider:r,...a}=e,l=M(L,r),i=S(L,r),c=(0,n.useRef)(null),u=(0,s.e)(t,c),d=l.values.length,m=l.values.map(e=>F(e,l.min,l.max));return(0,n.createElement)(p.WV.span,(0,o.Z)({"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0},a,{ref:u,style:{...e.style,[i.startEdge]:(d>1?Math.min(...m):0)+"%",[i.endEdge]:100-Math.max(...m)+"%"}}))}),z="SliderThumb",O=(0,n.forwardRef)((e,t)=>{let r=w(e.__scopeSlider),[a,l]=(0,n.useState)(null),i=(0,s.e)(t,e=>l(e)),c=(0,n.useMemo)(()=>a?r().findIndex(e=>e.ref.current===a):-1,[r,a]);return(0,n.createElement)(Z,(0,o.Z)({},e,{ref:i,index:c}))}),Z=(0,n.forwardRef)((e,t)=>{var r;let{__scopeSlider:a,index:l,...c}=e,u=M(z,a),d=S(z,a),[m,v]=(0,n.useState)(null),h=(0,s.e)(t,e=>v(e)),g=(0,f.t)(m),C=u.values[l],E=void 0===C?0:F(C,u.min,u.max),w=(r=u.values.length)>2?`Value ${l+1} of ${r}`:2===r?["Minimum","Maximum"][l]:void 0,b=null==g?void 0:g[d.size],N=b?function(e,t,r){let n=e/2,a=B([0,50],[0,n]);return(n-a(t)*r)*r}(b,E,d.direction):0;return(0,n.useEffect)(()=>{if(m)return u.thumbs.add(m),()=>{u.thumbs.delete(m)}},[m,u.thumbs]),(0,n.createElement)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[d.startEdge]:`calc(${E}% + ${N}px)`}},(0,n.createElement)(y.ItemSlot,{scope:e.__scopeSlider},(0,n.createElement)(p.WV.span,(0,o.Z)({role:"slider","aria-label":e["aria-label"]||w,"aria-valuemin":u.min,"aria-valuenow":C,"aria-valuemax":u.max,"aria-orientation":u.orientation,"data-orientation":u.orientation,"data-disabled":u.disabled?"":void 0,tabIndex:u.disabled?void 0:0},c,{ref:h,style:void 0===C?{display:"none"}:e.style,onFocus:(0,i.M)(e.onFocus,()=>{u.valueIndexToChangeRef.current=l})}))))}),V=e=>{let{value:t,...r}=e,a=(0,n.useRef)(null),l=(0,m.D)(t);return(0,n.useEffect)(()=>{let e=a.current,r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(l!==t&&r){let n=new Event("input",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[l,t]),(0,n.createElement)("input",(0,o.Z)({style:{display:"none"}},r,{ref:a,defaultValue:t}))};function F(e,t,r){return(0,l.u)(100/(r-t)*(e-t),[0,100])}function B(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}var W=r(17534),G=r(75073),H=r(66176);let K={size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["classic","surface","soft"],default:"surface"},...W.EG,...G.K,...H.I};var U=r(19594),j=r(66188);let X=n.forwardRef((e,t)=>{var r,o;let{className:l,color:i,radius:s,tabIndex:c,...u}=(0,U.y)(e,K,j.E);return n.createElement(T,{"data-accent-color":i,"data-radius":s,ref:t,...u,asChild:!1,className:a("rt-SliderRoot",l)},n.createElement(I,{className:"rt-SliderTrack"},n.createElement(A,{className:a("rt-SliderRange",{"rt-high-contrast":e.highContrast}),"data-inverted":u.inverted?"":void 0})),(null!==(o=null!==(r=u.value)&&void 0!==r?r:u.defaultValue)&&void 0!==o?o:[]).map((e,t)=>n.createElement(O,{key:t,className:"rt-SliderThumb",...void 0!==c?{tabIndex:c}:void 0})))});X.displayName="Slider"},82709:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n={size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},loading:{type:"boolean",default:!0}}},15961:function(e,t,r){"use strict";r.r(t),r.d(t,{Switch:function(){return m}});var n=r(2265),a=r(56800),o=r(9646),l=r(19594),i=r(66188),s=r(17534),c=r(75073),u=r(66176);let d={size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["classic","surface","soft"],default:"surface"},...s.EG,...c.K,...u.I},m=n.forwardRef((e,t)=>{let{className:r,color:s,radius:c,...u}=(0,l.y)(e,d,i.E);return n.createElement(o.fC,{"data-accent-color":s,"data-radius":c,...u,asChild:!1,ref:t,className:a("rt-reset","rt-SwitchRoot",r)},n.createElement(o.bU,{className:a("rt-SwitchThumb",{"rt-high-contrast":e.highContrast})}))});m.displayName="Switch"},67738:function(e,t,r){"use strict";r.r(t),r.d(t,{Link:function(){return et},Root:function(){return ee}});var n=r(2265),a=r(56800),o=r(22988),l=(r(54887),r(98324)),i=r(78149),s=r(25171),c=r(91715),u=r(1584),d=r(87513),m=r(31383),f=r(53201),p=r(90976),v=r(53938),h=r(47250),g=r(1336),C=r(75137);r(31725);let E="NavigationMenu",[y,w,b]=(0,p.B)(E),[N,R,x]=(0,p.B)(E),[M,T]=(0,l.b)(E,[b,x]),[_,S]=M(E),[k,D]=M(E),P=(0,n.forwardRef)((e,t)=>{let{__scopeNavigationMenu:r,value:a,onValueChange:l,defaultValue:i,delayDuration:m=200,skipDelayDuration:f=300,orientation:p="horizontal",dir:v,...h}=e,[g,C]=(0,n.useState)(null),E=(0,u.e)(t,e=>C(e)),y=(0,d.gm)(v),w=(0,n.useRef)(0),b=(0,n.useRef)(0),N=(0,n.useRef)(0),[R,x]=(0,n.useState)(!0),[M="",T]=(0,c.T)({prop:a,onChange:e=>{let t=f>0;""!==e?(window.clearTimeout(N.current),t&&x(!1)):(window.clearTimeout(N.current),N.current=window.setTimeout(()=>x(!0),f)),null==l||l(e)},defaultProp:i}),_=(0,n.useCallback)(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>T(""),150)},[T]),S=(0,n.useCallback)(e=>{window.clearTimeout(b.current),T(e)},[T]),k=(0,n.useCallback)(e=>{M===e?window.clearTimeout(b.current):w.current=window.setTimeout(()=>{window.clearTimeout(b.current),T(e)},m)},[M,T,m]);return(0,n.useEffect)(()=>()=>{window.clearTimeout(w.current),window.clearTimeout(b.current),window.clearTimeout(N.current)},[]),(0,n.createElement)(I,{scope:r,isRootMenu:!0,value:M,dir:y,orientation:p,rootNavigationMenu:g,onTriggerEnter:e=>{window.clearTimeout(w.current),R?k(e):S(e)},onTriggerLeave:()=>{window.clearTimeout(w.current),_()},onContentEnter:()=>window.clearTimeout(b.current),onContentLeave:_,onItemSelect:e=>{T(t=>t===e?"":e)},onItemDismiss:()=>T("")},(0,n.createElement)(s.WV.nav,(0,o.Z)({"aria-label":"Main","data-orientation":p,dir:y},h,{ref:E})))}),I=e=>{let{scope:t,isRootMenu:r,rootNavigationMenu:a,dir:o,orientation:l,children:i,value:s,onItemSelect:c,onItemDismiss:u,onTriggerEnter:d,onTriggerLeave:m,onContentEnter:p,onContentLeave:v}=e,[g,E]=(0,n.useState)(null),[w,b]=(0,n.useState)(new Map),[N,R]=(0,n.useState)(null);return(0,n.createElement)(_,{scope:t,isRootMenu:r,rootNavigationMenu:a,value:s,previousValue:(0,h.D)(s),baseId:(0,f.M)(),dir:o,orientation:l,viewport:g,onViewportChange:E,indicatorTrack:N,onIndicatorTrackChange:R,onTriggerEnter:(0,C.W)(d),onTriggerLeave:(0,C.W)(m),onContentEnter:(0,C.W)(p),onContentLeave:(0,C.W)(v),onItemSelect:(0,C.W)(c),onItemDismiss:(0,C.W)(u),onViewportContentChange:(0,n.useCallback)((e,t)=>{b(r=>(r.set(e,t),new Map(r)))},[]),onViewportContentRemove:(0,n.useCallback)(e=>{b(t=>t.has(e)?(t.delete(e),new Map(t)):t)},[])},(0,n.createElement)(y.Provider,{scope:t},(0,n.createElement)(k,{scope:t,items:w},i)))},L=(0,n.forwardRef)((e,t)=>{let{__scopeNavigationMenu:r,...a}=e,l=S("NavigationMenuList",r),i=(0,n.createElement)(s.WV.ul,(0,o.Z)({"data-orientation":l.orientation},a,{ref:t}));return(0,n.createElement)(s.WV.div,{style:{position:"relative"},ref:l.onIndicatorTrackChange},(0,n.createElement)(y.Slot,{scope:r},l.isRootMenu?(0,n.createElement)(G,{asChild:!0},i):i))}),[A,z]=M("NavigationMenuItem"),O=(0,n.forwardRef)((e,t)=>{let{__scopeNavigationMenu:r,value:a,...l}=e,i=(0,f.M)(),c=(0,n.useRef)(null),u=(0,n.useRef)(null),d=(0,n.useRef)(null),m=(0,n.useRef)(()=>{}),p=(0,n.useRef)(!1),v=(0,n.useCallback)((e="start")=>{if(c.current){m.current();let t=U(c.current);t.length&&j("start"===e?t:t.reverse())}},[]),h=(0,n.useCallback)(()=>{if(c.current){let e=U(c.current);e.length&&(m.current=(e.forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}),()=>{e.forEach(e=>{let t=e.dataset.tabindex;e.setAttribute("tabindex",t)})}))}},[]);return(0,n.createElement)(A,{scope:r,value:a||i||"LEGACY_REACT_AUTO_VALUE",triggerRef:u,contentRef:c,focusProxyRef:d,wasEscapeCloseRef:p,onEntryKeyDown:v,onFocusProxyEnter:v,onRootContentClose:h,onContentFocusOutside:h},(0,n.createElement)(s.WV.li,(0,o.Z)({},l,{ref:t})))}),Z="navigationMenu.linkSelect",V=(0,n.forwardRef)((e,t)=>{let{__scopeNavigationMenu:r,active:a,onSelect:l,...c}=e;return(0,n.createElement)(K,{asChild:!0},(0,n.createElement)(s.WV.a,(0,o.Z)({"data-active":a?"":void 0,"aria-current":a?"page":void 0},c,{ref:t,onClick:(0,i.M)(e.onClick,e=>{let t=e.target,r=new CustomEvent(Z,{bubbles:!0,cancelable:!0});if(t.addEventListener(Z,e=>null==l?void 0:l(e),{once:!0}),(0,s.jH)(t,r),!r.defaultPrevented&&!e.metaKey){let e=new CustomEvent(B,{bubbles:!0,cancelable:!0});(0,s.jH)(t,e)}},{checkForDefaultPrevented:!1})})))}),F=((e,t)=>{let{__scopeNavigationMenu:r,...a}=e,l=S("NavigationMenuIndicator",r),i=w(r),[c,u]=(0,n.useState)(null),[d,m]=(0,n.useState)(null),f="horizontal"===l.orientation,p=!!l.value;(0,n.useEffect)(()=>{var e;let t=null===(e=i().find(e=>e.value===l.value))||void 0===e?void 0:e.ref.current;t&&u(t)},[i,l.value]);let v=()=>{c&&m({size:f?c.offsetWidth:c.offsetHeight,offset:f?c.offsetLeft:c.offsetTop})};return X(c,v),X(l.indicatorTrack,v),d?(0,n.createElement)(s.WV.div,(0,o.Z)({"aria-hidden":!0,"data-state":p?"visible":"hidden","data-orientation":l.orientation},a,{ref:t,style:{position:"absolute",...f?{left:0,width:d.size+"px",transform:`translateX(${d.offset}px)`}:{top:0,height:d.size+"px",transform:`translateY(${d.offset}px)`},...a.style}})):null},"NavigationMenuContent"),B=((e,t)=>{let{onViewportContentChange:r,onViewportContentRemove:n}=S(F,e.__scopeNavigationMenu);return(0,g.b)(()=>{r(e.value,{ref:t,...e})},[e,t,r]),(0,g.b)(()=>()=>n(e.value),[e.value,n]),null},"navigationMenu.rootContentDismiss"),W=(0,n.forwardRef)((e,t)=>{let{__scopeNavigationMenu:r,value:a,triggerRef:l,focusProxyRef:s,wasEscapeCloseRef:c,onRootContentClose:d,onContentFocusOutside:m,...f}=e,p=S(F,r),h=(0,n.useRef)(null),g=(0,u.e)(h,t),C=function(e,t){return`${e}-trigger-${t}`}(p.baseId,a),E=function(e,t){return`${e}-content-${t}`}(p.baseId,a),y=w(r),b=(0,n.useRef)(null),{onItemDismiss:N}=p;(0,n.useEffect)(()=>{let e=h.current;if(p.isRootMenu&&e){let t=()=>{var t;N(),d(),e.contains(document.activeElement)&&(null===(t=l.current)||void 0===t||t.focus())};return e.addEventListener(B,t),()=>e.removeEventListener(B,t)}},[p.isRootMenu,e.value,l,N,d]);let R=(0,n.useMemo)(()=>{let e=y().map(e=>e.value);"rtl"===p.dir&&e.reverse();let t=e.indexOf(p.value),r=e.indexOf(p.previousValue),n=a===p.value,o=r===e.indexOf(a);if(!n&&!o)return b.current;let l=(()=>{if(t!==r){if(n&&-1!==r)return t>r?"from-end":"from-start";if(o&&-1!==t)return t>r?"to-start":"to-end"}return null})();return b.current=l,l},[p.previousValue,p.value,p.dir,y,a]);return(0,n.createElement)(G,{asChild:!0},(0,n.createElement)(v.XB,(0,o.Z)({id:E,"aria-labelledby":C,"data-motion":R,"data-orientation":p.orientation},f,{ref:g,onDismiss:()=>{var e;let t=new Event(B,{bubbles:!0,cancelable:!0});null===(e=h.current)||void 0===e||e.dispatchEvent(t)},onFocusOutside:(0,i.M)(e.onFocusOutside,e=>{var t;m();let r=e.target;null!==(t=p.rootNavigationMenu)&&void 0!==t&&t.contains(r)&&e.preventDefault()}),onPointerDownOutside:(0,i.M)(e.onPointerDownOutside,e=>{var t;let r=e.target,n=y().some(e=>{var t;return null===(t=e.ref.current)||void 0===t?void 0:t.contains(r)}),a=p.isRootMenu&&(null===(t=p.viewport)||void 0===t?void 0:t.contains(r));(n||a||!p.isRootMenu)&&e.preventDefault()}),onKeyDown:(0,i.M)(e.onKeyDown,e=>{let t=e.altKey||e.ctrlKey||e.metaKey;if("Tab"===e.key&&!t){let t=U(e.currentTarget),n=document.activeElement,a=t.findIndex(e=>e===n);if(j(e.shiftKey?t.slice(0,a).reverse():t.slice(a+1,t.length)))e.preventDefault();else{var r;null===(r=s.current)||void 0===r||r.focus()}}}),onEscapeKeyDown:(0,i.M)(e.onEscapeKeyDown,e=>{c.current=!0})})))}),G=((e,t)=>{let{__scopeNavigationMenu:r,children:a,...l}=e,c=S("NavigationMenuViewport",r),d=(0,u.e)(t,c.onViewportChange),f=D(F,e.__scopeNavigationMenu),[p,v]=(0,n.useState)(null),[h,g]=(0,n.useState)(null),C=p?(null==p?void 0:p.width)+"px":void 0,E=p?(null==p?void 0:p.height)+"px":void 0,y=!!c.value,w=y?c.value:c.previousValue;return X(h,()=>{h&&v({width:h.offsetWidth,height:h.offsetHeight})}),(0,n.createElement)(s.WV.div,(0,o.Z)({"data-state":function(e){return e?"open":"closed"}(y),"data-orientation":c.orientation},l,{ref:d,style:{pointerEvents:!y&&c.isRootMenu?"none":void 0,"--radix-navigation-menu-viewport-width":C,"--radix-navigation-menu-viewport-height":E,...l.style},onPointerEnter:(0,i.M)(e.onPointerEnter,c.onContentEnter),onPointerLeave:(0,i.M)(e.onPointerLeave,function(e){return t=>"mouse"===t.pointerType?e(t):void 0}(c.onContentLeave))}),Array.from(f.items).map(([e,{ref:t,forceMount:r,...a}])=>{let l=w===e;return(0,n.createElement)(m.z,{key:e,present:r||l},(0,n.createElement)(W,(0,o.Z)({},a,{ref:(0,u.F)(t,e=>{l&&e&&g(e)})})))}))},(0,n.forwardRef)((e,t)=>{let{__scopeNavigationMenu:r,...a}=e,l=S("FocusGroup",r);return(0,n.createElement)(N.Provider,{scope:r},(0,n.createElement)(N.Slot,{scope:r},(0,n.createElement)(s.WV.div,(0,o.Z)({dir:l.dir},a,{ref:t}))))})),H=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],K=(0,n.forwardRef)((e,t)=>{let{__scopeNavigationMenu:r,...a}=e,l=R(r),c=S("FocusGroupItem",r);return(0,n.createElement)(N.ItemSlot,{scope:r},(0,n.createElement)(s.WV.button,(0,o.Z)({},a,{ref:t,onKeyDown:(0,i.M)(e.onKeyDown,e=>{if(["Home","End",...H].includes(e.key)){let t=l().map(e=>e.ref.current);if(["rtl"===c.dir?"ArrowRight":"ArrowLeft","ArrowUp","End"].includes(e.key)&&t.reverse(),H.includes(e.key)){let r=t.indexOf(e.currentTarget);t=t.slice(r+1)}setTimeout(()=>j(t)),e.preventDefault()}})})))});function U(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function j(e){let t=document.activeElement;return e.some(e=>e===t||(e.focus(),document.activeElement!==t))}function X(e,t){let r=(0,C.W)(t);(0,g.b)(()=>{let t=0;if(e){let n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}var Y=r(38460),q=r(13384);({...Y.C});var $=r(19594),J=r(81271),Q=r(66188);let ee=n.forwardRef((e,t)=>{let{children:r,className:o,color:l,...i}=(0,$.y)(e,q.U,Q.E);return n.createElement(P,{className:"rt-TabNavRoot","data-accent-color":l,...i,asChild:!1,ref:t},n.createElement(L,{className:a("rt-reset","rt-BaseTabList","rt-TabNavList",o)},r))});ee.displayName="TabNav.Root";let et=n.forwardRef((e,t)=>{let{asChild:r,children:o,className:l,...i}=e;return n.createElement(O,{className:"rt-TabNavItem"},n.createElement(V,{...i,ref:t,className:a("rt-reset","rt-BaseTabListTrigger","rt-TabNavLink",l),onSelect:()=>{},asChild:r},(0,J.x)({asChild:r,children:o},e=>n.createElement(n.Fragment,null,n.createElement("span",{className:"rt-BaseTabListTriggerInner rt-TabNavLinkInner"},e),n.createElement("span",{className:"rt-BaseTabListTriggerInnerHidden rt-TabNavLinkInnerHidden"},e)))))});et.displayName="TabNav.Link"},42594:function(e,t,r){"use strict";r.r(t),r.d(t,{Content:function(){return I},List:function(){return D},Root:function(){return k},Trigger:function(){return P}});var n=r(2265),a=r(56800),o=r(22988),l=r(78149),i=r(98324),s=r(53398),c=r(31383),u=r(25171),d=r(87513),m=r(91715),f=r(53201);let p="Tabs",[v,h]=(0,i.b)(p,[s.Pc]),g=(0,s.Pc)(),[C,E]=v(p),y=(0,n.forwardRef)((e,t)=>{let{__scopeTabs:r,value:a,onValueChange:l,defaultValue:i,orientation:s="horizontal",dir:c,activationMode:p="automatic",...v}=e,h=(0,d.gm)(c),[g,E]=(0,m.T)({prop:a,onChange:l,defaultProp:i});return(0,n.createElement)(C,{scope:r,baseId:(0,f.M)(),value:g,onValueChange:E,orientation:s,dir:h,activationMode:p},(0,n.createElement)(u.WV.div,(0,o.Z)({dir:h,"data-orientation":s},v,{ref:t})))}),w=(0,n.forwardRef)((e,t)=>{let{__scopeTabs:r,loop:a=!0,...l}=e,i=E("TabsList",r),c=g(r);return(0,n.createElement)(s.fC,(0,o.Z)({asChild:!0},c,{orientation:i.orientation,dir:i.dir,loop:a}),(0,n.createElement)(u.WV.div,(0,o.Z)({role:"tablist","aria-orientation":i.orientation},l,{ref:t})))}),b=(0,n.forwardRef)((e,t)=>{let{__scopeTabs:r,value:a,disabled:i=!1,...c}=e,d=E("TabsTrigger",r),m=g(r),f=R(d.baseId,a),p=x(d.baseId,a),v=a===d.value;return(0,n.createElement)(s.ck,(0,o.Z)({asChild:!0},m,{focusable:!i,active:v}),(0,n.createElement)(u.WV.button,(0,o.Z)({type:"button",role:"tab","aria-selected":v,"aria-controls":p,"data-state":v?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:f},c,{ref:t,onMouseDown:(0,l.M)(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():d.onValueChange(a)}),onKeyDown:(0,l.M)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&d.onValueChange(a)}),onFocus:(0,l.M)(e.onFocus,()=>{let e="manual"!==d.activationMode;v||i||!e||d.onValueChange(a)})})))}),N=(0,n.forwardRef)((e,t)=>{let{__scopeTabs:r,value:a,forceMount:l,children:i,...s}=e,d=E("TabsContent",r),m=R(d.baseId,a),f=x(d.baseId,a),p=a===d.value,v=(0,n.useRef)(p);return(0,n.useEffect)(()=>{let e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,n.createElement)(c.z,{present:l||p},({present:r})=>(0,n.createElement)(u.WV.div,(0,o.Z)({"data-state":p?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!r,id:f,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:v.current?"0s":void 0}}),r&&i))});function R(e,t){return`${e}-trigger-${t}`}function x(e,t){return`${e}-content-${t}`}var M=r(38460),T=r(13384);M.C,M.C;var _=r(19594),S=r(66188);let k=n.forwardRef((e,t)=>{let{className:r,...o}=(0,_.y)(e,S.E);return n.createElement(y,{...o,ref:t,className:a("rt-TabsRoot",r)})});k.displayName="Tabs.Root";let D=n.forwardRef((e,t)=>{let{className:r,color:o,...l}=(0,_.y)(e,T.U,S.E);return n.createElement(w,{"data-accent-color":o,...l,asChild:!1,ref:t,className:a("rt-BaseTabList","rt-TabsList",r)})});D.displayName="Tabs.List";let P=n.forwardRef((e,t)=>{let{className:r,children:o,...l}=e;return n.createElement(b,{...l,asChild:!1,ref:t,className:a("rt-reset","rt-BaseTabListTrigger","rt-TabsTrigger",r)},n.createElement("span",{className:"rt-BaseTabListTriggerInner rt-TabsTriggerInner"},o),n.createElement("span",{className:"rt-BaseTabListTriggerInnerHidden rt-TabsTriggerInnerHidden"},o))});P.displayName="Tabs.Trigger";let I=n.forwardRef((e,t)=>{let{className:r,...o}=(0,_.y)(e,S.E);return n.createElement(N,{...o,ref:t,className:a("rt-TabsContent",r)})});I.displayName="Tabs.Content"},36982:function(e,t,r){"use strict";r.r(t),r.d(t,{Root:function(){return p},Slot:function(){return v}});var n=r(2265),a=r(56800),o=r(1584),l=r(17534),i=r(11379),s=r(66176),c=r(20611);let u={size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["classic","surface","soft"],default:"surface"},...l.EG,...s.I},d={side:{type:"enum",values:["left","right"]},...l.EG,gap:c.l.gap,px:i.i.px,pl:i.i.pl,pr:i.i.pr};var m=r(19594),f=r(66188);let p=n.forwardRef((e,t)=>{let r=n.useRef(null),{children:l,className:i,color:s,radius:c,style:d,...p}=(0,m.y)(e,u,f.E);return n.createElement("div",{"data-accent-color":s,"data-radius":c,style:d,className:a("rt-TextFieldRoot",i),onPointerDown:e=>{let t=e.target;if(t.closest("input, button, a"))return;let n=r.current;if(!n)return;let a=t.closest("\n .rt-TextFieldSlot[data-side='right'],\n .rt-TextFieldSlot:not([data-side='right']) ~ .rt-TextFieldSlot:not([data-side='left'])\n ")?n.value.length:0;requestAnimationFrame(()=>{try{n.setSelectionRange(a,a)}catch(e){}n.focus()})}},n.createElement("input",{spellCheck:"false",...p,ref:(0,o.F)(r,t),className:"rt-reset rt-TextFieldInput"}),l)});p.displayName="TextField.Root";let v=n.forwardRef((e,t)=>{let{className:r,color:o,side:l,...i}=(0,m.y)(e,d);return n.createElement("div",{"data-accent-color":o,"data-side":l,...i,ref:t,className:a("rt-TextFieldSlot",r)})});v.displayName="TextField.Slot"},19078:function(e,t,r){"use strict";r.d(t,{x:function(){return c}});var n=r(2265),a=r(56800),o=r(71538),l=r(19594),i=r(66188),s=r(17408);let c=n.forwardRef((e,t)=>{let{children:r,className:c,asChild:u,as:d="span",color:m,...f}=(0,l.y)(e,s.S,i.E);return n.createElement(o.g7,{"data-accent-color":m,...f,ref:t,className:a("rt-Text",c)},u?r:n.createElement(d,null,r))});c.displayName="Text"},17408:function(e,t,r){"use strict";r.d(t,{S:function(){return d}});var n=r(38460),a=r(17534),o=r(75073),l=r(76148),i=r(16532),s=r(91279),c=r(58489),u=r(53773);let d={as:{type:"enum",values:["span","div","label","p"],default:"span"},...n.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3","4","5","6","7","8","9"],responsive:!0},...u.x,...i.O,...l.E,...c.w,...s.u,...a.EG,...o.K}},90448:function(e,t,r){"use strict";r.r(t),r.d(t,{ThemePanel:function(){return c}});var n=r(2265),a=r(75137),o=r(34270),l=r(29340),i=r(37033),s=r(95204);let c=n.forwardRef((e,t)=>{let{defaultOpen:r=!0,...a}=e,[o,l]=n.useState(r);return n.createElement(u,{...a,ref:t,open:o,onOpenChange:l})});c.displayName="ThemePanel";let u=n.forwardRef((e,t)=>{let{open:r,onOpenChange:c,onAppearanceChange:u,...m}=e,{appearance:f,onAppearanceChange:p,accentColor:v,onAccentColorChange:h,grayColor:g,onGrayColorChange:C,panelBackground:E,onPanelBackgroundChange:y,radius:w,onRadiusChange:b,scaling:N,onScalingChange:R}=(0,l.useThemeContext)(),x=void 0!==u,M=(0,a.W)(u),T=n.useCallback(e=>{let t=function(){let e=document.createElement("style");return e.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}}();if("inherit"!==f){p(e);return}x?M(e):(L(e),function(e){let t=document.documentElement,r=t.classList.contains("light-theme"),n=t.classList.contains("dark-theme"),a=t.classList.contains("light"),o=t.classList.contains("dark");(r||n)&&(t.classList.remove("light-theme","dark-theme"),t.style.colorScheme=e,t.classList.add("".concat(e,"-theme"))),(a||o)&&(t.classList.remove("light","dark"),t.style.colorScheme=e,t.classList.add(e)),r||n||a||o||(t.style.colorScheme=e,t.classList.add(e))}(e)),t()},[f,p,x,M]),_=(0,i.G)(v),S="auto"===g?_:g,[k,D]=n.useState("idle");async function P(){let e={appearance:f===s.y.appearance.default?void 0:f,accentColor:v===s.y.accentColor.default?void 0:v,grayColor:g===s.y.grayColor.default?void 0:g,panelBackground:E===s.y.panelBackground.default?void 0:E,radius:w===s.y.radius.default?void 0:w,scaling:N===s.y.scaling.default?void 0:N},t=Object.keys(e).filter(t=>void 0!==e[t]).map(t=>"".concat(t,'="').concat(e[t],'"')).join(" ");D("copying"),await navigator.clipboard.writeText(t?""):""),D("copied"),setTimeout(()=>D("idle"),2e3)}let[I,L]=n.useState("inherit"===f?null:f),A='\n [contenteditable],\n [role="combobox"],\n [role="listbox"],\n [role="menu"],\n input:not([type="radio"], [type="checkbox"]),\n select,\n textarea\n ';return n.useEffect(()=>{function e(e){var t,n;let a=e.altKey||e.ctrlKey||e.shiftKey||e.metaKey,o=null===(t=document.activeElement)||void 0===t?void 0:t.closest(A);(null===(n=e.key)||void 0===n?void 0:n.toUpperCase())!=="T"||a||o||c(!r)}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[c,r,A]),n.useEffect(()=>{function e(e){var t,r;let n=e.altKey||e.ctrlKey||e.shiftKey||e.metaKey,a=null===(t=document.activeElement)||void 0===t?void 0:t.closest(A);(null===(r=e.key)||void 0===r?void 0:r.toUpperCase())!=="D"||n||a||T("light"===I?"dark":"light")}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[T,I,A]),n.useEffect(()=>{let e=document.documentElement,t=document.body;function r(){let r=e.classList.contains("dark")||e.classList.contains("dark-theme")||t.classList.contains("dark")||t.classList.contains("dark-theme");L("inherit"===f?r?"dark":"light":f)}let n=new MutationObserver(function(e){e.forEach(function(e){"class"===e.attributeName&&r()})});return r(),"inherit"===f&&(n.observe(e,{attributes:!0}),n.observe(t,{attributes:!0})),()=>n.disconnect()},[f]),n.createElement(l.Theme,{asChild:!0,radius:"medium",scaling:"100%"},n.createElement(o.kC,{direction:"column",position:"fixed",top:"0",right:"0",mr:"4",mt:"4",inert:r?void 0:"",...m,ref:t,style:{zIndex:9999,overflow:"hidden",maxHeight:"calc(100vh - var(--space-4) - var(--space-4))",borderRadius:"var(--radius-4)",backgroundColor:"var(--color-panel-solid)",transformOrigin:"top center",transitionProperty:"transform, box-shadow",transitionDuration:"200ms",transitionTimingFunction:r?"ease-out":"ease-in",transform:r?"none":"translateX(105%)",boxShadow:r?"var(--shadow-5)":"var(--shadow-2)",...e.style}},n.createElement(o.xr,null,n.createElement(o.xu,{flexGrow:"1",p:"5",position:"relative"},n.createElement(o.xu,{position:"absolute",top:"0",right:"0",m:"2"},n.createElement(o.u,{content:"Press T to show/hide the Theme Panel",side:"bottom",sideOffset:6},n.createElement(o.Tz,{asChild:!0,size:"3",tabIndex:0,className:"rt-ThemePanelShortcut"},n.createElement("button",{onClick:()=>c(!r)},"T")))),n.createElement(o.X6,{size:"5",trim:"both",as:"h3",mb:"5"},"Theme"),n.createElement(o.xv,{id:"accent-color-title",as:"p",size:"2",weight:"medium",mt:"5"},"Accent color"),n.createElement(o.rj,{columns:"10",gap:"2",mt:"3",role:"group","aria-labelledby":"accent-color-title"},s.y.accentColor.values.map(e=>n.createElement("label",{key:e,className:"rt-ThemePanelSwatch",style:{backgroundColor:"var(--".concat(e,"-9)")}},n.createElement(o.u,{content:"".concat(d(e)).concat("gray"===v&&"gray"!==S?" (".concat(d(S),")"):"")},n.createElement("input",{className:"rt-ThemePanelSwatchInput",type:"radio",name:"accentColor",value:e,checked:v===e,onChange:e=>h(e.target.value)}))))),n.createElement(o.kC,{asChild:!0,align:"center",justify:"between"},n.createElement(o.xv,{as:"p",id:"gray-color-title",size:"2",weight:"medium",mt:"5"},"Gray color")),n.createElement(o.rj,{columns:"10",gap:"2",mt:"3",role:"group","aria-labelledby":"gray-color-title"},s.y.grayColor.values.map(e=>n.createElement(o.kC,{key:e,asChild:!0,align:"center",justify:"center"},n.createElement("label",{className:"rt-ThemePanelSwatch",style:{backgroundColor:"auto"===e?"var(--".concat(_,"-9)"):"gray"===e?"var(--gray-9)":"var(--".concat(e,"-9)"),filter:"gray"===e?"saturate(0)":void 0}},n.createElement(o.u,{content:"".concat(d(e)).concat("auto"===e?" (".concat(d(_),")"):"")},n.createElement("input",{className:"rt-ThemePanelSwatchInput",type:"radio",name:"grayColor",value:e,checked:g===e,onChange:e=>C(e.target.value)})))))),n.createElement(o.xv,{id:"appearance-title",as:"p",size:"2",weight:"medium",mt:"5"},"Appearance"),n.createElement(o.rj,{columns:"2",gap:"2",mt:"3",role:"group","aria-labelledby":"appearance-title"},["light","dark"].map(e=>n.createElement("label",{key:e,className:"rt-ThemePanelRadioCard"},n.createElement("input",{className:"rt-ThemePanelRadioCardInput",type:"radio",name:"appearance",value:e,checked:I===e,onChange:e=>T(e.target.value)}),n.createElement(o.kC,{align:"center",justify:"center",height:"32px",gap:"2"},"light"===e?n.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:"0 -1px"}},n.createElement("path",{d:"M7.5 0C7.77614 0 8 0.223858 8 0.5V2.5C8 2.77614 7.77614 3 7.5 3C7.22386 3 7 2.77614 7 2.5V0.5C7 0.223858 7.22386 0 7.5 0ZM2.1967 2.1967C2.39196 2.00144 2.70854 2.00144 2.90381 2.1967L4.31802 3.61091C4.51328 3.80617 4.51328 4.12276 4.31802 4.31802C4.12276 4.51328 3.80617 4.51328 3.61091 4.31802L2.1967 2.90381C2.00144 2.70854 2.00144 2.39196 2.1967 2.1967ZM0.5 7C0.223858 7 0 7.22386 0 7.5C0 7.77614 0.223858 8 0.5 8H2.5C2.77614 8 3 7.77614 3 7.5C3 7.22386 2.77614 7 2.5 7H0.5ZM2.1967 12.8033C2.00144 12.608 2.00144 12.2915 2.1967 12.0962L3.61091 10.682C3.80617 10.4867 4.12276 10.4867 4.31802 10.682C4.51328 10.8772 4.51328 11.1938 4.31802 11.3891L2.90381 12.8033C2.70854 12.9986 2.39196 12.9986 2.1967 12.8033ZM12.5 7C12.2239 7 12 7.22386 12 7.5C12 7.77614 12.2239 8 12.5 8H14.5C14.7761 8 15 7.77614 15 7.5C15 7.22386 14.7761 7 14.5 7H12.5ZM10.682 4.31802C10.4867 4.12276 10.4867 3.80617 10.682 3.61091L12.0962 2.1967C12.2915 2.00144 12.608 2.00144 12.8033 2.1967C12.9986 2.39196 12.9986 2.70854 12.8033 2.90381L11.3891 4.31802C11.1938 4.51328 10.8772 4.51328 10.682 4.31802ZM8 12.5C8 12.2239 7.77614 12 7.5 12C7.22386 12 7 12.2239 7 12.5V14.5C7 14.7761 7.22386 15 7.5 15C7.77614 15 8 14.7761 8 14.5V12.5ZM10.682 10.682C10.8772 10.4867 11.1938 10.4867 11.3891 10.682L12.8033 12.0962C12.9986 12.2915 12.9986 12.608 12.8033 12.8033C12.608 12.9986 12.2915 12.9986 12.0962 12.8033L10.682 11.3891C10.4867 11.1938 10.4867 10.8772 10.682 10.682ZM5.5 7.5C5.5 6.39543 6.39543 5.5 7.5 5.5C8.60457 5.5 9.5 6.39543 9.5 7.5C9.5 8.60457 8.60457 9.5 7.5 9.5C6.39543 9.5 5.5 8.60457 5.5 7.5ZM7.5 4.5C5.84315 4.5 4.5 5.84315 4.5 7.5C4.5 9.15685 5.84315 10.5 7.5 10.5C9.15685 10.5 10.5 9.15685 10.5 7.5C10.5 5.84315 9.15685 4.5 7.5 4.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})):n.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:"0 -1px"}},n.createElement("path",{d:"M2.89998 0.499976C2.89998 0.279062 2.72089 0.0999756 2.49998 0.0999756C2.27906 0.0999756 2.09998 0.279062 2.09998 0.499976V1.09998H1.49998C1.27906 1.09998 1.09998 1.27906 1.09998 1.49998C1.09998 1.72089 1.27906 1.89998 1.49998 1.89998H2.09998V2.49998C2.09998 2.72089 2.27906 2.89998 2.49998 2.89998C2.72089 2.89998 2.89998 2.72089 2.89998 2.49998V1.89998H3.49998C3.72089 1.89998 3.89998 1.72089 3.89998 1.49998C3.89998 1.27906 3.72089 1.09998 3.49998 1.09998H2.89998V0.499976ZM5.89998 3.49998C5.89998 3.27906 5.72089 3.09998 5.49998 3.09998C5.27906 3.09998 5.09998 3.27906 5.09998 3.49998V4.09998H4.49998C4.27906 4.09998 4.09998 4.27906 4.09998 4.49998C4.09998 4.72089 4.27906 4.89998 4.49998 4.89998H5.09998V5.49998C5.09998 5.72089 5.27906 5.89998 5.49998 5.89998C5.72089 5.89998 5.89998 5.72089 5.89998 5.49998V4.89998H6.49998C6.72089 4.89998 6.89998 4.72089 6.89998 4.49998C6.89998 4.27906 6.72089 4.09998 6.49998 4.09998H5.89998V3.49998ZM1.89998 6.49998C1.89998 6.27906 1.72089 6.09998 1.49998 6.09998C1.27906 6.09998 1.09998 6.27906 1.09998 6.49998V7.09998H0.499976C0.279062 7.09998 0.0999756 7.27906 0.0999756 7.49998C0.0999756 7.72089 0.279062 7.89998 0.499976 7.89998H1.09998V8.49998C1.09998 8.72089 1.27906 8.89997 1.49998 8.89997C1.72089 8.89997 1.89998 8.72089 1.89998 8.49998V7.89998H2.49998C2.72089 7.89998 2.89998 7.72089 2.89998 7.49998C2.89998 7.27906 2.72089 7.09998 2.49998 7.09998H1.89998V6.49998ZM8.54406 0.98184L8.24618 0.941586C8.03275 0.917676 7.90692 1.1655 8.02936 1.34194C8.17013 1.54479 8.29981 1.75592 8.41754 1.97445C8.91878 2.90485 9.20322 3.96932 9.20322 5.10022C9.20322 8.37201 6.82247 11.0878 3.69887 11.6097C3.45736 11.65 3.20988 11.6772 2.96008 11.6906C2.74563 11.702 2.62729 11.9535 2.77721 12.1072C2.84551 12.1773 2.91535 12.2458 2.98667 12.3128L3.05883 12.3795L3.31883 12.6045L3.50684 12.7532L3.62796 12.8433L3.81491 12.9742L3.99079 13.089C4.11175 13.1651 4.23536 13.2375 4.36157 13.3059L4.62496 13.4412L4.88553 13.5607L5.18837 13.6828L5.43169 13.7686C5.56564 13.8128 5.70149 13.8529 5.83857 13.8885C5.94262 13.9155 6.04767 13.9401 6.15405 13.9622C6.27993 13.9883 6.40713 14.0109 6.53544 14.0298L6.85241 14.0685L7.11934 14.0892C7.24637 14.0965 7.37436 14.1002 7.50322 14.1002C11.1483 14.1002 14.1032 11.1453 14.1032 7.50023C14.1032 7.25044 14.0893 7.00389 14.0623 6.76131L14.0255 6.48407C13.991 6.26083 13.9453 6.04129 13.8891 5.82642C13.8213 5.56709 13.7382 5.31398 13.6409 5.06881L13.5279 4.80132L13.4507 4.63542L13.3766 4.48666C13.2178 4.17773 13.0353 3.88295 12.8312 3.60423L12.6782 3.40352L12.4793 3.16432L12.3157 2.98361L12.1961 2.85951L12.0355 2.70246L11.8134 2.50184L11.4925 2.24191L11.2483 2.06498L10.9562 1.87446L10.6346 1.68894L10.3073 1.52378L10.1938 1.47176L9.95488 1.3706L9.67791 1.2669L9.42566 1.1846L9.10075 1.09489L8.83599 1.03486L8.54406 0.98184ZM10.4032 5.30023C10.4032 4.27588 10.2002 3.29829 9.83244 2.40604C11.7623 3.28995 13.1032 5.23862 13.1032 7.50023C13.1032 10.593 10.596 13.1002 7.50322 13.1002C6.63646 13.1002 5.81597 12.9036 5.08355 12.5522C6.5419 12.0941 7.81081 11.2082 8.74322 10.0416C8.87963 10.2284 9.10028 10.3497 9.34928 10.3497C9.76349 10.3497 10.0993 10.0139 10.0993 9.59971C10.0993 9.24256 9.84965 8.94373 9.51535 8.86816C9.57741 8.75165 9.63653 8.63334 9.6926 8.51332C9.88358 8.63163 10.1088 8.69993 10.35 8.69993C11.0403 8.69993 11.6 8.14028 11.6 7.44993C11.6 6.75976 11.0406 6.20024 10.3505 6.19993C10.3853 5.90487 10.4032 5.60464 10.4032 5.30023Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})),n.createElement(o.xv,{size:"1",weight:"medium"},d(e)))))),n.createElement(o.xv,{id:"radius-title",as:"p",size:"2",weight:"medium",mt:"5"},"Radius"),n.createElement(o.rj,{columns:"5",gap:"2",mt:"3",role:"group","aria-labelledby":"radius-title"},s.y.radius.values.map(e=>n.createElement(o.kC,{key:e,direction:"column",align:"center"},n.createElement("label",{className:"rt-ThemePanelRadioCard"},n.createElement("input",{className:"rt-ThemePanelRadioCardInput",type:"radio",name:"radius",id:"theme-panel-radius-".concat(e),value:e,checked:w===e,onChange:e=>b(e.target.value)}),n.createElement(l.Theme,{asChild:!0,radius:e},n.createElement(o.xu,{m:"3",width:"32px",height:"32px",style:{borderTopLeftRadius:"full"===e?"80%":"var(--radius-5)",backgroundImage:"linear-gradient(to bottom right, var(--accent-3), var(--accent-4))",borderTop:"2px solid var(--accent-a8)",borderLeft:"2px solid var(--accent-a8)"}}))),n.createElement(o.xu,{asChild:!0,pt:"2"},n.createElement(o.xv,{asChild:!0,size:"1",color:"gray"},n.createElement("label",{htmlFor:"theme-panel-radius-".concat(e)},d(e))))))),n.createElement(o.xv,{id:"scaling-title",as:"p",size:"2",weight:"medium",mt:"5"},"Scaling"),n.createElement(o.rj,{columns:"5",gap:"2",mt:"3",role:"group","aria-labelledby":"scaling-title"},s.y.scaling.values.map(e=>n.createElement("label",{key:e,className:"rt-ThemePanelRadioCard"},n.createElement("input",{className:"rt-ThemePanelRadioCardInput",type:"radio",name:"scaling",value:e,checked:N===e,onChange:e=>R(e.target.value)}),n.createElement(o.kC,{align:"center",justify:"center",height:"32px"},n.createElement(l.Theme,{asChild:!0,scaling:e},n.createElement(o.kC,{align:"center",justify:"center"},n.createElement(o.xv,{size:"1",weight:"medium"},d(e)))))))),n.createElement(o.kC,{mt:"5",align:"center",gap:"2"},n.createElement(o.xv,{id:"panel-background-title",as:"p",size:"2",weight:"medium"},"Panel background"),n.createElement(o.J2.Root,null,n.createElement(o.J2.Trigger,null,n.createElement(o.hU,{size:"1",variant:"ghost",color:"gray"},n.createElement(o.CJ,{label:"Learn more about panel background options"},n.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z",fillRule:"evenodd",clipRule:"evenodd"}))))),n.createElement(o.J2.Content,{size:"1",style:{maxWidth:220},side:"top",align:"center"},n.createElement(o.xv,{as:"p",size:"2"},"Whether Card and Table panels are translucent, showing some of\xa0the background behind them.")))),n.createElement(o.rj,{columns:"2",gap:"2",mt:"3",role:"group","aria-labelledby":"panel-background-title"},s.y.panelBackground.values.map(e=>n.createElement("label",{key:e,className:"rt-ThemePanelRadioCard"},n.createElement("input",{className:"rt-ThemePanelRadioCardInput",type:"radio",name:"panelBackground",value:e,checked:E===e,onChange:e=>y(e.target.value)}),n.createElement(o.kC,{align:"center",justify:"center",height:"32px",gap:"2"},"solid"===e?n.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:"0 -2px"}},n.createElement("path",{d:"M0.877075 7.49988C0.877075 3.84219 3.84222 0.877045 7.49991 0.877045C11.1576 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1575 0.877075 7.49988ZM7.49991 1.82704C4.36689 1.82704 1.82708 4.36686 1.82708 7.49988C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49988C13.1727 4.36686 10.6329 1.82704 7.49991 1.82704Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})):n.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:"0 -2px"}},n.createElement("path",{opacity:".05",d:"M6.78296 13.376C8.73904 9.95284 8.73904 5.04719 6.78296 1.62405L7.21708 1.37598C9.261 4.95283 9.261 10.0472 7.21708 13.624L6.78296 13.376Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),n.createElement("path",{opacity:".1",d:"M7.28204 13.4775C9.23929 9.99523 9.23929 5.00475 7.28204 1.52248L7.71791 1.2775C9.76067 4.9119 9.76067 10.0881 7.71791 13.7225L7.28204 13.4775Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),n.createElement("path",{opacity:".15",d:"M7.82098 13.5064C9.72502 9.99523 9.72636 5.01411 7.82492 1.50084L8.26465 1.26285C10.2465 4.92466 10.2451 10.085 8.26052 13.7448L7.82098 13.5064Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),n.createElement("path",{opacity:".2",d:"M8.41284 13.429C10.1952 9.92842 10.1957 5.07537 8.41435 1.57402L8.85999 1.34729C10.7139 4.99113 10.7133 10.0128 8.85841 13.6559L8.41284 13.429Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),n.createElement("path",{opacity:".25",d:"M9.02441 13.2956C10.6567 9.8379 10.6586 5.17715 9.03005 1.71656L9.48245 1.50366C11.1745 5.09919 11.1726 9.91629 9.47657 13.5091L9.02441 13.2956Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),n.createElement("path",{opacity:".3",d:"M9.66809 13.0655C11.1097 9.69572 11.1107 5.3121 9.67088 1.94095L10.1307 1.74457C11.6241 5.24121 11.6231 9.76683 10.1278 13.2622L9.66809 13.0655Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),n.createElement("path",{opacity:".35",d:"M10.331 12.7456C11.5551 9.52073 11.5564 5.49103 10.3347 2.26444L10.8024 2.0874C12.0672 5.42815 12.0659 9.58394 10.7985 12.9231L10.331 12.7456Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),n.createElement("path",{opacity:".4",d:"M11.0155 12.2986C11.9938 9.29744 11.9948 5.71296 11.0184 2.71067L11.4939 2.55603C12.503 5.6589 12.502 9.35178 11.4909 12.4535L11.0155 12.2986Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),n.createElement("path",{opacity:".45",d:"M11.7214 11.668C12.4254 9.01303 12.4262 5.99691 11.7237 3.34116L12.2071 3.21329C12.9318 5.95292 12.931 9.05728 12.2047 11.7961L11.7214 11.668Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),n.createElement("path",{opacity:".5",d:"M12.4432 10.752C12.8524 8.63762 12.8523 6.36089 12.4429 4.2466L12.9338 4.15155C13.3553 6.32861 13.3554 8.66985 12.9341 10.847L12.4432 10.752Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),n.createElement("path",{d:"M0.877075 7.49988C0.877075 3.84219 3.84222 0.877045 7.49991 0.877045C11.1576 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1575 0.877075 7.49988ZM7.49991 1.82704C4.36689 1.82704 1.82708 4.36686 1.82708 7.49988C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49988C13.1727 4.36686 10.6329 1.82704 7.49991 1.82704Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})),n.createElement(o.xv,{size:"1",weight:"medium"},d(e)))))),n.createElement(o.zx,{mt:"5",style:{width:"100%"},onClick:P},"copied"===k?"Copied":"Copy Theme")))))});function d(e){return e.charAt(0).toUpperCase()+e.slice(1)}u.displayName="ThemePanelImpl"},29340:function(e,t,r){"use strict";r.r(t),r.d(t,{Theme:function(){return f},useThemeContext:function(){return m}});var n=r(2265),a=r(56800),o=r(27071),l=r(87513),i=r(71538),s=r(37033),c=r(95204);let u=()=>{},d=n.createContext(void 0);function m(){let e=n.useContext(d);if(void 0===e)throw Error("`useThemeContext` must be used within a `Theme`");return e}let f=n.forwardRef((e,t)=>void 0===n.useContext(d)?n.createElement(o.zt,{delayDuration:200},n.createElement(l._9,{dir:"ltr"},n.createElement(p,{...e,ref:t}))):n.createElement(v,{...e,ref:t}));f.displayName="Theme";let p=n.forwardRef((e,t)=>{let{appearance:r=c.y.appearance.default,accentColor:a=c.y.accentColor.default,grayColor:o=c.y.grayColor.default,panelBackground:l=c.y.panelBackground.default,radius:i=c.y.radius.default,scaling:s=c.y.scaling.default,hasBackground:u=c.y.hasBackground.default,...d}=e,[m,f]=n.useState(r);n.useEffect(()=>f(r),[r]);let[p,h]=n.useState(a);n.useEffect(()=>h(a),[a]);let[g,C]=n.useState(o);n.useEffect(()=>C(o),[o]);let[E,y]=n.useState(l);n.useEffect(()=>y(l),[l]);let[w,b]=n.useState(i);n.useEffect(()=>b(i),[i]);let[N,R]=n.useState(s);return n.useEffect(()=>R(s),[s]),n.createElement(v,{...d,ref:t,isRoot:!0,hasBackground:u,appearance:m,accentColor:p,grayColor:g,panelBackground:E,radius:w,scaling:N,onAppearanceChange:f,onAccentColorChange:h,onGrayColorChange:C,onPanelBackgroundChange:y,onRadiusChange:b,onScalingChange:R})});p.displayName="ThemeRoot";let v=n.forwardRef((e,t)=>{var r,o,l,m,f,p;let v=n.useContext(d),{asChild:h,isRoot:g,hasBackground:C,appearance:E=null!==(r=null==v?void 0:v.appearance)&&void 0!==r?r:c.y.appearance.default,accentColor:y=null!==(o=null==v?void 0:v.accentColor)&&void 0!==o?o:c.y.accentColor.default,grayColor:w=null!==(l=null==v?void 0:v.resolvedGrayColor)&&void 0!==l?l:c.y.grayColor.default,panelBackground:b=null!==(m=null==v?void 0:v.panelBackground)&&void 0!==m?m:c.y.panelBackground.default,radius:N=null!==(f=null==v?void 0:v.radius)&&void 0!==f?f:c.y.radius.default,scaling:R=null!==(p=null==v?void 0:v.scaling)&&void 0!==p?p:c.y.scaling.default,onAppearanceChange:x=u,onAccentColorChange:M=u,onGrayColorChange:T=u,onPanelBackgroundChange:_=u,onRadiusChange:S=u,onScalingChange:k=u,...D}=e,P=h?i.g7:"div",I="auto"===w?(0,s.G)(y):w,L="light"===e.appearance||"dark"===e.appearance;return n.createElement(d.Provider,{value:n.useMemo(()=>({appearance:E,accentColor:y,grayColor:w,resolvedGrayColor:I,panelBackground:b,radius:N,scaling:R,onAppearanceChange:x,onAccentColorChange:M,onGrayColorChange:T,onPanelBackgroundChange:_,onRadiusChange:S,onScalingChange:k}),[E,y,w,I,b,N,R,x,M,T,_,S,k])},n.createElement(P,{"data-is-root-theme":g?"true":"false","data-accent-color":y,"data-gray-color":I,"data-has-background":(void 0===C?g||L:C)?"true":"false","data-panel-background":b,"data-radius":N,"data-scaling":R,ref:t,...D,className:a("radix-themes",{light:"light"===E,dark:"dark"===E},D.className)}))});v.displayName="ThemeImpl"},95204:function(e,t,r){"use strict";r.d(t,{y:function(){return l}});var n=r(38460),a=r(17534),o=r(66176);let l={...n.C,hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:["inherit","light","dark"],default:"inherit"},accentColor:{type:"enum",values:a.FN,default:"indigo"},grayColor:{type:"enum",values:a.ab,default:"auto"},panelBackground:{type:"enum",values:["solid","translucent"],default:"translucent"},radius:{type:"enum",values:o.p,default:"medium"},scaling:{type:"enum",values:["90%","95%","100%","105%","110%"],default:"100%"}}},16823:function(e,t,r){"use strict";r.r(t),r.d(t,{Tooltip:function(){return d}});var n=r(2265),a=r(56800),o=r(27071),l=r(19078),i=r(29340),s=r(19594),c=r(74577);let u={content:{type:"ReactNode",required:!0},width:c.n.width,minWidth:c.n.minWidth,maxWidth:{...c.n.maxWidth,default:"360px"}},d=n.forwardRef((e,t)=>{let{children:r,className:c,open:d,defaultOpen:m,onOpenChange:f,delayDuration:p,disableHoverableContent:v,content:h,container:g,forceMount:C,...E}=(0,s.y)(e,u);return n.createElement(o.fC,{open:d,defaultOpen:m,onOpenChange:f,delayDuration:p,disableHoverableContent:v},n.createElement(o.xz,{asChild:!0},r),n.createElement(o.h_,{container:g,forceMount:C},n.createElement(i.Theme,{asChild:!0},n.createElement(o.VY,{sideOffset:4,collisionPadding:10,...E,asChild:!1,ref:t,className:a("rt-TooltipContent",c)},n.createElement(l.x,{as:"p",className:"rt-TooltipText",size:"1"},h),n.createElement(o.Eh,{className:"rt-TooltipArrow"})))))});d.displayName="Tooltip"},19594:function(e,t,r){"use strict";r.d(t,{y:function(){return i}});var n=r(56800),a=r(28978),o=r(37910),l=r(36291);function i(e,...t){let r,s;let c={...e},u=function(...e){return Object.assign({},...e)}(...t);for(let e in u){let t=c[e],i=u[e];if(void 0!==i.default&&void 0===t&&(t=i.default),"enum"!==i.type||[i.default,...i.values].includes(t)||(0,o.d)(t)||(t=i.default),c[e]=t,"className"in i&&i.className){delete c[e];let u="responsive"in i;if(!t||(0,o.d)(t)&&!u)continue;if((0,o.d)(t)&&(void 0!==i.default&&void 0===t.initial&&(t.initial=i.default),"enum"===i.type&&([i.default,...i.values].includes(t.initial)||(t.initial=i.default))),"enum"===i.type){r=n(r,(0,a.RE)({allowArbitraryValues:!1,value:t,className:i.className,propValues:i.values,parseValue:i.parseValue}));continue}if("string"===i.type||"enum | string"===i.type){let e="string"===i.type?[]:i.values,[o,c]=(0,a.uq)({className:i.className,customProperties:i.customProperties,propValues:e,parseValue:i.parseValue,value:t});s=(0,l.y)(s,c),r=n(r,o);continue}if("boolean"===i.type&&t){r=n(r,i.className);continue}}}return c.className=n(r,e.className),c.style=(0,l.y)(s,e.style),c}},37033:function(e,t,r){"use strict";function n(e){switch(e){case"tomato":case"red":case"ruby":case"crimson":case"pink":case"plum":case"purple":case"violet":return"mauve";case"iris":case"indigo":case"blue":case"sky":case"cyan":return"slate";case"teal":case"jade":case"mint":case"green":return"sage";case"grass":case"lime":return"olive";case"yellow":case"amber":case"orange":case"brown":case"gold":case"bronze":return"sand";case"gray":return"gray"}}r.d(t,{G:function(){return n}})},28978:function(e,t,r){"use strict";r.d(t,{RE:function(){return i},uq:function(){return l}});var n=r(57770);function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var o=r(37910);function l({className:e,customProperties:t,...r}){return[i({allowArbitraryValues:!0,className:e,...r}),function({customProperties:e,value:t,propValues:r,parseValue:l=e=>e}){let i={};if(!(!t||"string"==typeof t&&r.includes(t))){if("string"==typeof t&&(i=Object.fromEntries(e.map(e=>[e,t]))),(0,o.d)(t))for(let o in t){if(!a(t,o)||!n.A.includes(o))continue;let l=t[o];if(!r.includes(l))for(let t of e)i={["initial"===o?t:`${t}-${o}`]:l,...i}}for(let e in i){let t=i[e];void 0!==t&&(i[e]=l(t))}return i}}({customProperties:t,...r})]}function i({allowArbitraryValues:e,value:t,className:r,propValues:l,parseValue:i=e=>e}){let c=[];if(t){if("string"==typeof t&&l.includes(t))return s(r,t,i);if((0,o.d)(t)){for(let o in t){if(!a(t,o)||!n.A.includes(o))continue;let u=t[o];if(void 0!==u){if(l.includes(u)){let e=s(r,u,i),t="initial"===o?e:`${o}:${e}`;c.push(t)}else if(e){let e="initial"===o?r:`${o}:${r}`;c.push(e)}}}return c.join(" ")}if(e)return r}}function s(e,t,r){let n=r(t),a=n?.startsWith("-"),o=a?n?.substring(1):n;return`${a?"-":""}${e}${e?"-":""}${o}`}},81271:function(e,t,r){"use strict";r.d(t,{x:function(){return a}});var n=r(2265);function a(e,t){let{asChild:r,children:a}=e;if(!r)return"function"==typeof t?t(a):t;let o=n.Children.only(a);return n.cloneElement(o,{children:"function"==typeof t?t(o.props.children):t})}},37910:function(e,t,r){"use strict";r.d(t,{d:function(){return a}});var n=r(57770);function a(e){return"object"==typeof e&&Object.keys(e).some(e=>n.A.includes(e))}},6717:function(e,t,r){"use strict";function n(e,t){if(void 0!==e)return"string"==typeof e?t(e):Object.fromEntries(Object.entries(e).map(([e,r])=>[e,t(r)]))}function a(e){return"3"===e?"3":"2"}function o(e){switch(e){case"1":return"1";case"2":case"3":return"2";case"4":return"3"}}r.d(t,{AG:function(){return o},qz:function(){return n},uJ:function(){return a}}),r(58022),r(31861),r(82709),r(17408)},36291:function(e,t,r){"use strict";function n(...e){let t={};for(let r of e)r&&(t={...t,...r});return Object.keys(t).length?t:void 0}r.d(t,{y:function(){return n}})},9766:function(e,t,r){"use strict";r.d(t,{O:function(){return a}});var n=r(2265);let a=e=>{if(!n.isValidElement(e))throw Error(`Expected a single React Element child, but got: ${n.Children.toArray(e).map(e=>"object"==typeof e&&"type"in e&&"string"==typeof e.type?e.type:typeof e).join(", ")}`);return e}},34270:function(e,t,r){"use strict";r.d(t,{CJ:function(){return a.AccessibleIcon},Ct:function(){return v},xu:function(){return b},zx:function(){return D},Zb:function(){return I},cO:function(){return L},W2:function(){return F},FR:function(){return n},Vq:function(){return Y},kC:function(){return x},rj:function(){return $.r},X6:function(){return J.X},hU:function(){return Q},Tz:function(){return ea},rU:function(){return el},J2:function(){return ei},Ex:function(){return es.Progress},xr:function(){return ed.ScrollArea},Ph:function(){return ef},Z0:function(){return ep.Separator},$j:function(){return T},rs:function(){return eg.Switch},mQ:function(){return eN},xv:function(){return h.x},nv:function(){return ex},u:function(){return eM.Tooltip}});var n={};r.r(n),r.d(n,{ck:function(){return U},__:function(){return j},fC:function(){return K},B4:function(){return X}});var a=r(91048);r(16502),r(38507);var o=r(2265),l=r(56800),i=r(71538),s=r(38460),c=r(17534),u=r(75073),d=r(66176);let m={...s.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"1",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["solid","soft","surface","outline"],default:"soft"},...c.o3,...u.K,...d.I};var f=r(19594),p=r(66188);let v=o.forwardRef((e,t)=>{let{asChild:r,className:n,color:a,radius:s,...c}=(0,f.y)(e,m,p.E);return o.createElement(r?i.g7:"span",{"data-accent-color":a,"data-radius":s,...c,ref:t,className:l("rt-reset","rt-Badge",n)})});v.displayName="Badge";var h=r(19078),g=r(91279),C=r(58489),E=r(53773);s.C,E.x,c.EG,u.K,C.w,g.u,o.forwardRef((e,t)=>{let{asChild:r,children:n,className:a,...s}=e,c=r?i.g7:"blockquote";return o.createElement(h.x,{asChild:!0,...s,ref:t,className:l("rt-Blockquote",a)},o.createElement(c,null,n))}).displayName="Blockquote";let y={as:{type:"enum",values:["div","span"],default:"div"},...s.C,display:{type:"enum",className:"rt-r-display",values:["none","inline","inline-block","block"],responsive:!0}};var w=r(85706);let b=o.forwardRef((e,t)=>{let{className:r,asChild:n,as:a="div",...s}=(0,f.y)(e,y,w.P,p.E);return o.createElement(n?i.g7:a,{...s,ref:t,className:l("rt-Box",r)})});b.displayName="Box";var N=r(58022),R=r(20611);let x=o.forwardRef((e,t)=>{let{className:r,asChild:n,as:a="div",...s}=(0,f.y)(e,R.l,w.P,p.E);return o.createElement(n?i.g7:a,{...s,ref:t,className:l("rt-Flex",r)})});x.displayName="Flex";var M=r(82709);let T=o.forwardRef((e,t)=>{let{className:r,children:n,loading:a,...i}=(0,f.y)(e,M.Z,p.E);if(!a)return n;let s=o.createElement("span",{...i,ref:t,className:l("rt-Spinner",r)},o.createElement("span",{className:"rt-SpinnerLeaf"}),o.createElement("span",{className:"rt-SpinnerLeaf"}),o.createElement("span",{className:"rt-SpinnerLeaf"}),o.createElement("span",{className:"rt-SpinnerLeaf"}),o.createElement("span",{className:"rt-SpinnerLeaf"}),o.createElement("span",{className:"rt-SpinnerLeaf"}),o.createElement("span",{className:"rt-SpinnerLeaf"}),o.createElement("span",{className:"rt-SpinnerLeaf"}));return void 0===n?s:o.createElement(x,{asChild:!0,position:"relative",align:"center",justify:"center"},o.createElement("span",null,o.createElement("span",{"aria-hidden":!0,style:{display:"contents",visibility:"hidden"},inert:""},n),o.createElement(x,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},o.createElement("span",null,s))))});T.displayName="Spinner";var _=r(31725),S=r(6717);let k=o.forwardRef((e,t)=>{let{size:r=N.C.size.default}=e,{className:n,children:a,asChild:s,color:c,radius:u,disabled:d=e.loading,...m}=(0,f.y)(e,N.C,p.E);return o.createElement(s?i.g7:"button",{"data-disabled":d||void 0,"data-accent-color":c,"data-radius":u,...m,ref:t,className:l("rt-reset","rt-BaseButton",n),disabled:d},e.loading?o.createElement(o.Fragment,null,o.createElement("span",{style:{display:"contents",visibility:"hidden"},"aria-hidden":!0},a),o.createElement(_.T,null,a),o.createElement(x,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},o.createElement("span",null,o.createElement(T,{size:(0,S.qz)(r,S.AG)})))):a)});k.displayName="BaseButton";let D=o.forwardRef(({className:e,...t},r)=>o.createElement(k,{...t,ref:r,className:l("rt-Button",e)}));D.displayName="Button",r(44581);let P={...s.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3","4","5"],default:"1",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["surface","classic","ghost"],default:"surface"}},I=o.forwardRef((e,t)=>{let{asChild:r,className:n,...a}=(0,f.y)(e,P,p.E);return o.createElement(r?i.g7:"div",{ref:t,...a,className:l("rt-reset","rt-BaseCard","rt-Card",n)})});I.displayName="Card",r(36756);var L=r(76895);r(2738);let A={...s.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3","4","5","6","7","8","9"],responsive:!0},variant:{type:"enum",className:"rt-variant",values:["solid","soft","outline","ghost"],default:"soft"},...E.x,...c.o3,...u.K,...C.w,...g.u};o.forwardRef((e,t)=>{let{asChild:r,className:n,color:a,...s}=(0,f.y)(e,A,p.E),c="ghost"===e.variant?a||void 0:a;return o.createElement(r?i.g7:"code",{"data-accent-color":c,...s,ref:t,className:l("rt-reset","rt-Code",n)})}).displayName="Code";let z={...s.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3","4"],default:"4",responsive:!0},display:{type:"enum",className:"rt-r-display",values:["none","initial"],parseValue:function(e){return"initial"===e?"flex":e},responsive:!0},align:{type:"enum",className:"rt-r-ai",values:["left","center","right"],parseValue:function(e){return"left"===e?"start":"right"===e?"end":e},responsive:!0}};var O=r(81271),Z=r(64791),V=r(74577);let F=o.forwardRef(({width:e,minWidth:t,maxWidth:r,height:n,minHeight:a,maxHeight:s,...c},u)=>{let{asChild:d,children:m,className:v,...h}=(0,f.y)(c,z,w.P,p.E),{className:g,style:C}=(0,f.y)({width:e,minWidth:t,maxWidth:r,height:n,minHeight:a,maxHeight:s},V.n,Z.F);return o.createElement(d?i.g7:"div",{...h,ref:u,className:l("rt-Container",v)},(0,O.x)({asChild:d,children:m},e=>o.createElement("div",{className:l("rt-ContainerInner",g),style:C},e)))});F.displayName="Container",r(23195);var B=r(76148);let W={orientation:{type:"enum",className:"rt-r-orientation",values:["horizontal","vertical"],default:"horizontal",responsive:!0},size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},trim:{...B.E.trim,className:"rt-r-trim"}},G={align:{type:"enum",className:"rt-r-ai",values:["start","center","end","baseline","stretch"],responsive:!0}},H={...V.n,...c.EG,...u.K},K=o.forwardRef((e,t)=>{let{className:r,...n}=(0,f.y)(e,W,p.E);return o.createElement(h.x,{asChild:!0},o.createElement("dl",{...n,ref:t,className:l("rt-DataListRoot",r)}))});K.displayName="DataList.Root";let U=o.forwardRef((e,t)=>{let{className:r,...n}=(0,f.y)(e,G);return o.createElement("div",{...n,ref:t,className:l("rt-DataListItem",r)})});U.displayName="DataList.Item";let j=o.forwardRef((e,t)=>{let{className:r,color:n,...a}=(0,f.y)(e,H);return o.createElement("dt",{...a,"data-accent-color":n,ref:t,className:l("rt-DataListLabel",r)})});j.displayName="DataList.Label";let X=o.forwardRef(({children:e,className:t,...r},n)=>o.createElement("dd",{...r,ref:n,className:l(t,"rt-DataListValue")},e));X.displayName="DataList.Value";var Y=r(17584);r(62187);let q={...s.C,...C.w,...g.u};o.forwardRef((e,t)=>{let{asChild:r,className:n,...a}=(0,f.y)(e,q);return o.createElement(r?i.g7:"em",{...a,ref:t,className:l("rt-Em",n)})}).displayName="Em";var $=r(61395),J=r(68890);r(16808);let Q=o.forwardRef(({className:e,...t},r)=>o.createElement(k,{...t,ref:r,className:l("rt-IconButton",e)}));Q.displayName="IconButton",r(52777);let ee=["current","0"],et={...s.C,side:{type:"enum",className:"rt-r-side",values:["all","x","y","top","bottom","left","right"],default:"all",responsive:!0},clip:{type:"enum",className:"rt-r-clip",values:["border-box","padding-box"],default:"border-box",responsive:!0},p:{type:"enum",className:"rt-r-p",values:ee,parseValue:er,responsive:!0},px:{type:"enum",className:"rt-r-px",values:ee,parseValue:er,responsive:!0},py:{type:"enum",className:"rt-r-py",values:ee,parseValue:er,responsive:!0},pt:{type:"enum",className:"rt-r-pt",values:ee,parseValue:er,responsive:!0},pr:{type:"enum",className:"rt-r-pr",values:ee,parseValue:er,responsive:!0},pb:{type:"enum",className:"rt-r-pb",values:ee,parseValue:er,responsive:!0},pl:{type:"enum",className:"rt-r-pl",values:ee,parseValue:er,responsive:!0}};function er(e){return"current"===e?"inset":e}o.forwardRef((e,t)=>{let{asChild:r,className:n,...a}=(0,f.y)(e,et,p.E);return o.createElement(r?i.g7:"div",{...a,ref:t,className:l("rt-Inset",n)})}).displayName="Inset";let en={...s.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3","4","5","6","7","8","9"],responsive:!0}},ea=o.forwardRef((e,t)=>{let{asChild:r,className:n,...a}=(0,f.y)(e,en,p.E);return o.createElement(r?i.g7:"kbd",{...a,ref:t,className:l("rt-reset","rt-Kbd",n)})});ea.displayName="Kbd";let eo={...s.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3","4","5","6","7","8","9"],responsive:!0},...E.x,...B.E,...C.w,...g.u,underline:{type:"enum",className:"rt-underline",values:["auto","always","hover","none"],default:"auto"},...c.o3,...u.K},el=o.forwardRef((e,t)=>{let{children:r,className:n,color:a,asChild:i,...s}=(0,f.y)(e,eo);return o.createElement(h.x,{...s,"data-accent-color":a,ref:t,asChild:!0,className:l("rt-reset","rt-Link",n)},i?r:o.createElement("a",null,r))});el.displayName="Link";var ei=r(84285),es=r(37654);let ec={...s.C,...C.w,...g.u};o.forwardRef((e,t)=>{let{asChild:r,className:n,...a}=(0,f.y)(e,ec);return o.createElement(r?i.g7:"q",{...a,ref:t,className:l("rt-Quote",n)})}).displayName="Quote",r(11416),r(76484),r(62381);var eu=r(9766);o.forwardRef(({className:e,children:t,...r},n)=>o.createElement(i.g7,{...r,ref:n,className:l("rt-reset",e)},(0,eu.O)(t))).displayName="Reset";var ed=r(19829);r(90393);let em={...s.C,size:{type:"enum",className:"rt-r-size",values:["1","2","3","4"],default:"3",responsive:!0},display:{type:"enum",className:"rt-r-display",values:["none","initial"],parseValue:function(e){return"initial"===e?"block":e},responsive:!0}};o.forwardRef((e,t)=>{let{asChild:r,className:n,...a}=(0,f.y)(e,em,w.P,p.E);return o.createElement(r?i.g7:"section",{...a,ref:t,className:l("rt-Section",n)})}).displayName="Section";var ef=r(37967),ep=r(63817);let ev={loading:{type:"boolean",default:!0},...V.n,...Z.F};o.forwardRef((e,t)=>{let{children:r,className:n,loading:a,...s}=(0,f.y)(e,ev,p.E);if(!a)return r;let c=o.isValidElement(r)?i.g7:"span";return o.createElement(c,{ref:t,"aria-hidden":!0,className:l("rt-Skeleton",n),"data-inline-skeleton":!o.isValidElement(r)||void 0,tabIndex:-1,inert:"",...s},r)}).displayName="Skeleton",r(32039);let eh={...s.C,...C.w,...g.u};o.forwardRef((e,t)=>{let{asChild:r,className:n,...a}=(0,f.y)(e,eh);return o.createElement(r?i.g7:"strong",{...a,ref:t,className:l("rt-Strong",n)})}).displayName="Strong";var eg=r(15961);r(67738);var eC=r(11379);let eE={size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["surface","ghost"],default:"ghost"},layout:{type:"enum",className:"rt-r-tl",values:["auto","fixed"],responsive:!0}},ey={align:{type:"enum",className:"rt-r-va",values:["start","center","end","baseline"],parseValue:function(e){return({baseline:"baseline",start:"top",center:"middle",end:"bottom"})[e]},responsive:!0}},ew={justify:{type:"enum",className:"rt-r-ta",values:["start","center","end"],parseValue:function(e){return({start:"left",center:"center",end:"right"})[e]},responsive:!0},...V.n,...eC.i};var eb=r(28978);o.forwardRef((e,t)=>{let{layout:r,...n}=eE,{className:a,children:i,layout:s,...c}=(0,f.y)(e,n,p.E),u=(0,eb.RE)({value:s,className:eE.layout.className,propValues:eE.layout.values});return o.createElement("div",{ref:t,className:l("rt-TableRoot",a),...c},o.createElement(ed.ScrollArea,null,o.createElement("table",{className:l("rt-TableRootTable",u)},i)))}).displayName="Table.Root",o.forwardRef(({className:e,...t},r)=>o.createElement("thead",{...t,ref:r,className:l("rt-TableHeader",e)})).displayName="Table.Header",o.forwardRef(({className:e,...t},r)=>o.createElement("tbody",{...t,ref:r,className:l("rt-TableBody",e)})).displayName="Table.Body",o.forwardRef((e,t)=>{let{className:r,...n}=(0,f.y)(e,ey);return o.createElement("tr",{...n,ref:t,className:l("rt-TableRow",r)})}).displayName="Table.Row",o.forwardRef((e,t)=>{let{className:r,...n}=(0,f.y)(e,ew);return o.createElement("td",{className:l("rt-TableCell",r),ref:t,...n})}).displayName="Table.Cell",o.forwardRef((e,t)=>{let{className:r,...n}=(0,f.y)(e,ew);return o.createElement("th",{className:l("rt-TableCell","rt-TableColumnHeaderCell",r),scope:"col",ref:t,...n})}).displayName="Table.ColumnHeaderCell",o.forwardRef((e,t)=>{let{className:r,...n}=(0,f.y)(e,ew);return o.createElement("th",{className:l("rt-TableCell","rt-TableRowHeaderCell",r),scope:"row",ref:t,...n})}).displayName="Table.RowHeaderCell";var eN=r(42594);let eR={size:{type:"enum",className:"rt-r-size",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:["classic","surface","soft"],default:"surface"},resize:{type:"enum",className:"rt-r-resize",values:["none","vertical","horizontal","both"],responsive:!0},...c.EG,...d.I};o.forwardRef((e,t)=>{let{className:r,color:n,radius:a,style:i,...s}=(0,f.y)(e,eR,p.E);return o.createElement("div",{"data-accent-color":n,"data-radius":a,className:l("rt-TextAreaRoot",r),style:i},o.createElement("textarea",{className:"rt-reset rt-TextAreaInput",ref:t,...s}))}).displayName="TextArea";var ex=r(36982);r(90448),r(29340);var eM=r(16823)},38460:function(e,t,r){"use strict";r.d(t,{C:function(){return n}});let n={asChild:{type:"boolean"}}},17534:function(e,t,r){"use strict";r.d(t,{EG:function(){return o},FN:function(){return n},ab:function(){return a},o3:function(){return l}});let n=["gray","gold","bronze","brown","yellow","amber","orange","tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","lime","mint","sky"],a=["auto","gray","mauve","slate","sage","olive","sand"],o={color:{type:"enum",values:n,default:void 0}},l={color:{type:"enum",values:n,default:""}}},75232:function(e,t,r){"use strict";r.d(t,{c:function(){return a}});let n=["0","1","2","3","4","5","6","7","8","9"],a={gap:{type:"enum | string",className:"rt-r-gap",customProperties:["--gap"],values:n,responsive:!0},gapX:{type:"enum | string",className:"rt-r-cg",customProperties:["--column-gap"],values:n,responsive:!0},gapY:{type:"enum | string",className:"rt-r-rg",customProperties:["--row-gap"],values:n,responsive:!0}}},64791:function(e,t,r){"use strict";r.d(t,{F:function(){return n}});let n={height:{type:"string",className:"rt-r-h",customProperties:["--height"],responsive:!0},minHeight:{type:"string",className:"rt-r-min-h",customProperties:["--min-height"],responsive:!0},maxHeight:{type:"string",className:"rt-r-max-h",customProperties:["--max-height"],responsive:!0}}},75073:function(e,t,r){"use strict";r.d(t,{K:function(){return n}});let n={highContrast:{type:"boolean",className:"rt-high-contrast",default:void 0}}},85706:function(e,t,r){"use strict";r.d(t,{P:function(){return s}});var n=r(11379),a=r(64791),o=r(74577);let l=["visible","hidden","clip","scroll","auto"],i=["0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],s={...n.i,...o.n,...a.F,position:{type:"enum",className:"rt-r-position",values:["static","relative","absolute","fixed","sticky"],responsive:!0},inset:{type:"enum | string",className:"rt-r-inset",customProperties:["--inset"],values:i,responsive:!0},top:{type:"enum | string",className:"rt-r-top",customProperties:["--top"],values:i,responsive:!0},right:{type:"enum | string",className:"rt-r-right",customProperties:["--right"],values:i,responsive:!0},bottom:{type:"enum | string",className:"rt-r-bottom",customProperties:["--bottom"],values:i,responsive:!0},left:{type:"enum | string",className:"rt-r-left",customProperties:["--left"],values:i,responsive:!0},overflow:{type:"enum",className:"rt-r-overflow",values:l,responsive:!0},overflowX:{type:"enum",className:"rt-r-ox",values:l,responsive:!0},overflowY:{type:"enum",className:"rt-r-oy",values:l,responsive:!0},flexBasis:{type:"string",className:"rt-r-fb",customProperties:["--flex-basis"],responsive:!0},flexShrink:{type:"enum | string",className:"rt-r-fs",customProperties:["--flex-shrink"],values:["0","1"],responsive:!0},flexGrow:{type:"enum | string",className:"rt-r-fg",customProperties:["--flex-grow"],values:["0","1"],responsive:!0},gridColumn:{type:"string",className:"rt-r-gc",customProperties:["--grid-column"],responsive:!0},gridColumnStart:{type:"string",className:"rt-r-gcs",customProperties:["--grid-column-start"],responsive:!0},gridColumnEnd:{type:"string",className:"rt-r-gce",customProperties:["--grid-column-end"],responsive:!0},gridRow:{type:"string",className:"rt-r-gr",customProperties:["--grid-row"],responsive:!0},gridRowStart:{type:"string",className:"rt-r-grs",customProperties:["--grid-row-start"],responsive:!0},gridRowEnd:{type:"string",className:"rt-r-gre",customProperties:["--grid-row-end"],responsive:!0}}},76148:function(e,t,r){"use strict";r.d(t,{E:function(){return n}});let n={trim:{type:"enum",className:"rt-r-lt",values:["normal","start","end","both"],responsive:!0}}},66188:function(e,t,r){"use strict";r.d(t,{E:function(){return a}});let n=["0","1","2","3","4","5","6","7","8","9","-1","-2","-3","-4","-5","-6","-7","-8","-9"],a={m:{type:"enum | string",values:n,responsive:!0,className:"rt-r-m",customProperties:["--m"]},mx:{type:"enum | string",values:n,responsive:!0,className:"rt-r-mx",customProperties:["--ml","--mr"]},my:{type:"enum | string",values:n,responsive:!0,className:"rt-r-my",customProperties:["--mt","--mb"]},mt:{type:"enum | string",values:n,responsive:!0,className:"rt-r-mt",customProperties:["--mt"]},mr:{type:"enum | string",values:n,responsive:!0,className:"rt-r-mr",customProperties:["--mr"]},mb:{type:"enum | string",values:n,responsive:!0,className:"rt-r-mb",customProperties:["--mb"]},ml:{type:"enum | string",values:n,responsive:!0,className:"rt-r-ml",customProperties:["--ml"]}}},11379:function(e,t,r){"use strict";r.d(t,{i:function(){return a}});let n=["0","1","2","3","4","5","6","7","8","9"],a={p:{type:"enum | string",className:"rt-r-p",customProperties:["--p"],values:n,responsive:!0},px:{type:"enum | string",className:"rt-r-px",customProperties:["--pl","--pr"],values:n,responsive:!0},py:{type:"enum | string",className:"rt-r-py",customProperties:["--pt","--pb"],values:n,responsive:!0},pt:{type:"enum | string",className:"rt-r-pt",customProperties:["--pt"],values:n,responsive:!0},pr:{type:"enum | string",className:"rt-r-pr",customProperties:["--pr"],values:n,responsive:!0},pb:{type:"enum | string",className:"rt-r-pb",customProperties:["--pb"],values:n,responsive:!0},pl:{type:"enum | string",className:"rt-r-pl",customProperties:["--pl"],values:n,responsive:!0}}},57770:function(e,t,r){"use strict";r.d(t,{A:function(){return n}});let n=["initial","xs","sm","md","lg","xl"]},66176:function(e,t,r){"use strict";r.d(t,{I:function(){return a},p:function(){return n}});let n=["none","small","medium","large","full"],a={radius:{type:"enum",values:n,default:void 0}}},16532:function(e,t,r){"use strict";r.d(t,{O:function(){return n}});let n={align:{type:"enum",className:"rt-r-ta",values:["left","center","right"],responsive:!0}}},91279:function(e,t,r){"use strict";r.d(t,{u:function(){return n}});let n={wrap:{type:"enum",className:"rt-r-tw",values:["wrap","nowrap","pretty","balance"],responsive:!0}}},58489:function(e,t,r){"use strict";r.d(t,{w:function(){return n}});let n={truncate:{type:"boolean",className:"rt-truncate"}}},53773:function(e,t,r){"use strict";r.d(t,{x:function(){return n}});let n={weight:{type:"enum",className:"rt-r-weight",values:["light","regular","medium","bold"],responsive:!0}}},74577:function(e,t,r){"use strict";r.d(t,{n:function(){return n}});let n={width:{type:"string",className:"rt-r-w",customProperties:["--width"],responsive:!0},minWidth:{type:"string",className:"rt-r-min-w",customProperties:["--min-width"],responsive:!0},maxWidth:{type:"string",className:"rt-r-max-w",customProperties:["--max-width"],responsive:!0}}}}]); \ No newline at end of file diff --git a/_next/static/chunks/832-887eb6d665e26afc.js b/_next/static/chunks/832-887eb6d665e26afc.js new file mode 100644 index 0000000000000000000000000000000000000000..33e1acf5dbabfb8c857724561ce7a7a2cfb941a5 --- /dev/null +++ b/_next/static/chunks/832-887eb6d665e26afc.js @@ -0,0 +1,102 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[832],{71620:function(e,t,r){e.exports={default:r(30333),__esModule:!0}},41188:function(e,t,r){e.exports={default:r(7617),__esModule:!0}},39631:function(e,t,r){e.exports={default:r(76826),__esModule:!0}},42291:function(e,t,r){e.exports={default:r(42941),__esModule:!0}},40622:function(e,t,r){e.exports={default:r(76759),__esModule:!0}},72177:function(e,t,r){e.exports={default:r(27432),__esModule:!0}},28102:function(e,t,r){e.exports={default:r(23367),__esModule:!0}},75246:function(e,t){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}},82244:function(e,t,r){"use strict";t.__esModule=!0;var n,i=(n=r(39631))&&n.__esModule?n:{default:n};t.default=function(){function e(e,t){for(var r=0;rl;)if((s=u[l++])!=s)return!0}else for(;c>l;l++)if((e||l in u)&&u[l]===r)return e||l||0;return!e&&-1}}},55072:function(e){var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},90687:function(e){var t=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=t)},2257:function(e,t,r){var n=r(33547);e.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},26064:function(e){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},15635:function(e,t,r){e.exports=!r(35511)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},54039:function(e,t,r){var n=r(73656),i=r(9054).document,o=n(i)&&n(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},13020:function(e){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},87452:function(e,t,r){var n=r(82855),i=r(37446),o=r(51035);e.exports=function(e){var t=n(e),r=i.f;if(r)for(var a,s=r(e),u=o.f,c=0;s.length>c;)u.call(e,a=s[c++])&&t.push(a);return t}},74015:function(e,t,r){var n=r(9054),i=r(90687),o=r(2257),a=r(79751),s=r(77276),u="prototype",c=function(e,t,r){var l,f,d,h=e&c.F,p=e&c.G,m=e&c.S,y=e&c.P,b=e&c.B,v=e&c.W,g=p?i:i[t]||(i[t]={}),w=g[u],O=p?n:m?n[t]:(n[t]||{})[u];for(l in p&&(r=t),r)!((f=!h&&O&&void 0!==O[l])&&s(g,l))&&(d=f?O[l]:r[l],g[l]=p&&"function"!=typeof O[l]?r[l]:b&&f?o(d,n):v&&O[l]==d?function(e){var t=function(t,r,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,n)}return e.apply(this,arguments)};return t[u]=e[u],t}(d):y&&"function"==typeof d?o(Function.call,d):d,y&&((g.virtual||(g.virtual={}))[l]=d,e&c.R&&w&&!w[l]&&a(w,l,d)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},35511:function(e){e.exports=function(e){try{return!!e()}catch(e){return!0}}},9054:function(e){var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)},77276:function(e){var t={}.hasOwnProperty;e.exports=function(e,r){return t.call(e,r)}},79751:function(e,t,r){var n=r(1899),i=r(98070);e.exports=r(15635)?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},48484:function(e,t,r){var n=r(9054).document;e.exports=n&&n.documentElement},79597:function(e,t,r){e.exports=!r(15635)&&!r(35511)(function(){return 7!=Object.defineProperty(r(54039)("div"),"a",{get:function(){return 7}}).a})},97818:function(e,t,r){var n=r(55072);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},79102:function(e,t,r){var n=r(55072);e.exports=Array.isArray||function(e){return"Array"==n(e)}},73656:function(e){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},17213:function(e,t,r){"use strict";var n=r(62763),i=r(98070),o=r(44614),a={};r(79751)(a,r(16964)("iterator"),function(){return this}),e.exports=function(e,t,r){e.prototype=n(a,{next:i(1,r)}),o(e,t+" Iterator")}},51686:function(e,t,r){"use strict";var n=r(23e3),i=r(74015),o=r(10682),a=r(79751),s=r(38301),u=r(17213),c=r(44614),l=r(34021),f=r(16964)("iterator"),d=!([].keys&&"next"in[].keys()),h="values",p=function(){return this};e.exports=function(e,t,r,m,y,b,v){u(r,t,m);var g,w,O,S=function(e){return!d&&e in E?E[e]:function(){return new r(this,e)}},P=t+" Iterator",j=y==h,C=!1,E=e.prototype,k=E[f]||E["@@iterator"]||y&&E[y],x=k||S(y),M=y?j?S("entries"):x:void 0,A="Array"==t&&E.entries||k;if(A&&(O=l(A.call(new e)))!==Object.prototype&&O.next&&(c(O,P,!0),n||"function"==typeof O[f]||a(O,f,p)),j&&k&&k.name!==h&&(C=!0,x=function(){return k.call(this)}),(!n||v)&&(d||C||!E[f])&&a(E,f,x),s[t]=x,s[P]=p,y){if(g={values:j?x:S(h),keys:b?x:S("keys"),entries:M},v)for(w in g)w in E||o(E,w,g[w]);else i(i.P+i.F*(d||C),t,g)}return g}},69631:function(e){e.exports=function(e,t){return{value:t,done:!!e}}},38301:function(e){e.exports={}},23e3:function(e){e.exports=!0},9899:function(e,t,r){var n=r(86733)("meta"),i=r(73656),o=r(77276),a=r(1899).f,s=0,u=Object.isExtensible||function(){return!0},c=!r(35511)(function(){return u(Object.preventExtensions({}))}),l=function(e){a(e,n,{value:{i:"O"+ ++s,w:{}}})},f=e.exports={KEY:n,NEED:!1,fastKey:function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,n)){if(!u(e))return"F";if(!t)return"E";l(e)}return e[n].i},getWeak:function(e,t){if(!o(e,n)){if(!u(e))return!0;if(!t)return!1;l(e)}return e[n].w},onFreeze:function(e){return c&&f.NEED&&u(e)&&!o(e,n)&&l(e),e}}},65147:function(e,t,r){"use strict";var n=r(15635),i=r(82855),o=r(37446),a=r(51035),s=r(56784),u=r(97818),c=Object.assign;e.exports=!c||r(35511)(function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e}),7!=c({},e)[r]||Object.keys(c({},t)).join("")!=n})?function(e,t){for(var r=s(e),c=arguments.length,l=1,f=o.f,d=a.f;c>l;)for(var h,p=u(arguments[l++]),m=f?i(p).concat(f(p)):i(p),y=m.length,b=0;y>b;)h=m[b++],(!n||d.call(p,h))&&(r[h]=p[h]);return r}:c},62763:function(e,t,r){var n=r(67188),i=r(6624),o=r(13020),a=r(79740)("IE_PROTO"),s=function(){},u="prototype",c=function(){var e,t=r(54039)("iframe"),n=o.length;for(t.style.display="none",r(48484).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write(""),e.close(),c=e.F;n--;)delete c[u][o[n]];return c()};e.exports=Object.create||function(e,t){var r;return null!==e?(s[u]=n(e),r=new s,s[u]=null,r[a]=e):r=c(),void 0===t?r:i(r,t)}},1899:function(e,t,r){var n=r(67188),i=r(79597),o=r(57747),a=Object.defineProperty;t.f=r(15635)?Object.defineProperty:function(e,t,r){if(n(e),t=o(t,!0),n(r),i)try{return a(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},6624:function(e,t,r){var n=r(1899),i=r(67188),o=r(82855);e.exports=r(15635)?Object.defineProperties:function(e,t){i(e);for(var r,a=o(t),s=a.length,u=0;s>u;)n.f(e,r=a[u++],t[r]);return e}},66999:function(e,t,r){var n=r(51035),i=r(98070),o=r(7826),a=r(57747),s=r(77276),u=r(79597),c=Object.getOwnPropertyDescriptor;t.f=r(15635)?c:function(e,t){if(e=o(e),t=a(t,!0),u)try{return c(e,t)}catch(e){}if(s(e,t))return i(!n.f.call(e,t),e[t])}},8455:function(e,t,r){var n=r(7826),i=r(42057).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(e){try{return i(e)}catch(e){return a.slice()}};e.exports.f=function(e){return a&&"[object Window]"==o.call(e)?s(e):i(n(e))}},42057:function(e,t,r){var n=r(93222),i=r(13020).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},37446:function(e,t){t.f=Object.getOwnPropertySymbols},34021:function(e,t,r){var n=r(77276),i=r(56784),o=r(79740)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return n(e=i(e),o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},93222:function(e,t,r){var n=r(77276),i=r(7826),o=r(63527)(!1),a=r(79740)("IE_PROTO");e.exports=function(e,t){var r,s=i(e),u=0,c=[];for(r in s)r!=a&&n(s,r)&&c.push(r);for(;t.length>u;)n(s,r=t[u++])&&(~o(c,r)||c.push(r));return c}},82855:function(e,t,r){var n=r(93222),i=r(13020);e.exports=Object.keys||function(e){return n(e,i)}},51035:function(e,t){t.f=({}).propertyIsEnumerable},55921:function(e,t,r){var n=r(74015),i=r(90687),o=r(35511);e.exports=function(e,t){var r=(i.Object||{})[e]||Object[e],a={};a[e]=t(r),n(n.S+n.F*o(function(){r(1)}),"Object",a)}},98070:function(e){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},10682:function(e,t,r){e.exports=r(79751)},11633:function(e,t,r){var n=r(73656),i=r(67188),o=function(e,t){if(i(e),!n(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,n){try{(n=r(2257)(Function.call,r(66999).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,r){return o(e,r),t?e.__proto__=r:n(e,r),e}}({},!1):void 0),check:o}},44614:function(e,t,r){var n=r(1899).f,i=r(77276),o=r(16964)("toStringTag");e.exports=function(e,t,r){e&&!i(e=r?e:e.prototype,o)&&n(e,o,{configurable:!0,value:t})}},79740:function(e,t,r){var n=r(5035)("keys"),i=r(86733);e.exports=function(e){return n[e]||(n[e]=i(e))}},5035:function(e,t,r){var n=r(90687),i=r(9054),o="__core-js_shared__",a=i[o]||(i[o]={});(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:n.version,mode:r(23e3)?"pure":"global",copyright:"\xa9 2020 Denis Pushkarev (zloirock.ru)"})},55755:function(e,t,r){var n=r(67050),i=r(26064);e.exports=function(e){return function(t,r){var o,a,s=String(i(t)),u=n(r),c=s.length;return u<0||u>=c?e?"":void 0:(o=s.charCodeAt(u))<55296||o>56319||u+1===c||(a=s.charCodeAt(u+1))<56320||a>57343?e?s.charAt(u):o:e?s.slice(u,u+2):(o-55296<<10)+(a-56320)+65536}}},56481:function(e,t,r){var n=r(67050),i=Math.max,o=Math.min;e.exports=function(e,t){return(e=n(e))<0?i(e+t,0):o(e,t)}},67050:function(e){var t=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:t)(e)}},7826:function(e,t,r){var n=r(97818),i=r(26064);e.exports=function(e){return n(i(e))}},95065:function(e,t,r){var n=r(67050),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},56784:function(e,t,r){var n=r(26064);e.exports=function(e){return Object(n(e))}},57747:function(e,t,r){var n=r(73656);e.exports=function(e,t){var r,i;if(!n(e))return e;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e))||"function"==typeof(r=e.valueOf)&&!n(i=r.call(e))||!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},86733:function(e){var t=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++t+r).toString(36))}},95898:function(e,t,r){var n=r(9054),i=r(90687),o=r(23e3),a=r(9480),s=r(1899).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=o?{}:n.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:a.f(e)})}},9480:function(e,t,r){t.f=r(16964)},16964:function(e,t,r){var n=r(5035)("wks"),i=r(86733),o=r(9054).Symbol,a="function"==typeof o;(e.exports=function(e){return n[e]||(n[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=n},56518:function(e,t,r){"use strict";var n=r(57568),i=r(69631),o=r(38301),a=r(7826);e.exports=r(51686)(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,r):"values"==t?i(0,e[r]):i(0,[r,e[r]])},"values"),o.Arguments=o.Array,n("keys"),n("values"),n("entries")},67497:function(e,t,r){var n=r(74015);n(n.S+n.F,"Object",{assign:r(65147)})},28857:function(e,t,r){var n=r(74015);n(n.S,"Object",{create:r(62763)})},14791:function(e,t,r){var n=r(74015);n(n.S+!r(15635)*n.F,"Object",{defineProperty:r(1899).f})},80423:function(e,t,r){var n=r(56784),i=r(34021);r(55921)("getPrototypeOf",function(){return function(e){return i(n(e))}})},29857:function(e,t,r){var n=r(74015);n(n.S,"Object",{setPrototypeOf:r(11633).set})},43711:function(){},56235:function(e,t,r){"use strict";var n=r(55755)(!0);r(51686)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=n(t,r),this._i+=e.length,{value:e,done:!1})})},29557:function(e,t,r){"use strict";var n=r(9054),i=r(77276),o=r(15635),a=r(74015),s=r(10682),u=r(9899).KEY,c=r(35511),l=r(5035),f=r(44614),d=r(86733),h=r(16964),p=r(9480),m=r(95898),y=r(87452),b=r(79102),v=r(67188),g=r(73656),w=r(56784),O=r(7826),S=r(57747),P=r(98070),j=r(62763),C=r(8455),E=r(66999),k=r(37446),x=r(1899),M=r(82855),A=E.f,I=x.f,R=C.f,T=n.Symbol,D=n.JSON,_=D&&D.stringify,q="prototype",F=h("_hidden"),L=h("toPrimitive"),N={}.propertyIsEnumerable,U=l("symbol-registry"),z=l("symbols"),K=l("op-symbols"),V=Object[q],$="function"==typeof T&&!!k.f,G=n.QObject,Z=!G||!G[q]||!G[q].findChild,W=o&&c(function(){return 7!=j(I({},"a",{get:function(){return I(this,"a",{value:7}).a}})).a})?function(e,t,r){var n=A(V,t);n&&delete V[t],I(e,t,r),n&&e!==V&&I(V,t,n)}:I,H=function(e){var t=z[e]=j(T[q]);return t._k=e,t},Q=$&&"symbol"==typeof T.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof T},B=function(e,t,r){return(e===V&&B(K,t,r),v(e),t=S(t,!0),v(r),i(z,t))?(r.enumerable?(i(e,F)&&e[F][t]&&(e[F][t]=!1),r=j(r,{enumerable:P(0,!1)})):(i(e,F)||I(e,F,P(1,{})),e[F][t]=!0),W(e,t,r)):I(e,t,r)},J=function(e,t){v(e);for(var r,n=y(t=O(t)),i=0,o=n.length;o>i;)B(e,r=n[i++],t[r]);return e},X=function(e){var t=N.call(this,e=S(e,!0));return(!(this===V&&i(z,e))||!!i(K,e))&&(!(t||!i(this,e)||!i(z,e)||i(this,F)&&this[F][e])||t)},Y=function(e,t){if(e=O(e),t=S(t,!0),!(e===V&&i(z,t))||i(K,t)){var r=A(e,t);return r&&i(z,t)&&!(i(e,F)&&e[F][t])&&(r.enumerable=!0),r}},ee=function(e){for(var t,r=R(O(e)),n=[],o=0;r.length>o;)i(z,t=r[o++])||t==F||t==u||n.push(t);return n},et=function(e){for(var t,r=e===V,n=R(r?K:O(e)),o=[],a=0;n.length>a;)i(z,t=n[a++])&&(!r||i(V,t))&&o.push(z[t]);return o};$||(s((T=function(){if(this instanceof T)throw TypeError("Symbol is not a constructor!");var e=d(arguments.length>0?arguments[0]:void 0),t=function(r){this===V&&t.call(K,r),i(this,F)&&i(this[F],e)&&(this[F][e]=!1),W(this,e,P(1,r))};return o&&Z&&W(V,e,{configurable:!0,set:t}),H(e)})[q],"toString",function(){return this._k}),E.f=Y,x.f=B,r(42057).f=C.f=ee,r(51035).f=X,k.f=et,o&&!r(23e3)&&s(V,"propertyIsEnumerable",X,!0),p.f=function(e){return H(h(e))}),a(a.G+a.W+!$*a.F,{Symbol:T});for(var er="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),en=0;er.length>en;)h(er[en++]);for(var ei=M(h.store),eo=0;ei.length>eo;)m(ei[eo++]);a(a.S+!$*a.F,"Symbol",{for:function(e){return i(U,e+="")?U[e]:U[e]=T(e)},keyFor:function(e){if(!Q(e))throw TypeError(e+" is not a symbol!");for(var t in U)if(U[t]===e)return t},useSetter:function(){Z=!0},useSimple:function(){Z=!1}}),a(a.S+!$*a.F,"Object",{create:function(e,t){return void 0===t?j(e):J(j(e),t)},defineProperty:B,defineProperties:J,getOwnPropertyDescriptor:Y,getOwnPropertyNames:ee,getOwnPropertySymbols:et});var ea=c(function(){k.f(1)});a(a.S+a.F*ea,"Object",{getOwnPropertySymbols:function(e){return k.f(w(e))}}),D&&a(a.S+a.F*(!$||c(function(){var e=T();return"[null]"!=_([e])||"{}"!=_({a:e})||"{}"!=_(Object(e))})),"JSON",{stringify:function(e){for(var t,r,n=[e],i=1;arguments.length>i;)n.push(arguments[i++]);if(r=t=n[1],!(!g(t)&&void 0===e||Q(e)))return b(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!Q(t))return t}),n[1]=t,_.apply(D,n)}}),T[q][L]||r(79751)(T[q],L,T[q].valueOf),f(T,"Symbol"),f(Math,"Math",!0),f(n.JSON,"JSON",!0)},66894:function(e,t,r){r(95898)("asyncIterator")},1373:function(e,t,r){r(95898)("observable")},60076:function(e,t,r){r(56518);for(var n=r(9054),i=r(79751),o=r(38301),a=r(16964)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;ue.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:u,className:c="",children:l,iconNode:f,...d}=e;return(0,n.createElement)("svg",{ref:t,...a,width:i,height:i,stroke:r,strokeWidth:u?24*Number(s)/Number(i):s,className:o("lucide",c),...d},[...f.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(l)?l:[l]])}),u=(e,t)=>{let r=(0,n.forwardRef)((r,a)=>{let{className:u,...c}=r;return(0,n.createElement)(s,{ref:a,iconNode:t,className:o("lucide-".concat(i(e)),u),...c})});return r.displayName="".concat(e),r}},94207:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},10462:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]])},22468:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},42421:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},1282:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]])},92940:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},71935:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},6884:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},60287:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])},55182:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]])},30690:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},54817:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},64341:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]])},11240:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.379.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(78030).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},99949:function(e,t,r){"use strict";var n=r(88877);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,r,i,o,a){if(a!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return r.PropTypes=r,r}},41448:function(e,t,r){e.exports=r(99949)()},88877:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},46260:function(e,t,r){"use strict";var n=d(r(87430)),i=d(r(42291)),o=d(r(75246)),a=d(r(82244)),s=d(r(93365)),u=d(r(7607)),c=d(r(2265)),l=d(r(41448)),f=d(r(71451));function d(e){return e&&e.__esModule?e:{default:e}}var h=function(e){function t(){(0,o.default)(this,t);for(var e,r,n,a=arguments.length,u=Array(a),c=0;c(0,i.createElement)(o.WV.label,(0,n.Z)({},e,{ref:t,onMouseDown:t=>{var r;null===(r=e.onMouseDown)||void 0===r||r.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault()}})))},34939:function(e,t,r){"use strict";r.d(t,{j:function(){return o}});var n=r(49010),i=r(56298),o=new class extends n.l{#e;#t;#r;constructor(){super(),this.#r=e=>{if(!i.sk&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#e?this.#e:globalThis.document?.visibilityState!=="hidden"}}},92812:function(e,t,r){"use strict";r.d(t,{R:function(){return s},m:function(){return a}});var n=r(69948),i=r(43494),o=r(30924),a=class extends i.F{#n;#i;#o;constructor(e){super(),this.mutationId=e.mutationId,this.#i=e.mutationCache,this.#n=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#n.includes(e)||(this.#n.push(e),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#n=this.#n.filter(t=>t!==e),this.scheduleGc(),this.#i.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#n.length||("pending"===this.state.status?this.scheduleGc():this.#i.remove(this))}continue(){return this.#o?.continue()??this.execute(this.state.variables)}async execute(e){this.#o=(0,o.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#i.canRun(this)});let t="pending"===this.state.status,r=!this.#o.canStart();try{if(!t){this.#a({type:"pending",variables:e,isPaused:r}),await this.#i.config.onMutate?.(e,this);let t=await this.options.onMutate?.(e);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:r})}let n=await this.#o.start();return await this.#i.config.onSuccess?.(n,e,this.state.context,this),await this.options.onSuccess?.(n,e,this.state.context),await this.#i.config.onSettled?.(n,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(n,null,e,this.state.context),this.#a({type:"success",data:n}),n}catch(t){try{throw await this.#i.config.onError?.(t,e,this.state.context,this),await this.options.onError?.(t,e,this.state.context),await this.#i.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,t,e,this.state.context),t}finally{this.#a({type:"error",error:t})}}finally{this.#i.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.V.batch(()=>{this.#n.forEach(t=>{t.onMutationUpdate(e)}),this.#i.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},69948:function(e,t,r){"use strict";r.d(t,{V:function(){return n}});var n=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},i=e=>setTimeout(e,0),o=n=>{t?e.push(n):i(()=>{r(n)})},a=()=>{let t=e;e=[],t.length&&i(()=>{n(()=>{t.forEach(e=>{r(e)})})})};return{batch:e=>{let r;t++;try{r=e()}finally{--t||a()}return r},batchCalls:e=>(...t)=>{o(()=>{e(...t)})},schedule:o,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{i=e}}}()},49937:function(e,t,r){"use strict";r.d(t,{N:function(){return o}});var n=r(49010),i=r(56298),o=new class extends n.l{#s=!0;#t;#r;constructor(){super(),this.#r=e=>{if(!i.sk&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#s!==e&&(this.#s=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#s}}},43151:function(e,t,r){"use strict";r.d(t,{S:function(){return y}});var n=r(56298),i=r(69948),o=r(30924),a=r(43494),s=class extends a.F{#u;#c;#l;#o;#f;#d;constructor(e){super(),this.#d=!1,this.#f=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#l=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#u=e.state||function(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=this.#u,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#o?.promise}setOptions(e){this.options={...this.#f,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#l.remove(this)}setData(e,t){let r=(0,n.oE)(this.state.data,e,this.options);return this.#a({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#a({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#o?.promise;return this.#o?.cancel(e),t?t.then(n.ZT).catch(n.ZT):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#u)}isActive(){return this.observers.some(e=>!1!==e.options.enabled)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data)}isStaleByTime(e=0){return this.state.isInvalidated||void 0===this.state.data||!(0,n.Kp)(this.state.dataUpdatedAt,e)}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#o?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#o?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#l.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#o&&(this.#d?this.#o.cancel({revert:!0}):this.#o.cancelRetry()),this.scheduleGc()),this.#l.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#a({type:"invalidate"})}fetch(e,t){if("idle"!==this.state.fetchStatus){if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#o)return this.#o.continueRetry(),this.#o.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let r=new AbortController,i=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#d=!0,r.signal)})},a={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:()=>{let e=(0,n.cG)(this.options,t),r={queryKey:this.queryKey,meta:this.meta};return(i(r),this.#d=!1,this.options.persister)?this.options.persister(e,r,this):e(r)}};i(a),this.options.behavior?.onFetch(a,this),this.#c=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#a({type:"fetch",meta:a.fetchOptions?.meta});let s=e=>{(0,o.DV)(e)&&e.silent||this.#a({type:"error",error:e}),(0,o.DV)(e)||(this.#l.config.onError?.(e,this),this.#l.config.onSettled?.(this.state.data,e,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.#o=(0,o.Mz)({initialPromise:t?.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:e=>{if(void 0===e){s(Error(`${this.queryHash} data is undefined`));return}this.setData(e),this.#l.config.onSuccess?.(e,this),this.#l.config.onSettled?.(e,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:s,onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),this.#o.start()}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":var r,n;return{...t,...(r=t.data,n=this.options,{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:(0,o.Kw)(n.networkMode)?"fetching":"paused",...void 0===r&&{error:null,status:"pending"}}),fetchMeta:e.meta??null};case"success":return{...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":let i=e.error;if((0,o.DV)(i)&&i.revert&&this.#c)return{...this.#c,fetchStatus:"idle"};return{...t,error:i,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),i.V.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#l.notify({query:this,type:"updated",action:e})})}},u=r(49010),c=class extends u.l{constructor(e={}){super(),this.config=e,this.#h=new Map}#h;build(e,t,r){let i=t.queryKey,o=t.queryHash??(0,n.Rm)(i,t),a=this.get(o);return a||(a=new s({cache:this,queryKey:i,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}add(e){this.#h.has(e.queryHash)||(this.#h.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#h.get(e.queryHash);t&&(e.destroy(),t===e&&this.#h.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){i.V.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#h.get(e)}getAll(){return[...this.#h.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){i.V.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){i.V.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){i.V.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},l=r(92812),f=class extends u.l{constructor(e={}){super(),this.config=e,this.#p=new Map,this.#m=Date.now()}#p;#m;build(e,t,r){let n=new l.m({mutationCache:this,mutationId:++this.#m,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){let t=d(e),r=this.#p.get(t)??[];r.push(e),this.#p.set(t,r),this.notify({type:"added",mutation:e})}remove(e){let t=d(e);if(this.#p.has(t)){let r=this.#p.get(t)?.filter(t=>t!==e);r&&(0===r.length?this.#p.delete(t):this.#p.set(t,r))}this.notify({type:"removed",mutation:e})}canRun(e){let t=this.#p.get(d(e))?.find(e=>"pending"===e.state.status);return!t||t===e}runNext(e){let t=this.#p.get(d(e))?.find(t=>t!==e&&t.state.isPaused);return t?.continue()??Promise.resolve()}clear(){i.V.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...this.#p.values()].flat()}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){i.V.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return i.V.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function d(e){return e.options.scope?.id??String(e.mutationId)}var h=r(34939),p=r(49937);function m(e,{pages:t,pageParams:r}){let n=t.length-1;return e.getNextPageParam(t[n],t,r[n],r)}var y=class{#y;#i;#f;#b;#v;#g;#w;#O;constructor(e={}){this.#y=e.queryCache||new c,this.#i=e.mutationCache||new f,this.#f=e.defaultOptions||{},this.#b=new Map,this.#v=new Map,this.#g=0}mount(){this.#g++,1===this.#g&&(this.#w=h.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#y.onFocus())}),this.#O=p.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#y.onOnline())}))}unmount(){this.#g--,0===this.#g&&(this.#w?.(),this.#w=void 0,this.#O?.(),this.#O=void 0)}isFetching(e){return this.#y.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#i.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#y.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.getQueryData(e.queryKey);if(void 0===t)return this.fetchQuery(e);{let r=this.defaultQueryOptions(e),n=this.#y.build(this,r);return e.revalidateIfStale&&n.isStaleByTime(r.staleTime)&&this.prefetchQuery(r),Promise.resolve(t)}}getQueriesData(e){return this.#y.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let i=this.defaultQueryOptions({queryKey:e}),o=this.#y.get(i.queryHash),a=o?.state.data,s=(0,n.SE)(t,a);if(void 0!==s)return this.#y.build(this,i).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return i.V.batch(()=>this.#y.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#y.get(t.queryHash)?.state}removeQueries(e){let t=this.#y;i.V.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#y,n={type:"active",...e};return i.V.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries(n,t)))}cancelQueries(e={},t={}){let r={revert:!0,...t};return Promise.all(i.V.batch(()=>this.#y.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e={},t={}){return i.V.batch(()=>{if(this.#y.findAll(e).forEach(e=>{e.invalidate()}),"none"===e.refetchType)return Promise.resolve();let r={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(r,t)})}refetchQueries(e={},t){let r={...t,cancelRefetch:t?.cancelRefetch??!0};return Promise.all(i.V.batch(()=>this.#y.findAll(e).filter(e=>!e.isDisabled()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#y.build(this,t);return r.isStaleByTime(t.staleTime)?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){var t;return e.behavior=(t=e.pages,{onFetch:(e,r)=>{let i=async()=>{let r;let i=e.options,o=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],s=e.state.data?.pageParams||[],u=!1,c=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(e.signal.aborted?u=!0:e.signal.addEventListener("abort",()=>{u=!0}),e.signal)})},l=(0,n.cG)(e.options,e.fetchOptions),f=async(t,r,i)=>{if(u)return Promise.reject();if(null==r&&t.pages.length)return Promise.resolve(t);let o={queryKey:e.queryKey,pageParam:r,direction:i?"backward":"forward",meta:e.options.meta};c(o);let a=await l(o),{maxPages:s}=e.options,f=i?n.Ht:n.VX;return{pages:f(t.pages,a,s),pageParams:f(t.pageParams,r,s)}};if(o&&a.length){let e="backward"===o,t={pages:a,pageParams:s},n=(e?function(e,{pages:t,pageParams:r}){return e.getPreviousPageParam?.(t[0],t,r[0],r)}:m)(i,t);r=await f(t,n,e)}else{r=await f({pages:[],pageParams:[]},s[0]??i.initialPageParam);let e=t??a.length;for(let t=1;te.options.persister?.(i,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r):e.fetchFn=i}}),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}resumePausedMutations(){return p.N.isOnline()?this.#i.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#y}getMutationCache(){return this.#i}getDefaultOptions(){return this.#f}setDefaultOptions(e){this.#f=e}setQueryDefaults(e,t){this.#b.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#b.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&(r={...r,...t.defaultOptions})}),r}setMutationDefaults(e,t){this.#v.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#v.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&(r={...r,...t.defaultOptions})}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#f.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),!0!==t.enabled&&t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#f.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#y.clear(),this.#i.clear()}}},43494:function(e,t,r){"use strict";r.d(t,{F:function(){return i}});var n=r(56298),i=class{#S;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,n.PN)(this.gcTime)&&(this.#S=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(n.sk?1/0:3e5))}clearGcTimeout(){this.#S&&(clearTimeout(this.#S),this.#S=void 0)}}},30924:function(e,t,r){"use strict";r.d(t,{DV:function(){return c},Kw:function(){return s},Mz:function(){return l}});var n=r(34939),i=r(49937),o=r(56298);function a(e){return Math.min(1e3*2**e,3e4)}function s(e){return(e??"online")!=="online"||i.N.isOnline()}var u=class{constructor(e){this.revert=e?.revert,this.silent=e?.silent}};function c(e){return e instanceof u}function l(e){let t,r,c,l=!1,f=0,d=!1,h=new Promise((e,t)=>{r=e,c=t}),p=()=>n.j.isFocused()&&("always"===e.networkMode||i.N.isOnline())&&e.canRun(),m=()=>s(e.networkMode)&&e.canRun(),y=n=>{d||(d=!0,e.onSuccess?.(n),t?.(),r(n))},b=r=>{d||(d=!0,e.onError?.(r),t?.(),c(r))},v=()=>new Promise(r=>{t=e=>{(d||p())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,d||e.onContinue?.()}),g=()=>{let t;if(d)return;let r=0===f?e.initialPromise:void 0;try{t=r??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(y).catch(t=>{if(d)return;let r=e.retry??(o.sk?0:3),n=e.retryDelay??a,i="function"==typeof n?n(f,t):n,s=!0===r||"number"==typeof r&&fp()?void 0:v()).then(()=>{l?b(t):g()})})};return{promise:h,cancel:t=>{d||(b(new u(t)),e.abort?.())},continue:()=>(t?.(),h),cancelRetry:()=>{l=!0},continueRetry:()=>{l=!1},canStart:m,start:()=>(m()?g():v().then(g),h)}}},49010:function(e,t,r){"use strict";r.d(t,{l:function(){return n}});var n=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}},56298:function(e,t,r){"use strict";r.d(t,{CN:function(){return O},Ht:function(){return w},Kp:function(){return s},PN:function(){return a},Rm:function(){return l},SE:function(){return o},VS:function(){return h},VX:function(){return g},X7:function(){return c},Ym:function(){return f},ZT:function(){return i},_v:function(){return b},_x:function(){return u},cG:function(){return S},oE:function(){return v},sk:function(){return n},to:function(){return d}});var n="undefined"==typeof window||"Deno"in globalThis;function i(){}function o(e,t){return"function"==typeof e?e(t):e}function a(e){return"number"==typeof e&&e>=0&&e!==1/0}function s(e,t){return Math.max(e+(t||0)-Date.now(),0)}function u(e,t){let{type:r="all",exact:n,fetchStatus:i,predicate:o,queryKey:a,stale:s}=e;if(a){if(n){if(t.queryHash!==l(a,t.options))return!1}else if(!d(t.queryKey,a))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof s||t.isStale()===s)&&(!i||i===t.state.fetchStatus)&&(!o||!!o(t))}function c(e,t){let{exact:r,status:n,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(f(t.options.mutationKey)!==f(o))return!1}else if(!d(t.options.mutationKey,o))return!1}return(!n||t.state.status===n)&&(!i||!!i(t))}function l(e,t){return(t?.queryKeyHashFn||f)(e)}function f(e){return JSON.stringify(e,(e,t)=>m(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function d(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&!Object.keys(t).some(r=>!d(e[r],t[r]))}function h(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}function p(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function m(e){if(!y(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!(y(r)&&r.hasOwnProperty("isPrototypeOf"))&&Object.getPrototypeOf(e)===Object.prototype}function y(e){return"[object Object]"===Object.prototype.toString.call(e)}function b(e){return new Promise(t=>{setTimeout(t,e)})}function v(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?function e(t,r){if(t===r)return t;let n=p(t)&&p(r);if(n||m(t)&&m(r)){let i=n?t:Object.keys(t),o=i.length,a=n?r:Object.keys(r),s=a.length,u=n?[]:{},c=0;for(let o=0;or?n.slice(1):n}function w(e,t,r=0){let n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var O=Symbol(),S=(e,t)=>!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==O?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))},93191:function(e,t,r){"use strict";r.d(t,{NL:function(){return a},aH:function(){return s}});var n=r(2265),i=r(57437),o=n.createContext(void 0),a=e=>{let t=n.useContext(o);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t},s=e=>{let{client:t,children:r}=e;return n.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,i.jsx)(o.Provider,{value:t,children:r})}},6007:function(e,t,r){"use strict";r.d(t,{D:function(){return f}});var n=r(2265),i=r(92812),o=r(69948),a=r(49010),s=r(56298),u=class extends a.l{#P;#j=void 0;#C;#E;constructor(e,t){super(),this.#P=e,this.setOptions(t),this.bindMethods(),this.#k()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#P.defaultMutationOptions(e),(0,s.VS)(this.options,t)||this.#P.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#C,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,s.Ym)(t.mutationKey)!==(0,s.Ym)(this.options.mutationKey)?this.reset():this.#C?.state.status==="pending"&&this.#C.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#C?.removeObserver(this)}onMutationUpdate(e){this.#k(),this.#x(e)}getCurrentResult(){return this.#j}reset(){this.#C?.removeObserver(this),this.#C=void 0,this.#k(),this.#x()}mutate(e,t){return this.#E=t,this.#C?.removeObserver(this),this.#C=this.#P.getMutationCache().build(this.#P,this.options),this.#C.addObserver(this),this.#C.execute(e)}#k(){let e=this.#C?.state??(0,i.R)();this.#j={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#x(e){o.V.batch(()=>{if(this.#E&&this.hasListeners()){let t=this.#j.variables,r=this.#j.context;e?.type==="success"?(this.#E.onSuccess?.(e.data,t,r),this.#E.onSettled?.(e.data,null,t,r)):e?.type==="error"&&(this.#E.onError?.(e.error,t,r),this.#E.onSettled?.(void 0,e.error,t,r))}this.listeners.forEach(e=>{e(this.#j)})})}},c=r(93191);function l(){}function f(e,t){var r,i;let a=(0,c.NL)(t),[s]=n.useState(()=>new u(a,e));n.useEffect(()=>{s.setOptions(e)},[s,e]);let f=n.useSyncExternalStore(n.useCallback(e=>s.subscribe(o.V.batchCalls(e)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),d=n.useCallback((e,t)=>{s.mutate(e,t).catch(l)},[s]);if(f.error&&(r=s.options.throwOnError,i=[f.error],"function"==typeof r?r(...i):!!r))throw f.error;return{...f,mutate:d,mutateAsync:f.mutate}}},43061:function(e,t,r){"use strict";r.d(t,{Nr:function(){return i},iP:function(){return o}});var n=r(2265);function i(e,t){let[r,i]=n.useState(e);return n.useEffect(()=>{let r=setTimeout(()=>{i(e)},t);return()=>{clearTimeout(r)}},[e,t]),r}function o(){let[e,t]=n.useState({width:null,height:null});return n.useLayoutEffect(()=>{let e=()=>{t({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),e}},55767:function(e,t,r){"use strict";r.d(t,{O:function(){return u}});var n=r(86417),i=r(85770),o=r(99112),a=r(96329),s=r(95046);function u(e={}){let t,c,l;return(0,n.K)(n=>({id:"metaMaskSDK",name:"MetaMask",type:u.type,async setup(){let e=await this.getProvider();e&&e.on("connect",this.onConnect.bind(this))},async connect({chainId:e,isReconnecting:r}={}){let i=await this.getProvider(),s=[];r&&(s=await this.getAccounts().catch(()=>[]));try{s?.length||(s=(await t.connect()).map(e=>(0,o.K)(e))),i.removeListener("connect",this.onConnect.bind(this)),i.on("accountsChanged",this.onAccountsChanged.bind(this)),i.on("chainChanged",this.onChainChanged),i.on("disconnect",this.onDisconnect.bind(this));let r=await this.getChainId();if(e&&r!==e){let t=await this.switchChain({chainId:e}).catch(e=>{if(e.code===a.ab.code)throw e;return{id:r}});r=t?.id??r}return await n.storage?.removeItem("metaMaskSDK.disconnected"),{accounts:s,chainId:r}}catch(e){if(e.code===a.ab.code)throw new a.ab(e);if(e.code===a.pT.code)throw new a.pT(e);throw e}},async disconnect(){let e=await this.getProvider();e.removeListener("accountsChanged",this.onAccountsChanged.bind(this)),e.removeListener("chainChanged",this.onChainChanged),e.removeListener("disconnect",this.onDisconnect.bind(this)),e.on("connect",this.onConnect.bind(this)),t.terminate(),await n.storage?.setItem("metaMaskSDK.disconnected",!0)},async getAccounts(){let e=await this.getProvider();return(await e.request({method:"eth_accounts"})).map(e=>(0,o.K)(e))},async getChainId(){let e=await this.getProvider();return Number(e.getChainId()||await e?.request({method:"eth_chainId"}))},async getProvider(){async function i(){let{default:i}=await r.e(497).then(r.t.bind(r,97797,19));return t=new("function"!=typeof i&&"function"==typeof i.default?i.default:i)({dappMetadata:{},...e,_source:"wagmi",readonlyRPCMap:Object.fromEntries(n.chains.map(e=>[e.id,e.rpcUrls.default.http[0]]))}),await t.init(),t.getProvider()}return c||(l||(l=i()),c=await l),c},async isAuthorized(){try{if("undefined"!=typeof navigator&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||await n.storage?.getItem("metaMaskSDK.disconnected"))return!1;return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){let r=await this.getProvider(),o=n.chains.find(e=>e.id===t);if(!o)throw new a.x3(new i.X4);try{return await Promise.all([r.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,s.eC)(t)}]}),new Promise(e=>n.emitter.once("change",({chainId:r})=>{r===t&&e()}))]),o}catch(n){if(4902===n.code||n?.data?.originalError?.code===4902)try{let n,i;let{default:u,...c}=o.blockExplorers??{};e?.blockExplorerUrls?n=e.blockExplorerUrls:u&&(n=[u.url,...Object.values(c).map(e=>e.url)]),i=e?.rpcUrls?.length?e.rpcUrls:[o.rpcUrls.default?.http[0]??""];let l={blockExplorerUrls:n,chainId:(0,s.eC)(t),chainName:e?.chainName??o.name,iconUrls:e?.iconUrls,nativeCurrency:e?.nativeCurrency??o.nativeCurrency,rpcUrls:i};if(await r.request({method:"wallet_addEthereumChain",params:[l]}),await this.getChainId()!==t)throw new a.ab(Error("User rejected switch after adding network."));return o}catch(e){throw new a.ab(e)}if(n.code===a.ab.code)throw new a.ab(n);throw new a.x3(n)}},async onAccountsChanged(e){if(0===e.length)this.onDisconnect();else if(n.emitter.listenerCount("connect")){let e=(await this.getChainId()).toString();this.onConnect({chainId:e}),await n.storage?.removeItem("metaMaskSDK.disconnected")}else n.emitter.emit("change",{accounts:e.map(e=>(0,o.K)(e))})},onChainChanged(e){let t=Number(e);n.emitter.emit("change",{chainId:t})},async onConnect(e){let t=await this.getAccounts();if(0===t.length)return;let r=Number(e.chainId);n.emitter.emit("connect",{accounts:t,chainId:r});let i=await this.getProvider();i&&(i.removeListener("connect",this.onConnect.bind(this)),i.on("accountsChanged",this.onAccountsChanged.bind(this)),i.on("chainChanged",this.onChainChanged),i.on("disconnect",this.onDisconnect.bind(this)))},async onDisconnect(e){let t=await this.getProvider();e&&1013===e.code&&t&&(await this.getAccounts()).length||("undefined"!=typeof localStorage&&(localStorage.removeItem("MMSDK_cached_address"),localStorage.removeItem("MMSDK_cached_chainId")),n.emitter.emit("disconnect"),t.removeListener("accountsChanged",this.onAccountsChanged.bind(this)),t.removeListener("chainChanged",this.onChainChanged),t.removeListener("disconnect",this.onDisconnect.bind(this)),t.on("connect",this.onConnect.bind(this)))}}))}u.type="metaMask"},86417:function(e,t,r){"use strict";function n(e){return e}r.d(t,{K:function(){return n}})},55925:function(e,t,r){"use strict";let n;r.d(t,{_:function(){return D}});var i=r(500);let o=e=>(t,r,n)=>{let i=n.subscribe;return n.subscribe=(e,t,r)=>{let o=e;if(t){let i=(null==r?void 0:r.equalityFn)||Object.is,a=e(n.getState());o=r=>{let n=e(r);if(!i(a,n)){let e=a;t(a=n,e)}},(null==r?void 0:r.fireImmediately)&&t(a,a)}return i(o)},e(t,r,n)},a=e=>t=>{try{let r=e(t);if(r instanceof Promise)return r;return{then:e=>a(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>a(t)(e)}}},s=(e,t)=>(r,n,i)=>{let o,s,u={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},c=!1,l=new Set,f=new Set;try{o=u.getStorage()}catch(e){}if(!o)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${u.name}', the given storage is currently unavailable.`),r(...e)},n,i);let d=a(u.serialize),h=()=>{let e;let t=d({state:u.partialize({...n()}),version:u.version}).then(e=>o.setItem(u.name,e)).catch(t=>{e=t});if(e)throw e;return t},p=i.setState;i.setState=(e,t)=>{p(e,t),h()};let m=e((...e)=>{r(...e),h()},n,i),y=()=>{var e;if(!o)return;c=!1,l.forEach(e=>e(n()));let t=(null==(e=u.onRehydrateStorage)?void 0:e.call(u,n()))||void 0;return a(o.getItem.bind(o))(u.name).then(e=>{if(e)return u.deserialize(e)}).then(e=>{if(e){if("number"!=typeof e.version||e.version===u.version)return e.state;if(u.migrate)return u.migrate(e.state,e.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}}).then(e=>{var t;return r(s=u.merge(e,null!=(t=n())?t:m),!0),h()}).then(()=>{null==t||t(s,void 0),c=!0,f.forEach(e=>e(s))}).catch(e=>{null==t||t(void 0,e)})};return i.persist={setOptions:e=>{u={...u,...e},e.getStorage&&(o=e.getStorage())},clearStorage:()=>{null==o||o.removeItem(u.name)},getOptions:()=>u,rehydrate:()=>y(),hasHydrated:()=>c,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(f.add(e),()=>{f.delete(e)})},y(),s||m},u=(e,t)=>(r,n,i)=>{let o,s={storage:function(e,t){let r;try{r=e()}catch(e){return}return{getItem:e=>{var t;let n=e=>null===e?null:JSON.parse(e,void 0),i=null!=(t=r.getItem(e))?t:null;return i instanceof Promise?i.then(n):n(i)},setItem:(e,t)=>r.setItem(e,JSON.stringify(t,void 0)),removeItem:e=>r.removeItem(e)}}(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},u=!1,c=new Set,l=new Set,f=s.storage;if(!f)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...e)},n,i);let d=()=>{let e=s.partialize({...n()});return f.setItem(s.name,{state:e,version:s.version})},h=i.setState;i.setState=(e,t)=>{h(e,t),d()};let p=e((...e)=>{r(...e),d()},n,i),m=()=>{var e,t;if(!f)return;u=!1,c.forEach(e=>{var t;return e(null!=(t=n())?t:p)});let i=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=n())?e:p))||void 0;return a(f.getItem.bind(f))(s.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===s.version)return e.state;if(s.migrate)return s.migrate(e.state,e.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}}).then(e=>{var t;return r(o=s.merge(e,null!=(t=n())?t:p),!0),d()}).then(()=>{null==i||i(o,void 0),o=n(),u=!0,l.forEach(e=>e(o))}).catch(e=>{null==i||i(void 0,e)})};return i.persist={setOptions:e=>{s={...s,...e},e.storage&&(f=e.storage)},clearStorage:()=>{null==f||f.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>m(),hasHydrated:()=>u,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},s.skipHydration||m(),o||p},c=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?(console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),s(e,t)):u(e,t),l=e=>{let t;let r=new Set,n=(e,n)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=n?n:"object"!=typeof i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,o={setState:n,getState:i,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return t=e(n,i,o),o},f=e=>e?l(e):l;var d=r(99112),h=r(96329),p=r(39881),m=r(13581),y=r(95046),b=r(85770),v=r(66564);class g extends v.G{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}var w=r(86417);let O=/(rabby|trustwallet)/,S={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider:e=>e?.coinbaseWalletExtension?e.coinbaseWalletExtension:j(e,"isCoinbaseWallet")},metaMask:{id:"metaMask",name:"MetaMask",provider:e=>j(e,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;for(let t of["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isZerion"])if(e[t])return!1;return!0})},phantom:{id:"phantom",name:"Phantom",provider:e=>e?.phantom?.ethereum?e.phantom?.ethereum:j(e,"isPhantom")}};function P(e={}){let t,r,n,i;let{shimDisconnect:o=!0,unstable_shimAsyncInject:a}=e;function s(){let t=e.target;if("function"==typeof t){let e=t();if(e)return e}return"object"==typeof t?t:"string"==typeof t?{...S[t]??{id:t,name:`${t[0].toUpperCase()}${t.slice(1)}`,provider:`is${t[0].toUpperCase()}${t.slice(1)}`}}:{id:"injected",name:"Injected",provider:e=>e?.ethereum}}return(0,w.K)(u=>({get icon(){return s().icon},get id(){return s().id},get name(){return s().name},get supportsSimulation(){return O.test(this.id.toLowerCase())},type:P.type,async setup(){let r=await this.getProvider();r&&e.target&&(n||(n=this.onConnect.bind(this),r.on("connect",n)),t||(t=this.onAccountsChanged.bind(this),r.on("accountsChanged",t)))},async connect({chainId:a,isReconnecting:s}={}){let c=await this.getProvider();if(!c)throw new g;let l=[];if(s)l=await this.getAccounts().catch(()=>[]);else if(o)try{let e=await c.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});l=e[0]?.caveats?.[0]?.value?.map(e=>d.K(e))}catch(e){if(e.code===h.ab.code)throw new h.ab(e);if(e.code===h.pT.code)throw e}try{l?.length||s||(l=(await c.request({method:"eth_requestAccounts"})).map(e=>(0,d.K)(e))),n&&(c.removeListener("connect",n),n=void 0),t||(t=this.onAccountsChanged.bind(this),c.on("accountsChanged",t)),r||(r=this.onChainChanged.bind(this),c.on("chainChanged",r)),i||(i=this.onDisconnect.bind(this),c.on("disconnect",i));let f=await this.getChainId();if(a&&f!==a){let e=await this.switchChain({chainId:a}).catch(e=>{if(e.code===h.ab.code)throw e;return{id:f}});f=e?.id??f}return o&&await u.storage?.removeItem(`${this.id}.disconnected`),e.target||await u.storage?.setItem("injected.connected",!0),{accounts:l,chainId:f}}catch(e){if(e.code===h.ab.code)throw new h.ab(e);if(e.code===h.pT.code)throw new h.pT(e);throw e}},async disconnect(){let t=await this.getProvider();if(!t)throw new g;r&&(t.removeListener("chainChanged",r),r=void 0),i&&(t.removeListener("disconnect",i),i=void 0),n||(n=this.onConnect.bind(this),t.on("connect",n));try{await t.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]})}catch{}o&&await u.storage?.setItem(`${this.id}.disconnected`,!0),e.target||await u.storage?.removeItem("injected.connected")},async getAccounts(){let e=await this.getProvider();if(!e)throw new g;return(await e.request({method:"eth_accounts"})).map(e=>(0,d.K)(e))},async getChainId(){let e=await this.getProvider();if(!e)throw new g;return Number(await e.request({method:"eth_chainId"}))},async getProvider(){let e;if("undefined"==typeof window)return;let t=s();return(e="function"==typeof t.provider?t.provider(window):"string"==typeof t.provider?j(window,t.provider):t.provider)&&!e.removeListener&&("off"in e&&"function"==typeof e.off?e.removeListener=e.off:e.removeListener=()=>{}),e},async isAuthorized(){try{if(o&&await u.storage?.getItem(`${this.id}.disconnected`)||!e.target&&!await u.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(void 0!==a&&!1!==a){let e=async()=>("undefined"!=typeof window&&window.removeEventListener("ethereum#initialized",e),!!await this.getProvider()),t="number"==typeof a?a:1e3;if(await Promise.race([..."undefined"!=typeof window?[new Promise(t=>window.addEventListener("ethereum#initialized",()=>t(e()),{once:!0}))]:[],new Promise(r=>setTimeout(()=>r(e()),t))]))return!0}throw new g}return!!(await (0,p.J)(()=>(0,m.F)(()=>this.getAccounts(),{timeout:100}))).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){let r=await this.getProvider();if(!r)throw new g;let n=u.chains.find(e=>e.id===t);if(!n)throw new h.x3(new b.X4);try{return await Promise.all([r.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,y.eC)(t)}]}).then(async()=>{await this.getChainId()===t&&u.emitter.emit("change",{chainId:t})}),new Promise(e=>u.emitter.once("change",({chainId:r})=>{r===t&&e()}))]),n}catch(i){if(4902===i.code||i?.data?.originalError?.code===4902)try{let i,o;let{default:a,...s}=n.blockExplorers??{};e?.blockExplorerUrls?i=e.blockExplorerUrls:a&&(i=[a.url,...Object.values(s).map(e=>e.url)]),o=e?.rpcUrls?.length?e.rpcUrls:[n.rpcUrls.default?.http[0]??""];let u={blockExplorerUrls:i,chainId:(0,y.eC)(t),chainName:e?.chainName??n.name,iconUrls:e?.iconUrls,nativeCurrency:e?.nativeCurrency??n.nativeCurrency,rpcUrls:o};if(await r.request({method:"wallet_addEthereumChain",params:[u]}),await this.getChainId()!==t)throw new h.ab(Error("User rejected switch after adding network."));return n}catch(e){throw new h.ab(e)}if(i.code===h.ab.code)throw new h.ab(i);throw new h.x3(i)}},async onAccountsChanged(e){if(0===e.length)this.onDisconnect();else if(u.emitter.listenerCount("connect")){let e=(await this.getChainId()).toString();this.onConnect({chainId:e}),o&&await u.storage?.removeItem(`${this.id}.disconnected`)}else u.emitter.emit("change",{accounts:e.map(e=>(0,d.K)(e))})},onChainChanged(e){let t=Number(e);u.emitter.emit("change",{chainId:t})},async onConnect(e){let o=await this.getAccounts();if(0===o.length)return;let a=Number(e.chainId);u.emitter.emit("connect",{accounts:o,chainId:a});let s=await this.getProvider();s&&(n&&(s.removeListener("connect",n),n=void 0),t||(t=this.onAccountsChanged.bind(this),s.on("accountsChanged",t)),r||(r=this.onChainChanged.bind(this),s.on("chainChanged",r)),i||(i=this.onDisconnect.bind(this),s.on("disconnect",i)))},async onDisconnect(e){let t=await this.getProvider();e&&1013===e.code&&t&&(await this.getAccounts()).length||(u.emitter.emit("disconnect"),t&&(r&&(t.removeListener("chainChanged",r),r=void 0),i&&(t.removeListener("disconnect",i),i=void 0),n||(n=this.onConnect.bind(this),t.on("connect",n))))}}))}function j(e,t){function r(e){return"function"==typeof t?t(e):"string"!=typeof t||e[t]}let n=e.ethereum;return n?.providers?n.providers.find(e=>r(e)):n&&r(n)?n:void 0}P.type="injected";var C=r(36393);class E{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new C.v})}on(e,t){this._emitter.on(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}emit(e,...t){let r=t[0];this._emitter.emit(e,{uid:this.uid,...r})}listenerCount(e){return this._emitter.listenerCount(e)}}function k(e,t){return JSON.parse(e,(e,r)=>{let n=r;return n?.__type==="bigint"&&(n=BigInt(n.value)),n?.__type==="Map"&&(n=new Map(n.value)),t?.(e,n)??n})}function x(e,t){return e.slice(0,t).join(".")||"."}function M(e,t){let{length:r}=e;for(let n=0;n{let n=r;return"bigint"==typeof n&&(n={__type:"bigint",value:r.toString()}),n instanceof Map&&(n={__type:"Map",value:Array.from(r.entries())}),t?.(e,n)??n},n),r??void 0)}let I={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},R=256;var T=r(52520);function D(e){let t;let{multiInjectedProviderDiscovery:r=!0,storage:a=function(e){let{deserialize:t=k,key:r="wagmi",serialize:n=A,storage:i=I}=e;function o(e){return e instanceof Promise?e.then(e=>e).catch(()=>null):e}return{...i,key:r,async getItem(e,n){let a=i.getItem(`${r}.${e}`),s=await o(a);return s?t(s)??null:n??null},async setItem(e,t){let a=`${r}.${e}`;null===t?await o(i.removeItem(a)):await o(i.setItem(a,n(t)))},async removeItem(e){await o(i.removeItem(`${r}.${e}`))}}}({storage:"undefined"!=typeof window&&window.localStorage?window.localStorage:I}),syncConnectedChain:s=!0,ssr:u,...l}=e,d="undefined"!=typeof window&&r?function(){let e=new Set,t=[],r=()=>(function(e){let t=t=>e(t.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)})(r=>{t.some(({info:e})=>e.uuid===r.info.uuid)||(t=[...t,r],e.forEach(e=>e(t,{added:[r]})))}),n=r();return{_listeners:()=>e,clear(){e.forEach(e=>e([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),n()},findProvider:({rdns:e})=>t.find(t=>t.info.rdns===e),getProviders:()=>t,reset(){this.clear(),n(),n=r()},subscribe:(r,{emitImmediately:n}={})=>(e.add(r),n&&r(t,{added:t}),()=>e.delete(r))}}():void 0,h=f(()=>l.chains),p=f(()=>[...l.connectors??[],...u?[]:d?.getProviders().map(y)??[]].map(m));function m(e){let t=new E(function(e=11){if(!n||R+e>512){n="",R=0;for(let e=0;e<256;e++)n+=(256+256*Math.random()|0).toString(16).substring(1)}return n.substring(R,R+++e)}()),r={...e({emitter:t,chains:h.getState(),storage:a}),emitter:t,uid:t.uid};return t.on("connect",j),r.setup?.(),r}function y(e){let{info:t}=e,r=e.provider;return P({target:{...t,id:t.rdns,provider:r}})}let v=new Map;function g(){return{chainId:h.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let w="0.0.0-canary-";t=T.i.startsWith(w)?Number.parseInt(T.i.replace(w,"")):Number.parseInt(T.i.split(".")[0]??"0");let O=f(o(a?c(g,{migrate(e,r){if(r===t)return e;let n=g(),i=e&&"object"==typeof e&&"chainId"in e&&"number"==typeof e.chainId?e.chainId:n.chainId;return{...n,chainId:i}},name:"store",partialize:e=>({connections:{__type:"Map",value:Array.from(e.connections.entries()).map(([e,t])=>{let{id:r,name:n,type:i,uid:o}=t.connector;return[e,{...t,connector:{id:r,name:n,type:i,uid:o}}]})},chainId:e.chainId,current:e.current}),skipHydration:u,storage:a,version:t}):g));function S(e){O.setState(t=>{let r=t.connections.get(e.uid);return r?{...t,connections:new Map(t.connections).set(e.uid,{accounts:e.accounts??r.accounts,chainId:e.chainId??r.chainId,connector:r.connector})}:t})}function j(e){"connecting"!==O.getState().status&&"reconnecting"!==O.getState().status&&O.setState(t=>{let r=p.getState().find(t=>t.uid===e.uid);return r?(r.emitter.listenerCount("connect")&&r.emitter.off("connect",S),r.emitter.listenerCount("change")||r.emitter.on("change",S),r.emitter.listenerCount("disconnect")||r.emitter.on("disconnect",C),{...t,connections:new Map(t.connections).set(e.uid,{accounts:e.accounts,chainId:e.chainId,connector:r}),current:e.uid,status:"connected"}):t})}function C(e){O.setState(t=>{let r=t.connections.get(e.uid);if(r){let e=r.connector;e.emitter.listenerCount("change")&&r.connector.emitter.off("change",S),e.emitter.listenerCount("disconnect")&&r.connector.emitter.off("disconnect",C),e.emitter.listenerCount("connect")||r.connector.emitter.on("connect",j)}if(t.connections.delete(e.uid),0===t.connections.size)return{...t,connections:new Map,current:null,status:"disconnected"};let n=t.connections.values().next().value;return{...t,connections:new Map(t.connections),current:n.connector.uid}})}return s&&O.subscribe(({connections:e,current:t})=>t?e.get(t)?.chainId:void 0,e=>{if(h.getState().some(t=>t.id===e))return O.setState(t=>({...t,chainId:e??t.chainId}))}),d?.subscribe(e=>{let t=new Map;for(let e of p.getState())t.set(e.id,!0);let r=[];for(let n of e){let e=m(y(n));t.has(e.id)||r.push(e)}(!a||O.persist.hasHydrated())&&p.setState(e=>[...e,...r],!0)}),{get chains(){return h.getState()},get connectors(){return p.getState()},storage:a,getClient:function(e={}){let t;let r=e.chainId??O.getState().chainId,n=h.getState().find(e=>e.id===r);if(e.chainId&&!n)throw new b.X4;{let e=v.get(O.getState().chainId);if(e&&!n)return e;if(!n)throw new b.X4}{let e=v.get(r);if(e)return e}if(l.client)t=l.client({chain:n});else{let e=n.id,r=h.getState().map(e=>e.id),o={};for(let[t,n]of Object.entries(l))if("chains"!==t&&"client"!==t&&"connectors"!==t&&"transports"!==t){if("object"==typeof n){if(e in n)o[t]=n[e];else{if(r.some(e=>e in n))continue;o[t]=n}}else o[t]=n}t=(0,i.e)({...o,chain:n,batch:o.batch??{multicall:!0},transport:t=>l.transports[e]({...t,connectors:p})})}return v.set(r,t),t},get state(){return O.getState()},setState(e){let t;t="function"==typeof e?e(O.getState()):e;let r=g();"object"!=typeof t&&(t=r),Object.keys(r).some(e=>!(e in t))&&(t=r),O.setState(t,!0)},subscribe:(e,t,r)=>O.subscribe(e,t,r?{...r,fireImmediately:r.emitImmediately}:void 0),_internal:{mipd:d,store:O,ssr:!!u,syncConnectedChain:s,transports:l.transports,chains:{setState(e){let t="function"==typeof e?e(h.getState()):e;if(0!==t.length)return h.setState(t,!0)},subscribe:e=>h.subscribe(e)},connectors:{providerDetailToConnector:y,setup:m,setState:e=>p.setState("function"==typeof e?e(p.getState()):e,!0),subscribe:e=>p.subscribe(e)},events:{change:S,connect:j,disconnect:C}}}}},66564:function(e,t,r){"use strict";r.d(t,{G:function(){return u}});var n,i,o=r(52520);let a=()=>`@wagmi/core@${o.i}`;var s=function(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class u extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return a()}constructor(e,t={}){super(),n.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});let r=t.cause instanceof u?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof u&&t.cause.docsPath||t.docsPath;this.message=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${this.docsBaseUrl}${i}.html${t.docsSlug?`#${t.docsSlug}`:""}`]:[],...r?[`Details: ${r}`]:[],`Version: ${this.version}`].join("\n"),t.cause&&(this.cause=t.cause),this.details=r,this.docsPath=i,this.metaMessages=t.metaMessages,this.shortMessage=e}walk(e){return s(this,n,"m",i).call(this,this,e)}}n=new WeakSet,i=function e(t,r){return r?.(t)?t:t.cause?s(this,n,"m",e).call(this,t.cause,r):t}},85770:function(e,t,r){"use strict";r.d(t,{JK:function(){return s},X4:function(){return i},aH:function(){return a},wi:function(){return o}});var n=r(66564);class i extends n.G{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class o extends n.G{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class a extends n.G{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class s extends n.G{constructor({address:e,connector:t}){super(`Account "${e}" not found for connector "${t.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}},90331:function(e,t,r){"use strict";r.d(t,{v:function(){return function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){let n,i;if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)&&Array.isArray(r)){if((n=t.length)!==r.length)return!1;for(i=n;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();let o=Object.keys(t);if((n=o.length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;0!=i--;){let n=o[i];if(n&&!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r}}})},52520:function(e,t,r){"use strict";r.d(t,{i:function(){return n}});let n="2.10.5"},16876:function(e,t,r){"use strict";r.d(t,{mY:function(){return A}});var n=/[\\\/_+.#"@\[\(\{&]/,i=/[\\\/_+.#"@\[\(\{&]/g,o=/[\s-]/,a=/[\s-]/g;function s(e){return e.toLowerCase().replace(a," ")}var u=r(13304),c=r(2265),l=r(25171),f='[cmdk-group=""]',d='[cmdk-group-items=""]',h='[cmdk-item=""]',p=`${h}:not([aria-disabled="true"])`,m="cmdk-item-select",y="data-value",b=(e,t,r)=>{var u;return u=e,function e(t,r,s,u,c,l,f){if(l===r.length)return c===t.length?1:.99;var d=`${c},${l}`;if(void 0!==f[d])return f[d];for(var h,p,m,y,b=u.charAt(l),v=s.indexOf(b,c),g=0;v>=0;)(h=e(t,r,s,u,v+1,l+1,f))>g&&(v===c?h*=1:n.test(t.charAt(v-1))?(h*=.8,(m=t.slice(c,v-1).match(i))&&c>0&&(h*=Math.pow(.999,m.length))):o.test(t.charAt(v-1))?(h*=.9,(y=t.slice(c,v-1).match(a))&&c>0&&(h*=Math.pow(.999,y.length))):(h*=.17,c>0&&(h*=Math.pow(.999,v-c))),t.charAt(v)!==r.charAt(l)&&(h*=.9999)),(h<.1&&s.charAt(v-1)===u.charAt(l+1)||u.charAt(l+1)===u.charAt(l)&&s.charAt(v-1)!==u.charAt(l))&&.1*(p=e(t,r,s,u,v+1,l+2,f))>h&&(h=.1*p),h>g&&(g=h),v=s.indexOf(b,v+1);return f[d]=g,g}(u=r&&r.length>0?`${u+" "+r.join(" ")}`:u,t,s(u),s(t),0,0,{})},v=c.createContext(void 0),g=()=>c.useContext(v),w=c.createContext(void 0),O=()=>c.useContext(w),S=c.createContext(void 0),P=c.forwardRef((e,t)=>{let r=T(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",filtered:{count:0,items:new Map,groups:new Set}}}),n=T(()=>new Set),i=T(()=>new Map),o=T(()=>new Map),a=T(()=>new Set),s=I(e),{label:u,children:g,value:O,onValueChange:S,filter:P,shouldFilter:j,loop:C,disablePointerSelection:E=!1,vimBindings:k=!0,...x}=e,M=c.useId(),A=c.useId(),D=c.useId(),_=c.useRef(null),q=F();R(()=>{if(void 0!==O){let e=O.trim();r.current.value=e,U.emit()}},[O]),R(()=>{q(6,Z)},[]);let U=c.useMemo(()=>({subscribe:e=>(a.current.add(e),()=>a.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var i,o,a;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)G(),V(),q(1,$);else if("value"===e&&(n||q(5,Z),(null==(i=s.current)?void 0:i.value)!==void 0)){null==(a=(o=s.current).onValueChange)||a.call(o,null!=t?t:"");return}U.emit()}},emit:()=>{a.current.forEach(e=>e())}}),[]),z=c.useMemo(()=>({value:(e,t,n)=>{var i;t!==(null==(i=o.current.get(e))?void 0:i.value)&&(o.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,K(t,n)),q(2,()=>{V(),U.emit()}))},item:(e,t)=>(n.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),q(3,()=>{G(),V(),r.current.value||$(),U.emit()}),()=>{o.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=W();q(4,()=>{G(),(null==t?void 0:t.getAttribute("id"))===e&&$(),U.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{o.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:u||e["aria-label"],disablePointerSelection:E,listId:M,inputId:D,labelId:A,listInnerRef:_}),[]);function K(e,t){var n,i;let o=null!=(i=null==(n=s.current)?void 0:n.filter)?i:b;return e?o(e,r.current.search,t):0}function V(){if(!r.current.search||!1===s.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=i.current.get(r),o=0;n.forEach(t=>{o=Math.max(e.get(t),o)}),t.push([r,o])});let n=_.current;H().sort((t,r)=>{var n,i;let o=t.getAttribute("id"),a=r.getAttribute("id");return(null!=(n=e.get(a))?n:0)-(null!=(i=e.get(o))?i:0)}).forEach(e=>{let t=e.closest(d);t?t.appendChild(e.parentElement===t?e:e.closest(`${d} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${d} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=_.current.querySelector(`${f}[${y}="${encodeURIComponent(e[0])}"]`);null==t||t.parentElement.appendChild(t)})}function $(){let e=H().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(y);U.setState("value",t||void 0)}function G(){var e,t,a,u;if(!r.current.search||!1===s.current.shouldFilter){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let c=0;for(let i of n.current){let n=K(null!=(t=null==(e=o.current.get(i))?void 0:e.value)?t:"",null!=(u=null==(a=o.current.get(i))?void 0:a.keywords)?u:[]);r.current.filtered.items.set(i,n),n>0&&c++}for(let[e,t]of i.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=c}function Z(){var e,t,r;let n=W();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(f))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function W(){var e;return null==(e=_.current)?void 0:e.querySelector(`${h}[aria-selected="true"]`)}function H(){var e;return Array.from(null==(e=_.current)?void 0:e.querySelectorAll(p))}function Q(e){let t=H()[e];t&&U.setState("value",t.getAttribute(y))}function B(e){var t;let r=W(),n=H(),i=n.findIndex(e=>e===r),o=n[i+e];null!=(t=s.current)&&t.loop&&(o=i+e<0?n[n.length-1]:i+e===n.length?n[0]:n[i+e]),o&&U.setState("value",o.getAttribute(y))}function J(e){let t=W(),r=null==t?void 0:t.closest(f),n;for(;r&&!n;)n=null==(r=e>0?function(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}(r,f):function(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}(r,f))?void 0:r.querySelector(p);n?U.setState("value",n.getAttribute(y)):B(e)}let X=()=>Q(H().length-1),Y=e=>{e.preventDefault(),e.metaKey?X():e.altKey?J(1):B(1)},ee=e=>{e.preventDefault(),e.metaKey?Q(0):e.altKey?J(-1):B(-1)};return c.createElement(l.WV.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:e=>{var t;if(null==(t=x.onKeyDown)||t.call(x,e),!e.defaultPrevented)switch(e.key){case"n":case"j":k&&e.ctrlKey&&Y(e);break;case"ArrowDown":Y(e);break;case"p":case"k":k&&e.ctrlKey&&ee(e);break;case"ArrowUp":ee(e);break;case"Home":e.preventDefault(),Q(0);break;case"End":e.preventDefault(),X();break;case"Enter":if(!e.nativeEvent.isComposing&&229!==e.keyCode){e.preventDefault();let t=W();if(t){let e=new Event(m);t.dispatchEvent(e)}}}}},c.createElement("label",{"cmdk-label":"",htmlFor:z.inputId,id:z.labelId,style:N},u),L(e,e=>c.createElement(w.Provider,{value:U},c.createElement(v.Provider,{value:z},e))))}),j=c.forwardRef((e,t)=>{var r,n;let i=c.useId(),o=c.useRef(null),a=c.useContext(S),s=g(),u=I(e),f=null!=(n=null==(r=u.current)?void 0:r.forceMount)?n:null==a?void 0:a.forceMount;R(()=>{if(!f)return s.item(i,null==a?void 0:a.id)},[f]);let d=q(i,o,[e.value,e.children,o],e.keywords),h=O(),p=_(e=>e.value&&e.value===d.current),y=_(e=>!!f||!1===s.filter()||!e.search||e.filtered.items.get(i)>0);function b(){var e,t;v(),null==(t=(e=u.current).onSelect)||t.call(e,d.current)}function v(){h.setState("value",d.current,!0)}if(c.useEffect(()=>{let t=o.current;if(!(!t||e.disabled))return t.addEventListener(m,b),()=>t.removeEventListener(m,b)},[y,e.onSelect,e.disabled]),!y)return null;let{disabled:w,value:P,onSelect:j,forceMount:C,keywords:E,...k}=e;return c.createElement(l.WV.div,{ref:D([o,t]),...k,id:i,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!p,"data-disabled":!!w,"data-selected":!!p,onPointerMove:w||s.disablePointerSelection?void 0:v,onClick:w?void 0:b},e.children)}),C=c.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:i,...o}=e,a=c.useId(),s=c.useRef(null),u=c.useRef(null),f=c.useId(),d=g(),h=_(e=>!!i||!1===d.filter()||!e.search||e.filtered.groups.has(a));R(()=>d.group(a),[]),q(a,s,[e.value,e.heading,u]);let p=c.useMemo(()=>({id:a,forceMount:i}),[i]);return c.createElement(l.WV.div,{ref:D([s,t]),...o,"cmdk-group":"",role:"presentation",hidden:!h||void 0},r&&c.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:f},r),L(e,e=>c.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?f:void 0},c.createElement(S.Provider,{value:p},e))))}),E=c.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,i=c.useRef(null),o=_(e=>!e.search);return r||o?c.createElement(l.WV.div,{ref:D([i,t]),...n,"cmdk-separator":"",role:"separator"}):null}),k=c.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,i=null!=e.value,o=O(),a=_(e=>e.search),s=_(e=>e.value),u=g(),f=c.useMemo(()=>{var e;let t=null==(e=u.listInnerRef.current)?void 0:e.querySelector(`${h}[${y}="${encodeURIComponent(s)}"]`);return null==t?void 0:t.getAttribute("id")},[]);return c.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),c.createElement(l.WV.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":f,id:u.inputId,type:"text",value:i?e.value:a,onChange:e=>{i||o.setState("search",e.target.value),null==r||r(e.target.value)}})}),x=c.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...i}=e,o=c.useRef(null),a=c.useRef(null),s=g();return c.useEffect(()=>{if(a.current&&o.current){let e=a.current,t=o.current,r,n=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;t.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return n.observe(e),()=>{cancelAnimationFrame(r),n.unobserve(e)}}},[]),c.createElement(l.WV.div,{ref:D([o,t]),...i,"cmdk-list":"",role:"listbox","aria-label":n,id:s.listId},L(e,e=>c.createElement("div",{ref:D([a,s.listInnerRef]),"cmdk-list-sizer":""},e)))}),M=c.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:i,contentClassName:o,container:a,...s}=e;return c.createElement(u.fC,{open:r,onOpenChange:n},c.createElement(u.h_,{container:a},c.createElement(u.aV,{"cmdk-overlay":"",className:i}),c.createElement(u.VY,{"aria-label":e.label,"cmdk-dialog":"",className:o},c.createElement(P,{ref:t,...s}))))}),A=Object.assign(P,{List:x,Item:j,Input:k,Group:C,Separator:E,Dialog:M,Empty:c.forwardRef((e,t)=>_(e=>0===e.filtered.count)?c.createElement(l.WV.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:c.forwardRef((e,t)=>{let{progress:r,children:n,label:i="Loading...",...o}=e;return c.createElement(l.WV.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},L(e,e=>c.createElement("div",{"aria-hidden":!0},e)))})});function I(e){let t=c.useRef(e);return R(()=>{t.current=e}),t}var R="undefined"==typeof window?c.useEffect:c.useLayoutEffect;function T(e){let t=c.useRef();return void 0===t.current&&(t.current=e()),t}function D(e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}}function _(e){let t=O(),r=()=>e(t.snapshot());return c.useSyncExternalStore(t.subscribe,r,r)}function q(e,t,r,n=[]){let i=c.useRef(),o=g();return R(()=>{var a;let s=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():i.current}})(),u=n.map(e=>e.trim());o.value(e,s,u),null==(a=t.current)||a.setAttribute(y,s),i.current=s}),i}var F=()=>{let[e,t]=c.useState(),r=T(()=>new Map);return R(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function L({asChild:e,children:t},r){let n;return e&&c.isValidElement(t)?c.cloneElement("function"==typeof(n=t.type)?n(t.props):"render"in n?n.render(t.props):t,{ref:t.ref},r(t.props.children)):r(t)}var N={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"}},68628:function(e,t,r){"use strict";function n(e=[],t=[]){let r=Math.min(e.length,t.length),n=0,i=0,o=0,a=0;for(;a1&&void 0!==arguments[1]?arguments[1]:{},r=t.localeMatcher||"lookup";switch(r){case"lookup":case"best fit":return function(e){var t=s(e);if(t)return t;for(var r=e.split("-");e.length>1;){r.pop();var n=s(e=r.join("-"));if(n)return n}}(e);default:throw RangeError('Invalid "localeMatcher" option: '.concat(r))}}var c={af:function(e){return 1==e?"one":"other"},am:function(e){return e>=0&&e<=1?"one":"other"},ar:function(e){var t=String(e).split("."),r=Number(t[0])==e&&t[0].slice(-2);return 0==e?"zero":1==e?"one":2==e?"two":r>=3&&r<=10?"few":r>=11&&r<=99?"many":"other"},ast:function(e){var t=!String(e).split(".")[1];return 1==e&&t?"one":"other"},be:function(e){var t=String(e).split("."),r=Number(t[0])==e,n=r&&t[0].slice(-1),i=r&&t[0].slice(-2);return 1==n&&11!=i?"one":n>=2&&n<=4&&(i<12||i>14)?"few":r&&0==n||n>=5&&n<=9||i>=11&&i<=14?"many":"other"},br:function(e){var t=String(e).split("."),r=Number(t[0])==e,n=r&&t[0].slice(-1),i=r&&t[0].slice(-2),o=r&&t[0].slice(-6);return 1==n&&11!=i&&71!=i&&91!=i?"one":2==n&&12!=i&&72!=i&&92!=i?"two":(3==n||4==n||9==n)&&(i<10||i>19)&&(i<70||i>79)&&(i<90||i>99)?"few":0!=e&&r&&0==o?"many":"other"},bs:function(e){var t=String(e).split("."),r=t[0],n=t[1]||"",i=!t[1],o=r.slice(-1),a=r.slice(-2),s=n.slice(-1),u=n.slice(-2);return i&&1==o&&11!=a||1==s&&11!=u?"one":i&&o>=2&&o<=4&&(a<12||a>14)||s>=2&&s<=4&&(u<12||u>14)?"few":"other"},ca:function(e){var t=String(e).split("."),r=t[0],n=!t[1],i=r.slice(-6);return 1==e&&n?"one":0!=r&&0==i&&n?"many":"other"},ceb:function(e){var t=String(e).split("."),r=t[0],n=t[1]||"",i=!t[1],o=r.slice(-1),a=n.slice(-1);return i&&(1==r||2==r||3==r)||i&&4!=o&&6!=o&&9!=o||!i&&4!=a&&6!=a&&9!=a?"one":"other"},cs:function(e){var t=String(e).split("."),r=t[0],n=!t[1];return 1==e&&n?"one":r>=2&&r<=4&&n?"few":n?"other":"many"},cy:function(e){return 0==e?"zero":1==e?"one":2==e?"two":3==e?"few":6==e?"many":"other"},da:function(e){var t=String(e).split("."),r=t[0],n=Number(t[0])==e;return 1!=e&&(n||0!=r&&1!=r)?"other":"one"},dsb:function(e){var t=String(e).split("."),r=t[0],n=t[1]||"",i=!t[1],o=r.slice(-2),a=n.slice(-2);return i&&1==o||1==a?"one":i&&2==o||2==a?"two":i&&(3==o||4==o)||3==a||4==a?"few":"other"},dz:function(e){return"other"},es:function(e){var t=String(e).split("."),r=t[0],n=!t[1],i=r.slice(-6);return 1==e?"one":0!=r&&0==i&&n?"many":"other"},ff:function(e){return e>=0&&e<2?"one":"other"},fr:function(e){var t=String(e).split("."),r=t[0],n=!t[1],i=r.slice(-6);return e>=0&&e<2?"one":0!=r&&0==i&&n?"many":"other"},ga:function(e){var t=Number(String(e).split(".")[0])==e;return 1==e?"one":2==e?"two":t&&e>=3&&e<=6?"few":t&&e>=7&&e<=10?"many":"other"},gd:function(e){var t=Number(String(e).split(".")[0])==e;return 1==e||11==e?"one":2==e||12==e?"two":t&&e>=3&&e<=10||t&&e>=13&&e<=19?"few":"other"},he:function(e){var t=String(e).split("."),r=t[0],n=!t[1];return 1==r&&n||0==r&&!n?"one":2==r&&n?"two":"other"},is:function(e){var t=String(e).split("."),r=t[0],n=(t[1]||"").replace(/0+$/,""),i=Number(t[0])==e,o=r.slice(-1),a=r.slice(-2);return i&&1==o&&11!=a||n%10==1&&n%100!=11?"one":"other"},ksh:function(e){return 0==e?"zero":1==e?"one":"other"},lt:function(e){var t=String(e).split("."),r=t[1]||"",n=Number(t[0])==e,i=n&&t[0].slice(-1),o=n&&t[0].slice(-2);return 1==i&&(o<11||o>19)?"one":i>=2&&i<=9&&(o<11||o>19)?"few":0!=r?"many":"other"},lv:function(e){var t=String(e).split("."),r=t[1]||"",n=r.length,i=Number(t[0])==e,o=i&&t[0].slice(-1),a=i&&t[0].slice(-2),s=r.slice(-2),u=r.slice(-1);return i&&0==o||a>=11&&a<=19||2==n&&s>=11&&s<=19?"zero":1==o&&11!=a||2==n&&1==u&&11!=s||2!=n&&1==u?"one":"other"},mk:function(e){var t=String(e).split("."),r=t[0],n=t[1]||"",i=!t[1],o=r.slice(-1),a=r.slice(-2),s=n.slice(-1),u=n.slice(-2);return i&&1==o&&11!=a||1==s&&11!=u?"one":"other"},mt:function(e){var t=String(e).split("."),r=Number(t[0])==e&&t[0].slice(-2);return 1==e?"one":2==e?"two":0==e||r>=3&&r<=10?"few":r>=11&&r<=19?"many":"other"},pa:function(e){return 0==e||1==e?"one":"other"},pl:function(e){var t=String(e).split("."),r=t[0],n=!t[1],i=r.slice(-1),o=r.slice(-2);return 1==e&&n?"one":n&&i>=2&&i<=4&&(o<12||o>14)?"few":n&&1!=r&&(0==i||1==i)||n&&i>=5&&i<=9||n&&o>=12&&o<=14?"many":"other"},pt:function(e){var t=String(e).split("."),r=t[0],n=!t[1],i=r.slice(-6);return 0==r||1==r?"one":0!=r&&0==i&&n?"many":"other"},ro:function(e){var t=String(e).split("."),r=!t[1],n=Number(t[0])==e&&t[0].slice(-2);return 1==e&&r?"one":!r||0==e||1!=e&&n>=1&&n<=19?"few":"other"},ru:function(e){var t=String(e).split("."),r=t[0],n=!t[1],i=r.slice(-1),o=r.slice(-2);return n&&1==i&&11!=o?"one":n&&i>=2&&i<=4&&(o<12||o>14)?"few":n&&0==i||n&&i>=5&&i<=9||n&&o>=11&&o<=14?"many":"other"},se:function(e){return 1==e?"one":2==e?"two":"other"},si:function(e){var t=String(e).split("."),r=t[0],n=t[1]||"";return 0==e||1==e||0==r&&1==n?"one":"other"},sl:function(e){var t=String(e).split("."),r=t[0],n=!t[1],i=r.slice(-2);return n&&1==i?"one":n&&2==i?"two":n&&(3==i||4==i)||!n?"few":"other"}};function l(e){return"pt-PT"===e?e:function(e){var t=e.match(f);if(!t)throw TypeError("Invalid locale: ".concat(e));return t[1]}(e)}c.as=c.am,c.az=c.af,c.bg=c.af,c.bn=c.am,c.brx=c.af,c.ce=c.af,c.chr=c.af,c.de=c.ast,c.ee=c.af,c.el=c.af,c.en=c.ast,c.et=c.ast,c.eu=c.af,c.fa=c.am,c.fi=c.ast,c.fil=c.ceb,c.fo=c.af,c.fur=c.af,c.fy=c.ast,c.gl=c.ast,c.gu=c.am,c.ha=c.af,c.hi=c.am,c.hr=c.bs,c.hsb=c.dsb,c.hu=c.af,c.hy=c.ff,c.ia=c.ast,c.id=c.dz,c.ig=c.dz,c.it=c.ca,c.ja=c.dz,c.jgo=c.af,c.jv=c.dz,c.ka=c.af,c.kea=c.dz,c.kk=c.af,c.kl=c.af,c.km=c.dz,c.kn=c.am,c.ko=c.dz,c.ks=c.af,c.ku=c.af,c.ky=c.af,c.lb=c.af,c.lkt=c.dz,c.lo=c.dz,c.ml=c.af,c.mn=c.af,c.mr=c.af,c.ms=c.dz,c.my=c.dz,c.nb=c.af,c.ne=c.af,c.nl=c.ast,c.nn=c.af,c.no=c.af,c.or=c.af,c.pcm=c.am,c.ps=c.af,c.rm=c.af,c.sah=c.dz,c.sc=c.ast,c.sd=c.af,c.sk=c.cs,c.so=c.af,c.sq=c.af,c.sr=c.bs,c.su=c.dz,c.sv=c.ast,c.sw=c.ast,c.ta=c.af,c.te=c.af,c.th=c.dz,c.ti=c.pa,c.tk=c.af,c.to=c.dz,c.tr=c.af,c.ug=c.af,c.uk=c.ru,c.ur=c.ast,c.uz=c.af,c.vi=c.dz,c.wae=c.af,c.wo=c.dz,c.xh=c.af,c.yi=c.ast,c.yo=c.dz,c.yue=c.dz,c.zh=c.dz,c.zu=c.am;var f=/^([a-z0-9]+)/i;function d(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t);var n=r.numeric,o=r.style,a=r.localeMatcher;if(this.numeric="always",this.style="long",this.localeMatcher="lookup",void 0!==n){if(0>w.indexOf(n))throw RangeError('Invalid "numeric" option: '.concat(n));this.numeric=n}if(void 0!==o){if(0>O.indexOf(o))throw RangeError('Invalid "style" option: '.concat(o));this.style=o}if(void 0!==a){if(0>S.indexOf(a))throw RangeError('Invalid "localeMatcher" option: '.concat(a));this.localeMatcher=a}if("string"==typeof e&&(e=[e]),e.push(i),this.locale=t.supportedLocalesOf(e,{localeMatcher:this.localeMatcher})[0],!this.locale)throw Error("No supported locale was found");h.supportedLocalesOf(this.locale).length>0?this.pluralRules=new h(this.locale):console.warn('"'.concat(this.locale,'" locale is not supported')),"undefined"!=typeof Intl&&Intl.NumberFormat?(this.numberFormat=new Intl.NumberFormat(this.locale),this.numberingSystem=this.numberFormat.resolvedOptions().numberingSystem):this.numberingSystem="latn",this.locale=u(this.locale,{localeMatcher:this.localeMatcher})}return e=[{key:"format",value:function(){var e=C(arguments),t=b(e,2),r=t[0],n=t[1];return this.getRule(r,n).replace("{0}",this.formatNumber(Math.abs(r)))}},{key:"formatToParts",value:function(){var e=C(arguments),t=b(e,2),r=t[0],n=t[1],i=this.getRule(r,n),o=i.indexOf("{0}");if(o<0)return[{type:"literal",value:i}];var a=[];return o>0&&a.push({type:"literal",value:i.slice(0,o)}),a=a.concat(this.formatNumberToParts(Math.abs(r)).map(function(e){return y(y({},e),{},{unit:n})})),o+31&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e)e=[e];else if(!Array.isArray(e))throw TypeError('Invalid "locales" argument');return e.filter(function(e){return u(e,t)})},P.addLocale=function(e){if(!e)throw Error("No locale data passed");o[e.locale]=e,a[e.locale.toLowerCase()]=e.locale},P.setDefaultLocale=function(e){i=e},P.getDefaultLocale=function(){return i},P.PluralRules=h;var j='Invalid "unit" argument';function C(e){if(e.length<2)throw TypeError('"unit" argument is required');return[function(e){if(e=Number(e),Number.isFinite&&!Number.isFinite(e))throw RangeError("".concat('Invalid "number" argument',": ").concat(e));return e}(e[0]),function(e){if("symbol"===p(e))throw TypeError(j);if("string"!=typeof e||("s"===e[e.length-1]&&(e=e.slice(0,e.length-1)),0>g.indexOf(e)))throw RangeError("".concat(j,": ").concat(e));return e}(e[1])]}function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var k=function(){var e;function t(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.cache={}}return e=[{key:"get",value:function(){for(var e=this.cache,t=arguments.length,r=Array(t),n=0;ne.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.polyfill;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),"string"==typeof e&&(e=[e]),this.locale=function(e,t){for(var r,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return M(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return M(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(r=n()).done;){var i=r.value;if(t(i))return i;for(var o=i.split("-");o.length>1;)if(o.pop(),t(i=o.join("-")))return i}throw Error("No locale data has been registered for any of the locales: ".concat(e.join(", ")))}(e.concat(t.getDefaultLocale()),z),"undefined"!=typeof Intl&&Intl.NumberFormat&&(this.numberFormat=new Intl.NumberFormat(this.locale)),!1===n?(this.IntlRelativeTimeFormat=Intl.RelativeTimeFormat,this.IntlPluralRules=Intl.PluralRules):(this.IntlRelativeTimeFormat=P,this.IntlPluralRules=P.PluralRules),this.relativeTimeFormatCache=new k,this.pluralRulesCache=new k}return e=[{key:"format",value:function(e,t,r){r||(t&&!function(e){return"string"==typeof e||void 0!==A(e)&&null!==e&&e.constructor===I&&(Array.isArray(e.steps)||Array.isArray(e.gradation)||Array.isArray(e.flavour)||"string"==typeof e.flavour||Array.isArray(e.labels)||"string"==typeof e.labels||Array.isArray(e.units)||"function"==typeof e.custom)}(t)?(r=t,t=void 0):r={}),t||(t=Z),"string"==typeof t&&(t=function(e){switch(e){case"default":case"round":return V;case"round-minute":return Z;case"approximate":default:return H;case"time":case"approximate-time":return Q;case"mini":return ed;case"mini-now":return em;case"mini-minute":return ev;case"mini-minute-now":return eO;case"twitter":return Y;case"twitter-now":return er;case"twitter-minute":return eo;case"twitter-minute-now":return eu;case"twitter-first-minute":return ef}}(t));var n,i,o,a,s,u,c,l=function(e){if(e.constructor===Date||"object"===eS(e)&&"function"==typeof e.getTime)return e.getTime();if("number"==typeof e)return e;throw Error("Unsupported relative time formatter input: ".concat(eS(e),", ").concat(e))}(e),f=this.getLabels(t.flavour||t.labels),d=f.labels,h=f.labelsType;void 0!==t.now&&(c=t.now),void 0===c&&void 0!==r.now&&(c=r.now),void 0===c&&(c=Date.now());var p=(c-l)/1e3,m=r.future||p<0,y=(n=z(this.locale).now,i=z(this.locale).long,(o=d.now||n&&n.now)?"string"==typeof o?o:m?o.future:o.past:i&&i.second&&i.second.current?i.second.current:void 0);if(t.custom){var b=t.custom({now:c,date:new Date(l),time:l,elapsed:p,locale:this.locale});if(void 0!==b)return b}var v=(a=t.units,s=Object.keys(d),y&&s.push("now"),a&&(s=a.filter(function(e){return"now"===e||s.indexOf(e)>=0})),s),g=r.round||t.round,w=function(e){if(Array.isArray(e))return e}(u=function(e,t,r){var n=r.now,i=r.future,o=r.round,a=r.units,s=r.getNextStep,u=function(e,t,r){var n=r.now,i=r.future,o=r.round;if(0!==e.length){var a=function e(t,r,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=F(t[i],function(e){for(var t=1;t0?e[a-1]:s}}}(e=e.filter(function(e){var t=e.unit,r=e.formatAs;return!(t=t||r)||a.indexOf(t)>=0}),t,{now:n,future:i,round:o});if(s){if(u){var c=e[e.indexOf(u)-1],l=e[e.indexOf(u)+1];return[c,u,l]}return[void 0,void 0,e[0]]}return u}(t.gradation||t.steps||Z.steps,p,{now:c,units:v,round:g,future:m,getNextStep:!0}))||function(e,t){var r,n,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(r=i.next()).done)&&(o.push(r.value),3!==o.length);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw n}}return o}}(u,3)||eP(u,3)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),O=w[0],S=w[1],P=w[2],j=this.formatDateForStep(l,S,p,{labels:d,labelsType:h,nowLabel:y,now:c,future:m,round:g})||"";return r.getTimeToNextUpdate?[j,function(e,t,r){var n,i=r.prevStep,o=r.nextStep,a=r.now,s=r.future,u=r.round,c=e.getTime?e.getTime():e,l=function(e){return function(e,t,r){var n=r.now,i=r.round;if(R(e)){var o=1e3*R(e),a=Math.abs(t-n),s=D(i)(a/o)*o;return t>n?s>0?a-s+((1-_(i))*o+1):a-s+1:-(a-s)+_(i)*o}}(e,c,{now:a,round:u})},f=function(e,t,r){var n=r.now,i=r.future,o=r.round,a=r.prevStep;if(e){var s,u,c,l,f=void 0===(l=F(e,{timestamp:t,now:u=(s={now:n,future:i,round:o,prevStep:a}).now,future:c=s.future,round:s.round,prevStep:s.prevStep}))?void 0:c?t-1e3*l+1:0===l&&t===u?31536e9:t+1e3*l;if(void 0===f)return;return f-n}return i?t-n+1:31536e9}(s?t:o,c,{future:s,now:a,round:u,prevStep:s?i:t});if(void 0!==f){if(t&&(t.getTimeToNextUpdate&&(n=t.getTimeToNextUpdate(c,{getTimeToNextUpdateForUnit:l,getRoundFunction:D,now:a,future:s,round:u})),void 0===n)){var d=t.unit||t.formatAs;d&&(n=l(d))}return void 0===n?f:Math.min(n,f)}}(l,S,{nextStep:P,prevStep:O,now:c,future:m,round:g})]:j}},{key:"formatDateForStep",value:function(e,t,r,n){var i=this,o=n.labels,a=n.labelsType,s=n.nowLabel,u=n.now,c=n.future,l=n.round;if(t){if(t.format)return t.format(e,this.locale,{formatAs:function(e,t){return i.formatValue(t,e,{labels:o,future:c})},now:u,future:c});var f=t.unit||t.formatAs;if(!f)throw Error("[javascript-time-ago] Each step must define either `formatAs` or `format()`. Step: ".concat(JSON.stringify(t)));if("now"===f)return s;var d=Math.abs(r)/T(t);t.granularity&&(d=D(l)(d/t.granularity)*t.granularity);var h=-1*Math.sign(r)*D(l)(d);switch(0===h&&(h=c?0:-0),a){case"long":case"short":case"narrow":return this.getFormatter(a).format(h,f);default:return this.formatValue(h,f,{labels:o,future:c})}}}},{key:"formatValue",value:function(e,t,r){var n=r.labels,i=r.future;return this.getFormattingRule(n,t,e,{future:i}).replace("{0}",this.formatNumber(Math.abs(e)))}},{key:"getFormattingRule",value:function(e,t,r,n){var i=n.future;if(this.locale,"string"==typeof(e=e[t]))return e;var o=e[0===r?i?"future":"past":r<0?"past":"future"]||e;return"string"==typeof o?o:o[this.getPluralRules().select(Math.abs(r))]||o.other}},{key:"formatNumber",value:function(e){return this.numberFormat?this.numberFormat.format(e):String(e)}},{key:"getFormatter",value:function(e){return this.relativeTimeFormatCache.get(this.locale,e)||this.relativeTimeFormatCache.put(this.locale,e,new this.IntlRelativeTimeFormat(this.locale,{style:e}))}},{key:"getPluralRules",value:function(){return this.pluralRulesCache.get(this.locale)||this.pluralRulesCache.put(this.locale,new this.IntlPluralRules(this.locale))}},{key:"getLabels",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];"string"==typeof e&&(e=[e]),e=(e=e.map(function(e){switch(e){case"tiny":case"mini-time":return"mini";default:return e}})).concat("long");for(var t,r=z(this.locale),n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=eP(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(t=n()).done;){var i=t.value;if(r[i])return{labelsType:i,labels:r[i]}}}}],function(e,t){for(var r=0;r512){n="",o=0;for(let e=0;e<256;e++)n+=(256+256*Math.random()|0).toString(16).substring(1)}return n.substring(o,o+++e)}()};return Object.assign(y,{extend:function e(t){return r=>{let n=r(t);for(let e in y)delete n[e];let i={...t,...n};return Object.assign(i,{extend:e(i)})}}(y)})}},36655:function(e,t,r){"use strict";r.d(t,{q:function(){return s}});var n=r(48926),i=r(4456),o=r(96329),a=r(39881);function s({key:e,name:t,request:r,retryCount:s=3,retryDelay:u=150,timeout:c,type:l},f){return{config:{key:e,name:t,request:r,retryCount:s,retryDelay:u,timeout:c,type:l},request:function(e,t={}){return async(r,s={})=>{let{retryDelay:u=150,retryCount:c=3}={...t,...s};return(0,a.J)(async()=>{try{return await e(r)}catch(e){switch(e.code){case o.s7.code:throw new o.s7(e);case o.B.code:throw new o.B(e);case o.LX.code:throw new o.LX(e);case o.nY.code:throw new o.nY(e);case o.XS.code:throw new o.XS(e);case o.yR.code:throw new o.yR(e);case o.Og.code:throw new o.Og(e);case o.pT.code:throw new o.pT(e);case o.KB.code:throw new o.KB(e);case o.gS.code:throw new o.gS(e);case o.Pv.code:throw new o.Pv(e);case o.GD.code:throw new o.GD(e);case o.ab.code:throw new o.ab(e);case o.PE.code:throw new o.PE(e);case o.Ts.code:throw new o.Ts(e);case o.u5.code:throw new o.u5(e);case o.I0.code:throw new o.I0(e);case o.x3.code:throw new o.x3(e);case 5e3:throw new o.ab(e);default:if(e instanceof n.G)throw e;throw new o.ir(e)}}},{delay:({count:e,error:t})=>{if(t&&t instanceof i.Gg){let e=t?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*Number.parseInt(e)}return~~(1<"code"in e&&"number"==typeof e.code?-1===e.code||e.code===o.Pv.code||e.code===o.XS.code:!(e instanceof i.Gg)||!e.status||403===e.status||408===e.status||413===e.status||429===e.status||500===e.status||502===e.status||503===e.status||504===e.status})}}(r,{retryCount:s,retryDelay:u}),value:f}}},87446:function(e,t,r){"use strict";r.d(t,{d:function(){return f}});var n=r(4456),i=r(48926);class o extends i.G{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}let a=new Map;var s=r(13581),u=r(47499);let c={current:0,take(){return this.current++},reset(){this.current=0}};var l=r(36655);function f(e,t={}){let{batch:r,fetchOptions:i,key:f="http",name:d="HTTP JSON-RPC",onFetchRequest:h,onFetchResponse:p,retryDelay:m}=t;return({chain:y,retryCount:b,timeout:v})=>{let{batchSize:g=1e3,wait:w=0}="object"==typeof r?r:{},O=t.retryCount??b,S=v??t.timeout??1e4,P=e||y?.rpcUrls.default.http[0];if(!P)throw new o;let j=function(e,t={}){return{async request(r){let{body:i,onRequest:o=t.onRequest,onResponse:a=t.onResponse,timeout:l=t.timeout??1e4}=r,f={...t.fetchOptions??{},...r.fetchOptions??{}},{headers:d,method:h,signal:p}=f;try{let t;let r=await (0,s.F)(async({signal:t})=>{let r={...f,body:Array.isArray(i)?(0,u.P)(i.map(e=>({jsonrpc:"2.0",id:e.id??c.take(),...e}))):(0,u.P)({jsonrpc:"2.0",id:i.id??c.take(),...i}),headers:{...d,"Content-Type":"application/json"},method:h||"POST",signal:p||(l>0?t:null)},n=new Request(e,r);return o&&await o(n),await fetch(e,r)},{errorInstance:new n.W5({body:i,url:e}),timeout:l,signal:!0});if(a&&await a(r),r.headers.get("Content-Type")?.startsWith("application/json")?t=await r.json():(t=await r.text(),t=JSON.parse(t||"{}")),!r.ok)throw new n.Gg({body:i,details:(0,u.P)(t.error)||r.statusText,headers:r.headers,status:r.status,url:e});return t}catch(t){if(t instanceof n.Gg||t instanceof n.W5)throw t;throw new n.Gg({body:i,details:t.message,url:e})}}}}(P,{fetchOptions:i,onRequest:h,onResponse:p,timeout:S});return(0,l.q)({key:f,name:d,async request({method:e,params:t}){let i={method:e,params:t},{schedule:o}=function({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:i}){let o=async()=>{let t=c();s();let r=t.map(({args:e})=>e);0!==r.length&&e(r).then(e=>{i&&Array.isArray(e)&&e.sort(i);for(let r=0;r{for(let r=0;ra.delete(t),u=()=>c().map(({args:e})=>e),c=()=>a.get(t)||[],l=e=>a.set(t,[...c(),e]);return{flush:s,async schedule(e){let t={},i=new Promise((e,r)=>{t.resolve=e,t.reject=r});return(r?.([...u(),e])&&o(),c().length>0)?l({args:e,pendingPromise:t}):(l({args:e,pendingPromise:t}),setTimeout(o,n)),i}}}({id:P,wait:w,shouldSplitBatch:e=>e.length>g,fn:e=>j.request({body:e}),sort:(e,t)=>e.id-t.id}),s=async e=>r?o(e):[await j.request({body:e})],[{error:u,result:c}]=await s(i);if(u)throw new n.bs({body:i,error:u,url:P});return c},retryCount:O,retryDelay:m,timeout:S,type:"http"},{fetchOptions:i,url:P})}}},4456:function(e,t,r){"use strict";r.d(t,{Gg:function(){return a},W5:function(){return u},bs:function(){return s}});var n=r(47499),i=r(48926),o=r(94290);class a extends i.G{constructor({body:e,details:t,headers:r,status:i,url:a}){super("HTTP request failed.",{details:t,metaMessages:[i&&`Status: ${i}`,`URL: ${(0,o.Gr)(a)}`,e&&`Request body: ${(0,n.P)(e)}`].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=r,this.status=i,this.url=a}}class s extends i.G{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${(0,o.Gr)(r)}`,`Request body: ${(0,n.P)(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}}class u extends i.G{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${(0,o.Gr)(t)}`,`Request body: ${(0,n.P)(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}}},96329:function(e,t,r){"use strict";r.d(t,{B:function(){return u},GD:function(){return v},I0:function(){return P},KB:function(){return m},LX:function(){return c},Og:function(){return h},PE:function(){return w},Pv:function(){return b},Ts:function(){return O},XS:function(){return f},ab:function(){return g},gS:function(){return y},ir:function(){return C},nY:function(){return l},pT:function(){return p},s7:function(){return s},u5:function(){return S},x3:function(){return j},yR:function(){return d}});var n=r(48926),i=r(4456);class o extends n.G{constructor(e,{code:t,docsPath:r,metaMessages:n,shortMessage:o}){super(o,{cause:e,docsPath:r,metaMessages:n||e?.metaMessages}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.code=e instanceof i.bs?e.code:t??-1}}class a extends o{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class s extends o{constructor(e){super(e,{code:s.code,shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ParseRpcError"})}}Object.defineProperty(s,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class u extends o{constructor(e){super(e,{code:u.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}}Object.defineProperty(u,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class c extends o{constructor(e){super(e,{code:c.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}}Object.defineProperty(c,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class l extends o{constructor(e){super(e,{code:l.code,shortMessage:"Invalid parameters were provided to the RPC method.\nDouble check you have provided the correct parameters."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"})}}Object.defineProperty(l,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class f extends o{constructor(e){super(e,{code:f.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}}Object.defineProperty(f,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class d extends o{constructor(e){super(e,{code:d.code,shortMessage:"Missing or invalid parameters.\nDouble check you have provided the correct parameters."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}}Object.defineProperty(d,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class h extends o{constructor(e){super(e,{code:h.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(h,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class p extends o{constructor(e){super(e,{code:p.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}}Object.defineProperty(p,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class m extends o{constructor(e){super(e,{code:m.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}}Object.defineProperty(m,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class y extends o{constructor(e){super(e,{code:y.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}}Object.defineProperty(y,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class b extends o{constructor(e){super(e,{code:b.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}}Object.defineProperty(b,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class v extends o{constructor(e){super(e,{code:v.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}}Object.defineProperty(v,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class g extends a{constructor(e){super(e,{code:g.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}}Object.defineProperty(g,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class w extends a{constructor(e){super(e,{code:w.code,shortMessage:"The requested method and/or account has not been authorized by the user."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnauthorizedProviderError"})}}Object.defineProperty(w,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class O extends a{constructor(e){super(e,{code:O.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}}Object.defineProperty(O,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class S extends a{constructor(e){super(e,{code:S.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}}Object.defineProperty(S,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class P extends a{constructor(e){super(e,{code:P.code,shortMessage:"The Provider is not connected to the requested chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDisconnectedError"})}}Object.defineProperty(P,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class j extends a{constructor(e){super(e,{code:j.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}}Object.defineProperty(j,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class C extends o{constructor(e){super(e,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}}},95258:function(e,t,r){"use strict";function n(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}r.d(t,{a:function(){return n}})},39881:function(e,t,r){"use strict";async function n(e){return new Promise(t=>setTimeout(t,e))}function i(e,{delay:t=100,retryCount:r=2,shouldRetry:i=()=>!0}={}){return new Promise((o,a)=>{let s=async({count:u=0}={})=>{let c=async({error:e})=>{let r="function"==typeof t?t({count:u,error:e}):t;r&&await n(r),s({count:u+1})};try{let t=await e();o(t)}catch(e){if(u{(async()=>{let a;try{let s=new AbortController;r>0&&(a=setTimeout(()=>{n?s.abort():o(t)},r)),i(await e({signal:s?.signal||null}))}catch(e){e?.name==="AbortError"&&o(t),o(e)}finally{clearTimeout(a)}})()})}r.d(t,{F:function(){return n}})},47499:function(e,t,r){"use strict";r.d(t,{P:function(){return n}});let n=(e,t,r)=>JSON.stringify(e,(e,r)=>{let n="bigint"==typeof r?r.toString():r;return"function"==typeof t?t(e,n):n},r)},40181:function(e,t,r){"use strict";r.d(t,{V:function(){return s},F:function(){return u}});var n=r(2265);let i=!1;async function o(e,t={}){let r;if(i)return[];i=!0,e.setState(e=>({...e,status:e.current?"reconnecting":"connecting"}));let n=[];if(t.connectors?.length)for(let r of t.connectors){let t;t="function"==typeof r?e._internal.connectors.setup(r):r,n.push(t)}else n.push(...e.connectors);try{r=await e.storage?.getItem("recentConnectorId")}catch{}let o={};for(let[,t]of e.state.connections)o[t.connector.id]=1;r&&(o[r]=0);let a=Object.keys(o).length>0?[...n].sort((e,t)=>(o[e.id]??10)-(o[t.id]??10)):n,s=!1,u=[],c=[];for(let t of a){let r=await t.getProvider().catch(()=>void 0);if(!r||c.some(e=>e===r)||!await t.isAuthorized())continue;let n=await t.connect({isReconnecting:!0}).catch(()=>null);n&&(t.emitter.off("connect",e._internal.events.connect),t.emitter.on("change",e._internal.events.change),t.emitter.on("disconnect",e._internal.events.disconnect),e.setState(e=>{let r=new Map(s?e.connections:new Map).set(t.uid,{accounts:n.accounts,chainId:n.chainId,connector:t});return{...e,current:s?e.current:t.uid,connections:r}}),u.push({accounts:n.accounts,chainId:n.chainId,connector:t}),c.push(r),s=!0)}return("reconnecting"===e.state.status||"connecting"===e.state.status)&&(s?e.setState(e=>({...e,status:"connected"})):e.setState(e=>({...e,connections:new Map,current:null,status:"disconnected"}))),i=!1,u}function a(e){let{children:t,config:r,initialState:i,reconnectOnMount:a=!0}=e,{onMount:s}=function(e,t){let{initialState:r,reconnectOnMount:n}=t;return r&&!e._internal.store.persist.hasHydrated()&&e.setState({...r,connections:n?r.connections:new Map,status:n?"reconnecting":"disconnected"}),{async onMount(){if(e._internal.ssr){await e._internal.store.persist.rehydrate();let t=e._internal.mipd?.getProviders().map(e._internal.connectors.providerDetailToConnector).map(e._internal.connectors.setup);e._internal.connectors.setState(e=>[...e,...t??[]])}n?o(e):e.storage&&e.setState(e=>({...e,connections:new Map}))}}}(r,{initialState:i,reconnectOnMount:a});r._internal.ssr||s();let u=(0,n.useRef)(!0);return(0,n.useEffect)(()=>{if(u.current&&r._internal.ssr)return s(),()=>{u.current=!1}},[]),t}let s=(0,n.createContext)(void 0);function u(e){let{children:t,config:r}=e;return(0,n.createElement)(a,e,(0,n.createElement)(s.Provider,{value:r},t))}},4842:function(e,t,r){"use strict";r.d(t,{m:function(){return c}});var n=r(90331);function i(e){let t=e.state.current,r=e.state.connections.get(t),n=r?.accounts,i=n?.[0],o=e.chains.find(e=>e.id===r?.chainId),a=e.state.status;switch(a){case"connected":return{address:i,addresses:n,chain:o,chainId:r?.chainId,connector:r?.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:a};case"reconnecting":return{address:i,addresses:n,chain:o,chainId:r?.chainId,connector:r?.connector,isConnected:!!i,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:a};case"connecting":return{address:i,addresses:n,chain:o,chainId:r?.chainId,connector:r?.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:a};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:a}}}var o=r(94956),a=r(2265),s=r(35006);let u=e=>"object"==typeof e&&!Array.isArray(e);function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,o.Z)(e);return function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.v,o=(0,a.useRef)([]),c=(0,s.useSyncExternalStoreWithSelector)(e,t,r,e=>e,(e,t)=>{if(u(e)&&u(t)&&o.current.length){for(let r of o.current)if(!i(e[r],t[r]))return!1;return!0}return i(e,t)});if(u(c)){let e={...c},t={};for(let[r,n]of Object.entries(e))t={...t,[r]:{configurable:!1,enumerable:!0,get:()=>(o.current.includes(r)||o.current.push(r),n)}};return Object.defineProperties(e,t),e}return c}(e=>(function(e,t){let{onChange:r}=t;return e.subscribe(()=>i(e),r,{equalityFn(e,t){let{connector:r,...i}=e,{connector:o,...a}=t;return(0,n.v)(i,a)&&r?.id===o?.id&&r?.uid===o?.uid}})})(t,{onChange:e}),()=>i(t))}},94956:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265),i=r(40181),o=r(66564);let a=()=>"wagmi@2.9.11";class s extends o.G{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return a()}}class u extends s{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function c(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null!==(e=t.config)&&void 0!==e?e:(0,n.useContext)(i.V);if(!r)throw new u;return r}},24934:function(e,t,r){"use strict";r.d(t,{$:function(){return f}});var n=r(6007),i=r(85770);async function o(e,t){let r;if((r="function"==typeof t.connector?e._internal.connectors.setup(t.connector):t.connector).uid===e.state.current)throw new i.wi;try{e.setState(e=>({...e,status:"connecting"})),r.emitter.emit("message",{type:"connecting"});let n=await r.connect({chainId:t.chainId}),i=n.accounts;return r.emitter.off("connect",e._internal.events.connect),r.emitter.on("change",e._internal.events.change),r.emitter.on("disconnect",e._internal.events.disconnect),await e.storage?.setItem("recentConnectorId",r.id),e.setState(e=>({...e,connections:new Map(e.connections).set(r.uid,{accounts:i,chainId:n.chainId,connector:r}),current:r.uid,status:"connected"})),{accounts:i,chainId:n.chainId}}catch(t){throw e.setState(e=>({...e,status:e.current?"connected":"disconnected"})),t}}var a=r(2265),s=r(94956),u=r(90331);let c=[];function l(e){let t=e.connectors;return(0,u.v)(c,t)?c:(c=t,t)}function f(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{mutation:t}=e,r=(0,s.Z)(e),{mutate:i,mutateAsync:u,...c}=(0,n.D)({...t,mutationFn:e=>o(r,e),mutationKey:["connect"]});return(0,a.useEffect)(()=>r.subscribe(e=>{let{status:t}=e;return t},(e,t)=>{"connected"===t&&"disconnected"===e&&c.reset()}),[r,c.reset]),{...c,connect:i,connectAsync:u,connectors:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,s.Z)(e);return(0,a.useSyncExternalStore)(e=>(function(e,t){let{onChange:r}=t;return e._internal.connectors.subscribe((e,t)=>{r(Object.values(e),t)})})(t,{onChange:e}),()=>l(t),()=>l(t))}({config:r})}}},74703:function(e,t,r){"use strict";r.d(t,{q:function(){return l}});var n=r(6007);async function i(e,t={}){let r;if(t.connector)r=t.connector;else{let{connections:t,current:n}=e.state,i=t.get(n);r=i?.connector}let n=e.state.connections;r&&(await r.disconnect(),r.emitter.off("change",e._internal.events.change),r.emitter.off("disconnect",e._internal.events.disconnect),r.emitter.on("connect",e._internal.events.connect),n.delete(r.uid)),e.setState(e=>{if(0===n.size)return{...e,connections:new Map,current:null,status:"disconnected"};let t=n.values().next().value;return{...e,connections:new Map(n),current:t.connector.uid}});{let t=e.state.current;if(!t)return;let r=e.state.connections.get(t)?.connector;if(!r)return;await e.storage?.setItem("recentConnectorId",r.id)}}var o=r(94956),a=r(90331);let s=[];function u(e){let t=[...e.state.connections.values()];return"reconnecting"===e.state.status||(0,a.v)(s,t)?s:(s=t,t)}var c=r(2265);function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{mutation:t}=e,r=(0,o.Z)(e),{mutate:s,mutateAsync:l,...f}=(0,n.D)({...t,mutationFn:e=>i(r,e),mutationKey:["disconnect"]});return{...f,connectors:(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,o.Z)(e);return(0,c.useSyncExternalStore)(e=>(function(e,t){let{onChange:r}=t;return e.subscribe(()=>u(e),r,{equalityFn:a.v})})(t,{onChange:e}),()=>u(t),()=>u(t))})({config:r}).map(e=>e.connector),disconnect:s,disconnectAsync:l}}},58961:function(e,t,r){"use strict";r.d(t,{Q:function(){return y}});var n=r(6007),i=r(96104),o=r(48926);class a extends o.G{constructor({docsPath:e}={}){super("Could not find an Account to execute with this Action.\nPlease provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient.",{docsPath:e,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}var s=r(95046);async function u(e,{account:t=e.account,message:r}){if(!t)throw new a({docsPath:"/docs/actions/wallet/signMessage"});let n=(0,i.T)(t);if("local"===n.type)return n.signMessage({message:r});let o="string"==typeof r?(0,s.$G)(r):r.raw instanceof Uint8Array?(0,s.NC)(r.raw):r.raw;return e.request({method:"personal_sign",params:[o,n.address]},{retryCount:0})}var c=r(500),l=r(36655),f=r(99112),d=r(85770);async function h(e,t={}){let r;if(t.connector){let{connector:e}=t,[n,i]=await Promise.all([e.getAccounts(),e.getChainId()]);r={accounts:n,chainId:i,connector:e}}else r=e.state.connections.get(e.state.current);if(!r)throw new d.aH;let n=t.chainId??r.chainId,o=r.connector;if(o.getClient)return o.getClient({chainId:n});let a=(0,i.T)(t.account??r.accounts[0]);a.address=(0,f.K)(a.address);let s=e.chains.find(e=>e.id===n),u=await r.connector.getProvider({chainId:n});if(t.account&&!r.accounts.some(e=>e.toLowerCase()===a.address.toLowerCase()))throw new d.JK({address:a.address,connector:o});return(0,c.e)({account:a,chain:s,name:"Connector Client",transport:e=>(function(e,t={}){let{key:r="custom",name:n="Custom Provider",retryDelay:i}=t;return({retryCount:o})=>(0,l.q)({key:r,name:n,request:e.request.bind(e),retryCount:t.retryCount??o,retryDelay:i,type:"custom"})})(u)({...e,retryCount:0})})}async function p(e,t){let{account:r,connector:n,...i}=t;return(function(e,t,r){let n=e[t.name];if("function"==typeof n)return n;let i=e[r];return"function"==typeof i?i:r=>t(e,r)})("object"==typeof r&&"local"===r.type?e.getClient():await h(e,{account:r,connector:n}),u,"signMessage")({...i,...r?{account:r}:{}})}var m=r(94956);function y(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{mutation:r}=t,i=(e=(0,m.Z)(t),{mutationFn:t=>p(e,t),mutationKey:["signMessage"]}),{mutate:o,mutateAsync:a,...s}=(0,n.D)({...r,...i});return{...s,signMessage:o,signMessageAsync:a}}}}]); \ No newline at end of file diff --git a/_next/static/chunks/868-984cc4aa9dbc4378.js b/_next/static/chunks/868-984cc4aa9dbc4378.js new file mode 100644 index 0000000000000000000000000000000000000000..5c9b68cad1f6dcdc5d491bca0b59571efcf92212 --- /dev/null +++ b/_next/static/chunks/868-984cc4aa9dbc4378.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[868],{44839:function(e,r,o){o.d(r,{W:function(){return t}});function t(){for(var e,r,o=0,t="",n=arguments.length;o{o.nextPart.has(e)||o.nextPart.set(e,{nextPart:new Map,validators:[]}),o=o.nextPart.get(e)}),o}let l=/\s+/;function i(){let e,r,o=0,t="";for(;or[e]||[];return r.isThemeGetter=!0,r}let a=/^\[(?:([a-z-]+):)?(.+)\]$/i,c=/^\d+\/\d+$/,d=new Set(["px","full","screen"]),u=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,p=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,b=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,f=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,m=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function g(e){return x(e)||d.has(e)||c.test(e)}function h(e){return M(e,"length",I)}function x(e){return!!e&&!Number.isNaN(Number(e))}function y(e){return M(e,"number",x)}function w(e){return!!e&&Number.isInteger(Number(e))}function v(e){return e.endsWith("%")&&x(e.slice(0,-1))}function k(e){return a.test(e)}function z(e){return u.test(e)}let j=new Set(["length","size","percentage"]);function C(e){return M(e,j,$)}function S(e){return M(e,"position",$)}let G=new Set(["image","url"]);function P(e){return M(e,G,O)}function E(e){return M(e,"",_)}function N(){return!0}function M(e,r,o){let t=a.exec(e);return!!t&&(t[1]?"string"==typeof r?t[1]===r:r.has(t[1]):o(t[2]))}function I(e){return p.test(e)&&!b.test(e)}function $(){return!1}function _(e){return f.test(e)}function O(e){return m.test(e)}let T=function(e,...r){let o,s,a;let c=function(l){var i;return s=(o={cache:function(e){if(e<1)return{get:()=>void 0,set:()=>{}};let r=0,o=new Map,t=new Map;function n(n,l){o.set(n,l),++r>e&&(r=0,t=o,o=new Map)}return{get(e){let r=o.get(e);return void 0!==r?r:void 0!==(r=t.get(e))?(n(e,r),r):void 0},set(e,r){o.has(e)?o.set(e,r):n(e,r)}}}((i=r.reduce((e,r)=>r(e),e())).cacheSize),splitModifiers:function(e){let r=e.separator,o=1===r.length,t=r[0],n=r.length;return function(e){let l;let i=[],s=0,a=0;for(let c=0;ca?l-a:void 0}}}(i),...function(e){let r=function(e){var r;let{theme:o,prefix:t}=e,l={nextPart:new Map,validators:[]};return(r=Object.entries(e.classGroups),t?r.map(([e,r])=>[e,r.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,r])=>[t+e,r])):e)]):r).forEach(([e,r])=>{(function e(r,o,t,l){r.forEach(r=>{if("string"==typeof r){(""===r?o:n(o,r)).classGroupId=t;return}if("function"==typeof r){if(r.isThemeGetter){e(r(l),o,t,l);return}o.validators.push({validator:r,classGroupId:t});return}Object.entries(r).forEach(([r,i])=>{e(i,n(o,r),t,l)})})})(r,l,e,o)}),l}(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:l}=e;return{getClassGroupId:function(e){let o=e.split("-");return""===o[0]&&1!==o.length&&o.shift(),function e(r,o){if(0===r.length)return o.classGroupId;let t=r[0],n=o.nextPart.get(t),l=n?e(r.slice(1),n):void 0;if(l)return l;if(0===o.validators.length)return;let i=r.join("-");return o.validators.find(({validator:e})=>e(i))?.classGroupId}(o,r)||function(e){if(t.test(e)){let r=t.exec(e)[1],o=r?.substring(0,r.indexOf(":"));if(o)return"arbitrary.."+o}}(e)},getConflictingClassGroupIds:function(e,r){let t=o[e]||[];return r&&l[e]?[...t,...l[e]]:t}}}(i)}).cache.get,a=o.cache.set,c=d,d(l)};function d(e){let r=s(e);if(r)return r;let t=function(e,r){let{splitModifiers:o,getClassGroupId:t,getConflictingClassGroupIds:n}=r,i=new Set;return e.trim().split(l).map(e=>{let{modifiers:r,hasImportantModifier:n,baseClassName:l,maybePostfixModifierPosition:i}=o(e),s=t(i?l.substring(0,i):l),a=!!i;if(!s){if(!i||!(s=t(l)))return{isTailwindClass:!1,originalClassName:e};a=!1}let c=(function(e){if(e.length<=1)return e;let r=[],o=[];return e.forEach(e=>{"["===e[0]?(r.push(...o.sort(),e),o=[]):o.push(e)}),r.push(...o.sort()),r})(r).join(":");return{isTailwindClass:!0,modifierId:n?c+"!":c,classGroupId:s,originalClassName:e,hasPostfixModifier:a}}).reverse().filter(e=>{if(!e.isTailwindClass)return!0;let{modifierId:r,classGroupId:o,hasPostfixModifier:t}=e,l=r+o;return!i.has(l)&&(i.add(l),n(o,t).forEach(e=>i.add(r+e)),!0)}).reverse().map(e=>e.originalClassName).join(" ")}(e,o);return a(e,t),t}return function(){return c(i.apply(null,arguments))}}(function(){let e=s("colors"),r=s("spacing"),o=s("blur"),t=s("brightness"),n=s("borderColor"),l=s("borderRadius"),i=s("borderSpacing"),a=s("borderWidth"),c=s("contrast"),d=s("grayscale"),u=s("hueRotate"),p=s("invert"),b=s("gap"),f=s("gradientColorStops"),m=s("gradientColorStopPositions"),j=s("inset"),G=s("margin"),M=s("opacity"),I=s("padding"),$=s("saturate"),_=s("scale"),O=s("sepia"),T=s("skew"),W=s("space"),R=s("translate"),q=()=>["auto","contain","none"],A=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto",k,r],D=()=>[k,r],F=()=>["",g,h],H=()=>["auto",x,k],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],L=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>["start","end","center","between","around","evenly","stretch"],U=()=>["","0",k],V=()=>["auto","avoid","all","avoid-page","page","left","right","column"],X=()=>[x,y],Y=()=>[x,k];return{cacheSize:500,separator:":",theme:{colors:[N],spacing:[g,h],blur:["none","",z,k],brightness:X(),borderColor:[e],borderRadius:["none","","full",z,k],borderSpacing:D(),borderWidth:F(),contrast:X(),grayscale:U(),hueRotate:Y(),invert:U(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[v,h],inset:B(),margin:B(),opacity:X(),padding:D(),saturate:X(),scale:X(),sepia:U(),skew:Y(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",k]}],container:["container"],columns:[{columns:[z]}],"break-after":[{"break-after":V()}],"break-before":[{"break-before":V()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...J(),k]}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:q()}],"overscroll-x":[{"overscroll-x":q()}],"overscroll-y":[{"overscroll-y":q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",w,k]}],basis:[{basis:B()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",k]}],grow:[{grow:U()}],shrink:[{shrink:U()}],order:[{order:["first","last","none",w,k]}],"grid-cols":[{"grid-cols":[N]}],"col-start-end":[{col:["auto",{span:["full",w,k]},k]}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":[N]}],"row-start-end":[{row:["auto",{span:[w,k]},k]}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",k]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",k]}],gap:[{gap:[b]}],"gap-x":[{"gap-x":[b]}],"gap-y":[{"gap-y":[b]}],"justify-content":[{justify:["normal",...Q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[I]}],px:[{px:[I]}],py:[{py:[I]}],ps:[{ps:[I]}],pe:[{pe:[I]}],pt:[{pt:[I]}],pr:[{pr:[I]}],pb:[{pb:[I]}],pl:[{pl:[I]}],m:[{m:[G]}],mx:[{mx:[G]}],my:[{my:[G]}],ms:[{ms:[G]}],me:[{me:[G]}],mt:[{mt:[G]}],mr:[{mr:[G]}],mb:[{mb:[G]}],ml:[{ml:[G]}],"space-x":[{"space-x":[W]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[W]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",k,r]}],"min-w":[{"min-w":[k,r,"min","max","fit"]}],"max-w":[{"max-w":[k,r,"none","full","min","max","fit","prose",{screen:[z]},z]}],h:[{h:[k,r,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[k,r,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[k,r,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[k,r,"auto","min","max","fit"]}],"font-size":[{text:["base",z,h]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",y]}],"font-family":[{font:[N]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",k]}],"line-clamp":[{"line-clamp":["none",x,y]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",g,k]}],"list-image":[{"list-image":["none",k]}],"list-style-type":[{list:["none","disc","decimal",k]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[M]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[M]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",g,h]}],"underline-offset":[{"underline-offset":["auto",g,k]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",k]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",k]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[M]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...J(),S]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",C]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},P]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[M]}],"border-style":[{border:[...K(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[M]}],"divide-style":[{divide:K()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[g,k]}],"outline-w":[{outline:[g,h]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[M]}],"ring-offset-w":[{"ring-offset":[g,h]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",z,E]}],"shadow-color":[{shadow:[N]}],opacity:[{opacity:[M]}],"mix-blend":[{"mix-blend":[...L(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":L()}],filter:[{filter:["","none"]}],blur:[{blur:[o]}],brightness:[{brightness:[t]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",z,k]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[p]}],saturate:[{saturate:[$]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[o]}],"backdrop-brightness":[{"backdrop-brightness":[t]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[M]}],"backdrop-saturate":[{"backdrop-saturate":[$]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",k]}],duration:[{duration:Y()}],ease:[{ease:["linear","in","out","in-out",k]}],delay:[{delay:Y()}],animate:[{animate:["none","spin","ping","pulse","bounce",k]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[w,k]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",k]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",k]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",k]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[g,h,y]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}})}}]); \ No newline at end of file diff --git a/_next/static/chunks/881-917fbfa492ed201a.js b/_next/static/chunks/881-917fbfa492ed201a.js new file mode 100644 index 0000000000000000000000000000000000000000..6f62b59aaf3aa8e21c7a8ecb5ee06604d9d42874 --- /dev/null +++ b/_next/static/chunks/881-917fbfa492ed201a.js @@ -0,0 +1,25 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[881],{26850:function(e,t,r){"use strict";r(44331);let n=e=>{let t;let r=[],n=new Promise((e,n)=>{t={resolve:t=>{r.forEach(e=>{e(t)}),e(t)},reject:n}});return Object.assign(n,{cancel:()=>{t.cancelled=!0,r.splice(0,r.length)},channel:e,prethen:e=>{r.push(e)}}),{order:t,promise:n}},i={},o=function(e=0){let t,r=0,s=!1,a=[],c=[],u=n=>{for(;n.push{for(let n=t.push+r;n{for(;e.shift{for(let e=0;e{let e={push:0,shift:0};u(e),l(e),s&&h(e),a.splice(0,e.push),c.splice(0,e.shift),f()},d=Object.freeze(Object.assign(Object.create(i),{concat:(...e)=>{let t=o();return(async()=>{await d.forEach(t.push);for(let r=0;r{for(;;){let r=await d.shift();if(void 0===r)return!0;if(!e.call(t,r))return!1}},filter:(e,t)=>{let r=o();return(async()=>{await d.forEach(async n=>{await e.call(t,n)&&await r.push(n)}),await r.close()})(),r},forEach:async(e,t)=>{for(;;){let r=await d.shift();if(void 0===r)break;await e.call(t,r)}},join:async e=>(await d.values()).join(e),map:(e,t)=>{let r=o();return(async()=>{await d.forEach(n=>r.push(e.call(t,n))),await r.close()})(),r},readOnly:()=>d,reduce:async(e,...t)=>{let r=t[0],n=t.length>0;if(await d.forEach(t=>{n?r=e(r,t):(r=t,n=!0)}),n)return r;throw TypeError("No values in channel and initialValue wasn't provided.")},shift:function(){let{order:e,promise:t}=n(this);return c.push(e),setImmediate(p),t},slice:(e,t=1/0)=>{let r=o();return(async()=>{for(let t=0;t{for(;;){let r=await d.shift();if(void 0===r)return!1;if(e.call(t,r))return!0}},toString:()=>`Channel(${e})`,value:()=>t,values:async()=>{let e=[];return await d.forEach(t=>{e.push(t)}),e}})),y=Object.freeze(Object.assign(Object.create(i),{close:()=>new Promise((e,t)=>{s?t(Error("Can't close an already-closed channel.")):(s=!0,p(),setImmediate(e))}),length:e,push:function(e){let{order:t,promise:r}=n(this);return t.value=e,Promise.resolve(e).catch(()=>{}),s?t.reject(Error("Can't push to closed channel.")):void 0===e?t.reject(TypeError("Can't push 'undefined' to channel, use close instead.")):arguments.length>1?t.reject(Error("Can't push more than one value at a time.")):(a.push(t),setImmediate(p)),r},writeOnly:()=>y}));return Object.freeze(Object.assign(Object.create(i),d,y))},s=(e,t)=>{t.on("readable",async()=>{for(;;){let r=t.read();if(null===r)break;await e.push(r)}}),t.once("end",e.close)};o.from=(e,t,r)=>{let n=o();return(async()=>{try{for(let t of e)await n.push(t);await n.close()}catch(t){try{for(;;){let t=e();if(void 0===t){await n.close();break}await n.push(t)}}catch(t){s(n,e)}}})(),(t?n.map(t,r):n).readOnly()},o.of=(...e)=>o.from(e),o.isChannel=e=>null!=e&&Object.getPrototypeOf(e)===i,o.select=e=>{if(!Array.isArray(e))throw TypeError("Channel.select: Argument must be an array.");return Object.assign(new Promise((t,r)=>{e.forEach(async n=>{try{n.prethen(()=>{e.forEach(e=>{e!==n&&e.cancel()})});try{await n}catch(e){r(e)}t(n.channel)}catch(e){r(TypeError("Channel.select accepts only promises returned by push & shift."))}})}),{cancel:()=>e.forEach(e=>e.cancel())})},o.selectValue=e=>{if(!Array.isArray(e))throw TypeError("Channel.select: Argument must be an array.");return Object.assign(new Promise((t,r)=>{e.forEach(async n=>{try{n.prethen(()=>{e.forEach(e=>{e!==n&&e.cancel()})});try{t(await n)}catch(e){r(e)}}catch(e){r(TypeError("Channel.select accepts only promises returned by push & shift."))}})}),{cancel:()=>e.forEach(e=>e.cancel())})};let a=o(),c=Object.keys(a).filter(e=>"function"==typeof a[e]),u={reduce:2,slice:2};c.forEach(e=>{let t=function(...r){let n=u[e]||a[e].length;return r.length>n?r[n][e](...r.slice(0,n)):t.bind(this,...r)};o[e]=t}),e.exports=Object.freeze(o)},77708:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=l(r(86543)),i=l(r(26850)),o=u(r(69456)),s=r(64223),a=u(r(70711));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(c=function(e){return e?r:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=c(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function l(e){return e&&e.__esModule?e:{default:e}}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class f{constructor(e,t,r,o){h(this,"session",void 0),h(this,"localClientID",void 0),h(this,"remoteClientID",void 0),h(this,"windowSize",void 0),h(this,"sendWindowUpdate",void 0),h(this,"timeSentSeq",void 0),h(this,"resentSeq",void 0),h(this,"sendAckQueue",void 0),h(this,"retransmissionTimeout",void 0),this.session=e,this.localClientID=t,this.remoteClientID=r,this.windowSize=o,this.retransmissionTimeout=e.config.initialRetransmissionTimeout,this.sendWindowUpdate=new i.default(1),this.timeSentSeq=new Map,this.resentSeq=new Map,this.sendAckQueue=new n.default}sendWindowUsed(){return this.timeSentSeq.size}sendAck(e){this.sendAckQueue.push(e)}sendAckQueueLen(){return this.sendAckQueue.size()}receiveAck(e,t){if(this.timeSentSeq.has(e)){if(this.resentSeq.has(e)||this.setWindowSize(this.windowSize+1),t){let t=Date.now()-this.timeSentSeq.get(e);this.retransmissionTimeout+=100*Math.tanh((3*t-this.retransmissionTimeout)/1e3),this.retransmissionTimeout>this.session.config.maxRetransmissionTimeout&&(this.retransmissionTimeout=this.session.config.maxRetransmissionTimeout)}this.timeSentSeq.delete(e),this.resentSeq.delete(e),i.default.select([this.sendWindowUpdate.push(null),a.closedChan.shift()])}}async _waitForSendWindow(e){for(;this.sendWindowUsed()>=this.windowSize;){let t=a.timeoutChan(a._maxWait);switch(await i.default.select([this.sendWindowUpdate.shift(),t.shift(),e.done.shift()])){case this.sendWindowUpdate:break;case t:throw a._errMaxWait;case e.done:throw e.err}}}start(){this._tx().catch(()=>{}),this._sendAck().catch(()=>{}),this._checkTimeout().catch(()=>{})}async _tx(){let e=0;for(;;){if(0===e&&(e=await this.session._getResendSeq()),0===e){try{await this._waitForSendWindow(this.session.context)}catch(e){if(e===a._errMaxWait)continue;throw e}e=await this.session._getSendSeq()}let t=this.session.getDataToSend(e);if(!t){this.timeSentSeq.delete(e),this.resentSeq.delete(e),e=0;continue}try{await this.session.sendWith(this.localClientID,this.remoteClientID,t)}catch(t){if(this.session.isClosed)throw new o.SessionClosedError;switch(console.log(t),this.setWindowSize(this.windowSize/2),this.session.updateConnWindowSize(),await i.default.select([this.session.resendChan.push(e),this.session.context.done.shift()])){case this.session.resendChan:e=0;break;case this.session.context.done:throw this.session.context.err}await a.sleep(1e3);continue}this.timeSentSeq.has(e)||this.timeSentSeq.set(e,Date.now()),this.resentSeq.delete(e),e=0}}async _sendAck(){for(;;){let e=a.timeoutChan(this.session.config.sendAckInterval);switch(await i.default.select([e.shift(),this.session.context.done.shift()])){case e:break;case this.session.context.done:throw this.session.context.err}if(0===this.sendAckQueueLen())continue;let t=[],r=[];for(;this.sendAckQueueLen()>0&&t.length0&&this.sendAckQueue.peek()===a.nextSeq(e,n);)this.sendAckQueue.pop(),n++;t.push(e),r.push(n)}let n=!0;for(let e of r)if(1!=e){n=!1;break}n&&(r=null);try{let e=new s.Packet;e.setAckStartSeqList(t),r&&e.setAckSeqCountList(r),e.setBytesRead(this.session.bytesRead);let n=e.serializeBinary();await this.session.sendWith(this.localClientID,this.remoteClientID,n),this.session.bytesReadSentTime=Date.now()}catch(e){console.log(e),await a.sleep(1e3);continue}}}async _checkTimeout(){for(;;){let e=a.timeoutChan(this.session.config.checkTimeoutInterval);switch(await i.default.select([e.shift(),this.session.context.done.shift()])){case e:break;case this.session.context.done:throw this.session.context.err}let t=Date.now()-this.retransmissionTimeout,r=!1;for(let[e,n]of this.timeSentSeq)if(!this.resentSeq.has(e)&&n0&&(u=new n.default,i.push(u.shift()),this.timeoutTimer=setTimeout(u.close,r)),i.length>0&&n.default.select(i).then(t=>{switch(t){case c:return e.err;case this.cancelChan:return new s;case u:return new a}}).then(e=>{this.err=e,this.done.close(),this.cancel(),clearTimeout(this.timeoutTimer)})}async cancel(){try{this.cancelChan&&await this.cancelChan.close()}catch(e){}}static background(){return new c(null,!1,0)}static withCancel(e){return new c(e,!0,0)}static withTimeout(e,t){return new c(e,!0,t)}}t.default=c},69456:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WriteDeadlineExceededError=t.SessionNotEstablishedError=t.SessionEstablishedError=t.SessionClosedError=t.RecvWindowFullError=t.ReadDeadlineExceededError=t.NotHandshakeError=t.InvalidPacketError=t.DialTimeoutError=t.DataSizeTooLargeError=t.ConnNotFoundError=t.BufferSizeTooSmallError=void 0;class r extends Error{constructor(e="session closed",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,r),this.name="SessionClosedError"}}t.SessionClosedError=r;class n extends Error{constructor(e="session is already established",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,n),this.name="SessionEstablishedError"}}t.SessionEstablishedError=n;class i extends Error{constructor(e="session not established yet",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,i),this.name="SessionNotEstablishedError"}}t.SessionNotEstablishedError=i;class o extends Error{constructor(e="read deadline exceeded",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,o),this.name="ReadDeadlineExceededError"}}t.ReadDeadlineExceededError=o;class s extends Error{constructor(e="write deadline exceeded",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,s),this.name="WriteDeadlineExceededError"}}t.WriteDeadlineExceededError=s;class a extends Error{constructor(e="read buffer size is less than data length in non-session mode",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,a),this.name="BufferSizeTooSmallError"}}t.BufferSizeTooSmallError=a;class c extends Error{constructor(e="data size is greater than session mtu in non-session mode",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,c),this.name="DataSizeTooLargeError"}}t.DataSizeTooLargeError=c;class u extends Error{constructor(e="invalid packet",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,u),this.name="InvalidPacketError"}}t.InvalidPacketError=u;class l extends Error{constructor(e="receive window full",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,l),this.name="RecvWindowFullError"}}t.RecvWindowFullError=l;class h extends Error{constructor(e="first packet is not handshake packet",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,h),this.name="NotHandshakeError"}}t.NotHandshakeError=h;class f extends Error{constructor(e="dial timeout",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,f),this.name="DialTimeoutError"}}t.DialTimeoutError=f;class p extends Error{constructor(e="Connection not found",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,p),this.name="ConnNotFoundError"}}t.ConnNotFoundError=p},79499:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Connection",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"Context",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"Session",{enumerable:!0,get:function(){return o.default}}),t.util=t.errors=t.consts=void 0;var n=h(r(77708)),i=h(r(70944)),o=h(r(35314)),s=l(r(86513));t.consts=s;var a=l(r(69456));t.errors=a;var c=l(r(70711));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(u=function(e){return e?r:t})(e)}function l(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=u(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function h(e){return e&&e.__esModule?e:{default:e}}t.util=c},64223:function(e,t,r){"use strict";var n=r(24304),i=n,o=Function("return this")();i.exportSymbol("proto.Packet",null,o),proto.Packet=function(e){n.Message.initialize(this,e,0,-1,proto.Packet.repeatedFields_,null)},i.inherits(proto.Packet,n.Message),i.DEBUG&&!COMPILED&&(proto.Packet.displayName="proto.Packet"),proto.Packet.repeatedFields_=[3,4,6],n.Message.GENERATE_TO_OBJECT&&(proto.Packet.prototype.toObject=function(e){return proto.Packet.toObject(e,this)},proto.Packet.toObject=function(e,t){var r={sequenceId:n.Message.getFieldWithDefault(t,1,0),data:t.getData_asB64(),ackStartSeqList:n.Message.getRepeatedField(t,3),ackSeqCountList:n.Message.getRepeatedField(t,4),bytesRead:n.Message.getFieldWithDefault(t,5,0),clientIdsList:n.Message.getRepeatedField(t,6),windowSize:n.Message.getFieldWithDefault(t,7,0),mtu:n.Message.getFieldWithDefault(t,8,0),close:n.Message.getFieldWithDefault(t,9,!1),handshake:n.Message.getFieldWithDefault(t,10,!1)};return e&&(r.$jspbMessageInstance=t),r}),proto.Packet.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.Packet;return proto.Packet.deserializeBinaryFromReader(r,t)},proto.Packet.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readUint32();e.setSequenceId(r);break;case 2:var r=t.readBytes();e.setData(r);break;case 3:var r=t.readPackedUint32();e.setAckStartSeqList(r);break;case 4:var r=t.readPackedUint32();e.setAckSeqCountList(r);break;case 5:var r=t.readUint64();e.setBytesRead(r);break;case 6:var r=t.readString();e.addClientIds(r);break;case 7:var r=t.readUint32();e.setWindowSize(r);break;case 8:var r=t.readUint32();e.setMtu(r);break;case 9:var r=t.readBool();e.setClose(r);break;case 10:var r=t.readBool();e.setHandshake(r);break;default:t.skipField()}return e},proto.Packet.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.Packet.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.Packet.serializeBinaryToWriter=function(e,t){var r=void 0;0!==(r=e.getSequenceId())&&t.writeUint32(1,r),(r=e.getData_asU8()).length>0&&t.writeBytes(2,r),(r=e.getAckStartSeqList()).length>0&&t.writePackedUint32(3,r),(r=e.getAckSeqCountList()).length>0&&t.writePackedUint32(4,r),0!==(r=e.getBytesRead())&&t.writeUint64(5,r),(r=e.getClientIdsList()).length>0&&t.writeRepeatedString(6,r),0!==(r=e.getWindowSize())&&t.writeUint32(7,r),0!==(r=e.getMtu())&&t.writeUint32(8,r),(r=e.getClose())&&t.writeBool(9,r),(r=e.getHandshake())&&t.writeBool(10,r)},proto.Packet.prototype.getSequenceId=function(){return n.Message.getFieldWithDefault(this,1,0)},proto.Packet.prototype.setSequenceId=function(e){n.Message.setProto3IntField(this,1,e)},proto.Packet.prototype.getData=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.Packet.prototype.getData_asB64=function(){return n.Message.bytesAsB64(this.getData())},proto.Packet.prototype.getData_asU8=function(){return n.Message.bytesAsU8(this.getData())},proto.Packet.prototype.setData=function(e){n.Message.setProto3BytesField(this,2,e)},proto.Packet.prototype.getAckStartSeqList=function(){return n.Message.getRepeatedField(this,3)},proto.Packet.prototype.setAckStartSeqList=function(e){n.Message.setField(this,3,e||[])},proto.Packet.prototype.addAckStartSeq=function(e,t){n.Message.addToRepeatedField(this,3,e,t)},proto.Packet.prototype.clearAckStartSeqList=function(){this.setAckStartSeqList([])},proto.Packet.prototype.getAckSeqCountList=function(){return n.Message.getRepeatedField(this,4)},proto.Packet.prototype.setAckSeqCountList=function(e){n.Message.setField(this,4,e||[])},proto.Packet.prototype.addAckSeqCount=function(e,t){n.Message.addToRepeatedField(this,4,e,t)},proto.Packet.prototype.clearAckSeqCountList=function(){this.setAckSeqCountList([])},proto.Packet.prototype.getBytesRead=function(){return n.Message.getFieldWithDefault(this,5,0)},proto.Packet.prototype.setBytesRead=function(e){n.Message.setProto3IntField(this,5,e)},proto.Packet.prototype.getClientIdsList=function(){return n.Message.getRepeatedField(this,6)},proto.Packet.prototype.setClientIdsList=function(e){n.Message.setField(this,6,e||[])},proto.Packet.prototype.addClientIds=function(e,t){n.Message.addToRepeatedField(this,6,e,t)},proto.Packet.prototype.clearClientIdsList=function(){this.setClientIdsList([])},proto.Packet.prototype.getWindowSize=function(){return n.Message.getFieldWithDefault(this,7,0)},proto.Packet.prototype.setWindowSize=function(e){n.Message.setProto3IntField(this,7,e)},proto.Packet.prototype.getMtu=function(){return n.Message.getFieldWithDefault(this,8,0)},proto.Packet.prototype.setMtu=function(e){n.Message.setProto3IntField(this,8,e)},proto.Packet.prototype.getClose=function(){return n.Message.getFieldWithDefault(this,9,!1)},proto.Packet.prototype.setClose=function(e){n.Message.setProto3BooleanField(this,9,e)},proto.Packet.prototype.getHandshake=function(){return n.Message.getFieldWithDefault(this,10,!1)},proto.Packet.prototype.setHandshake=function(e){n.Message.setProto3BooleanField(this,10,e)},i.object.extend(t,proto)},35314:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=p(r(64569)),i=p(r(26850)),o=p(r(77708)),s=f(r(86513)),a=f(r(70944)),c=f(r(69456)),u=r(64223),l=f(r(70711));function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(h=function(e){return e?r:t})(e)}function f(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=h(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function p(e){return e&&e.__esModule?e:{default:e}}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class y{constructor(e,t,r,n,o,c={}){d(this,"config",void 0),d(this,"localAddr",void 0),d(this,"remoteAddr",void 0),d(this,"localClientIDs",void 0),d(this,"remoteClientIDs",void 0),d(this,"sendWith",void 0),d(this,"sendWindowSize",void 0),d(this,"recvWindowSize",void 0),d(this,"sendMtu",void 0),d(this,"recvMtu",void 0),d(this,"connections",void 0),d(this,"onAccept",void 0),d(this,"sendChan",void 0),d(this,"resendChan",void 0),d(this,"sendWindowUpdate",void 0),d(this,"recvDataUpdate",void 0),d(this,"context",void 0),d(this,"readContext",void 0),d(this,"writeContext",void 0),d(this,"isAccepted",void 0),d(this,"isEstablished",void 0),d(this,"isClosed",void 0),d(this,"sendBuffer",void 0),d(this,"sendWindowStartSeq",void 0),d(this,"sendWindowEndSeq",void 0),d(this,"sendWindowData",void 0),d(this,"recvWindowStartSeq",void 0),d(this,"recvWindowUsed",void 0),d(this,"recvWindowData",void 0),d(this,"bytesWrite",void 0),d(this,"bytesRead",void 0),d(this,"bytesReadSentTime",void 0),d(this,"bytesReadUpdateTime",void 0),d(this,"remoteBytesRead",void 0),d(this,"ReadableStream",void 0),d(this,"_readableStream",void 0),d(this,"WritableStream",void 0),d(this,"_writableStream",void 0),d(this,"sendWindowPacketCount",void 0),this.config=Object.assign({},s.defaultConfig,c),this.localAddr=e,this.remoteAddr=t,this.localClientIDs=r,this.remoteClientIDs=n,this.sendWith=o,this.sendWindowSize=this.config.sessionWindowSize,this.recvWindowSize=this.config.sessionWindowSize,this.sendMtu=this.config.mtu,this.recvMtu=this.config.mtu,this.sendWindowStartSeq=s.minSequenceID,this.sendWindowEndSeq=s.minSequenceID,this.recvWindowStartSeq=s.minSequenceID,this.recvWindowUsed=0,this.bytesWrite=0,this.bytesRead=0,this.bytesReadSentTime=Date.now(),this.bytesReadUpdateTime=Date.now(),this.remoteBytesRead=0,this.onAccept=new i.default(1),this.context=a.default.withCancel(),this.setTimeout(0),this.ReadableStream=null,this._readableStream=null,this.WritableStream=null,this._writableStream=null,this.sendWindowPacketCount=this.sendWindowSize/this.sendMtu}isStream(){return!this.config.nonStream}sendWindowUsed(){return this.bytesWrite>this.remoteBytesRead?this.bytesWrite-this.remoteBytesRead:0}getDataToSend(e){return this.sendWindowData.get(e)}getConnWindowSize(){let e=0;for(let t of this.connections.values())e+=t.windowSize;return e}async _getResendSeq(){let e=await i.default.selectValue([this.resendChan.shift(),this.context.done.shift(),l.closedChan.shift()]);if(void 0===e){if(this.context.err)throw this.context.err;return 0}return e}async _getSendSeq(){let e=await i.default.selectValue([this.resendChan.shift(),this.sendChan.shift(),this.context.done.shift()]);if(void 0===e)throw this.context.err;return e}receiveWith(e,t,r){if(this.isClosed)throw new c.SessionClosedError;let n=u.Packet.deserializeBinary(r);if(n.getClose())return this._handleClosePacket();let o=this.isEstablished;if(!o&&n.getHandshake())return this._handleHandshakePacket(n);if(o&&(n.getAckStartSeqList().length>0||n.getAckSeqCountList().length>0)){if(n.getAckStartSeqList().length>0&&n.getAckSeqCountList().length>0&&n.getAckStartSeqList().length!==n.getAckSeqCountList().length)throw new c.InvalidPacketError("AckStartSeq and AckSeqCount should have the same length if both are non-empty");let r=0;r=n.getAckStartSeqList().length>0?n.getAckStartSeqList().length:n.getAckSeqCountList().length;let i=0,o=0;for(let a=0;a0?n.getAckStartSeqList()[a]:s.minSequenceID,o=n.getAckSeqCountList().length>0?l.nextSeq(i,n.getAckSeqCountList()[a]):l.nextSeq(i,1),l.seqInBetween(this.sendWindowStartSeq,this.sendWindowEndSeq,l.nextSeq(o,-1))){l.seqInBetween(this.sendWindowStartSeq,this.sendWindowEndSeq,i)||(i=this.sendWindowStartSeq);for(let r=i;l.seqInBetween(i,o,r);r=l.nextSeq(r,1)){for(let[n,i]of this.connections)i.receiveAck(r,n===l.connKey(e,t));this.sendWindowData.delete(r)}if(i===this.sendWindowStartSeq)for(;this.sendWindowStartSeq=l.nextSeq(this.sendWindowStartSeq,1),!this.sendWindowData.has(this.sendWindowStartSeq)&&this.sendWindowStartSeq!==this.sendWindowEndSeq;);}this.updateConnWindowSize()}if(o&&n.getBytesRead()>this.remoteBytesRead&&(this.remoteBytesRead=n.getBytesRead(),i.default.select([this.sendWindowUpdate.push(null),l.closedChan.shift()])),o&&n.getSequenceId()>0){if(n.getData().length>this.recvMtu)throw new c.DataSizeTooLargeError;if(l.compareSeq(n.getSequenceId(),this.recvWindowStartSeq)>=0&&!this.recvWindowData.has(n.getSequenceId())){if(this.recvWindowUsed+n.getData().length>this.recvWindowSize)throw new c.RecvWindowFullError;this.recvWindowData.set(n.getSequenceId(),n.getData()),this.recvWindowUsed+=n.getData().length,n.getSequenceId()===this.recvWindowStartSeq&&i.default.select([this.recvDataUpdate.push(null),l.closedChan.shift()])}let r=this.connections.get(l.connKey(e,t));if(r)r.sendAck(n.getSequenceId());else throw new c.ConnNotFoundError("Connection "+l.connKey(e,t)+" not found.")}}_start(){for(let e of(this._startFlush().catch(()=>{}),this._startCheckBytesRead().catch(()=>{}),this.connections.values()))e.start()}async _startFlush(){for(;;){let e=l.timeoutChan(this.config.flushInterval);switch(await i.default.select([e.shift(),this.context.done.shift()])){case e:break;case this.context.done:throw this.context.err}if(this.sendBuffer&&0!==this.sendBuffer.length)try{await this._flushSendBuffer()}catch(e){if(this.context.err)throw e;console.log(e);continue}}}async _startCheckBytesRead(){for(;;){let e=l.timeoutChan(this.config.checkBytesReadInterval);switch(await i.default.select([e.shift(),this.context.done.shift()])){case e:break;case this.context.done:throw this.context.err}if(!(0===this.bytesRead||this.bytesReadSentTime>this.bytesReadUpdateTime||Date.now()-this.bytesReadUpdateTimethis.sendWindowSize;){let t=l.timeoutChan(l._maxWait);switch(await i.default.select([this.sendWindowUpdate.shift(),t.shift(),e.done.shift()])){case this.sendWindowUpdate:case t:break;case e.done:throw e.err}}return this.sendWindowSize-this.sendWindowUsed()}async _flushSendBuffer(){if(!this.sendBuffer||0===this.sendBuffer.length)return;let e=this.sendWindowEndSeq,t=new u.Packet;t.setSequenceId(e),t.setData(this.sendBuffer);let r=t.serializeBinary();switch(this.sendWindowData.set(e,r),this.sendWindowEndSeq=l.nextSeq(e,1),this.sendBuffer=new Uint8Array(0),await i.default.select([this.sendChan.push(e),this.context.done.shift()])){case this.sendChan:break;case this.context.done:throw this.context.err}}async _sendHandshakePacket(e){let t=new u.Packet;t.setHandshake(!0),t.setClientIdsList(this.localClientIDs),t.setWindowSize(this.recvWindowSize),t.setMtu(this.recvMtu);let r=t.serializeBinary(),i=[];if(this.connections&&this.connections.size>0)for(let t of this.connections.values())i.push(l.promiseTimeout(this.sendWith(t.localClientID,t.remoteClientID,r),e,new c.WriteDeadlineExceededError));else i=this.localClientIDs.map((t,n)=>{let i=t;return this.remoteClientIDs&&this.remoteClientIDs.length>0&&(i=this.remoteClientIDs[n%this.remoteClientIDs.length]),l.promiseTimeout(this.sendWith(t,i,r),e,new c.WriteDeadlineExceededError)});try{await n.default.any(i)}catch(e){throw e.errors}}_handleHandshakePacket(e){if(this.isEstablished)return;if(0===e.getWindowSize())throw new c.InvalidPacketError("WindowSize is zero");if(e.getWindowSize()0&&(t=l.timeoutChan(e),r.push(t.shift())),await i.default.select(r)){case this.onAccept:break;case t:throw new c.DialTimeoutError}this._start(),this.isAccepted=!0}async accept(){if(this.isAccepted)throw new c.SessionEstablishedError;if(await i.default.select([this.onAccept.shift(),l.closedChan.shift()])===this.onAccept);else throw new c.NotHandshakeError;this._start(),this.isAccepted=!0,await this._sendHandshakePacket(this.config.maxRetransmissionTimeout)}async read(e=0){try{if(this.isClosed)throw new c.SessionClosedError;if(!this.isEstablished)throw new c.SessionNotEstablishedError;for(;;){if(this.readContext.err)throw this.readContext.err;if(this.recvWindowData.has(this.recvWindowStartSeq))break;let e=l.timeoutChan(l._maxWait);switch(await i.default.select([this.recvDataUpdate.shift(),e.shift(),this.readContext.done.shift()])){case this.recvDataUpdate:case e:break;case this.readContext.done:throw this.readContext.err}}let t=this.recvWindowData.get(this.recvWindowStartSeq);if(!this.isStream()&&e>0&&e0){r=new Uint8Array(e);let i=t.subarray(0,e);r.set(i),n=i.length}if(n===t.length?(this.recvWindowData.delete(this.recvWindowStartSeq),this.recvWindowStartSeq=l.nextSeq(this.recvWindowStartSeq,1)):this.recvWindowData.set(this.recvWindowStartSeq,t.subarray(n)),this.recvWindowUsed-=n,this.bytesRead+=n,this.bytesReadUpdateTime=Date.now(),this.isStream())for(;e<0||n0){let o=t.subarray(0,e-n);r.set(o,n),i=o.length}else r=l.mergeUint8Array(r,t),i=t.length;i===t.length?(this.recvWindowData.delete(this.recvWindowStartSeq),this.recvWindowStartSeq=l.nextSeq(this.recvWindowStartSeq,1)):this.recvWindowData.set(this.recvWindowStartSeq,t.subarray(i)),this.recvWindowUsed-=i,this.bytesRead+=i,this.bytesReadUpdateTime=Date.now(),n+=i}return r.subarray(0,n)}catch(e){if(e instanceof a.ContextDeadlineExceededError)throw new c.ReadDeadlineExceededError;if(e instanceof a.ContextCanceledError)throw new c.SessionClosedError;throw e}}async write(e){try{if(this.isClosed)throw new c.SessionClosedError;if(!this.isEstablished)throw new c.SessionNotEstablishedError;if(!this.isStream()&&(e.length>this.sendMtu||e>this.sendWindowSize))throw new c.DataSizeTooLargeError;if(0===e.length)return;let t=0;if(this.isStream())for(;e.length>0;){let r=await this._waitForSendWindow(this.writeContext,1),n=e.length;n>r&&(n=r);let i=r===this.sendWindowSize,o=this.sendMtu,s=this.sendBuffer.length;n>=o-s&&(n=o-s,i=!0),this.sendBuffer=l.mergeUint8Array(this.sendBuffer,e.subarray(0,n)),this.bytesWrite+=n,t+=n,i&&await this._flushSendBuffer(),e=e.subarray(n)}else await this._waitForSendWindow(this.writeContext,e.length),this.sendBuffer=new Uint8Array(e),this.bytesWrite+=e.length,t+=e.length,await this._flushSendBuffer()}catch(e){if(e instanceof a.ContextDeadlineExceededError)throw new c.WriteDeadlineExceededError;if(e instanceof a.ContextCanceledError)throw new c.SessionClosedError;throw e}}async close(){this.readContext.cancel(),this.writeContext.cancel();let e=new i.default;if(this.config.linger>0&&setTimeout(e.close,this.config.linger),0!==this.config.linger){try{await this._flushSendBuffer()}catch(e){console.log(e)}await (async()=>{for(;;){let t=l.timeoutChan(100);switch(await i.default.select([t.shift(),e.shift()])){case t:if(this.sendWindowStartSeq===this.sendWindowEndSeq)return;break;case e:return}}})()}try{await this._sendClosePacket()}catch(e){console.log(e)}this.context.cancel(),this.isClosed=!0}setTimeout(e){this.setReadTimeout(e),this.setWriteTimeout(e)}setReadTimeout(e){this.readContext=a.default.withTimeout(this.context,e)}setWriteTimeout(e){this.writeContext=a.default.withTimeout(this.context,e)}setLinger(e){this.config.linger=e}getReadableStream(){if(!this._readableStream){let e=this.ReadableStream||ReadableStream;this._readableStream=new e({start:e=>{this.context.done.shift().then(()=>e.close())},pull:e=>this.isClosed?e.close():this.read().then(t=>e.enqueue(t))})}return this._readableStream}getWritableStream(e=!1){if(!this._writableStream){let t=this.WritableStream||WritableStream,r={write:(e,t)=>this.isClosed?t.error(new c.SessionClosedError):this.write(e)};e&&(r.close=e=>this.close(),r.abort=e=>(console.log("Abort stream:",e),this.setLinger(0),this.close())),this._writableStream=new t(r)}return this._writableStream}updateConnWindowSize(){let e=0;for(let t of this.connections.values())e+=t.windowSize;if(!(e<=0))for(let t of this.connections.values()){let r=this.sendWindowPacketCount*(t.windowSize/e);t.setWindowSize(r)}}}t.default=y},70711:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.closedChan=t._maxWait=t._errMaxWait=void 0,t.compareSeq=d,t.connKey=y,t.maxUint32=void 0,t.mergeUint8Array=v,t.nextSeq=f,t.promiseTimeout=b,t.seqInBetween=p,t.sleep=_,t.timeoutChan=g;var n=a(r(26850)),i=s(r(86513));function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(o=function(e){return e?r:t})(e)}function s(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=o(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=i?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=e[s]}return n.default=e,r&&r.set(e,n),n}function a(e){return e&&e.__esModule?e:{default:e}}let c=4294967295;t.maxUint32=c;let u=1e3;t._maxWait=u;let l=Error("max wait time reached");t._errMaxWait=l;let h=new n.default;function f(e,t){let r=c-i.minSequenceID+1,n=(e-i.minSequenceID+t)%r;return n<0&&(n+=r),n+i.minSequenceID}function p(e,t,r){return e<=t?r>=e&&r=e||rsetTimeout(t,e))}function v(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function b(e,t,r){return new Promise((n,i)=>{let o;t>0&&(o=setTimeout(()=>i(r),t)),e.then(()=>{clearTimeout(o),n()}).catch(i)})}t.closedChan=h,h.close()},73360:function(e,t,r){e.exports=r(36451)},81641:function(e,t,r){"use strict";var n=r(59608),i=r(79263),o=r(46710),s=r(16524),a=r(26501),c=r(98993),u=r(32791),l=r(67899),h=r(24947),f=r(35842),p=r(65181),d=r(72964);e.exports=function(e){return new Promise(function(t,r){var y,g=e.data,_=e.headers,v=e.responseType,b=e.withXSRFToken;function m(){e.cancelToken&&e.cancelToken.unsubscribe(y),e.signal&&e.signal.removeEventListener("abort",y)}n.isFormData(g)&&n.isStandardBrowserEnv()&&delete _["Content-Type"];var w=new XMLHttpRequest;if(e.auth){var S=e.auth.username||"",E=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";_.Authorization="Basic "+btoa(S+":"+E)}var x=a(e.baseURL,e.url);function k(){if(w){var n="getAllResponseHeaders"in w?c(w.getAllResponseHeaders()):null;i(function(e){t(e),m()},function(e){r(e),m()},{data:v&&"text"!==v&&"json"!==v?w.response:w.responseText,status:w.status,statusText:w.statusText,headers:n,config:e,request:w}),w=null}}if(w.open(e.method.toUpperCase(),s(x,e.params,e.paramsSerializer),!0),w.timeout=e.timeout,"onloadend"in w?w.onloadend=k:w.onreadystatechange=function(){w&&4===w.readyState&&(0!==w.status||w.responseURL&&0===w.responseURL.indexOf("file:"))&&setTimeout(k)},w.onabort=function(){w&&(r(new h("Request aborted",h.ECONNABORTED,e,w)),w=null)},w.onerror=function(){r(new h("Network Error",h.ERR_NETWORK,e,w)),w=null},w.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",n=e.transitional||l;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new h(t,n.clarifyTimeoutError?h.ETIMEDOUT:h.ECONNABORTED,e,w)),w=null},n.isStandardBrowserEnv()&&(b&&n.isFunction(b)&&(b=b(e)),b||!1!==b&&u(x))){var T=e.xsrfHeaderName&&e.xsrfCookieName&&o.read(e.xsrfCookieName);T&&(_[e.xsrfHeaderName]=T)}"setRequestHeader"in w&&n.forEach(_,function(e,t){void 0===g&&"content-type"===t.toLowerCase()?delete _[t]:w.setRequestHeader(t,e)}),n.isUndefined(e.withCredentials)||(w.withCredentials=!!e.withCredentials),v&&"json"!==v&&(w.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&w.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&w.upload&&w.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(y=function(t){w&&(r(!t||t.type?new f(null,e,w):t),w.abort(),w=null)},e.cancelToken&&e.cancelToken.subscribe(y),e.signal&&(e.signal.aborted?y():e.signal.addEventListener("abort",y))),g||!1===g||0===g||""===g||(g=null);var B=p(x);if(B&&-1===d.protocols.indexOf(B)){r(new h("Unsupported protocol "+B+":",h.ERR_BAD_REQUEST,e));return}w.send(g)})}},36451:function(e,t,r){"use strict";var n=r(59608),i=r(76305),o=r(77622),s=r(7215),a=r(88886),c=r(59829);function u(e){var t=new o(e),r=i(o.prototype.request,t);return n.extend(r,o.prototype,t),n.extend(r,t),r.create=function(t){return u(s(e,t))},r}var l=u(a);l.Axios=o,l.CanceledError=r(35842),l.CancelToken=r(23899),l.isCancel=r(66163),l.VERSION=r(17249).version,l.toFormData=r(64731),l.AxiosError=r(24947),l.Cancel=l.CanceledError,l.all=function(e){return Promise.all(e)},l.spread=r(45220),l.isAxiosError=r(9088),l.formToJSON=function(e){return c(n.isHTMLForm(e)?new FormData(e):e)},e.exports=l,e.exports.default=l},23899:function(e,t,r){"use strict";var n=r(35842);function i(e){if("function"!=typeof e)throw TypeError("executor must be a function.");this.promise=new Promise(function(e){t=e});var t,r=this;this.promise.then(function(e){if(r._listeners){for(var t=r._listeners.length;t-- >0;)r._listeners[t](e);r._listeners=null}}),this.promise.then=function(e){var t,n=new Promise(function(e){r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,i,o){r.reason||(r.reason=new n(e,i,o),t(r.reason))})}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]},i.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},i.source=function(){var e;return{token:new i(function(t){e=t}),cancel:e}},e.exports=i},35842:function(e,t,r){"use strict";var n=r(24947);function i(e,t,r){n.call(this,null==e?"canceled":e,n.ERR_CANCELED,t,r),this.name="CanceledError"}r(59608).inherits(i,n,{__CANCEL__:!0}),e.exports=i},66163:function(e){"use strict";e.exports=function(e){return!!(e&&e.__CANCEL__)}},77622:function(e,t,r){"use strict";var n=r(59608),i=r(16524),o=r(86981),s=r(42777),a=r(7215),c=r(26501),u=r(11515),l=u.validators;function h(e){this.defaults=e,this.interceptors={request:new o,response:new o}}h.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r,i=t.transitional;void 0!==i&&u.assertOptions(i,{silentJSONParsing:l.transitional(l.boolean),forcedJSONParsing:l.transitional(l.boolean),clarifyTimeoutError:l.transitional(l.boolean)},!1);var o=t.paramsSerializer;void 0!==o&&u.assertOptions(o,{encode:l.function,serialize:l.function},!0),n.isFunction(o)&&(t.paramsSerializer={serialize:o});var c=[],h=!0;this.interceptors.request.forEach(function(e){("function"!=typeof e.runWhen||!1!==e.runWhen(t))&&(h=h&&e.synchronous,c.unshift(e.fulfilled,e.rejected))});var f=[];if(this.interceptors.response.forEach(function(e){f.push(e.fulfilled,e.rejected)}),!h){var p=[s,void 0];for(Array.prototype.unshift.apply(p,c),p=p.concat(f),r=Promise.resolve(t);p.length;)r=r.then(p.shift(),p.shift());return r}for(var d=t;c.length;){var y=c.shift(),g=c.shift();try{d=y(d)}catch(e){g(e);break}}try{r=s(d)}catch(e){return Promise.reject(e)}for(;f.length;)r=r.then(f.shift(),f.shift());return r},h.prototype.getUri=function(e){return i(c((e=a(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)},n.forEach(["delete","get","head","options"],function(e){h.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}}),n.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,i){return this.request(a(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}h.prototype[e]=t(),h.prototype[e+"Form"]=t(!0)}),e.exports=h},24947:function(e,t,r){"use strict";var n=r(59608);function i(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}n.inherits(i,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var o=i.prototype,s={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(function(e){s[e]={value:e}}),Object.defineProperties(i,s),Object.defineProperty(o,"isAxiosError",{value:!0}),i.from=function(e,t,r,s,a,c){var u=Object.create(o);return n.toFlatObject(e,u,function(e){return e!==Error.prototype}),i.call(u,e.message,t,r,s,a),u.cause=e,u.name=e.name,c&&Object.assign(u,c),u},e.exports=i},86981:function(e,t,r){"use strict";var n=r(59608);function i(){this.handlers=[]}i.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.clear=function(){this.handlers&&(this.handlers=[])},i.prototype.forEach=function(e){n.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=i},26501:function(e,t,r){"use strict";var n=r(1314),i=r(94110);e.exports=function(e,t){return e&&!n(t)?i(e,t):t}},42777:function(e,t,r){"use strict";var n=r(59608),i=r(45406),o=r(66163),s=r(88886),a=r(35842),c=r(22089);function u(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a}e.exports=function(e){return u(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,null,e.transformRequest),c(e.headers,"Accept"),c(e.headers,"Content-Type"),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||s.adapter)(e).then(function(t){return u(e),t.data=i.call(e,t.data,t.headers,t.status,e.transformResponse),t},function(t){return!o(t)&&(u(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,t.response.status,e.transformResponse))),Promise.reject(t)})}},7215:function(e,t,r){"use strict";var n=r(59608);e.exports=function(e,t){t=t||{};var r={};function i(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isEmptyObject(t)?n.merge({},e):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function o(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:i(void 0,e[r]):i(e[r],t[r])}function s(e){if(!n.isUndefined(t[e]))return i(void 0,t[e])}function a(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:i(void 0,e[r]):i(void 0,t[r])}function c(r){return r in t?i(e[r],t[r]):r in e?i(void 0,e[r]):void 0}var u={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return n.forEach(Object.keys(e).concat(Object.keys(t)),function(e){var t=u[e]||o,i=t(e);n.isUndefined(i)&&t!==c||(r[e]=i)}),r}},79263:function(e,t,r){"use strict";var n=r(24947);e.exports=function(e,t,r){var i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new n("Request failed with status code "+r.status,[n.ERR_BAD_REQUEST,n.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}},45406:function(e,t,r){"use strict";var n=r(59608),i=r(88886);e.exports=function(e,t,r,o){var s=this||i;return n.forEach(o,function(n){e=n.call(s,e,t,r)}),e}},88886:function(e,t,r){"use strict";var n=r(25566),i=r(59608),o=r(22089),s=r(24947),a=r(67899),c=r(64731),u=r(30980),l=r(72964),h=r(59829),f={"Content-Type":"application/x-www-form-urlencoded"};function p(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function d(e,t,r){if(i.isString(e))try{return(t||JSON.parse)(e),i.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}var y={transitional:a,adapter:function(){var e;return"undefined"!=typeof XMLHttpRequest?e=r(81641):void 0!==n&&"[object process]"===Object.prototype.toString.call(n)&&(e=r(81641)),e}(),transformRequest:[function(e,t){o(t,"Accept"),o(t,"Content-Type");var r,n=t&&t["Content-Type"]||"",s=n.indexOf("application/json")>-1,a=i.isObject(e);if(a&&i.isHTMLForm(e)&&(e=new FormData(e)),i.isFormData(e))return s?JSON.stringify(h(e)):e;if(i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e))return e;if(i.isArrayBufferView(e))return e.buffer;if(i.isURLSearchParams(e))return p(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();if(a){if(-1!==n.indexOf("application/x-www-form-urlencoded"))return u(e,this.formSerializer).toString();if((r=i.isFileList(e))||n.indexOf("multipart/form-data")>-1){var l=this.env&&this.env.FormData;return c(r?{"files[]":e}:e,l&&new l,this.formSerializer)}}return a||s?(p(t,"application/json"),d(e)):e}],transformResponse:[function(e){var t=this.transitional||y.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&i.isString(e)&&(r&&!this.responseType||n)){var o=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw s.from(e,s.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:l.classes.FormData,Blob:l.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};i.forEach(["delete","get","head"],function(e){y.headers[e]={}}),i.forEach(["post","put","patch"],function(e){y.headers[e]=i.merge(f)}),e.exports=y},67899:function(e){"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},31588:function(e,t,r){e.exports=r(42558)},17249:function(e){e.exports={version:"0.28.1"}},3168:function(e,t,r){"use strict";var n=r(64731);function i(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'\(\)~]|%20|%00/g,function(e){return t[e]})}function o(e,t){this._pairs=[],e&&n(e,this,t)}var s=o.prototype;s.append=function(e,t){this._pairs.push([e,t])},s.toString=function(e){var t=e?function(t){return e.call(this,t,i)}:i;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")},e.exports=o},76305:function(e){"use strict";e.exports=function(e,t){return function(){return e.apply(t,arguments)}}},16524:function(e,t,r){"use strict";var n=r(59608),i=r(3168);function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s,a=e.indexOf("#");-1!==a&&(e=e.slice(0,a));var c=r&&r.encode||o,u=r&&r.serialize;return(s=u?u(t,r):n.isURLSearchParams(t)?t.toString():new i(t,r).toString(c))&&(e+=(-1===e.indexOf("?")?"?":"&")+s),e}},94110:function(e){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},46710:function(e,t,r){"use strict";var n=r(59608);e.exports=n.isStandardBrowserEnv()?function(){return{write:function(e,t,r,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(i)&&a.push("path="+i),n.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},59829:function(e,t,r){"use strict";var n=r(59608);function i(e){return n.matchAll(/\w+|\[(\w*)]/g,e).map(function(e){return"[]"===e[0]?"":e[1]||e[0]})}function o(e){var t,r,n={},i=Object.keys(e),o=i.length;for(t=0;t=e.length;return(a=!a&&n.isArray(i)?i.length:a,u)?n.hasOwnProperty(i,a)?i[a]=[i[a],r]:i[a]=r:(i[a]&&n.isObject(i[a])||(i[a]=[]),t(e,r,i[a],s)&&n.isArray(i[a])&&(i[a]=o(i[a]))),!c}if(n.isFormData(e)&&n.isFunction(e.entries)){var r={};return n.forEachEntry(e,function(e,n){t(i(e),n,r,0)}),r}return null}e.exports=s},1314:function(e){"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},9088:function(e,t,r){"use strict";var n=r(59608);e.exports=function(e){return n.isObject(e)&&!0===e.isAxiosError}},32791:function(e,t,r){"use strict";var n=r(59608);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=i(window.location.href),function(t){var r=n.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return function(){return!0}}()},22089:function(e,t,r){"use strict";var n=r(59608);e.exports=function(e,t){n.forEach(e,function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])})}},98993:function(e,t,r){"use strict";var n=r(59608),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,s={};return e&&n.forEach(e.split("\n"),function(e){o=e.indexOf(":"),t=n.trim(e.slice(0,o)).toLowerCase(),r=n.trim(e.slice(o+1)),t&&!(s[t]&&i.indexOf(t)>=0)&&("set-cookie"===t?s[t]=(s[t]?s[t]:[]).concat([r]):s[t]=s[t]?s[t]+", "+r:r)}),s}},65181:function(e){"use strict";e.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}},45220:function(e){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},64731:function(e,t,r){"use strict";var n=r(9109).Buffer,i=r(59608),o=r(24947),s=r(31588);function a(e){return i.isPlainObject(e)||i.isArray(e)}function c(e){return i.endsWith(e,"[]")?e.slice(0,-2):e}function u(e,t,r){return e?e.concat(t).map(function(e,t){return e=c(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}function l(e){return i.isArray(e)&&!e.some(a)}var h=i.toFlatObject(i,{},null,function(e){return/^is[A-Z]/.test(e)});function f(e){return e&&i.isFunction(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator]}function p(e,t,r){if(!i.isObject(e))throw TypeError("target must be an object");t=t||new(s||FormData);var p=(r=i.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!i.isUndefined(t[e])})).metaTokens,d=r.visitor||b,y=r.dots,g=r.indexes,_=(r.Blob||"undefined"!=typeof Blob&&Blob)&&f(t);if(!i.isFunction(d))throw TypeError("visitor must be a function");function v(e){if(null===e)return"";if(i.isDate(e))return e.toISOString();if(!_&&i.isBlob(e))throw new o("Blob is not supported. Use a Buffer instead.");return i.isArrayBuffer(e)||i.isTypedArray(e)?_&&"function"==typeof Blob?new Blob([e]):n.from(e):e}function b(e,r,n){var o=e;if(e&&!n&&"object"==typeof e){if(i.endsWith(r,"{}"))r=p?r:r.slice(0,-2),e=JSON.stringify(e);else if(i.isArray(e)&&l(e)||i.isFileList(e)||i.endsWith(r,"[]")&&(o=i.toArray(e)))return r=c(r),o.forEach(function(e,n){i.isUndefined(e)||t.append(!0===g?u([r],n,y):null===g?r:r+"[]",v(e))}),!1}return!!a(e)||(t.append(u(n,r,y),v(e)),!1)}var m=[],w=Object.assign(h,{defaultVisitor:b,convertValue:v,isVisitable:a});function S(e,r){if(!i.isUndefined(e)){if(-1!==m.indexOf(e))throw Error("Circular reference detected in "+r.join("."));m.push(e),i.forEach(e,function(e,n){!0===(!i.isUndefined(e)&&d.call(t,e,i.isString(n)?n.trim():n,r,w))&&S(e,r?r.concat(n):[n])}),m.pop()}}if(!i.isObject(e))throw TypeError("data must be an object");return S(e),t}e.exports=p},30980:function(e,t,r){"use strict";var n=r(59608),i=r(64731),o=r(72964);e.exports=function(e,t){return i(e,new o.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,i){return o.isNode&&n.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}},11515:function(e,t,r){"use strict";var n=r(17249).version,i=r(24947),o={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){o[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});var s={};function a(e,t,r){if("object"!=typeof e)throw new i("options must be an object",i.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(e),o=n.length;o-- >0;){var s=n[o],a=t[s];if(a){var c=e[s],u=void 0===c||a(c,s,e);if(!0!==u)throw new i("option "+s+" must be "+u,i.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new i("Unknown option "+s,i.ERR_BAD_OPTION)}}o.transitional=function(e,t,r){function o(e,t){return"[Axios v"+n+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,a){if(!1===e)throw new i(o(n," has been removed"+(t?" in "+t:"")),i.ERR_DEPRECATED);return t&&!s[n]&&(s[n]=!0,console.warn(o(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,a)}},e.exports={assertOptions:a,validators:o}},86369:function(e){"use strict";e.exports=FormData},61438:function(e,t,r){"use strict";var n=r(3168);e.exports="undefined"!=typeof URLSearchParams?URLSearchParams:n},94472:function(e,t,r){"use strict";e.exports={isBrowser:!0,classes:{URLSearchParams:r(61438),FormData:r(86369),Blob:Blob},protocols:["http","https","file","blob","url","data"]}},72964:function(e,t,r){"use strict";e.exports=r(94472)},59608:function(e,t,r){"use strict";var n=r(76305),i=Object.prototype.toString,o=function(e){return function(t){var r=i.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())}}(Object.create(null));function s(e){return e=e.toLowerCase(),function(t){return o(t)===e}}function a(e){return Array.isArray(e)}function c(e){return void 0===e}function u(e){return null!==e&&!c(e)&&null!==e.constructor&&!c(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var l=s("ArrayBuffer");function h(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&l(e.buffer)}function f(e){return"string"==typeof e}function p(e){return"number"==typeof e}function d(e){return null!==e&&"object"==typeof e}function y(e){if("object"!==o(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function g(e){return e&&0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}var _=s("Date"),v=s("File"),b=s("Blob"),m=s("FileList");function w(e){return"[object Function]"===i.call(e)}function S(e){return d(e)&&w(e.pipe)}function E(e){var t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||i.call(e)===t||w(e.toString)&&e.toString()===t)}var x=s("URLSearchParams");function k(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}function T(){var e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&"undefined"!=typeof window&&"undefined"!=typeof document}function B(e,t){if(null!=e){if("object"!=typeof e&&(e=[e]),a(e))for(var r=0,n=e.length;r0;)s=i[o],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=!1!==r&&Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t}function C(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var n=e.indexOf(t,r);return -1!==n&&n===r}function N(e){if(!e)return null;if(a(e))return e;var t=e.length;if(!p(t))return null;for(var r=Array(t);t-- >0;)r[t]=e[t];return r}var I=function(e){return function(t){return e&&t instanceof e}}("undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array));function D(e,t){for(var r,n=(e&&e[Symbol.iterator]).call(e);(r=n.next())&&!r.done;){var i=r.value;t.call(e,i[0],i[1])}}function j(e,t){for(var r,n=[];null!==(r=e.exec(t));)n.push(r);return n}var U=s("HTMLFormElement"),F=function(e){return function(t,r){return e.call(t,r)}}(Object.prototype.hasOwnProperty);e.exports={isArray:a,isArrayBuffer:l,isBuffer:u,isFormData:E,isArrayBufferView:h,isString:f,isNumber:p,isObject:d,isPlainObject:y,isEmptyObject:g,isUndefined:c,isDate:_,isFile:v,isBlob:b,isFunction:w,isStream:S,isURLSearchParams:x,isStandardBrowserEnv:T,forEach:B,merge:A,extend:M,trim:k,stripBOM:O,inherits:P,toFlatObject:R,kindOf:o,kindOfTest:s,endsWith:C,toArray:N,isTypedArray:I,isFileList:m,forEachEntry:D,matchAll:j,isHTMLForm:U,hasOwnProperty:F}},35197:function(e,t,r){"use strict";var n=r(10632).Buffer;function i(e){if(e.length>=255)throw TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(s);e[r];){var h=t[e.charCodeAt(r)];if(255===h)return;for(var f=0,p=s-1;(0!==h||f>>0,l[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw Error("Non-zero carry");o=f,r++}for(var d=s-o;d!==s&&0===l[d];)d++;var y=n.allocUnsafe(i+(s-d));y.fill(0,0,i);for(var g=i;d!==s;)y[g++]=l[d++];return y}function f(e){var t=h(e);if(t)return t;throw Error("Non-base"+a+" character")}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,o=0,s=t.length;o!==s&&0===t[o];)o++,r++;for(var u=(s-o)*l+1>>>0,h=new Uint8Array(u);o!==s;){for(var f=t[o],p=0,d=u-1;(0!==f||p>>0,h[d]=f%a>>>0,f=f/a>>>0;if(0!==f)throw Error("Non-zero carry");i=p,o++}for(var y=u-i;y!==u&&0===h[y];)y++;for(var g=c.repeat(r);y-1?i(r):r}},11356:function(e,t,r){"use strict";var n=r(71769),i=r(77323),o=r(49813),s=r(31354),a=i("%Function.prototype.apply%"),c=i("%Function.prototype.call%"),u=i("%Reflect.apply%",!0)||n.call(c,a),l=r(7723),h=i("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new s("a function is required");var t=u(n,c,arguments);return o(t,1+h(0,e.length-(arguments.length-1)),!0)};var f=function(){return u(n,a,arguments)};l?l(e.exports,"apply",{value:f}):e.exports.apply=f},42927:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(85925),r(96546),r(87579),r(90576))}(0,function(e){return!function(){var t=e,r=t.lib.BlockCipher,n=t.algo,i=[],o=[],s=[],a=[],c=[],u=[],l=[],h=[],f=[],p=[];!function(){for(var e=[],t=0;t<256;t++)t<128?e[t]=t<<1:e[t]=t<<1^283;for(var r=0,n=0,t=0;t<256;t++){var d=n^n<<1^n<<2^n<<3^n<<4;d=d>>>8^255&d^99,i[r]=d,o[d]=r;var y=e[r],g=e[y],_=e[g],v=257*e[d]^16843008*d;s[r]=v<<24|v>>>8,a[r]=v<<16|v>>>16,c[r]=v<<8|v>>>24,u[r]=v;var v=16843009*_^65537*g^257*y^16843008*r;l[d]=v<<24|v>>>8,h[d]=v<<16|v>>>16,f[d]=v<<8|v>>>24,p[d]=v,r?(r=y^e[e[e[_^y]]],n^=e[e[n]]):r=n=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],y=n.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e,t=this._keyPriorReset=this._key,r=t.words,n=t.sigBytes/4,o=((this._nRounds=n+6)+1)*4,s=this._keySchedule=[],a=0;a6&&a%n==4&&(e=i[e>>>24]<<24|i[e>>>16&255]<<16|i[e>>>8&255]<<8|i[255&e]):e=(i[(e=e<<8|e>>>24)>>>24]<<24|i[e>>>16&255]<<16|i[e>>>8&255]<<8|i[255&e])^d[a/n|0]<<24,s[a]=s[a-n]^e);for(var c=this._invKeySchedule=[],u=0;u>>24]]^h[i[e>>>16&255]]^f[i[e>>>8&255]]^p[i[255&e]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,u,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,h,f,p,o);var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,s,a){for(var c=this._nRounds,u=e[t]^r[0],l=e[t+1]^r[1],h=e[t+2]^r[2],f=e[t+3]^r[3],p=4,d=1;d>>24]^i[l>>>16&255]^o[h>>>8&255]^s[255&f]^r[p++],g=n[l>>>24]^i[h>>>16&255]^o[f>>>8&255]^s[255&u]^r[p++],_=n[h>>>24]^i[f>>>16&255]^o[u>>>8&255]^s[255&l]^r[p++],v=n[f>>>24]^i[u>>>16&255]^o[l>>>8&255]^s[255&h]^r[p++];u=y,l=g,h=_,f=v}var y=(a[u>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&f])^r[p++],g=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[f>>>8&255]<<8|a[255&u])^r[p++],_=(a[h>>>24]<<24|a[f>>>16&255]<<16|a[u>>>8&255]<<8|a[255&l])^r[p++],v=(a[f>>>24]<<24|a[u>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^r[p++];e[t]=y,e[t+1]=g,e[t+2]=_,e[t+3]=v},keySize:8});t.AES=r._createHelper(y)}(),e.AES})},16405:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(85925),r(96546),r(87579),r(90576))}(0,function(e){return!function(){var t=e,r=t.lib.BlockCipher,n=t.algo;let i=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function c(e,t){let r=t>>24&255,n=t>>16&255,i=t>>8&255,o=255&t,s=e.sbox[0][r]+e.sbox[1][n];return s^=e.sbox[2][i],s+=e.sbox[3][o]}function u(e,t,r){let n,o=t,s=r;for(let t=0;t1;--t)o^=e.pbox[t],s=c(e,o)^s,n=o,o=s,s=n;return n=o,o=s,s=n^e.pbox[1],{left:o^=e.pbox[0],right:s}}function h(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=s[t][r]}let n=0;for(let s=0;s=r&&(n=0);let a=0,c=0,l=0;for(let t=0;t>>2];e.sigBytes-=t}};r.BlockCipher=u.extend({cfg:u.cfg.extend({mode:f,padding:p}),reset:function(){u.reset.call(this);var e,t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var d=r.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),y=(t.format={}).OpenSSL={stringify:function(e){var t,r=e.ciphertext,n=e.salt;return(t=n?i.create([1398893684,1701076831]).concat(n).concat(r):r).toString(a)},parse:function(e){var t,r=a.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=i.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),d.create({ciphertext:r,salt:t})}},g=r.SerializableCipher=n.extend({cfg:n.extend({format:y}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),s=i.cfg;return d.create({ciphertext:o,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),_=(t.kdf={}).OpenSSL={execute:function(e,t,r,n,o){if(n||(n=i.random(8)),o)var s=c.create({keySize:t+r,hasher:o}).compute(e,n);else var s=c.create({keySize:t+r}).compute(e,n);var a=i.create(s.words.slice(t),4*r);return s.sigBytes=4*t,d.create({key:s,iv:a,salt:n})}},v=r.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:_}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=i.iv;var o=g.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=i.iv,g.decrypt.call(this,e,t,i.key,n)}})}()})},39317:function(e,t,r){!function(r,n){e.exports=t=n()}(0,function(){var e=e||function(e,t){if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==r.g&&r.g.crypto&&(n=r.g.crypto),!n)try{n=r(42480)}catch(e){}var n,i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),s={},a=s.lib={},c=a.Base=function(){return{extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),u=a.WordArray=c.extend({init:function(e,r){e=this.words=e||[],t!=r?this.sigBytes=r:this.sigBytes=4*e.length},toString:function(e){return(e||h).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var a=0;a>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},f=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},p=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},d=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,l=e.min(4*c,o);if(c){for(var h=0;h>>6-s%4*2;i[o>>>2]|=a<<24-o%4*8,o++}return r.create(i,o)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o>>6-s%4*2;i[o>>>2]|=a<<24-o%4*8,o++}return r.create(i,o)}t.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,n=e.sigBytes,i=t?this._safe_map:this._map;e.clamp();for(var o=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(r[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|r[s+2>>>2]>>>24-(s+2)%4*8&255,c=0;c<4&&s+.75*c>>6*(3-c)&63));var u=i.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,i=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var s=0;s>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>1]|=e.charCodeAt(i)<<16-i%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16})},87579:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(54724),r(52657))}(0,function(e){return!function(){var t=e,r=t.lib,n=r.Base,i=r.WordArray,o=t.algo,s=o.MD5,a=o.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,o=n.hasher.create(),s=i.create(),a=s.words,c=n.keySize,u=n.iterations;a.lengthi&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),a=o.words,c=s.words,u=0;u>>2]|=e[i]<<24-i%4*8;r.call(this,n,t)}else r.apply(this,arguments)}).prototype=t}}(),e.lib.WordArray})},96546:function(e,t,r){!function(n,i){e.exports=t=i(r(39317))}(0,function(e){return!function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360}var o=this._hash.words,s=e[t+0],c=e[t+1],p=e[t+2],d=e[t+3],y=e[t+4],g=e[t+5],_=e[t+6],v=e[t+7],b=e[t+8],m=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],x=e[t+13],k=e[t+14],T=e[t+15],B=o[0],A=o[1],M=o[2],O=o[3];B=u(B,A,M,O,s,7,a[0]),O=u(O,B,A,M,c,12,a[1]),M=u(M,O,B,A,p,17,a[2]),A=u(A,M,O,B,d,22,a[3]),B=u(B,A,M,O,y,7,a[4]),O=u(O,B,A,M,g,12,a[5]),M=u(M,O,B,A,_,17,a[6]),A=u(A,M,O,B,v,22,a[7]),B=u(B,A,M,O,b,7,a[8]),O=u(O,B,A,M,m,12,a[9]),M=u(M,O,B,A,w,17,a[10]),A=u(A,M,O,B,S,22,a[11]),B=u(B,A,M,O,E,7,a[12]),O=u(O,B,A,M,x,12,a[13]),M=u(M,O,B,A,k,17,a[14]),A=u(A,M,O,B,T,22,a[15]),B=l(B,A,M,O,c,5,a[16]),O=l(O,B,A,M,_,9,a[17]),M=l(M,O,B,A,S,14,a[18]),A=l(A,M,O,B,s,20,a[19]),B=l(B,A,M,O,g,5,a[20]),O=l(O,B,A,M,w,9,a[21]),M=l(M,O,B,A,T,14,a[22]),A=l(A,M,O,B,y,20,a[23]),B=l(B,A,M,O,m,5,a[24]),O=l(O,B,A,M,k,9,a[25]),M=l(M,O,B,A,d,14,a[26]),A=l(A,M,O,B,b,20,a[27]),B=l(B,A,M,O,x,5,a[28]),O=l(O,B,A,M,p,9,a[29]),M=l(M,O,B,A,v,14,a[30]),A=l(A,M,O,B,E,20,a[31]),B=h(B,A,M,O,g,4,a[32]),O=h(O,B,A,M,b,11,a[33]),M=h(M,O,B,A,S,16,a[34]),A=h(A,M,O,B,k,23,a[35]),B=h(B,A,M,O,c,4,a[36]),O=h(O,B,A,M,y,11,a[37]),M=h(M,O,B,A,v,16,a[38]),A=h(A,M,O,B,w,23,a[39]),B=h(B,A,M,O,x,4,a[40]),O=h(O,B,A,M,s,11,a[41]),M=h(M,O,B,A,d,16,a[42]),A=h(A,M,O,B,_,23,a[43]),B=h(B,A,M,O,m,4,a[44]),O=h(O,B,A,M,E,11,a[45]),M=h(M,O,B,A,T,16,a[46]),A=h(A,M,O,B,p,23,a[47]),B=f(B,A,M,O,s,6,a[48]),O=f(O,B,A,M,v,10,a[49]),M=f(M,O,B,A,k,15,a[50]),A=f(A,M,O,B,g,21,a[51]),B=f(B,A,M,O,E,6,a[52]),O=f(O,B,A,M,d,10,a[53]),M=f(M,O,B,A,w,15,a[54]),A=f(A,M,O,B,c,21,a[55]),B=f(B,A,M,O,b,6,a[56]),O=f(O,B,A,M,T,10,a[57]),M=f(M,O,B,A,_,15,a[58]),A=f(A,M,O,B,x,21,a[59]),B=f(B,A,M,O,y,6,a[60]),O=f(O,B,A,M,S,10,a[61]),M=f(M,O,B,A,p,15,a[62]),A=f(A,M,O,B,m,21,a[63]),o[0]=o[0]+B|0,o[1]=o[1]+A|0,o[2]=o[2]+M|0,o[3]=o[3]+O|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var o=t.floor(n/4294967296),s=n;r[(i+64>>>9<<4)+15]=(o<<8|o>>>24)&16711935|(o<<24|o>>>8)&4278255360,r[(i+64>>>9<<4)+14]=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,e.sigBytes=(r.length+1)*4,this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,o,s){var a=e+(t&r|~t&n)+i+s;return(a<>>32-o)+t}function l(e,t,r,n,i,o,s){var a=e+(t&n|r&~n)+i+s;return(a<>>32-o)+t}function h(e,t,r,n,i,o,s){var a=e+(t^r^n)+i+s;return(a<>>32-o)+t}function f(e,t,r,n,i,o,s){var a=e+(r^(t|~n))+i+s;return(a<>>32-o)+t}r.MD5=o._createHelper(c),r.HmacMD5=o._createHmacHelper(c)}(Math),e.MD5})},90584:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(90576))}(0,function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,n){var i,o=this._iv;o?(i=o.slice(0),this._iv=void 0):i=this._prevBlock,n.encryptBlock(i,0);for(var s=0;s>24&255)==255){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0+(t<<16)+(r<<8)+n}else e+=16777216;return e}function n(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var i=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0),n(s);var a=s.slice(0);r.encryptBlock(a,0);for(var c=0;c>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923})},44121:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(90576))}(0,function(e){return e.pad.Iso10126={pad:function(t,r){var n=4*r,i=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(i-1)).concat(e.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126})},57457:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(90576))}(0,function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971})},64394:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(90576))}(0,function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding})},36490:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(90576))}(0,function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){for(var t=e.words,r=e.sigBytes-1,r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding})},51795:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(7940),r(52657))}(0,function(e){return!function(){var t=e,r=t.lib,n=r.Base,i=r.WordArray,o=t.algo,s=o.SHA256,a=o.HMAC,c=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=a.create(r.hasher,e),o=i.create(),s=i.create([1]),c=o.words,u=s.words,l=r.keySize,h=r.iterations;c.length>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)c.call(this);for(var i=0;i<8;i++)n[i]^=r[i+4&7];if(t){var o=t.words,s=o[0],a=o[1],u=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,l=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360,h=u>>>16|4294901760&l,f=l<<16|65535&u;n[0]^=u,n[1]^=h,n[2]^=l,n[3]^=f,n[4]^=u,n[5]^=h,n[6]^=l,n[7]^=f;for(var i=0;i<4;i++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=(i[n]<<8|i[n]>>>24)&16711935|(i[n]<<24|i[n]>>>8)&4278255360,e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0;for(var r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,a=n>>>16,c=((i*i>>>17)+i*a>>>15)+a*a,u=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.RabbitLegacy=r._createHelper(a)}(),e.RabbitLegacy})},70843:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(85925),r(96546),r(87579),r(90576))}(0,function(e){return!function(){var t=e,r=t.lib.StreamCipher,n=t.algo,i=[],o=[],s=[],a=n.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=(e[r]<<8|e[r]>>>24)&16711935|(e[r]<<24|e[r]>>>8)&4278255360;var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var r=0;r<4;r++)c.call(this);for(var r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var o=t.words,s=o[0],a=o[1],u=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,l=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360,h=u>>>16|4294901760&l,f=l<<16|65535&u;i[0]^=u,i[1]^=h,i[2]^=l,i[3]^=f,i[4]^=u,i[5]^=h,i[6]^=l,i[7]^=f;for(var r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=(i[n]<<8|i[n]>>>24)&16711935|(i[n]<<24|i[n]>>>8)&4278255360,e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0;for(var r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,a=n>>>16,c=((i*i>>>17)+i*a>>>15)+a*a,u=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.Rabbit=r._createHelper(a)}(),e.Rabbit})},14848:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(85925),r(96546),r(87579),r(90576))}(0,function(e){return!function(){var t=e,r=t.lib.StreamCipher,n=t.algo,i=n.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],i=0;i<256;i++)n[i]=i;for(var i=0,o=0;i<256;i++){var s=i%r,a=t[s>>>2]>>>24-s%4*8&255;o=(o+n[i]+a)%256;var c=n[i];n[i]=n[o],n[o]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[r],e[r]=o,n|=e[(e[t]+e[r])%256]<<24-8*i}return this._i=t,this._j=r,n}t.RC4=r._createHelper(i);var s=n.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});t.RC4Drop=r._createHelper(s)}(),e.RC4})},75461:function(e,t,r){!function(n,i){e.exports=t=i(r(39317))}(0,function(e){return!/** @preserve + (c) 2012 by Cédric Mesnil. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=i.create([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]),c=i.create([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]),u=i.create([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]),l=i.create([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]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),f=i.create([1352829926,1548603684,1836072691,2053994217,0]),p=s.RIPEMD160=o.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r,n,i,o,s,p,m,w,S,E,x,k=0;k<16;k++){var T=t+k,B=e[T];e[T]=(B<<8|B>>>24)&16711935|(B<<24|B>>>8)&4278255360}var A=this._hash.words,M=h.words,O=f.words,P=a.words,R=c.words,C=u.words,N=l.words;p=r=A[0],m=n=A[1],w=i=A[2],S=o=A[3],E=s=A[4];for(var k=0;k<80;k+=1)x=r+e[t+P[k]]|0,k<16?x+=d(n,i,o)+M[0]:k<32?x+=y(n,i,o)+M[1]:k<48?x+=g(n,i,o)+M[2]:k<64?x+=_(n,i,o)+M[3]:x+=v(n,i,o)+M[4],x|=0,x=(x=b(x,C[k]))+s|0,r=s,s=o,o=b(i,10),i=n,n=x,x=p+e[t+R[k]]|0,k<16?x+=v(m,w,S)+O[0]:k<32?x+=_(m,w,S)+O[1]:k<48?x+=g(m,w,S)+O[2]:k<64?x+=y(m,w,S)+O[3]:x+=d(m,w,S)+O[4],x|=0,x=(x=b(x,N[k]))+E|0,p=E,E=S,S=b(w,10),w=m,m=x;x=A[1]+i+S|0,A[1]=A[2]+o+E|0,A[2]=A[3]+s+p|0,A[3]=A[4]+r+m|0,A[4]=A[0]+n+w|0,A[0]=x},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[(n+64>>>9<<4)+14]=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,e.sigBytes=(t.length+1)*4,this._process();for(var i=this._hash,o=i.words,s=0;s<5;s++){var a=o[s];o[s]=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360}return i},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,r){return e^t^r}function y(e,t,r){return e&t|~e&r}function g(e,t,r){return(e|~t)^r}function _(e,t,r){return e&r|t&~r}function v(e,t,r){return e^(t|~r)}function b(e,t){return e<>>32-t}r.RIPEMD160=o._createHelper(p),r.HmacRIPEMD160=o._createHmacHelper(p)}(Math),e.RIPEMD160})},54724:function(e,t,r){!function(n,i){e.exports=t=i(r(39317))}(0,function(e){return!function(){var t=e,r=t.lib,n=r.WordArray,i=r.Hasher,o=t.algo,s=[],a=o.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],c=r[4],u=0;u<80;u++){if(u<16)s[u]=0|e[t+u];else{var l=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=l<<1|l>>>31}var h=(n<<5|n>>>27)+c+s[u];u<20?h+=(i&o|~i&a)+1518500249:u<40?h+=(i^o^a)+1859775393:u<60?h+=(i&o|i&a|o&a)-1894007588:h+=(i^o^a)-899497514,c=a,a=o,o=i<<30|i>>>2,i=n,n=h}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[(n+64>>>9<<4)+14]=Math.floor(r/4294967296),t[(n+64>>>9<<4)+15]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=i._createHelper(a),t.HmacSHA1=i._createHmacHelper(a)}(),e.SHA1})},92020:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(7940))}(0,function(e){return!function(){var t=e,r=t.lib.WordArray,n=t.algo,i=n.SHA256,o=n.SHA224=i.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}});t.SHA224=i._createHelper(o),t.HmacSHA224=i._createHmacHelper(o)}(),e.SHA224})},7940:function(e,t,r){!function(n,i){e.exports=t=i(r(39317))}(0,function(e){return!function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return(e-(0|e))*4294967296|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(a[i]=r(t.pow(n,.5))),c[i]=r(t.pow(n,1/3)),i++),n++}();var u=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],h=r[6],f=r[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var d=u[p-15],y=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,g=u[p-2],_=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;u[p]=y+u[p-7]+_+u[p-16]}var v=a&l^~a&h,b=n&i^n&o^i&o,m=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=f+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+v+c[p]+u[p],S=m+b;f=h,h=l,l=a,a=s+w|0,s=o,o=i,i=n,n=w+S|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+h|0,r[7]=r[7]+f|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[(i+64>>>9<<4)+14]=t.floor(n/4294967296),r[(i+64>>>9<<4)+15]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=o._createHelper(l),r.HmacSHA256=o._createHmacHelper(l)}(Math),e.SHA256})},26552:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(66061))}(0,function(e){return!function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.x64.Word,a=r.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=t%5,i=(2*e+3*t)%5;e=n,t=i}for(var e=0;e<5;e++)for(var t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,a=0;a<24;a++){for(var h=0,f=0,p=0;p<7;p++){if(1&o){var d=(1<>>24)&16711935|(o<<24|o>>>8)&4278255360,s=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360;var a=r[i];a.high^=s,a.low^=o}for(var f=0;f<24;f++){for(var p=0;p<5;p++){for(var d=0,y=0,g=0;g<5;g++){var a=r[p+5*g];d^=a.high,y^=a.low}var _=h[p];_.high=d,_.low=y}for(var p=0;p<5;p++)for(var v=h[(p+4)%5],b=h[(p+1)%5],m=b.high,w=b.low,d=v.high^(m<<1|w>>>31),y=v.low^(w<<1|m>>>31),g=0;g<5;g++){var a=r[p+5*g];a.high^=d,a.low^=y}for(var S=1;S<25;S++){var d,y,a=r[S],E=a.high,x=a.low,k=c[S];k<32?(d=E<>>32-k,y=x<>>32-k):(d=x<>>64-k,y=E<>>64-k);var T=h[u[S]];T.high=d,T.low=y}var B=h[0],A=r[0];B.high=A.high,B.low=A.low;for(var p=0;p<5;p++)for(var g=0;g<5;g++){var S=p+5*g,a=r[S],M=h[S],O=h[(p+1)%5+5*g],P=h[(p+2)%5+5*g];a.high=M.high^~O.high&P.high,a.low=M.low^~O.low&P.low}var a=r[0],R=l[f];a.high^=R.high,a.low^=R.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/o)*o>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,c=a/8,u=[],l=0;l>>24)&16711935|(f<<24|f>>>8)&4278255360,p=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,u.push(p),u.push(f)}return new i.init(u,a)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=o._createHelper(f),r.HmacSHA3=o._createHmacHelper(f)}(Math),e.SHA3})},42869:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(66061),r(12427))}(0,function(e){return!function(){var t=e,r=t.x64,n=r.Word,i=r.WordArray,o=t.algo,s=o.SHA512,a=o.SHA384=s.extend({_doReset:function(){this._hash=new i.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}});t.SHA384=s._createHelper(a),t.HmacSHA384=s._createHmacHelper(a)}(),e.SHA384})},12427:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(66061))}(0,function(e){return!function(){var t=e,r=t.lib.Hasher,n=t.x64,i=n.Word,o=n.WordArray,s=t.algo;function a(){return i.create.apply(i,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=a()}();var l=s.SHA512=r.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],h=r[6],f=r[7],p=n.high,d=n.low,y=i.high,g=i.low,_=o.high,v=o.low,b=s.high,m=s.low,w=a.high,S=a.low,E=l.high,x=l.low,k=h.high,T=h.low,B=f.high,A=f.low,M=p,O=d,P=y,R=g,C=_,N=v,I=b,D=m,j=w,U=S,F=E,L=x,W=k,z=T,K=B,H=A,q=0;q<80;q++){var Y,G,$=u[q];if(q<16)G=$.high=0|e[t+2*q],Y=$.low=0|e[t+2*q+1];else{var V=u[q-15],J=V.high,Z=V.low,X=(J>>>1|Z<<31)^(J>>>8|Z<<24)^J>>>7,Q=(Z>>>1|J<<31)^(Z>>>8|J<<24)^(Z>>>7|J<<25),ee=u[q-2],et=ee.high,er=ee.low,en=(et>>>19|er<<13)^(et<<3|er>>>29)^et>>>6,ei=(er>>>19|et<<13)^(er<<3|et>>>29)^(er>>>6|et<<26),eo=u[q-7],es=eo.high,ea=eo.low,ec=u[q-16],eu=ec.high,el=ec.low;G=X+es+((Y=Q+ea)>>>0>>0?1:0),Y+=ei,G=G+en+(Y>>>0>>0?1:0),Y+=el,G=G+eu+(Y>>>0>>0?1:0),$.high=G,$.low=Y}var eh=j&F^~j&W,ef=U&L^~U&z,ep=M&P^M&C^P&C,ed=O&R^O&N^R&N,ey=(M>>>28|O<<4)^(M<<30|O>>>2)^(M<<25|O>>>7),eg=(O>>>28|M<<4)^(O<<30|M>>>2)^(O<<25|M>>>7),e_=(j>>>14|U<<18)^(j>>>18|U<<14)^(j<<23|U>>>9),ev=(U>>>14|j<<18)^(U>>>18|j<<14)^(U<<23|j>>>9),eb=c[q],em=eb.high,ew=eb.low,eS=H+ev,eE=K+e_+(eS>>>0>>0?1:0),eS=eS+ef,eE=eE+eh+(eS>>>0>>0?1:0),eS=eS+ew,eE=eE+em+(eS>>>0>>0?1:0),eS=eS+Y,eE=eE+G+(eS>>>0>>0?1:0),ex=eg+ed,ek=ey+ep+(ex>>>0>>0?1:0);K=W,H=z,W=F,z=L,F=j,L=U,j=I+eE+((U=D+eS|0)>>>0>>0?1:0)|0,I=C,D=N,C=P,N=R,P=M,R=O,M=eE+ek+((O=eS+ex|0)>>>0>>0?1:0)|0}d=n.low=d+O,n.high=p+M+(d>>>0>>0?1:0),g=i.low=g+R,i.high=y+P+(g>>>0>>0?1:0),v=o.low=v+N,o.high=_+C+(v>>>0>>0?1:0),m=s.low=m+D,s.high=b+I+(m>>>0>>0?1:0),S=a.low=S+U,a.high=w+j+(S>>>0>>0?1:0),x=l.low=x+L,l.high=E+F+(x>>>0>>0?1:0),T=h.low=T+z,h.high=k+W+(T>>>0>>0?1:0),A=f.low=A+H,f.high=B+K+(A>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[(n+128>>>10<<5)+30]=Math.floor(r/4294967296),t[(n+128>>>10<<5)+31]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(l),t.HmacSHA512=r._createHmacHelper(l)}(),e.SHA512})},77850:function(e,t,r){!function(n,i,o){e.exports=t=i(r(39317),r(85925),r(96546),r(87579),r(90576))}(0,function(e){return!function(){var t=e,r=t.lib,n=r.WordArray,i=r.BlockCipher,o=t.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=o.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=s[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){for(var u=i[o]=[],l=c[o],r=0;r<24;r++)u[r/6|0]|=t[(a[r]-1+l)%28]<<31-r%6,u[4+(r/6|0)]|=t[28+(a[r+24]-1+l)%28]<<31-r%6;u[0]=u[0]<<1|u[0]>>>31;for(var r=1;r<7;r++)u[r]=u[r]>>>(r-1)*4+3;u[7]=u[7]<<5|u[7]>>>27}for(var h=this._invSubKeys=[],r=0;r<16;r++)h[r]=i[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],f.call(this,4,252645135),f.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),f.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,s=this._rBlock,a=0,c=0;c<8;c++)a|=u[c][((s^i[c])&l[c])>>>0];this._lBlock=s,this._rBlock=o^a}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function f(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),i=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=h.createEncryptor(n.create(t)),this._des2=h.createEncryptor(n.create(r)),this._des3=h.createEncryptor(n.create(i))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=i._createHelper(d)}(),e.TripleDES})},66061:function(e,t,r){!function(n,i){e.exports=t=i(r(39317))}(0,function(e){return!function(){var t=e,r=t.lib,n=r.Base,i=r.WordArray,o=t.x64={};o.Word=n.extend({init:function(e,t){this.high=e,this.low=t}}),o.WordArray=n.extend({init:function(e,t){e=this.words=e||[],void 0!=t?this.sigBytes=t:this.sigBytes=8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n + * MIT Licence + */var o,s,a,c=9e15,u=1e9,l="0123456789abcdef",h="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",f="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",p={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},d=!0,y="[DecimalError] ",g=y+"Invalid argument: ",_=y+"Precision limit exceeded",v=y+"crypto unavailable",b="[object Decimal]",m=Math.floor,w=Math.pow,S=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,E=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,x=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,k=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,T=1e7,B=7,A=9007199254740991,M=h.length-1,O=f.length-1,P={toStringTag:b};function R(e){var t,r,n,i=e.length-1,o="",s=e[0];if(i>0){for(o+=s,t=1;tr)throw Error(g+e)}function N(e,t,r,n){var i,o,s,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=B,i=0):(i=Math.ceil((t+1)/B),t%=B),o=w(10,B-t),a=e[i]%o|0,null==n?t<3?(0==t?a=a/100|0:1==t&&(a=a/10|0),s=r<4&&99999==a||r>3&&49999==a||5e4==a||0==a):s=(r<4&&a+1==o||r>3&&a+1==o/2)&&(e[i+1]/o/100|0)==w(10,t-2)-1||(a==o/2||0==a)&&(e[i+1]/o/100|0)==0:t<4?(0==t?a=a/1e3|0:1==t?a=a/100|0:2==t&&(a=a/10|0),s=(n||r<4)&&9999==a||!n&&r>3&&4999==a):s=((n||r<4)&&a+1==o||!n&&r>3&&a+1==o/2)&&(e[i+1]/o/1e3|0)==w(10,t-3)-1,s}function I(e,t,r){for(var n,i,o=[0],s=0,a=e.length;sr-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}function D(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/et(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=ee(e,1,t.times(i),new e(1));for(var o=r;o--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=r,t}P.absoluteValue=P.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),U(e)},P.ceil=function(){return U(new this.constructor(this),this.e+1,2)},P.clampedTo=P.clamp=function(e,t){var r=this,n=r.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(g+t);return 0>r.cmp(e)?e:r.cmp(t)>0?t:new n(r)},P.comparedTo=P.cmp=function(e){var t,r,n,i,o=this,s=o.d,a=(e=new o.constructor(e)).d,c=o.s,u=e.s;if(!s||!a)return c&&u?c!==u?c:s===a?0:!s^c<0?1:-1:NaN;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(o.e!==e.e)return o.e>e.e^c<0?1:-1;for(t=0,r=(n=s.length)<(i=a.length)?n:i;ta[t]^c<0?1:-1;return n===i?0:n>i^c<0?1:-1},P.cosine=P.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+B,n.rounding=1,r=D(n,er(n,r)),n.precision=e,n.rounding=t,U(2==a||3==a?r.neg():r,e,t,!0)):new n(1):new n(NaN)},P.cubeRoot=P.cbrt=function(){var e,t,r,n,i,o,s,a,c,u,l=this,h=l.constructor;if(!l.isFinite()||l.isZero())return new h(l);for(d=!1,(o=l.s*w(l.s*l,1/3))&&Math.abs(o)!=1/0?n=new h(o.toString()):(r=R(l.d),(o=((e=l.e)-r.length+1)%3)&&(r+=1==o||-2==o?"0":"00"),o=w(r,1/3),e=m((e+1)/3)-(e%3==(e<0?-1:2)),(n=new h(r=o==1/0?"5e"+e:(r=o.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=l.s),s=(e=h.precision)+3;;)if(n=j((u=(c=(a=n).times(a).times(a)).plus(l)).plus(l).times(a),u.plus(c),s+2,1),R(a.d).slice(0,s)===(r=R(n.d)).slice(0,s)){if("9999"!=(r=r.slice(s-3,s+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(U(n,e+1,1),t=!n.times(n).times(n).eq(l));break}if(!i&&(U(a,e+1,0),a.times(a).times(a).eq(l))){n=a;break}s+=4,i=1}return d=!0,U(n,e,h.rounding,t)},P.decimalPlaces=P.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-m(this.e/B))*B,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},P.dividedBy=P.div=function(e){return j(this,new this.constructor(e))},P.dividedToIntegerBy=P.divToInt=function(e){var t=this,r=t.constructor;return U(j(t,new r(e),0,1,1),r.precision,r.rounding)},P.equals=P.eq=function(e){return 0===this.cmp(e)},P.floor=function(){return U(new this.constructor(this),this.e+1,3)},P.greaterThan=P.gt=function(e){return this.cmp(e)>0},P.greaterThanOrEqualTo=P.gte=function(e){var t=this.cmp(e);return 1==t||0===t},P.hyperbolicCosine=P.cosh=function(){var e,t,r,n,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;r=s.precision,n=s.rounding,s.precision=r+Math.max(o.e,o.sd())+4,s.rounding=1,(i=o.d.length)<32?t=(1/et(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=ee(s,1,o.times(t),new s(1),!0);for(var c,u=e,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return U(o,s.precision=r,s.rounding=n,!0)},P.hyperbolicSine=P.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(n=i.d.length)<3)i=ee(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=ee(o,2,i=i.times(1/et(5,e)),i,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);e--;)s=i.times(i),i=i.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=t,o.rounding=r,U(i,t,r,!0)},P.hyperbolicTangent=P.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,j(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},P.inverseCosine=P.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,o=r.rounding;return -1!==n?0===n?t.isNeg()?z(r,i,o):new r(0):new r(NaN):t.isZero()?z(r,i+4,o).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=z(r,i+4,o).times(.5),r.precision=i,r.rounding=o,e.minus(t))},P.inverseHyperbolicCosine=P.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,d=!1,r=r.times(r).minus(1).sqrt().plus(r),d=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},P.inverseHyperbolicSine=P.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,d=!1,r=r.times(r).plus(1).sqrt().plus(r),d=!0,n.precision=e,n.rounding=t,r.ln())},P.inverseHyperbolicTangent=P.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,Math.max(n=i.sd(),e)<-(2*i.e)-1)?U(new o(i),e,t,!0):(o.precision=r=n-i.e,i=j(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5)):new o(NaN)},P.inverseSine=P.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,-1!==t)?0===t?((e=z(o,r+4,n).times(.5)).s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2))},P.inverseTangent=P.atan=function(){var e,t,r,n,i,o,s,a,c,u=this,l=u.constructor,h=l.precision,f=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&h+4<=O)return(s=z(l,h+4,f).times(.25)).s=u.s,s}else{if(!u.s)return new l(NaN);if(h+4<=O)return(s=z(l,h+4,f).times(.5)).s=u.s,s}for(l.precision=a=h+10,l.rounding=1,e=r=Math.min(28,a/B+2|0);e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(d=!1,t=Math.ceil(a/B),n=1,c=u.times(u),s=new l(u),i=u;-1!==e;)if(i=i.times(c),o=s.minus(i.div(n+=2)),i=i.times(c),void 0!==(s=o.plus(i.div(n+=2))).d[t])for(e=t;s.d[e]===o.d[e]&&e--;);return r&&(s=s.times(2<this.d.length-2},P.isNaN=function(){return!this.s},P.isNegative=P.isNeg=function(){return this.s<0},P.isPositive=P.isPos=function(){return this.s>0},P.isZero=function(){return!!this.d&&0===this.d[0]},P.lessThan=P.lt=function(e){return 0>this.cmp(e)},P.lessThanOrEqualTo=P.lte=function(e){return 1>this.cmp(e)},P.logarithm=P.log=function(e){var t,r,n,i,o,s,a,c,u=this,l=u.constructor,h=l.precision,f=l.rounding,p=5;if(null==e)e=new l(10),t=!0;else{if(r=(e=new l(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new l(r&&!r[0]?-1/0:1!=u.s?NaN:r?0:1/0);if(t){if(r.length>1)o=!0;else{for(i=r[0];i%10==0;)i/=10;o=1!==i}}if(d=!1,N((c=j(s=V(u,a=h+p),n=t?W(l,a+10):V(e,a),a,1)).d,i=h,f))do if(a+=10,c=j(s=V(u,a),n=t?W(l,a+10):V(e,a),a,1),!o){+R(c.d).slice(i+1,i+15)+1==1e14&&(c=U(c,h+1,0));break}while(N(c.d,i+=10,f));return d=!0,U(c,h,f)},P.minus=P.sub=function(e){var t,r,n,i,o,s,a,c,u,l,h,f,p=this,y=p.constructor;if(e=new y(e),!p.d||!e.d)return p.s&&e.s?p.d?e.s=-e.s:e=new y(e.d||p.s!==e.s?p:NaN):e=new y(NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(u=p.d,f=e.d,a=y.precision,c=y.rounding,!u[0]||!f[0]){if(f[0])e.s=-e.s;else{if(!u[0])return new y(3===c?-0:0);e=new y(p)}return d?U(e,a,c):e}if(r=m(e.e/B),l=m(p.e/B),u=u.slice(),o=l-r){for((h=o<0)?(t=u,o=-o,s=f.length):(t=f,r=l,s=u.length),o>(n=Math.max(Math.ceil(a/B),s)+2)&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for((h=(n=u.length)<(s=f.length))&&(s=n),n=0;n0;--n)u[s++]=0;for(n=f.length;n>o;){if(u[--n](s=(o=Math.ceil(a/B))>s?o+1:s+1)&&(i=s,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((s=u.length)-(i=l.length)<0&&(i=s,r=l,l=u,u=r),t=0;i;)t=(u[--i]=u[i]+l[i]+t)/T|0,u[i]%=T;for(t&&(u.unshift(t),++n),s=u.length;0==u[--s];)u.pop();return e.d=u,e.e=L(u,n),d?U(e,a,c):e},P.precision=P.sd=function(e){var t,r=this;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(g+e);return r.d?(t=K(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},P.round=function(){var e=this,t=e.constructor;return U(new t(e),e.e+1,t.rounding)},P.sine=P.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+B,n.rounding=1,r=Q(n,er(n,r)),n.precision=e,n.rounding=t,U(a>2?r.neg():r,e,t,!0)):new n(NaN)},P.squareRoot=P.sqrt=function(){var e,t,r,n,i,o,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(1!==u||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(d=!1,0==(u=Math.sqrt(+s))||u==1/0?(((t=R(a)).length+c)%2==0&&(t+="0"),u=Math.sqrt(t),c=m((c+1)/2)-(c<0||c%2),n=new l(t=u==1/0?"5e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new l(u.toString()),r=(c=l.precision)+3;;)if(n=(o=n).plus(j(s,o,r+2,1)).times(.5),R(o.d).slice(0,r)===(t=R(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(U(n,c+1,1),e=!n.times(n).eq(s));break}if(!i&&(U(o,c+1,0),o.times(o).eq(s))){n=o;break}r+=4,i=1}return d=!0,U(n,c,l.rounding,e)},P.tangent=P.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=j(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,U(2==a||4==a?r.neg():r,e,t,!0)):new n(NaN)},P.times=P.mul=function(e){var t,r,n,i,o,s,a,c,u,l=this,h=l.constructor,f=l.d,p=(e=new h(e)).d;if(e.s*=l.s,!f||!f[0]||!p||!p[0])return new h(e.s&&(!f||f[0]||p)&&(!p||p[0]||f)?f&&p?0*e.s:e.s/0:NaN);for(r=m(l.e/B)+m(e.e/B),(c=f.length)<(u=p.length)&&(o=f,f=p,p=o,s=c,c=u,u=s),o=[],n=s=c+u;n--;)o.push(0);for(n=u;--n>=0;){for(t=0,i=c+n;i>n;)a=o[i]+p[n]*f[i-n-1]+t,o[i--]=a%T|0,t=a/T|0;o[i]=(o[i]+t)%T|0}for(;!o[--s];)o.pop();return t?++r:o.shift(),e.d=o,e.e=L(o,r),d?U(e,h.precision,h.rounding):e},P.toBinary=function(e,t){return en(this,2,e,t)},P.toDecimalPlaces=P.toDP=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(C(e,0,u),void 0===t?t=n.rounding:C(t,0,8),U(r,e+r.e+1,t))},P.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=F(n,!0):(C(e,0,u),void 0===t?t=i.rounding:C(t,0,8),r=F(n=U(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},P.toFixed=function(e,t){var r,n,i=this,o=i.constructor;return void 0===e?r=F(i):(C(e,0,u),void 0===t?t=o.rounding:C(t,0,8),r=F(n=U(new o(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},P.toFraction=function(e){var t,r,n,i,o,s,a,c,u,l,h,f,p=this,y=p.d,_=p.constructor;if(!y)return new _(p);if(u=r=new _(1),n=c=new _(0),s=(o=(t=new _(n)).e=K(y)-p.e-1)%B,t.d[0]=w(10,s<0?B+s:s),null==e)e=o>0?t:u;else{if(!(a=new _(e)).isInt()||a.lt(u))throw Error(g+a);e=a.gt(t)?o>0?t:u:a}for(d=!1,a=new _(R(y)),l=_.precision,_.precision=o=y.length*B*2;h=j(a,t,0,1,1),1!=(i=r.plus(h.times(n))).cmp(e);)r=n,n=i,i=u,u=c.plus(h.times(i)),c=i,i=t,t=a.minus(h.times(i)),a=i;return i=j(e.minus(r),n,0,1,1),c=c.plus(i.times(u)),r=r.plus(i.times(n)),c.s=u.s=p.s,f=1>j(u,n,o,1).minus(p).abs().cmp(j(c,r,o,1).minus(p).abs())?[u,n]:[c,r],_.precision=l,d=!0,f},P.toHexadecimal=P.toHex=function(e,t){return en(this,16,e,t)},P.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:C(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(d=!1,r=j(r,e,0,t,1).times(e),d=!0,U(r)):(e.s=r.s,r=e),r},P.toNumber=function(){return+this},P.toOctal=function(e,t){return en(this,8,e,t)},P.toPower=P.pow=function(e){var t,r,n,i,o,s,a=this,c=a.constructor,u=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(w(+a,u));if((a=new c(a)).eq(1))return a;if(n=c.precision,o=c.rounding,e.eq(1))return U(a,n,o);if((t=m(e.e/B))>=e.d.length-1&&(r=u<0?-u:u)<=A)return i=q(c,a,r,n),e.s<0?new c(1).div(i):U(i,n,o);if((s=a.s)<0){if(tc.maxE+1||t0?s/0:0):(d=!1,c.rounding=a.s=1,r=Math.min(12,(t+"").length),(i=$(e.times(V(a,n+r)),n)).d&&N((i=U(i,n+5,1)).d,n,o)&&(t=n+10,+R((i=U($(e.times(V(a,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=U(i,n+1,0))),i.s=s,d=!0,c.rounding=o,U(i,n,o))},P.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=F(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(C(e,1,u),void 0===t?t=i.rounding:C(t,0,8),r=F(n=U(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},P.toSignificantDigits=P.toSD=function(e,t){var r=this,n=r.constructor;return void 0===e?(e=n.precision,t=n.rounding):(C(e,1,u),void 0===t?t=n.rounding:C(t,0,8)),U(new n(r),e,t)},P.toString=function(){var e=this,t=e.constructor,r=F(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},P.truncated=P.trunc=function(){return U(new this.constructor(this),this.e+1,1)},P.valueOf=P.toJSON=function(){var e=this,t=e.constructor,r=F(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var j=function(){function e(e,t,r){var n,i=0,o=e.length;for(e=e.slice();o--;)n=e[o]*t+i,e[o]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;)e.shift()}return function(n,i,o,a,c,u){var l,h,f,p,d,y,g,_,v,b,w,S,E,x,k,A,M,O,P,R,C=n.constructor,N=n.s==i.s?1:-1,I=n.d,D=i.d;if(!I||!I[0]||!D||!D[0])return new C(n.s&&i.s&&(I?!D||I[0]!=D[0]:D)?I&&0==I[0]||!D?0*N:N/0:NaN);for(u?(d=1,h=n.e-i.e):(u=T,d=B,h=m(n.e/d)-m(i.e/d)),P=D.length,M=I.length,b=(v=new C(N)).d=[],f=0;D[f]==(I[f]||0);f++);if(D[f]>(I[f]||0)&&h--,null==o?(x=o=C.precision,a=C.rounding):x=c?o+(n.e-i.e)+1:o,x<0)b.push(1),y=!0;else{if(x=x/d+2|0,f=0,1==P){for(p=0,D=D[0],x++;(f1&&(D=e(D,p,u),I=e(I,p,u),P=D.length,M=I.length),A=P,S=(w=I.slice(0,P)).length;S=u/2&&++O;do p=0,(l=t(D,w,P,S))<0?(E=w[0],P!=S&&(E=E*u+(w[1]||0)),(p=E/O|0)>1?(p>=u&&(p=u-1),_=(g=e(D,p,u)).length,S=w.length,1==(l=t(g,w,_,S))&&(p--,r(g,P<_?R:D,_,u))):(0==p&&(l=p=1),g=D.slice()),(_=g.length)=10;p/=10)f++;v.e=f+h*d-1,U(v,c?o+v.e+1:o,a,y)}return v}}();function U(e,t,r,n){var i,o,s,a,c,u,l,h,f,p=e.constructor;e:if(null!=t){if(!(h=e.d))return e;for(i=1,a=h[0];a>=10;a/=10)i++;if((o=t-i)<0)o+=B,s=t,c=(l=h[f=0])/w(10,i-s-1)%10|0;else if((f=Math.ceil((o+1)/B))>=(a=h.length)){if(n){for(;a++<=f;)h.push(0);l=c=0,i=1,o%=B,s=o-B+1}else break e}else{for(i=1,l=a=h[f];a>=10;a/=10)i++;o%=B,c=(s=o-B+i)<0?0:l/w(10,i-s-1)%10|0}if(n=n||t<0||void 0!==h[f+1]||(s<0?l:l%w(10,i-s-1)),u=r<4?(c||n)&&(0==r||r==(e.s<0?3:2)):c>5||5==c&&(4==r||n||6==r&&(o>0?s>0?l/w(10,i-s):0:h[f-1])%10&1||r==(e.s<0?8:7)),t<1||!h[0])return h.length=0,u?(t-=e.e+1,h[0]=w(10,(B-t%B)%B),e.e=-t||0):h[0]=e.e=0,e;if(0==o?(h.length=f,a=1,f--):(h.length=f+1,a=w(10,B-o),h[f]=s>0?(l/w(10,i-s)%w(10,s)|0)*a:0),u)for(;;){if(0==f){for(o=1,s=h[0];s>=10;s/=10)o++;for(s=h[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(e.e++,h[0]==T&&(h[0]=1));break}if(h[f]+=a,h[f]!=T)break;h[f--]=0,a=1}for(o=h.length;0===h[--o];)h.pop()}return d&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e0?o=o.charAt(0)+"."+o.slice(1)+H(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+H(-i-1)+o,r&&(n=r-s)>0&&(o+=H(n))):i>=s?(o+=H(i+1-s),r&&(n=r-i-1)>0&&(o=o+"."+H(n))):((n=i+1)0&&(i+1===s&&(o+="."),o+=H(n))),o}function L(e,t){var r=e[0];for(t*=B;r>=10;r/=10)t++;return t}function W(e,t,r){if(t>M)throw d=!0,r&&(e.precision=r),Error(_);return U(new e(h),t,1,!0)}function z(e,t,r){if(t>O)throw Error(_);return U(new e(f),t,r,!0)}function K(e){var t=e.length-1,r=t*B+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function H(e){for(var t="";e--;)t+="0";return t}function q(e,t,r,n){var i,o=new e(1),s=Math.ceil(n/B+4);for(d=!1;;){if(r%2&&ei((o=o.times(t)).d,s)&&(i=!0),0===(r=m(r/2))){r=o.d.length-1,i&&0===o.d[r]&&++o.d[r];break}ei((t=t.times(t)).d,s)}return d=!0,o}function Y(e){return 1&e.d[e.d.length-1]}function G(e,t,r){for(var n,i=new e(t[0]),o=0;++o17)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(null==t?(d=!1,c=y):c=t,a=new f(.03125);e.e>-2;)e=e.times(a),h+=5;for(c+=n=Math.log(w(2,h))/Math.LN10*2+5|0,r=o=s=new f(1),f.precision=c;;){if(o=U(o.times(e),c,1),r=r.times(++l),R((a=s.plus(j(o,r,c,1))).d).slice(0,c)===R(s.d).slice(0,c)){for(i=h;i--;)s=U(s.times(s),c,1);if(null!=t)return f.precision=y,s;if(!(u<3&&N(s.d,c-n,p,u)))return U(s,f.precision=y,p,d=!0);f.precision=c+=10,r=o=a=new f(1),l=0,u++}s=a}}function V(e,t){var r,n,i,o,s,a,c,u,l,h,f,p=1,y=10,g=e,_=g.d,v=g.constructor,b=v.rounding,m=v.precision;if(g.s<0||!_||!_[0]||!g.e&&1==_[0]&&1==_.length)return new v(_&&!_[0]?-1/0:1!=g.s?NaN:_?0:g);if(null==t?(d=!1,l=m):l=t,v.precision=l+=y,n=(r=R(_)).charAt(0),!(15e14>Math.abs(o=g.e)))return u=W(v,l+2,m).times(o+""),g=V(new v(n+"."+r.slice(1)),l-y).plus(u),v.precision=m,null==t?U(g,m,b,d=!0):g;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=R((g=g.times(e)).d)).charAt(0),p++;for(o=g.e,n>1?(g=new v("0."+r),o++):g=new v(n+"."+r.slice(1)),h=g,c=s=g=j(g.minus(1),g.plus(1),l,1),f=U(g.times(g),l,1),i=3;;){if(s=U(s.times(f),l,1),R((u=c.plus(j(s,new v(i),l,1))).d).slice(0,l)===R(c.d).slice(0,l)){if(c=c.times(2),0!==o&&(c=c.plus(W(v,l+2,m).times(o+""))),c=j(c,new v(p),l,1),null!=t)return v.precision=m,c;if(!N(c.d,l-y,b,a))return U(c,v.precision=m,b,d=!0);v.precision=l+=y,u=s=g=j(h.minus(1),h.plus(1),l,1),f=U(g.times(g),l,1),i=a=1}c=u,i+=2}}function J(e){return String(e.s*e.s/0)}function Z(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%B,r<0&&(n+=B),ne.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),k.test(t))return Z(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(E.test(t))r=16,t=t.toLowerCase();else if(S.test(t))r=2;else if(x.test(t))r=8;else throw Error(g+t);for((s=t.search(/p/i))>0?(u=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),a=(s=t.indexOf("."))>=0,n=e.constructor,a&&(s=(c=(t=t.replace(".","")).length)-s,i=q(n,new n(r),s,2*s)),s=h=(l=I(t,r,T)).length-1;0===l[s];--s)l.pop();return s<0?new n(0*e.s):(e.e=L(l,h),e.d=l,d=!1,a&&(e=j(e,i,4*c)),u&&(e=e.times(54>Math.abs(u)?w(2,u):o.pow(2,u))),d=!0,e)}function Q(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:ee(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=ee(e,2,t=t.times(1/et(5,r)),t);for(var i,o=new e(5),s=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(s.times(i).minus(a))));return t}function ee(e,t,r,n,i){var o,s,a,c,u=e.precision,l=Math.ceil(u/B);for(d=!1,c=r.times(r),a=new e(n);;){if(s=j(a.times(c),new e(t++*t++),u,1),a=i?n.plus(s):n.minus(s),n=j(s.times(c),new e(t++*t++),u,1),void 0!==(s=a.plus(n)).d[l]){for(o=l;s.d[o]===a.d[o]&&o--;);if(-1==o)break}o=a,a=n,n=s,s=o}return d=!0,s.d.length=l+1,s}function et(e,t){for(var r=e;--t;)r*=e;return r}function er(e,t){var r,n=t.s<0,i=z(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return a=n?4:1,t;if((r=t.divToInt(i)).isZero())a=n?3:2;else{if((t=t.minus(r.times(i))).lte(o))return a=Y(r)?n?2:3:n?4:1,t;a=Y(r)?n?1:4:n?3:2}return t.minus(i).abs()}function en(e,t,r,n){var i,o,a,c,h,f,p,d,y,g=e.constructor,_=void 0!==r;if(_?(C(r,1,u),void 0===n?n=g.rounding:C(n,0,8)):(r=g.precision,n=g.rounding),e.isFinite()){for(a=(p=F(e)).indexOf("."),_?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,a>=0&&(p=p.replace(".",""),(y=new g(1)).e=p.length-a,y.d=I(F(y),10,i),y.e=y.d.length),o=h=(d=I(p,10,i)).length;0==d[--h];)d.pop();if(d[0]){if(a<0?o--:((e=new g(e)).d=d,e.e=o,d=(e=j(e,y,r,n,0,i)).d,o=e.e,f=s),a=d[r],c=i/2,f=f||void 0!==d[r+1],f=n<4?(void 0!==a||f)&&(0===n||n===(e.s<0?3:2)):a>c||a===c&&(4===n||f||6===n&&1&d[r-1]||n===(e.s<0?8:7)),d.length=r,f)for(;++d[--r]>i-1;)d[r]=0,r||(++o,d.unshift(1));for(h=d.length;!d[h-1];--h);for(a=0,p="";a1){if(16==t||8==t){for(a=16==t?4:3,--h;h%a;h++)p+="0";for(h=(d=I(p,i,t)).length;!d[h-1];--h);for(a=1,p="1.";ah)for(o-=h;o--;)p+="0";else ot)return e.length=t,!0}function eo(e){return new this(e).abs()}function es(e){return new this(e).acos()}function ea(e){return new this(e).acosh()}function ec(e,t){return new this(e).plus(t)}function eu(e){return new this(e).asin()}function el(e){return new this(e).asinh()}function eh(e){return new this(e).atan()}function ef(e){return new this(e).atanh()}function ep(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?z(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=z(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,r=this.atan(j(e,t,o,1)),t=z(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(j(e,t,o,1)):(r=z(this,o,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function ed(e){return new this(e).cbrt()}function ey(e){return U(e=new this(e),e.e+1,2)}function eg(e,t,r){return new this(e).clamp(t,r)}function e_(e){if(!e||"object"!=typeof e)throw Error(y+"Object expected");var t,r,n,i=!0===e.defaults,o=["precision",1,u,"rounding",0,8,"toExpNeg",-c,0,"toExpPos",0,c,"maxE",0,c,"minE",-c,0,"modulo",0,9];for(t=0;t=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(g+r+": "+n)}if(r="crypto",i&&(this[r]=p[r]),void 0!==(n=e[r])){if(!0===n||!1===n||0===n||1===n){if(n){if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(v)}else this[r]=!1}else throw Error(g+r+": "+n)}return this}function ev(e){return new this(e).cos()}function eb(e){return new this(e).cosh()}function em(e){var t,r,n;function i(e){var t,r,n,o=this;if(!(o instanceof i))return new i(e);if(o.constructor=i,ek(e)){o.s=e.s,d?!e.d||e.e>i.maxE?(o.e=NaN,o.d=null):e.e=10;r/=10)t++;d?t>i.maxE?(o.e=NaN,o.d=null):t=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);o=214e7?crypto.randomBytes(4).copy(t,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(v)}else for(;o=10;i/=10)n++;n3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,l=arguments.length>6&&arguments[6],h=!!s&&s(e,t);if(n)n(e,t,{configurable:null===u&&h?h.configurable:!u,enumerable:null===a&&h?h.enumerable:!a,value:r,writable:null===c&&h?h.writable:!c});else if(!l&&(a||c||u))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");else e[t]=r}},45230:function(e,t,r){!function(t,n){"use strict";e.exports?e.exports=n(r(77085)):t.ed2curve=n(t.nacl)}(this,function(e){"use strict";if(!e)throw Error("tweetnacl not loaded");var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t=0;n--)f(i,i),2!==n&&4!==n&&h(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function d(e,r){var n,i,o,c=t(),u=t();for(n=0;n<16;n++)u[n]=r[n];for(s(u),s(u),s(u),i=0;i<2;i++){for(n=1,c[0]=u[0]-65517;n<15;n++)c[n]=u[n]-65535-(c[n-1]>>16&1),c[n-1]&=65535;c[15]=u[15]-32767-(c[14]>>16&1),o=c[15]>>16&1,c[14]&=65535,a(u,c,1-o)}for(n=0;n<16;n++)e[2*n]=255&u[n],e[2*n+1]=u[n]>>8}function y(e){var t=new Uint8Array(32);return d(t,e),1&t[0]}function g(e,t,r,n,i){var o,s=0;for(o=0;o>>8)-1}function _(e,t,r,n){return g(e,t,r,n,32)}function v(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return d(r,e),d(n,t),_(r,0,n,0)}function b(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)f(i,i),1!==n&&h(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function m(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function w(e,s){var a=t(),p=t(),d=t(),g=t(),_=t(),w=t(),S=t();return(m(e[2],n),c(e[1],s),f(d,e[1]),h(g,d,i),l(d,d,e[2]),u(g,e[2],g),f(_,g),f(w,_),h(S,w,_),h(a,S,d),h(a,a,g),b(a,a),h(a,a,d),h(a,a,g),h(a,a,g),h(e[0],a,g),f(p,e[0]),h(p,p,g),v(p,d)&&h(e[0],e[0],o),f(p,e[0]),h(p,p,g),v(p,d))?-1:(y(e[0])===s[31]>>7&&l(e[0],r,e[0]),h(e[3],e[0],e[1]),0)}function S(e){var r=new Uint8Array(32),i=[t(),t(),t(),t()],o=t(),s=t();if(w(i,e))return null;var a=i[1];return u(o,n,a),l(s,n,a),p(s,s),h(o,o,s),d(r,o),r}function E(t){var r,n=new Uint8Array(64),i=new Uint8Array(32);for(e.lowlevel.crypto_hash(n,t,32),n[0]&=248,n[31]&=127,n[31]|=64,r=0;r<32;r++)i[r]=n[r];for(r=0;r<64;r++)n[r]=0;return i}function x(e){var t=S(e.publicKey);return t?{publicKey:t,secretKey:E(e.secretKey)}:null}return{convertPublicKey:S,convertSecretKey:E,convertKeyPair:x}})},7723:function(e,t,r){"use strict";var n=r(77323)("%Object.defineProperty%",!0)||!1;if(n)try{n({},"a",{value:1})}catch(e){n=!1}e.exports=n},41479:function(e){"use strict";e.exports=EvalError},19509:function(e){"use strict";e.exports=Error},33231:function(e){"use strict";e.exports=RangeError},78531:function(e){"use strict";e.exports=ReferenceError},97422:function(e){"use strict";e.exports=SyntaxError},31354:function(e){"use strict";e.exports=TypeError},88150:function(e){"use strict";e.exports=URIError},68885:function(e){"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};function i(e){console&&console.warn&&console.warn(e)}t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=v,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function c(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){if(c(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),a=s[t]),void 0===a)a=s[t]=r,++e._eventsCount;else if("function"==typeof a?a=s[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=u(e))>0&&a.length>o&&!a.warned){a.warned=!0;var o,s,a,l=Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,i(l)}return e}function h(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=h.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?_(i):y(i,i.length)}function d(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function y(e,t){for(var r=Array(t),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var s,a=Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else for(var u=c.length,l=y(c,u),r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():g(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0==arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0==arguments.length){var i,o=Object.keys(r);for(n=0;n=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},s.prototype.listenerCount=d,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},35609:function(e,t,r){"use strict";var n=r(70342),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty,s=function(e,t,r){for(var n=0,i=e.length;n=3&&(o=r),"[object Array]"===i.call(e)?s(e,t,o):"string"==typeof e?a(e,t,o):c(e,t,o)};e.exports=u},42558:function(e){e.exports="object"==typeof self?self.FormData:window.FormData},78734:function(e){"use strict";var t="Function.prototype.bind called on incompatible ",r=Object.prototype.toString,n=Math.max,i="[object Function]",o=function(e,t){for(var r=[],n=0;n1&&"boolean"!=typeof t)throw new u('"allowMissing" argument must be a boolean');if(null===P(/^%?[^%]*%?$/,e))throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=N(e),n=r.length>0?r[0]:"",i=I("%"+n+"%",t),o=i.name,s=i.value,a=!1,l=i.alias;l&&(n=l[0],A(r,B([0,1],l)));for(var h=1,f=!0;h=r.length){var _=p(s,d);s=(f=!!_)&&"get"in _&&!("originalValue"in _.get)?_.get:s[d]}else f=T(s,d),s=s[d];f&&!a&&(w[o]=s)}}return s}},55601:function(e,t,r){"use strict";var n=r(77323)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n},24364:function(e,t,r){e.exports=r(90014)},90014:function(e,t,r){e=r.nmd(e),function(){function t(e,n){return n?r(3592)(e):e.slice?t[i(e)]:function(r,n){e(r={exports:{}}),t[i(n)]=r.exports};function i(e){return e.split("/").slice(-1).toString().replace(".js","")}}var n=e;t(function(e){String.random=function(e,t){var r="";for(e=e||24,t=t||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";e-- >0;)r+=t.charAt(Math.floor(Math.random()*t.length));return r},String.match=function(e,t){var r,n;return"string"==typeof e&&("string"==typeof t&&(t={"=":t}),e===(r=(t=t||{})["="]||t["*"]||t[">"]||t["<"])||n===t["="]&&(r=t["*"]||t[">"],e.slice(0,(r||"").length)===r||n===t["*"]&&(n!==t[">"]&&n!==t["<"]?e>=t[">"]&&e<=t["<"]:n!==t[">"]&&e>=t[">"]||n!==t["<"]&&e<=t["<"])))},String.hash=function(e,t){if("string"==typeof e){if(t=t||0,!e.length)return t;for(var r=0,n=e.length;r=o.now()-r&&n++<3333){e();return}i(function(){r=o.now(),e()},n=0)}}(),function(){var e,t=setTimeout,r=t.turn=t.turn||function(e){1==n.push(e)&&i(s)},n=r.s=[],i=t.poll,o=0,s=function(){(e=n[o++])&&e(),(o==n.length||99==o)&&(n=r.s=n.slice(o),o=0),n.length&&i(s)}}(),function(){var e,t=setTimeout,r=t.turn;(t.each=t.each||function(t,n,i,o){o=o||9,function s(a,c,u){if(c=(a=(t||[]).splice(0,o)).length){for(var l=0;l"]||r;if(n)return"number"==typeof(n=n[t])?n:i},r.ify=function(e,t,r,i,o){(e=e||{})._=e._||{},o&&(e._["#"]=o);var s=e._[">"]||(e._[">"]={});return n!==t&&"_"!==t&&("number"==typeof r&&(s[t]=r),n!==i&&(e[t]=i)),e},e.exports=r})(t,"./state"),t(function(e){function r(e){var t={s:{}},r=t.s;e=e||{max:999,age:9e3},t.check=function(e){return!!r[e]&&n(e)};var n=t.track=function(i){var o=r[i]||(r[i]={});return o.was=t.now=+new Date,t.to||(t.to=setTimeout(t.drop,e.age+9)),n.ed&&n.ed(i),o};return t.drop=function(n){t.to=null,t.now=+new Date;var i=Object.keys(r);console.STAT&&console.STAT(t.now,+new Date-t.now,"dup drop keys"),setTimeout.each(i,function(i){var o=r[i];o&&(n||e.age)>t.now-o.was||delete r[i]},0,99)},t}t("./shim"),e.exports=r})(t,"./dup"),t(function(e){t("./onto"),e.exports=function(e,t){if(this.on){var n=(this.opt||{}).lack||9e3;if("function"!=typeof e){if(!e)return;var i=e["#"]||e,o=(this.tag||"")[i];if(!o)return;return t&&(clearTimeout((o=this.on(i,t)).err),o.err=setTimeout(function(){o.off()},n)),!0}var i=t&&t["#"]||r(9);if(!e)return i;var s=this.on(i,e,t);return s.err=s.err||setTimeout(function(){s.off(),s.next({err:"Error: No ACK yet.",lack:!0})},n),i}};var r=String.random||function(){return Math.random().toString(36).slice(2)}})(t,"./ask"),t(function(e){function r(e){return e instanceof r?(this._={$:this}).$:this instanceof r?r.create(this._={$:this,opt:e}):new r(e)}r.is=function(e){return e instanceof r||e&&e._&&e===e._.$||!1},r.version=.202,r.chain=r.prototype,r.chain.toJSON=function(){},t("./shim"),r.valid=t("./valid"),r.state=t("./state"),r.on=t("./onto"),r.dup=t("./dup"),r.ask=t("./ask"),function(){function e(n){if(n){if(n.out===e){this.to.next(n);return}var i,o=this,s=o.as,c=s.at||s,u=c.$,l=c.dup,h=n.DBG;if((i=n["#"])||(i=n["#"]=a(9)),!l.check(i)){if(l.track(i),i=n._,n._="function"==typeof i?i:function(){},n.$&&n.$===(n.$._||"").$||(n.$=u),n["@"]&&!n.put&&p(n),!c.ask(n["@"],n)){if(h&&(h.u=+new Date),n.put){t(n);return}n.get&&r.on.get(n,u)}h&&(h.uc=+new Date),o.to.next(n),h&&(h.ua=+new Date),n.nts||n.NTS||(n.out=e,c.on("out",n),h&&(h.ue=+new Date))}}}function t(t){if(t){var r=t._||"",o=r.root=((r.$=t.$||"")._||"").root;if(t["@"]&&r.faith&&!r.miss){t.out=e,o.on("out",t);return}r.latch=o.hatch,r.match=o.hatch=[];var a=t.put,l=r.DBG=t.DBG,h=+new Date;if(y=y||h,!a["#"]||!a["."]){l&&(l.p=h),r["#"]=t["#"],r.msg=t,r.all=0,r.stun=1;var f=Object.keys(a);console.STAT&&console.STAT(h,((l||r).pk=+new Date)-h,"put sort");var p,d,v,b,m,S,E,x=0;!function e(o){if(p!=x){if(p=x,!(v=f[x])){console.STAT&&console.STAT(h,((l||r).pd=+new Date)-h,"put"),s(r);return}(b=a[v])?(E=b._)?v!==E["#"]?S=g+_(v)+"soul not same.":(m=E[">"])||(S=g+_(v)+"no state."):S=g+_(v)+"no meta.":S=g+_(v)+"no node.",d=Object.keys(b||{})}if(S){t.err=r.err=S,s(r);return}var y,k=0;for(o=o||0;o++<9&&(y=d[k++]);)if("_"!==y){var T=b[y],B=m[y];if(i===B){S=g+_(y)+"on"+_(v)+"no state.";break}if(!u(T)){S=g+_(y)+"on"+_(v)+"bad "+typeof T+_(T);break}n(T,y,v,B,t),++w}if((d=d.slice(k)).length){c(e);return}++x,d=null,e(o)}()}}}function n(e,t,r,i,o){var s,a=o._||"",c=a.root,u=c.graph,h=u[r]||f,p=l(h,t,1),d=h[t],y=a.DBG;(s=console.STAT)&&(!u[r]||!d)&&(s.has=(s.has||0)+1);var g=m();if(i>g){setTimeout(function(){n(e,t,r,i,o)},(s=i-g)>b?b:s),console.STAT&&console.STAT((y||a).Hf=+new Date,s,"future");return}if(!(i":i},ok:o.ok,_:a})}}function o(e){(t=(e._||"").DBG)&&(t.pa=+new Date,t.pm=t.pm||+new Date);var t,r,n=this,i=n.as,o=i.graph,a=e._,c=e.put,u=c["#"],l=c["."],f=c[":"],p=c[">"];e["#"],(r=a.msg)&&(r=r.put)&&(r=r[u])&&h(r,l,p,f,u),o[u]=h(o[u],l,p,f,u),(r=(i.next||"")[u])&&r.on("in",e),s(a),n.to.next(e)}function s(t,r){if(!(t.stop||!t.err&&0<--t.stun)&&(t.stop=1,n=t.root)){var n,i=t.match;i.end=1,i===n.hatch&&((i=t.latch)&&!i.end?n.hatch=i:delete n.hatch),t.hatch&&t.hatch(),setTimeout.each(t.match,function(e){e&&e()}),(r=t.msg)&&!t.err&&!r.err&&(r.out=e,t.root.on("out",r),S())}}function p(e){var t,r=e["@"]||"";if(!(t=r._)){var n=(n=e.$)&&(n=n._)&&(n=n.root)&&(n=n.dup);if(!(n=n.check(r)))return;e["@"]=n["#"]||e["@"];return}t.acks=(t.acks||0)+1,(t.err=e.err)&&(e["@"]=t["#"],s(t)),t.ok=e.ok||t.ok,t.stop||t.crack||(t.crack=t.match&&t.match.push(function(){d(t)})),d(t)}function d(e){e&&e.root&&!e.stun&&e.acks===e.all&&e.root.on("in",{"@":e["#"],err:e.err,ok:e.err?i:e.ok||{"":1}})}r.create=function(t){t.root=t.root||t,t.graph=t.graph||{},t.on=t.on||r.on,t.ask=t.ask||r.ask,t.dup=t.dup||r.dup();var n=t.$.opt(t.opt);return t.once||(t.on("in",e,t),t.on("out",e,t),t.on("put",o,t),r.on("create",t),t.on("create",t)),t.once=1,n},r.on.put=t;var y,g="Error: Invalid graph!",_=function(e){return" '"+(""+e).slice(0,9)+"...' "},v=JSON.stringify,b=2147483647,m=r.state,w=0,S=function(){w>999&&-(w/(y-(y=+new Date)))>1&&(r.window&&console.log("Warning: You're syncing 1K+ records a second, faster than DOM can update - consider limiting query."),S=function(){w=0})}}(),function(){function e(e,t){var r=+new Date,n=e._||{},o=n.DBG=e.DBG,s=e["#"],c=a(9),u=Object.keys(t||"").sort(),f=((t||"")._||"")["#"],p=(u.length,e.$._.root),d=t===p.graph[f];console.STAT&&console.STAT(r,((o||n).gk=+new Date)-r,"got keys"),t&&function e(){r=+new Date;for(var n,y,g,_=0,v={};_<9&&(y=u[_++]);)h(v,y,l(t,y),t[y],f);u=u.slice(_),(g={})[f]=v,v=g,d&&((n=function(){}).ram=n.faith=!0),g=u.length,console.STAT&&console.STAT(r,-(r-(r=+new Date)),"got copied some"),o&&(o.ga=+new Date),p.on("in",{"@":s,"#":c,put:v,"%":g?c=a(9):i,$:p.$,_:n,DBG:o,FOO:1}),console.STAT&&console.STAT(r,+new Date-r,"got in"),g&&setTimeout.turn(e)}(),t||p.on("in",{"@":e["#"]})}r.on.get=function(t,r){var n=r._,o=t.get,s=o["#"],a=n.graph[s],c=o["."],u=(n.next||(n.next={}))[s],f=(t._||{}).DBG=t.DBG;if(f&&(f.g=+new Date),!a)return n.on("get",t);if(c){if(("string"!=typeof c||i===a[c])&&!((u||"").next||"")[c]){n.on("get",t);return}a=h({},c,l(a,c),a[c],s)}a&&e(t,a),n.on("get",t)},r.on.get.ack=e}(),function(){r.chain.opt=function(e){e=e||{};var t=this,n=t._,i=e.peers||e;return Object.plain(e)||(e={}),Object.plain(n.opt)||(n.opt=e),"string"==typeof i&&(i=[i]),Object.plain(n.opt.peers)||(n.opt.peers={}),i instanceof Array&&(e.peers={},i.forEach(function(t){var r={};r.id=r.url=t,e.peers[t]=n.opt.peers[t]=n.opt.peers[t]||r})),s(e,function e(t){var r=this[t];if(this&&this.hasOwnProperty(t)||"string"==typeof r||Object.empty(r)){this[t]=r;return}(!r||r.constructor===Object||r instanceof Array)&&s(r,e)}),n.opt.from=e,r.on("opt",n),n.opt.uuid=n.opt.uuid||function(e){return r.state().toString(36).replace(".","")+String.random(e||12)},t}}();var i,o,s=function(e,t){Object.keys(e).forEach(t,e)},a=String.random,c=setTimeout.turn,u=r.valid,l=r.state.is,h=r.state.ify,f={};r.log=function(){return r.log.off||o.log.apply(o,arguments),[].slice.call(arguments).join(" ")},r.log.once=function(e,t,n){return(n=r.log.once)[e]=n[e]||0,n[e]++||r.log(t)},"undefined"!=typeof window&&((window.GUN=window.Gun=r).window=window);try{void 0!==n&&(n.exports=r)}catch(e){}e.exports=r,(r.window||{}).console=(r.window||{}).console||{log:function(){}},(o=console).only=function(e,t){return o.only.i&&e===o.only.i&&o.only.i++&&(o.log.apply(o,arguments)||t)},r.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, please ask for help on http://chat.gun.eco if anything takes you longer than 5min to figure out!")})(t,"./root"),t(function(e){t("./root").chain.back=function(e,t){if(-1===(e=e||1)||1/0===e)return this._.root.$;if(1===e)return(this._.back||this._).$;var i=this,o=i._;if("string"==typeof e&&(e=e.split(".")),e instanceof Array){for(var s=0,a=e.length,c=o;s":d(o.graph[i.soul],t)}}),r))return}else{if(r=i.ask&&i.ask[""],(i.ask||(i.ask={}))[""]=i,c!==i.put&&(i.on("in",i),r))return;e.$=i.$}return o.ask(a,e),o.on("in",e)}if(t["."])return n.get?(e={get:{".":n.get},$:n.$},(i.ask||(i.ask={}))[n.get]=e.$._):e={get:n.lex?e.get:{},$:n.$},i.on("out",e);(n.ask||(n.ask={}))[""]=n,n.get&&(t["."]=n.get,(i.ask||(i.ask={}))[n.get]=e.$._)}return i.on("out",e)}function i(e,t){var r,n=(t=t||this.as).root,i=e.$||(e.$=t.$),a=(i||"")._||u,l=e.put||"",f=l["#"],p=l["."],g=c!==l["="]?l["="]:l[":"],_=l[">"]||-1/0;if(c!==e.put&&(c===l["#"]||c===l["."]||c===l[":"]&&c===l["="]||c===l[">"])){if(!h(l)){if(!(f=((l||"")._||"")["#"])){console.log("chain not yet supported for",l,"...",e,t);return}return i=t.root.$.get(f),setTimeout.each(Object.keys(l).sort(),function(r){"_"!=r&&c!==(_=d(l,r))&&t.on("in",{$:i,put:{"#":f,".":r,"=":l[r],">":_},VIA:e})})}return void t.on("in",{$:a.back.$,put:{"#":f=a.back.soul,".":p=a.has||a.get,"=":l,">":d(a.back.put,p)},via:e})}(e.seen||"")[t.id]||((e.seen||(e.seen=function(){}))[t.id]=t,t!==a&&(Object.keys(e).forEach(function(t){l[t]=e[t]},l={}),l.get=t.get||l.get,t.soul||t.has?a.soul&&(l.$=t.$,l.$$=l.$$||a.$):l.$$$=l.$$$||t.$,e=l),s(e,t),(t.soul||e.$$)&&_>=d(n.graph[f],p)&&((l=n.$.get(f)._).put=y(l.put,p,_,g,f)),!a.soul&&_>=d(n.graph[f],p)&&(r=(n.$.get(f)._.next||"")[p])&&(r.put=g,"string"==typeof(l=h(g))&&(r.put=n.$.get(l)._.put||g)),this.to&&this.to.next(e),t.any&&setTimeout.each(Object.keys(t.any),function(r){(r=t.any[r])&&r(e)},0,99),t.echo&&setTimeout.each(Object.keys(t.echo),function(r){(r=t.echo[r])&&r.on("in",e)},0,99),((e.$$||"")._||a).soul&&(r=t.next)&&(r=r[p])&&(l={},Object.keys(e).forEach(function(t){l[t]=e[t]}),l.$=(e.$$||e.$).get(l.get=p),delete l.$$,delete l.$$$,r.on("in",l)),o(e,t))}function o(e,t){if(t=t||this.as||e.$._,(!e.$$||this===r.on)&&e.put&&!t.soul){var n,i=e.put||"",o=i["="]||i[":"],s=t.root,a=s.$.get(i["#"]).get(i["."])._;if("string"!=typeof(o=h(o))){this===r.on&&((a.echo||(a.echo={}))[t.id]=t);return}if(!(a.echo||(a.echo={}))[t.id]||(s.pass||"")[t.id]){if(n=s.pass){if(n[o+t.id])return;n[o+t.id]=1}(a.echo||(a.echo={}))[t.id]=t,t.has&&(t.link=o);var c=s.$.get(a.link=o)._;(c.echo||(c.echo={}))[a.id]=a;var n=t.ask||"";(n[""]||t.lex)&&c.on("out",{get:{"#":o}}),setTimeout.each(Object.keys(n),function(e,t){e&&(t=n[e])&&t.on("out",{get:{"#":o,".":e}})},0,99)}}}function s(e,t){var r,n,i=e.put||"",o=c!==i["="]?i["="]:i[":"],a=t.root;if(c===o){if(t.soul&&c!==t.put||(n=(e.$$||e.$||"")._||"",e["@"]&&(c!==n.put||c!==t.put)))return;(r=t.link||e.linked)&&delete(a.$.get(r)._.echo||"")[t.id],t.has&&(t.link=null),t.put=c,setTimeout.each(Object.keys(t.next||""),function(e,n){(n=t.next[e])&&(r&&delete(a.$.get(r).get(e)._.echo||"")[n.id],n.on("in",{get:e,put:c,$:n.$}))},0,99);return}!t.soul&&!e.$$&&(r=h(o),n=e.$._||"",(r!==n.link&&(!t.has||n.link)||(a.pass||"")[t.id]&&"string"!=typeof r)&&(delete(n.echo||"")[t.id],s({get:t.get,put:c,$:e.$,linked:e.linked=e.linked||n.link},t)))}function a(e,t){var n=this.as,i=n.$._,o=(i.root,n.get||""),s=(e.put||"")[o["#"]]||"";if(!e.put||"string"==typeof o["."]&&c===s[o["."]]){if(c!==i.put||!i.soul&&!i.has)return;i.ack=(i.ack||0)+1,i.on("in",{get:i.get,put:i.put=c,$:i.$,"@":e["@"]});return}(e._||{}).miss=1,r.on.put(e)}r.chain.chain=function(e){var t,n=this,i=n._,o=new(e||n).constructor(n),s=o._;return s.root=t=i.root,s.id=++t.once,s.back=n._,s.on=r.on,s.on("in",r.on.in,s),s.on("out",r.on.out,s),o},r.on.out=n,r.on.in=i,r.on.link=o,r.on.unlink=s;var c,u={},l=String.random,h=r.valid,f=function(e,t){return e&&Object.prototype.hasOwnProperty.call(e,t)},p=r.state,d=p.is,y=p.ify})(t,"./chain"),t(function(e){var r=t("./root");function n(e,t){var r=t._,n=r.next,i=t.chain()._;return n||(n=r.next={}),n[i.get=e]=i,t===r.root.$?i.soul=e:(r.soul||r.has)&&(i.has=e),i}function i(e,t,n,i){var o,a=e._,c=0;return(o=a.soul||a.link)?t(o,i,a):a.jam?a.jam.push([t,i]):(a.jam=[[t,i]],e.get(function(e,t){if(!(s===e.put&&!a.root.opt.super&&(o=Object.keys(a.root.opt.peers).length)&&++c<=o)){t.rid(e);var n,i=(i=e.$)&&i._||{},u=0;for(o=a.jam,delete a.jam;n=o[u++];){var l,h=n[0];n=n[1],h&&h(l=i.link||i.soul||r.valid(e.put)||((e.put||{})._||{})["#"],n,e,t)}}},{out:{get:{".":!0}}}),e)}function o(e){var t,r,n=this.at||this.on;if(!e||n.soul||n.has)return this.off();if(e=(e=(e=e.$||e)._||e).id){if(n.map,t=(r=this.seen||(this.seen={}))[e])return!0;r[e]=!0}}r.chain.get=function(e,t,u){var l,h;if("string"==typeof e){if(0==e.length)return(l=this.chain())._.err={err:r.log("0 length key!",e)},t&&t.call(l,l._.err),l;var f=this,p=f._;(l=(p.next||a)[e])||(l=e&&n(e,f)),l=l&&l.$}else if("function"==typeof e){if(!0===t)return i(this,e,t,u),this;l=this;var d,p=l._,y=t||{},g=p.root;y.at=p,y.ok=e;var _={};function v(e,t,n){if(!v.stun&&(!(o=g.pass)||o[d])){var i,o,a=e.$._,c=(e.$$||"")._,u=(c||a).put,l=!a.has&&!a.soul,h={};if((l||s===u)&&(u=s===((o=e.put)||"")["="]?s===(o||"")[":"]?o:o[":"]:o["="]),(i="string"==typeof(o=r.valid(u)))&&(u=s===(o=g.$.get(o)._.put)?y.not?s:u:o),!y.not||s!==u){if(s===y.stun){if((o=g.stun)&&o.on&&(p.$.back(function(e){if(o.on(""+e.id,h={}),(h.run||0)h.run&&((!h.stun||h.stun.end)&&(h.stun=o.on("stun"),h.stun=h.stun&&h.stun.last),h.stun&&!h.stun.end))){(h.stun.add||(h.stun.add={}))[d]=function(){v(e,t,1)};return}if(s===u&&(n=0),(o=g.hatch)&&!o.end&&s===y.hatch&&!n){if(_[a.$._.id])return;_[a.$._.id]=1,o.push(function(){v(e,t,1)});return}_={}}if(g.pass){if(g.pass[d+a.id])return;g.pass[d+a.id]=1}if(y.on){y.ok.call(a.$,u,a.get,e,t||v);return}if(y.v2020){y.ok(e,t||v);return}Object.keys(e).forEach(function(t){o[t]=e[t]},o={}),(e=o).put=u,y.ok.call(y.as,e,t||v)}}}return v.at=p,(p.any||(p.any={}))[d=String.random(7)]=v,v.off=function(){v.stun=1,p.any&&delete p.any[d]},v.rid=o,v.id=y.run||++g.once,h=g.pass,(g.pass={})[d]=1,y.out=y.out||{get:{}},p.on("out",y.out),g.pass=h,l}else{if("number"==typeof e)return this.get(""+e,t,u);if("string"==typeof(h=c(e)))return this.get(h,t,u);(h=this.get.next)&&(l=h(this,e))}return l?t&&"function"==typeof t&&l.get(t,u):((l=this.chain())._.err={err:r.log("Invalid get request!",e)},t&&t.call(l,l._.err)),l};var s,a={},c=r.valid})(t,"./get"),t(function(e){var r=t("./root");function n(e,t){if(t){t=(t._||"").id||t;var n,i=e.root.stun||(e.root.stun={on:r.on}),o={};e.stun||(e.stun=i.on("stun",function(){})),(n=i.on(""+t))&&n.the.last.next(o),o.run>=e.run||i.on(""+t,function(t){if(e.stun.end){this.off(),this.to.next(t);return}t.run=t.run||e.run,t.stun=t.stun||e.stun})}}function i(e){if(e.err){i.end(e.stun,e.root);return}if(!e.todo.length&&!e.end&&Object.empty(e.wait)){e.end=1;var t,n=e.$.back(-1)._,o=n.root,s=n.ask(function(t){o.on("ack",t),t.err&&!t.lack&&r.log(t),++a>(e.acks||0)&&this.off(),e.ack&&e.ack(t,this)},e.opt),a=0,c=e.stun;(t=function(){c&&(i.end(c,o),setTimeout.each(Object.keys(c=c.add||""),function(e){(e=c[e])&&e()}))}).hatch=t,e.ack&&!e.ok&&(e.ok=e.acks||9),e.via._.on("out",{put:e.out=e.graph,ok:e.ok&&{"@":e.ok+1},opt:e.opt,"#":s,_:t})}}function o(e){var t,r=e.via._;e.via=e.via.back(function(r){if(r.soul||!r.get)return r.$;t=e.data,(e.data={})[r.get]=t}),e.via&&e.via._.soul||(e.via=r.root.$.get(((e.data||"")._||"")["#"]||r.$.back("opt.uuid")())),e.via.put(e.data,e.ack,e)}function s(e,t){return e&&(t=e.constructor)&&t.name||typeof e}r.chain.put=function(e,t,c){var f=this,p=f._,d=p.root;(c=c||{}).root=p.root,c.run||(c.run=d.once),n(c,p.id),c.ack=c.ack||t,c.via=c.via||f,c.data=c.data||e,c.soul||(c.soul=p.soul||"string"==typeof t&&t);var y=c.state=c.state||r.state();return"function"==typeof e?e(function(e){c.data=e,f.put(a,a,c)}):c.soul?(c.$=d.$.get(c.soul),c.todo=[{it:c.data,ref:c.$}],c.turn=c.turn||u,c.ran=c.ran||i,function e(){var t,o,a,u,f,p=c.todo,d=p.pop(),g=d.it;if(d.ref&&d.ref._.id,n(c,d.ref),(u=d.todo)&&(g=g[o=u.pop()],u.length&&p.push(d)),o&&(p.path||(p.path=[])).push(o),!(t=l(g))&&!(f=r.is(g))){if(!Object.plain(g)){i.err(c,"Invalid data: "+s(g)+" at "+(c.via.back(function(e){e.get&&u.push(e.get)},u=[])||u.join("."))+"."+(p.path||[]).join("."));return}for(var _=c.seen||(c.seen=[]),v=_.length;v--;)if(g===(u=_[v]).it){t=g=u.link;break}}if(o&&t)d.node=h(d.node,o,y,g);else{if(!c.seen){i.err(c,"Data at root of graph must be a node (an object).");return}c.seen.push(a={it:g,link:{},todo:f?[]:Object.keys(g).sort().reverse(),path:(p.path||[]).slice(),up:d}),d.node=h(d.node,o,y,a.link),!f&&a.todo.length&&p.push(a);var b=c.seen.length;function m(e,t){var r=a.link["#"];t&&(t.off(),t.rid(e));var i=r||e.soul||(u=(e.$$||e.$)._||"").soul||u.link||((u=u.put||"")._||"")["#"]||u["#"]||((u=e.put||"")&&e.$$?u["#"]:(u["="]||u[":"]||"")["#"]);if(r||n(c,e.$),!i&&!d.link["#"]){(d.wait||(d.wait=[])).push(function(){m(e,t)});return}i||(i=[],(e.$$||e.$).back(function(e){if(u=e.soul||e.link)return i.push(u);i.push(e.get)}),i=i.reverse().join("/")),a.link["#"]=i,f||(((c.graph||(c.graph={}))[i]=a.node||(a.node={_:{}}))._["#"]=i),delete c.wait[b],a.wait&&setTimeout.each(a.wait,function(e){e&&e()}),c.ran(c)}(c.wait||(c.wait={}))[b]="",u=(a.ref=f?g:o?d.ref.get(o):d.ref)._,(u=g&&(g._||"")["#"]||u.soul||u.link)?m({soul:u}):a.ref.get(m,{run:c.run,v2020:1,out:{get:{".":" "}}})}if(!p.length)return c.ran(c);c.turn(e)}()):o(c),f},i.end=function(e,t){e.end=c,e.the.to===e&&e===e.the.last&&delete t.stun,e.off()},i.err=function(e,t){(e.ack||c).call(e,e.out={err:e.err=r.log(t)}),e.ran(e)};var a,c=function(){},u=setTimeout.turn,l=r.valid,h=r.state.ify})(t,"./put"),t(function(e){var r=t("./root");t("./chain"),t("./back"),t("./put"),t("./get"),e.exports=r})(t,"./index"),t(function(e){var r,n=t("./index");function i(e,t,r){return n.log.once("valonce","Chainable val is experimental, its behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it."),(r=e.chain())._.nix=e.once(function(e,t){r._.on("in",this._)}),r._.lex=e._.lex,r}n.chain.on=function(e,t,r,n){var i,o=this,s=o._;if(s.root,"string"==typeof e)return t?(i=s.on(e,t,r||s,n),r&&r.$&&(r.subs||(r.subs=[])).push(i),o):s.on(e);var a=t;return(a=!0===a?{change:!0}:a||{}).not=1,a.on=1,o.get(e,a),o},n.chain.once=function(e,t){if(t=t||{},!e)return i(this,t);var o,s=this,a=s._,c=a.root,u=(a.put,String.random(7));return s.get(function(i,s,l,h){var f=this,p=f._,d=p.one||(p.one={});if(!h.stun&&""!==d[u]){if(!0===(o=n.valid(i))){y();return}"string"!=typeof o&&(clearTimeout((a.one||"")[u]),clearTimeout(d[u]),d[u]=setTimeout(y,t.wait||99))}function y(g){if(p.has||p.soul||(p={put:i,get:s}),r===(o=p.put)&&(o=((l.$$||"")._||"").put),"string"==typeof n.valid(o)&&(o=c.$.get(o)._.put)===r&&!g){d[u]=setTimeout(function(){y(1)},t.wait||99);return}h.stun||""===d[u]||(d[u]="",(a.soul||a.has)&&h.off(),e.call(f,o,p.get),clearTimeout(d[u]))}},{on:1}),s},n.chain.off=function(){var e,t=this,r=t._,n=r.back;if(n)return r.ack=0,(e=n.next)&&e[r.get]&&delete e[r.get],(e=n.any)&&(delete n.any,n.any={}),(e=n.ask)&&delete e[r.get],(e=n.put)&&delete e[r.get],(e=r.soul)&&delete n.root.graph[e],(e=r.map)&&Object.keys(e).forEach(function(t,r){(r=e[t]).link&&n.root.$.get(r.link).off()}),(e=r.next)&&Object.keys(e).forEach(function(t,r){(r=e[t]).$.off()}),r.on("off",{}),t}})(t,"./on"),t(function(e){var r=t("./index"),n=r.chain.get.next;function i(e){this.to.next(e);var t,n=this.as,i=e.$._,o=e.put;(i.soul||e.$$)&&(!(t=n.lex)||String.match(e.get||(o||"")["."],t["."]||t["#"]||t))&&r.on.link(e,n)}r.chain.get.next=function(e,t){var r;return Object.plain(t)?(r=((r=t["#"])||"")["="]||r)?e.get(r):((r=e.chain()._).lex=t,e.on("in",function(e){String.match(e.get||(e.put||"")["."],t["."]||t["#"]||t)&&r.on("in",e),this.to.next(e)}),r.$):(n||s)(e,t)},r.chain.map=function(e,t,n){var a,c,u=this,l=u._;return(Object.plain(e)&&(a=e["."]?e:{".":e},e=o),e)?(r.log.once("mapfn","Map functions are experimental, their behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it."),c=u.chain(),u.map().on(function(t,n,i,a){var u=(e||s).call(this,t,n,i,a);if(o!==u){if(t===u)return c._.on("in",i);if(r.is(u))return c._.on("in",u._);var l={};Object.keys(i.put).forEach(function(e){l[e]=i.put[e]},l),l["="]=u,c._.on("in",{get:n,put:l})}})):(c=l.each)||((l.each=c=u.chain())._.lex=a||c._.lex||l.lex,c._.nix=u.back("nix"),u.on("in",i,c._)),c};var o,s=function(){}})(t,"./map"),t(function(e){var r=t("./index");r.chain.set=function(e,t,n){var i,o,s=this,a=s.back(-1);return(t=t||function(){},(n=n||{}).item=n.item||e,(i=((e||"")._||"")["#"])&&((e={})["#"]=i),"string"==typeof(o=r.valid(e)))?s.get(i=o).put(e,t,n):r.is(e)?(s.put(function(n){e.get(function(e,i,a){if(!e)return t.call(s,{err:r.log('Only a node can be linked! Not "'+a.put+'"!')});(o={})[e]={"#":e},n(o)},!0)}),e):(Object.plain(e)&&(e=a.get(i=s.back("opt.uuid")()).put(e)),s.get(i||a.back("opt.uuid")(7)).put(e,t,n))}})(t,"./set"),t(function(e){t("./shim");var r,n=function(){},i=JSON.parseAsync||function(e,t,r){var n,i=+new Date;try{t(n,JSON.parse(e,r),o.sucks(+new Date-i))}catch(e){t(e)}},o=JSON.stringifyAsync||function(e,t,r,n){var i,s=+new Date;try{t(i,JSON.stringify(e,r,n),o.sucks(+new Date-s))}catch(e){t(e)}};function s(e){var t=function(){},n=e.opt||{};n.log=n.log||console.log,n.gap=n.gap||n.wait||0,n.max=n.max||(n.memory?998001*n.memory:3e8)*.3,n.pack=n.pack||1e-4*n.max,n.puff=n.puff||9;var s=setTimeout.turn||setTimeout,a=e.dup,c=a.check,u=a.track,l=t.hear=function(e,r){if(e){if(n.max<=e.length)return t.say({dam:"!",err:"Message too big!"},r);t===this&&(l.d+=e.length||0,++l.c);var o,a=r.SH=+new Date,c=e[0];if("["===c){i(e,function(e,i){if(e||!i)return t.say({dam:"!",err:"DAM JSON parse error."},r);console.STAT&&console.STAT(+new Date,i.length,"# on hear batch");var o=n.puff;!function e(){for(var n,a=+new Date,c=0;ct.length):!!t.length)){if(!r)try{t=1===t.length?t[0]:JSON.stringify(t)}catch(e){return n.log("DAM JSON stringify error",e)}t&&f(t,e)}}function f(e,r){try{var n=r.wire;r.say?r.say(e):n.send&&n.send(e),t.say.d+=e.length||0,++t.say.c}catch(t){(r.queue=r.queue||[]).push(e)}}l.one=function(r,n,i){if(r.DBG&&(r.DBG=f={DBG:r.DBG}),f&&(f.h=i),f&&(f.hp=+new Date),(o=r["#"])||(o=r["#"]=String.random(9)),!((l=c(o))||(s=r["##"])&&(l=r["@"]||r.get&&o)&&a.check(h=l+s))){if((r._=function(){}).via=t.leap=n,(l=r["><"])&&"string"==typeof l&&l.slice(0,99).split(",").forEach(function(e){this[e]=1},r._.yo={}),l=r.dam){(l=t.hear[l])&&l(r,n,e),u(o);return}(l=r.ok)&&(r._.near=l["/"]);var o,s,l,h,f,i=+new Date;f&&(f.is=i),n.SI=o,u.ed=function(e){o===e&&(u.ed=0,(e=a.s[o])&&(e.via=n,r.get&&(e.it=r)))},e.on("in",t.last=r),f&&(f.hd=+new Date),console.STAT&&console.STAT(i,+new Date-i,r.get?"msg get":r.put?"msg put":"msg"),u(o),h&&u(h),t.leap=t.last=null}},l.c=l.d=0,function(){var e,i=0;function l(e,t){var r;return t instanceof Object?(Object.keys(t).sort().forEach(p,{to:r={},on:t}),r):t}function p(e){this.to[e]=this.on[e]}t.hash=function(e,r){var n,i,a,c=+new Date;o(e.put,function o(u,l){if(n=String.hash((i||(i=a=l||"")).slice(0,32768),n),i=i.slice(32768)){s(o,0);return}console.STAT&&console.STAT(c,+new Date-c,"say json+hash"),e._.$put=a,e["##"]=n,t.say(e,r),delete e._.$put},l)},t.say=function(o,c){if((l=this)&&(l=l.to)&&l.next&&l.next(o),!o)return!1;var l,p,d,y,g=o["@"],_=o._||(o._=function(){}),v=o.DBG,b=+new Date;if(_.y=_.y||b,!c&&v&&(v.y=b),(p=o["#"])||(p=o["#"]=String.random(9)),e||u(p),!(d=o["##"])&&r!==o.put&&!_.via&&g){t.hash(o,c);return}if(!c&&g&&(c=(l=a.s[g])&&(l.via||(l=l.it)&&(l=l._)&&l.via)||(l=t.last)&&g===l["#"]&&t.leap),!c&&g){if(a.s[g])return;return console.STAT&&console.STAT(+new Date,++i,"total no peer to ack to"),!1}if(g&&!o.put&&!d&&((a.s[g]||"").it||"")["##"])return!1;if(!c&&t.way)return t.way(o);if(v&&(v.yh=+new Date),!(y=_.raw)){t.raw(o,c);return}if(v&&(v.yr=+new Date),!c||!c.id){if(!Object.plain(c||n.peers))return!1;var b=+new Date;n.puff;var m=n.peers,w=Object.keys(c||n.peers||{});return console.STAT&&console.STAT(b,+new Date-b,"peer keys"),void function r(){var n=+new Date;e=1;var i=_.raw;_.raw=y;for(var a,l=0;l<9&&(a=(w||"")[l++]);)(a=m[a]||(c||"")[a])&&t.say(o,a);_.raw=i,e=0,w=w.slice(l),console.STAT&&console.STAT(n,+new Date-n,"say loop"),w.length&&(s(r,0),g&&u(g))}()}if(!c.wire&&t.wire&&t.wire(c),p!==c.last){if(c.last=p,c===_.via||(l=_.yo)&&(l[c.url]||l[c.pid]||l[c.id]))return!1;if(console.STAT&&console.STAT(b,((v||_).yp=+new Date)-(_.y||b),"say prep"),!e&&g&&u(g),c.batch){if(c.tail=(l=c.tail||0)+y.length,c.tail<=n.pack){c.batch+=(l?",":"")+y;return}h(c)}c.batch="[";var S=+new Date;setTimeout(function(){console.STAT&&console.STAT(S,+new Date-S,"0ms TO"),h(c)},n.gap),f(y,c),console.STAT&&g===c.SI&&console.STAT(b,+new Date-c.SH,"say ack")}},t.say.c=t.say.d=0,t.raw=function(e,i){if(!e)return"";var s,u,l=e._||{};if(u=l.raw)return u;if("string"==typeof e)return e;var h=e["##"],f=e["@"];if(h&&f){if(!l.via&&c(f+h))return!1;if(u=(a.s[f]||"").it){if(h===u["##"])return!1;u["##"]||(u["##"]=h)}}if(!e.dam&&!e["@"]){var p=0,d=[];for(var y in u=n.peers){var g=u[y];if(d.push(g.url||g.pid||g.id),++p>6)break}p>1&&(e["><"]=d.join())}if(e.put&&(u=e.ok)&&(e.ok={"@":(u["@"]||1)-1,"/":u["/"]==e._.near?t.near:u["/"]}),s=l.$put){u={},Object.keys(e).forEach(function(t){u[t]=e[t]}),u.put=":])([:",o(u,function(e,t){if(!e){var n=+new Date;u=t.indexOf('"put":":])([:"'),_(r,t=t.slice(0,u+6)+s+t.slice(u+14)),console.STAT&&console.STAT(n,+new Date-n,"say slice")}});return}function _(r,n){r||(l.raw=n,t.say(e,i))}o(e,_)}}(),t.near=0,t.hi=function(r){var i;if(!r.wire){t.wire(r.length&&{url:r,id:r}||r);return}r.id?n.peers[r.url||r.id]=r:(i=r.id=r.id||r.url||String.random(9),t.say({dam:"?",pid:e.opt.pid},n.peers[i]=r),delete a.s[r.last]),r.met||(t.near++,r.met=+new Date,e.on("hi",r)),i=r.queue,r.queue=[],setTimeout.each(i||[],function(e){f(e,r)},0,9)},t.bye=function(r){r.met&&--t.near,delete r.met,e.on("bye",r);var n=+new Date;n-=r.met||n,t.bye.time=((t.bye.time||n)+n)/2},t.hear["!"]=function(e,t){n.log("Error:",e.err)},t.hear["?"]=function(e,r){e.pid&&(r.pid||(r.pid=e.pid),e["@"])||(t.say({dam:"?",pid:n.pid,"@":e["#"]},r),delete a.s[r.last])},t.hear.mob=function(e,r){if(e.peers){var n=Object.keys(e.peers),i=n[Math.random()*n.length>>0];i&&(t.bye(r),t.hi(i))}},e.on("create",function(e){e.opt.pid=e.opt.pid||String.random(9),this.to.next(e),e.on("out",t.say)}),e.on("bye",function(e,t){e=n.peers[e.id||e]||e,this.to.next(e),e.bye?e.bye():(t=e.wire)&&t.close&&t.close(),delete n.peers[e.id],e.wire=null});var p={};return e.on("bye",function(e,r){this.to.next(e),(r=console.STAT)&&(r.peers=t.near),(r=e.url)&&(p[r]=!0,setTimeout(function(){delete p[r]},n.lack||9e3))}),e.on("hi",function(r,i){if(this.to.next(r),(i=console.STAT)&&(i.peers=t.near),!n.super){var o=Object.keys(e.next||"");o.length>9999&&!console.SUBS&&console.log(console.SUBS="Warning: You have more than 10K live GETs, which might use more bandwidth than your screen can show - consider `.off()`."),setTimeout.each(o,function(i){var o=e.next[i];if(n.super||(o.ask||"")[""]){t.say({get:{"#":i}},r);return}setTimeout.each(Object.keys(o.ask||""),function(n){n&&t.say({"##":String.hash((e.graph[i]||"")[n]),get:{"#":i,".":n}},r)})})}}),t}o.sucks=function(e){e>99&&(console.log("Warning: JSON blocking CPU detected. Add `gun/lib/yson.js` to fix."),o.sucks=n)};try{e.exports=s}catch(e){}})(t,"./mesh"),t(function(e){var r,n=t("./index");n.Mesh=t("./mesh"),n.on("opt",function(e){if(this.to.next(e),!e.once){var t=e.opt;if(!1!==t.WebSocket){var i=n.window||{},o=t.WebSocket||i.WebSocket||i.webkitWebSocket||i.mozWebSocket;if(o){t.WebSocket=o;var s=t.mesh=t.mesh||n.Mesh(e);s.wire||t.wire,s.wire=t.wire=u,setTimeout(function(){t.super||e.on("out",{dam:"hi"})},1);var a=1998,c=""+r!=typeof document&&document}}}function u(e){try{if(!e||!e.url)return n&&n(e);var r=e.url.replace(/^http/,"ws"),n=e.wire=new t.WebSocket(r);return n.onclose=function(){l(e),t.mesh.bye(e)},n.onerror=function(t){l(e)},n.onopen=function(){t.mesh.hi(e)},n.onmessage=function(r){r&&t.mesh.hear(r.data||r,e)},n}catch(r){t.mesh.bye(e)}}function l(e){clearTimeout(e.defer),!t.peers[e.url]||c&&e.retry<=0||(e.retry=(e.retry||t.retry+1||60)-(-e.tried+(e.tried=+new Date)<4*a?1:0),e.defer=setTimeout(function t(){if(c&&c.hidden)return setTimeout(t,a);u(e)},a))}})})(t,"./websocket"),t(function(e){if("undefined"!=typeof Gun){var t,r=function(){};try{t=(Gun.window||r).localStorage}catch(e){}t||(Gun.log("Warning: No localStorage exists to persist data to!"),t={setItem:function(e,t){this[e]=t},removeItem:function(e){delete this[e]},getItem:function(e){return this[e]}});var n=JSON.stringifyAsync||function(e,t,r,n){var i;try{t(i,JSON.stringify(e,r,n))}catch(e){t(e)}};Gun.on("create",function e(r){this.to.next(r);var i,o,s,a,c=r.opt,u=(r.graph,[]);if(!1!==c.localStorage){c.prefix=c.file||"gun/";try{i=e[c.prefix]=e[c.prefix]||JSON.parse(s=t.getItem(c.prefix))||{}}catch(t){i=e[c.prefix]={}}s=(s||"").length,r.on("get",function(e){this.to.next(e);var t,r,n,o,s=e.get;s&&(t=s["#"])&&((r=i[t]||o)&&(n=s["."])&&!Object.plain(n)&&(r=Gun.state.ify({},n,Gun.state.is(r,n),r[n],t)),Gun.on.get.ack(e,r))}),r.on("put",function(e){this.to.next(e);var t=e.put,n=t["#"],c=t["."],h=e["#"],f=e.ok||"";if(i[n]=Gun.state.ify(i[n],c,t[">"],t[":"],n),a&&s>4999880){r.on("in",{"@":h,err:"localStorage max!"});return}!e["@"]&&(!e._.via||Math.random()=0||1/0===e||-1/0===e)}},r.text=r.text||{is:function(e){return t("text"),"string"==typeof e}},r.text.ify=r.text.ify||function(e){return(t("text.ify"),r.text.is(e))?e:"undefined"!=typeof JSON?JSON.stringify(e):e&&e.toString?e.toString():e},r.text.random=r.text.random||function(e,r){t("text.random");var n="";for(e=e||24,r=r||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";e>0;)n+=r.charAt(Math.floor(Math.random()*r.length)),e--;return n},r.text.match=r.text.match||function(e,r){var n,i;return t("text.match"),"string"==typeof e&&("string"==typeof r&&(r={"=":r}),e===(n=(r=r||{})["="]||r["*"]||r[">"]||r["<"])||i===r["="]&&(n=r["*"]||r[">"]||r["<"],e.slice(0,(n||"").length)===n||i===r["*"]&&(i!==r[">"]&&i!==r["<"]?e>=r[">"]&&e<=r["<"]:i!==r[">"]&&e>=r[">"]||i!==r["<"]&&e<=r["<"])))},r.text.hash=r.text.hash||function(e,r){if(t("text.hash"),"string"==typeof e){if(r=r||0,!e.length)return r;for(var n=0,i=e.length;nr?1:0:0}},r.list.map=r.list.map||function(e,r,n){return t("list.map"),c(e,r,n)},r.list.index=1,r.obj=r.boj||{is:function(e){return t("obj"),!!e&&(e instanceof Object&&e.constructor===Object||"Object"===Object.prototype.toString.call(e).match(/^\[object (\w+)\]$/)[1])}},r.obj.put=r.obj.put||function(e,r,n){return t("obj.put"),(e||{})[r]=n,e},r.obj.has=r.obj.has||function(e,r){return t("obj.has"),e&&Object.prototype.hasOwnProperty.call(e,r)},r.obj.del=r.obj.del||function(e,r){if(t("obj.del"),e)return e[r]=null,delete e[r],e},r.obj.as=r.obj.as||function(e,r,n,i){return t("obj.as"),e[r]=e[r]||(i===n?{}:n)},r.obj.ify=r.obj.ify||function(e){if(t("obj.ify"),s(e))return e;try{e=JSON.parse(e)}catch(t){e={}}return e},function(){var e;function n(t,r){a(this,r)&&e!==this[r]||(this[r]=t)}r.obj.to=r.obj.to||function(e,r){return t("obj.to"),c(e,n,r=r||{}),r}}(),r.obj.copy=r.obj.copy||function(e){return t("obj.copy"),e?JSON.parse(JSON.stringify(e)):e},function(){function e(e,t){var r,n=this.n;if(!(n&&(t===n||s(n)&&a(n,t)))&&r!==t)return!0}r.obj.empty=r.obj.empty||function(r,n){return t("obj.empty"),!r||!c(r,e,{n:n})}}(),function(){function e(t,r){if(2==arguments.length){e.r=e.r||{},e.r[t]=r;return}e.r=e.r||[],e.r.push(t)}var n,o=Object.keys;Object.keys=Object.keys||function(e){return n(e,function(e,t,r){r(t)})},r.obj.map=n=r.obj.map||function(n,c,u){t("obj.map");var l,h,f,p,d,y=0,g="function"==typeof c;if(e.r=l,o&&s(n)&&(p=o(n),d=!0),u=u||{},i(n)||p)for(h=(p||n).length;yt?1:0},p=function(e,t,r,n,i){var o;if(null==r&&(r=0),null==i&&(i=s),r<0)throw Error("lo must be non-negative");for(null==n&&(n=e.length);ri(t,e[o=a((r+n)/2)])?n=o:r=o+1;return[].splice.apply(e,[r,r-r].concat(t)),t},l=function(e,t,r){return null==r&&(r=s),e.push(t),v(e,0,e.length-1,r)},u=function(e,t){var r,n;return null==t&&(t=s),r=e.pop(),e.length?(n=e[0],e[0]=r,b(e,0,t)):n=r,n},f=function(e,t,r){var n;return null==r&&(r=s),n=e[0],e[0]=t,b(e,0,r),n},h=function(e,t,r){var n;return null==r&&(r=s),e.length&&0>r(e[0],t)&&(t=(n=[e[0],t])[0],e[0]=n[1],b(e,0,r)),t},c=function(e,t){var r,n,i,o,c,u;for(null==t&&(t=s),o=(function(){u=[];for(var t=0,r=a(e.length/2);0<=r?tr;0<=r?t++:t--)u.push(t);return u}).apply(this).reverse(),c=[],n=0,i=o.length;nr(n=y[l],o)&&(p(a,n,0,null,r),a.pop(),o=a[a.length-1]);return a}for(c(e,r),_=[],i=h=0,g=d(t,e.length);0<=g?hg;i=0<=g?++h:--h)_.push(u(e,r));return _},v=function(e,t,r,n){var i,o,a;for(null==n&&(n=s),i=e[r];r>t;){if(0>n(i,o=e[a=r-1>>1])){e[r]=o,r=a;continue}break}return e[r]=i},b=function(e,t,r){var n,i,o,a,c;for(null==r&&(r=s),i=e.length,c=t,o=e[t],n=2*t+1;nr(e[n],e[a]))&&(n=a),e[t]=e[n],n=2*(t=n)+1;return e[t]=o,v(e,c,t,r)},o=function(){function e(e){this.cmp=null!=e?e:s,this.nodes=[]}return e.push=l,e.pop=u,e.replace=f,e.pushpop=h,e.heapify=c,e.updateItem=_,e.nlargest=y,e.nsmallest=g,e.prototype.push=function(e){return l(this.nodes,e,this.cmp)},e.prototype.pop=function(){return u(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return -1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return f(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return h(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return c(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return _(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),function(o,s){n=[],void 0!==(i="function"==typeof(r=s)?r.apply(t,n):r)&&(e.exports=i)}(0,function(){return o})}).call(this)},87398:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},52984:function(e,t,r){"use strict";var n=r(71118)(),i=r(50084)("Object.prototype.toString"),o=function(e){return(!n||!e||"object"!=typeof e||!(Symbol.toStringTag in e))&&"[object Arguments]"===i(e)},s=function(e){return!!o(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},a=function(){return o(arguments)}();o.isLegacyArguments=s,e.exports=a?o:s},70342:function(e){"use strict";var t,r,n=Function.prototype.toString,i="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof i&&"function"==typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw r}}),r={},i(function(){throw 42},null,t)}catch(e){e!==r&&(i=null)}else i=null;var o=/^\s*class\b/,s=function(e){try{var t=n.call(e);return o.test(t)}catch(e){return!1}},a=function(e){try{if(s(e))return!1;return n.call(e),!0}catch(e){return!1}},c=Object.prototype.toString,u="[object Object]",l="[object Function]",h="[object GeneratorFunction]",f="[object HTMLAllCollection]",p="[object HTML document.all class]",d="[object HTMLCollection]",y="function"==typeof Symbol&&!!Symbol.toStringTag,g=!(0 in[,]),_=function(){return!1};if("object"==typeof document){var v=document.all;c.call(v)===c.call(document.all)&&(_=function(e){if((g||!e)&&(void 0===e||"object"==typeof e))try{var t=c.call(e);return(t===f||t===p||t===d||t===u)&&null==e("")}catch(e){}return!1})}e.exports=i?function(e){if(_(e))return!0;if(!e||"function"!=typeof e&&"object"!=typeof e)return!1;try{i(e,null,t)}catch(e){if(e!==r)return!1}return!s(e)&&a(e)}:function(e){if(_(e))return!0;if(!e||"function"!=typeof e&&"object"!=typeof e)return!1;if(y)return a(e);if(s(e))return!1;var t=c.call(e);return!!(t===l||t===h||/^\[object HTML/.test(t))&&a(e)}},36528:function(e,t,r){"use strict";var n,i=Object.prototype.toString,o=Function.prototype.toString,s=/^\s*(?:function)?\*/,a=r(71118)(),c=Object.getPrototypeOf,u=function(){if(!a)return!1;try{return Function("return function*() {}")()}catch(e){}};e.exports=function(e){if("function"!=typeof e)return!1;if(s.test(o.call(e)))return!0;if(!a)return"[object GeneratorFunction]"===i.call(e);if(!c)return!1;if(void 0===n){var t=u();n=!!t&&c(t)}return c(e)===n}},31661:function(e,t,r){"use strict";var n=r(92590);e.exports=function(e){return!!n(e)}},74811:function(e,t,r){var n=null;"undefined"!=typeof WebSocket?n=WebSocket:"undefined"!=typeof MozWebSocket?n=MozWebSocket:void 0!==r.g?n=r.g.WebSocket||r.g.MozWebSocket:"undefined"!=typeof window?n=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(n=self.WebSocket||self.MozWebSocket),e.exports=n},73551:function(e,t,r){var n,i,o;!function(s){function a(e,t){"use strict";var r,n="uint8array",i=t.ready.then(function(){function n(){if(0!==r._sodium_init())throw Error("libsodium was not correctly initialized.");for(var t,n=["crypto_aead_aegis128l_decrypt","crypto_aead_aegis128l_decrypt_detached","crypto_aead_aegis128l_encrypt","crypto_aead_aegis128l_encrypt_detached","crypto_aead_aegis128l_keygen","crypto_aead_aegis256_decrypt","crypto_aead_aegis256_decrypt_detached","crypto_aead_aegis256_encrypt","crypto_aead_aegis256_encrypt_detached","crypto_aead_aegis256_keygen","crypto_aead_chacha20poly1305_decrypt","crypto_aead_chacha20poly1305_decrypt_detached","crypto_aead_chacha20poly1305_encrypt","crypto_aead_chacha20poly1305_encrypt_detached","crypto_aead_chacha20poly1305_ietf_decrypt","crypto_aead_chacha20poly1305_ietf_decrypt_detached","crypto_aead_chacha20poly1305_ietf_encrypt","crypto_aead_chacha20poly1305_ietf_encrypt_detached","crypto_aead_chacha20poly1305_ietf_keygen","crypto_aead_chacha20poly1305_keygen","crypto_aead_xchacha20poly1305_ietf_decrypt","crypto_aead_xchacha20poly1305_ietf_decrypt_detached","crypto_aead_xchacha20poly1305_ietf_encrypt","crypto_aead_xchacha20poly1305_ietf_encrypt_detached","crypto_aead_xchacha20poly1305_ietf_keygen","crypto_auth","crypto_auth_hmacsha256","crypto_auth_hmacsha256_final","crypto_auth_hmacsha256_init","crypto_auth_hmacsha256_keygen","crypto_auth_hmacsha256_update","crypto_auth_hmacsha256_verify","crypto_auth_hmacsha512","crypto_auth_hmacsha512_final","crypto_auth_hmacsha512_init","crypto_auth_hmacsha512_keygen","crypto_auth_hmacsha512_update","crypto_auth_hmacsha512_verify","crypto_auth_keygen","crypto_auth_verify","crypto_box_beforenm","crypto_box_curve25519xchacha20poly1305_beforenm","crypto_box_curve25519xchacha20poly1305_detached","crypto_box_curve25519xchacha20poly1305_detached_afternm","crypto_box_curve25519xchacha20poly1305_easy","crypto_box_curve25519xchacha20poly1305_easy_afternm","crypto_box_curve25519xchacha20poly1305_keypair","crypto_box_curve25519xchacha20poly1305_open_detached","crypto_box_curve25519xchacha20poly1305_open_detached_afternm","crypto_box_curve25519xchacha20poly1305_open_easy","crypto_box_curve25519xchacha20poly1305_open_easy_afternm","crypto_box_curve25519xchacha20poly1305_seal","crypto_box_curve25519xchacha20poly1305_seal_open","crypto_box_curve25519xchacha20poly1305_seed_keypair","crypto_box_detached","crypto_box_easy","crypto_box_easy_afternm","crypto_box_keypair","crypto_box_open_detached","crypto_box_open_easy","crypto_box_open_easy_afternm","crypto_box_seal","crypto_box_seal_open","crypto_box_seed_keypair","crypto_core_ed25519_add","crypto_core_ed25519_from_hash","crypto_core_ed25519_from_uniform","crypto_core_ed25519_is_valid_point","crypto_core_ed25519_random","crypto_core_ed25519_scalar_add","crypto_core_ed25519_scalar_complement","crypto_core_ed25519_scalar_invert","crypto_core_ed25519_scalar_mul","crypto_core_ed25519_scalar_negate","crypto_core_ed25519_scalar_random","crypto_core_ed25519_scalar_reduce","crypto_core_ed25519_scalar_sub","crypto_core_ed25519_sub","crypto_core_hchacha20","crypto_core_hsalsa20","crypto_core_ristretto255_add","crypto_core_ristretto255_from_hash","crypto_core_ristretto255_is_valid_point","crypto_core_ristretto255_random","crypto_core_ristretto255_scalar_add","crypto_core_ristretto255_scalar_complement","crypto_core_ristretto255_scalar_invert","crypto_core_ristretto255_scalar_mul","crypto_core_ristretto255_scalar_negate","crypto_core_ristretto255_scalar_random","crypto_core_ristretto255_scalar_reduce","crypto_core_ristretto255_scalar_sub","crypto_core_ristretto255_sub","crypto_generichash","crypto_generichash_blake2b_salt_personal","crypto_generichash_final","crypto_generichash_init","crypto_generichash_keygen","crypto_generichash_update","crypto_hash","crypto_hash_sha256","crypto_hash_sha256_final","crypto_hash_sha256_init","crypto_hash_sha256_update","crypto_hash_sha512","crypto_hash_sha512_final","crypto_hash_sha512_init","crypto_hash_sha512_update","crypto_kdf_derive_from_key","crypto_kdf_keygen","crypto_kx_client_session_keys","crypto_kx_keypair","crypto_kx_seed_keypair","crypto_kx_server_session_keys","crypto_onetimeauth","crypto_onetimeauth_final","crypto_onetimeauth_init","crypto_onetimeauth_keygen","crypto_onetimeauth_update","crypto_onetimeauth_verify","crypto_pwhash","crypto_pwhash_scryptsalsa208sha256","crypto_pwhash_scryptsalsa208sha256_ll","crypto_pwhash_scryptsalsa208sha256_str","crypto_pwhash_scryptsalsa208sha256_str_verify","crypto_pwhash_str","crypto_pwhash_str_needs_rehash","crypto_pwhash_str_verify","crypto_scalarmult","crypto_scalarmult_base","crypto_scalarmult_ed25519","crypto_scalarmult_ed25519_base","crypto_scalarmult_ed25519_base_noclamp","crypto_scalarmult_ed25519_noclamp","crypto_scalarmult_ristretto255","crypto_scalarmult_ristretto255_base","crypto_secretbox_detached","crypto_secretbox_easy","crypto_secretbox_keygen","crypto_secretbox_open_detached","crypto_secretbox_open_easy","crypto_secretstream_xchacha20poly1305_init_pull","crypto_secretstream_xchacha20poly1305_init_push","crypto_secretstream_xchacha20poly1305_keygen","crypto_secretstream_xchacha20poly1305_pull","crypto_secretstream_xchacha20poly1305_push","crypto_secretstream_xchacha20poly1305_rekey","crypto_shorthash","crypto_shorthash_keygen","crypto_shorthash_siphashx24","crypto_sign","crypto_sign_detached","crypto_sign_ed25519_pk_to_curve25519","crypto_sign_ed25519_sk_to_curve25519","crypto_sign_ed25519_sk_to_pk","crypto_sign_ed25519_sk_to_seed","crypto_sign_final_create","crypto_sign_final_verify","crypto_sign_init","crypto_sign_keypair","crypto_sign_open","crypto_sign_seed_keypair","crypto_sign_update","crypto_sign_verify_detached","crypto_stream_chacha20","crypto_stream_chacha20_ietf_xor","crypto_stream_chacha20_ietf_xor_ic","crypto_stream_chacha20_keygen","crypto_stream_chacha20_xor","crypto_stream_chacha20_xor_ic","crypto_stream_keygen","crypto_stream_xchacha20_keygen","crypto_stream_xchacha20_xor","crypto_stream_xchacha20_xor_ic","randombytes_buf","randombytes_buf_deterministic","randombytes_close","randombytes_random","randombytes_set_implementation","randombytes_stir","randombytes_uniform","sodium_version_string"],i=[S,E,x,k,T,B,A,M,O,P,R,C,N,I,D,j,U,F,L,W,z,K,H,q,Y,G,$,V,J,Z,X,Q,ee,et,er,en,ei,eo,es,ea,ec,eu,el,eh,ef,ep,ed,ey,eg,e_,ev,eb,em,ew,eS,eE,ex,ek,eT,eB,eA,eM,eO,eP,eR,eC,eN,eI,eD,ej,eU,eF,eL,eW,ez,eK,eH,eq,eY,eG,e$,eV,eJ,eZ,eX,eQ,e0,e1,e2,e5,e3,e6,e4,e8,e7,e9,te,tt,tr,tn,ti,to,ts,ta,tc,tu,tl,th,tf,tp,td,ty,tg,t_,tv,tb,tm,tw,tS,tE,tx,tk,tT,tB,tA,tM,tO,tP,tR,tC,tN,tI,tD,tj,tU,tF,tL,tW,tz,tK,tH,tq,tY,tG,t$,tV,tJ,tZ,tX,tQ,t0,t1,t2,t5,t3,t6,t4,t8,t7,t9,re,rt,rr,rn,ri,ro,rs,ra,rc,ru,rl,rh,rf,rp,rd,ry,rg,r_,rv,rb,rm,rw],o=0;o=240?(l=4,c=!0):h>=224?(l=3,c=!0):h>=192?(l=2,c=!0):h<128&&(l=1,c=!0)}while(!c);for(var f=l-(a.length-u),p=0;p>8&-39)<<8|87+(t=e[o]>>>4)+(t-10>>8&-39)))+String.fromCharCode(n>>>8);return i}var c={ORIGINAL:1,ORIGINAL_NO_PADDING:3,URLSAFE:5,URLSAFE_NO_PADDING:7};function u(e){if(null==e)return c.URLSAFE_NO_PADDING;if(e!==c.ORIGINAL&&e!==c.ORIGINAL_NO_PADDING&&e!==c.URLSAFE&&e!=c.URLSAFE_NO_PADDING)throw Error("unsupported base64 variant");return e}function l(e,t){t=u(t);var n,i=[],o=0|Math.floor((e=w(i,e,"input")).length/3),a=e.length-3*o,c=4*o+(0!==a?0==(2&t)?4:2+(a>>>1):0),l=new d(c+1),h=y(e);return i.push(h),i.push(l.address),0===r._sodium_bin2base64(l.address,l.length,h,e.length,t)&&v(i,"conversion failed"),l.length=c,n=s(l.to_Uint8Array()),_(i),n}function h(e,t){var r=t||n;if(!f(r))throw Error(r+" output format is not available");if(e instanceof d){if("uint8array"===r)return e.to_Uint8Array();if("text"===r)return s(e.to_Uint8Array());if("hex"===r)return a(e.to_Uint8Array());if("base64"===r)return l(e.to_Uint8Array(),c.URLSAFE_NO_PADDING);throw Error('What is output format "'+r+'"?')}if("object"==typeof e){for(var i=Object.keys(e),o={},u=0;u>>24>>>8,c,l);var S=h(g,s);return _(a),S}function tp(e){var t=[];p(e);var n=new d(0|r._crypto_kdf_keybytes()),i=n.address;t.push(i),r._crypto_kdf_keygen(i);var o=h(n,e);return _(t),o}function td(e,t,n,i){var o=[];p(i),e=w(o,e,"clientPublicKey");var s,a=0|r._crypto_kx_publickeybytes();e.length!==a&&b(o,"invalid clientPublicKey length"),s=y(e),o.push(s),t=w(o,t,"clientSecretKey");var c,u=0|r._crypto_kx_secretkeybytes();t.length!==u&&b(o,"invalid clientSecretKey length"),c=y(t),o.push(c),n=w(o,n,"serverPublicKey");var l,f=0|r._crypto_kx_publickeybytes();n.length!==f&&b(o,"invalid serverPublicKey length"),l=y(n),o.push(l);var g=new d(0|r._crypto_kx_sessionkeybytes()),m=g.address;o.push(m);var S=new d(0|r._crypto_kx_sessionkeybytes()),E=S.address;if(o.push(E),0==(0|r._crypto_kx_client_session_keys(m,E,s,c,l))){var x=h({sharedRx:g,sharedTx:S},i);return _(o),x}v(o,"invalid usage")}function ty(e){var t=[];p(e);var n=new d(0|r._crypto_kx_publickeybytes()),i=n.address;t.push(i);var o=new d(0|r._crypto_kx_secretkeybytes()),s=o.address;if(t.push(s),0==(0|r._crypto_kx_keypair(i,s))){var a={publicKey:h(n,e),privateKey:h(o,e),keyType:"x25519"};return _(t),a}v(t,"internal error")}function tg(e,t){var n=[];p(t),e=w(n,e,"seed");var i,o=0|r._crypto_kx_seedbytes();e.length!==o&&b(n,"invalid seed length"),i=y(e),n.push(i);var s=new d(0|r._crypto_kx_publickeybytes()),a=s.address;n.push(a);var c=new d(0|r._crypto_kx_secretkeybytes()),u=c.address;if(n.push(u),0==(0|r._crypto_kx_seed_keypair(a,u,i))){var l={publicKey:h(s,t),privateKey:h(c,t),keyType:"x25519"};return _(n),l}v(n,"internal error")}function t_(e,t,n,i){var o=[];p(i),e=w(o,e,"serverPublicKey");var s,a=0|r._crypto_kx_publickeybytes();e.length!==a&&b(o,"invalid serverPublicKey length"),s=y(e),o.push(s),t=w(o,t,"serverSecretKey");var c,u=0|r._crypto_kx_secretkeybytes();t.length!==u&&b(o,"invalid serverSecretKey length"),c=y(t),o.push(c),n=w(o,n,"clientPublicKey");var l,f=0|r._crypto_kx_publickeybytes();n.length!==f&&b(o,"invalid clientPublicKey length"),l=y(n),o.push(l);var g=new d(0|r._crypto_kx_sessionkeybytes()),m=g.address;o.push(m);var S=new d(0|r._crypto_kx_sessionkeybytes()),E=S.address;if(o.push(E),0==(0|r._crypto_kx_server_session_keys(m,E,s,c,l))){var x=h({sharedRx:g,sharedTx:S},i);return _(o),x}v(o,"invalid usage")}function tv(e,t,n){var i=[];p(n);var o=y(e=w(i,e,"message")),s=e.length;i.push(o),t=w(i,t,"key");var a,c=0|r._crypto_onetimeauth_keybytes();t.length!==c&&b(i,"invalid key length"),a=y(t),i.push(a);var u=new d(0|r._crypto_onetimeauth_bytes()),l=u.address;if(i.push(l),0==(0|r._crypto_onetimeauth(l,o,s,0,a))){var f=h(u,n);return _(i),f}v(i,"invalid usage")}function tb(e,t){var n=[];p(t),m(n,e,"state_address");var i=new d(0|r._crypto_onetimeauth_bytes()),o=i.address;if(n.push(o),0==(0|r._crypto_onetimeauth_final(e,o))){var s=(r._free(e),h(i,t));return _(n),s}v(n,"invalid usage")}function tm(e,t){var n=[];p(t);var i=null;null!=e&&(i=y(e=w(n,e,"key")),e.length,n.push(i));var o=new d(144).address;if(0==(0|r._crypto_onetimeauth_init(o,i))){var s=o;return _(n),s}v(n,"invalid usage")}function tw(e){var t=[];p(e);var n=new d(0|r._crypto_onetimeauth_keybytes()),i=n.address;t.push(i),r._crypto_onetimeauth_keygen(i);var o=h(n,e);return _(t),o}function tS(e,t,n){var i=[];p(n),m(i,e,"state_address");var o=y(t=w(i,t,"message_chunk")),s=t.length;i.push(o),0!=(0|r._crypto_onetimeauth_update(e,o,s))&&v(i,"invalid usage"),_(i)}function tE(e,t,n){var i=[];e=w(i,e,"hash");var o,s=0|r._crypto_onetimeauth_bytes();e.length!==s&&b(i,"invalid hash length"),o=y(e),i.push(o);var a=y(t=w(i,t,"message")),c=t.length;i.push(a),n=w(i,n,"key");var u,l=0|r._crypto_onetimeauth_keybytes();n.length!==l&&b(i,"invalid key length"),u=y(n),i.push(u);var h=0==(0|r._crypto_onetimeauth_verify(o,a,c,0,u));return _(i),h}function tx(e,t,n,i,o,s,a){var c=[];p(a),m(c,e,"keyLength"),("number"!=typeof e||(0|e)!==e||e<0)&&b(c,"keyLength must be an unsigned integer");var u=y(t=w(c,t,"password")),l=t.length;c.push(u),n=w(c,n,"salt");var f,g=0|r._crypto_pwhash_saltbytes();n.length!==g&&b(c,"invalid salt length"),f=y(n),c.push(f),m(c,i,"opsLimit"),("number"!=typeof i||(0|i)!==i||i<0)&&b(c,"opsLimit must be an unsigned integer"),m(c,o,"memLimit"),("number"!=typeof o||(0|o)!==o||o<0)&&b(c,"memLimit must be an unsigned integer"),m(c,s,"algorithm"),("number"!=typeof s||(0|s)!==s||s<0)&&b(c,"algorithm must be an unsigned integer");var S=new d(0|e),E=S.address;if(c.push(E),0==(0|r._crypto_pwhash(E,e,0,u,l,0,f,i,0,o,s))){var x=h(S,a);return _(c),x}v(c,"invalid usage")}function tk(e,t,n,i,o,s){var a=[];p(s),m(a,e,"keyLength"),("number"!=typeof e||(0|e)!==e||e<0)&&b(a,"keyLength must be an unsigned integer");var c=y(t=w(a,t,"password")),u=t.length;a.push(c),n=w(a,n,"salt");var l,f=0|r._crypto_pwhash_scryptsalsa208sha256_saltbytes();n.length!==f&&b(a,"invalid salt length"),l=y(n),a.push(l),m(a,i,"opsLimit"),("number"!=typeof i||(0|i)!==i||i<0)&&b(a,"opsLimit must be an unsigned integer"),m(a,o,"memLimit"),("number"!=typeof o||(0|o)!==o||o<0)&&b(a,"memLimit must be an unsigned integer");var g=new d(0|e),S=g.address;if(a.push(S),0==(0|r._crypto_pwhash_scryptsalsa208sha256(S,e,0,c,u,0,l,i,0,o))){var E=h(g,s);return _(a),E}v(a,"invalid usage")}function tT(e,t,n,i,o,s,a){var c=[];p(a);var u=y(e=w(c,e,"password")),l=e.length;c.push(u);var f=y(t=w(c,t,"salt")),g=t.length;c.push(f),m(c,n,"opsLimit"),("number"!=typeof n||(0|n)!==n||n<0)&&b(c,"opsLimit must be an unsigned integer"),m(c,i,"r"),("number"!=typeof i||(0|i)!==i||i<0)&&b(c,"r must be an unsigned integer"),m(c,o,"p"),("number"!=typeof o||(0|o)!==o||o<0)&&b(c,"p must be an unsigned integer"),m(c,s,"keyLength"),("number"!=typeof s||(0|s)!==s||s<0)&&b(c,"keyLength must be an unsigned integer");var S=new d(0|s),E=S.address;if(c.push(E),0==(0|r._crypto_pwhash_scryptsalsa208sha256_ll(u,l,f,g,n,0,i,o,E,s))){var x=h(S,a);return _(c),x}v(c,"invalid usage")}function tB(e,t,n,i){var o=[];p(i);var s=y(e=w(o,e,"password")),a=e.length;o.push(s),m(o,t,"opsLimit"),("number"!=typeof t||(0|t)!==t||t<0)&&b(o,"opsLimit must be an unsigned integer"),m(o,n,"memLimit"),("number"!=typeof n||(0|n)!==n||n<0)&&b(o,"memLimit must be an unsigned integer");var c=new d(0|r._crypto_pwhash_scryptsalsa208sha256_strbytes()).address;if(o.push(c),0==(0|r._crypto_pwhash_scryptsalsa208sha256_str(c,s,a,0,t,0,n))){var u=r.UTF8ToString(c);return _(o),u}v(o,"invalid usage")}function tA(e,t,n){var i=[];p(n),"string"!=typeof e&&b(i,"hashed_password must be a string"),e=o(e+"\0"),null!=a&&e.length-1!==a&&b(i,"invalid hashed_password length");var s=y(e),a=e.length-1;i.push(s);var c=y(t=w(i,t,"password")),u=t.length;i.push(c);var l=0==(0|r._crypto_pwhash_scryptsalsa208sha256_str_verify(s,c,u,0));return _(i),l}function tM(e,t,n,i){var o=[];p(i);var s=y(e=w(o,e,"password")),a=e.length;o.push(s),m(o,t,"opsLimit"),("number"!=typeof t||(0|t)!==t||t<0)&&b(o,"opsLimit must be an unsigned integer"),m(o,n,"memLimit"),("number"!=typeof n||(0|n)!==n||n<0)&&b(o,"memLimit must be an unsigned integer");var c=new d(0|r._crypto_pwhash_strbytes()).address;if(o.push(c),0==(0|r._crypto_pwhash_str(c,s,a,0,t,0,n))){var u=r.UTF8ToString(c);return _(o),u}v(o,"invalid usage")}function tO(e,t,n,i){var s=[];p(i),"string"!=typeof e&&b(s,"hashed_password must be a string"),e=o(e+"\0"),null!=c&&e.length-1!==c&&b(s,"invalid hashed_password length");var a=y(e),c=e.length-1;s.push(a),m(s,t,"opsLimit"),("number"!=typeof t||(0|t)!==t||t<0)&&b(s,"opsLimit must be an unsigned integer"),m(s,n,"memLimit"),("number"!=typeof n||(0|n)!==n||n<0)&&b(s,"memLimit must be an unsigned integer");var u=0!=(0|r._crypto_pwhash_str_needs_rehash(a,t,0,n));return _(s),u}function tP(e,t,n){var i=[];p(n),"string"!=typeof e&&b(i,"hashed_password must be a string"),e=o(e+"\0"),null!=a&&e.length-1!==a&&b(i,"invalid hashed_password length");var s=y(e),a=e.length-1;i.push(s);var c=y(t=w(i,t,"password")),u=t.length;i.push(c);var l=0==(0|r._crypto_pwhash_str_verify(s,c,u,0));return _(i),l}function tR(e,t,n){var i=[];p(n),e=w(i,e,"privateKey");var o,s=0|r._crypto_scalarmult_scalarbytes();e.length!==s&&b(i,"invalid privateKey length"),o=y(e),i.push(o),t=w(i,t,"publicKey");var a,c=0|r._crypto_scalarmult_bytes();t.length!==c&&b(i,"invalid publicKey length"),a=y(t),i.push(a);var u=new d(0|r._crypto_scalarmult_bytes()),l=u.address;if(i.push(l),0==(0|r._crypto_scalarmult(l,o,a))){var f=h(u,n);return _(i),f}v(i,"weak public key")}function tC(e,t){var n=[];p(t),e=w(n,e,"privateKey");var i,o=0|r._crypto_scalarmult_scalarbytes();e.length!==o&&b(n,"invalid privateKey length"),i=y(e),n.push(i);var s=new d(0|r._crypto_scalarmult_bytes()),a=s.address;if(n.push(a),0==(0|r._crypto_scalarmult_base(a,i))){var c=h(s,t);return _(n),c}v(n,"unknown error")}function tN(e,t,n){var i=[];p(n),e=w(i,e,"n");var o,s=0|r._crypto_scalarmult_ed25519_scalarbytes();e.length!==s&&b(i,"invalid n length"),o=y(e),i.push(o),t=w(i,t,"p");var a,c=0|r._crypto_scalarmult_ed25519_bytes();t.length!==c&&b(i,"invalid p length"),a=y(t),i.push(a);var u=new d(0|r._crypto_scalarmult_ed25519_bytes()),l=u.address;if(i.push(l),0==(0|r._crypto_scalarmult_ed25519(l,o,a))){var f=h(u,n);return _(i),f}v(i,"invalid point or scalar is 0")}function tI(e,t){var n=[];p(t),e=w(n,e,"scalar");var i,o=0|r._crypto_scalarmult_ed25519_scalarbytes();e.length!==o&&b(n,"invalid scalar length"),i=y(e),n.push(i);var s=new d(0|r._crypto_scalarmult_ed25519_bytes()),a=s.address;if(n.push(a),0==(0|r._crypto_scalarmult_ed25519_base(a,i))){var c=h(s,t);return _(n),c}v(n,"scalar is 0")}function tD(e,t){var n=[];p(t),e=w(n,e,"scalar");var i,o=0|r._crypto_scalarmult_ed25519_scalarbytes();e.length!==o&&b(n,"invalid scalar length"),i=y(e),n.push(i);var s=new d(0|r._crypto_scalarmult_ed25519_bytes()),a=s.address;if(n.push(a),0==(0|r._crypto_scalarmult_ed25519_base_noclamp(a,i))){var c=h(s,t);return _(n),c}v(n,"scalar is 0")}function tj(e,t,n){var i=[];p(n),e=w(i,e,"n");var o,s=0|r._crypto_scalarmult_ed25519_scalarbytes();e.length!==s&&b(i,"invalid n length"),o=y(e),i.push(o),t=w(i,t,"p");var a,c=0|r._crypto_scalarmult_ed25519_bytes();t.length!==c&&b(i,"invalid p length"),a=y(t),i.push(a);var u=new d(0|r._crypto_scalarmult_ed25519_bytes()),l=u.address;if(i.push(l),0==(0|r._crypto_scalarmult_ed25519_noclamp(l,o,a))){var f=h(u,n);return _(i),f}v(i,"invalid point or scalar is 0")}function tU(e,t,n){var i=[];p(n),e=w(i,e,"scalar");var o,s=0|r._crypto_scalarmult_ristretto255_scalarbytes();e.length!==s&&b(i,"invalid scalar length"),o=y(e),i.push(o),t=w(i,t,"element");var a,c=0|r._crypto_scalarmult_ristretto255_bytes();t.length!==c&&b(i,"invalid element length"),a=y(t),i.push(a);var u=new d(0|r._crypto_scalarmult_ristretto255_bytes()),l=u.address;if(i.push(l),0==(0|r._crypto_scalarmult_ristretto255(l,o,a))){var f=h(u,n);return _(i),f}v(i,"result is identity element")}function tF(e,t){var n=[];p(t),e=w(n,e,"scalar");var i,o=0|r._crypto_core_ristretto255_scalarbytes();e.length!==o&&b(n,"invalid scalar length"),i=y(e),n.push(i);var s=new d(0|r._crypto_core_ristretto255_bytes()),a=s.address;if(n.push(a),0==(0|r._crypto_scalarmult_ristretto255_base(a,i))){var c=h(s,t);return _(n),c}v(n,"scalar is 0")}function tL(e,t,n,i){var o=[];p(i);var s=y(e=w(o,e,"message")),a=e.length;o.push(s),t=w(o,t,"nonce");var c,u=0|r._crypto_secretbox_noncebytes();t.length!==u&&b(o,"invalid nonce length"),c=y(t),o.push(c),n=w(o,n,"key");var l,f=0|r._crypto_secretbox_keybytes();n.length!==f&&b(o,"invalid key length"),l=y(n),o.push(l);var g=new d(0|a),m=g.address;o.push(m);var S=new d(0|r._crypto_secretbox_macbytes()),E=S.address;if(o.push(E),0==(0|r._crypto_secretbox_detached(m,E,s,a,0,c,l))){var x=h({mac:S,cipher:g},i);return _(o),x}v(o,"invalid usage")}function tW(e,t,n,i){var o=[];p(i);var s=y(e=w(o,e,"message")),a=e.length;o.push(s),t=w(o,t,"nonce");var c,u=0|r._crypto_secretbox_noncebytes();t.length!==u&&b(o,"invalid nonce length"),c=y(t),o.push(c),n=w(o,n,"key");var l,f=0|r._crypto_secretbox_keybytes();n.length!==f&&b(o,"invalid key length"),l=y(n),o.push(l);var g=new d(a+r._crypto_secretbox_macbytes()|0),m=g.address;if(o.push(m),0==(0|r._crypto_secretbox_easy(m,s,a,0,c,l))){var S=h(g,i);return _(o),S}v(o,"invalid usage")}function tz(e){var t=[];p(e);var n=new d(0|r._crypto_secretbox_keybytes()),i=n.address;t.push(i),r._crypto_secretbox_keygen(i);var o=h(n,e);return _(t),o}function tK(e,t,n,i,o){var s=[];p(o);var a=y(e=w(s,e,"ciphertext")),c=e.length;s.push(a),t=w(s,t,"mac");var u,l=0|r._crypto_secretbox_macbytes();t.length!==l&&b(s,"invalid mac length"),u=y(t),s.push(u),n=w(s,n,"nonce");var f,g=0|r._crypto_secretbox_noncebytes();n.length!==g&&b(s,"invalid nonce length"),f=y(n),s.push(f),i=w(s,i,"key");var m,S=0|r._crypto_secretbox_keybytes();i.length!==S&&b(s,"invalid key length"),m=y(i),s.push(m);var E=new d(0|c),x=E.address;if(s.push(x),0==(0|r._crypto_secretbox_open_detached(x,a,u,c,0,f,m))){var k=h(E,o);return _(s),k}v(s,"wrong secret key for the given ciphertext")}function tH(e,t,n,i){var o=[];p(i),e=w(o,e,"ciphertext");var s,a=r._crypto_secretbox_macbytes(),c=e.length;c>>0;return _([]),t}function rv(e,t){var n=[];p(t);for(var i=r._malloc(24),o=0;o<6;o++)r.setValue(i+4*o,r.Runtime.addFunction(e[["implementation_name","random","stir","uniform","buf","close"][o]]),"i32");0!=(0|r._randombytes_set_implementation(i))&&v(n,"unsupported implementation"),_(n)}function rb(e){p(e),r._randombytes_stir()}function rm(e,t){var n=[];p(t),m(n,e,"upper_bound"),("number"!=typeof e||(0|e)!==e||e<0)&&b(n,"upper_bound must be an unsigned integer");var i=r._randombytes_uniform(e)>>>0;return _(n),i}function rw(){var e=r._sodium_version_string(),t=r.UTF8ToString(e);return _([]),t}return d.prototype.to_Uint8Array=function(){var e=new Uint8Array(this.length);return e.set(r.HEAPU8.subarray(this.address,this.address+this.length)),e},e.add=function(e,t){if(!(e instanceof Uint8Array&&t instanceof Uint8Array))throw TypeError("Only Uint8Array instances can added");var r=e.length,n=0,i=0;if(t.length!=e.length)throw TypeError("Arguments must have the same length");for(i=0;i>=8,n+=e[i]+t[i],e[i]=255&n},e.base64_variants=c,e.compare=function(e,t){if(!(e instanceof Uint8Array&&t instanceof Uint8Array))throw TypeError("Only Uint8Array instances can be compared");if(e.length!==t.length)throw TypeError("Only instances of identical length can be compared");for(var r=0,n=1,i=e.length;i-- >0;)r|=t[i]-e[i]>>8&n,n&=(t[i]^e[i])-1>>8;return r+r+n-1},e.from_base64=function(e,t){t=u(t);var n,i=[],o=new d(3*(e=w(i,e,"input")).length/4),s=y(e),a=g(4),c=g(4);return i.push(s),i.push(o.address),i.push(o.result_bin_len_p),i.push(o.b64_end_p),0!==r._sodium_base642bin(o.address,o.length,s,e.length,0,a,c,t)&&v(i,"invalid input"),r.getValue(c,"i32")-s!==e.length&&v(i,"incomplete input"),o.length=r.getValue(a,"i32"),n=o.to_Uint8Array(),_(i),n},e.from_hex=function(e){var t,n=[],i=new d((e=w(n,e,"input")).length/2),o=y(e),s=g(4);return n.push(o),n.push(i.address),n.push(i.hex_end_p),0!==r._sodium_hex2bin(i.address,i.length,o,e.length,0,0,s)&&v(n,"invalid input"),r.getValue(s,"i32")-o!==e.length&&v(n,"incomplete input"),t=i.to_Uint8Array(),_(n),t},e.from_string=o,e.increment=function(e){if(!(e instanceof Uint8Array))throw TypeError("Only Uint8Array instances can be incremented");for(var t=256,r=0,n=e.length;r>=8,t+=e[r],e[r]=255&t},e.is_zero=function(e){if(!(e instanceof Uint8Array))throw TypeError("Only Uint8Array instances can be checked");for(var t=0,r=0,n=e.length;r 0");var n,i=[],o=g(4),s=1,a=0,c=0|e.length,u=new d(c+t);i.push(o),i.push(u.address);for(var l=u.address,h=u.address+c+t;l>>48|c>>>32|c>>>16|c))-1>>16);return 0!==r._sodium_pad(o,u.address,e.length,t,u.length)&&v(i,"internal error"),u.length=r.getValue(o,"i32"),n=u.to_Uint8Array(),_(i),n},e.unpad=function(e,t){if(!(e instanceof Uint8Array))throw TypeError("buffer must be a Uint8Array");if((t|=0)<=0)throw Error("block size must be > 0");var n=[],i=y(e),o=g(4);return n.push(i),n.push(o),0!==r._sodium_unpad(o,i,e.length,t)&&v(n,"unsupported/invalid padding"),e=(e=new Uint8Array(e)).subarray(0,r.getValue(o,"i32")),_(n),e},e.ready=i,e.symbols=function(){return Object.keys(e).sort()},e.to_base64=l,e.to_hex=a,e.to_string=s,e}var c="object"==typeof s.sodium&&"function"==typeof s.sodium.onload?s.sodium.onload:null;i=[t,r(92930)],void 0!==(o="function"==typeof(n=a)?n.apply(t,i):n)&&(e.exports=o),c&&s.sodium.ready.then(function(){c(s.sodium)})}(this)},86253:function(e){"use strict";function t(){var e=Object.create(null),t=0,r=0,n=0,i=!1;function o(t){n--,delete e[t]}this.put=function(t,r,s,a){if(i&&console.log("caching: %s = %j (@%s)",t,r,s),void 0!==s&&("number"!=typeof s||isNaN(s)||s<=0))throw Error("Cache timeout must be a positive number");if(void 0!==a&&"function"!=typeof a)throw Error("Cache timeout callback must be a function");var c=e[t];c?clearTimeout(c.timeout):n++;var u={value:r,expire:s+Date.now()};return isNaN(u.expire)||(u.timeout=setTimeout((function(){o(t),a&&a(t,r)}).bind(this),s)),e[t]=u,r},this.del=function(t){var r=!0,n=e[t];return n?(clearTimeout(n.timeout),!isNaN(n.expire)&&n.expire=Date.now())return i&&t++,s.value;i&&r++,n--,delete e[o]}else i&&r++;return null},this.size=function(){return n},this.memsize=function(){var t,r=0;for(t in e)r++;return r},this.debug=function(e){i=e},this.hits=function(){return t},this.misses=function(){return r},this.keys=function(){return Object.keys(e)},this.exportJson=function(){var t={};for(var r in e){var n=e[r];t[r]={value:n.value,expire:n.expire||"NaN"}}return JSON.stringify(t)},this.importJson=function(t,r){var n=JSON.parse(t),o=Date.now(),s=r&&r.skipDuplicates;for(var a in n)if(n.hasOwnProperty(a)){if(s&&e[a]){i&&console.log("Skipping duplicate imported key '%s'",a);continue}var c=n[a],u=c.expire-o;if(u<=0){this.del(a);continue}u=u>0?u:void 0,this.put(a,c.value,u)}return this.size()}}e.exports=new t,e.exports.Cache=t},44331:function(e,t,r){var n="/",i=r(25566);!function(){var t={189:function(){!function(e,t){"use strict";if(!e.setImmediate){var r,n=1,o={},s=!1,a=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,"[object process]"===({}).toString.call(e.process)?p():d()?y():e.MessageChannel?g():a&&"onreadystatechange"in a.createElement("script")?_():v(),c.setImmediate=u,c.clearImmediate=l}function u(e){"function"!=typeof e&&(e=Function(""+e));for(var t=Array(arguments.length-1),i=0;iString(e)),r>2)?`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]:2===r?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}}function i(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function o(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function s(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}r("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(e,t,r){let a,c;if("string"==typeof t&&i(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",o(e," argument"))c=`The ${e} ${a} ${n(t,"type")}`;else{let r=s(e,".")?"property":"argument";c=`The "${e}" ${r} ${a} ${n(t,"type")}`}return c+`. Received type ${typeof r}`},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},403:function(e,t,r){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var o=r(709),s=r(337);r(782)(l,o);for(var a=n(s.prototype),c=0;c0){if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===f.prototype||(t=d(t)),n)a.endEmitted?k(e,new x):P(e,a,t,!0);else if(a.ended)k(e,new S);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?P(e,a,t,!1):F(e,a)):P(e,a,t,!1)}}else n||(a.reading=!1,F(e,a));return!a.ended&&(a.length=C?e=C:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function I(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=N(e)),e<=t.length)?e:t.ended?t.length:(t.needReadable=!0,0)}function D(e,t){if(s("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?j(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,U(e)))}}function j(e){var t=e._readableState;s("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(s("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(U,e))}function U(e){var t=e._readableState;s("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Y(e)}function F(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(L,e,t))}function L(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function K(e){s("readable nexttick read 0"),e.read(0)}function H(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(q,e,t))}function q(e,t){s("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Y(e),t.flowing&&!t.reading&&e.read(0)}function Y(e){var t=e._readableState;for(s("flow",t.flowing);t.flowing&&null!==e.read(););}function G(e,t){var r;return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function $(e){var t=e._readableState;s("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(V,t,e))}function V(e,t){if(s("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function J(e,t){for(var r=0,n=e.length;r=r.highWaterMark:r.length>0)||r.ended))return s("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?$(this):j(this),null;if(0===(e=I(e,r))&&r.ended)return 0===r.length&&$(this),null;var i=r.needReadable;return s("need readable",i),(0===r.length||r.length-e0?G(e,r):null)?(r.needReadable=r.length<=r.highWaterMark,e=0):(r.length-=e,r.awaitDrain=0),0===r.length&&(r.ended||(r.needReadable=!0),n!==e&&r.ended&&$(this)),null!==t&&this.emit("data",t),t},M.prototype._read=function(e){k(this,new E("_read()"))},M.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,s("pipe count=%d opts=%j",n.pipesCount,t);var o=t&&!1===t.end||e===i.stdout||e===i.stderr?_:c;function a(e,t){s("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,f())}function c(){s("onend"),e.end()}n.endEmitted?i.nextTick(o):r.once("end",o),e.on("unpipe",a);var u=W(r);e.on("drain",u);var h=!1;function f(){s("cleanup"),e.removeListener("close",y),e.removeListener("finish",g),e.removeListener("drain",u),e.removeListener("error",d),e.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",_),r.removeListener("data",p),h=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&u()}function p(t){s("ondata");var i=e.write(t);s("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==J(n.pipes,e))&&!h&&(s("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function d(t){s("onerror",t),_(),e.removeListener("error",d),0===l(e,"error")&&k(e,t)}function y(){e.removeListener("finish",g),_()}function g(){s("onfinish"),e.removeListener("close",y),_()}function _(){s("unpipe"),r.unpipe(e)}return r.on("data",p),B(e,"error",d),e.once("close",y),e.once("finish",g),e.emit("pipe",r),n.flowing||(s("pipe resume"),r.resume()),e},M.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==n.flowing&&this.resume()):"readable"!==e||n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,s("on readable",n.length,n.reading),n.length?j(this):n.reading||i.nextTick(K,this)),r},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(e,t){var r=h.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(z,this),r},M.prototype.removeAllListeners=function(e){var t=h.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&i.nextTick(z,this),t},M.prototype.resume=function(){var e=this._readableState;return e.flowing||(s("resume"),e.flowing=!e.readableListening,H(this,e)),e.paused=!1,this},M.prototype.pause=function(){return s("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(s("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},M.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",function(){if(s("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){s("wrapped data"),r.decoder&&(i=r.decoder.write(i)),(!r.objectMode||null!=i)&&(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o-1))throw new x(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,r){r(new v("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||H(this,n,r),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=d.destroy,A.prototype._undestroy=d.undestroy,A.prototype._destroy=function(e,t){t(e)}},871:function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o,s=r(698),a=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),h=Symbol("lastPromise"),f=Symbol("handlePromise"),p=Symbol("stream");function d(e,t){return{value:e,done:t}}function y(e){var t=e[a];if(null!==t){var r=e[p].read();null!==r&&(e[h]=null,e[a]=null,e[c]=null,t(d(r,!1)))}}function g(e){i.nextTick(y,e)}function _(e,t){return function(r,n){e.then(function(){if(t[l]){r(d(void 0,!0));return}t[f](r,n)},n)}}var v=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((n(o={get stream(){return this[p]},next:function(){var e,t=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[l])return Promise.resolve(d(void 0,!0));if(this[p].destroyed)return new Promise(function(e,r){i.nextTick(function(){t[u]?r(t[u]):e(d(void 0,!0))})});var n=this[h];if(n)e=new Promise(_(n,this));else{var o=this[p].read();if(null!==o)return Promise.resolve(d(o,!1));e=new Promise(this[f])}return this[h]=e,e}},Symbol.asyncIterator,function(){return this}),n(o,"return",function(){var e=this;return new Promise(function(t,r){e[p].destroy(null,function(e){if(e){r(e);return}t(d(void 0,!0))})})}),o),v),m=function(e){var t,r=Object.create(b,(n(t={},p,{value:e,writable:!0}),n(t,a,{value:null,writable:!0}),n(t,c,{value:null,writable:!0}),n(t,u,{value:null,writable:!0}),n(t,l,{value:e._readableState.endEmitted,writable:!0}),n(t,f,{value:function(e,t){var n=r[p].read();n?(r[h]=null,r[a]=null,r[c]=null,e(d(n,!1))):(r[a]=e,r[c]=t)},writable:!0}),t));return r[h]=null,s(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[c];null!==t&&(r[h]=null,r[a]=null,r[c]=null,t(e)),r[u]=e;return}var n=r[a];null!==n&&(r[h]=null,r[a]=null,r[c]=null,n(d(void 0,!0))),r[l]=!0}),e.on("readable",g.bind(null,r)),r};e.exports=m},379:function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return u.alloc(0);for(var t=u.allocUnsafe(e>>>0),r=this.head,n=0;r;)f(r.data,t,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=u.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:h,value:function(e,t){return l(this,i({},t,{depth:0,customInspect:!1}))}}]),e}()},25:function(e){"use strict";function t(e,t){var o=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(s,this,e)):i.nextTick(s,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?o._writableState?o._writableState.errorEmitted?i.nextTick(n,o):(o._writableState.errorEmitted=!0,i.nextTick(r,o,e)):i.nextTick(r,o,e):t?(i.nextTick(n,o),t(e)):i.nextTick(n,o)})),this}function r(e,t){s(e,t),n(e)}function n(e){(!e._writableState||e._writableState.emitClose)&&(!e._readableState||e._readableState.emitClose)&&e.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(e,t){e.emit("error",t)}function a(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}e.exports={destroy:t,undestroy:o,errorOrDestroy:a}},698:function(e,t,r){"use strict";var n=r(646).q.ERR_STREAM_PREMATURE_CLOSE;function i(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=Array(r),i=0;i0,function(t){e||(e=t),t&&o.forEach(h),s||(o.forEach(h),i(e))})});return r.reduce(f)}e.exports=d},776:function(e,t,r){"use strict";var n=r(646).q.ERR_INVALID_OPT_VALUE;function i(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}function o(e,t,r,o){var s=i(t,o,r);if(null!=s){if(!(isFinite(s)&&Math.floor(s)===s)||s<0)throw new n(o?r:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}e.exports={getHighWaterMark:o}},678:function(e,t,r){e.exports=r(781)},55:function(e,t,r){var n=r(300),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n.SlowBuffer(e)}},173:function(e,t,r){e.exports=i;var n=r(361).EventEmitter;function i(){n.call(this)}r(782)(i,n),i.Readable=r(709),i.Writable=r(337),i.Duplex=r(403),i.Transform=r(170),i.PassThrough=r(889),i.finished=r(698),i.pipeline=r(442),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",a),r.on("close",c));var s=!1;function a(){s||(s=!0,e.end())}function c(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(l(),0===n.listenerCount(this,"error"))throw e}function l(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",c),r.removeListener("error",u),e.removeListener("error",u),r.removeListener("end",l),r.removeListener("close",l),e.removeListener("close",l)}return r.on("error",u),e.on("error",u),r.on("end",l),r.on("close",l),e.on("close",l),e.emit("pipe",r),e}},704:function(e,t,r){"use strict";var n=r(55).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;if(!e)return"utf8";for(;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function s(e){var t=o(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw Error("Unknown encoding: "+e);return t||e}function a(e){var t;switch(this.encoding=s(e),this.encoding){case"utf16le":this.text=d,this.end=y,t=4;break;case"utf8":this.fillLast=h,t=4;break;case"base64":this.text=g,this.end=_,t=3;break;default:this.write=v,this.end=b;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function c(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function u(e,t,r){var n=t.length-1;if(n=0?(i>0&&(e.lastNeed=i-1),i):--n=0?(i>0&&(e.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}function l(e,t,r){if((192&t[0])!=128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((192&t[1])!=128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(192&t[2])!=128)return e.lastNeed=2,"�"}}function h(e){var t=this.lastTotal-this.lastNeed,r=l(this,e,t);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length)}function f(e,t){var r=u(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function d(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function y(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function g(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function _(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function v(e){return e.toString(this.encoding)}function b(e){return e&&e.length?this.write(e):""}t.s=a,a.prototype.write=function(e){var t,r;if(0===e.length)return"";if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return rthis._connect(),this.reconnectInterval),this.reconnectInterval*=2,this.reconnectInterval>this.options.reconnectIntervalMax&&(this.reconnectInterval=this.options.reconnectIntervalMax)}_connectFailed(){this.isFailed||(this.isFailed=!0,this.eventListeners.connectFailed.length>0?this.eventListeners.connectFailed.forEach(async e=>{try{await e()}catch(e){console.log("Connect failed handler error:",e)}}):console.log("Client connect failed"))}on(e,t){this.eventListeners[e]||(this.eventListeners[e]=[]),this.eventListeners[e].push(t)}onConnect(e){this.eventListeners.connect.push(e)}onConnectFailed(e){this.eventListeners.connectFailed.push(e)}onWsError(e){this.eventListeners.wsError.push(e)}onMessage(e){this.eventListeners.message.push(e)}_wsSend(e){if(!this.ws)throw new o.errors.ClientNotReadyError;this.ws.send(e)}async _processDest(e){if(0===e.length)throw new o.errors.InvalidDestinationError("destination is empty");let t=e.split(".");if(t[t.length-1].length<2*o.crypto.publicKeyLength){let r=await this.getRegistrant(t[t.length-1]);if(r.registrant&&r.registrant.length>0)t[t.length-1]=r.registrant;else throw new o.errors.InvalidDestinationError(e+" is neither a valid public key nor a registered name")}return t.join(".")}async _processDests(e){if(Array.isArray(e)){if(0===e.length)throw new o.errors.InvalidDestinationError("no destinations");if(0===(e=(e=await Promise.all(e.map(async e=>{try{return await this._processDest(e)}catch(e){return console.warn(e.message),""}}))).filter(e=>e.length>0)).length)throw new o.errors.InvalidDestinationError("all destinations are invalid")}else e=await this._processDest(e);return e}async _send(e,t,r=!0,n=0){if(Array.isArray(e)){if(0===e.length)return null;if(1===e.length)return await this._send(e[0],t,r,n)}e=await this._processDests(e);let i=await this._messageFromPayload(t,r,e);i=i.map(e=>e.serializeBinary());let s=[],c=[],u=[];if(i.length>1){let t=0,r=0;for(let l=0;la.maxClientMessageSize)throw new o.errors.DataSizeTooLargeError("encoded message is greater than "+a.maxClientMessageSize+" bytes");t+r>a.maxClientMessageSize&&(s.push(await a.newOutboundMessage(this,c,u,n)),c=[],u=[],t=0),c.push(e[l]),u.push(i[l]),t+=r}}else{let t=i[0].length;if(Array.isArray(e))for(let r=0;ra.maxClientMessageSize)throw new o.errors.DataSizeTooLargeError("encoded message is greater than "+a.maxClientMessageSize+" bytes");c=e,u=i}return s.push(await a.newOutboundMessage(this,c,u,n)),s.length>1&&console.log(`Client message size is greater than ${a.maxClientMessageSize} bytes, split into ${s.length} batches.`),s.forEach(e=>{this._wsSend(e.serializeBinary())}),t.getMessageId()||null}async send(e,t,r={}){let n;r=o.util.assignDefined({},this.options,r),n="string"==typeof t?a.newTextPayload(t,r.replyToId,r.messageId):a.newBinaryPayload(t,r.replyToId,r.messageId);let i=await this._send(e,n,r.encrypt,r.msgHoldingSeconds);return null===i||r.noReply?null:await new Promise((e,t)=>{this.responseManager.add(new g(i,r.responseTimeout,e,t))})}async _sendACK(e,t,r){if(Array.isArray(e)){if(0===e.length)return;if(1===e.length)return await this._sendACK(e[0],t,r);if(e.length>1&&r){console.warn("Encrypted ACK with multicast is not supported, fallback to unicast.");for(let n=0;n=r.limit;){if(n+=r.limit,!((i=await this.getSubscribers(e,{offset:n,limit:r.limit})).subscribers instanceof Array))throw new o.errors.InvalidResponseError("subscribers should be an array");a=a.concat(i.subscribers)}return r.txPool&&c&&(a=a.concat(c)),await this.send(a,t,r),null}close(){this.responseManager.stop(),this.shouldReconnect=!1;try{this.ws&&this.ws.close()}catch(e){}this.isClosed=!0}async _messageFromPayload(e,t,r){return t?await this._encryptPayload(e.serializeBinary(),r):[a.newMessage(e.serializeBinary(),!1)]}async _handleMsg(e){let t=o.pb.messages.ClientMessage.deserializeBinary(e);return t.getMessageType()===o.pb.messages.ClientMessageType.INBOUND_MESSAGE&&await this._handleInboundMsg(t.getMessage())}async _handleInboundMsg(e){let t,r=o.pb.messages.InboundMessage.deserializeBinary(e),n=r.getPrevSignature();if(n.length>0){n=o.util.bytesToHex(n);let e=await a.newReceipt(this,n);this._wsSend(e.serializeBinary())}let i=o.pb.payloads.Message.deserializeBinary(r.getPayload());t=i.getEncrypted()?await this._decryptPayload(i,r.getSrc()):i.getPayload();let s=o.pb.payloads.Payload.deserializeBinary(t),c=s.getData();switch(s.getType()){case o.pb.payloads.PayloadType.TEXT:c=o.pb.payloads.TextData.deserializeBinary(c).getText();break;case o.pb.payloads.PayloadType.ACK:return this.responseManager.respond(s.getReplyToId(),null,s.getType()),!0}if(s.getReplyToId().length)return this.responseManager.respond(s.getReplyToId(),c,s.getType()),!0;switch(s.getType()){case o.pb.payloads.PayloadType.TEXT:case o.pb.payloads.PayloadType.BINARY:case o.pb.payloads.PayloadType.SESSION:if(this.eventListeners.message.length>0){let e=await Promise.all(this.eventListeners.message.map(async e=>{try{return await e({src:r.getSrc(),payload:c,payloadType:s.getType(),isEncrypted:i.getEncrypted(),messageId:s.getMessageId(),noReply:s.getNoReply()})}catch(e){return console.log("Message handler error:",e),null}}));if(!s.getNoReply()){let t=!1;for(let n of e){if(!1===n)return!0;if(null!=n){this.send(r.getSrc(),n,{encrypt:i.getEncrypted(),msgHoldingSeconds:0,replyToId:s.getMessageId()}).catch(e=>{console.log("Send response error:",e)}),t=!0;break}}t||await this._sendACK(r.getSrc(),s.getMessageId(),i.getEncrypted())}}return!0;default:return!1}}_shouldUseTls(){return void 0!==this.options.tls?!!this.options.tls:"undefined"!=typeof window&&!!window.location&&"https:"===window.location.protocol}async _newWsAddr(e){let t,r,i,a;if(!e.addr){console.log("No address in node info",e),this.shouldReconnect?this._reconnect():this.isClosed||this._connectFailed();return}let c=this._shouldUseTls();try{this.options.webrtc?(t=this.peer,this.peer.setRemoteDescription(e.sdp)):(t=new n.default((c?"wss":"ws")+"://"+e.addr)).binaryType="arraybuffer"}catch(e){console.log("Create WebSocket or WebRTC failed,",e),this.shouldReconnect?this._reconnect():this.isClosed||this._connectFailed();return}if(this.ws){this.ws.onclose=()=>{};try{this.ws.close()}catch(e){}}if(this.isClosed){try{t.close()}catch(e){}return}if(this.ws=t,this.node=e,this.wallet.options.rpcServerAddr="",!c&&e.rpcAddr){let t="http://"+e.rpcAddr;o.rpc.getNodeState({rpcServerAddr:t}).then(e=>{"PERSIST_FINISHED"===e.syncState&&(this.wallet.options.rpcServerAddr=t)}).catch(e=>{console.log(e)})}new Promise((e,n)=>{r=e,i=setTimeout(()=>{this.ws===t?n(new o.errors.ConnectToNodeTimeoutError):e()},this.options.connectTimeout)}).then(()=>{clearTimeout(i)}).catch(e=>{this.isClosed||console.log("WebSocket or WebRTC connect timeout,",e),this.shouldReconnect?this._reconnect():this.isClosed||this._connectFailed()});let l=new Promise((e,r)=>{a=e,setTimeout(()=>{this.ws===t&&e(new o.errors.ChallengeTimeoutError)},s.waitForChallengeTimeout)});t.onopen=async()=>{r();let e={Action:d.setClient,Addr:this.addr},n=await l;!n||n instanceof o.errors.ChallengeTimeoutError||(e.ClientSalt=o.util.bytesToHex(n.ClientSalt),e.Signature=o.util.bytesToHex(n.Signature)),t.send(JSON.stringify(e)),this.shouldReconnect=!0,this.reconnectInterval=this.options.reconnectIntervalMin},t.onmessage=async e=>{let t=e.data;if(t instanceof ArrayBuffer||t instanceof Blob){try{t instanceof Blob&&(t=new Uint8Array(await t.arrayBuffer())),await this._handleMsg(t)||console.warn("Unhandled msg.")}catch(e){console.log(e)}return}let r=JSON.parse(t);if(void 0!==r.Error&&r.Error!==o.errors.rpcRespErrCodes.success){if(console.log(r),r.Error===o.errors.rpcRespErrCodes.wrongNode)this._newWsAddr(r.Result);else if(r.Action===d.setClient)try{this.ws&&this.ws.close()}catch(e){}return}switch(r.Action){case d.setClient:this.sigChainBlockHash=r.Result.sigChainBlockHash,!this.isReady&&(this.isReady=!0,this.eventListeners.connect.length>0&&this.eventListeners.connect.forEach(async e=>{try{await e(r.Result)}catch(e){console.log("Connect handler error:",e)}}));break;case d.updateSigChainBlockHash:this.sigChainBlockHash=r.Result;break;case d.authChallenge:let n=r.Challenge,i=o.util.hexToBytes(n),s=o.util.randomBytes(32);i=o.util.mergeTypedArrays(i,s);let c=o.hash.sha256Hex(o.util.bytesToHex(i)),l=await u.sign(this.key.privateKey,c);a({ClientSalt:s,Signature:o.util.hexToBytes(l)});break;default:console.warn("Unknown msg type:",r.Action)}},t.onclose=()=>{this.shouldReconnect?(console.warn("WebSocket unexpectedly closed."),this._reconnect()):this.isClosed||this._connectFailed()},t.onerror=e=>{this.eventListeners.wsError.length>0?this.eventListeners.wsError.forEach(async t=>{try{await t(e)}catch(e){console.log("WsError handler error:",e)}}):console.log(e.message)}}async _encryptPayload(e,t){if(Array.isArray(t)){let r=o.util.randomBytes(o.crypto.nonceLength),n=o.util.randomBytes(o.crypto.keyLength),i=await o.crypto.encryptSymmetric(e,r,n),s=[];for(let e=0;e0){if(s.length!=2*o.crypto.nonceLength)throw new o.errors.DecryptionError("invalid nonce length");let e=await this.key.decrypt(c,s.slice(0,o.crypto.nonceLength),i);if(null===e)throw new o.errors.DecryptionError("decrypt shared key failed");if(null===(r=await o.crypto.decryptSymmetric(n,s.slice(o.crypto.nonceLength),e)))throw new o.errors.DecryptionError("decrypt message failed")}else{if(s.length!=o.crypto.nonceLength)throw new o.errors.DecryptionError("invalid nonce length");if(null===(r=await this.key.decrypt(n,s,i)))throw new o.errors.DecryptionError("decrypt message failed")}return r}async getLatestBlock(){if(this.wallet.options.rpcServerAddr)try{return await i.default.getLatestBlock(this.options)}catch(e){}return await i.default.getLatestBlock(this.options)}async getRegistrant(e){if(this.wallet.options.rpcServerAddr)try{return await i.default.getRegistrant(e,this.wallet.options)}catch(e){}return await i.default.getRegistrant(e,this.options)}async getSubscribers(e,t={}){if(this.wallet.options.rpcServerAddr)try{return await i.default.getSubscribers(e,Object.assign({},this.wallet.options,t))}catch(e){}return await i.default.getSubscribers(e,Object.assign({},this.options,t))}async getSubscribersCount(e){if(this.wallet.options.rpcServerAddr)try{return await i.default.getSubscribersCount(e,this.wallet.options)}catch(e){}return await i.default.getSubscribersCount(e,this.options)}async getSubscription(e,t){if(this.wallet.options.rpcServerAddr)try{return await i.default.getSubscription(e,t,this.wallet.options)}catch(e){}return await i.default.getSubscription(e,t,this.options)}async getBalance(e){if(this.wallet.options.rpcServerAddr)try{return await i.default.getBalance(e||this.wallet.address,this.wallet.options)}catch(e){}return await i.default.getBalance(e||this.wallet.address,this.options)}async getNonce(e,t={}){if(this.wallet.options.rpcServerAddr)try{return await i.default.getNonce(e||this.wallet.address,Object.assign({},this.wallet.options,t))}catch(e){}return await i.default.getNonce(e||this.wallet.address,Object.assign({},this.options,t))}async sendTransaction(e){if(this.wallet.options.rpcServerAddr)try{return await i.default.sendTransaction(e,this.wallet.options)}catch(e){}return await i.default.sendTransaction(e,this.options)}transferTo(e,t,r={}){return o.rpc.transferTo.call(this,e,t,r)}registerName(e,t={}){return o.rpc.registerName.call(this,e,t)}transferName(e,t,r={}){return o.rpc.transferName.call(this,e,t,r)}deleteName(e,t={}){return o.rpc.deleteName.call(this,e,t)}subscribe(e,t,r="",n="",i={}){return o.rpc.subscribe.call(this,e,t,r,n,i)}unsubscribe(e,t="",r={}){return o.rpc.unsubscribe.call(this,e,t,r)}createTransaction(e,t,r={}){return this.wallet.createTransaction(e,t,r)}}t.default=y;class g{constructor(e,t,r,n){p(this,"messageId",void 0),p(this,"deadline",void 0),p(this,"responseHandler",void 0),p(this,"timeoutHandler",void 0),e instanceof Uint8Array&&(e=o.util.bytesToHex(e)),this.messageId=e,t&&(this.deadline=Date.now()+t),this.responseHandler=r,this.timeoutHandler=n}checkTimeout(e){return!!this.deadline&&(e||(e=Date.now()),e>this.deadline)}handleResponse(e){this.responseHandler&&this.responseHandler(e)}handleTimeout(){this.timeoutHandler&&this.timeoutHandler(Error("Message timeout"))}}class _{constructor(){p(this,"responseProcessors",void 0),p(this,"timer",void 0),this.responseProcessors=new Map,this.timer=null,this.checkTimeout()}add(e){this.responseProcessors.set(e.messageId,e)}clear(){for(let e of this.responseProcessors.values())e.handleTimeout();this.responseProcessors=new Map}stop(){clearTimeout(this.timer),this.clear()}respond(e,t,r){e instanceof Uint8Array&&(e=o.util.bytesToHex(e));let n=this.responseProcessors.get(e);n&&(n.handleResponse(t),this.responseProcessors.delete(e))}checkTimeout(){let e=[],t=Date.now();for(let r of this.responseProcessors.values())r.checkTimeout(t)&&e.push(r);e.forEach(e=>{e.handleTimeout(),this.responseProcessors.delete(e.messageId)}),this.timer=setTimeout(this.checkTimeout.bind(this),s.checkTimeoutInterval)}}},26816:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.waitForChallengeTimeout=t.defaultPublishOptions=t.defaultOptions=t.checkTimeoutInterval=void 0;let r={reconnectIntervalMin:1e3,reconnectIntervalMax:64e3,responseTimeout:5e3,connectTimeout:1e4,msgHoldingSeconds:0,encrypt:!0,rpcServerAddr:"https://mainnet-rpc-node-0001.nkn.org/mainnet/api/wallet",stunServerAddr:["stun:stun.l.google.com:19302","stun:stun.cloudflare.com:3478","stun:stunserver.stunprotocol.org:3478"],worker:!1};t.defaultOptions=r;let n={txPool:!1,offset:0,limit:1e3};t.defaultPublishOptions=n;let i=250;t.checkTimeoutInterval=i;let o=5e3;t.waitForChallengeTimeout=o},85349:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.default}});var n=i(r(3890));function i(e){return e&&e.__esModule?e:{default:e}}},12681:function(e,t,r){"use strict";var n=r(11530).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.addrToID=S,t.addrToPubkey=E,t.messageIdSize=t.maxClientMessageSize=void 0,t.newAckPayload=d,t.newBinaryPayload=f,t.newClientMessage=_,t.newMessage=g,t.newOutboundMessage=v,t.newPayload=h,t.newReceipt=b,t.newSessionPayload=y,t.newTextPayload=p,t.serializeSigChainElem=w,t.serializeSigChainMetadata=m;var i=c(r(25090)),o=a(r(21913));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(s=function(e){return e?r:t})(e)}function a(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=s(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function c(e){return e&&e.__esModule?e:{default:e}}let u=8;t.messageIdSize=u;let l=4e6;function h(e,t,r,n){let i=new o.pb.payloads.Payload;return i.setType(e),t?i.setReplyToId(t):n?i.setMessageId(n):i.setMessageId(o.util.randomBytes(u)),i.setData(r),i}function f(e,t,r){return h(o.pb.payloads.PayloadType.BINARY,t,e,r)}function p(e,t,r){let n=new o.pb.payloads.TextData;return n.setText(e),h(o.pb.payloads.PayloadType.TEXT,t,n.serializeBinary(),r)}function d(e,t){return h(o.pb.payloads.PayloadType.ACK,e,null,t)}function y(e,t){return h(o.pb.payloads.PayloadType.SESSION,null,e,t)}function g(e,t,r,n){let i=new o.pb.payloads.Message;return i.setPayload(e),i.setEncrypted(t),r&&i.setNonce(r),n&&i.setEncryptedKey(n),i}function _(e,t,r){let n=new o.pb.messages.ClientMessage;switch(n.setMessageType(e),n.setCompressionType(r),r){case o.pb.messages.CompressionType.COMPRESSION_NONE:break;case o.pb.messages.CompressionType.COMPRESSION_ZLIB:t=i.default.deflate(t);break;default:throw new o.errors.InvalidArgumentError("unknown compression type "+r)}return n.setMessage(t),n}async function v(e,t,r,i){let s,a,c,u;if(Array.isArray(t)||(t=[t]),0===t.length)throw new o.errors.InvalidArgumentError("no destination");if(Array.isArray(r)||(r=[r]),0===r.length)throw new o.errors.InvalidArgumentError("no payloads");if(r.length>1&&r.length!==t.length)throw new o.errors.InvalidArgumentError("invalid payload array length");let l=new o.pb.sigchain.SigChainElem;l.setNextPubkey(n.from(e.node.pubkey,"hex"));let h=w(l),f=new o.pb.sigchain.SigChain;f.setNonce(o.util.randomInt32()),e.sigChainBlockHash&&f.setBlockHash(n.from(e.sigChainBlockHash,"hex")),f.setSrcId(n.from(S(e.addr),"hex")),f.setSrcPubkey(n.from(e.key.publicKey,"hex"));let p=[];for(let i=0;i1?f.setDataSize(r[i].length):f.setDataSize(r[0].length),s=m(f),a=o.hash.sha256Hex(s),a=o.hash.sha256Hex(a+h),c=await e.key.sign(a),p.push(n.from(c,"hex"));let d=new o.pb.messages.OutboundMessage;return d.setDestsList(t),d.setPayloadsList(r),d.setMaxHoldingSeconds(i),d.setNonce(f.getNonce()),d.setBlockHash(f.getBlockHash()),d.setSignaturesList(p),u=r.length>1?o.pb.messages.CompressionType.COMPRESSION_ZLIB:o.pb.messages.CompressionType.COMPRESSION_NONE,_(o.pb.messages.ClientMessageType.OUTBOUND_MESSAGE,d.serializeBinary(),u)}async function b(e,t){let r=w(new o.pb.sigchain.SigChainElem),i=o.hash.sha256Hex(t);i=o.hash.sha256Hex(i+r);let s=await e.key.sign(i),a=new o.pb.messages.Receipt;return a.setPrevSignature(n.from(t,"hex")),a.setSignature(n.from(s,"hex")),_(o.pb.messages.ClientMessageType.RECEIPT,a.serializeBinary(),o.pb.messages.CompressionType.COMPRESSION_NONE)}function m(e){return""+(o.serialize.encodeUint32(e.getNonce())+o.serialize.encodeUint32(e.getDataSize())+o.serialize.encodeBytes(e.getBlockHash())+o.serialize.encodeBytes(e.getSrcId())+o.serialize.encodeBytes(e.getSrcPubkey())+o.serialize.encodeBytes(e.getDestId())+o.serialize.encodeBytes(e.getDestPubkey()))}function w(e){return""+(o.serialize.encodeBytes(e.getId())+o.serialize.encodeBytes(e.getNextPubkey())+o.serialize.encodeBool(e.getMining()))}function S(e){return o.hash.sha256(e)}function E(e){let t=e.split(".");return t[t.length-1]}t.maxClientMessageSize=l},5316:function(e,t){"use strict";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;let n="ping",i="pong";class o{send(e){this.dc.send(e)}constructor(e){r(this,"config",void 0),r(this,"pc",void 0),r(this,"dc",void 0),r(this,"sdp",void 0),r(this,"isConnected",void 0),r(this,"onopen",void 0),r(this,"onmessage",void 0),r(this,"onclose",void 0),r(this,"onerror",void 0);let t={iceServers:[{urls:e}]};this.config=t,this.isConnected=!1}async offer(e){return new Promise(async(t,r)=>{try{this.pc&&"closed"!==this.pc.signalingState||(this.pc=new RTCPeerConnection(this.config)),this.pc.oniceconnectionstatechange=()=>{"failed"===this.pc.iceConnectionState&&this.pc.restartIce()},this.dc=this.pc.createDataChannel(e),this.dc.addEventListener("open",()=>{this.isConnected=!0,this.onopen&&this.onopen()}),this.dc.addEventListener("message",e=>{if(e.data==i){null!=this.pongHandler?this.pongHandler(i):console.log("Pong handler not set");return}if(e.data==n){this.dc.send(i);return}this.onmessage&&this.onmessage(e)}),this.dc.addEventListener("close",e=>{this.isConnected=!1,this.onclose&&this.onclose()}),this.dc.addEventListener("error",e=>{this.onerror&&this.onerror(e)}),await this.pc.createOffer(),await this.pc.setLocalDescription(),this.sdp=btoa(JSON.stringify(this.pc.localDescription)),t(this.sdp)}catch(e){r(e)}})}setRemoteDescription(e){let t=JSON.parse(atob(e));return this.pc.setRemoteDescription(t)}close(){this.dc.close(),this.pc.close()}}t.default=o},16835:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=s,t.encrypt=o;var n=i(r(58110));function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return n.default.AES.encrypt(n.default.enc.Hex.parse(e),n.default.enc.Hex.parse(t),{iv:n.default.enc.Hex.parse(r),mode:n.default.mode.CBC,padding:n.default.pad.NoPadding}).ciphertext.toString(n.default.enc.Hex)}function s(e,t,r){return n.default.AES.decrypt(n.default.enc.Hex.parse(e).toString(n.default.enc.Base64),n.default.enc.Hex.parse(t),{iv:n.default.enc.Hex.parse(r),mode:n.default.mode.CBC,padding:n.default.pad.NoPadding}).toString()}},69073:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(6615);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}n.Decimal.set({minE:-8});class o extends n.Decimal{value(){return this.times(o.unit).floor()}}t.default=o,i(o,"unit",new n.Decimal("100000000"))},35033:function(e,t,r){"use strict";var n=r(11530).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.computeSharedKey=m,t.decryptSymmetric=S,t.ed25519PkToCurve25519=b,t.ed25519SkToCurve25519=v,t.encryptSymmetric=w,t.keyLength=void 0,t.keyPair=_,t.seedLength=t.publicKeyLength=t.nonceLength=void 0,t.sign=E,t.signatureLength=void 0;var i=l(r(45230)),o=l(r(73551)),s=l(r(77085)),a=u(r(41015));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(c=function(e){return e?r:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=c(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function l(e){return e&&e.__esModule?e:{default:e}}let h=32;t.keyLength=h;let f=24;t.nonceLength=f;let p=32;t.publicKeyLength=p;let d=32;t.seedLength=d;let y=64;t.signatureLength=y;let g=!1;function _(e){let t=a.hexToBytes(e);try{let r=o.default.crypto_sign_seed_keypair(t);return{seed:e,publicKey:r.publicKey,privateKey:r.privateKey,curvePrivateKey:v(r.privateKey)}}catch(n){let r=s.default.sign.keyPair.fromSeed(t);return{seed:e,publicKey:r.publicKey,privateKey:r.secretKey,curvePrivateKey:i.default.convertSecretKey(r.secretKey)}}}function v(e){try{return o.default.crypto_sign_ed25519_sk_to_curve25519(e)}catch(t){return i.default.convertSecretKey(e)}}async function b(e){try{return g||(await o.default.ready,g=!0),o.default.crypto_sign_ed25519_pk_to_curve25519(e)}catch(t){return console.warn(t),i.default.convertPublicKey(e)}}async function m(e,t){let r,i=await b(n.from(t,"hex"));try{r=o.default.crypto_box_beforenm(i,e)}catch(t){console.warn(t),r=s.default.box.before(i,e)}return a.bytesToHex(r)}async function w(e,t,r){try{return g||(await o.default.ready,g=!0),o.default.crypto_box_easy_afternm(e,t,r)}catch(n){return console.warn(n),s.default.secretbox(e,t,r)}}async function S(e,t,r){try{return g||(await o.default.ready,g=!0),o.default.crypto_box_open_easy_afternm(e,t,r)}catch(n){return console.warn(n),s.default.secretbox.open(e,t,r)}}async function E(e,t){let r;try{g||(await o.default.ready,g=!0),r=o.default.crypto_sign_detached(n.from(t,"hex"),e)}catch(i){console.warn(i),r=s.default.sign.detached(n.from(t,"hex"),e)}return a.bytesToHex(r)}},4453:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rpcRespErrCodes=t.WrongPasswordError=t.UnknownError=t.ServerError=t.RpcTimeoutError=t.RpcError=t.NotEnoughBalanceError=t.InvalidWalletVersionError=t.InvalidWalletFormatError=t.InvalidResponseError=t.InvalidDestinationError=t.InvalidArgumentError=t.InvalidAddressError=t.DecryptionError=t.DataSizeTooLargeError=t.ConnectToNodeTimeoutError=t.ClientNotReadyError=t.ChallengeTimeoutError=t.AddrNotAllowedError=void 0;let r={success:0,wrongNode:48001,appendTxnPool:45021,invalidMethod:42001};t.rpcRespErrCodes=r;class n extends Error{constructor(e="address not allowed",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,n),this.name="AddrNotAllowedError"}}t.AddrNotAllowedError=n;class i extends Error{constructor(e="client not ready",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,i),this.name="ClientNotReadyError"}}t.ClientNotReadyError=i;class o extends Error{constructor(e="data size too large",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,o),this.name="DataSizeTooLargeError"}}t.DataSizeTooLargeError=o;class s extends Error{constructor(e="decrypt message error",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,s),this.name="DecryptionError"}}t.DecryptionError=s;class a extends Error{constructor(e="unknown error",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,a),this.name="UnknownError"}}t.UnknownError=a;class c extends Error{constructor(e="not enough balance",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,c),this.name="NotEnoughBalanceError"}}t.NotEnoughBalanceError=c;class u extends Error{constructor(e="wrong password",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,u),this.name="WrongPasswordError"}}t.WrongPasswordError=u;class l extends Error{constructor(e="invalid wallet address",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,l),this.name="InvalidAddressError"}}t.InvalidAddressError=l;class h extends Error{constructor(e="invalid wallet format",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,h),this.name="InvalidWalletFormatError"}}t.InvalidWalletFormatError=h;class f extends Error{constructor(e="invalid wallet version",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,f),this.name="InvalidWalletVersionError"}}t.InvalidWalletVersionError=f;class p extends Error{constructor(e="invalid argument",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,p),this.name="InvalidArgumentError"}}t.InvalidArgumentError=p;class d extends Error{constructor(e="invalid response from RPC server",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,d),this.name="InvalidResponseError"}}t.InvalidResponseError=d;class y extends Error{constructor(e="error from RPC server",...t){let r;super(r="object"==typeof e?e.message+": "+e.data:e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,y),this.name="ServerError",e.code&&(this.code=-e.code)}}t.ServerError=y;class g extends Error{constructor(e="invalid destination",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,g),this.name="InvalidDestinationError"}}t.InvalidDestinationError=g;class _ extends Error{constructor(e="rpc timeout",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,_),this.name="RpcTimeoutError"}}t.RpcTimeoutError=_;class v extends Error{constructor(e="rpc error",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,v),this.name="RpcError"}}t.RpcError=v;class b extends Error{constructor(e="challenge timeout",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,b),this.name="ChallengeTimeoutError"}}t.ChallengeTimeoutError=b;class m extends Error{constructor(e="connect to node timeout",...t){super(e,...t),Error.captureStackTrace&&Error.captureStackTrace(this,m),this.name="ConnectToNodeTimeoutError"}}t.ConnectToNodeTimeoutError=m},58373:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cryptoHexStringParse=o,t.doubleSha256=c,t.doubleSha256Hex=u,t.ripemd160=l,t.ripemd160Hex=h,t.sha256=s,t.sha256Hex=a;var n=i(r(58110));function i(e){return e&&e.__esModule?e:{default:e}}function o(e){return n.default.enc.Hex.parse(e)}function s(e){return n.default.SHA256(e).toString()}function a(e){return s(o(e))}function c(e){return n.default.SHA256(n.default.SHA256(e)).toString()}function u(e){return c(o(e))}function l(e){return n.default.RIPEMD160(e).toString()}function h(e){return l(o(e))}},21913:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Amount",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"Key",{enumerable:!0,get:function(){return i.default}}),t.util=t.serialize=t.rpc=t.pb=t.key=t.hash=t.errors=t.crypto=t.aes=void 0;var n=y(r(69073)),i=d(r(27645));t.key=i;var o=d(r(16835));t.aes=o;var s=d(r(35033));t.crypto=s;var a=d(r(4453));t.errors=a;var c=d(r(58373));t.hash=c;var u=d(r(63339));t.pb=u;var l=d(r(92110));t.rpc=l;var h=d(r(57308));t.serialize=h;var f=d(r(41015));function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(p=function(e){return e?r:t})(e)}function d(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=p(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function y(e){return e&&e.__esModule?e:{default:e}}t.util=f},27645:function(e,t,r){"use strict";var n=r(11530).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=u(r(74975)),o=c(r(35033));c(r(4453));var s=c(r(41015));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=a(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function u(e){return e&&e.__esModule?e:{default:e}}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class h{constructor(e,t={}){l(this,"seed",void 0),l(this,"publicKey",void 0),l(this,"privateKey",void 0),l(this,"curvePrivateKey",void 0),l(this,"sharedKeyCache",void 0),l(this,"useWorker",void 0),l(this,"worker",void 0),l(this,"workerMsgID",void 0),l(this,"workerMsgCache",void 0),e||(e=s.randomBytesHex(o.seedLength));let n=o.keyPair(e);this.seed=e,this.publicKey=s.bytesToHex(n.publicKey),this.privateKey=n.privateKey,this.curvePrivateKey=n.curvePrivateKey,this.sharedKeyCache=new Map,this.useWorker=this._shouldUseWorker(t.worker),this.worker=null,this.workerMsgID=0,this.workerMsgCache=new Map,this.useWorker&&(async()=>{try{if("function"==typeof t.worker)this.worker=await t.worker();else try{this.worker=(0,i.default)(r(8953))}catch(e){try{let e=r(25735);this.worker=new e}catch(e){throw"neither browserify nor webpack worker-loader is detected"}}this.worker.onmessage=e=>{if(void 0!==e.data.id&&this.workerMsgCache.has(e.data.id)){let t=this.workerMsgCache.get(e.data.id);e.data.error?t.reject(e.data.error):t.resolve(e.data.result),this.workerMsgCache.delete(e.data.id)}},await this._sendToWorker({action:"setSeed",seed:this.seed})}catch(e){console.warn("Launch web worker failed:",e),this.useWorker=!1}})()}_shouldUseWorker(e){return!!e&&"undefined"!=typeof window&&!!window.Worker}_sendToWorker(e){return new Promise((t,r)=>{let n=this.workerMsgID;this.workerMsgID++,this.workerMsgCache.set(n,{resolve:t,reject:r}),this.worker.postMessage(Object.assign({id:n},e))})}async computeSharedKey(e){if(this.useWorker)try{return await this._sendToWorker({action:"computeSharedKey",otherPubkey:e})}catch(e){console.warn("worker computeSharedKey failed, fallback to main thread:",e)}return await o.computeSharedKey(this.curvePrivateKey,e)}async getOrComputeSharedKey(e){let t=this.sharedKeyCache.get(e);return t||(t=await this.computeSharedKey(e),this.sharedKeyCache.set(e,t)),t}async encrypt(e,t,r={}){let i=await this.getOrComputeSharedKey(t);i=n.from(i,"hex");let a=r.nonce||s.randomBytes(o.nonceLength);return{message:await o.encryptSymmetric(e,a,i),nonce:a}}async decrypt(e,t,r,i={}){let s=await this.getOrComputeSharedKey(r);return s=n.from(s,"hex"),await o.decryptSymmetric(e,t,s)}async sign(e){if(this.useWorker)try{return await this._sendToWorker({action:"sign",message:e})}catch(e){console.warn("worker sign failed, fallback to main thread:",e)}return await o.sign(this.privateKey,e)}}t.default=h},63339:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transaction=t.sigchain=t.payloads=t.messages=void 0;var n=c(r(90647));t.messages=n;var i=c(r(260));t.payloads=i;var o=c(r(50817));t.sigchain=o;var s=c(r(96946));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=a(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}t.transaction=s},90647:function(e,t,r){"use strict";var n=r(24304),i=n,o=Function("return this")();i.exportSymbol("proto.messages.ClientMessage",null,o),i.exportSymbol("proto.messages.ClientMessageType",null,o),i.exportSymbol("proto.messages.CompressionType",null,o),i.exportSymbol("proto.messages.InboundMessage",null,o),i.exportSymbol("proto.messages.OutboundMessage",null,o),i.exportSymbol("proto.messages.Receipt",null,o),proto.messages.ClientMessage=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.messages.ClientMessage,n.Message),i.DEBUG&&!COMPILED&&(proto.messages.ClientMessage.displayName="proto.messages.ClientMessage"),proto.messages.OutboundMessage=function(e){n.Message.initialize(this,e,0,-1,proto.messages.OutboundMessage.repeatedFields_,null)},i.inherits(proto.messages.OutboundMessage,n.Message),i.DEBUG&&!COMPILED&&(proto.messages.OutboundMessage.displayName="proto.messages.OutboundMessage"),proto.messages.InboundMessage=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.messages.InboundMessage,n.Message),i.DEBUG&&!COMPILED&&(proto.messages.InboundMessage.displayName="proto.messages.InboundMessage"),proto.messages.Receipt=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.messages.Receipt,n.Message),i.DEBUG&&!COMPILED&&(proto.messages.Receipt.displayName="proto.messages.Receipt"),n.Message.GENERATE_TO_OBJECT&&(proto.messages.ClientMessage.prototype.toObject=function(e){return proto.messages.ClientMessage.toObject(e,this)},proto.messages.ClientMessage.toObject=function(e,t){var r={messageType:n.Message.getFieldWithDefault(t,1,0),message:t.getMessage_asB64(),compressionType:n.Message.getFieldWithDefault(t,3,0)};return e&&(r.$jspbMessageInstance=t),r}),proto.messages.ClientMessage.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.messages.ClientMessage;return proto.messages.ClientMessage.deserializeBinaryFromReader(r,t)},proto.messages.ClientMessage.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setMessageType(r);break;case 2:var r=t.readBytes();e.setMessage(r);break;case 3:var r=t.readEnum();e.setCompressionType(r);break;default:t.skipField()}return e},proto.messages.ClientMessage.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.messages.ClientMessage.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.messages.ClientMessage.serializeBinaryToWriter=function(e,t){var r=void 0;0!==(r=e.getMessageType())&&t.writeEnum(1,r),(r=e.getMessage_asU8()).length>0&&t.writeBytes(2,r),0!==(r=e.getCompressionType())&&t.writeEnum(3,r)},proto.messages.ClientMessage.prototype.getMessageType=function(){return n.Message.getFieldWithDefault(this,1,0)},proto.messages.ClientMessage.prototype.setMessageType=function(e){n.Message.setProto3EnumField(this,1,e)},proto.messages.ClientMessage.prototype.getMessage=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.messages.ClientMessage.prototype.getMessage_asB64=function(){return n.Message.bytesAsB64(this.getMessage())},proto.messages.ClientMessage.prototype.getMessage_asU8=function(){return n.Message.bytesAsU8(this.getMessage())},proto.messages.ClientMessage.prototype.setMessage=function(e){n.Message.setProto3BytesField(this,2,e)},proto.messages.ClientMessage.prototype.getCompressionType=function(){return n.Message.getFieldWithDefault(this,3,0)},proto.messages.ClientMessage.prototype.setCompressionType=function(e){n.Message.setProto3EnumField(this,3,e)},proto.messages.OutboundMessage.repeatedFields_=[3,7,8],n.Message.GENERATE_TO_OBJECT&&(proto.messages.OutboundMessage.prototype.toObject=function(e){return proto.messages.OutboundMessage.toObject(e,this)},proto.messages.OutboundMessage.toObject=function(e,t){var r={dest:n.Message.getFieldWithDefault(t,1,""),payload:t.getPayload_asB64(),destsList:n.Message.getRepeatedField(t,3),maxHoldingSeconds:n.Message.getFieldWithDefault(t,4,0),nonce:n.Message.getFieldWithDefault(t,5,0),blockHash:t.getBlockHash_asB64(),signaturesList:t.getSignaturesList_asB64(),payloadsList:t.getPayloadsList_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.messages.OutboundMessage.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.messages.OutboundMessage;return proto.messages.OutboundMessage.deserializeBinaryFromReader(r,t)},proto.messages.OutboundMessage.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readString();e.setDest(r);break;case 2:var r=t.readBytes();e.setPayload(r);break;case 3:var r=t.readString();e.addDests(r);break;case 4:var r=t.readUint32();e.setMaxHoldingSeconds(r);break;case 5:var r=t.readUint32();e.setNonce(r);break;case 6:var r=t.readBytes();e.setBlockHash(r);break;case 7:var r=t.readBytes();e.addSignatures(r);break;case 8:var r=t.readBytes();e.addPayloads(r);break;default:t.skipField()}return e},proto.messages.OutboundMessage.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.messages.OutboundMessage.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.messages.OutboundMessage.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getDest()).length>0&&t.writeString(1,r),(r=e.getPayload_asU8()).length>0&&t.writeBytes(2,r),(r=e.getDestsList()).length>0&&t.writeRepeatedString(3,r),0!==(r=e.getMaxHoldingSeconds())&&t.writeUint32(4,r),0!==(r=e.getNonce())&&t.writeUint32(5,r),(r=e.getBlockHash_asU8()).length>0&&t.writeBytes(6,r),(r=e.getSignaturesList_asU8()).length>0&&t.writeRepeatedBytes(7,r),(r=e.getPayloadsList_asU8()).length>0&&t.writeRepeatedBytes(8,r)},proto.messages.OutboundMessage.prototype.getDest=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.messages.OutboundMessage.prototype.setDest=function(e){n.Message.setProto3StringField(this,1,e)},proto.messages.OutboundMessage.prototype.getPayload=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.messages.OutboundMessage.prototype.getPayload_asB64=function(){return n.Message.bytesAsB64(this.getPayload())},proto.messages.OutboundMessage.prototype.getPayload_asU8=function(){return n.Message.bytesAsU8(this.getPayload())},proto.messages.OutboundMessage.prototype.setPayload=function(e){n.Message.setProto3BytesField(this,2,e)},proto.messages.OutboundMessage.prototype.getDestsList=function(){return n.Message.getRepeatedField(this,3)},proto.messages.OutboundMessage.prototype.setDestsList=function(e){n.Message.setField(this,3,e||[])},proto.messages.OutboundMessage.prototype.addDests=function(e,t){n.Message.addToRepeatedField(this,3,e,t)},proto.messages.OutboundMessage.prototype.clearDestsList=function(){this.setDestsList([])},proto.messages.OutboundMessage.prototype.getMaxHoldingSeconds=function(){return n.Message.getFieldWithDefault(this,4,0)},proto.messages.OutboundMessage.prototype.setMaxHoldingSeconds=function(e){n.Message.setProto3IntField(this,4,e)},proto.messages.OutboundMessage.prototype.getNonce=function(){return n.Message.getFieldWithDefault(this,5,0)},proto.messages.OutboundMessage.prototype.setNonce=function(e){n.Message.setProto3IntField(this,5,e)},proto.messages.OutboundMessage.prototype.getBlockHash=function(){return n.Message.getFieldWithDefault(this,6,"")},proto.messages.OutboundMessage.prototype.getBlockHash_asB64=function(){return n.Message.bytesAsB64(this.getBlockHash())},proto.messages.OutboundMessage.prototype.getBlockHash_asU8=function(){return n.Message.bytesAsU8(this.getBlockHash())},proto.messages.OutboundMessage.prototype.setBlockHash=function(e){n.Message.setProto3BytesField(this,6,e)},proto.messages.OutboundMessage.prototype.getSignaturesList=function(){return n.Message.getRepeatedField(this,7)},proto.messages.OutboundMessage.prototype.getSignaturesList_asB64=function(){return n.Message.bytesListAsB64(this.getSignaturesList())},proto.messages.OutboundMessage.prototype.getSignaturesList_asU8=function(){return n.Message.bytesListAsU8(this.getSignaturesList())},proto.messages.OutboundMessage.prototype.setSignaturesList=function(e){n.Message.setField(this,7,e||[])},proto.messages.OutboundMessage.prototype.addSignatures=function(e,t){n.Message.addToRepeatedField(this,7,e,t)},proto.messages.OutboundMessage.prototype.clearSignaturesList=function(){this.setSignaturesList([])},proto.messages.OutboundMessage.prototype.getPayloadsList=function(){return n.Message.getRepeatedField(this,8)},proto.messages.OutboundMessage.prototype.getPayloadsList_asB64=function(){return n.Message.bytesListAsB64(this.getPayloadsList())},proto.messages.OutboundMessage.prototype.getPayloadsList_asU8=function(){return n.Message.bytesListAsU8(this.getPayloadsList())},proto.messages.OutboundMessage.prototype.setPayloadsList=function(e){n.Message.setField(this,8,e||[])},proto.messages.OutboundMessage.prototype.addPayloads=function(e,t){n.Message.addToRepeatedField(this,8,e,t)},proto.messages.OutboundMessage.prototype.clearPayloadsList=function(){this.setPayloadsList([])},n.Message.GENERATE_TO_OBJECT&&(proto.messages.InboundMessage.prototype.toObject=function(e){return proto.messages.InboundMessage.toObject(e,this)},proto.messages.InboundMessage.toObject=function(e,t){var r={src:n.Message.getFieldWithDefault(t,1,""),payload:t.getPayload_asB64(),prevSignature:t.getPrevSignature_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.messages.InboundMessage.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.messages.InboundMessage;return proto.messages.InboundMessage.deserializeBinaryFromReader(r,t)},proto.messages.InboundMessage.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readString();e.setSrc(r);break;case 2:var r=t.readBytes();e.setPayload(r);break;case 3:var r=t.readBytes();e.setPrevSignature(r);break;default:t.skipField()}return e},proto.messages.InboundMessage.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.messages.InboundMessage.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.messages.InboundMessage.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getSrc()).length>0&&t.writeString(1,r),(r=e.getPayload_asU8()).length>0&&t.writeBytes(2,r),(r=e.getPrevSignature_asU8()).length>0&&t.writeBytes(3,r)},proto.messages.InboundMessage.prototype.getSrc=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.messages.InboundMessage.prototype.setSrc=function(e){n.Message.setProto3StringField(this,1,e)},proto.messages.InboundMessage.prototype.getPayload=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.messages.InboundMessage.prototype.getPayload_asB64=function(){return n.Message.bytesAsB64(this.getPayload())},proto.messages.InboundMessage.prototype.getPayload_asU8=function(){return n.Message.bytesAsU8(this.getPayload())},proto.messages.InboundMessage.prototype.setPayload=function(e){n.Message.setProto3BytesField(this,2,e)},proto.messages.InboundMessage.prototype.getPrevSignature=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.messages.InboundMessage.prototype.getPrevSignature_asB64=function(){return n.Message.bytesAsB64(this.getPrevSignature())},proto.messages.InboundMessage.prototype.getPrevSignature_asU8=function(){return n.Message.bytesAsU8(this.getPrevSignature())},proto.messages.InboundMessage.prototype.setPrevSignature=function(e){n.Message.setProto3BytesField(this,3,e)},n.Message.GENERATE_TO_OBJECT&&(proto.messages.Receipt.prototype.toObject=function(e){return proto.messages.Receipt.toObject(e,this)},proto.messages.Receipt.toObject=function(e,t){var r={prevSignature:t.getPrevSignature_asB64(),signature:t.getSignature_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.messages.Receipt.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.messages.Receipt;return proto.messages.Receipt.deserializeBinaryFromReader(r,t)},proto.messages.Receipt.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setPrevSignature(r);break;case 2:var r=t.readBytes();e.setSignature(r);break;default:t.skipField()}return e},proto.messages.Receipt.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.messages.Receipt.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.messages.Receipt.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getPrevSignature_asU8()).length>0&&t.writeBytes(1,r),(r=e.getSignature_asU8()).length>0&&t.writeBytes(2,r)},proto.messages.Receipt.prototype.getPrevSignature=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.messages.Receipt.prototype.getPrevSignature_asB64=function(){return n.Message.bytesAsB64(this.getPrevSignature())},proto.messages.Receipt.prototype.getPrevSignature_asU8=function(){return n.Message.bytesAsU8(this.getPrevSignature())},proto.messages.Receipt.prototype.setPrevSignature=function(e){n.Message.setProto3BytesField(this,1,e)},proto.messages.Receipt.prototype.getSignature=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.messages.Receipt.prototype.getSignature_asB64=function(){return n.Message.bytesAsB64(this.getSignature())},proto.messages.Receipt.prototype.getSignature_asU8=function(){return n.Message.bytesAsU8(this.getSignature())},proto.messages.Receipt.prototype.setSignature=function(e){n.Message.setProto3BytesField(this,2,e)},proto.messages.ClientMessageType={OUTBOUND_MESSAGE:0,INBOUND_MESSAGE:1,RECEIPT:2},proto.messages.CompressionType={COMPRESSION_NONE:0,COMPRESSION_ZLIB:1},i.object.extend(t,proto.messages)},260:function(e,t,r){"use strict";var n=r(24304),i=n,o=Function("return this")();i.exportSymbol("proto.payloads.Message",null,o),i.exportSymbol("proto.payloads.Payload",null,o),i.exportSymbol("proto.payloads.PayloadType",null,o),i.exportSymbol("proto.payloads.TextData",null,o),proto.payloads.Message=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.payloads.Message,n.Message),i.DEBUG&&!COMPILED&&(proto.payloads.Message.displayName="proto.payloads.Message"),proto.payloads.Payload=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.payloads.Payload,n.Message),i.DEBUG&&!COMPILED&&(proto.payloads.Payload.displayName="proto.payloads.Payload"),proto.payloads.TextData=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.payloads.TextData,n.Message),i.DEBUG&&!COMPILED&&(proto.payloads.TextData.displayName="proto.payloads.TextData"),n.Message.GENERATE_TO_OBJECT&&(proto.payloads.Message.prototype.toObject=function(e){return proto.payloads.Message.toObject(e,this)},proto.payloads.Message.toObject=function(e,t){var r={payload:t.getPayload_asB64(),encrypted:n.Message.getFieldWithDefault(t,2,!1),nonce:t.getNonce_asB64(),encryptedKey:t.getEncryptedKey_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.payloads.Message.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.payloads.Message;return proto.payloads.Message.deserializeBinaryFromReader(r,t)},proto.payloads.Message.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setPayload(r);break;case 2:var r=t.readBool();e.setEncrypted(r);break;case 3:var r=t.readBytes();e.setNonce(r);break;case 4:var r=t.readBytes();e.setEncryptedKey(r);break;default:t.skipField()}return e},proto.payloads.Message.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.payloads.Message.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.payloads.Message.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getPayload_asU8()).length>0&&t.writeBytes(1,r),(r=e.getEncrypted())&&t.writeBool(2,r),(r=e.getNonce_asU8()).length>0&&t.writeBytes(3,r),(r=e.getEncryptedKey_asU8()).length>0&&t.writeBytes(4,r)},proto.payloads.Message.prototype.getPayload=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.payloads.Message.prototype.getPayload_asB64=function(){return n.Message.bytesAsB64(this.getPayload())},proto.payloads.Message.prototype.getPayload_asU8=function(){return n.Message.bytesAsU8(this.getPayload())},proto.payloads.Message.prototype.setPayload=function(e){n.Message.setProto3BytesField(this,1,e)},proto.payloads.Message.prototype.getEncrypted=function(){return n.Message.getFieldWithDefault(this,2,!1)},proto.payloads.Message.prototype.setEncrypted=function(e){n.Message.setProto3BooleanField(this,2,e)},proto.payloads.Message.prototype.getNonce=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.payloads.Message.prototype.getNonce_asB64=function(){return n.Message.bytesAsB64(this.getNonce())},proto.payloads.Message.prototype.getNonce_asU8=function(){return n.Message.bytesAsU8(this.getNonce())},proto.payloads.Message.prototype.setNonce=function(e){n.Message.setProto3BytesField(this,3,e)},proto.payloads.Message.prototype.getEncryptedKey=function(){return n.Message.getFieldWithDefault(this,4,"")},proto.payloads.Message.prototype.getEncryptedKey_asB64=function(){return n.Message.bytesAsB64(this.getEncryptedKey())},proto.payloads.Message.prototype.getEncryptedKey_asU8=function(){return n.Message.bytesAsU8(this.getEncryptedKey())},proto.payloads.Message.prototype.setEncryptedKey=function(e){n.Message.setProto3BytesField(this,4,e)},n.Message.GENERATE_TO_OBJECT&&(proto.payloads.Payload.prototype.toObject=function(e){return proto.payloads.Payload.toObject(e,this)},proto.payloads.Payload.toObject=function(e,t){var r={type:n.Message.getFieldWithDefault(t,1,0),messageId:t.getMessageId_asB64(),data:t.getData_asB64(),replyToId:t.getReplyToId_asB64(),noReply:n.Message.getFieldWithDefault(t,5,!1)};return e&&(r.$jspbMessageInstance=t),r}),proto.payloads.Payload.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.payloads.Payload;return proto.payloads.Payload.deserializeBinaryFromReader(r,t)},proto.payloads.Payload.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setType(r);break;case 2:var r=t.readBytes();e.setMessageId(r);break;case 3:var r=t.readBytes();e.setData(r);break;case 4:var r=t.readBytes();e.setReplyToId(r);break;case 5:var r=t.readBool();e.setNoReply(r);break;default:t.skipField()}return e},proto.payloads.Payload.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.payloads.Payload.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.payloads.Payload.serializeBinaryToWriter=function(e,t){var r=void 0;0!==(r=e.getType())&&t.writeEnum(1,r),(r=e.getMessageId_asU8()).length>0&&t.writeBytes(2,r),(r=e.getData_asU8()).length>0&&t.writeBytes(3,r),(r=e.getReplyToId_asU8()).length>0&&t.writeBytes(4,r),(r=e.getNoReply())&&t.writeBool(5,r)},proto.payloads.Payload.prototype.getType=function(){return n.Message.getFieldWithDefault(this,1,0)},proto.payloads.Payload.prototype.setType=function(e){n.Message.setProto3EnumField(this,1,e)},proto.payloads.Payload.prototype.getMessageId=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.payloads.Payload.prototype.getMessageId_asB64=function(){return n.Message.bytesAsB64(this.getMessageId())},proto.payloads.Payload.prototype.getMessageId_asU8=function(){return n.Message.bytesAsU8(this.getMessageId())},proto.payloads.Payload.prototype.setMessageId=function(e){n.Message.setProto3BytesField(this,2,e)},proto.payloads.Payload.prototype.getData=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.payloads.Payload.prototype.getData_asB64=function(){return n.Message.bytesAsB64(this.getData())},proto.payloads.Payload.prototype.getData_asU8=function(){return n.Message.bytesAsU8(this.getData())},proto.payloads.Payload.prototype.setData=function(e){n.Message.setProto3BytesField(this,3,e)},proto.payloads.Payload.prototype.getReplyToId=function(){return n.Message.getFieldWithDefault(this,4,"")},proto.payloads.Payload.prototype.getReplyToId_asB64=function(){return n.Message.bytesAsB64(this.getReplyToId())},proto.payloads.Payload.prototype.getReplyToId_asU8=function(){return n.Message.bytesAsU8(this.getReplyToId())},proto.payloads.Payload.prototype.setReplyToId=function(e){n.Message.setProto3BytesField(this,4,e)},proto.payloads.Payload.prototype.getNoReply=function(){return n.Message.getFieldWithDefault(this,5,!1)},proto.payloads.Payload.prototype.setNoReply=function(e){n.Message.setProto3BooleanField(this,5,e)},n.Message.GENERATE_TO_OBJECT&&(proto.payloads.TextData.prototype.toObject=function(e){return proto.payloads.TextData.toObject(e,this)},proto.payloads.TextData.toObject=function(e,t){var r={text:n.Message.getFieldWithDefault(t,1,"")};return e&&(r.$jspbMessageInstance=t),r}),proto.payloads.TextData.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.payloads.TextData;return proto.payloads.TextData.deserializeBinaryFromReader(r,t)},proto.payloads.TextData.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)if(1===t.getFieldNumber()){var r=t.readString();e.setText(r)}else t.skipField();return e},proto.payloads.TextData.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.payloads.TextData.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.payloads.TextData.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getText()).length>0&&t.writeString(1,r)},proto.payloads.TextData.prototype.getText=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.payloads.TextData.prototype.setText=function(e){n.Message.setProto3StringField(this,1,e)},proto.payloads.PayloadType={BINARY:0,TEXT:1,ACK:2,SESSION:3},i.object.extend(t,proto.payloads)},50817:function(e,t,r){"use strict";var n=r(24304),i=n,o=Function("return this")();i.exportSymbol("proto.sigchain.SigAlgo",null,o),i.exportSymbol("proto.sigchain.SigChain",null,o),i.exportSymbol("proto.sigchain.SigChainElem",null,o),proto.sigchain.SigChainElem=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.sigchain.SigChainElem,n.Message),i.DEBUG&&!COMPILED&&(proto.sigchain.SigChainElem.displayName="proto.sigchain.SigChainElem"),proto.sigchain.SigChain=function(e){n.Message.initialize(this,e,0,-1,proto.sigchain.SigChain.repeatedFields_,null)},i.inherits(proto.sigchain.SigChain,n.Message),i.DEBUG&&!COMPILED&&(proto.sigchain.SigChain.displayName="proto.sigchain.SigChain"),n.Message.GENERATE_TO_OBJECT&&(proto.sigchain.SigChainElem.prototype.toObject=function(e){return proto.sigchain.SigChainElem.toObject(e,this)},proto.sigchain.SigChainElem.toObject=function(e,t){var r={id:t.getId_asB64(),nextPubkey:t.getNextPubkey_asB64(),mining:n.Message.getFieldWithDefault(t,3,!1),signature:t.getSignature_asB64(),sigAlgo:n.Message.getFieldWithDefault(t,5,0),vrf:t.getVrf_asB64(),proof:t.getProof_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.sigchain.SigChainElem.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.sigchain.SigChainElem;return proto.sigchain.SigChainElem.deserializeBinaryFromReader(r,t)},proto.sigchain.SigChainElem.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setId(r);break;case 2:var r=t.readBytes();e.setNextPubkey(r);break;case 3:var r=t.readBool();e.setMining(r);break;case 4:var r=t.readBytes();e.setSignature(r);break;case 5:var r=t.readEnum();e.setSigAlgo(r);break;case 6:var r=t.readBytes();e.setVrf(r);break;case 7:var r=t.readBytes();e.setProof(r);break;default:t.skipField()}return e},proto.sigchain.SigChainElem.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.sigchain.SigChainElem.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.sigchain.SigChainElem.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getId_asU8()).length>0&&t.writeBytes(1,r),(r=e.getNextPubkey_asU8()).length>0&&t.writeBytes(2,r),(r=e.getMining())&&t.writeBool(3,r),(r=e.getSignature_asU8()).length>0&&t.writeBytes(4,r),0!==(r=e.getSigAlgo())&&t.writeEnum(5,r),(r=e.getVrf_asU8()).length>0&&t.writeBytes(6,r),(r=e.getProof_asU8()).length>0&&t.writeBytes(7,r)},proto.sigchain.SigChainElem.prototype.getId=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.sigchain.SigChainElem.prototype.getId_asB64=function(){return n.Message.bytesAsB64(this.getId())},proto.sigchain.SigChainElem.prototype.getId_asU8=function(){return n.Message.bytesAsU8(this.getId())},proto.sigchain.SigChainElem.prototype.setId=function(e){n.Message.setProto3BytesField(this,1,e)},proto.sigchain.SigChainElem.prototype.getNextPubkey=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.sigchain.SigChainElem.prototype.getNextPubkey_asB64=function(){return n.Message.bytesAsB64(this.getNextPubkey())},proto.sigchain.SigChainElem.prototype.getNextPubkey_asU8=function(){return n.Message.bytesAsU8(this.getNextPubkey())},proto.sigchain.SigChainElem.prototype.setNextPubkey=function(e){n.Message.setProto3BytesField(this,2,e)},proto.sigchain.SigChainElem.prototype.getMining=function(){return n.Message.getFieldWithDefault(this,3,!1)},proto.sigchain.SigChainElem.prototype.setMining=function(e){n.Message.setProto3BooleanField(this,3,e)},proto.sigchain.SigChainElem.prototype.getSignature=function(){return n.Message.getFieldWithDefault(this,4,"")},proto.sigchain.SigChainElem.prototype.getSignature_asB64=function(){return n.Message.bytesAsB64(this.getSignature())},proto.sigchain.SigChainElem.prototype.getSignature_asU8=function(){return n.Message.bytesAsU8(this.getSignature())},proto.sigchain.SigChainElem.prototype.setSignature=function(e){n.Message.setProto3BytesField(this,4,e)},proto.sigchain.SigChainElem.prototype.getSigAlgo=function(){return n.Message.getFieldWithDefault(this,5,0)},proto.sigchain.SigChainElem.prototype.setSigAlgo=function(e){n.Message.setProto3EnumField(this,5,e)},proto.sigchain.SigChainElem.prototype.getVrf=function(){return n.Message.getFieldWithDefault(this,6,"")},proto.sigchain.SigChainElem.prototype.getVrf_asB64=function(){return n.Message.bytesAsB64(this.getVrf())},proto.sigchain.SigChainElem.prototype.getVrf_asU8=function(){return n.Message.bytesAsU8(this.getVrf())},proto.sigchain.SigChainElem.prototype.setVrf=function(e){n.Message.setProto3BytesField(this,6,e)},proto.sigchain.SigChainElem.prototype.getProof=function(){return n.Message.getFieldWithDefault(this,7,"")},proto.sigchain.SigChainElem.prototype.getProof_asB64=function(){return n.Message.bytesAsB64(this.getProof())},proto.sigchain.SigChainElem.prototype.getProof_asU8=function(){return n.Message.bytesAsU8(this.getProof())},proto.sigchain.SigChainElem.prototype.setProof=function(e){n.Message.setProto3BytesField(this,7,e)},proto.sigchain.SigChain.repeatedFields_=[8],n.Message.GENERATE_TO_OBJECT&&(proto.sigchain.SigChain.prototype.toObject=function(e){return proto.sigchain.SigChain.toObject(e,this)},proto.sigchain.SigChain.toObject=function(e,t){var r={nonce:n.Message.getFieldWithDefault(t,1,0),dataSize:n.Message.getFieldWithDefault(t,2,0),blockHash:t.getBlockHash_asB64(),srcId:t.getSrcId_asB64(),srcPubkey:t.getSrcPubkey_asB64(),destId:t.getDestId_asB64(),destPubkey:t.getDestPubkey_asB64(),elemsList:n.Message.toObjectList(t.getElemsList(),proto.sigchain.SigChainElem.toObject,e)};return e&&(r.$jspbMessageInstance=t),r}),proto.sigchain.SigChain.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.sigchain.SigChain;return proto.sigchain.SigChain.deserializeBinaryFromReader(r,t)},proto.sigchain.SigChain.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readUint32();e.setNonce(r);break;case 2:var r=t.readUint32();e.setDataSize(r);break;case 3:var r=t.readBytes();e.setBlockHash(r);break;case 4:var r=t.readBytes();e.setSrcId(r);break;case 5:var r=t.readBytes();e.setSrcPubkey(r);break;case 6:var r=t.readBytes();e.setDestId(r);break;case 7:var r=t.readBytes();e.setDestPubkey(r);break;case 8:var r=new proto.sigchain.SigChainElem;t.readMessage(r,proto.sigchain.SigChainElem.deserializeBinaryFromReader),e.addElems(r);break;default:t.skipField()}return e},proto.sigchain.SigChain.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.sigchain.SigChain.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.sigchain.SigChain.serializeBinaryToWriter=function(e,t){var r=void 0;0!==(r=e.getNonce())&&t.writeUint32(1,r),0!==(r=e.getDataSize())&&t.writeUint32(2,r),(r=e.getBlockHash_asU8()).length>0&&t.writeBytes(3,r),(r=e.getSrcId_asU8()).length>0&&t.writeBytes(4,r),(r=e.getSrcPubkey_asU8()).length>0&&t.writeBytes(5,r),(r=e.getDestId_asU8()).length>0&&t.writeBytes(6,r),(r=e.getDestPubkey_asU8()).length>0&&t.writeBytes(7,r),(r=e.getElemsList()).length>0&&t.writeRepeatedMessage(8,r,proto.sigchain.SigChainElem.serializeBinaryToWriter)},proto.sigchain.SigChain.prototype.getNonce=function(){return n.Message.getFieldWithDefault(this,1,0)},proto.sigchain.SigChain.prototype.setNonce=function(e){n.Message.setProto3IntField(this,1,e)},proto.sigchain.SigChain.prototype.getDataSize=function(){return n.Message.getFieldWithDefault(this,2,0)},proto.sigchain.SigChain.prototype.setDataSize=function(e){n.Message.setProto3IntField(this,2,e)},proto.sigchain.SigChain.prototype.getBlockHash=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.sigchain.SigChain.prototype.getBlockHash_asB64=function(){return n.Message.bytesAsB64(this.getBlockHash())},proto.sigchain.SigChain.prototype.getBlockHash_asU8=function(){return n.Message.bytesAsU8(this.getBlockHash())},proto.sigchain.SigChain.prototype.setBlockHash=function(e){n.Message.setProto3BytesField(this,3,e)},proto.sigchain.SigChain.prototype.getSrcId=function(){return n.Message.getFieldWithDefault(this,4,"")},proto.sigchain.SigChain.prototype.getSrcId_asB64=function(){return n.Message.bytesAsB64(this.getSrcId())},proto.sigchain.SigChain.prototype.getSrcId_asU8=function(){return n.Message.bytesAsU8(this.getSrcId())},proto.sigchain.SigChain.prototype.setSrcId=function(e){n.Message.setProto3BytesField(this,4,e)},proto.sigchain.SigChain.prototype.getSrcPubkey=function(){return n.Message.getFieldWithDefault(this,5,"")},proto.sigchain.SigChain.prototype.getSrcPubkey_asB64=function(){return n.Message.bytesAsB64(this.getSrcPubkey())},proto.sigchain.SigChain.prototype.getSrcPubkey_asU8=function(){return n.Message.bytesAsU8(this.getSrcPubkey())},proto.sigchain.SigChain.prototype.setSrcPubkey=function(e){n.Message.setProto3BytesField(this,5,e)},proto.sigchain.SigChain.prototype.getDestId=function(){return n.Message.getFieldWithDefault(this,6,"")},proto.sigchain.SigChain.prototype.getDestId_asB64=function(){return n.Message.bytesAsB64(this.getDestId())},proto.sigchain.SigChain.prototype.getDestId_asU8=function(){return n.Message.bytesAsU8(this.getDestId())},proto.sigchain.SigChain.prototype.setDestId=function(e){n.Message.setProto3BytesField(this,6,e)},proto.sigchain.SigChain.prototype.getDestPubkey=function(){return n.Message.getFieldWithDefault(this,7,"")},proto.sigchain.SigChain.prototype.getDestPubkey_asB64=function(){return n.Message.bytesAsB64(this.getDestPubkey())},proto.sigchain.SigChain.prototype.getDestPubkey_asU8=function(){return n.Message.bytesAsU8(this.getDestPubkey())},proto.sigchain.SigChain.prototype.setDestPubkey=function(e){n.Message.setProto3BytesField(this,7,e)},proto.sigchain.SigChain.prototype.getElemsList=function(){return n.Message.getRepeatedWrapperField(this,proto.sigchain.SigChainElem,8)},proto.sigchain.SigChain.prototype.setElemsList=function(e){n.Message.setRepeatedWrapperField(this,8,e)},proto.sigchain.SigChain.prototype.addElems=function(e,t){return n.Message.addToRepeatedWrapperField(this,8,e,proto.sigchain.SigChainElem,t)},proto.sigchain.SigChain.prototype.clearElemsList=function(){this.setElemsList([])},proto.sigchain.SigAlgo={SIGNATURE:0,VRF:1},i.object.extend(t,proto.sigchain)},96946:function(e,t,r){"use strict";var n=r(24304),i=n,o=Function("return this")();i.exportSymbol("proto.transaction.Coinbase",null,o),i.exportSymbol("proto.transaction.DeleteName",null,o),i.exportSymbol("proto.transaction.GenerateID",null,o),i.exportSymbol("proto.transaction.IssueAsset",null,o),i.exportSymbol("proto.transaction.NanoPay",null,o),i.exportSymbol("proto.transaction.Payload",null,o),i.exportSymbol("proto.transaction.PayloadType",null,o),i.exportSymbol("proto.transaction.Program",null,o),i.exportSymbol("proto.transaction.RegisterName",null,o),i.exportSymbol("proto.transaction.SigChainTxn",null,o),i.exportSymbol("proto.transaction.Subscribe",null,o),i.exportSymbol("proto.transaction.Transaction",null,o),i.exportSymbol("proto.transaction.TransferAsset",null,o),i.exportSymbol("proto.transaction.TransferName",null,o),i.exportSymbol("proto.transaction.UnsignedTx",null,o),i.exportSymbol("proto.transaction.Unsubscribe",null,o),proto.transaction.UnsignedTx=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.UnsignedTx,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.UnsignedTx.displayName="proto.transaction.UnsignedTx"),proto.transaction.Transaction=function(e){n.Message.initialize(this,e,0,-1,proto.transaction.Transaction.repeatedFields_,null)},i.inherits(proto.transaction.Transaction,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.Transaction.displayName="proto.transaction.Transaction"),proto.transaction.Program=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.Program,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.Program.displayName="proto.transaction.Program"),proto.transaction.Payload=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.Payload,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.Payload.displayName="proto.transaction.Payload"),proto.transaction.Coinbase=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.Coinbase,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.Coinbase.displayName="proto.transaction.Coinbase"),proto.transaction.SigChainTxn=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.SigChainTxn,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.SigChainTxn.displayName="proto.transaction.SigChainTxn"),proto.transaction.RegisterName=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.RegisterName,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.RegisterName.displayName="proto.transaction.RegisterName"),proto.transaction.TransferName=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.TransferName,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.TransferName.displayName="proto.transaction.TransferName"),proto.transaction.DeleteName=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.DeleteName,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.DeleteName.displayName="proto.transaction.DeleteName"),proto.transaction.Subscribe=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.Subscribe,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.Subscribe.displayName="proto.transaction.Subscribe"),proto.transaction.Unsubscribe=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.Unsubscribe,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.Unsubscribe.displayName="proto.transaction.Unsubscribe"),proto.transaction.TransferAsset=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.TransferAsset,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.TransferAsset.displayName="proto.transaction.TransferAsset"),proto.transaction.GenerateID=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.GenerateID,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.GenerateID.displayName="proto.transaction.GenerateID"),proto.transaction.NanoPay=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.NanoPay,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.NanoPay.displayName="proto.transaction.NanoPay"),proto.transaction.IssueAsset=function(e){n.Message.initialize(this,e,0,-1,null,null)},i.inherits(proto.transaction.IssueAsset,n.Message),i.DEBUG&&!COMPILED&&(proto.transaction.IssueAsset.displayName="proto.transaction.IssueAsset"),n.Message.GENERATE_TO_OBJECT&&(proto.transaction.UnsignedTx.prototype.toObject=function(e){return proto.transaction.UnsignedTx.toObject(e,this)},proto.transaction.UnsignedTx.toObject=function(e,t){var r,i={payload:(r=t.getPayload())&&proto.transaction.Payload.toObject(e,r),nonce:n.Message.getFieldWithDefault(t,2,0),fee:n.Message.getFieldWithDefault(t,3,0),attributes:t.getAttributes_asB64()};return e&&(i.$jspbMessageInstance=t),i}),proto.transaction.UnsignedTx.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.UnsignedTx;return proto.transaction.UnsignedTx.deserializeBinaryFromReader(r,t)},proto.transaction.UnsignedTx.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=new proto.transaction.Payload;t.readMessage(r,proto.transaction.Payload.deserializeBinaryFromReader),e.setPayload(r);break;case 2:var r=t.readUint64();e.setNonce(r);break;case 3:var r=t.readInt64();e.setFee(r);break;case 4:var r=t.readBytes();e.setAttributes(r);break;default:t.skipField()}return e},proto.transaction.UnsignedTx.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.UnsignedTx.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.UnsignedTx.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getPayload())&&t.writeMessage(1,r,proto.transaction.Payload.serializeBinaryToWriter),0!==(r=e.getNonce())&&t.writeUint64(2,r),0!==(r=e.getFee())&&t.writeInt64(3,r),(r=e.getAttributes_asU8()).length>0&&t.writeBytes(4,r)},proto.transaction.UnsignedTx.prototype.getPayload=function(){return n.Message.getWrapperField(this,proto.transaction.Payload,1)},proto.transaction.UnsignedTx.prototype.setPayload=function(e){n.Message.setWrapperField(this,1,e)},proto.transaction.UnsignedTx.prototype.clearPayload=function(){this.setPayload(void 0)},proto.transaction.UnsignedTx.prototype.hasPayload=function(){return null!=n.Message.getField(this,1)},proto.transaction.UnsignedTx.prototype.getNonce=function(){return n.Message.getFieldWithDefault(this,2,0)},proto.transaction.UnsignedTx.prototype.setNonce=function(e){n.Message.setProto3IntField(this,2,e)},proto.transaction.UnsignedTx.prototype.getFee=function(){return n.Message.getFieldWithDefault(this,3,0)},proto.transaction.UnsignedTx.prototype.setFee=function(e){n.Message.setProto3IntField(this,3,e)},proto.transaction.UnsignedTx.prototype.getAttributes=function(){return n.Message.getFieldWithDefault(this,4,"")},proto.transaction.UnsignedTx.prototype.getAttributes_asB64=function(){return n.Message.bytesAsB64(this.getAttributes())},proto.transaction.UnsignedTx.prototype.getAttributes_asU8=function(){return n.Message.bytesAsU8(this.getAttributes())},proto.transaction.UnsignedTx.prototype.setAttributes=function(e){n.Message.setProto3BytesField(this,4,e)},proto.transaction.Transaction.repeatedFields_=[2],n.Message.GENERATE_TO_OBJECT&&(proto.transaction.Transaction.prototype.toObject=function(e){return proto.transaction.Transaction.toObject(e,this)},proto.transaction.Transaction.toObject=function(e,t){var r,i={unsignedTx:(r=t.getUnsignedTx())&&proto.transaction.UnsignedTx.toObject(e,r),programsList:n.Message.toObjectList(t.getProgramsList(),proto.transaction.Program.toObject,e)};return e&&(i.$jspbMessageInstance=t),i}),proto.transaction.Transaction.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.Transaction;return proto.transaction.Transaction.deserializeBinaryFromReader(r,t)},proto.transaction.Transaction.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=new proto.transaction.UnsignedTx;t.readMessage(r,proto.transaction.UnsignedTx.deserializeBinaryFromReader),e.setUnsignedTx(r);break;case 2:var r=new proto.transaction.Program;t.readMessage(r,proto.transaction.Program.deserializeBinaryFromReader),e.addPrograms(r);break;default:t.skipField()}return e},proto.transaction.Transaction.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.Transaction.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.Transaction.serializeBinaryToWriter=function(e,t){var r=void 0;null!=(r=e.getUnsignedTx())&&t.writeMessage(1,r,proto.transaction.UnsignedTx.serializeBinaryToWriter),(r=e.getProgramsList()).length>0&&t.writeRepeatedMessage(2,r,proto.transaction.Program.serializeBinaryToWriter)},proto.transaction.Transaction.prototype.getUnsignedTx=function(){return n.Message.getWrapperField(this,proto.transaction.UnsignedTx,1)},proto.transaction.Transaction.prototype.setUnsignedTx=function(e){n.Message.setWrapperField(this,1,e)},proto.transaction.Transaction.prototype.clearUnsignedTx=function(){this.setUnsignedTx(void 0)},proto.transaction.Transaction.prototype.hasUnsignedTx=function(){return null!=n.Message.getField(this,1)},proto.transaction.Transaction.prototype.getProgramsList=function(){return n.Message.getRepeatedWrapperField(this,proto.transaction.Program,2)},proto.transaction.Transaction.prototype.setProgramsList=function(e){n.Message.setRepeatedWrapperField(this,2,e)},proto.transaction.Transaction.prototype.addPrograms=function(e,t){return n.Message.addToRepeatedWrapperField(this,2,e,proto.transaction.Program,t)},proto.transaction.Transaction.prototype.clearProgramsList=function(){this.setProgramsList([])},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.Program.prototype.toObject=function(e){return proto.transaction.Program.toObject(e,this)},proto.transaction.Program.toObject=function(e,t){var r={code:t.getCode_asB64(),parameter:t.getParameter_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.Program.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.Program;return proto.transaction.Program.deserializeBinaryFromReader(r,t)},proto.transaction.Program.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setCode(r);break;case 2:var r=t.readBytes();e.setParameter(r);break;default:t.skipField()}return e},proto.transaction.Program.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.Program.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.Program.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getCode_asU8()).length>0&&t.writeBytes(1,r),(r=e.getParameter_asU8()).length>0&&t.writeBytes(2,r)},proto.transaction.Program.prototype.getCode=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.Program.prototype.getCode_asB64=function(){return n.Message.bytesAsB64(this.getCode())},proto.transaction.Program.prototype.getCode_asU8=function(){return n.Message.bytesAsU8(this.getCode())},proto.transaction.Program.prototype.setCode=function(e){n.Message.setProto3BytesField(this,1,e)},proto.transaction.Program.prototype.getParameter=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.Program.prototype.getParameter_asB64=function(){return n.Message.bytesAsB64(this.getParameter())},proto.transaction.Program.prototype.getParameter_asU8=function(){return n.Message.bytesAsU8(this.getParameter())},proto.transaction.Program.prototype.setParameter=function(e){n.Message.setProto3BytesField(this,2,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.Payload.prototype.toObject=function(e){return proto.transaction.Payload.toObject(e,this)},proto.transaction.Payload.toObject=function(e,t){var r={type:n.Message.getFieldWithDefault(t,1,0),data:t.getData_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.Payload.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.Payload;return proto.transaction.Payload.deserializeBinaryFromReader(r,t)},proto.transaction.Payload.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readEnum();e.setType(r);break;case 2:var r=t.readBytes();e.setData(r);break;default:t.skipField()}return e},proto.transaction.Payload.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.Payload.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.Payload.serializeBinaryToWriter=function(e,t){var r=void 0;0!==(r=e.getType())&&t.writeEnum(1,r),(r=e.getData_asU8()).length>0&&t.writeBytes(2,r)},proto.transaction.Payload.prototype.getType=function(){return n.Message.getFieldWithDefault(this,1,0)},proto.transaction.Payload.prototype.setType=function(e){n.Message.setProto3EnumField(this,1,e)},proto.transaction.Payload.prototype.getData=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.Payload.prototype.getData_asB64=function(){return n.Message.bytesAsB64(this.getData())},proto.transaction.Payload.prototype.getData_asU8=function(){return n.Message.bytesAsU8(this.getData())},proto.transaction.Payload.prototype.setData=function(e){n.Message.setProto3BytesField(this,2,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.Coinbase.prototype.toObject=function(e){return proto.transaction.Coinbase.toObject(e,this)},proto.transaction.Coinbase.toObject=function(e,t){var r={sender:t.getSender_asB64(),recipient:t.getRecipient_asB64(),amount:n.Message.getFieldWithDefault(t,3,0)};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.Coinbase.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.Coinbase;return proto.transaction.Coinbase.deserializeBinaryFromReader(r,t)},proto.transaction.Coinbase.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setSender(r);break;case 2:var r=t.readBytes();e.setRecipient(r);break;case 3:var r=t.readInt64();e.setAmount(r);break;default:t.skipField()}return e},proto.transaction.Coinbase.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.Coinbase.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.Coinbase.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getSender_asU8()).length>0&&t.writeBytes(1,r),(r=e.getRecipient_asU8()).length>0&&t.writeBytes(2,r),0!==(r=e.getAmount())&&t.writeInt64(3,r)},proto.transaction.Coinbase.prototype.getSender=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.Coinbase.prototype.getSender_asB64=function(){return n.Message.bytesAsB64(this.getSender())},proto.transaction.Coinbase.prototype.getSender_asU8=function(){return n.Message.bytesAsU8(this.getSender())},proto.transaction.Coinbase.prototype.setSender=function(e){n.Message.setProto3BytesField(this,1,e)},proto.transaction.Coinbase.prototype.getRecipient=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.Coinbase.prototype.getRecipient_asB64=function(){return n.Message.bytesAsB64(this.getRecipient())},proto.transaction.Coinbase.prototype.getRecipient_asU8=function(){return n.Message.bytesAsU8(this.getRecipient())},proto.transaction.Coinbase.prototype.setRecipient=function(e){n.Message.setProto3BytesField(this,2,e)},proto.transaction.Coinbase.prototype.getAmount=function(){return n.Message.getFieldWithDefault(this,3,0)},proto.transaction.Coinbase.prototype.setAmount=function(e){n.Message.setProto3IntField(this,3,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.SigChainTxn.prototype.toObject=function(e){return proto.transaction.SigChainTxn.toObject(e,this)},proto.transaction.SigChainTxn.toObject=function(e,t){var r={sigChain:t.getSigChain_asB64(),submitter:t.getSubmitter_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.SigChainTxn.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.SigChainTxn;return proto.transaction.SigChainTxn.deserializeBinaryFromReader(r,t)},proto.transaction.SigChainTxn.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setSigChain(r);break;case 2:var r=t.readBytes();e.setSubmitter(r);break;default:t.skipField()}return e},proto.transaction.SigChainTxn.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.SigChainTxn.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.SigChainTxn.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getSigChain_asU8()).length>0&&t.writeBytes(1,r),(r=e.getSubmitter_asU8()).length>0&&t.writeBytes(2,r)},proto.transaction.SigChainTxn.prototype.getSigChain=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.SigChainTxn.prototype.getSigChain_asB64=function(){return n.Message.bytesAsB64(this.getSigChain())},proto.transaction.SigChainTxn.prototype.getSigChain_asU8=function(){return n.Message.bytesAsU8(this.getSigChain())},proto.transaction.SigChainTxn.prototype.setSigChain=function(e){n.Message.setProto3BytesField(this,1,e)},proto.transaction.SigChainTxn.prototype.getSubmitter=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.SigChainTxn.prototype.getSubmitter_asB64=function(){return n.Message.bytesAsB64(this.getSubmitter())},proto.transaction.SigChainTxn.prototype.getSubmitter_asU8=function(){return n.Message.bytesAsU8(this.getSubmitter())},proto.transaction.SigChainTxn.prototype.setSubmitter=function(e){n.Message.setProto3BytesField(this,2,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.RegisterName.prototype.toObject=function(e){return proto.transaction.RegisterName.toObject(e,this)},proto.transaction.RegisterName.toObject=function(e,t){var r={registrant:t.getRegistrant_asB64(),name:n.Message.getFieldWithDefault(t,2,""),registrationFee:n.Message.getFieldWithDefault(t,3,0)};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.RegisterName.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.RegisterName;return proto.transaction.RegisterName.deserializeBinaryFromReader(r,t)},proto.transaction.RegisterName.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setRegistrant(r);break;case 2:var r=t.readString();e.setName(r);break;case 3:var r=t.readInt64();e.setRegistrationFee(r);break;default:t.skipField()}return e},proto.transaction.RegisterName.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.RegisterName.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.RegisterName.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getRegistrant_asU8()).length>0&&t.writeBytes(1,r),(r=e.getName()).length>0&&t.writeString(2,r),0!==(r=e.getRegistrationFee())&&t.writeInt64(3,r)},proto.transaction.RegisterName.prototype.getRegistrant=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.RegisterName.prototype.getRegistrant_asB64=function(){return n.Message.bytesAsB64(this.getRegistrant())},proto.transaction.RegisterName.prototype.getRegistrant_asU8=function(){return n.Message.bytesAsU8(this.getRegistrant())},proto.transaction.RegisterName.prototype.setRegistrant=function(e){n.Message.setProto3BytesField(this,1,e)},proto.transaction.RegisterName.prototype.getName=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.RegisterName.prototype.setName=function(e){n.Message.setProto3StringField(this,2,e)},proto.transaction.RegisterName.prototype.getRegistrationFee=function(){return n.Message.getFieldWithDefault(this,3,0)},proto.transaction.RegisterName.prototype.setRegistrationFee=function(e){n.Message.setProto3IntField(this,3,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.TransferName.prototype.toObject=function(e){return proto.transaction.TransferName.toObject(e,this)},proto.transaction.TransferName.toObject=function(e,t){var r={name:n.Message.getFieldWithDefault(t,1,""),registrant:t.getRegistrant_asB64(),recipient:t.getRecipient_asB64()};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.TransferName.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.TransferName;return proto.transaction.TransferName.deserializeBinaryFromReader(r,t)},proto.transaction.TransferName.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readString();e.setName(r);break;case 2:var r=t.readBytes();e.setRegistrant(r);break;case 3:var r=t.readBytes();e.setRecipient(r);break;default:t.skipField()}return e},proto.transaction.TransferName.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.TransferName.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.TransferName.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getName()).length>0&&t.writeString(1,r),(r=e.getRegistrant_asU8()).length>0&&t.writeBytes(2,r),(r=e.getRecipient_asU8()).length>0&&t.writeBytes(3,r)},proto.transaction.TransferName.prototype.getName=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.TransferName.prototype.setName=function(e){n.Message.setProto3StringField(this,1,e)},proto.transaction.TransferName.prototype.getRegistrant=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.TransferName.prototype.getRegistrant_asB64=function(){return n.Message.bytesAsB64(this.getRegistrant())},proto.transaction.TransferName.prototype.getRegistrant_asU8=function(){return n.Message.bytesAsU8(this.getRegistrant())},proto.transaction.TransferName.prototype.setRegistrant=function(e){n.Message.setProto3BytesField(this,2,e)},proto.transaction.TransferName.prototype.getRecipient=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.transaction.TransferName.prototype.getRecipient_asB64=function(){return n.Message.bytesAsB64(this.getRecipient())},proto.transaction.TransferName.prototype.getRecipient_asU8=function(){return n.Message.bytesAsU8(this.getRecipient())},proto.transaction.TransferName.prototype.setRecipient=function(e){n.Message.setProto3BytesField(this,3,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.DeleteName.prototype.toObject=function(e){return proto.transaction.DeleteName.toObject(e,this)},proto.transaction.DeleteName.toObject=function(e,t){var r={registrant:t.getRegistrant_asB64(),name:n.Message.getFieldWithDefault(t,2,"")};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.DeleteName.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.DeleteName;return proto.transaction.DeleteName.deserializeBinaryFromReader(r,t)},proto.transaction.DeleteName.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setRegistrant(r);break;case 2:var r=t.readString();e.setName(r);break;default:t.skipField()}return e},proto.transaction.DeleteName.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.DeleteName.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.DeleteName.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getRegistrant_asU8()).length>0&&t.writeBytes(1,r),(r=e.getName()).length>0&&t.writeString(2,r)},proto.transaction.DeleteName.prototype.getRegistrant=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.DeleteName.prototype.getRegistrant_asB64=function(){return n.Message.bytesAsB64(this.getRegistrant())},proto.transaction.DeleteName.prototype.getRegistrant_asU8=function(){return n.Message.bytesAsU8(this.getRegistrant())},proto.transaction.DeleteName.prototype.setRegistrant=function(e){n.Message.setProto3BytesField(this,1,e)},proto.transaction.DeleteName.prototype.getName=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.DeleteName.prototype.setName=function(e){n.Message.setProto3StringField(this,2,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.Subscribe.prototype.toObject=function(e){return proto.transaction.Subscribe.toObject(e,this)},proto.transaction.Subscribe.toObject=function(e,t){var r={subscriber:t.getSubscriber_asB64(),identifier:n.Message.getFieldWithDefault(t,2,""),topic:n.Message.getFieldWithDefault(t,3,""),bucket:n.Message.getFieldWithDefault(t,4,0),duration:n.Message.getFieldWithDefault(t,5,0),meta:n.Message.getFieldWithDefault(t,6,"")};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.Subscribe.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.Subscribe;return proto.transaction.Subscribe.deserializeBinaryFromReader(r,t)},proto.transaction.Subscribe.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setSubscriber(r);break;case 2:var r=t.readString();e.setIdentifier(r);break;case 3:var r=t.readString();e.setTopic(r);break;case 4:var r=t.readUint32();e.setBucket(r);break;case 5:var r=t.readUint32();e.setDuration(r);break;case 6:var r=t.readString();e.setMeta(r);break;default:t.skipField()}return e},proto.transaction.Subscribe.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.Subscribe.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.Subscribe.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getSubscriber_asU8()).length>0&&t.writeBytes(1,r),(r=e.getIdentifier()).length>0&&t.writeString(2,r),(r=e.getTopic()).length>0&&t.writeString(3,r),0!==(r=e.getBucket())&&t.writeUint32(4,r),0!==(r=e.getDuration())&&t.writeUint32(5,r),(r=e.getMeta()).length>0&&t.writeString(6,r)},proto.transaction.Subscribe.prototype.getSubscriber=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.Subscribe.prototype.getSubscriber_asB64=function(){return n.Message.bytesAsB64(this.getSubscriber())},proto.transaction.Subscribe.prototype.getSubscriber_asU8=function(){return n.Message.bytesAsU8(this.getSubscriber())},proto.transaction.Subscribe.prototype.setSubscriber=function(e){n.Message.setProto3BytesField(this,1,e)},proto.transaction.Subscribe.prototype.getIdentifier=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.Subscribe.prototype.setIdentifier=function(e){n.Message.setProto3StringField(this,2,e)},proto.transaction.Subscribe.prototype.getTopic=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.transaction.Subscribe.prototype.setTopic=function(e){n.Message.setProto3StringField(this,3,e)},proto.transaction.Subscribe.prototype.getBucket=function(){return n.Message.getFieldWithDefault(this,4,0)},proto.transaction.Subscribe.prototype.setBucket=function(e){n.Message.setProto3IntField(this,4,e)},proto.transaction.Subscribe.prototype.getDuration=function(){return n.Message.getFieldWithDefault(this,5,0)},proto.transaction.Subscribe.prototype.setDuration=function(e){n.Message.setProto3IntField(this,5,e)},proto.transaction.Subscribe.prototype.getMeta=function(){return n.Message.getFieldWithDefault(this,6,"")},proto.transaction.Subscribe.prototype.setMeta=function(e){n.Message.setProto3StringField(this,6,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.Unsubscribe.prototype.toObject=function(e){return proto.transaction.Unsubscribe.toObject(e,this)},proto.transaction.Unsubscribe.toObject=function(e,t){var r={subscriber:t.getSubscriber_asB64(),identifier:n.Message.getFieldWithDefault(t,2,""),topic:n.Message.getFieldWithDefault(t,3,"")};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.Unsubscribe.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.Unsubscribe;return proto.transaction.Unsubscribe.deserializeBinaryFromReader(r,t)},proto.transaction.Unsubscribe.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setSubscriber(r);break;case 2:var r=t.readString();e.setIdentifier(r);break;case 3:var r=t.readString();e.setTopic(r);break;default:t.skipField()}return e},proto.transaction.Unsubscribe.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.Unsubscribe.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.Unsubscribe.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getSubscriber_asU8()).length>0&&t.writeBytes(1,r),(r=e.getIdentifier()).length>0&&t.writeString(2,r),(r=e.getTopic()).length>0&&t.writeString(3,r)},proto.transaction.Unsubscribe.prototype.getSubscriber=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.Unsubscribe.prototype.getSubscriber_asB64=function(){return n.Message.bytesAsB64(this.getSubscriber())},proto.transaction.Unsubscribe.prototype.getSubscriber_asU8=function(){return n.Message.bytesAsU8(this.getSubscriber())},proto.transaction.Unsubscribe.prototype.setSubscriber=function(e){n.Message.setProto3BytesField(this,1,e)},proto.transaction.Unsubscribe.prototype.getIdentifier=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.Unsubscribe.prototype.setIdentifier=function(e){n.Message.setProto3StringField(this,2,e)},proto.transaction.Unsubscribe.prototype.getTopic=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.transaction.Unsubscribe.prototype.setTopic=function(e){n.Message.setProto3StringField(this,3,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.TransferAsset.prototype.toObject=function(e){return proto.transaction.TransferAsset.toObject(e,this)},proto.transaction.TransferAsset.toObject=function(e,t){var r={sender:t.getSender_asB64(),recipient:t.getRecipient_asB64(),amount:n.Message.getFieldWithDefault(t,3,0)};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.TransferAsset.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.TransferAsset;return proto.transaction.TransferAsset.deserializeBinaryFromReader(r,t)},proto.transaction.TransferAsset.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setSender(r);break;case 2:var r=t.readBytes();e.setRecipient(r);break;case 3:var r=t.readInt64();e.setAmount(r);break;default:t.skipField()}return e},proto.transaction.TransferAsset.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.TransferAsset.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.TransferAsset.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getSender_asU8()).length>0&&t.writeBytes(1,r),(r=e.getRecipient_asU8()).length>0&&t.writeBytes(2,r),0!==(r=e.getAmount())&&t.writeInt64(3,r)},proto.transaction.TransferAsset.prototype.getSender=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.TransferAsset.prototype.getSender_asB64=function(){return n.Message.bytesAsB64(this.getSender())},proto.transaction.TransferAsset.prototype.getSender_asU8=function(){return n.Message.bytesAsU8(this.getSender())},proto.transaction.TransferAsset.prototype.setSender=function(e){n.Message.setProto3BytesField(this,1,e)},proto.transaction.TransferAsset.prototype.getRecipient=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.TransferAsset.prototype.getRecipient_asB64=function(){return n.Message.bytesAsB64(this.getRecipient())},proto.transaction.TransferAsset.prototype.getRecipient_asU8=function(){return n.Message.bytesAsU8(this.getRecipient())},proto.transaction.TransferAsset.prototype.setRecipient=function(e){n.Message.setProto3BytesField(this,2,e)},proto.transaction.TransferAsset.prototype.getAmount=function(){return n.Message.getFieldWithDefault(this,3,0)},proto.transaction.TransferAsset.prototype.setAmount=function(e){n.Message.setProto3IntField(this,3,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.GenerateID.prototype.toObject=function(e){return proto.transaction.GenerateID.toObject(e,this)},proto.transaction.GenerateID.toObject=function(e,t){var r={publicKey:t.getPublicKey_asB64(),registrationFee:n.Message.getFieldWithDefault(t,2,0)};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.GenerateID.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.GenerateID;return proto.transaction.GenerateID.deserializeBinaryFromReader(r,t)},proto.transaction.GenerateID.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setPublicKey(r);break;case 2:var r=t.readInt64();e.setRegistrationFee(r);break;default:t.skipField()}return e},proto.transaction.GenerateID.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.GenerateID.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.GenerateID.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getPublicKey_asU8()).length>0&&t.writeBytes(1,r),0!==(r=e.getRegistrationFee())&&t.writeInt64(2,r)},proto.transaction.GenerateID.prototype.getPublicKey=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.GenerateID.prototype.getPublicKey_asB64=function(){return n.Message.bytesAsB64(this.getPublicKey())},proto.transaction.GenerateID.prototype.getPublicKey_asU8=function(){return n.Message.bytesAsU8(this.getPublicKey())},proto.transaction.GenerateID.prototype.setPublicKey=function(e){n.Message.setProto3BytesField(this,1,e)},proto.transaction.GenerateID.prototype.getRegistrationFee=function(){return n.Message.getFieldWithDefault(this,2,0)},proto.transaction.GenerateID.prototype.setRegistrationFee=function(e){n.Message.setProto3IntField(this,2,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.NanoPay.prototype.toObject=function(e){return proto.transaction.NanoPay.toObject(e,this)},proto.transaction.NanoPay.toObject=function(e,t){var r={sender:t.getSender_asB64(),recipient:t.getRecipient_asB64(),id:n.Message.getFieldWithDefault(t,3,0),amount:n.Message.getFieldWithDefault(t,4,0),txnExpiration:n.Message.getFieldWithDefault(t,5,0),nanoPayExpiration:n.Message.getFieldWithDefault(t,6,0)};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.NanoPay.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.NanoPay;return proto.transaction.NanoPay.deserializeBinaryFromReader(r,t)},proto.transaction.NanoPay.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setSender(r);break;case 2:var r=t.readBytes();e.setRecipient(r);break;case 3:var r=t.readUint64();e.setId(r);break;case 4:var r=t.readInt64();e.setAmount(r);break;case 5:var r=t.readUint32();e.setTxnExpiration(r);break;case 6:var r=t.readUint32();e.setNanoPayExpiration(r);break;default:t.skipField()}return e},proto.transaction.NanoPay.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.NanoPay.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.NanoPay.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getSender_asU8()).length>0&&t.writeBytes(1,r),(r=e.getRecipient_asU8()).length>0&&t.writeBytes(2,r),0!==(r=e.getId())&&t.writeUint64(3,r),0!==(r=e.getAmount())&&t.writeInt64(4,r),0!==(r=e.getTxnExpiration())&&t.writeUint32(5,r),0!==(r=e.getNanoPayExpiration())&&t.writeUint32(6,r)},proto.transaction.NanoPay.prototype.getSender=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.NanoPay.prototype.getSender_asB64=function(){return n.Message.bytesAsB64(this.getSender())},proto.transaction.NanoPay.prototype.getSender_asU8=function(){return n.Message.bytesAsU8(this.getSender())},proto.transaction.NanoPay.prototype.setSender=function(e){n.Message.setProto3BytesField(this,1,e)},proto.transaction.NanoPay.prototype.getRecipient=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.NanoPay.prototype.getRecipient_asB64=function(){return n.Message.bytesAsB64(this.getRecipient())},proto.transaction.NanoPay.prototype.getRecipient_asU8=function(){return n.Message.bytesAsU8(this.getRecipient())},proto.transaction.NanoPay.prototype.setRecipient=function(e){n.Message.setProto3BytesField(this,2,e)},proto.transaction.NanoPay.prototype.getId=function(){return n.Message.getFieldWithDefault(this,3,0)},proto.transaction.NanoPay.prototype.setId=function(e){n.Message.setProto3IntField(this,3,e)},proto.transaction.NanoPay.prototype.getAmount=function(){return n.Message.getFieldWithDefault(this,4,0)},proto.transaction.NanoPay.prototype.setAmount=function(e){n.Message.setProto3IntField(this,4,e)},proto.transaction.NanoPay.prototype.getTxnExpiration=function(){return n.Message.getFieldWithDefault(this,5,0)},proto.transaction.NanoPay.prototype.setTxnExpiration=function(e){n.Message.setProto3IntField(this,5,e)},proto.transaction.NanoPay.prototype.getNanoPayExpiration=function(){return n.Message.getFieldWithDefault(this,6,0)},proto.transaction.NanoPay.prototype.setNanoPayExpiration=function(e){n.Message.setProto3IntField(this,6,e)},n.Message.GENERATE_TO_OBJECT&&(proto.transaction.IssueAsset.prototype.toObject=function(e){return proto.transaction.IssueAsset.toObject(e,this)},proto.transaction.IssueAsset.toObject=function(e,t){var r={sender:t.getSender_asB64(),name:n.Message.getFieldWithDefault(t,2,""),symbol:n.Message.getFieldWithDefault(t,3,""),totalSupply:n.Message.getFieldWithDefault(t,4,0),precision:n.Message.getFieldWithDefault(t,5,0)};return e&&(r.$jspbMessageInstance=t),r}),proto.transaction.IssueAsset.deserializeBinary=function(e){var t=new n.BinaryReader(e),r=new proto.transaction.IssueAsset;return proto.transaction.IssueAsset.deserializeBinaryFromReader(r,t)},proto.transaction.IssueAsset.deserializeBinaryFromReader=function(e,t){for(;t.nextField()&&!t.isEndGroup();)switch(t.getFieldNumber()){case 1:var r=t.readBytes();e.setSender(r);break;case 2:var r=t.readString();e.setName(r);break;case 3:var r=t.readString();e.setSymbol(r);break;case 4:var r=t.readInt64();e.setTotalSupply(r);break;case 5:var r=t.readUint32();e.setPrecision(r);break;default:t.skipField()}return e},proto.transaction.IssueAsset.prototype.serializeBinary=function(){var e=new n.BinaryWriter;return proto.transaction.IssueAsset.serializeBinaryToWriter(this,e),e.getResultBuffer()},proto.transaction.IssueAsset.serializeBinaryToWriter=function(e,t){var r=void 0;(r=e.getSender_asU8()).length>0&&t.writeBytes(1,r),(r=e.getName()).length>0&&t.writeString(2,r),(r=e.getSymbol()).length>0&&t.writeString(3,r),0!==(r=e.getTotalSupply())&&t.writeInt64(4,r),0!==(r=e.getPrecision())&&t.writeUint32(5,r)},proto.transaction.IssueAsset.prototype.getSender=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.transaction.IssueAsset.prototype.getSender_asB64=function(){return n.Message.bytesAsB64(this.getSender())},proto.transaction.IssueAsset.prototype.getSender_asU8=function(){return n.Message.bytesAsU8(this.getSender())},proto.transaction.IssueAsset.prototype.setSender=function(e){n.Message.setProto3BytesField(this,1,e)},proto.transaction.IssueAsset.prototype.getName=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.transaction.IssueAsset.prototype.setName=function(e){n.Message.setProto3StringField(this,2,e)},proto.transaction.IssueAsset.prototype.getSymbol=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.transaction.IssueAsset.prototype.setSymbol=function(e){n.Message.setProto3StringField(this,3,e)},proto.transaction.IssueAsset.prototype.getTotalSupply=function(){return n.Message.getFieldWithDefault(this,4,0)},proto.transaction.IssueAsset.prototype.setTotalSupply=function(e){n.Message.setProto3IntField(this,4,e)},proto.transaction.IssueAsset.prototype.getPrecision=function(){return n.Message.getFieldWithDefault(this,5,0)},proto.transaction.IssueAsset.prototype.setPrecision=function(e){n.Message.setProto3IntField(this,5,e)},proto.transaction.PayloadType={COINBASE_TYPE:0,TRANSFER_ASSET_TYPE:1,SIG_CHAIN_TXN_TYPE:2,REGISTER_NAME_TYPE:3,TRANSFER_NAME_TYPE:4,DELETE_NAME_TYPE:5,SUBSCRIBE_TYPE:6,UNSUBSCRIBE_TYPE:7,GENERATE_ID_TYPE:8,NANO_PAY_TYPE:9,ISSUE_ASSET_TYPE:10},i.object.extend(t,proto.transaction)},92110:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deleteName=M,t.getBalance=E,t.getLatestBlock=v,t.getNodeState=R,t.getNonce=x,t.getPeerAddr=C,t.getRegistrant=b,t.getSubscribers=m,t.getSubscribersCount=w,t.getSubscription=S,t.getWsAddr=g,t.getWssAddr=_,t.registerName=B,t.rpcCall=y,t.sendTransaction=k,t.subscribe=O,t.transferName=A,t.transferTo=T,t.unsubscribe=P;var n=h(r(73360)),i=h(r(69073)),o=l(r(22737)),s=l(r(4453)),a=l(r(78121)),c=l(r(41015));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(u=function(e){return e?r:t})(e)}function l(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=u(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function h(e){return e&&e.__esModule?e:{default:e}}let f=1e4,p={getWsAddr:{method:"getwsaddr"},getWssAddr:{method:"getwssaddr"},getSubscribers:{method:"getsubscribers",defaultParams:{offset:0,limit:1e3,meta:!1,txPool:!1}},getSubscribersCount:{method:"getsubscriberscount"},getSubscription:{method:"getsubscription"},getBalanceByAddr:{method:"getbalancebyaddr"},getNonceByAddr:{method:"getnoncebyaddr"},getRegistrant:{method:"getregistrant"},getLatestBlockHash:{method:"getlatestblockhash"},sendRawTransaction:{method:"sendrawtransaction"},getNodeState:{method:"getnodestate"},getPeerAddr:{method:"getpeeraddr"}};var d={};for(let e in p)p.hasOwnProperty(e)&&(d[e]=(t,r)=>(r=c.assignDefined({},p[e].defaultParams,r),y(t,p[e].method,r)));async function y(e,t,r={}){let i=n.default.CancelToken.source(),o=null;setTimeout(()=>{null===o&&i.cancel("rpc timeout")},f);try{o=await (0,n.default)({url:e,method:"POST",timeout:f,cancelToken:i.token,data:{id:"nkn-sdk-js",jsonrpc:"2.0",method:t,params:r}})}catch(e){if(n.default.isCancel(e))throw new s.RpcTimeoutError(e.message);throw new s.RpcError(e.message)}let a=o.data;if(a.error)throw new s.ServerError(a.error);if(void 0!==a.result)return a.result;throw new s.InvalidResponseError("rpc response contains no result or error field")}async function g(e,t={}){return d.getWsAddr(t.rpcServerAddr,{address:e})}async function _(e,t={}){return d.getWssAddr(t.rpcServerAddr,{address:e})}async function v(e={}){return d.getLatestBlockHash(e.rpcServerAddr)}async function b(e,t={}){return d.getRegistrant(t.rpcServerAddr,{name:e})}async function m(e,t={}){return d.getSubscribers(t.rpcServerAddr,{topic:e,offset:t.offset,limit:t.limit,meta:t.meta,txPool:t.txPool})}async function w(e,t={}){return d.getSubscribersCount(t.rpcServerAddr,{topic:e})}async function S(e,t,r={}){return d.getSubscription(r.rpcServerAddr,{topic:e,subscriber:t})}async function E(e,t={}){if(!e)throw new s.InvalidArgumentError("address is empty");let r=await d.getBalanceByAddr(t.rpcServerAddr,{address:e});if(!r.amount)throw new s.InvalidResponseError("amount is empty");return new i.default(r.amount)}async function x(e,t={}){if(!e)throw new s.InvalidArgumentError("address is empty");t=c.assignDefined({txPool:!0},t);let r=await d.getNonceByAddr(t.rpcServerAddr,{address:e});if("number"!=typeof r.nonce)throw new s.InvalidResponseError("nonce is not a number");let n=r.nonce;return t.txPool&&r.nonceInTxPool&&r.nonceInTxPool>n&&(n=r.nonceInTxPool),n}async function k(e,t={}){return d.sendRawTransaction(t.rpcServerAddr,{tx:c.bytesToHex(e.serializeBinary())})}async function T(e,t,r={}){if(!o.verifyAddress(e))throw new s.InvalidAddressError("invalid recipient address");let n=r.nonce;null==n&&(n=await this.getNonce());let i=o.publicKeyToSignatureRedeem(this.getPublicKey()),c=o.hexStringToProgramHash(i),u=a.newTransferPayload(c,o.addressStringToProgramHash(e),t),l=await this.createTransaction(u,n,r);return r.buildOnly?l:await this.sendTransaction(l)}async function B(e,t={}){let r=t.nonce;null==r&&(r=await this.getNonce());let n=a.newRegisterNamePayload(this.getPublicKey(),e),i=await this.createTransaction(n,r,t);return t.buildOnly?i:await this.sendTransaction(i)}async function A(e,t,r={}){let n=r.nonce;null==n&&(n=await this.getNonce());let i=a.newTransferNamePayload(e,this.getPublicKey(),t),o=await this.createTransaction(i,n,r);return r.buildOnly?o:await this.sendTransaction(o)}async function M(e,t={}){let r=t.nonce;null==r&&(r=await this.getNonce());let n=a.newDeleteNamePayload(this.getPublicKey(),e),i=await this.createTransaction(n,r,t);return t.buildOnly?i:await this.sendTransaction(i)}async function O(e,t,r,n,i={}){let o=i.nonce;null==o&&(o=await this.getNonce());let s=a.newSubscribePayload(this.getPublicKey(),r,e,t,n),c=await this.createTransaction(s,o,i);return i.buildOnly?c:await this.sendTransaction(c)}async function P(e,t,r={}){let n=r.nonce;null==n&&(n=await this.getNonce());let i=a.newUnsubscribePayload(this.getPublicKey(),t,e),o=await this.createTransaction(i,n,r);return r.buildOnly?o:await this.sendTransaction(o)}async function R(e={}){return d.getNodeState(e.rpcServerAddr)}async function C(e,t={}){return d.getPeerAddr(t.rpcServerAddr,{address:e,offer:t.offer})}},57308:function(e,t,r){"use strict";var n=r(11530).lW;function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.encodeBool=d,t.encodeBytes=f,t.encodeString=p,t.encodeUint=h,t.encodeUint16=c,t.encodeUint32=u,t.encodeUint64=l,t.encodeUint8=a,t.maxUintBits=t.maxUint=void 0,i(r(4453));let o=48;t.maxUintBits=o;let s=2**o;function a(e){let t=n.alloc(1,0);return t.writeUInt8(e),t.toString("hex")}function c(e){let t=n.alloc(2,0);return t.writeUInt16LE(e),t.toString("hex")}function u(e){let t=n.alloc(4,0);return t.writeUInt32LE(e),t.toString("hex")}function l(e){if(e>s)throw RangeError("full 64 bit integer is not supported in JavaScript");let t=n.alloc(8,0);return t.writeUIntLE(e,0,6),t.toString("hex")}function h(e){return e<253?a(e):e<=65535?"fd"+c(e):e<=4294967295?"fe"+u(e):"ff"+l(e)}function f(e){let t=n.from(e);return h(t.length)+t.toString("hex")}function p(e){let t=n.from(e,"utf8");return h(t.length)+t.toString("hex")}function d(e){return a(e?1:0)}t.maxUint=s},41015:function(e,t,r){"use strict";var n=r(11530).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefined=g,t.bytesToHex=u,t.hexToBytes=c,t.isBrowser=m,t.mergeTypedArrays=y,t.randomBytes=void 0,t.randomBytesHex=f,t.randomInt32=p,t.randomUint64=d,t.setPRNG=h,t.sleep=b,t.toLowerKeys=v,t.utf8ToBytes=_;var i=s(r(77085)),o=r(57308);function s(e){return e&&e.__esModule?e:{default:e}}let a=/^[0-9a-f]+$/i;function c(e){if(e.length%2==1)throw RangeError("invalid hex string length "+e.length);if(!a.test(e))throw RangeError("invalid hex string");let t=[];for(let r=0;r{if(e<0||e>255)throw RangeError("invalid byte "+e);return("0"+(255&e).toString(16)).slice(-2)}).join("")}var l=i.default.randomBytes;function h(e){i.default.setPRNG(e)}function f(e){return u(l(e))}function p(){let e=l(4);return e[0]&=127,(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3]}function d(){return parseInt(f(o.maxUintBits/8),16)}function y(e,t){let r=new e.constructor(e.length+t.length);return r.set(e),r.set(t,e.length),r}function g(e,...t){for(let r of t)if(r)for(let t of Object.keys(r))void 0!==r[t]&&(e[t]=r[t]);return e}function _(e){return e?new Uint8Array(n.from(e,"utf8")):new Uint8Array}function v(e){return Object.keys(e).reduce((t,r)=>Object.assign(t,{[r.toLowerCase()]:"object"==typeof e[r]?v(e[r]):e[r]}),{})}function b(e){return new Promise(t=>setTimeout(t,e))}function m(){return![typeof window,typeof document].includes("undefined")}t.randomBytes=l},2105:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={setPRNG:!0,ready:!0,Client:!0,MultiClient:!0,Wallet:!0};Object.defineProperty(t,"Client",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"MultiClient",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"Wallet",{enumerable:!0,get:function(){return c.default}}),t.default=void 0,Object.defineProperty(t,"ready",{enumerable:!0,get:function(){return i.ready}}),t.setPRNG=void 0;var i=r(73551),o=h(r(21913));Object.keys(o).forEach(function(e){!("default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e))&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))});var s=u(r(85349)),a=u(r(746)),c=u(r(35293));function u(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(l=function(e){return e?r:t})(e)}function h(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=l(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}var f=o.util.setPRNG;t.setPRNG=f,o.ready=i.ready,o.Client=s.default,o.MultiClient=a.default,o.Wallet=c.default,o.setPRNG=f;var p=o;t.default=p},14228:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sessionIDSize=t.multiclientIdentifierRe=t.defaultSessionAllowAddr=t.defaultOptions=t.acceptSessionBufSize=void 0;let r={numSubClients:4,originalClient:!1,msgCacheExpiration:3e5,sessionConfig:{}};t.defaultOptions=r;let n=128;t.acceptSessionBufSize=n;let i=/.*/;t.defaultSessionAllowAddr=i;let o=/^__\d+__$/;t.multiclientIdentifierRe=o;let s=8;t.sessionIDSize=s},746:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.default}});var n=i(r(100));function i(e){return e&&e.__esModule?e:{default:e}}},100:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=y(r(79499)),i=r(86253),o=p(r(64569)),s=p(r(85349)),a=p(r(35293)),c=r(26816),u=y(r(21913)),l=y(r(14228)),h=y(r(12681)),f=y(r(63922));function p(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(d=function(e){return e?r:t})(e)}function y(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=d(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class _{constructor(e={}){g(this,"options",void 0),g(this,"key",void 0),g(this,"identifier",void 0),g(this,"addr",void 0),g(this,"eventListeners",void 0),g(this,"clients",void 0),g(this,"defaultClient",void 0),g(this,"msgCache",void 0),g(this,"acceptAddrs",void 0),g(this,"sessions",void 0),g(this,"isReady",void 0),g(this,"isFailed",void 0),g(this,"isClosed",void 0);let t=(e=u.util.assignDefined({},l.defaultOptions,e)).identifier||"",r={};if(e.originalClient){let t=f.addIdentifier("","");r[t]=new s.default(e),e.seed||(e=u.util.assignDefined({},e,{seed:r[t].key.seed}))}for(let n=0;n{if(this.isClosed)return!1;if(a===u.pb.payloads.PayloadType.SESSION){if(!c)return!1;try{await this._handleSessionMsg(s,t,l,i)}catch(e){if(!(e instanceof n.errors.SessionClosedError||e instanceof u.errors.AddrNotAllowedError))throw e}return!1}let p=u.util.bytesToHex(l);if(null!==this.msgCache.get(p))return!1;if(this.msgCache.put(p,s,e.msgCacheExpiration),t=f.removeIdentifier(t).addr,this.eventListeners.message.length>0){let e=await o.default.all(this.eventListeners.message.map(async e=>{try{return await e({src:t,payload:i,payloadType:a,isEncrypted:c,messageId:l,noReply:h})}catch(e){return console.log("Message handler error:",e),null}}));if(!h){let n=!1;for(let r of e){if(!1===r)return!1;if(null!=r){this.send(t,r,{encrypt:c,msgHoldingSeconds:0,replyToId:l}).catch(e=>{console.log("Send response error:",e)}),n=!0;break}}if(!n)for(let e of Object.keys(r))r[e].isReady&&r[e]._sendACK(f.addIdentifierPrefixAll(t,e),l,c).catch(e=>{console.log("Send ack error:",e)})}}return!1});let c=Object.keys(this.clients).map(e=>new o.default((t,r)=>{this.clients[e].onConnect(t)}));o.default.any(c).then(e=>{this.isReady=!0,this.eventListeners.connect.length>0&&this.eventListeners.connect.forEach(async t=>{try{await t(e)}catch(e){console.log("Connect handler error:",e)}})});let h=Object.keys(this.clients).map(e=>new o.default((t,r)=>{this.clients[e].onConnectFailed(t)}));o.default.all(h).then(()=>{this.isFailed=!0,this.eventListeners.connectFailed.length>0?this.eventListeners.connectFailed.forEach(async e=>{try{await e()}catch(e){console.log("Connect failed handler error:",e)}}):console.log("All clients connect failed")}),Object.keys(this.clients).map(e=>{this.clients[e].onWsError(e=>{this.eventListeners.wsError.length>0?this.eventListeners.wsError.forEach(async t=>{try{await t(e)}catch(e){console.log("WsError handler error:",e)}}):console.log(e.message)})})}getSeed(){return this.key.seed}getPublicKey(){return this.key.publicKey}_shouldAcceptAddr(e){for(let t of this.acceptAddrs)if(t.test(e))return!0;return!1}async _handleSessionMsg(e,t,r,n){let i,s=f.removeIdentifier(t),a=s.addr,c=s.clientID,l=f.sessionKey(a,r),h=this.sessions.has(l);if(h)i=this.sessions.get(l);else{if(!this._shouldAcceptAddr(a))throw new u.errors.AddrNotAllowedError;i=this._newSession(a,r,this.options.sessionConfig),this.sessions.set(l,i)}i.receiveWith(e,c,n),!h&&(await i.accept(),this.eventListeners.session.length>0&&await o.default.all(this.eventListeners.session.map(async e=>{try{return await e(i)}catch(e){console.log("Session handler error:",e);return}})))}_newSession(e,t,r={}){let i=this.readyClientIDs().sort();return new n.Session(this.addr,e,i,null,async(r,n,i)=>{let o=this.clients[r];if(!o.isReady)throw new u.errors.ClientNotReadyError;let s=h.newSessionPayload(i,t);await o._send(f.addIdentifierPrefix(e,n),s)},r)}async sendWithClient(e,t,r,n={}){let i=this.clients[e];if(!i)throw new u.errors.InvalidArgumentError("no such clientID");if(!i.isReady)throw new u.errors.ClientNotReadyError;return await i.send(f.addIdentifierPrefixAll(t,e),r,n)}readyClientIDs(){return Object.keys(this.clients).filter(e=>this.clients[e]&&this.clients[e].isReady)}async send(e,t,r={}){r=u.util.assignDefined({},r,{messageId:u.util.randomBytes(h.messageIdSize)});let n=this.readyClientIDs();if(0===n.length)throw new u.errors.ClientNotReadyError;e=await this.defaultClient._processDests(e);try{return await o.default.any(n.map(n=>this.sendWithClient(n,e,t,r)))}catch(e){throw Error("failed to send with any client: "+e.errors)}}async publish(e,t,r={}){let n=(r=u.util.assignDefined({},c.defaultPublishOptions,r,{noReply:!0})).offset,i=await this.getSubscribers(e,{offset:n,limit:r.limit,txPool:r.txPool}),o=i.subscribers,s=i.subscribersInTxPool;for(;i.subscribers&&i.subscribers.length>=r.limit;)n+=r.limit,i=await this.getSubscribers(e,{offset:n,limit:r.limit}),o=o.concat(i.subscribers);return r.txPool&&(o=o.concat(s)),await this.send(o,t,r)}on(e,t){this.eventListeners[e]||(this.eventListeners[e]=[]),this.eventListeners[e].push(t)}onConnect(e){this.eventListeners.connect.push(e)}onConnectFailed(e){this.eventListeners.connectFailed.push(e)}onWsError(e){this.eventListeners.wsError.push(e)}onMessage(e){this.eventListeners.message.push(e)}onSession(e){this.eventListeners.session.push(e)}async close(){let e=[];for(let t of this.sessions.values())e.push(t.close());try{await o.default.all(e)}catch(e){console.log(e)}Object.keys(this.clients).forEach(e=>{try{this.clients[e].close()}catch(e){console.log(e)}}),this.msgCache.clear(),this.isClosed=!0}listen(e){null==e?e=[l.defaultSessionAllowAddr]:Array.isArray(e)||(e=[e]),this.acceptAddrs=[];for(let t=0;te.wallet.options.rpcServerAddr);if(t.length>0)try{return await o.default.any(t.map(t=>a.default.sendTransaction(e,t.wallet.options)))}catch(e){}return await a.default.sendTransaction(e,this.options)}transferTo(e,t,r={}){return u.rpc.transferTo.call(this,e,t,r)}registerName(e,t={}){return u.rpc.registerName.call(this,e,t)}transferName(e,t,r={}){return u.rpc.transferName.call(this,e,t,r)}deleteName(e,t={}){return u.rpc.deleteName.call(this,e,t)}subscribe(e,t,r="",n="",i={}){return u.rpc.subscribe.call(this,e,t,r,n,i)}unsubscribe(e,t="",r={}){return u.rpc.unsubscribe.call(this,e,t,r)}createTransaction(e,t,r={}){return this.defaultClient.wallet.createTransaction(e,t,r)}}t.default=_},63922:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addIdentifier=a,t.addIdentifierPrefix=s,t.addIdentifierPrefixAll=u,t.removeIdentifier=c,t.sessionKey=l;var n=o(r(14228));function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function o(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=i(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=o?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=e[s]}return n.default=e,r&&r.set(e,n),n}function s(e,t){return""===e?""+t:""===t?""+e:t+"."+e}function a(e,t){return""===t?e:s(e,"__"+t+"__")}function c(e){let t=e.split(".");return n.multiclientIdentifierRe.test(t[0])?{addr:t.slice(1).join("."),clientID:t[0]}:{addr:e,clientID:""}}function u(e,t){return Array.isArray(e)?e.map(e=>s(e,t)):s(e,t)}function l(e,t){return e+t}},42569:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=s(r(22737)),i=s(r(21913));function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(o=function(e){return e?r:t})(e)}function s(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=o(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=i?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=e[s]}return n.default=e,r&&r.set(e,n),n}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class c{constructor(e,t={}){a(this,"key",void 0),a(this,"signatureRedeem",void 0),a(this,"programHash",void 0),a(this,"address",void 0),a(this,"contract",void 0),this.key=new i.Key(e,{worker:t.worker}),this.signatureRedeem=n.publicKeyToSignatureRedeem(this.key.publicKey),this.programHash=n.hexStringToProgramHash(this.signatureRedeem),this.address=n.programHashStringToAddress(this.programHash),this.contract=u(this.signatureRedeem,this.programHash)}getPublicKey(){return this.key.publicKey}getSeed(){return this.key.seed}}function u(e,t){return n.prefixByteCountToHexString(e)+(n.prefixByteCountToHexString("00")+t)}t.default=c},22737:function(e,t,r){"use strict";var n=r(11530).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.UINT160_LEN=t.CHECKSUM_LEN=t.BITCOIN_BASE58=t.ADDRESS_LEN=t.ADDRESS_GEN_PREFIX_LEN=t.ADDRESS_GEN_PREFIX=void 0,t.addressStringToProgramHash=v,t.genAddressVerifyBytesFromProgramHash=b,t.genAddressVerifyCodeFromProgramHash=m,t.getAddressStringVerifyCode=w,t.hexStringToProgramHash=g,t.prefixByteCountToHexString=E,t.programHashStringToAddress=_,t.publicKeyToSignatureRedeem=y,t.signatureToParameter=S,t.verifyAddress=d;var i=s(r(21913));function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(o=function(e){return e?r:t})(e)}function s(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=o(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=i?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=e[s]}return n.default=e,r&&r.set(e,n),n}let a="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";t.BITCOIN_BASE58=a;let c=r(35197)(a),u="02b825";t.ADDRESS_GEN_PREFIX=u;let l=u.length/2;t.ADDRESS_GEN_PREFIX_LEN=l;let h=20;t.UINT160_LEN=h;let f=4;t.CHECKSUM_LEN=f;let p=l+h+f;function d(e){try{let t=c.decode(e);if(t.length!==p)return!1;let r=t.slice(0,l);if(i.util.bytesToHex(r)!==u)return!1;let n=v(e),o=w(e),s=m(n);return o===s}catch(e){return!1}}function y(e){return"20"+e+"ac"}function g(e){return i.hash.ripemd160Hex(i.hash.sha256Hex(e))}function _(e){let t=b(e),r=i.util.hexToBytes(u+e);return c.encode(n.from(i.util.mergeTypedArrays(r,t)))}function v(e){let t=c.decode(e),r=t.slice(l,t.length-f);return i.util.bytesToHex(r)}function b(e){return e=u+e,i.util.hexToBytes(i.hash.doubleSha256Hex(e)).slice(0,f)}function m(e){let t=b(e);return i.util.bytesToHex(t)}function w(e){let t=c.decode(e).slice(-f);return i.util.bytesToHex(t)}function S(e){return"40"+e}function E(e){let t=e.length;if(0===t)return"00";1==t%2&&(e="0"+e,t+=1);let r=t/2;return 1==(r=r.toString(16)).length%2&&(r="0"+r),r+e}t.ADDRESS_LEN=p},48477:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scryptParams=t.defaultOptions=void 0;let r={rpcServerAddr:"https://mainnet-rpc-node-0001.nkn.org/mainnet/api/wallet",worker:!1};t.defaultOptions=r;let n={saltLen:8,N:32768,r:8,p:1};t.scryptParams=n},35293:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.default}});var n=i(r(24634));function i(e){return e&&e.__esModule?e:{default:e}}},78121:function(e,t,r){"use strict";var n=r(11530).lW;Object.defineProperty(t,"__esModule",{value:!0}),t.nameRegistrationFee=void 0,t.newDeleteNamePayload=f,t.newNanoPayPayload=y,t.newRegisterNamePayload=l,t.newSubscribePayload=p,t.newTransaction=_,t.newTransferNamePayload=h,t.newTransferPayload=u,t.newUnsubscribePayload=d,t.serializePayload=g,t.serializeUnsignedTx=v,t.signTx=b;var i=a(r(22737)),o=a(r(21913));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(s=function(e){return e?r:t})(e)}function a(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=s(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}let c="10";function u(e,t,r){let i=new o.pb.transaction.TransferAsset;i.setSender(n.from(e,"hex")),i.setRecipient(n.from(t,"hex")),i.setAmount(new o.Amount(r).value());let s=new o.pb.transaction.Payload;return s.setType(o.pb.transaction.PayloadType.TRANSFER_ASSET_TYPE),s.setData(i.serializeBinary()),s}function l(e,t,r=c){let i=new o.pb.transaction.RegisterName;i.setRegistrant(n.from(e,"hex")),i.setName(t),i.setRegistrationFee(new o.Amount(r).value());let s=new o.pb.transaction.Payload;return s.setType(o.pb.transaction.PayloadType.REGISTER_NAME_TYPE),s.setData(i.serializeBinary()),s}function h(e,t,r){let i=new o.pb.transaction.TransferName;i.setName(e),i.setRegistrant(n.from(t,"hex")),i.setRecipient(n.from(r,"hex"));let s=new o.pb.transaction.Payload;return s.setType(o.pb.transaction.PayloadType.TRANSFER_NAME_TYPE),s.setData(i.serializeBinary()),s}function f(e,t){let r=new o.pb.transaction.DeleteName;r.setRegistrant(n.from(e,"hex")),r.setName(t);let i=new o.pb.transaction.Payload;return i.setType(o.pb.transaction.PayloadType.DELETE_NAME_TYPE),i.setData(r.serializeBinary()),i}function p(e,t,r,i,s){let a=new o.pb.transaction.Subscribe;a.setSubscriber(n.from(e,"hex")),a.setIdentifier(t),a.setTopic(r),a.setDuration(i),a.setMeta(s);let c=new o.pb.transaction.Payload;return c.setType(o.pb.transaction.PayloadType.SUBSCRIBE_TYPE),c.setData(a.serializeBinary()),c}function d(e,t,r){let i=new o.pb.transaction.Unsubscribe;i.setSubscriber(n.from(e,"hex")),i.setIdentifier(t),i.setTopic(r);let s=new o.pb.transaction.Payload;return s.setType(o.pb.transaction.PayloadType.UNSUBSCRIBE_TYPE),s.setData(i.serializeBinary()),s}function y(e,t,r,i,s,a){let c=new o.pb.transaction.NanoPay;c.setSender(n.from(e,"hex")),c.setRecipient(n.from(t,"hex")),c.setId(r),c.setAmount(new o.Amount(i).value()),c.setTxnExpiration(s),c.setNanoPayExpiration(a);let u=new o.pb.transaction.Payload;return u.setType(o.pb.transaction.PayloadType.NANO_PAY_TYPE),u.setData(c.serializeBinary()),u}function g(e){return""+(o.serialize.encodeUint32(e.getType())+o.serialize.encodeBytes(e.getData()))}async function _(e,t,r,i="0",s=""){let a=new o.pb.transaction.UnsignedTx;a.setPayload(t),a.setNonce(r),a.setFee(new o.Amount(i).value()),a.setAttributes(n.from(s,"hex"));let c=new o.pb.transaction.Transaction;return c.setUnsignedTx(a),await b(e,c),c}function v(e){return""+(g(e.getPayload())+o.serialize.encodeUint64(e.getNonce())+o.serialize.encodeUint64(e.getFee())+o.serialize.encodeBytes(e.getAttributes()))}async function b(e,t){let r=v(t.getUnsignedTx()),s=o.hash.sha256Hex(r),a=await e.key.sign(s);t.hash=o.hash.doubleSha256Hex(r);let c=new o.pb.transaction.Program;c.setCode(n.from(e.signatureRedeem,"hex")),c.setParameter(n.from(i.signatureToParameter(a),"hex")),t.setProgramsList([c])}t.nameRegistrationFee=c},24634:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=h(r(43670)),i=h(r(42569)),o=l(r(22737)),s=l(r(21913)),a=l(r(48477)),c=l(r(78121));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(u=function(e){return e?r:t})(e)}function l(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=u(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class p{constructor(e={}){f(this,"options",void 0),f(this,"account",void 0),f(this,"iv",void 0),f(this,"masterKey",void 0),f(this,"address",void 0),f(this,"programHash",void 0),f(this,"seedEncrypted",void 0),f(this,"scryptParams",void 0),f(this,"version",void 0),e=s.util.assignDefined({},a.defaultOptions,e),this.version=e.version||p.version,2===this.version&&(this.scryptParams=s.util.assignDefined({},a.scryptParams,e.scrypt),this.scryptParams.salt=this.scryptParams.salt||s.util.randomBytesHex(this.scryptParams.saltLen)),this.options=e,this.account=new i.default(e.seed,{worker:e.worker}),this.address=this.account.address,this.programHash=this.account.programHash,(e.iv||e.masterKey||e.password||e.passwordKey)&&this._completeWallet(Object.assign({},e,{async:!1})),delete e.seed,delete e.iv,delete e.masterKey,delete e.password,delete e.passwordKey}static _computePasswordKey(e){if(!(e=s.util.toLowerKeys(e)).version)throw new s.errors.InvalidArgumentError("missing version field");switch(e.version){case 1:if(e.async)return Promise.resolve(s.hash.doubleSha256(e.password));return s.hash.doubleSha256(e.password);case 2:if(!e.scrypt)throw new s.errors.InvalidArgumentError("missing scrypt field");if(!e.scrypt.salt||!e.scrypt.n||!e.scrypt.r||!e.scrypt.p)throw new s.errors.InvalidArgumentError("incomplete scrypt parameters");if(e.async)return n.default.scrypt(s.util.utf8ToBytes(e.password),s.util.hexToBytes(e.scrypt.salt),e.scrypt.n,e.scrypt.r,e.scrypt.p,32).then(s.util.bytesToHex);return s.util.bytesToHex(n.default.syncScrypt(s.util.utf8ToBytes(e.password),s.util.hexToBytes(e.scrypt.salt),e.scrypt.n,e.scrypt.r,e.scrypt.p,32));default:throw new s.errors.InvalidWalletFormatError("unsupported wallet verison "+e.version)}}static _decryptWallet(e,t){if(t.iv=e.iv,t.masterKey=s.aes.decrypt(e.masterkey,t.passwordKey,t.iv),t.seed=s.aes.decrypt(e.seedencrypted,t.masterKey,t.iv),t.passwordKey={[e.version]:t.passwordKey},2===e.version&&(t.scrypt={salt:e.scrypt.salt,N:e.scrypt.n,r:e.scrypt.r,p:e.scrypt.p}),new i.default(t.seed,{worker:!1}).address!==e.address)throw new s.errors.WrongPasswordError;return new p(t)}_completeWallet(e={}){let t;if(this.seedEncrypted)return e.async?Promise.resolve():void 0;let r=t=>{let r=e.iv||s.util.randomBytesHex(16),n=e.masterKey||s.util.randomBytesHex(32);this.iv=r,this.masterKey=s.aes.encrypt(n,t,r),this.seedEncrypted=s.aes.encrypt(this.account.getSeed(),n,r)};if(e.passwordKey&&e.passwordKey[""+this.version])t=e.passwordKey[""+this.version];else{if(e.async)return p._computePasswordKey({version:this.version,password:e.password||"",scrypt:this.scryptParams,async:!0}).then(r);t=p._computePasswordKey({version:this.version,password:e.password||"",scrypt:this.scryptParams,async:!1})}return(r(t),e.async)?Promise.resolve():void 0}static fromJSON(e,t={}){let r;if(r="string"==typeof e?JSON.parse(e):e,"number"!=typeof(r=s.util.toLowerKeys(r)).version||r.versionp.maxCompatibleVersion)throw new s.errors.InvalidWalletVersionError("invalid wallet version "+r.version+", should be between "+p.minCompatibleVersion+" and "+p.maxCompatibleVersion);if(!r.masterkey)throw new s.errors.InvalidWalletFormatError("missing masterKey field");if(!r.iv)throw new s.errors.InvalidWalletFormatError("missing iv field");if(!r.seedencrypted)throw new s.errors.InvalidWalletFormatError("missing seedEncrypted field");if(!r.address)throw new s.errors.InvalidWalletFormatError("missing address field");if(t.async)return p._computePasswordKey(Object.assign({},r,{password:t.password,async:!0})).then(e=>p._decryptWallet(r,Object.assign({},t,{passwordKey:e})));{let e=p._computePasswordKey(Object.assign({},r,{password:t.password,async:!1}));return p._decryptWallet(r,Object.assign({},t,{passwordKey:e}))}}toJSON(){this._completeWallet({async:!1});let e={Version:this.version,MasterKey:this.masterKey,IV:this.iv,SeedEncrypted:this.seedEncrypted,Address:this.address};return this.scryptParams&&(e.Scrypt={Salt:this.scryptParams.salt,N:this.scryptParams.N,R:this.scryptParams.r,P:this.scryptParams.p}),e}getSeed(){return this.account.getSeed()}getPublicKey(){return this.account.getPublicKey()}static verifyAddress(e){return o.verifyAddress(e)}_verifyPassword(e){this._completeWallet({async:!1});let t=s.aes.decrypt(this.masterKey,e,this.iv),r=s.aes.decrypt(this.seedEncrypted,t,this.iv);return new i.default(r,{worker:!1}).address===this.address}verifyPassword(e,t={}){let r={version:this.version,password:e,scrypt:this.scryptParams,async:t.async};if(t.async)return(async()=>{await this._completeWallet({async:!0});let e=await p._computePasswordKey(r);return this._verifyPassword(e)})();{this._completeWallet({async:!1});let e=p._computePasswordKey(r);return this._verifyPassword(e)}}static getLatestBlock(e={}){return e=s.util.assignDefined({},a.defaultOptions,e),s.rpc.getLatestBlock(e)}getLatestBlock(){return p.getLatestBlock(this.options)}static getRegistrant(e,t={}){return t=s.util.assignDefined({},a.defaultOptions,t),s.rpc.getRegistrant(e,t)}getRegistrant(e){return p.getRegistrant(e,this.options)}static getSubscribers(e,t={}){return t=s.util.assignDefined({},a.defaultOptions,t),s.rpc.getSubscribers(e,t)}getSubscribers(e,t={}){return p.getSubscribers(e,Object.assign({},this.options,t))}static getSubscribersCount(e,t={}){return t=s.util.assignDefined({},a.defaultOptions,t),s.rpc.getSubscribersCount(e,t)}getSubscribersCount(e){return p.getSubscribersCount(e,this.options)}static getSubscription(e,t,r={}){return r=s.util.assignDefined({},a.defaultOptions,r),s.rpc.getSubscription(e,t,r)}getSubscription(e,t){return p.getSubscription(e,t,this.options)}static getBalance(e,t={}){return t=s.util.assignDefined({},a.defaultOptions,t),s.rpc.getBalance(e,t)}getBalance(e){return p.getBalance(e||this.address,this.options)}static getNonce(e,t={}){return t=s.util.assignDefined({},a.defaultOptions,t),s.rpc.getNonce(e,t)}getNonce(e,t={}){return t=s.util.assignDefined({},this.options,t),p.getNonce(e||this.address,t)}static sendTransaction(e,t={}){return t=s.util.assignDefined({},a.defaultOptions,t),s.rpc.sendTransaction(e,t)}sendTransaction(e){return p.sendTransaction(e,this.options)}transferTo(e,t,r={}){return s.rpc.transferTo.call(this,e,t,r)}registerName(e,t={}){return s.rpc.registerName.call(this,e,t)}transferName(e,t,r={}){return s.rpc.transferName.call(this,e,t,r)}deleteName(e,t={}){return s.rpc.deleteName.call(this,e,t)}subscribe(e,t,r="",n="",i={}){return s.rpc.subscribe.call(this,e,t,r,n,i)}unsubscribe(e,t="",r={}){return s.rpc.unsubscribe.call(this,e,t,r)}async createOrUpdateNanoPay(e,t,r,n,i={}){if(!o.verifyAddress(e))throw new s.errors.InvalidAddressError("invalid recipient address");n||(n=s.util.randomUint64());let a=c.newNanoPayPayload(this.programHash,o.addressStringToProgramHash(e),n,t,r,r);return await this.createTransaction(a,0,i)}createTransaction(e,t,r={}){return c.newTransaction(this.account,e,t,r.fee,r.attrs)}static publicKeyToAddress(e){let t=o.publicKeyToSignatureRedeem(e),r=o.hexStringToProgramHash(t);return o.programHashStringToAddress(r)}}t.default=p,f(p,"version",2),f(p,"minCompatibleVersion",1),f(p,"maxCompatibleVersion",2)},25735:function(e,t,r){"use strict";var n=i(r(8953));function i(e){return e&&e.__esModule?e:{default:e}}"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&(0,n.default)(self)},8953:function(e,t,r){"use strict";var n=o(r(35033));function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function o(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=i(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=o?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=e[s]}return n.default=e,r&&r.set(e,n),n}o(r(41015)),e.exports=function(e){let t;e.onmessage=async function(r){try{let i=null;switch(r.data.action){case"setSeed":if(t){if(r.data.seed!==t.seed)throw"cannot set to different seed"}else t=n.keyPair(r.data.seed);break;case"computeSharedKey":if(t)i=await n.computeSharedKey(t.curvePrivateKey,r.data.otherPubkey);else throw"worker key not created";break;case"sign":if(t)i=await n.sign(t.privateKey,r.data.message);else throw"worker key not created";break;default:throw"unknown action: "+r.data.action}e.postMessage({id:r.data.id,result:i})}catch(t){e.postMessage({id:r.data.id,error:t})}}}},11530:function(e,t,r){"use strict";/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */var n,i=r(48738),o=r(6868),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=l,n=w,t.h2=50;var a=2147483647;function c(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}function u(e){if(e>a)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return d(e)}return h(e,t,r)}function h(e,t,r){if("string"==typeof e)return y(e,t);if(ArrayBuffer.isView(e))return _(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return v(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);var i=b(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function p(e,t,r){return(f(e),e<=0)?u(e):void 0!==t?"string"==typeof r?u(e).fill(t,r):u(e).fill(t):u(e)}function d(e){return f(e),u(e<0?0:0|m(e))}function y(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!l.isEncoding(t))throw TypeError("Unknown encoding: "+t);var r=0|S(e,t),n=u(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function g(e){for(var t=e.length<0?0:0|m(e.length),r=u(t),n=0;n=a)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function w(e){return+e!=e&&(e=0),l.alloc(+e)}function S(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(i)return n?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function E(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,r);case"utf8":case"utf-8":return C(this,t,r);case"ascii":return D(this,t,r);case"latin1":case"binary":return j(this,t,r);case"base64":return R(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,t,r);default:if(n)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function x(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function k(e,t,r,n,i){if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Q(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return -1;r=e.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:T(e,t,r,n,i);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):T(e,[t],r,n,i);throw TypeError("val must be string, number or Buffer")}function T(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){for(var h=!0,f=0;fi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(l=u);break;case 2:(192&(o=e[i+1]))==128&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],(192&o)==128&&(192&s)==128&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return I(n)}n=2147483647,l.TYPED_ARRAY_SUPPORT=c(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return h(e,t,r)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,r){return p(e,t,r)},l.allocUnsafe=function(e){return d(e)},l.allocUnsafeSlow=function(e){return d(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(X(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),X(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);in.length?l.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else if(l.isBuffer(o))o.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=o.length}return n},l.byteLength=S,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,i){if(X(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,a=Math.min(o,s),c=this.slice(n,i),u=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return B(this,e,t,r);case"utf8":case"utf-8":return A(this,e,t,r);case"ascii":case"latin1":case"binary":return M(this,e,t,r);case"base64":return O(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,r);default:if(o)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function I(e){var t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var i="",o=t;or)throw RangeError("Trying to access beyond buffer length")}function W(e,t,r,n,i,o){if(!l.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function z(e,t,r,n,i,o){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function K(e,t,r,n,i){return t=+t,r>>>=0,i||z(e,t,r,4,34028234663852886e22,-34028234663852886e22),o.write(e,t,r,n,23,4),r+4}function H(e,t,r,n,i){return t=+t,r>>>=0,i||z(e,t,r,8,17976931348623157e292,-17976931348623157e292),o.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||L(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||L(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return(e>>>=0,t||L(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;W(this,e,t,r,i,0)}var o=1,s=0;for(this[t]=255&e;++s>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;W(this,e,t,r,i,0)}var o=r-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||W(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||W(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||W(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||W(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||W(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);W(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);W(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||W(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||W(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||W(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||W(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||W(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return K(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return K(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return H(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return H(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!i){if(r>56319||s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function $(e){for(var t=[],r=0;r>8,i.push(r%256),i.push(n);return i}function J(e){return i.toByteArray(Y(e))}function Z(e,t,r,n){for(var i=0;i=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Q(e){return e!=e}var ee=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},25090:function(e,t,r){"use strict";var n=r(92402).assign,i=r(47949),o=r(5167),s=r(39946),a={};n(a,i,o,s),e.exports=a},47949:function(e,t,r){"use strict";var n=r(72269),i=r(92402),o=r(66578),s=r(496),a=r(45274),c=Object.prototype.toString,u=0,l=4,h=0,f=1,p=2,d=-1,y=0,g=8;function _(e){if(!(this instanceof _))return new _(e);this.options=i.assign({level:d,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:y,to:""},e||{});var t,r=this.options;r.raw&&r.windowBits>0?r.windowBits=-r.windowBits:r.gzip&&r.windowBits>0&&r.windowBits<16&&(r.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var u=n.deflateInit2(this.strm,r.level,r.method,r.windowBits,r.memLevel,r.strategy);if(u!==h)throw Error(s[u]);if(r.header&&n.deflateSetHeader(this.strm,r.header),r.dictionary){if(t="string"==typeof r.dictionary?o.string2buf(r.dictionary):"[object ArrayBuffer]"===c.call(r.dictionary)?new Uint8Array(r.dictionary):r.dictionary,(u=n.deflateSetDictionary(this.strm,t))!==h)throw Error(s[u]);this._dict_set=!0}}function v(e,t){var r=new _(t);if(r.push(e,!0),r.err)throw r.msg||s[r.err];return r.result}function b(e,t){return(t=t||{}).raw=!0,v(e,t)}function m(e,t){return(t=t||{}).gzip=!0,v(e,t)}_.prototype.push=function(e,t){var r,s,a=this.strm,d=this.options.chunkSize;if(this.ended)return!1;s=t===~~t?t:!0===t?l:u,"string"==typeof e?a.input=o.string2buf(e):"[object ArrayBuffer]"===c.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new i.Buf8(d),a.next_out=0,a.avail_out=d),(r=n.deflate(a,s))!==f&&r!==h)return this.onEnd(r),this.ended=!0,!1;(0===a.avail_out||0===a.avail_in&&(s===l||s===p))&&("string"===this.options.to?this.onData(o.buf2binstring(i.shrinkBuf(a.output,a.next_out))):this.onData(i.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&r!==f);return s===l?(r=n.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===h):(s===p&&(this.onEnd(h),a.avail_out=0),!0)},_.prototype.onData=function(e){this.chunks.push(e)},_.prototype.onEnd=function(e){e===h&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=_,t.deflate=v,t.deflateRaw=b,t.gzip=m},5167:function(e,t,r){"use strict";var n=r(63400),i=r(92402),o=r(66578),s=r(39946),a=r(496),c=r(45274),u=r(67891),l=Object.prototype.toString;function h(e){if(!(this instanceof h))return new h(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits)==0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var r=n.inflateInit2(this.strm,t.windowBits);if(r!==s.Z_OK||(this.header=new u,n.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=o.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=n.inflateSetDictionary(this.strm,t.dictionary))!==s.Z_OK)))throw Error(a[r])}function f(e,t){var r=new h(t);if(r.push(e,!0),r.err)throw r.msg||a[r.err];return r.result}function p(e,t){return(t=t||{}).raw=!0,f(e,t)}h.prototype.push=function(e,t){var r,a,c,u,h,f=this.strm,p=this.options.chunkSize,d=this.options.dictionary,y=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof e?f.input=o.binstring2buf(e):"[object ArrayBuffer]"===l.call(e)?f.input=new Uint8Array(e):f.input=e,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new i.Buf8(p),f.next_out=0,f.avail_out=p),(r=n.inflate(f,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&d&&(r=n.inflateSetDictionary(this.strm,d)),r===s.Z_BUF_ERROR&&!0===y&&(r=s.Z_OK,y=!1),r!==s.Z_STREAM_END&&r!==s.Z_OK)return this.onEnd(r),this.ended=!0,!1;f.next_out&&(0===f.avail_out||r===s.Z_STREAM_END||0===f.avail_in&&(a===s.Z_FINISH||a===s.Z_SYNC_FLUSH))&&("string"===this.options.to?(c=o.utf8border(f.output,f.next_out),u=f.next_out-c,h=o.buf2string(f.output,c),f.next_out=u,f.avail_out=p-u,u&&i.arraySet(f.output,f.output,c,u,0),this.onData(h)):this.onData(i.shrinkBuf(f.output,f.next_out))),0===f.avail_in&&0===f.avail_out&&(y=!0)}while((f.avail_in>0||0===f.avail_out)&&r!==s.Z_STREAM_END);return(r===s.Z_STREAM_END&&(a=s.Z_FINISH),a===s.Z_FINISH)?(r=n.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===s.Z_OK):(a===s.Z_SYNC_FLUSH&&(this.onEnd(s.Z_OK),f.avail_out=0),!0)},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=h,t.inflate=f,t.inflateRaw=p,t.ungzip=f},92402:function(e,t){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw TypeError(r+"must be non-object");for(var i in r)n(r,i)&&(e[i]=r[i])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+n),i);return}for(var o=0;o=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function c(e,t){if(t<65534&&(e.subarray&&o||!e.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(e,t));for(var r="",s=0;s>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},t.buf2binstring=function(e){return c(e,e.length)},t.binstring2buf=function(e){for(var t=new n.Buf8(e.length),r=0,i=t.length;r4){u[n++]=65533,r+=o-1;continue}for(i&=2===o?31:3===o?15:7;o>1&&r1){u[n++]=65533;continue}i<65536?u[n++]=i:(i-=65536,u[n++]=55296|i>>10&1023,u[n++]=56320|1023&i)}return c(u,n)},t.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&(192&e[r])==128;)r--;return r<0||0===r?t:r+s[e[r]]>t?r:t}},43213:function(e){"use strict";function t(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,s=0;0!==r;){s=r>2e3?2e3:r,r-=s;do o=o+(i=i+t[n++]|0)|0;while(--s);i%=65521,o%=65521}return i|o<<16|0}e.exports=t},39946:function(e){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},15193:function(e){"use strict";var t=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();function r(e,r,n,i){var o=t,s=i+n;e^=-1;for(var a=i;a>>8^o[(e^r[a])&255];return -1^e}e.exports=r},72269:function(e,t,r){"use strict";var n,i=r(92402),o=r(78898),s=r(43213),a=r(15193),c=r(496),u=0,l=1,h=3,f=4,p=5,d=0,y=1,g=-2,_=-3,v=-5,b=-1,m=1,w=2,S=3,E=4,x=0,k=2,T=8,B=9,A=15,M=8,O=286,P=30,R=19,C=573,N=15,I=3,D=258,j=262,U=32,F=42,L=69,W=73,z=91,K=103,H=113,q=666,Y=1,G=2,$=3,V=4,J=3;function Z(e,t){return e.msg=c[t],t}function X(e){return(e<<1)-(e>4?9:0)}function Q(e){for(var t=e.length;--t>=0;)e[t]=0}function ee(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(i.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function et(e,t){o._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ee(e.strm)}function er(e,t){e.pending_buf[e.pending++]=t}function en(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function ei(e,t,r,n){var o=e.avail_in;return(o>n&&(o=n),0===o)?0:(e.avail_in-=o,i.arraySet(t,e.input,e.next_in,o,r),1===e.state.wrap?e.adler=s(e.adler,t,o,r):2===e.state.wrap&&(e.adler=a(e.adler,t,o,r)),e.next_in+=o,e.total_in+=o,o)}function eo(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,c=e.strstart>e.w_size-j?e.strstart-(e.w_size-j):0,u=e.window,l=e.w_mask,h=e.prev,f=e.strstart+D,p=u[o+s-1],d=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+s]!==d||u[r+s-1]!==p||u[r]!==u[o]||u[++r]!==u[o+1])continue;o+=2,r++;do;while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&os){if(e.match_start=t,s=n,n>=a)break;p=u[o+s-1],d=u[o+s]}}while((t=h[t&l])>c&&0!=--i);return s<=e.lookahead?s:e.lookahead}function es(e){var t,r,n,o,s,a=e.w_size;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=a+(a-j)){i.arraySet(e.window,e.window,a,a,0),e.match_start-=a,e.strstart-=a,e.block_start-=a,t=r=e.hash_size;do n=e.head[--t],e.head[t]=n>=a?n-a:0;while(--r);t=r=a;do n=e.prev[--t],e.prev[t]=n>=a?n-a:0;while(--r);o+=a}if(0===e.strm.avail_in)break;if(r=ei(e.strm,e.window,e.strstart+e.lookahead,o),e.lookahead+=r,e.lookahead+e.insert>=I)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<=I&&(e.ins_h=(e.ins_h<=I){if(n=o._tr_tally(e,e.strstart-e.match_start,e.match_length-I),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=I){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=I&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=I-1)),e.prev_length>=I&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-I,n=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-I),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<=I&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){s=e.strstart+D;do;while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=I?(r=o._tr_tally(e,1,e.match_length-I),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(et(e,!1),0===e.strm.avail_out))return Y}return(e.insert=0,t===f)?(et(e,!0),0===e.strm.avail_out)?$:V:e.last_lit&&(et(e,!1),0===e.strm.avail_out)?Y:G}function el(e,t){for(var r;;){if(0===e.lookahead&&(es(e),0===e.lookahead)){if(t===u)return Y;break}if(e.match_length=0,r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(et(e,!1),0===e.strm.avail_out))return Y}return(e.insert=0,t===f)?(et(e,!0),0===e.strm.avail_out)?$:V:e.last_lit&&(et(e,!1),0===e.strm.avail_out)?Y:G}function eh(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function ef(e){e.window_size=2*e.w_size,Q(e.head),e.max_lazy_match=n[e.level].max_lazy,e.good_match=n[e.level].good_length,e.nice_match=n[e.level].nice_length,e.max_chain_length=n[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=I-1,e.match_available=0,e.ins_h=0}function ep(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=T,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*C),this.dyn_dtree=new i.Buf16((2*P+1)*2),this.bl_tree=new i.Buf16((2*R+1)*2),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(N+1),this.heap=new i.Buf16(2*O+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*O+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ed(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=k,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?F:H,e.adler=2===t.wrap?0:1,t.last_flush=u,o._tr_init(t),d):Z(e,g)}function ey(e){var t=ed(e);return t===d&&ef(e.state),t}function eg(e,t){return e&&e.state&&2===e.state.wrap?(e.state.gzhead=t,d):g}function e_(e,t,r,n,o,s){if(!e)return g;var a=1;if(t===b&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),o<1||o>B||r!==T||n<8||n>15||t<0||t>9||s<0||s>E)return Z(e,g);8===n&&(n=9);var c=new ep;return e.state=c,c.strm=e,c.wrap=a,c.gzhead=null,c.w_bits=n,c.w_size=1<p||t<0)return e?Z(e,g):g;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||i.status===q&&t!==f)return Z(e,0===e.avail_out?v:g);if(i.strm=e,r=i.last_flush,i.last_flush=t,i.status===F){if(2===i.wrap)e.adler=0,er(i,31),er(i,139),er(i,8),i.gzhead?(er(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),er(i,255&i.gzhead.time),er(i,i.gzhead.time>>8&255),er(i,i.gzhead.time>>16&255),er(i,i.gzhead.time>>24&255),er(i,9===i.level?2:i.strategy>=w||i.level<2?4:0),er(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(er(i,255&i.gzhead.extra.length),er(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=L):(er(i,0),er(i,0),er(i,0),er(i,0),er(i,0),er(i,9===i.level?2:i.strategy>=w||i.level<2?4:0),er(i,J),i.status=H);else{var r,i,s,c,_=T+(i.w_bits-8<<4)<<8,b=-1;_|=(b=i.strategy>=w||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(_|=U),_+=31-_%31,i.status=H,en(i,_),0!==i.strstart&&(en(i,e.adler>>>16),en(i,65535&e.adler)),e.adler=1}}if(i.status===L){if(i.gzhead.extra){for(s=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),ee(e),s=i.pending,i.pending!==i.pending_buf_size));)er(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=W)}else i.status=W}if(i.status===W){if(i.gzhead.name){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),ee(e),s=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexs&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===c&&(i.gzindex=0,i.status=z)}else i.status=z}if(i.status===z){if(i.gzhead.comment){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),ee(e),s=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexs&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===c&&(i.status=K)}else i.status=K}if(i.status===K&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&ee(e),i.pending+2<=i.pending_buf_size&&(er(i,255&e.adler),er(i,e.adler>>8&255),e.adler=0,i.status=H)):i.status=H),0!==i.pending){if(ee(e),0===e.avail_out)return i.last_flush=-1,d}else if(0===e.avail_in&&X(t)<=X(r)&&t!==f)return Z(e,v);if(i.status===q&&0!==e.avail_in)return Z(e,v);if(0!==e.avail_in||0!==i.lookahead||t!==u&&i.status!==q){var m=i.strategy===w?el(i,t):i.strategy===S?eu(i,t):n[i.level].func(i,t);if((m===$||m===V)&&(i.status=q),m===Y||m===$)return 0===e.avail_out&&(i.last_flush=-1),d;if(m===G&&(t===l?o._tr_align(i):t!==p&&(o._tr_stored_block(i,0,0,!1),t===h&&(Q(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),ee(e),0===e.avail_out))return i.last_flush=-1,d}return t!==f?d:i.wrap<=0?y:(2===i.wrap?(er(i,255&e.adler),er(i,e.adler>>8&255),er(i,e.adler>>16&255),er(i,e.adler>>24&255),er(i,255&e.total_in),er(i,e.total_in>>8&255),er(i,e.total_in>>16&255),er(i,e.total_in>>24&255)):(en(i,e.adler>>>16),en(i,65535&e.adler)),ee(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?d:y)}function em(e){var t;return e&&e.state?(t=e.state.status)!==F&&t!==L&&t!==W&&t!==z&&t!==K&&t!==H&&t!==q?Z(e,g):(e.state=null,t===H?Z(e,_):d):g}function ew(e,t){var r,n,o,a,c,u,l,h,f=t.length;if(!e||!e.state||2===(a=(r=e.state).wrap)||1===a&&r.status!==F||r.lookahead)return g;for(1===a&&(e.adler=s(e.adler,t,f,0)),r.wrap=0,f>=r.w_size&&(0===a&&(Q(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new i.Buf8(r.w_size),i.arraySet(h,t,f-r.w_size,r.w_size,0),t=h,f=r.w_size),c=e.avail_in,u=e.next_in,l=e.input,e.avail_in=f,e.next_in=0,e.input=t,es(r);r.lookahead>=I;){n=r.strstart,o=r.lookahead-(I-1);do r.ins_h=(r.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(es(e),0===e.lookahead&&t===u)return Y;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,et(e,!1),0===e.strm.avail_out)||e.strstart-e.block_start>=e.w_size-j&&(et(e,!1),0===e.strm.avail_out))return Y}return(e.insert=0,t===f)?(et(e,!0),0===e.strm.avail_out)?$:V:(e.strstart>e.block_start&&(et(e,!1),e.strm.avail_out),Y)}),new eh(4,4,8,4,ea),new eh(4,5,16,8,ea),new eh(4,6,32,32,ea),new eh(4,4,16,16,ec),new eh(8,16,32,32,ec),new eh(8,16,128,128,ec),new eh(8,32,128,256,ec),new eh(32,128,258,1024,ec),new eh(32,258,258,4096,ec)],t.deflateInit=ev,t.deflateInit2=e_,t.deflateReset=ey,t.deflateResetKeep=ed,t.deflateSetHeader=eg,t.deflate=eb,t.deflateEnd=em,t.deflateSetDictionary=ew,t.deflateInfo="pako deflate (from Nodeca project)"},67891:function(e){"use strict";function t(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}e.exports=t},61974:function(e){"use strict";var t=30,r=12;e.exports=function(e,n){var i,o,s,a,c,u,l,h,f,p,d,y,g,_,v,b,m,w,S,E,x,k,T,B,A;i=e.state,o=e.next_in,B=e.input,s=o+(e.avail_in-5),a=e.next_out,A=e.output,c=a-(n-e.avail_out),u=a+(e.avail_out-257),l=i.dmax,h=i.wsize,f=i.whave,p=i.wnext,d=i.window,y=i.hold,g=i.bits,_=i.lencode,v=i.distcode,b=(1<>>=S=w>>>24,g-=S,0==(S=w>>>16&255))A[a++]=65535&w;else if(16&S)for(E=65535&w,(S&=15)&&(g>>=S,g-=S),g<15&&(y+=B[o++]<>>=S=w>>>24,g-=S,16&(S=w>>>16&255)){if(x=65535&w,g<(S&=15)&&(y+=B[o++]<l){e.msg="invalid distance too far back",i.mode=t;break t}if(y>>>=S,g-=S,x>(S=a-c)){if((S=x-S)>f&&i.sane){e.msg="invalid distance too far back",i.mode=t;break t}if(k=0,T=d,0===p){if(k+=h-S,S2;)A[a++]=T[k++],A[a++]=T[k++],A[a++]=T[k++],E-=3;E&&(A[a++]=T[k++],E>1&&(A[a++]=T[k++]))}else{k=a-x;do A[a++]=A[k++],A[a++]=A[k++],A[a++]=A[k++],E-=3;while(E>2);E&&(A[a++]=A[k++],E>1&&(A[a++]=A[k++]))}}else if((64&S)==0){w=v[(65535&w)+(y&(1<>3,g-=E<<3,y&=(1<>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function eo(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function es(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=x,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new o.Buf32(et),t.distcode=t.distdyn=new o.Buf32(er),t.sane=1,t.back=-1,g):b}function ea(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,es(e)):b}function ec(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?b:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,ea(e)):b}function eu(e,t){var r,n;return e?(n=new eo,e.state=n,n.window=null,(r=ec(e,t))!==g&&(e.state=null),r):b}function el(e){return eu(e,en)}var eh=!0;function ef(e){if(eh){var t;for(n=new o.Buf32(512),i=new o.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(u(h,e.lens,0,288,n,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;u(f,e.lens,0,32,i,0,e.work,{bits:5}),eh=!1}e.lencode=n,e.lenbits=9,e.distcode=i,e.distbits=5}function ep(e,t,r,n){var i,s=e.state;return null===s.window&&(s.wsize=1<=s.wsize?(o.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((i=s.wsize-s.wnext)>n&&(i=n),o.arraySet(s.window,t,r-n,i,s.wnext),(n-=i)?(o.arraySet(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=a(r.check,eT,2,0),es=0,ea=0,r.mode=k;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&es)<<8)+(es>>8))%31){e.msg="incorrect header check",r.mode=Q;break}if((15&es)!==E){e.msg="unknown compression method",r.mode=Q;break}if(es>>>=4,ea-=4,ew=(15&es)+8,0===r.wbits)r.wbits=ew;else if(ew>r.wbits){e.msg="invalid window size",r.mode=Q;break}r.dmax=1<>8&1),512&r.flags&&(eT[0]=255&es,eT[1]=es>>>8&255,r.check=a(r.check,eT,2,0)),es=0,ea=0,r.mode=T;case T:for(;ea<32;){if(0===en)break r;en--,es+=n[et++]<>>8&255,eT[2]=es>>>16&255,eT[3]=es>>>24&255,r.check=a(r.check,eT,4,0)),es=0,ea=0,r.mode=B;case B:for(;ea<16;){if(0===en)break r;en--,es+=n[et++]<>8),512&r.flags&&(eT[0]=255&es,eT[1]=es>>>8&255,r.check=a(r.check,eT,2,0)),es=0,ea=0,r.mode=A;case A:if(1024&r.flags){for(;ea<16;){if(0===en)break r;en--,es+=n[et++]<>>8&255,r.check=a(r.check,eT,2,0)),es=0,ea=0}else r.head&&(r.head.extra=null);r.mode=M;case M:if(1024&r.flags&&((el=r.length)>en&&(el=en),el&&(r.head&&(ew=r.head.extra_len-r.length,r.head.extra||(r.head.extra=Array(r.head.extra_len)),o.arraySet(r.head.extra,n,et,el,ew)),512&r.flags&&(r.check=a(r.check,n,el,et)),en-=el,et+=el,r.length-=el),r.length))break r;r.length=0,r.mode=O;case O:if(2048&r.flags){if(0===en)break r;el=0;do ew=n[et+el++],r.head&&ew&&r.length<65536&&(r.head.name+=String.fromCharCode(ew));while(ew&&el>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=I;break;case C:for(;ea<32;){if(0===en)break r;en--,es+=n[et++]<>>=7&ea,ea-=7&ea,r.mode=J;break}for(;ea<3;){if(0===en)break r;en--,es+=n[et++]<>>=1)){case 0:r.mode=j;break;case 1:if(ef(r),r.mode=K,t===y){es>>>=2,ea-=2;break r}break;case 2:r.mode=L;break;case 3:e.msg="invalid block type",r.mode=Q}es>>>=2,ea-=2;break;case j:for(es>>>=7&ea,ea-=7&ea;ea<32;){if(0===en)break r;en--,es+=n[et++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=Q;break}if(r.length=65535&es,es=0,ea=0,r.mode=U,t===y)break r;case U:r.mode=F;case F:if(el=r.length){if(el>en&&(el=en),el>eo&&(el=eo),0===el)break r;o.arraySet(i,n,et,el,er),en-=el,et+=el,eo-=el,er+=el,r.length-=el;break}r.mode=I;break;case L:for(;ea<14;){if(0===en)break r;en--,es+=n[et++]<>>=5,ea-=5,r.ndist=(31&es)+1,es>>>=5,ea-=5,r.ncode=(15&es)+4,es>>>=4,ea-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Q;break}r.have=0,r.mode=W;case W:for(;r.have>>=3,ea-=3}for(;r.have<19;)r.lens[eB[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,eE={bits:r.lenbits},eS=u(l,r.lens,0,19,r.lencode,0,r.work,eE),r.lenbits=eE.bits,eS){e.msg="invalid code lengths set",r.mode=Q;break}r.have=0,r.mode=z;case z:for(;r.have>>24,eg=ek>>>16&255,e_=65535&ek,!(ey<=ea);){if(0===en)break r;en--,es+=n[et++]<>>=ey,ea-=ey,r.lens[r.have++]=e_;else{if(16===e_){for(ex=ey+2;ea>>=ey,ea-=ey,0===r.have){e.msg="invalid bit length repeat",r.mode=Q;break}ew=r.lens[r.have-1],el=3+(3&es),es>>>=2,ea-=2}else if(17===e_){for(ex=ey+3;ea>>=ey,ea-=ey,ew=0,el=3+(7&es),es>>>=3,ea-=3}else{for(ex=ey+7;ea>>=ey,ea-=ey,ew=0,el=11+(127&es),es>>>=7,ea-=7}if(r.have+el>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Q;break}for(;el--;)r.lens[r.have++]=ew}}if(r.mode===Q)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=Q;break}if(r.lenbits=9,eE={bits:r.lenbits},eS=u(h,r.lens,0,r.nlen,r.lencode,0,r.work,eE),r.lenbits=eE.bits,eS){e.msg="invalid literal/lengths set",r.mode=Q;break}if(r.distbits=6,r.distcode=r.distdyn,eE={bits:r.distbits},eS=u(f,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,eE),r.distbits=eE.bits,eS){e.msg="invalid distances set",r.mode=Q;break}if(r.mode=K,t===y)break r;case K:r.mode=H;case H:if(en>=6&&eo>=258){e.next_out=er,e.avail_out=eo,e.next_in=et,e.avail_in=en,r.hold=es,r.bits=ea,c(e,eu),er=e.next_out,i=e.output,eo=e.avail_out,et=e.next_in,n=e.input,en=e.avail_in,es=r.hold,ea=r.bits,r.mode===I&&(r.back=-1);break}for(r.back=0;ey=(ek=r.lencode[es&(1<>>24,eg=ek>>>16&255,e_=65535&ek,!(ey<=ea);){if(0===en)break r;en--,es+=n[et++]<>ev)])>>>24,eg=ek>>>16&255,e_=65535&ek,!(ev+ey<=ea);){if(0===en)break r;en--,es+=n[et++]<>>=ev,ea-=ev,r.back+=ev}if(es>>>=ey,ea-=ey,r.back+=ey,r.length=e_,0===eg){r.mode=V;break}if(32&eg){r.back=-1,r.mode=I;break}if(64&eg){e.msg="invalid literal/length code",r.mode=Q;break}r.extra=15&eg,r.mode=q;case q:if(r.extra){for(ex=r.extra;ea>>=r.extra,ea-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Y;case Y:for(;ey=(ek=r.distcode[es&(1<>>24,eg=ek>>>16&255,e_=65535&ek,!(ey<=ea);){if(0===en)break r;en--,es+=n[et++]<>ev)])>>>24,eg=ek>>>16&255,e_=65535&ek,!(ev+ey<=ea);){if(0===en)break r;en--,es+=n[et++]<>>=ev,ea-=ev,r.back+=ev}if(es>>>=ey,ea-=ey,r.back+=ey,64&eg){e.msg="invalid distance code",r.mode=Q;break}r.offset=e_,r.extra=15&eg,r.mode=G;case G:if(r.extra){for(ex=r.extra;ea>>=r.extra,ea-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Q;break}r.mode=$;case $:if(0===eo)break r;if(el=eu-eo,r.offset>el){if((el=r.offset-el)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Q;break}el>r.wnext?(el-=r.wnext,eh=r.wsize-el):eh=r.wnext-el,el>r.length&&(el=r.length),ed=r.window}else ed=i,eh=er-r.offset,el=r.length;el>eo&&(el=eo),eo-=el,r.length-=el;do i[er++]=ed[eh++];while(--el);0===r.length&&(r.mode=H);break;case V:if(0===eo)break r;i[er++]=r.length,eo--,r.mode=H;break;case J:if(r.wrap){for(;ea<32;){if(0===en)break r;en--,es|=n[et++]<=1&&0===W[R];R--);if(C>R&&(C=R),0===R)return y[g++]=20971520,y[g++]=20971520,v.bits=1,0;for(P=1;P0&&(e===a||1!==R))return -1;for(M=1,z[1]=0;Mo||e===u&&j>s)return 1;for(;;){k=M-I,_[O]x?(T=K[H+_[O]],B=F[L+_[O]]):(T=96,B=0),b=1<>I)+(m-=b)]=k<<24|T<<16|B|0;while(0!==m);for(b=1<>=1;if(0!==b?(U&=b-1,U+=b):U=0,O++,0==--W[M]){if(M===R)break;M=t[r+_[O]]}if(M>C&&(U&S)!==w){for(0===I&&(I=C),E+=P,D=1<<(N=M-I);N+Io||e===u&&j>s)return 1;y[w=U&S]=C<<24|N<<16|E-g|0}}return 0!==U&&(y[E+U]=M-I<<24|4194304),v.bits=C,0}},496:function(e){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},78898:function(e,t,r){"use strict";var n,i,o,s=r(92402),a=4,c=0,u=1,l=2;function h(e){for(var t=e.length;--t>=0;)e[t]=0}var f=0,p=1,d=2,y=3,g=258,_=29,v=256,b=286,m=30,w=19,S=573,E=15,x=16,k=7,T=256,B=16,A=17,M=18,O=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],P=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],R=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],N=512,I=Array(576);h(I);var D=Array(2*m);h(D);var j=Array(N);h(j);var U=Array(g-y+1);h(U);var F=Array(_);h(F);var L=Array(m);function W(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function z(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function K(e){return e<256?j[e]:j[256+(e>>>7)]}function H(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function q(e,t,r){e.bi_valid>x-r?(e.bi_buf|=t<>x-e.bi_valid,e.bi_valid+=r-x):(e.bi_buf|=t<>>=1,r<<=1;while(--t>0);return r>>>1}function $(e){16===e.bi_valid?(H(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}function V(e,t){var r,n,i,o,s,a,c=t.dyn_tree,u=t.max_code,l=t.stat_desc.static_tree,h=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,d=t.stat_desc.max_length,y=0;for(o=0;o<=E;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;rd&&(o=d,y++),c[2*n+1]=o,!(n>u)&&(e.bl_count[o]++,s=0,n>=p&&(s=f[n-p]),a=c[2*n],e.opt_len+=a*(o+s),h&&(e.static_len+=a*(l[2*n+1]+s)));if(0!==y){do{for(o=d-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[d]--,y-=2}while(y>0);for(o=d;0!==o;o--)for(n=e.bl_count[o];0!==n;)!((i=e.heap[--r])>u)&&(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}function J(e,t,r){var n,i,o=Array(E+1),s=0;for(n=1;n<=E;n++)o[n]=s=s+r[n-1]<<1;for(i=0;i<=t;i++){var a=e[2*i+1];0!==a&&(e[2*i]=G(o[a]++,a))}}function Z(){var e,t,r,s,a,c=Array(E+1);for(s=0,r=0;s<_-1;s++)for(e=0,F[s]=r;e<1<>=7;s8?H(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function ee(e,t,r,n){Q(e),n&&(H(e,r),H(e,~r)),s.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function et(e,t,r,n){var i=2*t,o=2*r;return e[i]>1;r>=1;r--)er(e,o,r);i=c;do r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],er(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,er(e,o,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],V(e,t),J(o,u,e.bl_count)}function eo(e,t,r){var n,i,o=-1,s=t[1],a=0,c=7,u=4;for(0===s&&(c=138,u=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)i=s,s=t[(n+1)*2+1],++a=3&&0===e.bl_tree[2*C[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}function ec(e,t,r,n){var i;for(q(e,t-257,5),q(e,r-1,5),q(e,n-4,4),i=0;i>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return c;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return u;for(t=32;t0?(e.strm.data_type===l&&(e.strm.data_type=eu(e)),ei(e,e.l_desc),ei(e,e.d_desc),s=ea(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?ef(e,t,r,n):e.strategy===a||o===i?(q(e,(p<<1)+(n?1:0),3),en(e,I,D)):(q(e,(d<<1)+(n?1:0),3),ec(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),en(e,e.dyn_ltree,e.dyn_dtree)),X(e),n&&Q(e)}function ey(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[(U[r]+v+1)*2]++,e.dyn_dtree[2*K(t)]++),e.last_lit===e.lit_bufsize-1}t._tr_init=eh,t._tr_stored_block=ef,t._tr_flush_block=ed,t._tr_tally=ey,t._tr_align=ep},45274:function(e){"use strict";function t(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}e.exports=t},76269:function(e){"use strict";e.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},10632:function(e,t,r){/*! safe-buffer. MIT License. Feross Aboukhadijeh */var n=r(9109),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n.SlowBuffer(e)}},43670:function(e){"use strict";!function(t){let r=2147483647;function n(e){let t=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]),r=1779033703,n=3144134277,i=1013904242,o=2773480762,s=1359893119,a=2600822924,c=528734635,u=1541459225,l=new Uint32Array(64);function h(e){let h=0,f=e.length;for(;f>=64;){let p=r,d=n,y=i,g=o,_=s,v=a,b=c,m=u,w,S,E,x,k;for(S=0;S<16;S++)E=h+4*S,l[S]=(255&e[E])<<24|(255&e[E+1])<<16|(255&e[E+2])<<8|255&e[E+3];for(S=16;S<64;S++)x=((w=l[S-2])>>>17|w<<15)^(w>>>19|w<<13)^w>>>10,k=((w=l[S-15])>>>7|w<<25)^(w>>>18|w<<14)^w>>>3,l[S]=(x+l[S-7]|0)+(k+l[S-16]|0)|0;for(S=0;S<64;S++)x=(((_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&v^~_&b)|0)+(m+(t[S]+l[S]|0)|0)|0,k=((p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10))+(p&d^p&y^d&y)|0,m=b,b=v,v=_,_=g+x|0,g=y,y=d,d=p,p=x+k|0;r=r+p|0,n=n+d|0,i=i+y|0,o=o+g|0,s=s+_|0,a=a+v|0,c=c+b|0,u=u+m|0,h+=64,f-=64}}h(e);let f,p=e.length%64,d=e.length/536870912|0,y=e.length<<3,g=p<56?56:120,_=e.slice(e.length-p,e.length);for(_.push(128),f=p+1;f>>24&255),_.push(d>>>16&255),_.push(d>>>8&255),_.push(d>>>0&255),_.push(y>>>24&255),_.push(y>>>16&255),_.push(y>>>8&255),_.push(y>>>0&255),h(_),[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,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255]}function i(e,t,r){let i;e=e.length<=64?e:n(e);let o=64+t.length+4,s=Array(o),a=Array(64),c=[];for(i=0;i<64;i++)s[i]=54;for(i=0;i=o-4;e--){if(s[e]++,s[e]<=255)return;s[e]=0}}for(;r>=32;)u(),c=c.concat(n(a.concat(n(s)))),r-=32;return r>0&&(u(),c=c.concat(n(a.concat(n(s))).slice(0,r))),c}function o(e,t,r,n,i){let o;for(u(e,(2*r-1)*16,i,0,16),o=0;o<2*r;o++)c(e,16*o,i,16),a(i,n),u(i,0,e,t+16*o,16);for(o=0;o>>32-t}function a(e,t){u(e,0,t,0,16);for(let e=8;e>0;e-=2)t[4]^=s(t[0]+t[12],7),t[8]^=s(t[4]+t[0],9),t[12]^=s(t[8]+t[4],13),t[0]^=s(t[12]+t[8],18),t[9]^=s(t[5]+t[1],7),t[13]^=s(t[9]+t[5],9),t[1]^=s(t[13]+t[9],13),t[5]^=s(t[1]+t[13],18),t[14]^=s(t[10]+t[6],7),t[2]^=s(t[14]+t[10],9),t[6]^=s(t[2]+t[14],13),t[10]^=s(t[6]+t[2],18),t[3]^=s(t[15]+t[11],7),t[7]^=s(t[3]+t[15],9),t[11]^=s(t[7]+t[3],13),t[15]^=s(t[11]+t[7],18),t[1]^=s(t[0]+t[3],7),t[2]^=s(t[1]+t[0],9),t[3]^=s(t[2]+t[1],13),t[0]^=s(t[3]+t[2],18),t[6]^=s(t[5]+t[4],7),t[7]^=s(t[6]+t[5],9),t[4]^=s(t[7]+t[6],13),t[5]^=s(t[4]+t[7],18),t[11]^=s(t[10]+t[9],7),t[8]^=s(t[11]+t[10],9),t[9]^=s(t[8]+t[11],13),t[10]^=s(t[9]+t[8],18),t[12]^=s(t[15]+t[14],7),t[13]^=s(t[12]+t[15],9),t[14]^=s(t[13]+t[12],13),t[15]^=s(t[14]+t[13],18);for(let r=0;r<16;++r)e[r]+=t[r]}function c(e,t,r,n){for(let i=0;i=256)return!1}return!0}function h(e,t){if("number"!=typeof e||e%1)throw Error("invalid "+t);return e}function f(e,t,n,s,a,f,p){let d;if(n=h(n,"N"),s=h(s,"r"),a=h(a,"p"),f=h(f,"dkLen"),0===n||(n&n-1)!=0)throw Error("N must be power of 2");if(n>r/128/s)throw Error("N too large");if(s>r/128/a)throw Error("r too large");if(!l(e))throw Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!l(t))throw Error("salt must be an array or buffer");t=Array.prototype.slice.call(t);let y=i(e,t,128*a*s),g=new Uint32Array(32*a*s);for(let e=0;eM&&(t=M);for(let e=0;eM&&(t=M);for(let e=0;e>0&255),y.push(g[e]>>8&255),y.push(g[e]>>16&255),y.push(g[e]>>24&255);let r=i(e,y,f);return p&&p(null,1,r),r}p&&O(P)};if(!p)for(;;){let e=P();if(void 0!=e)return e}P()}let p={scrypt:function(e,t,r,n,i,o,s){return new Promise(function(a,c){let u=0;s&&s(0),f(e,t,r,n,i,o,function(e,t,r){if(e)c(e);else if(r)s&&1!==u&&s(1),a(new Uint8Array(r));else if(s&&t!==u)return u=t,s(t)})})},syncScrypt:function(e,t,r,n,i,o){return new Uint8Array(f(e,t,r,n,i,o))}};e.exports=p}(0)},49813:function(e,t,r){"use strict";var n=r(77323),i=r(30602),o=r(66626)(),s=r(55601),a=r(31354),c=n("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new a("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||c(t)!==t)throw new a("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,u=!0;if("length"in e&&s){var l=s(e,"length");l&&!l.configurable&&(n=!1),l&&!l.writable&&(u=!1)}return(n||u||!r)&&(o?i(e,"length",t,!0,!0):i(e,"length",t)),e}},56123:function(e,t,r){"use strict";var n=r(10632).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;if(!e)return"utf8";for(;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function s(e){var t=o(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw Error("Unknown encoding: "+e);return t||e}function a(e){var t;switch(this.encoding=s(e),this.encoding){case"utf16le":this.text=d,this.end=y,t=4;break;case"utf8":this.fillLast=h,t=4;break;case"base64":this.text=g,this.end=_,t=3;break;default:this.write=v,this.end=b;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function c(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function u(e,t,r){var n=t.length-1;if(n=0?(i>0&&(e.lastNeed=i-1),i):--n=0?(i>0&&(e.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}function l(e,t,r){if((192&t[0])!=128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((192&t[1])!=128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(192&t[2])!=128)return e.lastNeed=2,"�"}}function h(e){var t=this.lastTotal-this.lastNeed,r=l(this,e,t);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length)}function f(e,t){var r=u(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function d(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function y(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function g(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function _(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function v(e){return e.toString(this.encoding)}function b(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){var t,r;if(0===e.length)return"";if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function y(e,t,r,n,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,r,n){return y(e,t,r,n,16)}function _(e,t,r,n){return y(e,t,r,n,32)}function v(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,p=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,d=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,_=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,v=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,m=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,w=o,S=s,E=a,x=c,k=u,T=l,B=h,A=f,M=p,O=d,P=y,R=g,C=_,N=v,I=b,D=m,j=0;j<20;j+=2)k^=(i=w+C|0)<<7|i>>>25,M^=(i=k+w|0)<<9|i>>>23,C^=(i=M+k|0)<<13|i>>>19,w^=(i=C+M|0)<<18|i>>>14,O^=(i=T+S|0)<<7|i>>>25,N^=(i=O+T|0)<<9|i>>>23,S^=(i=N+O|0)<<13|i>>>19,T^=(i=S+N|0)<<18|i>>>14,I^=(i=P+B|0)<<7|i>>>25,E^=(i=I+P|0)<<9|i>>>23,B^=(i=E+I|0)<<13|i>>>19,P^=(i=B+E|0)<<18|i>>>14,x^=(i=D+R|0)<<7|i>>>25,A^=(i=x+D|0)<<9|i>>>23,R^=(i=A+x|0)<<13|i>>>19,D^=(i=R+A|0)<<18|i>>>14,S^=(i=w+x|0)<<7|i>>>25,E^=(i=S+w|0)<<9|i>>>23,x^=(i=E+S|0)<<13|i>>>19,w^=(i=x+E|0)<<18|i>>>14,B^=(i=T+k|0)<<7|i>>>25,A^=(i=B+T|0)<<9|i>>>23,k^=(i=A+B|0)<<13|i>>>19,T^=(i=k+A|0)<<18|i>>>14,R^=(i=P+O|0)<<7|i>>>25,M^=(i=R+P|0)<<9|i>>>23,O^=(i=M+R|0)<<13|i>>>19,P^=(i=O+M|0)<<18|i>>>14,C^=(i=D+I|0)<<7|i>>>25,N^=(i=C+D|0)<<9|i>>>23,I^=(i=N+C|0)<<13|i>>>19,D^=(i=I+N|0)<<18|i>>>14;w=w+o|0,S=S+s|0,E=E+a|0,x=x+c|0,k=k+u|0,T=T+l|0,B=B+h|0,A=A+f|0,M=M+p|0,O=O+d|0,P=P+y|0,R=R+g|0,C=C+_|0,N=N+v|0,I=I+b|0,D=D+m|0,e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=S>>>0&255,e[5]=S>>>8&255,e[6]=S>>>16&255,e[7]=S>>>24&255,e[8]=E>>>0&255,e[9]=E>>>8&255,e[10]=E>>>16&255,e[11]=E>>>24&255,e[12]=x>>>0&255,e[13]=x>>>8&255,e[14]=x>>>16&255,e[15]=x>>>24&255,e[16]=k>>>0&255,e[17]=k>>>8&255,e[18]=k>>>16&255,e[19]=k>>>24&255,e[20]=T>>>0&255,e[21]=T>>>8&255,e[22]=T>>>16&255,e[23]=T>>>24&255,e[24]=B>>>0&255,e[25]=B>>>8&255,e[26]=B>>>16&255,e[27]=B>>>24&255,e[28]=A>>>0&255,e[29]=A>>>8&255,e[30]=A>>>16&255,e[31]=A>>>24&255,e[32]=M>>>0&255,e[33]=M>>>8&255,e[34]=M>>>16&255,e[35]=M>>>24&255,e[36]=O>>>0&255,e[37]=O>>>8&255,e[38]=O>>>16&255,e[39]=O>>>24&255,e[40]=P>>>0&255,e[41]=P>>>8&255,e[42]=P>>>16&255,e[43]=P>>>24&255,e[44]=R>>>0&255,e[45]=R>>>8&255,e[46]=R>>>16&255,e[47]=R>>>24&255,e[48]=C>>>0&255,e[49]=C>>>8&255,e[50]=C>>>16&255,e[51]=C>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=I>>>0&255,e[57]=I>>>8&255,e[58]=I>>>16&255,e[59]=I>>>24&255,e[60]=D>>>0&255,e[61]=D>>>8&255,e[62]=D>>>16&255,e[63]=D>>>24&255}function b(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,p=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,d=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,_=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,v=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,m=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,w=o,S=s,E=a,x=c,k=u,T=l,B=h,A=f,M=p,O=d,P=y,R=g,C=_,N=v,I=b,D=m,j=0;j<20;j+=2)k^=(i=w+C|0)<<7|i>>>25,M^=(i=k+w|0)<<9|i>>>23,C^=(i=M+k|0)<<13|i>>>19,w^=(i=C+M|0)<<18|i>>>14,O^=(i=T+S|0)<<7|i>>>25,N^=(i=O+T|0)<<9|i>>>23,S^=(i=N+O|0)<<13|i>>>19,T^=(i=S+N|0)<<18|i>>>14,I^=(i=P+B|0)<<7|i>>>25,E^=(i=I+P|0)<<9|i>>>23,B^=(i=E+I|0)<<13|i>>>19,P^=(i=B+E|0)<<18|i>>>14,x^=(i=D+R|0)<<7|i>>>25,A^=(i=x+D|0)<<9|i>>>23,R^=(i=A+x|0)<<13|i>>>19,D^=(i=R+A|0)<<18|i>>>14,S^=(i=w+x|0)<<7|i>>>25,E^=(i=S+w|0)<<9|i>>>23,x^=(i=E+S|0)<<13|i>>>19,w^=(i=x+E|0)<<18|i>>>14,B^=(i=T+k|0)<<7|i>>>25,A^=(i=B+T|0)<<9|i>>>23,k^=(i=A+B|0)<<13|i>>>19,T^=(i=k+A|0)<<18|i>>>14,R^=(i=P+O|0)<<7|i>>>25,M^=(i=R+P|0)<<9|i>>>23,O^=(i=M+R|0)<<13|i>>>19,P^=(i=O+M|0)<<18|i>>>14,C^=(i=D+I|0)<<7|i>>>25,N^=(i=C+D|0)<<9|i>>>23,I^=(i=N+C|0)<<13|i>>>19,D^=(i=I+N|0)<<18|i>>>14;e[0]=w>>>0&255,e[1]=w>>>8&255,e[2]=w>>>16&255,e[3]=w>>>24&255,e[4]=T>>>0&255,e[5]=T>>>8&255,e[6]=T>>>16&255,e[7]=T>>>24&255,e[8]=P>>>0&255,e[9]=P>>>8&255,e[10]=P>>>16&255,e[11]=P>>>24&255,e[12]=D>>>0&255,e[13]=D>>>8&255,e[14]=D>>>16&255,e[15]=D>>>24&255,e[16]=B>>>0&255,e[17]=B>>>8&255,e[18]=B>>>16&255,e[19]=B>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=M>>>0&255,e[25]=M>>>8&255,e[26]=M>>>16&255,e[27]=M>>>24&255,e[28]=O>>>0&255,e[29]=O>>>8&255,e[30]=O>>>16&255,e[31]=O>>>24&255}function m(e,t,r,n){v(e,t,r,n)}function w(e,t,r,n){b(e,t,r,n)}var S=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function E(e,t,r,n,i,o,s){var a,c,u=new Uint8Array(16),l=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=o[c];for(;i>=64;){for(m(l,u,s,S),c=0;c<64;c++)e[t+c]=r[n+c]^l[c];for(c=8,a=1;c<16;c++)a=a+(255&u[c])|0,u[c]=255&a,a>>>=8;i-=64,t+=64,n+=64}if(i>0)for(m(l,u,s,S),c=0;c=64;){for(m(c,a,i,S),s=0;s<64;s++)e[t+s]=c[s];for(s=8,o=1;s<16;s++)o=o+(255&a[s])|0,a[s]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(m(c,a,i,S),s=0;s>>13|r<<3)&8191,n=255&e[4]|(255&e[5])<<8,this.r[2]=(r>>>10|n<<6)&7939,i=255&e[6]|(255&e[7])<<8,this.r[3]=(n>>>7|i<<9)&8191,o=255&e[8]|(255&e[9])<<8,this.r[4]=(i>>>4|o<<12)&255,this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=(o>>>14|s<<2)&8191,a=255&e[12]|(255&e[13])<<8,this.r[7]=(s>>>11|a<<5)&8065,c=255&e[14]|(255&e[15])<<8,this.r[8]=(a>>>8|c<<8)&8191,this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function A(e,t,r,n,i,o){var s=new B(o);return s.update(r,n,i),s.finish(e,t),0}function M(e,t,r,n,i,o){var s=new Uint8Array(16);return A(s,0,r,n,i,o),g(e,t,s,0)}function O(e,t,r,n,i){var o;if(r<32)return -1;for(T(e,0,t,0,r,n,i),A(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function P(e,t,r,n,i){var o,s=new Uint8Array(32);if(r<32||(k(s,0,32,n,i),0!==M(t,16,t,32,r-32,s)))return -1;for(T(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function R(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function C(e){var t,r,n=1;for(t=0;t<16;t++)n=Math.floor((r=e[t]+n+65535)/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function N(e,t,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function I(e,r){var n,i,o,s=t(),a=t();for(n=0;n<16;n++)a[n]=r[n];for(C(a),C(a),C(a),i=0;i<2;i++){for(n=1,s[0]=a[0]-65517;n<15;n++)s[n]=a[n]-65535-(s[n-1]>>16&1),s[n-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,N(a,s,1-o)}for(n=0;n<16;n++)e[2*n]=255&a[n],e[2*n+1]=a[n]>>8}function D(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return I(r,e),I(n,t),_(r,0,n,0)}function j(e){var t=new Uint8Array(32);return I(t,e),1&t[0]}function U(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function F(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function L(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function W(e,t,r){var n,i,o=0,s=0,a=0,c=0,u=0,l=0,h=0,f=0,p=0,d=0,y=0,g=0,_=0,v=0,b=0,m=0,w=0,S=0,E=0,x=0,k=0,T=0,B=0,A=0,M=0,O=0,P=0,R=0,C=0,N=0,I=0,D=r[0],j=r[1],U=r[2],F=r[3],L=r[4],W=r[5],z=r[6],K=r[7],H=r[8],q=r[9],Y=r[10],G=r[11],$=r[12],V=r[13],J=r[14],Z=r[15];o+=(n=t[0])*D,s+=n*j,a+=n*U,c+=n*F,u+=n*L,l+=n*W,h+=n*z,f+=n*K,p+=n*H,d+=n*q,y+=n*Y,g+=n*G,_+=n*$,v+=n*V,b+=n*J,m+=n*Z,s+=(n=t[1])*D,a+=n*j,c+=n*U,u+=n*F,l+=n*L,h+=n*W,f+=n*z,p+=n*K,d+=n*H,y+=n*q,g+=n*Y,_+=n*G,v+=n*$,b+=n*V,m+=n*J,w+=n*Z,a+=(n=t[2])*D,c+=n*j,u+=n*U,l+=n*F,h+=n*L,f+=n*W,p+=n*z,d+=n*K,y+=n*H,g+=n*q,_+=n*Y,v+=n*G,b+=n*$,m+=n*V,w+=n*J,S+=n*Z,c+=(n=t[3])*D,u+=n*j,l+=n*U,h+=n*F,f+=n*L,p+=n*W,d+=n*z,y+=n*K,g+=n*H,_+=n*q,v+=n*Y,b+=n*G,m+=n*$,w+=n*V,S+=n*J,E+=n*Z,u+=(n=t[4])*D,l+=n*j,h+=n*U,f+=n*F,p+=n*L,d+=n*W,y+=n*z,g+=n*K,_+=n*H,v+=n*q,b+=n*Y,m+=n*G,w+=n*$,S+=n*V,E+=n*J,x+=n*Z,l+=(n=t[5])*D,h+=n*j,f+=n*U,p+=n*F,d+=n*L,y+=n*W,g+=n*z,_+=n*K,v+=n*H,b+=n*q,m+=n*Y,w+=n*G,S+=n*$,E+=n*V,x+=n*J,k+=n*Z,h+=(n=t[6])*D,f+=n*j,p+=n*U,d+=n*F,y+=n*L,g+=n*W,_+=n*z,v+=n*K,b+=n*H,m+=n*q,w+=n*Y,S+=n*G,E+=n*$,x+=n*V,k+=n*J,T+=n*Z,f+=(n=t[7])*D,p+=n*j,d+=n*U,y+=n*F,g+=n*L,_+=n*W,v+=n*z,b+=n*K,m+=n*H,w+=n*q,S+=n*Y,E+=n*G,x+=n*$,k+=n*V,T+=n*J,B+=n*Z,p+=(n=t[8])*D,d+=n*j,y+=n*U,g+=n*F,_+=n*L,v+=n*W,b+=n*z,m+=n*K,w+=n*H,S+=n*q,E+=n*Y,x+=n*G,k+=n*$,T+=n*V,B+=n*J,A+=n*Z,d+=(n=t[9])*D,y+=n*j,g+=n*U,_+=n*F,v+=n*L,b+=n*W,m+=n*z,w+=n*K,S+=n*H,E+=n*q,x+=n*Y,k+=n*G,T+=n*$,B+=n*V,A+=n*J,M+=n*Z,y+=(n=t[10])*D,g+=n*j,_+=n*U,v+=n*F,b+=n*L,m+=n*W,w+=n*z,S+=n*K,E+=n*H,x+=n*q,k+=n*Y,T+=n*G,B+=n*$,A+=n*V,M+=n*J,O+=n*Z,g+=(n=t[11])*D,_+=n*j,v+=n*U,b+=n*F,m+=n*L,w+=n*W,S+=n*z,E+=n*K,x+=n*H,k+=n*q,T+=n*Y,B+=n*G,A+=n*$,M+=n*V,O+=n*J,P+=n*Z,_+=(n=t[12])*D,v+=n*j,b+=n*U,m+=n*F,w+=n*L,S+=n*W,E+=n*z,x+=n*K,k+=n*H,T+=n*q,B+=n*Y,A+=n*G,M+=n*$,O+=n*V,P+=n*J,R+=n*Z,v+=(n=t[13])*D,b+=n*j,m+=n*U,w+=n*F,S+=n*L,E+=n*W,x+=n*z,k+=n*K,T+=n*H,B+=n*q,A+=n*Y,M+=n*G,O+=n*$,P+=n*V,R+=n*J,C+=n*Z,b+=(n=t[14])*D,m+=n*j,w+=n*U,S+=n*F,E+=n*L,x+=n*W,k+=n*z,T+=n*K,B+=n*H,A+=n*q,M+=n*Y,O+=n*G,P+=n*$,R+=n*V,C+=n*J,N+=n*Z,m+=(n=t[15])*D,w+=n*j,S+=n*U,E+=n*F,x+=n*L,k+=n*W,T+=n*z,B+=n*K,A+=n*H,M+=n*q,O+=n*Y,P+=n*G,R+=n*$,C+=n*V,N+=n*J,I+=n*Z,o+=38*w,s+=38*S,a+=38*E,c+=38*x,u+=38*k,l+=38*T,h+=38*B,f+=38*A,p+=38*M,d+=38*O,y+=38*P,g+=38*R,_+=38*C,v+=38*N,b+=38*I,i=Math.floor((n=o+(i=1)+65535)/65536),o=n-65536*i,i=Math.floor((n=s+i+65535)/65536),s=n-65536*i,i=Math.floor((n=a+i+65535)/65536),a=n-65536*i,i=Math.floor((n=c+i+65535)/65536),c=n-65536*i,i=Math.floor((n=u+i+65535)/65536),u=n-65536*i,i=Math.floor((n=l+i+65535)/65536),l=n-65536*i,i=Math.floor((n=h+i+65535)/65536),h=n-65536*i,i=Math.floor((n=f+i+65535)/65536),f=n-65536*i,i=Math.floor((n=p+i+65535)/65536),p=n-65536*i,i=Math.floor((n=d+i+65535)/65536),d=n-65536*i,i=Math.floor((n=y+i+65535)/65536),y=n-65536*i,i=Math.floor((n=g+i+65535)/65536),g=n-65536*i,i=Math.floor((n=_+i+65535)/65536),_=n-65536*i,i=Math.floor((n=v+i+65535)/65536),v=n-65536*i,i=Math.floor((n=b+i+65535)/65536),b=n-65536*i,i=Math.floor((n=m+i+65535)/65536),m=n-65536*i,o+=i-1+37*(i-1),i=Math.floor((n=o+(i=1)+65535)/65536),o=n-65536*i,i=Math.floor((n=s+i+65535)/65536),s=n-65536*i,i=Math.floor((n=a+i+65535)/65536),a=n-65536*i,i=Math.floor((n=c+i+65535)/65536),c=n-65536*i,i=Math.floor((n=u+i+65535)/65536),u=n-65536*i,i=Math.floor((n=l+i+65535)/65536),l=n-65536*i,i=Math.floor((n=h+i+65535)/65536),h=n-65536*i,i=Math.floor((n=f+i+65535)/65536),f=n-65536*i,i=Math.floor((n=p+i+65535)/65536),p=n-65536*i,i=Math.floor((n=d+i+65535)/65536),d=n-65536*i,i=Math.floor((n=y+i+65535)/65536),y=n-65536*i,i=Math.floor((n=g+i+65535)/65536),g=n-65536*i,i=Math.floor((n=_+i+65535)/65536),_=n-65536*i,i=Math.floor((n=v+i+65535)/65536),v=n-65536*i,i=Math.floor((n=b+i+65535)/65536),b=n-65536*i,i=Math.floor((n=m+i+65535)/65536),m=n-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=h,e[7]=f,e[8]=p,e[9]=d,e[10]=y,e[11]=g,e[12]=_,e[13]=v,e[14]=b,e[15]=m}function z(e,t){W(e,t,t)}function K(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)z(i,i),2!==n&&4!==n&&W(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function H(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)z(i,i),1!==n&&W(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function q(e,r,n){var i,o,s=new Uint8Array(32),a=new Float64Array(80),u=t(),l=t(),h=t(),f=t(),p=t(),d=t();for(o=0;o<31;o++)s[o]=r[o];for(s[31]=127&r[31]|64,s[0]&=248,U(a,n),o=0;o<16;o++)l[o]=a[o],f[o]=u[o]=h[o]=0;for(o=254,u[0]=f[0]=1;o>=0;--o)N(u,l,i=s[o>>>3]>>>(7&o)&1),N(h,f,i),F(p,u,h),L(u,u,h),F(h,l,f),L(l,l,f),z(f,p),z(d,u),W(u,h,u),W(h,l,p),F(p,u,h),L(u,u,h),z(l,u),L(h,f,d),W(u,h,c),F(u,u,f),W(h,h,u),W(u,f,d),W(f,l,a),z(l,p),N(u,l,i),N(h,f,i);for(o=0;o<16;o++)a[o+16]=u[o],a[o+32]=h[o],a[o+48]=l[o],a[o+64]=f[o];var y=a.subarray(32),g=a.subarray(16);return K(y,y),W(g,g,y),I(e,g),0}function Y(e,t){return q(e,t,o)}function G(e,t){return n(t,32),Y(e,t)}function $(e,t,r){var n=new Uint8Array(32);return q(n,r,t),w(e,i,n,S)}B.prototype.blocks=function(e,t,r){for(var n,i,o,s,a,c,u,l,h,f,p,d,y,g,_,v,b,m,w,S=this.fin?0:2048,E=this.h[0],x=this.h[1],k=this.h[2],T=this.h[3],B=this.h[4],A=this.h[5],M=this.h[6],O=this.h[7],P=this.h[8],R=this.h[9],C=this.r[0],N=this.r[1],I=this.r[2],D=this.r[3],j=this.r[4],U=this.r[5],F=this.r[6],L=this.r[7],W=this.r[8],z=this.r[9];r>=16;)E+=8191&(n=255&e[t+0]|(255&e[t+1])<<8),x+=(n>>>13|(i=255&e[t+2]|(255&e[t+3])<<8)<<3)&8191,k+=(i>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6)&8191,T+=(o>>>7|(s=255&e[t+6]|(255&e[t+7])<<8)<<9)&8191,B+=(s>>>4|(a=255&e[t+8]|(255&e[t+9])<<8)<<12)&8191,A+=a>>>1&8191,M+=(a>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2)&8191,O+=(c>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5)&8191,P+=(u>>>8|(l=255&e[t+14]|(255&e[t+15])<<8)<<8)&8191,R+=l>>>5|S,h=(f=(h=0)+E*C+5*z*x+5*W*k+5*L*T+5*F*B)>>>13,f&=8191,f+=5*U*A+5*j*M+5*D*O+5*I*P+5*N*R,h+=f>>>13,f&=8191,h=(p=h+E*N+x*C+5*z*k+5*W*T+5*L*B)>>>13,p&=8191,p+=5*F*A+5*U*M+5*j*O+5*D*P+5*I*R,h+=p>>>13,p&=8191,h=(d=h+E*I+x*N+k*C+5*z*T+5*W*B)>>>13,d&=8191,d+=5*L*A+5*F*M+5*U*O+5*j*P+5*D*R,h+=d>>>13,d&=8191,h=(y=h+E*D+x*I+k*N+T*C+5*z*B)>>>13,y&=8191,y+=5*W*A+5*L*M+5*F*O+5*U*P+5*j*R,h+=y>>>13,y&=8191,h=(g=h+E*j+x*D+k*I+T*N+B*C)>>>13,g&=8191,g+=5*z*A+5*W*M+5*L*O+5*F*P+5*U*R,h+=g>>>13,g&=8191,h=(_=h+E*U+x*j+k*D+T*I+B*N)>>>13,_&=8191,_+=A*C+5*z*M+5*W*O+5*L*P+5*F*R,h+=_>>>13,_&=8191,h=(v=h+E*F+x*U+k*j+T*D+B*I)>>>13,v&=8191,v+=A*N+M*C+5*z*O+5*W*P+5*L*R,h+=v>>>13,v&=8191,h=(b=h+E*L+x*F+k*U+T*j+B*D)>>>13,b&=8191,b+=A*I+M*N+O*C+5*z*P+5*W*R,h+=b>>>13,b&=8191,h=(m=h+E*W+x*L+k*F+T*U+B*j)>>>13,m&=8191,m+=A*D+M*I+O*N+P*C+5*z*R,h+=m>>>13,m&=8191,h=(w=h+E*z+x*W+k*L+T*F+B*U)>>>13,w&=8191,w+=A*j+M*D+O*I+P*N+R*C,h+=w>>>13,w&=8191,f=8191&(h=(h=(h<<2)+h|0)+f|0),h>>>=13,p+=h,E=f,x=p,k=d,T=y,B=g,A=_,M=v,O=b,P=m,R=w,t+=16,r-=16;this.h[0]=E,this.h[1]=x,this.h[2]=k,this.h[3]=T,this.h[4]=B,this.h[5]=A,this.h[6]=M,this.h[7]=O,this.h[8]=P,this.h[9]=R},B.prototype.finish=function(e,t){var r,n,i,o,s=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,s[0]=this.h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this.h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(o=0,n=~n;o<10;o++)this.h[o]=this.h[o]&n|s[o];for(o=1,this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,i=this.h[0]+this.pad[0],this.h[0]=65535&i;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},B.prototype.update=function(e,t,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n=128;){for(S=0;S<16;S++)E=8*S+$,O[S]=r[E+0]<<24|r[E+1]<<16|r[E+2]<<8|r[E+3],P[S]=r[E+4]<<24|r[E+5]<<16|r[E+6]<<8|r[E+7];for(S=0;S<80;S++)if(i=R,o=C,s=N,a=I,c=D,u=j,l=U,h=F,f=L,p=W,d=z,y=K,g=H,_=q,v=Y,b=G,x=F,T=65535&(k=G),B=k>>>16,A=65535&x,M=x>>>16,x=(D>>>14|H<<18)^(D>>>18|H<<14)^(H>>>9|D<<23),T+=65535&(k=(H>>>14|D<<18)^(H>>>18|D<<14)^(D>>>9|H<<23)),B+=k>>>16,A+=65535&x,M+=x>>>16,x=D&j^~D&U,T+=65535&(k=H&q^~H&Y),B+=k>>>16,A+=65535&x,M+=x>>>16,x=Q[2*S],T+=65535&(k=Q[2*S+1]),B+=k>>>16,A+=65535&x,M+=x>>>16,x=O[S%16],T+=65535&(k=P[S%16]),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,m=65535&A|M<<16,w=65535&T|B<<16,x=m,T=65535&(k=w),B=k>>>16,A=65535&x,M=x>>>16,x=(R>>>28|L<<4)^(L>>>2|R<<30)^(L>>>7|R<<25),T+=65535&(k=(L>>>28|R<<4)^(R>>>2|L<<30)^(R>>>7|L<<25)),B+=k>>>16,A+=65535&x,M+=x>>>16,x=R&C^R&N^C&N,T+=65535&(k=L&W^L&z^W&z),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,h=65535&A|M<<16,b=65535&T|B<<16,x=a,T=65535&(k=y),B=k>>>16,A=65535&x,M=x>>>16,x=m,T+=65535&(k=w),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,a=65535&A|M<<16,y=65535&T|B<<16,C=i,N=o,I=s,D=a,j=c,U=u,F=l,R=h,W=f,z=p,K=d,H=y,q=g,Y=_,G=v,L=b,S%16==15)for(E=0;E<16;E++)x=O[E],T=65535&(k=P[E]),B=k>>>16,A=65535&x,M=x>>>16,x=O[(E+9)%16],T+=65535&(k=P[(E+9)%16]),B+=k>>>16,A+=65535&x,M+=x>>>16,x=((m=O[(E+1)%16])>>>1|(w=P[(E+1)%16])<<31)^(m>>>8|w<<24)^m>>>7,T+=65535&(k=(w>>>1|m<<31)^(w>>>8|m<<24)^(w>>>7|m<<25)),B+=k>>>16,A+=65535&x,M+=x>>>16,x=((m=O[(E+14)%16])>>>19|(w=P[(E+14)%16])<<13)^(w>>>29|m<<3)^m>>>6,T+=65535&(k=(w>>>19|m<<13)^(m>>>29|w<<3)^(w>>>6|m<<26)),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,O[E]=65535&A|M<<16,P[E]=65535&T|B<<16;x=R,T=65535&(k=L),B=k>>>16,A=65535&x,M=x>>>16,x=e[0],T+=65535&(k=t[0]),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,e[0]=R=65535&A|M<<16,t[0]=L=65535&T|B<<16,x=C,T=65535&(k=W),B=k>>>16,A=65535&x,M=x>>>16,x=e[1],T+=65535&(k=t[1]),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,e[1]=C=65535&A|M<<16,t[1]=W=65535&T|B<<16,x=N,T=65535&(k=z),B=k>>>16,A=65535&x,M=x>>>16,x=e[2],T+=65535&(k=t[2]),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,e[2]=N=65535&A|M<<16,t[2]=z=65535&T|B<<16,x=I,T=65535&(k=K),B=k>>>16,A=65535&x,M=x>>>16,x=e[3],T+=65535&(k=t[3]),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,e[3]=I=65535&A|M<<16,t[3]=K=65535&T|B<<16,x=D,T=65535&(k=H),B=k>>>16,A=65535&x,M=x>>>16,x=e[4],T+=65535&(k=t[4]),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,e[4]=D=65535&A|M<<16,t[4]=H=65535&T|B<<16,x=j,T=65535&(k=q),B=k>>>16,A=65535&x,M=x>>>16,x=e[5],T+=65535&(k=t[5]),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,e[5]=j=65535&A|M<<16,t[5]=q=65535&T|B<<16,x=U,T=65535&(k=Y),B=k>>>16,A=65535&x,M=x>>>16,x=e[6],T+=65535&(k=t[6]),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,e[6]=U=65535&A|M<<16,t[6]=Y=65535&T|B<<16,x=F,T=65535&(k=G),B=k>>>16,A=65535&x,M=x>>>16,x=e[7],T+=65535&(k=t[7]),B+=k>>>16,A+=65535&x,M+=x>>>16,B+=T>>>16,A+=B>>>16,M+=A>>>16,e[7]=F=65535&A|M<<16,t[7]=G=65535&T|B<<16,$+=128,n-=128}return n}function et(e,t,r){var n,i=new Int32Array(8),o=new Int32Array(8),s=new Uint8Array(256),a=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,ee(i,o,t,r),r%=128,n=0;n=0;--i)en(e,t,n=r[i/8|0]>>(7&i)&1),er(t,e),er(e,e),en(e,t,n)}function es(e,r){var n=[t(),t(),t(),t()];R(n[0],h),R(n[1],f),R(n[2],a),W(n[3],h,f),eo(e,n,r)}function ea(e,r,i){var o,s=new Uint8Array(64),a=[t(),t(),t(),t()];for(i||n(r,32),et(s,r,32),s[0]&=248,s[31]&=127,s[31]|=64,es(a,s),ei(e,a),o=0;o<32;o++)r[o+32]=e[o];return 0}var ec=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function eu(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*ec[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ec[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function el(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;eu(e,r)}function eh(e,r,n,i){var o,s,a=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),l=new Float64Array(64),h=[t(),t(),t(),t()];et(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=n+64;for(o=0;o>7&&L(e[0],s,e[0]),W(e[3],e[0],e[1]),0)}function ep(e,r,n,i){var o,s=new Uint8Array(32),a=new Uint8Array(64),c=[t(),t(),t(),t()],u=[t(),t(),t(),t()];if(n<64||ef(u,i))return -1;for(o=0;o=0},e.sign.keyPair=function(){var e=new Uint8Array(eB),t=new Uint8Array(eA);return ea(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(eC(e),e.length!==eA)throw Error("bad secret key size");for(var t=new Uint8Array(eB),r=0;r=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),a=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(r)?n.showHidden=r:r&&t._extend(n,r),T(n.showHidden)&&(n.showHidden=!1),T(n.depth)&&(n.depth=2),T(n.colors)&&(n.colors=!1),T(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=l),p(n,e,n.depth)}function l(e,t){var r=u.styles[t];return r?"\x1b["+u.colors[r][0]+"m"+e+"\x1b["+u.colors[r][1]+"m":e}function h(e,t){return e}function f(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function p(e,r,n){if(e.customInspect&&r&&P(r.inspect)&&r.inspect!==t.inspect&&!(r.constructor&&r.constructor.prototype===r)){var i,o=r.inspect(n,e);return x(o)||(o=p(e,o,n)),o}var s=d(e,r);if(s)return s;var a=Object.keys(r),c=f(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),O(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return y(r);if(0===a.length){if(P(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(B(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(M(r))return e.stylize(Date.prototype.toString.call(r),"date");if(O(r))return y(r)}var l="",h=!1,m=["{","}"];return(b(r)&&(h=!0,m=["[","]"]),P(r)&&(l=" [Function"+(r.name?": "+r.name:"")+"]"),B(r)&&(l=" "+RegExp.prototype.toString.call(r)),M(r)&&(l=" "+Date.prototype.toUTCString.call(r)),O(r)&&(l=" "+y(r)),0!==a.length||h&&0!=r.length)?n<0?B(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),i=h?g(e,r,n,c,a):a.map(function(t){return _(e,r,n,c,t,h)}),e.seen.pop(),v(i,l,m)):m[0]+l+m[1]}function d(e,t){if(T(t))return e.stylize("undefined","undefined");if(x(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return E(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):w(t)?e.stylize("null","null"):void 0}function y(e){return"["+Error.prototype.toString.call(e)+"]"}function g(e,t,r,n,i){for(var o=[],s=0,a=t.length;se.seen.indexOf(c.value)?(a=w(r)?p(e,c.value,null):p(e,c.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").slice(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),T(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.slice(1,-1),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function v(e,t,r){var n=0;return e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function b(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function w(e){return null===e}function S(e){return null==e}function E(e){return"number"==typeof e}function x(e){return"string"==typeof e}function k(e){return"symbol"==typeof e}function T(e){return void 0===e}function B(e){return A(e)&&"[object RegExp]"===C(e)}function A(e){return"object"==typeof e&&null!==e}function M(e){return A(e)&&"[object Date]"===C(e)}function O(e){return A(e)&&("[object Error]"===C(e)||e instanceof Error)}function P(e){return"function"==typeof e}function R(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function C(e){return Object.prototype.toString.call(e)}function N(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(!s[e=e.toUpperCase()]){if(a.test(e)){var r=n.pid;s[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else s[e]=function(){}}return s[e]},t.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(42613),t.isArray=b,t.isBoolean=m,t.isNull=w,t.isNullOrUndefined=S,t.isNumber=E,t.isString=x,t.isSymbol=k,t.isUndefined=T,t.isRegExp=B,t.types.isRegExp=B,t.isObject=A,t.isDate=M,t.types.isDate=M,t.isError=O,t.types.isNativeError=O,t.isFunction=P,t.isPrimitive=R,t.isBuffer=r(4330);var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function D(){var e=new Date,t=[N(e.getHours()),N(e.getMinutes()),N(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function j(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",D(),t.format.apply(t,arguments))},t.inherits=r(87398),t._extend=function(e,t){if(!t||!A(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var U="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function F(e,t){if(!e){var r=Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}function L(e){if("function"!=typeof e)throw TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r-1?t:"Object"===t&&_(e)}return a?g(e):null}},59436:function(e,t,r){"use strict";var n=r(76269),i="undefined"==typeof globalThis?r.g:globalThis;e.exports=function(){for(var e=[],t=0;tl;)if((a=c[l++])!=a)return!0}else for(;u>l;l++)if((e||l in c)&&c[l]===r)return e||l||0;return!e&&-1}};e.exports={includes:s(!0),indexOf:s(!1)}},19713:function(e,t,r){"use strict";var n=r(905);e.exports=n([].slice)},66749:function(e,t,r){"use strict";var n=r(4235)("iterator"),i=!1;try{var o=0,s={next:function(){return{done:!!o++}},return:function(){i=!0}};s[n]=function(){return this},Array.from(s,function(){throw 2})}catch(e){}e.exports=function(e,t){try{if(!t&&!i)return!1}catch(e){return!1}var r=!1;try{var o={};o[n]=function(){return{next:function(){return{done:r=!0}}}},e(o)}catch(e){}return r}},90651:function(e,t,r){"use strict";var n=r(905),i=n({}.toString),o=n("".slice);e.exports=function(e){return o(i(e),8,-1)}},74457:function(e,t,r){"use strict";var n=r(77448),i=r(19415),o=r(90651),s=r(4235)("toStringTag"),a=Object,c="Arguments"===o(function(){return arguments}()),u=function(e,t){try{return e[t]}catch(e){}};e.exports=n?o:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=u(t=a(e),s))?r:c?o(t):"Object"===(n=o(t))&&i(t.callee)?"Arguments":n}},76828:function(e,t,r){"use strict";var n=r(95945),i=r(25573),o=r(38562),s=r(79606);e.exports=function(e,t,r){for(var a=i(t),c=s.f,u=o.f,l=0;l0&&n[0]<4?1:+(n[0]+n[1])),!i&&s&&(!(n=s.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=s.match(/Chrome\/(\d+)/))&&(i=+n[1]),e.exports=i},2482:function(e){"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},90685:function(e,t,r){"use strict";var n=r(905),i=Error,o=n("".replace),s=function(e){return String(new i(e).stack)}("zxcasd"),a=/\n\s*at [^:]*:[^\n]*/,c=a.test(s);e.exports=function(e,t){if(c&&"string"==typeof e&&!i.prepareStackTrace)for(;t--;)e=o(e,a,"");return e}},11729:function(e,t,r){"use strict";var n=r(57780),i=r(90685),o=r(43338),s=Error.captureStackTrace;e.exports=function(e,t,r,a){o&&(s?s(e,t):n(e,"stack",i(r,a)))}},43338:function(e,t,r){"use strict";var n=r(78877),i=r(27737);e.exports=!n(function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",i(1,7)),7!==e.stack)})},67441:function(e,t,r){"use strict";var n=r(21936),i=r(535),o=r(92708),s=r(19415),a=r(38562).f,c=r(25086),u=r(39862),l=r(26508),h=r(57780),f=r(95945);r(74327);var p=function(e){var t=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,o)}return i(e,this,arguments)};return t.prototype=e.prototype,t};e.exports=function(e,t){var r,i,d,y,g,_,v,b,m,w=e.target,S=e.global,E=e.stat,x=e.proto,k=S?n:E?n[w]:n[w]&&n[w].prototype,T=S?u:u[w]||h(u,w,{})[w],B=T.prototype;for(y in t)i=!(r=c(S?y:w+(E?".":"#")+y,e.forced))&&k&&f(k,y),_=T[y],i&&(v=e.dontCallGetSet?(m=a(k,y))&&m.value:k[y]),g=i&&v?v:t[y],(r||x||typeof _!=typeof g)&&(b=e.bind&&i?l(g,n):e.wrap&&i?p(g):x&&s(g)?o(g):g,(e.sham||g&&g.sham||_&&_.sham)&&h(b,"sham",!0),h(T,y,b),x&&(f(u,d=w+"Prototype")||h(u,d,{}),h(u[d],y,g),e.real&&B&&(r||!B[y])&&h(B,y,g)))}},78877:function(e){"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},535:function(e,t,r){"use strict";var n=r(69544),i=Function.prototype,o=i.apply,s=i.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?s.bind(o):function(){return s.apply(o,arguments)})},26508:function(e,t,r){"use strict";var n=r(92708),i=r(39135),o=r(69544),s=n(n.bind);e.exports=function(e,t){return i(e),void 0===t?e:o?s(e,t):function(){return e.apply(t,arguments)}}},69544:function(e,t,r){"use strict";var n=r(78877);e.exports=!n(function(){var e=(function(){}).bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})},10131:function(e,t,r){"use strict";var n=r(69544),i=Function.prototype.call;e.exports=n?i.bind(i):function(){return i.apply(i,arguments)}},2140:function(e,t,r){"use strict";var n=r(83594),i=r(95945),o=Function.prototype,s=n&&Object.getOwnPropertyDescriptor,a=i(o,"name"),c=a&&"something"===(function(){}).name,u=a&&(!n||n&&s(o,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:u}},36222:function(e,t,r){"use strict";var n=r(905),i=r(39135);e.exports=function(e,t,r){try{return n(i(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}}},92708:function(e,t,r){"use strict";var n=r(90651),i=r(905);e.exports=function(e){if("Function"===n(e))return i(e)}},905:function(e,t,r){"use strict";var n=r(69544),i=Function.prototype,o=i.call,s=n&&i.bind.bind(o,o);e.exports=n?s:function(e){return function(){return o.apply(e,arguments)}}},54714:function(e,t,r){"use strict";var n=r(39862),i=r(21936),o=r(19415),s=function(e){return o(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?s(n[e])||s(i[e]):n[e]&&n[e][t]||i[e]&&i[e][t]}},58289:function(e,t,r){"use strict";var n=r(74457),i=r(22927),o=r(55654),s=r(39078),a=r(4235)("iterator");e.exports=function(e){if(!o(e))return i(e,a)||i(e,"@@iterator")||s[n(e)]}},57806:function(e,t,r){"use strict";var n=r(10131),i=r(39135),o=r(21926),s=r(1734),a=r(58289),c=TypeError;e.exports=function(e,t){var r=arguments.length<2?a(e):t;if(i(r))return o(n(r,e));throw new c(s(e)+" is not iterable")}},22927:function(e,t,r){"use strict";var n=r(39135),i=r(55654);e.exports=function(e,t){var r=e[t];return i(r)?void 0:n(r)}},21936:function(e,t,r){"use strict";var n=function(e){return e&&e.Math===Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||n("object"==typeof this&&this)||function(){return this}()||Function("return this")()},95945:function(e,t,r){"use strict";var n=r(905),i=r(15554),o=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(i(e),t)}},34716:function(e){"use strict";e.exports={}},41783:function(e){"use strict";e.exports=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}}},53566:function(e,t,r){"use strict";var n=r(54714);e.exports=n("document","documentElement")},48376:function(e,t,r){"use strict";var n=r(83594),i=r(78877),o=r(8789);e.exports=!n&&!i(function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a})},68206:function(e,t,r){"use strict";var n=r(905),i=r(78877),o=r(90651),s=Object,a=n("".split);e.exports=i(function(){return!s("z").propertyIsEnumerable(0)})?function(e){return"String"===o(e)?a(e,""):s(e)}:s},24040:function(e,t,r){"use strict";var n=r(905),i=r(19415),o=r(74327),s=n(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return s(e)}),e.exports=o.inspectSource},79885:function(e,t,r){"use strict";var n=r(27894),i=r(57780);e.exports=function(e,t){n(t)&&"cause"in t&&i(e,"cause",t.cause)}},6308:function(e,t,r){"use strict";var n,i,o,s=r(31629),a=r(21936),c=r(27894),u=r(57780),l=r(95945),h=r(74327),f=r(46859),p=r(34716),d="Object already initialized",y=a.TypeError,g=a.WeakMap,_=function(e){return o(e)?i(e):n(e,{})},v=function(e){return function(t){var r;if(!c(t)||(r=i(t)).type!==e)throw new y("Incompatible receiver, "+e+" required");return r}};if(s||h.state){var b=h.state||(h.state=new g);b.get=b.get,b.has=b.has,b.set=b.set,n=function(e,t){if(b.has(e))throw new y(d);return t.facade=e,b.set(e,t),t},i=function(e){return b.get(e)||{}},o=function(e){return b.has(e)}}else{var m=f("state");p[m]=!0,n=function(e,t){if(l(e,m))throw new y(d);return t.facade=e,u(e,m,t),t},i=function(e){return l(e,m)?e[m]:{}},o=function(e){return l(e,m)}}e.exports={set:n,get:i,has:o,enforce:_,getterFor:v}},11071:function(e,t,r){"use strict";var n=r(4235),i=r(39078),o=n("iterator"),s=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||s[o]===e)}},19415:function(e){"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},69439:function(e,t,r){"use strict";var n=r(905),i=r(78877),o=r(19415),s=r(74457),a=r(54714),c=r(24040),u=function(){},l=a("Reflect","construct"),h=/^\s*(?:class|function)\b/,f=n(h.exec),p=!h.test(u),d=function(e){if(!o(e))return!1;try{return l(u,[],e),!0}catch(e){return!1}},y=function(e){if(!o(e))return!1;switch(s(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!f(h,c(e))}catch(e){return!0}};y.sham=!0,e.exports=!l||i(function(){var e;return d(d.call)||!d(Object)||!d(function(){e=!0})||e})?y:d},25086:function(e,t,r){"use strict";var n=r(78877),i=r(19415),o=/#|\.prototype\./,s=function(e,t){var r=c[a(e)];return r===l||r!==u&&(i(t)?n(t):!!t)},a=s.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=s.data={},u=s.NATIVE="N",l=s.POLYFILL="P";e.exports=s},55654:function(e){"use strict";e.exports=function(e){return null==e}},27894:function(e,t,r){"use strict";var n=r(19415);e.exports=function(e){return"object"==typeof e?null!==e:n(e)}},18168:function(e,t,r){"use strict";var n=r(27894);e.exports=function(e){return n(e)||null===e}},84446:function(e){"use strict";e.exports=!0},28610:function(e,t,r){"use strict";var n=r(54714),i=r(19415),o=r(86466),s=r(59624),a=Object;e.exports=s?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return i(t)&&o(t.prototype,a(e))}},53924:function(e,t,r){"use strict";var n=r(26508),i=r(10131),o=r(21926),s=r(1734),a=r(11071),c=r(80210),u=r(86466),l=r(57806),h=r(58289),f=r(79031),p=TypeError,d=function(e,t){this.stopped=e,this.result=t},y=d.prototype;e.exports=function(e,t,r){var g,_,v,b,m,w,S,E=r&&r.that,x=!!(r&&r.AS_ENTRIES),k=!!(r&&r.IS_RECORD),T=!!(r&&r.IS_ITERATOR),B=!!(r&&r.INTERRUPTED),A=n(t,E),M=function(e){return g&&f(g,"normal",e),new d(!0,e)},O=function(e){return x?(o(e),B?A(e[0],e[1],M):A(e[0],e[1])):B?A(e,M):A(e)};if(k)g=e.iterator;else if(T)g=e;else{if(!(_=h(e)))throw new p(s(e)+" is not iterable");if(a(_)){for(v=0,b=c(e);b>v;v++)if((m=O(e[v]))&&u(y,m))return m;return new d(!1)}g=l(e,_)}for(w=k?e.next:g.next;!(S=i(w,g)).done;){try{m=O(S.value)}catch(e){f(g,"throw",e)}if("object"==typeof m&&m&&u(y,m))return m}return new d(!1)}},79031:function(e,t,r){"use strict";var n=r(10131),i=r(21926),o=r(22927);e.exports=function(e,t,r){var s,a;i(e);try{if(!(s=o(e,"return"))){if("throw"===t)throw r;return r}s=n(s,e)}catch(e){a=!0,s=e}if("throw"===t)throw r;if(a)throw s;return i(s),r}},87278:function(e,t,r){"use strict";var n=r(55795).IteratorPrototype,i=r(50994),o=r(27737),s=r(20215),a=r(39078),c=function(){return this};e.exports=function(e,t,r,u){var l=t+" Iterator";return e.prototype=i(n,{next:o(+!u,r)}),s(e,l,!1,!0),a[l]=c,e}},9383:function(e,t,r){"use strict";var n=r(67441),i=r(10131),o=r(84446),s=r(2140),a=r(19415),c=r(87278),u=r(33634),l=r(57086),h=r(20215),f=r(57780),p=r(33849),d=r(4235),y=r(39078),g=r(55795),_=s.PROPER,v=s.CONFIGURABLE,b=g.IteratorPrototype,m=g.BUGGY_SAFARI_ITERATORS,w=d("iterator"),S="keys",E="values",x="entries",k=function(){return this};e.exports=function(e,t,r,s,d,g,T){c(r,t,s);var B,A,M,O=function(e){if(e===d&&I)return I;if(!m&&e&&e in C)return C[e];switch(e){case S:case E:case x:return function(){return new r(this,e)}}return function(){return new r(this)}},P=t+" Iterator",R=!1,C=e.prototype,N=C[w]||C["@@iterator"]||d&&C[d],I=!m&&N||O(d),D="Array"===t&&C.entries||N;if(D&&(B=u(D.call(new e)))!==Object.prototype&&B.next&&(o||u(B)===b||(l?l(B,b):a(B[w])||p(B,w,k)),h(B,P,!0,!0),o&&(y[P]=k)),_&&d===E&&N&&N.name!==E&&(!o&&v?f(C,"name",E):(R=!0,I=function(){return i(N,this)})),d){if(A={values:O(E),keys:g?I:O(S),entries:O(x)},T)for(M in A)!m&&!R&&M in C||p(C,M,A[M]);else n({target:t,proto:!0,forced:m||R},A)}return(!o||T)&&C[w]!==I&&p(C,w,I,{name:d}),y[t]=I,A}},55795:function(e,t,r){"use strict";var n,i,o,s=r(78877),a=r(19415),c=r(27894),u=r(50994),l=r(33634),h=r(33849),f=r(4235),p=r(84446),d=f("iterator"),y=!1;[].keys&&("next"in(o=[].keys())?(i=l(l(o)))!==Object.prototype&&(n=i):y=!0),!c(n)||s(function(){var e={};return n[d].call(e)!==e})?n={}:p&&(n=u(n)),a(n[d])||h(n,d,function(){return this}),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:y}},39078:function(e){"use strict";e.exports={}},80210:function(e,t,r){"use strict";var n=r(83221);e.exports=function(e){return n(e.length)}},92903:function(e){"use strict";var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){var n=+e;return(n>0?r:t)(n)}},31794:function(e,t,r){"use strict";var n,i,o,s,a,c=r(21936),u=r(67761),l=r(26508),h=r(56482).set,f=r(16582),p=r(41777),d=r(95971),y=r(70129),g=r(8704),_=c.MutationObserver||c.WebKitMutationObserver,v=c.document,b=c.process,m=c.Promise,w=u("queueMicrotask");if(!w){var S=new f,E=function(){var e,t;for(g&&(e=b.domain)&&e.exit();t=S.get();)try{t()}catch(e){throw S.head&&n(),e}e&&e.enter()};p||g||y||!_||!v?!d&&m&&m.resolve?((s=m.resolve(void 0)).constructor=m,a=l(s.then,s),n=function(){a(E)}):g?n=function(){b.nextTick(E)}:(h=l(h,c),n=function(){h(E)}):(i=!0,o=v.createTextNode(""),new _(E).observe(o,{characterData:!0}),n=function(){o.data=i=!i}),w=function(e){S.head||n(),S.add(e)}}e.exports=w},41355:function(e,t,r){"use strict";var n=r(39135),i=TypeError,o=function(e){var t,r;this.promise=new e(function(e,n){if(void 0!==t||void 0!==r)throw new i("Bad Promise constructor");t=e,r=n}),this.resolve=n(t),this.reject=n(r)};e.exports.f=function(e){return new o(e)}},20736:function(e,t,r){"use strict";var n=r(10182);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:n(e)}},50994:function(e,t,r){"use strict";var n,i=r(21926),o=r(41889),s=r(2482),a=r(34716),c=r(53566),u=r(8789),l=r(46859),h=">",f="<",p="prototype",d="script",y=l("IE_PROTO"),g=function(){},_=function(e){return f+d+h+e+f+"/"+d+h},v=function(e){e.write(_("")),e.close();var t=e.parentWindow.Object;return e=null,t},b=function(){var e,t=u("iframe"),r="java"+d+":";return t.style.display="none",c.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(_("document.F=Object")),e.close(),e.F},m=function(){try{n=new ActiveXObject("htmlfile")}catch(e){}m="undefined"!=typeof document?document.domain&&n?v(n):b():v(n);for(var e=s.length;e--;)delete m[p][s[e]];return m()};a[y]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(g[p]=i(e),r=new g,g[p]=null,r[y]=e):r=m(),void 0===t?r:o.f(r,t)}},41889:function(e,t,r){"use strict";var n=r(83594),i=r(60125),o=r(79606),s=r(21926),a=r(95777),c=r(33273);t.f=n&&!i?Object.defineProperties:function(e,t){s(e);for(var r,n=a(t),i=c(t),u=i.length,l=0;u>l;)o.f(e,r=i[l++],n[r]);return e}},79606:function(e,t,r){"use strict";var n=r(83594),i=r(48376),o=r(60125),s=r(21926),a=r(28591),c=TypeError,u=Object.defineProperty,l=Object.getOwnPropertyDescriptor,h="enumerable",f="configurable",p="writable";t.f=n?o?function(e,t,r){if(s(e),t=a(t),s(r),"function"==typeof e&&"prototype"===t&&"value"in r&&p in r&&!r[p]){var n=l(e,t);n&&n[p]&&(e[t]=r.value,r={configurable:f in r?r[f]:n[f],enumerable:h in r?r[h]:n[h],writable:!1})}return u(e,t,r)}:u:function(e,t,r){if(s(e),t=a(t),s(r),i)try{return u(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new c("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},38562:function(e,t,r){"use strict";var n=r(83594),i=r(10131),o=r(95855),s=r(27737),a=r(95777),c=r(28591),u=r(95945),l=r(48376),h=Object.getOwnPropertyDescriptor;t.f=n?h:function(e,t){if(e=a(e),t=c(t),l)try{return h(e,t)}catch(e){}if(u(e,t))return s(!i(o.f,e,t),e[t])}},50640:function(e,t,r){"use strict";var n=r(19025),i=r(2482).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},19894:function(e,t){"use strict";t.f=Object.getOwnPropertySymbols},33634:function(e,t,r){"use strict";var n=r(95945),i=r(19415),o=r(15554),s=r(46859),a=r(46675),c=s("IE_PROTO"),u=Object,l=u.prototype;e.exports=a?u.getPrototypeOf:function(e){var t=o(e);if(n(t,c))return t[c];var r=t.constructor;return i(r)&&t instanceof r?r.prototype:t instanceof u?l:null}},86466:function(e,t,r){"use strict";var n=r(905);e.exports=n({}.isPrototypeOf)},19025:function(e,t,r){"use strict";var n=r(905),i=r(95945),o=r(95777),s=r(1056).indexOf,a=r(34716),c=n([].push);e.exports=function(e,t){var r,n=o(e),u=0,l=[];for(r in n)!i(a,r)&&i(n,r)&&c(l,r);for(;t.length>u;)i(n,r=t[u++])&&(~s(l,r)||c(l,r));return l}},33273:function(e,t,r){"use strict";var n=r(19025),i=r(2482);e.exports=Object.keys||function(e){return n(e,i)}},95855:function(e,t){"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!r.call({1:2},1);t.f=i?function(e){var t=n(this,e);return!!t&&t.enumerable}:r},57086:function(e,t,r){"use strict";var n=r(36222),i=r(27894),o=r(99995),s=r(93911);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=n(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return o(r),s(n),i(r)&&(t?e(r,n):r.__proto__=n),r}}():void 0)},66238:function(e,t,r){"use strict";var n=r(77448),i=r(74457);e.exports=n?({}).toString:function(){return"[object "+i(this)+"]"}},57202:function(e,t,r){"use strict";var n=r(10131),i=r(19415),o=r(27894),s=TypeError;e.exports=function(e,t){var r,a;if("string"===t&&i(r=e.toString)&&!o(a=n(r,e))||i(r=e.valueOf)&&!o(a=n(r,e))||"string"!==t&&i(r=e.toString)&&!o(a=n(r,e)))return a;throw new s("Can't convert object to primitive value")}},25573:function(e,t,r){"use strict";var n=r(54714),i=r(905),o=r(50640),s=r(19894),a=r(21926),c=i([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=o.f(a(e)),r=s.f;return r?c(t,r(e)):t}},39862:function(e){"use strict";e.exports={}},96636:function(e){"use strict";e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},41991:function(e,t,r){"use strict";var n=r(21936),i=r(82788),o=r(19415),s=r(25086),a=r(24040),c=r(4235),u=r(6850),l=r(30900),h=r(84446),f=r(86838),p=i&&i.prototype,d=c("species"),y=!1,g=o(n.PromiseRejectionEvent),_=s("Promise",function(){var e=a(i),t=e!==String(i);if(!t&&66===f||h&&!(p.catch&&p.finally))return!0;if(!f||f<51||!/native code/.test(e)){var r=new i(function(e){e(1)}),n=function(e){e(function(){},function(){})};if((r.constructor={})[d]=n,!(y=r.then(function(){}) instanceof n))return!0}return!t&&(u||l)&&!g});e.exports={CONSTRUCTOR:_,REJECTION_EVENT:g,SUBCLASSING:y}},82788:function(e,t,r){"use strict";var n=r(21936);e.exports=n.Promise},41496:function(e,t,r){"use strict";var n=r(21926),i=r(27894),o=r(41355);e.exports=function(e,t){if(n(e),i(t)&&t.constructor===e)return t;var r=o.f(e);return(0,r.resolve)(t),r.promise}},52672:function(e,t,r){"use strict";var n=r(82788),i=r(66749),o=r(41991).CONSTRUCTOR;e.exports=o||!i(function(e){n.all(e).then(void 0,function(){})})},16582:function(e){"use strict";var t=function(){this.head=null,this.tail=null};t.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}},e.exports=t},99995:function(e,t,r){"use strict";var n=r(55654),i=TypeError;e.exports=function(e){if(n(e))throw new i("Can't call method on "+e);return e}},67761:function(e,t,r){"use strict";var n=r(21936),i=r(83594),o=Object.getOwnPropertyDescriptor;e.exports=function(e){if(!i)return n[e];var t=o(n,e);return t&&t.value}},26638:function(e,t,r){"use strict";var n=r(54714),i=r(53669),o=r(4235),s=r(83594),a=o("species");e.exports=function(e){var t=n(e);s&&t&&!t[a]&&i(t,a,{configurable:!0,get:function(){return this}})}},20215:function(e,t,r){"use strict";var n=r(77448),i=r(79606).f,o=r(57780),s=r(95945),a=r(66238),c=r(4235)("toStringTag");e.exports=function(e,t,r,u){var l=r?e:e&&e.prototype;l&&(s(l,c)||i(l,c,{configurable:!0,value:t}),u&&!n&&o(l,"toString",a))}},46859:function(e,t,r){"use strict";var n=r(91474),i=r(50168),o=n("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},74327:function(e,t,r){"use strict";var n=r(84446),i=r(21936),o=r(87359),s="__core-js_shared__",a=e.exports=i[s]||o(s,{});(a.versions||(a.versions=[])).push({version:"3.37.1",mode:n?"pure":"global",copyright:"\xa9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE",source:"https://github.com/zloirock/core-js"})},91474:function(e,t,r){"use strict";var n=r(74327);e.exports=function(e,t){return n[e]||(n[e]=t||{})}},87199:function(e,t,r){"use strict";var n=r(21926),i=r(20404),o=r(55654),s=r(4235)("species");e.exports=function(e,t){var r,a=n(e).constructor;return void 0===a||o(r=n(a)[s])?t:i(r)}},52856:function(e,t,r){"use strict";var n=r(905),i=r(1164),o=r(10182),s=r(99995),a=n("".charAt),c=n("".charCodeAt),u=n("".slice),l=function(e){return function(t,r){var n,l,h=o(s(t)),f=i(r),p=h.length;return f<0||f>=p?e?"":void 0:(n=c(h,f))<55296||n>56319||f+1===p||(l=c(h,f+1))<56320||l>57343?e?a(h,f):n:e?u(h,f,f+2):(n-55296<<10)+(l-56320)+65536}};e.exports={codeAt:l(!1),charAt:l(!0)}},25892:function(e,t,r){"use strict";var n=r(86838),i=r(78877),o=r(21936).String;e.exports=!!Object.getOwnPropertySymbols&&!i(function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e) instanceof Symbol)||!Symbol.sham&&n&&n<41})},56482:function(e,t,r){"use strict";var n,i,o,s,a=r(21936),c=r(535),u=r(26508),l=r(19415),h=r(95945),f=r(78877),p=r(53566),d=r(19713),y=r(8789),g=r(19368),_=r(41777),v=r(8704),b=a.setImmediate,m=a.clearImmediate,w=a.process,S=a.Dispatch,E=a.Function,x=a.MessageChannel,k=a.String,T=0,B={},A="onreadystatechange";f(function(){n=a.location});var M=function(e){if(h(B,e)){var t=B[e];delete B[e],t()}},O=function(e){return function(){M(e)}},P=function(e){M(e.data)},R=function(e){a.postMessage(k(e),n.protocol+"//"+n.host)};b&&m||(b=function(e){g(arguments.length,1);var t=l(e)?e:E(e),r=d(arguments,1);return B[++T]=function(){c(t,void 0,r)},i(T),T},m=function(e){delete B[e]},v?i=function(e){w.nextTick(O(e))}:S&&S.now?i=function(e){S.now(O(e))}:x&&!_?(s=(o=new x).port2,o.port1.onmessage=P,i=u(s.postMessage,s)):a.addEventListener&&l(a.postMessage)&&!a.importScripts&&n&&"file:"!==n.protocol&&!f(R)?(i=R,a.addEventListener("message",P,!1)):i=A in y("script")?function(e){p.appendChild(y("script"))[A]=function(){p.removeChild(this),M(e)}}:function(e){setTimeout(O(e),0)}),e.exports={set:b,clear:m}},10628:function(e,t,r){"use strict";var n=r(1164),i=Math.max,o=Math.min;e.exports=function(e,t){var r=n(e);return r<0?i(r+t,0):o(r,t)}},95777:function(e,t,r){"use strict";var n=r(68206),i=r(99995);e.exports=function(e){return n(i(e))}},1164:function(e,t,r){"use strict";var n=r(92903);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},83221:function(e,t,r){"use strict";var n=r(1164),i=Math.min;e.exports=function(e){var t=n(e);return t>0?i(t,9007199254740991):0}},15554:function(e,t,r){"use strict";var n=r(99995),i=Object;e.exports=function(e){return i(n(e))}},38293:function(e,t,r){"use strict";var n=r(10131),i=r(27894),o=r(28610),s=r(22927),a=r(57202),c=r(4235),u=TypeError,l=c("toPrimitive");e.exports=function(e,t){if(!i(e)||o(e))return e;var r,c=s(e,l);if(c){if(void 0===t&&(t="default"),!i(r=n(c,e,t))||o(r))return r;throw new u("Can't convert object to primitive value")}return void 0===t&&(t="number"),a(e,t)}},28591:function(e,t,r){"use strict";var n=r(38293),i=r(28610);e.exports=function(e){var t=n(e,"string");return i(t)?t:t+""}},77448:function(e,t,r){"use strict";var n=r(4235)("toStringTag"),i={};i[n]="z",e.exports="[object z]"===String(i)},10182:function(e,t,r){"use strict";var n=r(74457),i=String;e.exports=function(e){if("Symbol"===n(e))throw TypeError("Cannot convert a Symbol value to a string");return i(e)}},1734:function(e){"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},50168:function(e,t,r){"use strict";var n=r(905),i=0,o=Math.random(),s=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++i+o,36)}},59624:function(e,t,r){"use strict";var n=r(25892);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},60125:function(e,t,r){"use strict";var n=r(83594),i=r(78877);e.exports=n&&i(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},19368:function(e){"use strict";var t=TypeError;e.exports=function(e,r){if(e2&&h(r,arguments[2]);var a=[];return p(e,_,{that:a}),u(r,"errors",a),r};s?s(v,g):a(v,g,{name:!0});var b=v.prototype=c(g.prototype,{constructor:l(1,v),message:l(1,""),name:l(1,"AggregateError")});n({global:!0,constructor:!0,arity:2},{AggregateError:v})},43284:function(e,t,r){"use strict";r(96726)},71809:function(e,t,r){"use strict";var n=r(95777),i=r(42834),o=r(39078),s=r(6308),a=r(79606).f,c=r(9383),u=r(57011),l=r(84446),h=r(83594),f="Array Iterator",p=s.set,d=s.getterFor(f);e.exports=c(Array,"Array",function(e,t){p(this,{type:f,target:n(e),index:0,kind:t})},function(){var e=d(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=void 0,u(void 0,!0);switch(e.kind){case"keys":return u(r,!1);case"values":return u(t[r],!1)}return u([r,t[r]],!1)},"values");var y=o.Arguments=o.Array;if(i("keys"),i("values"),i("entries"),!l&&h&&"values"!==y.name)try{a(y,"name",{value:"values"})}catch(e){}},8573:function(){},66382:function(e,t,r){"use strict";var n=r(67441),i=r(10131),o=r(39135),s=r(41355),a=r(96636),c=r(53924);n({target:"Promise",stat:!0,forced:r(52672)},{allSettled:function(e){var t=this,r=s.f(t),n=r.resolve,u=r.reject,l=a(function(){var r=o(t.resolve),s=[],a=0,u=1;c(e,function(e){var o=a++,c=!1;u++,i(r,t,e).then(function(e){!c&&(c=!0,s[o]={status:"fulfilled",value:e},--u||n(s))},function(e){!c&&(c=!0,s[o]={status:"rejected",reason:e},--u||n(s))})}),--u||n(s)});return l.error&&u(l.value),r.promise}})},29842:function(e,t,r){"use strict";var n=r(67441),i=r(10131),o=r(39135),s=r(41355),a=r(96636),c=r(53924);n({target:"Promise",stat:!0,forced:r(52672)},{all:function(e){var t=this,r=s.f(t),n=r.resolve,u=r.reject,l=a(function(){var r=o(t.resolve),s=[],a=0,l=1;c(e,function(e){var o=a++,c=!1;l++,i(r,t,e).then(function(e){!c&&(c=!0,s[o]=e,--l||n(s))},u)}),--l||n(s)});return l.error&&u(l.value),r.promise}})},52544:function(e,t,r){"use strict";var n=r(67441),i=r(10131),o=r(39135),s=r(54714),a=r(41355),c=r(96636),u=r(53924),l=r(52672),h="No one promise resolved";n({target:"Promise",stat:!0,forced:l},{any:function(e){var t=this,r=s("AggregateError"),n=a.f(t),l=n.resolve,f=n.reject,p=c(function(){var n=o(t.resolve),s=[],a=0,c=1,p=!1;u(e,function(e){var o=a++,u=!1;c++,i(n,t,e).then(function(e){u||p||(p=!0,l(e))},function(e){!u&&!p&&(u=!0,s[o]=e,--c||f(new r(s,h)))})}),--c||f(new r(s,h))});return p.error&&f(p.value),n.promise}})},31524:function(e,t,r){"use strict";var n=r(67441),i=r(84446),o=r(41991).CONSTRUCTOR,s=r(82788),a=r(54714),c=r(19415),u=r(33849),l=s&&s.prototype;if(n({target:"Promise",proto:!0,forced:o,real:!0},{catch:function(e){return this.then(void 0,e)}}),!i&&c(s)){var h=a("Promise").prototype.catch;l.catch!==h&&u(l,"catch",h,{unsafe:!0})}},81572:function(e,t,r){"use strict";var n,i,o,s,a=r(67441),c=r(84446),u=r(8704),l=r(21936),h=r(10131),f=r(33849),p=r(57086),d=r(20215),y=r(26638),g=r(39135),_=r(19415),v=r(27894),b=r(85135),m=r(87199),w=r(56482).set,S=r(31794),E=r(41783),x=r(96636),k=r(16582),T=r(6308),B=r(82788),A=r(41991),M=r(41355),O="Promise",P=A.CONSTRUCTOR,R=A.REJECTION_EVENT,C=A.SUBCLASSING,N=T.getterFor(O),I=T.set,D=B&&B.prototype,j=B,U=D,F=l.TypeError,L=l.document,W=l.process,z=M.f,K=z,H=!!(L&&L.createEvent&&l.dispatchEvent),q="unhandledrejection",Y="rejectionhandled",G=0,$=1,V=2,J=1,Z=2,X=function(e){var t;return!!(v(e)&&_(t=e.then))&&t},Q=function(e,t){var r,n,i,o=t.value,s=t.state===$,a=s?e.ok:e.fail,c=e.resolve,u=e.reject,l=e.domain;try{a?(s||(t.rejection===Z&&ei(t),t.rejection=J),!0===a?r=o:(l&&l.enter(),r=a(o),l&&(l.exit(),i=!0)),r===e.promise?u(new F("Promise-chain cycle")):(n=X(r))?h(n,r,c,u):c(r)):u(o)}catch(e){l&&!i&&l.exit(),u(e)}},ee=function(e,t){e.notified||(e.notified=!0,S(function(){for(var r,n=e.reactions;r=n.get();)Q(r,e);e.notified=!1,t&&!e.rejection&&er(e)}))},et=function(e,t,r){var n,i;H?((n=L.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),l.dispatchEvent(n)):n={promise:t,reason:r},!R&&(i=l["on"+e])?i(n):e===q&&E("Unhandled promise rejection",r)},er=function(e){h(w,l,function(){var t,r=e.facade,n=e.value;if(en(e)&&(t=x(function(){u?W.emit("unhandledRejection",n,r):et(q,r,n)}),e.rejection=u||en(e)?Z:J,t.error))throw t.value})},en=function(e){return e.rejection!==J&&!e.parent},ei=function(e){h(w,l,function(){var t=e.facade;u?W.emit("rejectionHandled",t):et(Y,t,e.value)})},eo=function(e,t,r){return function(n){e(t,n,r)}},es=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=V,ee(e,!0))},ea=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new F("Promise can't be resolved itself");var n=X(t);n?S(function(){var r={done:!1};try{h(n,t,eo(ea,r,e),eo(es,r,e))}catch(t){es(r,t,e)}}):(e.value=t,e.state=$,ee(e,!1))}catch(t){es({done:!1},t,e)}}};if(P&&(U=(j=function(e){b(this,U),g(e),h(n,this);var t=N(this);try{e(eo(ea,t),eo(es,t))}catch(e){es(t,e)}}).prototype,(n=function(e){I(this,{type:O,done:!1,notified:!1,parent:!1,reactions:new k,rejection:!1,state:G,value:void 0})}).prototype=f(U,"then",function(e,t){var r=N(this),n=z(m(this,j));return r.parent=!0,n.ok=!_(e)||e,n.fail=_(t)&&t,n.domain=u?W.domain:void 0,r.state===G?r.reactions.add(n):S(function(){Q(n,r)}),n.promise}),i=function(){var e=new n,t=N(e);this.promise=e,this.resolve=eo(ea,t),this.reject=eo(es,t)},M.f=z=function(e){return e===j||e===o?new i(e):K(e)},!c&&_(B)&&D!==Object.prototype)){s=D.then,C||f(D,"then",function(e,t){var r=this;return new j(function(e,t){h(s,r,e,t)}).then(e,t)},{unsafe:!0});try{delete D.constructor}catch(e){}p&&p(D,U)}a({global:!0,constructor:!0,wrap:!0,forced:P},{Promise:j}),d(j,O,!1,!0),y(O)},17872:function(e,t,r){"use strict";var n=r(67441),i=r(84446),o=r(82788),s=r(78877),a=r(54714),c=r(19415),u=r(87199),l=r(41496),h=r(33849),f=o&&o.prototype;if(n({target:"Promise",proto:!0,real:!0,forced:!!o&&s(function(){f.finally.call({then:function(){}},function(){})})},{finally:function(e){var t=u(this,a("Promise")),r=c(e);return this.then(r?function(r){return l(t,e()).then(function(){return r})}:e,r?function(r){return l(t,e()).then(function(){throw r})}:e)}}),!i&&c(o)){var p=a("Promise").prototype.finally;f.finally!==p&&h(f,"finally",p,{unsafe:!0})}},83415:function(e,t,r){"use strict";r(81572),r(29842),r(31524),r(91661),r(58977),r(76184)},91661:function(e,t,r){"use strict";var n=r(67441),i=r(10131),o=r(39135),s=r(41355),a=r(96636),c=r(53924);n({target:"Promise",stat:!0,forced:r(52672)},{race:function(e){var t=this,r=s.f(t),n=r.reject,u=a(function(){var s=o(t.resolve);c(e,function(e){i(s,t,e).then(r.resolve,n)})});return u.error&&n(u.value),r.promise}})},58977:function(e,t,r){"use strict";var n=r(67441),i=r(41355);n({target:"Promise",stat:!0,forced:r(41991).CONSTRUCTOR},{reject:function(e){var t=i.f(this);return(0,t.reject)(e),t.promise}})},76184:function(e,t,r){"use strict";var n=r(67441),i=r(54714),o=r(84446),s=r(82788),a=r(41991).CONSTRUCTOR,c=r(41496),u=i("Promise"),l=o&&!a;n({target:"Promise",stat:!0,forced:o||a},{resolve:function(e){return c(l&&this===u?s:this,e)}})},67769:function(e,t,r){"use strict";var n=r(67441),i=r(41355);n({target:"Promise",stat:!0},{withResolvers:function(){var e=i.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}})},18411:function(e,t,r){"use strict";var n=r(52856).charAt,i=r(10182),o=r(6308),s=r(9383),a=r(57011),c="String Iterator",u=o.set,l=o.getterFor(c);s(String,"String",function(e){u(this,{type:c,string:i(e),index:0})},function(){var e,t=l(this),r=t.string,i=t.index;return i>=r.length?a(void 0,!0):(e=n(r,i),t.index+=e.length,a(e,!1))})},64851:function(e,t,r){"use strict";r(43284)},91205:function(e,t,r){"use strict";r(66382)},67833:function(e,t,r){"use strict";r(52544)},62719:function(e,t,r){"use strict";var n=r(67441),i=r(535),o=r(19713),s=r(41355),a=r(39135),c=r(96636);n({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=o(arguments,1),r=s.f(this),n=c(function(){return i(a(e),void 0,t)});return(n.error?r.reject:r.resolve)(n.value),r.promise}})},8757:function(e,t,r){"use strict";r(67769)},18004:function(e,t,r){"use strict";r(71809);var n=r(67023),i=r(21936),o=r(20215),s=r(39078);for(var a in n)o(i[a],a),s[a]=s.Array},66921:function(e,t,r){"use strict";var n=r(6878);r(18004),e.exports=n},65332:function(e,t,r){"use strict";r.d(t,{K:function(){return c},M:function(){return a}});var n=r(53554),i=r(91678);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let o=BigInt(0),s=BigInt(1);function a(e,t){let r=(e,t)=>{let r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,i=t;for(;r>o;)r&s&&(n=n.add(i)),i=i.double(),r>>=s;return n},precomputeWindow(e,t){let{windows:r,windowSize:i}=n(t),o=[],s=e,a=s;for(let e=0;e>=p,n>c&&(n-=f,o+=s);let a=t,d=t+Math.abs(n)-1,y=e%2!=0,g=n<0;0===n?l=l.add(r(y,i[a])):u=u.add(r(g,i[d]))}return{p:u,f:l}},wNAFCached(e,t,r,n){let i=e._WINDOW_SIZE||1,o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,n(o))),this.wNAF(i,o,r)}}}function c(e){return(0,n.OP)(e.Fp),(0,i.FF)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,n.kK)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}},53554:function(e,t,r){"use strict";r.d(t,{DV:function(){return x},OP:function(){return b},PS:function(){return T},Tu:function(){return _},U_:function(){return d},Us:function(){return B},gN:function(){return E},kK:function(){return S},oA:function(){return p},sQ:function(){return f},wQ:function(){return h}});var n=r(91678);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let i=BigInt(0),o=BigInt(1),s=BigInt(2),a=BigInt(3),c=BigInt(4),u=BigInt(5),l=BigInt(8);function h(e,t){let r=e%t;return r>=i?r:t+r}function f(e,t,r){if(r<=i||t 0");if(r===o)return i;let n=o;for(;t>i;)t&o&&(n=n*e%r),e=e*e%r,t>>=o;return n}function p(e,t,r){let n=e;for(;t-- >i;)n*=n,n%=r;return n}function d(e,t){if(e===i||t<=i)throw Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=h(e,t),n=t,s=i,a=o,c=o,u=i;for(;r!==i;){let e=n/r,t=n%r,i=s-c*e,o=a-u*e;n=r,r=t,s=c,a=u,c=i,u=o}if(n!==o)throw Error("invert: does not exist");return h(s,t)}function y(e){let t,r,n;let a=(e-o)/s;for(t=e-o,r=0;t%s===i;t/=s,r++);for(n=s;n(h(e,t)&o)===o,v=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function b(e){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=v.reduce((e,t)=>(e[t]="function",e),t);return(0,n.FF)(e,r)}function m(e,t,r){if(r 0");if(r===i)return e.ONE;if(r===o)return t;let n=e.ONE,s=t;for(;r>i;)r&o&&(n=e.mul(n,s)),s=e.sqr(s),r>>=o;return n}function w(e,t){let r=Array(t.length),n=t.reduce((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n)),e.ONE),i=e.inv(n);return t.reduceRight((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n)),i),r}function S(e,t){let r=void 0!==t?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function E(e,t,r=!1,s={}){if(e<=i)throw Error(`Expected Field ORDER > 0, got ${e}`);let{nBitLength:a,nByteLength:c}=S(e,t);if(c>2048)throw Error("Field lengths over 2048 bytes are not supported");let u=g(e),l=Object.freeze({ORDER:e,BITS:a,BYTES:c,MASK:(0,n.dQ)(a),ZERO:i,ONE:o,create:t=>h(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error(`Invalid field element: expected bigint, got ${typeof t}`);return i<=t&&te===i,isOdd:e=>(e&o)===o,neg:t=>h(-t,e),eql:(e,t)=>e===t,sqr:t=>h(t*t,e),add:(t,r)=>h(t+r,e),sub:(t,r)=>h(t-r,e),mul:(t,r)=>h(t*r,e),pow:(e,t)=>m(l,e,t),div:(t,r)=>h(t*d(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>d(t,e),sqrt:s.sqrt||(e=>u(l,e)),invertBatch:e=>w(l,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?(0,n.S5)(e,c):(0,n.tL)(e,c),fromBytes:e=>{if(e.length!==c)throw Error(`Fp.fromBytes: expected ${c}, got ${e.length}`);return r?(0,n.ty)(e):(0,n.bytesToNumberBE)(e)}});return Object.freeze(l)}function x(e,t){if(!e.isOdd)throw Error("Field doesn't have isOdd");let r=e.sqrt(t);return e.isOdd(r)?e.neg(r):r}function k(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function T(e){let t=k(e);return t+Math.ceil(t/2)}function B(e,t,r=!1){let i=e.length,s=k(t),a=T(t);if(i<16||i1024)throw Error(`expected ${a}-1024 bytes of input, got ${i}`);let c=h(r?(0,n.bytesToNumberBE)(e):(0,n.ty)(e),t-o)+o;return r?(0,n.S5)(c,s):(0,n.tL)(c,s)}},91678:function(e,t,r){"use strict";r.d(t,{FF:function(){return x},S5:function(){return g},_t:function(){return o},bytesToNumberBE:function(){return p},ci:function(){return c},dQ:function(){return b},eV:function(){return v},gk:function(){return s},hexToBytes:function(){return f},n$:function(){return S},ql:function(){return _},tL:function(){return y},ty:function(){return d}}),BigInt(0);let n=BigInt(1),i=BigInt(2);function o(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function s(e){if(!o(e))throw Error("Uint8Array expected")}let a=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function c(e){s(e);let t="";for(let r=0;r=l._0&&e<=l._9?e-l._0:e>=l._A&&e<=l._F?e-(l._A-10):e>=l._a&&e<=l._f?e-(l._a-10):void 0}function f(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let t=0,i=0;t(i<new Uint8Array(e),w=e=>Uint8Array.from(e);function S(e,t,r){if("number"!=typeof e||e<2)throw Error("hashLen must be a number");if("number"!=typeof t||t<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let n=m(e),i=m(e),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...e)=>r(i,n,...e),c=(e=m())=>{i=a(w([0]),e),n=a(),0!==e.length&&(i=a(w([1]),e),n=a())},u=()=>{if(o++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e{let r;for(s(),c(e);!(r=t(u()));)c();return s(),r}}let E={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||o(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function x(e,t,r={}){let n=(t,r,n)=>{let i=E[r];if("function"!=typeof i)throw Error(`Invalid validator "${r}", expected function`);let o=e[t];if((!n||void 0!==o)&&!i(o,e))throw Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${r}`)};for(let[e,r]of Object.entries(t))n(e,r,!1);for(let[e,t]of Object.entries(r))n(e,t,!0);return e}},14374:function(e,t,r){"use strict";r.d(t,{xW:function(){return H},kA:function(){return A}});var n=r(65530),i=r(93560),o=r(53554),s=r(91678),a=r(93557),c=r(65332);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function u(e){let t=(0,c.K)(e);s.FF(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}let{bytesToNumberBE:l,hexToBytes:h}=s,f={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){let{Err:t}=f;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");let r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:l(n),l:e.subarray(r+2)}},toSig(e){let{Err:t}=f,r="string"==typeof e?h(e):e;s.gk(r);let n=r.length;if(n<2||48!=r[0])throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");let{d:i,l:o}=f._parseInt(r.subarray(2)),{d:a,l:c}=f._parseInt(o);if(c.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s:a}},hexFromSig(e){let t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{let t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),i=t(r(e.r)),o=n.length/2,s=i.length/2,a=r(o),c=r(s);return`30${r(s+o+4)}02${c}${i}02${a}${n}`}},p=BigInt(0),d=BigInt(1),y=(BigInt(2),BigInt(3));function g(e){let t=u(e),{Fp:r}=t,n=t.toBytes||((e,t,n)=>{let i=t.toAffine();return s.eV(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),i=t.fromBytes||(e=>{let t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function a(e){let{a:n,b:i}=t,o=r.sqr(e),s=r.mul(o,e);return r.add(r.add(s,r.mul(e,n)),i)}if(!r.eql(r.sqr(t.Gy),a(t.Gx)))throw Error("bad generator point: equation left != right");function l(e){return"bigint"==typeof e&&pr.eql(e,r.ZERO);return i(t)&&i(n)?v.ZERO:new v(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=r.invertBatch(e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(v.fromAffine)}static fromHex(e){let t=v.fromAffine(i((0,s.ql)("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return v.BASE.multiply(f(e))}_setWindowSize(e){this._WINDOW_SIZE=e,g.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw Error("bad point: ZERO")}let{x:e,y:n}=this.toAffine();if(!r.isValid(e)||!r.isValid(n))throw Error("bad point: x or y not FE");let i=r.sqr(n),o=a(e);if(!r.eql(i,o))throw Error("bad point: equation left != right");if(!this.isTorsionFree())throw Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw Error("Field doesn't support isOdd")}equals(e){_(e);let{px:t,py:n,pz:i}=this,{px:o,py:s,pz:a}=e,c=r.eql(r.mul(t,a),r.mul(o,i)),u=r.eql(r.mul(n,a),r.mul(s,i));return c&&u}negate(){return new v(this.px,r.neg(this.py),this.pz)}double(){let{a:e,b:n}=t,i=r.mul(n,y),{px:o,py:s,pz:a}=this,c=r.ZERO,u=r.ZERO,l=r.ZERO,h=r.mul(o,o),f=r.mul(s,s),p=r.mul(a,a),d=r.mul(o,s);return d=r.add(d,d),l=r.mul(o,a),l=r.add(l,l),c=r.mul(e,l),u=r.mul(i,p),u=r.add(c,u),c=r.sub(f,u),u=r.add(f,u),u=r.mul(c,u),c=r.mul(d,c),l=r.mul(i,l),p=r.mul(e,p),d=r.sub(h,p),d=r.mul(e,d),d=r.add(d,l),l=r.add(h,h),h=r.add(l,h),h=r.add(h,p),h=r.mul(h,d),u=r.add(u,h),p=r.mul(s,a),p=r.add(p,p),h=r.mul(p,d),c=r.sub(c,h),l=r.mul(p,f),l=r.add(l,l),new v(c,u,l=r.add(l,l))}add(e){_(e);let{px:n,py:i,pz:o}=this,{px:s,py:a,pz:c}=e,u=r.ZERO,l=r.ZERO,h=r.ZERO,f=t.a,p=r.mul(t.b,y),d=r.mul(n,s),g=r.mul(i,a),b=r.mul(o,c),m=r.add(n,i),w=r.add(s,a);m=r.mul(m,w),w=r.add(d,g),m=r.sub(m,w),w=r.add(n,o);let S=r.add(s,c);return w=r.mul(w,S),S=r.add(d,b),w=r.sub(w,S),S=r.add(i,o),u=r.add(a,c),S=r.mul(S,u),u=r.add(g,b),S=r.sub(S,u),h=r.mul(f,w),u=r.mul(p,b),h=r.add(u,h),u=r.sub(g,h),h=r.add(g,h),l=r.mul(u,h),g=r.add(d,d),g=r.add(g,d),b=r.mul(f,b),w=r.mul(p,w),g=r.add(g,b),b=r.sub(d,b),b=r.mul(f,b),w=r.add(w,b),d=r.mul(g,w),l=r.add(l,d),d=r.mul(S,w),u=r.mul(m,u),u=r.sub(u,d),d=r.mul(m,g),h=r.mul(S,h),new v(u,l,h=r.add(h,d))}subtract(e){return this.add(e.negate())}is0(){return this.equals(v.ZERO)}wNAF(e){return m.wNAFCached(this,g,e,e=>{let t=r.invertBatch(e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(v.fromAffine)})}multiplyUnsafe(e){let n=v.ZERO;if(e===p)return n;if(h(e),e===d)return this;let{endo:i}=t;if(!i)return m.unsafeLadder(this,e);let{k1neg:o,k1:s,k2neg:a,k2:c}=i.splitScalar(e),u=n,l=n,f=this;for(;s>p||c>p;)s&d&&(u=u.add(f)),c&d&&(l=l.add(f)),f=f.double(),s>>=d,c>>=d;return o&&(u=u.negate()),a&&(l=l.negate()),l=new v(r.mul(l.px,i.beta),l.py,l.pz),u.add(l)}multiply(e){let n,i;h(e);let o=e,{endo:s}=t;if(s){let{k1neg:e,k1:t,k2neg:a,k2:c}=s.splitScalar(o),{p:u,f:l}=this.wNAF(t),{p:h,f:f}=this.wNAF(c);u=m.constTimeNegate(e,u),h=m.constTimeNegate(a,h),h=new v(r.mul(h.px,s.beta),h.py,h.pz),n=u.add(h),i=l.add(f)}else{let{p:e,f:t}=this.wNAF(o);n=e,i=t}return v.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(e,t,r){let n=v.BASE,i=(e,t)=>t!==p&&t!==d&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,r));return o.is0()?void 0:o}toAffine(e){let{px:t,py:n,pz:i}=this,o=this.is0();null==e&&(e=o?r.ONE:r.inv(i));let s=r.mul(t,e),a=r.mul(n,e),c=r.mul(i,e);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(c,r.ONE))throw Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){let{h:e,isTorsionFree:r}=t;if(e===d)return!0;if(r)return r(v,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:e,clearCofactor:r}=t;return e===d?this:r?r(v,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),n(v,this,e)}toHex(e=!0){return s.ci(this.toRawBytes(e))}}v.BASE=new v(t.Gx,t.Gy,r.ONE),v.ZERO=new v(r.ZERO,r.ONE,r.ZERO);let b=t.nBitLength,m=(0,c.M)(v,t.endo?Math.ceil(b/2):b);return{CURVE:t,ProjectivePoint:v,normPrivateKeyToScalar:f,weierstrassEquation:a,isWithinCurveOrder:l}}function _(e){let t=(0,c.K)(e);return s.FF(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function v(e){let t=_(e),{Fp:r,n:n}=t,i=r.BYTES+1,a=2*r.BYTES+1;function c(e){return ps.ci(s.tL(e,t.nByteLength));function w(e){return e>n>>d}function S(e){return w(e)?u(-e):e}let E=(e,t,r)=>s.bytesToNumberBE(e.slice(t,r));class x{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){let r=t.nByteLength;return new x(E(e=(0,s.ql)("compactSignature",e,2*r),0,r),E(e,r,2*r))}static fromDER(e){let{r:t,s:r}=f.toSig((0,s.ql)("DER",e));return new x(t,r)}assertValidity(){if(!b(this.r))throw Error("r must be 0 < r < CURVE.n");if(!b(this.s))throw Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new x(this.r,this.s,e)}recoverPublicKey(e){let{r:n,s:i,recovery:o}=this,a=O((0,s.ql)("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw Error("recovery id invalid");let c=2===o||3===o?n+t.n:n;if(c>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let f=(1&o)==0?"02":"03",p=h.fromHex(f+m(c)),d=l(c),y=u(-a*d),g=u(i*d),_=h.BASE.multiplyAndAddUnsafe(p,y,g);if(!_)throw Error("point at infinify");return _.assertValidity(),_}hasHighS(){return w(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,u(-this.s),this.recovery):this}toDERRawBytes(){return s.hexToBytes(this.toDERHex())}toDERHex(){return f.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return s.hexToBytes(this.toCompactHex())}toCompactHex(){return m(this.r)+m(this.s)}}let k={isValidPrivateKey(e){try{return y(e),!0}catch(e){return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{let e=o.PS(t.n);return o.Us(t.randomBytes(e),t.n)},precompute:(e=8,t=h.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function T(e,t=!0){return h.fromPrivateKey(e).toRawBytes(t)}function B(e){let t=s._t(e),r="string"==typeof e,n=(t||r)&&e.length;return t?n===i||n===a:r?n===2*i||n===2*a:e instanceof h}function A(e,t,r=!0){if(B(e))throw Error("first arg must be private key");if(!B(t))throw Error("second arg must be public key");return h.fromHex(t).multiply(y(e)).toRawBytes(r)}let M=t.bits2int||function(e){let r=s.bytesToNumberBE(e),n=8*e.length-t.nBitLength;return n>0?r>>BigInt(n):r},O=t.bits2int_modN||function(e){return u(M(e))},P=s.dQ(t.nBitLength);function R(e){if("bigint"!=typeof e)throw Error("bigint expected");if(!(p<=e&&ee in i))throw Error("sign() legacy options not supported");let{hash:o,randomBytes:a}=t,{lowS:c,prehash:f,extraEntropy:g}=i;null==c&&(c=!0),e=(0,s.ql)("msgHash",e),f&&(e=(0,s.ql)("prehashed msgHash",o(e)));let _=O(e),v=y(n),m=[R(v),R(_)];if(null!=g&&!1!==g){let e=!0===g?a(r.BYTES):g;m.push((0,s.ql)("extraEntropy",e))}let E=s.eV(...m),k=_;return{seed:E,k2sig:function(e){let t=M(e);if(!b(t))return;let r=l(t),n=h.BASE.multiply(t).toAffine(),i=u(n.x);if(i===p)return;let o=u(r*u(k+i*v));if(o===p)return;let s=(n.x===i?0:2)|Number(n.y&d),a=o;return c&&w(o)&&(a=S(o),s^=1),new x(i,a,s)}}}let N={lowS:t.lowS,prehash:!1},I={lowS:t.lowS,prehash:!1};function D(e,r,n=N){let{seed:i,k2sig:o}=C(e,r,n),a=t;return s.n$(a.hash.outputLen,a.nByteLength,a.hmac)(i,o)}function j(e,r,n,i=I){let o,a;let c=e;if(r=(0,s.ql)("msgHash",r),n=(0,s.ql)("publicKey",n),"strict"in i)throw Error("options.strict was renamed to lowS");let{lowS:p,prehash:d}=i;try{if("string"==typeof c||s._t(c))try{a=x.fromDER(c)}catch(e){if(!(e instanceof f.Err))throw e;a=x.fromCompact(c)}else if("object"==typeof c&&"bigint"==typeof c.r&&"bigint"==typeof c.s){let{r:e,s:t}=c;a=new x(e,t)}else throw Error("PARSE");o=h.fromHex(n)}catch(e){if("PARSE"===e.message)throw Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(p&&a.hasHighS())return!1;d&&(r=t.hash(r));let{r:y,s:g}=a,_=O(r),v=l(g),b=u(_*v),m=u(y*v),w=h.BASE.multiplyAndAddUnsafe(o,b,m)?.toAffine();return!!w&&u(w.x)===y}return h.BASE._setWindowSize(8),{CURVE:t,getPublicKey:T,getSharedSecret:A,sign:D,verify:j,ProjectivePoint:h,Signature:x,utils:k}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function b(e){return{hash:e,hmac:(t,...r)=>(0,a.b)(e,t,(0,i.eV)(...r)),randomBytes:i.O6}}function m(e,t){let r=t=>v({...e,...b(t)});return Object.freeze({...r(t),create:r})}BigInt(4);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let w=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),S=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),E=BigInt(1),x=BigInt(2),k=(e,t)=>(e+t/x)/t;function T(e){let t=w,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),a=BigInt(23),c=BigInt(44),u=BigInt(88),l=e*e*e%t,h=l*l*e%t,f=(0,o.oA)(h,r,t)*h%t,p=(0,o.oA)(f,r,t)*h%t,d=(0,o.oA)(p,x,t)*l%t,y=(0,o.oA)(d,i,t)*d%t,g=(0,o.oA)(y,s,t)*y%t,_=(0,o.oA)(g,c,t)*g%t,v=(0,o.oA)(_,u,t)*_%t,b=(0,o.oA)(v,c,t)*g%t,m=(0,o.oA)(b,r,t)*h%t,S=(0,o.oA)(m,a,t)*y%t,E=(0,o.oA)(S,n,t)*l%t,k=(0,o.oA)(E,x,t);if(!B.eql(B.sqr(k),e))throw Error("Cannot find square root");return k}let B=(0,o.gN)(w,void 0,void 0,{sqrt:T}),A=m({a:BigInt(0),b:BigInt(7),Fp:B,n:S,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{let t=S,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-E*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,a=BigInt("0x100000000000000000000000000000000"),c=k(s*e,t),u=k(-n*e,t),l=(0,o.wQ)(e-c*r-u*i,t),h=(0,o.wQ)(-c*n-u*s,t),f=l>a,p=h>a;if(f&&(l=t-l),p&&(h=t-h),l>a||h>a)throw Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:l,k2neg:p,k2:h}}}},n.J),M=BigInt(0),O=e=>"bigint"==typeof e&&M"bigint"==typeof e&&Me.charCodeAt(0)));r=(0,s.eV)(t,t),R[e]=r}return(0,n.J)((0,s.eV)(r,...t))}let N=e=>e.toRawBytes(!0).slice(1),I=e=>(0,s.tL)(e,32),D=e=>(0,o.wQ)(e,w),j=e=>(0,o.wQ)(e,S),U=A.ProjectivePoint,F=(e,t,r)=>U.BASE.multiplyAndAddUnsafe(e,t,r);function L(e){let t=A.utils.normPrivateKeyToScalar(e),r=U.fromPrivateKey(t);return{scalar:r.hasEvenY()?t:j(-t),bytes:N(r)}}function W(e){if(!O(e))throw Error("bad x: need 0 < x < p");let t=D(e*e),r=T(D(t*e+BigInt(7)));r%x!==M&&(r=D(-r));let n=new U(e,r,E);return n.assertValidity(),n}function z(...e){return j((0,s.bytesToNumberBE)(C("BIP0340/challenge",...e)))}function K(e,t,r){let n=(0,s.ql)("signature",e,64),i=(0,s.ql)("message",t),o=(0,s.ql)("publicKey",r,32);try{let e=W((0,s.bytesToNumberBE)(o)),t=(0,s.bytesToNumberBE)(n.subarray(0,32));if(!O(t))return!1;let r=(0,s.bytesToNumberBE)(n.subarray(32,64));if(!P(r))return!1;let a=z(I(t),N(e),i),c=F(e,r,j(-a));if(!c||!c.hasEvenY()||c.toAffine().x!==t)return!1;return!0}catch(e){return!1}}let H={getPublicKey:function(e){return L(e).bytes},sign:function(e,t,r=(0,i.O6)(32)){let n=(0,s.ql)("message",e),{bytes:o,scalar:a}=L(t),c=(0,s.ql)("auxRand",r,32),u=I(a^(0,s.bytesToNumberBE)(C("BIP0340/aux",c))),l=C("BIP0340/nonce",u,o,n),h=j((0,s.bytesToNumberBE)(l));if(h===M)throw Error("sign failed: k is zero");let{bytes:f,scalar:p}=L(h),d=z(f,o,n),y=new Uint8Array(64);if(y.set(f,0),y.set(I(j(p+d*a)),32),!K(y,n,o))throw Error("sign: Invalid signature produced");return y},verify:K,utils:{randomPrivateKey:A.utils.randomPrivateKey,lift_x:W,pointToBytes:N,numberToBytesBE:s.tL,bytesToNumberBE:s.bytesToNumberBE,taggedHash:C,mod:o.wQ}}},65376:function(e,t,r){"use strict";function n(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, not ${e}`)}function i(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function o(e,...t){if(!i(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function s(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");n(e.outputLen),n(e.blockLen)}function a(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function c(e,t){o(e);let r=t.outputLen;if(e.length>i&o),a=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}let s=(e,t,r)=>e&t^~e&r,a=(e,t,r)=>e&t^e&r^t&r;class c extends i.kb{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,i.GL)(this.buffer)}update(e){(0,n.Gg)(this);let{view:t,buffer:r,blockLen:o}=this,s=(e=(0,i.O0)(e)).length;for(let n=0;ns-c&&(this.process(r,0),c=0);for(let e=c;ef.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;eo?e.create().update(r).digest():r);for(let e=0;enew o(e,t).update(r).digest();s.create=(e,t)=>new o(e,t)},65530:function(e,t,r){"use strict";r.d(t,{J:function(){return u}});var n=r(44815),i=r(93560);let o=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]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);class c extends n.VR{constructor(){super(64,32,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){let{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)a[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=a[e-15],r=a[e-2],n=(0,i.np)(t,7)^(0,i.np)(t,18)^t>>>3,o=(0,i.np)(r,17)^(0,i.np)(r,19)^r>>>10;a[e]=o+a[e-7]+n+a[e-16]|0}let{A:r,B:s,C:c,D:u,E:l,F:h,G:f,H:p}=this;for(let e=0;e<64;e++){let t=p+((0,i.np)(l,6)^(0,i.np)(l,11)^(0,i.np)(l,25))+(0,n.bc)(l,h,f)+o[e]+a[e]|0,d=((0,i.np)(r,2)^(0,i.np)(r,13)^(0,i.np)(r,22))+(0,n.l3)(r,s,c)|0;p=f,f=h,h=l,l=u+t|0,u=c,c=s,s=r,r=t+d|0}r=r+this.A|0,s=s+this.B|0,c=c+this.C|0,u=u+this.D|0,l=l+this.E|0,h=h+this.F|0,f=f+this.G|0,p=p+this.H|0,this.set(r,s,c,u,l,h,f,p)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let u=(0,i.hE)(()=>new c)},78967:function(e,t,r){"use strict";r.d(t,{o:function(){return d}});var n=r(44815);let i=BigInt(4294967296-1),o=BigInt(32);function s(e,t=!1){return t?{h:Number(e&i),l:Number(e>>o&i)}:{h:0|Number(e>>o&i),l:0|Number(e&i)}}var a={split:function(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;ie>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,add:function(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/4294967296|0)|0,l:0|i}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/4294967296|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/4294967296|0)|0,add5H:(e,t,r,n,i,o)=>t+r+n+i+o+(e/4294967296|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},c=r(93560);let[u,l]=a.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),h=new Uint32Array(80),f=new Uint32Array(80);class p extends n.VR{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:o,Dh:s,Dl:a,Eh:c,El:u,Fh:l,Fl:h,Gh:f,Gl:p,Hh:d,Hl:y}=this;return[e,t,r,n,i,o,s,a,c,u,l,h,f,p,d,y]}set(e,t,r,n,i,o,s,a,c,u,l,h,f,p,d,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|h,this.Gh=0|f,this.Gl=0|p,this.Hh=0|d,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)h[r]=e.getUint32(t),f[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|h[e-15],r=0|f[e-15],n=a.rotrSH(t,r,1)^a.rotrSH(t,r,8)^a.shrSH(t,r,7),i=a.rotrSL(t,r,1)^a.rotrSL(t,r,8)^a.shrSL(t,r,7),o=0|h[e-2],s=0|f[e-2],c=a.rotrSH(o,s,19)^a.rotrBH(o,s,61)^a.shrSH(o,s,6),u=a.rotrSL(o,s,19)^a.rotrBL(o,s,61)^a.shrSL(o,s,6),l=a.add4L(i,u,f[e-7],f[e-16]),p=a.add4H(l,n,c,h[e-7],h[e-16]);h[e]=0|p,f[e]=0|l}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:s,Cl:c,Dh:p,Dl:d,Eh:y,El:g,Fh:_,Fl:v,Gh:b,Gl:m,Hh:w,Hl:S}=this;for(let e=0;e<80;e++){let t=a.rotrSH(y,g,14)^a.rotrSH(y,g,18)^a.rotrBH(y,g,41),E=a.rotrSL(y,g,14)^a.rotrSL(y,g,18)^a.rotrBL(y,g,41),x=y&_^~y&b,k=g&v^~g&m,T=a.add5L(S,E,k,l[e],f[e]),B=a.add5H(T,w,t,x,u[e],h[e]),A=0|T,M=a.rotrSH(r,n,28)^a.rotrBH(r,n,34)^a.rotrBH(r,n,39),O=a.rotrSL(r,n,28)^a.rotrBL(r,n,34)^a.rotrBL(r,n,39),P=r&i^r&s^i&s,R=n&o^n&c^o&c;w=0|b,S=0|m,b=0|_,m=0|v,_=0|y,v=0|g,({h:y,l:g}=a.add(0|p,0|d,0|B,0|A)),p=0|s,d=0|c,s=0|i,c=0|o,i=0|r,o=0|n;let C=a.add3L(A,O,R);r=a.add3H(C,B,M,P),n=0|C}({h:r,l:n}=a.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=a.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:c}=a.add(0|this.Ch,0|this.Cl,0|s,0|c)),({h:p,l:d}=a.add(0|this.Dh,0|this.Dl,0|p,0|d)),({h:y,l:g}=a.add(0|this.Eh,0|this.El,0|y,0|g)),({h:_,l:v}=a.add(0|this.Fh,0|this.Fl,0|_,0|v)),({h:b,l:m}=a.add(0|this.Gh,0|this.Gl,0|b,0|m)),({h:w,l:S}=a.add(0|this.Hh,0|this.Hl,0|w,0|S)),this.set(r,n,i,o,s,c,p,d,y,g,_,v,b,m,w,S)}roundClean(){h.fill(0),f.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}let d=(0,c.hE)(()=>new p)},93560:function(e,t,r){"use strict";r.d(t,{GL:function(){return o},O0:function(){return l},O6:function(){return g},U5:function(){return d},eV:function(){return h},hE:function(){return y},iY:function(){return u},kb:function(){return f},np:function(){return s},oY:function(){return c}});var n=r(17536),i=r(65376);let o=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),s=(e,t)=>e<<32-t|e>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];let a=async()=>{};async function c(e,t,r){let n=Date.now();for(let i=0;i=0&&ee().update(l(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function g(e=32){if(n.e&&"function"==typeof n.e.getRandomValues)return n.e.getRandomValues(new Uint8Array(e));throw Error("crypto.getRandomValues must be defined")}},28820:function(e,t,r){"use strict";r.d(t,{HI:function(){return c},_j:function(){return a},pe:function(){return u}});var n=r(38357);let i="AES-CBC",o=e=>btoa(String.fromCharCode.apply(null,new Uint8Array(e))),s=e=>{let t=atob(e);return new Uint8Array(t.length).map((e,r)=>t.charCodeAt(r)).buffer},a=async(e,t)=>crypto.subtle.importKey("raw",await crypto.subtle.digest({name:"SHA-256"},(0,n.hg)(`${e}:${t}`)),{name:i},!1,["encrypt","decrypt"]),c=async(e,t)=>{let r=crypto.getRandomValues(new Uint8Array(16));return JSON.stringify({c:o(await crypto.subtle.encrypt({name:i,iv:r},await e,(0,n.hg)(t))),iv:[...r]})},u=async(e,t)=>{let{c:r,iv:o}=JSON.parse(t);return(0,n.X9)(await crypto.subtle.decrypt({name:i,iv:new Uint8Array(o)},await e,s(r)))}},97481:function(e,t,r){"use strict";r.d(t,{Ls:function(){return g}});var n=r(14374),i=r(75442),o=r(38357),s=r(28820);let a={},c=4,u=29333,l="x",h=(0,o.NC)(crypto.getRandomValues(new Uint8Array(32))),f=(0,o.NC)(n.xW.getPublicKey(h)),p={},d=()=>Math.floor(Date.now()/1e3),y=["wss://relay.nostr.net","wss://relay.blackbyte.nl","wss://relay.piazza.today","wss://relay.exit.pub","wss://relay.nostr.band","wss://relay.damus.io","wss://nostr.mom","wss://relay.snort.social","wss://nostr.lu.ke","wss://relay.plebstr.com","wss://nostr.sathoarder.com","wss://nsrelay.assilvestrar.club","wss://nostrasia.casa","wss://relay.nostr.bg","wss://relay.nostrr.de","wss://relay.nostrss.re"],g=(0,o.kv)(a,(e,t)=>{let r=e.password&&(0,s._j)(e.password,t),g=`${o.FR.toLowerCase()}/${e.appId}/${t}`,_=`${g}/${o._0}`,v=(0,o.Bu)(64),b=(0,o.Bu)(64),m={},w={},S={},E=(0,o.dQ)(e,y,c),x=(e,t)=>{M(e,t),S[t]=e},k=e=>{delete m[e],delete w[e],delete S[e]},T=(e,t)=>JSON.stringify(["REQ",e,{kinds:[u],since:d(),["#"+l]:[t]}]),B=e=>JSON.stringify(["CLOSE",e]),A=async(e,t)=>{let r={kind:u,content:JSON.stringify(t),pubkey:f,created_at:d(),tags:[[l,e]]},i=(0,o.NC)(new Uint8Array(await crypto.subtle.digest("SHA-256",(0,o.hg)(JSON.stringify([0,r.pubkey,r.created_at,r.kind,r.tags,r.content])))));return JSON.stringify(["EVENT",{...r,id:i,sig:(0,o.NC)(await n.xW.sign(i,h))}])},M=o.EI;return E.forEach(t=>{let n=new WebSocket(t);p[t]=n,n.addEventListener("open",async()=>{n.send(T(v,g)),n.send(T(b,_)),n.send(await A(g,o._0))}),n.addEventListener("message",async t=>{let[i,a,c,u]=JSON.parse(t.data);if("EVENT"!==i){"OK"!==i||c||console.warn(`${o.FR}: relay failure from ${n.url} - ${u}`);return}let l=JSON.parse(c.content);if(a===v){let t=l;if(t!==o._0&&!S[t]&&!w[t]){w[t]=!0;let i=m[t]=(0,o.kL)(!0,!1,e.rtcConfig);i.once(o.U3.signal,async e=>{n.send(await A(`${g}/${t}`,{peerId:o._0,offer:r?{...e,sdp:await (0,s.HI)(r,e.sdp)}:e}))}),i.once(o.U3.connect,()=>x(i,t)),i.once(o.U3.close,()=>k(t))}}else if(a===b){let{peerId:t,offer:i,answer:a}=l;if(m[t]&&a){m[t].signal(r?{...a,sdp:await (0,s.pe)(r,a.sdp)}:a);return}if(!i)return;let c=(0,o.kL)(!1,!1,e.rtcConfig);c.once(o.U3.signal,async e=>n.send(await A(`${g}/${t}`,{peerId:o._0,answer:r?{...e,sdp:await (0,s.HI)(r,e.sdp)}:e}))),c.once(o.U3.connect,()=>x(c,t)),c.once(o.U3.close,()=>k(t)),c.signal(i)}})}),(0,i.Z)(e=>M=e,()=>{delete a[t],(0,o.VO)(p).forEach(e=>{e.send(B(v)),e.send(B(b))})})})},75442:function(e,t,r){"use strict";var n=r(38357);let i=Object.getPrototypeOf(Uint8Array),o=12,s=0,a=12,c=13,u=14,l=15,h=16369,f=255,p="bufferedamountlow";t.Z=(e,t)=>{let r={},d={},y={},g={},_={},v={},b=(e,t)=>(e?Array.isArray(e)?e:[e]:(0,n.XP)(r)).flatMap(e=>{let i=r[e];return i?t(e,i):(console.warn(`${n.FR}: no peer with id ${e} found`),[])}),m=e=>{r[e]&&(delete r[e],delete y[e],delete g[e],N(e))},w=e=>{if(d[e])return[d[e].send,d[e].setOnComplete,d[e].setOnProgress];if(!e)throw(0,n.QK)("action type argument is required");let t=(0,n.hg)(e);if(t.byteLength>o)throw(0,n.QK)(`action type string "${e}" (${t.byteLength}b) exceeds byte limit (${o}). Hint: choose a shorter name.`);let s=new Uint8Array(o);s.set(t);let y=0;return d[e]={onComplete:n.EI,onProgress:n.EI,setOnComplete:t=>d[e]={...d[e],onComplete:t},setOnProgress:t=>d[e]={...d[e],onProgress:t},send:async(e,t,o,d)=>{if(o&&"object"!=typeof o)throw(0,n.QK)("action meta argument must be an object");if(void 0===e)throw(0,n.QK)("action data cannot be undefined");let g="string"!=typeof e,_=e instanceof Blob,v=_||e instanceof ArrayBuffer||e instanceof i;if(o&&!v)throw(0,n.QK)("action meta argument can only be used with binary data");let m=v?new Uint8Array(_?await e.arrayBuffer():e):(0,n.hg)(g?JSON.stringify(e):e),w=o?(0,n.hg)(JSON.stringify(o)):null,S=Math.ceil(m.byteLength/h)+(o?1:0)||1,E=Array(S).fill().map((e,t)=>{let r=t===S-1,n=o&&0===t,i=new Uint8Array(l+(n?w.byteLength:r?m.byteLength-h*(S-(o?2:1)):h));return i.set(s),i.set([y],a),i.set([r|n<<1|v<<2|g<<3],c),i.set([Math.round((t+1)/S*f)],u),i.set(o?n?w:m.subarray((t-1)*h,t*h):m.subarray(t*h,(t+1)*h),l),i});return y=y+1&f,Promise.all(b(t,async(e,t)=>{let n=t._channel,i=0;for(;in.bufferedAmountLowThreshold&&await new Promise(e=>{let t=()=>{n.removeEventListener(p,t),e()};n.addEventListener(p,t)}),!r[e])break;t.send(s),i++,d&&d(s[u]/f,e,o)}}))}},[d[e].send,d[e].setOnComplete,d[e].setOnProgress]},S=(e,t)=>{let r=new Uint8Array(t),i=(0,n.X9)(r.subarray(s,a)).replaceAll("\0",""),[o]=r.subarray(a,c),[h]=r.subarray(c,u),[p]=r.subarray(u,l),g=r.subarray(l),_=!!(1&h),v=!!(2&h),b=!!(4&h),m=!!(8&h);if(!d[i])throw(0,n.QK)(`received message with unregistered type (${i})`);y[e]||(y[e]={}),y[e][i]||(y[e][i]={});let w=y[e][i][o];if(w||(w=y[e][i][o]={chunks:[]}),v?w.meta=JSON.parse((0,n.X9)(g)):w.chunks.push(g),d[i].onProgress(p/f,e,w.meta),!_)return;let S=new Uint8Array(w.chunks.reduce((e,t)=>e+t.byteLength,0));if(w.chunks.reduce((e,t)=>(S.set(t,e),e+t.byteLength),0),b)d[i].onComplete(S,e,w.meta);else{let t=(0,n.X9)(S);d[i].onComplete(m?JSON.parse(t):t,e)}delete y[e][i][o]},[E,x]=w("__91n6__"),[k,T]=w("__90n6__"),[B,A]=w("__516n4L__"),[M,O]=w("__57r34m__"),[P,R]=w("__7r4ck__"),C=n.EI,N=n.EI,I=n.EI,D=n.EI;return e((e,t)=>{if(r[t])return;let i=S.bind(null,t);r[t]=e,e.on(n.U3.signal,e=>B(e,t)),e.on(n.U3.close,()=>m(t)),e.on(n.U3.data,i),e.on(n.U3.stream,e=>{I(e,t,_[t]),delete _[t]}),e.on(n.U3.track,(e,r)=>{D(e,r,t,v[t]),delete v[t]}),e.on(n.U3.error,e=>{"ERR_DATA_CHANNEL"!==e.code&&console.error(e)}),C(t),e.__drainEarlyData(i)}),x((e,t)=>k("",t)),T((e,t)=>{g[t]&&(g[t](),delete g[t])}),A((e,t)=>{r[t]&&r[t].signal(e)}),O((e,t)=>_[t]=e),R((e,t)=>v[t]=e),{makeAction:w,ping:async e=>{if(!e)throw(0,n.QK)("ping() must be called with target peer ID");let t=Date.now();return E("",e),await new Promise(t=>g[e]=t),Date.now()-t},leave:()=>{(0,n.qh)(r).forEach(([e,t])=>{t.destroy(),delete r[e]}),t()},getPeers:()=>(0,n.sq)((0,n.qh)(r).map(([e,t])=>[e,t._pc])),addStream:(e,t,r)=>b(t,async(t,n)=>{r&&await M(r,t),n.addStream(e)}),removeStream:(e,t)=>b(t,(t,r)=>r.removeStream(e)),addTrack:(e,t,r,n)=>b(r,async(r,i)=>{n&&await P(n,r),i.addTrack(e,t)}),removeTrack:(e,t,r)=>b(r,(r,n)=>n.removeTrack(e,t)),replaceTrack:(e,t,r,n,i)=>b(n,async(n,o)=>{i&&await P(i,n),o.replaceTrack(e,t,r)}),onPeerJoin:e=>C=e,onPeerLeave:e=>N=e,onPeerStream:e=>I=e,onPeerTrack:e=>D=e}}},18210:function(e,t,r){"use strict";r.d(t,{Ls:function(){return b}});var n=r(75442),i=r(38357),o=r(28820);let s={},a={},c={},u={},l={},h=20,f=10,p=3,d=33,y=120,g=4,_="announce",v=["wss://tracker.webtorrent.dev","wss://tracker.openwebtorrent.com","wss://tracker.files.fm:7073/announce","wss://tracker.btorrent.xyz"],b=(0,i.kv)(s,(e,t)=>{let r;if(e.trackerUrls||e.trackerRedundancy)throw(0,i.QK)("trackerUrls/trackerRedundancy have been replaced by relayUrls/relayRedundancy");let b={},m=e.password&&(0,o._j)(e.password,t),w=(0,i.dQ)(e,v,p),S=crypto.subtle.digest("SHA-1",(0,i.hg)(`${i.FR}:${e.appId}:${t}`)).then(e=>Array.from(new Uint8Array(e)).map(e=>e.toString(36)).join("").slice(0,h)),E=t=>(0,i.sq)(Array(t).fill().map(()=>{let t=(0,i.kL)(!0,!1,e.rtcConfig);return[(0,i.Bu)(h),{peer:t,offerP:new Promise(e=>t.once(i.U3.signal,e))}]})),x=async(t,n)=>{let s;let a=await S;try{s=JSON.parse(n.data)}catch(e){console.error(`${i.FR}: received malformed SDP JSON`);return}if(s.info_hash!==a||s.peer_id&&s.peer_id===i._0)return;let c=s["failure reason"];if(c){console.warn(`${i.FR}: torrent tracker failure from ${t.url} - ${c}`);return}if(s.interval&&s.interval>P&&s.interval<=y&&(clearInterval(R),R=setInterval(B,1e3*(P=s.interval))),s.offer&&s.offer_id){if(b[s.peer_id]||N[s.offer_id])return;N[s.offer_id]=!0;let r=(0,i.kL)(!1,!1,e.rtcConfig);r.once(i.U3.signal,async e=>t.send(JSON.stringify({answer:m?{...e,sdp:await (0,o.HI)(m,e.sdp)}:e,action:_,info_hash:a,peer_id:i._0,to_peer_id:s.peer_id,offer_id:s.offer_id}))),r.on(i.U3.connect,()=>M(r,s.peer_id)),r.on(i.U3.close,()=>O(r,s.peer_id,s.offer_id)),r.signal(m?{...s.offer,sdp:await (0,o.pe)(m,s.offer.sdp)}:s.offer);return}if(s.answer){if(b[s.peer_id]||N[s.offer_id])return;let e=r[s.offer_id];if(e){let{peer:t}=e;if(t.destroyed)return;N[s.offer_id]=!0,t.on(i.U3.connect,()=>M(t,s.peer_id,s.offer_id)),t.on(i.U3.close,()=>O(t,s.peer_id,s.offer_id)),t.signal(m?{...s.answer,sdp:await (0,o.pe)(m,s.answer.sdp)}:s.answer)}}},k=async(e,t)=>e.send(JSON.stringify({action:_,info_hash:t,numwant:f,peer_id:i._0,offers:await Promise.all((0,i.qh)(r).map(async([e,{offerP:t}])=>{let r=await t;return{offer_id:e,offer:m?{...r,sdp:await (0,o.HI)(m,r.sdp)}:r}}))})),T=(e,t,r)=>(r||!a[e]?(l[e]={...l[e],[t]:x},a[e]=new Promise(r=>{let n=new WebSocket(e);c[e]=n,n.addEventListener("open",()=>{u[e]=1e3*g,r(n)}),n.addEventListener("message",t=>(0,i.VO)(l[e]).forEach(e=>e(n,t))),n.addEventListener("close",async()=>{u[e]=u[e]??1e3*g,await (0,i._v)(u[e]),u[e]*=2,T(e,t,!0)})})):l[e][t]=x,a[e]),B=async()=>{let e=await S;r&&A(),r=E(f),w.forEach(async t=>{let r=await T(t,e);r.readyState===WebSocket.OPEN?k(r,e):r.readyState!==WebSocket.CONNECTING&&k(await T(t,e,!0),e)})},A=()=>{(0,i.qh)(r).forEach(([e,{peer:t}])=>{N[e]||b[e]||t.destroy()}),N={}},M=(e,t,r)=>{C(e,t),b[t]=!0,r&&(b[r]=!0)},O=(e,t,n)=>{delete b[t],e.destroy(),n in r&&(delete r[n],r={...r,...E(1)})},P=d,R=setInterval(B,1e3*P),C=i.EI,N={};return B(),(0,n.Z)(e=>C=e,async()=>{let e=await S;w.forEach(t=>delete l[t][e]),delete s[t],clearInterval(R),A()})})},38357:function(e,t,r){"use strict";r.d(t,{X9:function(){return T},hg:function(){return k},qh:function(){return w},U3:function(){return A},sq:function(){return S},Bu:function(){return y},dQ:function(){return M},kv:function(){return g},kL:function(){return d},XP:function(){return b},FR:function(){return _},QK:function(){return x},EI:function(){return E},_0:function(){return v},_v:function(){return O},NC:function(){return B},VO:function(){return m}});/*! simple-peer. MIT License. Feross Aboukhadijeh */let n=65536,i=5e3,o=5e3;function s(e){let t=new Uint8Array(e);for(let r=0;re),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.iceCompleteTimeout||i,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:a(),!this._wrtc){if("undefined"==typeof window)throw c(Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT");throw c(Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT")}this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(e){this.destroy(c(e,"ERR_PC_CONSTRUCTOR"));return}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=e=>{this._onIceCandidate(e)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch(e=>{this.destroy(c(e,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},this.streams&&this.streams.forEach(e=>{this.addStream(e)}),this._pc.ontrack=e=>{this._onTrack(e)},this._debug("initial negotiation"),this._needsNegotiation()}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(!this.destroying){if(this.destroyed)throw c(Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(e=>{this._addIceCandidate(e)}),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())}).catch(e=>{this.destroy(c(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(c(Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(e){let t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch(e=>{!t.address||t.address.endsWith(".local")?l("Ignoring unsupported ICE candidate."):this.destroy(c(e,"ERR_ADD_ICE_CANDIDATE"))})}send(e){if(!this.destroying){if(this.destroyed)throw c(Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(e)}}addTransceiver(e,t){if(!this.destroying){if(this.destroyed)throw c(Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(c(e,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:e,init:t}})}}addStream(e){if(!this.destroying){if(this.destroyed)throw c(Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),e.getTracks().forEach(t=>{this.addTrack(t,e)})}}addTrack(e,t){if(this.destroying)return;if(this.destroyed)throw c(Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");let r=this._senderMap.get(e)||new Map,n=r.get(t);if(n){if(n.removed)throw c(Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED");throw c(Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}n=this._pc.addTrack(e,t),r.set(t,n),this._senderMap.set(e,r),this._needsNegotiation()}replaceTrack(e,t,r){if(this.destroying)return;if(this.destroyed)throw c(Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");let n=this._senderMap.get(e),i=n?n.get(r):null;if(!i)throw c(Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");t&&this._senderMap.set(t,n),null!=i.replaceTrack?i.replaceTrack(t):this.destroy(c(Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(e,t){if(this.destroying)return;if(this.destroyed)throw c(Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");let r=this._senderMap.get(e),n=r?r.get(t):null;if(!n)throw c(Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{n.removed=!0,this._pc.removeTrack(n)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(n):this.destroy(c(e,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(e){if(!this.destroying){if(this.destroyed)throw c(Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),e.getTracks().forEach(t=>{this.removeTrack(t,e)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,queueMicrotask(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw c(Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(e){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",e&&(e.message||e)),queueMicrotask(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",e&&(e.message||e)),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,e&&this.emit("error",e),this.emit("close")}))}_setupData(e){if(!e.channel)return this.destroy(c(Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=n),this.channelName=this._channel.label,this._channel.onmessage=e=>{this._onChannelMessage(e)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=e=>{this.destroy(c(e,"ERR_DATA_CHANNEL"))};let t=!1;this._closingInterval=setInterval(()=>{this._channel&&"closing"===this._channel.readyState?(t&&this._onChannelClose(),t=!0):t=!1},o)}_startIceCompleteTimeout(){!this.destroyed&&(this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout)))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=u(e.sdp)),e.sdp=this.sdpTransform(e.sdp);let t=()=>{if(this.destroyed)return;let t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp})},r=()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))},n=e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(e).then(r).catch(n)}).catch(e=>{this.destroy(c(e,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(e=>{e.mid||!e.sender.track||e.requested||(e.requested=!0,this.addTransceiver(e.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=u(e.sdp)),e.sdp=this.sdpTransform(e.sdp);let t=()=>{if(this.destroyed)return;let t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers()},r=()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))},n=e=>{this.destroy(c(e,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(e).then(r).catch(n)}).catch(e=>{this.destroy(c(e,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||"failed"!==this._pc.connectionState||this.destroy(c(Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;let e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),("connected"===e||"completed"===e)&&(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.destroy(c(Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.destroy(c(Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(e){let t=e=>("[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(t=>{Object.assign(e,t)}),e);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then(r=>{let n=[];r.forEach(e=>{n.push(t(e))}),e(null,n)},t=>e(t)):this._pc.getStats.length>0?this._pc.getStats(r=>{if(this.destroyed)return;let n=[];r.result().forEach(e=>{let r={};e.names().forEach(t=>{r[t]=e.stat(t)}),r.id=e.id,r.type=e.type,r.timestamp=e.timestamp,n.push(t(r))}),e(null,n)},t=>e(t)):e(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;let e=()=>{this.destroyed||this.getStats((t,r)=>{if(this.destroyed)return;t&&(r=[]);let n={},i={},o={},s=!1;r.forEach(e=>{("remotecandidate"===e.type||"remote-candidate"===e.type)&&(n[e.id]=e),("localcandidate"===e.type||"local-candidate"===e.type)&&(i[e.id]=e),("candidatepair"===e.type||"candidate-pair"===e.type)&&(o[e.id]=e)});let a=e=>{s=!0;let t=i[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=Number(t.port)):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=Number(t.portNumber)):"string"==typeof e.googLocalAddress&&(t=e.googLocalAddress.split(":"),this.localAddress=t[0],this.localPort=Number(t[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let r=n[e.remoteCandidateId];r&&(r.ip||r.address)?(this.remoteAddress=r.ip||r.address,this.remotePort=Number(r.port)):r&&r.ipAddress?(this.remoteAddress=r.ipAddress,this.remotePort=Number(r.portNumber)):"string"==typeof e.googRemoteAddress&&(r=e.googRemoteAddress.split(":"),this.remoteAddress=r[0],this.remotePort=Number(r[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(r.forEach(e=>{"transport"===e.type&&e.selectedCandidatePairId&&a(o[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&a(e)}),s||Object.keys(o).length&&!Object.keys(i).length)this._connecting=!1,this._connected=!0;else{setTimeout(e,100);return}if(this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(c(e,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');let e=this._cb;this._cb=null,e(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};e()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>n)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(e=>{this._pc.removeTrack(e),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(e){!this.destroyed&&(e.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=new Uint8Array(t)),this.emit("data",t)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);let e=this._cb;this._cb=null,e(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(e){this.destroyed||e.streams.forEach(t=>{this._debug("on track"),this.emit("track",e.track,t),this._remoteTracks.push({track:e.track,stream:t}),this._remoteStreams.some(e=>e.id===t.id)||(this._remoteStreams.push(t),queueMicrotask(()=>{this._debug("on stream"),this.emit("stream",t)}))})}_debug(...e){this._doDebug&&(e[0]="["+this._id+"] "+e[0],console.log(...e))}on(e,t){let r=this._map;r.has(e)||r.set(e,new Set),r.get(e).add(t)}off(e,t){let r=this._map,n=r.get(e);n&&(n.delete(t),0===n.size&&r.delete(e))}once(e,t){let r=(...n)=>{this.off(e,r),t(...n)};this.on(e,r)}emit(e,...t){let r=this._map;if(r.has(e))for(let n of r.get(e))try{n(...t)}catch(e){console.error(e)}}}h.WEBRTC_SUPPORT=!!a(),h.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},h.channelConfig={};var f=h;let p="0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz",d=(e,t,r)=>{let n=new f({initiator:e,trickle:t,config:r}),i=e=>n.__earlyDataBuffer.push(e);return n.on(A.data,i),n.__earlyDataBuffer=[],n.__drainEarlyData=e=>{n.off(A.data,i),n.__earlyDataBuffer.forEach(e),delete n.__earlyDataBuffer,delete n.__drainEarlyData},n},y=e=>Array(e).fill().map(()=>p[Math.floor(Math.random()*p.length)]).join(""),g=(e,t)=>(r,n)=>{if(e[n])return e[n];if(!r)throw x("requires a config map as the first argument");if(!r.appId&&!r.firebaseApp)throw x("config map is missing appId field");if(!n)throw x("namespace argument required");return e[n]=t(r,n)},_="Trystero",v=y(20),{keys:b,values:m,entries:w,fromEntries:S}=Object,E=()=>{},x=e=>Error(`${_}: ${e}`),k=e=>new TextEncoder().encode(e),T=e=>new TextDecoder().decode(e),B=e=>e.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),A=S(["close","connect","data","error","signal","stream","track"].map(e=>[e,e])),M=(e,t,r)=>(e.relayUrls||t).slice(0,e.relayUrls?e.relayUrls.length:e.relayRedundancy||r),O=e=>new Promise(t=>setTimeout(t,e))}}]); \ No newline at end of file diff --git a/_next/static/chunks/955-5748263a00b1ccb8.js b/_next/static/chunks/955-5748263a00b1ccb8.js new file mode 100644 index 0000000000000000000000000000000000000000..0549227edae5e2ed5197e0a6ebdb4440b78b4347 --- /dev/null +++ b/_next/static/chunks/955-5748263a00b1ccb8.js @@ -0,0 +1,6 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[955],{9109:function(t,e,r){/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */let n=r(48738),i=r(6868),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function f(t){if(t>2147483647)throw RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw TypeError('The "string" argument must be of type string. Received type number');return l(t)}return s(t,e,r)}function s(t,e,r){if("string"==typeof t)return function(t,e){if(("string"!=typeof e||""===e)&&(e="utf8"),!u.isEncoding(e))throw TypeError("Unknown encoding: "+e);let r=0|y(t,e),n=f(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(N(t,Uint8Array)){let e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return a(t)}(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(N(t,ArrayBuffer)||t&&N(t.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(N(t,SharedArrayBuffer)||t&&N(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);let i=function(t){var e;if(u.isBuffer(t)){let e=0|c(t.length),r=f(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||(e=t.length)!=e?f(0):a(t):"Buffer"===t.type&&Array.isArray(t.data)?a(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw TypeError('"size" argument must be of type number');if(t<0)throw RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return h(t),f(t<0?0:0|c(t))}function a(t){let e=t.length<0?0:0|c(t.length),r=f(e);for(let n=0;n=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||N(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return P(t).length;default:if(i)return n?-1:k(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){let i=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(e>>>=0)))return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(o=r=+r)!=o&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return -1;r=t.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:w(t,e,r,n,i);if("number"==typeof e)return(e&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):w(t,[e],r,n,i);throw TypeError("val must be string, number or Buffer")}function w(t,e,r,n,i){let o,f=1,u=t.length,s=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return -1;f=2,u/=2,s/=2,r/=2}function h(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){let n=-1;for(o=r;ou&&(r=u-s),o=r;o>=0;o--){let r=!0;for(let n=0;n239?4:e>223?3:e>191?2:1;if(i+f<=r){let r,n,u,s;switch(f){case 1:e<128&&(o=e);break;case 2:(192&(r=t[i+1]))==128&&(s=(31&e)<<6|63&r)>127&&(o=s);break;case 3:r=t[i+1],n=t[i+2],(192&r)==128&&(192&n)==128&&(s=(15&e)<<12|(63&r)<<6|63&n)>2047&&(s<55296||s>57343)&&(o=s);break;case 4:r=t[i+1],n=t[i+2],u=t[i+3],(192&r)==128&&(192&n)==128&&(192&u)==128&&(s=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&u)>65535&&s<1114112&&(o=s)}}null===o?(o=65533,f=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=f}return function(t){let e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nr)throw RangeError("Trying to access beyond buffer length")}function m(t,e,r,n,i,o){if(!u.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw RangeError("Index out of range")}function I(t,e,r,n,i){_(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,r}function U(t,e,r,n,i){_(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=f,f>>=8,t[r+2]=f,f>>=8,t[r+1]=f,f>>=8,t[r]=f,r+8}function A(t,e,r,n,i,o){if(r+n>t.length||r<0)throw RangeError("Index out of range")}function v(t,e,r,n,o){return e=+e,r>>>=0,o||A(t,e,r,4,34028234663852886e22,-34028234663852886e22),i.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,o){return e=+e,r>>>=0,o||A(t,e,r,8,17976931348623157e292,-17976931348623157e292),i.write(t,e,r,n,52,8),r+8}e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50,e.kMaxLength=2147483647,u.TYPED_ARRAY_SUPPORT=function(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return s(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return(h(t),t<=0)?f(t):void 0!==e?"string"==typeof r?f(t).fill(e,r):f(t).fill(e):f(t)},u.allocUnsafe=function(t){return l(t)},u.allocUnsafeSlow=function(t){return l(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(N(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),N(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);in.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else if(u.isBuffer(e))e.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=e.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){let t=this.length;if(t%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;er&&(t+=" ... "),""},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(N(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;let o=i-n,f=r-e,s=Math.min(o,f),h=this.slice(n,i),l=t.slice(e,r);for(let t=0;t>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let p=this.length-e;if((void 0===r||r>p)&&(r=p),t.length>0&&(r<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let c=!1;for(;;)switch(n){case"hex":return function(t,e,r,n){let i;r=Number(r)||0;let o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;let f=e.length;for(n>f/2&&(n=f/2),i=0;i>8,i.push(r%256),i.push(n);return i}(t,this.length-l),this,l,a);default:if(c)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),c=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},u.prototype.slice=function(t,e){let r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||E(t,e,this.length);let n=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,r||E(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=M(function(t){S(t>>>=0,"offset");let e=this[t],r=this[t+7];(void 0===e||void 0===r)&&$(t,this.length-8);let n=e+256*this[++t]+65536*this[++t]+16777216*this[++t],i=this[++t]+256*this[++t]+65536*this[++t]+16777216*r;return BigInt(n)+(BigInt(i)<>>=0,"offset");let e=this[t],r=this[t+7];(void 0===e||void 0===r)&&$(t,this.length-8);let n=16777216*e+65536*this[++t]+256*this[++t]+this[++t],i=16777216*this[++t]+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<>>=0,e>>>=0,r||E(t,e,this.length);let n=this[t],i=1,o=0;for(;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return(t>>>=0,e||E(t,1,this.length),128&this[t])?-((255-this[t]+1)*1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||E(t,2,this.length);let r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||E(t,2,this.length);let r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=M(function(t){S(t>>>=0,"offset");let e=this[t],r=this[t+7];return(void 0===e||void 0===r)&&$(t,this.length-8),(BigInt(this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24))<>>=0,"offset");let e=this[t],r=this[t+7];return(void 0===e||void 0===r)&&$(t,this.length-8),(BigInt((e<<24)+65536*this[++t]+256*this[++t]+this[++t])<>>=0,e||E(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||E(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||E(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||E(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;m(this,t,e,r,n,0)}let i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;m(this,t,e,r,n,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||m(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||m(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||m(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||m(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||m(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=M(function(t,e=0){return I(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=M(function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){let n=Math.pow(2,8*r-1);m(this,t,e,r,n-1,-n)}let i=0,o=1,f=0;for(this[e]=255&t;++i>0)-f&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){let n=Math.pow(2,8*r-1);m(this,t,e,r,n-1,-n)}let i=r-1,o=1,f=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===f&&0!==this[e+i+1]&&(f=1),this[e+i]=(t/o>>0)-f&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||m(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||m(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||m(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||m(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||m(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=M(function(t,e=0){return I(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=M(function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(t,e,r){return v(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return v(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return R(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function _(t,e,r,n,i,o){if(t>r||t3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${(o+1)*8}${i}`:`>= -(2${i} ** ${(o+1)*8-1}${i}) and < 2 ** ${(o+1)*8-1}${i}`:`>= ${e}${i} and <= ${r}${i}`,new T.ERR_OUT_OF_RANGE("value",n,t)}S(i,"offset"),(void 0===n[i]||void 0===n[i+o])&&$(i,n.length-(o+1))}function S(t,e){if("number"!=typeof t)throw new T.ERR_INVALID_ARG_TYPE(e,"number",t)}function $(t,e,r){if(Math.floor(t)!==t)throw S(t,r),new T.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new T.ERR_BUFFER_OUT_OF_BOUNDS;throw new T.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}O("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),O("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),O("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>4294967296?i=L(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=L(i)),i+="n"),n+=` It must be ${e}. Received ${i}`},RangeError);let x=/[^+/0-9A-Za-z-_]/g;function k(t,e){let r;e=e||1/0;let n=t.length,i=null,o=[];for(let f=0;f55295&&r<57344){if(!i){if(r>56319||f+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function P(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(x,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function C(t,e,r,n){let i;for(i=0;i=e.length)&&!(i>=t.length);++i)e[i+r]=t[i];return i}function N(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}let F=function(){let t="0123456789abcdef",e=Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function M(t){return"undefined"==typeof BigInt?j:t}function j(){throw Error("BigInt not supported")}},36393:function(t,e,r){r.d(e,{v:function(){return n}});var n=r(37836);e.Z=n}}]); \ No newline at end of file diff --git a/_next/static/chunks/99.c468b8ef795cd013.js b/_next/static/chunks/99.c468b8ef795cd013.js new file mode 100644 index 0000000000000000000000000000000000000000..20e249800fddeeeb17014c7e6246f92c320e42df --- /dev/null +++ b/_next/static/chunks/99.c468b8ef795cd013.js @@ -0,0 +1 @@ +!function(){var e,o,n,t,r,i,s,a,c={50495:function(){},27147:function(){},31418:function(){},68741:function(){},70319:function(){},78386:function(){},73342:function(){},58517:function(e,o,n){"use strict";var t=n(78703);class r{constructor(){this.promise=new Promise((e,o)=>{this.resolve=e,this.reject=o})}}n(9109);var i=n(69893),s=n(78967);async function a(e){let o=new Uint8Array(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",o))).map(e=>e.toString(16).padStart(2,"0")).join("")}i.UG.sha512Sync=function(){for(var e=arguments.length,o=Array(e),n=0;no.at.getTime()-e.at.getTime()),S.getInstance().emitNewLogs()}constructor(){super(),this.logs=[],this.emitNewLogs=d()(()=>{this.emit("newLog")},h.newLogEventDebounceMs)}}let P=function(e,o){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!n&&window&&(window.blockedLogLevels=localStorage.getItem("blockedLogLevels")||[],window.blockedLoggers=localStorage.getItem("blockedLoggers")||[]),{trace:function(t){for(var r,i,s,a,c=arguments.length,l=Array(c>1?c-1:0),d=1;d1?c-1:0),d=1;d1?c-1:0),d=1;d1?c-1:0),d=1;d1?c-1:0),d=1;d{I&&(isNaN(e.progress)||(I.modelLoadingProgress=e.progress/100),e.progress>=100&&I.modelLoadingPromise.resolve())}}))}catch(e){return e.message}return await I.modelLoadingPromise.promise,!0}async function O(e,o){if(!I||!I.pipeline)return{success:!1,reason:"Model could not be loaded."};if(I.busyEmbedding)return{success:!1,reason:"Worker is busy embedding."};I.busyEmbedding=!0,E({type:"workerBusyEmbedding",batchId:o});try{P.debug("Worker ".concat(I.workerId," is now embedding ").concat(o),JSON.stringify(e));let n=await I.pipeline(e,{normalize:!0,pooling:"mean"});I.busyEmbedding=!1,E({type:"workerIdle"});let r=(0,t.eaU)(n,"ubinary"),i=await Promise.all(e.map(async(e,o)=>({text:e,embedding:n.slice([o,o+1]).data,binaryEmbedding:r.slice([o,o+1]).data,bEmbeddingHash:await a(r.slice([o,o+1]).data)})));return{success:!0,results:i}}catch(e){return I.busyEmbedding=!1,E({type:"workerIdle"}),{success:!1,reason:e.message}}}self.onmessage=async e=>{let o=e.data;switch(o.type){case"loadWorker":let n=await M(o.modelName,o.workerId);!0===n?E({type:"workerLoaded",modelName:o.modelName}):E({type:"workerLoadFailure",modelName:o.modelName,err:n});break;case"embedText":let t=await O(o.texts,o.batchId);t.success?E({type:"embeddingSuccess",batchId:o.batchId,results:t.results}):E({type:"embeddingFailure",batchId:o.batchId,reason:t.reason});break;default:P.error("EMBEDDING WORKER GOT ",e," - THIS SHOULDNT HAPPEN!")}}}},l={};function d(e){var o=l[e];if(void 0!==o)return o.exports;var n=l[e]={exports:{}},t=!0;try{c[e](n,n.exports,d),t=!1}finally{t&&delete l[e]}return n.exports}d.m=c,d.x=function(){var e=d.O(void 0,[165,132,15,708,687],function(){return d(58517)});return d.O(e)},e=[],d.O=function(o,n,t,r){if(n){r=r||0;for(var i=e.length;i>0&&e[i-1][2]>r;i--)e[i]=e[i-1];e[i]=[n,t,r];return}for(var s=1/0,i=0;i=r&&Object.keys(d.O).every(function(e){return d.O[e](n[c])})?n.splice(c--,1):(a=!1,r1&&void 0!==arguments[1]?arguments[1]:{};if(i(t)){if(0===t.length)throw TypeError("input must not be empty")}else throw TypeError("input must be an array");if(void 0!==r.output){if(!i(r.output))throw TypeError("output option must be an array if specified");e=r.output}else e=Array(t.length);var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!function(t){let e=s.call(t);return e.endsWith("Array]")&&!e.includes("Big")}(t))throw TypeError("input must be an array");if(0===t.length)throw TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,n=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw Error("fromIndex must be a positive integer smaller than length");if(n<=o||n>t.length||!Number.isInteger(n))throw Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],h=o+1;h1&&void 0!==arguments[1]?arguments[1]:{};if(!function(t){let e=n.call(t);return e.endsWith("Array]")&&!e.includes("Big")}(t))throw TypeError("input must be an array");if(0===t.length)throw TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],h=o+1;ha&&(a=t[h]);return a}(t);if(o===a)throw RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var h=r.min,u=void 0===h?r.autoMinMax?o:0:h,l=r.max,f=void 0===l?r.autoMinMax?a:1:l;if(u>=f)throw RangeError("min option must be smaller than max option");for(var c=(f-u)/(a-o),m=0;mt.get(e,r)){i=!0;break t}}for(let e=0;e=0&&m?` ${h(c,o-1)}`:h(c,o)).padEnd(o)))}f.push(`${r.join(" ")}`)}return l!==a&&(f[f.length-1]+=` ... ${a-r} more columns`),u!==n&&f.push(`... ${n-e} more rows`),f.join(` +${s}`)}(t,r,o,i,a)} +${n}] +${n}rows: ${t.rows} +${n}columns: ${t.columns} +}`}function h(t,e){let r=t.toString();if(r.length<=e)return r;let o=t.toFixed(e);if(o.length>e&&(o=t.toFixed(Math.max(0,e-(o.length-e)))),o.length<=e&&!o.startsWith("0.000")&&!o.startsWith("-0.000"))return o;let i=t.toExponential(e);return i.length>e&&(i=t.toExponential(Math.max(0,e-(i.length-e)))),i.slice(0)}function u(t,e,r){let o=r?t.rows:t.rows-1;if(e<0||e>o)throw RangeError("Row index out of range")}function l(t,e,r){let o=r?t.columns:t.columns-1;if(e<0||e>o)throw RangeError("Column index out of range")}function f(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw RangeError("vector size must be the same as the number of columns");return e}function c(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw RangeError("vector size must be the same as the number of rows");return e}function m(t,e){if(!o.isAnyArray(e))throw TypeError("row indices must be an array");for(let r=0;r=t.rows)throw RangeError("row indices are out of range")}function g(t,e){if(!o.isAnyArray(e))throw TypeError("column indices must be an array");for(let r=0;r=t.columns)throw RangeError("column indices are out of range")}function p(t,e,r,o,i){if(5!=arguments.length)throw RangeError("expected 4 arguments");if(w("startRow",e),w("endRow",r),w("startColumn",o),w("endColumn",i),e>r||o>i||e<0||e>=t.rows||r<0||r>=t.rows||o<0||o>=t.columns||i<0||i>=t.columns)throw RangeError("Submatrix indices are out of range")}function d(t,e=0){let r=[];for(let o=0;o=i)throw RangeError("min must be smaller than max");let s=i-o,a=new M(t,e);for(let r=0;rr?(i=!0,r=e):(o=!1,i=!0);t++}return o}isReducedEchelonForm(){let t=0,e=0,r=-1,o=!0,i=!1;for(;tr?(i=!0,r=e):(o=!1,i=!0);for(let r=e+1;rt.get(o,r)&&(o=i);if(0===t.get(o,r))r++;else{t.swapRows(e,o);let i=t.get(e,r);for(let o=r;o=0;)if(0===t.maxRow(o))o--;else{let i=0,n=!1;for(;it[e]&&(t[e]=this.get(e,r));return t}case"column":{let t=Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;et[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;et&&(t=this.get(e,r));return t}default:throw Error(`invalid option: ${t}`)}}maxIndex(){y(this);let t=this.get(0,0),e=[0,0];for(let r=0;rt&&(t=this.get(r,o),e[0]=r,e[1]=o);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{let t=Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;ee&&(e=this.get(t,r));return e}maxRowIndex(t){u(this,t),y(this);let e=this.get(t,0),r=[t,0];for(let o=1;oe&&(e=this.get(t,o),r[1]=o);return r}minRow(t){if(u(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;re&&(e=this.get(r,t));return e}maxColumnIndex(t){l(this,t),y(this);let e=this.get(0,t),r=[0,t];for(let o=1;oe&&(e=this.get(o,t),r[0]=o);return r}minColumn(t){if(l(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r=r)throw RangeError("min must be smaller than max");let o=new M(this.rows,this.columns);for(let t=0;t0&&i(n,{min:e,max:r,output:n}),o.setRow(t,n)}return o}scaleColumns(t={}){if("object"!=typeof t)throw TypeError("options must be an object");let{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw TypeError("min must be a number");if(!Number.isFinite(r))throw TypeError("max must be a number");if(e>=r)throw RangeError("min must be smaller than max");let o=new M(this.rows,this.columns);for(let t=0;tr||e<0||e>=this.columns||r<0||r>=this.columns)throw RangeError("Argument out of range");let o=new M(t.length,r-e+1);for(let i=0;i=this.rows)throw RangeError(`Row index out of range: ${t[i]}`);o.set(i,n-e,this.get(t[i],n))}return o}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw RangeError("Argument out of range");let o=new M(r-e+1,t.length);for(let i=0;i=this.columns)throw RangeError(`Column index out of range: ${t[i]}`);o.set(n-e,i,this.get(n,t[i]))}return o}setSubMatrix(t,e,r){if((t=M.checkMatrix(t)).isEmpty())return this;let o=e+t.rows-1,i=r+t.columns-1;p(this,e,o,r,i);for(let o=0;o=0)for(let r=0;r=0)this.#t(t,e);else if(o.isAnyArray(t)){let r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw TypeError("Data must be a 2D array with at least one element");this.data=[];for(let o=0;o"number"==typeof t))throw TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[o]))}this.rows=t,this.columns=e}else throw TypeError("First argument must be a positive number or an array")}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return u(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),u(this,t,!0),e=Float64Array.from(f(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){l(this,t);for(let e=0;e>t);return this},v.prototype.signPropagatingRightShiftM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e>t.get(e,r));return this},v.signPropagatingRightShift=function(t,e){return new M(t).signPropagatingRightShift(e)},v.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},v.prototype.rightShiftS=function(t){for(let e=0;e>>t);return this},v.prototype.rightShiftM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e>>t.get(e,r));return this},v.rightShift=function(t,e){return new M(t).rightShift(e)},v.prototype.zeroFillRightShift=v.prototype.rightShift,v.prototype.zeroFillRightShiftS=v.prototype.rightShiftS,v.prototype.zeroFillRightShiftM=v.prototype.rightShiftM,v.zeroFillRightShift=v.rightShift,v.prototype.not=function(){for(let t=0;t=0)this.#e=new M(t,t);else if(this.#e=new M(t),!this.isSymmetric())throw TypeError("not symmetric data")}clone(){let t=new x(this.diagonalSize);for(let[e,r,o]of this.upperRightEntries())t.set(e,r,o);return t}toMatrix(){return new M(this)}get(t,e){return this.#e.get(t,e)}set(t,e,r){return this.#e.set(t,e,r),this.#e.set(e,t,r),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);let r=e.slice();return r.splice(t,1),this.#e.addRow(t,r),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw RangeError("Mask size do not match with matrix size");let e=[];for(let[r,o]of t.entries())o||e.push(r);for(let t of(e.reverse(),e))this.removeCross(t);return this}toCompact(){let{diagonalSize:t}=this,e=Array(t*(t+1)/2);for(let r=0,o=0,i=0;i=t&&(r=++o);return e}static fromCompact(t){let e=t.length,r=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(r))throw TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);let o=new x(r);for(let i=0,n=0,s=0;s=r&&(i=++n);return o}*upperRightEntries(){for(let t=0,e=0;t=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t=this.diagonalSize&&(e=++t)}}}x.prototype.klassType="SymmetricMatrix";class S extends x{static isDistanceMatrix(t){return x.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new x(this)}clone(){let t=new S(this.diagonalSize);for(let[e,r,o]of this.upperRightEntries())e!==r&&t.set(e,r,o);return t}toCompact(){let{diagonalSize:t}=this,e=Array((t-1)*t/2);for(let r=1,o=0,i=0;i=t&&(r=++o+1);return e}static fromCompact(t){let e=t.length,r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);let o=new this(r);for(let i=1,n=0,s=0;s=r&&(i=++n+1);return o}}S.prototype.klassSubType="DistanceMatrix";class E extends v{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class R extends E{constructor(t,e){l(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}}class k extends E{constructor(t,e){g(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}}class N extends E{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}}class z extends E{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}}class _ extends E{constructor(t,e){u(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}}class A extends E{constructor(t,e){m(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}}class P extends E{constructor(t,e,r){m(t,e),g(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class I extends E{constructor(t,e,r,o,i){p(t,e,r,o,i),super(t,r-e+1,i-o+1),this.startRow=e,this.startColumn=o}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}}class O extends E{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}}class C extends v{constructor(t,e={}){let{rows:r=1}=e;if(t.length%r!=0)throw Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let o=this._calculateIndex(t,e);return this.data[o]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class T extends v{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}class j{constructor(t){let e,r,o,i,n,s,a,h,u;let l=(t=T.checkMatrix(t)).clone(),f=l.rows,c=l.columns,m=new Float64Array(f),g=1;for(e=0;eMath.abs(h[i])&&(i=e);if(i!==r){for(o=0;o=0;o--){for(r=0;re?o.set(i,e,t.get(i,e)):i===e?o.set(i,e,1):o.set(i,e,0);return o}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,o=new M(e,r);for(let i=0;iMath.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class D{constructor(t){let e,r,o,i;let n=(t=T.checkMatrix(t)).clone(),s=t.rows,a=t.columns,h=new Float64Array(a);for(o=0;on.get(o,o)&&(t=-t),e=o;e=0;o--){for(r=0;r=0;r--){for(t=0;tr.get(t,t)&&(m[t]=-m[t]);for(let e=t;e=0;t--)if(0!==m[t]){for(let e=t+1;e=0;t--){if(t0;){let t,e;for(t=S-2;t>=-1&&-1!==t;t--){let e=Number.MIN_VALUE+R*Math.abs(m[t]+Math.abs(m[t+1]));if(Math.abs(d[t])<=e||Number.isNaN(d[t])){d[t]=0;break}}if(t===S-2)e=4;else{let r;for(r=S-1;r>=t&&r!==t;r--){let e=(r!==S?Math.abs(d[r]):0)+(r!==t+1?Math.abs(d[r-1]):0);if(Math.abs(m[r])<=R*e){m[r]=0;break}}r===t?e=3:r===S-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=d[S-2];d[S-2]=0;for(let r=S-2;r>=t;r--){let o=F(m[r],e),n=m[r]/o,s=e/o;if(m[r]=o,r!==t&&(e=-s*d[r-1],d[r-1]=n*d[r-1]),u)for(let t=0;t=m[t+1]);){let e=m[t];if(m[t]=m[t+1],m[t+1]=e,u&&te&&i.set(n,r,t.get(n,r)/this.s[r]);let n=this.U,s=n.rows,a=n.columns,h=new M(r,s);for(let t=0;tt&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return M.diag(this.s)}}function q(t,e,r=!1){return(t=T.checkMatrix(t),e=T.checkMatrix(e),r)?new V(t).solve(e):t.isSquare()?new j(t).solve(e):new D(t).solve(e)}class L{constructor(t,e={}){let r,o;let{assumeSymmetric:i=!1}=e;if(!(t=T.checkMatrix(t)).isSquare())throw Error("Matrix is not a square matrix");if(t.isEmpty())throw Error("Matrix must be non-empty");let n=t.columns,s=new M(n,n),a=new Float64Array(n),h=new Float64Array(n),u=t;if(i||t.isSymmetric()){for(r=0;r0;a--){for(u=0,f=0,s=0;u0&&(n=-n),e[a]=f*n,s-=i*n,r[a-1]=i-n,h=0;hu)do{for(i=r[u],c=F(f=(r[u+1]-i)/(2*e[u]),1),f<0&&(c=-c),r[u]=e[u]/(f+c),r[u+1]=e[u]*(f+c),m=r[u+1],n=i-r[u],s=u+2;s=u;s--)for(h=0,d=p,p=g,v=y,i=g*e[s],n=g*f,c=F(f,e[s]),e[s+1]=y*c,y=e[s]/c,f=(g=f/c)*r[s]-y*i,r[s+1]=n+y*(g*i+y*r[s]);hx*M);r[u]=r[u]+b,e[u]=0}for(s=0;s=u;a--)r[a]=e.get(a,u-1)/l,s+=r[a]*r[a];for(n=Math.sqrt(s),r[u]>0&&(n=-n),s-=r[u]*n,r[u]=r[u]-n,h=u;h=u;a--)i+=r[a]*e.get(a,h);for(i/=s,a=u;a<=f;a++)e.set(a,h,e.get(a,h)-i*r[a])}for(a=0;a<=f;a++){for(i=0,h=f;h>=u;h--)i+=r[h]*e.get(a,h);for(i/=s,h=u;h<=f;h++)e.set(a,h,e.get(a,h)-i*r[h])}r[u]=l*r[u],e.set(u,u-1,l*n)}}for(a=0;a=1;u--)if(0!==e.get(u,u-1)){for(a=u+1;a<=f;a++)r[a]=e.get(a,u-1);for(h=u;h<=f;h++){for(n=0,a=u;a<=f;a++)n+=r[a]*o.get(a,h);for(n=n/r[u]/e.get(u,u-1),a=u;a<=f;a++)o.set(a,h,o.get(a,h)+n*r[a])}}})(n,t,e,s),function(t,e,r,o,i){let n,s,a,h,u,l,f,c,m,g,p,d,w,y,v,b=t-1,M=t-1,x=Number.EPSILON,S=0,E=0,R=0,k=0,N=0,z=0,_=0,A=0;for(n=0;nM)&&(r[n]=i.get(n,n),e[n]=0),s=Math.max(n-1,0);s=0;){for(h=b;h>0&&(0===(z=Math.abs(i.get(h-1,h-1))+Math.abs(i.get(h,h)))&&(z=E),!(Math.abs(i.get(h,h-1))=0){for(_=R>=0?R+_:R-_,r[b-1]=c+_,r[b]=r[b-1],0!==_&&(r[b]=c-f/_),e[b-1]=0,e[b]=0,z=Math.abs(c=i.get(b,b-1))+Math.abs(_),N=Math.sqrt((R=c/z)*R+(k=_/z)*k),R/=N,k/=N,s=b-1;s0){for(z=Math.sqrt(z),m=h&&(z=Math.abs(R=((N=c-(_=i.get(u,u)))*(z=m-_)-f)/i.get(u+1,u)+i.get(u,u+1))+Math.abs(k=i.get(u+1,u+1)-_-N-z)+Math.abs(N=i.get(u+2,u+1)),R/=z,k/=z,N/=z,!(u===h||Math.abs(i.get(u,u-1))*(Math.abs(k)+Math.abs(N))u+2&&i.set(n,n-3,0);for(a=u;a<=b-1&&(y=a!==b-1,a!==u&&0!==(c=Math.abs(R=i.get(a,a-1))+Math.abs(k=i.get(a+1,a-1))+Math.abs(N=y?i.get(a+2,a-1):0))&&(R/=c,k/=c,N/=c),0!==c);a++)if(z=Math.sqrt(R*R+k*k+N*N),R<0&&(z=-z),0!==z){for(a!==u?i.set(a,a-1,-z*c):h!==u&&i.set(a,a-1,-i.get(a,a-1)),R+=z,c=R/z,m=k/z,_=N/z,k/=R,N/=R,s=a;s=0;b--)if(R=r[b],0===(k=e[b]))for(h=b,i.set(b,b,1),n=b-1;n>=0;n--){for(f=i.get(n,n)-R,N=0,s=h;s<=b;s++)N+=i.get(n,s)*i.get(s,b);if(e[n]<0)_=f,z=N;else if(h=n,0===e[n]?i.set(n,b,0!==f?-N/f:-N/(x*E)):(c=i.get(n,n+1),m=i.get(n+1,n),l=(c*z-_*N)/(k=(r[n]-R)*(r[n]-R)+e[n]*e[n]),i.set(n,b,l),i.set(n+1,b,Math.abs(c)>Math.abs(_)?(-N-f*l)/c:(-z-m*l)/_)),x*(l=Math.abs(i.get(n,b)))*l>1)for(s=n;s<=b;s++)i.set(s,b,i.get(s,b)/l)}else if(k<0)for(h=b-1,Math.abs(i.get(b,b-1))>Math.abs(i.get(b-1,b))?(i.set(b-1,b-1,k/i.get(b,b-1)),i.set(b-1,b,-(i.get(b,b)-R)/i.get(b,b-1))):(v=U(0,-i.get(b-1,b),i.get(b-1,b-1)-R,k),i.set(b-1,b-1,v[0]),i.set(b-1,b,v[1])),i.set(b,b-1,0),i.set(b,b,1),n=b-2;n>=0;n--){for(g=0,p=0,s=h;s<=b;s++)g+=i.get(n,s)*i.get(s,b-1),p+=i.get(n,s)*i.get(s,b);if(f=i.get(n,n)-R,e[n]<0)_=f,N=g,z=p;else if(h=n,0===e[n]?(v=U(-g,-p,f,k),i.set(n,b-1,v[0]),i.set(n,b,v[1])):(c=i.get(n,n+1),m=i.get(n+1,n),d=(r[n]-R)*(r[n]-R)+e[n]*e[n]-k*k,w=(r[n]-R)*2*k,0===d&&0===w&&(d=x*E*(Math.abs(f)+Math.abs(k)+Math.abs(c)+Math.abs(m)+Math.abs(_))),v=U(c*N-_*g+k*p,c*z-_*p-k*g,d,w),i.set(n,b-1,v[0]),i.set(n,b,v[1]),Math.abs(c)>Math.abs(_)+Math.abs(k)?(i.set(n+1,b-1,(-g-f*i.get(n,b-1)+k*i.get(n,b))/c),i.set(n+1,b,(-p-f*i.get(n,b)-k*i.get(n,b-1))/c)):(v=U(-N-m*i.get(n,b-1),-z-m*i.get(n,b),_,k),i.set(n+1,b-1,v[0]),i.set(n+1,b,v[1]))),x*(l=Math.max(Math.abs(i.get(n,b-1)),Math.abs(i.get(n,b))))*l>1)for(s=n;s<=b;s++)i.set(s,b-1,i.get(s,b-1)/l),i.set(s,b,i.get(s,b)/l)}for(n=0;nM)for(s=n;s=0;s--)for(n=0;n<=M;n++){for(a=0,_=0;a<=Math.min(s,M);a++)_+=o.get(n,a)*i.get(a,s);o.set(n,s,_)}}}(n,h,a,s,t)}this.n=n,this.e=h,this.d=a,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,r=this.n,o=this.e,i=this.d,n=new M(r,r);for(t=0;t0?n.set(t,t+1,o[t]):o[t]<0&&n.set(t,t-1,o[t])}return n}}function U(t,e,r,o){let i,n;return Math.abs(r)>Math.abs(o)?(i=o/r,n=r+i*o,[(t+i*e)/n,(e-i*t)/n]):(i=r/o,n=o+i*r,[(i*t+e)/n,(i*e-t)/n])}class H{constructor(t){let e,r,o;if(!(t=T.checkMatrix(t)).isSymmetric())throw Error("Matrix is not symmetric");let i=t,n=i.rows,s=new M(n,n),a=!0;for(r=0;r0,s.set(r,r,Math.sqrt(Math.max(t,0))),o=r+1;o=0;o--)for(r=0;rf;e++)s=(s=t.transpose().mmul(r).div(r.transpose().mmul(r).get(0,0))).div(s.norm()),i=t.mmul(s).div(s.transpose().mmul(s).get(0,0)),e>0&&(c=i.clone().sub(a).pow(2).sum()),a=i.clone(),h?(n=(n=h.transpose().mmul(i).div(i.transpose().mmul(i).get(0,0))).div(n.norm()),r=h.mmul(n).div(n.transpose().mmul(n).get(0,0))):r=i;if(h){let e=t.transpose().mmul(i).div(i.transpose().mmul(i).get(0,0));e=e.div(e.norm());let o=t.clone().sub(i.clone().mmul(e.transpose())),a=r.transpose().mmul(i).div(i.transpose().mmul(i).get(0,0)),u=h.clone().sub(i.clone().mulS(a.get(0,0)).mmul(n.transpose()));this.t=i,this.p=e.transpose(),this.w=s.transpose(),this.q=n,this.u=r,this.s=i.transpose().mmul(i),this.xResidual=o,this.yResidual=u,this.betas=a}else this.w=s.transpose(),this.s=i.transpose().mmul(i).sqrt(),u?this.t=i.clone().div(this.s.get(0,0)):this.t=i,this.xResidual=t.sub(i.mmul(s.transpose()))}}e.XA=v,e.a_=H,e.yQ=H,e.Hs=S,e.Ec=L,e.dx=L,e.LU=j,e.Rm=j,e.y3=M,e.qK=k,e.pb=R,e.j=N,e.sO=z,e.BZ=A,e.EK=_,e.Db=P,e.Fx=I,e.tU=O,e.Ym=$,e.rs=$,e.QR=D,e.TB=D,e.oH=V,e.Sc=V,e.BN=x,e.it=C,e.$r=T,e.QM=function(t,e=t,r={}){t=new M(t);let i=!1;if("object"!=typeof e||M.isMatrix(e)||o.isAnyArray(e)?e=new M(e):(r=e,e=t,i=!0),t.rows!==e.rows)throw TypeError("Both matrices must have the same number of rows");let{center:n=!0,scale:s=!0}=r;n&&(t.center("column"),i||e.center("column")),s&&(t.scale("column"),i||e.scale("column"));let a=t.standardDeviation("column",{unbiased:!0}),h=i?a:e.standardDeviation("column",{unbiased:!0}),u=t.transpose().mmul(e);for(let e=0;ei)return Array(e.rows+1).fill(0);{let t=e.addRow(r,[0]);for(let e=0;ee?n[t]=1/n[t]:n[t]=0;return i.mmul(M.diag(n).mmul(o.transpose()))},e.F1=q,e.re=function(t,e){if(o.isAnyArray(t))return t[0]&&o.isAnyArray(t[0])?new T(t):new C(t,e);throw Error("the argument is not an array")}},19068:function(t,e,r){"use strict";r.r(e),r.d(e,{isAnyArray:function(){return i}});let o=Object.prototype.toString;function i(t){let e=o.call(t);return e.endsWith("Array]")&&!e.includes("Big")}},99949:function(t,e,r){"use strict";var o=r(88877);function i(){}function n(){}n.resetWarningCache=i,t.exports=function(){function t(t,e,r,i,n,s){if(s!==o){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function e(){return t}t.isRequired=t;var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:n,resetWarningCache:i};return r.PropTypes=r,r}},41448:function(t,e,r){t.exports=r(99949)()},88877:function(t){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},86108:function(t,e,r){"use strict";function o(t){return(o="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})(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}(a,e);var r,i,s=(r=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=l(a);return t=r?Reflect.construct(e,arguments,l(this).constructor):e.apply(this,arguments),function(t,e){if(e&&("object"===o(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return u(t)}(this,t)});function a(t){var e;return function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,a),(e=s.call(this,t)).p=Promise.resolve(),e.resizeHandler=null,e.handlers={},e.syncWindowResize=e.syncWindowResize.bind(u(e)),e.syncEventHandlers=e.syncEventHandlers.bind(u(e)),e.attachUpdateEvents=e.attachUpdateEvents.bind(u(e)),e.getRef=e.getRef.bind(u(e)),e.handleUpdate=e.handleUpdate.bind(u(e)),e.figureCallback=e.figureCallback.bind(u(e)),e.updatePlotly=e.updatePlotly.bind(u(e)),e}return i=[{key:"updatePlotly",value:function(e,r,o){var i=this;this.p=this.p.then(function(){if(!i.unmounting){if(!i.el)throw Error("Missing element reference");return t.react(i.el,{data:i.props.data,layout:i.props.layout,config:i.props.config,frames:i.props.frames})}}).then(function(){!i.unmounting&&(i.syncWindowResize(e),i.syncEventHandlers(),i.figureCallback(r),o&&i.attachUpdateEvents())}).catch(function(t){i.props.onError&&i.props.onError(t)})}},{key:"componentDidMount",value:function(){this.unmounting=!1,this.updatePlotly(!0,this.props.onInitialized,!0)}},{key:"componentDidUpdate",value:function(t){this.unmounting=!1;var e=t.frames&&t.frames.length?t.frames.length:0,r=this.props.frames&&this.props.frames.length?this.props.frames.length:0,o=!(t.layout===this.props.layout&&t.data===this.props.data&&t.config===this.props.config&&r===e),i=void 0!==t.revision,n=t.revision!==this.props.revision;(o||i&&(!i||n))&&this.updatePlotly(!1,this.props.onUpdate,!1)}},{key:"componentWillUnmount",value:function(){this.unmounting=!0,this.figureCallback(this.props.onPurge),this.resizeHandler&&m&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null),this.removeUpdateEvents(),t.purge(this.el)}},{key:"attachUpdateEvents",value:function(){var t=this;this.el&&this.el.removeListener&&c.forEach(function(e){t.el.on(e,t.handleUpdate)})}},{key:"removeUpdateEvents",value:function(){var t=this;this.el&&this.el.removeListener&&c.forEach(function(e){t.el.removeListener(e,t.handleUpdate)})}},{key:"handleUpdate",value:function(){this.figureCallback(this.props.onUpdate)}},{key:"figureCallback",value:function(t){if("function"==typeof t){var e=this.el;t({data:e.data,layout:e.layout,frames:this.el._transitionData?this.el._transitionData._frames:null},this.el)}}},{key:"syncWindowResize",value:function(e){var r=this;m&&(this.props.useResizeHandler&&!this.resizeHandler?(this.resizeHandler=function(){return t.Plots.resize(r.el)},window.addEventListener("resize",this.resizeHandler),e&&this.resizeHandler()):!this.props.useResizeHandler&&this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null))}},{key:"getRef",value:function(t){this.el=t,this.props.debug&&m&&(window.gd=this.el)}},{key:"syncEventHandlers",value:function(){var t=this;f.forEach(function(e){var r=t.props["on"+e],o=t.handlers[e],i=!!o;r&&!i?t.addEventHandler(e,r):!r&&i?t.removeEventHandler(e):r&&i&&r!==o&&(t.removeEventHandler(e),t.addEventHandler(e,r))})}},{key:"addEventHandler",value:function(t,e){this.handlers[t]=e,this.el.on(this.getPlotlyEventName(t),this.handlers[t])}},{key:"removeEventHandler",value:function(t){this.el.removeListener(this.getPlotlyEventName(t),this.handlers[t]),delete this.handlers[t]}},{key:"getPlotlyEventName",value:function(t){return"plotly_"+t.toLowerCase()}},{key:"render",value:function(){return n.default.createElement("div",{id:this.props.divId,style:this.props.style,ref:this.getRef,className:this.props.className})}}],function(t,e){for(var r=0;r=s[0])return 0;for(var a=0;a=s[0])return 0;s[0]=r,n[0]=o,a[0]=i;for(var h=0,u=0;;){var l=2*h+1,f=l+1,c=t[0][0].length;if(l>=c)break;if(f>=c){if(s[l]>r)u=l;else break}else if(s[l]>=s[f]){if(rr.length;a++)1===i[a]&&o[a]=0?(i[s]=0,Math.floor(r[s])):-1}},5778:function(t,e,r){"use strict";var o=r(28158);Object.defineProperty(e,"u",{enumerable:!0,get:function(){return o.UMAP}})},78965:function(t,e,r){"use strict";var o,i=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&i(e,t,r);return n(e,t),e},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var o,i,n=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return s},h=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],o=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.getCSR=e.normalize=e.eliminateZeros=e.multiplyScalar=e.maximum=e.subtract=e.add=e.pairwiseMultiply=e.identity=e.transpose=e.SparseMatrix=void 0;var u=s(r(10006)),l=function(){function t(t,e,r,o){if(this.entries=new Map,this.nRows=0,this.nCols=0,t.length!==e.length||t.length!==r.length)throw Error("rows, cols and values arrays must all have the same length");this.nRows=o[0],this.nCols=o[1];for(var i=0;ie?t:e})},e.multiplyScalar=function(t,e){return t.map(function(t){return t*e})},e.eliminateZeros=function(t){for(var e=new Set,r=t.getValues(),o=t.getRows(),i=t.getCols(),n=0;ne?t[r]:e;return t.map(function(t){return t/e})},o.l1=function(t){for(var e=0,r=0;r=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.initializeSearch=e.makeInitializedNNSearch=e.makeInitializations=e.makeNNDescent=void 0;var a=n(r(35230)),h=n(r(78965)),u=n(r(50993)),l=n(r(10006));e.makeNNDescent=function(t,e){return function(r,o,i,n,s,h,u,f){void 0===n&&(n=10),void 0===s&&(s=50),void 0===h&&(h=.001),void 0===u&&(u=.5),void 0===f&&(f=!0);for(var c=r.length,m=a.makeHeap(r.length,i),g=0;g0)&&!(o=n.next()).done;)s.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return s},a=this&&this.__spread||function(){for(var t=[],e=0;e=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.searchFlatTree=e.makeLeafArray=e.makeForest=e.FlatTree=void 0;var u=n(r(10006)),l=function(t,e,r,o){this.hyperplanes=t,this.offsets=e,this.children=r,this.indices=o};e.FlatTree=l,e.makeForest=function(t,e,r,o){var i=Math.max(10,e);return u.range(r).map(function(e,r){var n,s;return void 0===(n=i)&&(n=30),s=u.range(t.length),function t(e,r,o,i,n){if(void 0===o&&(o=30),r.length>o){var s=function(t,e,r){var o=t[0].length,i=u.tauRandInt(e.length,r),n=u.tauRandInt(e.length,r);n+=i===n?1:0,n%=e.length;for(var s=e[i],a=e[n],h=0,l=u.zeros(o),f=0;f0?(g[f]=0,c+=1):(g[f]=1,m+=1)}var w=u.zeros(c),y=u.zeros(m);c=0,m=0;for(var f=0;f0))return[[-1]];var e,r,o=[];try{for(var i=h(t),n=i.next();!n.done;n=i.next()){var s=n.value;o.push.apply(o,a(s.indices))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return o},e.searchFlatTree=function(t,e,r){for(var o=0;e.children[o][0]>0;)o=0===function(t,e,r,o){for(var i=e,n=0;n0?0:1}(e.hyperplanes[o],e.offsets[o],t,r)?e.children[o][0]:e.children[o][1];var i=-1*e.children[o][0];return e.indices[i]}},28158:function(t,e,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&o(e,t,r);return i(e,t),e},s=this&&this.__awaiter||function(t,e,r,o){return new(r||(r=Promise))(function(i,n){function s(t){try{h(o.next(t))}catch(t){n(t)}}function a(t){try{h(o.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(s,a)}h((o=o.apply(t,e||[])).next())})},a=this&&this.__generator||function(t,e){var r,o,i,n,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(n){return function(a){return function(n){if(r)throw TypeError("Generator is already executing.");for(;s;)try{if(r=1,o&&(i=2&n[0]?o.return:n[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,n[1])).done)return i;switch(o=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return s.label++,{value:n[1],done:!1};case 5:s.label++,o=n[1],n=[0];continue;case 7:n=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===n[0]||2===n[0])){s=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]0)&&!(o=n.next()).done;)s.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return s},u=this&&this.__spread||function(){for(var t=[],e=0;e0&&i.set(n,u,l)}var f=c.transpose(i);return c.maximum(i,f)},t.prototype.transform=function(t){var e=this,r=this.X;if(void 0===r||0===r.length)throw Error("No data has been fit.");var o=Math.floor(this.nNeighbors*this.transformQueueSize);o=Math.min(r.length,o);var i=m.initializeSearch(this.rpForest,r,t,o,this.initFromRandom,this.initFromTree,this.random),n=this.search(r,this.searchGraph,i,t),s=f.deheapSort(n),a=s.indices,h=s.weights;a=a.map(function(t){return t.slice(0,e.nNeighbors)}),h=h.map(function(t){return t.slice(0,e.nNeighbors)});var u=Math.max(0,this.localConnectivity-1),l=this.smoothKNNDistance(h,this.nNeighbors,u),g=l.sigmas,d=l.rhos,w=this.computeMembershipStrengths(a,h,g,d),y=w.rows,v=w.cols,b=w.vals,M=[t.length,r.length],x=new c.SparseMatrix(y,v,b,M),S=c.normalize(x,"l1"),E=c.getCSR(S),k=t.length,N=R(p.reshape2d(E.indices,k,this.nNeighbors),p.reshape2d(E.values,k,this.nNeighbors),this.embedding),z=this.nEpochs?this.nEpochs/3:x.nRows<=1e4?100:30,_=x.getValues().reduce(function(t,e){return e>t?e:t},0);x=x.map(function(t){return t<_/z?0:t}),x=c.eliminateZeros(x);var A=this.makeEpochsPerSample(x.getValues(),z),P=x.getRows(),I=x.getCols();return this.assignOptimizationStateParameters({headEmbedding:N,tailEmbedding:this.embedding,head:P,tail:I,currentEpoch:0,nEpochs:z,nVertices:x.getDims()[1],epochsPerSample:A}),this.prepareForOptimizationLoop(),this.optimizeLayout()},t.prototype.processGraphForSupervisedProjection=function(){var t=this.Y,e=this.X;if(t){if(t.length!==e.length)throw Error("Length of X and y must be equal");if("categorical"===this.targetMetric){var r=this.targetWeight<1?1/(1-this.targetWeight)*2.5:1e12;this.graph=this.categoricalSimplicialSetIntersection(this.graph,t,r)}}},t.prototype.step=function(){var t=this.optimizationState.currentEpoch;return t0});if(m.length>=r){var g=Math.floor(r),d=r-g;g>0?(s[h]=m[g-1],d>1e-5&&(s[h]+=d*(m[g]-m[g-1]))):s[h]=d*m[0]}else m.length>0&&(s[h]=p.max(m));for(var w=0;w0?y+=Math.exp(-(b/f)):y+=1}if(1e-5>Math.abs(y-n))break;y>n?f=(u+(l=f))/2:(u=f,l===1/0?f*=2:f=(u+l)/2)}if(a[h]=f,s[h]>0){var M=p.mean(c);a[h]<.001*M&&(a[h]=.001*M)}else{var x=p.mean(t.map(p.mean));a[h]<.001*x&&(a[h]=.001*x)}}return{sigmas:a,rhos:s}},t.prototype.computeMembershipStrengths=function(t,e,r,o){for(var i=t.length,n=t[0].length,s=p.zeros(i*n),a=p.zeros(i*n),h=p.zeros(i*n),u=0;u0&&(r[o]=e/i[o])}),r},t.prototype.assignOptimizationStateParameters=function(t){Object.assign(this.optimizationState,t)},t.prototype.prepareForOptimizationLoop=function(){var t=this.repulsionStrength,e=this.learningRate,r=this.negativeSampleRate,o=this.optimizationState,i=o.epochsPerSample,n=o.headEmbedding,s=o.tailEmbedding,a=n[0].length,h=n.length===s.length,l=i.map(function(t){return t/r}),f=u(l),c=u(i);this.assignOptimizationStateParameters({epochOfNextSample:c,epochOfNextNegativeSample:f,epochsPerNegativeSample:l,moveOther:h,initialAlpha:e,alpha:e,gamma:t,dim:a})},t.prototype.initializeOptimization=function(){var t=this.embedding,e=this.embedding,r=this.optimizationState,o=r.head,i=r.tail,n=r.epochsPerSample,s=this.getNEpochs(),a=this.graph.nCols,h=x(this.spread,this.minDist),u=h.a,l=h.b;this.assignOptimizationStateParameters({headEmbedding:t,tailEmbedding:e,head:o,tail:i,epochsPerSample:n,a:u,b:l,nEpochs:s,nVertices:a})},t.prototype.optimizeLayoutStep=function(t){for(var e=this.optimizationState,r=e.head,o=e.tail,i=e.headEmbedding,n=e.tailEmbedding,s=e.epochsPerSample,a=e.epochOfNextSample,h=e.epochOfNextNegativeSample,u=e.epochsPerNegativeSample,l=e.moveOther,f=e.initialAlpha,c=e.alpha,m=e.gamma,g=e.a,d=e.b,w=e.dim,y=e.nEpochs,v=e.nVertices,x=0;xt)){var S=r[x],E=o[x],R=i[S],k=n[E],N=M(R,k),z=0;N>0&&(z=-2*g*d*Math.pow(N,d-1)/(g*Math.pow(N,d)+1));for(var _=0;_0)j=2*m*d/((.001+T)*(g*Math.pow(T,d)+1));else if(S===O)continue;for(var _=0;_0&&(A=b(j*(R[_]-C[_]),4)),R[_]+=A*c}}h[x]+=P*u[x]}return e.alpha=f*(1-t/y),e.currentEpoch+=1,i},t.prototype.optimizeLayoutAsync=function(t){var e=this;return void 0===t&&(t=function(){return!0}),new Promise(function(r,o){var i=function(){return s(e,void 0,void 0,function(){var e,n,s,h,u,l;return a(this,function(a){try{if(n=(e=this.optimizationState).nEpochs,s=e.currentEpoch,this.embedding=this.optimizeLayoutStep(s),h=this.optimizationState.currentEpoch,u=!1===t(h),l=h===n,u||l)return[2,r(l)];setTimeout(function(){return i()},0)}catch(t){o(t)}return[2]})})};setTimeout(function(){return i()},0)})},t.prototype.optimizeLayout=function(t){void 0===t&&(t=function(){return!0});for(var e=!1,r=[];!e;){var o=this.optimizationState,i=o.nEpochs,n=o.currentEpoch;r=this.optimizeLayoutStep(n);var s=this.optimizationState.currentEpoch,a=!1===t(s);e=s===i||a}return r},t.prototype.getNEpochs=function(){var t=this.graph;if(this.nEpochs>0)return this.nEpochs;var e=t.nRows;return e<=2500?500:e<=5e3?400:e<=7500?300:200},t}();function y(t,e){for(var r=0,o=0;oe?e:t<-e?-e:t}function M(t,e){for(var r=0,o=0;o=e?Math.exp(-(r[i]-e)/t):o}),i=d.default({x:r,y:o},function(t){var e=h(t,2),r=e[0],o=e[1];return function(t){return 1/(1+r*Math.pow(t,2*o))}},{damping:1.5,initialValues:[.5,.5],gradientDifference:.1,maxIterations:100,errorTolerance:.01}).parameterValues,n=h(i,2);return{a:n[0],b:n[1]}}function S(t,e,r,o){return void 0===r&&(r=1),void 0===o&&(o=5),t.map(function(t,i,n){return -1===e[i]||-1===e[n]?t*Math.exp(-r):e[i]!==e[n]?t*Math.exp(-o):t})}function E(t){t=c.normalize(t,"max");var e=c.transpose(t),r=c.pairwiseMultiply(e,t);return t=c.add(t,c.subtract(e,r)),c.eliminateZeros(t)}function R(t,e,r){for(var o=p.zeros(t.length).map(function(t){return p.zeros(r[0].length)}),i=0;i=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function o(t,e){return Math.floor(e()*t)}function i(t){for(var e=[],r=0;re?t[r]:e;return e},e.max2d=function(t){for(var e=0,r=0;re?t[r][o]:e;return e},e.rejectionSample=function(t,e,r){for(var i=s(t),n=0;n>6],n=(32&r)==0;if((31&r)==31){var a=r;for(r=0;(128&a)==128;){if(a=t.readUInt8(e),t.isError(a))return a;r<<=7,r|=127&a}}else r&=31;var o=f.tag[r];return{cls:i,primitive:n,tag:r,tagStr:o}}function c(t,e,r){var i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if((128&i)==0)return i;var n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(var a=0;a=31?i.error("Multi-octet tag encoding unsupported"):(e||(n|=32),n|=f.tagClassByName[r||"universal"]<<6)}(t,e,r,this.reporter);if(i.length<128){var o=new n(2);return o[0]=a,o[1]=i.length,this._createEncoderBuffer([o,i])}for(var s=1,h=i.length;h>=256;h>>=8)s++;var o=new n(2+s);o[0]=a,o[1]=128|s;for(var h=1+s,d=i.length;d>0;h--,d>>=8)o[h]=255&d;return this._createEncoderBuffer([o,i])},h.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=new n(2*t.length),i=0;i=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}for(var a=0,i=0;i=128;o>>=7)a++}for(var f=new n(a),s=f.length-1,i=t.length-1;i>=0;i--){var o=t[i];for(f[s--]=127&o;(o>>=7)>0;)f[s--]=128|127&o}return this._createEncoderBuffer(f)},h.prototype._encodeTime=function(t,e){var r,i=new Date(t);return"gentime"===e?r=[d(i.getFullYear()),d(i.getUTCMonth()+1),d(i.getUTCDate()),d(i.getUTCHours()),d(i.getUTCMinutes()),d(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[d(i.getFullYear()%100),d(i.getUTCMonth()+1),d(i.getUTCDate()),d(i.getUTCHours()),d(i.getUTCMinutes()),d(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},h.prototype._encodeNull=function(){return this._createEncoderBuffer("")},h.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!n.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new n(r)}if(n.isBuffer(t)){var i=t.length;0===t.length&&i++;var a=new n(i);return t.copy(a),0===t.length&&(a[0]=0),this._createEncoderBuffer(a)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);for(var i=1,o=t;o>=256;o>>=8)i++;for(var a=Array(i),o=a.length-1;o>=0;o--)a[o]=255&t,t>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(new n(a))},h.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},h.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},h.prototype._skipDefault=function(t,e,r){var i,n=this._baseState;if(null===n.default)return!1;var a=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),a.length!==n.defaultBuffer.length)return!1;for(i=0;i=49&&o<=54?i|=o-49+10:o>=17&&o<=22?i|=o-17+10:i|=15&o}return i}function f(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?n+=f-49+10:f>=17?n+=f-17+10:n+=f}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return 0>t.cmp(e)?t:e},a.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),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=Array(this.length);for(var n,a,o=0;o=0;o-=3)a=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[n]|=a<>>26-f&67108863,(f+=24)>=26&&(f-=26,n++);else if("le"===r)for(o=0,n=0;o>>26-f&67108863,(f+=24)>=26&&(f-=26,n++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=Array(this.length);for(var r,i,n=0;n=e;n-=6)i=o(t,n,n+6),this.words[r]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,r++);n+6!==e&&(i=o(t,e,n+6),this.words[r]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=0,d=r;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var s,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"],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],c=[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 u(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,f=67108863&o,s=o/67108864|0;r.words[0]=f;for(var h=1;h>>26,c=67108863&s,u=Math.min(h,e.length-1),l=Math.max(0,h-t.length+1);l<=u;l++){var p=h-l|0;d+=(o=(n=0|t.words[p])*(a=0|e.words[l])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,s=0|d}return 0!==s?r.words[h]=0|s:r.length--,r.strip()}a.prototype.toString=function(t,e){if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var r,n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-s.length]+s+r:s+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.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 u=d[t],l=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(l).toString(t);r=(p=p.idivn(l)).isZero()?b+r:h[u-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.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&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==s),this.toArrayLike(s,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n,a,o=this.byteLength(),f=r||Math.max(1,o);i(o<=f,"byte array longer than desired length"),i(f>0,"Requested array length <= 0"),this.strip();var s=new t(f),h=this.clone();if("le"===e){for(a=0;!h.isZero();a++)n=h.andln(255),h.iushrn(8),s[a]=n;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},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return(8191&e)==0&&(r+=13,e>>>=13),(127&e)==0&&(r+=7,e>>>=7),(15&e)==0&&(r+=4,e>>>=4),(3&e)==0&&(r+=2,e>>>=2),(1&e)==0&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return(this.length-1)*26+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.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)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){this.length>t.length?(e=this,r=t):(e=t,r=this);for(var e,r,i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),e?this.words[r]=this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var e,r,i,n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e,r,i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(e=this,r=t):(e=t,r=this);for(var a=0,o=0;o>26,this.words[o]=67108863&i;for(;0!==a&&o>26,this.words[o]=67108863&i;if(0===a&&o>>13,l=0|o[1],p=8191&l,b=l>>>13,m=0|o[2],v=8191&m,y=m>>>13,g=0|o[3],_=8191&g,w=g>>>13,M=0|o[4],S=8191&M,k=M>>>13,E=0|o[5],A=8191&E,x=E>>>13,R=0|o[6],I=8191&R,B=R>>>13,P=0|o[7],T=8191&P,C=P>>>13,j=0|o[8],O=8191&j,D=j>>>13,N=0|o[9],q=8191&N,L=N>>>13,z=0|f[0],U=8191&z,K=z>>>13,H=0|f[1],F=8191&H,V=H>>>13,W=0|f[2],Z=8191&W,X=W>>>13,G=0|f[3],J=8191&G,Y=G>>>13,$=0|f[4],Q=8191&$,tt=$>>>13,te=0|f[5],tr=8191&te,ti=te>>>13,tn=0|f[6],ta=8191&tn,to=tn>>>13,tf=0|f[7],ts=8191&tf,th=tf>>>13,td=0|f[8],tc=8191&td,tu=td>>>13,tl=0|f[9],tp=8191&tl,tb=tl>>>13;r.negative=t.negative^e.negative,r.length=19;var tm=(h+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,K))+Math.imul(u,U)|0))<<13)|0;h=((a=Math.imul(u,K))+(n>>>13)|0)+(tm>>>26)|0,tm&=67108863,i=Math.imul(p,U),n=(n=Math.imul(p,K))+Math.imul(b,U)|0,a=Math.imul(b,K);var tv=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(u,F)|0))<<13)|0;h=((a=a+Math.imul(u,V)|0)+(n>>>13)|0)+(tv>>>26)|0,tv&=67108863,i=Math.imul(v,U),n=(n=Math.imul(v,K))+Math.imul(y,U)|0,a=Math.imul(y,K),i=i+Math.imul(p,F)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(b,F)|0,a=a+Math.imul(b,V)|0;var ty=(h+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,X)|0)+Math.imul(u,Z)|0))<<13)|0;h=((a=a+Math.imul(u,X)|0)+(n>>>13)|0)+(ty>>>26)|0,ty&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(w,U)|0,a=Math.imul(w,K),i=i+Math.imul(v,F)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,F)|0,a=a+Math.imul(y,V)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(b,Z)|0,a=a+Math.imul(b,X)|0;var tg=(h+(i=i+Math.imul(c,J)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(u,J)|0))<<13)|0;h=((a=a+Math.imul(u,Y)|0)+(n>>>13)|0)+(tg>>>26)|0,tg&=67108863,i=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(k,U)|0,a=Math.imul(k,K),i=i+Math.imul(_,F)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(w,F)|0,a=a+Math.imul(w,V)|0,i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,Z)|0,a=a+Math.imul(y,X)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(b,J)|0,a=a+Math.imul(b,Y)|0;var t_=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(u,Q)|0))<<13)|0;h=((a=a+Math.imul(u,tt)|0)+(n>>>13)|0)+(t_>>>26)|0,t_&=67108863,i=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(x,U)|0,a=Math.imul(x,K),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(k,F)|0,a=a+Math.imul(k,V)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(w,Z)|0,a=a+Math.imul(w,X)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(y,J)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,a=a+Math.imul(b,tt)|0;var tw=(h+(i=i+Math.imul(c,tr)|0)|0)+((8191&(n=(n=n+Math.imul(c,ti)|0)+Math.imul(u,tr)|0))<<13)|0;h=((a=a+Math.imul(u,ti)|0)+(n>>>13)|0)+(tw>>>26)|0,tw&=67108863,i=Math.imul(I,U),n=(n=Math.imul(I,K))+Math.imul(B,U)|0,a=Math.imul(B,K),i=i+Math.imul(A,F)|0,n=(n=n+Math.imul(A,V)|0)+Math.imul(x,F)|0,a=a+Math.imul(x,V)|0,i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(k,Z)|0,a=a+Math.imul(k,X)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(w,J)|0,a=a+Math.imul(w,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,tt)|0,i=i+Math.imul(p,tr)|0,n=(n=n+Math.imul(p,ti)|0)+Math.imul(b,tr)|0,a=a+Math.imul(b,ti)|0;var tM=(h+(i=i+Math.imul(c,ta)|0)|0)+((8191&(n=(n=n+Math.imul(c,to)|0)+Math.imul(u,ta)|0))<<13)|0;h=((a=a+Math.imul(u,to)|0)+(n>>>13)|0)+(tM>>>26)|0,tM&=67108863,i=Math.imul(T,U),n=(n=Math.imul(T,K))+Math.imul(C,U)|0,a=Math.imul(C,K),i=i+Math.imul(I,F)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(B,F)|0,a=a+Math.imul(B,V)|0,i=i+Math.imul(A,Z)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(x,Z)|0,a=a+Math.imul(x,X)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(k,J)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(w,Q)|0,a=a+Math.imul(w,tt)|0,i=i+Math.imul(v,tr)|0,n=(n=n+Math.imul(v,ti)|0)+Math.imul(y,tr)|0,a=a+Math.imul(y,ti)|0,i=i+Math.imul(p,ta)|0,n=(n=n+Math.imul(p,to)|0)+Math.imul(b,ta)|0,a=a+Math.imul(b,to)|0;var tS=(h+(i=i+Math.imul(c,ts)|0)|0)+((8191&(n=(n=n+Math.imul(c,th)|0)+Math.imul(u,ts)|0))<<13)|0;h=((a=a+Math.imul(u,th)|0)+(n>>>13)|0)+(tS>>>26)|0,tS&=67108863,i=Math.imul(O,U),n=(n=Math.imul(O,K))+Math.imul(D,U)|0,a=Math.imul(D,K),i=i+Math.imul(T,F)|0,n=(n=n+Math.imul(T,V)|0)+Math.imul(C,F)|0,a=a+Math.imul(C,V)|0,i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(B,Z)|0,a=a+Math.imul(B,X)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(x,J)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(_,tr)|0,n=(n=n+Math.imul(_,ti)|0)+Math.imul(w,tr)|0,a=a+Math.imul(w,ti)|0,i=i+Math.imul(v,ta)|0,n=(n=n+Math.imul(v,to)|0)+Math.imul(y,ta)|0,a=a+Math.imul(y,to)|0,i=i+Math.imul(p,ts)|0,n=(n=n+Math.imul(p,th)|0)+Math.imul(b,ts)|0,a=a+Math.imul(b,th)|0;var tk=(h+(i=i+Math.imul(c,tc)|0)|0)+((8191&(n=(n=n+Math.imul(c,tu)|0)+Math.imul(u,tc)|0))<<13)|0;h=((a=a+Math.imul(u,tu)|0)+(n>>>13)|0)+(tk>>>26)|0,tk&=67108863,i=Math.imul(q,U),n=(n=Math.imul(q,K))+Math.imul(L,U)|0,a=Math.imul(L,K),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(D,F)|0,a=a+Math.imul(D,V)|0,i=i+Math.imul(T,Z)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(C,Z)|0,a=a+Math.imul(C,X)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(B,J)|0,a=a+Math.imul(B,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(S,tr)|0,n=(n=n+Math.imul(S,ti)|0)+Math.imul(k,tr)|0,a=a+Math.imul(k,ti)|0,i=i+Math.imul(_,ta)|0,n=(n=n+Math.imul(_,to)|0)+Math.imul(w,ta)|0,a=a+Math.imul(w,to)|0,i=i+Math.imul(v,ts)|0,n=(n=n+Math.imul(v,th)|0)+Math.imul(y,ts)|0,a=a+Math.imul(y,th)|0,i=i+Math.imul(p,tc)|0,n=(n=n+Math.imul(p,tu)|0)+Math.imul(b,tc)|0,a=a+Math.imul(b,tu)|0;var tE=(h+(i=i+Math.imul(c,tp)|0)|0)+((8191&(n=(n=n+Math.imul(c,tb)|0)+Math.imul(u,tp)|0))<<13)|0;h=((a=a+Math.imul(u,tb)|0)+(n>>>13)|0)+(tE>>>26)|0,tE&=67108863,i=Math.imul(q,F),n=(n=Math.imul(q,V))+Math.imul(L,F)|0,a=Math.imul(L,V),i=i+Math.imul(O,Z)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(D,Z)|0,a=a+Math.imul(D,X)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(C,J)|0,a=a+Math.imul(C,Y)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(B,Q)|0,a=a+Math.imul(B,tt)|0,i=i+Math.imul(A,tr)|0,n=(n=n+Math.imul(A,ti)|0)+Math.imul(x,tr)|0,a=a+Math.imul(x,ti)|0,i=i+Math.imul(S,ta)|0,n=(n=n+Math.imul(S,to)|0)+Math.imul(k,ta)|0,a=a+Math.imul(k,to)|0,i=i+Math.imul(_,ts)|0,n=(n=n+Math.imul(_,th)|0)+Math.imul(w,ts)|0,a=a+Math.imul(w,th)|0,i=i+Math.imul(v,tc)|0,n=(n=n+Math.imul(v,tu)|0)+Math.imul(y,tc)|0,a=a+Math.imul(y,tu)|0;var tA=(h+(i=i+Math.imul(p,tp)|0)|0)+((8191&(n=(n=n+Math.imul(p,tb)|0)+Math.imul(b,tp)|0))<<13)|0;h=((a=a+Math.imul(b,tb)|0)+(n>>>13)|0)+(tA>>>26)|0,tA&=67108863,i=Math.imul(q,Z),n=(n=Math.imul(q,X))+Math.imul(L,Z)|0,a=Math.imul(L,X),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(D,J)|0,a=a+Math.imul(D,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,tt)|0,i=i+Math.imul(I,tr)|0,n=(n=n+Math.imul(I,ti)|0)+Math.imul(B,tr)|0,a=a+Math.imul(B,ti)|0,i=i+Math.imul(A,ta)|0,n=(n=n+Math.imul(A,to)|0)+Math.imul(x,ta)|0,a=a+Math.imul(x,to)|0,i=i+Math.imul(S,ts)|0,n=(n=n+Math.imul(S,th)|0)+Math.imul(k,ts)|0,a=a+Math.imul(k,th)|0,i=i+Math.imul(_,tc)|0,n=(n=n+Math.imul(_,tu)|0)+Math.imul(w,tc)|0,a=a+Math.imul(w,tu)|0;var tx=(h+(i=i+Math.imul(v,tp)|0)|0)+((8191&(n=(n=n+Math.imul(v,tb)|0)+Math.imul(y,tp)|0))<<13)|0;h=((a=a+Math.imul(y,tb)|0)+(n>>>13)|0)+(tx>>>26)|0,tx&=67108863,i=Math.imul(q,J),n=(n=Math.imul(q,Y))+Math.imul(L,J)|0,a=Math.imul(L,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,a=a+Math.imul(D,tt)|0,i=i+Math.imul(T,tr)|0,n=(n=n+Math.imul(T,ti)|0)+Math.imul(C,tr)|0,a=a+Math.imul(C,ti)|0,i=i+Math.imul(I,ta)|0,n=(n=n+Math.imul(I,to)|0)+Math.imul(B,ta)|0,a=a+Math.imul(B,to)|0,i=i+Math.imul(A,ts)|0,n=(n=n+Math.imul(A,th)|0)+Math.imul(x,ts)|0,a=a+Math.imul(x,th)|0,i=i+Math.imul(S,tc)|0,n=(n=n+Math.imul(S,tu)|0)+Math.imul(k,tc)|0,a=a+Math.imul(k,tu)|0;var tR=(h+(i=i+Math.imul(_,tp)|0)|0)+((8191&(n=(n=n+Math.imul(_,tb)|0)+Math.imul(w,tp)|0))<<13)|0;h=((a=a+Math.imul(w,tb)|0)+(n>>>13)|0)+(tR>>>26)|0,tR&=67108863,i=Math.imul(q,Q),n=(n=Math.imul(q,tt))+Math.imul(L,Q)|0,a=Math.imul(L,tt),i=i+Math.imul(O,tr)|0,n=(n=n+Math.imul(O,ti)|0)+Math.imul(D,tr)|0,a=a+Math.imul(D,ti)|0,i=i+Math.imul(T,ta)|0,n=(n=n+Math.imul(T,to)|0)+Math.imul(C,ta)|0,a=a+Math.imul(C,to)|0,i=i+Math.imul(I,ts)|0,n=(n=n+Math.imul(I,th)|0)+Math.imul(B,ts)|0,a=a+Math.imul(B,th)|0,i=i+Math.imul(A,tc)|0,n=(n=n+Math.imul(A,tu)|0)+Math.imul(x,tc)|0,a=a+Math.imul(x,tu)|0;var tI=(h+(i=i+Math.imul(S,tp)|0)|0)+((8191&(n=(n=n+Math.imul(S,tb)|0)+Math.imul(k,tp)|0))<<13)|0;h=((a=a+Math.imul(k,tb)|0)+(n>>>13)|0)+(tI>>>26)|0,tI&=67108863,i=Math.imul(q,tr),n=(n=Math.imul(q,ti))+Math.imul(L,tr)|0,a=Math.imul(L,ti),i=i+Math.imul(O,ta)|0,n=(n=n+Math.imul(O,to)|0)+Math.imul(D,ta)|0,a=a+Math.imul(D,to)|0,i=i+Math.imul(T,ts)|0,n=(n=n+Math.imul(T,th)|0)+Math.imul(C,ts)|0,a=a+Math.imul(C,th)|0,i=i+Math.imul(I,tc)|0,n=(n=n+Math.imul(I,tu)|0)+Math.imul(B,tc)|0,a=a+Math.imul(B,tu)|0;var tB=(h+(i=i+Math.imul(A,tp)|0)|0)+((8191&(n=(n=n+Math.imul(A,tb)|0)+Math.imul(x,tp)|0))<<13)|0;h=((a=a+Math.imul(x,tb)|0)+(n>>>13)|0)+(tB>>>26)|0,tB&=67108863,i=Math.imul(q,ta),n=(n=Math.imul(q,to))+Math.imul(L,ta)|0,a=Math.imul(L,to),i=i+Math.imul(O,ts)|0,n=(n=n+Math.imul(O,th)|0)+Math.imul(D,ts)|0,a=a+Math.imul(D,th)|0,i=i+Math.imul(T,tc)|0,n=(n=n+Math.imul(T,tu)|0)+Math.imul(C,tc)|0,a=a+Math.imul(C,tu)|0;var tP=(h+(i=i+Math.imul(I,tp)|0)|0)+((8191&(n=(n=n+Math.imul(I,tb)|0)+Math.imul(B,tp)|0))<<13)|0;h=((a=a+Math.imul(B,tb)|0)+(n>>>13)|0)+(tP>>>26)|0,tP&=67108863,i=Math.imul(q,ts),n=(n=Math.imul(q,th))+Math.imul(L,ts)|0,a=Math.imul(L,th),i=i+Math.imul(O,tc)|0,n=(n=n+Math.imul(O,tu)|0)+Math.imul(D,tc)|0,a=a+Math.imul(D,tu)|0;var tT=(h+(i=i+Math.imul(T,tp)|0)|0)+((8191&(n=(n=n+Math.imul(T,tb)|0)+Math.imul(C,tp)|0))<<13)|0;h=((a=a+Math.imul(C,tb)|0)+(n>>>13)|0)+(tT>>>26)|0,tT&=67108863,i=Math.imul(q,tc),n=(n=Math.imul(q,tu))+Math.imul(L,tc)|0,a=Math.imul(L,tu);var tC=(h+(i=i+Math.imul(O,tp)|0)|0)+((8191&(n=(n=n+Math.imul(O,tb)|0)+Math.imul(D,tp)|0))<<13)|0;h=((a=a+Math.imul(D,tb)|0)+(n>>>13)|0)+(tC>>>26)|0,tC&=67108863;var tj=(h+(i=Math.imul(q,tp))|0)+((8191&(n=(n=Math.imul(q,tb))+Math.imul(L,tp)|0))<<13)|0;return h=((a=Math.imul(L,tb))+(n>>>13)|0)+(tj>>>26)|0,tj&=67108863,s[0]=tm,s[1]=tv,s[2]=ty,s[3]=tg,s[4]=t_,s[5]=tw,s[6]=tM,s[7]=tS,s[8]=tk,s[9]=tE,s[10]=tA,s[11]=tx,s[12]=tR,s[13]=tI,s[14]=tB,s[15]=tP,s[16]=tT,s[17]=tC,s[18]=tj,0!==h&&(s[19]=h,r.length++),r};function p(t,e,r){return(new b).mulp(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(l=u),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?u(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=f,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},b.prototype.makeRBT=function(t){for(var e=Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},b.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=(n/67108864|0)+(a>>>26),this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var n,a=t%26,o=Math.min((t-a)/26,this.length),f=67108863^67108863>>>a<o)for(this.length-=o,s=0;s=0&&(0!==h||s>=n);s--){var d=0|this.words[s];this.words[s]=h<<26-a|d>>>a,h=d&f}return r&&0!==h&&(r.words[r.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var e=t%26,r=(t-e)/26;return(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==e&&r++,this.length=Math.min(r,this.length),0!==e&&(this.words[this.length-1]&=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},a.prototype.isubn=function(t){if(i("number"==typeof t),i(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)-(s/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===f)return this.strip();for(i(-1===f),f=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r,i=this.length-t.length,n=this.clone(),o=t,f=0|o.words[o.length-1];0!=(i=26-this._countBits(f))&&(o=o.ushln(i),n.iushln(i),f=0|o.words[o.length-1]);var s=n.length-o.length;if("mod"!==e){(r=new a(null)).length=s+1,r.words=Array(r.length);for(var h=0;h=0;c--){var u=(0|n.words[o.length+c])*67108864+(0|n.words[o.length+c-1]);for(u=Math.min(u/f|0,67108863),n._ishlnsubmul(o,u,c);0!==n.negative;)u--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);r&&(r.words[c]=u)}return r&&r.strip(),n.strip(),"div"!==e&&0!==i&&n.iushrn(i),{div:r||null,mod:n}},a.prototype.divmod=function(t,e,r){var n,o,f;return(i(!t.isZero()),this.isZero())?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(f=this.neg().divmod(t,e),"mod"!==e&&(n=f.div.neg()),"div"!==e&&(o=f.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(f=this.divmod(t.neg(),e),"mod"!==e&&(n=f.div.neg()),{div:n,mod:f.mod}):(this.negative&t.negative)!=0?(f=this.neg().divmod(t.neg(),e),"div"!==e&&(o=f.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:f.div,mod:o}):t.length>this.length||0>this.cmp(t)?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e)},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.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,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=67108864%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),f=new a(0),s=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var d=r.clone(),c=e.clone();!e.isZero();){for(var u=0,l=1;(e.words[0]&l)==0&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(d),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,b=1;(r.words[0]&b)==0&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(f.isOdd()||s.isOdd())&&(f.iadd(d),s.isub(c)),f.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(f),o.isub(s)):(r.isub(e),f.isub(n),s.isub(o))}return{a:f,b:s,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e,r=this,n=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var o=new a(1),f=new a(0),s=n.clone();r.cmpn(1)>0&&n.cmpn(1)>0;){for(var h=0,d=1;(r.words[0]&d)==0&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var c=0,u=1;(n.words[0]&u)==0&&c<26;++c,u<<=1);if(c>0)for(n.iushrn(c);c-- >0;)f.isOdd()&&f.iadd(s),f.iushrn(1);r.cmp(n)>=0?(r.isub(n),o.isub(f)):(n.isub(r),f.isub(o))}return 0>(e=0===r.cmpn(1)?o:f).cmpn(0)&&e.iadd(t),e},a.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 i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return(1&this.words[0])==0},a.prototype.isOdd=function(){return(1&this.words[0])==1},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,f&=67108863,this.words[o]=f}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.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),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return -1===this.cmpn(t)},a.prototype.lt=function(t){return -1===this.cmp(t)},a.prototype.lten=function(t){return 0>=this.cmpn(t)},a.prototype.lte=function(t){return 0>=this.cmp(t)},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new M(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(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)}v.prototype._tmp=function(){var t=new a(null);return t.words=Array(Math.ceil(this.n/13)),t},v.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 i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},y.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]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){var e;if(m[t])return m[t];if("k256"===t)e=new y;else if("p224"===t)e=new g;else if("p192"===t)e=new _;else if("p25519"===t)e=new w;else throw Error("Unknown prime "+t);return m[t]=e,e},M.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){i((t.negative|e.negative)==0,"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.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)},M.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},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var f=new a(1).toRed(this),s=f.redNeg(),h=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new a(2*d*d).toRed(this);0!==this.pow(d,h).cmp(s);)d.redIAdd(s);for(var c=this.pow(d,n),u=this.pow(t,n.addn(1).iushrn(1)),l=this.pow(t,n),p=o;0!==l.cmp(f);){for(var b=l,m=0;0!==b.cmp(f);m++)b=b.redSqr();i(m=0;i--){for(var h=e.words[i],d=s-1;d>=0;d--){var c=h>>d&1;if(n!==r[0]&&(n=this.sqr(n)),0===c&&0===o){f=0;continue}o<<=1,o|=c,(4==++f||0===i&&0===d)&&(n=this.mul(n,r[o]),f=0,o=0)}s=26}return n},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new S(t)},n(S,M),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):0>n.cmpn(0)&&(a=n.iadd(this.m)),a._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):0>n.cmpn(0)&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},1670:function(t,e,r){!function(t,e){"use strict";function i(t,e){if(!t)throw Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.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"))}"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{d=r(4300).Buffer}catch(t){}function o(t,e,r){for(var n=0,a=Math.min(t.length,r),o=0,f=e;f=49&&h<=54?h-49+10:h>=17&&h<=22?h-17+10:h,o|=s}return i(!(240&o),"Invalid character in "+t),n}function f(t,e,r,n){for(var a=0,o=0,f=Math.min(t.length,r),s=e;s=49?h-49+10:h>=17?h-17+10:h,i(h>=0&&o"}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return 0>t.cmp(e)?t:e},a.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),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this._strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=Array(this.length);for(var n,a,o=0;o=0;o-=3)a=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[n]|=a<>>26-f&67108863,(f+=24)>=26&&(f-=26,n++);else if("le"===r)for(o=0,n=0;o>>26-f&67108863,(f+=24)>=26&&(f-=26,n++);return this._strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=Array(this.length);for(var r,i,n=0;n=e;n-=6)i=o(t,n,n+6),this.words[r]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,r++);n+6!==e&&(i=o(t,e,n+6),this.words[r]|=i<>>26-a&4194303),this._strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=0,d=r;d1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?a.prototype[Symbol.for("nodejs.util.inspect.custom")]=h:a.prototype.inspect=h;var d,c=["","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"],u=[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],l=[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 p(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,f=67108863&o,s=o/67108864|0;r.words[0]=f;for(var h=1;h>>26,c=67108863&s,u=Math.min(h,e.length-1),l=Math.max(0,h-t.length+1);l<=u;l++){var p=h-l|0;d+=(o=(n=0|t.words[p])*(a=0|e.words[l])+c)/67108864|0,c=67108863&o}r.words[h]=0|c,s=0|d}return 0!==s?r.words[h]=0|s:r.length--,r._strip()}a.prototype.toString=function(t,e){if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var r,n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?c[6-s.length]+s+r:s+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.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 h=u[t],d=l[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modrn(d).toString(t);r=(p=p.idivn(d)).isZero()?b+r:c[h-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.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&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16,2)},d&&(a.prototype.toBuffer=function(t,e){return this.toArrayLike(d,t,e)}),a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0");var o=t.allocUnsafe?t.allocUnsafe(a):new t(a);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,n),o},a.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,a=0;n>8&255),r>16&255),6===a?(r>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===a?(r>=0&&(t[r--]=o>>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?a.prototype._countBits=function(t){return 32-Math.clz32(t)}:a.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},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return(8191&e)==0&&(r+=13,e>>>=13),(127&e)==0&&(r+=7,e>>>=7),(15&e)==0&&(r+=4,e>>>=4),(3&e)==0&&(r+=2,e>>>=2),(1&e)==0&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return(this.length-1)*26+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.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)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){this.length>t.length?(e=this,r=t):(e=t,r=this);for(var e,r,i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),e?this.words[r]=this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var e,r,i,n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e,r,i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(e=this,r=t):(e=t,r=this);for(var a=0,o=0;o>26,this.words[o]=67108863&i;for(;0!==a&&o>26,this.words[o]=67108863&i;if(0===a&&o>>13,l=0|o[1],p=8191&l,b=l>>>13,m=0|o[2],v=8191&m,y=m>>>13,g=0|o[3],_=8191&g,w=g>>>13,M=0|o[4],S=8191&M,k=M>>>13,E=0|o[5],A=8191&E,x=E>>>13,R=0|o[6],I=8191&R,B=R>>>13,P=0|o[7],T=8191&P,C=P>>>13,j=0|o[8],O=8191&j,D=j>>>13,N=0|o[9],q=8191&N,L=N>>>13,z=0|f[0],U=8191&z,K=z>>>13,H=0|f[1],F=8191&H,V=H>>>13,W=0|f[2],Z=8191&W,X=W>>>13,G=0|f[3],J=8191&G,Y=G>>>13,$=0|f[4],Q=8191&$,tt=$>>>13,te=0|f[5],tr=8191&te,ti=te>>>13,tn=0|f[6],ta=8191&tn,to=tn>>>13,tf=0|f[7],ts=8191&tf,th=tf>>>13,td=0|f[8],tc=8191&td,tu=td>>>13,tl=0|f[9],tp=8191&tl,tb=tl>>>13;r.negative=t.negative^e.negative,r.length=19;var tm=(h+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,K))+Math.imul(u,U)|0))<<13)|0;h=((a=Math.imul(u,K))+(n>>>13)|0)+(tm>>>26)|0,tm&=67108863,i=Math.imul(p,U),n=(n=Math.imul(p,K))+Math.imul(b,U)|0,a=Math.imul(b,K);var tv=(h+(i=i+Math.imul(c,F)|0)|0)+((8191&(n=(n=n+Math.imul(c,V)|0)+Math.imul(u,F)|0))<<13)|0;h=((a=a+Math.imul(u,V)|0)+(n>>>13)|0)+(tv>>>26)|0,tv&=67108863,i=Math.imul(v,U),n=(n=Math.imul(v,K))+Math.imul(y,U)|0,a=Math.imul(y,K),i=i+Math.imul(p,F)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(b,F)|0,a=a+Math.imul(b,V)|0;var ty=(h+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,X)|0)+Math.imul(u,Z)|0))<<13)|0;h=((a=a+Math.imul(u,X)|0)+(n>>>13)|0)+(ty>>>26)|0,ty&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(w,U)|0,a=Math.imul(w,K),i=i+Math.imul(v,F)|0,n=(n=n+Math.imul(v,V)|0)+Math.imul(y,F)|0,a=a+Math.imul(y,V)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(b,Z)|0,a=a+Math.imul(b,X)|0;var tg=(h+(i=i+Math.imul(c,J)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(u,J)|0))<<13)|0;h=((a=a+Math.imul(u,Y)|0)+(n>>>13)|0)+(tg>>>26)|0,tg&=67108863,i=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(k,U)|0,a=Math.imul(k,K),i=i+Math.imul(_,F)|0,n=(n=n+Math.imul(_,V)|0)+Math.imul(w,F)|0,a=a+Math.imul(w,V)|0,i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(y,Z)|0,a=a+Math.imul(y,X)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(b,J)|0,a=a+Math.imul(b,Y)|0;var t_=(h+(i=i+Math.imul(c,Q)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(u,Q)|0))<<13)|0;h=((a=a+Math.imul(u,tt)|0)+(n>>>13)|0)+(t_>>>26)|0,t_&=67108863,i=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(x,U)|0,a=Math.imul(x,K),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(k,F)|0,a=a+Math.imul(k,V)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(w,Z)|0,a=a+Math.imul(w,X)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,Y)|0)+Math.imul(y,J)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,a=a+Math.imul(b,tt)|0;var tw=(h+(i=i+Math.imul(c,tr)|0)|0)+((8191&(n=(n=n+Math.imul(c,ti)|0)+Math.imul(u,tr)|0))<<13)|0;h=((a=a+Math.imul(u,ti)|0)+(n>>>13)|0)+(tw>>>26)|0,tw&=67108863,i=Math.imul(I,U),n=(n=Math.imul(I,K))+Math.imul(B,U)|0,a=Math.imul(B,K),i=i+Math.imul(A,F)|0,n=(n=n+Math.imul(A,V)|0)+Math.imul(x,F)|0,a=a+Math.imul(x,V)|0,i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(k,Z)|0,a=a+Math.imul(k,X)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(w,J)|0,a=a+Math.imul(w,Y)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,tt)|0,i=i+Math.imul(p,tr)|0,n=(n=n+Math.imul(p,ti)|0)+Math.imul(b,tr)|0,a=a+Math.imul(b,ti)|0;var tM=(h+(i=i+Math.imul(c,ta)|0)|0)+((8191&(n=(n=n+Math.imul(c,to)|0)+Math.imul(u,ta)|0))<<13)|0;h=((a=a+Math.imul(u,to)|0)+(n>>>13)|0)+(tM>>>26)|0,tM&=67108863,i=Math.imul(T,U),n=(n=Math.imul(T,K))+Math.imul(C,U)|0,a=Math.imul(C,K),i=i+Math.imul(I,F)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(B,F)|0,a=a+Math.imul(B,V)|0,i=i+Math.imul(A,Z)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(x,Z)|0,a=a+Math.imul(x,X)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(k,J)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(w,Q)|0,a=a+Math.imul(w,tt)|0,i=i+Math.imul(v,tr)|0,n=(n=n+Math.imul(v,ti)|0)+Math.imul(y,tr)|0,a=a+Math.imul(y,ti)|0,i=i+Math.imul(p,ta)|0,n=(n=n+Math.imul(p,to)|0)+Math.imul(b,ta)|0,a=a+Math.imul(b,to)|0;var tS=(h+(i=i+Math.imul(c,ts)|0)|0)+((8191&(n=(n=n+Math.imul(c,th)|0)+Math.imul(u,ts)|0))<<13)|0;h=((a=a+Math.imul(u,th)|0)+(n>>>13)|0)+(tS>>>26)|0,tS&=67108863,i=Math.imul(O,U),n=(n=Math.imul(O,K))+Math.imul(D,U)|0,a=Math.imul(D,K),i=i+Math.imul(T,F)|0,n=(n=n+Math.imul(T,V)|0)+Math.imul(C,F)|0,a=a+Math.imul(C,V)|0,i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(B,Z)|0,a=a+Math.imul(B,X)|0,i=i+Math.imul(A,J)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(x,J)|0,a=a+Math.imul(x,Y)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(_,tr)|0,n=(n=n+Math.imul(_,ti)|0)+Math.imul(w,tr)|0,a=a+Math.imul(w,ti)|0,i=i+Math.imul(v,ta)|0,n=(n=n+Math.imul(v,to)|0)+Math.imul(y,ta)|0,a=a+Math.imul(y,to)|0,i=i+Math.imul(p,ts)|0,n=(n=n+Math.imul(p,th)|0)+Math.imul(b,ts)|0,a=a+Math.imul(b,th)|0;var tk=(h+(i=i+Math.imul(c,tc)|0)|0)+((8191&(n=(n=n+Math.imul(c,tu)|0)+Math.imul(u,tc)|0))<<13)|0;h=((a=a+Math.imul(u,tu)|0)+(n>>>13)|0)+(tk>>>26)|0,tk&=67108863,i=Math.imul(q,U),n=(n=Math.imul(q,K))+Math.imul(L,U)|0,a=Math.imul(L,K),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(D,F)|0,a=a+Math.imul(D,V)|0,i=i+Math.imul(T,Z)|0,n=(n=n+Math.imul(T,X)|0)+Math.imul(C,Z)|0,a=a+Math.imul(C,X)|0,i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(B,J)|0,a=a+Math.imul(B,Y)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,tt)|0,i=i+Math.imul(S,tr)|0,n=(n=n+Math.imul(S,ti)|0)+Math.imul(k,tr)|0,a=a+Math.imul(k,ti)|0,i=i+Math.imul(_,ta)|0,n=(n=n+Math.imul(_,to)|0)+Math.imul(w,ta)|0,a=a+Math.imul(w,to)|0,i=i+Math.imul(v,ts)|0,n=(n=n+Math.imul(v,th)|0)+Math.imul(y,ts)|0,a=a+Math.imul(y,th)|0,i=i+Math.imul(p,tc)|0,n=(n=n+Math.imul(p,tu)|0)+Math.imul(b,tc)|0,a=a+Math.imul(b,tu)|0;var tE=(h+(i=i+Math.imul(c,tp)|0)|0)+((8191&(n=(n=n+Math.imul(c,tb)|0)+Math.imul(u,tp)|0))<<13)|0;h=((a=a+Math.imul(u,tb)|0)+(n>>>13)|0)+(tE>>>26)|0,tE&=67108863,i=Math.imul(q,F),n=(n=Math.imul(q,V))+Math.imul(L,F)|0,a=Math.imul(L,V),i=i+Math.imul(O,Z)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(D,Z)|0,a=a+Math.imul(D,X)|0,i=i+Math.imul(T,J)|0,n=(n=n+Math.imul(T,Y)|0)+Math.imul(C,J)|0,a=a+Math.imul(C,Y)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(B,Q)|0,a=a+Math.imul(B,tt)|0,i=i+Math.imul(A,tr)|0,n=(n=n+Math.imul(A,ti)|0)+Math.imul(x,tr)|0,a=a+Math.imul(x,ti)|0,i=i+Math.imul(S,ta)|0,n=(n=n+Math.imul(S,to)|0)+Math.imul(k,ta)|0,a=a+Math.imul(k,to)|0,i=i+Math.imul(_,ts)|0,n=(n=n+Math.imul(_,th)|0)+Math.imul(w,ts)|0,a=a+Math.imul(w,th)|0,i=i+Math.imul(v,tc)|0,n=(n=n+Math.imul(v,tu)|0)+Math.imul(y,tc)|0,a=a+Math.imul(y,tu)|0;var tA=(h+(i=i+Math.imul(p,tp)|0)|0)+((8191&(n=(n=n+Math.imul(p,tb)|0)+Math.imul(b,tp)|0))<<13)|0;h=((a=a+Math.imul(b,tb)|0)+(n>>>13)|0)+(tA>>>26)|0,tA&=67108863,i=Math.imul(q,Z),n=(n=Math.imul(q,X))+Math.imul(L,Z)|0,a=Math.imul(L,X),i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(D,J)|0,a=a+Math.imul(D,Y)|0,i=i+Math.imul(T,Q)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,tt)|0,i=i+Math.imul(I,tr)|0,n=(n=n+Math.imul(I,ti)|0)+Math.imul(B,tr)|0,a=a+Math.imul(B,ti)|0,i=i+Math.imul(A,ta)|0,n=(n=n+Math.imul(A,to)|0)+Math.imul(x,ta)|0,a=a+Math.imul(x,to)|0,i=i+Math.imul(S,ts)|0,n=(n=n+Math.imul(S,th)|0)+Math.imul(k,ts)|0,a=a+Math.imul(k,th)|0,i=i+Math.imul(_,tc)|0,n=(n=n+Math.imul(_,tu)|0)+Math.imul(w,tc)|0,a=a+Math.imul(w,tu)|0;var tx=(h+(i=i+Math.imul(v,tp)|0)|0)+((8191&(n=(n=n+Math.imul(v,tb)|0)+Math.imul(y,tp)|0))<<13)|0;h=((a=a+Math.imul(y,tb)|0)+(n>>>13)|0)+(tx>>>26)|0,tx&=67108863,i=Math.imul(q,J),n=(n=Math.imul(q,Y))+Math.imul(L,J)|0,a=Math.imul(L,Y),i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(D,Q)|0,a=a+Math.imul(D,tt)|0,i=i+Math.imul(T,tr)|0,n=(n=n+Math.imul(T,ti)|0)+Math.imul(C,tr)|0,a=a+Math.imul(C,ti)|0,i=i+Math.imul(I,ta)|0,n=(n=n+Math.imul(I,to)|0)+Math.imul(B,ta)|0,a=a+Math.imul(B,to)|0,i=i+Math.imul(A,ts)|0,n=(n=n+Math.imul(A,th)|0)+Math.imul(x,ts)|0,a=a+Math.imul(x,th)|0,i=i+Math.imul(S,tc)|0,n=(n=n+Math.imul(S,tu)|0)+Math.imul(k,tc)|0,a=a+Math.imul(k,tu)|0;var tR=(h+(i=i+Math.imul(_,tp)|0)|0)+((8191&(n=(n=n+Math.imul(_,tb)|0)+Math.imul(w,tp)|0))<<13)|0;h=((a=a+Math.imul(w,tb)|0)+(n>>>13)|0)+(tR>>>26)|0,tR&=67108863,i=Math.imul(q,Q),n=(n=Math.imul(q,tt))+Math.imul(L,Q)|0,a=Math.imul(L,tt),i=i+Math.imul(O,tr)|0,n=(n=n+Math.imul(O,ti)|0)+Math.imul(D,tr)|0,a=a+Math.imul(D,ti)|0,i=i+Math.imul(T,ta)|0,n=(n=n+Math.imul(T,to)|0)+Math.imul(C,ta)|0,a=a+Math.imul(C,to)|0,i=i+Math.imul(I,ts)|0,n=(n=n+Math.imul(I,th)|0)+Math.imul(B,ts)|0,a=a+Math.imul(B,th)|0,i=i+Math.imul(A,tc)|0,n=(n=n+Math.imul(A,tu)|0)+Math.imul(x,tc)|0,a=a+Math.imul(x,tu)|0;var tI=(h+(i=i+Math.imul(S,tp)|0)|0)+((8191&(n=(n=n+Math.imul(S,tb)|0)+Math.imul(k,tp)|0))<<13)|0;h=((a=a+Math.imul(k,tb)|0)+(n>>>13)|0)+(tI>>>26)|0,tI&=67108863,i=Math.imul(q,tr),n=(n=Math.imul(q,ti))+Math.imul(L,tr)|0,a=Math.imul(L,ti),i=i+Math.imul(O,ta)|0,n=(n=n+Math.imul(O,to)|0)+Math.imul(D,ta)|0,a=a+Math.imul(D,to)|0,i=i+Math.imul(T,ts)|0,n=(n=n+Math.imul(T,th)|0)+Math.imul(C,ts)|0,a=a+Math.imul(C,th)|0,i=i+Math.imul(I,tc)|0,n=(n=n+Math.imul(I,tu)|0)+Math.imul(B,tc)|0,a=a+Math.imul(B,tu)|0;var tB=(h+(i=i+Math.imul(A,tp)|0)|0)+((8191&(n=(n=n+Math.imul(A,tb)|0)+Math.imul(x,tp)|0))<<13)|0;h=((a=a+Math.imul(x,tb)|0)+(n>>>13)|0)+(tB>>>26)|0,tB&=67108863,i=Math.imul(q,ta),n=(n=Math.imul(q,to))+Math.imul(L,ta)|0,a=Math.imul(L,to),i=i+Math.imul(O,ts)|0,n=(n=n+Math.imul(O,th)|0)+Math.imul(D,ts)|0,a=a+Math.imul(D,th)|0,i=i+Math.imul(T,tc)|0,n=(n=n+Math.imul(T,tu)|0)+Math.imul(C,tc)|0,a=a+Math.imul(C,tu)|0;var tP=(h+(i=i+Math.imul(I,tp)|0)|0)+((8191&(n=(n=n+Math.imul(I,tb)|0)+Math.imul(B,tp)|0))<<13)|0;h=((a=a+Math.imul(B,tb)|0)+(n>>>13)|0)+(tP>>>26)|0,tP&=67108863,i=Math.imul(q,ts),n=(n=Math.imul(q,th))+Math.imul(L,ts)|0,a=Math.imul(L,th),i=i+Math.imul(O,tc)|0,n=(n=n+Math.imul(O,tu)|0)+Math.imul(D,tc)|0,a=a+Math.imul(D,tu)|0;var tT=(h+(i=i+Math.imul(T,tp)|0)|0)+((8191&(n=(n=n+Math.imul(T,tb)|0)+Math.imul(C,tp)|0))<<13)|0;h=((a=a+Math.imul(C,tb)|0)+(n>>>13)|0)+(tT>>>26)|0,tT&=67108863,i=Math.imul(q,tc),n=(n=Math.imul(q,tu))+Math.imul(L,tc)|0,a=Math.imul(L,tu);var tC=(h+(i=i+Math.imul(O,tp)|0)|0)+((8191&(n=(n=n+Math.imul(O,tb)|0)+Math.imul(D,tp)|0))<<13)|0;h=((a=a+Math.imul(D,tb)|0)+(n>>>13)|0)+(tC>>>26)|0,tC&=67108863;var tj=(h+(i=Math.imul(q,tp))|0)+((8191&(n=(n=Math.imul(q,tb))+Math.imul(L,tp)|0))<<13)|0;return h=((a=Math.imul(L,tb))+(n>>>13)|0)+(tj>>>26)|0,tj&=67108863,s[0]=tm,s[1]=tv,s[2]=ty,s[3]=tg,s[4]=t_,s[5]=tw,s[6]=tM,s[7]=tS,s[8]=tk,s[9]=tE,s[10]=tA,s[11]=tx,s[12]=tR,s[13]=tI,s[14]=tB,s[15]=tP,s[16]=tT,s[17]=tC,s[18]=tj,0!==h&&(s[19]=h,r.length++),r};function m(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=f,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r._strip()}function v(t,e){this.x=t,this.y=e}Math.imul||(b=p),a.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return 10===this.length&&10===t.length?b(this,t,e):i<63?p(this,t,e):m(this,t,e)},v.prototype.makeRBT=function(t){for(var e=Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},v.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,r+=(a/67108864|0)+(o>>>26),this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=Array(t.bitLength()),r=0;r>>n&1}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var n,a=t%26,o=Math.min((t-a)/26,this.length),f=67108863^67108863>>>a<o)for(this.length-=o,s=0;s=0&&(0!==h||s>=n);s--){var d=0|this.words[s];this.words[s]=h<<26-a|d>>>a,h=d&f}return r&&0!==h&&(r.words[r.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var e=t%26,r=(t-e)/26;return(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==e&&r++,this.length=Math.min(r,this.length),0!==e&&(this.words[this.length-1]&=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},a.prototype.isubn=function(t){if(i("number"==typeof t),i(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)-(s/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===f)return this._strip();for(i(-1===f),f=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this._strip()},a.prototype._wordDiv=function(t,e){var r,i=this.length-t.length,n=this.clone(),o=t,f=0|o.words[o.length-1];0!=(i=26-this._countBits(f))&&(o=o.ushln(i),n.iushln(i),f=0|o.words[o.length-1]);var s=n.length-o.length;if("mod"!==e){(r=new a(null)).length=s+1,r.words=Array(r.length);for(var h=0;h=0;c--){var u=(0|n.words[o.length+c])*67108864+(0|n.words[o.length+c-1]);for(u=Math.min(u/f|0,67108863),n._ishlnsubmul(o,u,c);0!==n.negative;)u--,n.negative=0,n._ishlnsubmul(o,1,c),n.isZero()||(n.negative^=1);r&&(r.words[c]=u)}return r&&r._strip(),n._strip(),"div"!==e&&0!==i&&n.iushrn(i),{div:r||null,mod:n}},a.prototype.divmod=function(t,e,r){var n,o,f;return(i(!t.isZero()),this.isZero())?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(f=this.neg().divmod(t,e),"mod"!==e&&(n=f.div.neg()),"div"!==e&&(o=f.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(f=this.divmod(t.neg(),e),"mod"!==e&&(n=f.div.neg()),{div:n,mod:f.mod}):(this.negative&t.negative)!=0?(f=this.neg().divmod(t.neg(),e),"div"!==e&&(o=f.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:f.div,mod:o}):t.length>this.length||0>this.cmp(t)?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modrn(t.words[0]))}:this._wordDiv(t,e)},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.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,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=67108864%t,n=0,a=this.length-1;a>=0;a--)n=(r*n+(0|this.words[a]))%t;return e?-n:n},a.prototype.modn=function(t){return this.modrn(t)},a.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var a=(0|this.words[n])+67108864*r;this.words[n]=a/t|0,r=a%t}return this._strip(),e?this.ineg():this},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),f=new a(0),s=new a(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var d=r.clone(),c=e.clone();!e.isZero();){for(var u=0,l=1;(e.words[0]&l)==0&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(d),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,b=1;(r.words[0]&b)==0&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(f.isOdd()||s.isOdd())&&(f.iadd(d),s.isub(c)),f.iushrn(1),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(f),o.isub(s)):(r.isub(e),f.isub(n),s.isub(o))}return{a:f,b:s,gcd:r.iushln(h)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e,r=this,n=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var o=new a(1),f=new a(0),s=n.clone();r.cmpn(1)>0&&n.cmpn(1)>0;){for(var h=0,d=1;(r.words[0]&d)==0&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var c=0,u=1;(n.words[0]&u)==0&&c<26;++c,u<<=1);if(c>0)for(n.iushrn(c);c-- >0;)f.isOdd()&&f.iadd(s),f.iushrn(1);r.cmp(n)>=0?(r.isub(n),o.isub(f)):(n.isub(r),f.isub(o))}return 0>(e=0===r.cmpn(1)?o:f).cmpn(0)&&e.iadd(t),e},a.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 i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return(1&this.words[0])==0},a.prototype.isOdd=function(){return(1&this.words[0])==1},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,f&=67108863,this.words[o]=f}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.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),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return -1===this.cmpn(t)},a.prototype.lt=function(t){return -1===this.cmp(t)},a.prototype.lten=function(t){return 0>=this.cmpn(t)},a.prototype.lte=function(t){return 0>=this.cmp(t)},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new k(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(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)}g.prototype._tmp=function(){var t=new a(null);return t.words=Array(Math.ceil(this.n/13)),t},g.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 i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},n(_,g),_.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},_.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]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){var e;if(y[t])return y[t];if("k256"===t)e=new _;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else if("p25519"===t)e=new S;else throw Error("Unknown prime "+t);return y[t]=e,e},k.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},k.prototype._verify2=function(t,e){i((t.negative|e.negative)==0,"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(s(t,t.umod(this.m)._forceRed(this)),t)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.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)},k.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},k.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var f=new a(1).toRed(this),s=f.redNeg(),h=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new a(2*d*d).toRed(this);0!==this.pow(d,h).cmp(s);)d.redIAdd(s);for(var c=this.pow(d,n),u=this.pow(t,n.addn(1).iushrn(1)),l=this.pow(t,n),p=o;0!==l.cmp(f);){for(var b=l,m=0;0!==b.cmp(f);m++)b=b.redSqr();i(m=0;i--){for(var h=e.words[i],d=s-1;d>=0;d--){var c=h>>d&1;if(n!==r[0]&&(n=this.sqr(n)),0===c&&0===o){f=0;continue}o<<=1,o|=c,(4==++f||0===i&&0===d)&&(n=this.mul(n,r[o]),f=0,o=0)}s=26}return n},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new E(t)},n(E,k),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},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),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):0>n.cmpn(0)&&(a=n.iadd(this.m)),a._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):0>n.cmpn(0)&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},3500:function(t,e,r){var i;function n(t){this.rand=t}if(t.exports=function(t){return i||(i=new n(null)),i.generate(t)},t.exports.Rand=n,n.prototype.generate=function(t){return this._rand(t)},n.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r>>24]^d[p>>>16&255]^c[b>>>8&255]^u[255&m]^e[v++],o=h[p>>>24]^d[b>>>16&255]^c[m>>>8&255]^u[255&l]^e[v++],f=h[b>>>24]^d[m>>>16&255]^c[l>>>8&255]^u[255&p]^e[v++],s=h[m>>>24]^d[l>>>16&255]^c[p>>>8&255]^u[255&b]^e[v++],l=a,p=o,b=f,m=s;return a=(i[l>>>24]<<24|i[p>>>16&255]<<16|i[b>>>8&255]<<8|i[255&m])^e[v++],o=(i[p>>>24]<<24|i[b>>>16&255]<<16|i[m>>>8&255]<<8|i[255&l])^e[v++],[a>>>=0,o>>>=0,f=((i[b>>>24]<<24|i[m>>>16&255]<<16|i[l>>>8&255]<<8|i[255&p])^e[v++])>>>0,s=((i[m>>>24]<<24|i[l>>>16&255]<<16|i[p>>>8&255]<<8|i[255&b])^e[v++])>>>0]}var f=[0,1,2,4,8,16,32,64,128,27,54],s=function(){for(var t=Array(256),e=0;e<256;e++)e<128?t[e]=e<<1:t[e]=e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],a=[[],[],[],[]],o=0,f=0,s=0;s<256;++s){var h=f^f<<1^f<<2^f<<3^f<<4;h=h>>>8^255&h^99,r[o]=h,i[h]=o;var d=t[o],c=t[d],u=t[c],l=257*t[h]^16843008*h;n[0][o]=l<<24|l>>>8,n[1][o]=l<<16|l>>>16,n[2][o]=l<<8|l>>>24,n[3][o]=l,l=16843009*u^65537*c^257*d^16843008*o,a[0][h]=l<<24|l>>>8,a[1][h]=l<<16|l>>>16,a[2][h]=l<<8|l>>>24,a[3][h]=l,0===o?o=f=1:(o=d^t[t[t[u^d]]],f^=t[t[f]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:a}}();function h(t){this._key=n(t),this._reset()}h.blockSize=16,h.keySize=32,h.prototype.blockSize=h.blockSize,h.prototype.keySize=h.keySize,h.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=(r+1)*4,n=[],a=0;a>>24,o=(s.SBOX[o>>>24]<<24|s.SBOX[o>>>16&255]<<16|s.SBOX[o>>>8&255]<<8|s.SBOX[255&o])^f[a/e|0]<<24):e>6&&a%e==4&&(o=s.SBOX[o>>>24]<<24|s.SBOX[o>>>16&255]<<16|s.SBOX[o>>>8&255]<<8|s.SBOX[255&o]),n[a]=n[a-e]^o}for(var h=[],d=0;d>>24]]^s.INV_SUB_MIX[1][s.SBOX[u>>>16&255]]^s.INV_SUB_MIX[2][s.SBOX[u>>>8&255]]^s.INV_SUB_MIX[3][s.SBOX[255&u]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=h},h.prototype.encryptBlockRaw=function(t){return o(t=n(t),this._keySchedule,s.SUB_MIX,s.SBOX,this._nRounds)},h.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=i.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},h.prototype.decryptBlock=function(t){var e=(t=n(t))[1];t[1]=t[3],t[3]=e;var r=o(t,this._invKeySchedule,s.INV_SUB_MIX,s.INV_SBOX,this._nRounds),a=i.allocUnsafe(16);return a.writeUInt32BE(r[0],0),a.writeUInt32BE(r[3],4),a.writeUInt32BE(r[2],8),a.writeUInt32BE(r[1],12),a},h.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},t.exports.AES=h},6624:function(t,e,r){var i=r(1387),n=r(6911).Buffer,a=r(1043),o=r(3782),f=r(7225),s=r(4734),h=r(598);function d(t,e,r,o){a.call(this);var s=n.alloc(4,0);this._cipher=new i.AES(e);var d=this._cipher.encryptBlock(s);this._ghash=new f(d),r=function(t,e,r){if(12===e.length)return t._finID=n.concat([e,n.from([0,0,0,1])]),n.concat([e,n.from([0,0,0,2])]);var i=new f(r),a=e.length,o=a%16;i.update(e),o&&(o=16-o,i.update(n.alloc(o,0))),i.update(n.alloc(8,0));var s=n.alloc(8);s.writeUIntBE(8*a,0,8),i.update(s),t._finID=i.state;var d=n.from(t._finID);return h(d),d}(this,r,d),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=o,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}o(d,a),d.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=n.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},d.prototype._final=function(){if(this._decrypt&&!this._authTag)throw Error("Unsupported state or unable to authenticate data");var t=s(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var i=Math.min(t.length,e.length),n=0;n16)throw Error("unable to decrypt data");for(var r=-1;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},c.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var r=a[t.toLowerCase()];if(!r)throw TypeError("invalid suite type");var i=h(e,!1,r.key,r.iv);return u(t,i.key,i.iv)},e.createDecipheriv=u},2:function(t,e,r){var i=r(6370),n=r(6624),a=r(6911).Buffer,o=r(126),f=r(1043),s=r(1387),h=r(8368);function d(t,e,r){f.call(this),this._cache=new u,this._cipher=new s.AES(e),this._prev=a.from(r),this._mode=t,this._autopadding=!0}r(3782)(d,f),d.prototype._update=function(t){this._cache.add(t);for(var e,r,i=[];e=this._cache.get();)r=this._mode.encrypt(this,e),i.push(r);return a.concat(i)};var c=a.alloc(16,16);function u(){this.cache=a.allocUnsafe(0)}function l(t,e,r){var f=i[t.toLowerCase()];if(!f)throw TypeError("invalid suite type");if("string"==typeof e&&(e=a.from(e)),e.length!==f.key/8)throw TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=a.from(r)),"GCM"!==f.mode&&r.length!==f.iv)throw TypeError("invalid iv length "+r.length);return"stream"===f.type?new o(f.module,e,r):"auth"===f.type?new n(f.module,e,r):new d(f.module,e,r)}d.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(c))throw this._cipher.scrub(),Error("data not multiple of block length")},d.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},u.prototype.add=function(t){this.cache=a.concat([this.cache,t])},u.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},u.prototype.flush=function(){for(var t=16-this.cache.length,e=a.allocUnsafe(t),r=-1;++r>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function o(t){this.h=t,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}o.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=-520093696^i[0])}this.state=a(n)},o.prototype.update=function(t){var e;for(this.cache=i.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},o.prototype.final=function(t,e){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(a([0,t,0,e])),this.state},t.exports=o},598:function(t){t.exports=function(t){for(var e,r=t.length;r--;)if(255===(e=t.readUInt8(r)))t.writeUInt8(0,r);else{e++,t.writeUInt8(e,r);break}}},9825:function(t,e,r){var i=r(4734);e.encrypt=function(t,e){var r=i(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},e.decrypt=function(t,e){var r=t._prev;return t._prev=e,i(t._cipher.decryptBlock(e),r)}},321:function(t,e,r){var i=r(6911).Buffer,n=r(4734);function a(t,e,r){var a=e.length,o=n(e,t._cache);return t._cache=t._cache.slice(a),t._prev=i.concat([t._prev,r?e:o]),o}e.encrypt=function(t,e,r){for(var n,o=i.allocUnsafe(0);e.length;)if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=i.allocUnsafe(0)),t._cache.length<=e.length)n=t._cache.length,o=i.concat([o,a(t,e.slice(0,n),r)]),e=e.slice(n);else{o=i.concat([o,a(t,e,r)]);break}return o}},3147:function(t,e,r){var i=r(6911).Buffer;e.encrypt=function(t,e,r){for(var n=e.length,a=i.allocUnsafe(n),o=-1;++o>f%8,t._prev=function(t,e){var r=t.length,n=-1,a=i.allocUnsafe(t.length);for(t=i.concat([t,i.from([e])]);++n>7;return a}(t._prev,r?a:o);return s}(t,e[o],r);return a}},2430:function(t,e,r){var i=r(6911).Buffer;e.encrypt=function(t,e,r){for(var n=e.length,a=i.allocUnsafe(n),o=-1;++o=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new n(a(e));return r}t.exports=o,o.getr=f},9276:function(t,e,r){t.exports=r(2908)},4078:function(t,e,r){var i=r(6911).Buffer,n=r(9739),a=r(3726),o=r(3782),f=r(9807),s=r(4013),h=r(2908);function d(t){a.Writable.call(this);var e=h[t];if(!e)throw Error("Unknown message digest");this._hashType=e.hash,this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function c(t){a.Writable.call(this);var e=h[t];if(!e)throw Error("Unknown message digest");this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function u(t){return new d(t)}function l(t){return new c(t)}Object.keys(h).forEach(function(t){h[t].id=i.from(h[t].id,"hex"),h[t.toLowerCase()]=h[t]}),o(d,a.Writable),d.prototype._write=function(t,e,r){this._hash.update(t),r()},d.prototype.update=function(t,e){return"string"==typeof t&&(t=i.from(t,e)),this._hash.update(t),this},d.prototype.sign=function(t,e){this.end();var r=f(this._hash.digest(),t,this._hashType,this._signType,this._tag);return e?r.toString(e):r},o(c,a.Writable),c.prototype._write=function(t,e,r){this._hash.update(t),r()},c.prototype.update=function(t,e){return"string"==typeof t&&(t=i.from(t,e)),this._hash.update(t),this},c.prototype.verify=function(t,e,r){return"string"==typeof e&&(e=i.from(e,r)),this.end(),s(e,this._hash.digest(),t,this._signType,this._tag)},t.exports={Sign:u,Verify:l,createSign:u,createVerify:l}},9807:function(t,e,r){var i=r(6911).Buffer,n=r(4873),a=r(7166),o=r(949).ec,f=r(1670),s=r(9902),h=r(9267);function d(t,e,r,a){if((t=i.from(t.toArray())).length0&&r.ishrn(i),r}function u(t,e,r){var a,o;do{for(a=i.alloc(0);8*a.length=t.cmpn(0)||t.cmp(e)>=e)throw Error("invalid sig")}t.exports=function(t,e,r,h,d){var c,u,l,p,b,m,v,y,g,_,w,M=o(r);if("ec"===M.type){if("ecdsa"!==h&&"ecdsa/rsa"!==h)throw Error("wrong public key type");return function(t,e,r){var i=f[r.data.algorithm.curve.join(".")];if(!i)throw Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new a(i),o=r.data.subjectPrivateKey.data;return n.verify(e,t,o)}(t,e,M)}if("dsa"===M.type){if("dsa"!==h)throw Error("wrong public key type");return c=t,u=e,l=M.data.p,p=M.data.q,b=M.data.g,m=M.data.pub_key,y=(v=o.signature.decode(c,"der")).s,g=v.r,s(y,p),s(g,p),_=n.mont(l),w=y.invm(p),0===b.toRed(_).redPow(new n(u).mul(w).mod(p)).fromRed().mul(m.toRed(_).redPow(g.mul(w).mod(p)).fromRed()).mod(l).mod(p).cmp(g)}if("rsa"!==h&&"ecdsa/rsa"!==h)throw Error("wrong public key type");e=i.concat([d,e]);for(var S=M.modulus.byteLength(),k=[1],E=0;e.length+k.length+2r?e=("rmd160"===t?new s:h(t)).update(e).digest():e.length64?e=t(e):e.length<64&&(e=n.concat([e,o],64));for(var r=this._ipad=n.allocUnsafe(64),i=this._opad=n.allocUnsafe(64),f=0;f<64;f++)r[f]=54^e[f],i[f]=92^e[f];this._hash=[r]}i(f,a),f.prototype._update=function(t){this._hash.push(t)},f.prototype._final=function(){var t=this._alg(n.concat(this._hash));return this._alg(n.concat([this._opad,t]))},t.exports=f},9536:function(t,e,r){"use strict";e.utils=r(5334),e.Cipher=r(9876),e.DES=r(1016),e.CBC=r(8641),e.EDE=r(6159)},8641:function(t,e,r){"use strict";var i=r(3523),n=r(3782),a={};function o(t){i.equal(t.length,8,"Invalid IV length"),this.iv=Array(8);for(var e=0;e0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(n,r);return e+=this._buffer(t,e),n},n.prototype.final=function(t){var e,r;return(t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e)?e.concat(r):r},n.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=a.r28shl(r,f),n=a.r28shl(n,f),a.pc2(r,n,t.keys,o)}},s.prototype._update=function(t,e,r,i){var n=this._desState,o=a.readUInt32BE(t,e),f=a.readUInt32BE(t,e+4);a.ip(o,f,n.tmp,0),o=n.tmp[0],f=n.tmp[1],"encrypt"===this.type?this._encrypt(n,o,f,n.tmp,0):this._decrypt(n,o,f,n.tmp,0),o=n.tmp[0],f=n.tmp[1],a.writeUInt32BE(r,o,i),a.writeUInt32BE(r,f,i+4)},s.prototype._pad=function(t,e){for(var r=t.length-e,i=e;i>>0,o=l}a.rip(f,o,i,n)},s.prototype._decrypt=function(t,e,r,i,n){for(var o=r,f=e,s=t.keys.length-2;s>=0;s-=2){var h=t.keys[s],d=t.keys[s+1];a.expand(o,t.tmp,0),h^=t.tmp[0],d^=t.tmp[1];var c=a.substitute(h,d),u=a.permute(c),l=o;o=(f^u)>>>0,f=l}a.rip(o,f,i,n)}},6159:function(t,e,r){"use strict";var i=r(3523),n=r(3782),a=r(9876),o=r(1016);function f(t,e){i.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),n=e.slice(8,16),a=e.slice(16,24);"encrypt"===t?this.ciphers=[o.create({type:"encrypt",key:r}),o.create({type:"decrypt",key:n}),o.create({type:"encrypt",key:a})]:this.ciphers=[o.create({type:"decrypt",key:a}),o.create({type:"encrypt",key:n}),o.create({type:"decrypt",key:r})]}function s(t){a.call(this,t);var e=new f(this.type,this.options.key);this._edeState=e}n(s,a),t.exports=s,s.create=function(t){return new s(t)},s.prototype._update=function(t,e,r,i){var n=this._edeState;n.ciphers[0]._update(t,e,r,i),n.ciphers[1]._update(r,i,r,i),n.ciphers[2]._update(r,i,r,i)},s.prototype._pad=o.prototype._pad,s.prototype._unpad=o.prototype._unpad},5334:function(t,e){"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,i){for(var n=0,a=0,o=6;o>=0;o-=2){for(var f=0;f<=24;f+=8)n<<=1,n|=e>>>f+o&1;for(var f=0;f<=24;f+=8)n<<=1,n|=t>>>f+o&1}for(var o=6;o>=0;o-=2){for(var f=1;f<=25;f+=8)a<<=1,a|=e>>>f+o&1;for(var f=1;f<=25;f+=8)a<<=1,a|=t>>>f+o&1}r[i+0]=n>>>0,r[i+1]=a>>>0},e.rip=function(t,e,r,i){for(var n=0,a=0,o=0;o<4;o++)for(var f=24;f>=0;f-=8)n<<=1,n|=e>>>f+o&1,n<<=1,n|=t>>>f+o&1;for(var o=4;o<8;o++)for(var f=24;f>=0;f-=8)a<<=1,a|=e>>>f+o&1,a<<=1,a|=t>>>f+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},e.pc1=function(t,e,r,i){for(var n=0,a=0,o=7;o>=5;o--){for(var f=0;f<=24;f+=8)n<<=1,n|=e>>f+o&1;for(var f=0;f<=24;f+=8)n<<=1,n|=t>>f+o&1}for(var f=0;f<=24;f+=8)n<<=1,n|=e>>f+o&1;for(var o=1;o<=3;o++){for(var f=0;f<=24;f+=8)a<<=1,a|=e>>f+o&1;for(var f=0;f<=24;f+=8)a<<=1,a|=t>>f+o&1}for(var f=0;f<=24;f+=8)a<<=1,a|=t>>f+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},e.r28shl=function(t,e){return t<>>28-e};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,i,n){for(var a=0,o=0,f=r.length>>>1,s=0;s>>r[s]&1;for(var s=f;s>>r[s]&1;i[n+0]=a>>>0,i[n+1]=o>>>0},e.expand=function(t,e,r){var i=0,n=0;i=(1&t)<<5|t>>>27;for(var a=23;a>=15;a-=4)i<<=6,i|=t>>>a&63;for(var a=11;a>=3;a-=4)n|=t>>>a&63,n<<=6;n|=(31&t)<<1|t>>>31,e[r+0]=i>>>0,e[r+1]=n>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var r=0,n=0;n<4;n++){var a=t>>>18-6*n&63,o=i[64*n+a];r<<=4,r|=o}for(var n=0;n<4;n++){var a=e>>>18-6*n&63,o=i[256+64*n+a];r<<=4,r|=o}return r>>>0};var n=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,r=0;r>>n[r]&1;return e>>>0},e.padSplit=function(t,e,r){for(var i=t.toString(2);i.lengtht;)r.ishrn(1);if(r.isEven()&&r.iadd(f),r.testn(1)||r.iadd(s),e.cmp(s)){if(!e.cmp(h))for(;r.mod(d).cmp(c);)r.iadd(l)}else for(;r.mod(a).cmp(u);)r.iadd(l);if(b(p=r.shrn(1))&&b(r)&&m(p)&&m(r)&&o.test(p)&&o.test(r))return r}}},949:function(t,e,r){"use strict";e.version=r(2531).i8,e.utils=r(4401),e.rand=r(3500),e.curve=r(9359),e.curves=r(6226),e.ec=r(4088),e.eddsa=r(8511)},2727:function(t,e,r){"use strict";var i=r(711),n=r(4401),a=n.getNAF,o=n.getJSF,f=n.assert;function s(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=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],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))}function h(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=s,s.prototype.point=function(){throw Error("Not implemented")},s.prototype.validate=function(){throw Error("Not implemented")},s.prototype._fixedNafMul=function(t,e){f(t.precomputed);var r=t._getDoubles(),i=a(e,1,this._bitLength),n=(1<=s;e--)h=(h<<1)+i[e];o.push(h)}for(var d=this.jpoint(null,null,null),c=this.jpoint(null,null,null),u=n;u>0;u--){for(var s=0;s=0;h--){for(var e=0;h>=0&&0===o[h];h--)e++;if(h>=0&&e++,s=s.dblp(e),h<0)break;var d=o[h];f(0!==d),s="affine"===t.type?d>0?s.mixedAdd(n[d-1>>1]):s.mixedAdd(n[-d-1>>1].neg()):d>0?s.add(n[d-1>>1]):s.add(n[-d-1>>1].neg())}return"affine"===t.type?s.toP():s},s.prototype._wnafMulAdd=function(t,e,r,i,n){for(var f=this._wnafT1,s=this._wnafT2,h=this._wnafT3,d=0,c=0;c=1;c-=2){var p=c-1,b=c;if(1!==f[p]||1!==f[b]){h[p]=a(r[p],f[p],this._bitLength),h[b]=a(r[b],f[b],this._bitLength),d=Math.max(h[p].length,d),d=Math.max(h[b].length,d);continue}var m=[e[p],null,null,e[b]];0===e[p].y.cmp(e[b].y)?(m[1]=e[p].add(e[b]),m[2]=e[p].toJ().mixedAdd(e[b].neg())):0===e[p].y.cmp(e[b].y.redNeg())?(m[1]=e[p].toJ().mixedAdd(e[b]),m[2]=e[p].add(e[b].neg())):(m[1]=e[p].toJ().mixedAdd(e[b]),m[2]=e[p].toJ().mixedAdd(e[b].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],y=o(r[p],r[b]);d=Math.max(y[0].length,d),h[p]=Array(d),h[b]=Array(d);for(var g=0;g=0;c--){for(var k=0;c>=0;){for(var E=!0,g=0;g=0&&k++,M=M.dblp(k),c<0)break;for(var g=0;g0?u=s[g][A-1>>1]:A<0&&(u=s[g][-A-1>>1].neg()),M="affine"===u.type?M.mixedAdd(u):M.add(u))}}for(var c=0;c=Math.ceil((t.bitLength()+1)/e.step)},h.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n":""},h.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},h.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),a=i.redAdd(e),o=a.redSub(r),f=i.redSub(e),s=n.redMul(o),h=a.redMul(f),d=n.redMul(f),c=o.redMul(a);return this.curve.point(s,h,c,d)},h.prototype._projDbl=function(){var t,e,r,i=this.x.redAdd(this.y).redSqr(),n=this.x.redSqr(),a=this.y.redSqr();if(this.curve.twisted){var o=this.curve._mulA(n),f=o.redAdd(a);if(this.zOne)t=i.redSub(n).redSub(a).redMul(f.redSub(this.curve.two)),e=f.redMul(o.redSub(a)),r=f.redSqr().redSub(f).redSub(f);else{var s=this.z.redSqr(),h=f.redSub(s).redISub(s);t=i.redSub(n).redISub(a).redMul(h),e=f.redMul(o.redSub(a)),r=f.redMul(h)}}else{var o=n.redAdd(a),s=this.curve._mulC(this.z).redSqr(),h=o.redSub(s).redSub(s);t=this.curve._mulC(i.redISub(o)).redMul(h),e=this.curve._mulC(o).redMul(n.redISub(a)),r=o.redMul(h)}return this.curve.point(t,e,r)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},h.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),a=r.redSub(e),o=n.redSub(i),f=n.redAdd(i),s=r.redAdd(e),h=a.redMul(o),d=f.redMul(s),c=a.redMul(s),u=o.redMul(f);return this.curve.point(h,d,u,c)},h.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),a=this.x.redMul(t.x),o=this.y.redMul(t.y),f=this.curve.d.redMul(a).redMul(o),s=n.redSub(f),h=n.redAdd(f),d=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(a).redISub(o),c=i.redMul(s).redMul(d);return this.curve.twisted?(e=i.redMul(h).redMul(o.redSub(this.curve._mulA(a))),r=s.redMul(h)):(e=i.redMul(h).redMul(o.redSub(a)),r=this.curve._mulC(s).redMul(h)),this.curve.point(c,e,r)},h.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},h.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},h.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},h.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},h.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},h.prototype.getX=function(){return this.normalize(),this.x.fromRed()},h.prototype.getY=function(){return this.normalize(),this.y.fromRed()},h.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},h.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},h.prototype.toP=h.prototype.normalize,h.prototype.mixedAdd=h.prototype.add},9359:function(t,e,r){"use strict";e.base=r(2727),e.short=r(4720),e.mont=r(6653),e.edwards=r(2705)},6653:function(t,e,r){"use strict";var i=r(711),n=r(3782),a=r(2727),o=r(4401);function f(t){a.call(this,"mont",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function s(t,e,r){a.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(f,a),t.exports=f,f.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},n(s,a.BasePoint),f.prototype.decodePoint=function(t,e){return this.point(o.toArray(t,e),1)},f.prototype.point=function(t,e){return new s(this,t,e)},f.prototype.pointFromJSON=function(t){return s.fromJSON(this,t)},s.prototype.precompute=function(){},s.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},s.fromJSON=function(t,e){return new s(t,e[0],e[1]||t.one)},s.prototype.inspect=function(){return this.isInfinity()?"":""},s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},s.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},s.prototype.add=function(){throw Error("Not supported on Montgomery curve")},s.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),a=t.x.redSub(t.z).redMul(r),o=n.redMul(i),f=e.z.redMul(a.redAdd(o).redSqr()),s=e.x.redMul(a.redISub(o).redSqr());return this.curve.point(f,s)},s.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var a=n.length-1;a>=0;a--)0===n[a]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},s.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},s.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},s.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},s.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},s.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},4720:function(t,e,r){"use strict";var i=r(4401),n=r(711),a=r(3782),o=r(2727),f=i.assert;function s(t){o.call(this,"short",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}function h(t,e,r,i){o.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(e,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function d(t,e,r,i){o.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(e,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}a(s,o),t.exports=s,s.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){if(t.beta)e=new n(t.beta,16).toRed(this.red);else{var e,r,i,a=this._getEndoRoots(this.p);e=(e=0>a[0].cmp(a[1])?a[0]:a[1]).toRed(this.red)}if(t.lambda)r=new n(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],f(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return i=t.basis?t.basis.map(function(t){return{a:new n(t.a,16),b:new n(t.b,16)}}):this._getEndoBasis(r),{beta:e,lambda:r,basis:i}}},s.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:n.mont(t),r=new n(2).toRed(e).redInvm(),i=r.redNeg(),a=new n(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(a).fromRed(),i.redSub(a).fromRed()]},s.prototype._getEndoBasis=function(t){for(var e,r,i,a,o,f,s,h,d,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=t,l=this.n.clone(),p=new n(1),b=new n(0),m=new n(0),v=new n(1),y=0;0!==u.cmpn(0);){var g=l.div(u);h=l.sub(g.mul(u)),d=m.sub(g.mul(p));var _=v.sub(g.mul(b));if(!i&&0>h.cmp(c))e=s.neg(),r=p,i=h.neg(),a=d;else if(i&&2==++y)break;s=h,l=u,u=h,m=p,p=d,v=b,b=_}o=h.neg(),f=d;var w=i.sqr().add(a.sqr());return o.sqr().add(f.sqr()).cmp(w)>=0&&(o=e,f=r),i.negative&&(i=i.neg(),a=a.neg()),o.negative&&(o=o.neg(),f=f.neg()),[{a:i,b:a},{a:o,b:f}]},s.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),a=r.b.neg().mul(t).divRound(this.n),o=n.mul(r.a),f=a.mul(i.a),s=n.mul(r.b),h=a.mul(i.b);return{k1:t.sub(o).sub(f),k2:s.add(h).neg()}},s.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw Error("invalid point");var a=i.fromRed().isOdd();return(e&&!a||!e&&a)&&(i=i.redNeg()),this.point(t,i)},s.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},s.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,a=0;a":""},h.prototype.isInfinity=function(){return this.inf},h.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)||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),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},h.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(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),a=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},h.prototype.getX=function(){return this.x.fromRed()},h.prototype.getY=function(){return this.y.fromRed()},h.prototype.mul=function(t){return(t=new n(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)},h.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},h.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},h.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))},h.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,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},h.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(d,o.BasePoint),s.prototype.jpoint=function(t,e,r){return new d(this,t,e,r)},d.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),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},d.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},d.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),a=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),f=i.redSub(n),s=a.redSub(o);if(0===f.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=f.redSqr(),d=h.redMul(f),c=i.redMul(h),u=s.redSqr().redIAdd(d).redISub(c).redISub(c),l=s.redMul(c.redISub(u)).redISub(a.redMul(d)),p=this.z.redMul(t.z).redMul(f);return this.curve.jpoint(u,l,p)},d.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,a=t.y.redMul(e).redMul(this.z),o=r.redSub(i),f=n.redSub(a);if(0===o.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var s=o.redSqr(),h=s.redMul(o),d=r.redMul(s),c=f.redSqr().redIAdd(h).redISub(d).redISub(d),u=f.redMul(d.redISub(c)).redISub(n.redMul(h)),l=this.z.redMul(o);return this.curve.jpoint(c,u,l)},d.prototype.dblp=function(t){if(0===t||this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},d.prototype.inspect=function(){return this.isInfinity()?"":""},d.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},6226:function(t,e,r){"use strict";var i,n=r(7028),a=r(9359),o=r(4401).assert;function f(t){"short"===t.type?this.curve=new a.short(t):"edwards"===t.type?this.curve=new a.edwards(t):this.curve=new a.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){var i=new f(r);return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:i}),i}})}e.PresetCurve=f,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:n.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:n.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:n.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:n.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:n.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:n.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:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(9702)}catch(t){i=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:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},4088:function(t,e,r){"use strict";var i=r(711),n=r(4910),a=r(4401),o=r(6226),f=r(3500),s=a.assert,h=r(4724),d=r(7526);function c(t){if(!(this instanceof c))return new c(t);"string"==typeof t&&(s(o.hasOwnProperty(t),"Unknown curve "+t),t=o[t]),t instanceof o.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}t.exports=c,c.prototype.keyPair=function(t){return new h(this,t)},c.prototype.keyFromPrivate=function(t,e){return h.fromPrivate(this,t,e)},c.prototype.keyFromPublic=function(t,e){return h.fromPublic(this,t,e)},c.prototype.genKeyPair=function(t){t||(t={});for(var e=new n({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||f(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),a=this.n.sub(new i(2));;){var o=new i(e.generate(r));if(!(o.cmp(a)>0))return o.iaddn(1),this.keyFromPrivate(o)}},c.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},c.prototype.sign=function(t,e,r,a){"object"==typeof r&&(a=r,r=null),a||(a={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new i(t,16));for(var o=this.n.byteLength(),f=e.getPrivate().toArray("be",o),s=t.toArray("be",o),h=new n({hash:this.hash,entropy:f,nonce:s,pers:a.pers,persEnc:a.persEnc||"utf8"}),c=this.n.sub(new i(1)),u=0;;u++){var l=a.k?a.k(u):new i(h.generate(this.n.byteLength()));if(!(0>=(l=this._truncateToN(l,!0)).cmpn(1)||l.cmp(c)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var b=p.getX(),m=b.umod(this.n);if(0!==m.cmpn(0)){var v=l.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(v=v.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==b.cmp(m)?2:0);return a.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),y^=1),new d({r:m,s:v,recoveryParam:y})}}}}}},c.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n);var a=(e=new d(e,"hex")).r,o=e.s;if(0>a.cmpn(1)||a.cmp(this.n)>=0||0>o.cmpn(1)||o.cmp(this.n)>=0)return!1;var f=o.invm(this.n),s=f.mul(t).umod(this.n),h=f.mul(a).umod(this.n);if(!this.curve._maxwellTrick){var c=this.g.mulAdd(s,r.getPublic(),h);return!c.isInfinity()&&0===c.getX().umod(this.n).cmp(a)}var c=this.g.jmulAdd(s,r.getPublic(),h);return!c.isInfinity()&&c.eqXToP(a)},c.prototype.recoverPubKey=function(t,e,r,n){s((3&r)===r,"The recovery param is more than two bits"),e=new d(e,n);var a=this.n,o=new i(t),f=e.r,h=e.s,c=1&r,u=r>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw Error("Unable to find sencond key candinate");f=u?this.curve.pointFromX(f.add(this.curve.n),c):this.curve.pointFromX(f,c);var l=e.r.invm(a),p=a.sub(o).mul(l).umod(a),b=h.mul(l).umod(a);return this.g.mulAdd(p,f,b)},c.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new d(e,i)).recoveryParam)return e.recoveryParam;for(var n,a=0;a<4;a++){try{n=this.recoverPubKey(t,e,a)}catch(t){continue}if(n.eq(r))return a}throw Error("Unable to find valid recovery factor")}},4724:function(t,e,r){"use strict";var i=r(711),n=r(4401).assert;function a(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=a,a.fromPublic=function(t,e,r){return e instanceof a?e:new a(t,{pub:e,pubEnc:r})},a.fromPrivate=function(t,e,r){return e instanceof a?e:new a(t,{priv:e,privEnc:r})},a.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},a.prototype.getPublic=function(t,e){return("string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e)?this.pub.encode(e,t):this.pub},a.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},a.prototype._importPrivate=function(t,e){this.priv=new i(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},a.prototype._importPublic=function(t,e){if(t.x||t.y){"mont"===this.ec.curve.type?n(t.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&n(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,e)},a.prototype.derive=function(t){return t.mul(this.priv).getX()},a.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},a.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},a.prototype.inspect=function(){return""}},7526:function(t,e,r){"use strict";var i=r(711),n=r(4401),a=n.assert;function o(t,e){if(t instanceof o)return t;this._importDER(t,e)||(a(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)}function f(){this.place=0}function s(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,a=0,o=e.place;a>>=0;return!(n<=127)&&(e.place=o,n)}function h(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)}t.exports=o,o.prototype._importDER=function(t,e){t=n.toArray(t,e);var r=new f;if(48!==t[r.place++])return!1;var a=s(t,r);if(!1===a||a+r.place!==t.length||2!==t[r.place++])return!1;var o=s(t,r);if(!1===o)return!1;var h=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var d=s(t,r);if(!1===d||t.length!==d+r.place)return!1;var c=t.slice(r.place,d+r.place);if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}return this.r=new i(h),this.s=new i(c),this.recoveryParam=null,!0},o.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=h(e),r=h(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var i=[2];d(i,e.length),(i=i.concat(e)).push(2),d(i,r.length);var a=i.concat(r),o=[48];return d(o,a.length),o=o.concat(a),n.encode(o,t)}},8511:function(t,e,r){"use strict";var i=r(7028),n=r(6226),a=r(4401),o=a.assert,f=a.parseBytes,s=r(9917),h=r(9314);function d(t){if(o("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof d))return new d(t);var t=n[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}t.exports=d,d.prototype.sign=function(t,e){t=f(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),a=this.encodePoint(n),o=this.hashInt(a,r.pubBytes(),t).mul(r.priv()),s=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:s,Rencoded:a})},d.prototype.verify=function(t,e,r){t=f(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),a=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(a)},d.prototype.hashInt=function(){for(var t=this.hash(),e=0;e(n>>1)-1?(n>>1)-s:s,a.isubn(f)):f=0,i[o]=f,a.iushrn(1)}return i},e.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i=0,n=0;t.cmpn(-i)>0||e.cmpn(-n)>0;){var a,o,f=t.andln(3)+i&3,s=e.andln(3)+n&3;if(3===f&&(f=-1),3===s&&(s=-1),(1&f)==0)a=0;else{var h=t.andln(7)+i&7;a=(3===h||5===h)&&2===s?-f:f}if(r[0].push(a),(1&s)==0)o=0;else{var h=e.andln(7)+n&7;o=(3===h||5===h)&&2===f?-s:s}r[1].push(o),2*i===a+1&&(i=1-i),2*n===o+1&&(n=1-n),t.iushrn(1),e.iushrn(1)}return r},e.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},e.parseBytes=function(t){return"string"==typeof t?e.toArray(t,"hex"):t},e.intFromLE=function(t){return new i(t,"hex","le")}},8368:function(t,e,r){var i=r(6911).Buffer,n=r(3533);t.exports=function(t,e,r,a){if(i.isBuffer(t)||(t=i.from(t,"binary")),e&&(i.isBuffer(e)||(e=i.from(e,"binary")),8!==e.length))throw RangeError("salt should be Buffer with 8 byte length");for(var o=r/8,f=i.alloc(o),s=i.alloc(a||0),h=i.alloc(0);o>0||a>0;){var d=new n;d.update(h),d.update(t),e&&d.update(e),h=d.digest();var c=0;if(o>0){var u=f.length-o;c=Math.min(o,h.length),h.copy(f,u,0,c),o-=c}if(c0){var l=s.length-a,p=Math.min(a,h.length-c);h.copy(s,l,c,c+p),a-=p}}return h.fill(0),{key:f,iv:s}}},9029:function(t,e,r){"use strict";var i=r(6911).Buffer,n=r(3726).Transform;function a(t){n.call(this),this._block=i.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(3782)(a,n),a.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(t){i=t}r(i)},a.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},a.prototype.update=function(t,e){if(function(t,e){if(!i.isBuffer(t)&&"string"!=typeof t)throw TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw Error("Digest already called");i.isBuffer(t)||(t=i.from(t,e));for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var a=this._blockOffset;a0;++o)this._length[o]+=f,(f=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*f);return this},a.prototype._update=function(){throw Error("_update is not implemented")},a.prototype.digest=function(t){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},a.prototype._digest=function(){throw Error("_digest is not implemented")},t.exports=a},7028:function(t,e,r){e.utils=r(263),e.common=r(1330),e.sha=r(301),e.ripemd=r(3079),e.hmac=r(3092),e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160},1330:function(t,e,r){"use strict";var i=r(263),n=r(3523);function a(){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=a,a.prototype.update=function(t,e){if(t=i.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=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(a=8,i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0;athis.blockSize&&(t=(new this.Hash).update(t).digest()),n(t.length<=this.blockSize);for(var e=t.length;e>>3},e.g1_256=function(t){return i(t,17)^i(t,19)^t>>>10}},263:function(t,e,r){"use strict";var i=r(3523),n=r(3782);function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function o(t){return 1===t.length?"0"+t:t}function f(t){if(7===t.length)return"0"+t;if(6===t.length)return"00"+t;if(5===t.length)return"000"+t;if(4===t.length)return"0000"+t;if(3===t.length)return"00000"+t;if(2===t.length)return"000000"+t;if(1===t.length)return"0000000"+t;else return t}e.inherits=n,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),n=0;n>6|192:((a=t,o=n,(64512&a.charCodeAt(o))!=55296||o<0||o+1>=a.length?1:(64512&a.charCodeAt(o+1))!=56320)?r[i++]=f>>12|224:(f=65536+((1023&f)<<10)+(1023&t.charCodeAt(++n)),r[i++]=f>>18|240,r[i++]=f>>12&63|128),r[i++]=f>>6&63|128),r[i++]=63&f|128)}}else for(n=0;n>>0;return f},e.split32=function(t,e){for(var r=Array(4*t.length),i=0,n=0;i>>24,r[n+1]=a>>>16&255,r[n+2]=a>>>8&255,r[n+3]=255&a):(r[n+3]=a>>>24,r[n+2]=a>>>16&255,r[n+1]=a>>>8&255,r[n]=255&a)}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,i){return t+e+r+i>>>0},e.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},e.sum64=function(t,e,r,i){var n=t[e],a=i+t[e+1]>>>0;t[e]=(a>>0,t[e+1]=a},e.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},e.sum64_lo=function(t,e,r,i){return e+i>>>0},e.sum64_4_hi=function(t,e,r,i,n,a,o,f){var s,h=e;return t+r+n+o+(0+((h=h+i>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,i,n,a,o,f){return e+i+a+f>>>0},e.sum64_5_hi=function(t,e,r,i,n,a,o,f,s,h){var d,c=e;return t+r+n+o+s+(0+((c=c+i>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,i,n,a,o,f,s,h){return e+i+a+f+h>>>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}},4910:function(t,e,r){"use strict";var i=r(7028),n=r(6545),a=r(3523);function o(t){if(!(this instanceof o))return new o(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=n.toArray(t.entropy,t.entropyEnc||"hex"),r=n.toArray(t.nonce,t.nonceEnc||"hex"),i=n.toArray(t.pers,t.persEnc||"hex");a(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}t.exports=o,o.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},o.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var a=[];a.length>>32-e}function h(t,e,r,i,n,a,o){return s(t+(e&r|~e&i)+n+a|0,o)+e|0}function d(t,e,r,i,n,a,o){return s(t+(e&i|r&~i)+n+a|0,o)+e|0}function c(t,e,r,i,n,a,o){return s(t+(e^r^i)+n+a|0,o)+e|0}function u(t,e,r,i,n,a,o){return s(t+(r^(e|~i))+n+a|0,o)+e|0}i(f,n),f.prototype._update=function(){for(var t=0;t<16;++t)o[t]=this._block.readInt32LE(4*t);var e=this._a,r=this._b,i=this._c,n=this._d;e=h(e,r,i,n,o[0],3614090360,7),n=h(n,e,r,i,o[1],3905402710,12),i=h(i,n,e,r,o[2],606105819,17),r=h(r,i,n,e,o[3],3250441966,22),e=h(e,r,i,n,o[4],4118548399,7),n=h(n,e,r,i,o[5],1200080426,12),i=h(i,n,e,r,o[6],2821735955,17),r=h(r,i,n,e,o[7],4249261313,22),e=h(e,r,i,n,o[8],1770035416,7),n=h(n,e,r,i,o[9],2336552879,12),i=h(i,n,e,r,o[10],4294925233,17),r=h(r,i,n,e,o[11],2304563134,22),e=h(e,r,i,n,o[12],1804603682,7),n=h(n,e,r,i,o[13],4254626195,12),i=h(i,n,e,r,o[14],2792965006,17),r=h(r,i,n,e,o[15],1236535329,22),e=d(e,r,i,n,o[1],4129170786,5),n=d(n,e,r,i,o[6],3225465664,9),i=d(i,n,e,r,o[11],643717713,14),r=d(r,i,n,e,o[0],3921069994,20),e=d(e,r,i,n,o[5],3593408605,5),n=d(n,e,r,i,o[10],38016083,9),i=d(i,n,e,r,o[15],3634488961,14),r=d(r,i,n,e,o[4],3889429448,20),e=d(e,r,i,n,o[9],568446438,5),n=d(n,e,r,i,o[14],3275163606,9),i=d(i,n,e,r,o[3],4107603335,14),r=d(r,i,n,e,o[8],1163531501,20),e=d(e,r,i,n,o[13],2850285829,5),n=d(n,e,r,i,o[2],4243563512,9),i=d(i,n,e,r,o[7],1735328473,14),r=d(r,i,n,e,o[12],2368359562,20),e=c(e,r,i,n,o[5],4294588738,4),n=c(n,e,r,i,o[8],2272392833,11),i=c(i,n,e,r,o[11],1839030562,16),r=c(r,i,n,e,o[14],4259657740,23),e=c(e,r,i,n,o[1],2763975236,4),n=c(n,e,r,i,o[4],1272893353,11),i=c(i,n,e,r,o[7],4139469664,16),r=c(r,i,n,e,o[10],3200236656,23),e=c(e,r,i,n,o[13],681279174,4),n=c(n,e,r,i,o[0],3936430074,11),i=c(i,n,e,r,o[3],3572445317,16),r=c(r,i,n,e,o[6],76029189,23),e=c(e,r,i,n,o[9],3654602809,4),n=c(n,e,r,i,o[12],3873151461,11),i=c(i,n,e,r,o[15],530742520,16),r=c(r,i,n,e,o[2],3299628645,23),e=u(e,r,i,n,o[0],4096336452,6),n=u(n,e,r,i,o[7],1126891415,10),i=u(i,n,e,r,o[14],2878612391,15),r=u(r,i,n,e,o[5],4237533241,21),e=u(e,r,i,n,o[12],1700485571,6),n=u(n,e,r,i,o[3],2399980690,10),i=u(i,n,e,r,o[10],4293915773,15),r=u(r,i,n,e,o[1],2240044497,21),e=u(e,r,i,n,o[8],1873313359,6),n=u(n,e,r,i,o[15],4264355552,10),i=u(i,n,e,r,o[6],2734768916,15),r=u(r,i,n,e,o[13],1309151649,21),e=u(e,r,i,n,o[4],4149444226,6),n=u(n,e,r,i,o[11],3174756917,10),i=u(i,n,e,r,o[2],718787259,15),r=u(r,i,n,e,o[9],3951481745,21),this._a=this._a+e|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+n|0},f.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=a.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=f},1354:function(t,e,r){var i=r(711),n=r(3500);function a(t){this.rand=t||new n.Rand}t.exports=a,a.create=function(t){return new a(t)},a.prototype._randbelow=function(t){var e=Math.ceil(t.bitLength()/8);do var r=new i(this.rand.generate(e));while(r.cmp(t)>=0);return r},a.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},a.prototype.test=function(t,e,r){var n=t.bitLength(),a=i.mont(t),o=new i(1).toRed(a);e||(e=Math.max(1,n/48|0));for(var f=t.subn(1),s=0;!f.testn(s);s++);for(var h=t.shrn(s),d=f.toRed(a);e>0;e--){var c=this._randrange(new i(2),f);r&&r(c);var u=c.toRed(a).redPow(h);if(0!==u.cmp(o)&&0!==u.cmp(d)){for(var l=1;l0;e--){var d=this._randrange(new i(2),o),c=t.gcd(d);if(0!==c.cmpn(1))return c;var u=d.toRed(n).redPow(s);if(0!==u.cmp(a)&&0!==u.cmp(h)){for(var l=1;l>8,o=255&n;a?r.push(a,o):r.push(o)}return r},e.zero2=r,e.toHex=i,e.encode=function(t,e){return"hex"===e?i(t):t}},8687:function(t,e,r){"use strict";var i=r(7160);e.certificate=r(8782);var n=i.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});e.RSAPrivateKey=n;var a=i.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});e.RSAPublicKey=a;var o=i.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(f),this.key("subjectPublicKey").bitstr())});e.PublicKey=o;var f=i.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),s=i.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(f),this.key("subjectPrivateKey").octstr())});e.PrivateKey=s;var h=i.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});e.EncryptedPrivateKey=h;var d=i.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});e.DSAPrivateKey=d,e.DSAparam=i.define("DSAparam",function(){this.int()});var c=i.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(u),this.key("publicKey").optional().explicit(1).bitstr())});e.ECPrivateKey=c;var u=i.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});e.signature=i.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},8782:function(t,e,r){"use strict";var i=r(7160),n=i.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),a=i.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),o=i.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),f=i.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(o),this.key("subjectPublicKey").bitstr())}),s=i.define("RelativeDistinguishedName",function(){this.setof(a)}),h=i.define("RDNSequence",function(){this.seqof(s)}),d=i.define("Name",function(){this.choice({rdnSequence:this.use(h)})}),c=i.define("Validity",function(){this.seq().obj(this.key("notBefore").use(n),this.key("notAfter").use(n))}),u=i.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),l=i.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(o),this.key("issuer").use(d),this.key("validity").use(c),this.key("subject").use(d),this.key("subjectPublicKeyInfo").use(f),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(u).optional())}),p=i.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(l),this.key("signatureAlgorithm").use(o),this.key("signatureValue").bitstr())});t.exports=p},6501:function(t,e,r){var i=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m,n=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,a=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,o=r(8368),f=r(6594),s=r(6911).Buffer;t.exports=function(t,e){var r,h=t.toString(),d=h.match(i);if(d){var c="aes"+d[1],u=s.from(d[2],"hex"),l=s.from(d[3].replace(/[\r\n]/g,""),"base64"),p=o(e,u.slice(0,8),parseInt(d[1],10)).key,b=[],m=f.createDecipheriv(c,p,u);b.push(m.update(l)),b.push(m.final()),r=s.concat(b)}else r=new s(h.match(a)[2].replace(/[\r\n]/g,""),"base64");return{tag:h.match(n)[1],data:r}}},9902:function(t,e,r){var i=r(8687),n=r(2510),a=r(6501),o=r(6594),f=r(4978),s=r(6911).Buffer;function h(t){"object"!=typeof t||s.isBuffer(t)||(y=t.passphrase,t=t.key),"string"==typeof t&&(t=s.from(t));var e,r,h,d,c,u,l,p,b,m,v,y,g,_,w=a(t,y),M=w.tag,S=w.data;switch(M){case"CERTIFICATE":_=i.certificate.decode(S,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(_||(_=i.PublicKey.decode(S,"der")),g=_.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPublicKey.decode(_.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return _.subjectPrivateKey=_.subjectPublicKey,{type:"ec",data:_};case"1.2.840.10040.4.1":return _.algorithm.params.pub_key=i.DSAparam.decode(_.subjectPublicKey.data,"der"),{type:"dsa",data:_.algorithm.params};default:throw Error("unknown key id "+g)}throw Error("unknown key type "+M);case"ENCRYPTED PRIVATE KEY":e=S=i.EncryptedPrivateKey.decode(S,"der"),r=y,h=e.algorithm.decrypt.kde.kdeparams.salt,d=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),c=n[e.algorithm.decrypt.cipher.algo.join(".")],u=e.algorithm.decrypt.cipher.iv,l=e.subjectPrivateKey,p=parseInt(c.split("-")[1],10)/8,b=f.pbkdf2Sync(r,h,d,p,"sha1"),m=o.createDecipheriv(c,b,u),(v=[]).push(m.update(l)),v.push(m.final()),S=s.concat(v);case"PRIVATE KEY":switch(g=(_=i.PrivateKey.decode(S,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPrivateKey.decode(_.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:_.algorithm.curve,privateKey:i.ECPrivateKey.decode(_.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return _.algorithm.params.priv_key=i.DSAparam.decode(_.subjectPrivateKey,"der"),{type:"dsa",params:_.algorithm.params};default:throw Error("unknown key id "+g)}throw Error("unknown key type "+M);case"RSA PUBLIC KEY":return i.RSAPublicKey.decode(S,"der");case"RSA PRIVATE KEY":return i.RSAPrivateKey.decode(S,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:i.DSAPrivateKey.decode(S,"der")};case"EC PRIVATE KEY":return{curve:(S=i.ECPrivateKey.decode(S,"der")).parameters.value,privateKey:S.privateKey};default:throw Error("unknown key type "+M)}}t.exports=h,h.signature=i.signature},4978:function(t,e,r){var i=r(6113),n=r(5349),a=r(7007),o=r(5407);i.pbkdf2Sync&&-1!==i.pbkdf2Sync.toString().indexOf("keylen, digest")?(e.pbkdf2Sync=function(t,e,r,f,s){return n(r,f),t=o(t,a,"Password"),e=o(e,a,"Salt"),s=s||"sha1",i.pbkdf2Sync(t,e,r,f,s)},e.pbkdf2=function(t,e,r,f,s,h){if(n(r,f),t=o(t,a,"Password"),e=o(e,a,"Salt"),"function"==typeof s&&(h=s,s="sha1"),"function"!=typeof h)throw Error("No callback provided to pbkdf2");return i.pbkdf2(t,e,r,f,s,h)}):(e.pbkdf2Sync=r(2127),e.pbkdf2=r(9601))},9601:function(t,e,i){var a,o=i(6911).Buffer,f=i(5349),s=i(7007),h=i(2127),d=i(5407),c=r.g.crypto&&r.g.crypto.subtle,u={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},l=[];function p(t,e,r,i,n){return c.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then(function(t){return c.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:n}},t,i<<3)}).then(function(t){return o.from(t)})}t.exports=function(t,e,i,b,m,v){"function"==typeof m&&(v=m,m=void 0);var y=u[(m=m||"sha1").toLowerCase()];if(!y||"function"!=typeof r.g.Promise)return n.nextTick(function(){var r;try{r=h(t,e,i,b,m)}catch(t){return v(t)}v(null,r)});if(f(i,b),t=d(t,s,"Password"),e=d(e,s,"Salt"),"function"!=typeof v)throw Error("No callback provided to pbkdf2");!function(t,e){t.then(function(t){n.nextTick(function(){e(null,t)})},function(t){n.nextTick(function(){e(t)})})}((function(t){if(r.g.process&&!r.g.process.browser||!c||!c.importKey||!c.deriveBits)return Promise.resolve(!1);if(void 0!==l[t])return l[t];var e=p(a=a||o.alloc(8),a,10,128,t).then(function(){return!0}).catch(function(){return!1});return l[t]=e,e})(y).then(function(r){return r?p(t,e,i,b,y):h(t,e,i,b,m)}),v)}},7007:function(t){var e;e="utf-8",t.exports=e},5349:function(t){t.exports=function(t,e){if("number"!=typeof t)throw TypeError("Iterations not a number");if(t<0)throw TypeError("Bad iterations");if("number"!=typeof e)throw TypeError("Key length not a number");if(e<0||e>1073741823||e!=e)throw TypeError("Bad key length")}},2127:function(t,e,r){var i={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20},n=r(4873),a=r(6911).Buffer,o=r(5349),f=r(7007),s=r(5407);t.exports=function(t,e,r,h,d){o(r,h),t=s(t,f,"Password"),e=s(e,f,"Salt"),d=d||"sha1";var c=a.allocUnsafe(h),u=a.allocUnsafe(e.length+4);e.copy(u,0,0,e.length);for(var l=0,p=i[d],b=Math.ceil(h/p),m=1;m<=b;m++){u.writeUInt32BE(m,e.length);for(var v=n(d,t).update(u).digest(),y=v,g=1;gp||new o(e).cmp(l.modulus)>=0)throw Error("decryption error");u=r?h(new o(e),l):f(e,l);var b=d.alloc(p-u.length);if(u=d.concat([b,u],p),4===c)return function(t,e){var r=t.modulus.byteLength(),i=s("sha1").update(d.alloc(0)).digest(),o=i.length;if(0!==e[0])throw Error("decryption error");var f=e.slice(1,o+1),h=e.slice(o+1),c=a(f,n(h,o)),u=a(h,n(c,r-o-1));if(function(t,e){t=d.from(t),e=d.from(e);var r=0,i=t.length;t.length!==e.length&&(r++,i=Math.min(t.length,e.length));for(var n=-1;++n=e.length){a++;break}var o=e.slice(2,n-1);if(("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&a++,o.length<8&&a++,a)throw Error("decryption error");return e.slice(n)}(0,u,r);if(3===c)return u;throw Error("unknown padding")}},3995:function(t,e,r){var i=r(9902),n=r(7223),a=r(9739),o=r(5520),f=r(6386),s=r(711),h=r(1607),d=r(7166),c=r(6911).Buffer;t.exports=function(t,e,r){u=t.padding?t.padding:r?1:4;var u,l,p=i(t);if(4===u)l=function(t,e){var r=t.modulus.byteLength(),i=e.length,h=a("sha1").update(c.alloc(0)).digest(),d=h.length,u=2*d;if(i>r-u-2)throw Error("message too long");var l=c.alloc(r-i-u-2),p=r-d-1,b=n(d),m=f(c.concat([h,l,c.alloc(1,1),e],p),o(b,p)),v=f(b,o(m,d));return new s(c.concat([c.alloc(1),v,m],r))}(p,e);else if(1===u)l=function(t,e,r){var i,a=e.length,o=t.modulus.byteLength();if(a>o-11)throw Error("message too long");return i=r?c.alloc(o-a-3,255):function(t){for(var e,r=c.allocUnsafe(t),i=0,a=n(2*t),o=0;i=0)throw Error("data too long for modulus")}else throw Error("unknown padding");return r?d(l,p):h(l,p)}},1607:function(t,e,r){var i=r(711),n=r(6911).Buffer;t.exports=function(t,e){return n.from(t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed().toArray())}},6386:function(t){t.exports=function(t,e){for(var r=t.length,i=-1;++i4294967295)throw RangeError("requested too many random bytes");var r=a.allocUnsafe(t);if(t>0){if(t>65536)for(var i=0;i4294967295||t<0)throw TypeError("offset must be a uint32");if(t>s||t>e)throw RangeError("offset out of range")}function c(t,e,r){if("number"!=typeof t||t!=t)throw TypeError("size must be a number");if(t>4294967295||t<0)throw TypeError("size must be a uint32");if(t+e>r||t>s)throw RangeError("buffer too small")}function u(t,e,r,i){var a=new Uint8Array(t.buffer,e,r);if(h.getRandomValues(a),i){n.nextTick(function(){i(null,t)});return}return t}h&&h.getRandomValues?(e.randomFill=function(t,e,i,n){if(!f.isBuffer(t)&&!(t instanceof r.g.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof e)n=e,e=0,i=t.length;else if("function"==typeof i)n=i,i=t.length-e;else if("function"!=typeof n)throw TypeError('"cb" argument must be a function');return d(e,t.length),c(i,e,t.length),u(t,e,i,n)},e.randomFillSync=function(t,e,i){if(void 0===e&&(e=0),!f.isBuffer(t)&&!(t instanceof r.g.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');return d(e,t.length),void 0===i&&(i=t.length-e),c(i,e,t.length),u(t,e,i)}):(e.randomFill=a,e.randomFillSync=a)},4646:function(t){"use strict";let e={};function r(t,r,i){i||(i=Error);class n extends i{constructor(t,e,i){super("string"==typeof r?r:r(t,e,i))}}n.prototype.name=i.name,n.prototype.code=t,e[t]=n}function i(t,e){if(!Array.isArray(t))return`of ${e} ${String(t)}`;{let r=t.length;return(t=t.map(t=>String(t)),r>2)?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:2===r?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}}r("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(t,e,r){var n,a,o,f;let s,h;if("string"==typeof e&&(n="not ",e.substr(0,n.length)===n)?(s="must not be",e=e.replace(/^not /,"")):s="must be",a=" argument",(void 0===o||o>t.length)&&(o=t.length),t.substring(o-a.length,o)===a)h=`The ${t} ${s} ${i(e,"type")}`;else{let r=("number"!=typeof f&&(f=0),f+1>t.length||-1===t.indexOf(".",f))?"argument":"property";h=`The "${t}" ${r} ${s} ${i(e,"type")}`}return h+`. Received type ${typeof r}`},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},2403:function(t,e,r){"use strict";var i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=d;var a=r(1709),o=r(7337);r(3782)(d,a);for(var f=i(o.prototype),s=0;s0){if("string"==typeof e||c.objectMode||Object.getPrototypeOf(e)===u.prototype||(h=e,e=u.from(h)),i)c.endEmitted?S(t,new M):R(t,c,e,!0);else if(c.ended)S(t,new _);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(e=c.decoder.write(e),c.objectMode||0!==e.length?R(t,c,e,!1):T(t,c)):R(t,c,e,!1)}}else i||(c.reading=!1,T(t,c))}return!c.ended&&(c.lengthe.highWaterMark){var r;e.highWaterMark=((r=t)>=1073741824?r=1073741824:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),r)}return t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0)}function B(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(P,t))}function P(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,N(t)}function T(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(C,t,e))}function C(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function O(t){o("readable nexttick read 0"),t.read(0)}function D(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function q(t,e){var r;return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r)}function L(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(z,e,t))}function z(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function U(t,e){for(var r=0,i=t.length;r=r.highWaterMark:r.length>0)||r.ended))return o("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?L(this):B(this),null;if(0===(t=I(t,r))&&r.ended)return 0===r.length&&L(this),null;var n=r.needReadable;return o("need readable",n),(0===r.length||r.length-t0?q(t,r):null)?(r.needReadable=r.length<=r.highWaterMark,t=0):(r.length-=t,r.awaitDrain=0),0===r.length&&(r.ended||(r.needReadable=!0),i!==t&&r.ended&&L(this)),null!==e&&this.emit("data",e),e},A.prototype._read=function(t){S(this,new w("_read()"))},A.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,o("pipe count=%d opts=%j",i.pipesCount,e);var a=e&&!1===e.end||t===n.stdout||t===n.stderr?b:f;function f(){o("onend"),t.end()}i.endEmitted?n.nextTick(a):r.once("end",a),t.on("unpipe",function e(n,a){o("onunpipe"),n===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,o("cleanup"),t.removeListener("close",l),t.removeListener("finish",p),t.removeListener("drain",s),t.removeListener("error",u),t.removeListener("unpipe",e),r.removeListener("end",f),r.removeListener("end",b),r.removeListener("data",c),h=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&s())});var s=function(){var t=r._readableState;o("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&d(r,"data")&&(t.flowing=!0,N(r))};t.on("drain",s);var h=!1;function c(e){o("ondata");var n=t.write(e);o("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==U(i.pipes,t))&&!h&&(o("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function u(e){o("onerror",e),b(),t.removeListener("error",u),0===d(t,"error")&&S(t,e)}function l(){t.removeListener("finish",p),b()}function p(){o("onfinish"),t.removeListener("close",l),b()}function b(){o("unpipe"),r.unpipe(t)}return r.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",u),t.once("close",l),t.once("finish",p),t.emit("pipe",r),i.flowing||(o("pipe resume"),r.resume()),t},A.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a0,!1!==i.flowing&&this.resume()):"readable"!==t||i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,o("on readable",i.length,i.reading),i.length?B(this):i.reading||n.nextTick(O,this)),r},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(t,e){var r=c.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(j,this),r},A.prototype.removeAllListeners=function(t){var e=c.prototype.removeAllListeners.apply(this,arguments);return("readable"===t||void 0===t)&&n.nextTick(j,this),e},A.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(D,this,t))),t.paused=!1,this},A.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",function(){if(o("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(n){o("wrapped data"),r.decoder&&(n=r.decoder.write(n)),(!r.objectMode||null!=n)&&(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))}),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var a=0;a-1))throw new M(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(t,e,r){r(new m("_write()"))},A.prototype._writev=null,A.prototype.end=function(t,e,r){var i,a=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),a.corked&&(a.corked=1,this.uncork()),a.ending||(i=r,a.ending=!0,T(this,a),i&&(a.finished?n.nextTick(i):this.once("finish",i)),a.ended=!0,this.writable=!1),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),A.prototype.destroy=u.destroy,A.prototype._undestroy=u.undestroy,A.prototype._destroy=function(t,e){e(t)}},6871:function(t,e,r){"use strict";function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var a,o=r(9698),f=Symbol("lastResolve"),s=Symbol("lastReject"),h=Symbol("error"),d=Symbol("ended"),c=Symbol("lastPromise"),u=Symbol("handlePromise"),l=Symbol("stream");function p(t,e){return{value:t,done:e}}function b(t){var e=t[f];if(null!==e){var r=t[l].read();null!==r&&(t[c]=null,t[f]=null,t[s]=null,e(p(r,!1)))}}function m(t){n.nextTick(b,t)}var v=Object.getPrototypeOf(function(){}),y=Object.setPrototypeOf((i(a={get stream(){return this[l]},next:function(){var t,e,r=this,i=this[h];if(null!==i)return Promise.reject(i);if(this[d])return Promise.resolve(p(void 0,!0));if(this[l].destroyed)return new Promise(function(t,e){n.nextTick(function(){r[h]?e(r[h]):t(p(void 0,!0))})});var a=this[c];if(a)e=new Promise((t=this,function(e,r){a.then(function(){if(t[d]){e(p(void 0,!0));return}t[u](e,r)},r)}));else{var o=this[l].read();if(null!==o)return Promise.resolve(p(o,!1));e=new Promise(this[u])}return this[c]=e,e}},Symbol.asyncIterator,function(){return this}),i(a,"return",function(){var t=this;return new Promise(function(e,r){t[l].destroy(null,function(t){if(t){r(t);return}e(p(void 0,!0))})})}),a),v);t.exports=function(t){var e,r=Object.create(y,(i(e={},l,{value:t,writable:!0}),i(e,f,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,h,{value:null,writable:!0}),i(e,d,{value:t._readableState.endEmitted,writable:!0}),i(e,u,{value:function(t,e){var i=r[l].read();i?(r[c]=null,r[f]=null,r[s]=null,t(p(i,!1))):(r[f]=t,r[s]=e)},writable:!0}),e));return r[c]=null,o(t,function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[s];null!==e&&(r[c]=null,r[f]=null,r[s]=null,e(t)),r[h]=t;return}var i=r[f];null!==i&&(r[c]=null,r[f]=null,r[s]=null,i(p(void 0,!0))),r[d]=!0}),t.on("readable",m.bind(null,r)),r}},4379:function(t,e,r){"use strict";function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}var n=r(4300).Buffer,a=r(3837).inspect,o=a&&a.custom||"inspect";t.exports=function(){var t;function e(){!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return t=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return n.alloc(0);for(var e,r,i=n.allocUnsafe(t>>>0),a=this.head,o=0;a;)e=a.data,r=o,n.prototype.copy.call(e,i,r),o+=a.data.length,a=a.next;return i}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(a===n.length?i+=n:i+=n.slice(0,t),0==(t-=a)){a===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=n.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var a=r.data,o=t>a.length?a.length:t;if(a.copy(e,e.length-t,0,o),0==(t-=o)){o===a.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=a.slice(o));break}++i}return this.length-=i,e}},{key:o,value:function(t,e){return a(this,function(t){for(var e=1;e0,h=f=function(t){e||(e=t),t&&l.forEach(s),m||(l.forEach(s),u(e))},c=!1,f=function(){c||(c=!0,h.apply(void 0,arguments))},p=!1,t.on("close",function(){p=!0}),void 0===i&&(i=r(9698)),i(t,{readable:m,writable:a},function(t){if(t)return f(t);p=!0,f()}),b=!1,function(e){if(!p&&!b){if(b=!0,t.setHeader&&"function"==typeof t.abort)return t.abort();if("function"==typeof t.destroy)return t.destroy();f(e||new o("pipe"))}}});return d.reduce(h)}},6776:function(t,e,r){"use strict";var i=r(4646).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,n){var a=null!=e.highWaterMark?e.highWaterMark:n?e[r]:null;if(null!=a){if(!(isFinite(a)&&Math.floor(a)===a)||a<0)throw new i(n?r:"highWaterMark",a);return Math.floor(a)}return t.objectMode?16:16384}}},4678:function(t,e,r){t.exports=r(2781)},3726:function(t,e,r){var i=r(2781);"disable"===n.env.READABLE_STREAM&&i?(t.exports=i.Readable,Object.assign(t.exports,i),t.exports.Stream=i):((e=t.exports=r(1709)).Stream=i||e,e.Readable=e,e.Writable=r(7337),e.Duplex=r(2403),e.Transform=r(1170),e.PassThrough=r(7889),e.finished=r(9698),e.pipeline=r(8442))},3225:function(t,e,r){"use strict";var i=r(4300).Buffer,n=r(3782),a=r(9029),o=Array(16),f=[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],s=[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],h=[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],d=[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];function c(){a.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function u(t,e){return t<>>32-e}n(c,a),c.prototype._update=function(){for(var t,e,r,i,n,a,c,l,p,b,m,v,y,g,_,w,M,S,k,E,A,x,R,I,B,P,T,C,j,O,D,N,q,L,z,U,K,H,F,V,W,Z,X,G,J,Y,$,Q,tt,te,tr,ti,tn=0;tn<16;++tn)o[tn]=this._block.readInt32LE(4*tn);for(var ta=0|this._a,to=0|this._b,tf=0|this._c,ts=0|this._d,th=0|this._e,td=0|this._a,tc=0|this._b,tu=0|this._c,tl=0|this._d,tp=0|this._e,tb=0;tb<80;tb+=1)tb<16?(t=ta,e=to,r=tf,i=ts,n=th,tr=u(t+(e^r^i)+o[f[tb]]+0|0,h[tb])+n|0,a=td,c=tc,l=tu,p=tl,b=tp,ti=u(a+(c^(l|~p))+o[s[tb]]+1352829926|0,d[tb])+b|0):tb<32?(m=ta,v=to,y=tf,g=ts,_=th,tr=u(m+(v&y|~v&g)+o[f[tb]]+1518500249|0,h[tb])+_|0,w=td,M=tc,S=tu,k=tl,E=tp,ti=u(w+(M&k|S&~k)+o[s[tb]]+1548603684|0,d[tb])+E|0):tb<48?(A=ta,x=to,R=tf,I=ts,B=th,tr=u(A+((x|~R)^I)+o[f[tb]]+1859775393|0,h[tb])+B|0,P=td,T=tc,C=tu,j=tl,O=tp,ti=u(P+((T|~C)^j)+o[s[tb]]+1836072691|0,d[tb])+O|0):tb<64?(D=ta,N=to,q=tf,L=ts,z=th,tr=u(D+(N&L|q&~L)+o[f[tb]]+2400959708|0,h[tb])+z|0,U=td,K=tc,H=tu,F=tl,V=tp,ti=u(U+(K&H|~K&F)+o[s[tb]]+2053994217|0,d[tb])+V|0):(W=ta,Z=to,X=tf,G=ts,J=th,tr=u(W+(Z^(X|~G))+o[f[tb]]+2840853838|0,h[tb])+J|0,Y=td,$=tc,Q=tu,tt=tl,te=tp,ti=u(Y+($^Q^tt)+o[s[tb]]+0|0,d[tb])+te|0),ta=th,th=ts,ts=u(tf,10),tf=to,to=tr,td=tp,tp=tl,tl=u(tu,10),tu=tc,tc=ti;var tm=this._b+tf+tl|0;this._b=this._c+ts+tp|0,this._c=this._d+th+td|0,this._d=this._e+ta+tc|0,this._e=this._a+to+tu|0,this._a=tm},c.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=i.alloc?i.alloc(20):new i(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=c},5055:function(t,e,r){var i=r(4300),n=i.Buffer;function a(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,e),e.Buffer=o),o.prototype=Object.create(n.prototype),a(n,o),o.from=function(t,e,r){if("number"==typeof t)throw TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw TypeError("Argument must be a number");return i.SlowBuffer(t)}},6911:function(t,e,r){/*! safe-buffer. MIT License. Feross Aboukhadijeh */var i=r(4300),n=i.Buffer;function a(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,e),e.Buffer=o),o.prototype=Object.create(n.prototype),a(n,o),o.from=function(t,e,r){if("number"==typeof t)throw TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw TypeError("Argument must be a number");return i.SlowBuffer(t)}},2858:function(t,e,r){var i=r(6911).Buffer;function n(t,e){this._block=i.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}n.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=i.from(t,e));for(var r=this._block,n=this._blockSize,a=t.length,o=this._len,f=0;f=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0;this._block.writeUInt32BE((r-i)/4294967296,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var n=this._hash();return t?n.toString(t):n},n.prototype._update=function(){throw Error("_update must be implemented by subclass")},t.exports=n},4371:function(t,e,r){var i=t.exports=function(t){var e=i[t=t.toLowerCase()];if(!e)throw Error(t+" is not supported (we accept pull requests)");return new e};i.sha=r(4018),i.sha1=r(4179),i.sha224=r(532),i.sha256=r(1843),i.sha384=r(7455),i.sha512=r(9934)},4018:function(t,e,r){var i=r(3782),n=r(2858),a=r(6911).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],f=Array(80);function s(){this.init(),this._w=f,n.call(this,64,56)}i(s,n),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(t){for(var e=this._w,r=0|this._a,i=0|this._b,n=0|this._c,a=0|this._d,f=0|this._e,s=0;s<16;++s)e[s]=t.readInt32BE(4*s);for(;s<80;++s)e[s]=e[s-3]^e[s-8]^e[s-14]^e[s-16];for(var h=0;h<80;++h){var d,c,u,l,p,b=~~(h/20),m=((d=r)<<5|d>>>27)+(c=i,u=n,l=a,0===b?c&u|~c&l:2===b?c&u|c&l|u&l:c^u^l)+f+e[h]+o[b]|0;f=a,a=n,n=(p=i)<<30|p>>>2,i=r,r=m}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=a+this._d|0,this._e=f+this._e|0},s.prototype._hash=function(){var t=a.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=s},4179:function(t,e,r){var i=r(3782),n=r(2858),a=r(6911).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],f=Array(80);function s(){this.init(),this._w=f,n.call(this,64,56)}i(s,n),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(t){for(var e=this._w,r=0|this._a,i=0|this._b,n=0|this._c,a=0|this._d,f=0|this._e,s=0;s<16;++s)e[s]=t.readInt32BE(4*s);for(;s<80;++s)e[s]=(d=e[s-3]^e[s-8]^e[s-14]^e[s-16])<<1|d>>>31;for(var h=0;h<80;++h){var d,c,u,l,p,b,m=~~(h/20),v=((c=r)<<5|c>>>27)+(u=i,l=n,p=a,0===m?u&l|~u&p:2===m?u&l|u&p|l&p:u^l^p)+f+e[h]+o[m]|0;f=a,a=n,n=(b=i)<<30|b>>>2,i=r,r=v}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=a+this._d|0,this._e=f+this._e|0},s.prototype._hash=function(){var t=a.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=s},532:function(t,e,r){var i=r(3782),n=r(1843),a=r(2858),o=r(6911).Buffer,f=Array(64);function s(){this.init(),this._w=f,a.call(this,64,56)}i(s,n),s.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},s.prototype._hash=function(){var t=o.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=s},1843:function(t,e,r){var i=r(3782),n=r(2858),a=r(6911).Buffer,o=[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],f=Array(64);function s(){this.init(),this._w=f,n.call(this,64,56)}i(s,n),s.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},s.prototype._update=function(t){for(var e=this._w,r=0|this._a,i=0|this._b,n=0|this._c,a=0|this._d,f=0|this._e,s=0|this._f,h=0|this._g,d=0|this._h,c=0;c<16;++c)e[c]=t.readInt32BE(4*c);for(;c<64;++c)e[c]=(((l=e[c-2])>>>17|l<<15)^(l>>>19|l<<13)^l>>>10)+e[c-7]+(((p=e[c-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3)+e[c-16]|0;for(var u=0;u<64;++u){var l,p,b,m,v,y,g,_,w,M=d+(((b=f)>>>6|b<<26)^(b>>>11|b<<21)^(b>>>25|b<<7))+(m=f,v=s,(y=h)^m&(v^y))+o[u]+e[u]|0,S=(((g=r)>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+((_=r)&(w=i)|n&(_|w))|0;d=h,h=s,s=f,f=a+M|0,a=n,n=i,i=r,r=M+S|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=a+this._d|0,this._e=f+this._e|0,this._f=s+this._f|0,this._g=h+this._g|0,this._h=d+this._h|0},s.prototype._hash=function(){var t=a.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=s},7455:function(t,e,r){var i=r(3782),n=r(9934),a=r(2858),o=r(6911).Buffer,f=Array(160);function s(){this.init(),this._w=f,a.call(this,128,112)}i(s,n),s.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},s.prototype._hash=function(){var t=o.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=s},9934:function(t,e,r){var i=r(3782),n=r(2858),a=r(6911).Buffer,o=[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],f=Array(160);function s(){this.init(),this._w=f,n.call(this,128,112)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function d(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function c(t,e){return t>>>0>>0?1:0}i(s,n),s.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},s.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,a=0|this._dh,f=0|this._eh,s=0|this._fh,u=0|this._gh,l=0|this._hh,p=0|this._al,b=0|this._bl,m=0|this._cl,v=0|this._dl,y=0|this._el,g=0|this._fl,_=0|this._gl,w=0|this._hl,M=0;M<32;M+=2)e[M]=t.readInt32BE(4*M),e[M+1]=t.readInt32BE(4*M+4);for(;M<160;M+=2){var S,k,E,A,x,R,I,B,P=e[M-30],T=e[M-30+1],C=((S=P)>>>1|(k=T)<<31)^(S>>>8|k<<24)^S>>>7,j=((E=T)>>>1|(A=P)<<31)^(E>>>8|A<<24)^(E>>>7|A<<25);P=e[M-4],T=e[M-4+1];var O=((x=P)>>>19|(R=T)<<13)^(R>>>29|x<<3)^x>>>6,D=((I=T)>>>19|(B=P)<<13)^(B>>>29|I<<3)^(I>>>6|B<<26),N=e[M-14],q=e[M-14+1],L=e[M-32],z=e[M-32+1],U=j+q|0,K=C+N+c(U,j)|0;K=(K=K+O+c(U=U+D|0,D)|0)+L+c(U=U+z|0,z)|0,e[M]=K,e[M+1]=U}for(var H=0;H<160;H+=2){K=e[H],U=e[H+1];var F,V,W,Z,X,G,J,Y,$,Q,tt=(F=r)&(V=i)|n&(F|V),te=(W=p)&(Z=b)|m&(W|Z),tr=h(r,p),ti=h(p,r),tn=d(f,y),ta=d(y,f),to=o[H],tf=o[H+1],ts=(X=f,G=s,(J=u)^X&(G^J)),th=(Y=y,$=g,(Q=_)^Y&($^Q)),td=w+ta|0,tc=l+tn+c(td,w)|0;tc=(tc=(tc=tc+ts+c(td=td+th|0,th)|0)+to+c(td=td+tf|0,tf)|0)+K+c(td=td+U|0,U)|0;var tu=ti+te|0,tl=tr+tt+c(tu,ti)|0;l=u,w=_,u=s,_=g,s=f,g=y,f=a+tc+c(y=v+td|0,v)|0,a=n,v=m,n=i,m=b,i=r,b=p,r=tc+tl+c(p=td+tu|0,td)|0}this._al=this._al+p|0,this._bl=this._bl+b|0,this._cl=this._cl+m|0,this._dl=this._dl+v|0,this._el=this._el+y|0,this._fl=this._fl+g|0,this._gl=this._gl+_|0,this._hl=this._hl+w|0,this._ah=this._ah+r+c(this._al,p)|0,this._bh=this._bh+i+c(this._bl,b)|0,this._ch=this._ch+n+c(this._cl,m)|0,this._dh=this._dh+a+c(this._dl,v)|0,this._eh=this._eh+f+c(this._el,y)|0,this._fh=this._fh+s+c(this._fl,g)|0,this._gh=this._gh+u+c(this._gl,_)|0,this._hh=this._hh+l+c(this._hl,w)|0},s.prototype._hash=function(){var t=a.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=s},3704:function(t,e,r){"use strict";var i=r(5055).Buffer,n=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(t){var e;switch(this.encoding=function(t){var e=function(t){var e;if(!t)return"utf8";for(;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=s,this.end=h,e=4;break;case"utf8":this.fillLast=f,e=4;break;case"base64":this.text=d,this.end=c,e=3;break;default:this.write=u,this.end=l;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function f(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if((192&e[0])!=128)return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if((192&e[1])!=128)return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&(192&e[2])!=128)return t.lastNeed=2,"�"}}(this,t,0);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length)}function s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function d(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function u(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}e.s=a,a.prototype.write=function(t){var e,r;if(0===t.length)return"";if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},a.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},6769:function(t){t.exports=function(t,r){if(e("noDeprecation"))return t;var i=!1;return function(){if(!i){if(e("throwDeprecation"))throw Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),i=!0}return t.apply(this,arguments)}};function e(t){try{if(!r.g.localStorage)return!1}catch(t){return!1}var e=r.g.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}},4300:function(t){"use strict";t.exports=r(9109)},6113:function(t){"use strict";t.exports=r(75683)},2361:function(t){"use strict";t.exports=r(68885)},2781:function(t){"use strict";t.exports=r(63090)},1576:function(t){"use strict";t.exports=r(56123)},3837:function(t){"use strict";t.exports=r(11786)},6144:function(t){"use strict";t.exports=r(38336)},5866:function(t){"use strict";t.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},2908:function(t){"use strict";t.exports=JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}')},9267:function(t){"use strict";t.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},7992:function(t){"use strict";t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},2531:function(t){"use strict";t.exports={i8:"6.5.3"}},2510:function(t){"use strict";t.exports=JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}')}},u={};function l(t){var e=u[t];if(void 0!==e)return e.exports;var r=u[t]={id:t,loaded:!1,exports:{}},i=!0;try{c[t].call(r.exports,r,r.exports,l),i=!1}finally{i&&delete u[t]}return r.loaded=!0,r.exports}l.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},l.ab="//";var p={};p.randomBytes=p.rng=p.pseudoRandomBytes=p.prng=l(7223),p.createHash=p.Hash=l(9739),p.createHmac=p.Hmac=l(4873),e=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(Object.keys(l(9276))),p.getHashes=function(){return e},a=l(4978),p.pbkdf2=a.pbkdf2,p.pbkdf2Sync=a.pbkdf2Sync,o=l(8996),p.Cipher=o.Cipher,p.createCipher=o.createCipher,p.Cipheriv=o.Cipheriv,p.createCipheriv=o.createCipheriv,p.Decipher=o.Decipher,p.createDecipher=o.createDecipher,p.Decipheriv=o.Decipheriv,p.createDecipheriv=o.createDecipheriv,p.getCiphers=o.getCiphers,p.listCiphers=o.listCiphers,f=l(6587),p.DiffieHellmanGroup=f.DiffieHellmanGroup,p.createDiffieHellmanGroup=f.createDiffieHellmanGroup,p.getDiffieHellman=f.getDiffieHellman,p.createDiffieHellman=f.createDiffieHellman,p.DiffieHellman=f.DiffieHellman,s=l(4078),p.createSign=s.createSign,p.Sign=s.Sign,p.createVerify=s.createVerify,p.Verify=s.Verify,p.createECDH=l(9942),h=l(9783),p.publicEncrypt=h.publicEncrypt,p.privateEncrypt=h.privateEncrypt,p.publicDecrypt=h.publicDecrypt,p.privateDecrypt=h.privateDecrypt,d=l(6445),p.randomFill=d.randomFill,p.randomFillSync=d.randomFillSync,p.createCredentials=function(){throw Error("sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/crypto-browserify/crypto-browserify")},p.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},t.exports=p}()}}]); \ No newline at end of file diff --git a/_next/static/chunks/adeb83e6-84f90efd33747506.js b/_next/static/chunks/adeb83e6-84f90efd33747506.js new file mode 100644 index 0000000000000000000000000000000000000000..86939a1f8fd614848f9d50f91d364d23e4ad1df8 --- /dev/null +++ b/_next/static/chunks/adeb83e6-84f90efd33747506.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[864],{24304:function(__unused_webpack_module,exports,__webpack_require__){var $jscomp=$jscomp||{};$jscomp.scope={},$jscomp.findInternal=function(e,t,r){e instanceof String&&(e=String(e));for(var n=e.length,i=0;i=n}},"es6","es3"),$jscomp.polyfill("Array.prototype.find",function(e){return e||function(e,t){return $jscomp.findInternal(this,e,t).v}},"es6","es3"),$jscomp.polyfill("String.prototype.startsWith",function(e){return e||function(e,t){var r=$jscomp.checkStringArgs(this,e,"startsWith");e+="";var n=r.length,i=e.length;t=Math.max(0,Math.min(0|t,r.length));for(var a=0;a=i}},"es6","es3"),$jscomp.polyfill("String.prototype.repeat",function(e){return e||function(e){var t=$jscomp.checkStringArgs(this,null,"repeat");if(0>e||1342177279>>=1)&&(t+=t);return r}},"es6","es3");var COMPILED=!0,goog=goog||{};goog.global=this||self,goog.exportPath_=function(e,t,r){e=e.split("."),r=r||goog.global,e[0]in r||void 0===r.execScript||r.execScript("var "+e[0]);for(var n;e.length&&(n=e.shift());)e.length||void 0===t?r=r[n]&&r[n]!==Object.prototype[n]?r[n]:r[n]={}:r[n]=t},goog.define=function(e,t){if(!COMPILED){var r=goog.global.CLOSURE_UNCOMPILED_DEFINES,n=goog.global.CLOSURE_DEFINES;r&&void 0===r.nodeType&&Object.prototype.hasOwnProperty.call(r,e)?t=r[e]:n&&void 0===n.nodeType&&Object.prototype.hasOwnProperty.call(n,e)&&(t=n[e])}return t},goog.FEATURESET_YEAR=2012,goog.DEBUG=!0,goog.LOCALE="en",goog.TRUSTED_SITE=!0,goog.STRICT_MODE_COMPATIBLE=!1,goog.DISALLOW_TEST_ONLY_CODE=COMPILED&&!goog.DEBUG,goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1,goog.provide=function(e){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");if(!COMPILED&&goog.isProvided_(e))throw Error('Namespace "'+e+'" already declared.');goog.constructNamespace_(e)},goog.constructNamespace_=function(e,t){if(!COMPILED){delete goog.implicitNamespaces_[e];for(var r=e;(r=r.substring(0,r.lastIndexOf(".")))&&!goog.getObjectByName(r);)goog.implicitNamespaces_[r]=!0}goog.exportPath_(e,t)},goog.getScriptNonce=function(e){return e&&e!=goog.global?goog.getScriptNonce_(e.document):(null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document)),goog.cspNonce_)},goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/,goog.cspNonce_=null,goog.getScriptNonce_=function(e){return(e=e.querySelector&&e.querySelector("script[nonce]"))&&(e=e.nonce||e.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(e)?e:""},goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/,goog.module=function(e){if("string"!=typeof e||!e||-1==e.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+e+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");if(goog.moduleLoaderState_.moduleName=e,!COMPILED){if(goog.isProvided_(e))throw Error('Namespace "'+e+'" already declared.');delete goog.implicitNamespaces_[e]}},goog.module.get=function(e){return goog.module.getInternal_(e)},goog.module.getInternal_=function(e){if(!COMPILED){if(e in goog.loadedModules_)return goog.loadedModules_[e].exports;if(!goog.implicitNamespaces_[e])return null!=(e=goog.getObjectByName(e))?e:null}return null},goog.ModuleType={ES6:"es6",GOOG:"goog"},goog.moduleLoaderState_=null,goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()},goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG},goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var e=goog.global.$jscomp;return!!e&&"function"==typeof e.getCurrentModulePath&&!!e.getCurrentModulePath()},goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInGoogModuleLoader_())throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");if(!COMPILED&&!goog.moduleLoaderState_.moduleName)throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");goog.moduleLoaderState_.declareLegacyNamespace=!0},goog.declareModuleId=function(e){if(!COMPILED){if(!goog.isInEs6ModuleLoader_())throw Error("goog.declareModuleId may only be called from within an ES6 module");if(goog.moduleLoaderState_&&goog.moduleLoaderState_.moduleName)throw Error("goog.declareModuleId may only be called once per module.");if(e in goog.loadedModules_)throw Error('Module with namespace "'+e+'" already exists.')}if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=e;else{var t=goog.global.$jscomp;if(!t||"function"!=typeof t.getCurrentModulePath)throw Error('Module with namespace "'+e+'" has been loaded incorrectly.');t=t.require(t.getCurrentModulePath()),goog.loadedModules_[e]={exports:t,type:goog.ModuleType.ES6,moduleId:e}}},goog.setTestOnly=function(e){if(goog.DISALLOW_TEST_ONLY_CODE)throw Error("Importing test-only code into non-debug environment"+((e=e||"")?": "+e:"."))},goog.forwardDeclare=function(e){},COMPILED||(goog.isProvided_=function(e){return e in goog.loadedModules_||!goog.implicitNamespaces_[e]&&null!=goog.getObjectByName(e)},goog.implicitNamespaces_={"goog.module":!0}),goog.getObjectByName=function(e,t){e=e.split("."),t=t||goog.global;for(var r=0;r>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(e){var t=goog.typeOf(e);if("object"==t||"array"==t){if("function"==typeof e.clone)return e.clone();for(var r in t="array"==t?[]:{},e)t[r]=goog.cloneObject(e[r]);return t}return e},goog.bindNative_=function(e,t,r){return e.call.apply(e.bind,arguments)},goog.bindJs_=function(e,t,r){if(!e)throw Error();if(2{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')}),a("es7",function(){return b("2 ** 2 == 4")}),a("es8",function(){return b("async () => 1, true")}),a("es9",function(){return b("({...rest} = {}), true")}),a("es_next",function(){return!1}),{target:c,map:d}},goog.Transpiler.prototype.needsTranspile=function(e,t){if("always"==goog.TRANSPILE)return!0;if("never"==goog.TRANSPILE)return!1;if(!this.requiresTranspilation_){var r=this.createRequiresTranspilation_();this.requiresTranspilation_=r.map,this.transpilationTarget_=this.transpilationTarget_||r.target}if(e in this.requiresTranspilation_)return!!this.requiresTranspilation_[e]||!(!goog.inHtmlDocument_()||"es6"!=t||"noModule"in goog.global.document.createElement("script"));throw Error("Unknown language mode: "+e)},goog.Transpiler.prototype.transpile=function(e,t){return goog.transpile_(e,t,this.transpilationTarget_)},goog.transpiler_=new goog.Transpiler,goog.protectScriptTag_=function(e){return e.replace(/<\/(SCRIPT)/ig,"\\x3c/$1")},goog.DebugLoader_=function(){this.dependencies_={},this.idToPath_={},this.written_={},this.loadingDeps_=[],this.depsToLoad_=[],this.paused_=!1,this.factory_=new goog.DependencyFactory(goog.transpiler_),this.deferredCallbacks_={},this.deferredQueue_=[]},goog.DebugLoader_.prototype.bootstrap=function(e,t){function r(){n&&(goog.global.setTimeout(n,0),n=null)}var n=t;if(e.length){t=[];for(var i=0;i",t.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(n):n)}else{var i=t.createElement("script");i.defer=goog.Dependency.defer_,i.async=!1,i.type="text/javascript",(n=goog.getScriptNonce())&&i.setAttribute("nonce",n),goog.DebugLoader_.IS_OLD_IE_?(e.pause(),i.onreadystatechange=function(){("loaded"==i.readyState||"complete"==i.readyState)&&(e.loaded(),e.resume())}):i.onload=function(){i.onload=null,e.loaded()},i.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path):this.path,t.head.appendChild(i)}}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),"deps.js"==this.relativePath?(goog.logToConsole_("Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true."),e.loaded()):e.pause()},goog.Es6ModuleDependency=function(e,t,r,n,i){goog.Dependency.call(this,e,t,r,n,i)},goog.inherits(goog.Es6ModuleDependency,goog.Dependency),goog.Es6ModuleDependency.prototype.load=function(e){function t(e,t){e=t?'":'',n.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(e):e)}function r(e,t){var r=n.createElement("script");r.defer=!0,r.async=!1,r.type="module",r.setAttribute("crossorigin",!0);var i=goog.getScriptNonce();i&&r.setAttribute("nonce",i),t?r.textContent=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScript(t):t:r.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(e):e,n.head.appendChild(r)}if(goog.global.CLOSURE_IMPORT_SCRIPT)goog.global.CLOSURE_IMPORT_SCRIPT(this.path)?e.loaded():e.pause();else if(goog.inHtmlDocument_()){var n=goog.global.document,i=this;if(goog.isDocumentLoading_()){var a=t;goog.Dependency.defer_=!0}else a=r;var s=goog.Dependency.registerCallback_(function(){goog.Dependency.unregisterCallback_(s),e.setModuleState(goog.ModuleType.ES6)});a(void 0,'goog.Dependency.callback_("'+s+'")'),a(this.path,void 0);var o=goog.Dependency.registerCallback_(function(t){goog.Dependency.unregisterCallback_(o),e.registerEs6ModuleExports(i.path,t,goog.moduleLoaderState_.moduleName)});a(void 0,'import * as m from "'+this.path+'"; goog.Dependency.callback_("'+o+'", m)');var l=goog.Dependency.registerCallback_(function(){goog.Dependency.unregisterCallback_(l),e.clearModuleState(),e.loaded()});a(void 0,'goog.Dependency.callback_("'+l+'")')}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),e.pause()},goog.TransformedDependency=function(e,t,r,n,i){goog.Dependency.call(this,e,t,r,n,i),this.contents_=null,this.lazyFetch_=!goog.inHtmlDocument_()||!("noModule"in goog.global.document.createElement("script"))},goog.inherits(goog.TransformedDependency,goog.Dependency),goog.TransformedDependency.prototype.load=function(e){function t(){i.contents_=goog.loadFileSync_(i.path),i.contents_&&(i.contents_=i.transform(i.contents_),i.contents_&&(i.contents_+="\n//# sourceURL="+i.path))}function r(){if(i.lazyFetch_&&t(),i.contents_){a&&e.setModuleState(goog.ModuleType.ES6);try{var r=i.contents_;if(i.contents_=null,goog.globalEval(r),a)var n=goog.moduleLoaderState_.moduleName}finally{a&&e.clearModuleState()}a&&goog.global.$jscomp.require.ensure([i.getPathName()],function(){e.registerEs6ModuleExports(i.path,goog.global.$jscomp.require(i.getPathName()),n)}),e.loaded()}}function n(){var e=goog.global.document,t=goog.Dependency.registerCallback_(function(){goog.Dependency.unregisterCallback_(t),r()}),n='";e.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(n):n)}var i=this;if(goog.global.CLOSURE_IMPORT_SCRIPT)t(),this.contents_&&goog.global.CLOSURE_IMPORT_SCRIPT("",this.contents_)?(this.contents_=null,e.loaded()):e.pause();else{var a=this.loadFlags.module==goog.ModuleType.ES6;this.lazyFetch_||t();var s=1r?Math.max(0,e.length+r):r,"string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.indexOf(t,r);for(;r(r=null==r?e.length-1:r)&&(r=Math.max(0,e.length+r)),"string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.lastIndexOf(t,r);for(;0<=r;r--)if(r in e&&e[r]===t)return r;return -1},goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(e,t,r){goog.asserts.assert(null!=e.length),Array.prototype.forEach.call(e,t,r)}:function(e,t,r){for(var n=e.length,i="string"==typeof e?e.split(""):e,a=0;a(t=goog.array.findIndex(e,t,r))?null:"string"==typeof e?e.charAt(t):e[t]},goog.array.findIndex=function(e,t,r){for(var n=e.length,i="string"==typeof e?e.split(""):e,a=0;a(t=goog.array.findIndexRight(e,t,r))?null:"string"==typeof e?e.charAt(t):e[t]},goog.array.findIndexRight=function(e,t,r){var n=e.length,i="string"==typeof e?e.split(""):e;for(--n;0<=n;n--)if(n in i&&t.call(r,i[n],n,e))return n;return -1},goog.array.contains=function(e,t){return 0<=goog.array.indexOf(e,t)},goog.array.isEmpty=function(e){return 0==e.length},goog.array.clear=function(e){if(!Array.isArray(e))for(var t=e.length-1;0<=t;t--)delete e[t];e.length=0},goog.array.insert=function(e,t){goog.array.contains(e,t)||e.push(t)},goog.array.insertAt=function(e,t,r){goog.array.splice(e,r,0,t)},goog.array.insertArrayAt=function(e,t,r){goog.partial(goog.array.splice,e,r,0).apply(null,t)},goog.array.insertBefore=function(e,t,r){var n;2==arguments.length||0>(n=goog.array.indexOf(e,r))?e.push(t):goog.array.insertAt(e,t,n)},goog.array.remove=function(e,t){var r;return(r=0<=(t=goog.array.indexOf(e,t)))&&goog.array.removeAt(e,t),r},goog.array.removeLast=function(e,t){return 0<=(t=goog.array.lastIndexOf(e,t))&&(goog.array.removeAt(e,t),!0)},goog.array.removeAt=function(e,t){return goog.asserts.assert(null!=e.length),1==Array.prototype.splice.call(e,t,1).length},goog.array.removeIf=function(e,t,r){return 0<=(t=goog.array.findIndex(e,t,r))&&(goog.array.removeAt(e,t),!0)},goog.array.removeAllIf=function(e,t,r){var n=0;return goog.array.forEachRight(e,function(i,a){t.call(r,i,a,e)&&goog.array.removeAt(e,a)&&n++}),n},goog.array.concat=function(e){return Array.prototype.concat.apply([],arguments)},goog.array.join=function(e){return Array.prototype.concat.apply([],arguments)},goog.array.toArray=function(e){var t=e.length;if(0=arguments.length?Array.prototype.slice.call(e,t):Array.prototype.slice.call(e,t,r)},goog.array.removeDuplicates=function(e,t,r){t=t||e;var n=function(e){return goog.isObject(e)?"o"+goog.getUid(e):(typeof e).charAt(0)+e};r=r||n,n={};for(var i=0,a=0;a>>1),u=r?t.call(i,e[l],l,e):t(n,e[l]);0t?1:e(r=goog.array.binarySearch(e,t,r))&&(goog.array.insertAt(e,t,-(r+1)),!0)},goog.array.binaryRemove=function(e,t,r){return 0<=(t=goog.array.binarySearch(e,t,r))&&goog.array.removeAt(e,t)},goog.array.bucket=function(e,t,r){for(var n={},i=0;ir*(a-i))return[];if(0a;e+=r)n.push(e);return n},goog.array.repeat=function(e,t){for(var r=[],n=0;nt&&Array.prototype.push.apply(e,e.splice(0,-t))),e},goog.array.moveItem=function(e,t,r){goog.asserts.assert(0<=t&&t>=8),t[r++]=i}return t},goog.crypt.byteArrayToString=function(e){if(8192>=e.length)return String.fromCharCode.apply(null,e);for(var t="",r=0;ri?t[r++]=i:(2048>i?t[r++]=i>>6|192:(55296==(64512&i)&&n+1>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return t},goog.crypt.utf8ByteArrayToString=function(e){for(var t=[],r=0,n=0;ri)t[n++]=String.fromCharCode(i);else if(191i){var a=e[r++];t[n++]=String.fromCharCode((31&i)<<6|63&a)}else if(239i){a=e[r++];var s=e[r++];i=((7&i)<<18|(63&a)<<12|(63&s)<<6|63&e[r++])-65536,t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))}else a=e[r++],s=e[r++],t[n++]=String.fromCharCode((15&i)<<12|(63&a)<<6|63&s)}return t.join("")},goog.crypt.xorByteArray=function(e,t){goog.asserts.assert(e.length==t.length,"XOR array lengths must match");for(var r=[],n=0;n"}},goog.dom.asserts.getWindow_=function(e){try{var t=e&&e.ownerDocument,r=t&&(t.defaultView||t.parentWindow);if((r=r||goog.global).Element&&r.Location)return r}catch(e){}return null},goog.functions={},goog.functions.constant=function(e){return function(){return e}},goog.functions.FALSE=function(){return!1},goog.functions.TRUE=function(){return!0},goog.functions.NULL=function(){return null},goog.functions.identity=function(e,t){return e},goog.functions.error=function(e){return function(){throw Error(e)}},goog.functions.fail=function(e){return function(){throw e}},goog.functions.lock=function(e,t){return t=t||0,function(){return e.apply(this,Array.prototype.slice.call(arguments,0,t))}},goog.functions.nth=function(e){return function(){return arguments[e]}},goog.functions.partialRight=function(e,t){var r=Array.prototype.slice.call(arguments,1);return function(){var t=Array.prototype.slice.call(arguments);return t.push.apply(t,r),e.apply(this,t)}},goog.functions.withReturnValue=function(e,t){return goog.functions.sequence(e,goog.functions.constant(t))},goog.functions.equalTo=function(e,t){return function(r){return t?e==r:e===r}},goog.functions.compose=function(e,t){var r=arguments,n=r.length;return function(){var e;n&&(e=r[n-1].apply(this,arguments));for(var t=n-2;0<=t;t--)e=r[t].call(this,e);return e}},goog.functions.sequence=function(e){var t=arguments,r=t.length;return function(){for(var e,n=0;ne?goog.i18n.bidi.Dir.RTL:t?null:goog.i18n.bidi.Dir.NEUTRAL:null==e?null:e?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.ltrChars_="A-Za-z\xc0-\xd6\xd8-\xf6\xf8-ʸ̀-֐ऀ-῿‎Ⰰ-\ud801\ud804-\ud839\ud83c-\udbff豈-﬜︀-﹯﻽-￿",goog.i18n.bidi.rtlChars_="֑-ۯۺ-ࣿ‏\ud802-\ud803\ud83a-\ud83bיִ-﷿ﹰ-ﻼ",goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g,goog.i18n.bidi.stripHtmlIfNeeded_=function(e,t){return t?e.replace(goog.i18n.bidi.htmlSkipReg_,""):e},goog.i18n.bidi.rtlCharReg_=RegExp("["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.ltrCharReg_=RegExp("["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.hasAnyRtl=function(e,t){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl,goog.i18n.bidi.hasAnyLtr=function(e,t){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.ltrRe_=RegExp("^["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlRe_=RegExp("^["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.isRtlChar=function(e){return goog.i18n.bidi.rtlRe_.test(e)},goog.i18n.bidi.isLtrChar=function(e){return goog.i18n.bidi.ltrRe_.test(e)},goog.i18n.bidi.isNeutralChar=function(e){return!goog.i18n.bidi.isLtrChar(e)&&!goog.i18n.bidi.isRtlChar(e)},goog.i18n.bidi.ltrDirCheckRe_=RegExp("^[^"+goog.i18n.bidi.rtlChars_+"]*["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlDirCheckRe_=RegExp("^[^"+goog.i18n.bidi.ltrChars_+"]*["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.startsWithRtl=function(e,t){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl,goog.i18n.bidi.startsWithLtr=function(e,t){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr,goog.i18n.bidi.isRequiredLtrRe_=/^http:\/\/.*/,goog.i18n.bidi.isNeutralText=function(e,t){return e=goog.i18n.bidi.stripHtmlIfNeeded_(e,t),goog.i18n.bidi.isRequiredLtrRe_.test(e)||!goog.i18n.bidi.hasAnyLtr(e)&&!goog.i18n.bidi.hasAnyRtl(e)},goog.i18n.bidi.ltrExitDirCheckRe_=RegExp("["+goog.i18n.bidi.ltrChars_+"][^"+goog.i18n.bidi.rtlChars_+"]*$"),goog.i18n.bidi.rtlExitDirCheckRe_=RegExp("["+goog.i18n.bidi.rtlChars_+"][^"+goog.i18n.bidi.ltrChars_+"]*$"),goog.i18n.bidi.endsWithLtr=function(e,t){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr,goog.i18n.bidi.endsWithRtl=function(e,t){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,t))},goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl,goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i,goog.i18n.bidi.isRtlLanguage=function(e){return goog.i18n.bidi.rtlLocalesRe_.test(e)},goog.i18n.bidi.bracketGuardTextRe_=/(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g,goog.i18n.bidi.guardBracketInText=function(e,t){return t=(void 0===t?goog.i18n.bidi.hasAnyRtl(e):t)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM,e.replace(goog.i18n.bidi.bracketGuardTextRe_,t+"$&"+t)},goog.i18n.bidi.enforceRtlInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=rtl"):"\n"+e+""},goog.i18n.bidi.enforceRtlInText=function(e){return goog.i18n.bidi.Format.RLE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.enforceLtrInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=ltr"):"\n"+e+""},goog.i18n.bidi.enforceLtrInText=function(e){return goog.i18n.bidi.Format.LRE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.dimensionsRe_=/:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g,goog.i18n.bidi.leftRe_=/left/gi,goog.i18n.bidi.rightRe_=/right/gi,goog.i18n.bidi.tempRe_=/%%%%/g,goog.i18n.bidi.mirrorCSS=function(e){return e.replace(goog.i18n.bidi.dimensionsRe_,":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_,"%%%%").replace(goog.i18n.bidi.rightRe_,goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_,goog.i18n.bidi.RIGHT)},goog.i18n.bidi.doubleQuoteSubstituteRe_=/([\u0591-\u05f2])"/g,goog.i18n.bidi.singleQuoteSubstituteRe_=/([\u0591-\u05f2])'/g,goog.i18n.bidi.normalizeHebrewQuote=function(e){return e.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,"$1״").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,"$1׳")},goog.i18n.bidi.wordSeparatorRe_=/\s+/,goog.i18n.bidi.hasNumeralsRe_=/[\d\u06f0-\u06f9]/,goog.i18n.bidi.rtlDetectionThreshold_=.4,goog.i18n.bidi.estimateDirection=function(e,t){var r=0,n=0,i=!1;for(e=goog.i18n.bidi.stripHtmlIfNeeded_(e,t).split(goog.i18n.bidi.wordSeparatorRe_),t=0;tgoog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.detectRtlDirectionality=function(e,t){return goog.i18n.bidi.estimateDirection(e,t)==goog.i18n.bidi.Dir.RTL},goog.i18n.bidi.setElementDirAndAlign=function(e,t){e&&(t=goog.i18n.bidi.toDir(t))&&(e.style.textAlign=t==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,e.dir=t==goog.i18n.bidi.Dir.RTL?"rtl":"ltr")},goog.i18n.bidi.setElementDirByTextDirectionality=function(e,t){switch(goog.i18n.bidi.estimateDirection(t)){case goog.i18n.bidi.Dir.LTR:e.dir="ltr";break;case goog.i18n.bidi.Dir.RTL:e.dir="rtl";break;default:e.removeAttribute("dir")}},goog.i18n.bidi.DirectionalString=function(){},goog.html.TrustedResourceUrl=function(e,t){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=e===goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_&&t||"",this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString=!0,goog.html.TrustedResourceUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString()},goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.html.TrustedResourceUrl.prototype.cloneWithParams=function(e,t){var r=goog.html.TrustedResourceUrl.unwrap(this),n=(r=goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(r))[3]||"";return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(r[1]+goog.html.TrustedResourceUrl.stringifyParams_("?",r[2]||"",e)+goog.html.TrustedResourceUrl.stringifyParams_("#",n,t))},goog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return"TrustedResourceUrl{"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+"}"}),goog.html.TrustedResourceUrl.unwrap=function(e){return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(e).toString()},goog.html.TrustedResourceUrl.unwrapTrustedScriptURL=function(e){return e instanceof goog.html.TrustedResourceUrl&&e.constructor===goog.html.TrustedResourceUrl&&e.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_:(goog.asserts.fail("expected object of type TrustedResourceUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:TrustedResourceUrl")},goog.html.TrustedResourceUrl.format=function(e,t){var r=goog.string.Const.unwrap(e);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return e=r.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,function(e,n){if(!Object.prototype.hasOwnProperty.call(t,n))throw Error('Found marker, "'+n+'", in format string, "'+r+'", but no valid label mapping found in args: '+JSON.stringify(t));return(e=t[n])instanceof goog.string.Const?goog.string.Const.unwrap(e):encodeURIComponent(String(e))}),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\w+)}/g,goog.html.TrustedResourceUrl.BASE_URL_=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,goog.html.TrustedResourceUrl.URL_PARAM_PARSER_=/^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/,goog.html.TrustedResourceUrl.formatWithParams=function(e,t,r,n){return goog.html.TrustedResourceUrl.format(e,t).cloneWithParams(r,n)},goog.html.TrustedResourceUrl.fromConstant=function(e){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.TrustedResourceUrl.fromConstants=function(e){for(var t="",r=0;re.length?"&":"")+encodeURIComponent(n)+"="+encodeURIComponent(String(s)))}}return t},goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_={},goog.string.internal={},goog.string.internal.startsWith=function(e,t){return 0==e.lastIndexOf(t,0)},goog.string.internal.endsWith=function(e,t){var r=e.length-t.length;return 0<=r&&e.indexOf(t,r)==r},goog.string.internal.caseInsensitiveStartsWith=function(e,t){return 0==goog.string.internal.caseInsensitiveCompare(t,e.substr(0,t.length))},goog.string.internal.caseInsensitiveEndsWith=function(e,t){return 0==goog.string.internal.caseInsensitiveCompare(t,e.substr(e.length-t.length,t.length))},goog.string.internal.caseInsensitiveEquals=function(e,t){return e.toLowerCase()==t.toLowerCase()},goog.string.internal.isEmptyOrWhitespace=function(e){return/^[\s\xa0]*$/.test(e)},goog.string.internal.trim=goog.TRUSTED_SITE&&String.prototype.trim?function(e){return e.trim()}:function(e){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(e)[1]},goog.string.internal.caseInsensitiveCompare=function(e,t){return(e=String(e).toLowerCase())<(t=String(t).toLowerCase())?-1:e==t?0:1},goog.string.internal.newLineToBr=function(e,t){return e.replace(/(\r\n|\r|\n)/g,t?"
    ":"
    ")},goog.string.internal.htmlEscape=function(e,t){if(t)e=e.replace(goog.string.internal.AMP_RE_,"&").replace(goog.string.internal.LT_RE_,"<").replace(goog.string.internal.GT_RE_,">").replace(goog.string.internal.QUOT_RE_,""").replace(goog.string.internal.SINGLE_QUOTE_RE_,"'").replace(goog.string.internal.NULL_RE_,"�");else{if(!goog.string.internal.ALL_RE_.test(e))return e;-1!=e.indexOf("&")&&(e=e.replace(goog.string.internal.AMP_RE_,"&")),-1!=e.indexOf("<")&&(e=e.replace(goog.string.internal.LT_RE_,"<")),-1!=e.indexOf(">")&&(e=e.replace(goog.string.internal.GT_RE_,">")),-1!=e.indexOf('"')&&(e=e.replace(goog.string.internal.QUOT_RE_,""")),-1!=e.indexOf("'")&&(e=e.replace(goog.string.internal.SINGLE_QUOTE_RE_,"'")),-1!=e.indexOf("\0")&&(e=e.replace(goog.string.internal.NULL_RE_,"�"))}return e},goog.string.internal.AMP_RE_=/&/g,goog.string.internal.LT_RE_=//g,goog.string.internal.QUOT_RE_=/"/g,goog.string.internal.SINGLE_QUOTE_RE_=/'/g,goog.string.internal.NULL_RE_=/\x00/g,goog.string.internal.ALL_RE_=/[\x00&<>"']/,goog.string.internal.whitespaceEscape=function(e,t){return goog.string.internal.newLineToBr(e.replace(/ /g,"  "),t)},goog.string.internal.contains=function(e,t){return -1!=e.indexOf(t)},goog.string.internal.caseInsensitiveContains=function(e,t){return goog.string.internal.contains(e.toLowerCase(),t.toLowerCase())},goog.string.internal.compareVersions=function(e,t){var r=0;e=goog.string.internal.trim(String(e)).split("."),t=goog.string.internal.trim(String(t)).split(".");for(var n=Math.max(e.length,t.length),i=0;0==r&&it?1:0},goog.html.SafeUrl=function(e,t){this.privateDoNotAccessOrElseSafeUrlWrappedValue_=e===goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_&&t||"",this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeUrl.INNOCUOUS_STRING="about:invalid#zClosurez",goog.html.SafeUrl.prototype.implementsGoogStringTypedString=!0,goog.html.SafeUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()},goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.SafeUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.DEBUG&&(goog.html.SafeUrl.prototype.toString=function(){return"SafeUrl{"+this.privateDoNotAccessOrElseSafeUrlWrappedValue_+"}"}),goog.html.SafeUrl.unwrap=function(e){return e instanceof goog.html.SafeUrl&&e.constructor===goog.html.SafeUrl&&e.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeUrlWrappedValue_:(goog.asserts.fail("expected object of type SafeUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeUrl")},goog.html.SafeUrl.fromConstant=function(e){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i,goog.html.SafeUrl.isSafeMimeType=function(e){return goog.html.SAFE_MIME_TYPE_PATTERN_.test(e)},goog.html.SafeUrl.fromBlob=function(e){return e=goog.html.SafeUrl.isSafeMimeType(e.type)?goog.fs.url.createObjectUrl(e):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromMediaSource=function(e){return goog.asserts.assert("MediaSource"in goog.global,"No support for MediaSource"),e=e instanceof MediaSource?goog.fs.url.createObjectUrl(e):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.DATA_URL_PATTERN_=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,goog.html.SafeUrl.fromDataUrl=function(e){var t=(e=e.replace(/(%0A|%0D)/g,"")).match(goog.html.DATA_URL_PATTERN_);return t=t&&goog.html.SafeUrl.isSafeMimeType(t[1]),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t?e:goog.html.SafeUrl.INNOCUOUS_STRING)},goog.html.SafeUrl.fromTelUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"tel:")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SIP_URL_PATTERN_=/^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i,goog.html.SafeUrl.fromSipUrl=function(e){return goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(e))||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromFacebookMessengerUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"fb-messenger://share")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromWhatsAppUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"whatsapp://send")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromSmsUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"sms:")&&goog.html.SafeUrl.isSmsUrlBodyValid_(e)||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.isSmsUrlBodyValid_=function(e){var t=e.indexOf("#");if(0+~[\]()=^$|]+$/.test(r))throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: "+e);if(!goog.html.SafeStyleSheet.hasBalancedBrackets_(r))throw Error("() and [] in selector must be balanced, got: "+e);return t instanceof goog.html.SafeStyle||(t=goog.html.SafeStyle.create(t)),e=e+"{"+goog.html.SafeStyle.unwrap(t).replace(/",null)},goog.html.SafeHtml.VALID_NAMES_IN_TAG_=/^[a-zA-Z0-9-]+$/,goog.html.SafeHtml.URL_ATTRIBUTES_={action:!0,cite:!0,data:!0,formaction:!0,href:!0,manifest:!0,poster:!0,src:!0},goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_={APPLET:!0,BASE:!0,EMBED:!0,IFRAME:!0,LINK:!0,MATH:!0,META:!0,OBJECT:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0},goog.html.SafeHtml.create=function(e,t,r){return goog.html.SafeHtml.verifyTagName(String(e)),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(String(e),t,r)},goog.html.SafeHtml.verifyTagName=function(e){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(e))throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"Invalid tag name <"+e+">.":"");if(e.toUpperCase() in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"Tag name <"+e+"> is not allowed for SafeHtml.":"")},goog.html.SafeHtml.createIframe=function(e,t,r,n){e&&goog.html.TrustedResourceUrl.unwrap(e);var i={};return i.src=e||null,i.srcdoc=t&&goog.html.SafeHtml.unwrap(t),e=goog.html.SafeHtml.combineAttributes(i,{sandbox:""},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,n)},goog.html.SafeHtml.createSandboxIframe=function(e,t,r,n){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"The browser does not support sandboxed iframes.":"");var i={};return i.src=e?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(e)):null,i.srcdoc=t||null,i.sandbox="",e=goog.html.SafeHtml.combineAttributes(i,{},r),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,n)},goog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&"sandbox"in goog.global.HTMLIFrameElement.prototype},goog.html.SafeHtml.createScriptSrc=function(e,t){return goog.html.TrustedResourceUrl.unwrap(e),e=goog.html.SafeHtml.combineAttributes({src:e},{},t),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",e)},goog.html.SafeHtml.createScript=function(e,t){for(var r in t){var n=r.toLowerCase();if("language"==n||"src"==n||"text"==n||"type"==n)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot set "'+n+'" attribute':"")}for(n=0,r="",e=goog.array.concat(e);n does not allow content."),i+=">"):(n=goog.html.SafeHtml.concat(r),i+=">"+goog.html.SafeHtml.unwrap(n)+"",n=n.getDirection()),(e=t&&t.dir)&&(n=/^(ltr|rtl|auto)$/i.test(e)?goog.i18n.bidi.Dir.NEUTRAL:null),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(i,n)},goog.html.SafeHtml.stringifyAttributes=function(e,t){var r="";if(t)for(var n in t){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(n))throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Invalid attribute name "'+n+'".':"");var i=t[n];null!=i&&(r+=" "+goog.html.SafeHtml.getAttrNameAndValue_(e,n,i))}return r},goog.html.SafeHtml.combineAttributes=function(e,t,r){var n,i={};for(n in e)goog.asserts.assert(n.toLowerCase()==n,"Must be lower case"),i[n]=e[n];for(n in t)goog.asserts.assert(n.toLowerCase()==n,"Must be lower case"),i[n]=t[n];if(r)for(n in r){var a=n.toLowerCase();if(a in e)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot override "'+a+'" attribute, got "'+n+'" with value "'+r[n]+'"':"");a in t&&delete i[a],i[n]=r[n]}return i},goog.html.SafeHtml.DOCTYPE_HTML=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.EMPTY=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.BR=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("
    ",goog.i18n.bidi.Dir.NEUTRAL),goog.html.uncheckedconversions={},goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract=function(e,t,r){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(t,r||null)},goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(t)},goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract=function(e,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(t)},goog.dom.safe={},goog.dom.safe.InsertAdjacentHtmlPosition={AFTERBEGIN:"afterbegin",AFTEREND:"afterend",BEFOREBEGIN:"beforebegin",BEFOREEND:"beforeend"},goog.dom.safe.insertAdjacentHtml=function(e,t,r){e.insertAdjacentHTML(t,goog.html.SafeHtml.unwrapTrustedHTML(r))},goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_={MATH:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0},goog.dom.safe.isInnerHtmlCleanupRecursive_=goog.functions.cacheReturnValue(function(){if(goog.DEBUG&&"undefined"==typeof document)return!1;var e=document.createElement("div"),t=document.createElement("div");return t.appendChild(document.createElement("div")),e.appendChild(t),(!goog.DEBUG||!!e.firstChild)&&(t=e.firstChild.firstChild,e.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY),!t.parentElement)}),goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse=function(e,t){if(goog.dom.safe.isInnerHtmlCleanupRecursive_())for(;e.lastChild;)e.removeChild(e.lastChild);e.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setInnerHtml=function(e,t){if(goog.asserts.ENABLE_ASSERTS){var r=e.tagName.toUpperCase();if(goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[r])throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of "+e.tagName+".")}goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(e,t)},goog.dom.safe.setOuterHtml=function(e,t){e.outerHTML=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setFormElementAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLFormElement(e).action=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setButtonFormAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLButtonElement(e).formAction=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setInputFormAction=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),goog.dom.asserts.assertIsHTMLInputElement(e).formAction=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setStyle=function(e,t){e.style.cssText=goog.html.SafeStyle.unwrap(t)},goog.dom.safe.documentWrite=function(e,t){e.write(goog.html.SafeHtml.unwrapTrustedHTML(t))},goog.dom.safe.setAnchorHref=function(e,t){goog.dom.asserts.assertIsHTMLAnchorElement(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setImageSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLImageElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:image\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setAudioSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLAudioElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:audio\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setVideoSrc=function(e,t){if(goog.dom.asserts.assertIsHTMLVideoElement(e),!(t instanceof goog.html.SafeUrl)){var r=/^data:video\//i.test(t);t=goog.html.SafeUrl.sanitizeAssertUnchanged(t,r)}e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setEmbedSrc=function(e,t){goog.dom.asserts.assertIsHTMLEmbedElement(e),e.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t)},goog.dom.safe.setFrameSrc=function(e,t){goog.dom.asserts.assertIsHTMLFrameElement(e),e.src=goog.html.TrustedResourceUrl.unwrap(t)},goog.dom.safe.setIframeSrc=function(e,t){goog.dom.asserts.assertIsHTMLIFrameElement(e),e.src=goog.html.TrustedResourceUrl.unwrap(t)},goog.dom.safe.setIframeSrcdoc=function(e,t){goog.dom.asserts.assertIsHTMLIFrameElement(e),e.srcdoc=goog.html.SafeHtml.unwrapTrustedHTML(t)},goog.dom.safe.setLinkHrefAndRel=function(e,t,r){goog.dom.asserts.assertIsHTMLLinkElement(e),e.rel=r,goog.string.internal.caseInsensitiveContains(r,"stylesheet")?(goog.asserts.assert(t instanceof goog.html.TrustedResourceUrl,'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),e.href=goog.html.TrustedResourceUrl.unwrap(t)):e.href=t instanceof goog.html.TrustedResourceUrl?goog.html.TrustedResourceUrl.unwrap(t):t instanceof goog.html.SafeUrl?goog.html.SafeUrl.unwrap(t):goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitizeAssertUnchanged(t))},goog.dom.safe.setObjectData=function(e,t){goog.dom.asserts.assertIsHTMLObjectElement(e),e.data=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t)},goog.dom.safe.setScriptSrc=function(e,t){goog.dom.asserts.assertIsHTMLScriptElement(e),e.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(t),(t=goog.getScriptNonce())&&e.setAttribute("nonce",t)},goog.dom.safe.setScriptContent=function(e,t){goog.dom.asserts.assertIsHTMLScriptElement(e),e.text=goog.html.SafeScript.unwrapTrustedScript(t),(t=goog.getScriptNonce())&&e.setAttribute("nonce",t)},goog.dom.safe.setLocationHref=function(e,t){goog.dom.asserts.assertIsLocation(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.assignLocation=function(e,t){goog.dom.asserts.assertIsLocation(e),t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.assign(goog.html.SafeUrl.unwrap(t))},goog.dom.safe.replaceLocation=function(e,t){t=t instanceof goog.html.SafeUrl?t:goog.html.SafeUrl.sanitizeAssertUnchanged(t),e.replace(goog.html.SafeUrl.unwrap(t))},goog.dom.safe.openInWindow=function(e,t,r,n,i){return e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitizeAssertUnchanged(e),t=t||goog.global,r=r instanceof goog.string.Const?goog.string.Const.unwrap(r):r||"",t.open(goog.html.SafeUrl.unwrap(e),r,n,i)},goog.dom.safe.parseFromStringHtml=function(e,t){return goog.dom.safe.parseFromString(e,t,"text/html")},goog.dom.safe.parseFromString=function(e,t,r){return e.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(t),r)},goog.dom.safe.createImageFromBlob=function(e){if(!/^image\/.*/g.test(e.type))throw Error("goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.");var t=goog.global.URL.createObjectURL(e);return(e=new goog.global.Image).onload=function(){goog.global.URL.revokeObjectURL(t)},goog.dom.safe.setImageSrc(e,goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Image blob URL."),t)),e},goog.string.DETECT_DOUBLE_ESCAPING=!1,goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1,goog.string.Unicode={NBSP:"\xa0"},goog.string.startsWith=goog.string.internal.startsWith,goog.string.endsWith=goog.string.internal.endsWith,goog.string.caseInsensitiveStartsWith=goog.string.internal.caseInsensitiveStartsWith,goog.string.caseInsensitiveEndsWith=goog.string.internal.caseInsensitiveEndsWith,goog.string.caseInsensitiveEquals=goog.string.internal.caseInsensitiveEquals,goog.string.subs=function(e,t){for(var r=e.split("%s"),n="",i=Array.prototype.slice.call(arguments,1);i.length&&1=e||"\x80"<=e&&"�">=e},goog.string.stripNewlines=function(e){return e.replace(/(\r\n|\r|\n)+/g," ")},goog.string.canonicalizeNewlines=function(e){return e.replace(/(\r\n|\r|\n)/g,"\n")},goog.string.normalizeWhitespace=function(e){return e.replace(/\xa0|\s/g," ")},goog.string.normalizeSpaces=function(e){return e.replace(/\xa0|[ \t]+/g," ")},goog.string.collapseBreakingSpaces=function(e){return e.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")},goog.string.trim=goog.string.internal.trim,goog.string.trimLeft=function(e){return e.replace(/^[\s\xa0]+/,"")},goog.string.trimRight=function(e){return e.replace(/[\s\xa0]+$/,"")},goog.string.caseInsensitiveCompare=goog.string.internal.caseInsensitiveCompare,goog.string.numberAwareCompare_=function(e,t,r){if(e==t)return 0;if(!e)return -1;if(!t)return 1;for(var n=e.toLowerCase().match(r),i=t.toLowerCase().match(r),a=Math.min(n.length,i.length),s=0;s",""":'"'},n=t?t.createElement("div"):goog.global.document.createElement("div");return e.replace(goog.string.HTML_ENTITY_PATTERN_,function(e,t){var i=r[e];return i||("#"==t.charAt(0)&&(isNaN(t=Number("0"+t.substr(1)))||(i=String.fromCharCode(t))),i||(goog.dom.safe.setInnerHtml(n,goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."),e+" ")),i=n.firstChild.nodeValue.slice(0,-1)),r[e]=i)})},goog.string.unescapePureXmlEntities_=function(e){return e.replace(/&([^;]+);/g,function(e,t){switch(t){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';default:return"#"!=t.charAt(0)||isNaN(t=Number("0"+t.substr(1)))?e:String.fromCharCode(t)}})},goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g,goog.string.whitespaceEscape=function(e,t){return goog.string.newLineToBr(e.replace(/ /g,"  "),t)},goog.string.preserveSpaces=function(e){return e.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP)},goog.string.stripQuotes=function(e,t){for(var r=t.length,n=0;nt&&(e=e.substring(0,t-3)+"..."),r&&(e=goog.string.htmlEscape(e)),e},goog.string.truncateMiddle=function(e,t,r,n){if(r&&(e=goog.string.unescapeEntities(e)),n&&e.length>t){n>t&&(n=t);var i=e.length-n;e=e.substring(0,t-n)+"..."+e.substring(i)}else e.length>t&&(n=Math.floor(t/2),i=e.length-n,e=e.substring(0,n+t%2)+"..."+e.substring(i));return r&&(e=goog.string.htmlEscape(e)),e},goog.string.specialEscapeChars_={"\0":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"},goog.string.jsEscapeCache_={"'":"\\'"},goog.string.quote=function(e){e=String(e);for(var t=['"'],r=0;ri?n:goog.string.escapeChar(n))}return t.push('"'),t.join("")},goog.string.escapeString=function(e){for(var t=[],r=0;rt)var r=e;else 256>t?(r="\\x",(16>t||256t&&(r+="0")),r+=t.toString(16).toUpperCase();return goog.string.jsEscapeCache_[e]=r},goog.string.contains=goog.string.internal.contains,goog.string.caseInsensitiveContains=goog.string.internal.caseInsensitiveContains,goog.string.countOf=function(e,t){return e&&t?e.split(t).length-1:0},goog.string.removeAt=function(e,t,r){var n=e;return 0<=t&&t>>0;return t},goog.string.uniqueStringCounter_=2147483648*Math.random()|0,goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++},goog.string.toNumber=function(e){var t=Number(e);return 0==t&&goog.string.isEmptyOrWhitespace(e)?NaN:t},goog.string.isLowerCamelCase=function(e){return/^[a-z]+([A-Z][a-z]*)*$/.test(e)},goog.string.isUpperCamelCase=function(e){return/^([A-Z][a-z]*)+$/.test(e)},goog.string.toCamelCase=function(e){return String(e).replace(/\-([a-z])/g,function(e,t){return t.toUpperCase()})},goog.string.toSelectorCase=function(e){return String(e).replace(/([A-Z])/g,"-$1").toLowerCase()},goog.string.toTitleCase=function(e,t){return t="string"==typeof t?goog.string.regExpEscape(t):"\\s",e.replace(RegExp("(^"+(t?"|["+t+"]+":"")+")([a-z])","g"),function(e,t,r){return t+r.toUpperCase()})},goog.string.capitalize=function(e){return String(e.charAt(0)).toUpperCase()+String(e.substr(1)).toLowerCase()},goog.string.parseInt=function(e){return isFinite(e)&&(e=String(e)),"string"==typeof e?/^\s*-?0x/i.test(e)?parseInt(e,16):parseInt(e,10):NaN},goog.string.splitLimit=function(e,t,r){e=e.split(t);for(var n=[];0r&&(r=i)}return -1==r?e:e.slice(r+1)},goog.string.editDistance=function(e,t){var r=[],n=[];if(e==t)return 0;if(!e.length||!t.length)return Math.max(e.length,t.length);for(var i=0;iparseFloat(e)?String(t):e},goog.userAgent.getVersionRegexResult_=function(){var e=goog.userAgent.getUserAgentString();return goog.userAgent.GECKO?/rv:([^\);]+)(\)|;)/.exec(e):goog.userAgent.EDGE?/Edge\/([\d\.]+)/.exec(e):goog.userAgent.IE?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):goog.userAgent.WEBKIT?/WebKit\/(\S+)/.exec(e):goog.userAgent.OPERA?/(?:Version)[ \/]?(\S+)/.exec(e):void 0},goog.userAgent.getDocumentMode_=function(){var e=goog.global.document;return e?e.documentMode:void 0},goog.userAgent.VERSION=goog.userAgent.determineVersion_(),goog.userAgent.compare=function(e,t){return goog.string.compareVersions(e,t)},goog.userAgent.isVersionOrHigherCache_={},goog.userAgent.isVersionOrHigher=function(e){return goog.userAgent.ASSUME_ANY_VERSION||goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_,e,function(){return 0<=goog.string.compareVersions(goog.userAgent.VERSION,e)})},goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher,goog.userAgent.isDocumentModeOrHigher=function(e){return Number(goog.userAgent.DOCUMENT_MODE)>=e},goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher,goog.userAgent.DOCUMENT_MODE=function(){if(goog.global.document&&goog.userAgent.IE)return goog.userAgent.getDocumentMode_()||parseInt(goog.userAgent.VERSION,10)||void 0}(),goog.userAgent.product={},goog.userAgent.product.ASSUME_FIREFOX=!1,goog.userAgent.product.ASSUME_IPHONE=!1,goog.userAgent.product.ASSUME_IPAD=!1,goog.userAgent.product.ASSUME_ANDROID=!1,goog.userAgent.product.ASSUME_CHROME=!1,goog.userAgent.product.ASSUME_SAFARI=!1,goog.userAgent.product.PRODUCT_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_OPERA||goog.userAgent.product.ASSUME_FIREFOX||goog.userAgent.product.ASSUME_IPHONE||goog.userAgent.product.ASSUME_IPAD||goog.userAgent.product.ASSUME_ANDROID||goog.userAgent.product.ASSUME_CHROME||goog.userAgent.product.ASSUME_SAFARI,goog.userAgent.product.OPERA=goog.userAgent.OPERA,goog.userAgent.product.IE=goog.userAgent.IE,goog.userAgent.product.EDGE=goog.userAgent.EDGE,goog.userAgent.product.FIREFOX=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_FIREFOX:goog.labs.userAgent.browser.isFirefox(),goog.userAgent.product.isIphoneOrIpod_=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpod()},goog.userAgent.product.IPHONE=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPHONE:goog.userAgent.product.isIphoneOrIpod_(),goog.userAgent.product.IPAD=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad(),goog.userAgent.product.ANDROID=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_ANDROID:goog.labs.userAgent.browser.isAndroidBrowser(),goog.userAgent.product.CHROME=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_CHROME:goog.labs.userAgent.browser.isChrome(),goog.userAgent.product.isSafariDesktop_=function(){return goog.labs.userAgent.browser.isSafari()&&!goog.labs.userAgent.platform.isIos()},goog.userAgent.product.SAFARI=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_SAFARI:goog.userAgent.product.isSafariDesktop_(),goog.crypt.base64={},goog.crypt.base64.DEFAULT_ALPHABET_COMMON_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",goog.crypt.base64.ENCODED_VALS=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"+/=",goog.crypt.base64.ENCODED_VALS_WEBSAFE=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"-_.",goog.crypt.base64.Alphabet={DEFAULT:0,NO_PADDING:1,WEBSAFE:2,WEBSAFE_DOT_PADDING:3,WEBSAFE_NO_PADDING:4},goog.crypt.base64.paddingChars_="=.",goog.crypt.base64.isPadding_=function(e){return goog.string.contains(goog.crypt.base64.paddingChars_,e)},goog.crypt.base64.byteToCharMaps_={},goog.crypt.base64.charToByteMap_=null,goog.crypt.base64.ASSUME_NATIVE_SUPPORT_=goog.userAgent.GECKO||goog.userAgent.WEBKIT&&!goog.userAgent.product.SAFARI||goog.userAgent.OPERA,goog.crypt.base64.HAS_NATIVE_ENCODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||"function"==typeof goog.global.btoa,goog.crypt.base64.HAS_NATIVE_DECODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||!goog.userAgent.product.SAFARI&&!goog.userAgent.IE&&"function"==typeof goog.global.atob,goog.crypt.base64.encodeByteArray=function(e,t){goog.asserts.assert(goog.isArrayLike(e),"encodeByteArray takes an array as a parameter"),void 0===t&&(t=goog.crypt.base64.Alphabet.DEFAULT),goog.crypt.base64.init_(),t=goog.crypt.base64.byteToCharMaps_[t];for(var r=[],n=0;n>2;i=(3&i)<<4|s>>4,s=(15&s)<<2|l>>6,l&=63,o||(l=64,a||(s=64)),r.push(t[u],t[i],t[s]||"",t[l]||"")}return r.join("")},goog.crypt.base64.encodeString=function(e,t){return goog.crypt.base64.HAS_NATIVE_ENCODE_&&!t?goog.global.btoa(e):goog.crypt.base64.encodeByteArray(goog.crypt.stringToByteArray(e),t)},goog.crypt.base64.decodeString=function(e,t){if(goog.crypt.base64.HAS_NATIVE_DECODE_&&!t)return goog.global.atob(e);var r="";return goog.crypt.base64.decodeStringInternal_(e,function(e){r+=String.fromCharCode(e)}),r},goog.crypt.base64.decodeStringToByteArray=function(e,t){var r=[];return goog.crypt.base64.decodeStringInternal_(e,function(e){r.push(e)}),r},goog.crypt.base64.decodeStringToUint8Array=function(e){goog.asserts.assert(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10"),"Browser does not support typed arrays");var t=e.length,r=3*t/4;r%3?r=Math.floor(r):goog.crypt.base64.isPadding_(e[t-1])&&(r=goog.crypt.base64.isPadding_(e[t-2])?r-2:r-1);var n=new Uint8Array(r),i=0;return goog.crypt.base64.decodeStringInternal_(e,function(e){n[i++]=e}),n.subarray(0,i)},goog.crypt.base64.decodeStringInternal_=function(e,t){function r(t){for(;n>4),64!=s&&(t(a<<4&240|s>>2),64!=o&&t(s<<6&192|o))}},goog.crypt.base64.init_=function(){if(!goog.crypt.base64.charToByteMap_){goog.crypt.base64.charToByteMap_={};for(var e=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_.split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var n=e.concat(t[r].split(""));goog.crypt.base64.byteToCharMaps_[r]=n;for(var i=0;i>>0;e=Math.floor((e-t)/jspb.BinaryConstants.TWO_TO_32)>>>0,jspb.utils.split64Low=t,jspb.utils.split64High=e},jspb.utils.splitInt64=function(e){var t=0>e,r=(e=Math.abs(e))>>>0;e=Math.floor((e-r)/jspb.BinaryConstants.TWO_TO_32)>>>0,t&&(e=~e>>>0,4294967295<(r=(~r>>>0)+1)&&(r=0,4294967295<++e&&(e=0))),jspb.utils.split64Low=r,jspb.utils.split64High=e},jspb.utils.splitZigzag64=function(e){var t=0>e;e=2*Math.abs(e),jspb.utils.splitUint64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;t&&(0==e?0==r?r=e=4294967295:(r--,e=4294967295):e--),jspb.utils.split64Low=e,jspb.utils.split64High=r},jspb.utils.splitFloat32=function(e){var t=0>e?1:0;if(0===(e=t?-e:e))0<1/e?(jspb.utils.split64High=0,jspb.utils.split64Low=0):(jspb.utils.split64High=0,jspb.utils.split64Low=2147483648);else if(isNaN(e))jspb.utils.split64High=0,jspb.utils.split64Low=2147483647;else if(e>jspb.BinaryConstants.FLOAT32_MAX)jspb.utils.split64High=0,jspb.utils.split64Low=(t<<31|2139095040)>>>0;else if(e>>0;else{var r=Math.floor(Math.log(e)/Math.LN2);e*=Math.pow(2,-r),16777216<=(e=Math.round(e*jspb.BinaryConstants.TWO_TO_23))&&++r,jspb.utils.split64High=0,jspb.utils.split64Low=(t<<31|r+127<<23|8388607&e)>>>0}},jspb.utils.splitFloat64=function(e){var t=0>e?1:0;if(0===(e=t?-e:e))jspb.utils.split64High=0<1/e?0:2147483648,jspb.utils.split64Low=0;else if(isNaN(e))jspb.utils.split64High=2147483647,jspb.utils.split64Low=4294967295;else if(e>jspb.BinaryConstants.FLOAT64_MAX)jspb.utils.split64High=(t<<31|2146435072)>>>0,jspb.utils.split64Low=0;else if(e>>0,jspb.utils.split64Low=r>>>0}else{var n=0;if(2<=(r=e))for(;2<=r&&1023>n;)n++,r/=2;else for(;1>r&&-1022>>0,jspb.utils.split64High=(t<<31|n+1023<<20|e)>>>0,jspb.utils.split64Low=r}},jspb.utils.splitHash64=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),a=e.charCodeAt(4),s=e.charCodeAt(5),o=e.charCodeAt(6);e=e.charCodeAt(7),jspb.utils.split64Low=t+(r<<8)+(n<<16)+(i<<24)>>>0,jspb.utils.split64High=a+(s<<8)+(o<<16)+(e<<24)>>>0},jspb.utils.joinUint64=function(e,t){return t*jspb.BinaryConstants.TWO_TO_32+(e>>>0)},jspb.utils.joinInt64=function(e,t){var r=2147483648&t;return r&&(t=~t>>>0,0==(e=~e+1>>>0)&&(t=t+1>>>0)),e=jspb.utils.joinUint64(e,t),r?-e:e},jspb.utils.toZigzag64=function(e,t,r){var n=t>>31;return r(e<<1^n,(t<<1|e>>>31)^n)},jspb.utils.joinZigzag64=function(e,t){return jspb.utils.fromZigzag64(e,t,jspb.utils.joinInt64)},jspb.utils.fromZigzag64=function(e,t,r){var n=-(1&e);return r((e>>>1|t<<31)^n,t>>>1^n)},jspb.utils.joinFloat32=function(e,t){t=2*(e>>31)+1;var r=e>>>23&255;return e&=8388607,255==r?e?NaN:1/0*t:0==r?1401298464324817e-60*t*e:t*Math.pow(2,r-150)*(e+8388608)},jspb.utils.joinFloat64=function(e,t){var r=2*(t>>31)+1,n=t>>>20&2047;return e=jspb.BinaryConstants.TWO_TO_32*(1048575&t)+e,2047==n?e?NaN:1/0*r:0==n?5e-324*r*e:r*Math.pow(2,n-1075)*(e+jspb.BinaryConstants.TWO_TO_52)},jspb.utils.joinHash64=function(e,t){return String.fromCharCode(e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255,t>>>0&255,t>>>8&255,t>>>16&255,t>>>24&255)},jspb.utils.DIGITS="0123456789abcdef".split(""),jspb.utils.ZERO_CHAR_CODE_=48,jspb.utils.A_CHAR_CODE_=97,jspb.utils.joinUnsignedDecimalString=function(e,t){function r(e,t){return e=e?String(e):"",t?"0000000".slice(e.length)+e:e}if(2097151>=t)return""+jspb.utils.joinUint64(e,t);var n=(e>>>24|t<<8)>>>0&16777215;return e=(16777215&e)+6777216*n+6710656*(t=t>>16&65535),n+=8147497*t,t*=2,1e7<=e&&(n+=Math.floor(e/1e7),e%=1e7),1e7<=n&&(t+=Math.floor(n/1e7),n%=1e7),r(t,0)+r(n,t)+r(e,1)},jspb.utils.joinSignedDecimalString=function(e,t){var r=2147483648&t;return r&&(t=~t+(0==(e=~e+1>>>0)?1:0)>>>0),e=jspb.utils.joinUnsignedDecimalString(e,t),r?"-"+e:e},jspb.utils.hash64ToDecimalString=function(e,t){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;return t?jspb.utils.joinSignedDecimalString(e,r):jspb.utils.joinUnsignedDecimalString(e,r)},jspb.utils.hash64ArrayToDecimalStrings=function(e,t){for(var r=Array(e.length),n=0;nr&&(1!==e||0>>=8}function r(){for(var e=0;8>e;e++)i[e]=255&~i[e]}jspb.asserts.assert(0e?jspb.utils.ZERO_CHAR_CODE_+e:jspb.utils.A_CHAR_CODE_-10+e)},jspb.utils.fromHexCharCode_=function(e){return e>=jspb.utils.A_CHAR_CODE_?e-jspb.utils.A_CHAR_CODE_+10:e-jspb.utils.ZERO_CHAR_CODE_},jspb.utils.hash64ToHexString=function(e){var t=Array(18);t[0]="0",t[1]="x";for(var r=0;8>r;r++){var n=e.charCodeAt(7-r);t[2*r+2]=jspb.utils.toHexDigit_(n>>4),t[2*r+3]=jspb.utils.toHexDigit_(15&n)}return t.join("")},jspb.utils.hexStringToHash64=function(e){e=e.toLowerCase(),jspb.asserts.assert(18==e.length),jspb.asserts.assert("0"==e[0]),jspb.asserts.assert("x"==e[1]);for(var t="",r=0;8>r;r++)t=String.fromCharCode(16*jspb.utils.fromHexCharCode_(e.charCodeAt(2*r+2))+jspb.utils.fromHexCharCode_(e.charCodeAt(2*r+3)))+t;return t},jspb.utils.hash64ToNumber=function(e,t){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;return t?jspb.utils.joinInt64(e,r):jspb.utils.joinUint64(e,r)},jspb.utils.numberToHash64=function(e){return jspb.utils.splitInt64(e),jspb.utils.joinHash64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.utils.countVarints=function(e,t,r){for(var n=0,i=t;i>7;return r-t-n},jspb.utils.countVarintFields=function(e,t,r,n){var i=0;if(128>(n=8*n+jspb.BinaryConstants.WireType.VARINT))for(;t>=7}if(e[t++]!=a)break;for(i++;0!=(128&(a=e[t++])););}return i},jspb.utils.countFixedFields_=function(e,t,r,n,i){var a=0;if(128>n)for(;t>=7}if(e[t++]!=s)break;a++,t+=i}return a},jspb.utils.countFixed32Fields=function(e,t,r,n){return jspb.utils.countFixedFields_(e,t,r,8*n+jspb.BinaryConstants.WireType.FIXED32,4)},jspb.utils.countFixed64Fields=function(e,t,r,n){return jspb.utils.countFixedFields_(e,t,r,8*n+jspb.BinaryConstants.WireType.FIXED64,8)},jspb.utils.countDelimitedFields=function(e,t,r,n){var i=0;for(n=8*n+jspb.BinaryConstants.WireType.DELIMITED;t>=7}if(e[t++]!=a)break;i++;for(var s=0,o=1;s+=(127&(a=e[t++]))*o,o*=128,0!=(128&a););t+=s}return i},jspb.utils.debugBytesToTextFormat=function(e){var t='"';if(e){e=jspb.utils.byteSourceToUint8Array(e);for(var r=0;re[r]&&(t+="0"),t+=e[r].toString(16)}return t+'"'},jspb.utils.debugScalarToTextFormat=function(e){return"string"==typeof e?goog.string.quote(e):e.toString()},jspb.utils.stringToByteArray=function(e){for(var t=new Uint8Array(e.length),r=0;rjspb.BinaryDecoder.instanceCache_.length&&jspb.BinaryDecoder.instanceCache_.push(this)},jspb.BinaryDecoder.prototype.clone=function(){return jspb.BinaryDecoder.alloc(this.bytes_,this.start_,this.end_-this.start_)},jspb.BinaryDecoder.prototype.clear=function(){this.bytes_=null,this.cursor_=this.end_=this.start_=0,this.error_=!1},jspb.BinaryDecoder.prototype.getBuffer=function(){return this.bytes_},jspb.BinaryDecoder.prototype.setBlock=function(e,t,r){this.bytes_=jspb.utils.byteSourceToUint8Array(e),this.start_=void 0!==t?t:0,this.end_=void 0!==r?this.start_+r:this.bytes_.length,this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getEnd=function(){return this.end_},jspb.BinaryDecoder.prototype.setEnd=function(e){this.end_=e},jspb.BinaryDecoder.prototype.reset=function(){this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getCursor=function(){return this.cursor_},jspb.BinaryDecoder.prototype.setCursor=function(e){this.cursor_=e},jspb.BinaryDecoder.prototype.advance=function(e){this.cursor_+=e,jspb.asserts.assert(this.cursor_<=this.end_)},jspb.BinaryDecoder.prototype.atEnd=function(){return this.cursor_==this.end_},jspb.BinaryDecoder.prototype.pastEnd=function(){return this.cursor_>this.end_},jspb.BinaryDecoder.prototype.getError=function(){return this.error_||0>this.cursor_||this.cursor_>this.end_},jspb.BinaryDecoder.prototype.readSplitVarint64=function(e){for(var t=128,r=0,n=0,i=0;4>i&&128<=t;i++)r|=(127&(t=this.bytes_[this.cursor_++]))<<7*i;if(128<=t&&(r|=(127&(t=this.bytes_[this.cursor_++]))<<28,n|=(127&t)>>4),128<=t)for(i=0;5>i&&128<=t;i++)n|=(127&(t=this.bytes_[this.cursor_++]))<<7*i+3;if(128>t)return e(r>>>0,n>>>0);jspb.asserts.fail("Failed to read varint, encoding is invalid."),this.error_=!0},jspb.BinaryDecoder.prototype.readSplitZigzagVarint64=function(e){return this.readSplitVarint64(function(t,r){return jspb.utils.fromZigzag64(t,r,e)})},jspb.BinaryDecoder.prototype.readSplitFixed64=function(e){var t=this.bytes_,r=this.cursor_;this.cursor_+=8;for(var n=0,i=0,a=r+7;a>=r;a--)n=n<<8|t[a],i=i<<8|t[a+4];return e(n,i)},jspb.BinaryDecoder.prototype.skipVarint=function(){for(;128&this.bytes_[this.cursor_];)this.cursor_++;this.cursor_++},jspb.BinaryDecoder.prototype.unskipVarint=function(e){for(;128>>=7;this.cursor_--},jspb.BinaryDecoder.prototype.readUnsignedVarint32=function(){var e=this.bytes_,t=e[this.cursor_+0],r=127&t;return 128>t?(this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+1]))<<7,128>t)?(this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+2]))<<14,128>t)?(this.cursor_+=3,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(127&(t=e[this.cursor_+3]))<<21,128>t)?(this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),r):(r|=(15&(t=e[this.cursor_+4]))<<28,128>t)?(this.cursor_+=5,jspb.asserts.assert(this.cursor_<=this.end_),r>>>0):(this.cursor_+=5,128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&jspb.asserts.assert(!1),jspb.asserts.assert(this.cursor_<=this.end_),r)},jspb.BinaryDecoder.prototype.readSignedVarint32=function(){return~~this.readUnsignedVarint32()},jspb.BinaryDecoder.prototype.readUnsignedVarint32String=function(){return this.readUnsignedVarint32().toString()},jspb.BinaryDecoder.prototype.readSignedVarint32String=function(){return this.readSignedVarint32().toString()},jspb.BinaryDecoder.prototype.readZigzagVarint32=function(){var e=this.readUnsignedVarint32();return e>>>1^-(1&e)},jspb.BinaryDecoder.prototype.readUnsignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinUint64)},jspb.BinaryDecoder.prototype.readUnsignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinUnsignedDecimalString)},jspb.BinaryDecoder.prototype.readSignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinInt64)},jspb.BinaryDecoder.prototype.readSignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readZigzagVarint64=function(){return this.readSplitVarint64(jspb.utils.joinZigzag64)},jspb.BinaryDecoder.prototype.readZigzagVarintHash64=function(){return this.readSplitZigzagVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readZigzagVarint64String=function(){return this.readSplitZigzagVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readUint8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),e},jspb.BinaryDecoder.prototype.readUint16=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1];return this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),e<<0|t<<8},jspb.BinaryDecoder.prototype.readUint32=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],n=this.bytes_[this.cursor_+3];return this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),(e<<0|t<<8|r<<16|n<<24)>>>0},jspb.BinaryDecoder.prototype.readUint64=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinUint64(e,t)},jspb.BinaryDecoder.prototype.readUint64String=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinUnsignedDecimalString(e,t)},jspb.BinaryDecoder.prototype.readInt8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,jspb.asserts.assert(this.cursor_<=this.end_),e<<24>>24},jspb.BinaryDecoder.prototype.readInt16=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1];return this.cursor_+=2,jspb.asserts.assert(this.cursor_<=this.end_),(e<<0|t<<8)<<16>>16},jspb.BinaryDecoder.prototype.readInt32=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],n=this.bytes_[this.cursor_+3];return this.cursor_+=4,jspb.asserts.assert(this.cursor_<=this.end_),e<<0|t<<8|r<<16|n<<24},jspb.BinaryDecoder.prototype.readInt64=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinInt64(e,t)},jspb.BinaryDecoder.prototype.readInt64String=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinSignedDecimalString(e,t)},jspb.BinaryDecoder.prototype.readFloat=function(){var e=this.readUint32();return jspb.utils.joinFloat32(e,0)},jspb.BinaryDecoder.prototype.readDouble=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinFloat64(e,t)},jspb.BinaryDecoder.prototype.readBool=function(){return!!this.bytes_[this.cursor_++]},jspb.BinaryDecoder.prototype.readEnum=function(){return this.readSignedVarint32()},jspb.BinaryDecoder.prototype.readString=function(e){var t=this.bytes_,r=this.cursor_;e=r+e;for(var n=[],i="";ra)n.push(a);else if(192>a)continue;else if(224>a){var s=t[r++];n.push((31&a)<<6|63&s)}else if(240>a){s=t[r++];var o=t[r++];n.push((15&a)<<12|(63&s)<<6|63&o)}else 248>a&&(a=((7&a)<<18|(63&(s=t[r++]))<<12|(63&(o=t[r++]))<<6|63&t[r++])-65536,n.push((a>>10&1023)+55296,(1023&a)+56320));8192<=n.length&&(i+=String.fromCharCode.apply(null,n),n.length=0)}return i+=goog.crypt.byteArrayToString(n),this.cursor_=r,i},jspb.BinaryDecoder.prototype.readStringWithLength=function(){var e=this.readUnsignedVarint32();return this.readString(e)},jspb.BinaryDecoder.prototype.readBytes=function(e){if(0>e||this.cursor_+e>this.bytes_.length)return this.error_=!0,jspb.asserts.fail("Invalid byte length!"),new Uint8Array(0);var t=this.bytes_.subarray(this.cursor_,this.cursor_+e);return this.cursor_+=e,jspb.asserts.assert(this.cursor_<=this.end_),t},jspb.BinaryDecoder.prototype.readVarintHash64=function(){return this.readSplitVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readFixedHash64=function(){var e=this.bytes_,t=this.cursor_,r=e[t+0],n=e[t+1],i=e[t+2],a=e[t+3],s=e[t+4],o=e[t+5],l=e[t+6];return e=e[t+7],this.cursor_+=8,String.fromCharCode(r,n,i,a,s,o,l,e)},jspb.BinaryReader=function(e,t,r){this.decoder_=jspb.BinaryDecoder.alloc(e,t,r),this.fieldCursor_=this.decoder_.getCursor(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null},jspb.BinaryReader.instanceCache_=[],jspb.BinaryReader.alloc=function(e,t,r){if(jspb.BinaryReader.instanceCache_.length){var n=jspb.BinaryReader.instanceCache_.pop();return e&&n.decoder_.setBlock(e,t,r),n}return new jspb.BinaryReader(e,t,r)},jspb.BinaryReader.prototype.alloc=jspb.BinaryReader.alloc,jspb.BinaryReader.prototype.free=function(){this.decoder_.clear(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null,100>jspb.BinaryReader.instanceCache_.length&&jspb.BinaryReader.instanceCache_.push(this)},jspb.BinaryReader.prototype.getFieldCursor=function(){return this.fieldCursor_},jspb.BinaryReader.prototype.getCursor=function(){return this.decoder_.getCursor()},jspb.BinaryReader.prototype.getBuffer=function(){return this.decoder_.getBuffer()},jspb.BinaryReader.prototype.getFieldNumber=function(){return this.nextField_},goog.exportProperty(jspb.BinaryReader.prototype,"getFieldNumber",jspb.BinaryReader.prototype.getFieldNumber),jspb.BinaryReader.prototype.getWireType=function(){return this.nextWireType_},jspb.BinaryReader.prototype.isDelimited=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED},goog.exportProperty(jspb.BinaryReader.prototype,"isDelimited",jspb.BinaryReader.prototype.isDelimited),jspb.BinaryReader.prototype.isEndGroup=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP},goog.exportProperty(jspb.BinaryReader.prototype,"isEndGroup",jspb.BinaryReader.prototype.isEndGroup),jspb.BinaryReader.prototype.getError=function(){return this.error_||this.decoder_.getError()},jspb.BinaryReader.prototype.setBlock=function(e,t,r){this.decoder_.setBlock(e,t,r),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.reset=function(){this.decoder_.reset(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.advance=function(e){this.decoder_.advance(e)},jspb.BinaryReader.prototype.nextField=function(){if(this.decoder_.atEnd())return!1;if(this.getError())return jspb.asserts.fail("Decoder hit an error"),!1;this.fieldCursor_=this.decoder_.getCursor();var e=this.decoder_.readUnsignedVarint32(),t=e>>>3;return(e&=7)!=jspb.BinaryConstants.WireType.VARINT&&e!=jspb.BinaryConstants.WireType.FIXED32&&e!=jspb.BinaryConstants.WireType.FIXED64&&e!=jspb.BinaryConstants.WireType.DELIMITED&&e!=jspb.BinaryConstants.WireType.START_GROUP&&e!=jspb.BinaryConstants.WireType.END_GROUP?(jspb.asserts.fail("Invalid wire type: %s (at position %s)",e,this.fieldCursor_),this.error_=!0,!1):(this.nextField_=t,this.nextWireType_=e,!0)},goog.exportProperty(jspb.BinaryReader.prototype,"nextField",jspb.BinaryReader.prototype.nextField),jspb.BinaryReader.prototype.unskipHeader=function(){this.decoder_.unskipVarint(this.nextField_<<3|this.nextWireType_)},jspb.BinaryReader.prototype.skipMatchingFields=function(){var e=this.nextField_;for(this.unskipHeader();this.nextField()&&this.getFieldNumber()==e;)this.skipField();this.decoder_.atEnd()||this.unskipHeader()},jspb.BinaryReader.prototype.skipVarintField=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.VARINT?(jspb.asserts.fail("Invalid wire type for skipVarintField"),this.skipField()):this.decoder_.skipVarint()},jspb.BinaryReader.prototype.skipDelimitedField=function(){if(this.nextWireType_!=jspb.BinaryConstants.WireType.DELIMITED)jspb.asserts.fail("Invalid wire type for skipDelimitedField"),this.skipField();else{var e=this.decoder_.readUnsignedVarint32();this.decoder_.advance(e)}},jspb.BinaryReader.prototype.skipFixed32Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED32?(jspb.asserts.fail("Invalid wire type for skipFixed32Field"),this.skipField()):this.decoder_.advance(4)},jspb.BinaryReader.prototype.skipFixed64Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED64?(jspb.asserts.fail("Invalid wire type for skipFixed64Field"),this.skipField()):this.decoder_.advance(8)},jspb.BinaryReader.prototype.skipGroup=function(){for(var e=this.nextField_;;){if(!this.nextField()){jspb.asserts.fail("Unmatched start-group tag: stream EOF"),this.error_=!0;break}if(this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP){this.nextField_!=e&&(jspb.asserts.fail("Unmatched end-group tag"),this.error_=!0);break}this.skipField()}},jspb.BinaryReader.prototype.skipField=function(){switch(this.nextWireType_){case jspb.BinaryConstants.WireType.VARINT:this.skipVarintField();break;case jspb.BinaryConstants.WireType.FIXED64:this.skipFixed64Field();break;case jspb.BinaryConstants.WireType.DELIMITED:this.skipDelimitedField();break;case jspb.BinaryConstants.WireType.FIXED32:this.skipFixed32Field();break;case jspb.BinaryConstants.WireType.START_GROUP:this.skipGroup();break;default:jspb.asserts.fail("Invalid wire encoding for field.")}},jspb.BinaryReader.prototype.registerReadCallback=function(e,t){null===this.readCallbacks_&&(this.readCallbacks_={}),jspb.asserts.assert(!this.readCallbacks_[e]),this.readCallbacks_[e]=t},jspb.BinaryReader.prototype.runReadCallback=function(e){return jspb.asserts.assert(null!==this.readCallbacks_),e=this.readCallbacks_[e],jspb.asserts.assert(e),e(this)},jspb.BinaryReader.prototype.readAny=function(e){this.nextWireType_=jspb.BinaryConstants.FieldTypeToWireType(e);var t=jspb.BinaryConstants.FieldType;switch(e){case t.DOUBLE:return this.readDouble();case t.FLOAT:return this.readFloat();case t.INT64:return this.readInt64();case t.UINT64:return this.readUint64();case t.INT32:return this.readInt32();case t.FIXED64:return this.readFixed64();case t.FIXED32:return this.readFixed32();case t.BOOL:return this.readBool();case t.STRING:return this.readString();case t.GROUP:jspb.asserts.fail("Group field type not supported in readAny()");case t.MESSAGE:jspb.asserts.fail("Message field type not supported in readAny()");case t.BYTES:return this.readBytes();case t.UINT32:return this.readUint32();case t.ENUM:return this.readEnum();case t.SFIXED32:return this.readSfixed32();case t.SFIXED64:return this.readSfixed64();case t.SINT32:return this.readSint32();case t.SINT64:return this.readSint64();case t.FHASH64:return this.readFixedHash64();case t.VHASH64:return this.readVarintHash64();default:jspb.asserts.fail("Invalid field type in readAny()")}return 0},jspb.BinaryReader.prototype.readMessage=function(e,t){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var r=this.decoder_.getEnd(),n=this.decoder_.readUnsignedVarint32();n=this.decoder_.getCursor()+n,this.decoder_.setEnd(n),t(e,this),this.decoder_.setCursor(n),this.decoder_.setEnd(r)},goog.exportProperty(jspb.BinaryReader.prototype,"readMessage",jspb.BinaryReader.prototype.readMessage),jspb.BinaryReader.prototype.readGroup=function(e,t,r){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.START_GROUP),jspb.asserts.assert(this.nextField_==e),r(t,this),this.error_||this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP||(jspb.asserts.fail("Group submessage did not end with an END_GROUP tag"),this.error_=!0)},goog.exportProperty(jspb.BinaryReader.prototype,"readGroup",jspb.BinaryReader.prototype.readGroup),jspb.BinaryReader.prototype.getFieldDecoder=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32(),t=this.decoder_.getCursor(),r=t+e;return e=jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(),t,e),this.decoder_.setCursor(r),e},jspb.BinaryReader.prototype.readInt32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readInt32",jspb.BinaryReader.prototype.readInt32),jspb.BinaryReader.prototype.readInt32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32String()},jspb.BinaryReader.prototype.readInt64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readInt64",jspb.BinaryReader.prototype.readInt64),jspb.BinaryReader.prototype.readInt64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64String()},jspb.BinaryReader.prototype.readUint32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readUint32",jspb.BinaryReader.prototype.readUint32),jspb.BinaryReader.prototype.readUint32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32String()},jspb.BinaryReader.prototype.readUint64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readUint64",jspb.BinaryReader.prototype.readUint64),jspb.BinaryReader.prototype.readUint64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64String()},jspb.BinaryReader.prototype.readSint32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readSint32",jspb.BinaryReader.prototype.readSint32),jspb.BinaryReader.prototype.readSint64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readSint64",jspb.BinaryReader.prototype.readSint64),jspb.BinaryReader.prototype.readSint64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64String()},jspb.BinaryReader.prototype.readFixed32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readUint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readFixed32",jspb.BinaryReader.prototype.readFixed32),jspb.BinaryReader.prototype.readFixed64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readFixed64",jspb.BinaryReader.prototype.readFixed64),jspb.BinaryReader.prototype.readFixed64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64String()},jspb.BinaryReader.prototype.readSfixed32=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32()},goog.exportProperty(jspb.BinaryReader.prototype,"readSfixed32",jspb.BinaryReader.prototype.readSfixed32),jspb.BinaryReader.prototype.readSfixed32String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32().toString()},jspb.BinaryReader.prototype.readSfixed64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64()},goog.exportProperty(jspb.BinaryReader.prototype,"readSfixed64",jspb.BinaryReader.prototype.readSfixed64),jspb.BinaryReader.prototype.readSfixed64String=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64String()},jspb.BinaryReader.prototype.readFloat=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readFloat()},goog.exportProperty(jspb.BinaryReader.prototype,"readFloat",jspb.BinaryReader.prototype.readFloat),jspb.BinaryReader.prototype.readDouble=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readDouble()},goog.exportProperty(jspb.BinaryReader.prototype,"readDouble",jspb.BinaryReader.prototype.readDouble),jspb.BinaryReader.prototype.readBool=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),!!this.decoder_.readUnsignedVarint32()},goog.exportProperty(jspb.BinaryReader.prototype,"readBool",jspb.BinaryReader.prototype.readBool),jspb.BinaryReader.prototype.readEnum=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},goog.exportProperty(jspb.BinaryReader.prototype,"readEnum",jspb.BinaryReader.prototype.readEnum),jspb.BinaryReader.prototype.readString=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readString(e)},goog.exportProperty(jspb.BinaryReader.prototype,"readString",jspb.BinaryReader.prototype.readString),jspb.BinaryReader.prototype.readBytes=function(){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readBytes(e)},goog.exportProperty(jspb.BinaryReader.prototype,"readBytes",jspb.BinaryReader.prototype.readBytes),jspb.BinaryReader.prototype.readVarintHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readVarintHash64()},jspb.BinaryReader.prototype.readSintHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarintHash64()},jspb.BinaryReader.prototype.readSplitVarint64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64(e)},jspb.BinaryReader.prototype.readSplitZigzagVarint64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64(function(t,r){return jspb.utils.fromZigzag64(t,r,e)})},jspb.BinaryReader.prototype.readFixedHash64=function(){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readFixedHash64()},jspb.BinaryReader.prototype.readSplitFixed64=function(e){return jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readSplitFixed64(e)},jspb.BinaryReader.prototype.readPackedField_=function(e){jspb.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var t=this.decoder_.readUnsignedVarint32();t=this.decoder_.getCursor()+t;for(var r=[];this.decoder_.getCursor()>>7|t<<25)>>>0,t>>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSplitFixed64=function(e,t){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(t==Math.floor(t)),jspb.asserts.assert(0<=e&&e>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSignedVarint32=function(e){if(jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&et;t++)this.buffer_.push(127&e|128),e>>=7;this.buffer_.push(1)}},jspb.BinaryEncoder.prototype.writeUnsignedVarint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&e=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_31&&e>31)>>>0)},jspb.BinaryEncoder.prototype.writeZigzagVarint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e>>0,r>>>0)})},jspb.BinaryEncoder.prototype.writeUint8=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&256>e),this.buffer_.push(e>>>0&255)},jspb.BinaryEncoder.prototype.writeUint16=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&65536>e),this.buffer_.push(e>>>0&255),this.buffer_.push(e>>>8&255)},jspb.BinaryEncoder.prototype.writeUint32=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&e>>0&255),this.buffer_.push(e>>>8&255),this.buffer_.push(e>>>16&255),this.buffer_.push(e>>>24&255)},jspb.BinaryEncoder.prototype.writeUint64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(0<=e&&ee),this.buffer_.push(e>>>0&255)},jspb.BinaryEncoder.prototype.writeInt16=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(-32768<=e&&32768>e),this.buffer_.push(e>>>0&255),this.buffer_.push(e>>>8&255)},jspb.BinaryEncoder.prototype.writeInt32=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e>>0&255),this.buffer_.push(e>>>8&255),this.buffer_.push(e>>>16&255),this.buffer_.push(e>>>24&255)},jspb.BinaryEncoder.prototype.writeInt64=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_63&&+e=-jspb.BinaryConstants.FLOAT32_MAX&&e<=jspb.BinaryConstants.FLOAT32_MAX),jspb.utils.splitFloat32(e),this.writeUint32(jspb.utils.split64Low)},jspb.BinaryEncoder.prototype.writeDouble=function(e){jspb.asserts.assert(1/0===e||-1/0===e||isNaN(e)||e>=-jspb.BinaryConstants.FLOAT64_MAX&&e<=jspb.BinaryConstants.FLOAT64_MAX),jspb.utils.splitFloat64(e),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeBool=function(e){jspb.asserts.assert("boolean"==typeof e||"number"==typeof e),this.buffer_.push(e?1:0)},jspb.BinaryEncoder.prototype.writeEnum=function(e){jspb.asserts.assert(e==Math.floor(e)),jspb.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&en)this.buffer_.push(n);else if(2048>n)this.buffer_.push(n>>6|192),this.buffer_.push(63&n|128);else if(65536>n){if(55296<=n&&56319>=n&&r+1=i&&(n=1024*(n-55296)+i-56320+65536,this.buffer_.push(n>>18|240),this.buffer_.push(n>>12&63|128),this.buffer_.push(n>>6&63|128),this.buffer_.push(63&n|128),r++)}else this.buffer_.push(n>>12|224),this.buffer_.push(n>>6&63|128),this.buffer_.push(63&n|128)}}return this.buffer_.length-t},jspb.arith={},jspb.arith.UInt64=function(e,t){this.lo=e,this.hi=t},jspb.arith.UInt64.prototype.cmp=function(e){return this.hi>>1|(1&this.hi)<<31)>>>0,this.hi>>>1>>>0)},jspb.arith.UInt64.prototype.leftShift=function(){return new jspb.arith.UInt64(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)},jspb.arith.UInt64.prototype.msb=function(){return!!(2147483648&this.hi)},jspb.arith.UInt64.prototype.lsb=function(){return!!(1&this.lo)},jspb.arith.UInt64.prototype.zero=function(){return 0==this.lo&&0==this.hi},jspb.arith.UInt64.prototype.add=function(e){return new jspb.arith.UInt64((this.lo+e.lo&4294967295)>>>0>>>0,((this.hi+e.hi&4294967295)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.UInt64.prototype.sub=function(e){return new jspb.arith.UInt64((this.lo-e.lo&4294967295)>>>0>>>0,((this.hi-e.hi&4294967295)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.UInt64.mul32x32=function(e,t){var r=65535&e;e>>>=16;var n=65535&t,i=t>>>16;for(t=r*n+65536*(r*i&65535)+65536*(e*n&65535),r=e*i+(r*i>>>16)+(e*n>>>16);4294967296<=t;)t-=4294967296,r+=1;return new jspb.arith.UInt64(t>>>0,r>>>0)},jspb.arith.UInt64.prototype.mul=function(e){var t=jspb.arith.UInt64.mul32x32(this.lo,e);return(e=jspb.arith.UInt64.mul32x32(this.hi,e)).hi=e.lo,e.lo=0,t.add(e)},jspb.arith.UInt64.prototype.div=function(e){if(0==e)return[];var t=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(this.lo,this.hi);e=new jspb.arith.UInt64(e,0);for(var n=new jspb.arith.UInt64(1,0);!e.msb();)e=e.leftShift(),n=n.leftShift();for(;!n.zero();)0>=e.cmp(r)&&(t=t.add(n),r=r.sub(e)),e=e.rightShift(),n=n.rightShift();return[t,r]},jspb.arith.UInt64.prototype.toString=function(){for(var e="",t=this;!t.zero();){var r=(t=t.div(10))[0];e=t[1].lo+e,t=r}return""==e&&(e="0"),e},jspb.arith.UInt64.fromString=function(e){for(var t=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(0,0),n=0;ne[n]||"9">>0>>>0,((this.hi+e.hi&4294967295)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.sub=function(e){return new jspb.arith.Int64((this.lo-e.lo&4294967295)>>>0>>>0,((this.hi-e.hi&4294967295)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.clone=function(){return new jspb.arith.Int64(this.lo,this.hi)},jspb.arith.Int64.prototype.toString=function(){var e=0!=(2147483648&this.hi),t=new jspb.arith.UInt64(this.lo,this.hi);return e&&(t=new jspb.arith.UInt64(0,0).sub(t)),(e?"-":"")+t.toString()},jspb.arith.Int64.fromString=function(e){var t=0>>=7,this.totalLength_++;e.push(t),this.totalLength_++},jspb.BinaryWriter.prototype.writeSerializedMessage=function(e,t,r){this.appendUint8Array_(e.subarray(t,r))},jspb.BinaryWriter.prototype.maybeWriteSerializedMessage=function(e,t,r){null!=e&&null!=t&&null!=r&&this.writeSerializedMessage(e,t,r)},jspb.BinaryWriter.prototype.reset=function(){this.blocks_=[],this.encoder_.end(),this.totalLength_=0,this.bookmarks_=[]},jspb.BinaryWriter.prototype.getResultBuffer=function(){jspb.asserts.assert(0==this.bookmarks_.length);for(var e=new Uint8Array(this.totalLength_+this.encoder_.length()),t=this.blocks_,r=t.length,n=0,i=0;i=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t>>0,t>>>0)})},jspb.BinaryWriter.prototype.writeRepeatedInt32=function(e,t){if(null!=t)for(var r=0;r>>0,t>>>0)});this.endDelimited_(e)}},jspb.BinaryWriter.prototype.writePackedInt64String=function(e,t){if(null!=t&&t.length){e=this.beginDelimited_(e);for(var r=0;rt.length?r.length:t.length;for(e.getJsPbMessageId()&&(n[0]=e.getJsPbMessageId(),i=1);i{let{className:t,children:r,...s}=e;return(0,o.jsxs)(i.xz,{ref:n,className:(0,d.cn)("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...s,children:[r,(0,o.jsx)(i.JO,{asChild:!0,children:(0,o.jsx)(l.jnn,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=i.xz.displayName;let f=r.forwardRef((e,n)=>{let{className:t,...r}=e;return(0,o.jsx)(i.u_,{ref:n,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...r,children:(0,o.jsx)(l.g8U,{})})});f.displayName=i.u_.displayName;let h=r.forwardRef((e,n)=>{let{className:t,...r}=e;return(0,o.jsx)(i.$G,{ref:n,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...r,children:(0,o.jsx)(l.v4q,{})})});h.displayName=i.$G.displayName;let p=r.forwardRef((e,n)=>{let{className:t,children:r,position:s="popper",...a}=e;return(0,o.jsx)(i.h_,{children:(0,o.jsxs)(i.VY,{ref:n,className:(0,d.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:s,...a,children:[(0,o.jsx)(f,{}),(0,o.jsx)(i.l_,{className:(0,d.cn)("p-1","popper"===s&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),(0,o.jsx)(h,{})]})})});p.displayName=i.VY.displayName;let v=r.forwardRef((e,n)=>{let{className:t,...r}=e;return(0,o.jsx)(i.__,{ref:n,className:(0,d.cn)("px-2 py-1.5 text-sm font-semibold",t),...r})});v.displayName=i.__.displayName;let b=r.forwardRef((e,n)=>{let{className:t,children:r,...s}=e;return(0,o.jsxs)(i.ck,{ref:n,className:(0,d.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s,children:[(0,o.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,o.jsx)(i.wU,{children:(0,o.jsx)(l.nQG,{className:"h-4 w-4"})})}),(0,o.jsx)(i.eT,{children:r})]})});b.displayName=i.ck.displayName,r.forwardRef((e,n)=>{let{className:t,...r}=e;return(0,o.jsx)(i.Z0,{ref:n,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",t),...r})}).displayName=i.Z0.displayName;var w=t(89733),x=t(4919),y=t(52431);let j=r.forwardRef((e,n)=>{let{className:t,value:r,...s}=e;return(0,o.jsx)(y.fC,{ref:n,className:(0,d.cn)("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...s,children:(0,o.jsx)(y.z$,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:"translateX(-".concat(100-(r||0),"%)")}})})});j.displayName=y.fC.displayName;var k=t(40882);let N=k.fC,S=k.wy,L=k.Fw;var E=t(74697),M=t(1282),P=t(81810),C=t(80018),I=t(89183);let z=(0,s.default)(()=>Promise.all([t.e(934),t.e(994),t.e(122)]).then(t.bind(t,95122)),{loadableGenerated:{webpack:()=>[95122]},ssr:!1}),D=new C.X,T=new I.g;var B=()=>{let[e,n]=(0,r.useState)([]),[t,s]=(0,r.useState)([]),[l,i]=(0,r.useState)(a.o[0]),[d,f]=(0,r.useState)({}),[h,y]=(0,r.useState)({}),[k,C]=(0,r.useState)(0),[I,B]=(0,r.useState)(2),[R,_]=(0,r.useState)(""),[q,O]=(0,r.useState)([]),[W,A]=(0,r.useState)({}),[H,F]=(0,r.useState)(!1);(0,r.useEffect)(()=>{I{for(let e=k-1;e>=I;e--){let n="embedding-worker-".concat(e);console.log("Removing ",n),await D.deleteEmbeddingWorker(n)}})()):I>k&&(C(I),console.log("Adding ",I-k," workers"),(async()=>{for(let e=k;e{try{let n=await T.getWorkerState(e);n&&A(t=>({...t,[e]:{...t[e],state:n.state,loadingProgress:n.loadingProgress||1}}))}catch(n){console.error("Error fetching worker state for ".concat(e,":"),n)}},G=async()=>{try{let e=await T.getEngineLogs(50),n=D.getEmbeddingEngineLogs(50),t=[...e,...n].sort((e,n)=>e.at.getTime()-n.at.getTime());t.length>0&&O(t)}catch(e){console.error("Error fetching engine logs:",e)}};(0,r.useEffect)(()=>{let e=setInterval(G,1e3);return()=>{clearInterval(e)}},[]);let Z=async()=>{let e=Math.random().toString(36).substring(7);n(n=>[...n,e]),f(n=>({...n,[e]:l})),A(n=>({...n,[e]:{tps:0,output:"",isLoading:!0,state:"loading",loadingProgress:0,embeddingHash:""}}));let t=setInterval(()=>Q(e),1e3);try{await T.loadWorker(l,e)}catch(o){console.error("Error loading worker ".concat(e,":"),o),A(n=>{let{[e]:t,...o}=n;return o}),n(n=>n.filter(n=>n!==e)),clearInterval(t)}return()=>{clearInterval(t)}},J=async e=>{let n=h[e],t={modelName:d[e],messages:[{role:"user",content:n}]},o=T.runInferenceOnWorker(t,e),r=0,a="",l=Date.now();for await(let n of o)if("token"===n.type){r++,a+=n.token;let t=Math.round(r/((Date.now()-l)/1e3));A(n=>{var o,r;return{...n,[e]:{tps:t,output:a,isLoading:!1,loadingProgress:(null===(o=W[e])||void 0===o?void 0:o.loadingProgress)||1,state:(null===(r=W[e])||void 0===r?void 0:r.state)||"idle",embeddingHash:""}}})}let i=await D.embedText([a],"nomic-ai/nomic-embed-text-v1.5");i&&i.length>0&&s(n=>[...n,...i.map(n=>({...n,modelName:d[e]}))]),i&&i.length>0&&A(n=>({...n,[e]:{...n[e],embeddingHash:i[0].bEmbeddingHash}}))},V=async()=>{let n=e.map(async e=>{let n={modelName:d[e],messages:[{role:"user",content:R}]};try{let t=T.runInferenceOnWorker(n,e),o=0,r="",a=Date.now();for await(let n of t)if("token"===n.type){o++,r+=n.token;let t=(Date.now()-a)/1e3,s=Math.round(o/t);A(n=>{var t,o;return{...n,[e]:{tps:s,output:r,isLoading:!0,loadingProgress:(null===(t=W[e])||void 0===t?void 0:t.loadingProgress)||1,state:(null===(o=W[e])||void 0===o?void 0:o.state)||"idle",embeddingHash:""}}})}let l=await D.embedText([r],"nomic-ai/nomic-embed-text-v1.5");l&&l.length>0&&s(n=>[...n,...l.map(n=>({...n,modelName:d[e]}))]),l&&l.length>0&&A(n=>({...n,[e]:{...n[e],isLoading:!1,embeddingHash:l[0].bEmbeddingHash}}))}catch(n){console.error("Error running inference on worker ".concat(e,":"),n)}});await Promise.all(n)},U=e=>{T.abortWorkerInference(e)},$=e=>{T.unloadWorker(e),n(n=>n.filter(n=>n!==e))};return(0,o.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between p-4 bg-gray-100",children:[(0,o.jsx)("h1",{className:"text-2xl font-bold",children:"LLM Testing"}),(0,o.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,o.jsxs)("span",{className:"text-lg",children:["Global Average TPS:"," ",(0,o.jsx)("span",{className:"font-bold",children:(Object.values(W).reduce((e,n)=>e+((null==n?void 0:n.tps)||0),0)/Object.keys(W).length||0).toFixed(1)||"Nil"})]}),(0,o.jsx)(x.g,{className:"w-80",placeholder:"Enter prompt...",value:R,onChange:e=>_(e.target.value)}),(0,o.jsx)(w.z,{onClick:V,children:"Send to All"})]}),(0,o.jsx)(w.z,{onClick:()=>F(!H),variant:"outline",children:H?"Hide Log":"Show Log"})]}),(0,o.jsxs)("div",{className:"flex-grow p-4",children:[(0,o.jsxs)("div",{className:"flex justify-end mb-4 items-center",children:[(0,o.jsxs)(c,{value:l,onValueChange:e=>i(e),children:[(0,o.jsx)(m,{className:"w-70",children:(0,o.jsx)(g,{placeholder:"Select Model"})}),(0,o.jsx)(p,{children:(0,o.jsxs)(u,{children:[(0,o.jsx)(v,{children:"Models"}),a.o.map(e=>(0,o.jsx)(b,{value:e,children:e},e))]})})]}),(0,o.jsx)(w.z,{onClick:Z,className:"ml-4",children:"Spawn Worker"}),(0,o.jsx)("span",{className:"ml-6",children:"Embedding Workers:"}),(0,o.jsxs)("div",{className:"ml-4 flex items-center",children:[(0,o.jsx)(w.z,{onClick:()=>B(e=>Math.max(0,e-1)),size:"sm",className:"w-8 p-0",children:"-"}),(0,o.jsx)("span",{className:"mx-2",children:k}),(0,o.jsx)(w.z,{onClick:()=>B(e=>e+1),size:"sm",className:"w-8 p-0",children:"+"})]})]}),(0,o.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(e=>{var n,t,r,s,a,l,i,c,u,g,m;return(0,o.jsxs)("div",{className:"border border-gray-200 rounded-lg p-4 bg-white shadow ".concat(P.Q[d[e]]),children:[(0,o.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,o.jsxs)("span",{className:"text-lg font-semibold",children:["Worker: ",e]}),(0,o.jsxs)("span",{className:"text-lg",children:["TPS:"," ",(0,o.jsx)("span",{className:"font-bold",children:(null===(n=W[e])||void 0===n?void 0:n.tps)||0})]})]}),(0,o.jsxs)("p",{className:"text-sm mb-2",children:["Model: ",d[e]]}),(0,o.jsx)(x.g,{className:"w-full mb-2",rows:2,value:h[e]||"",onChange:n=>y(t=>({...t,[e]:n.target.value}))}),(0,o.jsxs)("div",{className:"relative mb-2 p-2 bg-gray-50 rounded text-sm max-h-20 overflow-auto",children:[(null===(t=W[e])||void 0===t?void 0:t.state)==="loading"&&(0,o.jsx)(j,{value:(null===(r=W[e])||void 0===r?void 0:r.loadingProgress)||0,className:"absolute top-0 left-0 w-full h-1"}),(null===(s=W[e])||void 0===s?void 0:s.state)==="inference-in-progress"&&(0,o.jsx)(j,{value:30,className:"absolute top-0 left-0 w-full h-1"}),(0,o.jsx)("p",{className:"whitespace-pre-line",children:null===(a=W[e])||void 0===a?void 0:a.output})]}),(0,o.jsxs)("div",{className:"mb-2",children:[(0,o.jsx)("span",{className:"text-sm font-semibold",children:"Embedding Hash:"})," ",(0,o.jsx)("div",{className:"text-xs font-bold uppercase overflow-x-scroll",children:null===(l=W[e])||void 0===l?void 0:l.embeddingHash})]}),(0,o.jsxs)("div",{className:"flex space-x-2 justify-center",children:[(0,o.jsx)(w.z,{size:"sm",onClick:()=>J(e),disabled:(null===(i=W[e])||void 0===i?void 0:i.state)==="loading"||(null===(c=W[e])||void 0===c?void 0:c.state)==="inference-in-progress",children:"Send"}),(0,o.jsx)(w.z,{size:"sm",onClick:()=>U(e),disabled:(null===(u=W[e])||void 0===u?void 0:u.state)!=="inference-in-progress",children:"Stop"}),(0,o.jsx)(w.z,{size:"sm",onClick:()=>$(e),disabled:(null===(g=W[e])||void 0===g?void 0:g.state)==="loading"||(null===(m=W[e])||void 0===m?void 0:m.state)==="inference-in-progress",children:"Unload"})]})]},e)})})]}),(0,o.jsxs)("div",{className:"fixed top-0 right-0 bottom-0 w-96 bg-white p-4 shadow-lg transition-transform duration-300 ease-in-out border-l border-gray-200 ".concat(H?"translate-x-0":"translate-x-full"),children:[(0,o.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,o.jsx)("h2",{className:"text-xl font-bold",children:"Engine Log"}),(0,o.jsxs)(w.z,{variant:"ghost",size:"sm",onClick:()=>F(!1),className:"p-0",children:[(0,o.jsx)(E.Z,{className:"h-4 w-4"}),(0,o.jsx)("span",{className:"sr-only",children:"Close"})]})]}),(0,o.jsx)("div",{className:"space-y-2 overflow-auto max-h-[calc(100vh-8rem)]",children:q.map((e,n)=>(0,o.jsxs)(N,{className:"space-y-2",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between space-x-4 px-4",children:[(0,o.jsx)("h4",{className:"text-sm font-semibold",children:e.type}),(0,o.jsx)(S,{asChild:!0,children:(0,o.jsxs)(w.z,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[(0,o.jsx)(M.Z,{className:"h-4 w-4"}),(0,o.jsx)("span",{className:"sr-only",children:"Toggle"})]})})]}),(0,o.jsx)(L,{children:(0,o.jsx)("pre",{className:"rounded-md border px-4 py-3 font-mono text-sm overflow-auto",children:(0,o.jsx)("code",{className:"language-json",children:JSON.stringify(e,null,2)})})})]},n))})]}),t.length>=6&&(0,o.jsx)(z,{embeddings:t})]})}},49354:function(e,n,t){"use strict";t.d(n,{cn:function(){return s}});var o=t(44839),r=t(96164);function s(){for(var e=arguments.length,n=Array(e),t=0;t{this.resolve=e,this.reject=n})}}},62052:function(e,n,t){"use strict";t.d(n,{$5:function(){return l},HQ:function(){return d},hu:function(){return c}});var o=t(36393),r=t(22170),s=t.n(r);let a=(0,t(89028).ri)().loggerSettings,l={llmEngine:{main:"background: #f0f8ff; color: #1e90ff; font-weight: bold;",worker:"background: #f0f8ff; color: #87cefa;"},embeddingEngine:{main:"background: #f0fff0; color: #2e8b57; font-weight: bold;",worker:"background: #f0fff0; color: #90ee90;"},theDomain:"background: #fff0f5; color: #ff69b4; font-weight: bold;",consensusCore:"background: #f5f5f5; color: #4682b4; font-weight: bold;",databases:{inferenceDB:"background: #f5f5f5; color: #a9a9a9;",packetDB:"background: #f5f5f5; color: #708090;",peerDB:"background: #f5f5f5; color: #778899;",quorumDB:"background: #f5f5f5; color: #696969;"},p2pNetworks:{nkn:"background: #fffacd; color: #ffa500;",torrent:"background: #fffacd; color: #ff8c00;",pewpewdb:"background: #fffacd; color: #ff7f50;",nostr:"background: #fffacd; color: #ff6347;"}},i=0;class d extends o.Z{static getInstance(){return d.instance||(d.instance=new d),d.instance}static addLog(e,n,t){d.getInstance().logs.push({at:new Date,logger:e,type:n,id:i++,message:t}),d.getInstance().logs=d.getInstance().logs.slice(-a.maxLogsInMemory).sort((e,n)=>n.at.getTime()-e.at.getTime()),d.getInstance().emitNewLogs()}constructor(){super(),this.logs=[],this.emitNewLogs=s()(()=>{this.emit("newLog")},a.newLogEventDebounceMs)}}function c(e,n){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!t&&window&&(window.blockedLogLevels=localStorage.getItem("blockedLogLevels")||[],window.blockedLoggers=localStorage.getItem("blockedLoggers")||[]),{trace:function(o){for(var r,s,a,l,i=arguments.length,d=Array(i>1?i-1:0),c=1;c1?c-1:0),g=1;g1?c-1:0),g=1;g1?c-1:0),g=1;g1?c-1:0),g=1;g0?"-":"+").concat(o,":").concat(r)}function r(){return"undefined"==typeof navigator||"undefined"==typeof screen?"not-client":window.disableAnalytics?"disabled-analytics":Object.values({userAgent:navigator.userAgent,browserVersion:navigator.appVersion,platform:navigator.platform,language:navigator.language,screenWidth:screen.width,screenHeight:screen.height,colorDepth:screen.colorDepth,timezoneOffset:new Date().getTimezoneOffset(),cpuCores:navigator.hardwareConcurrency,touchSupport:"ontouchstart"in window}).map(e=>"".concat(e)).join("#")}async function s(e){return new Promise(n=>{setTimeout(()=>n("timeout"),e)})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",t="";for(let o=0;o{let e=async()=>{let e="nostr"===s?await (0,r.Ls)({appId:c,relayRedundancy:4,rtcConfig:d},i):await (0,n.Ls)({appId:c,relayRedundancy:4,rtcConfig:d},i);console.log("Trystero: Trystero client created",e),x(e=>({...e,events:[...e.events,{type:"log",data:"".concat(s," client created"),timestamp:Date.now()}]})),a(e),e.onPeerJoin(e=>{console.log("Trystero: Peer joined",e),x(s=>({...s,events:[...s.events,{type:"peerJoined",data:e,timestamp:Date.now()}],peers:[...s.peers,e]}))}),e.onPeerLeave(e=>{x(s=>({...s,events:[...s.events,{type:"peerLeft",data:e,timestamp:Date.now()}],peers:s.peers.filter(s=>s!==e)}))});let[,t]=e.makeAction(i);t((e,s)=>{x(t=>({...t,messages:[...t.messages,{type:"message",data:e,peerId:s,timestamp:Date.now()}]}))})};o.current||(o.current=!0,console.log("Setting up Trystero..."),e())},[s]),{send:s=>{if(t){let[a]=t.makeAction(i);a({nickName:e,message:s}),x(t=>({...t,messages:[{type:"message",data:{nickName:e,message:s},peerId:e,timestamp:Date.now()},...t.messages]}))}},messages:m.messages,events:m.events,peers:m.peers}},m=t(92358),x=t(18976);let u="/zsu/8/json",h="/waku/2/default-waku/proto",p={contentTopics:[u],pubsubTopics:[h],defaultBootstrap:!1,bootstrapPeers:["/dns4/waku.myrandomdemos.online/tcp/8000/wss/p2p/16Uiu2HAmKfC2QUvMVyBsVjuEzdo1hVhRddZxo69YkBuXYvuZ83sc","/dns4/node-01.do-ams3.wakuv2.prod.status.im/tcp/8000/wss/p2p/16Uiu2HAmL5okWopX7NqZWBUKVqW8iUxCEmd5GMHLVPwCgzYzQv3e","/dns4/node-01.gc-us-central1-a.wakuv2.prod.statusim.net/tcp/8000/wss/p2p/16Uiu2HAmVkKntsECaYfefR1V2yCR79CegLATuTPE6B9TxgxBiiiA","/dns4/node-01.ac-cn-hongkong-c.wakuv2.prod.status.im/tcp/8000/wss/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr24iDQpSN5Qa992BCjjwgrD","/dns4/node-01.do-ams3.wakuv2.test.status.im/tcp/8000/wss/p2p/16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ"],libp2p:{peerDiscovery:[(0,x.PZ)([h])]}};var f=function(e){let[s,t]=(0,l.useState)(),a=(0,l.useRef)(!1),[n,r]=(0,l.useState)({messages:[],events:[],connectedPeers:[]});return(0,l.useEffect)(()=>{let e=async()=>{console.log("Creating waku node...");let e=await (0,m.pq)(p);console.log("WAKU: Waku node created."),r(e=>({...e,events:[...e.events,{type:"log",data:"Waku node created",timestamp:Date.now()}]})),t(e),e.store.protocol.addLibp2pEventListener("peer:connect",async e=>{let s=e.detail;console.log("WAKU: Peer connected with peer id: ".concat(s)),r(e=>({...e,events:[...e.events,{type:"peerConnected",data:s,timestamp:Date.now()}]})),r(e=>({...e,connectedPeers:[...e.connectedPeers,s.toString()]}))}),console.log("WAKU: Starting Waku node..."),await e.start(),console.log("WAKU: Waiting for a peer"),await (0,m.gT)(e,[m.Uw.LightPush,m.Uw.Filter,m.Uw.Store]),console.log("WAKU: Peer found!");let s=(0,m.UF)(u,h);await e.filter.subscribe([s],e=>{if(!e.payload)return;let s=JSON.parse((0,m.Md)(e.payload));console.log("WAKU: Received Message - ",s),r(e=>({...e,messages:[{type:"message",data:s,peerId:s.sender,timestamp:s.timestamp},...e.messages]}))}),console.log("WAKU: Subscribed to messages");let a=await new Promise(t=>{let a=[];e.store.queryWithOrderedCallback([s],e=>{if(!e.payload)return;let s=JSON.parse((0,m.Md)(e.payload));a.push({type:"message",data:s,peerId:s.sender,timestamp:s.timestamp})}).then(()=>{console.log("WAKU: Finished querying messages"),t(a.sort((e,s)=>s.timestamp-e.timestamp))})});r(e=>({...e,messages:[...e.messages,...a]})),console.log("WAKU: Retrieved existing messages")};a.current||(a.current=!0,console.log("Setting up waku..."),e())},[]),{send:t=>{if(s){let a=(0,m.Mf)({contentTopic:u,pubsubTopic:h});console.log("Sending waku message ",t),s.lightPush.send(a,{payload:(0,m.iY)(JSON.stringify({timestamp:Date.now(),sender:e,message:t}))})}},messages:n.messages,events:n.events,connectedPeers:n.connectedPeers}},g=t(2105);let j="zensu3";var N=function(e){let[s,t]=(0,l.useState)(),a=(0,l.useRef)(!1),[n,r]=(0,l.useState)({messages:[],events:[],subscribers:[]});return(0,l.useEffect)(()=>{let s=async()=>{let s=new g.Wallet({password:"password"}),a=new g.MultiClient({identifier:e,seed:s.getSeed()});console.log("NKN: NKN client created with id ".concat(e)),r(e=>({...e,events:[...e.events,{type:"log",data:"NKN client created",timestamp:Date.now()}]})),t(a),a.onMessage(e=>{let{src:s,payload:t}=e;console.log("NKN: Received message from ",s,"payload",t),r(e=>({...e,messages:[{type:"message",data:{timestamp:Date.now(),sender:s.split(".")[0],message:t},peerId:s,timestamp:Date.now()},...e.messages]}))}),await a.onConnect(e=>{let{addr:s}=e;console.log("NKN: Connected to ".concat(s)),r(e=>({...e,events:[...e.events,{type:"connected",data:s,timestamp:Date.now()}]}))}),await a.onConnectFailed(()=>{console.log("NKN: Connection failed"),r(e=>({...e,events:[...e.events,{type:"connectFailed",data:null,timestamp:Date.now()}]}))}),await s.subscribe(j,1e3,e,"");let l=setInterval(async()=>{let e=await a.getSubscribers(j);r(s=>({...s,subscribers:e.subscribers}))},2e3);return()=>{clearInterval(l)}};a.current||(a.current=!0,console.log("Setting up NKN..."),s())},[e]),{send:e=>{s&&(console.log("NKN: Sending message",e),s.publish(j,e,{txPool:!0}))},messages:n.messages,events:n.events,subscribers:n.subscribers}},v=t(89733),b=t(77209),w=t(48185),y=t(44458),k=t(49354);let S=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)(y.fC,{ref:s,className:(0,k.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...l})});S.displayName=y.fC.displayName;let C=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)(y.Ee,{ref:s,className:(0,k.cn)("aspect-square h-full w-full",t),...l})});C.displayName=y.Ee.displayName;let D=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)(y.NY,{ref:s,className:(0,k.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...l})});D.displayName=y.NY.displayName;var U=t(9646);let O=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)(U.fC,{className:(0,k.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...l,ref:s,children:(0,a.jsx)(U.bU,{className:(0,k.cn)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})});O.displayName=U.fC.displayName;var P=t(66648),K=t(24364),R=t.n(K);let E="zensu/chat2";var Z=function(e){let s=(0,l.useRef)(!1),[t,a]=(0,l.useState)(),[n,r]=(0,l.useState)(),[c,i]=(0,l.useState)({messages:[],events:[]});return(0,l.useEffect)(()=>{if(n&&!c.messages.find(e=>e.timestamp===n.timestamp&&e.peerId===n.peerId)){let e=c.messages,s=[n,...c.messages].sort((e,s)=>s.timestamp-e.timestamp);console.log("GUN: Old message list",e),console.log("GUN: New message list",s),r(void 0),i(e=>({...e,messages:s}))}},[c,n]),(0,l.useEffect)(()=>{t||s.current||(s.current=!0,console.log("Setting up GUN..."),(()=>{let e=R()({peers:["https://gun-manhattan.herokuapp.com/gun","https://peer.wallie.io/gun","https://gundb-relay-mlccl.ondigitalocean.app/gun","https://plankton-app-6qfp3.ondigitalocean.app/"]});a(e),console.log("GUN: Gun instance created"),i(e=>({...e,events:[...e.events,{type:"log",data:"Gun instance created",timestamp:Date.now()}]})),console.log("Attaching gun listener"),e.get(E).on((e,s)=>{console.log("GUN: Received message",e),r({type:"message",data:JSON.parse(JSON.stringify(e)),peerId:e.nickName,timestamp:e.time})})})())},[t]),{send:s=>{t&&(console.log("GUN: Sending message",s),t.get(E).put({message:s,nickName:e,time:new Date().getTime()}))},messages:c.messages,events:c.events}};let L=e=>{let{nodeName:s}=e,{send:t,messages:n,events:r,peers:c}=o(s,"nostr"),{send:i,messages:d,events:m,peers:x}=o(s,"torrent"),{send:u,messages:h,events:p,connectedPeers:g}=f(s),{send:j,messages:y,events:k,subscribers:U}=N(s),{send:K,messages:R,events:E}=Z(s),[L,Y]=(0,l.useState)(""),[A,W]=(0,l.useState)(!1),T=()=>{""!==L.trim()&&(t(L),i(L),u(L),j(L),K(L),Y(""))};return(0,a.jsx)("div",{className:"".concat(A?"dark":""),children:(0,a.jsxs)("div",{className:"mx-auto p-4 bg-white dark:bg-slate-900",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-8",children:[(0,a.jsxs)("h1",{className:"text-3xl font-bold text-slate-800 dark:text-slate-100",children:["How good is Browser P2P SoTA? - ",s]}),(0,a.jsxs)("div",{className:"flex space-x-4 items-center",children:[(0,a.jsx)(b.I,{value:L,onChange:e=>Y(e.target.value),onKeyDown:e=>{"Enter"===e.key&&T()},className:"w-64 px-3 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-700 rounded-md text-sm placeholder-slate-400 focus:outline-none focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 dark:focus:border-indigo-600 dark:focus:ring-indigo-600 dark:text-slate-200",placeholder:"Type your message..."}),(0,a.jsx)(v.z,{onClick:T,className:"bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:focus:ring-offset-slate-900 text-white font-semibold py-2 px-4 rounded-md",children:"Send"})]}),(0,a.jsxs)(O,{checked:A,onCheckedChange:W,className:"ml-4 bg-slate-200 dark:bg-slate-700 relative inline-flex h-6 w-11 items-center rounded-full",children:[(0,a.jsx)("span",{className:"sr-only",children:"Enable dark mode"}),(0,a.jsx)("span",{className:"".concat(A?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-5 gap-8",children:[(0,a.jsxs)("div",{className:"bg-purple-100 dark:bg-purple-900 rounded-lg p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-purple-600 dark:text-purple-400",children:"Torrent"}),(0,a.jsx)(P.default,{src:"/torrent.png",alt:"Vercel",width:32,height:32,className:"h-6 w-6"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Connected Peers"})}),(0,a.jsx)(w.aY,{className:"h-24 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-2",children:x.map((e,s)=>(0,a.jsxs)("li",{className:"flex items-center space-x-2",children:[(0,a.jsxs)(S,{className:"w-6 h-6",children:[(0,a.jsx)(C,{src:"https://api.dicebear.com/5.x/initials/svg?seed=".concat(e),alt:e}),(0,a.jsx)(D,{children:e.slice(0,2)})]}),(0,a.jsx)("div",{className:"font-medium text-slate-700 dark:text-slate-400",children:e})]},s))})})]}),(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Events"})}),(0,a.jsx)(w.aY,{className:"h-24 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-2",children:m.map((e,s)=>(0,a.jsxs)("li",{children:[(0,a.jsx)("div",{className:"font-medium text-slate-700 dark:text-slate-400",children:e.type}),(0,a.jsx)("div",{className:"text-slate-500 dark:text-slate-500",children:e.data}),(0,a.jsx)("div",{className:"text-xs text-slate-400 dark:text-slate-600",children:new Date(e.timestamp).toLocaleString()})]},s))})})]}),(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Messages"})}),(0,a.jsx)(w.aY,{className:"h-64 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-4",children:d.map((e,t)=>(0,a.jsxs)("li",{className:"flex space-x-2",children:[(0,a.jsxs)(S,{className:"w-8 h-8",children:[(0,a.jsx)(C,{src:"https://api.dicebear.com/5.x/initials/svg?seed=".concat(e.data.nickName),alt:e.data.nickName}),(0,a.jsx)(D,{children:e.data.nickName.slice(0,2)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-semibold ".concat(e.data.nickName===s?"text-purple-600 dark:text-purple-400":"text-slate-700 dark:text-slate-400"),children:e.data.nickName}),(0,a.jsx)("div",{className:"text-slate-500 dark:text-slate-500",children:e.data.message}),(0,a.jsx)("div",{className:"text-xs text-slate-400 dark:text-slate-600",children:new Date(e.timestamp).toLocaleString()})]})]},t))})})]})]})]}),(0,a.jsxs)("div",{className:"bg-red-100 dark:bg-red-900 rounded-lg p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-red-600 dark:text-red-400",children:"Nostr"}),(0,a.jsx)(P.default,{src:"/nostr.png",alt:"Vercel",width:32,height:32,className:"h-6 w-6"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Connected Peers"})}),(0,a.jsx)(w.aY,{className:"h-24 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-2",children:c.map((e,s)=>(0,a.jsxs)("li",{className:"flex items-center space-x-2",children:[(0,a.jsxs)(S,{className:"w-6 h-6",children:[(0,a.jsx)(C,{src:"https://api.dicebear.com/5.x/initials/svg?seed=".concat(e),alt:e}),(0,a.jsx)(D,{children:e.slice(0,2)})]}),(0,a.jsx)("div",{className:"font-medium text-slate-700 dark:text-slate-400",children:e})]},s))})})]}),(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Events"})}),(0,a.jsx)(w.aY,{className:"h-24 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-2",children:r.map((e,s)=>(0,a.jsxs)("li",{children:[(0,a.jsx)("div",{className:"font-medium text-slate-700 dark:text-slate-400",children:e.type}),(0,a.jsx)("div",{className:"text-slate-500 dark:text-slate-500",children:e.data}),(0,a.jsx)("div",{className:"text-xs text-slate-400 dark:text-slate-600",children:new Date(e.timestamp).toLocaleString()})]},s))})})]}),(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Messages"})}),(0,a.jsx)(w.aY,{className:"h-64 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-4",children:n.map((e,t)=>(0,a.jsxs)("li",{className:"flex space-x-2",children:[(0,a.jsxs)(S,{className:"w-8 h-8",children:[(0,a.jsx)(C,{src:"https://api.dicebear.com/5.x/initials/svg?seed=".concat(e.data.nickName),alt:e.data.nickName}),(0,a.jsx)(D,{children:e.data.nickName.slice(0,2)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-semibold ".concat(e.data.nickName===s?"text-red-600 dark:text-red-400":"text-slate-700 dark:text-slate-400"),children:e.data.nickName}),(0,a.jsx)("div",{className:"text-slate-500 dark:text-slate-500",children:e.data.message}),(0,a.jsx)("div",{className:"text-xs text-slate-400 dark:text-slate-600",children:new Date(e.timestamp).toLocaleString()})]})]},t))})})]})]})]}),(0,a.jsxs)("div",{className:"bg-red-100 dark:bg-red-900 rounded-lg p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-red-600 dark:text-red-400",children:"GunDB"}),(0,a.jsx)(P.default,{src:"/gundb.png",alt:"Vercel",width:32,height:32,className:"h-6 w-6"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Events"})}),(0,a.jsx)(w.aY,{className:"h-24 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-2",children:E.map((e,s)=>(0,a.jsxs)("li",{children:[(0,a.jsx)("div",{className:"font-medium text-slate-700 dark:text-slate-400",children:e.type}),(0,a.jsx)("div",{className:"text-slate-500 dark:text-slate-500",children:e.data}),(0,a.jsx)("div",{className:"text-xs text-slate-400 dark:text-slate-600",children:new Date(e.timestamp).toLocaleString()})]},s))})})]}),(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Messages"})}),(0,a.jsx)(w.aY,{className:"h-64 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-4",children:R.map((e,t)=>(0,a.jsxs)("li",{className:"flex space-x-2",children:[(0,a.jsxs)(S,{className:"w-8 h-8",children:[(0,a.jsx)(C,{src:"https://api.dicebear.com/5.x/initials/svg?seed=".concat(e.data.nickName),alt:e.data.nickName}),(0,a.jsx)(D,{children:e.data.nickName.slice(0,2)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-semibold ".concat(e.data.nickName===s?"text-red-600 dark:text-red-400":"text-slate-700 dark:text-slate-400"),children:e.data.nickName}),(0,a.jsx)("div",{className:"text-slate-500 dark:text-slate-500",children:e.data.message}),(0,a.jsx)("div",{className:"text-xs text-slate-400 dark:text-slate-600",children:new Date(e.timestamp).toLocaleString()})]})]},t))})})]})]})]}),(0,a.jsxs)("div",{className:"bg-emerald-100 dark:bg-emerald-900 rounded-lg p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-emerald-600 dark:text-emerald-400",children:"Waku"}),(0,a.jsx)(P.default,{src:"/waku.svg",alt:"Vercel",width:32,height:32,className:"h-6 w-6"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Connected Peers (For relay)"})}),(0,a.jsx)(w.aY,{className:"h-24 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-2",children:g.map((e,s)=>(0,a.jsxs)("li",{className:"flex items-center space-x-2",children:[(0,a.jsxs)(S,{className:"w-6 h-6",children:[(0,a.jsx)(C,{src:"https://api.dicebear.com/5.x/initials/svg?seed=".concat(e.slice(-2)),alt:e}),(0,a.jsx)(D,{children:e.slice(-2)})]}),(0,a.jsx)("div",{className:"font-medium text-slate-700 dark:text-slate-400",children:e})]},s))})})]}),(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Events"})}),(0,a.jsx)(w.aY,{className:"h-24 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-2",children:p.map((e,s)=>(0,a.jsxs)("li",{children:[(0,a.jsx)("div",{className:"font-medium text-slate-700 dark:text-slate-400",children:e.type}),(0,a.jsx)("div",{className:"text-slate-500 dark:text-slate-500",children:JSON.stringify(e.data)}),(0,a.jsx)("div",{className:"text-xs text-slate-400 dark:text-slate-600",children:new Date(e.timestamp).toLocaleString()})]},s))})})]}),(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Messages"})}),(0,a.jsx)(w.aY,{className:"h-64 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-4",children:h.map((e,t)=>(0,a.jsxs)("li",{className:"flex space-x-2",children:[(0,a.jsxs)(S,{className:"w-8 h-8",children:[(0,a.jsx)(C,{src:"https://api.dicebear.com/5.x/initials/svg?seed=".concat(e.data.sender),alt:e.data.sender}),(0,a.jsx)(D,{children:e.data.sender.slice(0,2)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-semibold ".concat(e.data.sender===s?"text-emerald-600 dark:text-emerald-400":"text-slate-700 dark:text-slate-400"),children:e.data.sender}),(0,a.jsx)("div",{className:"text-slate-500 dark:text-slate-500",children:e.data.message}),(0,a.jsx)("div",{className:"text-xs text-slate-400 dark:text-slate-600",children:new Date(e.timestamp).toLocaleString()})]})]},t))})})]})]})]}),(0,a.jsxs)("div",{className:"bg-sky-100 dark:bg-sky-900 rounded-lg p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-sky-600 dark:text-sky-400",children:"NKN"}),(0,a.jsx)(P.default,{src:"/nkn.png",alt:"Vercel",width:32,height:32,className:"h-6 w-6"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Subscribers"})}),(0,a.jsx)(w.aY,{className:"h-24 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-2",children:U.map((e,s)=>(0,a.jsxs)("li",{className:"flex items-center space-x-2",children:[(0,a.jsxs)(S,{className:"w-6 h-6",children:[(0,a.jsx)(C,{src:"https://api.dicebear.com/5.x/initials/svg?seed=".concat(e.slice(-4,-2)),alt:e}),(0,a.jsx)(D,{children:e.slice(0,2)})]}),(0,a.jsx)("div",{className:"font-medium text-slate-700 dark:text-slate-400",children:e})]},s))})})]}),(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Events"})}),(0,a.jsx)(w.aY,{className:"h-24 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-2",children:k.map((e,s)=>(0,a.jsxs)("li",{children:[(0,a.jsx)("div",{className:"font-medium text-slate-700 dark:text-slate-400",children:e.type}),(0,a.jsx)("div",{className:"text-slate-500 dark:text-slate-500",children:e.data}),(0,a.jsx)("div",{className:"text-xs text-slate-400 dark:text-slate-600",children:new Date(e.timestamp).toLocaleString()})]},s))})})]}),(0,a.jsxs)(w.Zb,{children:[(0,a.jsx)(w.Ol,{children:(0,a.jsx)(w.ll,{children:"Messages"})}),(0,a.jsx)(w.aY,{className:"h-64 overflow-y-auto",children:(0,a.jsx)("ul",{className:"text-sm space-y-4",children:y.map((e,t)=>(0,a.jsxs)("li",{className:"flex space-x-2",children:[(0,a.jsxs)(S,{className:"w-8 h-8",children:[(0,a.jsx)(C,{src:"https://api.dicebear.com/5.x/initials/svg?seed=".concat(e.data.sender),alt:e.data.sender}),(0,a.jsx)(D,{children:e.data.sender.slice(0,2)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-semibold ".concat(e.data.sender===s?"text-sky-600 dark:text-sky-400":"text-slate-700 dark:text-slate-400"),children:e.data.sender}),(0,a.jsx)("div",{className:"text-slate-500 dark:text-slate-500",children:e.data.message}),(0,a.jsx)("div",{className:"text-xs text-slate-400 dark:text-slate-600",children:new Date(e.timestamp).toLocaleString()})]})]},t))})})]})]})]})]})]})})};var Y=()=>{let[e,s]=(0,l.useState)(""),t=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{e||t.current||(t.current=!0,(async()=>{let e=await fetch("https://randomuser.me/api/"),t=await e.json();t.results.length>0&&s("".concat(t.results[0].name.title," ").concat(t.results[0].name.first," ").concat(t.results[0].name.last))})())},[e]),e&&(0,a.jsx)(L,{nodeName:e})||null}},89733:function(e,s,t){"use strict";t.d(s,{z:function(){return d}});var a=t(57437),l=t(2265),n=t(71538),r=t(12218),c=t(49354);let i=(0,r.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),d=l.forwardRef((e,s)=>{let{className:t,variant:l,size:r,asChild:d=!1,...o}=e,m=d?n.g7:"button";return(0,a.jsx)(m,{className:(0,c.cn)(i({variant:l,size:r,className:t})),ref:s,...o})});d.displayName="Button"},48185:function(e,s,t){"use strict";t.d(s,{Ol:function(){return c},Zb:function(){return r},aY:function(){return d},ll:function(){return i}});var a=t(57437),l=t(2265),n=t(49354);let r=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)("div",{ref:s,className:(0,n.cn)("rounded-xl border bg-card text-card-foreground shadow",t),...l})});r.displayName="Card";let c=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)("div",{ref:s,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",t),...l})});c.displayName="CardHeader";let i=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)("h3",{ref:s,className:(0,n.cn)("font-semibold leading-none tracking-tight",t),...l})});i.displayName="CardTitle",l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)("p",{ref:s,className:(0,n.cn)("text-sm text-muted-foreground",t),...l})}).displayName="CardDescription";let d=l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)("div",{ref:s,className:(0,n.cn)("p-6 pt-0",t),...l})});d.displayName="CardContent",l.forwardRef((e,s)=>{let{className:t,...l}=e;return(0,a.jsx)("div",{ref:s,className:(0,n.cn)("flex items-center p-6 pt-0",t),...l})}).displayName="CardFooter"},77209:function(e,s,t){"use strict";t.d(s,{I:function(){return r}});var a=t(57437),l=t(2265),n=t(49354);let r=l.forwardRef((e,s)=>{let{className:t,type:l,...r}=e;return(0,a.jsx)("input",{type:l,className:(0,n.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...r})});r.displayName="Input"},49354:function(e,s,t){"use strict";t.d(s,{cn:function(){return n}});var a=t(44839),l=t(96164);function n(){for(var e=arguments.length,s=Array(e),t=0;t{let{x:t,y:n,source:r}=e,[l,o]=(0,s.useState)(!0);return((0,s.useEffect)(()=>{let e=setTimeout(()=>{o(!1)},1e3);return()=>{clearTimeout(e)}},[]),l)?(0,a.jsxs)("span",{className:"absolute animate-pulse",style:{left:t,top:n},children:[(0,a.jsx)("span",{className:"text-4xl",children:"❤️"}),(0,a.jsx)("br",{}),(0,a.jsx)("span",{className:"absolute text-sm",children:r})]}):null};t.default=()=>{let[e,t]=(0,s.useState)(""),[n,g]=(0,s.useState)(null),[w,x]=(0,s.useState)(null),[N,k]=(0,s.useState)(null),[P,b]=(0,s.useState)(null),[h,R]=(0,s.useState)(null),[E,v]=(0,s.useState)([]),[I,T]=(0,s.useState)(null);(0,s.useEffect)(()=>{T((0,p.e)((0,y.ri)().p2pSettings))},[]);let j=(0,s.useRef)(!1);(0,s.useEffect)(()=>{(async()=>{if(!j.current&&n&&I){j.current=!0,console.log("Initializing GunP2PNetworkInstance...");let e=new l.p(n.synthientId,{gunPeers:I.PEWPEW.bootstrapPeers,gunTopic:I.PEWPEW.topic,startupDelayMs:I.PEWPEW.bootFixedDelayMs});x(e),console.log("GunP2PNetworkInstance initialized."),console.log("Initializing NknP2PNetworkInstance...");let t=new u.t(n.synthientId,{nknTopic:I.NKN.topic,nknWalletPassword:"password"},I.NKN);k(t),console.log("Initializing TrysteroP2PNetworkInstance...");let a=new f.f(n.synthientId,{relayRedundancy:I.TRYSTERO.relayRedundancy,rtcConfig:I.TRYSTERO.rtcConfig,trysteroTopic:I.TRYSTERO.topic,trysteroAppId:I.TRYSTERO.appId,trysteroType:"nostr"},I.TRYSTERO);b(a),await Promise.all([e.waitForReady(),t.waitForReady(),a.waitForReady()]),console.log("Initializing PacketDB...");let s=new o.j(n,async n=>{await Promise.all([e.broadcastPacket(n),t.broadcastPacket(n),a.broadcastPacket(n)])});R(s),console.log("PacketDB initialized."),window.packetDB=s,j.current=!1}})()},[n,I]),(0,s.useEffect)(()=>{w&&h&&(console.log("Listening for packets..."),w.listenForPacket(async e=>{console.log("Received packet from Gun:",e),await h.receivePacket(e)}))},[w,h]),(0,s.useEffect)(()=>{N&&h&&(console.log("Listening for packets..."),N.listenForPacket(async e=>{console.log("Received packet from NKN:",e),await h.receivePacket(e)}))},[N,h]),(0,s.useEffect)(()=>{P&&h&&(console.log("Listening for packets..."),P.listenForPacket(async e=>{console.log("Received packet from Trystero:",e),await h.receivePacket(e)}))},[P,h]);let S=async t=>{if("Enter"===t.key){console.log("Initializing identity...");let t=await (0,r.K6)(e);g(t),console.log("Identity initialized:",t)}},C=async e=>{if(h){let t={type:"peerHeart",windowX:e.clientX,windowY:e.clientY,createdAt:(0,d.MQ)(new Date)};console.log("Sending heart:",t),await h.transmitPacket(t)}};return(0,a.jsxs)("div",{onClick:C,className:"relative h-screen",children:[n?(0,a.jsx)(i.Zb,{className:"absolute top-4 left-4",children:(0,a.jsxs)("p",{children:["synthientId: ",n.synthientId]})}):(0,a.jsx)(i.Zb,{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2",children:(0,a.jsx)(c.I,{type:"password",placeholder:"Enter password",value:e,onChange:e=>t(e.target.value),onKeyPress:S})}),E.map(e=>(0,a.jsx)(m,{x:e.x,y:e.y,source:e.source},e.id))]})}},48185:function(e,t,n){"use strict";n.d(t,{Ol:function(){return o},Zb:function(){return l},aY:function(){return c},ll:function(){return i}});var a=n(57437),s=n(2265),r=n(49354);let l=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("div",{ref:t,className:(0,r.cn)("rounded-xl border bg-card text-card-foreground shadow",n),...s})});l.displayName="Card";let o=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("div",{ref:t,className:(0,r.cn)("flex flex-col space-y-1.5 p-6",n),...s})});o.displayName="CardHeader";let i=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("h3",{ref:t,className:(0,r.cn)("font-semibold leading-none tracking-tight",n),...s})});i.displayName="CardTitle",s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("p",{ref:t,className:(0,r.cn)("text-sm text-muted-foreground",n),...s})}).displayName="CardDescription";let c=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("div",{ref:t,className:(0,r.cn)("p-6 pt-0",n),...s})});c.displayName="CardContent",s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)("div",{ref:t,className:(0,r.cn)("flex items-center p-6 pt-0",n),...s})}).displayName="CardFooter"},77209:function(e,t,n){"use strict";n.d(t,{I:function(){return l}});var a=n(57437),s=n(2265),r=n(49354);let l=s.forwardRef((e,t)=>{let{className:n,type:s,...l}=e;return(0,a.jsx)("input",{type:s,className:(0,r.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",n),ref:t,...l})});l.displayName="Input"}},function(e){e.O(0,[443,218,864,868,708,955,881,141,556,971,23,744],function(){return e(e.s=9747)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/layout-9e4af58933956f5d.js b/_next/static/chunks/app/layout-9e4af58933956f5d.js new file mode 100644 index 0000000000000000000000000000000000000000..2ac4df2d7f3d2f676311d907df761fed27479384 --- /dev/null +++ b/_next/static/chunks/app/layout-9e4af58933956f5d.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{51857:function(e,t,r){Promise.resolve().then(r.bind(r,91048)),Promise.resolve().then(r.bind(r,16502)),Promise.resolve().then(r.bind(r,52515)),Promise.resolve().then(r.bind(r,38507)),Promise.resolve().then(r.bind(r,44581)),Promise.resolve().then(r.bind(r,36756)),Promise.resolve().then(r.bind(r,76895)),Promise.resolve().then(r.bind(r,2738)),Promise.resolve().then(r.bind(r,23195)),Promise.resolve().then(r.bind(r,17584)),Promise.resolve().then(r.bind(r,62187)),Promise.resolve().then(r.bind(r,16808)),Promise.resolve().then(r.bind(r,84285)),Promise.resolve().then(r.bind(r,77959)),Promise.resolve().then(r.bind(r,37654)),Promise.resolve().then(r.bind(r,11416)),Promise.resolve().then(r.bind(r,76484)),Promise.resolve().then(r.bind(r,62381)),Promise.resolve().then(r.bind(r,19829)),Promise.resolve().then(r.bind(r,90393)),Promise.resolve().then(r.bind(r,37967)),Promise.resolve().then(r.bind(r,63817)),Promise.resolve().then(r.bind(r,32039)),Promise.resolve().then(r.bind(r,15961)),Promise.resolve().then(r.bind(r,67738)),Promise.resolve().then(r.bind(r,42594)),Promise.resolve().then(r.bind(r,36982)),Promise.resolve().then(r.bind(r,90448)),Promise.resolve().then(r.bind(r,29340)),Promise.resolve().then(r.bind(r,16823)),Promise.resolve().then(r.bind(r,22794)),Promise.resolve().then(r.t.bind(r,64671,23)),Promise.resolve().then(r.t.bind(r,27131,23)),Promise.resolve().then(r.t.bind(r,53054,23)),Promise.resolve().then(r.t.bind(r,44069,23)),Promise.resolve().then(r.bind(r,42371))},42371:function(e,t,r){"use strict";r.d(t,{Toaster:function(){return en}});var n=r(57437),o=r(2265),s=r(4867),a=r(22988),i=r(54887),l=r(78149),d=r(1584),u=r(90976),c=r(98324),p=r(53938),f=r(56935),m=r(31383),v=r(25171),w=r(75137),E=r(91715),h=r(1336),b=r(31725);let y="ToastProvider",[T,x,g]=(0,u.B)("Toast"),[P,_]=(0,c.b)("Toast",[g]),[R,S]=P(y),C=e=>{let{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:a=50,children:i}=e,[l,d]=(0,o.useState)(null),[u,c]=(0,o.useState)(0),p=(0,o.useRef)(!1),f=(0,o.useRef)(!1);return(0,o.createElement)(T.Provider,{scope:t},(0,o.createElement)(R,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:a,toastCount:u,viewport:l,onViewportChange:d,onToastAdd:(0,o.useCallback)(()=>c(e=>e+1),[]),onToastRemove:(0,o.useCallback)(()=>c(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:f},i))};C.propTypes={label:e=>e.label&&"string"==typeof e.label&&!e.label.trim()?Error(`Invalid prop \`label\` supplied to \`${y}\`. Expected non-empty \`string\`.`):null};let N=["F8"],D="toast.viewportPause",A="toast.viewportResume",I=(0,o.forwardRef)((e,t)=>{let{__scopeToast:r,hotkey:n=N,label:s="Notifications ({hotkey})",...i}=e,l=S("ToastViewport",r),u=x(r),c=(0,o.useRef)(null),f=(0,o.useRef)(null),m=(0,o.useRef)(null),w=(0,o.useRef)(null),E=(0,d.e)(t,w,l.onViewportChange),h=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=l.toastCount>0;(0,o.useEffect)(()=>{let e=e=>{var t;n.every(t=>e[t]||e.code===t)&&(null===(t=w.current)||void 0===t||t.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n]),(0,o.useEffect)(()=>{let e=c.current,t=w.current;if(b&&e&&t){let r=()=>{if(!l.isClosePausedRef.current){let e=new CustomEvent(D);t.dispatchEvent(e),l.isClosePausedRef.current=!0}},n=()=>{if(l.isClosePausedRef.current){let e=new CustomEvent(A);t.dispatchEvent(e),l.isClosePausedRef.current=!1}},o=t=>{e.contains(t.relatedTarget)||n()},s=()=>{e.contains(document.activeElement)||n()};return e.addEventListener("focusin",r),e.addEventListener("focusout",o),e.addEventListener("pointermove",r),e.addEventListener("pointerleave",s),window.addEventListener("blur",r),window.addEventListener("focus",n),()=>{e.removeEventListener("focusin",r),e.removeEventListener("focusout",o),e.removeEventListener("pointermove",r),e.removeEventListener("pointerleave",s),window.removeEventListener("blur",r),window.removeEventListener("focus",n)}}},[b,l.isClosePausedRef]);let y=(0,o.useCallback)(({tabbingDirection:e})=>{let t=u().map(t=>{let r=t.ref.current,n=[r,...function(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}(r)];return"forwards"===e?n:n.reverse()});return("forwards"===e?t.reverse():t).flat()},[u]);return(0,o.useEffect)(()=>{let e=w.current;if(e){let t=t=>{let r=t.altKey||t.ctrlKey||t.metaKey;if("Tab"===t.key&&!r){var n,o,s;let r=document.activeElement,a=t.shiftKey;if(t.target===e&&a){null===(n=f.current)||void 0===n||n.focus();return}let i=y({tabbingDirection:a?"backwards":"forwards"}),l=i.findIndex(e=>e===r);q(i.slice(l+1))?t.preventDefault():a?null===(o=f.current)||void 0===o||o.focus():null===(s=m.current)||void 0===s||s.focus()}};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}},[u,y]),(0,o.createElement)(p.I0,{ref:c,role:"region","aria-label":s.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:b?void 0:"none"}},b&&(0,o.createElement)(M,{ref:f,onFocusFromOutsideViewport:()=>{q(y({tabbingDirection:"forwards"}))}}),(0,o.createElement)(T.Slot,{scope:r},(0,o.createElement)(v.WV.ol,(0,a.Z)({tabIndex:-1},i,{ref:E}))),b&&(0,o.createElement)(M,{ref:m,onFocusFromOutsideViewport:()=>{q(y({tabbingDirection:"backwards"}))}}))}),M=(0,o.forwardRef)((e,t)=>{let{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,i=S("ToastFocusProxy",r);return(0,o.createElement)(b.T,(0,a.Z)({"aria-hidden":!0,tabIndex:0},s,{ref:t,style:{position:"fixed"},onFocus:e=>{var t;let r=e.relatedTarget;null!==(t=i.viewport)&&void 0!==t&&t.contains(r)||n()}}))}),F="Toast",k=(0,o.forwardRef)((e,t)=>{let{forceMount:r,open:n,defaultOpen:s,onOpenChange:i,...d}=e,[u=!0,c]=(0,E.T)({prop:n,defaultProp:s,onChange:i});return(0,o.createElement)(m.z,{present:r||u},(0,o.createElement)(j,(0,a.Z)({open:u},d,{ref:t,onClose:()=>c(!1),onPause:(0,w.W)(e.onPause),onResume:(0,w.W)(e.onResume),onSwipeStart:(0,l.M)(e.onSwipeStart,e=>{e.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:(0,l.M)(e.onSwipeMove,e=>{let{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","move"),e.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${r}px`)}),onSwipeCancel:(0,l.M)(e.onSwipeCancel,e=>{e.currentTarget.setAttribute("data-swipe","cancel"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:(0,l.M)(e.onSwipeEnd,e=>{let{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","end"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${r}px`),c(!1)})})))}),[L,O]=P(F,{onClose(){}}),j=(0,o.forwardRef)((e,t)=>{let{__scopeToast:r,type:n="foreground",duration:s,open:u,onClose:c,onEscapeKeyDown:f,onPause:m,onResume:E,onSwipeStart:h,onSwipeMove:b,onSwipeCancel:y,onSwipeEnd:x,...g}=e,P=S(F,r),[_,R]=(0,o.useState)(null),C=(0,d.e)(t,e=>R(e)),N=(0,o.useRef)(null),I=(0,o.useRef)(null),M=s||P.duration,k=(0,o.useRef)(0),O=(0,o.useRef)(M),j=(0,o.useRef)(0),{onToastAdd:K,onToastRemove:W}=P,Z=(0,w.W)(()=>{var e;(null==_?void 0:_.contains(document.activeElement))&&(null===(e=P.viewport)||void 0===e||e.focus()),c()}),$=(0,o.useCallback)(e=>{e&&e!==1/0&&(window.clearTimeout(j.current),k.current=new Date().getTime(),j.current=window.setTimeout(Z,e))},[Z]);(0,o.useEffect)(()=>{let e=P.viewport;if(e){let t=()=>{$(O.current),null==E||E()},r=()=>{let e=new Date().getTime()-k.current;O.current=O.current-e,window.clearTimeout(j.current),null==m||m()};return e.addEventListener(D,r),e.addEventListener(A,t),()=>{e.removeEventListener(D,r),e.removeEventListener(A,t)}}},[P.viewport,M,m,E,$]),(0,o.useEffect)(()=>{u&&!P.isClosePausedRef.current&&$(M)},[u,M,P.isClosePausedRef,$]),(0,o.useEffect)(()=>(K(),()=>W()),[K,W]);let U=(0,o.useMemo)(()=>_?function e(t){let r=[];return Array.from(t.childNodes).forEach(t=>{if(t.nodeType===t.TEXT_NODE&&t.textContent&&r.push(t.textContent),t.nodeType===t.ELEMENT_NODE){let n=t.ariaHidden||t.hidden||"none"===t.style.display,o=""===t.dataset.radixToastAnnounceExclude;if(!n){if(o){let e=t.dataset.radixToastAnnounceAlt;e&&r.push(e)}else r.push(...e(t))}}}),r}(_):null,[_]);return P.viewport?(0,o.createElement)(o.Fragment,null,U&&(0,o.createElement)(V,{__scopeToast:r,role:"status","aria-live":"foreground"===n?"assertive":"polite","aria-atomic":!0},U),(0,o.createElement)(L,{scope:r,onClose:Z},(0,i.createPortal)((0,o.createElement)(T.ItemSlot,{scope:r},(0,o.createElement)(p.fC,{asChild:!0,onEscapeKeyDown:(0,l.M)(f,()=>{P.isFocusedToastEscapeKeyDownRef.current||Z(),P.isFocusedToastEscapeKeyDownRef.current=!1})},(0,o.createElement)(v.WV.li,(0,a.Z)({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":u?"open":"closed","data-swipe-direction":P.swipeDirection},g,{ref:C,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:(0,l.M)(e.onKeyDown,e=>{"Escape"!==e.key||(null==f||f(e.nativeEvent),e.nativeEvent.defaultPrevented||(P.isFocusedToastEscapeKeyDownRef.current=!0,Z()))}),onPointerDown:(0,l.M)(e.onPointerDown,e=>{0===e.button&&(N.current={x:e.clientX,y:e.clientY})}),onPointerMove:(0,l.M)(e.onPointerMove,e=>{if(!N.current)return;let t=e.clientX-N.current.x,r=e.clientY-N.current.y,n=!!I.current,o=["left","right"].includes(P.swipeDirection),s=["left","up"].includes(P.swipeDirection)?Math.min:Math.max,a=o?s(0,t):0,i=o?0:s(0,r),l="touch"===e.pointerType?10:2,d={x:a,y:i},u={originalEvent:e,delta:d};n?(I.current=d,H("toast.swipeMove",b,u,{discrete:!1})):X(d,P.swipeDirection,l)?(I.current=d,H("toast.swipeStart",h,u,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>l||Math.abs(r)>l)&&(N.current=null)}),onPointerUp:(0,l.M)(e.onPointerUp,e=>{let t=I.current,r=e.target;if(r.hasPointerCapture(e.pointerId)&&r.releasePointerCapture(e.pointerId),I.current=null,N.current=null,t){let r=e.currentTarget,n={originalEvent:e,delta:t};X(t,P.swipeDirection,P.swipeThreshold)?H("toast.swipeEnd",x,n,{discrete:!0}):H("toast.swipeCancel",y,n,{discrete:!0}),r.addEventListener("click",e=>e.preventDefault(),{once:!0})}})})))),P.viewport))):null});j.propTypes={type:e=>e.type&&!["foreground","background"].includes(e.type)?Error(`Invalid prop \`type\` supplied to \`${F}\`. Expected \`foreground | background\`.`):null};let V=e=>{let{__scopeToast:t,children:r,...n}=e,s=S(F,t),[a,i]=(0,o.useState)(!1),[l,d]=(0,o.useState)(!1);return function(e=()=>{}){let t=(0,w.W)(e);(0,h.b)(()=>{let e=0,r=0;return e=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(r)}},[t])}(()=>i(!0)),(0,o.useEffect)(()=>{let e=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(e)},[]),l?null:(0,o.createElement)(f.h,{asChild:!0},(0,o.createElement)(b.T,n,a&&(0,o.createElement)(o.Fragment,null,s.label," ",r)))},K=(0,o.forwardRef)((e,t)=>{let{__scopeToast:r,...n}=e;return(0,o.createElement)(v.WV.div,(0,a.Z)({},n,{ref:t}))}),W=(0,o.forwardRef)((e,t)=>{let{__scopeToast:r,...n}=e;return(0,o.createElement)(v.WV.div,(0,a.Z)({},n,{ref:t}))}),Z=(0,o.forwardRef)((e,t)=>{let{altText:r,...n}=e;return r?(0,o.createElement)(U,{altText:r,asChild:!0},(0,o.createElement)($,(0,a.Z)({},n,{ref:t}))):null});Z.propTypes={altText:e=>e.altText?null:Error("Missing prop `altText` expected on `ToastAction`")};let $=(0,o.forwardRef)((e,t)=>{let{__scopeToast:r,...n}=e,s=O("ToastClose",r);return(0,o.createElement)(U,{asChild:!0},(0,o.createElement)(v.WV.button,(0,a.Z)({type:"button"},n,{ref:t,onClick:(0,l.M)(e.onClick,s.onClose)})))}),U=(0,o.forwardRef)((e,t)=>{let{__scopeToast:r,altText:n,...s}=e;return(0,o.createElement)(v.WV.div,(0,a.Z)({"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0},s,{ref:t}))});function H(e,t,r,{discrete:n}){let o=r.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?(0,v.jH)(o,s):o.dispatchEvent(s)}let X=(e,t,r=0)=>{let n=Math.abs(e.x),o=Math.abs(e.y),s=n>o;return"left"===t||"right"===t?s&&n>r:!s&&o>r};function q(e){let t=document.activeElement;return e.some(e=>e===t||(e.focus(),document.activeElement!==t))}var z=r(12218),B=r(49354);let Y=o.forwardRef((e,t)=>{let{className:r,...o}=e;return(0,n.jsx)(I,{ref:t,className:(0,B.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",r),...o})});Y.displayName=I.displayName;let G=(0,z.j)("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),J=o.forwardRef((e,t)=>{let{className:r,variant:o,...s}=e;return(0,n.jsx)(k,{ref:t,className:(0,B.cn)(G({variant:o}),r),...s})});J.displayName=k.displayName,o.forwardRef((e,t)=>{let{className:r,...o}=e;return(0,n.jsx)(Z,{ref:t,className:(0,B.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",r),...o})}).displayName=Z.displayName;let Q=o.forwardRef((e,t)=>{let{className:r,...o}=e;return(0,n.jsx)($,{ref:t,className:(0,B.cn)("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",r),"toast-close":"",...o,children:(0,n.jsx)(s.Pxu,{className:"h-4 w-4"})})});Q.displayName=$.displayName;let ee=o.forwardRef((e,t)=>{let{className:r,...o}=e;return(0,n.jsx)(K,{ref:t,className:(0,B.cn)("text-sm font-semibold [&+div]:text-xs",r),...o})});ee.displayName=K.displayName;let et=o.forwardRef((e,t)=>{let{className:r,...o}=e;return(0,n.jsx)(W,{ref:t,className:(0,B.cn)("text-sm opacity-90",r),...o})});et.displayName=W.displayName;var er=r(78068);function en(){let{toasts:e}=(0,er.pm)();return(0,n.jsxs)(C,{children:[e.map(function(e){let{id:t,title:r,description:o,action:s,...a}=e;return(0,n.jsxs)(J,{...a,children:[(0,n.jsxs)("div",{className:"grid gap-1",children:[r&&(0,n.jsx)(ee,{children:r}),o&&(0,n.jsx)(et,{children:o})]}),s,(0,n.jsx)(Q,{})]},t)}),(0,n.jsx)(Y,{})]})}},78068:function(e,t,r){"use strict";r.d(t,{Am:function(){return c},pm:function(){return p}});var n=r(2265);let o=0,s=new Map,a=e=>{if(s.has(e))return;let t=setTimeout(()=>{s.delete(e),u({type:"REMOVE_TOAST",toastId:e})},1e6);s.set(e,t)},i=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?a(r):e.toasts.forEach(e=>{a(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},l=[],d={toasts:[]};function u(e){d=i(d,e),l.forEach(e=>{e(d)})}function c(e){let{...t}=e,r=(o=(o+1)%Number.MAX_SAFE_INTEGER).toString(),n=()=>u({type:"DISMISS_TOAST",toastId:r});return u({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:e=>{e||n()}}}),{id:r,dismiss:n,update:e=>u({type:"UPDATE_TOAST",toast:{...e,id:r}})}}function p(){let[e,t]=n.useState(d);return n.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:c,dismiss:e=>u({type:"DISMISS_TOAST",toastId:e})}}},49354:function(e,t,r){"use strict";r.d(t,{cn:function(){return s}});var n=r(44839),o=r(96164);function s(){for(var e=arguments.length,t=Array(e),r=0;r{let{ratio:r=1,style:a,...i}=e;return(0,o.createElement)("div",{style:{position:"relative",width:"100%",paddingBottom:`${100/r}%`},"data-radix-aspect-ratio-wrapper":""},(0,o.createElement)(s.WV.div,(0,n.Z)({},i,{ref:t,style:{...a,position:"absolute",top:0,right:0,bottom:0,left:0}})))})},77959:function(e,t,r){"use strict";r.r(t),r.d(t,{Portal:function(){return n.h}});var n=r(56935)},22794:function(e,t,r){"use strict";r.r(t),r.d(t,{VisuallyHidden:function(){return n.T}});var n=r(31725)}},function(e){e.O(0,[51,532,310,868,297,786,813,971,23,744],function(){return e(e.s=51857)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/app/page-0650d8116c8fa2b9.js b/_next/static/chunks/app/page-0650d8116c8fa2b9.js new file mode 100644 index 0000000000000000000000000000000000000000..95e051476d3c286599d286d8f5e9dac0236276c0 --- /dev/null +++ b/_next/static/chunks/app/page-0650d8116c8fa2b9.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{65125:function(e,t,s){Promise.resolve().then(s.bind(s,85668))},85668:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return tf}});var n=s(57437),i=s(4867),r=s(34270),a=s(89028),o=s(2265),c=s(18951),d=s(78068),l=s(46260),u=s(80018),m=s(89183),h=s(14635),x=s(65530),p=s(69893),g=s(13201),f=s(36393),k=s(62052),y=s(68628),v=s(3682);let b=(0,k.hu)("Consensus Core",k.$5.consensusCore),q=(0,a.ri)().quorumSettings;async function w(e,t,s,n){b.debug("Consensus ".concat(e.requestId,": Running final consensus with ").concat(e.quorum.length," commits "),e);let i=Math.ceil(n.secPercentage*e.quorum.length);e.quorum=e.quorum.filter(e=>e.reveal),b.debug("Consensus ".concat(e.requestId,": Removed non-revealed commits, ").concat(e.quorum.length," commits remaining"));let r=[];if(e.quorum=(await Promise.all(e.quorum.map(async n=>{if(n.synthientId===s)return n;if(!n.reveal)return!1;let i=t.find(e=>e.text===n.reveal.output);if(!i)return b.error("Consensus ".concat(e.requestId,": Could not find verified embedding for revealed commit "),n," from results ",t),!1;let a=(0,y.Z)(n.reveal.bEmbedding,i.binaryEmbedding);if(a<1-q.bEmbeddingThreshold)return b.warn("Consensus ".concat(e.requestId,": Rejecting reveal for ").concat(n.inferenceId," from ").concat(n.synthientId," - our embeddings didn't match"),n," with similarity ",a," to verified embedding ",i," over threshold ",q.bEmbeddingThreshold),r.push({createdAt:(0,g.MQ)(new Date),type:"inferenceRevealRejected",requestId:e.requestId,inferenceId:n.inferenceId,rejectReason:{type:"computed_bembedding_fails_threshold",computedBEmbedding:i.binaryEmbedding,revealedBEmbedding:n.reveal.bEmbedding}}),!1;let o=await (0,v.TU)(Object.values(n.reveal.bEmbedding));return o!==n.bEmbeddingHash?(b.warn("Consensus ".concat(e.requestId,": Rejecting reveal for ").concat(n.inferenceId," from ").concat(n.synthientId," - our hash didn't match"),n," with hash mismatch ",o," !== ",n.bEmbeddingHash),r.push({createdAt:(0,g.MQ)(new Date),type:"inferenceRevealRejected",requestId:e.requestId,inferenceId:n.inferenceId,rejectReason:{type:"bembedding_hash_mismatch",computedBEmbeddingHash:o,revealedBEmbeddingHash:n.bEmbeddingHash,revealedBEmbedding:n.reveal.bEmbedding}}),!1):n}))).filter(e=>!1!==e),b.debug("Consensus ".concat(e.requestId,": Removed non-verified commits, ").concat(e.quorum.length," commits remaining")),e.quorum.lengtht+Math.pow(n-e.quorum[s].reveal.bEmbedding[i],2),0))}b.debug("Consensus ".concat(e.requestId,": Computed distances for ").concat(e.quorum.length," commits"),a);let o=a.map(e=>e.filter(e=>e({commitIndex:t,clusterSize:e.length}));b.debug("Consensus ".concat(e.requestId,": Computed cluster sizes for ").concat(e.quorum.length," commits"),o),b.debug("Consensus ".concat(e.requestId,": Computed cluster size needed for ").concat(e.quorum.length," commits: ").concat(i));let c=o.filter(e=>e.clusterSize>=i).sort((e,t)=>t.clusterSize-e.clusterSize);if(b.debug("Consensus ".concat(e.requestId,": Computed largest cluster sizes for ").concat(e.quorum.length," commits"),c),console.timeEnd("Computing clusters for ".concat(e.quorum.length," commits")),!c.length)return b.debug("Consensus ".concat(e.requestId,": No clusters found with size ").concat(i," or greater")),{requestId:e.requestId,success:!1,reason:"no_clusters_found_of_needed_size",debug:{clusterSizeNeeded:i,distances:a},rejectionPackets:r};let d=c[0];b.debug("Consensus ".concat(e.requestId,": Found largest cluster with size ").concat(d.clusterSize," at index ").concat(d.commitIndex));let l=a[d.commitIndex].map((e,t)=>!(e>=n.secDistance)&&t).filter(e=>!1!==e);b.debug("Consensus ".concat(e.requestId,": Accepted ").concat(l.length," inferences for largest cluster"),l);let u=l.map(t=>e.quorum[t]);b.debug("Consensus ".concat(e.requestId,": Accepted inferences for largest cluster"),u);let m=await (0,v.Wu)(e.requestId+u.map(e=>e.bEmbeddingHash+e.inferenceId).join("")),h=u[parseInt(m.slice(0,16),16)%u.length],x={type:"inferenceQuorumComputed",createdAt:(0,g.MQ)(new Date),requestId:e.requestId,verifiedBy:s,submittedInferences:e.quorum.map(e=>({inferenceId:e.inferenceId})),validInferences:u.map(e=>({inferenceId:e.inferenceId})),validInferenceJointHash:m,validSingleInference:{output:h.reveal.output,fromSynthientId:h.synthientId,bEmbeddingHash:h.bEmbeddingHash}};return b.debug("Consensus ".concat(e.requestId,": Computed Final inference quorum"),x),{rejectionPackets:r,success:!0,requestId:e.requestId,reason:"success",debug:{clusterSizeNeeded:i,distances:a},computedQuorumPacket:x}}let I=(0,k.hu)("QuorumDB",k.$5.databases.quorumDB),j=(0,a.ri)().quorumSettings;class R extends h.ZP{constructor(){super("QuorumDatabase"),this.version(2).stores({quorums:"requestId, status, endingAt, consensusRequestedAt"})}}class E extends h.ZP{constructor(){super("ConsensusResultsDatabase"),this.version(1).stores({consensusResults:"requestId, success, reason"})}}class D extends h.ZP{constructor(){super("ExternalConsensusResultsDatabase"),this.version(1).stores({consensusResults:"[requestId+verifiedBy]"})}}class A extends f.Z{async getQuorum(e){return this.db.quorums.get(e)}async getQuorums(e){return this.db.quorums.where("requestId").anyOf(e).toArray()}async getConsensusResults(e){return this.consensusResultsDB.consensusResults.where("requestId").anyOf(e).toArray()}async getExternalConsensusResults(e){return this.externalConsensusResultsDB.consensusResults.where("requestId").anyOf(e).toArray()}async checkQuorumsReadyForReveal(){I.debug("Checking quorums for reveal");let e=new Date,t=new Date(e.getTime()-j.quorumRevealRequestIssueTimeoutMs),s=(await this.db.quorums.where("endingAt").between(t,e).toArray()).filter(e=>"awaiting_commitments"===e.status),n=s.filter(e=>e.quorum.lengthe.status="failed"),await this.db.quorums.bulkPut(n).catch(h.ZP.BulkError,e=>{I.error("Failed to update quorums to failed",e)});let i=s.filter(e=>e.quorum.length>=e.quorumThreshold);I.debug("".concat(i.length," quorums passed commitment thresholds"),i),i.forEach(e=>e.status="awaiting_reveal"),await this.db.quorums.bulkPut(i).catch(h.ZP.BulkError,e=>{I.error("Failed to update quorums to awaiting_reveal for these quorums: ",e)}),i.length&&this.emit("requestReveal",i)}async processInferenceReveal(e){let t=await this.db.quorums.get(e.packet.requestId);if(!t){I.debug("No quorum found for reveal packet ".concat(e.packet.requestId),e);return}if(e.receivedTime&&e.receivedTime.getTime()>t.endingAt.getTime()+j.quorumRevealTimeoutMs){I.debug("Received reveal packet after reveal timeout, discarding.",e);return}let s=t.quorum.find(t=>t.synthientId===e.synthientId&&t.inferenceId===e.packet.inferenceId);if(!s){I.debug("No commit found for reveal packet",e);return}s.reveal||(s.reveal={embedding:e.packet.embedding,bEmbedding:e.packet.bEmbedding,output:e.packet.output,receivedAt:new Date},t.quorumRevealed+=1,await this.db.quorums.put(t),I.debug("Updated quorum with reveal",t),await this.checkQuorumsReadyForConsensus())}async checkQuorumsReadyForConsensus(){this.quorumConsensusTimeout&&clearTimeout(this.quorumConsensusTimeout);let e=new Date,t=new Date(e.getTime()-j.quorumRevealTimeoutMs),s=new Date(e.getTime()-j.quorumRevealTimeoutMs-j.quorumConsensusWindowMs),n=(await this.db.quorums.where("endingAt").between(s,t).toArray()).filter(e=>"awaiting_reveal"===e.status&&!e.consensusRequestedAt);for(let e of(I.debug("".concat(n.length," Quorums ready for consensus processing"),n),n)){if(e.quorumRevealede.synthientId===this.mySynthientId))}await this.db.quorums.bulkPut(n).catch(h.ZP.BulkError,e=>{I.error("Failed to update quorums to awaiting_consensus",e)});let i=(await this.db.quorums.where("endingAt").above(t).toArray()).filter(e=>"awaiting_reveal"===e.status).sort((e,t)=>e.endingAt.getTime()-t.endingAt.getTime());i.length&&(I.debug("Setting timeout for next quorum check: ".concat(i[0].endingAt.getTime()-Date.now()+j.quorumRevealTimeoutMs-10),i[0]),this.quorumConsensusTimeout=setTimeout(()=>this.checkQuorumsReadyForConsensus(),i[0].endingAt.getTime()+j.quorumRevealTimeoutMs-Date.now()+10))}async getQuorumConsensusQueue(){let e=new Date(new Date().getTime()-j.quorumConsensusWindowMs);return(await this.db.quorums.where("consensusRequestedAt").above(e).toArray()).filter(e=>!!e.consensusRequestedAt).sort((e,t)=>e.consensusRequestedAt.getTime()-t.consensusRequestedAt.getTime())}async refreshQuorumRevealTimeout(){this.quorumRevealTimeout&&clearTimeout(this.quorumRevealTimeout);let e=(await this.db.quorums.where("endingAt").above(new Date).toArray()).filter(e=>"awaiting_commitments"===e.status).sort((e,t)=>e.endingAt.getTime()-t.endingAt.getTime());I.trace("Got quorums for setting Timeout: ",e),e.length&&(this.quorumRevealTimeout=setTimeout(async()=>{I.debug("Checking to see if any quorums are ready for reveal"),await this.checkQuorumsReadyForReveal(),setTimeout(()=>this.refreshQuorumRevealTimeout(),0)},e[0].endingAt.getTime()-Date.now()))}async processExternalConsensus(e){if(await this.externalConsensusResultsDB.consensusResults.get([e.requestId,e.verifiedBy])){I.debug("Received redundant external consensus for ".concat(e.requestId," from ").concat(e.verifiedBy,", dropping"));return}this.externalConsensusResultsDB.consensusResults.put(e)}async processVerifiedConsensusEmbeddings(e,t){I.debug("Processing verified consensus embeddings for ".concat(e.requestId),t," for request: ",e),await this.db.quorums.update(e.requestId,{status:"verifying_consensus"});let s=await this.db.quorums.get(e.requestId);if(!s){I.error("No quorum found for request ".concat(e.requestId),e);return}let n=await w(s,t,this.mySynthientId,e.payload.securityFrame);I.debug("Final consensus computed for ".concat(e.requestId),n),this.consensusResultsDB.consensusResults.put(n);let i=n.rejectionPackets;n.success?(n.computedQuorumPacket&&i.push(n.computedQuorumPacket),this.db.quorums.update(e.requestId,{status:"completed"})):this.db.quorums.update(e.requestId,{status:"failed"}),this.emit("consensusPackets",i)}async processInferenceCommit(e,t){let s=await this.db.quorums.get(e.packet.requestId);I.debug("Received inference commit",e),s?s.quorum.find(t=>t.synthientId===e.synthientId&&t.inferenceId===e.packet.inferenceId)?I.debug("Commit already exists in quorum",s):(I.debug("Adding new commit to quorum",s),s.quorum.push({inferenceId:e.packet.inferenceId,synthientId:e.synthientId,bEmbeddingHash:e.packet.bEmbeddingHash,commitReceivedAt:new Date}),s.quorumCommitted+=1,this.db.quorums.put(s)):(I.debug("Creating new quorum for commit",e),this.db.quorums.put({requestId:e.packet.requestId,status:"awaiting_commitments",quorumThreshold:t.payload.securityFrame.quorum,endingAt:t.endingAt,quorumCommitted:1,quorumRevealed:0,embeddingModel:t.payload.securityFrame.embeddingModel,quorum:[{inferenceId:e.packet.inferenceId,synthientId:e.synthientId,bEmbeddingHash:e.packet.bEmbeddingHash,commitReceivedAt:new Date}]})),this.refreshQuorumRevealTimeout()}constructor(e){super(),this.mySynthientId=e,this.quorumRevealTimeout=null,this.quorumConsensusTimeout=null,this.db=new R,this.consensusResultsDB=new E,this.externalConsensusResultsDB=new D}}let C=(0,a.ri)().quorumSettings,S=(0,k.hu)("InferenceDB",k.$5.databases.inferenceDB);class _ extends h.ZP{constructor(e={}){super("InferenceEmbeddingDB",e),this.version(2).stores({inferenceEmbeddings:"inferenceId, requestId"})}}class T extends h.ZP{constructor(e={}){super("InferenceRequestDB",e),this.version(2).stores({inferenceRequests:"requestId, endingAt"})}}class P extends h.ZP{constructor(e={}){super("InferenceResultDB",e),this.version(2).stores({inferenceResults:"inferenceId, requestId"})}}class z extends f.Z{async completeBoot(){let e=(await this.inferenceResultDb.inferenceResults.toArray()).reduce((e,t)=>t.result.success?e+t.result.tokenCount:e,0);this.totalTokens+=e,S.debug("Our total inference tokens so far - ".concat(this.totalTokens)),this.refreshCleanupTimeout(),this.emit("bootComplete",this.totalTokens)}async processExternalConsensus(e){if(!await this.inferenceRequestDb.inferenceRequests.get(e.requestId)){S.error("No matching request for consensus packet for ".concat(e.requestId,", dropping"),e);return}await this.quorumDb.processExternalConsensus(e)}async getInferences(e){let t=await this.inferenceRequestDb.inferenceRequests.orderBy("endingAt").reverse().limit(e).toArray(),s=await this.inferenceResultDb.inferenceResults.where("requestId").anyOf(t.map(e=>e.requestId)).toArray(),n=await this.inferenceEmbeddingDb.inferenceEmbeddings.where("requestId").anyOf(t.map(e=>e.requestId)).toArray(),i=await this.quorumDb.getExternalConsensusResults(t.map(e=>e.requestId)),r=await this.quorumDb.getQuorums(t.map(e=>e.requestId)),a=await this.quorumDb.getConsensusResults(t.map(e=>e.requestId));return t.map(e=>{let t=s.find(t=>t.requestId===e.requestId),o=n.find(t=>t.requestId===e.requestId),c=r.find(t=>t.requestId===e.requestId),d=a.find(t=>t.requestId===e.requestId);return{requestId:e.requestId,requestedAt:e.payload.createdAt,endingAt:e.endingAt,fromSynthientId:e.fromSynthientId,requestPayload:e.payload,ourResult:t&&{payload:t,bEmbeddingHash:null==o?void 0:o.bEmbeddingHash},quorum:c&&{consensusRequestedAt:null==c?void 0:c.consensusRequestedAt,status:c.status,quorumThreshold:c.quorumThreshold,quorumCommitted:c.quorumCommitted,quorumRevealed:c.quorumRevealed,quorum:c.quorum.map(e=>({inferenceId:e.inferenceId,synthientId:e.synthientId,commitReceivedAt:e.commitReceivedAt,bEmbeddingHash:e.bEmbeddingHash,reveal:e.reveal&&{output:e.reveal.output,receivedAt:e.reveal.receivedAt}}))},consensusResult:d&&{status:d.reason,result:d.computedQuorumPacket&&{submittedInferences:d.computedQuorumPacket.submittedInferences,validInferences:d.computedQuorumPacket.validInferences,validInferenceJointHash:d.computedQuorumPacket.validInferenceJointHash,validInference:{output:d.computedQuorumPacket.validSingleInference.output,fromSynthientId:d.computedQuorumPacket.validSingleInference.fromSynthientId,bEmbeddingHash:d.computedQuorumPacket.validSingleInference.bEmbeddingHash}}},externalConsensuses:i.filter(t=>t.requestId===e.requestId).map(e=>({verifiedBy:e.verifiedBy,bEmbeddingHash:e.validSingleInference.bEmbeddingHash,validCommitments:e.validInferences.length,allCommitments:e.submittedInferences.length,output:e.validSingleInference.output,validInferenceBy:e.validSingleInference.fromSynthientId}))}})}emitRevealRequests(e){let t=e.map(e=>({createdAt:(0,g.MQ)(new Date),type:"inferenceRevealRequest",requestId:e.requestId,quorum:e.quorum.map(e=>({inferenceId:e.inferenceId,synthientId:e.synthientId,bEmbeddingHash:e.bEmbeddingHash})),timeoutMs:C.quorumRevealTimeoutMs}));S.debug("Emitting reveal requests for ".concat(t.length," packets"),t),this.emit("requestQuorumReveal",t)}refreshCleanupTimeout(){this.cleanupTimeout&&(clearTimeout(this.cleanupTimeout),this.cleanupTimeout=null);let e=new Date;if(this.activeInferenceRequests=this.activeInferenceRequests.filter(t=>t.endingAt>e),!this.activeInferenceRequests.length)return;let t=this.activeInferenceRequests.sort((e,t)=>e.endingAt.getTime()-t.endingAt.getTime());this.cleanupTimeout=setTimeout(()=>{this.cleanupExpiredInferences()},t[0].endingAt.getTime()-e.getTime())}async cleanupExpiredInferences(){let e=new Date,t=(await this.inferenceResultDb.inferenceResults.where("requestId").anyOf(this.activeInferenceRequests.map(e=>e.requestId)).toArray()).map(e=>e.requestId);this.activeInferenceRequests=this.activeInferenceRequests.filter(s=>!(s.endingAt<=e)&&!t.includes(s.requestId)),S.debug("Active inferences after cleanup: ".concat(this.activeInferenceRequests.length),this.activeInferenceRequests.length),this.activeInferenceRequests.length>0&&this.refreshCleanupTimeout()}async processInferenceReveal(e){if(!await this.inferenceRequestDb.inferenceRequests.get(e.packet.requestId)){S.error("No matching request for revealed inference, skipping ".concat(e.packet.requestId),e);return}this.quorumDb.processInferenceReveal(e)}async processVerifiedConsensusEmbeddings(e){if(!e.results){S.error("No results to process for verified embeddings we just did",e);return}let t=await this.inferenceRequestDb.inferenceRequests.get(e.requestId);if(!t){S.error("No matching request for verified embeddings to run final consensus",e);return}await this.quorumDb.processVerifiedConsensusEmbeddings(t,e.results)}async processInferenceRevealRequest(e){let t=await this.inferenceRequestDb.inferenceRequests.get(e.packet.requestId);if(!t){S.error("We were asked to reveal our inference. No matching request for reveal request ".concat(e.packet.requestId),e);return}if(t.endingAt>new Date){S.error("We were asked to reveal our inference. Request ".concat(t.requestId," is still active. Not revealing embeddings."));return}let s=e.packet.quorum.find(e=>e.synthientId===this.mySynthientId);if(!s){S.error("We were asked to reveal our inference. No matching commit with our synthient id for ".concat(e.packet.requestId),e);return}let n=await this.inferenceResultDb.inferenceResults.get(s.inferenceId);if(!n){S.error("We were asked to reveal our inference. No matching result for reveal request ".concat(e.packet.requestId),e);return}if(!n.result.success){S.error("We were asked to reveal our inference for ".concat(e.packet.requestId," - Result was not successful. Not revealing embeddings."));return}let i=await this.inferenceEmbeddingDb.inferenceEmbeddings.get(n.inferenceId);if(!i){S.error("No matching embedding for reveal request ".concat(e.packet.requestId),e);return}S.debug("Revealing our inference for ".concat(e.packet.requestId," to ").concat(e.synthientId)),this.emit("revealedInference",{createdAt:(0,g.MQ)(new Date),type:"inferenceReveal",requestedSynthientId:e.synthientId,requestId:t.requestId,inferenceId:n.inferenceId,output:n.result.result,embedding:i.embedding,bEmbedding:i.bEmbedding})}async saveInferenceEmbedding(e,t){if(!await this.inferenceResultDb.inferenceResults.get(e.inferenceId))throw Error("No matching inference result for embedding - ".concat(e.inferenceId));if(await this.inferenceEmbeddingDb.inferenceEmbeddings.get(t.inferenceId)){S.debug("Embedding already exists. Skipping save.");return}await this.inferenceEmbeddingDb.inferenceEmbeddings.put(t),this.emit("newInferenceEmbedding",t)}async saveInferenceResult(e){if(this.activeInferenceRequests=this.activeInferenceRequests.filter(t=>t.requestId!==e.requestId),await this.inferenceResultDb.inferenceResults.put(e),e.result.success){this.totalTokens=(this.totalTokens||0)+e.result.tokenCount;let t=await this.inferenceRequestDb.inferenceRequests.get(e.requestId);t&&t.endingAt>new Date&&this.emit("inferenceResultAwaitingEmbedding",t,e)}}async saveInferenceCommit(e){let t=await this.inferenceRequestDb.inferenceRequests.get(e.packet.requestId);if(!t){S.error("No matching inference request for commit to save ".concat(e.packet.requestId),e);return}await this.quorumDb.processInferenceCommit(e,t)}async saveInferenceRequest(e){var t;let s=Object.values(e.payload).join("");if(null!==(t=e.requestId)&&void 0!==t||(e.requestId=p.UG.bytesToHex((0,x.J)(s))+"."+(0,g.zs)(8)),await this.inferenceRequestDb.inferenceRequests.get(e.requestId)){S.trace("Inference request ".concat(e.requestId," already exists. Skipping save."));return}let n=new Date(new Date(e.payload.createdAt).getTime()+e.payload.securityFrame.maxTimeMs);e.endingAt=n;let i={...e,endingAt:n,requestId:e.requestId};S.debug("Saving ".concat(i.requestId," ending in ").concat((i.endingAt.getTime()-Date.now())/1e3,"s"),i),await this.inferenceRequestDb.inferenceRequests.put(i),n>new Date&&(this.activeInferenceRequests.push(i),S.debug("".concat(this.activeInferenceRequests.length," Active inferences after save")),this.refreshCleanupTimeout()),i.endingAt>new Date&&setTimeout(()=>this.emit("newActiveInferenceRequest",i),0),setTimeout(()=>this.emit("newInferenceRequest",i),0)}constructor(e,t={}){super(),this.mySynthientId=e,this.activeInferenceRequests=[],this.totalTokens=0,this.cleanupTimeout=null,this.inferenceRequestDb=new T(t),this.inferenceResultDb=new P(t),this.inferenceEmbeddingDb=new _(t),this.quorumDb=new A(e),this.quorumDb.on("requestReveal",e=>{this.emitRevealRequests(e)}),this.completeBoot()}}var B=s(24754),N=s(12683),V=s(37678),M=s(31406),Q=s(30701);let G=(0,k.hu)("Domain",k.$5.theDomain),F=(0,Q.e)((0,a.ri)().p2pSettings);class W{static createP2PNetworkInstance(e,t){switch(e){case"gun":return new V.p(t,{gunPeers:F.PEWPEW.bootstrapPeers,gunTopic:F.PEWPEW.topic,startupDelayMs:F.PEWPEW.bootFixedDelayMs});case"nkn":return new N.t(t,{nknTopic:F.NKN.topic,nknWalletPassword:"password"},F.NKN);case"nostr":return new M.f(t,{relayRedundancy:F.TRYSTERO.relayRedundancy,rtcConfig:F.TRYSTERO.rtcConfig,trysteroTopic:F.TRYSTERO.topic,trysteroAppId:F.TRYSTERO.appId,trysteroType:"nostr"},F.TRYSTERO);case"torrent":return new M.f(t,{relayRedundancy:F.TRYSTERO.relayRedundancy,rtcConfig:F.TRYSTERO.rtcConfig,trysteroTopic:F.TRYSTERO.topic,trysteroAppId:F.TRYSTERO.appId,trysteroType:"torrent"},F.TRYSTERO);default:throw Error("Unsupported P2P network: ".concat(e))}}static async initializeP2PNetworks(e,t){let s=e.map(e=>!1);if("timeout"===await Promise.race([(0,g.GR)(t),Promise.all(e.map((e,t)=>e.waitForReady().then(()=>s[t]=!0)))])&&(G.debug("Timed out waiting for all networks to load."),e.filter((e,t)=>!s[t]).length>=e.length))throw Error("No p2p networks could be loaded in time. Please check logs for errors.");return e.filter((e,t)=>s[t])}}var L=s(22170),H=s.n(L),O=s(28580);let Z=(0,k.hu)("Domain",k.$5.theDomain),Y=(0,a.ri)();class J{static getInstance(){return this.instance?this.instance:null}hookupConnections(){for(let e of this.p2pNetworkInstances){let t=e.listenForPacket(async e=>{this.packetDB.receivePacket(e)});this.shutdownListeners.push(()=>t())}this.shutdownListeners.push(function(e,t,s){let n=(e,n)=>{s.debug("Saving p2p inference request to our db"),setTimeout(()=>t.saveInferenceRequest({fetchedAt:new Date,fromSynthientId:n,requestId:e.requestId,payload:e.payload}),0)},i=e=>{setTimeout(()=>{s.debug("Processing new inference commit"),t.saveInferenceCommit(e)},0)},r=e=>{setTimeout(()=>{s.debug("Processing new inference reveal request"),t.processInferenceRevealRequest(e)},0)},a=e=>{setTimeout(()=>{s.debug("Processing new inference reveal"),t.processInferenceReveal(e)},0)},o=e=>{setTimeout(()=>{s.debug("Processing new consensus packet"),t.processExternalConsensus(e)},0)};return e.on("newP2PInferenceRequest",n),e.on("newInferenceCommit",i),e.on("newInferenceRevealRequest",r),e.on("newInferenceRevealed",a),e.on("consensusPacketReceived",o),()=>{e.removeListener("newP2PInferenceRequest",n),e.removeListener("newInferenceCommit",i),e.removeListener("newInferenceRevealRequest",r),e.removeListener("newInferenceRevealed",a),e.removeListener("consensusPacketReceived",o)}}(this.packetDB,this.inferenceDB,Z)),this.shutdownListeners.push(function(e,t,s){let n=t=>{setTimeout(()=>{s.debug("New inference embedding, committing to result"),e.transmitPacket({type:"inferenceCommit",bEmbeddingHash:t.bEmbeddingHash,requestId:t.requestId,inferenceId:t.inferenceId,createdAt:(0,g.MQ)(new Date)})},0)},i=t=>{setTimeout(()=>{s.debug("Publishing reveal requests"),t.forEach(t=>{e.transmitPacket(t)})},0)},r=t=>{setTimeout(()=>{s.debug("Publishing revealed inference"),e.transmitPacket(t)},0)},a=t=>{t.forEach(t=>{setTimeout(()=>{s.debug("New consensus packets, propagating"),e.transmitPacket(t)},0)})};return t.on("newInferenceEmbedding",n),t.on("requestQuorumReveal",i),t.on("revealedInference",r),t.quorumDb.on("consensusPackets",a),()=>{t.removeListener("newInferenceEmbedding",n),t.removeListener("requestQuorumReveal",i),t.removeListener("revealedInference",r),t.quorumDb.removeListener("consensusPackets",a)}}(this.packetDB,this.inferenceDB,Z)),this.inferenceDB.quorumDb.on("newQuorumAwaitingConsensus",(e,t,s,n)=>{Z.debug("New quorum awaiting consensus verification - ".concat(e," with our work included: ").concat(n)),this.inferenceStatus.embeddingQueue.find(t=>"consensusVerification"===t.request.type&&t.request.requestId===e)||this.inferenceStatus.embeddingQueue.push({model:t,request:{type:"consensusVerification",requestId:e,priorityConsensusVerification:n},expiresAt:new Date(s.getTime()+Y.quorumSettings.quorumConsensusWindowMs),queued:!1}),setTimeout(()=>this.processEmbeddingQueue(),0)}),this.embeddingEngine.on("workerFree",()=>{Z.debug("Worker free, checking for jobs"),setTimeout(()=>this.processEmbeddingQueue(),0)}),this.llmEngine.on("workerFree",()=>{Z.debug("Worker free, checking for jobs"),setTimeout(()=>this.processInferenceRequestQueue(),0)}),this.llmEngine.on("workerLoaded",e=>{let{modelName:t,workerId:s}=e;this.packetDB.transmitPacket({type:"peerStatusUpdate",status:"loaded_worker",totalWorkers:Object.keys(this.llmEngine.getWorkerStates()).length,createdAt:(0,g.MQ)(new Date),modelName:t})}),this.inferenceDB.on("inferenceResultAwaitingEmbedding",(e,t)=>{Z.debug("New inference awaiting embedding"),this.inferenceStatus.embeddingQueue.push({model:e.payload.securityFrame.embeddingModel,expiresAt:e.endingAt,request:{type:"resultEmbedding",request:e,result:t},queued:!1}),setTimeout(()=>this.processEmbeddingQueue(),0)}),this.inferenceDB.on("newActiveInferenceRequest",e=>{Z.debug("New active inference request, starting inference loop."),setTimeout(()=>this.processInferenceRequestQueue(),0)})}async addChainIdentity(e,t,s){let n=await (0,v.YK)(this.synthientId,e);if(this.chainIdentities.find(e=>e.address===n))return Z.debug("Identity already exists for this address ".concat(n)),!0;if(!n)return Z.error("Could not recover address from signed chain identity",e),!1;try{this.chainIdentities.push({address:n,chain:t,signedWithWallet:s,synthientIdSignature:e}),await (0,c.il)(this.clientInfo,this.identityPassword),Z.debug("Updated local identity with new chain ids."),await this.packetDB.transmitPacket({type:"peerConnectedChain",createdAt:(0,g.MQ)(new Date),identities:this.chainIdentities})}catch(e){return Z.error("Could not save new chain identity",e),!1}return!0}async processEmbeddingQueue(){let e=(0,g.zs)(3);Z.debug("EmbeddingQueue: ".concat(e,": Processing embedding queue."));let t=this.embeddingEngine.getAvailableModels();Z.debug("EmbeddingQueue: ".concat(e,": Available models - ").concat(t)),this.inferenceStatus.embeddingQueue=this.inferenceStatus.embeddingQueue.filter(e=>e.expiresAt>new Date).sort((e,t)=>"consensusVerification"===e.request.type&&e.request.priorityConsensusVerification&&("consensusVerification"!==t.request.type||!t.request.priorityConsensusVerification)?-1:"consensusVerification"===t.request.type&&t.request.priorityConsensusVerification&&("consensusVerification"!==e.request.type||!e.request.priorityConsensusVerification)?1:"resultEmbedding"===e.request.type&&"resultEmbedding"!==t.request.type?-1:"resultEmbedding"!==e.request.type&&"resultEmbedding"===t.request.type?1:e.expiresAt.getTime()-t.expiresAt.getTime()),Z.trace("EmbeddingQueue: ",e,": Sorted embedding queue - ",this.inferenceStatus.embeddingQueue);let s=this.inferenceStatus.embeddingQueue.filter(e=>!e.queued&&t.includes(e.model));Z.debug("EmbeddingQueue: ".concat(e,": Items to process - ").concat(s.length),s);let n=Array.from(new Set(s.map(e=>e.model)));Z.debug("EmbeddingQueue: ".concat(e,": Usable models - ").concat(n));let i=Object.values(this.embeddingEngine.embeddingWorkers).filter(e=>!e.busy&&n.includes(e.modelName));Z.debug("EmbeddingQueue: ".concat(e,": Available workers - ").concat(i.length)),i.length&&s.length&&this.packetDB.transmitPacket({type:"peerStatusUpdate",status:"computing_bEmbeddingHash",embeddingModels:n,createdAt:(0,g.MQ)(new Date)});for(let t=0;te!==s[t]);continue}i=e.quorum.filter(e=>!!e.reveal&&e.synthientId!==this.clientInfo.synthientId).map(e=>e.reveal.output)}else i=[n.request.result.result.result];if(!i.length){Z.error("EmbeddingQueue: No embeddings to embed for payload",n),this.inferenceStatus.embeddingQueue=this.inferenceStatus.embeddingQueue.filter(e=>e!==s[t]);continue}Z.debug("EmbeddingQueue: Embedding now",i),this.embeddingEngine.embedText(i,n.model).then(e=>{if(Z.debug("EmbeddingQueue: Embedding completed",n," - ",e&&(null==e?void 0:e.length)),e&&e.length){if("resultEmbedding"===n.request.type){let t=e[0];this.inferenceDB.saveInferenceEmbedding(n.request.result,{inferenceId:n.request.result.inferenceId,requestId:n.request.result.requestId,embedding:t.embedding,bEmbedding:t.binaryEmbedding,bEmbeddingHash:t.bEmbeddingHash})}else this.inferenceDB.processVerifiedConsensusEmbeddings({requestId:n.request.requestId,results:e})}else Z.error("EmbeddingQueue: Embedding failed for ".concat(n.request.type))}).catch(e=>{Z.error("EmbeddingQueue: Error embedding - ".concat(e))})}}async shutdownDomain(){for(let e of this.shutdownListeners)e()}static async bootup(e){let{identityPassword:t,overwriteIdentity:s,initialEmbeddingWorkers:n,initialLLMWorkers:i}=e;if(J.instance)return J.instance;if(J.loadingPromise)return J.loadingPromise.promise;J.loadingPromise=new O.C,Z.debug("Booting up the the domain...");let r=await (0,c.K6)(t,s);Z.debug("Identity retrieved/created successfully.");let a=Y.theDomainSettings.enabledP2PNetworks.map(e=>W.createP2PNetworkInstance(e,r.synthientId));Z.debug("Initialized p2p networks, waiting for bootup...");let o=await W.initializeP2PNetworks(a,Y.theDomainSettings.waitForP2PBootupMs);return Z.debug("Connecting up working networks."),this.instance=new J(t,r,o,n,i),J.loadingPromise.resolve(this.instance),this.instance}constructor(e,t,s,n,i){this.identityPassword=e,this.clientInfo=t,this.p2pNetworkInstances=s,this.shutdownListeners=[],this.inferenceStatus={inferenceIdsInProcess:[],inferenceCompletionInterval:null,waitingForWorker:!1,embeddingQueue:[]},this.processInferenceRequestQueue=H()(()=>{let e=(0,g.zs)(3),t=this.inferenceDB.activeInferenceRequests.filter(e=>e.endingAt>new Date&&!this.inferenceStatus.inferenceIdsInProcess.includes(e.requestId));Z.debug("Request Inference Queue: ".concat(e,": Processing inference request queue: ").concat(t.length," available."));let s=Array.from(new Set(t.map(e=>e.payload.acceptedModels).flat()));Z.debug("Request Inference Queue: ".concat(e,": Models needed - ").concat(s));let n=this.llmEngine.getWorkerAvailability(s);Z.debug("Request Inference Queue: ".concat(e,": Worker availability - "),n);let i=t.filter(e=>e.payload.acceptedModels.some(e=>n[e]&&n[e].free>0));if(Z.debug("Request Inference Queue: ".concat(e,": Possible inferences - ").concat(i.length)),!i.length){Z.debug("Request Inference Queue: ".concat(e,": No inferences to process."));return}let r=i.sort((e,t)=>t.endingAt.getTime()-e.endingAt.getTime()),a=r.filter(e=>Math.abs(e.endingAt.getTime()-r[0].endingAt.getTime()){Z.debug("Request Inference Queue: ".concat(e,": Inference completed for ").concat(o.requestId),t);let s=new Date;if(t.success){let e=s.getTime()/1e3-c.getTime()/1e3,n=t.tokenCount&&e?t.tokenCount/e:0;this.packetDB.transmitPacket({type:"peerStatusUpdate",status:"completed_inference",modelName:o.payload.acceptedModels[0],tps:n,totalTokens:this.inferenceDB.totalTokens,createdAt:(0,g.MQ)(new Date)})}return this.inferenceDB.saveInferenceResult({requestId:o.requestId,inferenceId:o.requestId+"."+(0,g.zs)(),startedAt:(0,g.MQ)(c),completedAt:(0,g.MQ)(new Date),result:t})}).then(()=>{this.inferenceStatus.inferenceIdsInProcess=this.inferenceStatus.inferenceIdsInProcess.filter(e=>e!==o.requestId)}).catch(e=>(Z.error("Request Inference Queue: Error running inference - ".concat(e)),this.inferenceDB.saveInferenceResult({requestId:o.requestId,inferenceId:o.requestId+"."+(0,g.zs)(),startedAt:(0,g.MQ)(c),completedAt:(0,g.MQ)(new Date),result:{success:!1,error:e}}))),Z.debug("Request Inference Queue: ".concat(e,": Waiting a tick before next inference.")),setTimeout(()=>this.processInferenceRequestQueue(),0)},Y.theDomainSettings.inferenceRequestQueueDebounceMs,{leading:!0});let r=async e=>{await Promise.all(this.p2pNetworkInstances.map(t=>t.broadcastPacket(e)))};this.synthientId=t.synthientId,this.chainIdentities=t.chainIds,this.packetDB=new B.j(t,r),this.inferenceDB=new z(t.synthientId),Z.debug("Databases created."),this.embeddingEngine=new u.X,this.llmEngine=new m.g,Z.debug("Setting up connections..."),this.hookupConnections(),Z.debug("Starting workers...");let a=[];for(let e of n)a.push(this.embeddingEngine.scaleEmbeddingWorkers(e.modelName,e.count));for(let e of i)a.push(this.llmEngine.scaleLLMWorkers(e.modelName,e.count));this.inferenceDB.on("bootComplete",e=>{this.packetDB.transmitPacket({type:"peerStatusUpdate",status:"boot",totalTokens:e,createdAt:(0,g.MQ)(new Date)})}),this.chainIdentities.length&&this.packetDB.transmitPacket({type:"peerConnectedChain",createdAt:(0,g.MQ)(new Date),identities:this.chainIdentities})}}J.loadingPromise=null;let U=new Date;U.setDate(U.getDate()-1);var $=JSON.parse('{"v":"5.9.4","fr":30,"ip":29,"op":87,"w":502,"h":530,"nm":"Ball 1","ddd":0,"assets":[{"id":"comp_0","nm":"1","fr":30,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-309,-310],[66,-63]],"o":[[0,0],[81.956,82.221],[-36.884,35.207]],"v":[[-105,62],[61,-218],[121,212.999]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[48]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":14,"s":[32.8]},{"i":{"x":[0.3],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":34,"s":[32.8]},{"t":50,"s":[0]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[52]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":14,"s":[46.6]},{"i":{"x":[0.3],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":34,"s":[46.6]},{"t":50,"s":[6]}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[196]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":14,"s":[111.75]},{"i":{"x":[0.3],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":34,"s":[15.75]},{"t":50,"s":[6]}],"ix":3},"m":2,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"gs","o":{"a":0,"k":100,"ix":9},"w":{"a":0,"k":134,"ix":10},"g":{"p":3,"k":{"a":0,"k":[0,0.973,0.797,0.469,0.5,0.986,0.724,0.235,1,1,0.652,0],"ix":8}},"s":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":0,"s":[-178,48],"to":[36.667,-14.667],"ti":[-18.667,44.667]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":14,"s":[42,-40],"to":[18.667,-44.667],"ti":[37.333,-13.333]},{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":34,"s":[-66,-220],"to":[-37.333,13.333],"ti":[19.333,-43.333]},{"t":50,"s":[-182,40]}],"ix":4},"e":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":0,"s":[-48,10],"to":[40,-17.333],"ti":[-10.667,58.667]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":14,"s":[192,-94],"to":[10.667,-58.667],"ti":[38,-15.333]},{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":34,"s":[16,-342],"to":[-38,15.333],"ti":[8.667,-56.667]},{"t":50,"s":[-36,-2]}],"ix":5},"t":1,"lc":2,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":13},"bm":0,"nm":"Gradient Stroke 1","mn":"ADBE Vector Graphic - G-Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"ct":1,"bm":0}]},{"id":"comp_1","nm":"2","fr":30,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-309,-310],[66,-63]],"o":[[0,0],[81.956,82.221],[-36.884,35.207]],"v":[[-105,62],[61,-218],[121,212.999]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[48]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":14,"s":[32.8]},{"i":{"x":[0.3],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":34,"s":[32.8]},{"t":50,"s":[0]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[52]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":14,"s":[46.6]},{"i":{"x":[0.3],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":34,"s":[46.6]},{"t":50,"s":[6]}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[196]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":14,"s":[111.75]},{"i":{"x":[0.3],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":34,"s":[15.75]},{"t":50,"s":[6]}],"ix":3},"m":2,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"gs","o":{"a":0,"k":100,"ix":9},"w":{"a":0,"k":134,"ix":10},"g":{"p":3,"k":{"a":0,"k":[0,0.028,0.426,0.557,0.5,0.192,0.592,0.71,1,0.355,0.758,0.863],"ix":8}},"s":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":0,"s":[-176,56],"to":[36.667,-16.667],"ti":[-18,46]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":14,"s":[44,-44],"to":[18,-46],"ti":[36,-14.667]},{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":34,"s":[-68,-220],"to":[-36,14.667],"ti":[17.333,-44]},{"t":50,"s":[-172,44]}],"ix":4},"e":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":0,"s":[-24,4],"to":[38.667,-16],"ti":[-4.667,60]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":14,"s":[208,-92],"to":[4.667,-60],"ti":[46,-4.667]},{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":34,"s":[4,-356],"to":[-46,4.667],"ti":[12,-48.667]},{"t":50,"s":[-68,-64]}],"ix":5},"t":1,"lc":2,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":13},"bm":0,"nm":"Gradient Stroke 1","mn":"ADBE Vector Graphic - G-Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"ct":1,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"1","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[238,336.72,0],"ix":2,"l":2},"a":{"a":0,"k":[540,540,0],"ix":1,"l":2},"s":{"a":0,"k":[78,78,100],"ix":6,"l":2}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"a","pt":{"a":0,"k":{"i":[[0,0],[0,0],[-4,-12],[0,0],[0,0],[0,0],[25.25,-7.25],[22.25,1.75],[0,0],[0,0],[0,0],[-1.5,-30.75],[62,3.75]],"o":[[0,0],[0,0],[4,12],[0,0],[0,0],[0,0],[-28.75,7.25],[-76.75,-16.75],[0,0],[0,0],[0,0],[-1,36.25],[-101.956,-2.983]],"v":[[285,354],[306,272],[454,100],[962,276],[838,640],[806,656],[745,701],[673.5,706],[607,637],[555,571],[553,505],[475,383.5],[367.5,443]],"c":true},"ix":1},"o":{"a":0,"k":100,"ix":3},"x":{"a":0,"k":0,"ix":4},"nm":"Mask 1"}],"w":1080,"h":1080,"ip":58,"op":108,"st":58,"bm":0},{"ddd":0,"ind":2,"ty":0,"nm":"2","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[238,336.72,0],"ix":2,"l":2},"a":{"a":0,"k":[540,540,0],"ix":1,"l":2},"s":{"a":0,"k":[78,78,100],"ix":6,"l":2}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"a","pt":{"a":0,"k":{"i":[[0,0],[0,0],[-4,-12],[0,0],[0,0],[0,0],[25.25,-7.25],[22.25,1.75],[0,0],[0,0],[0,0],[-1.5,-30.75],[62,3.75]],"o":[[0,0],[0,0],[4,12],[0,0],[0,0],[0,0],[-28.75,7.25],[-76.75,-16.75],[0,0],[0,0],[0,0],[-1,36.25],[-101.956,-2.983]],"v":[[285,354],[306,272],[454,100],[962,276],[838,640],[806,656],[745,701],[673.5,706],[607,637],[555,571],[553,505],[475,383.5],[367.5,443]],"c":true},"ix":1},"o":{"a":0,"k":100,"ix":3},"x":{"a":0,"k":0,"ix":4},"nm":"Mask 1"}],"w":1080,"h":1080,"ip":29,"op":79,"st":29,"bm":0},{"ddd":0,"ind":3,"ty":0,"nm":"1","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[238,336.72,0],"ix":2,"l":2},"a":{"a":0,"k":[540,540,0],"ix":1,"l":2},"s":{"a":0,"k":[78,78,100],"ix":6,"l":2}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"a","pt":{"a":0,"k":{"i":[[0,0],[0,0],[-4,-12],[0,0],[0,0],[0,0],[25.25,-7.25],[22.25,1.75],[0,0],[0,0],[0,0],[-1.5,-30.75],[62,3.75]],"o":[[0,0],[0,0],[4,12],[0,0],[0,0],[0,0],[-28.75,7.25],[-76.75,-16.75],[0,0],[0,0],[0,0],[-1,36.25],[-101.956,-2.983]],"v":[[285,354],[306,272],[454,100],[962,276],[838,640],[806,656],[745,701],[673.5,706],[607,637],[555,571],[553,505],[475,383.5],[367.5,443]],"c":true},"ix":1},"o":{"a":0,"k":100,"ix":3},"x":{"a":0,"k":0,"ix":4},"nm":"Mask 1"}],"w":1080,"h":1080,"ip":0,"op":50,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Shape Layer 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[113.2,215.04,0],"ix":2,"l":2},"a":{"a":0,"k":[-276,36,0],"ix":1,"l":2},"s":{"a":0,"k":[78,78,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[188,120],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.345098039216,0.094117647059,0.270588235294,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-276,36],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[362.8,420.96,0],"ix":2,"l":2},"a":{"a":0,"k":[-276,36,0],"ix":1,"l":2},"s":{"a":0,"k":[78,78,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[188,120],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.345098039216,0.094117647059,0.270588235294,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-276,36],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":180,"st":0,"ct":1,"bm":0}],"markers":[]}'),K=s.t($,2),X=s(42421),ee=s(60287),et=s(38364),es=s(12218),en=s(49354);let ei=(0,es.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),er=o.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,n.jsx)(et.f,{ref:t,className:(0,en.cn)(ei(),s),...i})});er.displayName=et.f.displayName;var ea=s(4919),eo=s(79798);function ec(e){let{submitInferenceRequest:t}=e,s=(0,o.useRef)(null),[i,a]=(0,o.useState)(["gemma-2b-it-q4f16_1"]),[c,l]=(0,o.useState)("50"),[u,m]=(0,o.useState)("500"),[h,x]=(0,o.useState)("2"),[p,g]=(0,o.useState)("30"),{toast:f}=(0,d.pm)();function k(){var e;let n={prompt:null===(e=s.current)||void 0===e?void 0:e.value,models:i,minimumParticipants:parseInt(h),timeAvailableSeconds:parseInt(p),percentageAgreement:parseInt(c)};if(!n.prompt){f({variant:"destructive",title:"Prompt is empty",description:"Please enter a prompt before sending an inference request."});return}if(0===n.models.length){f({variant:"destructive",title:"No models selected",description:"Please select at least one model before sending an inference request."});return}if(isNaN(n.minimumParticipants)||n.minimumParticipants<=0){f({variant:"destructive",title:"Invalid number of nodes",description:"Please enter a valid number of nodes before sending an inference request."});return}if(isNaN(n.timeAvailableSeconds)||n.timeAvailableSeconds<=0){f({variant:"destructive",title:"Invalid expiry timeout",description:"Please enter a valid expiry timeout in seconds before sending an inference request."});return}if(isNaN(n.percentageAgreement)||n.percentageAgreement<=0||n.percentageAgreement>100){f({variant:"destructive",title:"Invalid consensus percentage",description:"Please enter a valid consensus percentage before sending an inference request."});return}t(n.prompt,n.models,n.minimumParticipants,n.timeAvailableSeconds,n.percentageAgreement),s.current.value=""}return(0,n.jsxs)("div",{className:"relative overflow-hidden rounded-lg border bg-background focus-within:ring-2 focus-within:ring-ring ring-1",children:[(0,n.jsx)(er,{htmlFor:"prompt",className:"sr-only",children:"Prompt"}),(0,n.jsx)(ea.g,{id:"prompt",ref:s,placeholder:"Type your prompt for inference here...",className:"min-h-24 resize-none border-0 p-3 shadow-none focus-visible:ring-0 text-md",onKeyDown:e=>{"Enter"===e.key&&e.metaKey&&k()}}),(0,n.jsxs)(r.kC,{justify:"center",p:"2",pt:"0",gap:"2",children:[(0,n.jsxs)(r.J2.Root,{children:[(0,n.jsx)(r.J2.Trigger,{children:(0,n.jsxs)(r.zx,{variant:"ghost",mt:"2",size:"2",color:"gray",ml:"3",children:["Models ",(0,n.jsx)(X.Z,{width:15})]})}),(0,n.jsx)(r.J2.Content,{width:"250px",children:(0,n.jsxs)(r.kC,{direction:"column",gap:"2",p:"3",children:[(0,n.jsx)("label",{children:(0,n.jsx)(r.xv,{as:"div",size:"2",mb:"1",weight:"bold",color:"gray",children:"Which models are allowed?"})}),(0,n.jsx)(r.cO.Root,{defaultValue:i,name:"selectedModels",onValueChange:e=>a(e),children:eo.o.map(e=>(0,n.jsx)(r.cO.Item,{value:e,children:e},e))})]})})]}),(0,n.jsxs)(r.J2.Root,{children:[(0,n.jsx)(r.J2.Trigger,{children:(0,n.jsxs)(r.zx,{variant:"ghost",mt:"2",size:"2",color:"gray",ml:"3",children:["Consensus ",(0,n.jsx)(X.Z,{width:15})]})}),(0,n.jsx)(r.J2.Content,{width:"250px",children:(0,n.jsxs)(r.kC,{direction:"column",gap:"2",p:"3",children:[(0,n.jsx)("label",{children:(0,n.jsx)(r.xv,{as:"div",size:"2",mb:"1",weight:"bold",color:"gray",children:"How many nodes should participate and how many should agree?"})}),(0,n.jsxs)(r.kC,{gap:"2",children:[(0,n.jsx)(r.nv.Root,{placeholder:"30",size:"2",type:"number",className:"max-w-14",value:c,onInput:e=>l(e.currentTarget.value),children:(0,n.jsx)(r.nv.Slot,{side:"right",children:(0,n.jsx)(r.xv,{children:"%"})})}),(0,n.jsx)(r.xv,{size:"2",children:"of"}),(0,n.jsx)(r.nv.Root,{placeholder:"6000",size:"2",type:"number",value:h,onInput:e=>x(e.currentTarget.value),children:(0,n.jsx)(r.nv.Slot,{side:"right",children:(0,n.jsx)(r.xv,{children:"nodes"})})})]}),(0,n.jsx)("label",{children:(0,n.jsx)(r.xv,{as:"div",size:"2",mt:"2",mb:"1",weight:"bold",color:"gray",children:"How big should the consensus circle be? (Feel free to play around with this!)"})}),(0,n.jsx)(r.nv.Root,{placeholder:"6000",size:"2",type:"number",value:u,onInput:e=>m(e.currentTarget.value)})]})})]}),(0,n.jsx)(r.u,{content:"Maximum timeout for inferences to come in.",children:(0,n.jsx)(r.nv.Root,{placeholder:"6000",ml:"3",className:"w-[5.3rem] flex-shrink mt-1",value:p,onInput:e=>g(e.currentTarget.value),children:(0,n.jsx)(r.nv.Slot,{side:"right",children:(0,n.jsx)(r.xv,{children:"secs"})})})}),(0,n.jsxs)(r.zx,{type:"submit",size:"3",variant:"solid",color:"indigo",highContrast:!0,ml:"auto",className:"ml-auto gap-1.5 flex-grow",onClick:k,children:["Send to Rakis",(0,n.jsx)(ee.Z,{className:"size-3.5"})]})]})]})}var ed=s(64341),el=s(71935),eu=s(24972),em=s(33565);eu.Z.addDefaultLocale(em.Z);let eh=new eu.Z("en-US");function ex(){let[e,t]=(0,o.useState)([]),[s,a]=(0,o.useState)("all"),[c,d]=(0,o.useState)("all"),[l,u]=(0,o.useState)([]),[m,h]=(0,o.useState)([]);return(0,o.useEffect)(()=>{let e=()=>{t(k.HQ.getInstance().logs.filter(e=>("all"===s||e.logger===s)&&("all"===c||e.type===c))),u(Array.from(new Set(k.HQ.getInstance().logs.map(e=>e.logger)))),h(Array.from(new Set(k.HQ.getInstance().logs.map(e=>e.type))))};return e(),k.HQ.getInstance().on("newLog",e),()=>{k.HQ.getInstance().off("newLog",e)}},[s,c]),(0,n.jsxs)(r.kC,{direction:"column",gap:"5",py:"4",px:"2",children:[(0,n.jsxs)(r.kC,{gap:"2",children:[(0,n.jsx)("label",{children:(0,n.jsx)(r.xv,{size:"2",color:"gray",mt:"1",children:"Showing"})}),(0,n.jsxs)(r.Ph.Root,{defaultValue:"all",value:s,onValueChange:a,children:[(0,n.jsx)(r.Ph.Trigger,{variant:"soft"}),(0,n.jsxs)(r.Ph.Content,{children:[(0,n.jsx)(r.Ph.Group,{children:(0,n.jsx)(r.Ph.Item,{value:"all",children:"All"})}),(0,n.jsx)(r.Ph.Group,{children:l.map(e=>(0,n.jsx)(r.Ph.Item,{value:e,children:e},e))})]})]}),(0,n.jsx)(r.xv,{size:"2",color:"gray",mt:"1",children:"logs of type"}),(0,n.jsxs)(r.Ph.Root,{defaultValue:"all",value:c,onValueChange:d,children:[(0,n.jsx)(r.Ph.Trigger,{variant:"soft"}),(0,n.jsxs)(r.Ph.Content,{children:[(0,n.jsx)(r.Ph.Group,{children:(0,n.jsx)(r.Ph.Item,{value:"all",children:"All"})}),(0,n.jsx)(r.Ph.Group,{children:m.map(e=>(0,n.jsx)(r.Ph.Item,{value:e,children:e.slice(0,1).toUpperCase()+e.slice(1)},e))})]})]})]}),e.map(e=>(0,n.jsx)(r.Zb,{variant:"ghost",style:{borderBottom:"1px solid var(--gray-3)",..."warn"===e.type?{backgroundColor:"var(--orange-5)"}:"error"===e.type?{backgroundColor:"var(--red-5)"}:{}},children:(0,n.jsxs)(r.kC,{gap:"2",align:"center",children:[(0,n.jsx)(r.xu,{minWidth:"10px",mr:"2",children:"debug"===e.type||"trace"===e.type?(0,n.jsx)(i.H4u,{height:"18",width:"18",className:"mb-4"}):"info"===e.type?(0,n.jsx)(i.H4u,{height:"18",width:"18",className:"mb-4"}):"warn"===e.type?(0,n.jsx)(ed.Z,{height:"18",width:"18",className:"mb-4"}):(0,n.jsx)(el.Z,{height:"18",width:"18",className:"mb-4"})}),(0,n.jsxs)(r.kC,{direction:"column",flexGrow:"1",children:[(0,n.jsx)(r.xv,{size:"2",children:e.message}),(0,n.jsxs)(r.kC,{justify:"between",mt:"1",children:[(0,n.jsx)(r.xv,{size:"1",color:"gray",weight:"medium",children:e.logger}),(0,n.jsx)(r.xv,{size:"1",color:"gray",children:eh.format(e.at)})]})]})]})},e.id))]})}function ep(e){let{packetLimit:t}=e,[s,n]=(0,o.useState)(null),i=(0,o.useRef)(null),[r,a]=(0,o.useState)(null),c=(0,o.useRef)(null),d=H()(async()=>{s&&a(await s.packetDB.getLastPackets(t))},10);return(0,o.useEffect)(()=>(s||i.current?s&&!c.current&&(c.current=setInterval(()=>{d()},1e3),d()):i.current=setInterval(()=>{let e=J.getInstance();e&&(clearInterval(i.current),i.current=null,n(e))}),()=>{i.current&&(clearInterval(i.current),i.current=null),c.current&&(clearInterval(c.current),c.current=null)}),[s,t,d]),r}var eg=s(43061),ef=s(94207),ek=s(11240),ey=s(55182),ev=s(30690),eb=s(92940),eq=s(54817);let ew=new eu.Z("en-US"),eI=e=>{switch(e){case"loaded_worker":case"inferencing":case"completed_inference":return"blue";case"computing_bEmbeddingHash":case"verifying quorum":return"orange";default:return"gray"}},ej=e=>e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),eR=e=>{switch(e){case"peerStatusUpdate":return(0,n.jsx)(ef.Z,{size:20});case"knownPeers":return(0,n.jsx)(ek.Z,{size:20});case"peerHeart":return(0,n.jsx)(ey.Z,{size:20});case"peerInfo":return(0,n.jsx)(ev.Z,{size:20});case"peerConnectedChain":return(0,n.jsx)(eb.Z,{size:20});case"inferenceCommit":case"inferenceRevealRequest":case"inferenceReveal":case"inferenceRevealRejected":case"inferenceQuorumComputed":case"p2pInferenceRequest":return(0,n.jsx)(eq.Z,{size:20});default:return null}},eE=e=>{switch(e.packet.type){case"peerStatusUpdate":return(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"3",color:eI(e.packet.status),children:ej(e.packet.status)}),"loaded_worker"===e.packet.status&&(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Model: ",e.packet.modelName]}),"inferencing"===e.packet.status&&(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Model: ",e.packet.modelName]}),"completed_inference"===e.packet.status&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Model: ",e.packet.modelName]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["TPS: ",e.packet.tps]})]}),"computing_bEmbeddingHash"===e.packet.status&&(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Embedding Models: ",e.packet.embeddingModels.join(", ")]}),"verifying quorum"===e.packet.status&&(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Request ID: ",e.packet.requestId]})]});case"knownPeers":return(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"3",color:"blue",children:"Known Peers"}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:[e.packet.peerList.length," peers"]})]});case"peerHeart":return(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"3",color:"green",children:"Peer Heartbeat"}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Window X: ",e.packet.windowX]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Window Y: ",e.packet.windowY]})]});case"peerInfo":return(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"3",color:"blue",children:"Peer Info"}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Device Info: ",e.packet.deviceInfo]})]});case"peerConnectedChain":return(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"3",color:"green",children:"Connected Chains"}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:[e.packet.identities.length," chains"]})]});case"inferenceCommit":return(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"3",color:"orange",children:"Inference Commit"}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Request ID: ",e.packet.requestId]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Inference ID: ",e.packet.inferenceId]})]});case"inferenceRevealRequest":return(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"3",color:"orange",children:"Inference Reveal Request"}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Request ID: ",e.packet.requestId]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Quorum Size: ",e.packet.quorum.length]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Timeout: ",e.packet.timeoutMs,"ms"]})]});case"inferenceReveal":return(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"3",color:"green",children:"Inference Reveal"}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Request ID: ",e.packet.requestId]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Inference ID: ",e.packet.inferenceId]})]});case"inferenceRevealRejected":return(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"3",color:"red",children:"Inference Reveal Rejected"}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Request ID: ",e.packet.requestId]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Inference ID: ",e.packet.inferenceId]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Reject Reason: ",ej(e.packet.rejectReason.type)]})]});case"inferenceQuorumComputed":return(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"3",color:"green",children:"Inference Quorum Computed"}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Request ID: ",e.packet.requestId]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Verified By: ",e.packet.verifiedBy]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Submitted Inferences: ",e.packet.submittedInferences.length]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Valid Inferences: ",e.packet.validInferences.length]})]});case"p2pInferenceRequest":return(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"3",color:"blue",children:"P2P Inference Request"}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:["Request ID: ",e.packet.requestId]})]});default:return null}};function eD(){let e=ep({packetLimit:500}),[t,s]=(0,o.useState)(""),a=(0,eg.Nr)(t,100),[c,d]=(0,o.useState)([]);return(0,o.useEffect)(()=>{e&&(a?d(e.packets.filter(e=>e.packet.type.toLowerCase().includes(a.split(" ").join("").toLowerCase()))):d(e.packets))},[a,e]),e&&(0,n.jsxs)(r.kC,{direction:"column",gap:"4",py:"4",children:[(0,n.jsx)(r.nv.Root,{placeholder:"Search packet types (".concat(e.total," packets)..."),value:t,onChange:e=>s(e.target.value),children:(0,n.jsx)(r.nv.Slot,{children:(0,n.jsx)(i._Ve,{height:"16",width:"16"})})}),c.map(e=>(0,n.jsxs)(r.J2.Root,{children:[(0,n.jsx)(r.J2.Trigger,{children:(0,n.jsx)(r.Zb,{style:{backgroundColor:e.packet.type.startsWith("inference")||"p2pInferenceRequest"===e.packet.type?"$orange3":"$gray3"},children:(0,n.jsxs)(r.kC,{align:"center",gap:"2",children:[eR(e.packet.type),(0,n.jsxs)(r.kC,{direction:"column",flexGrow:"1",children:[eE(e),(0,n.jsxs)(r.kC,{justify:"between",mt:"1",children:[(0,n.jsxs)(r.xv,{size:"1",color:"gray",weight:"medium",children:["from ",e.synthientId.slice(0,8)]}),(0,n.jsx)(r.xv,{size:"1",color:"gray",children:ew.format(e.receivedTime||new Date(e.packet.createdAt))})]})]})]})},e.signature+e.synthientId)}),(0,n.jsx)(r.J2.Content,{children:(0,n.jsx)(r.xu,{maxHeight:"300px",overflowY:"auto",children:(0,n.jsx)(r.FR.fC,{size:"1",children:Object.keys(e.packet).map(t=>(0,n.jsxs)(r.FR.ck,{children:[(0,n.jsx)(r.FR.__,{children:t}),(0,n.jsx)(r.FR.B4,{children:e.packet[t].constructor==Object||Array.isArray(e.packet[t])?JSON.stringify(e.packet[t]):"".concat(e.packet[t]).slice(0,100)})]},t))})})})]},e.signature+e.synthientId))]})||(0,n.jsx)(r.$j,{size:"2"})}function eA(e){let{}=e;return ep({packetLimit:500}),(0,n.jsxs)(r.kC,{direction:"column",gap:"2",children:[(0,n.jsx)(r.xv,{size:"2",weight:"medium",mt:"3",children:"Logs and Packets"}),(0,n.jsx)(r.xv,{size:"1",color:"gray",children:"Packets you send and receive are here (just the latest few), along with your node's logs."}),(0,n.jsx)(r.xu,{children:(0,n.jsx)(r.Zb,{children:(0,n.jsxs)(r.mQ.Root,{defaultValue:"logs",children:[(0,n.jsxs)(r.mQ.List,{children:[(0,n.jsx)(r.mQ.Trigger,{value:"logs",children:"Logs"}),(0,n.jsx)(r.mQ.Trigger,{value:"packets",children:"Packets"})]}),(0,n.jsxs)(r.xu,{maxHeight:"300px",overflowY:"scroll",children:[(0,n.jsx)(r.mQ.Content,{value:"logs",children:(0,n.jsx)(ex,{})}),(0,n.jsx)(r.mQ.Content,{value:"packets",children:(0,n.jsx)(eD,{})})]})]})})})]})}let eC=(0,a.ri)();var eS=s(6884);eu.Z.addDefaultLocale(em.Z);let e_=new eu.Z("en-US"),eT=()=>(0,n.jsx)(r.xu,{width:"8px",height:"8px",position:"absolute",mt:"1",ml:"-1",left:"0",style:{backgroundColor:"var(--teal-9)",borderRadius:"100%"}});function eP(e){let{inference:t,mySynthientId:s}=e;return(0,n.jsx)(r.Zb,{children:(0,n.jsxs)(r.rj,{gap:"2",columns:"2",rows:"1",height:"125px",children:[(0,n.jsx)(r.xu,{height:"100%",children:(0,n.jsxs)(r.kC,{direction:"column",gap:"1",className:"h-full",children:[(0,n.jsx)(r.kC,{justify:"between",mx:"1",children:(0,n.jsxs)(r.J2.Root,{children:[(0,n.jsx)(r.J2.Trigger,{children:(0,n.jsxs)(r.zx,{size:"1",variant:"ghost",color:"gray",style:{padding:"0 5px"},children:["Parameters ",(0,n.jsx)(X.Z,{width:15})]})}),(0,n.jsx)(r.J2.Content,{width:"450px",style:{padding:"20px 30px"},children:(0,n.jsxs)(r.FR.fC,{children:[(0,n.jsxs)(r.FR.ck,{children:[(0,n.jsx)(r.FR.__,{minWidth:"88px",children:"Request Id"}),(0,n.jsx)(r.FR.B4,{children:t.requestId})]}),(0,n.jsxs)(r.FR.ck,{children:[(0,n.jsx)(r.FR.__,{minWidth:"88px",children:"Accepted Models"}),(0,n.jsxs)(r.FR.B4,{children:["(",t.requestPayload.acceptedModels.length,")"," ",t.requestPayload.acceptedModels.join(", ").slice(0,100)]})]}),(0,n.jsxs)(r.FR.ck,{children:[(0,n.jsx)(r.FR.__,{minWidth:"88px",children:"Embedding Model"}),(0,n.jsx)(r.FR.B4,{children:t.requestPayload.securityFrame.embeddingModel})]}),(0,n.jsxs)(r.FR.ck,{children:[(0,n.jsx)(r.FR.__,{minWidth:"88px",children:"Security Distance"}),(0,n.jsxs)(r.FR.B4,{children:[t.requestPayload.securityFrame.secDistance," ","distance in embedding space"]})]})]})})]})}),(0,n.jsx)(r.xu,{className:"flex-grow",mt:"1",children:(0,n.jsx)(r.u,{content:t.requestPayload.prompt,children:(0,n.jsxs)(r.xv,{size:"3",weight:"medium",children:[t.requestPayload.prompt.slice(0,60),t.requestPayload.prompt.length>60?"...":""]})})}),(0,n.jsxs)(r.xv,{size:"1",color:t.quorum&&t.quorum.quorumCommitted>=t.quorum.quorumThreshold?"grass":"amber",align:"right",mt:"1",children:[Math.floor(t.requestPayload.securityFrame.quorum*t.requestPayload.securityFrame.secPercentage),"/",t.requestPayload.securityFrame.quorum," nodes need to agree"]}),(0,n.jsxs)(r.xv,{size:"1",color:"gray",align:"right",children:["from ".concat(t.fromSynthientId?"".concat(t.fromSynthientId.slice(0,5),"..."):"unknown"," (on ").concat(t.requestPayload.fromChain,")")," ",e_.format(new Date(t.requestedAt))]})]})}),(0,n.jsxs)(r.W2,{size:"1",overflowY:"scroll",pl:"3",style:{position:"relative"},children:[(0,n.jsx)(r.xu,{position:"absolute",top:"0",left:"0",right:"0",height:"20px",style:{pointerEvents:"none",zIndex:1}}),(0,n.jsxs)(r.xu,{position:"relative",pt:"1",children:[(0,n.jsx)(r.xu,{position:"absolute",top:"0",bottom:"0",width:"1px",ml:"-0.5px",children:(0,n.jsx)(r.Z0,{size:"4",orientation:"vertical",mt:"2",style:{}})}),(0,n.jsx)(r.xu,{pl:"6",children:(0,n.jsx)(r.kC,{direction:"column-reverse",gap:"4",children:t.states.map((e,t)=>(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(eT,{}),"requested"===e.state?(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mb:"1",children:e.at.toLocaleString()}),(0,n.jsxs)(r.xv,{as:"p",size:"3",children:["Requested"," ",e.by?"by ".concat(e.by===s?"us":e.by.slice(0,5)):""]}),(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mt:"1",children:e.endingAt>new Date?"ending in ".concat(((e.endingAt.getTime()-new Date().getTime())/1e3).toFixed(1)," seconds"):"ended at ".concat(e.endingAt.toLocaleString())})]}):"committing"===e.state?(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mb:"1",children:e.at.toLocaleString()}),(0,n.jsx)(r.xv,{as:"p",size:"3",children:"Collecting Inferences"}),(0,n.jsxs)(r.xv,{size:"2",weight:"bold",color:e.commitmentsCollected>=e.commitmentsNeeded?"grass":"amber",children:[e.commitmentsCollected," of ",e.commitmentsNeeded," needed"]}),(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mt:"1",children:e.endingAt>new Date?"ending in ".concat(((e.endingAt.getTime()-new Date().getTime())/1e3).toFixed(1)," seconds"):"ended at ".concat(e.endingAt.toLocaleString())})]}):"revealRequested"===e.state?(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mb:"1",children:e.at.toLocaleString()}),(0,n.jsx)(r.xv,{as:"p",size:"3",children:"Requesting Nodes to reveal"}),(0,n.jsxs)(r.xv,{size:"2",weight:"bold",color:e.revealsCollected>=e.revealsNeeded?"grass":"amber",children:[e.revealsCollected," of ",e.commitments," revealed"]}),(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mt:"1",children:e.endingAt>new Date?"ending in ".concat(((e.endingAt.getTime()-new Date().getTime())/1e3).toFixed(1)," seconds"):"ended at ".concat(e.endingAt.toLocaleString())})]}):"calculatingConsensus"===e.state?(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mb:"1",children:e.at.toLocaleString()}),(0,n.jsx)(r.xv,{as:"p",size:"3",children:"Nodes are calculating consensus"}),(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mt:"1",children:e.endingAt>new Date?"ending in ".concat(((e.endingAt.getTime()-new Date().getTime())/1e3).toFixed(1)," seconds"):"ended at ".concat(e.endingAt.toLocaleString())})]}):"collectingExternalConsensuses"===e.state?(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mb:"1",children:e.at.toLocaleString()}),(0,n.jsx)(r.xv,{as:"p",size:"3",children:"Collecting peer consensus"}),e.collectedExternalConsensuses>0&&(0,n.jsxs)(r.xv,{size:"1",color:"gray",children:[e.collectedExternalConsensuses," collected"]}),(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mt:"1",children:e.endingAt>new Date?"ending in ".concat(((e.endingAt.getTime()-new Date().getTime())/1e3).toFixed(1)," seconds"):"ended at ".concat(e.endingAt.toLocaleString())})]}):"completed"===e.state?(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mb:"1",children:e.at.toLocaleString()}),(0,n.jsx)(r.u,{content:e.finalOutput+" (click to copy)",children:(0,n.jsxs)(r.kC,{direction:"row",gap:"2",ml:"-5",children:[(0,n.jsx)(r.hU,{size:"1","aria-label":"Copy value",color:"gray",variant:"ghost",children:(0,n.jsx)(eS.Z,{width:"15"})}),(0,n.jsxs)(r.xv,{as:"p",size:"3",weight:"medium",wrap:"wrap",color:"green",children:[e.finalOutput.slice(0,100),"..."]})]})}),(0,n.jsxs)(r.xv,{as:"p",size:"1",mt:"2",children:[e.validCommitments,"/",e.revealedCommitments," reveals judged valid"]}),(0,n.jsxs)(r.xv,{as:"p",size:"1",color:"gray",mt:"2",children:["Computed by ",e.external?"network":"us"]}),(0,n.jsxs)(r.xv,{as:"p",size:"1",color:"gray",mt:"1",children:[e.bEmbeddingHash.slice(0,25),"..."]}),(0,n.jsxs)(r.xv,{as:"p",size:"1",color:"gray",mt:"1",children:[e.consensusAgreedWith," agree, ",e.consensusDisagreedWith," ","disagree"]})]}):"failed"===e.state?(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(r.xv,{as:"div",size:"1",color:"gray",mb:"1",children:e.at.toLocaleString()}),(0,n.jsx)(r.xv,{as:"p",size:"4",weight:"medium",color:"ruby",children:"Failed"}),(0,n.jsx)(r.xv,{mt:"1",size:"2",children:e.reason})]}):void 0]},t))})})]})]})]})})}function ez(e){let{mySynthientId:t}=e,s=function(e){let{inferenceLimit:t}=e,[s,n]=(0,o.useState)(null),i=(0,o.useRef)(null),[r,a]=(0,o.useState)(null),c=(0,o.useRef)(null),d=H()(async()=>{s&&a((await s.inferenceDB.getInferences(t)).map(e=>{let t=function(e){let t=[];t.push({state:"requested",at:new Date(e.requestedAt),endingAt:e.endingAt,by:e.fromSynthientId});let s=!1;if(e.quorum&&(e.quorum.quorum.length>0&&t.push({state:"committing",at:e.quorum.quorum.sort((e,t)=>e.commitReceivedAt.getTime()-t.commitReceivedAt.getTime())[0].commitReceivedAt,commitmentsCollected:e.quorum.quorum.length,commitmentsNeeded:e.quorum.quorumThreshold,endingAt:e.endingAt}),e.endingAt!!e.reveal).length)&&t.push({state:"revealRequested",at:e.endingAt,revealsNeeded:e.quorum.quorumThreshold,revealsCollected:e.quorum.quorum.filter(e=>!!e.reveal).length,commitments:e.quorum.quorum.length,endingAt:new Date(e.endingAt.getTime()+eC.quorumSettings.quorumRevealTimeoutMs)}),!s&&new Date(e.endingAt.getTime()+eC.quorumSettings.quorumRevealTimeoutMs)!!e.reveal).length&&(t.push({state:"failed",reason:"Not enough reveals",at:new Date(e.endingAt.getTime()+eC.quorumSettings.quorumRevealTimeoutMs)}),s=!0),!s&&e.quorum.consensusRequestedAt&&(t.push({state:"calculatingConsensus",at:e.quorum.consensusRequestedAt,endingAt:new Date(e.quorum.consensusRequestedAt.getTime()+eC.quorumSettings.quorumConsensusWindowMs)}),!(new Date(e.quorum.consensusRequestedAt.getTime()+eC.quorumSettings.quorumConsensusWindowMs)!!e.reveal).length,quorumThreshold:e.quorum.quorumThreshold,bEmbeddingHash:e.consensusResult.result.validInferenceJointHash,consensusAgreedWith:e.externalConsensuses.filter(t=>t.bEmbeddingHash===e.consensusResult.result.validInference.bEmbeddingHash).length,consensusDisagreedWith:e.externalConsensuses.filter(t=>t.bEmbeddingHash!==e.consensusResult.result.validInference.bEmbeddingHash).length});else if(e.externalConsensuses.length){let s={};e.externalConsensuses.forEach(e=>{s[e.bEmbeddingHash]||(s[e.bEmbeddingHash]=0),s[e.bEmbeddingHash]++});let n=Object.keys(s).reduce((e,t)=>s[e]>s[t]?e:t),i=e.externalConsensuses.find(e=>e.bEmbeddingHash===n);t.push({state:"completed",external:!0,at:new Date(e.quorum.consensusRequestedAt.getTime()+eC.quorumSettings.quorumConsensusWindowMs),finalOutput:i.output,validCommitments:i.validCommitments,revealedCommitments:i.allCommitments,quorumThreshold:e.quorum.quorumThreshold,bEmbeddingHash:i.bEmbeddingHash,consensusAgreedWith:e.externalConsensuses.filter(e=>e.bEmbeddingHash===i.bEmbeddingHash).length,consensusDisagreedWith:e.externalConsensuses.filter(e=>e.bEmbeddingHash!==i.bEmbeddingHash).length})}}return t}(e);return{...e,states:t,updatedAt:t.sort((e,t)=>e.at.getTime()-t.at.getTime())[0].at}}).sort((e,t)=>t.updatedAt.getTime()-e.updatedAt.getTime()))},10,{leading:!0});return(0,o.useEffect)(()=>(s||i.current?s&&!c.current&&(c.current=setInterval(()=>{d()},1e3),d(),s.inferenceDB.on("inferenceResultAwaitingEmbedding",d),s.inferenceDB.on("newActiveInferenceRequest",d),s.inferenceDB.on("newInferenceRequest",d),s.inferenceDB.on("requestQuorumReveal",d),s.inferenceDB.on("revealedInference",d),s.inferenceDB.on("newInferenceEmbedding",d),s.packetDB.on("newInferenceCommit",d),s.packetDB.on("newInferenceRevealRequest",d),s.packetDB.on("newInferenceRevealed",d),s.packetDB.on("newP2PInferenceRequest",d)):i.current=setInterval(()=>{let e=J.getInstance();e&&(clearInterval(i.current),i.current=null,n(e))}),()=>{i.current&&(clearInterval(i.current),i.current=null),c.current&&(clearInterval(c.current),c.current=null),s&&(s.inferenceDB.off("inferenceResultAwaitingEmbedding",d),s.inferenceDB.off("newActiveInferenceRequest",d),s.inferenceDB.off("newInferenceRequest",d),s.inferenceDB.off("requestQuorumReveal",d),s.inferenceDB.off("revealedInference",d),s.inferenceDB.off("newInferenceEmbedding",d),s.packetDB.off("newInferenceCommit",d),s.packetDB.off("newInferenceRevealRequest",d),s.packetDB.off("newInferenceRevealed",d),s.packetDB.off("newP2PInferenceRequest",d))}),[s,t,d]),r}({inferenceLimit:50});return(0,n.jsx)(r.Zb,{children:(0,n.jsx)(r.W2,{maxHeight:{initial:"50vh",lg:"65vh"},overflowY:"scroll",children:(0,n.jsx)(r.kC,{gap:"2",direction:"column",children:s&&s.length&&s.map(e=>(0,n.jsx)(eP,{inference:e,mySynthientId:t},e.requestId))||(0,n.jsxs)(r.kC,{gap:"2",direction:"column",children:[(0,n.jsx)(r.xv,{size:"4",weight:"bold",children:"No Inferences yet"}),(0,n.jsx)(r.xv,{size:"2",children:"Inferences on Rakis are ephemeral - you only see the ones that happen after you node has been live. Leave your node running or send an inference to see them here."})]})})})})}var eB=s(24934),eN=s(4842),eV=s(74703),eM=s(58961),eQ=e=>{let{chainIdentities:t,synthientId:s,addNewChainIdentity:i}=e,{connectors:a,connect:c}=(0,eB.$)(),{address:d,isConnected:l,connector:u,chain:m}=(0,eN.m)(),{disconnect:h}=(0,eV.q)(),{signMessageAsync:x}=(0,eM.Q)(),p=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{l&&d&&!t.find(e=>e.address===d)&&!p.current&&(p.current=!0,console.log("Waiting to connect identity"),(async()=>{console.log("Connecting a new identity ",d);try{let e=await x({account:d,message:s});console.log("Got signature ",e),e&&await i(e,(null==m?void 0:m.name)||"unknown",(null==u?void 0:u.name)||"unknown"),h()}catch(e){console.error("Could not sign message",e)}})())},[d,m,l,s,i,h,x,t,u]),(0,n.jsx)(r.u,{content:t&&t.length?t.map(e=>(0,n.jsxs)("div",{children:[(0,n.jsx)(r.Ct,{children:e.chain}),(0,n.jsxs)("p",{children:[e.address.slice(0,10),"...",e.address.slice(-10)]})]},e.address+e.chain)).join("\n"):"Click to add an identity",children:(0,n.jsxs)(r.J2.Root,{children:[(0,n.jsx)(r.J2.Trigger,{children:(0,n.jsxs)(r.zx,{color:"grass",variant:"soft",size:"2",children:["Connect On-Chain Identity"," ",t.length?"(".concat(t.length,")"):""]})}),(0,n.jsx)(r.J2.Content,{children:(0,n.jsxs)(r.kC,{direction:"column",gap:"2",children:[(function(e){let t=e.filter(e=>"injected"===e.type);return t.length?t:e})(a).map(e=>(0,n.jsxs)(r.zx,{size:"4",variant:"surface",onClick:()=>c({connector:e}),children:[e.icon&&(0,n.jsx)("img",{src:e.icon,alt:e.name,className:"mr-2 h-4 w-4"}),e.name]},e.uid)),t.map((e,t)=>(0,n.jsxs)(r.Ct,{size:"2",children:[e.chain,": ",e.address.slice(0,10),"...",e.address.slice(-10)]},t))]})})]})})},eG=s(61485);let eF=eG.fC,eW=eG.xz;eG.ee;let eL=o.forwardRef((e,t)=>{let{className:s,align:i="center",sideOffset:r=4,...a}=e;return(0,n.jsx)(eG.h_,{children:(0,n.jsx)(eG.VY,{ref:t,align:i,sideOffset:r,className:(0,en.cn)("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a})})});eL.displayName=eG.VY.displayName;var eH=s(16876),eO=s(13304);eO.fC,eO.xz;let eZ=eO.h_;eO.x8;let eY=o.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,n.jsx)(eO.aV,{ref:t,className:(0,en.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...i})});eY.displayName=eO.aV.displayName,o.forwardRef((e,t)=>{let{className:s,children:r,...a}=e;return(0,n.jsxs)(eZ,{children:[(0,n.jsx)(eY,{}),(0,n.jsxs)(eO.VY,{ref:t,className:(0,en.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...a,children:[r,(0,n.jsxs)(eO.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,n.jsx)(i.Pxu,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}).displayName=eO.VY.displayName,o.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,n.jsx)(eO.Dx,{ref:t,className:(0,en.cn)("text-lg font-semibold leading-none tracking-tight",s),...i})}).displayName=eO.Dx.displayName,o.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,n.jsx)(eO.dk,{ref:t,className:(0,en.cn)("text-sm text-muted-foreground",s),...i})}).displayName=eO.dk.displayName;let eJ=o.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,n.jsx)(eH.mY,{ref:t,className:(0,en.cn)("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...i})});eJ.displayName=eH.mY.displayName;let eU=o.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,n.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[(0,n.jsx)(i._Ve,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,n.jsx)(eH.mY.Input,{ref:t,className:(0,en.cn)("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",s),...r})]})});eU.displayName=eH.mY.Input.displayName;let e$=o.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,n.jsx)(eH.mY.List,{ref:t,className:(0,en.cn)("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...i})});e$.displayName=eH.mY.List.displayName;let eK=o.forwardRef((e,t)=>(0,n.jsx)(eH.mY.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));eK.displayName=eH.mY.Empty.displayName;let eX=o.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,n.jsx)(eH.mY.Group,{ref:t,className:(0,en.cn)("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",s),...i})});eX.displayName=eH.mY.Group.displayName,o.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,n.jsx)(eH.mY.Separator,{ref:t,className:(0,en.cn)("-mx-1 h-px bg-border",s),...i})}).displayName=eH.mY.Separator.displayName;let e0=o.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,n.jsx)(eH.mY.Item,{ref:t,className:(0,en.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",s),...i})});e0.displayName=eH.mY.Item.displayName;var e1=s(89733),e2=s(1282),e7=s(22468);function e4(e){let{workerCount:t,scaleLLMWorkers:s}=e,[i,a]=(0,o.useState)(!1),[c,d]=(0,o.useState)(!1),[l,u]=(0,o.useState)("gemma-2b-it-q4f16_1"),[m,h]=(0,o.useState)("");return(0,o.useEffect)(()=>{h("".concat(l&&t[l]+1||1))},[l,t]),(0,n.jsxs)(r.Vq.Root,{open:c,onOpenChange:d,children:[(0,n.jsx)(r.Vq.Trigger,{children:(0,n.jsx)(r.zx,{variant:"soft",size:"2",children:"Scale Workers"})}),(0,n.jsx)(r.Vq.Content,{maxWidth:"330px",children:(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)("label",{children:(0,n.jsx)(r.xv,{as:"div",size:"2",mb:"1",weight:"bold",children:"Model Name"})}),(0,n.jsxs)(eF,{open:i,onOpenChange:a,children:[(0,n.jsx)(eW,{asChild:!0,children:(0,n.jsxs)(e1.z,{variant:"outline",role:"combobox","aria-expanded":i,className:"w-[280px] justify-between",children:["".concat(l.slice(0,30)).concat(l.length>30?"...":"")||"Select model...",(0,n.jsx)(e2.Z,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,n.jsx)(eL,{className:"w-[300px] p-0 z-50",children:(0,n.jsxs)(eJ,{children:[(0,n.jsx)(eU,{placeholder:"Search model..."}),(0,n.jsxs)(e$,{children:[(0,n.jsx)(eK,{children:"No model found."}),(0,n.jsx)(eX,{children:eo.o.map(e=>(0,n.jsxs)(e0,{value:e,onSelect:e=>{u(e===l?"":e),a(!1)},children:[(0,n.jsx)(e7.Z,{className:(0,en.cn)("mr-2 h-4 w-4",l===e?"opacity-100":"opacity-0")}),e]},e))})]})]})})]}),(0,n.jsx)("label",{children:(0,n.jsx)(r.xv,{as:"div",size:"2",mt:"4",mb:"1",weight:"bold",children:"Number of Workers"})}),(0,n.jsx)(r.nv.Root,{size:"3",type:"number",onChange:e=>h(e.target.value),value:m,className:"max-w-[280px]"}),(0,n.jsx)(r.zx,{mt:"4",variant:"solid",color:l&&t[l]&&!isNaN(parseInt(m))?t[l]=0&&(s(l,parseInt(m)),d(!1))},disabled:!!(l&&t[l]&&!isNaN(parseInt(m))&&t[l]===parseInt(m)),children:l&&t[l]&&!isNaN(parseInt(m))?t[l]>parseInt(m)?"Delete Workers":"Add Workers":"Scale Workers"})]})})]})}let e5=()=>(0,n.jsx)(r.xu,{width:"8px",height:"8px",position:"absolute",mt:"3",ml:"-1",left:"0",style:{backgroundColor:"var(--teal-9)",borderRadius:"100%"}});function e6(e){let{llmWorkerStates:t,mySynthientId:s,scaleLLMWorkers:i,chainIdentities:a,addNewChainIdentity:o}=e;return(0,n.jsxs)(r.kC,{direction:{initial:"column",sm:"row"},justify:"center",gap:"2",children:[(0,n.jsx)(r.u,{content:"".concat(s),children:(0,n.jsxs)(r.zx,{variant:"ghost",size:"3",children:["You are ",s.slice(0,10)]})}),(0,n.jsx)(r.xu,{flexGrow:"1"}),(0,n.jsxs)(r.J2.Root,{children:[(0,n.jsx)(r.J2.Trigger,{children:(0,n.jsx)(r.zx,{variant:"ghost",size:"2",children:"How Rakis Works"})}),(0,n.jsx)(r.J2.Content,{children:(0,n.jsxs)(r.Zb,{children:[(0,n.jsxs)(r.xv,{size:"1",children:["All Rakis nodes run the exact same code you ",(0,n.jsx)("a",{href:""}),"re currently running, to process AI inference requests. Here's how it works:"]}),(0,n.jsxs)(r.W2,{size:"1",overflowY:"scroll",pl:"3",pt:"3",style:{position:"relative"},children:[(0,n.jsx)(r.xu,{position:"absolute",top:"0",left:"0",right:"0",height:"20px",style:{pointerEvents:"none",zIndex:1}}),(0,n.jsxs)(r.xu,{position:"relative",pt:"1",children:[(0,n.jsx)(r.xu,{position:"absolute",top:"0",bottom:"0",width:"1px",ml:"-0.5px",children:(0,n.jsx)(r.Z0,{size:"4",orientation:"vertical",mt:"2",style:{}})}),(0,n.jsx)(r.xu,{pl:"6",children:(0,n.jsxs)(r.kC,{direction:"column",gap:"4",children:[(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(e5,{}),(0,n.jsx)(r.xv,{size:"3",children:"Inference requests are picked up from another node, or from a supported blockchain contract (not fully implemented yet)."})]}),(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(e5,{}),(0,n.jsx)(r.xv,{size:"3",children:"The Inference request contains a timeout until which nodes can submit commitments, which are hashes that commit them to a result without revealing it."})]}),(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(e5,{}),(0,n.jsx)(r.xv,{size:"3",children:"At the end of the allotted time, if there are enough commits (as specified by the request), nodes are requested to reveal their results."})]}),(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(e5,{}),(0,n.jsx)(r.xv,{size:"3",children:"Once results are revealed, all nodes double check the embeddings and hashes to validate prior commitments."})]}),(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(e5,{}),(0,n.jsx)(r.xv,{size:"3",children:"Among the validated commitments, the outputs are clustered in embedding space, and the densest cluster of results is chosen."})]}),(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(e5,{}),(0,n.jsx)(r.xv,{size:"3",children:"Nodes communicate their independent results of consensus, to check for agreement. This is the final output you can see."})]})]})})]})]})]})})]}),(0,n.jsx)(r.xu,{flexGrow:"1"}),(0,n.jsx)(e4,{workerCount:Object.keys(t).map(e=>t[e].modelName).reduce((e,t)=>{var s;return null!==(s=e[t])&&void 0!==s||(e[t]=0),e[t]++,e},{}),scaleLLMWorkers:i}),(0,n.jsx)(eQ,{chainIdentities:a,synthientId:s,addNewChainIdentity:o})]})}function e3(){return(0,n.jsxs)(r.kC,{direction:"row",gap:"2",children:[(0,n.jsx)(r.xu,{children:(0,n.jsxs)(r.Zb,{children:[(0,n.jsx)(r.X6,{size:"7",children:"200"}),(0,n.jsx)(r.xv,{size:"2",children:"Peers"})]})}),(0,n.jsx)(r.xu,{children:(0,n.jsxs)(r.Zb,{children:[(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(r.xv,{as:"span",size:"7",children:"20000"}),(0,n.jsxs)(r.xv,{as:"span",size:"7",weight:"bold",children:[" ","/ 20000"]})]}),(0,n.jsx)(r.xv,{size:"2",children:"Tokens (you/network)"})]})}),(0,n.jsx)(r.xu,{children:(0,n.jsxs)(r.Zb,{children:[(0,n.jsxs)(r.xu,{children:[(0,n.jsx)(r.xv,{as:"span",size:"7",children:"7"}),(0,n.jsxs)(r.xv,{as:"span",size:"7",weight:"bold",children:[" ","/ 300"]})]}),(0,n.jsx)(r.xv,{size:"2",children:"AI Workers (you/network)"})]})})," "]})}var e9=s(10462),e8=JSON.parse('{"v":"5.3.4","fr":120,"ip":118,"op":669,"w":700,"h":700,"nm":"Final","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":0,"nm":"Combine","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":180,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":550,"op":851,"st":550,"bm":0},{"ddd":0,"ind":2,"ty":0,"nm":"Combine","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":275,"op":577,"st":275,"bm":0},{"ddd":0,"ind":3,"ty":0,"nm":"Combine","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":180,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":0,"op":301,"st":0,"bm":0}]},{"id":"comp_1","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Small 4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":120,"ix":10},"p":{"s":true,"x":{"a":0,"k":500,"ix":3},"y":{"a":0,"k":500,"ix":4}},"a":{"a":0,"k":[-300,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[50,50],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.87450986376,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.87450986376,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 2","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":4,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":26,"op":183,"st":127,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Small 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":-120,"ix":10},"p":{"s":true,"x":{"a":0,"k":500,"ix":3},"y":{"a":0,"k":500,"ix":4}},"a":{"a":0,"k":[-300,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[50,50],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.160784313725,0.450980422076,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.160784313725,0.450980422076,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 2","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":4,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":212,"op":801,"st":201,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Small 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":60,"ix":10},"p":{"s":true,"x":{"a":0,"k":500,"ix":3},"y":{"a":0,"k":500,"ix":4}},"a":{"a":0,"k":[-300,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[50,50],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.160784313725,0.450980392157,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.160784313725,0.450980392157,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 2","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":4,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":94,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Small","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"s":true,"x":{"a":0,"k":200,"ix":3},"y":{"a":0,"k":500,"ix":4}},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[50,50],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.505882352941,0,0.674509803922,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":123,"op":276,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":0,"nm":"Gradient bubble","refId":"comp_2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":0,"op":123,"st":0,"bm":0},{"ddd":0,"ind":6,"ty":0,"nm":"Gradient bubble 2","refId":"comp_3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":60,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":94,"op":212,"st":91,"bm":0},{"ddd":0,"ind":7,"ty":0,"nm":"Gradient bubble 3","refId":"comp_4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":120,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":183,"op":3783,"st":183,"bm":0}]},{"id":"comp_2","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Small 2","parent":4,"td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,0,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[50,50],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"g":{"p":3,"k":{"a":0,"k":[0,1,0.165,0.1,0.5,1,0.165,0.099,1,1,0.165,0.098],"ix":9}},"s":{"a":0,"k":[0,0],"ix":5},"e":{"a":0,"k":[100,0],"ix":6},"t":1,"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":4,"op":3604,"st":4,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Middle 2","tt":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[25,25,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":44,"s":[{"i":[[-173.529,0],[-90.002,-132.024],[-12.439,-28.365],[0,-71.349],[25.943,-60.455],[17.464,-25.863],[172.632,0],[89.122,137.333],[10.875,24.758],[0,71.457],[-29.676,63.926],[-14.207,21.268]],"o":[[171.836,0],[17.262,25.321],[26.93,61.409],[0,69.955],[-12.444,28.999],[-89.845,133.057],[-175.911,0],[-14.578,-22.464],[-27.006,-61.482],[0,-75.118],[10.863,-23.4],[89.659,-134.222]],"v":[[0,-500],[413.429,-281.292],[458.126,-200.617],[500,0],[459.691,197.009],[414.675,279.456],[0,500],[-419.728,271.823],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.07,-277.379]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[407,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":54,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[407,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[536,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":62,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[536,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-174.816,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.804,139.028],[10.683,24.786],[0,70.234],[-28.796,63.141],[-14.008,21.299]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-177.204,0],[-14.385,-22.52],[-26.139,-60.647],[0,-73.927],[10.672,-23.401],[89.377,-135.901]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[463.424,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-421.682,268.788],[-459.38,197.733],[-500,0],[-455.16,-207.248],[-418.056,-274.383]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":70,"s":[{"i":[[-174.816,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.804,139.028],[10.683,24.786],[0,70.234],[-28.796,63.141],[-14.008,21.299]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-177.204,0],[-14.385,-22.52],[-26.139,-60.647],[0,-73.927],[10.672,-23.401],[89.377,-135.901]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[463.424,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-421.682,268.788],[-459.38,197.733],[-500,0],[-455.16,-207.248],[-418.056,-274.383]],"c":true}],"e":[{"i":[[-174.161,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.97,138.149],[10.747,24.636],[0,71.013],[-29.357,63.641],[-14.031,21.165]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.534,0],[-14.412,-22.378],[-26.692,-61.179],[0,-74.686],[10.728,-23.26],[89.522,-135.046]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[458.057,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.67,270.362],[-458.503,199.747],[-500,0],[-454.267,-209.188],[-417.046,-275.908]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":71,"s":[{"i":[[-174.161,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.97,138.149],[10.747,24.636],[0,71.013],[-29.357,63.641],[-14.031,21.165]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.534,0],[-14.412,-22.378],[-26.692,-61.179],[0,-74.686],[10.728,-23.26],[89.522,-135.046]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[458.057,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.67,270.362],[-458.503,199.747],[-500,0],[-454.267,-209.188],[-417.046,-275.908]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[455,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":72,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[455,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[509.432,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-548,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":80,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[509.432,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-548,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[485.728,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-447,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":91,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[485.728,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-447,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[494.72,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-533,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":101,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[494.72,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-533,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":107,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-467,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":111,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-467,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-506,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":121,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-506,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"t":131}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"g":{"p":3,"k":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":44,"s":[0,1,0.875,0,0.05,1,0.875,0,0.998,1,0.875,0],"e":[0.316,0.506,0,0.675,0.658,0.753,0.437,0.337,1,1,0.875,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":80,"s":[0.316,0.506,0,0.675,0.658,0.753,0.437,0.337,1,1,0.875,0],"e":[1,0.506,0,0.675,1,0.753,0.437,0.337,1,1,0.875,0]},{"t":109}],"ix":9}},"s":{"a":0,"k":[2000,0],"ix":5},"e":{"a":0,"k":[-2000,0],"ix":6},"t":2,"h":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":44,"s":[-100],"e":[100]},{"t":109}],"ix":7},"a":{"a":0,"k":0,"ix":8},"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":13,"op":3600,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Middle","td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[25,25,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-276.142,0],[0,-276.142],[276.142,0],[0,276.142]],"o":[[276.142,0],[0,276.142],[-276.142,0],[0,-276.142]],"v":[[0,-500],[500,0],[0,500],[-500,0]],"c":true},"ix":2,"x":"var $bm_rt;\\n$bm_rt = thisComp.layer(\'Middle 2\').content(\'Ellipse 1\').content(\'Path 1\').path;"},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"g":{"p":3,"k":{"a":0,"k":[0,1,0.875,0,0.05,1,0.875,0,0.998,1,0.875,0],"ix":9}},"s":{"a":0,"k":[0,0],"ix":5},"e":{"a":0,"k":[100,0],"ix":6},"t":1,"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":3600,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Small","tt":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0.501],"y":[1]},"o":{"x":[0.5],"y":[0]},"n":["0p501_1_0p5_0"],"t":0,"s":[800],"e":[200]},{"t":120}],"ix":3},"y":{"a":1,"k":[{"i":{"x":[0.99],"y":[1]},"o":{"x":[0.01],"y":[0]},"n":["0p99_1_0p01_0"],"t":0,"s":[500],"e":[500]},{"t":120}],"ix":4}},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[50,50],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.505882352941,0,0.674509803922,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":3600,"st":0,"bm":0}]},{"id":"comp_3","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Small 2","parent":4,"td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,0,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[50,50],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"g":{"p":3,"k":{"a":0,"k":[0,1,0.165,0.1,0.5,1,0.165,0.099,1,1,0.165,0.098],"ix":9}},"s":{"a":0,"k":[0,0],"ix":5},"e":{"a":0,"k":[100,0],"ix":6},"t":1,"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":4,"op":3604,"st":4,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Middle 2","tt":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[25,25,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":44,"s":[{"i":[[-173.529,0],[-90.002,-132.024],[-12.439,-28.365],[0,-71.349],[25.943,-60.455],[17.464,-25.863],[172.632,0],[89.122,137.333],[10.875,24.758],[0,71.457],[-29.676,63.926],[-14.207,21.268]],"o":[[171.836,0],[17.262,25.321],[26.93,61.409],[0,69.955],[-12.444,28.999],[-89.845,133.057],[-175.911,0],[-14.578,-22.464],[-27.006,-61.482],[0,-75.118],[10.863,-23.4],[89.659,-134.222]],"v":[[0,-500],[413.429,-281.292],[458.126,-200.617],[500,0],[459.691,197.009],[414.675,279.456],[0,500],[-419.728,271.823],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.07,-277.379]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[407,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":54,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[407,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[536,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":62,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[536,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-174.816,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.804,139.028],[10.683,24.786],[0,70.234],[-28.796,63.141],[-14.008,21.299]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-177.204,0],[-14.385,-22.52],[-26.139,-60.647],[0,-73.927],[10.672,-23.401],[89.377,-135.901]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[463.424,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-421.682,268.788],[-459.38,197.733],[-500,0],[-455.16,-207.248],[-418.056,-274.383]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":70,"s":[{"i":[[-174.816,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.804,139.028],[10.683,24.786],[0,70.234],[-28.796,63.141],[-14.008,21.299]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-177.204,0],[-14.385,-22.52],[-26.139,-60.647],[0,-73.927],[10.672,-23.401],[89.377,-135.901]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[463.424,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-421.682,268.788],[-459.38,197.733],[-500,0],[-455.16,-207.248],[-418.056,-274.383]],"c":true}],"e":[{"i":[[-174.161,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.97,138.149],[10.747,24.636],[0,71.013],[-29.357,63.641],[-14.031,21.165]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.534,0],[-14.412,-22.378],[-26.692,-61.179],[0,-74.686],[10.728,-23.26],[89.522,-135.046]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[458.057,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.67,270.362],[-458.503,199.747],[-500,0],[-454.267,-209.188],[-417.046,-275.908]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":71,"s":[{"i":[[-174.161,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.97,138.149],[10.747,24.636],[0,71.013],[-29.357,63.641],[-14.031,21.165]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.534,0],[-14.412,-22.378],[-26.692,-61.179],[0,-74.686],[10.728,-23.26],[89.522,-135.046]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[458.057,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.67,270.362],[-458.503,199.747],[-500,0],[-454.267,-209.188],[-417.046,-275.908]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[455,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":72,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[455,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[509.432,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-548,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":80,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[509.432,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-548,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[485.728,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-447,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":91,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[485.728,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-447,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[494.72,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-533,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":101,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[494.72,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-533,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":107,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-467,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":111,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-467,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-506,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":121,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-506,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"t":131}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"g":{"p":3,"k":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":44,"s":[0,0.506,0,0.675,0.05,0.506,0,0.675,1,0.506,0,0.675],"e":[0.316,1,0.161,0.451,0.658,0.753,0.08,0.563,1,0.506,0,0.675]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":80,"s":[0.316,1,0.161,0.451,0.658,0.753,0.08,0.563,1,0.506,0,0.675],"e":[1,1,0.161,0.451,1,0.753,0.08,0.563,1,0.506,0,0.675]},{"t":109}],"ix":9}},"s":{"a":0,"k":[2000,0],"ix":5},"e":{"a":0,"k":[-2000,0],"ix":6},"t":2,"h":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":44,"s":[-100],"e":[100]},{"t":109}],"ix":7},"a":{"a":0,"k":0,"ix":8},"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":25,"op":3600,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Middle","td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[25,25,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-276.142,0],[0,-276.142],[276.142,0],[0,276.142]],"o":[[276.142,0],[0,276.142],[-276.142,0],[0,-276.142]],"v":[[0,-500],[500,0],[0,500],[-500,0]],"c":true},"ix":2,"x":"var $bm_rt;\\n$bm_rt = thisComp.layer(\'Middle 2\').content(\'Ellipse 1\').content(\'Path 1\').path;"},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"g":{"p":3,"k":{"a":0,"k":[0,0.506,0,0.675,0.05,0.506,0,0.675,1,0.506,0,0.675],"ix":9}},"s":{"a":0,"k":[0,0],"ix":5},"e":{"a":0,"k":[100,0],"ix":6},"t":1,"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":3600,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Small","tt":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0.501],"y":[1]},"o":{"x":[0.5],"y":[0]},"n":["0p501_1_0p5_0"],"t":0,"s":[800],"e":[200]},{"t":120}],"ix":3},"y":{"a":1,"k":[{"i":{"x":[0.99],"y":[1]},"o":{"x":[0.01],"y":[0]},"n":["0p99_1_0p01_0"],"t":0,"s":[500],"e":[500]},{"t":120}],"ix":4}},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[50,50],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.160784313725,0.450980392157,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":3600,"st":0,"bm":0}]},{"id":"comp_4","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Small 2","parent":4,"td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,0,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[50,50],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"g":{"p":3,"k":{"a":0,"k":[0,1,0.165,0.1,0.5,1,0.165,0.099,1,1,0.165,0.098],"ix":9}},"s":{"a":0,"k":[0,0],"ix":5},"e":{"a":0,"k":[100,0],"ix":6},"t":1,"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":4,"op":3604,"st":4,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Middle 2","tt":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[25,25,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":44,"s":[{"i":[[-173.529,0],[-90.002,-132.024],[-12.439,-28.365],[0,-71.349],[25.943,-60.455],[17.464,-25.863],[172.632,0],[89.122,137.333],[10.875,24.758],[0,71.457],[-29.676,63.926],[-14.207,21.268]],"o":[[171.836,0],[17.262,25.321],[26.93,61.409],[0,69.955],[-12.444,28.999],[-89.845,133.057],[-175.911,0],[-14.578,-22.464],[-27.006,-61.482],[0,-75.118],[10.863,-23.4],[89.659,-134.222]],"v":[[0,-500],[413.429,-281.292],[458.126,-200.617],[500,0],[459.691,197.009],[414.675,279.456],[0,500],[-419.728,271.823],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.07,-277.379]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[407,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":54,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[407,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[536,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":62,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[536,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-174.816,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.804,139.028],[10.683,24.786],[0,70.234],[-28.796,63.141],[-14.008,21.299]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-177.204,0],[-14.385,-22.52],[-26.139,-60.647],[0,-73.927],[10.672,-23.401],[89.377,-135.901]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[463.424,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-421.682,268.788],[-459.38,197.733],[-500,0],[-455.16,-207.248],[-418.056,-274.383]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":70,"s":[{"i":[[-174.816,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.804,139.028],[10.683,24.786],[0,70.234],[-28.796,63.141],[-14.008,21.299]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-177.204,0],[-14.385,-22.52],[-26.139,-60.647],[0,-73.927],[10.672,-23.401],[89.377,-135.901]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[463.424,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-421.682,268.788],[-459.38,197.733],[-500,0],[-455.16,-207.248],[-418.056,-274.383]],"c":true}],"e":[{"i":[[-174.161,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.97,138.149],[10.747,24.636],[0,71.013],[-29.357,63.641],[-14.031,21.165]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.534,0],[-14.412,-22.378],[-26.692,-61.179],[0,-74.686],[10.728,-23.26],[89.522,-135.046]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[458.057,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.67,270.362],[-458.503,199.747],[-500,0],[-454.267,-209.188],[-417.046,-275.908]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":71,"s":[{"i":[[-174.161,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[88.97,138.149],[10.747,24.636],[0,71.013],[-29.357,63.641],[-14.031,21.165]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.534,0],[-14.412,-22.378],[-26.692,-61.179],[0,-74.686],[10.728,-23.26],[89.522,-135.046]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[458.057,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.67,270.362],[-458.503,199.747],[-500,0],[-454.267,-209.188],[-417.046,-275.908]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[455,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":72,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[455,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[509.432,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-548,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":80,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[509.432,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-548,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[485.728,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-447,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":91,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[485.728,-0.001],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-447,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[494.72,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-533,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":101,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[494.72,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-533,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":107,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-467,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":111,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-467,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-506,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":121,"s":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-506,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}],"e":[{"i":[[-173.787,0],[-89.945,-132.406],[-12.328,-28.112],[0,-71.349],[25.943,-60.455],[17.275,-25.672],[172.918,0],[89.064,137.648],[10.784,24.551],[0,71.457],[-29.676,63.926],[-14.043,21.089]],"o":[[172.13,0],[17.068,25.125],[26.93,61.409],[0,69.955],[-12.338,28.751],[-89.787,133.428],[-176.152,0],[-14.427,-22.297],[-27.006,-61.482],[0,-75.118],[10.76,-23.179],[89.604,-134.559]],"v":[[0,-500],[413.89,-280.614],[458.126,-200.617],[500,0],[459.691,197.009],[415.121,278.794],[0,500],[-420.093,271.259],[-458.004,200.894],[-500,0],[-453.759,-210.293],[-416.471,-276.778]],"c":true}]},{"t":131}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"g":{"p":3,"k":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":44,"s":[0,1,0.161,0.451,0.05,1,0.161,0.451,1,1,0.161,0.451],"e":[0.316,1,0.875,0,0.658,1,0.518,0.225,1,1,0.161,0.451]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":80,"s":[0.316,1,0.875,0,0.658,1,0.518,0.225,1,1,0.161,0.451],"e":[1,1,0.875,0,1,1,0.518,0.225,1,1,0.161,0.451]},{"t":109}],"ix":9}},"s":{"a":0,"k":[2000,0],"ix":5},"e":{"a":0,"k":[-2000,0],"ix":6},"t":2,"h":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":44,"s":[-100],"e":[100]},{"t":109}],"ix":7},"a":{"a":0,"k":0,"ix":8},"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":25,"op":3600,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Middle","td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[25,25,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-276.142,0],[0,-276.142],[276.142,0],[0,276.142]],"o":[[276.142,0],[0,276.142],[-276.142,0],[0,-276.142]],"v":[[0,-500],[500,0],[0,500],[-500,0]],"c":true},"ix":2,"x":"var $bm_rt;\\n$bm_rt = thisComp.layer(\'Middle 2\').content(\'Ellipse 1\').content(\'Path 1\').path;"},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"g":{"p":3,"k":{"a":0,"k":[0,1,0.161,0.451,0.05,1,0.161,0.451,1,1,0.161,0.451],"ix":9}},"s":{"a":0,"k":[0,0],"ix":5},"e":{"a":0,"k":[100,0],"ix":6},"t":1,"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":3600,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Small","tt":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"s":true,"x":{"a":1,"k":[{"i":{"x":[0.501],"y":[1]},"o":{"x":[0.5],"y":[0]},"n":["0p501_1_0p5_0"],"t":0,"s":[800],"e":[200]},{"t":120}],"ix":3},"y":{"a":1,"k":[{"i":{"x":[0.99],"y":[1]},"o":{"x":[0.01],"y":[0]},"n":["0p99_1_0p01_0"],"t":0,"s":[500],"e":[500]},{"t":120}],"ix":4}},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[50,50],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.874509803922,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":3600,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"Combine 2","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":118,"s":[0],"e":[360]},{"t":669}],"ix":10},"p":{"a":0,"k":[350,350,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":0,"op":3600,"st":0,"bm":0}],"markers":[]}'),te=s.t(e8,2);function tt(e){let{llmWorkerStates:t}=e,[s,i]=(0,o.useState)(!1),[a,c]=(0,o.useState)("gemma-2b-it-q4f16_1");return(0,n.jsxs)(r.xu,{children:[(0,n.jsxs)(r.kC,{direction:"column",children:[(0,n.jsx)(r.xv,{size:"2",weight:"medium",mt:"3",children:"Local LLM Workers"}),(0,n.jsx)(r.xv,{size:"1",color:"gray",children:"These are the local models you're running that will pick up inference requests from the network."})]}),(0,n.jsx)(r.kC,{direction:"row",overflowY:"scroll",children:Object.keys(t).sort((e,s)=>"idle"===t[e].state&&"idle"!==t[s].state?-1:"idle"!==t[e].state&&"idle"===t[s].state?1:0).map(e=>(0,n.jsx)(r.Zb,{size:"2",m:"2",className:"min-w-60",variant:"surface",children:(0,n.jsxs)(r.kC,{gap:"3",align:"center",children:["inference-in-progress"===t[e].state?(0,n.jsx)(r.xu,{width:"40px",children:(0,n.jsx)(l.Z,{options:{loop:!0,autoplay:!0,animationData:te,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}},style:{width:"100%",height:"auto"}})}):(0,n.jsx)(e9.Z,{width:"20",height:"20",className:"ml-2"}),(0,n.jsxs)(r.xu,{children:[(0,n.jsxs)(r.xv,{as:"div",size:"2",weight:"bold",children:[t[e].modelName.slice(0,20),t[e].modelName.length>20?"...":""]}),t[e].loadingProgress<1?(0,n.jsx)(r.Ex,{value:100*t[e].loadingProgress,size:"3",mt:"2",variant:"classic"}):(0,n.jsx)(r.xv,{as:"div",size:"2",color:"gray",children:"inference-in-progress"===t[e].state?"Inference in progress":"idle"===t[e].state?"Idle":"Ready"})]})]})},e))})]})}function ts(e){let{password:t,overwrite:s}=e,{llmWorkerStates:i,mySynthientId:c,scaleLLMWorkers:d,submitInferenceRequest:u,chainIdentities:m,addNewChainIdentity:h}=function(e,t){let s=(0,o.useRef)(null),[n,i]=(0,o.useState)(null),[r,c]=(0,o.useState)({}),[d,l]=(0,o.useState)([]),u=H()((e,t,n,i,r)=>{var a;null===(a=s.current)||void 0===a||a.packetDB.transmitPacket({type:"p2pInferenceRequest",requestId:(0,g.zs)(10),payload:{fromChain:"rakis",blockNumber:0,createdAt:(0,g.MQ)(new Date),prompt:e,acceptedModels:t,temperature:1,maxTokens:2048,securityFrame:{quorum:n,maxTimeMs:1e3*i,secDistance:4500,secPercentage:r/100,embeddingModel:"nomic-ai/nomic-embed-text-v1.5"}},createdAt:(0,g.MQ)(new Date)})},500);async function m(e,t,n){var i,r;if(await (null===(i=s.current)||void 0===i?void 0:i.addChainIdentity(e,t,n))){let e=null===(r=s.current)||void 0===r?void 0:r.chainIdentities;e&&l(e)}}return(0,o.useEffect)(()=>{let n=H()(()=>{var e,t;let n=null===(t=s.current)||void 0===t?void 0:null===(e=t.llmEngine)||void 0===e?void 0:e.getWorkerStates();console.log("Got engine states",n),n&&c(n)},100);(async()=>{let r=(0,a.ri)(),o=await J.bootup({identityPassword:e,overwriteIdentity:t,initialEmbeddingWorkers:r.workerSettings.initialEmbeddingWorkers,initialLLMWorkers:r.workerSettings.initialLLMWorkers});s.current=o,i(o.synthientId),l(o.chainIdentities||[]),o.llmEngine.on("workerFree",n),o.llmEngine.on("workerLoading",n),o.llmEngine.on("workerLoadFailed",n),o.llmEngine.on("workerBusy",n),o.llmEngine.on("workerLoaded",n),o.llmEngine.on("workerUnloaded",n),o.llmEngine.on("modelLoadingProgress",n),c(o.llmEngine.getWorkerStates())})();let r=setInterval(async()=>{if(!s.current)return;let[e,t,n,i,r]=await Promise.all([s.current.packetDB.peerDB.getLastPeers(U,100),s.current.packetDB.getLastPackets(100),s.current.llmEngine.getEngineLogs(100),s.current.inferenceDB.getInferences(10),s.current.packetDB.peerDB.getPeerCount()])},3e3);return()=>{var e,t,i,a;clearInterval(r),null===(e=s.current)||void 0===e||e.llmEngine.removeListener("workerFree",n),null===(t=s.current)||void 0===t||t.llmEngine.removeListener("workerLoadFailed",n),null===(i=s.current)||void 0===i||i.llmEngine.removeListener("workerLoaded",n),null===(a=s.current)||void 0===a||a.llmEngine.removeListener("workerUnloaded",n)}},[e,t]),{mySynthientId:n,llmWorkerStates:r,scaleLLMWorkers:function(e,t){var n;null===(n=s.current)||void 0===n||n.llmEngine.scaleLLMWorkers(e,t)},submitInferenceRequest:u,chainIdentities:d,addNewChainIdentity:m}}(t,s),{width:x}=(0,eg.iP)(),[p,f]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{x&&(x<1280?f(!0):f(!1))},[x]),c&&(0,n.jsxs)(r.kC,{direction:"column",justify:"start",gap:"2",height:"100vh",p:"4",className:"w-full",children:[(0,n.jsx)(r.xu,{mt:"1",children:(0,n.jsx)(e6,{llmWorkerStates:i,mySynthientId:c,scaleLLMWorkers:d,chainIdentities:m,addNewChainIdentity:h})}),(0,n.jsxs)(r.kC,{direction:{initial:"column",lg:"row"},gap:"4",children:[(0,n.jsx)(r.xu,{minWidth:"490px",maxWidth:{initial:"unset",lg:"590px"},children:(0,n.jsx)(r.kC,{direction:"row",children:(0,n.jsxs)(r.kC,{direction:"column",gap:"2",children:[(0,n.jsxs)(r.kC,{direction:"column",gap:"2",className:"bg-lime-200 p-3",style:{borderRadius:"7px"},children:[(0,n.jsx)(r.xv,{size:"5",weight:"medium",children:"Run a prompt!"}),(0,n.jsx)(r.xv,{size:"1",color:"gray",children:"Send an inference request to the Rakis network from here. Feel free to adjust the consensus settings to see what succeeds and fails."}),(0,n.jsx)(ec,{submitInferenceRequest:u})]}),(0,n.jsx)(r.xv,{size:"2",weight:"medium",mt:"3",children:"Your Stats"}),(0,n.jsx)(r.xv,{size:"1",color:"gray",children:"Rakis has no central servers, so these stats are collected from p2p exchanges during your time in the network. YMMV!"}),(0,n.jsx)(e3,{}),p?null:(0,n.jsx)(eA,{})]})})}),(0,n.jsxs)(r.xu,{flexGrow:"1",minWidth:"500px",children:[(0,n.jsx)(r.kC,{direction:"column",gap:"2",children:(0,n.jsx)(tt,{llmWorkerStates:i})}),(0,n.jsxs)(r.kC,{direction:"column",gap:"2",children:[(0,n.jsx)(r.xv,{size:"2",weight:"medium",children:"Step two: watch inferences"}),(0,n.jsx)(r.xv,{size:"1",color:"gray",children:"Rakis is completely public. Watch inference requests from the networks here, as they pass through each stage of validation."}),(0,n.jsx)(ez,{mySynthientId:c})]})]}),p?(0,n.jsx)(eA,{}):null]})]})||(0,n.jsx)("div",{className:" h-dvh w-full flex justify-center items-center",children:(0,n.jsx)("div",{className:"w-1/4",children:(0,n.jsx)(l.Z,{options:{loop:!0,autoplay:!0,animationData:K,rendererSettings:{preserveAspectRatio:"xMidYMid slice"}},style:{width:"100%",height:"auto"}})})})}var tn=s(40181),ti=s(43151),tr=s(93191),ta=s(55925),to=s(87446),tc=s(16491),td=s(8483),tl=s(80755),tu=s(53611),tm=s(993),th=s(55767);let tx=(0,a.ri)().chainConnectionSettings,tp=(0,ta._)({chains:[tc.R,td.F,tl.y,tu.y,tm.p],connectors:[(0,th.O)({dappMetadata:{name:tx.dAppName,url:tx.url}})],transports:{[tc.R.id]:(0,to.d)(),[td.F.id]:(0,to.d)(),[tl.y.id]:(0,to.d)(),[tu.y.id]:(0,to.d)(),[tm.p.id]:(0,to.d)()}}),tg=new ti.S;function tf(){let[e,t]=(0,o.useState)(!1),[s,l]=(0,o.useState)(!1),[u,m]=(0,o.useState)(""),[h,x]=(0,o.useState)(!1);(0,o.useEffect)(()=>{localStorage.getItem(a.wK)&&t(!0)},[]);let p=()=>{console.log("Trying to decrypt identity with ",u," and ",s),(async()=>{try{await (0,c.K6)(u,s)?(console.log("Client info initialized successfully"),x(!0)):(0,d.Am)({variant:"destructive",title:"Could not decrypt identity.",description:"Please try again or overwrite!"})}catch(e){(0,d.Am)({variant:"destructive",title:"Could not decrypt identity.",description:"Please try again or overwrite!"})}})()};return h?(0,n.jsx)(tn.F,{config:tp,children:(0,n.jsx)(tr.aH,{client:tg,children:(0,n.jsx)(ts,{password:u,overwrite:s})})}):(0,n.jsx)(r.kC,{direction:"column",justify:"center",height:"100vh",children:(0,n.jsx)(r.kC,{direction:"row",justify:"center",children:(0,n.jsx)(r.Zb,{variant:"ghost",children:(0,n.jsxs)(r.W2,{size:"1",p:"4",children:[(0,n.jsx)(r.X6,{size:"9",weight:"medium",children:"Welcome to Rakis."}),(0,n.jsx)(r.kC,{justify:"end",className:"mt-2",children:(0,n.jsx)(r.rU,{color:"blue",href:"https://twitter.com/hrishioa",target:"_blank",children:"built as a two-week experiment by @hrishioa"})}),(0,n.jsx)(r.xv,{color:"gray",as:"div",size:"4",className:"mt-6",children:"Rakis is a permissionless inference network that runs entirely in the browser. Choose a password below and instantly be a part of the network."})," ",(0,n.jsxs)(r.kC,{direction:"row",className:"mt-3",justify:"between",children:[(0,n.jsx)(r.rU,{color:"amber",children:"The Story"}),(0,n.jsx)(r.rU,{color:"amber",children:"How Rakis Works"}),(0,n.jsx)(r.rU,{color:"amber",href:"https://github.com/hrishioa/rakis",target:"_blank",children:"See the code"})]}),(0,n.jsxs)(r.kC,{direction:"row",className:"mt-6",gap:"3",children:[(0,n.jsx)(r.xu,{flexGrow:"1",children:(0,n.jsx)(r.nv.Root,{onKeyDown:e=>{"Enter"===e.key&&p()},size:"3",variant:"classic",type:"password",value:u,onChange:e=>m(e.target.value),placeholder:e?"Enter password...":"Create a password...",children:e&&(0,n.jsx)(r.nv.Slot,{side:"right",children:(0,n.jsx)(r.xv,{as:"label",size:"2",children:(0,n.jsxs)(r.kC,{gap:"2",children:[(0,n.jsx)(r.rs,{size:"1",variant:"soft",checked:s,onCheckedChange:e=>l(!!e)})," ","Overwrite Existing"]})})})})}),(0,n.jsx)(r.xu,{children:(0,n.jsxs)(r.zx,{size:"3",variant:"classic",onClick:p,children:[(0,n.jsx)(i.Ymj,{})," Join"]})})]})]})})})})}},78068:function(e,t,s){"use strict";s.d(t,{Am:function(){return u},pm:function(){return m}});var n=s(2265);let i=0,r=new Map,a=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),l({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},o=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:s}=t;return s?a(s):e.toasts.forEach(e=>{a(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===s||void 0===s?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},c=[],d={toasts:[]};function l(e){d=o(d,e),c.forEach(e=>{e(d)})}function u(e){let{...t}=e,s=(i=(i+1)%Number.MAX_SAFE_INTEGER).toString(),n=()=>l({type:"DISMISS_TOAST",toastId:s});return l({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:e=>{e||n()}}}),{id:s,dismiss:n,update:e=>l({type:"UPDATE_TOAST",toast:{...e,id:s}})}}function m(){let[e,t]=n.useState(d);return n.useEffect(()=>(c.push(t),()=>{let e=c.indexOf(t);e>-1&&c.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>l({type:"DISMISS_TOAST",toastId:e})}}}},function(e){e.O(0,[333,443,310,218,864,705,868,708,955,297,881,786,813,141,832,556,483,971,23,744],function(){return e(e.s=65125)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/_next/static/chunks/b2db8554.daf562cf211503d9.js b/_next/static/chunks/b2db8554.daf562cf211503d9.js new file mode 100644 index 0000000000000000000000000000000000000000..9a8ca9a5bb5dd4949e2b27aff364163156c03de0 --- /dev/null +++ b/_next/static/chunks/b2db8554.daf562cf211503d9.js @@ -0,0 +1,1679 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[15],{97004:function(module,__unused_webpack_exports,__webpack_require__){var process=__webpack_require__(25566);/*! +* ONNX Runtime Web v1.14.0 +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. +*/!function(t,e){module.exports=e(__webpack_require__(63426))}(self,__WEBPACK_EXTERNAL_MODULE__1670__=>(()=>{var __webpack_modules__={3474:(t,e,r)=>{var n,i=(n=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return k.buffer!=F&&W(k.buffer),N}function i(){return k.buffer!=F&&W(k.buffer),L}function o(){return k.buffer!=F&&W(k.buffer),R}function a(){return k.buffer!=F&&W(k.buffer),j}function s(){return k.buffer!=F&&W(k.buffer),M}t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise(function(t,e){l=t,c=e});var u,l,c,p,f,d,h,g,b,m=Object.assign({},u),y="./this.program",_=(t,e)=>{throw e},v="object"==typeof window,x="function"==typeof importScripts,w="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,T=u.ENVIRONMENT_IS_PTHREAD||!1,S="";function O(t){return u.locateFile?u.locateFile(t,S):S+t}if(w){let t;S=x?r(908).dirname(S)+"/":"//",b=()=>{g||(h=r(1384),g=r(908))},p=function(t,e){return b(),t=g.normalize(t),h.readFileSync(t,e?void 0:"utf8")},d=t=>((t=p(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,r)=>{b(),t=g.normalize(t),h.readFile(t,function(t,n){t?r(t):e(n.buffer)})},1{if(Q())throw process.exitCode=t,e;e instanceof tl||D("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{t=r(9925)}catch(t){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),t}r.g.Worker=t.Worker}else(v||x)&&(x?S=self.location.href:"undefined"!=typeof document&&document.currentScript&&(S=document.currentScript.src),n&&(S=n),S=0!==S.indexOf("blob:")?S.substr(0,S.replace(/[?#].*/,"").lastIndexOf("/")+1):"",w||(p=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},x&&(d=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,r)=>{var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)}));w&&"undefined"==typeof performance&&(r.g.performance=r(6953).performance);var A=console.log.bind(console),E=console.warn.bind(console);w&&(b(),A=t=>h.writeSync(1,t+"\n"),E=t=>h.writeSync(2,t+"\n"));var I,P=u.print||A,D=u.printErr||E;Object.assign(u,m),m=null,u.thisProgram&&(y=u.thisProgram),u.quit&&(_=u.quit),u.wasmBinary&&(I=u.wasmBinary);var $=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&to("no native wasm support detected");var k,C,F,N,L,R,j,M,U=!1,V="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function B(t,e,r){var n=(e>>>=0)+r;for(r=e;t[r]&&!(r>=n);)++r;if(16(i=224==(240&i)?(15&i)<<12|o<<6|a:(7&i)<<18|o<<12|a<<6|63&t[e++])?n+=String.fromCharCode(i):(i-=65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else n+=String.fromCharCode(i)}return n}function z(t,e){return(t>>>=0)?B(i(),t,e):""}function G(t,e,r,n){if(!(0>>=0;n=r+n-1;for(var o=0;o=a&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++o)),127>=a){if(r>=n)break;e[r++>>>0]=a}else{if(2047>=a){if(r+1>=n)break;e[r++>>>0]=192|a>>6}else{if(65535>=a){if(r+2>=n)break;e[r++>>>0]=224|a>>12}else{if(r+3>=n)break;e[r++>>>0]=240|a>>18,e[r++>>>0]=128|a>>12&63}e[r++>>>0]=128|a>>6&63}e[r++>>>0]=128|63&a}}return e[r>>>0]=0,r-i}function H(t){for(var e=0,r=0;r=n?e++:2047>=n?e+=2:55296<=n&&57343>=n?(e+=4,++r):e+=3}return e}function W(t){F=t,u.HEAP8=N=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=R=new Int32Array(t),u.HEAPU8=L=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=j=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=M=new Float64Array(t)}T&&(F=u.buffer);var q=u.INITIAL_MEMORY||16777216;if(T)k=u.wasmMemory,F=u.buffer;else if(u.wasmMemory)k=u.wasmMemory;else if(!((k=new WebAssembly.Memory({initial:q/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw D("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),w&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");k&&(F=k.buffer),q=F.byteLength,W(F);var X,Y=[],K=[],Z=[],J=[];function Q(){return $||!1}function tt(){var t=u.preRun.shift();Y.unshift(t)}var te,tr=0,tn=null,ti=null;function to(t){throw T?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),D(t="Aborted("+t+")"),U=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),c(t),t}function ta(){return te.startsWith("data:application/octet-stream;base64,")}function ts(){var t=te;try{if(t==te&&I)return new Uint8Array(I);if(d)return d(t);throw"both async and sync fetching of the wasm failed"}catch(t){to(t)}}te="ort-wasm-threaded.wasm",ta()||(te=O(te));var tu={};function tl(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function tc(t){(t=th.Vb[t])||to(),th.mc(t)}function tp(t){var e=th.Cc();if(!e)return 6;th.ac.push(e),th.Vb[t.Ub]=e,e.Ub=t.Ub;var r={cmd:"run",start_routine:t.Ic,arg:t.zc,pthread_ptr:t.Ub};return e.$b=()=>{r.time=performance.now(),e.postMessage(r,t.Nc)},e.loaded&&(e.$b(),delete e.$b),0}function tf(t){if(T)return tX(1,1,t);Q()||(th.oc(),u.onExit&&u.onExit(t),U=!0),_(t,new tl(t))}function td(t,e){if(!e&&T)throw tm(t),"unwind";Q()||T||(eu(),tg(Z),es(0),t4[1].length&&t6(1,10),t4[2].length&&t6(2,10),th.oc()),tf(t)}var th={Yb:[],ac:[],qc:[],Vb:{},fc:function(){T&&th.Ec()},Pc:function(){},Ec:function(){th.receiveObjectTransfer=th.Gc,th.threadInitTLS=th.pc,th.setExitStatus=th.nc,$=!1},nc:function(){},oc:function(){for(var t of Object.values(th.Vb))th.mc(t);for(t of th.Yb)t.terminate();th.Yb=[]},mc:function(t){var e=t.Ub;delete th.Vb[e],th.Yb.push(t),th.ac.splice(th.ac.indexOf(t),1),t.Ub=0,ed(e)},Gc:function(){},pc:function(){th.qc.forEach(t=>t())},Fc:function(t,e){t.onmessage=r=>{var n=(r=r.data).cmd;if(t.Ub&&(th.Bc=t.Ub),r.targetThread&&r.targetThread!=ei()){var i=th.Vb[r.Qc];i?i.postMessage(r,r.transferList):D('Internal error! Worker sent a message "'+n+'" to target pthread '+r.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===n?tB(r.queue):"spawnThread"===n?tp(r):"cleanupThread"===n?tc(r.thread):"killThread"===n?(r=r.thread,n=th.Vb[r],delete th.Vb[r],n.terminate(),ed(r),th.ac.splice(th.ac.indexOf(n),1),n.Ub=0):"cancelThread"===n?th.Vb[r.thread].postMessage({cmd:"cancel"}):"loaded"===n?(t.loaded=!0,e&&e(t),t.$b&&(t.$b(),delete t.$b)):"print"===n?P("Thread "+r.threadId+": "+r.text):"printErr"===n?D("Thread "+r.threadId+": "+r.text):"alert"===n?alert("Thread "+r.threadId+": "+r.text):"setimmediate"===r.target?t.postMessage(r):"onAbort"===n?u.onAbort&&u.onAbort(r.arg):n&&D("worker sent an unknown command "+n);th.Bc=void 0},t.onerror=t=>{throw D("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},w&&(t.on("message",function(e){t.onmessage({data:e})}),t.on("error",function(e){t.onerror(e)}),t.on("detachedExit",function(){})),t.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||n,wasmMemory:k,wasmModule:C})},yc:function(){var t=O("ort-wasm-threaded.worker.js");th.Yb.push(new Worker(t))},Cc:function(){return 0==th.Yb.length&&(th.yc(),th.Fc(th.Yb[0])),th.Yb.pop()}};function tg(t){for(;0>2>>>0];t=o()[t+48>>2>>>0],eb(e,e-t),ey(e)};var ty=[];function t_(t){var e=ty[t];return e||(t>=ty.length&&(ty.length=t+1),ty[t]=e=X.get(t)),e}u.invokeEntryPoint=function(t,e){t=t_(t)(e),Q()?th.nc(t):eh(t)};var tv,tx,tw=[],tT=0,tS=0;function tO(t){this.Zb=t,this.Sb=t-24,this.xc=function(t){a()[this.Sb+4>>2>>>0]=t},this.bc=function(){return a()[this.Sb+4>>2>>>0]},this.wc=function(t){a()[this.Sb+8>>2>>>0]=t},this.Dc=function(){return a()[this.Sb+8>>2>>>0]},this.rc=function(){o()[this.Sb>>2>>>0]=0},this.hc=function(t){t=t?1:0,e()[this.Sb+12>>0>>>0]=t},this.uc=function(){return 0!=e()[this.Sb+12>>0>>>0]},this.ic=function(t){t=t?1:0,e()[this.Sb+13>>0>>>0]=t},this.kc=function(){return 0!=e()[this.Sb+13>>0>>>0]},this.fc=function(t,e){this.cc(0),this.xc(t),this.wc(e),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(o(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(o(),this.Sb>>2,1)},this.cc=function(t){a()[this.Sb+16>>2>>>0]=t},this.tc=function(){return a()[this.Sb+16>>2>>>0]},this.vc=function(){if(ex(this.bc()))return a()[this.Zb>>2>>>0];var t=this.tc();return 0!==t?t:this.Zb}}function tA(t){return ea(new tO(t).Sb)}function tE(t,e,r,n){return T?tX(3,1,t,e,r,n):tI(t,e,r,n)}function tI(t,e,r,n){if("undefined"==typeof SharedArrayBuffer)return D("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var i=[];return T&&0===i.length?tE(t,e,r,n):(t={Ic:r,Ub:t,zc:n,Nc:i},T?(t.Oc="spawnThread",postMessage(t,i),0):tp(t))}function tP(t,e,r){return T?tX(4,1,t,e,r):0}function tD(t,e){if(T)return tX(5,1,t,e)}function t$(t,e){if(T)return tX(6,1,t,e)}function tk(t,e,r){if(T)return tX(7,1,t,e,r)}function tC(t,e,r){return T?tX(8,1,t,e,r):0}function tF(t,e){if(T)return tX(9,1,t,e)}function tN(t,e,r){if(T)return tX(10,1,t,e,r)}function tL(t,e,r,n){if(T)return tX(11,1,t,e,r,n)}function tR(t,e,r,n){if(T)return tX(12,1,t,e,r,n)}function tj(t,e,r,n){if(T)return tX(13,1,t,e,r,n)}function tM(t){if(T)return tX(14,1,t)}function tU(t,e){if(T)return tX(15,1,t,e)}function tV(t,e,r){if(T)return tX(16,1,t,e,r)}function tB(t){Atomics.store(o(),t>>2,1),ei()&&ef(t),Atomics.compareExchange(o(),t>>2,1,0)}function tz(t){return a()[t>>>2]+4294967296*o()[t+4>>>2]}function tG(t,e,r,n,i,o){return T?tX(17,1,t,e,r,n,i,o):-52}function tH(t,e,r,n,i,o){if(T)return tX(18,1,t,e,r,n,i,o)}function tW(t){var r=H(t)+1,n=eo(r);return n&&G(t,e(),n,r),n}function tq(t,e,r){function n(t){return(t=t.toTimeString().match(/\(([A-Za-z ]+)\)$/))?t[1]:"GMT"}if(T)return tX(19,1,t,e,r);var i=(new Date).getFullYear(),s=new Date(i,0,1),u=new Date(i,6,1);i=s.getTimezoneOffset();var l=u.getTimezoneOffset(),c=Math.max(i,l);o()[t>>2>>>0]=60*c,o()[e>>2>>>0]=Number(i!=l),t=n(s),e=n(u),t=tW(t),e=tW(e),l>2>>>0]=t,a()[r+4>>2>>>0]=e):(a()[r>>2>>>0]=e,a()[r+4>>2>>>0]=t)}function tX(t,e){var r=arguments.length-2,n=arguments;return tb(()=>{for(var i=e_(8*r),o=i>>3,a=0;a>>0]=u}return ep(t,r,i,e)})}u.executeNotifiedProxyingQueue=tB,tx=w?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:T?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var tY,tK=[],tZ={};function tJ(){if(!tY){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:y||"./this.program"};for(t in tZ)void 0===tZ[t]?delete e[t]:e[t]=tZ[t];var r=[];for(t in e)r.push(t+"="+e[t]);tY=r}return tY}function tQ(t,r){if(T)return tX(20,1,t,r);var n=0;return tJ().forEach(function(i,o){var s=r+n;for(o=a()[t+4*o>>2>>>0]=s,s=0;s>0>>>0]=i.charCodeAt(s);e()[o>>0>>>0]=0,n+=i.length+1}),0}function t0(t,e){if(T)return tX(21,1,t,e);var r=tJ();a()[t>>2>>>0]=r.length;var n=0;return r.forEach(function(t){n+=t.length+1}),a()[e>>2>>>0]=n,0}function t1(t){return T?tX(22,1,t):52}function t2(t,e,r,n){return T?tX(23,1,t,e,r,n):52}function t3(t,e,r,n,i){return T?tX(24,1,t,e,r,n,i):70}var t4=[null,[],[]];function t6(t,e){var r=t4[t];0===e||10===e?((1===t?P:D)(B(r,0)),r.length=0):r.push(e)}function t8(t,e,r,n){if(T)return tX(25,1,t,e,r,n);for(var o=0,s=0;s>2>>>0],l=a()[e+4>>2>>>0];e+=8;for(var c=0;c>>0]);o+=l}return a()[n>>2>>>0]=o,0}var t5=0;function t7(t){return 0==t%4&&(0!=t%100||0==t%400)}var t9=[31,29,31,30,31,30,31,31,30,31,30,31],et=[31,28,31,30,31,30,31,31,30,31,30,31];function ee(t,r,n,i){function a(t,e,r){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0n-t.getDate())){t.setDate(t.getDate()+e);break}e-=n-t.getDate()+1,t.setDate(1),11>r?t.setMonth(r+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return r=new Date(t.getFullYear()+1,0,4),e=l(new Date(t.getFullYear(),0,4)),r=l(r),0>=u(e,t)?0>=u(r,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var p=o()[i+40>>2>>>0];for(var f in i={Lc:o()[i>>2>>>0],Kc:o()[i+4>>2>>>0],dc:o()[i+8>>2>>>0],jc:o()[i+12>>2>>>0],ec:o()[i+16>>2>>>0],Xb:o()[i+20>>2>>>0],Tb:o()[i+24>>2>>>0],Wb:o()[i+28>>2>>>0],Rc:o()[i+32>>2>>>0],Jc:o()[i+36>>2>>>0],Mc:p?z(p):""},n=z(n),p={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(RegExp(f,"g"),p[f]);var d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),h="January February March April May June July August September October November December".split(" ");for(f in p={"%a":function(t){return d[t.Tb].substring(0,3)},"%A":function(t){return d[t.Tb]},"%b":function(t){return h[t.ec].substring(0,3)},"%B":function(t){return h[t.ec]},"%C":function(t){return s((t.Xb+1900)/100|0,2)},"%d":function(t){return s(t.jc,2)},"%e":function(t){return a(t.jc,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return s(t.dc,2)},"%I":function(t){return 0==(t=t.dc)?t=12:12t.dc?"AM":"PM"},"%S":function(t){return s(t.Lc,2)},"%t":function(){return" "},"%u":function(t){return t.Tb||7},"%U":function(t){return s(Math.floor((t.Wb+7-t.Tb)/7),2)},"%V":function(t){var e=Math.floor((t.Wb+7-(t.Tb+6)%7)/7);if(2>=(t.Tb+371-t.Wb-2)%7&&e++,e)53==e&&(4==(r=(t.Tb+371-t.Wb)%7)||3==r&&t7(t.Xb)||(e=1));else{e=52;var r=(t.Tb+7-t.Wb-1)%7;(4==r||5==r&&t7(t.Xb%400-1))&&e++}return s(e,2)},"%w":function(t){return t.Tb},"%W":function(t){return s(Math.floor((t.Wb+7-(t.Tb+6)%7)/7),2)},"%y":function(t){return(t.Xb+1900).toString().substring(2)},"%Y":function(t){return t.Xb+1900},"%z":function(t){var e=0<=(t=t.Jc);return(e?"+":"-")+String("0000"+((t=Math.abs(t)/60)/60*100+t%60)).slice(-4)},"%Z":function(t){return t.Mc},"%%":function(){return"%"}},n=n.replace(/%%/g,"\0\0"),p)n.includes(f)&&(n=n.replace(RegExp(f,"g"),p[f](i)));return(f=function(t){var e=Array(H(t)+1);return G(t,e,0,e.length),e}(n=n.replace(/\0\0/g,"%"))).length>r?0:(function(t,r){e().set(t,r>>>0)}(f,t),f.length-1)}th.fc();var er=[null,tf,tm,tE,tP,tD,t$,tk,tC,tF,tN,tL,tR,tj,tM,tU,tV,tG,tH,tq,tQ,t0,t1,t2,t3,t8],en={b:function(t){return eo(t+24)+24},n:function(t){return(t=new tO(t)).uc()||(t.hc(!0),tT--),t.ic(!1),tw.push(t),t.sc(),t.vc()},ma:function(t){throw D("Unexpected exception thrown, this is not properly supported - aborting"),U=!0,t},x:function(){eg(0);var t=tw.pop();if(t.Hc()&&!t.kc()){var e=t.Dc();e&&t_(e)(t.Zb),tA(t.Zb)}tS=0},e:function(){var t=tS;if(!t)return t5=0;var e=new tO(t);e.cc(t);var r=e.bc();if(!r)return t5=0,t;for(var n=Array.prototype.slice.call(arguments),i=0;itB(n));else if(T)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:n});else{if(!(t=th.Vb[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:n})}return 1},Ea:function(){return -1},Pa:function(t,e){t=new Date(1e3*tz(t)),o()[e>>2>>>0]=t.getUTCSeconds(),o()[e+4>>2>>>0]=t.getUTCMinutes(),o()[e+8>>2>>>0]=t.getUTCHours(),o()[e+12>>2>>>0]=t.getUTCDate(),o()[e+16>>2>>>0]=t.getUTCMonth(),o()[e+20>>2>>>0]=t.getUTCFullYear()-1900,o()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,o()[e+28>>2>>>0]=t},Qa:function(t,e){t=new Date(1e3*tz(t)),o()[e>>2>>>0]=t.getSeconds(),o()[e+4>>2>>>0]=t.getMinutes(),o()[e+8>>2>>>0]=t.getHours(),o()[e+12>>2>>>0]=t.getDate(),o()[e+16>>2>>>0]=t.getMonth(),o()[e+20>>2>>>0]=t.getFullYear()-1900,o()[e+24>>2>>>0]=t.getDay();var r=new Date(t.getFullYear(),0,1),n=(t.getTime()-r.getTime())/864e5|0;o()[e+28>>2>>>0]=n,o()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),t=0|((n=new Date(t.getFullYear(),6,1).getTimezoneOffset())!=(r=r.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(r,n)),o()[e+32>>2>>>0]=t},Ra:function(t){var e=new Date(o()[t+20>>2>>>0]+1900,o()[t+16>>2>>>0],o()[t+12>>2>>>0],o()[t+8>>2>>>0],o()[t+4>>2>>>0],o()[t>>2>>>0],0),r=o()[t+32>>2>>>0],n=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),a=new Date(e.getFullYear(),6,1).getTimezoneOffset(),s=i.getTimezoneOffset(),u=Math.min(s,a);return 0>r?o()[t+32>>2>>>0]=Number(a!=s&&u==n):0>2>>>0]=e.getDay(),r=(e.getTime()-i.getTime())/864e5|0,o()[t+28>>2>>>0]=r,o()[t>>2>>>0]=e.getSeconds(),o()[t+4>>2>>>0]=e.getMinutes(),o()[t+8>>2>>>0]=e.getHours(),o()[t+12>>2>>>0]=e.getDate(),o()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},Aa:tG,Ba:tH,Sa:function t(e,r,n){t.Ac||(t.Ac=!0,tq(e,r,n))},y:function(){to("")},U:function(){if(!w&&!x){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";tv||(tv={}),tv[t]||(tv[t]=1,w&&(t="warning: "+t),D(t))}},ra:function(){return 4294901760},B:tx,Ia:function(t,e,r){i().copyWithin(t>>>0,e>>>0,e+r>>>0)},F:function(){return w?r(3993).cpus().length:navigator.hardwareConcurrency},Da:function(t,e,r){tK.length=e,r>>=3;for(var n=0;n>>0];return(0>t?tu[-t-1]:er[t]).apply(null,tK)},qa:function(t){var e=i().length;if((t>>>=0)<=e||4294901760=r;r*=2){var n=e*(1+.2/r);n=Math.min(n,t+100663296);var o=Math;n=Math.max(t,n),o=o.min.call(o,4294901760,n+(65536-n%65536)%65536);t:{try{k.grow(o-F.byteLength+65535>>>16),W(k.buffer);var a=1;break t}catch(t){}a=void 0}if(a)return!0}return!1},Na:function(){throw"unwind"},Ga:tQ,Ha:t0,J:td,I:t1,S:t2,ga:t3,R:t8,d:function(){return t5},na:function t(n,i){t.lc||(t.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(w)try{var e=r(Object(function(){var t=Error("Cannot find module 'crypto'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>to("randomDevice")}());for(var o=0;o>0>>>0]=t.lc();return 0},ia:function(t,e,r){var n=em();try{return t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},ja:function(t,e,r){var n=em();try{return t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},K:function(t){var e=em();try{return t_(t)()}catch(t){if(ey(e),t!==t+0)throw t;eg(1,0)}},f:function(t,e){var r=em();try{return t_(t)(e)}catch(t){if(ey(r),t!==t+0)throw t;eg(1,0)}},P:function(t,e,r){var n=em();try{return t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},Q:function(t,e,r){var n=em();try{return t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},k:function(t,e,r){var n=em();try{return t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},p:function(t,e,r,n){var i=em();try{return t_(t)(e,r,n)}catch(t){if(ey(i),t!==t+0)throw t;eg(1,0)}},q:function(t,e,r,n,i){var o=em();try{return t_(t)(e,r,n,i)}catch(t){if(ey(o),t!==t+0)throw t;eg(1,0)}},N:function(t,e,r,n,i,o){var a=em();try{return t_(t)(e,r,n,i,o)}catch(t){if(ey(a),t!==t+0)throw t;eg(1,0)}},s:function(t,e,r,n,i,o){var a=em();try{return t_(t)(e,r,n,i,o)}catch(t){if(ey(a),t!==t+0)throw t;eg(1,0)}},w:function(t,e,r,n,i,o,a){var s=em();try{return t_(t)(e,r,n,i,o,a)}catch(t){if(ey(s),t!==t+0)throw t;eg(1,0)}},L:function(t,e,r,n,i,o,a,s){var u=em();try{return t_(t)(e,r,n,i,o,a,s)}catch(t){if(ey(u),t!==t+0)throw t;eg(1,0)}},E:function(t,e,r,n,i,o,a,s,u,l,c,p){var f=em();try{return t_(t)(e,r,n,i,o,a,s,u,l,c,p)}catch(t){if(ey(f),t!==t+0)throw t;eg(1,0)}},aa:function(t,e,r,n,i,o,a,s){var u=em();try{return eD(t,e,r,n,i,o,a,s)}catch(t){if(ey(u),t!==t+0)throw t;eg(1,0)}},_:function(t,e,r,n,i,o,a){var s=em();try{return eT(t,e,r,n,i,o,a)}catch(t){if(ey(s),t!==t+0)throw t;eg(1,0)}},Z:function(t,e,r,n,i){var o=em();try{return e$(t,e,r,n,i)}catch(t){if(ey(o),t!==t+0)throw t;eg(1,0)}},ca:function(t,e,r,n){var i=em();try{return eI(t,e,r,n)}catch(t){if(ey(i),t!==t+0)throw t;eg(1,0)}},$:function(t){var e=em();try{return ew(t)}catch(t){if(ey(e),t!==t+0)throw t;eg(1,0)}},ba:function(t,e){var r=em();try{return eP(t,e)}catch(t){if(ey(r),t!==t+0)throw t;eg(1,0)}},Y:function(t,e,r){var n=em();try{return eS(t,e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},g:function(t){var e=em();try{t_(t)()}catch(t){if(ey(e),t!==t+0)throw t;eg(1,0)}},r:function(t,e){var r=em();try{t_(t)(e)}catch(t){if(ey(r),t!==t+0)throw t;eg(1,0)}},i:function(t,e,r){var n=em();try{t_(t)(e,r)}catch(t){if(ey(n),t!==t+0)throw t;eg(1,0)}},ha:function(t,e,r,n){var i=em();try{t_(t)(e,r,n)}catch(t){if(ey(i),t!==t+0)throw t;eg(1,0)}},m:function(t,e,r,n){var i=em();try{t_(t)(e,r,n)}catch(t){if(ey(i),t!==t+0)throw t;eg(1,0)}},v:function(t,e,r,n,i){var o=em();try{t_(t)(e,r,n,i)}catch(t){if(ey(o),t!==t+0)throw t;eg(1,0)}},u:function(t,e,r,n,i,o){var a=em();try{t_(t)(e,r,n,i,o)}catch(t){if(ey(a),t!==t+0)throw t;eg(1,0)}},O:function(t,e,r,n,i,o,a){var s=em();try{t_(t)(e,r,n,i,o,a)}catch(t){if(ey(s),t!==t+0)throw t;eg(1,0)}},A:function(t,e,r,n,i,o,a,s){var u=em();try{t_(t)(e,r,n,i,o,a,s)}catch(t){if(ey(u),t!==t+0)throw t;eg(1,0)}},ka:function(t,e,r,n,i,o,a,s,u){var l=em();try{t_(t)(e,r,n,i,o,a,s,u)}catch(t){if(ey(l),t!==t+0)throw t;eg(1,0)}},C:function(t,e,r,n,i,o,a,s,u,l,c){var p=em();try{t_(t)(e,r,n,i,o,a,s,u,l,c)}catch(t){if(ey(p),t!==t+0)throw t;eg(1,0)}},D:function(t,e,r,n,i,o,a,s,u,l,c,p,f,d,h,g){var b=em();try{t_(t)(e,r,n,i,o,a,s,u,l,c,p,f,d,h,g)}catch(t){if(ey(b),t!==t+0)throw t;eg(1,0)}},fa:function(t,e,r,n,i,o,a,s){var u=em();try{eO(t,e,r,n,i,o,a,s)}catch(t){if(ey(u),t!==t+0)throw t;eg(1,0)}},da:function(t,e,r,n,i,o,a,s,u,l,c,p){var f=em();try{eE(t,e,r,n,i,o,a,s,u,l,c,p)}catch(t){if(ey(f),t!==t+0)throw t;eg(1,0)}},ea:function(t,e,r,n,i,o){var a=em();try{eA(t,e,r,n,i,o)}catch(t){if(ey(a),t!==t+0)throw t;eg(1,0)}},o:function(t){return t},a:k||u.wasmMemory,G:function(t){t5=t},la:ee,z:function(t,e,r,n){return ee(t,e,r,n)}};(function(){function t(t,e){u.asm=t.exports,th.qc.push(u.asm.sb),X=u.asm.ub,K.unshift(u.asm.Va),C=e,T||(tr--,u.monitorRunDependencies&&u.monitorRunDependencies(tr),0==tr&&(null!==tn&&(clearInterval(tn),tn=null),ti&&(t=ti,ti=null,t())))}function e(e){t(e.instance,e.module)}function r(t){return(function(){if(!I&&(v||x)){if("function"==typeof fetch&&!te.startsWith("file://"))return fetch(te,{credentials:"same-origin"}).then(function(t){if(!t.ok)throw"failed to load wasm binary file at '"+te+"'";return t.arrayBuffer()}).catch(function(){return ts()});if(f)return new Promise(function(t,e){f(te,function(e){t(new Uint8Array(e))},e)})}return Promise.resolve().then(function(){return ts()})})().then(function(t){return WebAssembly.instantiate(t,n)}).then(function(t){return t}).then(t,function(t){D("failed to asynchronously prepare wasm: "+t),to(t)})}var n={a:en};if(T||(tr++,u.monitorRunDependencies&&u.monitorRunDependencies(tr)),u.instantiateWasm)try{return u.instantiateWasm(n,t)}catch(t){return D("Module.instantiateWasm callback failed with error: "+t),!1}(I||"function"!=typeof WebAssembly.instantiateStreaming||ta()||te.startsWith("file://")||w||"function"!=typeof fetch?r(e):fetch(te,{credentials:"same-origin"}).then(function(t){return WebAssembly.instantiateStreaming(t,n).then(e,function(t){return D("wasm streaming compile failed: "+t),D("falling back to ArrayBuffer instantiation"),r(e)})})).catch(c)})(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.Va).apply(null,arguments)},u._OrtInit=function(){return(u._OrtInit=u.asm.Wa).apply(null,arguments)},u._OrtCreateSessionOptions=function(){return(u._OrtCreateSessionOptions=u.asm.Xa).apply(null,arguments)},u._OrtAppendExecutionProvider=function(){return(u._OrtAppendExecutionProvider=u.asm.Ya).apply(null,arguments)},u._OrtAddSessionConfigEntry=function(){return(u._OrtAddSessionConfigEntry=u.asm.Za).apply(null,arguments)},u._OrtReleaseSessionOptions=function(){return(u._OrtReleaseSessionOptions=u.asm._a).apply(null,arguments)},u._OrtCreateSession=function(){return(u._OrtCreateSession=u.asm.$a).apply(null,arguments)},u._OrtReleaseSession=function(){return(u._OrtReleaseSession=u.asm.ab).apply(null,arguments)},u._OrtGetInputCount=function(){return(u._OrtGetInputCount=u.asm.bb).apply(null,arguments)},u._OrtGetOutputCount=function(){return(u._OrtGetOutputCount=u.asm.cb).apply(null,arguments)},u._OrtGetInputName=function(){return(u._OrtGetInputName=u.asm.db).apply(null,arguments)},u._OrtGetOutputName=function(){return(u._OrtGetOutputName=u.asm.eb).apply(null,arguments)},u._OrtFree=function(){return(u._OrtFree=u.asm.fb).apply(null,arguments)},u._OrtCreateTensor=function(){return(u._OrtCreateTensor=u.asm.gb).apply(null,arguments)},u._OrtGetTensorData=function(){return(u._OrtGetTensorData=u.asm.hb).apply(null,arguments)},u._OrtReleaseTensor=function(){return(u._OrtReleaseTensor=u.asm.ib).apply(null,arguments)},u._OrtCreateRunOptions=function(){return(u._OrtCreateRunOptions=u.asm.jb).apply(null,arguments)},u._OrtAddRunConfigEntry=function(){return(u._OrtAddRunConfigEntry=u.asm.kb).apply(null,arguments)},u._OrtReleaseRunOptions=function(){return(u._OrtReleaseRunOptions=u.asm.lb).apply(null,arguments)},u._OrtRun=function(){return(u._OrtRun=u.asm.mb).apply(null,arguments)},u._OrtEndProfiling=function(){return(u._OrtEndProfiling=u.asm.nb).apply(null,arguments)};var ei=u._pthread_self=function(){return(ei=u._pthread_self=u.asm.ob).apply(null,arguments)},eo=u._malloc=function(){return(eo=u._malloc=u.asm.pb).apply(null,arguments)},ea=u._free=function(){return(ea=u._free=u.asm.qb).apply(null,arguments)},es=u._fflush=function(){return(es=u._fflush=u.asm.rb).apply(null,arguments)};u.__emscripten_tls_init=function(){return(u.__emscripten_tls_init=u.asm.sb).apply(null,arguments)};var eu=u.___funcs_on_exit=function(){return(eu=u.___funcs_on_exit=u.asm.tb).apply(null,arguments)},el=u.__emscripten_thread_init=function(){return(el=u.__emscripten_thread_init=u.asm.vb).apply(null,arguments)};u.__emscripten_thread_crashed=function(){return(u.__emscripten_thread_crashed=u.asm.wb).apply(null,arguments)};var ec,ep=u._emscripten_run_in_main_runtime_thread_js=function(){return(ep=u._emscripten_run_in_main_runtime_thread_js=u.asm.xb).apply(null,arguments)},ef=u.__emscripten_proxy_execute_task_queue=function(){return(ef=u.__emscripten_proxy_execute_task_queue=u.asm.yb).apply(null,arguments)},ed=u.__emscripten_thread_free_data=function(){return(ed=u.__emscripten_thread_free_data=u.asm.zb).apply(null,arguments)},eh=u.__emscripten_thread_exit=function(){return(eh=u.__emscripten_thread_exit=u.asm.Ab).apply(null,arguments)},eg=u._setThrew=function(){return(eg=u._setThrew=u.asm.Bb).apply(null,arguments)},eb=u._emscripten_stack_set_limits=function(){return(eb=u._emscripten_stack_set_limits=u.asm.Cb).apply(null,arguments)},em=u.stackSave=function(){return(em=u.stackSave=u.asm.Db).apply(null,arguments)},ey=u.stackRestore=function(){return(ey=u.stackRestore=u.asm.Eb).apply(null,arguments)},e_=u.stackAlloc=function(){return(e_=u.stackAlloc=u.asm.Fb).apply(null,arguments)},ev=u.___cxa_can_catch=function(){return(ev=u.___cxa_can_catch=u.asm.Gb).apply(null,arguments)},ex=u.___cxa_is_pointer_type=function(){return(ex=u.___cxa_is_pointer_type=u.asm.Hb).apply(null,arguments)},ew=u.dynCall_j=function(){return(ew=u.dynCall_j=u.asm.Ib).apply(null,arguments)},eT=u.dynCall_iiiiij=function(){return(eT=u.dynCall_iiiiij=u.asm.Jb).apply(null,arguments)},eS=u.dynCall_jii=function(){return(eS=u.dynCall_jii=u.asm.Kb).apply(null,arguments)},eO=u.dynCall_viiiiij=function(){return(eO=u.dynCall_viiiiij=u.asm.Lb).apply(null,arguments)},eA=u.dynCall_vjji=function(){return(eA=u.dynCall_vjji=u.asm.Mb).apply(null,arguments)},eE=u.dynCall_viiijjjii=function(){return(eE=u.dynCall_viiijjjii=u.asm.Nb).apply(null,arguments)},eI=u.dynCall_iij=function(){return(eI=u.dynCall_iij=u.asm.Ob).apply(null,arguments)},eP=u.dynCall_ji=function(){return(eP=u.dynCall_ji=u.asm.Pb).apply(null,arguments)},eD=u.dynCall_iiiiiij=function(){return(eD=u.dynCall_iiiiiij=u.asm.Qb).apply(null,arguments)},e$=u.dynCall_iiij=function(){return(e$=u.dynCall_iiij=u.asm.Rb).apply(null,arguments)};function ek(){function t(){if(!ec&&(ec=!0,u.calledRun=!0,!U)&&(T||tg(K),l(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!T)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();J.unshift(t)}tg(J)}}if(!(0{var n,i=(n=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise(function(t,e){i=t,o=e});var e,i,o,a,s,u,l,c,p,f=Object.assign({},e),d="./this.program",h=(t,e)=>{throw e},g="object"==typeof window,b="function"==typeof importScripts,m="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,y="";m?(y=b?r(908).dirname(y)+"/":"//",p=()=>{c||(l=r(1384),c=r(908))},a=function(t,e){return p(),t=c.normalize(t),l.readFileSync(t,e?void 0:"utf8")},u=t=>((t=a(t,!0)).buffer||(t=new Uint8Array(t)),t),s=(t,e,r)=>{p(),t=c.normalize(t),l.readFile(t,function(t,n){t?r(t):e(n.buffer)})},1{if(w||0{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},b&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),s=(t,e,r)=>{var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)});var _,v=e.print||console.log.bind(console),x=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(d=e.thisProgram),e.quit&&(h=e.quit),e.wasmBinary&&(_=e.wasmBinary);var w=e.noExitRuntime||!1;"object"!=typeof WebAssembly&&q("no native wasm support detected");var T,S,O,A,E,I,P=!1,D="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function $(t,e,r){var n=(e>>>=0)+r;for(r=e;t[r]&&!(r>=n);)++r;if(16(i=224==(240&i)?(15&i)<<12|o<<6|a:(7&i)<<18|o<<12|a<<6|63&t[e++])?n+=String.fromCharCode(i):(i-=65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else n+=String.fromCharCode(i)}return n}function k(t,e){return(t>>>=0)?$(A,t,e):""}function C(t,e,r,n){if(!(0>>=0;n=r+n-1;for(var o=0;o=a&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++o)),127>=a){if(r>=n)break;e[r++>>>0]=a}else{if(2047>=a){if(r+1>=n)break;e[r++>>>0]=192|a>>6}else{if(65535>=a){if(r+2>=n)break;e[r++>>>0]=224|a>>12}else{if(r+3>=n)break;e[r++>>>0]=240|a>>18,e[r++>>>0]=128|a>>12&63}e[r++>>>0]=128|a>>6&63}e[r++>>>0]=128|63&a}}return e[r>>>0]=0,r-i}function F(t){for(var e=0,r=0;r=n?e++:2047>=n?e+=2:55296<=n&&57343>=n?(e+=4,++r):e+=3}return e}function N(){var t=T.buffer;S=t,e.HEAP8=O=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=E=new Int32Array(t),e.HEAPU8=A=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=I=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var L,R=[],j=[],M=[],U=[],V=0;function B(){var t=e.preRun.shift();R.unshift(t)}var z,G=0,H=null,W=null;function q(t){throw e.onAbort&&e.onAbort(t),x(t="Aborted("+t+")"),P=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),o(t),t}function X(){return z.startsWith("data:application/octet-stream;base64,")}if(z="ort-wasm.wasm",!X()){var Y=z;z=e.locateFile?e.locateFile(Y,y):y+Y}function K(){var t=z;try{if(t==z&&_)return new Uint8Array(_);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){q(t)}}function Z(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function J(t){for(;0>2>>>0]=t},this.Eb=function(){return I[this.zb+4>>2>>>0]},this.Sb=function(t){I[this.zb+8>>2>>>0]=t},this.Wb=function(){return I[this.zb+8>>2>>>0]},this.Tb=function(){E[this.zb>>2>>>0]=0},this.Ib=function(t){O[this.zb+12>>0>>>0]=t?1:0},this.Pb=function(){return 0!=O[this.zb+12>>0>>>0]},this.Jb=function(t){O[this.zb+13>>0>>>0]=t?1:0},this.Lb=function(){return 0!=O[this.zb+13>>0>>>0]},this.Rb=function(t,e){this.Fb(0),this.Ub(t),this.Sb(e),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){E[this.zb>>2>>>0]+=1},this.Xb=function(){var t=E[this.zb>>2>>>0];return E[this.zb>>2>>>0]=t-1,1===t},this.Fb=function(t){I[this.zb+16>>2>>>0]=t},this.Ob=function(){return I[this.zb+16>>2>>>0]},this.Qb=function(){if(tI(this.Eb()))return I[this.Db>>2>>>0];var t=this.Ob();return 0!==t?t:this.Db}}function tn(t){return tv(new tr(t).zb)}var ti=[];function to(t){var e=ti[t];return e||(t>=ti.length&&(ti.length=t+1),ti[t]=e=L.get(t)),e}function ta(t){var e=F(t)+1,r=t_(e);return r&&C(t,O,r,e),r}var ts={};function tu(){if(!tl){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:d||"./this.program"};for(t in ts)void 0===ts[t]?delete e[t]:e[t]=ts[t];var r=[];for(t in e)r.push(t+"="+e[t]);tl=r}return tl}var tl,tc=[null,[],[]];function tp(t,e){var r=tc[t];0===e||10===e?((1===t?v:x)($(r,0)),r.length=0):r.push(e)}var tf=0;function td(t){return 0==t%4&&(0!=t%100||0==t%400)}var th=[31,29,31,30,31,30,31,31,30,31,30,31],tg=[31,28,31,30,31,30,31,31,30,31,30,31];function tb(t,e,r,n){function i(t,e,r){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0n-t.getDate())){t.setDate(t.getDate()+e);break}e-=n-t.getDate()+1,t.setDate(1),11>r?t.setMonth(r+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return r=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),r=s(r),0>=a(e,t)?0>=a(r,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var l=E[n+40>>2>>>0];for(var c in n={$b:E[n>>2>>>0],Zb:E[n+4>>2>>>0],Gb:E[n+8>>2>>>0],Kb:E[n+12>>2>>>0],Hb:E[n+16>>2>>>0],Cb:E[n+20>>2>>>0],Ab:E[n+24>>2>>>0],Bb:E[n+28>>2>>>0],bc:E[n+32>>2>>>0],Yb:E[n+36>>2>>>0],ac:l?k(l):""},r=k(r),l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(RegExp(c,"g"),l[c]);var p="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),f="January February March April May June July August September October November December".split(" ");for(c in l={"%a":function(t){return p[t.Ab].substring(0,3)},"%A":function(t){return p[t.Ab]},"%b":function(t){return f[t.Hb].substring(0,3)},"%B":function(t){return f[t.Hb]},"%C":function(t){return o((t.Cb+1900)/100|0,2)},"%d":function(t){return o(t.Kb,2)},"%e":function(t){return i(t.Kb,2," ")},"%g":function(t){return u(t).toString().substring(2)},"%G":function(t){return u(t)},"%H":function(t){return o(t.Gb,2)},"%I":function(t){return 0==(t=t.Gb)?t=12:12t.Gb?"AM":"PM"},"%S":function(t){return o(t.$b,2)},"%t":function(){return" "},"%u":function(t){return t.Ab||7},"%U":function(t){return o(Math.floor((t.Bb+7-t.Ab)/7),2)},"%V":function(t){var e=Math.floor((t.Bb+7-(t.Ab+6)%7)/7);if(2>=(t.Ab+371-t.Bb-2)%7&&e++,e)53==e&&(4==(r=(t.Ab+371-t.Bb)%7)||3==r&&td(t.Cb)||(e=1));else{e=52;var r=(t.Ab+7-t.Bb-1)%7;(4==r||5==r&&td(t.Cb%400-1))&&e++}return o(e,2)},"%w":function(t){return t.Ab},"%W":function(t){return o(Math.floor((t.Bb+7-(t.Ab+6)%7)/7),2)},"%y":function(t){return(t.Cb+1900).toString().substring(2)},"%Y":function(t){return t.Cb+1900},"%z":function(t){var e=0<=(t=t.Yb);return(e?"+":"-")+String("0000"+((t=Math.abs(t)/60)/60*100+t%60)).slice(-4)},"%Z":function(t){return t.ac},"%%":function(){return"%"}},r=r.replace(/%%/g,"\0\0"),l)r.includes(c)&&(r=r.replace(RegExp(c,"g"),l[c](n)));return(c=function(t){var e=Array(F(t)+1);return C(t,e,0,e.length),e}(r=r.replace(/\0\0/g,"%"))).length>e?0:(O.set(c,t>>>0),c.length-1)}var tm={a:function(t){return t_(t+24)+24},m:function(t){return(t=new tr(t)).Pb()||(t.Ib(!0),tt--),t.Jb(!1),Q.push(t),t.Nb(),t.Qb()},ia:function(t){throw x("Unexpected exception thrown, this is not properly supported - aborting"),P=!0,t},w:function(){tT(0);var t=Q.pop();if(t.Xb()&&!t.Lb()){var e=t.Wb();e&&to(e)(t.Db),tn(t.Db)}te=0},d:function(){var t=te;if(!t)return tf=0;var e=new tr(t);e.Fb(t);var r=e.Eb();if(!r)return tf=0,t;for(var n=Array.prototype.slice.call(arguments),i=0;i>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getUTCSeconds(),E[e+4>>2>>>0]=t.getUTCMinutes(),E[e+8>>2>>>0]=t.getUTCHours(),E[e+12>>2>>>0]=t.getUTCDate(),E[e+16>>2>>>0]=t.getUTCMonth(),E[e+20>>2>>>0]=t.getUTCFullYear()-1900,E[e+24>>2>>>0]=t.getUTCDay(),E[e+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(t,e){t=new Date(1e3*(I[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getSeconds(),E[e+4>>2>>>0]=t.getMinutes(),E[e+8>>2>>>0]=t.getHours(),E[e+12>>2>>>0]=t.getDate(),E[e+16>>2>>>0]=t.getMonth(),E[e+20>>2>>>0]=t.getFullYear()-1900,E[e+24>>2>>>0]=t.getDay();var r=new Date(t.getFullYear(),0,1);E[e+28>>2>>>0]=(t.getTime()-r.getTime())/864e5|0,E[e+36>>2>>>0]=-60*t.getTimezoneOffset();var n=new Date(t.getFullYear(),6,1).getTimezoneOffset();r=r.getTimezoneOffset(),E[e+32>>2>>>0]=0|(n!=r&&t.getTimezoneOffset()==Math.min(r,n))},Fa:function(t){var e=new Date(E[t+20>>2>>>0]+1900,E[t+16>>2>>>0],E[t+12>>2>>>0],E[t+8>>2>>>0],E[t+4>>2>>>0],E[t>>2>>>0],0),r=E[t+32>>2>>>0],n=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),a=i.getTimezoneOffset(),s=Math.min(a,o);return 0>r?E[t+32>>2>>>0]=Number(o!=a&&s==n):0>2>>>0]=e.getDay(),E[t+28>>2>>>0]=(e.getTime()-i.getTime())/864e5|0,E[t>>2>>>0]=e.getSeconds(),E[t+4>>2>>>0]=e.getMinutes(),E[t+8>>2>>>0]=e.getHours(),E[t+12>>2>>>0]=e.getDate(),E[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},sa:function(){return -52},ta:function(){},Ga:function t(e,r,n){t.Vb||(t.Vb=!0,function(t,e,r){function n(t){return(t=t.toTimeString().match(/\(([A-Za-z ]+)\)$/))?t[1]:"GMT"}var i=(new Date).getFullYear(),o=new Date(i,0,1),a=new Date(i,6,1);i=o.getTimezoneOffset();var s=a.getTimezoneOffset();E[t>>2>>>0]=60*Math.max(i,s),E[e>>2>>>0]=Number(i!=s),t=n(o),e=n(a),t=ta(t),e=ta(e),s>2>>>0]=t,I[r+4>>2>>>0]=e):(I[r>>2>>>0]=e,I[r+4>>2>>>0]=t)}(e,r,n))},B:function(){q("")},ma:function(){return 4294901760},I:m?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),xa:function(t,e,r){A.copyWithin(t>>>0,e>>>0,e+r>>>0)},G:function(t){var e=A.length;if(4294901760<(t>>>=0))return!1;for(var r=1;4>=r;r*=2){var n=e*(1+.2/r);n=Math.min(n,t+100663296);var i=Math;n=Math.max(t,n),i=i.min.call(i,4294901760,n+(65536-n%65536)%65536);t:{try{T.grow(i-S.byteLength+65535>>>16),N();var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},va:function(t,e){var r=0;return tu().forEach(function(n,i){var o=e+r;for(i=I[t+4*i>>2>>>0]=o,o=0;o>0>>>0]=n.charCodeAt(o);O[i>>0>>>0]=0,r+=n.length+1}),0},wa:function(t,e){var r=tu();I[t>>2>>>0]=r.length;var n=0;return r.forEach(function(t){n+=t.length+1}),I[e>>2>>>0]=n,0},ba:function(t){w||0>2>>>0],s=I[e+4>>2>>>0];e+=8;for(var u=0;u>>0]);i+=s}return I[n>>2>>>0]=i,0},c:function(){return tf},ja:function t(e,n){t.Mb||(t.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(m)try{var e=r(Object(function(){var t=Error("Cannot find module 'crypto'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>q("randomDevice")}());for(var i=0;i>0>>>0]=t.Mb();return 0},ea:function(t,e,r){var n=tS();try{return to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},fa:function(t,e,r){var n=tS();try{return to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},J:function(t){var e=tS();try{return to(t)()}catch(t){if(tO(e),t!==t+0)throw t;tT(1,0)}},e:function(t,e){var r=tS();try{return to(t)(e)}catch(t){if(tO(r),t!==t+0)throw t;tT(1,0)}},N:function(t,e,r){var n=tS();try{return to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},O:function(t,e,r){var n=tS();try{return to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},j:function(t,e,r){var n=tS();try{return to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},o:function(t,e,r,n){var i=tS();try{return to(t)(e,r,n)}catch(t){if(tO(i),t!==t+0)throw t;tT(1,0)}},p:function(t,e,r,n,i){var o=tS();try{return to(t)(e,r,n,i)}catch(t){if(tO(o),t!==t+0)throw t;tT(1,0)}},M:function(t,e,r,n,i,o){var a=tS();try{return to(t)(e,r,n,i,o)}catch(t){if(tO(a),t!==t+0)throw t;tT(1,0)}},r:function(t,e,r,n,i,o){var a=tS();try{return to(t)(e,r,n,i,o)}catch(t){if(tO(a),t!==t+0)throw t;tT(1,0)}},v:function(t,e,r,n,i,o,a){var s=tS();try{return to(t)(e,r,n,i,o,a)}catch(t){if(tO(s),t!==t+0)throw t;tT(1,0)}},K:function(t,e,r,n,i,o,a,s){var u=tS();try{return to(t)(e,r,n,i,o,a,s)}catch(t){if(tO(u),t!==t+0)throw t;tT(1,0)}},D:function(t,e,r,n,i,o,a,s,u,l,c,p){var f=tS();try{return to(t)(e,r,n,i,o,a,s,u,l,c,p)}catch(t){if(tO(f),t!==t+0)throw t;tT(1,0)}},X:function(t,e,r,n,i,o,a,s){var u=tS();try{return tR(t,e,r,n,i,o,a,s)}catch(t){if(tO(u),t!==t+0)throw t;tT(1,0)}},V:function(t,e,r,n,i,o,a){var s=tS();try{return tD(t,e,r,n,i,o,a)}catch(t){if(tO(s),t!==t+0)throw t;tT(1,0)}},U:function(t,e,r,n,i){var o=tS();try{return tj(t,e,r,n,i)}catch(t){if(tO(o),t!==t+0)throw t;tT(1,0)}},Z:function(t,e,r,n){var i=tS();try{return tN(t,e,r,n)}catch(t){if(tO(i),t!==t+0)throw t;tT(1,0)}},W:function(t){var e=tS();try{return tP(t)}catch(t){if(tO(e),t!==t+0)throw t;tT(1,0)}},Y:function(t,e){var r=tS();try{return tL(t,e)}catch(t){if(tO(r),t!==t+0)throw t;tT(1,0)}},T:function(t,e,r){var n=tS();try{return t$(t,e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},f:function(t){var e=tS();try{to(t)()}catch(t){if(tO(e),t!==t+0)throw t;tT(1,0)}},q:function(t,e){var r=tS();try{to(t)(e)}catch(t){if(tO(r),t!==t+0)throw t;tT(1,0)}},h:function(t,e,r){var n=tS();try{to(t)(e,r)}catch(t){if(tO(n),t!==t+0)throw t;tT(1,0)}},da:function(t,e,r,n){var i=tS();try{to(t)(e,r,n)}catch(t){if(tO(i),t!==t+0)throw t;tT(1,0)}},l:function(t,e,r,n){var i=tS();try{to(t)(e,r,n)}catch(t){if(tO(i),t!==t+0)throw t;tT(1,0)}},t:function(t,e,r,n,i){var o=tS();try{to(t)(e,r,n,i)}catch(t){if(tO(o),t!==t+0)throw t;tT(1,0)}},u:function(t,e,r,n,i,o){var a=tS();try{to(t)(e,r,n,i,o)}catch(t){if(tO(a),t!==t+0)throw t;tT(1,0)}},x:function(t,e,r,n,i,o,a){var s=tS();try{to(t)(e,r,n,i,o,a)}catch(t){if(tO(s),t!==t+0)throw t;tT(1,0)}},z:function(t,e,r,n,i,o,a,s){var u=tS();try{to(t)(e,r,n,i,o,a,s)}catch(t){if(tO(u),t!==t+0)throw t;tT(1,0)}},ga:function(t,e,r,n,i,o,a,s,u){var l=tS();try{to(t)(e,r,n,i,o,a,s,u)}catch(t){if(tO(l),t!==t+0)throw t;tT(1,0)}},A:function(t,e,r,n,i,o,a,s,u,l,c){var p=tS();try{to(t)(e,r,n,i,o,a,s,u,l,c)}catch(t){if(tO(p),t!==t+0)throw t;tT(1,0)}},C:function(t,e,r,n,i,o,a,s,u,l,c,p,f,d,h,g){var b=tS();try{to(t)(e,r,n,i,o,a,s,u,l,c,p,f,d,h,g)}catch(t){if(tO(b),t!==t+0)throw t;tT(1,0)}},aa:function(t,e,r,n,i,o,a,s){var u=tS();try{tk(t,e,r,n,i,o,a,s)}catch(t){if(tO(u),t!==t+0)throw t;tT(1,0)}},_:function(t,e,r,n,i,o,a,s,u,l,c,p){var f=tS();try{tF(t,e,r,n,i,o,a,s,u,l,c,p)}catch(t){if(tO(f),t!==t+0)throw t;tT(1,0)}},$:function(t,e,r,n,i,o){var a=tS();try{tC(t,e,r,n,i,o)}catch(t){if(tO(a),t!==t+0)throw t;tT(1,0)}},n:function(t){return t},F:function(t){tf=t},ha:tb,y:function(t,e,r,n){return tb(t,e,r,n)}};(function(){function t(t){e.asm=t.exports,T=e.asm.Ka,N(),L=e.asm.ib,j.unshift(e.asm.La),G--,e.monitorRunDependencies&&e.monitorRunDependencies(G),0==G&&(null!==H&&(clearInterval(H),H=null),W&&(t=W,W=null,t()))}function r(e){t(e.instance)}function n(t){return(function(){if(!_&&(g||b)){if("function"==typeof fetch&&!z.startsWith("file://"))return fetch(z,{credentials:"same-origin"}).then(function(t){if(!t.ok)throw"failed to load wasm binary file at '"+z+"'";return t.arrayBuffer()}).catch(function(){return K()});if(s)return new Promise(function(t,e){s(z,function(e){t(new Uint8Array(e))},e)})}return Promise.resolve().then(function(){return K()})})().then(function(t){return WebAssembly.instantiate(t,i)}).then(function(t){return t}).then(t,function(t){x("failed to asynchronously prepare wasm: "+t),q(t)})}var i={a:tm};if(G++,e.monitorRunDependencies&&e.monitorRunDependencies(G),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return x("Module.instantiateWasm callback failed with error: "+t),!1}(_||"function"!=typeof WebAssembly.instantiateStreaming||X()||z.startsWith("file://")||m||"function"!=typeof fetch?n(r):fetch(z,{credentials:"same-origin"}).then(function(t){return WebAssembly.instantiateStreaming(t,i).then(r,function(t){return x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation"),n(r)})})).catch(o)})(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.La).apply(null,arguments)},e._OrtInit=function(){return(e._OrtInit=e.asm.Ma).apply(null,arguments)},e._OrtCreateSessionOptions=function(){return(e._OrtCreateSessionOptions=e.asm.Na).apply(null,arguments)},e._OrtAppendExecutionProvider=function(){return(e._OrtAppendExecutionProvider=e.asm.Oa).apply(null,arguments)},e._OrtAddSessionConfigEntry=function(){return(e._OrtAddSessionConfigEntry=e.asm.Pa).apply(null,arguments)},e._OrtReleaseSessionOptions=function(){return(e._OrtReleaseSessionOptions=e.asm.Qa).apply(null,arguments)},e._OrtCreateSession=function(){return(e._OrtCreateSession=e.asm.Ra).apply(null,arguments)},e._OrtReleaseSession=function(){return(e._OrtReleaseSession=e.asm.Sa).apply(null,arguments)},e._OrtGetInputCount=function(){return(e._OrtGetInputCount=e.asm.Ta).apply(null,arguments)},e._OrtGetOutputCount=function(){return(e._OrtGetOutputCount=e.asm.Ua).apply(null,arguments)},e._OrtGetInputName=function(){return(e._OrtGetInputName=e.asm.Va).apply(null,arguments)},e._OrtGetOutputName=function(){return(e._OrtGetOutputName=e.asm.Wa).apply(null,arguments)},e._OrtFree=function(){return(e._OrtFree=e.asm.Xa).apply(null,arguments)},e._OrtCreateTensor=function(){return(e._OrtCreateTensor=e.asm.Ya).apply(null,arguments)},e._OrtGetTensorData=function(){return(e._OrtGetTensorData=e.asm.Za).apply(null,arguments)},e._OrtReleaseTensor=function(){return(e._OrtReleaseTensor=e.asm._a).apply(null,arguments)},e._OrtCreateRunOptions=function(){return(e._OrtCreateRunOptions=e.asm.$a).apply(null,arguments)},e._OrtAddRunConfigEntry=function(){return(e._OrtAddRunConfigEntry=e.asm.ab).apply(null,arguments)},e._OrtReleaseRunOptions=function(){return(e._OrtReleaseRunOptions=e.asm.bb).apply(null,arguments)},e._OrtRun=function(){return(e._OrtRun=e.asm.cb).apply(null,arguments)},e._OrtEndProfiling=function(){return(e._OrtEndProfiling=e.asm.db).apply(null,arguments)};var ty,t_=e._malloc=function(){return(t_=e._malloc=e.asm.eb).apply(null,arguments)},tv=e._free=function(){return(tv=e._free=e.asm.fb).apply(null,arguments)},tx=e._fflush=function(){return(tx=e._fflush=e.asm.gb).apply(null,arguments)},tw=e.___funcs_on_exit=function(){return(tw=e.___funcs_on_exit=e.asm.hb).apply(null,arguments)},tT=e._setThrew=function(){return(tT=e._setThrew=e.asm.jb).apply(null,arguments)},tS=e.stackSave=function(){return(tS=e.stackSave=e.asm.kb).apply(null,arguments)},tO=e.stackRestore=function(){return(tO=e.stackRestore=e.asm.lb).apply(null,arguments)},tA=e.stackAlloc=function(){return(tA=e.stackAlloc=e.asm.mb).apply(null,arguments)},tE=e.___cxa_can_catch=function(){return(tE=e.___cxa_can_catch=e.asm.nb).apply(null,arguments)},tI=e.___cxa_is_pointer_type=function(){return(tI=e.___cxa_is_pointer_type=e.asm.ob).apply(null,arguments)},tP=e.dynCall_j=function(){return(tP=e.dynCall_j=e.asm.pb).apply(null,arguments)},tD=e.dynCall_iiiiij=function(){return(tD=e.dynCall_iiiiij=e.asm.qb).apply(null,arguments)},t$=e.dynCall_jii=function(){return(t$=e.dynCall_jii=e.asm.rb).apply(null,arguments)},tk=e.dynCall_viiiiij=function(){return(tk=e.dynCall_viiiiij=e.asm.sb).apply(null,arguments)},tC=e.dynCall_vjji=function(){return(tC=e.dynCall_vjji=e.asm.tb).apply(null,arguments)},tF=e.dynCall_viiijjjii=function(){return(tF=e.dynCall_viiijjjii=e.asm.ub).apply(null,arguments)},tN=e.dynCall_iij=function(){return(tN=e.dynCall_iij=e.asm.vb).apply(null,arguments)},tL=e.dynCall_ji=function(){return(tL=e.dynCall_ji=e.asm.wb).apply(null,arguments)},tR=e.dynCall_iiiiiij=function(){return(tR=e.dynCall_iiiiiij=e.asm.xb).apply(null,arguments)},tj=e.dynCall_iiij=function(){return(tj=e.dynCall_iiij=e.asm.yb).apply(null,arguments)};function tM(){function t(){if(!ty&&(ty=!0,e.calledRun=!0,!P)){if(J(j),i(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();U.unshift(t)}J(U)}}if(!(0{"use strict";t.exports=function(t,e){for(var r=Array(arguments.length-1),n=0,i=2,o=!0;i{"use strict";var r=e;r.length=function(t){var e=t.length;if(!e)return 0;for(var r=0;--e%4>1&&"="===t.charAt(e);)++r;return Math.ceil(3*t.length)/4-r};for(var n=Array(64),i=Array(123),o=0;o<64;)i[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;r.encode=function(t,e,r){for(var i,o=null,a=[],s=0,u=0;e>2],i=(3&l)<<4,u=1;break;case 1:a[s++]=n[i|l>>4],i=(15&l)<<2,u=2;break;case 2:a[s++]=n[i|l>>6],a[s++]=n[63&l],u=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0)}return u&&(a[s++]=n[i],a[s++]=61,1===u&&(a[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))};var a="invalid encoding";r.decode=function(t,e,r){for(var n,o=r,s=0,u=0;u1)break;if(void 0===(l=i[l]))throw Error(a);switch(s){case 0:n=l,s=1;break;case 1:e[r++]=n<<2|(48&l)>>4,n=l,s=2;break;case 2:e[r++]=(15&n)<<4|(60&l)>>2,n=l,s=3;break;case 3:e[r++]=(3&n)<<6|l,s=0}}if(1===s)throw Error(a);return r-o},r.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}},9211:t=>{"use strict";function e(){this._listeners={}}t.exports=e,e.prototype.on=function(t,e,r){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:r||this}),this},e.prototype.off=function(t,e){if(void 0===t)this._listeners={};else if(void 0===e)this._listeners[t]=[];else for(var r=this._listeners[t],n=0;n{"use strict";function e(t){return"undefined"!=typeof Float32Array?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=128===r[3];function i(t,n,i){e[0]=t,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function o(t,n,i){e[0]=t,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function a(t,n){return r[0]=t[n],r[1]=t[n+1],r[2]=t[n+2],r[3]=t[n+3],e[0]}function s(t,n){return r[3]=t[n],r[2]=t[n+1],r[1]=t[n+2],r[0]=t[n+3],e[0]}t.writeFloatLE=n?i:o,t.writeFloatBE=n?o:i,t.readFloatLE=n?a:s,t.readFloatBE=n?s:a}():function(){function e(t,e,r,n){var i=e<0?1:0;if(i&&(e=-e),0===e)t(1/e>0?0:2147483648,r,n);else if(isNaN(e))t(2143289344,r,n);else if(e>34028234663852886e22)t((i<<31|2139095040)>>>0,r,n);else if(e<11754943508222875e-54)t((i<<31|Math.round(e/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(e)/Math.LN2);t((i<<31|o+127<<23|8388607&Math.round(e*Math.pow(2,-o)*8388608))>>>0,r,n)}}function a(t,e,r){var n=t(e,r),i=2*(n>>31)+1,o=n>>>23&255,a=8388607&n;return 255===o?a?NaN:1/0*i:0===o?1401298464324817e-60*i*a:i*Math.pow(2,o-150)*(a+8388608)}t.writeFloatLE=e.bind(null,r),t.writeFloatBE=e.bind(null,n),t.readFloatLE=a.bind(null,i),t.readFloatBE=a.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=128===r[7];function i(t,n,i){e[0]=t,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(t,n,i){e[0]=t,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function a(t,n){return r[0]=t[n],r[1]=t[n+1],r[2]=t[n+2],r[3]=t[n+3],r[4]=t[n+4],r[5]=t[n+5],r[6]=t[n+6],r[7]=t[n+7],e[0]}function s(t,n){return r[7]=t[n],r[6]=t[n+1],r[5]=t[n+2],r[4]=t[n+3],r[3]=t[n+4],r[2]=t[n+5],r[1]=t[n+6],r[0]=t[n+7],e[0]}t.writeDoubleLE=n?i:o,t.writeDoubleBE=n?o:i,t.readDoubleLE=n?a:s,t.readDoubleBE=n?s:a}():function(){function e(t,e,r,n,i,o){var a,s=n<0?1:0;if(s&&(n=-n),0===n)t(0,i,o+e),t(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))t(0,i,o+e),t(2146959360,i,o+r);else if(n>17976931348623157e292)t(0,i,o+e),t((s<<31|2146435072)>>>0,i,o+r);else if(n<22250738585072014e-324)t((a=n/5e-324)>>>0,i,o+e),t((s<<31|a/4294967296)>>>0,i,o+r);else{var u=Math.floor(Math.log(n)/Math.LN2);1024===u&&(u=1023),t(4503599627370496*(a=n*Math.pow(2,-u))>>>0,i,o+e),t((s<<31|u+1023<<20|1048576*a&1048575)>>>0,i,o+r)}}function a(t,e,r,n,i){var o=t(n,i+e),a=t(n,i+r),s=2*(a>>31)+1,u=a>>>20&2047,l=4294967296*(1048575&a)+o;return 2047===u?l?NaN:1/0*s:0===u?5e-324*s*l:s*Math.pow(2,u-1075)*(l+4503599627370496)}t.writeDoubleLE=e.bind(null,r,0,4),t.writeDoubleBE=e.bind(null,n,4,0),t.readDoubleLE=a.bind(null,i,0,4),t.readDoubleBE=a.bind(null,o,4,0)}(),t}function r(t,e,r){e[r]=255&t,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function n(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=255&t}function i(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function o(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}t.exports=e(e)},7199:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}module.exports=inquire},6662:t=>{"use strict";t.exports=function(t,e,r){var n=r||8192,i=n>>>1,o=null,a=n;return function(r){if(r<1||r>i)return t(r);a+r>n&&(o=t(n),a=0);var s=e.call(o,a,a+=r);return 7&a&&(a=1+(7|a)),s}}},4997:(t,e)=>{"use strict";var r=e;r.length=function(t){for(var e=0,r=0,n=0;n191&&n<224?o[a++]=(31&n)<<6|63&t[e++]:n>239&&n<365?(n=((7&n)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,o[a++]=55296+(n>>10),o[a++]=56320+(1023&n)):o[a++]=(15&n)<<12|(63&t[e++])<<6|63&t[e++],a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),a=0);return i?(a&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))},r.write=function(t,e,r){for(var n,i,o=r,a=0;a>6|192:(55296==(64512&n)&&56320==(64512&(i=t.charCodeAt(a+1)))?(n=65536+((1023&n)<<10)+(1023&i),++a,e[r++]=n>>18|240,e[r++]=n>>12&63|128):e[r++]=n>>12|224,e[r++]=n>>6&63|128),e[r++]=63&n|128);return r-o}},3442:(t,e)=>{"use strict";e.__esModule=!0;var r=function(){function t(e){if(!e)throw TypeError("Invalid argument; `value` has no value.");this.value=t.EMPTY,e&&t.isGuid(e)&&(this.value=e)}return t.isGuid=function(e){var r=e.toString();return e&&(e instanceof t||t.validator.test(r))},t.create=function(){return new t([t.gen(2),t.gen(1),t.gen(1),t.gen(1),t.gen(3)].join("-"))},t.createEmpty=function(){return new t("emptyguid")},t.parse=function(e){return new t(e)},t.raw=function(){return[t.gen(2),t.gen(1),t.gen(1),t.gen(1),t.gen(3)].join("-")},t.gen=function(t){for(var e="",r=0;r{t.exports=r;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}function r(t,e,r){this.low=0|t,this.high=0|e,this.unsigned=!!r}function n(t){return!0===(t&&t.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=n;var i={},o={};function a(t,e){var r,n,a;return e?(a=0<=(t>>>=0)&&t<256)&&(n=o[t])?n:(r=u(t,(0|t)<0?-1:0,!0),a&&(o[t]=r),r):(a=-128<=(t|=0)&&t<128)&&(n=i[t])?n:(r=u(t,t<0?-1:0,!1),a&&(i[t]=r),r)}function s(t,e){if(isNaN(t))return e?m:b;if(e){if(t<0)return m;if(t>=d)return w}else{if(t<=-h)return T;if(t+1>=h)return x}return t<0?s(-t,e).neg():u(t%f|0,t/f|0,e)}function u(t,e,n){return new r(t,e,n)}r.fromInt=a,r.fromNumber=s,r.fromBits=u;var l=Math.pow;function c(t,e,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return b;if("number"==typeof e?(r=e,e=!1):e=!!e,(r=r||10)<2||360)throw Error("interior hyphen");if(0===n)return c(t.substring(1),e,r).neg();for(var n,i=s(l(r,8)),o=b,a=0;a>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},S.toString=function(t){if((t=t||10)<2||36>>0).toString(t);if((o=u).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},S.isOdd=function(){return 1==(1&this.low)},S.isEven=function(){return 0==(1&this.low)},S.equals=function(t){return n(t)||(t=p(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&this.high===t.high&&this.low===t.low},S.eq=S.equals,S.notEquals=function(t){return!this.eq(t)},S.neq=S.notEquals,S.ne=S.notEquals,S.lessThan=function(t){return 0>this.comp(t)},S.lt=S.lessThan,S.lessThanOrEqual=function(t){return 0>=this.comp(t)},S.lte=S.lessThanOrEqual,S.le=S.lessThanOrEqual,S.greaterThan=function(t){return this.comp(t)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(t){return this.comp(t)>=0},S.gte=S.greaterThanOrEqual,S.ge=S.greaterThanOrEqual,S.compare=function(t){if(n(t)||(t=p(t)),this.eq(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(y)},S.neg=S.negate,S.add=function(t){n(t)||(t=p(t));var e,r,i,o,a=this.high>>>16,s=65535&this.high,l=this.low>>>16,c=65535&this.low,f=t.high>>>16,d=65535&t.high,h=t.low>>>16;return o=0+(((i=0+((e=0+((r=0+(c+(65535&t.low)))>>>16)+(l+h))>>>16)+(s+d))>>>16)+(a+f)),u((e&=65535)<<16|(r&=65535),(o&=65535)<<16|(i&=65535),this.unsigned)},S.subtract=function(t){return n(t)||(t=p(t)),this.add(t.neg())},S.sub=S.subtract,S.multiply=function(t){if(this.isZero())return b;if(n(t)||(t=p(t)),e)return u(e.mul(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned);if(t.isZero())return b;if(this.eq(T))return t.isOdd()?T:b;if(t.eq(T))return this.isOdd()?T:b;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(g)&&t.lt(g))return s(this.toNumber()*t.toNumber(),this.unsigned);var r,i,o,a=this.high>>>16,l=65535&this.high,c=this.low>>>16,f=65535&this.low,d=t.high>>>16,h=65535&t.high,m=t.low>>>16,y=65535&t.low,_=0;return o=0+((r=0+((i=0+f*y)>>>16)+c*y)>>>16),r&=65535,o+=(r+=f*m)>>>16,_+=(o+=l*y)>>>16,o&=65535,_+=(o+=c*m)>>>16,o&=65535,_+=((o+=f*h)>>>16)+(a*y+l*m+c*h+f*d),u((r&=65535)<<16|(i&=65535),(_&=65535)<<16|(o&=65535),this.unsigned)},S.mul=S.multiply,S.divide=function(t){if(n(t)||(t=p(t)),t.isZero())throw Error("division by zero");if(e)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?u((this.unsigned?e.div_u:e.div_s)(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:b;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return m;if(t.gt(this.shru(1)))return _;o=m}else{if(this.eq(T))return t.eq(y)||t.eq(v)?T:t.eq(T)?y:(r=this.shr(1).div(t).shl(1)).eq(b)?t.isNegative()?y:v:(i=this.sub(t.mul(r)),o=r.add(i.div(t)));if(t.eq(T))return this.unsigned?m:b;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=b}for(i=this;i.gte(t);){r=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var r,i,o,a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:l(2,a-48),f=s(r),d=f.mul(t);d.isNegative()||d.gt(i);)d=(f=s(r-=c,this.unsigned)).mul(t);f.isZero()&&(f=y),o=o.add(f),i=i.sub(d)}return o},S.div=S.divide,S.modulo=function(t){return n(t)||(t=p(t)),e?u((this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},S.mod=S.modulo,S.rem=S.modulo,S.not=function(){return u(~this.low,~this.high,this.unsigned)},S.and=function(t){return n(t)||(t=p(t)),u(this.low&t.low,this.high&t.high,this.unsigned)},S.or=function(t){return n(t)||(t=p(t)),u(this.low|t.low,this.high|t.high,this.unsigned)},S.xor=function(t){return n(t)||(t=p(t)),u(this.low^t.low,this.high^t.high,this.unsigned)},S.shiftLeft=function(t){return n(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?u(this.low<>>32-t,this.unsigned):u(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):u(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},S.shr=S.shiftRight,S.shiftRightUnsigned=function(t){if(n(t)&&(t=t.toInt()),0==(t&=63))return this;var e=this.high;return t<32?u(this.low>>>t|e<<32-t,e>>>t,this.unsigned):u(32===t?e:e>>>t-32,0,this.unsigned)},S.shru=S.shiftRightUnsigned,S.shr_u=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},S.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},S.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},S.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},r.fromBytes=function(t,e,n){return n?r.fromBytesLE(t,e):r.fromBytesBE(t,e)},r.fromBytesLE=function(t,e){return new r(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},r.fromBytesBE=function(t,e){return new r(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)}},1446:(t,e,r)=>{"use strict";var n,i,o,a=r(2100),s=a.Reader,u=a.Writer,l=a.util,c=a.roots.default||(a.roots.default={});c.onnx=((o={}).Version=((i=Object.create(n={}))[n[0]="_START_VERSION"]=0,i[n[1]="IR_VERSION_2017_10_10"]=1,i[n[2]="IR_VERSION_2017_10_30"]=2,i[n[3]="IR_VERSION_2017_11_3"]=3,i[n[4]="IR_VERSION_2019_1_22"]=4,i[n[5]="IR_VERSION"]=5,i),o.AttributeProto=function(){function t(t){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],t)for(var e=Object.keys(t),r=0;r>>3){case 1:n.name=t.string();break;case 21:n.refAttrName=t.string();break;case 13:n.docString=t.string();break;case 20:n.type=t.int32();break;case 2:n.f=t.float();break;case 3:n.i=t.int64();break;case 4:n.s=t.bytes();break;case 5:n.t=c.onnx.TensorProto.decode(t,t.uint32());break;case 6:n.g=c.onnx.GraphProto.decode(t,t.uint32());break;case 7:if(n.floats&&n.floats.length||(n.floats=[]),2==(7&i))for(var o=t.uint32()+t.pos;t.pos>>0,t.i.high>>>0).toNumber())),null!=t.s&&("string"==typeof t.s?l.base64.decode(t.s,e.s=l.newBuffer(l.base64.length(t.s)),0):t.s.length&&(e.s=t.s)),null!=t.t){if("object"!=typeof t.t)throw TypeError(".onnx.AttributeProto.t: object expected");e.t=c.onnx.TensorProto.fromObject(t.t)}if(null!=t.g){if("object"!=typeof t.g)throw TypeError(".onnx.AttributeProto.g: object expected");e.g=c.onnx.GraphProto.fromObject(t.g)}if(t.floats){if(!Array.isArray(t.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");e.floats=[];for(var r=0;r>>0,t.ints[r].high>>>0).toNumber())}if(t.strings){if(!Array.isArray(t.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(e.strings=[],r=0;r>>0,t.i.high>>>0).toNumber():t.i),null!=t.s&&t.hasOwnProperty("s")&&(r.s=e.bytes===String?l.base64.encode(t.s,0,t.s.length):e.bytes===Array?Array.prototype.slice.call(t.s):t.s),null!=t.t&&t.hasOwnProperty("t")&&(r.t=c.onnx.TensorProto.toObject(t.t,e)),null!=t.g&&t.hasOwnProperty("g")&&(r.g=c.onnx.GraphProto.toObject(t.g,e)),t.floats&&t.floats.length){r.floats=[];for(var i=0;i>>0,t.ints[i].high>>>0).toNumber():t.ints[i];if(t.strings&&t.strings.length)for(r.strings=[],i=0;i>>3){case 1:n.name=t.string();break;case 2:n.type=c.onnx.TypeProto.decode(t,t.uint32());break;case 3:n.docString=t.string();break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.name&&t.hasOwnProperty("name")&&!l.isString(t.name))return"name: string expected";if(null!=t.type&&t.hasOwnProperty("type")){var e=c.onnx.TypeProto.verify(t.type);if(e)return"type."+e}return null!=t.docString&&t.hasOwnProperty("docString")&&!l.isString(t.docString)?"docString: string expected":null},t.fromObject=function(t){if(t instanceof c.onnx.ValueInfoProto)return t;var e=new c.onnx.ValueInfoProto;if(null!=t.name&&(e.name=String(t.name)),null!=t.type){if("object"!=typeof t.type)throw TypeError(".onnx.ValueInfoProto.type: object expected");e.type=c.onnx.TypeProto.fromObject(t.type)}return null!=t.docString&&(e.docString=String(t.docString)),e},t.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.name="",r.type=null,r.docString=""),null!=t.name&&t.hasOwnProperty("name")&&(r.name=t.name),null!=t.type&&t.hasOwnProperty("type")&&(r.type=c.onnx.TypeProto.toObject(t.type,e)),null!=t.docString&&t.hasOwnProperty("docString")&&(r.docString=t.docString),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o.NodeProto=function(){function t(t){if(this.input=[],this.output=[],this.attribute=[],t)for(var e=Object.keys(t),r=0;r>>3){case 1:n.input&&n.input.length||(n.input=[]),n.input.push(t.string());break;case 2:n.output&&n.output.length||(n.output=[]),n.output.push(t.string());break;case 3:n.name=t.string();break;case 4:n.opType=t.string();break;case 7:n.domain=t.string();break;case 5:n.attribute&&n.attribute.length||(n.attribute=[]),n.attribute.push(c.onnx.AttributeProto.decode(t,t.uint32()));break;case 6:n.docString=t.string();break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.input&&t.hasOwnProperty("input")){if(!Array.isArray(t.input))return"input: array expected";for(var e=0;e>>3){case 1:n.irVersion=t.int64();break;case 8:n.opsetImport&&n.opsetImport.length||(n.opsetImport=[]),n.opsetImport.push(c.onnx.OperatorSetIdProto.decode(t,t.uint32()));break;case 2:n.producerName=t.string();break;case 3:n.producerVersion=t.string();break;case 4:n.domain=t.string();break;case 5:n.modelVersion=t.int64();break;case 6:n.docString=t.string();break;case 7:n.graph=c.onnx.GraphProto.decode(t,t.uint32());break;case 14:n.metadataProps&&n.metadataProps.length||(n.metadataProps=[]),n.metadataProps.push(c.onnx.StringStringEntryProto.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.irVersion&&t.hasOwnProperty("irVersion")&&!(l.isInteger(t.irVersion)||t.irVersion&&l.isInteger(t.irVersion.low)&&l.isInteger(t.irVersion.high)))return"irVersion: integer|Long expected";if(null!=t.opsetImport&&t.hasOwnProperty("opsetImport")){if(!Array.isArray(t.opsetImport))return"opsetImport: array expected";for(var e,r=0;r>>0,t.irVersion.high>>>0).toNumber())),t.opsetImport){if(!Array.isArray(t.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");e.opsetImport=[];for(var r=0;r>>0,t.modelVersion.high>>>0).toNumber())),null!=t.docString&&(e.docString=String(t.docString)),null!=t.graph){if("object"!=typeof t.graph)throw TypeError(".onnx.ModelProto.graph: object expected");e.graph=c.onnx.GraphProto.fromObject(t.graph)}if(t.metadataProps){if(!Array.isArray(t.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(e.metadataProps=[],r=0;r>>0,t.irVersion.high>>>0).toNumber():t.irVersion),null!=t.producerName&&t.hasOwnProperty("producerName")&&(r.producerName=t.producerName),null!=t.producerVersion&&t.hasOwnProperty("producerVersion")&&(r.producerVersion=t.producerVersion),null!=t.domain&&t.hasOwnProperty("domain")&&(r.domain=t.domain),null!=t.modelVersion&&t.hasOwnProperty("modelVersion")&&("number"==typeof t.modelVersion?r.modelVersion=e.longs===String?String(t.modelVersion):t.modelVersion:r.modelVersion=e.longs===String?l.Long.prototype.toString.call(t.modelVersion):e.longs===Number?new l.LongBits(t.modelVersion.low>>>0,t.modelVersion.high>>>0).toNumber():t.modelVersion),null!=t.docString&&t.hasOwnProperty("docString")&&(r.docString=t.docString),null!=t.graph&&t.hasOwnProperty("graph")&&(r.graph=c.onnx.GraphProto.toObject(t.graph,e)),t.opsetImport&&t.opsetImport.length){r.opsetImport=[];for(var i=0;i>>3){case 1:n.key=t.string();break;case 2:n.value=t.string();break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null!=t.key&&t.hasOwnProperty("key")&&!l.isString(t.key)?"key: string expected":null!=t.value&&t.hasOwnProperty("value")&&!l.isString(t.value)?"value: string expected":null},t.fromObject=function(t){if(t instanceof c.onnx.StringStringEntryProto)return t;var e=new c.onnx.StringStringEntryProto;return null!=t.key&&(e.key=String(t.key)),null!=t.value&&(e.value=String(t.value)),e},t.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.key="",r.value=""),null!=t.key&&t.hasOwnProperty("key")&&(r.key=t.key),null!=t.value&&t.hasOwnProperty("value")&&(r.value=t.value),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o.TensorAnnotation=function(){function t(t){if(this.quantParameterTensorNames=[],t)for(var e=Object.keys(t),r=0;r>>3){case 1:n.tensorName=t.string();break;case 2:n.quantParameterTensorNames&&n.quantParameterTensorNames.length||(n.quantParameterTensorNames=[]),n.quantParameterTensorNames.push(c.onnx.StringStringEntryProto.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.tensorName&&t.hasOwnProperty("tensorName")&&!l.isString(t.tensorName))return"tensorName: string expected";if(null!=t.quantParameterTensorNames&&t.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(t.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var e=0;e>>3){case 1:n.node&&n.node.length||(n.node=[]),n.node.push(c.onnx.NodeProto.decode(t,t.uint32()));break;case 2:n.name=t.string();break;case 5:n.initializer&&n.initializer.length||(n.initializer=[]),n.initializer.push(c.onnx.TensorProto.decode(t,t.uint32()));break;case 10:n.docString=t.string();break;case 11:n.input&&n.input.length||(n.input=[]),n.input.push(c.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 12:n.output&&n.output.length||(n.output=[]),n.output.push(c.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 13:n.valueInfo&&n.valueInfo.length||(n.valueInfo=[]),n.valueInfo.push(c.onnx.ValueInfoProto.decode(t,t.uint32()));break;case 14:n.quantizationAnnotation&&n.quantizationAnnotation.length||(n.quantizationAnnotation=[]),n.quantizationAnnotation.push(c.onnx.TensorAnnotation.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.node&&t.hasOwnProperty("node")){if(!Array.isArray(t.node))return"node: array expected";for(var e,r=0;r>>3){case 1:if(n.dims&&n.dims.length||(n.dims=[]),2==(7&i))for(var o=t.uint32()+t.pos;t.pos>>0,t.dims[r].high>>>0).toNumber())}if(null!=t.dataType&&(e.dataType=0|t.dataType),null!=t.segment){if("object"!=typeof t.segment)throw TypeError(".onnx.TensorProto.segment: object expected");e.segment=c.onnx.TensorProto.Segment.fromObject(t.segment)}if(t.floatData){if(!Array.isArray(t.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(e.floatData=[],r=0;r>>0,t.int64Data[r].high>>>0).toNumber())}if(null!=t.name&&(e.name=String(t.name)),null!=t.docString&&(e.docString=String(t.docString)),null!=t.rawData&&("string"==typeof t.rawData?l.base64.decode(t.rawData,e.rawData=l.newBuffer(l.base64.length(t.rawData)),0):t.rawData.length&&(e.rawData=t.rawData)),t.externalData){if(!Array.isArray(t.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(e.externalData=[],r=0;r>>0,t.uint64Data[r].high>>>0).toNumber(!0))}return e},t.toObject=function(t,e){e||(e={});var r={};if((e.arrays||e.defaults)&&(r.dims=[],r.floatData=[],r.int32Data=[],r.stringData=[],r.int64Data=[],r.doubleData=[],r.uint64Data=[],r.externalData=[]),e.defaults&&(r.dataType=0,r.segment=null,r.name="",e.bytes===String?r.rawData="":(r.rawData=[],e.bytes!==Array&&(r.rawData=l.newBuffer(r.rawData))),r.docString="",r.dataLocation=e.enums===String?"DEFAULT":0),t.dims&&t.dims.length){r.dims=[];for(var n=0;n>>0,t.dims[n].high>>>0).toNumber():t.dims[n]}if(null!=t.dataType&&t.hasOwnProperty("dataType")&&(r.dataType=t.dataType),null!=t.segment&&t.hasOwnProperty("segment")&&(r.segment=c.onnx.TensorProto.Segment.toObject(t.segment,e)),t.floatData&&t.floatData.length)for(r.floatData=[],n=0;n>>0,t.int64Data[n].high>>>0).toNumber():t.int64Data[n];if(null!=t.name&&t.hasOwnProperty("name")&&(r.name=t.name),null!=t.rawData&&t.hasOwnProperty("rawData")&&(r.rawData=e.bytes===String?l.base64.encode(t.rawData,0,t.rawData.length):e.bytes===Array?Array.prototype.slice.call(t.rawData):t.rawData),t.doubleData&&t.doubleData.length)for(r.doubleData=[],n=0;n>>0,t.uint64Data[n].high>>>0).toNumber(!0):t.uint64Data[n];if(null!=t.docString&&t.hasOwnProperty("docString")&&(r.docString=t.docString),t.externalData&&t.externalData.length)for(r.externalData=[],n=0;n>>3){case 1:n.begin=t.int64();break;case 2:n.end=t.int64();break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null!=t.begin&&t.hasOwnProperty("begin")&&!(l.isInteger(t.begin)||t.begin&&l.isInteger(t.begin.low)&&l.isInteger(t.begin.high))?"begin: integer|Long expected":null!=t.end&&t.hasOwnProperty("end")&&!(l.isInteger(t.end)||t.end&&l.isInteger(t.end.low)&&l.isInteger(t.end.high))?"end: integer|Long expected":null},t.fromObject=function(t){if(t instanceof c.onnx.TensorProto.Segment)return t;var e=new c.onnx.TensorProto.Segment;return null!=t.begin&&(l.Long?(e.begin=l.Long.fromValue(t.begin)).unsigned=!1:"string"==typeof t.begin?e.begin=parseInt(t.begin,10):"number"==typeof t.begin?e.begin=t.begin:"object"==typeof t.begin&&(e.begin=new l.LongBits(t.begin.low>>>0,t.begin.high>>>0).toNumber())),null!=t.end&&(l.Long?(e.end=l.Long.fromValue(t.end)).unsigned=!1:"string"==typeof t.end?e.end=parseInt(t.end,10):"number"==typeof t.end?e.end=t.end:"object"==typeof t.end&&(e.end=new l.LongBits(t.end.low>>>0,t.end.high>>>0).toNumber())),e},t.toObject=function(t,e){e||(e={});var r={};if(e.defaults){if(l.Long){var n=new l.Long(0,0,!1);r.begin=e.longs===String?n.toString():e.longs===Number?n.toNumber():n}else r.begin=e.longs===String?"0":0;l.Long?(n=new l.Long(0,0,!1),r.end=e.longs===String?n.toString():e.longs===Number?n.toNumber():n):r.end=e.longs===String?"0":0}return null!=t.begin&&t.hasOwnProperty("begin")&&("number"==typeof t.begin?r.begin=e.longs===String?String(t.begin):t.begin:r.begin=e.longs===String?l.Long.prototype.toString.call(t.begin):e.longs===Number?new l.LongBits(t.begin.low>>>0,t.begin.high>>>0).toNumber():t.begin),null!=t.end&&t.hasOwnProperty("end")&&("number"==typeof t.end?r.end=e.longs===String?String(t.end):t.end:r.end=e.longs===String?l.Long.prototype.toString.call(t.end):e.longs===Number?new l.LongBits(t.end.low>>>0,t.end.high>>>0).toNumber():t.end),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),t.DataLocation=function(){var t={},e=Object.create(t);return e[t[0]="DEFAULT"]=0,e[t[1]="EXTERNAL"]=1,e}(),t}(),o.TensorShapeProto=function(){function t(t){if(this.dim=[],t)for(var e=Object.keys(t),r=0;r>>3==1?(n.dim&&n.dim.length||(n.dim=[]),n.dim.push(c.onnx.TensorShapeProto.Dimension.decode(t,t.uint32()))):t.skipType(7&i)}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.dim&&t.hasOwnProperty("dim")){if(!Array.isArray(t.dim))return"dim: array expected";for(var e=0;e>>3){case 1:n.dimValue=t.int64();break;case 2:n.dimParam=t.string();break;case 3:n.denotation=t.string();break;default:t.skipType(7&i)}}return n},e.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},e.verify=function(t){if("object"!=typeof t||null===t)return"object expected";var e={};if(null!=t.dimValue&&t.hasOwnProperty("dimValue")&&(e.value=1,!(l.isInteger(t.dimValue)||t.dimValue&&l.isInteger(t.dimValue.low)&&l.isInteger(t.dimValue.high))))return"dimValue: integer|Long expected";if(null!=t.dimParam&&t.hasOwnProperty("dimParam")){if(1===e.value)return"value: multiple values";if(e.value=1,!l.isString(t.dimParam))return"dimParam: string expected"}return null!=t.denotation&&t.hasOwnProperty("denotation")&&!l.isString(t.denotation)?"denotation: string expected":null},e.fromObject=function(t){if(t instanceof c.onnx.TensorShapeProto.Dimension)return t;var e=new c.onnx.TensorShapeProto.Dimension;return null!=t.dimValue&&(l.Long?(e.dimValue=l.Long.fromValue(t.dimValue)).unsigned=!1:"string"==typeof t.dimValue?e.dimValue=parseInt(t.dimValue,10):"number"==typeof t.dimValue?e.dimValue=t.dimValue:"object"==typeof t.dimValue&&(e.dimValue=new l.LongBits(t.dimValue.low>>>0,t.dimValue.high>>>0).toNumber())),null!=t.dimParam&&(e.dimParam=String(t.dimParam)),null!=t.denotation&&(e.denotation=String(t.denotation)),e},e.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.denotation=""),null!=t.dimValue&&t.hasOwnProperty("dimValue")&&("number"==typeof t.dimValue?r.dimValue=e.longs===String?String(t.dimValue):t.dimValue:r.dimValue=e.longs===String?l.Long.prototype.toString.call(t.dimValue):e.longs===Number?new l.LongBits(t.dimValue.low>>>0,t.dimValue.high>>>0).toNumber():t.dimValue,e.oneofs&&(r.value="dimValue")),null!=t.dimParam&&t.hasOwnProperty("dimParam")&&(r.dimParam=t.dimParam,e.oneofs&&(r.value="dimParam")),null!=t.denotation&&t.hasOwnProperty("denotation")&&(r.denotation=t.denotation),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),t}(),o.TypeProto=function(){var t;function e(t){if(t)for(var e=Object.keys(t),r=0;r>>3){case 1:n.tensorType=c.onnx.TypeProto.Tensor.decode(t,t.uint32());break;case 6:n.denotation=t.string();break;default:t.skipType(7&i)}}return n},e.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},e.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.tensorType&&t.hasOwnProperty("tensorType")){var e=c.onnx.TypeProto.Tensor.verify(t.tensorType);if(e)return"tensorType."+e}return null!=t.denotation&&t.hasOwnProperty("denotation")&&!l.isString(t.denotation)?"denotation: string expected":null},e.fromObject=function(t){if(t instanceof c.onnx.TypeProto)return t;var e=new c.onnx.TypeProto;if(null!=t.tensorType){if("object"!=typeof t.tensorType)throw TypeError(".onnx.TypeProto.tensorType: object expected");e.tensorType=c.onnx.TypeProto.Tensor.fromObject(t.tensorType)}return null!=t.denotation&&(e.denotation=String(t.denotation)),e},e.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.denotation=""),null!=t.tensorType&&t.hasOwnProperty("tensorType")&&(r.tensorType=c.onnx.TypeProto.Tensor.toObject(t.tensorType,e),e.oneofs&&(r.value="tensorType")),null!=t.denotation&&t.hasOwnProperty("denotation")&&(r.denotation=t.denotation),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e.Tensor=function(){function t(t){if(t)for(var e=Object.keys(t),r=0;r>>3){case 1:n.elemType=t.int32();break;case 2:n.shape=c.onnx.TensorShapeProto.decode(t,t.uint32());break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(null!=t.elemType&&t.hasOwnProperty("elemType")&&!l.isInteger(t.elemType))return"elemType: integer expected";if(null!=t.shape&&t.hasOwnProperty("shape")){var e=c.onnx.TensorShapeProto.verify(t.shape);if(e)return"shape."+e}return null},t.fromObject=function(t){if(t instanceof c.onnx.TypeProto.Tensor)return t;var e=new c.onnx.TypeProto.Tensor;if(null!=t.elemType&&(e.elemType=0|t.elemType),null!=t.shape){if("object"!=typeof t.shape)throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");e.shape=c.onnx.TensorShapeProto.fromObject(t.shape)}return e},t.toObject=function(t,e){e||(e={});var r={};return e.defaults&&(r.elemType=0,r.shape=null),null!=t.elemType&&t.hasOwnProperty("elemType")&&(r.elemType=t.elemType),null!=t.shape&&t.hasOwnProperty("shape")&&(r.shape=c.onnx.TensorShapeProto.toObject(t.shape,e)),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),e}(),o.OperatorSetIdProto=function(){function t(t){if(t)for(var e=Object.keys(t),r=0;r>>3){case 1:n.domain=t.string();break;case 2:n.version=t.int64();break;default:t.skipType(7&i)}}return n},t.decodeDelimited=function(t){return t instanceof s||(t=new s(t)),this.decode(t,t.uint32())},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null!=t.domain&&t.hasOwnProperty("domain")&&!l.isString(t.domain)?"domain: string expected":null!=t.version&&t.hasOwnProperty("version")&&!(l.isInteger(t.version)||t.version&&l.isInteger(t.version.low)&&l.isInteger(t.version.high))?"version: integer|Long expected":null},t.fromObject=function(t){if(t instanceof c.onnx.OperatorSetIdProto)return t;var e=new c.onnx.OperatorSetIdProto;return null!=t.domain&&(e.domain=String(t.domain)),null!=t.version&&(l.Long?(e.version=l.Long.fromValue(t.version)).unsigned=!1:"string"==typeof t.version?e.version=parseInt(t.version,10):"number"==typeof t.version?e.version=t.version:"object"==typeof t.version&&(e.version=new l.LongBits(t.version.low>>>0,t.version.high>>>0).toNumber())),e},t.toObject=function(t,e){e||(e={});var r={};if(e.defaults){if(r.domain="",l.Long){var n=new l.Long(0,0,!1);r.version=e.longs===String?n.toString():e.longs===Number?n.toNumber():n}else r.version=e.longs===String?"0":0}return null!=t.domain&&t.hasOwnProperty("domain")&&(r.domain=t.domain),null!=t.version&&t.hasOwnProperty("version")&&("number"==typeof t.version?r.version=e.longs===String?String(t.version):t.version:r.version=e.longs===String?l.Long.prototype.toString.call(t.version):e.longs===Number?new l.LongBits(t.version.low>>>0,t.version.high>>>0).toNumber():t.version),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},t}(),o),t.exports=c},2100:(t,e,r)=>{"use strict";t.exports=r(9482)},9482:(t,e,r)=>{"use strict";var n=e;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(1173),n.BufferWriter=r(3155),n.Reader=r(1408),n.BufferReader=r(593),n.util=r(9693),n.rpc=r(5994),n.roots=r(5054),n.configure=i,i()},1408:(t,e,r)=>{"use strict";t.exports=u;var n,i=r(9693),o=i.LongBits,a=i.utf8;function s(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function u(t){this.buf=t,this.pos=0,this.len=t.length}var l,c="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new u(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new u(t);throw Error("illegal buffer")},p=function(){return i.Buffer?function(t){return(u.create=function(t){return i.Buffer.isBuffer(t)?new n(t):c(t)})(t)}:c};function f(){var t=new o(0,0),e=0;if(!(this.len-this.pos>4)){for(;e<3;++e){if(this.pos>=this.len)throw s(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*e)>>>0,t}for(;e<4;++e)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(e=0,this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw s(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function d(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw s(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}u.create=p(),u.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,u.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return l;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return l}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return d(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|d(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var t=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},u.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var t=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},u.prototype.bytes=function(){var t=this.uint32(),e=this.pos,r=this.pos+t;if(r>this.len)throw s(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,r):e===r?new this.buf.constructor(0):this._slice.call(this.buf,e,r)},u.prototype.string=function(){var t=this.bytes();return a.read(t,0,t.length)},u.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw s(this,t);this.pos+=t}else do if(this.pos>=this.len)throw s(this);while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},u._configure=function(t){n=t,u.create=p(),n._configure();var e=i.Long?"toLong":"toNumber";i.merge(u.prototype,{int64:function(){return f.call(this)[e](!1)},uint64:function(){return f.call(this)[e](!0)},sint64:function(){return f.call(this).zzDecode()[e](!1)},fixed64:function(){return h.call(this)[e](!0)},sfixed64:function(){return h.call(this)[e](!1)}})}},593:(t,e,r)=>{"use strict";t.exports=o;var n=r(1408);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(9693);function o(t){n.call(this,t)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},o._configure()},5054:t=>{"use strict";t.exports={}},5994:(t,e,r)=>{"use strict";e.Service=r(7948)},7948:(t,e,r)=>{"use strict";t.exports=i;var n=r(9693);function i(t,e,r){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function t(e,r,i,o,a){if(!o)throw TypeError("request must be specified");var s=this;if(!a)return n.asPromise(t,s,e,r,i,o);if(s.rpcImpl)try{return s.rpcImpl(e,r[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(t,r){if(t)return s.emit("error",t,e),a(t);if(null!==r){if(!(r instanceof i))try{r=i[s.responseDelimited?"decodeDelimited":"decode"](r)}catch(t){return s.emit("error",t,e),a(t)}return s.emit("data",r,e),a(null,r)}s.end(!0)})}catch(t){return s.emit("error",t,e),void setTimeout(function(){a(t)},0)}else setTimeout(function(){a(Error("already ended"))},0)},i.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(t,e,r)=>{"use strict";t.exports=i;var n=r(9693);function i(t,e){this.lo=t>>>0,this.hi=e>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var a=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(t){if(0===t)return o;var e=t<0;e&&(t=-t);var r=t>>>0,n=(t-r)/4294967296>>>0;return e&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(t){if("number"==typeof t)return i.fromNumber(t);if(n.isString(t)){if(!n.Long)return i.fromNumber(parseInt(t,10));t=n.Long.fromString(t)}return t.low||t.high?new i(t.low>>>0,t.high>>>0):o},i.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=1+~this.lo>>>0,r=~this.hi>>>0;return e||(r=r+1>>>0),-(e+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(t){return n.Long?new n.Long(0|this.lo,0|this.hi,!!t):{low:0|this.lo,high:0|this.hi,unsigned:!!t}};var s=String.prototype.charCodeAt;i.fromHash=function(t){return t===a?o:new i((s.call(t,0)|s.call(t,1)<<8|s.call(t,2)<<16|s.call(t,3)<<24)>>>0,(s.call(t,4)|s.call(t,5)<<8|s.call(t,6)<<16|s.call(t,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},i.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},i.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===e?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:r<128?9:10}},9693:function(t,e,r){"use strict";var n=e;function i(t,e,r){for(var n=Object.keys(e),i=0;i0)},n.Buffer=function(){try{var t=n.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(t){return"number"==typeof t?n.Buffer?n._Buffer_allocUnsafe(t):new n.Array(t):n.Buffer?n._Buffer_from(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(t){return t?n.LongBits.from(t).toHash():n.LongBits.zeroHash},n.longFromHash=function(t,e){var r=n.LongBits.fromHash(t);return n.Long?n.Long.fromBits(r.lo,r.hi,e):r.toNumber(!!e)},n.merge=i,n.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(t){for(var e={},r=0;r-1;--r)if(1===e[t[r]]&&void 0!==this[t[r]]&&null!==this[t[r]])return t[r]}},n.oneOfSetter=function(t){return function(e){for(var r=0;r{"use strict";t.exports=p;var n,i=r(9693),o=i.LongBits,a=i.base64,s=i.utf8;function u(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function l(){}function c(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function p(){this.len=0,this.head=new u(l,0,0),this.tail=this.head,this.states=null}var f=function(){return i.Buffer?function(){return(p.create=function(){return new n})()}:function(){return new p}};function d(t,e,r){e[r]=255&t}function h(t,e){this.len=t,this.next=void 0,this.val=e}function g(t,e,r){for(;t.hi;)e[r++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=127&t.lo|128,t.lo=t.lo>>>7;e[r++]=t.lo}function b(t,e,r){e[r]=255&t,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}p.create=f(),p.alloc=function(t){return new i.Array(t)},i.Array!==Array&&(p.alloc=i.pool(p.alloc,i.Array.prototype.subarray)),p.prototype._push=function(t,e,r){return this.tail=this.tail.next=new u(t,e,r),this.len+=e,this},h.prototype=Object.create(u.prototype),h.prototype.fn=function(t,e,r){for(;t>127;)e[r++]=127&t|128,t>>>=7;e[r]=t},p.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new h((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},p.prototype.int32=function(t){return t<0?this._push(g,10,o.fromNumber(t)):this.uint32(t)},p.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},p.prototype.uint64=function(t){var e=o.from(t);return this._push(g,e.length(),e)},p.prototype.int64=p.prototype.uint64,p.prototype.sint64=function(t){var e=o.from(t).zzEncode();return this._push(g,e.length(),e)},p.prototype.bool=function(t){return this._push(d,1,t?1:0)},p.prototype.fixed32=function(t){return this._push(b,4,t>>>0)},p.prototype.sfixed32=p.prototype.fixed32,p.prototype.fixed64=function(t){var e=o.from(t);return this._push(b,4,e.lo)._push(b,4,e.hi)},p.prototype.sfixed64=p.prototype.fixed64,p.prototype.float=function(t){return this._push(i.float.writeFloatLE,4,t)},p.prototype.double=function(t){return this._push(i.float.writeDoubleLE,8,t)};var m=i.Array.prototype.set?function(t,e,r){e.set(t,r)}:function(t,e,r){for(var n=0;n>>0;if(!e)return this._push(d,1,0);if(i.isString(t)){var r=p.alloc(e=a.length(t));a.decode(t,r,0),t=r}return this.uint32(e)._push(m,e,t)},p.prototype.string=function(t){var e=s.length(t);return e?this.uint32(e)._push(s.write,e,t):this._push(d,1,0)},p.prototype.fork=function(){return this.states=new c(this),this.head=this.tail=new u(l,0,0),this.len=0,this},p.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(l,0,0),this.len=0),this},p.prototype.ldelim=function(){var t=this.head,e=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=t.next,this.tail=e,this.len+=r),this},p.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),r=0;t;)t.fn(t.val,e,r),r+=t.len,t=t.next;return e},p._configure=function(t){n=t,p.create=f(),n._configure()}},3155:(t,e,r)=>{"use strict";t.exports=o;var n=r(1173);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(9693);function o(){n.call(this)}function a(t,e,r){t.length<40?i.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var n=0;n>>0;return this.uint32(e),e&&this._push(o.writeBytesBuffer,e,t),this},o.prototype.string=function(t){var e=i.Buffer.byteLength(t);return this.uint32(e),e&&this._push(a,e,t),this},o._configure()},7714:(t,e,r)=>{"use strict";e.R=void 0;let n=r(6919),i=r(7448);e.R=new class{async init(){}async createSessionHandler(t,e){let r=new n.Session(e);return await r.loadModel(t),new i.OnnxjsSessionHandler(r)}}},4200:(t,e,r)=>{"use strict";e.c8=e.rX=void 0;let n=r(1670),i=r(5381),o=r(2157),a=r(2306);e.rX=()=>{if(("number"!=typeof n.env.wasm.initTimeout||n.env.wasm.initTimeout<0)&&(n.env.wasm.initTimeout=0),"boolean"!=typeof n.env.wasm.simd&&(n.env.wasm.simd=!0),"boolean"!=typeof n.env.wasm.proxy&&(n.env.wasm.proxy=!1),"number"!=typeof n.env.wasm.numThreads||!Number.isInteger(n.env.wasm.numThreads)||n.env.wasm.numThreads<=0){let t="undefined"==typeof navigator?(0,i.cpus)().length:navigator.hardwareConcurrency;n.env.wasm.numThreads=Math.min(4,Math.ceil((t||1)/2))}},e.c8=new class{async init(){(0,e.rX)(),await (0,o.initWasm)()}async createSessionHandler(t,e){let r=new a.OnnxruntimeWebAssemblySessionHandler;return await r.loadModel(t,e),Promise.resolve(r)}}},6018:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}: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(1670),e);let o=r(1670);{let t=r(7714).R;(0,o.registerBackend)("webgl",t,-10)}{let t=r(4200).c8;(0,o.registerBackend)("cpu",t,10),(0,o.registerBackend)("wasm",t,10),(0,o.registerBackend)("xnnpack",t,9)}},246:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createAttributeWithCacheKey=void 0;class r{constructor(t){Object.assign(this,t)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map(t=>`${this[t]}`).join(";")),this._cacheKey}}e.createAttributeWithCacheKey=t=>new r(t)},7778:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Attribute=void 0;let n=r(1446),i=r(9395),o=r(9162),a=r(2517);var s=i.onnxruntime.experimental.fbs;class u{constructor(t){if(this._attributes=new Map,null!=t){for(let e of t)e instanceof n.onnx.AttributeProto?this._attributes.set(e.name,[u.getValue(e),u.getType(e)]):e instanceof s.Attribute&&this._attributes.set(e.name(),[u.getValue(e),u.getType(e)]);if(this._attributes.sizeo.Tensor.fromProto(t));if(t instanceof s.Attribute)return r.map(t=>o.Tensor.fromOrtTensor(t))}if(e===n.onnx.AttributeProto.AttributeType.STRING&&t instanceof n.onnx.AttributeProto){let t=r;return(0,a.decodeUtf8String)(t)}return e===n.onnx.AttributeProto.AttributeType.STRINGS&&t instanceof n.onnx.AttributeProto?r.map(a.decodeUtf8String):r}static getValueNoCheck(t){return t instanceof n.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(t):this.getValueNoCheckFromOrtFormat(t)}static getValueNoCheckFromOnnxFormat(t){switch(t.type){case n.onnx.AttributeProto.AttributeType.FLOAT:return t.f;case n.onnx.AttributeProto.AttributeType.INT:return t.i;case n.onnx.AttributeProto.AttributeType.STRING:return t.s;case n.onnx.AttributeProto.AttributeType.TENSOR:return t.t;case n.onnx.AttributeProto.AttributeType.GRAPH:return t.g;case n.onnx.AttributeProto.AttributeType.FLOATS:return t.floats;case n.onnx.AttributeProto.AttributeType.INTS:return t.ints;case n.onnx.AttributeProto.AttributeType.STRINGS:return t.strings;case n.onnx.AttributeProto.AttributeType.TENSORS:return t.tensors;case n.onnx.AttributeProto.AttributeType.GRAPHS:return t.graphs;default:throw Error(`unsupported attribute type: ${n.onnx.AttributeProto.AttributeType[t.type]}`)}}static getValueNoCheckFromOrtFormat(t){switch(t.type()){case s.AttributeType.FLOAT:return t.f();case s.AttributeType.INT:return t.i();case s.AttributeType.STRING:return t.s();case s.AttributeType.TENSOR:return t.t();case s.AttributeType.GRAPH:return t.g();case s.AttributeType.FLOATS:return t.floatsArray();case s.AttributeType.INTS:{let e=[];for(let r=0;r{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolveBackend=e.backend=void 0;let n=r(5038),i=new Map;async function o(t){let r=e.backend;if(void 0!==r[t]&&function(t){let e=t;return"initialize"in e&&"function"==typeof e.initialize&&"createSessionHandler"in e&&"function"==typeof e.createSessionHandler&&"dispose"in e&&"function"==typeof e.dispose}(r[t])){let e=r[t],n=e.initialize();if("object"==typeof n&&"then"in n&&(n=await n),n)return i.set(t,e),e}}e.backend={webgl:new n.WebGLBackend},e.resolveBackend=async function t(e){if(!e)return t(["webgl"]);for(let t of"string"==typeof e?[e]:e){let e=i.get(t);if(e)return e;let r=await o(t);if(r)return r}throw Error("no available backend to use")}},5038:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLBackend=void 0;let n=r(1670),i=r(6231),o=r(6416),a=r(7305);e.WebGLBackend=class{get contextId(){return n.env.webgl.contextId}set contextId(t){n.env.webgl.contextId=t}get matmulMaxBatchSize(){return n.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(t){n.env.webgl.matmulMaxBatchSize=t}get textureCacheMode(){return n.env.webgl.textureCacheMode}set textureCacheMode(t){n.env.webgl.textureCacheMode=t}get pack(){return n.env.webgl.pack}set pack(t){n.env.webgl.pack=t}get async(){return n.env.webgl.async}set async(t){n.env.webgl.async=t}initialize(){try{return this.glContext=(0,a.createWebGLContext)(this.contextId),"number"!=typeof this.matmulMaxBatchSize&&(this.matmulMaxBatchSize=16),"string"!=typeof this.textureCacheMode&&(this.textureCacheMode="full"),"boolean"!=typeof this.pack&&(this.pack=!1),"boolean"!=typeof this.async&&(this.async=!1),i.Logger.setWithEnv(n.env),i.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(t){return i.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${t}`),!1}}createSessionHandler(t){return new o.WebGLSessionHandler(this,t)}dispose(){this.glContext.dispose()}}},5107:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CoordsGlslLib=void 0;let n=r(2517),i=r(8520),o=r(5060),a=r(7859),s=r(9390);class u extends i.GlslLib{constructor(t){super(t)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.offsetToCoords()),this.coordsToOffset()),this.toVec()),this.valueFrom()),this.getCommonUtilFuncs()),this.getInputsSamplingSnippets()),this.getOutputSamplingSnippet())}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new i.GlslLibRoutine("\n vec2 offsetToCoords(int offset, int width, int height) {\n int t = offset / width;\n int s = offset - t*width;\n vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height);\n return coords;\n }\n ")}}coordsToOffset(){return{coordsToOffset:new i.GlslLibRoutine("\n int coordsToOffset(vec2 coords, int width, int height) {\n float s = coords.s * float(width);\n float t = coords.t * float(height);\n int offset = int(t) * width + int(s);\n return offset;\n }\n ")}}getOutputSamplingSnippet(){let t=this.context.outputTextureLayout;return t.isPacked?this.getPackedOutputSamplingSnippet(t):this.getUnpackedOutputSamplingSnippet(t)}getPackedOutputSamplingSnippet(t){let e=t.unpackedShape,r=[t.width,t.height],n={},a="getOutputCoords";switch(e.length){case 0:n[a]=this.getOutputScalarCoords();break;case 1:n[a]=this.getOutputPacked1DCoords(e,r);break;case 2:n[a]=this.getOutputPacked2DCoords(e,r);break;case 3:n[a]=this.getOutputPacked3DCoords(e,r);break;default:n[a]=this.getOutputPackedNDCoords(e,r)}let s=` + void setOutput(vec4 val) { + ${(0,o.getGlsl)(this.context.glContext.version).output} = val; + } + `;return n.floatTextureSetRGBA=new i.GlslLibRoutine(s),n}getUnpackedOutputSamplingSnippet(t){let e=t.unpackedShape,r=[t.width,t.height],n={},a="getOutputCoords";switch(e.length){case 0:n[a]=this.getOutputScalarCoords();break;case 1:n[a]=this.getOutputUnpacked1DCoords(e,r);break;case 2:n[a]=this.getOutputUnpacked2DCoords(e,r);break;case 3:n[a]=this.getOutputUnpacked3DCoords(e,r);break;case 4:n[a]=this.getOutputUnpacked4DCoords(e,r);break;case 5:n[a]=this.getOutputUnpacked5DCoords(e,r);break;case 6:n[a]=this.getOutputUnpacked6DCoords(e,r);break;default:throw Error(`Unsupported output dimensionality: ${e.length}`)}let s=` + void setOutput(float val) { + ${(0,o.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0); + } + `;return n.floatTextureSetR=new i.GlslLibRoutine(s),n}getOutputScalarCoords(){return new i.GlslLibRoutine("\n int getOutputCoords() {\n return 0;\n }\n ")}getOutputPacked1DCoords(t,e){let r=e,n="";return n=1===r[0]?` + int getOutputCoords() { + return 2 * int(TexCoords.y * ${r[1]}.0); + } + `:1===r[1]?` + int getOutputCoords() { + return 2 * int(TexCoords.x * ${r[0]}.0); + } + `:` + int getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${r[0]}, ${r[1]})); + return 2 * (resTexRC.y * ${r[0]} + resTexRC.x); + } + `,new i.GlslLibRoutine(n)}getOutputPacked2DCoords(t,e){let r="";if(n.ArrayUtil.arraysEqual(t,e))return r=` + ivec2 getOutputCoords() { + return 2 * ivec2(TexCoords.xy * vec2(${e[0]}, ${e[1]})); + } + `,new i.GlslLibRoutine(r);let o=e,a=Math.ceil(t[1]/2);return r=` + ivec2 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${o[0]}, ${o[1]})); + + int index = resTexRC.y * ${o[0]} + resTexRC.x; + + // reverse r and c order for packed texture + int r = imod(index, ${a}) * 2; + int c = 2 * (index / ${a}); + + return ivec2(r, c); + } + `,new i.GlslLibRoutine(r)}getOutputPacked3DCoords(t,e){let r=[e[0],e[1]],n=Math.ceil(t[2]/2),o=n*Math.ceil(t[1]/2),a=` + ivec3 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${r[0]}, ${r[1]})); + int index = resTexRC.y * ${r[0]} + resTexRC.x; + + int b = index / ${o}; + index -= b * ${o}; + + // reverse r and c order for packed texture + int r = imod(index, ${n}) * 2; + int c = 2 * (index / ${n}); + + return ivec3(b, r, c); + } + `;return new i.GlslLibRoutine(a)}getOutputPackedNDCoords(t,e){let r=[e[0],e[1]],n=Math.ceil(t[t.length-1]/2),o=n*Math.ceil(t[t.length-2]/2),a=o,s="",u="b, r, c";for(let e=2;e=0;--e)o[e]=o[e+1]*t[e+1];let a=["r","c","d"],s=o.map((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`).join("");return r=` + ivec3 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${e[0]}, ${e[1]})); + int index = resTexRC.y * ${e[0]} + resTexRC.x; + ${s} + return ivec3(r, c, d); + } + `,new i.GlslLibRoutine(r)}getOutputUnpacked4DCoords(t,e){let r="",n=t.length,o=null;n<2&&(o=[]),(o=Array(n-1))[n-2]=t[n-1];for(let e=n-3;e>=0;--e)o[e]=o[e+1]*t[e+1];let a=["r","c","d","d2"],s=o.map((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`).join("");return r=` + ivec4 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${e[0]}, ${e[1]})); + int index = resTexRC.y * ${e[0]} + resTexRC.x; + ${s} + return ivec4(r, c, d, d2); + } + `,new i.GlslLibRoutine(r)}getOutputUnpacked5DCoords(t,e){let r="",n=t.length,o=null;n<2&&(o=[]),(o=Array(n-1))[n-2]=t[n-1];for(let e=n-3;e>=0;--e)o[e]=o[e+1]*t[e+1];let a=["r","c","d","d2","d3"],s=o.map((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`).join("");return r=` + ivec5 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${e[0]}, ${e[1]})); + int index = resTexRC.y * ${e[0]} + resTexRC.x; + ${s} + return ivec5(r, c, d, d2, d3); + } + `,new i.GlslLibRoutine(r)}getOutputUnpacked6DCoords(t,e){let r="",n=t.length,o=null;n<2&&(o=[]),(o=Array(n-1))[n-2]=t[n-1];for(let e=n-3;e>=0;--e)o[e]=o[e+1]*t[e+1];let a=["r","c","d","d2","d3","d4"],s=o.map((t,e)=>`int ${a[e]} = index / ${t}; ${e===o.length-1?`int ${a[e+1]} = index - ${a[e]} * ${t}`:`index -= ${a[e]} * ${t}`};`).join("");return r=` + ivec6 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${e[0]}, ${e[1]})); + int index = resTexRC.y * ${e[0]} + resTexRC.x; + ${s} + return ivec6(r, c, d, d2, d3, d4); + } + `,new i.GlslLibRoutine(r)}getCommonUtilFuncs(){let t={},e="uvFromFlat";t[e]=new i.GlslLibRoutine("\n vec2 uvFromFlat(int texNumR, int texNumC, int index) {\n int texC = index / texNumR;\n int texR = index - texC * texNumR;\n // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to\n // v.\n return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC);\n }\n "),t[e="packedUVfrom1D"]=new i.GlslLibRoutine("\n vec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n int texelIndex = index / 2;\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n }\n "),t[e="packedUVfrom2D"]=new i.GlslLibRoutine("\n vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) {\n int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n }\n "),t[e="packedUVfrom3D"]=new i.GlslLibRoutine("\n vec2 packedUVfrom3D(int texNumR, int texNumC,\n int texelsInBatch, int texelsInLogicalRow, int b,\n int row, int col) {\n int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n }\n "),e="sampleTexture";let r=(0,o.getGlsl)(this.context.glContext.version);return t[e]=new i.GlslLibRoutine(` + float sampleTexture(sampler2D textureSampler, vec2 uv) { + return ${r.texture2D}(textureSampler, uv).r; + }`),t}getInputsSamplingSnippets(){let t={},e=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((r,n)=>{let i=this.context.inputTextureLayouts[n],o=(0,s.generateShaderFuncNameFromInputSamplerName)(r);i.isPacked?t[o]=this.getPackedSamplerFromInput(o,r,i):t[o]=this.getUnpackedSamplerFromInput(o,r,i);let a=(0,s.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(r);i.unpackedShape.length<=e.unpackedShape.length&&(i.isPacked?t[a]=this.getPackedSamplerAtOutputCoords(a,i,e,r):t[a]=this.getUnpackedSamplerAtOutputCoords(a,i,e,r))}),t}getPackedSamplerAtOutputCoords(t,e,r,o){let a;let u=e.unpackedShape,l=r.unpackedShape,c=o,p=(0,s.generateShaderFuncNameFromInputSamplerName)(c),f=u.length,d=l.length,h=n.BroadcastUtil.getBroadcastDims(u,l),g=(0,s.getCoordsDataType)(d),b=d-f,m=(0,s.getGlChannels)();a=0===f?"":d<2&&h.length>=1?"coords = 0;":h.map(t=>`coords.${m[t+b]} = 0;`).join("\n");let y="";y=d<2&&f>0?"coords":u.map((t,e)=>`coords.${m[e+b]}`).join(", ");let _="return outputValue;",v=1===n.ShapeUtil.size(u),x=1===n.ShapeUtil.size(l);if(1!==f||v||x){if(v&&!x)_=1===d?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(h.length){let t=f-2,e=f-1;h.indexOf(t)>-1&&h.indexOf(e)>-1?_="return vec4(outputValue.x);":h.indexOf(t)>-1?_="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":h.indexOf(e)>-1&&(_="return vec4(outputValue.xx, outputValue.zz);")}}else _="\n return vec4(outputValue.xy, outputValue.xy);\n ";let w=` + vec4 ${t}() { + ${g} coords = getOutputCoords(); + + int lastDim = coords.${m[d-1]}; + coords.${m[d-1]} = coords.${m[d-2]}; + coords.${m[d-2]} = lastDim; + + ${a} + vec4 outputValue = ${p}(${y}); + ${_} + } + `;return new i.GlslLibRoutine(w,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(t,e,r,o){let a;let u=[r.width,r.height],l=[e.width,e.height],c=e.unpackedShape.length,p=r.unpackedShape.length,f=e.unpackedShape,d=r.unpackedShape,h=(0,s.generateShaderFuncNameFromInputSamplerName)(o);if(c===p&&n.ArrayUtil.arraysEqual(l,u)){let e=` + float ${t}() { + return sampleTexture(${o}, TexCoords); + } + `;return new i.GlslLibRoutine(e,["coordinates.sampleTexture"])}let g=(0,s.getCoordsDataType)(p),b=n.BroadcastUtil.getBroadcastDims(f,d),m=p-c,y=(0,s.getGlChannels)();a=0===c?"":p<2&&b.length>=1?"coords = 0;":b.map(t=>`coords.${y[t+m]} = 0;`).join("\n");let _="";_=p<2&&c>0?"coords":e.unpackedShape.map((t,e)=>`coords.${y[e+m]}`).join(", ");let v=` + float ${t}() { + ${g} coords = getOutputCoords(); + ${a} + return ${h}(${_}); + } + `;return new i.GlslLibRoutine(v,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(t,e,r){switch(r.unpackedShape.length){case 0:return this.getPackedSamplerScalar(t,e);case 1:return this.getPackedSampler1D(t,e,r);case 2:return this.getPackedSampler2D(t,e,r);case 3:return this.getPackedSampler3D(t,e,r);default:return this.getPackedSamplerND(t,e,r)}}getUnpackedSamplerFromInput(t,e,r){let n=r.unpackedShape;switch(n.length){case 0:return this.getUnpackedSamplerScalar(t,e,r);case 1:return this.getUnpackedSampler1D(t,e,r);case 2:return this.getUnpackedSampler2D(t,e,r);case 3:return this.getUnpackedSampler3D(t,e,r);case 4:return this.getUnpackedSampler4D(t,e,r);case 5:return this.getUnpackedSampler5D(t,e,r);case 6:return this.getUnpackedSampler6D(t,e,r);default:throw Error(`Unsupported dimension ${n.length}-D`)}}getPackedSamplerScalar(t,e){let r=` + vec4 ${t}() { + return ${(0,o.getGlsl)(this.context.glContext.version).texture2D}(${e}, halfCR); + } + `;return new i.GlslLibRoutine(r)}getPackedSampler1D(t,e,r){let n=[r.width,r.height],a=[n[1],n[0]],s=(0,o.getGlsl)(this.context.glContext.version),u=`vec4 ${t}(int index) { + vec2 uv = packedUVfrom1D( + ${a[0]}, ${a[1]}, index); + return ${s.texture2D}(${e}, uv); + }`;return new i.GlslLibRoutine(u,["coordinates.packedUVfrom1D"])}getPackedSampler2D(t,e,r){let a=r.unpackedShape,s=[r.width,r.height],u=(0,o.getGlsl)(this.context.glContext.version),l=s[0],c=s[1];if(null!=s&&n.ArrayUtil.arraysEqual(a,s)){let r=`vec4 ${t}(int row, int col) { + vec2 uv = (vec2(col, row) + halfCR) / vec2(${c}.0, ${l}.0); + return ${u.texture2D}(${e}, uv); + }`;return new i.GlslLibRoutine(r)}let p=s,f=Math.ceil(a[1]/2),d=`vec4 ${t}(int row, int col) { + vec2 uv = packedUVfrom2D(${p[1]}, ${p[0]}, ${f}, row, col); + return ${u.texture2D}(${e}, uv); + }`;return new i.GlslLibRoutine(d,["coordinates.packedUVfrom2D"])}getPackedSampler3D(t,e,r){let n=r.unpackedShape,a=[r.width,r.height],u=[a[0],a[1]],l=(0,o.getGlsl)(this.context.glContext.version);if(1===n[0]){let o=n.slice(1),a=[1,2],u=(0,s.squeezeInputShape)(n,o),l=["b","row","col"],c=JSON.parse(JSON.stringify(r));c.unpackedShape=u;let p=this.getPackedSamplerFromInput(t,e,c),f=`${p.routineBody} + vec4 ${t}(int b, int row, int col) { + return ${t}(${(0,s.getSqueezedParams)(l,a)}); + } `;return new i.GlslLibRoutine(f,p.dependencies)}let c=u[0],p=u[1],f=Math.ceil(n[2]/2),d=`vec4 ${t}(int b, int row, int col) { + vec2 uv = packedUVfrom3D( + ${p}, ${c}, ${f*Math.ceil(n[1]/2)}, ${f}, b, row, col); + return ${l.texture2D}(${e}, uv);}`;return new i.GlslLibRoutine(d,["coordinates.packedUVfrom3D"])}getPackedSamplerND(t,e,r){let n=r.unpackedShape,a=n.length,s=[r.width,r.height],u=(0,o.getGlsl)(this.context.glContext.version),l=[s[0],s[1]],c=l[1],p=l[0],f=Math.ceil(n[a-1]/2),d=f*Math.ceil(n[a-2]/2),h="int b, int row, int col",g=`b * ${d} + (row / 2) * ${f} + (col / 2)`;for(let t=2;t{let n=this.context.inputTextureLayouts[r],o=(n.unpackedShape.length>0?n.unpackedShape:n.shape).length,a=`_${e}`;t[a]=new i.GlslLibRoutine(this.getValueFromSingle(e,o,n.width,n.height,!1),[`shapeUtils.indicesToOffset${a}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),t[a+="_T"]=new i.GlslLibRoutine(this.getValueFromSingle(e,o,n.width,n.height,!0),[`shapeUtils.indicesToOffset${a}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])}),t}getValueFromSingle(t,e,r,n,i){let a=`_${t}`;return i&&(a+="_T"),` + float ${a}(int m[${e}]) { + int offset = indicesToOffset${a}(m); + vec2 coords = offsetToCoords(offset, ${r}, ${n}); + float value = getColorAsFloat(${(0,o.getGlsl)(this.context.glContext.version).texture2D}(${t}, coords)); + return value; + } + `}getPackedValueFrom(t,e,r,n,i){let a=`_${t}_Pack`;return i&&(a+="_T"),` + vec4 ${a}(int m[${e}]) { + int offset = indicesToOffset_${t}(m); + vec2 coords = offsetToCoords(offset, ${r}, ${n}); + return ${(0,o.getGlsl)(this.context.glContext.version).texture2D}(${t}, coords); + } + `}}e.CoordsGlslLib=u},8520:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.TopologicalSortGlslRoutines=e.GlslLibRoutineNode=e.GlslLibRoutine=e.GlslLib=e.GlslContext=e.FunctionType=void 0,(r=e.FunctionType||(e.FunctionType={}))[r.ValueBased=0]="ValueBased",r[r.Positional=1]="Positional",e.GlslContext=class{constructor(t,e,r,n){this.glContext=t,this.programInfo=e,this.inputTextureLayouts=r,this.outputTextureLayout=n}},e.GlslLib=class{constructor(t){this.context=t}},e.GlslLibRoutine=class{constructor(t,e){this.routineBody=t,this.dependencies=e}},e.GlslLibRoutineNode=class{constructor(t,e,r){this.name=t,this.dependencies=r||[],e&&(this.routineBody=e)}addDependency(t){t&&this.dependencies.push(t)}},e.TopologicalSortGlslRoutines=class{static returnOrderedNodes(t){if(!t||0===t.length)return[];if(1===t.length)return t;let e=new Set,r=new Set,n=[];return this.createOrderedNodes(t,e,r,n),n}static createOrderedNodes(t,e,r,n){for(let i=0;i0)for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncodingGlslLib=void 0;let n=r(8520);class i extends n.GlslLib{constructor(t){super(t)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new n.GlslLibRoutine("highp vec4 encode(highp float f) {\n return vec4(f, 0.0, 0.0, 0.0);\n }\n ")}}decodeFloat32(){return{decode:new n.GlslLibRoutine("highp float decode(highp vec4 rgba) {\n return rgba.r;\n }\n ")}}encodeUint8(){let t=i.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new n.GlslLibRoutine(` + highp vec4 encode(highp float f) { + highp float F = abs(f); + highp float Sign = step(0.0,-f); + highp float Exponent = floor(log2(F)); + highp float Mantissa = (exp2(- Exponent) * F); + Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa)); + highp vec4 rgba; + rgba[0] = 128.0 * Sign + floor(Exponent*exp2(-1.0)); + rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0); + rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0))); + rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0))); + ${t} + rgba = rgba / 255.0; // values need to be normalized to [0,1] + return rgba; + } + `)}}decodeUint8(){let t=i.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new n.GlslLibRoutine(` + highp float decode(highp vec4 rgba) { + rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255] + ${t} + highp float Sign = 1.0 - step(128.0,rgba[0])*2.0; + highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0; + highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000); + highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 )); + return Result; + } + `)}}static isLittleEndian(){let t=new ArrayBuffer(4),e=new Uint32Array(t),r=new Uint8Array(t);if(e[0]=3735928559,239===r[0])return!0;if(222===r[0])return!1;throw Error("unknown endianness")}}e.EncodingGlslLib=i},9894:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FragColorGlslLib=void 0;let n=r(8520),i=r(5060);class o extends n.GlslLib{constructor(t){super(t)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){let t=(0,i.getGlsl)(this.context.glContext.version);return{setFragColor:new n.GlslLibRoutine(` + void setFragColor(float value) { + ${t.output} = encode(value); + } + `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new n.GlslLibRoutine("\n float getColorAsFloat(vec4 color) {\n return decode(color);\n }\n ",["encoding.decode"])}}}e.FragColorGlslLib=o},2848:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.replaceInlines=void 0;let r=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;e.replaceInlines=function(t){let e;let n={};for(;null!==(e=r.exec(t));){let t=e[3].split(",").map(t=>{let e=t.trim().split(" ");return e&&2===e.length?{type:e[0],name:e[1]}:null}).filter(t=>null!==t);n[e[2]]={params:t,body:e[4]}}for(let r in n){let i=RegExp("(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",r),"gm");for(;null!==(e=i.exec(t));){let i=e[1],o=e[2],a=e[3].split(","),s=i?`${i} ${o};`:"",u=n[r].body,l="";n[r].params.forEach((t,e)=>{t&&(l+=`${t.type} ${t.name} = ${a[e]}; +`)}),u=(u=`${l} + ${u}`).replace("return",`${o} = `);let c=` + ${s} + { + ${u} + } + `;t=t.replace(e[0],c)}}return t.replace(r,"")}},8879:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GlslPreprocessor=void 0;let n=r(8520),i=r(2848),o=r(5483),a=r(5060);e.GlslPreprocessor=class{constructor(t,e,r,i){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new n.GlslContext(t,e,r,i),Object.keys(o.glslRegistry).forEach(t=>{let e=new o.glslRegistry[t](this.context);this.libs[t]=e});let a=this.glslLibRoutineDependencyGraph;for(let t in this.libs){let e=this.libs[t].getFunctions();for(let r in e){let i;let o=t+"."+r;a[o]?(i=a[o]).routineBody=e[r].routineBody:(i=new n.GlslLibRoutineNode(o,e[r].routineBody),a[o]=i);let s=e[r].dependencies;if(s)for(let t=0;t{let n=r.split(".")[1];-1!==t.indexOf(n)&&e.push(this.glslLibRoutineDependencyGraph[r])}),n.TopologicalSortGlslRoutines.returnOrderedNodes(e)}getUniforms(t,e){let r=[];if(t)for(let e of t)r.push(`uniform sampler2D ${e};`);if(e)for(let t of e)r.push(`uniform ${t.type} ${t.name}${t.arrayLength?`[${t.arrayLength}]`:""};`);return r.join("\n")}}},5483:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.glslRegistry=void 0;let n=r(5107),i=r(7341),o=r(9894),a=r(2655),s=r(3891);e.glslRegistry={encoding:i.EncodingGlslLib,fragcolor:o.FragColorGlslLib,vec:s.VecGlslLib,shapeUtils:a.ShapeUtilsGlslLib,coordinates:n.CoordsGlslLib}},2655:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ShapeUtilsGlslLib=void 0;let n=r(8520);class i extends n.GlslLib{constructor(t){super(t)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.bcastIndex()),this.bcastMatmulIndex()),this.offsetToIndices()),this.indicesToOffset()),this.incrementIndices())}getCustomTypes(){return{}}bcastIndex(){let t=this.context.outputTextureLayout.shape.length,e={};return this.context.programInfo.inputNames.forEach((r,i)=>{let o=this.context.inputTextureLayouts[i].unpackedShape;if(o.length<=t){let i=o.length,a=t-i,s=`bcastIndices_${r}`,u="";for(let t=0;t{let o=this.context.inputTextureLayouts[i].shape;if(!(o.length<2||o.length>t)){let i=o.length,a=t-i,s=`bcastMatmulIndices_${r}`,u="";for(let t=0;t{let o=this.context.inputTextureLayouts[r].shape,a=this.context.inputTextureLayouts[r].strides,s=o.length,u=`indicesToOffset_${e}`;t[u]=new n.GlslLibRoutine(i.indexToOffsetSingle(u,s,a)),t[u=`indicesToOffset_${e}_T`]=new n.GlslLibRoutine(i.indexToOffsetSingle(u,s,a.slice().reverse()))}),t}static indexToOffsetSingle(t,e,r){let n="";for(let t=e-1;t>=0;--t)n+=` + offset += indices[${t}] * ${r[t]}; + `;return` + int ${t}(int indices[${e}]) { + int offset = 0; + ${n} + return offset; + } + `}offsetToIndices(){let t={};return this.context.programInfo.inputNames.forEach((e,r)=>{let o=this.context.inputTextureLayouts[r].shape,a=this.context.inputTextureLayouts[r].strides,s=o.length,u=`offsetToIndices_${e}`;t[u]=new n.GlslLibRoutine(i.offsetToIndicesSingle(u,s,a)),t[u=`offsetToIndices_${e}_T`]=new n.GlslLibRoutine(i.offsetToIndicesSingle(u,s,a.slice().reverse()))}),t}static offsetToIndicesSingle(t,e,r){let n=[];for(let t=0;t{let i=this.context.inputTextureLayouts[r].shape,o=i.length,a=`incrementIndices_${e}`,s="";for(let t=0;t= 0; --i) { + if(i > axis) continue; + indices[i] += 1; + if(indices[i] < shape[i]) { + break; + } + indices[i] = 0; + } + } + `;t[a]=new n.GlslLibRoutine(u)}),t}}e.ShapeUtilsGlslLib=i},5060:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getDefaultFragShaderMain=e.getFragShaderPreamble=e.getVertexShaderSource=e.getGlsl=void 0;let r={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},n={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function i(t){return 1===t?r:n}e.getGlsl=i,e.getVertexShaderSource=function(t){let e=i(t);return`${e.version} + precision highp float; + ${e.attribute} vec3 position; + ${e.attribute} vec2 textureCoord; + + ${e.varyingVertex} vec2 TexCoords; + + void main() + { + gl_Position = vec4(position, 1.0); + TexCoords = textureCoord; + }`},e.getFragShaderPreamble=function(t){let e=i(t);return`${e.version} + precision highp float; + precision highp int; + precision highp sampler2D; + ${e.varyingFrag} vec2 TexCoords; + ${e.outputDeclaration} + const vec2 halfCR = vec2(0.5, 0.5); + + // Custom vector types to handle higher dimenalities. + struct ivec5 + { + int x; + int y; + int z; + int w; + int u; + }; + + struct ivec6 + { + int x; + int y; + int z; + int w; + int u; + int v; + }; + + int imod(int x, int y) { + return x - y * (x / y); + } + + `},e.getDefaultFragShaderMain=function(t,e){return` + void main() { + int indices[${e}]; + toVec(TexCoords, indices); + vec4 result = vec4(process(indices)); + ${i(t).output} = result; + } + `}},3891:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VecGlslLib=void 0;let n=r(8520);class i extends n.GlslLib{constructor(t){super(t)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){let t=this.context.outputTextureLayout.shape.length,e={add:"+=",sub:"-=",mul:"*=",div:"/="},r={};for(let i in e){let o=`${i}Vec`,a="";for(let r=0;r{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLInferenceHandler=void 0;let n=r(6231),i=r(9162),o=r(2517),a=r(2403),s=r(7019),u=r(8710),l=r(5611),c=r(4057),p=r(2039);e.WebGLInferenceHandler=class{constructor(t){this.session=t,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(t,e){return(0,c.calculateTextureWidthAndHeight)(this.session.layoutStrategy,t,e)}executeProgram(t,e){if(e.length{let r=e.map(t=>`${t.unpackedShape.join(",")};${t.width}x${t.height}`).join("_"),n=t.name;return t.cacheHint&&(n+="["+t.cacheHint+"]"),n+=":"+r})(t,r),i=this.session.programManager.getArtifact(n),o=i?i.programInfo:"function"==typeof t.get?t.get():t,a=(0,c.createTextureLayoutFromTextureType)(this.session.layoutStrategy,o.output.dims,o.output.textureType),s=this.createTextureData(a,o.output.type);return i||(i=this.session.programManager.build(o,r,s),this.session.programManager.setArtifact(n,i)),this.runProgram(i,r,s),s}run(t,e){return this.executeProgram(t,e).tensor}runProgram(t,e,r){for(let r=0;rthis.readTexture(a),async t=>this.readTextureAsync(a),void 0,o),texture:r});return this.setTextureData(a.tensor.dataId,a,t.isPacked),a}getTextureData(t,e=!1){return this.session.isInitializer(t)?this.session.getTextureData(t,e):e?this.packedTextureDataCache.get(t):this.unpackedTextureDataCache.get(t)}setTextureData(t,e,r=!1){this.session.isInitializer(t)?this.session.setTextureData(t,e,r):(r?this.packedTextureDataCache:this.unpackedTextureDataCache).set(t,e)}isTextureLayoutCached(t,e=!1){return!!this.getTextureData(t.dataId,e)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(t=>this.session.textureManager.releaseTexture(t)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(t=>this.session.textureManager.releaseTexture(t)),this.unpackedTextureDataCache=new Map}readTexture(t){return t.isPacked?this.readTexture(this.unpack(t)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(t,t.tensor.type,t.channels):this.session.textureManager.readUint8TextureAsFloat((0,u.encodeAsUint8)(this,t))}async readTextureAsync(t){return t.isPacked?this.readTextureAsync(this.unpack(t)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(t,t.tensor.type,t.channels):this.session.textureManager.readUint8TextureAsFloat((0,u.encodeAsUint8)(this,t))}pack(t){return this.executeProgram((0,a.createPackProgramInfoLoader)(this,t.tensor),[t.tensor])}unpack(t){return this.executeProgram((0,l.createUnpackProgramInfoLoader)(this,t.tensor),[t.tensor])}}},1640:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.WEBGL_OP_RESOLVE_RULES=void 0;let a=r(2898),s=o(r(7839)),u=r(4196),l=r(2069),c=r(8138),p=r(9663),f=r(5193),d=r(7992),h=r(1253),g=r(4776),b=r(6572),m=r(3346),y=r(5623),_=r(2870),v=r(2143),x=r(4939),w=r(718),T=r(2268),S=r(8117),O=r(2278),A=r(5524),E=r(5975),I=r(3933),P=r(6558),D=r(5723),$=r(3738),k=o(r(4909)),C=r(8428),F=r(9793);e.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",k.abs],["Acos","","7+",k.acos],["Add","","7+",s.add],["And","","7+",s.and],["Asin","","7+",k.asin],["Atan","","7+",k.atan],["AveragePool","","7+",v.averagePool,v.parseAveragePoolAttributes],["BatchNormalization","","7+",a.batchNormalization,a.parseBatchNormalizationAttributes],["Cast","","6+",u.cast,u.parseCastAttributes],["Ceil","","6+",k.ceil],["Clip","","6-10",k.clip,k.parseClipAttributes],["Clip","","11+",k.clipV11],["Concat","","4+",l.concat,l.parseConcatAttributes],["Conv","","1+",c.conv,c.parseConvAttributes],["ConvTranspose","","1+",p.convTranspose,p.parseConvTransposeAttributes],["Cos","","7+",k.cos],["Div","","7+",s.div],["Dropout","","7+",k.identity],["DepthToSpace","","1+",f.depthToSpace,f.parseDepthToSpaceAttributes],["Equal","","7+",s.equal],["Elu","","6+",k.elu,k.parseEluAttributes],["Exp","","6+",k.exp],["Flatten","","1+",d.flatten,d.parseFlattenAttributes],["Floor","","6+",k.floor],["FusedConv","com.microsoft","1+",c.conv,c.parseConvAttributes],["Gather","","1+",h.gather,h.parseGatherAttributes],["Gemm","","7-10",g.gemm,g.parseGemmAttributesV7],["Gemm","","11+",g.gemm,g.parseGemmAttributesV11],["GlobalAveragePool","","1+",v.globalAveragePool,v.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",v.globalMaxPool],["Greater","","7+",s.greater],["Identity","","1+",k.identity],["ImageScaler","","1+",b.imageScaler,b.parseImageScalerAttributes],["InstanceNormalization","","6+",m.instanceNormalization,m.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",k.leakyRelu,k.parseLeakyReluAttributes],["Less","","7+",s.less],["Log","","6+",k.log],["MatMul","","1+",y.matMul,y.parseMatMulAttributes],["MaxPool","","1+",v.maxPool,v.parseMaxPoolAttributes],["Mul","","7+",s.mul],["Neg","","6+",k.neg],["Not","","1+",k.not],["Or","","7+",s.or],["Pad","","2-10",_.padV2,_.parsePadAttributesV2],["Pad","","11+",_.padV11,_.parsePadAttributesV11],["Pow","","7+",s.pow],["PRelu","","7+",s.pRelu],["ReduceLogSum","","1+",x.reduceLogSum,x.parseReduceAttributes],["ReduceMax","","1+",x.reduceMax,x.parseReduceAttributes],["ReduceMean","","1+",x.reduceMean,x.parseReduceAttributes],["ReduceMin","","1+",x.reduceMin,x.parseReduceAttributes],["ReduceProd","","1+",x.reduceProd,x.parseReduceAttributes],["ReduceSum","","1-12",x.reduceSum,x.parseReduceAttributes],["ReduceSumSquare","","1+",x.reduceLogSumSquare,x.parseReduceAttributes],["Relu","","6+",k.relu],["Reshape","","5+",w.reshape],["Resize","","10",T.resize,T.parseResizeAttributesV10],["Resize","","11+",T.resize,T.parseResizeAttributesV11],["Shape","","1+",S.shape],["Sigmoid","","6+",k.sigmoid],["Sin","","7+",k.sin],["Slice","","10+",O.sliceV10],["Slice","","1-9",O.slice,O.parseSliceAttributes],["Softmax","","1-12",A.softmax,A.parseSoftmaxAttributes],["Softmax","","13+",A.softmaxV13,A.parseSoftmaxAttributesV13],["Split","","2-12",E.split,E.parseSplitAttributes],["Sqrt","","6+",k.sqrt],["Squeeze","","1-12",I.squeeze,I.parseSqueezeAttributes],["Squeeze","","13+",I.squeezeV13],["Sub","","7+",s.sub],["Sum","","6+",P.sum],["Tan","","7+",k.tan],["Tanh","","6+",k.tanh],["Tile","","6+",D.tile],["Transpose","","1+",$.transpose,$.parseTransposeAttributes],["Upsample","","7-8",F.upsample,F.parseUpsampleAttributesV7],["Upsample","","9",F.upsample,F.parseUpsampleAttributesV9],["Unsqueeze","","1-12",C.unsqueeze,C.parseUnsqueezeAttributes],["Unsqueeze","","13+",C.unsqueezeV13],["Xor","","7+",s.xor]]},2898:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseBatchNormalizationAttributes=e.batchNormalization=void 0;let n=r(246),i=r(5060),o=r(2039),a={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]};e.batchNormalization=(t,e,r)=>(u(e),[t.run(Object.assign(Object.assign({},a),{cacheHint:r.cacheKey,get:()=>s(t,e,r)}),e)]),e.parseBatchNormalizationAttributes=t=>{let e=t.attributes.getFloat("epsilon",1e-5),r=t.attributes.getFloat("momentum",.9),i=t.attributes.getInt("spatial",1);return(0,n.createAttributeWithCacheKey)({epsilon:e,momentum:r,spatial:i})};let s=(t,e,r)=>{let n=(0,i.getGlsl)(t.session.backend.glContext.version),s=e[0].dims.length,[u,l]=t.calculateTextureWidthAndHeight(e[1].dims,o.TextureType.unpacked),c=` + float process(int[${s}] indices) { + vec2 position = offsetToCoords(indices[1], ${u}, ${l}); + float scale = getColorAsFloat(${n.texture2D}(Scale, position)); + float mean = getColorAsFloat(${n.texture2D}(Mean, position)); + float variance = getColorAsFloat(${n.texture2D}(Variance, position)); + float b = getColorAsFloat(${n.texture2D}(B, position)); + + return scale * ( (_A(indices) - mean) / sqrt(variance + float(${r.epsilon})) ) + b; + }`;return Object.assign(Object.assign({},a),{output:{dims:e[0].dims,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:c})},u=t=>{if(!t||5!==t.length)throw Error("BatchNormalization requires 5 inputs.");let e=t[0],r=t[1],n=t[2],i=t[3],o=t[4];if(e.dims.length<3||1!==r.dims.length||1!==n.dims.length||1!==i.dims.length||1!==o.dims.length||r.dims[0]!==e.dims[1]||n.dims[0]!==e.dims[1]||i.dims[0]!==e.dims[1]||o.dims[0]!==e.dims[1])throw Error("invalid input shape.");if("float32"!==e.type&&"float64"!==e.type||"float32"!==r.type&&"float64"!==r.type||"float32"!==n.type&&"float64"!==n.type||"float32"!==i.type&&"float64"!==i.type||"float32"!==o.type&&"float64"!==o.type)throw Error("invalid input tensor types.")}},7839:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.xor=e.sub=e.pRelu=e.pow=e.or=e.mul=e.less=e.greater=e.equal=e.div=e.and=e.add=e.glslPRelu=e.glslPow=e.glslXor=e.glslOr=e.glslAnd=e.glslLess=e.glslGreater=e.glslEqual=e.glslSub=e.glslMul=e.glslDiv=e.glslAdd=void 0;let n=r(2517),i=r(8520),o=r(5060),a=r(2039);function s(){let t="add_";return{body:` + float ${t}(float a, float b) { + return a + b; + } + vec4 ${t}(vec4 v1, vec4 v2) { + return v1 + v2; + } + `,name:t,type:i.FunctionType.ValueBased}}function u(){let t="div_";return{body:` + float ${t}(float a, float b) { + return a / b; + } + vec4 ${t}(vec4 v1, vec4 v2) { + return v1 / v2; + } + `,name:t,type:i.FunctionType.ValueBased}}function l(){let t="mul_";return{body:` + float ${t}(float a, float b) { + return a * b; + } + vec4 ${t}(vec4 v1, vec4 v2) { + return v1 * v2; + } + `,name:t,type:i.FunctionType.ValueBased}}function c(){let t="sub_";return{body:` + float ${t}(float a, float b) { + return a - b; + } + vec4 ${t}(vec4 v1, vec4 v2) { + return v1 - v2; + } + `,name:t,type:i.FunctionType.ValueBased}}function p(){let t="equal_";return{body:` + float ${t}(float a, float b) { + return float(a == b); + } + vec4 ${t}(vec4 v1, vec4 v2) { + return vec4(equal(v1, v2)); + } + `,name:t,type:i.FunctionType.ValueBased}}function f(){let t="greater_";return{body:` + float ${t}(float a, float b) { + return float(a > b); + } + vec4 ${t}(vec4 v1, vec4 v2) { + return vec4( v1.r > v2.r , + v1.g > v2.g, + v1.b > v2.b, + v1.a > v2.a ); + } + `,name:t,type:i.FunctionType.ValueBased}}function d(){let t="less_";return{body:` + float ${t}(float a, float b) { + return float(a < b); + } + vec4 ${t}(vec4 v1, vec4 v2) { + return vec4( v1.r < v2.r , + v1.g < v2.g, + v1.b < v2.b, + v1.a < v2.a ); + } + `,name:t,type:i.FunctionType.ValueBased}}function h(){let t="and_";return{body:` + float ${t}(float a, float b) { + return float( bool(a) && bool(b) ); + } + vec4 ${t}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r && b2.r , + b1.g && b2.g, + b1.b && b2.b, + b1.a && b2.a ); + } + `,name:t,type:i.FunctionType.ValueBased}}function g(){let t="or_";return{body:` + float ${t}(float a, float b) { + return float( bool(a) || bool(b) ); + } + vec4 ${t}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r || b2.r , + b1.g || b2.g, + b1.b || b2.b, + b1.a || b2.a ); + } + `,name:t,type:i.FunctionType.ValueBased}}function b(){let t="xor_";return{body:` + float ${t}(float a, float b) { + return float( bool(a) ^^ bool(b) ); + } + vec4 ${t}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r ^^ b2.r , + b1.g ^^ b2.g, + b1.b ^^ b2.b, + b1.a ^^ b2.a ); + } + `,name:t,type:i.FunctionType.ValueBased}}function m(){return function(t){let e="pow_";return{body:` + float ${e}(float a, float b) { + return pow(a, b); + } + vec4 ${e}(vec4 v1, vec4 v2) { + return pow(v1, v2); + } + `,name:e,type:i.FunctionType.ValueBased}}("pow")}function y(){let t="prelu_";return{body:` + float ${t}(float a, float b) { + return a < 0.0 ? a * b: a; + } + vec4 ${t}(vec4 v1, vec4 v2) { + return vec4( + v1.r < 0.0 ? v1.r * v2.r: v1.r, + v1.g < 0.0 ? v1.g * v2.g: v1.g, + v1.b < 0.0 ? v1.b * v2.b: v1.b, + v1.a < 0.0 ? v1.a * v2.a: v1.a + ); + } + `,name:t,type:i.FunctionType.ValueBased}}e.glslAdd=s,e.glslDiv=u,e.glslMul=l,e.glslSub=c,e.glslEqual=p,e.glslGreater=f,e.glslLess=d,e.glslAnd=h,e.glslOr=g,e.glslXor=b,e.glslPow=m,e.glslPRelu=y;let _=(t,e,r,n=e[0].type,i)=>{let o=t.session.pack?a.TextureType.packed:a.TextureType.unpacked;return{name:r.name,inputNames:["A","B"],inputTypes:[o,o],cacheHint:i,get:()=>v(t,e,r,n)}},v=(t,e,r,i=e[0].type)=>{let s=t.session.pack?a.TextureType.packed:a.TextureType.unpacked,u=!n.ShapeUtil.areEqual(e[0].dims,e[1].dims),l=e[0].dims,c=t.session.pack;if(u){let a=n.BroadcastUtil.calcShape(e[0].dims,e[1].dims,!1);if(!a)throw Error("Can't perform binary op on the given tensors");let u=(l=a).length,p=0!==e[0].dims.length?e[0].dims.length:1,f=0!==e[1].dims.length?e[1].dims.length:1,d=0!==e[0].dims.length?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",h=0!==e[1].dims.length?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",g=(0,o.getGlsl)(t.session.backend.glContext.version),b=c?` + ${r.body} + void main() { + vec4 a = getAAtOutCoords(); + vec4 b = getBAtOutCoords(); + vec4 result = ${r.name}(a, b); + ${g.output} = result; + }`:` + ${r.body} + float process(int indices[${u}]) { + int aindices[${p}]; + int bindices[${f}]; + ${d} + ${h} + return ${r.name}(_A(aindices), _B(bindices)); + }`;return{name:r.name,inputNames:["A","B"],inputTypes:[s,s],output:{dims:l,type:i,textureType:s},shaderSource:b,hasMain:c}}let p=(0,o.getGlsl)(t.session.backend.glContext.version),f=` + ${r.body} + void main() { + vec4 v1 = ${p.texture2D}(A, TexCoords); + vec4 v2 = ${p.texture2D}(B, TexCoords); + vec4 result = ${r.name}(v1, v2); + ${p.output} = result; + } + `;return{name:r.name,inputNames:["A","B"],inputTypes:[s,s],output:{dims:e[0].dims,type:i,textureType:s},shaderSource:f,hasMain:!0}};e.add=(t,e)=>[t.run(_(t,e,s()),e)],e.and=(t,e)=>[t.run(_(t,e,h(),"bool"),e)],e.div=(t,e)=>[t.run(_(t,e,u()),e)],e.equal=(t,e)=>[t.run(_(t,e,p(),"bool"),e)],e.greater=(t,e)=>[t.run(_(t,e,f(),"bool"),e)],e.less=(t,e)=>[t.run(_(t,e,d(),"bool"),e)],e.mul=(t,e)=>[t.run(_(t,e,l()),e)],e.or=(t,e)=>[t.run(_(t,e,g(),"bool"),e)],e.pow=(t,e)=>[t.run(_(t,e,m()),e)],e.pRelu=(t,e)=>[t.run(_(t,e,y()),e)],e.sub=(t,e)=>[t.run(_(t,e,c()),e)],e.xor=(t,e)=>[t.run(_(t,e,b(),"bool"),e)]},4196:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseCastAttributes=e.cast=void 0;let n=r(2517);e.cast=(t,e,r)=>(i(e),[t.cast(e[0],r)]),e.parseCastAttributes=t=>n.ProtoUtil.tensorDataTypeFromProto(t.attributes.getInt("to"));let i=t=>{if(!t||1!==t.length)throw Error("Cast requires 1 input.");if("string"===t[0].type)throw Error("Invalid input type.")}},1163:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedConcatProgramInfoLoader=void 0;let n=r(5060),i=r(2039),o=r(9390),a=r(2827);e.createPackedConcatProgramInfoLoader=(t,e,r)=>{var u,l;let c=(u=e.length,l=r.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:u},(t,e)=>`X${e}`),inputTypes:Array(u).fill(i.TextureType.packed),cacheHint:l});return Object.assign(Object.assign({},c),{get:()=>((t,e,r,u)=>{let l=r[0].dims.slice();if(u>=l.length||u<-1*l.length)throw Error("axis specified for concat doesn't match input dimensionality");u<0&&(u=l.length+u);let c=l.slice(0);for(let t=1;tt.dims),b=(0,o.getGlChannels)(p),m=Array(g.length-1);m[0]=g[0][u];for(let t=1;t= ${m[t-1]}) { + return getChannel( + getX${t}(${s(b,y,e)}), + vec2(${s(_,y,e)})); + }`}let w=m.length,T=m[m.length-1];x+=` + return getChannel( + getX${w}(${s(b,y,T)}), + vec2(${s(_,y,T)}));`;let S=(0,n.getGlsl)(t.session.backend.glContext.version),O=` + ${h} + float getValue(${b.map(t=>"int "+t)}) { + ${x} + } + + void main() { + ${d} coords = getOutputCoords(); + int lastDim = coords.${b[p-1]}; + coords.${b[p-1]} = coords.${b[p-2]}; + coords.${b[p-2]} = lastDim; + + vec4 result = vec4(getValue(${f}), 0., 0., 0.); + + ${f[p-1]} = ${f[p-1]} + 1; + if (${f[p-1]} < ${c[p-1]}) { + result.g = getValue(${f}); + } + + ${f[p-2]} = ${f[p-2]} + 1; + if (${f[p-2]} < ${c[p-2]}) { + result.a = getValue(${f}); + } + + ${f[p-1]} = ${f[p-1]} - 1; + if (${f[p-2]} < ${c[p-2]} && + ${f[p-1]} < ${c[p-1]}) { + result.b = getValue(${f}); + } + ${S.output} = result; + } + `;return Object.assign(Object.assign({},e),{output:{dims:c,type:r[0].type,textureType:i.TextureType.packed},shaderSource:O,hasMain:!0})})(t,c,e,r.axis)})};let s=(t,e,r)=>{let n=t.indexOf(e);return t.map((t,e)=>e===n?`${t} - ${r}`:t).join()}},2069:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseConcatAttributes=e.concat=void 0;let n=r(246),i=r(2039),o=r(1163);e.concat=(t,e,r)=>(p(e),t.session.pack&&e[0].dims.length>1?[t.run((0,o.createPackedConcatProgramInfoLoader)(t,e,r),e)]:[t.run(a(t,e,r),e)]);let a=(t,e,r)=>{var n,o;let a=(n=e.length,o=r.cacheKey,{name:"Concat",inputNames:Array.from({length:n},(t,e)=>`X${e}`),inputTypes:Array(n).fill(i.TextureType.unpacked),cacheHint:o});return Object.assign(Object.assign({},a),{get:()=>((t,e,r,n)=>{let o=r[0].dims.slice();if(n>=o.length||n<-1*o.length)throw Error("axis specified for concat doesn't match input dimensionality");n<0&&(n=o.length+n);let a=o.slice(0);for(let t=1;t`int getTextureWhereDataResides(int index) { + ${t.map((t,e)=>`if(index<${t}) {return ${e};} +`).join("")} + }`,u=t=>s(t),l=(t,e)=>{let r=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${e}]) {`];for(let e=0;e{let e=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let r=0;r(0,n.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis")});let p=t=>{if(!t||t.length<1)throw Error("too few inputs");let e=t[0].type,r=t[0].dims.length;if("string"===e)throw Error("string tensor is not supported yet");for(let n of t){if(n.type!==e)throw Error("input tensors should be one type");if(n.dims.length!==r)throw Error("input tensors should have the same shape")}}},4770:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createUnpackedGroupedConvProgramInfoLoader=void 0;let n=r(6231),i=r(5060),o=r(2039),a=r(8138),s=r(2823);e.createUnpackedGroupedConvProgramInfoLoader=(t,e,r)=>{var u,l;let c=(u=e.length>2,l=r.cacheKey,{name:"GroupedConv",inputNames:u?["X","W","Bias"]:["X","W"],inputTypes:u?[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.unpacked],cacheHint:l});return Object.assign(Object.assign({},c),{get:()=>((t,e,r,u)=>{let l=e.length>2?"value += getBias(output_channel);":"",c=e[0].dims.slice(),p=e[1].dims.slice(),f=p[0]/u.group;n.Logger.verbose("GroupedConv",`autpPad:${u.autoPad}, dilations:${u.dilations}, group:${u.group}, kernelShape:${u.kernelShape}, pads:${u.pads}, strides:${u.strides}`);let d=(0,a.calculateOutputShape)(c,p,u.dilations,u.pads,u.strides),h=(0,i.getGlsl)(t.session.backend.glContext.version),{activationFunction:g,applyActivation:b}=(0,s.getActivationSnippet)(u),m=` + const ivec2 strides = ivec2(${u.strides[0]}, ${u.strides[1]}); + const ivec2 pads = ivec2(${u.pads[0]}, ${u.pads[1]}); + ${g} + void main() { + ivec4 coords = getOutputCoords(); + int batch = coords.x; + int output_channel = coords.y; + ivec2 xRCCorner = coords.zw * strides - pads; + int group_id = output_channel / ${f}; + + float value = 0.0; + for (int wInChannel = 0; wInChannel < ${p[1]}; wInChannel++) { + int input_channel = group_id * ${p[1]} + wInChannel; + for (int wHeight = 0; wHeight < ${p[2]}; wHeight++) { + int xHeight = xRCCorner.x + wHeight * ${u.dilations[0]}; + + if (xHeight < 0 || xHeight >= ${c[2]}) { + continue; + } + + for (int wWidth = 0; wWidth < ${p[3]}; wWidth++) { + int xWidth = xRCCorner.y + wWidth * ${u.dilations[1]}; + if (xWidth < 0 || xWidth >= ${c[3]}) { + continue; + } + + float xVal = getX(batch, input_channel, xWidth, xHeight); + float wVal = getW(output_channel, wInChannel, wWidth, wHeight); + value += xVal*wVal; + } + } + } + ${l} + ${b} + ${h.output} = vec4(value, .0, .0, .0); + } +`;return Object.assign(Object.assign({},r),{output:{dims:d,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:m,hasMain:!0})})(t,e,c,r)})}},1386:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.conv2DPacked=e.conv2DPackedPointwise=void 0;let n=r(8138),i=r(8555),o=r(708);e.conv2DPackedPointwise=(t,e,r)=>{let i=e[0].dims,a=e[1].dims,s=(0,n.calculateOutputShape)(i,a,r.dilations,r.pads,r.strides),u=t.reshapePacked(e[0],[i[1],i[2]*i[3]]),l=t.reshapePacked(e[1],[a[0],a[1]]),c=e.length>2?[l,u,e[2]]:[l,u],p=t.run((0,o.createPackedMatmulProgramInfoLoader)(t,c,r),c);return t.reshapePacked(p,s)},e.conv2DPacked=(t,e,r)=>{let a=e[0].dims,s=e[1].dims,u=(0,n.calculateOutputShape)(a,s,r.dilations,r.pads,r.strides),l=t.run((0,i.createPackedIm2ColProgramInfoLoader)(t,e[0],e[1],u,r),[e[0]]),c=t.reshapePacked(e[1],[s[0],s[1]*s[2]*s[3]]),p=3===e.length?[c,l,e[2]]:[c,l],f=t.run((0,o.createPackedMatmulProgramInfoLoader)(t,p,r),p);return t.reshapePacked(f,u)}},9663:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseConvTransposeAttributes=e.convTranspose=void 0;let n=r(246),i=r(5060),o=r(2039),a=r(2823),s=(t,e,r,n,i,o)=>(t-1)*e+r+(n-1)*i+1-o,u=(t,e,r,n,i)=>{let o=Math.floor(t/2);"SAME_UPPER"===e?(r[n]=o,r[i]=t-o):"SAME_LOWER"===e&&(r[n]=t-o,r[i]=o)};e.convTranspose=(t,e,r)=>(f(e,r),l(t,e,r));let l=(t,e,r)=>{let n=p(r,e);return[c(t,e,n)]},c=(t,e,r)=>t.run(((t,e,r)=>{var n,s;let u=(n=e.length>2,s=r.cacheKey,{name:"ConvTranspose",inputNames:n?["X","W","B"]:["X","W"],inputTypes:n?[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.unpacked],cacheHint:s});return Object.assign(Object.assign({},u),{get:()=>((t,e,r,n)=>{let s=e.length>2?"getB(output_channel)":"0.0",u=e[0].dims,l=e[1].dims,c=l[1],p=l[0]/n.group,f=[e[0].dims[0],e[1].dims[1]*n.group,...n.outputShape],d=(0,i.getGlsl)(t.session.backend.glContext.version),{activationFunction:h,applyActivation:g}=(0,a.getActivationSnippet)(n),b=` + const ivec2 strides = ivec2(${n.strides[0]}, ${n.strides[1]}); + const ivec2 pads = ivec2(${n.pads[0]}, ${n.pads[1]}); + ${h} + void main() { + ivec4 coords = getOutputCoords(); + int batch = coords.x; + int output_channel = coords.y; + + ivec2 loc = coords.zw + pads; + + int group_id = output_channel / ${c}; + int wOutChannel = output_channel - group_id * ${c}; + + float value = ${s}; + for (int inChannelOffset = 0; inChannelOffset < ${p}; inChannelOffset++) { + int input_channel = group_id * ${p} + inChannelOffset; + for (int wWOff = 0; wWOff < ${l[2]}; wWOff++) { + for (int wHOff = 0; wHOff < ${l[3]}; wHOff++) { + ivec2 wOff = ivec2(wWOff * ${n.dilations[0]}, wHOff * ${n.dilations[1]}); + ivec2 wLoc = loc - wOff; + ivec2 wLocIn = wLoc / strides; + if ( + wLocIn * strides == wLoc && + wLocIn.x >= 0 && wLocIn.x < ${u[2]} && + wLocIn.y >= 0 && wLocIn.y < ${u[3]} + ) { + float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x); + float wVal = getW(input_channel, wOutChannel, wHOff, wWOff); + value += xVal * wVal; + } + } + } + } + ${g} + ${d.output} = vec4(value, .0, .0, .0); + } +`;return Object.assign(Object.assign({},r),{output:{dims:f,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:b,hasMain:!0})})(t,e,u,r)})})(t,e,r),e),p=(t,e)=>{let r=t.kernelShape.slice();if(0===t.kernelShape.length)for(let t=2;t{let c=t.length-2,p=0===l.length;for(let f=0;f{let e=t.attributes,r=(0,a.parseInternalActivationAttributes)(e),i=e.getString("auto_pad","NOTSET"),o=e.getInts("dilations",[1,1]),s=e.getInt("group",1),u=e.getInts("kernel_shape",[]),l=e.getInts("output_padding",[0,0]),c=e.getInts("output_shape",[]),p=e.getInts("pads",[0,0,0,0]),f=e.getInts("strides",[1,1]);return(0,n.createAttributeWithCacheKey)(Object.assign({autoPad:i,dilations:o,group:s,kernelShape:u,outputPadding:l,outputShape:c,pads:p,strides:f},r))};let f=(t,e)=>{if(!t||2!==t.length&&3!==t.length)throw Error("Conv requires 2 or 3 inputs");if(4!==t[0].dims.length||4!==t[1].dims.length)throw Error("currently only support 2-dimensional conv");if(t[0].dims[1]!==t[1].dims[0])throw Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");let r=t[1].dims[1]*e.group;if(3===t.length&&(1!==t[2].dims.length||t[2].dims[0]!==r))throw Error("invalid bias");let n=t[0].dims.length-2;if(e.dilations.length!==n)throw Error(`dilations should be ${n}D`);if(e.strides.length!==n)throw Error(`strides should be ${n}D`);if(e.pads.length!==2*n)throw Error(`pads should be ${2*n}D`);if(e.outputPadding.length!==n)throw Error(`output_padding should be ${n}D`);if(0!==e.kernelShape.length&&e.kernelShape.length!==t[1].dims.length-2)throw Error("invalid kernel shape");if(0!==e.outputShape.length&&e.outputShape.length!==t[0].dims.length-2)throw Error("invalid output shape");if("float32"!==t[0].type||"float32"!==t[1].type)throw Error("ConvTranspose input(X,W) should be float tensor");if(3===t.length&&"float32"!==t[2].type)throw Error("ConvTranspose input(bias) should be float tensor")}},8138:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseConvAttributes=e.conv=e.calculateOutputShape=void 0;let n=r(246),i=r(2517),o=r(4770),a=r(1386),s=r(9828),u=r(2823),l=r(3248),c=r(5623);e.calculateOutputShape=(t,e,r,n,i)=>{let o=t[0],a=t.slice(2),s=a.length,u=e[0],l=e.slice(2).map((t,e)=>t+(t-1)*(r[e]-1));return[o,u].concat(...a.map((t,e)=>t+n[e]+n[e+s]).map((t,e)=>Math.floor((t-l[e]+i[e])/i[e])))},e.conv=(t,e,r)=>(g(e,r),p(t,e,r));let p=(t,e,r)=>{let n=h(r,e),i=t.session.pack,s=1===n.kernelShape[0]&&1===n.kernelShape[1];return n.group>1?[t.run((0,o.createUnpackedGroupedConvProgramInfoLoader)(t,e,n),e)]:s&&i?[f(t,e,n)]:i&&4===e[0].dims.length&&1===e[0].dims[0]&&!s?[(0,a.conv2DPacked)(t,e,n)]:[d(t,e,n)]},f=(t,r,n)=>{let i=r[0].dims,o=r[1].dims,a=(0,e.calculateOutputShape)(i,o,n.dilations,n.pads,n.strides),s=t.reshapeUnpacked(r[0],[i[1],i[2]*i[3]]),u=t.reshapeUnpacked(r[1],[o[0],o[1]]),l=r.length>2?[u,s,r[2]]:[u,s],p=t.run((0,c.createMatmulProgramInfoLoader)(l,n),l);return t.reshapeUnpacked(p,a)},d=(t,r,n)=>{let i=r[0].dims,o=r[1].dims,a=(0,e.calculateOutputShape)(i,o,n.dilations,n.pads,n.strides),u=t.run((0,l.createIm2ColProgramInfoLoader)(t,r[0],r[1],a,n),[r[0]]),c=3===r.length?[u,r[1],r[2]]:[u,r[1]];return t.run((0,s.createDotProductProgramInfoLoader)(t,r,a,n),c)},h=(t,e)=>{let r=t.kernelShape.slice();if(0===t.kernelShape.length)for(let t=2;t{let e=t.attributes,r=(0,u.parseInternalActivationAttributes)(e),i=e.getString("auto_pad","NOTSET"),o=e.getInts("dilations",[1,1]),a=e.getInt("group",1),s=e.getInts("kernel_shape",[]),l=e.getInts("pads",[0,0,0,0]),c=e.getInts("strides",[1,1]);return(0,n.createAttributeWithCacheKey)(Object.assign({autoPad:i,dilations:o,group:a,kernelShape:s,pads:l,strides:c},r))};let g=(t,e)=>{if(!t||2!==t.length&&3!==t.length)throw Error("Conv requires 2 or 3 inputs");if(4!==t[0].dims.length||4!==t[1].dims.length)throw Error("currently only support 2-dimensional conv");if(t[0].dims[1]!==t[1].dims[1]*e.group)throw Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(3===t.length&&(1!==t[2].dims.length||t[1].dims[0]!==t[2].dims[0]))throw Error("invalid bias");let r=t[0].dims.length-2;if(e.dilations.length!==r)throw Error(`dilations should be ${r}D`);if(e.strides.length!==r)throw Error(`strides should be ${r}D`);if(e.pads.length!==2*r)throw Error(`pads should be ${2*r}D`);if(0!==e.kernelShape.length&&e.kernelShape.length!==t[1].dims.length-2)throw Error("invalid kernel shape");if("float32"!==t[0].type||"float32"!==t[1].type)throw Error("Conv input(X,W) should be float tensor");if(3===t.length&&"float32"!==t[2].type)throw Error("Conv input(bias) should be float tensor")}},5193:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseDepthToSpaceAttributes=e.depthToSpace=void 0;let n=r(3738);e.depthToSpace=(t,e,r)=>{i(e);let o=r.blocksize,a=o*o,s="DCR"===r.mode?[0,3,4,1,5,2]:[0,1,4,2,5,3],u="DCR"===r.mode?[e[0].dims[0],o,o,e[0].dims[1]/a,e[0].dims[2],e[0].dims[3]]:[e[0].dims[0],e[0].dims[1]/a,o,o,e[0].dims[2],e[0].dims[3]],l=t.reshapeUnpacked(e[0],u),c={perm:s,cacheKey:`${s}`},[p]=(0,n.transpose)(t,[l],c),f=[e[0].dims[0],e[0].dims[1]/a,e[0].dims[2]*o,e[0].dims[3]*o];return[t.reshapeUnpacked(p,f)]},e.parseDepthToSpaceAttributes=t=>{let e=t.attributes.getInt("blocksize");if(e<1)throw Error(`blocksize must be >= 1, but got : ${e} for DepthToSpace`);let r=t.attributes.getString("mode","DCR");if("DCR"!==r&&"CRD"!==r)throw Error(`unrecognized mode: ${r} for DepthToSpace`);return{mode:r,blocksize:e}};let i=t=>{if(1!==t.length)throw Error(`DepthToSpace expect 1 inputs, but got ${t.length}`);if("string"===t[0].type||4!==t[0].dims.length)throw TypeError("DepthToSpace input should be a 4-D numeric tensor")}},9828:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createDotProductProgramInfoLoader=void 0;let n=r(2517),i=r(5060),o=r(2039),a=r(2823),s=r(3248);e.createDotProductProgramInfoLoader=(t,e,r,u)=>{let l,c;let p=(l=e.length>2,c=u,{name:"ConvDotProduct",inputNames:l?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:l?[o.TextureType.unpacked,o.TextureType.packedLastDimension,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.packedLastDimension],cacheKey:c.activationCacheKey});return Object.assign(Object.assign({},p),{get:()=>((t,e,r,u,l)=>{let c=r[0].dims,p=r[1].dims,f=[p[0],Math.ceil(c[1]*p[2]*p[3]/4)],d=(0,s.calculateIm2ColDims)(c,p,u),[h,g]=t.calculateTextureWidthAndHeight(f,o.TextureType.packedLastDimension),b=n.ShapeUtil.computeStrides(d),[m,y]=t.calculateTextureWidthAndHeight(d,o.TextureType.packedLastDimension),_=u.length,v=r.length<3?"0.0":"_B(b)",x=Math.ceil(c[1]*p[2]*p[3]/4),{activationFunction:w,applyActivation:T}=(0,a.getActivationSnippet)(l),S=(0,i.getGlsl)(t.session.backend.glContext.version),O=` +${w} +float process(int indices[${_}]) { + int b[1]; + b[0] = indices[1]; + int im2col[4]; + im2col[0] = indices[0]; + im2col[1] = indices[2]; + im2col[2] = indices[3]; + int im2colOffset = im2col[0] * ${b[0]} + im2col[1] * ${b[1]} + im2col[2] * ${b[2]}; + int kernelOffset = indices[1] * ${f[1]}; + float value = ${v}; + for (int i = 0; i < ${x}; ++i) { + vec2 im2colCoords = offsetToCoords(im2colOffset, ${m}, ${y}); + vec2 kernelCoords = offsetToCoords(kernelOffset, ${h}, ${g}); + value += dot(${S.texture2D}(Im2Col, im2colCoords), ${S.texture2D}(K, kernelCoords)); + ++im2colOffset; + ++kernelOffset; + } + ${T} + return value; +}`;return Object.assign(Object.assign({},e),{output:{dims:u,type:r[0].type,textureType:o.TextureType.unpacked},shaderSource:O})})(t,p,e,r,u)})}},7992:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseFlattenAttributes=e.flatten=void 0;let n=r(2517);e.flatten=(t,e,r)=>{i(e,r);let o=n.ShapeUtil.flattenShape(e[0].dims,r);return[t.reshapeUnpacked(e[0],o)]},e.parseFlattenAttributes=t=>t.attributes.getInt("axis",1);let i=(t,e)=>{if(!t||1!==t.length)throw Error("Flatten requires 1 input.");let r=t[0].dims.length;if(0===r)throw Error("scalar tensor is not supported.");if(e<-r||e>r)throw Error("Invalid axis");if("string"===t[0].type)throw Error("string tensor is not supported.")}},2823:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseInternalActivationAttributes=e.getActivationSnippet=void 0;let n=r(2517),i=r(4909);e.getActivationSnippet=function(t){let e;switch(t.activation){case"Relu":e=(0,i.glslRelu)();break;case"Sigmoid":e=(0,i.glslSigmoid)();break;case"Clip":e=(0,i.glslClip)(t.clipMin,t.clipMax);break;default:return{activationFunction:"",applyActivation:""}}let r=e.name;return{activationFunction:e.body,applyActivation:`value = ${r}_(value);`}},e.parseInternalActivationAttributes=t=>{let e=t.getString("activation","");if("Clip"===e){let[r,i]=t.getFloats("activation_params",[n.MIN_CLIP,n.MAX_CLIP]);return{activation:e,clipMax:i,clipMin:r,activationCacheKey:`${e}:${r},${i}`}}return{activation:e,activationCacheKey:e}}},1253:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseGatherAttributes=e.gather=void 0;let n=r(246),i=r(782),o=r(2517),a=r(2039);e.gather=(t,e,r)=>(l(e,r.axis),[t.run(u(t,e,r),e)]),e.parseGatherAttributes=t=>(0,n.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis",0)});let s={name:"Gather",inputNames:["A","B"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked]},u=(t,e,r)=>{let n=Object.assign(Object.assign({},s),{cacheHint:r.cacheKey});return Object.assign(Object.assign({},n),{get:()=>((t,e,r,n)=>{let i=r[0].dims.slice(),s=r[1].dims.slice(),u=Array(i.length+s.length-1);n=o.ShapeUtil.normalizeAxis(n,i.length);let l=[];for(let t=0;t{if(!t||2!==t.length)throw Error("Gather requires 2 inputs.");let r=t[0].dims.length;if(r<1)throw Error("Invalid input shape.");if(e<-r||e>r-1)throw Error("Invalid axis.");if(-1===i.NUMBER_TYPES.indexOf(t[0].type)||"int32"!==t[1].type&&"int16"!==t[1].type)throw Error("Invaid input type.")}},4776:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseGemmAttributesV11=e.parseGemmAttributesV7=e.gemm=void 0;let n=r(246),i=r(2517),o=r(2039);e.gemm=(t,e,r)=>(l(e,r),[t.run(s(e,r),e)]);let a=(t,e)=>{let r=0!==t.attributes.getInt("transA",0),i=0!==t.attributes.getInt("transB",0),o=t.attributes.getFloat("alpha",1),a=t.attributes.getFloat("beta",1);return(0,n.createAttributeWithCacheKey)({transA:r,transB:i,alpha:o,beta:a,isOptionalC:e})};e.parseGemmAttributesV7=t=>a(t,!1),e.parseGemmAttributesV11=t=>a(t,!0);let s=(t,e)=>{let r={name:"Gemm",inputNames:3===t.length?["A","B","C"]:["A","B"],inputTypes:3===t.length?[o.TextureType.unpacked,o.TextureType.unpacked,o.TextureType.unpacked]:[o.TextureType.unpacked,o.TextureType.unpacked],key:e.cacheKey};return Object.assign(Object.assign({},r),{get:()=>u(r,t,e)})},u=(t,e,r)=>{let n=e[0].dims.slice(),a=e[1].dims.slice(),[s,u]=i.GemmUtil.getShapeOfGemmResult(n,r.transA,a,r.transB,3===e.length?e[2].dims:void 0),l=[s,u];if(!l)throw Error("Can't use gemm on the given tensors");let c=n[n.length-1],p="";r.transA&&(c=n[0]),r.transA&&r.transB?p="value += _A_T(a) * _B_T(b);":r.transA&&!r.transB?p="value += _A_T(a) * _B(b);":!r.transA&&r.transB?p="value += _A(a) * _B_T(b);":r.transA||r.transB||(p="value += _A(a) * _B(b);");let f=l.length,d=` + float process(int indices[${f}]) { + int a[${f}]; + int b[${f}]; + ${3===e.length?`int c[${e[2].dims.length}];`:""} + + copyVec(indices, a); + copyVec(indices, b); + ${3===e.length?"bcastIndices_C(indices, c);":""} + + float value = 0.0; + for (int k=0; k<${c}; ++k) { + a[${f-1}] = k; + b[${f-2}] = k; + ${p} + } + + value = value * alpha; + ${3===e.length?"value += beta * _C(c);":""} + return value; + }`;return Object.assign(Object.assign({},t),{output:{dims:l,type:e[0].type,textureType:o.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:r.alpha},{name:"beta",type:"float",data:r.beta}],shaderSource:d})},l=(t,e)=>{if(!t)throw Error("Input is missing");if(e.isOptionalC&&(t.length<2||t.length>3))throw Error("Invaid input shape.");if(!e.isOptionalC&&3!==t.length)throw Error("Gemm requires 3 inputs");if(3===t.length&&1!==t[2].dims.length&&2!==t[2].dims.length)throw Error("Invalid input shape of C");if("float32"!==t[0].type&&"float64"!==t[0].type||"float32"!==t[1].type&&"float64"!==t[1].type||3===t.length&&"float32"!==t[2].type&&"float64"!==t[2].type)throw Error("Invalid input type.");if(t[0].type!==t[1].type||3===t.length&&t[0].type!==t[2].type)throw Error("Input types are mismatched")}},8555:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedIm2ColProgramInfoLoader=void 0;let n=r(5060),i=r(2039),o=r(2827);e.createPackedIm2ColProgramInfoLoader=(t,e,r,a,s)=>{var u;let l=(u=s.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[i.TextureType.packed],cacheHint:u});return Object.assign(Object.assign({},l),{get:()=>((t,e,r,a,s,u)=>{let l=r.dims,c=a.dims,p=s.length,f=[c[1]*c[2]*c[3],s[2]*s[3]],d=c[2]*c[3],h=(0,o.unpackFromChannel)(),g=(0,n.getGlsl)(t.session.backend.glContext.version),b="";for(let t=0;t<=1;t++)for(let e=0;e<=1;e++)b+=` + blockIndex = rc.x + ${e}; + pos = rc.y + ${t}; + + if(blockIndex < ${f[1]} && pos < ${f[0]}) { + offsetY = int(blockIndex / (${s[p-1]})) * ${u.strides[0]} - + ${u.pads[0]}; + d0 = offsetY + ${u.dilations[0]} * (imod(pos, ${d}) / ${c[2]}); + + if(d0 < ${l[2]} && d0 >= 0) { + offsetX = imod(blockIndex, ${s[p-1]}) * ${u.strides[1]} - + ${u.pads[1]}; + d1 = offsetX + ${u.dilations[1]} * imod(imod(pos, ${d}), ${c[2]}); + + if(d1 < ${l[3]} && d1 >= 0) { + + ch = int(float(pos)/ ${d}.); + innerDims = vec2(d0, d1); + result[${2*t+e}] = getChannel( + getA(0, ch, int(innerDims.x), + int(innerDims.y)), innerDims); + } + } + } + + `;let m=` + ${h} + + void main() { + ivec2 rc = getOutputCoords(); + vec4 result = vec4(0.0); + int blockIndex, pos, offsetY, d0, offsetX, d1, ch; + vec2 innerDims; + ${b} + ${g.output} = result; + } + `;return Object.assign(Object.assign({},e),{output:{dims:f,type:r.type,textureType:i.TextureType.packed},shaderSource:m,hasMain:!0})})(t,l,e,r,a,s)})}},3248:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.calculateIm2ColDims=e.createIm2ColProgramInfoLoader=void 0;let n=r(2039);e.createIm2ColProgramInfoLoader=(t,r,i,o,a)=>{var s;let u=(s=a.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[n.TextureType.unpacked],cacheHint:s});return Object.assign(Object.assign({},u),{get:()=>((t,r,i,o,a,s)=>{let u=i.dims,l=o.dims,c=a.length,p=(0,e.calculateIm2ColDims)(u,l,a,4),f=` + const int XC = ${u[1]}; + const int XH = ${u[2]}; + const int XW = ${u[3]}; + const int KH = ${s.kernelShape[0]}; + const int KW = ${s.kernelShape[1]}; + const int dilationH = ${s.dilations[0]}; + const int dilationW = ${s.dilations[1]}; + const int strideH = ${s.strides[0]}; + const int strideW = ${s.strides[1]}; + const int padH = ${s.pads[0]}; + const int padW = ${s.pads[1]}; + const int KHKW = KH*KW; + const int XCKHKW = XC * KHKW; + const int outputChannels = 4; + vec4 process(int indices[${c}]) { + int b = indices[0]; // batch size + int oh = indices[1] * strideH - padH; //output height + int ow = indices[2] * strideW - padW; //output width + int p = indices[3] * outputChannels; //patch + vec4 value = vec4(0.0); + for(int i=0; i < outputChannels; ++i) { + if(p < XCKHKW) { + int patchC = p / KHKW; + int patchH = (p - patchC*KHKW) / KW; + int patchW = (p - patchC*KHKW) - patchH * KW; + int xh2 = oh + patchH * dilationH; + int xw2 = ow + patchW * dilationW; + int x[${u.length}]; + x[0] = b; + x[1] = patchC; + x[2] = xh2; + x[3] = xw2; + if(xh2 >= 0 && + xh2 < XH && + xw2 >= 0 && + xw2 < XW) { + value[i] = _X(x); + } + } + ++p; + } + return value; + } + `;return Object.assign(Object.assign({},r),{output:{dims:p,type:i.type,textureType:n.TextureType.packedLastDimension},shaderSource:f})})(0,u,r,i,o,a)})},e.calculateIm2ColDims=(t,e,r,n=4)=>[r[0],r[2],r[3],Math.ceil(t[1]*e[2]*e[3]/n)]},6572:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseImageScalerAttributes=e.imageScaler=void 0;let n=r(246),i=r(2039);e.imageScaler=(t,e,r)=>(u(e),[t.run(a(t,e,r),e)]),e.parseImageScalerAttributes=t=>{let e=t.attributes.getFloat("scale"),r=t.attributes.getFloats("bias");return(0,n.createAttributeWithCacheKey)({scale:e,bias:r})};let o={name:"ImageScaler",inputNames:["X"],inputTypes:[i.TextureType.unpacked]},a=(t,e,r)=>{let n=Object.assign(Object.assign({},o),{cacheHint:r.cacheKey});return Object.assign(Object.assign({},n),{get:()=>((t,e,r,n)=>{let o=r[0].dims.slice(),a=o.length,u=` + ${s(n.bias.length)} + float process(int indices[${a}]) { + return _X(indices) * scale + getBias(bias, indices[1]); + }`;return Object.assign(Object.assign({},e),{output:{dims:o,type:r[0].type,textureType:i.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:n.bias.length,data:n.bias},{name:"scale",type:"float",data:n.scale}],shaderSource:u})})(0,n,e,r)})},s=t=>{let e=[`float getBias(float bias[${t}], int channel) {`];for(let r=0;r{if(!t||1!==t.length)throw Error("ImageScaler requires 1 input.");if(4!==t[0].dims.length)throw Error("Invalid input shape.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw Error("Invalid input type.")}},3346:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseInstanceNormalizationAttributes=e.instanceNormalization=void 0;let n=r(5060),i=r(2039);e.instanceNormalization=(t,e,r)=>{l(e);let n=t.run(a(e[0]),e);return[t.run(u(t,e[0],r,n.dims),[e[0],n,e[1],e[2]])]},e.parseInstanceNormalizationAttributes=t=>t.attributes.getFloat("epsilon",1e-5);let o={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[i.TextureType.unpacked]},a=t=>Object.assign(Object.assign({},o),{get:()=>((t,e)=>{let r=e.dims.slice(),n=r[1],o=r[2]*r[3],a=[r[0],n],s=` + vec4 process(int[2] indices) { + vec4 v = vec4(0.0); + int a[4]; + a[0] = indices[0]; + a[1] = indices[1]; + float temp = 0.0; + for(int a2=0; a2<${r[2]}; a2++) { + a[2] = a2; + for(int a3=0; a3<${r[3]}; a3++) { + a[3] = a3; + float x = _X(a); + temp += x; + } + } + float mean = temp / float(${o}); + temp = 0.0; + for(int a2=0; a2<${r[2]}; a2++) { + a[2] = a2; + for(int a3=0; a3<${r[3]}; a3++) { + a[3] = a3; + float x = _X(a); + temp += (x - mean) * (x - mean); + } + } + v.r = mean; + v.g = temp / float(${o}); + + return v; + }`;return Object.assign(Object.assign({},t),{output:{dims:a,type:e.type,textureType:i.TextureType.packedLastDimension},shaderSource:s})})(o,t)}),s={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[i.TextureType.unpacked,i.TextureType.packedLastDimension,i.TextureType.unpacked,i.TextureType.unpacked]},u=(t,e,r,o)=>{let a=Object.assign(Object.assign({},s),{cacheHint:`${r}`});return Object.assign(Object.assign({},a),{get:()=>((t,e,r,o,a)=>{let s=(0,n.getGlsl)(t.session.backend.glContext.version),[u,l]=t.calculateTextureWidthAndHeight(a,i.TextureType.packedLastDimension),[c,p]=[u/4,l],f=` + vec4 get_MeanAndVariance(int[2] mv) { + int offset = indicesToOffset_MeanAndVariance(mv); + vec2 coords = offsetToCoords(offset, ${c}, ${p}); + return ${s.texture2D}(MeanAndVariance, coords); + } + + float process(int[4] indices) { + int mv[2]; + mv[0] = indices[0]; + mv[1] = indices[1]; + vec4 mean_and_variance = get_MeanAndVariance(mv); + float mean = mean_and_variance.r; + float variance = mean_and_variance.g; + + int sb[1]; + sb[0] = indices[1]; + float scale = _Scale(sb); + float b = _B(sb); + + return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b; + }`;return Object.assign(Object.assign({},e),{output:{dims:r.dims,type:r.type,textureType:i.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:o}],shaderSource:f})})(t,a,e,r,o)})},l=t=>{if(!t||3!==t.length)throw Error("InstanceNormalization requires 3 inputs.");let e=t[0],r=t[1],n=t[2];if(e.dims.length<3||1!==r.dims.length||1!==n.dims.length)throw Error("Invalid input shape.");if(r.dims[0]!==e.dims[1]||n.dims[0]!==e.dims[1])throw Error("Input shapes are mismatched.");if("float32"!==e.type&&"float64"!==e.type||"float32"!==r.type&&"float64"!==r.type||"float32"!==n.type&&"float64"!==n.type)throw Error("Invalid input type.");if(4!==t[0].dims.length)throw Error("Only support 4-D input shape.")}},708:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedMatmulProgramInfoLoader=void 0;let n=r(2517),i=r(5060),o=r(2039),a=r(9390),s=r(2823),u=r(5623);e.createPackedMatmulProgramInfoLoader=(t,e,r)=>{var l,c;let p=(l=e.length>2,c=r.activationCacheKey,{name:"MatMul (packed)",inputNames:l?["A","B","Bias"]:["A","B"],inputTypes:l?[o.TextureType.packed,o.TextureType.packed,o.TextureType.packed]:[o.TextureType.packed,o.TextureType.packed],cacheHint:c});return Object.assign(Object.assign({},p),{get:()=>((t,e,r,l)=>{let c=r.length>2,p=c?"value += getBiasForMatmul();":"",f=r[0].dims,d=r[1].dims,h=n.BroadcastUtil.calcShape(f,d,!0),g=!n.ShapeUtil.areEqual(r[0].dims,r[1].dims);if(!h)throw Error("Can't use matmul on the given tensors");let b=Math.ceil(f[f.length-1]/2),m=f.length,y=d.length,_=(0,i.getGlsl)(t.session.backend.glContext.version),v=(0,a.getCoordsDataType)(h.length),x=h.length,w=(0,a.getGlChannels)(),{activationFunction:T,applyActivation:S}=(0,s.getActivationSnippet)(l),O=c?`${(0,u.getBiasForMatmul)(v,w,r[2].dims,h,!0)}`:"",A=g?`${function(t,e,r,i){let o=[],a=[],s=r[0].dims,u=r[1].dims,l=s.length,c=u.length,p=i.length,f=p-l,d=p-c;(o=s.map((t,r)=>`coords.${e[r+f]}`))[l-1]="i*2",o.join(", "),(a=u.map((t,r)=>`coords.${e[r+d]}`))[c-2]="i*2",a.join(", ");let h=n.BroadcastUtil.getBroadcastDims(s,i),g=n.BroadcastUtil.getBroadcastDims(u,i),b=h.map(t=>`coords.${e[t+f]} = 0;`).join("\n"),m=g.map(t=>`coords.${e[t+d]} = 0;`).join("\n"),y=`int lastDim = coords.${e[p-1]}; + coords.${e[p-1]} = coords.${e[p-2]}; + coords.${e[p-2]} = lastDim;`;return` +vec4 getAAtOutCoordsMatmul(int i) { + ${t} coords = getOutputCoords(); + ${y} + ${b} + vec4 outputValue = getA(${o}); + return outputValue; +} + +vec4 getBAtOutCoordsMatmul(int i) { + ${t} coords = getOutputCoords(); + ${y} + ${m} + vec4 outputValue = getB(${a}); + return outputValue; +}`}(v,w,r,h)}`:"",E=g?"getAAtOutCoordsMatmul(i)":`getA(${function(t,e){let r="";for(let n=0;n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBiasForMatmul=e.createMatmulProgramInfoLoader=e.parseMatMulAttributes=e.matMul=void 0;let n=r(2517),i=r(2039),o=r(9390),a=r(2823),s=r(708);function u(t,e){var r,s;let u=(r=t.length>2,s=e.activationCacheKey,{name:"MatMul",inputNames:r?["A","B","Bias"]:["A","B"],inputTypes:r?[i.TextureType.unpacked,i.TextureType.unpacked,i.TextureType.unpacked]:[i.TextureType.unpacked,i.TextureType.unpacked],cacheHint:s});return Object.assign(Object.assign({},u),{get:()=>(function(t,e,r){let s=e[0].dims,u=e[1].dims,l=n.BroadcastUtil.calcShape(s,u,!0);if(!l)throw Error("Can't use matmul on the given tensors");let p=(0,o.getCoordsDataType)(l.length),f=(0,o.getGlChannels)(),{activationFunction:d,applyActivation:h}=(0,a.getActivationSnippet)(r),g=e.length>2,b=g?"value += getBiasForMatmul();":"",m=g?`${c(p,f,e[2].dims,l,!1)}`:"",y=l.length,_=s.length,v=u.length,x=` + ${d} + ${m} + float process(int indices[${y}]) { + int a[${_}]; + int b[${v}]; + bcastMatmulIndices_A(indices, a); + bcastMatmulIndices_B(indices, b); + + float value; + for (int k=0; k<${s[s.length-1]}; ++k) { + a[${_-1}] = k; + b[${v-2}] = k; + value += _A(a) * _B(b); + } + ${b} + ${h} + return value; + }`;return Object.assign(Object.assign({},t),{output:{dims:l,type:e[0].type,textureType:i.TextureType.unpacked},shaderSource:x})})(u,t,e)})}e.matMul=(t,e,r)=>(l(e),t.session.pack?[t.run((0,s.createPackedMatmulProgramInfoLoader)(t,e,r),e)]:[t.run(u(e,r),e)]),e.parseMatMulAttributes=t=>(0,a.parseInternalActivationAttributes)(t.attributes),e.createMatmulProgramInfoLoader=u;let l=t=>{if(!t||2!==t.length)throw Error("MatMul requires 2 inputs.");if(t[0].dims[t[0].dims.length-1]!==t[1].dims[t[1].dims.length-2])throw Error("shared dimension does not match.");if("float32"!==t[0].type&&"float64"!==t[0].type||"float32"!==t[1].type&&"float64"!==t[1].type)throw Error("inputs should be float type");if(t[0].type!==t[1].type)throw Error("inputs types should match")};function c(t,e,r,i,o){let a="",s=r.length,u=i.length,l=u-s;a=u<2&&s>0?"coords":r.map((t,r)=>`coords.${e[r+l]}`).join(", ");let c=n.BroadcastUtil.getBroadcastDims(r,i).map(t=>`coords.${e[t+l]} = 0;`).join("\n"),p="vec4(outputValue.xx, outputValue.yy)";return 1===n.ShapeUtil.size(r)&&(p="vec4(outputValue.x)"),o?` +vec4 getBiasForMatmul() { + ${t} coords = getOutputCoords(); + ${c} + vec4 outputValue = getBias(${a}); + return ${p}; +}`:` +float getBiasForMatmul() { + ${t} coords = getOutputCoords(); + ${c} + return getBias(coords.x); +}`}e.getBiasForMatmul=c},2403:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createPackProgramInfoLoader=void 0;let n=r(5060),i=r(2039),o=r(9390),a=r(2827),s={name:"pack",inputNames:["A"],inputTypes:[i.TextureType.unpackedReversed]};e.createPackProgramInfoLoader=(t,e)=>Object.assign(Object.assign({},s),{get:()=>((t,e)=>{var r,u,l,c;let p;let f=(0,n.getGlsl)(t.session.backend.glContext.version),d=e.dims,h=d.length,g=e.dims.length,b=(0,o.getCoordsDataType)(g),m=(0,a.getChannels)("rc",g),y=(r=g,u=m,l=d[d.length-2],c=d[d.length-1],0===r||1===r?"":` + int r = ${u[r-2]}; + int c = ${u[r-1]}; + int rp1 = ${u[r-2]} + 1; + int cp1 = ${u[r-1]} + 1; + bool rEdge = rp1 >= ${c}; + bool cEdge = cp1 >= ${l}; + `);p=0===h?[1,1]:1===h?[d[0],1]:[d[g-1],d[g-2]];let _=function(t,e,r){if(0===t)return"false";if(1===t)return`rc > ${e[0]}`;let n="";for(let i=t-2;i= ${e[i-t+2]}`,i= ${t[0]} ? 0. : getA(rc + 1), + 0, 0`;let n="";if(r>2)for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unpackFromChannel=e.getChannels=e.getVecChannels=void 0;let n=r(9390);function i(t,e){return(0,n.getGlChannels)(e).map(e=>`${t}.${e}`)}e.getVecChannels=i,e.getChannels=function(t,e){return 1===e?[t]:i(t,e)},e.unpackFromChannel=function(){return"\n float getChannel(vec4 frag, int dim) {\n int modCoord = imod(dim, 2);\n return modCoord == 0 ? frag.r : frag.g;\n }\n\n float getChannel(vec4 frag, vec2 innerDims) {\n vec2 modCoord = mod(innerDims, 2.);\n return modCoord.x == 0. ?\n (modCoord.y == 0. ? frag.r : frag.g) :\n (modCoord.y == 0. ? frag.b : frag.a);\n }\n "}},2870:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parsePadAttributesV11=e.padV11=e.parsePadAttributesV2=e.padV2=void 0;let n=r(246),i=r(2517),o=r(5060),a=r(2039),s={name:"Pad",inputNames:["A"],inputTypes:[a.TextureType.unpacked]};e.padV2=(t,e,r)=>(c(e),[t.run(Object.assign(Object.assign({},s),{cacheHint:r.cacheKey,get:()=>l(t,e[0],r)}),e)]),e.parsePadAttributesV2=t=>{let e=t.attributes.getString("mode","constant"),r=t.attributes.getFloat("value",0),i=t.attributes.getInts("pads");return(0,n.createAttributeWithCacheKey)({mode:e,value:r,pads:i})},e.padV11=(t,r,n)=>{p(r);let i=u(t,r,n);return(0,e.padV2)(t,[r[0]],i)},e.parsePadAttributesV11=t=>t.attributes.getString("mode","constant");let u=(t,e,r)=>{if(!t.session.isInitializer(e[1].dataId)||e.length>=3&&!t.session.isInitializer(e[2].dataId))throw Error("dynamic pad attributes are not allowed");let i=Array.from(e[1].integerData),o=e.length>=3?e[2].floatData[0]:0;return(0,n.createAttributeWithCacheKey)({mode:r,pads:i,value:o})},l=(t,e,r)=>{let n=i.ShapeUtil.padShape(e.dims.slice(),r.pads),o=n.length,s=` + ${f(t,e,r)} + float process(int[${o}] indices) { + return padA(indices); + }`;return{name:"Pad",inputNames:["A"],inputTypes:[a.TextureType.unpacked],output:{dims:n,type:e.type,textureType:a.TextureType.unpacked},shaderSource:s}},c=t=>{if(!t||1!==t.length)throw Error("Pad requires 1 input");if("float32"!==t[0].type&&"float64"!==t[0].type)throw Error("Invalid input type.")},p=t=>{if(!t||2!==t.length&&3!==t.length)throw Error("Pad requires 2 or 3 inputs");if("int32"!==t[1].type||t.length>=3&&"string"===t[2].type)throw Error("Invalid input type.")},f=(t,e,r)=>{let n=(0,o.getGlsl)(t.session.backend.glContext.version),[s,u]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),l=i.ShapeUtil.computeStrides(e.dims);switch(r.mode){case"constant":return d(n,e.dims,l,s,u,r.pads,r.value);case"reflect":return h(n,e.dims,l,s,u,r.pads);case"edge":return g(n,e.dims,l,s,u,r.pads);default:throw Error("Invalid mode")}},d=(t,e,r,n,i,o,a)=>{let s=e.length,u="";for(let t=s-1;t>=0;--t)u+=` + k = m[${t}] - ${o[t]}; + if (k < 0) return constant; + if (k >= ${e[t]}) return constant; + offset += k * ${r[t]}; + `;return` + float padA(int m[${s}]) { + const float constant = float(${a}); + int offset = 0; + int k = 0; + ${u} + vec2 coords = offsetToCoords(offset, ${n}, ${i}); + float value = getColorAsFloat(${t.texture2D}(A, coords)); + return value; + } + `},h=(t,e,r,n,i,o)=>{let a=e.length,s="";for(let t=a-1;t>=0;--t)s+=` + k = m[${t}] - ${o[t]}; + if (k < 0) { k = -k; } + { + const int _2n_1 = ${2*(e[t]-1)}; + k = int( mod( float(k), float(_2n_1) ) ) ; + if(k >= ${e[t]}) { k = _2n_1 - k; } + } + offset += k * ${r[t]}; + `;return` + float padA(int m[${a}]) { + int offset = 0; + int k = 0; + ${s} + vec2 coords = offsetToCoords(offset, ${n}, ${i}); + float value = getColorAsFloat(${t.texture2D}(A, coords)); + return value; + } + `},g=(t,e,r,n,i,o)=>{let a=e.length,s="";for(let t=a-1;t>=0;--t)s+=` + k = m[${t}] - ${o[t]}; + if (k < 0) k = 0; + if (k >= ${e[t]}) k = ${e[t]-1}; + offset += k * ${r[t]}; + `;return` + float padA(int m[${a}]) { + int offset = 0; + int k = 0; + ${s} + vec2 coords = offsetToCoords(offset, ${n}, ${i}); + float value = getColorAsFloat(${t.texture2D}(A, coords)); + return value; + } + `}},2143:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.globalMaxPool=e.parseMaxPoolAttributes=e.maxPool=e.parseGlobalAveragePoolAttributes=e.globalAveragePool=e.parseAveragePoolAttributes=e.averagePool=void 0;let n=r(246),i=r(2517),o=r(2039);e.averagePool=(t,e,r)=>{p(e);let n={name:"AveragePool",inputNames:["X"],inputTypes:[o.TextureType.unpacked],cacheHint:r.cacheKey};return[t.run(Object.assign(Object.assign({},n),{get:()=>a(e,n,!1,r)}),e)]},e.parseAveragePoolAttributes=t=>{let e=t.attributes.getString("auto_pad","NOTSET"),r=t.attributes.getInt("ceil_mode",0),i=0!==t.attributes.getInt("count_include_pad",0),o=t.attributes.getInts("kernel_shape"),a=t.attributes.getInts("strides",[]),s=t.attributes.getInts("pads",[]);if(0!==r)throw Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,n.createAttributeWithCacheKey)({autoPad:e,ceilMode:r,countIncludePad:i,kernelShape:o,strides:a,pads:s})};let a=(t,e,r,n)=>{let[a,s]=u(t,n,r),l=i.ShapeUtil.size(a.kernelShape),c="";a.countIncludePad?c+=`value /= float(${l});`:c+=`value /= float(${l} - pad);`;let p=` + ${f(t[0].dims,a,"value += _X(x);",c,"0.0")} + `;return Object.assign(Object.assign({},e),{output:{dims:s,type:t[0].type,textureType:o.TextureType.unpacked},shaderSource:p})};e.globalAveragePool=(t,e,r)=>{p(e);let n={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[o.TextureType.unpacked],cacheHint:`${r.countIncludePad}`};return[t.run(Object.assign(Object.assign({},n),{get:()=>a(e,n,!0,r)}),e)]},e.parseGlobalAveragePoolAttributes=t=>{let e=0!==t.attributes.getInt("count_include_pad",0);return(0,n.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:e,kernelShape:[],strides:[],pads:[]})},e.maxPool=(t,e,r)=>{p(e);let n={name:"MaxPool",inputNames:["X"],inputTypes:[o.TextureType.unpacked],cacheHint:r.cacheKey};return[t.run(Object.assign(Object.assign({},n),{get:()=>s(e,n,!1,r)}),e)]},e.parseMaxPoolAttributes=t=>{let e=t.attributes.getString("auto_pad","NOTSET"),r=t.attributes.getInt("ceil_mode",0),i=t.attributes.getInts("kernel_shape"),o=t.attributes.getInts("strides",[]),a=t.attributes.getInts("pads",[]),s=t.attributes.getInt("storage_order",0),u=t.attributes.getInts("dilations",[]);if(0!==s)throw Error("column major storage order is not yet supported for MaxPool");if(0!==r)throw Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,n.createAttributeWithCacheKey)({autoPad:e,ceilMode:r,countIncludePad:!1,kernelShape:i,strides:o,pads:a,storageOrder:s,dilations:u})};let s=(t,e,r,n)=>{let[i,a]=u(t,n,r),s=` + ${f(t[0].dims,i,"\n value = max(_X(x), value);\n ","","-1e5")} + `;return Object.assign(Object.assign({},e),{output:{dims:a,type:t[0].type,textureType:o.TextureType.unpacked},shaderSource:s})},u=(t,e,r)=>{let n=t[0].dims.slice(),o=Object.hasOwnProperty.call(e,"dilations"),a=e.kernelShape.slice(),s=e.strides.slice(),u=o?e.dilations.slice():[],l=e.pads.slice();i.PoolConvUtil.adjustPoolAttributes(r,n,a,s,u,l);let c=i.PoolConvUtil.computePoolOutputShape(r,n,s,u,a,l,e.autoPad),p=Object.assign({},e);return o?Object.assign(p,{kernelShape:a,strides:s,pads:l,dilations:u,cacheKey:e.cacheKey}):Object.assign(p,{kernelShape:a,strides:s,pads:l,cacheKey:e.cacheKey}),[p,c]},l={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},c={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[o.TextureType.unpacked]};e.globalMaxPool=(t,e)=>(p(e),[t.run(Object.assign(Object.assign({},c),{get:()=>s(e,c,!0,l)}),e)]);let p=t=>{if(!t||1!==t.length)throw Error("Pool ops requires 1 input.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw Error("Invalid input type.")},f=(t,e,r,n,o)=>{let a=t.length;if(e.kernelShape.length<=2){let i=e.kernelShape[e.kernelShape.length-1],s=e.strides[e.strides.length-1],u=e.pads[e.pads.length/2-1],l=e.pads[e.pads.length-1],c=t[a-1],p="",f="",d="";if(p=u+l!==0?` + for (int i = 0; i < ${i}; i++) { + x[${a} - 1] = indices[${a} - 1] * ${s} - ${u} + i; + if (x[${a} - 1] < 0 || x[${a} - 1] >= ${c}) { + pad++; + continue; + } + ${r} + }`:` + for (int i = 0; i < ${i}; i++) { + x[${a} - 1] = indices[${a} - 1] * ${s} - ${u} + i; + ${r} + }`,2===e.kernelShape.length){let r=e.kernelShape[e.kernelShape.length-2],n=e.strides[e.strides.length-2],o=e.pads[e.pads.length/2-2],s=e.pads[e.pads.length-2],u=t[a-2];f=o+s!==0?` + for (int j = 0; j < ${r}; j++) { + x[${a} - 2] = indices[${a} - 2] * ${n} - ${o} + j; + if (x[${a} - 2] < 0 || x[${a} - 2] >= ${u}) { + pad+= ${i}; + continue; + } + `:` + for (int j = 0; j < ${r}; j++) { + x[${a} - 2] = indices[${a} - 2] * ${n} - ${o} + j; + `,d="\n }\n "}return` + float process(int indices[${a}]) { + int x[${a}]; + copyVec(indices, x); + + float value = ${o}; + int pad = 0; + ${f} + ${p} + ${d} + ${n} + return value; + } + `}{let s=i.ShapeUtil.size(e.kernelShape),u=i.ShapeUtil.computeStrides(e.kernelShape),l=u.length,c=e.pads.length,p=h(l),f=d(t,"inputDims"),g=d(e.pads,"pads"),b=d(u,"kernelStrides"),m=d(e.strides,"strides"),y="";return y=e.pads.reduce((t,e)=>t+e)?` + if (x[j] >= inputDims[j] || x[j] < 0) { + pad++; + isPad = true; + break; + } + } + if (!isPad) { + ${r} + }`:` + } + ${r} + `,` + ${p} + float process(int indices[${a}]) { + int x[${a}]; + copyVec(indices, x); + int offset[${l}]; + int pads[${c}]; + int inputDims[${a}]; + int kernelStrides[${l}]; + int strides[${l}]; + ${g} + ${f} + ${m} + ${b} + + float value = ${o}; + int pad = 0; + bool isPad = false; + for (int i = 0; i < ${s}; i++) { + offsetToIndices(i, kernelStrides, offset); + isPad = false; + for (int j = ${a} - ${l}; j < ${a}; j++) { + x[j] = indices[j] * strides[j - ${a} + ${l}] + + offset[j - ${a} + ${l}] - pads[j - 2]; + ${y} + } + ${n} + + return value; + } + `}},d=(t,e)=>{let r="";for(let n=0;n` + void offsetToIndices(int offset, int[${t}] strides, out int[${t}] indices) { + if (${t} == 0) { + return; + } + for (int i = 0; i < ${t} - 1; ++i) { + indices[i] = offset / strides[i]; + offset -= indices[i] * strides[i]; + } + indices[${t} - 1] = offset; + }`},4939:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.reduceLogSumSquare=e.reduceLogSum=e.reduceProd=e.reduceMin=e.reduceMax=e.reduceMean=e.reduceSum=e.parseReduceAttributes=void 0;let n=r(246),i=r(782),o=r(2517),a=r(2039),s=(t,e,r,n,i)=>{l(e);let o={name:n,inputNames:["A"],inputTypes:[a.TextureType.unpacked]};return[t.run(Object.assign(Object.assign({},o),{cacheHint:r.cacheKey,get:()=>u(t,e,r,n,i,o)}),e)]};e.parseReduceAttributes=t=>{let e=t.attributes.getInts("axes",[]),r=1===t.attributes.getInt("keepdims",1);return(0,n.createAttributeWithCacheKey)({axes:e,keepDims:r})};let u=(t,e,r,n,i,s)=>{let u=[],l=e[0].dims.length||1,c=[],p=o.ShapeUtil.normalizeAxes(r.axes,e[0].dims.length),f=i(e,p),d=f[1];for(let t=0;t=0||0===p.length?(r.keepDims&&u.push(1),d=` + for(int j${t} = 0; j${t} < ${e[0].dims[t]}; j${t}++) { + inputIdx[${t}] = j${t}; + ${d} + }`):(c.push(`inputIdx[${t}] = outputIdx[${u.length}];`),u.push(e[0].dims[t]));let h=` + float process(int outputIdx[${u.length||1}]) { + float value; // final result + int inputIdx[${l}]; // addressing input data + ${c.join("\n")} + ${f[0]} // init ops for reduce max/min + ${d} + ${f[2]} // final computation for reduce mean + return value; + }`;return Object.assign(Object.assign({},s),{output:{dims:u,type:e[0].type,textureType:a.TextureType.unpacked},shaderSource:h})},l=t=>{if(!t||1!==t.length)throw Error("Reduce op requires 1 input.");if(-1===i.NUMBER_TYPES.indexOf(t[0].type))throw Error("Invalid input type.")};e.reduceSum=(t,e,r)=>s(t,e,r,"ReduceSum",()=>["value = 0.0;","value += _A(inputIdx);",""]),e.reduceMean=(t,e,r)=>s(t,e,r,"ReduceMean",(t,e)=>{let r=1;for(let n=0;n=0||0===e.length)&&(r*=t[0].dims[n]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${r}.;`]}),e.reduceMax=(t,e,r)=>s(t,e,r,"ReduceMax",(t,e)=>{let r=[];for(let n=0;n=0||0===e.length)&&r.push(`inputIdx[${n}] = 0;`);return[`${r.join("\n")} +value = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]}),e.reduceMin=(t,e,r)=>s(t,e,r,"ReduceMin",(t,e)=>{let r=[];for(let n=0;n=0||0===e.length)&&r.push(`inputIdx[${n}] = 0;`);return[`${r.join("\n")} +value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),e.reduceProd=(t,e,r)=>s(t,e,r,"ReduceProd",()=>["value = 1.0;","value *= _A(inputIdx);",""]),e.reduceLogSum=(t,e,r)=>s(t,e,r,"ReduceLogSum",()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"]),e.reduceLogSumSquare=(t,e,r)=>s(t,e,r,"ReduceLogSumSquare",()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""])},7019:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isReshapeCheap=e.processDims3D=e.createPackedReshape3DProgramInfoLoader=void 0;let n=r(2517),i=r(5060),o=r(2039),a=r(2827);e.createPackedReshape3DProgramInfoLoader=(t,e,r)=>{let s;let u=(s=r,{name:"Reshape (packed)",inputTypes:[o.TextureType.packed],inputNames:["A"],cacheHint:`${s}`});return Object.assign(Object.assign({},u),{get:()=>((t,e,r,s)=>{let u=e.dims,l=s,c="";for(let t=0;t<4;t++){let e="";switch(t){case 0:e="outputCoords = rc;";break;case 1:e="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:e="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:e="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw Error()}c+=` + ${e} + ${t>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""} + int flattenedIndex = getFlattenedIndex(outputCoords); + + ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex); + vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z)); + + result[${t}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims); + + ${t>0?"}":""} + `}let p=(0,i.getGlsl)(t.session.backend.glContext.version),f=` + ${function(t){let e=n.ShapeUtil.computeStrides(t),r=["b","r","c"],i="index";return` + ivec3 inputCoordsFromReshapedOutCoords(int index) { + ${e.map((t,n)=>`int ${r[n]} = ${i} / ${t}; ${n===e.length-1?`int ${r[n+1]} = ${i} - ${r[n]} * ${t}`:`index -= ${r[n]} * ${t}`};`).join("")} + return ivec3(b, r, c); + } + `}(u)} + ${function(t){let e=n.ShapeUtil.computeStrides(t);return` + int getFlattenedIndex(ivec3 coords) { + // reverse y, z order + return coords.x * ${e[0]} + coords.z * ${e[1]} + coords.y; + } +`}(l)} + ${(0,a.unpackFromChannel)()} + + void main() { + ivec3 rc = getOutputCoords(); + + vec4 result = vec4(0.0); + + ivec3 outputCoords; + int rows = ${l[2]}; + int cols = ${l[1]}; + + ${c} + ${p.output} = result; + } + `;return Object.assign(Object.assign({},r),{output:{dims:l,type:e.type,textureType:o.TextureType.packed},shaderSource:f,hasMain:!0})})(t,e,u,r)})},e.processDims3D=function(t){if(0===t.length)return[1,1,1];let e=1;for(let r=0;r1?t[t.length-2]:1,t[t.length-1]]},e.isReshapeCheap=function(t,e){return 0===t.length||0===e.length||(t.length<2||e.length<2?t[t.length-1]===e[e.length-1]:t[t.length-1]===e[e.length-1]&&t[t.length-2]===e[e.length-2])}},718:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.reshape=void 0;let n=r(2517);e.reshape=(t,e)=>{let r=n.ShapeUtil.calculateReshapedDims(e[0].dims,e[1].integerData);return t.session.pack?[t.reshapePacked(e[0],r)]:[t.reshapeUnpacked(e[0],r)]}},2268:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseResizeAttributesV11=e.parseResizeAttributesV10=e.resize=void 0;let n=r(5060),i=r(2039),o=r(9390),a=r(2827),s=r(9793),u={name:"Resize",inputNames:["A"],inputTypes:[i.TextureType.packed]};e.resize=(t,e,r)=>((0,s.validateInputs)(e,r),[t.run(Object.assign(Object.assign({},u),{cacheHint:r.cacheKey,get:()=>l(t,e,r)}),e)]),e.parseResizeAttributesV10=t=>(0,s.parseUpsampleAttributes)(t,10),e.parseResizeAttributesV11=t=>(0,s.parseUpsampleAttributes)(t,11);let l=(t,e,r)=>{let s=(0,n.getGlsl)(t.session.backend.glContext.version),[l,p]=c(e,r);if(l.every(t=>1===t)&&"tf_crop_and_resize"!==r.coordinateTransformMode)return Object.assign(Object.assign({},u),{output:{dims:p,type:e[0].type,textureType:i.TextureType.packed},hasMain:!0,shaderSource:`void main() { + vec4 v = ${s.texture2D}(X, TexCoords); + ${s.output} = v; + }`});let f=p.length;if(f<2)throw Error(`output dimension should be at least 2, but got ${f}`);let d=p[f-2],h=p[f-1],g=e[0].dims;if(f!==g.length)throw Error(`output dimension should match input ${g.length}, but got ${f}`);let b=g[f-2],m=g[f-1],y=l[f-2],_=l[f-1],v="";if("linear"!==r.mode)throw Error(`resize (packed) does not support mode: '${r.mode}'`);switch(r.coordinateTransformMode){case"asymmetric":v="\n vec4 getSourceFracIndex(ivec4 coords) {\n return vec4(coords) / scaleWHWH;\n }\n ";break;case"half_pixel":v="\n vec4 getSourceFracIndex(ivec4 coords) {\n return (vec4(coords) + 0.5) / scaleWHWH - 0.5;\n }\n ";break;case"pytorch_half_pixel":v=` + vec4 getSourceFracIndex(ivec4 coords) { + vec4 fcoords = vec4(coords); + return vec4( + ${h}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0, + ${d}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0, + ${h}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0, + ${d}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0 + ); + } + `;break;case"align_corners":v=` + vec4 getSourceFracIndex(ivec4 coords) { + vec4 resized = vec4(${h}.0 - 1.0, ${d}.0 - 1.0, ${h}.0 - 1.0, + ${d}.0 - 1.0); + vec4 original = vec4(${m}.0 - 1.0, ${b}.0 - 1.0, ${m}.0 - 1.0, + ${b}.0 - 1.0); + vec4 new_scale = original / resized; + return vec4(coords) * new_scale; + } + `;break;default:throw Error(`resize (packed) does not support coordinateTransformMode: '${r.coordinateTransformMode}'`)}let x=(0,o.getCoordsDataType)(f),w=` + const vec2 inputWH = vec2(${b}.0, ${m}.0); + const vec4 scaleWHWH = vec4(float(${y}), float(${_}), float(${y}), float(${_})); + ${(0,a.unpackFromChannel)()} + ${v} + float getAValue(int x10, int r, int c, int d) { + return getChannel(getA(x10, r, c, d), vec2(c, d)); + } + void main() { + ${x} rc = getOutputCoords(); + + int batch = rc[0]; + int depth = rc[1]; + + // retrieve the 4 coordinates that is used in the 4 packed output values. + ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1); + + // calculate the source index in fraction + vec4 sourceFrac = getSourceFracIndex(coords); + + // get the lower and upper bound of the 4 values that will be packed into one texel. + ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy))); + ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw))); + ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy))); + ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw))); + + bool hasNextRow = rc.w < ${d-1}; + bool hasNextCol = rc.z < ${h-1}; + + // pack x00, x01, x10, x11's top-left corner into one vec4 structure + vec4 topLeft = vec4( + getAValue(batch, depth, x00.x, x00.y), + hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0); + + // pack x00, x01, x10, x11's top-right corner into one vec4 structure + vec4 topRight = vec4( + getAValue(batch, depth, x00.x, x00.w), + hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0); + + // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure + vec4 bottomLeft = vec4( + getAValue(batch, depth, x00.z, x00.y), + hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0); + + // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure + vec4 bottomRight = vec4( + getAValue(batch, depth, x00.z, x00.w), + hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0); + + // calculate the interpolation fraction on u and v direction + vec4 frac = vec4(sourceFrac) - floor(sourceFrac); + vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0)); + + vec4 top = mix(topLeft, topRight, clampFrac.ywyw); + vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw); + vec4 newValue = mix(top, bottom, clampFrac.xxzz); + + ${s.output} = vec4(newValue); + } + `;return Object.assign(Object.assign({},u),{output:{dims:p,type:e[0].type,textureType:i.TextureType.packed},hasMain:!0,shaderSource:w})},c=(t,e)=>{let r=t[0].dims,n,i=e.scales;if(0===i.length){let o=t[e.scalesInputIdx];if(o&&0!==o.size){if(t[e.sizesInputIdx])throw Error("Only one of scales or sizes must be provided as input.");i=p(o,e.mode,e.isResize)}else{let o=t[e.sizesInputIdx];if(!o||0===o.size)throw Error("Either scales or sizes MUST be provided as input.");i=f(n=Array.from(o.integerData),r,e.mode,e.isResize)}}else if(t[e.sizesInputIdx])throw Error("Only one of scales or sizes must be provided as input.");let o=n||r.map((t,e)=>Math.floor(t*i[e]));return[i,o]},p=(t,e,r)=>{let n=Array.from(t.floatData);return(0,s.scalesValidation)(n,e,r),n},f=(t,e,r,n)=>{let i=e.length,o=Array(i);for(let r=0,n=i;r{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.shape=void 0;let n=r(9162);e.shape=(t,e)=>(i(e),[new n.Tensor([e[0].dims.length],"int32",void 0,void 0,new Int32Array(e[0].dims))]);let i=t=>{if(!t||1!==t.length)throw Error("Shape requires 1 input.")}},2278:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sliceV10=e.parseSliceAttributes=e.slice=void 0;let n=r(246),i=r(782),o=r(2517),a=r(2039),s={name:"Slice",inputNames:["A"],inputTypes:[a.TextureType.unpacked]};e.slice=(t,e,r)=>(l(e),[t.run(Object.assign(Object.assign({},s),{cacheHint:r.cacheKey,get:()=>u(t,e[0],r)}),e)]),e.parseSliceAttributes=t=>{let e=t.attributes.getInts("starts"),r=t.attributes.getInts("ends"),i=t.attributes.getInts("axes",[]);return(0,n.createAttributeWithCacheKey)({starts:e,ends:r,axes:i})};let u=(t,e,r)=>{let n=0===r.axes.length?e.dims.slice(0).map((t,e)=>e):r.axes,i=o.ShapeUtil.normalizeAxes(n,e.dims.length),u=r.starts.map((t,r)=>t>e.dims[i[r]]-1?e.dims[i[r]]:o.ShapeUtil.normalizeAxis(t,e.dims[i[r]])),l=r.ends.map((t,r)=>t>e.dims[i[r]]-1?e.dims[i[r]]:o.ShapeUtil.normalizeAxis(t,e.dims[i[r]])),c=e.dims.slice(),p=[];for(let t=0;t0&&p.push(`outputIdx[${i[t]}] += ${u[t]};`);let f=` + float process(int outputIdx[${c.length}]) { + ${p.join("\n ")} + return _A(outputIdx); + }`;return Object.assign(Object.assign({},s),{output:{dims:c,type:e.type,textureType:a.TextureType.unpacked},shaderSource:f})},l=t=>{if(!t||1!==t.length)throw Error("Slice requires 1 input.");if(-1===i.NUMBER_TYPES.indexOf(t[0].type))throw Error("Invalid input type.")};e.sliceV10=(t,e)=>{p(e);let r=c(t,e);return[t.run(Object.assign(Object.assign({},s),{cacheHint:r.cacheKey,get:()=>u(t,e[0],r)}),[e[0]])]};let c=(t,e)=>{if(!t.session.isInitializer(e[1].dataId)||!t.session.isInitializer(e[2].dataId)||e.length>=4&&!t.session.isInitializer(e[3].dataId)||e.length>=5&&!t.session.isInitializer(e[4].dataId))throw Error("dynamic slice attributes are not allowed");if(e.length>=5&&e[4].integerData.some(t=>1!==t))throw Error("currently non-1 steps is not supported for Slice");let r=Array.from(e[1].integerData),n=Array.from(e[2].integerData),i=e.length>=4?Array.from(e[3].integerData):[];return{starts:r,ends:n,axes:i,cacheKey:`${i};${r};${n}`}},p=t=>{if(!t||t.length<3||t.length>5)throw Error("Invalid input number.");if("int32"!==t[1].type||1!==t[1].dims.length||"int32"!==t[2].type||1!==t[2].dims.length||t.length>=4&&("int32"!==t[3].type||1!==t[3].dims.length)||t.length>=5&&("int32"!==t[4].type||1!==t[4].dims.length))throw Error("Invalid input type.")}},5524:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.softmaxV13=e.parseSoftmaxAttributesV13=e.parseSoftmaxAttributes=e.softmax=void 0;let n=r(246),i=r(2517),o=r(5060),a=r(2039),s=r(3738),u={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[a.TextureType.unpacked]},l={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked]},c={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked,a.TextureType.unpacked]};e.softmax=(t,e,r)=>{g(e);let n=e[0].dims.slice(),o=i.ShapeUtil.normalizeAxis(r.axis,n.length);return p(t,e,r,i.ShapeUtil.sizeToDimension(n,o),i.ShapeUtil.sizeFromDimension(n,o))},e.parseSoftmaxAttributes=t=>(0,n.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis",1)}),e.parseSoftmaxAttributesV13=t=>(0,n.createAttributeWithCacheKey)({axis:t.attributes.getInt("axis",-1)}),e.softmaxV13=(t,e,r)=>{g(e);let o=e[0].dims.slice(),a=i.ShapeUtil.normalizeAxis(r.axis,o.length),u=o.length,l=a!==u-1,c=[],f,d=[],h=[];l&&((d=Array.from({length:u}).map((t,e)=>e))[a]=u-1,d[u-1]=a,d.map(t=>c.push(o[t])),f=(0,n.createAttributeWithCacheKey)({perm:d}),h=(0,s.transpose)(t,e,f));let b=l?i.ShapeUtil.sizeToDimension(c,u-1):i.ShapeUtil.sizeToDimension(o,u-1),m=l?i.ShapeUtil.sizeFromDimension(c,u-1):i.ShapeUtil.sizeFromDimension(o,u-1),y=p(t,l?h:e,r,b,m);return l?(0,s.transpose)(t,y,f):y};let p=(t,e,r,n,i)=>{let o=f(t,e[0],n,i,[n]),a=t.run(Object.assign(Object.assign({},u),{cacheHint:r.cacheKey,get:()=>o}),e),s=d(t,e[0],n,i,o.output.dims,[n]),p=t.run(Object.assign(Object.assign({},l),{cacheHint:r.cacheKey,get:()=>s}),[e[0],a]),g=h(t,e[0],n,i,o.output.dims,s.output.dims);return[t.run(Object.assign(Object.assign({},c),{cacheHint:r.cacheKey,get:()=>g}),[e[0],a,p])]},f=(t,e,r,n,i)=>{let[s,l]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),c=i.length;if(r<1||n<1)throw Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==i.length)throw Error("Dimensionality of the output should be 1");if(i[0]!==r)throw Error("Shape of the output should be equal to logical row count");let p=(0,o.getGlsl)(t.session.backend.glContext.version),f=` + float process(int[${c}] indices) { + int logical_row_start_offset = indices[0] * ${n}; + + float max = getColorAsFloat(${p.texture2D}(A, offsetToCoords(logical_row_start_offset, ${s}, + ${l} ))); + for(int i=1; i<${n}; ++i) + { + float current = getColorAsFloat(${p.texture2D}(A, offsetToCoords(logical_row_start_offset + i, + ${s}, ${l}))); + if(current > max) + max = current; + } + + return max; + }`;return Object.assign(Object.assign({},u),{output:{dims:i,type:e.type,textureType:a.TextureType.unpacked},shaderSource:f})},d=(t,e,r,n,i,s)=>{let[u,c]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),p=s.length;if(r<1||n<1)throw Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==s.length)throw Error("Dimensionality of the output should be 1");if(s[0]!==r)throw Error("Shape of the output should be equal to logical row count");if(1!==i.length)throw Error("Dimensionality of the intermediate results should be 1");if(i[0]!==r)throw Error("Shape of the intermediate results should be equal to logical row count");let f=` + float process(int[${p}] indices) { + int logical_row_start_offset = indices[0] * ${n}; + + float norm_factor = 0.0; + float max = _Max(indices); + for(int i=0; i<${n}; ++i) + { + norm_factor += exp(getColorAsFloat(${(0,o.getGlsl)(t.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i, + ${u}, ${c}))) - max); + } + + return norm_factor; + }`;return Object.assign(Object.assign({},l),{output:{dims:s,type:e.type,textureType:a.TextureType.unpacked},shaderSource:f})},h=(t,e,r,n,i,o)=>{let[s,u]=t.calculateTextureWidthAndHeight(e.dims,a.TextureType.unpacked),l=e.dims.length;if(r<1||n<1)throw Error("Logical row count N and feature count D must be greater than or equal to 1");if(1!==i.length||1!==o.length)throw Error("Dimensionality of the intermediate results should be 1");if(i[0]!==r||o[0]!==r)throw Error("Shape of the intermediate results should be equal to logical row count");let p=` + float process(int[${l}] indices) { + + // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords) + int offset = coordsToOffset(TexCoords, ${s}, ${u}); + + //determine the logical row for this index + int logical_row_index[1]; + logical_row_index[0] = offset / ${n}; + + float norm_factor = _Norm(logical_row_index); + + // avoid possible division by 0 + // if norm_facor is 0, all elements are zero + // if so, return 0 + if(norm_factor == 0.0) + return 0.0; + + return exp(_A(indices) - _Max(logical_row_index)) / norm_factor; + }`;return Object.assign(Object.assign({},c),{output:{dims:e.dims,type:e.type,textureType:a.TextureType.unpacked},shaderSource:p})},g=t=>{if(!t||1!==t.length)throw Error("Softmax requires 1 input.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw Error("Invalid input type")}},5975:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseSplitAttributes=e.split=void 0;let n=r(246),i=r(2517),o=r(2039),a={name:"Split",inputNames:["A"],inputTypes:[o.TextureType.unpacked]};e.split=(t,e,r)=>{l(e);let n=i.ShapeUtil.normalizeAxis(r.axis,e[0].dims.length),o=s(t,e,n,r),c=[];for(let i=0;iu(t,e[0],r,n,i)}),e));return c},e.parseSplitAttributes=t=>{let e=t.attributes.getInt("axis",0),r=t.attributes.getInts("split",[]),i=t.outputs.length;return(0,n.createAttributeWithCacheKey)({axis:e,split:r,numOutputs:i})};let s=(t,e,r,n)=>{let[,o]=i.SplitUtil.splitShape(e[0].dims,r,n.split,n.numOutputs);return o.length},u=(t,e,r,n,s)=>{let[u,l]=i.SplitUtil.splitShape(e.dims,n,r.split,r.numOutputs),c=l[s],p=u[s],f=` + float process(int indices[${p.length}]) { + indices[${n}] += ${c}; + return _A(indices); + } + `;return Object.assign(Object.assign({},a),{cacheHint:`${r.cacheKey}:${s}`,output:{dims:p,type:e.type,textureType:o.TextureType.unpacked},shaderSource:f})},l=t=>{if(!t||1!==t.length)throw Error("Split requires one input.");if("int8"!==t[0].type&&"uint8"!==t[0].type&&"int16"!==t[0].type&&"uint16"!==t[0].type&&"int32"!==t[0].type&&"uint32"!==t[0].type&&"float32"!==t[0].type&&"float64"!==t[0].type&&"bool"!==t[0].type)throw Error("Invalid input type.")}},3933:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseSqueezeAttributes=e.squeezeV13=e.squeeze=void 0;let n=r(2517);e.squeeze=(t,e,r)=>{i(e);let o=n.ShapeUtil.squeezeShape(e[0].dims,r);return[t.reshapeUnpacked(e[0],o)]},e.squeezeV13=(t,r)=>(o(r),(0,e.squeeze)(t,[r[0]],Array.from(r[1].integerData))),e.parseSqueezeAttributes=t=>t.attributes.getInts("axes");let i=t=>{if(!t||1!==t.length)throw Error("Squeeze requires 1 input.");if("string"===t[0].type)throw Error("invalid input tensor types.")},o=t=>{if(!t||2!==t.length)throw Error("Squeeze requires 2 inputs.");if("int32"!==t[1].type)throw Error("Invalid input type.")}},6558:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sum=void 0;let n=r(5060),i=r(2039);e.sum=(t,e)=>{a(e);let r={name:"Sum",inputNames:e.map((t,e)=>`X${e}`),inputTypes:Array(e.length).fill(i.TextureType.unpacked)};return[t.run(Object.assign(Object.assign({},r),{get:()=>o(t,e,r)}),e)]};let o=(t,e,r)=>{let o=(0,n.getGlsl)(t.session.backend.glContext.version),a=e[0].dims.slice(),s=` + void main() { + vec4 result = ${e.map((t,e)=>`${o.texture2D}(X${e},TexCoords)`).join(" + ")}; + ${o.output} = result; + } + `;return Object.assign(Object.assign({},r),{output:{dims:a,type:e[0].type,textureType:i.TextureType.unpacked},hasMain:!0,shaderSource:s})},a=t=>{if(!t||0===t.length)throw Error("Sum requires inputs.");let e=t[0].dims.length;for(let r=1;r{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tile=void 0;let n=r(782),i=r(2039);e.tile=(t,e)=>{a(e);let r={name:"Tile",inputNames:["A"],inputTypes:[i.TextureType.unpacked]};return[t.run(Object.assign(Object.assign({},r),{get:()=>o(t,e,r)}),e)]};let o=(t,e,r)=>{let n=e[0].dims.slice(),o=Array(n.length),a=[];for(let t=0;t{if(!t||2!==t.length)throw Error("Tile requires 2 input.");if(1!==t[1].dims.length)throw Error("The second input shape must 1 dimension.");if(t[1].dims[0]!==t[0].dims.length)throw Error("Invalid input shape.");if(-1===n.NUMBER_TYPES.indexOf(t[0].type))throw Error("Invalid input type.");if("int32"!==t[1].type&&"int16"!==t[1].type)throw Error("Invalid repeat type.")}},3738:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseTransposeAttributes=e.transpose=void 0;let n=r(246),i=r(2517),o=r(2039),a={name:"Transpose",inputNames:["A"],inputTypes:[o.TextureType.unpacked]};e.transpose=(t,e,r)=>(p(e),[t.run(Object.assign(Object.assign({},a),{cacheHint:r.cacheKey,get:()=>s(t,e[0],r.perm)}),e)]),e.parseTransposeAttributes=t=>(0,n.createAttributeWithCacheKey)({perm:t.attributes.getInts("perm",[])});let s=(t,e,r)=>{let n=e.dims;r=u(n,r);let i=l(n,r),s=n.length,p=` + ${c("perm",r,s)} + float process(int indices[${s}]) { + int a[${s}]; + perm(a, indices); + return _A(a); + }`;return Object.assign(Object.assign({},a),{output:{dims:i,type:e.type,textureType:o.TextureType.unpacked},shaderSource:p})},u=(t,e)=>(e&&e.length!==t.length&&(e=[...t.keys()].reverse()),e),l=(t,e)=>(e=u(t,e),i.ShapeUtil.sortBasedOnPerm(t,e)),c=(t,e,r)=>{let n=[];n.push(`void ${t}(out int a[${r}], int src[${r}]) {`);for(let t=0;t{if(!t||1!==t.length)throw Error("Transpose requires 1 input.");if("float32"!==t[0].type&&"float64"!==t[0].type)throw Error("input should be float tensor")}},8710:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encodeAsUint8=void 0;let n=r(5060),i=r(2039);e.encodeAsUint8=(t,e)=>{let r=e.shape,o=(0,n.getGlsl)(t.session.backend.glContext.version),a=` + const float FLOAT_MAX = 1.70141184e38; + const float FLOAT_MIN = 1.17549435e-38; + + bool isNaN(float val) { + return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true; + } + + highp vec4 encodeAsUint8(highp float v) { + if (isNaN(v)) { + return vec4(255, 255, 255, 255); + } + + highp float av = abs(v); + + if(av < FLOAT_MIN) { + return vec4(0.0, 0.0, 0.0, 0.0); + } else if(v > FLOAT_MAX) { + return vec4(0.0, 0.0, 128.0, 127.0) / 255.0; + } else if(v < -FLOAT_MAX) { + return vec4(0.0, 0.0, 128.0, 255.0) / 255.0; + } + + highp vec4 c = vec4(0,0,0,0); + + highp float e = floor(log2(av)); + highp float m = exp2(fract(log2(av))) - 1.0; + + c[2] = floor(128.0 * m); + m -= c[2] / 128.0; + c[1] = floor(32768.0 * m); + m -= c[1] / 32768.0; + c[0] = floor(8388608.0 * m); + + highp float ebias = e + 127.0; + c[3] = floor(ebias / 2.0); + ebias -= c[3] * 2.0; + c[2] += floor(ebias) * 128.0; + + c[3] += 128.0 * step(0.0, -v); + + return c / 255.0; + } + + void main() { + float value = ${o.texture2D}(X,TexCoords).r; + ${o.output} = encodeAsUint8(value); + }`,s={name:"Uint8Encode",inputTypes:[i.TextureType.unpacked],inputNames:["X"],output:{dims:r,type:e.tensor.type,textureType:i.TextureType.downloadUint8AsFloat},shaderSource:a,hasMain:!0};return t.executeProgram(s,[e.tensor])}},4909:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tanh=e.tan=e.sqrt=e.sin=e.sigmoid=e.relu=e.not=e.neg=e.log=e.parseLeakyReluAttributes=e.leakyRelu=e.identity=e.floor=e.exp=e.parseEluAttributes=e.elu=e.cos=e.ceil=e.clipV11=e.parseClipAttributes=e.clip=e.atan=e.asin=e.acos=e.abs=e.glslTanh=e.glslTan=e.glslSqrt=e.glslSigmoid=e.glslRelu=e.glslSin=e.glslNot=e.glslNeg=e.glslLog=e.glslLeakyRelu=e.glslIdentity=e.glslClip=e.glslFloor=e.glslExp=e.glslElu=e.glslCos=e.glslCeil=e.glslAtan=e.glslAsin=e.glslAcos=e.glslAbs=void 0;let n=r(246),i=r(2517),o=r(8520),a=r(5060),s=r(2039);function u(){return P("abs")}function l(){return P("acos")}function c(){return P("asin")}function p(){return P("atan")}function f(){return P("ceil")}function d(){return P("cos")}function h(t){let e="elu";return{body:` + const float alpha = float(${t}); + + float ${e}_(float a) { + return a >= 0.0 ? a: (exp(a) - 1.0) * alpha; + } + vec4 ${e}_(vec4 v) { + return vec4(${e}_(v.x), ${e}_(v.y), ${e}_(v.z), ${e}_(v.w)); + } + `,name:e,type:o.FunctionType.ValueBased}}function g(){return P("exp")}function b(){return P("floor")}function m(t,e){let r="clip";return{body:` + const float min = float(${t}); + const float max = float(${e}); + + float ${r}_(float a) { + return clamp(a, min, max); + } + vec4 ${r}_(vec4 v) { + return clamp(v, min, max); + } + `,name:r,type:o.FunctionType.ValueBased}}function y(){let t="indentity";return{body:` + float ${t}_(float a) { + return a; + } + vec4 ${t}_(vec4 v) { + return v; + } + `,name:t,type:o.FunctionType.ValueBased}}function _(t){let e="leakyRelu";return{body:` + const float alpha = float(${t}); + + float ${e}_(float a) { + return a < 0.0 ? a * alpha : a; + } + vec4 ${e}_(vec4 v) { + return vec4(${e}_(v.x), ${e}_(v.y), ${e}_(v.z), ${e}_(v.w)); + } + `,name:e,type:o.FunctionType.ValueBased}}function v(){return P("log")}function x(){let t="neg";return{body:` + float ${t}_(float a) { + return -a; + } + vec4 ${t}_(vec4 v) { + return -v; + } + `,name:t,type:o.FunctionType.ValueBased}}function w(){let t="not";return{body:` + float ${t}_(float a) { + return float( ! bool(a) ); + } + bool ${t}_(bool a) { + return !a; + } + vec4 ${t}_(vec4 v) { + return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w)); + } + bvec4 ${t}_(bvec4 v) { + return bvec4(!v.x, !v.y, !v.z, !v.w); + } + `,name:t,type:o.FunctionType.ValueBased}}function T(){return P("sin")}function S(){let t="relu";return{body:` + float ${t}_(float a) { + return max( a, 0.0 ); + } + vec4 ${t}_(vec4 v) { + return max( v, 0.0 ); + } + `,name:t,type:o.FunctionType.ValueBased}}function O(){let t="sigmoid";return{body:` + float ${t}_(float a) { + return 1.0 / (1.0 + exp(-a)); + } + vec4 ${t}_(vec4 v) { + return 1.0 / (1.0 + exp(-v)); + } + `,name:t,type:o.FunctionType.ValueBased}}function A(){return P("sqrt")}function E(){return P("tan")}function I(){let t="tanh";return{body:` + float ${t}_(float a) { + a = clamp(a, -10., 10.); + a = exp(2.*a); + return (a - 1.) / (a + 1.); + } + vec4 ${t}_(vec4 v) { + v = clamp(v, -10., 10.); + v = exp(2.*v); + return (v - 1.) / (v + 1.); + } + `,name:t,type:o.FunctionType.ValueBased}}function P(t){return{body:` + float ${t}_(float a) { + return ${t}(a); + } + vec4 ${t}_(vec4 v) { + return ${t}(v); + } + `,name:t,type:o.FunctionType.ValueBased}}e.glslAbs=u,e.glslAcos=l,e.glslAsin=c,e.glslAtan=p,e.glslCeil=f,e.glslCos=d,e.glslElu=h,e.glslExp=g,e.glslFloor=b,e.glslClip=m,e.glslIdentity=y,e.glslLeakyRelu=_,e.glslLog=v,e.glslNeg=x,e.glslNot=w,e.glslSin=T,e.glslRelu=S,e.glslSigmoid=O,e.glslSqrt=A,e.glslTan=E,e.glslTanh=I;let D=(t,e,r,n)=>{let i=t.session.pack?s.TextureType.packed:s.TextureType.unpacked,o={name:r.name,inputTypes:[i],inputNames:["A"],cacheHint:n};return Object.assign(Object.assign({},o),{get:()=>((t,e,r,n)=>{let i=t.session.pack?s.TextureType.packed:s.TextureType.unpacked,o=(0,a.getGlsl)(t.session.backend.glContext.version);return Object.assign(Object.assign({},e),{output:{dims:r.dims,type:r.type,textureType:i},shaderSource:` + ${n.body} + void main() { + vec4 v = ${o.texture2D}(A, TexCoords); + v = ${n.name}_(v); + ${o.output} = v; + } + `,hasMain:!0})})(t,o,e,r)})};e.abs=(t,e)=>[t.run(D(t,e[0],u()),e)],e.acos=(t,e)=>[t.run(D(t,e[0],l()),e)],e.asin=(t,e)=>[t.run(D(t,e[0],c()),e)],e.atan=(t,e)=>[t.run(D(t,e[0],p()),e)],e.clip=(t,e,r)=>[t.run(D(t,e[0],m(r.min,r.max),r.cacheKey),e)],e.parseClipAttributes=t=>(0,n.createAttributeWithCacheKey)({min:t.attributes.getFloat("min",i.MIN_CLIP),max:t.attributes.getFloat("max",i.MAX_CLIP)}),e.clipV11=(t,r)=>{let n=$(t,r);return(0,e.clip)(t,[r[0]],n)};let $=(t,e)=>{if(e.length>=3&&(!t.session.isInitializer(e[1].dataId)||!t.session.isInitializer(e[2].dataId)))throw Error("dynamic clip attributes are not allowed");let r=e.length>=3?e[1].numberData[0]:i.MIN_CLIP,o=e.length>=3?e[2].numberData[0]:i.MAX_CLIP;return(0,n.createAttributeWithCacheKey)({min:r,max:o})};e.ceil=(t,e)=>[t.run(D(t,e[0],f()),e)],e.cos=(t,e)=>[t.run(D(t,e[0],d()),e)],e.elu=(t,e,r)=>[t.run(D(t,e[0],h(r.alpha),r.cacheKey),e)],e.parseEluAttributes=t=>(0,n.createAttributeWithCacheKey)({alpha:t.attributes.getFloat("alpha",1)}),e.exp=(t,e)=>[t.run(D(t,e[0],g()),e)],e.floor=(t,e)=>[t.run(D(t,e[0],b()),e)],e.identity=(t,e)=>[t.run(D(t,e[0],y()),e)],e.leakyRelu=(t,e,r)=>[t.run(D(t,e[0],_(r.alpha),r.cacheKey),e)],e.parseLeakyReluAttributes=t=>(0,n.createAttributeWithCacheKey)({alpha:t.attributes.getFloat("alpha",.01)}),e.log=(t,e)=>[t.run(D(t,e[0],v()),e)],e.neg=(t,e)=>[t.run(D(t,e[0],x()),e)],e.not=(t,e)=>[t.run(D(t,e[0],w()),e)],e.relu=(t,e)=>[t.run(D(t,e[0],S()),e)],e.sigmoid=(t,e)=>[t.run(D(t,e[0],O()),e)],e.sin=(t,e)=>[t.run(D(t,e[0],T()),e)],e.sqrt=(t,e)=>[t.run(D(t,e[0],A()),e)],e.tan=(t,e)=>[t.run(D(t,e[0],E()),e)],e.tanh=(t,e)=>[t.run(D(t,e[0],I()),e)]},5611:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createUnpackProgramInfoLoader=e.createUnpackProgramInfo=void 0;let n=r(5060),i=r(2039),o=r(9390),a=r(2827),s={name:"unpack",inputNames:["A"],inputTypes:[i.TextureType.packed]};e.createUnpackProgramInfo=(t,e)=>{let r=e.dims.length,u=(0,a.getChannels)("rc",r),l=u.slice(-2),c=(0,o.getCoordsDataType)(r),p=(0,a.unpackFromChannel)(),f=0===e.dims.length?"":function(t,e){if(1===t)return"rc";let r="";for(let n=0;nObject.assign(Object.assign({},s),{get:()=>(0,e.createUnpackProgramInfo)(t,r)})},8428:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseUnsqueezeAttributes=e.unsqueezeV13=e.unsqueeze=void 0;let n=r(2517);e.unsqueeze=(t,e,r)=>{i(e);let o=n.ShapeUtil.unsqueezeShape(e[0].dims,r);return[t.reshapeUnpacked(e[0],o)]},e.unsqueezeV13=(t,r)=>(o(r),(0,e.unsqueeze)(t,[r[0]],Array.from(r[1].integerData))),e.parseUnsqueezeAttributes=t=>t.attributes.getInts("axes");let i=t=>{if(!t||1!==t.length)throw Error("Unsqueeze requires 1 input.");if("string"===t[0].type)throw Error("invalid input tensor types.")},o=t=>{if(!t||2!==t.length)throw Error("Unsqueeze requires 2 inputs.");if("int32"!==t[1].type)throw Error("Invalid input type.")}},9793:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.scalesValidation=e.validateInputs=e.parseUpsampleAttributes=e.parseUpsampleAttributesV9=e.parseUpsampleAttributesV7=e.upsample=void 0;let n=r(246),i=r(5060),o=r(2039),a={name:"Upsample",inputNames:["X"],inputTypes:[o.TextureType.unpacked]};e.upsample=(t,r,n)=>((0,e.validateInputs)(r,n),[t.run(Object.assign(Object.assign({},a),{cacheHint:n.cacheKey,get:()=>s(t,r,n)}),r)]),e.parseUpsampleAttributesV7=t=>(0,e.parseUpsampleAttributes)(t,7),e.parseUpsampleAttributesV9=t=>(0,e.parseUpsampleAttributes)(t,9),e.parseUpsampleAttributes=(t,r)=>{let i=r>=10,o=t.attributes.getString("mode","nearest");if("nearest"!==o&&"linear"!==o&&(r<11||"cubic"!==o))throw Error(`unrecognized mode: ${o}`);let a=[];r<9&&(a=t.attributes.getFloats("scales"),(0,e.scalesValidation)(a,o,i));let s=t.attributes.getFloat("extrapolation_value",0),u=r>10?t.attributes.getString("coordinate_transformation_mode","half_pixel"):"asymmetric";if(-1===["asymmetric","pytorch_half_pixel","tf_half_pixel_for_nn","align_corners","tf_crop_and_resize","half_pixel"].indexOf(u))throw Error(`coordinate_transform_mode '${u}' is not supported`);let l="tf_crop_and_resize"===u,c=l,p="nearest"===o&&r>=11?t.attributes.getString("nearest_mode","round_prefer_floor"):"";if(-1===["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(p))throw Error(`nearest_mode '${p}' is not supported`);let f=t.attributes.getFloat("cubic_coeff_a",-.75),d=0!==t.attributes.getInt("exclude_outside",0);if(d&&"cubic"!==o)throw Error("exclude_outside can be set to 1 only when mode is CUBIC.");let h=r<11||"nearest"===o&&"asymmetric"===u&&"floor"===p,g=0,b=0,m=0;return r>10?t.inputs.length>2?(g=1,b=2,m=3):(b=1,m=2):9===r&&(b=1),(0,n.createAttributeWithCacheKey)({opset:r,isResize:i,mode:o,scales:a,extrapolationValue:s,coordinateTransformMode:u,useExtrapolation:c,needRoiInput:l,nearestMode:p,cubicCoefficientA:f,excludeOutside:d,useNearest2xOptimization:h,roiInputIdx:g,scalesInputIdx:b,sizesInputIdx:m})};let s=(t,e,r)=>{let n=(0,i.getGlsl)(t.session.backend.glContext.version),[s,u]=t.calculateTextureWidthAndHeight(e[0].dims,o.TextureType.unpacked),l=e[0].dims.map((t,e)=>Math.floor(t*r.scales[e])),[c,p]=t.calculateTextureWidthAndHeight(l,o.TextureType.unpacked),f=l.length,d=Array(f),h=Array(f),g=` + int output_pitches[${f}]; + int input_pitches[${f}]; + `;for(let t=f-1;t>=0;t--)d[t]=t===f-1?1:d[t+1]*l[t+1],h[t]=t===f-1?1:h[t+1]*e[0].dims[t+1],g+=` + output_pitches[${t}] = ${d[t]}; + input_pitches[${t}] = ${h[t]}; + `;let b=` + float getInputFloat(int index) { + vec2 coords = offsetToCoords(index, ${s}, ${u}); + float value = getColorAsFloat(${n.texture2D}(X, coords)); + return value; + } + `,m="nearest"===r.mode?` + ${b} + float process(int indices[${f}]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${c}, ${p}); + + ${g} + + int d, m; + for (int dim = 0; dim < ${f}; ++dim) { + d = output_index / output_pitches[dim]; + m = output_index - d * output_pitches[dim]; + output_index = m; + + if (scales[dim] != 1 && d > 0) { + int d2 = d / scales[dim]; + m = d - d2 * scales[dim]; + d = d2; + } + input_index += input_pitches[dim] * d; + } + + return getInputFloat(input_index); + }`:4===f?` + ${b} + float process(int indices[4]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${c}, ${p}); + + ${g} + + int m; + int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3; + index_of_dim0 = output_index / output_pitches[0]; + m = output_index - index_of_dim0 * output_pitches[0]; + index_of_dim1 = m / output_pitches[1]; + m = m - index_of_dim1 * output_pitches[1]; + index_of_dim2 = m / output_pitches[2]; + m = m - index_of_dim2 * output_pitches[2]; + index_of_dim3 = m; + + int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset; + index_of_input_dim2 = index_of_dim2 / scales[2]; + y_offset = index_of_dim2 - index_of_input_dim2 * scales[2]; + index_of_input_dim3 = index_of_dim3 / scales[3]; + x_offset = index_of_dim3 - index_of_input_dim3 * scales[3]; + + input_index = index_of_dim0 * input_pitches[0] + + index_of_dim1 * input_pitches[1] + + index_of_input_dim2 * input_pitches[2] + + index_of_input_dim3; + + float x00 = getInputFloat(input_index); + float x10, x01, x11; + + bool end_of_dim2 = false; + if (index_of_input_dim2 == (${e[0].dims[2]} - 1)) { + // It's the end in dimension 2 + x01 = x00; + end_of_dim2 = true; + } else { + x01 = getInputFloat(input_index + input_pitches[2]); + } + + if (index_of_input_dim3 == (input_pitches[2] - 1)) { + // It's the end in dimension 3 + x10 = x00; + x11 = x01; + } + else { + x10 = getInputFloat(input_index + 1); + x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1); + } + + float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]); + float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]); + return y0 + float(x_offset) * (y1 - y0) / float(scales[3]); + }`:` + ${b} + float process(int indices[2]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${c}, ${p}); + + ${g} + + int m; + int index_of_dim0, index_of_dim1; + index_of_dim0 = output_index / output_pitches[0]; + m = output_index - index_of_dim0 * output_pitches[0]; + index_of_dim1 = m; + + int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset; + index_of_input_dim0 = index_of_dim0 / scales[0]; + y_offset = index_of_dim0 - index_of_input_dim0 * scales[0]; + index_of_input_dim1 = index_of_dim1 / scales[1]; + x_offset = index_of_dim1 - index_of_input_dim1 * scales[1]; + + input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1; + + float x00 = getInputFloat(input_index); + float x10, x01, x11; + + bool end_of_dim0 = false; + if (index_of_input_dim0 == (${e[0].dims[0]} - 1)) { + // It's the end in dimension 0 + x01 = x00; + end_of_dim0 = true; + } else { + x01 = getInputFloat(input_index + input_pitches[0]); + } + + if (index_of_input_dim1 == (input_pitches[0] - 1)) { + // It's the end in dimension 1 + x10 = x00; + x11 = x01; + } + else { + x10 = getInputFloat(input_index + 1); + x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1); + } + + float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]); + float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]); + return y0 + float(x_offset) * (y1 - y0) / float(scales[1]); + }`;return Object.assign(Object.assign({},a),{output:{dims:l,type:e[0].type,textureType:o.TextureType.unpacked},shaderSource:m,variables:[{name:"scales",type:"int",arrayLength:r.scales.length,data:r.scales.map(t=>Math.ceil(t))}]})};e.validateInputs=(t,e)=>{if(!t||e.opset<9&&1!==t.length||e.opset>=9&&e.opset<11&&2!==t.length||e.opset>=11&&t.length<2)throw Error("invalid inputs.");if(e.scales.length>0&&t[0].dims.length!==e.scales.length)throw Error("Invalid input shape.");if("string"===t[0].type)throw Error("Invalid input tensor types.")},e.scalesValidation=(t,e,r)=>{if(r){for(let e of t)if(e<=0)throw Error("Scale value should be greater than 0.")}else for(let e of t)if(e<1)throw Error("Scale value should be greater than or equal to 1.");if(!("linear"!==e&&"cubic"!==e||2===t.length||4===t.length&&1===t[0]&&1===t[1]))throw Error(`'Linear' mode and 'Cubic' mode only support 2-D inputs ('Bilinear', 'Bicubic') or 4-D inputs with the corresponding outermost 2 scale values being 1 in the ${r?"Resize":"Upsample"} opeartor.`)}},1958:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProgramManager=void 0;let n=r(1670),i=r(6231),o=r(8879),a=r(5060);e.ProgramManager=class{constructor(t,e,r){this.profiler=t,this.glContext=e,this.textureLayoutStrategy=r,this.repo=new Map,this.attributesBound=!1}getArtifact(t){return this.repo.get(t)}setArtifact(t,e){this.repo.set(t,e)}run(t,e,r){var n;this.profiler.event("op",`ProgramManager.run ${null!==(n=t.programInfo.name)&&void 0!==n?n:"unknown kernel"}`,()=>{var n;let o=this.glContext.gl,a=t.program;o.useProgram(a);try{this.bindOutput(r),this.attributesBound||this.bindAttributes(t.attribLocations),this.bindUniforms(t.uniformLocations,null!==(n=t.programInfo.variables)&&void 0!==n?n:[],e)}catch(e){throw i.Logger.error("ProgramManager",t.programInfo.shaderSource),e}this.profiler.event("backend","GlContext.draw()",()=>{this.glContext.draw()})},this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEach(t=>this.glContext.deleteProgram(t.program))}build(t,e,r){return this.profiler.event("backend","ProgramManager.build",()=>{let n=new o.GlslPreprocessor(this.glContext,t,e,r),i=n.preprocess(),a=this.compile(i);return{programInfo:t,program:a,uniformLocations:this.getUniformLocations(a,n.context.programInfo.inputNames,n.context.programInfo.variables),attribLocations:this.getAttribLocations(a)}})}compile(t){if(!this.vertexShader){i.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");let t=(0,a.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(t,this.glContext.gl.VERTEX_SHADER)}n.env.debug&&i.Logger.verbose("ProrgramManager",`FragShader: +${t} +`);let e=this.glContext.compileShader(t,this.glContext.gl.FRAGMENT_SHADER),r=this.glContext.createProgram(this.vertexShader,e);return this.glContext.deleteShader(e),r}bindOutput(t){let e=t.width,r=t.height;i.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${e}/${r}, shape=${t.shape}, type=${t.tensor.type}`),this.glContext.attachFramebuffer(t.texture,e,r)}bindAttributes(t){let e=t.position,r=t.textureCoord;this.glContext.setVertexAttributes(e,r),this.attributesBound=!0}bindUniforms(t,e,r){var n;let i=this.glContext.gl,o=0;for(let{name:a,type:s,location:u,arrayLength:l}of t){let t=null===(n=e.find(t=>t.name===a))||void 0===n?void 0:n.data;if("sampler2D"!==s&&!t)throw Error(`variable '${a}' does not have data defined in program info`);switch(s){case"sampler2D":this.bindTexture(r[o],u,o),o++;break;case"float":l?i.uniform1fv(u,t):i.uniform1f(u,t);break;case"int":l?i.uniform1iv(u,t):i.uniform1i(u,t);break;default:throw Error(`Uniform not implemented: ${s}`)}}}bindTexture(t,e,r){this.glContext.bindTextureToUniform(t.texture,r,e)}getAttribLocations(t){return{position:this.getAttribLocation(t,"position"),textureCoord:this.getAttribLocation(t,"textureCoord")}}getUniformLocations(t,e,r){let n=[];if(e)for(let r of e)n.push({name:r,type:"sampler2D",location:this.getUniformLocation(t,r)});if(r)for(let e of r)n.push(Object.assign(Object.assign({},e),{location:this.getUniformLocation(t,e.name)}));return n}getUniformLocation(t,e){let r=this.glContext.gl.getUniformLocation(t,e);if(null===r)throw Error(`Uniform ${e} not found.`);return r}getAttribLocation(t,e){return this.glContext.gl.getAttribLocation(t,e)}}},6416:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLSessionHandler=void 0;let n=r(6231),i=r(1047),o=r(8316),a=r(1640),s=r(1958),u=r(7859),l=r(5702);e.WebGLSessionHandler=class{constructor(t,e){this.backend=t,this.context=e,this.layoutStrategy=new u.PreferLogicalStrategy(t.glContext.maxTextureSize),this.programManager=new s.ProgramManager(this.context.profiler,t.glContext,this.layoutStrategy),this.textureManager=new l.TextureManager(t.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:"full"===t.textureCacheMode}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=t.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new o.WebGLInferenceHandler(this)}onGraphInitialized(t){let e=t.getValues().filter(t=>-1===t.from&&t.tensor).map(t=>t.tensor.dataId);this.initializers=new Set(e)}isInitializer(t){return!!this.initializers&&this.initializers.has(t)}addInitializer(t){this.initializers.add(t)}getTextureData(t,e){return e?this.packedTextureDataCache.get(t):this.unpackedTextureDataCache.get(t)}setTextureData(t,e,r=!1){n.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),r?this.packedTextureDataCache.set(t,e):this.unpackedTextureDataCache.set(t,e)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(t=>this.textureManager.releaseTexture(t,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(t=>this.textureManager.releaseTexture(t,!0)),this.unpackedTextureDataCache=new Map}resolve(t,e,r){let n=(0,i.resolveOperator)(t,e,a.WEBGL_OP_RESOLVE_RULES);return{impl:n.opImpl,context:n.opInit?n.opInit(t,r):t}}}},7769:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Uint8DataEncoder=e.RGBAFloatDataEncoder=e.RedFloat32DataEncoder=void 0;let n=r(6231);e.RedFloat32DataEncoder=class{constructor(t,e=1){if(1===e)this.internalFormat=t.R32F,this.format=t.RED,this.textureType=t.FLOAT,this.channelSize=e;else{if(4!==e)throw Error(`Invalid number of channels: ${e}`);this.internalFormat=t.RGBA32F,this.format=t.RGBA,this.textureType=t.FLOAT,this.channelSize=e}}encode(t,e){let r,i;return t.constructor!==Float32Array&&(n.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),i=new Float32Array(t)),e*this.channelSize>t.length?(n.Logger.warning("Encoder","Source data too small. Allocating larger array"),i=t,r=this.allocate(e*this.channelSize),i.forEach((t,e)=>r[e]=t)):r=i=t,r}allocate(t){return new Float32Array(4*t)}decode(t,e){return 1===this.channelSize?t.filter((t,e)=>e%4==0).subarray(0,e):t.subarray(0,e)}},e.RGBAFloatDataEncoder=class{constructor(t,e=1,r){if(1!==e&&4!==e)throw Error(`Invalid number of channels: ${e}`);this.internalFormat=t.RGBA,this.format=t.RGBA,this.channelSize=e,this.textureType=r||t.FLOAT}encode(t,e){let r=t;return 1===this.channelSize&&(n.Logger.verbose("Encoder","Exploding into a larger array"),r=this.allocate(e),t.forEach((t,e)=>r[4*e]=t)),r}allocate(t){return new Float32Array(4*t)}decode(t,e){return 1===this.channelSize?t.filter((t,e)=>e%4==0).subarray(0,e):t.subarray(0,e)}},e.Uint8DataEncoder=class{constructor(t,e=1){if(this.channelSize=4,1===e)this.internalFormat=t.ALPHA,this.format=t.ALPHA,this.textureType=t.UNSIGNED_BYTE,this.channelSize=e;else{if(4!==e)throw Error(`Invalid number of channels: ${e}`);this.internalFormat=t.RGBA,this.format=t.RGBA,this.textureType=t.UNSIGNED_BYTE,this.channelSize=e}}encode(t,e){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}allocate(t){return new Uint8Array(t*this.channelSize)}decode(t,e){if(t instanceof Uint8Array)return t.subarray(0,e);throw Error(`Invalid array type: ${t.constructor}`)}}},7859:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBatchDim=e.sizeToSquarishShape=e.getRowsCols=e.sizeFromShape=e.isInt=e.parseAxisParam=e.squeezeShape=e.PreferLogicalStrategy=e.AlwaysKeepOriginalSizeStrategy=void 0;let n=r(6231),i=r(2517);function o(t,e){let r=[],n=[],i=null!=e&&Array.isArray(e)&&0===e.length,o=null==e||i?null:a(e,t).sort(),s=0;for(let e=0;ee)&&1===t[e]&&(r.push(t[e]),n.push(e)),o[s]<=e&&s++}1!==t[e]&&(r.push(t[e]),n.push(e))}return{newShape:r,keptDims:n}}function a(t,e){let r=e.length;return t=null==t?e.map((t,e)=>e):[].concat(t),(0,i.assert)(t.every(t=>t>=-r&&t`All values in axis param must be in range [-${r}, ${r}) but got axis ${t}`),(0,i.assert)(t.every(s),()=>`All values in axis param must be integers but got axis ${t}`),t.map(t=>t<0?r+t:t)}function s(t){return t%1==0}function u(t){if(0===t.length)return 1;let e=t[0];for(let r=1;r=t.length?1:t.slice(e.breakAxis).reduce((t,e)=>t*e),o=e.breakAxis<=0?1:t.slice(0,e.breakAxis).reduce((t,e)=>t*e);if(!(i>r||o>r))return[i,o];n.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${t}, breakAxis:${e.breakAxis}`)}let i=t.reduce((t,e)=>t*e),o=Math.floor(Math.sqrt(i));for(;o=r||i%o!=0)throw Error(`The given dimensions are outside this GPU's boundaries: ${t}`);return[o,i/o]}},e.PreferLogicalStrategy=class{constructor(t){this.maxTextureSize=t}computeTextureWH(t,e){let r=this.computeTexture(t,e);return e&&e.isPacked&&(r[0]/=2,r[1]/=2),e&&e.reverseWH?[r[1],r[0]]:r}computeTexture(t,e){let r=e&&e.isPacked;if(0===t.length)return r?[2,2]:[1,1];let i=this.maxTextureSize;if(e&&void 0!==e.breakAxis){let r=e.breakAxis>=t.length?1:t.slice(e.breakAxis).reduce((t,e)=>t*e),o=e.breakAxis<=0?1:t.slice(0,e.breakAxis).reduce((t,e)=>t*e);if(!(r>i||o>i))return[r,o];n.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${t}, breakAxis:${e.breakAxis}`)}let a=t.slice(0);r&&(i*=2,1===(a=a.map((t,e)=>e>=a.length-2?a[e]%2==0?a[e]:a[e]+1:a[e])).length&&(a=[2,a[0]])),2!==a.length&&(a=o(a).newShape);let s=u(a);return a.length<=1&&s<=i?[1,s]:2===a.length&&a[0]<=i&&a[1]<=i?a:3===a.length&&a[0]*a[1]<=i&&a[2]<=i?[a[0]*a[1],a[2]]:3===a.length&&a[0]<=i&&a[1]*a[2]<=i?[a[0],a[1]*a[2]]:4===a.length&&a[0]*a[1]*a[2]<=i&&a[3]<=i?[a[0]*a[1]*a[2],a[3]]:4===a.length&&a[0]<=i&&a[1]*a[2]*a[3]<=i?[a[0],a[1]*a[2]*a[3]]:r?l(s/4).map(t=>2*t):l(s)}},e.squeezeShape=o,e.parseAxisParam=a,e.isInt=s,e.sizeFromShape=u,e.getRowsCols=function(t){if(0===t.length)throw Error("Cannot get rows and columns of an empty shape array.");return[t.length>1?t[t.length-2]:1,t[t.length-1]]},e.sizeToSquarishShape=l,e.getBatchDim=function(t,e=2){return u(t.slice(0,t.length-e))}},4057:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createTextureLayoutFromShape=e.calculateTextureWidthAndHeight=e.createTextureLayoutFromTextureType=void 0;let n=r(2517),i=r(2039);e.createTextureLayoutFromTextureType=(t,r,n)=>{let o=n===i.TextureType.unpacked||n===i.TextureType.unpackedReversed?1:4,a=n===i.TextureType.packed,s=n===i.TextureType.unpackedReversed||n===i.TextureType.packed,u=n===i.TextureType.packedLastDimension?r.length-1:void 0,l=n===i.TextureType.packedLastDimension?r.map((t,e)=>e===r.length-1?4*t:t):void 0;return(0,e.createTextureLayoutFromShape)(t,r,o,l,{isPacked:a,reverseWH:s,breakAxis:u})},e.calculateTextureWidthAndHeight=(t,r,n)=>{let i=(0,e.createTextureLayoutFromTextureType)(t,r,n);return[i.width,i.height]},e.createTextureLayoutFromShape=(t,e,r=1,i,o)=>{let a=!(!o||!o.isPacked),[s,u]=t.computeTextureWH(a&&i||e,o),l=e.length,c=e.slice(0);if(0===l&&(c=[1]),1===r)i=e;else if(a){if(4!==r)throw Error("a packed texture must be 4-channel");i=e,l>0&&(c[l-1]=Math.ceil(c[l-1]/2)),l>1&&(c[l-2]=Math.ceil(c[l-2]/2))}else if(!i)throw Error("Unpacked shape is needed when using channels > 1");return{width:s,height:u,channels:r,isPacked:a,shape:c,strides:n.ShapeUtil.computeStrides(c),unpackedShape:i,reversedWH:o&&o.reverseWH}}},5702:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextureManager=void 0;let n=r(6231);e.TextureManager=class{constructor(t,e,r,n){this.glContext=t,this.layoutStrategy=e,this.profiler=r,this.config=n,this.pendingRead=new Map,n.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(t,e,r,i){let o,a;let s=this.toEncoderType(t),u=this.glContext.getEncoder(s,e.channels||1,i);if(e.isPacked&&1===i)throw Error("not implemented");let l=e.width,c=e.height;if(this.config.reuseTextures){o=`${l}x${c}_${u.format}_${u.internalFormat}_${u.textureType}`,(a=this.inUseTextures.get(o))||(a=[],this.inUseTextures.set(o,a));let e=this.idleTextures.get(o);if(e&&e.length>0){let n=e.pop();return a.push(n),1===i&&this.glContext.updateTexture(n,l,c,u,this.toTextureData(t,r)),n}}n.Logger.verbose("TextureManager",`Creating new texture of size ${e.width}x${e.height}`);let p=this.glContext.allocateTexture(l,c,u,this.toTextureData(t,r));return this.config.reuseTextures&&(a.push(p),this.textureLookup.set(p,o)),p}readTexture(t,e,r){return r||(r=1),this.profiler.event("backend","TextureManager.readTexture",()=>{let n=t.shape.reduce((t,e)=>t*e)*r,i=this.glContext.readTexture(t.texture,t.width,t.height,n,this.toEncoderType(e),r);return this.toTensorData(e,i)})}async readTextureAsync(t,e,r){let n=t.tensor.dataId;if(r||(r=1),this.pendingRead.has(n)){let t=this.pendingRead.get(n);return new Promise(e=>null==t?void 0:t.push(e))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(n,[]);let i=t.shape.reduce((t,e)=>t*e)*r;await this.glContext.createAndWaitForFence();let o=this.glContext.readTexture(t.texture,t.width,t.height,i,this.toEncoderType(e),r),a=this.toTensorData(e,o),s=this.pendingRead.get(n);return this.pendingRead.delete(n),null==s||s.forEach(t=>t(a)),a})}readUint8TextureAsFloat(t){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{let e=t.shape.reduce((t,e)=>t*e),r=this.glContext.readTexture(t.texture,t.width,t.height,4*e,"byte",4);return new Float32Array(r.buffer,r.byteOffset,e)})}releaseTexture(t,e){let r;if(this.config.reuseTextures&&(r=this.textureLookup.get(t.texture))){e&&this.textureLookup.delete(r);let n=this.inUseTextures.get(r);if(n){let e=n.indexOf(t.texture);if(-1!==e){n.splice(e,1);let i=this.idleTextures.get(r);i||(i=[],this.idleTextures.set(r,i)),i.push(t.texture)}}}r&&!e||(n.Logger.verbose("TextureManager",`Deleting texture of size ${t.width}x${t.height}`),this.glContext.deleteTexture(t.texture))}toTensorData(t,e){switch(t){case"int16":return e instanceof Int16Array?e:Int16Array.from(e);case"int32":return e instanceof Int32Array?e:Int32Array.from(e);case"int8":return e instanceof Int8Array?e:Int8Array.from(e);case"uint16":return e instanceof Uint16Array?e:Uint16Array.from(e);case"uint32":return e instanceof Uint32Array?e:Uint32Array.from(e);case"uint8":case"bool":return e instanceof Uint8Array?e:Uint8Array.from(e);case"float32":return e instanceof Float32Array?e:Float32Array.from(e);case"float64":return e instanceof Float64Array?e:Float64Array.from(e);default:throw Error(`TensorData type ${t} is not supported`)}}toTextureData(t,e){if(e)return e instanceof Float32Array?e:new Float32Array(e)}toEncoderType(t){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.TextureType=void 0,(r=e.TextureType||(e.TextureType={}))[r.unpacked=0]="unpacked",r[r.unpackedReversed=1]="unpackedReversed",r[r.packed=2]="packed",r[r.downloadUint8AsFloat=3]="downloadUint8AsFloat",r[r.packedLastDimension=4]="packedLastDimension"},9390:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getGlChannels=e.getCoordsDataType=e.getSqueezedParams=e.squeezeInputShape=e.generateShaderFuncNameFromInputSamplerNameAtOutCoords=e.generateShaderFuncNameFromInputSamplerName=e.repeatedTry=e.getPackedShape=void 0;let n=r(2517);e.getPackedShape=function(t){let e=t.length;return t.slice(0,e-1).concat(t[e-1]/4)},e.repeatedTry=async function(t,e=t=>0,r){return new Promise((n,i)=>{let o=0,a=()=>{if(t())return void n();let s=e(++o);null!=r&&o>=r?i():setTimeout(a,s)};a()})},e.generateShaderFuncNameFromInputSamplerName=function(t){return(0,n.assert)(void 0!==t&&0!==t.length,()=>"empty string found for sampler name"),"get"+t.charAt(0).toUpperCase()+t.slice(1)},e.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(t){return(0,n.assert)(void 0!==t&&0!==t.length,()=>"empty string found for sampler name"),"get"+t.charAt(0).toUpperCase()+t.slice(1)+"AtOutCoords"},e.squeezeInputShape=function(t,e){return JSON.parse(JSON.stringify(t)),e},e.getSqueezedParams=function(t,e){return e.map(e=>t[e]).join(", ")},e.getCoordsDataType=function(t){if(t<=1)return"int";if(2===t)return"ivec2";if(3===t)return"ivec3";if(4===t)return"ivec4";if(5===t)return"ivec5";if(6===t)return"ivec6";throw Error(`GPU for rank ${t} is not yet supported`)},e.getGlChannels=function(t=6){return["x","y","z","w","u","v"].slice(0,t)}},7305:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createNewWebGLContext=e.createWebGLContext=void 0;let n=r(6231),i=r(1713),o={};function a(t){let e;let r=function(){if("undefined"==typeof document){if("undefined"==typeof OffscreenCanvas)throw TypeError("failed to create canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}let t=document.createElement("canvas");return t.width=1,t.height=1,t}(),o={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!t||"webgl2"===t)&&(e=r.getContext("webgl2",o)))try{return new i.WebGLContext(e,2)}catch(t){n.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${t}`)}if((!t||"webgl"===t)&&(e=r.getContext("webgl",o)||r.getContext("experimental-webgl",o)))try{return new i.WebGLContext(e,1)}catch(t){n.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${t}`)}throw Error("WebGL is not supported")}e.createWebGLContext=function t(e){let r;(!e||"webgl2"===e)&&"webgl2"in o?r=o.webgl2:(!e||"webgl"===e)&&"webgl"in o&&(r=o.webgl),r=r||a(e),e=e||1===r.version?"webgl":"webgl2";let n=r.gl;return o[e]=r,n.isContextLost()?(delete o[e],t(e)):(n.disable(n.DEPTH_TEST),n.disable(n.STENCIL_TEST),n.disable(n.BLEND),n.disable(n.DITHER),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SAMPLE_COVERAGE),n.enable(n.SCISSOR_TEST),n.enable(n.CULL_FACE),n.cullFace(n.BACK),r)},e.createNewWebGLContext=a},1713:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLContext=e.linearSearchLastTrue=void 0;let a=r(1670),s=o(r(7769)),u=r(9390);function l(t){let e=0;for(;ethis.isTimerResultAvailable(t)),this.getTimerResult(t)}async createAndWaitForFence(){let t=this.createFence(this.gl);return this.pollFence(t)}createFence(t){let e;let r=t,n=r.fenceSync(r.SYNC_GPU_COMMANDS_COMPLETE,0);return t.flush(),e=null===n?()=>!0:()=>{let t=r.clientWaitSync(n,0,0);return t===r.ALREADY_SIGNALED||t===r.CONDITION_SATISFIED},{query:n,isFencePassed:e}}async pollFence(t){return new Promise(e=>{this.addItemToPoll(()=>t.isFencePassed(),()=>e())})}pollItems(){let t=l(this.itemsToPoll.map(t=>t.isDoneFn));for(let e=0;e<=t;++e){let{resolveFn:t}=this.itemsToPoll[e];t()}this.itemsToPoll=this.itemsToPoll.slice(t+1)}async addItemToPoll(t,e){this.itemsToPoll.push({isDoneFn:t,resolveFn:e}),this.itemsToPoll.length>1||await (0,u.repeatedTry)(()=>(this.pollItems(),0===this.itemsToPoll.length))}}},1036:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ExecutionPlan=void 0;let n=r(6231);class i{constructor(t,e){this.op=t,this.node=e}}e.ExecutionPlan=class{constructor(t,e,r){this.graph=t,this.profiler=r,this.initialize(e)}initialize(t){this.profiler.event("session","ExecutionPlan.initialize",()=>{let e=this.graph.getNodes();if(e.length!==t.length)throw Error("The size of nodes and OPs do not match.");this._ops=t.map((t,r)=>new i(t,e[r])),this.reset(),this._starter=[],this._ops.forEach((t,e)=>{let r=!0;for(let e of t.node.inputs)if(!this._values[e]&&-1===this.graph.getInputIndices().indexOf(e)){r=!1;break}r&&this._starter.push(e)})})}reset(){this._values=this.graph.getValues().map(t=>t.tensor)}async execute(t,e){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();let r=t.createInferenceHandler(),i=this.graph.getInputIndices();if(e.length!==i.length)throw Error(`number of input tensors don't match the number of inputs to the model: actual: ${e.length} expected: ${i.length}`);e.forEach((t,e)=>{let r=i[e];this._values[r]=t});let o=this._starter.slice(0),a=this.graph.getValues(),s=this.graph.getNodes(),u=0;for(;uthis._values[t]);if(-1!==i.indexOf(void 0))throw Error(`unresolved input detected: op: ${e.node}`);let l=i;n.Logger.verbose("ExecPlan",`Runing op:${e.node.name} (${l.map((t,r)=>`'${e.node.inputs[r]}': ${t.type}[${t.dims.join(",")}]`).join(", ")})`);let c=await this.profiler.event("node",e.node.name,async()=>e.op.impl(r,l,e.op.context));if(c.length!==e.node.outputs.length)throw Error("the size of output does not match model definition.");c.forEach((t,r)=>{let n=e.node.outputs[r];if(this._values[n])throw Error(`output [${n}] already has value: op:${e.node.name}`);this._values[n]=t});let p=new Set;c.forEach((t,r)=>{for(let t of a[e.node.outputs[r]].to){let e=s[t],r=!0;for(let t of e.inputs)if(!this._values[t]){r=!1;break}r&&p.add(t)}}),o.push(...p)}let l=[];for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Graph=void 0;let n=r(1446),i=r(7778),o=r(9395),a=r(9162),s=r(2517);var u=o.onnxruntime.experimental.fbs;e.Graph={from:(t,e)=>new p(t,e)};class l{constructor(t){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,t&&(this.type=s.ProtoUtil.tensorValueTypeFromProto(t.type.tensorType))}get from(){return this._from}get to(){return this._to}}class c{constructor(t,e){t instanceof n.onnx.NodeProto?(this.name=t.name,this.opType=t.opType,this.attributes=new i.Attribute(t.attribute)):t instanceof u.Node&&(this.name=null!=e?e:t.name(),this.opType=t.opType(),this.attributes=new i.Attribute(s.ProtoUtil.tensorAttributesFromORTFormat(t))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class p{constructor(t,e){if(!t)throw TypeError("graph is empty");this.buildGraph(t),this.transformGraph(e),this.checkIsAcyclic()}getInputIndices(){return this._allInputIndices}getInputNames(){return this._allInputNames}getOutputIndices(){return this._allOutputIndices}getOutputNames(){return this._allOutputNames}getValues(){return this._allData}getNodes(){return this._nodes}buildGraph(t){if(t instanceof n.onnx.GraphProto)this.buildGraphFromOnnxFormat(t);else{if(!(t instanceof u.Graph))throw TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(t)}}buildGraphFromOnnxFormat(t){let e=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];let r=new Map;if(!t.input)throw Error("missing information in graph: input");let n=[];for(let r of t.input){if(e.has(r.name))throw Error(`duplicated input name: ${r.name}`);let t=this._allData.push(new l(r))-1;e.set(r.name,t),n.push(r.name)}if(!t.initializer)throw Error("missing information in graph: initializer");for(let r of t.initializer){let t=e.get(r.name);if(void 0===t){let n=new l;n.type={shape:{dims:s.ProtoUtil.tensorDimsFromProto(r.dims)},tensorType:s.ProtoUtil.tensorDataTypeFromProto(r.dataType)},t=this._allData.push(n)-1,e.set(r.name,t)}this._allData[t]._from=-1,this._allData[t].tensor=a.Tensor.fromProto(r)}for(let t=0;t{this._allData[e]._to.forEach(e=>{t.add(e)})});let e=Array.from(t),r=Array(this._nodes.length).fill("white");for(;e.length>0;){let t=e.pop();"gray"===r[t]?r[t]="black":(e.push(t),r[t]="gray",this._nodes[t].outputs.forEach(n=>{let i=this._allData[n];if(void 0!==i.tensor)throw Error("node outputs should not be initialized");if(i._from!==t)throw Error("from property of the Value object doesn't match index of Node being processed");i._to.forEach(t=>{if("gray"===r[t])throw Error("model graph is cyclic");"white"===r[t]&&e.push(t)})}))}}transformGraph(t){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),t&&t.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let t=0;for(let e=0;e0&&(this._nodes[e].inputs.forEach(r=>{let n=this._allData[r]._to.indexOf(e+t);-1!==n&&(this._allData[r]._to[n]=e)}),this._nodes[e].outputs.forEach(r=>{this._allData[r]._from&&this._allData[r]._from===e+t&&(this._allData[r]._from=e)})):(t++,this._nodes[e].outputs.forEach(t=>{this._allData[t]._from=-2}),this._nodes.splice(e,1),e--);t=0;for(let e=0;e0){let r=-1;void 0!==this._allData[e].from&&-1!==this._allData[e].from?-1!==(r=this._nodes[this._allData[e].from].outputs.indexOf(e+t))&&(this._nodes[this._allData[e].from].outputs[r]=e):-1!==(r=this._allInputIndices.indexOf(e+t))&&(this._allInputIndices[r]=e),this._allData[e].to.forEach(n=>{-1!==(r=this._nodes[n].inputs.indexOf(e+t))&&(this._nodes[n].inputs[r]=e)}),0===this._allData[e].to.length&&-1!==(r=this._allOutputIndices.indexOf(e+t))&&(this._allOutputIndices[r]=e)}}else t++,this._allData.splice(e,1),e--}deleteNode(t){let e=this._nodes[t];if(e.outputs.length>1){for(let t=1;t0)throw Error("Node deletion with more than one output connected to other nodes is not supported. ")}e.executeNode=!1;let r=e.inputs[0],n=e.outputs[0],i=this._allData[n].to,o=this._allData[r].to.indexOf(t);if(-1===o)throw Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[r].to.splice(o,1),this._allData[n]._to=[];let a=this._allOutputIndices.indexOf(n);if(-1!==a&&(this._allOutputIndices[a]=r),i&&i.length>0)for(let t of i){let e=this._nodes[t].inputs.indexOf(n);if(-1===e)throw Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[t].inputs[e]=r,this._allData[r].to.push(t)}}removeAllDropoutNodes(){let t=0;for(let e of this._nodes){if("Dropout"===e.opType){if(1!==e.inputs.length)throw Error("Dropout nodes should only contain one input. ");if(1!==e.outputs.length&&2!==e.outputs.length)throw Error("Dropout nodes should contain either 1 or 2 output(s)");if(2===e.outputs.length&&0!==this._allData[e.outputs[1]]._to.length)throw Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(t)}t++}}removeAllIdentityNodes(){let t=0;for(let e of this._nodes)"Identity"===e.opType&&this.deleteNode(t),t++}isActivation(t){switch(t.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(let t of this._nodes)if("Conv"===t.opType){let e=this._allData[t.outputs[0]]._to;if(1===e.length&&this.isActivation(this._nodes[e[0]])){let r=this._nodes[e[0]];if("Clip"===r.opType){if(1===r.inputs.length)try{t.attributes.set("activation_params","floats",[r.attributes.getFloat("min"),r.attributes.getFloat("max")])}catch(e){t.attributes.set("activation_params","floats",[s.MIN_CLIP,s.MAX_CLIP])}else{if(!(r.inputs.length>=3&&void 0!==this._allData[r.inputs[1]].tensor&&void 0!==this._allData[r.inputs[2]].tensor))continue;t.attributes.set("activation_params","floats",[this._allData[r.inputs[1]].tensor.floatData[0],this._allData[r.inputs[2]].tensor.floatData[0]])}}t.attributes.set("activation","string",r.opType),this.deleteNode(e[0])}}}}},6231:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.now=e.Profiler=e.Logger=void 0;let r={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},n={none:new class{log(t,e,r){}},console:new class{log(t,e,r){console.log(`${this.color(t)} ${r?"\x1b[35m"+r+"\x1b[0m ":""}${e}`)}color(t){switch(t){case"verbose":return"\x1b[34;40mv\x1b[0m";case"info":return"\x1b[32mi\x1b[0m";case"warning":return"\x1b[30;43mw\x1b[0m";case"error":return"\x1b[31;40me\x1b[0m";case"fatal":return"\x1b[101mf\x1b[0m";default:throw Error(`unsupported severity: ${t}`)}}}},i={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1},o={"":i};function a(t,e,r,n){var i;if(void 0===e)return i=t,{verbose:a.verbose.bind(null,i),info:a.info.bind(null,i),warning:a.warning.bind(null,i),error:a.error.bind(null,i),fatal:a.fatal.bind(null,i)};if(void 0===r)s(t,e);else if("number"==typeof r&&void 0===n)s(t,e);else if("string"==typeof r&&void 0===n)s(t,r,0,e);else{if("string"!=typeof r||"number"!=typeof n)throw TypeError("input is valid");s(t,r,0,e)}}function s(t,e,i,a){let s=o[a||""]||o[""];r[t]{a.then(async e=>{i&&await i.end(),t(e)},async t=>{i&&await i.end(),e(t)})});if(!o&&i){let t=i.end();if(t&&"function"==typeof t.then)return new Promise((e,r)=>{t.then(()=>{e(a)},t=>{r(t)})})}return a}begin(t,r,n){if(!this._started)throw Error("profiler is not started yet");if(void 0===n){let n=(0,e.now)();return this.flush(n),new u(t,r,n,t=>this.endSync(t))}return new u(t,r,0,async t=>this.end(t),n.beginTimer(),n)}async end(t){let e=await t.checkTimer();this._timingEvents.length=this._flushBatchSize||t-this._flushTime>=this._flushIntervalInMilliseconds){for(let t=this._flushPointer;this._flushPointerperformance.now():Date.now},2644:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Model=void 0;let n=r(5686),i=r(1446),o=r(7070),a=r(9395),s=r(2517);var u=a.onnxruntime.experimental.fbs;e.Model=class{constructor(){}load(t,e,r){if(!r)try{return void this.loadFromOnnxFormat(t,e)}catch(t){if(void 0!==r)throw t}this.loadFromOrtFormat(t,e)}loadFromOnnxFormat(t,e){let r=i.onnx.ModelProto.decode(t);if(3>s.LongUtil.longToNumber(r.irVersion))throw Error("only support ONNX model with IR_VERSION>=3");this._opsets=r.opsetImport.map(t=>({domain:t.domain,version:s.LongUtil.longToNumber(t.version)})),this._graph=o.Graph.from(r.graph,e)}loadFromOrtFormat(t,e){let r=new n.flatbuffers.ByteBuffer(t),i=u.InferenceSession.getRootAsInferenceSession(r).model();if(3>s.LongUtil.longToNumber(i.irVersion()))throw Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FLOAT_TYPES=e.INT_TYPES=e.NUMBER_TYPES=void 0,e.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],e.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],e.FLOAT_TYPES=["float32","float64"]},1047:(t,e)=>{"use strict";function r(t,e){if(e.endsWith("+")){let r=Number.parseInt(e.substring(0,e.length-1),10);return!isNaN(r)&&r<=t}if(2===e.split("-").length){let r=e.split("-"),n=Number.parseInt(r[0],10),i=Number.parseInt(r[1],10);return!isNaN(n)&&!isNaN(i)&&n<=t&&t<=i}return Number.parseInt(e,10)===t}Object.defineProperty(e,"__esModule",{value:!0}),e.resolveOperator=void 0,e.resolveOperator=function(t,e,n){for(let i of n){let n=i[0],o=i[1],a=i[2],s=i[3],u=i[4];if(t.opType===n){for(let t of e)if((t.domain===o||"ai.onnx"===t.domain&&""===o)&&r(t.version,a))return{opImpl:s,opInit:u}}}throw TypeError(`cannot resolve operator '${t.opType}' with opsets: ${e.map(t=>`${t.domain||"ai.onnx"} v${t.version}`).join(", ")}`)}},9395:(t,e,r)=>{"use strict";var n,i;Object.defineProperty(e,"__esModule",{value:!0}),e.onnxruntime=void 0;let o=r(5686);(function(t){let e;!function(t){t[t.UNDEFINED=0]="UNDEFINED",t[t.FLOAT=1]="FLOAT",t[t.INT=2]="INT",t[t.STRING=3]="STRING",t[t.TENSOR=4]="TENSOR",t[t.GRAPH=5]="GRAPH",t[t.FLOATS=6]="FLOATS",t[t.INTS=7]="INTS",t[t.STRINGS=8]="STRINGS",t[t.TENSORS=9]="TENSORS",t[t.GRAPHS=10]="GRAPHS",t[t.SPARSE_TENSOR=11]="SPARSE_TENSOR",t[t.SPARSE_TENSORS=12]="SPARSE_TENSORS"}(e=t.AttributeType||(t.AttributeType={}))})((i=(n=e.onnxruntime||(e.onnxruntime={})).experimental||(n.experimental={})).fbs||(i.fbs={})),function(t){!function(t){!function(t){let e;!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.VALUE=1]="VALUE",t[t.PARAM=2]="PARAM"}(e=t.DimensionValueType||(t.DimensionValueType={}))}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){let e;!function(t){t[t.UNDEFINED=0]="UNDEFINED",t[t.FLOAT=1]="FLOAT",t[t.UINT8=2]="UINT8",t[t.INT8=3]="INT8",t[t.UINT16=4]="UINT16",t[t.INT16=5]="INT16",t[t.INT32=6]="INT32",t[t.INT64=7]="INT64",t[t.STRING=8]="STRING",t[t.BOOL=9]="BOOL",t[t.FLOAT16=10]="FLOAT16",t[t.DOUBLE=11]="DOUBLE",t[t.UINT32=12]="UINT32",t[t.UINT64=13]="UINT64",t[t.COMPLEX64=14]="COMPLEX64",t[t.COMPLEX128=15]="COMPLEX128",t[t.BFLOAT16=16]="BFLOAT16"}(e=t.TensorDataType||(t.TensorDataType={}))}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){let e;!function(t){t[t.Primitive=0]="Primitive",t[t.Fused=1]="Fused"}(e=t.NodeType||(t.NodeType={}))}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){let e;!function(t){t[t.NONE=0]="NONE",t[t.tensor_type=1]="tensor_type",t[t.sequence_type=2]="sequence_type",t[t.map_type=3]="map_type"}(e=t.TypeInfoValue||(t.TypeInfoValue={}))}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsShape(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsShape(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}dim(e,r){let n=this.bb.__offset(this.bb_pos,4);return n?(r||new t.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}dimLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}static startShape(t){t.startObject(1)}static addDim(t,e){t.addFieldOffset(0,e,0)}static createDimVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startDimVector(t,e){t.startVector(4,e,4)}static endShape(t){return t.endObject()}static createShape(t,e){return r.startShape(t),r.addDim(t,e),r.endShape(t)}}e.Shape=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDimension(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDimension(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}value(e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new t.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}denotation(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startDimension(t){t.startObject(2)}static addValue(t,e){t.addFieldOffset(0,e,0)}static addDenotation(t,e){t.addFieldOffset(1,e,0)}static endDimension(t){return t.endObject()}static createDimension(t,e,n){return r.startDimension(t),r.addValue(t,e),r.addDenotation(t,n),r.endDimension(t)}}e.Dimension=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDimensionValue(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDimensionValue(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}dimType(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):t.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}dimParam(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}static startDimensionValue(t){t.startObject(3)}static addDimType(e,r){e.addFieldInt8(0,r,t.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(t,e){t.addFieldInt64(1,e,t.createLong(0,0))}static addDimParam(t,e){t.addFieldOffset(2,e,0)}static endDimensionValue(t){return t.endObject()}static createDimensionValue(t,e,n,i){return r.startDimensionValue(t),r.addDimType(t,e),r.addDimValue(t,n),r.addDimParam(t,i),r.endDimensionValue(t)}}e.DimensionValue=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTensorTypeAndShape(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTensorTypeAndShape(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}elemType(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.TensorDataType.UNDEFINED}shape(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startTensorTypeAndShape(t){t.startObject(2)}static addElemType(e,r){e.addFieldInt32(0,r,t.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(t,e){t.addFieldOffset(1,e,0)}static endTensorTypeAndShape(t){return t.endObject()}static createTensorTypeAndShape(t,e,n){return r.startTensorTypeAndShape(t),r.addElemType(t,e),r.addShape(t,n),r.endTensorTypeAndShape(t)}}e.TensorTypeAndShape=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMapType(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMapType(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}keyType(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.TensorDataType.UNDEFINED}valueType(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startMapType(t){t.startObject(2)}static addKeyType(e,r){e.addFieldInt32(0,r,t.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(t,e){t.addFieldOffset(1,e,0)}static endMapType(t){return t.endObject()}static createMapType(t,e,n){return r.startMapType(t),r.addKeyType(t,e),r.addValueType(t,n),r.endMapType(t)}}e.MapType=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSequenceType(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSequenceType(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}elemType(e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startSequenceType(t){t.startObject(1)}static addElemType(t,e){t.addFieldOffset(0,e,0)}static endSequenceType(t){return t.endObject()}static createSequenceType(t,e){return r.startSequenceType(t),r.addElemType(t,e),r.endSequenceType(t)}}e.SequenceType=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){(t.fbs||(t.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}nodeIndex(){return this.bb.readUint32(this.bb_pos)}srcArgIndex(){return this.bb.readInt32(this.bb_pos+4)}dstArgIndex(){return this.bb.readInt32(this.bb_pos+8)}static createEdgeEnd(t,e,r,n){return t.prep(4,12),t.writeInt32(n),t.writeInt32(r),t.writeInt32(e),t.offset()}}}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNodeEdge(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNodeEdge(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}nodeIndex(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readUint32(this.bb_pos+t):0}inputEdges(e,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new t.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+n)+12*e,this.bb):null}inputEdgesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}outputEdges(e,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new t.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+n)+12*e,this.bb):null}outputEdgesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startNodeEdge(t){t.startObject(3)}static addNodeIndex(t,e){t.addFieldInt32(0,e,0)}static addInputEdges(t,e){t.addFieldOffset(1,e,0)}static startInputEdgesVector(t,e){t.startVector(12,e,4)}static addOutputEdges(t,e){t.addFieldOffset(2,e,0)}static startOutputEdgesVector(t,e){t.startVector(12,e,4)}static endNodeEdge(t){return t.endObject()}static createNodeEdge(t,e,n,i){return r.startNodeEdge(t),r.addNodeIndex(t,e),r.addInputEdges(t,n),r.addOutputEdges(t,i),r.endNodeEdge(t)}}e.NodeEdge=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNode(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNode(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}domain(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}sinceVersion(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0}index(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readUint32(this.bb_pos+t):0}opType(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}type(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.NodeType.Primitive}executionProviderType(t){let e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null}inputs(t,e){let r=this.bb.__offset(this.bb_pos,20);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}inputsLength(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0}outputs(t,e){let r=this.bb.__offset(this.bb_pos,22);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}outputsLength(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0}attributes(e,r){let n=this.bb.__offset(this.bb_pos,24);return n?(r||new t.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}attributesLength(){let t=this.bb.__offset(this.bb_pos,24);return t?this.bb.__vector_len(this.bb_pos+t):0}inputArgCounts(t){let e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+4*t):0}inputArgCountsLength(){let t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0}inputArgCountsArray(){let t=this.bb.__offset(this.bb_pos,26);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}implicitInputs(t,e){let r=this.bb.__offset(this.bb_pos,28);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}implicitInputsLength(){let t=this.bb.__offset(this.bb_pos,28);return t?this.bb.__vector_len(this.bb_pos+t):0}static startNode(t){t.startObject(13)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addDomain(t,e){t.addFieldOffset(2,e,0)}static addSinceVersion(t,e){t.addFieldInt32(3,e,0)}static addIndex(t,e){t.addFieldInt32(4,e,0)}static addOpType(t,e){t.addFieldOffset(5,e,0)}static addType(e,r){e.addFieldInt32(6,r,t.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(t,e){t.addFieldOffset(7,e,0)}static addInputs(t,e){t.addFieldOffset(8,e,0)}static createInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInputsVector(t,e){t.startVector(4,e,4)}static addOutputs(t,e){t.addFieldOffset(9,e,0)}static createOutputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOutputsVector(t,e){t.startVector(4,e,4)}static addAttributes(t,e){t.addFieldOffset(10,e,0)}static createAttributesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startAttributesVector(t,e){t.startVector(4,e,4)}static addInputArgCounts(t,e){t.addFieldOffset(11,e,0)}static createInputArgCountsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startInputArgCountsVector(t,e){t.startVector(4,e,4)}static addImplicitInputs(t,e){t.addFieldOffset(12,e,0)}static createImplicitInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startImplicitInputsVector(t,e){t.startVector(4,e,4)}static endNode(t){return t.endObject()}static createNode(t,e,n,i,o,a,s,u,l,c,p,f,d,h){return r.startNode(t),r.addName(t,e),r.addDocString(t,n),r.addDomain(t,i),r.addSinceVersion(t,o),r.addIndex(t,a),r.addOpType(t,s),r.addType(t,u),r.addExecutionProviderType(t,l),r.addInputs(t,c),r.addOutputs(t,p),r.addAttributes(t,f),r.addInputArgCounts(t,d),r.addImplicitInputs(t,h),r.endNode(t)}}e.Node=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsValueInfo(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsValueInfo(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}type(e){let r=this.bb.__offset(this.bb_pos,8);return r?(e||new t.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startValueInfo(t){t.startObject(3)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addType(t,e){t.addFieldOffset(2,e,0)}static endValueInfo(t){return t.endObject()}static createValueInfo(t,e,n,i){return r.startValueInfo(t),r.addName(t,e),r.addDocString(t,n),r.addType(t,i),r.endValueInfo(t)}}e.ValueInfo=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTypeInfo(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTypeInfo(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}denotation(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}valueType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):t.experimental.fbs.TypeInfoValue.NONE}value(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}static startTypeInfo(t){t.startObject(3)}static addDenotation(t,e){t.addFieldOffset(0,e,0)}static addValueType(e,r){e.addFieldInt8(1,r,t.experimental.fbs.TypeInfoValue.NONE)}static addValue(t,e){t.addFieldOffset(2,e,0)}static endTypeInfo(t){return t.endObject()}static createTypeInfo(t,e,n,i){return r.startTypeInfo(t),r.addDenotation(t,e),r.addValueType(t,n),r.addValue(t,i),r.endTypeInfo(t)}}e.TypeInfo=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsOperatorSetId(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsOperatorSetId(t,r){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}domain(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}version(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}static startOperatorSetId(t){t.startObject(2)}static addDomain(t,e){t.addFieldOffset(0,e,0)}static addVersion(t,e){t.addFieldInt64(1,e,t.createLong(0,0))}static endOperatorSetId(t){return t.endObject()}static createOperatorSetId(t,r,n){return e.startOperatorSetId(t),e.addDomain(t,r),e.addVersion(t,n),e.endOperatorSetId(t)}}t.OperatorSetId=e}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTensor(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTensor(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}dims(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}dimsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}dataType(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.TensorDataType.UNDEFINED}rawData(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}rawDataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}rawDataArray(){let t=this.bb.__offset(this.bb_pos,12);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}stringData(t,e){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}stringDataLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}static startTensor(t){t.startObject(6)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addDims(t,e){t.addFieldOffset(2,e,0)}static createDimsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startDimsVector(t,e){t.startVector(8,e,8)}static addDataType(e,r){e.addFieldInt32(3,r,t.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(t,e){t.addFieldOffset(4,e,0)}static createRawDataVector(t,e){t.startVector(1,e.length,1);for(let r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()}static startRawDataVector(t,e){t.startVector(1,e,1)}static addStringData(t,e){t.addFieldOffset(5,e,0)}static createStringDataVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startStringDataVector(t,e){t.startVector(4,e,4)}static endTensor(t){return t.endObject()}static createTensor(t,e,n,i,o,a,s){return r.startTensor(t),r.addName(t,e),r.addDocString(t,n),r.addDims(t,i),r.addDataType(t,o),r.addRawData(t,a),r.addStringData(t,s),r.endTensor(t)}}e.Tensor=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSparseTensor(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSparseTensor(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}values(e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}indices(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dims(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}dimsLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSparseTensor(t){t.startObject(3)}static addValues(t,e){t.addFieldOffset(0,e,0)}static addIndices(t,e){t.addFieldOffset(1,e,0)}static addDims(t,e){t.addFieldOffset(2,e,0)}static createDimsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startDimsVector(t,e){t.startVector(8,e,8)}static endSparseTensor(t){return t.endObject()}static createSparseTensor(t,e,n,i){return r.startSparseTensor(t),r.addValues(t,e),r.addIndices(t,n),r.addDims(t,i),r.endSparseTensor(t)}}e.SparseTensor=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsAttribute(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsAttribute(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}docString(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}type(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):t.experimental.fbs.AttributeType.UNDEFINED}f(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readFloat32(this.bb_pos+t):0}i(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}s(t){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}t(e){let r=this.bb.__offset(this.bb_pos,16);return r?(e||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}g(e){let r=this.bb.__offset(this.bb_pos,18);return r?(e||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}floats(t){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0}floatsLength(){let t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0}floatsArray(){let t=this.bb.__offset(this.bb_pos,20);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}ints(t){let e=this.bb.__offset(this.bb_pos,22);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}intsLength(){let t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0}strings(t,e){let r=this.bb.__offset(this.bb_pos,24);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}stringsLength(){let t=this.bb.__offset(this.bb_pos,24);return t?this.bb.__vector_len(this.bb_pos+t):0}tensors(e,r){let n=this.bb.__offset(this.bb_pos,26);return n?(r||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}tensorsLength(){let t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0}graphs(e,r){let n=this.bb.__offset(this.bb_pos,28);return n?(r||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}graphsLength(){let t=this.bb.__offset(this.bb_pos,28);return t?this.bb.__vector_len(this.bb_pos+t):0}static startAttribute(t){t.startObject(13)}static addName(t,e){t.addFieldOffset(0,e,0)}static addDocString(t,e){t.addFieldOffset(1,e,0)}static addType(e,r){e.addFieldInt32(2,r,t.experimental.fbs.AttributeType.UNDEFINED)}static addF(t,e){t.addFieldFloat32(3,e,0)}static addI(t,e){t.addFieldInt64(4,e,t.createLong(0,0))}static addS(t,e){t.addFieldOffset(5,e,0)}static addT(t,e){t.addFieldOffset(6,e,0)}static addG(t,e){t.addFieldOffset(7,e,0)}static addFloats(t,e){t.addFieldOffset(8,e,0)}static createFloatsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addFloat32(e[r]);return t.endVector()}static startFloatsVector(t,e){t.startVector(4,e,4)}static addInts(t,e){t.addFieldOffset(9,e,0)}static createIntsVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startIntsVector(t,e){t.startVector(8,e,8)}static addStrings(t,e){t.addFieldOffset(10,e,0)}static createStringsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startStringsVector(t,e){t.startVector(4,e,4)}static addTensors(t,e){t.addFieldOffset(11,e,0)}static createTensorsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startTensorsVector(t,e){t.startVector(4,e,4)}static addGraphs(t,e){t.addFieldOffset(12,e,0)}static createGraphsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startGraphsVector(t,e){t.startVector(4,e,4)}static endAttribute(t){return t.endObject()}static createAttribute(t,e,n,i,o,a,s,u,l,c,p,f,d,h){return r.startAttribute(t),r.addName(t,e),r.addDocString(t,n),r.addType(t,i),r.addF(t,o),r.addI(t,a),r.addS(t,s),r.addT(t,u),r.addG(t,l),r.addFloats(t,c),r.addInts(t,p),r.addStrings(t,f),r.addTensors(t,d),r.addGraphs(t,h),r.endAttribute(t)}}e.Attribute=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsGraph(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsGraph(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}initializers(e,r){let n=this.bb.__offset(this.bb_pos,4);return n?(r||new t.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}initializersLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}nodeArgs(e,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new t.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}nodeArgsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}nodes(e,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new t.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}maxNodeIndex(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readUint32(this.bb_pos+t):0}nodeEdges(e,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new t.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}nodeEdgesLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}inputs(t,e){let r=this.bb.__offset(this.bb_pos,14);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}inputsLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}outputs(t,e){let r=this.bb.__offset(this.bb_pos,16);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+4*t,e):null}outputsLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}sparseInitializers(e,r){let n=this.bb.__offset(this.bb_pos,18);return n?(r||new t.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}sparseInitializersLength(){let t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static startGraph(t){t.startObject(8)}static addInitializers(t,e){t.addFieldOffset(0,e,0)}static createInitializersVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInitializersVector(t,e){t.startVector(4,e,4)}static addNodeArgs(t,e){t.addFieldOffset(1,e,0)}static createNodeArgsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodeArgsVector(t,e){t.startVector(4,e,4)}static addNodes(t,e){t.addFieldOffset(2,e,0)}static createNodesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodesVector(t,e){t.startVector(4,e,4)}static addMaxNodeIndex(t,e){t.addFieldInt32(3,e,0)}static addNodeEdges(t,e){t.addFieldOffset(4,e,0)}static createNodeEdgesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startNodeEdgesVector(t,e){t.startVector(4,e,4)}static addInputs(t,e){t.addFieldOffset(5,e,0)}static createInputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startInputsVector(t,e){t.startVector(4,e,4)}static addOutputs(t,e){t.addFieldOffset(6,e,0)}static createOutputsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOutputsVector(t,e){t.startVector(4,e,4)}static addSparseInitializers(t,e){t.addFieldOffset(7,e,0)}static createSparseInitializersVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startSparseInitializersVector(t,e){t.startVector(4,e,4)}static endGraph(t){return t.endObject()}static createGraph(t,e,n,i,o,a,s,u,l){return r.startGraph(t),r.addInitializers(t,e),r.addNodeArgs(t,n),r.addNodes(t,i),r.addMaxNodeIndex(t,o),r.addNodeEdges(t,a),r.addInputs(t,s),r.addOutputs(t,u),r.addSparseInitializers(t,l),r.endGraph(t)}}e.Graph=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsModel(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsModel(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}irVersion(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}opsetImport(e,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new t.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}opsetImportLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}producerName(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}producerVersion(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}domain(t){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}modelVersion(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}docString(t){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__string(this.bb_pos+e,t):null}graph(e){let r=this.bb.__offset(this.bb_pos,18);return r?(e||new t.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}graphDocString(t){let e=this.bb.__offset(this.bb_pos,20);return e?this.bb.__string(this.bb_pos+e,t):null}static startModel(t){t.startObject(9)}static addIrVersion(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addOpsetImport(t,e){t.addFieldOffset(1,e,0)}static createOpsetImportVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startOpsetImportVector(t,e){t.startVector(4,e,4)}static addProducerName(t,e){t.addFieldOffset(2,e,0)}static addProducerVersion(t,e){t.addFieldOffset(3,e,0)}static addDomain(t,e){t.addFieldOffset(4,e,0)}static addModelVersion(t,e){t.addFieldInt64(5,e,t.createLong(0,0))}static addDocString(t,e){t.addFieldOffset(6,e,0)}static addGraph(t,e){t.addFieldOffset(7,e,0)}static addGraphDocString(t,e){t.addFieldOffset(8,e,0)}static endModel(t){return t.endObject()}static createModel(t,e,n,i,o,a,s,u,l,c){return r.startModel(t),r.addIrVersion(t,e),r.addOpsetImport(t,n),r.addProducerName(t,i),r.addProducerVersion(t,o),r.addDomain(t,a),r.addModelVersion(t,s),r.addDocString(t,u),r.addGraph(t,l),r.addGraphDocString(t,c),r.endModel(t)}}e.Model=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(t){!function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKernelCreateInfos(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKernelCreateInfos(t,r){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}nodeIndices(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}nodeIndicesLength(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}nodeIndicesArray(){let t=this.bb.__offset(this.bb_pos,4);return t?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}kernelDefHashes(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint64(this.bb.__vector(this.bb_pos+e)+8*t):this.bb.createLong(0,0)}kernelDefHashesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}static startKernelCreateInfos(t){t.startObject(2)}static addNodeIndices(t,e){t.addFieldOffset(0,e,0)}static createNodeIndicesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startNodeIndicesVector(t,e){t.startVector(4,e,4)}static addKernelDefHashes(t,e){t.addFieldOffset(1,e,0)}static createKernelDefHashesVector(t,e){t.startVector(8,e.length,8);for(let r=e.length-1;r>=0;r--)t.addInt64(e[r]);return t.endVector()}static startKernelDefHashesVector(t,e){t.startVector(8,e,8)}static endKernelCreateInfos(t){return t.endObject()}static createKernelCreateInfos(t,r,n){return e.startKernelCreateInfos(t),e.addNodeIndices(t,r),e.addKernelDefHashes(t,n),e.endKernelCreateInfos(t)}}t.KernelCreateInfos=e}(t.fbs||(t.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSubGraphSessionState(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSubGraphSessionState(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}graphId(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}sessionState(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startSubGraphSessionState(t){t.startObject(2)}static addGraphId(t,e){t.addFieldOffset(0,e,0)}static addSessionState(t,e){t.addFieldOffset(1,e,0)}static endSubGraphSessionState(t){let e=t.endObject();return t.requiredField(e,4),e}static createSubGraphSessionState(t,e,n){return r.startSubGraphSessionState(t),r.addGraphId(t,e),r.addSessionState(t,n),r.endSubGraphSessionState(t)}}e.SubGraphSessionState=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSessionState(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSessionState(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}kernels(e){let r=this.bb.__offset(this.bb_pos,4);return r?(e||new t.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}subGraphSessionStates(e,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new t.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*e),this.bb):null}subGraphSessionStatesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSessionState(t){t.startObject(2)}static addKernels(t,e){t.addFieldOffset(0,e,0)}static addSubGraphSessionStates(t,e){t.addFieldOffset(1,e,0)}static createSubGraphSessionStatesVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startSubGraphSessionStatesVector(t,e){t.startVector(4,e,4)}static endSessionState(t){return t.endObject()}static createSessionState(t,e,n){return r.startSessionState(t),r.addKernels(t,e),r.addSubGraphSessionStates(t,n),r.endSessionState(t)}}e.SessionState=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(t){!function(e){!function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInferenceSession(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInferenceSession(t,e){return t.setPosition(t.position()+o.flatbuffers.SIZE_PREFIX_LENGTH),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static bufferHasIdentifier(t){return t.__has_identifier("ORTM")}ortVersion(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}model(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}sessionState(e){let r=this.bb.__offset(this.bb_pos,8);return r?(e||new t.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startInferenceSession(t){t.startObject(3)}static addOrtVersion(t,e){t.addFieldOffset(0,e,0)}static addModel(t,e){t.addFieldOffset(1,e,0)}static addSessionState(t,e){t.addFieldOffset(2,e,0)}static endInferenceSession(t){return t.endObject()}static finishInferenceSessionBuffer(t,e){t.finish(e,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(t,e){t.finish(e,"ORTM",!0)}static createInferenceSession(t,e,n,i){return r.startInferenceSession(t),r.addOrtVersion(t,e),r.addModel(t,n),r.addSessionState(t,i),r.endInferenceSession(t)}}e.InferenceSession=r}(e.fbs||(e.fbs={}))}(t.experimental||(t.experimental={}))}(e.onnxruntime||(e.onnxruntime={}))},7448:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OnnxjsSessionHandler=void 0;let n=r(1670),i=r(9162);e.OnnxjsSessionHandler=class{constructor(t){this.session=t,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(t,e,r){let o=new Map;for(let e in t)if(Object.hasOwnProperty.call(t,e)){let r=t[e];o.set(e,new i.Tensor(r.dims,r.type,void 0,void 0,r.data))}let a=await this.session.run(o),s={};return a.forEach((t,e)=>{s[e]=new n.Tensor(t.type,t.data,t.dims)}),s}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Session=void 0;let n=r(7067),i=r(1296),o=r(7091),a=r(1036),s=r(6231),u=r(2644);e.Session=class{constructor(t={}){this._initialized=!1,this.backendHint=t.backendHint,this.profiler=s.Profiler.create(t.profiler),this.context={profiler:this.profiler,graphInputTypes:[],graphInputDims:[]}}get inputNames(){return this._model.graph.getInputNames()}get outputNames(){return this._model.graph.getOutputNames()}startProfiling(){this.profiler.start()}endProfiling(){this.profiler.stop()}async loadModel(t,e,r){await this.profiler.event("session","Session.loadModel",async()=>{let a=await (0,o.resolveBackend)(this.backendHint);if(this.sessionHandler=a.createSessionHandler(this.context),this._model=new u.Model,"string"==typeof t){let e=t.endsWith(".ort");if("undefined"==typeof fetch){let r=await (0,i.promisify)(n.readFile)(t);this.initialize(r,e)}else{let r=await fetch(t),n=await r.arrayBuffer();this.initialize(new Uint8Array(n),e)}}else if(ArrayBuffer.isView(t))this.initialize(t);else{let n=new Uint8Array(t,e||0,r||t.byteLength);this.initialize(n)}})}initialize(t,e){if(this._initialized)throw Error("already initialized");this.profiler.event("session","Session.initialize",()=>{let r=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(t,r,e),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new a.ExecutionPlan(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(t){if(!this._initialized)throw Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{let e=this.normalizeAndValidateInputs(t),r=await this._executionPlan.execute(this.sessionHandler,e);return this.createOutput(r)})}normalizeAndValidateInputs(t){let e=this._model.graph.getInputNames();if(Array.isArray(t)){if(t.length!==e.length)throw Error(`incorrect input array length: expected ${e.length} but got ${t.length}`)}else{if(t.size!==e.length)throw Error(`incorrect input map size: expected ${e.length} but got ${t.size}`);let r=Array(t.size),n=0;for(let i=0;i"string"==typeof t)))throw TypeError("cache should be a string array");l&&(this.cache=Array(s))}else{if(void 0!==o){let t=f(e);if(!(o instanceof t))throw TypeError(`cache should be type ${t.name}`)}if(l){let t=new ArrayBuffer(s*function(t){switch(t){case"bool":case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;case"float64":return 8;default:throw Error(`cannot calculate sizeof() on type ${t}`)}}(e));this.cache=function(t,e){return new(f(e))(t)}(t,e)}}}static fromProto(t){if(!t)throw Error("cannot construct Value from an empty tensor");let e=u.ProtoUtil.tensorDataTypeFromProto(t.dataType),r=new c(u.ProtoUtil.tensorDimsFromProto(t.dims),e);if("string"===e)t.stringData.forEach((t,e)=>{r.data[e]=(0,u.decodeUtf8String)(t)});else if(t.rawData&&"number"==typeof t.rawData.byteLength&&t.rawData.byteLength>0){let e=r.data,n=new DataView(t.rawData.buffer,t.rawData.byteOffset,t.rawData.byteLength),i=p(t.dataType),o=t.rawData.byteLength/i;if(t.rawData.byteLength%i!=0)throw Error("invalid buffer length");if(e.length!==o)throw Error("buffer length mismatch");for(let r=0;r0){let e=n.data,r=new DataView(t.rawDataArray().buffer,t.rawDataArray().byteOffset,t.rawDataLength()),i=p(t.dataType()),o=t.rawDataLength()/i;if(t.rawDataLength()%i!=0)throw Error("invalid buffer length");if(e.length!==o)throw Error("buffer length mismatch");for(let n=0;n1&&u>1)return;a[o-s]=Math.max(r,u)}return a}static index(t,e){let r=Array(e.length);return l.fillIndex(t,e,r),r}static fillIndex(t,e,r){let n=t.length-e.length;for(let i=0;i=0;t--)n[t]=c%o[t],c=Math.floor(c/o[t]);d||(l.fillIndex(n,t.dims,i),p=t.get(i)),h||(l.fillIndex(n,e.dims,s),f=e.get(s)),u.set(n,r(p,f))}}return u}}static isValidBroadcast(t,e){let r=t.length,n=e.length;if(r>n)return!1;for(let i=1;i<=r;i++)if(1!==t[r-i]&&t[r-i]!==e[n-i])return!1;return!0}static getBroadcastDims(t,e){let r=t.length,n=[];for(let i=0;i1&&1===a&&n.unshift(o)}return n}}e.BroadcastUtil=l,e.arrayCopyHelper=function(t,e,r,n,i){if(n<0||n>=e.length)throw Error("sourceIndex out of bounds");if(r<0||r>=t.length)throw Error("targetIndex out of bounds");if(n+i>e.length)throw Error("source indices to be copied are outside bounds");if(r+i>t.length)throw Error("target array is too small to hold result");for(let o=0;oo.default.isLong(t)?t.toNumber():t)}static tensorValueTypeFromProto(t){return{tensorType:c.tensorDataTypeFromProto(t.elemType),shape:{dims:c.tensorDimsFromProto(t.shape.dim.map(t=>t.dimValue))}}}static tensorDimsFromORTFormat(t){let e=[];for(let r=0;rt.length)throw Error(`invalid dimension of ${e} for sizeFromDimension as Tensor has ${t.length} dimensions.`);return f.getSizeFromDimensionRange(t,e,t.length)}static sizeToDimension(t,e){if(e<0||e>t.length)throw Error(`invalid dimension of ${e} for sizeToDimension as Tensor has ${t.length} dimensions.`);return f.getSizeFromDimensionRange(t,0,e)}static getSizeFromDimensionRange(t,e,r){let n=1;for(let i=e;i=0;--n)r[n]=r[n+1]*t[n+1];return r}static transpose(t){return t.slice().reverse()}static indicesToOffset(t,e,r){void 0===r&&(r=t.length);let n=0;for(let i=0;i=e)throw Error("unsupported axis for this operation.");return t<0?t+e:t}static normalizeAxes(t,e){return t.map(t=>this.normalizeAxis(t,e))}static incrementIndex(t,e,r){if(0===e.length||0===t.length)throw Error("Index incrementing unsupported for scalar Tensor");if(void 0===r)r=e.length;else if(r<=0||r>e.length)throw Error("Incorrect axis to increment on");for(let n=r-1;n>=0&&(t[n]++,!(t[n]=t.length)throw Error("the dimension with value zero exceeds the dimension size of the input tensor");n[a]=t[a]}else n[a]=e[a];o*=n[a]}}let a=f.size(t);if(-1!==i){if(a%o!=0)throw Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${t}] Output shape: [${e}]`);n[i]=a/o}else if(o!==a)throw Error("reshapedDims and originalDims don't have matching sizes");return n}static sortBasedOnPerm(t,e){return e?e.map(e=>t[e]):t.slice().reverse()}static padShape(t,e){let r=t.length;return t.map((t,n)=>t+e[n]+e[n+r])}static areEqual(t,e){return t.length===e.length&&t.every((t,r)=>t===e[r])}static validateDimsAndCalcSize(t){if(t.length>6)throw TypeError("Only rank 0 to 6 is supported for tensor shape.");let e=1;for(let r of t){if(!Number.isInteger(r))throw TypeError(`Invalid shape: ${r} is not an integer`);if(r<0||r>2147483647)throw TypeError(`Invalid shape: length ${r} is not allowed`);e*=r}return e}static flattenShape(t,e){e<0&&(e+=t.length);let r=t.reduce((t,e)=>t*e,1),n=t.slice(e).reduce((t,e)=>t*e,1);return[r/n,n]}static squeezeShape(t,e){let r=[];e=f.normalizeAxes(e,t.length);for(let n=0;n=0;if(i&&1!==t[n])throw Error("squeeze an axis of size different than 1");(0===e.length&&t[n]>1||e.length>0&&!i)&&r.push(t[n])}return r}static unsqueezeShape(t,e){let r=Array(t.length+e.length);r.fill(0);for(let t=0;t=r.length)throw Error("'axes' has an out of range axis");if(0!==r[n])throw Error("'axes' has a duplicate axis");r[n]=1}let n=0;for(let e=0;e=e.length)throw Error("sourceIndex out of bounds");if(r<0||r>=t.length)throw Error("targetIndex out of bounds");if(n+i>e.length)throw Error("source indices to be copied are outside bounds");if(r+i>t.length)throw Error("target array is too small to hold result");for(let o=0;o=e.length)throw Error("sourceIndex out of bounds");if(r<0||r>=t.length)throw Error("targetIndex out of bounds");if(n+i>e.length)throw Error("source indices to be copied are outside bounds");if(r+i>t.length)throw Error("target array is too small to hold result");for(let a=0;a=e.length)throw Error("sourceIndex out of bounds");if(r<0||r>=t.length)throw Error("targetIndex out of bounds");if(n+i>e.length)throw Error("source indices to be copied are outside bounds");if(r+i>t.length)throw Error("target array is too small to hold result");for(let a=0;a=e.length)throw Error("sourceIndex out of bounds");if(r<0||r>=t.length)throw Error("targetIndex out of bounds");if(n+i>e.length)throw Error("source indices to be copied are outside bounds");if(r+i>t.length)throw Error("target array is too small to hold result");for(let o=0;oe.push(r));let a=h.calcReduceShape(o,e,!0),u=f.size(a),c=new s.Tensor(a,t.type),p=f.computeStrides(a),d=f.computeStrides(o),g=Array(o.length);for(let r=0;r=e.length)return o(t[i]);let u=e[n],l=u>=r.length?1:f.size(r.slice(u+1));for(let c=0;c0!==t)}}e.ReduceUtil=h;class g{static adjustPoolAttributes(t,e,r,n,i,o){if(!t&&r.length!==e.length-2)throw Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(t)for(let t=0;t=r.length?r.push(e[t+2]):r[t]=e[t+2];for(let t=0;t=r[t]||o[t+r.length]>=r[t])throw Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(t,e,r,n,i,o){if(o){if(i.length!==2*(t.length-2))throw Error("length of pads should be twice the length of data dimensions");if(e.length!==t.length-2)throw Error("length of strides should be the length of data dimensions");if(n.length!==t.length-2)throw Error("length of kernel shapes should be the length of data dimensions");for(let a=0;a{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,r,n,i)=>{if("object"==typeof t&&null!==t){if(n.has(t))throw Error("Circular reference in options");n.add(t)}Object.entries(t).forEach(([t,o])=>{let a=r?r+t:t;if("object"==typeof o)(0,e.iterateExtraOptions)(o,a+".",n,i);else if("string"==typeof o||"number"==typeof o)i(a,o.toString());else{if("boolean"!=typeof o)throw Error("Can't handle extra config type: "+typeof o);i(a,o?"1":"0")}})}},2157:function(t,e,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&i(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=e.initWasm=void 0;let s=r(1670),u=a(r(349)),l=r(6361),c=()=>!!s.env.wasm.proxy&&"undefined"!=typeof document,p,f,d,h=!1,g=!1,b=!1,m=[],y=[],_=[],v=[],x=[],w=[],T=()=>{if(h||!g||b||!p)throw Error("worker not ready")},S=t=>{switch(t.data.type){case"init-wasm":h=!1,t.data.err?(b=!0,f[1](t.data.err)):(g=!0,f[0]());break;case"init-ort":t.data.err?d[1](t.data.err):d[0]();break;case"create_allocate":t.data.err?m.shift()[1](t.data.err):m.shift()[0](t.data.out);break;case"create_finalize":t.data.err?y.shift()[1](t.data.err):y.shift()[0](t.data.out);break;case"create":t.data.err?_.shift()[1](t.data.err):_.shift()[0](t.data.out);break;case"release":t.data.err?v.shift()[1](t.data.err):v.shift()[0]();break;case"run":t.data.err?x.shift()[1](t.data.err):x.shift()[0](t.data.out);break;case"end-profiling":t.data.err?w.shift()[1](t.data.err):w.shift()[0]()}},O="undefined"!=typeof document?null===(n=null==document?void 0:document.currentScript)||void 0===n?void 0:n.src:void 0;e.initWasm=async()=>{if(c()){if(g)return;if(h)throw Error("multiple calls to 'initWasm()' detected.");if(b)throw Error("previous call to 'initWasm()' failed.");return h=!0,void 0===s.env.wasm.wasmPaths&&O&&0!==O.indexOf("blob:")&&(s.env.wasm.wasmPaths=O.substr(0,+O.lastIndexOf("/")+1)),new Promise((t,e)=>{null==p||p.terminate(),(p=r(9710).Z()).onmessage=S,f=[t,e];let n={type:"init-wasm",in:s.env.wasm};p.postMessage(n)})}return(0,l.initializeWebAssembly)(s.env.wasm)},e.initOrt=async(t,e)=>{if(c())return T(),new Promise((r,n)=>{d=[r,n];let i={type:"init-ort",in:{numThreads:t,loggingLevel:e}};p.postMessage(i)});u.initOrt(t,e)},e.createSessionAllocate=async t=>c()?(T(),new Promise((e,r)=>{m.push([e,r]);let n={type:"create_allocate",in:{model:t}};p.postMessage(n,[t.buffer])})):u.createSessionAllocate(t),e.createSessionFinalize=async(t,e)=>c()?(T(),new Promise((r,n)=>{y.push([r,n]);let i={type:"create_finalize",in:{modeldata:t,options:e}};p.postMessage(i)})):u.createSessionFinalize(t,e),e.createSession=async(t,e)=>c()?(T(),new Promise((r,n)=>{_.push([r,n]);let i={type:"create",in:{model:t,options:e}};p.postMessage(i,[t.buffer])})):u.createSession(t,e),e.releaseSession=async t=>{if(c())return T(),new Promise((e,r)=>{v.push([e,r]);let n={type:"release",in:t};p.postMessage(n)});u.releaseSession(t)},e.run=async(t,e,r,n,i)=>c()?(T(),new Promise((o,a)=>{x.push([o,a]);let s={type:"run",in:{sessionId:t,inputIndices:e,inputs:r,outputIndices:n,options:i}};p.postMessage(s,u.extractTransferableBuffers(r))})):u.run(t,e,r,n,i),e.endProfiling=async t=>{if(c())return T(),new Promise((e,r)=>{w.push([e,r]);let n={type:"end-profiling",in:t};p.postMessage(n)});u.endProfiling(t)}},586:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;let n=r(7967),i=r(4983),o=r(6361);e.setRunOptions=t=>{let e=(0,o.getInstance)(),r=0,a=[],s=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))s.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))s.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(s.terminate=!1);let o=0;if(void 0!==(null==t?void 0:t.tag)&&(o=(0,i.allocWasmString)(t.tag,a)),r=e._OrtCreateRunOptions(s.logSeverityLevel,s.logVerbosityLevel,!!s.terminate,o),0===r)throw Error("Can't create run options");return void 0!==(null==t?void 0:t.extra)&&(0,n.iterateExtraOptions)(t.extra,"",new WeakSet,(t,n)=>{let o=(0,i.allocWasmString)(t,a),s=(0,i.allocWasmString)(n,a);if(0!==e._OrtAddRunConfigEntry(r,o,s))throw Error(`Can't set a run config entry: ${t} - ${n}`)}),[r,a]}catch(t){throw 0!==r&&e._OrtReleaseRunOptions(r),a.forEach(e._free),t}}},2306:(t,e,r)=>{"use strict";let n;Object.defineProperty(e,"__esModule",{value:!0}),e.OnnxruntimeWebAssemblySessionHandler=void 0;let i=r(2806),o=r(1670),a=r(2850),s=r(2157);e.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(t){let e=await fetch(t),r=await e.arrayBuffer();return(0,s.createSessionAllocate)(new Uint8Array(r))}async loadModel(t,e){if(n||(await (0,s.initOrt)(o.env.wasm.numThreads,(t=>{switch(t){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw Error(`unsupported logging level: ${t}`)}})(o.env.logLevel)),n=!0),"string"==typeof t){if("undefined"==typeof fetch){let r=await (0,a.promisify)(i.readFile)(t);[this.sessionId,this.inputNames,this.outputNames]=await (0,s.createSession)(r,e)}else{let r=await this.createSessionAllocate(t);[this.sessionId,this.inputNames,this.outputNames]=await (0,s.createSessionFinalize)(r,e)}}else[this.sessionId,this.inputNames,this.outputNames]=await (0,s.createSession)(t,e)}async dispose(){return(0,s.releaseSession)(this.sessionId)}async run(t,e,r){let n=[],i=[];Object.entries(t).forEach(t=>{let e=t[0],r=t[1],o=this.inputNames.indexOf(e);if(-1===o)throw Error(`invalid input '${e}'`);n.push(r),i.push(o)});let a=[];Object.entries(e).forEach(t=>{let e=t[0],r=this.outputNames.indexOf(e);if(-1===r)throw Error(`invalid output '${e}'`);a.push(r)});let u=await (0,s.run)(this.sessionId,i,n.map(t=>[t.type,t.dims,t.data]),a,r),l={};for(let t=0;t{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;let n=r(7967),i=r(4983),o=r(6361);e.setSessionOptions=t=>{let e=(0,o.getInstance)(),r=0,a=[],s=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});let e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(s);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(s.graphOptimizationLevel="all");let u=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw Error(`unsupported graph optimization level: ${t}`)}})(s.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(s.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(s.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(s.executionMode="sequential");let l=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw Error(`unsupported execution mode: ${t}`)}})(s.executionMode),c=0;if(void 0!==(null==t?void 0:t.logId)&&(c=(0,i.allocWasmString)(t.logId,a)),void 0===(null==t?void 0:t.logSeverityLevel))s.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))s.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(s.enableProfiling=!1),r=e._OrtCreateSessionOptions(u,!!s.enableCpuMemArena,!!s.enableMemPattern,l,!!s.enableProfiling,0,c,s.logSeverityLevel,s.logVerbosityLevel),0===r)throw Error("Can't create session options");return(null==t?void 0:t.executionProviders)&&((t,e,r)=>{for(let n of e){let e="string"==typeof n?n:n.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw Error(`not supported EP: ${e}`)}let a=(0,i.allocWasmString)(e,r);if(0!==(0,o.getInstance)()._OrtAppendExecutionProvider(t,a))throw Error(`Can't append execution provider: ${e}`)}})(r,t.executionProviders,a),void 0!==(null==t?void 0:t.extra)&&(0,n.iterateExtraOptions)(t.extra,"",new WeakSet,(t,n)=>{let o=(0,i.allocWasmString)(t,a),s=(0,i.allocWasmString)(n,a);if(0!==e._OrtAddSessionConfigEntry(r,o,s))throw Error(`Can't set a session config entry: ${t} - ${n}`)}),[r,a]}catch(t){throw 0!==r&&e._OrtReleaseSessionOptions(r),a.forEach(e._free),t}}},4983:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;let n=r(6361);e.allocWasmString=(t,e)=>{let r=(0,n.getInstance)(),i=r.lengthBytesUTF8(t)+1,o=r._malloc(i);return r.stringToUTF8(t,o,i),e.push(o),o}},349:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;let n=r(586),i=r(4919),o=r(4983),a=r(6361);e.initOrt=(t,e)=>{let r=(0,a.getInstance)()._OrtInit(t,e);if(0!==r)throw Error(`Can't initialize onnxruntime. error code = ${r}`)};let s=new Map;e.createSessionAllocate=t=>{let e=(0,a.getInstance)(),r=e._malloc(t.byteLength);return e.HEAPU8.set(t,r),[r,t.byteLength]},e.createSessionFinalize=(t,e)=>{let r=(0,a.getInstance)(),n=0,o=0,u=[];try{if([o,u]=(0,i.setSessionOptions)(e),n=r._OrtCreateSession(t[0],t[1],o),0===n)throw Error("Can't create a session")}finally{r._free(t[0]),r._OrtReleaseSessionOptions(o),u.forEach(r._free)}let l=r._OrtGetInputCount(n),c=r._OrtGetOutputCount(n),p=[],f=[],d=[],h=[];for(let t=0;t{let n=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(n,r)},e.releaseSession=t=>{let e=(0,a.getInstance)(),r=s.get(t);if(!r)throw Error("invalid session id");let n=r[0],i=r[1],o=r[2];i.forEach(e._OrtFree),o.forEach(e._OrtFree),e._OrtReleaseSession(n),s.delete(t)};let u=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw Error(`unsupported data type: ${t}`)}},l=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw Error(`unsupported data type: ${t}`)}},c=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw Error(`unsupported type: ${t}`)}};e.run=(t,e,r,i,p)=>{let f=(0,a.getInstance)(),d=s.get(t);if(!d)throw Error("invalid session id");let h=d[0],g=d[1],b=d[2],m=e.length,y=i.length,_=0,v=[],x=[],w=[];try{[_,v]=(0,n.setRunOptions)(p);for(let t=0;tf.HEAP32[t++]=e);let r=f._OrtCreateTensor(u(i),e,n,c,a.length);if(0===r)throw Error("Can't create a tensor");x.push(r)}finally{f.stackRestore(l)}}let t=f.stackSave(),a=f.stackAlloc(4*m),s=f.stackAlloc(4*m),d=f.stackAlloc(4*y),T=f.stackAlloc(4*y);try{let t=a/4,r=s/4,n=d/4,o=T/4;for(let n=0;nt*e);if(i=l(r),"string"===i){let t=[],e=o/4;for(let r=0;r{let e=(0,a.getInstance)(),r=s.get(t);if(!r)throw Error("invalid session id");let n=r[0],i=e._OrtEndProfiling(n);if(0===i)throw Error("Can't get an profile file name");e._OrtFree(i)},e.extractTransferableBuffers=t=>{let e=[];for(let r of t){let t=r[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},6361:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;let s=o(r(6449)),u=a(r(932)),l=r(3474),c,p=!1,f=!1,d=!1,h=(t,e)=>e?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":t?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async t=>{if(p)return Promise.resolve();if(f)throw Error("multiple calls to 'initializeWebAssembly()' detected.");if(d)throw Error("previous call to 'initializeWebAssembly()' failed.");f=!0;let e=t.initTimeout,n=t.numThreads,i=t.simd,o=n>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch(t){return!1}})(),a=i&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch(t){return!1}})(),g="string"==typeof t.wasmPaths?t.wasmPaths:void 0,b=h(!1,o),m=h(a,o),y="object"==typeof t.wasmPaths?t.wasmPaths[m]:void 0,_=!1,v=[];if(e>0&&v.push(new Promise(t=>{setTimeout(()=>{_=!0,t()},e)})),v.push(new Promise((t,e)=>{let n=o?l:u.default,i={locateFile:(t,e)=>o&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([r(4154)],{type:"text/javascript"})):t===b?null!=y?y:(null!=g?g:e)+m:e+t};if(o){if("undefined"==typeof Blob)i.mainScriptUrlOrBlob=s.join("/","ort-wasm-threaded.js");else{let t=`var ortWasmThreaded=(function(){var _scriptDir;return ${n.toString()}})();`;i.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}}n(i).then(e=>{f=!1,p=!0,c=e,t()},t=>{f=!1,d=!0,e(t)})})),await Promise.race(v),_)throw Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(p&&c)return c;throw Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!p||f||d||(f=!0,null===(t=c.PThread)||void 0===t||t.terminateAllThreads(),c=void 0,f=!1,p=!1,d=!0)}},9710:(t,e,r)=>{"use strict";r.d(e,{Z:()=>o});var n=r(477),i=r.n(n);function o(){return i()('/*!\n* ONNX Runtime Web v1.14.0\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License.\n*/\n(()=>{var t={474:(t,e,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return j.buffer!=D&&N(j.buffer),P}function r(){return j.buffer!=D&&N(j.buffer),U}function a(){return j.buffer!=D&&N(j.buffer),F}function i(){return j.buffer!=D&&N(j.buffer),I}function o(){return j.buffer!=D&&N(j.buffer),W}var u,c,s;t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise((function(t,e){c=t,s=e}));var l,f,p,h,d,y,b=Object.assign({},u),m="./this.program",g=(t,e)=>{throw e},v="object"==typeof window,w="function"==typeof importScripts,_="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,O=u.ENVIRONMENT_IS_PTHREAD||!1,A="";function S(t){return u.locateFile?u.locateFile(t,A):A+t}if(_){let e;A=w?n(908).dirname(A)+"/":"//",y=()=>{d||(h=n(384),d=n(908))},l=function(t,e){return y(),t=d.normalize(t),h.readFileSync(t,e?void 0:"utf8")},p=t=>((t=l(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,n)=>{y(),t=d.normalize(t),h.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(Q())throw process.exitCode=t,e;e instanceof ct||x("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{e=n(925)}catch(t){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),t}n.g.Worker=e.Worker}else(v||w)&&(w?A=self.location.href:"undefined"!=typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),A=0!==A.indexOf("blob:")?A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):"",_||(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},w&&(p=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}));_&&"undefined"==typeof performance&&(n.g.performance=n(953).performance);var T=console.log.bind(console),E=console.warn.bind(console);_&&(y(),T=t=>h.writeSync(1,t+"\\n"),E=t=>h.writeSync(2,t+"\\n"));var M,C=u.print||T,x=u.printErr||E;Object.assign(u,b),b=null,u.thisProgram&&(m=u.thisProgram),u.quit&&(g=u.quit),u.wasmBinary&&(M=u.wasmBinary);var R=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&at("no native wasm support detected");var j,k,D,P,U,F,I,W,H=!1,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function z(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function Y(t,e){return(t>>>=0)?z(r(),t,e):""}function B(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function G(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function N(t){D=t,u.HEAP8=P=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=F=new Int32Array(t),u.HEAPU8=U=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=I=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=W=new Float64Array(t)}O&&(D=u.buffer);var V=u.INITIAL_MEMORY||16777216;if(O)j=u.wasmMemory,D=u.buffer;else if(u.wasmMemory)j=u.wasmMemory;else if(!((j=new WebAssembly.Memory({initial:V/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw x("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),_&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");j&&(D=j.buffer),V=D.byteLength,N(D);var $,q=[],X=[],J=[],Z=[];function Q(){return R||!1}function K(){var t=u.preRun.shift();q.unshift(t)}var tt,et=0,nt=null,rt=null;function at(t){throw O?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),x(t="Aborted("+t+")"),H=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),s(t),t}function it(){return tt.startsWith("data:application/octet-stream;base64,")}function ot(){var t=tt;try{if(t==tt&&M)return new Uint8Array(M);if(p)return p(t);throw"both async and sync fetching of the wasm failed"}catch(t){at(t)}}tt="ort-wasm-threaded.wasm",it()||(tt=S(tt));var ut={};function ct(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function st(t){(t=ht.Vb[t])||at(),ht.mc(t)}function lt(t){var e=ht.Cc();if(!e)return 6;ht.ac.push(e),ht.Vb[t.Ub]=e,e.Ub=t.Ub;var n={cmd:"run",start_routine:t.Ic,arg:t.zc,pthread_ptr:t.Ub};return e.$b=()=>{n.time=performance.now(),e.postMessage(n,t.Nc)},e.loaded&&(e.$b(),delete e.$b),0}function ft(t){if(O)return $t(1,1,t);Q()||(ht.oc(),u.onExit&&u.onExit(t),H=!0),g(t,new ct(t))}function pt(t,e){if(!e&&O)throw bt(t),"unwind";Q()||O||(me(),dt(J),be(0),re[1].length&&ae(1,10),re[2].length&&ae(2,10),ht.oc()),ft(t)}var ht={Yb:[],ac:[],qc:[],Vb:{},fc:function(){O&&ht.Ec()},Pc:function(){},Ec:function(){ht.receiveObjectTransfer=ht.Gc,ht.threadInitTLS=ht.pc,ht.setExitStatus=ht.nc,R=!1},nc:function(){},oc:function(){for(var t of Object.values(ht.Vb))ht.mc(t);for(t of ht.Yb)t.terminate();ht.Yb=[]},mc:function(t){var e=t.Ub;delete ht.Vb[e],ht.Yb.push(t),ht.ac.splice(ht.ac.indexOf(t),1),t.Ub=0,Oe(e)},Gc:function(){},pc:function(){ht.qc.forEach((t=>t()))},Fc:function(t,e){t.onmessage=n=>{var r=(n=n.data).cmd;if(t.Ub&&(ht.Bc=t.Ub),n.targetThread&&n.targetThread!=he()){var a=ht.Vb[n.Qc];a?a.postMessage(n,n.transferList):x(\'Internal error! Worker sent a message "\'+r+\'" to target pthread \'+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?zt(n.queue):"spawnThread"===r?lt(n):"cleanupThread"===r?st(n.thread):"killThread"===r?(n=n.thread,r=ht.Vb[n],delete ht.Vb[n],r.terminate(),Oe(n),ht.ac.splice(ht.ac.indexOf(r),1),r.Ub=0):"cancelThread"===r?ht.Vb[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(t.loaded=!0,e&&e(t),t.$b&&(t.$b(),delete t.$b)):"print"===r?C("Thread "+n.threadId+": "+n.text):"printErr"===r?x("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?t.postMessage(n):"onAbort"===r?u.onAbort&&u.onAbort(n.arg):r&&x("worker sent an unknown command "+r);ht.Bc=void 0},t.onerror=t=>{throw x("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},_&&(t.on("message",(function(e){t.onmessage({data:e})})),t.on("error",(function(e){t.onerror(e)})),t.on("detachedExit",(function(){}))),t.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||_scriptDir,wasmMemory:j,wasmModule:k})},yc:function(){var t=S("ort-wasm-threaded.worker.js");ht.Yb.push(new Worker(t))},Cc:function(){return 0==ht.Yb.length&&(ht.yc(),ht.Fc(ht.Yb[0])),ht.Yb.pop()}};function dt(t){for(;0>2>>>0];t=a()[t+48>>2>>>0],Te(e,e-t),Me(e)};var mt=[];function gt(t){var e=mt[t];return e||(t>=mt.length&&(mt.length=t+1),mt[t]=e=$.get(t)),e}u.invokeEntryPoint=function(t,e){t=gt(t)(e),Q()?ht.nc(t):Ae(t)};var vt,wt,_t=[],Ot=0,At=0;function St(t){this.Zb=t,this.Sb=t-24,this.xc=function(t){i()[this.Sb+4>>2>>>0]=t},this.bc=function(){return i()[this.Sb+4>>2>>>0]},this.wc=function(t){i()[this.Sb+8>>2>>>0]=t},this.Dc=function(){return i()[this.Sb+8>>2>>>0]},this.rc=function(){a()[this.Sb>>2>>>0]=0},this.hc=function(t){t=t?1:0,e()[this.Sb+12>>0>>>0]=t},this.uc=function(){return 0!=e()[this.Sb+12>>0>>>0]},this.ic=function(t){t=t?1:0,e()[this.Sb+13>>0>>>0]=t},this.kc=function(){return 0!=e()[this.Sb+13>>0>>>0]},this.fc=function(t,e){this.cc(0),this.xc(t),this.wc(e),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(a(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(a(),this.Sb>>2,1)},this.cc=function(t){i()[this.Sb+16>>2>>>0]=t},this.tc=function(){return i()[this.Sb+16>>2>>>0]},this.vc=function(){if(Re(this.bc()))return i()[this.Zb>>2>>>0];var t=this.tc();return 0!==t?t:this.Zb}}function Tt(t){return ye(new St(t).Sb)}function Et(t,e,n,r){return O?$t(3,1,t,e,n,r):Mt(t,e,n,r)}function Mt(t,e,n,r){if("undefined"==typeof SharedArrayBuffer)return x("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return O&&0===a.length?Et(t,e,n,r):(t={Ic:n,Ub:t,zc:r,Nc:a},O?(t.Oc="spawnThread",postMessage(t,a),0):lt(t))}function Ct(t,e,n){return O?$t(4,1,t,e,n):0}function xt(t,e){if(O)return $t(5,1,t,e)}function Rt(t,e){if(O)return $t(6,1,t,e)}function jt(t,e,n){if(O)return $t(7,1,t,e,n)}function kt(t,e,n){return O?$t(8,1,t,e,n):0}function Dt(t,e){if(O)return $t(9,1,t,e)}function Pt(t,e,n){if(O)return $t(10,1,t,e,n)}function Ut(t,e,n,r){if(O)return $t(11,1,t,e,n,r)}function Ft(t,e,n,r){if(O)return $t(12,1,t,e,n,r)}function It(t,e,n,r){if(O)return $t(13,1,t,e,n,r)}function Wt(t){if(O)return $t(14,1,t)}function Ht(t,e){if(O)return $t(15,1,t,e)}function Lt(t,e,n){if(O)return $t(16,1,t,e,n)}function zt(t){Atomics.store(a(),t>>2,1),he()&&_e(t),Atomics.compareExchange(a(),t>>2,1,0)}function Yt(t){return i()[t>>>2]+4294967296*a()[t+4>>>2]}function Bt(t,e,n,r,a,i){return O?$t(17,1,t,e,n,r,a,i):-52}function Gt(t,e,n,r,a,i){if(O)return $t(18,1,t,e,n,r,a,i)}function Nt(t){var n=G(t)+1,r=de(n);return r&&B(t,e(),r,n),r}function Vt(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}if(O)return $t(19,1,t,e,n);var o=(new Date).getFullYear(),u=new Date(o,0,1),c=new Date(o,6,1);o=u.getTimezoneOffset();var s=c.getTimezoneOffset(),l=Math.max(o,s);a()[t>>2>>>0]=60*l,a()[e>>2>>>0]=Number(o!=s),t=r(u),e=r(c),t=Nt(t),e=Nt(e),s>2>>>0]=t,i()[n+4>>2>>>0]=e):(i()[n>>2>>>0]=e,i()[n+4>>2>>>0]=t)}function $t(t,e){var n=arguments.length-2,r=arguments;return yt((()=>{for(var a=Ce(8*n),i=a>>3,u=0;u>>0]=c}return we(t,n,a,e)}))}u.executeNotifiedProxyingQueue=zt,wt=_?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:O?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var qt,Xt=[],Jt={};function Zt(){if(!qt){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:m||"./this.program"};for(t in Jt)void 0===Jt[t]?delete e[t]:e[t]=Jt[t];var n=[];for(t in e)n.push(t+"="+e[t]);qt=n}return qt}function Qt(t,n){if(O)return $t(20,1,t,n);var r=0;return Zt().forEach((function(a,o){var u=n+r;for(o=i()[t+4*o>>2>>>0]=u,u=0;u>0>>>0]=a.charCodeAt(u);e()[o>>0>>>0]=0,r+=a.length+1})),0}function Kt(t,e){if(O)return $t(21,1,t,e);var n=Zt();i()[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),i()[e>>2>>>0]=r,0}function te(t){return O?$t(22,1,t):52}function ee(t,e,n,r){return O?$t(23,1,t,e,n,r):52}function ne(t,e,n,r,a){return O?$t(24,1,t,e,n,r,a):70}var re=[null,[],[]];function ae(t,e){var n=re[t];0===e||10===e?((1===t?C:x)(z(n,0)),n.length=0):n.push(e)}function ie(t,e,n,a){if(O)return $t(25,1,t,e,n,a);for(var o=0,u=0;u>2>>>0],s=i()[e+4>>2>>>0];e+=8;for(var l=0;l>>0]);o+=s}return i()[a>>2>>>0]=o,0}var oe=0;function ue(t){return 0==t%4&&(0!=t%100||0==t%400)}var ce=[31,29,31,30,31,30,31,31,30,31,30,31],se=[31,28,31,30,31,30,31,31,30,31,30,31];function le(t,n,r,i){function o(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),n=s(n),0>=c(e,t)?0>=c(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var f=a()[i+40>>2>>>0];for(var p in i={Lc:a()[i>>2>>>0],Kc:a()[i+4>>2>>>0],dc:a()[i+8>>2>>>0],jc:a()[i+12>>2>>>0],ec:a()[i+16>>2>>>0],Xb:a()[i+20>>2>>>0],Tb:a()[i+24>>2>>>0],Wb:a()[i+28>>2>>>0],Rc:a()[i+32>>2>>>0],Jc:a()[i+36>>2>>>0],Mc:f?Y(f):""},r=Y(r),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(p,"g"),f[p]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(p in f={"%a":function(t){return h[t.Tb].substring(0,3)},"%A":function(t){return h[t.Tb]},"%b":function(t){return d[t.ec].substring(0,3)},"%B":function(t){return d[t.ec]},"%C":function(t){return u((t.Xb+1900)/100|0,2)},"%d":function(t){return u(t.jc,2)},"%e":function(t){return o(t.jc,2," ")},"%g":function(t){return l(t).toString().substring(2)},"%G":function(t){return l(t)},"%H":function(t){return u(t.dc,2)},"%I":function(t){return 0==(t=t.dc)?t=12:12t.dc?"AM":"PM"},"%S":function(t){return u(t.Lc,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Tb||7},"%U":function(t){return u(Math.floor((t.Wb+7-t.Tb)/7),2)},"%V":function(t){var e=Math.floor((t.Wb+7-(t.Tb+6)%7)/7);if(2>=(t.Tb+371-t.Wb-2)%7&&e++,e)53==e&&(4==(n=(t.Tb+371-t.Wb)%7)||3==n&&ue(t.Xb)||(e=1));else{e=52;var n=(t.Tb+7-t.Wb-1)%7;(4==n||5==n&&ue(t.Xb%400-1))&&e++}return u(e,2)},"%w":function(t){return t.Tb},"%W":function(t){return u(Math.floor((t.Wb+7-(t.Tb+6)%7)/7),2)},"%y":function(t){return(t.Xb+1900).toString().substring(2)},"%Y":function(t){return t.Xb+1900},"%z":function(t){var e=0<=(t=t.Jc);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.Mc},"%%":function(){return"%"}},r=r.replace(/%%/g,"\\0\\0"),f)r.includes(p)&&(r=r.replace(new RegExp(p,"g"),f[p](i)));return p=function(t){var e=Array(G(t)+1);return B(t,e,0,e.length),e}(r=r.replace(/\\0\\0/g,"%")),p.length>n?0:(function(t,n){e().set(t,n>>>0)}(p,t),p.length-1)}ht.fc();var fe=[null,ft,bt,Et,Ct,xt,Rt,jt,kt,Dt,Pt,Ut,Ft,It,Wt,Ht,Lt,Bt,Gt,Vt,Qt,Kt,te,ee,ne,ie],pe={b:function(t){return de(t+24)+24},n:function(t){return(t=new St(t)).uc()||(t.hc(!0),Ot--),t.ic(!1),_t.push(t),t.sc(),t.vc()},ma:function(t){throw x("Unexpected exception thrown, this is not properly supported - aborting"),H=!0,t},x:function(){Se(0);var t=_t.pop();if(t.Hc()&&!t.kc()){var e=t.Dc();e&>(e)(t.Zb),Tt(t.Zb)}At=0},e:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;azt(r)));else if(O)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:r});else{if(!(t=ht.Vb[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},Ea:function(){return-1},Pa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getUTCSeconds(),a()[e+4>>2>>>0]=t.getUTCMinutes(),a()[e+8>>2>>>0]=t.getUTCHours(),a()[e+12>>2>>>0]=t.getUTCDate(),a()[e+16>>2>>>0]=t.getUTCMonth(),a()[e+20>>2>>>0]=t.getUTCFullYear()-1900,a()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[e+28>>2>>>0]=t},Qa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getSeconds(),a()[e+4>>2>>>0]=t.getMinutes(),a()[e+8>>2>>>0]=t.getHours(),a()[e+12>>2>>>0]=t.getDate(),a()[e+16>>2>>>0]=t.getMonth(),a()[e+20>>2>>>0]=t.getFullYear()-1900,a()[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1),r=(t.getTime()-n.getTime())/864e5|0;a()[e+28>>2>>>0]=r,a()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),r=new Date(t.getFullYear(),6,1).getTimezoneOffset(),t=0|(r!=(n=n.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(n,r)),a()[e+32>>2>>>0]=t},Ra:function(t){var e=new Date(a()[t+20>>2>>>0]+1900,a()[t+16>>2>>>0],a()[t+12>>2>>>0],a()[t+8>>2>>>0],a()[t+4>>2>>>0],a()[t>>2>>>0],0),n=a()[t+32>>2>>>0],r=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),c=Math.min(u,o);return 0>n?a()[t+32>>2>>>0]=Number(o!=u&&c==r):0>2>>>0]=e.getDay(),n=(e.getTime()-i.getTime())/864e5|0,a()[t+28>>2>>>0]=n,a()[t>>2>>>0]=e.getSeconds(),a()[t+4>>2>>>0]=e.getMinutes(),a()[t+8>>2>>>0]=e.getHours(),a()[t+12>>2>>>0]=e.getDate(),a()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},Aa:Bt,Ba:Gt,Sa:function t(e,n,r){t.Ac||(t.Ac=!0,Vt(e,n,r))},y:function(){at("")},U:function(){if(!_&&!w){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";vt||(vt={}),vt[t]||(vt[t]=1,_&&(t="warning: "+t),x(t))}},ra:function(){return 4294901760},B:wt,Ia:function(t,e,n){r().copyWithin(t>>>0,e>>>0,e+n>>>0)},F:function(){return _?n(993).cpus().length:navigator.hardwareConcurrency},Da:function(t,e,n){Xt.length=e,n>>=3;for(var r=0;r>>0];return(0>t?ut[-t-1]:fe[t]).apply(null,Xt)},qa:function(t){var e=r().length;if((t>>>=0)<=e||4294901760=n;n*=2){var a=e*(1+.2/n);a=Math.min(a,t+100663296);var i=Math;a=Math.max(t,a),i=i.min.call(i,4294901760,a+(65536-a%65536)%65536);t:{try{j.grow(i-D.byteLength+65535>>>16),N(j.buffer);var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},Na:function(){throw"unwind"},Ga:Qt,Ha:Kt,J:pt,I:te,S:ee,ga:ne,R:ie,d:function(){return oe},na:function t(r,a){t.lc||(t.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(_)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>at("randomDevice")}());for(var i=0;i>0>>>0]=t.lc();return 0},ia:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ja:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},K:function(t){var e=Ee();try{return gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},f:function(t,e){var n=Ee();try{return gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},P:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},Q:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},k:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},p:function(t,e,n,r){var a=Ee();try{return gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},q:function(t,e,n,r,a){var i=Ee();try{return gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},N:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},s:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},w:function(t,e,n,r,a,i,o){var u=Ee();try{return gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},L:function(t,e,n,r,a,i,o,u){var c=Ee();try{return gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},E:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{return gt(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=Ee();try{return He(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},_:function(t,e,n,r,a,i,o){var u=Ee();try{return ke(t,e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},Z:function(t,e,n,r,a){var i=Ee();try{return Le(t,e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},ca:function(t,e,n,r){var a=Ee();try{return Ie(t,e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},$:function(t){var e=Ee();try{return je(t)}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},ba:function(t,e){var n=Ee();try{return We(t,e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},Y:function(t,e,n){var r=Ee();try{return De(t,e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},g:function(t){var e=Ee();try{gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},r:function(t,e){var n=Ee();try{gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},i:function(t,e,n){var r=Ee();try{gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ha:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},m:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},v:function(t,e,n,r,a){var i=Ee();try{gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},u:function(t,e,n,r,a,i){var o=Ee();try{gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},O:function(t,e,n,r,a,i,o){var u=Ee();try{gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},A:function(t,e,n,r,a,i,o,u){var c=Ee();try{gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},ka:function(t,e,n,r,a,i,o,u,c){var s=Ee();try{gt(t)(e,n,r,a,i,o,u,c)}catch(t){if(Me(s),t!==t+0)throw t;Se(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l){var f=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(Me(f),t!==t+0)throw t;Se(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(Me(b),t!==t+0)throw t;Se(1,0)}},fa:function(t,e,n,r,a,i,o,u){var c=Ee();try{Pe(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},da:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{Fe(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},ea:function(t,e,n,r,a,i){var o=Ee();try{Ue(t,e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},o:function(t){return t},a:j||u.wasmMemory,G:function(t){oe=t},la:le,z:function(t,e,n,r){return le(t,e,n,r)}};!function(){function t(t,e){u.asm=t.exports,ht.qc.push(u.asm.sb),$=u.asm.ub,X.unshift(u.asm.Va),k=e,O||(et--,u.monitorRunDependencies&&u.monitorRunDependencies(et),0==et&&(null!==nt&&(clearInterval(nt),nt=null),rt&&(t=rt,rt=null,t())))}function e(e){t(e.instance,e.module)}function n(t){return function(){if(!M&&(v||w)){if("function"==typeof fetch&&!tt.startsWith("file://"))return fetch(tt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+tt+"\'";return t.arrayBuffer()})).catch((function(){return ot()}));if(f)return new Promise((function(t,e){f(tt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return ot()}))}().then((function(t){return WebAssembly.instantiate(t,r)})).then((function(t){return t})).then(t,(function(t){x("failed to asynchronously prepare wasm: "+t),at(t)}))}var r={a:pe};if(O||(et++,u.monitorRunDependencies&&u.monitorRunDependencies(et)),u.instantiateWasm)try{return u.instantiateWasm(r,t)}catch(t){return x("Module.instantiateWasm callback failed with error: "+t),!1}(M||"function"!=typeof WebAssembly.instantiateStreaming||it()||tt.startsWith("file://")||_||"function"!=typeof fetch?n(e):fetch(tt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,r).then(e,(function(t){return x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation"),n(e)}))}))).catch(s)}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.Va).apply(null,arguments)},u._OrtInit=function(){return(u._OrtInit=u.asm.Wa).apply(null,arguments)},u._OrtCreateSessionOptions=function(){return(u._OrtCreateSessionOptions=u.asm.Xa).apply(null,arguments)},u._OrtAppendExecutionProvider=function(){return(u._OrtAppendExecutionProvider=u.asm.Ya).apply(null,arguments)},u._OrtAddSessionConfigEntry=function(){return(u._OrtAddSessionConfigEntry=u.asm.Za).apply(null,arguments)},u._OrtReleaseSessionOptions=function(){return(u._OrtReleaseSessionOptions=u.asm._a).apply(null,arguments)},u._OrtCreateSession=function(){return(u._OrtCreateSession=u.asm.$a).apply(null,arguments)},u._OrtReleaseSession=function(){return(u._OrtReleaseSession=u.asm.ab).apply(null,arguments)},u._OrtGetInputCount=function(){return(u._OrtGetInputCount=u.asm.bb).apply(null,arguments)},u._OrtGetOutputCount=function(){return(u._OrtGetOutputCount=u.asm.cb).apply(null,arguments)},u._OrtGetInputName=function(){return(u._OrtGetInputName=u.asm.db).apply(null,arguments)},u._OrtGetOutputName=function(){return(u._OrtGetOutputName=u.asm.eb).apply(null,arguments)},u._OrtFree=function(){return(u._OrtFree=u.asm.fb).apply(null,arguments)},u._OrtCreateTensor=function(){return(u._OrtCreateTensor=u.asm.gb).apply(null,arguments)},u._OrtGetTensorData=function(){return(u._OrtGetTensorData=u.asm.hb).apply(null,arguments)},u._OrtReleaseTensor=function(){return(u._OrtReleaseTensor=u.asm.ib).apply(null,arguments)},u._OrtCreateRunOptions=function(){return(u._OrtCreateRunOptions=u.asm.jb).apply(null,arguments)},u._OrtAddRunConfigEntry=function(){return(u._OrtAddRunConfigEntry=u.asm.kb).apply(null,arguments)},u._OrtReleaseRunOptions=function(){return(u._OrtReleaseRunOptions=u.asm.lb).apply(null,arguments)},u._OrtRun=function(){return(u._OrtRun=u.asm.mb).apply(null,arguments)},u._OrtEndProfiling=function(){return(u._OrtEndProfiling=u.asm.nb).apply(null,arguments)};var he=u._pthread_self=function(){return(he=u._pthread_self=u.asm.ob).apply(null,arguments)},de=u._malloc=function(){return(de=u._malloc=u.asm.pb).apply(null,arguments)},ye=u._free=function(){return(ye=u._free=u.asm.qb).apply(null,arguments)},be=u._fflush=function(){return(be=u._fflush=u.asm.rb).apply(null,arguments)};u.__emscripten_tls_init=function(){return(u.__emscripten_tls_init=u.asm.sb).apply(null,arguments)};var me=u.___funcs_on_exit=function(){return(me=u.___funcs_on_exit=u.asm.tb).apply(null,arguments)},ge=u.__emscripten_thread_init=function(){return(ge=u.__emscripten_thread_init=u.asm.vb).apply(null,arguments)};u.__emscripten_thread_crashed=function(){return(u.__emscripten_thread_crashed=u.asm.wb).apply(null,arguments)};var ve,we=u._emscripten_run_in_main_runtime_thread_js=function(){return(we=u._emscripten_run_in_main_runtime_thread_js=u.asm.xb).apply(null,arguments)},_e=u.__emscripten_proxy_execute_task_queue=function(){return(_e=u.__emscripten_proxy_execute_task_queue=u.asm.yb).apply(null,arguments)},Oe=u.__emscripten_thread_free_data=function(){return(Oe=u.__emscripten_thread_free_data=u.asm.zb).apply(null,arguments)},Ae=u.__emscripten_thread_exit=function(){return(Ae=u.__emscripten_thread_exit=u.asm.Ab).apply(null,arguments)},Se=u._setThrew=function(){return(Se=u._setThrew=u.asm.Bb).apply(null,arguments)},Te=u._emscripten_stack_set_limits=function(){return(Te=u._emscripten_stack_set_limits=u.asm.Cb).apply(null,arguments)},Ee=u.stackSave=function(){return(Ee=u.stackSave=u.asm.Db).apply(null,arguments)},Me=u.stackRestore=function(){return(Me=u.stackRestore=u.asm.Eb).apply(null,arguments)},Ce=u.stackAlloc=function(){return(Ce=u.stackAlloc=u.asm.Fb).apply(null,arguments)},xe=u.___cxa_can_catch=function(){return(xe=u.___cxa_can_catch=u.asm.Gb).apply(null,arguments)},Re=u.___cxa_is_pointer_type=function(){return(Re=u.___cxa_is_pointer_type=u.asm.Hb).apply(null,arguments)},je=u.dynCall_j=function(){return(je=u.dynCall_j=u.asm.Ib).apply(null,arguments)},ke=u.dynCall_iiiiij=function(){return(ke=u.dynCall_iiiiij=u.asm.Jb).apply(null,arguments)},De=u.dynCall_jii=function(){return(De=u.dynCall_jii=u.asm.Kb).apply(null,arguments)},Pe=u.dynCall_viiiiij=function(){return(Pe=u.dynCall_viiiiij=u.asm.Lb).apply(null,arguments)},Ue=u.dynCall_vjji=function(){return(Ue=u.dynCall_vjji=u.asm.Mb).apply(null,arguments)},Fe=u.dynCall_viiijjjii=function(){return(Fe=u.dynCall_viiijjjii=u.asm.Nb).apply(null,arguments)},Ie=u.dynCall_iij=function(){return(Ie=u.dynCall_iij=u.asm.Ob).apply(null,arguments)},We=u.dynCall_ji=function(){return(We=u.dynCall_ji=u.asm.Pb).apply(null,arguments)},He=u.dynCall_iiiiiij=function(){return(He=u.dynCall_iiiiiij=u.asm.Qb).apply(null,arguments)},Le=u.dynCall_iiij=function(){return(Le=u.dynCall_iiij=u.asm.Rb).apply(null,arguments)};function ze(){function t(){if(!ve&&(ve=!0,u.calledRun=!0,!H)&&(O||dt(X),c(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!O)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();Z.unshift(t)}dt(Z)}}if(!(0{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){var e,r,a;t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise((function(t,e){r=t,a=e}));var i,o,u,c,s,l,f=Object.assign({},e),p="./this.program",h=(t,e)=>{throw e},d="object"==typeof window,y="function"==typeof importScripts,b="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";b?(m=y?n(908).dirname(m)+"/":"//",l=()=>{s||(c=n(384),s=n(908))},i=function(t,e){return l(),t=s.normalize(t),c.readFileSync(t,e?void 0:"utf8")},u=t=>((t=i(t,!0)).buffer||(t=new Uint8Array(t)),t),o=(t,e,n)=>{l(),t=s.normalize(t),c.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(_||0{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},y&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)});var g,v=e.print||console.log.bind(console),w=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(p=e.thisProgram),e.quit&&(h=e.quit),e.wasmBinary&&(g=e.wasmBinary);var _=e.noExitRuntime||!1;"object"!=typeof WebAssembly&&V("no native wasm support detected");var O,A,S,T,E,M,C=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function j(t,e){return(t>>>=0)?R(T,t,e):""}function k(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function D(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function P(){var t=O.buffer;A=t,e.HEAP8=S=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=E=new Int32Array(t),e.HEAPU8=T=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=M=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var U,F=[],I=[],W=[],H=[],L=0;function z(){var t=e.preRun.shift();F.unshift(t)}var Y,B=0,G=null,N=null;function V(t){throw e.onAbort&&e.onAbort(t),w(t="Aborted("+t+")"),C=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),a(t),t}function $(){return Y.startsWith("data:application/octet-stream;base64,")}if(Y="ort-wasm.wasm",!$()){var q=Y;Y=e.locateFile?e.locateFile(q,m):m+q}function X(){var t=Y;try{if(t==Y&&g)return new Uint8Array(g);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){V(t)}}function J(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Z(t){for(;0>2>>>0]=t},this.Eb=function(){return M[this.zb+4>>2>>>0]},this.Sb=function(t){M[this.zb+8>>2>>>0]=t},this.Wb=function(){return M[this.zb+8>>2>>>0]},this.Tb=function(){E[this.zb>>2>>>0]=0},this.Ib=function(t){S[this.zb+12>>0>>>0]=t?1:0},this.Pb=function(){return 0!=S[this.zb+12>>0>>>0]},this.Jb=function(t){S[this.zb+13>>0>>>0]=t?1:0},this.Lb=function(){return 0!=S[this.zb+13>>0>>>0]},this.Rb=function(t,e){this.Fb(0),this.Ub(t),this.Sb(e),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){E[this.zb>>2>>>0]+=1},this.Xb=function(){var t=E[this.zb>>2>>>0];return E[this.zb>>2>>>0]=t-1,1===t},this.Fb=function(t){M[this.zb+16>>2>>>0]=t},this.Ob=function(){return M[this.zb+16>>2>>>0]},this.Qb=function(){if(Mt(this.Eb()))return M[this.Db>>2>>>0];var t=this.Ob();return 0!==t?t:this.Db}}function nt(t){return vt(new et(t).zb)}var rt=[];function at(t){var e=rt[t];return e||(t>=rt.length&&(rt.length=t+1),rt[t]=e=U.get(t)),e}function it(t){var e=D(t)+1,n=gt(e);return n&&k(t,S,n,e),n}var ot={};function ut(){if(!ct){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:p||"./this.program"};for(t in ot)void 0===ot[t]?delete e[t]:e[t]=ot[t];var n=[];for(t in e)n.push(t+"="+e[t]);ct=n}return ct}var ct,st=[null,[],[]];function lt(t,e){var n=st[t];0===e||10===e?((1===t?v:w)(R(n,0)),n.length=0):n.push(e)}var ft=0;function pt(t){return 0==t%4&&(0!=t%100||0==t%400)}var ht=[31,29,31,30,31,30,31,31,30,31,30,31],dt=[31,28,31,30,31,30,31,31,30,31,30,31];function yt(t,e,n,r){function a(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=u(new Date(t.getFullYear(),0,4)),n=u(n),0>=o(e,t)?0>=o(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var s=E[r+40>>2>>>0];for(var l in r={$b:E[r>>2>>>0],Zb:E[r+4>>2>>>0],Gb:E[r+8>>2>>>0],Kb:E[r+12>>2>>>0],Hb:E[r+16>>2>>>0],Cb:E[r+20>>2>>>0],Ab:E[r+24>>2>>>0],Bb:E[r+28>>2>>>0],bc:E[r+32>>2>>>0],Yb:E[r+36>>2>>>0],ac:s?j(s):""},n=j(n),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(l,"g"),s[l]);var f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(l in s={"%a":function(t){return f[t.Ab].substring(0,3)},"%A":function(t){return f[t.Ab]},"%b":function(t){return p[t.Hb].substring(0,3)},"%B":function(t){return p[t.Hb]},"%C":function(t){return i((t.Cb+1900)/100|0,2)},"%d":function(t){return i(t.Kb,2)},"%e":function(t){return a(t.Kb,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return i(t.Gb,2)},"%I":function(t){return 0==(t=t.Gb)?t=12:12t.Gb?"AM":"PM"},"%S":function(t){return i(t.$b,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Ab||7},"%U":function(t){return i(Math.floor((t.Bb+7-t.Ab)/7),2)},"%V":function(t){var e=Math.floor((t.Bb+7-(t.Ab+6)%7)/7);if(2>=(t.Ab+371-t.Bb-2)%7&&e++,e)53==e&&(4==(n=(t.Ab+371-t.Bb)%7)||3==n&&pt(t.Cb)||(e=1));else{e=52;var n=(t.Ab+7-t.Bb-1)%7;(4==n||5==n&&pt(t.Cb%400-1))&&e++}return i(e,2)},"%w":function(t){return t.Ab},"%W":function(t){return i(Math.floor((t.Bb+7-(t.Ab+6)%7)/7),2)},"%y":function(t){return(t.Cb+1900).toString().substring(2)},"%Y":function(t){return t.Cb+1900},"%z":function(t){var e=0<=(t=t.Yb);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.ac},"%%":function(){return"%"}},n=n.replace(/%%/g,"\\0\\0"),s)n.includes(l)&&(n=n.replace(new RegExp(l,"g"),s[l](r)));return l=function(t){var e=Array(D(t)+1);return k(t,e,0,e.length),e}(n=n.replace(/\\0\\0/g,"%")),l.length>e?0:(S.set(l,t>>>0),l.length-1)}var bt={a:function(t){return gt(t+24)+24},m:function(t){return(t=new et(t)).Pb()||(t.Ib(!0),K--),t.Jb(!1),Q.push(t),t.Nb(),t.Qb()},ia:function(t){throw w("Unexpected exception thrown, this is not properly supported - aborting"),C=!0,t},w:function(){Ot(0);var t=Q.pop();if(t.Xb()&&!t.Lb()){var e=t.Wb();e&&at(e)(t.Db),nt(t.Db)}tt=0},d:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getUTCSeconds(),E[e+4>>2>>>0]=t.getUTCMinutes(),E[e+8>>2>>>0]=t.getUTCHours(),E[e+12>>2>>>0]=t.getUTCDate(),E[e+16>>2>>>0]=t.getUTCMonth(),E[e+20>>2>>>0]=t.getUTCFullYear()-1900,E[e+24>>2>>>0]=t.getUTCDay(),E[e+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(t,e){t=new Date(1e3*(M[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getSeconds(),E[e+4>>2>>>0]=t.getMinutes(),E[e+8>>2>>>0]=t.getHours(),E[e+12>>2>>>0]=t.getDate(),E[e+16>>2>>>0]=t.getMonth(),E[e+20>>2>>>0]=t.getFullYear()-1900,E[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1);E[e+28>>2>>>0]=(t.getTime()-n.getTime())/864e5|0,E[e+36>>2>>>0]=-60*t.getTimezoneOffset();var r=new Date(t.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),E[e+32>>2>>>0]=0|(r!=n&&t.getTimezoneOffset()==Math.min(n,r))},Fa:function(t){var e=new Date(E[t+20>>2>>>0]+1900,E[t+16>>2>>>0],E[t+12>>2>>>0],E[t+8>>2>>>0],E[t+4>>2>>>0],E[t>>2>>>0],0),n=E[t+32>>2>>>0],r=e.getTimezoneOffset(),a=new Date(e.getFullYear(),0,1),i=new Date(e.getFullYear(),6,1).getTimezoneOffset(),o=a.getTimezoneOffset(),u=Math.min(o,i);return 0>n?E[t+32>>2>>>0]=Number(i!=o&&u==r):0>2>>>0]=e.getDay(),E[t+28>>2>>>0]=(e.getTime()-a.getTime())/864e5|0,E[t>>2>>>0]=e.getSeconds(),E[t+4>>2>>>0]=e.getMinutes(),E[t+8>>2>>>0]=e.getHours(),E[t+12>>2>>>0]=e.getDate(),E[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function t(e,n,r){t.Vb||(t.Vb=!0,function(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}var a=(new Date).getFullYear(),i=new Date(a,0,1),o=new Date(a,6,1);a=i.getTimezoneOffset();var u=o.getTimezoneOffset();E[t>>2>>>0]=60*Math.max(a,u),E[e>>2>>>0]=Number(a!=u),t=r(i),e=r(o),t=it(t),e=it(e),u>2>>>0]=t,M[n+4>>2>>>0]=e):(M[n>>2>>>0]=e,M[n+4>>2>>>0]=t)}(e,n,r))},B:function(){V("")},ma:function(){return 4294901760},I:b?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),xa:function(t,e,n){T.copyWithin(t>>>0,e>>>0,e+n>>>0)},G:function(t){var e=T.length;if(4294901760<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296);var a=Math;r=Math.max(t,r),a=a.min.call(a,4294901760,r+(65536-r%65536)%65536);t:{try{O.grow(a-A.byteLength+65535>>>16),P();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},va:function(t,e){var n=0;return ut().forEach((function(r,a){var i=e+n;for(a=M[t+4*a>>2>>>0]=i,i=0;i>0>>>0]=r.charCodeAt(i);S[a>>0>>>0]=0,n+=r.length+1})),0},wa:function(t,e){var n=ut();M[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),M[e>>2>>>0]=r,0},ba:function(t){_||0>2>>>0],u=M[e+4>>2>>>0];e+=8;for(var c=0;c>>0]);a+=u}return M[r>>2>>>0]=a,0},c:function(){return ft},ja:function t(e,r){t.Mb||(t.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(b)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>V("randomDevice")}());for(var a=0;a>0>>>0]=t.Mb();return 0},ea:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},fa:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},J:function(t){var e=At();try{return at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},e:function(t,e){var n=At();try{return at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},N:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},O:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},j:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},o:function(t,e,n,r){var a=At();try{return at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},p:function(t,e,n,r,a){var i=At();try{return at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},M:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},r:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},v:function(t,e,n,r,a,i,o){var u=At();try{return at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},K:function(t,e,n,r,a,i,o,u){var c=At();try{return at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{return at(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},X:function(t,e,n,r,a,i,o,u){var c=At();try{return Ft(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},V:function(t,e,n,r,a,i,o){var u=At();try{return xt(t,e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},U:function(t,e,n,r,a){var i=At();try{return It(t,e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},Z:function(t,e,n,r){var a=At();try{return Pt(t,e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},W:function(t){var e=At();try{return Ct(t)}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},Y:function(t,e){var n=At();try{return Ut(t,e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},T:function(t,e,n){var r=At();try{return Rt(t,e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},f:function(t){var e=At();try{at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},q:function(t,e){var n=At();try{at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},h:function(t,e,n){var r=At();try{at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},da:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},l:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},t:function(t,e,n,r,a){var i=At();try{at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},u:function(t,e,n,r,a,i){var o=At();try{at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},x:function(t,e,n,r,a,i,o){var u=At();try{at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},z:function(t,e,n,r,a,i,o,u){var c=At();try{at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},ga:function(t,e,n,r,a,i,o,u,c){var s=At();try{at(t)(e,n,r,a,i,o,u,c)}catch(t){if(St(s),t!==t+0)throw t;Ot(1,0)}},A:function(t,e,n,r,a,i,o,u,c,s,l){var f=At();try{at(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(St(f),t!==t+0)throw t;Ot(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=At();try{at(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(St(b),t!==t+0)throw t;Ot(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=At();try{jt(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},_:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{Dt(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},$:function(t,e,n,r,a,i){var o=At();try{kt(t,e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},n:function(t){return t},F:function(t){ft=t},ha:yt,y:function(t,e,n,r){return yt(t,e,n,r)}};!function(){function t(t){e.asm=t.exports,O=e.asm.Ka,P(),U=e.asm.ib,I.unshift(e.asm.La),B--,e.monitorRunDependencies&&e.monitorRunDependencies(B),0==B&&(null!==G&&(clearInterval(G),G=null),N&&(t=N,N=null,t()))}function n(e){t(e.instance)}function r(t){return function(){if(!g&&(d||y)){if("function"==typeof fetch&&!Y.startsWith("file://"))return fetch(Y,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+Y+"\'";return t.arrayBuffer()})).catch((function(){return X()}));if(o)return new Promise((function(t,e){o(Y,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return X()}))}().then((function(t){return WebAssembly.instantiate(t,i)})).then((function(t){return t})).then(t,(function(t){w("failed to asynchronously prepare wasm: "+t),V(t)}))}var i={a:bt};if(B++,e.monitorRunDependencies&&e.monitorRunDependencies(B),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return w("Module.instantiateWasm callback failed with error: "+t),!1}(g||"function"!=typeof WebAssembly.instantiateStreaming||$()||Y.startsWith("file://")||b||"function"!=typeof fetch?r(n):fetch(Y,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(n,(function(t){return w("wasm streaming compile failed: "+t),w("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(a)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.La).apply(null,arguments)},e._OrtInit=function(){return(e._OrtInit=e.asm.Ma).apply(null,arguments)},e._OrtCreateSessionOptions=function(){return(e._OrtCreateSessionOptions=e.asm.Na).apply(null,arguments)},e._OrtAppendExecutionProvider=function(){return(e._OrtAppendExecutionProvider=e.asm.Oa).apply(null,arguments)},e._OrtAddSessionConfigEntry=function(){return(e._OrtAddSessionConfigEntry=e.asm.Pa).apply(null,arguments)},e._OrtReleaseSessionOptions=function(){return(e._OrtReleaseSessionOptions=e.asm.Qa).apply(null,arguments)},e._OrtCreateSession=function(){return(e._OrtCreateSession=e.asm.Ra).apply(null,arguments)},e._OrtReleaseSession=function(){return(e._OrtReleaseSession=e.asm.Sa).apply(null,arguments)},e._OrtGetInputCount=function(){return(e._OrtGetInputCount=e.asm.Ta).apply(null,arguments)},e._OrtGetOutputCount=function(){return(e._OrtGetOutputCount=e.asm.Ua).apply(null,arguments)},e._OrtGetInputName=function(){return(e._OrtGetInputName=e.asm.Va).apply(null,arguments)},e._OrtGetOutputName=function(){return(e._OrtGetOutputName=e.asm.Wa).apply(null,arguments)},e._OrtFree=function(){return(e._OrtFree=e.asm.Xa).apply(null,arguments)},e._OrtCreateTensor=function(){return(e._OrtCreateTensor=e.asm.Ya).apply(null,arguments)},e._OrtGetTensorData=function(){return(e._OrtGetTensorData=e.asm.Za).apply(null,arguments)},e._OrtReleaseTensor=function(){return(e._OrtReleaseTensor=e.asm._a).apply(null,arguments)},e._OrtCreateRunOptions=function(){return(e._OrtCreateRunOptions=e.asm.$a).apply(null,arguments)},e._OrtAddRunConfigEntry=function(){return(e._OrtAddRunConfigEntry=e.asm.ab).apply(null,arguments)},e._OrtReleaseRunOptions=function(){return(e._OrtReleaseRunOptions=e.asm.bb).apply(null,arguments)},e._OrtRun=function(){return(e._OrtRun=e.asm.cb).apply(null,arguments)},e._OrtEndProfiling=function(){return(e._OrtEndProfiling=e.asm.db).apply(null,arguments)};var mt,gt=e._malloc=function(){return(gt=e._malloc=e.asm.eb).apply(null,arguments)},vt=e._free=function(){return(vt=e._free=e.asm.fb).apply(null,arguments)},wt=e._fflush=function(){return(wt=e._fflush=e.asm.gb).apply(null,arguments)},_t=e.___funcs_on_exit=function(){return(_t=e.___funcs_on_exit=e.asm.hb).apply(null,arguments)},Ot=e._setThrew=function(){return(Ot=e._setThrew=e.asm.jb).apply(null,arguments)},At=e.stackSave=function(){return(At=e.stackSave=e.asm.kb).apply(null,arguments)},St=e.stackRestore=function(){return(St=e.stackRestore=e.asm.lb).apply(null,arguments)},Tt=e.stackAlloc=function(){return(Tt=e.stackAlloc=e.asm.mb).apply(null,arguments)},Et=e.___cxa_can_catch=function(){return(Et=e.___cxa_can_catch=e.asm.nb).apply(null,arguments)},Mt=e.___cxa_is_pointer_type=function(){return(Mt=e.___cxa_is_pointer_type=e.asm.ob).apply(null,arguments)},Ct=e.dynCall_j=function(){return(Ct=e.dynCall_j=e.asm.pb).apply(null,arguments)},xt=e.dynCall_iiiiij=function(){return(xt=e.dynCall_iiiiij=e.asm.qb).apply(null,arguments)},Rt=e.dynCall_jii=function(){return(Rt=e.dynCall_jii=e.asm.rb).apply(null,arguments)},jt=e.dynCall_viiiiij=function(){return(jt=e.dynCall_viiiiij=e.asm.sb).apply(null,arguments)},kt=e.dynCall_vjji=function(){return(kt=e.dynCall_vjji=e.asm.tb).apply(null,arguments)},Dt=e.dynCall_viiijjjii=function(){return(Dt=e.dynCall_viiijjjii=e.asm.ub).apply(null,arguments)},Pt=e.dynCall_iij=function(){return(Pt=e.dynCall_iij=e.asm.vb).apply(null,arguments)},Ut=e.dynCall_ji=function(){return(Ut=e.dynCall_ji=e.asm.wb).apply(null,arguments)},Ft=e.dynCall_iiiiiij=function(){return(Ft=e.dynCall_iiiiiij=e.asm.xb).apply(null,arguments)},It=e.dynCall_iiij=function(){return(It=e.dynCall_iiij=e.asm.yb).apply(null,arguments)};function Wt(){function t(){if(!mt&&(mt=!0,e.calledRun=!0,!C)){if(Z(I),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();H.unshift(t)}Z(H)}}if(!(0{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,n,r,a)=>{if("object"==typeof t&&null!==t){if(r.has(t))throw new Error("Circular reference in options");r.add(t)}Object.entries(t).forEach((([t,i])=>{const o=n?n+t:t;if("object"==typeof i)(0,e.iterateExtraOptions)(i,o+".",r,a);else if("string"==typeof i||"number"==typeof i)a(o,i.toString());else{if("boolean"!=typeof i)throw new Error("Can\'t handle extra config type: "+typeof i);a(o,i?"1":"0")}}))}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setRunOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(u.terminate=!1);let i=0;if(void 0!==(null==t?void 0:t.tag)&&(i=(0,a.allocWasmString)(t.tag,o)),n=e._OrtCreateRunOptions(u.logSeverityLevel,u.logVerbosityLevel,!!u.terminate,i),0===n)throw new Error("Can\'t create run options");return void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddRunConfigEntry(n,i,u))throw new Error(`Can\'t set a run config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseRunOptions(n),o.forEach(e._free),t}}},919:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setSessionOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(u);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(u.graphOptimizationLevel="all");const c=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}})(u.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(u.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(u.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(u.executionMode="sequential");const s=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}})(u.executionMode);let l=0;if(void 0!==(null==t?void 0:t.logId)&&(l=(0,a.allocWasmString)(t.logId,o)),void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(u.enableProfiling=!1),n=e._OrtCreateSessionOptions(c,!!u.enableCpuMemArena,!!u.enableMemPattern,s,!!u.enableProfiling,0,l,u.logSeverityLevel,u.logVerbosityLevel),0===n)throw new Error("Can\'t create session options");return(null==t?void 0:t.executionProviders)&&((t,e,n)=>{for(const r of e){let e="string"==typeof r?r:r.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${e}`)}const o=(0,a.allocWasmString)(e,n);if(0!==(0,i.getInstance)()._OrtAppendExecutionProvider(t,o))throw new Error(`Can\'t append execution provider: ${e}`)}})(n,t.executionProviders,o),void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddSessionConfigEntry(n,i,u))throw new Error(`Can\'t set a session config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseSessionOptions(n),o.forEach(e._free),t}}},983:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const r=n(361);e.allocWasmString=(t,e)=>{const n=(0,r.getInstance)(),a=n.lengthBytesUTF8(t)+1,i=n._malloc(a);return n.stringToUTF8(t,i,a),e.push(i),i}},349:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;const r=n(586),a=n(919),i=n(983),o=n(361);e.initOrt=(t,e)=>{const n=(0,o.getInstance)()._OrtInit(t,e);if(0!==n)throw new Error(`Can\'t initialize onnxruntime. error code = ${n}`)};const u=new Map;e.createSessionAllocate=t=>{const e=(0,o.getInstance)(),n=e._malloc(t.byteLength);return e.HEAPU8.set(t,n),[n,t.byteLength]},e.createSessionFinalize=(t,e)=>{const n=(0,o.getInstance)();let r=0,i=0,c=[];try{if([i,c]=(0,a.setSessionOptions)(e),r=n._OrtCreateSession(t[0],t[1],i),0===r)throw new Error("Can\'t create a session")}finally{n._free(t[0]),n._OrtReleaseSessionOptions(i),c.forEach(n._free)}const s=n._OrtGetInputCount(r),l=n._OrtGetOutputCount(r),f=[],p=[],h=[],d=[];for(let t=0;t{const r=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(r,n)},e.releaseSession=t=>{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=n[1],i=n[2];a.forEach(e._OrtFree),i.forEach(e._OrtFree),e._OrtReleaseSession(r),u.delete(t)};const c=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${t}`)}},s=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${t}`)}},l=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};e.run=(t,e,n,a,f)=>{const p=(0,o.getInstance)(),h=u.get(t);if(!h)throw new Error("invalid session id");const d=h[0],y=h[1],b=h[2],m=e.length,g=a.length;let v=0,w=[];const _=[],O=[];try{[v,w]=(0,r.setRunOptions)(f);for(let t=0;tp.HEAP32[t++]=e));const n=p._OrtCreateTensor(c(e),o,u,l,r.length);if(0===n)throw new Error("Can\'t create a tensor");_.push(n)}finally{p.stackRestore(s)}}const t=p.stackSave(),o=p.stackAlloc(4*m),u=p.stackAlloc(4*m),h=p.stackAlloc(4*g),A=p.stackAlloc(4*g);try{let n=o/4,r=u/4,i=h/4,c=A/4;for(let t=0;tt*e));if(a=s(o),"string"===a){const t=[];let e=i/4;for(let n=0;n{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=e._OrtEndProfiling(r);if(0===a)throw new Error("Can\'t get an profile file name");e._OrtFree(a)},e.extractTransferableBuffers=t=>{const e=[];for(const n of t){const t=n[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},361:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return a(e,t),e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const u=i(n(449)),c=o(n(932)),s=n(474);let l,f=!1,p=!1,h=!1;const d=(t,e)=>e?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":t?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async t=>{if(f)return Promise.resolve();if(p)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(h)throw new Error("previous call to \'initializeWebAssembly()\' failed.");p=!0;const e=t.initTimeout,r=t.numThreads,a=t.simd,i=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch(t){return!1}})(),o=a&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch(t){return!1}})(),y="string"==typeof t.wasmPaths?t.wasmPaths:void 0,b=d(!1,i),m=d(o,i),g="object"==typeof t.wasmPaths?t.wasmPaths[m]:void 0;let v=!1;const w=[];if(e>0&&w.push(new Promise((t=>{setTimeout((()=>{v=!0,t()}),e)}))),w.push(new Promise(((t,e)=>{const r=i?s:c.default,a={locateFile:(t,e)=>i&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(154)],{type:"text/javascript"})):t===b?null!=g?g:(null!=y?y:e)+m:e+t};if(i)if("undefined"==typeof Blob)a.mainScriptUrlOrBlob=u.join("/","ort-wasm-threaded.js");else{const t=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;a.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}r(a).then((e=>{p=!1,f=!0,l=e,t()}),(t=>{p=!1,h=!0,e(t)}))}))),await Promise.race(w),v)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(f&&l)return l;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!f||p||h||(p=!0,null===(t=l.PThread)||void 0===t||t.terminateAllThreads(),l=void 0,p=!1,f=!1,h=!0)}},154:t=>{"use strict";t.exports=\'"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\\n\'},384:()=>{},993:()=>{},908:()=>{},953:()=>{},925:()=>{},449:()=>{}},e={};function n(r){var a=e[r];if(void 0!==a)return a.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{"use strict";const t=n(349),e=n(361);self.onmessage=n=>{switch(n.data.type){case"init-wasm":(0,e.initializeWebAssembly)(n.data.in).then((()=>postMessage({type:"init-wasm"})),(t=>postMessage({type:"init-wasm",err:t})));break;case"init-ort":try{const{numThreads:e,loggingLevel:r}=n.data.in;(0,t.initOrt)(e,r),postMessage({type:"init-ort"})}catch(t){postMessage({type:"init-ort",err:t})}break;case"create_allocate":try{const{model:e}=n.data.in,r=(0,t.createSessionAllocate)(e);postMessage({type:"create_allocate",out:r})}catch(t){postMessage({type:"create_allocate",err:t})}break;case"create_finalize":try{const{modeldata:e,options:r}=n.data.in,a=(0,t.createSessionFinalize)(e,r);postMessage({type:"create_finalize",out:a})}catch(t){postMessage({type:"create_finalize",err:t})}break;case"create":try{const{model:e,options:r}=n.data.in,a=(0,t.createSession)(e,r);postMessage({type:"create",out:a})}catch(t){postMessage({type:"create",err:t})}break;case"release":try{const e=n.data.in;(0,t.releaseSession)(e),postMessage({type:"release"})}catch(t){postMessage({type:"release",err:t})}break;case"run":try{const{sessionId:e,inputIndices:r,inputs:a,outputIndices:i,options:o}=n.data.in,u=(0,t.run)(e,r,a,i,o);postMessage({type:"run",out:u},(0,t.extractTransferableBuffers)(u))}catch(t){postMessage({type:"run",err:t})}break;case"end-profiling":try{const e=n.data.in;(0,t.endProfiling)(e),postMessage({type:"end-profiling"})}catch(t){postMessage({type:"end-profiling",err:t})}}}})()})();\n',"Worker",void 0,void 0)}},477:t=>{"use strict";t.exports=function(t,e,r,n){var i=self||window;try{try{try{o=new i.Blob([t])}catch(e){(o=new(i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder)).append(t),o=o.getBlob()}var o,a=i.URL||i.webkitURL,s=a.createObjectURL(o),u=new i[e](s,r);return a.revokeObjectURL(s),u}catch(n){return new i[e]("data:application/javascript,".concat(encodeURIComponent(t)),r)}}catch(t){if(!n)throw Error("Inline worker is not supported");return new i[e](n,r)}}},4154:t=>{"use strict";t.exports='"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\n'},1670:t=>{"use strict";t.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(t,e,r)=>{"use strict";r.r(e),r.d(e,{flatbuffers:()=>n});var n={};n.Offset,n.Table,n.SIZEOF_SHORT=2,n.SIZEOF_INT=4,n.FILE_IDENTIFIER_LENGTH=4,n.SIZE_PREFIX_LENGTH=4,n.Encoding={UTF8_BYTES:1,UTF16_STRING:2},n.int32=new Int32Array(2),n.float32=new Float32Array(n.int32.buffer),n.float64=new Float64Array(n.int32.buffer),n.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],n.Long=function(t,e){this.low=0|t,this.high=0|e},n.Long.create=function(t,e){return 0==t&&0==e?n.Long.ZERO:new n.Long(t,e)},n.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},n.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},n.Long.ZERO=new n.Long(0,0),n.Builder=function(t){if(t)e=t;else var e=1024;this.bb=n.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},n.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},n.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},n.Builder.prototype.dataBuffer=function(){return this.bb},n.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},n.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var r=1+~(this.bb.capacity()-this.space+e)&t-1;this.space=0&&0==this.vtable[e];e--);for(var r=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var i=(r+2)*n.SIZEOF_SHORT;this.addInt16(i);var o=0,a=this.space;t:for(e=0;e=0;a--)this.writeInt8(o.charCodeAt(a))}this.prep(this.minalign,n.SIZEOF_INT+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},n.Builder.prototype.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},n.Builder.prototype.requiredField=function(t,e){var r=this.bb.capacity()-t,n=r-this.bb.readInt32(r);if(0==this.bb.readInt16(n+e))throw Error("FlatBuffers: field "+e+" must be set")},n.Builder.prototype.startVector=function(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(n.SIZEOF_INT,t*e),this.prep(r,t*e)},n.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},n.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var r=0;r=56320?i:(i<<10)+t.charCodeAt(r++)+-56613888)<128?e.push(n):(n<2048?e.push(n>>6&31|192):(n<65536?e.push(n>>12&15|224):e.push(n>>18&7|240,n>>12&63|128),e.push(n>>6&63|128)),e.push(63&n|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),r=0;for(var o=this.space,a=this.bb.bytes();r>24},n.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},n.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},n.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},n.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},n.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},n.ByteBuffer.prototype.readInt64=function(t){return new n.Long(this.readInt32(t),this.readInt32(t+4))},n.ByteBuffer.prototype.readUint64=function(t){return new n.Long(this.readUint32(t),this.readUint32(t+4))},n.ByteBuffer.prototype.readFloat32=function(t){return n.int32[0]=this.readInt32(t),n.float32[0]},n.ByteBuffer.prototype.readFloat64=function(t){return n.int32[n.isLittleEndian?0:1]=this.readInt32(t),n.int32[n.isLittleEndian?1:0]=this.readInt32(t+4),n.float64[0]},n.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},n.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},n.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},n.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},n.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},n.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},n.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},n.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},n.ByteBuffer.prototype.writeFloat32=function(t,e){n.float32[0]=e,this.writeInt32(t,n.int32[0])},n.ByteBuffer.prototype.writeFloat64=function(t,e){n.float64[0]=e,this.writeInt32(t,n.int32[n.isLittleEndian?0:1]),this.writeInt32(t+4,n.int32[n.isLittleEndian?1:0])},n.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length>10),56320+(1023&a)))}return i},n.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},n.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+n.SIZEOF_INT},n.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},n.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=n.FILE_IDENTIFIER_LENGTH)throw Error("FlatBuffers: file identifier must be length "+n.FILE_IDENTIFIER_LENGTH);for(var e=0;e{var e=t&&t.__esModule?()=>t.default:()=>t;return __nested_webpack_require_546802__.d(e,{a:e}),e},__nested_webpack_require_546802__.d=(t,e)=>{for(var r in e)__nested_webpack_require_546802__.o(e,r)&&!__nested_webpack_require_546802__.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},__nested_webpack_require_546802__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__nested_webpack_require_546802__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__nested_webpack_require_546802__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var __nested_webpack_exports__=__nested_webpack_require_546802__(6018);return __nested_webpack_exports__})())}}]); \ No newline at end of file diff --git a/_next/static/chunks/b75e687f.1f7b440207b462e5.js b/_next/static/chunks/b75e687f.1f7b440207b462e5.js new file mode 100644 index 0000000000000000000000000000000000000000..7cac80da34e80876bb2419fcd05c838b811c1439 --- /dev/null +++ b/_next/static/chunks/b75e687f.1f7b440207b462e5.js @@ -0,0 +1,26 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[497],{97797:function(e,t,n){!function(e){"use strict";let t,r,i,o,a;var s=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var d={exports:{}};ec=d.exports,ed="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==l&&l,eh=ef=function(){function e(){this.fetch=!1,this.DOMException=ed.DOMException}return e.prototype=ed,new e}(),function(e){var t=void 0!==eh&&eh||"undefined"!=typeof self&&self||void 0!==t&&t,n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function h(e){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function m(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(m)}),this.text=function(){var e,t,n,r=h(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,n=p(t=new FileReader),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=Array(t.length),r=0;r-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;o.test(this.url)?this.url=this.url.replace(o,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function A(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}}),t}function w(e,t){if(!(this instanceof w))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},v.call(y.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];w.redirect=function(e,t){if(-1===_.indexOf(t))throw RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(n,r){return new Promise(function(o,s){var l=new y(n,r);if(l.signal&&l.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function d(){u.abort()}u.onload=function(){var e,t,n={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new f,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}}),t)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var r="response"in u?u.response:u.responseText;setTimeout(function(){o(new w(r,n))},0)},u.onerror=function(){setTimeout(function(){s(TypeError("Network request failed"))},0)},u.ontimeout=function(){setTimeout(function(){s(TypeError("Network request failed"))},0)},u.onabort=function(){setTimeout(function(){s(new e.DOMException("Aborted","AbortError"))},0)},u.open(l.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(t){return e}}(l.url),!0),"include"===l.credentials?u.withCredentials=!0:"omit"===l.credentials&&(u.withCredentials=!1),"responseType"in u&&(i?u.responseType="blob":a&&l.headers.get("Content-Type")&&-1!==l.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof f?l.headers.forEach(function(e,t){u.setRequestHeader(t,e)}):Object.getOwnPropertyNames(r.headers).forEach(function(e){u.setRequestHeader(e,c(r.headers[e]))}),l.signal&&(l.signal.addEventListener("abort",d),u.onreadystatechange=function(){4===u.readyState&&l.signal.removeEventListener("abort",d)}),u.send(void 0===l._bodyInit?null:l._bodyInit)})}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=f,t.Request=y,t.Response=w),e.Headers=f,e.Request=y,e.Response=w,e.fetch=E}({}),ef.fetch.ponyfill=!0,delete ef.fetch.polyfill,(ec=(ep=ed.fetch?ed:ef).fetch).default=ep.fetch,ec.fetch=ep.fetch,ec.Headers=ep.Headers,ec.Request=ep.Request,ec.Response=ep.Response,d.exports=ec;var f=u(d.exports),h=[],p=[],m="undefined"!=typeof Uint8Array?Uint8Array:Array,g=!1;function v(){g=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)h[t]=e[t],p[e.charCodeAt(t)]=t;p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63}function b(e){var t;g||v();for(var n=e.length,r=n%3,i="",o=[],a=0,s=n-r;a>18&63]+h[r>>12&63]+h[r>>6&63]+h[63&r]);return i.join("")}(e,a,a+16383>s?s:a+16383));return 1===r?i+=h[(t=e[n-1])>>2]+h[t<<4&63]+"==":2===r&&(i+=h[(t=(e[n-2]<<8)+e[n-1])>>10]+h[t>>4&63]+h[t<<2&63]+"="),o.push(i),o.join("")}function y(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<>1,c=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=u}return(h?-1:1)*a*Math.pow(2,o-r)}function A(e,t,n,r,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,f=23===i?5960464477539062e-23:0,h=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?f/l:f*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*m}var w={}.toString,_=Array.isArray||function(e){return"[object Array]"==w.call(e)};M.TYPED_ARRAY_SUPPORT=void 0===s.TYPED_ARRAY_SUPPORT||s.TYPED_ARRAY_SUPPORT;var E=S();function S(){return M.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k(e,t){if(S()=S())throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+S().toString(16)+" bytes");return 0|e}function O(e){return!(null==e||!e._isBuffer)}function P(e,t){if(O(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return Y(e).length;t=(""+t).toLowerCase(),r=!0}}function L(e,t,n){var r,i,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r,i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var o="",a=t;a2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),isNaN(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return -1;n=e.length-1}else if(n<0){if(!i)return -1;n=0}if("string"==typeof t&&(t=M.from(t,r)),O(t))return 0===t.length?-1:B(e,t,n,r,i);if("number"==typeof t)return t&=255,M.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):B(e,[t],n,r,i);throw TypeError("val must be string, number or Buffer")}function B(e,t,n,r,i){var o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;os&&(n=s-l),o=n;o>=0;o--){for(var d=!0,f=0;f239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=F)return String.fromCharCode.apply(String,e);for(var n="",r=0;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},M.prototype.compare=function(e,t,n,r,i){if(!O(e))throw TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,i),u=e.slice(t,n),c=0;cp)&&(n=p),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var m=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i.push(n%256),i.push(r);return i}(e,this.length-f),this,f,h);default:if(m)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),m=!0}},M.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var F=4096;function z(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function U(e,t,n,r,i,o){if(!O(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function q(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function K(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function H(e,t,n,r,i,o){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function V(e,t,n,r,i){return i||H(e,0,n,4),A(e,t,n,r,23,4),n+4}function $(e,t,n,r,i){return i||H(e,0,n,8),A(e,t,n,r,52,8),n+8}M.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},M.prototype.readUInt8=function(e,t){return t||z(e,1,this.length),this[e]},M.prototype.readUInt16LE=function(e,t){return t||z(e,2,this.length),this[e]|this[e+1]<<8},M.prototype.readUInt16BE=function(e,t){return t||z(e,2,this.length),this[e]<<8|this[e+1]},M.prototype.readUInt32LE=function(e,t){return t||z(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},M.prototype.readUInt32BE=function(e,t){return t||z(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},M.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||z(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},M.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||z(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},M.prototype.readInt8=function(e,t){return t||z(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},M.prototype.readInt16LE=function(e,t){t||z(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},M.prototype.readInt16BE=function(e,t){t||z(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},M.prototype.readInt32LE=function(e,t){return t||z(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},M.prototype.readInt32BE=function(e,t){return t||z(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},M.prototype.readFloatLE=function(e,t){return t||z(e,4,this.length),y(this,e,!0,23,4)},M.prototype.readFloatBE=function(e,t){return t||z(e,4,this.length),y(this,e,!1,23,4)},M.prototype.readDoubleLE=function(e,t){return t||z(e,8,this.length),y(this,e,!0,52,8)},M.prototype.readDoubleBE=function(e,t){return t||z(e,8,this.length),y(this,e,!1,52,8)},M.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||U(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},M.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,1,255,0),M.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},M.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,65535,0),M.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},M.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,65535,0),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},M.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,4294967295,0),M.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):K(this,e,t,!0),t+4},M.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,4294967295,0),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):K(this,e,t,!1),t+4},M.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);U(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},M.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);U(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},M.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,1,127,-128),M.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},M.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,32767,-32768),M.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},M.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,32767,-32768),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},M.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,2147483647,-2147483648),M.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):K(this,e,t,!0),t+4},M.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):K(this,e,t,!1),t+4},M.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},M.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)},M.prototype.writeDoubleLE=function(e,t,n){return $(this,e,t,!0,n)},M.prototype.writeDoubleBE=function(e,t,n){return $(this,e,t,!1,n)},M.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw RangeError("sourceStart out of bounds");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!M.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!i){if(n>56319||a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function G(e){return function(e){g||v();var t,n,r,i,o,a,s=e.length;if(s%4>0)throw Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new m(3*s/4-o),r=o>0?s-4:s;var l=0;for(t=0,n=0;t>16&255,a[l++]=i>>8&255,a[l++]=255&i;return 2===o?(i=p[e.charCodeAt(t)]<<2|p[e.charCodeAt(t+1)]>>4,a[l++]=255&i):1===o&&(i=p[e.charCodeAt(t)]<<10|p[e.charCodeAt(t+1)]<<4|p[e.charCodeAt(t+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(W,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Q(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Z(e){return null!=e&&(!!e._isBuffer||J(e)||"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&J(e.slice(0,0)))}function J(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var X=Object.freeze({__proto__:null,Buffer:M,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),M.alloc(+e)},isBuffer:Z,kMaxLength:E}),ee={},et={},en={},er=c(X),ei={};function eo(){throw Error("setTimeout has not been defined")}function ea(){throw Error("clearTimeout has not been defined")}var es=eo,el=ea;function eu(e){if(es===setTimeout)return setTimeout(e,0);if((es===eo||!es)&&setTimeout)return es=setTimeout,setTimeout(e,0);try{return es(e,0)}catch(t){try{return es.call(null,e,0)}catch(t){return es.call(this,e,0)}}}"function"==typeof s.setTimeout&&(es=setTimeout),"function"==typeof s.clearTimeout&&(el=clearTimeout);var ec,ed,ef,eh,ep,em,eg=[],ev=!1,eb=-1;function ey(){ev&&em&&(ev=!1,em.length?eg=em.concat(eg):eb=-1,eg.length&&eA())}function eA(){if(!ev){var e=eu(ey);ev=!0;for(var t=eg.length;t;){for(em=eg,eg=[];++eb1)for(var n=1;n4294967295)throw RangeError("requested too many random bytes");var n=eO.allocUnsafe(e);if(e>0){if(e>65536)for(var r=0;r0&&a.length>i){a.warned=!0;var s=Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function eq(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function eK(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function eH(e,t){for(var n=Array(t);t--;)n[t]=e[t];return n}ej.prototype=Object.create(null),eF.EventEmitter=eF,eF.usingDomains=!1,eF.prototype.domain=void 0,eF.prototype._events=void 0,eF.prototype._maxListeners=void 0,eF.defaultMaxListeners=10,eF.init=function(){this.domain=null,eF.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new ej,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},eF.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},eF.prototype.getMaxListeners=function(){return ez(this)},eF.prototype.emit=function(e){var t,n,r,i,o,a,s,l="error"===e;if(a=this._events)l=l&&null==a.error;else if(!l)return!1;if(s=this.domain,l){if(t=arguments[1],!s){if(t instanceof Error)throw t;var u=Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=eH(e,r),o=0;o0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new ej,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r0?Reflect.ownKeys(this._events):[]};var eV=c(Object.freeze({__proto__:null,EventEmitter:eF,default:eF})),e$=eV.EventEmitter,eW="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},eY=/%[sdj%]/g;function eG(e){if(!tt(e)){for(var t=[],n=0;n=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),a=r[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),e5(t)?n.showHidden=t:t&&tm(n,t),tr(n.showHidden)&&(n.showHidden=!1),tr(n.depth)&&(n.depth=2),tr(n.colors)&&(n.colors=!1),tr(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=e1),e3(n,e,n.depth)}function e1(e,t){var n=e0.styles[t];return n?"\x1b["+e0.colors[n][0]+"m"+e+"\x1b["+e0.colors[n][1]+"m":e}function e2(e,t){return e}function e3(e,t,n){if(e.customInspect&&t&&tl(t.inspect)&&t.inspect!==e0&&(!t.constructor||t.constructor.prototype!==t)){var r,i,o=t.inspect(n,e);return tt(o)||(o=e3(e,o,n)),o}var a=function(e,t){if(tr(t))return e.stylize("undefined","undefined");if(tt(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return te(t)?e.stylize(""+t,"number"):e5(t)?e.stylize(""+t,"boolean"):e7(t)?e.stylize("null","null"):void 0}(e,t);if(a)return a;var s=Object.keys(t),l=(c={},s.forEach(function(e,t){c[e]=!0}),c);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),ts(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return e6(t);if(0===s.length){if(tl(t)){var u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(ti(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(ta(t))return e.stylize(Date.prototype.toString.call(t),"date");if(ts(t))return e6(t)}var c,d,f="",h=!1,p=["{","}"];return e8(t)&&(h=!0,p=["[","]"]),tl(t)&&(f=" [Function"+(t.name?": "+t.name:"")+"]"),ti(t)&&(f=" "+RegExp.prototype.toString.call(t)),ta(t)&&(f=" "+Date.prototype.toUTCString.call(t)),ts(t)&&(f=" "+e6(t)),0!==s.length||h&&0!=t.length?n<0?ti(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),d=h?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a60?i[0]+(""===r?"":r+"\n ")+" "+d.join(",\n ")+" "+i[1]:i[0]+r+" "+d.join(", ")+" "+i[1]):p[0]+f+p[1]}function e6(e){return"["+Error.prototype.toString.call(e)+"]"}function e4(e,t,n,r,i,o){var a,s,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),tg(r,i)||(a="["+i+"]"),s||(0>e.seen.indexOf(l.value)?(s=e7(n)?e3(e,l.value,null):e3(e,l.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),tr(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function e8(e){return Array.isArray(e)}function e5(e){return"boolean"==typeof e}function e7(e){return null===e}function e9(e){return null==e}function te(e){return"number"==typeof e}function tt(e){return"string"==typeof e}function tn(e){return"symbol"==typeof e}function tr(e){return void 0===e}function ti(e){return to(e)&&"[object RegExp]"===td(e)}function to(e){return"object"==typeof e&&null!==e}function ta(e){return to(e)&&"[object Date]"===td(e)}function ts(e){return to(e)&&("[object Error]"===td(e)||e instanceof Error)}function tl(e){return"function"==typeof e}function tu(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function tc(e){return Z(e)}function td(e){return Object.prototype.toString.call(e)}function tf(e){return e<10?"0"+e.toString(10):e.toString(10)}e0.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e0.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var th=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function tp(){var e,t;console.log("%s - %s",(t=[tf((e=new Date).getHours()),tf(e.getMinutes()),tf(e.getSeconds())].join(":"),[e.getDate(),th[e.getMonth()],t].join(" ")),eG.apply(null,arguments))}function tm(e,t){if(!t||!to(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function tg(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var tv,tb,ty=c(Object.freeze({__proto__:null,_extend:tm,debuglog:eX,default:{inherits:eW,_extend:tm,log:tp,isBuffer:tc,isPrimitive:tu,isFunction:tl,isError:ts,isDate:ta,isObject:to,isRegExp:ti,isUndefined:tr,isSymbol:tn,isString:tt,isNumber:te,isNullOrUndefined:e9,isNull:e7,isBoolean:e5,isArray:e8,inspect:e0,deprecate:eQ,format:eG,debuglog:eX},deprecate:eQ,format:eG,inherits:eW,inspect:e0,isArray:e8,isBoolean:e5,isBuffer:tc,isDate:ta,isError:ts,isFunction:tl,isNull:e7,isNullOrUndefined:e9,isNumber:te,isObject:to,isPrimitive:tu,isRegExp:ti,isString:tt,isSymbol:tn,isUndefined:tr,log:tp}));function tA(e,t){t_(e,t),tw(e)}function tw(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function t_(e,t){e.emit("error",t)}var tE={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ew(t_,this,e)):ew(t_,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?n._writableState?n._writableState.errorEmitted?ew(tw,n):(n._writableState.errorEmitted=!0,ew(tA,n,e)):ew(tA,n,e):t?(ew(tw,n),t(e)):ew(tw,n)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},tS={},tk={};function tM(e,t,n){n||(n=Error);var r=function(e){function n(n,r,i){return e.call(this,"string"==typeof t?t:t(n,r,i))||this}return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e,n}(n);r.prototype.name=n.name,r.prototype.code=e,tk[e]=r}function tC(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}tM("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),tM("ERR_INVALID_ARG_TYPE",function(e,t,n){if("string"==typeof t&&(i="not ",t.substr(!o||o<0?0:+o,i.length)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",s=" argument",(void 0===l||l>e.length)&&(l=e.length),e.substring(l-s.length,l)===s)a="The ".concat(e," ").concat(r," ").concat(tC(t,"type"));else{var r,i,o,a,s,l,u,c=("number"!=typeof u&&(u=0),u+1>e.length||-1===e.indexOf(".",u))?"argument":"property";a='The "'.concat(e,'" ').concat(c," ").concat(r," ").concat(tC(t,"type"))}return a+". Received type ".concat(typeof n)},TypeError),tM("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),tM("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),tM("ERR_STREAM_PREMATURE_CLOSE","Premature close"),tM("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),tM("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),tM("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),tM("ERR_STREAM_WRITE_AFTER_END","write after end"),tM("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),tM("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),tM("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),tS.codes=tk;var tx,tR,tI,tT,tO=tS.codes.ERR_INVALID_OPT_VALUE,tP={getHighWaterMark:function(e,t,n,r){var i=null!=t.highWaterMark?t.highWaterMark:r?t[n]:null;if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new tO(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}},tL=function(e,t){if(tN("noDeprecation"))return e;var n=!1;return function(){if(!n){if(tN("throwDeprecation"))throw Error(t);tN("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}};function tN(e){try{if(!l.localStorage)return!1}catch(e){return!1}var t=l.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}function tD(){if(tR)return tx;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(void 0),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}tR=1,tx=A,A.WritableState=y;var t,n,r={deprecate:tL},i=er.Buffer,o=(void 0!==l?l:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},a=tP.getHighWaterMark,s=tS.codes,u=s.ERR_INVALID_ARG_TYPE,c=s.ERR_METHOD_NOT_IMPLEMENTED,d=s.ERR_MULTIPLE_CALLBACK,f=s.ERR_STREAM_CANNOT_PIPE,h=s.ERR_STREAM_DESTROYED,p=s.ERR_STREAM_NULL_VALUES,m=s.ERR_STREAM_WRITE_AFTER_END,g=s.ERR_UNKNOWN_ENCODING,v=tE.errorOrDestroy;function b(){}function y(n,r,i){t=t||tB(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=a(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new d;if(n.writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t)--n.pendingcb,r?(ew(i,t),ew(M,e,n),e._writableState.errorEmitted=!0,v(e,t)):(i(t),e._writableState.errorEmitted=!0,v(e,t),M(e,n));else{var o=S(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||E(e,n),r?ew(_,e,n,o,i):_(e,n,o,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function A(e){var r=this instanceof(t=t||tB());if(!r&&!n.call(A,this))return new A(e);this._writableState=new y(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),e$.call(this)}function w(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new h("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function _(e,t,n,r){n||0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain")),t.pendingcb--,r(),M(e,t)}function E(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=Array(n.bufferedRequestCount),o=n.corkedRequestsFree;o.entry=r;for(var a=0,s=!0;r;)i[a]=r,r.isBuf||(s=!1),r=r.next,a+=1;i.allBuffers=s,w(t,n,!0,n.length,i,"",o.finish),n.pendingcb++,n.lastBufferedRequest=null,o.next?(n.corkedRequestsFree=o.next,o.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,c=r.callback;if(w(t,n,!1,n.objectMode?1:l.length,l,u,c),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(n){t.pendingcb--,n&&v(e,n),t.prefinished=!0,e.emit("prefinish"),M(e,t)})}function M(e,t){var n=S(t);if(n&&(t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,ew(k,e,t))),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return eD(A,e$),y.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(y.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===A&&e&&e._writableState instanceof y}})):n=function(e){return e instanceof this},A.prototype.pipe=function(){v(this,new f)},A.prototype.write=function(e,t,n){var r,a,s,l,c,d,f,h=this._writableState,g=!1,y=!h.objectMode&&(f=e,i.isBuffer(f)||f instanceof o);return y&&!i.isBuffer(e)&&(r=e,e=i.from(r)),"function"==typeof t&&(n=t,t=null),y?t="buffer":t||(t=h.defaultEncoding),"function"!=typeof n&&(n=b),h.ending?(a=n,v(this,s=new m),ew(a,s)):!y&&(l=e,c=n,null===l?d=new p:"string"==typeof l||h.objectMode||(d=new u("chunk",["string","Buffer"],l)),d&&(v(this,d),ew(c,d),1))||(h.pendingcb++,g=function(e,t,n,r,o,a){if(!n){var s,l,u=(s=r,l=o,t.objectMode||!1===t.decodeStrings||"string"!=typeof s||(s=i.from(s,l)),s);r!==u&&(n=!0,o="buffer",r=u)}var c=t.objectMode?1:r.length;t.length+=c;var d=t.length-1))throw new g(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,n){n(new c("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var r,i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||(r=n,i.ending=!0,M(this,i),r&&(i.finished?ew(r):this.once("finish",r)),i.ended=!0,this.writable=!1),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=tE.destroy,A.prototype._undestroy=tE.undestroy,A.prototype._destroy=function(e,t){t(e)},tx}function tB(){if(tT)return tI;tT=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};tI=a;var t=tQ(),n=tD();eD(a,t);for(var r=e(n.prototype),i=0;i>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function s(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function c(e){return e&&e.length?this.write(e):""}return tF.StringDecoder=n,n.prototype.write=function(e){var t,n;if(0===e.length)return"";if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(o>0&&(e.lastNeed=o-1),o):--i=0?(o>0&&(e.lastNeed=o-2),o):--i=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},tF}var tU=tS.codes.ERR_STREAM_PREMATURE_CLOSE;function tq(){}var tK,tH,tV,t$,tW,tY,tG=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),i=r||tq,o=!1,r=function(){if(!o){o=!0;for(var e=arguments.length,t=Array(e),n=0;n0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var t,n,r=i.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,n=a,i.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return r}},{key:"consume",value:function(e,t){var n;return ei.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=i.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,a),0==(e-=a)){a===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++r}return this.length-=r,t}},{key:a,value:function(e,n){return o(this,t(t({},n),{},{depth:0,customInspect:!1}))}}],n(s.prototype,e),r&&n(s,r),Object.defineProperty(s,"prototype",{writable:!1}),s}()}(),c=tP.getHighWaterMark,d=tS.codes,f=d.ERR_INVALID_ARG_TYPE,h=d.ERR_STREAM_PUSH_AFTER_EOF,p=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;eD(y,e$);var g=tE.errorOrDestroy,v=["error","close","destroy","pause","resume"];function b(e,t,n){r=r||tB(),e=e||{},"boolean"!=typeof n&&(n=t instanceof r),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=c(this,e,"readableHighWaterMark",n),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(o||(o=tz().StringDecoder),this.decoder=new o(e.encoding),this.encoding=e.encoding)}function y(e){if(r=r||tB(),!(this instanceof y))return new y(e);var t=this instanceof r;this._readableState=new b(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),e$.call(this)}function A(e,r,o,a,s){i("readableAddChunk",r);var l,u,c,d,p=e._readableState;if(null===r)p.reading=!1,function(e,t){if(i("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?E(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,S(e)))}}(e,p);else if(s||(l=r,t.isBuffer(l)||l instanceof n||"string"==typeof l||void 0===l||p.objectMode||(u=new f("chunk",["string","Buffer","Uint8Array"],l)),d=u),d)g(e,d);else if(p.objectMode||r&&r.length>0){if("string"==typeof r||p.objectMode||Object.getPrototypeOf(r)===t.prototype||(c=r,r=t.from(c)),a)p.endEmitted?g(e,new m):w(e,p,r,!0);else if(p.ended)g(e,new h);else{if(p.destroyed)return!1;p.reading=!1,p.decoder&&!o?(r=p.decoder.write(r),p.objectMode||0!==r.length?w(e,p,r,!1):k(e,p)):w(e,p,r,!1)}}else a||(p.reading=!1,k(e,p));return!p.ended&&(p.lengtht.highWaterMark&&(t.highWaterMark=((n=e)>=1073741824?n=1073741824:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function E(e){var t=e._readableState;i("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(i("emitReadable",t.flowing),t.emittedReadable=!0,ew(S,e))}function S(e){var t=e._readableState;i("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,I(e)}function k(e,t){t.readingMore||(t.readingMore=!0,ew(M,e,t))}function M(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function x(e){i("readable nexttick read 0"),e.read(0)}function R(e,t){i("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),I(e),t.flowing&&!t.reading&&e.read(0)}function I(e){var t=e._readableState;for(i("flow",t.flowing);t.flowing&&null!==e.read(););}function T(e,t){var n;return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n)}function O(e){var t=e._readableState;i("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,ew(P,t,e))}function P(e,t){if(i("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function L(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return i("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):E(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&O(this),null;var r,o=t.needReadable;return i("need readable",o),(0===t.length||t.length-e0?T(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&O(this)),null!==r&&this.emit("data",r),r},y.prototype._read=function(e){g(this,new p("_read()"))},y.prototype.pipe=function(t,n){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,i("pipe count=%d opts=%j",o.pipesCount,n);var a=n&&!1===n.end||t===ex.stdout||t===ex.stderr?p:s;function s(){i("onend"),t.end()}o.endEmitted?ew(a):r.once("end",a),t.on("unpipe",function e(n,a){i("onunpipe"),n===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,i("cleanup"),t.removeListener("close",f),t.removeListener("finish",h),t.removeListener("drain",l),t.removeListener("error",d),t.removeListener("unpipe",e),r.removeListener("end",s),r.removeListener("end",p),r.removeListener("data",c),u=!0,o.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&l())});var l=function(){var t=r._readableState;i("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e(r,"data")&&(t.flowing=!0,I(r))};t.on("drain",l);var u=!1;function c(e){i("ondata");var n=t.write(e);i("dest.write",n),!1===n&&((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==L(o.pipes,t))&&!u&&(i("false write response, pause",o.awaitDrain),o.awaitDrain++),r.pause())}function d(n){i("onerror",n),p(),t.removeListener("error",d),0===e(t,"error")&&g(t,n)}function f(){t.removeListener("finish",h),p()}function h(){i("onfinish"),t.removeListener("close",f),p()}function p(){i("unpipe"),r.unpipe(t)}return r.on("data",c),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(t,"error",d),t.once("close",f),t.once("finish",h),t.emit("pipe",r),o.flowing||(i("pipe resume"),r.resume()),t},y.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,i("on readable",r.length,r.reading),r.length?E(this):r.reading||ew(x,this))),n},y.prototype.addListener=y.prototype.on,y.prototype.removeListener=function(e,t){var n=e$.prototype.removeListener.call(this,e,t);return"readable"===e&&ew(C,this),n},y.prototype.removeAllListeners=function(e){var t=e$.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||ew(C,this),t},y.prototype.resume=function(){var e=this._readableState;return e.flowing||(i("resume"),e.flowing=!e.readableListening,e.resumeScheduled||(e.resumeScheduled=!0,ew(R,this,e))),e.paused=!1,this},y.prototype.pause=function(){return i("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(i("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},y.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var o in e.on("end",function(){if(i("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(o){i("wrapped data"),n.decoder&&(o=n.decoder.write(o)),n.objectMode&&null==o||(n.objectMode||o&&o.length)&&(t.push(o)||(r=!0,e.pause()))}),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var a=0;a0,l=s=function(e){i||(i=e),e&&a.forEach(nn),f||(a.forEach(nn),o(i))},u=!1,s=function(){u||(u=!0,l.apply(void 0,arguments))},c=!1,e.on("close",function(){c=!0}),void 0===rG&&(rG=tG),rG(e,{readable:f,writable:r},function(e){if(e)return s(e);c=!0,s()}),d=!1,function(t){if(!c&&!d)return d=!0,e.setHeader&&"function"==typeof e.abort?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new ne("pipe"))}});return t.reduce(nr)};var ni=eB.exports,no=eT().Buffer,na=ni.Transform;function ns(e){na.call(this),this._block=no.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}eD(ns,na),ns.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},ns.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},ns.prototype.update=function(e,t){if(function(e,t){if(!no.isBuffer(e)&&"string"!=typeof e)throw TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw Error("Digest already called");no.isBuffer(e)||(e=no.from(e,t));for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var i=this._blockOffset;i0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},ns.prototype._update=function(){throw Error("_update is not implemented")},ns.prototype.digest=function(e){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},ns.prototype._digest=function(){throw Error("_digest is not implemented")};var nl=eT().Buffer,nu=Array(16);function nc(){ns.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function nd(e,t){return e<>>32-t}function nf(e,t,n,r,i,o,a){return nd(e+(t&n|~t&r)+i+o|0,a)+t|0}function nh(e,t,n,r,i,o,a){return nd(e+(t&r|n&~r)+i+o|0,a)+t|0}function np(e,t,n,r,i,o,a){return nd(e+(t^n^r)+i+o|0,a)+t|0}function nm(e,t,n,r,i,o,a){return nd(e+(n^(t|~r))+i+o|0,a)+t|0}eD(nc,ns),nc.prototype._update=function(){for(var e=0;e<16;++e)nu[e]=this._block.readInt32LE(4*e);var t=this._a,n=this._b,r=this._c,i=this._d;t=nf(t,n,r,i,nu[0],3614090360,7),i=nf(i,t,n,r,nu[1],3905402710,12),r=nf(r,i,t,n,nu[2],606105819,17),n=nf(n,r,i,t,nu[3],3250441966,22),t=nf(t,n,r,i,nu[4],4118548399,7),i=nf(i,t,n,r,nu[5],1200080426,12),r=nf(r,i,t,n,nu[6],2821735955,17),n=nf(n,r,i,t,nu[7],4249261313,22),t=nf(t,n,r,i,nu[8],1770035416,7),i=nf(i,t,n,r,nu[9],2336552879,12),r=nf(r,i,t,n,nu[10],4294925233,17),n=nf(n,r,i,t,nu[11],2304563134,22),t=nf(t,n,r,i,nu[12],1804603682,7),i=nf(i,t,n,r,nu[13],4254626195,12),r=nf(r,i,t,n,nu[14],2792965006,17),t=nh(t,n=nf(n,r,i,t,nu[15],1236535329,22),r,i,nu[1],4129170786,5),i=nh(i,t,n,r,nu[6],3225465664,9),r=nh(r,i,t,n,nu[11],643717713,14),n=nh(n,r,i,t,nu[0],3921069994,20),t=nh(t,n,r,i,nu[5],3593408605,5),i=nh(i,t,n,r,nu[10],38016083,9),r=nh(r,i,t,n,nu[15],3634488961,14),n=nh(n,r,i,t,nu[4],3889429448,20),t=nh(t,n,r,i,nu[9],568446438,5),i=nh(i,t,n,r,nu[14],3275163606,9),r=nh(r,i,t,n,nu[3],4107603335,14),n=nh(n,r,i,t,nu[8],1163531501,20),t=nh(t,n,r,i,nu[13],2850285829,5),i=nh(i,t,n,r,nu[2],4243563512,9),r=nh(r,i,t,n,nu[7],1735328473,14),t=np(t,n=nh(n,r,i,t,nu[12],2368359562,20),r,i,nu[5],4294588738,4),i=np(i,t,n,r,nu[8],2272392833,11),r=np(r,i,t,n,nu[11],1839030562,16),n=np(n,r,i,t,nu[14],4259657740,23),t=np(t,n,r,i,nu[1],2763975236,4),i=np(i,t,n,r,nu[4],1272893353,11),r=np(r,i,t,n,nu[7],4139469664,16),n=np(n,r,i,t,nu[10],3200236656,23),t=np(t,n,r,i,nu[13],681279174,4),i=np(i,t,n,r,nu[0],3936430074,11),r=np(r,i,t,n,nu[3],3572445317,16),n=np(n,r,i,t,nu[6],76029189,23),t=np(t,n,r,i,nu[9],3654602809,4),i=np(i,t,n,r,nu[12],3873151461,11),r=np(r,i,t,n,nu[15],530742520,16),t=nm(t,n=np(n,r,i,t,nu[2],3299628645,23),r,i,nu[0],4096336452,6),i=nm(i,t,n,r,nu[7],1126891415,10),r=nm(r,i,t,n,nu[14],2878612391,15),n=nm(n,r,i,t,nu[5],4237533241,21),t=nm(t,n,r,i,nu[12],1700485571,6),i=nm(i,t,n,r,nu[3],2399980690,10),r=nm(r,i,t,n,nu[10],4293915773,15),n=nm(n,r,i,t,nu[1],2240044497,21),t=nm(t,n,r,i,nu[8],1873313359,6),i=nm(i,t,n,r,nu[15],4264355552,10),r=nm(r,i,t,n,nu[6],2734768916,15),n=nm(n,r,i,t,nu[13],1309151649,21),t=nm(t,n,r,i,nu[4],4149444226,6),i=nm(i,t,n,r,nu[11],3174756917,10),r=nm(r,i,t,n,nu[2],718787259,15),n=nm(n,r,i,t,nu[9],3951481745,21),this._a=this._a+t|0,this._b=this._b+n|0,this._c=this._c+r|0,this._d=this._d+i|0},nc.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=nl.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var ng=er.Buffer,nv=Array(16),nb=[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],ny=[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],nA=[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],nw=[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];function n_(){ns.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function nE(e,t){return e<>>32-t}eD(n_,ns),n_.prototype._update=function(){for(var e,t,n,r,i,o,a,s,l,u,c,d,f,h,p,m,g,v,b,y,A,w,_,E,S,k,M,C,x,R,I,T,O,P,L,N,D,B,j,F,z,U,q,K,H,V,$,W,Y,G,Q,Z,J=0;J<16;++J)nv[J]=this._block.readInt32LE(4*J);for(var X=0|this._a,ee=0|this._b,et=0|this._c,en=0|this._d,er=0|this._e,ei=0|this._a,eo=0|this._b,ea=0|this._c,es=0|this._d,el=0|this._e,eu=0;eu<80;eu+=1)eu<16?(e=X,t=ee,n=et,r=en,i=er,Q=nE(e+(t^n^r)+nv[nb[eu]]+0|0,nA[eu])+i|0,o=ei,a=eo,s=ea,l=es,u=el,Z=nE(o+(a^(s|~l))+nv[ny[eu]]+1352829926|0,nw[eu])+u|0):eu<32?(c=X,d=ee,f=et,h=en,p=er,Q=nE(c+(d&f|~d&h)+nv[nb[eu]]+1518500249|0,nA[eu])+p|0,m=ei,g=eo,v=ea,b=es,y=el,Z=nE(m+(g&b|v&~b)+nv[ny[eu]]+1548603684|0,nw[eu])+y|0):eu<48?(A=X,w=ee,_=et,E=en,S=er,Q=nE(A+((w|~_)^E)+nv[nb[eu]]+1859775393|0,nA[eu])+S|0,k=ei,M=eo,C=ea,x=es,R=el,Z=nE(k+((M|~C)^x)+nv[ny[eu]]+1836072691|0,nw[eu])+R|0):eu<64?(I=X,T=ee,O=et,P=en,L=er,Q=nE(I+(T&P|O&~P)+nv[nb[eu]]+2400959708|0,nA[eu])+L|0,N=ei,D=eo,B=ea,j=es,F=el,Z=nE(N+(D&B|~D&j)+nv[ny[eu]]+2053994217|0,nw[eu])+F|0):(z=X,U=ee,q=et,K=en,H=er,Q=nE(z+(U^(q|~K))+nv[nb[eu]]+2840853838|0,nA[eu])+H|0,V=ei,$=eo,W=ea,Y=es,G=el,Z=nE(V+($^W^Y)+nv[ny[eu]]+0|0,nw[eu])+G|0),X=er,er=en,en=nE(et,10),et=ee,ee=Q,ei=el,el=es,es=nE(ea,10),ea=eo,eo=Z;var ec=this._b+et+es|0;this._b=this._c+en+el|0,this._c=this._d+er+ei|0,this._d=this._e+X+eo|0,this._e=this._a+ee+ea|0,this._a=ec},n_.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=ng.alloc?ng.alloc(20):new ng(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var nS={exports:{}},nk=eT().Buffer;function nM(e,t){this._block=nk.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}nM.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=nk.from(e,t));for(var n=this._block,r=this._blockSize,i=e.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0;this._block.writeUInt32BE((n-r)/4294967296,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var i=this._hash();return e?i.toString(e):i},nM.prototype._update=function(){throw Error("_update must be implemented by subclass")};var nC=eT().Buffer,nx=[1518500249,1859775393,-1894007588,-899497514],nR=Array(80);function nI(){this.init(),this._w=nR,nM.call(this,64,56)}eD(nI,nM),nI.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},nI.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,l=0;l<16;++l)n[l]=e.readInt32BE(4*l);for(;l<80;++l)n[l]=n[l-3]^n[l-8]^n[l-14]^n[l-16];for(var u=0;u<80;++u){var c,d,f,h,p=~~(u/20),m=0|((t=r)<<5|t>>>27)+(c=i,d=o,f=a,0===p?c&d|~c&f:2===p?c&d|c&f|d&f:c^d^f)+s+n[u]+nx[p];s=a,a=o,o=(h=i)<<30|h>>>2,i=r,r=m}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},nI.prototype._hash=function(){var e=nC.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var nT=eT().Buffer,nO=[1518500249,1859775393,-1894007588,-899497514],nP=Array(80);function nL(){this.init(),this._w=nP,nM.call(this,64,56)}eD(nL,nM),nL.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},nL.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,l=0;l<16;++l)n[l]=e.readInt32BE(4*l);for(;l<80;++l)n[l]=(t=n[l-3]^n[l-8]^n[l-14]^n[l-16])<<1|t>>>31;for(var u=0;u<80;++u){var c,d,f,h,p,m=~~(u/20),g=((c=r)<<5|c>>>27)+(d=i,f=o,h=a,0===m?d&f|~d&h:2===m?d&f|d&h|f&h:d^f^h)+s+n[u]+nO[m]|0;s=a,a=o,o=(p=i)<<30|p>>>2,i=r,r=g}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},nL.prototype._hash=function(){var e=nT.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var nN=eT().Buffer,nD=[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],nB=Array(64);function nj(){this.init(),this._w=nB,nM.call(this,64,56)}eD(nj,nM),nj.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},nj.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._f,l=0|this._g,u=0|this._h,c=0;c<16;++c)t[c]=e.readInt32BE(4*c);for(;c<64;++c)t[c]=(((f=t[c-2])>>>17|f<<15)^(f>>>19|f<<13)^f>>>10)+t[c-7]+(((h=t[c-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3)+t[c-16]|0;for(var d=0;d<64;++d){var f,h,p,m,g,v,b,y,A,w=u+(((p=a)>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(m=a,g=s,(v=l)^m&(g^v))+nD[d]+t[d]|0,_=(((b=n)>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+((y=n)&(A=r)|i&(y|A))|0;u=l,l=s,s=a,a=o+w|0,o=i,i=r,r=n,n=w+_|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=s+this._f|0,this._g=l+this._g|0,this._h=u+this._h|0},nj.prototype._hash=function(){var e=nN.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var nF=eT().Buffer,nz=Array(64);function nU(){this.init(),this._w=nz,nM.call(this,64,56)}eD(nU,nj),nU.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},nU.prototype._hash=function(){var e=nF.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var nq=eT().Buffer,nK=[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],nH=Array(160);function nV(){this.init(),this._w=nH,nM.call(this,128,112)}function n$(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function nW(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function nY(e,t){return e>>>0>>0?1:0}eD(nV,nM),nV.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},nV.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,l=0|this._gh,u=0|this._hh,c=0|this._al,d=0|this._bl,f=0|this._cl,h=0|this._dl,p=0|this._el,m=0|this._fl,g=0|this._gl,v=0|this._hl,b=0;b<32;b+=2)t[b]=e.readInt32BE(4*b),t[b+1]=e.readInt32BE(4*b+4);for(;b<160;b+=2){var y,A,w,_,E,S,k,M,C=t[b-30],x=t[b-30+1],R=((y=C)>>>1|(A=x)<<31)^(y>>>8|A<<24)^y>>>7,I=((w=x)>>>1|(_=C)<<31)^(w>>>8|_<<24)^(w>>>7|_<<25),T=((E=C=t[b-4])>>>19|(S=x=t[b-4+1])<<13)^(S>>>29|E<<3)^E>>>6,O=((k=x)>>>19|(M=C)<<13)^(M>>>29|k<<3)^(k>>>6|M<<26),P=t[b-14],L=t[b-14+1],N=t[b-32],D=t[b-32+1],B=I+L|0,j=R+P+nY(B,I)|0;j=(j=j+T+nY(B=B+O|0,O)|0)+N+nY(B=B+D|0,D)|0,t[b]=j,t[b+1]=B}for(var F=0;F<160;F+=2){j=t[F],B=t[F+1];var z,U,q,K,H,V,$,W,Y,G,Q=(z=n)&(U=r)|i&(z|U),Z=(q=c)&(K=d)|f&(q|K),J=n$(n,c),X=n$(c,n),ee=nW(a,p),et=nW(p,a),en=nK[F],er=nK[F+1],ei=(H=a,V=s,($=l)^H&(V^$)),eo=(W=p,Y=m,(G=g)^W&(Y^G)),ea=v+et|0,es=u+ee+nY(ea,v)|0;es=(es=(es=es+ei+nY(ea=ea+eo|0,eo)|0)+en+nY(ea=ea+er|0,er)|0)+j+nY(ea=ea+B|0,B)|0;var el=X+Z|0,eu=J+Q+nY(el,X)|0;u=l,v=g,l=s,g=m,s=a,m=p,a=o+es+nY(p=h+ea|0,h)|0,o=i,h=f,i=r,f=d,r=n,d=c,n=es+eu+nY(c=ea+el|0,ea)|0}this._al=this._al+c|0,this._bl=this._bl+d|0,this._cl=this._cl+f|0,this._dl=this._dl+h|0,this._el=this._el+p|0,this._fl=this._fl+m|0,this._gl=this._gl+g|0,this._hl=this._hl+v|0,this._ah=this._ah+n+nY(this._al,c)|0,this._bh=this._bh+r+nY(this._bl,d)|0,this._ch=this._ch+i+nY(this._cl,f)|0,this._dh=this._dh+o+nY(this._dl,h)|0,this._eh=this._eh+a+nY(this._el,p)|0,this._fh=this._fh+s+nY(this._fl,m)|0,this._gh=this._gh+l+nY(this._gl,g)|0,this._hh=this._hh+u+nY(this._hl,v)|0},nV.prototype._hash=function(){var e=nq.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var nG=eT().Buffer,nQ=Array(160);function nZ(){this.init(),this._w=nQ,nM.call(this,128,112)}eD(nZ,nV),nZ.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},nZ.prototype._hash=function(){var e=nG.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var nJ=nS.exports=function(e){var t=nJ[e=e.toLowerCase()];if(!t)throw Error(e+" is not supported (we accept pull requests)");return new t};nJ.sha=nI,nJ.sha1=nL,nJ.sha224=nU,nJ.sha256=nj,nJ.sha384=nZ,nJ.sha512=nV;var nX=nS.exports;function n0(){this.head=null,this.tail=null,this.length=0}n0.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},n0.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},n0.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},n0.prototype.clear=function(){this.head=this.tail=null,this.length=0},n0.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},n0.prototype.concat=function(e){if(0===this.length)return M.alloc(0);if(1===this.length)return this.head.data;for(var t=M.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var n1=M.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n2(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!n1(e))throw Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=n6;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=n4;break;default:return void(this.write=n3)}this.charBuffer=new M(6),this.charReceived=0,this.charLength=0}function n3(e){return e.toString(this.encoding)}function n6(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function n4(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}n2.prototype.write=function(e){for(var t,n="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&t<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return n;break}this.charLength+=this.surrogateSize,n=""}this.detectIncompleteChar(e);var i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(n+=e.toString(this.encoding,0,i)).length-1,(t=n.charCodeAt(i))>=55296&&t<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),n.substring(0,i)}return n},n2.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},n2.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var n8=Object.freeze({__proto__:null,StringDecoder:n2});n9.ReadableState=n7;var n5=eX("stream");function n7(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof rM&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new n0,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new n2(e.encoding),this.encoding=e.encoding)}function n9(e){if(!(this instanceof n9))return new n9(e);this._readableState=new n7(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),eF.call(this)}function re(e,t,n,r,i){var o,a,s,l=(a=null,Z(o=n)||"string"==typeof o||null==o||t.objectMode||(a=TypeError("Invalid non-string/buffer chunk")),a);if(l)e.emit("error",l);else if(null===n)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,rn(e)}}(e,t);else if(t.objectMode||n&&n.length>0){if(t.ended&&!i){var u=Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&i){var c=Error("stream.unshift() after end event");e.emit("error",c)}else!t.decoder||i||r||(n=t.decoder.write(n),s=!t.objectMode&&0===n.length),i||(t.reading=!1),s||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&rn(e))),t.readingMore||(t.readingMore=!0,ew(ri,e,t))}else i||(t.reading=!1);return!t.ended&&(t.needReadable||t.lengtht.highWaterMark&&(t.highWaterMark=((n=e)>=8388608?n=8388608:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function rn(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(n5("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?ew(rr,e):rr(e))}function rr(e){n5("emit readable"),e.emit("readable"),rs(e)}function ri(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):(r=t.buffer,i=t.decoder,eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0==(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,r):function(e,t){var n=M.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0==(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,r),n=o),n)}function ru(e){var t=e._readableState;if(t.length>0)throw Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,ew(rc,t,e))}function rc(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function rd(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return n5("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ru(this):rn(this),null;if(0===(e=rt(e,t))&&t.ended)return 0===t.length&&ru(this),null;var r,i=t.needReadable;return n5("need readable",i),(0===t.length||t.length-e0?rl(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&ru(this)),null!==r&&this.emit("data",r),r},n9.prototype._read=function(e){this.emit("error",Error("not implemented"))},n9.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,n5("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end?u:a;function o(e){n5("onunpipe"),e===n&&u()}function a(){n5("onend"),e.end()}r.endEmitted?ew(i):n.once("end",i),e.on("unpipe",o);var s=function(){var e=n._readableState;n5("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&n.listeners("data").length&&(e.flowing=!0,rs(n))};e.on("drain",s);var l=!1;function u(){n5("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",f),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",u),n.removeListener("data",d),l=!0,r.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&s()}var c=!1;function d(t){n5("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==rd(r.pipes,e))&&!l&&(n5("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function f(t){var n;n5("onerror",t),m(),e.removeListener("error",f),0===(n="error",e.listeners(n).length)&&e.emit("error",t)}function h(){e.removeListener("finish",p),m()}function p(){n5("onfinish"),e.removeListener("close",h),m()}function m(){n5("unpipe"),n.unpipe(e)}return n.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",f),e.once("close",h),e.once("finish",p),e.emit("pipe",n),r.flowing||(n5("pipe resume"),n.resume()),e},n9.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},rm.prototype._write=function(e,t,n){n(Error("not implemented"))},rm.prototype._writev=null,rm.prototype.end=function(e,t,n){var r,i=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||(r=n,i.ending=!0,rw(this,i),r&&(i.finished?ew(r):this.once("finish",r)),i.ended=!0,this.writable=!1)},eW(rM,n9);for(var rE=Object.keys(rm.prototype),rS=0;rS64?t=e(t):t.length<64&&(t=rq.concat([t,rK],64));for(var n=this._ipad=rq.allocUnsafe(64),r=this._opad=rq.allocUnsafe(64),i=0;i<64;i++)n[i]=54^t[i],r[i]=92^t[i];this._hash=[n]}eD(rH,rF),rH.prototype._update=function(e){this._hash.push(e)},rH.prototype._final=function(){var e=this._alg(rq.concat(this._hash));return this._alg(rq.concat([this._opad,e]))};var rV=function(e){return(new nc).update(e).digest()},r$=eT().Buffer,rW=r$.alloc(128);function rY(e,t){rF.call(this,"digest"),"string"==typeof t&&(t=r$.from(t));var n="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>n)?t=("rmd160"===e?new n_:nX(e)).update(t).digest():t.length1073741823||t!=t)throw TypeError("Bad key length")},r1=l.process&&l.process.browser?"utf-8":l.process&&l.process.version?parseInt(ex.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",r2=eT().Buffer,r3=function(e,t,n){if(r2.isBuffer(e))return e;if("string"==typeof e)return r2.from(e,t);if(ArrayBuffer.isView(e))return r2.from(e.buffer);throw TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},r6=eT().Buffer,r4=r6.alloc(128),r8={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function r5(e,t,n){var r="rmd160"===e||"ripemd160"===e?function(e){return(new n_).update(e).digest()}:"md5"===e?rV:function(t){return nX(e).update(t).digest()},i="sha512"===e||"sha384"===e?128:64;t.length>i?t=r(t):t.length>>0},writeUInt32BE:function(e,t,n){e[0+n]=t>>>24,e[1+n]=t>>>16&255,e[2+n]=t>>>8&255,e[3+n]=255&t},ip:function(e,t,n,r){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}n[r+0]=i>>>0,n[r+1]=o>>>0},rip:function(e,t,n,r){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},pc1:function(e,t,n,r){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},r28shl:function(e,t){return e<>>28-t}},id=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];ic.pc2=function(e,t,n,r){for(var i=0,o=0,a=id.length>>>1,s=0;s>>id[s]&1;for(s=a;s>>id[s]&1;n[r+0]=i>>>0,n[r+1]=o>>>0},ic.expand=function(e,t,n){var r=0,i=0;r=(1&e)<<5|e>>>27;for(var o=23;o>=15;o-=4)r<<=6,r|=e>>>o&63;for(o=11;o>=3;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[n+0]=r>>>0,t[n+1]=i>>>0};var ih=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];ic.substitute=function(e,t){for(var n=0,r=0;r<4;r++)n<<=4,n|=ih[64*r+(e>>>18-6*r&63)];for(r=0;r<4;r++)n<<=4,n|=ih[256+64*r+(t>>>18-6*r&63)];return n>>>0};var ip=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];function im(e,t){if(!e)throw Error(t||"Assertion failed")}function ig(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=Array(this.blockSize),this.bufferOff=0,this.padding=!1!==e.padding}function iv(){this.tmp=[,,],this.keys=null}function ib(e){ig.call(this,e);var t=new iv;this._desState=t,this.deriveKeys(t,e.key)}ic.permute=function(e){for(var t=0,n=0;n>>ip[n]&1;return t>>>0},ic.padSplit=function(e,t,n){for(var r=e.toString(2);r.length0;r--)t+=this._buffer(e,t),n+=this._flushBuffer(i,n);return t+=this._buffer(e,t),i},ig.prototype.final=function(e){var t,n;return e&&(t=this.update(e)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(n):n},ig.prototype._pad=function(e,t){if(0===t)return!1;for(;t>>1];n=ic.r28shl(n,o),r=ic.r28shl(r,o),ic.pc2(n,r,e.keys,i)}},ib.prototype._update=function(e,t,n,r){var i=this._desState,o=ic.readUInt32BE(e,t),a=ic.readUInt32BE(e,t+4);ic.ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],ic.writeUInt32BE(n,o,r),ic.writeUInt32BE(n,a,r+4)},ib.prototype._pad=function(e,t){if(!1===this.padding)return!1;for(var n=e.length-t,r=t;r>>0,o=d}ic.rip(a,o,r,i)},ib.prototype._decrypt=function(e,t,n,r,i){for(var o=n,a=t,s=e.keys.length-2;s>=0;s-=2){var l=e.keys[s],u=e.keys[s+1];ic.expand(o,e.tmp,0),l^=e.tmp[0],u^=e.tmp[1];var c=ic.substitute(l,u),d=o;o=(a^ic.permute(c))>>>0,a=d}ic.rip(o,a,r,i)};var iA={},iw={};function i_(e){im.equal(e.length,8,"Invalid IV length"),this.iv=Array(8);for(var t=0;t>o%8,e._prev=function(e,t){var n=e.length,r=-1,i=ij.allocUnsafe(e.length);for(e=ij.concat([e,ij.from([t])]);++r>7;return i}(e._prev,n?r:i);return a}(e,t[o],n);return i};var iF={};iF.encrypt=function(e,t){for(;e._cache.length>>24]^c[p>>>16&255]^d[m>>>8&255]^f[255&g]^t[v++],a=u[p>>>24]^c[m>>>16&255]^d[g>>>8&255]^f[255&h]^t[v++],s=u[m>>>24]^c[g>>>16&255]^d[h>>>8&255]^f[255&p]^t[v++],l=u[g>>>24]^c[h>>>16&255]^d[p>>>8&255]^f[255&m]^t[v++],h=o,p=a,m=s,g=l;return o=(r[h>>>24]<<24|r[p>>>16&255]<<16|r[m>>>8&255]<<8|r[255&g])^t[v++],[o>>>=0,a=((r[p>>>24]<<24|r[m>>>16&255]<<16|r[g>>>8&255]<<8|r[255&h])^t[v++])>>>0,s=((r[m>>>24]<<24|r[g>>>16&255]<<16|r[h>>>8&255]<<8|r[255&p])^t[v++])>>>0,l=((r[g>>>24]<<24|r[h>>>16&255]<<16|r[p>>>8&255]<<8|r[255&m])^t[v++])>>>0]}var iZ=[0,1,2,4,8,16,32,64,128,27,54],iJ=function(){for(var e=Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,l=0;l<256;++l){var u=s^s<<1^s<<2^s<<3^s<<4;u=u>>>8^255&u^99,n[a]=u,r[u]=a;var c=e[a],d=e[c],f=e[d],h=257*e[u]^16843008*u;i[0][a]=h<<24|h>>>8,i[1][a]=h<<16|h>>>16,i[2][a]=h<<8|h>>>24,i[3][a]=h,h=16843009*f^65537*d^257*c^16843008*a,o[0][u]=h<<24|h>>>8,o[1][u]=h<<16|h>>>16,o[2][u]=h<<8|h>>>24,o[3][u]=h,0===a?a=s=1:(a=c^e[e[e[f^c]]],s^=e[e[s]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function iX(e){this._key=iY(e),this._reset()}iX.blockSize=16,iX.keySize=32,iX.prototype.blockSize=iX.blockSize,iX.prototype.keySize=iX.keySize,iX.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o>>24,a=(iJ.SBOX[a>>>24]<<24|iJ.SBOX[a>>>16&255]<<16|iJ.SBOX[a>>>8&255]<<8|iJ.SBOX[255&a])^iZ[o/t|0]<<24):t>6&&o%t==4&&(a=iJ.SBOX[a>>>24]<<24|iJ.SBOX[a>>>16&255]<<16|iJ.SBOX[a>>>8&255]<<8|iJ.SBOX[255&a]),i[o]=i[o-t]^a}for(var s=[],l=0;l>>24]]^iJ.INV_SUB_MIX[1][iJ.SBOX[c>>>16&255]]^iJ.INV_SUB_MIX[2][iJ.SBOX[c>>>8&255]]^iJ.INV_SUB_MIX[3][iJ.SBOX[255&c]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=s},iX.prototype.encryptBlockRaw=function(e){return iQ(e=iY(e),this._keySchedule,iJ.SUB_MIX,iJ.SBOX,this._nRounds)},iX.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=iW.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},iX.prototype.decryptBlock=function(e){var t=(e=iY(e))[1];e[1]=e[3],e[3]=t;var n=iQ(e,this._invKeySchedule,iJ.INV_SUB_MIX,iJ.INV_SBOX,this._nRounds),r=iW.allocUnsafe(16);return r.writeUInt32BE(n[0],0),r.writeUInt32BE(n[3],4),r.writeUInt32BE(n[2],8),r.writeUInt32BE(n[1],12),r},iX.prototype.scrub=function(){iG(this._keySchedule),iG(this._invKeySchedule),iG(this._key)},i$.AES=iX;var i0=eT().Buffer,i1=i0.alloc(16,0);function i2(e){var t=i0.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function i3(e){this.h=e,this.state=i0.alloc(16,0),this.cache=i0.allocUnsafe(0)}i3.prototype.ghash=function(e){for(var t=-1;++t0;t--)r[t]=r[t]>>>1|(1&r[t-1])<<31;r[0]=r[0]>>>1,n&&(r[0]=-520093696^r[0])}this.state=i2(i)},i3.prototype.update=function(e){var t;for(this.cache=i0.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},i3.prototype.final=function(e,t){return this.cache.length&&this.ghash(i0.concat([this.cache,i1],16)),this.ghash(i2([0,e,0,t])),this.state};var i6=eT().Buffer;function i4(e,t,n,r){rF.call(this);var i=i6.alloc(4,0);this._cipher=new i$.AES(t);var o=this._cipher.encryptBlock(i);this._ghash=new i3(o),n=function(e,t,n){if(12===t.length)return e._finID=i6.concat([t,i6.from([0,0,0,1])]),i6.concat([t,i6.from([0,0,0,2])]);var r=new i3(n),i=t.length,o=i%16;r.update(t),o&&(o=16-o,r.update(i6.alloc(o,0))),r.update(i6.alloc(8,0));var a=i6.alloc(8);a.writeUIntBE(8*i,0,8),r.update(a),e._finID=r.state;var s=i6.from(e._finID);return iU(s),s}(this,n,o),this._prev=i6.from(n),this._cache=i6.allocUnsafe(0),this._secCache=i6.allocUnsafe(0),this._decrypt=r,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}eD(i4,rF),i4.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=i6.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},i4.prototype._final=function(){if(this._decrypt&&!this._authTag)throw Error("Unsupported state or unable to authenticate data");var e=iT(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var n=0;e.length!==t.length&&n++;for(var r=Math.min(e.length,t.length),i=0;i0||r>0;){var l=new nc;l.update(s),l.update(e),t&&l.update(t),s=l.digest();var u=0;if(i>0){var c=o.length-i;u=Math.min(i,s.length),s.copy(o,c,0,u),i-=u}if(u0){var d=a.length-r,f=Math.min(r,s.length-u);s.copy(a,d,u,u+f),r-=f}}return s.fill(0),{key:o,iv:a}},oe=eT().Buffer;function ot(e,t,n){rF.call(this),this._cache=new or,this._cipher=new i$.AES(t),this._prev=oe.from(n),this._mode=e,this._autopadding=!0}eD(ot,rF),ot.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return oe.concat(r)};var on=oe.alloc(16,16);function or(){this.cache=oe.allocUnsafe(0)}function oi(e,t,n){var r=iK[e.toLowerCase()];if(!r)throw TypeError("invalid suite type");if("string"==typeof t&&(t=oe.from(t)),t.length!==r.key/8)throw TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=oe.from(n)),"GCM"!==r.mode&&n.length!==r.iv)throw TypeError("invalid iv length "+n.length);return"stream"===r.type?new i5(r.module,t,n):"auth"===r.type?new i4(r.module,t,n):new ot(r.module,t,n)}ot.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(on))throw this._cipher.scrub(),Error("data not multiple of block length")},ot.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},or.prototype.add=function(e){this.cache=oe.concat([this.cache,e])},or.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},or.prototype.flush=function(){for(var e=16-this.cache.length,t=oe.allocUnsafe(e),n=-1;++n16)throw Error("unable to decrypt data");for(var n=-1;++n16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},ol.prototype.flush=function(){if(this.cache.length)return this.cache},oo.createDecipher=function(e,t){var n=iK[e.toLowerCase()];if(!n)throw TypeError("invalid suite type");var r=i9(t,!1,n.key,n.iv);return ou(e,r.key,r.iv)},oo.createDecipheriv=ou,ix.createCipher=ix.Cipher=iR.createCipher,ix.createCipheriv=ix.Cipheriv=iR.createCipheriv,ix.createDecipher=ix.Decipher=oo.createDecipher,ix.createDecipheriv=ix.Decipheriv=oo.createDecipheriv,ix.listCiphers=ix.getCiphers=function(){return Object.keys(iK)};var oc={};function od(e,t,n){if(iK[e=e.toLowerCase()])return ix.createCipheriv(e,t,n);if(oc[e])return new iC({key:t,iv:n,mode:e});throw TypeError("invalid suite type")}function of(e,t,n){if(iK[e=e.toLowerCase()])return ix.createDecipheriv(e,t,n);if(oc[e])return new iC({key:t,iv:n,mode:e,decrypt:!0});throw TypeError("invalid suite type")}oc["des-ecb"]={key:8,iv:0},oc["des-cbc"]=oc.des={key:8,iv:8},oc["des-ede3-cbc"]=oc.des3={key:24,iv:8},oc["des-ede3"]={key:24,iv:0},oc["des-ede-cbc"]={key:16,iv:8},oc["des-ede"]={key:16,iv:0},il.createCipher=il.Cipher=function(e,t){if(iK[e=e.toLowerCase()])n=iK[e].key,r=iK[e].iv;else{if(!oc[e])throw TypeError("invalid suite type");n=8*oc[e].key,r=oc[e].iv}var n,r,i=i9(t,!1,n,r);return od(e,i.key,i.iv)},il.createCipheriv=il.Cipheriv=od,il.createDecipher=il.Decipher=function(e,t){if(iK[e=e.toLowerCase()])n=iK[e].key,r=iK[e].iv;else{if(!oc[e])throw TypeError("invalid suite type");n=8*oc[e].key,r=oc[e].iv}var n,r,i=i9(t,!1,n,r);return of(e,i.key,i.iv)},il.createDecipheriv=il.Decipheriv=of,il.listCiphers=il.getCiphers=function(){return Object.keys(oc).concat(ix.getCiphers())};var oh={},op={exports:{}};!function(e,t){function n(e,t){if(!e)throw Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{l="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:er.Buffer}catch(e){}function o(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function a(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),a=t;a=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return 0>e.cmp(t)?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,l=Math.min(o,o-a)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var l,u=["","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],d=[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 f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,l=a/67108864|0;n.words[0]=s;for(var u=1;u>>26,d=67108863&l,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var f=c[e],h=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?m+r:u[f-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==l),this.toArrayLike(l,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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 a,s,l=new e(o),u=this.clone();if("le"===t){for(s=0;!u.isZero();s++)a=u.andln(255),u.iushrn(8),l[s]=a;for(;s=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,b=g>>>13,y=0|a[3],A=8191&y,w=y>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,I=x>>>13,T=0|a[7],O=8191&T,P=T>>>13,L=0|a[8],N=8191&L,D=L>>>13,B=0|a[9],j=8191&B,F=B>>>13,z=0|s[0],U=8191&z,q=z>>>13,K=0|s[1],H=8191&K,V=K>>>13,$=0|s[2],W=8191&$,Y=$>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,J=0|s[4],X=8191&J,ee=J>>>13,et=0|s[5],en=8191&et,er=et>>>13,ei=0|s[6],eo=8191&ei,ea=ei>>>13,es=0|s[7],el=8191&es,eu=es>>>13,ec=0|s[8],ed=8191&ec,ef=ec>>>13,eh=0|s[9],ep=8191&eh,em=eh>>>13;n.negative=e.negative^t.negative,n.length=19;var eg=(u+(r=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,U)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(eg>>>26)|0,eg&=67108863,r=Math.imul(p,U),i=(i=Math.imul(p,q))+Math.imul(m,U)|0,o=Math.imul(m,q);var ev=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(i>>>13)|0)+(ev>>>26)|0,ev&=67108863,r=Math.imul(v,U),i=(i=Math.imul(v,q))+Math.imul(b,U)|0,o=Math.imul(b,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,V)|0;var eb=(u+(r=r+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,W)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(eb>>>26)|0,eb&=67108863,r=Math.imul(A,U),i=(i=Math.imul(A,q))+Math.imul(w,U)|0,o=Math.imul(w,q),r=r+Math.imul(v,H)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var ey=(u+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(ey>>>26)|0,ey&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,q))+Math.imul(S,U)|0,o=Math.imul(S,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,V)|0,r=r+Math.imul(v,W)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var eA=(u+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(eA>>>26)|0,eA&=67108863,r=Math.imul(M,U),i=(i=Math.imul(M,q))+Math.imul(C,U)|0,o=Math.imul(C,q),r=r+Math.imul(E,H)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(A,W)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,Z)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var ew=(u+(r=r+Math.imul(d,en)|0)|0)+((8191&(i=(i=i+Math.imul(d,er)|0)+Math.imul(f,en)|0))<<13)|0;u=((o=o+Math.imul(f,er)|0)+(i>>>13)|0)+(ew>>>26)|0,ew&=67108863,r=Math.imul(R,U),i=(i=Math.imul(R,q))+Math.imul(I,U)|0,o=Math.imul(I,q),r=r+Math.imul(M,H)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(E,W)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,Z)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,ee)|0,r=r+Math.imul(p,en)|0,i=(i=i+Math.imul(p,er)|0)+Math.imul(m,en)|0,o=o+Math.imul(m,er)|0;var e_=(u+(r=r+Math.imul(d,eo)|0)|0)+((8191&(i=(i=i+Math.imul(d,ea)|0)+Math.imul(f,eo)|0))<<13)|0;u=((o=o+Math.imul(f,ea)|0)+(i>>>13)|0)+(e_>>>26)|0,e_&=67108863,r=Math.imul(O,U),i=(i=Math.imul(O,q))+Math.imul(P,U)|0,o=Math.imul(P,q),r=r+Math.imul(R,H)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(A,X)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(v,en)|0,i=(i=i+Math.imul(v,er)|0)+Math.imul(b,en)|0,o=o+Math.imul(b,er)|0,r=r+Math.imul(p,eo)|0,i=(i=i+Math.imul(p,ea)|0)+Math.imul(m,eo)|0,o=o+Math.imul(m,ea)|0;var eE=(u+(r=r+Math.imul(d,el)|0)|0)+((8191&(i=(i=i+Math.imul(d,eu)|0)+Math.imul(f,el)|0))<<13)|0;u=((o=o+Math.imul(f,eu)|0)+(i>>>13)|0)+(eE>>>26)|0,eE&=67108863,r=Math.imul(N,U),i=(i=Math.imul(N,q))+Math.imul(D,U)|0,o=Math.imul(D,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(R,W)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(A,en)|0,i=(i=i+Math.imul(A,er)|0)+Math.imul(w,en)|0,o=o+Math.imul(w,er)|0,r=r+Math.imul(v,eo)|0,i=(i=i+Math.imul(v,ea)|0)+Math.imul(b,eo)|0,o=o+Math.imul(b,ea)|0,r=r+Math.imul(p,el)|0,i=(i=i+Math.imul(p,eu)|0)+Math.imul(m,el)|0,o=o+Math.imul(m,eu)|0;var eS=(u+(r=r+Math.imul(d,ed)|0)|0)+((8191&(i=(i=i+Math.imul(d,ef)|0)+Math.imul(f,ed)|0))<<13)|0;u=((o=o+Math.imul(f,ef)|0)+(i>>>13)|0)+(eS>>>26)|0,eS&=67108863,r=Math.imul(j,U),i=(i=Math.imul(j,q))+Math.imul(F,U)|0,o=Math.imul(F,q),r=r+Math.imul(N,H)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(M,X)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,en)|0,i=(i=i+Math.imul(E,er)|0)+Math.imul(S,en)|0,o=o+Math.imul(S,er)|0,r=r+Math.imul(A,eo)|0,i=(i=i+Math.imul(A,ea)|0)+Math.imul(w,eo)|0,o=o+Math.imul(w,ea)|0,r=r+Math.imul(v,el)|0,i=(i=i+Math.imul(v,eu)|0)+Math.imul(b,el)|0,o=o+Math.imul(b,eu)|0,r=r+Math.imul(p,ed)|0,i=(i=i+Math.imul(p,ef)|0)+Math.imul(m,ed)|0,o=o+Math.imul(m,ef)|0;var ek=(u+(r=r+Math.imul(d,ep)|0)|0)+((8191&(i=(i=i+Math.imul(d,em)|0)+Math.imul(f,ep)|0))<<13)|0;u=((o=o+Math.imul(f,em)|0)+(i>>>13)|0)+(ek>>>26)|0,ek&=67108863,r=Math.imul(j,H),i=(i=Math.imul(j,V))+Math.imul(F,H)|0,o=Math.imul(F,V),r=r+Math.imul(N,W)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,Z)|0,r=r+Math.imul(R,X)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(M,en)|0,i=(i=i+Math.imul(M,er)|0)+Math.imul(C,en)|0,o=o+Math.imul(C,er)|0,r=r+Math.imul(E,eo)|0,i=(i=i+Math.imul(E,ea)|0)+Math.imul(S,eo)|0,o=o+Math.imul(S,ea)|0,r=r+Math.imul(A,el)|0,i=(i=i+Math.imul(A,eu)|0)+Math.imul(w,el)|0,o=o+Math.imul(w,eu)|0,r=r+Math.imul(v,ed)|0,i=(i=i+Math.imul(v,ef)|0)+Math.imul(b,ed)|0,o=o+Math.imul(b,ef)|0;var eM=(u+(r=r+Math.imul(p,ep)|0)|0)+((8191&(i=(i=i+Math.imul(p,em)|0)+Math.imul(m,ep)|0))<<13)|0;u=((o=o+Math.imul(m,em)|0)+(i>>>13)|0)+(eM>>>26)|0,eM&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Y))+Math.imul(F,W)|0,o=Math.imul(F,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(R,en)|0,i=(i=i+Math.imul(R,er)|0)+Math.imul(I,en)|0,o=o+Math.imul(I,er)|0,r=r+Math.imul(M,eo)|0,i=(i=i+Math.imul(M,ea)|0)+Math.imul(C,eo)|0,o=o+Math.imul(C,ea)|0,r=r+Math.imul(E,el)|0,i=(i=i+Math.imul(E,eu)|0)+Math.imul(S,el)|0,o=o+Math.imul(S,eu)|0,r=r+Math.imul(A,ed)|0,i=(i=i+Math.imul(A,ef)|0)+Math.imul(w,ed)|0,o=o+Math.imul(w,ef)|0;var eC=(u+(r=r+Math.imul(v,ep)|0)|0)+((8191&(i=(i=i+Math.imul(v,em)|0)+Math.imul(b,ep)|0))<<13)|0;u=((o=o+Math.imul(b,em)|0)+(i>>>13)|0)+(eC>>>26)|0,eC&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(F,Q)|0,o=Math.imul(F,Z),r=r+Math.imul(N,X)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(O,en)|0,i=(i=i+Math.imul(O,er)|0)+Math.imul(P,en)|0,o=o+Math.imul(P,er)|0,r=r+Math.imul(R,eo)|0,i=(i=i+Math.imul(R,ea)|0)+Math.imul(I,eo)|0,o=o+Math.imul(I,ea)|0,r=r+Math.imul(M,el)|0,i=(i=i+Math.imul(M,eu)|0)+Math.imul(C,el)|0,o=o+Math.imul(C,eu)|0,r=r+Math.imul(E,ed)|0,i=(i=i+Math.imul(E,ef)|0)+Math.imul(S,ed)|0,o=o+Math.imul(S,ef)|0;var ex=(u+(r=r+Math.imul(A,ep)|0)|0)+((8191&(i=(i=i+Math.imul(A,em)|0)+Math.imul(w,ep)|0))<<13)|0;u=((o=o+Math.imul(w,em)|0)+(i>>>13)|0)+(ex>>>26)|0,ex&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(N,en)|0,i=(i=i+Math.imul(N,er)|0)+Math.imul(D,en)|0,o=o+Math.imul(D,er)|0,r=r+Math.imul(O,eo)|0,i=(i=i+Math.imul(O,ea)|0)+Math.imul(P,eo)|0,o=o+Math.imul(P,ea)|0,r=r+Math.imul(R,el)|0,i=(i=i+Math.imul(R,eu)|0)+Math.imul(I,el)|0,o=o+Math.imul(I,eu)|0,r=r+Math.imul(M,ed)|0,i=(i=i+Math.imul(M,ef)|0)+Math.imul(C,ed)|0,o=o+Math.imul(C,ef)|0;var eR=(u+(r=r+Math.imul(E,ep)|0)|0)+((8191&(i=(i=i+Math.imul(E,em)|0)+Math.imul(S,ep)|0))<<13)|0;u=((o=o+Math.imul(S,em)|0)+(i>>>13)|0)+(eR>>>26)|0,eR&=67108863,r=Math.imul(j,en),i=(i=Math.imul(j,er))+Math.imul(F,en)|0,o=Math.imul(F,er),r=r+Math.imul(N,eo)|0,i=(i=i+Math.imul(N,ea)|0)+Math.imul(D,eo)|0,o=o+Math.imul(D,ea)|0,r=r+Math.imul(O,el)|0,i=(i=i+Math.imul(O,eu)|0)+Math.imul(P,el)|0,o=o+Math.imul(P,eu)|0,r=r+Math.imul(R,ed)|0,i=(i=i+Math.imul(R,ef)|0)+Math.imul(I,ed)|0,o=o+Math.imul(I,ef)|0;var eI=(u+(r=r+Math.imul(M,ep)|0)|0)+((8191&(i=(i=i+Math.imul(M,em)|0)+Math.imul(C,ep)|0))<<13)|0;u=((o=o+Math.imul(C,em)|0)+(i>>>13)|0)+(eI>>>26)|0,eI&=67108863,r=Math.imul(j,eo),i=(i=Math.imul(j,ea))+Math.imul(F,eo)|0,o=Math.imul(F,ea),r=r+Math.imul(N,el)|0,i=(i=i+Math.imul(N,eu)|0)+Math.imul(D,el)|0,o=o+Math.imul(D,eu)|0,r=r+Math.imul(O,ed)|0,i=(i=i+Math.imul(O,ef)|0)+Math.imul(P,ed)|0,o=o+Math.imul(P,ef)|0;var eT=(u+(r=r+Math.imul(R,ep)|0)|0)+((8191&(i=(i=i+Math.imul(R,em)|0)+Math.imul(I,ep)|0))<<13)|0;u=((o=o+Math.imul(I,em)|0)+(i>>>13)|0)+(eT>>>26)|0,eT&=67108863,r=Math.imul(j,el),i=(i=Math.imul(j,eu))+Math.imul(F,el)|0,o=Math.imul(F,eu),r=r+Math.imul(N,ed)|0,i=(i=i+Math.imul(N,ef)|0)+Math.imul(D,ed)|0,o=o+Math.imul(D,ef)|0;var eO=(u+(r=r+Math.imul(O,ep)|0)|0)+((8191&(i=(i=i+Math.imul(O,em)|0)+Math.imul(P,ep)|0))<<13)|0;u=((o=o+Math.imul(P,em)|0)+(i>>>13)|0)+(eO>>>26)|0,eO&=67108863,r=Math.imul(j,ed),i=(i=Math.imul(j,ef))+Math.imul(F,ed)|0,o=Math.imul(F,ef);var eP=(u+(r=r+Math.imul(N,ep)|0)|0)+((8191&(i=(i=i+Math.imul(N,em)|0)+Math.imul(D,ep)|0))<<13)|0;u=((o=o+Math.imul(D,em)|0)+(i>>>13)|0)+(eP>>>26)|0,eP&=67108863;var eL=(u+(r=Math.imul(j,ep))|0)+((8191&(i=(i=Math.imul(j,em))+Math.imul(F,ep)|0))<<13)|0;return u=((o=Math.imul(F,em))+(i>>>13)|0)+(eL>>>26)|0,eL&=67108863,l[0]=eg,l[1]=ev,l[2]=eb,l[3]=ey,l[4]=eA,l[5]=ew,l[6]=e_,l[7]=eE,l[8]=eS,l[9]=ek,l[10]=eM,l[11]=eC,l[12]=ex,l[13]=eR,l[14]=eI,l[15]=eT,l[16]=eO,l[17]=eP,l[18]=eL,0!==u&&(l[19]=u,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=f),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?h(this,e,t):n<63?f(this,e,t):n<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t)},m.prototype.makeRBT=function(e){for(var t=Array(e),n=i.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=(i/67108864|0)+(o>>>26),this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var i,o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,l=0;l=0&&(0!==u||l>=i);l--){var c=0|this.words[l];this.words[l]=u<<26-o|c>>>o,u=c&s}return r&&0!==u&&(r.words[r.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,l=r.length-o.length;if("mod"!==t){(s=new i(null)).length=l+1,s.words=Array(s.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){var o,a,s;return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||0>this.cmp(e)?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t)},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=67108864%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.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;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(d)),s.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(l)):(r.isub(t),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return 0>(o=0===t.cmpn(1)?a:s).cmpn(0)&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return -1===this.cmpn(e)},i.prototype.lt=function(e){return -1===this.cmp(e)},i.prototype.lten=function(e){return 0>=this.cmpn(e)},i.prototype.lte=function(e){return 0>=this.cmp(e)},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}v.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength();while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(b,v),b.prototype.split=function(e,t){for(var n=Math.min(e.length,9),r=0;r>>22,i=o}i>>>=22,e.words[r-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){var t;if(g[e])return g[e];if("k256"===e)t=new b;else if("p224"===e)t=new y;else if("p192"===e)t=new A;else{if("p25519"!==e)throw Error("Unknown prime "+e);t=new w}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var d=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}l=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):0>o.cmpn(0)&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(op,l);var om,og,ov,ob,oy,oA=op.exports,ow={exports:{}};function o_(){if(om)return ow.exports;function e(e){this.rand=e}if(om=1,ow.exports=function(n){return t||(t=new e(null)),t.generate(n)},ow.exports.Rand=e,e.prototype.generate=function(e){return this._rand(e)},e.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n=0);return n},t.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},t.prototype.test=function(e,t,n){var r=e.bitLength(),i=oA.mont(e),o=new oA(1).toRed(i);t||(t=Math.max(1,r/48|0));for(var a=e.subn(1),s=0;!a.testn(s);s++);for(var l=e.shrn(s),u=a.toRed(i);t>0;t--){var c=this._randrange(new oA(2),a);n&&n(c);var d=c.toRed(i).redPow(l);if(0!==d.cmp(o)&&0!==d.cmp(u)){for(var f=1;f0;t--){var u=this._randrange(new oA(2),o),c=e.gcd(u);if(0!==c.cmpn(1))return c;var d=u.toRed(r).redPow(s);if(0!==d.cmp(i)&&0!==d.cmp(l)){for(var f=1;fu;)h.ishrn(1);if(h.isEven()&&h.iadd(n),h.testn(1)||h.iadd(r),f.cmp(r)){if(!f.cmp(i))for(;h.mod(o).cmp(a);)h.iadd(l)}else for(;h.mod(e).cmp(s);)h.iadd(l);if(c(p=h.shrn(1))&&c(h)&&d(p)&&d(h)&&t.test(p)&&t.test(h))return h}}return ob}var ok,oM,oC,ox={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},oR={exports:{}},oI={exports:{}};!function(e,t){function n(e,t){if(!e)throw Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{c="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:er.Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);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 "+e)}function a(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}function s(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),l=t;l=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&a0?e:t},i.min=function(e,t){return 0>e.cmp(t)?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,l=Math.min(o,o-a)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch(e){i.prototype.inspect=u}else i.prototype.inspect=u;function u(){return(this.red?""}var c,d=["","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"],f=[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],h=[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 p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,l=a/67108864|0;n.words[0]=s;for(var u=1;u>>26,d=67108863&l,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?d[6-l.length]+l+r:l+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=f[e],c=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(e);r=(p=p.idivn(c)).isZero()?m+r:d[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},c&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(c,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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 a=e.allocUnsafe?e.allocUnsafe(o):new e(o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,b=g>>>13,y=0|a[3],A=8191&y,w=y>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,I=x>>>13,T=0|a[7],O=8191&T,P=T>>>13,L=0|a[8],N=8191&L,D=L>>>13,B=0|a[9],j=8191&B,F=B>>>13,z=0|s[0],U=8191&z,q=z>>>13,K=0|s[1],H=8191&K,V=K>>>13,$=0|s[2],W=8191&$,Y=$>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,J=0|s[4],X=8191&J,ee=J>>>13,et=0|s[5],en=8191&et,er=et>>>13,ei=0|s[6],eo=8191&ei,ea=ei>>>13,es=0|s[7],el=8191&es,eu=es>>>13,ec=0|s[8],ed=8191&ec,ef=ec>>>13,eh=0|s[9],ep=8191&eh,em=eh>>>13;n.negative=e.negative^t.negative,n.length=19;var eg=(u+(r=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,U)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(eg>>>26)|0,eg&=67108863,r=Math.imul(p,U),i=(i=Math.imul(p,q))+Math.imul(m,U)|0,o=Math.imul(m,q);var ev=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(i>>>13)|0)+(ev>>>26)|0,ev&=67108863,r=Math.imul(v,U),i=(i=Math.imul(v,q))+Math.imul(b,U)|0,o=Math.imul(b,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,V)|0;var eb=(u+(r=r+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,W)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(eb>>>26)|0,eb&=67108863,r=Math.imul(A,U),i=(i=Math.imul(A,q))+Math.imul(w,U)|0,o=Math.imul(w,q),r=r+Math.imul(v,H)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var ey=(u+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(ey>>>26)|0,ey&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,q))+Math.imul(S,U)|0,o=Math.imul(S,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,V)|0,r=r+Math.imul(v,W)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var eA=(u+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(eA>>>26)|0,eA&=67108863,r=Math.imul(M,U),i=(i=Math.imul(M,q))+Math.imul(C,U)|0,o=Math.imul(C,q),r=r+Math.imul(E,H)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(A,W)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,Z)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var ew=(u+(r=r+Math.imul(d,en)|0)|0)+((8191&(i=(i=i+Math.imul(d,er)|0)+Math.imul(f,en)|0))<<13)|0;u=((o=o+Math.imul(f,er)|0)+(i>>>13)|0)+(ew>>>26)|0,ew&=67108863,r=Math.imul(R,U),i=(i=Math.imul(R,q))+Math.imul(I,U)|0,o=Math.imul(I,q),r=r+Math.imul(M,H)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(E,W)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,Z)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,ee)|0,r=r+Math.imul(p,en)|0,i=(i=i+Math.imul(p,er)|0)+Math.imul(m,en)|0,o=o+Math.imul(m,er)|0;var e_=(u+(r=r+Math.imul(d,eo)|0)|0)+((8191&(i=(i=i+Math.imul(d,ea)|0)+Math.imul(f,eo)|0))<<13)|0;u=((o=o+Math.imul(f,ea)|0)+(i>>>13)|0)+(e_>>>26)|0,e_&=67108863,r=Math.imul(O,U),i=(i=Math.imul(O,q))+Math.imul(P,U)|0,o=Math.imul(P,q),r=r+Math.imul(R,H)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(A,X)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(v,en)|0,i=(i=i+Math.imul(v,er)|0)+Math.imul(b,en)|0,o=o+Math.imul(b,er)|0,r=r+Math.imul(p,eo)|0,i=(i=i+Math.imul(p,ea)|0)+Math.imul(m,eo)|0,o=o+Math.imul(m,ea)|0;var eE=(u+(r=r+Math.imul(d,el)|0)|0)+((8191&(i=(i=i+Math.imul(d,eu)|0)+Math.imul(f,el)|0))<<13)|0;u=((o=o+Math.imul(f,eu)|0)+(i>>>13)|0)+(eE>>>26)|0,eE&=67108863,r=Math.imul(N,U),i=(i=Math.imul(N,q))+Math.imul(D,U)|0,o=Math.imul(D,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(R,W)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(A,en)|0,i=(i=i+Math.imul(A,er)|0)+Math.imul(w,en)|0,o=o+Math.imul(w,er)|0,r=r+Math.imul(v,eo)|0,i=(i=i+Math.imul(v,ea)|0)+Math.imul(b,eo)|0,o=o+Math.imul(b,ea)|0,r=r+Math.imul(p,el)|0,i=(i=i+Math.imul(p,eu)|0)+Math.imul(m,el)|0,o=o+Math.imul(m,eu)|0;var eS=(u+(r=r+Math.imul(d,ed)|0)|0)+((8191&(i=(i=i+Math.imul(d,ef)|0)+Math.imul(f,ed)|0))<<13)|0;u=((o=o+Math.imul(f,ef)|0)+(i>>>13)|0)+(eS>>>26)|0,eS&=67108863,r=Math.imul(j,U),i=(i=Math.imul(j,q))+Math.imul(F,U)|0,o=Math.imul(F,q),r=r+Math.imul(N,H)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(M,X)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,en)|0,i=(i=i+Math.imul(E,er)|0)+Math.imul(S,en)|0,o=o+Math.imul(S,er)|0,r=r+Math.imul(A,eo)|0,i=(i=i+Math.imul(A,ea)|0)+Math.imul(w,eo)|0,o=o+Math.imul(w,ea)|0,r=r+Math.imul(v,el)|0,i=(i=i+Math.imul(v,eu)|0)+Math.imul(b,el)|0,o=o+Math.imul(b,eu)|0,r=r+Math.imul(p,ed)|0,i=(i=i+Math.imul(p,ef)|0)+Math.imul(m,ed)|0,o=o+Math.imul(m,ef)|0;var ek=(u+(r=r+Math.imul(d,ep)|0)|0)+((8191&(i=(i=i+Math.imul(d,em)|0)+Math.imul(f,ep)|0))<<13)|0;u=((o=o+Math.imul(f,em)|0)+(i>>>13)|0)+(ek>>>26)|0,ek&=67108863,r=Math.imul(j,H),i=(i=Math.imul(j,V))+Math.imul(F,H)|0,o=Math.imul(F,V),r=r+Math.imul(N,W)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,Z)|0,r=r+Math.imul(R,X)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(M,en)|0,i=(i=i+Math.imul(M,er)|0)+Math.imul(C,en)|0,o=o+Math.imul(C,er)|0,r=r+Math.imul(E,eo)|0,i=(i=i+Math.imul(E,ea)|0)+Math.imul(S,eo)|0,o=o+Math.imul(S,ea)|0,r=r+Math.imul(A,el)|0,i=(i=i+Math.imul(A,eu)|0)+Math.imul(w,el)|0,o=o+Math.imul(w,eu)|0,r=r+Math.imul(v,ed)|0,i=(i=i+Math.imul(v,ef)|0)+Math.imul(b,ed)|0,o=o+Math.imul(b,ef)|0;var eM=(u+(r=r+Math.imul(p,ep)|0)|0)+((8191&(i=(i=i+Math.imul(p,em)|0)+Math.imul(m,ep)|0))<<13)|0;u=((o=o+Math.imul(m,em)|0)+(i>>>13)|0)+(eM>>>26)|0,eM&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Y))+Math.imul(F,W)|0,o=Math.imul(F,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(R,en)|0,i=(i=i+Math.imul(R,er)|0)+Math.imul(I,en)|0,o=o+Math.imul(I,er)|0,r=r+Math.imul(M,eo)|0,i=(i=i+Math.imul(M,ea)|0)+Math.imul(C,eo)|0,o=o+Math.imul(C,ea)|0,r=r+Math.imul(E,el)|0,i=(i=i+Math.imul(E,eu)|0)+Math.imul(S,el)|0,o=o+Math.imul(S,eu)|0,r=r+Math.imul(A,ed)|0,i=(i=i+Math.imul(A,ef)|0)+Math.imul(w,ed)|0,o=o+Math.imul(w,ef)|0;var eC=(u+(r=r+Math.imul(v,ep)|0)|0)+((8191&(i=(i=i+Math.imul(v,em)|0)+Math.imul(b,ep)|0))<<13)|0;u=((o=o+Math.imul(b,em)|0)+(i>>>13)|0)+(eC>>>26)|0,eC&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(F,Q)|0,o=Math.imul(F,Z),r=r+Math.imul(N,X)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(O,en)|0,i=(i=i+Math.imul(O,er)|0)+Math.imul(P,en)|0,o=o+Math.imul(P,er)|0,r=r+Math.imul(R,eo)|0,i=(i=i+Math.imul(R,ea)|0)+Math.imul(I,eo)|0,o=o+Math.imul(I,ea)|0,r=r+Math.imul(M,el)|0,i=(i=i+Math.imul(M,eu)|0)+Math.imul(C,el)|0,o=o+Math.imul(C,eu)|0,r=r+Math.imul(E,ed)|0,i=(i=i+Math.imul(E,ef)|0)+Math.imul(S,ed)|0,o=o+Math.imul(S,ef)|0;var ex=(u+(r=r+Math.imul(A,ep)|0)|0)+((8191&(i=(i=i+Math.imul(A,em)|0)+Math.imul(w,ep)|0))<<13)|0;u=((o=o+Math.imul(w,em)|0)+(i>>>13)|0)+(ex>>>26)|0,ex&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(N,en)|0,i=(i=i+Math.imul(N,er)|0)+Math.imul(D,en)|0,o=o+Math.imul(D,er)|0,r=r+Math.imul(O,eo)|0,i=(i=i+Math.imul(O,ea)|0)+Math.imul(P,eo)|0,o=o+Math.imul(P,ea)|0,r=r+Math.imul(R,el)|0,i=(i=i+Math.imul(R,eu)|0)+Math.imul(I,el)|0,o=o+Math.imul(I,eu)|0,r=r+Math.imul(M,ed)|0,i=(i=i+Math.imul(M,ef)|0)+Math.imul(C,ed)|0,o=o+Math.imul(C,ef)|0;var eR=(u+(r=r+Math.imul(E,ep)|0)|0)+((8191&(i=(i=i+Math.imul(E,em)|0)+Math.imul(S,ep)|0))<<13)|0;u=((o=o+Math.imul(S,em)|0)+(i>>>13)|0)+(eR>>>26)|0,eR&=67108863,r=Math.imul(j,en),i=(i=Math.imul(j,er))+Math.imul(F,en)|0,o=Math.imul(F,er),r=r+Math.imul(N,eo)|0,i=(i=i+Math.imul(N,ea)|0)+Math.imul(D,eo)|0,o=o+Math.imul(D,ea)|0,r=r+Math.imul(O,el)|0,i=(i=i+Math.imul(O,eu)|0)+Math.imul(P,el)|0,o=o+Math.imul(P,eu)|0,r=r+Math.imul(R,ed)|0,i=(i=i+Math.imul(R,ef)|0)+Math.imul(I,ed)|0,o=o+Math.imul(I,ef)|0;var eI=(u+(r=r+Math.imul(M,ep)|0)|0)+((8191&(i=(i=i+Math.imul(M,em)|0)+Math.imul(C,ep)|0))<<13)|0;u=((o=o+Math.imul(C,em)|0)+(i>>>13)|0)+(eI>>>26)|0,eI&=67108863,r=Math.imul(j,eo),i=(i=Math.imul(j,ea))+Math.imul(F,eo)|0,o=Math.imul(F,ea),r=r+Math.imul(N,el)|0,i=(i=i+Math.imul(N,eu)|0)+Math.imul(D,el)|0,o=o+Math.imul(D,eu)|0,r=r+Math.imul(O,ed)|0,i=(i=i+Math.imul(O,ef)|0)+Math.imul(P,ed)|0,o=o+Math.imul(P,ef)|0;var eT=(u+(r=r+Math.imul(R,ep)|0)|0)+((8191&(i=(i=i+Math.imul(R,em)|0)+Math.imul(I,ep)|0))<<13)|0;u=((o=o+Math.imul(I,em)|0)+(i>>>13)|0)+(eT>>>26)|0,eT&=67108863,r=Math.imul(j,el),i=(i=Math.imul(j,eu))+Math.imul(F,el)|0,o=Math.imul(F,eu),r=r+Math.imul(N,ed)|0,i=(i=i+Math.imul(N,ef)|0)+Math.imul(D,ed)|0,o=o+Math.imul(D,ef)|0;var eO=(u+(r=r+Math.imul(O,ep)|0)|0)+((8191&(i=(i=i+Math.imul(O,em)|0)+Math.imul(P,ep)|0))<<13)|0;u=((o=o+Math.imul(P,em)|0)+(i>>>13)|0)+(eO>>>26)|0,eO&=67108863,r=Math.imul(j,ed),i=(i=Math.imul(j,ef))+Math.imul(F,ed)|0,o=Math.imul(F,ef);var eP=(u+(r=r+Math.imul(N,ep)|0)|0)+((8191&(i=(i=i+Math.imul(N,em)|0)+Math.imul(D,ep)|0))<<13)|0;u=((o=o+Math.imul(D,em)|0)+(i>>>13)|0)+(eP>>>26)|0,eP&=67108863;var eL=(u+(r=Math.imul(j,ep))|0)+((8191&(i=(i=Math.imul(j,em))+Math.imul(F,ep)|0))<<13)|0;return u=((o=Math.imul(F,em))+(i>>>13)|0)+(eL>>>26)|0,eL&=67108863,l[0]=eg,l[1]=ev,l[2]=eb,l[3]=ey,l[4]=eA,l[5]=ew,l[6]=e_,l[7]=eE,l[8]=eS,l[9]=ek,l[10]=eM,l[11]=eC,l[12]=ex,l[13]=eR,l[14]=eI,l[15]=eT,l[16]=eO,l[17]=eP,l[18]=eL,0!==u&&(l[19]=u,n.length++),n};function g(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?p(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i>=26,r+=(o/67108864|0)+(a>>>26),this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var i,o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,l=0;l=0&&(0!==u||l>=i);l--){var c=0|this.words[l];this.words[l]=u<<26-o|c>>>o,u=c&s}return r&&0!==u&&(r.words[r.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,l=r.length-o.length;if("mod"!==t){(s=new i(null)).length=l+1,s.words=Array(s.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){var o,a,s;return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||0>this.cmp(e)?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t)},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=67108864%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.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;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(d)),s.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(l)):(r.isub(t),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return 0>(o=0===t.cmpn(1)?a:s).cmpn(0)&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return -1===this.cmpn(e)},i.prototype.lt=function(e){return -1===this.cmp(e)},i.prototype.lten=function(e){return 0>=this.cmpn(e)},i.prototype.lte=function(e){return 0>=this.cmp(e)},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new E(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}b.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength();while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(y,b),y.prototype.split=function(e,t){for(var n=Math.min(e.length,9),r=0;r>>22,i=o}i>>>=22,e.words[r-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){var t;if(v[e])return v[e];if("k256"===e)t=new y;else if("p224"===e)t=new A;else if("p192"===e)t=new w;else{if("p25519"!==e)throw Error("Unknown prime "+e);t=new _}return v[e]=t,t},E.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},E.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},E.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},E.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,e)},E.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var d=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}l=26}return o},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new S(e)},r(S,E),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):0>o.cmpn(0)&&(a=o.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(oI,l);var oT=oI.exports;function oO(e){var t,n=e.modulus.byteLength();do t=new oT(eL(n));while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function oP(e,t){var n,r={blinder:(n=oO(t)).toRed(oT.mont(t.modulus)).redPow(new oT(t.publicExponent)).fromRed(),unblinder:n.invm(t.modulus)},i=t.modulus.byteLength(),o=new oT(e).mul(r.blinder).umod(t.modulus),a=o.toRed(oT.mont(t.prime1)),s=o.toRed(oT.mont(t.prime2)),l=t.coefficient,u=t.prime1,c=t.prime2,d=a.redPow(t.exponent1).fromRed(),f=s.redPow(t.exponent2).fromRed(),h=d.isub(f).imul(l).umod(u).imul(c);return f.iadd(h).imul(r.unblinder).umod(t.modulus).toArrayLike(M,"be",i)}oP.getr=oO;var oL={},oN={version:"6.5.4"},oD={},oB={};(function(e){function t(e){return 1===e.length?"0"+e:e}function n(e){for(var n="",r=0;r>8,a=255&i;o?n.push(o,a):n.push(a)}return n},e.zero2=t,e.toHex=n,e.encode=function(e,t){return"hex"===t?n(e):e}})(oB),oD.assert=im,oD.toArray=oB.toArray,oD.zero2=oB.zero2,oD.toHex=oB.toHex,oD.encode=oB.encode,oD.getNAF=function(e,t,n){var r=Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-l:l,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},oD.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,l=e.andln(3)+i&3,u=t.andln(3)+o&3;3===l&&(l=-1),3===u&&(u=-1),a=0==(1&l)?0:3!=(r=e.andln(7)+i&7)&&5!==r||2!==u?l:-l,n[0].push(a),s=0==(1&u)?0:3!=(r=t.andln(7)+o&7)&&5!==r||2!==l?u:-u,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},oD.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},oD.parseBytes=function(e){return"string"==typeof e?oD.toArray(e,"hex"):e},oD.intFromLE=function(e){return new oA(e,"hex","le")};var oj={},oF=oD.getNAF,oz=oD.getJSF,oU=oD.assert;function oq(e,t){this.type=e,this.p=new oA(t.p,16),this.red=t.prime?oA.red(t.prime):oA.mont(this.p),this.zero=new oA(0).toRed(this.red),this.one=new oA(1).toRed(this.red),this.two=new oA(2).toRed(this.red),this.n=t.n&&new oA(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function oK(e,t){this.curve=e,this.type=t,this.precomputed=null}oq.prototype.point=function(){throw Error("Not implemented")},oq.prototype.validate=function(){throw Error("Not implemented")},oq.prototype._fixedNafMul=function(e,t){oU(e.precomputed);var n=e._getDoubles(),r=oF(t,1,this._bitLength),i=(1<=o;l--)a=(a<<1)+r[l];s.push(a)}for(var u=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o=0;s--){for(var l=0;s>=0&&0===o[s];s--)l++;if(s>=0&&l++,a=a.dblp(l),s<0)break;var u=o[s];oU(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},oq.prototype._wnafMulAdd=function(e,t,n,r,i){var o,a,s,l=this._wnafT1,u=this._wnafT2,c=this._wnafT3,d=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===l[h]&&1===l[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=oz(n[h],n[p]);for(d=Math.max(v[0].length,d),c[h]=Array(d),c[p]=Array(d),a=0;a=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a=0&&_++,A=A.dblp(_),o<0)break;for(a=0;a0?s=u[a][S-1>>1]:S<0&&(s=u[a][-S-1>>1].neg()),A="affine"===s.type?A.mixedAdd(s):A.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},oK.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;ir[0].cmp(r[1])?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new oA(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],oH(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map(function(e){return{a:new oA(e.a,16),b:new oA(e.b,16)}}):this._getEndoBasis(n)}}},oV.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:oA.mont(e),n=new oA(2).toRed(t).redInvm(),r=n.redNeg(),i=new oA(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},oV.prototype._getEndoBasis=function(e){for(var t,n,r,i,o,a,s,l,u,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new oA(1),p=new oA(0),m=new oA(0),g=new oA(1),v=0;0!==d.cmpn(0);){var b=f.div(d);l=f.sub(b.mul(d)),u=m.sub(b.mul(h));var y=g.sub(b.mul(p));if(!r&&0>l.cmp(c))t=s.neg(),n=h,r=l.neg(),i=u;else if(r&&2==++v)break;s=l,f=d,d=l,m=h,h=u,g=p,p=y}o=l.neg(),a=u;var A=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(A)>=0&&(o=t,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},oV.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),l=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(a).sub(s),k2:l.add(u).neg()}},oV.prototype.pointFromX=function(e,t){(e=new oA(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},oV.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},oV.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},o$.prototype.isInfinity=function(){return this.inf},o$.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},o$.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},o$.prototype.getX=function(){return this.x.fromRed()},o$.prototype.getY=function(){return this.y.fromRed()},o$.prototype.mul=function(e){return e=new oA(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},o$.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},o$.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},o$.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},o$.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},o$.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},eD(oW,oq.BasePoint),oV.prototype.jpoint=function(e,t,n){return new oW(this,e,t,n)},oW.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},oW.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},oW.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),l=o.redSub(a);if(0===s.cmpn(0))return 0!==l.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),d=r.redMul(u),f=l.redSqr().redIAdd(c).redISub(d).redISub(d),h=l.redMul(d.redISub(f)).redISub(o.redMul(c)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},oW.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),u=l.redMul(a),c=n.redMul(l),d=s.redSqr().redIAdd(u).redISub(c).redISub(c),f=s.redMul(c.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},oW.prototype.dblp=function(e){if(0===e||this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){var t,n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},oW.prototype.inspect=function(){return this.isInfinity()?"":""},oW.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},eD(oY,oq),oY.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},eD(oG,oq.BasePoint),oY.prototype.decodePoint=function(e,t){return this.point(oD.toArray(e,t),1)},oY.prototype.point=function(e,t){return new oG(this,e,t)},oY.prototype.pointFromJSON=function(e){return oG.fromJSON(this,e)},oG.prototype.precompute=function(){},oG.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},oG.fromJSON=function(e,t){return new oG(e,t[0],t[1]||e.one)},oG.prototype.inspect=function(){return this.isInfinity()?"":""},oG.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},oG.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},oG.prototype.add=function(){throw Error("Not supported on Montgomery curve")},oG.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),a=i.redMul(r),s=t.z.redMul(o.redAdd(a).redSqr()),l=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,l)},oG.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},oG.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},oG.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},oG.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},oG.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},oG.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var oQ=oD.assert;function oZ(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,oq.call(this,"edwards",e),this.a=new oA(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new oA(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new oA(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),oQ(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function oJ(e,t,n,r,i){oq.BasePoint.call(this,e,"projective"),null===t&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new oA(t,16),this.y=new oA(n,16),this.z=r?new oA(r,16):this.curve.one,this.t=i&&new oA(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}eD(oZ,oq),oZ.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},oZ.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},oZ.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},oZ.prototype.pointFromX=function(e,t){(e=new oA(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},oZ.prototype.pointFromY=function(e,t){(e=new oA(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},oZ.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return 0===r.cmp(i)},eD(oJ,oq.BasePoint),oZ.prototype.pointFromJSON=function(e){return oJ.fromJSON(this,e)},oZ.prototype.point=function(e,t,n,r){return new oJ(this,e,t,n,r)},oJ.fromJSON=function(e,t){return new oJ(e,t[0],t[1],t[2])},oJ.prototype.inspect=function(){return this.isInfinity()?"":""},oJ.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},oJ.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),a=o.redSub(n),s=r.redSub(t),l=i.redMul(a),u=o.redMul(s),c=i.redMul(s),d=a.redMul(o);return this.curve.point(l,u,d,c)},oJ.prototype._projDbl=function(){var e,t,n,r,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),l=this.y.redSqr();if(this.curve.twisted){var u=(r=this.curve._mulA(s)).redAdd(l);this.zOne?(e=a.redSub(s).redSub(l).redMul(u.redSub(this.curve.two)),t=u.redMul(r.redSub(l)),n=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=a.redSub(s).redISub(l).redMul(o),t=u.redMul(r.redSub(l)),n=u.redMul(o))}else r=s.redAdd(l),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(s.redISub(l)),n=r.redMul(o);return this.curve.point(e,t,n)},oJ.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},oJ.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),a=i.redSub(r),s=i.redAdd(r),l=n.redAdd(t),u=o.redMul(a),c=s.redMul(l),d=o.redMul(l),f=a.redMul(s);return this.curve.point(u,c,f,d)},oJ.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),l=i.redSub(s),u=i.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),d=r.redMul(l).redMul(c);return this.curve.twisted?(t=r.redMul(u).redMul(a.redSub(this.curve._mulA(o))),n=l.redMul(u)):(t=r.redMul(u).redMul(a.redSub(o)),n=this.curve._mulC(l).redMul(u)),this.curve.point(d,t,n)},oJ.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},oJ.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},oJ.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},oJ.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},oJ.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},oJ.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},oJ.prototype.getX=function(){return this.normalize(),this.x.fromRed()},oJ.prototype.getY=function(){return this.normalize(),this.y.fromRed()},oJ.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},oJ.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},oJ.prototype.toP=oJ.prototype.normalize,oJ.prototype.mixedAdd=oJ.prototype.add,oj.base=oq,oj.short=oV,oj.mont=oY,oj.edwards=oZ;var oX={},o0={},o1={};function o2(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function o3(e){return 1===e.length?"0"+e:e}function o6(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}o1.inherits=eD,o1.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e){if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192:((o=e,a=i,55296!=(64512&o.charCodeAt(a))||a<0||a+1>=o.length||56320!=(64512&o.charCodeAt(a+1)))?n[r++]=s>>12|224:(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128),n[r++]=s>>6&63|128),n[r++]=63&s|128)}}else for(i=0;i>>0;return a},o1.split32=function(e,t){for(var n=Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},o1.rotr32=function(e,t){return e>>>t|e<<32-t},o1.rotl32=function(e,t){return e<>>32-t},o1.sum32=function(e,t){return e+t>>>0},o1.sum32_3=function(e,t,n){return e+t+n>>>0},o1.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},o1.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},o1.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0;e[t]=(o>>0,e[t+1]=o},o1.sum64_hi=function(e,t,n,r){return(t+r>>>0>>0},o1.sum64_lo=function(e,t,n,r){return t+r>>>0},o1.sum64_4_hi=function(e,t,n,r,i,o,a,s){var l=t;return e+n+i+a+(0+(((l=l+r>>>0)>>0)>>0)>>0},o1.sum64_4_lo=function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0},o1.sum64_5_hi=function(e,t,n,r,i,o,a,s,l,u){var c=t;return e+n+i+a+l+(0+(((c=c+r>>>0)>>0)>>0)>>0)>>0},o1.sum64_5_lo=function(e,t,n,r,i,o,a,s,l,u){return t+r+o+s+u>>>0},o1.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},o1.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},o1.shr64_hi=function(e,t,n){return e>>>n},o1.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0};var o4={};function o8(){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}o4.BlockHash=o8,o8.prototype.update=function(e,t){if(e=o1.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=o1.join32(e,0,e.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},o7.g1_256=function(e){return o9(e,17)^o9(e,19)^e>>>10};var at=o1.rotl32,an=o1.sum32,ar=o1.sum32_5,ai=o7.ft_1,ao=o4.BlockHash,aa=[1518500249,1859775393,2400959708,3395469782];function as(){if(!(this instanceof as))return new as;ao.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}o1.inherits(as,ao),as.blockSize=512,as.outSize=160,as.hmacStrength=80,as.padLength=64,as.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}aY.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),im(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},aG.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=oB.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var aJ=oD.assert;function aX(e,t){if(e instanceof aX)return e;this._importDER(e,t)||(aJ(e.r&&e.s,"Signature without r or s"),this.r=new oA(e.r,16),this.s=new oA(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a0(){this.place=0}function a1(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function a2(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}aX.prototype._importDER=function(e,t){e=oD.toArray(e,t);var n=new a0;if(48!==e[n.place++])return!1;var r=a1(e,n);if(!1===r||r+n.place!==e.length||2!==e[n.place++])return!1;var i=a1(e,n);if(!1===i)return!1;var o=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var a=a1(e,n);if(!1===a||e.length!==a+n.place)return!1;var s=e.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new oA(o),this.s=new oA(s),this.recoveryParam=null,!0},aX.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=a2(t),n=a2(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];a3(r,t.length),(r=r.concat(t)).push(2),a3(r,n.length);var i=r.concat(n),o=[48];return a3(o,i.length),o=o.concat(i),oD.encode(o,e)};var a6=oD.assert,a4=oD.parseBytes,a8=oD.cachedProperty;function a5(e,t){this.eddsa=e,this._secret=a4(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=a4(t.pub)}a5.fromPublic=function(e,t){return t instanceof a5?t:new a5(e,{pub:t})},a5.fromSecret=function(e,t){return t instanceof a5?t:new a5(e,{secret:t})},a5.prototype.secret=function(){return this._secret},a8(a5,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),a8(a5,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),a8(a5,"privBytes",function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),a8(a5,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),a8(a5,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),a8(a5,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),a5.prototype.sign=function(e){return a6(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a5.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a5.prototype.getSecret=function(e){return a6(this._secret,"KeyPair is public only"),oD.encode(this.secret(),e)},a5.prototype.getPublic=function(e){return oD.encode(this.pubBytes(),e)};var a7=oD.assert,a9=oD.cachedProperty,se=oD.parseBytes;function st(e,t){this.eddsa=e,"object"!=typeof t&&(t=se(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),a7(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof oA&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}a9(st,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),a9(st,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),a9(st,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),a9(st,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),st.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},st.prototype.toHex=function(){return oD.encode(this.toBytes(),"hex").toUpperCase()};var sn=oD.assert,sr=oD.parseBytes;function si(e){if(sn("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof si))return new si(e);e=oX[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=o0.sha512}function so(){return sd||(sd=1,oL.version=oN.version,oL.utils=oD,oL.rand=o_(),oL.curve=oj,oL.curves=oX,oL.ec=function(){if(sc)return su;sc=1;var e=o_(),t=oD.assert;function n(e){if(!(this instanceof n))return new n(e);"string"==typeof e&&(t(Object.prototype.hasOwnProperty.call(oX,e),"Unknown curve "+e),e=oX[e]),e instanceof oX.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}return su=n,n.prototype.keyPair=function(e){return new aZ(this,e)},n.prototype.keyFromPrivate=function(e,t){return aZ.fromPrivate(this,e,t)},n.prototype.keyFromPublic=function(e,t){return aZ.fromPublic(this,e,t)},n.prototype.genKeyPair=function(t){t||(t={});for(var n=new aG({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||e(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new oA(2));;){var o=new oA(n.generate(r));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}},n.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},n.prototype.sign=function(e,t,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new oA(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new aG({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),l=this.n.sub(new oA(1)),u=0;;u++){var c=r.k?r.k(u):new oA(s.generate(this.n.byteLength()));if(!(0>=(c=this._truncateToN(c,!0)).cmpn(1)||c.cmp(l)>=0)){var d=this.g.mul(c);if(!d.isInfinity()){var f=d.getX(),h=f.umod(this.n);if(0!==h.cmpn(0)){var p=c.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==f.cmp(h)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new aX({r:h,s:p,recoveryParam:m})}}}}}},n.prototype.verify=function(e,t,n,r){e=this._truncateToN(new oA(e,16)),n=this.keyFromPublic(n,r);var i=(t=new aX(t,"hex")).r,o=t.s;if(0>i.cmpn(1)||i.cmp(this.n)>=0||0>o.cmpn(1)||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),l=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(l,n.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(l,n.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},n.prototype.recoverPubKey=function(e,n,r,i){t((3&r)===r,"The recovery param is more than two bits"),n=new aX(n,i);var o=this.n,a=new oA(e),s=n.r,l=n.s,u=1&r,c=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw Error("Unable to find sencond key candinate");s=c?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var d=n.r.invm(o),f=o.sub(a).mul(d).umod(o),h=l.mul(d).umod(o);return this.g.mulAdd(f,s,h)},n.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new aX(t,r)).recoveryParam)return t.recoveryParam;for(var i,o=0;o<4;o++){try{i=this.recoverPubKey(e,t,o)}catch(e){continue}if(i.eq(n))return o}throw Error("Unable to find valid recovery factor")},su}(),oL.eddsa=si),oL}si.prototype.sign=function(e,t){e=sr(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},si.prototype.verify=function(e,t,n){e=sr(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},si.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function a(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}function s(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),l=t;l=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&a0?e:t},i.min=function(e,t){return 0>e.cmp(t)?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,l=Math.min(o,o-a)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch(e){i.prototype.inspect=u}else i.prototype.inspect=u;function u(){return(this.red?""}var c,d=["","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"],f=[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],h=[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 p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,l=a/67108864|0;n.words[0]=s;for(var u=1;u>>26,d=67108863&l,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?d[6-l.length]+l+r:l+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=f[e],c=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(e);r=(p=p.idivn(c)).isZero()?m+r:d[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},c&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(c,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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 a=e.allocUnsafe?e.allocUnsafe(o):new e(o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,b=g>>>13,y=0|a[3],A=8191&y,w=y>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,I=x>>>13,T=0|a[7],O=8191&T,P=T>>>13,L=0|a[8],N=8191&L,D=L>>>13,B=0|a[9],j=8191&B,F=B>>>13,z=0|s[0],U=8191&z,q=z>>>13,K=0|s[1],H=8191&K,V=K>>>13,$=0|s[2],W=8191&$,Y=$>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,J=0|s[4],X=8191&J,ee=J>>>13,et=0|s[5],en=8191&et,er=et>>>13,ei=0|s[6],eo=8191&ei,ea=ei>>>13,es=0|s[7],el=8191&es,eu=es>>>13,ec=0|s[8],ed=8191&ec,ef=ec>>>13,eh=0|s[9],ep=8191&eh,em=eh>>>13;n.negative=e.negative^t.negative,n.length=19;var eg=(u+(r=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,U)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(eg>>>26)|0,eg&=67108863,r=Math.imul(p,U),i=(i=Math.imul(p,q))+Math.imul(m,U)|0,o=Math.imul(m,q);var ev=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(i>>>13)|0)+(ev>>>26)|0,ev&=67108863,r=Math.imul(v,U),i=(i=Math.imul(v,q))+Math.imul(b,U)|0,o=Math.imul(b,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,V)|0;var eb=(u+(r=r+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,W)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(eb>>>26)|0,eb&=67108863,r=Math.imul(A,U),i=(i=Math.imul(A,q))+Math.imul(w,U)|0,o=Math.imul(w,q),r=r+Math.imul(v,H)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var ey=(u+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(ey>>>26)|0,ey&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,q))+Math.imul(S,U)|0,o=Math.imul(S,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,V)|0,r=r+Math.imul(v,W)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var eA=(u+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(eA>>>26)|0,eA&=67108863,r=Math.imul(M,U),i=(i=Math.imul(M,q))+Math.imul(C,U)|0,o=Math.imul(C,q),r=r+Math.imul(E,H)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(A,W)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,Z)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var ew=(u+(r=r+Math.imul(d,en)|0)|0)+((8191&(i=(i=i+Math.imul(d,er)|0)+Math.imul(f,en)|0))<<13)|0;u=((o=o+Math.imul(f,er)|0)+(i>>>13)|0)+(ew>>>26)|0,ew&=67108863,r=Math.imul(R,U),i=(i=Math.imul(R,q))+Math.imul(I,U)|0,o=Math.imul(I,q),r=r+Math.imul(M,H)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(E,W)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,Z)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,ee)|0,r=r+Math.imul(p,en)|0,i=(i=i+Math.imul(p,er)|0)+Math.imul(m,en)|0,o=o+Math.imul(m,er)|0;var e_=(u+(r=r+Math.imul(d,eo)|0)|0)+((8191&(i=(i=i+Math.imul(d,ea)|0)+Math.imul(f,eo)|0))<<13)|0;u=((o=o+Math.imul(f,ea)|0)+(i>>>13)|0)+(e_>>>26)|0,e_&=67108863,r=Math.imul(O,U),i=(i=Math.imul(O,q))+Math.imul(P,U)|0,o=Math.imul(P,q),r=r+Math.imul(R,H)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(A,X)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(v,en)|0,i=(i=i+Math.imul(v,er)|0)+Math.imul(b,en)|0,o=o+Math.imul(b,er)|0,r=r+Math.imul(p,eo)|0,i=(i=i+Math.imul(p,ea)|0)+Math.imul(m,eo)|0,o=o+Math.imul(m,ea)|0;var eE=(u+(r=r+Math.imul(d,el)|0)|0)+((8191&(i=(i=i+Math.imul(d,eu)|0)+Math.imul(f,el)|0))<<13)|0;u=((o=o+Math.imul(f,eu)|0)+(i>>>13)|0)+(eE>>>26)|0,eE&=67108863,r=Math.imul(N,U),i=(i=Math.imul(N,q))+Math.imul(D,U)|0,o=Math.imul(D,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(R,W)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(A,en)|0,i=(i=i+Math.imul(A,er)|0)+Math.imul(w,en)|0,o=o+Math.imul(w,er)|0,r=r+Math.imul(v,eo)|0,i=(i=i+Math.imul(v,ea)|0)+Math.imul(b,eo)|0,o=o+Math.imul(b,ea)|0,r=r+Math.imul(p,el)|0,i=(i=i+Math.imul(p,eu)|0)+Math.imul(m,el)|0,o=o+Math.imul(m,eu)|0;var eS=(u+(r=r+Math.imul(d,ed)|0)|0)+((8191&(i=(i=i+Math.imul(d,ef)|0)+Math.imul(f,ed)|0))<<13)|0;u=((o=o+Math.imul(f,ef)|0)+(i>>>13)|0)+(eS>>>26)|0,eS&=67108863,r=Math.imul(j,U),i=(i=Math.imul(j,q))+Math.imul(F,U)|0,o=Math.imul(F,q),r=r+Math.imul(N,H)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(M,X)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,en)|0,i=(i=i+Math.imul(E,er)|0)+Math.imul(S,en)|0,o=o+Math.imul(S,er)|0,r=r+Math.imul(A,eo)|0,i=(i=i+Math.imul(A,ea)|0)+Math.imul(w,eo)|0,o=o+Math.imul(w,ea)|0,r=r+Math.imul(v,el)|0,i=(i=i+Math.imul(v,eu)|0)+Math.imul(b,el)|0,o=o+Math.imul(b,eu)|0,r=r+Math.imul(p,ed)|0,i=(i=i+Math.imul(p,ef)|0)+Math.imul(m,ed)|0,o=o+Math.imul(m,ef)|0;var ek=(u+(r=r+Math.imul(d,ep)|0)|0)+((8191&(i=(i=i+Math.imul(d,em)|0)+Math.imul(f,ep)|0))<<13)|0;u=((o=o+Math.imul(f,em)|0)+(i>>>13)|0)+(ek>>>26)|0,ek&=67108863,r=Math.imul(j,H),i=(i=Math.imul(j,V))+Math.imul(F,H)|0,o=Math.imul(F,V),r=r+Math.imul(N,W)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,Z)|0,r=r+Math.imul(R,X)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(M,en)|0,i=(i=i+Math.imul(M,er)|0)+Math.imul(C,en)|0,o=o+Math.imul(C,er)|0,r=r+Math.imul(E,eo)|0,i=(i=i+Math.imul(E,ea)|0)+Math.imul(S,eo)|0,o=o+Math.imul(S,ea)|0,r=r+Math.imul(A,el)|0,i=(i=i+Math.imul(A,eu)|0)+Math.imul(w,el)|0,o=o+Math.imul(w,eu)|0,r=r+Math.imul(v,ed)|0,i=(i=i+Math.imul(v,ef)|0)+Math.imul(b,ed)|0,o=o+Math.imul(b,ef)|0;var eM=(u+(r=r+Math.imul(p,ep)|0)|0)+((8191&(i=(i=i+Math.imul(p,em)|0)+Math.imul(m,ep)|0))<<13)|0;u=((o=o+Math.imul(m,em)|0)+(i>>>13)|0)+(eM>>>26)|0,eM&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Y))+Math.imul(F,W)|0,o=Math.imul(F,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(R,en)|0,i=(i=i+Math.imul(R,er)|0)+Math.imul(I,en)|0,o=o+Math.imul(I,er)|0,r=r+Math.imul(M,eo)|0,i=(i=i+Math.imul(M,ea)|0)+Math.imul(C,eo)|0,o=o+Math.imul(C,ea)|0,r=r+Math.imul(E,el)|0,i=(i=i+Math.imul(E,eu)|0)+Math.imul(S,el)|0,o=o+Math.imul(S,eu)|0,r=r+Math.imul(A,ed)|0,i=(i=i+Math.imul(A,ef)|0)+Math.imul(w,ed)|0,o=o+Math.imul(w,ef)|0;var eC=(u+(r=r+Math.imul(v,ep)|0)|0)+((8191&(i=(i=i+Math.imul(v,em)|0)+Math.imul(b,ep)|0))<<13)|0;u=((o=o+Math.imul(b,em)|0)+(i>>>13)|0)+(eC>>>26)|0,eC&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(F,Q)|0,o=Math.imul(F,Z),r=r+Math.imul(N,X)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(O,en)|0,i=(i=i+Math.imul(O,er)|0)+Math.imul(P,en)|0,o=o+Math.imul(P,er)|0,r=r+Math.imul(R,eo)|0,i=(i=i+Math.imul(R,ea)|0)+Math.imul(I,eo)|0,o=o+Math.imul(I,ea)|0,r=r+Math.imul(M,el)|0,i=(i=i+Math.imul(M,eu)|0)+Math.imul(C,el)|0,o=o+Math.imul(C,eu)|0,r=r+Math.imul(E,ed)|0,i=(i=i+Math.imul(E,ef)|0)+Math.imul(S,ed)|0,o=o+Math.imul(S,ef)|0;var ex=(u+(r=r+Math.imul(A,ep)|0)|0)+((8191&(i=(i=i+Math.imul(A,em)|0)+Math.imul(w,ep)|0))<<13)|0;u=((o=o+Math.imul(w,em)|0)+(i>>>13)|0)+(ex>>>26)|0,ex&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(N,en)|0,i=(i=i+Math.imul(N,er)|0)+Math.imul(D,en)|0,o=o+Math.imul(D,er)|0,r=r+Math.imul(O,eo)|0,i=(i=i+Math.imul(O,ea)|0)+Math.imul(P,eo)|0,o=o+Math.imul(P,ea)|0,r=r+Math.imul(R,el)|0,i=(i=i+Math.imul(R,eu)|0)+Math.imul(I,el)|0,o=o+Math.imul(I,eu)|0,r=r+Math.imul(M,ed)|0,i=(i=i+Math.imul(M,ef)|0)+Math.imul(C,ed)|0,o=o+Math.imul(C,ef)|0;var eR=(u+(r=r+Math.imul(E,ep)|0)|0)+((8191&(i=(i=i+Math.imul(E,em)|0)+Math.imul(S,ep)|0))<<13)|0;u=((o=o+Math.imul(S,em)|0)+(i>>>13)|0)+(eR>>>26)|0,eR&=67108863,r=Math.imul(j,en),i=(i=Math.imul(j,er))+Math.imul(F,en)|0,o=Math.imul(F,er),r=r+Math.imul(N,eo)|0,i=(i=i+Math.imul(N,ea)|0)+Math.imul(D,eo)|0,o=o+Math.imul(D,ea)|0,r=r+Math.imul(O,el)|0,i=(i=i+Math.imul(O,eu)|0)+Math.imul(P,el)|0,o=o+Math.imul(P,eu)|0,r=r+Math.imul(R,ed)|0,i=(i=i+Math.imul(R,ef)|0)+Math.imul(I,ed)|0,o=o+Math.imul(I,ef)|0;var eI=(u+(r=r+Math.imul(M,ep)|0)|0)+((8191&(i=(i=i+Math.imul(M,em)|0)+Math.imul(C,ep)|0))<<13)|0;u=((o=o+Math.imul(C,em)|0)+(i>>>13)|0)+(eI>>>26)|0,eI&=67108863,r=Math.imul(j,eo),i=(i=Math.imul(j,ea))+Math.imul(F,eo)|0,o=Math.imul(F,ea),r=r+Math.imul(N,el)|0,i=(i=i+Math.imul(N,eu)|0)+Math.imul(D,el)|0,o=o+Math.imul(D,eu)|0,r=r+Math.imul(O,ed)|0,i=(i=i+Math.imul(O,ef)|0)+Math.imul(P,ed)|0,o=o+Math.imul(P,ef)|0;var eT=(u+(r=r+Math.imul(R,ep)|0)|0)+((8191&(i=(i=i+Math.imul(R,em)|0)+Math.imul(I,ep)|0))<<13)|0;u=((o=o+Math.imul(I,em)|0)+(i>>>13)|0)+(eT>>>26)|0,eT&=67108863,r=Math.imul(j,el),i=(i=Math.imul(j,eu))+Math.imul(F,el)|0,o=Math.imul(F,eu),r=r+Math.imul(N,ed)|0,i=(i=i+Math.imul(N,ef)|0)+Math.imul(D,ed)|0,o=o+Math.imul(D,ef)|0;var eO=(u+(r=r+Math.imul(O,ep)|0)|0)+((8191&(i=(i=i+Math.imul(O,em)|0)+Math.imul(P,ep)|0))<<13)|0;u=((o=o+Math.imul(P,em)|0)+(i>>>13)|0)+(eO>>>26)|0,eO&=67108863,r=Math.imul(j,ed),i=(i=Math.imul(j,ef))+Math.imul(F,ed)|0,o=Math.imul(F,ef);var eP=(u+(r=r+Math.imul(N,ep)|0)|0)+((8191&(i=(i=i+Math.imul(N,em)|0)+Math.imul(D,ep)|0))<<13)|0;u=((o=o+Math.imul(D,em)|0)+(i>>>13)|0)+(eP>>>26)|0,eP&=67108863;var eL=(u+(r=Math.imul(j,ep))|0)+((8191&(i=(i=Math.imul(j,em))+Math.imul(F,ep)|0))<<13)|0;return u=((o=Math.imul(F,em))+(i>>>13)|0)+(eL>>>26)|0,eL&=67108863,l[0]=eg,l[1]=ev,l[2]=eb,l[3]=ey,l[4]=eA,l[5]=ew,l[6]=e_,l[7]=eE,l[8]=eS,l[9]=ek,l[10]=eM,l[11]=eC,l[12]=ex,l[13]=eR,l[14]=eI,l[15]=eT,l[16]=eO,l[17]=eP,l[18]=eL,0!==u&&(l[19]=u,n.length++),n};function g(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?p(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i>=26,r+=(o/67108864|0)+(a>>>26),this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var i,o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,l=0;l=0&&(0!==u||l>=i);l--){var c=0|this.words[l];this.words[l]=u<<26-o|c>>>o,u=c&s}return r&&0!==u&&(r.words[r.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,l=r.length-o.length;if("mod"!==t){(s=new i(null)).length=l+1,s.words=Array(s.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){var o,a,s;return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||0>this.cmp(e)?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t)},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=67108864%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.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;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(d)),s.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(l)):(r.isub(t),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return 0>(o=0===t.cmpn(1)?a:s).cmpn(0)&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return -1===this.cmpn(e)},i.prototype.lt=function(e){return -1===this.cmp(e)},i.prototype.lten=function(e){return 0>=this.cmpn(e)},i.prototype.lte=function(e){return 0>=this.cmp(e)},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new E(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){E.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}b.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength();while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(y,b),y.prototype.split=function(e,t){for(var n=Math.min(e.length,9),r=0;r>>22,i=o}i>>>=22,e.words[r-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){var t;if(v[e])return v[e];if("k256"===e)t=new y;else if("p224"===e)t=new A;else if("p192"===e)t=new w;else{if("p25519"!==e)throw Error("Unknown prime "+e);t=new _}return v[e]=t,t},E.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},E.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},E.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},E.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,e)},E.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var d=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}l=26}return o},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new S(e)},r(S,E),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):0>o.cmpn(0)&&(a=o.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(sa,l);var ss,sl,su,sc,sd,sf,sh=sa.exports,sp={},sm={},sg={},sv={},sb=er.Buffer,sy={};for(sf in er)er.hasOwnProperty(sf)&&"SlowBuffer"!==sf&&"Buffer"!==sf&&(sy[sf]=er[sf]);var sA=sy.Buffer={};for(sf in sb)sb.hasOwnProperty(sf)&&"allocUnsafe"!==sf&&"allocUnsafeSlow"!==sf&&(sA[sf]=sb[sf]);if(sy.Buffer.prototype=sb.prototype,sA.from&&sA.from!==Uint8Array.from||(sA.from=function(e,t,n){if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return sb(e,t,n)}),sA.alloc||(sA.alloc=function(e,t,n){if("number"!=typeof e)throw TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*1073741824)throw RangeError('The value "'+e+'" is invalid for option "size"');var r=sb(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!sy.kStringMaxLength)try{sy.kStringMaxLength=ex.binding("buffer").kStringMaxLength}catch(e){}sy.constants||(sy.constants={MAX_LENGTH:sy.kMaxLength},sy.kStringMaxLength&&(sy.constants.MAX_STRING_LENGTH=sy.kStringMaxLength));var sw={};function s_(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function sE(e,t){this.path=e,this.rethrow(t)}sw.Reporter=s_,s_.prototype.isError=function(e){return e instanceof sE},s_.prototype.save=function(){let e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},s_.prototype.restore=function(e){let t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},s_.prototype.enterKey=function(e){return this._reporterState.path.push(e)},s_.prototype.exitKey=function(e){let t=this._reporterState;t.path=t.path.slice(0,e-1)},s_.prototype.leaveKey=function(e,t,n){let r=this._reporterState;this.exitKey(e),null!==r.obj&&(r.obj[t]=n)},s_.prototype.path=function(){return this._reporterState.path.join("/")},s_.prototype.enterObject=function(){let e=this._reporterState,t=e.obj;return e.obj={},t},s_.prototype.leaveObject=function(e){let t=this._reporterState,n=t.obj;return t.obj=e,n},s_.prototype.error=function(e){let t;let n=this._reporterState,r=e instanceof sE;if(t=r?e:new sE(n.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!n.options.partial)throw t;return r||n.errors.push(t),t},s_.prototype.wrapResult=function(e){let t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},eD(sE,Error),sE.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,sE),!this.stack)try{throw Error(this.message)}catch(e){this.stack=e.stack}return this};var sS={};let sk=sw.Reporter,sM=sy.Buffer;function sC(e,t){sk.call(this,t),sM.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function sx(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return sx.isEncoderBuffer(e)||(e=new sx(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=sM.byteLength(e);else{if(!sM.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}eD(sC,sk),sS.DecoderBuffer=sC,sC.isDecoderBuffer=function(e){return e instanceof sC||"object"==typeof e&&sM.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},sC.prototype.save=function(){return{offset:this.offset,reporter:sk.prototype.save.call(this)}},sC.prototype.restore=function(e){let t=new sC(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,sk.prototype.restore.call(this,e.reporter),t},sC.prototype.isEmpty=function(){return this.offset===this.length},sC.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},sC.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");let n=new sC(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},sC.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},sS.EncoderBuffer=sx,sx.isEncoderBuffer=function(e){return e instanceof sx||"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},sx.prototype.join=function(e,t){return e||(e=sM.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,t),t+=n.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):sM.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e};let sR=sw.Reporter,sI=sS.EncoderBuffer,sT=sS.DecoderBuffer,sO=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],sP=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(sO);function sL(e,t,n){let r={};this._baseState=r,r.name=n,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}let sN=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];sL.prototype.clone=function(){let e=this._baseState,t={};sN.forEach(function(n){t[n]=e[n]});let n=new this.constructor(t.parent);return n._baseState=t,n},sL.prototype._wrap=function(){let e=this._baseState;sP.forEach(function(t){this[t]=function(){let n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}},this)},sL.prototype._init=function(e){let t=this._baseState;im(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),im.equal(t.children.length,1,"Root node can have only one child")},sL.prototype._useArgs=function(e){let t=this._baseState,n=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==n.length&&(im(null===t.children),t.children=n,n.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(im(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;let t={};return Object.keys(e).forEach(function(n){n==(0|n)&&(n|=0),t[e[n]]=n}),t}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){sL.prototype[e]=function(){throw Error(e+" not implemented for encoding: "+this._baseState.enc)}}),sO.forEach(function(e){sL.prototype[e]=function(){let t=this._baseState,n=Array.prototype.slice.call(arguments);return im(null===t.tag),t.tag=e,this._useArgs(n),this}}),sL.prototype.use=function(e){im(e);let t=this._baseState;return im(null===t.use),t.use=e,this},sL.prototype.optional=function(){return this._baseState.optional=!0,this},sL.prototype.def=function(e){let t=this._baseState;return im(null===t.default),t.default=e,t.optional=!0,this},sL.prototype.explicit=function(e){let t=this._baseState;return im(null===t.explicit&&null===t.implicit),t.explicit=e,this},sL.prototype.implicit=function(e){let t=this._baseState;return im(null===t.explicit&&null===t.implicit),t.implicit=e,this},sL.prototype.obj=function(){let e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},sL.prototype.key=function(e){let t=this._baseState;return im(null===t.key),t.key=e,this},sL.prototype.any=function(){return this._baseState.any=!0,this},sL.prototype.choice=function(e){let t=this._baseState;return im(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},sL.prototype.contains=function(e){let t=this._baseState;return im(null===t.use),t.contains=e,this},sL.prototype._decode=function(e,t){let n=this._baseState;if(null===n.parent)return e.wrapResult(n.children[0]._decode(e,t));let r,i=n.default,o=!0,a=null;if(null!==n.key&&(a=e.enterKey(n.key)),n.optional){let r=null;if(null!==n.explicit?r=n.explicit:null!==n.implicit?r=n.implicit:null!==n.tag&&(r=n.tag),null!==r||n.any){if(o=this._peekTag(e,r,n.any),e.isError(o))return o}else{let r=e.save();try{null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),o=!0}catch(e){o=!1}e.restore(r)}}if(n.obj&&o&&(r=e.enterObject()),o){if(null!==n.explicit){let t=this._decodeTag(e,n.explicit);if(e.isError(t))return t;e=t}let r=e.offset;if(null===n.use&&null===n.choice){let t;n.any&&(t=e.save());let r=this._decodeTag(e,null!==n.implicit?n.implicit:n.tag,n.any);if(e.isError(r))return r;n.any?i=e.raw(t):e=r}if(t&&t.track&&null!==n.tag&&t.track(e.path(),r,e.length,"tagged"),t&&t.track&&null!==n.tag&&t.track(e.path(),e.offset,e.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function(n){n._decode(e,t)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){let r=new sT(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(r,t)}}return n.obj&&o&&(i=e.leaveObject(r)),null===n.key||null===i&&!0!==o?null!==a&&e.exitKey(a):e.leaveKey(a,n.key,i),i},sL.prototype._decodeGeneric=function(e,t,n){let r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):"objid"===e?this._decodeObjid(t,null,null,n):"gentime"===e||"utctime"===e?this._decodeTime(t,e,n):"null_"===e?this._decodeNull(t,n):"bool"===e?this._decodeBool(t,n):"objDesc"===e?this._decodeStr(t,e,n):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,t._reporterState.obj)._decode(t,n):t.error("unknown tag: "+e)},sL.prototype._getUse=function(e,t){let n=this._baseState;return n.useDecoder=this._use(e,t),im(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},sL.prototype._decodeChoice=function(e,t){let n=this._baseState,r=null,i=!1;return Object.keys(n.choice).some(function(o){let a=e.save(),s=n.choice[o];try{let n=s._decode(e,t);if(e.isError(n))return!1;r={type:o,value:n},i=!0}catch(t){return e.restore(a),!1}return!0},this),i?r:e.error("Choice not matched")},sL.prototype._createEncoderBuffer=function(e){return new sI(e,this.reporter)},sL.prototype._encode=function(e,t,n){let r=this._baseState;if(null!==r.default&&r.default===e)return;let i=this._encodeValue(e,t,n);return void 0===i||this._skipDefault(i,t,n)?void 0:i},sL.prototype._encodeValue=function(e,t,n){let r=this._baseState;if(null===r.parent)return r.children[0]._encode(e,t||new sR);let i=null;if(this.reporter=t,r.optional&&void 0===e){if(null===r.default)return;e=r.default}let o=null,a=!1;if(r.any)i=this._createEncoderBuffer(e);else if(r.choice)i=this._encodeChoice(e,t);else if(r.contains)o=this._getUse(r.contains,n)._encode(e,t),a=!0;else if(r.children)o=r.children.map(function(n){if("null_"===n._baseState.tag)return n._encode(null,t,e);if(null===n._baseState.key)return t.error("Child should have a key");let r=t.enterKey(n._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");let i=n._encode(e[n._baseState.key],t,e);return t.leaveKey(r),i},this).filter(function(e){return e}),o=this._createEncoderBuffer(o);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");let n=this.clone();n._baseState.implicit=null,o=this._createEncoderBuffer(e.map(function(n){let r=this._baseState;return this._getUse(r.args[0],e)._encode(n,t)},n))}else null!==r.use?i=this._getUse(r.use,n)._encode(e,t):(o=this._encodePrimitive(r.tag,e),a=!0);if(!r.any&&null===r.choice){let e=null!==r.implicit?r.implicit:r.tag,n=null===r.implicit?"universal":"context";null===e?null===r.use&&t.error("Tag could be omitted only for .use()"):null===r.use&&(i=this._encodeComposite(e,a,n,o))}return null!==r.explicit&&(i=this._encodeComposite(r.explicit,!1,"context",i)),i},sL.prototype._encodeChoice=function(e,t){let n=this._baseState,r=n.choice[e.type];return r||im(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},sL.prototype._encodePrimitive=function(e,t){let n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw Error("Unsupported tag: "+e)},sL.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},sL.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)};var sD={};!function(e){function t(e){let t={};return Object.keys(e).forEach(function(n){(0|n)==n&&(n|=0),t[e[n]]=n}),t}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=t(e.tag)}(sD);let sB=sy.Buffer;function sj(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new sF,this.tree._init(e.body)}function sF(e){sL.call(this,"der",e)}function sz(e){return e<10?"0"+e:e}function sU(e){sj.call(this,e),this.enc="pem"}sj.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},eD(sF,sL),sF.prototype._encodeComposite=function(e,t,n,r){let i=function(e,t,n,r){let i;if("seqof"===e?e="seq":"setof"===e&&(e="set"),sD.tagByName.hasOwnProperty(e))i=sD.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return r.error("Unknown tag: "+e);i=e}return i>=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|sD.tagClassByName[n||"universal"]<<6)}(e,t,n,this.reporter);if(r.length<128){let e=sB.alloc(2);return e[0]=i,e[1]=r.length,this._createEncoderBuffer([e,r])}let o=1;for(let e=r.length;e>=256;e>>=8)o++;let a=sB.alloc(2+o);a[0]=i,a[1]=128|o;for(let e=1+o,t=r.length;t>0;e--,t>>=8)a[e]=255&t;return this._createEncoderBuffer([a,r])},sF.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){let t=sB.alloc(2*e.length);for(let n=0;n=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let r=0;for(let t=0;t=128;n>>=7)r++}let i=sB.alloc(r),o=i.length-1;for(let t=e.length-1;t>=0;t--){let n=e[t];for(i[o--]=127&n;(n>>=7)>0;)i[o--]=128|127&n}return this._createEncoderBuffer(i)},sF.prototype._encodeTime=function(e,t){let n;let r=new Date(e);return"gentime"===t?n=[sz(r.getUTCFullYear()),sz(r.getUTCMonth()+1),sz(r.getUTCDate()),sz(r.getUTCHours()),sz(r.getUTCMinutes()),sz(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[sz(r.getUTCFullYear()%100),sz(r.getUTCMonth()+1),sz(r.getUTCDate()),sz(r.getUTCHours()),sz(r.getUTCMinutes()),sz(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},sF.prototype._encodeNull=function(){return this._createEncoderBuffer("")},sF.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!sB.isBuffer(e)){let t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=sB.from(t)}if(sB.isBuffer(e)){let t=e.length;0===e.length&&t++;let n=sB.alloc(t);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let t=e;t>=256;t>>=8)n++;let r=Array(n);for(let t=r.length-1;t>=0;t--)r[t]=255&e,e>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(sB.from(r))},sF.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},sF.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},sF.prototype._skipDefault=function(e,t,n){let r;let i=this._baseState;if(null===i.default)return!1;let o=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,n).join()),o.length!==i.defaultBuffer.length)return!1;for(r=0;r>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=e.readUInt8(t),e.isError(r))return r;n<<=7,n|=127&r}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:sD.tag[n]}}function sW(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;let i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(let t=0;tn-a-2)throw Error("message too long");var s=lI.alloc(n-r-a-2),l=n-o-1,u=eL(o),c=lC(lI.concat([i,s,lI.alloc(1,1),t],l),lM(u,l)),d=lC(u,lM(c,o));return new oA(lI.concat([lI.alloc(1),d,c],n))}(o,t);else if(1===r)i=function(e,t,n){var r,i=t.length,o=e.modulus.byteLength();if(i>o-11)throw Error("message too long");return r=n?lI.alloc(o-i-3,255):function(e){for(var t,n=lI.allocUnsafe(e),r=0,i=eL(2*e),o=0;r=0)throw Error("data too long for modulus")}return n?oP(i,o):lR(i,o)},lS.privateDecrypt=function(e,t,n){r=e.padding?e.padding:n?1:4;var r,i,o=lm(e),a=o.modulus.byteLength();if(t.length>a||new oA(t).cmp(o.modulus)>=0)throw Error("decryption error");i=n?lR(new oA(t),o):oP(t,o);var s=lT.alloc(a-i.length);if(i=lT.concat([s,i],a),4===r)return function(e,t){var n=e.modulus.byteLength(),r=rU("sha1").update(lT.alloc(0)).digest(),i=r.length;if(0!==t[0])throw Error("decryption error");var o=t.slice(1,i+1),a=t.slice(i+1),s=lC(o,lM(a,i)),l=lC(a,lM(s,n-i-1));if(function(e,t){e=lT.from(e),t=lT.from(t);var n=0,r=e.length;e.length!==t.length&&(n++,r=Math.min(e.length,t.length));for(var i=-1;++i=t.length){o++;break}var a=t.slice(2,i-1);if(("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++,a.length<8&&o++,o)throw Error("decryption error");return t.slice(i)}(0,i,n);if(3===r)return i;throw Error("unknown padding")},lS.privateEncrypt=function(e,t){return lS.publicEncrypt(e,t,!0)},lS.publicDecrypt=function(e,t){return lS.privateDecrypt(e,t,!0)};var lO={};function lP(){throw Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var lL,lN=eT(),lD=lN.Buffer,lB=lN.kMaxLength,lj=l.crypto||l.msCrypto;function lF(e,t){if("number"!=typeof e||e!=e)throw TypeError("offset must be a number");if(e>4294967295||e<0)throw TypeError("offset must be a uint32");if(e>lB||e>t)throw RangeError("offset out of range")}function lz(e,t,n){if("number"!=typeof e||e!=e)throw TypeError("size must be a number");if(e>4294967295||e<0)throw TypeError("size must be a uint32");if(e+t>n||e>lB)throw RangeError("buffer too small")}function lU(e,t,n,r){var i=new Uint8Array(e.buffer,t,n);return lj.getRandomValues(i),r?void ew(function(){r(null,e)}):e}function lq(){if(lL)return ei;lL=1,ei.randomBytes=ei.rng=ei.pseudoRandomBytes=ei.prng=eL,ei.createHash=ei.Hash=rU,ei.createHmac=ei.Hmac=rZ;var e=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(Object.keys(rJ));ei.getHashes=function(){return e},ei.pbkdf2=rX.pbkdf2,ei.pbkdf2Sync=rX.pbkdf2Sync,ei.Cipher=il.Cipher,ei.createCipher=il.createCipher,ei.Cipheriv=il.Cipheriv,ei.createCipheriv=il.createCipheriv,ei.Decipher=il.Decipher,ei.createDecipher=il.createDecipher,ei.Decipheriv=il.Decipheriv,ei.createDecipheriv=il.createDecipheriv,ei.getCiphers=il.getCiphers,ei.listCiphers=il.listCiphers;var t=function(){if(oC)return oh;oC=1;var e=oS(),t=function(){if(oM)return ok;oM=1;var e=new(oE()),t=new oA(24),n=new oA(11),r=new oA(10),i=new oA(3),o=new oA(7),a=oS();function s(e,t){return t=t||"utf8",Z(e)||(e=new M(e,t)),this._pub=new oA(e),this}function l(e,t){return t=t||"utf8",Z(e)||(e=new M(e,t)),this._priv=new oA(e),this}ok=c;var u={};function c(e,t,n){this.setGenerator(t),this.__prime=new oA(e),this._prime=oA.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=s,this.setPrivateKey=l):this._primeCode=8}function d(e,t){var n=new M(e.toArray());return t?n.toString(t):n}return Object.defineProperty(c.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(s,l){var c=l.toString("hex"),d=[c,s.toString(16)].join("_");if(d in u)return u[d];var f,h=0;if(s.isEven()||!a.simpleSieve||!a.fermatTest(s)||!e.test(s))return h+=1+("02"===c||"05"===c?8:4),u[d]=h,h;switch(e.test(s.shrn(1))||(h+=2),c){case"02":s.mod(t).cmp(n)&&(h+=8);break;case"05":(f=s.mod(r)).cmp(i)&&f.cmp(o)&&(h+=8);break;default:h+=4}return u[d]=h,h}(this.__prime,this.__gen)),this._primeCode}}),c.prototype.generateKeys=function(){return this._priv||(this._priv=new oA(eL(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},c.prototype.computeSecret=function(e){var t=new M((e=(e=new oA(e)).toRed(this._prime)).redPow(this._priv).fromRed().toArray()),n=this.getPrime();if(t.length0&&n.ishrn(r),n}function i(t,n,i){var o,a;do{for(o=e.alloc(0);8*o.length=e.cmpn(0)||e.cmp(t)>=t)throw Error("invalid sig")}return lv=function(r,i,o,a,s){var l,u,c,d,f,h,p,m,g,v,b,y=lm(o);if("ec"===y.type){if("ecdsa"!==a&&"ecdsa/rsa"!==a)throw Error("wrong public key type");return function(e,n,r){var i=lE[r.data.algorithm.curve.join(".")];if(!i)throw Error("unknown curve "+r.data.algorithm.curve.join("."));var o=new t(i),a=r.data.subjectPrivateKey.data;return o.verify(n,e,a)}(r,i,y)}if("dsa"===y.type){if("dsa"!==a)throw Error("wrong public key type");return l=r,u=i,c=y.data.p,d=y.data.q,f=y.data.g,h=y.data.pub_key,m=(p=lm.signature.decode(l,"der")).s,g=p.r,n(m,d),n(g,d),v=sh.mont(c),b=m.invm(d),0===f.toRed(v).redPow(new sh(u).mul(b).mod(d)).fromRed().mul(h.toRed(v).redPow(g.mul(b).mod(d)).fromRed()).mod(c).mod(d).cmp(g)}if("rsa"!==a&&"ecdsa/rsa"!==a)throw Error("wrong public key type");i=e.concat([s,i]);for(var A=y.modulus.byteLength(),w=[1],_=0;i.length+w.length+2{switch(e){case"sha256":case"sha3-256":case"blake2s256":return 32;case"sha512":case"sha3-512":case"blake2b512":return 64;case"sha224":case"sha3-224":return 28;case"sha384":case"sha3-384":return 48;case"sha1":return 20;case"md5":return 16;default:{let t=l$[e];return void 0===t&&(t=lH(e).digest().length,l$[e]=t),t}}},lY=(e,t,n,r)=>{let i=lK.isBuffer(n)?n:lK.from(n);return lV(e,r&&r.length?lK.from(r):lK.alloc(t,0)).update(i).digest()},lG=(e,t,n,r,i)=>{let o=lK.isBuffer(i)?i:lK.from(i||""),a=o.length,s=Math.ceil(r/t);if(s>255)throw Error(`OKM length ${r} is too long for ${e} hash`);let l=lK.alloc(t*s+a+1);for(let r=1,i=0,u=0;r<=s;++r)o.copy(l,u),l[u+a]=r,lV(e,n).update(l.slice(i,u+a+1)).digest().copy(l,u),i=u,u+=t;return l.slice(0,r)};function lQ(e,t,{salt:n="",info:r="",hash:i="SHA-256"}={}){let o=lW(i=i.toLowerCase().replace("-","")),a=lY(i,o,e,n);return lG(i,o,a,t,r)}Object.defineProperties(lQ,{hash_length:{configurable:!1,enumerable:!1,writable:!1,value:lW},extract:{configurable:!1,enumerable:!1,writable:!1,value:lY},expand:{configurable:!1,enumerable:!1,writable:!1,value:lG}});let lZ="Impossible case. Please create issue.",lJ="The tweak was out of range or the resulted private key is invalid",lX="The tweak was out of range or equal to zero",l0="Public Key could not be parsed",l1="Public Key serialization error",l2="Signature could not be parsed";function l3(e,t){if(!e)throw Error(t)}function l6(e,t,n){if(l3(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==n){if(Array.isArray(n)){let r=`Expected ${e} to be an Uint8Array with length [${n.join(", ")}]`;l3(n.includes(t.length),r)}else{let r=`Expected ${e} to be an Uint8Array with length ${n}`;l3(t.length===n,r)}}}function l4(e){l3("Boolean"===l5(e),"Expected compressed to be a Boolean")}function l8(e=e=>new Uint8Array(e),t){return"function"==typeof e&&(e=e(t)),l6("output",e,t),e}function l5(e){return Object.prototype.toString.call(e).slice(8,-1)}var l7={},l9={},ue={exports:{}};!function(e,t){function n(e,t){if(!e)throw Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{l="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:er.Buffer}catch(e){}function o(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function a(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),a=t;a=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return 0>e.cmp(t)?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,l=Math.min(o,o-a)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var l,u=["","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],d=[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 f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,l=a/67108864|0;n.words[0]=s;for(var u=1;u>>26,d=67108863&l,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var f=c[e],h=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?m+r:u[f-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==l),this.toArrayLike(l,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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 a,s,l=new e(o),u=this.clone();if("le"===t){for(s=0;!u.isZero();s++)a=u.andln(255),u.iushrn(8),l[s]=a;for(;s=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,b=g>>>13,y=0|a[3],A=8191&y,w=y>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,I=x>>>13,T=0|a[7],O=8191&T,P=T>>>13,L=0|a[8],N=8191&L,D=L>>>13,B=0|a[9],j=8191&B,F=B>>>13,z=0|s[0],U=8191&z,q=z>>>13,K=0|s[1],H=8191&K,V=K>>>13,$=0|s[2],W=8191&$,Y=$>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,J=0|s[4],X=8191&J,ee=J>>>13,et=0|s[5],en=8191&et,er=et>>>13,ei=0|s[6],eo=8191&ei,ea=ei>>>13,es=0|s[7],el=8191&es,eu=es>>>13,ec=0|s[8],ed=8191&ec,ef=ec>>>13,eh=0|s[9],ep=8191&eh,em=eh>>>13;n.negative=e.negative^t.negative,n.length=19;var eg=(u+(r=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,U)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(eg>>>26)|0,eg&=67108863,r=Math.imul(p,U),i=(i=Math.imul(p,q))+Math.imul(m,U)|0,o=Math.imul(m,q);var ev=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(i>>>13)|0)+(ev>>>26)|0,ev&=67108863,r=Math.imul(v,U),i=(i=Math.imul(v,q))+Math.imul(b,U)|0,o=Math.imul(b,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,V)|0;var eb=(u+(r=r+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,W)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(eb>>>26)|0,eb&=67108863,r=Math.imul(A,U),i=(i=Math.imul(A,q))+Math.imul(w,U)|0,o=Math.imul(w,q),r=r+Math.imul(v,H)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var ey=(u+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(ey>>>26)|0,ey&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,q))+Math.imul(S,U)|0,o=Math.imul(S,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,V)|0,r=r+Math.imul(v,W)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var eA=(u+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(eA>>>26)|0,eA&=67108863,r=Math.imul(M,U),i=(i=Math.imul(M,q))+Math.imul(C,U)|0,o=Math.imul(C,q),r=r+Math.imul(E,H)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(A,W)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,Z)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var ew=(u+(r=r+Math.imul(d,en)|0)|0)+((8191&(i=(i=i+Math.imul(d,er)|0)+Math.imul(f,en)|0))<<13)|0;u=((o=o+Math.imul(f,er)|0)+(i>>>13)|0)+(ew>>>26)|0,ew&=67108863,r=Math.imul(R,U),i=(i=Math.imul(R,q))+Math.imul(I,U)|0,o=Math.imul(I,q),r=r+Math.imul(M,H)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(E,W)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,Z)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,ee)|0,r=r+Math.imul(p,en)|0,i=(i=i+Math.imul(p,er)|0)+Math.imul(m,en)|0,o=o+Math.imul(m,er)|0;var e_=(u+(r=r+Math.imul(d,eo)|0)|0)+((8191&(i=(i=i+Math.imul(d,ea)|0)+Math.imul(f,eo)|0))<<13)|0;u=((o=o+Math.imul(f,ea)|0)+(i>>>13)|0)+(e_>>>26)|0,e_&=67108863,r=Math.imul(O,U),i=(i=Math.imul(O,q))+Math.imul(P,U)|0,o=Math.imul(P,q),r=r+Math.imul(R,H)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(A,X)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(v,en)|0,i=(i=i+Math.imul(v,er)|0)+Math.imul(b,en)|0,o=o+Math.imul(b,er)|0,r=r+Math.imul(p,eo)|0,i=(i=i+Math.imul(p,ea)|0)+Math.imul(m,eo)|0,o=o+Math.imul(m,ea)|0;var eE=(u+(r=r+Math.imul(d,el)|0)|0)+((8191&(i=(i=i+Math.imul(d,eu)|0)+Math.imul(f,el)|0))<<13)|0;u=((o=o+Math.imul(f,eu)|0)+(i>>>13)|0)+(eE>>>26)|0,eE&=67108863,r=Math.imul(N,U),i=(i=Math.imul(N,q))+Math.imul(D,U)|0,o=Math.imul(D,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(R,W)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(A,en)|0,i=(i=i+Math.imul(A,er)|0)+Math.imul(w,en)|0,o=o+Math.imul(w,er)|0,r=r+Math.imul(v,eo)|0,i=(i=i+Math.imul(v,ea)|0)+Math.imul(b,eo)|0,o=o+Math.imul(b,ea)|0,r=r+Math.imul(p,el)|0,i=(i=i+Math.imul(p,eu)|0)+Math.imul(m,el)|0,o=o+Math.imul(m,eu)|0;var eS=(u+(r=r+Math.imul(d,ed)|0)|0)+((8191&(i=(i=i+Math.imul(d,ef)|0)+Math.imul(f,ed)|0))<<13)|0;u=((o=o+Math.imul(f,ef)|0)+(i>>>13)|0)+(eS>>>26)|0,eS&=67108863,r=Math.imul(j,U),i=(i=Math.imul(j,q))+Math.imul(F,U)|0,o=Math.imul(F,q),r=r+Math.imul(N,H)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(M,X)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,en)|0,i=(i=i+Math.imul(E,er)|0)+Math.imul(S,en)|0,o=o+Math.imul(S,er)|0,r=r+Math.imul(A,eo)|0,i=(i=i+Math.imul(A,ea)|0)+Math.imul(w,eo)|0,o=o+Math.imul(w,ea)|0,r=r+Math.imul(v,el)|0,i=(i=i+Math.imul(v,eu)|0)+Math.imul(b,el)|0,o=o+Math.imul(b,eu)|0,r=r+Math.imul(p,ed)|0,i=(i=i+Math.imul(p,ef)|0)+Math.imul(m,ed)|0,o=o+Math.imul(m,ef)|0;var ek=(u+(r=r+Math.imul(d,ep)|0)|0)+((8191&(i=(i=i+Math.imul(d,em)|0)+Math.imul(f,ep)|0))<<13)|0;u=((o=o+Math.imul(f,em)|0)+(i>>>13)|0)+(ek>>>26)|0,ek&=67108863,r=Math.imul(j,H),i=(i=Math.imul(j,V))+Math.imul(F,H)|0,o=Math.imul(F,V),r=r+Math.imul(N,W)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,Z)|0,r=r+Math.imul(R,X)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(M,en)|0,i=(i=i+Math.imul(M,er)|0)+Math.imul(C,en)|0,o=o+Math.imul(C,er)|0,r=r+Math.imul(E,eo)|0,i=(i=i+Math.imul(E,ea)|0)+Math.imul(S,eo)|0,o=o+Math.imul(S,ea)|0,r=r+Math.imul(A,el)|0,i=(i=i+Math.imul(A,eu)|0)+Math.imul(w,el)|0,o=o+Math.imul(w,eu)|0,r=r+Math.imul(v,ed)|0,i=(i=i+Math.imul(v,ef)|0)+Math.imul(b,ed)|0,o=o+Math.imul(b,ef)|0;var eM=(u+(r=r+Math.imul(p,ep)|0)|0)+((8191&(i=(i=i+Math.imul(p,em)|0)+Math.imul(m,ep)|0))<<13)|0;u=((o=o+Math.imul(m,em)|0)+(i>>>13)|0)+(eM>>>26)|0,eM&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Y))+Math.imul(F,W)|0,o=Math.imul(F,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(R,en)|0,i=(i=i+Math.imul(R,er)|0)+Math.imul(I,en)|0,o=o+Math.imul(I,er)|0,r=r+Math.imul(M,eo)|0,i=(i=i+Math.imul(M,ea)|0)+Math.imul(C,eo)|0,o=o+Math.imul(C,ea)|0,r=r+Math.imul(E,el)|0,i=(i=i+Math.imul(E,eu)|0)+Math.imul(S,el)|0,o=o+Math.imul(S,eu)|0,r=r+Math.imul(A,ed)|0,i=(i=i+Math.imul(A,ef)|0)+Math.imul(w,ed)|0,o=o+Math.imul(w,ef)|0;var eC=(u+(r=r+Math.imul(v,ep)|0)|0)+((8191&(i=(i=i+Math.imul(v,em)|0)+Math.imul(b,ep)|0))<<13)|0;u=((o=o+Math.imul(b,em)|0)+(i>>>13)|0)+(eC>>>26)|0,eC&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(F,Q)|0,o=Math.imul(F,Z),r=r+Math.imul(N,X)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(O,en)|0,i=(i=i+Math.imul(O,er)|0)+Math.imul(P,en)|0,o=o+Math.imul(P,er)|0,r=r+Math.imul(R,eo)|0,i=(i=i+Math.imul(R,ea)|0)+Math.imul(I,eo)|0,o=o+Math.imul(I,ea)|0,r=r+Math.imul(M,el)|0,i=(i=i+Math.imul(M,eu)|0)+Math.imul(C,el)|0,o=o+Math.imul(C,eu)|0,r=r+Math.imul(E,ed)|0,i=(i=i+Math.imul(E,ef)|0)+Math.imul(S,ed)|0,o=o+Math.imul(S,ef)|0;var ex=(u+(r=r+Math.imul(A,ep)|0)|0)+((8191&(i=(i=i+Math.imul(A,em)|0)+Math.imul(w,ep)|0))<<13)|0;u=((o=o+Math.imul(w,em)|0)+(i>>>13)|0)+(ex>>>26)|0,ex&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(N,en)|0,i=(i=i+Math.imul(N,er)|0)+Math.imul(D,en)|0,o=o+Math.imul(D,er)|0,r=r+Math.imul(O,eo)|0,i=(i=i+Math.imul(O,ea)|0)+Math.imul(P,eo)|0,o=o+Math.imul(P,ea)|0,r=r+Math.imul(R,el)|0,i=(i=i+Math.imul(R,eu)|0)+Math.imul(I,el)|0,o=o+Math.imul(I,eu)|0,r=r+Math.imul(M,ed)|0,i=(i=i+Math.imul(M,ef)|0)+Math.imul(C,ed)|0,o=o+Math.imul(C,ef)|0;var eR=(u+(r=r+Math.imul(E,ep)|0)|0)+((8191&(i=(i=i+Math.imul(E,em)|0)+Math.imul(S,ep)|0))<<13)|0;u=((o=o+Math.imul(S,em)|0)+(i>>>13)|0)+(eR>>>26)|0,eR&=67108863,r=Math.imul(j,en),i=(i=Math.imul(j,er))+Math.imul(F,en)|0,o=Math.imul(F,er),r=r+Math.imul(N,eo)|0,i=(i=i+Math.imul(N,ea)|0)+Math.imul(D,eo)|0,o=o+Math.imul(D,ea)|0,r=r+Math.imul(O,el)|0,i=(i=i+Math.imul(O,eu)|0)+Math.imul(P,el)|0,o=o+Math.imul(P,eu)|0,r=r+Math.imul(R,ed)|0,i=(i=i+Math.imul(R,ef)|0)+Math.imul(I,ed)|0,o=o+Math.imul(I,ef)|0;var eI=(u+(r=r+Math.imul(M,ep)|0)|0)+((8191&(i=(i=i+Math.imul(M,em)|0)+Math.imul(C,ep)|0))<<13)|0;u=((o=o+Math.imul(C,em)|0)+(i>>>13)|0)+(eI>>>26)|0,eI&=67108863,r=Math.imul(j,eo),i=(i=Math.imul(j,ea))+Math.imul(F,eo)|0,o=Math.imul(F,ea),r=r+Math.imul(N,el)|0,i=(i=i+Math.imul(N,eu)|0)+Math.imul(D,el)|0,o=o+Math.imul(D,eu)|0,r=r+Math.imul(O,ed)|0,i=(i=i+Math.imul(O,ef)|0)+Math.imul(P,ed)|0,o=o+Math.imul(P,ef)|0;var eT=(u+(r=r+Math.imul(R,ep)|0)|0)+((8191&(i=(i=i+Math.imul(R,em)|0)+Math.imul(I,ep)|0))<<13)|0;u=((o=o+Math.imul(I,em)|0)+(i>>>13)|0)+(eT>>>26)|0,eT&=67108863,r=Math.imul(j,el),i=(i=Math.imul(j,eu))+Math.imul(F,el)|0,o=Math.imul(F,eu),r=r+Math.imul(N,ed)|0,i=(i=i+Math.imul(N,ef)|0)+Math.imul(D,ed)|0,o=o+Math.imul(D,ef)|0;var eO=(u+(r=r+Math.imul(O,ep)|0)|0)+((8191&(i=(i=i+Math.imul(O,em)|0)+Math.imul(P,ep)|0))<<13)|0;u=((o=o+Math.imul(P,em)|0)+(i>>>13)|0)+(eO>>>26)|0,eO&=67108863,r=Math.imul(j,ed),i=(i=Math.imul(j,ef))+Math.imul(F,ed)|0,o=Math.imul(F,ef);var eP=(u+(r=r+Math.imul(N,ep)|0)|0)+((8191&(i=(i=i+Math.imul(N,em)|0)+Math.imul(D,ep)|0))<<13)|0;u=((o=o+Math.imul(D,em)|0)+(i>>>13)|0)+(eP>>>26)|0,eP&=67108863;var eL=(u+(r=Math.imul(j,ep))|0)+((8191&(i=(i=Math.imul(j,em))+Math.imul(F,ep)|0))<<13)|0;return u=((o=Math.imul(F,em))+(i>>>13)|0)+(eL>>>26)|0,eL&=67108863,l[0]=eg,l[1]=ev,l[2]=eb,l[3]=ey,l[4]=eA,l[5]=ew,l[6]=e_,l[7]=eE,l[8]=eS,l[9]=ek,l[10]=eM,l[11]=eC,l[12]=ex,l[13]=eR,l[14]=eI,l[15]=eT,l[16]=eO,l[17]=eP,l[18]=eL,0!==u&&(l[19]=u,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=f),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?h(this,e,t):n<63?f(this,e,t):n<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t)},m.prototype.makeRBT=function(e){for(var t=Array(e),n=i.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=(i/67108864|0)+(o>>>26),this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var i,o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,l=0;l=0&&(0!==u||l>=i);l--){var c=0|this.words[l];this.words[l]=u<<26-o|c>>>o,u=c&s}return r&&0!==u&&(r.words[r.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,l=r.length-o.length;if("mod"!==t){(s=new i(null)).length=l+1,s.words=Array(s.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){var o,a,s;return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||0>this.cmp(e)?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t)},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=67108864%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.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;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(d)),s.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(l)):(r.isub(t),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return 0>(o=0===t.cmpn(1)?a:s).cmpn(0)&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return -1===this.cmpn(e)},i.prototype.lt=function(e){return -1===this.cmp(e)},i.prototype.lten=function(e){return 0>=this.cmpn(e)},i.prototype.lte=function(e){return 0>=this.cmp(e)},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}v.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength();while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(b,v),b.prototype.split=function(e,t){for(var n=Math.min(e.length,9),r=0;r>>22,i=o}i>>>=22,e.words[r-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){var t;if(g[e])return g[e];if("k256"===e)t=new b;else if("p224"===e)t=new y;else if("p192"===e)t=new A;else{if("p25519"!==e)throw Error("Unknown prime "+e);t=new w}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var d=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}l=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):0>o.cmpn(0)&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(ue,l);var ut=ue.exports;function un(e,t){if(!e)throw Error(t||"Assertion failed")}un.equal=function(e,t,n){if(e!=t)throw Error(n||"Assertion failed: "+e+" != "+t)};var ur={};(function(e){function t(e){return 1===e.length?"0"+e:e}function n(e){for(var n="",r=0;r>8,a=255&i;o?n.push(o,a):n.push(a)}return n},e.zero2=t,e.toHex=n,e.encode=function(e,t){return"hex"===t?n(e):e}})(ur),l9.assert=un,l9.toArray=ur.toArray,l9.zero2=ur.zero2,l9.toHex=ur.toHex,l9.encode=ur.encode,l9.getNAF=function(e,t,n){var r=Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-l:l,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},l9.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,l=e.andln(3)+i&3,u=t.andln(3)+o&3;3===l&&(l=-1),3===u&&(u=-1),a=0==(1&l)?0:3!=(r=e.andln(7)+i&7)&&5!==r||2!==u?l:-l,n[0].push(a),s=0==(1&u)?0:3!=(r=t.andln(7)+o&7)&&5!==r||2!==l?u:-u,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},l9.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},l9.parseBytes=function(e){return"string"==typeof e?l9.toArray(e,"hex"):e},l9.intFromLE=function(e){return new ut(e,"hex","le")};var ui,uo={exports:{}};function ua(e){this.rand=e}if(uo.exports=function(e){return ui||(ui=new ua(null)),ui.generate(e)},uo.exports.Rand=ua,ua.prototype.generate=function(e){return this._rand(e)},ua.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function up(e,t){this.curve=e,this.type=t,this.precomputed=null}uh.prototype.point=function(){throw Error("Not implemented")},uh.prototype.validate=function(){throw Error("Not implemented")},uh.prototype._fixedNafMul=function(e,t){uf(e.precomputed);var n=e._getDoubles(),r=uc(t,1,this._bitLength),i=(1<=o;l--)a=(a<<1)+r[l];s.push(a)}for(var u=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o=0;s--){for(var l=0;s>=0&&0===o[s];s--)l++;if(s>=0&&l++,a=a.dblp(l),s<0)break;var u=o[s];uf(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},uh.prototype._wnafMulAdd=function(e,t,n,r,i){var o,a,s,l=this._wnafT1,u=this._wnafT2,c=this._wnafT3,d=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===l[h]&&1===l[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=ud(n[h],n[p]);for(d=Math.max(v[0].length,d),c[h]=Array(d),c[p]=Array(d),a=0;a=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a=0&&_++,A=A.dblp(_),o<0)break;for(a=0;a0?s=u[a][S-1>>1]:S<0&&(s=u[a][-S-1>>1].neg()),A="affine"===s.type?A.mixedAdd(s):A.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},up.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;ir[0].cmp(r[1])?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new ut(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],uv(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map(function(e){return{a:new ut(e.a,16),b:new ut(e.b,16)}}):this._getEndoBasis(n)}}},ub.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:ut.mont(e),n=new ut(2).toRed(t).redInvm(),r=n.redNeg(),i=new ut(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},ub.prototype._getEndoBasis=function(e){for(var t,n,r,i,o,a,s,l,u,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new ut(1),p=new ut(0),m=new ut(0),g=new ut(1),v=0;0!==d.cmpn(0);){var b=f.div(d);l=f.sub(b.mul(d)),u=m.sub(b.mul(h));var y=g.sub(b.mul(p));if(!r&&0>l.cmp(c))t=s.neg(),n=h,r=l.neg(),i=u;else if(r&&2==++v)break;s=l,f=d,d=l,m=h,h=u,g=p,p=y}o=l.neg(),a=u;var A=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(A)>=0&&(o=t,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},ub.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),l=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(a).sub(s),k2:l.add(u).neg()}},ub.prototype.pointFromX=function(e,t){(e=new ut(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},ub.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},ub.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},uy.prototype.isInfinity=function(){return this.inf},uy.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},uy.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},uy.prototype.getX=function(){return this.x.fromRed()},uy.prototype.getY=function(){return this.y.fromRed()},uy.prototype.mul=function(e){return e=new ut(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},uy.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},uy.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},uy.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},uy.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},uy.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},ug(uA,uh.BasePoint),ub.prototype.jpoint=function(e,t,n){return new uA(this,e,t,n)},uA.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},uA.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},uA.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),l=o.redSub(a);if(0===s.cmpn(0))return 0!==l.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),d=r.redMul(u),f=l.redSqr().redIAdd(c).redISub(d).redISub(d),h=l.redMul(d.redISub(f)).redISub(o.redMul(c)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},uA.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),u=l.redMul(a),c=n.redMul(l),d=s.redSqr().redIAdd(u).redISub(c).redISub(c),f=s.redMul(c.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},uA.prototype.dblp=function(e){if(0===e||this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){var t,n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},uA.prototype.inspect=function(){return this.isInfinity()?"":""},uA.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},ug(uw,uh),uw.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},ug(u_,uh.BasePoint),uw.prototype.decodePoint=function(e,t){return this.point(l9.toArray(e,t),1)},uw.prototype.point=function(e,t){return new u_(this,e,t)},uw.prototype.pointFromJSON=function(e){return u_.fromJSON(this,e)},u_.prototype.precompute=function(){},u_.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u_.fromJSON=function(e,t){return new u_(e,t[0],t[1]||e.one)},u_.prototype.inspect=function(){return this.isInfinity()?"":""},u_.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u_.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},u_.prototype.add=function(){throw Error("Not supported on Montgomery curve")},u_.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),a=i.redMul(r),s=t.z.redMul(o.redAdd(a).redSqr()),l=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,l)},u_.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},u_.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},u_.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},u_.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},u_.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u_.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var uE=l9.assert;function uS(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,uh.call(this,"edwards",e),this.a=new ut(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ut(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ut(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),uE(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function uk(e,t,n,r,i){uh.BasePoint.call(this,e,"projective"),null===t&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ut(t,16),this.y=new ut(n,16),this.z=r?new ut(r,16):this.curve.one,this.t=i&&new ut(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}ug(uS,uh),uS.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},uS.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},uS.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},uS.prototype.pointFromX=function(e,t){(e=new ut(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},uS.prototype.pointFromY=function(e,t){(e=new ut(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},uS.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return 0===r.cmp(i)},ug(uk,uh.BasePoint),uS.prototype.pointFromJSON=function(e){return uk.fromJSON(this,e)},uS.prototype.point=function(e,t,n,r){return new uk(this,e,t,n,r)},uk.fromJSON=function(e,t){return new uk(e,t[0],t[1],t[2])},uk.prototype.inspect=function(){return this.isInfinity()?"":""},uk.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},uk.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),a=o.redSub(n),s=r.redSub(t),l=i.redMul(a),u=o.redMul(s),c=i.redMul(s),d=a.redMul(o);return this.curve.point(l,u,d,c)},uk.prototype._projDbl=function(){var e,t,n,r,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),l=this.y.redSqr();if(this.curve.twisted){var u=(r=this.curve._mulA(s)).redAdd(l);this.zOne?(e=a.redSub(s).redSub(l).redMul(u.redSub(this.curve.two)),t=u.redMul(r.redSub(l)),n=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=a.redSub(s).redISub(l).redMul(o),t=u.redMul(r.redSub(l)),n=u.redMul(o))}else r=s.redAdd(l),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(s.redISub(l)),n=r.redMul(o);return this.curve.point(e,t,n)},uk.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},uk.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),a=i.redSub(r),s=i.redAdd(r),l=n.redAdd(t),u=o.redMul(a),c=s.redMul(l),d=o.redMul(l),f=a.redMul(s);return this.curve.point(u,c,f,d)},uk.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),l=i.redSub(s),u=i.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),d=r.redMul(l).redMul(c);return this.curve.twisted?(t=r.redMul(u).redMul(a.redSub(this.curve._mulA(o))),n=l.redMul(u)):(t=r.redMul(u).redMul(a.redSub(o)),n=this.curve._mulC(l).redMul(u)),this.curve.point(d,t,n)},uk.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},uk.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},uk.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},uk.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},uk.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},uk.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},uk.prototype.getX=function(){return this.normalize(),this.x.fromRed()},uk.prototype.getY=function(){return this.normalize(),this.y.fromRed()},uk.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},uk.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},uk.prototype.toP=uk.prototype.normalize,uk.prototype.mixedAdd=uk.prototype.add,uu.base=uh,uu.short=ub,uu.mont=uw,uu.edwards=uS;var uM={},uC={},ux={};function uR(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function uI(e){return 1===e.length?"0"+e:e}function uT(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}ux.inherits=ug,ux.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e){if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192:((o=e,a=i,55296!=(64512&o.charCodeAt(a))||a<0||a+1>=o.length||56320!=(64512&o.charCodeAt(a+1)))?n[r++]=s>>12|224:(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128),n[r++]=s>>6&63|128),n[r++]=63&s|128)}}else for(i=0;i>>0;return a},ux.split32=function(e,t){for(var n=Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},ux.rotr32=function(e,t){return e>>>t|e<<32-t},ux.rotl32=function(e,t){return e<>>32-t},ux.sum32=function(e,t){return e+t>>>0},ux.sum32_3=function(e,t,n){return e+t+n>>>0},ux.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},ux.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},ux.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0;e[t]=(o>>0,e[t+1]=o},ux.sum64_hi=function(e,t,n,r){return(t+r>>>0>>0},ux.sum64_lo=function(e,t,n,r){return t+r>>>0},ux.sum64_4_hi=function(e,t,n,r,i,o,a,s){var l=t;return e+n+i+a+(0+(((l=l+r>>>0)>>0)>>0)>>0},ux.sum64_4_lo=function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0},ux.sum64_5_hi=function(e,t,n,r,i,o,a,s,l,u){var c=t;return e+n+i+a+l+(0+(((c=c+r>>>0)>>0)>>0)>>0)>>0},ux.sum64_5_lo=function(e,t,n,r,i,o,a,s,l,u){return t+r+o+s+u>>>0},ux.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},ux.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},ux.shr64_hi=function(e,t,n){return e>>>n},ux.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0};var uO={};function uP(){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}uO.BlockHash=uP,uP.prototype.update=function(e,t){if(e=ux.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=ux.join32(e,0,e.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},uN.g1_256=function(e){return uD(e,17)^uD(e,19)^e>>>10};var uj=ux.rotl32,uF=ux.sum32,uz=ux.sum32_5,uU=uN.ft_1,uq=uO.BlockHash,uK=[1518500249,1859775393,2400959708,3395469782];function uH(){if(!(this instanceof uH))return new uH;uq.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}ux.inherits(uH,uq),uH.blockSize=512,uH.outSize=160,uH.hmacStrength=80,uH.padLength=64,uH.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}cw.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),un(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},c_.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=ur.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var ck=l9.assert;function cM(e,t){if(e instanceof cM)return e;this._importDER(e,t)||(ck(e.r&&e.s,"Signature without r or s"),this.r=new ut(e.r,16),this.s=new ut(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function cC(){this.place=0}function cx(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function cR(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}cM.prototype._importDER=function(e,t){e=l9.toArray(e,t);var n=new cC;if(48!==e[n.place++])return!1;var r=cx(e,n);if(!1===r||r+n.place!==e.length||2!==e[n.place++])return!1;var i=cx(e,n);if(!1===i)return!1;var o=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var a=cx(e,n);if(!1===a||e.length!==a+n.place)return!1;var s=e.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new ut(o),this.s=new ut(s),this.recoveryParam=null,!0},cM.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=cR(t),n=cR(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];cI(r,t.length),(r=r.concat(t)).push(2),cI(r,n.length);var i=r.concat(n),o=[48];return cI(o,i.length),o=o.concat(i),l9.encode(o,e)};var cT=l9.assert;function cO(e){if(!(this instanceof cO))return new cO(e);"string"==typeof e&&(cT(Object.prototype.hasOwnProperty.call(uM,e),"Unknown curve "+e),e=uM[e]),e instanceof uM.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}cO.prototype.keyPair=function(e){return new cS(this,e)},cO.prototype.keyFromPrivate=function(e,t){return cS.fromPrivate(this,e,t)},cO.prototype.keyFromPublic=function(e,t){return cS.fromPublic(this,e,t)},cO.prototype.genKeyPair=function(e){e||(e={});for(var t=new c_({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||ul(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new ut(2));;){var i=new ut(t.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},cO.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},cO.prototype.sign=function(e,t,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new ut(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new c_({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),l=this.n.sub(new ut(1)),u=0;;u++){var c=r.k?r.k(u):new ut(s.generate(this.n.byteLength()));if(!(0>=(c=this._truncateToN(c,!0)).cmpn(1)||c.cmp(l)>=0)){var d=this.g.mul(c);if(!d.isInfinity()){var f=d.getX(),h=f.umod(this.n);if(0!==h.cmpn(0)){var p=c.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==f.cmp(h)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new cM({r:h,s:p,recoveryParam:m})}}}}}},cO.prototype.verify=function(e,t,n,r){e=this._truncateToN(new ut(e,16)),n=this.keyFromPublic(n,r);var i=(t=new cM(t,"hex")).r,o=t.s;if(0>i.cmpn(1)||i.cmp(this.n)>=0||0>o.cmpn(1)||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),l=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(l,n.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(l,n.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},cO.prototype.recoverPubKey=function(e,t,n,r){cT((3&n)===n,"The recovery param is more than two bits"),t=new cM(t,r);var i=this.n,o=new ut(e),a=t.r,s=t.s,l=1&n,u=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var c=t.r.invm(i),d=i.sub(o).mul(c).umod(i),f=s.mul(c).umod(i);return this.g.mulAdd(d,a,f)},cO.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new cM(t,r)).recoveryParam)return t.recoveryParam;for(var i,o=0;o<4;o++){try{i=this.recoverPubKey(e,t,o)}catch(e){continue}if(i.eq(n))return o}throw Error("Unable to find valid recovery factor")};var cP=l9.assert,cL=l9.parseBytes,cN=l9.cachedProperty;function cD(e,t){this.eddsa=e,this._secret=cL(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=cL(t.pub)}cD.fromPublic=function(e,t){return t instanceof cD?t:new cD(e,{pub:t})},cD.fromSecret=function(e,t){return t instanceof cD?t:new cD(e,{secret:t})},cD.prototype.secret=function(){return this._secret},cN(cD,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),cN(cD,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),cN(cD,"privBytes",function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),cN(cD,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),cN(cD,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),cN(cD,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),cD.prototype.sign=function(e){return cP(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},cD.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},cD.prototype.getSecret=function(e){return cP(this._secret,"KeyPair is public only"),l9.encode(this.secret(),e)},cD.prototype.getPublic=function(e){return l9.encode(this.pubBytes(),e)};var cB=l9.assert,cj=l9.cachedProperty,cF=l9.parseBytes;function cz(e,t){this.eddsa=e,"object"!=typeof t&&(t=cF(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),cB(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof ut&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}cj(cz,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),cj(cz,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),cj(cz,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),cj(cz,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),cz.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},cz.prototype.toHex=function(){return l9.encode(this.toBytes(),"hex").toUpperCase()};var cU=l9.assert,cq=l9.parseBytes;function cK(e){if(cU("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof cK))return new cK(e);e=uM[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=uC.sha512}cK.prototype.sign=function(e,t){e=cq(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},cK.prototype.verify=function(e,t,n){e=cq(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},cK.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=0)return null;let r=(n=n.toRed(cV.red)).redSqr().redIMul(n).redIAdd(cV.b).redSqrt();return 3===e!==r.isOdd()&&(r=r.redNeg()),cH.keyPair({pub:{x:n,y:r}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,n){let r=new c$(t),i=new c$(n);if(r.cmp(cV.p)>=0||i.cmp(cV.p)>=0||(r=r.toRed(cV.red),i=i.toRed(cV.red),(6===e||7===e)&&i.isOdd()!==(7===e)))return null;let o=r.redSqr().redIMul(r);return i.redSqr().redISub(o.redIAdd(cV.b)).isZero()?cH.keyPair({pub:{x:r,y:i}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function cY(e,t){let n=t.encode(null,33===e.length);for(let t=0;t0,privateKeyVerify(e){let t=new c$(e);return 0>t.cmp(cV.n)&&!t.isZero()?0:1},privateKeyNegate(e){let t=new c$(e),n=cV.n.sub(t).umod(cV.n).toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakAdd(e,t){let n=new c$(t);if(n.cmp(cV.n)>=0||(n.iadd(new c$(e)),n.cmp(cV.n)>=0&&n.isub(cV.n),n.isZero()))return 1;let r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakMul(e,t){let n=new c$(t);if(n.cmp(cV.n)>=0||n.isZero())return 1;n.imul(new c$(e)),n.cmp(cV.n)>=0&&(n=n.umod(cV.n));let r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},publicKeyVerify:e=>null===cW(e)?1:0,publicKeyCreate(e,t){let n=new c$(t);return n.cmp(cV.n)>=0||n.isZero()?1:(cY(e,cH.keyFromPrivate(t).getPublic()),0)},publicKeyConvert(e,t){let n=cW(t);return null===n?1:(cY(e,n.getPublic()),0)},publicKeyNegate(e,t){let n=cW(t);if(null===n)return 1;let r=n.getPublic();return r.y=r.y.redNeg(),cY(e,r),0},publicKeyCombine(e,t){let n=Array(t.length);for(let e=0;e=0)return 2;let i=r.getPublic().add(cV.g.mul(n));return i.isInfinity()?2:(cY(e,i),0)},publicKeyTweakMul(e,t,n){let r=cW(t);return null===r?1:(n=new c$(n)).cmp(cV.n)>=0||n.isZero()?2:(cY(e,r.getPublic().mul(n)),0)},signatureNormalize(e){let t=new c$(e.subarray(0,32)),n=new c$(e.subarray(32,64));return t.cmp(cV.n)>=0||n.cmp(cV.n)>=0?1:(1===n.cmp(cH.nh)&&e.set(cV.n.sub(n).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){let n=t.subarray(0,32),r=t.subarray(32,64);if(new c$(n).cmp(cV.n)>=0||new c$(r).cmp(cV.n)>=0)return 1;let{output:i}=e,o=i.subarray(4,37);o[0]=0,o.set(n,1);let a=33,s=0;for(;a>1&&0===o[s]&&!(128&o[s+1]);--a,++s);if(128&(o=o.subarray(s))[0]||a>1&&0===o[0]&&!(128&o[1]))return 1;let l=i.subarray(39,72);l[0]=0,l.set(r,1);let u=33,c=0;for(;u>1&&0===l[c]&&!(128&l[c+1]);--u,++c);return 128&(l=l.subarray(c))[0]||u>1&&0===l[0]&&!(128&l[1])?1:(e.outputlen=6+a+u,i[0]=48,i[1]=e.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+a]=2,i[5+a]=l.length,i.set(l,6+a),0)},signatureImport(e,t){if(t.length<8||t.length>72||48!==t[0]||t[1]!==t.length-2||2!==t[2])return 1;let n=t[3];if(0===n||5+n>=t.length||2!==t[4+n])return 1;let r=t[5+n];if(0===r||6+n+r!==t.length||128&t[4]||n>1&&0===t[4]&&!(128&t[5])||128&t[n+6]||r>1&&0===t[n+6]&&!(128&t[n+7]))return 1;let i=t.subarray(4,4+n);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=t.subarray(6+n);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw Error("S length is too long");let a=new c$(i);a.cmp(cV.n)>=0&&(a=new c$(0));let s=new c$(t.subarray(6+n));return s.cmp(cV.n)>=0&&(s=new c$(0)),e.set(a.toArrayLike(Uint8Array,"be",32),0),e.set(s.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,n,r,i){let o;if(i){let e=i;i=i=>{let o=e(t,n,null,r,i);if(!(o instanceof Uint8Array&&32===o.length))throw Error("This is the way");return new c$(o)}}let a=new c$(n);if(a.cmp(cV.n)>=0||a.isZero())return 1;try{o=cH.sign(t,n,{canonical:!0,k:i,pers:r})}catch(e){return 1}return e.signature.set(o.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(o.s.toArrayLike(Uint8Array,"be",32),32),e.recid=o.recoveryParam,0},ecdsaVerify(e,t,n){let r={r:e.subarray(0,32),s:e.subarray(32,64)},i=new c$(r.r),o=new c$(r.s);if(i.cmp(cV.n)>=0||o.cmp(cV.n)>=0)return 1;if(1===o.cmp(cH.nh)||i.isZero()||o.isZero())return 3;let a=cW(n);if(null===a)return 2;let s=a.getPublic();return cH.verify(t,r,s)?0:3},ecdsaRecover(e,t,n,r){let i;let o={r:t.slice(0,32),s:t.slice(32,64)},a=new c$(o.r),s=new c$(o.s);if(a.cmp(cV.n)>=0||s.cmp(cV.n)>=0)return 1;if(a.isZero()||s.isZero())return 2;try{i=cH.recoverPubKey(r,o,n)}catch(e){return 2}return cY(e,i),0},ecdh(e,t,n,r,i,o,a){let s=cW(t);if(null===s)return 1;let l=new c$(n);if(l.cmp(cV.n)>=0||l.isZero())return 2;let u=s.getPublic().mul(l);if(void 0===i){let t=u.encode(null,!0),n=cH.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=n[t]}else{o||(o=new Uint8Array(32));let t=u.getX().toArray("be",32);for(let e=0;e<32;++e)o[e]=t[e];a||(a=new Uint8Array(32));let n=u.getY().toArray("be",32);for(let e=0;e<32;++e)a[e]=n[e];let s=i(o,a,r);if(!(s instanceof Uint8Array&&s.length===e.length))return 2;e.set(s)}return 0}},{contextRandomize(e){if(l3(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&l6("seed",e,32),1===i.contextRandomize(e))throw Error("Unknow error on context randomization")},privateKeyVerify:e=>(l6("private key",e,32),0===i.privateKeyVerify(e)),privateKeyNegate(e){switch(l6("private key",e,32),i.privateKeyNegate(e)){case 0:return e;case 1:throw Error(lZ)}},privateKeyTweakAdd(e,t){switch(l6("private key",e,32),l6("tweak",t,32),i.privateKeyTweakAdd(e,t)){case 0:return e;case 1:throw Error(lJ)}},privateKeyTweakMul(e,t){switch(l6("private key",e,32),l6("tweak",t,32),i.privateKeyTweakMul(e,t)){case 0:return e;case 1:throw Error(lX)}},publicKeyVerify:e=>(l6("public key",e,[33,65]),0===i.publicKeyVerify(e)),publicKeyCreate(e,t=!0,n){switch(l6("private key",e,32),l4(t),n=l8(n,t?33:65),i.publicKeyCreate(n,e)){case 0:return n;case 1:throw Error("Private Key is invalid");case 2:throw Error(l1)}},publicKeyConvert(e,t=!0,n){switch(l6("public key",e,[33,65]),l4(t),n=l8(n,t?33:65),i.publicKeyConvert(n,e)){case 0:return n;case 1:throw Error(l0);case 2:throw Error(l1)}},publicKeyNegate(e,t=!0,n){switch(l6("public key",e,[33,65]),l4(t),n=l8(n,t?33:65),i.publicKeyNegate(n,e)){case 0:return n;case 1:throw Error(l0);case 2:throw Error(lZ);case 3:throw Error(l1)}},publicKeyCombine(e,t=!0,n){for(let t of(l3(Array.isArray(e),"Expected public keys to be an Array"),l3(e.length>0,"Expected public keys array will have more than zero items"),e))l6("public key",t,[33,65]);switch(l4(t),n=l8(n,t?33:65),i.publicKeyCombine(n,e)){case 0:return n;case 1:throw Error(l0);case 2:throw Error("The sum of the public keys is not valid");case 3:throw Error(l1)}},publicKeyTweakAdd(e,t,n=!0,r){switch(l6("public key",e,[33,65]),l6("tweak",t,32),l4(n),r=l8(r,n?33:65),i.publicKeyTweakAdd(r,e,t)){case 0:return r;case 1:throw Error(l0);case 2:throw Error(lJ)}},publicKeyTweakMul(e,t,n=!0,r){switch(l6("public key",e,[33,65]),l6("tweak",t,32),l4(n),r=l8(r,n?33:65),i.publicKeyTweakMul(r,e,t)){case 0:return r;case 1:throw Error(l0);case 2:throw Error(lX)}},signatureNormalize(e){switch(l6("signature",e,64),i.signatureNormalize(e)){case 0:return e;case 1:throw Error(l2)}},signatureExport(e,t){l6("signature",e,64);let n={output:t=l8(t,72),outputlen:72};switch(i.signatureExport(n,e)){case 0:return t.slice(0,n.outputlen);case 1:throw Error(l2);case 2:throw Error(lZ)}},signatureImport(e,t){switch(l6("signature",e),t=l8(t,64),i.signatureImport(t,e)){case 0:return t;case 1:throw Error(l2);case 2:throw Error(lZ)}},ecdsaSign(e,t,n={},r){l6("message",e,32),l6("private key",t,32),l3("Object"===l5(n),"Expected options to be an Object"),void 0!==n.data&&l6("options.data",n.data),void 0!==n.noncefn&&l3("Function"===l5(n.noncefn),"Expected options.noncefn to be a Function");let o={signature:r=l8(r,64),recid:null};switch(i.ecdsaSign(o,e,t,n.data,n.noncefn)){case 0:return o;case 1:throw Error("The nonce generation function failed, or the private key was invalid");case 2:throw Error(lZ)}},ecdsaVerify(e,t,n){switch(l6("signature",e,64),l6("message",t,32),l6("public key",n,[33,65]),i.ecdsaVerify(e,t,n)){case 0:return!0;case 3:return!1;case 1:throw Error(l2);case 2:throw Error(l0)}},ecdsaRecover(e,t,n,r=!0,o){switch(l6("signature",e,64),l3("Number"===l5(t)&&t>=0&&t<=3,"Expected recovery id to be a Number within interval [0, 3]"),l6("message",n,32),l4(r),o=l8(o,r?33:65),i.ecdsaRecover(o,e,t,n)){case 0:return o;case 1:throw Error(l2);case 2:throw Error("Public key could not be recover");case 3:throw Error(lZ)}},ecdh(e,t,n={},r){switch(l6("public key",e,[33,65]),l6("private key",t,32),l3("Object"===l5(n),"Expected options to be an Object"),void 0!==n.data&&l6("options.data",n.data),void 0!==n.hashfn?(l3("Function"===l5(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&l6("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&l6("options.ybuf",n.ybuf,32),l6("output",r)):r=l8(r,32),i.ecdh(r,e,t,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return r;case 1:throw Error(l0);case 2:throw Error("Scalar was invalid (zero or overflow)")}}}),cQ={},cZ={};Object.defineProperty(cZ,"__esModule",{value:!0}),cZ.SECRET_KEY_LENGTH=cZ.AES_IV_PLUS_TAG_LENGTH=cZ.AES_TAG_LENGTH=cZ.AES_IV_LENGTH=cZ.UNCOMPRESSED_PUBLIC_KEY_SIZE=void 0,cZ.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,cZ.AES_IV_LENGTH=16,cZ.AES_TAG_LENGTH=16,cZ.AES_IV_PLUS_TAG_LENGTH=cZ.AES_IV_LENGTH+cZ.AES_TAG_LENGTH,cZ.SECRET_KEY_LENGTH=32;var cJ=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cQ,"__esModule",{value:!0}),cQ.aesDecrypt=cQ.aesEncrypt=cQ.getValidSecret=cQ.decodeHex=cQ.remove0x=void 0;var cX=lq(),c0=cJ(cG);function c1(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}cQ.remove0x=c1,cQ.decodeHex=function(e){return M.from(c1(e),"hex")},cQ.getValidSecret=function(){var e;do e=(0,cX.randomBytes)(cZ.SECRET_KEY_LENGTH);while(!c0.default.privateKeyVerify(e));return e},cQ.aesEncrypt=function(e,t){var n=(0,cX.randomBytes)(cZ.AES_IV_LENGTH),r=(0,cX.createCipheriv)("aes-256-gcm",e,n),i=M.concat([r.update(t),r.final()]),o=r.getAuthTag();return M.concat([n,o,i])},cQ.aesDecrypt=function(e,t){var n=t.slice(0,cZ.AES_IV_LENGTH),r=t.slice(cZ.AES_IV_LENGTH,cZ.AES_IV_PLUS_TAG_LENGTH),i=t.slice(cZ.AES_IV_PLUS_TAG_LENGTH),o=(0,cX.createDecipheriv)("aes-256-gcm",e,n);return o.setAuthTag(r),M.concat([o.update(i),o.final()])};var c2={},c3=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(c2,"__esModule",{value:!0});var c6=c3(lQ),c4=c3(cG),c8=function(){function e(e){this.uncompressed=M.from(c4.default.publicKeyConvert(e,!1)),this.compressed=M.from(c4.default.publicKeyConvert(e,!0))}return e.fromHex=function(t){var n=(0,cQ.decodeHex)(t);if(n.length===cZ.UNCOMPRESSED_PUBLIC_KEY_SIZE-1){var r=M.from([4]);return new e(M.concat([r,n]))}return new e(n)},e.prototype.toHex=function(e){return void 0===e&&(e=!0),e?this.compressed.toString("hex"):this.uncompressed.toString("hex")},e.prototype.decapsulate=function(e){var t=M.concat([this.uncompressed,e.multiply(this)]);return(0,c6.default)(t,32,{hash:"SHA-256"})},e.prototype.equals=function(e){return this.uncompressed.equals(e.uncompressed)},e}();c2.default=c8;var c5=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(en,"__esModule",{value:!0});var c7=c5(lQ),c9=c5(cG),de=c5(c2),dt=function(){function e(e){if(this.secret=e||(0,cQ.getValidSecret)(),!c9.default.privateKeyVerify(this.secret))throw Error("Invalid private key");this.publicKey=new de.default(M.from(c9.default.publicKeyCreate(this.secret)))}return e.fromHex=function(t){return new e((0,cQ.decodeHex)(t))},e.prototype.toHex=function(){return"0x".concat(this.secret.toString("hex"))},e.prototype.encapsulate=function(e){var t=M.concat([this.publicKey.uncompressed,this.multiply(e)]);return(0,c7.default)(t,32,{hash:"SHA-256"})},e.prototype.multiply=function(e){return M.from(c9.default.publicKeyTweakMul(e.compressed,this.secret,!1))},e.prototype.equals=function(e){return this.secret.equals(e.secret)},e}();en.default=dt,da=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Object.defineProperty(et,"__esModule",{value:!0}),et.PublicKey=et.PrivateKey=void 0,Object.defineProperty(et,"PrivateKey",{enumerable:!0,get:function(){return da(en).default}}),Object.defineProperty(et,"PublicKey",{enumerable:!0,get:function(){return da(c2).default}}),Object.defineProperty(ee,"__esModule",{value:!0}),ee.utils=ee.PublicKey=ee.PrivateKey=ee.decrypt=ee.encrypt=void 0,ee.encrypt=function(e,t){var n=new et.PrivateKey,r=e instanceof M?new et.PublicKey(e):et.PublicKey.fromHex(e),i=n.encapsulate(r),o=(0,cQ.aesEncrypt)(i,t);return M.concat([n.publicKey.uncompressed,o])},ee.decrypt=function(e,t){var n=e instanceof M?new et.PrivateKey(e):et.PrivateKey.fromHex(e),r=new et.PublicKey(t.slice(0,cZ.UNCOMPRESSED_PUBLIC_KEY_SIZE)),i=t.slice(cZ.UNCOMPRESSED_PUBLIC_KEY_SIZE),o=r.decapsulate(n);return(0,cQ.aesDecrypt)(o,i)},Object.defineProperty(ee,"PrivateKey",{enumerable:!0,get:function(){return et.PrivateKey}}),Object.defineProperty(ee,"PublicKey",{enumerable:!0,get:function(){return et.PublicKey}}),ee.utils={aesDecrypt:cQ.aesDecrypt,aesEncrypt:cQ.aesEncrypt,decodeHex:cQ.decodeHex,getValidSecret:cQ.getValidSecret,remove0x:cQ.remove0x};var dn={exports:{}};!function(e){var t=Object.hasOwnProperty,n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r="object"==typeof ex,i="function"==typeof Symbol,o="object"==typeof Reflect,a="function"==typeof setImmediate?setImmediate:setTimeout,s=i?o&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function l(){this._events={},this._conf&&u.call(this,this._conf)}function u(t){t&&(this._conf=t,t.delimiter&&(this.delimiter=t.delimiter),t.maxListeners!==e&&(this._maxListeners=t.maxListeners),t.wildcard&&(this.wildcard=t.wildcard),t.newListener&&(this._newListener=t.newListener),t.removeListener&&(this._removeListener=t.removeListener),t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak),t.ignoreErrors&&(this.ignoreErrors=t.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function c(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==ex&&ex.emitWarning){var r=Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,ex.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var d=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=Array(r);r--;)i[r]=arguments[r];return i}};function f(t,n){for(var r={},i=t.length,o=n?n.length:0,a=0;a0;)if(o===e[a])return r;i(t)}}Object.assign(h.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,a=this._listeners,s=function(){var r=d.apply(null,arguments),a={data:r,name:t,original:e};n?!1!==n.call(i,a)&&o.emit.apply(o,[a.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===a[e]&&(a[e]=s,r._on.call(i,e,s))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&a[e]&&(a[e]=null,r._off.call(i,e,s))},a[e]=null,o.on("removeListener",this._onRemoveListener)):(a[e]=s,r._on.call(i,e,s))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,a=this._emitter,l=this._off,u=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=A.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=o[e]))return;l.call(u,e,t),delete o[e],--this._listenersCount||c()}else{for(r=(n=s(o)).length;r-- >0;)e=n[r],l.call(u,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var v=g(["function"]),b=g(["object","function"]);function y(e,t,n){var r,i,o,a=0,s=new e(function(l,u,c){function d(){i&&(i=null),a&&(clearTimeout(a),a=0)}r=!(n=p(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}})).overload&&"function"==typeof e.prototype.cancel&&"function"==typeof c;var f=function(e){d(),l(e)},h=function(e){d(),u(e)};r?t(f,h,c):(i=[function(e){h(e||Error("canceled"))}],t(f,h,function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)}),o=!0),n.timeout>0&&(a=setTimeout(function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,s.cancel(e),u(e)},n.timeout))});return r||(s.cancel=function(e){if(i){for(var t=i.length,n=1;n0;)"_listeners"!==(h=b[l])&&(y=w(e,t,n[h],r+1,i))&&(A?A.push.apply(A,y):A=y);return A}if("**"===_){for((v=r+1===i||r+2===i&&"*"===E)&&n._listeners&&(A=w(e,t,n,i,i)),l=(b=s(n)).length;l-- >0;)"_listeners"!==(h=b[l])&&("*"===h||"**"===h?(n[h]._listeners&&!v&&(y=w(e,t,n[h],i,i))&&(A?A.push.apply(A,y):A=y),y=w(e,t,n[h],r,i)):y=w(e,t,n[h],h===E?r+2:r,i),y&&(A?A.push.apply(A,y):A=y));return A}n[_]&&(A=w(e,t,n[_],r+1,i))}if((p=n["*"])&&w(e,t,p,r+1,i),m=n["**"]){if(r0;)"_listeners"!==(h=b[l])&&(h===E?w(e,t,m[h],r+2,i):h===_?w(e,t,m[h],r+1,i):((g={})[h]=m[h],w(e,t,{"**":g},r+1,i)));else m._listeners?w(e,t,m,i,i):m["*"]&&m["*"]._listeners&&w(e,t,m["*"],i,i)}return A}function _(e,t,n){var r,i,o=0,a=0,s=this.delimiter,l=s.length;if("string"==typeof e){if(-1!==(r=e.indexOf(s))){i=[,,,,,];do i[o++]=e.slice(a,r),a=r+l;while(-1!==(r=e.indexOf(s,a)));i[o++]=e.slice(a)}else i=[e],o=1}else i=e,o=e.length;if(o>1){for(r=0;r+10&&d._listeners.length>this._maxListeners&&(d._listeners.warned=!0,c.call(this,d._listeners.length,u))):d._listeners=t,!0;return!0}function E(e,t,n,r){for(var i,o,a,l,u=s(e),c=u.length,d=e._listeners;c-- >0;)i=e[o=u[c]],a="_listeners"===o?n:n?n.concat(o):[o],l=r||"symbol"==typeof o,d&&t.push(l?a:a.join(this.delimiter)),"object"==typeof i&&E.call(this,i,t,a,l);return t}function S(e){for(var t,n,r,i=s(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||S(t)||delete e[n]);return r}function k(e,t,n){this.emitter=e,this.event=t,this.listener=n}function M(t,n,i){if(!0===i)s=!0;else if(!1===i)o=!0;else{if(!i||"object"!=typeof i)throw TypeError("options should be an object or true");var o=i.async,s=i.promisify,l=i.nextTick,u=i.objectify}if(o||l||s){var c=n,d=n._origin||n;if(l&&!r)throw Error("process.nextTick is not supported");s===e&&(s="AsyncFunction"===n.constructor.name),(n=function(){var e=arguments,t=this,n=this.event;return s?l?Promise.resolve():new Promise(function(e){a(e)}).then(function(){return t.event=n,c.apply(t,e)}):(l?ew:a)(function(){t.event=n,c.apply(t,e)})})._async=!0,n._origin=d}return[n,u?new k(this,t,n):this]}function C(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,u.call(this,e)}k.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},C.EventEmitter2=C,C.prototype.listenTo=function(t,r,i){if("object"!=typeof t)throw TypeError("target musts be an object");var o=this;return i=p(i,{on:e,off:e,reducers:e},{on:v,off:v,reducers:b}),function(e){if("object"!=typeof e)throw TypeError("events must be an object");var n,r=i.reducers,a=A.call(o,t);n=-1===a?new h(o,t,i):o._observers[a];for(var l,u=s(e),c=u.length,d="function"==typeof r,f=0;f0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},C.prototype.delimiter=".",C.prototype.setMaxListeners=function(t){t!==e&&(this._maxListeners=t,this._conf||(this._conf={}),this._conf.maxListeners=t)},C.prototype.getMaxListeners=function(){return this._maxListeners},C.prototype.event="",C.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},C.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},C.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},C.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},C.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},C.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),n.apply(this,arguments)}return a._origin=n,this._on(e,a,r,i)},C.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,o,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(n=s.length,i){for(r=0;r3)for(t=Array(d-1),o=1;o3)for(n=Array(f-1),a=1;a0&&this._events[t].length>this._maxListeners&&(this._events[t].warned=!0,c.call(this,this._events[t].length,t))):this._events[t]=n,a},C.prototype.off=function(e,t){if("function"!=typeof t)throw Error("removeListener only takes instances of Function");var r,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=w.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],i.push({_listeners:r})}for(var a=0;a0){for(n=0,r=(t=this._all).length;n0;)"function"==typeof(r=l[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var u=[],c="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,u,c,a,0),u}return l&&(r=l[t])?"function"==typeof r?[r]:r:[]},C.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.call(this,this.listenerTree,[],null,e):t?s(t):[]},C.prototype.listenerCount=function(e){return this.listeners(e).length},C.prototype.hasListeners=function(t){if(this.wildcard){var n=[],r="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(t===e?s(i).length:i[t]))},C.prototype.listenersAny=function(){return this._all?this._all:[]},C.prototype.waitFor=function(t,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),y((n=p(n,{timeout:0,filter:e,handleError:!1,Promise:Promise,overload:!1},{filter:v,Promise:m})).Promise,function(e,i,o){function a(){var o=n.filter;if(!o||o.apply(r,arguments)){if(r.off(t,a),n.handleError){var s=arguments[0];s?i(s):e(d.apply(null,arguments).slice(1))}else e(d.apply(null,arguments))}}o(function(){r.off(t,a)}),r._on(t,a,!1)},{timeout:n.timeout,overload:n.overload})};var x=C.prototype;Object.defineProperties(C,{defaultMaxListeners:{get:function(){return x._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");x._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return y((n=p(n,{Promise:Promise,timeout:0,overload:!1},{Promise:m})).Promise,function(n,r,i){if("function"==typeof e.addEventListener)return o=function(){n(d.apply(null,arguments))},i(function(){e.removeEventListener(t,o)}),void e.addEventListener(t,o,{once:!0});var o,a,s=function(){a&&e.removeListener("error",a),n(d.apply(null,arguments))};"error"!==t&&(a=function(n){e.removeListener(t,s),r(n)},e.once("error",a)),i(function(){a&&e.removeListener("error",a),e.removeListener(t,s)}),e.once(t,s)},{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(x,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof e&&e.amd?e(function(){return C}):dn.exports=C}();var dr,di,da,ds,dl=dn.exports,du=new Uint8Array(16),dc=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function dd(e){return"string"==typeof e&&dc.test(e)}for(var df=[],dh=0;dh<256;++dh)df.push((dh+256).toString(16).substr(1));function dp(e,t,n){var r=(e=e||{}).random||(e.rng||function(){if(!ds&&!(ds="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ds(du)})();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(df[e[t+0]]+df[e[t+1]]+df[e[t+2]]+df[e[t+3]]+"-"+df[e[t+4]]+df[e[t+5]]+"-"+df[e[t+6]]+df[e[t+7]]+"-"+df[e[t+8]]+df[e[t+9]]+"-"+df[e[t+10]]+df[e[t+11]]+df[e[t+12]]+df[e[t+13]]+df[e[t+14]]+df[e[t+15]]).toLowerCase();if(!dd(n))throw TypeError("Stringified UUID is invalid");return n}(r)}let dm=Object.create(null);dm.open="0",dm.close="1",dm.ping="2",dm.pong="3",dm.message="4",dm.upgrade="5",dm.noop="6";let dg=Object.create(null);Object.keys(dm).forEach(e=>{dg[dm[e]]=e});let dv={type:"error",data:"parser error"},db="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),dy="function"==typeof ArrayBuffer,dA=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,dw=({type:e,data:t},n,r)=>db&&t instanceof Blob?n?r(t):d_(t,r):dy&&(t instanceof ArrayBuffer||dA(t))?n?r(t):d_(new Blob([t]),r):r(dm[e]+(t||"")),d_=(e,t)=>{let n=new FileReader;return n.onload=function(){t("b"+(n.result.split(",")[1]||""))},n.readAsDataURL(e)};function dE(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let dS="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)dS["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(e)]=e;let dk="function"==typeof ArrayBuffer,dM=(e,t)=>{if("string"!=typeof e)return{type:"message",data:dx(e,t)};let n=e.charAt(0);return"b"===n?{type:"message",data:dC(e.substring(1),t)}:dg[n]?e.length>1?{type:dg[n],data:e.substring(1)}:{type:dg[n]}:dv},dC=(e,t)=>dk?dx((e=>{let t,n,r,i,o,a=.75*e.length,s=e.length,l=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);let u=new ArrayBuffer(a),c=new Uint8Array(u);for(t=0;t>4,c[l++]=(15&r)<<4|i>>2,c[l++]=(3&i)<<6|63&o;return u})(e),t):{base64:!0,data:e},dx=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer;function dR(e){if(e)return function(e){for(var t in dR.prototype)e[t]=dR.prototype[t];return e}(e)}dR.prototype.on=dR.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},dR.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},dR.prototype.off=dR.prototype.removeListener=dR.prototype.removeAllListeners=dR.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}let dO=dI.setTimeout,dP=dI.clearTimeout;function dL(e,t){t.useNativeTimers?(e.setTimeoutFn=dO.bind(dI),e.clearTimeoutFn=dP.bind(dI)):(e.setTimeoutFn=dI.setTimeout.bind(dI),e.clearTimeoutFn=dI.clearTimeout.bind(dI))}class dN extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class dD extends dR{constructor(e){super(),this.writable=!1,dL(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new dN(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=dM(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return -1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){let t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}let dB="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),dj={},dF,dz=0,dU=0;function dq(e){let t="";do t=dB[e%64]+t,e=Math.floor(e/64);while(e>0);return t}function dK(){let e=dq(+new Date);return e!==dF?(dz=0,dF=e):e+"."+dq(dz++)}for(;dU<64;dU++)dj[dB[dU]]=dU;let dH=!1;try{dH="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}let dV=dH;function d$(e){let t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||dV))return new XMLHttpRequest}catch(e){}if(!t)try{return new dI[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(e){}}function dW(){}let dY=null!=new d$({xdomain:!1}).responseType;class dG extends dR{constructor(e,t){super(),dL(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=void 0!==t.data?t.data:null,this.create()}create(){var e;let t=dT(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;let n=this.xhr=new d$(t);try{n.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders)for(let e in n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this.opts.extraHeaders[e])}catch(e){}if("POST"===this.method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this.opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(n)),4===n.readyState&&(200===n.status||1223===n.status?this.onLoad():this.setTimeoutFn(()=>{this.onError("number"==typeof n.status?n.status:0)},0))},n.send(this.data)}catch(e){return void this.setTimeoutFn(()=>{this.onError(e)},0)}"undefined"!=typeof document&&(this.index=dG.requestsCount++,dG.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=dW,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete dG.requests[this.index],this.xhr=null}}onLoad(){let e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function dQ(){for(let e in dG.requests)dG.requests.hasOwnProperty(e)&&dG.requests[e].abort()}dG.requestsCount=0,dG.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",dQ):"function"==typeof addEventListener&&addEventListener("onpagehide"in dI?"pagehide":"unload",dQ,!1));let dZ="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),dJ=dI.WebSocket||dI.MozWebSocket,dX="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),d0={websocket:class extends dD{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),t=this.opts.protocols,n=dX?{}:dT(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=dX?new dJ(e,t,n):t?new dJ(e,t):new dJ(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.ws.send(e)}catch(e){}r&&dZ(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=dK()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!dJ}},webtransport:class extends dD{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{let t;let n=e.readable.getReader();this.writer=e.writable.getWriter();let i=()=>{n.read().then(({done:e,value:n})=>{var o,a;e||(t||1!==n.byteLength||54!==n[0]?(this.onPacket((o=t,a="arraybuffer",r||(r=new TextDecoder),dM(o||n[0]<48||n[0]>54?n:r.decode(n),a))),t=!1):t=!0,i())}).catch(e=>{})};i();let o=this.query.sid?`0{"sid":"${this.query.sid}"}`:"0";this.writer.write((new TextEncoder).encode(o)).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let n=0;n{t||(t=new TextEncoder),n(t.encode(e))})}(r,e=>{"message"===r.type&&"string"!=typeof r.data&&e[0]>=48&&e[0]<=54&&this.writer.write(Uint8Array.of(54)),this.writer.write(e).then(()=>{i&&dZ(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})})}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends dD{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){let t="https:"===location.protocol,n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}let t=e&&e.forceBase64;this.supportsBinary=dY&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{let n=e.split("\x1e"),r=[];for(let e=0;e{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){let e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,o)=>{dw(e,!1,e=>{r[o]=e,++i===n&&t(r.join("\x1e"))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=dK()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new dG(this.uri(),e)}doWrite(e,t){let n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}},d1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,d2=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function d3(e){let t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=d1.exec(e||""),o={},a=14;for(;a--;)o[d2[a]]=i[a]||"";return -1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){let n=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1),"/"==t.slice(-1)&&n.splice(n.length-1,1),n}(0,o.path),o.queryKey=function(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}let d6=class e extends dR{constructor(e,t={}){super(),this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=d3(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=d3(t.host).host),dL(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new d0[e](n)}open(){let t;if(this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(e){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",e=>this.onClose("transport close",e))}probe(t){let n=this.createTransport(t),r=!1;e.priorWebsocketSuccess=!1;let i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",t=>{if(!r){if("pong"===t.type&&"probe"===t.data)this.upgrading=!0,this.emitReserved("upgrading",n),n&&(e.priorWebsocketSuccess="websocket"===n.name,this.transport.pause(()=>{r||"closed"!==this.readyState&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())}));else{let e=Error("probe error");e.transport=n.name,this.emitReserved("upgradeError",e)}}}))};function o(){r||(r=!0,c(),n.close(),n=null)}let a=e=>{let t=Error("probe error: "+e);t.transport=n.name,o(),this.emitReserved("upgradeError",t)};function s(){a("transport closed")}function l(){a("socket closed")}function u(e){n&&e.name!==n.name&&o()}let c=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",l),this.once("upgrading",u),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",e.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0,t=this.upgrades.length;for(;e{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t=57344?n+=3:(r++,n+=4);return n}(n):Math.ceil(1.33*(n.byteLength||n.size))),t>0&&e>this.maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){let e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}onError(t){e.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let t=[],n=0,r=e.length;for(;n"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,d5=Object.prototype.toString,d7="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===d5.call(Blob),d9="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===d5.call(File);function fe(e){return d4&&(e instanceof ArrayBuffer||d8(e))||d7&&e instanceof Blob||d9&&e instanceof File}let ft=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];function fn(e){return"[object Object]"===Object.prototype.toString.call(e)}(fy=fA||(fA={}))[fy.CONNECT=0]="CONNECT",fy[fy.DISCONNECT=1]="DISCONNECT",fy[fy.EVENT=2]="EVENT",fy[fy.ACK=3]="ACK",fy[fy.CONNECT_ERROR=4]="CONNECT_ERROR",fy[fy.BINARY_EVENT=5]="BINARY_EVENT",fy[fy.BINARY_ACK=6]="BINARY_ACK";class fr extends dR{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let n=(t=this.decodeString(e)).type===fA.BINARY_EVENT;n||t.type===fA.BINARY_ACK?(t.type=n?fA.EVENT:fA.ACK,this.reconstructor=new fi(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!fe(e)&&!e.base64)throw Error("Unknown type: "+e);if(!this.reconstructor)throw Error("got binary data when not reconstructing a packet");(t=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0,n={type:Number(e.charAt(0))};if(void 0===fA[n.type])throw Error("unknown packet type "+n.type);if(n.type===fA.BINARY_EVENT||n.type===fA.BINARY_ACK){let r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);let i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw Error("Illegal attachments");n.attachments=Number(i)}if("/"===e.charAt(t+1)){let r=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);n.nsp=e.substring(r,t)}else n.nsp="/";let r=e.charAt(t+1);if(""!==r&&Number(r)==r){let r=t+1;for(;++t;){let n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){let r=this.tryParse(e.substr(t));if(!fr.isPayloadValid(n.type,r))throw Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case fA.CONNECT:return fn(t);case fA.DISCONNECT:return void 0===t;case fA.CONNECT_ERROR:return"string"==typeof t||fn(t);case fA.EVENT:case fA.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===ft.indexOf(t[0]));case fA.ACK:case fA.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class fi{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t,n;let e=(t=this.reconPack,n=this.buffers,t.data=function e(t,n){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num{delete this.acks[e];for(let t=0;t{this.io.clearTimeoutFn(i),t.apply(this,[null,...e])}}emitWithAck(e,...t){let n=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise((r,i)=>{t.push((e,t)=>n?e?i(e):r(t):r(e)),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n===this._queue[0])return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:fA.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case fA.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case fA.EVENT:case fA.BINARY_EVENT:this.onevent(e);break;case fA.ACK:case fA.BINARY_ACK:this.onack(e);break;case fA.DISCONNECT:this.ondisconnect();break;case fA.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){let t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length)for(let t of this._anyListeners.slice())t.apply(this,e);super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:fA.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:fA.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n0&&e.jitter<=1?e.jitter:0,this.attempts=0}fu.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},fu.prototype.reset=function(){this.attempts=0},fu.prototype.setMin=function(e){this.ms=e},fu.prototype.setMax=function(e){this.max=e},fu.prototype.setJitter=function(e){this.jitter=e};class fc extends dR{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,dL(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new fu({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;let r=t.parser||fo;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new d6(this.uri,this.opts);let t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;let r=fa(t,"open",function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=fa(t,"error",i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(fa(e,"ping",this.onping.bind(this)),fa(e,"data",this.ondata.bind(this)),fa(e,"error",this.onerror.bind(this)),fa(e,"close",this.onclose.bind(this)),fa(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){dZ(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new fl(this,e,t),this.nsps[e]=n),n}_destroy(e){for(let e of Object.keys(this.nsps))if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;ne()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}let fd={};function ff(e,t){let n;"object"==typeof e&&(t=e,e=void 0);let r=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=d3(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),i=r.source,o=r.id,a=r.path,s=fd[o]&&a in fd[o].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?n=new fc(i,t):(fd[o]||(fd[o]=new fc(i,t)),n=fd[o]),r.query&&!t.query&&(t.query=r.queryKey),n.socket(r.path,t)}function fh(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})}Object.assign(ff,{Manager:fc,Socket:fl,io:ff,connect:ff}),"function"==typeof SuppressedError&&SuppressedError;var fp=void 0!==s?s:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function fm(){throw Error("setTimeout has not been defined")}function fg(){throw Error("clearTimeout has not been defined")}var fv=fm,fb=fg;"function"==typeof fp.setTimeout&&(fv=setTimeout),"function"==typeof fp.clearTimeout&&(fb=clearTimeout);var fy,fA,fw,f_=[],fE=!1,fS=-1;function fk(){fE&&fw&&(fE=!1,fw.length?f_=fw.concat(f_):fS=-1,f_.length&&function(){if(!fE){var e=function(e){if(fv===setTimeout)return setTimeout(e,0);if((fv===fm||!fv)&&setTimeout)return fv=setTimeout,setTimeout(e,0);try{return fv(e,0)}catch(t){try{return fv.call(null,e,0)}catch(t){return fv.call(this,e,0)}}}(fk);fE=!0;for(var t=f_.length;t;){for(fw=f_,f_=[];++fS{if("%%"===n)return"%";o++;let i=t.formatters[r];if("function"==typeof i){let t=e[o];n=i.call(s,t),e.splice(o,1),o--}return n}),t.formatArgs.call(s,e),(s.log||t.log).apply(s,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){let r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names.map(r),...t.skips.map(r).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];let r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n=1.5*n?"s":"")}return fC=1,fM=function(t,n){n=n||{};var r,i,o=typeof t;if("string"===o&&t.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return 864e5*n;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*n;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*n;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(t);if("number"===o&&isFinite(t))return n.long?(r=Math.abs(t))>=864e5?e(t,r,864e5,"day"):r>=36e5?e(t,r,36e5,"hour"):r>=6e4?e(t,r,6e4,"minute"):r>=1e3?e(t,r,1e3,"second"):t+" ms":(i=Math.abs(t))>=864e5?Math.round(t/864e5)+"d":i>=36e5?Math.round(t/36e5)+"h":i>=6e4?Math.round(t/6e4)+"m":i>=1e3?Math.round(t/1e3)+"s":t+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}}(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==fR&&"env"in fR&&(e=fR.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(n=!1,()=>{n||(n=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=fT(t);let{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(fI,fI.exports);var fO=(vt=fI.exports)&&vt.__esModule&&Object.prototype.hasOwnProperty.call(vt,"default")?vt.default:vt;let fP=fO("KeyExchange:Layer"),fL=fO("SocketService:Layer"),fN=fO("Ecies:Layer"),fD=fO("RemoteCommunication:Layer");fP.color="##95c44e",fL.color="#f638d7",fN.color="#465b9c",fD.color="#47a2be";let fB={KeyExchange:fP,SocketService:fL,Ecies:fN,RemoteCommunication:fD},fj,fF=[],fz=[],fU=(e,t)=>fh(void 0,void 0,void 0,function*(){fj=t,fz.push(e),(function(e){return fh(this,void 0,void 0,function*(){if(!fj||!e)return;!function(){let e=fz;fz=fF,fF=e}();let t=fj.endsWith("/")?`${fj}debug`:`${fj}/debug`,n=Object.assign({},e);if(delete n.params,e.params)for(let[t,r]of Object.entries(e.params))n[t]=r;let r=JSON.stringify(n);fB.RemoteCommunication(`[sendBufferedEvents] Sending ${fF.length} analytics events to ${t}`);try{let e=yield f(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:r}),n=yield e.text();fB.RemoteCommunication(`[sendBufferedEvents] Response: ${n}`),fF.length=0}catch(e){console.warn("Error sending analytics",e)}})})(e).catch(()=>{})});var fq=[],fK=[],fH="undefined"!=typeof Uint8Array?Uint8Array:Array,fV=!1;function f$(){fV=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)fq[t]=e[t],fK[e.charCodeAt(t)]=t;fK["-".charCodeAt(0)]=62,fK["_".charCodeAt(0)]=63}function fW(e){var t;fV||f$();for(var n=e.length,r=n%3,i="",o=[],a=0,s=n-r;a>18&63]+fq[r>>12&63]+fq[r>>6&63]+fq[63&r]);return i.join("")}(e,a,a+16383>s?s:a+16383));return 1===r?i+=fq[(t=e[n-1])>>2]+fq[t<<4&63]+"==":2===r&&(i+=fq[(t=(e[n-2]<<8)+e[n-1])>>10]+fq[t>>4&63]+fq[t<<2&63]+"="),o.push(i),o.join("")}function fY(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<>1,c=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=u}return(h?-1:1)*a*Math.pow(2,o-r)}function fG(e,t,n,r,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,f=23===i?5960464477539062e-23:0,h=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?f/l:f*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*m}var fQ={}.toString,fZ=Array.isArray||function(e){return"[object Array]"==fQ.call(e)};function fJ(){return f0.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function fX(e,t){if(fJ()=fJ())throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+fJ().toString(16)+" bytes");return 0|e}function f8(e){return!(null==e||!e._isBuffer)}function f5(e,t){if(f8(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return hf(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return hh(e).length;default:if(r)return hf(e).length;t=(""+t).toLowerCase(),r=!0}}function f7(e,t,n){var r,i,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r,i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var o="",a=t;a2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),isNaN(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return -1;n=e.length-1}else if(n<0){if(!i)return -1;n=0}if("string"==typeof t&&(t=f0.from(t,r)),f8(t))return 0===t.length?-1:ht(e,t,n,r,i);if("number"==typeof t)return t&=255,f0.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):ht(e,[t],n,r,i);throw TypeError("val must be string, number or Buffer")}function ht(e,t,n,r,i){var o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;os&&(n=s-l),o=n;o>=0;o--){for(var d=!0,f=0;f239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=hr)return String.fromCharCode.apply(String,e);for(var n="",r=0;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},f0.prototype.compare=function(e,t,n,r,i){if(!f8(e))throw TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,i),u=e.slice(t,n),c=0;cp)&&(n=p),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var m=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i.push(n%256),i.push(r);return i}(e,this.length-f),this,f,h);default:if(m)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),m=!0}},f0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var hr=4096;function hi(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function ho(e,t,n,r,i,o){if(!f8(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function ha(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function hs(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function hl(e,t,n,r,i,o){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function hu(e,t,n,r,i){return i||hl(e,0,n,4),fG(e,t,n,r,23,4),n+4}function hc(e,t,n,r,i){return i||hl(e,0,n,8),fG(e,t,n,r,52,8),n+8}f0.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},f0.prototype.readUInt8=function(e,t){return t||hi(e,1,this.length),this[e]},f0.prototype.readUInt16LE=function(e,t){return t||hi(e,2,this.length),this[e]|this[e+1]<<8},f0.prototype.readUInt16BE=function(e,t){return t||hi(e,2,this.length),this[e]<<8|this[e+1]},f0.prototype.readUInt32LE=function(e,t){return t||hi(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f0.prototype.readUInt32BE=function(e,t){return t||hi(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f0.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||hi(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},f0.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||hi(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},f0.prototype.readInt8=function(e,t){return t||hi(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f0.prototype.readInt16LE=function(e,t){t||hi(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},f0.prototype.readInt16BE=function(e,t){t||hi(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},f0.prototype.readInt32LE=function(e,t){return t||hi(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f0.prototype.readInt32BE=function(e,t){return t||hi(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f0.prototype.readFloatLE=function(e,t){return t||hi(e,4,this.length),fY(this,e,!0,23,4)},f0.prototype.readFloatBE=function(e,t){return t||hi(e,4,this.length),fY(this,e,!1,23,4)},f0.prototype.readDoubleLE=function(e,t){return t||hi(e,8,this.length),fY(this,e,!0,52,8)},f0.prototype.readDoubleBE=function(e,t){return t||hi(e,8,this.length),fY(this,e,!1,52,8)},f0.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||ho(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},f0.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,1,255,0),f0.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},f0.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,2,65535,0),f0.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ha(this,e,t,!0),t+2},f0.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,2,65535,0),f0.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ha(this,e,t,!1),t+2},f0.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,4,4294967295,0),f0.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):hs(this,e,t,!0),t+4},f0.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,4,4294967295,0),f0.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):hs(this,e,t,!1),t+4},f0.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ho(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},f0.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ho(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},f0.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,1,127,-128),f0.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},f0.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,2,32767,-32768),f0.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ha(this,e,t,!0),t+2},f0.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,2,32767,-32768),f0.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ha(this,e,t,!1),t+2},f0.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,4,2147483647,-2147483648),f0.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):hs(this,e,t,!0),t+4},f0.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),f0.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):hs(this,e,t,!1),t+4},f0.prototype.writeFloatLE=function(e,t,n){return hu(this,e,t,!0,n)},f0.prototype.writeFloatBE=function(e,t,n){return hu(this,e,t,!1,n)},f0.prototype.writeDoubleLE=function(e,t,n){return hc(this,e,t,!0,n)},f0.prototype.writeDoubleBE=function(e,t,n){return hc(this,e,t,!1,n)},f0.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw RangeError("sourceStart out of bounds");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!f0.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!i){if(n>56319||a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function hh(e){return function(e){fV||f$();var t,n,r,i,o,a,s=e.length;if(s%4>0)throw Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new fH(3*s/4-o),r=o>0?s-4:s;var l=0;for(t=0,n=0;t>16&255,a[l++]=i>>8&255,a[l++]=255&i;return 2===o?(i=fK[e.charCodeAt(t)]<<2|fK[e.charCodeAt(t+1)]>>4,a[l++]=255&i):1===o&&(i=fK[e.charCodeAt(t)]<<10|fK[e.charCodeAt(t+1)]<<4|fK[e.charCodeAt(t+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(hd,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function hp(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function hm(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}class hg{constructor(e){this.enabled=!0,(null==e?void 0:e.debug)&&fO.enable("Ecies:Layer"),(null==e?void 0:e.privateKey)?this.ecies=ee.PrivateKey.fromHex(e.privateKey):this.ecies=new ee.PrivateKey,fB.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),fB.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),fB.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new ee.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,t){let n=e;if(this.enabled)try{fB.Ecies("[ECIES: encrypt()] using otherPublicKey",t);let r=f0.from(e),i=ee.encrypt(t,r);n=f0.from(i).toString("base64")}catch(n){throw fB.Ecies("[ECIES: encrypt()] error encrypt:",n),fB.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),fB.Ecies("[ECIES: encrypt()] data: ",e),fB.Ecies("[ECIES: encrypt()] otherkey: ",t),n}return n}decrypt(e){let t=e;if(this.enabled)try{fB.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());let n=f0.from(e.toString(),"base64");t=ee.decrypt(this.ecies.toHex(),n).toString()}catch(t){throw fB.Ecies("[ECIES: decrypt()] error decrypt",t),fB.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),fB.Ecies("[ECIES: decrypt()] encryptedData: ",e),t}return t}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){fB.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var hv="0.20.5";let hb="https://metamask-sdk.api.cx.metamask.io/",hy=["websocket"],hA={ETH_REQUESTACCOUNTS:"eth_requestAccounts"};function hw(e){let{context:t}=e;fB.RemoteCommunication(`[RemoteCommunication: clean()] context=${t}`),e.channelConfig=void 0,e.ready=!1,e.originatorConnectStarted=!1}e.ConnectionStatus=void 0,e.EventType=void 0,e.MessageType=void 0,(vn=e.ConnectionStatus||(e.ConnectionStatus={})).DISCONNECTED="disconnected",vn.WAITING="waiting",vn.TIMEOUT="timeout",vn.LINKED="linked",vn.PAUSED="paused",vn.TERMINATED="terminated",(vr=e.EventType||(e.EventType={})).KEY_INFO="key_info",vr.SERVICE_STATUS="service_status",vr.PROVIDER_UPDATE="provider_update",vr.RPC_UPDATE="rpc_update",vr.KEYS_EXCHANGED="keys_exchanged",vr.JOIN_CHANNEL="join_channel",vr.CHANNEL_CREATED="channel_created",vr.CLIENTS_CONNECTED="clients_connected",vr.CLIENTS_DISCONNECTED="clients_disconnected",vr.CLIENTS_WAITING="clients_waiting",vr.CLIENTS_READY="clients_ready",vr.CHANNEL_PERSISTENCE="channel_persistence",vr.MESSAGE_ACK="ack",vr.SOCKET_DISCONNECTED="socket_disconnected",vr.SOCKET_RECONNECT="socket_reconnect",vr.OTP="otp",vr.SDK_RPC_CALL="sdk_rpc_call",vr.AUTHORIZED="authorized",vr.CONNECTION_STATUS="connection_status",vr.MESSAGE="message",vr.TERMINATE="terminate",(vc||(vc={})).KEY_EXCHANGE="key_exchange",(vi=vd||(vd={})).KEY_HANDSHAKE_START="key_handshake_start",vi.KEY_HANDSHAKE_CHECK="key_handshake_check",vi.KEY_HANDSHAKE_SYN="key_handshake_SYN",vi.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",vi.KEY_HANDSHAKE_ACK="key_handshake_ACK",vi.KEY_HANDSHAKE_NONE="none";class h_ extends dl.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:t,context:n,ecies:r,logging:i}){super(),this.keysExchanged=!1,this.step=vd.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=n,this.communicationLayer=e,(null==r?void 0:r.privateKey)&&t&&(fB.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${t} set keysExchanged to true!`,r),this.keysExchanged=!0),this.myECIES=new hg(Object.assign(Object.assign({},r),{debug:null==i?void 0:i.eciesLayer})),this.myPublicKey=this.myECIES.getPublicKey(),this.debug=!0===(null==i?void 0:i.keyExchangeLayer),t&&this.setOtherPublicKey(t),this.communicationLayer.on(vc.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(t){let{relayPersistence:n}=this.communicationLayer.remote.state;if(fB.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${n}`,t),n)return void fB.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");let{message:r}=t;this.keysExchanged&&fB.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(e.EventType.KEY_INFO,r.type),r.type===vd.KEY_HANDSHAKE_SYN?(this.checkStep([vd.KEY_HANDSHAKE_NONE,vd.KEY_HANDSHAKE_ACK]),fB.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",r),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:vd.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}),this.setStep(vd.KEY_HANDSHAKE_ACK)):r.type===vd.KEY_HANDSHAKE_SYNACK?(this.checkStep([vd.KEY_HANDSHAKE_SYNACK,vd.KEY_HANDSHAKE_ACK,vd.KEY_HANDSHAKE_NONE]),fB.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:vd.KEY_HANDSHAKE_ACK}),this.keysExchanged=!0,this.setStep(vd.KEY_HANDSHAKE_ACK),this.emit(e.EventType.KEYS_EXCHANGED)):r.type===vd.KEY_HANDSHAKE_ACK&&(fB.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([vd.KEY_HANDSHAKE_ACK,vd.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(vd.KEY_HANDSHAKE_ACK),this.emit(e.EventType.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new hg(e)}clean(){fB.KeyExchange(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(vd.KEY_HANDSHAKE_NONE),this.emit(e.EventType.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:t}){let{relayPersistence:n,protocolVersion:r}=this.communicationLayer.remote.state;if(n)return fB.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"),void console.log(`[KeyExchange: start()] relayPersistence=${n}`);fB.KeyExchange(`[KeyExchange: start()] context=${this.context} protocolVersion=${r} isOriginator=${e} step=${this.step} force=${t} relayPersistence=${n} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==vd.KEY_HANDSHAKE_NONE&&this.step!==vd.KEY_HANDSHAKE_SYNACK)||t?(fB.KeyExchange(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${t}) -- step=${this.step}`,this.step),this.clean(),this.setStep(vd.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:vd.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2})):fB.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&!0!==t?fB.KeyExchange("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):r>=2?this.communicationLayer.sendMessage({type:vd.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}):(this.communicationLayer.sendMessage({type:vd.KEY_HANDSHAKE_START}),this.clean())}setStep(t){this.step=t,this.emit(e.EventType.KEY_INFO,t)}checkStep(e){e.length>0&&-1===e.indexOf(this.step.toString())&&console.warn(`[KeyExchange: checkStep()] Wrong Step "${this.step}" not within ${e}`)}setRelayPersistence({localKey:e,otherKey:t}){this.otherPublicKey=t,this.myECIES=new hg({privateKey:e,debug:this.debug}),this.keysExchanged=!0}setKeysExchanged(e){this.keysExchanged=e}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(e){fB.KeyExchange("[KeyExchange: setOtherPubKey()]",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){return JSON.stringify({keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step})}}(vo=e.MessageType||(e.MessageType={})).TERMINATE="terminate",vo.ANSWER="answer",vo.OFFER="offer",vo.CANDIDATE="candidate",vo.JSONRPC="jsonrpc",vo.WALLET_INFO="wallet_info",vo.ORIGINATOR_INFO="originator_info",vo.PAUSE="pause",vo.OTP="otp",vo.AUTHORIZED="authorized",vo.PING="ping",vo.READY="ready";let hE=e=>new Promise(t=>{setTimeout(t,e)}),hS=(e,t,n=200)=>fh(void 0,void 0,void 0,function*(){let r;let i=Date.now(),o=!1;for(;!o;){if(o=Date.now()-i>3e5,void 0!==(r=t[e]).elapsedTime)return r;yield hE(n)}throw Error(`RPC ${e} timed out`)}),hk=t=>fh(void 0,void 0,void 0,function*(){var n,r,i,o,a;return t.remote.state.terminated?(fB.SocketService(`[SocketService: reconnectSocket()] instance.remote.state.terminated=${t.remote.state.terminated} socket already terminated`,t),!1):(fB.SocketService(`[SocketService: reconnectSocket()] instance.state.socket?.connected=${null===(n=t.state.socket)||void 0===n?void 0:n.connected} trying to reconnect after socketio disconnection`,t),yield hE(200),(null===(r=t.state.socket)||void 0===r?void 0:r.connected)||(t.state.resumed=!0,null===(i=t.state.socket)||void 0===i||i.connect(),t.emit(e.EventType.SOCKET_RECONNECT),null===(o=t.state.socket)||void 0===o||o.emit(e.EventType.JOIN_CHANNEL,{channelId:t.state.channelId,context:`${t.state.context}connect_again`,clientType:t.state.isOriginator?"dapp":"wallet"})),yield hE(100),null===(a=t.state.socket)||void 0===a?void 0:a.connected)});(va=vf||(vf={})).REQUEST="sdk_connect_request_started",va.REQUEST_MOBILE="sdk_connect_request_started_mobile",va.RECONNECT="sdk_reconnect_request_started",va.CONNECTED="sdk_connection_established",va.CONNECTED_MOBILE="sdk_connection_established_mobile",va.AUTHORIZED="sdk_connection_authorized",va.REJECTED="sdk_connection_rejected",va.TERMINATED="sdk_connection_terminated",va.DISCONNECTED="sdk_disconnected",va.SDK_USE_EXTENSION="sdk_use_extension",va.SDK_RPC_REQUEST="sdk_rpc_request",va.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",va.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",va.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",va.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser",(vs=vh||(vh={})).RPC_CHECK="rpcCheck",vs.SKIPPED_RPC="skippedRpc";let hM=["eth_sendTransaction","eth_signTypedData","eth_signTransaction","personal_sign","wallet_requestPermissions","wallet_switchEthereumChain","eth_signTypedData_v3","eth_signTypedData_v4","metamask_connectSign","metamask_connectWith","metamask_batch"].map(e=>e.toLowerCase()),hC=[{event:"clients_connected",handler:function(t,n){return r=>fh(this,void 0,void 0,function*(){var r,i,o,a,s,l,u,c,d,f,h;let p=null!==(i=null===(r=t.remote.state.channelConfig)||void 0===r?void 0:r.relayPersistence)&&void 0!==i&&i;if(fB.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected-${n}' relayPersistence=${p} resumed=${t.state.resumed} clientsPaused=${t.state.clientsPaused} keysExchanged=${null===(o=t.state.keyExchange)||void 0===o?void 0:o.areKeysExchanged()} isOriginator=${t.state.isOriginator}`),t.emit(e.EventType.CLIENTS_CONNECTED,{isOriginator:t.state.isOriginator,keysExchanged:null===(a=t.state.keyExchange)||void 0===a?void 0:a.areKeysExchanged(),context:t.state.context}),t.state.resumed)t.state.isOriginator||(fB.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} 'clients_connected' / keysExchanged=${null===(s=t.state.keyExchange)||void 0===s?void 0:s.areKeysExchanged()} -- backward compatibility`),null===(l=t.state.keyExchange)||void 0===l||l.start({isOriginator:null!==(u=t.state.isOriginator)&&void 0!==u&&u})),t.state.resumed=!1;else if(t.state.clientsPaused)fB.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!t.state.isOriginator){let e=!p;console.log(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${null===(c=t.state.keyExchange)||void 0===c?void 0:c.areKeysExchanged()} -- force=${e} -- backward compatibility`),fB.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${null===(d=t.state.keyExchange)||void 0===d?void 0:d.areKeysExchanged()} -- force=${e} -- backward compatibility`),null===(f=t.state.keyExchange)||void 0===f||f.start({isOriginator:null!==(h=t.state.isOriginator)&&void 0!==h&&h,force:e})}t.state.clientsConnected=!0,t.state.clientsPaused=!1})}},{event:"channel_created",handler:function(t,n){return r=>{fB.SocketService(`[SocketService: handleChannelCreated()] context=${t.state.context} on 'channel_created-${n}'`,r),t.emit(e.EventType.CHANNEL_CREATED,r)}}},{event:"clients_disconnected",handler:function(t,n){return()=>{var r;t.state.clientsConnected=!1,fB.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${n}'`),t.remote.state.relayPersistence?fB.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${n}' - relayPersistence enabled, skipping key exchange cleanup.`):(t.state.isOriginator&&!t.state.clientsPaused&&(null===(r=t.state.keyExchange)||void 0===r||r.clean()),t.emit(e.EventType.CLIENTS_DISCONNECTED,n))}}},{event:"config",handler:function(t,n){return r=>fh(this,void 0,void 0,function*(){var i,o;fB.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${n}'`,r),t.remote.state.relayPersistence=!0,t.remote.emit(e.EventType.CHANNEL_PERSISTENCE),null===(i=t.state.keyExchange)||void 0===i||i.setKeysExchanged(!0),t.state.isOriginator&&t.remote.state.channelConfig&&!t.remote.state.channelConfig.relayPersistence&&(t.remote.state.channelConfig.relayPersistence=!0,null===(o=t.remote.state.storageManager)||void 0===o||o.persistChannelConfig(t.remote.state.channelConfig))})}},{event:"message",handler:function(t,n){return r=>{var i,o,a,s,l,u,c,d,f,h,p,m,g,v,b,y,A,w;let{id:_,ackId:E,message:S,error:k}=r,M=null!==(i=t.remote.state.relayPersistence)&&void 0!==i&&i;if(fB.SocketService(`[SocketService handleMessage()] relayPersistence=${M} context=${t.state.context} on 'message' ${n} keysExchanged=${null===(o=t.state.keyExchange)||void 0===o?void 0:o.areKeysExchanged()}`,r),k)throw fB.SocketService(` + [SocketService handleMessage()] context=${t.state.context}::on 'message' error=${k}`),Error(k);try{!function(e,t){if(t!==e.channelId)throw e.debug&&console.error(`Wrong id ${t} - should be ${e.channelId}`),Error("Wrong id")}(t.state,_)}catch(e){return void console.error("ignore message --- wrong id ",S)}let C="string"==typeof S;if(!C&&(null==S?void 0:S.type)===vd.KEY_HANDSHAKE_START)return M?void console.warn("[SocketService handleMessage()] Ignoring key exchange message because relay persistence is activated",S):(fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received HANDSHAKE_START isOriginator=${t.state.isOriginator}`,S),void(null===(a=t.state.keyExchange)||void 0===a||a.start({isOriginator:null!==(s=t.state.isOriginator)&&void 0!==s&&s,force:!0})));if(!C&&(null===(l=null==S?void 0:S.type)||void 0===l?void 0:l.startsWith("key_handshake")))return M?void console.warn("[SocketService handleMessage()] Ignoring key exchange message because relay persistence is activated",S):(fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' emit KEY_EXCHANGE`,S),void t.emit(vc.KEY_EXCHANGE,{message:S,context:t.state.context}));if(!C||(null===(u=t.state.keyExchange)||void 0===u?void 0:u.areKeysExchanged())){if(!C&&(null==S?void 0:S.type))return console.warn("[SocketService handleMessage() ::on 'message' received non encrypted unkwown message"),void t.emit(e.EventType.MESSAGE,S)}else{let e=!1;try{fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' trying to decrypt message`),null===(c=t.state.keyExchange)||void 0===c||c.decryptMessage(S),e=!0}catch(e){fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' error`,e)}if(!e)return t.state.isOriginator?null===(f=t.state.keyExchange)||void 0===f||f.start({isOriginator:null!==(h=t.state.isOriginator)&&void 0!==h&&h}):t.sendMessage({type:vd.KEY_HANDSHAKE_START}),void fB.SocketService(`Message ignored because invalid key exchange status. step=${null===(p=t.state.keyExchange)||void 0===p?void 0:p.getKeyInfo().step}`,null===(m=t.state.keyExchange)||void 0===m?void 0:m.getKeyInfo(),S);fB.SocketService("Invalid key exchange status detected --- updating it."),null===(d=t.state.keyExchange)||void 0===d||d.setKeysExchanged(!0)}if(!C)return console.warn("[SocketService handleMessage() ::on 'message' received unkwown message",S),void t.emit(e.EventType.MESSAGE,S);let x=null===(g=t.state.keyExchange)||void 0===g?void 0:g.decryptMessage(S),R=JSON.parse(null!=x?x:"{}");if(E&&(null==E?void 0:E.length)>0&&(fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' ackid=${E} channelId=${_}`),null===(v=t.state.socket)||void 0===v||v.emit(e.EventType.MESSAGE_ACK,{ackId:E,channelId:_,clientType:t.state.isOriginator?"dapp":"wallet"})),(null==R?void 0:R.type)===e.MessageType.PAUSE?t.state.clientsPaused=!0:t.state.clientsPaused=!1,t.state.isOriginator&&R.data){let n=R.data,r=t.state.rpcMethodTracker[n.id];if(r){let i=Date.now()-r.timestamp;fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received answer for id=${n.id} method=${r.method} responseTime=${i}`,R),t.remote.state.analytics&&hM.includes(r.method.toLowerCase())&&fU({id:null!==(b=t.remote.state.channelId)&&void 0!==b?b:"",event:vf.SDK_RPC_REQUEST_DONE,sdkVersion:t.remote.state.sdkVersion,commLayerVersion:hv,walletVersion:null===(y=t.remote.state.walletInfo)||void 0===y?void 0:y.version,params:{method:r.method,from:"mobile"}},t.remote.state.communicationServerUrl).catch(e=>{console.error("Cannot send analytics",e)});let o=Object.assign(Object.assign({},r),{result:n.result,error:n.error?{code:null===(A=n.error)||void 0===A?void 0:A.code,message:null===(w=n.error)||void 0===w?void 0:w.message}:void 0,elapsedTime:i});t.state.rpcMethodTracker[n.id]=o,t.emit(e.EventType.RPC_UPDATE,o)}}t.emit(e.EventType.MESSAGE,{message:R})}}},{event:"clients_waiting_to_join",handler:function(t,n){return r=>{fB.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${t.state.context} on 'clients_waiting_to_join-${n}'`,r),t.emit(e.EventType.CLIENTS_WAITING,r)}}}],hx=[{event:e.EventType.KEY_INFO,handler:function(t){return n=>{fB.SocketService("[SocketService: handleKeyInfo()] on 'KEY_INFO'",n),t.emit(e.EventType.KEY_INFO,n)}}},{event:e.EventType.KEYS_EXCHANGED,handler:function(t){return()=>{var n,r,i;fB.SocketService(`[SocketService: handleKeysExchanged()] on 'keys_exchanged' keyschanged=${null===(n=t.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()}`);let{channelConfig:o}=t.remote.state;if(o){let e=t.getKeyExchange().getKeyInfo().ecies;o.localKey=e.private,o.otherKey=e.otherPubKey,t.remote.state.channelConfig=o,null===(r=t.remote.state.storageManager)||void 0===r||r.persistChannelConfig(o).catch(e=>{console.error("Error persisting channel config",e)})}t.emit(e.EventType.KEYS_EXCHANGED,{keysExchanged:null===(i=t.state.keyExchange)||void 0===i?void 0:i.areKeysExchanged(),isOriginator:t.state.isOriginator});let a={keyInfo:t.getKeyInfo()};t.emit(e.EventType.SERVICE_STATUS,a)}}}];function hR(t,n){fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} setting socket listeners for channel ${n}...`);let{socket:r}=t.state,{keyExchange:i}=t.state;t.state.setupChannelListeners&&console.warn(`[SocketService: setupChannelListener()] context=${t.state.context} socket listeners already set up for channel ${n}`),r&&t.state.isOriginator&&(t.state.debug&&(null==r||r.io.on("error",e=>{fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=error`,e)}),null==r||r.io.on("reconnect",e=>{fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect`,e)}),null==r||r.io.on("reconnect_error",e=>{fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_error`,e)}),null==r||r.io.on("reconnect_failed",()=>{fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_failed`)}),null==r||r.io.on("ping",()=>{fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket`)})),null==r||r.on("disconnect",n=>{var r;return fB.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${n}' begin recovery...`),r=n,void(fB.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${t.state.manualDisconnect}`,r),t.state.manualDisconnect||(t.emit(e.EventType.SOCKET_DISCONNECTED),"undefined"!=typeof window&&"undefined"!=typeof document&&(fB.SocketService(`[SocketService: checkFocusAndReconnect()] hasFocus=${document.hasFocus()}`,t),document.hasFocus()?hk(t).then(e=>{fB.SocketService(`SocketService::checkFocus reconnectSocket success=${e}`,t)}).catch(e=>{console.error("SocketService::checkFocus Error reconnecting socket",e)}):window.addEventListener("focus",()=>{hk(t).catch(e=>{console.error("SocketService::checkFocus Error reconnecting socket",e)})},{once:!0}))))})),hC.forEach(({event:e,handler:i})=>{let o=`${e}-${n}`;null==r||r.on(o,i(t,n))}),hx.forEach(({event:e,handler:n})=>{null==i||i.on(e,n(t))}),t.state.setupChannelListeners=!0}class hI extends dl.EventEmitter2{constructor({otherPublicKey:e,reconnect:t,communicationLayerPreference:n,transports:r,communicationServerUrl:i,context:o,ecies:a,remote:s,logging:l}){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:""},this.state.resumed=t,this.state.context=o,this.state.isOriginator=s.state.isOriginator,this.state.communicationLayerPreference=n,this.state.debug=!0===(null==l?void 0:l.serviceLayer),this.remote=s,!0===(null==l?void 0:l.serviceLayer)&&fO.enable("SocketService:Layer"),this.state.communicationServerUrl=i,this.state.hasPlaintext=this.state.communicationServerUrl!==hb&&!0===(null==l?void 0:l.plaintext);let u={autoConnect:!1,transports:hy,withCredentials:!0};r&&(u.transports=r),fB.SocketService(`[SocketService: constructor()] Socket IO url: ${this.state.communicationServerUrl}`),this.state.socket=ff(i,u);let c={communicationLayer:this,otherPublicKey:e,sendPublicKey:!1,context:this.state.context,ecies:a,logging:l};this.state.keyExchange=new h_(c)}resetKeys(){var e;return fB.SocketService("[SocketService: resetKeys()] Resetting keys."),void(null===(e=this.state.keyExchange)||void 0===e||e.resetKeys())}createChannel(){return function(t){var n,r,i,o;if(fB.SocketService(`[SocketService: createChannel()] context=${t.state.context}`),null===(n=t.state.socket)||void 0===n?void 0:n.connected)throw console.error("[SocketService: createChannel()] socket already connected"),Error("socket already connected");console.log("create channel",t.state.socket),null===(r=t.state.socket)||void 0===r||r.connect(),t.state.manualDisconnect=!1,t.state.isOriginator=!0;let a=dp();return t.state.channelId=a,hR(t,a),null===(i=t.state.socket)||void 0===i||i.emit(e.EventType.JOIN_CHANNEL,{channelId:a,context:`${t.state.context}createChannel`,clientType:"dapp"}),{channelId:a,pubKey:(null===(o=t.state.keyExchange)||void 0===o?void 0:o.getMyPublicKey())||""}}(this)}connectToChannel({channelId:t,withKeyExchange:n=!1}){return function({options:t,instance:n}){var r,i,o,a,s,l,u,c;let{channelId:d,withKeyExchange:f}=t,h=null!==(r=n.state.isOriginator)&&void 0!==r&&r;if(fB.SocketService(`[SocketService: connectToChannel()] context=${n.state.context} channelId=${d} isOriginator=${h}`,null===(i=n.state.keyExchange)||void 0===i?void 0:i.toString()),null===(o=n.state.socket)||void 0===o?void 0:o.connected)throw console.error("[SocketService: connectToChannel()] socket already connected"),Error("socket already connected");let{channelConfig:p}=n.remote.state;h&&(null==p?void 0:p.relayPersistence)&&(p.localKey&&(null===(a=null==p?void 0:p.localKey)||void 0===a?void 0:a.length)>0&&p.otherKey&&(null===(s=null==p?void 0:p.otherKey)||void 0===s?void 0:s.length)>0?null===(l=n.state.keyExchange)||void 0===l||l.setRelayPersistence({localKey:p.localKey,otherKey:p.otherKey}):console.warn("Missing keys in relay persistence",p)),n.state.manualDisconnect=!1,null===(u=n.state.socket)||void 0===u||u.connect(),n.state.withKeyExchange=f,n.state.isOriginator=h,n.state.channelId=d,hR(n,d),null===(c=n.state.socket)||void 0===c||c.emit(e.EventType.JOIN_CHANNEL,{channelId:d,context:`${n.state.context}_connectToChannel`,clientType:h?"dapp":"wallet"},(t,r)=>{"error_terminated"===t?n.emit(e.EventType.TERMINATE):"object"==typeof r&&r.persistence&&n.emit(e.EventType.CHANNEL_PERSISTENCE)})}({options:{channelId:t,withKeyExchange:n},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var t;null===(t=this.state.socket)||void 0===t||t.emit(e.EventType.MESSAGE,{id:this.state.channelId,context:this.state.context,message:{type:vd.KEY_HANDSHAKE_CHECK,pubkey:this.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(t){return function(t,n){var r,i,o,a,s;if(!t.state.channelId)throw Error("Create a channel first");fB.SocketService(`[SocketService: handleSendMessage()] context=${t.state.context} areKeysExchanged=${null===(r=t.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged()}`,n),(null===(i=null==n?void 0:n.type)||void 0===i?void 0:i.startsWith("key_handshake"))?(fB.SocketService(`[SocketService: handleKeyHandshake()] context=${t.state.context}`,n),null===(s=t.state.socket)||void 0===s||s.emit(e.EventType.MESSAGE,{id:t.state.channelId,context:t.state.context,clientType:t.state.isOriginator?"dapp":"wallet",message:n})):(function(e,t){var n;if(!(null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged())&&!e.remote.state.relayPersistence)throw fB.SocketService(`[SocketService: validateKeyExchange()] context=${e.state.context} ERROR keys not exchanged`,t),console.error("[SocketService: validateKeyExchange()] ERROR keys not exchanged",t),Error("Keys not exchanged BBB")}(t,n),function(t,n){var r;let i=null!==(r=null==n?void 0:n.method)&&void 0!==r?r:"",o=null==n?void 0:n.id;t.state.isOriginator&&o&&(t.state.rpcMethodTracker[o]={id:o,timestamp:Date.now(),method:i},t.emit(e.EventType.RPC_UPDATE,t.state.rpcMethodTracker[o]))}(t,n),function(t,n){var r,i;let o=null===(r=t.state.keyExchange)||void 0===r?void 0:r.encryptMessage(JSON.stringify(n)),a={id:t.state.channelId,context:t.state.context,clientType:t.state.isOriginator?"dapp":"wallet",message:o,plaintext:t.state.hasPlaintext?JSON.stringify(n):void 0};fB.SocketService(`[SocketService: encryptAndSendMessage()] context=${t.state.context}`,a),n.type===e.MessageType.TERMINATE&&(t.state.manualDisconnect=!0),null===(i=t.state.socket)||void 0===i||i.emit(e.EventType.MESSAGE,a)}(t,n),t.remote.state.analytics&&t.remote.state.isOriginator&&n.method&&hM.includes(n.method.toLowerCase())&&fU({id:null!==(o=t.remote.state.channelId)&&void 0!==o?o:"",event:vf.SDK_RPC_REQUEST,sdkVersion:t.remote.state.sdkVersion,commLayerVersion:hv,walletVersion:null===(a=t.remote.state.walletInfo)||void 0===a?void 0:a.version,params:{method:n.method,from:"mobile"}},t.remote.state.communicationServerUrl).catch(e=>{console.error("Cannot send analytics",e)}),(function(t,n){var r;return fh(this,void 0,void 0,function*(){let i=null==n?void 0:n.id,o=null!==(r=null==n?void 0:n.method)&&void 0!==r?r:"";if(t.state.isOriginator&&i)try{let r=hS(i,t.state.rpcMethodTracker,200).then(e=>({type:vh.RPC_CHECK,result:e})),a=fh(this,void 0,void 0,function*(){let e=yield(({rpcId:e,instance:t})=>fh(void 0,void 0,void 0,function*(){for(;t.state.lastRpcId===e||void 0===t.state.lastRpcId;)yield hE(200);return t.state.lastRpcId}))({instance:t,rpcId:i}),n=yield hS(e,t.state.rpcMethodTracker,200);return{type:vh.SKIPPED_RPC,result:n}}),s=yield Promise.race([r,a]);if(s.type===vh.RPC_CHECK){let e=s.result;fB.SocketService(`[SocketService:handleRpcReplies()] id=${n.id} ${o} ( ${e.elapsedTime} ms)`,e.result)}else{if(s.type!==vh.SKIPPED_RPC)throw Error(`Error handling RPC replies for ${i}`);{let{result:n}=s;console.warn(`[SocketService handleRpcReplies()] RPC METHOD HAS BEEN SKIPPED rpcid=${i} method=${o}`,n);let r=Object.assign(Object.assign({},t.state.rpcMethodTracker[i]),{error:Error("SDK_CONNECTION_ISSUE")});t.emit(e.EventType.RPC_UPDATE,r);let a={data:Object.assign(Object.assign({},r),{jsonrpc:"2.0"}),name:"metamask-provider"};t.emit(e.EventType.MESSAGE,{message:a})}}}catch(e){throw console.warn(`[SocketService handleRpcReplies()] Error rpcId=${n.id} ${o}`,e),e}})})(t,n).catch(e=>{console.warn("Error handleRpcReplies",e)}))}(this,t)}ping(){var t,n,r,i,o;return fB.SocketService(`[SocketService: ping()] context=${this.state.context} originator=${this.state.isOriginator} keysExchanged=${null===(t=this.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged()}`),this.state.isOriginator&&((null===(n=this.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged())?(console.warn(`[SocketService:ping()] context=${this.state.context} sending READY message`),this.sendMessage({type:e.MessageType.READY})):(console.warn(`[SocketService: ping()] context=${this.state.context} starting key exchange`),null===(r=this.state.keyExchange)||void 0===r||r.start({isOriginator:null!==(i=this.state.isOriginator)&&void 0!==i&&i}))),void(null===(o=this.state.socket)||void 0===o||o.emit(e.EventType.MESSAGE,{id:this.state.channelId,context:this.state.context,clientType:this.remote.state.isOriginator?"dapp":"wallet",message:{type:e.MessageType.PING}}))}pause(){var t,n;return fB.SocketService(`[SocketService: pause()] context=${this.state.context}`),this.state.manualDisconnect=!0,(null===(t=this.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged())&&this.sendMessage({type:e.MessageType.PAUSE}),void(null===(n=this.state.socket)||void 0===n||n.disconnect())}isConnected(){var e;return null===(e=this.state.socket)||void 0===e?void 0:e.connected}resume(){var t,n,r,i,o,a,s,l,u;return fB.SocketService(`[SocketService: resume()] context=${this.state.context} connected=${null===(t=this.state.socket)||void 0===t?void 0:t.connected} manualDisconnect=${this.state.manualDisconnect} resumed=${this.state.resumed} keysExchanged=${null===(n=this.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()}`),(null===(r=this.state.socket)||void 0===r?void 0:r.connected)?fB.SocketService("[SocketService: resume()] already connected."):(null===(i=this.state.socket)||void 0===i||i.connect(),fB.SocketService(`[SocketService: resume()] after connecting socket --> connected=${null===(o=this.state.socket)||void 0===o?void 0:o.connected}`),null===(a=this.state.socket)||void 0===a||a.emit(e.EventType.JOIN_CHANNEL,{channelId:this.state.channelId,context:`${this.state.context}_resume`,clientType:this.remote.state.isOriginator?"dapp":"wallet"})),(null===(s=this.state.keyExchange)||void 0===s?void 0:s.areKeysExchanged())?this.state.isOriginator||this.sendMessage({type:e.MessageType.READY}):this.state.isOriginator||null===(l=this.state.keyExchange)||void 0===l||l.start({isOriginator:null!==(u=this.state.isOriginator)&&void 0!==u&&u}),this.state.manualDisconnect=!1,void(this.state.resumed=!0)}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){var t,n;fB.SocketService(`[SocketService: disconnect()] context=${this.state.context}`,e),(null==e?void 0:e.terminate)&&(this.state.channelId=e.channelId,null===(t=this.state.keyExchange)||void 0===t||t.clean(),this.state.rpcMethodTracker={}),this.state.manualDisconnect=!0,null===(n=this.state.socket)||void 0===n||n.disconnect()}}function hT({options:t,instance:n}){var r,i,o,a,s,l;let{state:u}=n;fB.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${u.channelId}`,t),u.ready=!1,u.paused=!1,(null==t?void 0:t.terminate)?(null===(r=u.storageManager)||void 0===r||r.terminate(null!==(i=u.channelId)&&void 0!==i?i:""),n.state.terminated=!0,t.sendMessage&&(null===(o=u.communicationLayer)||void 0===o?void 0:o.getKeyInfo().keysExchanged)&&(null===(a=u.communicationLayer)||void 0===a||a.sendMessage({type:e.MessageType.TERMINATE})),u.relayPersistence=!1,u.channelId=dp(),t.channelId=u.channelId,u.channelConfig=void 0,u.originatorConnectStarted=!1,null===(s=u.communicationLayer)||void 0===s||s.disconnect(t),n.setConnectionStatus(e.ConnectionStatus.TERMINATED)):(null===(l=u.communicationLayer)||void 0===l||l.disconnect(t),n.setConnectionStatus(e.ConnectionStatus.DISCONNECTED))}e.CommunicationLayerPreference=void 0,e.PlatformType=void 0,(e.CommunicationLayerPreference||(e.CommunicationLayerPreference={})).SOCKET="socket",(vl=e.PlatformType||(e.PlatformType={})).NonBrowser="nodejs",vl.MetaMaskMobileWebview="in-app-browser",vl.DesktopWeb="web-desktop",vl.MobileWeb="web-mobile",vl.ReactNative="react-native";class hO extends dl.EventEmitter2{constructor({platformType:t,communicationLayerPreference:n,otherPublicKey:r,reconnect:i,walletInfo:o,dappMetadata:a,protocolVersion:s,transports:l,context:u,relayPersistence:c,ecies:d,analytics:f=!1,storage:h,sdkVersion:p,communicationServerUrl:m=hb,logging:g,autoConnect:v={timeout:3e3}}){super(),this.state={ready:!1,authorized:!1,isOriginator:!1,terminated:!1,protocolVersion:1,paused:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:hb,context:"",persist:!1,clientsConnected:!1,sessionDuration:6048e5,originatorConnectStarted:!1,debug:!1,_connectionStatus:e.ConnectionStatus.DISCONNECTED},this.state.otherPublicKey=r,this.state.dappMetadata=a,this.state.walletInfo=o,this.state.transports=l,this.state.platformType=t,this.state.analytics=f,this.state.protocolVersion=null!=s?s:1,this.state.isOriginator=!r,this.state.relayPersistence=c,this.state.communicationServerUrl=m,this.state.context=u,this.state.terminated=!1,this.state.sdkVersion=p,this.setMaxListeners(50),this.setConnectionStatus(e.ConnectionStatus.DISCONNECTED),(null==h?void 0:h.duration)&&(this.state.sessionDuration=6048e5),this.state.storageOptions=h,this.state.autoConnectOptions=v,this.state.debug=!0===(null==g?void 0:g.remoteLayer),!0===(null==g?void 0:g.remoteLayer)&&fO.enable("RemoteCommunication:Layer"),!0===(null==g?void 0:g.serviceLayer)&&fO.enable("SocketService:Layer"),!0===(null==g?void 0:g.eciesLayer)&&fO.enable("ECIES:Layer"),!0===(null==g?void 0:g.keyExchangeLayer)&&fO.enable("KeyExchange:Layer"),this.state.logging=g,(null==h?void 0:h.storageManager)&&(this.state.storageManager=h.storageManager),fB.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${s} relayPersistence=${c} isOriginator=${this.state.isOriginator} communicationLayerPreference=${n} otherPublicKey=${r} reconnect=${i}`),this.initCommunicationLayer({communicationLayerPreference:n,otherPublicKey:r,reconnect:i,ecies:d,communicationServerUrl:m}),this.emitServiceStatusEvent({context:"constructor"})}initCommunicationLayer({communicationLayerPreference:t,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o=hb}){return function({communicationLayerPreference:t,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o=hb,instance:a}){var s,l,u,c,d,f,h,p,m;let{state:g}=a;if(fB.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(g,null,2)),t!==e.CommunicationLayerPreference.SOCKET)throw Error("Invalid communication protocol");g.communicationLayer=new hI({communicationLayerPreference:t,otherPublicKey:n,reconnect:r,transports:g.transports,communicationServerUrl:o,context:g.context,ecies:i,logging:g.logging,remote:a});let v="undefined"!=typeof document&&document.URL||"",b="undefined"!=typeof document&&document.title||"";(null===(s=g.dappMetadata)||void 0===s?void 0:s.url)&&(v=g.dappMetadata.url),(null===(l=g.dappMetadata)||void 0===l?void 0:l.name)&&(b=g.dappMetadata.name);let y="undefined"!=typeof window&&void 0!==window.location?window.location.hostname:null!==(f=null!==(c=null===(u=g.dappMetadata)||void 0===u?void 0:u.name)&&void 0!==c?c:null===(d=g.dappMetadata)||void 0===d?void 0:d.url)&&void 0!==f?f:"unkown",A={url:v,title:b,source:null===(h=g.dappMetadata)||void 0===h?void 0:h.source,dappId:y,icon:(null===(p=g.dappMetadata)||void 0===p?void 0:p.iconUrl)||(null===(m=g.dappMetadata)||void 0===m?void 0:m.base64Icon),platform:g.platformType,apiVersion:hv};for(let[n,r]of(g.originatorInfo=A,Object.entries({[e.EventType.AUTHORIZED]:function(t){return()=>fh(this,void 0,void 0,function*(){var n,r,i;let{state:o}=t;if(o.authorized)return;yield fh(this,void 0,void 0,function*(){for(;!o.walletInfo;)yield hE(500)});let a="7.3".localeCompare((null===(n=o.walletInfo)||void 0===n?void 0:n.version)||"");if(fB.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${null===(r=o.walletInfo)||void 0===r?void 0:r.version} compareValue=${a}`),1!==a)return;let s=o.platformType===e.PlatformType.MobileWeb||o.platformType===e.PlatformType.ReactNative||o.platformType===e.PlatformType.MetaMaskMobileWebview;fB.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${o.platformType} secure=${s} channel=${o.channelId} walletVersion=${null===(i=o.walletInfo)||void 0===i?void 0:i.version}`),s&&(o.authorized=!0,t.emit(e.EventType.AUTHORIZED))})}(a),[e.EventType.MESSAGE]:t=>{let n=t;t.message&&(n=n.message),function(t,n){let{state:r}=n;if(fB.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${r.context} on 'message' typeof=${typeof t}`,t),n.state.ready=!0,r.isOriginator||t.type!==e.MessageType.ORIGINATOR_INFO){if(r.isOriginator&&t.type===e.MessageType.WALLET_INFO)!function(e,t){let{state:n}=e;n.walletInfo=t.walletInfo,n.paused=!1}(n,t);else{if(t.type===e.MessageType.TERMINATE)!function(t){let{state:n}=t;n.isOriginator&&(hT({options:{terminate:!0,sendMessage:!1},instance:t}),console.debug(),t.emit(e.EventType.TERMINATE))}(n);else if(t.type===e.MessageType.PAUSE)!function(t){let{state:n}=t;n.paused=!0,t.setConnectionStatus(e.ConnectionStatus.PAUSED)}(n);else if(t.type===e.MessageType.READY&&r.isOriginator)!function(t){let{state:n}=t;t.setConnectionStatus(e.ConnectionStatus.LINKED);let r=n.paused;n.paused=!1,t.emit(e.EventType.CLIENTS_READY,{isOriginator:n.isOriginator,walletInfo:n.walletInfo}),r&&(n.authorized=!0,t.emit(e.EventType.AUTHORIZED))}(n);else{if(t.type===e.MessageType.OTP&&r.isOriginator)return void function(t,n){var r;let{state:i}=t;t.emit(e.EventType.OTP,n.otpAnswer),1==="6.6".localeCompare((null===(r=i.walletInfo)||void 0===r?void 0:r.version)||"")&&(console.warn("RemoteCommunication::on 'otp' -- backward compatibility <6.6 -- triger eth_requestAccounts"),t.emit(e.EventType.SDK_RPC_CALL,{method:hA.ETH_REQUESTACCOUNTS,params:[]}))}(n,t);t.type===e.MessageType.AUTHORIZED&&r.isOriginator&&function(t){let{state:n}=t;n.authorized=!0,t.emit(e.EventType.AUTHORIZED)}(n)}n.emit(e.EventType.MESSAGE,t)}}else!function(t,n){var r;let{state:i}=t;null===(r=i.communicationLayer)||void 0===r||r.sendMessage({type:e.MessageType.WALLET_INFO,walletInfo:i.walletInfo}),i.originatorInfo=n.originatorInfo||n.originator,t.emit(e.EventType.CLIENTS_READY,{isOriginator:i.isOriginator,originatorInfo:i.originatorInfo}),i.paused=!1}(n,t)}(n,a)},[e.EventType.CHANNEL_PERSISTENCE]:function(t){return()=>fh(this,void 0,void 0,function*(){var n,r,i,o,a,s,l;let{state:u}=t;fB.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${u.context}`),t.state.ready=!0,t.state.clientsConnected=!0,t.state.authorized=!0,t.state.relayPersistence=!0,null===(n=t.state.communicationLayer)||void 0===n||n.getKeyExchange().setKeysExchanged(!0),t.emit(e.EventType.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),t.emit(e.EventType.AUTHORIZED),t.emit(e.EventType.CLIENTS_READY),t.emit(e.EventType.CHANNEL_PERSISTENCE);try{u.channelConfig=Object.assign(Object.assign({},u.channelConfig),{localKey:null===(r=u.communicationLayer)||void 0===r?void 0:r.getKeyExchange().getKeyInfo().ecies.private,otherKey:null===(i=u.communicationLayer)||void 0===i?void 0:i.getKeyExchange().getOtherPublicKey(),channelId:null!==(o=u.channelId)&&void 0!==o?o:"",validUntil:null!==(s=null===(a=u.channelConfig)||void 0===a?void 0:a.validUntil)&&void 0!==s?s:6048e5,relayPersistence:!0}),yield null===(l=u.storageManager)||void 0===l?void 0:l.persistChannelConfig(u.channelConfig)}catch(e){console.error("Error persisting channel config",e)}})}(a),[e.EventType.CLIENTS_CONNECTED]:()=>{var n,r,i,o;let{state:s}=a;if(fB.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${s.channelId} keysExchanged=${null===(r=null===(n=s.communicationLayer)||void 0===n?void 0:n.getKeyInfo())||void 0===r?void 0:r.keysExchanged}`),s.analytics){let e=s.isOriginator?vf.REQUEST:vf.REQUEST_MOBILE;fU(Object.assign(Object.assign({id:null!==(i=s.channelId)&&void 0!==i?i:"",event:s.reconnection?vf.RECONNECT:e},s.originatorInfo),{commLayer:t,sdkVersion:s.sdkVersion,walletVersion:null===(o=s.walletInfo)||void 0===o?void 0:o.version,commLayerVersion:hv}),s.communicationServerUrl).catch(e=>{console.error("Cannot send analytics",e)})}s.clientsConnected=!0,s.originatorInfoSent=!1,a.emit(e.EventType.CLIENTS_CONNECTED)},[e.EventType.KEYS_EXCHANGED]:n=>{var r,i,o,s,l,u,c,d;let{state:f}=a;if(fB.RemoteCommunication(`[RemoteCommunication: handleKeysExchangedEvent()] context=${f.context} on commLayer.'keys_exchanged' channel=${f.channelId}`,n),null===(i=null===(r=f.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.keysExchanged){let t=Object.assign(Object.assign({},f.channelConfig),{channelId:null!==(o=f.channelId)&&void 0!==o?o:"",validUntil:(null===(s=f.channelConfig)||void 0===s?void 0:s.validUntil)||6048e5,localKey:f.communicationLayer.getKeyInfo().ecies.private,otherKey:f.communicationLayer.getKeyInfo().ecies.otherPubKey});null===(l=f.storageManager)||void 0===l||l.persistChannelConfig(t).catch(e=>{console.error("Error persisting channel config",e)}),a.setConnectionStatus(e.ConnectionStatus.LINKED)}(function(e,t){var n,r,i,o,a,s,l,u;let{state:c}=e;fB.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${c.channelId}`,t);let d=Object.assign(Object.assign({},c.channelConfig),{channelId:null!==(n=c.channelId)&&void 0!==n?n:"",validUntil:null!==(i=null===(r=c.channelConfig)||void 0===r?void 0:r.validUntil)&&void 0!==i?i:0,relayPersistence:c.relayPersistence,localKey:null===(a=null===(o=c.communicationLayer)||void 0===o?void 0:o.state.keyExchange)||void 0===a?void 0:a.getKeyInfo().ecies.private,otherKey:null===(l=null===(s=c.communicationLayer)||void 0===s?void 0:s.state.keyExchange)||void 0===l?void 0:l.getKeyInfo().ecies.otherPubKey,lastActive:t.getTime()});null===(u=c.storageManager)||void 0===u||u.persistChannelConfig(d)})(a,new Date),f.analytics&&f.channelId&&fU({id:f.channelId,event:n.isOriginator?vf.CONNECTED:vf.CONNECTED_MOBILE,sdkVersion:f.sdkVersion,commLayer:t,commLayerVersion:hv,walletVersion:null===(u=f.walletInfo)||void 0===u?void 0:u.version},f.communicationServerUrl).catch(e=>{console.error("Cannot send analytics",e)}),f.isOriginator=n.isOriginator,n.isOriginator||(null===(c=f.communicationLayer)||void 0===c||c.sendMessage({type:e.MessageType.READY}),f.ready=!0,f.paused=!1),n.isOriginator&&!f.originatorInfoSent&&(null===(d=f.communicationLayer)||void 0===d||d.sendMessage({type:e.MessageType.ORIGINATOR_INFO,originatorInfo:f.originatorInfo,originator:f.originatorInfo}),f.originatorInfoSent=!0)},[e.EventType.SOCKET_DISCONNECTED]:()=>{let{state:e}=a;fB.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),e.ready=!1},[e.EventType.SOCKET_RECONNECT]:()=>{let{state:e}=a;fB.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to false"),e.ready=!1,e.authorized=!1,hw(e),a.emitServiceStatusEvent({context:"socket_reconnect"})},[e.EventType.CLIENTS_DISCONNECTED]:n=>{var r;let{state:i}=a;fB.RemoteCommunication(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${i.context} on 'clients_disconnected' channelId=${n}`),i.relayPersistence||(i.clientsConnected=!1,i.ready=!1,i.authorized=!1),a.emit(e.EventType.CLIENTS_DISCONNECTED,i.channelId),a.setConnectionStatus(e.ConnectionStatus.DISCONNECTED),i.analytics&&i.channelId&&fU({id:i.channelId,event:vf.DISCONNECTED,sdkVersion:i.sdkVersion,commLayer:t,commLayerVersion:hv,walletVersion:null===(r=i.walletInfo)||void 0===r?void 0:r.version},i.communicationServerUrl).catch(e=>{console.error("Cannot send analytics",e)})},[e.EventType.KEY_INFO]:()=>{},[e.EventType.CHANNEL_CREATED]:t=>{let{state:n}=a;fB.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${n.context} on 'channel_created' channelId=${t}`),a.emit(e.EventType.CHANNEL_CREATED,t)},[e.EventType.CLIENTS_WAITING]:t=>{var n;let{state:r}=a;if(fB.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${r.context} on 'clients_waiting' numberUsers=${t} ready=${r.ready} autoStarted=${r.originatorConnectStarted}`),a.setConnectionStatus(e.ConnectionStatus.WAITING),a.emit(e.EventType.CLIENTS_WAITING,t),r.originatorConnectStarted){fB.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_waiting' watch autoStarted=${r.originatorConnectStarted} timeout`,r.autoConnectOptions);let t=(null===(n=r.autoConnectOptions)||void 0===n?void 0:n.timeout)||3e3,i=setTimeout(()=>{fB.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${t}) terminate channelConfig`,r.autoConnectOptions),r.originatorConnectStarted=!1,r.ready||a.setConnectionStatus(e.ConnectionStatus.TIMEOUT),clearTimeout(i)},t)}},[e.EventType.RPC_UPDATE]:t=>{a.emit(e.EventType.RPC_UPDATE,t)}})))try{g.communicationLayer.on(n,r)}catch(e){console.error(`Error registering handler for ${n}:`,e)}}({communicationLayerPreference:t,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o,instance:this})}originatorSessionConnect(){return fh(this,void 0,void 0,function*(){return yield function(e){var t;return fh(this,void 0,void 0,function*(){let{state:n}=e;if(!n.storageManager)return void fB.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");let r=yield n.storageManager.getPersistedChannelConfig();if(fB.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${n.originatorConnectStarted} channelConfig`,r),null===(t=n.communicationLayer)||void 0===t?void 0:t.isConnected())return fB.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] socket already connected - skip"),r;if(r){if(r.validUntil>Date.now())return n.channelConfig=r,n.originatorConnectStarted=!0,n.channelId=null==r?void 0:r.channelId,n.reconnection=!0,r;fB.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}n.originatorConnectStarted=!1})}(this)})}generateChannelIdConnect(){return fh(this,void 0,void 0,function*(){return function(e){var t,n,r,i;if(!e.communicationLayer)throw Error("communication layer not initialized");if(e.ready)throw Error("Channel already connected");if(e.channelId&&(null===(t=e.communicationLayer)||void 0===t?void 0:t.isConnected()))return console.warn("Channel already exists -- interrupt generateChannelId",e.channelConfig),e.channelConfig=Object.assign(Object.assign({},e.channelConfig),{channelId:e.channelId,validUntil:Date.now()+e.sessionDuration}),null===(n=e.storageManager)||void 0===n||n.persistChannelConfig(e.channelConfig),{channelId:e.channelId,pubKey:null===(i=null===(r=e.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.ecies.public};fB.RemoteCommunication("[RemoteCommunication: generateChannelId()]");let o=e.communicationLayer.createChannel();fB.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",o);let a=Object.assign(Object.assign({},e.channelConfig),{channelId:o.channelId,validUntil:Date.now()+e.sessionDuration});return e.channelId=o.channelId,e.channelConfig=a,{channelId:e.channelId,pubKey:o.pubKey}}(this.state)})}clean(){return hw(this.state)}connectToChannel({channelId:e,withKeyExchange:t}){return function({channelId:e,withKeyExchange:t,state:n}){var r,i,o;if(!dd(e))throw fB.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${n.context} invalid channel channelId=${e}`),Error(`Invalid channel ${e}`);if(fB.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${n.context} channelId=${e} withKeyExchange=${t}`),null===(r=n.communicationLayer)||void 0===r?void 0:r.isConnected())return void fB.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${n.context} already connected - interrupt connection.`);n.channelId=e,null===(i=n.communicationLayer)||void 0===i||i.connectToChannel({channelId:e,withKeyExchange:t});let a=Object.assign(Object.assign({},n.channelConfig),{channelId:e,validUntil:Date.now()+n.sessionDuration});n.channelConfig=a,null===(o=n.storageManager)||void 0===o||o.persistChannelConfig(a)}({channelId:e,withKeyExchange:t,state:this.state})}sendMessage(t){return function(t,n){var r,i;return fh(this,void 0,void 0,function*(){let{state:o}=t;fB.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${o.context} paused=${o.paused} ready=${o.ready} relayPersistence=${o.relayPersistence} authorized=${o.authorized} socket=${null===(r=o.communicationLayer)||void 0===r?void 0:r.isConnected()} clientsConnected=${o.clientsConnected} status=${o._connectionStatus}`,n),o.relayPersistence||o.ready&&(null===(i=o.communicationLayer)||void 0===i?void 0:i.isConnected())&&o.clientsConnected||(fB.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${o.context} SKIP message waiting for MM mobile readiness.`),yield new Promise(n=>{t.once(e.EventType.CLIENTS_READY,n)}),fB.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${o.context} AFTER SKIP / READY -- sending pending message`));try{yield function(t,n){return fh(this,void 0,void 0,function*(){return new Promise(r=>{var i,o,a,s;let{state:l}=t;if(fB.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${l.context} ready=${l.ready} authorized=${l.authorized} method=${n.method}`),1==="7.3".localeCompare((null===(i=l.walletInfo)||void 0===i?void 0:i.version)||""))return fB.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] compatibility hack wallet version > ${null===(o=l.walletInfo)||void 0===o?void 0:o.version}`),null===(a=l.communicationLayer)||void 0===a||a.sendMessage(n),void r();!l.isOriginator||l.authorized||l.relayPersistence?(null===(s=l.communicationLayer)||void 0===s||s.sendMessage(n),r()):t.once(e.EventType.AUTHORIZED,()=>{var e;fB.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${l.context} AFTER SKIP / AUTHORIZED -- sending pending message`),null===(e=l.communicationLayer)||void 0===e||e.sendMessage(n),r()})})})}(t,n)}catch(e){throw console.error(`[RemoteCommunication: sendMessage()] context=${o.context} ERROR`,e),e}})}(this,t)}testStorage(){return fh(this,void 0,void 0,function*(){return function(e){var t;return fh(this,void 0,void 0,function*(){let n=yield null===(t=e.storageManager)||void 0===t?void 0:t.getPersistedChannelConfig();fB.RemoteCommunication("[RemoteCommunication: testStorage()] res",n)})}(this.state)})}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){var e;fB.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.ping()}testLogger(){fB.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),fB.SocketService(`testLogger() channel=${this.state.channelId}`),fB.Ecies(`testLogger() channel=${this.state.channelId}`),fB.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;fB.RemoteCommunication(`[RemoteCommunication: keyCheck()] channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.keyCheck()}setConnectionStatus(t){this.state._connectionStatus!==t&&(this.state._connectionStatus=t,this.emit(e.EventType.CONNECTION_STATUS,t),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(t={}){this.emit(e.EventType.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getKeyInfo()}resetKeys(){var e;null===(e=this.state.communicationLayer)||void 0===e||e.resetKeys()}setOtherPublicKey(e){var t;let n=null===(t=this.state.communicationLayer)||void 0===t?void 0:t.getKeyExchange();if(!n)throw Error("KeyExchange is not initialized.");n.getOtherPublicKey()!==e&&n.setOtherPublicKey(e)}pause(){var t;fB.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),null===(t=this.state.communicationLayer)||void 0===t||t.pause(),this.setConnectionStatus(e.ConnectionStatus.PAUSED)}getVersion(){return hv}hasRelayPersistence(){var e;return null!==(e=this.state.relayPersistence)&&void 0!==e&&e}resume(){return function(t){var n;let{state:r}=t;fB.RemoteCommunication(`[RemoteCommunication: resume()] channel=${r.channelId}`),null===(n=r.communicationLayer)||void 0===n||n.resume(),t.setConnectionStatus(e.ConnectionStatus.LINKED)}(this)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getRPCMethodTracker()}disconnect(e){return hT({options:e,instance:this})}}function hP(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})}function hL(e,t,n,r){if("a"===n&&!r)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function hN(e,t,n,r,i){if("m"===r)throw TypeError("Private method is not writable");if("a"===r&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}(vu=vp||(vp={})).RENEW="renew",vu.LINK="link","function"==typeof SuppressedError&&SuppressedError;var hD={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:e=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`MetaMask: Connected to chain with ID "${e}".`},warnings:{chainIdDeprecation:"MetaMask: 'ethereum.chainId' is deprecated and may be removed in the future. Please use the 'eth_chainId' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",networkVersionDeprecation:"MetaMask: 'ethereum.networkVersion' is deprecated and may be removed in the future. Please use the 'net_version' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",selectedAddressDeprecation:"MetaMask: 'ethereum.selectedAddress' is deprecated and may be removed in the future. Please use the 'eth_accounts' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",enableDeprecation:"MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1102",sendDeprecation:"MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193",events:{close:"MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect",data:"MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message",networkChanged:"MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged",notification:"MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message"},rpc:{ethDecryptDeprecation:"MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",ethGetEncryptionPublicKeyDeprecation:"MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",walletWatchAssetNFTExperimental:"MetaMask: The RPC method 'wallet_watchAsset' is experimental for ERC721/ERC1155 assets and may change in the future.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-1.md and https://github.com/MetaMask/metamask-improvement-proposals/blob/main/PROCESS-GUIDE.md#proposal-lifecycle"},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}},hB={},hj={},hF=l&&l.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})};Object.defineProperty(hj,"__esModule",{value:!0}),hj.createAsyncMiddleware=void 0,hj.createAsyncMiddleware=function(e){return(t,n,r,i)=>hF(this,void 0,void 0,function*(){let o;let a=new Promise(e=>{o=e}),s=null,l=!1;try{yield e(t,n,()=>hF(this,void 0,void 0,function*(){return l=!0,r(e=>{s=e,o()}),a})),l?(yield a,s(null)):i(null)}catch(e){s?s(e):i(e)}})};var hz={};Object.defineProperty(hz,"__esModule",{value:!0}),hz.createScaffoldMiddleware=void 0,hz.createScaffoldMiddleware=function(e){return(t,n,r,i)=>{let o=e[t.method];return void 0===o?r():"function"==typeof o?o(t,n,r,i):(n.result=o,i())}};var hU={};Object.defineProperty(hU,"__esModule",{value:!0}),hU.getUniqueId=void 0;let hq=Math.floor(4294967295*Math.random());hU.getUniqueId=function(){return hq=(hq+1)%4294967295};var hK={};Object.defineProperty(hK,"__esModule",{value:!0}),hK.createIdRemapMiddleware=void 0,hK.createIdRemapMiddleware=function(){return(e,t,n,r)=>{let i=e.id,o=(0,hU.getUniqueId)();e.id=o,t.id=o,n(n=>{e.id=i,t.id=i,n()})}};var hH={},hV={},h$={},hW={},hY={},hG={};Object.defineProperty(hG,"__esModule",{value:!0}),hG.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},hG.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};var hQ={},hZ={},hJ={},hX={},h0={},h1={};Object.defineProperty(h1,"__esModule",{value:!0});var h2=((o=h2||{})[o.Null=4]="Null",o[o.Comma=1]="Comma",o[o.Wrapper=1]="Wrapper",o[o.True=4]="True",o[o.False=5]="False",o[o.Quote=1]="Quote",o[o.Colon=1]="Colon",o[o.Date=24]="Date",o),h3=/"|\\|\n|\r|\t/gu;function h6(e){return 127>=e.charCodeAt(0)}h1.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},h1.isNullOrUndefined=function(e){return null==e},h1.isObject=function(e){return!!e&&"object"==typeof e&&!Array.isArray(e)},h1.hasProperty=(e,t)=>Object.hasOwnProperty.call(e,t),h1.getKnownPropertyNames=function(e){return Object.getOwnPropertyNames(e)},h1.JsonSize=h2,h1.ESCAPE_CHARACTERS_REGEXP=h3,h1.isPlainObject=function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}},h1.isASCII=h6,h1.calculateStringSize=function(e){var t,n;return e.split("").reduce((e,t)=>h6(t)?e+1:e+2,0)+(t=e.match(h3),n=()=>[],null!=t?t:n()).length},h1.calculateNumberSize=function(e){return e.toString().length};var h4=c(Object.freeze({__proto__:null,ErrorWithCause:class e extends Error{constructor(t,{cause:n}={}){super(t),this.name=e.name,n&&(this.cause=n),this.message=t}}}));let h8=e=>{if(e&&"object"==typeof e&&"cause"in e){if("function"==typeof e.cause){let t=e.cause();return t instanceof Error?t:void 0}return e.cause instanceof Error?e.cause:void 0}},h5=(e,t)=>{if(!(e instanceof Error))return"";let n=e.stack||"";if(t.has(e))return n+"\ncauses have become circular...";let r=h8(e);return r?(t.add(e),n+"\ncaused by: "+h5(r,t)):n},h7=(e,t,n)=>{if(!(e instanceof Error))return"";let r=n?"":e.message||"";if(t.has(e))return r+": ...";let i=h8(e);if(i){t.add(e);let n="cause"in e&&"function"==typeof e.cause;return r+(n?"":": ")+h7(i,t,n)}return r};var h9=c(Object.freeze({__proto__:null,findCauseByReference:(e,t)=>{if(!e||!t||!(e instanceof Error)||!(t.prototype instanceof Error)&&t!==Error)return;let n=new Set,r=e;for(;r&&!n.has(r);){if(n.add(r),r instanceof t)return r;r=h8(r)}},getErrorCause:h8,messageWithCauses:e=>h7(e,new Set),stackWithCauses:e=>h5(e,new Set)}));let{ErrorWithCause:pe}=h4,{findCauseByReference:pt,getErrorCause:pn,messageWithCauses:pr,stackWithCauses:pi}=h9;Object.defineProperty(h0,"__esModule",{value:!0});var po={ErrorWithCause:pe};function pa(e){return"object"==typeof e&&null!==e&&"code"in e}function ps(e){return"object"==typeof e&&null!==e&&"message"in e}h0.isErrorWithCode=pa,h0.isErrorWithMessage=ps,h0.isErrorWithStack=function(e){return"object"==typeof e&&null!==e&&"stack"in e},h0.getErrorMessage=function(e){return ps(e)&&"string"==typeof e.message?e.message:h1.isNullOrUndefined.call(void 0,e)?"":String(e)},h0.wrapError=function(e,t){if(e instanceof Error||h1.isObject.call(void 0,e)&&"Error"===e.constructor.name){let n;return n=2===Error.length?Error(t,{cause:e}):new po.ErrorWithCause(t,{cause:e}),pa(e)&&(n.code=e.code),n}return t.length>0?Error(`${String(e)}: ${t}`):Error(String(e))};class pl extends TypeError{constructor(e,t){let n;let{message:r,explanation:i,...o}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(i??s),null!=i&&(this.cause=s),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function pu(e){return"object"==typeof e&&null!=e}function pc(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function pd(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function*pf(e,t,n,r){var i;for(let o of(pu(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]),e)){let e=function(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});let{path:i,branch:o}=t,{type:a}=n,{refinement:s,message:l=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${pd(r)}\``}=e;return{value:r,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...e,message:l}}(o,t,n,r);e&&(yield e)}}function*ph(e,t,n={}){let{path:r=[],branch:i=[e],coerce:o=!1,mask:a=!1}=n,s={path:r,branch:i};if(o&&(e=t.coercer(e,s),a&&"type"!==t.type&&pu(t.schema)&&pu(e)&&!Array.isArray(e)))for(let n in e)void 0===t.schema[n]&&delete e[n];let l="valid";for(let r of t.validator(e,s))r.explanation=n.message,l="not_valid",yield[r,void 0];for(let[u,c,d]of t.entries(e,s))for(let t of ph(c,d,{path:void 0===u?r:[...r,u],branch:void 0===u?i:[...i,c],coerce:o,mask:a,message:n.message}))t[0]?(l=null!=t[0].refinement?"not_refined":"not_valid",yield[t[0],void 0]):o&&(c=t[1],void 0===u?e=c:e instanceof Map?e.set(u,c):e instanceof Set?e.add(c):pu(e)&&(void 0!==c||u in e)&&(e[u]=c));if("not_valid"!==l)for(let r of t.refiner(e,s))r.explanation=n.message,l="not_refined",yield[r,void 0];"valid"===l&&(yield[void 0,e])}class pp{constructor(e){let{type:t,schema:n,validator:r,refiner:i,coercer:o=e=>e,entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=o,this.validator=r?(e,t)=>pf(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>pf(i(e,t),t,this,e):()=>[]}assert(e,t){return pm(e,this,t)}create(e,t){return pg(e,this,t)}is(e){return pb(e,this)}mask(e,t){return pv(e,this,t)}validate(e,t={}){return py(e,this,t)}}function pm(e,t,n){let r=py(e,t,{message:n});if(r[0])throw r[0]}function pg(e,t,n){let r=py(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function pv(e,t,n){let r=py(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}function pb(e,t){return!py(e,t)[0]}function py(e,t,n={}){let r=ph(e,t,n),i=function(e){let{done:t,value:n}=e.next();return t?void 0:n}(r);return i[0]?[new pl(i[0],function*(){for(let e of r)e[0]&&(yield e[0])}),void 0]:[void 0,i[1]]}function pA(e,t){return new pp({type:e,schema:null,validator:t})}function pw(e){let t;return new pp({type:"lazy",schema:null,*entries(n,r){t??(t=e()),yield*t.entries(n,r)},validator:(n,r)=>(t??(t=e()),t.validator(n,r)),coercer:(n,r)=>(t??(t=e()),t.coercer(n,r)),refiner:(n,r)=>(t??(t=e()),t.refiner(n,r))})}function p_(){return pA("any",()=>!0)}function pE(e){return new pp({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(let[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${pd(e)}`})}function pS(){return pA("boolean",e=>"boolean"==typeof e)}function pk(){return pA("integer",e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${pd(e)}`)}function pM(e){let t=pd(e),n=typeof e;return new pp({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${pd(n)}`})}function pC(){return pA("never",()=>!1)}function px(e){return new pp({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function pR(){return pA("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${pd(e)}`)}function pI(e){let t=e?Object.keys(e):[],n=pC();return new pp({type:"object",schema:e||null,*entries(r){if(e&&pu(r)){let i=new Set(Object.keys(r));for(let n of t)i.delete(n),yield[n,r[n],e[n]];for(let e of i)yield[e,r[e],n]}},validator:e=>pu(e)||`Expected an object, but received: ${pd(e)}`,coercer:e=>pu(e)?{...e}:e})}function pT(e){return new pp({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function pO(e,t){return new pp({type:"record",schema:null,*entries(n){if(pu(n))for(let r in n){let i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>pu(e)||`Expected an object, but received: ${pd(e)}`})}function pP(){return pA("string",e=>"string"==typeof e||`Expected a string, but received: ${pd(e)}`)}function pL(e){let t=Object.keys(e);return new pp({type:"type",schema:e,*entries(n){if(pu(n))for(let r of t)yield[r,n[r],e[r]]},validator:e=>pu(e)||`Expected an object, but received: ${pd(e)}`,coercer:e=>pu(e)?{...e}:e})}function pN(e){let t=e.map(e=>e.type).join(" | ");return new pp({type:"union",schema:null,coercer(t){for(let n of e){let[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){let i=[];for(let t of e){let[...e]=ph(n,t,r),[o]=e;if(!o[0])return[];for(let[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${pd(n)}`,...i]}})}function pD(){return pA("unknown",()=>!0)}function pB(e,t,n){return new pp({...e,coercer:(r,i)=>pb(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)})}function pj(e){return e instanceof Map||e instanceof Set?e.size:e.length}function pF(e,t,n){return new pp({...e,*refiner(r,i){for(let o of(yield*e.refiner(r,i),pf(n(r,i),i,e,r)))yield{...o,refinement:t}}})}var pz=c(Object.freeze({__proto__:null,Struct:pp,StructError:pl,any:p_,array:pE,assert:pm,assign:function(...e){let t="type"===e[0].type,n=Object.assign({},...e.map(e=>e.schema));return t?pL(n):pI(n)},bigint:function(){return pA("bigint",e=>"bigint"==typeof e)},boolean:pS,coerce:pB,create:pg,date:function(){return pA("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${pd(e)}`)},defaulted:function(e,t,n={}){return pB(e,pD(),e=>{let r="function"==typeof t?t():t;if(void 0===e)return r;if(!n.strict&&pc(e)&&pc(r)){let t={...e},n=!1;for(let e in r)void 0===t[e]&&(t[e]=r[e],n=!0);if(n)return t}return e})},define:pA,deprecated:function(e,t){return new pp({...e,refiner:(t,n)=>void 0===t||e.refiner(t,n),validator:(n,r)=>void 0===n||(t(n,r),e.validator(n,r))})},dynamic:function(e){return new pp({type:"dynamic",schema:null,*entries(t,n){let r=e(t,n);yield*r.entries(t,n)},validator:(t,n)=>e(t,n).validator(t,n),coercer:(t,n)=>e(t,n).coercer(t,n),refiner:(t,n)=>e(t,n).refiner(t,n)})},empty:function(e){return pF(e,"empty",t=>{let n=pj(t);return 0===n||`Expected an empty ${e.type} but received one with a size of \`${n}\``})},enums:function(e){let t={},n=e.map(e=>pd(e)).join();for(let n of e)t[n]=n;return new pp({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${n}\`, but received: ${pd(t)}`})},func:function(){return pA("func",e=>"function"==typeof e||`Expected a function, but received: ${pd(e)}`)},instance:function(e){return pA("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${pd(t)}`)},integer:pk,intersection:function(e){return new pp({type:"intersection",schema:null,*entries(t,n){for(let r of e)yield*r.entries(t,n)},*validator(t,n){for(let r of e)yield*r.validator(t,n)},*refiner(t,n){for(let r of e)yield*r.refiner(t,n)}})},is:pb,lazy:pw,literal:pM,map:function(e,t){return new pp({type:"map",schema:null,*entries(n){if(e&&t&&n instanceof Map)for(let[r,i]of n.entries())yield[r,r,e],yield[r,i,t]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||`Expected a \`Map\` object, but received: ${pd(e)}`})},mask:pv,max:function(e,t,n={}){let{exclusive:r}=n;return pF(e,"max",n=>r?nr?n>t:n>=t||`Expected a ${e.type} greater than ${r?"":"or equal to "}${t} but received \`${n}\``)},never:pC,nonempty:function(e){return pF(e,"nonempty",t=>pj(t)>0||`Expected a nonempty ${e.type} but received an empty one`)},nullable:px,number:pR,object:pI,omit:function(e,t){let{schema:n}=e,r={...n};for(let e of t)delete r[e];return"type"===e.type?pL(r):pI(r)},optional:pT,partial:function(e){let t=e instanceof pp?{...e.schema}:{...e};for(let e in t)t[e]=pT(t[e]);return pI(t)},pattern:function(e,t){return pF(e,"pattern",n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`)},pick:function(e,t){let{schema:n}=e,r={};for(let e of t)r[e]=n[e];return pI(r)},record:pO,refine:pF,regexp:function(){return pA("regexp",e=>e instanceof RegExp)},set:function(e){return new pp({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(let n of t)yield[n,n,e]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||`Expected a \`Set\` object, but received: ${pd(e)}`})},size:function(e,t,n=t){let r=`Expected a ${e.type}`,i=t===n?`of \`${t}\``:`between \`${t}\` and \`${n}\``;return pF(e,"size",e=>{if("number"==typeof e||e instanceof Date)return t<=e&&e<=n||`${r} ${i} but received \`${e}\``;if(e instanceof Map||e instanceof Set){let{size:o}=e;return t<=o&&o<=n||`${r} with a size ${i} but received one with a size of \`${o}\``}{let{length:o}=e;return t<=o&&o<=n||`${r} with a length ${i} but received one with a length of \`${o}\``}})},string:pP,struct:function(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),pA(e,t)},trimmed:function(e){return pB(e,pP(),e=>e.trim())},tuple:function(e){let t=pC();return new pp({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){let r=Math.max(e.length,n.length);for(let i=0;iArray.isArray(e)||`Expected an array, but received: ${pd(e)}`})},type:pL,union:pN,unknown:pD,validate:py}));function pU(e,t){return"string"==typeof function(e){let t,n=e[0],r=1;for(;rn.call(t,...e)),t=void 0)}return n}([e,"optionalAccess",e=>e.prototype,"optionalAccess",e=>e.constructor,"optionalAccess",e=>e.name])?new e({message:t}):e({message:t})}Object.defineProperty(hX,"__esModule",{value:!0});var pq=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};hX.AssertionError=pq,hX.assert=function(e,t="Assertion failed.",n=pq){if(!e){if(t instanceof Error)throw t;throw pU(n,t)}},hX.assertStruct=function(e,t,n="Assertion failed",r=pq){try{pz.assert.call(void 0,e,t)}catch(e){throw pU(r,`${n}: ${h0.getErrorMessage.call(void 0,e).replace(/\.$/u,"")}.`)}},hX.assertExhaustive=function(e){throw Error("Invalid branch reached. Should be detected during compilation.")};var pK={},pH={};function pV(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`Wrong positive integer: ${e}`)}function p$(e){if("boolean"!=typeof e)throw Error(`Expected boolean, not ${e}`)}function pW(e,...t){if(!(e instanceof Uint8Array))throw Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function pY(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");pV(e.outputLen),pV(e.blockLen)}function pG(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function pQ(e,t){pW(e);let n=t.outputLen;if(e.length>pX&pJ)}:{h:0|Number(e>>pX&pJ),l:0|Number(e&pJ)}}function p1(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);pZ.toBig=p2;let p3=(e,t,n)=>e>>>n;pZ.shrSH=p3;let p6=(e,t,n)=>e<<32-n|t>>>n;pZ.shrSL=p6;let p4=(e,t,n)=>e>>>n|t<<32-n;pZ.rotrSH=p4;let p8=(e,t,n)=>e<<32-n|t>>>n;pZ.rotrSL=p8;let p5=(e,t,n)=>e<<64-n|t>>>n-32;pZ.rotrBH=p5;let p7=(e,t,n)=>e>>>n-32|t<<64-n;pZ.rotrBL=p7;let p9=(e,t)=>t;pZ.rotr32H=p9;let me=(e,t)=>e;pZ.rotr32L=me;let mt=(e,t,n)=>e<>>32-n;pZ.rotlSH=mt;let mn=(e,t,n)=>t<>>32-n;pZ.rotlSL=mn;let mr=(e,t,n)=>t<>>64-n;pZ.rotlBH=mr;let mi=(e,t,n)=>e<>>64-n;function mo(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/4294967296|0)|0,l:0|i}}pZ.rotlBL=mi,pZ.add=mo;let ma=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);pZ.add3L=ma;let ms=(e,t,n,r)=>t+n+r+(e/4294967296|0)|0;pZ.add3H=ms;let ml=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);pZ.add4L=ml;let mu=(e,t,n,r,i)=>t+n+r+i+(e/4294967296|0)|0;pZ.add4H=mu;let mc=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);pZ.add5L=mc;let md=(e,t,n,r,i,o)=>t+n+r+i+o+(e/4294967296|0)|0;pZ.add5H=md,pZ.default={fromBig:p0,split:p1,toBig:p2,shrSH:p3,shrSL:p6,rotrSH:p4,rotrSL:p8,rotrBH:p5,rotrBL:p7,rotr32H:p9,rotr32L:me,rotlSH:mt,rotlSL:mn,rotlBH:mr,rotlBL:mi,add:mo,add3L:ma,add3H:ms,add4L:ml,add4H:mu,add5H:md,add5L:mc};var mf={},mh={};Object.defineProperty(mh,"__esModule",{value:!0}),mh.crypto=void 0,mh.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.isLE=e.rotr=e.createView=e.u32=e.u8=void 0;let t=e=>e instanceof Uint8Array;if(e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),e.rotr=(e,t)=>e<<32-t|e>>>t,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw Error("Non little-endian hardware is not supported");let n=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function r(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function i(e){if("string"==typeof e&&(e=r(e)),!t(e))throw Error("expected Uint8Array, got "+typeof e);return e}e.bytesToHex=function(e){if(!t(e))throw Error("Uint8Array expected");let r="";for(let t=0;t{},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o=0&&te+t.length,0)),r=0;return e.forEach(e=>{if(!t(e))throw Error("Uint8Array expected");n.set(e,r),r+=e.length}),n},e.Hash=class{clone(){return this._cloneInto()}};let o={}.toString;e.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!==o.call(t))throw Error("Options should be object or undefined");return Object.assign(e,t)},e.wrapConstructor=function(e){let t=t=>e().update(i(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){let t=(t,n)=>e(n).update(i(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){let t=(t,n)=>e(n).update(i(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(mh.crypto&&"function"==typeof mh.crypto.getRandomValues)return mh.crypto.getRandomValues(new Uint8Array(e));throw Error("crypto.getRandomValues must be defined")}}(mf),Object.defineProperty(pK,"__esModule",{value:!0}),pK.shake256=pK.shake128=pK.keccak_512=pK.keccak_384=pK.keccak_256=pK.keccak_224=pK.sha3_512=pK.sha3_384=pK.sha3_256=pK.sha3_224=pK.Keccak=pK.keccakP=void 0;let mp=mf,[mm,mg,mv]=[[],[],[]],mb=BigInt(0),my=BigInt(1),mA=BigInt(2),mw=BigInt(7),m_=BigInt(256),mE=BigInt(113);for(let e=0,t=my,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],mm.push(2*(5*r+n)),mg.push((e+1)*(e+2)/2%64);let i=mb;for(let e=0;e<7;e++)(t=(t<>mw)*mE)%m_)&mA&&(i^=my<<(my<n>32?(0,pZ.rotlBH)(e,t,n):(0,pZ.rotlSH)(e,t,n),mC=(e,t,n)=>n>32?(0,pZ.rotlBL)(e,t,n):(0,pZ.rotlSL)(e,t,n);function mx(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,o=n[i],a=n[i+1],s=mM(o,a,1)^n[r],l=mC(o,a,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=l}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=mg[n],o=mM(t,i,r),a=mC(t,i,r),s=mm[n];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=mS[r],e[1]^=mk[r]}n.fill(0)}pK.keccakP=mx;class mR extends mp.Hash{constructor(e,t,n,r=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,pH.number)(n),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,mp.u32)(this.state)}keccak(){mx(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){(0,pH.exists)(this);let{blockLen:t,state:n}=this,r=(e=(0,mp.toBytes)(e)).length;for(let i=0;i=n&&this.keccak();let o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,pH.number)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,pH.output)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new mR(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}pK.Keccak=mR;let mI=(e,t,n)=>(0,mp.wrapConstructor)(()=>new mR(t,e,n));pK.sha3_224=mI(6,144,28),pK.sha3_256=mI(6,136,32),pK.sha3_384=mI(6,104,48),pK.sha3_512=mI(6,72,64),pK.keccak_224=mI(1,144,28),pK.keccak_256=mI(1,136,32),pK.keccak_384=mI(1,104,48),pK.keccak_512=mI(1,72,64);let mT=(e,t,n)=>(0,mp.wrapXOFConstructorWithOpts)((r={})=>new mR(t,e,void 0===r.dkLen?n:r.dkLen,!0));pK.shake128=mT(31,168,16),pK.shake256=mT(31,136,32);var mO={};(function(e){function t(...e){let n=(e,t)=>n=>e(t(n));return{encode:Array.from(e).reverse().reduce((e,t)=>e?n(e,t.encode):t.encode,void 0),decode:e.reduce((e,t)=>e?n(e,t.decode):t.decode,void 0)}}function n(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw Error("alphabet.encode input should be an array of numbers");return t.map(t=>{if(t<0||t>=e.length)throw Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]})},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw Error("alphabet.decode input should be array of strings");return t.map(t=>{if("string"!=typeof t)throw Error(`alphabet.decode: not string element=${t}`);let n=e.indexOf(t);if(-1===n)throw Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})}}}function r(e=""){if("string"!=typeof e)throw Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw Error("join.decode input should be string");return t.split(e)}}}function i(e,t="="){if("string"!=typeof t)throw Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw Error(`padding.decode: non-string input=${e}`);let r=n.length;if(r*e%8)throw Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function o(e){if("function"!=typeof e)throw Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function a(e,t,n){if(t<2)throw Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw Error("convertRadix: data should be array");if(!e.length)return[];let r=0,i=[],o=Array.from(e);for(o.forEach(e=>{if(e<0||e>=t)throw Error(`Wrong integer: ${e}`)});;){let e=0,a=!0;for(let i=r;it?s(t,e%t):e,l=(e,t)=>e+(t-s(e,t));function u(e,t,n,r){if(!Array.isArray(e))throw Error("convertRadix2: data should be array");if(t<=0||t>32)throw Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw Error(`convertRadix2: wrong to=${n}`);if(l(t,n)>32)throw Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${l(t,n)}`);let i=0,o=0,a=2**n-1,s=[];for(let r of e){if(r>=2**t)throw Error(`convertRadix2: invalid data word=${r} from=${t}`);if(i=i<32)throw Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=n;o-=n)s.push((i>>o-n&a)>>>0);i&=2**o-1}if(i=i<=t)throw Error("Excess padding");if(!r&&i)throw Error(`Non-zero padding: ${i}`);return r&&o>0&&s.push(i>>>0),s}function c(e){return{encode:t=>{if(!(t instanceof Uint8Array))throw Error("radix.encode input should be Uint8Array");return a(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw Error("radix.decode input should be array of strings");return Uint8Array.from(a(t,e,256))}}}function d(e,t=!1){if(e<=0||e>32)throw Error("radix2: bits should be in (0..32]");if(l(8,e)>32||l(e,8)>32)throw Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw Error("radix2.encode input should be Uint8Array");return u(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw Error("radix2.decode input should be array of strings");return Uint8Array.from(u(n,e,8,t))}}}function f(e){if("function"!=typeof e)throw Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}function h(e,t){if("function"!=typeof t)throw Error("checksum fn should be function");return{encode(n){if(!(n instanceof Uint8Array))throw Error("checksum.encode: input should be Uint8Array");let r=t(n).slice(0,e),i=new Uint8Array(n.length+e);return i.set(n),i.set(r,n.length),i},decode(n){if(!(n instanceof Uint8Array))throw Error("checksum.decode: input should be Uint8Array");let r=n.slice(0,-e),i=t(r).slice(0,e),o=n.slice(-e);for(let t=0;te.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),e.base64=t(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),i(6),r("")),e.base64url=t(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),i(6),r("")),e.base64urlnopad=t(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),r(""));let p=e=>t(c(58),n(e),r(""));e.base58=p("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e.base58flickr=p("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),e.base58xrp=p("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");let m=[0,2,3,5,6,7,9,10,11];e.base58xmr={encode(t){let n="";for(let r=0;rt(h(4,e=>n(n(e))),e.base58);let g=t(n("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),r("")),v=[996825010,642813549,513874426,1027748829,705979059];function b(e){let t=e>>25,n=(33554431&e)<<5;for(let e=0;e>e&1)&&(n^=v[e]);return n}function y(e,t,n=1){let r=e.length,i=1;for(let t=0;t126)throw Error(`Invalid prefix (${e})`);i=b(i)^n>>5}i=b(i);for(let t=0;tn)throw TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${n})`);let r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw Error("String must be lowercase or uppercase");let i=(e=r).lastIndexOf("1");if(0===i||-1===i)throw Error('Letter "1" must be present between prefix and data only');let o=e.slice(0,i),a=e.slice(i+1);if(a.length<6)throw Error("Data must be at least 6 characters long");let s=g.decode(a).slice(0,-6),l=y(o,s,t);if(!a.endsWith(l))throw Error(`Invalid checksum in ${e}: expected "${l}"`);return{prefix:o,words:s}}return{encode:function(e,n,r=90){if("string"!=typeof e)throw Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw Error("bech32.encode words should be array of numbers, not "+typeof n);let i=e.length+7+n.length;if(!1!==r&&i>r)throw TypeError(`Length ${i} exceeds limit ${r}`);let o=e.toLowerCase(),a=y(o,n,t);return`${o}1${g.encode(n)}${a}`},decode:a,decodeToBytes:function(e){let{prefix:t,words:n}=a(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:f(a),fromWords:r,fromWordsUnsafe:o,toWords:i}}e.bech32=A("bech32"),e.bech32m=A("bech32m"),e.utf8={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},e.hex=t(d(4),n("0123456789abcdef"),r(""),o(e=>{if("string"!=typeof e||e.length%2)throw TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}));let w={utf8:e.utf8,hex:e.hex,base16:e.base16,base32:e.base32,base64:e.base64,base64url:e.base64url,base58:e.base58,base58xmr:e.base58xmr},_="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr";e.bytesToString=(e,t)=>{if("string"!=typeof e||!w.hasOwnProperty(e))throw TypeError(_);if(!(t instanceof Uint8Array))throw TypeError("bytesToString() expects Uint8Array");return w[e].encode(t)},e.str=e.bytesToString,e.stringToBytes=(e,t)=>{if(!w.hasOwnProperty(e))throw TypeError(_);if("string"!=typeof t)throw TypeError("stringToBytes() expects string");return w[e].decode(t)},e.bytes=e.stringToBytes})(mO),Object.defineProperty(hJ,"__esModule",{value:!0});var mP=function(){let e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function mL(e){return e instanceof Uint8Array}function mN(e){hX.assert.call(void 0,mL(e),"Value must be a Uint8Array.")}function mD(e){if(mN(e),0===e.length)return"0x";let t=mP(),n=Array(e.length);for(let r=0;rn.call(t,...e)),t=void 0)}return n}([e,"optionalAccess",e=>e.toLowerCase,"optionalCall",e=>e()]))return new Uint8Array;mG(e);let t=mX(e).toLowerCase(),n=t.length%2==0?t:`0${t}`,r=new Uint8Array(n.length/2);for(let e=0;e=BigInt(0),"Value must be a non-negative bigint."),mj(e.toString(16))}function mz(e){return hX.assert.call(void 0,"number"==typeof e,"Value must be a number."),hX.assert.call(void 0,e>=0,"Value must be a non-negative number."),hX.assert.call(void 0,Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead."),mj(e.toString(16))}function mU(e){return hX.assert.call(void 0,"string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function mq(e){if("bigint"==typeof e)return mF(e);if("number"==typeof e)return mz(e);if("string"==typeof e)return e.startsWith("0x")?mj(e):mU(e);if(mL(e))return e;throw TypeError(`Unsupported value type: "${typeof e}".`)}var mK=pz.pattern.call(void 0,pz.string.call(void 0),/^(?:0x)?[0-9a-f]+$/iu),mH=pz.pattern.call(void 0,pz.string.call(void 0),/^0x[0-9a-f]+$/iu),mV=pz.pattern.call(void 0,pz.string.call(void 0),/^0x[0-9a-f]{40}$/u),m$=pz.pattern.call(void 0,pz.string.call(void 0),/^0x[0-9a-fA-F]{40}$/u);function mW(e){return pz.is.call(void 0,e,mK)}function mY(e){return pz.is.call(void 0,e,mH)}function mG(e){hX.assert.call(void 0,mW(e),"Value must be a hexadecimal string.")}function mQ(e){hX.assert.call(void 0,pz.is.call(void 0,e,m$),"Invalid hex address.");let t=mX(e.toLowerCase()),n=mX(mD(pK.keccak_256.call(void 0,t)));return`0x${t.split("").map((e,t)=>{let r=n[t];return hX.assert.call(void 0,pz.is.call(void 0,r,pz.string.call(void 0)),"Hash shorter than address."),parseInt(r,16)>7?e.toUpperCase():e}).join("")}`}function mZ(e){return!!pz.is.call(void 0,e,m$)&&mQ(e)===e}function mJ(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`}function mX(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}hJ.HexStruct=mK,hJ.StrictHexStruct=mH,hJ.HexAddressStruct=mV,hJ.HexChecksumAddressStruct=m$,hJ.isHexString=mW,hJ.isStrictHexString=mY,hJ.assertIsHexString=mG,hJ.assertIsStrictHexString=function(e){hX.assert.call(void 0,mY(e),'Value must be a hexadecimal string, starting with "0x".')},hJ.isValidHexAddress=function(e){return pz.is.call(void 0,e,mV)||mZ(e)},hJ.getChecksumAddress=mQ,hJ.isValidChecksumAddress=mZ,hJ.add0x=mJ,hJ.remove0x=mX,hJ.isBytes=mL,hJ.assertIsBytes=mN,hJ.bytesToHex=mD,hJ.bytesToBigInt=mB,hJ.bytesToSignedBigInt=function(e){mN(e);let t=BigInt(0);for(let n of e)t=(t<0,"Byte length must be greater than 0."),hX.assert.call(void 0,function(e,t){hX.assert.call(void 0,t>0);let n=e>>BigInt(31);return!((~e&n)+(e&~n)>>BigInt(8*t-1))}(e,t),"Byte length is too small to represent the given value.");let n=e,r=new Uint8Array(t);for(let e=0;e>=BigInt(8);return r.reverse()},hJ.numberToBytes=mz,hJ.stringToBytes=mU,hJ.base64ToBytes=function(e){return hX.assert.call(void 0,"string"==typeof e,"Value must be a string."),mO.base64.decode(e)},hJ.valueToBytes=mq,hJ.concatBytes=function(e){let t=Array(e.length),n=0;for(let r=0;r(hX.assert.call(void 0,"number"==typeof e,"Value must be a number."),hX.assert.call(void 0,e>=0,"Value must be a non-negative number."),hX.assert.call(void 0,Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),hJ.add0x.call(void 0,e.toString(16))),hZ.bigIntToHex=e=>(hX.assert.call(void 0,"bigint"==typeof e,"Value must be a bigint."),hX.assert.call(void 0,e>=0,"Value must be a non-negative bigint."),hJ.add0x.call(void 0,e.toString(16))),hZ.hexToNumber=e=>{hJ.assertIsHexString.call(void 0,e);let t=parseInt(e,16);return hX.assert.call(void 0,Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t},hZ.hexToBigInt=e=>(hJ.assertIsHexString.call(void 0,e),BigInt(hJ.add0x.call(void 0,e)));var m0={};Object.defineProperty(m0,"__esModule",{value:!0}),m0.createDeferredPromise=function({suppressUnhandledRejection:e=!1}={}){let t,n;let r=new Promise((e,r)=>{t=e,n=r});return e&&r.catch(e=>{}),{promise:r,resolve:t,reject:n}};var m1={};Object.defineProperty(m1,"__esModule",{value:!0});var m2=((a=m2||{})[a.Millisecond=1]="Millisecond",a[a.Second=1e3]="Second",a[a.Minute=6e4]="Minute",a[a.Hour=36e5]="Hour",a[a.Day=864e5]="Day",a[a.Week=6048e5]="Week",a[a.Year=31536e6]="Year",a),m3=(e,t)=>{if(!(Number.isInteger(e)&&e>=0))throw Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};m1.Duration=m2,m1.inMilliseconds=function(e,t){return m3(e,"count"),e*t},m1.timeSince=function(e){return m3(e,"timestamp"),Date.now()-e};var m6={},m4={exports:{}},m8={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},m5="object"==typeof ex&&ex.env&&ex.env.NODE_DEBUG&&/\bsemver\b/i.test(ex.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=m8,o=(t=e.exports={}).re=[],a=t.safeRe=[],s=t.src=[],l=t.t={},u=0,c="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",i],[c,r]],f=(e,t,n)=>{let r=(e=>{for(let[t,n]of d)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=u++;m5(e,i,t),l[e]=i,s[i]=t,o[i]=new RegExp(t,n?"g":void 0),a[i]=new RegExp(r,n?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${c}*`),f("MAINVERSION",`(${s[l.NUMERICIDENTIFIER]})\\.(${s[l.NUMERICIDENTIFIER]})\\.(${s[l.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${s[l.NUMERICIDENTIFIERLOOSE]})\\.(${s[l.NUMERICIDENTIFIERLOOSE]})\\.(${s[l.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${s[l.NUMERICIDENTIFIER]}|${s[l.NONNUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${s[l.NUMERICIDENTIFIERLOOSE]}|${s[l.NONNUMERICIDENTIFIER]})`),f("PRERELEASE",`(?:-(${s[l.PRERELEASEIDENTIFIER]}(?:\\.${s[l.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${s[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${s[l.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${c}+`),f("BUILD",`(?:\\+(${s[l.BUILDIDENTIFIER]}(?:\\.${s[l.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${s[l.MAINVERSION]}${s[l.PRERELEASE]}?${s[l.BUILD]}?`),f("FULL",`^${s[l.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${s[l.MAINVERSIONLOOSE]}${s[l.PRERELEASELOOSE]}?${s[l.BUILD]}?`),f("LOOSE",`^${s[l.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${s[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${s[l.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${s[l.XRANGEIDENTIFIER]})(?:\\.(${s[l.XRANGEIDENTIFIER]})(?:\\.(${s[l.XRANGEIDENTIFIER]})(?:${s[l.PRERELEASE]})?${s[l.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${s[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[l.XRANGEIDENTIFIERLOOSE]})(?:${s[l.PRERELEASELOOSE]})?${s[l.BUILD]}?)?)?`),f("XRANGE",`^${s[l.GTLT]}\\s*${s[l.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${s[l.GTLT]}\\s*${s[l.XRANGEPLAINLOOSE]}$`),f("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),f("COERCERTL",s[l.COERCE],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${s[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${s[l.LONETILDE]}${s[l.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${s[l.LONETILDE]}${s[l.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${s[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${s[l.LONECARET]}${s[l.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${s[l.LONECARET]}${s[l.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${s[l.GTLT]}\\s*(${s[l.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${s[l.GTLT]}\\s*(${s[l.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${s[l.GTLT]}\\s*(${s[l.LOOSEPLAIN]}|${s[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${s[l.XRANGEPLAIN]})\\s+-\\s+(${s[l.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${s[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${s[l.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(m4,m4.exports);var m7=m4.exports;let m9=Object.freeze({loose:!0}),ge=Object.freeze({});var gt=e=>e?"object"!=typeof e?m9:e:ge;let gn=/^[0-9]+$/,gr=(e,t)=>{let n=gn.test(e),r=gn.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:egr(t,e)};let{MAX_LENGTH:go,MAX_SAFE_INTEGER:ga}=m8,{safeRe:gs,t:gl}=m7,{compareIdentifiers:gu}=gi;var gc=class e{constructor(t,n){if(n=gt(n),t instanceof e){if(!!n.loose===t.loose&&!!n.includePrerelease===t.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>go)throw TypeError(`version is longer than ${go} characters`);m5("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let r=t.trim().match(n.loose?gs[gl.LOOSE]:gs[gl.FULL]);if(!r)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>ga||this.major<0)throw TypeError("Invalid major version");if(this.minor>ga||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>ga||this.patch<0)throw TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===gu(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}},gd=(e,t,n=!1)=>{if(e instanceof gc)return e;try{return new gc(e,t)}catch(e){if(!n)return null;throw e}},gf=(e,t,n)=>new gc(e,n).compare(new gc(t,n)),gh=(e,t,n)=>{let r=new gc(e,n),i=new gc(t,n);return r.compare(i)||r.compareBuild(i)},gp=(e,t,n)=>gf(e,t,n)>0,gm=(e,t,n)=>0>gf(e,t,n),gg=(e,t,n)=>0===gf(e,t,n),gv=(e,t,n)=>0!==gf(e,t,n),gb=(e,t,n)=>gf(e,t,n)>=0,gy=(e,t,n)=>0>=gf(e,t,n),gA=(e,t,n,r)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return gg(e,n,r);case"!=":return gv(e,n,r);case">":return gp(e,n,r);case">=":return gb(e,n,r);case"<":return gm(e,n,r);case"<=":return gy(e,n,r);default:throw TypeError(`Invalid operator: ${t}`)}};let{safeRe:gw,t:g_}=m7;function gE(){if(v_)return vw;v_=1;class e{constructor(t,i){if(i=n(i),t instanceof e)return!!i.loose===t.loose&&!!i.includePrerelease===t.includePrerelease?t:new e(t.raw,i);if(t instanceof r)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=i,this.loose=!!i.loose,this.includePrerelease=!!i.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(1===e.length&&p(e[0])){this.set=[e];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&d)|(this.options.loose&&f))+":"+e,o=t.get(n);if(o)return o;let p=this.options.loose,m=p?a[s.HYPHENRANGELOOSE]:a[s.HYPHENRANGE];i("hyphen replace",e=e.replace(m,M(this.options.includePrerelease))),i("comparator trim",e=e.replace(a[s.COMPARATORTRIM],l)),i("tilde trim",e=e.replace(a[s.TILDETRIM],u)),i("caret trim",e=e.replace(a[s.CARETTRIM],c));let v=e.split(" ").map(e=>g(e,this.options)).join(" ").split(/\s+/).map(e=>k(e,this.options));p&&(v=v.filter(e=>(i("loose invalid filter",e,this.options),!!e.match(a[s.COMPARATORLOOSE])))),i("range list",v);let b=new Map;for(let e of v.map(e=>new r(e,this.options))){if(h(e))return[e];b.set(e.value,e)}b.size>1&&b.has("")&&b.delete("");let y=[...b.values()];return t.set(n,y),y}intersects(t,n){if(!(t instanceof e))throw TypeError("a Range is required");return this.set.some(e=>m(e,n)&&t.set.some(t=>m(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new o(e,this.options)}catch(e){return!1}for(let t=0;t0)for(var r=0,i=arguments.length;r1)n=t;else{if(!this.head)throw TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=e(n,r.value,i),r=r.next;return n},e.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=e(n,r.value,i),r=r.prev;return n},e.prototype.toArray=function(){for(var e=Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},e.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},e.prototype.slice=function(t,n){(n=n||this.length)<0&&(n+=this.length),(t=t||0)<0&&(t+=this.length);var r=new e;if(nthis.length&&(n=this.length);for(var i=0,o=this.head;null!==o&&ithis.length&&(n=this.length);for(var i=this.length,o=this.tail;null!==o&&i>n;i--)o=o.prev;for(;null!==o&&i>t;i--,o=o.prev)r.push(o.value);return r},e.prototype.splice=function(e,n,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,o=this.head;null!==o&&i1,f=(e,t,n)=>{let r=e[u].get(t);if(r){let t=r.value;if(h(e,t)){if(m(e,r),!e[i])return}else n&&(e[c]&&(r.value.now=Date.now()),e[l].unshiftNode(r));return t.value}},h=(e,t)=>{if(!t||!t.maxAge&&!e[o])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[o]&&n>e[o]},p=e=>{if(e[n]>e[t])for(let r=e[l].tail;e[n]>e[t]&&null!==r;){let t=r.prev;m(e,r),r=t}},m=(e,t)=>{if(t){let r=t.value;e[a]&&e[a](r.key,r.value),e[n]-=r.length,e[u].delete(r.key),e[l].removeNode(t)}};class g{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}let v=(e,t,n,r)=>{let o=n.value;h(e,o)&&(m(e,n),e[i]||(o=void 0)),o&&t.call(r,o.value,o.key,e)};return vy=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw TypeError("max must be a non-negative number");this[t]=e.max||1/0;let n=e.length||d;if(this[r]="function"!=typeof n?d:n,this[i]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw TypeError("maxAge must be a number");this[o]=e.maxAge||0,this[a]=e.dispose,this[s]=e.noDisposeOnSet||!1,this[c]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw TypeError("max must be a non-negative number");this[t]=e||1/0,p(this)}get max(){return this[t]}set allowStale(e){this[i]=!!e}get allowStale(){return this[i]}set maxAge(e){if("number"!=typeof e)throw TypeError("maxAge must be a non-negative number");this[o]=e,p(this)}get maxAge(){return this[o]}set lengthCalculator(e){"function"!=typeof e&&(e=d),e!==this[r]&&(this[r]=e,this[n]=0,this[l].forEach(e=>{e.length=this[r](e.value,e.key),this[n]+=e.length})),p(this)}get lengthCalculator(){return this[r]}get length(){return this[n]}get itemCount(){return this[l].length}rforEach(e,t){t=t||this;for(let n=this[l].tail;null!==n;){let r=n.prev;v(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[l].head;null!==n;){let r=n.next;v(this,e,n,t),n=r}}keys(){return this[l].toArray().map(e=>e.key)}values(){return this[l].toArray().map(e=>e.value)}reset(){this[a]&&this[l]&&this[l].length&&this[l].forEach(e=>this[a](e.key,e.value)),this[u]=new Map,this[l]=new e,this[n]=0}dump(){return this[l].map(e=>!h(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[l]}set(e,i,c){if((c=c||this[o])&&"number"!=typeof c)throw TypeError("maxAge must be a number");let d=c?Date.now():0,f=this[r](i,e);if(this[u].has(e)){if(f>this[t])return m(this,this[u].get(e)),!1;let r=this[u].get(e).value;return this[a]&&(this[s]||this[a](e,r.value)),r.now=d,r.maxAge=c,r.value=i,this[n]+=f-r.length,r.length=f,this.get(e),p(this),!0}let h=new g(e,i,f,d,c);return h.length>this[t]?(this[a]&&this[a](e,i),!1):(this[n]+=h.length,this[l].unshift(h),this[u].set(e,this[l].head),p(this),!0)}has(e){return!!this[u].has(e)&&!h(this,this[u].get(e).value)}get(e){return f(this,e,!0)}peek(e){return f(this,e,!1)}pop(){let e=this[l].tail;return e?(m(this,e),e.value):null}del(e){m(this,this[u].get(e))}load(e){this.reset();let t=Date.now();for(let n=e.length-1;n>=0;n--){let r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{let e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[u].forEach((e,t)=>f(this,t,!1))}}}())({max:1e3}),n=gt,r=gS(),i=m5,o=gc,{safeRe:a,t:s,comparatorTrimReplace:l,tildeTrimReplace:u,caretTrimReplace:c}=m7,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:f}=m8,h=e=>"<0.0.0-0"===e.value,p=e=>""===e.value,m=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},g=(e,t)=>(i("comp",e,t),i("caret",e=A(e,t)),i("tildes",e=b(e,t)),i("xrange",e=_(e,t)),i("stars",e=S(e,t)),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map(e=>y(e,t)).join(" "),y=(e,t)=>{let n=t.loose?a[s.TILDELOOSE]:a[s.TILDE];return e.replace(n,(t,n,r,o,a)=>{let s;return i("tilde",e,t,n,r,o,a),v(n)?s="":v(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(o)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(i("replaceTilde pr",a),s=`>=${n}.${r}.${o}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${o} <${n}.${+r+1}.0-0`,i("tilde return",s),s})},A=(e,t)=>e.trim().split(/\s+/).map(e=>w(e,t)).join(" "),w=(e,t)=>{i("caret",e,t);let n=t.loose?a[s.CARETLOOSE]:a[s.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,(t,n,o,a,s)=>{let l;return i("caret",e,t,n,o,a,s),v(n)?l="":v(o)?l=`>=${n}.0.0${r} <${+n+1}.0.0-0`:v(a)?l="0"===n?`>=${n}.${o}.0${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.0${r} <${+n+1}.0.0-0`:s?(i("replaceCaret pr",s),l="0"===n?"0"===o?`>=${n}.${o}.${a}-${s} <${n}.${o}.${+a+1}-0`:`>=${n}.${o}.${a}-${s} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${a}-${s} <${+n+1}.0.0-0`):(i("no pr"),l="0"===n?"0"===o?`>=${n}.${o}.${a}${r} <${n}.${o}.${+a+1}-0`:`>=${n}.${o}.${a}${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${a} <${+n+1}.0.0-0`),i("caret return",l),l})},_=(e,t)=>(i("replaceXRanges",e,t),e.split(/\s+/).map(e=>E(e,t)).join(" ")),E=(e,t)=>{e=e.trim();let n=t.loose?a[s.XRANGELOOSE]:a[s.XRANGE];return e.replace(n,(n,r,o,a,s,l)=>{i("xRange",e,n,r,o,a,s,l);let u=v(o),c=u||v(a),d=c||v(s);return"="===r&&d&&(r=""),l=t.includePrerelease?"-0":"",u?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&d?(c&&(a=0),s=0,">"===r?(r=">=",c?(o=+o+1,a=0):a=+a+1,s=0):"<="===r&&(r="<",c?o=+o+1:a=+a+1),"<"===r&&(l="-0"),n=`${r+o}.${a}.${s}${l}`):c?n=`>=${o}.0.0${l} <${+o+1}.0.0-0`:d&&(n=`>=${o}.${a}.0${l} <${o}.${+a+1}.0-0`),i("xRange return",n),n})},S=(e,t)=>(i("replaceStars",e,t),e.trim().replace(a[s.STAR],"")),k=(e,t)=>(i("replaceGTE0",e,t),e.trim().replace(a[t.includePrerelease?s.GTE0PRE:s.GTE0],"")),M=e=>(t,n,r,i,o,a,s,l,u,c,d,f,h)=>`${n=v(r)?"":v(i)?`>=${r}.0.0${e?"-0":""}`:v(o)?`>=${r}.${i}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=v(u)?"":v(c)?`<${+u+1}.0.0-0`:v(d)?`<${u}.${+c+1}.0-0`:f?`<=${u}.${c}.${d}-${f}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`}`.trim(),C=(e,t,n)=>{for(let n=0;n0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return vw}function gS(){if(vS)return vE;vS=1;let e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(r,i){if(i=n(i),r instanceof t){if(!!i.loose===r.loose)return r;r=r.value}a("comparator",r=r.trim().split(/\s+/).join(" "),i),this.options=i,this.loose=!!i.loose,this.parse(r),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){let n=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],o=t.match(n);if(!o)throw TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new s(o[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new s(t,this.options)}catch(e){return!1}return o(t,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new l(e.value,r).test(this.value):""===e.operator?""===e.value||new l(this.value,r).test(e.semver):(!(r=n(r)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&!(!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||!!(o(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(o(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}vE=t;let n=gt,{safeRe:r,t:i}=m7,o=gA,a=m5,s=gc,l=gE();return vE}let gk=gE();var gM=(e,t,n)=>{try{t=new gk(t,n)}catch(e){return!1}return t.test(e)};let gC=gE(),gx=gE(),gR=gE(),gI=gE(),gT=gE(),gO=gS(),{ANY:gP}=gO,gL=gE();var gN=(e,t,n,r)=>{let i,o,a,s,l;switch(e=new gc(e,r),t=new gL(t,r),n){case">":i=gp,o=gy,a=gm,s=">",l=">=";break;case"<":i=gm,o=gb,a=gp,s="<",l="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(gM(e,t,r))return!1;for(let n=0;n{e.semver===gP&&(e=new gO(">=0.0.0")),c=c||e,d=d||e,i(e.semver,c.semver,r)?c=e:a(e.semver,d.semver,r)&&(d=e)}),c.operator===s||c.operator===l||(!d.operator||d.operator===s)&&o(e,d.semver)||d.operator===l&&a(e,d.semver))return!1}return!0};let gD=gE(),gB=gE(),gj=gS(),{ANY:gF}=gj,gz=[new gj(">=0.0.0-0")],gU=[new gj(">=0.0.0")],gq=(e,t,n)=>{let r,i,o,a,s,l,u;if(e===t)return!0;if(1===e.length&&e[0].semver===gF){if(1===t.length&&t[0].semver===gF)return!0;e=n.includePrerelease?gz:gU}if(1===t.length&&t[0].semver===gF){if(n.includePrerelease)return!0;t=gU}let c=new Set;for(let t of e)">"===t.operator||">="===t.operator?r=gK(r,t,n):"<"===t.operator||"<="===t.operator?i=gH(i,t,n):c.add(t.semver);if(c.size>1||r&&i&&((o=gf(r.semver,i.semver,n))>0||0===o&&(">="!==r.operator||"<="!==i.operator)))return null;for(let e of c){if(r&&!gM(e,String(r),n)||i&&!gM(e,String(i),n))return null;for(let r of t)if(!gM(e,String(r),n))return!1;return!0}let d=!(!i||n.includePrerelease||!i.semver.prerelease.length)&&i.semver,f=!(!r||n.includePrerelease||!r.semver.prerelease.length)&&r.semver;for(let e of(d&&1===d.prerelease.length&&"<"===i.operator&&0===d.prerelease[0]&&(d=!1),t)){if(u=u||">"===e.operator||">="===e.operator,l=l||"<"===e.operator||"<="===e.operator,r){if(f&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===f.major&&e.semver.minor===f.minor&&e.semver.patch===f.patch&&(f=!1),">"===e.operator||">="===e.operator){if((a=gK(r,e,n))===e&&a!==r)return!1}else if(">="===r.operator&&!gM(r.semver,String(e),n))return!1}if(i){if(d&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===d.major&&e.semver.minor===d.minor&&e.semver.patch===d.patch&&(d=!1),"<"===e.operator||"<="===e.operator){if((s=gH(i,e,n))===e&&s!==i)return!1}else if("<="===i.operator&&!gM(i.semver,String(e),n))return!1}if(!e.operator&&(i||r)&&0!==o)return!1}return!(r&&l&&!i&&0!==o)&&!(i&&u&&!r&&0!==o)&&!f&&!d},gK=(e,t,n)=>{if(!e)return t;let r=gf(e.semver,t.semver,n);return r>0?e:r<0||">"===t.operator&&">="===e.operator?t:e},gH=(e,t,n)=>{if(!e)return t;let r=gf(e.semver,t.semver,n);return r<0?e:r>0||"<"===t.operator&&"<="===e.operator?t:e};var gV={parse:gd,valid:(e,t)=>{let n=gd(e,t);return n?n.version:null},clean:(e,t)=>{let n=gd(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null},inc:(e,t,n,r,i)=>{"string"==typeof n&&(i=r,r=n,n=void 0);try{return new gc(e instanceof gc?e.version:e,n).inc(t,r,i).version}catch(e){return null}},diff:(e,t)=>{let n=gd(e,null,!0),r=gd(t,null,!0),i=n.compare(r);if(0===i)return null;let o=i>0,a=o?n:r,s=o?r:n,l=!!a.prerelease.length;if(s.prerelease.length&&!l)return s.patch||s.minor?a.patch?"patch":a.minor?"minor":"major":"major";let u=l?"pre":"";return n.major!==r.major?u+"major":n.minor!==r.minor?u+"minor":n.patch!==r.patch?u+"patch":"prerelease"},major:(e,t)=>new gc(e,t).major,minor:(e,t)=>new gc(e,t).minor,patch:(e,t)=>new gc(e,t).patch,prerelease:(e,t)=>{let n=gd(e,t);return n&&n.prerelease.length?n.prerelease:null},compare:gf,rcompare:(e,t,n)=>gf(t,e,n),compareLoose:(e,t)=>gf(e,t,!0),compareBuild:gh,sort:(e,t)=>e.sort((e,n)=>gh(e,n,t)),rsort:(e,t)=>e.sort((e,n)=>gh(n,e,t)),gt:gp,lt:gm,eq:gg,neq:gv,gte:gb,lte:gy,cmp:gA,coerce:(e,t)=>{if(e instanceof gc)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let n=null;if((t=t||{}).rtl){let t;for(;(t=gw[g_.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&t.index+t[0].length===n.index+n[0].length||(n=t),gw[g_.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;gw[g_.COERCERTL].lastIndex=-1}else n=e.match(gw[g_.COERCE]);return null===n?null:gd(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)},Comparator:gS(),Range:gE(),satisfies:gM,toComparators:(e,t)=>new gC(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" ")),maxSatisfying:(e,t,n)=>{let r=null,i=null,o=null;try{o=new gx(t,n)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(r&&-1!==i.compare(e)||(i=new gc(r=e,n)))}),r},minSatisfying:(e,t,n)=>{let r=null,i=null,o=null;try{o=new gR(t,n)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(r&&1!==i.compare(e)||(i=new gc(r=e,n)))}),r},minVersion:(e,t)=>{e=new gI(e,t);let n=new gc("0.0.0");if(e.test(n)||(n=new gc("0.0.0-0"),e.test(n)))return n;n=null;for(let t=0;t{let t=new gc(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":i&&!gp(t,i)||(i=t);break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),i&&(!n||gp(n,i))&&(n=i)}return n&&e.test(n)?n:null},validRange:(e,t)=>{try{return new gT(e,t).range||"*"}catch(e){return null}},outside:gN,gtr:(e,t,n)=>gN(e,t,">",n),ltr:(e,t,n)=>gN(e,t,"<",n),intersects:(e,t,n)=>(e=new gD(e,n),t=new gD(t,n),e.intersects(t,n)),simplifyRange:(e,t,n)=>{let r=[],i=null,o=null,a=e.sort((e,t)=>gf(e,t,n));for(let e of a)gM(e,t,n)?(o=e,i||(i=e)):(o&&r.push([i,o]),o=null,i=null);i&&r.push([i,null]);let s=[];for(let[e,t]of r)e===t?s.push(e):t||e!==a[0]?t?e===a[0]?s.push(`<=${t}`):s.push(`${e} - ${t}`):s.push(`>=${e}`):s.push("*");let l=s.join(" || "),u="string"==typeof t.raw?t.raw:String(t);return l.length{if(e===t)return!0;e=new gB(e,n),t=new gB(t,n);let r=!1;e:for(let i of e.set){for(let e of t.set){let t=gq(i,e,n);if(r=r||null!==t,t)continue e}if(r)return!1}return!0},SemVer:gc,re:m7.re,src:m7.src,tokens:m7.t,SEMVER_SPEC_VERSION:m8.SEMVER_SPEC_VERSION,RELEASE_TYPES:m8.RELEASE_TYPES,compareIdentifiers:gi.compareIdentifiers,rcompareIdentifiers:gi.rcompareIdentifiers};Object.defineProperty(m6,"__esModule",{value:!0});var g$=pz.refine.call(void 0,pz.string.call(void 0),"Version",e=>null!==gV.valid.call(void 0,e)||`Expected SemVer version, got "${e}"`),gW=pz.refine.call(void 0,pz.string.call(void 0),"Version range",e=>null!==gV.validRange.call(void 0,e)||`Expected SemVer range, got "${e}"`);m6.VersionStruct=g$,m6.VersionRangeStruct=gW,m6.isValidSemVerVersion=function(e){return pz.is.call(void 0,e,g$)},m6.isValidSemVerRange=function(e){return pz.is.call(void 0,e,gW)},m6.assertIsSemVerVersion=function(e){hX.assertStruct.call(void 0,e,g$)},m6.assertIsSemVerRange=function(e){hX.assertStruct.call(void 0,e,gW)},m6.gtVersion=function(e,t){return gV.gt.call(void 0,e,t)},m6.gtRange=function(e,t){return gV.gtr.call(void 0,e,t)},m6.satisfiesVersionRange=function(e,t){return gV.satisfies.call(void 0,e,t,{includePrerelease:!0})};var gY={};Object.defineProperty(gY,"__esModule",{value:!0});var gG=e=>pz.object.call(void 0,e);function gQ({path:e,branch:t}){let n=e[e.length-1];return h1.hasProperty.call(void 0,t[t.length-2],n)}function gZ(e){return new pz.Struct({...e,type:`optional ${e.type}`,validator:(t,n)=>!gQ(n)||e.validator(t,n),refiner:(t,n)=>!gQ(n)||e.refiner(t,n)})}var gJ=pz.union.call(void 0,[pz.literal.call(void 0,null),pz.boolean.call(void 0),pz.define.call(void 0,"finite number",e=>pz.is.call(void 0,e,pz.number.call(void 0))&&Number.isFinite(e)),pz.string.call(void 0),pz.array.call(void 0,pz.lazy.call(void 0,()=>gJ)),pz.record.call(void 0,pz.string.call(void 0),pz.lazy.call(void 0,()=>gJ))]),gX=pz.coerce.call(void 0,gJ,pz.any.call(void 0),e=>(hX.assertStruct.call(void 0,e,gJ),JSON.parse(JSON.stringify(e,(e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))));function g0(e){return pz.create.call(void 0,e,gX)}var g1=pz.literal.call(void 0,"2.0"),g2=pz.nullable.call(void 0,pz.union.call(void 0,[pz.number.call(void 0),pz.string.call(void 0)])),g3=gG({code:pz.integer.call(void 0),message:pz.string.call(void 0),data:gZ(gX),stack:gZ(pz.string.call(void 0))}),g6=pz.union.call(void 0,[pz.record.call(void 0,pz.string.call(void 0),gX),pz.array.call(void 0,gX)]),g4=gG({id:g2,jsonrpc:g1,method:pz.string.call(void 0),params:gZ(g6)}),g8=gG({jsonrpc:g1,method:pz.string.call(void 0),params:gZ(g6)}),g5=pz.object.call(void 0,{id:g2,jsonrpc:g1,result:pz.optional.call(void 0,pz.unknown.call(void 0)),error:pz.optional.call(void 0,g3)}),g7=gG({id:g2,jsonrpc:g1,result:gX}),g9=gG({id:g2,jsonrpc:g1,error:g3}),ve=pz.union.call(void 0,[g7,g9]);gY.object=gG,gY.exactOptional=gZ,gY.UnsafeJsonStruct=gJ,gY.JsonStruct=gX,gY.isValidJson=function(e){try{return g0(e),!0}catch(e){return!1}},gY.getSafeJson=g0,gY.getJsonSize=function(e){hX.assertStruct.call(void 0,e,gX,"Invalid JSON value");let t=JSON.stringify(e);return(new TextEncoder).encode(t).byteLength},gY.jsonrpc2="2.0",gY.JsonRpcVersionStruct=g1,gY.JsonRpcIdStruct=g2,gY.JsonRpcErrorStruct=g3,gY.JsonRpcParamsStruct=g6,gY.JsonRpcRequestStruct=g4,gY.JsonRpcNotificationStruct=g8,gY.isJsonRpcNotification=function(e){return pz.is.call(void 0,e,g8)},gY.assertIsJsonRpcNotification=function(e,t){hX.assertStruct.call(void 0,e,g8,"Invalid JSON-RPC notification",t)},gY.isJsonRpcRequest=function(e){return pz.is.call(void 0,e,g4)},gY.assertIsJsonRpcRequest=function(e,t){hX.assertStruct.call(void 0,e,g4,"Invalid JSON-RPC request",t)},gY.PendingJsonRpcResponseStruct=g5,gY.JsonRpcSuccessStruct=g7,gY.JsonRpcFailureStruct=g9,gY.JsonRpcResponseStruct=ve,gY.isPendingJsonRpcResponse=function(e){return pz.is.call(void 0,e,g5)},gY.assertIsPendingJsonRpcResponse=function(e,t){hX.assertStruct.call(void 0,e,g5,"Invalid pending JSON-RPC response",t)},gY.isJsonRpcResponse=function(e){return pz.is.call(void 0,e,ve)},gY.assertIsJsonRpcResponse=function(e,t){hX.assertStruct.call(void 0,e,ve,"Invalid JSON-RPC response",t)},gY.isJsonRpcSuccess=function(e){return pz.is.call(void 0,e,g7)},gY.assertIsJsonRpcSuccess=function(e,t){hX.assertStruct.call(void 0,e,g7,"Invalid JSON-RPC success response",t)},gY.isJsonRpcFailure=function(e){return pz.is.call(void 0,e,g9)},gY.assertIsJsonRpcFailure=function(e,t){hX.assertStruct.call(void 0,e,g9,"Invalid JSON-RPC failure response",t)},gY.isJsonRpcError=function(e){return pz.is.call(void 0,e,g3)},gY.assertIsJsonRpcError=function(e,t){hX.assertStruct.call(void 0,e,g3,"Invalid JSON-RPC error",t)},gY.getJsonRpcIdValidator=function(e){let{permitEmptyString:t,permitFractions:n,permitNull:r}={permitEmptyString:!0,permitFractions:!1,permitNull:!0,...e};return e=>!!("number"==typeof e&&(n||Number.isInteger(e))||"string"==typeof e&&(t||e.length>0)||r&&null===e)};var vt,vn,vr,vi,vo,va,vs,vl,vu,vc,vd,vf,vh,vp,vm,vg,vv,vb,vy,vA,vw,v_,vE,vS,vk,vM,vC={},vx={exports:{}},vR=function(e){function t(e){let r,i,o,a=null;function s(...e){if(!s.enabled)return;let n=Number(new Date),i=n-(r||n);s.diff=i,s.prev=r,s.curr=n,r=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,r)=>{if("%%"===n)return"%";o++;let i=t.formatters[r];if("function"==typeof i){let t=e[o];n=i.call(s,t),e.splice(o,1),o--}return n}),t.formatArgs.call(s,e),(s.log||t.log).apply(s,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){let r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names.map(r),...t.skips.map(r).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];let r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n=1.5*n?"s":"")}return vM=1,vk=function(t,n){n=n||{};var r,i,o=typeof t;if("string"===o&&t.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return 864e5*n;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*n;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*n;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(t);if("number"===o&&isFinite(t))return n.long?(r=Math.abs(t))>=864e5?e(t,r,864e5,"day"):r>=36e5?e(t,r,36e5,"hour"):r>=6e4?e(t,r,6e4,"minute"):r>=1e3?e(t,r,1e3,"second"):t+" ms":(i=Math.abs(t))>=864e5?Math.round(t/864e5)+"d":i>=36e5?Math.round(t/36e5)+"h":i>=6e4?Math.round(t/6e4)+"m":i>=1e3?Math.round(t/1e3)+"s":t+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}}(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==ex&&"env"in ex&&(e=ex.env.DEBUG),e},t.useColors=function(){return"undefined"!=typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(n=!1,()=>{n||(n=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=vR(t);let{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(vx,vx.exports);var vI=vx.exports,vT=u(vI);Object.defineProperty(vC,"__esModule",{value:!0});var vO=(vI&&vI.__esModule?vI:{default:vI}).default.call(void 0,"metamask");vC.createProjectLogger=function(e){return vO.extend(e)},vC.createModuleLogger=function(e,t){return e.extend(t)};var vP={};function vL(e){let t,n=e[0],r=1;for(;rn.call(t,...e)),t=void 0)}return n}Object.defineProperty(vP,"__esModule",{value:!0});var vN=/^(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u,vD=/^[-a-z0-9]{3,8}$/u,vB=/^[-_a-zA-Z0-9]{1,32}$/u,vj=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u,vF=/^[-.%a-zA-Z0-9]{1,128}$/u,vz=pz.pattern.call(void 0,pz.string.call(void 0),vN),vU=pz.pattern.call(void 0,pz.string.call(void 0),vD),vq=pz.pattern.call(void 0,pz.string.call(void 0),vB),vK=pz.pattern.call(void 0,pz.string.call(void 0),vj),vH=pz.pattern.call(void 0,pz.string.call(void 0),vF);vP.CAIP_CHAIN_ID_REGEX=vN,vP.CAIP_NAMESPACE_REGEX=vD,vP.CAIP_REFERENCE_REGEX=vB,vP.CAIP_ACCOUNT_ID_REGEX=vj,vP.CAIP_ACCOUNT_ADDRESS_REGEX=vF,vP.CaipChainIdStruct=vz,vP.CaipNamespaceStruct=vU,vP.CaipReferenceStruct=vq,vP.CaipAccountIdStruct=vK,vP.CaipAccountAddressStruct=vH,vP.isCaipChainId=function(e){return pz.is.call(void 0,e,vz)},vP.isCaipNamespace=function(e){return pz.is.call(void 0,e,vU)},vP.isCaipReference=function(e){return pz.is.call(void 0,e,vq)},vP.isCaipAccountId=function(e){return pz.is.call(void 0,e,vK)},vP.isCaipAccountAddress=function(e){return pz.is.call(void 0,e,vH)},vP.parseCaipChainId=function(e){let t=vN.exec(e);if(!vL([t,"optionalAccess",e=>e.groups]))throw Error("Invalid CAIP chain ID.");return{namespace:t.groups.namespace,reference:t.groups.reference}},vP.parseCaipAccountId=function(e){let t=vj.exec(e);if(!vL([t,"optionalAccess",e=>e.groups]))throw Error("Invalid CAIP account ID.");return{address:t.groups.accountAddress,chainId:t.groups.chainId,chain:{namespace:t.groups.namespace,reference:t.groups.reference}}};var vV={},v$={};Object.defineProperty(v$,"__esModule",{value:!0}),v$.base64=(e,t={})=>{var n,r;let i,o;let a=(n=t.paddingRequired,null!=n&&n),s=(r=t.characterSet,null!=r?r:"base64");return"base64"===s?i=String.raw`[A-Za-z0-9+\/]`:(hX.assert.call(void 0,"base64url"===s),i=String.raw`[-_A-Za-z0-9]`),o=a?RegExp(`^(?:${i}{4})*(?:${i}{3}=|${i}{2}==)?$`,"u"):RegExp(`^(?:${i}{4})*(?:${i}{2,3}|${i}{3}=|${i}{2}==)?$`,"u"),pz.pattern.call(void 0,e,o)},Object.defineProperty(vV,"__esModule",{value:!0});var vW=pz.size.call(void 0,v$.base64.call(void 0,pz.string.call(void 0),{paddingRequired:!0}),44,44);vV.ChecksumStruct=vW;var vY={};Object.defineProperty(vY,"__esModule",{value:!0});var vG=pz.union.call(void 0,[pz.number.call(void 0),pz.bigint.call(void 0),pz.string.call(void 0),hJ.StrictHexStruct]),vQ=pz.coerce.call(void 0,pz.number.call(void 0),vG,Number),vZ=pz.coerce.call(void 0,pz.bigint.call(void 0),vG,BigInt);pz.union.call(void 0,[hJ.StrictHexStruct,pz.instance.call(void 0,Uint8Array)]);var vJ=pz.coerce.call(void 0,pz.instance.call(void 0,Uint8Array),pz.union.call(void 0,[hJ.StrictHexStruct]),hJ.hexToBytes),vX=pz.coerce.call(void 0,hJ.StrictHexStruct,pz.instance.call(void 0,Uint8Array),hJ.bytesToHex);vY.createNumber=function(e){try{let t=pz.create.call(void 0,e,vQ);return hX.assert.call(void 0,Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){if(t instanceof pz.StructError)throw Error(`Expected a number-like value, got "${e}".`);throw t}},vY.createBigInt=function(e){try{return pz.create.call(void 0,e,vZ)}catch(e){if(e instanceof pz.StructError)throw Error(`Expected a number-like value, got "${String(e.value)}".`);throw e}},vY.createBytes=function(e){if("string"==typeof e&&"0x"===e.toLowerCase())return new Uint8Array;try{return pz.create.call(void 0,e,vJ)}catch(e){if(e instanceof pz.StructError)throw Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}},vY.createHex=function(e){if(e instanceof Uint8Array&&0===e.length||"string"==typeof e&&"0x"===e.toLowerCase())return"0x";try{return pz.create.call(void 0,e,vX)}catch(e){if(e instanceof pz.StructError)throw Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}};var v0={},v1={};Object.defineProperty(v1,"__esModule",{value:!0});var v2=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};v1.__privateGet=(e,t,n)=>(v2(e,t,"read from private field"),n?n.call(e):t.get(e)),v1.__privateAdd=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},v1.__privateSet=(e,t,n,r)=>(v2(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Object.defineProperty(v0,"__esModule",{value:!0});var v3,v6,v4=class{constructor(e){v1.__privateAdd.call(void 0,this,v3,void 0),v1.__privateSet.call(void 0,this,v3,new Map(e)),Object.freeze(this)}get size(){return v1.__privateGet.call(void 0,this,v3).size}[Symbol.iterator](){return v1.__privateGet.call(void 0,this,v3)[Symbol.iterator]()}entries(){return v1.__privateGet.call(void 0,this,v3).entries()}forEach(e,t){return v1.__privateGet.call(void 0,this,v3).forEach((n,r,i)=>e.call(t,n,r,this))}get(e){return v1.__privateGet.call(void 0,this,v3).get(e)}has(e){return v1.__privateGet.call(void 0,this,v3).has(e)}keys(){return v1.__privateGet.call(void 0,this,v3).keys()}values(){return v1.__privateGet.call(void 0,this,v3).values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([e,t])=>`${String(e)} => ${String(t)}`).join(", ")} `:""}}`}};v3=new WeakMap;var v8=class{constructor(e){v1.__privateAdd.call(void 0,this,v6,void 0),v1.__privateSet.call(void 0,this,v6,new Set(e)),Object.freeze(this)}get size(){return v1.__privateGet.call(void 0,this,v6).size}[Symbol.iterator](){return v1.__privateGet.call(void 0,this,v6)[Symbol.iterator]()}entries(){return v1.__privateGet.call(void 0,this,v6).entries()}forEach(e,t){return v1.__privateGet.call(void 0,this,v6).forEach((n,r,i)=>e.call(t,n,r,this))}has(e){return v1.__privateGet.call(void 0,this,v6).has(e)}keys(){return v1.__privateGet.call(void 0,this,v6).keys()}values(){return v1.__privateGet.call(void 0,this,v6).values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(e=>String(e)).join(", ")} `:""}}`}};v6=new WeakMap,Object.freeze(v4),Object.freeze(v4.prototype),Object.freeze(v8),Object.freeze(v8.prototype),v0.FrozenMap=v4,v0.FrozenSet=v8,Object.defineProperty(hQ,"__esModule",{value:!0}),hQ.AssertionError=hX.AssertionError,hQ.CAIP_ACCOUNT_ADDRESS_REGEX=vP.CAIP_ACCOUNT_ADDRESS_REGEX,hQ.CAIP_ACCOUNT_ID_REGEX=vP.CAIP_ACCOUNT_ID_REGEX,hQ.CAIP_CHAIN_ID_REGEX=vP.CAIP_CHAIN_ID_REGEX,hQ.CAIP_NAMESPACE_REGEX=vP.CAIP_NAMESPACE_REGEX,hQ.CAIP_REFERENCE_REGEX=vP.CAIP_REFERENCE_REGEX,hQ.CaipAccountAddressStruct=vP.CaipAccountAddressStruct,hQ.CaipAccountIdStruct=vP.CaipAccountIdStruct,hQ.CaipChainIdStruct=vP.CaipChainIdStruct,hQ.CaipNamespaceStruct=vP.CaipNamespaceStruct,hQ.CaipReferenceStruct=vP.CaipReferenceStruct,hQ.ChecksumStruct=vV.ChecksumStruct,hQ.Duration=m1.Duration,hQ.ESCAPE_CHARACTERS_REGEXP=h1.ESCAPE_CHARACTERS_REGEXP,hQ.FrozenMap=v0.FrozenMap,hQ.FrozenSet=v0.FrozenSet,hQ.HexAddressStruct=hJ.HexAddressStruct,hQ.HexChecksumAddressStruct=hJ.HexChecksumAddressStruct,hQ.HexStruct=hJ.HexStruct,hQ.JsonRpcErrorStruct=gY.JsonRpcErrorStruct,hQ.JsonRpcFailureStruct=gY.JsonRpcFailureStruct,hQ.JsonRpcIdStruct=gY.JsonRpcIdStruct,hQ.JsonRpcNotificationStruct=gY.JsonRpcNotificationStruct,hQ.JsonRpcParamsStruct=gY.JsonRpcParamsStruct,hQ.JsonRpcRequestStruct=gY.JsonRpcRequestStruct,hQ.JsonRpcResponseStruct=gY.JsonRpcResponseStruct,hQ.JsonRpcSuccessStruct=gY.JsonRpcSuccessStruct,hQ.JsonRpcVersionStruct=gY.JsonRpcVersionStruct,hQ.JsonSize=h1.JsonSize,hQ.JsonStruct=gY.JsonStruct,hQ.PendingJsonRpcResponseStruct=gY.PendingJsonRpcResponseStruct,hQ.StrictHexStruct=hJ.StrictHexStruct,hQ.UnsafeJsonStruct=gY.UnsafeJsonStruct,hQ.VersionRangeStruct=m6.VersionRangeStruct,hQ.VersionStruct=m6.VersionStruct,hQ.add0x=hJ.add0x,hQ.assert=hX.assert,hQ.assertExhaustive=hX.assertExhaustive,hQ.assertIsBytes=hJ.assertIsBytes,hQ.assertIsHexString=hJ.assertIsHexString,hQ.assertIsJsonRpcError=gY.assertIsJsonRpcError,hQ.assertIsJsonRpcFailure=gY.assertIsJsonRpcFailure,hQ.assertIsJsonRpcNotification=gY.assertIsJsonRpcNotification,hQ.assertIsJsonRpcRequest=gY.assertIsJsonRpcRequest,hQ.assertIsJsonRpcResponse=gY.assertIsJsonRpcResponse,hQ.assertIsJsonRpcSuccess=gY.assertIsJsonRpcSuccess,hQ.assertIsPendingJsonRpcResponse=gY.assertIsPendingJsonRpcResponse,hQ.assertIsSemVerRange=m6.assertIsSemVerRange,hQ.assertIsSemVerVersion=m6.assertIsSemVerVersion,hQ.assertIsStrictHexString=hJ.assertIsStrictHexString,hQ.assertStruct=hX.assertStruct,hQ.base64=v$.base64,hQ.base64ToBytes=hJ.base64ToBytes,hQ.bigIntToBytes=hJ.bigIntToBytes,hQ.bigIntToHex=hZ.bigIntToHex,hQ.bytesToBase64=hJ.bytesToBase64,hQ.bytesToBigInt=hJ.bytesToBigInt,hQ.bytesToHex=hJ.bytesToHex,hQ.bytesToNumber=hJ.bytesToNumber,hQ.bytesToSignedBigInt=hJ.bytesToSignedBigInt,hQ.bytesToString=hJ.bytesToString,hQ.calculateNumberSize=h1.calculateNumberSize,hQ.calculateStringSize=h1.calculateStringSize,hQ.concatBytes=hJ.concatBytes,hQ.createBigInt=vY.createBigInt,hQ.createBytes=vY.createBytes,hQ.createDataView=hJ.createDataView,hQ.createDeferredPromise=m0.createDeferredPromise,hQ.createHex=vY.createHex,hQ.createModuleLogger=vC.createModuleLogger,hQ.createNumber=vY.createNumber,hQ.createProjectLogger=vC.createProjectLogger,hQ.exactOptional=gY.exactOptional,hQ.getChecksumAddress=hJ.getChecksumAddress,hQ.getErrorMessage=h0.getErrorMessage,hQ.getJsonRpcIdValidator=gY.getJsonRpcIdValidator,hQ.getJsonSize=gY.getJsonSize,hQ.getKnownPropertyNames=h1.getKnownPropertyNames,hQ.getSafeJson=gY.getSafeJson,hQ.gtRange=m6.gtRange,hQ.gtVersion=m6.gtVersion,hQ.hasProperty=h1.hasProperty,hQ.hexToBigInt=hZ.hexToBigInt,hQ.hexToBytes=hJ.hexToBytes,hQ.hexToNumber=hZ.hexToNumber,hQ.inMilliseconds=m1.inMilliseconds,hQ.isASCII=h1.isASCII,hQ.isBytes=hJ.isBytes,hQ.isCaipAccountAddress=vP.isCaipAccountAddress,hQ.isCaipAccountId=vP.isCaipAccountId,hQ.isCaipChainId=vP.isCaipChainId,hQ.isCaipNamespace=vP.isCaipNamespace,hQ.isCaipReference=vP.isCaipReference,hQ.isErrorWithCode=h0.isErrorWithCode,hQ.isErrorWithMessage=h0.isErrorWithMessage,hQ.isErrorWithStack=h0.isErrorWithStack,hQ.isHexString=hJ.isHexString,hQ.isJsonRpcError=gY.isJsonRpcError,hQ.isJsonRpcFailure=gY.isJsonRpcFailure,hQ.isJsonRpcNotification=gY.isJsonRpcNotification,hQ.isJsonRpcRequest=gY.isJsonRpcRequest,hQ.isJsonRpcResponse=gY.isJsonRpcResponse,hQ.isJsonRpcSuccess=gY.isJsonRpcSuccess,hQ.isNonEmptyArray=h1.isNonEmptyArray,hQ.isNullOrUndefined=h1.isNullOrUndefined,hQ.isObject=h1.isObject,hQ.isPendingJsonRpcResponse=gY.isPendingJsonRpcResponse,hQ.isPlainObject=h1.isPlainObject,hQ.isStrictHexString=hJ.isStrictHexString,hQ.isValidChecksumAddress=hJ.isValidChecksumAddress,hQ.isValidHexAddress=hJ.isValidHexAddress,hQ.isValidJson=gY.isValidJson,hQ.isValidSemVerRange=m6.isValidSemVerRange,hQ.isValidSemVerVersion=m6.isValidSemVerVersion,hQ.jsonrpc2=gY.jsonrpc2,hQ.numberToBytes=hJ.numberToBytes,hQ.numberToHex=hZ.numberToHex,hQ.object=gY.object,hQ.parseCaipAccountId=vP.parseCaipAccountId,hQ.parseCaipChainId=vP.parseCaipChainId,hQ.remove0x=hJ.remove0x,hQ.satisfiesVersionRange=m6.satisfiesVersionRange,hQ.signedBigIntToBytes=hJ.signedBigIntToBytes,hQ.stringToBytes=hJ.stringToBytes,hQ.timeSince=m1.timeSince,hQ.valueToBytes=hJ.valueToBytes,hQ.wrapError=h0.wrapError,Object.defineProperty(hY,"__esModule",{value:!0});var v5=hG.errorCodes.rpc.internal,v7={code:v5,message:be(v5)},v9="Unspecified server error.";function be(e,t="Unspecified error message. This is a bug, please report it."){if(bt(e)){let t=e.toString();if(hQ.hasProperty.call(void 0,hG.errorValues,t))return hG.errorValues[t].message;if(e>=-32099&&e<=-32e3)return v9}return t}function bt(e){return Number.isInteger(e)}function bn(e){return Array.isArray(e)?e.map(e=>hQ.isValidJson.call(void 0,e)?e:hQ.isObject.call(void 0,e)?br(e):null):hQ.isObject.call(void 0,e)?br(e):hQ.isValidJson.call(void 0,e)?e:null}function br(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{let r=e[n];return hQ.isValidJson.call(void 0,r)&&(t[n]=r),t},{})}hY.JSON_RPC_SERVER_ERROR_MESSAGE=v9,hY.getMessageFromCode=be,hY.isValidCode=bt,hY.serializeError=function(e,{fallbackError:t=v7,shouldIncludeStack:n=!0}={}){if(!hQ.isJsonRpcError.call(void 0,t))throw Error("Must provide fallback error with integer number code and string message.");let r=function(e,t){if(e&&"object"==typeof e&&"serialize"in e&&"function"==typeof e.serialize)return e.serialize();if(hQ.isJsonRpcError.call(void 0,e))return e;let n=bn(e);return{...t,data:{cause:n}}}(e,t);return n||delete r.stack,r},hY.serializeCause=bn,bu.default=bu,bu.stable=bf,bu.stableStringify=bf;var bi="[...]",bo="[Circular]",ba=[],bs=[];function bl(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function bu(e,t,n,r){var i;void 0===r&&(r=bl()),function e(t,n,r,i,o,a,s){var l;if(a+=1,"object"==typeof t&&null!==t){for(l=0;ls.depthLimit||void 0!==s.edgesLimit&&r+1>s.edgesLimit)return void bc(bi,t,n,o);if(i.push(t),Array.isArray(t))for(l=0;lt?1:0}function bf(e,t,n,r){void 0===r&&(r=bl());var i,o=function e(t,n,r,i,o,a,s){var l;if(a+=1,"object"==typeof t&&null!==t){for(l=0;ls.depthLimit||void 0!==s.edgesLimit&&r+1>s.edgesLimit)return void bc(bi,t,n,o);if(i.push(t),Array.isArray(t))for(l=0;l0)for(var r=0;rhY.getMessageFromCode.call(void 0,e)),r)}function bA(e,t){let[n,r]=bw(t);return new hW.EthereumProviderError(e,bb(n,()=>hY.getMessageFromCode.call(void 0,e)),r)}function bw(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:n}=e;if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[bb(t,()=>{}),n]}}return[]}hW.JsonRpcError=bg,hW.EthereumProviderError=class extends bg{constructor(e,t,n){if(!(Number.isInteger(e)&&e>=1e3&&e<=4999))throw Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}},Object.defineProperty(h$,"__esModule",{value:!0}),h$.rpcErrors={parse:e=>by(hG.errorCodes.rpc.parse,e),invalidRequest:e=>by(hG.errorCodes.rpc.invalidRequest,e),invalidParams:e=>by(hG.errorCodes.rpc.invalidParams,e),methodNotFound:e=>by(hG.errorCodes.rpc.methodNotFound,e),internal:e=>by(hG.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum RPC Server errors must provide single object argument.");let{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw Error('"code" must be an integer such that: -32099 <= code <= -32005');return by(t,e)},invalidInput:e=>by(hG.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>by(hG.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>by(hG.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>by(hG.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>by(hG.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>by(hG.errorCodes.rpc.limitExceeded,e)},h$.providerErrors={userRejectedRequest:e=>bA(hG.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>bA(hG.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>bA(hG.errorCodes.provider.unsupportedMethod,e),disconnected:e=>bA(hG.errorCodes.provider.disconnected,e),chainDisconnected:e=>bA(hG.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum Provider custom errors must provide single object argument.");let{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw Error('"message" must be a nonempty string');return new hW.EthereumProviderError(t,n,r)}},Object.defineProperty(hV,"__esModule",{value:!0}),hV.EthereumProviderError=hW.EthereumProviderError,hV.JsonRpcError=hW.JsonRpcError,hV.errorCodes=hG.errorCodes,hV.getMessageFromCode=hY.getMessageFromCode,hV.providerErrors=h$.providerErrors,hV.rpcErrors=h$.rpcErrors,hV.serializeCause=hY.serializeCause,hV.serializeError=hY.serializeError;var b_={};Object.defineProperty(b_,"__esModule",{value:!0});let bE=eV;function bS(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout(()=>{throw e})}}class bk extends bE.EventEmitter{emit(e,...t){let n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;let n=Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}let i=r[e];if(void 0===i)return!1;if("function"==typeof i)bS(i,this,t);else{let e=i.length,n=function(e){let t=e.length,n=Array(t);for(let r=0;r{"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}),bU(this,bR,[],"f"),bU(this,bx,!0,"f")}push(e){bq(this,bM,"m",bT).call(this),bq(this,bR,"f").push(e)}handle(e,t){if(bq(this,bM,"m",bT).call(this),t&&"function"!=typeof t)throw Error('"callback" must be a function if provided.');return Array.isArray(e)?t?bq(this,bM,"m",bO).call(this,e,t):bq(this,bM,"m",bO).call(this,e):t?bq(this,bM,"m",bP).call(this,e,t):this._promiseHandle(e)}asMiddleware(){return bq(this,bM,"m",bT).call(this),(e,t,n,r)=>bz(this,void 0,void 0,function*(){try{let[i,o,a]=yield bq(bV,bC,"m",bN).call(bV,e,t,bq(this,bR,"f"));return o?(yield bq(bV,bC,"m",bB).call(bV,a),r(i)):n(e=>bz(this,void 0,void 0,function*(){try{yield bq(bV,bC,"m",bB).call(bV,a)}catch(t){return e(t)}return e()}))}catch(e){return r(e)}})}_promiseHandle(e){return bz(this,void 0,void 0,function*(){return new Promise((t,n)=>{bq(this,bM,"m",bP).call(this,e,(e,r)=>{e&&void 0===r?n(e):t(r)}).catch(n)})})}}function b$(e){return JSON.stringify(e,null,2)}hH.JsonRpcEngine=bV,bC=bV,bx=new WeakMap,bR=new WeakMap,bI=new WeakMap,bM=new WeakSet,bT=function(){if(bq(this,bx,"f"))throw Error("This engine is destroyed and can no longer be used.")},bO=function(e,t){return bz(this,void 0,void 0,function*(){try{if(0===e.length){let e=[{id:null,jsonrpc:"2.0",error:new hV.JsonRpcError(hV.errorCodes.rpc.invalidRequest,"Request batch must contain plain objects. Received an empty array")}];return t?t(null,e):e}let n=(yield Promise.all(e.map(this._promiseHandle.bind(this)))).filter(e=>void 0!==e);return t?t(null,n):n}catch(e){if(t)return t(e);throw e}})},bP=function(e,t){var n;return bz(this,void 0,void 0,function*(){if(!e||Array.isArray(e)||"object"!=typeof e){let n=new hV.JsonRpcError(hV.errorCodes.rpc.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(n,{id:null,jsonrpc:"2.0",error:n})}if("string"!=typeof e.method){let r=new hV.JsonRpcError(hV.errorCodes.rpc.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});return bq(this,bI,"f")&&!(0,hQ.isJsonRpcRequest)(e)?t(null):t(r,{id:null!==(n=e.id)&&void 0!==n?n:null,jsonrpc:"2.0",error:r})}if(bq(this,bI,"f")&&!(0,hQ.isJsonRpcRequest)(e)){try{yield bq(this,bI,"f").call(this,e)}catch(e){return t(e)}return t(null)}let r=null,i=Object.assign({},e),o={id:i.id,jsonrpc:i.jsonrpc};try{yield bq(bV,bC,"m",bL).call(bV,i,o,bq(this,bR,"f"))}catch(e){r=e}return r&&(delete o.result,o.error||(o.error=(0,hV.serializeError)(r))),t(r,o)})},bL=function(e,t,n){return bz(this,void 0,void 0,function*(){let[r,i,o]=yield bq(bV,bC,"m",bN).call(bV,e,t,n);if(bq(bV,bC,"m",bj).call(bV,e,t,i),yield bq(bV,bC,"m",bB).call(bV,o),r)throw r})},bN=function(e,t,n){return bz(this,void 0,void 0,function*(){let r=[],i=null,o=!1;for(let a of n)if([i,o]=yield bq(bV,bC,"m",bD).call(bV,e,t,a,r),o)break;return[i,o,r.reverse()]})},bD=function(e,t,n,r){return bz(this,void 0,void 0,function*(){return new Promise(i=>{let o=e=>{let n=e||t.error;n&&(t.error=(0,hV.serializeError)(n)),i([n,!0])};try{n(e,t,n=>{t.error?o(t.error):(n&&("function"!=typeof n&&o(new hV.JsonRpcError(hV.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof n}" for request: +${b$(e)}`,{request:e})),r.push(n)),i([null,!1]))},o)}catch(e){o(e)}})})},bB=function(e){return bz(this,void 0,void 0,function*(){for(let t of e)yield new Promise((e,n)=>{t(t=>t?n(t):e())})})},bj=function(e,t,n){if(!(0,hQ.hasProperty)(t,"result")&&!(0,hQ.hasProperty)(t,"error"))throw new hV.JsonRpcError(hV.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request: +${b$(e)}`,{request:e});if(!n)throw new hV.JsonRpcError(hV.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request: +${b$(e)}`,{request:e})};var bW={};Object.defineProperty(bW,"__esModule",{value:!0}),bW.mergeMiddleware=void 0,bW.mergeMiddleware=function(e){let t=new hH.JsonRpcEngine;return e.forEach(e=>t.push(e)),t.asMiddleware()},yd=l&&l.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),yf=l&&l.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||yd(t,e,n)},Object.defineProperty(hB,"__esModule",{value:!0}),yf(hj,hB),yf(hz,hB),yf(hU,hB),yf(hK,hB),yf(hH,hB),yf(bW,hB);var bY={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function bG(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}var bQ=(e,t)=>Object.hasOwnProperty.call(e,t),bZ=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}},bJ=e=>pI(e);function bX({path:e,branch:t}){let n=e[e.length-1];return bQ(t[t.length-2],n)}function b0(e){return new pp({...e,type:`optional ${e.type}`,validator:(t,n)=>!bX(n)||e.validator(t,n),refiner:(t,n)=>!bX(n)||e.refiner(t,n)})}var b1=pN([pM(null),pS(),pA("finite number",e=>pb(e,pR())&&Number.isFinite(e)),pP(),pE(pw(()=>b1)),pO(pP(),pw(()=>b1))]),b2=pB(b1,p_(),e=>((function(e,t,n="Assertion failed",r=bZ){try{pm(e,t)}catch(e){var i;throw i=`${n}: ${("object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:null==e?"":String(e)).replace(/\.$/u,"")}.`,"string"==typeof r?.prototype?.constructor?.name?new r({message:i}):r({message:i})}})(e,b1),JSON.parse(JSON.stringify(e,(e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))));function b3(e){try{return pg(e,b2),!0}catch{return!1}}var b6=pM("2.0"),b4=px(pN([pR(),pP()])),b8=bJ({code:pk(),message:pP(),data:b0(b2),stack:b0(pP())}),b5=pN([pO(pP(),b2),pE(b2)]);function b7(e,t="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){let t=e.toString();if(bQ(bY,t))return bY[t].message;if(e>=-32099&&e<=-32e3)return"Unspecified server error."}return t}function b9(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{let r=e[n];return b3(r)&&(t[n]=r),t},{})}bJ({id:b4,jsonrpc:b6,method:pP(),params:b0(b5)}),bJ({jsonrpc:b6,method:pP(),params:b0(b5)}),pI({id:b4,jsonrpc:b6,result:pT(pD()),error:pT(b8)}),pN([bJ({id:b4,jsonrpc:b6,result:b2}),bJ({id:b4,jsonrpc:b6,error:b8})]),b7(-32603);var ye=class extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a non-empty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){var e;let t={code:this.code,message:this.message};return void 0!==this.data&&(t.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(this.data)&&(t.data.cause=Array.isArray(e=this.data.cause)?e.map(e=>b3(e)?e:bG(e)?b9(e):null):bG(e)?b9(e):b3(e)?e:null)),this.stack&&(t.stack=this.stack),t}toString(){return bp(this.serialize(),yt,2)}};function yt(e,t){if("[Circular]"!==t)return t}var yn=e=>(function(e,t){let[n,r]=function(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:n}=e;if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t??void 0,n]}}return[]}(t);return new ye(-32600,n??b7(-32600),r)})(-32600,e),yr=Object.freeze(["eth_subscription"]),yi=(e=console)=>[hB.createIdRemapMiddleware(),(t,n,r)=>{"string"==typeof t.method&&t.method||(n.error=yn({message:"The request 'method' must be a non-empty string.",data:t})),r(t=>{let{error:r}=n;return r&&e.error(`MetaMask - RPC Error: ${r.message}`,r),t()})},function(e){let t={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1};return(n,r,i)=>{t.ethDecryptDeprecation||"eth_decrypt"!==n.method?t.ethGetEncryptionPublicKeyDeprecation||"eth_getEncryptionPublicKey"!==n.method?!t.walletWatchAssetNFTExperimental&&"wallet_watchAsset"===n.method&&["ERC721","ERC1155"].includes(n.params?.type||"")&&(e.warn(hD.warnings.rpc.walletWatchAssetNFTExperimental),t.walletWatchAssetNFTExperimental=!0):(e.warn(hD.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),t.ethGetEncryptionPublicKeyDeprecation=!0):(e.warn(hD.warnings.rpc.ethDecryptDeprecation),t.ethDecryptDeprecation=!0),i()}}(e)],yo=(e,t,n=!0)=>(r,i)=>{r||i.error?t(r||i.error):!n||Array.isArray(i)?e(i):e(i.result)},ya=e=>!!e&&"string"==typeof e&&e.startsWith("0x"),ys=()=>{};async function yl(e,t){try{let t=await async function(){return{name:function(e){let{document:t}=e,n=t.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;let r=t.querySelector('head > meta[name="title"]');return r?r.content:t.title&&t.title.length>0?t.title:window.location.hostname}(window),icon:await yu(window)}}();e.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:t},ys)}catch(e){t.error({message:hD.errors.sendSiteMetadata(),originalError:e})}}async function yu(e){let{document:t}=e;for(let e of Array.from(t.querySelectorAll('head > link[rel~="icon"]')))if(e&&await yc(e.href))return e.href;return null}async function yc(e){return new Promise((t,n)=>{try{let n=document.createElement("img");n.onload=()=>t(!0),n.onerror=()=>t(!1),n.src=e}catch(e){n(e)}})}var yd,yf,yh,yp,ym=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},yg=(e,t,n)=>(ym(e,t,"read from private field"),n?n.call(e):t.get(e)),yv=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},yb=(e,t,n,r)=>(ym(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),yy=u(function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var r,i,o,a=o[i];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}),yA=class e extends bF{constructor({logger:t=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),yv(this,yh,void 0),yv(this,yp,void 0),this._log=t,this.setMaxListeners(n),this._state={...e._defaultState},yb(this,yp,null),yb(this,yh,null),this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleConnect=this._handleConnect.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this.request=this.request.bind(this);let i=new hB.JsonRpcEngine;r.forEach(e=>i.push(e)),this._rpcEngine=i}get chainId(){return yg(this,yh)}get selectedAddress(){return yg(this,yp)}isConnected(){return this._state.isConnected}async request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw yn({message:hD.errors.invalidRequestArgs(),data:e});let{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw yn({message:hD.errors.invalidRequestMethod(),data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw yn({message:hD.errors.invalidRequestParams(),data:e});let r=null==n?{method:t}:{method:t,params:n};return new Promise((e,t)=>{this._rpcRequest(r,yo(e,t))})}_initializeState(e){if(this._state.initialized)throw Error("Provider already initialized.");if(e){let{accounts:t,chainId:n,isUnlocked:r,networkVersion:i}=e;this._handleConnect(n),this._handleChainChanged({chainId:n,networkVersion:i}),this._handleUnlockStateChanged({accounts:t,isUnlocked:r}),this._handleAccountsChanged(t)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,t){let n=t;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),"eth_accounts"!==e.method&&"eth_requestAccounts"!==e.method||(n=(n,r)=>{this._handleAccountsChanged(r.result??[],"eth_accounts"===e.method),t(n,r)})),this._rpcEngine.handle(e,n)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(hD.info.connected(e)))}_handleDisconnect(e,t){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let n;this._state.isConnected=!1,e?(n=new ye(1013,t??hD.errors.disconnected()),this._log.debug(n)):(n=new ye(1011,t??hD.errors.permanentlyDisconnected()),this._log.error(n),yb(this,yh,null),this._state.accounts=null,yb(this,yp,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",n)}}_handleChainChanged({chainId:e}={}){ya(e)?(this._handleConnect(e),e!==yg(this,yh)&&(yb(this,yh,e),this._state.initialized&&this.emit("chainChanged",yg(this,yh)))):this._log.error(hD.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,t=!1){let n=e;for(let t of(Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),n=[]),e))if("string"!=typeof t){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),n=[];break}if(!yy(this._state.accounts,n)&&(t&&null!==this._state.accounts&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",n),this._state.accounts=n,yg(this,yp)!==n[0]&&yb(this,yp,n[0]||null),this._state.initialized)){let e=[...n];this.emit("accountsChanged",e)}}_handleUnlockStateChanged({accounts:e,isUnlocked:t}={}){"boolean"==typeof t?t!==this._state.isUnlocked&&(this._state.isUnlocked=t,this._handleAccountsChanged(e??[])):this._log.error("MetaMask: Received invalid isUnlocked parameter. Please report this bug.")}};yh=new WeakMap,yp=new WeakMap,yA._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var yw=yA,y_={},yE={};Object.defineProperty(yE,"__esModule",{value:!0}),yE.default=function(e){if(!(null==e?void 0:e.engine))throw Error("Missing engine parameter!");let{engine:t}=e,n=new ni.Duplex({objectMode:!0,read:()=>{},write:function(e,r,i){t.handle(e,(e,t)=>{n.push(t)}),i()}});return t.on&&t.on("notification",e=>{n.push(e)}),n};var yS={},yk=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yS,"__esModule",{value:!0});let yM=yk(b_);yS.default=function(e={}){let t={},n=new ni.Duplex({objectMode:!0,read:()=>{},write:function(i,o,a){let s=null;try{i.id?function(e){let{id:n}=e;if(null===n)return;let r=t[n];if(!r)return void console.warn(`StreamMiddleware - Unknown response id "${n}"`);delete t[n],Object.assign(r.res,e),setTimeout(r.end)}(i):((null==e?void 0:e.retryOnMessage)&&i.method===e.retryOnMessage&&Object.values(t).forEach(({req:e,retryCount:r=0})=>{if(!e.id)return;if(r>=3)throw Error(`StreamMiddleware - Retry limit exceeded for request id "${e.id}"`);let i=t[e.id];i&&(i.retryCount=r+1),n.push(e)}),r.emit("notification",i))}catch(e){s=e}a(s)}}),r=new yM.default;return{events:r,middleware:(e,r,i,o)=>{t[e.id]={req:e,res:r,next:i,end:o},n.push(e)},stream:n}};var yC=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(y_,"__esModule",{value:!0});var yx=y_.createStreamMiddleware=y_.createEngineStream=void 0;let yR=yC(yE);y_.createEngineStream=yR.default;let yI=yC(yS);yx=y_.createStreamMiddleware=yI.default;var yT={},yO={exports:{}},yP=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw TypeError("need wrapper function");return Object.keys(t).forEach(function(e){r[e]=t[e]}),r;function r(){for(var e=Array(arguments.length),n=0;nt.destroy(e||void 0)),t}ignoreStream(e){if(!e)throw Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw Error(`ObjectMultiplex - Substream for name "${e}" already exists`);this._substreams[e]=yK}_read(){}_write(e,t,n){let{name:r,data:i}=e;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${e}"`),n();let o=this._substreams[r];return o?o!==yK&&o.push(i):console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n()}};yT.ObjectMultiplex=yH;var yV=u(yT.ObjectMultiplex);let y$=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;y$.writable=e=>y$(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,y$.readable=e=>y$(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,y$.duplex=e=>y$.writable(e)&&y$.readable(e),y$.transform=e=>y$.duplex(e)&&"function"==typeof e._transform;var yW,yY=class extends yw{constructor(e,{jsonRpcStreamName:t,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!y$.duplex(e))throw Error(hD.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);let o=new yV;ni.pipeline(e,o,e,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=yx({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),ni.pipeline(this._jsonRpcConnection.stream,o.createStream(t),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",t=>{let{method:n,params:r}=t;"metamask_accountsChanged"===n?this._handleAccountsChanged(r):"metamask_unlockStateChanged"===n?this._handleUnlockStateChanged(r):"metamask_chainChanged"===n?this._handleChainChanged(r):yr.includes(n)?this.emit("message",{type:n,data:r}):"METAMASK_STREAM_FAILURE"===n&&e.destroy(Error(hD.errors.permanentlyDisconnected()))})}async _initializeStateAsync(){let e;try{e=await this.request({method:"metamask_getProviderState"})}catch(e){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e)}this._initializeState(e)}_handleStreamDisconnect(e,t){let n=`MetaMask: Lost connection to "${e}".`;t?.stack&&(n+=` +${t.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,t?t.message:void 0)}_handleChainChanged({chainId:e,networkVersion:t}={}){let n;ya(e)&&(n=t)&&"string"==typeof n?"loading"===t?this._handleDisconnect(!0):super._handleChainChanged({chainId:e}):this._log.error(hD.errors.invalidNetworkParams(),{chainId:e,networkVersion:t})}},yG=class extends yY{constructor(e,{jsonRpcStreamName:t="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,rpcMiddleware:yi(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},yv(this,yW,void 0),this._initializeStateAsync(),yb(this,yW,null),this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",e=>{let{method:t}=e;yr.includes(t)&&(this.emit("data",e),this.emit("notification",e.params.result))}),i){if("complete"===document.readyState)yl(this._rpcEngine,this._log);else{let e=()=>{yl(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",e)};window.addEventListener("DOMContentLoaded",e)}}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(hD.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(hD.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),yg(this,yW)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(hD.warnings.selectedAddressDeprecation),this._sentWarnings.selectedAddress=!0),super.selectedAddress}sendAsync(e,t){this._rpcRequest(e,t)}addListener(e,t){return this._warnOfDeprecation(e),super.addListener(e,t)}on(e,t){return this._warnOfDeprecation(e),super.on(e,t)}once(e,t){return this._warnOfDeprecation(e),super.once(e,t)}prependListener(e,t){return this._warnOfDeprecation(e),super.prependListener(e,t)}prependOnceListener(e,t){return this._warnOfDeprecation(e),super.prependOnceListener(e,t)}_handleDisconnect(e,t){super._handleDisconnect(e,t),yg(this,yW)&&!e&&yb(this,yW,null)}_warnOfDeprecation(e){!1===this._sentWarnings?.events[e]&&(this._log.warn(hD.warnings.events[e]),this._sentWarnings.events[e]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(hD.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise((e,t)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},yo(e,t))}catch(e){t(e)}})}send(e,t){return this._sentWarnings.send||(this._log.warn(hD.warnings.sendDeprecation),this._sentWarnings.send=!0),"string"!=typeof e||t&&!Array.isArray(t)?e&&"object"==typeof e&&"function"==typeof t?this._rpcRequest(e,t):this._sendSync(e):new Promise((n,r)=>{try{this._rpcRequest({method:e,params:t},yo(n,r,!1))}catch(e){r(e)}})}_sendSync(e){let t;switch(e.method){case"eth_accounts":t=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":t=this.selectedAddress??null;break;case"eth_uninstallFilter":this._rpcRequest(e,ys),t=!0;break;case"net_version":t=yg(this,yW)??null;break;default:throw Error(hD.errors.unsupportedSync(e.method))}return{id:e.id,jsonrpc:e.jsonrpc,result:t}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise(e=>{this.on("_initialized",()=>e())}),this._state.isUnlocked),requestBatch:async e=>{if(!Array.isArray(e))throw yn({message:"Batch requests must be made with an array of request objects.",data:e});return new Promise((t,n)=>{this._rpcRequest(e,yo(t,n))})}},{get:(e,t,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(hD.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(e,t,...n))})}_handleChainChanged({chainId:e,networkVersion:t}={}){super._handleChainChanged({chainId:e,networkVersion:t}),this._state.isConnected&&t!==yg(this,yW)&&(yb(this,yW,t),this._state.initialized&&this.emit("networkChanged",yg(this,yW)))}};yW=new WeakMap;let yQ=vT("MM_SDK");yQ.color="#FFAC1C";var yZ={},yJ={};Object.defineProperty(yJ,"__esModule",{value:!0}),yJ.EthereumProviderError=yJ.EthereumRpcError=void 0;class yX extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){let e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return bu.default(this.serialize(),y0,2)}}function y0(e,t){if("[Circular]"!==t)return t}yJ.EthereumRpcError=yX,yJ.EthereumProviderError=class extends yX{constructor(e,t,n){if(!(Number.isInteger(e)&&e>=1e3&&e<=4999))throw Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}};var y1={},y2={};Object.defineProperty(y2,"__esModule",{value:!0}),y2.errorValues=y2.errorCodes=void 0,y2.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},y2.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;let t=y2.errorCodes.rpc.internal,n={code:t,message:r(t)};function r(t,n="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(t)){let n=t.toString();if(a(y2.errorValues,n))return y2.errorValues[n].message;if(t>=-32099&&t<=-32e3)return e.JSON_RPC_SERVER_ERROR_MESSAGE}return n}function i(e){if(!Number.isInteger(e))return!1;let t=e.toString();return!!y2.errorValues[t]||!!(e>=-32099&&e<=-32e3)}function o(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=r,e.isValidCode=i,e.serializeError=function(e,{fallbackError:t=n,shouldIncludeStack:s=!1}={}){if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw Error("Must provide fallback error with integer number code and string message.");if(e instanceof yJ.EthereumRpcError)return e.serialize();let l={};if(e&&"object"==typeof e&&!Array.isArray(e)&&a(e,"code")&&i(e.code))l.code=e.code,e.message&&"string"==typeof e.message?(l.message=e.message,a(e,"data")&&(l.data=e.data)):(l.message=r(l.code),l.data={originalError:o(e)});else{l.code=t.code;let n=null==e?void 0:e.message;l.message=n&&"string"==typeof n?n:t.message,l.data={originalError:o(e)}}let u=null==e?void 0:e.stack;return s&&e&&u&&"string"==typeof u&&(l.stack=u),l}}(y1);var y3={};function y6(e,t){let[n,r]=y8(t);return new yJ.EthereumRpcError(e,n||y1.getMessageFromCode(e),r)}function y4(e,t){let[n,r]=y8(t);return new yJ.EthereumProviderError(e,n||y1.getMessageFromCode(e),r)}function y8(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:n}=e;if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t||void 0,n]}}return[]}Object.defineProperty(y3,"__esModule",{value:!0}),y3.ethErrors=void 0,y3.ethErrors={rpc:{parse:e=>y6(y2.errorCodes.rpc.parse,e),invalidRequest:e=>y6(y2.errorCodes.rpc.invalidRequest,e),invalidParams:e=>y6(y2.errorCodes.rpc.invalidParams,e),methodNotFound:e=>y6(y2.errorCodes.rpc.methodNotFound,e),internal:e=>y6(y2.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum RPC Server errors must provide single object argument.");let{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw Error('"code" must be an integer such that: -32099 <= code <= -32005');return y6(t,e)},invalidInput:e=>y6(y2.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>y6(y2.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>y6(y2.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>y6(y2.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>y6(y2.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>y6(y2.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>y4(y2.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>y4(y2.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>y4(y2.errorCodes.provider.unsupportedMethod,e),disconnected:e=>y4(y2.errorCodes.provider.disconnected,e),chainDisconnected:e=>y4(y2.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum Provider custom errors must provide single object argument.");let{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw Error('"message" must be a nonempty string');return new yJ.EthereumProviderError(t,n,r)}}},Object.defineProperty(yZ,"__esModule",{value:!0}),yZ.getMessageFromCode=yZ.serializeError=yZ.EthereumProviderError=yZ.EthereumRpcError=yZ.ethErrors=yZ.errorCodes=void 0,Object.defineProperty(yZ,"EthereumRpcError",{enumerable:!0,get:function(){return yJ.EthereumRpcError}}),Object.defineProperty(yZ,"EthereumProviderError",{enumerable:!0,get:function(){return yJ.EthereumProviderError}}),Object.defineProperty(yZ,"serializeError",{enumerable:!0,get:function(){return y1.serializeError}}),Object.defineProperty(yZ,"getMessageFromCode",{enumerable:!0,get:function(){return y1.getMessageFromCode}}),Object.defineProperty(yZ,"ethErrors",{enumerable:!0,get:function(){return y3.ethErrors}}),Object.defineProperty(yZ,"errorCodes",{enumerable:!0,get:function(){return y2.errorCodes}});let y5={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_GETPERMISSIONS:"wallet_getPermissions",WALLET_WATCHASSET:"wallet_watchAsset",WALLET_ADDETHEREUMCHAIN:"wallet_addEthereumChain",WALLET_SWITCHETHETHEREUMCHAIN:"wallet_switchEthereumChain",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},y7={[y5.ETH_REQUESTACCOUNTS]:!0,[y5.ETH_SENDTRANSACTION]:!0,[y5.ETH_SIGNTRANSACTION]:!0,[y5.ETH_SIGN]:!0,[y5.ETH_ACCOUNTS]:!0,[y5.PERSONAL_SIGN]:!0,[y5.ETH_SIGNTYPEDDATA]:!0,[y5.ETH_SIGNTYPEDDATA_V3]:!0,[y5.ETH_SIGNTYPEDDATA_V4]:!0,[y5.WALLET_REQUESTPERMISSIONS]:!0,[y5.WALLET_GETPERMISSIONS]:!0,[y5.WALLET_WATCHASSET]:!0,[y5.WALLET_ADDETHEREUMCHAIN]:!0,[y5.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[y5.METAMASK_CONNECTSIGN]:!0,[y5.METAMASK_CONNECTWITH]:!0,[y5.PERSONAL_EC_RECOVER]:!0,[y5.METAMASK_BATCH]:!0,[y5.METAMASK_OPEN]:!0},y9=Object.keys(y7).map(e=>e.toLowerCase()),Ae=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map(e=>e.toLowerCase()),At=".sdk-comm",An="providerType",Ar=".MMSDK_cached_address",Ai=".MMSDK_cached_chainId",Ao={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"};class Aa{constructor({enabled:e}={enabled:!1}){this.enabled=!1,this.enabled=e}persistChannelConfig(e){return hP(this,void 0,void 0,function*(){let t=JSON.stringify(e);yQ(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,e),localStorage.setItem(At,t)})}getPersistedChannelConfig(){return hP(this,void 0,void 0,function*(){let e;try{if(yQ(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),e=localStorage.getItem(At),yQ("[StorageManagerWeb: getPersistedChannelConfig()]",e),!e)return;let t=JSON.parse(e);return yQ("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",t),t}catch(e){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",e)}})}persistAccounts(e){return hP(this,void 0,void 0,function*(){yQ(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,e);let t=JSON.stringify(e);localStorage.setItem(Ar,t)})}getCachedAccounts(){return hP(this,void 0,void 0,function*(){try{let e=localStorage.getItem(Ar);return e?JSON.parse(e):[]}catch(e){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",e),e}})}persistChainId(e){return hP(this,void 0,void 0,function*(){yQ(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,e),localStorage.setItem(Ai,e)})}getCachedChainId(){return hP(this,void 0,void 0,function*(){try{let e=localStorage.getItem(Ai);return null!=e?e:void 0}catch(e){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",e),e}})}terminate(){return hP(this,void 0,void 0,function*(){yQ(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(At)})}}let As=e=>new Aa(e);class Al extends yG{constructor({connectionStream:e,shouldSendMetadata:t,autoRequestAccounts:n=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:t}),this.state={autoRequestAccounts:!1,providerStateRequested:!1,chainId:"",networkVersion:""},yQ(`[SDKProvider: constructor()] autoRequestAccounts=${n}`),this.state.autoRequestAccounts=n}forceInitializeState(){return hP(this,void 0,void 0,function*(){return yQ(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()})}_setConnected(){yQ("[SDKProvider: _setConnected()] Setting connected state"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}getSelectedAddress(){var e;let{accounts:t}=this._state;return t&&0!==t.length?(null===(e=t[0])||void 0===e?void 0:e.toLowerCase())||"":(yQ("[SDKProvider: getSelectedAddress] No accounts found"),null)}getChainId(){return this.state.chainId}getNetworkVersion(){return this.state.networkVersion}setSDKProviderState(e){this.state=Object.assign(Object.assign({},this.state),e)}handleDisconnect({terminate:e=!1}){!function({terminate:e=!1,instance:t}){let{state:n}=t;t.isConnected()?(yQ(`[SDKProvider: handleDisconnect()] cleaning up provider state terminate=${e}`,t),e&&(t._state.accounts=null,t._state.isUnlocked=!1,t._state.isPermanentlyDisconnected=!0,t._state.initialized=!1),t._handleAccountsChanged([]),t._state.isConnected=!1,t.emit("disconnect",yZ.ethErrors.provider.disconnected()),n.providerStateRequested=!1):yQ("[SDKProvider: handleDisconnect()] not connected --- interrupt disconnection")}({terminate:e,instance:this})}_initializeStateAsync(){return hP(this,void 0,void 0,function*(){return function(e){var t,n;return hP(this,void 0,void 0,function*(){let r;void 0===e.state&&(e.state={autoRequestAccounts:!1,providerStateRequested:!1,chainId:""});let{state:i}=e;if(i.providerStateRequested)yQ("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let o;i.providerStateRequested=!0;let a=null,s=!1,l=!1,u=As({enabled:!0});if(u){let e=yield u.getPersistedChannelConfig();s=null!==(t=null==e?void 0:e.relayPersistence)&&void 0!==t&&t,o=yield u.getCachedChainId();let n=yield u.getCachedAccounts();n.length>0&&(a=n[0])}if(yQ(`[SDKProvider: initializeStateAsync()] relayPersistence=${s}`,{relayPersistence:s,cachedChainId:o,cachedSelectedAddress:a}),s){if(o&&a)r={accounts:[a],chainId:o,isUnlocked:!1},l=!0;else try{r=yield e.request({method:"metamask_getProviderState"})}catch(t){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",t),void(i.providerStateRequested=!1)}}if(0===(null===(n=null==r?void 0:r.accounts)||void 0===n?void 0:n.length)){if(e.getSelectedAddress())r.accounts=[e.getSelectedAddress()];else{yQ("[SDKProvider: initializeStateAsync()] Fetch accounts remotely.");let t=yield e.request({method:"eth_requestAccounts",params:[]});r.accounts=t}}e._initializeState(r),i.providerStateRequested=!1,l&&(e._state.isConnected=!0,e.emit("connect",{chainId:null==r?void 0:r.chainId}))}})}(this)})}_initializeState(e){var t;return yQ("[SDKProvider: _initializeState()]",e),t=super._initializeState.bind(this),yQ("[SDKProvider: initializeState()] set state._initialized to false"),this._state.initialized=!1,t(e)}_handleChainChanged({chainId:e,networkVersion:t}={}){this.state.chainId=e,this.state.networkVersion=t,function({instance:e,chainId:t,networkVersion:n,superHandleChainChanged:r}){yQ(`[SDKProvider: handleChainChanged()] chainId=${t} networkVersion=${n}`);let i=n;n||(yQ("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),i="1"),e._state.isConnected=!0,e.emit("connect",{chainId:t}),r({chainId:t,networkVersion:i})}({instance:this,chainId:e,networkVersion:t,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var Au={exports:{}};!function(e){var t=Object.hasOwnProperty,n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r="object"==typeof ex,i="function"==typeof Symbol,o="object"==typeof Reflect,a="function"==typeof setImmediate?setImmediate:setTimeout,s=i?o&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function l(){this._events={},this._conf&&u.call(this,this._conf)}function u(t){t&&(this._conf=t,t.delimiter&&(this.delimiter=t.delimiter),t.maxListeners!==e&&(this._maxListeners=t.maxListeners),t.wildcard&&(this.wildcard=t.wildcard),t.newListener&&(this._newListener=t.newListener),t.removeListener&&(this._removeListener=t.removeListener),t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak),t.ignoreErrors&&(this.ignoreErrors=t.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function c(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==ex&&ex.emitWarning){var r=Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,ex.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var d=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=Array(r);r--;)i[r]=arguments[r];return i}};function f(t,n){for(var r={},i=t.length,o=n?n.length:0,a=0;a0;)if(o===e[a])return r;i(t)}}Object.assign(h.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,a=this._listeners,s=function(){var r=d.apply(null,arguments),a={data:r,name:t,original:e};n?!1!==n.call(i,a)&&o.emit.apply(o,[a.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===a[e]&&(a[e]=s,r._on.call(i,e,s))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&a[e]&&(a[e]=null,r._off.call(i,e,s))},a[e]=null,o.on("removeListener",this._onRemoveListener)):(a[e]=s,r._on.call(i,e,s))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,a=this._emitter,l=this._off,u=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=A.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=o[e]))return;l.call(u,e,t),delete o[e],--this._listenersCount||c()}else{for(r=(n=s(o)).length;r-- >0;)e=n[r],l.call(u,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var v=g(["function"]),b=g(["object","function"]);function y(e,t,n){var r,i,o,a=0,s=new e(function(l,u,c){function d(){i&&(i=null),a&&(clearTimeout(a),a=0)}r=!(n=p(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}})).overload&&"function"==typeof e.prototype.cancel&&"function"==typeof c;var f=function(e){d(),l(e)},h=function(e){d(),u(e)};r?t(f,h,c):(i=[function(e){h(e||Error("canceled"))}],t(f,h,function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)}),o=!0),n.timeout>0&&(a=setTimeout(function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,s.cancel(e),u(e)},n.timeout))});return r||(s.cancel=function(e){if(i){for(var t=i.length,n=1;n0;)"_listeners"!==(h=b[l])&&(y=w(e,t,n[h],r+1,i))&&(A?A.push.apply(A,y):A=y);return A}if("**"===_){for((v=r+1===i||r+2===i&&"*"===E)&&n._listeners&&(A=w(e,t,n,i,i)),l=(b=s(n)).length;l-- >0;)"_listeners"!==(h=b[l])&&("*"===h||"**"===h?(n[h]._listeners&&!v&&(y=w(e,t,n[h],i,i))&&(A?A.push.apply(A,y):A=y),y=w(e,t,n[h],r,i)):y=w(e,t,n[h],h===E?r+2:r,i),y&&(A?A.push.apply(A,y):A=y));return A}n[_]&&(A=w(e,t,n[_],r+1,i))}if((p=n["*"])&&w(e,t,p,r+1,i),m=n["**"]){if(r0;)"_listeners"!==(h=b[l])&&(h===E?w(e,t,m[h],r+2,i):h===_?w(e,t,m[h],r+1,i):((g={})[h]=m[h],w(e,t,{"**":g},r+1,i)));else m._listeners?w(e,t,m,i,i):m["*"]&&m["*"]._listeners&&w(e,t,m["*"],i,i)}return A}function _(e,t,n){var r,i,o=0,a=0,s=this.delimiter,l=s.length;if("string"==typeof e){if(-1!==(r=e.indexOf(s))){i=[,,,,,];do i[o++]=e.slice(a,r),a=r+l;while(-1!==(r=e.indexOf(s,a)));i[o++]=e.slice(a)}else i=[e],o=1}else i=e,o=e.length;if(o>1){for(r=0;r+10&&d._listeners.length>this._maxListeners&&(d._listeners.warned=!0,c.call(this,d._listeners.length,u))):d._listeners=t,!0;return!0}function E(e,t,n,r){for(var i,o,a,l,u=s(e),c=u.length,d=e._listeners;c-- >0;)i=e[o=u[c]],a="_listeners"===o?n:n?n.concat(o):[o],l=r||"symbol"==typeof o,d&&t.push(l?a:a.join(this.delimiter)),"object"==typeof i&&E.call(this,i,t,a,l);return t}function S(e){for(var t,n,r,i=s(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||S(t)||delete e[n]);return r}function k(e,t,n){this.emitter=e,this.event=t,this.listener=n}function M(t,n,i){if(!0===i)s=!0;else if(!1===i)o=!0;else{if(!i||"object"!=typeof i)throw TypeError("options should be an object or true");var o=i.async,s=i.promisify,l=i.nextTick,u=i.objectify}if(o||l||s){var c=n,d=n._origin||n;if(l&&!r)throw Error("process.nextTick is not supported");s===e&&(s="AsyncFunction"===n.constructor.name),(n=function(){var e=arguments,t=this,n=this.event;return s?l?Promise.resolve():new Promise(function(e){a(e)}).then(function(){return t.event=n,c.apply(t,e)}):(l?ew:a)(function(){t.event=n,c.apply(t,e)})})._async=!0,n._origin=d}return[n,u?new k(this,t,n):this]}function C(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,u.call(this,e)}k.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},C.EventEmitter2=C,C.prototype.listenTo=function(t,r,i){if("object"!=typeof t)throw TypeError("target musts be an object");var o=this;return i=p(i,{on:e,off:e,reducers:e},{on:v,off:v,reducers:b}),function(e){if("object"!=typeof e)throw TypeError("events must be an object");var n,r=i.reducers,a=A.call(o,t);n=-1===a?new h(o,t,i):o._observers[a];for(var l,u=s(e),c=u.length,d="function"==typeof r,f=0;f0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},C.prototype.delimiter=".",C.prototype.setMaxListeners=function(t){t!==e&&(this._maxListeners=t,this._conf||(this._conf={}),this._conf.maxListeners=t)},C.prototype.getMaxListeners=function(){return this._maxListeners},C.prototype.event="",C.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},C.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},C.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},C.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},C.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},C.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),n.apply(this,arguments)}return a._origin=n,this._on(e,a,r,i)},C.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,o,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(n=s.length,i){for(r=0;r3)for(t=Array(d-1),o=1;o3)for(n=Array(f-1),a=1;a0&&this._events[t].length>this._maxListeners&&(this._events[t].warned=!0,c.call(this,this._events[t].length,t))):this._events[t]=n,a},C.prototype.off=function(e,t){if("function"!=typeof t)throw Error("removeListener only takes instances of Function");var r,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=w.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],i.push({_listeners:r})}for(var a=0;a0){for(n=0,r=(t=this._all).length;n0;)"function"==typeof(r=l[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var u=[],c="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,u,c,a,0),u}return l&&(r=l[t])?"function"==typeof r?[r]:r:[]},C.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.call(this,this.listenerTree,[],null,e):t?s(t):[]},C.prototype.listenerCount=function(e){return this.listeners(e).length},C.prototype.hasListeners=function(t){if(this.wildcard){var n=[],r="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(t===e?s(i).length:i[t]))},C.prototype.listenersAny=function(){return this._all?this._all:[]},C.prototype.waitFor=function(t,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),y((n=p(n,{timeout:0,filter:e,handleError:!1,Promise:Promise,overload:!1},{filter:v,Promise:m})).Promise,function(e,i,o){function a(){var o=n.filter;if(!o||o.apply(r,arguments)){if(r.off(t,a),n.handleError){var s=arguments[0];s?i(s):e(d.apply(null,arguments).slice(1))}else e(d.apply(null,arguments))}}o(function(){r.off(t,a)}),r._on(t,a,!1)},{timeout:n.timeout,overload:n.overload})};var x=C.prototype;Object.defineProperties(C,{defaultMaxListeners:{get:function(){return x._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");x._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return y((n=p(n,{Promise:Promise,timeout:0,overload:!1},{Promise:m})).Promise,function(n,r,i){if("function"==typeof e.addEventListener)return o=function(){n(d.apply(null,arguments))},i(function(){e.removeEventListener(t,o)}),void e.addEventListener(t,o,{once:!0});var o,a,s=function(){a&&e.removeListener("error",a),n(d.apply(null,arguments))};"error"!==t&&(a=function(n){e.removeListener(t,s),r(n)},e.once("error",a)),i(function(){a&&e.removeListener("error",a),e.removeListener(t,s)}),e.once(t,s)},{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(x,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof e&&e.amd?e(function(){return C}):Au.exports=C}();var Ac=u(Au.exports);function Ad(e){return(Ad="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Af(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function Ah(e){var t=function(e,t){if("object"!==Ad(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ad(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ad(t)?t:String(t)}function Ap(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&void 0!==arguments[1]?arguments[1]:{};Af(this,e),this.init(t,n)}return Am(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Ak,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=Array(e),n=0;n1?t-1:0),r=1;r-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var a=r(o.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function AT(e,t,n){var r=AI(e,t,Object);r.obj[r.k]=n}function AO(e,t){var n=AI(e,t),r=n.obj,i=n.k;if(r)return r[i]}function AP(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var AL={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function AN(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return AL[e]}):e}var AD="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,AB=[" ",",","?","!",";"];function Aj(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;oo+a;)a++,l=i[s=r.slice(o,o+a).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(s)){if("string"==typeof l)return l;if(s&&"string"==typeof l[s])return l[s]}var u=r.slice(o+a).join(n);return u?Aj(l,u,n):void 0}i=i[r[o]]}return i}}function AF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Az(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Af(this,r),t=n.call(this),AD&&AC.call(Ag(t)),t.data=e||{},t.options=i,void 0===t.options.keySeparator&&(t.options.keySeparator="."),void 0===t.options.ignoreJSONStructure&&(t.options.ignoreJSONStructure=!0),t}return Am(r,[{key:"addNamespaces",value:function(e){0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=AO(this.data,a);return s||!o||"string"!=typeof n?s:Aj(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,a=[e,t];n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),AT(this.data,a,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=AO(this.data,a)||{};r?function e(t,n,r){for(var i in n)"__proto__"!==i&&"constructor"!==i&&(i in t?"string"==typeof t[i]||t[i]instanceof String||"string"==typeof n[i]||n[i]instanceof String?r&&(t[i]=n[i]):e(t[i],n[i],r):t[i]=n[i]);return t}(s,n,i):s=Az(Az({},s),n),AT(this.data,a,s),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?Az(Az({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(function(e){return t[e]&&Object.keys(t[e]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),r}(AC),Aq={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach(function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))}),t}};function AK(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function AH(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};return Af(this,r),t=n.call(this),AD&&AC.call(Ag(t)),function(e,t,n){e.forEach(function(e){t[e]&&(n[e]=t[e])})}(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,Ag(t)),t.options=i,void 0===t.options.keySeparator&&(t.options.keySeparator="."),t.logger=AM.create("translator"),t}return Am(r,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=AB.filter(function(e){return 0>t.indexOf(e)&&0>n.indexOf(e)});if(0===r.length)return!0;var i=new RegExp("(".concat(r.map(function(e){return"?"===e?"\\?":e}).join("|"),")")),o=!i.test(e);if(!o){var a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}(e,n,r));if(o&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:i};var l=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(l[0])>-1)&&(i=l.shift()),e=l.join(r)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,n){var i=this;if("object"!==Ad(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===Ad(t)&&(t=AH({},t)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),l=s.key,u=s.namespaces,c=u[u.length-1],d=t.lng||this.language,f=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(f){var h=t.nsSeparator||this.options.nsSeparator;return o?{res:"".concat(c).concat(h).concat(l),usedKey:l,exactUsedKey:l,usedLng:d,usedNS:c}:"".concat(c).concat(h).concat(l)}return o?{res:l,usedKey:l,exactUsedKey:l,usedLng:d,usedNS:c}:l}var p=this.resolve(e,t),m=p&&p.res,g=p&&p.usedKey||l,v=p&&p.exactUsedKey||l,b=Object.prototype.toString.apply(m),y=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,A=!this.i18nFormat||this.i18nFormat.handleAsObject;if(A&&m&&"string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(b)&&("string"!=typeof y||"[object Array]"!==b)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var w=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,AH(AH({},t),{},{ns:u})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return o?(p.res=w,p):w}if(a){var _="[object Array]"===b,E=_?[]:{},S=_?v:g;for(var k in m)if(Object.prototype.hasOwnProperty.call(m,k)){var M="".concat(S).concat(a).concat(k);E[k]=this.translate(M,AH(AH({},t),{joinArrays:!1,ns:u})),E[k]===M&&(E[k]=m[k])}m=E}}else if(A&&"string"==typeof y&&"[object Array]"===b)(m=m.join(y))&&(m=this.extendTranslation(m,e,t,n));else{var C=!1,x=!1,R=void 0!==t.count&&"string"!=typeof t.count,I=r.hasDefaultValue(t),T=R?this.pluralResolver.getSuffix(d,t.count,t):"",O=t["defaultValue".concat(T)]||t.defaultValue;!this.isValidLookup(m)&&I&&(C=!0,m=O),this.isValidLookup(m)||(x=!0,m=l);var P=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&x?void 0:m,L=I&&O!==m&&this.options.updateMissing;if(x||C||L){if(this.logger.log(L?"updateKey":"missingKey",d,c,l,L?O:m),a){var N=this.resolve(l,AH(AH({},t),{},{keySeparator:!1}));N&&N.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var D=[],B=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&B&&B[0])for(var j=0;j1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach(function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,s),u=l.key;n=u;var c=l.namespaces;a.options.fallbackNS&&(c=c.concat(a.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,f=d&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),h=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);c.forEach(function(e){a.isValidLookup(t)||(o=e,!AV["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(o)&&(AV["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(function(n){if(!a.isValidLookup(t)){i=n;var o,l=[u];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(l,u,n,e,s);else{d&&(c=a.pluralResolver.getSuffix(n,s.count,s));var c,p="".concat(a.options.pluralSeparator,"zero");if(d&&(l.push(u+c),f&&l.push(u+p)),h){var m="".concat(u).concat(a.options.contextSeparator).concat(s.context);l.push(m),d&&(l.push(m+c),f&&l.push(m+p))}}for(;o=l.pop();)a.isValidLookup(t)||(r=o,t=a.getResource(n,e,o,s))}}))})}}),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&"defaultValue"===t.substring(0,12)&&void 0!==e[t])return!0;return!1}}]),r}(AC);function AW(e){return e.charAt(0).toUpperCase()+e.slice(1)}var AY=function(){function e(t){Af(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=AM.create("languageUtils")}return Am(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||0>e.indexOf("-"))return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||0>e.indexOf("-"))return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map(function(e){return e.toLowerCase()}):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=AW(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=AW(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=AW(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach(function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}}),!t&&this.options.supportedLngs&&e.forEach(function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find(function(e){return e===r?e:0>e.indexOf("-")&&0>r.indexOf("-")?void 0:0===e.indexOf(r)?e:void 0})}}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),r.forEach(function(e){0>i.indexOf(e)&&o(n.formatLanguageCode(e))}),i}}]),e}(),AG=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],AQ={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},AZ=["v1","v2","v3"],AJ={zero:0,one:1,two:2,few:3,many:4,other:5},AX=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Af(this,e),this.languageUtils=t,this.options=r,this.logger=AM.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(n={},AG.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:AQ[e.fc]}})}),n)}return Am(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map(function(e){return"".concat(t).concat(e)})}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort(function(e,t){return AJ[e]-AJ[t]}).map(function(e){return"".concat(t.options.prepend).concat(e)}):r.numbers.map(function(r){return t.getSuffix(e,r,n)}):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var o=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!AZ.includes(this.options.compatibilityJSON)}}]),e}();function A0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function A1(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=void 0!==(r=AO(e,n))?r:AO(t,n);return!a&&o&&"string"==typeof n&&void 0===(a=Aj(e,n,i))&&(a=Aj(t,n,i)),a}var A3=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Af(this,e),this.logger=AM.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return Am(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:AN,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?AP(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?AP(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?AP(t.nestingPrefix):t.nestingPrefixEscaped||AP("$t("),this.nestingSuffix=t.nestingSuffix?AP(t.nestingSuffix):t.nestingSuffixEscaped||AP(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,a,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(0>e.indexOf(s.formatSeparator)){var i=A2(t,l,e,s.options.keySeparator,s.options.ignoreJSONStructure);return s.alwaysFormat?s.format(i,void 0,n,A1(A1(A1({},r),t),{},{interpolationkey:e})):i}var o=e.split(s.formatSeparator),a=o.shift().trim(),u=o.join(s.formatSeparator).trim();return s.format(A2(t,l,a,s.options.keySeparator,s.options.ignoreJSONStructure),u,n,A1(A1(A1({},r),t),{},{interpolationkey:a}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?u(s.escape(e)):u(e)}}].forEach(function(t){for(a=0;i=t.regex.exec(e);){var n=i[1].trim();if(void 0===(o=c(n))){if("function"==typeof d){var l=d(e,i,r);o="string"==typeof l?l:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))o="";else{if(f){o=i[0];continue}s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}}else"string"==typeof o||s.useRawValueToEscape||(o=AR(o));var u=t.safeValue(o);if(e=e.replace(i[0],u),f?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}}),e}},{key:"nest",value:function(e,t){var n,r,i,o=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function s(e,t){var n=this.nestingOptionsSeparator;if(0>e.indexOf(n))return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),o="{".concat(r[1]);e=r[0];var a=(o=this.interpolate(o,i)).match(/'/g),s=o.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(o=o.replace(/'/g,'"'));try{i=JSON.parse(o),t&&(i=A1(A1({},t),i))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(o)}return delete i.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var l=[];(i=(i=A1({},a)).replace&&"string"!=typeof i.replace?i.replace:i).applyPostProcessor=!1,delete i.defaultValue;var u=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var c=n[1].split(this.formatSeparator).map(function(e){return e.trim()});n[1]=c.shift(),l=c,u=!0}if((r=t(s.call(this,n[1].trim(),i),i))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=AR(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),u&&(r=l.reduce(function(e,t){return o.format(e,t,a.lng,A1(A1({},a),{},{interpolationkey:n[1].trim()}))},r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function A6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function A4(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};Af(this,e),this.logger=AM.create("formatter"),this.options=t,this.formats={number:A8(function(e,t){var n=new Intl.NumberFormat(e,A4({},t));return function(e){return n.format(e)}}),currency:A8(function(e,t){var n=new Intl.NumberFormat(e,A4(A4({},t),{},{style:"currency"}));return function(e){return n.format(e)}}),datetime:A8(function(e,t){var n=new Intl.DateTimeFormat(e,A4({},t));return function(e){return n.format(e)}}),relativetime:A8(function(e,t){var n=new Intl.RelativeTimeFormat(e,A4({},t));return function(e){return n.format(e,t.range||"day")}}),list:A8(function(e,t){var n=new Intl.ListFormat(e,A4({},t));return function(e){return n.format(e)}})},this.init(t)}return Am(e,[{key:"init",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=A8(t)}},{key:"format",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return t.split(this.formatSeparator).reduce(function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);"currency"===t&&0>i.indexOf(":")?n.currency||(n.currency=i.trim()):"relativetime"===t&&0>i.indexOf(":")?n.range||(n.range=i.trim()):i.split(";").forEach(function(e){if(e){var t,r=function(e){if(Array.isArray(e))return e}(t=e.split(":"))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return A_(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A_(e,void 0):void 0}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=r[0],o=r.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[i.trim()]||(n[i.trim()]=o),"false"===o&&(n[i.trim()]=!1),"true"===o&&(n[i.trim()]=!0),isNaN(o)||(n[i.trim()]=parseInt(o,10))}})}return{formatName:t,formatOptions:n}}(t),a=o.formatName,s=o.formatOptions;if(r.formats[a]){var l=e;try{var u=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},c=u.locale||u.lng||i.locale||i.lng||n;l=r.formats[a](e,c,A4(A4(A4({},s),i),u))}catch(e){r.logger.warn(e)}return l}return r.logger.warn("there was no format function for ".concat(a)),e},e)}}]),e}();function A7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function A9(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:{};return Af(this,r),o=n.call(this),AD&&AC.call(Ag(o)),o.backend=e,o.store=t,o.services=i,o.languageUtils=i.languageUtils,o.options=a,o.logger=AM.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,a.backend,a),o}return Am(r,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},a={},s={},l={};return e.forEach(function(e){var r=!0;t.forEach(function(t){var s="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[s]=2:i.state[s]<0||(1===i.state[s]?void 0===a[s]&&(a[s]=!0):(i.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===l[t]&&(l[t]=!0)))}),r||(s[e]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var a={};this.queue.forEach(function(n){var r,s,l,u;(l=(s=AI(n.loaded,[i],Object)).obj)[u=s.k]=l[u]||[],r||l[u].push(o),void 0!==n.pending[e]&&(delete n.pending[e],n.pendingCount--),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(function(e){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach(function(t){void 0===a[e][t]&&(a[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(function(e){return!e.done})}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:n,tried:i,wait:o,callback:a});else{this.readingCalls++;var s=function(s,l){if(r.readingCalls--,r.waitingReads.length>0){var u=r.waitingReads.shift();r.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}s&&l&&i2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(function(e){n.loadOne(e)})}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,function(r,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),a),t.loaded(e,r,a)})}},{key:"saveMissing",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){var s,l=A9(A9({},o),{},{isUpdate:i}),u=this.backend.create.bind(this.backend);if(u.length<6)try{(s=5===u.length?u(e,t,n,r,l):u(e,t,n,r))&&"function"==typeof s.then?s.then(function(e){return a(null,e)}).catch(a):a(null,s)}catch(e){a(e)}else u(e,t,n,r,a,l)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}]),r}(AC);function wt(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===Ad(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===Ad(e[2])||"object"===Ad(e[3])){var n=e[3]||e[2];Object.keys(n).forEach(function(e){t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function wn(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&0>e.supportedLngs.indexOf("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function wr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wi(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(Af(this,r),e=n.call(this),AD&&AC.call(Ag(e)),e.options=wn(i),e.services={},e.logger=AM,e.modules={external:[]},Object.getOwnPropertyNames(Object.getPrototypeOf(t=Ag(e))).forEach(function(e){"function"==typeof t[e]&&(t[e]=t[e].bind(t))}),o&&!e.isInitialized&&!i.isClone){if(!e.options.initImmediate)return e.init(i,o),Ay(e,Ag(e));setTimeout(function(){e.init(i,o)},0)}return e}return Am(r,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:0>t.ns.indexOf("translation")&&(t.defaultNS=t.ns[0]));var r=wt();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=wi(wi(wi({},r),this.options),wn(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=wi(wi({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){this.modules.logger?AM.init(i(this.modules.logger),this.options):AM.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=A5);var o,a=new AY(this.options);this.store=new AU(this.options.resources,this.options);var s=this.services;s.logger=AM,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new AX(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(s.formatter=i(o),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new A3(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new we(i(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i1?n-1:0),i=1;i0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}});var u=Ax(),c=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),u.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),u}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wo,r="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&"cimode"===r.toLowerCase())return n();var i=[],o=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach(function(e){0>i.indexOf(e)&&i.push(e)})};r?o(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(function(e){return o(e)}),this.options.preload&&this.options.preload.forEach(function(e){return o(e)}),this.services.backendConnector.load(i,this.options.ns,function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),n(e)})}else n(null)}},{key:"reloadResources",value:function(e,t,n){var r=Ax();return e||(e=this.languages),t||(t=this.options.ns),n||(n=wo),this.services.backendConnector.reload(e,t,function(e){r.resolve(),n(e)}),r}},{key:"use",value:function(e){if(!e)throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Aq.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=Ax();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(o){e||o||!n.services.languageDetector||(o=[]);var a="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);a&&(n.language||i(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,function(e){a?(i(a),n.translator.changeLanguage(a),n.isLanguageChangingTo=void 0,n.emit("languageChanged",a),n.logger.log("languageChanged",a)):n.isLanguageChangingTo=void 0,r.resolve(function(){return n.t.apply(n,arguments)}),t&&t(e,function(){return n.t.apply(n,arguments)})})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,i=function e(t,i){if("object"!==Ad(i)){for(var o=arguments.length,a=Array(o>2?o-2:0),s=2;s1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=n.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return -1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return!!this.hasResourceBundle(r,e)||!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(r,e)||i&&!a(o,e))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=Ax();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach(function(e){0>n.options.ns.indexOf(e)&&n.options.ns.push(e)}),this.loadResources(function(e){r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=Ax();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter(function(e){return 0>r.indexOf(e)});return i.length?(this.options.preload=r.concat(i),this.loadResources(function(e){n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){return(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),e)?["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf((this.services&&this.services.languageUtils||new AY(wt())).getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr":"rtl"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wo,i=wi(wi(wi({},this.options),t),{isClone:!0}),o=new r(i);return void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t)),["store","services","language"].forEach(function(t){o[t]=e[t]}),o.services=wi({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new A$(o.services,o.options),o.translator.on("*",function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)});var ws=wa.createInstance();ws.createInstance=wa.createInstance;var wl=ws.createInstance;ws.dir,ws.init,ws.loadResources,ws.reloadResources,ws.use,ws.changeLanguage,ws.getFixedT,ws.t,ws.exists,ws.setDefaultNamespace,ws.hasLoadedNamespace,ws.loadNamespaces,ws.loadLanguages;var wu,wc="0.20.5";(wR=wu||(wu={})).INPAGE="metamask-inpage",wR.CONTENT_SCRIPT="metamask-contentscript",wR.PROVIDER="metamask-provider";let wd="direct",wf="https://metamask.app.link/connect",wh="metamask://connect",wp={NAME:"MetaMask",RDNS:"io.metamask"},wm=/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u;e.PROVIDER_UPDATE_TYPE=void 0,(wD=e.PROVIDER_UPDATE_TYPE||(e.PROVIDER_UPDATE_TYPE={})).TERMINATE="terminate",wD.EXTENSION="extension",wD.INITIALIZED="initialized";let wg="undefined"!=typeof window&&window.localStorage;function wv(t){var n,r;return hP(this,void 0,void 0,function*(){yQ("[MetaMaskSDK: connectWithExtensionProvider()] ",t),t.sdkProvider=t.activeProvider,t.activeProvider=window.extension,window.ethereum=window.extension;try{let e=yield null===(n=window.extension)||void 0===n?void 0:n.request({method:"eth_requestAccounts"});yQ(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${e}`)}catch(e){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",e)}localStorage.setItem(An,"extension"),t.extensionActive=!0,t.emit(e.EventType.PROVIDER_UPDATE,e.PROVIDER_UPDATE_TYPE.EXTENSION),t.options.enableAnalytics&&(null===(r=t.analytics)||void 0===r||r.send({event:vf.SDK_USE_EXTENSION}))})}class wb{constructor({shouldSetOnWindow:e,connectionStream:t,shouldSendMetadata:n=!1,shouldShimWeb3:r}){var i;let o=new Proxy(new Al({connectionStream:t,shouldSendMetadata:n,shouldSetOnWindow:e,shouldShimWeb3:r,autoRequestAccounts:!1}),{deleteProperty:()=>!0});this.provider=o,e&&"undefined"!=typeof window&&(i=this.provider,window.ethereum=i,window.dispatchEvent(new Event("ethereum#initialized"))),r&&"undefined"!=typeof window&&function(e,t=console){let n=!1,r=!1;if(!window.web3){let i="__isMetaMaskShim__",o={currentProvider:e};Object.defineProperty(o,i,{value:!0,enumerable:!0,configurable:!1,writable:!1}),Object.defineProperty(window,"web3",{value:o=new Proxy(o,{get:(o,a,...s)=>("currentProvider"!==a||n?"currentProvider"===a||a===i||r||(r=!0,t.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),e.request({method:"metamask_logWeb3ShimUsage"}).catch(e=>{t.debug("MetaMask: Failed to log web3 shim usage.",e)})):(n=!0,t.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(o,a,...s)),set:(...e)=>(t.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...e))}),enumerable:!1,configurable:!0,writable:!0})}}(this.provider),this.provider.on("_initialized",()=>{yQ("[Ethereum: constructor()] provider initialized",{chainId:this.provider.getChainId(),isConnected:this.provider.isConnected(),isMetaNask:this.provider.isMetaMask,selectedAddress:this.provider.getSelectedAddress(),networkVersion:this.provider.getNetworkVersion()})})}static init(e){var t;return yQ("[Ethereum: init()] Initializing Ethereum service"),this.instance=new wb(e),null===(t=this.instance)||void 0===t?void 0:t.provider}static destroy(){wb.instance=void 0}static getInstance(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}class wy extends ni.Duplex{constructor({name:t,remote:n,platformManager:r}){super({objectMode:!0}),this.state={_name:null,remote:null,platformManager:null},this.state._name=t,this.state.remote=n,this.state.platformManager=r,this._onMessage=this._onMessage.bind(this),this.state.remote.on(e.EventType.MESSAGE,this._onMessage)}_write(e,t,n){return hP(this,void 0,void 0,function*(){return function(e,t,n,r){var i,o,a,s,l,u,c,d,f,h,p,m,g,v;return hP(this,void 0,void 0,function*(){var n;let b;let y=null===(i=e.state.remote)||void 0===i?void 0:i.isReady(),A=null===(o=e.state.remote)||void 0===o?void 0:o.isConnected(),w=null===(a=e.state.remote)||void 0===a?void 0:a.isPaused(),_=wb.getProvider(),E=null===(s=e.state.remote)||void 0===s?void 0:s.getChannelId(),S=null===(l=e.state.remote)||void 0===l?void 0:l.isAuthorized(),{method:k,data:C}=(M.isBuffer(t)?(b=t.toJSON())._isBuffer=!0:b=t,{method:null===(n=null==b?void 0:b.data)||void 0===n?void 0:n.method,data:b});if(yQ(`[RCPMS: write()] method='${k}' isRemoteReady=${y} channelId=${E} isSocketConnected=${A} isRemotePaused=${w} providerConnected=${_.isConnected()}`,t),!E)return k!==y5.METAMASK_GETPROVIDERSTATE&&yQ("[RCPMS: write()] Invalid channel id -- undefined"),r();yQ(`[RCPMS: write()] remote.isPaused()=${null===(u=e.state.remote)||void 0===u?void 0:u.isPaused()} authorized=${S} ready=${y} socketConnected=${A}`,t);try{if(null===(c=e.state.remote)||void 0===c||c.sendMessage(null==C?void 0:C.data).then(()=>{yQ(`[RCPMS: _write()] ${k} sent successfully`)}).catch(e=>{yQ("[RCPMS: _write()] error sending message",e)}),!(null===(d=e.state.platformManager)||void 0===d?void 0:d.isSecure()))return yQ(`[RCPMS: _write()] unsecure platform for method ${k} -- return callback`),r();if(!A&&!y)return yQ(`[RCPMS: _write()] invalid connection status targetMethod=${k} socketConnected=${A} ready=${y} providerConnected=${_.isConnected()}`),r();if(!A&&y)return console.warn("[RCPMS: _write()] invalid socket status -- shouldn't happen"),r();let t=null!==(p=null===(h=null===(f=e.state.remote)||void 0===f?void 0:f.getKeyInfo())||void 0===h?void 0:h.ecies.public)&&void 0!==p?p:"",n=encodeURI(`channelId=${E}&pubkey=${t}&comm=socket&t=d&v=2`);y7[k]?(yQ(`[RCPMS: _write()] redirect link for '${k}' socketConnected=${A} connect?${n}`),null===(m=e.state.platformManager)||void 0===m||m.openDeeplink(`${wf}?${n}`,`${wh}?${n}`,"_self")):(null===(g=e.state.remote)||void 0===g?void 0:g.isPaused())?(yQ(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${k}`),null===(v=e.state.platformManager)||void 0===v||v.openDeeplink(`${wf}?redirect=true&${n}`,`${wh}?redirect=true&${n}`,"_self")):yQ(`[RCPMS: _write()] method ${k} doesn't need redirect.`)}catch(e){return yQ("[RCPMS: _write()] error sending message",e),r(Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()})}(this,e,0,n)})}_read(){}_onMessage(e){return function(e,t){try{if(yQ("[RCPMS: onMessage()] message",t),!t||"object"!=typeof t||"object"!=typeof(null==t?void 0:t.data))return;if(!(null==t?void 0:t.name))return void yQ(`[RCPMS: onMessage()] ignore message without name message=${t}`);if((null==t?void 0:t.name)!==wu.PROVIDER)return void yQ(`[RCPMS: onMessage()] ignore message with wrong name message=${t}`);if(M.isBuffer(t)){let n=M.from(t);e.push(n)}else e.push(t)}catch(e){yQ(`[RCPMS: onMessage()] ignore message error err=${e}`)}}(this,e)}start(){}}var wA={exports:{}};wI=wA.exports,wT="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==l&&l,wP=wO=function(){function e(){this.fetch=!1,this.DOMException=wT.DOMException}return e.prototype=wT,new e}(),function(e){var t=void 0!==wP&&wP||"undefined"!=typeof self&&self||void 0!==t&&t,n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function h(e){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function m(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(m)}),this.text=function(){var e,t,n,r=h(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,n=p(t=new FileReader),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=Array(t.length),r=0;r-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;o.test(this.url)?this.url=this.url.replace(o,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function A(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}}),t}function w(e,t){if(!(this instanceof w))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},v.call(y.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];w.redirect=function(e,t){if(-1===_.indexOf(t))throw RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(n,r){return new Promise(function(o,s){var l=new y(n,r);if(l.signal&&l.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function d(){u.abort()}u.onload=function(){var e,t,n={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new f,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}}),t)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var r="response"in u?u.response:u.responseText;setTimeout(function(){o(new w(r,n))},0)},u.onerror=function(){setTimeout(function(){s(TypeError("Network request failed"))},0)},u.ontimeout=function(){setTimeout(function(){s(TypeError("Network request failed"))},0)},u.onabort=function(){setTimeout(function(){s(new e.DOMException("Aborted","AbortError"))},0)},u.open(l.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(t){return e}}(l.url),!0),"include"===l.credentials?u.withCredentials=!0:"omit"===l.credentials&&(u.withCredentials=!1),"responseType"in u&&(i?u.responseType="blob":a&&l.headers.get("Content-Type")&&-1!==l.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof f?l.headers.forEach(function(e,t){u.setRequestHeader(t,e)}):Object.getOwnPropertyNames(r.headers).forEach(function(e){u.setRequestHeader(e,c(r.headers[e]))}),l.signal&&(l.signal.addEventListener("abort",d),u.onreadystatechange=function(){4===u.readyState&&l.signal.removeEventListener("abort",d)}),u.send(void 0===l._bodyInit?null:l._bodyInit)})}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=f,t.Request=y,t.Response=w),e.Headers=f,e.Request=y,e.Response=w,e.fetch=E}({}),wO.fetch.ponyfill=!0,delete wO.fetch.polyfill,(wI=(wL=wT.fetch?wT:wO).fetch).default=wL.fetch,wI.fetch=wL.fetch,wI.Headers=wL.Headers,wI.Request=wL.Request,wI.Response=wL.Response,wA.exports=wI;var ww=u(wA.exports);let w_=1,wE=e=>new Promise(t=>{setTimeout(()=>{t(!0)},e)}),wS=({checkInstallationOnAllCalls:t=!1,communicationLayerPreference:n,injectProvider:r,shouldShimWeb3:i,platformManager:o,installer:a,sdk:s,remoteConnection:l,debug:u})=>hP(void 0,void 0,void 0,function*(){var c,d;let f=(({name:e,remoteConnection:t})=>{if(!t||!(null==t?void 0:t.getConnector()))throw Error("Missing remote connection parameter");return new wy({name:e,remote:null==t?void 0:t.getConnector(),platformManager:null==t?void 0:t.getPlatformManager()})})({name:wu.INPAGE,target:wu.CONTENT_SCRIPT,platformManager:o,communicationLayerPreference:n,remoteConnection:l}),h=o.getPlatformType(),p=s.options.dappMetadata,m=`Sdk/Javascript SdkVersion/${wc} Platform/${h} dApp/${null!==(c=p.url)&&void 0!==c?c:p.name} dAppTitle/${p.name}`,g=null,v=null,b=null===(d=s.options.storage)||void 0===d?void 0:d.storageManager;if(b){try{let e=yield b.getCachedAccounts();e.length>0&&(g=e[0])}catch(e){console.error(`[initializeMobileProvider] failed to get cached addresses: ${e}`)}try{let e=yield b.getCachedChainId();e&&(v=e)}catch(e){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${e}`)}}yQ(`[initializeMobileProvider] cachedAccountAddress: ${g}, cachedChainId: ${v}`);let y=!(!r||h===e.PlatformType.NonBrowser||h===e.PlatformType.ReactNative),A=wb.init({shouldSetOnWindow:y,connectionStream:f,shouldShimWeb3:i}),w=!1,_=e=>{w=e},E=()=>w,S=(n,r,i,u)=>hP(void 0,void 0,void 0,function*(){var c,d,f,h,p,y,A,S,k;if(w){null==l||l.showActiveModal();let e=E();for(;e;)yield wE(1e3),e=E();return yQ("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),i(...r)}let M=o.isMetaMaskInstalled(),C=null==l?void 0:l.isConnected(),x=wb.getProvider(),R=null,I=null;if(R=null!==(c=x.getSelectedAddress())&&void 0!==c?c:g,I=x.getChainId()||v,R&&b&&R!==g&&b.persistAccounts([R]).catch(e=>{console.error(`[initializeMobileProvider] failed to persist account: ${e}`)}),I&&(v=I,b&&b.persistChainId(I).catch(e=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${e}`)})),yQ("[initializeMobileProvider: sendRequest()]",{selectedAddress:R,chainId:I}),u&&yQ(`[initializeMobileProvider: sendRequest()] method=${n} ongoing=${w} selectedAddress=${R} isInstalled=${M} checkInstallationOnAllCalls=${t} socketConnected=${C}`),R&&n.toLowerCase()===y5.ETH_ACCOUNTS.toLowerCase())return[R];if(I&&n.toLowerCase()===y5.ETH_CHAINID.toLowerCase())return I;let T=[y5.ETH_REQUESTACCOUNTS,y5.WALLET_REQUESTPERMISSIONS,y5.METAMASK_CONNECTSIGN,y5.METAMASK_CONNECTWITH],O=!y7[n],P=null===(d=s.options.readonlyRPCMap)||void 0===d?void 0:d[I];if(P&&O)try{let e=null===(f=null==r?void 0:r[0])||void 0===f?void 0:f.params,t=yield(({rpcEndpoint:e,method:t,sdkInfo:n,params:r})=>hP(void 0,void 0,void 0,function*(){let i;let o=JSON.stringify({jsonrpc:"2.0",method:t,params:r,id:w_+=1}),a={Accept:"application/json","Content-Type":"application/json"};e.includes("infura")&&(a["Metamask-Sdk-Info"]=n);try{i=yield ww(e,{method:"POST",headers:a,body:o})}catch(e){throw e instanceof Error?Error(`Failed to fetch from RPC: ${e.message}`):Error(`Failed to fetch from RPC: ${e}`)}if(!i.ok)throw Error(`Server responded with a status of ${i.status}`);return(yield i.json()).result}))({rpcEndpoint:P,sdkInfo:m,method:n,params:e||[]});return u&&yQ(`initializeProvider::ReadOnlyRPCResponse ${t}`),t}catch(e){console.warn(`[initializeMobileProvider: sendRequest()] method=${n} readOnlyRPCRequest failed:`,e)}if((!M||M&&!C)&&n!==y5.METAMASK_GETPROVIDERSTATE){let u=(null===(h=null==r?void 0:r[0])||void 0===h?void 0:h.params)||[];if(-1!==T.indexOf(n)||t){_(!0);try{yield a.start({wait:!1})}catch(t){if(_(!1),e.PROVIDER_UPDATE_TYPE.EXTENSION===t){if(yQ(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${n} on the active provider`),n.toLowerCase()===y5.METAMASK_CONNECTSIGN.toLowerCase()){let e=yield null===(p=s.getProvider())||void 0===p?void 0:p.request({method:y5.ETH_REQUESTACCOUNTS,params:[]});if(!e.length)throw Error("SDK state invalid -- undefined accounts");return yield null===(y=s.getProvider())||void 0===y?void 0:y.request({method:y5.PERSONAL_SIGN,params:[u[0],e[0]]})}if(n.toLowerCase()===y5.METAMASK_CONNECTWITH.toLowerCase()){let[e]=u;return yield(({method:e,sdk:t,params:n})=>hP(void 0,void 0,void 0,function*(){var r,i,o,a;if(!t.isExtensionActive())throw Error("SDK state invalid -- extension is not active");yQ("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",e,n);let s=yield null===(r=t.getProvider())||void 0===r?void 0:r.request({method:y5.ETH_REQUESTACCOUNTS,params:[]});if(!s.length)throw Error("SDK state invalid -- undefined accounts");if((null==e?void 0:e.toLowerCase())===y5.PERSONAL_SIGN.toLowerCase()){let r={method:e,params:[n[0],s[0]]};return yield null===(i=t.getProvider())||void 0===i?void 0:i.request(r)}if((null==e?void 0:e.toLowerCase())===y5.ETH_SENDTRANSACTION.toLowerCase()){let r={method:e,params:[Object.assign(Object.assign({},n[0]),{from:s[0]})]};return yield null===(o=t.getProvider())||void 0===o?void 0:o.request(r)}return Ae.includes(e.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${e} -- not handled by the extension -- call separately`),s):yield null===(a=t.getProvider())||void 0===a?void 0:a.request({method:e,params:n})}))({method:e.method,sdk:s,params:e.params})}return yQ(`[initializeMobileProvider: sendRequest()] sending '${n}' on active provider`,u),yield null===(A=s.getProvider())||void 0===A?void 0:A.request({method:n,params:u})}throw yQ(`[initializeMobileProvider: sendRequest()] failed to start installer: ${t}`),t}let t=i(...r);try{yield new Promise((t,n)=>{null==l||l.getConnector().once(e.EventType.AUTHORIZED,()=>{t(!0)}),s.once(e.EventType.PROVIDER_UPDATE,t=>{yQ(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${t}`),t===e.PROVIDER_UPDATE_TYPE.EXTENSION?n(e.EventType.PROVIDER_UPDATE):n(Error("Connection Terminated"))})})}catch(t){if(_(!1),t===e.EventType.PROVIDER_UPDATE)return yield null===(S=s.getProvider())||void 0===S?void 0:S.request({method:n,params:u});throw t}return _(!1),t}if(o.isSecure()&&y7[n])return i(...r);if(s.isExtensionActive())return yQ(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${n}' to it`,r,u),yield null===(k=s.getProvider())||void 0===k?void 0:k.request({method:n,params:u});throw yQ(`[initializeMobileProvider: sendRequest()] method=${n} --- skip --- not connected/installed`),Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}let L=yield i(...r);return yQ(`[initializeMobileProvider: sendRequest()] method=${n} rpcResponse: ${L}`),L}),{request:k}=A;A.request=(...e)=>hP(void 0,void 0,void 0,function*(){return S(null==e?void 0:e[0].method,e,k,u)});let{send:M}=A;return A.send=(...e)=>hP(void 0,void 0,void 0,function*(){return S(null==e?void 0:e[0],e,M,u)}),yQ("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),f.start(),A});class wk{constructor({serverUrl:e,enabled:t,originatorInfo:n}){wB.set(this,hb),wj.set(this,void 0),wF.set(this,void 0),hN(this,wB,e,"f"),hN(this,wF,n,"f"),hN(this,wj,null==t||t,"f")}send({event:e,params:t}){if(!hL(this,wj,"f"))return;let n={id:"sdk",event:e,sdkVersion:wc,originationInfo:hL(this,wF,"f"),params:t};yQ(`[Analytics: send()] event: ${e}`,n),fU(n,hL(this,wB,"f")).catch(e=>{yQ(`[Analytics: send()] error: ${e}`)})}}wB=new WeakMap,wj=new WeakMap,wF=new WeakMap;let wM=()=>{let e;if("undefined"==typeof document)return;let t=document.getElementsByTagName("link");for(let n=0;n{if("state"in e)throw Error("INVALID EXTENSION PROVIDER");return new Proxy(e,{get:(n,r)=>"request"===r?function(r){var i,o,a;return hP(this,void 0,void 0,function*(){let s;yQ("[wrapExtensionProvider()] Overwriting request method",r);let{method:l,params:u}=r,c=y9.includes(l.toLowerCase());if(c&&(null===(i=t.analytics)||void 0===i||i.send({event:vf.SDK_RPC_REQUEST,params:{method:l,from:"extension"}})),l===y5.METAMASK_BATCH&&Array.isArray(u)){for(let t of u)yield null==e?void 0:e.request({method:t.method,params:t.params});let i=yield n.request(r);return c&&(null===(o=t.analytics)||void 0===o||o.send({event:vf.SDK_RPC_REQUEST_DONE,params:{method:l,from:"extension"}})),i}try{return s=yield n.request(r)}catch(e){}finally{c&&(null===(a=t.analytics)||void 0===a||a.send({event:vf.SDK_RPC_REQUEST_DONE,params:{method:l,from:"extension"}}))}return s})}:"getChainId"===r?function(){return e.chainId}:"getNetworkVersion"===r?function(){return e.networkVersion}:"getSelectedAddress"===r?function(){return e.selectedAddress}:"isConnected"===r?function(){return e._state.isConnected}:n[r]})};(wN=wz||(wz={})).Announce="eip6963:announceProvider",wN.Request="eip6963:requestProvider";var wx={exports:{}};wx.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,(function(t){return e[t]}).bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),a=Math.max(i,o),s=0,l=e.map([t,n],function(t){var n=a-e.getVersionPrecision(t),r=t+Array(n+1).join(".0");return e.map(r.split("."),function(e){return Array(20-e.length).join("0")+e}).reverse()});for(r&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(l[0][a]>l[1][a])return 1;if(l[0][a]===l[1][a]){if(a===s)return 0;a-=1}else if(l[0][a]1?r-1:0),o=1;o0){var a=Object.keys(n),l=s.default.find(a,function(e){return t.isOS(e)});if(l){var u=this.satisfies(n[l]);if(void 0!==u)return u}var c=s.default.find(a,function(e){return t.isPlatform(e)});if(c){var d=this.satisfies(n[c]);if(void 0!==d)return d}}if(o>0){var f=Object.keys(i),h=s.default.find(f,function(e){return t.isBrowser(e,!0)});if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(s.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some(function(e){return t.is(e)})},e}();t.default=u,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=a,e.exports=t.default}});var wR,wI,wT,wO,wP,wL,wN,wD,wB,wj,wF,wz,wU,wq=u(wx.exports);(w3=wU||(wU={})).Disabled="Disabled",w3.Temporary="Temporary",w3.UntilResponse="UntilResponse";let wK=()=>"wakeLock"in navigator,wH=()=>{if("undefined"==typeof navigator)return!1;let{userAgent:e}=navigator,t=/CPU (?:iPhone )?OS (\d+)(?:_\d+)?_?\d+ like Mac OS X/iu.exec(e);return!!t&&10>parseInt(t[1],10)&&!window.MSStream};class wV{constructor(e){this.enabled=!1,this._eventsAdded=!1,this.debug=null!=e&&e}start(){if(this.enabled=!1,wK()&&!this._eventsAdded){this._eventsAdded=!0,this._wakeLock=void 0;let e=()=>hP(this,void 0,void 0,function*(){null!==this._wakeLock&&"visible"===document.visibilityState&&(yield this.enable())});document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else wH()?this.noSleepTimer=void 0:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","MetaMask SDK - Listening for responses"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK"),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"),this.noSleepVideo.addEventListener("loadedmetadata",()=>{yQ("[WakeLockManager: start()] video loadedmetadata",this.noSleepVideo),this.noSleepVideo&&(this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",()=>{this.noSleepVideo&&this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}))}))}_addSourceToVideo(e,t,n){let r=document.createElement("source");r.src=n,r.type=`video/${t}`,e.appendChild(r)}isEnabled(){return this.enabled}setDebug(e){yQ("[WakeLockManager: setDebug()] activate debug mode"),this.debug=e}enable(){return hP(this,void 0,void 0,function*(){this.enabled&&this.disable("from_enable");let e=wK(),t=wH();if(yQ(`[WakeLockManager: enable()] hasWakelock=${e} isOldIos=${t}`,this.noSleepVideo),this.start(),wK())try{let e=yield navigator.wakeLock.request("screen");this._wakeLock=e,this.enabled=!0}catch(e){return yQ("[WakeLockManager: enable()] failed to enable wake lock",e),this.enabled=!1,!1}else if(wH())return this.disable("from_enable_old_ios"),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,!0;return!!this.noSleepVideo&&(this.noSleepVideo.play().then(()=>{yQ("[WakeLockManager: enable()] video started playing successfully")}).catch(e=>{console.warn("[WakeLockManager: enable()] video failed to play",e)}),this.enabled=!0,!0)})}disable(e){if(this.enabled){if(yQ(`[WakeLockManager: disable()] context=${e}`),wK())this._wakeLock&&(yQ("[WakeLockManager: disable()] release wake lock"),this._wakeLock.release()),this._wakeLock=void 0;else if(wH())this.noSleepTimer&&(console.warn("\n NoSleep now disabled for older iOS devices.\n "),window.clearInterval(this.noSleepTimer),this.noSleepTimer=void 0);else try{if(!this.noSleepVideo)return void yQ("[WakeLockManager: disable()] noSleepVideo is undefined");yQ("[WakeLockManager: disable()] pause noSleepVideo"),this.noSleepVideo.firstChild&&(this.noSleepVideo.removeChild(this.noSleepVideo.firstChild),this.noSleepVideo.load()),this.noSleepVideo.pause(),this.noSleepVideo.src="",this.noSleepVideo.remove()}catch(e){console.log(e)}this.enabled=!1}}}class w${constructor({useDeepLink:e,preferredOpenLink:t,wakeLockStatus:n=wU.UntilResponse,debug:r=!1}){this.state={wakeLock:new wV,wakeLockStatus:wU.UntilResponse,wakeLockTimer:void 0,wakeLockFeatureActive:!1,platformType:void 0,useDeeplink:!1,preferredOpenLink:void 0,debug:!1},this.state.platformType=this.getPlatformType(),this.state.useDeeplink=e,this.state.preferredOpenLink=t,this.state.wakeLockStatus=n,this.state.debug=r,this.state.wakeLock.setDebug(r)}enableWakeLock(){return function(e){let{state:t}=e;if(t.wakeLockStatus===wU.Disabled)return void yQ("[PlatfformManager: enableWakeLock()] WakeLock is disabled");t.wakeLock.enable().catch(e=>{console.error("[PlatfformManager: enableWakeLock()] WakeLock is not supported",e)});let n=t.wakeLockStatus===wU.Temporary?2e3:4e4;t.wakeLockTimer=setTimeout(()=>{e.disableWakeLock()},n),t.wakeLockFeatureActive||t.wakeLockStatus!==wU.UntilResponse||(t.wakeLockFeatureActive=!0,window.addEventListener("focus",()=>{e.disableWakeLock()}))}(this)}disableWakeLock(){return function(e){let{state:t}=e;t.wakeLockStatus!==wU.Disabled&&(t.wakeLockTimer&&clearTimeout(t.wakeLockTimer),t.wakeLock.disable("disableWakeLock"))}(this)}openDeeplink(e,t,n){return function(e,t,n,r){let{state:i}=e;yQ(`[PlatfformManager: openDeeplink()] universalLink --> ${t}`),yQ(`[PlatfformManager: openDeeplink()] deepLink --> ${n}`),e.isBrowser()&&e.enableWakeLock();try{if(i.preferredOpenLink)return void i.preferredOpenLink(i.useDeeplink?n:t,r);if(yQ(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${i.useDeeplink} link=${i.useDeeplink?n:t}`),"undefined"!=typeof window){let e;e=i.useDeeplink?window.open(n,"_blank"):window.open(t,"_blank"),setTimeout(()=>{var t;return null===(t=null==e?void 0:e.close)||void 0===t?void 0:t.call(e)},500)}}catch(e){console.log("[PlatfformManager: openDeeplink()] can't open link",e)}}(this,e,t,n)}isReactNative(){var e;return this.isNotBrowser()&&"undefined"!=typeof window&&(null==window?void 0:window.navigator)&&"ReactNative"===(null===(e=window.navigator)||void 0===e?void 0:e.product)}isMetaMaskInstalled(){return function(){let e=wb.getProvider()||(null==window?void 0:window.ethereum);return yQ(`[PlatfformManager: isMetaMaskInstalled()] isMetaMask=${null==e?void 0:e.isMetaMask} isConnected=${null==e?void 0:e.isConnected()}`),(null==e?void 0:e.isMetaMask)&&(null==e?void 0:e.isConnected())}()}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,t;let n=wq.parse(window.navigator.userAgent);return"mobile"===(null===(e=null==n?void 0:n.platform)||void 0===e?void 0:e.type)||"tablet"===(null===(t=null==n?void 0:n.platform)||void 0===t?void 0:t.type)}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return"undefined"!=typeof window&&!!window.ReactNativeWebView&&!!navigator.userAgent.endsWith("MetaMaskMobile")}isMobileWeb(){return this.state.platformType===e.PlatformType.MobileWeb}isNotBrowser(){var e;return"undefined"==typeof window||!(null==window?void 0:window.navigator)||void 0!==n.g&&"ReactNative"===(null===(e=null===n.g||void 0===n.g?void 0:n.g.navigator)||void 0===e?void 0:e.product)||"ReactNative"===(null==navigator?void 0:navigator.product)}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isBrowser(){return!this.isNotBrowser()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return function(t){let{state:n}=t;return n.platformType?n.platformType:t.isReactNative()?e.PlatformType.ReactNative:t.isNotBrowser()?e.PlatformType.NonBrowser:t.isMetaMaskMobileWebView()?e.PlatformType.MetaMaskMobileWebview:t.isMobile()?e.PlatformType.MobileWeb:e.PlatformType.DesktopWeb}(this)}}var wW="INSTALLED",wY="NOT_INSTALLED",wG="REGISTERED",wQ="REGISTERING",wZ="RELOADING",wJ={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},wX="REGISTRATION_IN_PROGRESS",w0="FORWARDER_ID",w1=function(){function e(t){var n=void 0===t?{}:t,r=n.forwarderOrigin,i=n.forwarderMode,o=void 0===i?e.FORWARDER_MODE.INJECT:i;this.forwarderOrigin=void 0===r?"https://fwd.metamask.io":r,this.forwarderMode=o,this.state=e.isMetaMaskInstalled()?wW:wY;var a=e._detectBrowser();this.downloadUrl=a?wJ[a]:wJ.DEFAULT,this._onMessage=this._onMessage.bind(this),this._onMessageFromForwarder=this._onMessageFromForwarder.bind(this),this._openForwarder=this._openForwarder.bind(this),this._openDownloadPage=this._openDownloadPage.bind(this),this.startOnboarding=this.startOnboarding.bind(this),this.stopOnboarding=this.stopOnboarding.bind(this),window.addEventListener("message",this._onMessage),o===e.FORWARDER_MODE.INJECT&&"true"===sessionStorage.getItem(wX)&&e._injectForwarder(this.forwarderOrigin)}return e.prototype._onMessage=function(e){if(e.origin===this.forwarderOrigin)return"metamask:reload"===e.data.type?this._onMessageFromForwarder(e):void console.debug("Unknown message from '"+e.origin+"' with data "+JSON.stringify(e.data))},e.prototype._onMessageUnknownStateError=function(e){throw Error("Unknown state: '"+e+"'")},e.prototype._onMessageFromForwarder=function(t){var n,r,i,o;return n=this,r=void 0,i=void 0,o=function(){return function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1?t-1:0),r=1;r1?t-1:0),r=1;r1){for(var c=Array(u),d=0;d1){for(var f=Array(d),h=0;h import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",n),"default"in n||S("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",n),n.default}throw e._result}function eo(e){return"string"==typeof e||"function"==typeof e||!!(e===r||e===o||e===i||e===u||e===c||e===h)||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===d||e.$$typeof===a||e.$$typeof===s||e.$$typeof===l||e.$$typeof===es||void 0!==e.getModuleId)}function ea(){var e=g.current;return null===e&&S("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."),e}es=Symbol.for("react.module.reference");var es,el,eu,ec,ed,ef,eh,ep,em=0;function eg(){}eg.__reactDisabledLog=!0;var ev,eb=_.ReactCurrentDispatcher;function ey(e,t,n){if(void 0===ev)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);ev=r&&r[1]||""}return"\n"+ev+e}var eA,ew=!1;function e_(e,t){if(!e||ew)return"";var n,r=eA.get(e);if(void 0!==r)return r;ew=!0;var i,o=Error.prepareStackTrace;Error.prepareStackTrace=void 0,i=eb.current,eb.current=null,function(){if(0===em){el=console.log,eu=console.info,ec=console.warn,ed=console.error,ef=console.group,eh=console.groupCollapsed,ep=console.groupEnd;var e={configurable:!0,enumerable:!0,value:eg,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}em++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){n=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){n=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),l=n.stack.split("\n"),u=s.length-1,c=l.length-1;u>=1&&c>=0&&s[u]!==l[c];)c--;for(;u>=1&&c>=0;u--,c--)if(s[u]!==l[c]){if(1!==u||1!==c)do if(u--,--c<0||s[u]!==l[c]){var d="\n"+s[u].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),"function"==typeof e&&eA.set(e,d),d}while(u>=1&&c>=0);break}}}finally{ew=!1,eb.current=i,function(){if(0==--em){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},e,{value:el}),info:R({},e,{value:eu}),warn:R({},e,{value:ec}),error:R({},e,{value:ed}),group:R({},e,{value:ef}),groupCollapsed:R({},e,{value:eh}),groupEnd:R({},e,{value:ep})})}em<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=o}var f=e?e.displayName||e.name:"",h=f?ey(f):"";return"function"==typeof e&&eA.set(e,h),h}function eE(e,t,n){if(null==e)return"";if("function"==typeof e){var r;return e_(e,!(!(r=e.prototype)||!r.isReactComponent))}if("string"==typeof e)return ey(e);switch(e){case u:return ey("Suspense");case c:return ey("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case l:return e_(e.render,!1);case d:return eE(e.type,t,n);case f:var i=e._payload,o=e._init;try{return eE(o(i),t,n)}catch(e){}}return""}eA=new("function"==typeof WeakMap?WeakMap:Map);var eS,ek={},eM=_.ReactDebugCurrentFrame;function eC(e){if(e){var t=e._owner,n=eE(e.type,e._source,t?t.type:null);eM.setExtraStackFrame(n)}else eM.setExtraStackFrame(null)}function ex(e){if(e){var t=e._owner;w=eE(e.type,e._source,t?t.type:null)}else w=null}function eR(){if(y.current){var e=U(y.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}eS=!1;var eI={};function eT(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=eR();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!eI[n]){eI[n]=!0;var r="";e&&e._owner&&e._owner!==y.current&&(r=" It was passed a child from "+U(e._owner.type)+"."),ex(e),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),ex(null)}}}function eO(e,t){if("object"==typeof e){if(j(e))for(var n=0;n",l=" Did you accidentally export a JSX literal instead of a component?"):s=typeof e,S("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",s,l)}var u=Q.apply(this,arguments);if(null==u)return u;if(a)for(var c=2;c ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(void 0)}}eB(e)}(function(){0===r.length?(b.current=null,t(e)):eU(e,t,n)})}catch(e){n(e)}else t(e)}var eq=!1;function eK(e){if(!eq){eq=!0;var t=0;try{for(;t is not supported and will be removed in a future major release. Did you mean to render instead?")),t.Provider},set:function(e){t.Provider=e}},_currentValue:{get:function(){return t._currentValue},set:function(e){t._currentValue=e}},_currentValue2:{get:function(){return t._currentValue2},set:function(e){t._currentValue2=e}},_threadCount:{get:function(){return t._threadCount},set:function(e){t._threadCount=e}},Consumer:{get:function(){return n||(n=!0,S("Rendering is not supported and will be removed in a future major release. Did you mean to render instead?")),t.Consumer}},displayName:{get:function(){return t.displayName},set:function(e){i||(E("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",e),i=!0)}}}),t.Consumer=o,t._currentRenderer=null,t._currentRenderer2=null,t},e.createElement=eL,e.createFactory=function(e){var t=eL.bind(null,e);return t.type=e,eN||(eN=!0,E("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(t,"type",{enumerable:!1,get:function(){return E("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},e.createRef=function(){var e={current:null};return Object.seal(e),e},e.forwardRef=function(e){null!=e&&e.$$typeof===d?S("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?S("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&S("forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null==e.defaultProps&&null==e.propTypes||S("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"));var t,n={$$typeof:l,render:e};return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(n){t=n,e.name||e.displayName||(e.displayName=n)}}),n},e.isValidElement=J,e.lazy=function(e){var t,n,r={$$typeof:f,_payload:{_status:-1,_result:e},_init:ei};return Object.defineProperties(r,{defaultProps:{configurable:!0,get:function(){return t},set:function(e){S("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),t=e,Object.defineProperty(r,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return n},set:function(e){S("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(r,"propTypes",{enumerable:!0})}}}),r},e.memo=function(e,t){eo(e)||S("memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e);var n,r={$$typeof:d,type:e,compare:void 0===t?null:t};return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return n},set:function(t){n=t,e.name||e.displayName||(e.displayName=t)}}),r},e.startTransition=function(e,t){var n=v.transition;v.transition={};var r=v.transition;v.transition._updatedFibers=new Set;try{e()}finally{v.transition=n,null===n&&r._updatedFibers&&(r._updatedFibers.size>10&&E("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),r._updatedFibers.clear())}},e.unstable_act=function(e){var t=ej;ej++,null===b.current&&(b.current=[]);var n,r=b.isBatchingLegacy;try{if(b.isBatchingLegacy=!0,n=e(),!r&&b.didScheduleLegacyUpdate){var i=b.current;null!==i&&(b.didScheduleLegacyUpdate=!1,eK(i))}}catch(e){throw ez(t),e}finally{b.isBatchingLegacy=r}if(null!==n&&"object"==typeof n&&"function"==typeof n.then){var o=n,a=!1;return eF||"undefined"==typeof Promise||Promise.resolve().then(function(){}).then(function(){a||(eF=!0,S("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(e,n){a=!0,o.then(function(r){ez(t),0===ej?eU(r,e,n):e(r)},function(e){ez(t),n(e)})}}}var s=n;if(ez(t),0===ej){var l=b.current;return null!==l&&(eK(l),b.current=null),{then:function(e,t){null===b.current?(b.current=[],eU(s,e,t)):e(s)}}}return{then:function(e,t){e(s)}}},e.useCallback=function(e,t){return ea().useCallback(e,t)},e.useContext=function(e){var t=ea();if(void 0!==e._context){var n=e._context;n.Consumer===e?S("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):n.Provider===e&&S("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return t.useContext(e)},e.useDebugValue=function(e,t){return ea().useDebugValue(e,t)},e.useDeferredValue=function(e){return ea().useDeferredValue(e)},e.useEffect=function(e,t){return ea().useEffect(e,t)},e.useId=function(){return ea().useId()},e.useImperativeHandle=function(e,t,n){return ea().useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return ea().useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return ea().useLayoutEffect(e,t)},e.useMemo=function(e,t){return ea().useMemo(e,t)},e.useReducer=function(e,t,n){return ea().useReducer(e,t,n)},e.useRef=function(e){return ea().useRef(e)},e.useState=function(e){return ea().useState(e)},e.useSyncExternalStore=function(e,t,n){return ea().useSyncExternalStore(e,t,n)},e.useTransition=function(){return ea().useTransition()},e.version="18.2.0","undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),_e.exports)),w7.exports}_e.exports;var _n,_r,_i,_o,_a={},_s={exports:{}},_l={},_u={exports:{}},_c={},_d={};function _f(){return _i||(_i=1,"production"===ex.env.NODE_ENV?_u.exports=(_n||(_n=1,function(e){function t(e,t){var n=e.length;for(e.push(t);0>>1,o=e[r];if(!(0>>1;ri(l,n))ui(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[s]=n,r=s);else{if(!(ui(c,n)))break;e[r]=c,e[u]=n,r=u}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,g="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function y(e){for(var i=n(u);null!==i;){if(null===i.callback)r(u);else{if(!(i.startTime<=e))break;r(u),i.sortIndex=i.expirationTime,t(l,i)}i=n(u)}}function A(e){if(m=!1,y(e),!p){if(null!==n(l))p=!0,O(w);else{var t=n(u);null!==t&&P(A,t.startTime-e)}}}function w(t,i){p=!1,m&&(m=!1,v(k),k=-1),h=!0;var o=f;try{for(y(i),d=n(l);null!==d&&(!(d.expirationTime>i)||t&&!x());){var a=d.callback;if("function"==typeof a){d.callback=null,f=d.priorityLevel;var s=a(d.expirationTime<=i);i=e.unstable_now(),"function"==typeof s?d.callback=s:d===n(l)&&r(l),y(i)}else r(l);d=n(l)}if(null!==d)var c=!0;else{var g=n(u);null!==g&&P(A,g.startTime-i),c=!1}return c}finally{d=null,f=o,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var _,E=!1,S=null,k=-1,M=5,C=-1;function x(){return!(e.unstable_now()-Ce||125a?(r.sortIndex=o,t(u,r),null===n(l)&&r===n(u)&&(m?(v(k),k=-1):m=!0,P(A,o-a))):(r.sortIndex=s,t(l,r),p||h||(p=!0,O(w))),r},e.unstable_shouldYield=x,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(_c)),_c):_u.exports=(_r||(_r=1,"production"!==ex.env.NODE_ENV&&function(){function e(e,t){var n=e.length;e.push(t),function(e,t,n){for(var i=n;i>0;){var o=i-1>>>1,a=e[o];if(!(r(a,t)>0))return;e[o]=t,e[i]=a,i=o}}(e,t,n)}function t(e){return 0===e.length?null:e[0]}function n(e){if(0===e.length)return null;var t=e[0],n=e.pop();return n!==t&&(e[0]=n,function(e,t,n){for(var i=0,o=e.length,a=o>>>1;ir(l,t))ur(c,l)?(e[i]=c,e[u]=t,i=u):(e[i]=l,e[s]=t,i=s);else{if(!(ur(c,t)))return;e[i]=c,e[u]=t,i=u}}}(e,n,0)),t}function r(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),"object"==typeof performance&&"function"==typeof performance.now){var i=performance;_d.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();_d.unstable_now=function(){return o.now()-a}}var s=[],l=[],u=1,c=null,d=3,f=!1,h=!1,p=!1,m="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function b(r){for(var i=t(l);null!==i;){if(null===i.callback)n(l);else{if(!(i.startTime<=r))return;n(l),i.sortIndex=i.expirationTime,e(s,i)}i=t(l)}}function y(e){if(p=!1,b(e),!h){if(null!==t(s))h=!0,T(A);else{var n=t(l);null!==n&&O(y,n.startTime-e)}}}function A(e,r){h=!1,p&&(p=!1,g(E),E=-1),f=!0;var i=d;try{return function(e,r){var i=r;for(b(i),c=t(s);null!==c&&(!(c.expirationTime>i)||e&&!M());){var o=c.callback;if("function"==typeof o){c.callback=null,d=c.priorityLevel;var a=o(c.expirationTime<=i);i=_d.unstable_now(),"function"==typeof a?c.callback=a:c===t(s)&&n(s),b(i)}else n(s);c=t(s)}if(null!==c)return!0;var u=t(l);return null!==u&&O(y,u.startTime-i),!1}(e,r)}finally{c=null,d=i,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w=!1,_=null,E=-1,S=5,k=-1;function M(){return!(_d.unstable_now()-k125?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):S=e>0?Math.floor(1e3/e):5},_d.unstable_getCurrentPriorityLevel=function(){return d},_d.unstable_getFirstCallbackNode=function(){return t(s)},_d.unstable_next=function(e){switch(d){case 1:case 2:case 3:t=3;break;default:t=d}var t,n=d;d=t;try{return e()}finally{d=n}},_d.unstable_pauseExecution=function(){},_d.unstable_requestPaint=function(){},_d.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=d;d=e;try{return t()}finally{d=n}},_d.unstable_scheduleCallback=function(n,r,i){var o,a,c=_d.unstable_now();if("object"==typeof i&&null!==i){var d=i.delay;o="number"==typeof d&&d>0?c+d:c}else o=c;switch(n){case 1:a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}var m=o+a,v={id:u++,callback:r,priorityLevel:n,startTime:o,expirationTime:m,sortIndex:-1};return o>c?(v.sortIndex=o,e(l,v),null===t(s)&&v===t(l)&&(p?(g(E),E=-1):p=!0,O(y,o-c))):(v.sortIndex=m,e(s,v),h||f||(h=!0,T(A))),v},_d.unstable_shouldYield=M,_d.unstable_wrapCallback=function(e){var t=d;return function(){var n=d;d=t;try{return e.apply(this,arguments)}finally{d=n}}},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),_d)),_u.exports}var _h,_p,_m,_g,_v={},_b={exports:{}};function _y(){return _g||(_g=1,self,_b.exports=(()=>{var e={192:(e,t)=>{var n,r,i=function(){var e,t,n=function(e,t){var n=e,r=a[t],i=null,o=0,l=null,g=[],v={},y=function(e,t){i=function(e){for(var t=Array(e),n=0;n=7&&E(e),null==l&&(l=M(n,r,g)),k(l,t)},A=function(e,t){for(var n=-1;n<=7;n+=1)if(!(e+n<=-1||o<=e+n))for(var r=-1;r<=7;r+=1)t+r<=-1||o<=t+r||(i[e+n][t+r]=0<=n&&n<=6&&(0==r||6==r)||0<=r&&r<=6&&(0==n||6==n)||2<=n&&n<=4&&2<=r&&r<=4)},w=function(){for(var e=8;e>r&1);i[Math.floor(r/3)][r%3+o-8-3]=a}for(r=0;r<18;r+=1)a=!e&&1==(t>>r&1),i[r%3+o-8-3][Math.floor(r/3)]=a},S=function(e,t){for(var n=r<<3|t,a=s.getBCHTypeInfo(n),l=0;l<15;l+=1){var u=!e&&1==(a>>l&1);l<6?i[l][8]=u:l<8?i[l+1][8]=u:i[o-15+l][8]=u}for(l=0;l<15;l+=1)u=!e&&1==(a>>l&1),l<8?i[8][o-l-1]=u:l<9?i[8][15-l-1+1]=u:i[8][15-l-1]=u;i[o-8][8]=!e},k=function(e,t){for(var n=-1,r=o-1,a=7,l=0,u=s.getMaskFunction(t),c=o-1;c>0;c-=2)for(6==c&&(c-=1);;){for(var d=0;d<2;d+=1)if(null==i[r][c-d]){var f=!1;l>>a&1)),u(r,c-d)&&(f=!f),i[r][c-d]=f,-1==(a-=1)&&(l+=1,a=7)}if((r+=n)<0||o<=r){r-=n,n=-n;break}}},M=function(e,t,n){for(var r=c.getRSBlocks(e,t),i=d(),o=0;o8*l)throw"code length overflow. ("+i.getLengthInBits()+">"+8*l+")";for(i.getLengthInBits()+4<=8*l&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=8*l||(i.put(236,8),i.getLengthInBits()>=8*l));)i.put(17,8);return function(e,t){for(var n=0,r=0,i=0,o=Array(t.length),a=Array(t.length),l=0;l=0?p.getAt(m):0}}var g=0;for(f=0;fr)&&(e=r,t=n)}return t}())},v.createTableTag=function(e,t){e=e||2;var n="";n+='';for(var r=0;r";for(var i=0;i';n+=""}return(n+="")+"
    "},v.createSvgTag=function(e,t,n,r){var i={};"object"==typeof arguments[0]&&(e=(i=arguments[0]).cellSize,t=i.margin,n=i.alt,r=i.title),e=e||2,t=void 0===t?4*e:t,(n="string"==typeof n?{text:n}:n||{}).text=n.text||null,n.id=n.text?n.id||"qrcode-description":null,(r="string"==typeof r?{text:r}:r||{}).text=r.text||null,r.id=r.text?r.id||"qrcode-title":null;var o,a,s,l,u=v.getModuleCount()*e+2*t,c="";for(l="l"+e+",0 0,"+e+" -"+e+",0 0,-"+e+"z ",c+='"+(r.text?''+C(r.text)+"":"")+(n.text?''+C(n.text)+"":"")+'"},v.createDataURL=function(e,t){e=e||2,t=void 0===t?4*e:t;var n=v.getModuleCount()*e+2*t,r=t,i=n-t;return b(n,n,function(t,n){if(r<=t&&t"};var C=function(e){for(var t="",n=0;n":t+=">";break;case"&":t+="&";break;case'"':t+=""";break;default:t+=r}}return t};return v.createASCII=function(e,t){if((e=e||1)<2)return function(e){e=void 0===e?2:e;var t,n,r,i,o,a=1*v.getModuleCount()+2*e,s=e,l=a-e,u={"██":"█","█ ":"▀"," █":"▄"," ":" "},c={"██":"▀","█ ":"▀"," █":" "," ":" "},d="";for(t=0;t=l?c[o]:u[o];d+="\n"}return a%2&&e>0?d.substring(0,d.length-a-1)+Array(a+1).join("▀"):d.substring(0,d.length-1)}(t);e-=1,t=void 0===t?2*e:t;var n,r,i,o,a=v.getModuleCount()*e+2*t,s=t,l=a-t,u=Array(e+1).join("██"),c=Array(e+1).join(" "),d="",f="";for(n=0;n>>8),t.push(255&o)):t.push(63)}}return t}};var r,i,o,a={L:1,M:0,Q:3,H:2},s=(r=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],o=function(e){for(var t=0;0!=e;)t+=1,e>>>=1;return t},(i={}).getBCHTypeInfo=function(e){for(var t=e<<10;o(t)-o(1335)>=0;)t^=1335<=0;)t^=7973<5&&(n+=3+o-5)}for(r=0;r=256;)t-=255;return e[t]}}}();function u(e,t){if(void 0===e.length)throw e.length+"/"+t;var n=function(){for(var n=0;n>>7-t%8&1)},put:function(e,t){for(var r=0;r>>t-r-1&1))},getLengthInBits:function(){return t},putBit:function(n){var r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1}};return n},f=function(e){var t=function(e){for(var t=0,r=0;r>>8&255)+(255&n),e.put(n,13),t+=2}if(t>>8)},writeBytes:function(e,n,r){n=n||0,r=r||e.length;for(var i=0;i0&&(t+=","),t+=e[n];return t+"]"}};return t},v=function(e){var t=0,n=0,r=0,i=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(43==e)return 62;if(47==e)return 63;throw"c:"+e};return{read:function(){for(;r<8;){if(t>=e.length){if(0==r)return -1;throw"unexpected end of file./"+r}var o=e.charAt(t);if(t+=1,"="==o)return r=0,-1;o.match(/^\s$/)||(n=n<<6|i(o.charCodeAt(0)),r+=6)}var a=n>>>r-8&255;return r-=8,a}}},b=function(e,t,n){for(var r,i,o,a,s,l,u,c,d,f,h=(r=Array(e*t),i=function(e){for(var t=1<>>t!=0)throw"length over";for(;l+t>=8;)c.writeByte(255&(e<>>=8-l,u=0,l=0;u|=e<0&&c.writeByte(u)}});d.write(t,i);var f=0,h=String.fromCharCode(r[0]);for(f+=1;fa.size()&&(a.size()==1<255;)n.writeByte(255),n.writeBytes(r,o,255),o+=255;n.writeByte(r.length-o),n.writeBytes(r,o,r.length-o),n.writeByte(0),n.writeString(";")}}),p=0;p=6;)d(a>>>s-6),s-=6},c.flush=function(){if(s>0&&(d(a<<6-s),a=0,s=0),l%3!=0)for(var e=3-l%3,t=0;t>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}(e)},void 0===(r="function"==typeof(n=function(){return i})?n.apply(t,[]):n)||(e.exports=r)},676:(e,t,n)=>{n.d(t,{default:()=>O});var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n2||o&&a||s&&l)this._basicSquare({x:t,y:n,size:r,rotation:0});else{if(2===u){var c=0;return o&&s?c=Math.PI/2:s&&a?c=Math.PI:a&&l&&(c=-Math.PI/2),void this._basicCornerRounded({x:t,y:n,size:r,rotation:c})}if(1===u)return c=0,s?c=Math.PI/2:a?c=Math.PI:l&&(c=-Math.PI/2),void this._basicSideRounded({x:t,y:n,size:r,rotation:c})}}else this._basicDot({x:t,y:n,size:r,rotation:0})},e.prototype._drawExtraRounded=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,a=i?+i(1,0):0,s=i?+i(0,-1):0,l=i?+i(0,1):0,u=o+a+s+l;if(0!==u){if(u>2||o&&a||s&&l)this._basicSquare({x:t,y:n,size:r,rotation:0});else{if(2===u){var c=0;return o&&s?c=Math.PI/2:s&&a?c=Math.PI:a&&l&&(c=-Math.PI/2),void this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:c})}if(1===u)return c=0,s?c=Math.PI/2:a?c=Math.PI:l&&(c=-Math.PI/2),void this._basicSideRounded({x:t,y:n,size:r,rotation:c})}}else this._basicDot({x:t,y:n,size:r,rotation:0})},e.prototype._drawClassy=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,a=i?+i(1,0):0,s=i?+i(0,-1):0,l=i?+i(0,1):0;0!==o+a+s+l?o||s?a||l?this._basicSquare({x:t,y:n,size:r,rotation:0}):this._basicCornerRounded({x:t,y:n,size:r,rotation:Math.PI/2}):this._basicCornerRounded({x:t,y:n,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:n,size:r,rotation:Math.PI/2})},e.prototype._drawClassyRounded=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,a=i?+i(1,0):0,s=i?+i(0,-1):0,l=i?+i(0,1):0;0!==o+a+s+l?o||s?a||l?this._basicSquare({x:t,y:n,size:r,rotation:0}):this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:n,size:r,rotation:Math.PI/2})},e}();var d=function(){return(d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]r||i&&i=(t-i.hideXDots)/2&&e<(t+i.hideXDots)/2&&n>=(t-i.hideYDots)/2&&n<(t+i.hideYDots)/2||(null===(r=b[e])||void 0===r?void 0:r[n])||(null===(o=b[e-t+7])||void 0===o?void 0:o[n])||(null===(a=b[e])||void 0===a?void 0:a[n-t+7])||(null===(s=y[e])||void 0===s?void 0:s[n])||(null===(l=y[e-t+7])||void 0===l?void 0:l[n])||(null===(u=y[e])||void 0===u?void 0:u[n-t+7]))}),this.drawCorners(),this._options.image?[4,this.drawImage({width:i.width,height:i.height,count:t,dotSize:r})]:[3,4];case 3:d.sent(),d.label=4;case 4:return[2]}})})},e.prototype.drawBackground=function(){var e,t,n,r=this._element,i=this._options;if(r){var o=null===(e=i.backgroundOptions)||void 0===e?void 0:e.gradient,a=null===(t=i.backgroundOptions)||void 0===t?void 0:t.color;if((o||a)&&this._createColor({options:o,color:a,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:"background-color"}),null===(n=i.backgroundOptions)||void 0===n?void 0:n.round){var s=Math.min(i.width,i.height),l=document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id","clip-path-background-color"),this._defs.appendChild(this._backgroundClipPath),l.setAttribute("x",String((i.width-s)/2)),l.setAttribute("y",String((i.height-s)/2)),l.setAttribute("width",String(s)),l.setAttribute("height",String(s)),l.setAttribute("rx",String(s/2*i.backgroundOptions.round)),this._backgroundClipPath.appendChild(l)}}},e.prototype.drawDots=function(e){var t,n,r=this;if(!this._qr)throw"QR code is not defined";var i=this._options,o=this._qr.getModuleCount();if(o>i.width||o>i.height)throw"The canvas is too small.";var a=Math.min(i.width,i.height)-2*i.margin,s=Math.floor((i.shape===m?a/Math.sqrt(2):a)/o),l=Math.floor((i.width-o*s)/2),u=Math.floor((i.height-o*s)/2),d=new c({svg:this._element,type:i.dotsOptions.type});this._dotsClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id","clip-path-dot-color"),this._defs.appendChild(this._dotsClipPath),this._createColor({options:null===(t=i.dotsOptions)||void 0===t?void 0:t.gradient,color:i.dotsOptions.color,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:"dot-color"});for(var f=function(t){for(var i=function(i){return e&&!e(t,i)?"continue":(null===(n=h._qr)||void 0===n?void 0:n.isDark(t,i))?(d.draw(l+t*s,u+i*s,s,function(n,a){return!(t+n<0||i+a<0||t+n>=o||i+a>=o)&&!(e&&!e(t+n,i+a))&&!!r._qr&&r._qr.isDark(t+n,i+a)}),void(d._element&&h._dotsClipPath&&h._dotsClipPath.appendChild(d._element))):"continue"},a=0;a=g-1&&p<=v-g&&_>=g-1&&_<=v-g||Math.sqrt((p-w)*(p-w)+(_-w)*(_-w))>w?A[p][_]=0:A[p][_]=this._qr.isDark(_-2*g<0?_:_>=o?_-2*g:_-g,p-2*g<0?p:p>=o?p-2*g:p-g)?1:0}var E=function(e){for(var t=function(t){if(!A[e][t])return"continue";d.draw(b+e*s,y+t*s,s,function(n,r){var i;return!!(null===(i=A[e+n])||void 0===i?void 0:i[t+r])}),d._element&&S._dotsClipPath&&S._dotsClipPath.appendChild(d._element)},n=0;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]s?l:s)/2));else{var d=((n.rotation||0)+i)%(2*Math.PI),f=(d+2*Math.PI)%(2*Math.PI),h=o+l/2,p=a+s/2,m=o+l/2,g=a+s/2;f>=0&&f<=.25*Math.PI||f>1.75*Math.PI&&f<=2*Math.PI?(h-=l/2,p-=s/2*Math.tan(d),m+=l/2,g+=s/2*Math.tan(d)):f>.25*Math.PI&&f<=.75*Math.PI?(p-=s/2,h-=l/2/Math.tan(d),g+=s/2,m+=l/2/Math.tan(d)):f>.75*Math.PI&&f<=1.25*Math.PI?(h+=l/2,p+=s/2*Math.tan(d),m-=l/2,g-=s/2*Math.tan(d)):f>1.25*Math.PI&&f<=1.75*Math.PI&&(p+=s/2,h+=l/2/Math.tan(d),g-=s/2,m-=l/2/Math.tan(d)),(t=document.createElementNS("http://www.w3.org/2000/svg","linearGradient")).setAttribute("id",u),t.setAttribute("gradientUnits","userSpaceOnUse"),t.setAttribute("x1",String(Math.round(h))),t.setAttribute("y1",String(Math.round(p))),t.setAttribute("x2",String(Math.round(m))),t.setAttribute("y2",String(Math.round(g)))}n.colorStops.forEach(function(e){var n=e.offset,r=e.color,i=document.createElementNS("http://www.w3.org/2000/svg","stop");i.setAttribute("offset",100*n+"%"),i.setAttribute("stop-color",r),t.appendChild(i)}),c.setAttribute("fill","url('#"+u+"')"),this._defs.appendChild(t)}else r&&c.setAttribute("fill",r);this._element.appendChild(c)},e}(),w="canvas";for(var _={},E=0;E<=40;E++)_[E]=E;let S={type:w,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:_[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000"},backgroundOptions:{round:0,color:"#fff"}};var k=function(){return(k=Object.assign||function(e){for(var t,n=1,r=arguments.length;nMath.min(t.width,t.height)&&(t.margin=Math.min(t.width,t.height)),t.dotsOptions=k({},t.dotsOptions),t.dotsOptions.gradient&&(t.dotsOptions.gradient=M(t.dotsOptions.gradient)),t.cornersSquareOptions&&(t.cornersSquareOptions=k({},t.cornersSquareOptions),t.cornersSquareOptions.gradient&&(t.cornersSquareOptions.gradient=M(t.cornersSquareOptions.gradient))),t.cornersDotOptions&&(t.cornersDotOptions=k({},t.cornersDotOptions),t.cornersDotOptions.gradient&&(t.cornersDotOptions.gradient=M(t.cornersDotOptions.gradient))),t.backgroundOptions&&(t.backgroundOptions=k({},t.backgroundOptions),t.backgroundOptions.gradient&&(t.backgroundOptions.gradient=M(t.backgroundOptions.gradient))),t}var x=n(192),R=n.n(x),I=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})},T=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]\r\n'+(new XMLSerializer).serializeToString(t)],{type:"image/svg+xml"})]:[2,new Promise(function(n){return t.toBlob(n,"image/"+e,1)})]:[2,null]}})})},e.prototype.download=function(e){return I(this,void 0,void 0,function(){var t,n,r;return T(this,function(i){switch(i.label){case 0:if(!this._qr)throw"QR code is empty";return t="png",n="qr","string"==typeof e?(t=e,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):"object"==typeof e&&null!==e&&(e.name&&(n=e.name),e.extension&&(t=e.extension)),[4,this._getElement(t)];case 1:return(r=i.sent())&&("svg"===t.toLowerCase()?s("data:image/svg+xml;charset=utf-8,"+encodeURIComponent('\r\n'+(new XMLSerializer).serializeToString(r)),n+".svg"):s(r.toDataURL("image/"+t),n+"."+t)),[2]}})})},e}()}},t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(676)})().default),_b.exports}!function(e,t,n){var r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA2CAYAAACbZ/oUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAb1SURBVHgB3Vrdcds4EN4FJVo/fnAqOKWCOBVEqcBKBbbeLvLNWFeBnQpiz+SUe4tTwckVWK4gTgVRB9ZD9BNaBG4XJGiIon4oUYrtb0YiCIIEFvuD3QUQLPxslI8cUG98wJvdVv8SnihUc29v5HknVKyAKz8Uz0dd8wxNYfhnoaKE+GG916WHHRDya/HTqAOPHJrI8WgflHOqlKqaekTsFP/pv43uTYG5K0B9CasvENSB4hkK0JVKXTg7qm3P1mPA8K9CVUmnpkAdEjF7XMdEEtE9Ktb0vStfmnEL86KDcGgal1r9Jkj5Vin4Gj6uCMSPyhM/hsfla54cnlH4TeC+h43S6eC49E1JcU01JyGxPVDqb+boL9etR+1/Yc2UNYdtcUbAetHS32GjcETzcmpxO/gIfZxmq70tkWci+96o5qBzaItsBMTvUnlHu637W1PFzOG2tlhrgm1xttkfvUgTIlGcYSgFCaD2eIWuf561yCeJ7DTwQktl4rssAQDE8Rcvznu9gMNmJgAui61BfVbng+NiExSewsyOA5XwSRVc8G591+nBqvDEoQRo4ry+eKKFrM+SsDuSih3P+6HHS6Je+jw8R1ucSWfflT8P2jAH3B4c50uiWG0VeFF082dIXJvXiqT3XLCOh2KN/felGonqfzxbxN2XsCT6jdIZvXMKW8YirsYRF2uRR+zyDenId0iBcmtwhlK+1APYGvCi4Lqv0xjJoK3qUrHHOizcVp+tGokF/gEpUfx3pKWCLPYH2CB4UlHIt2yYFolwHFoFASsk0tp663U4vNm/W3Ft3TC322m5aoNWl319VeqGr5pgsqpanN1fXhVWxAa43XMEvCu1Bu/ScjUG7XQIITv6GtT5mt3E6SqsiSy4zRaV/IHXO5/mrxhLQcArvoxyhQeRdiQFCRrqADIAc3tEYijJyEA6RK5hFg4M6y8qYJG+fRFKiTADDC1Z5S4jH5k72GUjQ8ZmKW6Ta8hcZecAMoIvnKr+NBFs6qLgQSnUSp337muQIdjYKKvDObjO2i3FyDkKaGNEBFM4qAfFCQDICCxS7LZCaDjmQqkmR0CQIcih0rQ45OaaugeCnYBg4kYVMsDPRn6fXNbrNC4o9X3GEzRs8tq5HrxGmXW3Qr+ea0VQEcGhFWPFrqzb4ahRPBGQ/waxkHIZ8ARR3H3t0YTBGvBAGyvjY0SICNahU/jQDpjTIAzMv5B1XtfwVMY0YeuIOAUMmgYV+hgP9RaMA0KEv4KU0Prqed9ILI8gI7CID47LH1dcObT+ksR07MrcZBt2QAR3xLNTX/RFkzjjAF3ODdDXABkzimlrP98XL1wcd2x9nAXW3zEoPRaxIyfao30TBsx3XM7B/eukj3O45fu47whxQP7p/kaInANOLTmUTR1ThsVx/U7SUjZ4T4kKysElhbwTHGY9HjSKXY4uxipXBbi/ZQPmk047JOaUgagpCXsCtahMztaWwBPM42AdJeMGg0ZJp5OlgKtSzu2w343EDB5fUsg7NWZKCFyGuatuWFWBpwQ2vCR5uhymdezHIt5eOPIyLFbgqRHLMMQSkPLo8cdTBDtyjcTb40IvSb+nCDYL9jPAHhvYeOU0h2fnnp8ceLmM100QrFO2vz39miXUFPMmPa0wfnxGmBLrCYKzEmfec9KBP/3SvKcdBcodI8h6VglBKUU11kcA28taA20acN1OupltnGVeXnYjLyW6JcvbijicSaaDkvojGE26mugvlcUM3MAHYsPRdRWsjYot1rmHb6v1CSZHn9y9JkU45O3ADQq/DWPeGlniVVo3ORgZjL2qkHBg3FjIAKFYd7isRTojcX60sPeH9dyvk4B/CmAbYrI4RtgyzVQ+RkhPHPE13FvKLlP5WEErQJAQ4D8J4gqeOUwyPthqYWv63EHZEb5EjgdlDthKbzVdsy3YVjpahykjcoWbjZR64S8JFdgglJSRyj4QjLKDIDZDMG2UFfP56qx9XvscxiaQo2ynKUc+0L1b2Jge0zrYnrepbZ3DyBzssiZutYQ7Dx3YACi/2V3cClMdqkmBjn0z4eWacxBZg1aB7qI2ZEM2kkuTZJvs+4m8NJ+DIF1Ks5+j96N4omjmDmeFcSjFSb9Rqs77EIZbI4nPSPJ0H4hv0mZkvB23Q2uQ3c8kFi5PSAs4bZ5zJFSgHUejm2EAwuc1M3ZTJ89R6ogq8P1rtCHwZl6sHD8rHQw/BnNUz6riA5ltH+RNmQzbohM1GZ7Q41M89UUHW/Q5LAFVBYLPp1TBYlY8oRDUJXxACadJi1dXkjnfXWLzKnkQtBm+4vqqjWfer69yBIKXOJPW4RNFU9+GDWIFbvMpng9ZHmyJY+P7YdqpUOIjrU1z3VbkM58rcjUN/geU/3c0eMPNdAAAAABJRU5ErkJggg==",i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n",t=er.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return ei(e,t)})}:ei);function ea(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var es={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},el=["Webkit","ms","Moz","O"];function eu(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||es.hasOwnProperty(e)&&es[e]?(""+t).trim():t+"px"}function ec(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=eu(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(es).forEach(function(e){el.forEach(function(t){es[t=t+e.charAt(0).toUpperCase()+e.substring(1)]=es[e]})});var ed=L({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ef(e,t){if(t){if(ed[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(n(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(n(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(n(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(n(62))}}function eh(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ep=null;function em(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var eg=null,ev=null,eb=null;function ey(e){if(e=rC(e)){if("function"!=typeof eg)throw Error(n(280));var t=e.stateNode;t&&(t=rR(t),eg(e.stateNode,e.type,t))}}function eA(e){ev?eb?eb.push(e):eb=[e]:ev=e}function ew(){if(ev){var e=ev,t=eb;if(eb=ev=null,ey(e),t)for(e=0;e>>=0)?32:31-(e0(e)/e1|0)|0},e0=Math.log,e1=Math.LN2,e2=64,e3=4194304;function e6(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function e4(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=268435455&n;if(0!==a){var s=a&~i;0!==s?r=e6(s):0!=(o&=a)&&(r=e6(o))}else 0!=(a=n&~i)?r=e6(a):0!==o&&(r=e6(o));if(0===r)return 0;if(0!==t&&t!==r&&0==(t&i)&&((i=r&-r)>=(o=t&-t)||16===i&&0!=(4194240&o)))return t;if(0!=(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function e9(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-eX(t)]=n}function te(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-eX(n),i=1<=nr),na=!1;function ns(e,t){switch(e){case"keyup":return -1!==nt.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nl(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var nu=!1,nc={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function nd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!nc[e.type]:"textarea"===t}function nf(e,t,n,r){eA(r),0<(t=re(t,"onChange")).length&&(n=new tV("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var nh=null,np=null;function nm(e){n2(e,0)}function ng(e){if(U(rx(e)))return e}function nv(e,t){if("change"===e)return t}var nb=!1;if(s){if(s){var ny="oninput"in document;if(!ny){var nA=document.createElement("div");nA.setAttribute("oninput","return;"),ny="function"==typeof nA.oninput}ad=ny}else ad=!1;nb=ad&&(!document.documentMode||9=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=nR(r)}}function nT(){for(var e=window,t=q();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=q((e=t.contentWindow).document)}return t}function nO(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var nP=s&&"documentMode"in document&&11>=document.documentMode,nL=null,nN=null,nD=null,nB=!1;function nj(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;nB||null==nL||nL!==q(r)||(r="selectionStart"in(r=nL)&&nO(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},nD&&nx(nD,r)||(nD=r,0<(r=re(nN,"onSelect")).length&&(t=new tV("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=nL)))}function nF(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var nz={animationend:nF("Animation","AnimationEnd"),animationiteration:nF("Animation","AnimationIteration"),animationstart:nF("Animation","AnimationStart"),transitionend:nF("Transition","TransitionEnd")},nU={},nq={};function nK(e){if(nU[e])return nU[e];if(!nz[e])return e;var t,n=nz[e];for(t in n)if(n.hasOwnProperty(t)&&t in nq)return nU[e]=n[t];return e}s&&(nq=document.createElement("div").style,"AnimationEvent"in window||(delete nz.animationend.animation,delete nz.animationiteration.animation,delete nz.animationstart.animation),"TransitionEvent"in window||delete nz.transitionend.transition);var nH=nK("animationend"),nV=nK("animationiteration"),n$=nK("animationstart"),nW=nK("transitionend"),nY=new Map,nG="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function nQ(e,t){nY.set(e,t),o(t,[e])}for(var nZ=0;nZrT||(e.current=rI[rT],rI[rT]=null,rT--)}function rL(e,t){rI[++rT]=e.current,e.current=t}var rN={},rD=rO(rN),rB=rO(!1),rj=rN;function rF(e,t){var n=e.type.contextTypes;if(!n)return rN;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function rz(e){return null!=(e=e.childContextTypes)}function rU(){rP(rB),rP(rD)}function rq(e,t,r){if(rD.current!==rN)throw Error(n(168));rL(rD,t),rL(rB,r)}function rK(e,t,r){var i=e.stateNode;if(t=t.childContextTypes,"function"!=typeof i.getChildContext)return r;for(var o in i=i.getChildContext())if(!(o in t))throw Error(n(108,function(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return function e(t){if(null==t)return null;if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case A:return"Fragment";case y:return"Portal";case _:return"Profiler";case w:return"StrictMode";case M:return"Suspense";case C:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case S:return(t.displayName||"Context")+".Consumer";case E:return(t._context.displayName||"Context")+".Provider";case k:var n=t.render;return(t=t.displayName)||(t=""!==(t=n.displayName||n.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case x:return null!==(n=t.displayName||null)?n:e(t.type)||"Memo";case R:n=t._payload,t=t._init;try{return e(t(n))}catch(e){}}return null}(t);case 8:return t===w?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}(e)||"Unknown",o));return L({},r,i)}function rH(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||rN,rj=rD.current,rL(rD,e),rL(rB,rB.current),!0}function rV(e,t,r){var i=e.stateNode;if(!i)throw Error(n(169));r?(e=rK(e,t,rj),i.__reactInternalMemoizedMergedChildContext=e,rP(rB),rP(rD),rL(rD,e)):rP(rB),rL(rB,r)}var r$=null,rW=!1,rY=!1;function rG(e){null===r$?r$=[e]:r$.push(e)}function rQ(){if(!rY&&null!==r$){rY=!0;var e=0,t=tt;try{var n=r$;for(tt=1;e>=a,i-=a,r6=1<<32-eX(t)+i|n<m?(g=d,d=null):g=d.sibling;var v=h(n,d,s[m],l);if(null===v){null===d&&(d=g);break}e&&d&&null===v.alternate&&t(n,d),o=a(v,o,m),null===c?u=v:c.sibling=v,c=v,d=g}if(m===s.length)return r(n,d),ir&&r8(n,m),u;if(null===d){for(;mg?(v=m,m=null):v=m.sibling;var y=h(o,m,b.value,u);if(null===y){null===m&&(m=v);break}e&&m&&null===y.alternate&&t(o,m),s=a(y,s,g),null===d?c=y:d.sibling=y,d=y,m=v}if(b.done)return r(o,m),ir&&r8(o,g),c;if(null===m){for(;!b.done;g++,b=l.next())null!==(b=f(o,b.value,u))&&(s=a(b,s,g),null===d?c=b:d.sibling=b,d=b);return ir&&r8(o,g),c}for(m=i(o,m);!b.done;g++,b=l.next())null!==(b=p(m,o,g,b.value,u))&&(e&&null!==b.alternate&&m.delete(null===b.key?g:b.key),s=a(b,s,g),null===d?c=b:d.sibling=b,d=b);return e&&m.forEach(function(e){return t(o,e)}),ir&&r8(o,g),c}(u,c,d,m);iW(u,d)}return"string"==typeof d&&""!==d||"number"==typeof d?(d=""+d,null!==c&&6===c.tag?(r(u,c.sibling),(c=o(c,d)).return=u):(r(u,c),(c=sJ(d,u.mode,m)).return=u),s(u=c)):r(u,c)}}var iQ=iG(!0),iZ=iG(!1),iJ={},iX=rO(iJ),i0=rO(iJ),i1=rO(iJ);function i2(e){if(e===iJ)throw Error(n(174));return e}function i3(e,t){switch(rL(i1,t),rL(i0,e),rL(iX,iJ),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:en(null,"");break;default:t=en(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}rP(iX),rL(iX,t)}function i6(){rP(iX),rP(i0),rP(i1)}function i4(e){i2(i1.current);var t=i2(iX.current),n=en(t,e.type);t!==n&&(rL(i0,e),rL(iX,n))}function i8(e){i0.current===e&&(rP(iX),rP(i0))}var i5=rO(0);function i7(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var i9=[];function oe(){for(var e=0;en?n:4,e(!0);var r=on.transition;on.transition={};try{e(!1),t()}finally{tt=n,on.transition=r}}function oK(){return og().memoizedState}function oH(e,t,n){var r=sy(e);(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},o$(e))?oW(t,n):null!==(n=ix(e,t,n,r))&&(sA(n,e,r,sb()),oY(n,t,r))}function oV(e,t,n){var r=sy(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(o$(e))oW(t,i);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,nC(s,a)){var l=t.interleaved;return null===l?(i.next=i,iC(t)):(i.next=l.next,l.next=i),void(t.interleaved=i)}}catch(e){}null!==(n=ix(e,t,i,r))&&(sA(n,e,r,i=sb()),oY(n,t,r))}}function o$(e){var t=e.alternate;return e===oi||null!==t&&t===oi}function oW(e,t){ol=os=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function oY(e,t,n){if(0!=(4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,te(e,n)}}var oG={readContext:ik,useCallback:od,useContext:od,useEffect:od,useImperativeHandle:od,useInsertionEffect:od,useLayoutEffect:od,useMemo:od,useReducer:od,useRef:od,useState:od,useDebugValue:od,useDeferredValue:od,useTransition:od,useMutableSource:od,useSyncExternalStore:od,useId:od,unstable_isNewReconciler:!1},oQ={readContext:ik,useCallback:function(e,t){return om().memoizedState=[e,void 0===t?null:t],e},useContext:ik,useEffect:oO,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,oI(4194308,4,oD.bind(null,t,e),n)},useLayoutEffect:function(e,t){return oI(4194308,4,e,t)},useInsertionEffect:function(e,t){return oI(4,2,e,t)},useMemo:function(e,t){var n=om();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=om();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=oH.bind(null,oi,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},om().memoizedState=e},useState:oC,useDebugValue:oj,useDeferredValue:function(e){return om().memoizedState=e},useTransition:function(){var e=oC(!1),t=e[0];return e=oq.bind(null,e[1]),om().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var i=oi,o=om();if(ir){if(void 0===r)throw Error(n(407));r=r()}else{if(r=t(),null===a3)throw Error(n(349));0!=(30&or)||o_(i,t,r)}o.memoizedState=r;var a={value:r,getSnapshot:t};return o.queue=a,oO(oS.bind(null,i,a,e),[e]),i.flags|=2048,ox(9,oE.bind(null,i,a,r,t),void 0,null),r},useId:function(){var e=om(),t=a3.identifierPrefix;if(ir){var n=r4;t=":"+t+"R"+(n=(r6&~(1<<32-eX(r6)-1)).toString(32)+n),0<(n=ou++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=oc++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},oZ={readContext:ik,useCallback:oF,useContext:ik,useEffect:oP,useImperativeHandle:oB,useInsertionEffect:oL,useLayoutEffect:oN,useMemo:oz,useReducer:ob,useRef:oR,useState:function(){return ob(ov)},useDebugValue:oj,useDeferredValue:function(e){return oU(og(),oo.memoizedState,e)},useTransition:function(){return[ob(ov)[0],og().memoizedState]},useMutableSource:oA,useSyncExternalStore:ow,useId:oK,unstable_isNewReconciler:!1},oJ={readContext:ik,useCallback:oF,useContext:ik,useEffect:oP,useImperativeHandle:oB,useInsertionEffect:oL,useLayoutEffect:oN,useMemo:oz,useReducer:oy,useRef:oR,useState:function(){return oy(ov)},useDebugValue:oj,useDeferredValue:function(e){var t=og();return null===oo?t.memoizedState=e:oU(t,oo.memoizedState,e)},useTransition:function(){return[oy(ov)[0],og().memoizedState]},useMutableSource:oA,useSyncExternalStore:ow,useId:oK,unstable_isNewReconciler:!1};function oX(e,t){try{var n="",r=t;do n+=function(e){switch(e.tag){case 5:return N(e.type);case 16:return N("Lazy");case 13:return N("Suspense");case 19:return N("SuspenseList");case 0:case 2:case 15:return e=B(e.type,!1);case 11:return e=B(e.type.render,!1);case 1:return e=B(e.type,!0);default:return""}}(r),r=r.return;while(r);var i=n}catch(e){i="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:i,digest:null}}function o0(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function o1(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var o2="function"==typeof WeakMap?WeakMap:Map;function o3(e,t,n){(n=iP(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){sl||(sl=!0,su=r),o1(0,t)},n}function o6(e,t,n){(n=iP(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){o1(0,t)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){o1(0,t),"function"!=typeof r&&(null===sc?sc=new Set([this]):sc.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function o4(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new o2;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=sU.bind(null,e,t,n),t.then(e,e))}function o8(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function o5(e,t,n,r,i){return 0==(1&e.mode)?e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=iP(-1,1)).tag=2,iL(n,t,1))),n.lanes|=1):(e.flags|=65536,e.lanes=i),e}var o7=v.ReactCurrentOwner,o9=!1;function ae(e,t,n,r){t.child=null===e?iZ(t,null,n,r):iQ(t,e.child,n,r)}function at(e,t,n,r,i){n=n.render;var o=t.ref;return iS(t,i),r=oh(e,t,n,r,o,i),n=op(),null===e||o9?(ir&&n&&r7(t),t.flags|=1,ae(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ak(e,t,i))}function an(e,t,n,r,i){if(null===e){var o=n.type;return"function"!=typeof o||sW(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=sG(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,ar(e,t,o,r,i))}if(o=e.child,0==(e.lanes&i)){var a=o.memoizedProps;if((n=null!==(n=n.compare)?n:nx)(a,r)&&e.ref===t.ref)return ak(e,t,i)}return t.flags|=1,(e=sY(o,r)).ref=t.ref,e.return=t,t.child=e}function ar(e,t,n,r,i){if(null!==e){var o=e.memoizedProps;if(nx(o,r)&&e.ref===t.ref){if(o9=!1,t.pendingProps=r=o,0==(e.lanes&i))return t.lanes=e.lanes,ak(e,t,i);0!=(131072&e.flags)&&(o9=!0)}}return aa(e,t,n,r,i)}function ai(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode){if(0==(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},rL(a5,a8),a8|=n;else{if(0==(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,rL(a5,a8),a8|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,rL(a5,a8),a8|=r}}else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,rL(a5,a8),a8|=r;return ae(e,t,i,n),t.child}function ao(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function aa(e,t,n,r,i){var o=rz(n)?rj:rD.current;return o=rF(t,o),iS(t,i),n=oh(e,t,n,r,o,i),r=op(),null===e||o9?(ir&&r&&r7(t),t.flags|=1,ae(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ak(e,t,i))}function as(e,t,n,r,i){if(rz(n)){var o=!0;rH(t)}else o=!1;if(iS(t,i),null===t.stateNode)aS(e,t),iK(t,n,r),iV(t,n,r,i),r=!0;else if(null===e){var a=t.stateNode,s=t.memoizedProps;a.props=s;var l=a.context,u=n.contextType;u="object"==typeof u&&null!==u?ik(u):rF(t,u=rz(n)?rj:rD.current);var c=n.getDerivedStateFromProps,d="function"==typeof c||"function"==typeof a.getSnapshotBeforeUpdate;d||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==r||l!==u)&&iH(t,a,r,u),iI=!1;var f=t.memoizedState;a.state=f,iB(t,r,a,i),l=t.memoizedState,s!==r||f!==l||rB.current||iI?("function"==typeof c&&(iz(t,n,c,r),l=t.memoizedState),(s=iI||iq(t,n,s,r,f,l,u))?(d||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=u,r=s):("function"==typeof a.componentDidMount&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,iO(e,t),s=t.memoizedProps,u=t.type===t.elementType?s:ig(t.type,s),a.props=u,d=t.pendingProps,f=a.context,l="object"==typeof(l=n.contextType)&&null!==l?ik(l):rF(t,l=rz(n)?rj:rD.current);var h=n.getDerivedStateFromProps;(c="function"==typeof h||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==d||f!==l)&&iH(t,a,r,l),iI=!1,f=t.memoizedState,a.state=f,iB(t,r,a,i);var p=t.memoizedState;s!==d||f!==p||rB.current||iI?("function"==typeof h&&(iz(t,n,h,r),p=t.memoizedState),(u=iI||iq(t,n,u,r,f,p,l)||!1)?(c||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,p,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=l,r=u):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return al(e,t,n,r,o,i)}function al(e,t,n,r,i,o){ao(e,t);var a=0!=(128&t.flags);if(!r&&!a)return i&&rV(t,n,!1),ak(e,t,o);r=t.stateNode,o7.current=t;var s=a&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&a?(t.child=iQ(t,e.child,null,o),t.child=iQ(t,null,s,o)):ae(e,t,s,o),t.memoizedState=r.state,i&&rV(t,n,!0),t.child}function au(e){var t=e.stateNode;t.pendingContext?rq(0,t.pendingContext,t.pendingContext!==t.context):t.context&&rq(0,t.context,!1),i3(e,t.containerInfo)}function ac(e,t,n,r,i){return ih(),ip(i),t.flags|=256,ae(e,t,n,r),t.child}var ad,af,ah,ap,am,ag={dehydrated:null,treeContext:null,retryLane:0};function av(e){return{baseLanes:e,cachePool:null,transitions:null}}function ab(e,t,r){var i,o=t.pendingProps,a=i5.current,s=!1,l=0!=(128&t.flags);if((i=l)||(i=(null===e||null!==e.memoizedState)&&0!=(2&a)),i?(s=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(a|=1),rL(i5,1&a),null===e)return il(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0==(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(l=o.children,e=o.fallback,s?(o=t.mode,s=t.child,l={mode:"hidden",children:l},0==(1&o)&&null!==s?(s.childLanes=0,s.pendingProps=l):s=sZ(l,o,0,null),e=sQ(e,o,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=av(r),t.memoizedState=ag,e):ay(t,l));if(null!==(a=e.memoizedState)&&null!==(i=a.dehydrated))return function(e,t,r,i,o,a,s){if(r)return 256&t.flags?(t.flags&=-257,aA(e,t,s,i=o0(Error(n(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(a=i.fallback,o=t.mode,i=sZ({mode:"visible",children:i.children},o,0,null),(a=sQ(a,o,s,null)).flags|=2,i.return=t,a.return=t,i.sibling=a,t.child=i,0!=(1&t.mode)&&iQ(t,e.child,null,s),t.child.memoizedState=av(s),t.memoizedState=ag,a);if(0==(1&t.mode))return aA(e,t,s,null);if("$!"===o.data){if(i=o.nextSibling&&o.nextSibling.dataset)var l=i.dgst;return i=l,aA(e,t,s,i=o0(a=Error(n(419)),i,void 0))}if(l=0!=(s&e.childLanes),o9||l){if(null!==(i=a3)){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}0!==(o=0!=(o&(i.suspendedLanes|s))?0:o)&&o!==a.retryLane&&(a.retryLane=o,iR(e,o),sA(i,e,o,-1))}return sP(),aA(e,t,s,i=o0(Error(n(421))))}return"$?"===o.data?(t.flags|=128,t.child=e.child,t=sK.bind(null,e),o._reactRetry=t,null):(e=a.treeContext,it=rv(o.nextSibling),ie=t,ir=!0,ii=null,null!==e&&(r1[r2++]=r6,r1[r2++]=r4,r1[r2++]=r3,r6=e.id,r4=e.overflow,r3=t),t=ay(t,i.children),t.flags|=4096,t)}(e,t,l,o,i,a,r);if(s){s=o.fallback,l=t.mode,i=(a=e.child).sibling;var u={mode:"hidden",children:o.children};return 0==(1&l)&&t.child!==a?((o=t.child).childLanes=0,o.pendingProps=u,t.deletions=null):(o=sY(a,u)).subtreeFlags=14680064&a.subtreeFlags,null!==i?s=sY(i,s):(s=sQ(s,l,r,null)).flags|=2,s.return=t,o.return=t,o.sibling=s,t.child=o,o=s,s=t.child,l=null===(l=e.child.memoizedState)?av(r):{baseLanes:l.baseLanes|r,cachePool:null,transitions:l.transitions},s.memoizedState=l,s.childLanes=e.childLanes&~r,t.memoizedState=ag,o}return e=(s=e.child).sibling,o=sY(s,{mode:"visible",children:o.children}),0==(1&t.mode)&&(o.lanes=r),o.return=t,o.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=o,t.memoizedState=null,o}function ay(e,t){return(t=sZ({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function aA(e,t,n,r){return null!==r&&ip(r),iQ(t,e.child,null,n),(e=ay(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function aw(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),iE(e.return,t,n)}function a_(e,t,n,r,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function aE(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(ae(e,t,r.children,n),0!=(2&(r=i5.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&aw(e,n,t);else if(19===e.tag)aw(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(rL(i5,r),0==(1&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===i7(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),a_(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===i7(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}a_(t,!0,n,null,o);break;case"together":a_(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function aS(e,t){0==(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ak(e,t,r){if(null!==e&&(t.dependencies=e.dependencies),se|=t.lanes,0==(r&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(n(153));if(null!==t.child){for(r=sY(e=t.child,e.pendingProps),t.child=r,r.return=t;null!==e.sibling;)e=e.sibling,(r=r.sibling=sY(e,e.pendingProps)).return=t;r.sibling=null}return t.child}function aM(e,t){if(!ir)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function aC(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=14680064&i.subtreeFlags,r|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}af=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ah=function(){},ap=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,i2(iX.current);var a,s=null;switch(n){case"input":o=K(e,o),r=K(e,r),s=[];break;case"select":o=L({},o,{value:void 0}),r=L({},r,{value:void 0}),s=[];break;case"textarea":o=Z(e,o),r=Z(e,r),s=[];break;default:"function"!=typeof o.onClick&&"function"==typeof r.onClick&&(e.onclick=rs)}for(c in ef(n,r),n=null,o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&null!=o[c]){if("style"===c){var l=o[c];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(i.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null))}for(c in r){var u=r[c];if(l=null!=o?o[c]:void 0,r.hasOwnProperty(c)&&u!==l&&(null!=u||null!=l)){if("style"===c){if(l){for(a in l)!l.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in u)u.hasOwnProperty(a)&&l[a]!==u[a]&&(n||(n={}),n[a]=u[a])}else n||(s||(s=[]),s.push(c,n)),n=u}else"dangerouslySetInnerHTML"===c?(u=u?u.__html:void 0,l=l?l.__html:void 0,null!=u&&l!==u&&(s=s||[]).push(c,u)):"children"===c?"string"!=typeof u&&"number"!=typeof u||(s=s||[]).push(c,""+u):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(i.hasOwnProperty(c)?(null!=u&&"onScroll"===c&&n3("scroll",e),s||l===u||(s=[])):(s=s||[]).push(c,u))}}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}},am=function(e,t,n,r){n!==r&&(t.flags|=4)};var ax=!1,aR=!1,aI="function"==typeof WeakSet?WeakSet:Set,aT=null;function aO(e,t){var n=e.ref;if(null!==n){if("function"==typeof n)try{n(null)}catch(n){sz(e,t,n)}else n.current=null}}function aP(e,t,n){try{n()}catch(n){sz(e,t,n)}}var aL=!1;function aN(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,void 0!==o&&aP(t,n,o)}i=i.next}while(i!==r)}}function aD(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function aB(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function aj(e){return 5===e.tag||3===e.tag||4===e.tag}function aF(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||aj(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags||null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}var az=null,aU=!1;function aq(e,t,n){for(n=n.child;null!==n;)aK(e,t,n),n=n.sibling}function aK(e,t,n){if(eJ&&"function"==typeof eJ.onCommitFiberUnmount)try{eJ.onCommitFiberUnmount(eZ,n)}catch(e){}switch(n.tag){case 5:aR||aO(n,t);case 6:var r=az,i=aU;az=null,aq(e,t,n),aU=i,null!==(az=r)&&(aU?(e=az,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):az.removeChild(n.stateNode));break;case 18:null!==az&&(aU?(e=az,n=n.stateNode,8===e.nodeType?rg(e.parentNode,n):1===e.nodeType&&rg(e,n),tS(e)):rg(az,n.stateNode));break;case 4:r=az,i=aU,az=n.stateNode.containerInfo,aU=!0,aq(e,t,n),az=r,aU=i;break;case 0:case 11:case 14:case 15:if(!aR&&null!==(r=n.updateQueue)&&null!==(r=r.lastEffect)){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,void 0!==a&&(0!=(2&o)||0!=(4&o))&&aP(n,t,a),i=i.next}while(i!==r)}aq(e,t,n);break;case 1:if(!aR&&(aO(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){sz(n,t,e)}aq(e,t,n);break;case 21:default:aq(e,t,n);break;case 22:1&n.mode?(aR=(r=aR)||null!==n.memoizedState,aq(e,t,n),aR=r):aq(e,t,n)}}function aH(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new aI),t.forEach(function(t){var r=sH.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function aV(e,t){var r=t.deletions;if(null!==r)for(var i=0;io&&(o=s),i&=~a}if(i=o,10<(i=(120>(i=eH()-i)?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*aJ(i/1960))-i)){e.timeoutHandle=rd(sB.bind(null,e,si,ss),i);break}sB(e,si,ss);break;default:throw Error(n(329))}}}return sw(e,eH()),e.callbackNode===r?s_.bind(null,e):null}function sE(e,t){var n=sr;return e.current.memoizedState.isDehydrated&&(sI(e,t).flags|=256),2!==(e=sL(e,t))&&(t=si,si=n,null!==t&&sS(t)),e}function sS(e){null===si?si=e:si.push.apply(si,e)}function sk(e,t){for(t&=~sn,t&=~st,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0",e=e.removeChild(e.firstChild)):"string"==typeof o.is?e=l.createElement(r,{is:o.is}):(e=l.createElement(r),"select"===r&&(l=e,o.multiple?l.multiple=!0:o.size&&(l.size=o.size))):e=l.createElementNS(e,r),e[rA]=t,e[rw]=o,af(e,t,!1,!1),t.stateNode=e;e:{switch(l=eh(r,o),r){case"dialog":n3("cancel",e),n3("close",e),a=o;break;case"iframe":case"object":case"embed":n3("load",e),a=o;break;case"video":case"audio":for(a=0;asa&&(t.flags|=128,o=!0,aM(s,!1),t.lanes=4194304)}}else{if(!o){if(null!==(e=i7(l))){if(t.flags|=128,o=!0,null!==(r=e.updateQueue)&&(t.updateQueue=r,t.flags|=4),aM(s,!0),null===s.tail&&"hidden"===s.tailMode&&!l.alternate&&!ir)return aC(t),null}else 2*eH()-s.renderingStartTime>sa&&1073741824!==r&&(t.flags|=128,o=!0,aM(s,!1),t.lanes=4194304)}s.isBackwards?(l.sibling=t.child,t.child=l):(null!==(r=s.last)?r.sibling=l:t.child=l,s.last=l)}return null!==s.tail?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=eH(),t.sibling=null,r=i5.current,rL(i5,o?1&r|2:1&r),t):(aC(t),null);case 22:case 23:return sR(),o=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==o&&(t.flags|=8192),o&&0!=(1&t.mode)?0!=(1073741824&a8)&&(aC(t),6&t.subtreeFlags&&(t.flags|=8192)):aC(t),null;case 24:case 25:return null}throw Error(n(156,t.tag))}(r,t,a8)))return void(a6=r)}else{if(null!==(r=function(e,t){switch(r9(t),t.tag){case 1:return rz(t.type)&&rU(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return i6(),rP(rB),rP(rD),oe(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 5:return i8(t),null;case 13:if(rP(i5),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(n(340));ih()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return rP(i5),null;case 4:return i6(),null;case 10:return i_(t.type._context),null;case 22:case 23:return sR(),null;default:return null}}(r,t)))return r.flags&=32767,void(a6=r);if(null===e)return a7=6,void(a6=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(a6=t);a6=t=e}while(null!==t);0===a7&&(a7=5)}function sB(e,t,r){var i=tt,o=a1.transition;try{a1.transition=null,tt=1,function(e,t,r,i){do sj();while(null!==sf);if(0!=(6&a2))throw Error(n(327));r=e.finishedWork;var o=e.finishedLanes;if(null!==r){if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(n(177));e.callbackNode=null,e.callbackPriority=0;var a=r.lanes|r.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0r&&(i=r,r=o,o=i),i=nI(n,o);var a=nI(n,r);i&&a&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&((t=t.createRange()).setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;ne?16:e,null===sf)var i=!1;else{if(e=sf,sf=null,sh=0,0!=(6&a2))throw Error(n(331));var o=a2;for(a2|=4,aT=e.current;null!==aT;){var a=aT,s=a.child;if(0!=(16&aT.flags)){var l=a.deletions;if(null!==l){for(var u=0;ueH()-so?sI(e,0):sn|=n),sw(e,t)}function sq(e,t){0===t&&(0==(1&e.mode)?t=1:(t=e3,0==(130023424&(e3<<=1))&&(e3=4194304)));var n=sb();null!==(e=iR(e,t))&&(e9(e,t,n),sw(e,n))}function sK(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),sq(e,n)}function sH(e,t){var r=0;switch(e.tag){case 13:var i=e.stateNode,o=e.memoizedState;null!==o&&(r=o.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(n(314))}null!==i&&i.delete(t),sq(e,r)}function sV(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function s$(e,t,n,r){return new sV(e,t,n,r)}function sW(e){return!(!(e=e.prototype)||!e.isReactComponent)}function sY(e,t){var n=e.alternate;return null===n?((n=s$(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function sG(e,t,r,i,o,a){var s=2;if(i=e,"function"==typeof e)sW(e)&&(s=1);else if("string"==typeof e)s=5;else e:switch(e){case A:return sQ(r.children,o,a,t);case w:s=8,o|=8;break;case _:return(e=s$(12,r,t,2|o)).elementType=_,e.lanes=a,e;case M:return(e=s$(13,r,t,o)).elementType=M,e.lanes=a,e;case C:return(e=s$(19,r,t,o)).elementType=C,e.lanes=a,e;case I:return sZ(r,o,a,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case E:s=10;break e;case S:s=9;break e;case k:s=11;break e;case x:s=14;break e;case R:s=16,i=null;break e}throw Error(n(130,null==e?e:typeof e,""))}return(t=s$(s,r,t,o)).elementType=e,t.type=i,t.lanes=a,t}function sQ(e,t,n,r){return(e=s$(7,e,r,t)).lanes=n,e}function sZ(e,t,n,r){return(e=s$(22,e,r,t)).elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function sJ(e,t,n){return(e=s$(6,e,null,t)).lanes=n,e}function sX(e,t,n){return(t=s$(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function s0(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=e7(0),this.expirationTimes=e7(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=e7(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function s1(e,t,n,r,i,o,a,s,l){return e=new s0(e,t,n,s,l),1===t?(t=1,!0===o&&(t|=8)):t=0,o=s$(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},iT(o),e}function s2(e){if(!e)return rN;e:{if(eD(e=e._reactInternals)!==e||1!==e.tag)throw Error(n(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(rz(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(n(171))}if(1===e.tag){var r=e.type;if(rz(r))return rK(e,r,t)}return t}function s3(e,t,n,r,i,o,a,s,l){return(e=s1(n,r,!0,e,0,o,0,s,l)).context=s2(null),n=e.current,(o=iP(r=sb(),i=sy(n))).callback=null!=t?t:null,iL(n,o,i),e.current.lanes=i,e9(e,i,r),sw(e,r),e}function s6(e,t,n,r){var i=t.current,o=sb(),a=sy(i);return n=s2(n),null===t.context?t.context=n:t.pendingContext=n,(t=iP(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=iL(i,t,a))&&(sA(e,i,a,o),iN(e,i,a)),a}function s4(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function s8(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n1?t-1:0),r=1;r1?t-1:0),r=1;r2&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1])}function x(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":if(r)return!1;if(null!==n)return!n.acceptsBooleans;var i=e.toLowerCase().slice(0,5);return"data-"!==i&&"aria-"!==i;default:return!1}}function R(e,t,n,r){if(null==t||x(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||t<1}return!1}function I(e){return O.hasOwnProperty(e)?O[e]:null}function T(e,t,n,r,i,o,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var O={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(function(e){O[e]=new T(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0],n=e[1];O[t]=new T(t,1,!1,n,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){O[e]=new T(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){O[e]=new T(e,2,!1,e,null,!1,!1)}),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(function(e){O[e]=new T(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){O[e]=new T(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){O[e]=new T(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){O[e]=new T(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){O[e]=new T(e,5,!1,e.toLowerCase(),null,!1,!1)});var P=/[\-\:]([a-z])/g,L=function(e){return e[1].toUpperCase()};["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(function(e){var t=e.replace(P,L);O[t]=new T(t,1,!1,e,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(function(e){var t=e.replace(P,L);O[t]=new T(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(P,L);O[t]=new T(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){O[e]=new T(e,1,!1,e.toLowerCase(),null,!1,!1)}),O.xlinkHref=new T("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){O[e]=new T(e,1,!1,e.toLowerCase(),null,!0,!0)});var N=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i,D=!1;function B(e){!D&&N.test(e)&&(D=!0,l("A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML try using dangerouslySetInnerHTML instead. React was passed %s.",JSON.stringify(e)))}function j(e,t,n,r){if(M(t)){if(!e.hasAttribute(t))return void 0===n?void 0:null;var i=e.getAttribute(t);return y(n,t),i===""+n?n:i}}function F(e,t,n,r){var i=I(t);if(!C(t,i,r)){if(R(t,n,i,r)&&(n=null),r||null===i)M(t)&&(null===n?e.removeAttribute(t):(y(n,t),e.setAttribute(t,""+n)));else if(i.mustUseProperty){var o=i.propertyName;if(null===n){var a=i.type;e[o]=3!==a&&""}else e[o]=n}else{var s=i.attributeName,l=i.attributeNamespace;if(null===n)e.removeAttribute(s);else{var u,c=i.type;3===c||4===c&&!0===n?u="":(y(n,s),u=""+n,i.sanitizeURL&&B(u.toString())),l?e.setAttributeNS(l,s,u):e.setAttribute(s,u)}}}}var z=Symbol.for("react.element"),U=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),V=Symbol.for("react.provider"),$=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),J=(Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode"),Symbol.for("react.offscreen")),X=(Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker"),Symbol.iterator);function ee(e){if(null===e||"object"!=typeof e)return null;var t=X&&e[X]||e["@@iterator"];return"function"==typeof t?t:null}var et,en,er,ei,eo,ea,es,el=Object.assign,eu=0;function ec(){}ec.__reactDisabledLog=!0;var ed,ef=o.ReactCurrentDispatcher;function eh(e,t,n){if(void 0===ed)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);ed=r&&r[1]||""}return"\n"+ed+e}var ep,em=!1;function eg(e,t){if(!e||em)return"";var n,r=ep.get(e);if(void 0!==r)return r;em=!0;var i,o=Error.prepareStackTrace;Error.prepareStackTrace=void 0,i=ef.current,ef.current=null,function(){if(0===eu){et=console.log,en=console.info,er=console.warn,ei=console.error,eo=console.group,ea=console.groupCollapsed,es=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ec,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}eu++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){n=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){n=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),u=n.stack.split("\n"),c=s.length-1,d=u.length-1;c>=1&&d>=0&&s[c]!==u[d];)d--;for(;c>=1&&d>=0;c--,d--)if(s[c]!==u[d]){if(1!==c||1!==d)do if(c--,--d<0||s[c]!==u[d]){var f="\n"+s[c].replace(" at new "," at ");return e.displayName&&f.includes("")&&(f=f.replace("",e.displayName)),"function"==typeof e&&ep.set(e,f),f}while(c>=1&&d>=0);break}}}finally{em=!1,ef.current=i,function(){if(0==--eu){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:el({},e,{value:et}),info:el({},e,{value:en}),warn:el({},e,{value:er}),error:el({},e,{value:ei}),group:el({},e,{value:eo}),groupCollapsed:el({},e,{value:ea}),groupEnd:el({},e,{value:es})})}eu<0&&l("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=o}var h=e?e.displayName||e.name:"",p=h?eh(h):"";return"function"==typeof e&&ep.set(e,p),p}function ev(e){try{var t="",n=e;do t+=function(e){switch(e._debugOwner&&e._debugOwner.type,e._debugSource,e.tag){case 5:return eh(e.type);case 16:return eh("Lazy");case 13:return eh("Suspense");case 19:return eh("SuspenseList");case 0:case 2:case 15:return eg(e.type,!1);case 11:return eg(e.type.render,!1);case 1:return eg(e.type,!0);default:return""}}(n),n=n.return;while(n);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function eb(e){return e.displayName||"Context"}function ey(e){if(null==e)return null;if("number"==typeof e.tag&&l("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case q:return"Fragment";case U:return"Portal";case H:return"Profiler";case K:return"StrictMode";case Y:return"Suspense";case G:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case $:return eb(e)+".Consumer";case V:return eb(e._context)+".Provider";case W:return function(e,t,n){var r=e.displayName;if(r)return r;var i=t.displayName||t.name||"";return""!==i?n+"("+i+")":n}(e,e.render,"ForwardRef");case Q:var t=e.displayName||null;return null!==t?t:ey(e.type)||"Memo";case Z:var n=e._payload,r=e._init;try{return ey(r(n))}catch(e){}}return null}function eA(e){return e.displayName||"Context"}function ew(e){var t,n,r,i=e.tag,o=e.type;switch(i){case 24:return"Cache";case 9:return eA(o)+".Consumer";case 10:return eA(o._context)+".Provider";case 18:return"DehydratedFragment";case 11:return t=o.render,n="ForwardRef",r=t.displayName||t.name||"",o.displayName||(""!==r?n+"("+r+")":n);case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ey(o);case 8:return o===K?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof o)return o.displayName||o.name||null;if("string"==typeof o)return o}return null}ep=new("function"==typeof WeakMap?WeakMap:Map);var e_=o.ReactDebugCurrentFrame,eE=null,eS=!1;function ek(){if(null===eE)return null;var e=eE._debugOwner;return null!=e?ew(e):null}function eM(){return null===eE?"":ev(eE)}function eC(){e_.getCurrentStack=null,eE=null,eS=!1}function ex(e){e_.getCurrentStack=null===e?null:eM,eE=e,eS=!1}function eR(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return A(e),e;default:return""}}var eI={button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0};function eT(e,t){eI[t.type]||t.onChange||t.onInput||t.readOnly||t.disabled||null==t.value||l("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`."),t.onChange||t.readOnly||t.disabled||null==t.checked||l("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")}function eO(e){var t=e.type,n=e.nodeName;return n&&"input"===n.toLowerCase()&&("checkbox"===t||"radio"===t)}function eP(e){return e._valueTracker}function eL(e){eP(e)||(e._valueTracker=function(e){var t=eO(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);A(e[t]);var r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){A(e),r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){A(e),r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function eN(e){if(!e)return!1;var t,n=eP(e);if(!n)return!0;var r=n.getValue(),i=(t="",e?t=eO(e)?e.checked?"true":"false":e.value:t);return i!==r&&(n.setValue(i),!0)}function eD(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var eB=!1,ej=!1,eF=!1,ez=!1;function eU(e){return"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}function eq(e,t){var n=t.checked;return el({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function eK(e,t){eT(0,t),void 0===t.checked||void 0===t.defaultChecked||ej||(l("%s contains an input of type %s with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components",ek()||"A component",t.type),ej=!0),void 0===t.value||void 0===t.defaultValue||eB||(l("%s contains an input of type %s with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components",ek()||"A component",t.type),eB=!0);var n=null==t.defaultValue?"":t.defaultValue;e._wrapperState={initialChecked:null!=t.checked?t.checked:t.defaultChecked,initialValue:eR(null!=t.value?t.value:n),controlled:eU(t)}}function eH(e,t){var n=t.checked;null!=n&&F(e,"checked",n,!1)}function eV(e,t){var n=eU(t);e._wrapperState.controlled||!n||ez||(l("A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"),ez=!0),!e._wrapperState.controlled||n||eF||(l("A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"),eF=!0),eH(e,t);var r=eR(t.value),i=t.type;if(null!=r)"number"===i?(0===r&&""===e.value||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if("submit"===i||"reset"===i)return void e.removeAttribute("value");t.hasOwnProperty("value")?eW(e,t.type,r):t.hasOwnProperty("defaultValue")&&eW(e,t.type,eR(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function e$(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(("submit"===r||"reset"===r)&&(void 0===t.value||null===t.value))return;var i=""+e._wrapperState.initialValue;n||i!==e.value&&(e.value=i),e.defaultValue=i}var o=e.name;""!==o&&(e.name=""),e.defaultChecked=!e.defaultChecked,e.defaultChecked=!!e._wrapperState.initialChecked,""!==o&&(e.name=o)}function eW(e,t,n){"number"===t&&eD(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var eY=!1,eG=!1,eQ=!1;function eZ(e,t){null==t.value&&("object"==typeof t.children&&null!==t.children?r.Children.forEach(t.children,function(e){null!=e&&"string"!=typeof e&&"number"!=typeof e&&(eG||(eG=!0,l("Cannot infer the option value of complex children. Pass a `value` prop or use a plain string as children to