CyberChef/Yara.js

101 lines
1.5 MiB
JavaScript
Raw Permalink Normal View History

/**
* CyberChef - The Cyber Swiss Army Knife
*
* @copyright Crown Copyright 2016
* @license Apache-2.0
*
* Copyright 2016 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/!function(A){var I={};function g(B){if(I[B])return I[B].exports;var Q=I[B]={i:B,l:!1,exports:{}};return A[B].call(Q.exports,Q,Q.exports,g),Q.l=!0,Q.exports}g.m=A,g.c=I,g.d=function(A,I,B){g.o(A,I)||Object.defineProperty(A,I,{enumerable:!0,get:B})},g.r=function(A){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})},g.t=function(A,I){if(1&I&&(A=g(A)),8&I)return A;if(4&I&&"object"==typeof A&&A&&A.__esModule)return A;var B=Object.create(null);if(g.r(B),Object.defineProperty(B,"default",{enumerable:!0,value:A}),2&I&&"string"!=typeof A)for(var Q in A)g.d(B,Q,function(I){return A[I]}.bind(null,Q));return B},g.n=function(A){var I=A&&A.__esModule?function(){return A.default}:function(){return A};return g.d(I,"a",I),I},g.o=function(A,I){return Object.prototype.hasOwnProperty.call(A,I)},g.p="",g(g.s=1515)}({0:function(A,I,g){"use strict";var B=g(15),Q=g.n(B),C=g(10),E=g(7),D=g(19),w=g(18);function i(A,I,g,B,Q,C,E){try{var D=A[C](E),w=D.value}catch(A){return void g(A)}D.done?I(w):Promise.resolve(w).then(B,Q)}function o(A){return function(){var I=this,g=arguments;return new Promise(function(B,Q){var C=A.apply(I,g);function E(A){i(C,B,Q,E,D,"next",A)}function D(A){i(C,B,Q,E,D,"throw",A)}E(void 0)})}}function F(A,I){for(var g=0;g<I.length;g++){var B=I[g];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(A,B.key,B)}}
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
var G=function(){function A(){!function(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}(this,A)}var I,g,B;return I=A,g=null,B=[{key:"chr",value:function(A){if(A>65535){A-=65536;var I=String.fromCharCode(A>>>10&1023|55296);return A=56320|1023&A,I+String.fromCharCode(A)}return String.fromCharCode(A)}},{key:"ord",value:function(A){if(2===A.length){var I=A.charCodeAt(0),g=A.charCodeAt(1);if(I>=55296&&I<56320&&g>=56320&&g<57344)return 1024*(I-55296)+g-56320+65536}return A.charCodeAt(0)}},{key:"padBytesRight",value:function(A,I){var g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,B=new Array(I);return B.fill(g),Array.prototype.map.call(A,function(A,I){B[I]=A}),B}},{key:"truncate",value:function(A,I){var g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";return A.length>I&&(A=A.slice(0,I-g.length)+g),A}},{key:"hex",value:function(I){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return(I="string"==typeof I?A.ord(I):I).toString(16).padStart(g,"0")}},{key:"bin",value:function(I){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return(I="string"==typeof I?A.ord(I):I).toString(2).padStart(g,"0")}},{key:"printable",value:function(I){var g=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof window&&window.app&&!window.app.options.treatAsUtf8&&(I=A.byteArrayToChars(A.strToByteArray(I)));return I=I.replace(/[\0-\x08\x0B-\x0C\x0E-\x1F\x7F-\x9F\xAD\u0378\u0379\u037F-\u0383\u038B\u038D\u03A2\u0528-\u0530\u0557\u0558\u0560\u0588\u058B-\u058E\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u0605\u061C\u061D\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08A1\u08AD-\u08E3\u08FF\u0978\u0980\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0C00\u0C04\u0C0D\u0C11\u0C29\u0C34\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5A-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C80\u0C81\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D01\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D4F-\u0D56\u0D58-\u0D5F\u0D64\u0D65\u0D76-\u0D78\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F5-\u13FF\u169D-\u169F\u16F1-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191D-\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C80-\u1CBF\u1CC8-\u1CCF\u1CF7-\u1CFF\u1DE7-\u1DFB\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20BB-\u20CF\u20F1-\u
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
var D=function(){function A(I){!function(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}(this,A),this.name="",this.type="",this._value=null,this.disabled=!1,this.hint="",this.rows=0,this.toggleValues=[],this.target=null,this.defaultIndex=0,I&&this._parseConfig(I)}var I,g,B;return I=A,B=[{key:"prepare",value:function(A,I){var g;switch(I){case"binaryString":case"binaryShortString":case"editableOption":case"editableOptionShort":return Q.a.parseEscapedChars(A);case"byteArray":return"string"==typeof A?(A=A.replace(/\s+/g,""),Object(C.c)(A)):A;case"number":if(g=parseFloat(A),isNaN(g))throw"Invalid ingredient value. Not a number: "+Q.a.truncate(A.toString(),10);return g;default:return A}}}],(g=[{key:"_parseConfig",value:function(A){this.name=A.name,this.type=A.type,this.defaultValue=A.value,this.disabled=!!A.disabled,this.hint=A.hint||!1,this.rows=A.rows||!1,this.toggleValues=A.toggleValues,this.target=void 0!==A.target?A.target:null,this.defaultIndex=void 0!==A.defaultIndex?A.defaultIndex:0}},{key:"config",get:function(){return this._value}},{key:"value",set:function(I){this._value=A.prepare(I,this.type)},get:function(){return this._value}}])&&E(I.prototype,g),B&&E(I,B),A}();function w(A,I){for(var g=0;g<I.length;g++){var B=I[g];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(A,B.key,B)}}
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
var i=function(){function A(){!function(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}(this,A),this._inputType=-1,this._outputType=-1,this._presentType=-1,this._breakpoint=!1,this._disabled=!1,this._flowControl=!1,this._manualBake=!1,this._ingList=[],this.name="",this.module="",this.description="",this.infoURL=null}var I,g,Q;return I=A,(g=[{key:"run",value:function(A,I){return A}},{key:"highlight",value:function(A,I){return!1}},{key:"highlightReverse",value:function(A,I){return!1}},{key:"present",value:function(A,I){return A}},{key:"addIngredient",value:function(A){this._ingList.push(A)}},{key:"inputType",set:function(A){this._inputType=B.a.typeEnum(A)},get:function(){return B.a.enumLookup(this._inputType)}},{key:"outputType",set:function(A){this._outputType=B.a.typeEnum(A),this._presentType<0&&(this._presentType=this._outputType)},get:function(){return B.a.enumLookup(this._outputType)}},{key:"presentType",set:function(A){this._presentType=B.a.typeEnum(A)},get:function(){return B.a.enumLookup(this._presentType)}},{key:"args",set:function(A){var I=this;A.forEach(function(A){var g=new D(A);I.addIngredient(g)})},get:function(){return this._ingList.map(function(A){var I={name:A.name,type:A.type,value:A.defaultValue};return A.toggleValues&&(I.toggleValues=A.toggleValues),A.hint&&(I.hint=A.hint),A.rows&&(I.rows=A.rows),A.disabled&&(I.disabled=A.disabled),A.target&&(I.target=A.target),A.defaultIndex&&(I.defaultIndex=A.defaultIndex),I})}},{key:"config",get:function(){return{op:this.name,args:this._ingList.map(function(A){return A.config})}}},{key:"ingValues",set:function(A){var I=this;A.forEach(function(A,g){I._ingList[g].value=A})},get:function(){return this._ingList.map(function(A){return A.value})}},{key:"breakpoint",set:function(A){this._breakpoint=!!A},get:function(){return this._breakpoint}},{key:"disabled",set:function(A){this._disabled=!!A},get:function(){return this._disabled}},{key:"flowControl",get:function(){return this._flowControl},set:function(A){this._flowControl=!!A}},{key:"manualBake",get:function(){return this._manualBake},set:function(A){this._manualBake=!!A}}])&&w(I.prototype,g),Q&&w(I,Q),A}();I.a=i},10:function(A,I,g){"use strict";g.d(I,"c",function(){return Q}),g.d(I,"b",function(){return C}),g.d(I,"a",function(){return E});var B=g(0);
/**
* Base64 functions.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/function Q(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=";if(!A)return"";"string"==typeof A&&(A=B.a.strToByteArray(A)),I=B.a.expandAlphRange(I).join("");for(var g,Q,C,E,D,w,i,o="",F=0;F<A.length;)E=(g=A[F++])>>2,D=(3&g)<<4|(Q=A[F++])>>4,w=(15&Q)<<2|(C=A[F++])>>6,i=63&C,isNaN(Q)?w=i=64:isNaN(C)&&(i=64),o+=I.charAt(E)+I.charAt(D)+I.charAt(w)+I.charAt(i);return o}function C(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=",g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string",Q=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!A)return"string"===g?"":[];I=I||"A-Za-z0-9+/=",I=B.a.expandAlphRange(I).join("");var C,E,D,w,i,o,F=[],G=0;if(Q){var R=new RegExp("[^"+I.replace(/[[\]\\\-^$]/g,"\\$&")+"]","g");A=A.replace(R,"")}for(;G<A.length;)C=I.indexOf(A.charAt(G++))<<2|(w=-1===(w=I.indexOf(A.charAt(G++)||"="))?64:w)>>4,E=(15&w)<<4|(i=-1===(i=I.indexOf(A.charAt(G++)||"="))?64:i)>>2,D=(3&i)<<6|(o=-1===(o=I.indexOf(A.charAt(G++)||"="))?64:o),F.push(C),64!==i&&F.push(E),64!==o&&F.push(D);return"string"===g?B.a.byteArrayToUtf8(F):F}var E=[{name:"Standard (RFC 4648): A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe (RFC 4648 §5): A-Za-z0-9-_",value:"A-Za-z0-9-_"},{name:"Filename safe: A-Za-z0-9+-=",value:"A-Za-z0-9+\\-="},{name:"itoa64: ./0-9A-Za-z=",value:"./0-9A-Za-z="},{name:"XML: A-Za-z0-9_.",value:"A-Za-z0-9_."},{name:"y64: A-Za-z0-9._-",value:"A-Za-z0-9._-"},{name:"z64: 0-9a-zA-Z+/=",value:"0-9a-zA-Z+/="},{name:"Radix-64 (RFC 4880): 0-9A-Za-z+/=",value:"0-9A-Za-z+/="},{name:"Uuencoding: [space]-_",value:" -_"},{name:"Xxencoding: +-0-9A-Za-z",value:"+\\-0-9A-Za-z"},{name:"BinHex: !-,-0-689@A-NP-VX-Z[`a-fh-mp-r",value:"!-,-0-689@A-NP-VX-Z[`a-fh-mp-r"},{name:"ROT13: N-ZA-Mn-za-m0-9+/=",value:"N-ZA-Mn-za-m0-9+/="},{name:"UNIX crypt: ./0-9A-Za-z",value:"./0-9A-Za-z"}]},12:function(A,I,g){"use strict";function B(A){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A})(A)}function Q(A){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(A){return A.__proto__||Object.getPrototypeOf(A)})(A)}function C(A,I){return(C=Object.setPrototypeOf||function(A,I){return A.__proto__=I,A})(A,I)}function E(A){if(void 0===A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function D(A){function I(){var I=Reflect.construct(A,Array.from(arguments));return Object.setPrototypeOf(I,Object.getPrototypeOf(this)),I}return I.prototype=Object.create(A.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(I,A):I.__proto__=A,I}
/**
* Custom error type for handling Dish type errors.
* i.e. where the Dish cannot be successfully translated between types
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/var w=function(A){function I(){var A,g,C,D;!function(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}(this,I);for(var w=arguments.length,i=new Array(w),o=0;o<w;o++)i[o]=arguments[o];return C=this,(g=!(D=(A=Q(I)).call.apply(A,[this].concat(i)))||"object"!==B(D)&&"function"!=typeof D?E(C):D).type="DishError",Error.captureStackTrace&&Error.captureStackTrace(E(E(g)),I),g}return function(A,I){if("function"!=typeof I&&null!==I)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(I&&I.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),I&&C(A,I)}(I,D(Error)),I}();I.a=w},14:function(A,I,g){var B,Q;!function(C,E){"use strict";void 0===(Q="function"==typeof(B=function(){var A=function(){},I="undefined",g=["trace","debug","info","warn","error"];function B(A,I){var g=A[I];if("function"==typeof g.bind)return g.bind(A);try{return Function.prototype.bind.call(g,A)}catch(I){return function(){return Function.prototype.apply.apply(g,[A,arguments])}}}function Q(I,B){for(var Q=0;Q<g.length;Q++){var C=g[Q];this[C]=Q<I?A:this.methodFactory(C,I,B)}this.log=this.debug}function C(g,C,E){return function(g){"debug"===g&&(g="log");return typeof console!==I&&(void 0!==console[g]?B(console,g):void 0!==console.log?B(console,"log"):A)}(g)||function(A,g,B){return function(){typeof console!==I&&(Q.call(this,g,B),this[A].apply(this,arguments))}}.apply(this,arguments)}function E(A,B,E){var D,w=this,i="loglevel";function o(){var A;if(typeof window!==I){try{A=window.localStorage[i]}catch(A){}if(typeof A===I)try{var g=window.document.cookie,B=g.indexOf(encodeURIComponent(i)+"=");-1!==B&&(A=/^([^;]+)/.exec(g.slice(B))[1])}catch(A){}return void 0===w.levels[A]&&(A=void 0),A}}A&&(i+=":"+A),w.name=A,w.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},w.methodFactory=E||C,w.getLevel=function(){return D},w.setLevel=function(B,C){if("string"==typeof B&&void 0!==w.levels[B.toUpperCase()]&&(B=w.levels[B.toUpperCase()]),!("number"==typeof B&&B>=0&&B<=w.levels.SILENT))throw"log.setLevel() called with invalid level: "+B;if(D=B,!1!==C&&function(A){var B=(g[A]||"silent").toUpperCase();if(typeof window===I)return;try{return void(window.localStorage[i]=B)}catch(A){}try{window.document.cookie=encodeURIComponent(i)+"="+B+";"}catch(A){}}(B),Q.call(w,B,A),typeof console===I&&B<w.levels.SILENT)return"No console available for logging"},w.setDefaultLevel=function(A){o()||w.setLevel(A,!1)},w.enableAll=function(A){w.setLevel(w.levels.TRACE,A)},w.disableAll=function(A){w.setLevel(w.levels.SILENT,A)};var F=o();null==F&&(F=null==B?"WARN":B),w.setLevel(F,!1)}var D=new E,w={};D.getLogger=function(A){if("string"!=typeof A||""===A)throw new TypeError("You must supply a name when creating a logger.");var I=w[A];return I||(I=w[A]=new E(A,D.getLevel(),D.methodFactory)),I};var i=typeof window!==I?window.log:void 0;return D.noConflict=function(){return typeof window!==I&&window.log===D&&(window.log=i),D},D.getLoggers=function(){return w},D})?B.call(I,g,I,A):B)||(A.exports=Q)}()},15:function(A,I,g){!function(A){var I,g,B,Q=String.fromCharCode;function C(A){for(var I,g,B=[],Q=0,C=A.length;Q<C;)(I=A.charCodeAt(Q++))>=55296&&I<=56319&&Q<C?56320==(64512&(g=A.charCodeAt(Q++)))?B.push(((1023&I)<<10)+(1023&g)+65536):(B.push(I),Q--):B.push(I);return B}function E(A){if(A>=55296&&A<=57343)throw Error("Lone surrogate U+"+A.toString(16).toUpperCase()+" is not a scalar value")}function D(A,I){return Q(A>>I&63|128)}function w(A){if(0==(4294967168&A))return Q(A);var I="";return 0==(4294965248&A)?I=Q(A>>6&31|192):0==(4294901760&A)?(E(A),I=Q(A>>12&15|224),I+=D(A,6)):0==(4292870144&A)&&(I=Q(A>>18&7|240),I+=D(A,12),I+=D(A,6)),I+=Q(63&A|128)}function i(){if(B>=g)throw Error("Invalid byte index");var A=255&I[B];if(B++,128==(192&A))return 63&A;throw Error("Invalid continuation byte")}function o(){var A,Q;if(B>g)throw Error("Invalid byte index");if(B==g)return!1;if(A=255&I[B],B++,0==(128&A))return A;if(192==(224&A)){if((Q=(31&A)<<6|i())>=128)return Q;throw Error("Invalid continuation byte")}if(224==(240&A)){if((Q=(15&
/**
* @author Matt C [matt@artemisbot.uk]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/var R=function(A){function I(){var A;return function(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}(this,I),(A=o(this,F(I).call(this))).name="YARA Rules",A.module="Yara",A.description="YARA is a tool developed at VirusTotal, primarily aimed at helping malware researchers to identify and classify malware samples. It matches based on rules specified by the user containing textual or binary patterns and a boolean expression. For help on writing rules, see the <a href='https://yara.readthedocs.io/en/latest/writingrules.html'>YARA documentation.</a>",A.infoURL="https://wikipedia.org/wiki/YARA",A.inputType="ArrayBuffer",A.outputType="string",A.args=[{name:"Rules",type:"text",value:"",rows:5},{name:"Show strings",type:"boolean",value:!1},{name:"Show string lengths",type:"boolean",value:!1},{name:"Show metadata",type:"boolean",value:!1},{name:"Show counts",type:"boolean",value:!0}],A}var g,C,D;return function(A,I){if("function"!=typeof I&&null!==I)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(I&&I.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),I&&G(A,I)}(I,B["a"]),g=I,(C=[{key:"run",value:function(A,I){"function"==typeof importScripts&&self.sendStatusMessage("Instantiating YARA...");var g=w(I,5),B=g[0],C=g[1],D=g[2],i=g[3],o=g[4];return new Promise(function(I,g){E()().then(function(E){"function"==typeof importScripts&&self.sendStatusMessage("Converting data for YARA.");var w="",F=new Uint8Array(A);"function"==typeof importScripts&&self.sendStatusMessage("Running YARA matching.");var G=E.run(F,B);if("function"==typeof importScripts&&self.sendStatusMessage("Processing data."),G.compileErrors.size()>0)for(var R=0;R<G.compileErrors.size();R++){var U=G.compileErrors.get(R);U.warning?w+="Warning on line ".concat(U.lineNumber,": ").concat(U.message):g(new Q.a("Error on line ".concat(U.lineNumber,": ").concat(U.message)))}for(var y=G.matchedRules,h=0;h<y.size();h++){var M=y.get(h),Y=M.resolvedMatches,k="";if(i&&M.metadata.size()>0){k+=" [";for(var c=0;c<M.metadata.size();c++)k+="".concat(M.metadata.get(c).identifier,": ").concat(M.metadata.get(c).data,", ");k=k.slice(0,-2)+"]"}var a=o?"".concat(Y.size()," time").concat(Y.size()>1?"s":""):"";if(0===Y.size()||!C&&!D)w+='Input matches rule "'.concat(M.ruleName,'"').concat(k).concat(a.length>0?" ".concat(a):"",".\n");else{w+='Rule "'.concat(M.ruleName,'"').concat(k," matches (").concat(a,"):\n");for(var S=0;S<Y.size();S++){var K=Y.get(S);(C||D)&&(w+="Pos ".concat(K.location,", ").concat(D?"length ".concat(K.matchLength,", "):"","identifier ").concat(K.stringIdentifier).concat(C?', data: "'.concat(K.data,'"'):"","\n"))}}}I(w)})})}}])&&i(g.prototype,C),D&&i(g,D),I}(),U="undefined"==typeof self?{}:self.OpModules||{};U.Yara={"YARA Rules":R};I.default=U},17:function(A,I){var g;g=function(){return this}();try{g=g||new Function("return this")()}catch(A){"object"==typeof window&&(g=window)}A.exports=g},18:function(A,I,g){"use strict";g.d(I,"b",function(){return Q}),g.d(I,"a",function(){return C});var B=g(0);
/**
* Binary functions.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/function Q(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8;if(!A)return"";I=B.a.charRep(I);for(var Q="",C=0;C<A.length;C++)Q+=A[C].toString(2).padStart(g,"0")+I;return I.length?Q.slice(0,-I.length):Q}function C(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,Q=B.a.regexRep(I);A=A.replace(Q,"");for(var C=[],E=0;E<A.length;E+=g)C.push(parseInt(A.substr(E,g),2));return C}},19:function(A,I,g){"use strict";g.d(I,"a",function(){return Q});var B=g(0);
/**
* Decimal functions.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/function Q(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto";I=B.a.charRep(I);var g=[],Q=A.split(I);""===Q[Q.length-1]&&(Q=Q.slice(0,Q.length-1));for(var C=0;C<Q.length;C++)g[C]=parseInt(Q[C],10);return g}},21:function(A,I){var g,B,Q=A.exports={};function C(){throw new Error("setTimeout has not been defined")}function E(){throw new Error("clearTimeout has not been defined")}function D(A){if(g===setTimeout)return setTimeout(A,0);if((g===C||!g)&&setTimeout)return g=setTimeout,setTimeout(A,0);try{return g(A,0)}catch(I){try{return g.call(null,A,0)}catch(I){return g.call(this,A,0)}}}!function(){try{g="function"==typeof setTimeout?setTimeout:C}catch(A){g=C}try{B="function"==typeof clearTimeout?clearTimeout:E}catch(A){B=E}}();var w,i=[],o=!1,F=-1;function G(){o&&w&&(o=!1,w.length?i=w.concat(i):F=-1,i.length&&R())}function R(){if(!o){var A=D(G);o=!0;for(var I=i.length;I;){for(w=i,i=[];++F<I;)w&&w[F].run();F=-1,I=i.length}w=null,o=!1,function(A){if(B===clearTimeout)return clearTimeout(A);if((B===E||!B)&&clearTimeout)return B=clearTimeout,clearTimeout(A);try{B(A)}catch(I){try{return B.call(null,A)}catch(I){return B.call(this,A)}}}(A)}}function U(A,I){this.fun=A,this.array=I}function y(){}Q.nextTick=function(A){var I=new Array(arguments.length-1);if(arguments.length>1)for(var g=1;g<arguments.length;g++)I[g-1]=arguments[g];i.push(new U(A,I)),1!==i.length||o||D(R)},U.prototype.run=function(){this.fun.apply(null,this.array)},Q.title="browser",Q.browser=!0,Q.env={},Q.argv=[],Q.version="",Q.versions={},Q.on=y,Q.addListener=y,Q.once=y,Q.off=y,Q.removeListener=y,Q.removeAllListeners=y,Q.emit=y,Q.prependListener=y,Q.prependOnceListener=y,Q.listeners=function(A){return[]},Q.binding=function(A){throw new Error("process.binding is not supported")},Q.cwd=function(){return"/"},Q.chdir=function(A){throw new Error("process.chdir is not supported")},Q.umask=function(){return 0}},3:function(A,I,g){"use strict";function B(A){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A})(A)}function Q(A){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(A){return A.__proto__||Object.getPrototypeOf(A)})(A)}function C(A,I){return(C=Object.setPrototypeOf||function(A,I){return A.__proto__=I,A})(A,I)}function E(A){if(void 0===A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function D(A){function I(){var I=Reflect.construct(A,Array.from(arguments));return Object.setPrototypeOf(I,Object.getPrototypeOf(this)),I}return I.prototype=Object.create(A.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(I,A):I.__proto__=A,I}
/**
* Custom error type for handling operation input errors.
* i.e. where the operation can handle the error and print a message to the screen.
*
* @author d98762625 [d98762625@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/var w=function(A){function I(){var A,g,C,D;!function(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}(this,I);for(var w=arguments.length,i=new Array(w),o=0;o<w;o++)i[o]=arguments[o];return C=this,(g=!(D=(A=Q(I)).call.apply(A,[this].concat(i)))||"object"!==B(D)&&"function"!=typeof D?E(C):D).type="OperationError",Error.captureStackTrace&&Error.captureStackTrace(E(E(g)),I),g}return function(A,I){if("function"!=typeof I&&null!==I)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(I&&I.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),I&&C(A,I)}(I,D(Error)),I}();I.a=w},327:function(A,I){},4:function(A,I,g){var B;!function(Q){"use strict";var C,E=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,D=Math.ceil,w=Math.floor,i="[BigNumber Error] ",o=i+"Number primitive has more than 15 significant digits: ",F=1e14,G=14,R=9007199254740991,U=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,h=1e9;function M(A){var I=0|A;return A>0||A===I?I:I-1}function Y(A){for(var I,g,B=1,Q=A.length,C=A[0]+"";B<Q;){for(I=A[B++]+"",g=G-I.length;g--;I="0"+I);C+=I}for(Q=C.length;48===C.charCodeAt(--Q););return C.slice(0,Q+1||1)}function k(A,I){var g,B,Q=A.c,C=I.c,E=A.s,D=I.s,w=A.e,i=I.e;if(!E||!D)return null;if(g=Q&&!Q[0],B=C&&!C[0],g||B)return g?B?0:-D:E;if(E!=D)return E;if(g=E<0,B=w==i,!Q||!C)return B?0:!Q^g?1:-1;if(!B)return w>i^g?1:-1;for(D=(w=Q.length)<(i=C.length)?w:i,E=0;E<D;E++)if(Q[E]!=C[E])return Q[E]>C[E]^g?1:-1;return w==i?0:w>i^g?1:-1}function c(A,I,g,B){if(A<I||A>g||A!==(A<0?D(A):w(A)))throw Error(i+(B||"Argument")+("number"==typeof A?A<I||A>g?" out of range: ":" not an integer: ":" not a primitive number: ")+String(A))}function a(A){var I=A.c.length-1;return M(A.e/G)==I&&A.c[I]%2!=0}function S(A,I){return(A.length>1?A.charAt(0)+"."+A.slice(1):A)+(I<0?"e":"e+")+I}function K(A,I,g){var B,Q;if(I<0){for(Q=g+".";++I;Q+=g);A=Q+A}else if(++I>(B=A.length)){for(Q=g,I-=B;--I;Q+=g);A+=Q}else I<B&&(A=A.slice(0,I)+"."+A.slice(I));return A}(C=function A(I){var g,B,Q,C,N,s,H,J,L,t=W.prototype={constructor:W,toString:null,valueOf:null},n=new W(1),e=20,f=4,q=-7,r=21,d=-1e7,l=1e7,V=!1,Z=1,p=0,X={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},u="0123456789abcdefghijklmnopqrstuvwxyz";function W(A,I){var g,C,D,i,F,U,y,h,M=this;if(!(M instanceof W))return new W(A,I);if(null==I){if(A instanceof W)return M.s=A.s,M.e=A.e,void(M.c=(A=A.c)?A.slice():A);if((U="number"==typeof A)&&0*A==0){if(M.s=1/A<0?(A=-A,-1):1,A===~~A){for(i=0,F=A;F>=10;F/=10,i++);return M.e=i,void(M.c=[A])}h=String(A)}else{if(h=String(A),!E.test(h))return Q(M,h,U);M.s=45==h.charCodeAt(0)?(h=h.slice(1),-1):1}(i=h.indexOf("."))>-1&&(h=h.replace(".","")),(F=h.search(/e/i))>0?(i<0&&(i=F),i+=+h.slice(F+1),h=h.substring(0,F)):i<0&&(i=h.length)}else{if(c(I,2,u.length,"Base"),h=String(A),10==I)return b(M=new W(A instanceof W?A:h),e+M.e+1,f);if(U="number"==typeof A){if(0*A!=0)return Q(M,h,U,I);if(M.s=1/A<0?(h=h.slice(1),-1):1,W.DEBUG&&h.replace(/^0\.0*|\./,"").length>15)throw Error(o+A);U=!1}else M.s=45===h.charCodeAt(0)?(h=h.slice(1),-1):1;for(g=u.slice(0,I),i=F=0,y=h.length;F<y;F++)if(g.indexOf(C=h.charAt(F))<0){if("."==C){if(F>i){i=y;continue}}else if(!D&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){D=!0,F=-1,i=0;continue}return Q(M,String(A),U,I)}(i=(h=B(h,I,10,M.s)).indexOf("."))>-1?h=h.replace(".",""):i=h.length}for(F=0;48===h.charCodeAt(F);F++);for(y=h.length;48===h.charCodeAt(--y););if(h=h.slice(F,++y)){if(y-=F,U&&W.DEBUG&&y>15&&(A>R||A!==w(A)))throw Error(o+M.s*A);if((i=i-F-1)>l)M.c=M.e=null;else if(i<d)M.c=[M.e=0];else{if(M.e=i,M.c=[],F=(i+1)%G,i<0&&(F+=G),F<y){for(F&&M.c.push(+h.slice(0,F)),y-=G;F<y;)M.c.push(+h.slice(F,F+=G));h=h.slice(F),F=G-h.length}else F-=y;for(;F--;h+="0");M.c.push(+h)}}else M.c=[M.e=0]}function x(A,I,g,B){var Q,C,E,D,w;if(null==g?g=f:c(g,0,8),!A.c)return A.toString();if(Q=A.c[0],E=A.e,null==I)w=Y(A.c),w=1==B||2==B&&(E<=q||E>=r)?S
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
var B=g(58),Q=g(59),C=g(60);function E(){return w.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function D(A,I){if(E()<I)throw new RangeError("Invalid typed array length");return w.TYPED_ARRAY_SUPPORT?(A=new Uint8Array(I)).__proto__=w.prototype:(null===A&&(A=new w(I)),A.length=I),A}function w(A,I,g){if(!(w.TYPED_ARRAY_SUPPORT||this instanceof w))return new w(A,I,g);if("number"==typeof A){if("string"==typeof I)throw new Error("If encoding is specified then the first argument must be a string");return F(this,A)}return i(this,A,I,g)}function i(A,I,g,B){if("number"==typeof I)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&I instanceof ArrayBuffer?function(A,I,g,B){if(I.byteLength,g<0||I.byteLength<g)throw new RangeError("'offset' is out of bounds");if(I.byteLength<g+(B||0))throw new RangeError("'length' is out of bounds");I=void 0===g&&void 0===B?new Uint8Array(I):void 0===B?new Uint8Array(I,g):new Uint8Array(I,g,B);w.TYPED_ARRAY_SUPPORT?(A=I).__proto__=w.prototype:A=G(A,I);return A}(A,I,g,B):"string"==typeof I?function(A,I,g){"string"==typeof g&&""!==g||(g="utf8");if(!w.isEncoding(g))throw new TypeError('"encoding" must be a valid string encoding');var B=0|U(I,g),Q=(A=D(A,B)).write(I,g);Q!==B&&(A=A.slice(0,Q));return A}(A,I,g):function(A,I){if(w.isBuffer(I)){var g=0|R(I.length);return 0===(A=D(A,g)).length?A:(I.copy(A,0,0,g),A)}if(I){if("undefined"!=typeof ArrayBuffer&&I.buffer instanceof ArrayBuffer||"length"in I)return"number"!=typeof I.length||(B=I.length)!=B?D(A,0):G(A,I);if("Buffer"===I.type&&C(I.data))return G(A,I.data)}var B;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(A,I)}function o(A){if("number"!=typeof A)throw new TypeError('"size" argument must be a number');if(A<0)throw new RangeError('"size" argument must not be negative')}function F(A,I){if(o(I),A=D(A,I<0?0:0|R(I)),!w.TYPED_ARRAY_SUPPORT)for(var g=0;g<I;++g)A[g]=0;return A}function G(A,I){var g=I.length<0?0:0|R(I.length);A=D(A,g);for(var B=0;B<g;B+=1)A[B]=255&I[B];return A}function R(A){if(A>=E())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+E().toString(16)+" bytes");return 0|A}function U(A,I){if(w.isBuffer(A))return A.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(A)||A instanceof ArrayBuffer))return A.byteLength;"string"!=typeof A&&(A=""+A);var g=A.length;if(0===g)return 0;for(var B=!1;;)switch(I){case"ascii":case"latin1":case"binary":return g;case"utf8":case"utf-8":case void 0:return X(A).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*g;case"hex":return g>>>1;case"base64":return u(A).length;default:if(B)return X(A).length;I=(""+I).toLowerCase(),B=!0}}function y(A,I,g){var B=A[I];A[I]=A[g],A[g]=B}function h(A,I,g,B,Q){if(0===A.length)return-1;if("string"==typeof g?(B=g,g=0):g>2147483647?g=2147483647:g<-2147483648&&(g=-2147483648),g=+g,isNaN(g)&&(g=Q?0:A.length-1),g<0&&(g=A.length+g),g>=A.length){if(Q)return-1;g=A.length-1}else if(g<0){if(!Q)return-1;g=0}if("string"==typeof I&&(I=w.from(I,B)),w.isBuffer(I))return 0===I.length?-1:M(A,I,g,B,Q);if("number"==typeof I)return I&=255,w.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?Q?Uint8Array.prototype.indexOf.call(A,I,g):Uint8Array.prototype.lastIndexOf.call(A,I,g):M(A,[I],g,B,Q);throw new TypeError("val must be string, number or Buffer")}function M(A,I,g,B,Q){var C,E=1,D=A.length,w=I.length;if(void 0!==B&&("ucs2"===(B=String(B).toLowerCase())||"ucs-2"===B||"utf16le"===B||"utf-16le"===B)){if(A.length<2||I.length<2)return-1;E=2,D/=2,w/=2,g/=2}function i(A,I){return 1===E?A[I]:A.readUInt16BE(I*E)}if(Q){var o=-1;for(C=g;C<D;C++)if(i(A,C)===i(I,-1===o?0:C-o)){if(-1===o&&(o=C),C-o+1===w)return o*E}else-1!==o&&(C-=C-o),o=-1}else for(g+w>D&&(g=D-w),C=g;C>=0;C--){for(var F=!0,G=0;G<w;G++)if(i(A,C+G)!==i(I,G)){F=!1;break}if(F)return C}return-1}function Y(A,I,g,B){g=Number(g)||0;var Q=A.length-g;B?(B=Number(B))>Q&&(B=Q):B=Q;var C=I.length;if(C%2!=0)throw new TypeError("Invalid hex s
/**
* Hexadecimal functions.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/function Q(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(!A)return"";for(var B="",Q=0;Q<A.length;Q++)B+=A[Q].toString(16).padStart(g,"0")+I;return"0x"===I&&(B="0x"+B),"\\x"===I&&(B="\\x"+B),I.length?B.slice(0,-I.length):B}function C(A){if(!A)return"";for(var I=[],g=0;g<A.length;g++)I.push((A[g]>>>4).toString(16)),I.push((15&A[g]).toString(16));return I.join("")}function E(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto",g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if("None"!==I){var Q="Auto"===I?/[^a-f\d]/gi:B.a.regexRep(I);A=A.replace(Q,"")}for(var C=[],E=0;E<A.length;E+=g)C.push(parseInt(A.substr(E,g),16));return C}var D=["Space","Comma","Semi-colon","Colon","Line feed","CRLF","0x","\\x","None"],w=["Auto"].concat(D)},794:function(A,I,g){(function(I,B,Q){var C=function(){"undefined"!=typeof document&&document.currentScript&&document.currentScript.src;return function(A){A=void 0!==(A=A||{})?A:{};var C,E={};for(C in A)A.hasOwnProperty(C)&&(E[C]=A[C]);A.arguments=[],A.thisProgram="./this.program",A.quit=function(A,I){throw I},A.preRun=[],A.postRun=[];var D=!1,w=!1,i=!1;D="object"==typeof window,w="function"==typeof importScripts,i="object"==typeof I&&!D&&!w;var o,F,G="";i&&(G=B+"/",A.read=function(A,I){var B;return(B=zI(A))||(o||(o=g(327)),F||(F=g(583)),A=F.normalize(A),B=o.readFileSync(A)),I?B:B.toString()},A.readBinary=function(I){var g=A.read(I,!0);return g.buffer||(g=new Uint8Array(g)),S(g.buffer),g},I.argv.length>1&&(A.thisProgram=I.argv[1].replace(/\\/g,"/")),A.arguments=I.argv.slice(2),I.on("uncaughtException",function(A){if(!(A instanceof sg))throw A}),I.on("unhandledRejection",Jg),A.quit=function(A){I.exit(A)},A.inspect=function(){return"[Emscripten Module object]"});var R=A.print||("undefined"!=typeof console?console.log.bind(console):"undefined"!=typeof print?print:null),U=A.printErr||("undefined"!=typeof printErr?printErr:"undefined"!=typeof console&&console.warn.bind(console)||R);for(C in E)E.hasOwnProperty(C)&&(A[C]=E[C]);function y(A){var I=X[b>>2],g=I+A+15&-16;if(g<=ZI())X[b>>2]=g;else if(!pI(g))return 0;return I}function h(A){switch(A){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:if("*"===A[A.length-1])return 4;if("i"===A[0]){var I=parseInt(A.substr(1));return S(I%8==0,"getNativeTypeSize invalid bits "+I+", type "+A),I/8}return 0}}E=void 0;var M,Y={"f64-rem":function(A,I){return A%I},debugger:function(){}},k=(new Array(0),0),c=function(A){k=A};"object"!=typeof WebAssembly&&U("no native wasm support detected");var a=!1;function S(A,I){A||Jg("Assertion failed: "+I)}function K(A,I,g,B){switch("*"===(g=g||"i8").charAt(g.length-1)&&(g="i32"),g){case"i1":case"i8":l[A>>0]=I;break;case"i16":Z[A>>1]=I;break;case"i32":X[A>>2]=I;break;case"i64":tempI64=[I>>>0,(tempDouble=I,+AA(tempDouble)>=1?tempDouble>0?(0|BA(+gA(tempDouble/4294967296),4294967295))>>>0:~~+IA((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],X[A>>2]=tempI64[0],X[A+4>>2]=tempI64[1];break;case"float":W[A>>2]=I;break;case"double":x[A>>3]=I;break;default:Jg("invalid type for setValue: "+g)}}var N=0,s=3;function H(A,I,g,B){var Q,C;"number"==typeof A?(Q=!0,C=A):(Q=!1,C=A.length);var E,D="string"==typeof I?I:null;if(E=g==s?B:[wg,Gg,y][g](Math.max(C,D?1:I.length)),Q){var w;for(B=E,S(0==(3&E)),w=E+(-4&C);B<w;B+=4)X[B>>2]=0;for(w=E+C;B<w;)l[B++>>0]=0;return E}if("i8"===D)return A.subarray||A.slice?V.set(A,E):V.set(new Uint8Array(A),E),E;for(var i,o,F,G=0;G<C;){var R=A[G];0!==(i=D||I[G])?("i64"==i&&(i="i32"),K(E+G,R,i),F!==i&&(o=h(i),F=i),G+=o):G++}return E}function J(A){return $?wg(A):y(A)}var L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function t(A,I,g){for(var B=I+g,Q=I;A[Q]&&!(Q>=B);)++Q;if(Q-I>16&&A.subarray&&L)return L.decode(A.subarray(I,Q));for(var C="";I<Q;){var E=A[I++];if(128&E){var D=63&A[I++];if(192!=(224&E)){var w=63&A[I++];if((E=224==(240&E)?(15&E)<<12|D<<6|w:(7&E)<<18|D<<12|w<<6|63&A[I++])<65536)C+=String.fromCh
/**
* @author n1474335 [n1474335@gmail.com]
* @author Matt C [matt@artemisbot.uk]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
var G=function(){function A(){var I=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!function(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}(this,A),this.value=[],this.type=A.BYTE_ARRAY,I&&I.hasOwnProperty("value")&&I.hasOwnProperty("type")&&this.set(I.value,I.type)}var I,g,C;return I=A,g=[{key:"set",value:function(I,g){if("string"==typeof g&&(g=A.typeEnum(g)),w.a.debug("Dish type: "+A.enumLookup(g)),this.value=I,this.type=g,!this.valid()){var C=B.a.truncate(JSON.stringify(this.value),13);throw new Q.a("Data is not a valid ".concat(A.enumLookup(g),": ").concat(C))}}},{key:"get",value:function(){var I=o(regeneratorRuntime.mark(function I(g){var B,Q=arguments;return regeneratorRuntime.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:if(B=Q.length>1&&void 0!==Q[1]&&Q[1],"string"==typeof g&&(g=A.typeEnum(g)),this.type===g){I.next=5;break}return I.next=5,this._translate(g,B);case 5:return I.abrupt("return",this.value);case 6:case"end":return I.stop()}},I,this)}));return function(A){return I.apply(this,arguments)}}()},{key:"_translate",value:function(){var I=o(regeneratorRuntime.mark(function I(g){var C,D,i=arguments;return regeneratorRuntime.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:C=i.length>1&&void 0!==i[1]&&i[1],w.a.debug("Translating Dish from ".concat(A.enumLookup(this.type)," to ").concat(A.enumLookup(g))),D=C?B.a.byteArrayToChars:B.a.byteArrayToUtf8,I.prev=3,I.t0=this.type,I.next=I.t0===A.STRING?7:I.t0===A.NUMBER?9:I.t0===A.HTML?11:I.t0===A.ARRAY_BUFFER?13:I.t0===A.BIG_NUMBER?15:I.t0===A.JSON?17:I.t0===A.FILE?19:I.t0===A.LIST_FILE?24:30;break;case 7:return this.value=this.value?B.a.strToByteArray(this.value):[],I.abrupt("break",31);case 9:return this.value="number"==typeof this.value?B.a.strToByteArray(this.value.toString()):[],I.abrupt("break",31);case 11:return this.value=this.value?B.a.strToByteArray(B.a.unescapeHtml(B.a.stripHtmlTags(this.value,!0))):[],I.abrupt("break",31);case 13:return this.value=Array.prototype.slice.call(new Uint8Array(this.value)),I.abrupt("break",31);case 15:return this.value=E.a.isBigNumber(this.value)?B.a.strToByteArray(this.value.toFixed()):[],I.abrupt("break",31);case 17:return this.value=this.value?B.a.strToByteArray(JSON.stringify(this.value,null,4)):[],I.abrupt("break",31);case 19:return I.next=21,B.a.readFile(this.value);case 21:return this.value=I.sent,this.value=Array.prototype.slice.call(this.value),I.abrupt("break",31);case 24:return I.next=26,Promise.all(this.value.map(function(){var A=o(regeneratorRuntime.mark(function A(I){return regeneratorRuntime.wrap(function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",B.a.readFile(I));case 1:case"end":return A.stop()}},A,this)}));return function(I){return A.apply(this,arguments)}}()));case 26:return this.value=I.sent,this.value=this.value.map(function(A){return Array.prototype.slice.call(A)}),this.value=[].concat.apply([],this.value),I.abrupt("break",31);case 30:return I.abrupt("break",31);case 31:I.next=36;break;case 33:throw I.prev=33,I.t1=I.catch(3),new Q.a("Error translating from ".concat(A.enumLookup(this.type)," to byteArray: ").concat(I.t1));case 36:this.type=A.BYTE_ARRAY,I.prev=37,I.t2=g,I.next=I.t2===A.STRING?41:I.t2===A.HTML?41:I.t2===A.NUMBER?44:I.t2===A.ARRAY_BUFFER?47:I.t2===A.BIG_NUMBER?50:I.t2===A.JSON?53:I.t2===A.FILE?56:I.t2===A.LIST_FILE?58:61;break;case 41:return this.value=this.value?D(this.value):"",this.type=A.STRING,I.abrupt("break",62);case 44:return this.value=this.value?parseFloat(D(this.value)):0,this.type=A.NUMBER,I.abrupt("break",62);case 47:return this.value=new Uint8Array(this.value).buffer,this.type=A.ARRAY_BUFFER,I.abrupt("break",62);case 50:try{this.value=new E.a(D(this.value))}catch(A){this.value=new E.a(NaN)}return this.type=A.BIG_NUMBER,I.abrupt("break",62);case 53:return this.value=JSON.parse(D(this.value)),this.type=A.JSON,I.abrupt("break",62);case 56:return this.value=new File(this.value,"unknown"),I.abrupt("break",62);case 58:return this.value=[new File(this.value,"unknown")],this.type=A.LIST_FILE,I.abrupt("break",