101 lines
107 KiB
JavaScript
Executable File
101 lines
107 KiB
JavaScript
Executable File
/**
|
||
* 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(t){var e={};function r(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1510)}({0:function(t,e,r){"use strict";var n=r(15),a=r.n(n),o=r(10),i=r(7),u=r(19),s=r(18);function c(t,e,r,n,a,o,i){try{var u=t[o](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,a)}function l(t){return function(){var e=this,r=arguments;return new Promise(function(n,a){var o=t.apply(e,r);function i(t){c(o,n,a,i,u,"next",t)}function u(t){c(o,n,a,i,u,"throw",t)}i(void 0)})}}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/
|
||
var f=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,r,n;return e=t,r=null,n=[{key:"chr",value:function(t){if(t>65535){t-=65536;var e=String.fromCharCode(t>>>10&1023|55296);return t=56320|1023&t,e+String.fromCharCode(t)}return String.fromCharCode(t)}},{key:"ord",value:function(t){if(2===t.length){var e=t.charCodeAt(0),r=t.charCodeAt(1);if(e>=55296&&e<56320&&r>=56320&&r<57344)return 1024*(e-55296)+r-56320+65536}return t.charCodeAt(0)}},{key:"padBytesRight",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=new Array(e);return n.fill(r),Array.prototype.map.call(t,function(t,e){n[e]=t}),n}},{key:"truncate",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";return t.length>e&&(t=t.slice(0,e-r.length)+r),t}},{key:"hex",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return(e="string"==typeof e?t.ord(e):e).toString(16).padStart(r,"0")}},{key:"bin",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return(e="string"==typeof e?t.ord(e):e).toString(2).padStart(r,"0")}},{key:"printable",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof window&&window.app&&!window.app.options.treatAsUtf8&&(e=t.byteArrayToChars(t.strToByteArray(e)));return e=e.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-\u20FF\u218A-\u218F\u23F4-\u23FF\u2427-\u243F\u244B-\u245F\u2700\u2B4D-\u2B4F\u2B5A-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E3C-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FCD-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA698-\uA69E\uA6F8-\uA6FF\uA78F\uA794-\uA79F\uA7AB-\uA7F7\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C5-\uA8CD\uA8DA-\uA8DF\uA8FC-\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9E0-\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAA7C-\uAA7F\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F-\uABBF\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE27-\uFE2F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF]/g,"."),r||(e=e.replace(/[\x09-\x10\x0D\u2028\u2029]/g,".")),e}},{key:"parseEscapedChars",value:function(t){return t.replace(/(\\)?\\([bfnrtv0'"]|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]{1,6}\})/g,function(t,e,r){if("\\"===e)return"\\"+r;switch(r[0]){case"0":return"\0";case"b":return"\b";case"t":return"\t";case"n":return"\n";case"v":return"\v";case"f":return"\f";case"r":return"\r";case'"':return'"';case"'":return"'";case"x":return String.fromCharCode(parseInt(r.substr(1),16));case"u":return"{"===r[1]?String.fromCodePoint(parseInt(r.slice(2,-1),16)):String.fromCharCode(parseInt(r.substr(1),16))}})}},{key:"escapeRegex",value:function(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}},{key:"expandAlphRange",value:function(e){for(var r=[],n=0;n<e.length;n++)if(n<e.length-2&&"-"===e[n+1]&&"\\"!==e[n]){for(var a=t.ord(e[n]),o=t.ord(e[n+2]),i=a;i<=o;i++)r.push(t.chr(i));n+=2}else n<e.length-2&&"\\"===e[n]&&"-"===e[n+1]?(r.push("-"),n++):r.push(e[n]);return r}},{key:"convertToByteArray",value:function(e,r){switch(r.toLowerCase()){case"binary":return Object(s.a)(e);case"hex":return Object(i.c)(e);case"decimal":return Object(u.a)(e);case"base64":return Object(o.b)(e,null,"byteArray");case"utf8":return t.strToUtf8ByteArray(e);case"latin1":default:return t.strToByteArray(e)}}},{key:"convertToByteString",value:function(e,r){switch(r.toLowerCase()){case"binary":return t.byteArrayToChars(Object(s.a)(e));case"hex":return t.byteArrayToChars(Object(i.c)(e));case"decimal":return t.byteArrayToChars(Object(u.a)(e));case"base64":return t.byteArrayToChars(Object(o.b)(e,null,"byteArray"));case"utf8":return a.a.encode(e);case"latin1":default:return e}}},{key:"strToByteArray",value:function(e){for(var r,n=new Array(e.length),a=e.length;a--;)if(r=e.charCodeAt(a),n[a]=r,r>255)return t.strToUtf8ByteArray(e);return n}},{key:"strToUtf8ByteArray",value:function(e){var r=a.a.encode(e);return e.length!==r.length&&("function"==typeof importScripts?self.setOption("attemptHighlight",!1):"object"==typeof window&&(window.app.options.attemptHighlight=!1)),t.strToByteArray(r)}},{key:"strToCharcode",value:function(e){for(var r=[],n=0;n<e.length;n++){var a=e.charCodeAt(n);if(n<e.length-1&&a>=55296&&a<56320){var o=e[n+1].charCodeAt(0);o>=56320&&o<57344&&(a=t.ord(e[n]+e[++n]))}r.push(a)}return r}},{key:"byteArrayToUtf8",value:function(e){var r=t.byteArrayToChars(e);try{var n=a.a.decode(r);return r.length!==n.length&&("function"==typeof importScripts?self.setOption("attemptHighlight",!1):"object"==typeof window&&(window.app.options.attemptHighlight=!1)),n}catch(t){return r}}},{key:"byteArrayToChars",value:function(t){if(!t)return"";for(var e="",r=0;r<t.length;)e+=String.fromCharCode(t[r++]);return e}},{key:"arrayBufferToStr",value:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=Array.prototype.slice.call(new Uint8Array(e));return r?t.byteArrayToUtf8(n):t.byteArrayToChars(n)}},{key:"parseCSV",value:function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[","],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["\n","\r"],o=!1,i=!1,u="",s=[],c=[];t.length&&"\ufeff"===t[0]&&(t=t.substr(1));for(var l=0;l<t.length;l++)e=t[l],r=t[l+1]||"",o?(u+=e,o=!1):'"'!==e||i?'"'===e&&i?'"'===r?o=!0:i=!1:!i&&n.indexOf(e)>=0?(s.push(u),u=""):!i&&a.indexOf(e)>=0?(s.push(u),u="",c.push(s),s=[],a.indexOf(r)>=0&&r!==e&&l++):u+=e:i=!0;return s.length&&(s.push(u),c.push(s)),c}},{key:"stripHtmlTags",value:function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(t=t.replace(/<(script|style)[^>]*>.*<\/(script|style)>/gim,"")),t.replace(/<[^>]+>/g,"")}},{key:"escapeHtml",value:function(t){var e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`"};return t.replace(/[&<>"'\/`]/g,function(t){return e[t]})}},{key:"unescapeHtml",value:function(t){var e={"&":"&","<":"<",">":">",""":'"',"'":"'","/":"/","`":"`"};return t.replace(/&#?x?[a-z0-9]{2,4};/gi,function(t){return e[t]||t})}},{key:"encodeURIFragment",value:function(t){var e={"%2D":"-","%2E":".","%5F":"_","%7E":"~","%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2C":",","%3B":";","%3A":":","%40":"@","%2F":"/","%3F":"?"};return(t=encodeURIComponent(t)).replace(/%[0-9A-F]{2}/g,function(t){return e[t]||t})}},{key:"generatePrettyRecipe",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="",n="",a="",o="",i="";return t.forEach(function(t){n=t.op.replace(/ /g,"_"),a=JSON.stringify(t.args).slice(1,-1).replace(/'/g,"\\'").replace(/"((?:[^"\\]|\\.)*)"/g,"'$1'").replace(/\\"/g,'"'),o=t.disabled?"/disabled":"",i=t.breakpoint?"/breakpoint":"",r+="".concat(n,"(").concat(a).concat(o).concat(i,")"),e&&(r+="\n")}),r}},{key:"parseRecipeConfig",value:function(t){if(0===(t=t.trim()).length)return[];if("["===t[0])return JSON.parse(t);var e,r;t=t.replace(/\n/g,"");for(var n=/([^(]+)\(((?:'[^'\\]*(?:\\.[^'\\]*)*'|[^)\/'])*)(\/[^)]+)?\)/g,a=[];e=n.exec(t);){r="["+(r=e[2].replace(/"/g,'\\"').replace(/(^|,|{|:)'/g,'$1"').replace(/([^\\]|[^\\]\\\\)'(,|:|}|$)/g,'$1"$2').replace(/\\'/g,"'"))+"]";var o={op:e[1].replace(/_/g," "),args:JSON.parse(r)};e[3]&&e[3].indexOf("disabled")>0&&(o.disabled=!0),e[3]&&e[3].indexOf("breakpoint")>0&&(o.breakpoint=!0),a.push(o)}return a}},{key:"displayFilesAsHTML",value:function(){var e=l(regeneratorRuntime.mark(function e(r){var n,a,i,u,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=function(e){return"<div class='card' style='white-space: normal;'>\n <div class='card-header'>\n <h6 class=\"mb-0\">\n ".concat(t.escapeHtml(e.name),"\n </h6>\n </div>\n </div>")},a=function(e,r){if(r.startsWith("image")){var n="data:";return n+=r+";","<img style='max-width: 100%;' src='"+(n+="base64,"+Object(o.c)(e))+"'>"}return"<pre>".concat(t.escapeHtml(t.arrayBufferToStr(e.buffer)),"</pre>")},i=function(){var e=l(regeneratorRuntime.mark(function e(r,n){var o,i,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.readFile(r);case 2:return o=e.sent,i=new Blob([o],{type:"octet/stream"}),u="<div class='card' style='white-space: normal;'>\n <div class='card-header' id='heading".concat(n,"'>\n <h6 class='mb-0'>\n <a class='collapsed'\n data-toggle='collapse'\n href='#collapse").concat(n,"'\n aria-expanded='false'\n aria-controls='collapse").concat(n,"'\n title=\"Show/hide contents of '").concat(t.escapeHtml(r.name),"'\">\n ").concat(t.escapeHtml(r.name),"</a>\n <span class='float-right' style=\"margin-top: -3px\">\n ").concat(r.size.toLocaleString(),' bytes\n <a title="Download ').concat(t.escapeHtml(r.name),"\"\n href='").concat(URL.createObjectURL(i),"'\n download='").concat(t.escapeHtml(r.name),'\'>\n <i class="material-icons" style="vertical-align: bottom">save</i>\n </a>\n </span>\n </h6>\n </div>\n <div id=\'collapse').concat(n,"' class='collapse' aria-labelledby='heading").concat(n,"' data-parent=\"#files\">\n <div class='card-body'>\n ").concat(a(o,r.type),"\n </div>\n </div>\n </div>"),e.abrupt("return",u);case 6:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}(),u="<div style='padding: 5px; white-space: normal;'>\n ".concat(r.length,' file(s) found\n </div><div id="files" style="padding: 20px">'),s=0;case 5:if(!(s<r.length)){e.next=17;break}if(!r[s].name.endsWith("/")){e.next=10;break}u+=n(r[s]),e.next=14;break;case 10:return e.t0=u,e.next=13,i(r[s],s);case 13:u=e.t0+=e.sent;case 14:s++,e.next=5;break;case 17:return e.abrupt("return",u+="</div>");case 18:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"parseURIParams",value:function(t){if(""===t)return{};"?"!==t[0]&&"#"!==t[0]||(t=t.substr(1));for(var e=t.split("&"),r={},n=0;n<e.length;n++){var a=e[n].split("=");2!==a.length?r[e[n]]=!0:r[a[0]]=decodeURIComponent(a[1].replace(/\+/g," "))}return r}},{key:"readFile",value:function(t){return new Promise(function(e,r){var n=new FileReader,a=new Uint8Array(t.size),o=0,i=function(){if(o>=t.size)e(a);else{var r=t.slice(o,o+10485760);n.readAsArrayBuffer(r)}};n.onload=function(t){a.set(new Uint8Array(n.result),o),o+=10485760,i()},n.onerror=function(t){r(n.error.message)},i()})}},{key:"mod",value:function(t,e){return(t%e+e)%e}},{key:"gcd",value:function(e,r){return r?t.gcd(r,e%r):e}},{key:"modInv",value:function(t,e){t%=e;for(var r=1;r<e;r++)if(t*r%26==1)return r}},{key:"charRep",value:function(t){return{Space:" ",Comma:",","Semi-colon":";",Colon:":","Line feed":"\n",CRLF:"\r\n","Forward slash":"/",Backslash:"\\","0x":"0x","\\x":"\\x","Nothing (separate chars)":"",None:""}[t]}},{key:"regexRep",value:function(t){return{Space:/\s+/g,Comma:/,/g,"Semi-colon":/;/g,Colon:/:/g,"Line feed":/\n/g,CRLF:/\r\n/g,"Forward slash":/\//g,Backslash:/\\/g,"0x":/0x/g,"\\x":/\\x/g,None:/\s+/g}[t]}}],r&&h(e.prototype,r),n&&h(e,n),t}();e.a=f,Array.prototype.unique=function(){for(var t={},e=[],r=0,n=this.length;r<n;r++)t.hasOwnProperty(this[r])||(e.push(this[r]),t[this[r]]=1);return e},Array.prototype.max=function(){return Math.max.apply(null,this)},Array.prototype.min=function(){return Math.min.apply(null,this)},Array.prototype.sum=function(){return this.reduce(function(t,e){return t+e},0)},Array.prototype.equals=function(t){if(!t)return!1;var e=this.length;if(e!==t.length)return!1;for(;e--;)if(this[e]!==t[e])return!1;return!0},String.prototype.count=function(t){return this.split(t).length-1},String.prototype.padStart||(String.prototype.padStart=function(t,e){return t>>=0,e=String(void 0!==e?e:" "),this.length>t?String(this):((t-=this.length)>e.length&&(e+=e.repeat(t/e.length)),e.slice(0,t)+String(this))}),String.prototype.padEnd||(String.prototype.padEnd=function(t,e){return t>>=0,e=String(void 0!==e?e:" "),this.length>t?String(this):((t-=this.length)>e.length&&(e+=e.repeat(t/e.length)),String(this)+e.slice(0,t))})},1:function(t,e,r){"use strict";var n=r(9),a=r(0),o=r(7);function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/
|
||
var u=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name="",this.type="",this._value=null,this.disabled=!1,this.hint="",this.rows=0,this.toggleValues=[],this.target=null,this.defaultIndex=0,e&&this._parseConfig(e)}var e,r,n;return e=t,n=[{key:"prepare",value:function(t,e){var r;switch(e){case"binaryString":case"binaryShortString":case"editableOption":case"editableOptionShort":return a.a.parseEscapedChars(t);case"byteArray":return"string"==typeof t?(t=t.replace(/\s+/g,""),Object(o.c)(t)):t;case"number":if(r=parseFloat(t),isNaN(r))throw"Invalid ingredient value. Not a number: "+a.a.truncate(t.toString(),10);return r;default:return t}}}],(r=[{key:"_parseConfig",value:function(t){this.name=t.name,this.type=t.type,this.defaultValue=t.value,this.disabled=!!t.disabled,this.hint=t.hint||!1,this.rows=t.rows||!1,this.toggleValues=t.toggleValues,this.target=void 0!==t.target?t.target:null,this.defaultIndex=void 0!==t.defaultIndex?t.defaultIndex:0}},{key:"config",get:function(){return this._value}},{key:"value",set:function(e){this._value=t.prepare(e,this.type)},get:function(){return this._value}}])&&i(e.prototype,r),n&&i(e,n),t}();function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/
|
||
var c=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),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 e,r,a;return e=t,(r=[{key:"run",value:function(t,e){return t}},{key:"highlight",value:function(t,e){return!1}},{key:"highlightReverse",value:function(t,e){return!1}},{key:"present",value:function(t,e){return t}},{key:"addIngredient",value:function(t){this._ingList.push(t)}},{key:"inputType",set:function(t){this._inputType=n.a.typeEnum(t)},get:function(){return n.a.enumLookup(this._inputType)}},{key:"outputType",set:function(t){this._outputType=n.a.typeEnum(t),this._presentType<0&&(this._presentType=this._outputType)},get:function(){return n.a.enumLookup(this._outputType)}},{key:"presentType",set:function(t){this._presentType=n.a.typeEnum(t)},get:function(){return n.a.enumLookup(this._presentType)}},{key:"args",set:function(t){var e=this;t.forEach(function(t){var r=new u(t);e.addIngredient(r)})},get:function(){return this._ingList.map(function(t){var e={name:t.name,type:t.type,value:t.defaultValue};return t.toggleValues&&(e.toggleValues=t.toggleValues),t.hint&&(e.hint=t.hint),t.rows&&(e.rows=t.rows),t.disabled&&(e.disabled=t.disabled),t.target&&(e.target=t.target),t.defaultIndex&&(e.defaultIndex=t.defaultIndex),e})}},{key:"config",get:function(){return{op:this.name,args:this._ingList.map(function(t){return t.config})}}},{key:"ingValues",set:function(t){var e=this;t.forEach(function(t,r){e._ingList[r].value=t})},get:function(){return this._ingList.map(function(t){return t.value})}},{key:"breakpoint",set:function(t){this._breakpoint=!!t},get:function(){return this._breakpoint}},{key:"disabled",set:function(t){this._disabled=!!t},get:function(){return this._disabled}},{key:"flowControl",get:function(){return this._flowControl},set:function(t){this._flowControl=!!t}},{key:"manualBake",get:function(){return this._manualBake},set:function(t){this._manualBake=!!t}}])&&s(e.prototype,r),a&&s(e,a),t}();e.a=c},10:function(t,e,r){"use strict";r.d(e,"c",function(){return a}),r.d(e,"b",function(){return o}),r.d(e,"a",function(){return i});var n=r(0);
|
||
/**
|
||
* Base64 functions.
|
||
*
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=";if(!t)return"";"string"==typeof t&&(t=n.a.strToByteArray(t)),e=n.a.expandAlphRange(e).join("");for(var r,a,o,i,u,s,c,l="",h=0;h<t.length;)i=(r=t[h++])>>2,u=(3&r)<<4|(a=t[h++])>>4,s=(15&a)<<2|(o=t[h++])>>6,c=63&o,isNaN(a)?s=c=64:isNaN(o)&&(c=64),l+=e.charAt(i)+e.charAt(u)+e.charAt(s)+e.charAt(c);return l}function o(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string",a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!t)return"string"===r?"":[];e=e||"A-Za-z0-9+/=",e=n.a.expandAlphRange(e).join("");var o,i,u,s,c,l,h=[],f=0;if(a){var p=new RegExp("[^"+e.replace(/[[\]\\\-^$]/g,"\\$&")+"]","g");t=t.replace(p,"")}for(;f<t.length;)o=e.indexOf(t.charAt(f++))<<2|(s=-1===(s=e.indexOf(t.charAt(f++)||"="))?64:s)>>4,i=(15&s)<<4|(c=-1===(c=e.indexOf(t.charAt(f++)||"="))?64:c)>>2,u=(3&c)<<6|(l=-1===(l=e.indexOf(t.charAt(f++)||"="))?64:l),h.push(o),64!==c&&h.push(i),64!==l&&h.push(u);return"string"===r?n.a.byteArrayToUtf8(h):h}var i=[{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"}]},105:function(t,e,r){"use strict";e.LatLonSpherical=r(1377),e.LatLonEllipsoidal=r(452);var n=r(1378);for(var a in n)e.LatLonEllipsoidal[a]=n[a];e.LatLonVectors=r(1379),e.Vector3d=r(586),e.Utm=r(719),e.Mgrs=r(1380),e.OsGridRef=r(1381),e.Dms=r(501)},12:function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}
|
||
/**
|
||
* 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 s=function(t){function e(){var t,r,o,u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var s=arguments.length,c=new Array(s),l=0;l<s;l++)c[l]=arguments[l];return o=this,(r=!(u=(t=a(e)).call.apply(t,[this].concat(c)))||"object"!==n(u)&&"function"!=typeof u?i(o):u).type="DishError",Error.captureStackTrace&&Error.captureStackTrace(i(i(r)),e),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}(e,u(Error)),e}();e.a=s},1377:function(t,e,r){"use strict";if(t.exports)var n=r(501);function a(t,e){if(!(this instanceof a))return new a(t,e);this.lat=Number(t),this.lon=Number(e)}a.prototype.distanceTo=function(t,e){if(!(t instanceof a))throw new TypeError("point is not LatLon object");var r=e=void 0===e?6371e3:Number(e),n=this.lat.toRadians(),o=this.lon.toRadians(),i=t.lat.toRadians(),u=i-n,s=t.lon.toRadians()-o,c=Math.sin(u/2)*Math.sin(u/2)+Math.cos(n)*Math.cos(i)*Math.sin(s/2)*Math.sin(s/2);return r*(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)))},a.prototype.bearingTo=function(t){if(!(t instanceof a))throw new TypeError("point is not LatLon object");var e=this.lat.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),o=Math.sin(n)*Math.cos(r),i=Math.cos(e)*Math.sin(r)-Math.sin(e)*Math.cos(r)*Math.cos(n);return(Math.atan2(o,i).toDegrees()+360)%360},a.prototype.finalBearingTo=function(t){if(!(t instanceof a))throw new TypeError("point is not LatLon object");return(t.bearingTo(this)+180)%360},a.prototype.midpointTo=function(t){if(!(t instanceof a))throw new TypeError("point is not LatLon object");var e=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),o=(t.lon-this.lon).toRadians(),i=Math.cos(n)*Math.cos(o),u=Math.cos(n)*Math.sin(o),s=Math.sqrt((Math.cos(e)+i)*(Math.cos(e)+i)+u*u),c=Math.sin(e)+Math.sin(n),l=Math.atan2(c,s),h=r+Math.atan2(u,Math.cos(e)+i);return new a(l.toDegrees(),(h.toDegrees()+540)%360-180)},a.prototype.intermediatePointTo=function(t,e){if(!(t instanceof a))throw new TypeError("point is not LatLon object");var r=this.lat.toRadians(),n=this.lon.toRadians(),o=t.lat.toRadians(),i=t.lon.toRadians(),u=Math.sin(r),s=Math.cos(r),c=Math.sin(n),l=Math.cos(n),h=Math.sin(o),f=Math.cos(o),p=Math.sin(i),d=Math.cos(i),g=o-r,v=i-n,y=Math.sin(g/2)*Math.sin(g/2)+Math.cos(r)*Math.cos(o)*Math.sin(v/2)*Math.sin(v/2),m=2*Math.atan2(Math.sqrt(y),Math.sqrt(1-y)),b=Math.sin((1-e)*m)/Math.sin(m),M=Math.sin(e*m)/Math.sin(m),w=b*s*l+M*f*d,A=b*s*c+M*f*p,F=b*u+M*h,E=Math.atan2(F,Math.sqrt(w*w+A*A)),N=Math.atan2(A,w);return new a(E.toDegrees(),(N.toDegrees()+540)%360-180)},a.prototype.destinationPoint=function(t,e,r){r=void 0===r?6371e3:r;var n=Number(t)/Number(r),o=Number(e).toRadians(),i=this.lat.toRadians(),u=this.lon.toRadians(),s=Math.sin(i),c=Math.cos(i),l=Math.sin(n),h=Math.cos(n),f=Math.sin(o),p=s*h+c*l*Math.cos(o),d=Math.asin(p),g=f*l*c,v=h-s*p,y=u+Math.atan2(g,v);return new a(d.toDegrees(),(y.toDegrees()+540)%360-180)},a.intersection=function(t,e,r,n){if(!(t instanceof a))throw new TypeError("p1 is not LatLon object");if(!(r instanceof a))throw new TypeError("p2 is not LatLon object");var o=t.lat.toRadians(),i=t.lon.toRadians(),u=r.lat.toRadians(),s=r.lon.toRadians(),c=Number(e).toRadians(),l=Number(n).toRadians(),h=u-o,f=s-i,p=2*Math.asin(Math.sqrt(Math.sin(h/2)*Math.sin(h/2)+Math.cos(o)*Math.cos(u)*Math.sin(f/2)*Math.sin(f/2)));if(0==p)return null;var d=Math.acos((Math.sin(u)-Math.sin(o)*Math.cos(p))/(Math.sin(p)*Math.cos(o)));isNaN(d)&&(d=0);var g=Math.acos((Math.sin(o)-Math.sin(u)*Math.cos(p))/(Math.sin(p)*Math.cos(u))),v=c-(Math.sin(s-i)>0?d:2*Math.PI-d),y=(Math.sin(s-i)>0?2*Math.PI-g:g)-l;if(0==Math.sin(v)&&0==Math.sin(y))return null;if(Math.sin(v)*Math.sin(y)<0)return null;var m=-Math.cos(v)*Math.cos(y)+Math.sin(v)*Math.sin(y)*Math.cos(p),b=Math.atan2(Math.sin(p)*Math.sin(v)*Math.sin(y),Math.cos(y)+Math.cos(v)*m),M=Math.asin(Math.sin(o)*Math.cos(b)+Math.cos(o)*Math.sin(b)*Math.cos(c)),w=i+Math.atan2(Math.sin(c)*Math.sin(b)*Math.cos(o),Math.cos(b)-Math.sin(o)*Math.sin(M));return new a(M.toDegrees(),(w.toDegrees()+540)%360-180)},a.prototype.crossTrackDistanceTo=function(t,e,r){if(!(t instanceof a))throw new TypeError("‘pathStart’ is not LatLon object");if(!(e instanceof a))throw new TypeError("‘pathEnd’ is not LatLon object");var n=void 0===r?6371e3:Number(r),o=t.distanceTo(this,n)/n,i=t.bearingTo(this).toRadians(),u=t.bearingTo(e).toRadians();return Math.asin(Math.sin(o)*Math.sin(i-u))*n},a.prototype.alongTrackDistanceTo=function(t,e,r){if(!(t instanceof a))throw new TypeError("‘pathStart’ is not LatLon object");if(!(e instanceof a))throw new TypeError("‘pathEnd’ is not LatLon object");var n=void 0===r?6371e3:r,o=t.distanceTo(this,n)/n,i=t.bearingTo(this).toRadians(),u=t.bearingTo(e).toRadians(),s=Math.asin(Math.sin(o)*Math.sin(i-u));return Math.acos(Math.cos(o)/Math.abs(Math.cos(s)))*Math.sign(Math.cos(u-i))*n},a.prototype.maxLatitude=function(t){var e=Number(t).toRadians(),r=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(r))).toDegrees()},a.crossingParallels=function(t,e,r){var n=Number(r).toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=e.lat.toRadians(),u=e.lon.toRadians()-o,s=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.sin(u),c=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.cos(u)-Math.cos(a)*Math.sin(i)*Math.cos(n),l=Math.cos(a)*Math.cos(i)*Math.sin(n)*Math.sin(u);if(l*l>s*s+c*c)return null;var h=Math.atan2(-c,s),f=Math.acos(l/Math.sqrt(s*s+c*c)),p=o+h+f;return{lon1:((o+h-f).toDegrees()+540)%360-180,lon2:(p.toDegrees()+540)%360-180}},a.prototype.rhumbDistanceTo=function(t,e){if(!(t instanceof a))throw new TypeError("point is not LatLon object");var r=e=void 0===e?6371e3:Number(e),n=this.lat.toRadians(),o=t.lat.toRadians(),i=o-n,u=Math.abs(t.lon-this.lon).toRadians();u>Math.PI&&(u-=2*Math.PI);var s=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),c=Math.abs(s)>1e-11?i/s:Math.cos(n);return Math.sqrt(i*i+c*c*u*u)*r},a.prototype.rhumbBearingTo=function(t){if(!(t instanceof a))throw new TypeError("point is not LatLon object");var e=this.lat.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians();n>Math.PI&&(n-=2*Math.PI),n<-Math.PI&&(n+=2*Math.PI);var o=Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(e/2+Math.PI/4));return(Math.atan2(n,o).toDegrees()+360)%360},a.prototype.rhumbDestinationPoint=function(t,e,r){r=void 0===r?6371e3:r;var n=this.lat.toRadians(),o=this.lon.toRadians(),i=Number(e).toRadians(),u=t/r,s=u*Math.cos(i),c=n+s;Math.abs(c)>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c);var l=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),h=Math.abs(l)>1e-11?s/l:Math.cos(n),f=o+u*Math.sin(i)/h;return new a(c.toDegrees(),(f.toDegrees()+540)%360-180)},a.prototype.rhumbMidpointTo=function(t){if(!(t instanceof a))throw new TypeError("point is not LatLon object");var e=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),o=t.lon.toRadians();Math.abs(o-r)>Math.PI&&(r+=2*Math.PI);var i=(e+n)/2,u=Math.tan(Math.PI/4+e/2),s=Math.tan(Math.PI/4+n/2),c=Math.tan(Math.PI/4+i/2),l=((o-r)*Math.log(c)+r*Math.log(s)-o*Math.log(u))/Math.log(s/u);return isFinite(l)||(l=(r+o)/2),a(i.toDegrees(),(l.toDegrees()+540)%360-180)},a.areaOf=function(t,e){var r=void 0===e?6371e3:Number(e),n=t[0].equals(t[t.length-1]);n||t.push(t[0]);for(var a=t.length-1,o=0,i=0;i<a;i++){var u=t[i].lat.toRadians(),s=t[i+1].lat.toRadians(),c=(t[i+1].lon-t[i].lon).toRadians();o+=2*Math.atan2(Math.tan(c/2)*(Math.tan(u/2)+Math.tan(s/2)),1+Math.tan(u/2)*Math.tan(s/2))}(function(t){for(var e=0,r=t[0].bearingTo(t[1]),n=0;n<t.length-1;n++){var a=t[n].bearingTo(t[n+1]),o=t[n].finalBearingTo(t[n+1]);e+=(a-r+540)%360-180,e+=(o-a+540)%360-180,r=o}var a=t[0].bearingTo(t[1]);return e+=(a-r+540)%360-180,Math.abs(e)<90})(t)&&(o=Math.abs(o)-2*Math.PI);var l=Math.abs(o*r*r);return n||t.pop(),l},a.prototype.equals=function(t){if(!(t instanceof a))throw new TypeError("point is not LatLon object");return this.lat==t.lat&&this.lon==t.lon},a.prototype.toString=function(t,e){return n.toLat(this.lat,t,e)+", "+n.toLon(this.lon,t,e)},void 0===Number.prototype.toRadians&&(Number.prototype.toRadians=function(){return this*Math.PI/180}),void 0===Number.prototype.toDegrees&&(Number.prototype.toDegrees=function(){return 180*this/Math.PI}),t.exports&&(t.exports=a)},1378:function(t,e,r){"use strict";if(t.exports)var n=r(452);n.prototype.distanceTo=function(t){if(!(t instanceof n))throw new TypeError("point is not LatLon object");try{return Number(this.inverse(t).distance.toFixed(3))}catch(t){return NaN}},n.prototype.initialBearingTo=function(t){if(!(t instanceof n))throw new TypeError("point is not LatLon object");try{return Number(this.inverse(t).initialBearing.toFixed(9))}catch(t){return NaN}},n.prototype.finalBearingTo=function(t){if(!(t instanceof n))throw new TypeError("point is not LatLon object");try{return Number(this.inverse(t).finalBearing.toFixed(9))}catch(t){return NaN}},n.prototype.destinationPoint=function(t,e){return this.direct(Number(t),Number(e)).point},n.prototype.finalBearingOn=function(t,e){return Number(this.direct(Number(t),Number(e)).finalBearing.toFixed(9))},n.prototype.direct=function(t,e){var r,a,o,i,u=this.lat.toRadians(),s=this.lon.toRadians(),c=e.toRadians(),l=t,h=this.datum.ellipsoid.a,f=this.datum.ellipsoid.b,p=this.datum.ellipsoid.f,d=Math.sin(c),g=Math.cos(c),v=(1-p)*Math.tan(u),y=1/Math.sqrt(1+v*v),m=v*y,b=Math.atan2(v,g),M=y*d,w=1-M*M,A=w*(h*h-f*f)/(f*f),F=1+A/16384*(4096+A*(A*(320-175*A)-768)),E=A/1024*(256+A*(A*(74-47*A)-128)),N=l/(f*F),D=0;do{r=Math.cos(2*b+N),i=N,N=l/(f*F)+E*(a=Math.sin(N))*(r+E/4*((o=Math.cos(N))*(2*r*r-1)-E/6*r*(4*a*a-3)*(4*r*r-3)))}while(Math.abs(N-i)>1e-12&&++D<100);if(D>=100)throw new Error("Formula failed to converge");var B=m*a-y*o*g,C=Math.atan2(m*o+y*a*g,(1-p)*Math.sqrt(M*M+B*B)),S=p/16*w*(4+p*(4-3*w)),R=(s+(Math.atan2(a*d,y*o-m*a*g)-(1-S)*p*M*(N+S*a*(r+S*o*(2*r*r-1))))+3*Math.PI)%(2*Math.PI)-Math.PI,x=Math.atan2(M,-B);return x=(x+2*Math.PI)%(2*Math.PI),{point:new n(C.toDegrees(),R.toDegrees(),this.datum),finalBearing:x.toDegrees(),iterations:D}},n.prototype.inverse=function(t){var e=t;-180==this.lon&&(this.lon=180);var r,n,a,o,i,u,s=this.lat.toRadians(),c=this.lon.toRadians(),l=e.lat.toRadians(),h=e.lon.toRadians(),f=this.datum.ellipsoid.a,p=this.datum.ellipsoid.b,d=this.datum.ellipsoid.f,g=h-c,v=(1-d)*Math.tan(s),y=1/Math.sqrt(1+v*v),m=v*y,b=(1-d)*Math.tan(l),M=1/Math.sqrt(1+b*b),w=b*M,A=0,F=0,E=0,N=0,D=0,B=g,C=0,S=Math.abs(g)>Math.PI;do{if(0==(a=M*(r=Math.sin(B))*(M*r)+(y*w-m*M*(n=Math.cos(B)))*(y*w-m*M*n)))break;if(F=m*w+y*M*n,u=B,B=g+(1-(i=d/16*(N=1-(o=y*M*r/(A=Math.sqrt(a)))*o)*(4+d*(4-3*N))))*d*o*((E=Math.atan2(A,F))+i*A*((D=0!=N?F-2*m*w/N:0)+i*F*(2*D*D-1))),(S?Math.abs(B)-Math.PI:Math.abs(B))>Math.PI)throw new Error("λ > π")}while(Math.abs(B-u)>1e-12&&++C<1e3);if(C>=1e3)throw new Error("Formula failed to converge");var R=N*(f*f-p*p)/(p*p),x=R/1024*(256+R*(R*(74-47*R)-128)),L=p*(1+R/16384*(4096+R*(R*(320-175*R)-768)))*(E-x*A*(D+x/4*(F*(2*D*D-1)-x/6*D*(4*A*A-3)*(4*D*D-3)))),T=Math.atan2(M*r,y*w-m*M*n),k=Math.atan2(y*r,-m*M+y*w*n);return T=(T+2*Math.PI)%(2*Math.PI),k=(k+2*Math.PI)%(2*Math.PI),{distance:L,initialBearing:0==L?NaN:T.toDegrees(),finalBearing:0==L?NaN:k.toDegrees(),iterations:C}},void 0===Number.prototype.toRadians&&(Number.prototype.toRadians=function(){return this*Math.PI/180}),void 0===Number.prototype.toDegrees&&(Number.prototype.toDegrees=function(){return 180*this/Math.PI}),t.exports&&(t.exports=n)},1379:function(t,e,r){"use strict";if(t.exports)var n=r(586);if(t.exports)var a=r(501);function o(t,e){if(!(this instanceof o))return new o(t,e);this.lat=Number(t),this.lon=Number(e)}o.prototype.toVector=function(){var t=this.lat.toRadians(),e=this.lon.toRadians(),r=Math.cos(t)*Math.cos(e),a=Math.cos(t)*Math.sin(e),o=Math.sin(t);return new n(r,a,o)},n.prototype.toLatLonS=function(){var t=Math.atan2(this.z,Math.sqrt(this.x*this.x+this.y*this.y)),e=Math.atan2(this.y,this.x);return new o(t.toDegrees(),e.toDegrees())},o.prototype.greatCircle=function(t){var e=this.lat.toRadians(),r=this.lon.toRadians(),a=Number(t).toRadians(),o=Math.sin(r)*Math.cos(a)-Math.sin(e)*Math.cos(r)*Math.sin(a),i=-Math.cos(r)*Math.cos(a)-Math.sin(e)*Math.sin(r)*Math.sin(a),u=Math.cos(e)*Math.sin(a);return new n(o,i,u)},n.prototype.greatCircle=function(t){var e=Number(t).toRadians(),r=new n(0,0,1).cross(this),a=this.cross(r),o=r.times(Math.cos(e)/r.length());return a.times(Math.sin(e)/a.length()).minus(o)},o.prototype.distanceTo=function(t,e){if(!(t instanceof o))throw new TypeError("point is not LatLon object");e=void 0===e?6371e3:Number(e);var r=this.toVector(),n=t.toVector();return r.angleTo(n)*e},o.prototype.bearingTo=function(t){if(!(t instanceof o))throw new TypeError("point is not LatLon object");var e=this.toVector(),r=t.toVector(),a=new n(0,0,1),i=e.cross(r),u=e.cross(a);return(i.angleTo(u,e).toDegrees()+360)%360},o.prototype.midpointTo=function(t){if(!(t instanceof o))throw new TypeError("point is not LatLon object");var e=this.toVector(),r=t.toVector();return e.plus(r).unit().toLatLonS()},o.prototype.intermediatePointTo=function(t,e){if(!(t instanceof o))throw new TypeError("point is not LatLon object");var r=this.toVector(),a=t.toVector(),i=r.cross(a).length(),u=r.dot(a),s=Math.atan2(i,u)*Number(e),c=Math.sin(s),l=Math.cos(s),h=r.cross(a).unit().cross(r),f=r.times(l).plus(h.times(c));return new n(f.x,f.y,f.z).toLatLonS()},o.prototype.intermediatePointOnChordTo=function(t,e){if(!(t instanceof o))throw new TypeError("point is not LatLon object");var r=this.toVector(),a=t.toVector(),i=r.plus(a.minus(r).times(Number(e)));return new n(i.x,i.y,i.z).toLatLonS()},o.prototype.destinationPoint=function(t,e,r){r=void 0===r?6371e3:Number(r);var a=this.toVector(),o=Number(t)/r,i=Number(e).toRadians(),u=new n(0,0,1).cross(a).unit(),s=a.cross(u),c=u.times(Math.sin(i)),l=s.times(Math.cos(i)).plus(c),h=a.times(Math.cos(o)),f=l.times(Math.sin(o));return h.plus(f).toLatLonS()},o.intersection=function(t,e,r,n){if(!(t instanceof o))throw new TypeError("path1start is not LatLon object");if(!(r instanceof o))throw new TypeError("path2start is not LatLon object");if(!(e instanceof o)&&isNaN(e))throw new TypeError("path1brngEnd is not LatLon object or bearing");if(!(n instanceof o)&&isNaN(n))throw new TypeError("path2brngEnd is not LatLon object or bearing");var a,i,u,s,c=t.toVector(),l=r.toVector();e instanceof o?(a=c.cross(e.toVector()),u="endpoint"):(a=t.greatCircle(Number(e)),u="bearing"),n instanceof o?(i=l.cross(n.toVector()),s="endpoint"):(i=r.greatCircle(Number(n)),s="bearing");var h=a.cross(i),f=i.cross(a),p=null;switch(u+"+"+s){case"bearing+bearing":switch(Math.sign(a.cross(c).dot(h))+Math.sign(i.cross(l).dot(h))){case 2:p=h;break;case-2:p=f;break;case 0:p=c.plus(l).dot(h)>0?f:h}break;case"bearing+endpoint":p=Math.sign(a.cross(c).dot(h))>0?h:f;break;case"endpoint+bearing":p=Math.sign(i.cross(l).dot(h))>0?h:f;break;case"endpoint+endpoint":p=c.plus(l).plus(e.toVector()).plus(n.toVector()).dot(h)>0?h:f}return p.toLatLonS()},o.prototype.crossTrackDistanceTo=function(t,e,r){if(!(t instanceof o))throw new TypeError("pathStart is not LatLon object");var n=void 0===r?6371e3:Number(r),a=this.toVector();return((e instanceof o?t.toVector().cross(e.toVector()):t.greatCircle(Number(e))).angleTo(a)-Math.PI/2)*n},o.prototype.alongTrackDistanceTo=function(t,e,r){if(!(t instanceof o))throw new TypeError("pathStart is not LatLon object");var n=void 0===r?6371e3:Number(r),a=this.toVector(),i=e instanceof o?t.toVector().cross(e.toVector()):t.greatCircle(Number(e)),u=i.cross(a).cross(i);return t.toVector().angleTo(u,i)*n},o.prototype.nearestPointOnSegment=function(t,e){var r=null;if(this.isBetween(t,e)){var n=this.toVector(),a=t.toVector(),o=e.toVector(),i=a.cross(o),u=n.cross(i);r=i.cross(u).toLatLonS()}else{r=this.distanceTo(t)<this.distanceTo(e)?t:e}return r},o.prototype.isBetween=function(t,e){var r=this.toVector(),n=t.toVector(),a=e.toVector(),o=r.minus(n),i=a.minus(n),u=r.minus(a),s=n.minus(a),c=o.dot(i),l=u.dot(s),h=c>=0&&l>=0,f=r.dot(n)>=0&&r.dot(a)>=0;return h&&f},o.prototype.enclosedBy=function(t){var e=t[0].equals(t[t.length-1]);e||t.push(t[0]);for(var r=t.length-1,n=this.toVector(),a=[],o=0;o<r;o++)a[o]=n.minus(t[o].toVector());a.push(a[0]);var i=0;for(o=0;o<r;o++)i+=a[o].angleTo(a[o+1],n);var u=Math.abs(i)>Math.PI;return e||t.pop(),u},o.areaOf=function(t,e){var r=null==e?6371e3:Number(e),n=t[0].equals(t[t.length-1]);n||t.push(t[0]);for(var a=t.length-1,o=[],i=0;i<a;i++){var u=t[i].toVector(),s=t[i+1].toVector();o[i]=u.cross(s)}o.push(o[0]);var c=t[0].toVector(),l=0;for(i=0;i<a;i++)l+=o[i].angleTo(o[i+1],c);var h=(a*Math.PI-Math.abs(l)-(a-2)*Math.PI)*r*r;return n||t.pop(),h},o.meanOf=function(t){for(var e=new n(0,0,0),r=0;r<t.length;r++)e=e.plus(t[r].toVector());return e.unit().toLatLonS()},o.prototype.equals=function(t){if(!(t instanceof o))throw new TypeError("point is not LatLon object");return this.lat==t.lat&&this.lon==t.lon},o.prototype.toString=function(t,e){return a.toLat(this.lat,t,e)+", "+a.toLon(this.lon,t,e)},void 0===Number.prototype.toRadians&&(Number.prototype.toRadians=function(){return this*Math.PI/180}),void 0===Number.prototype.toDegrees&&(Number.prototype.toDegrees=function(){return 180*this/Math.PI}),void 0===Math.sign&&(Math.sign=function(t){return 0===(t=+t)||isNaN(t)?t:t>0?1:-1}),t.exports&&(t.exports=o,t.exports.Vector3d=n)},1380:function(t,e,r){"use strict";if(t.exports)var n=r(719);if(t.exports)var a=r(452);function o(t,e,r,n,i,u,s){if(!(this instanceof o))return new o(t,e,r,n,i,u,s);if(void 0===s&&(s=a.datum.WGS84),!(1<=t&&t<=60))throw new Error("Invalid MGRS grid reference (zone ‘"+t+"’)");if(1!=e.length)throw new Error("Invalid MGRS grid reference (band ‘"+e+"’)");if(-1==o.latBands.indexOf(e))throw new Error("Invalid MGRS grid reference (band ‘"+e+"’)");if(1!=r.length)throw new Error("Invalid MGRS grid reference (e100k ‘"+r+"’)");if(1!=n.length)throw new Error("Invalid MGRS grid reference (n100k ‘"+n+"’)");this.zone=Number(t),this.band=e,this.e100k=r,this.n100k=n,this.easting=Number(i),this.northing=Number(u),this.datum=s}o.latBands="CDEFGHJKLMNPQRSTUVWXX",o.e100kLetters=["ABCDEFGH","JKLMNPQR","STUVWXYZ"],o.n100kLetters=["ABCDEFGHJKLMNPQRSTUV","FGHJKLMNPQRSTUVABCDE"],n.prototype.toMgrs=function(){if(isNaN(this.zone+this.easting+this.northing))throw new Error("Invalid UTM coordinate ‘"+this.toString()+"’");var t=this.zone,e=this.toLatLonE(),r=o.latBands.charAt(Math.floor(e.lat/8+10)),n=Math.floor(this.easting/1e5),a=o.e100kLetters[(t-1)%3].charAt(n-1),i=Math.floor(this.northing/1e5)%20,u=o.n100kLetters[(t-1)%2].charAt(i),s=this.easting%1e5,c=this.northing%1e5;return new o(t,r,a,u,s=Number(s.toFixed(6)),c=Number(c.toFixed(6)))},o.prototype.toUtm=function(){for(var t=this.zone,e=this.band,r=this.e100k,i=this.n100k,u=this.easting,s=this.northing,c=e>="N"?"N":"S",l=1e5*(o.e100kLetters[(t-1)%3].indexOf(r)+1),h=1e5*o.n100kLetters[(t-1)%2].indexOf(i),f=8*(o.latBands.indexOf(e)-10),p=1e5*Math.floor(new a(f,0).toUtm().northing/1e5),d=0;d+h+s<p;)d+=2e6;return new n(t,c,l+u,d+h+s,this.datum)},o.parse=function(t){if(!(t=t.trim()).match(/\s/)){var e=t.slice(5);e=e.slice(0,e.length/2)+" "+e.slice(-e.length/2),t=t.slice(0,3)+" "+t.slice(3,5)+" "+e}if(null==(t=t.match(/\S+/g))||4!=t.length)throw new Error("Invalid MGRS grid reference ‘"+t+"’");var r=t[0],n=r.slice(0,2),a=r.slice(2,3),i=t[1],u=i.slice(0,1),s=i.slice(1,2),c=t[2],l=t[3];return new o(n,a,u,s,c=c.length>=5?c:(c+"00000").slice(0,5),l=l.length>=5?l:(l+"00000").slice(0,5))},o.prototype.toString=function(t){if(t=void 0===t?10:Number(t),-1==[2,4,6,8,10].indexOf(t))throw new Error("Invalid precision ‘"+t+"’");var e=("00"+this.zone).slice(-2),r=this.band,n=this.e100k,a=this.n100k,o=Math.floor(this.easting/Math.pow(10,5-t/2)),i=Math.floor(this.northing/Math.pow(10,5-t/2));return e+r+" "+n+a+" "+("00000"+o).slice(-t/2)+" "+("00000"+i).slice(-t/2)},t.exports&&(t.exports=o)},1381:function(t,e,r){"use strict";if(t.exports)var n=r(452);function a(t,e){if(!(this instanceof a))return new a(t,e);this.easting=Number(t),this.northing=Number(e)}a.latLonToOsGrid=function(t){if(!(t instanceof n))throw new TypeError("point is not LatLon object");t.datum!=n.datum.OSGB36&&(t=t.convertDatum(n.datum.OSGB36));var e=t.lat.toRadians(),r=t.lon.toRadians(),o=6377563.396,i=6356256.909,u=.9996012717,s=49..toRadians(),c=(-2).toRadians(),l=1-i*i/(o*o),h=(o-i)/(o+i),f=h*h,p=h*h*h,d=Math.cos(e),g=Math.sin(e),v=o*u/Math.sqrt(1-l*g*g),y=o*u*(1-l)/Math.pow(1-l*g*g,1.5),m=v/y-1,b=i*u*((1+h+5/4*f+5/4*p)*(e-s)-(3*h+3*h*h+21/8*p)*Math.sin(e-s)*Math.cos(e+s)+(15/8*f+15/8*p)*Math.sin(2*(e-s))*Math.cos(2*(e+s))-35/24*p*Math.sin(3*(e-s))*Math.cos(3*(e+s))),M=d*d*d,w=M*d*d,A=Math.tan(e)*Math.tan(e),F=A*A,E=r-c,N=E*E,D=N*E,B=D*E,C=B*E,S=b+-1e5+v/2*g*d*N+v/24*g*M*(5-A+9*m)*B+v/720*g*w*(61-58*A+F)*(C*E),R=4e5+v*d*E+v/6*M*(v/y-A)*D+v/120*w*(5-18*A+F+14*m-58*A*m)*C;return S=Number(S.toFixed(3)),new a(R=Number(R.toFixed(3)),S)},a.osGridToLatLon=function(t,e){if(!(t instanceof a))throw new TypeError("gridref is not OsGridRef object");void 0===e&&(e=n.datum.WGS84);var r=t.easting,o=t.northing,i=6377563.396,u=6356256.909,s=.9996012717,c=49..toRadians(),l=(-2).toRadians(),h=1-u*u/(i*i),f=(i-u)/(i+u),p=f*f,d=f*f*f,g=c,v=0;do{v=u*s*((1+f+5/4*p+5/4*d)*((g=(o- -1e5-v)/(i*s)+g)-c)-(3*f+3*f*f+21/8*d)*Math.sin(g-c)*Math.cos(g+c)+(15/8*p+15/8*d)*Math.sin(2*(g-c))*Math.cos(2*(g+c))-35/24*d*Math.sin(3*(g-c))*Math.cos(3*(g+c)))}while(o- -1e5-v>=1e-5);var y=Math.cos(g),m=Math.sin(g),b=i*s/Math.sqrt(1-h*m*m),M=i*s*(1-h)/Math.pow(1-h*m*m,1.5),w=b/M-1,A=Math.tan(g),F=A*A,E=F*F,N=1/y,D=b*b*b,B=D*b*b,C=r-4e5,S=C*C,R=S*C,x=S*S,L=R*S,T=l+N/b*C-N/(6*D)*(b/M+2*F)*R+N/(120*B)*(5+28*F+24*E)*L-N/(5040*(B*b*b))*(61+662*F+1320*E+720*(E*F))*(L*S),k=new n((g=g-A/(2*M*b)*S+A/(24*M*D)*(5+3*F+w-9*F*w)*x-A/(720*M*B)*(61+90*F+45*E)*(x*S)).toDegrees(),T.toDegrees(),n.datum.OSGB36);return e!=n.datum.OSGB36&&(k=k.convertDatum(e)),k},a.parse=function(t){var e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new a(e[1],e[2]);if(!(e=t.match(/^[A-Z]{2}\s*[0-9]+\s*[0-9]+$/i)))throw new Error("Invalid grid reference");var r=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),n=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);r>7&&r--,n>7&&n--;var o=(r-2)%5*5+n%5,i=19-5*Math.floor(r/5)-Math.floor(n/5),u=t.slice(2).trim().split(/\s+/);if(1==u.length&&(u=[u[0].slice(0,u[0].length/2),u[0].slice(u[0].length/2)]),o<0||o>6||i<0||i>12)throw new Error("Invalid grid reference");if(2!=u.length)throw new Error("Invalid grid reference");if(u[0].length!=u[1].length)throw new Error("Invalid grid reference");return u[0]=(u[0]+"00000").slice(0,5),u[1]=(u[1]+"00000").slice(0,5),new a(o+u[0],i+u[1])},a.prototype.toString=function(t){if(t=void 0===t?10:Number(t),isNaN(t)||t%2!=0||t>16)throw new RangeError("Invalid precision ‘"+t+"’");var e=this.easting,r=this.northing;if(isNaN(e)||isNaN(r))throw new Error("Invalid grid reference");if(0==t){var n=Math.floor(e),a=e-n,o=Math.floor(r),i=r-o;return("000000"+n).slice(-6)+(a>0?a.toFixed(3).slice(1):"")+","+((o<1e6?("000000"+o).slice(-6):o)+(i>0?i.toFixed(3).slice(1):""))}var u=Math.floor(e/1e5),s=Math.floor(r/1e5);if(u<0||u>6||s<0||s>12)return"";var c=19-s-(19-s)%5+Math.floor((u+10)/5),l=5*(19-s)%25+u%5;c>7&&c++,l>7&&l++;var h=String.fromCharCode(c+"A".charCodeAt(0),l+"A".charCodeAt(0));return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),r=Math.floor(r%1e5/Math.pow(10,5-t/2)),h+" "+(e=("00000000"+e).slice(-t/2))+" "+(r=("00000000"+r).slice(-t/2))},t.exports&&(t.exports=a)},14:function(t,e,r){var n,a;!function(o,i){"use strict";void 0===(a="function"==typeof(n=function(){var t=function(){},e="undefined",r=["trace","debug","info","warn","error"];function n(t,e){var r=t[e];if("function"==typeof r.bind)return r.bind(t);try{return Function.prototype.bind.call(r,t)}catch(e){return function(){return Function.prototype.apply.apply(r,[t,arguments])}}}function a(e,n){for(var a=0;a<r.length;a++){var o=r[a];this[o]=a<e?t:this.methodFactory(o,e,n)}this.log=this.debug}function o(r,o,i){return function(r){"debug"===r&&(r="log");return typeof console!==e&&(void 0!==console[r]?n(console,r):void 0!==console.log?n(console,"log"):t)}(r)||function(t,r,n){return function(){typeof console!==e&&(a.call(this,r,n),this[t].apply(this,arguments))}}.apply(this,arguments)}function i(t,n,i){var u,s=this,c="loglevel";function l(){var t;if(typeof window!==e){try{t=window.localStorage[c]}catch(t){}if(typeof t===e)try{var r=window.document.cookie,n=r.indexOf(encodeURIComponent(c)+"=");-1!==n&&(t=/^([^;]+)/.exec(r.slice(n))[1])}catch(t){}return void 0===s.levels[t]&&(t=void 0),t}}t&&(c+=":"+t),s.name=t,s.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},s.methodFactory=i||o,s.getLevel=function(){return u},s.setLevel=function(n,o){if("string"==typeof n&&void 0!==s.levels[n.toUpperCase()]&&(n=s.levels[n.toUpperCase()]),!("number"==typeof n&&n>=0&&n<=s.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(u=n,!1!==o&&function(t){var n=(r[t]||"silent").toUpperCase();if(typeof window===e)return;try{return void(window.localStorage[c]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(c)+"="+n+";"}catch(t){}}(n),a.call(s,n,t),typeof console===e&&n<s.levels.SILENT)return"No console available for logging"},s.setDefaultLevel=function(t){l()||s.setLevel(t,!1)},s.enableAll=function(t){s.setLevel(s.levels.TRACE,t)},s.disableAll=function(t){s.setLevel(s.levels.SILENT,t)};var h=l();null==h&&(h=null==n?"WARN":n),s.setLevel(h,!1)}var u=new i,s={};u.getLogger=function(t){if("string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=s[t];return e||(e=s[t]=new i(t,u.getLevel(),u.methodFactory)),e};var c=typeof window!==e?window.log:void 0;return u.noConflict=function(){return typeof window!==e&&window.log===u&&(window.log=c),u},u.getLoggers=function(){return s},u})?n.call(e,r,e,t):n)||(t.exports=a)}()},15:function(t,e,r){!function(t){var e,r,n,a=String.fromCharCode;function o(t){for(var e,r,n=[],a=0,o=t.length;a<o;)(e=t.charCodeAt(a++))>=55296&&e<=56319&&a<o?56320==(64512&(r=t.charCodeAt(a++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),a--):n.push(e);return n}function i(t){if(t>=55296&&t<=57343)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value")}function u(t,e){return a(t>>e&63|128)}function s(t){if(0==(4294967168&t))return a(t);var e="";return 0==(4294965248&t)?e=a(t>>6&31|192):0==(4294901760&t)?(i(t),e=a(t>>12&15|224),e+=u(t,6)):0==(4292870144&t)&&(e=a(t>>18&7|240),e+=u(t,12),e+=u(t,6)),e+=a(63&t|128)}function c(){if(n>=r)throw Error("Invalid byte index");var t=255&e[n];if(n++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function l(){var t,a;if(n>r)throw Error("Invalid byte index");if(n==r)return!1;if(t=255&e[n],n++,0==(128&t))return t;if(192==(224&t)){if((a=(31&t)<<6|c())>=128)return a;throw Error("Invalid continuation byte")}if(224==(240&t)){if((a=(15&t)<<12|c()<<6|c())>=2048)return i(a),a;throw Error("Invalid continuation byte")}if(240==(248&t)&&(a=(7&t)<<18|c()<<12|c()<<6|c())>=65536&&a<=1114111)return a;throw Error("Invalid UTF-8 detected")}t.version="3.0.0",t.encode=function(t){for(var e=o(t),r=e.length,n=-1,a="";++n<r;)a+=s(e[n]);return a},t.decode=function(t){e=o(t),r=e.length,n=0;for(var i,u=[];!1!==(i=l());)u.push(i);return function(t){for(var e,r=t.length,n=-1,o="";++n<r;)(e=t[n])>65535&&(o+=a((e-=65536)>>>10&1023|55296),e=56320|1023&e),o+=a(e);return o}(u)}}(e)},1510:function(t,e,r){"use strict";r.r(e);var n=r(1),a=r(630),o=r.n(a),i=r(105),u=r.n(i),s=r(3);function c(t,e){return function(t){if(Array.isArray(t))return t}
|
||
/**
|
||
* Co-ordinate conversion resources.
|
||
*
|
||
* @author j433866 [j433866@gmail.com]
|
||
* @copyright Crown Copyright 2019
|
||
* @license Apache-2.0
|
||
*/(t)||function(t,e){var r=[],n=!0,a=!1,o=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){a=!0,o=t}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var l=["Degrees Minutes Seconds","Degrees Decimal Minutes","Decimal Degrees","Geohash","Military Grid Reference System","Ordnance Survey National Grid","Universal Transverse Mercator"],h=["Geohash","Military Grid Reference System","Ordnance Survey National Grid","Universal Transverse Mercator"];function f(t,e,r,n,a,i,l){var f,M,w,A,F,E,N,D,B,C,S,R=!1;if(l<0&&(l=0),"Auto"===r){if(null===(r=function(t){t=t.trim();var e=[",",";",":"],r=t.match(/[NnEeSsWw]/g);if(null!==r&&r.length>0&&r.length<3){var n=t.split(/[NnEeSsWw]/);if(n.length<=3&&n.length>0){if(""===n[0])return"Direction Preceding";if(""===n[n.length-1])return"Direction Following"}}for(var a=0;a<e.length;a++){var o=e[a];if(t.includes(o)){var i=t.split(o);if(i.length<=3&&i.length>0)return o}}return null}(t)))throw new s.a("Unable to detect the input delimiter automatically.")}else r.includes("Direction")||(r=b(r));if("Auto"===e&&null===(e=function(t,e){var r,n=new RegExp(/^[0-9]{2}\s?[C-HJ-NP-X]{1}\s?[A-HJ-NP-Z][A-HJ-NP-V]\s?[0-9\s]+/),a=new RegExp(/^[A-HJ-Z]{2}\s+[0-9\s]+$/),o=new RegExp(/^[0123456789BCDEFGHJKMNPQRSTUVWXYZ]+$/),i=new RegExp(/^[0-9]{2}\s?[C-HJ-NP-X]\s[0-9.]+\s?[0-9.]+$/),u=new RegExp(/[°'"]/g);if(t=t.trim(),null!==e&&e.includes("Direction")){var s=t.split(/[NnEeSsWw]/);s.length>1&&(r=""===s[0]?s[1]:s[0])}else if(null!==e&&""!==e)if(t.includes(e)){var c=t.split(e);c.length>1&&(r=""===c[0]?c[1]:c[0])}else r=t;if(!u.test(t)){var l=t.toUpperCase().replace(e,"");if(i.test(l))return"Universal Transverse Mercator";if(n.test(l))return"Military Grid Reference System";if(a.test(l))return"Ordnance Survey National Grid";if(o.test(l))return"Geohash"}if(void 0!==r){var h=p(r);switch(h.length){case 3:return"Degrees Minutes Seconds";case 2:return"Degrees Decimal Minutes";case 1:return"Decimal Degrees"}}return null}(t,r)))throw new s.a("Unable to detect the input format automatically.");if(a=b(a),h.includes(e))t=t.replace(r,""),R=!0;else{r.includes("Direction")?""===(f=t.split(/[NnEeSsWw]/g))[0]&&(f=f.slice(1)):f=t.split(r);for(var x=0;x<f.length;x++)f[x]=f[x].replace(/[°˝´'"]/g," ");f.length>1&&(R=!0)}switch(e){case"Geohash":E=o.a.decode(t.replace(/[^A-Za-z0-9]/g,"")),M=new u.a.LatLonEllipsoidal(E.latitude,E.longitude);break;case"Military Grid Reference System":M=u.a.Mgrs.parse(t.replace(/[^A-Za-z0-9]/g,"")).toUtm().toLatLonE();break;case"Ordnance Survey National Grid":N=u.a.OsGridRef.parse(t.replace(/[^A-Za-z0-9]/g,"")),M=u.a.OsGridRef.osGridToLatLon(N);break;case"Universal Transverse Mercator":/^[\d]{2}[A-Za-z]/.test(t)&&(t=t.slice(0,2)+" "+t.slice(2)),M=u.a.Utm.parse(t).toLatLonE();break;case"Degrees Minutes Seconds":if(R){if(D=p(f[0]),B=p(f[1]),!(D.length>=3&&B.length>=3))throw new s.a("Invalid co-ordinate format for Degrees Minutes Seconds");C=d(D[0],D[1],D[2],10),S=d(B[0],B[1],B[2],10),M=new u.a.LatLonEllipsoidal(C.degrees,S.degrees)}else{if(!((D=p(f[0])).length>=3))throw new s.a("Invalid co-ordinate format for Degrees Minutes Seconds");C=d(D[0],D[1],D[2]),M=new u.a.LatLonEllipsoidal(C.degrees,C.degrees)}break;case"Degrees Decimal Minutes":if(R){if(D=p(f[0]),B=p(f[1]),2!==D.length||2!==B.length)throw new s.a("Invalid co-ordinate format for Degrees Decimal Minutes.");C=g(D[0],D[1],10),S=g(B[0],B[1],10),M=new u.a.LatLonEllipsoidal(C.degrees,S.degrees)}else{if(2!==(D=p(t)).length)throw new s.a("Invalid co-ordinate format for Degrees Decimal Minutes.");C=g(D[0],D[1],10),M=new u.a.LatLonEllipsoidal(C.degrees,C.degrees)}break;case"Decimal Degrees":if(R){if(D=p(f[0]),B=p(f[1]),1!==D.length||1!==B.length)throw new s.a("Invalid co-ordinate format for Decimal Degrees.");M=new u.a.LatLonEllipsoidal(D[0],B[0])}else{if(1!==(D=p(f[0])).length)throw new s.a("Invalid co-ordinate format for Decimal Degrees.");M=new u.a.LatLonEllipsoidal(D[0],D[0])}break;default:throw new s.a("Unknown input format '".concat(e,"'"))}if(e.includes("Degrees")){var L=t.toUpperCase().match(/[NESW]/g);L&&L.length>=1&&(("S"===L[0]||"W"===L[0]&&M.lat>0)&&(M.lat=-M.lat),L.length>=2&&("S"===L[1]||"W"===L[1]&&M.lon>0)&&(M.lon=-M.lon))}var T=c(function(t,e){var r=t.toUpperCase(),n=new RegExp(/[NESW]/g),a=r.match(n);if(a&&a.length<=2&&a.length>=1)return 2===a.length?[a[0],a[1]]:[a[0],""];var o,i=r,u="",s="";if(e.includes("Direction")){var c=r.split(n);c.length>1&&(i=""===c[0]?c[1]:c[0],c.length>2&&""!==c[2]&&(o=c[2]))}else if(r.includes(e)){var l=r.split(e);l.length>=1&&(""!==l[0]&&(i=l[0]),l.length>=2&&""!==l[1]&&(o=l[1]))}i&&(i=parseFloat(i),u=i<0?"S":"N");o&&(o=parseFloat(o),s=o<0?"W":"E");return[u,s]}(M.lat+","+M.lon,","),2),k=T[0],O=T[1];switch(n){case"Decimal Degrees":C=v(M.lat,l),S=v(M.lon,l),w=C.string,A=S.string;break;case"Degrees Decimal Minutes":C=m(M.lat,l),S=m(M.lon,l),w=C.string,A=S.string;break;case"Degrees Minutes Seconds":C=y(M.lat,l),S=y(M.lon,l),w=C.string,A=S.string;break;case"Geohash":w=o.a.encode(M.lat,M.lon,l);break;case"Military Grid Reference System":l%2!=0&&(l+=1),l>10&&(l=10),w=M.toUtm().toMgrs().toString(l);break;case"Ordnance Survey National Grid":if(""===(N=u.a.OsGridRef.latLonToOsGrid(M)).toString())throw new s.a("Could not convert co-ordinates to OS National Grid. Are the co-ordinates in range?");l%2!=0&&(l+=1),l>10&&(l=10),w=N.toString(l);break;case"Universal Transverse Mercator":w=M.toUtm().toString(l)}if(void 0===w)throw new s.a("Error converting co-ordinates.");if(n.includes("Degrees")){"S"===k&&"None"!==i&&(w=w.replace("-","")),"W"===O&&"None"!==i&&(A=A.replace("-",""));var I="";"Before"===i&&(I+=k+" "),I+=w,"After"===i&&(I+=" "+k),I+=a,R&&("Before"===i&&(I+=O+" "),I+=A,"After"===i&&(I+=" "+O),I+=a),F=I}else F=w+a;return F}function p(t){var e=[];return t.split(/\s+/).forEach(function(t){(t=t.replace(/[^0-9.-]/g,"")).length>0&&e.push(parseFloat(t))}),e}function d(t,e,r,n){var a=Math.abs(t)+e/60+r/3600,o=w(a,n)+"°";return(M(t)||t<0)&&(a=-a,o="-"+o),{degrees:a,string:o}}function g(t,e,r){var n=Math.abs(t)+e/60,a=w(n,r)+"°";return(M(t)||t<0)&&(n=-n,a="-"+a),{degrees:n,string:a}}function v(t,e){return{degrees:t,string:w(t,e)+"°"}}function y(t,e){var r=Math.abs(t),n=Math.floor(r),a=Math.floor(60*(r-n)),o=w(3600*(r-n)-60*a,e),i=n+"° "+a+"' "+o+'"';return(M(t)||t<0)&&(n=-n,i="-"+i),{degrees:n,minutes:a,seconds:o,string:i}}function m(t,e){var r=Math.abs(t),n=Math.floor(r),a=w(60*(r-n),e),o=n+"° "+a+"'";return(t<0||M(t))&&(n=-n,o="-"+o),{degrees:n,minutes:a,string:o}}function b(t){return{Auto:"Auto",Space:" ","\\n":"\n",Comma:",","Semi-colon":";",Colon:":"}[t]}function M(t){return 0===t&&1/t<0}function w(t,e){return e=Math.pow(10,e),Math.round(t*e)/e}function A(t){return(A="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)}function F(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=[],n=!0,a=!1,o=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){a=!0,o=t}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function E(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function N(t,e){return!e||"object"!==A(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function D(t){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function B(t,e){return(B=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}
|
||
/**
|
||
* @author j433866 [j433866@gmail.com]
|
||
* @copyright Crown Copyright 2019
|
||
* @license Apache-2.0
|
||
*/var C=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=N(this,D(e).call(this))).name="Convert co-ordinate format",t.module="Hashing",t.description="Converts geographical coordinates between different formats.<br><br>Supported formats:<ul><li>Degrees Minutes Seconds (DMS)</li><li>Degrees Decimal Minutes (DDM)</li><li>Decimal Degrees (DD)</li><li>Geohash</li><li>Military Grid Reference System (MGRS)</li><li>Ordnance Survey National Grid (OSNG)</li><li>Universal Transverse Mercator (UTM)</li></ul><br>The operation can try to detect the input co-ordinate format and delimiter automatically, but this may not always work correctly.",t.infoURL="https://wikipedia.org/wiki/Geographic_coordinate_conversion",t.inputType="string",t.outputType="string",t.args=[{name:"Input Format",type:"option",value:["Auto"].concat(l)},{name:"Input Delimiter",type:"option",value:["Auto","Direction Preceding","Direction Following","\\n","Comma","Semi-colon","Colon"]},{name:"Output Format",type:"option",value:l},{name:"Output Delimiter",type:"option",value:["Space","\\n","Comma","Semi-colon","Colon"]},{name:"Include Compass Directions",type:"option",value:["None","Before","After"]},{name:"Precision",type:"number",value:3}],t}var r,a,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&B(t,e)}(e,n["a"]),r=e,(a=[{key:"run",value:function(t,e){if(""!==t.replace(/[\s+]/g,"")){var r=F(e,6);return f(t,r[0],r[1],r[2],r[3],r[4],r[5])}return t}}])&&E(r.prototype,a),o&&E(r,o),e}(),S="undefined"==typeof self?{}:self.OpModules||{};S.Hashing={"Convert co-ordinate format":C};e.default=S},18:function(t,e,r){"use strict";r.d(e,"b",function(){return a}),r.d(e,"a",function(){return o});var n=r(0);
|
||
/**
|
||
* Binary functions.
|
||
*
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8;if(!t)return"";e=n.a.charRep(e);for(var a="",o=0;o<t.length;o++)a+=t[o].toString(2).padStart(r,"0")+e;return e.length?a.slice(0,-e.length):a}function o(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,a=n.a.regexRep(e);t=t.replace(a,"");for(var o=[],i=0;i<t.length;i+=r)o.push(parseInt(t.substr(i,r),2));return o}},19:function(t,e,r){"use strict";r.d(e,"a",function(){return a});var n=r(0);
|
||
/**
|
||
* Decimal functions.
|
||
*
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2018
|
||
* @license Apache-2.0
|
||
*/function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto";e=n.a.charRep(e);var r=[],a=t.split(e);""===a[a.length-1]&&(a=a.slice(0,a.length-1));for(var o=0;o<a.length;o++)r[o]=parseInt(a[o],10);return r}},3:function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}
|
||
/**
|
||
* 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 s=function(t){function e(){var t,r,o,u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var s=arguments.length,c=new Array(s),l=0;l<s;l++)c[l]=arguments[l];return o=this,(r=!(u=(t=a(e)).call.apply(t,[this].concat(c)))||"object"!==n(u)&&"function"!=typeof u?i(o):u).type="OperationError",Error.captureStackTrace&&Error.captureStackTrace(i(i(r)),e),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}(e,u(Error)),e}();e.a=s},4:function(t,e,r){var n;!function(a){"use strict";var o,i=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,u=Math.ceil,s=Math.floor,c="[BigNumber Error] ",l=c+"Number primitive has more than 15 significant digits: ",h=1e14,f=14,p=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,v=1e9;function y(t){var e=0|t;return t>0||t===e?e:e-1}function m(t){for(var e,r,n=1,a=t.length,o=t[0]+"";n<a;){for(e=t[n++]+"",r=f-e.length;r--;e="0"+e);o+=e}for(a=o.length;48===o.charCodeAt(--a););return o.slice(0,a+1||1)}function b(t,e){var r,n,a=t.c,o=e.c,i=t.s,u=e.s,s=t.e,c=e.e;if(!i||!u)return null;if(r=a&&!a[0],n=o&&!o[0],r||n)return r?n?0:-u:i;if(i!=u)return i;if(r=i<0,n=s==c,!a||!o)return n?0:!a^r?1:-1;if(!n)return s>c^r?1:-1;for(u=(s=a.length)<(c=o.length)?s:c,i=0;i<u;i++)if(a[i]!=o[i])return a[i]>o[i]^r?1:-1;return s==c?0:s>c^r?1:-1}function M(t,e,r,n){if(t<e||t>r||t!==(t<0?u(t):s(t)))throw Error(c+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function w(t){var e=t.c.length-1;return y(t.e/f)==e&&t.c[e]%2!=0}function A(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function F(t,e,r){var n,a;if(e<0){for(a=r+".";++e;a+=r);t=a+t}else if(++e>(n=t.length)){for(a=r,e-=n;--e;a+=r);t+=a}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}(o=function t(e){var r,n,a,o,E,N,D,B,C,S=z.prototype={constructor:z,toString:null,valueOf:null},R=new z(1),x=20,L=4,T=-7,k=21,O=-1e7,I=1e7,_=!1,P=1,U=0,j={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},G="0123456789abcdefghijklmnopqrstuvwxyz";function z(t,e){var r,o,u,c,h,d,g,v,y=this;if(!(y instanceof z))return new z(t,e);if(null==e){if(t instanceof z)return y.s=t.s,y.e=t.e,void(y.c=(t=t.c)?t.slice():t);if((d="number"==typeof t)&&0*t==0){if(y.s=1/t<0?(t=-t,-1):1,t===~~t){for(c=0,h=t;h>=10;h/=10,c++);return y.e=c,void(y.c=[t])}v=String(t)}else{if(v=String(t),!i.test(v))return a(y,v,d);y.s=45==v.charCodeAt(0)?(v=v.slice(1),-1):1}(c=v.indexOf("."))>-1&&(v=v.replace(".","")),(h=v.search(/e/i))>0?(c<0&&(c=h),c+=+v.slice(h+1),v=v.substring(0,h)):c<0&&(c=v.length)}else{if(M(e,2,G.length,"Base"),v=String(t),10==e)return H(y=new z(t instanceof z?t:v),x+y.e+1,L);if(d="number"==typeof t){if(0*t!=0)return a(y,v,d,e);if(y.s=1/t<0?(v=v.slice(1),-1):1,z.DEBUG&&v.replace(/^0\.0*|\./,"").length>15)throw Error(l+t);d=!1}else y.s=45===v.charCodeAt(0)?(v=v.slice(1),-1):1;for(r=G.slice(0,e),c=h=0,g=v.length;h<g;h++)if(r.indexOf(o=v.charAt(h))<0){if("."==o){if(h>c){c=g;continue}}else if(!u&&(v==v.toUpperCase()&&(v=v.toLowerCase())||v==v.toLowerCase()&&(v=v.toUpperCase()))){u=!0,h=-1,c=0;continue}return a(y,String(t),d,e)}(c=(v=n(v,e,10,y.s)).indexOf("."))>-1?v=v.replace(".",""):c=v.length}for(h=0;48===v.charCodeAt(h);h++);for(g=v.length;48===v.charCodeAt(--g););if(v=v.slice(h,++g)){if(g-=h,d&&z.DEBUG&&g>15&&(t>p||t!==s(t)))throw Error(l+y.s*t);if((c=c-h-1)>I)y.c=y.e=null;else if(c<O)y.c=[y.e=0];else{if(y.e=c,y.c=[],h=(c+1)%f,c<0&&(h+=f),h<g){for(h&&y.c.push(+v.slice(0,h)),g-=f;h<g;)y.c.push(+v.slice(h,h+=f));v=v.slice(h),h=f-v.length}else h-=g;for(;h--;v+="0");y.c.push(+v)}}else y.c=[y.e=0]}function V(t,e,r,n){var a,o,i,u,s;if(null==r?r=L:M(r,0,8),!t.c)return t.toString();if(a=t.c[0],i=t.e,null==e)s=m(t.c),s=1==n||2==n&&(i<=T||i>=k)?A(s,i):F(s,i,"0");else if(o=(t=H(new z(t),e,r)).e,u=(s=m(t.c)).length,1==n||2==n&&(e<=o||o<=T)){for(;u<e;s+="0",u++);s=A(s,o)}else if(e-=i,s=F(s,o,"0"),o+1>u){if(--e>0)for(s+=".";e--;s+="0");}else if((e+=o-u)>0)for(o+1==u&&(s+=".");e--;s+="0");return t.s<0&&a?"-"+s:s}function q(t,e){for(var r,n=1,a=new z(t[0]);n<t.length;n++){if(!(r=new z(t[n])).s){a=r;break}e.call(a,r)&&(a=r)}return a}function W(t,e,r){for(var n=1,a=e.length;!e[--a];e.pop());for(a=e[0];a>=10;a/=10,n++);return(r=n+r*f-1)>I?t.c=t.e=null:r<O?t.c=[t.e=0]:(t.e=r,t.c=e),t}function H(t,e,r,n){var a,o,i,c,l,p,g,v=t.c,y=d;if(v){t:{for(a=1,c=v[0];c>=10;c/=10,a++);if((o=e-a)<0)o+=f,i=e,g=(l=v[p=0])/y[a-i-1]%10|0;else if((p=u((o+1)/f))>=v.length){if(!n)break t;for(;v.length<=p;v.push(0));l=g=0,a=1,i=(o%=f)-f+1}else{for(l=c=v[p],a=1;c>=10;c/=10,a++);g=(i=(o%=f)-f+a)<0?0:l/y[a-i-1]%10|0}if(n=n||e<0||null!=v[p+1]||(i<0?l:l%y[a-i-1]),n=r<4?(g||n)&&(0==r||r==(t.s<0?3:2)):g>5||5==g&&(4==r||n||6==r&&(o>0?i>0?l/y[a-i]:0:v[p-1])%10&1||r==(t.s<0?8:7)),e<1||!v[0])return v.length=0,n?(e-=t.e+1,v[0]=y[(f-e%f)%f],t.e=-e||0):v[0]=t.e=0,t;if(0==o?(v.length=p,c=1,p--):(v.length=p+1,c=y[f-o],v[p]=i>0?s(l/y[a-i]%y[i])*c:0),n)for(;;){if(0==p){for(o=1,i=v[0];i>=10;i/=10,o++);for(i=v[0]+=c,c=1;i>=10;i/=10,c++);o!=c&&(t.e++,v[0]==h&&(v[0]=1));break}if(v[p]+=c,v[p]!=h)break;v[p--]=0,c=1}for(o=v.length;0===v[--o];v.pop());}t.e>I?t.c=t.e=null:t.e<O&&(t.c=[t.e=0])}return t}function Z(t){var e,r=t.e;return null===r?t.toString():(e=m(t.c),e=r<=T||r>=k?A(e,r):F(e,r,"0"),t.s<0?"-"+e:e)}return z.clone=t,z.ROUND_UP=0,z.ROUND_DOWN=1,z.ROUND_CEIL=2,z.ROUND_FLOOR=3,z.ROUND_HALF_UP=4,z.ROUND_HALF_DOWN=5,z.ROUND_HALF_EVEN=6,z.ROUND_HALF_CEIL=7,z.ROUND_HALF_FLOOR=8,z.EUCLID=9,z.config=z.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(c+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(M(r=t[e],0,v,e),x=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(M(r=t[e],0,8,e),L=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(M(r[0],-v,0,e),M(r[1],0,v,e),T=r[0],k=r[1]):(M(r,-v,v,e),T=-(k=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)M(r[0],-v,-1,e),M(r[1],1,v,e),O=r[0],I=r[1];else{if(M(r,-v,v,e),!r)throw Error(c+e+" cannot be zero: "+r);O=-(I=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(c+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw _=!r,Error(c+"crypto unavailable");_=r}else _=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(M(r=t[e],0,9,e),P=r),t.hasOwnProperty(e="POW_PRECISION")&&(M(r=t[e],0,v,e),U=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(c+e+" not an object: "+r);j=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(c+e+" invalid: "+r);G=r}}return{DECIMAL_PLACES:x,ROUNDING_MODE:L,EXPONENTIAL_AT:[T,k],RANGE:[O,I],CRYPTO:_,MODULO_MODE:P,POW_PRECISION:U,FORMAT:j,ALPHABET:G}},z.isBigNumber=function(t){return t instanceof z||t&&!0===t._isBigNumber||!1},z.maximum=z.max=function(){return q(arguments,S.lt)},z.minimum=z.min=function(){return q(arguments,S.gt)},z.random=(o=9007199254740992*Math.random()&2097151?function(){return s(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,a,i,l=0,h=[],p=new z(R);if(null==t?t=x:M(t,0,v),a=u(t/f),_)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(a*=2));l<a;)(i=131072*e[l]+(e[l+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[l]=r[0],e[l+1]=r[1]):(h.push(i%1e14),l+=2);l=a/2}else{if(!crypto.randomBytes)throw _=!1,Error(c+"crypto unavailable");for(e=crypto.randomBytes(a*=7);l<a;)(i=281474976710656*(31&e[l])+1099511627776*e[l+1]+4294967296*e[l+2]+16777216*e[l+3]+(e[l+4]<<16)+(e[l+5]<<8)+e[l+6])>=9e15?crypto.randomBytes(7).copy(e,l):(h.push(i%1e14),l+=7);l=a/7}if(!_)for(;l<a;)(i=o())<9e15&&(h[l++]=i%1e14);for(a=h[--l],t%=f,a&&t&&(i=d[f-t],h[l]=s(a/i)*i);0===h[l];h.pop(),l--);if(l<0)h=[n=0];else{for(n=-1;0===h[0];h.splice(0,1),n-=f);for(l=1,i=h[0];i>=10;i/=10,l++);l<f&&(n-=f-l)}return p.e=n,p.c=h,p}),z.sum=function(){for(var t=1,e=arguments,r=new z(e[0]);t<e.length;)r=r.plus(e[t++]);return r},n=function(){function t(t,e,r,n){for(var a,o,i=[0],u=0,s=t.length;u<s;){for(o=i.length;o--;i[o]*=e);for(i[0]+=n.indexOf(t.charAt(u++)),a=0;a<i.length;a++)i[a]>r-1&&(null==i[a+1]&&(i[a+1]=0),i[a+1]+=i[a]/r|0,i[a]%=r)}return i.reverse()}return function(e,n,a,o,i){var u,s,c,l,h,f,p,d,g=e.indexOf("."),v=x,y=L;for(g>=0&&(l=U,U=0,e=e.replace(".",""),f=(d=new z(n)).pow(e.length-g),U=l,d.c=t(F(m(f.c),f.e,"0"),10,a,"0123456789"),d.e=d.c.length),c=l=(p=t(e,n,a,i?(u=G,"0123456789"):(u="0123456789",G))).length;0==p[--l];p.pop());if(!p[0])return u.charAt(0);if(g<0?--c:(f.c=p,f.e=c,f.s=o,p=(f=r(f,d,v,y,a)).c,h=f.r,c=f.e),g=p[s=c+v+1],l=a/2,h=h||s<0||null!=p[s+1],h=y<4?(null!=g||h)&&(0==y||y==(f.s<0?3:2)):g>l||g==l&&(4==y||h||6==y&&1&p[s-1]||y==(f.s<0?8:7)),s<1||!p[0])e=h?F(u.charAt(1),-v,u.charAt(0)):u.charAt(0);else{if(p.length=s,h)for(--a;++p[--s]>a;)p[s]=0,s||(++c,p=[1].concat(p));for(l=p.length;!p[--l];);for(g=0,e="";g<=l;e+=u.charAt(p[g++]));e=F(e,c,u.charAt(0))}return e}}(),r=function(){function t(t,e,r){var n,a,o,i,u=0,s=t.length,c=e%g,l=e/g|0;for(t=t.slice();s--;)u=((a=c*(o=t[s]%g)+(n=l*o+(i=t[s]/g|0)*c)%g*g+u)/r|0)+(n/g|0)+l*i,t[s]=a%r;return u&&(t=[u].concat(t)),t}function e(t,e,r,n){var a,o;if(r!=n)o=r>n?1:-1;else for(a=o=0;a<r;a++)if(t[a]!=e[a]){o=t[a]>e[a]?1:-1;break}return o}function r(t,e,r,n){for(var a=0;r--;)t[r]-=a,a=t[r]<e[r]?1:0,t[r]=a*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,a,o,i,u){var c,l,p,d,g,v,m,b,M,w,A,F,E,N,D,B,C,S=n.s==a.s?1:-1,R=n.c,x=a.c;if(!(R&&R[0]&&x&&x[0]))return new z(n.s&&a.s&&(R?!x||R[0]!=x[0]:x)?R&&0==R[0]||!x?0*S:S/0:NaN);for(M=(b=new z(S)).c=[],S=o+(l=n.e-a.e)+1,u||(u=h,l=y(n.e/f)-y(a.e/f),S=S/f|0),p=0;x[p]==(R[p]||0);p++);if(x[p]>(R[p]||0)&&l--,S<0)M.push(1),d=!0;else{for(N=R.length,B=x.length,p=0,S+=2,(g=s(u/(x[0]+1)))>1&&(x=t(x,g,u),R=t(R,g,u),B=x.length,N=R.length),E=B,A=(w=R.slice(0,B)).length;A<B;w[A++]=0);C=x.slice(),C=[0].concat(C),D=x[0],x[1]>=u/2&&D++;do{if(g=0,(c=e(x,w,B,A))<0){if(F=w[0],B!=A&&(F=F*u+(w[1]||0)),(g=s(F/D))>1)for(g>=u&&(g=u-1),m=(v=t(x,g,u)).length,A=w.length;1==e(v,w,m,A);)g--,r(v,B<m?C:x,m,u),m=v.length,c=1;else 0==g&&(c=g=1),m=(v=x.slice()).length;if(m<A&&(v=[0].concat(v)),r(w,v,A,u),A=w.length,-1==c)for(;e(x,w,B,A)<1;)g++,r(w,B<A?C:x,A,u),A=w.length}else 0===c&&(g++,w=[0]);M[p++]=g,w[0]?w[A++]=R[E]||0:(w=[R[E]],A=1)}while((E++<N||null!=w[0])&&S--);d=null!=w[0],M[0]||M.splice(0,1)}if(u==h){for(p=1,S=M[0];S>=10;S/=10,p++);H(b,o+(b.e=p+l*f-1)+1,i,d)}else b.e=l,b.r=+d;return b}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,N=/^([^.]+)\.$/,D=/^\.([^.]+)$/,B=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g,a=function(t,e,r,n){var a,o=r?e:e.replace(C,"");if(B.test(o))t.s=isNaN(o)?null:o<0?-1:1,t.c=t.e=null;else{if(!r&&(o=o.replace(E,function(t,e,r){return a="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=a?t:e}),n&&(a=n,o=o.replace(N,"$1").replace(D,"0.$1")),e!=o))return new z(o,a);if(z.DEBUG)throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+e);t.c=t.e=t.s=null}},S.absoluteValue=S.abs=function(){var t=new z(this);return t.s<0&&(t.s=1),t},S.comparedTo=function(t,e){return b(this,new z(t,e))},S.decimalPlaces=S.dp=function(t,e){var r,n,a,o=this;if(null!=t)return M(t,0,v),null==e?e=L:M(e,0,8),H(new z(o),t+o.e+1,e);if(!(r=o.c))return null;if(n=((a=r.length-1)-y(this.e/f))*f,a=r[a])for(;a%10==0;a/=10,n--);return n<0&&(n=0),n},S.dividedBy=S.div=function(t,e){return r(this,new z(t,e),x,L)},S.dividedToIntegerBy=S.idiv=function(t,e){return r(this,new z(t,e),0,1)},S.exponentiatedBy=S.pow=function(t,e){var r,n,a,o,i,l,h,p,d=this;if((t=new z(t)).c&&!t.isInteger())throw Error(c+"Exponent not an integer: "+Z(t));if(null!=e&&(e=new z(e)),i=t.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!t.c||!t.c[0])return p=new z(Math.pow(+Z(d),i?2-w(t):+Z(t))),e?p.mod(e):p;if(l=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new z(NaN);(n=!l&&d.isInteger()&&e.isInteger())&&(d=d.mod(e))}else{if(t.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||i&&d.c[1]>=24e7:d.c[0]<8e13||i&&d.c[0]<=9999975e7)))return o=d.s<0&&w(t)?-0:0,d.e>-1&&(o=1/o),new z(l?1/o:o);U&&(o=u(U/f+2))}for(i?(r=new z(.5),l&&(t.s=1),h=w(t)):h=(a=Math.abs(+Z(t)))%2,p=new z(R);;){if(h){if(!(p=p.times(d)).c)break;o?p.c.length>o&&(p.c.length=o):n&&(p=p.mod(e))}if(a){if(0===(a=s(a/2)))break;h=a%2}else if(H(t=t.times(r),t.e+1,1),t.e>14)h=w(t);else{if(0==(a=+Z(t)))break;h=a%2}d=d.times(d),o?d.c&&d.c.length>o&&(d.c.length=o):n&&(d=d.mod(e))}return n?p:(l&&(p=R.div(p)),e?p.mod(e):o?H(p,U,L,void 0):p)},S.integerValue=function(t){var e=new z(this);return null==t?t=L:M(t,0,8),H(e,e.e+1,t)},S.isEqualTo=S.eq=function(t,e){return 0===b(this,new z(t,e))},S.isFinite=function(){return!!this.c},S.isGreaterThan=S.gt=function(t,e){return b(this,new z(t,e))>0},S.isGreaterThanOrEqualTo=S.gte=function(t,e){return 1===(e=b(this,new z(t,e)))||0===e},S.isInteger=function(){return!!this.c&&y(this.e/f)>this.c.length-2},S.isLessThan=S.lt=function(t,e){return b(this,new z(t,e))<0},S.isLessThanOrEqualTo=S.lte=function(t,e){return-1===(e=b(this,new z(t,e)))||0===e},S.isNaN=function(){return!this.s},S.isNegative=function(){return this.s<0},S.isPositive=function(){return this.s>0},S.isZero=function(){return!!this.c&&0==this.c[0]},S.minus=function(t,e){var r,n,a,o,i=this,u=i.s;if(e=(t=new z(t,e)).s,!u||!e)return new z(NaN);if(u!=e)return t.s=-e,i.plus(t);var s=i.e/f,c=t.e/f,l=i.c,p=t.c;if(!s||!c){if(!l||!p)return l?(t.s=-e,t):new z(p?i:NaN);if(!l[0]||!p[0])return p[0]?(t.s=-e,t):new z(l[0]?i:3==L?-0:0)}if(s=y(s),c=y(c),l=l.slice(),u=s-c){for((o=u<0)?(u=-u,a=l):(c=s,a=p),a.reverse(),e=u;e--;a.push(0));a.reverse()}else for(n=(o=(u=l.length)<(e=p.length))?u:e,u=e=0;e<n;e++)if(l[e]!=p[e]){o=l[e]<p[e];break}if(o&&(a=l,l=p,p=a,t.s=-t.s),(e=(n=p.length)-(r=l.length))>0)for(;e--;l[r++]=0);for(e=h-1;n>u;){if(l[--n]<p[n]){for(r=n;r&&!l[--r];l[r]=e);--l[r],l[n]+=h}l[n]-=p[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?W(t,l,c):(t.s=3==L?-1:1,t.c=[t.e=0],t)},S.modulo=S.mod=function(t,e){var n,a,o=this;return t=new z(t,e),!o.c||!t.s||t.c&&!t.c[0]?new z(NaN):!t.c||o.c&&!o.c[0]?new z(o):(9==P?(a=t.s,t.s=1,n=r(o,t,0,3),t.s=a,n.s*=a):n=r(o,t,0,P),(t=o.minus(n.times(t))).c[0]||1!=P||(t.s=o.s),t)},S.multipliedBy=S.times=function(t,e){var r,n,a,o,i,u,s,c,l,p,d,v,m,b,M,w=this,A=w.c,F=(t=new z(t,e)).c;if(!(A&&F&&A[0]&&F[0]))return!w.s||!t.s||A&&!A[0]&&!F||F&&!F[0]&&!A?t.c=t.e=t.s=null:(t.s*=w.s,A&&F?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=y(w.e/f)+y(t.e/f),t.s*=w.s,(s=A.length)<(p=F.length)&&(m=A,A=F,F=m,a=s,s=p,p=a),a=s+p,m=[];a--;m.push(0));for(b=h,M=g,a=p;--a>=0;){for(r=0,d=F[a]%M,v=F[a]/M|0,o=a+(i=s);o>a;)r=((c=d*(c=A[--i]%M)+(u=v*c+(l=A[i]/M|0)*d)%M*M+m[o]+r)/b|0)+(u/M|0)+v*l,m[o--]=c%b;m[o]=r}return r?++n:m.splice(0,1),W(t,m,n)},S.negated=function(){var t=new z(this);return t.s=-t.s||null,t},S.plus=function(t,e){var r,n=this,a=n.s;if(e=(t=new z(t,e)).s,!a||!e)return new z(NaN);if(a!=e)return t.s=-e,n.minus(t);var o=n.e/f,i=t.e/f,u=n.c,s=t.c;if(!o||!i){if(!u||!s)return new z(a/0);if(!u[0]||!s[0])return s[0]?t:new z(u[0]?n:0*a)}if(o=y(o),i=y(i),u=u.slice(),a=o-i){for(a>0?(i=o,r=s):(a=-a,r=u),r.reverse();a--;r.push(0));r.reverse()}for((a=u.length)-(e=s.length)<0&&(r=s,s=u,u=r,e=a),a=0;e;)a=(u[--e]=u[e]+s[e]+a)/h|0,u[e]=h===u[e]?0:u[e]%h;return a&&(u=[a].concat(u),++i),W(t,u,i)},S.precision=S.sd=function(t,e){var r,n,a,o=this;if(null!=t&&t!==!!t)return M(t,1,v),null==e?e=L:M(e,0,8),H(new z(o),t,e);if(!(r=o.c))return null;if(n=(a=r.length-1)*f+1,a=r[a]){for(;a%10==0;a/=10,n--);for(a=r[0];a>=10;a/=10,n++);}return t&&o.e+1>n&&(n=o.e+1),n},S.shiftedBy=function(t){return M(t,-p,p),this.times("1e"+t)},S.squareRoot=S.sqrt=function(){var t,e,n,a,o,i=this,u=i.c,s=i.s,c=i.e,l=x+4,h=new z("0.5");if(1!==s||!u||!u[0])return new z(!s||s<0&&(!u||u[0])?NaN:u?i:1/0);if(0==(s=Math.sqrt(+Z(i)))||s==1/0?(((e=m(u)).length+c)%2==0&&(e+="0"),s=Math.sqrt(+e),c=y((c+1)/2)-(c<0||c%2),n=new z(e=s==1/0?"1e"+c:(e=s.toExponential()).slice(0,e.indexOf("e")+1)+c)):n=new z(s+""),n.c[0])for((s=(c=n.e)+l)<3&&(s=0);;)if(o=n,n=h.times(o.plus(r(i,o,l,1))),m(o.c).slice(0,s)===(e=m(n.c)).slice(0,s)){if(n.e<c&&--s,"9999"!=(e=e.slice(s-3,s+1))&&(a||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(H(n,n.e+x+2,1),t=!n.times(n).eq(i));break}if(!a&&(H(o,o.e+x+2,0),o.times(o).eq(i))){n=o;break}l+=4,s+=4,a=1}return H(n,n.e+x+1,L,t)},S.toExponential=function(t,e){return null!=t&&(M(t,0,v),t++),V(this,t,e,1)},S.toFixed=function(t,e){return null!=t&&(M(t,0,v),t=t+this.e+1),V(this,t,e)},S.toFormat=function(t,e,r){var n,a=this;if(null==r)null!=t&&e&&"object"==typeof e?(r=e,e=null):t&&"object"==typeof t?(r=t,t=e=null):r=j;else if("object"!=typeof r)throw Error(c+"Argument not an object: "+r);if(n=a.toFixed(t,e),a.c){var o,i=n.split("."),u=+r.groupSize,s=+r.secondaryGroupSize,l=r.groupSeparator||"",h=i[0],f=i[1],p=a.s<0,d=p?h.slice(1):h,g=d.length;if(s&&(o=u,u=s,s=o,g-=o),u>0&&g>0){for(o=g%u||u,h=d.substr(0,o);o<g;o+=u)h+=l+d.substr(o,u);s>0&&(h+=l+d.slice(o)),p&&(h="-"+h)}n=f?h+(r.decimalSeparator||"")+((s=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):h}return(r.prefix||"")+n+(r.suffix||"")},S.toFraction=function(t){var e,n,a,o,i,u,s,l,h,p,g,v,y=this,b=y.c;if(null!=t&&(!(s=new z(t)).isInteger()&&(s.c||1!==s.s)||s.lt(R)))throw Error(c+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+Z(s));if(!b)return new z(y);for(e=new z(R),h=n=new z(R),a=l=new z(R),v=m(b),i=e.e=v.length-y.e-1,e.c[0]=d[(u=i%f)<0?f+u:u],t=!t||s.comparedTo(e)>0?i>0?e:h:s,u=I,I=1/0,s=new z(v),l.c[0]=0;p=r(s,e,0,1),1!=(o=n.plus(p.times(a))).comparedTo(t);)n=a,a=o,h=l.plus(p.times(o=h)),l=o,e=s.minus(p.times(o=e)),s=o;return o=r(t.minus(n),a,0,1),l=l.plus(o.times(h)),n=n.plus(o.times(a)),l.s=h.s=y.s,g=r(h,a,i*=2,L).minus(y).abs().comparedTo(r(l,n,i,L).minus(y).abs())<1?[h,a]:[l,n],I=u,g},S.toNumber=function(){return+Z(this)},S.toPrecision=function(t,e){return null!=t&&M(t,1,v),V(this,t,e,2)},S.toString=function(t){var e,r=this,a=r.s,o=r.e;return null===o?a?(e="Infinity",a<0&&(e="-"+e)):e="NaN":(null==t?e=o<=T||o>=k?A(m(r.c),o):F(m(r.c),o,"0"):10===t?e=F(m((r=H(new z(r),x+o+1,L)).c),r.e,"0"):(M(t,2,G.length,"Base"),e=n(F(m(r.c),o,"0"),10,t,a,!0)),a<0&&r.c[0]&&(e="-"+e)),e},S.valueOf=S.toJSON=function(){return Z(this)},S._isBigNumber=!0,"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator&&(S[Symbol.toStringTag]="BigNumber",S[Symbol.for("nodejs.util.inspect.custom")]=S.valueOf),null!=e&&z.set(e),z}()).default=o.BigNumber=o,void 0===(n=function(){return o}.call(e,r,e,t))||(t.exports=n)}()},452:function(t,e,r){"use strict";if(t.exports)var n=r(586);if(t.exports)var a=r(501);function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);void 0===r&&(r=o.datum.WGS84),this.lat=Number(t),this.lon=Number(e),this.datum=r}o.ellipsoid={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},o.datum={ED50:{ellipsoid:o.ellipsoid.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},Irl1975:{ellipsoid:o.ellipsoid.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,-1.042,-.214,-.631]},NAD27:{ellipsoid:o.ellipsoid.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:o.ellipsoid.GRS80,transform:[1.004,-1.91,-.515,-.0015,.0267,34e-5,.011]},NTF:{ellipsoid:o.ellipsoid.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:o.ellipsoid.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:o.ellipsoid.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:o.ellipsoid.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:o.ellipsoid.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:o.ellipsoid.WGS84,transform:[0,0,0,0,0,0,0]}},o.prototype.convertDatum=function(t){var e=this,r=null;if(e.datum==o.datum.WGS84&&(r=t.transform),t==o.datum.WGS84){r=[];for(var n=0;n<7;n++)r[n]=-e.datum.transform[n]}return null==r&&(e=this.convertDatum(o.datum.WGS84),r=t.transform),e.toCartesian().applyTransform(r).toLatLonE(t)},o.prototype.toCartesian=function(){var t=this.lat.toRadians(),e=this.lon.toRadians(),r=this.datum.ellipsoid.a,a=this.datum.ellipsoid.f,o=Math.sin(t),i=Math.cos(t),u=Math.sin(e),s=Math.cos(e),c=2*a-a*a,l=r/Math.sqrt(1-c*o*o);return new n((l+0)*i*s,(l+0)*i*u,(l*(1-c)+0)*o)},n.prototype.toLatLonE=function(t){var e=this.x,r=this.y,n=this.z,a=t.ellipsoid.a,i=t.ellipsoid.b,u=t.ellipsoid.f,s=2*u-u*u,c=s/(1-s),l=Math.sqrt(e*e+r*r),h=i*n/(a*l)*(1+c*i/Math.sqrt(l*l+n*n)),f=h/Math.sqrt(1+h*h),p=f/h,d=isNaN(p)?0:Math.atan2(n+c*i*f*f*f,l-s*a*p*p*p),g=Math.atan2(r,e),v=Math.sin(d);Math.cos(d),Math.sqrt(1-s*v*v);return new o(d.toDegrees(),g.toDegrees(),t)},n.prototype.applyTransform=function(t){var e=this.x,r=this.y,a=this.z,o=t[0],i=t[1],u=t[2],s=t[3]/1e6+1,c=(t[4]/3600).toRadians(),l=(t[5]/3600).toRadians(),h=(t[6]/3600).toRadians();return new n(o+e*s-r*h+a*l,i+e*h+r*s-a*c,u-e*l+r*c+a*s)},o.prototype.toString=function(t,e){return a.toLat(this.lat,t,e)+", "+a.toLon(this.lon,t,e)},void 0===Number.prototype.toRadians&&(Number.prototype.toRadians=function(){return this*Math.PI/180}),void 0===Number.prototype.toDegrees&&(Number.prototype.toDegrees=function(){return 180*this/Math.PI}),t.exports&&(t.exports=o,t.exports.Vector3d=n)},501:function(t,e,r){"use strict";var n={parseDMS:function(t){if("number"==typeof t&&isFinite(t))return Number(t);var e,r=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==r[r.length-1]&&r.splice(r.length-1),""==r)return NaN;switch(r.length){case 3:e=r[0]/1+r[1]/60+r[2]/3600;break;case 2:e=r[0]/1+r[1]/60;break;case 1:e=r[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(e=-e),Number(e)},separator:"",toDMS:function(t,e,r){if(isNaN(t))return null;if(void 0===e&&(e="dms"),void 0===r)switch(e){case"d":case"deg":r=4;break;case"dm":case"deg+min":r=2;break;case"dms":case"deg+min+sec":r=0;break;default:e="dms",r=0}var a,o,i,u;switch(t=Math.abs(t),e){default:case"d":case"deg":(o=t.toFixed(r))<100&&(o="0"+o),o<10&&(o="0"+o),a=o+"°";break;case"dm":case"deg+min":o=Math.floor(t),60==(i=(60*t%60).toFixed(r))&&(i=0,o++),i<10&&(i="0"+i),a=(o=("000"+o).slice(-3))+"°"+n.separator+i+"′";break;case"dms":case"deg+min+sec":o=Math.floor(t),i=Math.floor(3600*t/60)%60,60==(u=(3600*t%60).toFixed(r))&&(u=(0).toFixed(r),i++),60==i&&(i=0,o++),o=("000"+o).slice(-3),i=("00"+i).slice(-2),u<10&&(u="0"+u),a=o+"°"+n.separator+i+"′"+n.separator+u+"″"}return a},toLat:function(t,e,r){var a=n.toDMS(t,e,r);return null===a?"–":a.slice(1)+n.separator+(t<0?"S":"N")},toLon:function(t,e,r){var a=n.toDMS(t,e,r);return null===a?"–":a+n.separator+(t<0?"W":"E")},toBrng:function(t,e,r){t=(Number(t)+360)%360;var a=n.toDMS(t,e,r);return null===a?"–":a.replace("360","0")},compassPoint:function(t,e){void 0===e&&(e=3),t=(t%360+360)%360;var r=4*Math.pow(2,e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*r/360)%r*16/r]}};t.exports&&(t.exports=n)},586:function(t,e,r){"use strict";function n(t,e,r){if(!(this instanceof n))return new n(t,e,r);this.x=Number(t),this.y=Number(e),this.z=Number(r)}n.prototype.plus=function(t){if(!(t instanceof n))throw new TypeError("v is not Vector3d object");return new n(this.x+t.x,this.y+t.y,this.z+t.z)},n.prototype.minus=function(t){if(!(t instanceof n))throw new TypeError("v is not Vector3d object");return new n(this.x-t.x,this.y-t.y,this.z-t.z)},n.prototype.times=function(t){return t=Number(t),new n(this.x*t,this.y*t,this.z*t)},n.prototype.dividedBy=function(t){return t=Number(t),new n(this.x/t,this.y/t,this.z/t)},n.prototype.dot=function(t){if(!(t instanceof n))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.cross=function(t){if(!(t instanceof n))throw new TypeError("v is not Vector3d object");return new n(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)},n.prototype.negate=function(){return new n(-this.x,-this.y,-this.z)},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.prototype.unit=function(){var t=this.length();return 1==t?this:0==t?this:new n(this.x/t,this.y/t,this.z/t)},n.prototype.angleTo=function(t,e){if(!(t instanceof n))throw new TypeError("v is not Vector3d object");if(!(e instanceof n||null==e))throw new TypeError("n is not Vector3d object");var r=null==e?1:Math.sign(this.cross(t).dot(e)),a=this.cross(t).length()*r,o=this.dot(t);return Math.atan2(a,o)},n.prototype.rotateAround=function(t,e){if(!(t instanceof n))throw new TypeError("axis is not Vector3d object");for(var r=this.unit(),a=[r.x,r.y,r.z],o=t.unit(),i=Math.sin(e),u=Math.cos(e),s=[[o.x*o.x*(1-u)+u,o.x*o.y*(1-u)-o.z*i,o.x*o.z*(1-u)+o.y*i],[o.y*o.x*(1-u)+o.z*i,o.y*o.y*(1-u)+u,o.y*o.z*(1-u)-o.x*i],[o.z*o.x*(1-u)-o.y*i,o.z*o.y*(1-u)+o.x*i,o.z*o.z*(1-u)+u]],c=[0,0,0],l=0;l<3;l++)for(var h=0;h<3;h++)c[l]+=s[l][h]*a[h];return new n(c[0],c[1],c[2])},n.prototype.toString=function(t){var e=void 0===t?3:Number(t);return"["+this.x.toFixed(e)+","+this.y.toFixed(e)+","+this.z.toFixed(e)+"]"},void 0===Math.sign&&(Math.sign=function(t){return 0===(t=+t)||isNaN(t)?t:t>0?1:-1}),t.exports&&(t.exports=n)},630:function(t,e){for(var r="0123456789bcdefghjkmnpqrstuvwxyz",n={},a=0;a<r.length;a++)n[r.charAt(a)]=a;var o=-90,i=90,u=-180,s=180,c=[0,5,7,8,11,12,13,15,16,17,18],l=function(t,e,n){if("auto"===n){if("number"==typeof t||"number"==typeof e)throw new Error("string notation required for auto precision.");var a=t.split(".")[1].length,l=e.split(".")[1].length,h=Math.max(a,l);n=c[h]}else void 0===n&&(n=9);for(var f,p=[],d=0,g=0,v=0,y=i,m=o,b=s,M=u;p.length<n;)if(g%2==0?e>(f=(b+M)/2)?(v=1+(v<<1),M=f):(v=0+(v<<1),b=f):t>(f=(y+m)/2)?(v=1+(v<<1),m=f):(v=0+(v<<1),y=f),g++,5===++d){var w=r[v];p.push(w),d=0,v=0}return p.join("")},h=function(t,e,r){r=r||52;for(var n,a=0,c=i,l=o,h=s,f=u,p=0;a<r;)p*=2,a%2==0?e>(n=(h+f)/2)?(p+=1,f=n):h=n:t>(n=(c+l)/2)?(p+=1,l=n):c=n,a++;return p},f=function(t){for(var e,r=!0,a=i,c=o,l=s,h=u,f=0,p=0,d=t.length;p<d;p++){var g=t[p].toLowerCase();f=n[g];for(var v=4;v>=0;v--){var y=f>>v&1;r?(e=(l+h)/2,1===y?h=e:l=e):(e=(a+c)/2,1===y?c=e:a=e),r=!r}}return[c,h,a,l]},p=function(t,e){for(var r=i,n=o,a=s,c=u,l=0,h=(e=e||52)/2,f=0;f<h;f++)l=d(t,2*(h-f)-1),0===d(t,2*(h-f)-2)?r=(r+n)/2:n=(r+n)/2,0===l?a=(a+c)/2:c=(a+c)/2;return[n,c,r,a]};function d(t,e){return t/Math.pow(2,e)&1}var g=function(t){var e=f(t),r=(e[0]+e[2])/2,n=(e[1]+e[3])/2;return{latitude:r,longitude:n,error:{latitude:e[2]-r,longitude:e[3]-n}}},v=function(t,e){var r=p(t,e),n=(r[0]+r[2])/2,a=(r[1]+r[3])/2;return{latitude:n,longitude:a,error:{latitude:r[2]-n,longitude:r[3]-a}}},y=function(t,e){var r=g(t),n=r.latitude+e[0]*r.error.latitude*2,a=r.longitude+e[1]*r.error.longitude*2;return a=b(a),n=M(n),l(n,a,t.length)},m=function(t,e,r){var n=v(t,r=r||52),a=n.latitude+e[0]*n.error.latitude*2,o=n.longitude+e[1]*n.error.longitude*2;return o=b(o),a=M(a),h(a,o,r)};function b(t){return t>s?u+t%s:t<u?s+t%s:t}function M(t){return t>i?i:t<o?o:t}var w={ENCODE_AUTO:"auto",encode:l,encode_uint64:h,encode_int:h,decode:g,decode_int:v,decode_uint64:v,decode_bbox:f,decode_bbox_uint64:p,decode_bbox_int:p,neighbor:y,neighbor_int:m,neighbors:function(t){var e,r,n=t.length,a=g(t),o=a.latitude,i=a.longitude,u=2*a.error.latitude,s=2*a.error.longitude;function c(t,a){return e=o+t*u,r=b(r=i+a*s),e=M(e),l(e,r,n)}return[c(1,0),c(1,1),c(0,1),c(-1,1),c(-1,0),c(-1,-1),c(0,-1),c(1,-1)]},neighbors_int:function(t,e){var r,n,a=v(t,e=e||52),o=a.latitude,i=a.longitude,u=2*a.error.latitude,s=2*a.error.longitude;function c(t,a){return r=o+t*u,n=b(n=i+a*s),r=M(r),h(r,n,e)}return[c(1,0),c(1,1),c(0,1),c(-1,1),c(-1,0),c(-1,-1),c(0,-1),c(1,-1)]},bboxes:function(t,e,r,n,a){for(var o=l(t,e,a=a||9),i=l(r,n,a),u=g(o),s=2*u.error.latitude,c=2*u.error.longitude,h=f(o),p=f(i),d=Math.round((p[0]-h[0])/s),v=Math.round((p[1]-h[1])/c),m=[],b=0;b<=d;b++)for(var M=0;M<=v;M++)m.push(y(o,[b,M]));return m},bboxes_int:function(t,e,r,n,a){for(var o=h(t,e,a=a||52),i=h(r,n,a),u=v(o,a),s=2*u.error.latitude,c=2*u.error.longitude,l=p(o,a),f=p(i,a),d=Math.round((f[0]-l[0])/s),g=Math.round((f[1]-l[1])/c),y=[],b=0;b<=d;b++)for(var M=0;M<=g;M++)y.push(m(o,[b,M],a));return y}};t.exports=w},7:function(t,e,r){"use strict";r.d(e,"d",function(){return a}),r.d(e,"e",function(){return o}),r.d(e,"c",function(){return i}),r.d(e,"b",function(){return u}),r.d(e,"a",function(){return s});var n=r(0);
|
||
/**
|
||
* Hexadecimal functions.
|
||
*
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(!t)return"";for(var n="",a=0;a<t.length;a++)n+=t[a].toString(16).padStart(r,"0")+e;return"0x"===e&&(n="0x"+n),"\\x"===e&&(n="\\x"+n),e.length?n.slice(0,-e.length):n}function o(t){if(!t)return"";for(var e=[],r=0;r<t.length;r++)e.push((t[r]>>>4).toString(16)),e.push((15&t[r]).toString(16));return e.join("")}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if("None"!==e){var a="Auto"===e?/[^a-f\d]/gi:n.a.regexRep(e);t=t.replace(a,"")}for(var o=[],i=0;i<t.length;i+=r)o.push(parseInt(t.substr(i,r),16));return o}var u=["Space","Comma","Semi-colon","Colon","Line feed","CRLF","0x","\\x","None"],s=["Auto"].concat(u)},719:function(t,e,r){"use strict";if(t.exports)var n=r(452);function a(t,e,r,o,i,u,s){if(!(this instanceof a))return new a(t,e,r,o,i,u,s);if(void 0===i&&(i=n.datum.WGS84),void 0===u&&(u=null),void 0===s&&(s=null),!(1<=t&&t<=60))throw new Error("Invalid UTM zone "+t);if(!e.match(/[NS]/i))throw new Error("Invalid UTM hemisphere "+e);this.zone=Number(t),this.hemisphere=e.toUpperCase(),this.easting=Number(r),this.northing=Number(o),this.datum=i,this.convergence=null===u?null:Number(u),this.scale=null===s?null:Number(s)}n.prototype.toUtm=function(){if(isNaN(this.lat)||isNaN(this.lon))throw new Error("Invalid point");if(!(-80<=this.lat&&this.lat<=84))throw new Error("Outside UTM limits");var t=Math.floor((this.lon+180)/6)+1,e=(6*(t-1)-180+3).toRadians(),r="CDEFGHJKLMNPQRSTUVWXX".charAt(Math.floor(this.lat/8+10));31==t&&"V"==r&&this.lon>=3&&(t++,e+=6..toRadians()),32==t&&"X"==r&&this.lon<9&&(t--,e-=6..toRadians()),32==t&&"X"==r&&this.lon>=9&&(t++,e+=6..toRadians()),34==t&&"X"==r&&this.lon<21&&(t--,e-=6..toRadians()),34==t&&"X"==r&&this.lon>=21&&(t++,e+=6..toRadians()),36==t&&"X"==r&&this.lon<33&&(t--,e-=6..toRadians()),36==t&&"X"==r&&this.lon>=33&&(t++,e+=6..toRadians());for(var n=this.lat.toRadians(),o=this.lon.toRadians()-e,i=this.datum.ellipsoid.a,u=this.datum.ellipsoid.f,s=Math.sqrt(u*(2-u)),c=u/(2-u),l=c*c,h=c*l,f=c*h,p=c*f,d=c*p,g=Math.cos(o),v=Math.sin(o),y=Math.tan(o),m=Math.tan(n),b=Math.sinh(s*Math.atanh(s*m/Math.sqrt(1+m*m))),M=m*Math.sqrt(1+b*b)-b*Math.sqrt(1+m*m),w=Math.atan2(M,g),A=Math.asinh(v/Math.sqrt(M*M+g*g)),F=i/(1+c)*(1+.25*l+1/64*f+1/256*d),E=[null,.5*c-2/3*l+5/16*h+41/180*f-127/288*p+7891/37800*d,13/48*l-.6*h+557/1440*f+281/630*p-1983433/1935360*d,61/240*h-103/140*f+15061/26880*p+167603/181440*d,49561/161280*f-179/168*p+6601661/7257600*d,34729/80640*p-3418889/1995840*d,.6650675310896665*d],N=w,D=1;D<=6;D++)N+=E[D]*Math.sin(2*D*w)*Math.cosh(2*D*A);var B=A;for(D=1;D<=6;D++)B+=E[D]*Math.cos(2*D*w)*Math.sinh(2*D*A);var C=.9996*F*B,S=.9996*F*N,R=1;for(D=1;D<=6;D++)R+=2*D*E[D]*Math.cos(2*D*w)*Math.cosh(2*D*A);var x=0;for(D=1;D<=6;D++)x+=2*D*E[D]*Math.sin(2*D*w)*Math.sinh(2*D*A);var L=Math.atan(M/Math.sqrt(1+M*M)*y)+Math.atan2(x,R),T=Math.sin(n),k=.9996*(Math.sqrt(1-s*s*T*T)*Math.sqrt(1+m*m)/Math.sqrt(M*M+g*g))*(F/i*Math.sqrt(R*R+x*x));C+=5e5,S<0&&(S+=1e7),C=Number(C.toFixed(6)),S=Number(S.toFixed(6));var O=Number(L.toDegrees().toFixed(9)),I=Number(k.toFixed(12));return new a(t,this.lat>=0?"N":"S",C,S,this.datum,O,I)},a.prototype.toLatLonE=function(){var t=this.zone,e=this.hemisphere,r=this.easting,a=this.northing;if(isNaN(t)||isNaN(r)||isNaN(a))throw new Error("Invalid coordinate");var o=this.datum.ellipsoid.a,i=this.datum.ellipsoid.f;r-=5e5,a="S"==e?a-1e7:a;for(var u=Math.sqrt(i*(2-i)),s=i/(2-i),c=s*s,l=s*c,h=s*l,f=s*h,p=s*f,d=o/(1+s)*(1+.25*c+1/64*h+1/256*p),g=r/(.9996*d),v=a/(.9996*d),y=[null,.5*s-2/3*c+37/96*l-1/360*h-81/512*f+96199/604800*p,1/48*c+1/15*l-437/1440*h+46/105*f-1118711/3870720*p,17/480*l-37/840*h-209/4480*f+5569/90720*p,4397/161280*h-11/504*f-830251/7257600*p,4583/161280*f-108847/3991680*p,.03233083094085698*p],m=v,b=1;b<=6;b++)m-=y[b]*Math.sin(2*b*v)*Math.cosh(2*b*g);var M=g;for(b=1;b<=6;b++)M-=y[b]*Math.cos(2*b*v)*Math.sinh(2*b*g);var w=Math.sinh(M),A=Math.sin(m),F=Math.cos(m),E=A/Math.sqrt(w*w+F*F),N=E;do{var D=Math.sinh(u*Math.atanh(u*N/Math.sqrt(1+N*N))),B=N*Math.sqrt(1+D*D)-D*Math.sqrt(1+N*N),C=(E-B)/Math.sqrt(1+B*B)*(1+(1-u*u)*N*N)/((1-u*u)*Math.sqrt(1+N*N));N+=C}while(Math.abs(C)>1e-12);var S=N,R=Math.atan(S),x=Math.atan2(w,F),L=1;for(b=1;b<=6;b++)L-=2*b*y[b]*Math.cos(2*b*v)*Math.cosh(2*b*g);var T=0;for(b=1;b<=6;b++)T+=2*b*y[b]*Math.sin(2*b*v)*Math.sinh(2*b*g);var k=Math.atan(Math.tan(m)*Math.tanh(M))+Math.atan2(T,L),O=Math.sin(R),I=.9996*(Math.sqrt(1-u*u*O*O)*Math.sqrt(1+S*S)*Math.sqrt(w*w+F*F))*(d/o/Math.sqrt(L*L+T*T));x+=(6*(t-1)-180+3).toRadians();var _=Number(R.toDegrees().toFixed(11)),P=Number(x.toDegrees().toFixed(11)),U=Number(k.toDegrees().toFixed(9)),j=Number(I.toFixed(12)),G=new n(_,P,this.datum);return G.convergence=U,G.scale=j,G},a.parse=function(t,e){if(void 0===e&&(e=n.datum.WGS84),null==(t=t.trim().match(/\S+/g))||4!=t.length)throw new Error("Invalid UTM coordinate ‘"+t+"’");return new a(t[0],t[1],t[2],t[3],e)},a.prototype.toString=function(t){t=Number(t||0);var e=this.zone<10?"0"+this.zone:this.zone,r=this.hemisphere,n=this.easting,a=this.northing;return isNaN(e)||!r.match(/[NS]/)||isNaN(n)||isNaN(a)?"":e+" "+r+" "+n.toFixed(t)+" "+a.toFixed(t)},void 0===Math.sinh&&(Math.sinh=function(t){return(Math.exp(t)-Math.exp(-t))/2}),void 0===Math.cosh&&(Math.cosh=function(t){return(Math.exp(t)+Math.exp(-t))/2}),void 0===Math.tanh&&(Math.tanh=function(t){return(Math.exp(t)-Math.exp(-t))/(Math.exp(t)+Math.exp(-t))}),void 0===Math.asinh&&(Math.asinh=function(t){return Math.log(t+Math.sqrt(1+t*t))}),void 0===Math.atanh&&(Math.atanh=function(t){return Math.log((1+t)/(1-t))/2}),t.exports&&(t.exports=a)},9:function(t,e,r){"use strict";var n=r(0),a=r(12),o=r(4),i=r.n(o),u=r(14),s=r.n(u);function c(t,e,r,n,a,o,i){try{var u=t[o](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,a)}function l(t){return function(){var e=this,r=arguments;return new Promise(function(n,a){var o=t.apply(e,r);function i(t){c(o,n,a,i,u,"next",t)}function u(t){c(o,n,a,i,u,"throw",t)}i(void 0)})}}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}
|
||
/**
|
||
* @author n1474335 [n1474335@gmail.com]
|
||
* @author Matt C [matt@artemisbot.uk]
|
||
* @copyright Crown Copyright 2016
|
||
* @license Apache-2.0
|
||
*/
|
||
var f=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.value=[],this.type=t.BYTE_ARRAY,e&&e.hasOwnProperty("value")&&e.hasOwnProperty("type")&&this.set(e.value,e.type)}var e,r,o;return e=t,r=[{key:"set",value:function(e,r){if("string"==typeof r&&(r=t.typeEnum(r)),s.a.debug("Dish type: "+t.enumLookup(r)),this.value=e,this.type=r,!this.valid()){var o=n.a.truncate(JSON.stringify(this.value),13);throw new a.a("Data is not a valid ".concat(t.enumLookup(r),": ").concat(o))}}},{key:"get",value:function(){var e=l(regeneratorRuntime.mark(function e(r){var n,a=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>1&&void 0!==a[1]&&a[1],"string"==typeof r&&(r=t.typeEnum(r)),this.type===r){e.next=5;break}return e.next=5,this._translate(r,n);case 5:return e.abrupt("return",this.value);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_translate",value:function(){var e=l(regeneratorRuntime.mark(function e(r){var o,u,c=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:o=c.length>1&&void 0!==c[1]&&c[1],s.a.debug("Translating Dish from ".concat(t.enumLookup(this.type)," to ").concat(t.enumLookup(r))),u=o?n.a.byteArrayToChars:n.a.byteArrayToUtf8,e.prev=3,e.t0=this.type,e.next=e.t0===t.STRING?7:e.t0===t.NUMBER?9:e.t0===t.HTML?11:e.t0===t.ARRAY_BUFFER?13:e.t0===t.BIG_NUMBER?15:e.t0===t.JSON?17:e.t0===t.FILE?19:e.t0===t.LIST_FILE?24:30;break;case 7:return this.value=this.value?n.a.strToByteArray(this.value):[],e.abrupt("break",31);case 9:return this.value="number"==typeof this.value?n.a.strToByteArray(this.value.toString()):[],e.abrupt("break",31);case 11:return this.value=this.value?n.a.strToByteArray(n.a.unescapeHtml(n.a.stripHtmlTags(this.value,!0))):[],e.abrupt("break",31);case 13:return this.value=Array.prototype.slice.call(new Uint8Array(this.value)),e.abrupt("break",31);case 15:return this.value=i.a.isBigNumber(this.value)?n.a.strToByteArray(this.value.toFixed()):[],e.abrupt("break",31);case 17:return this.value=this.value?n.a.strToByteArray(JSON.stringify(this.value,null,4)):[],e.abrupt("break",31);case 19:return e.next=21,n.a.readFile(this.value);case 21:return this.value=e.sent,this.value=Array.prototype.slice.call(this.value),e.abrupt("break",31);case 24:return e.next=26,Promise.all(this.value.map(function(){var t=l(regeneratorRuntime.mark(function t(e){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",n.a.readFile(e));case 1:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()));case 26:return this.value=e.sent,this.value=this.value.map(function(t){return Array.prototype.slice.call(t)}),this.value=[].concat.apply([],this.value),e.abrupt("break",31);case 30:return e.abrupt("break",31);case 31:e.next=36;break;case 33:throw e.prev=33,e.t1=e.catch(3),new a.a("Error translating from ".concat(t.enumLookup(this.type)," to byteArray: ").concat(e.t1));case 36:this.type=t.BYTE_ARRAY,e.prev=37,e.t2=r,e.next=e.t2===t.STRING?41:e.t2===t.HTML?41:e.t2===t.NUMBER?44:e.t2===t.ARRAY_BUFFER?47:e.t2===t.BIG_NUMBER?50:e.t2===t.JSON?53:e.t2===t.FILE?56:e.t2===t.LIST_FILE?58:61;break;case 41:return this.value=this.value?u(this.value):"",this.type=t.STRING,e.abrupt("break",62);case 44:return this.value=this.value?parseFloat(u(this.value)):0,this.type=t.NUMBER,e.abrupt("break",62);case 47:return this.value=new Uint8Array(this.value).buffer,this.type=t.ARRAY_BUFFER,e.abrupt("break",62);case 50:try{this.value=new i.a(u(this.value))}catch(t){this.value=new i.a(NaN)}return this.type=t.BIG_NUMBER,e.abrupt("break",62);case 53:return this.value=JSON.parse(u(this.value)),this.type=t.JSON,e.abrupt("break",62);case 56:return this.value=new File(this.value,"unknown"),e.abrupt("break",62);case 58:return this.value=[new File(this.value,"unknown")],this.type=t.LIST_FILE,e.abrupt("break",62);case 61:return e.abrupt("break",62);case 62:e.next=67;break;case 64:throw e.prev=64,e.t3=e.catch(37),new a.a("Error translating from byteArray to ".concat(t.enumLookup(r),": ").concat(e.t3));case 67:case"end":return e.stop()}},e,this,[[3,33],[37,64]])}));return function(t){return e.apply(this,arguments)}}()},{key:"valid",value:function(){switch(this.type){case t.BYTE_ARRAY:if(!(this.value instanceof Array))return!1;for(var e=0;e<this.value.length;e++)if("number"!=typeof this.value[e]||this.value[e]<0||this.value[e]>255)return!1;return!0;case t.STRING:case t.HTML:return"string"==typeof this.value;case t.NUMBER:return"number"==typeof this.value;case t.ARRAY_BUFFER:return this.value instanceof ArrayBuffer;case t.BIG_NUMBER:return i.a.isBigNumber(this.value);case t.JSON:return!0;case t.FILE:return this.value instanceof File;case t.LIST_FILE:return this.value instanceof Array&&this.value.reduce(function(t,e){return t&&e instanceof File},!0);default:return!1}}},{key:"clone",value:function(){var e=new t;switch(this.type){case t.STRING:case t.HTML:case t.NUMBER:case t.BIG_NUMBER:e.set(this.value,this.type);break;case t.BYTE_ARRAY:case t.JSON:e.set(JSON.parse(JSON.stringify(this.value)),this.type);break;case t.ARRAY_BUFFER:e.set(this.value.slice(0),this.type);break;case t.FILE:e.set(new File([this.value],this.value.name,{type:this.value.type,lastModified:this.value.lastModified}),this.type);break;case t.LIST_FILE:e.set(this.value.map(function(t){return new File([t],t.name,{type:t.type,lastModified:t.lastModified})}),this.type);break;default:throw new a.a("Cannot clone Dish, unknown type")}return e}},{key:"size",get:function(){switch(this.type){case t.BYTE_ARRAY:case t.STRING:case t.HTML:return this.value.length;case t.NUMBER:case t.BIG_NUMBER:return this.value.toString().length;case t.ARRAY_BUFFER:return this.value.byteLength;case t.JSON:return JSON.stringify(this.value).length;case t.FILE:return this.value.size;case t.LIST_FILE:return this.value.reduce(function(t,e){return t+e.size},0);default:return-1}}}],o=[{key:"typeEnum",value:function(e){switch(e.toLowerCase()){case"bytearray":case"byte array":return t.BYTE_ARRAY;case"string":return t.STRING;case"number":return t.NUMBER;case"html":return t.HTML;case"arraybuffer":case"array buffer":return t.ARRAY_BUFFER;case"bignumber":case"big number":return t.BIG_NUMBER;case"json":return t.JSON;case"file":return t.FILE;case"list<file>":return t.LIST_FILE;default:throw new a.a("Invalid data type string. No matching enum.")}}},{key:"enumLookup",value:function(e){switch(e){case t.BYTE_ARRAY:return"byteArray";case t.STRING:return"string";case t.NUMBER:return"number";case t.HTML:return"html";case t.ARRAY_BUFFER:return"ArrayBuffer";case t.BIG_NUMBER:return"BigNumber";case t.JSON:return"JSON";case t.FILE:return"File";case t.LIST_FILE:return"List<File>";default:throw new a.a("Invalid data type enum. No matching type.")}}}],r&&h(e.prototype,r),o&&h(e,o),t}();f.BYTE_ARRAY=0,f.STRING=1,f.NUMBER=2,f.HTML=3,f.ARRAY_BUFFER=4,f.BIG_NUMBER=5,f.JSON=6,f.FILE=7,f.LIST_FILE=8,e.a=f}}); |