tornado-core/dist/tornado.umd.min.js

8 lines
2.7 MiB
JavaScript
Raw Normal View History

/*! For license information please see tornado.umd.min.js.LICENSE.txt */
2024-09-30 13:55:24 +03:00
!function(e,a){"object"==typeof exports&&"object"==typeof module?module.exports=a():"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?exports.Tornado=a():e.Tornado=a()}(self,(()=>(()=>{var __webpack_modules__={66289:(e,a)=>{"use strict";function t(e){if(Array.isArray(e)){const a=[];let c=0;for(let f=0;f<e.length;f++){const d=t(e[f]);a.push(d),c+=d.length}return l(d(c,192),...a)}const a=g(e);return 1===a.length&&a[0]<128?a:l(d(a.length,128),a)}function c(e,a,t){if(t>e.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(a,t)}function f(e){if(0===e[0])throw new Error("invalid RLP: extra zeros");return o(b(e))}function d(e,a){if(e<56)return Uint8Array.from([e+a]);const t=h(e),c=h(a+55+t.length/2);return Uint8Array.from(s(c+t))}function r(e,a=!1){if(null==e||0===e.length)return Uint8Array.from([]);const t=n(g(e));if(a)return t;if(0!==t.remainder.length)throw new Error("invalid RLP: remainder must be zero");return t.data}function n(e){let a,t,d,r,i;const b=[],o=e[0];if(o<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(o<=183){if(a=o-127,d=128===o?Uint8Array.from([]):c(e,1,a),2===a&&d[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:d,remainder:e.slice(a)}}if(o<=191){if(t=o-182,e.length-1<t)throw new Error("invalid RLP: not enough bytes for string length");if(a=f(c(e,1,t)),a<=55)throw new Error("invalid RLP: expected string length to be greater than 55");return d=c(e,t,a+t),{data:d,remainder:e.slice(a+t)}}if(o<=247){for(a=o-191,r=c(e,1,a);r.length;)i=n(r),b.push(i.data),r=i.remainder;return{data:b,remainder:e.slice(a)}}{if(t=o-246,a=f(c(e,1,t)),a<56)throw new Error("invalid RLP: encoded list too short");const d=t+a;if(d>e.length)throw new Error("invalid RLP: total length is larger than the data");for(r=c(e,t,d);r.length;)i=n(r),b.push(i.data),r=i.remainder;return{data:b,remainder:e.slice(d)}}}Object.defineProperty(a,"__esModule",{value:!0}),a.RLP=a.utils=a.decode=a.encode=void 0,a.encode=t,a.decode=r;const i=Array.from({length:256},((e,a)=>a.toString(16).padStart(2,"0")));function b(e){let a="";for(let t=0;t<e.length;t++)a+=i[e[t]];return a}function o(e){const a=Number.parseInt(e,16);if(Number.isNaN(a))throw new Error("Invalid byte sequence");return a}function s(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const a=new Uint8Array(e.length/2);for(let t=0;t<a.length;t++){const c=2*t;a[t]=o(e.slice(c,c+2))}return a}function l(...e){if(1===e.length)return e[0];const a=e.reduce(((e,a)=>e+a.length),0),t=new Uint8Array(a);for(let a=0,c=0;a<e.length;a++){const f=e[a];t.set(f,c),c+=f.length}return t}function u(e){return(new TextEncoder).encode(e)}function h(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");const a=e.toString(16);return a.length%2?`0${a}`:a}function p(e){return e.length>=2&&"0"===e[0]&&"x"===e[1]}function g(e){if(e instanceof Uint8Array)return e;if("string"==typeof e)return p(e)?s((a="string"!=typeof(t=e)?t:p(t)?t.slice(2):t).length%2?`0${a}`:a):u(e);var a,t;if("number"==typeof e||"bigint"==typeof e)return e?s(h(e)):Uint8Array.from([]);if(null==e)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}a.utils={bytesToHex:b,concatBytes:l,hexToBytes:s,utf8ToBytes:u},a.RLP={encode:t,decode:r}},16284:(e,a,t)=>{"use strict";var c=t(48287).Buffer;Object.defineProperty(a,"__esModule",{value:!0}),a.accountBodyToRLP=a.accountBodyToSlim=a.accountBodyFromSlim=a.isZeroAddress=a.zeroAddress=a.importPublic=a.privateToAddress=a.privateToPublic=a.publicToAddress=a.pubToAddress=a.isValidPublic=a.isValidPrivate=a.generateAddress2=a.generateAddress=a.isValidChecksumAddress=a.toChecksumAddress=a.isValidAddress=a.Account=void 0;const f=t(66289),d=t(32019),r=t(26513),n=t(82672),i=t(77312),b=t(89838),o=t(35546),s=t(59498),l=BigInt(0);class u{constructor(e=l,a=l,t=b.KECCAK256_RLP,c=b.KECCAK256_NULL){this.nonce=e,this.bal
|| (${n} == "string" && ${f} && ${f} == +${f})`).assign(i,r._`+${f}`);case"integer":return void c.elseIf(r._`${n} === "boolean" || ${f} === null
|| (${n} === "string" && ${f} && ${f} == +${f} && !(${f} % 1))`).assign(i,r._`+${f}`);case"boolean":return void c.elseIf(r._`${f} === "false" || ${f} === 0 || ${f} === null`).assign(i,!1).elseIf(r._`${f} === "true" || ${f} === 1`).assign(i,!0);case"null":return c.elseIf(r._`${f} === "" || ${f} === 0 || ${f} === false`),void c.assign(i,null);case"array":c.elseIf(r._`${n} === "string" || ${n} === "number"
|| ${n} === "boolean" || ${f} === null`).assign(i,r._`[${f}]`)}}c.else(),h(e),c.endIf(),c.if(r._`${i} !== undefined`,(()=>{c.assign(f,i),function({gen:e,parentData:a,parentDataProperty:t},c){e.if(r._`${a} !== undefined`,(()=>e.assign(r._`${a}[${t}]`,c)))}(e,i)}))}(e,a,n):h(e)}))}return b};const o=new Set(["string","number","integer","boolean","null"]);function s(e,a,t,c=i.Correct){const f=c===i.Correct?r.operators.EQ:r.operators.NEQ;let d;switch(e){case"null":return r._`${a} ${f} null`;case"array":d=r._`Array.isArray(${a})`;break;case"object":d=r._`${a} && typeof ${a} == "object" && !Array.isArray(${a})`;break;case"integer":d=n(r._`!(${a} % 1) && !isNaN(${a})`);break;case"number":d=n();break;default:return r._`typeof ${a} ${f} ${e}`}return c===i.Correct?d:(0,r.not)(d);function n(e=r.nil){return(0,r.and)(r._`typeof ${a} == "number"`,e,t?r._`isFinite(${a})`:r.nil)}}function l(e,a,t,c){if(1===e.length)return s(e[0],a,t,c);let f;const d=(0,n.toHash)(e);if(d.array&&d.object){const e=r._`typeof ${a} != "object"`;f=d.null?e:r._`!${a} || ${e}`,delete d.null,delete d.array,delete d.object}else f=r.nil;d.number&&delete d.integer;for(const e in d)f=(0,r.and)(f,s(e,a,t,c));return f}a.checkDataType=s,a.checkDataTypes=l;const u={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:a})=>"string"==typeof e?r._`{type: ${e}}`:r._`{type: ${a}}`};function h(e){const a=function(e){const{gen:a,data:t,schema:c}=e,f=(0,n.schemaRefOrVal)(e,c,"type");return{gen:a,keyword:"type",data:t,schema:c.type,schemaCode:f,schemaValue:f,parentSchema:c,params:{},it:e}}(e);(0,d.reportError)(a,u)}a.reportTypeError=h},7870:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.assignDefaults=void 0;const c=t(99029),f=t(94227);function d(e,a,t){const{gen:d,compositeRule:r,data:n,opts:i}=e;if(void 0===t)return;const b=c._`${n}${(0,c.getProperty)(a)}`;if(r)return void(0,f.checkStrictMode)(e,`default is ignored for: ${b}`);let o=c._`${b} === undefined`;"empty"===i.useDefaults&&(o=c._`${o} || ${b} === null || ${b} === ""`),d.if(o,c._`${b} = ${(0,c.stringify)(t)}`)}a.assignDefaults=function(e,a){const{properties:t,items:c}=e.schema;if("object"===a&&t)for(const a in t)d(e,a,t[a].default);else"array"===a&&Array.isArray(c)&&c.forEach(((a,t)=>d(e,t,a.default)))}},62586:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.getData=a.KeywordCxt=a.validateFunctionCode=void 0;const c=t(28727),f=t(10208),d=t(7887),r=t(10208),n=t(7870),i=t(33673),b=t(24495),o=t(99029),s=t(42023),l=t(66939),u=t(94227),h=t(48708);function p({gen:e,validateName:a,schema:t,schemaEnv:c,opts:f},d){f.code.es5?e.func(a,o._`${s.default.data}, ${s.default.valCxt}`,c.$async,(()=>{e.code(o._`"use strict"; ${g(t,f)}`),function(e,a){e.if(s.default.valCxt,(()=>{e.var(s.default.instancePath,o._`${s.default.valCxt}.${s.default.instancePath}`),e.var(s.default.parentData,o._`${s.default.valCxt}.${s.default.parentData}`),e.var(s.default.parentDataProperty,o._`${s.default.valCxt}.${s.default.parentDataProperty}`),e.var(s.default.rootData,o._`${s.default.valCxt}.${s.default.rootData}`),a.dynamicRef&&e.var(s.default.dynamicAnchors,o._`${s.default.valCxt}.${s.default.dynamicAnchors}`)}),(()=>{e.var(s.default.instancePath,o._`""`),e.var(s.default.parentData,o._`undefined`),e.var(s.default.parentDataProperty,o._`undefined`),e.var(s.default.rootData,s.default.data),a.dynamicRef&&e.var(s.default.dynamicAnchors,o._`{}`)}))}(e,f),e.code(d)})):e.func(a,o._`${s.default.data}, ${function(e){return o._`{${s.default.instancePath}="", ${s.default.parentData}, ${s.default.parentDataProperty}, ${s.default.rootData}=${s.default.data}${e.dynamicRef?o._`, ${s.default.dynamicAnchors}={}`:o.nil}}={}`}(f)}`,c.$async,(()=>e.code(g(t,f)).code(d)))}function g(e,a){const t="object"==typeof e&&e[a.schemaId];return t&&(a.code.source||a.code.process)?o._`/*# sourceURL=${t} */`:o.nil}function m({schema:e,self:a}){if("boolean"==typeof e)return!e;for(const t in e)if(a.RULES.all[t])return!0;return!1}function x(e){return"boolean"!=typeof e.schema}function y(e){(0,u.checkUnknownRules
missingProperty: ${f},
depsCount: ${a},
deps: ${t}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:a.error,code(e){const[a,t]=function({schema:e}){const a={},t={};for(const c in e)"__proto__"!==c&&((Array.isArray(e[c])?a:t)[c]=e[c]);return[a,t]}(e);n(e,a),i(e,t)}};function n(e,a=e.schema){const{gen:t,data:f,it:r}=e;if(0===Object.keys(a).length)return;const n=t.let("missing");for(const i in a){const b=a[i];if(0===b.length)continue;const o=(0,d.propertyInData)(t,f,i,r.opts.ownProperties);e.setParams({property:i,depsCount:b.length,deps:b.join(", ")}),r.allErrors?t.if(o,(()=>{for(const a of b)(0,d.checkReportMissingProp)(e,a)})):(t.if(c._`${o} && (${(0,d.checkMissingProp)(e,b,n)})`),(0,d.reportMissingProp)(e,n),t.else())}}function i(e,a=e.schema){const{gen:t,data:c,keyword:r,it:n}=e,i=t.name("valid");for(const b in a)(0,f.alwaysValidSchema)(n,a[b])||(t.if((0,d.propertyInData)(t,c,b,n.opts.ownProperties),(()=>{const a=e.subschema({keyword:r,schemaProp:b},i);e.mergeValidEvaluated(a,i)}),(()=>t.var(i,!0))),e.ok(i))}a.validatePropertyDeps=n,a.validateSchemaDeps=i,a.default=r},1239:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=t(94227),d={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>c.str`must match "${e.ifClause}" schema`,params:({params:e})=>c._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:a,parentSchema:t,it:d}=e;void 0===t.then&&void 0===t.else&&(0,f.checkStrictMode)(d,'"if" without "then" and "else" is ignored');const n=r(d,"then"),i=r(d,"else");if(!n&&!i)return;const b=a.let("valid",!0),o=a.name("_valid");if(function(){const a=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},o);e.mergeEvaluated(a)}(),e.reset(),n&&i){const t=a.let("ifClause");e.setParams({ifClause:t}),a.if(o,s("then",t),s("else",t))}else n?a.if(o,s("then")):a.if((0,c.not)(o),s("else"));function s(t,f){return()=>{const d=e.subschema({keyword:t},o);a.assign(b,o),e.mergeValidEvaluated(d,b),f?a.assign(f,c._`${t}`):e.setParams({ifClause:t})}}e.pass(b,(()=>e.error(!0)))}};function r(e,a){const t=e.schema[a];return void 0!==t&&!(0,f.alwaysValidSchema)(e,t)}a.default=d},56378:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(15457),f=t(65354),d=t(20494),r=t(93966),n=t(12661),i=t(83025),b=t(19713),o=t(38660),s=t(40117),l=t(45333),u=t(57923),h=t(16505),p=t(96163),g=t(15844),m=t(1239),x=t(14426);a.default=function(e=!1){const a=[u.default,h.default,p.default,g.default,m.default,x.default,b.default,o.default,i.default,s.default,l.default];return e?a.push(f.default,r.default):a.push(c.default,d.default),a.push(n.default),a}},20494:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.validateTuple=void 0;const c=t(99029),f=t(94227),d=t(15765),r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:a,it:t}=e;if(Array.isArray(a))return n(e,"additionalItems",a);t.items=!0,(0,f.alwaysValidSchema)(t,a)||e.ok((0,d.validateArray)(e))}};function n(e,a,t=e.schema){const{gen:d,parentSchema:r,data:n,keyword:i,it:b}=e;!function(e){const{opts:c,errSchemaPath:d}=b,r=t.length,n=r===e.minItems&&(r===e.maxItems||!1===e[a]);if(c.strictTuples&&!n){const e=`"${i}" is ${r}-tuple, but minItems or maxItems/${a} are not specified or different at path "${d}"`;(0,f.checkStrictMode)(b,e,c.strictTuples)}}(r),b.opts.unevaluated&&t.length&&!0!==b.items&&(b.items=f.mergeEvaluated.items(d,t.length,b.items));const o=d.name("valid"),s=d.const("len",c._`${n}.length`);t.forEach(((a,t)=>{(0,f.alwaysValidSchema)(b,a)||(d.if(c._`${s} > ${t}`,(()=>e.subschema({keyword:i,schemaProp:t,dataProp:t},o))),e.ok(o))}))}a.validateTuple=n,a.default=r},93966:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});const c=t(99029),f=t(94227),d=t(15765),r=t(15457),n={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>c.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>c._`{limit: ${e}}`},code(e){const{schema