From 90e611ceef9d5387ab8d95fb4ddffecea4bfee0c Mon Sep 17 00:00:00 2001 From: Peng-YM <1048217874pengym@gmail.com> Date: Fri, 3 Jun 2022 22:51:39 +0800 Subject: [PATCH] Refactored ProxyUtils and RuleUtils --- backend/dist/sub-store-parser.loon.min.js | 4 +- backend/src/core/proxy-utils.js | 2015 ----------------- backend/src/core/proxy-utils/index.js | 176 ++ backend/src/core/proxy-utils/parsers.js | 879 +++++++ backend/src/core/proxy-utils/preprocessors.js | 92 + backend/src/core/proxy-utils/processors.js | 415 ++++ backend/src/core/proxy-utils/producers.js | 422 ++++ backend/src/core/rule-utils.js | 324 --- backend/src/core/rule-utils/index.js | 69 + backend/src/core/rule-utils/parsers.js | 58 + backend/src/core/rule-utils/preprocessors.js | 18 + backend/src/core/rule-utils/producers.js | 81 + backend/sub-store.min.js | 4 +- 13 files changed, 2214 insertions(+), 2343 deletions(-) delete mode 100644 backend/src/core/proxy-utils.js create mode 100644 backend/src/core/proxy-utils/index.js create mode 100644 backend/src/core/proxy-utils/parsers.js create mode 100644 backend/src/core/proxy-utils/preprocessors.js create mode 100644 backend/src/core/proxy-utils/processors.js create mode 100644 backend/src/core/proxy-utils/producers.js delete mode 100644 backend/src/core/rule-utils.js create mode 100644 backend/src/core/rule-utils/index.js create mode 100644 backend/src/core/rule-utils/parsers.js create mode 100644 backend/src/core/rule-utils/preprocessors.js create mode 100644 backend/src/core/rule-utils/producers.js diff --git a/backend/dist/sub-store-parser.loon.min.js b/backend/dist/sub-store-parser.loon.min.js index a7283ed..4301f21 100644 --- a/backend/dist/sub-store-parser.loon.min.js +++ b/backend/dist/sub-store-parser.loon.min.js @@ -6,11 +6,11 @@ * ███████║╚██████╔╝██████╔╝ ███████║ ██║ ╚██████╔╝██║ ██║███████╗ * ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ * Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket! - * @updated: 2022/6/3 19:10:53 + * @updated: 2022/6/3 22:47:32 * @version: 1.6 * @author: Peng-YM * @github: https://github.com/Peng-YM/Sub-Store * @documentation: https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46 */ -!function(){var createModuleFactory=function(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}},_$buffer_2=createModuleFactory((function(t,e){(function(t){(function(){"use strict";e.Buffer=r,e.SlowBuffer=function(t){return+t!=t&&(t=0),r.alloc(+t)},e.INSPECT_MAX_BYTES=50;function t(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=r.prototype,e}function r(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return i(t)}return n(t,e,r)}function n(e,n,o){if("string"==typeof e)return function(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!r.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o=0|c(e,n),i=t(o),a=i.write(e,n);return a!==o&&(i=i.slice(0,a)),i}(e,n);if(ArrayBuffer.isView(e))return a(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(P(e,ArrayBuffer)||e&&P(e.buffer,ArrayBuffer))return function(t,e,n){if(e<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function c(t,e){if(r.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||P(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return I(t).length;default:if(i)return o?-1:k(t).length;e=(""+e).toLowerCase(),i=!0}}function s(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function f(t,e,n,o,i){if(0===t.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),$(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=r.from(e,o)),r.isBuffer(e))return 0===e.length?-1:l(t,e,n,o,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):l(t,[e],n,o,i);throw new TypeError("val must be string, number or Buffer")}function l(t,e,r,n,o){var i,a=1,u=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,u/=2,c/=2,r/=2}function s(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){var f=-1;for(i=r;iu&&(r=u-c),i=r;i>=0;i--){for(var l=!0,p=0;po&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function g(t,e,r){return 0===e&&r===t.length?_$base64Js_1.fromByteArray(t):_$base64Js_1.fromByteArray(t.slice(e,r))}function m(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:s>223?3:s>191?2:1;if(o+l<=r)switch(l){case 1:s<128&&(f=s);break;case 2:128==(192&(i=t[o+1]))&&(c=(31&s)<<6|63&i)>127&&(f=c);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(c=(15&s)<<12|(63&i)<<6|63&a)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:i=t[o+1],a=t[o+2],u=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(c=(15&s)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&c<1114112&&(f=c)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=l}return function(t){var e=t.length;if(e<=w)return String.fromCharCode.apply(String,t);for(var r="",n=0;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,r);case"utf8":case"utf-8":return m(this,e,r);case"ascii":return b(this,e,r);case"latin1":case"binary":return E(this,e,r);case"base64":return g(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=function(t){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===r.compare(this,t)},r.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),""},r.prototype.compare=function(t,e,n,o,i){if(P(t,Uint8Array)&&(t=r.from(t,t.offset,t.byteLength)),!r.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),e<0||n>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=n)return 0;if(o>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var a=(i>>>=0)-(o>>>=0),u=(n>>>=0)-(e>>>=0),c=Math.min(a,u),s=this.slice(o,i),f=t.slice(e,n),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return p(this,t,e,r);case"utf8":case"utf-8":return h(this,t,e,r);case"ascii":return d(this,t,e,r);case"latin1":case"binary":return _(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function b(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;oo)&&(r=o);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,n,o,i,a){if(!r.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,4),_$ieee754_3.write(t,e,r,n,23,4),r+4}function C(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,8),_$ieee754_3.write(t,e,r,n,52,8),r+8}r.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},r.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},r.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},r.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},r.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},r.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},r.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},r.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},r.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},r.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},r.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},r.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),_$ieee754_3.read(this,t,!0,23,4)},r.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),_$ieee754_3.read(this,t,!1,23,4)},r.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),_$ieee754_3.read(this,t,!0,52,8)},r.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),_$ieee754_3.read(this,t,!1,52,8)},r.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},r.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,255,0),this[e]=255&t,e+1},r.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},r.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=0,a=1,u=0;for(this[e]=255&t;++i>0)-u&255;return e+r},r.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=r-1,a=1,u=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/a>>0)-u&255;return e+r},r.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},r.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},r.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},r.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},r.prototype.writeDoubleLE=function(t,e,r){return C(this,t,e,!0,r)},r.prototype.writeDoubleBE=function(t,e,r){return C(this,t,e,!1,r)},r.prototype.copy=function(t,e,n,o){if(!r.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),o||0===o||(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e=0;--a)t[a+e]=this[a+n];else Uint8Array.prototype.set.call(t,this.subarray(n,o),e);return i},r.prototype.fill=function(t,e,n,o){if("string"==typeof t){if("string"==typeof e?(o=e,e=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!r.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){var i=t.charCodeAt(0);("utf8"===o&&i<128||"latin1"===o)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function I(t){return _$base64Js_1.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(T,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function N(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function P(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function $(t){return t!=t}}).call(this)}).call(this,_$buffer_2({}).Buffer)})),_$openApi_44={};function _typeof(t){return(_typeof="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 ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(t){for(var e=1;e=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){asyncGeneratorStep(i,n,o,a,u,"next",t)}function u(t){asyncGeneratorStep(i,n,o,a,u,"throw",t)}a(void 0)}))}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"untitled",debug=arguments.length>1&&void 0!==arguments[1]&&arguments[1];_classCallCheck(this,OpenAPI),this.name=name,this.debug=debug,this.http=HTTP(),this.env=ENV(),this.node=function(){if(isNode){var fs=eval("require('fs')");return{fs:fs}}return null}(),this.initCache();var delay=function(t,e){return new Promise((function(r){setTimeout(r.bind(null,e),t)}))},_ref;Promise.prototype.delay=(_ref=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){var r;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:return r=t.sent,t.next=5,delay(e,r);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return _ref.apply(this,arguments)})}return _createClass(OpenAPI,[{key:"initCache",value:function(){if(isQX&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(isLoon||isSurge)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),isNode){var t="root.json";this.node.fs.existsSync(t)||this.node.fs.writeFileSync(t,JSON.stringify({}),{flag:"wx"},(function(t){return console.log(t)})),this.root={},t="".concat(this.name,".json"),this.node.fs.existsSync(t)?this.cache=JSON.parse(this.node.fs.readFileSync("".concat(this.name,".json"))):(this.node.fs.writeFileSync(t,JSON.stringify({}),{flag:"wx"},(function(t){return console.log(t)})),this.cache={})}}},{key:"persistCache",value:function(){var t=JSON.stringify(this.cache,null,2);isQX&&$prefs.setValueForKey(t,this.name),(isLoon||isSurge)&&$persistentStore.write(t,this.name),isNode&&(this.node.fs.writeFileSync("".concat(this.name,".json"),t,{flag:"w"},(function(t){return console.log(t)})),this.node.fs.writeFileSync("root.json",JSON.stringify(this.root,null,2),{flag:"w"},(function(t){return console.log(t)})))}},{key:"write",value:function(t,e){if(this.log("SET ".concat(e)),-1!==e.indexOf("#")){if(e=e.substr(1),isSurge||isLoon)return $persistentStore.write(t,e);if(isQX)return $prefs.setValueForKey(t,e);isNode&&(this.root[e]=t)}else this.cache[e]=t;this.persistCache()}},{key:"read",value:function(t){return this.log("READ ".concat(t)),-1===t.indexOf("#")?this.cache[t]:(t=t.substr(1),isSurge||isLoon?$persistentStore.read(t):isQX?$prefs.valueForKey(t):isNode?this.root[t]:void 0)}},{key:"delete",value:function(t){if(this.log("DELETE ".concat(t)),-1!==t.indexOf("#")){if(t=t.substr(1),isSurge||isLoon)return $persistentStore.write(null,t);if(isQX)return $prefs.removeValueForKey(t);isNode&&delete this.root[t]}else delete this.cache[t];this.persistCache()}},{key:"notify",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n["open-url"],i=n["media-url"];if(isQX&&$notify(t,e,r,n),isSurge&&$notification.post(t,e,r+"".concat(i?"\n\u591a\u5a92\u4f53:"+i:""),{url:o}),isLoon){var a={};o&&(a.openUrl=o),i&&(a.mediaUrl=i),"{}"===JSON.stringify(a)?$notification.post(t,e,r):$notification.post(t,e,r,a)}if(isNode){var u=r+(o?"\n\u70b9\u51fb\u8df3\u8f6c: ".concat(o):"")+(i?"\n\u591a\u5a92\u4f53: ".concat(i):"");console.log("".concat(t,"\n").concat(e,"\n").concat(u,"\n\n"))}}},{key:"log",value:function(t){this.debug&&console.log("[".concat(this.name,"] LOG: ").concat(t))}},{key:"info",value:function(t){console.log("[".concat(this.name,"] INFO: ").concat(t))}},{key:"error",value:function(t){console.log("[".concat(this.name,"] ERROR: ").concat(t))}},{key:"wait",value:function(t){return new Promise((function(e){return setTimeout(e,t)}))}},{key:"done",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};isQX||isLoon||isSurge?$done(t):isNode&&"undefined"!=typeof $context&&($context.headers=t.headers,$context.statusCode=t.statusCode,$context.body=t.body)}}]),OpenAPI}();function ENV(){return{isQX:isQX,isLoon:isLoon,isSurge:isSurge,isNode:isNode}}function HTTP(){var defaultOptions=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{baseURL:""},_ENV=ENV(),isQX=_ENV.isQX,isLoon=_ENV.isLoon,isSurge=_ENV.isSurge,isNode=_ENV.isNode,methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],URL_REGEX=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;function send(method,options){options="string"==typeof options?{url:options}:options;var baseURL=defaultOptions.baseURL;baseURL&&!URL_REGEX.test(options.url||"")&&(options.url=baseURL?baseURL+options.url:options.url),options=_objectSpread(_objectSpread({},defaultOptions),options);var timeout=options.timeout,events=_objectSpread(_objectSpread({},{onRequest:function(){},onResponse:function(t){return t},onTimeout:function(){}}),options.events),worker,timeoutid;events.onRequest(method,options),isQX?worker=$task.fetch({method:method,url:options.url,headers:options.headers,body:options.body}):(isLoon||isSurge||isNode)&&(worker=new Promise((function(resolve,reject){var request=isNode?eval("require('request')"):$httpClient;request[method.toLowerCase()](options,(function(t,e,r){t?reject(t):resolve({statusCode:e.status||e.statusCode,headers:e.headers,body:r})}))})));var timer=timeout?new Promise((function(t,e){timeoutid=setTimeout((function(){return events.onTimeout(),e("".concat(method," URL: ").concat(options.url," exceeds the timeout ").concat(timeout," ms"))}),timeout)})):null;return(timer?Promise.race([timer,worker]).then((function(t){return clearTimeout(timeoutid),t})):worker).then((function(t){return events.onResponse(t)}))}var http={};return methods.forEach((function(t){return http[t.toLowerCase()]=function(e){return send(t,e)}})),http}_$openApi_44.OpenAPI=OpenAPI;var _$common_7={};function isNothing(t){return null==t}_$common_7.isNothing=isNothing,_$common_7.isObject=function(t){return"object"==typeof t&&null!==t},_$common_7.toArray=function(t){return Array.isArray(t)?t:isNothing(t)?[]:[t]},_$common_7.repeat=function(t,e){var r,n="";for(r=0;r0&&-1==="\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(n-1));)if(n-=1,this.position-n>e/2-1){r=" ... ",n+=5;break}for(o="",i=this.position;ie/2-1){o=" ... ",i-=5;break}return a=this.buffer.slice(n,i),_$common_7.repeat(" ",t)+r+a+o+"\n"+_$common_7.repeat(" ",t+this.position-n+r.length)+"^"},Mark.prototype.toString=function(t){var e,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),t||(e=this.getSnippet())&&(r+=":\n"+e),r},_$mark_11=Mark;var TYPE_CONSTRUCTOR_OPTIONS=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],YAML_NODE_KINDS=["scalar","sequence","mapping"],_$type_18=function(t,e){var r,n;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===TYPE_CONSTRUCTOR_OPTIONS.indexOf(e))throw new _$exception_9('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=(r=e.styleAliases||null,n={},null!==r&&Object.keys(r).forEach((function(t){r[t].forEach((function(e){n[String(e)]=t}))})),n),-1===YAML_NODE_KINDS.indexOf(this.kind))throw new _$exception_9('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')},_$schema_12={};function compileList(t,e,r){var n=[];return t.include.forEach((function(t){r=compileList(t,e,r)})),t[e].forEach((function(t){r.forEach((function(e,r){e.tag===t.tag&&e.kind===t.kind&&n.push(r)})),r.push(t)})),r.filter((function(t,e){return-1===n.indexOf(e)}))}function Schema(t){this.include=t.include||[],this.implicit=t.implicit||[],this.explicit=t.explicit||[],this.implicit.forEach((function(t){if(t.loadKind&&"scalar"!==t.loadKind)throw new _$exception_9("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")})),this.compiledImplicit=compileList(this,"implicit",[]),this.compiledExplicit=compileList(this,"explicit",[]),this.compiledTypeMap=function(){var t,e,r={scalar:{},sequence:{},mapping:{},fallback:{}};function n(t){r[t.kind][t.tag]=r.fallback[t.tag]=t}for(t=0,e=arguments.length;t=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0"+t.toString(8):"-0"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),YAML_FLOAT_PATTERN=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),SCIENTIFIC_WITHOUT_DOT=/^[-+]?[0-9]+e/,_$float_21=new _$type_18("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!YAML_FLOAT_PATTERN.test(t)||"_"===t[t.length-1])},construct:function(t){var e,r,n,o;return r="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:e.indexOf(":")>=0?(e.split(":").forEach((function(t){o.unshift(parseFloat(t,10))})),e=0,n=1,o.forEach((function(t){e+=t*n,n*=60})),r*e):r*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||_$common_7.isNegativeZero(t))},represent:function(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(_$common_7.isNegativeZero(t))return"-0.0";return r=t.toString(10),SCIENTIFIC_WITHOUT_DOT.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"}),_$json_17=new _$schema_12({include:[_$failsafe_16],implicit:[_$null_28,_$bool_20,_$int_22,_$float_21]}),_$core_13=new _$schema_12({include:[_$json_17]}),YAML_DATE_REGEXP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),YAML_TIMESTAMP_REGEXP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),_$timestamp_34=new _$type_18("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==YAML_DATE_REGEXP.exec(t)||null!==YAML_TIMESTAMP_REGEXP.exec(t))},construct:function(t){var e,r,n,o,i,a,u,c,s=0,f=null;if(null===(e=YAML_DATE_REGEXP.exec(t))&&(e=YAML_TIMESTAMP_REGEXP.exec(t)),null===e)throw new Error("Date resolve error");if(r=+e[1],n=+e[2]-1,o=+e[3],!e[4])return new Date(Date.UTC(r,n,o));if(i=+e[4],a=+e[5],u=+e[6],e[7]){for(s=e[7].slice(0,3);s.length<3;)s+="0";s=+s}return e[9]&&(f=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(f=-f)),c=new Date(Date.UTC(r,n,o,i,a,u,s)),f&&c.setTime(c.getTime()-f),c},instanceOf:Date,represent:function(t){return t.toISOString()}}),_$merge_27=new _$type_18("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}}),NodeBuffer;try{var _require=require;NodeBuffer=_require("buffer").Buffer}catch(__){}var BASE64_MAP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",_$binary_19=new _$type_18("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,r,n=0,o=t.length,i=BASE64_MAP;for(r=0;r64)){if(e<0)return!1;n+=6}return n%8==0},construct:function(t){var e,r,n=t.replace(/[\r\n=]/g,""),o=n.length,i=BASE64_MAP,a=0,u=[];for(e=0;e>16&255),u.push(a>>8&255),u.push(255&a)),a=a<<6|i.indexOf(n.charAt(e));return 0==(r=o%4*6)?(u.push(a>>16&255),u.push(a>>8&255),u.push(255&a)):18===r?(u.push(a>>10&255),u.push(a>>2&255)):12===r&&u.push(a>>4&255),NodeBuffer?NodeBuffer.from?NodeBuffer.from(u):new NodeBuffer(u):u},predicate:function(t){return NodeBuffer&&NodeBuffer.isBuffer(t)},represent:function(t){var e,r,n="",o=0,i=t.length,a=BASE64_MAP;for(e=0;e>18&63],n+=a[o>>12&63],n+=a[o>>6&63],n+=a[63&o]),o=(o<<8)+t[e];return 0==(r=i%3)?(n+=a[o>>18&63],n+=a[o>>12&63],n+=a[o>>6&63],n+=a[63&o]):2===r?(n+=a[o>>10&63],n+=a[o>>4&63],n+=a[o<<2&63],n+=a[64]):1===r&&(n+=a[o>>2&63],n+=a[o<<4&63],n+=a[64],n+=a[64]),n}}),_hasOwnProperty=Object.prototype.hasOwnProperty,_toString=Object.prototype.toString,_$omap_29=new _$type_18("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,r,n,o,i,a=[],u=t;for(e=0,r=u.length;e3)return!1;if("/"!==e[e.length-n.length-1])return!1}return!0},construct:function(t){var e=t,r=/\/([gim]*)$/.exec(t),n="";return"/"===e[0]&&(r&&(n=r[1]),e=e.slice(1,e.length-n.length-1)),new RegExp(e,n)},predicate:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},represent:function(t){var e="/"+t.source+"/";return t.global&&(e+="g"),t.multiline&&(e+="m"),t.ignoreCase&&(e+="i"),e}}),esprima;try{var ___require_23=require;esprima=___require_23("esprima")}catch(_){"undefined"!=typeof window&&(esprima=window.esprima)}var _$function_23=new _$type_18("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var e="("+t+")",r=esprima.parse(e,{range:!0});return"Program"===r.type&&1===r.body.length&&"ExpressionStatement"===r.body[0].type&&("ArrowFunctionExpression"===r.body[0].expression.type||"FunctionExpression"===r.body[0].expression.type)}catch(n){return!1}},construct:function(t){var e,r="("+t+")",n=esprima.parse(r,{range:!0}),o=[];if("Program"!==n.type||1!==n.body.length||"ExpressionStatement"!==n.body[0].type||"ArrowFunctionExpression"!==n.body[0].expression.type&&"FunctionExpression"!==n.body[0].expression.type)throw new Error("Failed to resolve function");return n.body[0].expression.params.forEach((function(t){o.push(t.name)})),e=n.body[0].expression.body.range,"BlockStatement"===n.body[0].expression.body.type?new Function(o,r.slice(e[0]+1,e[1]-1)):new Function(o,"return "+r.slice(e[0],e[1]))},predicate:function(t){return"[object Function]"===Object.prototype.toString.call(t)},represent:function(t){return t.toString()}}),_$default_full_14=_$schema_12.DEFAULT=new _$schema_12({include:[_$default_safe_15],explicit:[_$undefined_25,_$regexp_24,_$function_23]}),_$loader_10={},___hasOwnProperty_10=Object.prototype.hasOwnProperty,CONTEXT_FLOW_IN=1,CONTEXT_FLOW_OUT=2,CONTEXT_BLOCK_IN=3,CONTEXT_BLOCK_OUT=4,CHOMPING_CLIP=1,CHOMPING_STRIP=2,CHOMPING_KEEP=3,PATTERN_NON_PRINTABLE=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,PATTERN_NON_ASCII_LINE_BREAKS=/[\x85\u2028\u2029]/,PATTERN_FLOW_INDICATORS=/[,\[\]\{\}]/,PATTERN_TAG_HANDLE=/^(?:!|!!|![a-z\-]+!)$/i,PATTERN_TAG_URI=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _class(t){return Object.prototype.toString.call(t)}function is_EOL(t){return 10===t||13===t}function is_WHITE_SPACE(t){return 9===t||32===t}function is_WS_OR_EOL(t){return 9===t||32===t||10===t||13===t}function is_FLOW_INDICATOR(t){return 44===t||91===t||93===t||123===t||125===t}function fromHexCode(t){var e;return 48<=t&&t<=57?t-48:97<=(e=32|t)&&e<=102?e-97+10:-1}function simpleEscapeSequence(t){return 48===t?"\0":97===t?"\x07":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"\x1b":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"\x85":95===t?"\xa0":76===t?"\u2028":80===t?"\u2029":""}function charFromCodepoint(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var simpleEscapeCheck=new Array(256),simpleEscapeMap=new Array(256),i=0;i<256;i++)simpleEscapeCheck[i]=simpleEscapeSequence(i)?1:0,simpleEscapeMap[i]=simpleEscapeSequence(i);function State(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||_$default_full_14,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function generateError(t,e){return new _$exception_9(e,new _$mark_11(t.filename,t.input,t.position,t.line,t.position-t.lineStart))}function throwError(t,e){throw generateError(t,e)}function throwWarning(t,e){t.onWarning&&t.onWarning.call(null,generateError(t,e))}var directiveHandlers={YAML:function(t,e,r){var n,o,i;null!==t.version&&throwError(t,"duplication of %YAML directive"),1!==r.length&&throwError(t,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&throwError(t,"ill-formed argument of the YAML directive"),o=parseInt(n[1],10),i=parseInt(n[2],10),1!==o&&throwError(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=i<2,1!==i&&2!==i&&throwWarning(t,"unsupported YAML version of the document")},TAG:function(t,e,r){var n,o;2!==r.length&&throwError(t,"TAG directive accepts exactly two arguments"),n=r[0],o=r[1],PATTERN_TAG_HANDLE.test(n)||throwError(t,"ill-formed tag handle (first argument) of the TAG directive"),___hasOwnProperty_10.call(t.tagMap,n)&&throwError(t,'there is a previously declared suffix for "'+n+'" tag handle'),PATTERN_TAG_URI.test(o)||throwError(t,"ill-formed tag prefix (second argument) of the TAG directive"),t.tagMap[n]=o}};function captureSegment(t,e,r,n){var o,i,a,u;if(e1&&(t.result+=_$common_7.repeat("\n",e-1))}function readBlockSequence(t,e){var r,n,o=t.tag,i=t.anchor,a=[],u=!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=a),n=t.input.charCodeAt(t.position);0!==n&&45===n&&is_WS_OR_EOL(t.input.charCodeAt(t.position+1));)if(u=!0,t.position++,skipSeparationSpace(t,!0,-1)&&t.lineIndent<=e)a.push(null),n=t.input.charCodeAt(t.position);else if(r=t.line,composeNode(t,e,CONTEXT_BLOCK_IN,!1,!0),a.push(t.result),skipSeparationSpace(t,!0,-1),n=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&0!==n)throwError(t,"bad indentation of a sequence entry");else if(t.lineIndente?h=1:t.lineIndent===e?h=0:t.lineIndente?h=1:t.lineIndent===e?h=0:t.lineIndente)&&(composeNode(t,e,CONTEXT_BLOCK_OUT,!0,o)&&(_?h=t.result:d=t.result),_||(storeMappingPair(t,f,l,p,h,d,i,a),p=h=d=null),skipSeparationSpace(t,!0,-1),u=t.input.charCodeAt(t.position)),t.lineIndent>e&&0!==u)throwError(t,"bad indentation of a mapping entry");else if(t.lineIndent=0))break;0===o?throwError(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?throwError(t,"repeat of an indentation width identifier"):(f=e+o-1,s=!0)}if(is_WHITE_SPACE(i)){do{i=t.input.charCodeAt(++t.position)}while(is_WHITE_SPACE(i));if(35===i)do{i=t.input.charCodeAt(++t.position)}while(!is_EOL(i)&&0!==i)}for(;0!==i;){for(readLineBreak(t),t.lineIndent=0,i=t.input.charCodeAt(t.position);(!s||t.lineIndentf&&(f=t.lineIndent),is_EOL(i))l++;else{if(t.lineIndent0){for(o=a,i=0;o>0;o--)(a=fromHexCode(u=t.input.charCodeAt(++t.position)))>=0?i=(i<<4)+a:throwError(t,"expected hexadecimal character");t.result+=charFromCodepoint(i),t.position++}else throwError(t,"unknown escape sequence");r=n=t.position}else is_EOL(u)?(captureSegment(t,r,n,!0),writeFoldedLines(t,skipSeparationSpace(t,!1,e)),r=n=t.position):t.position===t.lineStart&&testDocumentSeparator(t)?throwError(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}throwError(t,"unexpected end of the stream within a double quoted scalar")}(t,l)?_=!0:function(t){var e,r,n;if(42!==(n=t.input.charCodeAt(t.position)))return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;0!==n&&!is_WS_OR_EOL(n)&&!is_FLOW_INDICATOR(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&throwError(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),___hasOwnProperty_10.call(t.anchorMap,r)||throwError(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],skipSeparationSpace(t,!0,-1),!0}(t)?(_=!0,null===t.tag&&null===t.anchor||throwError(t,"alias node should not have any properties")):function(t,e,r){var n,o,i,a,u,c,s,f,l=t.kind,p=t.result;if(is_WS_OR_EOL(f=t.input.charCodeAt(t.position))||is_FLOW_INDICATOR(f)||35===f||38===f||42===f||33===f||124===f||62===f||39===f||34===f||37===f||64===f||96===f)return!1;if((63===f||45===f)&&(is_WS_OR_EOL(n=t.input.charCodeAt(t.position+1))||r&&is_FLOW_INDICATOR(n)))return!1;for(t.kind="scalar",t.result="",o=i=t.position,a=!1;0!==f;){if(58===f){if(is_WS_OR_EOL(n=t.input.charCodeAt(t.position+1))||r&&is_FLOW_INDICATOR(n))break}else if(35===f){if(is_WS_OR_EOL(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&testDocumentSeparator(t)||r&&is_FLOW_INDICATOR(f))break;if(is_EOL(f)){if(u=t.line,c=t.lineStart,s=t.lineIndent,skipSeparationSpace(t,!1,-1),t.lineIndent>=e){a=!0,f=t.input.charCodeAt(t.position);continue}t.position=i,t.line=u,t.lineStart=c,t.lineIndent=s;break}}a&&(captureSegment(t,o,i,!1),writeFoldedLines(t,t.line-u),o=i=t.position,a=!1),is_WHITE_SPACE(f)||(i=t.position+1),f=t.input.charCodeAt(++t.position)}return captureSegment(t,o,i,!1),!!t.result||(t.kind=l,t.result=p,!1)}(t,l,CONTEXT_FLOW_IN===r)&&(_=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===h&&(_=u&&readBlockSequence(t,p))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&throwError(t,'unacceptable node kind for ! tag; it should be "scalar", not "'+t.kind+'"'),c=0,s=t.implicitTypes.length;c tag; it should be "'+f.kind+'", not "'+t.kind+'"'),f.resolve(t.result)?(t.result=f.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):throwError(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):throwError(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||_}function readDocument(t){var e,r,n,o,i=t.position,a=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap={},t.anchorMap={};0!==(o=t.input.charCodeAt(t.position))&&(skipSeparationSpace(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==o));){for(a=!0,o=t.input.charCodeAt(++t.position),e=t.position;0!==o&&!is_WS_OR_EOL(o);)o=t.input.charCodeAt(++t.position);for(n=[],(r=t.input.slice(e,t.position)).length<1&&throwError(t,"directive name must not be less than one character in length");0!==o;){for(;is_WHITE_SPACE(o);)o=t.input.charCodeAt(++t.position);if(35===o){do{o=t.input.charCodeAt(++t.position)}while(0!==o&&!is_EOL(o));break}if(is_EOL(o))break;for(e=t.position;0!==o&&!is_WS_OR_EOL(o);)o=t.input.charCodeAt(++t.position);n.push(t.input.slice(e,t.position))}0!==o&&readLineBreak(t),___hasOwnProperty_10.call(directiveHandlers,r)?directiveHandlers[r](t,r,n):throwWarning(t,'unknown document directive "'+r+'"')}skipSeparationSpace(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,skipSeparationSpace(t,!0,-1)):a&&throwError(t,"directives end mark is expected"),composeNode(t,t.lineIndent-1,CONTEXT_BLOCK_OUT,!1,!0),skipSeparationSpace(t,!0,-1),t.checkLineBreaks&&PATTERN_NON_ASCII_LINE_BREAKS.test(t.input.slice(i,t.position))&&throwWarning(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&testDocumentSeparator(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,skipSeparationSpace(t,!0,-1)):t.position0?t.charCodeAt(i-1):null,h=h&&isPlainSafe(a,u)}else{for(i=0;in&&" "!==t[p+1],p=i);else if(!isPrintable(a))return STYLE_DOUBLE;u=i>0?t.charCodeAt(i-1):null,h=h&&isPlainSafe(a,u)}f=f||l&&i-p-1>n&&" "!==t[p+1]}return s||f?r>9&&needIndentIndicator(t)?STYLE_DOUBLE:f?STYLE_FOLDED:STYLE_LITERAL:h&&!o(t)?STYLE_PLAIN:STYLE_SINGLE}function writeScalar(t,e,r,n){t.dump=function(){if(0===e.length)return"''";if(!t.noCompatMode&&-1!==DEPRECATED_BOOLEANS_SYNTAX.indexOf(e))return"'"+e+"'";var o=t.indent*Math.max(1,r),i=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-o),a=n||t.flowLevel>-1&&r>=t.flowLevel;switch(chooseScalarStyle(e,a,t.indent,i,(function(e){return function(t,e){var r,n;for(r=0,n=t.implicitTypes.length;r"+blockHeader(e,t.indent)+dropEndingNewline(indentString(function(t,e){for(var r,n,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=t.indexOf("\n"))?o:t.length,i.lastIndex=o,foldLine(t.slice(0,o),e)),u="\n"===t[0]||" "===t[0];n=i.exec(t);){var c=n[1],s=n[2];r=" "===s[0],a+=c+(u||r||""===s?"":"\n")+foldLine(s,e),u=r}return a}(e,i),o));case STYLE_DOUBLE:return'"'+function(t){for(var e,r,n,o="",i=0;i=55296&&e<=56319&&(r=t.charCodeAt(i+1))>=56320&&r<=57343?(o+=encodeHex(1024*(e-55296)+r-56320+65536),i++):o+=!(n=ESCAPE_SEQUENCES[e])&&isPrintable(e)?t[i]:n||encodeHex(e);return o}(e)+'"';default:throw new _$exception_9("impossible error: invalid scalar style")}}()}function blockHeader(t,e){var r=needIndentIndicator(t)?String(e):"",n="\n"===t[t.length-1];return r+(!n||"\n"!==t[t.length-2]&&"\n"!==t?n?"":"-":"+")+"\n"}function dropEndingNewline(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function foldLine(t,e){if(""===t||" "===t[0])return t;for(var r,n,o=/ [^ ]/g,i=0,a=0,u=0,c="";r=o.exec(t);)(u=r.index)-i>e&&(n=a>i?a:u,c+="\n"+t.slice(i,n),i=n+1),a=u;return c+="\n",t.length-i>e&&a>i?c+=t.slice(i,a)+"\n"+t.slice(a+1):c+=t.slice(i),c.slice(1)}function detectType(t,e,r){var n,o,i,a,u,c;for(i=0,a=(o=r?t.explicitTypes:t.implicitTypes).length;i tag resolver accepts not "'+c+'" style');n=u.represent[c](e,c)}t.dump=n}return!0}return!1}function writeNode(t,e,r,n,o,i){t.tag=null,t.dump=r,detectType(t,r,!1)||detectType(t,r,!0);var a=___toString_8.call(t.dump);n&&(n=t.flowLevel<0||t.flowLevel>e);var u,c,s="[object Object]"===a||"[object Array]"===a;if(s&&(c=-1!==(u=t.duplicates.indexOf(r))),(null!==t.tag&&"?"!==t.tag||c||2!==t.indent&&e>0)&&(o=!1),c&&t.usedDuplicates[u])t.dump="*ref_"+u;else{if(s&&c&&!t.usedDuplicates[u]&&(t.usedDuplicates[u]=!0),"[object Object]"===a)n&&0!==Object.keys(t.dump).length?(function(t,e,r,n){var o,i,a,u,c,s,f="",l=t.tag,p=Object.keys(r);if(!0===t.sortKeys)p.sort();else if("function"==typeof t.sortKeys)p.sort(t.sortKeys);else if(t.sortKeys)throw new _$exception_9("sortKeys must be a boolean or a function");for(o=0,i=p.length;o1024)&&(t.dump&&CHAR_LINE_FEED===t.dump.charCodeAt(0)?s+="?":s+="? "),s+=t.dump,c&&(s+=generateNextLine(t,e)),writeNode(t,e+1,u,!0,c)&&(t.dump&&CHAR_LINE_FEED===t.dump.charCodeAt(0)?s+=":":s+=": ",f+=s+=t.dump));t.tag=l,t.dump=f||"{}"}(t,e,t.dump,o),c&&(t.dump="&ref_"+u+t.dump)):(function(t,e,r){var n,o,i,a,u,c="",s=t.tag,f=Object.keys(r);for(n=0,o=f.length;n1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),writeNode(t,e,a,!1,!1)&&(c+=u+=t.dump));t.tag=s,t.dump="{"+c+"}"}(t,e,t.dump),c&&(t.dump="&ref_"+u+" "+t.dump));else if("[object Array]"===a){var f=t.noArrayIndent&&e>0?e-1:e;n&&0!==t.dump.length?(function(t,e,r,n){var o,i,a="",u=t.tag;for(o=0,i=r.length;o "+t.dump)}return!0}function getDuplicateReferences(t,e){var r,n,o=[],i=[];for(function t(e,r,n){var o,i,a;if(null!==e&&"object"==typeof e)if(-1!==(i=r.indexOf(e)))-1===n.indexOf(i)&&n.push(i);else if(r.push(e),Array.isArray(e))for(i=0,a=e.length;i=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_41(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}Object.defineProperty(_$download_41,"__esModule",{value:!0}),_$download_41.default=function(t,e){return _download.apply(this,arguments)};var cache=new Map;function _download(){var t;return t=___regeneratorRuntime_41().mark((function t(e,r){var n,o,i;return ___regeneratorRuntime_41().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=(r=r||"Quantumult%20X/1.0.29 (iPhone14,5; iOS 15.4.1)")+e,!cache.has(n)){t.next=4;break}return t.abrupt("return",cache.get(n));case 4:return o=(0,_$openApi_44.HTTP)({headers:{"User-Agent":r}}),i=new Promise((function(t,r){o.get(e).then((function(e){var n=e.body;0===n.replace(/\s/g,"").length?r(new Error("\u8ba2\u9605\u5185\u5bb9\u4e3a\u7a7a\uff01")):t(n)}))})),cache.set(n,i),t.abrupt("return",i);case 8:case"end":return t.stop()}}),t)})),(_download=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_41(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_41(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}var _$logical_43={};function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0?o-4:o;for(r=0;r>16&255,a[u++]=e>>8&255,a[u++]=255&e;return 2===i&&(e=revLookup[t.charCodeAt(r)]<<2|revLookup[t.charCodeAt(r+1)]>>4,a[u++]=255&e),1===i&&(e=revLookup[t.charCodeAt(r)]<<10|revLookup[t.charCodeAt(r+1)]<<4|revLookup[t.charCodeAt(r+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e),a},fromByteArray:function(t){for(var e,r=t.length,n=r%3,o=[],i=0,a=r-n;ia?a:i+16383));return 1===n?(e=t[r-1],o.push(lookup[e>>2]+lookup[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),o.join("")}},lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",__i_1=0,len=code.length;__i_10)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function encodeChunk(t,e,r){for(var n,o,i=[],a=e;a>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]);return i.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var _$ieee754_3={read:function(t,e,r,n,o){var i,a,u=8*o-n-1,c=(1<>1,f=-7,l=r?o-1:0,p=r?-1:1,h=t[e+l];for(l+=p,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+t[e+l],l+=p,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=n;f>0;a=256*a+t[e+l],l+=p,f-=8);if(0===i)i=1-s;else{if(i===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),i-=s}return(h?-1:1)*a*Math.pow(2,i-n)},write:function(t,e,r,n,o,i){var a,u,c,s=8*i-o-1,f=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,d=n?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=f?(u=0,a=f):a+l>=1?(u=(e*c-1)*Math.pow(2,o),a+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,o),a=0));o>=8;t[r+h]=255&u,h+=d,u/=256,o-=8);for(a=a<0;t[r+h]=255&a,h+=d,a/=256,s-=8);t[r+h-d]|=128*_}},_$base64_4={exports:{}};(function(t,e){(function(){!function(t,e){var r,n;"object"==typeof _$base64_4.exports?_$base64_4.exports=e():"function"==typeof define&&define.amd?define(e):(r=t.Base64,(n=e()).noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:this,(function(){"use strict";var t,r="function"==typeof atob,n="function"==typeof btoa,o="function"==typeof e,i="function"==typeof TextDecoder?new TextDecoder:void 0,a="function"==typeof TextEncoder?new TextEncoder:void 0,u=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),c=(t={},u.forEach((function(e,r){return t[e]=r})),t),s=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,f=String.fromCharCode.bind(String),l="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t,e){return void 0===e&&(e=function(t){return t}),new Uint8Array(Array.prototype.slice.call(t,0).map(e))},p=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},h=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},d=function(t){for(var e,r,n,o,i="",a=t.length%3,c=0;c255||(n=t.charCodeAt(c++))>255||(o=t.charCodeAt(c++))>255)throw new TypeError("invalid character found");i+=u[(e=r<<16|n<<8|o)>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}return a?i.slice(0,a-3)+"===".substring(a):i},_=n?function(t){return btoa(t)}:o?function(t){return e.from(t,"binary").toString("base64")}:d,v=o?function(t){return e.from(t).toString("base64")}:function(t){for(var e=[],r=0,n=t.length;r>>6)+f(128|63&e):f(224|e>>>12&15)+f(128|e>>>6&63)+f(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return f(240|e>>>18&7)+f(128|e>>>12&63)+f(128|e>>>6&63)+f(128|63&e)},m=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,w=function(t){return t.replace(m,g)},b=o?function(t){return e.from(t,"utf8").toString("base64")}:a?function(t){return v(a.encode(t))}:function(t){return _(w(t))},E=function(t,e){return void 0===e&&(e=!1),e?p(b(t)):b(t)},A=function(t){return E(t,!0)},S=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,O=function(t){switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return f(55296+(e>>>10))+f(56320+(1023&e));case 3:return f((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return f((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},x=function(t){return t.replace(S,O)},R=function(t){if(t=t.replace(/\s+/g,""),!s.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var e,r,n,o="",i=0;i>16&255):64===n?f(e>>16&255,e>>8&255):f(e>>16&255,e>>8&255,255&e);return o},L=r?function(t){return atob(h(t))}:o?function(t){return e.from(t,"base64").toString("binary")}:R,C=o?function(t){return l(e.from(t,"base64"))}:function(t){return l(L(t),(function(t){return t.charCodeAt(0)}))},T=function(t){return C(I(t))},k=o?function(t){return e.from(t,"base64").toString("utf8")}:i?function(t){return i.decode(C(t))}:function(t){return x(L(t))},I=function(t){return h(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},N=function(t){return k(I(t))},P=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},$=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,P(e))};t("fromBase64",(function(){return N(this)})),t("toBase64",(function(t){return E(this,t)})),t("toBase64URI",(function(){return E(this,!0)})),t("toBase64URL",(function(){return E(this,!0)})),t("toUint8Array",(function(){return T(this)}))},j=function(){var t=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,P(e))};t("toBase64",(function(t){return y(this,t)})),t("toBase64URI",(function(){return y(this,!0)})),t("toBase64URL",(function(){return y(this,!0)}))},U={version:"3.7.2",VERSION:"3.7.2",atob:L,atobPolyfill:R,btoa:_,btoaPolyfill:d,fromBase64:N,toBase64:E,encode:E,encodeURI:A,encodeURL:A,utob:w,btou:x,decode:N,isValid:function(t){if("string"!=typeof t)return!1;var e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},fromUint8Array:y,toUint8Array:T,extendString:$,extendUint8Array:j,extendBuiltins:function(){$(),j()},Base64:{}};return Object.keys(U).forEach((function(t){return U.Base64[t]=U[t]})),U}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_$buffer_2({}).Buffer),_$base64_4=_$base64_4.exports;var _$lodash_35={exports:{}};(function(t){(function(){(function(){var e="Expected a function",r="__lodash_placeholder__",n=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],o="[object Arguments]",i="[object Array]",a="[object Boolean]",u="[object Date]",c="[object Error]",s="[object Function]",f="[object GeneratorFunction]",l="[object Map]",p="[object Number]",h="[object Object]",d="[object RegExp]",_="[object Set]",v="[object String]",y="[object Symbol]",g="[object WeakMap]",m="[object ArrayBuffer]",w="[object DataView]",b="[object Float32Array]",E="[object Float64Array]",A="[object Int8Array]",S="[object Int16Array]",O="[object Int32Array]",x="[object Uint8Array]",R="[object Uint16Array]",L="[object Uint32Array]",C=/\b__p \+= '';/g,T=/\b(__p \+=) '' \+/g,k=/(__e\(.*?\)|\b__t\)) \+\n'';/g,I=/&(?:amp|lt|gt|quot|#39);/g,N=/[&<>"']/g,P=RegExp(I.source),$=RegExp(N.source),j=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,F=/<%=([\s\S]+?)%>/g,D=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,M=/^\w*$/,B=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,H=/[\\^$.*+?()[\]{}|]/g,Y=RegExp(H.source),G=/^\s+/,W=/\s/,K=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,z=/\{\n\/\* \[wrapped with (.+)\] \*/,J=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,q=/[()=,{}\[\]\/\s]/,V=/\\(\\)?/g,Q=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Z=/\w*$/,tt=/^[-+]0x[0-9a-f]+$/i,et=/^0b[01]+$/i,rt=/^\[object .+?Constructor\]$/,nt=/^0o[0-7]+$/i,ot=/^(?:0|[1-9]\d*)$/,it=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,at=/($^)/,ut=/['\n\r\u2028\u2029\\]/g,ct="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",st="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ft="["+st+"]",lt="["+ct+"]",pt="\\d+",ht="[a-z\\xdf-\\xf6\\xf8-\\xff]",dt="[^\\ud800-\\udfff"+st+pt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",_t="\\ud83c[\\udffb-\\udfff]",vt="[^\\ud800-\\udfff]",yt="(?:\\ud83c[\\udde6-\\uddff]){2}",gt="[\\ud800-\\udbff][\\udc00-\\udfff]",mt="[A-Z\\xc0-\\xd6\\xd8-\\xde]",wt="(?:"+ht+"|"+dt+")",bt="(?:"+mt+"|"+dt+")",Et="(?:"+lt+"|"+_t+")?",At="[\\ufe0e\\ufe0f]?"+Et+"(?:\\u200d(?:"+[vt,yt,gt].join("|")+")[\\ufe0e\\ufe0f]?"+Et+")*",St="(?:"+["[\\u2700-\\u27bf]",yt,gt].join("|")+")"+At,Ot="(?:"+[vt+lt+"?",lt,yt,gt,"[\\ud800-\\udfff]"].join("|")+")",xt=RegExp("['\u2019]","g"),Rt=RegExp(lt,"g"),Lt=RegExp(_t+"(?="+_t+")|"+Ot+At,"g"),Ct=RegExp([mt+"?"+ht+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?="+[ft,mt,"$"].join("|")+")",bt+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?="+[ft,mt+wt,"$"].join("|")+")",mt+"?"+wt+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?",mt+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",pt,St].join("|"),"g"),Tt=RegExp("[\\u200d\\ud800-\\udfff"+ct+"\\ufe0e\\ufe0f]"),kt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,It=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Nt=-1,Pt={};Pt[b]=Pt[E]=Pt[A]=Pt[S]=Pt[O]=Pt[x]=Pt["[object Uint8ClampedArray]"]=Pt[R]=Pt[L]=!0,Pt[o]=Pt[i]=Pt[m]=Pt[a]=Pt[w]=Pt[u]=Pt[c]=Pt[s]=Pt[l]=Pt[p]=Pt[h]=Pt[d]=Pt[_]=Pt[v]=Pt[g]=!1;var $t={};$t[o]=$t[i]=$t[m]=$t[w]=$t[a]=$t[u]=$t[b]=$t[E]=$t[A]=$t[S]=$t[O]=$t[l]=$t[p]=$t[h]=$t[d]=$t[_]=$t[v]=$t[y]=$t[x]=$t["[object Uint8ClampedArray]"]=$t[R]=$t[L]=!0,$t[c]=$t[s]=$t[g]=!1;var jt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ut=parseFloat,Ft=parseInt,Dt="object"==typeof t&&t&&t.Object===Object&&t,Mt="object"==typeof self&&self&&self.Object===Object&&self,Bt=Dt||Mt||Function("return this")(),Ht="object"==typeof _$lodash_35.exports&&_$lodash_35.exports&&!_$lodash_35.exports.nodeType&&_$lodash_35.exports,Yt=Ht&&_$lodash_35&&!_$lodash_35.nodeType&&_$lodash_35,Gt=Yt&&Yt.exports===Ht,Wt=Gt&&Dt.process,Kt=function(){try{return Yt&&Yt.require&&Yt.require("util").types||Wt&&Wt.binding&&Wt.binding("util")}catch(t){}}(),zt=Kt&&Kt.isArrayBuffer,Jt=Kt&&Kt.isDate,Xt=Kt&&Kt.isMap,qt=Kt&&Kt.isRegExp,Vt=Kt&&Kt.isSet,Qt=Kt&&Kt.isTypedArray;function Zt(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function te(t,e,r,n){for(var o=-1,i=null==t?0:t.length;++o-1}function ae(t,e,r){for(var n=-1,o=null==t?0:t.length;++n-1;);return r}function Ce(t,e){for(var r=t.length;r--&&_e(e,t[r],0)>-1;);return r}var Te=we({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),ke=we({"&":"&","<":"<",">":">",'"':""","'":"'"});function Ie(t){return"\\"+jt[t]}function Ne(t){return Tt.test(t)}function Pe(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function $e(t,e){return function(r){return t(e(r))}}function je(t,e){for(var n=-1,o=t.length,i=0,a=[];++n",""":'"',"'":"'"}),Ye=function t(W){var ct,st=(W=null==W?Bt:Ye.defaults(Bt.Object(),W,Ye.pick(Bt,It))).Array,ft=W.Date,lt=W.Error,pt=W.Function,ht=W.Math,dt=W.Object,_t=W.RegExp,vt=W.String,yt=W.TypeError,gt=st.prototype,mt=pt.prototype,wt=dt.prototype,bt=W["__core-js_shared__"],Et=mt.toString,At=wt.hasOwnProperty,St=0,Ot=(ct=/[^.]+$/.exec(bt&&bt.keys&&bt.keys.IE_PROTO||""))?"Symbol(src)_1."+ct:"",Lt=wt.toString,Tt=Et.call(dt),jt=Bt._,Dt=_t("^"+Et.call(At).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mt=Gt?W.Buffer:void 0,Ht=W.Symbol,Yt=W.Uint8Array,Wt=Mt?Mt.allocUnsafe:void 0,Kt=$e(dt.getPrototypeOf,dt),pe=dt.create,we=wt.propertyIsEnumerable,Ge=gt.splice,We=Ht?Ht.isConcatSpreadable:void 0,Ke=Ht?Ht.iterator:void 0,ze=Ht?Ht.toStringTag:void 0,Je=function(){try{var t=Zo(dt,"defineProperty");return t({},"",{}),t}catch(e){}}(),Xe=W.clearTimeout!==Bt.clearTimeout&&W.clearTimeout,qe=ft&&ft.now!==Bt.Date.now&&ft.now,Ve=W.setTimeout!==Bt.setTimeout&&W.setTimeout,Qe=ht.ceil,Ze=ht.floor,tr=dt.getOwnPropertySymbols,er=Mt?Mt.isBuffer:void 0,rr=W.isFinite,nr=gt.join,or=$e(dt.keys,dt),ir=ht.max,ar=ht.min,ur=ft.now,cr=W.parseInt,sr=ht.random,fr=gt.reverse,lr=Zo(W,"DataView"),pr=Zo(W,"Map"),hr=Zo(W,"Promise"),dr=Zo(W,"Set"),_r=Zo(W,"WeakMap"),vr=Zo(dt,"create"),yr=_r&&new _r,gr={},mr=Oi(lr),wr=Oi(pr),br=Oi(hr),Er=Oi(dr),Ar=Oi(_r),Sr=Ht?Ht.prototype:void 0,Or=Sr?Sr.valueOf:void 0,xr=Sr?Sr.toString:void 0;function Rr(t){if(Ha(t)&&!ka(t)&&!(t instanceof kr)){if(t instanceof Tr)return t;if(At.call(t,"__wrapped__"))return xi(t)}return new Tr(t)}var Lr=function(){function t(){}return function(e){if(!Ba(e))return{};if(pe)return pe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Cr(){}function Tr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function kr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Ir(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function Xr(t,e,r,n,i,c){var g,C=1&e,T=2&e,k=4&e;if(r&&(g=i?r(t,n,i,c):r(t)),void 0!==g)return g;if(!Ba(t))return t;var I=ka(t);if(I){if(g=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&At.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!C)return yo(t,g)}else{var N=ri(t),P=N==s||N==f;if($a(t))return fo(t,C);if(N==h||N==o||P&&!i){if(g=T||P?{}:oi(t),!C)return T?function(t,e){return go(t,ei(t),e)}(t,function(t,e){return t&&go(e,mu(e),t)}(g,t)):function(t,e){return go(t,ti(t),e)}(t,Wr(g,t))}else{if(!$t[N])return i?t:{};g=function(t,e,r){var n,o,i,c=t.constructor;switch(e){case m:return lo(t);case a:case u:return new c(+t);case w:return function(t,e){var r=e?lo(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case b:case E:case A:case S:case O:case x:case"[object Uint8ClampedArray]":case R:case L:return po(t,r);case l:return new c;case p:case v:return new c(t);case d:return(i=new(o=t).constructor(o.source,Z.exec(o))).lastIndex=o.lastIndex,i;case _:return new c;case y:return n=t,Or?dt(Or.call(n)):{}}}(t,N,C)}}c||(c=new jr);var $=c.get(t);if($)return $;c.set(t,g),za(t)?t.forEach((function(n){g.add(Xr(n,e,r,n,t,c))})):Ya(t)&&t.forEach((function(n,o){g.set(o,Xr(n,e,r,o,t,c))}));var j=I?void 0:(k?T?Ko:Wo:T?mu:gu)(t);return ee(j||t,(function(n,o){j&&(n=t[o=n]),Hr(g,o,Xr(n,e,r,o,t,c))})),g}function qr(t,e,r){var n=r.length;if(null==t)return!n;for(t=dt(t);n--;){var o=r[n],i=e[o],a=t[o];if(void 0===a&&!(o in t)||!i(a))return!1}return!0}function Vr(t,r,n){if("function"!=typeof t)throw new yt(e);return gi((function(){t.apply(void 0,n)}),r)}function Qr(t,e,r,n){var o=-1,i=ie,a=!0,u=t.length,c=[],s=e.length;if(!u)return c;r&&(e=ue(e,Oe(r))),n?(i=ae,a=!1):e.length>=200&&(i=Re,a=!1,e=new $r(e));t:for(;++o-1},Nr.prototype.set=function(t,e){var r=this.__data__,n=Yr(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},Pr.prototype.clear=function(){this.size=0,this.__data__={hash:new Ir,map:new(pr||Nr),string:new Ir}},Pr.prototype.delete=function(t){var e=Vo(this,t).delete(t);return this.size-=e?1:0,e},Pr.prototype.get=function(t){return Vo(this,t).get(t)},Pr.prototype.has=function(t){return Vo(this,t).has(t)},Pr.prototype.set=function(t,e){var r=Vo(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},$r.prototype.add=$r.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},$r.prototype.has=function(t){return this.__data__.has(t)},jr.prototype.clear=function(){this.__data__=new Nr,this.size=0},jr.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},jr.prototype.get=function(t){return this.__data__.get(t)},jr.prototype.has=function(t){return this.__data__.has(t)},jr.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Nr){var n=r.__data__;if(!pr||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Pr(n)}return r.set(t,e),this.size=r.size,this};var Zr=bo(cn),tn=bo(sn,!0);function en(t,e){var r=!0;return Zr(t,(function(t,n,o){return r=!!e(t,n,o)})),r}function rn(t,e,r){for(var n=-1,o=t.length;++n0&&r(u)?e>1?on(u,e-1,r,n,o):ce(o,u):n||(o[o.length]=u)}return o}var an=Eo(),un=Eo(!0);function cn(t,e){return t&&an(t,e,gu)}function sn(t,e){return t&&un(t,e,gu)}function fn(t,e){return oe(e,(function(e){return Fa(t[e])}))}function ln(t,e){for(var r=0,n=(e=ao(e,t)).length;null!=t&&re}function _n(t,e){return null!=t&&At.call(t,e)}function vn(t,e){return null!=t&&e in dt(t)}function yn(t,e,r){for(var n=r?ae:ie,o=t[0].length,i=t.length,a=i,u=st(i),c=1/0,s=[];a--;){var f=t[a];a&&e&&(f=ue(f,Oe(e))),c=ar(f.length,c),u[a]=!r&&(e||o>=120&&f.length>=120)?new $r(a&&f):void 0}f=t[0];var l=-1,p=u[0];t:for(;++l=u?c:c*("desc"==r[n]?-1:1)}return t.index-e.index}(t,e,r)}));n--;)t[n]=t[n].value;return t}(xn(t,(function(t,r,o){return{criteria:ue(e,(function(e){return e(t)})),index:++n,value:t}})))}function In(t,e,r){for(var n=-1,o=e.length,i={};++n-1;)u!==t&&Ge.call(u,c,1),Ge.call(t,c,1);return t}function Pn(t,e){for(var r=t?e.length:0,n=r-1;r--;){var o=e[r];if(r==n||o!==i){var i=o;ai(o)?Ge.call(t,o,1):Qn(t,o)}}return t}function $n(t,e){return t+Ze(sr()*(e-t+1))}function jn(t,e){var r="";if(!t||e<1||e>9007199254740991)return r;do{e%2&&(r+=t),(e=Ze(e/2))&&(t+=t)}while(e);return r}function Un(t,e){return mi(di(t,e,Gu),t+"")}function Fn(t){return Fr(Ru(t))}function Dn(t,e){var r=Ru(t);return Ei(r,Jr(e,0,r.length))}function Mn(t,e,r,n){if(!Ba(t))return t;for(var o=-1,i=(e=ao(e,t)).length,a=i-1,u=t;null!=u&&++oo?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=st(o);++n>>1,a=t[i];null!==a&&!Xa(a)&&(r?a<=e:a=200){var s=e?null:Uo(t);if(s)return Ue(s);a=!1,o=Re,c=new $r}else c=e?[]:u;t:for(;++n=n?t:Gn(t,e,r)}var so=Xe||function(t){return Bt.clearTimeout(t)};function fo(t,e){if(e)return t.slice();var r=t.length,n=Wt?Wt(r):new t.constructor(r);return t.copy(n),n}function lo(t){var e=new t.constructor(t.byteLength);return new Yt(e).set(new Yt(t)),e}function po(t,e){var r=e?lo(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function ho(t,e){if(t!==e){var r=void 0!==t,n=null===t,o=t==t,i=Xa(t),a=void 0!==e,u=null===e,c=e==e,s=Xa(e);if(!u&&!s&&!i&&t>e||i&&a&&c&&!u&&!s||n&&a&&c||!r&&c||!o)return 1;if(!n&&!i&&!s&&t1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,a&&ui(r[0],r[1],a)&&(i=o<3?void 0:i,o=1),e=dt(e);++n-1?o[i?e[a]:a]:void 0}}function Ro(t){return Go((function(r){var n=r.length,o=n,i=Tr.prototype.thru;for(t&&r.reverse();o--;){var a=r[o];if("function"!=typeof a)throw new yt(e);if(i&&!u&&"wrapper"==Jo(a))var u=new Tr([],!0)}for(o=u?o:n;++o1&&g.reverse(),f&&cu))return!1;var s=i.get(t),f=i.get(e);if(s&&f)return s==e&&f==t;var l=-1,p=!0,h=2&r?new $r:void 0;for(i.set(t,e),i.set(e,t);++l-1&&t%1==0&&t1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(K,"{\n/* [wrapped with "+e+"] */\n")}(o,function(t,e){return ee(n,(function(r){var n="_."+r[0];e&r[1]&&!ie(t,n)&&t.push(n)})),t.sort()}(function(t){var e=t.match(z);return e?e[1].split(J):[]}(o),r)))}function bi(t){var e=0,r=0;return function(){var n=ur(),o=16-(n-r);if(r=n,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Ei(t,e){var r=-1,n=t.length,o=n-1;for(e=void 0===e?n:e;++r1?t[e-1]:void 0;return r="function"==typeof r?(t.pop(),r):void 0,Ki(t,r)}));function Zi(t){var e=Rr(t);return e.__chain__=!0,e}function ta(t,e){return e(t)}var ea=Go((function(t){var e=t.length,r=e?t[0]:0,n=this.__wrapped__,o=function(e){return zr(e,t)};return!(e>1||this.__actions__.length)&&n instanceof kr&&ai(r)?((n=n.slice(r,+r+(e?1:0))).__actions__.push({func:ta,args:[o],thisArg:void 0}),new Tr(n,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(o)})),ra=mo((function(t,e,r){At.call(t,r)?++t[r]:Kr(t,r,1)})),na=xo(Ti),oa=xo(ki);function ia(t,e){return(ka(t)?ee:Zr)(t,qo(e,3))}function aa(t,e){return(ka(t)?re:tn)(t,qo(e,3))}var ua=mo((function(t,e,r){At.call(t,r)?t[r].push(e):Kr(t,r,[e])})),ca=Un((function(t,e,r){var n=-1,o="function"==typeof e,i=Na(t)?st(t.length):[];return Zr(t,(function(t){i[++n]=o?Zt(e,t,r):gn(t,e,r)})),i})),sa=mo((function(t,e,r){Kr(t,r,e)}));function fa(t,e){return(ka(t)?ue:xn)(t,qo(e,3))}var la=mo((function(t,e,r){t[r?0:1].push(e)}),(function(){return[[],[]]})),pa=Un((function(t,e){if(null==t)return[];var r=e.length;return r>1&&ui(t,e[0],e[1])?e=[]:r>2&&ui(e[0],e[1],e[2])&&(e=[e[0]]),kn(t,on(e,1),[])})),ha=qe||function(){return Bt.Date.now()};function da(t,e,r){return e=r?void 0:e,Do(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function _a(t,r){var n;if("function"!=typeof r)throw new yt(e);return t=eu(t),function(){return--t>0&&(n=r.apply(this,arguments)),t<=1&&(r=void 0),n}}var va=Un((function(t,e,r){var n=1;if(r.length){var o=je(r,Xo(va));n|=32}return Do(t,n,e,r,o)})),ya=Un((function(t,e,r){var n=3;if(r.length){var o=je(r,Xo(ya));n|=32}return Do(e,n,t,r,o)}));function ga(t,r,n){var o,i,a,u,c,s,f=0,l=!1,p=!1,h=!0;if("function"!=typeof t)throw new yt(e);function d(e){var r=o,n=i;return o=i=void 0,f=e,u=t.apply(n,r)}function _(t){var e=t-s;return void 0===s||e>=r||e<0||p&&t-f>=a}function v(){var t=ha();if(_(t))return y(t);c=gi(v,function(t){var e=r-(t-s);return p?ar(e,a-(t-f)):e}(t))}function y(t){return c=void 0,h&&o?d(t):(o=i=void 0,u)}function g(){var t=ha(),e=_(t);if(o=arguments,i=this,s=t,e){if(void 0===c)return function(t){return f=t,c=gi(v,r),l?d(t):u}(s);if(p)return so(c),c=gi(v,r),d(s)}return void 0===c&&(c=gi(v,r)),u}return r=nu(r)||0,Ba(n)&&(l=!!n.leading,a=(p="maxWait"in n)?ir(nu(n.maxWait)||0,r):a,h="trailing"in n?!!n.trailing:h),g.cancel=function(){void 0!==c&&so(c),f=0,o=s=i=c=void 0},g.flush=function(){return void 0===c?u:y(ha())},g}var ma=Un((function(t,e){return Vr(t,1,e)})),wa=Un((function(t,e,r){return Vr(t,nu(e)||0,r)}));function ba(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new yt(e);var n=function(){var e=arguments,o=r?r.apply(this,e):e[0],i=n.cache;if(i.has(o))return i.get(o);var a=t.apply(this,e);return n.cache=i.set(o,a)||i,a};return n.cache=new(ba.Cache||Pr),n}function Ea(t){if("function"!=typeof t)throw new yt(e);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ba.Cache=Pr;var Aa=uo((function(t,e){var r=(e=1==e.length&&ka(e[0])?ue(e[0],Oe(qo())):ue(on(e,1),Oe(qo()))).length;return Un((function(n){for(var o=-1,i=ar(n.length,r);++o=e})),Ta=mn(function(){return arguments}())?mn:function(t){return Ha(t)&&At.call(t,"callee")&&!we.call(t,"callee")},ka=st.isArray,Ia=zt?Oe(zt):function(t){return Ha(t)&&hn(t)==m};function Na(t){return null!=t&&Ma(t.length)&&!Fa(t)}function Pa(t){return Ha(t)&&Na(t)}var $a=er||nc,ja=Jt?Oe(Jt):function(t){return Ha(t)&&hn(t)==u};function Ua(t){if(!Ha(t))return!1;var e=hn(t);return e==c||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Wa(t)}function Fa(t){if(!Ba(t))return!1;var e=hn(t);return e==s||e==f||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Da(t){return"number"==typeof t&&t==eu(t)}function Ma(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Ba(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ha(t){return null!=t&&"object"==typeof t}var Ya=Xt?Oe(Xt):function(t){return Ha(t)&&ri(t)==l};function Ga(t){return"number"==typeof t||Ha(t)&&hn(t)==p}function Wa(t){if(!Ha(t)||hn(t)!=h)return!1;var e=Kt(t);if(null===e)return!0;var r=At.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Et.call(r)==Tt}var Ka=qt?Oe(qt):function(t){return Ha(t)&&hn(t)==d},za=Vt?Oe(Vt):function(t){return Ha(t)&&ri(t)==_};function Ja(t){return"string"==typeof t||!ka(t)&&Ha(t)&&hn(t)==v}function Xa(t){return"symbol"==typeof t||Ha(t)&&hn(t)==y}var qa=Qt?Oe(Qt):function(t){return Ha(t)&&Ma(t.length)&&!!Pt[hn(t)]},Va=Po(On),Qa=Po((function(t,e){return t<=e}));function Za(t){if(!t)return[];if(Na(t))return Ja(t)?Me(t):yo(t);if(Ke&&t[Ke])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[Ke]());var e=ri(t);return(e==l?Pe:e==_?Ue:Ru)(t)}function tu(t){return t?(t=nu(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function eu(t){var e=tu(t),r=e%1;return e==e?r?e-r:e:0}function ru(t){return t?Jr(eu(t),0,4294967295):0}function nu(t){if("number"==typeof t)return t;if(Xa(t))return NaN;if(Ba(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ba(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Se(t);var r=et.test(t);return r||nt.test(t)?Ft(t.slice(2),r?2:8):tt.test(t)?NaN:+t}function ou(t){return go(t,mu(t))}function iu(t){return null==t?"":qn(t)}var au=wo((function(t,e){if(li(e)||Na(e))go(e,gu(e),t);else for(var r in e)At.call(e,r)&&Hr(t,r,e[r])})),uu=wo((function(t,e){go(e,mu(e),t)})),cu=wo((function(t,e,r,n){go(e,mu(e),t,n)})),su=wo((function(t,e,r,n){go(e,gu(e),t,n)})),fu=Go(zr),lu=Un((function(t,e){t=dt(t);var r=-1,n=e.length,o=n>2?e[2]:void 0;for(o&&ui(e[0],e[1],o)&&(n=1);++r1),e})),go(t,Ko(t),r),n&&(r=Xr(r,7,Ho));for(var o=e.length;o--;)Qn(r,e[o]);return r})),Au=Go((function(t,e){return null==t?{}:function(t,e){return In(t,e,(function(e,r){return du(t,r)}))}(t,e)}));function Su(t,e){if(null==t)return{};var r=ue(Ko(t),(function(t){return[t]}));return e=qo(e),In(t,r,(function(t,r){return e(t,r[0])}))}var Ou=Fo(gu),xu=Fo(mu);function Ru(t){return null==t?[]:xe(t,gu(t))}var Lu=So((function(t,e,r){return e=e.toLowerCase(),t+(r?Cu(e):e)}));function Cu(t){return Uu(iu(t).toLowerCase())}function Tu(t){return(t=iu(t))&&t.replace(it,Te).replace(Rt,"")}var ku=So((function(t,e,r){return t+(r?"-":"")+e.toLowerCase()})),Iu=So((function(t,e,r){return t+(r?" ":"")+e.toLowerCase()})),Nu=Ao("toLowerCase"),Pu=So((function(t,e,r){return t+(r?"_":"")+e.toLowerCase()})),$u=So((function(t,e,r){return t+(r?" ":"")+Uu(e)})),ju=So((function(t,e,r){return t+(r?" ":"")+e.toUpperCase()})),Uu=Ao("toUpperCase");function Fu(t,e,r){return t=iu(t),void 0===(e=r?void 0:e)?function(t){return kt.test(t)}(t)?function(t){return t.match(Ct)||[]}(t):function(t){return t.match(X)||[]}(t):t.match(e)||[]}var Du=Un((function(t,e){try{return Zt(t,void 0,e)}catch(r){return Ua(r)?r:new lt(r)}})),Mu=Go((function(t,e){return ee(e,(function(e){e=Si(e),Kr(t,e,va(t[e],t))})),t}));function Bu(t){return function(){return t}}var Hu=Ro(),Yu=Ro(!0);function Gu(t){return t}function Wu(t){return An("function"==typeof t?t:Xr(t,1))}var Ku=Un((function(t,e){return function(r){return gn(r,t,e)}})),zu=Un((function(t,e){return function(r){return gn(t,r,e)}}));function Ju(t,e,r){var n=gu(e),o=fn(e,n);null!=r||Ba(e)&&(o.length||!n.length)||(r=e,e=t,t=this,o=fn(e,gu(e)));var i=!(Ba(r)&&"chain"in r&&!r.chain),a=Fa(t);return ee(o,(function(r){var n=e[r];t[r]=n,a&&(t.prototype[r]=function(){var e=this.__chain__;if(i||e){var r=t(this.__wrapped__);return(r.__actions__=yo(this.__actions__)).push({func:n,args:arguments,thisArg:t}),r.__chain__=e,r}return n.apply(t,ce([this.value()],arguments))})})),t}function Xu(){}var qu=ko(ue),Vu=ko(ne),Qu=ko(le);function Zu(t){return ci(t)?me(Si(t)):function(t){return function(e){return ln(e,t)}}(t)}var tc=No(),ec=No(!0);function rc(){return[]}function nc(){return!1}var oc,ic=To((function(t,e){return t+e}),0),ac=jo("ceil"),uc=To((function(t,e){return t/e}),1),cc=jo("floor"),sc=To((function(t,e){return t*e}),1),fc=jo("round"),lc=To((function(t,e){return t-e}),0);return Rr.after=function(t,r){if("function"!=typeof r)throw new yt(e);return t=eu(t),function(){if(--t<1)return r.apply(this,arguments)}},Rr.ary=da,Rr.assign=au,Rr.assignIn=uu,Rr.assignInWith=cu,Rr.assignWith=su,Rr.at=fu,Rr.before=_a,Rr.bind=va,Rr.bindAll=Mu,Rr.bindKey=ya,Rr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return ka(t)?t:[t]},Rr.chain=Zi,Rr.chunk=function(t,e,r){e=(r?ui(t,e,r):void 0===e)?1:ir(eu(e),0);var n=null==t?0:t.length;if(!n||e<1)return[];for(var o=0,i=0,a=st(Qe(n/e));oo?0:o+r),(n=void 0===n||n>o?o:eu(n))<0&&(n+=o),n=r>n?0:ru(n);r>>0)?(t=iu(t))&&("string"==typeof e||null!=e&&!Ka(e))&&!(e=qn(e))&&Ne(t)?co(Me(t),0,r):t.split(e,r):[]},Rr.spread=function(t,r){if("function"!=typeof t)throw new yt(e);return r=null==r?0:ir(eu(r),0),Un((function(e){var n=e[r],o=co(e,0,r);return n&&ce(o,n),Zt(t,this,o)}))},Rr.tail=function(t){var e=null==t?0:t.length;return e?Gn(t,1,e):[]},Rr.take=function(t,e,r){return t&&t.length?Gn(t,0,(e=r||void 0===e?1:eu(e))<0?0:e):[]},Rr.takeRight=function(t,e,r){var n=null==t?0:t.length;return n?Gn(t,(e=n-(e=r||void 0===e?1:eu(e)))<0?0:e,n):[]},Rr.takeRightWhile=function(t,e){return t&&t.length?to(t,qo(e,3),!1,!0):[]},Rr.takeWhile=function(t,e){return t&&t.length?to(t,qo(e,3)):[]},Rr.tap=function(t,e){return e(t),t},Rr.throttle=function(t,r,n){var o=!0,i=!0;if("function"!=typeof t)throw new yt(e);return Ba(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),ga(t,r,{leading:o,maxWait:r,trailing:i})},Rr.thru=ta,Rr.toArray=Za,Rr.toPairs=Ou,Rr.toPairsIn=xu,Rr.toPath=function(t){return ka(t)?ue(t,Si):Xa(t)?[t]:yo(Ai(iu(t)))},Rr.toPlainObject=ou,Rr.transform=function(t,e,r){var n=ka(t),o=n||$a(t)||qa(t);if(e=qo(e,4),null==r){var i=t&&t.constructor;r=o?n?new i:[]:Ba(t)&&Fa(i)?Lr(Kt(t)):{}}return(o?ee:cn)(t,(function(t,n,o){return e(r,t,n,o)})),r},Rr.unary=function(t){return da(t,1)},Rr.union=Hi,Rr.unionBy=Yi,Rr.unionWith=Gi,Rr.uniq=function(t){return t&&t.length?Vn(t):[]},Rr.uniqBy=function(t,e){return t&&t.length?Vn(t,qo(e,2)):[]},Rr.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Vn(t,void 0,e):[]},Rr.unset=function(t,e){return null==t||Qn(t,e)},Rr.unzip=Wi,Rr.unzipWith=Ki,Rr.update=function(t,e,r){return null==t?t:Zn(t,e,io(r))},Rr.updateWith=function(t,e,r,n){return n="function"==typeof n?n:void 0,null==t?t:Zn(t,e,io(r),n)},Rr.values=Ru,Rr.valuesIn=function(t){return null==t?[]:xe(t,mu(t))},Rr.without=zi,Rr.words=Fu,Rr.wrap=function(t,e){return Sa(io(e),t)},Rr.xor=Ji,Rr.xorBy=Xi,Rr.xorWith=qi,Rr.zip=Vi,Rr.zipObject=function(t,e){return no(t||[],e||[],Hr)},Rr.zipObjectDeep=function(t,e){return no(t||[],e||[],Mn)},Rr.zipWith=Qi,Rr.entries=Ou,Rr.entriesIn=xu,Rr.extend=uu,Rr.extendWith=cu,Ju(Rr,Rr),Rr.add=ic,Rr.attempt=Du,Rr.camelCase=Lu,Rr.capitalize=Cu,Rr.ceil=ac,Rr.clamp=function(t,e,r){return void 0===r&&(r=e,e=void 0),void 0!==r&&(r=(r=nu(r))==r?r:0),void 0!==e&&(e=(e=nu(e))==e?e:0),Jr(nu(t),e,r)},Rr.clone=function(t){return Xr(t,4)},Rr.cloneDeep=function(t){return Xr(t,5)},Rr.cloneDeepWith=function(t,e){return Xr(t,5,e="function"==typeof e?e:void 0)},Rr.cloneWith=function(t,e){return Xr(t,4,e="function"==typeof e?e:void 0)},Rr.conformsTo=function(t,e){return null==e||qr(t,e,gu(e))},Rr.deburr=Tu,Rr.defaultTo=function(t,e){return null==t||t!=t?e:t},Rr.divide=uc,Rr.endsWith=function(t,e,r){t=iu(t),e=qn(e);var n=t.length,o=r=void 0===r?n:Jr(eu(r),0,n);return(r-=e.length)>=0&&t.slice(r,o)==e},Rr.eq=Ra,Rr.escape=function(t){return(t=iu(t))&&$.test(t)?t.replace(N,ke):t},Rr.escapeRegExp=function(t){return(t=iu(t))&&Y.test(t)?t.replace(H,"\\$&"):t},Rr.every=function(t,e,r){var n=ka(t)?ne:en;return r&&ui(t,e,r)&&(e=void 0),n(t,qo(e,3))},Rr.find=na,Rr.findIndex=Ti,Rr.findKey=function(t,e){return he(t,qo(e,3),cn)},Rr.findLast=oa,Rr.findLastIndex=ki,Rr.findLastKey=function(t,e){return he(t,qo(e,3),sn)},Rr.floor=cc,Rr.forEach=ia,Rr.forEachRight=aa,Rr.forIn=function(t,e){return null==t?t:an(t,qo(e,3),mu)},Rr.forInRight=function(t,e){return null==t?t:un(t,qo(e,3),mu)},Rr.forOwn=function(t,e){return t&&cn(t,qo(e,3))},Rr.forOwnRight=function(t,e){return t&&sn(t,qo(e,3))},Rr.get=hu,Rr.gt=La,Rr.gte=Ca,Rr.has=function(t,e){return null!=t&&ni(t,e,_n)},Rr.hasIn=du,Rr.head=Ni,Rr.identity=Gu,Rr.includes=function(t,e,r,n){t=Na(t)?t:Ru(t),r=r&&!n?eu(r):0;var o=t.length;return r<0&&(r=ir(o+r,0)),Ja(t)?r<=o&&t.indexOf(e,r)>-1:!!o&&_e(t,e,r)>-1},Rr.indexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=null==r?0:eu(r);return o<0&&(o=ir(n+o,0)),_e(t,e,o)},Rr.inRange=function(t,e,r){return e=tu(e),void 0===r?(r=e,e=0):r=tu(r),function(t,e,r){return t>=ar(e,r)&&t=-9007199254740991&&t<=9007199254740991},Rr.isSet=za,Rr.isString=Ja,Rr.isSymbol=Xa,Rr.isTypedArray=qa,Rr.isUndefined=function(t){return void 0===t},Rr.isWeakMap=function(t){return Ha(t)&&ri(t)==g},Rr.isWeakSet=function(t){return Ha(t)&&"[object WeakSet]"==hn(t)},Rr.join=function(t,e){return null==t?"":nr.call(t,e)},Rr.kebabCase=ku,Rr.last=Ui,Rr.lastIndexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=n;return void 0!==r&&(o=(o=eu(r))<0?ir(n+o,0):ar(o,n-1)),e==e?function(t,e,r){for(var n=r+1;n--;)if(t[n]===e)return n;return n}(t,e,o):de(t,ye,o,!0)},Rr.lowerCase=Iu,Rr.lowerFirst=Nu,Rr.lt=Va,Rr.lte=Qa,Rr.max=function(t){return t&&t.length?rn(t,Gu,dn):void 0},Rr.maxBy=function(t,e){return t&&t.length?rn(t,qo(e,2),dn):void 0},Rr.mean=function(t){return ge(t,Gu)},Rr.meanBy=function(t,e){return ge(t,qo(e,2))},Rr.min=function(t){return t&&t.length?rn(t,Gu,On):void 0},Rr.minBy=function(t,e){return t&&t.length?rn(t,qo(e,2),On):void 0},Rr.stubArray=rc,Rr.stubFalse=nc,Rr.stubObject=function(){return{}},Rr.stubString=function(){return""},Rr.stubTrue=function(){return!0},Rr.multiply=sc,Rr.nth=function(t,e){return t&&t.length?Tn(t,eu(e)):void 0},Rr.noConflict=function(){return Bt._===this&&(Bt._=jt),this},Rr.noop=Xu,Rr.now=ha,Rr.pad=function(t,e,r){t=iu(t);var n=(e=eu(e))?De(t):0;if(!e||n>=e)return t;var o=(e-n)/2;return Io(Ze(o),r)+t+Io(Qe(o),r)},Rr.padEnd=function(t,e,r){t=iu(t);var n=(e=eu(e))?De(t):0;return e&&ne){var n=t;t=e,e=n}if(r||t%1||e%1){var o=sr();return ar(t+o*(e-t+Ut("1e-"+((o+"").length-1))),e)}return $n(t,e)},Rr.reduce=function(t,e,r){var n=ka(t)?se:be,o=arguments.length<3;return n(t,qo(e,4),r,o,Zr)},Rr.reduceRight=function(t,e,r){var n=ka(t)?fe:be,o=arguments.length<3;return n(t,qo(e,4),r,o,tn)},Rr.repeat=function(t,e,r){return e=(r?ui(t,e,r):void 0===e)?1:eu(e),jn(iu(t),e)},Rr.replace=function(){var t=arguments,e=iu(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Rr.result=function(t,e,r){var n=-1,o=(e=ao(e,t)).length;for(o||(o=1,t=void 0);++n9007199254740991)return[];var r=4294967295,n=ar(t,4294967295);t-=4294967295;for(var o=Ae(n,e=qo(e));++r=i)return t;var u=r-De(n);if(u<1)return n;var c=a?co(a,0,u).join(""):t.slice(0,u);if(void 0===o)return c+n;if(a&&(u+=c.length-u),Ka(o)){if(t.slice(u).search(o)){var s,f=c;for(o.global||(o=_t(o.source,iu(Z.exec(o))+"g")),o.lastIndex=0;s=o.exec(f);)var l=s.index;c=c.slice(0,void 0===l?u:l)}}else if(t.indexOf(qn(o),u)!=u){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+n},Rr.unescape=function(t){return(t=iu(t))&&P.test(t)?t.replace(I,He):t},Rr.uniqueId=function(t){var e=++St;return iu(t)+e},Rr.upperCase=ju,Rr.upperFirst=Uu,Rr.each=ia,Rr.eachRight=aa,Rr.first=Ni,Ju(Rr,(oc={},cn(Rr,(function(t,e){At.call(Rr.prototype,e)||(oc[e]=t)})),oc),{chain:!1}),Rr.VERSION="4.17.21",ee(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Rr[t].placeholder=Rr})),ee(["drop","take"],(function(t,e){kr.prototype[t]=function(r){r=void 0===r?1:ir(eu(r),0);var n=this.__filtered__&&!e?new kr(this):this.clone();return n.__filtered__?n.__takeCount__=ar(r,n.__takeCount__):n.__views__.push({size:ar(r,4294967295),type:t+(n.__dir__<0?"Right":"")}),n},kr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ee(["filter","map","takeWhile"],(function(t,e){var r=e+1,n=1==r||3==r;kr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:qo(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}})),ee(["head","last"],(function(t,e){var r="take"+(e?"Right":"");kr.prototype[t]=function(){return this[r](1).value()[0]}})),ee(["initial","tail"],(function(t,e){var r="drop"+(e?"":"Right");kr.prototype[t]=function(){return this.__filtered__?new kr(this):this[r](1)}})),kr.prototype.compact=function(){return this.filter(Gu)},kr.prototype.find=function(t){return this.filter(t).head()},kr.prototype.findLast=function(t){return this.reverse().find(t)},kr.prototype.invokeMap=Un((function(t,e){return"function"==typeof t?new kr(this):this.map((function(r){return gn(r,t,e)}))})),kr.prototype.reject=function(t){return this.filter(Ea(qo(t)))},kr.prototype.slice=function(t,e){t=eu(t);var r=this;return r.__filtered__&&(t>0||e<0)?new kr(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),void 0!==e&&(r=(e=eu(e))<0?r.dropRight(-e):r.take(e-t)),r)},kr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},kr.prototype.toArray=function(){return this.take(4294967295)},cn(kr.prototype,(function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),o=Rr[n?"take"+("last"==e?"Right":""):e],i=n||/^find/.test(e);o&&(Rr.prototype[e]=function(){var e=this.__wrapped__,a=n?[1]:arguments,u=e instanceof kr,c=a[0],s=u||ka(e),f=function(t){var e=o.apply(Rr,ce([t],a));return n&&l?e[0]:e};s&&r&&"function"==typeof c&&1!=c.length&&(u=s=!1);var l=this.__chain__,p=!!this.__actions__.length,h=i&&!l,d=u&&!p;if(!i&&s){e=d?e:new kr(this);var _=t.apply(e,a);return _.__actions__.push({func:ta,args:[f],thisArg:void 0}),new Tr(_,l)}return h&&d?t.apply(this,a):(_=this.thru(f),h?n?_.value()[0]:_.value():_)})})),ee(["pop","push","shift","sort","splice","unshift"],(function(t){var e=gt[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);Rr.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var o=this.value();return e.apply(ka(o)?o:[],t)}return this[r]((function(r){return e.apply(ka(r)?r:[],t)}))}})),cn(kr.prototype,(function(t,e){var r=Rr[e];if(r){var n=r.name+"";At.call(gr,n)||(gr[n]=[]),gr[n].push({name:e,func:r})}})),gr[Lo(void 0,2).name]=[{name:"wrapper",func:void 0}],kr.prototype.clone=function(){var t=new kr(this.__wrapped__);return t.__actions__=yo(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=yo(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=yo(this.__views__),t},kr.prototype.reverse=function(){if(this.__filtered__){var t=new kr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},kr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=ka(t),n=e<0,o=r?t.length:0,i=function(t,e,r){for(var n=-1,o=r.length;++n=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},Rr.prototype.plant=function(t){for(var e,r=this;r instanceof Cr;){var n=xi(r);n.__index__=0,n.__values__=void 0,e?o.__wrapped__=n:e=n;var o=n;r=r.__wrapped__}return o.__wrapped__=t,e},Rr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof kr){var e=t;return this.__actions__.length&&(e=new kr(this)),(e=e.reverse()).__actions__.push({func:ta,args:[Bi],thisArg:void 0}),new Tr(e,this.__chain__)}return this.thru(Bi)},Rr.prototype.toJSON=Rr.prototype.valueOf=Rr.prototype.value=function(){return eo(this.__wrapped__,this.__actions__)},Rr.prototype.first=Rr.prototype.head,Ke&&(Rr.prototype[Ke]=function(){return this}),Rr}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Bt._=Ye,define((function(){return Ye}))):Yt?((Yt.exports=Ye)._=Ye,Ht._=Ye):Bt._=Ye}).call(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$lodash_35=_$lodash_35.exports;var _$app_37={};Object.defineProperty(_$app_37,"__esModule",{value:!0}),_$app_37.default=void 0;var _default=new _$openApi_44.OpenAPI("sub-store");_$app_37.default=_default;var _$proxyUtils_38={};function ___typeof_38(t){return(___typeof_38="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(_$proxyUtils_38,"__esModule",{value:!0}),_$proxyUtils_38.ApplyProcessor=ApplyProcessor,_$proxyUtils_38.ProxyUtils=void 0;var ___download_38=_interopRequireDefault(_$download_41),_lodash=_interopRequireDefault(_$lodash_35),_app=_interopRequireDefault(_$app_37);function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function ___regeneratorRuntime_38(){___regeneratorRuntime_38=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(x){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(x){return{type:"throw",arg:x}}}t.wrap=c;var f={};function l(){}function p(){}function h(){}var d={};u(d,o,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(S([])));v&&v!==e&&r.call(v,o)&&(d=v);var y=h.prototype=l.prototype=Object.create(d);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==___typeof_38(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_38(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function ___asyncToGenerator_38(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_38(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_38(i,n,o,a,u,"throw",t)}a(void 0)}))}}function _slicedToArray(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,u=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}}(t,e)||_unsupportedIterableToArray(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function __ownKeys_38(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ___objectSpread_38(t){for(var e=1;e=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_38(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_38(t,e):void 0}}function ___arrayLikeToArray_38(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r/.test(t)},parse:function(){return""}},(keys=["dm1lc3M","c3NyOi8v","dHJvamFu","c3M6Ly","c3NkOi8v","c2hhZG93","aHR0c"],{name:"Base64 Pre-processor",test:function(t){return keys.some((function(e){return-1!==t.indexOf(e)}))},parse:function(t){return _$base64_4.Base64.decode(t)}}),{name:"Clash Pre-processor",test:function(t){return/proxies/.test(t)},parse:function(t){return(0,_$staticJsYaml_36.safeLoad)(t).proxies.map((function(t){return JSON.stringify(t)})).join("\n")}},{name:"SSD Pre-processor",test:function(t){return 0===t.indexOf("ssd://")},parse:function(t){for(var e=[],r=JSON.parse(_$base64_4.Base64.decode(t.split("ssd://")[1])),n=r.port,o=r.encryption,i=r.password,a=r.servers,u=0;u1){var s,f=_createForOfIteratorHelper(t);try{for(f.s();!(s=f.n()).done;){var l=_slicedToArray(s.value.split("="),2),p=l[0],h=l[1];c[p]=h.trim()}}catch(d){f.e(d)}finally{f.f()}}return ___objectSpread_38(___objectSpread_38({},u),{},{name:c.remarks?_$base64_4.Base64.decode(c.remarks):u.server,"protocol-param":_$base64_4.Base64.decode(c.protoparam||"").replace(/\s/g,""),"obfs-param":_$base64_4.Base64.decode(c.obfsparam||"").replace(/\s/g,"")})}}),{name:"URI VMess Parser",test:function(t){return/^vmess:\/\//.test(t)},parse:function(t){t=t.split("vmess://")[1];var e=_$base64_4.Base64.decode(t);if(/=\s*vmess/.test(e)){var r,n=e.split(",").map((function(t){return t.trim()})),o={},i=_createForOfIteratorHelper(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(-1!==a.indexOf("=")){var u=_slicedToArray(a.split("="),2),c=u[0],s=u[1];o[c.trim()]=s.trim()}}}catch(d){i.e(d)}finally{i.f()}var f={name:n[0].split("=")[0].trim(),type:"vmess",server:n[1],port:n[2],cipher:n[3],uuid:n[4].match(/^"(.*)"$/)[1],tls:"over-tls"===o.obfs||"wss"===o.obfs};if(void 0!==o["udp-relay"]&&(f.udp=JSON.parse(o["udp-relay"])),void 0!==o["fast-open"]&&(f.udp=JSON.parse(o["fast-open"])),"ws"===o.obfs||"wss"===o.obfs){f.network="ws",f["ws-opts"].path=(o["obfs-path"]||'"/"').match(/^"(.*)"$/)[1];var l=o["obfs-header"];l&&-1!==l.indexOf("Host")&&(l=l.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),f["ws-opts"].headers={Host:l||f.server}}return f.tls&&"false"===o['"tls-verification"']&&(f["skip-cert-verify"]=!0),f.tls&&o["obfs-host"]&&(f.sni=o["obfs-host"]),f}var p=JSON.parse(e),h={name:p.ps,type:"vmess",server:p.add,port:p.port,cipher:"auto",uuid:p.id,alterId:p.aid||0,tls:"tls"===p.tls||!0===p.tls,supported:{}};return"ws"===p.net&&(h.network="ws",h["ws-opts"]={path:p.path,headers:{Host:p.host||p.add}},h.tls&&p.host&&(h.sni=p.host)),!1===p.verify_cert&&(h["skip-cert-verify"]=!0),h}},{name:"URI Trojan Parser",test:function(t){return/^trojan:\/\//.test(t)},parse:function(t){var e=_slicedToArray((t=t.split("trojan://")[1]).split("@")[1].split("?")[0].split(":"),2),r=e[0],n=e[1],o=decodeURIComponent(t.split("#")[1].trim()),i=t.split("?"),a=null;return i.length>1&&(i=i[1].split("#")[0].split("&"),a=new Map(i.map((function(t){return t.split("=")}))).get("sni")),{name:o||"[Trojan] ".concat(r),type:"trojan",server:r,port:n,password:t.split("@")[0],sni:a,supported:{}}}},{name:"Clash Parser",test:function(t){try{JSON.parse(t)}catch(e){return!1}return!0},parse:function(t){return JSON.parse(t)}},{name:"Surge SS Parser",test:function(t){return/^.*=\s*ss/.test(t.split(",")[0])},parse:function(t){var e=r(t),n={name:e.name,type:"ss",server:e.server,port:e.port,cipher:e["encrypt-method"],password:e.password,tfo:JSON.parse(e.tfo||"false"),udp:JSON.parse(e["udp-relay"]||"false")};return e.obfs&&(n.plugin="obfs",n["plugin-opts"]={mode:e.obfs,host:e["obfs-host"]}),n}},{name:"Surge VMess Parser",test:function(t){return/^.*=\s*vmess/.test(t.split(",")[0])&&-1!==t.indexOf("username")},parse:function(t){var e=r(t),n={name:e.name,type:"vmess",server:e.server,port:e.port,uuid:e.username,alterId:0,cipher:"none",tls:JSON.parse(e.tls||"false"),tfo:JSON.parse(e.tfo||"false")};if(n.tls&&(void 0!==e["skip-cert-verify"]&&(n["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),n.sni=e.sni||e.server),JSON.parse(e.ws||"false")){n.network="ws",n["ws-opts"]={path:e["ws-path"]};var o=e["ws-headers"].match(/(,|^|\s)*HOST:\s*(.*?)(,|$)/),i=o?o[2]:n.server;n["ws-opts"].headers={Host:i||e.server}}return n}},{name:"Surge Trojan Parser",test:function(t){return/^.*=\s*trojan/.test(t.split(",")[0])&&-1!==t.indexOf("sni")},parse:function(t){var e=r(t),n={name:e.name,type:"trojan",server:e.server,port:e.port,password:e.password,sni:e.sni||e.server,tfo:JSON.parse(e.tfo||"false")};return void 0!==e["skip-cert-verify"]&&(n["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),n}},{name:"Surge HTTP Parser",test:function(t){return/^.*=\s*https?/.test(t.split(",")[0])&&!e().test(t)},parse:function(t){var e=r(t),n=/^.*?=\s?https/.test(t),o={name:e.name,type:"http",server:e.server,port:e.port,tls:JSON.parse(n||"false"),tfo:JSON.parse(e.tfo||"false")};return o.tls&&(void 0!==e["skip-cert-verify"]&&(o["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),o.sni=e.sni||e.server),e.username&&"none"!==e.username&&(o.username=e.username),e.password&&"none"!==e.password&&(o.password=e.password),o}},{name:"Loon SS Parser",test:function(t){return"shadowsocks"===t.split(",")[0].split("=")[1].trim().toLowerCase()},parse:function(t){var e=t.split("=")[1].split(","),r={name:t.split("=")[0].trim(),type:"ss",server:e[1],port:e[2],cipher:e[3],password:e[4].replace(/"/g,"")};return e.length>5&&(r.plugin="obfs",r["plugin-opts"]={mode:e[5],host:e[6]}),r}},{name:"Loon SSR Parser",test:function(t){return"shadowsocksr"===t.split(",")[0].split("=")[1].trim().toLowerCase()},parse:function(t){var e=t.split("=")[1].split(",");return{name:t.split("=")[0].trim(),type:"ssr",server:e[1],port:e[2],cipher:e[3],password:e[4].replace(/"/g,""),protocol:e[5],"protocol-param":e[6].match(/{(.*)}/)[1],supported:{Surge:!1},obfs:e[7],"obfs-param":e[8].match(/{(.*)}/)[1]}}},{name:"Loon VMess Parser",test:function(t){return/^.*=\s*vmess/i.test(t.split(",")[0])&&-1===t.indexOf("username")},parse:function(t){var e,r=t.split("=")[1].split(","),n={name:t.split("=")[0].trim(),type:"vmess",server:r[1],port:r[2],cipher:r[3]||"none",uuid:r[4].replace(/"/g,""),alterId:0},o=_createForOfIteratorHelper(r=r.splice(5));try{for(o.s();!(e=o.n()).done;){var i=_slicedToArray(e.value.split(":"),2),a=i[0],u=i[1];r[a]=u}}catch(c){o.e(c)}finally{o.f()}switch(n.tls=JSON.parse(r["over-tls"]||"false"),n.tls&&(n.sni=r["tls-name"]||n.server,n["skip-cert-verify"]=JSON.parse(r["skip-cert-verify"]||"false")),r.transport){case"tcp":break;case"ws":n.network=r.transport,n["ws-opts"]={path:r.path,headers:{Host:r.host}}}return n.tls&&(n["skip-cert-verify"]=JSON.parse(r["skip-cert-verify"]||"false")),n}},{name:"Loon Trojan Parser",test:function(t){return/^.*=\s*trojan/i.test(t.split(",")[0])&&-1===t.indexOf("password")},parse:function(t){var e=t.split("=")[1].split(","),r={name:t.split("=")[0].trim(),type:"trojan",server:e[1],port:e[2],password:e[3].replace(/"/g,""),sni:e[1],"skip-cert-verify":JSON.parse(e["skip-cert-verify"]||"false")};if(e.length>4){var n=_slicedToArray(e[4].split(":"),2),o=n[0],i=n[1];if("tls-name"!==o)throw new Error("Unknown option ".concat(o," for line: \n").concat(t));r.sni=i}return r}},e(),{name:"QX SS Parser",test:function(t){return/^shadowsocks\s*=/.test(t.split(",")[0].trim())&&-1===t.indexOf("ssr-protocol")},parse:function(e){var r=t(e),n={name:r.tag,type:"ss",server:r.server,port:r.port,cipher:r.method,password:r.password,udp:JSON.parse(r["udp-relay"]||"false"),tfo:JSON.parse(r["fast-open"]||"false"),supported:{}};if(r.obfs)switch(n["plugin-opts"]={host:r["obfs-host"]||n.server},r.obfs){case"http":case"tls":n.plugin="obfs",n["plugin-opts"].mode=r.obfs;break;case"ws":case"wss":n["plugin-opts"]=___objectSpread_38(___objectSpread_38({},n["plugin-opts"]),{},{mode:"websocket",path:r["obfs-uri"]||"/",tls:"wss"===r.obfs}),n["plugin-opts"].tls&&void 0!==r["tls-verification"]&&(n["plugin-opts"]["skip-cert-verify"]=r["tls-verification"]),n.plugin="v2ray-plugin",n.supported.Surge=!1,n.supported.Loon=!1}return n}},{name:"QX SSR Parser",test:function(t){return/^shadowsocks\s*=/.test(t.split(",")[0].trim())&&-1!==t.indexOf("ssr-protocol")},parse:function(e){var r=t(e),n={name:r.tag,type:"ssr",server:r.server,port:r.port,cipher:r.method,password:r.password,protocol:r["ssr-protocol"],obfs:"plain","protocol-param":r["ssr-protocol-param"],udp:JSON.parse(r["udp-relay"]||"false"),tfo:JSON.parse(r["fast-open"]||"false"),supported:{Surge:!1}};return r.obfs&&(n.obfs=r.obfs,n["obfs-param"]=r["obfs-host"]),n}},{name:"QX VMess Parser",test:function(t){return/^vmess\s*=/.test(t.split(",")[0].trim())},parse:function(e){var r=t(e),n={type:"vmess",name:r.tag,server:r.server,port:r.port,cipher:r.method||"none",uuid:r.password,alterId:0,tls:"over-tls"===r.obfs||"wss"===r.obfs,udp:JSON.parse(r["udp-relay"]||"false"),tfo:JSON.parse(r["fast-open"]||"false")};return n.tls&&(n.sni=r["obfs-host"]||r.server,n["skip-cert-verify"]=!JSON.parse(r["tls-verification"]||"true")),"ws"!==r.obfs&&"wss"!==r.obfs||(n.network="ws",n["ws-opts"]={path:r["obfs-uri"],headers:{Host:r["obfs-host"]||r.server}}),n}},{name:"QX Trojan Parser",test:function(t){return/^trojan\s*=/.test(t.split(",")[0].trim())},parse:function(e){var r=t(e),n={type:"trojan",name:r.tag,server:r.server,port:r.port,password:r.password,sni:r["tls-host"]||r.server,udp:JSON.parse(r["udp-relay"]||"false"),tfo:JSON.parse(r["fast-open"]||"false")};return n["skip-cert-verify"]=!JSON.parse(r["tls-verification"]||"true"),n}},{name:"QX HTTP Parser",test:function(t){return/^http\s*=/.test(t.split(",")[0].trim())},parse:function(e){var r=t(e),n={type:"http",name:r.tag,server:r.server,port:r.port,tls:JSON.parse(r["over-tls"]||"false"),udp:JSON.parse(r["udp-relay"]||"false"),tfo:JSON.parse(r["fast-open"]||"false")};return r.username&&"none"!==r.username&&(n.username=r.username),r.password&&"none"!==r.password&&(n.password=r.password),n.tls&&(n.sni=r["tls-host"]||n.server,n["skip-cert-verify"]=!JSON.parse(r["tls-verification"]||"true")),n}}];var n}(),PROXY_PROCESSORS=function(){function t(t,e){for(var r=null,n=0;n1?e-1:0),n=1;n0&&void 0!==arguments[0])||arguments[0];return{name:"Flag Operator",func:function(e){return e.map((function(e){if(t){var r=(0,_$geo_42.getFlag)(e.name);e.name=removeFlag(e.name),e.name=r+" "+e.name,e.name=e.name.replace(/\ud83c\uddf9\ud83c\uddfc/g,"\ud83c\udde8\ud83c\uddf3")}else e.name=removeFlag(e.name);return e}))}}},"Sort Operator":function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"asc";return{name:"Sort Operator",func:function(e){switch(t){case"asc":case"desc":return e.sort((function(e,r){return(e.name>r.name?1:-1)*("desc"===t?-1:1)}));case"random":return function(t){for(var e,r,n=t.length;0!==n;)r=Math.floor(Math.random()*n),e=t[n-=1],t[n]=t[r],t[r]=e;return t}(e);default:throw new Error("Unknown sort option: "+t)}}}},"Regex Sort Operator":function(e){return{name:"Regex Sort Operator",func:function(r){return e=e.map((function(t){return n(t)})),r.sort((function(r,n){var o=t(e,r.name),i=t(e,n.name);return o&&!i?-1:i&&!o?1:o&&i?o1){void 0===s[t.name]&&(s[t.name]=1);for(var e="",r=s[t.name]++,n=0;r>0;)e=a[r%10]+e,r=parseInt(r/10),n++;for(;n++1&&void 0!==w[1]?w[1]:[],n=w.length>2?w[2]:void 0,o=_createForOfIteratorHelper(r),t.prev=3,o.s();case 5:if((i=o.n()).done){t.next=40;break}if(a=i.value,u=void 0,c={},-1===a.type.indexOf("Script")){t.next=29;break}if(s=a.args,f=s.mode,l=s.content,"link"!==f){t.next=28;break}if((h=(p=l).split("#")).length>1){d=_createForOfIteratorHelper(h[1].split("&"));try{for(d.s();!(_=d.n()).done;)v=_.value,y=v.split("=")[0],g=v.split("=")[1]||!0,c[y]=g}catch(b){d.e(b)}finally{d.f()}}return t.prev=15,t.next=18,(0,___download_38.default)(p.split("#")[0]);case 18:u=t.sent,_app.default.info("Script loaded: >>>\n ".concat(u)),t.next=26;break;case 22:return t.prev=22,t.t0=t.catch(15),_app.default.error("Error when downloading remote script: ".concat(a.args.content,".\n Reason: ").concat(t.t0)),t.abrupt("continue",38);case 26:t.next=29;break;case 28:u=l;case 29:if(PROXY_PROCESSORS[a.type]){t.next=32;break}return _app.default.error('Unknown operator: "'.concat(a.type,'"')),t.abrupt("continue",38);case 32:return _app.default.info('Applying "'.concat(a.type,'" with arguments:\n >>> ').concat(JSON.stringify(a.args,null,2)||"None")),m=void 0,m=-1!==a.type.indexOf("Script")?PROXY_PROCESSORS[a.type](u,n,c):PROXY_PROCESSORS[a.type](a.args),t.next=37,ApplyProcessor(m,e);case 37:e=t.sent;case 38:t.next=5;break;case 40:t.next=45;break;case 42:t.prev=42,t.t1=t.catch(3),o.e(t.t1);case 45:return t.prev=45,o.f(),t.finish(45);case 48:return t.abrupt("return",e);case 49:case"end":return t.stop()}}),t,null,[[3,42,45,48],[15,22]])})))).apply(this,arguments)}return{parse:function(e){e=function(t){var e,r=_createForOfIteratorHelper(PROXY_PREPROCESSORS);try{for(r.s();!(e=r.n()).done;){var n=e.value;try{if(n.test(t))return _app.default.info("Pre-processor [".concat(n.name,"] activated")),n.parse(t)}catch(o){_app.default.error("Parser [".concat(n.name,"] failed\n Reason: ").concat(o))}}}catch(i){r.e(i)}finally{r.f()}return t}(e);var r,n,o=[],i=_createForOfIteratorHelper(e.split("\n"));try{for(i.s();!(n=i.n()).done;){var a=n.value;if(0!==(a=a.trim()).length){var u=r&&t(r,a);if(!u){var c,s=_createForOfIteratorHelper(PROXY_PARSERS);try{for(s.s();!(c=s.n()).done;){var f=c.value;if(t(f,a)){r=f,u=!0,_app.default.info("Proxy parser: ".concat(f.name," is activated"));break}}}catch(p){s.e(p)}finally{s.f()}}if(u)try{var l=r.parse(a);l||_app.default.error("Parser ".concat(r.name," return nothing for \n").concat(a,"\n")),o.push(l)}catch(p){_app.default.error("Failed to parse line: \n ".concat(a,"\n Reason: ").concat(p.stack))}else _app.default.error("Failed to find a rule to parse line: \n".concat(a,"\n"))}}}catch(p){i.e(p)}finally{i.f()}return o},process:function(t){return e.apply(this,arguments)},produce:function(t,e){var r=PROXY_PRODUCERS[e];if(!r)throw new Error("Target platform: ".concat(e," is not supported!"));return t=t.filter((function(t){return!(t.supported&&!1===t.supported[e])})),_app.default.info("Producing proxies for target: ".concat(e)),void 0===r.type||"SINGLE"===r.type?t.map((function(t){try{return r.produce(t)}catch(e){return _app.default.error("Cannot produce proxy: ".concat(JSON.stringify(t,null,2),"\nReason: ").concat(e)),""}})).filter((function(t){return t.length>0})).join("\n"):"ALL"===r.type?r.produce(t):void 0}}}(),keys;function ApplyProcessor(t,e){return _ApplyProcessor.apply(this,arguments)}function _ApplyProcessor(){return(_ApplyProcessor=___asyncToGenerator_38(___regeneratorRuntime_38().mark((function t(e,r){var n,o,i,a;return ___regeneratorRuntime_38().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=function(){return(a=___asyncToGenerator_38(___regeneratorRuntime_38().mark((function t(e,r){var n,o;return ___regeneratorRuntime_38().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=r,n=JSON.parse(JSON.stringify(i)),t.prev=1,t.next=4,e.func(n);case 4:(o=t.sent)&&(n=o),t.next=11;break;case 8:t.prev=8,t.t0=t.catch(1),console.log("Cannot apply operator ".concat(e.name,"! Reason: ").concat(t.t0));case 11:return t.abrupt("return",n);case 12:case"end":return t.stop()}var i}),t,null,[[1,8]])})))).apply(this,arguments)},i=function(t,e){return a.apply(this,arguments)},o=function(){return(o=___asyncToGenerator_38(___regeneratorRuntime_38().mark((function t(e,r){var n;return ___regeneratorRuntime_38().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=(0,_$logical_43.FULL)(r.length,!0),t.prev=1,t.next=4,e.func(r);case 4:n=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.log("Cannot apply filter ".concat(e.name,"\n Reason: ").concat(t.t0));case 10:return t.abrupt("return",r.filter((function(t,e){return n[e]})));case 11:case"end":return t.stop()}}),t,null,[[1,7]])})))).apply(this,arguments)},n=function(t,e){return o.apply(this,arguments)},-1===e.name.indexOf("Filter")){t.next=8;break}return t.abrupt("return",n(e,r));case 8:if(-1===e.name.indexOf("Operator")){t.next=10;break}return t.abrupt("return",i(e,r));case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function removeFlag(t){return t.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/g,"").trim()}_$proxyUtils_38.ProxyUtils=ProxyUtils;var _$ruleUtils_39={};function ___typeof_39(t){return(___typeof_39="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(_$ruleUtils_39,"__esModule",{value:!0}),_$ruleUtils_39.RuleUtils=void 0;var ___staticJsYaml_39=___interopRequireDefault_39(_$staticJsYaml_36),___app_39=___interopRequireDefault_39(_$app_37);function ___interopRequireDefault_39(t){return t&&t.__esModule?t:{default:t}}function ___regeneratorRuntime_39(){___regeneratorRuntime_39=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(x){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(x){return{type:"throw",arg:x}}}t.wrap=c;var f={};function l(){}function p(){}function h(){}var d={};u(d,o,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(S([])));v&&v!==e&&r.call(v,o)&&(d=v);var y=h.prototype=l.prototype=Object.create(d);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==___typeof_39(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_39(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function ___createForOfIteratorHelper_39(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_39(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_39(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_39(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r/.test(t)},parse:function(){return""}},{name:"Clash Provider",test:function(t){return 0===t.indexOf("payload:")},parse:function(t){return t.replace("payload:","").replace(/^\s*-\s*/gm,"")}}],RULE_PARSERS=[{name:"Universal Rule Parser",test:function(){return!0},parse:function(t){var e,r=[],n=___createForOfIteratorHelper_39(t.split("\n"));try{for(n.s();!(e=n.n()).done;){var o=e.value;if(0!==(o=o.trim()).length&&!/\s*#/.test(o))try{var i,a=o.split(",").map((function(t){return t.trim()})),u=a[0],c=!1,s=___createForOfIteratorHelper_39(RULE_TYPES_MAPPING);try{for(s.s();!(i=s.n()).done;){var f=i.value;if(f[0].test(u)){c=!0;var l={type:f[1],content:a[1]};"IP-CIDR"!==l.type&&"IP-CIDR6"!==l.type||(l.options=a.slice(2)),r.push(l)}}}catch(p){s.e(p)}finally{s.f()}if(!c)throw new Error("Invalid rule type: "+u)}catch(h){console.error("Failed to parse line: ".concat(o,"\n Reason: ").concat(h))}}}catch(p){n.e(p)}finally{n.f()}return r}}],RULE_PROCESSORS={"Regex Filter":function(t){var e=t.regex,r=void 0===e?[]:e,n=t.keep,o=void 0===n||n;return{name:"Regex Filter",func:function(t){return t.map((function(t){var e=r.some((function(e){return(e=new RegExp(e)).test(t)}));return o?e:!e}))}}},"Remove Duplicate Filter":function(){return{name:"Remove Duplicate Filter",func:function(t){var e=new Set,r=[];return t.forEach((function(t){var n=t.options||[];n.sort();var o="".concat(t.type,",").concat(t.content,",").concat(JSON.stringify(n));e.has(o)||(r.push(t),e.add(o))})),r}}},"Type Filter":function(t){return{name:"Type Filter",func:function(e){return e.map((function(e){return t.some((function(t){return e.type===t}))}))}}},"Regex Replace Operator":function(t){return{name:"Regex Rename Operator",func:function(e){return e.map((function(e){var r,n=___createForOfIteratorHelper_39(t);try{for(n.s();!(r=n.n()).done;){var o=r.value,i=o.expr,a=o.now;e.content=e.content.replace(new RegExp(i,"g"),a).trim()}}catch(u){n.e(u)}finally{n.f()}return e}))}}}},RULE_PRODUCERS={QX:{type:"SINGLE",func:function(t){return-1!==["URL-REGEX","DEST-PORT","SRC-IP","IN-PORT","PROTOCOL"].indexOf(t.type)?null:"".concat({"DOMAIN-KEYWORD":"HOST-KEYWORD","DOMAIN-SUFFIX":"HOST-SUFFIX",DOMAIN:"HOST","IP-CIDR6":"IP6-CIDR"}[t.type]||t.type,",").concat(t.content,",SUB-STORE")}},Surge:{type:"SINGLE",func:function(t){var e="".concat(t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(e+=t.options?",".concat(t.options[0]):""),e}},Loon:{type:"SINGLE",func:function(t){return-1!==["DEST-PORT","SRC-IP","IN-PORT","PROTOCOL"].indexOf(t.type)?null:function(t){var e="".concat(t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(e+=t.options?",".concat(t.options[0]):""),e}(t)}},Clash:{type:"ALL",func:function(t){var e={"DEST-PORT":"DST-PORT","SRC-IP":"SRC-IP-CIDR","IN-PORT":"SRC-PORT"},r={payload:t.map((function(t){var r="".concat(e[t.type]||t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(r+=t.options?",".concat(t.options[0]):""),r}))};return ___staticJsYaml_39.default.dump(r)}}},RuleUtils=function(){function t(){var e;return e=___regeneratorRuntime_39().mark((function t(e,r){var n,o,i,a;return ___regeneratorRuntime_39().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=___createForOfIteratorHelper_39(r),t.prev=1,n.s();case 3:if((o=n.n()).done){t.next=13;break}if(i=o.value,RULE_PROCESSORS[i.type]){t.next=8;break}return console.error("Unknown operator: ".concat(i.type,"!")),t.abrupt("continue",11);case 8:a=RULE_PROCESSORS[i.type](i.args),___app_39.default.info('Applying "'.concat(i.type,'" with arguments: \n >>> ').concat(JSON.stringify(i.args)||"None")),e=(0,_$proxyUtils_38.ApplyProcessor)(a,e);case 11:t.next=3;break;case 13:t.next=18;break;case 15:t.prev=15,t.t0=t.catch(1),n.e(t.t0);case 18:return t.prev=18,n.f(),t.finish(18);case 21:return t.abrupt("return",e);case 22:case"end":return t.stop()}}),t,null,[[1,15,18,21]])})),(t=function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(t){__asyncGeneratorStep_39(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_39(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}return{parse:function(t){t=function(t){var e,r=___createForOfIteratorHelper_39(RULE_PREPROCESSORS);try{for(r.s();!(e=r.n()).done;){var n=e.value;try{if(n.test(t))return ___app_39.default.info("Pre-processor [".concat(n.name,"] activated")),n.parse(t)}catch(o){___app_39.default.error("Parser [".concat(n.name,"] failed\n Reason: ").concat(o))}}}catch(i){r.e(i)}finally{r.f()}return t}(t);var e,r=___createForOfIteratorHelper_39(RULE_PARSERS);try{for(r.s();!(e=r.n()).done;){var n=e.value,o=void 0;try{o=n.test(t)}catch(i){o=!1}if(o)return ___app_39.default.info("Rule parser [".concat(n.name,"] is activated!")),n.parse(t)}}catch(i){r.e(i)}finally{r.f()}},process:function(e,r){return t.apply(this,arguments)},produce:function(t,e){var r=RULE_PRODUCERS[e];if(!r)throw new Error("Target platform: ".concat(e," is not supported!"));return void 0===r.type||"SINGLE"===r.type?t.map((function(t){try{return r.func(t)}catch(e){return console.log("ERROR: cannot produce rule: ".concat(JSON.stringify(t),"\nReason: ").concat(e)),""}})).filter((function(t){return t.length>0})).join("\n"):"ALL"===r.type?r.func(t):void 0}}}();_$ruleUtils_39.RuleUtils=RuleUtils;var _$resourceParserLoon_40={},RESOURCE_TYPE_RULE=2,result=$resource;if(1===$resourceType){var proxies=_$proxyUtils_38.ProxyUtils.parse($resource);result=_$proxyUtils_38.ProxyUtils.produce(proxies,"Loon")}else if($resourceType===RESOURCE_TYPE_RULE){var rules=_$ruleUtils_39.RuleUtils.parse($resource);result=_$ruleUtils_39.RuleUtils.produce(rules,"Loon")}$done(result)}(); \ No newline at end of file +!function(){var createModuleFactory=function(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}},_$buffer_2=createModuleFactory((function(t,e){(function(t){(function(){"use strict";e.Buffer=r,e.SlowBuffer=function(t){return+t!=t&&(t=0),r.alloc(+t)},e.INSPECT_MAX_BYTES=50;function t(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=r.prototype,e}function r(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return i(t)}return n(t,e,r)}function n(e,n,o){if("string"==typeof e)return function(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!r.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o=0|c(e,n),i=t(o),a=i.write(e,n);return a!==o&&(i=i.slice(0,a)),i}(e,n);if(ArrayBuffer.isView(e))return a(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(P(e,ArrayBuffer)||e&&P(e.buffer,ArrayBuffer))return function(t,e,n){if(e<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function c(t,e){if(r.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||P(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return I(t).length;default:if(i)return o?-1:k(t).length;e=(""+e).toLowerCase(),i=!0}}function s(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function f(t,e,n,o,i){if(0===t.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),$(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=r.from(e,o)),r.isBuffer(e))return 0===e.length?-1:l(t,e,n,o,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):l(t,[e],n,o,i);throw new TypeError("val must be string, number or Buffer")}function l(t,e,r,n,o){var i,a=1,u=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,u/=2,c/=2,r/=2}function s(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){var f=-1;for(i=r;iu&&(r=u-c),i=r;i>=0;i--){for(var l=!0,p=0;po&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function g(t,e,r){return 0===e&&r===t.length?_$base64Js_1.fromByteArray(t):_$base64Js_1.fromByteArray(t.slice(e,r))}function m(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:s>223?3:s>191?2:1;if(o+l<=r)switch(l){case 1:s<128&&(f=s);break;case 2:128==(192&(i=t[o+1]))&&(c=(31&s)<<6|63&i)>127&&(f=c);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(c=(15&s)<<12|(63&i)<<6|63&a)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:i=t[o+1],a=t[o+2],u=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(c=(15&s)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&c<1114112&&(f=c)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=l}return function(t){var e=t.length;if(e<=w)return String.fromCharCode.apply(String,t);for(var r="",n=0;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return E(this,e,r);case"utf8":case"utf-8":return m(this,e,r);case"ascii":return b(this,e,r);case"latin1":case"binary":return A(this,e,r);case"base64":return g(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=function(t){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===r.compare(this,t)},r.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),""},r.prototype.compare=function(t,e,n,o,i){if(P(t,Uint8Array)&&(t=r.from(t,t.offset,t.byteLength)),!r.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),e<0||n>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=n)return 0;if(o>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var a=(i>>>=0)-(o>>>=0),u=(n>>>=0)-(e>>>=0),c=Math.min(a,u),s=this.slice(o,i),f=t.slice(e,n),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return p(this,t,e,r);case"utf8":case"utf-8":return h(this,t,e,r);case"ascii":return d(this,t,e,r);case"latin1":case"binary":return _(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function b(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;oo)&&(r=o);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,n,o,i,a){if(!r.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function T(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,4),_$ieee754_3.write(t,e,r,n,23,4),r+4}function C(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,8),_$ieee754_3.write(t,e,r,n,52,8),r+8}r.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},r.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},r.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},r.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},r.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},r.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},r.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},r.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},r.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},r.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},r.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},r.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),_$ieee754_3.read(this,t,!0,23,4)},r.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),_$ieee754_3.read(this,t,!1,23,4)},r.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),_$ieee754_3.read(this,t,!0,52,8)},r.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),_$ieee754_3.read(this,t,!1,52,8)},r.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},r.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,255,0),this[e]=255&t,e+1},r.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},r.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=0,a=1,u=0;for(this[e]=255&t;++i>0)-u&255;return e+r},r.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=r-1,a=1,u=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/a>>0)-u&255;return e+r},r.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},r.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},r.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeFloatLE=function(t,e,r){return T(this,t,e,!0,r)},r.prototype.writeFloatBE=function(t,e,r){return T(this,t,e,!1,r)},r.prototype.writeDoubleLE=function(t,e,r){return C(this,t,e,!0,r)},r.prototype.writeDoubleBE=function(t,e,r){return C(this,t,e,!1,r)},r.prototype.copy=function(t,e,n,o){if(!r.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),o||0===o||(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e=0;--a)t[a+e]=this[a+n];else Uint8Array.prototype.set.call(t,this.subarray(n,o),e);return i},r.prototype.fill=function(t,e,n,o){if("string"==typeof t){if("string"==typeof e?(o=e,e=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!r.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){var i=t.charCodeAt(0);("utf8"===o&&i<128||"latin1"===o)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function I(t){return _$base64Js_1.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function N(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function P(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function $(t){return t!=t}}).call(this)}).call(this,_$buffer_2({}).Buffer)})),_$openApi_51={};function _typeof(t){return(_typeof="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 ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(t){for(var e=1;e=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){asyncGeneratorStep(i,n,o,a,u,"next",t)}function u(t){asyncGeneratorStep(i,n,o,a,u,"throw",t)}a(void 0)}))}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"untitled",debug=arguments.length>1&&void 0!==arguments[1]&&arguments[1];_classCallCheck(this,OpenAPI),this.name=name,this.debug=debug,this.http=HTTP(),this.env=ENV(),this.node=function(){if(isNode){var fs=eval("require('fs')");return{fs:fs}}return null}(),this.initCache();var delay=function(t,e){return new Promise((function(r){setTimeout(r.bind(null,e),t)}))},_ref;Promise.prototype.delay=(_ref=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){var r;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:return r=t.sent,t.next=5,delay(e,r);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return _ref.apply(this,arguments)})}return _createClass(OpenAPI,[{key:"initCache",value:function(){if(isQX&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(isLoon||isSurge)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),isNode){var t="root.json";this.node.fs.existsSync(t)||this.node.fs.writeFileSync(t,JSON.stringify({}),{flag:"wx"},(function(t){return console.log(t)})),this.root={},t="".concat(this.name,".json"),this.node.fs.existsSync(t)?this.cache=JSON.parse(this.node.fs.readFileSync("".concat(this.name,".json"))):(this.node.fs.writeFileSync(t,JSON.stringify({}),{flag:"wx"},(function(t){return console.log(t)})),this.cache={})}}},{key:"persistCache",value:function(){var t=JSON.stringify(this.cache,null,2);isQX&&$prefs.setValueForKey(t,this.name),(isLoon||isSurge)&&$persistentStore.write(t,this.name),isNode&&(this.node.fs.writeFileSync("".concat(this.name,".json"),t,{flag:"w"},(function(t){return console.log(t)})),this.node.fs.writeFileSync("root.json",JSON.stringify(this.root,null,2),{flag:"w"},(function(t){return console.log(t)})))}},{key:"write",value:function(t,e){if(this.log("SET ".concat(e)),-1!==e.indexOf("#")){if(e=e.substr(1),isSurge||isLoon)return $persistentStore.write(t,e);if(isQX)return $prefs.setValueForKey(t,e);isNode&&(this.root[e]=t)}else this.cache[e]=t;this.persistCache()}},{key:"read",value:function(t){return this.log("READ ".concat(t)),-1===t.indexOf("#")?this.cache[t]:(t=t.substr(1),isSurge||isLoon?$persistentStore.read(t):isQX?$prefs.valueForKey(t):isNode?this.root[t]:void 0)}},{key:"delete",value:function(t){if(this.log("DELETE ".concat(t)),-1!==t.indexOf("#")){if(t=t.substr(1),isSurge||isLoon)return $persistentStore.write(null,t);if(isQX)return $prefs.removeValueForKey(t);isNode&&delete this.root[t]}else delete this.cache[t];this.persistCache()}},{key:"notify",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n["open-url"],i=n["media-url"];if(isQX&&$notify(t,e,r,n),isSurge&&$notification.post(t,e,r+"".concat(i?"\n\u591a\u5a92\u4f53:"+i:""),{url:o}),isLoon){var a={};o&&(a.openUrl=o),i&&(a.mediaUrl=i),"{}"===JSON.stringify(a)?$notification.post(t,e,r):$notification.post(t,e,r,a)}if(isNode){var u=r+(o?"\n\u70b9\u51fb\u8df3\u8f6c: ".concat(o):"")+(i?"\n\u591a\u5a92\u4f53: ".concat(i):"");console.log("".concat(t,"\n").concat(e,"\n").concat(u,"\n\n"))}}},{key:"log",value:function(t){this.debug&&console.log("[".concat(this.name,"] LOG: ").concat(t))}},{key:"info",value:function(t){console.log("[".concat(this.name,"] INFO: ").concat(t))}},{key:"error",value:function(t){console.log("[".concat(this.name,"] ERROR: ").concat(t))}},{key:"wait",value:function(t){return new Promise((function(e){return setTimeout(e,t)}))}},{key:"done",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};isQX||isLoon||isSurge?$done(t):isNode&&"undefined"!=typeof $context&&($context.headers=t.headers,$context.statusCode=t.statusCode,$context.body=t.body)}}]),OpenAPI}();function ENV(){return{isQX:isQX,isLoon:isLoon,isSurge:isSurge,isNode:isNode}}function HTTP(){var defaultOptions=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{baseURL:""},_ENV=ENV(),isQX=_ENV.isQX,isLoon=_ENV.isLoon,isSurge=_ENV.isSurge,isNode=_ENV.isNode,methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],URL_REGEX=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;function send(method,options){options="string"==typeof options?{url:options}:options;var baseURL=defaultOptions.baseURL;baseURL&&!URL_REGEX.test(options.url||"")&&(options.url=baseURL?baseURL+options.url:options.url),options=_objectSpread(_objectSpread({},defaultOptions),options);var timeout=options.timeout,events=_objectSpread(_objectSpread({},{onRequest:function(){},onResponse:function(t){return t},onTimeout:function(){}}),options.events),worker,timeoutid;events.onRequest(method,options),isQX?worker=$task.fetch({method:method,url:options.url,headers:options.headers,body:options.body}):(isLoon||isSurge||isNode)&&(worker=new Promise((function(resolve,reject){var request=isNode?eval("require('request')"):$httpClient;request[method.toLowerCase()](options,(function(t,e,r){t?reject(t):resolve({statusCode:e.status||e.statusCode,headers:e.headers,body:r})}))})));var timer=timeout?new Promise((function(t,e){timeoutid=setTimeout((function(){return events.onTimeout(),e("".concat(method," URL: ").concat(options.url," exceeds the timeout ").concat(timeout," ms"))}),timeout)})):null;return(timer?Promise.race([timer,worker]).then((function(t){return clearTimeout(timeoutid),t})):worker).then((function(t){return events.onResponse(t)}))}var http={};return methods.forEach((function(t){return http[t.toLowerCase()]=function(e){return send(t,e)}})),http}_$openApi_51.OpenAPI=OpenAPI;var _$download_48={};function ___typeof_48(t){return(___typeof_48="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 ___regeneratorRuntime_48(){___regeneratorRuntime_48=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(x){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new E(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(x){return{type:"throw",arg:x}}}t.wrap=c;var f={};function l(){}function p(){}function h(){}var d={};u(d,o,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(O([])));v&&v!==e&&r.call(v,o)&&(d=v);var y=h.prototype=l.prototype=Object.create(d);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==___typeof_48(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_48(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}Object.defineProperty(_$download_48,"__esModule",{value:!0}),_$download_48.default=function(t,e){return _download.apply(this,arguments)};var cache=new Map;function _download(){var t;return t=___regeneratorRuntime_48().mark((function t(e,r){var n,o,i;return ___regeneratorRuntime_48().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=(r=r||"Quantumult%20X/1.0.29 (iPhone14,5; iOS 15.4.1)")+e,!cache.has(n)){t.next=4;break}return t.abrupt("return",cache.get(n));case 4:return o=(0,_$openApi_51.HTTP)({headers:{"User-Agent":r}}),i=new Promise((function(t,r){o.get(e).then((function(e){var n=e.body;0===n.replace(/\s/g,"").length?r(new Error("\u8ba2\u9605\u5185\u5bb9\u4e3a\u7a7a\uff01")):t(n)}))})),cache.set(n,i),t.abrupt("return",i);case 8:case"end":return t.stop()}}),t)})),(_download=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_48(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_48(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}var _$logical_50={};function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r"']/g,P=RegExp(I.source),$=RegExp(N.source),j=/<%-([\s\S]+?)%>/g,F=/<%([\s\S]+?)%>/g,U=/<%=([\s\S]+?)%>/g,M=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,D=/^\w*$/,B=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,H=/[\\^$.*+?()[\]{}|]/g,G=RegExp(H.source),Y=/^\s+/,W=/\s/,K=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,z=/\{\n\/\* \[wrapped with (.+)\] \*/,J=/,? & /,q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,X=/[()=,{}\[\]\/\s]/,Q=/\\(\\)?/g,V=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Z=/\w*$/,tt=/^[-+]0x[0-9a-f]+$/i,et=/^0b[01]+$/i,rt=/^\[object .+?Constructor\]$/,nt=/^0o[0-7]+$/i,ot=/^(?:0|[1-9]\d*)$/,it=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,at=/($^)/,ut=/['\n\r\u2028\u2029\\]/g,ct="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",st="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ft="["+st+"]",lt="["+ct+"]",pt="\\d+",ht="[a-z\\xdf-\\xf6\\xf8-\\xff]",dt="[^\\ud800-\\udfff"+st+pt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",_t="\\ud83c[\\udffb-\\udfff]",vt="[^\\ud800-\\udfff]",yt="(?:\\ud83c[\\udde6-\\uddff]){2}",gt="[\\ud800-\\udbff][\\udc00-\\udfff]",mt="[A-Z\\xc0-\\xd6\\xd8-\\xde]",wt="(?:"+ht+"|"+dt+")",bt="(?:"+mt+"|"+dt+")",At="(?:"+lt+"|"+_t+")?",Et="[\\ufe0e\\ufe0f]?"+At+"(?:\\u200d(?:"+[vt,yt,gt].join("|")+")[\\ufe0e\\ufe0f]?"+At+")*",Ot="(?:"+["[\\u2700-\\u27bf]",yt,gt].join("|")+")"+Et,St="(?:"+[vt+lt+"?",lt,yt,gt,"[\\ud800-\\udfff]"].join("|")+")",xt=RegExp("['\u2019]","g"),Lt=RegExp(lt,"g"),Tt=RegExp(_t+"(?="+_t+")|"+St+Et,"g"),Ct=RegExp([mt+"?"+ht+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?="+[ft,mt,"$"].join("|")+")",bt+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?="+[ft,mt+wt,"$"].join("|")+")",mt+"?"+wt+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?",mt+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",pt,Ot].join("|"),"g"),Rt=RegExp("[\\u200d\\ud800-\\udfff"+ct+"\\ufe0e\\ufe0f]"),kt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,It=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Nt=-1,Pt={};Pt[b]=Pt[A]=Pt[E]=Pt[O]=Pt[S]=Pt[x]=Pt["[object Uint8ClampedArray]"]=Pt[L]=Pt[T]=!0,Pt[o]=Pt[i]=Pt[m]=Pt[a]=Pt[w]=Pt[u]=Pt[c]=Pt[s]=Pt[l]=Pt[p]=Pt[h]=Pt[d]=Pt[_]=Pt[v]=Pt[g]=!1;var $t={};$t[o]=$t[i]=$t[m]=$t[w]=$t[a]=$t[u]=$t[b]=$t[A]=$t[E]=$t[O]=$t[S]=$t[l]=$t[p]=$t[h]=$t[d]=$t[_]=$t[v]=$t[y]=$t[x]=$t["[object Uint8ClampedArray]"]=$t[L]=$t[T]=!0,$t[c]=$t[s]=$t[g]=!1;var jt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ft=parseFloat,Ut=parseInt,Mt="object"==typeof t&&t&&t.Object===Object&&t,Dt="object"==typeof self&&self&&self.Object===Object&&self,Bt=Mt||Dt||Function("return this")(),Ht="object"==typeof _$lodash_35.exports&&_$lodash_35.exports&&!_$lodash_35.exports.nodeType&&_$lodash_35.exports,Gt=Ht&&_$lodash_35&&!_$lodash_35.nodeType&&_$lodash_35,Yt=Gt&&Gt.exports===Ht,Wt=Yt&&Mt.process,Kt=function(){try{return Gt&&Gt.require&&Gt.require("util").types||Wt&&Wt.binding&&Wt.binding("util")}catch(t){}}(),zt=Kt&&Kt.isArrayBuffer,Jt=Kt&&Kt.isDate,qt=Kt&&Kt.isMap,Xt=Kt&&Kt.isRegExp,Qt=Kt&&Kt.isSet,Vt=Kt&&Kt.isTypedArray;function Zt(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function te(t,e,r,n){for(var o=-1,i=null==t?0:t.length;++o-1}function ae(t,e,r){for(var n=-1,o=null==t?0:t.length;++n-1;);return r}function Ce(t,e){for(var r=t.length;r--&&_e(e,t[r],0)>-1;);return r}var Re=we({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),ke=we({"&":"&","<":"<",">":">",'"':""","'":"'"});function Ie(t){return"\\"+jt[t]}function Ne(t){return Rt.test(t)}function Pe(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function $e(t,e){return function(r){return t(e(r))}}function je(t,e){for(var n=-1,o=t.length,i=0,a=[];++n",""":'"',"'":"'"}),Ge=function t(W){var ct,st=(W=null==W?Bt:Ge.defaults(Bt.Object(),W,Ge.pick(Bt,It))).Array,ft=W.Date,lt=W.Error,pt=W.Function,ht=W.Math,dt=W.Object,_t=W.RegExp,vt=W.String,yt=W.TypeError,gt=st.prototype,mt=pt.prototype,wt=dt.prototype,bt=W["__core-js_shared__"],At=mt.toString,Et=wt.hasOwnProperty,Ot=0,St=(ct=/[^.]+$/.exec(bt&&bt.keys&&bt.keys.IE_PROTO||""))?"Symbol(src)_1."+ct:"",Tt=wt.toString,Rt=At.call(dt),jt=Bt._,Mt=_t("^"+At.call(Et).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Dt=Yt?W.Buffer:void 0,Ht=W.Symbol,Gt=W.Uint8Array,Wt=Dt?Dt.allocUnsafe:void 0,Kt=$e(dt.getPrototypeOf,dt),pe=dt.create,we=wt.propertyIsEnumerable,Ye=gt.splice,We=Ht?Ht.isConcatSpreadable:void 0,Ke=Ht?Ht.iterator:void 0,ze=Ht?Ht.toStringTag:void 0,Je=function(){try{var t=Zo(dt,"defineProperty");return t({},"",{}),t}catch(e){}}(),qe=W.clearTimeout!==Bt.clearTimeout&&W.clearTimeout,Xe=ft&&ft.now!==Bt.Date.now&&ft.now,Qe=W.setTimeout!==Bt.setTimeout&&W.setTimeout,Ve=ht.ceil,Ze=ht.floor,tr=dt.getOwnPropertySymbols,er=Dt?Dt.isBuffer:void 0,rr=W.isFinite,nr=gt.join,or=$e(dt.keys,dt),ir=ht.max,ar=ht.min,ur=ft.now,cr=W.parseInt,sr=ht.random,fr=gt.reverse,lr=Zo(W,"DataView"),pr=Zo(W,"Map"),hr=Zo(W,"Promise"),dr=Zo(W,"Set"),_r=Zo(W,"WeakMap"),vr=Zo(dt,"create"),yr=_r&&new _r,gr={},mr=Si(lr),wr=Si(pr),br=Si(hr),Ar=Si(dr),Er=Si(_r),Or=Ht?Ht.prototype:void 0,Sr=Or?Or.valueOf:void 0,xr=Or?Or.toString:void 0;function Lr(t){if(Ha(t)&&!ka(t)&&!(t instanceof kr)){if(t instanceof Rr)return t;if(Et.call(t,"__wrapped__"))return xi(t)}return new Rr(t)}var Tr=function(){function t(){}return function(e){if(!Ba(e))return{};if(pe)return pe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Cr(){}function Rr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function kr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Ir(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function qr(t,e,r,n,i,c){var g,C=1&e,R=2&e,k=4&e;if(r&&(g=i?r(t,n,i,c):r(t)),void 0!==g)return g;if(!Ba(t))return t;var I=ka(t);if(I){if(g=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&Et.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!C)return yo(t,g)}else{var N=ri(t),P=N==s||N==f;if($a(t))return fo(t,C);if(N==h||N==o||P&&!i){if(g=R||P?{}:oi(t),!C)return R?function(t,e){return go(t,ei(t),e)}(t,function(t,e){return t&&go(e,mu(e),t)}(g,t)):function(t,e){return go(t,ti(t),e)}(t,Wr(g,t))}else{if(!$t[N])return i?t:{};g=function(t,e,r){var n,o,i,c=t.constructor;switch(e){case m:return lo(t);case a:case u:return new c(+t);case w:return function(t,e){var r=e?lo(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case b:case A:case E:case O:case S:case x:case"[object Uint8ClampedArray]":case L:case T:return po(t,r);case l:return new c;case p:case v:return new c(t);case d:return(i=new(o=t).constructor(o.source,Z.exec(o))).lastIndex=o.lastIndex,i;case _:return new c;case y:return n=t,Sr?dt(Sr.call(n)):{}}}(t,N,C)}}c||(c=new jr);var $=c.get(t);if($)return $;c.set(t,g),za(t)?t.forEach((function(n){g.add(qr(n,e,r,n,t,c))})):Ga(t)&&t.forEach((function(n,o){g.set(o,qr(n,e,r,o,t,c))}));var j=I?void 0:(k?R?Ko:Wo:R?mu:gu)(t);return ee(j||t,(function(n,o){j&&(n=t[o=n]),Hr(g,o,qr(n,e,r,o,t,c))})),g}function Xr(t,e,r){var n=r.length;if(null==t)return!n;for(t=dt(t);n--;){var o=r[n],i=e[o],a=t[o];if(void 0===a&&!(o in t)||!i(a))return!1}return!0}function Qr(t,r,n){if("function"!=typeof t)throw new yt(e);return gi((function(){t.apply(void 0,n)}),r)}function Vr(t,e,r,n){var o=-1,i=ie,a=!0,u=t.length,c=[],s=e.length;if(!u)return c;r&&(e=ue(e,Se(r))),n?(i=ae,a=!1):e.length>=200&&(i=Le,a=!1,e=new $r(e));t:for(;++o-1},Nr.prototype.set=function(t,e){var r=this.__data__,n=Gr(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},Pr.prototype.clear=function(){this.size=0,this.__data__={hash:new Ir,map:new(pr||Nr),string:new Ir}},Pr.prototype.delete=function(t){var e=Qo(this,t).delete(t);return this.size-=e?1:0,e},Pr.prototype.get=function(t){return Qo(this,t).get(t)},Pr.prototype.has=function(t){return Qo(this,t).has(t)},Pr.prototype.set=function(t,e){var r=Qo(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},$r.prototype.add=$r.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},$r.prototype.has=function(t){return this.__data__.has(t)},jr.prototype.clear=function(){this.__data__=new Nr,this.size=0},jr.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},jr.prototype.get=function(t){return this.__data__.get(t)},jr.prototype.has=function(t){return this.__data__.has(t)},jr.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Nr){var n=r.__data__;if(!pr||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Pr(n)}return r.set(t,e),this.size=r.size,this};var Zr=bo(cn),tn=bo(sn,!0);function en(t,e){var r=!0;return Zr(t,(function(t,n,o){return r=!!e(t,n,o)})),r}function rn(t,e,r){for(var n=-1,o=t.length;++n0&&r(u)?e>1?on(u,e-1,r,n,o):ce(o,u):n||(o[o.length]=u)}return o}var an=Ao(),un=Ao(!0);function cn(t,e){return t&&an(t,e,gu)}function sn(t,e){return t&&un(t,e,gu)}function fn(t,e){return oe(e,(function(e){return Ua(t[e])}))}function ln(t,e){for(var r=0,n=(e=ao(e,t)).length;null!=t&&re}function _n(t,e){return null!=t&&Et.call(t,e)}function vn(t,e){return null!=t&&e in dt(t)}function yn(t,e,r){for(var n=r?ae:ie,o=t[0].length,i=t.length,a=i,u=st(i),c=1/0,s=[];a--;){var f=t[a];a&&e&&(f=ue(f,Se(e))),c=ar(f.length,c),u[a]=!r&&(e||o>=120&&f.length>=120)?new $r(a&&f):void 0}f=t[0];var l=-1,p=u[0];t:for(;++l=u?c:c*("desc"==r[n]?-1:1)}return t.index-e.index}(t,e,r)}));n--;)t[n]=t[n].value;return t}(xn(t,(function(t,r,o){return{criteria:ue(e,(function(e){return e(t)})),index:++n,value:t}})))}function In(t,e,r){for(var n=-1,o=e.length,i={};++n-1;)u!==t&&Ye.call(u,c,1),Ye.call(t,c,1);return t}function Pn(t,e){for(var r=t?e.length:0,n=r-1;r--;){var o=e[r];if(r==n||o!==i){var i=o;ai(o)?Ye.call(t,o,1):Vn(t,o)}}return t}function $n(t,e){return t+Ze(sr()*(e-t+1))}function jn(t,e){var r="";if(!t||e<1||e>9007199254740991)return r;do{e%2&&(r+=t),(e=Ze(e/2))&&(t+=t)}while(e);return r}function Fn(t,e){return mi(di(t,e,Yu),t+"")}function Un(t){return Ur(Lu(t))}function Mn(t,e){var r=Lu(t);return Ai(r,Jr(e,0,r.length))}function Dn(t,e,r,n){if(!Ba(t))return t;for(var o=-1,i=(e=ao(e,t)).length,a=i-1,u=t;null!=u&&++oo?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=st(o);++n>>1,a=t[i];null!==a&&!qa(a)&&(r?a<=e:a=200){var s=e?null:Fo(t);if(s)return Fe(s);a=!1,o=Le,c=new $r}else c=e?[]:u;t:for(;++n=n?t:Yn(t,e,r)}var so=qe||function(t){return Bt.clearTimeout(t)};function fo(t,e){if(e)return t.slice();var r=t.length,n=Wt?Wt(r):new t.constructor(r);return t.copy(n),n}function lo(t){var e=new t.constructor(t.byteLength);return new Gt(e).set(new Gt(t)),e}function po(t,e){var r=e?lo(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function ho(t,e){if(t!==e){var r=void 0!==t,n=null===t,o=t==t,i=qa(t),a=void 0!==e,u=null===e,c=e==e,s=qa(e);if(!u&&!s&&!i&&t>e||i&&a&&c&&!u&&!s||n&&a&&c||!r&&c||!o)return 1;if(!n&&!i&&!s&&t1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,a&&ui(r[0],r[1],a)&&(i=o<3?void 0:i,o=1),e=dt(e);++n-1?o[i?e[a]:a]:void 0}}function Lo(t){return Yo((function(r){var n=r.length,o=n,i=Rr.prototype.thru;for(t&&r.reverse();o--;){var a=r[o];if("function"!=typeof a)throw new yt(e);if(i&&!u&&"wrapper"==Jo(a))var u=new Rr([],!0)}for(o=u?o:n;++o1&&g.reverse(),f&&cu))return!1;var s=i.get(t),f=i.get(e);if(s&&f)return s==e&&f==t;var l=-1,p=!0,h=2&r?new $r:void 0;for(i.set(t,e),i.set(e,t);++l-1&&t%1==0&&t1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(K,"{\n/* [wrapped with "+e+"] */\n")}(o,function(t,e){return ee(n,(function(r){var n="_."+r[0];e&r[1]&&!ie(t,n)&&t.push(n)})),t.sort()}(function(t){var e=t.match(z);return e?e[1].split(J):[]}(o),r)))}function bi(t){var e=0,r=0;return function(){var n=ur(),o=16-(n-r);if(r=n,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Ai(t,e){var r=-1,n=t.length,o=n-1;for(e=void 0===e?n:e;++r1?t[e-1]:void 0;return r="function"==typeof r?(t.pop(),r):void 0,Ki(t,r)}));function Zi(t){var e=Lr(t);return e.__chain__=!0,e}function ta(t,e){return e(t)}var ea=Yo((function(t){var e=t.length,r=e?t[0]:0,n=this.__wrapped__,o=function(e){return zr(e,t)};return!(e>1||this.__actions__.length)&&n instanceof kr&&ai(r)?((n=n.slice(r,+r+(e?1:0))).__actions__.push({func:ta,args:[o],thisArg:void 0}),new Rr(n,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(o)})),ra=mo((function(t,e,r){Et.call(t,r)?++t[r]:Kr(t,r,1)})),na=xo(Ri),oa=xo(ki);function ia(t,e){return(ka(t)?ee:Zr)(t,Xo(e,3))}function aa(t,e){return(ka(t)?re:tn)(t,Xo(e,3))}var ua=mo((function(t,e,r){Et.call(t,r)?t[r].push(e):Kr(t,r,[e])})),ca=Fn((function(t,e,r){var n=-1,o="function"==typeof e,i=Na(t)?st(t.length):[];return Zr(t,(function(t){i[++n]=o?Zt(e,t,r):gn(t,e,r)})),i})),sa=mo((function(t,e,r){Kr(t,r,e)}));function fa(t,e){return(ka(t)?ue:xn)(t,Xo(e,3))}var la=mo((function(t,e,r){t[r?0:1].push(e)}),(function(){return[[],[]]})),pa=Fn((function(t,e){if(null==t)return[];var r=e.length;return r>1&&ui(t,e[0],e[1])?e=[]:r>2&&ui(e[0],e[1],e[2])&&(e=[e[0]]),kn(t,on(e,1),[])})),ha=Xe||function(){return Bt.Date.now()};function da(t,e,r){return e=r?void 0:e,Mo(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function _a(t,r){var n;if("function"!=typeof r)throw new yt(e);return t=eu(t),function(){return--t>0&&(n=r.apply(this,arguments)),t<=1&&(r=void 0),n}}var va=Fn((function(t,e,r){var n=1;if(r.length){var o=je(r,qo(va));n|=32}return Mo(t,n,e,r,o)})),ya=Fn((function(t,e,r){var n=3;if(r.length){var o=je(r,qo(ya));n|=32}return Mo(e,n,t,r,o)}));function ga(t,r,n){var o,i,a,u,c,s,f=0,l=!1,p=!1,h=!0;if("function"!=typeof t)throw new yt(e);function d(e){var r=o,n=i;return o=i=void 0,f=e,u=t.apply(n,r)}function _(t){var e=t-s;return void 0===s||e>=r||e<0||p&&t-f>=a}function v(){var t=ha();if(_(t))return y(t);c=gi(v,function(t){var e=r-(t-s);return p?ar(e,a-(t-f)):e}(t))}function y(t){return c=void 0,h&&o?d(t):(o=i=void 0,u)}function g(){var t=ha(),e=_(t);if(o=arguments,i=this,s=t,e){if(void 0===c)return function(t){return f=t,c=gi(v,r),l?d(t):u}(s);if(p)return so(c),c=gi(v,r),d(s)}return void 0===c&&(c=gi(v,r)),u}return r=nu(r)||0,Ba(n)&&(l=!!n.leading,a=(p="maxWait"in n)?ir(nu(n.maxWait)||0,r):a,h="trailing"in n?!!n.trailing:h),g.cancel=function(){void 0!==c&&so(c),f=0,o=s=i=c=void 0},g.flush=function(){return void 0===c?u:y(ha())},g}var ma=Fn((function(t,e){return Qr(t,1,e)})),wa=Fn((function(t,e,r){return Qr(t,nu(e)||0,r)}));function ba(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new yt(e);var n=function(){var e=arguments,o=r?r.apply(this,e):e[0],i=n.cache;if(i.has(o))return i.get(o);var a=t.apply(this,e);return n.cache=i.set(o,a)||i,a};return n.cache=new(ba.Cache||Pr),n}function Aa(t){if("function"!=typeof t)throw new yt(e);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ba.Cache=Pr;var Ea=uo((function(t,e){var r=(e=1==e.length&&ka(e[0])?ue(e[0],Se(Xo())):ue(on(e,1),Se(Xo()))).length;return Fn((function(n){for(var o=-1,i=ar(n.length,r);++o=e})),Ra=mn(function(){return arguments}())?mn:function(t){return Ha(t)&&Et.call(t,"callee")&&!we.call(t,"callee")},ka=st.isArray,Ia=zt?Se(zt):function(t){return Ha(t)&&hn(t)==m};function Na(t){return null!=t&&Da(t.length)&&!Ua(t)}function Pa(t){return Ha(t)&&Na(t)}var $a=er||nc,ja=Jt?Se(Jt):function(t){return Ha(t)&&hn(t)==u};function Fa(t){if(!Ha(t))return!1;var e=hn(t);return e==c||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Wa(t)}function Ua(t){if(!Ba(t))return!1;var e=hn(t);return e==s||e==f||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ma(t){return"number"==typeof t&&t==eu(t)}function Da(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Ba(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ha(t){return null!=t&&"object"==typeof t}var Ga=qt?Se(qt):function(t){return Ha(t)&&ri(t)==l};function Ya(t){return"number"==typeof t||Ha(t)&&hn(t)==p}function Wa(t){if(!Ha(t)||hn(t)!=h)return!1;var e=Kt(t);if(null===e)return!0;var r=Et.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&At.call(r)==Rt}var Ka=Xt?Se(Xt):function(t){return Ha(t)&&hn(t)==d},za=Qt?Se(Qt):function(t){return Ha(t)&&ri(t)==_};function Ja(t){return"string"==typeof t||!ka(t)&&Ha(t)&&hn(t)==v}function qa(t){return"symbol"==typeof t||Ha(t)&&hn(t)==y}var Xa=Vt?Se(Vt):function(t){return Ha(t)&&Da(t.length)&&!!Pt[hn(t)]},Qa=Po(Sn),Va=Po((function(t,e){return t<=e}));function Za(t){if(!t)return[];if(Na(t))return Ja(t)?De(t):yo(t);if(Ke&&t[Ke])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[Ke]());var e=ri(t);return(e==l?Pe:e==_?Fe:Lu)(t)}function tu(t){return t?(t=nu(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function eu(t){var e=tu(t),r=e%1;return e==e?r?e-r:e:0}function ru(t){return t?Jr(eu(t),0,4294967295):0}function nu(t){if("number"==typeof t)return t;if(qa(t))return NaN;if(Ba(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ba(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Oe(t);var r=et.test(t);return r||nt.test(t)?Ut(t.slice(2),r?2:8):tt.test(t)?NaN:+t}function ou(t){return go(t,mu(t))}function iu(t){return null==t?"":Xn(t)}var au=wo((function(t,e){if(li(e)||Na(e))go(e,gu(e),t);else for(var r in e)Et.call(e,r)&&Hr(t,r,e[r])})),uu=wo((function(t,e){go(e,mu(e),t)})),cu=wo((function(t,e,r,n){go(e,mu(e),t,n)})),su=wo((function(t,e,r,n){go(e,gu(e),t,n)})),fu=Yo(zr),lu=Fn((function(t,e){t=dt(t);var r=-1,n=e.length,o=n>2?e[2]:void 0;for(o&&ui(e[0],e[1],o)&&(n=1);++r1),e})),go(t,Ko(t),r),n&&(r=qr(r,7,Ho));for(var o=e.length;o--;)Vn(r,e[o]);return r})),Eu=Yo((function(t,e){return null==t?{}:function(t,e){return In(t,e,(function(e,r){return du(t,r)}))}(t,e)}));function Ou(t,e){if(null==t)return{};var r=ue(Ko(t),(function(t){return[t]}));return e=Xo(e),In(t,r,(function(t,r){return e(t,r[0])}))}var Su=Uo(gu),xu=Uo(mu);function Lu(t){return null==t?[]:xe(t,gu(t))}var Tu=Oo((function(t,e,r){return e=e.toLowerCase(),t+(r?Cu(e):e)}));function Cu(t){return Fu(iu(t).toLowerCase())}function Ru(t){return(t=iu(t))&&t.replace(it,Re).replace(Lt,"")}var ku=Oo((function(t,e,r){return t+(r?"-":"")+e.toLowerCase()})),Iu=Oo((function(t,e,r){return t+(r?" ":"")+e.toLowerCase()})),Nu=Eo("toLowerCase"),Pu=Oo((function(t,e,r){return t+(r?"_":"")+e.toLowerCase()})),$u=Oo((function(t,e,r){return t+(r?" ":"")+Fu(e)})),ju=Oo((function(t,e,r){return t+(r?" ":"")+e.toUpperCase()})),Fu=Eo("toUpperCase");function Uu(t,e,r){return t=iu(t),void 0===(e=r?void 0:e)?function(t){return kt.test(t)}(t)?function(t){return t.match(Ct)||[]}(t):function(t){return t.match(q)||[]}(t):t.match(e)||[]}var Mu=Fn((function(t,e){try{return Zt(t,void 0,e)}catch(r){return Fa(r)?r:new lt(r)}})),Du=Yo((function(t,e){return ee(e,(function(e){e=Oi(e),Kr(t,e,va(t[e],t))})),t}));function Bu(t){return function(){return t}}var Hu=Lo(),Gu=Lo(!0);function Yu(t){return t}function Wu(t){return En("function"==typeof t?t:qr(t,1))}var Ku=Fn((function(t,e){return function(r){return gn(r,t,e)}})),zu=Fn((function(t,e){return function(r){return gn(t,r,e)}}));function Ju(t,e,r){var n=gu(e),o=fn(e,n);null!=r||Ba(e)&&(o.length||!n.length)||(r=e,e=t,t=this,o=fn(e,gu(e)));var i=!(Ba(r)&&"chain"in r&&!r.chain),a=Ua(t);return ee(o,(function(r){var n=e[r];t[r]=n,a&&(t.prototype[r]=function(){var e=this.__chain__;if(i||e){var r=t(this.__wrapped__);return(r.__actions__=yo(this.__actions__)).push({func:n,args:arguments,thisArg:t}),r.__chain__=e,r}return n.apply(t,ce([this.value()],arguments))})})),t}function qu(){}var Xu=ko(ue),Qu=ko(ne),Vu=ko(le);function Zu(t){return ci(t)?me(Oi(t)):function(t){return function(e){return ln(e,t)}}(t)}var tc=No(),ec=No(!0);function rc(){return[]}function nc(){return!1}var oc,ic=Ro((function(t,e){return t+e}),0),ac=jo("ceil"),uc=Ro((function(t,e){return t/e}),1),cc=jo("floor"),sc=Ro((function(t,e){return t*e}),1),fc=jo("round"),lc=Ro((function(t,e){return t-e}),0);return Lr.after=function(t,r){if("function"!=typeof r)throw new yt(e);return t=eu(t),function(){if(--t<1)return r.apply(this,arguments)}},Lr.ary=da,Lr.assign=au,Lr.assignIn=uu,Lr.assignInWith=cu,Lr.assignWith=su,Lr.at=fu,Lr.before=_a,Lr.bind=va,Lr.bindAll=Du,Lr.bindKey=ya,Lr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return ka(t)?t:[t]},Lr.chain=Zi,Lr.chunk=function(t,e,r){e=(r?ui(t,e,r):void 0===e)?1:ir(eu(e),0);var n=null==t?0:t.length;if(!n||e<1)return[];for(var o=0,i=0,a=st(Ve(n/e));oo?0:o+r),(n=void 0===n||n>o?o:eu(n))<0&&(n+=o),n=r>n?0:ru(n);r>>0)?(t=iu(t))&&("string"==typeof e||null!=e&&!Ka(e))&&!(e=Xn(e))&&Ne(t)?co(De(t),0,r):t.split(e,r):[]},Lr.spread=function(t,r){if("function"!=typeof t)throw new yt(e);return r=null==r?0:ir(eu(r),0),Fn((function(e){var n=e[r],o=co(e,0,r);return n&&ce(o,n),Zt(t,this,o)}))},Lr.tail=function(t){var e=null==t?0:t.length;return e?Yn(t,1,e):[]},Lr.take=function(t,e,r){return t&&t.length?Yn(t,0,(e=r||void 0===e?1:eu(e))<0?0:e):[]},Lr.takeRight=function(t,e,r){var n=null==t?0:t.length;return n?Yn(t,(e=n-(e=r||void 0===e?1:eu(e)))<0?0:e,n):[]},Lr.takeRightWhile=function(t,e){return t&&t.length?to(t,Xo(e,3),!1,!0):[]},Lr.takeWhile=function(t,e){return t&&t.length?to(t,Xo(e,3)):[]},Lr.tap=function(t,e){return e(t),t},Lr.throttle=function(t,r,n){var o=!0,i=!0;if("function"!=typeof t)throw new yt(e);return Ba(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),ga(t,r,{leading:o,maxWait:r,trailing:i})},Lr.thru=ta,Lr.toArray=Za,Lr.toPairs=Su,Lr.toPairsIn=xu,Lr.toPath=function(t){return ka(t)?ue(t,Oi):qa(t)?[t]:yo(Ei(iu(t)))},Lr.toPlainObject=ou,Lr.transform=function(t,e,r){var n=ka(t),o=n||$a(t)||Xa(t);if(e=Xo(e,4),null==r){var i=t&&t.constructor;r=o?n?new i:[]:Ba(t)&&Ua(i)?Tr(Kt(t)):{}}return(o?ee:cn)(t,(function(t,n,o){return e(r,t,n,o)})),r},Lr.unary=function(t){return da(t,1)},Lr.union=Hi,Lr.unionBy=Gi,Lr.unionWith=Yi,Lr.uniq=function(t){return t&&t.length?Qn(t):[]},Lr.uniqBy=function(t,e){return t&&t.length?Qn(t,Xo(e,2)):[]},Lr.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Qn(t,void 0,e):[]},Lr.unset=function(t,e){return null==t||Vn(t,e)},Lr.unzip=Wi,Lr.unzipWith=Ki,Lr.update=function(t,e,r){return null==t?t:Zn(t,e,io(r))},Lr.updateWith=function(t,e,r,n){return n="function"==typeof n?n:void 0,null==t?t:Zn(t,e,io(r),n)},Lr.values=Lu,Lr.valuesIn=function(t){return null==t?[]:xe(t,mu(t))},Lr.without=zi,Lr.words=Uu,Lr.wrap=function(t,e){return Oa(io(e),t)},Lr.xor=Ji,Lr.xorBy=qi,Lr.xorWith=Xi,Lr.zip=Qi,Lr.zipObject=function(t,e){return no(t||[],e||[],Hr)},Lr.zipObjectDeep=function(t,e){return no(t||[],e||[],Dn)},Lr.zipWith=Vi,Lr.entries=Su,Lr.entriesIn=xu,Lr.extend=uu,Lr.extendWith=cu,Ju(Lr,Lr),Lr.add=ic,Lr.attempt=Mu,Lr.camelCase=Tu,Lr.capitalize=Cu,Lr.ceil=ac,Lr.clamp=function(t,e,r){return void 0===r&&(r=e,e=void 0),void 0!==r&&(r=(r=nu(r))==r?r:0),void 0!==e&&(e=(e=nu(e))==e?e:0),Jr(nu(t),e,r)},Lr.clone=function(t){return qr(t,4)},Lr.cloneDeep=function(t){return qr(t,5)},Lr.cloneDeepWith=function(t,e){return qr(t,5,e="function"==typeof e?e:void 0)},Lr.cloneWith=function(t,e){return qr(t,4,e="function"==typeof e?e:void 0)},Lr.conformsTo=function(t,e){return null==e||Xr(t,e,gu(e))},Lr.deburr=Ru,Lr.defaultTo=function(t,e){return null==t||t!=t?e:t},Lr.divide=uc,Lr.endsWith=function(t,e,r){t=iu(t),e=Xn(e);var n=t.length,o=r=void 0===r?n:Jr(eu(r),0,n);return(r-=e.length)>=0&&t.slice(r,o)==e},Lr.eq=La,Lr.escape=function(t){return(t=iu(t))&&$.test(t)?t.replace(N,ke):t},Lr.escapeRegExp=function(t){return(t=iu(t))&&G.test(t)?t.replace(H,"\\$&"):t},Lr.every=function(t,e,r){var n=ka(t)?ne:en;return r&&ui(t,e,r)&&(e=void 0),n(t,Xo(e,3))},Lr.find=na,Lr.findIndex=Ri,Lr.findKey=function(t,e){return he(t,Xo(e,3),cn)},Lr.findLast=oa,Lr.findLastIndex=ki,Lr.findLastKey=function(t,e){return he(t,Xo(e,3),sn)},Lr.floor=cc,Lr.forEach=ia,Lr.forEachRight=aa,Lr.forIn=function(t,e){return null==t?t:an(t,Xo(e,3),mu)},Lr.forInRight=function(t,e){return null==t?t:un(t,Xo(e,3),mu)},Lr.forOwn=function(t,e){return t&&cn(t,Xo(e,3))},Lr.forOwnRight=function(t,e){return t&&sn(t,Xo(e,3))},Lr.get=hu,Lr.gt=Ta,Lr.gte=Ca,Lr.has=function(t,e){return null!=t&&ni(t,e,_n)},Lr.hasIn=du,Lr.head=Ni,Lr.identity=Yu,Lr.includes=function(t,e,r,n){t=Na(t)?t:Lu(t),r=r&&!n?eu(r):0;var o=t.length;return r<0&&(r=ir(o+r,0)),Ja(t)?r<=o&&t.indexOf(e,r)>-1:!!o&&_e(t,e,r)>-1},Lr.indexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=null==r?0:eu(r);return o<0&&(o=ir(n+o,0)),_e(t,e,o)},Lr.inRange=function(t,e,r){return e=tu(e),void 0===r?(r=e,e=0):r=tu(r),function(t,e,r){return t>=ar(e,r)&&t=-9007199254740991&&t<=9007199254740991},Lr.isSet=za,Lr.isString=Ja,Lr.isSymbol=qa,Lr.isTypedArray=Xa,Lr.isUndefined=function(t){return void 0===t},Lr.isWeakMap=function(t){return Ha(t)&&ri(t)==g},Lr.isWeakSet=function(t){return Ha(t)&&"[object WeakSet]"==hn(t)},Lr.join=function(t,e){return null==t?"":nr.call(t,e)},Lr.kebabCase=ku,Lr.last=Fi,Lr.lastIndexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=n;return void 0!==r&&(o=(o=eu(r))<0?ir(n+o,0):ar(o,n-1)),e==e?function(t,e,r){for(var n=r+1;n--;)if(t[n]===e)return n;return n}(t,e,o):de(t,ye,o,!0)},Lr.lowerCase=Iu,Lr.lowerFirst=Nu,Lr.lt=Qa,Lr.lte=Va,Lr.max=function(t){return t&&t.length?rn(t,Yu,dn):void 0},Lr.maxBy=function(t,e){return t&&t.length?rn(t,Xo(e,2),dn):void 0},Lr.mean=function(t){return ge(t,Yu)},Lr.meanBy=function(t,e){return ge(t,Xo(e,2))},Lr.min=function(t){return t&&t.length?rn(t,Yu,Sn):void 0},Lr.minBy=function(t,e){return t&&t.length?rn(t,Xo(e,2),Sn):void 0},Lr.stubArray=rc,Lr.stubFalse=nc,Lr.stubObject=function(){return{}},Lr.stubString=function(){return""},Lr.stubTrue=function(){return!0},Lr.multiply=sc,Lr.nth=function(t,e){return t&&t.length?Rn(t,eu(e)):void 0},Lr.noConflict=function(){return Bt._===this&&(Bt._=jt),this},Lr.noop=qu,Lr.now=ha,Lr.pad=function(t,e,r){t=iu(t);var n=(e=eu(e))?Me(t):0;if(!e||n>=e)return t;var o=(e-n)/2;return Io(Ze(o),r)+t+Io(Ve(o),r)},Lr.padEnd=function(t,e,r){t=iu(t);var n=(e=eu(e))?Me(t):0;return e&&ne){var n=t;t=e,e=n}if(r||t%1||e%1){var o=sr();return ar(t+o*(e-t+Ft("1e-"+((o+"").length-1))),e)}return $n(t,e)},Lr.reduce=function(t,e,r){var n=ka(t)?se:be,o=arguments.length<3;return n(t,Xo(e,4),r,o,Zr)},Lr.reduceRight=function(t,e,r){var n=ka(t)?fe:be,o=arguments.length<3;return n(t,Xo(e,4),r,o,tn)},Lr.repeat=function(t,e,r){return e=(r?ui(t,e,r):void 0===e)?1:eu(e),jn(iu(t),e)},Lr.replace=function(){var t=arguments,e=iu(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Lr.result=function(t,e,r){var n=-1,o=(e=ao(e,t)).length;for(o||(o=1,t=void 0);++n9007199254740991)return[];var r=4294967295,n=ar(t,4294967295);t-=4294967295;for(var o=Ee(n,e=Xo(e));++r=i)return t;var u=r-Me(n);if(u<1)return n;var c=a?co(a,0,u).join(""):t.slice(0,u);if(void 0===o)return c+n;if(a&&(u+=c.length-u),Ka(o)){if(t.slice(u).search(o)){var s,f=c;for(o.global||(o=_t(o.source,iu(Z.exec(o))+"g")),o.lastIndex=0;s=o.exec(f);)var l=s.index;c=c.slice(0,void 0===l?u:l)}}else if(t.indexOf(Xn(o),u)!=u){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+n},Lr.unescape=function(t){return(t=iu(t))&&P.test(t)?t.replace(I,He):t},Lr.uniqueId=function(t){var e=++Ot;return iu(t)+e},Lr.upperCase=ju,Lr.upperFirst=Fu,Lr.each=ia,Lr.eachRight=aa,Lr.first=Ni,Ju(Lr,(oc={},cn(Lr,(function(t,e){Et.call(Lr.prototype,e)||(oc[e]=t)})),oc),{chain:!1}),Lr.VERSION="4.17.21",ee(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Lr[t].placeholder=Lr})),ee(["drop","take"],(function(t,e){kr.prototype[t]=function(r){r=void 0===r?1:ir(eu(r),0);var n=this.__filtered__&&!e?new kr(this):this.clone();return n.__filtered__?n.__takeCount__=ar(r,n.__takeCount__):n.__views__.push({size:ar(r,4294967295),type:t+(n.__dir__<0?"Right":"")}),n},kr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ee(["filter","map","takeWhile"],(function(t,e){var r=e+1,n=1==r||3==r;kr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Xo(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}})),ee(["head","last"],(function(t,e){var r="take"+(e?"Right":"");kr.prototype[t]=function(){return this[r](1).value()[0]}})),ee(["initial","tail"],(function(t,e){var r="drop"+(e?"":"Right");kr.prototype[t]=function(){return this.__filtered__?new kr(this):this[r](1)}})),kr.prototype.compact=function(){return this.filter(Yu)},kr.prototype.find=function(t){return this.filter(t).head()},kr.prototype.findLast=function(t){return this.reverse().find(t)},kr.prototype.invokeMap=Fn((function(t,e){return"function"==typeof t?new kr(this):this.map((function(r){return gn(r,t,e)}))})),kr.prototype.reject=function(t){return this.filter(Aa(Xo(t)))},kr.prototype.slice=function(t,e){t=eu(t);var r=this;return r.__filtered__&&(t>0||e<0)?new kr(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),void 0!==e&&(r=(e=eu(e))<0?r.dropRight(-e):r.take(e-t)),r)},kr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},kr.prototype.toArray=function(){return this.take(4294967295)},cn(kr.prototype,(function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),o=Lr[n?"take"+("last"==e?"Right":""):e],i=n||/^find/.test(e);o&&(Lr.prototype[e]=function(){var e=this.__wrapped__,a=n?[1]:arguments,u=e instanceof kr,c=a[0],s=u||ka(e),f=function(t){var e=o.apply(Lr,ce([t],a));return n&&l?e[0]:e};s&&r&&"function"==typeof c&&1!=c.length&&(u=s=!1);var l=this.__chain__,p=!!this.__actions__.length,h=i&&!l,d=u&&!p;if(!i&&s){e=d?e:new kr(this);var _=t.apply(e,a);return _.__actions__.push({func:ta,args:[f],thisArg:void 0}),new Rr(_,l)}return h&&d?t.apply(this,a):(_=this.thru(f),h?n?_.value()[0]:_.value():_)})})),ee(["pop","push","shift","sort","splice","unshift"],(function(t){var e=gt[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);Lr.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var o=this.value();return e.apply(ka(o)?o:[],t)}return this[r]((function(r){return e.apply(ka(r)?r:[],t)}))}})),cn(kr.prototype,(function(t,e){var r=Lr[e];if(r){var n=r.name+"";Et.call(gr,n)||(gr[n]=[]),gr[n].push({name:e,func:r})}})),gr[To(void 0,2).name]=[{name:"wrapper",func:void 0}],kr.prototype.clone=function(){var t=new kr(this.__wrapped__);return t.__actions__=yo(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=yo(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=yo(this.__views__),t},kr.prototype.reverse=function(){if(this.__filtered__){var t=new kr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},kr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=ka(t),n=e<0,o=r?t.length:0,i=function(t,e,r){for(var n=-1,o=r.length;++n=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},Lr.prototype.plant=function(t){for(var e,r=this;r instanceof Cr;){var n=xi(r);n.__index__=0,n.__values__=void 0,e?o.__wrapped__=n:e=n;var o=n;r=r.__wrapped__}return o.__wrapped__=t,e},Lr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof kr){var e=t;return this.__actions__.length&&(e=new kr(this)),(e=e.reverse()).__actions__.push({func:ta,args:[Bi],thisArg:void 0}),new Rr(e,this.__chain__)}return this.thru(Bi)},Lr.prototype.toJSON=Lr.prototype.valueOf=Lr.prototype.value=function(){return eo(this.__wrapped__,this.__actions__)},Lr.prototype.first=Lr.prototype.head,Ke&&(Lr.prototype[Ke]=function(){return this}),Lr}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Bt._=Ge,define((function(){return Ge}))):Gt?((Gt.exports=Ge)._=Ge,Ht._=Ge):Bt._=Ge}).call(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$lodash_35=_$lodash_35.exports;var _$processors_41={};function ___typeof_41(t){return(___typeof_41="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(_$processors_41,"__esModule",{value:!0}),_$processors_41.ApplyProcessor=function(t,e){return _ApplyProcessor.apply(this,arguments)},_$processors_41.default=void 0;var obj,_lodash=(obj=_$lodash_35)&&obj.__esModule?obj:{default:obj};function ___regeneratorRuntime_41(){___regeneratorRuntime_41=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(x){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new E(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(x){return{type:"throw",arg:x}}}t.wrap=c;var f={};function l(){}function p(){}function h(){}var d={};u(d,o,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(O([])));v&&v!==e&&r.call(v,o)&&(d=v);var y=h.prototype=l.prototype=Object.create(d);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==___typeof_41(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_41(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function ___asyncToGenerator_41(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_41(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_41(i,n,o,a,u,"throw",t)}a(void 0)}))}}function _createForOfIteratorHelper(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_41(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_41(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_41(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1?e-1:0),n=1;n0&&void 0!==arguments[0])||arguments[0];return{name:"Flag Operator",func:function(e){return e.map((function(e){if(t){var r=(0,_$geo_49.getFlag)(e.name);e.name=removeFlag(e.name),e.name=r+" "+e.name,e.name=e.name.replace(/\ud83c\uddf9\ud83c\uddfc/g,"\ud83c\udde8\ud83c\uddf3")}else e.name=removeFlag(e.name);return e}))}}},"Sort Operator":function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"asc";return{name:"Sort Operator",func:function(e){switch(t){case"asc":case"desc":return e.sort((function(e,r){return(e.name>r.name?1:-1)*("desc"===t?-1:1)}));case"random":return function(t){for(var e,r,n=t.length;0!==n;)r=Math.floor(Math.random()*n),e=t[n-=1],t[n]=t[r],t[r]=e;return t}(e);default:throw new Error("Unknown sort option: "+t)}}}},"Regex Sort Operator":function(t){return{name:"Regex Sort Operator",func:function(e){return t=t.map((function(t){return buildRegex(t)})),e.sort((function(e,r){var n=getRegexOrder(t,e.name),o=getRegexOrder(t,r.name);return n&&!o?-1:o&&!n?1:n&&o?n1){void 0===s[t.name]&&(s[t.name]=1);for(var e="",r=s[t.name]++,n=0;r>0;)e=a[r%10]+e,r=parseInt(r/10),n++;for(;n++0&&-1==="\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(n-1));)if(n-=1,this.position-n>e/2-1){r=" ... ",n+=5;break}for(o="",i=this.position;ie/2-1){o=" ... ",i-=5;break}return a=this.buffer.slice(n,i),_$common_7.repeat(" ",t)+r+a+o+"\n"+_$common_7.repeat(" ",t+this.position-n+r.length)+"^"},Mark.prototype.toString=function(t){var e,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),t||(e=this.getSnippet())&&(r+=":\n"+e),r},_$mark_11=Mark;var TYPE_CONSTRUCTOR_OPTIONS=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],YAML_NODE_KINDS=["scalar","sequence","mapping"],_$type_18=function(t,e){var r,n;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===TYPE_CONSTRUCTOR_OPTIONS.indexOf(e))throw new _$exception_9('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=(r=e.styleAliases||null,n={},null!==r&&Object.keys(r).forEach((function(t){r[t].forEach((function(e){n[String(e)]=t}))})),n),-1===YAML_NODE_KINDS.indexOf(this.kind))throw new _$exception_9('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')},_$schema_12={};function compileList(t,e,r){var n=[];return t.include.forEach((function(t){r=compileList(t,e,r)})),t[e].forEach((function(t){r.forEach((function(e,r){e.tag===t.tag&&e.kind===t.kind&&n.push(r)})),r.push(t)})),r.filter((function(t,e){return-1===n.indexOf(e)}))}function Schema(t){this.include=t.include||[],this.implicit=t.implicit||[],this.explicit=t.explicit||[],this.implicit.forEach((function(t){if(t.loadKind&&"scalar"!==t.loadKind)throw new _$exception_9("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")})),this.compiledImplicit=compileList(this,"implicit",[]),this.compiledExplicit=compileList(this,"explicit",[]),this.compiledTypeMap=function(){var t,e,r={scalar:{},sequence:{},mapping:{},fallback:{}};function n(t){r[t.kind][t.tag]=r.fallback[t.tag]=t}for(t=0,e=arguments.length;t=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0"+t.toString(8):"-0"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),YAML_FLOAT_PATTERN=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),SCIENTIFIC_WITHOUT_DOT=/^[-+]?[0-9]+e/,_$float_21=new _$type_18("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!YAML_FLOAT_PATTERN.test(t)||"_"===t[t.length-1])},construct:function(t){var e,r,n,o;return r="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:e.indexOf(":")>=0?(e.split(":").forEach((function(t){o.unshift(parseFloat(t,10))})),e=0,n=1,o.forEach((function(t){e+=t*n,n*=60})),r*e):r*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||_$common_7.isNegativeZero(t))},represent:function(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(_$common_7.isNegativeZero(t))return"-0.0";return r=t.toString(10),SCIENTIFIC_WITHOUT_DOT.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"}),_$json_17=new _$schema_12({include:[_$failsafe_16],implicit:[_$null_28,_$bool_20,_$int_22,_$float_21]}),_$core_13=new _$schema_12({include:[_$json_17]}),YAML_DATE_REGEXP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),YAML_TIMESTAMP_REGEXP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),_$timestamp_34=new _$type_18("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==YAML_DATE_REGEXP.exec(t)||null!==YAML_TIMESTAMP_REGEXP.exec(t))},construct:function(t){var e,r,n,o,i,a,u,c,s=0,f=null;if(null===(e=YAML_DATE_REGEXP.exec(t))&&(e=YAML_TIMESTAMP_REGEXP.exec(t)),null===e)throw new Error("Date resolve error");if(r=+e[1],n=+e[2]-1,o=+e[3],!e[4])return new Date(Date.UTC(r,n,o));if(i=+e[4],a=+e[5],u=+e[6],e[7]){for(s=e[7].slice(0,3);s.length<3;)s+="0";s=+s}return e[9]&&(f=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(f=-f)),c=new Date(Date.UTC(r,n,o,i,a,u,s)),f&&c.setTime(c.getTime()-f),c},instanceOf:Date,represent:function(t){return t.toISOString()}}),_$merge_27=new _$type_18("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}}),NodeBuffer;try{var _require=require;NodeBuffer=_require("buffer").Buffer}catch(__){}var BASE64_MAP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",_$binary_19=new _$type_18("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,r,n=0,o=t.length,i=BASE64_MAP;for(r=0;r64)){if(e<0)return!1;n+=6}return n%8==0},construct:function(t){var e,r,n=t.replace(/[\r\n=]/g,""),o=n.length,i=BASE64_MAP,a=0,u=[];for(e=0;e>16&255),u.push(a>>8&255),u.push(255&a)),a=a<<6|i.indexOf(n.charAt(e));return 0==(r=o%4*6)?(u.push(a>>16&255),u.push(a>>8&255),u.push(255&a)):18===r?(u.push(a>>10&255),u.push(a>>2&255)):12===r&&u.push(a>>4&255),NodeBuffer?NodeBuffer.from?NodeBuffer.from(u):new NodeBuffer(u):u},predicate:function(t){return NodeBuffer&&NodeBuffer.isBuffer(t)},represent:function(t){var e,r,n="",o=0,i=t.length,a=BASE64_MAP;for(e=0;e>18&63],n+=a[o>>12&63],n+=a[o>>6&63],n+=a[63&o]),o=(o<<8)+t[e];return 0==(r=i%3)?(n+=a[o>>18&63],n+=a[o>>12&63],n+=a[o>>6&63],n+=a[63&o]):2===r?(n+=a[o>>10&63],n+=a[o>>4&63],n+=a[o<<2&63],n+=a[64]):1===r&&(n+=a[o>>2&63],n+=a[o<<4&63],n+=a[64],n+=a[64]),n}}),_hasOwnProperty=Object.prototype.hasOwnProperty,_toString=Object.prototype.toString,_$omap_29=new _$type_18("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,r,n,o,i,a=[],u=t;for(e=0,r=u.length;e3)return!1;if("/"!==e[e.length-n.length-1])return!1}return!0},construct:function(t){var e=t,r=/\/([gim]*)$/.exec(t),n="";return"/"===e[0]&&(r&&(n=r[1]),e=e.slice(1,e.length-n.length-1)),new RegExp(e,n)},predicate:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},represent:function(t){var e="/"+t.source+"/";return t.global&&(e+="g"),t.multiline&&(e+="m"),t.ignoreCase&&(e+="i"),e}}),esprima;try{var ___require_23=require;esprima=___require_23("esprima")}catch(_){"undefined"!=typeof window&&(esprima=window.esprima)}var _$function_23=new _$type_18("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var e="("+t+")",r=esprima.parse(e,{range:!0});return"Program"===r.type&&1===r.body.length&&"ExpressionStatement"===r.body[0].type&&("ArrowFunctionExpression"===r.body[0].expression.type||"FunctionExpression"===r.body[0].expression.type)}catch(n){return!1}},construct:function(t){var e,r="("+t+")",n=esprima.parse(r,{range:!0}),o=[];if("Program"!==n.type||1!==n.body.length||"ExpressionStatement"!==n.body[0].type||"ArrowFunctionExpression"!==n.body[0].expression.type&&"FunctionExpression"!==n.body[0].expression.type)throw new Error("Failed to resolve function");return n.body[0].expression.params.forEach((function(t){o.push(t.name)})),e=n.body[0].expression.body.range,"BlockStatement"===n.body[0].expression.body.type?new Function(o,r.slice(e[0]+1,e[1]-1)):new Function(o,"return "+r.slice(e[0],e[1]))},predicate:function(t){return"[object Function]"===Object.prototype.toString.call(t)},represent:function(t){return t.toString()}}),_$default_full_14=_$schema_12.DEFAULT=new _$schema_12({include:[_$default_safe_15],explicit:[_$undefined_25,_$regexp_24,_$function_23]}),_$loader_10={},___hasOwnProperty_10=Object.prototype.hasOwnProperty,CONTEXT_FLOW_IN=1,CONTEXT_FLOW_OUT=2,CONTEXT_BLOCK_IN=3,CONTEXT_BLOCK_OUT=4,CHOMPING_CLIP=1,CHOMPING_STRIP=2,CHOMPING_KEEP=3,PATTERN_NON_PRINTABLE=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,PATTERN_NON_ASCII_LINE_BREAKS=/[\x85\u2028\u2029]/,PATTERN_FLOW_INDICATORS=/[,\[\]\{\}]/,PATTERN_TAG_HANDLE=/^(?:!|!!|![a-z\-]+!)$/i,PATTERN_TAG_URI=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _class(t){return Object.prototype.toString.call(t)}function is_EOL(t){return 10===t||13===t}function is_WHITE_SPACE(t){return 9===t||32===t}function is_WS_OR_EOL(t){return 9===t||32===t||10===t||13===t}function is_FLOW_INDICATOR(t){return 44===t||91===t||93===t||123===t||125===t}function fromHexCode(t){var e;return 48<=t&&t<=57?t-48:97<=(e=32|t)&&e<=102?e-97+10:-1}function simpleEscapeSequence(t){return 48===t?"\0":97===t?"\x07":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"\x1b":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"\x85":95===t?"\xa0":76===t?"\u2028":80===t?"\u2029":""}function charFromCodepoint(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var simpleEscapeCheck=new Array(256),simpleEscapeMap=new Array(256),i=0;i<256;i++)simpleEscapeCheck[i]=simpleEscapeSequence(i)?1:0,simpleEscapeMap[i]=simpleEscapeSequence(i);function State(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||_$default_full_14,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function generateError(t,e){return new _$exception_9(e,new _$mark_11(t.filename,t.input,t.position,t.line,t.position-t.lineStart))}function throwError(t,e){throw generateError(t,e)}function throwWarning(t,e){t.onWarning&&t.onWarning.call(null,generateError(t,e))}var directiveHandlers={YAML:function(t,e,r){var n,o,i;null!==t.version&&throwError(t,"duplication of %YAML directive"),1!==r.length&&throwError(t,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&throwError(t,"ill-formed argument of the YAML directive"),o=parseInt(n[1],10),i=parseInt(n[2],10),1!==o&&throwError(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=i<2,1!==i&&2!==i&&throwWarning(t,"unsupported YAML version of the document")},TAG:function(t,e,r){var n,o;2!==r.length&&throwError(t,"TAG directive accepts exactly two arguments"),n=r[0],o=r[1],PATTERN_TAG_HANDLE.test(n)||throwError(t,"ill-formed tag handle (first argument) of the TAG directive"),___hasOwnProperty_10.call(t.tagMap,n)&&throwError(t,'there is a previously declared suffix for "'+n+'" tag handle'),PATTERN_TAG_URI.test(o)||throwError(t,"ill-formed tag prefix (second argument) of the TAG directive"),t.tagMap[n]=o}};function captureSegment(t,e,r,n){var o,i,a,u;if(e1&&(t.result+=_$common_7.repeat("\n",e-1))}function readBlockSequence(t,e){var r,n,o=t.tag,i=t.anchor,a=[],u=!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=a),n=t.input.charCodeAt(t.position);0!==n&&45===n&&is_WS_OR_EOL(t.input.charCodeAt(t.position+1));)if(u=!0,t.position++,skipSeparationSpace(t,!0,-1)&&t.lineIndent<=e)a.push(null),n=t.input.charCodeAt(t.position);else if(r=t.line,composeNode(t,e,CONTEXT_BLOCK_IN,!1,!0),a.push(t.result),skipSeparationSpace(t,!0,-1),n=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&0!==n)throwError(t,"bad indentation of a sequence entry");else if(t.lineIndente?h=1:t.lineIndent===e?h=0:t.lineIndente?h=1:t.lineIndent===e?h=0:t.lineIndente)&&(composeNode(t,e,CONTEXT_BLOCK_OUT,!0,o)&&(_?h=t.result:d=t.result),_||(storeMappingPair(t,f,l,p,h,d,i,a),p=h=d=null),skipSeparationSpace(t,!0,-1),u=t.input.charCodeAt(t.position)),t.lineIndent>e&&0!==u)throwError(t,"bad indentation of a mapping entry");else if(t.lineIndent=0))break;0===o?throwError(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?throwError(t,"repeat of an indentation width identifier"):(f=e+o-1,s=!0)}if(is_WHITE_SPACE(i)){do{i=t.input.charCodeAt(++t.position)}while(is_WHITE_SPACE(i));if(35===i)do{i=t.input.charCodeAt(++t.position)}while(!is_EOL(i)&&0!==i)}for(;0!==i;){for(readLineBreak(t),t.lineIndent=0,i=t.input.charCodeAt(t.position);(!s||t.lineIndentf&&(f=t.lineIndent),is_EOL(i))l++;else{if(t.lineIndent0){for(o=a,i=0;o>0;o--)(a=fromHexCode(u=t.input.charCodeAt(++t.position)))>=0?i=(i<<4)+a:throwError(t,"expected hexadecimal character");t.result+=charFromCodepoint(i),t.position++}else throwError(t,"unknown escape sequence");r=n=t.position}else is_EOL(u)?(captureSegment(t,r,n,!0),writeFoldedLines(t,skipSeparationSpace(t,!1,e)),r=n=t.position):t.position===t.lineStart&&testDocumentSeparator(t)?throwError(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}throwError(t,"unexpected end of the stream within a double quoted scalar")}(t,l)?_=!0:function(t){var e,r,n;if(42!==(n=t.input.charCodeAt(t.position)))return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;0!==n&&!is_WS_OR_EOL(n)&&!is_FLOW_INDICATOR(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&throwError(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),___hasOwnProperty_10.call(t.anchorMap,r)||throwError(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],skipSeparationSpace(t,!0,-1),!0}(t)?(_=!0,null===t.tag&&null===t.anchor||throwError(t,"alias node should not have any properties")):function(t,e,r){var n,o,i,a,u,c,s,f,l=t.kind,p=t.result;if(is_WS_OR_EOL(f=t.input.charCodeAt(t.position))||is_FLOW_INDICATOR(f)||35===f||38===f||42===f||33===f||124===f||62===f||39===f||34===f||37===f||64===f||96===f)return!1;if((63===f||45===f)&&(is_WS_OR_EOL(n=t.input.charCodeAt(t.position+1))||r&&is_FLOW_INDICATOR(n)))return!1;for(t.kind="scalar",t.result="",o=i=t.position,a=!1;0!==f;){if(58===f){if(is_WS_OR_EOL(n=t.input.charCodeAt(t.position+1))||r&&is_FLOW_INDICATOR(n))break}else if(35===f){if(is_WS_OR_EOL(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&testDocumentSeparator(t)||r&&is_FLOW_INDICATOR(f))break;if(is_EOL(f)){if(u=t.line,c=t.lineStart,s=t.lineIndent,skipSeparationSpace(t,!1,-1),t.lineIndent>=e){a=!0,f=t.input.charCodeAt(t.position);continue}t.position=i,t.line=u,t.lineStart=c,t.lineIndent=s;break}}a&&(captureSegment(t,o,i,!1),writeFoldedLines(t,t.line-u),o=i=t.position,a=!1),is_WHITE_SPACE(f)||(i=t.position+1),f=t.input.charCodeAt(++t.position)}return captureSegment(t,o,i,!1),!!t.result||(t.kind=l,t.result=p,!1)}(t,l,CONTEXT_FLOW_IN===r)&&(_=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===h&&(_=u&&readBlockSequence(t,p))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&throwError(t,'unacceptable node kind for ! tag; it should be "scalar", not "'+t.kind+'"'),c=0,s=t.implicitTypes.length;c tag; it should be "'+f.kind+'", not "'+t.kind+'"'),f.resolve(t.result)?(t.result=f.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):throwError(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):throwError(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||_}function readDocument(t){var e,r,n,o,i=t.position,a=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap={},t.anchorMap={};0!==(o=t.input.charCodeAt(t.position))&&(skipSeparationSpace(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==o));){for(a=!0,o=t.input.charCodeAt(++t.position),e=t.position;0!==o&&!is_WS_OR_EOL(o);)o=t.input.charCodeAt(++t.position);for(n=[],(r=t.input.slice(e,t.position)).length<1&&throwError(t,"directive name must not be less than one character in length");0!==o;){for(;is_WHITE_SPACE(o);)o=t.input.charCodeAt(++t.position);if(35===o){do{o=t.input.charCodeAt(++t.position)}while(0!==o&&!is_EOL(o));break}if(is_EOL(o))break;for(e=t.position;0!==o&&!is_WS_OR_EOL(o);)o=t.input.charCodeAt(++t.position);n.push(t.input.slice(e,t.position))}0!==o&&readLineBreak(t),___hasOwnProperty_10.call(directiveHandlers,r)?directiveHandlers[r](t,r,n):throwWarning(t,'unknown document directive "'+r+'"')}skipSeparationSpace(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,skipSeparationSpace(t,!0,-1)):a&&throwError(t,"directives end mark is expected"),composeNode(t,t.lineIndent-1,CONTEXT_BLOCK_OUT,!1,!0),skipSeparationSpace(t,!0,-1),t.checkLineBreaks&&PATTERN_NON_ASCII_LINE_BREAKS.test(t.input.slice(i,t.position))&&throwWarning(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&testDocumentSeparator(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,skipSeparationSpace(t,!0,-1)):t.position0?t.charCodeAt(i-1):null,h=h&&isPlainSafe(a,u)}else{for(i=0;in&&" "!==t[p+1],p=i);else if(!isPrintable(a))return STYLE_DOUBLE;u=i>0?t.charCodeAt(i-1):null,h=h&&isPlainSafe(a,u)}f=f||l&&i-p-1>n&&" "!==t[p+1]}return s||f?r>9&&needIndentIndicator(t)?STYLE_DOUBLE:f?STYLE_FOLDED:STYLE_LITERAL:h&&!o(t)?STYLE_PLAIN:STYLE_SINGLE}function writeScalar(t,e,r,n){t.dump=function(){if(0===e.length)return"''";if(!t.noCompatMode&&-1!==DEPRECATED_BOOLEANS_SYNTAX.indexOf(e))return"'"+e+"'";var o=t.indent*Math.max(1,r),i=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-o),a=n||t.flowLevel>-1&&r>=t.flowLevel;switch(chooseScalarStyle(e,a,t.indent,i,(function(e){return function(t,e){var r,n;for(r=0,n=t.implicitTypes.length;r"+blockHeader(e,t.indent)+dropEndingNewline(indentString(function(t,e){for(var r,n,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=t.indexOf("\n"))?o:t.length,i.lastIndex=o,foldLine(t.slice(0,o),e)),u="\n"===t[0]||" "===t[0];n=i.exec(t);){var c=n[1],s=n[2];r=" "===s[0],a+=c+(u||r||""===s?"":"\n")+foldLine(s,e),u=r}return a}(e,i),o));case STYLE_DOUBLE:return'"'+function(t){for(var e,r,n,o="",i=0;i=55296&&e<=56319&&(r=t.charCodeAt(i+1))>=56320&&r<=57343?(o+=encodeHex(1024*(e-55296)+r-56320+65536),i++):o+=!(n=ESCAPE_SEQUENCES[e])&&isPrintable(e)?t[i]:n||encodeHex(e);return o}(e)+'"';default:throw new _$exception_9("impossible error: invalid scalar style")}}()}function blockHeader(t,e){var r=needIndentIndicator(t)?String(e):"",n="\n"===t[t.length-1];return r+(!n||"\n"!==t[t.length-2]&&"\n"!==t?n?"":"-":"+")+"\n"}function dropEndingNewline(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function foldLine(t,e){if(""===t||" "===t[0])return t;for(var r,n,o=/ [^ ]/g,i=0,a=0,u=0,c="";r=o.exec(t);)(u=r.index)-i>e&&(n=a>i?a:u,c+="\n"+t.slice(i,n),i=n+1),a=u;return c+="\n",t.length-i>e&&a>i?c+=t.slice(i,a)+"\n"+t.slice(a+1):c+=t.slice(i),c.slice(1)}function detectType(t,e,r){var n,o,i,a,u,c;for(i=0,a=(o=r?t.explicitTypes:t.implicitTypes).length;i tag resolver accepts not "'+c+'" style');n=u.represent[c](e,c)}t.dump=n}return!0}return!1}function writeNode(t,e,r,n,o,i){t.tag=null,t.dump=r,detectType(t,r,!1)||detectType(t,r,!0);var a=___toString_8.call(t.dump);n&&(n=t.flowLevel<0||t.flowLevel>e);var u,c,s="[object Object]"===a||"[object Array]"===a;if(s&&(c=-1!==(u=t.duplicates.indexOf(r))),(null!==t.tag&&"?"!==t.tag||c||2!==t.indent&&e>0)&&(o=!1),c&&t.usedDuplicates[u])t.dump="*ref_"+u;else{if(s&&c&&!t.usedDuplicates[u]&&(t.usedDuplicates[u]=!0),"[object Object]"===a)n&&0!==Object.keys(t.dump).length?(function(t,e,r,n){var o,i,a,u,c,s,f="",l=t.tag,p=Object.keys(r);if(!0===t.sortKeys)p.sort();else if("function"==typeof t.sortKeys)p.sort(t.sortKeys);else if(t.sortKeys)throw new _$exception_9("sortKeys must be a boolean or a function");for(o=0,i=p.length;o1024)&&(t.dump&&CHAR_LINE_FEED===t.dump.charCodeAt(0)?s+="?":s+="? "),s+=t.dump,c&&(s+=generateNextLine(t,e)),writeNode(t,e+1,u,!0,c)&&(t.dump&&CHAR_LINE_FEED===t.dump.charCodeAt(0)?s+=":":s+=": ",f+=s+=t.dump));t.tag=l,t.dump=f||"{}"}(t,e,t.dump,o),c&&(t.dump="&ref_"+u+t.dump)):(function(t,e,r){var n,o,i,a,u,c="",s=t.tag,f=Object.keys(r);for(n=0,o=f.length;n1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),writeNode(t,e,a,!1,!1)&&(c+=u+=t.dump));t.tag=s,t.dump="{"+c+"}"}(t,e,t.dump),c&&(t.dump="&ref_"+u+" "+t.dump));else if("[object Array]"===a){var f=t.noArrayIndent&&e>0?e-1:e;n&&0!==t.dump.length?(function(t,e,r,n){var o,i,a="",u=t.tag;for(o=0,i=r.length;o "+t.dump)}return!0}function getDuplicateReferences(t,e){var r,n,o=[],i=[];for(function t(e,r,n){var o,i,a;if(null!==e&&"object"==typeof e)if(-1!==(i=r.indexOf(e)))-1===n.indexOf(i)&&n.push(i);else if(r.push(e),Array.isArray(e))for(i=0,a=e.length;i0?o-4:o;for(r=0;r>16&255,a[u++]=e>>8&255,a[u++]=255&e;return 2===i&&(e=revLookup[t.charCodeAt(r)]<<2|revLookup[t.charCodeAt(r+1)]>>4,a[u++]=255&e),1===i&&(e=revLookup[t.charCodeAt(r)]<<10|revLookup[t.charCodeAt(r+1)]<<4|revLookup[t.charCodeAt(r+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e),a},fromByteArray:function(t){for(var e,r=t.length,n=r%3,o=[],i=0,a=r-n;ia?a:i+16383));return 1===n?(e=t[r-1],o.push(lookup[e>>2]+lookup[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),o.join("")}},lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",__i_1=0,len=code.length;__i_10)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function encodeChunk(t,e,r){for(var n,o,i=[],a=e;a>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]);return i.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var _$ieee754_3={read:function(t,e,r,n,o){var i,a,u=8*o-n-1,c=(1<>1,f=-7,l=r?o-1:0,p=r?-1:1,h=t[e+l];for(l+=p,i=h&(1<<-f)-1,h>>=-f,f+=u;f>0;i=256*i+t[e+l],l+=p,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=n;f>0;a=256*a+t[e+l],l+=p,f-=8);if(0===i)i=1-s;else{if(i===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),i-=s}return(h?-1:1)*a*Math.pow(2,i-n)},write:function(t,e,r,n,o,i){var a,u,c,s=8*i-o-1,f=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,d=n?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=f?(u=0,a=f):a+l>=1?(u=(e*c-1)*Math.pow(2,o),a+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,o),a=0));o>=8;t[r+h]=255&u,h+=d,u/=256,o-=8);for(a=a<0;t[r+h]=255&a,h+=d,a/=256,s-=8);t[r+h-d]|=128*_}},_$base64_4={exports:{}};(function(t,e){(function(){!function(t,e){var r,n;"object"==typeof _$base64_4.exports?_$base64_4.exports=e():"function"==typeof define&&define.amd?define(e):(r=t.Base64,(n=e()).noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:this,(function(){"use strict";var t,r="function"==typeof atob,n="function"==typeof btoa,o="function"==typeof e,i="function"==typeof TextDecoder?new TextDecoder:void 0,a="function"==typeof TextEncoder?new TextEncoder:void 0,u=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),c=(t={},u.forEach((function(e,r){return t[e]=r})),t),s=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,f=String.fromCharCode.bind(String),l="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t,e){return void 0===e&&(e=function(t){return t}),new Uint8Array(Array.prototype.slice.call(t,0).map(e))},p=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},h=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},d=function(t){for(var e,r,n,o,i="",a=t.length%3,c=0;c255||(n=t.charCodeAt(c++))>255||(o=t.charCodeAt(c++))>255)throw new TypeError("invalid character found");i+=u[(e=r<<16|n<<8|o)>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}return a?i.slice(0,a-3)+"===".substring(a):i},_=n?function(t){return btoa(t)}:o?function(t){return e.from(t,"binary").toString("base64")}:d,v=o?function(t){return e.from(t).toString("base64")}:function(t){for(var e=[],r=0,n=t.length;r>>6)+f(128|63&e):f(224|e>>>12&15)+f(128|e>>>6&63)+f(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return f(240|e>>>18&7)+f(128|e>>>12&63)+f(128|e>>>6&63)+f(128|63&e)},m=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,w=function(t){return t.replace(m,g)},b=o?function(t){return e.from(t,"utf8").toString("base64")}:a?function(t){return v(a.encode(t))}:function(t){return _(w(t))},A=function(t,e){return void 0===e&&(e=!1),e?p(b(t)):b(t)},E=function(t){return A(t,!0)},O=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,S=function(t){switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return f(55296+(e>>>10))+f(56320+(1023&e));case 3:return f((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return f((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},x=function(t){return t.replace(O,S)},L=function(t){if(t=t.replace(/\s+/g,""),!s.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var e,r,n,o="",i=0;i>16&255):64===n?f(e>>16&255,e>>8&255):f(e>>16&255,e>>8&255,255&e);return o},T=r?function(t){return atob(h(t))}:o?function(t){return e.from(t,"base64").toString("binary")}:L,C=o?function(t){return l(e.from(t,"base64"))}:function(t){return l(T(t),(function(t){return t.charCodeAt(0)}))},R=function(t){return C(I(t))},k=o?function(t){return e.from(t,"base64").toString("utf8")}:i?function(t){return i.decode(C(t))}:function(t){return x(T(t))},I=function(t){return h(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},N=function(t){return k(I(t))},P=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},$=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,P(e))};t("fromBase64",(function(){return N(this)})),t("toBase64",(function(t){return A(this,t)})),t("toBase64URI",(function(){return A(this,!0)})),t("toBase64URL",(function(){return A(this,!0)})),t("toUint8Array",(function(){return R(this)}))},j=function(){var t=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,P(e))};t("toBase64",(function(t){return y(this,t)})),t("toBase64URI",(function(){return y(this,!0)})),t("toBase64URL",(function(){return y(this,!0)}))},F={version:"3.7.2",VERSION:"3.7.2",atob:T,atobPolyfill:L,btoa:_,btoaPolyfill:d,fromBase64:N,toBase64:A,encode:A,encodeURI:E,encodeURL:E,utob:w,btou:x,decode:N,isValid:function(t){if("string"!=typeof t)return!1;var e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},fromUint8Array:y,toUint8Array:R,extendString:$,extendUint8Array:j,extendBuiltins:function(){$(),j()},Base64:{}};return Object.keys(F).forEach((function(t){return F.Base64[t]=F[t]})),F}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_$buffer_2({}).Buffer),_$base64_4=_$base64_4.exports;var _$preprocessors_40={};Object.defineProperty(_$preprocessors_40,"__esModule",{value:!0}),_$preprocessors_40.default=void 0;var keys,___default_40=[{name:"HTML",test:function(t){return/^/.test(t)},parse:function(){return""}},(keys=["dm1lc3M","c3NyOi8v","dHJvamFu","c3M6Ly","c3NkOi8v","c2hhZG93","aHR0c"],{name:"Base64 Pre-processor",test:function(t){return keys.some((function(e){return-1!==t.indexOf(e)}))},parse:function(t){return _$base64_4.Base64.decode(t)}}),{name:"Clash Pre-processor",test:function(t){return/proxies/.test(t)},parse:function(t){return(0,_$staticJsYaml_36.safeLoad)(t).proxies.map((function(t){return JSON.stringify(t)})).join("\n")}},{name:"SSD Pre-processor",test:function(t){return 0===t.indexOf("ssd://")},parse:function(t){for(var e=[],r=JSON.parse(_$base64_4.Base64.decode(t.split("ssd://")[1])),n=r.port,o=r.encryption,i=r.password,a=r.servers,u=0;ut.length)&&(e=t.length);for(var r=0,n=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_39(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_39(t,e):void 0}}function ___arrayLikeToArray_39(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1){var c,s=___createForOfIteratorHelper_39(t);try{for(s.s();!(c=s.n()).done;){var f=___slicedToArray_39(c.value.split("="),2),l=f[0],p=f[1];u[l]=p.trim()}}catch(h){s.e(h)}finally{s.f()}}return ___objectSpread_39(___objectSpread_39({},a),{},{name:u.remarks?_$base64_4.Base64.decode(u.remarks):a.server,"protocol-param":_$base64_4.Base64.decode(u.protoparam||"").replace(/\s/g,""),"obfs-param":_$base64_4.Base64.decode(u.obfsparam||"").replace(/\s/g,"")})}}),{name:"URI VMess Parser",test:function(t){return/^vmess:\/\//.test(t)},parse:function(t){t=t.split("vmess://")[1];var e=_$base64_4.Base64.decode(t);if(/=\s*vmess/.test(e)){var r,n=e.split(",").map((function(t){return t.trim()})),o={},i=___createForOfIteratorHelper_39(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(-1!==a.indexOf("=")){var u=___slicedToArray_39(a.split("="),2),c=u[0],s=u[1];o[c.trim()]=s.trim()}}}catch(d){i.e(d)}finally{i.f()}var f={name:n[0].split("=")[0].trim(),type:"vmess",server:n[1],port:n[2],cipher:n[3],uuid:n[4].match(/^"(.*)"$/)[1],tls:"over-tls"===o.obfs||"wss"===o.obfs};if(void 0!==o["udp-relay"]&&(f.udp=JSON.parse(o["udp-relay"])),void 0!==o["fast-open"]&&(f.udp=JSON.parse(o["fast-open"])),"ws"===o.obfs||"wss"===o.obfs){f.network="ws",f["ws-opts"].path=(o["obfs-path"]||'"/"').match(/^"(.*)"$/)[1];var l=o["obfs-header"];l&&-1!==l.indexOf("Host")&&(l=l.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),f["ws-opts"].headers={Host:l||f.server}}return f.tls&&"false"===o['"tls-verification"']&&(f["skip-cert-verify"]=!0),f.tls&&o["obfs-host"]&&(f.sni=o["obfs-host"]),f}var p=JSON.parse(e),h={name:p.ps,type:"vmess",server:p.add,port:p.port,cipher:"auto",uuid:p.id,alterId:p.aid||0,tls:"tls"===p.tls||!0===p.tls,supported:{}};return"ws"===p.net&&(h.network="ws",h["ws-opts"]={path:p.path,headers:{Host:p.host||p.add}},h.tls&&p.host&&(h.sni=p.host)),!1===p.verify_cert&&(h["skip-cert-verify"]=!0),h}},{name:"URI Trojan Parser",test:function(t){return/^trojan:\/\//.test(t)},parse:function(t){var e=___slicedToArray_39((t=t.split("trojan://")[1]).split("@")[1].split("?")[0].split(":"),2),r=e[0],n=e[1],o=decodeURIComponent(t.split("#")[1].trim()),i=t.split("?"),a=null;return i.length>1&&(i=i[1].split("#")[0].split("&"),a=new Map(i.map((function(t){return t.split("=")}))).get("sni")),{name:o||"[Trojan] ".concat(r),type:"trojan",server:r,port:n,password:t.split("@")[0],sni:a,supported:{}}}},{name:"Clash Parser",test:function(t){try{JSON.parse(t)}catch(e){return!1}return!0},parse:function(t){return JSON.parse(t)}},{name:"Surge SS Parser",test:function(t){return/^.*=\s*ss/.test(t.split(",")[0])},parse:function(t){var e=getSurgeParams(t),r={name:e.name,type:"ss",server:e.server,port:e.port,cipher:e["encrypt-method"],password:e.password,tfo:JSON.parse(e.tfo||"false"),udp:JSON.parse(e["udp-relay"]||"false")};return e.obfs&&(r.plugin="obfs",r["plugin-opts"]={mode:e.obfs,host:e["obfs-host"]}),r}},{name:"Surge VMess Parser",test:function(t){return/^.*=\s*vmess/.test(t.split(",")[0])&&-1!==t.indexOf("username")},parse:function(t){var e=getSurgeParams(t),r={name:e.name,type:"vmess",server:e.server,port:e.port,uuid:e.username,alterId:0,cipher:"none",tls:JSON.parse(e.tls||"false"),tfo:JSON.parse(e.tfo||"false")};if(r.tls&&(void 0!==e["skip-cert-verify"]&&(r["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),r.sni=e.sni||e.server),JSON.parse(e.ws||"false")){r.network="ws",r["ws-opts"]={path:e["ws-path"]};var n=e["ws-headers"].match(/(,|^|\s)*HOST:\s*(.*?)(,|$)/),o=n?n[2]:r.server;r["ws-opts"].headers={Host:o||e.server}}return r}},{name:"Surge Trojan Parser",test:function(t){return/^.*=\s*trojan/.test(t.split(",")[0])&&-1!==t.indexOf("sni")},parse:function(t){var e=getSurgeParams(t),r={name:e.name,type:"trojan",server:e.server,port:e.port,password:e.password,sni:e.sni||e.server,tfo:JSON.parse(e.tfo||"false")};return void 0!==e["skip-cert-verify"]&&(r["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),r}},{name:"Surge HTTP Parser",test:function(t){return/^.*=\s*https?/.test(t.split(",")[0])&&!Loon_Http().test(t)},parse:function(t){var e=getSurgeParams(t),r=/^.*?=\s?https/.test(t),n={name:e.name,type:"http",server:e.server,port:e.port,tls:JSON.parse(r||"false"),tfo:JSON.parse(e.tfo||"false")};return n.tls&&(void 0!==e["skip-cert-verify"]&&(n["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),n.sni=e.sni||e.server),e.username&&"none"!==e.username&&(n.username=e.username),e.password&&"none"!==e.password&&(n.password=e.password),n}},{name:"Loon SS Parser",test:function(t){return"shadowsocks"===t.split(",")[0].split("=")[1].trim().toLowerCase()},parse:function(t){var e=t.split("=")[1].split(","),r={name:t.split("=")[0].trim(),type:"ss",server:e[1],port:e[2],cipher:e[3],password:e[4].replace(/"/g,"")};return e.length>5&&(r.plugin="obfs",r["plugin-opts"]={mode:e[5],host:e[6]}),r}},{name:"Loon SSR Parser",test:function(t){return"shadowsocksr"===t.split(",")[0].split("=")[1].trim().toLowerCase()},parse:function(t){var e=t.split("=")[1].split(",");return{name:t.split("=")[0].trim(),type:"ssr",server:e[1],port:e[2],cipher:e[3],password:e[4].replace(/"/g,""),protocol:e[5],"protocol-param":e[6].match(/{(.*)}/)[1],supported:{Surge:!1},obfs:e[7],"obfs-param":e[8].match(/{(.*)}/)[1]}}},{name:"Loon VMess Parser",test:function(t){return/^.*=\s*vmess/i.test(t.split(",")[0])&&-1===t.indexOf("username")},parse:function(t){var e,r=t.split("=")[1].split(","),n={name:t.split("=")[0].trim(),type:"vmess",server:r[1],port:r[2],cipher:r[3]||"none",uuid:r[4].replace(/"/g,""),alterId:0},o=___createForOfIteratorHelper_39(r=r.splice(5));try{for(o.s();!(e=o.n()).done;){var i=___slicedToArray_39(e.value.split(":"),2),a=i[0],u=i[1];r[a]=u}}catch(c){o.e(c)}finally{o.f()}switch(n.tls=JSON.parse(r["over-tls"]||"false"),n.tls&&(n.sni=r["tls-name"]||n.server,n["skip-cert-verify"]=JSON.parse(r["skip-cert-verify"]||"false")),r.transport){case"tcp":break;case"ws":n.network=r.transport,n["ws-opts"]={path:r.path,headers:{Host:r.host}}}return n.tls&&(n["skip-cert-verify"]=JSON.parse(r["skip-cert-verify"]||"false")),n}},{name:"Loon Trojan Parser",test:function(t){return/^.*=\s*trojan/i.test(t.split(",")[0])&&-1===t.indexOf("password")},parse:function(t){var e=t.split("=")[1].split(","),r={name:t.split("=")[0].trim(),type:"trojan",server:e[1],port:e[2],password:e[3].replace(/"/g,""),sni:e[1],"skip-cert-verify":JSON.parse(e["skip-cert-verify"]||"false")};if(e.length>4){var n=___slicedToArray_39(e[4].split(":"),2),o=n[0],i=n[1];if("tls-name"!==o)throw new Error("Unknown option ".concat(o," for line: \n").concat(t));r.sni=i}return r}},Loon_Http(),{name:"QX SS Parser",test:function(t){return/^shadowsocks\s*=/.test(t.split(",")[0].trim())&&-1===t.indexOf("ssr-protocol")},parse:function(t){var e=getQXParams(t),r={name:e.tag,type:"ss",server:e.server,port:e.port,cipher:e.method,password:e.password,udp:JSON.parse(e["udp-relay"]||"false"),tfo:JSON.parse(e["fast-open"]||"false"),supported:{}};if(e.obfs)switch(r["plugin-opts"]={host:e["obfs-host"]||r.server},e.obfs){case"http":case"tls":r.plugin="obfs",r["plugin-opts"].mode=e.obfs;break;case"ws":case"wss":r["plugin-opts"]=___objectSpread_39(___objectSpread_39({},r["plugin-opts"]),{},{mode:"websocket",path:e["obfs-uri"]||"/",tls:"wss"===e.obfs}),r["plugin-opts"].tls&&void 0!==e["tls-verification"]&&(r["plugin-opts"]["skip-cert-verify"]=e["tls-verification"]),r.plugin="v2ray-plugin",r.supported.Surge=!1,r.supported.Loon=!1}return r}},{name:"QX SSR Parser",test:function(t){return/^shadowsocks\s*=/.test(t.split(",")[0].trim())&&-1!==t.indexOf("ssr-protocol")},parse:function(t){var e=getQXParams(t),r={name:e.tag,type:"ssr",server:e.server,port:e.port,cipher:e.method,password:e.password,protocol:e["ssr-protocol"],obfs:"plain","protocol-param":e["ssr-protocol-param"],udp:JSON.parse(e["udp-relay"]||"false"),tfo:JSON.parse(e["fast-open"]||"false"),supported:{Surge:!1}};return e.obfs&&(r.obfs=e.obfs,r["obfs-param"]=e["obfs-host"]),r}},{name:"QX VMess Parser",test:function(t){return/^vmess\s*=/.test(t.split(",")[0].trim())},parse:function(t){var e=getQXParams(t),r={type:"vmess",name:e.tag,server:e.server,port:e.port,cipher:e.method||"none",uuid:e.password,alterId:0,tls:"over-tls"===e.obfs||"wss"===e.obfs,udp:JSON.parse(e["udp-relay"]||"false"),tfo:JSON.parse(e["fast-open"]||"false")};return r.tls&&(r.sni=e["obfs-host"]||e.server,r["skip-cert-verify"]=!JSON.parse(e["tls-verification"]||"true")),"ws"!==e.obfs&&"wss"!==e.obfs||(r.network="ws",r["ws-opts"]={path:e["obfs-uri"],headers:{Host:e["obfs-host"]||e.server}}),r}},{name:"QX Trojan Parser",test:function(t){return/^trojan\s*=/.test(t.split(",")[0].trim())},parse:function(t){var e=getQXParams(t),r={type:"trojan",name:e.tag,server:e.server,port:e.port,password:e.password,sni:e["tls-host"]||e.server,udp:JSON.parse(e["udp-relay"]||"false"),tfo:JSON.parse(e["fast-open"]||"false")};return r["skip-cert-verify"]=!JSON.parse(e["tls-verification"]||"true"),r}},{name:"QX HTTP Parser",test:function(t){return/^http\s*=/.test(t.split(",")[0].trim())},parse:function(t){var e=getQXParams(t),r={type:"http",name:e.tag,server:e.server,port:e.port,tls:JSON.parse(e["over-tls"]||"false"),udp:JSON.parse(e["udp-relay"]||"false"),tfo:JSON.parse(e["fast-open"]||"false")};return e.username&&"none"!==e.username&&(r.username=e.username),e.password&&"none"!==e.password&&(r.password=e.password),r.tls&&(r.sni=e["tls-host"]||r.server,r["skip-cert-verify"]=!JSON.parse(e["tls-verification"]||"true")),r}}];_$parsers_39.default=___default_39;var _$app_37={};Object.defineProperty(_$app_37,"__esModule",{value:!0}),_$app_37.default=void 0;var ___default_37=new _$openApi_51.OpenAPI("sub-store");_$app_37.default=___default_37;var _$proxyUtils_38={};function ___typeof_38(t){return(___typeof_38="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(_$proxyUtils_38,"__esModule",{value:!0}),_$proxyUtils_38.ProxyUtils=void 0;var ___download_38=_interopRequireDefault(_$download_48),_processors=function(t,e){if(t&&t.__esModule)return t;if(null===t||"object"!==___typeof_38(t)&&"function"!=typeof t)return{default:t};var r=_getRequireWildcardCache(void 0);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if("default"!==i&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}(_$processors_41),_preprocessors=_interopRequireDefault(_$preprocessors_40),_producers=_interopRequireDefault(_$producers_42),_parsers=_interopRequireDefault(_$parsers_39),_app=_interopRequireDefault(_$app_37);function _getRequireWildcardCache(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return(_getRequireWildcardCache=function(t){return t?r:e})(t)}function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function ___regeneratorRuntime_38(){___regeneratorRuntime_38=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(x){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new E(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(x){return{type:"throw",arg:x}}}t.wrap=c;var f={};function l(){}function p(){}function h(){}var d={};u(d,o,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(O([])));v&&v!==e&&r.call(v,o)&&(d=v);var y=h.prototype=l.prototype=Object.create(d);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==___typeof_38(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_38(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function ___createForOfIteratorHelper_38(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_38(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_38(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_38(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==w[1]?w[1]:[],n=w.length>2?w[2]:void 0,o=___createForOfIteratorHelper_38(r),t.prev=3,o.s();case 5:if((i=o.n()).done){t.next=40;break}if(a=i.value,u=void 0,c={},-1===a.type.indexOf("Script")){t.next=29;break}if(s=a.args,f=s.mode,l=s.content,"link"!==f){t.next=28;break}if((h=(p=l).split("#")).length>1){d=___createForOfIteratorHelper_38(h[1].split("&"));try{for(d.s();!(_=d.n()).done;)v=_.value,y=v.split("=")[0],g=v.split("=")[1]||!0,c[y]=g}catch(b){d.e(b)}finally{d.f()}}return t.prev=15,t.next=18,(0,___download_38.default)(p.split("#")[0]);case 18:u=t.sent,_app.default.info("Script loaded: >>>\n ".concat(u)),t.next=26;break;case 22:return t.prev=22,t.t0=t.catch(15),_app.default.error("Error when downloading remote script: ".concat(a.args.content,".\n Reason: ").concat(t.t0)),t.abrupt("continue",38);case 26:t.next=29;break;case 28:u=l;case 29:if(_processors.default[a.type]){t.next=32;break}return _app.default.error('Unknown operator: "'.concat(a.type,'"')),t.abrupt("continue",38);case 32:return _app.default.info('Applying "'.concat(a.type,'" with arguments:\n >>> ').concat(JSON.stringify(a.args,null,2)||"None")),m=void 0,m=-1!==a.type.indexOf("Script")?_processors.default[a.type](u,n,c):_processors.default[a.type](a.args),t.next=37,(0,_processors.ApplyProcessor)(m,e);case 37:e=t.sent;case 38:t.next=5;break;case 40:t.next=45;break;case 42:t.prev=42,t.t1=t.catch(3),o.e(t.t1);case 45:return t.prev=45,o.f(),t.finish(45);case 48:return t.abrupt("return",e);case 49:case"end":return t.stop()}}),t,null,[[3,42,45,48],[15,22]])})),(_process=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_38(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_38(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}var ProxyUtils={parse:function(t){t=function(t){var e,r=___createForOfIteratorHelper_38(_preprocessors.default);try{for(r.s();!(e=r.n()).done;){var n=e.value;try{if(n.test(t))return _app.default.info("Pre-processor [".concat(n.name,"] activated")),n.parse(t)}catch(o){_app.default.error("Parser [".concat(n.name,"] failed\n Reason: ").concat(o))}}}catch(i){r.e(i)}finally{r.f()}return t}(t);var e,r,n=[],o=___createForOfIteratorHelper_38(t.split("\n"));try{for(o.s();!(r=o.n()).done;){var i=r.value;if(0!==(i=i.trim()).length){var a=e&&safeMatch(e,i);if(!a){var u,c=___createForOfIteratorHelper_38(_parsers.default);try{for(c.s();!(u=c.n()).done;){var s=u.value;if(safeMatch(s,i)){e=s,a=!0,_app.default.info("Proxy parser: ".concat(s.name," is activated"));break}}}catch(l){c.e(l)}finally{c.f()}}if(a)try{var f=e.parse(i);f||_app.default.error("Parser ".concat(e.name," return nothing for \n").concat(i,"\n")),n.push(f)}catch(l){_app.default.error("Failed to parse line: \n ".concat(i,"\n Reason: ").concat(l.stack))}else _app.default.error("Failed to find a rule to parse line: \n".concat(i,"\n"))}}}catch(l){o.e(l)}finally{o.f()}return n},process:function(t){return _process.apply(this,arguments)},produce:function(t,e){var r=_producers.default[e];if(!r)throw new Error("Target platform: ".concat(e," is not supported!"));return t=t.filter((function(t){return!(t.supported&&!1===t.supported[e])})),_app.default.info("Producing proxies for target: ".concat(e)),void 0===r.type||"SINGLE"===r.type?t.map((function(t){try{return r.produce(t)}catch(e){return _app.default.error("Cannot produce proxy: ".concat(JSON.stringify(t,null,2),"\nReason: ").concat(e)),""}})).filter((function(t){return t.length>0})).join("\n"):"ALL"===r.type?r.produce(t):void 0}};function safeMatch(t,e){var r;try{r=t.test(e)}catch(n){r=!1}return r}_$proxyUtils_38.ProxyUtils=ProxyUtils;var _$preprocessors_45={};Object.defineProperty(_$preprocessors_45,"__esModule",{value:!0}),_$preprocessors_45.default=void 0;var ___default_45=[{name:"HTML",test:function(t){return/^/.test(t)},parse:function(){return""}},{name:"Clash Provider",test:function(t){return 0===t.indexOf("payload:")},parse:function(t){return t.replace("payload:","").replace(/^\s*-\s*/gm,"")}}];_$preprocessors_45.default=___default_45;var _$producers_46={};Object.defineProperty(_$producers_46,"__esModule",{value:!0}),_$producers_46.default=void 0;var __obj_46,___staticJsYaml_46=(__obj_46=_$staticJsYaml_36)&&__obj_46.__esModule?__obj_46:{default:__obj_46},___default_46={QX:{type:"SINGLE",func:function(t){return-1!==["URL-REGEX","DEST-PORT","SRC-IP","IN-PORT","PROTOCOL"].indexOf(t.type)?null:"".concat({"DOMAIN-KEYWORD":"HOST-KEYWORD","DOMAIN-SUFFIX":"HOST-SUFFIX",DOMAIN:"HOST","IP-CIDR6":"IP6-CIDR"}[t.type]||t.type,",").concat(t.content,",SUB-STORE")}},Surge:{type:"SINGLE",func:function(t){var e="".concat(t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(e+=t.options?",".concat(t.options[0]):""),e}},Loon:{type:"SINGLE",func:function(t){return-1!==["DEST-PORT","SRC-IP","IN-PORT","PROTOCOL"].indexOf(t.type)?null:function(t){var e="".concat(t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(e+=t.options?",".concat(t.options[0]):""),e}(t)}},Clash:{type:"ALL",func:function(t){var e={"DEST-PORT":"DST-PORT","SRC-IP":"SRC-IP-CIDR","IN-PORT":"SRC-PORT"},r={payload:t.map((function(t){var r="".concat(e[t.type]||t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(r+=t.options?",".concat(t.options[0]):""),r}))};return ___staticJsYaml_46.default.dump(r)}}};_$producers_46.default=___default_46;var _$parsers_44={};function ___createForOfIteratorHelper_44(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_44(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_44(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_44(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_43(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0})).join("\n"):"ALL"===r.type?r.func(t):void 0}};_$ruleUtils_43.RuleUtils=RuleUtils;var _$resourceParserLoon_47={},RESOURCE_TYPE_RULE=2,result=$resource;if(1===$resourceType){var proxies=_$proxyUtils_38.ProxyUtils.parse($resource);result=_$proxyUtils_38.ProxyUtils.produce(proxies,"Loon")}else if($resourceType===RESOURCE_TYPE_RULE){var rules=_$ruleUtils_43.RuleUtils.parse($resource);result=_$ruleUtils_43.RuleUtils.produce(rules,"Loon")}$done(result)}(); \ No newline at end of file diff --git a/backend/src/core/proxy-utils.js b/backend/src/core/proxy-utils.js deleted file mode 100644 index e381a31..0000000 --- a/backend/src/core/proxy-utils.js +++ /dev/null @@ -1,2015 +0,0 @@ -/* eslint-disable no-case-declarations */ -import { HTTP } from '../vendor/open-api'; -import { safeLoad } from 'static-js-yaml'; -import download from '../utils/download'; -import { FULL } from '../utils/logical'; -import { getFlag } from '../utils/geo'; -import { Base64 } from 'js-base64'; -import lodash from 'lodash'; - -import $ from './app'; - -const PROXY_PREPROCESSORS = (function () { - function HTML() { - const name = 'HTML'; - const test = (raw) => /^/.test(raw); - // simply discard HTML - const parse = () => ''; - return { name, test, parse }; - } - - function Base64Encoded() { - const name = 'Base64 Pre-processor'; - - const keys = [ - 'dm1lc3M', - 'c3NyOi8v', - 'dHJvamFu', - 'c3M6Ly', - 'c3NkOi8v', - 'c2hhZG93', - 'aHR0c', - ]; - - const test = function (raw) { - return keys.some((k) => raw.indexOf(k) !== -1); - }; - const parse = function (raw) { - raw = Base64.decode(raw); - return raw; - }; - return { name, test, parse }; - } - - function Clash() { - const name = 'Clash Pre-processor'; - const test = function (raw) { - return /proxies/.test(raw); - }; - const parse = function (raw) { - // Clash YAML format - const proxies = safeLoad(raw).proxies; - return proxies.map((p) => JSON.stringify(p)).join('\n'); - }; - return { name, test, parse }; - } - - function SSD() { - const name = 'SSD Pre-processor'; - const test = function (raw) { - return raw.indexOf('ssd://') === 0; - }; - const parse = function (raw) { - // preprocessing for SSD subscription format - const output = []; - let ssdinfo = JSON.parse(Base64.decode(raw.split('ssd://')[1])); - let port = ssdinfo.port; - let method = ssdinfo.encryption; - let password = ssdinfo.password; - // servers config - let servers = ssdinfo.servers; - for (let i = 0; i < servers.length; i++) { - let server = servers[i]; - method = server.encryption ? server.encryption : method; - password = server.password ? server.password : password; - let userinfo = Base64.encode(method + ':' + password); - let hostname = server.server; - port = server.port ? server.port : port; - let tag = server.remarks ? server.remarks : i; - let plugin = server.plugin_options - ? '/?plugin=' + - encodeURIComponent( - server.plugin + ';' + server.plugin_options, - ) - : ''; - output[i] = - 'ss://' + - userinfo + - '@' + - hostname + - ':' + - port + - plugin + - '#' + - tag; - } - return output.join('\n'); - }; - return { name, test, parse }; - } - - return [HTML(), Base64Encoded(), Clash(), SSD()]; -})(); -const PROXY_PARSERS = (function () { - // Parse SS URI format (only supports new SIP002, legacy format is depreciated). - // reference: https://shadowsocks.org/en/spec/SIP002-URI-Scheme.html - function URI_SS() { - const name = 'URI SS Parser'; - const test = (line) => { - return /^ss:\/\//.test(line); - }; - const parse = (line) => { - const supported = {}; - // parse url - let content = line.split('ss://')[1]; - - const proxy = { - name: decodeURIComponent(line.split('#')[1]), - type: 'ss', - supported, - }; - content = content.split('#')[0]; // strip proxy name - // handle IPV4 and IPV6 - const serverAndPort = content.match(/@([^/]*)(\/|$)/)[1]; - const portIdx = serverAndPort.lastIndexOf(':'); - proxy.server = serverAndPort.substring(0, portIdx); - proxy.port = serverAndPort.substring(portIdx + 1); - - const userInfo = Base64.decode(content.split('@')[0]).split(':'); - proxy.cipher = userInfo[0]; - proxy.password = userInfo[1]; - - // handle obfs - const idx = content.indexOf('?plugin='); - if (idx !== -1) { - const pluginInfo = ( - 'plugin=' + - decodeURIComponent( - content.split('?plugin=')[1].split('&')[0], - ) - ).split(';'); - const params = {}; - for (const item of pluginInfo) { - const [key, val] = item.split('='); - if (key) params[key] = val || true; // some options like "tls" will not have value - } - switch (params.plugin) { - case 'obfs-local': - case 'simple-obfs': - proxy.plugin = 'obfs'; - proxy['plugin-opts'] = { - mode: params.obfs, - host: params['obfs-host'], - }; - break; - case 'v2ray-plugin': - proxy.supported = { - ...supported, - Loon: false, - Surge: false, - }; - proxy.obfs = 'v2ray-plugin'; - proxy['plugin-opts'] = { - mode: 'websocket', - host: params['obfs-host'], - path: params.path || '', - tls: params.tls || false, - }; - break; - default: - throw new Error( - `Unsupported plugin option: ${params.plugin}`, - ); - } - } - return proxy; - }; - return { name, test, parse }; - } - - // Parse URI SSR format, such as ssr://xxx - function URI_SSR() { - const name = 'URI SSR Parser'; - const test = (line) => { - return /^ssr:\/\//.test(line); - }; - const supported = { - Surge: false, - }; - - const parse = (line) => { - line = Base64.decode(line.split('ssr://')[1]); - - // handle IPV6 & IPV4 format - let splitIdx = line.indexOf(':origin'); - if (splitIdx === -1) { - splitIdx = line.indexOf(':auth_'); - } - const serverAndPort = line.substring(0, splitIdx); - const server = serverAndPort.substring( - 0, - serverAndPort.lastIndexOf(':'), - ); - const port = serverAndPort.substring( - serverAndPort.lastIndexOf(':') + 1, - ); - - let params = line - .substring(splitIdx + 1) - .split('/?')[0] - .split(':'); - let proxy = { - type: 'ssr', - server, - port, - protocol: params[0], - cipher: params[1], - obfs: params[2], - password: Base64.decode(params[3]), - supported, - }; - // get other params - const other_params = {}; - line = line.split('/?')[1].split('&'); - if (line.length > 1) { - for (const item of line) { - const [key, val] = item.split('='); - other_params[key] = val.trim(); - } - } - proxy = { - ...proxy, - name: other_params.remarks - ? Base64.decode(other_params.remarks) - : proxy.server, - 'protocol-param': Base64.decode( - other_params.protoparam || '', - ).replace(/\s/g, ''), - 'obfs-param': Base64.decode( - other_params.obfsparam || '', - ).replace(/\s/g, ''), - }; - return proxy; - }; - - return { name, test, parse }; - } - - // V2rayN URI VMess format - // reference: https://github.com/2dust/v2rayN/wiki/%E5%88%86%E4%BA%AB%E9%93%BE%E6%8E%A5%E6%A0%BC%E5%BC%8F%E8%AF%B4%E6%98%8E(ver-2) - - // Quantumult VMess format - function URI_VMess() { - const name = 'URI VMess Parser'; - const test = (line) => { - return /^vmess:\/\//.test(line); - }; - const parse = (line) => { - const supported = {}; - line = line.split('vmess://')[1]; - const content = Base64.decode(line); - if (/=\s*vmess/.test(content)) { - // Quantumult VMess URI format - const partitions = content.split(',').map((p) => p.trim()); - // get keyword params - const params = {}; - for (const part of partitions) { - if (part.indexOf('=') !== -1) { - const [key, val] = part.split('='); - params[key.trim()] = val.trim(); - } - } - - const proxy = { - name: partitions[0].split('=')[0].trim(), - type: 'vmess', - server: partitions[1], - port: partitions[2], - cipher: partitions[3], - uuid: partitions[4].match(/^"(.*)"$/)[1], - tls: params.obfs === 'over-tls' || params.obfs === 'wss', - }; - - if (typeof params['udp-relay'] !== 'undefined') - proxy.udp = JSON.parse(params['udp-relay']); - if (typeof params['fast-open'] !== 'undefined') - proxy.udp = JSON.parse(params['fast-open']); - - // handle ws headers - if (params.obfs === 'ws' || params.obfs === 'wss') { - proxy.network = 'ws'; - proxy['ws-opts'].path = ( - params['obfs-path'] || '"/"' - ).match(/^"(.*)"$/)[1]; - let obfs_host = params['obfs-header']; - if (obfs_host && obfs_host.indexOf('Host') !== -1) { - obfs_host = obfs_host.match( - /Host:\s*([a-zA-Z0-9-.]*)/, - )[1]; - } - proxy['ws-opts'].headers = { - Host: obfs_host || proxy.server, // if no host provided, use the same as server - }; - } - - // handle scert - if (proxy.tls && params['"tls-verification"'] === 'false') { - proxy['skip-cert-verify'] = true; - } - - // handle sni - if (proxy.tls && params['obfs-host']) { - proxy.sni = params['obfs-host']; - } - - return proxy; - } else { - // V2rayN URI format - const params = JSON.parse(content); - const proxy = { - name: params.ps, - type: 'vmess', - server: params.add, - port: params.port, - cipher: 'auto', // V2rayN has no default cipher! use aes-128-gcm as default. - uuid: params.id, - alterId: params.aid || 0, - tls: params.tls === 'tls' || params.tls === true, - supported, - }; - // handle obfs - if (params.net === 'ws') { - proxy.network = 'ws'; - proxy['ws-opts'] = { - path: params.path, - headers: { Host: params.host || params.add }, - }; - if (proxy.tls && params.host) { - proxy.sni = params.host; - } - } - // handle scert - if (params.verify_cert === false) { - proxy['skip-cert-verify'] = true; - } - return proxy; - } - }; - return { name, test, parse }; - } - - // Trojan URI format - function URI_Trojan() { - const name = 'URI Trojan Parser'; - const test = (line) => { - return /^trojan:\/\//.test(line); - }; - - const parse = (line) => { - const supported = {}; - line = line.split('trojan://')[1]; - const [server, port] = line.split('@')[1].split('?')[0].split(':'); - const name = decodeURIComponent(line.split('#')[1].trim()); - let paramArr = line.split('?'); - let sni = null; - if (paramArr.length > 1) { - paramArr = paramArr[1].split('#')[0].split('&'); - const params = new Map( - paramArr.map((item) => { - return item.split('='); - }), - ); - sni = params.get('sni'); - } - - return { - name: name || `[Trojan] ${server}`, // trojan uri may have no server tag! - type: 'trojan', - server, - port, - password: line.split('@')[0], - sni, - supported, - }; - }; - return { name, test, parse }; - } - - function Clash_All() { - const name = 'Clash Parser'; - const test = (line) => { - try { - JSON.parse(line); - } catch (e) { - return false; - } - return true; - }; - const parse = (line) => JSON.parse(line); - return { name, test, parse }; - } - - function QX_SS() { - const name = 'QX SS Parser'; - const test = (line) => { - return ( - /^shadowsocks\s*=/.test(line.split(',')[0].trim()) && - line.indexOf('ssr-protocol') === -1 - ); - }; - const parse = (line) => { - const supported = {}; - const params = getQXParams(line); - const proxy = { - name: params.tag, - type: 'ss', - server: params.server, - port: params.port, - cipher: params.method, - password: params.password, - udp: JSON.parse(params['udp-relay'] || 'false'), - tfo: JSON.parse(params['fast-open'] || 'false'), - supported, - }; - // handle obfs options - if (params.obfs) { - proxy['plugin-opts'] = { - host: params['obfs-host'] || proxy.server, - }; - switch (params.obfs) { - case 'http': - case 'tls': - proxy.plugin = 'obfs'; - proxy['plugin-opts'].mode = params.obfs; - break; - case 'ws': - case 'wss': - proxy['plugin-opts'] = { - ...proxy['plugin-opts'], - mode: 'websocket', - path: params['obfs-uri'] || '/', - tls: params.obfs === 'wss', - }; - if ( - proxy['plugin-opts'].tls && - typeof params['tls-verification'] !== 'undefined' - ) { - proxy['plugin-opts']['skip-cert-verify'] = - params['tls-verification']; - } - proxy.plugin = 'v2ray-plugin'; - // Surge and Loon lack support for v2ray-plugin obfs - proxy.supported.Surge = false; - proxy.supported.Loon = false; - break; - } - } - return proxy; - }; - return { name, test, parse }; - } - - function QX_SSR() { - const name = 'QX SSR Parser'; - const test = (line) => { - return ( - /^shadowsocks\s*=/.test(line.split(',')[0].trim()) && - line.indexOf('ssr-protocol') !== -1 - ); - }; - - const parse = (line) => { - const supported = { - Surge: false, - }; - const params = getQXParams(line); - const proxy = { - name: params.tag, - type: 'ssr', - server: params.server, - port: params.port, - cipher: params.method, - password: params.password, - protocol: params['ssr-protocol'], - obfs: 'plain', // default obfs - 'protocol-param': params['ssr-protocol-param'], - udp: JSON.parse(params['udp-relay'] || 'false'), - tfo: JSON.parse(params['fast-open'] || 'false'), - supported, - }; - // handle obfs options - if (params.obfs) { - proxy.obfs = params.obfs; - proxy['obfs-param'] = params['obfs-host']; - } - return proxy; - }; - return { name, test, parse }; - } - - function QX_VMess() { - const name = 'QX VMess Parser'; - const test = (line) => { - return /^vmess\s*=/.test(line.split(',')[0].trim()); - }; - const parse = (line) => { - const params = getQXParams(line); - const proxy = { - type: 'vmess', - name: params.tag, - server: params.server, - port: params.port, - cipher: params.method || 'none', - uuid: params.password, - alterId: 0, - tls: params.obfs === 'over-tls' || params.obfs === 'wss', - udp: JSON.parse(params['udp-relay'] || 'false'), - tfo: JSON.parse(params['fast-open'] || 'false'), - }; - if (proxy.tls) { - proxy.sni = params['obfs-host'] || params.server; - proxy['skip-cert-verify'] = !JSON.parse( - params['tls-verification'] || 'true', - ); - } - // handle ws headers - if (params.obfs === 'ws' || params.obfs === 'wss') { - proxy.network = 'ws'; - proxy['ws-opts'] = { - path: params['obfs-uri'], - headers: { - Host: params['obfs-host'] || params.server, // if no host provided, use the same as server - }, - }; - } - return proxy; - }; - - return { name, test, parse }; - } - - function QX_Trojan() { - const name = 'QX Trojan Parser'; - const test = (line) => { - return /^trojan\s*=/.test(line.split(',')[0].trim()); - }; - const parse = (line) => { - const params = getQXParams(line); - const proxy = { - type: 'trojan', - name: params.tag, - server: params.server, - port: params.port, - password: params.password, - sni: params['tls-host'] || params.server, - udp: JSON.parse(params['udp-relay'] || 'false'), - tfo: JSON.parse(params['fast-open'] || 'false'), - }; - proxy['skip-cert-verify'] = !JSON.parse( - params['tls-verification'] || 'true', - ); - return proxy; - }; - return { name, test, parse }; - } - - function QX_Http() { - const name = 'QX HTTP Parser'; - const test = (line) => { - return /^http\s*=/.test(line.split(',')[0].trim()); - }; - const parse = (line) => { - const params = getQXParams(line); - const proxy = { - type: 'http', - name: params.tag, - server: params.server, - port: params.port, - tls: JSON.parse(params['over-tls'] || 'false'), - udp: JSON.parse(params['udp-relay'] || 'false'), - tfo: JSON.parse(params['fast-open'] || 'false'), - }; - if (params.username && params.username !== 'none') - proxy.username = params.username; - if (params.password && params.password !== 'none') - proxy.password = params.password; - if (proxy.tls) { - proxy.sni = params['tls-host'] || proxy.server; - proxy['skip-cert-verify'] = !JSON.parse( - params['tls-verification'] || 'true', - ); - } - return proxy; - }; - - return { name, test, parse }; - } - - function getQXParams(line) { - const groups = line.split(','); - const params = {}; - const protocols = ['shadowsocks', 'vmess', 'http', 'trojan']; - groups.forEach((g) => { - let [key, value] = g.split('='); - key = key.trim(); - value = value.trim(); - if (protocols.indexOf(key) !== -1) { - params.type = key; - const conf = value.split(':'); - params.server = conf[0]; - params.port = conf[1]; - } else { - params[key.trim()] = value.trim(); - } - }); - return params; - } - - function Loon_SS() { - const name = 'Loon SS Parser'; - const test = (line) => { - return ( - line.split(',')[0].split('=')[1].trim().toLowerCase() === - 'shadowsocks' - ); - }; - const parse = (line) => { - const params = line.split('=')[1].split(','); - const proxy = { - name: line.split('=')[0].trim(), - type: 'ss', - server: params[1], - port: params[2], - cipher: params[3], - password: params[4].replace(/"/g, ''), - }; - // handle obfs - if (params.length > 5) { - proxy.plugin = 'obfs'; - proxy['plugin-opts'] = { - mode: params[5], - host: params[6], - }; - } - return proxy; - }; - return { name, test, parse }; - } - - function Loon_SSR() { - const name = 'Loon SSR Parser'; - const test = (line) => { - return ( - line.split(',')[0].split('=')[1].trim().toLowerCase() === - 'shadowsocksr' - ); - }; - const parse = (line) => { - const params = line.split('=')[1].split(','); - const supported = { - Surge: false, - }; - return { - name: line.split('=')[0].trim(), - type: 'ssr', - server: params[1], - port: params[2], - cipher: params[3], - password: params[4].replace(/"/g, ''), - protocol: params[5], - 'protocol-param': params[6].match(/{(.*)}/)[1], - supported, - obfs: params[7], - 'obfs-param': params[8].match(/{(.*)}/)[1], - }; - }; - return { name, test, parse }; - } - - function Loon_VMess() { - const name = 'Loon VMess Parser'; - const test = (line) => { - // distinguish between surge vmess - return ( - /^.*=\s*vmess/i.test(line.split(',')[0]) && - line.indexOf('username') === -1 - ); - }; - const parse = (line) => { - let params = line.split('=')[1].split(','); - const proxy = { - name: line.split('=')[0].trim(), - type: 'vmess', - server: params[1], - port: params[2], - cipher: params[3] || 'none', - uuid: params[4].replace(/"/g, ''), - alterId: 0, - }; - // get transport options - params = params.splice(5); - for (const item of params) { - const [key, val] = item.split(':'); - params[key] = val; - } - proxy.tls = JSON.parse(params['over-tls'] || 'false'); - if (proxy.tls) { - proxy.sni = params['tls-name'] || proxy.server; - proxy['skip-cert-verify'] = JSON.parse( - params['skip-cert-verify'] || 'false', - ); - } - switch (params.transport) { - case 'tcp': - break; - case 'ws': - proxy.network = params.transport; - proxy['ws-opts'] = { - path: params.path, - headers: { - Host: params.host, - }, - }; - } - if (proxy.tls) { - proxy['skip-cert-verify'] = JSON.parse( - params['skip-cert-verify'] || 'false', - ); - } - return proxy; - }; - return { name, test, parse }; - } - - function Loon_Trojan() { - const name = 'Loon Trojan Parser'; - const test = (line) => { - return ( - /^.*=\s*trojan/i.test(line.split(',')[0]) && - line.indexOf('password') === -1 - ); - }; - - const parse = (line) => { - const params = line.split('=')[1].split(','); - const proxy = { - name: line.split('=')[0].trim(), - type: 'trojan', - server: params[1], - port: params[2], - password: params[3].replace(/"/g, ''), - sni: params[1], // default sni is the server itself - 'skip-cert-verify': JSON.parse( - params['skip-cert-verify'] || 'false', - ), - }; - // trojan sni - if (params.length > 4) { - const [key, val] = params[4].split(':'); - if (key === 'tls-name') proxy.sni = val; - else - throw new Error( - `Unknown option ${key} for line: \n${line}`, - ); - } - return proxy; - }; - - return { name, test, parse }; - } - - function Loon_Http() { - const name = 'Loon HTTP Parser'; - const test = (line) => { - return ( - /^.*=\s*http/i.test(line.split(',')[0]) && - line.split(',').length === 5 && - line.indexOf('username') === -1 && - line.indexOf('password') === -1 - ); - }; - - const parse = (line) => { - const params = line.split('=')[1].split(','); - const proxy = { - name: line.split('=')[0].trim(), - type: 'http', - server: params[1], - port: params[2], - tls: params[2] === '443', // port 443 is considered as https type - }; - if (params[3]) proxy.username = params[3]; - if (params[4]) proxy.password = params[4]; - - if (proxy.tls) { - proxy.sni = params['tls-name'] || proxy.server; - proxy['skip-cert-verify'] = JSON.parse( - params['skip-cert-verify'] || 'false', - ); - } - - return proxy; - }; - return { name, test, parse }; - } - - function Surge_SS() { - const name = 'Surge SS Parser'; - const test = (line) => { - return /^.*=\s*ss/.test(line.split(',')[0]); - }; - const parse = (line) => { - const params = getSurgeParams(line); - const proxy = { - name: params.name, - type: 'ss', - server: params.server, - port: params.port, - cipher: params['encrypt-method'], - password: params.password, - tfo: JSON.parse(params.tfo || 'false'), - udp: JSON.parse(params['udp-relay'] || 'false'), - }; - // handle obfs - if (params.obfs) { - proxy.plugin = 'obfs'; - proxy['plugin-opts'] = { - mode: params.obfs, - host: params['obfs-host'], - }; - } - return proxy; - }; - return { name, test, parse }; - } - - function Surge_VMess() { - const name = 'Surge VMess Parser'; - const test = (line) => { - return ( - /^.*=\s*vmess/.test(line.split(',')[0]) && - line.indexOf('username') !== -1 - ); - }; - const parse = (line) => { - const params = getSurgeParams(line); - const proxy = { - name: params.name, - type: 'vmess', - server: params.server, - port: params.port, - uuid: params.username, - alterId: 0, // surge does not have this field - cipher: 'none', // surge does not have this field - tls: JSON.parse(params.tls || 'false'), - tfo: JSON.parse(params.tfo || 'false'), - }; - if (proxy.tls) { - if (typeof params['skip-cert-verify'] !== 'undefined') { - proxy['skip-cert-verify'] = - params['skip-cert-verify'] === true || - params['skip-cert-verify'] === '1'; - } - proxy.sni = params['sni'] || params.server; - } - // use websocket - if (JSON.parse(params.ws || 'false')) { - proxy.network = 'ws'; - proxy['ws-opts'] = { - path: params['ws-path'], - }; - - const res = params['ws-headers'].match( - /(,|^|\s)*HOST:\s*(.*?)(,|$)/, - ); - const host = res ? res[2] : proxy.server; - proxy['ws-opts'].headers = { - Host: host || params.server, - }; - } - return proxy; - }; - return { name, test, parse }; - } - - function Surge_Trojan() { - const name = 'Surge Trojan Parser'; - const test = (line) => { - return ( - /^.*=\s*trojan/.test(line.split(',')[0]) && - line.indexOf('sni') !== -1 - ); - }; - const parse = (line) => { - const params = getSurgeParams(line); - const proxy = { - name: params.name, - type: 'trojan', - server: params.server, - port: params.port, - password: params.password, - sni: params.sni || params.server, - tfo: JSON.parse(params.tfo || 'false'), - }; - if (typeof params['skip-cert-verify'] !== 'undefined') { - proxy['skip-cert-verify'] = - params['skip-cert-verify'] === true || - params['skip-cert-verify'] === '1'; - } - return proxy; - }; - - return { name, test, parse }; - } - - function Surge_Http() { - const name = 'Surge HTTP Parser'; - const test = (line) => { - return ( - /^.*=\s*https?/.test(line.split(',')[0]) && - !Loon_Http().test(line) - ); - }; - const parse = (line) => { - const params = getSurgeParams(line); - const tls = /^.*?=\s?https/.test(line); - const proxy = { - name: params.name, - type: 'http', - server: params.server, - port: params.port, - tls: JSON.parse(tls || 'false'), - tfo: JSON.parse(params.tfo || 'false'), - }; - if (proxy.tls) { - if (typeof params['skip-cert-verify'] !== 'undefined') { - proxy['skip-cert-verify'] = - params['skip-cert-verify'] === true || - params['skip-cert-verify'] === '1'; - } - proxy.sni = params.sni || params.server; - } - if (params.username && params.username !== 'none') - proxy.username = params.username; - if (params.password && params.password !== 'none') - proxy.password = params.password; - return proxy; - }; - return { name, test, parse }; - } - - function getSurgeParams(line) { - const params = {}; - params.name = line.split('=')[0].trim(); - const segments = line.split(','); - params.server = segments[1].trim(); - params.port = segments[2].trim(); - for (let i = 3; i < segments.length; i++) { - const item = segments[i]; - if (item.indexOf('=') !== -1) { - const [key, value] = item.split('='); - params[key.trim()] = value.trim(); - } - } - return params; - } - - return [ - URI_SS(), - URI_SSR(), - URI_VMess(), - URI_Trojan(), - Clash_All(), - Surge_SS(), - Surge_VMess(), - Surge_Trojan(), - Surge_Http(), - Loon_SS(), - Loon_SSR(), - Loon_VMess(), - Loon_Trojan(), - Loon_Http(), - QX_SS(), - QX_SSR(), - QX_VMess(), - QX_Trojan(), - QX_Http(), - ]; -})(); -const PROXY_PROCESSORS = (function () { - // force to set some properties (e.g., skip-cert-verify, udp, tfo, etc.) - function SetPropertyOperator({ key, value }) { - return { - name: 'Set Property Operator', - func: (proxies) => { - return proxies.map((p) => { - p[key] = value; - return p; - }); - }, - }; - } - - // add or remove flag for proxies - function FlagOperator(add = true) { - return { - name: 'Flag Operator', - func: (proxies) => { - return proxies.map((proxy) => { - if (!add) { - // no flag - proxy.name = removeFlag(proxy.name); - } else { - // get flag - const newFlag = getFlag(proxy.name); - // remove old flag - proxy.name = removeFlag(proxy.name); - proxy.name = newFlag + ' ' + proxy.name; - proxy.name = proxy.name.replace(/🇹🇼/g, '🇨🇳'); - } - return proxy; - }); - }, - }; - } - - // duplicate handler - function HandleDuplicateOperator(arg) { - const { action, template, link, position } = { - ...{ - action: 'rename', - template: '0 1 2 3 4 5 6 7 8 9', - link: '-', - position: 'back', - }, - ...arg, - }; - return { - name: 'Handle Duplicate Operator', - func: (proxies) => { - if (action === 'delete') { - const chosen = {}; - return proxies.filter((p) => { - if (chosen[p.name]) { - return false; - } - chosen[p.name] = true; - return true; - }); - } else if (action === 'rename') { - const numbers = template.split(' '); - // count occurrences of each name - const counter = {}; - let maxLen = 0; - proxies.forEach((p) => { - if (typeof counter[p.name] === 'undefined') - counter[p.name] = 1; - else counter[p.name]++; - maxLen = Math.max( - counter[p.name].toString().length, - maxLen, - ); - }); - const increment = {}; - return proxies.map((p) => { - if (counter[p.name] > 1) { - if (typeof increment[p.name] == 'undefined') - increment[p.name] = 1; - let num = ''; - let cnt = increment[p.name]++; - let numDigits = 0; - while (cnt > 0) { - num = numbers[cnt % 10] + num; - cnt = parseInt(cnt / 10); - numDigits++; - } - // padding - while (numDigits++ < maxLen) { - num = numbers[0] + num; - } - if (position === 'front') { - p.name = num + link + p.name; - } else if (position === 'back') { - p.name = p.name + link + num; - } - } - return p; - }); - } - }, - }; - } - - // sort proxies according to their names - function SortOperator(order = 'asc') { - return { - name: 'Sort Operator', - func: (proxies) => { - switch (order) { - case 'asc': - case 'desc': - return proxies.sort((a, b) => { - let res = a.name > b.name ? 1 : -1; - res *= order === 'desc' ? -1 : 1; - return res; - }); - case 'random': - return shuffle(proxies); - default: - throw new Error('Unknown sort option: ' + order); - } - }, - }; - } - - // sort by regex - function RegexSortOperator(expressions) { - return { - name: 'Regex Sort Operator', - func: (proxies) => { - expressions = expressions.map((expr) => buildRegex(expr)); - return proxies.sort((a, b) => { - const oA = getRegexOrder(expressions, a.name); - const oB = getRegexOrder(expressions, b.name); - if (oA && !oB) return -1; - if (oB && !oA) return 1; - if (oA && oB) return oA < oB ? -1 : 1; - if ((!oA && !oB) || (oA && oB && oA === oB)) - return a.name < b.name ? -1 : 1; // fallback to normal sort - }); - }, - }; - } - - function getRegexOrder(expressions, str) { - let order = null; - for (let i = 0; i < expressions.length; i++) { - if (expressions[i].test(str)) { - order = i + 1; // plus 1 is important! 0 will be treated as false!!! - break; - } - } - return order; - } - - // rename by regex - // keywords: [{expr: "string format regex", now: "now"}] - function RegexRenameOperator(regex) { - return { - name: 'Regex Rename Operator', - func: (proxies) => { - return proxies.map((proxy) => { - for (const { expr, now } of regex) { - proxy.name = proxy.name - .replace(buildRegex(expr, 'g'), now) - .trim(); - } - return proxy; - }); - }, - }; - } - - // delete regex operator - // regex: ['a', 'b', 'c'] - function RegexDeleteOperator(regex) { - const regex_ = regex.map((r) => { - return { - expr: r, - now: '', - }; - }); - return { - name: 'Regex Delete Operator', - func: RegexRenameOperator(regex_).func, - }; - } - - /** Script Operator - function operator(proxies) { - const {arg1} = $arguments; - - // do something - return proxies; - } - - WARNING: - 1. This function name should be `operator`! - 2. Always declare variables before using them! - */ - function ScriptOperator(script, targetPlatform, $arguments) { - return { - name: 'Script Operator', - func: async (proxies) => { - let output = proxies; - await (async function () { - const operator = new Function( - '$arguments', - 'HTTP', - 'lodash', - `${script}\n return operator`, - )($arguments, HTTP, lodash); - output = operator(proxies, targetPlatform); - })(); - return output; - }, - }; - } - - /**************************** Filters ***************************************/ - // filter useless proxies - function UselessFilter() { - const KEYWORDS = [ - '网址', - '流量', - '时间', - '应急', - '过期', - 'Bandwidth', - 'expire', - ]; - return { - name: 'Useless Filter', - func: RegexFilter({ - regex: KEYWORDS, - keep: false, - }).func, - }; - } - - // filter by regions - function RegionFilter(regions) { - const REGION_MAP = { - HK: '🇭🇰', - TW: '🇹🇼', - US: '🇺🇸', - SG: '🇸🇬', - JP: '🇯🇵', - UK: '🇬🇧', - }; - return { - name: 'Region Filter', - func: (proxies) => { - // this would be high memory usage - return proxies.map((proxy) => { - const flag = getFlag(proxy.name); - return regions.some((r) => REGION_MAP[r] === flag); - }); - }, - }; - } - - // filter by regex - function RegexFilter({ regex = [], keep = true }) { - return { - name: 'Regex Filter', - func: (proxies) => { - return proxies.map((proxy) => { - const selected = regex.some((r) => { - return buildRegex(r).test(proxy.name); - }); - return keep ? selected : !selected; - }); - }, - }; - } - - function buildRegex(str, ...options) { - options = options.join(''); - if (str.startsWith('(?i)')) { - str = str.substr(4); - return new RegExp(str, 'i' + options); - } else { - return new RegExp(str, options); - } - } - - // filter by proxy types - function TypeFilter(types) { - return { - name: 'Type Filter', - func: (proxies) => { - return proxies.map((proxy) => - types.some((t) => proxy.type === t), - ); - }, - }; - } - - /** - Script Example - - function filter(proxies) { - return proxies.map(p => { - return p.name.indexOf("🇭🇰") !== -1; - }); - } - - WARNING: - 1. This function name should be `filter`! - 2. Always declare variables before using them! - */ - function ScriptFilter(script, targetPlatform, $arguments) { - return { - name: 'Script Filter', - func: async (proxies) => { - let output = FULL(proxies.length, true); - await (async function () { - const filter = new Function( - '$arguments', - 'HTTP', - 'lodash', - `${script}\n return filter`, - )($arguments, HTTP, lodash); - output = filter(proxies, targetPlatform); - })(); - return output; - }, - }; - } - - return { - 'Useless Filter': UselessFilter, - 'Region Filter': RegionFilter, - 'Regex Filter': RegexFilter, - 'Type Filter': TypeFilter, - 'Script Filter': ScriptFilter, - - 'Set Property Operator': SetPropertyOperator, - 'Flag Operator': FlagOperator, - 'Sort Operator': SortOperator, - 'Regex Sort Operator': RegexSortOperator, - 'Regex Rename Operator': RegexRenameOperator, - 'Regex Delete Operator': RegexDeleteOperator, - 'Script Operator': ScriptOperator, - 'Handle Duplicate Operator': HandleDuplicateOperator, - }; -})(); -const PROXY_PRODUCERS = (function () { - function QX_Producer() { - const targetPlatform = 'QX'; - const produce = (proxy) => { - let obfs_opts; - let tls_opts; - switch (proxy.type) { - case 'ss': - obfs_opts = ''; - if (proxy.plugin === 'obfs') { - const { host, mode } = proxy['plugin-opts']; - obfs_opts = `,obfs=${mode}${ - host ? ',obfs-host=' + host : '' - }`; - } - if (proxy.plugin === 'v2ray-plugin') { - const { tls, host, path } = proxy['plugin-opts']; - obfs_opts = `,obfs=${tls ? 'wss' : 'ws'}${ - host ? ',obfs-host=' + host : '' - }${path ? ',obfs-uri=' + path : ''}`; - } - return `shadowsocks=${proxy.server}:${proxy.port},method=${ - proxy.cipher - },password=${proxy.password}${obfs_opts}${ - proxy.tfo ? ',fast-open=true' : ',fast-open=false' - }${ - proxy.udp ? ',udp-relay=true' : ',udp-relay=false' - },tag=${proxy.name}`; - case 'ssr': - return `shadowsocks=${proxy.server}:${proxy.port},method=${ - proxy.cipher - },password=${proxy.password},ssr-protocol=${ - proxy.protocol - }${ - proxy['protocol-param'] - ? ',ssr-protocol-param=' + proxy['protocol-param'] - : '' - }${proxy.obfs ? ',obfs=' + proxy.obfs : ''}${ - proxy['obfs-param'] - ? ',obfs-host=' + proxy['obfs-param'] - : '' - },fast-open=${proxy.tfo || false}${ - proxy.udp ? ',udp-relay=true' : ',udp-relay=false' - },tag=${proxy.name}`; - case 'vmess': - obfs_opts = ''; - if (proxy.network === 'ws') { - // websocket - if (proxy.tls) { - // ws-tls - obfs_opts = `,obfs=wss${ - proxy.sni ? ',obfs-host=' + proxy.sni : '' - }${ - proxy['ws-opts'].path - ? ',obfs-uri=' + proxy['ws-opts'].path - : '' - },tls-verification=${ - proxy['skip-cert-verify'] ? 'false' : 'true' - }`; - } else { - // ws - obfs_opts = `,obfs=ws${ - proxy['ws-opts'].headers.Host - ? ',obfs-host=' + - proxy['ws-opts'].headers.Host - : '' - }${ - proxy['ws-opts'].path - ? ',obfs-uri=' + proxy['ws-opts'].path - : '' - }`; - } - } else { - // tcp - if (proxy.tls) { - obfs_opts = `,obfs=over-tls${ - proxy.sni ? ',obfs-host=' + proxy.sni : '' - },tls-verification=${ - proxy['skip-cert-verify'] ? 'false' : 'true' - }`; - } - } - let result = `vmess=${proxy.server}:${proxy.port},method=${ - proxy.cipher === 'auto' ? 'none' : proxy.cipher - },password=${proxy.uuid}${obfs_opts},fast-open=${ - proxy.tfo || false - }${proxy.udp ? ',udp-relay=true' : ',udp-relay=false'}`; - if (proxy.alterId === 0) proxy['vmess-aead'] = true; - if (typeof proxy['vmess-aead'] !== 'undefined') { - result += `,aead=${proxy['vmess-aead']}`; - } - result += `,tag=${proxy.name}`; - return result; - case 'trojan': - return `trojan=${proxy.server}:${proxy.port},password=${ - proxy.password - }${ - proxy.sni ? ',tls-host=' + proxy.sni : '' - },over-tls=true,tls-verification=${ - proxy['skip-cert-verify'] ? 'false' : 'true' - },fast-open=${proxy.tfo || false}${ - proxy.udp ? ',udp-relay=true' : ',udp-relay=false' - },tag=${proxy.name}`; - case 'http': - tls_opts = ''; - if (proxy.tls) { - tls_opts = `,over-tls=true,tls-verification=${ - proxy['skip-cert-verify'] ? 'false' : 'true' - }${proxy.sni ? ',tls-host=' + proxy.sni : ''}`; - } - return `http=${proxy.server}:${proxy.port},username=${ - proxy.username - },password=${proxy.password}${tls_opts},fast-open=${ - proxy.tfo || false - },tag=${proxy.name}`; - } - throw new Error( - `Platform ${targetPlatform} does not support proxy type: ${proxy.type}`, - ); - }; - return { produce }; - } - - function Loon_Producer() { - const targetPlatform = 'Loon'; - const produce = (proxy) => { - let obfs_opts = '', - tls_opts = '', - udp_opts = '', - tfo_opts = ''; - if (typeof proxy.udp !== 'undefined') { - udp_opts = proxy.udp ? ',udp=true' : ',udp=false'; - } - tfo_opts = `,fast-open=${proxy.tfo || false}`; - - switch (proxy.type) { - case 'ss': - obfs_opts = ',,'; - if (proxy.plugin) { - if (proxy.plugin === 'obfs') { - const { mode, host } = proxy['plugin-opts']; - obfs_opts = `,${mode},${host || ''}`; - } else { - throw new Error( - `Platform ${targetPlatform} does not support obfs option: ${proxy.obfs}`, - ); - } - } - return `${proxy.name}=shadowsocks,${proxy.server},${proxy.port},${proxy.cipher},"${proxy.password}"${obfs_opts}${udp_opts}${tfo_opts}`; - case 'ssr': - return `${proxy.name}=shadowsocksr,${proxy.server},${ - proxy.port - },${proxy.cipher},"${proxy.password}",${proxy.protocol},{${ - proxy['protocol-param'] || '' - }},${proxy.obfs},{${ - proxy['obfs-param'] || '' - }}${udp_opts}${tfo_opts}`; - case 'vmess': - obfs_opts = ''; - if (proxy.network === 'ws') { - const host = - proxy['ws-opts'].headers.Host || proxy.server; - obfs_opts = `,transport:ws,host:${host},path:${ - proxy['ws-opts'].path || '/' - }`; - } else { - obfs_opts = `,transport:tcp`; - } - if (proxy.tls) { - obfs_opts += `${ - proxy.sni ? ',tls-name:' + proxy.sni : '' - },skip-cert-verify:${ - proxy['skip-cert-verify'] || 'false' - }`; - } - let result = `${proxy.name}=vmess,${proxy.server},${ - proxy.port - },${proxy.cipher === 'auto' ? 'none' : proxy.cipher},"${ - proxy.uuid - }",over-tls:${proxy.tls || 'false'}${obfs_opts}`; - if (proxy.alterId === 0) proxy['vmess-aead'] = true; - if (typeof proxy['vmess-aead'] !== 'undefined') { - result += `,vmess-aead=${proxy['vmess-aead']}`; - } - return result; - case 'trojan': - return `${proxy.name}=trojan,${proxy.server},${ - proxy.port - },"${proxy.password}"${ - proxy.sni ? ',tls-name:' + proxy.sni : '' - },skip-cert-verify:${ - proxy['skip-cert-verify'] || 'false' - }${udp_opts}`; - case 'http': - tls_opts = ''; - const base = `${proxy.name}=${ - proxy.tls ? 'http' : 'https' - },${proxy.server},${proxy.port},${proxy.username || ''},${ - proxy.password || '' - }`; - if (proxy.tls) { - // https - tls_opts = `${ - proxy.sni ? ',tls-name:' + proxy.sni : '' - },skip-cert-verify:${proxy['skip-cert-verify']}`; - return base + tls_opts; - } else return base; - } - throw new Error( - `Platform ${targetPlatform} does not support proxy type: ${proxy.type}`, - ); - }; - return { produce }; - } - - function Surge_Producer() { - const targetPlatform = 'Surge'; - const produce = (proxy) => { - let result = ''; - let obfs_opts, tls_opts; - switch (proxy.type) { - case 'ss': - obfs_opts = ''; - if (proxy.plugin) { - const { host, mode } = proxy['plugin-opts']; - if (proxy.plugin === 'obfs') { - obfs_opts = `,obfs=${mode}${ - host ? ',obfs-host=' + host : '' - }`; - } else { - throw new Error( - `Platform ${targetPlatform} does not support obfs option: ${proxy.obfs}`, - ); - } - } - result = `${proxy.name}=ss,${proxy.server}, ${ - proxy.port - },encrypt-method=${proxy.cipher},password=${ - proxy.password - }${obfs_opts},tfo=${proxy.tfo || 'false'},udp-relay=${ - proxy.udp || 'false' - }`; - break; - case 'vmess': - tls_opts = ''; - result = `${proxy.name}=vmess,${proxy.server},${ - proxy.port - },username=${proxy.uuid},tls=${proxy.tls || 'false'},tfo=${ - proxy.tfo || 'false' - }`; - - if (proxy.alterId === 0) proxy['vmess-aead'] = true; - if (typeof proxy['vmess-aead'] !== 'undefined') { - result += `,vmess-aead=${proxy['vmess-aead']}`; - } - if (proxy.network === 'ws') { - const path = proxy['ws-opts'].path || '/'; - const wsHeaders = Object.entries( - proxy['ws-opts'].headers, - ) - .map(([key, value]) => `${key}:"${value}"`) - .join('|'); - result += `,ws=true${path ? ',ws-path=' + path : ''}${ - wsHeaders ? ',ws-headers=' + wsHeaders : '' - }`; - } - if (proxy.tls) { - result += `${ - typeof proxy['skip-cert-verify'] !== 'undefined' - ? ',skip-cert-verify=' + - proxy['skip-cert-verify'] - : '' - }`; - result += proxy.sni ? `,sni=${proxy.sni}` : ''; - } - break; - case 'trojan': - result = `${proxy.name}=trojan,${proxy.server},${ - proxy.port - },password=${proxy.password}${ - typeof proxy['skip-cert-verify'] !== 'undefined' - ? ',skip-cert-verify=' + proxy['skip-cert-verify'] - : '' - }${proxy.sni ? ',sni=' + proxy.sni : ''},tfo=${ - proxy.tfo || 'false' - },udp-relay=${proxy.udp || 'false'}`; - break; - case 'http': - if (proxy.tls) { - tls_opts = `,skip-cert-verify=${proxy['skip-cert-verify']},sni=${proxy.sni}`; - } - result = `${proxy.name}=${proxy.tls ? 'https' : 'http'},${ - proxy.server - },${proxy.port}${ - proxy.username ? ',username=' + proxy.username : '' - }${ - proxy.password ? ',password=' + proxy.password : '' - }${tls_opts},tfo=${proxy.tfo || 'false'}`; - break; - default: - throw new Error( - `Platform ${targetPlatform} does not support proxy type: ${proxy.type}`, - ); - } - - // handle surge hybrid param - result += - proxy['surge-hybrid'] !== undefined - ? `,hybrid=${proxy['surge-hybrid']}` - : ''; - return result; - }; - return { produce }; - } - - function Clash_Producer() { - const type = 'ALL'; - const produce = (proxies) => { - return ( - 'proxies:\n' + - proxies - .map((proxy) => { - delete proxy.supported; - return ' - ' + JSON.stringify(proxy) + '\n'; - }) - .join('') - ); - }; - return { type, produce }; - } - - function URI_Producer() { - const type = 'SINGLE'; - const produce = (proxy) => { - let result = ''; - switch (proxy.type) { - case 'ss': - const userinfo = `${proxy.cipher}:${proxy.password}`; - result = `ss://${Base64.encode(userinfo)}@${proxy.server}:${ - proxy.port - }/`; - if (proxy.plugin) { - result += '?plugin='; - const opts = proxy['plugin-opts']; - switch (proxy.plugin) { - case 'obfs': - result += encodeURIComponent( - `simple-obfs;obfs=${opts.mode}${ - opts.host - ? ';obfs-host=' + opts.host - : '' - }`, - ); - break; - case 'v2ray-plugin': - result += encodeURIComponent( - `v2ray-plugin;obfs=${opts.mode}${ - opts.host - ? ';obfs-host' + opts.host - : '' - }${opts.tls ? ';tls' : ''}`, - ); - break; - default: - throw new Error( - `Unsupported plugin option: ${proxy.plugin}`, - ); - } - } - result += `#${encodeURIComponent(proxy.name)}`; - break; - case 'ssr': - result = `${proxy.server}:${proxy.port}:${proxy.protocol}:${ - proxy.cipher - }:${proxy.obfs}:${Base64.encode(proxy.password)}/`; - result += `?remarks=${Base64.encode(proxy.name)}${ - proxy['obfs-param'] - ? '&obfsparam=' + Base64.encode(proxy['obfs-param']) - : '' - }${ - proxy['protocol-param'] - ? '&protocolparam=' + - Base64.encode(proxy['protocol-param']) - : '' - }`; - result = 'ssr://' + Base64.encode(result); - break; - case 'vmess': - // V2RayN URI format - result = { - ps: proxy.name, - add: proxy.server, - port: proxy.port, - id: proxy.uuid, - type: '', - aid: 0, - net: proxy.network || 'tcp', - tls: proxy.tls ? 'tls' : '', - }; - // obfs - if (proxy.network === 'ws') { - result.path = proxy['ws-opts'].path || '/'; - result.host = - proxy['ws-opts'].headers.Host || proxy.server; - } - result = 'vmess://' + Base64.encode(JSON.stringify(result)); - break; - case 'trojan': - result = `trojan://${proxy.password}@${proxy.server}:${ - proxy.port - }#${encodeURIComponent(proxy.name)}`; - break; - default: - throw new Error(`Cannot handle proxy type: ${proxy.type}`); - } - return result; - }; - return { type, produce }; - } - - function JSON_Producer() { - const type = 'ALL'; - const produce = (proxies) => JSON.stringify(proxies, null, 2); - return { type, produce }; - } - - return { - QX: QX_Producer(), - Surge: Surge_Producer(), - Loon: Loon_Producer(), - Clash: Clash_Producer(), - URI: URI_Producer(), - JSON: JSON_Producer(), - }; -})(); - -export const ProxyUtils = (function () { - function preprocess(raw) { - for (const processor of PROXY_PREPROCESSORS) { - try { - if (processor.test(raw)) { - $.info(`Pre-processor [${processor.name}] activated`); - return processor.parse(raw); - } - } catch (e) { - $.error(`Parser [${processor.name}] failed\n Reason: ${e}`); - } - } - return raw; - } - - function safeMatch(p, line) { - let patternMatched; - try { - patternMatched = p.test(line); - } catch (err) { - patternMatched = false; - } - return patternMatched; - } - - function parse(raw) { - raw = preprocess(raw); - // parse - const lines = raw.split('\n'); - const proxies = []; - let lastParser; - - for (let line of lines) { - line = line.trim(); - if (line.length === 0) continue; // skip empty line - let matched = lastParser && safeMatch(lastParser, line); - if (!matched) { - for (const parser of PROXY_PARSERS) { - if (safeMatch(parser, line)) { - lastParser = parser; - matched = true; - $.info(`Proxy parser: ${parser.name} is activated`); - break; - } - } - } - if (!matched) { - $.error(`Failed to find a rule to parse line: \n${line}\n`); - } else { - try { - const proxy = lastParser.parse(line); - if (!proxy) { - $.error( - `Parser ${lastParser.name} return nothing for \n${line}\n`, - ); - } - proxies.push(proxy); - } catch (err) { - $.error( - `Failed to parse line: \n ${line}\n Reason: ${err.stack}`, - ); - } - } - } - - return proxies; - } - - async function process(proxies, operators = [], targetPlatform) { - for (const item of operators) { - // process script - let script; - const $arguments = {}; - if (item.type.indexOf('Script') !== -1) { - const { mode, content } = item.args; - if (mode === 'link') { - const url = content; - // extract link arguments - const rawArgs = url.split('#'); - if (rawArgs.length > 1) { - for (const pair of rawArgs[1].split('&')) { - const key = pair.split('=')[0]; - const value = pair.split('=')[1] || true; - $arguments[key] = value; - } - } - - // if this is a remote script, download it - try { - script = await download(url.split('#')[0]); - $.info(`Script loaded: >>>\n ${script}`); - } catch (err) { - $.error( - `Error when downloading remote script: ${item.args.content}.\n Reason: ${err}`, - ); - // skip the script if download failed. - continue; - } - } else { - script = content; - } - } - - if (!PROXY_PROCESSORS[item.type]) { - $.error(`Unknown operator: "${item.type}"`); - continue; - } - - $.info( - `Applying "${item.type}" with arguments:\n >>> ${ - JSON.stringify(item.args, null, 2) || 'None' - }`, - ); - let processor; - if (item.type.indexOf('Script') !== -1) { - processor = PROXY_PROCESSORS[item.type]( - script, - targetPlatform, - $arguments, - ); - } else { - processor = PROXY_PROCESSORS[item.type](item.args); - } - proxies = await ApplyProcessor(processor, proxies); - } - return proxies; - } - - function produce(proxies, targetPlatform) { - const producer = PROXY_PRODUCERS[targetPlatform]; - if (!producer) { - throw new Error( - `Target platform: ${targetPlatform} is not supported!`, - ); - } - - // filter unsupported proxies - proxies = proxies.filter( - (proxy) => - !(proxy.supported && proxy.supported[targetPlatform] === false), - ); - - $.info(`Producing proxies for target: ${targetPlatform}`); - if ( - typeof producer.type === 'undefined' || - producer.type === 'SINGLE' - ) { - return proxies - .map((proxy) => { - try { - return producer.produce(proxy); - } catch (err) { - $.error( - `Cannot produce proxy: ${JSON.stringify( - proxy, - null, - 2, - )}\nReason: ${err}`, - ); - return ''; - } - }) - .filter((line) => line.length > 0) - .join('\n'); - } else if (producer.type === 'ALL') { - return producer.produce(proxies); - } - } - - return { - parse, - process, - produce, - }; -})(); - -export async function ApplyProcessor(processor, objs) { - async function ApplyFilter(filter, objs) { - // select proxies - let selected = FULL(objs.length, true); - try { - selected = await filter.func(objs); - } catch (err) { - // print log and skip this filter - console.log(`Cannot apply filter ${filter.name}\n Reason: ${err}`); - } - return objs.filter((_, i) => selected[i]); - } - - async function ApplyOperator(operator, objs) { - let output = clone(objs); - try { - const output_ = await operator.func(output); - if (output_) output = output_; - } catch (err) { - // print log and skip this operator - console.log( - `Cannot apply operator ${operator.name}! Reason: ${err}`, - ); - } - return output; - } - - if (processor.name.indexOf('Filter') !== -1) { - return ApplyFilter(processor, objs); - } else if (processor.name.indexOf('Operator') !== -1) { - return ApplyOperator(processor, objs); - } -} - -// shuffle array -function shuffle(array) { - let currentIndex = array.length, - temporaryValue, - randomIndex; - - // While there remain elements to shuffle... - while (0 !== currentIndex) { - // Pick a remaining element... - randomIndex = Math.floor(Math.random() * currentIndex); - currentIndex -= 1; - - // And swap it with the current element. - temporaryValue = array[currentIndex]; - array[currentIndex] = array[randomIndex]; - array[randomIndex] = temporaryValue; - } - - return array; -} - -// deep clone object -function clone(object) { - return JSON.parse(JSON.stringify(object)); -} - -// remove flag -function removeFlag(str) { - return str - .replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/g, '') - .trim(); -} diff --git a/backend/src/core/proxy-utils/index.js b/backend/src/core/proxy-utils/index.js new file mode 100644 index 0000000..64af0eb --- /dev/null +++ b/backend/src/core/proxy-utils/index.js @@ -0,0 +1,176 @@ +import download from '../../utils/download'; + +import PROXY_PROCESSORS, { ApplyProcessor } from './processors'; +import PROXY_PREPROCESSORS from './preprocessors'; +import PROXY_PRODUCERS from './producers'; +import PROXY_PARSERS from './parsers'; +import $ from '../app'; + +function preprocess(raw) { + for (const processor of PROXY_PREPROCESSORS) { + try { + if (processor.test(raw)) { + $.info(`Pre-processor [${processor.name}] activated`); + return processor.parse(raw); + } + } catch (e) { + $.error(`Parser [${processor.name}] failed\n Reason: ${e}`); + } + } + return raw; +} + +function parse(raw) { + raw = preprocess(raw); + // parse + const lines = raw.split('\n'); + const proxies = []; + let lastParser; + + for (let line of lines) { + line = line.trim(); + if (line.length === 0) continue; // skip empty line + let matched = lastParser && safeMatch(lastParser, line); + if (!matched) { + for (const parser of PROXY_PARSERS) { + if (safeMatch(parser, line)) { + lastParser = parser; + matched = true; + $.info(`Proxy parser: ${parser.name} is activated`); + break; + } + } + } + if (!matched) { + $.error(`Failed to find a rule to parse line: \n${line}\n`); + } else { + try { + const proxy = lastParser.parse(line); + if (!proxy) { + $.error( + `Parser ${lastParser.name} return nothing for \n${line}\n`, + ); + } + proxies.push(proxy); + } catch (err) { + $.error( + `Failed to parse line: \n ${line}\n Reason: ${err.stack}`, + ); + } + } + } + + return proxies; +} + +async function process(proxies, operators = [], targetPlatform) { + for (const item of operators) { + // process script + let script; + const $arguments = {}; + if (item.type.indexOf('Script') !== -1) { + const { mode, content } = item.args; + if (mode === 'link') { + const url = content; + // extract link arguments + const rawArgs = url.split('#'); + if (rawArgs.length > 1) { + for (const pair of rawArgs[1].split('&')) { + const key = pair.split('=')[0]; + const value = pair.split('=')[1] || true; + $arguments[key] = value; + } + } + + // if this is a remote script, download it + try { + script = await download(url.split('#')[0]); + $.info(`Script loaded: >>>\n ${script}`); + } catch (err) { + $.error( + `Error when downloading remote script: ${item.args.content}.\n Reason: ${err}`, + ); + // skip the script if download failed. + continue; + } + } else { + script = content; + } + } + + if (!PROXY_PROCESSORS[item.type]) { + $.error(`Unknown operator: "${item.type}"`); + continue; + } + + $.info( + `Applying "${item.type}" with arguments:\n >>> ${ + JSON.stringify(item.args, null, 2) || 'None' + }`, + ); + let processor; + if (item.type.indexOf('Script') !== -1) { + processor = PROXY_PROCESSORS[item.type]( + script, + targetPlatform, + $arguments, + ); + } else { + processor = PROXY_PROCESSORS[item.type](item.args); + } + proxies = await ApplyProcessor(processor, proxies); + } + return proxies; +} + +function produce(proxies, targetPlatform) { + const producer = PROXY_PRODUCERS[targetPlatform]; + if (!producer) { + throw new Error(`Target platform: ${targetPlatform} is not supported!`); + } + + // filter unsupported proxies + proxies = proxies.filter( + (proxy) => + !(proxy.supported && proxy.supported[targetPlatform] === false), + ); + + $.info(`Producing proxies for target: ${targetPlatform}`); + if (typeof producer.type === 'undefined' || producer.type === 'SINGLE') { + return proxies + .map((proxy) => { + try { + return producer.produce(proxy); + } catch (err) { + $.error( + `Cannot produce proxy: ${JSON.stringify( + proxy, + null, + 2, + )}\nReason: ${err}`, + ); + return ''; + } + }) + .filter((line) => line.length > 0) + .join('\n'); + } else if (producer.type === 'ALL') { + return producer.produce(proxies); + } +} + +export const ProxyUtils = { + parse, + process, + produce, +}; + +function safeMatch(p, line) { + let patternMatched; + try { + patternMatched = p.test(line); + } catch (err) { + patternMatched = false; + } + return patternMatched; +} diff --git a/backend/src/core/proxy-utils/parsers.js b/backend/src/core/proxy-utils/parsers.js new file mode 100644 index 0000000..84c7c59 --- /dev/null +++ b/backend/src/core/proxy-utils/parsers.js @@ -0,0 +1,879 @@ +import { Base64 } from 'js-base64'; + +// Parse SS URI format (only supports new SIP002, legacy format is depreciated). +// reference: https://shadowsocks.org/en/spec/SIP002-URI-Scheme.html +function URI_SS() { + const name = 'URI SS Parser'; + const test = (line) => { + return /^ss:\/\//.test(line); + }; + const parse = (line) => { + const supported = {}; + // parse url + let content = line.split('ss://')[1]; + + const proxy = { + name: decodeURIComponent(line.split('#')[1]), + type: 'ss', + supported, + }; + content = content.split('#')[0]; // strip proxy name + // handle IPV4 and IPV6 + const serverAndPort = content.match(/@([^/]*)(\/|$)/)[1]; + const portIdx = serverAndPort.lastIndexOf(':'); + proxy.server = serverAndPort.substring(0, portIdx); + proxy.port = serverAndPort.substring(portIdx + 1); + + const userInfo = Base64.decode(content.split('@')[0]).split(':'); + proxy.cipher = userInfo[0]; + proxy.password = userInfo[1]; + + // handle obfs + const idx = content.indexOf('?plugin='); + if (idx !== -1) { + const pluginInfo = ( + 'plugin=' + + decodeURIComponent(content.split('?plugin=')[1].split('&')[0]) + ).split(';'); + const params = {}; + for (const item of pluginInfo) { + const [key, val] = item.split('='); + if (key) params[key] = val || true; // some options like "tls" will not have value + } + switch (params.plugin) { + case 'obfs-local': + case 'simple-obfs': + proxy.plugin = 'obfs'; + proxy['plugin-opts'] = { + mode: params.obfs, + host: params['obfs-host'], + }; + break; + case 'v2ray-plugin': + proxy.supported = { + ...supported, + Loon: false, + Surge: false, + }; + proxy.obfs = 'v2ray-plugin'; + proxy['plugin-opts'] = { + mode: 'websocket', + host: params['obfs-host'], + path: params.path || '', + tls: params.tls || false, + }; + break; + default: + throw new Error( + `Unsupported plugin option: ${params.plugin}`, + ); + } + } + return proxy; + }; + return { name, test, parse }; +} + +// Parse URI SSR format, such as ssr://xxx +function URI_SSR() { + const name = 'URI SSR Parser'; + const test = (line) => { + return /^ssr:\/\//.test(line); + }; + const supported = { + Surge: false, + }; + + const parse = (line) => { + line = Base64.decode(line.split('ssr://')[1]); + + // handle IPV6 & IPV4 format + let splitIdx = line.indexOf(':origin'); + if (splitIdx === -1) { + splitIdx = line.indexOf(':auth_'); + } + const serverAndPort = line.substring(0, splitIdx); + const server = serverAndPort.substring( + 0, + serverAndPort.lastIndexOf(':'), + ); + const port = serverAndPort.substring( + serverAndPort.lastIndexOf(':') + 1, + ); + + let params = line + .substring(splitIdx + 1) + .split('/?')[0] + .split(':'); + let proxy = { + type: 'ssr', + server, + port, + protocol: params[0], + cipher: params[1], + obfs: params[2], + password: Base64.decode(params[3]), + supported, + }; + // get other params + const other_params = {}; + line = line.split('/?')[1].split('&'); + if (line.length > 1) { + for (const item of line) { + const [key, val] = item.split('='); + other_params[key] = val.trim(); + } + } + proxy = { + ...proxy, + name: other_params.remarks + ? Base64.decode(other_params.remarks) + : proxy.server, + 'protocol-param': Base64.decode( + other_params.protoparam || '', + ).replace(/\s/g, ''), + 'obfs-param': Base64.decode(other_params.obfsparam || '').replace( + /\s/g, + '', + ), + }; + return proxy; + }; + + return { name, test, parse }; +} + +// V2rayN URI VMess format +// reference: https://github.com/2dust/v2rayN/wiki/%E5%88%86%E4%BA%AB%E9%93%BE%E6%8E%A5%E6%A0%BC%E5%BC%8F%E8%AF%B4%E6%98%8E(ver-2) + +// Quantumult VMess format +function URI_VMess() { + const name = 'URI VMess Parser'; + const test = (line) => { + return /^vmess:\/\//.test(line); + }; + const parse = (line) => { + const supported = {}; + line = line.split('vmess://')[1]; + const content = Base64.decode(line); + if (/=\s*vmess/.test(content)) { + // Quantumult VMess URI format + const partitions = content.split(',').map((p) => p.trim()); + // get keyword params + const params = {}; + for (const part of partitions) { + if (part.indexOf('=') !== -1) { + const [key, val] = part.split('='); + params[key.trim()] = val.trim(); + } + } + + const proxy = { + name: partitions[0].split('=')[0].trim(), + type: 'vmess', + server: partitions[1], + port: partitions[2], + cipher: partitions[3], + uuid: partitions[4].match(/^"(.*)"$/)[1], + tls: params.obfs === 'over-tls' || params.obfs === 'wss', + }; + + if (typeof params['udp-relay'] !== 'undefined') + proxy.udp = JSON.parse(params['udp-relay']); + if (typeof params['fast-open'] !== 'undefined') + proxy.udp = JSON.parse(params['fast-open']); + + // handle ws headers + if (params.obfs === 'ws' || params.obfs === 'wss') { + proxy.network = 'ws'; + proxy['ws-opts'].path = (params['obfs-path'] || '"/"').match( + /^"(.*)"$/, + )[1]; + let obfs_host = params['obfs-header']; + if (obfs_host && obfs_host.indexOf('Host') !== -1) { + obfs_host = obfs_host.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]; + } + proxy['ws-opts'].headers = { + Host: obfs_host || proxy.server, // if no host provided, use the same as server + }; + } + + // handle scert + if (proxy.tls && params['"tls-verification"'] === 'false') { + proxy['skip-cert-verify'] = true; + } + + // handle sni + if (proxy.tls && params['obfs-host']) { + proxy.sni = params['obfs-host']; + } + + return proxy; + } else { + // V2rayN URI format + const params = JSON.parse(content); + const proxy = { + name: params.ps, + type: 'vmess', + server: params.add, + port: params.port, + cipher: 'auto', // V2rayN has no default cipher! use aes-128-gcm as default. + uuid: params.id, + alterId: params.aid || 0, + tls: params.tls === 'tls' || params.tls === true, + supported, + }; + // handle obfs + if (params.net === 'ws') { + proxy.network = 'ws'; + proxy['ws-opts'] = { + path: params.path, + headers: { Host: params.host || params.add }, + }; + if (proxy.tls && params.host) { + proxy.sni = params.host; + } + } + // handle scert + if (params.verify_cert === false) { + proxy['skip-cert-verify'] = true; + } + return proxy; + } + }; + return { name, test, parse }; +} + +// Trojan URI format +function URI_Trojan() { + const name = 'URI Trojan Parser'; + const test = (line) => { + return /^trojan:\/\//.test(line); + }; + + const parse = (line) => { + const supported = {}; + line = line.split('trojan://')[1]; + const [server, port] = line.split('@')[1].split('?')[0].split(':'); + const name = decodeURIComponent(line.split('#')[1].trim()); + let paramArr = line.split('?'); + let sni = null; + if (paramArr.length > 1) { + paramArr = paramArr[1].split('#')[0].split('&'); + const params = new Map( + paramArr.map((item) => { + return item.split('='); + }), + ); + sni = params.get('sni'); + } + + return { + name: name || `[Trojan] ${server}`, // trojan uri may have no server tag! + type: 'trojan', + server, + port, + password: line.split('@')[0], + sni, + supported, + }; + }; + return { name, test, parse }; +} + +function Clash_All() { + const name = 'Clash Parser'; + const test = (line) => { + try { + JSON.parse(line); + } catch (e) { + return false; + } + return true; + }; + const parse = (line) => JSON.parse(line); + return { name, test, parse }; +} + +function QX_SS() { + const name = 'QX SS Parser'; + const test = (line) => { + return ( + /^shadowsocks\s*=/.test(line.split(',')[0].trim()) && + line.indexOf('ssr-protocol') === -1 + ); + }; + const parse = (line) => { + const supported = {}; + const params = getQXParams(line); + const proxy = { + name: params.tag, + type: 'ss', + server: params.server, + port: params.port, + cipher: params.method, + password: params.password, + udp: JSON.parse(params['udp-relay'] || 'false'), + tfo: JSON.parse(params['fast-open'] || 'false'), + supported, + }; + // handle obfs options + if (params.obfs) { + proxy['plugin-opts'] = { + host: params['obfs-host'] || proxy.server, + }; + switch (params.obfs) { + case 'http': + case 'tls': + proxy.plugin = 'obfs'; + proxy['plugin-opts'].mode = params.obfs; + break; + case 'ws': + case 'wss': + proxy['plugin-opts'] = { + ...proxy['plugin-opts'], + mode: 'websocket', + path: params['obfs-uri'] || '/', + tls: params.obfs === 'wss', + }; + if ( + proxy['plugin-opts'].tls && + typeof params['tls-verification'] !== 'undefined' + ) { + proxy['plugin-opts']['skip-cert-verify'] = + params['tls-verification']; + } + proxy.plugin = 'v2ray-plugin'; + // Surge and Loon lack support for v2ray-plugin obfs + proxy.supported.Surge = false; + proxy.supported.Loon = false; + break; + } + } + return proxy; + }; + return { name, test, parse }; +} + +function QX_SSR() { + const name = 'QX SSR Parser'; + const test = (line) => { + return ( + /^shadowsocks\s*=/.test(line.split(',')[0].trim()) && + line.indexOf('ssr-protocol') !== -1 + ); + }; + + const parse = (line) => { + const supported = { + Surge: false, + }; + const params = getQXParams(line); + const proxy = { + name: params.tag, + type: 'ssr', + server: params.server, + port: params.port, + cipher: params.method, + password: params.password, + protocol: params['ssr-protocol'], + obfs: 'plain', // default obfs + 'protocol-param': params['ssr-protocol-param'], + udp: JSON.parse(params['udp-relay'] || 'false'), + tfo: JSON.parse(params['fast-open'] || 'false'), + supported, + }; + // handle obfs options + if (params.obfs) { + proxy.obfs = params.obfs; + proxy['obfs-param'] = params['obfs-host']; + } + return proxy; + }; + return { name, test, parse }; +} + +function QX_VMess() { + const name = 'QX VMess Parser'; + const test = (line) => { + return /^vmess\s*=/.test(line.split(',')[0].trim()); + }; + const parse = (line) => { + const params = getQXParams(line); + const proxy = { + type: 'vmess', + name: params.tag, + server: params.server, + port: params.port, + cipher: params.method || 'none', + uuid: params.password, + alterId: 0, + tls: params.obfs === 'over-tls' || params.obfs === 'wss', + udp: JSON.parse(params['udp-relay'] || 'false'), + tfo: JSON.parse(params['fast-open'] || 'false'), + }; + if (proxy.tls) { + proxy.sni = params['obfs-host'] || params.server; + proxy['skip-cert-verify'] = !JSON.parse( + params['tls-verification'] || 'true', + ); + } + // handle ws headers + if (params.obfs === 'ws' || params.obfs === 'wss') { + proxy.network = 'ws'; + proxy['ws-opts'] = { + path: params['obfs-uri'], + headers: { + Host: params['obfs-host'] || params.server, // if no host provided, use the same as server + }, + }; + } + return proxy; + }; + + return { name, test, parse }; +} + +function QX_Trojan() { + const name = 'QX Trojan Parser'; + const test = (line) => { + return /^trojan\s*=/.test(line.split(',')[0].trim()); + }; + const parse = (line) => { + const params = getQXParams(line); + const proxy = { + type: 'trojan', + name: params.tag, + server: params.server, + port: params.port, + password: params.password, + sni: params['tls-host'] || params.server, + udp: JSON.parse(params['udp-relay'] || 'false'), + tfo: JSON.parse(params['fast-open'] || 'false'), + }; + proxy['skip-cert-verify'] = !JSON.parse( + params['tls-verification'] || 'true', + ); + return proxy; + }; + return { name, test, parse }; +} + +function QX_Http() { + const name = 'QX HTTP Parser'; + const test = (line) => { + return /^http\s*=/.test(line.split(',')[0].trim()); + }; + const parse = (line) => { + const params = getQXParams(line); + const proxy = { + type: 'http', + name: params.tag, + server: params.server, + port: params.port, + tls: JSON.parse(params['over-tls'] || 'false'), + udp: JSON.parse(params['udp-relay'] || 'false'), + tfo: JSON.parse(params['fast-open'] || 'false'), + }; + if (params.username && params.username !== 'none') + proxy.username = params.username; + if (params.password && params.password !== 'none') + proxy.password = params.password; + if (proxy.tls) { + proxy.sni = params['tls-host'] || proxy.server; + proxy['skip-cert-verify'] = !JSON.parse( + params['tls-verification'] || 'true', + ); + } + return proxy; + }; + + return { name, test, parse }; +} + +function getQXParams(line) { + const groups = line.split(','); + const params = {}; + const protocols = ['shadowsocks', 'vmess', 'http', 'trojan']; + groups.forEach((g) => { + let [key, value] = g.split('='); + key = key.trim(); + value = value.trim(); + if (protocols.indexOf(key) !== -1) { + params.type = key; + const conf = value.split(':'); + params.server = conf[0]; + params.port = conf[1]; + } else { + params[key.trim()] = value.trim(); + } + }); + return params; +} + +function Loon_SS() { + const name = 'Loon SS Parser'; + const test = (line) => { + return ( + line.split(',')[0].split('=')[1].trim().toLowerCase() === + 'shadowsocks' + ); + }; + const parse = (line) => { + const params = line.split('=')[1].split(','); + const proxy = { + name: line.split('=')[0].trim(), + type: 'ss', + server: params[1], + port: params[2], + cipher: params[3], + password: params[4].replace(/"/g, ''), + }; + // handle obfs + if (params.length > 5) { + proxy.plugin = 'obfs'; + proxy['plugin-opts'] = { + mode: params[5], + host: params[6], + }; + } + return proxy; + }; + return { name, test, parse }; +} + +function Loon_SSR() { + const name = 'Loon SSR Parser'; + const test = (line) => { + return ( + line.split(',')[0].split('=')[1].trim().toLowerCase() === + 'shadowsocksr' + ); + }; + const parse = (line) => { + const params = line.split('=')[1].split(','); + const supported = { + Surge: false, + }; + return { + name: line.split('=')[0].trim(), + type: 'ssr', + server: params[1], + port: params[2], + cipher: params[3], + password: params[4].replace(/"/g, ''), + protocol: params[5], + 'protocol-param': params[6].match(/{(.*)}/)[1], + supported, + obfs: params[7], + 'obfs-param': params[8].match(/{(.*)}/)[1], + }; + }; + return { name, test, parse }; +} + +function Loon_VMess() { + const name = 'Loon VMess Parser'; + const test = (line) => { + // distinguish between surge vmess + return ( + /^.*=\s*vmess/i.test(line.split(',')[0]) && + line.indexOf('username') === -1 + ); + }; + const parse = (line) => { + let params = line.split('=')[1].split(','); + const proxy = { + name: line.split('=')[0].trim(), + type: 'vmess', + server: params[1], + port: params[2], + cipher: params[3] || 'none', + uuid: params[4].replace(/"/g, ''), + alterId: 0, + }; + // get transport options + params = params.splice(5); + for (const item of params) { + const [key, val] = item.split(':'); + params[key] = val; + } + proxy.tls = JSON.parse(params['over-tls'] || 'false'); + if (proxy.tls) { + proxy.sni = params['tls-name'] || proxy.server; + proxy['skip-cert-verify'] = JSON.parse( + params['skip-cert-verify'] || 'false', + ); + } + switch (params.transport) { + case 'tcp': + break; + case 'ws': + proxy.network = params.transport; + proxy['ws-opts'] = { + path: params.path, + headers: { + Host: params.host, + }, + }; + } + if (proxy.tls) { + proxy['skip-cert-verify'] = JSON.parse( + params['skip-cert-verify'] || 'false', + ); + } + return proxy; + }; + return { name, test, parse }; +} + +function Loon_Trojan() { + const name = 'Loon Trojan Parser'; + const test = (line) => { + return ( + /^.*=\s*trojan/i.test(line.split(',')[0]) && + line.indexOf('password') === -1 + ); + }; + + const parse = (line) => { + const params = line.split('=')[1].split(','); + const proxy = { + name: line.split('=')[0].trim(), + type: 'trojan', + server: params[1], + port: params[2], + password: params[3].replace(/"/g, ''), + sni: params[1], // default sni is the server itself + 'skip-cert-verify': JSON.parse( + params['skip-cert-verify'] || 'false', + ), + }; + // trojan sni + if (params.length > 4) { + const [key, val] = params[4].split(':'); + if (key === 'tls-name') proxy.sni = val; + else throw new Error(`Unknown option ${key} for line: \n${line}`); + } + return proxy; + }; + + return { name, test, parse }; +} + +function Loon_Http() { + const name = 'Loon HTTP Parser'; + const test = (line) => { + return ( + /^.*=\s*http/i.test(line.split(',')[0]) && + line.split(',').length === 5 && + line.indexOf('username') === -1 && + line.indexOf('password') === -1 + ); + }; + + const parse = (line) => { + const params = line.split('=')[1].split(','); + const proxy = { + name: line.split('=')[0].trim(), + type: 'http', + server: params[1], + port: params[2], + tls: params[2] === '443', // port 443 is considered as https type + }; + if (params[3]) proxy.username = params[3]; + if (params[4]) proxy.password = params[4]; + + if (proxy.tls) { + proxy.sni = params['tls-name'] || proxy.server; + proxy['skip-cert-verify'] = JSON.parse( + params['skip-cert-verify'] || 'false', + ); + } + + return proxy; + }; + return { name, test, parse }; +} + +function Surge_SS() { + const name = 'Surge SS Parser'; + const test = (line) => { + return /^.*=\s*ss/.test(line.split(',')[0]); + }; + const parse = (line) => { + const params = getSurgeParams(line); + const proxy = { + name: params.name, + type: 'ss', + server: params.server, + port: params.port, + cipher: params['encrypt-method'], + password: params.password, + tfo: JSON.parse(params.tfo || 'false'), + udp: JSON.parse(params['udp-relay'] || 'false'), + }; + // handle obfs + if (params.obfs) { + proxy.plugin = 'obfs'; + proxy['plugin-opts'] = { + mode: params.obfs, + host: params['obfs-host'], + }; + } + return proxy; + }; + return { name, test, parse }; +} + +function Surge_VMess() { + const name = 'Surge VMess Parser'; + const test = (line) => { + return ( + /^.*=\s*vmess/.test(line.split(',')[0]) && + line.indexOf('username') !== -1 + ); + }; + const parse = (line) => { + const params = getSurgeParams(line); + const proxy = { + name: params.name, + type: 'vmess', + server: params.server, + port: params.port, + uuid: params.username, + alterId: 0, // surge does not have this field + cipher: 'none', // surge does not have this field + tls: JSON.parse(params.tls || 'false'), + tfo: JSON.parse(params.tfo || 'false'), + }; + if (proxy.tls) { + if (typeof params['skip-cert-verify'] !== 'undefined') { + proxy['skip-cert-verify'] = + params['skip-cert-verify'] === true || + params['skip-cert-verify'] === '1'; + } + proxy.sni = params['sni'] || params.server; + } + // use websocket + if (JSON.parse(params.ws || 'false')) { + proxy.network = 'ws'; + proxy['ws-opts'] = { + path: params['ws-path'], + }; + + const res = params['ws-headers'].match( + /(,|^|\s)*HOST:\s*(.*?)(,|$)/, + ); + const host = res ? res[2] : proxy.server; + proxy['ws-opts'].headers = { + Host: host || params.server, + }; + } + return proxy; + }; + return { name, test, parse }; +} + +function Surge_Trojan() { + const name = 'Surge Trojan Parser'; + const test = (line) => { + return ( + /^.*=\s*trojan/.test(line.split(',')[0]) && + line.indexOf('sni') !== -1 + ); + }; + const parse = (line) => { + const params = getSurgeParams(line); + const proxy = { + name: params.name, + type: 'trojan', + server: params.server, + port: params.port, + password: params.password, + sni: params.sni || params.server, + tfo: JSON.parse(params.tfo || 'false'), + }; + if (typeof params['skip-cert-verify'] !== 'undefined') { + proxy['skip-cert-verify'] = + params['skip-cert-verify'] === true || + params['skip-cert-verify'] === '1'; + } + return proxy; + }; + + return { name, test, parse }; +} + +function Surge_Http() { + const name = 'Surge HTTP Parser'; + const test = (line) => { + return ( + /^.*=\s*https?/.test(line.split(',')[0]) && !Loon_Http().test(line) + ); + }; + const parse = (line) => { + const params = getSurgeParams(line); + const tls = /^.*?=\s?https/.test(line); + const proxy = { + name: params.name, + type: 'http', + server: params.server, + port: params.port, + tls: JSON.parse(tls || 'false'), + tfo: JSON.parse(params.tfo || 'false'), + }; + if (proxy.tls) { + if (typeof params['skip-cert-verify'] !== 'undefined') { + proxy['skip-cert-verify'] = + params['skip-cert-verify'] === true || + params['skip-cert-verify'] === '1'; + } + proxy.sni = params.sni || params.server; + } + if (params.username && params.username !== 'none') + proxy.username = params.username; + if (params.password && params.password !== 'none') + proxy.password = params.password; + return proxy; + }; + return { name, test, parse }; +} + +function getSurgeParams(line) { + const params = {}; + params.name = line.split('=')[0].trim(); + const segments = line.split(','); + params.server = segments[1].trim(); + params.port = segments[2].trim(); + for (let i = 3; i < segments.length; i++) { + const item = segments[i]; + if (item.indexOf('=') !== -1) { + const [key, value] = item.split('='); + params[key.trim()] = value.trim(); + } + } + return params; +} + +export default [ + URI_SS(), + URI_SSR(), + URI_VMess(), + URI_Trojan(), + Clash_All(), + Surge_SS(), + Surge_VMess(), + Surge_Trojan(), + Surge_Http(), + Loon_SS(), + Loon_SSR(), + Loon_VMess(), + Loon_Trojan(), + Loon_Http(), + QX_SS(), + QX_SSR(), + QX_VMess(), + QX_Trojan(), + QX_Http(), +]; diff --git a/backend/src/core/proxy-utils/preprocessors.js b/backend/src/core/proxy-utils/preprocessors.js new file mode 100644 index 0000000..ce9677a --- /dev/null +++ b/backend/src/core/proxy-utils/preprocessors.js @@ -0,0 +1,92 @@ +import { safeLoad } from 'static-js-yaml'; +import { Base64 } from 'js-base64'; + +function HTML() { + const name = 'HTML'; + const test = (raw) => /^/.test(raw); + // simply discard HTML + const parse = () => ''; + return { name, test, parse }; +} + +function Base64Encoded() { + const name = 'Base64 Pre-processor'; + + const keys = [ + 'dm1lc3M', + 'c3NyOi8v', + 'dHJvamFu', + 'c3M6Ly', + 'c3NkOi8v', + 'c2hhZG93', + 'aHR0c', + ]; + + const test = function (raw) { + return keys.some((k) => raw.indexOf(k) !== -1); + }; + const parse = function (raw) { + raw = Base64.decode(raw); + return raw; + }; + return { name, test, parse }; +} + +function Clash() { + const name = 'Clash Pre-processor'; + const test = function (raw) { + return /proxies/.test(raw); + }; + const parse = function (raw) { + // Clash YAML format + const proxies = safeLoad(raw).proxies; + return proxies.map((p) => JSON.stringify(p)).join('\n'); + }; + return { name, test, parse }; +} + +function SSD() { + const name = 'SSD Pre-processor'; + const test = function (raw) { + return raw.indexOf('ssd://') === 0; + }; + const parse = function (raw) { + // preprocessing for SSD subscription format + const output = []; + let ssdinfo = JSON.parse(Base64.decode(raw.split('ssd://')[1])); + let port = ssdinfo.port; + let method = ssdinfo.encryption; + let password = ssdinfo.password; + // servers config + let servers = ssdinfo.servers; + for (let i = 0; i < servers.length; i++) { + let server = servers[i]; + method = server.encryption ? server.encryption : method; + password = server.password ? server.password : password; + let userinfo = Base64.encode(method + ':' + password); + let hostname = server.server; + port = server.port ? server.port : port; + let tag = server.remarks ? server.remarks : i; + let plugin = server.plugin_options + ? '/?plugin=' + + encodeURIComponent( + server.plugin + ';' + server.plugin_options, + ) + : ''; + output[i] = + 'ss://' + + userinfo + + '@' + + hostname + + ':' + + port + + plugin + + '#' + + tag; + } + return output.join('\n'); + }; + return { name, test, parse }; +} + +export default [HTML(), Base64Encoded(), Clash(), SSD()]; diff --git a/backend/src/core/proxy-utils/processors.js b/backend/src/core/proxy-utils/processors.js new file mode 100644 index 0000000..484a060 --- /dev/null +++ b/backend/src/core/proxy-utils/processors.js @@ -0,0 +1,415 @@ +import { HTTP } from '../../vendor/open-api'; +import { FULL } from '../../utils/logical'; +import { getFlag } from '../../utils/geo'; +import lodash from 'lodash'; + +// force to set some properties (e.g., skip-cert-verify, udp, tfo, etc.) +function SetPropertyOperator({ key, value }) { + return { + name: 'Set Property Operator', + func: (proxies) => { + return proxies.map((p) => { + p[key] = value; + return p; + }); + }, + }; +} + +// add or remove flag for proxies +function FlagOperator(add = true) { + return { + name: 'Flag Operator', + func: (proxies) => { + return proxies.map((proxy) => { + if (!add) { + // no flag + proxy.name = removeFlag(proxy.name); + } else { + // get flag + const newFlag = getFlag(proxy.name); + // remove old flag + proxy.name = removeFlag(proxy.name); + proxy.name = newFlag + ' ' + proxy.name; + proxy.name = proxy.name.replace(/🇹🇼/g, '🇨🇳'); + } + return proxy; + }); + }, + }; +} + +// duplicate handler +function HandleDuplicateOperator(arg) { + const { action, template, link, position } = { + ...{ + action: 'rename', + template: '0 1 2 3 4 5 6 7 8 9', + link: '-', + position: 'back', + }, + ...arg, + }; + return { + name: 'Handle Duplicate Operator', + func: (proxies) => { + if (action === 'delete') { + const chosen = {}; + return proxies.filter((p) => { + if (chosen[p.name]) { + return false; + } + chosen[p.name] = true; + return true; + }); + } else if (action === 'rename') { + const numbers = template.split(' '); + // count occurrences of each name + const counter = {}; + let maxLen = 0; + proxies.forEach((p) => { + if (typeof counter[p.name] === 'undefined') + counter[p.name] = 1; + else counter[p.name]++; + maxLen = Math.max( + counter[p.name].toString().length, + maxLen, + ); + }); + const increment = {}; + return proxies.map((p) => { + if (counter[p.name] > 1) { + if (typeof increment[p.name] == 'undefined') + increment[p.name] = 1; + let num = ''; + let cnt = increment[p.name]++; + let numDigits = 0; + while (cnt > 0) { + num = numbers[cnt % 10] + num; + cnt = parseInt(cnt / 10); + numDigits++; + } + // padding + while (numDigits++ < maxLen) { + num = numbers[0] + num; + } + if (position === 'front') { + p.name = num + link + p.name; + } else if (position === 'back') { + p.name = p.name + link + num; + } + } + return p; + }); + } + }, + }; +} + +// sort proxies according to their names +function SortOperator(order = 'asc') { + return { + name: 'Sort Operator', + func: (proxies) => { + switch (order) { + case 'asc': + case 'desc': + return proxies.sort((a, b) => { + let res = a.name > b.name ? 1 : -1; + res *= order === 'desc' ? -1 : 1; + return res; + }); + case 'random': + return shuffle(proxies); + default: + throw new Error('Unknown sort option: ' + order); + } + }, + }; +} + +// sort by regex +function RegexSortOperator(expressions) { + return { + name: 'Regex Sort Operator', + func: (proxies) => { + expressions = expressions.map((expr) => buildRegex(expr)); + return proxies.sort((a, b) => { + const oA = getRegexOrder(expressions, a.name); + const oB = getRegexOrder(expressions, b.name); + if (oA && !oB) return -1; + if (oB && !oA) return 1; + if (oA && oB) return oA < oB ? -1 : 1; + if ((!oA && !oB) || (oA && oB && oA === oB)) + return a.name < b.name ? -1 : 1; // fallback to normal sort + }); + }, + }; +} + +function getRegexOrder(expressions, str) { + let order = null; + for (let i = 0; i < expressions.length; i++) { + if (expressions[i].test(str)) { + order = i + 1; // plus 1 is important! 0 will be treated as false!!! + break; + } + } + return order; +} + +// rename by regex +// keywords: [{expr: "string format regex", now: "now"}] +function RegexRenameOperator(regex) { + return { + name: 'Regex Rename Operator', + func: (proxies) => { + return proxies.map((proxy) => { + for (const { expr, now } of regex) { + proxy.name = proxy.name + .replace(buildRegex(expr, 'g'), now) + .trim(); + } + return proxy; + }); + }, + }; +} + +// delete regex operator +// regex: ['a', 'b', 'c'] +function RegexDeleteOperator(regex) { + const regex_ = regex.map((r) => { + return { + expr: r, + now: '', + }; + }); + return { + name: 'Regex Delete Operator', + func: RegexRenameOperator(regex_).func, + }; +} + +/** Script Operator + function operator(proxies) { + const {arg1} = $arguments; + + // do something + return proxies; + } + + WARNING: + 1. This function name should be `operator`! + 2. Always declare variables before using them! + */ +function ScriptOperator(script, targetPlatform, $arguments) { + return { + name: 'Script Operator', + func: async (proxies) => { + let output = proxies; + await (async function () { + const operator = new Function( + '$arguments', + 'HTTP', + 'lodash', + `${script}\n return operator`, + )($arguments, HTTP, lodash); + output = operator(proxies, targetPlatform); + })(); + return output; + }, + }; +} + +/**************************** Filters ***************************************/ +// filter useless proxies +function UselessFilter() { + const KEYWORDS = [ + '网址', + '流量', + '时间', + '应急', + '过期', + 'Bandwidth', + 'expire', + ]; + return { + name: 'Useless Filter', + func: RegexFilter({ + regex: KEYWORDS, + keep: false, + }).func, + }; +} + +// filter by regions +function RegionFilter(regions) { + const REGION_MAP = { + HK: '🇭🇰', + TW: '🇹🇼', + US: '🇺🇸', + SG: '🇸🇬', + JP: '🇯🇵', + UK: '🇬🇧', + }; + return { + name: 'Region Filter', + func: (proxies) => { + // this would be high memory usage + return proxies.map((proxy) => { + const flag = getFlag(proxy.name); + return regions.some((r) => REGION_MAP[r] === flag); + }); + }, + }; +} + +// filter by regex +function RegexFilter({ regex = [], keep = true }) { + return { + name: 'Regex Filter', + func: (proxies) => { + return proxies.map((proxy) => { + const selected = regex.some((r) => { + return buildRegex(r).test(proxy.name); + }); + return keep ? selected : !selected; + }); + }, + }; +} + +function buildRegex(str, ...options) { + options = options.join(''); + if (str.startsWith('(?i)')) { + str = str.substr(4); + return new RegExp(str, 'i' + options); + } else { + return new RegExp(str, options); + } +} + +// filter by proxy types +function TypeFilter(types) { + return { + name: 'Type Filter', + func: (proxies) => { + return proxies.map((proxy) => types.some((t) => proxy.type === t)); + }, + }; +} + +/** + Script Example + + function filter(proxies) { + return proxies.map(p => { + return p.name.indexOf("🇭🇰") !== -1; + }); + } + + WARNING: + 1. This function name should be `filter`! + 2. Always declare variables before using them! + */ +function ScriptFilter(script, targetPlatform, $arguments) { + return { + name: 'Script Filter', + func: async (proxies) => { + let output = FULL(proxies.length, true); + await (async function () { + const filter = new Function( + '$arguments', + 'HTTP', + 'lodash', + `${script}\n return filter`, + )($arguments, HTTP, lodash); + output = filter(proxies, targetPlatform); + })(); + return output; + }, + }; +} + +export default { + 'Useless Filter': UselessFilter, + 'Region Filter': RegionFilter, + 'Regex Filter': RegexFilter, + 'Type Filter': TypeFilter, + 'Script Filter': ScriptFilter, + + 'Set Property Operator': SetPropertyOperator, + 'Flag Operator': FlagOperator, + 'Sort Operator': SortOperator, + 'Regex Sort Operator': RegexSortOperator, + 'Regex Rename Operator': RegexRenameOperator, + 'Regex Delete Operator': RegexDeleteOperator, + 'Script Operator': ScriptOperator, + 'Handle Duplicate Operator': HandleDuplicateOperator, +}; + +async function ApplyFilter(filter, objs) { + // select proxies + let selected = FULL(objs.length, true); + try { + selected = await filter.func(objs); + } catch (err) { + // print log and skip this filter + console.log(`Cannot apply filter ${filter.name}\n Reason: ${err}`); + } + return objs.filter((_, i) => selected[i]); +} + +async function ApplyOperator(operator, objs) { + let output = clone(objs); + try { + const output_ = await operator.func(output); + if (output_) output = output_; + } catch (err) { + // print log and skip this operator + console.log(`Cannot apply operator ${operator.name}! Reason: ${err}`); + } + return output; +} + +export async function ApplyProcessor(processor, objs) { + if (processor.name.indexOf('Filter') !== -1) { + return ApplyFilter(processor, objs); + } else if (processor.name.indexOf('Operator') !== -1) { + return ApplyOperator(processor, objs); + } +} + +// shuffle array +function shuffle(array) { + let currentIndex = array.length, + temporaryValue, + randomIndex; + + // While there remain elements to shuffle... + while (0 !== currentIndex) { + // Pick a remaining element... + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex -= 1; + + // And swap it with the current element. + temporaryValue = array[currentIndex]; + array[currentIndex] = array[randomIndex]; + array[randomIndex] = temporaryValue; + } + + return array; +} + +// deep clone object +function clone(object) { + return JSON.parse(JSON.stringify(object)); +} + +// remove flag +function removeFlag(str) { + return str + .replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/g, '') + .trim(); +} diff --git a/backend/src/core/proxy-utils/producers.js b/backend/src/core/proxy-utils/producers.js new file mode 100644 index 0000000..832262d --- /dev/null +++ b/backend/src/core/proxy-utils/producers.js @@ -0,0 +1,422 @@ +/* eslint-disable no-case-declarations */ +import { Base64 } from 'js-base64'; + +function QX_Producer() { + const targetPlatform = 'QX'; + const produce = (proxy) => { + let obfs_opts; + let tls_opts; + switch (proxy.type) { + case 'ss': + obfs_opts = ''; + if (proxy.plugin === 'obfs') { + const { host, mode } = proxy['plugin-opts']; + obfs_opts = `,obfs=${mode}${ + host ? ',obfs-host=' + host : '' + }`; + } + if (proxy.plugin === 'v2ray-plugin') { + const { tls, host, path } = proxy['plugin-opts']; + obfs_opts = `,obfs=${tls ? 'wss' : 'ws'}${ + host ? ',obfs-host=' + host : '' + }${path ? ',obfs-uri=' + path : ''}`; + } + return `shadowsocks=${proxy.server}:${proxy.port},method=${ + proxy.cipher + },password=${proxy.password}${obfs_opts}${ + proxy.tfo ? ',fast-open=true' : ',fast-open=false' + }${proxy.udp ? ',udp-relay=true' : ',udp-relay=false'},tag=${ + proxy.name + }`; + case 'ssr': + return `shadowsocks=${proxy.server}:${proxy.port},method=${ + proxy.cipher + },password=${proxy.password},ssr-protocol=${proxy.protocol}${ + proxy['protocol-param'] + ? ',ssr-protocol-param=' + proxy['protocol-param'] + : '' + }${proxy.obfs ? ',obfs=' + proxy.obfs : ''}${ + proxy['obfs-param'] + ? ',obfs-host=' + proxy['obfs-param'] + : '' + },fast-open=${proxy.tfo || false}${ + proxy.udp ? ',udp-relay=true' : ',udp-relay=false' + },tag=${proxy.name}`; + case 'vmess': + obfs_opts = ''; + if (proxy.network === 'ws') { + // websocket + if (proxy.tls) { + // ws-tls + obfs_opts = `,obfs=wss${ + proxy.sni ? ',obfs-host=' + proxy.sni : '' + }${ + proxy['ws-opts'].path + ? ',obfs-uri=' + proxy['ws-opts'].path + : '' + },tls-verification=${ + proxy['skip-cert-verify'] ? 'false' : 'true' + }`; + } else { + // ws + obfs_opts = `,obfs=ws${ + proxy['ws-opts'].headers.Host + ? ',obfs-host=' + proxy['ws-opts'].headers.Host + : '' + }${ + proxy['ws-opts'].path + ? ',obfs-uri=' + proxy['ws-opts'].path + : '' + }`; + } + } else { + // tcp + if (proxy.tls) { + obfs_opts = `,obfs=over-tls${ + proxy.sni ? ',obfs-host=' + proxy.sni : '' + },tls-verification=${ + proxy['skip-cert-verify'] ? 'false' : 'true' + }`; + } + } + let result = `vmess=${proxy.server}:${proxy.port},method=${ + proxy.cipher === 'auto' ? 'none' : proxy.cipher + },password=${proxy.uuid}${obfs_opts},fast-open=${ + proxy.tfo || false + }${proxy.udp ? ',udp-relay=true' : ',udp-relay=false'}`; + if (proxy.alterId === 0) proxy['vmess-aead'] = true; + if (typeof proxy['vmess-aead'] !== 'undefined') { + result += `,aead=${proxy['vmess-aead']}`; + } + result += `,tag=${proxy.name}`; + return result; + case 'trojan': + return `trojan=${proxy.server}:${proxy.port},password=${ + proxy.password + }${ + proxy.sni ? ',tls-host=' + proxy.sni : '' + },over-tls=true,tls-verification=${ + proxy['skip-cert-verify'] ? 'false' : 'true' + },fast-open=${proxy.tfo || false}${ + proxy.udp ? ',udp-relay=true' : ',udp-relay=false' + },tag=${proxy.name}`; + case 'http': + tls_opts = ''; + if (proxy.tls) { + tls_opts = `,over-tls=true,tls-verification=${ + proxy['skip-cert-verify'] ? 'false' : 'true' + }${proxy.sni ? ',tls-host=' + proxy.sni : ''}`; + } + return `http=${proxy.server}:${proxy.port},username=${ + proxy.username + },password=${proxy.password}${tls_opts},fast-open=${ + proxy.tfo || false + },tag=${proxy.name}`; + } + throw new Error( + `Platform ${targetPlatform} does not support proxy type: ${proxy.type}`, + ); + }; + return { produce }; +} + +function Loon_Producer() { + const targetPlatform = 'Loon'; + const produce = (proxy) => { + let obfs_opts = '', + tls_opts = '', + udp_opts = '', + tfo_opts = ''; + if (typeof proxy.udp !== 'undefined') { + udp_opts = proxy.udp ? ',udp=true' : ',udp=false'; + } + tfo_opts = `,fast-open=${proxy.tfo || false}`; + + switch (proxy.type) { + case 'ss': + obfs_opts = ',,'; + if (proxy.plugin) { + if (proxy.plugin === 'obfs') { + const { mode, host } = proxy['plugin-opts']; + obfs_opts = `,${mode},${host || ''}`; + } else { + throw new Error( + `Platform ${targetPlatform} does not support obfs option: ${proxy.obfs}`, + ); + } + } + return `${proxy.name}=shadowsocks,${proxy.server},${proxy.port},${proxy.cipher},"${proxy.password}"${obfs_opts}${udp_opts}${tfo_opts}`; + case 'ssr': + return `${proxy.name}=shadowsocksr,${proxy.server},${ + proxy.port + },${proxy.cipher},"${proxy.password}",${proxy.protocol},{${ + proxy['protocol-param'] || '' + }},${proxy.obfs},{${ + proxy['obfs-param'] || '' + }}${udp_opts}${tfo_opts}`; + case 'vmess': + obfs_opts = ''; + if (proxy.network === 'ws') { + const host = proxy['ws-opts'].headers.Host || proxy.server; + obfs_opts = `,transport:ws,host:${host},path:${ + proxy['ws-opts'].path || '/' + }`; + } else { + obfs_opts = `,transport:tcp`; + } + if (proxy.tls) { + obfs_opts += `${ + proxy.sni ? ',tls-name:' + proxy.sni : '' + },skip-cert-verify:${proxy['skip-cert-verify'] || 'false'}`; + } + let result = `${proxy.name}=vmess,${proxy.server},${ + proxy.port + },${proxy.cipher === 'auto' ? 'none' : proxy.cipher},"${ + proxy.uuid + }",over-tls:${proxy.tls || 'false'}${obfs_opts}`; + if (proxy.alterId === 0) proxy['vmess-aead'] = true; + if (typeof proxy['vmess-aead'] !== 'undefined') { + result += `,vmess-aead=${proxy['vmess-aead']}`; + } + return result; + case 'trojan': + return `${proxy.name}=trojan,${proxy.server},${proxy.port},"${ + proxy.password + }"${ + proxy.sni ? ',tls-name:' + proxy.sni : '' + },skip-cert-verify:${ + proxy['skip-cert-verify'] || 'false' + }${udp_opts}`; + case 'http': + tls_opts = ''; + const base = `${proxy.name}=${proxy.tls ? 'http' : 'https'},${ + proxy.server + },${proxy.port},${proxy.username || ''},${ + proxy.password || '' + }`; + if (proxy.tls) { + // https + tls_opts = `${ + proxy.sni ? ',tls-name:' + proxy.sni : '' + },skip-cert-verify:${proxy['skip-cert-verify']}`; + return base + tls_opts; + } else return base; + } + throw new Error( + `Platform ${targetPlatform} does not support proxy type: ${proxy.type}`, + ); + }; + return { produce }; +} + +function Surge_Producer() { + const targetPlatform = 'Surge'; + const produce = (proxy) => { + let result = ''; + let obfs_opts, tls_opts; + switch (proxy.type) { + case 'ss': + obfs_opts = ''; + if (proxy.plugin) { + const { host, mode } = proxy['plugin-opts']; + if (proxy.plugin === 'obfs') { + obfs_opts = `,obfs=${mode}${ + host ? ',obfs-host=' + host : '' + }`; + } else { + throw new Error( + `Platform ${targetPlatform} does not support obfs option: ${proxy.obfs}`, + ); + } + } + result = `${proxy.name}=ss,${proxy.server}, ${ + proxy.port + },encrypt-method=${proxy.cipher},password=${ + proxy.password + }${obfs_opts},tfo=${proxy.tfo || 'false'},udp-relay=${ + proxy.udp || 'false' + }`; + break; + case 'vmess': + tls_opts = ''; + result = `${proxy.name}=vmess,${proxy.server},${ + proxy.port + },username=${proxy.uuid},tls=${proxy.tls || 'false'},tfo=${ + proxy.tfo || 'false' + }`; + + if (proxy.alterId === 0) proxy['vmess-aead'] = true; + if (typeof proxy['vmess-aead'] !== 'undefined') { + result += `,vmess-aead=${proxy['vmess-aead']}`; + } + if (proxy.network === 'ws') { + const path = proxy['ws-opts'].path || '/'; + const wsHeaders = Object.entries(proxy['ws-opts'].headers) + .map(([key, value]) => `${key}:"${value}"`) + .join('|'); + result += `,ws=true${path ? ',ws-path=' + path : ''}${ + wsHeaders ? ',ws-headers=' + wsHeaders : '' + }`; + } + if (proxy.tls) { + result += `${ + typeof proxy['skip-cert-verify'] !== 'undefined' + ? ',skip-cert-verify=' + proxy['skip-cert-verify'] + : '' + }`; + result += proxy.sni ? `,sni=${proxy.sni}` : ''; + } + break; + case 'trojan': + result = `${proxy.name}=trojan,${proxy.server},${ + proxy.port + },password=${proxy.password}${ + typeof proxy['skip-cert-verify'] !== 'undefined' + ? ',skip-cert-verify=' + proxy['skip-cert-verify'] + : '' + }${proxy.sni ? ',sni=' + proxy.sni : ''},tfo=${ + proxy.tfo || 'false' + },udp-relay=${proxy.udp || 'false'}`; + break; + case 'http': + if (proxy.tls) { + tls_opts = `,skip-cert-verify=${proxy['skip-cert-verify']},sni=${proxy.sni}`; + } + result = `${proxy.name}=${proxy.tls ? 'https' : 'http'},${ + proxy.server + },${proxy.port}${ + proxy.username ? ',username=' + proxy.username : '' + }${ + proxy.password ? ',password=' + proxy.password : '' + }${tls_opts},tfo=${proxy.tfo || 'false'}`; + break; + default: + throw new Error( + `Platform ${targetPlatform} does not support proxy type: ${proxy.type}`, + ); + } + + // handle surge hybrid param + result += + proxy['surge-hybrid'] !== undefined + ? `,hybrid=${proxy['surge-hybrid']}` + : ''; + return result; + }; + return { produce }; +} + +function Clash_Producer() { + const type = 'ALL'; + const produce = (proxies) => { + return ( + 'proxies:\n' + + proxies + .map((proxy) => { + delete proxy.supported; + return ' - ' + JSON.stringify(proxy) + '\n'; + }) + .join('') + ); + }; + return { type, produce }; +} + +function URI_Producer() { + const type = 'SINGLE'; + const produce = (proxy) => { + let result = ''; + switch (proxy.type) { + case 'ss': + const userinfo = `${proxy.cipher}:${proxy.password}`; + result = `ss://${Base64.encode(userinfo)}@${proxy.server}:${ + proxy.port + }/`; + if (proxy.plugin) { + result += '?plugin='; + const opts = proxy['plugin-opts']; + switch (proxy.plugin) { + case 'obfs': + result += encodeURIComponent( + `simple-obfs;obfs=${opts.mode}${ + opts.host ? ';obfs-host=' + opts.host : '' + }`, + ); + break; + case 'v2ray-plugin': + result += encodeURIComponent( + `v2ray-plugin;obfs=${opts.mode}${ + opts.host ? ';obfs-host' + opts.host : '' + }${opts.tls ? ';tls' : ''}`, + ); + break; + default: + throw new Error( + `Unsupported plugin option: ${proxy.plugin}`, + ); + } + } + result += `#${encodeURIComponent(proxy.name)}`; + break; + case 'ssr': + result = `${proxy.server}:${proxy.port}:${proxy.protocol}:${ + proxy.cipher + }:${proxy.obfs}:${Base64.encode(proxy.password)}/`; + result += `?remarks=${Base64.encode(proxy.name)}${ + proxy['obfs-param'] + ? '&obfsparam=' + Base64.encode(proxy['obfs-param']) + : '' + }${ + proxy['protocol-param'] + ? '&protocolparam=' + + Base64.encode(proxy['protocol-param']) + : '' + }`; + result = 'ssr://' + Base64.encode(result); + break; + case 'vmess': + // V2RayN URI format + result = { + ps: proxy.name, + add: proxy.server, + port: proxy.port, + id: proxy.uuid, + type: '', + aid: 0, + net: proxy.network || 'tcp', + tls: proxy.tls ? 'tls' : '', + }; + // obfs + if (proxy.network === 'ws') { + result.path = proxy['ws-opts'].path || '/'; + result.host = proxy['ws-opts'].headers.Host || proxy.server; + } + result = 'vmess://' + Base64.encode(JSON.stringify(result)); + break; + case 'trojan': + result = `trojan://${proxy.password}@${proxy.server}:${ + proxy.port + }#${encodeURIComponent(proxy.name)}`; + break; + default: + throw new Error(`Cannot handle proxy type: ${proxy.type}`); + } + return result; + }; + return { type, produce }; +} + +function JSON_Producer() { + const type = 'ALL'; + const produce = (proxies) => JSON.stringify(proxies, null, 2); + return { type, produce }; +} + +export default { + QX: QX_Producer(), + Surge: Surge_Producer(), + Loon: Loon_Producer(), + Clash: Clash_Producer(), + URI: URI_Producer(), + JSON: JSON_Producer(), +}; diff --git a/backend/src/core/rule-utils.js b/backend/src/core/rule-utils.js deleted file mode 100644 index 85c2d2c..0000000 --- a/backend/src/core/rule-utils.js +++ /dev/null @@ -1,324 +0,0 @@ -import { ApplyProcessor } from './proxy-utils'; -import YAML from 'static-js-yaml'; -import $ from './app'; - -const RULE_TYPES_MAPPING = [ - [/^(DOMAIN|host|HOST)$/, 'DOMAIN'], - [/^(DOMAIN-KEYWORD|host-keyword|HOST-KEYWORD)$/, 'DOMAIN-KEYWORD'], - [/^(DOMAIN-SUFFIX|host-suffix|HOST-SUFFIX)$/, 'DOMAIN-SUFFIX'], - [/^USER-AGENT$/i, 'USER-AGENT'], - [/^PROCESS-NAME$/, 'PROCESS-NAME'], - [/^(DEST-PORT|DST-PORT)$/, 'DST-PORT'], - [/^SRC-IP(-CIDR)?$/, 'SRC-IP'], - [/^(IN|SRC)-PORT$/, 'IN-PORT'], - [/^PROTOCOL$/, 'PROTOCOL'], - [/^IP-CIDR$/i, 'IP-CIDR'], - [/^(IP-CIDR6|ip6-cidr|IP6-CIDR)$/], -]; - -const RULE_PREPROCESSORS = (function () { - function HTML() { - const name = 'HTML'; - const test = (raw) => /^/.test(raw); - // simply discard HTML - const parse = () => ''; - return { name, test, parse }; - } - - function ClashProvider() { - const name = 'Clash Provider'; - const test = (raw) => raw.indexOf('payload:') === 0; - const parse = (raw) => { - return raw.replace('payload:', '').replace(/^\s*-\s*/gm, ''); - }; - return { name, test, parse }; - } - - return [HTML(), ClashProvider()]; -})(); -const RULE_PARSERS = (function () { - function AllRuleParser() { - const name = 'Universal Rule Parser'; - const test = () => true; - const parse = (raw) => { - const lines = raw.split('\n'); - const result = []; - for (let line of lines) { - line = line.trim(); - // skip empty line - if (line.length === 0) continue; - // skip comments - if (/\s*#/.test(line)) continue; - try { - const params = line.split(',').map((w) => w.trim()); - let rawType = params[0]; - let matched = false; - for (const item of RULE_TYPES_MAPPING) { - const regex = item[0]; - if (regex.test(rawType)) { - matched = true; - const rule = { - type: item[1], - content: params[1], - }; - if ( - rule.type === 'IP-CIDR' || - rule.type === 'IP-CIDR6' - ) { - rule.options = params.slice(2); - } - result.push(rule); - } - } - if (!matched) - throw new Error('Invalid rule type: ' + rawType); - } catch (e) { - console.error( - `Failed to parse line: ${line}\n Reason: ${e}`, - ); - } - } - return result; - }; - return { name, test, parse }; - } - - return [AllRuleParser()]; -})(); -const RULE_PROCESSORS = (function () { - function RegexFilter({ regex = [], keep = true }) { - return { - name: 'Regex Filter', - func: (rules) => { - return rules.map((rule) => { - const selected = regex.some((r) => { - r = new RegExp(r); - return r.test(rule); - }); - return keep ? selected : !selected; - }); - }, - }; - } - - function TypeFilter(types) { - return { - name: 'Type Filter', - func: (rules) => { - return rules.map((rule) => types.some((t) => rule.type === t)); - }, - }; - } - - function RemoveDuplicateFilter() { - return { - name: 'Remove Duplicate Filter', - func: (rules) => { - const seen = new Set(); - const result = []; - rules.forEach((rule) => { - const options = rule.options || []; - options.sort(); - const key = `${rule.type},${rule.content},${JSON.stringify( - options, - )}`; - if (!seen.has(key)) { - result.push(rule); - seen.add(key); - } - }); - return result; - }, - }; - } - - // regex: [{expr: "string format regex", now: "now"}] - function RegexReplaceOperator(regex) { - return { - name: 'Regex Rename Operator', - func: (rules) => { - return rules.map((rule) => { - for (const { expr, now } of regex) { - rule.content = rule.content - .replace(new RegExp(expr, 'g'), now) - .trim(); - } - return rule; - }); - }, - }; - } - - return { - 'Regex Filter': RegexFilter, - 'Remove Duplicate Filter': RemoveDuplicateFilter, - 'Type Filter': TypeFilter, - - 'Regex Replace Operator': RegexReplaceOperator, - }; -})(); -const RULE_PRODUCERS = (function () { - function QXFilter() { - const type = 'SINGLE'; - const func = (rule) => { - // skip unsupported rules - const UNSUPPORTED = [ - 'URL-REGEX', - 'DEST-PORT', - 'SRC-IP', - 'IN-PORT', - 'PROTOCOL', - ]; - if (UNSUPPORTED.indexOf(rule.type) !== -1) return null; - - const TRANSFORM = { - 'DOMAIN-KEYWORD': 'HOST-KEYWORD', - 'DOMAIN-SUFFIX': 'HOST-SUFFIX', - DOMAIN: 'HOST', - 'IP-CIDR6': 'IP6-CIDR', - }; - - // QX does not support the no-resolve option - return `${TRANSFORM[rule.type] || rule.type},${ - rule.content - },SUB-STORE`; - }; - return { type, func }; - } - - function SurgeRuleSet() { - const type = 'SINGLE'; - const func = (rule) => { - let output = `${rule.type},${rule.content}`; - if (rule.type === 'IP-CIDR' || rule.type === 'IP-CIDR6') { - output += rule.options ? `,${rule.options[0]}` : ''; - } - return output; - }; - return { type, func }; - } - - function LoonRules() { - const type = 'SINGLE'; - const func = (rule) => { - // skip unsupported rules - const UNSUPPORTED = ['DEST-PORT', 'SRC-IP', 'IN-PORT', 'PROTOCOL']; - if (UNSUPPORTED.indexOf(rule.type) !== -1) return null; - return SurgeRuleSet().func(rule); - }; - return { type, func }; - } - - function ClashRuleProvider() { - const type = 'ALL'; - const func = (rules) => { - const TRANSFORM = { - 'DEST-PORT': 'DST-PORT', - 'SRC-IP': 'SRC-IP-CIDR', - 'IN-PORT': 'SRC-PORT', - }; - const conf = { - payload: rules.map((rule) => { - let output = `${TRANSFORM[rule.type] || rule.type},${ - rule.content - }`; - if (rule.type === 'IP-CIDR' || rule.type === 'IP-CIDR6') { - output += rule.options ? `,${rule.options[0]}` : ''; - } - return output; - }), - }; - return YAML.dump(conf); - }; - return { type, func }; - } - - return { - QX: QXFilter(), - Surge: SurgeRuleSet(), - Loon: LoonRules(), - Clash: ClashRuleProvider(), - }; -})(); - -export const RuleUtils = (function () { - function preprocess(raw) { - for (const processor of RULE_PREPROCESSORS) { - try { - if (processor.test(raw)) { - $.info(`Pre-processor [${processor.name}] activated`); - return processor.parse(raw); - } - } catch (e) { - $.error(`Parser [${processor.name}] failed\n Reason: ${e}`); - } - } - return raw; - } - - function parse(raw) { - raw = preprocess(raw); - for (const parser of RULE_PARSERS) { - let matched; - try { - matched = parser.test(raw); - } catch (err) { - matched = false; - } - if (matched) { - $.info(`Rule parser [${parser.name}] is activated!`); - return parser.parse(raw); - } - } - } - - async function process(rules, operators) { - for (const item of operators) { - if (!RULE_PROCESSORS[item.type]) { - console.error(`Unknown operator: ${item.type}!`); - continue; - } - const processor = RULE_PROCESSORS[item.type](item.args); - $.info( - `Applying "${item.type}" with arguments: \n >>> ${ - JSON.stringify(item.args) || 'None' - }`, - ); - rules = ApplyProcessor(processor, rules); - } - return rules; - } - - function produce(rules, targetPlatform) { - const producer = RULE_PRODUCERS[targetPlatform]; - if (!producer) { - throw new Error( - `Target platform: ${targetPlatform} is not supported!`, - ); - } - if ( - typeof producer.type === 'undefined' || - producer.type === 'SINGLE' - ) { - return rules - .map((rule) => { - try { - return producer.func(rule); - } catch (err) { - console.log( - `ERROR: cannot produce rule: ${JSON.stringify( - rule, - )}\nReason: ${err}`, - ); - return ''; - } - }) - .filter((line) => line.length > 0) - .join('\n'); - } else if (producer.type === 'ALL') { - return producer.func(rules); - } - } - - return { parse, process, produce }; -})(); diff --git a/backend/src/core/rule-utils/index.js b/backend/src/core/rule-utils/index.js new file mode 100644 index 0000000..031ef17 --- /dev/null +++ b/backend/src/core/rule-utils/index.js @@ -0,0 +1,69 @@ +import RULE_PREPROCESSORS from './preprocessors'; +import RULE_PRODUCERS from './producers'; +import RULE_PARSERS from './parsers'; +import $ from '../app'; + +export const RuleUtils = (function () { + function preprocess(raw) { + for (const processor of RULE_PREPROCESSORS) { + try { + if (processor.test(raw)) { + $.info(`Pre-processor [${processor.name}] activated`); + return processor.parse(raw); + } + } catch (e) { + $.error(`Parser [${processor.name}] failed\n Reason: ${e}`); + } + } + return raw; + } + + function parse(raw) { + raw = preprocess(raw); + for (const parser of RULE_PARSERS) { + let matched; + try { + matched = parser.test(raw); + } catch (err) { + matched = false; + } + if (matched) { + $.info(`Rule parser [${parser.name}] is activated!`); + return parser.parse(raw); + } + } + } + + function produce(rules, targetPlatform) { + const producer = RULE_PRODUCERS[targetPlatform]; + if (!producer) { + throw new Error( + `Target platform: ${targetPlatform} is not supported!`, + ); + } + if ( + typeof producer.type === 'undefined' || + producer.type === 'SINGLE' + ) { + return rules + .map((rule) => { + try { + return producer.func(rule); + } catch (err) { + console.log( + `ERROR: cannot produce rule: ${JSON.stringify( + rule, + )}\nReason: ${err}`, + ); + return ''; + } + }) + .filter((line) => line.length > 0) + .join('\n'); + } else if (producer.type === 'ALL') { + return producer.func(rules); + } + } + + return { parse, produce }; +})(); diff --git a/backend/src/core/rule-utils/parsers.js b/backend/src/core/rule-utils/parsers.js new file mode 100644 index 0000000..51285bc --- /dev/null +++ b/backend/src/core/rule-utils/parsers.js @@ -0,0 +1,58 @@ +const RULE_TYPES_MAPPING = [ + [/^(DOMAIN|host|HOST)$/, 'DOMAIN'], + [/^(DOMAIN-KEYWORD|host-keyword|HOST-KEYWORD)$/, 'DOMAIN-KEYWORD'], + [/^(DOMAIN-SUFFIX|host-suffix|HOST-SUFFIX)$/, 'DOMAIN-SUFFIX'], + [/^USER-AGENT$/i, 'USER-AGENT'], + [/^PROCESS-NAME$/, 'PROCESS-NAME'], + [/^(DEST-PORT|DST-PORT)$/, 'DST-PORT'], + [/^SRC-IP(-CIDR)?$/, 'SRC-IP'], + [/^(IN|SRC)-PORT$/, 'IN-PORT'], + [/^PROTOCOL$/, 'PROTOCOL'], + [/^IP-CIDR$/i, 'IP-CIDR'], + [/^(IP-CIDR6|ip6-cidr|IP6-CIDR)$/], +]; + +function AllRuleParser() { + const name = 'Universal Rule Parser'; + const test = () => true; + const parse = (raw) => { + const lines = raw.split('\n'); + const result = []; + for (let line of lines) { + line = line.trim(); + // skip empty line + if (line.length === 0) continue; + // skip comments + if (/\s*#/.test(line)) continue; + try { + const params = line.split(',').map((w) => w.trim()); + let rawType = params[0]; + let matched = false; + for (const item of RULE_TYPES_MAPPING) { + const regex = item[0]; + if (regex.test(rawType)) { + matched = true; + const rule = { + type: item[1], + content: params[1], + }; + if ( + rule.type === 'IP-CIDR' || + rule.type === 'IP-CIDR6' + ) { + rule.options = params.slice(2); + } + result.push(rule); + } + } + if (!matched) throw new Error('Invalid rule type: ' + rawType); + } catch (e) { + console.error(`Failed to parse line: ${line}\n Reason: ${e}`); + } + } + return result; + }; + return { name, test, parse }; +} + +export default [AllRuleParser()]; diff --git a/backend/src/core/rule-utils/preprocessors.js b/backend/src/core/rule-utils/preprocessors.js new file mode 100644 index 0000000..dbb981c --- /dev/null +++ b/backend/src/core/rule-utils/preprocessors.js @@ -0,0 +1,18 @@ +function HTML() { + const name = 'HTML'; + const test = (raw) => /^/.test(raw); + // simply discard HTML + const parse = () => ''; + return { name, test, parse }; +} + +function ClashProvider() { + const name = 'Clash Provider'; + const test = (raw) => raw.indexOf('payload:') === 0; + const parse = (raw) => { + return raw.replace('payload:', '').replace(/^\s*-\s*/gm, ''); + }; + return { name, test, parse }; +} + +export default [HTML(), ClashProvider()]; diff --git a/backend/src/core/rule-utils/producers.js b/backend/src/core/rule-utils/producers.js new file mode 100644 index 0000000..9a7efcc --- /dev/null +++ b/backend/src/core/rule-utils/producers.js @@ -0,0 +1,81 @@ +import YAML from 'static-js-yaml'; + +function QXFilter() { + const type = 'SINGLE'; + const func = (rule) => { + // skip unsupported rules + const UNSUPPORTED = [ + 'URL-REGEX', + 'DEST-PORT', + 'SRC-IP', + 'IN-PORT', + 'PROTOCOL', + ]; + if (UNSUPPORTED.indexOf(rule.type) !== -1) return null; + + const TRANSFORM = { + 'DOMAIN-KEYWORD': 'HOST-KEYWORD', + 'DOMAIN-SUFFIX': 'HOST-SUFFIX', + DOMAIN: 'HOST', + 'IP-CIDR6': 'IP6-CIDR', + }; + + // QX does not support the no-resolve option + return `${TRANSFORM[rule.type] || rule.type},${rule.content},SUB-STORE`; + }; + return { type, func }; +} + +function SurgeRuleSet() { + const type = 'SINGLE'; + const func = (rule) => { + let output = `${rule.type},${rule.content}`; + if (rule.type === 'IP-CIDR' || rule.type === 'IP-CIDR6') { + output += rule.options ? `,${rule.options[0]}` : ''; + } + return output; + }; + return { type, func }; +} + +function LoonRules() { + const type = 'SINGLE'; + const func = (rule) => { + // skip unsupported rules + const UNSUPPORTED = ['DEST-PORT', 'SRC-IP', 'IN-PORT', 'PROTOCOL']; + if (UNSUPPORTED.indexOf(rule.type) !== -1) return null; + return SurgeRuleSet().func(rule); + }; + return { type, func }; +} + +function ClashRuleProvider() { + const type = 'ALL'; + const func = (rules) => { + const TRANSFORM = { + 'DEST-PORT': 'DST-PORT', + 'SRC-IP': 'SRC-IP-CIDR', + 'IN-PORT': 'SRC-PORT', + }; + const conf = { + payload: rules.map((rule) => { + let output = `${TRANSFORM[rule.type] || rule.type},${ + rule.content + }`; + if (rule.type === 'IP-CIDR' || rule.type === 'IP-CIDR6') { + output += rule.options ? `,${rule.options[0]}` : ''; + } + return output; + }), + }; + return YAML.dump(conf); + }; + return { type, func }; +} + +export default { + QX: QXFilter(), + Surge: SurgeRuleSet(), + Loon: LoonRules(), + Clash: ClashRuleProvider(), +}; diff --git a/backend/sub-store.min.js b/backend/sub-store.min.js index 272aa1e..0339578 100644 --- a/backend/sub-store.min.js +++ b/backend/sub-store.min.js @@ -6,11 +6,11 @@ * ███████║╚██████╔╝██████╔╝ ███████║ ██║ ╚██████╔╝██║ ██║███████╗ * ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ * Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket! - * @updated: 2022/6/3 19:10:53 + * @updated: 2022/6/3 22:47:32 * @version: 1.6 * @author: Peng-YM * @github: https://github.com/Peng-YM/Sub-Store * @documentation: https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46 */ -!function(){var createModuleFactory=function(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}},_$buffer_2=createModuleFactory((function(t,e){(function(t){(function(){"use strict";e.Buffer=r,e.SlowBuffer=function(t){return+t!=t&&(t=0),r.alloc(+t)},e.INSPECT_MAX_BYTES=50;function t(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=r.prototype,e}function r(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return i(t)}return n(t,e,r)}function n(e,n,o){if("string"==typeof e)return function(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!r.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o=0|c(e,n),i=t(o),a=i.write(e,n);return a!==o&&(i=i.slice(0,a)),i}(e,n);if(ArrayBuffer.isView(e))return a(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(j(e,ArrayBuffer)||e&&j(e.buffer,ArrayBuffer))return function(t,e,n){if(e<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function c(t,e){if(r.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||j(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return C(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return I(t).length;default:if(i)return o?-1:C(t).length;e=(""+e).toLowerCase(),i=!0}}function s(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function f(t,e,n,o,i){if(0===t.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),N(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=r.from(e,o)),r.isBuffer(e))return 0===e.length?-1:l(t,e,n,o,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):l(t,[e],n,o,i);throw new TypeError("val must be string, number or Buffer")}function l(t,e,r,n,o){var i,a=1,u=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,u/=2,c/=2,r/=2}function s(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){var f=-1;for(i=r;iu&&(r=u-c),i=r;i>=0;i--){for(var l=!0,p=0;po&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function g(t,e,r){return 0===e&&r===t.length?_$base64Js_1.fromByteArray(t):_$base64Js_1.fromByteArray(t.slice(e,r))}function m(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:s>223?3:s>191?2:1;if(o+l<=r)switch(l){case 1:s<128&&(f=s);break;case 2:128==(192&(i=t[o+1]))&&(c=(31&s)<<6|63&i)>127&&(f=c);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(c=(15&s)<<12|(63&i)<<6|63&a)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:i=t[o+1],a=t[o+2],u=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(c=(15&s)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&c<1114112&&(f=c)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=l}return function(t){var e=t.length;if(e<=w)return String.fromCharCode.apply(String,t);for(var r="",n=0;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return m(this,e,r);case"ascii":return b(this,e,r);case"latin1":case"binary":return E(this,e,r);case"base64":return g(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=function(t){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===r.compare(this,t)},r.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),""},r.prototype.compare=function(t,e,n,o,i){if(j(t,Uint8Array)&&(t=r.from(t,t.offset,t.byteLength)),!r.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),e<0||n>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=n)return 0;if(o>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var a=(i>>>=0)-(o>>>=0),u=(n>>>=0)-(e>>>=0),c=Math.min(a,u),s=this.slice(o,i),f=t.slice(e,n),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return p(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return h(this,t,e,r);case"latin1":case"binary":return d(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function b(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;oo)&&(r=o);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,n,o,i,a){if(!r.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function T(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,4),_$ieee754_3.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,8),_$ieee754_3.write(t,e,r,n,52,8),r+8}r.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,r||A(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||A(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},r.prototype.readUInt8=function(t,e){return t>>>=0,e||A(t,1,this.length),this[t]},r.prototype.readUInt16LE=function(t,e){return t>>>=0,e||A(t,2,this.length),this[t]|this[t+1]<<8},r.prototype.readUInt16BE=function(t,e){return t>>>=0,e||A(t,2,this.length),this[t]<<8|this[t+1]},r.prototype.readUInt32LE=function(t,e){return t>>>=0,e||A(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},r.prototype.readUInt32BE=function(t,e){return t>>>=0,e||A(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},r.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||A(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},r.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||A(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},r.prototype.readInt8=function(t,e){return t>>>=0,e||A(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},r.prototype.readInt16LE=function(t,e){t>>>=0,e||A(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt16BE=function(t,e){t>>>=0,e||A(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt32LE=function(t,e){return t>>>=0,e||A(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},r.prototype.readInt32BE=function(t,e){return t>>>=0,e||A(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},r.prototype.readFloatLE=function(t,e){return t>>>=0,e||A(t,4,this.length),_$ieee754_3.read(this,t,!0,23,4)},r.prototype.readFloatBE=function(t,e){return t>>>=0,e||A(t,4,this.length),_$ieee754_3.read(this,t,!1,23,4)},r.prototype.readDoubleLE=function(t,e){return t>>>=0,e||A(t,8,this.length),_$ieee754_3.read(this,t,!0,52,8)},r.prototype.readDoubleBE=function(t,e){return t>>>=0,e||A(t,8,this.length),_$ieee754_3.read(this,t,!1,52,8)},r.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},r.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,255,0),this[e]=255&t,e+1},r.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},r.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=0,a=1,u=0;for(this[e]=255&t;++i>0)-u&255;return e+r},r.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=r-1,a=1,u=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/a>>0)-u&255;return e+r},r.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},r.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},r.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeFloatLE=function(t,e,r){return T(this,t,e,!0,r)},r.prototype.writeFloatBE=function(t,e,r){return T(this,t,e,!1,r)},r.prototype.writeDoubleLE=function(t,e,r){return R(this,t,e,!0,r)},r.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},r.prototype.copy=function(t,e,n,o){if(!r.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),o||0===o||(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e=0;--a)t[a+e]=this[a+n];else Uint8Array.prototype.set.call(t,this.subarray(n,o),e);return i},r.prototype.fill=function(t,e,n,o){if("string"==typeof t){if("string"==typeof e?(o=e,e=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!r.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){var i=t.charCodeAt(0);("utf8"===o&&i<128||"latin1"===o)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function I(t){return _$base64Js_1.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function P(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function j(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function N(t){return t!=t}}).call(this)}).call(this,_$buffer_2({}).Buffer)})),_$constants_43={};Object.defineProperty(_$constants_43,"__esModule",{value:!0}),_$constants_43.SUBS_KEY=_$constants_43.SETTINGS_KEY=_$constants_43.GIST_BACKUP_KEY=_$constants_43.GIST_BACKUP_FILE_NAME=_$constants_43.COLLECTIONS_KEY=_$constants_43.ARTIFACT_REPOSITORY_KEY=_$constants_43.ARTIFACTS_KEY=void 0,_$constants_43.SETTINGS_KEY="settings",_$constants_43.SUBS_KEY="subs",_$constants_43.COLLECTIONS_KEY="collections",_$constants_43.ARTIFACTS_KEY="artifacts",_$constants_43.GIST_BACKUP_KEY="Auto Generated Sub-Store Backup",_$constants_43.GIST_BACKUP_FILE_NAME="Sub-Store",_$constants_43.ARTIFACT_REPOSITORY_KEY="Sub-Store Artifacts Repository";var _$openApi_53={};function _typeof(t){return(_typeof="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 ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(t){for(var e=1;e=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){asyncGeneratorStep(i,n,o,a,u,"next",t)}function u(t){asyncGeneratorStep(i,n,o,a,u,"throw",t)}a(void 0)}))}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"untitled",debug=arguments.length>1&&void 0!==arguments[1]&&arguments[1];_classCallCheck(this,OpenAPI),this.name=name,this.debug=debug,this.http=HTTP(),this.env=ENV(),this.node=function(){if(isNode){var fs=eval("require('fs')");return{fs:fs}}return null}(),this.initCache();var delay=function(t,e){return new Promise((function(r){setTimeout(r.bind(null,e),t)}))},_ref;Promise.prototype.delay=(_ref=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){var r;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:return r=t.sent,t.next=5,delay(e,r);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return _ref.apply(this,arguments)})}return _createClass(OpenAPI,[{key:"initCache",value:function(){if(isQX&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(isLoon||isSurge)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),isNode){var t="root.json";this.node.fs.existsSync(t)||this.node.fs.writeFileSync(t,JSON.stringify({}),{flag:"wx"},(function(t){return console.log(t)})),this.root={},t="".concat(this.name,".json"),this.node.fs.existsSync(t)?this.cache=JSON.parse(this.node.fs.readFileSync("".concat(this.name,".json"))):(this.node.fs.writeFileSync(t,JSON.stringify({}),{flag:"wx"},(function(t){return console.log(t)})),this.cache={})}}},{key:"persistCache",value:function(){var t=JSON.stringify(this.cache,null,2);isQX&&$prefs.setValueForKey(t,this.name),(isLoon||isSurge)&&$persistentStore.write(t,this.name),isNode&&(this.node.fs.writeFileSync("".concat(this.name,".json"),t,{flag:"w"},(function(t){return console.log(t)})),this.node.fs.writeFileSync("root.json",JSON.stringify(this.root,null,2),{flag:"w"},(function(t){return console.log(t)})))}},{key:"write",value:function(t,e){if(this.log("SET ".concat(e)),-1!==e.indexOf("#")){if(e=e.substr(1),isSurge||isLoon)return $persistentStore.write(t,e);if(isQX)return $prefs.setValueForKey(t,e);isNode&&(this.root[e]=t)}else this.cache[e]=t;this.persistCache()}},{key:"read",value:function(t){return this.log("READ ".concat(t)),-1===t.indexOf("#")?this.cache[t]:(t=t.substr(1),isSurge||isLoon?$persistentStore.read(t):isQX?$prefs.valueForKey(t):isNode?this.root[t]:void 0)}},{key:"delete",value:function(t){if(this.log("DELETE ".concat(t)),-1!==t.indexOf("#")){if(t=t.substr(1),isSurge||isLoon)return $persistentStore.write(null,t);if(isQX)return $prefs.removeValueForKey(t);isNode&&delete this.root[t]}else delete this.cache[t];this.persistCache()}},{key:"notify",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n["open-url"],i=n["media-url"];if(isQX&&$notify(t,e,r,n),isSurge&&$notification.post(t,e,r+"".concat(i?"\n\u591a\u5a92\u4f53:"+i:""),{url:o}),isLoon){var a={};o&&(a.openUrl=o),i&&(a.mediaUrl=i),"{}"===JSON.stringify(a)?$notification.post(t,e,r):$notification.post(t,e,r,a)}if(isNode){var u=r+(o?"\n\u70b9\u51fb\u8df3\u8f6c: ".concat(o):"")+(i?"\n\u591a\u5a92\u4f53: ".concat(i):"");console.log("".concat(t,"\n").concat(e,"\n").concat(u,"\n\n"))}}},{key:"log",value:function(t){this.debug&&console.log("[".concat(this.name,"] LOG: ").concat(t))}},{key:"info",value:function(t){console.log("[".concat(this.name,"] INFO: ").concat(t))}},{key:"error",value:function(t){console.log("[".concat(this.name,"] ERROR: ").concat(t))}},{key:"wait",value:function(t){return new Promise((function(e){return setTimeout(e,t)}))}},{key:"done",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};isQX||isLoon||isSurge?$done(t):isNode&&"undefined"!=typeof $context&&($context.headers=t.headers,$context.statusCode=t.statusCode,$context.body=t.body)}}]),OpenAPI}();function ENV(){return{isQX:isQX,isLoon:isLoon,isSurge:isSurge,isNode:isNode}}function HTTP(){var defaultOptions=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{baseURL:""},_ENV=ENV(),isQX=_ENV.isQX,isLoon=_ENV.isLoon,isSurge=_ENV.isSurge,isNode=_ENV.isNode,methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],URL_REGEX=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;function send(method,options){options="string"==typeof options?{url:options}:options;var baseURL=defaultOptions.baseURL;baseURL&&!URL_REGEX.test(options.url||"")&&(options.url=baseURL?baseURL+options.url:options.url),options=_objectSpread(_objectSpread({},defaultOptions),options);var timeout=options.timeout,events=_objectSpread(_objectSpread({},{onRequest:function(){},onResponse:function(t){return t},onTimeout:function(){}}),options.events),worker,timeoutid;events.onRequest(method,options),isQX?worker=$task.fetch({method:method,url:options.url,headers:options.headers,body:options.body}):(isLoon||isSurge||isNode)&&(worker=new Promise((function(resolve,reject){var request=isNode?eval("require('request')"):$httpClient;request[method.toLowerCase()](options,(function(t,e,r){t?reject(t):resolve({statusCode:e.status||e.statusCode,headers:e.headers,body:r})}))})));var timer=timeout?new Promise((function(t,e){timeoutid=setTimeout((function(){return events.onTimeout(),e("".concat(method," URL: ").concat(options.url," exceeds the timeout ").concat(timeout," ms"))}),timeout)})):null;return(timer?Promise.race([timer,worker]).then((function(t){return clearTimeout(timeoutid),t})):worker).then((function(t){return events.onResponse(t)}))}var http={};return methods.forEach((function(t){return http[t.toLowerCase()]=function(e){return send(t,e)}})),http}_$openApi_53.OpenAPI=OpenAPI;var _$express_52={};function ___classCallCheck_52(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ___defineProperties_52(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:0,n=e.method,o=e.url,i=e.headers,a=e.body;/json/i.test(i["Content-Type"])&&(a=JSON.parse(a)),n=n.toUpperCase();var u,c=extractURL(o),s=c.path,f=c.query,l=null,p=0;for(u=r;up&&(l=handlers[u],p=_.split("/").length)}if(l){var h=function(){t(n,o,u)},d={method:n,url:o,path:s,query:f,params:extractPathParams(l.pattern,s),headers:i,body:a},v=Response(),y=l.callback,g=function(t){v.status(500).json({status:"failed",message:"Internal Server Error: ".concat(t)})};if("AsyncFunction"===y.constructor.name)y(d,v,h).catch(g);else try{y(d,v,h)}catch(m){g(m)}}else Response().status(404).json({status:"failed",message:"ERROR: 404 not found"})},app={};return METHODS_NAMES.forEach((function(t){app[t.toLowerCase()]=function(e,r){handlers.push({method:t,pattern:e,callback:r})}})),app.route=function(t){var e={};return METHODS_NAMES.forEach((function(r){e[r.toLowerCase()]=function(n){return handlers.push({method:r,pattern:t,callback:n}),e}})),e},app.start=function(){dispatch($request)},app;function rawBodySaver(t,e,r,n){r&&r.length&&(t.rawBody=r.toString(n||"utf8"))}function Response(){var t=200,e=(0,_$openApi_53.ENV)(),r=e.isQX,n=e.isLoon,o=e.isSurge,i=DEFAULT_HEADERS,a={200:"HTTP/1.1 200 OK",201:"HTTP/1.1 201 Created",302:"HTTP/1.1 302 Found",307:"HTTP/1.1 307 Temporary Redirect",308:"HTTP/1.1 308 Permanent Redirect",404:"HTTP/1.1 404 Not Found",500:"HTTP/1.1 500 Internal Server Error"};return new(function(){function e(){___classCallCheck_52(this,e)}return ___createClass_52(e,[{key:"status",value:function(e){return t=e,this}},{key:"send",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",u={status:r?a[t]:t,body:e,headers:i};r?$done(u):(n||o)&&$done({response:u})}},{key:"end",value:function(){this.send()}},{key:"html",value:function(t){this.set("Content-Type","text/html;charset=UTF-8"),this.send(t)}},{key:"json",value:function(t){this.set("Content-Type","application/json;charset=UTF-8"),this.send(JSON.stringify(t))}},{key:"set",value:function(t,e){return i[t]=e,this}}]),e}())}}function patternMatched(t,e){if(t instanceof RegExp&&t.test(e))return!0;if("/"===t)return!0;if(-1===t.indexOf(":")){for(var r=e.split("/"),n=t.split("/"),o=0;o=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_50(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function _IP_API(){var t;return t=___regeneratorRuntime_50().mark((function t(e,r){var n,o,i;return ___regeneratorRuntime_50().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=decodeURIComponent(e.params.server),o=(0,_$openApi_53.HTTP)(),t.next=4,o.get("http://ip-api.com/json/".concat(n,"?lang=zh-CN")).then((function(t){return JSON.parse(t.body)}));case 4:i=t.sent,r.json(i);case 6:case"end":return t.stop()}}),t)})),(_IP_API=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_50(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_50(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}Object.defineProperty(_$ipApi_50,"__esModule",{value:!0}),_$ipApi_50.default=function(t,e){return _IP_API.apply(this,arguments)};var _$gist_49={};function ___typeof_49(t){return(___typeof_49="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 ___regeneratorRuntime_49(){___regeneratorRuntime_49=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(x){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(x){return{type:"throw",arg:x}}}t.wrap=c;var f={};function l(){}function p(){}function _(){}var h={};u(h,o,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(O([])));v&&v!==e&&r.call(v,o)&&(h=v);var y=_.prototype=l.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==___typeof_49(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function _createForOfIteratorHelper(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&-1==="\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(n-1));)if(n-=1,this.position-n>e/2-1){r=" ... ",n+=5;break}for(o="",i=this.position;ie/2-1){o=" ... ",i-=5;break}return a=this.buffer.slice(n,i),_$common_7.repeat(" ",t)+r+a+o+"\n"+_$common_7.repeat(" ",t+this.position-n+r.length)+"^"},Mark.prototype.toString=function(t){var e,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),t||(e=this.getSnippet())&&(r+=":\n"+e),r},_$mark_11=Mark;var TYPE_CONSTRUCTOR_OPTIONS=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],YAML_NODE_KINDS=["scalar","sequence","mapping"],_$type_18=function(t,e){var r,n;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===TYPE_CONSTRUCTOR_OPTIONS.indexOf(e))throw new _$exception_9('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=(r=e.styleAliases||null,n={},null!==r&&Object.keys(r).forEach((function(t){r[t].forEach((function(e){n[String(e)]=t}))})),n),-1===YAML_NODE_KINDS.indexOf(this.kind))throw new _$exception_9('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')},_$schema_12={};function compileList(t,e,r){var n=[];return t.include.forEach((function(t){r=compileList(t,e,r)})),t[e].forEach((function(t){r.forEach((function(e,r){e.tag===t.tag&&e.kind===t.kind&&n.push(r)})),r.push(t)})),r.filter((function(t,e){return-1===n.indexOf(e)}))}function Schema(t){this.include=t.include||[],this.implicit=t.implicit||[],this.explicit=t.explicit||[],this.implicit.forEach((function(t){if(t.loadKind&&"scalar"!==t.loadKind)throw new _$exception_9("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")})),this.compiledImplicit=compileList(this,"implicit",[]),this.compiledExplicit=compileList(this,"explicit",[]),this.compiledTypeMap=function(){var t,e,r={scalar:{},sequence:{},mapping:{},fallback:{}};function n(t){r[t.kind][t.tag]=r.fallback[t.tag]=t}for(t=0,e=arguments.length;t=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0"+t.toString(8):"-0"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),YAML_FLOAT_PATTERN=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),SCIENTIFIC_WITHOUT_DOT=/^[-+]?[0-9]+e/,_$float_21=new _$type_18("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!YAML_FLOAT_PATTERN.test(t)||"_"===t[t.length-1])},construct:function(t){var e,r,n,o;return r="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:e.indexOf(":")>=0?(e.split(":").forEach((function(t){o.unshift(parseFloat(t,10))})),e=0,n=1,o.forEach((function(t){e+=t*n,n*=60})),r*e):r*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||_$common_7.isNegativeZero(t))},represent:function(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(_$common_7.isNegativeZero(t))return"-0.0";return r=t.toString(10),SCIENTIFIC_WITHOUT_DOT.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"}),_$json_17=new _$schema_12({include:[_$failsafe_16],implicit:[_$null_28,_$bool_20,_$int_22,_$float_21]}),_$core_13=new _$schema_12({include:[_$json_17]}),YAML_DATE_REGEXP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),YAML_TIMESTAMP_REGEXP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),_$timestamp_34=new _$type_18("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==YAML_DATE_REGEXP.exec(t)||null!==YAML_TIMESTAMP_REGEXP.exec(t))},construct:function(t){var e,r,n,o,i,a,u,c,s=0,f=null;if(null===(e=YAML_DATE_REGEXP.exec(t))&&(e=YAML_TIMESTAMP_REGEXP.exec(t)),null===e)throw new Error("Date resolve error");if(r=+e[1],n=+e[2]-1,o=+e[3],!e[4])return new Date(Date.UTC(r,n,o));if(i=+e[4],a=+e[5],u=+e[6],e[7]){for(s=e[7].slice(0,3);s.length<3;)s+="0";s=+s}return e[9]&&(f=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(f=-f)),c=new Date(Date.UTC(r,n,o,i,a,u,s)),f&&c.setTime(c.getTime()-f),c},instanceOf:Date,represent:function(t){return t.toISOString()}}),_$merge_27=new _$type_18("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}}),NodeBuffer;try{var _require=require;NodeBuffer=_require("buffer").Buffer}catch(__){}var BASE64_MAP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",_$binary_19=new _$type_18("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,r,n=0,o=t.length,i=BASE64_MAP;for(r=0;r64)){if(e<0)return!1;n+=6}return n%8==0},construct:function(t){var e,r,n=t.replace(/[\r\n=]/g,""),o=n.length,i=BASE64_MAP,a=0,u=[];for(e=0;e>16&255),u.push(a>>8&255),u.push(255&a)),a=a<<6|i.indexOf(n.charAt(e));return 0==(r=o%4*6)?(u.push(a>>16&255),u.push(a>>8&255),u.push(255&a)):18===r?(u.push(a>>10&255),u.push(a>>2&255)):12===r&&u.push(a>>4&255),NodeBuffer?NodeBuffer.from?NodeBuffer.from(u):new NodeBuffer(u):u},predicate:function(t){return NodeBuffer&&NodeBuffer.isBuffer(t)},represent:function(t){var e,r,n="",o=0,i=t.length,a=BASE64_MAP;for(e=0;e>18&63],n+=a[o>>12&63],n+=a[o>>6&63],n+=a[63&o]),o=(o<<8)+t[e];return 0==(r=i%3)?(n+=a[o>>18&63],n+=a[o>>12&63],n+=a[o>>6&63],n+=a[63&o]):2===r?(n+=a[o>>10&63],n+=a[o>>4&63],n+=a[o<<2&63],n+=a[64]):1===r&&(n+=a[o>>2&63],n+=a[o<<4&63],n+=a[64],n+=a[64]),n}}),_hasOwnProperty=Object.prototype.hasOwnProperty,_toString=Object.prototype.toString,_$omap_29=new _$type_18("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,r,n,o,i,a=[],u=t;for(e=0,r=u.length;e3)return!1;if("/"!==e[e.length-n.length-1])return!1}return!0},construct:function(t){var e=t,r=/\/([gim]*)$/.exec(t),n="";return"/"===e[0]&&(r&&(n=r[1]),e=e.slice(1,e.length-n.length-1)),new RegExp(e,n)},predicate:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},represent:function(t){var e="/"+t.source+"/";return t.global&&(e+="g"),t.multiline&&(e+="m"),t.ignoreCase&&(e+="i"),e}}),esprima;try{var ___require_23=require;esprima=___require_23("esprima")}catch(_){"undefined"!=typeof window&&(esprima=window.esprima)}var _$function_23=new _$type_18("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var e="("+t+")",r=esprima.parse(e,{range:!0});return"Program"===r.type&&1===r.body.length&&"ExpressionStatement"===r.body[0].type&&("ArrowFunctionExpression"===r.body[0].expression.type||"FunctionExpression"===r.body[0].expression.type)}catch(n){return!1}},construct:function(t){var e,r="("+t+")",n=esprima.parse(r,{range:!0}),o=[];if("Program"!==n.type||1!==n.body.length||"ExpressionStatement"!==n.body[0].type||"ArrowFunctionExpression"!==n.body[0].expression.type&&"FunctionExpression"!==n.body[0].expression.type)throw new Error("Failed to resolve function");return n.body[0].expression.params.forEach((function(t){o.push(t.name)})),e=n.body[0].expression.body.range,"BlockStatement"===n.body[0].expression.body.type?new Function(o,r.slice(e[0]+1,e[1]-1)):new Function(o,"return "+r.slice(e[0],e[1]))},predicate:function(t){return"[object Function]"===Object.prototype.toString.call(t)},represent:function(t){return t.toString()}}),_$default_full_14=_$schema_12.DEFAULT=new _$schema_12({include:[_$default_safe_15],explicit:[_$undefined_25,_$regexp_24,_$function_23]}),_$loader_10={},___hasOwnProperty_10=Object.prototype.hasOwnProperty,CONTEXT_FLOW_IN=1,CONTEXT_FLOW_OUT=2,CONTEXT_BLOCK_IN=3,CONTEXT_BLOCK_OUT=4,CHOMPING_CLIP=1,CHOMPING_STRIP=2,CHOMPING_KEEP=3,PATTERN_NON_PRINTABLE=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,PATTERN_NON_ASCII_LINE_BREAKS=/[\x85\u2028\u2029]/,PATTERN_FLOW_INDICATORS=/[,\[\]\{\}]/,PATTERN_TAG_HANDLE=/^(?:!|!!|![a-z\-]+!)$/i,PATTERN_TAG_URI=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _class(t){return Object.prototype.toString.call(t)}function is_EOL(t){return 10===t||13===t}function is_WHITE_SPACE(t){return 9===t||32===t}function is_WS_OR_EOL(t){return 9===t||32===t||10===t||13===t}function is_FLOW_INDICATOR(t){return 44===t||91===t||93===t||123===t||125===t}function fromHexCode(t){var e;return 48<=t&&t<=57?t-48:97<=(e=32|t)&&e<=102?e-97+10:-1}function simpleEscapeSequence(t){return 48===t?"\0":97===t?"\x07":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"\x1b":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"\x85":95===t?"\xa0":76===t?"\u2028":80===t?"\u2029":""}function charFromCodepoint(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var simpleEscapeCheck=new Array(256),simpleEscapeMap=new Array(256),i=0;i<256;i++)simpleEscapeCheck[i]=simpleEscapeSequence(i)?1:0,simpleEscapeMap[i]=simpleEscapeSequence(i);function State(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||_$default_full_14,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function generateError(t,e){return new _$exception_9(e,new _$mark_11(t.filename,t.input,t.position,t.line,t.position-t.lineStart))}function throwError(t,e){throw generateError(t,e)}function throwWarning(t,e){t.onWarning&&t.onWarning.call(null,generateError(t,e))}var directiveHandlers={YAML:function(t,e,r){var n,o,i;null!==t.version&&throwError(t,"duplication of %YAML directive"),1!==r.length&&throwError(t,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&throwError(t,"ill-formed argument of the YAML directive"),o=parseInt(n[1],10),i=parseInt(n[2],10),1!==o&&throwError(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=i<2,1!==i&&2!==i&&throwWarning(t,"unsupported YAML version of the document")},TAG:function(t,e,r){var n,o;2!==r.length&&throwError(t,"TAG directive accepts exactly two arguments"),n=r[0],o=r[1],PATTERN_TAG_HANDLE.test(n)||throwError(t,"ill-formed tag handle (first argument) of the TAG directive"),___hasOwnProperty_10.call(t.tagMap,n)&&throwError(t,'there is a previously declared suffix for "'+n+'" tag handle'),PATTERN_TAG_URI.test(o)||throwError(t,"ill-formed tag prefix (second argument) of the TAG directive"),t.tagMap[n]=o}};function captureSegment(t,e,r,n){var o,i,a,u;if(e1&&(t.result+=_$common_7.repeat("\n",e-1))}function readBlockSequence(t,e){var r,n,o=t.tag,i=t.anchor,a=[],u=!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=a),n=t.input.charCodeAt(t.position);0!==n&&45===n&&is_WS_OR_EOL(t.input.charCodeAt(t.position+1));)if(u=!0,t.position++,skipSeparationSpace(t,!0,-1)&&t.lineIndent<=e)a.push(null),n=t.input.charCodeAt(t.position);else if(r=t.line,composeNode(t,e,CONTEXT_BLOCK_IN,!1,!0),a.push(t.result),skipSeparationSpace(t,!0,-1),n=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&0!==n)throwError(t,"bad indentation of a sequence entry");else if(t.lineIndente?_=1:t.lineIndent===e?_=0:t.lineIndente?_=1:t.lineIndent===e?_=0:t.lineIndente)&&(composeNode(t,e,CONTEXT_BLOCK_OUT,!0,o)&&(d?_=t.result:h=t.result),d||(storeMappingPair(t,f,l,p,_,h,i,a),p=_=h=null),skipSeparationSpace(t,!0,-1),u=t.input.charCodeAt(t.position)),t.lineIndent>e&&0!==u)throwError(t,"bad indentation of a mapping entry");else if(t.lineIndent=0))break;0===o?throwError(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?throwError(t,"repeat of an indentation width identifier"):(f=e+o-1,s=!0)}if(is_WHITE_SPACE(i)){do{i=t.input.charCodeAt(++t.position)}while(is_WHITE_SPACE(i));if(35===i)do{i=t.input.charCodeAt(++t.position)}while(!is_EOL(i)&&0!==i)}for(;0!==i;){for(readLineBreak(t),t.lineIndent=0,i=t.input.charCodeAt(t.position);(!s||t.lineIndentf&&(f=t.lineIndent),is_EOL(i))l++;else{if(t.lineIndent0){for(o=a,i=0;o>0;o--)(a=fromHexCode(u=t.input.charCodeAt(++t.position)))>=0?i=(i<<4)+a:throwError(t,"expected hexadecimal character");t.result+=charFromCodepoint(i),t.position++}else throwError(t,"unknown escape sequence");r=n=t.position}else is_EOL(u)?(captureSegment(t,r,n,!0),writeFoldedLines(t,skipSeparationSpace(t,!1,e)),r=n=t.position):t.position===t.lineStart&&testDocumentSeparator(t)?throwError(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}throwError(t,"unexpected end of the stream within a double quoted scalar")}(t,l)?d=!0:function(t){var e,r,n;if(42!==(n=t.input.charCodeAt(t.position)))return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;0!==n&&!is_WS_OR_EOL(n)&&!is_FLOW_INDICATOR(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&throwError(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),___hasOwnProperty_10.call(t.anchorMap,r)||throwError(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],skipSeparationSpace(t,!0,-1),!0}(t)?(d=!0,null===t.tag&&null===t.anchor||throwError(t,"alias node should not have any properties")):function(t,e,r){var n,o,i,a,u,c,s,f,l=t.kind,p=t.result;if(is_WS_OR_EOL(f=t.input.charCodeAt(t.position))||is_FLOW_INDICATOR(f)||35===f||38===f||42===f||33===f||124===f||62===f||39===f||34===f||37===f||64===f||96===f)return!1;if((63===f||45===f)&&(is_WS_OR_EOL(n=t.input.charCodeAt(t.position+1))||r&&is_FLOW_INDICATOR(n)))return!1;for(t.kind="scalar",t.result="",o=i=t.position,a=!1;0!==f;){if(58===f){if(is_WS_OR_EOL(n=t.input.charCodeAt(t.position+1))||r&&is_FLOW_INDICATOR(n))break}else if(35===f){if(is_WS_OR_EOL(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&testDocumentSeparator(t)||r&&is_FLOW_INDICATOR(f))break;if(is_EOL(f)){if(u=t.line,c=t.lineStart,s=t.lineIndent,skipSeparationSpace(t,!1,-1),t.lineIndent>=e){a=!0,f=t.input.charCodeAt(t.position);continue}t.position=i,t.line=u,t.lineStart=c,t.lineIndent=s;break}}a&&(captureSegment(t,o,i,!1),writeFoldedLines(t,t.line-u),o=i=t.position,a=!1),is_WHITE_SPACE(f)||(i=t.position+1),f=t.input.charCodeAt(++t.position)}return captureSegment(t,o,i,!1),!!t.result||(t.kind=l,t.result=p,!1)}(t,l,CONTEXT_FLOW_IN===r)&&(d=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===_&&(d=u&&readBlockSequence(t,p))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&throwError(t,'unacceptable node kind for ! tag; it should be "scalar", not "'+t.kind+'"'),c=0,s=t.implicitTypes.length;c tag; it should be "'+f.kind+'", not "'+t.kind+'"'),f.resolve(t.result)?(t.result=f.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):throwError(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):throwError(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||d}function readDocument(t){var e,r,n,o,i=t.position,a=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap={},t.anchorMap={};0!==(o=t.input.charCodeAt(t.position))&&(skipSeparationSpace(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==o));){for(a=!0,o=t.input.charCodeAt(++t.position),e=t.position;0!==o&&!is_WS_OR_EOL(o);)o=t.input.charCodeAt(++t.position);for(n=[],(r=t.input.slice(e,t.position)).length<1&&throwError(t,"directive name must not be less than one character in length");0!==o;){for(;is_WHITE_SPACE(o);)o=t.input.charCodeAt(++t.position);if(35===o){do{o=t.input.charCodeAt(++t.position)}while(0!==o&&!is_EOL(o));break}if(is_EOL(o))break;for(e=t.position;0!==o&&!is_WS_OR_EOL(o);)o=t.input.charCodeAt(++t.position);n.push(t.input.slice(e,t.position))}0!==o&&readLineBreak(t),___hasOwnProperty_10.call(directiveHandlers,r)?directiveHandlers[r](t,r,n):throwWarning(t,'unknown document directive "'+r+'"')}skipSeparationSpace(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,skipSeparationSpace(t,!0,-1)):a&&throwError(t,"directives end mark is expected"),composeNode(t,t.lineIndent-1,CONTEXT_BLOCK_OUT,!1,!0),skipSeparationSpace(t,!0,-1),t.checkLineBreaks&&PATTERN_NON_ASCII_LINE_BREAKS.test(t.input.slice(i,t.position))&&throwWarning(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&testDocumentSeparator(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,skipSeparationSpace(t,!0,-1)):t.position0?t.charCodeAt(i-1):null,_=_&&isPlainSafe(a,u)}else{for(i=0;in&&" "!==t[p+1],p=i);else if(!isPrintable(a))return STYLE_DOUBLE;u=i>0?t.charCodeAt(i-1):null,_=_&&isPlainSafe(a,u)}f=f||l&&i-p-1>n&&" "!==t[p+1]}return s||f?r>9&&needIndentIndicator(t)?STYLE_DOUBLE:f?STYLE_FOLDED:STYLE_LITERAL:_&&!o(t)?STYLE_PLAIN:STYLE_SINGLE}function writeScalar(t,e,r,n){t.dump=function(){if(0===e.length)return"''";if(!t.noCompatMode&&-1!==DEPRECATED_BOOLEANS_SYNTAX.indexOf(e))return"'"+e+"'";var o=t.indent*Math.max(1,r),i=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-o),a=n||t.flowLevel>-1&&r>=t.flowLevel;switch(chooseScalarStyle(e,a,t.indent,i,(function(e){return function(t,e){var r,n;for(r=0,n=t.implicitTypes.length;r"+blockHeader(e,t.indent)+dropEndingNewline(indentString(function(t,e){for(var r,n,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=t.indexOf("\n"))?o:t.length,i.lastIndex=o,foldLine(t.slice(0,o),e)),u="\n"===t[0]||" "===t[0];n=i.exec(t);){var c=n[1],s=n[2];r=" "===s[0],a+=c+(u||r||""===s?"":"\n")+foldLine(s,e),u=r}return a}(e,i),o));case STYLE_DOUBLE:return'"'+function(t){for(var e,r,n,o="",i=0;i=55296&&e<=56319&&(r=t.charCodeAt(i+1))>=56320&&r<=57343?(o+=encodeHex(1024*(e-55296)+r-56320+65536),i++):o+=!(n=ESCAPE_SEQUENCES[e])&&isPrintable(e)?t[i]:n||encodeHex(e);return o}(e)+'"';default:throw new _$exception_9("impossible error: invalid scalar style")}}()}function blockHeader(t,e){var r=needIndentIndicator(t)?String(e):"",n="\n"===t[t.length-1];return r+(!n||"\n"!==t[t.length-2]&&"\n"!==t?n?"":"-":"+")+"\n"}function dropEndingNewline(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function foldLine(t,e){if(""===t||" "===t[0])return t;for(var r,n,o=/ [^ ]/g,i=0,a=0,u=0,c="";r=o.exec(t);)(u=r.index)-i>e&&(n=a>i?a:u,c+="\n"+t.slice(i,n),i=n+1),a=u;return c+="\n",t.length-i>e&&a>i?c+=t.slice(i,a)+"\n"+t.slice(a+1):c+=t.slice(i),c.slice(1)}function detectType(t,e,r){var n,o,i,a,u,c;for(i=0,a=(o=r?t.explicitTypes:t.implicitTypes).length;i tag resolver accepts not "'+c+'" style');n=u.represent[c](e,c)}t.dump=n}return!0}return!1}function writeNode(t,e,r,n,o,i){t.tag=null,t.dump=r,detectType(t,r,!1)||detectType(t,r,!0);var a=___toString_8.call(t.dump);n&&(n=t.flowLevel<0||t.flowLevel>e);var u,c,s="[object Object]"===a||"[object Array]"===a;if(s&&(c=-1!==(u=t.duplicates.indexOf(r))),(null!==t.tag&&"?"!==t.tag||c||2!==t.indent&&e>0)&&(o=!1),c&&t.usedDuplicates[u])t.dump="*ref_"+u;else{if(s&&c&&!t.usedDuplicates[u]&&(t.usedDuplicates[u]=!0),"[object Object]"===a)n&&0!==Object.keys(t.dump).length?(function(t,e,r,n){var o,i,a,u,c,s,f="",l=t.tag,p=Object.keys(r);if(!0===t.sortKeys)p.sort();else if("function"==typeof t.sortKeys)p.sort(t.sortKeys);else if(t.sortKeys)throw new _$exception_9("sortKeys must be a boolean or a function");for(o=0,i=p.length;o1024)&&(t.dump&&CHAR_LINE_FEED===t.dump.charCodeAt(0)?s+="?":s+="? "),s+=t.dump,c&&(s+=generateNextLine(t,e)),writeNode(t,e+1,u,!0,c)&&(t.dump&&CHAR_LINE_FEED===t.dump.charCodeAt(0)?s+=":":s+=": ",f+=s+=t.dump));t.tag=l,t.dump=f||"{}"}(t,e,t.dump,o),c&&(t.dump="&ref_"+u+t.dump)):(function(t,e,r){var n,o,i,a,u,c="",s=t.tag,f=Object.keys(r);for(n=0,o=f.length;n1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),writeNode(t,e,a,!1,!1)&&(c+=u+=t.dump));t.tag=s,t.dump="{"+c+"}"}(t,e,t.dump),c&&(t.dump="&ref_"+u+" "+t.dump));else if("[object Array]"===a){var f=t.noArrayIndent&&e>0?e-1:e;n&&0!==t.dump.length?(function(t,e,r,n){var o,i,a="",u=t.tag;for(o=0,i=r.length;o "+t.dump)}return!0}function getDuplicateReferences(t,e){var r,n,o=[],i=[];for(function t(e,r,n){var o,i,a;if(null!==e&&"object"==typeof e)if(-1!==(i=r.indexOf(e)))-1===n.indexOf(i)&&n.push(i);else if(r.push(e),Array.isArray(e))for(i=0,a=e.length;i=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_47(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}Object.defineProperty(_$download_47,"__esModule",{value:!0}),_$download_47.default=function(t,e){return _download.apply(this,arguments)};var cache=new Map;function _download(){var t;return t=___regeneratorRuntime_47().mark((function t(e,r){var n,o,i;return ___regeneratorRuntime_47().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=(r=r||"Quantumult%20X/1.0.29 (iPhone14,5; iOS 15.4.1)")+e,!cache.has(n)){t.next=4;break}return t.abrupt("return",cache.get(n));case 4:return o=(0,_$openApi_53.HTTP)({headers:{"User-Agent":r}}),i=new Promise((function(t,r){o.get(e).then((function(e){var n=e.body;0===n.replace(/\s/g,"").length?r(new Error("\u8ba2\u9605\u5185\u5bb9\u4e3a\u7a7a\uff01")):t(n)}))})),cache.set(n,i),t.abrupt("return",i);case 8:case"end":return t.stop()}}),t)})),(_download=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_47(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_47(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}var _$logical_51={};function ___arrayLikeToArray_51(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0?o-4:o;for(r=0;r>16&255,a[u++]=e>>8&255,a[u++]=255&e;return 2===i&&(e=revLookup[t.charCodeAt(r)]<<2|revLookup[t.charCodeAt(r+1)]>>4,a[u++]=255&e),1===i&&(e=revLookup[t.charCodeAt(r)]<<10|revLookup[t.charCodeAt(r+1)]<<4|revLookup[t.charCodeAt(r+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e),a},fromByteArray:function(t){for(var e,r=t.length,n=r%3,o=[],i=0,a=r-n;ia?a:i+16383));return 1===n?(e=t[r-1],o.push(lookup[e>>2]+lookup[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),o.join("")}},lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",__i_1=0,len=code.length;__i_10)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function encodeChunk(t,e,r){for(var n,o,i=[],a=e;a>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]);return i.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var _$ieee754_3={read:function(t,e,r,n,o){var i,a,u=8*o-n-1,c=(1<>1,f=-7,l=r?o-1:0,p=r?-1:1,_=t[e+l];for(l+=p,i=_&(1<<-f)-1,_>>=-f,f+=u;f>0;i=256*i+t[e+l],l+=p,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=n;f>0;a=256*a+t[e+l],l+=p,f-=8);if(0===i)i=1-s;else{if(i===c)return a?NaN:1/0*(_?-1:1);a+=Math.pow(2,n),i-=s}return(_?-1:1)*a*Math.pow(2,i-n)},write:function(t,e,r,n,o,i){var a,u,c,s=8*i-o-1,f=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:i-1,h=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=f?(u=0,a=f):a+l>=1?(u=(e*c-1)*Math.pow(2,o),a+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,o),a=0));o>=8;t[r+_]=255&u,_+=h,u/=256,o-=8);for(a=a<0;t[r+_]=255&a,_+=h,a/=256,s-=8);t[r+_-h]|=128*d}},_$base64_4={exports:{}};(function(t,e){(function(){!function(t,e){var r,n;"object"==typeof _$base64_4.exports?_$base64_4.exports=e():"function"==typeof define&&define.amd?define(e):(r=t.Base64,(n=e()).noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:this,(function(){"use strict";var t,r="function"==typeof atob,n="function"==typeof btoa,o="function"==typeof e,i="function"==typeof TextDecoder?new TextDecoder:void 0,a="function"==typeof TextEncoder?new TextEncoder:void 0,u=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),c=(t={},u.forEach((function(e,r){return t[e]=r})),t),s=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,f=String.fromCharCode.bind(String),l="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t,e){return void 0===e&&(e=function(t){return t}),new Uint8Array(Array.prototype.slice.call(t,0).map(e))},p=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},_=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(t){for(var e,r,n,o,i="",a=t.length%3,c=0;c255||(n=t.charCodeAt(c++))>255||(o=t.charCodeAt(c++))>255)throw new TypeError("invalid character found");i+=u[(e=r<<16|n<<8|o)>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}return a?i.slice(0,a-3)+"===".substring(a):i},d=n?function(t){return btoa(t)}:o?function(t){return e.from(t,"binary").toString("base64")}:h,v=o?function(t){return e.from(t).toString("base64")}:function(t){for(var e=[],r=0,n=t.length;r>>6)+f(128|63&e):f(224|e>>>12&15)+f(128|e>>>6&63)+f(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return f(240|e>>>18&7)+f(128|e>>>12&63)+f(128|e>>>6&63)+f(128|63&e)},m=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,w=function(t){return t.replace(m,g)},b=o?function(t){return e.from(t,"utf8").toString("base64")}:a?function(t){return v(a.encode(t))}:function(t){return d(w(t))},E=function(t,e){return void 0===e&&(e=!1),e?p(b(t)):b(t)},S=function(t){return E(t,!0)},O=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,A=function(t){switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return f(55296+(e>>>10))+f(56320+(1023&e));case 3:return f((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return f((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},x=function(t){return t.replace(O,A)},L=function(t){if(t=t.replace(/\s+/g,""),!s.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var e,r,n,o="",i=0;i>16&255):64===n?f(e>>16&255,e>>8&255):f(e>>16&255,e>>8&255,255&e);return o},T=r?function(t){return atob(_(t))}:o?function(t){return e.from(t,"base64").toString("binary")}:L,R=o?function(t){return l(e.from(t,"base64"))}:function(t){return l(T(t),(function(t){return t.charCodeAt(0)}))},k=function(t){return R(I(t))},C=o?function(t){return e.from(t,"base64").toString("utf8")}:i?function(t){return i.decode(R(t))}:function(t){return x(T(t))},I=function(t){return _(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},P=function(t){return C(I(t))},j=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},N=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,j(e))};t("fromBase64",(function(){return P(this)})),t("toBase64",(function(t){return E(this,t)})),t("toBase64URI",(function(){return E(this,!0)})),t("toBase64URL",(function(){return E(this,!0)})),t("toUint8Array",(function(){return k(this)}))},$=function(){var t=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,j(e))};t("toBase64",(function(t){return y(this,t)})),t("toBase64URI",(function(){return y(this,!0)})),t("toBase64URL",(function(){return y(this,!0)}))},F={version:"3.7.2",VERSION:"3.7.2",atob:T,atobPolyfill:L,btoa:d,btoaPolyfill:h,fromBase64:P,toBase64:E,encode:E,encodeURI:S,encodeURL:S,utob:w,btou:x,decode:P,isValid:function(t){if("string"!=typeof t)return!1;var e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},fromUint8Array:y,toUint8Array:k,extendString:N,extendUint8Array:$,extendBuiltins:function(){N(),$()},Base64:{}};return Object.keys(F).forEach((function(t){return F.Base64[t]=F[t]})),F}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_$buffer_2({}).Buffer),_$base64_4=_$base64_4.exports;var _$lodash_35={exports:{}};(function(t){(function(){(function(){var e="Expected a function",r="__lodash_placeholder__",n=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],o="[object Arguments]",i="[object Array]",a="[object Boolean]",u="[object Date]",c="[object Error]",s="[object Function]",f="[object GeneratorFunction]",l="[object Map]",p="[object Number]",_="[object Object]",h="[object RegExp]",d="[object Set]",v="[object String]",y="[object Symbol]",g="[object WeakMap]",m="[object ArrayBuffer]",w="[object DataView]",b="[object Float32Array]",E="[object Float64Array]",S="[object Int8Array]",O="[object Int16Array]",A="[object Int32Array]",x="[object Uint8Array]",L="[object Uint16Array]",T="[object Uint32Array]",R=/\b__p \+= '';/g,k=/\b(__p \+=) '' \+/g,C=/(__e\(.*?\)|\b__t\)) \+\n'';/g,I=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,j=RegExp(I.source),N=RegExp(P.source),$=/<%-([\s\S]+?)%>/g,F=/<%([\s\S]+?)%>/g,U=/<%=([\s\S]+?)%>/g,D=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,M=/^\w*$/,B=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,G=/[\\^$.*+?()[\]{}|]/g,H=RegExp(G.source),Y=/^\s+/,K=/\s/,W=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,J=/\{\n\/\* \[wrapped with (.+)\] \*/,q=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,z=/[()=,{}\[\]\/\s]/,V=/\\(\\)?/g,Q=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Z=/\w*$/,tt=/^[-+]0x[0-9a-f]+$/i,et=/^0b[01]+$/i,rt=/^\[object .+?Constructor\]$/,nt=/^0o[0-7]+$/i,ot=/^(?:0|[1-9]\d*)$/,it=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,at=/($^)/,ut=/['\n\r\u2028\u2029\\]/g,ct="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",st="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ft="["+st+"]",lt="["+ct+"]",pt="\\d+",_t="[a-z\\xdf-\\xf6\\xf8-\\xff]",ht="[^\\ud800-\\udfff"+st+pt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",dt="\\ud83c[\\udffb-\\udfff]",vt="[^\\ud800-\\udfff]",yt="(?:\\ud83c[\\udde6-\\uddff]){2}",gt="[\\ud800-\\udbff][\\udc00-\\udfff]",mt="[A-Z\\xc0-\\xd6\\xd8-\\xde]",wt="(?:"+_t+"|"+ht+")",bt="(?:"+mt+"|"+ht+")",Et="(?:"+lt+"|"+dt+")?",St="[\\ufe0e\\ufe0f]?"+Et+"(?:\\u200d(?:"+[vt,yt,gt].join("|")+")[\\ufe0e\\ufe0f]?"+Et+")*",Ot="(?:"+["[\\u2700-\\u27bf]",yt,gt].join("|")+")"+St,At="(?:"+[vt+lt+"?",lt,yt,gt,"[\\ud800-\\udfff]"].join("|")+")",xt=RegExp("['\u2019]","g"),Lt=RegExp(lt,"g"),Tt=RegExp(dt+"(?="+dt+")|"+At+St,"g"),Rt=RegExp([mt+"?"+_t+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?="+[ft,mt,"$"].join("|")+")",bt+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?="+[ft,mt+wt,"$"].join("|")+")",mt+"?"+wt+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?",mt+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",pt,Ot].join("|"),"g"),kt=RegExp("[\\u200d\\ud800-\\udfff"+ct+"\\ufe0e\\ufe0f]"),Ct=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,It=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Pt=-1,jt={};jt[b]=jt[E]=jt[S]=jt[O]=jt[A]=jt[x]=jt["[object Uint8ClampedArray]"]=jt[L]=jt[T]=!0,jt[o]=jt[i]=jt[m]=jt[a]=jt[w]=jt[u]=jt[c]=jt[s]=jt[l]=jt[p]=jt[_]=jt[h]=jt[d]=jt[v]=jt[g]=!1;var Nt={};Nt[o]=Nt[i]=Nt[m]=Nt[w]=Nt[a]=Nt[u]=Nt[b]=Nt[E]=Nt[S]=Nt[O]=Nt[A]=Nt[l]=Nt[p]=Nt[_]=Nt[h]=Nt[d]=Nt[v]=Nt[y]=Nt[x]=Nt["[object Uint8ClampedArray]"]=Nt[L]=Nt[T]=!0,Nt[c]=Nt[s]=Nt[g]=!1;var $t={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ft=parseFloat,Ut=parseInt,Dt="object"==typeof t&&t&&t.Object===Object&&t,Mt="object"==typeof self&&self&&self.Object===Object&&self,Bt=Dt||Mt||Function("return this")(),Gt="object"==typeof _$lodash_35.exports&&_$lodash_35.exports&&!_$lodash_35.exports.nodeType&&_$lodash_35.exports,Ht=Gt&&_$lodash_35&&!_$lodash_35.nodeType&&_$lodash_35,Yt=Ht&&Ht.exports===Gt,Kt=Yt&&Dt.process,Wt=function(){try{return Ht&&Ht.require&&Ht.require("util").types||Kt&&Kt.binding&&Kt.binding("util")}catch(t){}}(),Jt=Wt&&Wt.isArrayBuffer,qt=Wt&&Wt.isDate,Xt=Wt&&Wt.isMap,zt=Wt&&Wt.isRegExp,Vt=Wt&&Wt.isSet,Qt=Wt&&Wt.isTypedArray;function Zt(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function te(t,e,r,n){for(var o=-1,i=null==t?0:t.length;++o-1}function ae(t,e,r){for(var n=-1,o=null==t?0:t.length;++n-1;);return r}function Re(t,e){for(var r=t.length;r--&&de(e,t[r],0)>-1;);return r}var ke=we({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),Ce=we({"&":"&","<":"<",">":">",'"':""","'":"'"});function Ie(t){return"\\"+$t[t]}function Pe(t){return kt.test(t)}function je(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function Ne(t,e){return function(r){return t(e(r))}}function $e(t,e){for(var n=-1,o=t.length,i=0,a=[];++n",""":'"',"'":"'"}),He=function t(K){var ct,st=(K=null==K?Bt:He.defaults(Bt.Object(),K,He.pick(Bt,It))).Array,ft=K.Date,lt=K.Error,pt=K.Function,_t=K.Math,ht=K.Object,dt=K.RegExp,vt=K.String,yt=K.TypeError,gt=st.prototype,mt=pt.prototype,wt=ht.prototype,bt=K["__core-js_shared__"],Et=mt.toString,St=wt.hasOwnProperty,Ot=0,At=(ct=/[^.]+$/.exec(bt&&bt.keys&&bt.keys.IE_PROTO||""))?"Symbol(src)_1."+ct:"",Tt=wt.toString,kt=Et.call(ht),$t=Bt._,Dt=dt("^"+Et.call(St).replace(G,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mt=Yt?K.Buffer:void 0,Gt=K.Symbol,Ht=K.Uint8Array,Kt=Mt?Mt.allocUnsafe:void 0,Wt=Ne(ht.getPrototypeOf,ht),pe=ht.create,we=wt.propertyIsEnumerable,Ye=gt.splice,Ke=Gt?Gt.isConcatSpreadable:void 0,We=Gt?Gt.iterator:void 0,Je=Gt?Gt.toStringTag:void 0,qe=function(){try{var t=Zo(ht,"defineProperty");return t({},"",{}),t}catch(e){}}(),Xe=K.clearTimeout!==Bt.clearTimeout&&K.clearTimeout,ze=ft&&ft.now!==Bt.Date.now&&ft.now,Ve=K.setTimeout!==Bt.setTimeout&&K.setTimeout,Qe=_t.ceil,Ze=_t.floor,tr=ht.getOwnPropertySymbols,er=Mt?Mt.isBuffer:void 0,rr=K.isFinite,nr=gt.join,or=Ne(ht.keys,ht),ir=_t.max,ar=_t.min,ur=ft.now,cr=K.parseInt,sr=_t.random,fr=gt.reverse,lr=Zo(K,"DataView"),pr=Zo(K,"Map"),_r=Zo(K,"Promise"),hr=Zo(K,"Set"),dr=Zo(K,"WeakMap"),vr=Zo(ht,"create"),yr=dr&&new dr,gr={},mr=Ai(lr),wr=Ai(pr),br=Ai(_r),Er=Ai(hr),Sr=Ai(dr),Or=Gt?Gt.prototype:void 0,Ar=Or?Or.valueOf:void 0,xr=Or?Or.toString:void 0;function Lr(t){if(Ga(t)&&!Ca(t)&&!(t instanceof Cr)){if(t instanceof kr)return t;if(St.call(t,"__wrapped__"))return xi(t)}return new kr(t)}var Tr=function(){function t(){}return function(e){if(!Ba(e))return{};if(pe)return pe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Rr(){}function kr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function Cr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Ir(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function Xr(t,e,r,n,i,c){var g,R=1&e,k=2&e,C=4&e;if(r&&(g=i?r(t,n,i,c):r(t)),void 0!==g)return g;if(!Ba(t))return t;var I=Ca(t);if(I){if(g=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&St.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!R)return yo(t,g)}else{var P=ri(t),j=P==s||P==f;if(Na(t))return fo(t,R);if(P==_||P==o||j&&!i){if(g=k||j?{}:oi(t),!R)return k?function(t,e){return go(t,ei(t),e)}(t,function(t,e){return t&&go(e,mu(e),t)}(g,t)):function(t,e){return go(t,ti(t),e)}(t,Kr(g,t))}else{if(!Nt[P])return i?t:{};g=function(t,e,r){var n,o,i,c=t.constructor;switch(e){case m:return lo(t);case a:case u:return new c(+t);case w:return function(t,e){var r=e?lo(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case b:case E:case S:case O:case A:case x:case"[object Uint8ClampedArray]":case L:case T:return po(t,r);case l:return new c;case p:case v:return new c(t);case h:return(i=new(o=t).constructor(o.source,Z.exec(o))).lastIndex=o.lastIndex,i;case d:return new c;case y:return n=t,Ar?ht(Ar.call(n)):{}}}(t,P,R)}}c||(c=new $r);var N=c.get(t);if(N)return N;c.set(t,g),Ja(t)?t.forEach((function(n){g.add(Xr(n,e,r,n,t,c))})):Ha(t)&&t.forEach((function(n,o){g.set(o,Xr(n,e,r,o,t,c))}));var $=I?void 0:(C?k?Wo:Ko:k?mu:gu)(t);return ee($||t,(function(n,o){$&&(n=t[o=n]),Gr(g,o,Xr(n,e,r,o,t,c))})),g}function zr(t,e,r){var n=r.length;if(null==t)return!n;for(t=ht(t);n--;){var o=r[n],i=e[o],a=t[o];if(void 0===a&&!(o in t)||!i(a))return!1}return!0}function Vr(t,r,n){if("function"!=typeof t)throw new yt(e);return gi((function(){t.apply(void 0,n)}),r)}function Qr(t,e,r,n){var o=-1,i=ie,a=!0,u=t.length,c=[],s=e.length;if(!u)return c;r&&(e=ue(e,Ae(r))),n?(i=ae,a=!1):e.length>=200&&(i=Le,a=!1,e=new Nr(e));t:for(;++o-1},Pr.prototype.set=function(t,e){var r=this.__data__,n=Hr(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},jr.prototype.clear=function(){this.size=0,this.__data__={hash:new Ir,map:new(pr||Pr),string:new Ir}},jr.prototype.delete=function(t){var e=Vo(this,t).delete(t);return this.size-=e?1:0,e},jr.prototype.get=function(t){return Vo(this,t).get(t)},jr.prototype.has=function(t){return Vo(this,t).has(t)},jr.prototype.set=function(t,e){var r=Vo(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},Nr.prototype.add=Nr.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Nr.prototype.has=function(t){return this.__data__.has(t)},$r.prototype.clear=function(){this.__data__=new Pr,this.size=0},$r.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},$r.prototype.get=function(t){return this.__data__.get(t)},$r.prototype.has=function(t){return this.__data__.has(t)},$r.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Pr){var n=r.__data__;if(!pr||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new jr(n)}return r.set(t,e),this.size=r.size,this};var Zr=bo(cn),tn=bo(sn,!0);function en(t,e){var r=!0;return Zr(t,(function(t,n,o){return r=!!e(t,n,o)})),r}function rn(t,e,r){for(var n=-1,o=t.length;++n0&&r(u)?e>1?on(u,e-1,r,n,o):ce(o,u):n||(o[o.length]=u)}return o}var an=Eo(),un=Eo(!0);function cn(t,e){return t&&an(t,e,gu)}function sn(t,e){return t&&un(t,e,gu)}function fn(t,e){return oe(e,(function(e){return Ua(t[e])}))}function ln(t,e){for(var r=0,n=(e=ao(e,t)).length;null!=t&&re}function dn(t,e){return null!=t&&St.call(t,e)}function vn(t,e){return null!=t&&e in ht(t)}function yn(t,e,r){for(var n=r?ae:ie,o=t[0].length,i=t.length,a=i,u=st(i),c=1/0,s=[];a--;){var f=t[a];a&&e&&(f=ue(f,Ae(e))),c=ar(f.length,c),u[a]=!r&&(e||o>=120&&f.length>=120)?new Nr(a&&f):void 0}f=t[0];var l=-1,p=u[0];t:for(;++l=u?c:c*("desc"==r[n]?-1:1)}return t.index-e.index}(t,e,r)}));n--;)t[n]=t[n].value;return t}(xn(t,(function(t,r,o){return{criteria:ue(e,(function(e){return e(t)})),index:++n,value:t}})))}function In(t,e,r){for(var n=-1,o=e.length,i={};++n-1;)u!==t&&Ye.call(u,c,1),Ye.call(t,c,1);return t}function jn(t,e){for(var r=t?e.length:0,n=r-1;r--;){var o=e[r];if(r==n||o!==i){var i=o;ai(o)?Ye.call(t,o,1):Qn(t,o)}}return t}function Nn(t,e){return t+Ze(sr()*(e-t+1))}function $n(t,e){var r="";if(!t||e<1||e>9007199254740991)return r;do{e%2&&(r+=t),(e=Ze(e/2))&&(t+=t)}while(e);return r}function Fn(t,e){return mi(hi(t,e,Yu),t+"")}function Un(t){return Ur(Lu(t))}function Dn(t,e){var r=Lu(t);return Ei(r,qr(e,0,r.length))}function Mn(t,e,r,n){if(!Ba(t))return t;for(var o=-1,i=(e=ao(e,t)).length,a=i-1,u=t;null!=u&&++oo?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=st(o);++n>>1,a=t[i];null!==a&&!Xa(a)&&(r?a<=e:a=200){var s=e?null:Fo(t);if(s)return Fe(s);a=!1,o=Le,c=new Nr}else c=e?[]:u;t:for(;++n=n?t:Yn(t,e,r)}var so=Xe||function(t){return Bt.clearTimeout(t)};function fo(t,e){if(e)return t.slice();var r=t.length,n=Kt?Kt(r):new t.constructor(r);return t.copy(n),n}function lo(t){var e=new t.constructor(t.byteLength);return new Ht(e).set(new Ht(t)),e}function po(t,e){var r=e?lo(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function _o(t,e){if(t!==e){var r=void 0!==t,n=null===t,o=t==t,i=Xa(t),a=void 0!==e,u=null===e,c=e==e,s=Xa(e);if(!u&&!s&&!i&&t>e||i&&a&&c&&!u&&!s||n&&a&&c||!r&&c||!o)return 1;if(!n&&!i&&!s&&t1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,a&&ui(r[0],r[1],a)&&(i=o<3?void 0:i,o=1),e=ht(e);++n-1?o[i?e[a]:a]:void 0}}function Lo(t){return Yo((function(r){var n=r.length,o=n,i=kr.prototype.thru;for(t&&r.reverse();o--;){var a=r[o];if("function"!=typeof a)throw new yt(e);if(i&&!u&&"wrapper"==qo(a))var u=new kr([],!0)}for(o=u?o:n;++o1&&g.reverse(),f&&cu))return!1;var s=i.get(t),f=i.get(e);if(s&&f)return s==e&&f==t;var l=-1,p=!0,_=2&r?new Nr:void 0;for(i.set(t,e),i.set(e,t);++l-1&&t%1==0&&t1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(W,"{\n/* [wrapped with "+e+"] */\n")}(o,function(t,e){return ee(n,(function(r){var n="_."+r[0];e&r[1]&&!ie(t,n)&&t.push(n)})),t.sort()}(function(t){var e=t.match(J);return e?e[1].split(q):[]}(o),r)))}function bi(t){var e=0,r=0;return function(){var n=ur(),o=16-(n-r);if(r=n,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Ei(t,e){var r=-1,n=t.length,o=n-1;for(e=void 0===e?n:e;++r1?t[e-1]:void 0;return r="function"==typeof r?(t.pop(),r):void 0,Wi(t,r)}));function Zi(t){var e=Lr(t);return e.__chain__=!0,e}function ta(t,e){return e(t)}var ea=Yo((function(t){var e=t.length,r=e?t[0]:0,n=this.__wrapped__,o=function(e){return Jr(e,t)};return!(e>1||this.__actions__.length)&&n instanceof Cr&&ai(r)?((n=n.slice(r,+r+(e?1:0))).__actions__.push({func:ta,args:[o],thisArg:void 0}),new kr(n,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(o)})),ra=mo((function(t,e,r){St.call(t,r)?++t[r]:Wr(t,r,1)})),na=xo(ki),oa=xo(Ci);function ia(t,e){return(Ca(t)?ee:Zr)(t,zo(e,3))}function aa(t,e){return(Ca(t)?re:tn)(t,zo(e,3))}var ua=mo((function(t,e,r){St.call(t,r)?t[r].push(e):Wr(t,r,[e])})),ca=Fn((function(t,e,r){var n=-1,o="function"==typeof e,i=Pa(t)?st(t.length):[];return Zr(t,(function(t){i[++n]=o?Zt(e,t,r):gn(t,e,r)})),i})),sa=mo((function(t,e,r){Wr(t,r,e)}));function fa(t,e){return(Ca(t)?ue:xn)(t,zo(e,3))}var la=mo((function(t,e,r){t[r?0:1].push(e)}),(function(){return[[],[]]})),pa=Fn((function(t,e){if(null==t)return[];var r=e.length;return r>1&&ui(t,e[0],e[1])?e=[]:r>2&&ui(e[0],e[1],e[2])&&(e=[e[0]]),Cn(t,on(e,1),[])})),_a=ze||function(){return Bt.Date.now()};function ha(t,e,r){return e=r?void 0:e,Do(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function da(t,r){var n;if("function"!=typeof r)throw new yt(e);return t=eu(t),function(){return--t>0&&(n=r.apply(this,arguments)),t<=1&&(r=void 0),n}}var va=Fn((function(t,e,r){var n=1;if(r.length){var o=$e(r,Xo(va));n|=32}return Do(t,n,e,r,o)})),ya=Fn((function(t,e,r){var n=3;if(r.length){var o=$e(r,Xo(ya));n|=32}return Do(e,n,t,r,o)}));function ga(t,r,n){var o,i,a,u,c,s,f=0,l=!1,p=!1,_=!0;if("function"!=typeof t)throw new yt(e);function h(e){var r=o,n=i;return o=i=void 0,f=e,u=t.apply(n,r)}function d(t){var e=t-s;return void 0===s||e>=r||e<0||p&&t-f>=a}function v(){var t=_a();if(d(t))return y(t);c=gi(v,function(t){var e=r-(t-s);return p?ar(e,a-(t-f)):e}(t))}function y(t){return c=void 0,_&&o?h(t):(o=i=void 0,u)}function g(){var t=_a(),e=d(t);if(o=arguments,i=this,s=t,e){if(void 0===c)return function(t){return f=t,c=gi(v,r),l?h(t):u}(s);if(p)return so(c),c=gi(v,r),h(s)}return void 0===c&&(c=gi(v,r)),u}return r=nu(r)||0,Ba(n)&&(l=!!n.leading,a=(p="maxWait"in n)?ir(nu(n.maxWait)||0,r):a,_="trailing"in n?!!n.trailing:_),g.cancel=function(){void 0!==c&&so(c),f=0,o=s=i=c=void 0},g.flush=function(){return void 0===c?u:y(_a())},g}var ma=Fn((function(t,e){return Vr(t,1,e)})),wa=Fn((function(t,e,r){return Vr(t,nu(e)||0,r)}));function ba(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new yt(e);var n=function(){var e=arguments,o=r?r.apply(this,e):e[0],i=n.cache;if(i.has(o))return i.get(o);var a=t.apply(this,e);return n.cache=i.set(o,a)||i,a};return n.cache=new(ba.Cache||jr),n}function Ea(t){if("function"!=typeof t)throw new yt(e);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ba.Cache=jr;var Sa=uo((function(t,e){var r=(e=1==e.length&&Ca(e[0])?ue(e[0],Ae(zo())):ue(on(e,1),Ae(zo()))).length;return Fn((function(n){for(var o=-1,i=ar(n.length,r);++o=e})),ka=mn(function(){return arguments}())?mn:function(t){return Ga(t)&&St.call(t,"callee")&&!we.call(t,"callee")},Ca=st.isArray,Ia=Jt?Ae(Jt):function(t){return Ga(t)&&_n(t)==m};function Pa(t){return null!=t&&Ma(t.length)&&!Ua(t)}function ja(t){return Ga(t)&&Pa(t)}var Na=er||nc,$a=qt?Ae(qt):function(t){return Ga(t)&&_n(t)==u};function Fa(t){if(!Ga(t))return!1;var e=_n(t);return e==c||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Ka(t)}function Ua(t){if(!Ba(t))return!1;var e=_n(t);return e==s||e==f||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Da(t){return"number"==typeof t&&t==eu(t)}function Ma(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Ba(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ga(t){return null!=t&&"object"==typeof t}var Ha=Xt?Ae(Xt):function(t){return Ga(t)&&ri(t)==l};function Ya(t){return"number"==typeof t||Ga(t)&&_n(t)==p}function Ka(t){if(!Ga(t)||_n(t)!=_)return!1;var e=Wt(t);if(null===e)return!0;var r=St.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Et.call(r)==kt}var Wa=zt?Ae(zt):function(t){return Ga(t)&&_n(t)==h},Ja=Vt?Ae(Vt):function(t){return Ga(t)&&ri(t)==d};function qa(t){return"string"==typeof t||!Ca(t)&&Ga(t)&&_n(t)==v}function Xa(t){return"symbol"==typeof t||Ga(t)&&_n(t)==y}var za=Qt?Ae(Qt):function(t){return Ga(t)&&Ma(t.length)&&!!jt[_n(t)]},Va=jo(An),Qa=jo((function(t,e){return t<=e}));function Za(t){if(!t)return[];if(Pa(t))return qa(t)?Me(t):yo(t);if(We&&t[We])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[We]());var e=ri(t);return(e==l?je:e==d?Fe:Lu)(t)}function tu(t){return t?(t=nu(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function eu(t){var e=tu(t),r=e%1;return e==e?r?e-r:e:0}function ru(t){return t?qr(eu(t),0,4294967295):0}function nu(t){if("number"==typeof t)return t;if(Xa(t))return NaN;if(Ba(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ba(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Oe(t);var r=et.test(t);return r||nt.test(t)?Ut(t.slice(2),r?2:8):tt.test(t)?NaN:+t}function ou(t){return go(t,mu(t))}function iu(t){return null==t?"":zn(t)}var au=wo((function(t,e){if(li(e)||Pa(e))go(e,gu(e),t);else for(var r in e)St.call(e,r)&&Gr(t,r,e[r])})),uu=wo((function(t,e){go(e,mu(e),t)})),cu=wo((function(t,e,r,n){go(e,mu(e),t,n)})),su=wo((function(t,e,r,n){go(e,gu(e),t,n)})),fu=Yo(Jr),lu=Fn((function(t,e){t=ht(t);var r=-1,n=e.length,o=n>2?e[2]:void 0;for(o&&ui(e[0],e[1],o)&&(n=1);++r1),e})),go(t,Wo(t),r),n&&(r=Xr(r,7,Go));for(var o=e.length;o--;)Qn(r,e[o]);return r})),Su=Yo((function(t,e){return null==t?{}:function(t,e){return In(t,e,(function(e,r){return hu(t,r)}))}(t,e)}));function Ou(t,e){if(null==t)return{};var r=ue(Wo(t),(function(t){return[t]}));return e=zo(e),In(t,r,(function(t,r){return e(t,r[0])}))}var Au=Uo(gu),xu=Uo(mu);function Lu(t){return null==t?[]:xe(t,gu(t))}var Tu=Oo((function(t,e,r){return e=e.toLowerCase(),t+(r?Ru(e):e)}));function Ru(t){return Fu(iu(t).toLowerCase())}function ku(t){return(t=iu(t))&&t.replace(it,ke).replace(Lt,"")}var Cu=Oo((function(t,e,r){return t+(r?"-":"")+e.toLowerCase()})),Iu=Oo((function(t,e,r){return t+(r?" ":"")+e.toLowerCase()})),Pu=So("toLowerCase"),ju=Oo((function(t,e,r){return t+(r?"_":"")+e.toLowerCase()})),Nu=Oo((function(t,e,r){return t+(r?" ":"")+Fu(e)})),$u=Oo((function(t,e,r){return t+(r?" ":"")+e.toUpperCase()})),Fu=So("toUpperCase");function Uu(t,e,r){return t=iu(t),void 0===(e=r?void 0:e)?function(t){return Ct.test(t)}(t)?function(t){return t.match(Rt)||[]}(t):function(t){return t.match(X)||[]}(t):t.match(e)||[]}var Du=Fn((function(t,e){try{return Zt(t,void 0,e)}catch(r){return Fa(r)?r:new lt(r)}})),Mu=Yo((function(t,e){return ee(e,(function(e){e=Oi(e),Wr(t,e,va(t[e],t))})),t}));function Bu(t){return function(){return t}}var Gu=Lo(),Hu=Lo(!0);function Yu(t){return t}function Ku(t){return Sn("function"==typeof t?t:Xr(t,1))}var Wu=Fn((function(t,e){return function(r){return gn(r,t,e)}})),Ju=Fn((function(t,e){return function(r){return gn(t,r,e)}}));function qu(t,e,r){var n=gu(e),o=fn(e,n);null!=r||Ba(e)&&(o.length||!n.length)||(r=e,e=t,t=this,o=fn(e,gu(e)));var i=!(Ba(r)&&"chain"in r&&!r.chain),a=Ua(t);return ee(o,(function(r){var n=e[r];t[r]=n,a&&(t.prototype[r]=function(){var e=this.__chain__;if(i||e){var r=t(this.__wrapped__);return(r.__actions__=yo(this.__actions__)).push({func:n,args:arguments,thisArg:t}),r.__chain__=e,r}return n.apply(t,ce([this.value()],arguments))})})),t}function Xu(){}var zu=Co(ue),Vu=Co(ne),Qu=Co(le);function Zu(t){return ci(t)?me(Oi(t)):function(t){return function(e){return ln(e,t)}}(t)}var tc=Po(),ec=Po(!0);function rc(){return[]}function nc(){return!1}var oc,ic=ko((function(t,e){return t+e}),0),ac=$o("ceil"),uc=ko((function(t,e){return t/e}),1),cc=$o("floor"),sc=ko((function(t,e){return t*e}),1),fc=$o("round"),lc=ko((function(t,e){return t-e}),0);return Lr.after=function(t,r){if("function"!=typeof r)throw new yt(e);return t=eu(t),function(){if(--t<1)return r.apply(this,arguments)}},Lr.ary=ha,Lr.assign=au,Lr.assignIn=uu,Lr.assignInWith=cu,Lr.assignWith=su,Lr.at=fu,Lr.before=da,Lr.bind=va,Lr.bindAll=Mu,Lr.bindKey=ya,Lr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ca(t)?t:[t]},Lr.chain=Zi,Lr.chunk=function(t,e,r){e=(r?ui(t,e,r):void 0===e)?1:ir(eu(e),0);var n=null==t?0:t.length;if(!n||e<1)return[];for(var o=0,i=0,a=st(Qe(n/e));oo?0:o+r),(n=void 0===n||n>o?o:eu(n))<0&&(n+=o),n=r>n?0:ru(n);r>>0)?(t=iu(t))&&("string"==typeof e||null!=e&&!Wa(e))&&!(e=zn(e))&&Pe(t)?co(Me(t),0,r):t.split(e,r):[]},Lr.spread=function(t,r){if("function"!=typeof t)throw new yt(e);return r=null==r?0:ir(eu(r),0),Fn((function(e){var n=e[r],o=co(e,0,r);return n&&ce(o,n),Zt(t,this,o)}))},Lr.tail=function(t){var e=null==t?0:t.length;return e?Yn(t,1,e):[]},Lr.take=function(t,e,r){return t&&t.length?Yn(t,0,(e=r||void 0===e?1:eu(e))<0?0:e):[]},Lr.takeRight=function(t,e,r){var n=null==t?0:t.length;return n?Yn(t,(e=n-(e=r||void 0===e?1:eu(e)))<0?0:e,n):[]},Lr.takeRightWhile=function(t,e){return t&&t.length?to(t,zo(e,3),!1,!0):[]},Lr.takeWhile=function(t,e){return t&&t.length?to(t,zo(e,3)):[]},Lr.tap=function(t,e){return e(t),t},Lr.throttle=function(t,r,n){var o=!0,i=!0;if("function"!=typeof t)throw new yt(e);return Ba(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),ga(t,r,{leading:o,maxWait:r,trailing:i})},Lr.thru=ta,Lr.toArray=Za,Lr.toPairs=Au,Lr.toPairsIn=xu,Lr.toPath=function(t){return Ca(t)?ue(t,Oi):Xa(t)?[t]:yo(Si(iu(t)))},Lr.toPlainObject=ou,Lr.transform=function(t,e,r){var n=Ca(t),o=n||Na(t)||za(t);if(e=zo(e,4),null==r){var i=t&&t.constructor;r=o?n?new i:[]:Ba(t)&&Ua(i)?Tr(Wt(t)):{}}return(o?ee:cn)(t,(function(t,n,o){return e(r,t,n,o)})),r},Lr.unary=function(t){return ha(t,1)},Lr.union=Gi,Lr.unionBy=Hi,Lr.unionWith=Yi,Lr.uniq=function(t){return t&&t.length?Vn(t):[]},Lr.uniqBy=function(t,e){return t&&t.length?Vn(t,zo(e,2)):[]},Lr.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Vn(t,void 0,e):[]},Lr.unset=function(t,e){return null==t||Qn(t,e)},Lr.unzip=Ki,Lr.unzipWith=Wi,Lr.update=function(t,e,r){return null==t?t:Zn(t,e,io(r))},Lr.updateWith=function(t,e,r,n){return n="function"==typeof n?n:void 0,null==t?t:Zn(t,e,io(r),n)},Lr.values=Lu,Lr.valuesIn=function(t){return null==t?[]:xe(t,mu(t))},Lr.without=Ji,Lr.words=Uu,Lr.wrap=function(t,e){return Oa(io(e),t)},Lr.xor=qi,Lr.xorBy=Xi,Lr.xorWith=zi,Lr.zip=Vi,Lr.zipObject=function(t,e){return no(t||[],e||[],Gr)},Lr.zipObjectDeep=function(t,e){return no(t||[],e||[],Mn)},Lr.zipWith=Qi,Lr.entries=Au,Lr.entriesIn=xu,Lr.extend=uu,Lr.extendWith=cu,qu(Lr,Lr),Lr.add=ic,Lr.attempt=Du,Lr.camelCase=Tu,Lr.capitalize=Ru,Lr.ceil=ac,Lr.clamp=function(t,e,r){return void 0===r&&(r=e,e=void 0),void 0!==r&&(r=(r=nu(r))==r?r:0),void 0!==e&&(e=(e=nu(e))==e?e:0),qr(nu(t),e,r)},Lr.clone=function(t){return Xr(t,4)},Lr.cloneDeep=function(t){return Xr(t,5)},Lr.cloneDeepWith=function(t,e){return Xr(t,5,e="function"==typeof e?e:void 0)},Lr.cloneWith=function(t,e){return Xr(t,4,e="function"==typeof e?e:void 0)},Lr.conformsTo=function(t,e){return null==e||zr(t,e,gu(e))},Lr.deburr=ku,Lr.defaultTo=function(t,e){return null==t||t!=t?e:t},Lr.divide=uc,Lr.endsWith=function(t,e,r){t=iu(t),e=zn(e);var n=t.length,o=r=void 0===r?n:qr(eu(r),0,n);return(r-=e.length)>=0&&t.slice(r,o)==e},Lr.eq=La,Lr.escape=function(t){return(t=iu(t))&&N.test(t)?t.replace(P,Ce):t},Lr.escapeRegExp=function(t){return(t=iu(t))&&H.test(t)?t.replace(G,"\\$&"):t},Lr.every=function(t,e,r){var n=Ca(t)?ne:en;return r&&ui(t,e,r)&&(e=void 0),n(t,zo(e,3))},Lr.find=na,Lr.findIndex=ki,Lr.findKey=function(t,e){return _e(t,zo(e,3),cn)},Lr.findLast=oa,Lr.findLastIndex=Ci,Lr.findLastKey=function(t,e){return _e(t,zo(e,3),sn)},Lr.floor=cc,Lr.forEach=ia,Lr.forEachRight=aa,Lr.forIn=function(t,e){return null==t?t:an(t,zo(e,3),mu)},Lr.forInRight=function(t,e){return null==t?t:un(t,zo(e,3),mu)},Lr.forOwn=function(t,e){return t&&cn(t,zo(e,3))},Lr.forOwnRight=function(t,e){return t&&sn(t,zo(e,3))},Lr.get=_u,Lr.gt=Ta,Lr.gte=Ra,Lr.has=function(t,e){return null!=t&&ni(t,e,dn)},Lr.hasIn=hu,Lr.head=Pi,Lr.identity=Yu,Lr.includes=function(t,e,r,n){t=Pa(t)?t:Lu(t),r=r&&!n?eu(r):0;var o=t.length;return r<0&&(r=ir(o+r,0)),qa(t)?r<=o&&t.indexOf(e,r)>-1:!!o&&de(t,e,r)>-1},Lr.indexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=null==r?0:eu(r);return o<0&&(o=ir(n+o,0)),de(t,e,o)},Lr.inRange=function(t,e,r){return e=tu(e),void 0===r?(r=e,e=0):r=tu(r),function(t,e,r){return t>=ar(e,r)&&t=-9007199254740991&&t<=9007199254740991},Lr.isSet=Ja,Lr.isString=qa,Lr.isSymbol=Xa,Lr.isTypedArray=za,Lr.isUndefined=function(t){return void 0===t},Lr.isWeakMap=function(t){return Ga(t)&&ri(t)==g},Lr.isWeakSet=function(t){return Ga(t)&&"[object WeakSet]"==_n(t)},Lr.join=function(t,e){return null==t?"":nr.call(t,e)},Lr.kebabCase=Cu,Lr.last=Fi,Lr.lastIndexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=n;return void 0!==r&&(o=(o=eu(r))<0?ir(n+o,0):ar(o,n-1)),e==e?function(t,e,r){for(var n=r+1;n--;)if(t[n]===e)return n;return n}(t,e,o):he(t,ye,o,!0)},Lr.lowerCase=Iu,Lr.lowerFirst=Pu,Lr.lt=Va,Lr.lte=Qa,Lr.max=function(t){return t&&t.length?rn(t,Yu,hn):void 0},Lr.maxBy=function(t,e){return t&&t.length?rn(t,zo(e,2),hn):void 0},Lr.mean=function(t){return ge(t,Yu)},Lr.meanBy=function(t,e){return ge(t,zo(e,2))},Lr.min=function(t){return t&&t.length?rn(t,Yu,An):void 0},Lr.minBy=function(t,e){return t&&t.length?rn(t,zo(e,2),An):void 0},Lr.stubArray=rc,Lr.stubFalse=nc,Lr.stubObject=function(){return{}},Lr.stubString=function(){return""},Lr.stubTrue=function(){return!0},Lr.multiply=sc,Lr.nth=function(t,e){return t&&t.length?kn(t,eu(e)):void 0},Lr.noConflict=function(){return Bt._===this&&(Bt._=$t),this},Lr.noop=Xu,Lr.now=_a,Lr.pad=function(t,e,r){t=iu(t);var n=(e=eu(e))?De(t):0;if(!e||n>=e)return t;var o=(e-n)/2;return Io(Ze(o),r)+t+Io(Qe(o),r)},Lr.padEnd=function(t,e,r){t=iu(t);var n=(e=eu(e))?De(t):0;return e&&ne){var n=t;t=e,e=n}if(r||t%1||e%1){var o=sr();return ar(t+o*(e-t+Ft("1e-"+((o+"").length-1))),e)}return Nn(t,e)},Lr.reduce=function(t,e,r){var n=Ca(t)?se:be,o=arguments.length<3;return n(t,zo(e,4),r,o,Zr)},Lr.reduceRight=function(t,e,r){var n=Ca(t)?fe:be,o=arguments.length<3;return n(t,zo(e,4),r,o,tn)},Lr.repeat=function(t,e,r){return e=(r?ui(t,e,r):void 0===e)?1:eu(e),$n(iu(t),e)},Lr.replace=function(){var t=arguments,e=iu(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Lr.result=function(t,e,r){var n=-1,o=(e=ao(e,t)).length;for(o||(o=1,t=void 0);++n9007199254740991)return[];var r=4294967295,n=ar(t,4294967295);t-=4294967295;for(var o=Se(n,e=zo(e));++r=i)return t;var u=r-De(n);if(u<1)return n;var c=a?co(a,0,u).join(""):t.slice(0,u);if(void 0===o)return c+n;if(a&&(u+=c.length-u),Wa(o)){if(t.slice(u).search(o)){var s,f=c;for(o.global||(o=dt(o.source,iu(Z.exec(o))+"g")),o.lastIndex=0;s=o.exec(f);)var l=s.index;c=c.slice(0,void 0===l?u:l)}}else if(t.indexOf(zn(o),u)!=u){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+n},Lr.unescape=function(t){return(t=iu(t))&&j.test(t)?t.replace(I,Ge):t},Lr.uniqueId=function(t){var e=++Ot;return iu(t)+e},Lr.upperCase=$u,Lr.upperFirst=Fu,Lr.each=ia,Lr.eachRight=aa,Lr.first=Pi,qu(Lr,(oc={},cn(Lr,(function(t,e){St.call(Lr.prototype,e)||(oc[e]=t)})),oc),{chain:!1}),Lr.VERSION="4.17.21",ee(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Lr[t].placeholder=Lr})),ee(["drop","take"],(function(t,e){Cr.prototype[t]=function(r){r=void 0===r?1:ir(eu(r),0);var n=this.__filtered__&&!e?new Cr(this):this.clone();return n.__filtered__?n.__takeCount__=ar(r,n.__takeCount__):n.__views__.push({size:ar(r,4294967295),type:t+(n.__dir__<0?"Right":"")}),n},Cr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ee(["filter","map","takeWhile"],(function(t,e){var r=e+1,n=1==r||3==r;Cr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:zo(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}})),ee(["head","last"],(function(t,e){var r="take"+(e?"Right":"");Cr.prototype[t]=function(){return this[r](1).value()[0]}})),ee(["initial","tail"],(function(t,e){var r="drop"+(e?"":"Right");Cr.prototype[t]=function(){return this.__filtered__?new Cr(this):this[r](1)}})),Cr.prototype.compact=function(){return this.filter(Yu)},Cr.prototype.find=function(t){return this.filter(t).head()},Cr.prototype.findLast=function(t){return this.reverse().find(t)},Cr.prototype.invokeMap=Fn((function(t,e){return"function"==typeof t?new Cr(this):this.map((function(r){return gn(r,t,e)}))})),Cr.prototype.reject=function(t){return this.filter(Ea(zo(t)))},Cr.prototype.slice=function(t,e){t=eu(t);var r=this;return r.__filtered__&&(t>0||e<0)?new Cr(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),void 0!==e&&(r=(e=eu(e))<0?r.dropRight(-e):r.take(e-t)),r)},Cr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Cr.prototype.toArray=function(){return this.take(4294967295)},cn(Cr.prototype,(function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),o=Lr[n?"take"+("last"==e?"Right":""):e],i=n||/^find/.test(e);o&&(Lr.prototype[e]=function(){var e=this.__wrapped__,a=n?[1]:arguments,u=e instanceof Cr,c=a[0],s=u||Ca(e),f=function(t){var e=o.apply(Lr,ce([t],a));return n&&l?e[0]:e};s&&r&&"function"==typeof c&&1!=c.length&&(u=s=!1);var l=this.__chain__,p=!!this.__actions__.length,_=i&&!l,h=u&&!p;if(!i&&s){e=h?e:new Cr(this);var d=t.apply(e,a);return d.__actions__.push({func:ta,args:[f],thisArg:void 0}),new kr(d,l)}return _&&h?t.apply(this,a):(d=this.thru(f),_?n?d.value()[0]:d.value():d)})})),ee(["pop","push","shift","sort","splice","unshift"],(function(t){var e=gt[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);Lr.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var o=this.value();return e.apply(Ca(o)?o:[],t)}return this[r]((function(r){return e.apply(Ca(r)?r:[],t)}))}})),cn(Cr.prototype,(function(t,e){var r=Lr[e];if(r){var n=r.name+"";St.call(gr,n)||(gr[n]=[]),gr[n].push({name:e,func:r})}})),gr[To(void 0,2).name]=[{name:"wrapper",func:void 0}],Cr.prototype.clone=function(){var t=new Cr(this.__wrapped__);return t.__actions__=yo(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=yo(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=yo(this.__views__),t},Cr.prototype.reverse=function(){if(this.__filtered__){var t=new Cr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Cr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=Ca(t),n=e<0,o=r?t.length:0,i=function(t,e,r){for(var n=-1,o=r.length;++n=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},Lr.prototype.plant=function(t){for(var e,r=this;r instanceof Rr;){var n=xi(r);n.__index__=0,n.__values__=void 0,e?o.__wrapped__=n:e=n;var o=n;r=r.__wrapped__}return o.__wrapped__=t,e},Lr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Cr){var e=t;return this.__actions__.length&&(e=new Cr(this)),(e=e.reverse()).__actions__.push({func:ta,args:[Bi],thisArg:void 0}),new kr(e,this.__chain__)}return this.thru(Bi)},Lr.prototype.toJSON=Lr.prototype.valueOf=Lr.prototype.value=function(){return eo(this.__wrapped__,this.__actions__)},Lr.prototype.first=Lr.prototype.head,We&&(Lr.prototype[We]=function(){return this}),Lr}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Bt._=He,define((function(){return He}))):Ht?((Ht.exports=He)._=He,Gt._=He):Bt._=He}).call(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$lodash_35=_$lodash_35.exports;var _$proxyUtils_38={};function ___typeof_38(t){return(___typeof_38="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(_$proxyUtils_38,"__esModule",{value:!0}),_$proxyUtils_38.ApplyProcessor=ApplyProcessor,_$proxyUtils_38.ProxyUtils=void 0;var ___download_38=_interopRequireDefault(_$download_47),_lodash=_interopRequireDefault(_$lodash_35),_app=_interopRequireDefault(_$app_37);function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function ___regeneratorRuntime_38(){___regeneratorRuntime_38=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(x){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(x){return{type:"throw",arg:x}}}t.wrap=c;var f={};function l(){}function p(){}function _(){}var h={};u(h,o,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(O([])));v&&v!==e&&r.call(v,o)&&(h=v);var y=_.prototype=l.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==___typeof_38(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_38(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function ___asyncToGenerator_38(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_38(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_38(i,n,o,a,u,"throw",t)}a(void 0)}))}}function _slicedToArray(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,u=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}}(t,e)||_unsupportedIterableToArray(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function __ownKeys_38(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ___objectSpread_38(t){for(var e=1;e=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_38(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_38(t,e):void 0}}function ___arrayLikeToArray_38(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r/.test(t)},parse:function(){return""}},(keys=["dm1lc3M","c3NyOi8v","dHJvamFu","c3M6Ly","c3NkOi8v","c2hhZG93","aHR0c"],{name:"Base64 Pre-processor",test:function(t){return keys.some((function(e){return-1!==t.indexOf(e)}))},parse:function(t){return _$base64_4.Base64.decode(t)}}),{name:"Clash Pre-processor",test:function(t){return/proxies/.test(t)},parse:function(t){return(0,_$staticJsYaml_36.safeLoad)(t).proxies.map((function(t){return JSON.stringify(t)})).join("\n")}},{name:"SSD Pre-processor",test:function(t){return 0===t.indexOf("ssd://")},parse:function(t){for(var e=[],r=JSON.parse(_$base64_4.Base64.decode(t.split("ssd://")[1])),n=r.port,o=r.encryption,i=r.password,a=r.servers,u=0;u1){var s,f=___createForOfIteratorHelper_38(t);try{for(f.s();!(s=f.n()).done;){var l=_slicedToArray(s.value.split("="),2),p=l[0],_=l[1];c[p]=_.trim()}}catch(h){f.e(h)}finally{f.f()}}return ___objectSpread_38(___objectSpread_38({},u),{},{name:c.remarks?_$base64_4.Base64.decode(c.remarks):u.server,"protocol-param":_$base64_4.Base64.decode(c.protoparam||"").replace(/\s/g,""),"obfs-param":_$base64_4.Base64.decode(c.obfsparam||"").replace(/\s/g,"")})}}),{name:"URI VMess Parser",test:function(t){return/^vmess:\/\//.test(t)},parse:function(t){t=t.split("vmess://")[1];var e=_$base64_4.Base64.decode(t);if(/=\s*vmess/.test(e)){var r,n=e.split(",").map((function(t){return t.trim()})),o={},i=___createForOfIteratorHelper_38(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(-1!==a.indexOf("=")){var u=_slicedToArray(a.split("="),2),c=u[0],s=u[1];o[c.trim()]=s.trim()}}}catch(h){i.e(h)}finally{i.f()}var f={name:n[0].split("=")[0].trim(),type:"vmess",server:n[1],port:n[2],cipher:n[3],uuid:n[4].match(/^"(.*)"$/)[1],tls:"over-tls"===o.obfs||"wss"===o.obfs};if(void 0!==o["udp-relay"]&&(f.udp=JSON.parse(o["udp-relay"])),void 0!==o["fast-open"]&&(f.udp=JSON.parse(o["fast-open"])),"ws"===o.obfs||"wss"===o.obfs){f.network="ws",f["ws-opts"].path=(o["obfs-path"]||'"/"').match(/^"(.*)"$/)[1];var l=o["obfs-header"];l&&-1!==l.indexOf("Host")&&(l=l.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),f["ws-opts"].headers={Host:l||f.server}}return f.tls&&"false"===o['"tls-verification"']&&(f["skip-cert-verify"]=!0),f.tls&&o["obfs-host"]&&(f.sni=o["obfs-host"]),f}var p=JSON.parse(e),_={name:p.ps,type:"vmess",server:p.add,port:p.port,cipher:"auto",uuid:p.id,alterId:p.aid||0,tls:"tls"===p.tls||!0===p.tls,supported:{}};return"ws"===p.net&&(_.network="ws",_["ws-opts"]={path:p.path,headers:{Host:p.host||p.add}},_.tls&&p.host&&(_.sni=p.host)),!1===p.verify_cert&&(_["skip-cert-verify"]=!0),_}},{name:"URI Trojan Parser",test:function(t){return/^trojan:\/\//.test(t)},parse:function(t){var e=_slicedToArray((t=t.split("trojan://")[1]).split("@")[1].split("?")[0].split(":"),2),r=e[0],n=e[1],o=decodeURIComponent(t.split("#")[1].trim()),i=t.split("?"),a=null;return i.length>1&&(i=i[1].split("#")[0].split("&"),a=new Map(i.map((function(t){return t.split("=")}))).get("sni")),{name:o||"[Trojan] ".concat(r),type:"trojan",server:r,port:n,password:t.split("@")[0],sni:a,supported:{}}}},{name:"Clash Parser",test:function(t){try{JSON.parse(t)}catch(e){return!1}return!0},parse:function(t){return JSON.parse(t)}},{name:"Surge SS Parser",test:function(t){return/^.*=\s*ss/.test(t.split(",")[0])},parse:function(t){var e=r(t),n={name:e.name,type:"ss",server:e.server,port:e.port,cipher:e["encrypt-method"],password:e.password,tfo:JSON.parse(e.tfo||"false"),udp:JSON.parse(e["udp-relay"]||"false")};return e.obfs&&(n.plugin="obfs",n["plugin-opts"]={mode:e.obfs,host:e["obfs-host"]}),n}},{name:"Surge VMess Parser",test:function(t){return/^.*=\s*vmess/.test(t.split(",")[0])&&-1!==t.indexOf("username")},parse:function(t){var e=r(t),n={name:e.name,type:"vmess",server:e.server,port:e.port,uuid:e.username,alterId:0,cipher:"none",tls:JSON.parse(e.tls||"false"),tfo:JSON.parse(e.tfo||"false")};if(n.tls&&(void 0!==e["skip-cert-verify"]&&(n["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),n.sni=e.sni||e.server),JSON.parse(e.ws||"false")){n.network="ws",n["ws-opts"]={path:e["ws-path"]};var o=e["ws-headers"].match(/(,|^|\s)*HOST:\s*(.*?)(,|$)/),i=o?o[2]:n.server;n["ws-opts"].headers={Host:i||e.server}}return n}},{name:"Surge Trojan Parser",test:function(t){return/^.*=\s*trojan/.test(t.split(",")[0])&&-1!==t.indexOf("sni")},parse:function(t){var e=r(t),n={name:e.name,type:"trojan",server:e.server,port:e.port,password:e.password,sni:e.sni||e.server,tfo:JSON.parse(e.tfo||"false")};return void 0!==e["skip-cert-verify"]&&(n["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),n}},{name:"Surge HTTP Parser",test:function(t){return/^.*=\s*https?/.test(t.split(",")[0])&&!e().test(t)},parse:function(t){var e=r(t),n=/^.*?=\s?https/.test(t),o={name:e.name,type:"http",server:e.server,port:e.port,tls:JSON.parse(n||"false"),tfo:JSON.parse(e.tfo||"false")};return o.tls&&(void 0!==e["skip-cert-verify"]&&(o["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),o.sni=e.sni||e.server),e.username&&"none"!==e.username&&(o.username=e.username),e.password&&"none"!==e.password&&(o.password=e.password),o}},{name:"Loon SS Parser",test:function(t){return"shadowsocks"===t.split(",")[0].split("=")[1].trim().toLowerCase()},parse:function(t){var e=t.split("=")[1].split(","),r={name:t.split("=")[0].trim(),type:"ss",server:e[1],port:e[2],cipher:e[3],password:e[4].replace(/"/g,"")};return e.length>5&&(r.plugin="obfs",r["plugin-opts"]={mode:e[5],host:e[6]}),r}},{name:"Loon SSR Parser",test:function(t){return"shadowsocksr"===t.split(",")[0].split("=")[1].trim().toLowerCase()},parse:function(t){var e=t.split("=")[1].split(",");return{name:t.split("=")[0].trim(),type:"ssr",server:e[1],port:e[2],cipher:e[3],password:e[4].replace(/"/g,""),protocol:e[5],"protocol-param":e[6].match(/{(.*)}/)[1],supported:{Surge:!1},obfs:e[7],"obfs-param":e[8].match(/{(.*)}/)[1]}}},{name:"Loon VMess Parser",test:function(t){return/^.*=\s*vmess/i.test(t.split(",")[0])&&-1===t.indexOf("username")},parse:function(t){var e,r=t.split("=")[1].split(","),n={name:t.split("=")[0].trim(),type:"vmess",server:r[1],port:r[2],cipher:r[3]||"none",uuid:r[4].replace(/"/g,""),alterId:0},o=___createForOfIteratorHelper_38(r=r.splice(5));try{for(o.s();!(e=o.n()).done;){var i=_slicedToArray(e.value.split(":"),2),a=i[0],u=i[1];r[a]=u}}catch(c){o.e(c)}finally{o.f()}switch(n.tls=JSON.parse(r["over-tls"]||"false"),n.tls&&(n.sni=r["tls-name"]||n.server,n["skip-cert-verify"]=JSON.parse(r["skip-cert-verify"]||"false")),r.transport){case"tcp":break;case"ws":n.network=r.transport,n["ws-opts"]={path:r.path,headers:{Host:r.host}}}return n.tls&&(n["skip-cert-verify"]=JSON.parse(r["skip-cert-verify"]||"false")),n}},{name:"Loon Trojan Parser",test:function(t){return/^.*=\s*trojan/i.test(t.split(",")[0])&&-1===t.indexOf("password")},parse:function(t){var e=t.split("=")[1].split(","),r={name:t.split("=")[0].trim(),type:"trojan",server:e[1],port:e[2],password:e[3].replace(/"/g,""),sni:e[1],"skip-cert-verify":JSON.parse(e["skip-cert-verify"]||"false")};if(e.length>4){var n=_slicedToArray(e[4].split(":"),2),o=n[0],i=n[1];if("tls-name"!==o)throw new Error("Unknown option ".concat(o," for line: \n").concat(t));r.sni=i}return r}},e(),{name:"QX SS Parser",test:function(t){return/^shadowsocks\s*=/.test(t.split(",")[0].trim())&&-1===t.indexOf("ssr-protocol")},parse:function(e){var r=t(e),n={name:r.tag,type:"ss",server:r.server,port:r.port,cipher:r.method,password:r.password,udp:JSON.parse(r["udp-relay"]||"false"),tfo:JSON.parse(r["fast-open"]||"false"),supported:{}};if(r.obfs)switch(n["plugin-opts"]={host:r["obfs-host"]||n.server},r.obfs){case"http":case"tls":n.plugin="obfs",n["plugin-opts"].mode=r.obfs;break;case"ws":case"wss":n["plugin-opts"]=___objectSpread_38(___objectSpread_38({},n["plugin-opts"]),{},{mode:"websocket",path:r["obfs-uri"]||"/",tls:"wss"===r.obfs}),n["plugin-opts"].tls&&void 0!==r["tls-verification"]&&(n["plugin-opts"]["skip-cert-verify"]=r["tls-verification"]),n.plugin="v2ray-plugin",n.supported.Surge=!1,n.supported.Loon=!1}return n}},{name:"QX SSR Parser",test:function(t){return/^shadowsocks\s*=/.test(t.split(",")[0].trim())&&-1!==t.indexOf("ssr-protocol")},parse:function(e){var r=t(e),n={name:r.tag,type:"ssr",server:r.server,port:r.port,cipher:r.method,password:r.password,protocol:r["ssr-protocol"],obfs:"plain","protocol-param":r["ssr-protocol-param"],udp:JSON.parse(r["udp-relay"]||"false"),tfo:JSON.parse(r["fast-open"]||"false"),supported:{Surge:!1}};return r.obfs&&(n.obfs=r.obfs,n["obfs-param"]=r["obfs-host"]),n}},{name:"QX VMess Parser",test:function(t){return/^vmess\s*=/.test(t.split(",")[0].trim())},parse:function(e){var r=t(e),n={type:"vmess",name:r.tag,server:r.server,port:r.port,cipher:r.method||"none",uuid:r.password,alterId:0,tls:"over-tls"===r.obfs||"wss"===r.obfs,udp:JSON.parse(r["udp-relay"]||"false"),tfo:JSON.parse(r["fast-open"]||"false")};return n.tls&&(n.sni=r["obfs-host"]||r.server,n["skip-cert-verify"]=!JSON.parse(r["tls-verification"]||"true")),"ws"!==r.obfs&&"wss"!==r.obfs||(n.network="ws",n["ws-opts"]={path:r["obfs-uri"],headers:{Host:r["obfs-host"]||r.server}}),n}},{name:"QX Trojan Parser",test:function(t){return/^trojan\s*=/.test(t.split(",")[0].trim())},parse:function(e){var r=t(e),n={type:"trojan",name:r.tag,server:r.server,port:r.port,password:r.password,sni:r["tls-host"]||r.server,udp:JSON.parse(r["udp-relay"]||"false"),tfo:JSON.parse(r["fast-open"]||"false")};return n["skip-cert-verify"]=!JSON.parse(r["tls-verification"]||"true"),n}},{name:"QX HTTP Parser",test:function(t){return/^http\s*=/.test(t.split(",")[0].trim())},parse:function(e){var r=t(e),n={type:"http",name:r.tag,server:r.server,port:r.port,tls:JSON.parse(r["over-tls"]||"false"),udp:JSON.parse(r["udp-relay"]||"false"),tfo:JSON.parse(r["fast-open"]||"false")};return r.username&&"none"!==r.username&&(n.username=r.username),r.password&&"none"!==r.password&&(n.password=r.password),n.tls&&(n.sni=r["tls-host"]||n.server,n["skip-cert-verify"]=!JSON.parse(r["tls-verification"]||"true")),n}}];var n}(),PROXY_PROCESSORS=function(){function t(t,e){for(var r=null,n=0;n1?e-1:0),n=1;n0&&void 0!==arguments[0])||arguments[0];return{name:"Flag Operator",func:function(e){return e.map((function(e){if(t){var r=(0,_$geo_48.getFlag)(e.name);e.name=removeFlag(e.name),e.name=r+" "+e.name,e.name=e.name.replace(/\ud83c\uddf9\ud83c\uddfc/g,"\ud83c\udde8\ud83c\uddf3")}else e.name=removeFlag(e.name);return e}))}}},"Sort Operator":function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"asc";return{name:"Sort Operator",func:function(e){switch(t){case"asc":case"desc":return e.sort((function(e,r){return(e.name>r.name?1:-1)*("desc"===t?-1:1)}));case"random":return function(t){for(var e,r,n=t.length;0!==n;)r=Math.floor(Math.random()*n),e=t[n-=1],t[n]=t[r],t[r]=e;return t}(e);default:throw new Error("Unknown sort option: "+t)}}}},"Regex Sort Operator":function(e){return{name:"Regex Sort Operator",func:function(r){return e=e.map((function(t){return n(t)})),r.sort((function(r,n){var o=t(e,r.name),i=t(e,n.name);return o&&!i?-1:i&&!o?1:o&&i?o1){void 0===s[t.name]&&(s[t.name]=1);for(var e="",r=s[t.name]++,n=0;r>0;)e=a[r%10]+e,r=parseInt(r/10),n++;for(;n++1&&void 0!==w[1]?w[1]:[],n=w.length>2?w[2]:void 0,o=___createForOfIteratorHelper_38(r),t.prev=3,o.s();case 5:if((i=o.n()).done){t.next=40;break}if(a=i.value,u=void 0,c={},-1===a.type.indexOf("Script")){t.next=29;break}if(s=a.args,f=s.mode,l=s.content,"link"!==f){t.next=28;break}if((_=(p=l).split("#")).length>1){h=___createForOfIteratorHelper_38(_[1].split("&"));try{for(h.s();!(d=h.n()).done;)v=d.value,y=v.split("=")[0],g=v.split("=")[1]||!0,c[y]=g}catch(b){h.e(b)}finally{h.f()}}return t.prev=15,t.next=18,(0,___download_38.default)(p.split("#")[0]);case 18:u=t.sent,_app.default.info("Script loaded: >>>\n ".concat(u)),t.next=26;break;case 22:return t.prev=22,t.t0=t.catch(15),_app.default.error("Error when downloading remote script: ".concat(a.args.content,".\n Reason: ").concat(t.t0)),t.abrupt("continue",38);case 26:t.next=29;break;case 28:u=l;case 29:if(PROXY_PROCESSORS[a.type]){t.next=32;break}return _app.default.error('Unknown operator: "'.concat(a.type,'"')),t.abrupt("continue",38);case 32:return _app.default.info('Applying "'.concat(a.type,'" with arguments:\n >>> ').concat(JSON.stringify(a.args,null,2)||"None")),m=void 0,m=-1!==a.type.indexOf("Script")?PROXY_PROCESSORS[a.type](u,n,c):PROXY_PROCESSORS[a.type](a.args),t.next=37,ApplyProcessor(m,e);case 37:e=t.sent;case 38:t.next=5;break;case 40:t.next=45;break;case 42:t.prev=42,t.t1=t.catch(3),o.e(t.t1);case 45:return t.prev=45,o.f(),t.finish(45);case 48:return t.abrupt("return",e);case 49:case"end":return t.stop()}}),t,null,[[3,42,45,48],[15,22]])})))).apply(this,arguments)}return{parse:function(e){e=function(t){var e,r=___createForOfIteratorHelper_38(PROXY_PREPROCESSORS);try{for(r.s();!(e=r.n()).done;){var n=e.value;try{if(n.test(t))return _app.default.info("Pre-processor [".concat(n.name,"] activated")),n.parse(t)}catch(o){_app.default.error("Parser [".concat(n.name,"] failed\n Reason: ").concat(o))}}}catch(i){r.e(i)}finally{r.f()}return t}(e);var r,n,o=[],i=___createForOfIteratorHelper_38(e.split("\n"));try{for(i.s();!(n=i.n()).done;){var a=n.value;if(0!==(a=a.trim()).length){var u=r&&t(r,a);if(!u){var c,s=___createForOfIteratorHelper_38(PROXY_PARSERS);try{for(s.s();!(c=s.n()).done;){var f=c.value;if(t(f,a)){r=f,u=!0,_app.default.info("Proxy parser: ".concat(f.name," is activated"));break}}}catch(p){s.e(p)}finally{s.f()}}if(u)try{var l=r.parse(a);l||_app.default.error("Parser ".concat(r.name," return nothing for \n").concat(a,"\n")),o.push(l)}catch(p){_app.default.error("Failed to parse line: \n ".concat(a,"\n Reason: ").concat(p.stack))}else _app.default.error("Failed to find a rule to parse line: \n".concat(a,"\n"))}}}catch(p){i.e(p)}finally{i.f()}return o},process:function(t){return e.apply(this,arguments)},produce:function(t,e){var r=PROXY_PRODUCERS[e];if(!r)throw new Error("Target platform: ".concat(e," is not supported!"));return t=t.filter((function(t){return!(t.supported&&!1===t.supported[e])})),_app.default.info("Producing proxies for target: ".concat(e)),void 0===r.type||"SINGLE"===r.type?t.map((function(t){try{return r.produce(t)}catch(e){return _app.default.error("Cannot produce proxy: ".concat(JSON.stringify(t,null,2),"\nReason: ").concat(e)),""}})).filter((function(t){return t.length>0})).join("\n"):"ALL"===r.type?r.produce(t):void 0}}}(),keys;function ApplyProcessor(t,e){return _ApplyProcessor.apply(this,arguments)}function _ApplyProcessor(){return(_ApplyProcessor=___asyncToGenerator_38(___regeneratorRuntime_38().mark((function t(e,r){var n,o,i,a;return ___regeneratorRuntime_38().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=function(){return(a=___asyncToGenerator_38(___regeneratorRuntime_38().mark((function t(e,r){var n,o;return ___regeneratorRuntime_38().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=r,n=JSON.parse(JSON.stringify(i)),t.prev=1,t.next=4,e.func(n);case 4:(o=t.sent)&&(n=o),t.next=11;break;case 8:t.prev=8,t.t0=t.catch(1),console.log("Cannot apply operator ".concat(e.name,"! Reason: ").concat(t.t0));case 11:return t.abrupt("return",n);case 12:case"end":return t.stop()}var i}),t,null,[[1,8]])})))).apply(this,arguments)},i=function(t,e){return a.apply(this,arguments)},o=function(){return(o=___asyncToGenerator_38(___regeneratorRuntime_38().mark((function t(e,r){var n;return ___regeneratorRuntime_38().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=(0,_$logical_51.FULL)(r.length,!0),t.prev=1,t.next=4,e.func(r);case 4:n=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.log("Cannot apply filter ".concat(e.name,"\n Reason: ").concat(t.t0));case 10:return t.abrupt("return",r.filter((function(t,e){return n[e]})));case 11:case"end":return t.stop()}}),t,null,[[1,7]])})))).apply(this,arguments)},n=function(t,e){return o.apply(this,arguments)},-1===e.name.indexOf("Filter")){t.next=8;break}return t.abrupt("return",n(e,r));case 8:if(-1===e.name.indexOf("Operator")){t.next=10;break}return t.abrupt("return",i(e,r));case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function removeFlag(t){return t.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/g,"").trim()}_$proxyUtils_38.ProxyUtils=ProxyUtils;var _$ruleUtils_39={};function ___typeof_39(t){return(___typeof_39="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(_$ruleUtils_39,"__esModule",{value:!0}),_$ruleUtils_39.RuleUtils=void 0;var ___staticJsYaml_39=___interopRequireDefault_39(_$staticJsYaml_36),___app_39=___interopRequireDefault_39(_$app_37);function ___interopRequireDefault_39(t){return t&&t.__esModule?t:{default:t}}function ___regeneratorRuntime_39(){___regeneratorRuntime_39=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(x){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(x){return{type:"throw",arg:x}}}t.wrap=c;var f={};function l(){}function p(){}function _(){}var h={};u(h,o,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(O([])));v&&v!==e&&r.call(v,o)&&(h=v);var y=_.prototype=l.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==___typeof_39(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_39(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function ___createForOfIteratorHelper_39(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_39(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_39(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_39(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r/.test(t)},parse:function(){return""}},{name:"Clash Provider",test:function(t){return 0===t.indexOf("payload:")},parse:function(t){return t.replace("payload:","").replace(/^\s*-\s*/gm,"")}}],RULE_PARSERS=[{name:"Universal Rule Parser",test:function(){return!0},parse:function(t){var e,r=[],n=___createForOfIteratorHelper_39(t.split("\n"));try{for(n.s();!(e=n.n()).done;){var o=e.value;if(0!==(o=o.trim()).length&&!/\s*#/.test(o))try{var i,a=o.split(",").map((function(t){return t.trim()})),u=a[0],c=!1,s=___createForOfIteratorHelper_39(RULE_TYPES_MAPPING);try{for(s.s();!(i=s.n()).done;){var f=i.value;if(f[0].test(u)){c=!0;var l={type:f[1],content:a[1]};"IP-CIDR"!==l.type&&"IP-CIDR6"!==l.type||(l.options=a.slice(2)),r.push(l)}}}catch(p){s.e(p)}finally{s.f()}if(!c)throw new Error("Invalid rule type: "+u)}catch(_){console.error("Failed to parse line: ".concat(o,"\n Reason: ").concat(_))}}}catch(p){n.e(p)}finally{n.f()}return r}}],RULE_PROCESSORS={"Regex Filter":function(t){var e=t.regex,r=void 0===e?[]:e,n=t.keep,o=void 0===n||n;return{name:"Regex Filter",func:function(t){return t.map((function(t){var e=r.some((function(e){return(e=new RegExp(e)).test(t)}));return o?e:!e}))}}},"Remove Duplicate Filter":function(){return{name:"Remove Duplicate Filter",func:function(t){var e=new Set,r=[];return t.forEach((function(t){var n=t.options||[];n.sort();var o="".concat(t.type,",").concat(t.content,",").concat(JSON.stringify(n));e.has(o)||(r.push(t),e.add(o))})),r}}},"Type Filter":function(t){return{name:"Type Filter",func:function(e){return e.map((function(e){return t.some((function(t){return e.type===t}))}))}}},"Regex Replace Operator":function(t){return{name:"Regex Rename Operator",func:function(e){return e.map((function(e){var r,n=___createForOfIteratorHelper_39(t);try{for(n.s();!(r=n.n()).done;){var o=r.value,i=o.expr,a=o.now;e.content=e.content.replace(new RegExp(i,"g"),a).trim()}}catch(u){n.e(u)}finally{n.f()}return e}))}}}},RULE_PRODUCERS={QX:{type:"SINGLE",func:function(t){return-1!==["URL-REGEX","DEST-PORT","SRC-IP","IN-PORT","PROTOCOL"].indexOf(t.type)?null:"".concat({"DOMAIN-KEYWORD":"HOST-KEYWORD","DOMAIN-SUFFIX":"HOST-SUFFIX",DOMAIN:"HOST","IP-CIDR6":"IP6-CIDR"}[t.type]||t.type,",").concat(t.content,",SUB-STORE")}},Surge:{type:"SINGLE",func:function(t){var e="".concat(t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(e+=t.options?",".concat(t.options[0]):""),e}},Loon:{type:"SINGLE",func:function(t){return-1!==["DEST-PORT","SRC-IP","IN-PORT","PROTOCOL"].indexOf(t.type)?null:function(t){var e="".concat(t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(e+=t.options?",".concat(t.options[0]):""),e}(t)}},Clash:{type:"ALL",func:function(t){var e={"DEST-PORT":"DST-PORT","SRC-IP":"SRC-IP-CIDR","IN-PORT":"SRC-PORT"},r={payload:t.map((function(t){var r="".concat(e[t.type]||t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(r+=t.options?",".concat(t.options[0]):""),r}))};return ___staticJsYaml_39.default.dump(r)}}},RuleUtils=function(){function t(){var e;return e=___regeneratorRuntime_39().mark((function t(e,r){var n,o,i,a;return ___regeneratorRuntime_39().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=___createForOfIteratorHelper_39(r),t.prev=1,n.s();case 3:if((o=n.n()).done){t.next=13;break}if(i=o.value,RULE_PROCESSORS[i.type]){t.next=8;break}return console.error("Unknown operator: ".concat(i.type,"!")),t.abrupt("continue",11);case 8:a=RULE_PROCESSORS[i.type](i.args),___app_39.default.info('Applying "'.concat(i.type,'" with arguments: \n >>> ').concat(JSON.stringify(i.args)||"None")),e=(0,_$proxyUtils_38.ApplyProcessor)(a,e);case 11:t.next=3;break;case 13:t.next=18;break;case 15:t.prev=15,t.t0=t.catch(1),n.e(t.t0);case 18:return t.prev=18,n.f(),t.finish(18);case 21:return t.abrupt("return",e);case 22:case"end":return t.stop()}}),t,null,[[1,15,18,21]])})),(t=function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(t){__asyncGeneratorStep_39(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_39(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}return{parse:function(t){t=function(t){var e,r=___createForOfIteratorHelper_39(RULE_PREPROCESSORS);try{for(r.s();!(e=r.n()).done;){var n=e.value;try{if(n.test(t))return ___app_39.default.info("Pre-processor [".concat(n.name,"] activated")),n.parse(t)}catch(o){___app_39.default.error("Parser [".concat(n.name,"] failed\n Reason: ").concat(o))}}}catch(i){r.e(i)}finally{r.f()}return t}(t);var e,r=___createForOfIteratorHelper_39(RULE_PARSERS);try{for(r.s();!(e=r.n()).done;){var n=e.value,o=void 0;try{o=n.test(t)}catch(i){o=!1}if(o)return ___app_39.default.info("Rule parser [".concat(n.name,"] is activated!")),n.parse(t)}}catch(i){r.e(i)}finally{r.f()}},process:function(e,r){return t.apply(this,arguments)},produce:function(t,e){var r=RULE_PRODUCERS[e];if(!r)throw new Error("Target platform: ".concat(e," is not supported!"));return void 0===r.type||"SINGLE"===r.type?t.map((function(t){try{return r.func(t)}catch(e){return console.log("ERROR: cannot produce rule: ".concat(JSON.stringify(t),"\nReason: ").concat(e)),""}})).filter((function(t){return t.length>0})).join("\n"):"ALL"===r.type?r.func(t):void 0}}}();_$ruleUtils_39.RuleUtils=RuleUtils;var _$artifacts_41={};function ___typeof_41(t){return(___typeof_41="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(_$artifacts_41,"__esModule",{value:!0}),_$artifacts_41.default=function(t){___app_41.default.read(_$constants_43.ARTIFACTS_KEY)||___app_41.default.write({},_$constants_43.ARTIFACTS_KEY),t.route("/api/artifacts").get(getAllArtifacts).post(createArtifact),t.route("/api/artifact/:name").get(getArtifact).patch(updateArtifact).delete(deleteArtifact),t.get("/api/cron/sync-artifacts",cronSyncArtifacts)},_$artifacts_41.produceArtifact=produceArtifact;var ___download_41=___interopRequireDefault_41(_$download_47),_gist=___interopRequireDefault_41(_$gist_49),___app_41=___interopRequireDefault_41(_$app_37);function ___interopRequireDefault_41(t){return t&&t.__esModule?t:{default:t}}function ___createForOfIteratorHelper_41(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_41(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_41(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_41(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __ownKeys_41(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ___objectSpread_41(t){for(var e=1;e>>")),console.log(JSON.stringify(a,null,2)),t.prev=26,t.next=29,syncArtifact(___defineProperty_41({},encodeURIComponent(a.name),{content:c}));case 29:s=t.sent,a.updated=(new Date).getTime(),f=JSON.parse(s.body),a.url=f.files[encodeURIComponent(a.name)].raw_url.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1"),___app_41.default.write(i,_$constants_43.ARTIFACTS_KEY),r.json({status:"success"}),t.next=40;break;case 37:t.prev=37,t.t1=t.catch(26),r.status(500).json({status:"failed",message:t.t1});case 40:t.next=43;break;case 42:r.json({status:"success",data:a});case 43:t.next=46;break;case 45:r.status(404).json({status:"failed",message:"\u672a\u627e\u5230\u5bf9\u5e94\u7684\u914d\u7f6e\uff01"});case 46:case"end":return t.stop()}}),t,null,[[26,37]])})))).apply(this,arguments)}function createArtifact(t,e){var r=t.body;___app_41.default.info("\u6b63\u5728\u521b\u5efa\u8fdc\u7a0b\u914d\u7f6e\uff1a".concat(r.name));var n=___app_41.default.read(_$constants_43.ARTIFACTS_KEY);n[r.name]?e.status(500).json({status:"failed",message:"\u8fdc\u7a0b\u914d\u7f6e".concat(r.name,"\u5df2\u5b58\u5728\uff01")}):(n[r.name]=r,___app_41.default.write(n,_$constants_43.ARTIFACTS_KEY),e.status(201).json({status:"success",data:r}))}function updateArtifact(t,e){var r=___app_41.default.read(_$constants_43.ARTIFACTS_KEY),n=t.params.name,o=r[n=decodeURIComponent(n)];if(o){___app_41.default.info("\u6b63\u5728\u66f4\u65b0\u8fdc\u7a0b\u914d\u7f6e\uff1a".concat(o.name));var i=t.body;if(void 0===i.name||/^[\w-_.]*$/.test(i.name)){var a=___objectSpread_41(___objectSpread_41({},o),i);r[a.name]=a,a.name!==n&&delete r[n],___app_41.default.write(r,_$constants_43.ARTIFACTS_KEY),e.json({status:"success",data:a})}else e.status(500).json({status:"failed",message:"\u8fdc\u7a0b\u914d\u7f6e\u540d\u79f0 ".concat(i.name," \u4e2d\u542b\u6709\u975e\u6cd5\u5b57\u7b26\uff01\u540d\u79f0\u4e2d\u53ea\u80fd\u5305\u542b\u82f1\u6587\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u4e0b\u5212\u7ebf\u3001\u6a2a\u6760\u3002")})}else e.status(404).json({status:"failed",message:"\u672a\u627e\u5230\u5bf9\u5e94\u7684\u8fdc\u7a0b\u914d\u7f6e\uff01"})}function cronSyncArtifacts(t,e){return _cronSyncArtifacts.apply(this,arguments)}function _cronSyncArtifacts(){return(_cronSyncArtifacts=___asyncToGenerator_41(___regeneratorRuntime_41().mark((function t(e,r){var n,o,i,a,u,c,s;return ___regeneratorRuntime_41().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ___app_41.default.info("\u5f00\u59cb\u540c\u6b65\u6240\u6709\u8fdc\u7a0b\u914d\u7f6e..."),n=___app_41.default.read(_$constants_43.ARTIFACTS_KEY),o={},t.prev=3,t.next=6,Promise.all(Object.values(n).map(function(){var t=___asyncToGenerator_41(___regeneratorRuntime_41().mark((function t(e){var r,n;return ___regeneratorRuntime_41().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.sync){t.next=15;break}___app_41.default.info("\u6b63\u5728\u540c\u6b65\u4e91\u914d\u7f6e\uff1a".concat(e.name,"...")),t.t0=e.type,t.next="subscription"===t.t0?5:"collection"===t.t0?7:"rule"===t.t0?9:11;break;case 5:return r=___app_41.default.read(_$constants_43.SUBS_KEY)[e.source],t.abrupt("break",11);case 7:return r=___app_41.default.read(_$constants_43.COLLECTIONS_KEY)[e.source],t.abrupt("break",11);case 9:return r=___app_41.default.read(_$constants_43.RULES_KEY)[e.source],t.abrupt("break",11);case 11:return t.next=13,produceArtifact({type:e.type,item:r,platform:e.platform});case 13:n=t.sent,o[e.name]={content:n};case 15:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 6:return t.next=8,syncArtifact(o);case 8:for(i=t.sent,a=JSON.parse(i.body),u=0,c=Object.values(n);u=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __ownKeys_46(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ___objectSpread_46(t){for(var e=1;e=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __ownKeys_42(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ___objectSpread_42(t){for(var e=1;e0)){t.next=16;break}if("local"===(l=s[f[0]]).source){t.next=16;break}return t.next=14,(0,_$subscriptions_46.getFlowHeaders)(l.url);case 14:(p=t.sent)&&r.set("subscription-userinfo",p);case 16:if(!c){t.next=30;break}return t.prev=17,t.next=20,(0,_$artifacts_41.produceArtifact)({type:"collection",item:c,platform:a,noProcessor:i});case 20:_=t.sent,"JSON"===a?r.set("Content-Type","application/json;charset=utf-8").send(_):r.send(_),t.next=28;break;case 24:t.prev=24,t.t0=t.catch(17),___app_42.default.notify("\ud83c\udf0d \u300e \ud835\udc7a\ud835\udc96\ud835\udc83-\ud835\udc7a\ud835\udc95\ud835\udc90\ud835\udc93\ud835\udc86 \u300f \u4e0b\u8f7d\u7ec4\u5408\u8ba2\u9605\u5931\u8d25","\u274c \u4e0b\u8f7d\u7ec4\u5408\u8ba2\u9605\u9519\u8bef\uff1a".concat(n,"\uff01"),"\ud83e\udd14 \u539f\u56e0\uff1a".concat(t.t0)),r.status(500).json({status:"failed",message:t.t0});case 28:t.next=32;break;case 30:___app_42.default.notify("\ud83c\udf0d \u300e \ud835\udc7a\ud835\udc96\ud835\udc83-\ud835\udc7a\ud835\udc95\ud835\udc90\ud835\udc93\ud835\udc86 \u300f \u4e0b\u8f7d\u7ec4\u5408\u8ba2\u9605\u5931\u8d25","\u274c \u672a\u627e\u5230\u7ec4\u5408\u8ba2\u9605\uff1a".concat(n,"\uff01")),r.status(404).json({status:"failed"});case 32:case"end":return t.stop()}}),t,null,[[17,24]])})),(_downloadCollection=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_42(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_42(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}function createCollection(t,e){var r=t.body;___app_42.default.info("\u6b63\u5728\u521b\u5efa\u7ec4\u5408\u8ba2\u9605\uff1a".concat(r.name));var n=___app_42.default.read(_$constants_43.COLLECTIONS_KEY);n[r.name]&&e.status(500).json({status:"failed",message:"\u8ba2\u9605\u96c6".concat(r.name,"\u5df2\u5b58\u5728\uff01")}),n[r.name]=r,___app_42.default.write(n,_$constants_43.COLLECTIONS_KEY),e.status(201).json({status:"success",data:r})}function getCollection(t,e){var r=t.params.name;r=decodeURIComponent(r);var n=___app_42.default.read(_$constants_43.COLLECTIONS_KEY)[r];n?e.json({status:"success",data:n}):e.status(404).json({status:"failed",message:"\u672a\u627e\u5230\u8ba2\u9605\u96c6\uff1a".concat(r,"!")})}function updateCollection(t,e){var r=t.params.name;r=decodeURIComponent(r);var n=t.body,o=___app_42.default.read(_$constants_43.COLLECTIONS_KEY);if(o[r]){var i=___objectSpread_42(___objectSpread_42({},o[r]),n);___app_42.default.info("\u6b63\u5728\u66f4\u65b0\u7ec4\u5408\u8ba2\u9605\uff1a".concat(r,"...")),delete o[r],o[n.name||r]=i,___app_42.default.write(o,_$constants_43.COLLECTIONS_KEY),e.json({status:"success",data:i})}else e.status(500).json({status:"failed",message:"\u8ba2\u9605\u96c6".concat(r,"\u4e0d\u5b58\u5728\uff0c\u65e0\u6cd5\u66f4\u65b0\uff01")})}function deleteCollection(t,e){var r=t.params.name;r=decodeURIComponent(r),___app_42.default.info("\u6b63\u5728\u5220\u9664\u7ec4\u5408\u8ba2\u9605\uff1a".concat(r));var n=___app_42.default.read(_$constants_43.COLLECTIONS_KEY);delete n[r],___app_42.default.write(n,_$constants_43.COLLECTIONS_KEY),e.json({status:"success"})}function getAllCollections(t,e){var r=___app_42.default.read(_$constants_43.COLLECTIONS_KEY);e.json({status:"success",data:r})}var _$settings_45={};Object.defineProperty(_$settings_45,"__esModule",{value:!0}),_$settings_45.default=function(t){___app_45.default.read(_$constants_43.SETTINGS_KEY)||___app_45.default.write({},_$constants_43.SETTINGS_KEY),t.route("/api/settings").get(getSettings).patch(updateSettings)};var __obj_45,___app_45=(__obj_45=_$app_37)&&__obj_45.__esModule?__obj_45:{default:__obj_45};function __ownKeys_45(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ___objectSpread_45(t){for(var e=1;e=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_44(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function ___asyncToGenerator_44(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_44(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_44(i,n,o,a,u,"throw",t)}a(void 0)}))}}function getEnv(t,e){var r=(0,_$openApi_53.ENV)(),n="Node";r.isNode&&(n="Node"),r.isQX&&(n="QX"),r.isLoon&&(n="Loon"),r.isSurge&&(n="Surge"),e.json({backend:n})}function gistBackup(t,e){return _gistBackup.apply(this,arguments)}function _gistBackup(){return(_gistBackup=___asyncToGenerator_44(___regeneratorRuntime_44().mark((function t(e,r){var n,o,i,a,u,c,s;return ___regeneratorRuntime_44().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.query.action,o=___app_44.default.read(_$constants_43.SETTINGS_KEY),i=o.gistToken){t.next=6;break}r.status(500).json({status:"failed",message:"\u672a\u627e\u5230Gist\u5907\u4efdToken!"}),t.next=35;break;case 6:a=new ___gist_44.default({token:i,key:_$constants_43.GIST_BACKUP_KEY}),t.prev=7,c=___app_44.default.read(_$constants_43.SETTINGS_KEY),t.t0=n,t.next="upload"===t.t0?12:"download"===t.t0?20:27;break;case 12:return c.syncTime=(new Date).getTime(),___app_44.default.write(c,_$constants_43.SETTINGS_KEY),u=___app_44.default.read("#sub-store"),___app_44.default.env.isNode&&(u=JSON.stringify(___app_44.default.cache,null," ")),___app_44.default.info("\u4e0a\u4f20\u5907\u4efd\u4e2d..."),t.next=19,a.upload((f={},l=_$constants_43.GIST_BACKUP_FILE_NAME,p={content:u},l in f?Object.defineProperty(f,l,{value:p,enumerable:!0,configurable:!0,writable:!0}):f[l]=p,f));case 19:return t.abrupt("break",27);case 20:return ___app_44.default.info("\u8fd8\u539f\u5907\u4efd\u4e2d..."),t.next=23,a.download(_$constants_43.GIST_BACKUP_FILE_NAME);case 23:return u=t.sent,___app_44.default.write(u,"#sub-store"),___app_44.default.env.isNode&&(u=JSON.parse(u),Object.keys(u).forEach((function(t){___app_44.default.write(u[t],t)}))),t.abrupt("break",27);case 27:r.json({status:"success"}),t.next=35;break;case 30:t.prev=30,t.t1=t.catch(7),s="".concat("upload"===n?"\u4e0a\u4f20":"\u4e0b\u8f7d","\u5907\u4efd\u5931\u8d25\uff01").concat(t.t1),___app_44.default.error(s),r.status(500).json({status:"failed",message:s});case 35:case"end":return t.stop()}var f,l,p}),t,null,[[7,30]])})))).apply(this,arguments)}var _$main_40={},__obj_40,_restful=(__obj_40=_$restful_44)&&__obj_40.__esModule?__obj_40:{default:__obj_40};console.log("\n\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\n \ud835\udc7a\ud835\udc96\ud835\udc83-\ud835\udc7a\ud835\udc95\ud835\udc90\ud835\udc93\ud835\udc86 \xa9 \ud835\udc77\ud835\udc86\ud835\udc8f\ud835\udc88-\ud835\udc80\ud835\udc74\n\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\n"),(0,_restful.default)()}(); \ No newline at end of file +!function(){var createModuleFactory=function(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}},_$buffer_2=createModuleFactory((function(t,e){(function(t){(function(){"use strict";e.Buffer=r,e.SlowBuffer=function(t){return+t!=t&&(t=0),r.alloc(+t)},e.INSPECT_MAX_BYTES=50;function t(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=r.prototype,e}function r(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return i(t)}return n(t,e,r)}function n(e,n,o){if("string"==typeof e)return function(e,n){if("string"==typeof n&&""!==n||(n="utf8"),!r.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o=0|c(e,n),i=t(o),a=i.write(e,n);return a!==o&&(i=i.slice(0,a)),i}(e,n);if(ArrayBuffer.isView(e))return a(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(P(e,ArrayBuffer)||e&&P(e.buffer,ArrayBuffer))return function(t,e,n){if(e<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function c(t,e){if(r.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||P(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return R(t).length;default:if(i)return o?-1:j(t).length;e=(""+e).toLowerCase(),i=!0}}function s(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function f(t,e,n,o,i){if(0===t.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),N(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=r.from(e,o)),r.isBuffer(e))return 0===e.length?-1:l(t,e,n,o,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):l(t,[e],n,o,i);throw new TypeError("val must be string, number or Buffer")}function l(t,e,r,n,o){var i,a=1,u=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,u/=2,c/=2,r/=2}function s(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){var f=-1;for(i=r;iu&&(r=u-c),i=r;i>=0;i--){for(var l=!0,p=0;po&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function g(t,e,r){return 0===e&&r===t.length?_$base64Js_1.fromByteArray(t):_$base64Js_1.fromByteArray(t.slice(e,r))}function m(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:s>223?3:s>191?2:1;if(o+l<=r)switch(l){case 1:s<128&&(f=s);break;case 2:128==(192&(i=t[o+1]))&&(c=(31&s)<<6|63&i)>127&&(f=c);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(c=(15&s)<<12|(63&i)<<6|63&a)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:i=t[o+1],a=t[o+2],u=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(c=(15&s)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&c<1114112&&(f=c)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=l}return function(t){var e=t.length;if(e<=w)return String.fromCharCode.apply(String,t);for(var r="",n=0;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return m(this,e,r);case"ascii":return b(this,e,r);case"latin1":case"binary":return E(this,e,r);case"base64":return g(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=function(t){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===r.compare(this,t)},r.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),""},r.prototype.compare=function(t,e,n,o,i){if(P(t,Uint8Array)&&(t=r.from(t,t.offset,t.byteLength)),!r.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),e<0||n>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=n)return 0;if(o>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var a=(i>>>=0)-(o>>>=0),u=(n>>>=0)-(e>>>=0),c=Math.min(a,u),s=this.slice(o,i),f=t.slice(e,n),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return p(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return h(this,t,e,r);case"latin1":case"binary":return d(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function b(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;oo)&&(r=o);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,n,o,i,a){if(!r.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function T(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,4),_$ieee754_3.write(t,e,r,n,23,4),r+4}function k(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,8),_$ieee754_3.write(t,e,r,n,52,8),r+8}r.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,r||A(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||A(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},r.prototype.readUInt8=function(t,e){return t>>>=0,e||A(t,1,this.length),this[t]},r.prototype.readUInt16LE=function(t,e){return t>>>=0,e||A(t,2,this.length),this[t]|this[t+1]<<8},r.prototype.readUInt16BE=function(t,e){return t>>>=0,e||A(t,2,this.length),this[t]<<8|this[t+1]},r.prototype.readUInt32LE=function(t,e){return t>>>=0,e||A(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},r.prototype.readUInt32BE=function(t,e){return t>>>=0,e||A(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},r.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||A(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},r.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||A(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},r.prototype.readInt8=function(t,e){return t>>>=0,e||A(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},r.prototype.readInt16LE=function(t,e){t>>>=0,e||A(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt16BE=function(t,e){t>>>=0,e||A(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},r.prototype.readInt32LE=function(t,e){return t>>>=0,e||A(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},r.prototype.readInt32BE=function(t,e){return t>>>=0,e||A(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},r.prototype.readFloatLE=function(t,e){return t>>>=0,e||A(t,4,this.length),_$ieee754_3.read(this,t,!0,23,4)},r.prototype.readFloatBE=function(t,e){return t>>>=0,e||A(t,4,this.length),_$ieee754_3.read(this,t,!1,23,4)},r.prototype.readDoubleLE=function(t,e){return t>>>=0,e||A(t,8,this.length),_$ieee754_3.read(this,t,!0,52,8)},r.prototype.readDoubleBE=function(t,e){return t>>>=0,e||A(t,8,this.length),_$ieee754_3.read(this,t,!1,52,8)},r.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},r.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,255,0),this[e]=255&t,e+1},r.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},r.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=0,a=1,u=0;for(this[e]=255&t;++i>0)-u&255;return e+r},r.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=r-1,a=1,u=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/a>>0)-u&255;return e+r},r.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},r.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},r.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},r.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},r.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},r.prototype.writeFloatLE=function(t,e,r){return T(this,t,e,!0,r)},r.prototype.writeFloatBE=function(t,e,r){return T(this,t,e,!1,r)},r.prototype.writeDoubleLE=function(t,e,r){return k(this,t,e,!0,r)},r.prototype.writeDoubleBE=function(t,e,r){return k(this,t,e,!1,r)},r.prototype.copy=function(t,e,n,o){if(!r.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),o||0===o||(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e=0;--a)t[a+e]=this[a+n];else Uint8Array.prototype.set.call(t,this.subarray(n,o),e);return i},r.prototype.fill=function(t,e,n,o){if("string"==typeof t){if("string"==typeof e?(o=e,e=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!r.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){var i=t.charCodeAt(0);("utf8"===o&&i<128||"latin1"===o)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function R(t){return _$base64Js_1.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function I(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function P(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function N(t){return t!=t}}).call(this)}).call(this,_$buffer_2({}).Buffer)})),_$constants_50={};Object.defineProperty(_$constants_50,"__esModule",{value:!0}),_$constants_50.SUBS_KEY=_$constants_50.SETTINGS_KEY=_$constants_50.GIST_BACKUP_KEY=_$constants_50.GIST_BACKUP_FILE_NAME=_$constants_50.COLLECTIONS_KEY=_$constants_50.ARTIFACT_REPOSITORY_KEY=_$constants_50.ARTIFACTS_KEY=void 0,_$constants_50.SETTINGS_KEY="settings",_$constants_50.SUBS_KEY="subs",_$constants_50.COLLECTIONS_KEY="collections",_$constants_50.ARTIFACTS_KEY="artifacts",_$constants_50.GIST_BACKUP_KEY="Auto Generated Sub-Store Backup",_$constants_50.GIST_BACKUP_FILE_NAME="Sub-Store",_$constants_50.ARTIFACT_REPOSITORY_KEY="Sub-Store Artifacts Repository";var _$openApi_60={};function _typeof(t){return(_typeof="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 ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(t){for(var e=1;e=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){asyncGeneratorStep(i,n,o,a,u,"next",t)}function u(t){asyncGeneratorStep(i,n,o,a,u,"throw",t)}a(void 0)}))}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:"untitled",debug=arguments.length>1&&void 0!==arguments[1]&&arguments[1];_classCallCheck(this,OpenAPI),this.name=name,this.debug=debug,this.http=HTTP(),this.env=ENV(),this.node=function(){if(isNode){var fs=eval("require('fs')");return{fs:fs}}return null}(),this.initCache();var delay=function(t,e){return new Promise((function(r){setTimeout(r.bind(null,e),t)}))},_ref;Promise.prototype.delay=(_ref=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){var r;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this;case 2:return r=t.sent,t.next=5,delay(e,r);case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return _ref.apply(this,arguments)})}return _createClass(OpenAPI,[{key:"initCache",value:function(){if(isQX&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(isLoon||isSurge)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),isNode){var t="root.json";this.node.fs.existsSync(t)||this.node.fs.writeFileSync(t,JSON.stringify({}),{flag:"wx"},(function(t){return console.log(t)})),this.root={},t="".concat(this.name,".json"),this.node.fs.existsSync(t)?this.cache=JSON.parse(this.node.fs.readFileSync("".concat(this.name,".json"))):(this.node.fs.writeFileSync(t,JSON.stringify({}),{flag:"wx"},(function(t){return console.log(t)})),this.cache={})}}},{key:"persistCache",value:function(){var t=JSON.stringify(this.cache,null,2);isQX&&$prefs.setValueForKey(t,this.name),(isLoon||isSurge)&&$persistentStore.write(t,this.name),isNode&&(this.node.fs.writeFileSync("".concat(this.name,".json"),t,{flag:"w"},(function(t){return console.log(t)})),this.node.fs.writeFileSync("root.json",JSON.stringify(this.root,null,2),{flag:"w"},(function(t){return console.log(t)})))}},{key:"write",value:function(t,e){if(this.log("SET ".concat(e)),-1!==e.indexOf("#")){if(e=e.substr(1),isSurge||isLoon)return $persistentStore.write(t,e);if(isQX)return $prefs.setValueForKey(t,e);isNode&&(this.root[e]=t)}else this.cache[e]=t;this.persistCache()}},{key:"read",value:function(t){return this.log("READ ".concat(t)),-1===t.indexOf("#")?this.cache[t]:(t=t.substr(1),isSurge||isLoon?$persistentStore.read(t):isQX?$prefs.valueForKey(t):isNode?this.root[t]:void 0)}},{key:"delete",value:function(t){if(this.log("DELETE ".concat(t)),-1!==t.indexOf("#")){if(t=t.substr(1),isSurge||isLoon)return $persistentStore.write(null,t);if(isQX)return $prefs.removeValueForKey(t);isNode&&delete this.root[t]}else delete this.cache[t];this.persistCache()}},{key:"notify",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n["open-url"],i=n["media-url"];if(isQX&&$notify(t,e,r,n),isSurge&&$notification.post(t,e,r+"".concat(i?"\n\u591a\u5a92\u4f53:"+i:""),{url:o}),isLoon){var a={};o&&(a.openUrl=o),i&&(a.mediaUrl=i),"{}"===JSON.stringify(a)?$notification.post(t,e,r):$notification.post(t,e,r,a)}if(isNode){var u=r+(o?"\n\u70b9\u51fb\u8df3\u8f6c: ".concat(o):"")+(i?"\n\u591a\u5a92\u4f53: ".concat(i):"");console.log("".concat(t,"\n").concat(e,"\n").concat(u,"\n\n"))}}},{key:"log",value:function(t){this.debug&&console.log("[".concat(this.name,"] LOG: ").concat(t))}},{key:"info",value:function(t){console.log("[".concat(this.name,"] INFO: ").concat(t))}},{key:"error",value:function(t){console.log("[".concat(this.name,"] ERROR: ").concat(t))}},{key:"wait",value:function(t){return new Promise((function(e){return setTimeout(e,t)}))}},{key:"done",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};isQX||isLoon||isSurge?$done(t):isNode&&"undefined"!=typeof $context&&($context.headers=t.headers,$context.statusCode=t.statusCode,$context.body=t.body)}}]),OpenAPI}();function ENV(){return{isQX:isQX,isLoon:isLoon,isSurge:isSurge,isNode:isNode}}function HTTP(){var defaultOptions=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{baseURL:""},_ENV=ENV(),isQX=_ENV.isQX,isLoon=_ENV.isLoon,isSurge=_ENV.isSurge,isNode=_ENV.isNode,methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],URL_REGEX=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;function send(method,options){options="string"==typeof options?{url:options}:options;var baseURL=defaultOptions.baseURL;baseURL&&!URL_REGEX.test(options.url||"")&&(options.url=baseURL?baseURL+options.url:options.url),options=_objectSpread(_objectSpread({},defaultOptions),options);var timeout=options.timeout,events=_objectSpread(_objectSpread({},{onRequest:function(){},onResponse:function(t){return t},onTimeout:function(){}}),options.events),worker,timeoutid;events.onRequest(method,options),isQX?worker=$task.fetch({method:method,url:options.url,headers:options.headers,body:options.body}):(isLoon||isSurge||isNode)&&(worker=new Promise((function(resolve,reject){var request=isNode?eval("require('request')"):$httpClient;request[method.toLowerCase()](options,(function(t,e,r){t?reject(t):resolve({statusCode:e.status||e.statusCode,headers:e.headers,body:r})}))})));var timer=timeout?new Promise((function(t,e){timeoutid=setTimeout((function(){return events.onTimeout(),e("".concat(method," URL: ").concat(options.url," exceeds the timeout ").concat(timeout," ms"))}),timeout)})):null;return(timer?Promise.race([timer,worker]).then((function(t){return clearTimeout(timeoutid),t})):worker).then((function(t){return events.onResponse(t)}))}var http={};return methods.forEach((function(t){return http[t.toLowerCase()]=function(e){return send(t,e)}})),http}_$openApi_60.OpenAPI=OpenAPI;var _$express_59={};function ___classCallCheck_59(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ___defineProperties_59(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:0,n=e.method,o=e.url,i=e.headers,a=e.body;/json/i.test(i["Content-Type"])&&(a=JSON.parse(a)),n=n.toUpperCase();var u,c=extractURL(o),s=c.path,f=c.query,l=null,p=0;for(u=r;up&&(l=handlers[u],p=_.split("/").length)}if(l){var h=function(){t(n,o,u)},d={method:n,url:o,path:s,query:f,params:extractPathParams(l.pattern,s),headers:i,body:a},v=Response(),y=l.callback,g=function(t){v.status(500).json({status:"failed",message:"Internal Server Error: ".concat(t)})};if("AsyncFunction"===y.constructor.name)y(d,v,h).catch(g);else try{y(d,v,h)}catch(m){g(m)}}else Response().status(404).json({status:"failed",message:"ERROR: 404 not found"})},app={};return METHODS_NAMES.forEach((function(t){app[t.toLowerCase()]=function(e,r){handlers.push({method:t,pattern:e,callback:r})}})),app.route=function(t){var e={};return METHODS_NAMES.forEach((function(r){e[r.toLowerCase()]=function(n){return handlers.push({method:r,pattern:t,callback:n}),e}})),e},app.start=function(){dispatch($request)},app;function rawBodySaver(t,e,r,n){r&&r.length&&(t.rawBody=r.toString(n||"utf8"))}function Response(){var t=200,e=(0,_$openApi_60.ENV)(),r=e.isQX,n=e.isLoon,o=e.isSurge,i=DEFAULT_HEADERS,a={200:"HTTP/1.1 200 OK",201:"HTTP/1.1 201 Created",302:"HTTP/1.1 302 Found",307:"HTTP/1.1 307 Temporary Redirect",308:"HTTP/1.1 308 Permanent Redirect",404:"HTTP/1.1 404 Not Found",500:"HTTP/1.1 500 Internal Server Error"};return new(function(){function e(){___classCallCheck_59(this,e)}return ___createClass_59(e,[{key:"status",value:function(e){return t=e,this}},{key:"send",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",u={status:r?a[t]:t,body:e,headers:i};r?$done(u):(n||o)&&$done({response:u})}},{key:"end",value:function(){this.send()}},{key:"html",value:function(t){this.set("Content-Type","text/html;charset=UTF-8"),this.send(t)}},{key:"json",value:function(t){this.set("Content-Type","application/json;charset=UTF-8"),this.send(JSON.stringify(t))}},{key:"set",value:function(t,e){return i[t]=e,this}}]),e}())}}function patternMatched(t,e){if(t instanceof RegExp&&t.test(e))return!0;if("/"===t)return!0;if(-1===t.indexOf(":")){for(var r=e.split("/"),n=t.split("/"),o=0;o=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_57(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function _IP_API(){var t;return t=___regeneratorRuntime_57().mark((function t(e,r){var n,o,i;return ___regeneratorRuntime_57().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=decodeURIComponent(e.params.server),o=(0,_$openApi_60.HTTP)(),t.next=4,o.get("http://ip-api.com/json/".concat(n,"?lang=zh-CN")).then((function(t){return JSON.parse(t.body)}));case 4:i=t.sent,r.json(i);case 6:case"end":return t.stop()}}),t)})),(_IP_API=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_57(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_57(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}Object.defineProperty(_$ipApi_57,"__esModule",{value:!0}),_$ipApi_57.default=function(t,e){return _IP_API.apply(this,arguments)};var _$gist_56={};function ___typeof_56(t){return(___typeof_56="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 ___regeneratorRuntime_56(){___regeneratorRuntime_56=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(x){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(x){return{type:"throw",arg:x}}}t.wrap=c;var f={};function l(){}function p(){}function _(){}var h={};u(h,o,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(O([])));v&&v!==e&&r.call(v,o)&&(h=v);var y=_.prototype=l.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==___typeof_56(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function _createForOfIteratorHelper(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_54(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}Object.defineProperty(_$download_54,"__esModule",{value:!0}),_$download_54.default=function(t,e){return _download.apply(this,arguments)};var cache=new Map;function _download(){var t;return t=___regeneratorRuntime_54().mark((function t(e,r){var n,o,i;return ___regeneratorRuntime_54().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=(r=r||"Quantumult%20X/1.0.29 (iPhone14,5; iOS 15.4.1)")+e,!cache.has(n)){t.next=4;break}return t.abrupt("return",cache.get(n));case 4:return o=(0,_$openApi_60.HTTP)({headers:{"User-Agent":r}}),i=new Promise((function(t,r){o.get(e).then((function(e){var n=e.body;0===n.replace(/\s/g,"").length?r(new Error("\u8ba2\u9605\u5185\u5bb9\u4e3a\u7a7a\uff01")):t(n)}))})),cache.set(n,i),t.abrupt("return",i);case 8:case"end":return t.stop()}}),t)})),(_download=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_54(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_54(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}var _$logical_58={};function ___arrayLikeToArray_58(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r"']/g,P=RegExp(R.source),N=RegExp(I.source),$=/<%-([\s\S]+?)%>/g,F=/<%([\s\S]+?)%>/g,U=/<%=([\s\S]+?)%>/g,D=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,M=/^\w*$/,B=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,G=/[\\^$.*+?()[\]{}|]/g,H=RegExp(G.source),Y=/^\s+/,K=/\s/,W=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,q=/\{\n\/\* \[wrapped with (.+)\] \*/,J=/,? & /,z=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,X=/[()=,{}\[\]\/\s]/,Q=/\\(\\)?/g,V=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Z=/\w*$/,tt=/^[-+]0x[0-9a-f]+$/i,et=/^0b[01]+$/i,rt=/^\[object .+?Constructor\]$/,nt=/^0o[0-7]+$/i,ot=/^(?:0|[1-9]\d*)$/,it=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,at=/($^)/,ut=/['\n\r\u2028\u2029\\]/g,ct="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",st="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ft="["+st+"]",lt="["+ct+"]",pt="\\d+",_t="[a-z\\xdf-\\xf6\\xf8-\\xff]",ht="[^\\ud800-\\udfff"+st+pt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",dt="\\ud83c[\\udffb-\\udfff]",vt="[^\\ud800-\\udfff]",yt="(?:\\ud83c[\\udde6-\\uddff]){2}",gt="[\\ud800-\\udbff][\\udc00-\\udfff]",mt="[A-Z\\xc0-\\xd6\\xd8-\\xde]",wt="(?:"+_t+"|"+ht+")",bt="(?:"+mt+"|"+ht+")",Et="(?:"+lt+"|"+dt+")?",St="[\\ufe0e\\ufe0f]?"+Et+"(?:\\u200d(?:"+[vt,yt,gt].join("|")+")[\\ufe0e\\ufe0f]?"+Et+")*",Ot="(?:"+["[\\u2700-\\u27bf]",yt,gt].join("|")+")"+St,At="(?:"+[vt+lt+"?",lt,yt,gt,"[\\ud800-\\udfff]"].join("|")+")",xt=RegExp("['\u2019]","g"),Lt=RegExp(lt,"g"),Tt=RegExp(dt+"(?="+dt+")|"+At+St,"g"),kt=RegExp([mt+"?"+_t+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?="+[ft,mt,"$"].join("|")+")",bt+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?="+[ft,mt+wt,"$"].join("|")+")",mt+"?"+wt+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?",mt+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",pt,Ot].join("|"),"g"),Ct=RegExp("[\\u200d\\ud800-\\udfff"+ct+"\\ufe0e\\ufe0f]"),jt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],It=-1,Pt={};Pt[b]=Pt[E]=Pt[S]=Pt[O]=Pt[A]=Pt[x]=Pt["[object Uint8ClampedArray]"]=Pt[L]=Pt[T]=!0,Pt[o]=Pt[i]=Pt[m]=Pt[a]=Pt[w]=Pt[u]=Pt[c]=Pt[s]=Pt[l]=Pt[p]=Pt[_]=Pt[h]=Pt[d]=Pt[v]=Pt[g]=!1;var Nt={};Nt[o]=Nt[i]=Nt[m]=Nt[w]=Nt[a]=Nt[u]=Nt[b]=Nt[E]=Nt[S]=Nt[O]=Nt[A]=Nt[l]=Nt[p]=Nt[_]=Nt[h]=Nt[d]=Nt[v]=Nt[y]=Nt[x]=Nt["[object Uint8ClampedArray]"]=Nt[L]=Nt[T]=!0,Nt[c]=Nt[s]=Nt[g]=!1;var $t={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ft=parseFloat,Ut=parseInt,Dt="object"==typeof t&&t&&t.Object===Object&&t,Mt="object"==typeof self&&self&&self.Object===Object&&self,Bt=Dt||Mt||Function("return this")(),Gt="object"==typeof _$lodash_35.exports&&_$lodash_35.exports&&!_$lodash_35.exports.nodeType&&_$lodash_35.exports,Ht=Gt&&_$lodash_35&&!_$lodash_35.nodeType&&_$lodash_35,Yt=Ht&&Ht.exports===Gt,Kt=Yt&&Dt.process,Wt=function(){try{return Ht&&Ht.require&&Ht.require("util").types||Kt&&Kt.binding&&Kt.binding("util")}catch(t){}}(),qt=Wt&&Wt.isArrayBuffer,Jt=Wt&&Wt.isDate,zt=Wt&&Wt.isMap,Xt=Wt&&Wt.isRegExp,Qt=Wt&&Wt.isSet,Vt=Wt&&Wt.isTypedArray;function Zt(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function te(t,e,r,n){for(var o=-1,i=null==t?0:t.length;++o-1}function ae(t,e,r){for(var n=-1,o=null==t?0:t.length;++n-1;);return r}function ke(t,e){for(var r=t.length;r--&&de(e,t[r],0)>-1;);return r}var Ce=we({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),je=we({"&":"&","<":"<",">":">",'"':""","'":"'"});function Re(t){return"\\"+$t[t]}function Ie(t){return Ct.test(t)}function Pe(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function Ne(t,e){return function(r){return t(e(r))}}function $e(t,e){for(var n=-1,o=t.length,i=0,a=[];++n",""":'"',"'":"'"}),He=function t(K){var ct,st=(K=null==K?Bt:He.defaults(Bt.Object(),K,He.pick(Bt,Rt))).Array,ft=K.Date,lt=K.Error,pt=K.Function,_t=K.Math,ht=K.Object,dt=K.RegExp,vt=K.String,yt=K.TypeError,gt=st.prototype,mt=pt.prototype,wt=ht.prototype,bt=K["__core-js_shared__"],Et=mt.toString,St=wt.hasOwnProperty,Ot=0,At=(ct=/[^.]+$/.exec(bt&&bt.keys&&bt.keys.IE_PROTO||""))?"Symbol(src)_1."+ct:"",Tt=wt.toString,Ct=Et.call(ht),$t=Bt._,Dt=dt("^"+Et.call(St).replace(G,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mt=Yt?K.Buffer:void 0,Gt=K.Symbol,Ht=K.Uint8Array,Kt=Mt?Mt.allocUnsafe:void 0,Wt=Ne(ht.getPrototypeOf,ht),pe=ht.create,we=wt.propertyIsEnumerable,Ye=gt.splice,Ke=Gt?Gt.isConcatSpreadable:void 0,We=Gt?Gt.iterator:void 0,qe=Gt?Gt.toStringTag:void 0,Je=function(){try{var t=Zo(ht,"defineProperty");return t({},"",{}),t}catch(e){}}(),ze=K.clearTimeout!==Bt.clearTimeout&&K.clearTimeout,Xe=ft&&ft.now!==Bt.Date.now&&ft.now,Qe=K.setTimeout!==Bt.setTimeout&&K.setTimeout,Ve=_t.ceil,Ze=_t.floor,tr=ht.getOwnPropertySymbols,er=Mt?Mt.isBuffer:void 0,rr=K.isFinite,nr=gt.join,or=Ne(ht.keys,ht),ir=_t.max,ar=_t.min,ur=ft.now,cr=K.parseInt,sr=_t.random,fr=gt.reverse,lr=Zo(K,"DataView"),pr=Zo(K,"Map"),_r=Zo(K,"Promise"),hr=Zo(K,"Set"),dr=Zo(K,"WeakMap"),vr=Zo(ht,"create"),yr=dr&&new dr,gr={},mr=Ai(lr),wr=Ai(pr),br=Ai(_r),Er=Ai(hr),Sr=Ai(dr),Or=Gt?Gt.prototype:void 0,Ar=Or?Or.valueOf:void 0,xr=Or?Or.toString:void 0;function Lr(t){if(Ga(t)&&!ja(t)&&!(t instanceof jr)){if(t instanceof Cr)return t;if(St.call(t,"__wrapped__"))return xi(t)}return new Cr(t)}var Tr=function(){function t(){}return function(e){if(!Ba(e))return{};if(pe)return pe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function kr(){}function Cr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function jr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Rr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function zr(t,e,r,n,i,c){var g,k=1&e,C=2&e,j=4&e;if(r&&(g=i?r(t,n,i,c):r(t)),void 0!==g)return g;if(!Ba(t))return t;var R=ja(t);if(R){if(g=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&St.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!k)return yo(t,g)}else{var I=ri(t),P=I==s||I==f;if(Na(t))return fo(t,k);if(I==_||I==o||P&&!i){if(g=C||P?{}:oi(t),!k)return C?function(t,e){return go(t,ei(t),e)}(t,function(t,e){return t&&go(e,mu(e),t)}(g,t)):function(t,e){return go(t,ti(t),e)}(t,Kr(g,t))}else{if(!Nt[I])return i?t:{};g=function(t,e,r){var n,o,i,c=t.constructor;switch(e){case m:return lo(t);case a:case u:return new c(+t);case w:return function(t,e){var r=e?lo(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case b:case E:case S:case O:case A:case x:case"[object Uint8ClampedArray]":case L:case T:return po(t,r);case l:return new c;case p:case v:return new c(t);case h:return(i=new(o=t).constructor(o.source,Z.exec(o))).lastIndex=o.lastIndex,i;case d:return new c;case y:return n=t,Ar?ht(Ar.call(n)):{}}}(t,I,k)}}c||(c=new $r);var N=c.get(t);if(N)return N;c.set(t,g),qa(t)?t.forEach((function(n){g.add(zr(n,e,r,n,t,c))})):Ha(t)&&t.forEach((function(n,o){g.set(o,zr(n,e,r,o,t,c))}));var $=R?void 0:(j?C?Wo:Ko:C?mu:gu)(t);return ee($||t,(function(n,o){$&&(n=t[o=n]),Gr(g,o,zr(n,e,r,o,t,c))})),g}function Xr(t,e,r){var n=r.length;if(null==t)return!n;for(t=ht(t);n--;){var o=r[n],i=e[o],a=t[o];if(void 0===a&&!(o in t)||!i(a))return!1}return!0}function Qr(t,r,n){if("function"!=typeof t)throw new yt(e);return gi((function(){t.apply(void 0,n)}),r)}function Vr(t,e,r,n){var o=-1,i=ie,a=!0,u=t.length,c=[],s=e.length;if(!u)return c;r&&(e=ue(e,Ae(r))),n?(i=ae,a=!1):e.length>=200&&(i=Le,a=!1,e=new Nr(e));t:for(;++o-1},Ir.prototype.set=function(t,e){var r=this.__data__,n=Hr(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},Pr.prototype.clear=function(){this.size=0,this.__data__={hash:new Rr,map:new(pr||Ir),string:new Rr}},Pr.prototype.delete=function(t){var e=Qo(this,t).delete(t);return this.size-=e?1:0,e},Pr.prototype.get=function(t){return Qo(this,t).get(t)},Pr.prototype.has=function(t){return Qo(this,t).has(t)},Pr.prototype.set=function(t,e){var r=Qo(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},Nr.prototype.add=Nr.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Nr.prototype.has=function(t){return this.__data__.has(t)},$r.prototype.clear=function(){this.__data__=new Ir,this.size=0},$r.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},$r.prototype.get=function(t){return this.__data__.get(t)},$r.prototype.has=function(t){return this.__data__.has(t)},$r.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Ir){var n=r.__data__;if(!pr||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Pr(n)}return r.set(t,e),this.size=r.size,this};var Zr=bo(cn),tn=bo(sn,!0);function en(t,e){var r=!0;return Zr(t,(function(t,n,o){return r=!!e(t,n,o)})),r}function rn(t,e,r){for(var n=-1,o=t.length;++n0&&r(u)?e>1?on(u,e-1,r,n,o):ce(o,u):n||(o[o.length]=u)}return o}var an=Eo(),un=Eo(!0);function cn(t,e){return t&&an(t,e,gu)}function sn(t,e){return t&&un(t,e,gu)}function fn(t,e){return oe(e,(function(e){return Ua(t[e])}))}function ln(t,e){for(var r=0,n=(e=ao(e,t)).length;null!=t&&re}function dn(t,e){return null!=t&&St.call(t,e)}function vn(t,e){return null!=t&&e in ht(t)}function yn(t,e,r){for(var n=r?ae:ie,o=t[0].length,i=t.length,a=i,u=st(i),c=1/0,s=[];a--;){var f=t[a];a&&e&&(f=ue(f,Ae(e))),c=ar(f.length,c),u[a]=!r&&(e||o>=120&&f.length>=120)?new Nr(a&&f):void 0}f=t[0];var l=-1,p=u[0];t:for(;++l=u?c:c*("desc"==r[n]?-1:1)}return t.index-e.index}(t,e,r)}));n--;)t[n]=t[n].value;return t}(xn(t,(function(t,r,o){return{criteria:ue(e,(function(e){return e(t)})),index:++n,value:t}})))}function Rn(t,e,r){for(var n=-1,o=e.length,i={};++n-1;)u!==t&&Ye.call(u,c,1),Ye.call(t,c,1);return t}function Pn(t,e){for(var r=t?e.length:0,n=r-1;r--;){var o=e[r];if(r==n||o!==i){var i=o;ai(o)?Ye.call(t,o,1):Vn(t,o)}}return t}function Nn(t,e){return t+Ze(sr()*(e-t+1))}function $n(t,e){var r="";if(!t||e<1||e>9007199254740991)return r;do{e%2&&(r+=t),(e=Ze(e/2))&&(t+=t)}while(e);return r}function Fn(t,e){return mi(hi(t,e,Yu),t+"")}function Un(t){return Ur(Lu(t))}function Dn(t,e){var r=Lu(t);return Ei(r,Jr(e,0,r.length))}function Mn(t,e,r,n){if(!Ba(t))return t;for(var o=-1,i=(e=ao(e,t)).length,a=i-1,u=t;null!=u&&++oo?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=st(o);++n>>1,a=t[i];null!==a&&!za(a)&&(r?a<=e:a=200){var s=e?null:Fo(t);if(s)return Fe(s);a=!1,o=Le,c=new Nr}else c=e?[]:u;t:for(;++n=n?t:Yn(t,e,r)}var so=ze||function(t){return Bt.clearTimeout(t)};function fo(t,e){if(e)return t.slice();var r=t.length,n=Kt?Kt(r):new t.constructor(r);return t.copy(n),n}function lo(t){var e=new t.constructor(t.byteLength);return new Ht(e).set(new Ht(t)),e}function po(t,e){var r=e?lo(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function _o(t,e){if(t!==e){var r=void 0!==t,n=null===t,o=t==t,i=za(t),a=void 0!==e,u=null===e,c=e==e,s=za(e);if(!u&&!s&&!i&&t>e||i&&a&&c&&!u&&!s||n&&a&&c||!r&&c||!o)return 1;if(!n&&!i&&!s&&t1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,a&&ui(r[0],r[1],a)&&(i=o<3?void 0:i,o=1),e=ht(e);++n-1?o[i?e[a]:a]:void 0}}function Lo(t){return Yo((function(r){var n=r.length,o=n,i=Cr.prototype.thru;for(t&&r.reverse();o--;){var a=r[o];if("function"!=typeof a)throw new yt(e);if(i&&!u&&"wrapper"==Jo(a))var u=new Cr([],!0)}for(o=u?o:n;++o1&&g.reverse(),f&&cu))return!1;var s=i.get(t),f=i.get(e);if(s&&f)return s==e&&f==t;var l=-1,p=!0,_=2&r?new Nr:void 0;for(i.set(t,e),i.set(e,t);++l-1&&t%1==0&&t1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(W,"{\n/* [wrapped with "+e+"] */\n")}(o,function(t,e){return ee(n,(function(r){var n="_."+r[0];e&r[1]&&!ie(t,n)&&t.push(n)})),t.sort()}(function(t){var e=t.match(q);return e?e[1].split(J):[]}(o),r)))}function bi(t){var e=0,r=0;return function(){var n=ur(),o=16-(n-r);if(r=n,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Ei(t,e){var r=-1,n=t.length,o=n-1;for(e=void 0===e?n:e;++r1?t[e-1]:void 0;return r="function"==typeof r?(t.pop(),r):void 0,Wi(t,r)}));function Zi(t){var e=Lr(t);return e.__chain__=!0,e}function ta(t,e){return e(t)}var ea=Yo((function(t){var e=t.length,r=e?t[0]:0,n=this.__wrapped__,o=function(e){return qr(e,t)};return!(e>1||this.__actions__.length)&&n instanceof jr&&ai(r)?((n=n.slice(r,+r+(e?1:0))).__actions__.push({func:ta,args:[o],thisArg:void 0}),new Cr(n,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(o)})),ra=mo((function(t,e,r){St.call(t,r)?++t[r]:Wr(t,r,1)})),na=xo(Ci),oa=xo(ji);function ia(t,e){return(ja(t)?ee:Zr)(t,Xo(e,3))}function aa(t,e){return(ja(t)?re:tn)(t,Xo(e,3))}var ua=mo((function(t,e,r){St.call(t,r)?t[r].push(e):Wr(t,r,[e])})),ca=Fn((function(t,e,r){var n=-1,o="function"==typeof e,i=Ia(t)?st(t.length):[];return Zr(t,(function(t){i[++n]=o?Zt(e,t,r):gn(t,e,r)})),i})),sa=mo((function(t,e,r){Wr(t,r,e)}));function fa(t,e){return(ja(t)?ue:xn)(t,Xo(e,3))}var la=mo((function(t,e,r){t[r?0:1].push(e)}),(function(){return[[],[]]})),pa=Fn((function(t,e){if(null==t)return[];var r=e.length;return r>1&&ui(t,e[0],e[1])?e=[]:r>2&&ui(e[0],e[1],e[2])&&(e=[e[0]]),jn(t,on(e,1),[])})),_a=Xe||function(){return Bt.Date.now()};function ha(t,e,r){return e=r?void 0:e,Do(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function da(t,r){var n;if("function"!=typeof r)throw new yt(e);return t=eu(t),function(){return--t>0&&(n=r.apply(this,arguments)),t<=1&&(r=void 0),n}}var va=Fn((function(t,e,r){var n=1;if(r.length){var o=$e(r,zo(va));n|=32}return Do(t,n,e,r,o)})),ya=Fn((function(t,e,r){var n=3;if(r.length){var o=$e(r,zo(ya));n|=32}return Do(e,n,t,r,o)}));function ga(t,r,n){var o,i,a,u,c,s,f=0,l=!1,p=!1,_=!0;if("function"!=typeof t)throw new yt(e);function h(e){var r=o,n=i;return o=i=void 0,f=e,u=t.apply(n,r)}function d(t){var e=t-s;return void 0===s||e>=r||e<0||p&&t-f>=a}function v(){var t=_a();if(d(t))return y(t);c=gi(v,function(t){var e=r-(t-s);return p?ar(e,a-(t-f)):e}(t))}function y(t){return c=void 0,_&&o?h(t):(o=i=void 0,u)}function g(){var t=_a(),e=d(t);if(o=arguments,i=this,s=t,e){if(void 0===c)return function(t){return f=t,c=gi(v,r),l?h(t):u}(s);if(p)return so(c),c=gi(v,r),h(s)}return void 0===c&&(c=gi(v,r)),u}return r=nu(r)||0,Ba(n)&&(l=!!n.leading,a=(p="maxWait"in n)?ir(nu(n.maxWait)||0,r):a,_="trailing"in n?!!n.trailing:_),g.cancel=function(){void 0!==c&&so(c),f=0,o=s=i=c=void 0},g.flush=function(){return void 0===c?u:y(_a())},g}var ma=Fn((function(t,e){return Qr(t,1,e)})),wa=Fn((function(t,e,r){return Qr(t,nu(e)||0,r)}));function ba(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new yt(e);var n=function(){var e=arguments,o=r?r.apply(this,e):e[0],i=n.cache;if(i.has(o))return i.get(o);var a=t.apply(this,e);return n.cache=i.set(o,a)||i,a};return n.cache=new(ba.Cache||Pr),n}function Ea(t){if("function"!=typeof t)throw new yt(e);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ba.Cache=Pr;var Sa=uo((function(t,e){var r=(e=1==e.length&&ja(e[0])?ue(e[0],Ae(Xo())):ue(on(e,1),Ae(Xo()))).length;return Fn((function(n){for(var o=-1,i=ar(n.length,r);++o=e})),Ca=mn(function(){return arguments}())?mn:function(t){return Ga(t)&&St.call(t,"callee")&&!we.call(t,"callee")},ja=st.isArray,Ra=qt?Ae(qt):function(t){return Ga(t)&&_n(t)==m};function Ia(t){return null!=t&&Ma(t.length)&&!Ua(t)}function Pa(t){return Ga(t)&&Ia(t)}var Na=er||nc,$a=Jt?Ae(Jt):function(t){return Ga(t)&&_n(t)==u};function Fa(t){if(!Ga(t))return!1;var e=_n(t);return e==c||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Ka(t)}function Ua(t){if(!Ba(t))return!1;var e=_n(t);return e==s||e==f||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Da(t){return"number"==typeof t&&t==eu(t)}function Ma(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Ba(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ga(t){return null!=t&&"object"==typeof t}var Ha=zt?Ae(zt):function(t){return Ga(t)&&ri(t)==l};function Ya(t){return"number"==typeof t||Ga(t)&&_n(t)==p}function Ka(t){if(!Ga(t)||_n(t)!=_)return!1;var e=Wt(t);if(null===e)return!0;var r=St.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Et.call(r)==Ct}var Wa=Xt?Ae(Xt):function(t){return Ga(t)&&_n(t)==h},qa=Qt?Ae(Qt):function(t){return Ga(t)&&ri(t)==d};function Ja(t){return"string"==typeof t||!ja(t)&&Ga(t)&&_n(t)==v}function za(t){return"symbol"==typeof t||Ga(t)&&_n(t)==y}var Xa=Vt?Ae(Vt):function(t){return Ga(t)&&Ma(t.length)&&!!Pt[_n(t)]},Qa=Po(An),Va=Po((function(t,e){return t<=e}));function Za(t){if(!t)return[];if(Ia(t))return Ja(t)?Me(t):yo(t);if(We&&t[We])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[We]());var e=ri(t);return(e==l?Pe:e==d?Fe:Lu)(t)}function tu(t){return t?(t=nu(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function eu(t){var e=tu(t),r=e%1;return e==e?r?e-r:e:0}function ru(t){return t?Jr(eu(t),0,4294967295):0}function nu(t){if("number"==typeof t)return t;if(za(t))return NaN;if(Ba(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ba(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Oe(t);var r=et.test(t);return r||nt.test(t)?Ut(t.slice(2),r?2:8):tt.test(t)?NaN:+t}function ou(t){return go(t,mu(t))}function iu(t){return null==t?"":Xn(t)}var au=wo((function(t,e){if(li(e)||Ia(e))go(e,gu(e),t);else for(var r in e)St.call(e,r)&&Gr(t,r,e[r])})),uu=wo((function(t,e){go(e,mu(e),t)})),cu=wo((function(t,e,r,n){go(e,mu(e),t,n)})),su=wo((function(t,e,r,n){go(e,gu(e),t,n)})),fu=Yo(qr),lu=Fn((function(t,e){t=ht(t);var r=-1,n=e.length,o=n>2?e[2]:void 0;for(o&&ui(e[0],e[1],o)&&(n=1);++r1),e})),go(t,Wo(t),r),n&&(r=zr(r,7,Go));for(var o=e.length;o--;)Vn(r,e[o]);return r})),Su=Yo((function(t,e){return null==t?{}:function(t,e){return Rn(t,e,(function(e,r){return hu(t,r)}))}(t,e)}));function Ou(t,e){if(null==t)return{};var r=ue(Wo(t),(function(t){return[t]}));return e=Xo(e),Rn(t,r,(function(t,r){return e(t,r[0])}))}var Au=Uo(gu),xu=Uo(mu);function Lu(t){return null==t?[]:xe(t,gu(t))}var Tu=Oo((function(t,e,r){return e=e.toLowerCase(),t+(r?ku(e):e)}));function ku(t){return Fu(iu(t).toLowerCase())}function Cu(t){return(t=iu(t))&&t.replace(it,Ce).replace(Lt,"")}var ju=Oo((function(t,e,r){return t+(r?"-":"")+e.toLowerCase()})),Ru=Oo((function(t,e,r){return t+(r?" ":"")+e.toLowerCase()})),Iu=So("toLowerCase"),Pu=Oo((function(t,e,r){return t+(r?"_":"")+e.toLowerCase()})),Nu=Oo((function(t,e,r){return t+(r?" ":"")+Fu(e)})),$u=Oo((function(t,e,r){return t+(r?" ":"")+e.toUpperCase()})),Fu=So("toUpperCase");function Uu(t,e,r){return t=iu(t),void 0===(e=r?void 0:e)?function(t){return jt.test(t)}(t)?function(t){return t.match(kt)||[]}(t):function(t){return t.match(z)||[]}(t):t.match(e)||[]}var Du=Fn((function(t,e){try{return Zt(t,void 0,e)}catch(r){return Fa(r)?r:new lt(r)}})),Mu=Yo((function(t,e){return ee(e,(function(e){e=Oi(e),Wr(t,e,va(t[e],t))})),t}));function Bu(t){return function(){return t}}var Gu=Lo(),Hu=Lo(!0);function Yu(t){return t}function Ku(t){return Sn("function"==typeof t?t:zr(t,1))}var Wu=Fn((function(t,e){return function(r){return gn(r,t,e)}})),qu=Fn((function(t,e){return function(r){return gn(t,r,e)}}));function Ju(t,e,r){var n=gu(e),o=fn(e,n);null!=r||Ba(e)&&(o.length||!n.length)||(r=e,e=t,t=this,o=fn(e,gu(e)));var i=!(Ba(r)&&"chain"in r&&!r.chain),a=Ua(t);return ee(o,(function(r){var n=e[r];t[r]=n,a&&(t.prototype[r]=function(){var e=this.__chain__;if(i||e){var r=t(this.__wrapped__);return(r.__actions__=yo(this.__actions__)).push({func:n,args:arguments,thisArg:t}),r.__chain__=e,r}return n.apply(t,ce([this.value()],arguments))})})),t}function zu(){}var Xu=jo(ue),Qu=jo(ne),Vu=jo(le);function Zu(t){return ci(t)?me(Oi(t)):function(t){return function(e){return ln(e,t)}}(t)}var tc=Io(),ec=Io(!0);function rc(){return[]}function nc(){return!1}var oc,ic=Co((function(t,e){return t+e}),0),ac=$o("ceil"),uc=Co((function(t,e){return t/e}),1),cc=$o("floor"),sc=Co((function(t,e){return t*e}),1),fc=$o("round"),lc=Co((function(t,e){return t-e}),0);return Lr.after=function(t,r){if("function"!=typeof r)throw new yt(e);return t=eu(t),function(){if(--t<1)return r.apply(this,arguments)}},Lr.ary=ha,Lr.assign=au,Lr.assignIn=uu,Lr.assignInWith=cu,Lr.assignWith=su,Lr.at=fu,Lr.before=da,Lr.bind=va,Lr.bindAll=Mu,Lr.bindKey=ya,Lr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return ja(t)?t:[t]},Lr.chain=Zi,Lr.chunk=function(t,e,r){e=(r?ui(t,e,r):void 0===e)?1:ir(eu(e),0);var n=null==t?0:t.length;if(!n||e<1)return[];for(var o=0,i=0,a=st(Ve(n/e));oo?0:o+r),(n=void 0===n||n>o?o:eu(n))<0&&(n+=o),n=r>n?0:ru(n);r>>0)?(t=iu(t))&&("string"==typeof e||null!=e&&!Wa(e))&&!(e=Xn(e))&&Ie(t)?co(Me(t),0,r):t.split(e,r):[]},Lr.spread=function(t,r){if("function"!=typeof t)throw new yt(e);return r=null==r?0:ir(eu(r),0),Fn((function(e){var n=e[r],o=co(e,0,r);return n&&ce(o,n),Zt(t,this,o)}))},Lr.tail=function(t){var e=null==t?0:t.length;return e?Yn(t,1,e):[]},Lr.take=function(t,e,r){return t&&t.length?Yn(t,0,(e=r||void 0===e?1:eu(e))<0?0:e):[]},Lr.takeRight=function(t,e,r){var n=null==t?0:t.length;return n?Yn(t,(e=n-(e=r||void 0===e?1:eu(e)))<0?0:e,n):[]},Lr.takeRightWhile=function(t,e){return t&&t.length?to(t,Xo(e,3),!1,!0):[]},Lr.takeWhile=function(t,e){return t&&t.length?to(t,Xo(e,3)):[]},Lr.tap=function(t,e){return e(t),t},Lr.throttle=function(t,r,n){var o=!0,i=!0;if("function"!=typeof t)throw new yt(e);return Ba(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),ga(t,r,{leading:o,maxWait:r,trailing:i})},Lr.thru=ta,Lr.toArray=Za,Lr.toPairs=Au,Lr.toPairsIn=xu,Lr.toPath=function(t){return ja(t)?ue(t,Oi):za(t)?[t]:yo(Si(iu(t)))},Lr.toPlainObject=ou,Lr.transform=function(t,e,r){var n=ja(t),o=n||Na(t)||Xa(t);if(e=Xo(e,4),null==r){var i=t&&t.constructor;r=o?n?new i:[]:Ba(t)&&Ua(i)?Tr(Wt(t)):{}}return(o?ee:cn)(t,(function(t,n,o){return e(r,t,n,o)})),r},Lr.unary=function(t){return ha(t,1)},Lr.union=Gi,Lr.unionBy=Hi,Lr.unionWith=Yi,Lr.uniq=function(t){return t&&t.length?Qn(t):[]},Lr.uniqBy=function(t,e){return t&&t.length?Qn(t,Xo(e,2)):[]},Lr.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Qn(t,void 0,e):[]},Lr.unset=function(t,e){return null==t||Vn(t,e)},Lr.unzip=Ki,Lr.unzipWith=Wi,Lr.update=function(t,e,r){return null==t?t:Zn(t,e,io(r))},Lr.updateWith=function(t,e,r,n){return n="function"==typeof n?n:void 0,null==t?t:Zn(t,e,io(r),n)},Lr.values=Lu,Lr.valuesIn=function(t){return null==t?[]:xe(t,mu(t))},Lr.without=qi,Lr.words=Uu,Lr.wrap=function(t,e){return Oa(io(e),t)},Lr.xor=Ji,Lr.xorBy=zi,Lr.xorWith=Xi,Lr.zip=Qi,Lr.zipObject=function(t,e){return no(t||[],e||[],Gr)},Lr.zipObjectDeep=function(t,e){return no(t||[],e||[],Mn)},Lr.zipWith=Vi,Lr.entries=Au,Lr.entriesIn=xu,Lr.extend=uu,Lr.extendWith=cu,Ju(Lr,Lr),Lr.add=ic,Lr.attempt=Du,Lr.camelCase=Tu,Lr.capitalize=ku,Lr.ceil=ac,Lr.clamp=function(t,e,r){return void 0===r&&(r=e,e=void 0),void 0!==r&&(r=(r=nu(r))==r?r:0),void 0!==e&&(e=(e=nu(e))==e?e:0),Jr(nu(t),e,r)},Lr.clone=function(t){return zr(t,4)},Lr.cloneDeep=function(t){return zr(t,5)},Lr.cloneDeepWith=function(t,e){return zr(t,5,e="function"==typeof e?e:void 0)},Lr.cloneWith=function(t,e){return zr(t,4,e="function"==typeof e?e:void 0)},Lr.conformsTo=function(t,e){return null==e||Xr(t,e,gu(e))},Lr.deburr=Cu,Lr.defaultTo=function(t,e){return null==t||t!=t?e:t},Lr.divide=uc,Lr.endsWith=function(t,e,r){t=iu(t),e=Xn(e);var n=t.length,o=r=void 0===r?n:Jr(eu(r),0,n);return(r-=e.length)>=0&&t.slice(r,o)==e},Lr.eq=La,Lr.escape=function(t){return(t=iu(t))&&N.test(t)?t.replace(I,je):t},Lr.escapeRegExp=function(t){return(t=iu(t))&&H.test(t)?t.replace(G,"\\$&"):t},Lr.every=function(t,e,r){var n=ja(t)?ne:en;return r&&ui(t,e,r)&&(e=void 0),n(t,Xo(e,3))},Lr.find=na,Lr.findIndex=Ci,Lr.findKey=function(t,e){return _e(t,Xo(e,3),cn)},Lr.findLast=oa,Lr.findLastIndex=ji,Lr.findLastKey=function(t,e){return _e(t,Xo(e,3),sn)},Lr.floor=cc,Lr.forEach=ia,Lr.forEachRight=aa,Lr.forIn=function(t,e){return null==t?t:an(t,Xo(e,3),mu)},Lr.forInRight=function(t,e){return null==t?t:un(t,Xo(e,3),mu)},Lr.forOwn=function(t,e){return t&&cn(t,Xo(e,3))},Lr.forOwnRight=function(t,e){return t&&sn(t,Xo(e,3))},Lr.get=_u,Lr.gt=Ta,Lr.gte=ka,Lr.has=function(t,e){return null!=t&&ni(t,e,dn)},Lr.hasIn=hu,Lr.head=Ii,Lr.identity=Yu,Lr.includes=function(t,e,r,n){t=Ia(t)?t:Lu(t),r=r&&!n?eu(r):0;var o=t.length;return r<0&&(r=ir(o+r,0)),Ja(t)?r<=o&&t.indexOf(e,r)>-1:!!o&&de(t,e,r)>-1},Lr.indexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=null==r?0:eu(r);return o<0&&(o=ir(n+o,0)),de(t,e,o)},Lr.inRange=function(t,e,r){return e=tu(e),void 0===r?(r=e,e=0):r=tu(r),function(t,e,r){return t>=ar(e,r)&&t=-9007199254740991&&t<=9007199254740991},Lr.isSet=qa,Lr.isString=Ja,Lr.isSymbol=za,Lr.isTypedArray=Xa,Lr.isUndefined=function(t){return void 0===t},Lr.isWeakMap=function(t){return Ga(t)&&ri(t)==g},Lr.isWeakSet=function(t){return Ga(t)&&"[object WeakSet]"==_n(t)},Lr.join=function(t,e){return null==t?"":nr.call(t,e)},Lr.kebabCase=ju,Lr.last=Fi,Lr.lastIndexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=n;return void 0!==r&&(o=(o=eu(r))<0?ir(n+o,0):ar(o,n-1)),e==e?function(t,e,r){for(var n=r+1;n--;)if(t[n]===e)return n;return n}(t,e,o):he(t,ye,o,!0)},Lr.lowerCase=Ru,Lr.lowerFirst=Iu,Lr.lt=Qa,Lr.lte=Va,Lr.max=function(t){return t&&t.length?rn(t,Yu,hn):void 0},Lr.maxBy=function(t,e){return t&&t.length?rn(t,Xo(e,2),hn):void 0},Lr.mean=function(t){return ge(t,Yu)},Lr.meanBy=function(t,e){return ge(t,Xo(e,2))},Lr.min=function(t){return t&&t.length?rn(t,Yu,An):void 0},Lr.minBy=function(t,e){return t&&t.length?rn(t,Xo(e,2),An):void 0},Lr.stubArray=rc,Lr.stubFalse=nc,Lr.stubObject=function(){return{}},Lr.stubString=function(){return""},Lr.stubTrue=function(){return!0},Lr.multiply=sc,Lr.nth=function(t,e){return t&&t.length?Cn(t,eu(e)):void 0},Lr.noConflict=function(){return Bt._===this&&(Bt._=$t),this},Lr.noop=zu,Lr.now=_a,Lr.pad=function(t,e,r){t=iu(t);var n=(e=eu(e))?De(t):0;if(!e||n>=e)return t;var o=(e-n)/2;return Ro(Ze(o),r)+t+Ro(Ve(o),r)},Lr.padEnd=function(t,e,r){t=iu(t);var n=(e=eu(e))?De(t):0;return e&&ne){var n=t;t=e,e=n}if(r||t%1||e%1){var o=sr();return ar(t+o*(e-t+Ft("1e-"+((o+"").length-1))),e)}return Nn(t,e)},Lr.reduce=function(t,e,r){var n=ja(t)?se:be,o=arguments.length<3;return n(t,Xo(e,4),r,o,Zr)},Lr.reduceRight=function(t,e,r){var n=ja(t)?fe:be,o=arguments.length<3;return n(t,Xo(e,4),r,o,tn)},Lr.repeat=function(t,e,r){return e=(r?ui(t,e,r):void 0===e)?1:eu(e),$n(iu(t),e)},Lr.replace=function(){var t=arguments,e=iu(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Lr.result=function(t,e,r){var n=-1,o=(e=ao(e,t)).length;for(o||(o=1,t=void 0);++n9007199254740991)return[];var r=4294967295,n=ar(t,4294967295);t-=4294967295;for(var o=Se(n,e=Xo(e));++r=i)return t;var u=r-De(n);if(u<1)return n;var c=a?co(a,0,u).join(""):t.slice(0,u);if(void 0===o)return c+n;if(a&&(u+=c.length-u),Wa(o)){if(t.slice(u).search(o)){var s,f=c;for(o.global||(o=dt(o.source,iu(Z.exec(o))+"g")),o.lastIndex=0;s=o.exec(f);)var l=s.index;c=c.slice(0,void 0===l?u:l)}}else if(t.indexOf(Xn(o),u)!=u){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+n},Lr.unescape=function(t){return(t=iu(t))&&P.test(t)?t.replace(R,Ge):t},Lr.uniqueId=function(t){var e=++Ot;return iu(t)+e},Lr.upperCase=$u,Lr.upperFirst=Fu,Lr.each=ia,Lr.eachRight=aa,Lr.first=Ii,Ju(Lr,(oc={},cn(Lr,(function(t,e){St.call(Lr.prototype,e)||(oc[e]=t)})),oc),{chain:!1}),Lr.VERSION="4.17.21",ee(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Lr[t].placeholder=Lr})),ee(["drop","take"],(function(t,e){jr.prototype[t]=function(r){r=void 0===r?1:ir(eu(r),0);var n=this.__filtered__&&!e?new jr(this):this.clone();return n.__filtered__?n.__takeCount__=ar(r,n.__takeCount__):n.__views__.push({size:ar(r,4294967295),type:t+(n.__dir__<0?"Right":"")}),n},jr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ee(["filter","map","takeWhile"],(function(t,e){var r=e+1,n=1==r||3==r;jr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Xo(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}})),ee(["head","last"],(function(t,e){var r="take"+(e?"Right":"");jr.prototype[t]=function(){return this[r](1).value()[0]}})),ee(["initial","tail"],(function(t,e){var r="drop"+(e?"":"Right");jr.prototype[t]=function(){return this.__filtered__?new jr(this):this[r](1)}})),jr.prototype.compact=function(){return this.filter(Yu)},jr.prototype.find=function(t){return this.filter(t).head()},jr.prototype.findLast=function(t){return this.reverse().find(t)},jr.prototype.invokeMap=Fn((function(t,e){return"function"==typeof t?new jr(this):this.map((function(r){return gn(r,t,e)}))})),jr.prototype.reject=function(t){return this.filter(Ea(Xo(t)))},jr.prototype.slice=function(t,e){t=eu(t);var r=this;return r.__filtered__&&(t>0||e<0)?new jr(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),void 0!==e&&(r=(e=eu(e))<0?r.dropRight(-e):r.take(e-t)),r)},jr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},jr.prototype.toArray=function(){return this.take(4294967295)},cn(jr.prototype,(function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),o=Lr[n?"take"+("last"==e?"Right":""):e],i=n||/^find/.test(e);o&&(Lr.prototype[e]=function(){var e=this.__wrapped__,a=n?[1]:arguments,u=e instanceof jr,c=a[0],s=u||ja(e),f=function(t){var e=o.apply(Lr,ce([t],a));return n&&l?e[0]:e};s&&r&&"function"==typeof c&&1!=c.length&&(u=s=!1);var l=this.__chain__,p=!!this.__actions__.length,_=i&&!l,h=u&&!p;if(!i&&s){e=h?e:new jr(this);var d=t.apply(e,a);return d.__actions__.push({func:ta,args:[f],thisArg:void 0}),new Cr(d,l)}return _&&h?t.apply(this,a):(d=this.thru(f),_?n?d.value()[0]:d.value():d)})})),ee(["pop","push","shift","sort","splice","unshift"],(function(t){var e=gt[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);Lr.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var o=this.value();return e.apply(ja(o)?o:[],t)}return this[r]((function(r){return e.apply(ja(r)?r:[],t)}))}})),cn(jr.prototype,(function(t,e){var r=Lr[e];if(r){var n=r.name+"";St.call(gr,n)||(gr[n]=[]),gr[n].push({name:e,func:r})}})),gr[To(void 0,2).name]=[{name:"wrapper",func:void 0}],jr.prototype.clone=function(){var t=new jr(this.__wrapped__);return t.__actions__=yo(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=yo(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=yo(this.__views__),t},jr.prototype.reverse=function(){if(this.__filtered__){var t=new jr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},jr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=ja(t),n=e<0,o=r?t.length:0,i=function(t,e,r){for(var n=-1,o=r.length;++n=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},Lr.prototype.plant=function(t){for(var e,r=this;r instanceof kr;){var n=xi(r);n.__index__=0,n.__values__=void 0,e?o.__wrapped__=n:e=n;var o=n;r=r.__wrapped__}return o.__wrapped__=t,e},Lr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof jr){var e=t;return this.__actions__.length&&(e=new jr(this)),(e=e.reverse()).__actions__.push({func:ta,args:[Bi],thisArg:void 0}),new Cr(e,this.__chain__)}return this.thru(Bi)},Lr.prototype.toJSON=Lr.prototype.valueOf=Lr.prototype.value=function(){return eo(this.__wrapped__,this.__actions__)},Lr.prototype.first=Lr.prototype.head,We&&(Lr.prototype[We]=function(){return this}),Lr}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Bt._=He,define((function(){return He}))):Ht?((Ht.exports=He)._=He,Gt._=He):Bt._=He}).call(this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$lodash_35=_$lodash_35.exports;var _$processors_41={};function ___typeof_41(t){return(___typeof_41="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(_$processors_41,"__esModule",{value:!0}),_$processors_41.ApplyProcessor=function(t,e){return _ApplyProcessor.apply(this,arguments)},_$processors_41.default=void 0;var obj,_lodash=(obj=_$lodash_35)&&obj.__esModule?obj:{default:obj};function ___regeneratorRuntime_41(){___regeneratorRuntime_41=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(x){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(x){return{type:"throw",arg:x}}}t.wrap=c;var f={};function l(){}function p(){}function _(){}var h={};u(h,o,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(O([])));v&&v!==e&&r.call(v,o)&&(h=v);var y=_.prototype=l.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==___typeof_41(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_41(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function ___asyncToGenerator_41(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_41(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_41(i,n,o,a,u,"throw",t)}a(void 0)}))}}function ___createForOfIteratorHelper_41(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_41(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_41(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_41(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1?e-1:0),n=1;n0&&void 0!==arguments[0])||arguments[0];return{name:"Flag Operator",func:function(e){return e.map((function(e){if(t){var r=(0,_$geo_55.getFlag)(e.name);e.name=removeFlag(e.name),e.name=r+" "+e.name,e.name=e.name.replace(/\ud83c\uddf9\ud83c\uddfc/g,"\ud83c\udde8\ud83c\uddf3")}else e.name=removeFlag(e.name);return e}))}}},"Sort Operator":function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"asc";return{name:"Sort Operator",func:function(e){switch(t){case"asc":case"desc":return e.sort((function(e,r){return(e.name>r.name?1:-1)*("desc"===t?-1:1)}));case"random":return function(t){for(var e,r,n=t.length;0!==n;)r=Math.floor(Math.random()*n),e=t[n-=1],t[n]=t[r],t[r]=e;return t}(e);default:throw new Error("Unknown sort option: "+t)}}}},"Regex Sort Operator":function(t){return{name:"Regex Sort Operator",func:function(e){return t=t.map((function(t){return buildRegex(t)})),e.sort((function(e,r){var n=getRegexOrder(t,e.name),o=getRegexOrder(t,r.name);return n&&!o?-1:o&&!n?1:n&&o?n1){void 0===s[t.name]&&(s[t.name]=1);for(var e="",r=s[t.name]++,n=0;r>0;)e=a[r%10]+e,r=parseInt(r/10),n++;for(;n++0&&-1==="\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(n-1));)if(n-=1,this.position-n>e/2-1){r=" ... ",n+=5;break}for(o="",i=this.position;ie/2-1){o=" ... ",i-=5;break}return a=this.buffer.slice(n,i),_$common_7.repeat(" ",t)+r+a+o+"\n"+_$common_7.repeat(" ",t+this.position-n+r.length)+"^"},Mark.prototype.toString=function(t){var e,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),t||(e=this.getSnippet())&&(r+=":\n"+e),r},_$mark_11=Mark;var TYPE_CONSTRUCTOR_OPTIONS=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],YAML_NODE_KINDS=["scalar","sequence","mapping"],_$type_18=function(t,e){var r,n;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===TYPE_CONSTRUCTOR_OPTIONS.indexOf(e))throw new _$exception_9('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=(r=e.styleAliases||null,n={},null!==r&&Object.keys(r).forEach((function(t){r[t].forEach((function(e){n[String(e)]=t}))})),n),-1===YAML_NODE_KINDS.indexOf(this.kind))throw new _$exception_9('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')},_$schema_12={};function compileList(t,e,r){var n=[];return t.include.forEach((function(t){r=compileList(t,e,r)})),t[e].forEach((function(t){r.forEach((function(e,r){e.tag===t.tag&&e.kind===t.kind&&n.push(r)})),r.push(t)})),r.filter((function(t,e){return-1===n.indexOf(e)}))}function Schema(t){this.include=t.include||[],this.implicit=t.implicit||[],this.explicit=t.explicit||[],this.implicit.forEach((function(t){if(t.loadKind&&"scalar"!==t.loadKind)throw new _$exception_9("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")})),this.compiledImplicit=compileList(this,"implicit",[]),this.compiledExplicit=compileList(this,"explicit",[]),this.compiledTypeMap=function(){var t,e,r={scalar:{},sequence:{},mapping:{},fallback:{}};function n(t){r[t.kind][t.tag]=r.fallback[t.tag]=t}for(t=0,e=arguments.length;t=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0"+t.toString(8):"-0"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),YAML_FLOAT_PATTERN=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),SCIENTIFIC_WITHOUT_DOT=/^[-+]?[0-9]+e/,_$float_21=new _$type_18("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!YAML_FLOAT_PATTERN.test(t)||"_"===t[t.length-1])},construct:function(t){var e,r,n,o;return r="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,o=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:e.indexOf(":")>=0?(e.split(":").forEach((function(t){o.unshift(parseFloat(t,10))})),e=0,n=1,o.forEach((function(t){e+=t*n,n*=60})),r*e):r*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||_$common_7.isNegativeZero(t))},represent:function(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(_$common_7.isNegativeZero(t))return"-0.0";return r=t.toString(10),SCIENTIFIC_WITHOUT_DOT.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"}),_$json_17=new _$schema_12({include:[_$failsafe_16],implicit:[_$null_28,_$bool_20,_$int_22,_$float_21]}),_$core_13=new _$schema_12({include:[_$json_17]}),YAML_DATE_REGEXP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),YAML_TIMESTAMP_REGEXP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),_$timestamp_34=new _$type_18("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==YAML_DATE_REGEXP.exec(t)||null!==YAML_TIMESTAMP_REGEXP.exec(t))},construct:function(t){var e,r,n,o,i,a,u,c,s=0,f=null;if(null===(e=YAML_DATE_REGEXP.exec(t))&&(e=YAML_TIMESTAMP_REGEXP.exec(t)),null===e)throw new Error("Date resolve error");if(r=+e[1],n=+e[2]-1,o=+e[3],!e[4])return new Date(Date.UTC(r,n,o));if(i=+e[4],a=+e[5],u=+e[6],e[7]){for(s=e[7].slice(0,3);s.length<3;)s+="0";s=+s}return e[9]&&(f=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(f=-f)),c=new Date(Date.UTC(r,n,o,i,a,u,s)),f&&c.setTime(c.getTime()-f),c},instanceOf:Date,represent:function(t){return t.toISOString()}}),_$merge_27=new _$type_18("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}}),NodeBuffer;try{var _require=require;NodeBuffer=_require("buffer").Buffer}catch(__){}var BASE64_MAP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",_$binary_19=new _$type_18("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,r,n=0,o=t.length,i=BASE64_MAP;for(r=0;r64)){if(e<0)return!1;n+=6}return n%8==0},construct:function(t){var e,r,n=t.replace(/[\r\n=]/g,""),o=n.length,i=BASE64_MAP,a=0,u=[];for(e=0;e>16&255),u.push(a>>8&255),u.push(255&a)),a=a<<6|i.indexOf(n.charAt(e));return 0==(r=o%4*6)?(u.push(a>>16&255),u.push(a>>8&255),u.push(255&a)):18===r?(u.push(a>>10&255),u.push(a>>2&255)):12===r&&u.push(a>>4&255),NodeBuffer?NodeBuffer.from?NodeBuffer.from(u):new NodeBuffer(u):u},predicate:function(t){return NodeBuffer&&NodeBuffer.isBuffer(t)},represent:function(t){var e,r,n="",o=0,i=t.length,a=BASE64_MAP;for(e=0;e>18&63],n+=a[o>>12&63],n+=a[o>>6&63],n+=a[63&o]),o=(o<<8)+t[e];return 0==(r=i%3)?(n+=a[o>>18&63],n+=a[o>>12&63],n+=a[o>>6&63],n+=a[63&o]):2===r?(n+=a[o>>10&63],n+=a[o>>4&63],n+=a[o<<2&63],n+=a[64]):1===r&&(n+=a[o>>2&63],n+=a[o<<4&63],n+=a[64],n+=a[64]),n}}),_hasOwnProperty=Object.prototype.hasOwnProperty,_toString=Object.prototype.toString,_$omap_29=new _$type_18("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,r,n,o,i,a=[],u=t;for(e=0,r=u.length;e3)return!1;if("/"!==e[e.length-n.length-1])return!1}return!0},construct:function(t){var e=t,r=/\/([gim]*)$/.exec(t),n="";return"/"===e[0]&&(r&&(n=r[1]),e=e.slice(1,e.length-n.length-1)),new RegExp(e,n)},predicate:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},represent:function(t){var e="/"+t.source+"/";return t.global&&(e+="g"),t.multiline&&(e+="m"),t.ignoreCase&&(e+="i"),e}}),esprima;try{var ___require_23=require;esprima=___require_23("esprima")}catch(_){"undefined"!=typeof window&&(esprima=window.esprima)}var _$function_23=new _$type_18("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var e="("+t+")",r=esprima.parse(e,{range:!0});return"Program"===r.type&&1===r.body.length&&"ExpressionStatement"===r.body[0].type&&("ArrowFunctionExpression"===r.body[0].expression.type||"FunctionExpression"===r.body[0].expression.type)}catch(n){return!1}},construct:function(t){var e,r="("+t+")",n=esprima.parse(r,{range:!0}),o=[];if("Program"!==n.type||1!==n.body.length||"ExpressionStatement"!==n.body[0].type||"ArrowFunctionExpression"!==n.body[0].expression.type&&"FunctionExpression"!==n.body[0].expression.type)throw new Error("Failed to resolve function");return n.body[0].expression.params.forEach((function(t){o.push(t.name)})),e=n.body[0].expression.body.range,"BlockStatement"===n.body[0].expression.body.type?new Function(o,r.slice(e[0]+1,e[1]-1)):new Function(o,"return "+r.slice(e[0],e[1]))},predicate:function(t){return"[object Function]"===Object.prototype.toString.call(t)},represent:function(t){return t.toString()}}),_$default_full_14=_$schema_12.DEFAULT=new _$schema_12({include:[_$default_safe_15],explicit:[_$undefined_25,_$regexp_24,_$function_23]}),_$loader_10={},___hasOwnProperty_10=Object.prototype.hasOwnProperty,CONTEXT_FLOW_IN=1,CONTEXT_FLOW_OUT=2,CONTEXT_BLOCK_IN=3,CONTEXT_BLOCK_OUT=4,CHOMPING_CLIP=1,CHOMPING_STRIP=2,CHOMPING_KEEP=3,PATTERN_NON_PRINTABLE=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,PATTERN_NON_ASCII_LINE_BREAKS=/[\x85\u2028\u2029]/,PATTERN_FLOW_INDICATORS=/[,\[\]\{\}]/,PATTERN_TAG_HANDLE=/^(?:!|!!|![a-z\-]+!)$/i,PATTERN_TAG_URI=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _class(t){return Object.prototype.toString.call(t)}function is_EOL(t){return 10===t||13===t}function is_WHITE_SPACE(t){return 9===t||32===t}function is_WS_OR_EOL(t){return 9===t||32===t||10===t||13===t}function is_FLOW_INDICATOR(t){return 44===t||91===t||93===t||123===t||125===t}function fromHexCode(t){var e;return 48<=t&&t<=57?t-48:97<=(e=32|t)&&e<=102?e-97+10:-1}function simpleEscapeSequence(t){return 48===t?"\0":97===t?"\x07":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"\x1b":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"\x85":95===t?"\xa0":76===t?"\u2028":80===t?"\u2029":""}function charFromCodepoint(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var simpleEscapeCheck=new Array(256),simpleEscapeMap=new Array(256),i=0;i<256;i++)simpleEscapeCheck[i]=simpleEscapeSequence(i)?1:0,simpleEscapeMap[i]=simpleEscapeSequence(i);function State(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||_$default_full_14,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function generateError(t,e){return new _$exception_9(e,new _$mark_11(t.filename,t.input,t.position,t.line,t.position-t.lineStart))}function throwError(t,e){throw generateError(t,e)}function throwWarning(t,e){t.onWarning&&t.onWarning.call(null,generateError(t,e))}var directiveHandlers={YAML:function(t,e,r){var n,o,i;null!==t.version&&throwError(t,"duplication of %YAML directive"),1!==r.length&&throwError(t,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&throwError(t,"ill-formed argument of the YAML directive"),o=parseInt(n[1],10),i=parseInt(n[2],10),1!==o&&throwError(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=i<2,1!==i&&2!==i&&throwWarning(t,"unsupported YAML version of the document")},TAG:function(t,e,r){var n,o;2!==r.length&&throwError(t,"TAG directive accepts exactly two arguments"),n=r[0],o=r[1],PATTERN_TAG_HANDLE.test(n)||throwError(t,"ill-formed tag handle (first argument) of the TAG directive"),___hasOwnProperty_10.call(t.tagMap,n)&&throwError(t,'there is a previously declared suffix for "'+n+'" tag handle'),PATTERN_TAG_URI.test(o)||throwError(t,"ill-formed tag prefix (second argument) of the TAG directive"),t.tagMap[n]=o}};function captureSegment(t,e,r,n){var o,i,a,u;if(e1&&(t.result+=_$common_7.repeat("\n",e-1))}function readBlockSequence(t,e){var r,n,o=t.tag,i=t.anchor,a=[],u=!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=a),n=t.input.charCodeAt(t.position);0!==n&&45===n&&is_WS_OR_EOL(t.input.charCodeAt(t.position+1));)if(u=!0,t.position++,skipSeparationSpace(t,!0,-1)&&t.lineIndent<=e)a.push(null),n=t.input.charCodeAt(t.position);else if(r=t.line,composeNode(t,e,CONTEXT_BLOCK_IN,!1,!0),a.push(t.result),skipSeparationSpace(t,!0,-1),n=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&0!==n)throwError(t,"bad indentation of a sequence entry");else if(t.lineIndente?_=1:t.lineIndent===e?_=0:t.lineIndente?_=1:t.lineIndent===e?_=0:t.lineIndente)&&(composeNode(t,e,CONTEXT_BLOCK_OUT,!0,o)&&(d?_=t.result:h=t.result),d||(storeMappingPair(t,f,l,p,_,h,i,a),p=_=h=null),skipSeparationSpace(t,!0,-1),u=t.input.charCodeAt(t.position)),t.lineIndent>e&&0!==u)throwError(t,"bad indentation of a mapping entry");else if(t.lineIndent=0))break;0===o?throwError(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?throwError(t,"repeat of an indentation width identifier"):(f=e+o-1,s=!0)}if(is_WHITE_SPACE(i)){do{i=t.input.charCodeAt(++t.position)}while(is_WHITE_SPACE(i));if(35===i)do{i=t.input.charCodeAt(++t.position)}while(!is_EOL(i)&&0!==i)}for(;0!==i;){for(readLineBreak(t),t.lineIndent=0,i=t.input.charCodeAt(t.position);(!s||t.lineIndentf&&(f=t.lineIndent),is_EOL(i))l++;else{if(t.lineIndent0){for(o=a,i=0;o>0;o--)(a=fromHexCode(u=t.input.charCodeAt(++t.position)))>=0?i=(i<<4)+a:throwError(t,"expected hexadecimal character");t.result+=charFromCodepoint(i),t.position++}else throwError(t,"unknown escape sequence");r=n=t.position}else is_EOL(u)?(captureSegment(t,r,n,!0),writeFoldedLines(t,skipSeparationSpace(t,!1,e)),r=n=t.position):t.position===t.lineStart&&testDocumentSeparator(t)?throwError(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}throwError(t,"unexpected end of the stream within a double quoted scalar")}(t,l)?d=!0:function(t){var e,r,n;if(42!==(n=t.input.charCodeAt(t.position)))return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;0!==n&&!is_WS_OR_EOL(n)&&!is_FLOW_INDICATOR(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&throwError(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),___hasOwnProperty_10.call(t.anchorMap,r)||throwError(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],skipSeparationSpace(t,!0,-1),!0}(t)?(d=!0,null===t.tag&&null===t.anchor||throwError(t,"alias node should not have any properties")):function(t,e,r){var n,o,i,a,u,c,s,f,l=t.kind,p=t.result;if(is_WS_OR_EOL(f=t.input.charCodeAt(t.position))||is_FLOW_INDICATOR(f)||35===f||38===f||42===f||33===f||124===f||62===f||39===f||34===f||37===f||64===f||96===f)return!1;if((63===f||45===f)&&(is_WS_OR_EOL(n=t.input.charCodeAt(t.position+1))||r&&is_FLOW_INDICATOR(n)))return!1;for(t.kind="scalar",t.result="",o=i=t.position,a=!1;0!==f;){if(58===f){if(is_WS_OR_EOL(n=t.input.charCodeAt(t.position+1))||r&&is_FLOW_INDICATOR(n))break}else if(35===f){if(is_WS_OR_EOL(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&testDocumentSeparator(t)||r&&is_FLOW_INDICATOR(f))break;if(is_EOL(f)){if(u=t.line,c=t.lineStart,s=t.lineIndent,skipSeparationSpace(t,!1,-1),t.lineIndent>=e){a=!0,f=t.input.charCodeAt(t.position);continue}t.position=i,t.line=u,t.lineStart=c,t.lineIndent=s;break}}a&&(captureSegment(t,o,i,!1),writeFoldedLines(t,t.line-u),o=i=t.position,a=!1),is_WHITE_SPACE(f)||(i=t.position+1),f=t.input.charCodeAt(++t.position)}return captureSegment(t,o,i,!1),!!t.result||(t.kind=l,t.result=p,!1)}(t,l,CONTEXT_FLOW_IN===r)&&(d=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===_&&(d=u&&readBlockSequence(t,p))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&throwError(t,'unacceptable node kind for ! tag; it should be "scalar", not "'+t.kind+'"'),c=0,s=t.implicitTypes.length;c tag; it should be "'+f.kind+'", not "'+t.kind+'"'),f.resolve(t.result)?(t.result=f.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):throwError(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):throwError(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||d}function readDocument(t){var e,r,n,o,i=t.position,a=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap={},t.anchorMap={};0!==(o=t.input.charCodeAt(t.position))&&(skipSeparationSpace(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==o));){for(a=!0,o=t.input.charCodeAt(++t.position),e=t.position;0!==o&&!is_WS_OR_EOL(o);)o=t.input.charCodeAt(++t.position);for(n=[],(r=t.input.slice(e,t.position)).length<1&&throwError(t,"directive name must not be less than one character in length");0!==o;){for(;is_WHITE_SPACE(o);)o=t.input.charCodeAt(++t.position);if(35===o){do{o=t.input.charCodeAt(++t.position)}while(0!==o&&!is_EOL(o));break}if(is_EOL(o))break;for(e=t.position;0!==o&&!is_WS_OR_EOL(o);)o=t.input.charCodeAt(++t.position);n.push(t.input.slice(e,t.position))}0!==o&&readLineBreak(t),___hasOwnProperty_10.call(directiveHandlers,r)?directiveHandlers[r](t,r,n):throwWarning(t,'unknown document directive "'+r+'"')}skipSeparationSpace(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,skipSeparationSpace(t,!0,-1)):a&&throwError(t,"directives end mark is expected"),composeNode(t,t.lineIndent-1,CONTEXT_BLOCK_OUT,!1,!0),skipSeparationSpace(t,!0,-1),t.checkLineBreaks&&PATTERN_NON_ASCII_LINE_BREAKS.test(t.input.slice(i,t.position))&&throwWarning(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&testDocumentSeparator(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,skipSeparationSpace(t,!0,-1)):t.position0?t.charCodeAt(i-1):null,_=_&&isPlainSafe(a,u)}else{for(i=0;in&&" "!==t[p+1],p=i);else if(!isPrintable(a))return STYLE_DOUBLE;u=i>0?t.charCodeAt(i-1):null,_=_&&isPlainSafe(a,u)}f=f||l&&i-p-1>n&&" "!==t[p+1]}return s||f?r>9&&needIndentIndicator(t)?STYLE_DOUBLE:f?STYLE_FOLDED:STYLE_LITERAL:_&&!o(t)?STYLE_PLAIN:STYLE_SINGLE}function writeScalar(t,e,r,n){t.dump=function(){if(0===e.length)return"''";if(!t.noCompatMode&&-1!==DEPRECATED_BOOLEANS_SYNTAX.indexOf(e))return"'"+e+"'";var o=t.indent*Math.max(1,r),i=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-o),a=n||t.flowLevel>-1&&r>=t.flowLevel;switch(chooseScalarStyle(e,a,t.indent,i,(function(e){return function(t,e){var r,n;for(r=0,n=t.implicitTypes.length;r"+blockHeader(e,t.indent)+dropEndingNewline(indentString(function(t,e){for(var r,n,o,i=/(\n+)([^\n]*)/g,a=(o=-1!==(o=t.indexOf("\n"))?o:t.length,i.lastIndex=o,foldLine(t.slice(0,o),e)),u="\n"===t[0]||" "===t[0];n=i.exec(t);){var c=n[1],s=n[2];r=" "===s[0],a+=c+(u||r||""===s?"":"\n")+foldLine(s,e),u=r}return a}(e,i),o));case STYLE_DOUBLE:return'"'+function(t){for(var e,r,n,o="",i=0;i=55296&&e<=56319&&(r=t.charCodeAt(i+1))>=56320&&r<=57343?(o+=encodeHex(1024*(e-55296)+r-56320+65536),i++):o+=!(n=ESCAPE_SEQUENCES[e])&&isPrintable(e)?t[i]:n||encodeHex(e);return o}(e)+'"';default:throw new _$exception_9("impossible error: invalid scalar style")}}()}function blockHeader(t,e){var r=needIndentIndicator(t)?String(e):"",n="\n"===t[t.length-1];return r+(!n||"\n"!==t[t.length-2]&&"\n"!==t?n?"":"-":"+")+"\n"}function dropEndingNewline(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function foldLine(t,e){if(""===t||" "===t[0])return t;for(var r,n,o=/ [^ ]/g,i=0,a=0,u=0,c="";r=o.exec(t);)(u=r.index)-i>e&&(n=a>i?a:u,c+="\n"+t.slice(i,n),i=n+1),a=u;return c+="\n",t.length-i>e&&a>i?c+=t.slice(i,a)+"\n"+t.slice(a+1):c+=t.slice(i),c.slice(1)}function detectType(t,e,r){var n,o,i,a,u,c;for(i=0,a=(o=r?t.explicitTypes:t.implicitTypes).length;i tag resolver accepts not "'+c+'" style');n=u.represent[c](e,c)}t.dump=n}return!0}return!1}function writeNode(t,e,r,n,o,i){t.tag=null,t.dump=r,detectType(t,r,!1)||detectType(t,r,!0);var a=___toString_8.call(t.dump);n&&(n=t.flowLevel<0||t.flowLevel>e);var u,c,s="[object Object]"===a||"[object Array]"===a;if(s&&(c=-1!==(u=t.duplicates.indexOf(r))),(null!==t.tag&&"?"!==t.tag||c||2!==t.indent&&e>0)&&(o=!1),c&&t.usedDuplicates[u])t.dump="*ref_"+u;else{if(s&&c&&!t.usedDuplicates[u]&&(t.usedDuplicates[u]=!0),"[object Object]"===a)n&&0!==Object.keys(t.dump).length?(function(t,e,r,n){var o,i,a,u,c,s,f="",l=t.tag,p=Object.keys(r);if(!0===t.sortKeys)p.sort();else if("function"==typeof t.sortKeys)p.sort(t.sortKeys);else if(t.sortKeys)throw new _$exception_9("sortKeys must be a boolean or a function");for(o=0,i=p.length;o1024)&&(t.dump&&CHAR_LINE_FEED===t.dump.charCodeAt(0)?s+="?":s+="? "),s+=t.dump,c&&(s+=generateNextLine(t,e)),writeNode(t,e+1,u,!0,c)&&(t.dump&&CHAR_LINE_FEED===t.dump.charCodeAt(0)?s+=":":s+=": ",f+=s+=t.dump));t.tag=l,t.dump=f||"{}"}(t,e,t.dump,o),c&&(t.dump="&ref_"+u+t.dump)):(function(t,e,r){var n,o,i,a,u,c="",s=t.tag,f=Object.keys(r);for(n=0,o=f.length;n1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),writeNode(t,e,a,!1,!1)&&(c+=u+=t.dump));t.tag=s,t.dump="{"+c+"}"}(t,e,t.dump),c&&(t.dump="&ref_"+u+" "+t.dump));else if("[object Array]"===a){var f=t.noArrayIndent&&e>0?e-1:e;n&&0!==t.dump.length?(function(t,e,r,n){var o,i,a="",u=t.tag;for(o=0,i=r.length;o "+t.dump)}return!0}function getDuplicateReferences(t,e){var r,n,o=[],i=[];for(function t(e,r,n){var o,i,a;if(null!==e&&"object"==typeof e)if(-1!==(i=r.indexOf(e)))-1===n.indexOf(i)&&n.push(i);else if(r.push(e),Array.isArray(e))for(i=0,a=e.length;i0?o-4:o;for(r=0;r>16&255,a[u++]=e>>8&255,a[u++]=255&e;return 2===i&&(e=revLookup[t.charCodeAt(r)]<<2|revLookup[t.charCodeAt(r+1)]>>4,a[u++]=255&e),1===i&&(e=revLookup[t.charCodeAt(r)]<<10|revLookup[t.charCodeAt(r+1)]<<4|revLookup[t.charCodeAt(r+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e),a},fromByteArray:function(t){for(var e,r=t.length,n=r%3,o=[],i=0,a=r-n;ia?a:i+16383));return 1===n?(e=t[r-1],o.push(lookup[e>>2]+lookup[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(lookup[e>>10]+lookup[e>>4&63]+lookup[e<<2&63]+"=")),o.join("")}},lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",__i_1=0,len=code.length;__i_10)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function encodeChunk(t,e,r){for(var n,o,i=[],a=e;a>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]);return i.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;var _$ieee754_3={read:function(t,e,r,n,o){var i,a,u=8*o-n-1,c=(1<>1,f=-7,l=r?o-1:0,p=r?-1:1,_=t[e+l];for(l+=p,i=_&(1<<-f)-1,_>>=-f,f+=u;f>0;i=256*i+t[e+l],l+=p,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=n;f>0;a=256*a+t[e+l],l+=p,f-=8);if(0===i)i=1-s;else{if(i===c)return a?NaN:1/0*(_?-1:1);a+=Math.pow(2,n),i-=s}return(_?-1:1)*a*Math.pow(2,i-n)},write:function(t,e,r,n,o,i){var a,u,c,s=8*i-o-1,f=(1<>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:i-1,h=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=f?(u=0,a=f):a+l>=1?(u=(e*c-1)*Math.pow(2,o),a+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,o),a=0));o>=8;t[r+_]=255&u,_+=h,u/=256,o-=8);for(a=a<0;t[r+_]=255&a,_+=h,a/=256,s-=8);t[r+_-h]|=128*d}},_$base64_4={exports:{}};(function(t,e){(function(){!function(t,e){var r,n;"object"==typeof _$base64_4.exports?_$base64_4.exports=e():"function"==typeof define&&define.amd?define(e):(r=t.Base64,(n=e()).noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:this,(function(){"use strict";var t,r="function"==typeof atob,n="function"==typeof btoa,o="function"==typeof e,i="function"==typeof TextDecoder?new TextDecoder:void 0,a="function"==typeof TextEncoder?new TextEncoder:void 0,u=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),c=(t={},u.forEach((function(e,r){return t[e]=r})),t),s=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,f=String.fromCharCode.bind(String),l="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(t,e){return void 0===e&&(e=function(t){return t}),new Uint8Array(Array.prototype.slice.call(t,0).map(e))},p=function(t){return t.replace(/=/g,"").replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"}))},_=function(t){return t.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(t){for(var e,r,n,o,i="",a=t.length%3,c=0;c255||(n=t.charCodeAt(c++))>255||(o=t.charCodeAt(c++))>255)throw new TypeError("invalid character found");i+=u[(e=r<<16|n<<8|o)>>18&63]+u[e>>12&63]+u[e>>6&63]+u[63&e]}return a?i.slice(0,a-3)+"===".substring(a):i},d=n?function(t){return btoa(t)}:o?function(t){return e.from(t,"binary").toString("base64")}:h,v=o?function(t){return e.from(t).toString("base64")}:function(t){for(var e=[],r=0,n=t.length;r>>6)+f(128|63&e):f(224|e>>>12&15)+f(128|e>>>6&63)+f(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return f(240|e>>>18&7)+f(128|e>>>12&63)+f(128|e>>>6&63)+f(128|63&e)},m=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,w=function(t){return t.replace(m,g)},b=o?function(t){return e.from(t,"utf8").toString("base64")}:a?function(t){return v(a.encode(t))}:function(t){return d(w(t))},E=function(t,e){return void 0===e&&(e=!1),e?p(b(t)):b(t)},S=function(t){return E(t,!0)},O=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,A=function(t){switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return f(55296+(e>>>10))+f(56320+(1023&e));case 3:return f((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return f((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},x=function(t){return t.replace(O,A)},L=function(t){if(t=t.replace(/\s+/g,""),!s.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));for(var e,r,n,o="",i=0;i>16&255):64===n?f(e>>16&255,e>>8&255):f(e>>16&255,e>>8&255,255&e);return o},T=r?function(t){return atob(_(t))}:o?function(t){return e.from(t,"base64").toString("binary")}:L,k=o?function(t){return l(e.from(t,"base64"))}:function(t){return l(T(t),(function(t){return t.charCodeAt(0)}))},C=function(t){return k(R(t))},j=o?function(t){return e.from(t,"base64").toString("utf8")}:i?function(t){return i.decode(k(t))}:function(t){return x(T(t))},R=function(t){return _(t.replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})))},I=function(t){return j(R(t))},P=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}},N=function(){var t=function(t,e){return Object.defineProperty(String.prototype,t,P(e))};t("fromBase64",(function(){return I(this)})),t("toBase64",(function(t){return E(this,t)})),t("toBase64URI",(function(){return E(this,!0)})),t("toBase64URL",(function(){return E(this,!0)})),t("toUint8Array",(function(){return C(this)}))},$=function(){var t=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,P(e))};t("toBase64",(function(t){return y(this,t)})),t("toBase64URI",(function(){return y(this,!0)})),t("toBase64URL",(function(){return y(this,!0)}))},F={version:"3.7.2",VERSION:"3.7.2",atob:T,atobPolyfill:L,btoa:d,btoaPolyfill:h,fromBase64:I,toBase64:E,encode:E,encodeURI:S,encodeURL:S,utob:w,btou:x,decode:I,isValid:function(t){if("string"!=typeof t)return!1;var e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},fromUint8Array:y,toUint8Array:C,extendString:N,extendUint8Array:$,extendBuiltins:function(){N(),$()},Base64:{}};return Object.keys(F).forEach((function(t){return F.Base64[t]=F[t]})),F}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_$buffer_2({}).Buffer),_$base64_4=_$base64_4.exports;var _$preprocessors_40={};Object.defineProperty(_$preprocessors_40,"__esModule",{value:!0}),_$preprocessors_40.default=void 0;var keys,___default_40=[{name:"HTML",test:function(t){return/^/.test(t)},parse:function(){return""}},(keys=["dm1lc3M","c3NyOi8v","dHJvamFu","c3M6Ly","c3NkOi8v","c2hhZG93","aHR0c"],{name:"Base64 Pre-processor",test:function(t){return keys.some((function(e){return-1!==t.indexOf(e)}))},parse:function(t){return _$base64_4.Base64.decode(t)}}),{name:"Clash Pre-processor",test:function(t){return/proxies/.test(t)},parse:function(t){return(0,_$staticJsYaml_36.safeLoad)(t).proxies.map((function(t){return JSON.stringify(t)})).join("\n")}},{name:"SSD Pre-processor",test:function(t){return 0===t.indexOf("ssd://")},parse:function(t){for(var e=[],r=JSON.parse(_$base64_4.Base64.decode(t.split("ssd://")[1])),n=r.port,o=r.encryption,i=r.password,a=r.servers,u=0;ut.length)&&(e=t.length);for(var r=0,n=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_39(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_39(t,e):void 0}}function ___arrayLikeToArray_39(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1){var c,s=___createForOfIteratorHelper_39(t);try{for(s.s();!(c=s.n()).done;){var f=___slicedToArray_39(c.value.split("="),2),l=f[0],p=f[1];u[l]=p.trim()}}catch(_){s.e(_)}finally{s.f()}}return ___objectSpread_39(___objectSpread_39({},a),{},{name:u.remarks?_$base64_4.Base64.decode(u.remarks):a.server,"protocol-param":_$base64_4.Base64.decode(u.protoparam||"").replace(/\s/g,""),"obfs-param":_$base64_4.Base64.decode(u.obfsparam||"").replace(/\s/g,"")})}}),{name:"URI VMess Parser",test:function(t){return/^vmess:\/\//.test(t)},parse:function(t){t=t.split("vmess://")[1];var e=_$base64_4.Base64.decode(t);if(/=\s*vmess/.test(e)){var r,n=e.split(",").map((function(t){return t.trim()})),o={},i=___createForOfIteratorHelper_39(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(-1!==a.indexOf("=")){var u=___slicedToArray_39(a.split("="),2),c=u[0],s=u[1];o[c.trim()]=s.trim()}}}catch(h){i.e(h)}finally{i.f()}var f={name:n[0].split("=")[0].trim(),type:"vmess",server:n[1],port:n[2],cipher:n[3],uuid:n[4].match(/^"(.*)"$/)[1],tls:"over-tls"===o.obfs||"wss"===o.obfs};if(void 0!==o["udp-relay"]&&(f.udp=JSON.parse(o["udp-relay"])),void 0!==o["fast-open"]&&(f.udp=JSON.parse(o["fast-open"])),"ws"===o.obfs||"wss"===o.obfs){f.network="ws",f["ws-opts"].path=(o["obfs-path"]||'"/"').match(/^"(.*)"$/)[1];var l=o["obfs-header"];l&&-1!==l.indexOf("Host")&&(l=l.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),f["ws-opts"].headers={Host:l||f.server}}return f.tls&&"false"===o['"tls-verification"']&&(f["skip-cert-verify"]=!0),f.tls&&o["obfs-host"]&&(f.sni=o["obfs-host"]),f}var p=JSON.parse(e),_={name:p.ps,type:"vmess",server:p.add,port:p.port,cipher:"auto",uuid:p.id,alterId:p.aid||0,tls:"tls"===p.tls||!0===p.tls,supported:{}};return"ws"===p.net&&(_.network="ws",_["ws-opts"]={path:p.path,headers:{Host:p.host||p.add}},_.tls&&p.host&&(_.sni=p.host)),!1===p.verify_cert&&(_["skip-cert-verify"]=!0),_}},{name:"URI Trojan Parser",test:function(t){return/^trojan:\/\//.test(t)},parse:function(t){var e=___slicedToArray_39((t=t.split("trojan://")[1]).split("@")[1].split("?")[0].split(":"),2),r=e[0],n=e[1],o=decodeURIComponent(t.split("#")[1].trim()),i=t.split("?"),a=null;return i.length>1&&(i=i[1].split("#")[0].split("&"),a=new Map(i.map((function(t){return t.split("=")}))).get("sni")),{name:o||"[Trojan] ".concat(r),type:"trojan",server:r,port:n,password:t.split("@")[0],sni:a,supported:{}}}},{name:"Clash Parser",test:function(t){try{JSON.parse(t)}catch(e){return!1}return!0},parse:function(t){return JSON.parse(t)}},{name:"Surge SS Parser",test:function(t){return/^.*=\s*ss/.test(t.split(",")[0])},parse:function(t){var e=getSurgeParams(t),r={name:e.name,type:"ss",server:e.server,port:e.port,cipher:e["encrypt-method"],password:e.password,tfo:JSON.parse(e.tfo||"false"),udp:JSON.parse(e["udp-relay"]||"false")};return e.obfs&&(r.plugin="obfs",r["plugin-opts"]={mode:e.obfs,host:e["obfs-host"]}),r}},{name:"Surge VMess Parser",test:function(t){return/^.*=\s*vmess/.test(t.split(",")[0])&&-1!==t.indexOf("username")},parse:function(t){var e=getSurgeParams(t),r={name:e.name,type:"vmess",server:e.server,port:e.port,uuid:e.username,alterId:0,cipher:"none",tls:JSON.parse(e.tls||"false"),tfo:JSON.parse(e.tfo||"false")};if(r.tls&&(void 0!==e["skip-cert-verify"]&&(r["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),r.sni=e.sni||e.server),JSON.parse(e.ws||"false")){r.network="ws",r["ws-opts"]={path:e["ws-path"]};var n=e["ws-headers"].match(/(,|^|\s)*HOST:\s*(.*?)(,|$)/),o=n?n[2]:r.server;r["ws-opts"].headers={Host:o||e.server}}return r}},{name:"Surge Trojan Parser",test:function(t){return/^.*=\s*trojan/.test(t.split(",")[0])&&-1!==t.indexOf("sni")},parse:function(t){var e=getSurgeParams(t),r={name:e.name,type:"trojan",server:e.server,port:e.port,password:e.password,sni:e.sni||e.server,tfo:JSON.parse(e.tfo||"false")};return void 0!==e["skip-cert-verify"]&&(r["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),r}},{name:"Surge HTTP Parser",test:function(t){return/^.*=\s*https?/.test(t.split(",")[0])&&!Loon_Http().test(t)},parse:function(t){var e=getSurgeParams(t),r=/^.*?=\s?https/.test(t),n={name:e.name,type:"http",server:e.server,port:e.port,tls:JSON.parse(r||"false"),tfo:JSON.parse(e.tfo||"false")};return n.tls&&(void 0!==e["skip-cert-verify"]&&(n["skip-cert-verify"]=!0===e["skip-cert-verify"]||"1"===e["skip-cert-verify"]),n.sni=e.sni||e.server),e.username&&"none"!==e.username&&(n.username=e.username),e.password&&"none"!==e.password&&(n.password=e.password),n}},{name:"Loon SS Parser",test:function(t){return"shadowsocks"===t.split(",")[0].split("=")[1].trim().toLowerCase()},parse:function(t){var e=t.split("=")[1].split(","),r={name:t.split("=")[0].trim(),type:"ss",server:e[1],port:e[2],cipher:e[3],password:e[4].replace(/"/g,"")};return e.length>5&&(r.plugin="obfs",r["plugin-opts"]={mode:e[5],host:e[6]}),r}},{name:"Loon SSR Parser",test:function(t){return"shadowsocksr"===t.split(",")[0].split("=")[1].trim().toLowerCase()},parse:function(t){var e=t.split("=")[1].split(",");return{name:t.split("=")[0].trim(),type:"ssr",server:e[1],port:e[2],cipher:e[3],password:e[4].replace(/"/g,""),protocol:e[5],"protocol-param":e[6].match(/{(.*)}/)[1],supported:{Surge:!1},obfs:e[7],"obfs-param":e[8].match(/{(.*)}/)[1]}}},{name:"Loon VMess Parser",test:function(t){return/^.*=\s*vmess/i.test(t.split(",")[0])&&-1===t.indexOf("username")},parse:function(t){var e,r=t.split("=")[1].split(","),n={name:t.split("=")[0].trim(),type:"vmess",server:r[1],port:r[2],cipher:r[3]||"none",uuid:r[4].replace(/"/g,""),alterId:0},o=___createForOfIteratorHelper_39(r=r.splice(5));try{for(o.s();!(e=o.n()).done;){var i=___slicedToArray_39(e.value.split(":"),2),a=i[0],u=i[1];r[a]=u}}catch(c){o.e(c)}finally{o.f()}switch(n.tls=JSON.parse(r["over-tls"]||"false"),n.tls&&(n.sni=r["tls-name"]||n.server,n["skip-cert-verify"]=JSON.parse(r["skip-cert-verify"]||"false")),r.transport){case"tcp":break;case"ws":n.network=r.transport,n["ws-opts"]={path:r.path,headers:{Host:r.host}}}return n.tls&&(n["skip-cert-verify"]=JSON.parse(r["skip-cert-verify"]||"false")),n}},{name:"Loon Trojan Parser",test:function(t){return/^.*=\s*trojan/i.test(t.split(",")[0])&&-1===t.indexOf("password")},parse:function(t){var e=t.split("=")[1].split(","),r={name:t.split("=")[0].trim(),type:"trojan",server:e[1],port:e[2],password:e[3].replace(/"/g,""),sni:e[1],"skip-cert-verify":JSON.parse(e["skip-cert-verify"]||"false")};if(e.length>4){var n=___slicedToArray_39(e[4].split(":"),2),o=n[0],i=n[1];if("tls-name"!==o)throw new Error("Unknown option ".concat(o," for line: \n").concat(t));r.sni=i}return r}},Loon_Http(),{name:"QX SS Parser",test:function(t){return/^shadowsocks\s*=/.test(t.split(",")[0].trim())&&-1===t.indexOf("ssr-protocol")},parse:function(t){var e=getQXParams(t),r={name:e.tag,type:"ss",server:e.server,port:e.port,cipher:e.method,password:e.password,udp:JSON.parse(e["udp-relay"]||"false"),tfo:JSON.parse(e["fast-open"]||"false"),supported:{}};if(e.obfs)switch(r["plugin-opts"]={host:e["obfs-host"]||r.server},e.obfs){case"http":case"tls":r.plugin="obfs",r["plugin-opts"].mode=e.obfs;break;case"ws":case"wss":r["plugin-opts"]=___objectSpread_39(___objectSpread_39({},r["plugin-opts"]),{},{mode:"websocket",path:e["obfs-uri"]||"/",tls:"wss"===e.obfs}),r["plugin-opts"].tls&&void 0!==e["tls-verification"]&&(r["plugin-opts"]["skip-cert-verify"]=e["tls-verification"]),r.plugin="v2ray-plugin",r.supported.Surge=!1,r.supported.Loon=!1}return r}},{name:"QX SSR Parser",test:function(t){return/^shadowsocks\s*=/.test(t.split(",")[0].trim())&&-1!==t.indexOf("ssr-protocol")},parse:function(t){var e=getQXParams(t),r={name:e.tag,type:"ssr",server:e.server,port:e.port,cipher:e.method,password:e.password,protocol:e["ssr-protocol"],obfs:"plain","protocol-param":e["ssr-protocol-param"],udp:JSON.parse(e["udp-relay"]||"false"),tfo:JSON.parse(e["fast-open"]||"false"),supported:{Surge:!1}};return e.obfs&&(r.obfs=e.obfs,r["obfs-param"]=e["obfs-host"]),r}},{name:"QX VMess Parser",test:function(t){return/^vmess\s*=/.test(t.split(",")[0].trim())},parse:function(t){var e=getQXParams(t),r={type:"vmess",name:e.tag,server:e.server,port:e.port,cipher:e.method||"none",uuid:e.password,alterId:0,tls:"over-tls"===e.obfs||"wss"===e.obfs,udp:JSON.parse(e["udp-relay"]||"false"),tfo:JSON.parse(e["fast-open"]||"false")};return r.tls&&(r.sni=e["obfs-host"]||e.server,r["skip-cert-verify"]=!JSON.parse(e["tls-verification"]||"true")),"ws"!==e.obfs&&"wss"!==e.obfs||(r.network="ws",r["ws-opts"]={path:e["obfs-uri"],headers:{Host:e["obfs-host"]||e.server}}),r}},{name:"QX Trojan Parser",test:function(t){return/^trojan\s*=/.test(t.split(",")[0].trim())},parse:function(t){var e=getQXParams(t),r={type:"trojan",name:e.tag,server:e.server,port:e.port,password:e.password,sni:e["tls-host"]||e.server,udp:JSON.parse(e["udp-relay"]||"false"),tfo:JSON.parse(e["fast-open"]||"false")};return r["skip-cert-verify"]=!JSON.parse(e["tls-verification"]||"true"),r}},{name:"QX HTTP Parser",test:function(t){return/^http\s*=/.test(t.split(",")[0].trim())},parse:function(t){var e=getQXParams(t),r={type:"http",name:e.tag,server:e.server,port:e.port,tls:JSON.parse(e["over-tls"]||"false"),udp:JSON.parse(e["udp-relay"]||"false"),tfo:JSON.parse(e["fast-open"]||"false")};return e.username&&"none"!==e.username&&(r.username=e.username),e.password&&"none"!==e.password&&(r.password=e.password),r.tls&&(r.sni=e["tls-host"]||r.server,r["skip-cert-verify"]=!JSON.parse(e["tls-verification"]||"true")),r}}];_$parsers_39.default=___default_39;var _$proxyUtils_38={};function ___typeof_38(t){return(___typeof_38="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(_$proxyUtils_38,"__esModule",{value:!0}),_$proxyUtils_38.ProxyUtils=void 0;var ___download_38=_interopRequireDefault(_$download_54),_processors=function(t,e){if(t&&t.__esModule)return t;if(null===t||"object"!==___typeof_38(t)&&"function"!=typeof t)return{default:t};var r=_getRequireWildcardCache(void 0);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if("default"!==i&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}(_$processors_41),_preprocessors=_interopRequireDefault(_$preprocessors_40),_producers=_interopRequireDefault(_$producers_42),_parsers=_interopRequireDefault(_$parsers_39),_app=_interopRequireDefault(_$app_37);function _getRequireWildcardCache(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return(_getRequireWildcardCache=function(t){return t?r:e})(t)}function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function ___regeneratorRuntime_38(){___regeneratorRuntime_38=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(x){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new S(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(x){return{type:"throw",arg:x}}}t.wrap=c;var f={};function l(){}function p(){}function _(){}var h={};u(h,o,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(O([])));v&&v!==e&&r.call(v,o)&&(h=v);var y=_.prototype=l.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==___typeof_38(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_38(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function ___createForOfIteratorHelper_38(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_38(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_38(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_38(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==w[1]?w[1]:[],n=w.length>2?w[2]:void 0,o=___createForOfIteratorHelper_38(r),t.prev=3,o.s();case 5:if((i=o.n()).done){t.next=40;break}if(a=i.value,u=void 0,c={},-1===a.type.indexOf("Script")){t.next=29;break}if(s=a.args,f=s.mode,l=s.content,"link"!==f){t.next=28;break}if((_=(p=l).split("#")).length>1){h=___createForOfIteratorHelper_38(_[1].split("&"));try{for(h.s();!(d=h.n()).done;)v=d.value,y=v.split("=")[0],g=v.split("=")[1]||!0,c[y]=g}catch(b){h.e(b)}finally{h.f()}}return t.prev=15,t.next=18,(0,___download_38.default)(p.split("#")[0]);case 18:u=t.sent,_app.default.info("Script loaded: >>>\n ".concat(u)),t.next=26;break;case 22:return t.prev=22,t.t0=t.catch(15),_app.default.error("Error when downloading remote script: ".concat(a.args.content,".\n Reason: ").concat(t.t0)),t.abrupt("continue",38);case 26:t.next=29;break;case 28:u=l;case 29:if(_processors.default[a.type]){t.next=32;break}return _app.default.error('Unknown operator: "'.concat(a.type,'"')),t.abrupt("continue",38);case 32:return _app.default.info('Applying "'.concat(a.type,'" with arguments:\n >>> ').concat(JSON.stringify(a.args,null,2)||"None")),m=void 0,m=-1!==a.type.indexOf("Script")?_processors.default[a.type](u,n,c):_processors.default[a.type](a.args),t.next=37,(0,_processors.ApplyProcessor)(m,e);case 37:e=t.sent;case 38:t.next=5;break;case 40:t.next=45;break;case 42:t.prev=42,t.t1=t.catch(3),o.e(t.t1);case 45:return t.prev=45,o.f(),t.finish(45);case 48:return t.abrupt("return",e);case 49:case"end":return t.stop()}}),t,null,[[3,42,45,48],[15,22]])})),(_process=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_38(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_38(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}var ProxyUtils={parse:function(t){t=function(t){var e,r=___createForOfIteratorHelper_38(_preprocessors.default);try{for(r.s();!(e=r.n()).done;){var n=e.value;try{if(n.test(t))return _app.default.info("Pre-processor [".concat(n.name,"] activated")),n.parse(t)}catch(o){_app.default.error("Parser [".concat(n.name,"] failed\n Reason: ").concat(o))}}}catch(i){r.e(i)}finally{r.f()}return t}(t);var e,r,n=[],o=___createForOfIteratorHelper_38(t.split("\n"));try{for(o.s();!(r=o.n()).done;){var i=r.value;if(0!==(i=i.trim()).length){var a=e&&safeMatch(e,i);if(!a){var u,c=___createForOfIteratorHelper_38(_parsers.default);try{for(c.s();!(u=c.n()).done;){var s=u.value;if(safeMatch(s,i)){e=s,a=!0,_app.default.info("Proxy parser: ".concat(s.name," is activated"));break}}}catch(l){c.e(l)}finally{c.f()}}if(a)try{var f=e.parse(i);f||_app.default.error("Parser ".concat(e.name," return nothing for \n").concat(i,"\n")),n.push(f)}catch(l){_app.default.error("Failed to parse line: \n ".concat(i,"\n Reason: ").concat(l.stack))}else _app.default.error("Failed to find a rule to parse line: \n".concat(i,"\n"))}}}catch(l){o.e(l)}finally{o.f()}return n},process:function(t){return _process.apply(this,arguments)},produce:function(t,e){var r=_producers.default[e];if(!r)throw new Error("Target platform: ".concat(e," is not supported!"));return t=t.filter((function(t){return!(t.supported&&!1===t.supported[e])})),_app.default.info("Producing proxies for target: ".concat(e)),void 0===r.type||"SINGLE"===r.type?t.map((function(t){try{return r.produce(t)}catch(e){return _app.default.error("Cannot produce proxy: ".concat(JSON.stringify(t,null,2),"\nReason: ").concat(e)),""}})).filter((function(t){return t.length>0})).join("\n"):"ALL"===r.type?r.produce(t):void 0}};function safeMatch(t,e){var r;try{r=t.test(e)}catch(n){r=!1}return r}_$proxyUtils_38.ProxyUtils=ProxyUtils;var _$preprocessors_45={};Object.defineProperty(_$preprocessors_45,"__esModule",{value:!0}),_$preprocessors_45.default=void 0;var ___default_45=[{name:"HTML",test:function(t){return/^/.test(t)},parse:function(){return""}},{name:"Clash Provider",test:function(t){return 0===t.indexOf("payload:")},parse:function(t){return t.replace("payload:","").replace(/^\s*-\s*/gm,"")}}];_$preprocessors_45.default=___default_45;var _$producers_46={};Object.defineProperty(_$producers_46,"__esModule",{value:!0}),_$producers_46.default=void 0;var __obj_46,___staticJsYaml_46=(__obj_46=_$staticJsYaml_36)&&__obj_46.__esModule?__obj_46:{default:__obj_46},___default_46={QX:{type:"SINGLE",func:function(t){return-1!==["URL-REGEX","DEST-PORT","SRC-IP","IN-PORT","PROTOCOL"].indexOf(t.type)?null:"".concat({"DOMAIN-KEYWORD":"HOST-KEYWORD","DOMAIN-SUFFIX":"HOST-SUFFIX",DOMAIN:"HOST","IP-CIDR6":"IP6-CIDR"}[t.type]||t.type,",").concat(t.content,",SUB-STORE")}},Surge:{type:"SINGLE",func:function(t){var e="".concat(t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(e+=t.options?",".concat(t.options[0]):""),e}},Loon:{type:"SINGLE",func:function(t){return-1!==["DEST-PORT","SRC-IP","IN-PORT","PROTOCOL"].indexOf(t.type)?null:function(t){var e="".concat(t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(e+=t.options?",".concat(t.options[0]):""),e}(t)}},Clash:{type:"ALL",func:function(t){var e={"DEST-PORT":"DST-PORT","SRC-IP":"SRC-IP-CIDR","IN-PORT":"SRC-PORT"},r={payload:t.map((function(t){var r="".concat(e[t.type]||t.type,",").concat(t.content);return"IP-CIDR"!==t.type&&"IP-CIDR6"!==t.type||(r+=t.options?",".concat(t.options[0]):""),r}))};return ___staticJsYaml_46.default.dump(r)}}};_$producers_46.default=___default_46;var _$parsers_44={};function ___createForOfIteratorHelper_44(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_44(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_44(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_44(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_43(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0})).join("\n"):"ALL"===r.type?r.func(t):void 0}};_$ruleUtils_43.RuleUtils=RuleUtils;var _$artifacts_48={};function ___typeof_48(t){return(___typeof_48="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(_$artifacts_48,"__esModule",{value:!0}),_$artifacts_48.default=function(t){___app_48.default.read(_$constants_50.ARTIFACTS_KEY)||___app_48.default.write({},_$constants_50.ARTIFACTS_KEY),t.route("/api/artifacts").get(getAllArtifacts).post(createArtifact),t.route("/api/artifact/:name").get(getArtifact).patch(updateArtifact).delete(deleteArtifact),t.get("/api/cron/sync-artifacts",cronSyncArtifacts)},_$artifacts_48.produceArtifact=produceArtifact;var ___download_48=___interopRequireDefault_48(_$download_54),_gist=___interopRequireDefault_48(_$gist_56),___app_48=___interopRequireDefault_48(_$app_37);function ___interopRequireDefault_48(t){return t&&t.__esModule?t:{default:t}}function ___createForOfIteratorHelper_48(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ___arrayLikeToArray_48(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?___arrayLikeToArray_48(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function ___arrayLikeToArray_48(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __ownKeys_48(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ___objectSpread_48(t){for(var e=1;e>>")),console.log(JSON.stringify(a,null,2)),t.prev=26,t.next=29,syncArtifact(___defineProperty_48({},encodeURIComponent(a.name),{content:c}));case 29:s=t.sent,a.updated=(new Date).getTime(),f=JSON.parse(s.body),a.url=f.files[encodeURIComponent(a.name)].raw_url.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1"),___app_48.default.write(i,_$constants_50.ARTIFACTS_KEY),r.json({status:"success"}),t.next=40;break;case 37:t.prev=37,t.t1=t.catch(26),r.status(500).json({status:"failed",message:t.t1});case 40:t.next=43;break;case 42:r.json({status:"success",data:a});case 43:t.next=46;break;case 45:r.status(404).json({status:"failed",message:"\u672a\u627e\u5230\u5bf9\u5e94\u7684\u914d\u7f6e\uff01"});case 46:case"end":return t.stop()}}),t,null,[[26,37]])})))).apply(this,arguments)}function createArtifact(t,e){var r=t.body;___app_48.default.info("\u6b63\u5728\u521b\u5efa\u8fdc\u7a0b\u914d\u7f6e\uff1a".concat(r.name));var n=___app_48.default.read(_$constants_50.ARTIFACTS_KEY);n[r.name]?e.status(500).json({status:"failed",message:"\u8fdc\u7a0b\u914d\u7f6e".concat(r.name,"\u5df2\u5b58\u5728\uff01")}):(n[r.name]=r,___app_48.default.write(n,_$constants_50.ARTIFACTS_KEY),e.status(201).json({status:"success",data:r}))}function updateArtifact(t,e){var r=___app_48.default.read(_$constants_50.ARTIFACTS_KEY),n=t.params.name,o=r[n=decodeURIComponent(n)];if(o){___app_48.default.info("\u6b63\u5728\u66f4\u65b0\u8fdc\u7a0b\u914d\u7f6e\uff1a".concat(o.name));var i=t.body;if(void 0===i.name||/^[\w-_.]*$/.test(i.name)){var a=___objectSpread_48(___objectSpread_48({},o),i);r[a.name]=a,a.name!==n&&delete r[n],___app_48.default.write(r,_$constants_50.ARTIFACTS_KEY),e.json({status:"success",data:a})}else e.status(500).json({status:"failed",message:"\u8fdc\u7a0b\u914d\u7f6e\u540d\u79f0 ".concat(i.name," \u4e2d\u542b\u6709\u975e\u6cd5\u5b57\u7b26\uff01\u540d\u79f0\u4e2d\u53ea\u80fd\u5305\u542b\u82f1\u6587\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u4e0b\u5212\u7ebf\u3001\u6a2a\u6760\u3002")})}else e.status(404).json({status:"failed",message:"\u672a\u627e\u5230\u5bf9\u5e94\u7684\u8fdc\u7a0b\u914d\u7f6e\uff01"})}function cronSyncArtifacts(t,e){return _cronSyncArtifacts.apply(this,arguments)}function _cronSyncArtifacts(){return(_cronSyncArtifacts=___asyncToGenerator_48(___regeneratorRuntime_48().mark((function t(e,r){var n,o,i,a,u,c,s;return ___regeneratorRuntime_48().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ___app_48.default.info("\u5f00\u59cb\u540c\u6b65\u6240\u6709\u8fdc\u7a0b\u914d\u7f6e..."),n=___app_48.default.read(_$constants_50.ARTIFACTS_KEY),o={},t.prev=3,t.next=6,Promise.all(Object.values(n).map(function(){var t=___asyncToGenerator_48(___regeneratorRuntime_48().mark((function t(e){var r,n;return ___regeneratorRuntime_48().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.sync){t.next=15;break}___app_48.default.info("\u6b63\u5728\u540c\u6b65\u4e91\u914d\u7f6e\uff1a".concat(e.name,"...")),t.t0=e.type,t.next="subscription"===t.t0?5:"collection"===t.t0?7:"rule"===t.t0?9:11;break;case 5:return r=___app_48.default.read(_$constants_50.SUBS_KEY)[e.source],t.abrupt("break",11);case 7:return r=___app_48.default.read(_$constants_50.COLLECTIONS_KEY)[e.source],t.abrupt("break",11);case 9:return r=___app_48.default.read(_$constants_50.RULES_KEY)[e.source],t.abrupt("break",11);case 11:return t.next=13,produceArtifact({type:e.type,item:r,platform:e.platform});case 13:n=t.sent,o[e.name]={content:n};case 15:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 6:return t.next=8,syncArtifact(o);case 8:for(i=t.sent,a=JSON.parse(i.body),u=0,c=Object.values(n);u=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __ownKeys_53(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ___objectSpread_53(t){for(var e=1;e=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __ownKeys_49(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ___objectSpread_49(t){for(var e=1;e0)){t.next=16;break}if("local"===(l=s[f[0]]).source){t.next=16;break}return t.next=14,(0,_$subscriptions_53.getFlowHeaders)(l.url);case 14:(p=t.sent)&&r.set("subscription-userinfo",p);case 16:if(!c){t.next=30;break}return t.prev=17,t.next=20,(0,_$artifacts_48.produceArtifact)({type:"collection",item:c,platform:a,noProcessor:i});case 20:_=t.sent,"JSON"===a?r.set("Content-Type","application/json;charset=utf-8").send(_):r.send(_),t.next=28;break;case 24:t.prev=24,t.t0=t.catch(17),___app_49.default.notify("\ud83c\udf0d \u300e \ud835\udc7a\ud835\udc96\ud835\udc83-\ud835\udc7a\ud835\udc95\ud835\udc90\ud835\udc93\ud835\udc86 \u300f \u4e0b\u8f7d\u7ec4\u5408\u8ba2\u9605\u5931\u8d25","\u274c \u4e0b\u8f7d\u7ec4\u5408\u8ba2\u9605\u9519\u8bef\uff1a".concat(n,"\uff01"),"\ud83e\udd14 \u539f\u56e0\uff1a".concat(t.t0)),r.status(500).json({status:"failed",message:t.t0});case 28:t.next=32;break;case 30:___app_49.default.notify("\ud83c\udf0d \u300e \ud835\udc7a\ud835\udc96\ud835\udc83-\ud835\udc7a\ud835\udc95\ud835\udc90\ud835\udc93\ud835\udc86 \u300f \u4e0b\u8f7d\u7ec4\u5408\u8ba2\u9605\u5931\u8d25","\u274c \u672a\u627e\u5230\u7ec4\u5408\u8ba2\u9605\uff1a".concat(n,"\uff01")),r.status(404).json({status:"failed"});case 32:case"end":return t.stop()}}),t,null,[[17,24]])})),(_downloadCollection=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_49(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_49(i,n,o,a,u,"throw",t)}a(void 0)}))}).apply(this,arguments)}function createCollection(t,e){var r=t.body;___app_49.default.info("\u6b63\u5728\u521b\u5efa\u7ec4\u5408\u8ba2\u9605\uff1a".concat(r.name));var n=___app_49.default.read(_$constants_50.COLLECTIONS_KEY);n[r.name]&&e.status(500).json({status:"failed",message:"\u8ba2\u9605\u96c6".concat(r.name,"\u5df2\u5b58\u5728\uff01")}),n[r.name]=r,___app_49.default.write(n,_$constants_50.COLLECTIONS_KEY),e.status(201).json({status:"success",data:r})}function getCollection(t,e){var r=t.params.name;r=decodeURIComponent(r);var n=___app_49.default.read(_$constants_50.COLLECTIONS_KEY)[r];n?e.json({status:"success",data:n}):e.status(404).json({status:"failed",message:"\u672a\u627e\u5230\u8ba2\u9605\u96c6\uff1a".concat(r,"!")})}function updateCollection(t,e){var r=t.params.name;r=decodeURIComponent(r);var n=t.body,o=___app_49.default.read(_$constants_50.COLLECTIONS_KEY);if(o[r]){var i=___objectSpread_49(___objectSpread_49({},o[r]),n);___app_49.default.info("\u6b63\u5728\u66f4\u65b0\u7ec4\u5408\u8ba2\u9605\uff1a".concat(r,"...")),delete o[r],o[n.name||r]=i,___app_49.default.write(o,_$constants_50.COLLECTIONS_KEY),e.json({status:"success",data:i})}else e.status(500).json({status:"failed",message:"\u8ba2\u9605\u96c6".concat(r,"\u4e0d\u5b58\u5728\uff0c\u65e0\u6cd5\u66f4\u65b0\uff01")})}function deleteCollection(t,e){var r=t.params.name;r=decodeURIComponent(r),___app_49.default.info("\u6b63\u5728\u5220\u9664\u7ec4\u5408\u8ba2\u9605\uff1a".concat(r));var n=___app_49.default.read(_$constants_50.COLLECTIONS_KEY);delete n[r],___app_49.default.write(n,_$constants_50.COLLECTIONS_KEY),e.json({status:"success"})}function getAllCollections(t,e){var r=___app_49.default.read(_$constants_50.COLLECTIONS_KEY);e.json({status:"success",data:r})}var _$settings_52={};Object.defineProperty(_$settings_52,"__esModule",{value:!0}),_$settings_52.default=function(t){___app_52.default.read(_$constants_50.SETTINGS_KEY)||___app_52.default.write({},_$constants_50.SETTINGS_KEY),t.route("/api/settings").get(getSettings).patch(updateSettings)};var __obj_52,___app_52=(__obj_52=_$app_37)&&__obj_52.__esModule?__obj_52:{default:__obj_52};function __ownKeys_52(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ___objectSpread_52(t){for(var e=1;e=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function __asyncGeneratorStep_51(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(s){return void r(s)}u.done?e(c):Promise.resolve(c).then(n,o)}function ___asyncToGenerator_51(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){__asyncGeneratorStep_51(i,n,o,a,u,"next",t)}function u(t){__asyncGeneratorStep_51(i,n,o,a,u,"throw",t)}a(void 0)}))}}function getEnv(t,e){var r=(0,_$openApi_60.ENV)(),n="Node";r.isNode&&(n="Node"),r.isQX&&(n="QX"),r.isLoon&&(n="Loon"),r.isSurge&&(n="Surge"),e.json({backend:n})}function gistBackup(t,e){return _gistBackup.apply(this,arguments)}function _gistBackup(){return(_gistBackup=___asyncToGenerator_51(___regeneratorRuntime_51().mark((function t(e,r){var n,o,i,a,u,c,s;return ___regeneratorRuntime_51().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.query.action,o=___app_51.default.read(_$constants_50.SETTINGS_KEY),i=o.gistToken){t.next=6;break}r.status(500).json({status:"failed",message:"\u672a\u627e\u5230Gist\u5907\u4efdToken!"}),t.next=35;break;case 6:a=new ___gist_51.default({token:i,key:_$constants_50.GIST_BACKUP_KEY}),t.prev=7,c=___app_51.default.read(_$constants_50.SETTINGS_KEY),t.t0=n,t.next="upload"===t.t0?12:"download"===t.t0?20:27;break;case 12:return c.syncTime=(new Date).getTime(),___app_51.default.write(c,_$constants_50.SETTINGS_KEY),u=___app_51.default.read("#sub-store"),___app_51.default.env.isNode&&(u=JSON.stringify(___app_51.default.cache,null," ")),___app_51.default.info("\u4e0a\u4f20\u5907\u4efd\u4e2d..."),t.next=19,a.upload((f={},l=_$constants_50.GIST_BACKUP_FILE_NAME,p={content:u},l in f?Object.defineProperty(f,l,{value:p,enumerable:!0,configurable:!0,writable:!0}):f[l]=p,f));case 19:return t.abrupt("break",27);case 20:return ___app_51.default.info("\u8fd8\u539f\u5907\u4efd\u4e2d..."),t.next=23,a.download(_$constants_50.GIST_BACKUP_FILE_NAME);case 23:return u=t.sent,___app_51.default.write(u,"#sub-store"),___app_51.default.env.isNode&&(u=JSON.parse(u),Object.keys(u).forEach((function(t){___app_51.default.write(u[t],t)}))),t.abrupt("break",27);case 27:r.json({status:"success"}),t.next=35;break;case 30:t.prev=30,t.t1=t.catch(7),s="".concat("upload"===n?"\u4e0a\u4f20":"\u4e0b\u8f7d","\u5907\u4efd\u5931\u8d25\uff01").concat(t.t1),___app_51.default.error(s),r.status(500).json({status:"failed",message:s});case 35:case"end":return t.stop()}var f,l,p}),t,null,[[7,30]])})))).apply(this,arguments)}var _$main_47={},__obj_47,_restful=(__obj_47=_$restful_51)&&__obj_47.__esModule?__obj_47:{default:__obj_47};console.log("\n\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\n \ud835\udc7a\ud835\udc96\ud835\udc83-\ud835\udc7a\ud835\udc95\ud835\udc90\ud835\udc93\ud835\udc86 \xa9 \ud835\udc77\ud835\udc86\ud835\udc8f\ud835\udc88-\ud835\udc80\ud835\udc74\n\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\n"),(0,_restful.default)()}(); \ No newline at end of file