pinets 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,28 +15,28 @@
15
15
  * You should have received a copy of the GNU Affero General Public License
16
16
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
- (function(Ce,Ge){typeof exports=="object"&&typeof module<"u"?Ge(exports):typeof define=="function"&&define.amd?define(["exports"],Ge):(Ce=typeof globalThis<"u"?globalThis:Ce||self,Ge(Ce.PineTSLib={}))})(this,function(Ce){"use strict";var Ge=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],Zt=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],wr="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",Jt="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",bt={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},vt="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",br={5:vt,"5module":vt+" export import",6:vt+" const class extends export import super"},vr=/^in(stanceof)?$/,_r=new RegExp("["+Jt+"]"),Sr=new RegExp("["+Jt+wr+"]");function _t(e,t){for(var i=65536,r=0;r<t.length;r+=2){if(i+=t[r],i>e)return!1;if(i+=t[r+1],i>=e)return!0}return!1}function ve(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&_r.test(String.fromCharCode(e)):t===!1?!1:_t(e,Zt)}function Fe(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Sr.test(String.fromCharCode(e)):t===!1?!1:_t(e,Zt)||_t(e,Ge)}var O=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function ne(e,t){return new O(e,{beforeExpr:!0,binop:t})}var ae={beforeExpr:!0},ee={startsExpr:!0},St={};function V(e,t){return t===void 0&&(t={}),t.keyword=e,St[e]=new O(e,t)}var c={num:new O("num",ee),regexp:new O("regexp",ee),string:new O("string",ee),name:new O("name",ee),privateId:new O("privateId",ee),eof:new O("eof"),bracketL:new O("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new O("]"),braceL:new O("{",{beforeExpr:!0,startsExpr:!0}),braceR:new O("}"),parenL:new O("(",{beforeExpr:!0,startsExpr:!0}),parenR:new O(")"),comma:new O(",",ae),semi:new O(";",ae),colon:new O(":",ae),dot:new O("."),question:new O("?",ae),questionDot:new O("?."),arrow:new O("=>",ae),template:new O("template"),invalidTemplate:new O("invalidTemplate"),ellipsis:new O("...",ae),backQuote:new O("`",ee),dollarBraceL:new O("${",{beforeExpr:!0,startsExpr:!0}),eq:new O("=",{beforeExpr:!0,isAssign:!0}),assign:new O("_=",{beforeExpr:!0,isAssign:!0}),incDec:new O("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new O("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:ne("||",1),logicalAND:ne("&&",2),bitwiseOR:ne("|",3),bitwiseXOR:ne("^",4),bitwiseAND:ne("&",5),equality:ne("==/!=/===/!==",6),relational:ne("</>/<=/>=",7),bitShift:ne("<</>>/>>>",8),plusMin:new O("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:ne("%",10),star:ne("*",10),slash:ne("/",10),starstar:new O("**",{beforeExpr:!0}),coalesce:ne("??",1),_break:V("break"),_case:V("case",ae),_catch:V("catch"),_continue:V("continue"),_debugger:V("debugger"),_default:V("default",ae),_do:V("do",{isLoop:!0,beforeExpr:!0}),_else:V("else",ae),_finally:V("finally"),_for:V("for",{isLoop:!0}),_function:V("function",ee),_if:V("if"),_return:V("return",ae),_switch:V("switch"),_throw:V("throw",ae),_try:V("try"),_var:V("var"),_const:V("const"),_while:V("while",{isLoop:!0}),_with:V("with"),_new:V("new",{beforeExpr:!0,startsExpr:!0}),_this:V("this",ee),_super:V("super",ee),_class:V("class",ee),_extends:V("extends",ae),_export:V("export"),_import:V("import",ee),_null:V("null",ee),_true:V("true",ee),_false:V("false",ee),_in:V("in",{beforeExpr:!0,binop:7}),_instanceof:V("instanceof",{beforeExpr:!0,binop:7}),_typeof:V("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:V("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:V("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},oe=/\r\n?|\n|\u2028|\u2029/,Er=new RegExp(oe.source,"g");function je(e){return e===10||e===13||e===8232||e===8233}function ei(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var s=e.charCodeAt(r);if(je(s))return r<i-1&&s===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var ti=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,he=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ii=Object.prototype,Nr=ii.hasOwnProperty,Cr=ii.toString,$e=Object.hasOwn||function(e,t){return Nr.call(e,t)},ri=Array.isArray||function(e){return Cr.call(e)==="[object Array]"},si=Object.create(null);function ke(e){return si[e]||(si[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function _e(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var kr=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ye=function(t,i){this.line=t,this.column=i};Ye.prototype.offset=function(t){return new Ye(this.line,this.column+t)};var at=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function ni(e,t){for(var i=1,r=0;;){var s=ei(e,r,t);if(s<0)return new Ye(i,t-r);++i,r=s}}var Et={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ai=!1;function Ir(e){var t={};for(var i in Et)t[i]=e&&$e(e,i)?e[i]:Et[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!ai&&typeof console=="object"&&console.warn&&(ai=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
19
- Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),ri(t.onToken)){var r=t.onToken;t.onToken=function(s){return r.push(s)}}return ri(t.onComment)&&(t.onComment=Ar(t,t.onComment)),t}function Ar(e,t){return function(i,r,s,n,a,o){var h={type:i?"Block":"Line",value:r,start:s,end:n};e.locations&&(h.loc=new at(this,a,o)),e.ranges&&(h.range=[s,n]),t.push(h)}}var Qe=1,We=2,Nt=4,oi=8,hi=16,ui=32,Ct=64,ci=128,Xe=256,kt=Qe|We|Xe;function It(e,t){return We|(e?Nt:0)|(t?oi:0)}var ot=0,At=1,Se=2,li=3,pi=4,fi=5,q=function(t,i,r){this.options=t=Ir(t),this.sourceFile=t.sourceFile,this.keywords=ke(br[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var s="";t.allowReserved!==!0&&(s=bt[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(s+=" await")),this.reservedWords=ke(s);var n=(s?s+" ":"")+bt.strict;this.reservedWordsStrict=ke(n),this.reservedWordsStrictBind=ke(n+" "+bt.strictBind),this.input=String(i),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf(`
20
- `,r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(oe).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=c.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Qe),this.regexpState=null,this.privateNameStack=[]},ye={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};q.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},ye.inFunction.get=function(){return(this.currentVarScope().flags&We)>0},ye.inGenerator.get=function(){return(this.currentVarScope().flags&oi)>0&&!this.currentVarScope().inClassFieldInit},ye.inAsync.get=function(){return(this.currentVarScope().flags&Nt)>0&&!this.currentVarScope().inClassFieldInit},ye.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&Xe)return!1;if(t.flags&We)return(t.flags&Nt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},ye.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&Ct)>0||i||this.options.allowSuperOutsideMethod},ye.allowDirectSuper.get=function(){return(this.currentThisScope().flags&ci)>0},ye.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},ye.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(We|Xe))>0||i},ye.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Xe)>0},q.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var r=this,s=0;s<t.length;s++)r=t[s](r);return r},q.parse=function(t,i){return new this(i,t).parse()},q.parseExpressionAt=function(t,i,r){var s=new this(r,t,i);return s.nextToken(),s.parseExpression()},q.tokenizer=function(t,i){return new this(i,t)},Object.defineProperties(q.prototype,ye);var Q=q.prototype,Pr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Q.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){he.lastIndex=e,e+=he.exec(this.input)[0].length;var t=Pr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){he.lastIndex=e+t[0].length;var i=he.exec(this.input),r=i.index+i[0].length,s=this.input.charAt(r);return s===";"||s==="}"||oe.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||s==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,he.lastIndex=e,e+=he.exec(this.input)[0].length,this.input[e]===";"&&e++}},Q.eat=function(e){return this.type===e?(this.next(),!0):!1},Q.isContextual=function(e){return this.type===c.name&&this.value===e&&!this.containsEsc},Q.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},Q.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Q.canInsertSemicolon=function(){return this.type===c.eof||this.type===c.braceR||oe.test(this.input.slice(this.lastTokEnd,this.start))},Q.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Q.semicolon=function(){!this.eat(c.semi)&&!this.insertSemicolon()&&this.unexpected()},Q.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Q.expect=function(e){this.eat(e)||this.unexpected()},Q.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var ht=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Q.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}},Q.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,r=e.doubleProto;if(!t)return i>=0||r>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")},Q.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},Q.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var N=q.prototype;N.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==c.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,s=Object.keys(this.undefinedExports);r<s.length;r+=1){var n=s[r];this.raiseRecoverable(this.undefinedExports[n].start,"Export '"+n+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Pt={kind:"loop"},Tr={kind:"switch"};N.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;he.lastIndex=this.pos;var t=he.exec(this.input),i=this.pos+t[0].length,r=this.input.charCodeAt(i);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(ve(r,!0)){for(var s=i+1;Fe(r=this.input.charCodeAt(s),!0);)++s;if(r===92||r>55295&&r<56320)return!0;var n=this.input.slice(i,s);if(!vr.test(n))return!0}return!1},N.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;he.lastIndex=this.pos;var e=he.exec(this.input),t=this.pos+e[0].length,i;return!oe.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(Fe(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))},N.parseStatement=function(e,t,i){var r=this.type,s=this.startNode(),n;switch(this.isLet(e)&&(r=c._var,n="let"),r){case c._break:case c._continue:return this.parseBreakContinueStatement(s,r.keyword);case c._debugger:return this.parseDebuggerStatement(s);case c._do:return this.parseDoStatement(s);case c._for:return this.parseForStatement(s);case c._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!e);case c._class:return e&&this.unexpected(),this.parseClass(s,!0);case c._if:return this.parseIfStatement(s);case c._return:return this.parseReturnStatement(s);case c._switch:return this.parseSwitchStatement(s);case c._throw:return this.parseThrowStatement(s);case c._try:return this.parseTryStatement(s);case c._const:case c._var:return n=n||this.value,e&&n!=="var"&&this.unexpected(),this.parseVarStatement(s,n);case c._while:return this.parseWhileStatement(s);case c._with:return this.parseWithStatement(s);case c.braceL:return this.parseBlock(!0,s);case c.semi:return this.parseEmptyStatement(s);case c._export:case c._import:if(this.options.ecmaVersion>10&&r===c._import){he.lastIndex=this.pos;var a=he.exec(this.input),o=this.pos+a[0].length,h=this.input.charCodeAt(o);if(h===40||h===46)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===c._import?this.parseImport(s):this.parseExport(s,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!e);var u=this.value,l=this.parseExpression();return r===c.name&&l.type==="Identifier"&&this.eat(c.colon)?this.parseLabeledStatement(s,u,l,e):this.parseExpressionStatement(s,l)}},N.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(c.semi)||this.insertSemicolon()?e.label=null:this.type!==c.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var s=this.labels[r];if((e.label==null||s.name===e.label.name)&&(s.kind!=null&&(i||s.kind==="loop")||e.label&&i))break}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")},N.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},N.parseDoStatement=function(e){return this.next(),this.labels.push(Pt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(c._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(c.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},N.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Pt),this.enterScope(0),this.expect(c.parenL),this.type===c.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===c._var||this.type===c._const||i){var r=this.startNode(),s=i?"let":this.value;return this.next(),this.parseVar(r,!0,s),this.finishNode(r,"VariableDeclaration"),(this.type===c._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===c._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var n=this.isContextual("let"),a=!1,o=this.containsEsc,h=new ht,u=this.start,l=t>-1?this.parseExprSubscripts(h,"await"):this.parseExpression(!0,h);return this.type===c._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===c._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(l.start===u&&!o&&l.type==="Identifier"&&l.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),n&&a&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,h),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(h,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))},N.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,Ze|(i?0:Tt),!1,t)},N.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(c._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},N.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(c.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},N.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(c.braceL),this.labels.push(Tr),this.enterScope(0);for(var t,i=!1;this.type!==c.braceR;)if(this.type===c._case||this.type===c._default){var r=this.type===c._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(c.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},N.parseThrowStatement=function(e){return this.next(),oe.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Rr=[];N.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?ui:0),this.checkLValPattern(e,t?pi:Se),this.expect(c.parenR),e},N.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===c._catch){var t=this.startNode();this.next(),this.eat(c.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(c._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},N.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")},N.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Pt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},N.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},N.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},N.parseLabeledStatement=function(e,t,i,r){for(var s=0,n=this.labels;s<n.length;s+=1){var a=n[s];a.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===c._switch?"switch":null,h=this.labels.length-1;h>=0;h--){var u=this.labels[h];if(u.statementStart===e.start)u.statementStart=this.start,u.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf("label")===-1?r+"label":r:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")},N.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},N.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(c.braceL),e&&this.enterScope(0);this.type!==c.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},N.parseFor=function(e,t){return e.init=t,this.expect(c.semi),e.test=this.type===c.semi?null:this.parseExpression(),this.expect(c.semi),e.update=this.type===c.parenR?null:this.parseExpression(),this.expect(c.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},N.parseForIn=function(e,t){var i=this.type===c._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(c.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")},N.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var s=this.startNode();if(this.parseVarId(s,i),this.eat(c.eq)?s.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===c._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&s.id.type!=="Identifier"&&!(t&&(this.type===c._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):s.init=null,e.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(c.comma))break}return e},N.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?At:Se,!1)};var Ze=1,Tt=2,mi=4;N.parseFunction=function(e,t,i,r,s){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===c.star&&t&Tt&&this.unexpected(),e.generator=this.eat(c.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Ze&&(e.id=t&mi&&this.type!==c.name?null:this.parseIdent(),e.id&&!(t&Tt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?At:Se:li));var n=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(It(e.async,e.generator)),t&Ze||(e.id=this.type===c.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,s),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&Ze?"FunctionDeclaration":"FunctionExpression")},N.parseFunctionParams=function(e){this.expect(c.parenL),e.params=this.parseBindingList(c.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},N.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),s=this.startNode(),n=!1;for(s.body=[],this.expect(c.braceL);this.type!==c.braceR;){var a=this.parseClassElement(e.superClass!==null);a&&(s.body.push(a),a.type==="MethodDefinition"&&a.kind==="constructor"?(n&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),n=!0):a.key&&a.key.type==="PrivateIdentifier"&&Dr(r,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},N.parseClassElement=function(e){if(this.eat(c.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",s=!1,n=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(c.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===c.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===c.star)&&!this.canInsertSemicolon()?n=!0:r="async"),!r&&(t>=9||!n)&&this.eat(c.star)&&(s=!0),!r&&!n&&!s){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=h:r=h)}if(r?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=r,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===c.parenL||a!=="method"||s||n){var u=!i.static&&ut(i,"constructor"),l=u&&e;u&&a!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=u?"constructor":a,this.parseClassMethod(i,s,n,l)}else this.parseClassField(i);return i},N.isClassElementNameStart=function(){return this.type===c.name||this.type===c.privateId||this.type===c.num||this.type===c.string||this.type===c.bracketL||this.type.keyword},N.parseClassElementName=function(e){this.type===c.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},N.parseClassMethod=function(e,t,i,r){var s=e.key;e.kind==="constructor"?(t&&this.raise(s.start,"Constructor can't be a generator"),i&&this.raise(s.start,"Constructor can't be an async method")):e.static&&ut(e,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,i,r);return e.kind==="get"&&n.params.length!==0&&this.raiseRecoverable(n.start,"getter should have no params"),e.kind==="set"&&n.params.length!==1&&this.raiseRecoverable(n.start,"setter should have exactly one param"),e.kind==="set"&&n.params[0].type==="RestElement"&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},N.parseClassField=function(e){if(ut(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&ut(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(c.eq)){var t=this.currentThisScope(),i=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=i}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")},N.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Xe|Ct);this.type!==c.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},N.parseClassId=function(e,t){this.type===c.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Se,!1)):(t===!0&&this.unexpected(),e.id=null)},N.parseClassSuper=function(e){e.superClass=this.eat(c._extends)?this.parseExprSubscripts(null,!1):null},N.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},N.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,s=r===0?null:this.privateNameStack[r-1],n=0;n<i.length;++n){var a=i[n];$e(t,a.name)||(s?s.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}};function Dr(e,t){var i=t.key.name,r=e[i],s="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(s=(t.static?"s":"i")+t.kind),r==="iget"&&s==="iset"||r==="iset"&&s==="iget"||r==="sget"&&s==="sset"||r==="sset"&&s==="sget"?(e[i]="true",!1):r?!0:(e[i]=s,!1)}function ut(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}N.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==c.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},N.parseExport=function(e,t){if(this.next(),this.eat(c.star))return this.parseExportAllDeclaration(e,t);if(this.eat(c._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==c.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,r=e.specifiers;i<r.length;i+=1){var s=r[i];this.checkUnreserved(s.local),this.checkLocalExport(s.local),s.local.type==="Literal"&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},N.parseExportDeclaration=function(e){return this.parseStatement(null)},N.parseExportDefaultDeclaration=function(){var e;if(this.type===c._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Ze|mi,!1,e)}else if(this.type===c._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}},N.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),$e(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)},N.checkPatternExport=function(e,t){var i=t.type;if(i==="Identifier")this.checkExport(e,t,t.start);else if(i==="ObjectPattern")for(var r=0,s=t.properties;r<s.length;r+=1){var n=s[r];this.checkPatternExport(e,n)}else if(i==="ArrayPattern")for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(e,h)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)},N.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var s=r[i];this.checkPatternExport(e,s.id)}},N.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},N.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},N.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(c.braceL);!this.eat(c.braceR);){if(i)i=!1;else if(this.expect(c.comma),this.afterTrailingComma(c.braceR))break;t.push(this.parseExportSpecifier(e))}return t},N.parseImport=function(e){return this.next(),this.type===c.string?(e.specifiers=Rr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===c.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},N.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Se),this.finishNode(e,"ImportSpecifier")},N.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Se),this.finishNode(e,"ImportDefaultSpecifier")},N.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Se),this.finishNode(e,"ImportNamespaceSpecifier")},N.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===c.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(c.comma)))return e;if(this.type===c.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(c.braceL);!this.eat(c.braceR);){if(t)t=!1;else if(this.expect(c.comma),this.afterTrailingComma(c.braceR))break;e.push(this.parseImportSpecifier())}return e},N.parseWithClause=function(){var e=[];if(!this.eat(c._with))return e;this.expect(c.braceL);for(var t={},i=!0;!this.eat(c.braceR);){if(i)i=!1;else if(this.expect(c.comma),this.afterTrailingComma(c.braceR))break;var r=this.parseImportAttribute(),s=r.key.type==="Identifier"?r.key.name:r.key.value;$e(t,s)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+s+"'"),t[s]=!0,e.push(r)}return e},N.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===c.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(c.colon),this.type!==c.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},N.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===c.string){var e=this.parseLiteral(this.value);return kr.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},N.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},N.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var ue=q.prototype;ue.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.toAssignable(n,t),n.type==="RestElement"&&(n.argument.type==="ArrayPattern"||n.argument.type==="ObjectPattern")&&this.raise(n.argument.start,"Unexpected token")}break;case"Property":e.kind!=="init"&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),e.argument.type==="AssignmentPattern"&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":e.operator!=="="&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,i);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return e},ue.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var s=e[r];s&&this.toAssignable(s,t)}if(i){var n=e[i-1];this.options.ecmaVersion===6&&t&&n&&n.type==="RestElement"&&n.argument.type!=="Identifier"&&this.unexpected(n.argument.start)}return e},ue.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},ue.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==c.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},ue.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case c.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(c.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case c.braceL:return this.parseObj(!0)}return this.parseIdent()},ue.parseBindingList=function(e,t,i,r){for(var s=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(c.comma),t&&this.type===c.comma)s.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===c.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),s.push(a),this.type===c.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else s.push(this.parseAssignableListItem(r))}return s},ue.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},ue.parseBindingListItem=function(e){return e},ue.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(c.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},ue.checkLValSimple=function(e,t,i){t===void 0&&(t=ot);var r=t!==ot;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(t===Se&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&($e(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==fi&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":r&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(r?"Binding":"Assigning to")+" rvalue")}},ue.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=ot),e.type){case"ObjectPattern":for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,t,i)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,t,i)}break;default:this.checkLValSimple(e,t,i)}},ue.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=ot),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var me=function(t,i,r,s,n){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=s,this.generator=!!n},$={b_stat:new me("{",!1),b_expr:new me("{",!0),b_tmpl:new me("${",!1),p_stat:new me("(",!1),p_expr:new me("(",!0),q_tmpl:new me("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new me("function",!1),f_expr:new me("function",!0),f_expr_gen:new me("function",!0,!1,null,!0),f_gen:new me("function",!1,!1,null,!0)},qe=q.prototype;qe.initialContext=function(){return[$.b_stat]},qe.curContext=function(){return this.context[this.context.length-1]},qe.braceIsBlock=function(e){var t=this.curContext();return t===$.f_expr||t===$.f_stat?!0:e===c.colon&&(t===$.b_stat||t===$.b_expr)?!t.isExpr:e===c._return||e===c.name&&this.exprAllowed?oe.test(this.input.slice(this.lastTokEnd,this.start)):e===c._else||e===c.semi||e===c.eof||e===c.parenR||e===c.arrow?!0:e===c.braceL?t===$.b_stat:e===c._var||e===c._const||e===c.name?!1:!this.exprAllowed},qe.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1},qe.updateContext=function(e){var t,i=this.type;i.keyword&&e===c.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr},qe.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},c.parenR.updateContext=c.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===$.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},c.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?$.b_stat:$.b_expr),this.exprAllowed=!0},c.dollarBraceL.updateContext=function(){this.context.push($.b_tmpl),this.exprAllowed=!0},c.parenL.updateContext=function(e){var t=e===c._if||e===c._for||e===c._with||e===c._while;this.context.push(t?$.p_stat:$.p_expr),this.exprAllowed=!0},c.incDec.updateContext=function(){},c._function.updateContext=c._class.updateContext=function(e){e.beforeExpr&&e!==c._else&&!(e===c.semi&&this.curContext()!==$.p_stat)&&!(e===c._return&&oe.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===c.colon||e===c.braceL)&&this.curContext()===$.b_stat)?this.context.push($.f_expr):this.context.push($.f_stat),this.exprAllowed=!1},c.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},c.backQuote.updateContext=function(){this.curContext()===$.q_tmpl?this.context.pop():this.context.push($.q_tmpl),this.exprAllowed=!1},c.star.updateContext=function(e){if(e===c._function){var t=this.context.length-1;this.context[t]===$.f_expr?this.context[t]=$.f_expr_gen:this.context[t]=$.f_gen}this.exprAllowed=!0},c.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==c.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var P=q.prototype;P.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,s;switch(r.type){case"Identifier":s=r.name;break;case"Literal":s=String(r.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6){s==="__proto__"&&n==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);return}s="$"+s;var a=t[s];if(a){var o;n==="init"?o=this.strict&&a.init||a.get||a.set:o=a.init||a[n],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else a=t[s]={init:!1,get:!1,set:!1};a[n]=!0}},P.parseExpression=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeAssign(e,t);if(this.type===c.comma){var n=this.startNodeAt(i,r);for(n.expressions=[s];this.eat(c.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return s},P.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,s=-1,n=-1,a=-1;t?(s=t.parenthesizedAssign,n=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new ht,r=!0);var o=this.start,h=this.startLoc;(this.type===c.parenL||this.type===c.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var u=this.parseMaybeConditional(e,t);if(i&&(u=i.call(this,u,o,h)),this.type.isAssign){var l=this.startNodeAt(o,h);return l.operator=this.value,this.type===c.eq&&(u=this.toAssignable(u,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===c.eq?this.checkLValPattern(u):this.checkLValSimple(u),l.left=u,this.next(),l.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(l,"AssignmentExpression")}else r&&this.checkExpressionErrors(t,!0);return s>-1&&(t.parenthesizedAssign=s),n>-1&&(t.trailingComma=n),u},P.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return s;if(this.eat(c.question)){var n=this.startNodeAt(i,r);return n.test=s,n.consequent=this.parseMaybeAssign(),this.expect(c.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return s},P.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||s.start===i&&s.type==="ArrowFunctionExpression"?s:this.parseExprOp(s,i,r,-1,e)},P.parseExprOp=function(e,t,i,r,s){var n=this.type.binop;if(n!=null&&(!s||this.type!==c._in)&&n>r){var a=this.type===c.logicalOR||this.type===c.logicalAND,o=this.type===c.coalesce;o&&(n=c.logicalAND.binop);var h=this.value;this.next();var u=this.start,l=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),u,l,n,s),g=this.buildBinary(t,i,e,f,h,a||o);return(a&&this.type===c.coalesce||o&&(this.type===c.logicalOR||this.type===c.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(g,t,i,r,s)}return e},P.buildBinary=function(e,t,i,r,s,n){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=i,a.operator=s,a.right=r,this.finishNode(a,n?"LogicalExpression":"BinaryExpression")},P.parseMaybeUnary=function(e,t,i,r){var s=this.start,n=this.startLoc,a;if(this.isContextual("await")&&this.canAwait)a=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),h=this.type===c.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,h,r),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&di(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&Rt(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,a=this.finishNode(o,h?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===c.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),a=this.parsePrivateIdent(),this.type!==c._in&&this.unexpected();else{if(a=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return a;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(s,n);u.operator=this.value,u.prefix=!1,u.argument=a,this.checkLValSimple(a),this.next(),a=this.finishNode(u,"UpdateExpression")}}if(!i&&this.eat(c.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(s,n,a,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return a};function di(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&di(e.expression)}function Rt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Rt(e.expression)||e.type==="ParenthesizedExpression"&&Rt(e.expression)}P.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprAtom(e,t);if(s.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return s;var n=this.parseSubscripts(s,i,r,!1,t);return e&&n.type==="MemberExpression"&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n},P.parseSubscripts=function(e,t,i,r,s){for(var n=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,i,r,n,a,s);if(o.optional&&(a=!0),o===e||o.type==="ArrowFunctionExpression"){if(a){var h=this.startNodeAt(t,i);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}e=o}},P.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(c.arrow)},P.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)},P.parseSubscript=function(e,t,i,r,s,n,a){var o=this.options.ecmaVersion>=11,h=o&&this.eat(c.questionDot);r&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(c.bracketL);if(u||h&&this.type!==c.parenL&&this.type!==c.backQuote||this.eat(c.dot)){var l=this.startNodeAt(t,i);l.object=e,u?(l.property=this.parseExpression(),this.expect(c.bracketR)):this.type===c.privateId&&e.type!=="Super"?l.property=this.parsePrivateIdent():l.property=this.parseIdent(this.options.allowReserved!=="never"),l.computed=!!u,o&&(l.optional=h),e=this.finishNode(l,"MemberExpression")}else if(!r&&this.eat(c.parenL)){var f=new ht,g=this.yieldPos,p=this.awaitPos,x=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var y=this.parseExprList(c.parenR,this.options.ecmaVersion>=8,!1,f);if(s&&!h&&this.shouldParseAsyncArrow())return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=g,this.awaitPos=p,this.awaitIdentPos=x,this.parseSubscriptAsyncArrow(t,i,y,a);this.checkExpressionErrors(f,!0),this.yieldPos=g||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=x||this.awaitIdentPos;var w=this.startNodeAt(t,i);w.callee=e,w.arguments=y,o&&(w.optional=h),e=this.finishNode(w,"CallExpression")}else if(this.type===c.backQuote){(h||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(t,i);E.tag=e,E.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(E,"TaggedTemplateExpression")}return e},P.parseExprAtom=function(e,t,i){this.type===c.slash&&this.readRegexp();var r,s=this.potentialArrowAt===this.start;switch(this.type){case c._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===c.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==c.dot&&this.type!==c.bracketL&&this.type!==c.parenL&&this.unexpected(),this.finishNode(r,"Super");case c._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case c.name:var n=this.start,a=this.startLoc,o=this.containsEsc,h=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&h.name==="async"&&!this.canInsertSemicolon()&&this.eat(c._function))return this.overrideContext($.f_expr),this.parseFunction(this.startNodeAt(n,a),0,!1,!0,t);if(s&&!this.canInsertSemicolon()){if(this.eat(c.arrow))return this.parseArrowExpression(this.startNodeAt(n,a),[h],!1,t);if(this.options.ecmaVersion>=8&&h.name==="async"&&this.type===c.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return h=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(c.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,a),[h],!0,t)}return h;case c.regexp:var u=this.value;return r=this.parseLiteral(u.value),r.regex={pattern:u.pattern,flags:u.flags},r;case c.num:case c.string:return this.parseLiteral(this.value);case c._null:case c._true:case c._false:return r=this.startNode(),r.value=this.type===c._null?null:this.type===c._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case c.parenL:var l=this.start,f=this.parseParenAndDistinguishExpression(s,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),f;case c.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(c.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case c.braceL:return this.overrideContext($.b_expr),this.parseObj(!1,e);case c._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case c._class:return this.parseClass(this.startNode(),!1);case c._new:return this.parseNew();case c.backQuote:return this.parseTemplate();case c._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}},P.parseExprAtomDefault=function(){this.unexpected()},P.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===c.parenL&&!e)return this.parseDynamicImport(t);if(this.type===c.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()},P.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(c.parenR)?e.options=null:(this.expect(c.comma),this.afterTrailingComma(c.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(c.parenR)||(this.expect(c.comma),this.afterTrailingComma(c.parenR)||this.unexpected())));else if(!this.eat(c.parenR)){var t=this.start;this.eat(c.comma)&&this.eat(c.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},P.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},P.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},P.parseParenExpression=function(){this.expect(c.parenL);var e=this.parseExpression();return this.expect(c.parenR),e},P.shouldParseArrow=function(e){return!this.canInsertSemicolon()},P.parseParenAndDistinguishExpression=function(e,t){var i=this.start,r=this.startLoc,s,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a=this.start,o=this.startLoc,h=[],u=!0,l=!1,f=new ht,g=this.yieldPos,p=this.awaitPos,x;for(this.yieldPos=0,this.awaitPos=0;this.type!==c.parenR;)if(u?u=!1:this.expect(c.comma),n&&this.afterTrailingComma(c.parenR,!0)){l=!0;break}else if(this.type===c.ellipsis){x=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===c.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else h.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var y=this.lastTokEnd,w=this.lastTokEndLoc;if(this.expect(c.parenR),e&&this.shouldParseArrow(h)&&this.eat(c.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=g,this.awaitPos=p,this.parseParenArrowList(i,r,h,t);(!h.length||l)&&this.unexpected(this.lastTokStart),x&&this.unexpected(x),this.checkExpressionErrors(f,!0),this.yieldPos=g||this.yieldPos,this.awaitPos=p||this.awaitPos,h.length>1?(s=this.startNodeAt(a,o),s.expressions=h,this.finishNodeAt(s,"SequenceExpression",y,w)):s=h[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(i,r);return E.expression=s,this.finishNode(E,"ParenthesizedExpression")}else return s},P.parseParenItem=function(e){return e},P.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var Vr=[];P.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===c.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var r=this.start,s=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,s,!0,!1),this.eat(c.parenL)?e.arguments=this.parseExprList(c.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Vr,this.finishNode(e,"NewExpression")},P.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===c.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
18
+ (function(Ce,Ge){typeof exports=="object"&&typeof module<"u"?Ge(exports):typeof define=="function"&&define.amd?define(["exports"],Ge):(Ce=typeof globalThis<"u"?globalThis:Ce||self,Ge(Ce.PineTSLib={}))})(this,function(Ce){"use strict";var Ge=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],Jt=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],br="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",ei="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",vt={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},_t="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",vr={5:_t,"5module":_t+" export import",6:_t+" const class extends export import super"},_r=/^in(stanceof)?$/,Sr=new RegExp("["+ei+"]"),Er=new RegExp("["+ei+br+"]");function St(e,t){for(var i=65536,r=0;r<t.length;r+=2){if(i+=t[r],i>e)return!1;if(i+=t[r+1],i>=e)return!0}return!1}function ve(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Sr.test(String.fromCharCode(e)):t===!1?!1:St(e,Jt)}function Fe(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Er.test(String.fromCharCode(e)):t===!1?!1:St(e,Jt)||St(e,Ge)}var O=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function ne(e,t){return new O(e,{beforeExpr:!0,binop:t})}var ae={beforeExpr:!0},ee={startsExpr:!0},Et={};function V(e,t){return t===void 0&&(t={}),t.keyword=e,Et[e]=new O(e,t)}var c={num:new O("num",ee),regexp:new O("regexp",ee),string:new O("string",ee),name:new O("name",ee),privateId:new O("privateId",ee),eof:new O("eof"),bracketL:new O("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new O("]"),braceL:new O("{",{beforeExpr:!0,startsExpr:!0}),braceR:new O("}"),parenL:new O("(",{beforeExpr:!0,startsExpr:!0}),parenR:new O(")"),comma:new O(",",ae),semi:new O(";",ae),colon:new O(":",ae),dot:new O("."),question:new O("?",ae),questionDot:new O("?."),arrow:new O("=>",ae),template:new O("template"),invalidTemplate:new O("invalidTemplate"),ellipsis:new O("...",ae),backQuote:new O("`",ee),dollarBraceL:new O("${",{beforeExpr:!0,startsExpr:!0}),eq:new O("=",{beforeExpr:!0,isAssign:!0}),assign:new O("_=",{beforeExpr:!0,isAssign:!0}),incDec:new O("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new O("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:ne("||",1),logicalAND:ne("&&",2),bitwiseOR:ne("|",3),bitwiseXOR:ne("^",4),bitwiseAND:ne("&",5),equality:ne("==/!=/===/!==",6),relational:ne("</>/<=/>=",7),bitShift:ne("<</>>/>>>",8),plusMin:new O("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:ne("%",10),star:ne("*",10),slash:ne("/",10),starstar:new O("**",{beforeExpr:!0}),coalesce:ne("??",1),_break:V("break"),_case:V("case",ae),_catch:V("catch"),_continue:V("continue"),_debugger:V("debugger"),_default:V("default",ae),_do:V("do",{isLoop:!0,beforeExpr:!0}),_else:V("else",ae),_finally:V("finally"),_for:V("for",{isLoop:!0}),_function:V("function",ee),_if:V("if"),_return:V("return",ae),_switch:V("switch"),_throw:V("throw",ae),_try:V("try"),_var:V("var"),_const:V("const"),_while:V("while",{isLoop:!0}),_with:V("with"),_new:V("new",{beforeExpr:!0,startsExpr:!0}),_this:V("this",ee),_super:V("super",ee),_class:V("class",ee),_extends:V("extends",ae),_export:V("export"),_import:V("import",ee),_null:V("null",ee),_true:V("true",ee),_false:V("false",ee),_in:V("in",{beforeExpr:!0,binop:7}),_instanceof:V("instanceof",{beforeExpr:!0,binop:7}),_typeof:V("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:V("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:V("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},oe=/\r\n?|\n|\u2028|\u2029/,Nr=new RegExp(oe.source,"g");function je(e){return e===10||e===13||e===8232||e===8233}function ti(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var s=e.charCodeAt(r);if(je(s))return r<i-1&&s===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var ii=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,he=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ri=Object.prototype,Cr=ri.hasOwnProperty,kr=ri.toString,$e=Object.hasOwn||function(e,t){return Cr.call(e,t)},si=Array.isArray||function(e){return kr.call(e)==="[object Array]"},ni=Object.create(null);function ke(e){return ni[e]||(ni[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function _e(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var Ir=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ye=function(t,i){this.line=t,this.column=i};Ye.prototype.offset=function(t){return new Ye(this.line,this.column+t)};var at=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function ai(e,t){for(var i=1,r=0;;){var s=ti(e,r,t);if(s<0)return new Ye(i,t-r);++i,r=s}}var Nt={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},oi=!1;function Ar(e){var t={};for(var i in Nt)t[i]=e&&$e(e,i)?e[i]:Nt[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!oi&&typeof console=="object"&&console.warn&&(oi=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
19
+ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),si(t.onToken)){var r=t.onToken;t.onToken=function(s){return r.push(s)}}return si(t.onComment)&&(t.onComment=Pr(t,t.onComment)),t}function Pr(e,t){return function(i,r,s,n,a,o){var h={type:i?"Block":"Line",value:r,start:s,end:n};e.locations&&(h.loc=new at(this,a,o)),e.ranges&&(h.range=[s,n]),t.push(h)}}var Qe=1,We=2,Ct=4,hi=8,ui=16,ci=32,kt=64,li=128,Xe=256,It=Qe|We|Xe;function At(e,t){return We|(e?Ct:0)|(t?hi:0)}var ot=0,Pt=1,Se=2,pi=3,fi=4,mi=5,q=function(t,i,r){this.options=t=Ar(t),this.sourceFile=t.sourceFile,this.keywords=ke(vr[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var s="";t.allowReserved!==!0&&(s=vt[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(s+=" await")),this.reservedWords=ke(s);var n=(s?s+" ":"")+vt.strict;this.reservedWordsStrict=ke(n),this.reservedWordsStrictBind=ke(n+" "+vt.strictBind),this.input=String(i),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf(`
20
+ `,r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(oe).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=c.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Qe),this.regexpState=null,this.privateNameStack=[]},ye={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};q.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},ye.inFunction.get=function(){return(this.currentVarScope().flags&We)>0},ye.inGenerator.get=function(){return(this.currentVarScope().flags&hi)>0&&!this.currentVarScope().inClassFieldInit},ye.inAsync.get=function(){return(this.currentVarScope().flags&Ct)>0&&!this.currentVarScope().inClassFieldInit},ye.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&Xe)return!1;if(t.flags&We)return(t.flags&Ct)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},ye.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&kt)>0||i||this.options.allowSuperOutsideMethod},ye.allowDirectSuper.get=function(){return(this.currentThisScope().flags&li)>0},ye.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},ye.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(We|Xe))>0||i},ye.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Xe)>0},q.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var r=this,s=0;s<t.length;s++)r=t[s](r);return r},q.parse=function(t,i){return new this(i,t).parse()},q.parseExpressionAt=function(t,i,r){var s=new this(r,t,i);return s.nextToken(),s.parseExpression()},q.tokenizer=function(t,i){return new this(i,t)},Object.defineProperties(q.prototype,ye);var Q=q.prototype,Tr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Q.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){he.lastIndex=e,e+=he.exec(this.input)[0].length;var t=Tr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){he.lastIndex=e+t[0].length;var i=he.exec(this.input),r=i.index+i[0].length,s=this.input.charAt(r);return s===";"||s==="}"||oe.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||s==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,he.lastIndex=e,e+=he.exec(this.input)[0].length,this.input[e]===";"&&e++}},Q.eat=function(e){return this.type===e?(this.next(),!0):!1},Q.isContextual=function(e){return this.type===c.name&&this.value===e&&!this.containsEsc},Q.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},Q.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Q.canInsertSemicolon=function(){return this.type===c.eof||this.type===c.braceR||oe.test(this.input.slice(this.lastTokEnd,this.start))},Q.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Q.semicolon=function(){!this.eat(c.semi)&&!this.insertSemicolon()&&this.unexpected()},Q.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Q.expect=function(e){this.eat(e)||this.unexpected()},Q.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var ht=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Q.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}},Q.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,r=e.doubleProto;if(!t)return i>=0||r>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")},Q.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},Q.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var N=q.prototype;N.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==c.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,s=Object.keys(this.undefinedExports);r<s.length;r+=1){var n=s[r];this.raiseRecoverable(this.undefinedExports[n].start,"Export '"+n+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Tt={kind:"loop"},Rr={kind:"switch"};N.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;he.lastIndex=this.pos;var t=he.exec(this.input),i=this.pos+t[0].length,r=this.input.charCodeAt(i);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(ve(r,!0)){for(var s=i+1;Fe(r=this.input.charCodeAt(s),!0);)++s;if(r===92||r>55295&&r<56320)return!0;var n=this.input.slice(i,s);if(!_r.test(n))return!0}return!1},N.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;he.lastIndex=this.pos;var e=he.exec(this.input),t=this.pos+e[0].length,i;return!oe.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(Fe(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))},N.parseStatement=function(e,t,i){var r=this.type,s=this.startNode(),n;switch(this.isLet(e)&&(r=c._var,n="let"),r){case c._break:case c._continue:return this.parseBreakContinueStatement(s,r.keyword);case c._debugger:return this.parseDebuggerStatement(s);case c._do:return this.parseDoStatement(s);case c._for:return this.parseForStatement(s);case c._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!e);case c._class:return e&&this.unexpected(),this.parseClass(s,!0);case c._if:return this.parseIfStatement(s);case c._return:return this.parseReturnStatement(s);case c._switch:return this.parseSwitchStatement(s);case c._throw:return this.parseThrowStatement(s);case c._try:return this.parseTryStatement(s);case c._const:case c._var:return n=n||this.value,e&&n!=="var"&&this.unexpected(),this.parseVarStatement(s,n);case c._while:return this.parseWhileStatement(s);case c._with:return this.parseWithStatement(s);case c.braceL:return this.parseBlock(!0,s);case c.semi:return this.parseEmptyStatement(s);case c._export:case c._import:if(this.options.ecmaVersion>10&&r===c._import){he.lastIndex=this.pos;var a=he.exec(this.input),o=this.pos+a[0].length,h=this.input.charCodeAt(o);if(h===40||h===46)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===c._import?this.parseImport(s):this.parseExport(s,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!e);var u=this.value,l=this.parseExpression();return r===c.name&&l.type==="Identifier"&&this.eat(c.colon)?this.parseLabeledStatement(s,u,l,e):this.parseExpressionStatement(s,l)}},N.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(c.semi)||this.insertSemicolon()?e.label=null:this.type!==c.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var s=this.labels[r];if((e.label==null||s.name===e.label.name)&&(s.kind!=null&&(i||s.kind==="loop")||e.label&&i))break}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")},N.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},N.parseDoStatement=function(e){return this.next(),this.labels.push(Tt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(c._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(c.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},N.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Tt),this.enterScope(0),this.expect(c.parenL),this.type===c.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===c._var||this.type===c._const||i){var r=this.startNode(),s=i?"let":this.value;return this.next(),this.parseVar(r,!0,s),this.finishNode(r,"VariableDeclaration"),(this.type===c._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===c._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var n=this.isContextual("let"),a=!1,o=this.containsEsc,h=new ht,u=this.start,l=t>-1?this.parseExprSubscripts(h,"await"):this.parseExpression(!0,h);return this.type===c._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===c._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(l.start===u&&!o&&l.type==="Identifier"&&l.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),n&&a&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,h),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(h,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))},N.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,Ze|(i?0:Rt),!1,t)},N.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(c._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},N.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(c.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},N.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(c.braceL),this.labels.push(Rr),this.enterScope(0);for(var t,i=!1;this.type!==c.braceR;)if(this.type===c._case||this.type===c._default){var r=this.type===c._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(c.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},N.parseThrowStatement=function(e){return this.next(),oe.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Dr=[];N.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?ci:0),this.checkLValPattern(e,t?fi:Se),this.expect(c.parenR),e},N.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===c._catch){var t=this.startNode();this.next(),this.eat(c.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(c._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},N.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")},N.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Tt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},N.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},N.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},N.parseLabeledStatement=function(e,t,i,r){for(var s=0,n=this.labels;s<n.length;s+=1){var a=n[s];a.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===c._switch?"switch":null,h=this.labels.length-1;h>=0;h--){var u=this.labels[h];if(u.statementStart===e.start)u.statementStart=this.start,u.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf("label")===-1?r+"label":r:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")},N.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},N.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(c.braceL),e&&this.enterScope(0);this.type!==c.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},N.parseFor=function(e,t){return e.init=t,this.expect(c.semi),e.test=this.type===c.semi?null:this.parseExpression(),this.expect(c.semi),e.update=this.type===c.parenR?null:this.parseExpression(),this.expect(c.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},N.parseForIn=function(e,t){var i=this.type===c._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(c.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")},N.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var s=this.startNode();if(this.parseVarId(s,i),this.eat(c.eq)?s.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===c._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&s.id.type!=="Identifier"&&!(t&&(this.type===c._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):s.init=null,e.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(c.comma))break}return e},N.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Pt:Se,!1)};var Ze=1,Rt=2,di=4;N.parseFunction=function(e,t,i,r,s){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===c.star&&t&Rt&&this.unexpected(),e.generator=this.eat(c.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Ze&&(e.id=t&di&&this.type!==c.name?null:this.parseIdent(),e.id&&!(t&Rt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Pt:Se:pi));var n=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(At(e.async,e.generator)),t&Ze||(e.id=this.type===c.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,s),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&Ze?"FunctionDeclaration":"FunctionExpression")},N.parseFunctionParams=function(e){this.expect(c.parenL),e.params=this.parseBindingList(c.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},N.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),s=this.startNode(),n=!1;for(s.body=[],this.expect(c.braceL);this.type!==c.braceR;){var a=this.parseClassElement(e.superClass!==null);a&&(s.body.push(a),a.type==="MethodDefinition"&&a.kind==="constructor"?(n&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),n=!0):a.key&&a.key.type==="PrivateIdentifier"&&Vr(r,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},N.parseClassElement=function(e){if(this.eat(c.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",s=!1,n=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(c.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===c.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===c.star)&&!this.canInsertSemicolon()?n=!0:r="async"),!r&&(t>=9||!n)&&this.eat(c.star)&&(s=!0),!r&&!n&&!s){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=h:r=h)}if(r?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=r,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===c.parenL||a!=="method"||s||n){var u=!i.static&&ut(i,"constructor"),l=u&&e;u&&a!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=u?"constructor":a,this.parseClassMethod(i,s,n,l)}else this.parseClassField(i);return i},N.isClassElementNameStart=function(){return this.type===c.name||this.type===c.privateId||this.type===c.num||this.type===c.string||this.type===c.bracketL||this.type.keyword},N.parseClassElementName=function(e){this.type===c.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},N.parseClassMethod=function(e,t,i,r){var s=e.key;e.kind==="constructor"?(t&&this.raise(s.start,"Constructor can't be a generator"),i&&this.raise(s.start,"Constructor can't be an async method")):e.static&&ut(e,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var n=e.value=this.parseMethod(t,i,r);return e.kind==="get"&&n.params.length!==0&&this.raiseRecoverable(n.start,"getter should have no params"),e.kind==="set"&&n.params.length!==1&&this.raiseRecoverable(n.start,"setter should have exactly one param"),e.kind==="set"&&n.params[0].type==="RestElement"&&this.raiseRecoverable(n.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},N.parseClassField=function(e){if(ut(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&ut(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(c.eq)){var t=this.currentThisScope(),i=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=i}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")},N.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Xe|kt);this.type!==c.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},N.parseClassId=function(e,t){this.type===c.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Se,!1)):(t===!0&&this.unexpected(),e.id=null)},N.parseClassSuper=function(e){e.superClass=this.eat(c._extends)?this.parseExprSubscripts(null,!1):null},N.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},N.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,s=r===0?null:this.privateNameStack[r-1],n=0;n<i.length;++n){var a=i[n];$e(t,a.name)||(s?s.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}};function Vr(e,t){var i=t.key.name,r=e[i],s="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(s=(t.static?"s":"i")+t.kind),r==="iget"&&s==="iset"||r==="iset"&&s==="iget"||r==="sget"&&s==="sset"||r==="sset"&&s==="sget"?(e[i]="true",!1):r?!0:(e[i]=s,!1)}function ut(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}N.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==c.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},N.parseExport=function(e,t){if(this.next(),this.eat(c.star))return this.parseExportAllDeclaration(e,t);if(this.eat(c._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==c.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,r=e.specifiers;i<r.length;i+=1){var s=r[i];this.checkUnreserved(s.local),this.checkLocalExport(s.local),s.local.type==="Literal"&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},N.parseExportDeclaration=function(e){return this.parseStatement(null)},N.parseExportDefaultDeclaration=function(){var e;if(this.type===c._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Ze|di,!1,e)}else if(this.type===c._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}},N.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),$e(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)},N.checkPatternExport=function(e,t){var i=t.type;if(i==="Identifier")this.checkExport(e,t,t.start);else if(i==="ObjectPattern")for(var r=0,s=t.properties;r<s.length;r+=1){var n=s[r];this.checkPatternExport(e,n)}else if(i==="ArrayPattern")for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(e,h)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)},N.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var s=r[i];this.checkPatternExport(e,s.id)}},N.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},N.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},N.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(c.braceL);!this.eat(c.braceR);){if(i)i=!1;else if(this.expect(c.comma),this.afterTrailingComma(c.braceR))break;t.push(this.parseExportSpecifier(e))}return t},N.parseImport=function(e){return this.next(),this.type===c.string?(e.specifiers=Dr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===c.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},N.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Se),this.finishNode(e,"ImportSpecifier")},N.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Se),this.finishNode(e,"ImportDefaultSpecifier")},N.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Se),this.finishNode(e,"ImportNamespaceSpecifier")},N.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===c.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(c.comma)))return e;if(this.type===c.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(c.braceL);!this.eat(c.braceR);){if(t)t=!1;else if(this.expect(c.comma),this.afterTrailingComma(c.braceR))break;e.push(this.parseImportSpecifier())}return e},N.parseWithClause=function(){var e=[];if(!this.eat(c._with))return e;this.expect(c.braceL);for(var t={},i=!0;!this.eat(c.braceR);){if(i)i=!1;else if(this.expect(c.comma),this.afterTrailingComma(c.braceR))break;var r=this.parseImportAttribute(),s=r.key.type==="Identifier"?r.key.name:r.key.value;$e(t,s)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+s+"'"),t[s]=!0,e.push(r)}return e},N.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===c.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(c.colon),this.type!==c.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},N.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===c.string){var e=this.parseLiteral(this.value);return Ir.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},N.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},N.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var ue=q.prototype;ue.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.toAssignable(n,t),n.type==="RestElement"&&(n.argument.type==="ArrayPattern"||n.argument.type==="ObjectPattern")&&this.raise(n.argument.start,"Unexpected token")}break;case"Property":e.kind!=="init"&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),e.argument.type==="AssignmentPattern"&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":e.operator!=="="&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,i);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return e},ue.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var s=e[r];s&&this.toAssignable(s,t)}if(i){var n=e[i-1];this.options.ecmaVersion===6&&t&&n&&n.type==="RestElement"&&n.argument.type!=="Identifier"&&this.unexpected(n.argument.start)}return e},ue.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},ue.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==c.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},ue.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case c.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(c.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case c.braceL:return this.parseObj(!0)}return this.parseIdent()},ue.parseBindingList=function(e,t,i,r){for(var s=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(c.comma),t&&this.type===c.comma)s.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===c.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),s.push(a),this.type===c.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else s.push(this.parseAssignableListItem(r))}return s},ue.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},ue.parseBindingListItem=function(e){return e},ue.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(c.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},ue.checkLValSimple=function(e,t,i){t===void 0&&(t=ot);var r=t!==ot;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(t===Se&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&($e(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==mi&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":r&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(r?"Binding":"Assigning to")+" rvalue")}},ue.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=ot),e.type){case"ObjectPattern":for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,t,i)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,t,i)}break;default:this.checkLValSimple(e,t,i)}},ue.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=ot),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var me=function(t,i,r,s,n){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=s,this.generator=!!n},$={b_stat:new me("{",!1),b_expr:new me("{",!0),b_tmpl:new me("${",!1),p_stat:new me("(",!1),p_expr:new me("(",!0),q_tmpl:new me("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new me("function",!1),f_expr:new me("function",!0),f_expr_gen:new me("function",!0,!1,null,!0),f_gen:new me("function",!1,!1,null,!0)},qe=q.prototype;qe.initialContext=function(){return[$.b_stat]},qe.curContext=function(){return this.context[this.context.length-1]},qe.braceIsBlock=function(e){var t=this.curContext();return t===$.f_expr||t===$.f_stat?!0:e===c.colon&&(t===$.b_stat||t===$.b_expr)?!t.isExpr:e===c._return||e===c.name&&this.exprAllowed?oe.test(this.input.slice(this.lastTokEnd,this.start)):e===c._else||e===c.semi||e===c.eof||e===c.parenR||e===c.arrow?!0:e===c.braceL?t===$.b_stat:e===c._var||e===c._const||e===c.name?!1:!this.exprAllowed},qe.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1},qe.updateContext=function(e){var t,i=this.type;i.keyword&&e===c.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr},qe.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},c.parenR.updateContext=c.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===$.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},c.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?$.b_stat:$.b_expr),this.exprAllowed=!0},c.dollarBraceL.updateContext=function(){this.context.push($.b_tmpl),this.exprAllowed=!0},c.parenL.updateContext=function(e){var t=e===c._if||e===c._for||e===c._with||e===c._while;this.context.push(t?$.p_stat:$.p_expr),this.exprAllowed=!0},c.incDec.updateContext=function(){},c._function.updateContext=c._class.updateContext=function(e){e.beforeExpr&&e!==c._else&&!(e===c.semi&&this.curContext()!==$.p_stat)&&!(e===c._return&&oe.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===c.colon||e===c.braceL)&&this.curContext()===$.b_stat)?this.context.push($.f_expr):this.context.push($.f_stat),this.exprAllowed=!1},c.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},c.backQuote.updateContext=function(){this.curContext()===$.q_tmpl?this.context.pop():this.context.push($.q_tmpl),this.exprAllowed=!1},c.star.updateContext=function(e){if(e===c._function){var t=this.context.length-1;this.context[t]===$.f_expr?this.context[t]=$.f_expr_gen:this.context[t]=$.f_gen}this.exprAllowed=!0},c.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==c.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var P=q.prototype;P.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,s;switch(r.type){case"Identifier":s=r.name;break;case"Literal":s=String(r.value);break;default:return}var n=e.kind;if(this.options.ecmaVersion>=6){s==="__proto__"&&n==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);return}s="$"+s;var a=t[s];if(a){var o;n==="init"?o=this.strict&&a.init||a.get||a.set:o=a.init||a[n],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else a=t[s]={init:!1,get:!1,set:!1};a[n]=!0}},P.parseExpression=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeAssign(e,t);if(this.type===c.comma){var n=this.startNodeAt(i,r);for(n.expressions=[s];this.eat(c.comma);)n.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(n,"SequenceExpression")}return s},P.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,s=-1,n=-1,a=-1;t?(s=t.parenthesizedAssign,n=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new ht,r=!0);var o=this.start,h=this.startLoc;(this.type===c.parenL||this.type===c.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var u=this.parseMaybeConditional(e,t);if(i&&(u=i.call(this,u,o,h)),this.type.isAssign){var l=this.startNodeAt(o,h);return l.operator=this.value,this.type===c.eq&&(u=this.toAssignable(u,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===c.eq?this.checkLValPattern(u):this.checkLValSimple(u),l.left=u,this.next(),l.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(l,"AssignmentExpression")}else r&&this.checkExpressionErrors(t,!0);return s>-1&&(t.parenthesizedAssign=s),n>-1&&(t.trailingComma=n),u},P.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return s;if(this.eat(c.question)){var n=this.startNodeAt(i,r);return n.test=s,n.consequent=this.parseMaybeAssign(),this.expect(c.colon),n.alternate=this.parseMaybeAssign(e),this.finishNode(n,"ConditionalExpression")}return s},P.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||s.start===i&&s.type==="ArrowFunctionExpression"?s:this.parseExprOp(s,i,r,-1,e)},P.parseExprOp=function(e,t,i,r,s){var n=this.type.binop;if(n!=null&&(!s||this.type!==c._in)&&n>r){var a=this.type===c.logicalOR||this.type===c.logicalAND,o=this.type===c.coalesce;o&&(n=c.logicalAND.binop);var h=this.value;this.next();var u=this.start,l=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),u,l,n,s),g=this.buildBinary(t,i,e,f,h,a||o);return(a&&this.type===c.coalesce||o&&(this.type===c.logicalOR||this.type===c.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(g,t,i,r,s)}return e},P.buildBinary=function(e,t,i,r,s,n){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=i,a.operator=s,a.right=r,this.finishNode(a,n?"LogicalExpression":"BinaryExpression")},P.parseMaybeUnary=function(e,t,i,r){var s=this.start,n=this.startLoc,a;if(this.isContextual("await")&&this.canAwait)a=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),h=this.type===c.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,h,r),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&gi(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&Dt(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,a=this.finishNode(o,h?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===c.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),a=this.parsePrivateIdent(),this.type!==c._in&&this.unexpected();else{if(a=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return a;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(s,n);u.operator=this.value,u.prefix=!1,u.argument=a,this.checkLValSimple(a),this.next(),a=this.finishNode(u,"UpdateExpression")}}if(!i&&this.eat(c.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(s,n,a,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return a};function gi(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&gi(e.expression)}function Dt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Dt(e.expression)||e.type==="ParenthesizedExpression"&&Dt(e.expression)}P.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprAtom(e,t);if(s.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return s;var n=this.parseSubscripts(s,i,r,!1,t);return e&&n.type==="MemberExpression"&&(e.parenthesizedAssign>=n.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=n.start&&(e.parenthesizedBind=-1),e.trailingComma>=n.start&&(e.trailingComma=-1)),n},P.parseSubscripts=function(e,t,i,r,s){for(var n=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,i,r,n,a,s);if(o.optional&&(a=!0),o===e||o.type==="ArrowFunctionExpression"){if(a){var h=this.startNodeAt(t,i);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}e=o}},P.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(c.arrow)},P.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)},P.parseSubscript=function(e,t,i,r,s,n,a){var o=this.options.ecmaVersion>=11,h=o&&this.eat(c.questionDot);r&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(c.bracketL);if(u||h&&this.type!==c.parenL&&this.type!==c.backQuote||this.eat(c.dot)){var l=this.startNodeAt(t,i);l.object=e,u?(l.property=this.parseExpression(),this.expect(c.bracketR)):this.type===c.privateId&&e.type!=="Super"?l.property=this.parsePrivateIdent():l.property=this.parseIdent(this.options.allowReserved!=="never"),l.computed=!!u,o&&(l.optional=h),e=this.finishNode(l,"MemberExpression")}else if(!r&&this.eat(c.parenL)){var f=new ht,g=this.yieldPos,p=this.awaitPos,x=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var y=this.parseExprList(c.parenR,this.options.ecmaVersion>=8,!1,f);if(s&&!h&&this.shouldParseAsyncArrow())return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=g,this.awaitPos=p,this.awaitIdentPos=x,this.parseSubscriptAsyncArrow(t,i,y,a);this.checkExpressionErrors(f,!0),this.yieldPos=g||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=x||this.awaitIdentPos;var w=this.startNodeAt(t,i);w.callee=e,w.arguments=y,o&&(w.optional=h),e=this.finishNode(w,"CallExpression")}else if(this.type===c.backQuote){(h||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(t,i);E.tag=e,E.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(E,"TaggedTemplateExpression")}return e},P.parseExprAtom=function(e,t,i){this.type===c.slash&&this.readRegexp();var r,s=this.potentialArrowAt===this.start;switch(this.type){case c._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===c.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==c.dot&&this.type!==c.bracketL&&this.type!==c.parenL&&this.unexpected(),this.finishNode(r,"Super");case c._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case c.name:var n=this.start,a=this.startLoc,o=this.containsEsc,h=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&h.name==="async"&&!this.canInsertSemicolon()&&this.eat(c._function))return this.overrideContext($.f_expr),this.parseFunction(this.startNodeAt(n,a),0,!1,!0,t);if(s&&!this.canInsertSemicolon()){if(this.eat(c.arrow))return this.parseArrowExpression(this.startNodeAt(n,a),[h],!1,t);if(this.options.ecmaVersion>=8&&h.name==="async"&&this.type===c.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return h=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(c.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(n,a),[h],!0,t)}return h;case c.regexp:var u=this.value;return r=this.parseLiteral(u.value),r.regex={pattern:u.pattern,flags:u.flags},r;case c.num:case c.string:return this.parseLiteral(this.value);case c._null:case c._true:case c._false:return r=this.startNode(),r.value=this.type===c._null?null:this.type===c._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case c.parenL:var l=this.start,f=this.parseParenAndDistinguishExpression(s,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),f;case c.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(c.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case c.braceL:return this.overrideContext($.b_expr),this.parseObj(!1,e);case c._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case c._class:return this.parseClass(this.startNode(),!1);case c._new:return this.parseNew();case c.backQuote:return this.parseTemplate();case c._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}},P.parseExprAtomDefault=function(){this.unexpected()},P.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===c.parenL&&!e)return this.parseDynamicImport(t);if(this.type===c.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()},P.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(c.parenR)?e.options=null:(this.expect(c.comma),this.afterTrailingComma(c.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(c.parenR)||(this.expect(c.comma),this.afterTrailingComma(c.parenR)||this.unexpected())));else if(!this.eat(c.parenR)){var t=this.start;this.eat(c.comma)&&this.eat(c.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},P.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},P.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},P.parseParenExpression=function(){this.expect(c.parenL);var e=this.parseExpression();return this.expect(c.parenR),e},P.shouldParseArrow=function(e){return!this.canInsertSemicolon()},P.parseParenAndDistinguishExpression=function(e,t){var i=this.start,r=this.startLoc,s,n=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a=this.start,o=this.startLoc,h=[],u=!0,l=!1,f=new ht,g=this.yieldPos,p=this.awaitPos,x;for(this.yieldPos=0,this.awaitPos=0;this.type!==c.parenR;)if(u?u=!1:this.expect(c.comma),n&&this.afterTrailingComma(c.parenR,!0)){l=!0;break}else if(this.type===c.ellipsis){x=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===c.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else h.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var y=this.lastTokEnd,w=this.lastTokEndLoc;if(this.expect(c.parenR),e&&this.shouldParseArrow(h)&&this.eat(c.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=g,this.awaitPos=p,this.parseParenArrowList(i,r,h,t);(!h.length||l)&&this.unexpected(this.lastTokStart),x&&this.unexpected(x),this.checkExpressionErrors(f,!0),this.yieldPos=g||this.yieldPos,this.awaitPos=p||this.awaitPos,h.length>1?(s=this.startNodeAt(a,o),s.expressions=h,this.finishNodeAt(s,"SequenceExpression",y,w)):s=h[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(i,r);return E.expression=s,this.finishNode(E,"ParenthesizedExpression")}else return s},P.parseParenItem=function(e){return e},P.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var Or=[];P.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===c.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var r=this.start,s=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,s,!0,!1),this.eat(c.parenL)?e.arguments=this.parseExprList(c.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Or,this.finishNode(e,"NewExpression")},P.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===c.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
21
21
  `),cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
22
- `),cooked:this.value},this.next(),i.tail=this.type===c.backQuote,this.finishNode(i,"TemplateElement")},P.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(i.quasis=[r];!r.tail;)this.type===c.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(c.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(c.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")},P.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===c.name||this.type===c.num||this.type===c.string||this.type===c.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===c.star)&&!oe.test(this.input.slice(this.lastTokEnd,this.start))},P.parseObj=function(e,t){var i=this.startNode(),r=!0,s={};for(i.properties=[],this.next();!this.eat(c.braceR);){if(r)r=!1;else if(this.expect(c.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(c.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,s,t),i.properties.push(n)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},P.parseProperty=function(e,t){var i=this.startNode(),r,s,n,a;if(this.options.ecmaVersion>=9&&this.eat(c.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===c.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===c.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(n=this.start,a=this.startLoc),e||(r=this.eat(c.star)));var o=this.containsEsc;return this.parsePropertyName(i),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(s=!0,r=this.options.ecmaVersion>=9&&this.eat(c.star),this.parsePropertyName(i)):s=!1,this.parsePropertyValue(i,e,r,s,n,a,t,o),this.finishNode(i,"Property")},P.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t=e.kind==="get"?0:1;if(e.value.params.length!==t){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},P.parsePropertyValue=function(e,t,i,r,s,n,a,o){(i||r)&&this.type===c.colon&&this.unexpected(),this.eat(c.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===c.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,r)):!t&&!o&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==c.comma&&this.type!==c.braceR&&this.type!==c.eq?((i||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),e.kind="init",t?e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key)):this.type===c.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()},P.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(c.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(c.bracketR),e.key;e.computed=!1}return e.key=this.type===c.num||this.type===c.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},P.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},P.parseMethod=function(e,t,i){var r=this.startNode(),s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(It(t,r.generator)|Ct|(i?ci:0)),this.expect(c.parenL),r.params=this.parseBindingList(c.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(r,"FunctionExpression")},P.parseArrowExpression=function(e,t,i,r){var s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(It(i,!1)|hi),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},P.parseFunctionBody=function(e,t,i,r){var s=t&&this.type!==c.braceL,n=this.strict,a=!1;if(s)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!n||o)&&(a=this.strictDirective(this.end),a&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var h=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!n&&!a&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,fi),e.body=this.parseBlock(!1,void 0,a&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=h}this.exitScope()},P.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){var r=i[t];if(r.type!=="Identifier")return!1}return!0},P.checkParams=function(e,t){for(var i=Object.create(null),r=0,s=e.params;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,At,t?null:i)}},P.parseExprList=function(e,t,i,r){for(var s=[],n=!0;!this.eat(e);){if(n)n=!1;else if(this.expect(c.comma),t&&this.afterTrailingComma(e))break;var a=void 0;i&&this.type===c.comma?a=null:this.type===c.ellipsis?(a=this.parseSpread(r),r&&this.type===c.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):a=this.parseMaybeAssign(!1,r),s.push(a)}return s},P.checkUnreserved=function(e){var t=e.start,i=e.end,r=e.name;if(this.inGenerator&&r==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&r==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(r==="arguments"||r==="await")&&this.raise(t,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(t,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,i).indexOf("\\")!==-1)){var s=this.strict?this.reservedWordsStrict:this.reservedWords;s.test(r)&&(!this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+r+"' is reserved"))}},P.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),t.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},P.parseIdentNode=function(){var e=this.startNode();return this.type===c.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name==="class"||e.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=c.name):this.unexpected(),e},P.parsePrivateIdent=function(){var e=this.startNode();return this.type===c.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},P.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===c.semi||this.canInsertSemicolon()||this.type!==c.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(c.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},P.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var ct=q.prototype;ct.raise=function(e,t){var i=ni(this.input,e);t+=" ("+i.line+":"+i.column+")";var r=new SyntaxError(t);throw r.pos=e,r.loc=i,r.raisedAt=this.pos,r},ct.raiseRecoverable=ct.raise,ct.curPosition=function(){if(this.options.locations)return new Ye(this.curLine,this.pos-this.lineStart)};var Ie=q.prototype,Or=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Ie.enterScope=function(e){this.scopeStack.push(new Or(e))},Ie.exitScope=function(){this.scopeStack.pop()},Ie.treatFunctionsAsVarInScope=function(e){return e.flags&We||!this.inModule&&e.flags&Qe},Ie.declareName=function(e,t,i){var r=!1;if(t===Se){var s=this.currentScope();r=s.lexical.indexOf(e)>-1||s.functions.indexOf(e)>-1||s.var.indexOf(e)>-1,s.lexical.push(e),this.inModule&&s.flags&Qe&&delete this.undefinedExports[e]}else if(t===pi){var n=this.currentScope();n.lexical.push(e)}else if(t===li){var a=this.currentScope();this.treatFunctionsAsVar?r=a.lexical.indexOf(e)>-1:r=a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var h=this.scopeStack[o];if(h.lexical.indexOf(e)>-1&&!(h.flags&ui&&h.lexical[0]===e)||!this.treatFunctionsAsVarInScope(h)&&h.functions.indexOf(e)>-1){r=!0;break}if(h.var.push(e),this.inModule&&h.flags&Qe&&delete this.undefinedExports[e],h.flags&kt)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},Ie.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Ie.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Ie.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&kt)return t}},Ie.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&kt&&!(t.flags&hi))return t}};var lt=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new at(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},Je=q.prototype;Je.startNode=function(){return new lt(this,this.start,this.startLoc)},Je.startNodeAt=function(e,t){return new lt(this,e,t)};function gi(e,t,i,r){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=i),e}Je.finishNode=function(e,t){return gi.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},Je.finishNodeAt=function(e,t,i,r){return gi.call(this,e,t,i,r)},Je.copyNode=function(e){var t=new lt(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Mr="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",xi="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",yi=xi+" Extended_Pictographic",wi=yi,bi=wi+" EBase EComp EMod EPres ExtPict",vi=bi,Lr=vi,Br={9:xi,10:yi,11:wi,12:bi,13:vi,14:Lr},Fr="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",jr={9:"",10:"",11:"",12:"",13:"",14:Fr},_i="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Si="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Ei=Si+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ni=Ei+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Ci=Ni+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ki=Ci+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",$r=ki+" "+Mr,Wr={9:Si,10:Ei,11:Ni,12:Ci,13:ki,14:$r},Ii={};function qr(e){var t=Ii[e]={binary:ke(Br[e]+" "+_i),binaryOfStrings:ke(jr[e]),nonBinary:{General_Category:ke(_i),Script:ke(Wr[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Dt=0,Ai=[9,10,11,12,13,14];Dt<Ai.length;Dt+=1){var Ur=Ai[Dt];qr(Ur)}var _=q.prototype,pt=function(t,i){this.parent=t,this.base=i||this};pt.prototype.separatedFrom=function(t){for(var i=this;i;i=i.parent)for(var r=t;r;r=r.parent)if(i.base===r.base&&i!==r)return!0;return!1},pt.prototype.sibling=function(){return new pt(this.parent,this.base)};var we=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Ii[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};we.prototype.reset=function(t,i,r){var s=r.indexOf("v")!==-1,n=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=n&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=n&&this.parser.options.ecmaVersion>=9)},we.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},we.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return-1;var n=r.charCodeAt(t);if(!(i||this.switchU)||n<=55295||n>=57344||t+1>=s)return n;var a=r.charCodeAt(t+1);return a>=56320&&a<=57343?(n<<10)+a-56613888:n},we.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return s;var n=r.charCodeAt(t),a;return!(i||this.switchU)||n<=55295||n>=57344||t+1>=s||(a=r.charCodeAt(t+1))<56320||a>57343?t+1:t+2},we.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)},we.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},we.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)},we.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1},we.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var r=this.pos,s=0,n=t;s<n.length;s+=1){var a=n[s],o=this.at(r,i);if(o===-1||o!==a)return!1;r=this.nextIndex(r,i)}return this.pos=r,!0},_.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,r=!1,s=!1,n=0;n<i.length;n++){var a=i.charAt(n);t.indexOf(a)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(a,n+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),a==="u"&&(r=!0),a==="v"&&(s=!0)}this.options.ecmaVersion>=15&&r&&s&&this.raise(e.start,"Invalid regular expression flag")};function Kr(e){for(var t in e)return!0;return!1}_.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Kr(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},_.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t<i.length;t+=1){var r=i[t];e.groupNames[r]||e.raise("Invalid named capture referenced")}},_.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new pt(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},_.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},_.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},_.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1},_.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},_.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},_.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var r=0,s=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue),e.eat(125)))return s!==-1&&s<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1},_.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},_.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},_.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(e),r=e.eat(45);if(i||r){for(var s=0;s<i.length;s++){var n=i.charAt(s);i.indexOf(n,s+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(r){var a=this.regexp_eatModifiers(e);!i&&!a&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var h=a.charAt(o);(a.indexOf(h,o+1)>-1||i.indexOf(h)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},_.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},_.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&zr(i);)t+=_e(i),e.advance();return t};function zr(e){return e===105||e===109||e===115}_.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},_.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},_.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Pi(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Pi(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}_.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Pi(i);)e.advance();return e.pos!==t},_.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1},_.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var r=0,s=i;r<s.length;r+=1){var n=s[r];n.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},_.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},_.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=_e(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=_e(e.lastIntValue);return!0}return!1},_.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),Hr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Hr(e){return ve(e,!0)||e===36||e===95}_.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),Gr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Gr(e){return Fe(e,!0)||e===36||e===95||e===8204||e===8205}_.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},_.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1},_.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},_.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},_.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},_.regexp_eatZero=function(e){return e.current()===48&&!ft(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1},_.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1},_.regexp_eatControlLetter=function(e){var t=e.current();return Ti(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Ti(e){return e>=65&&e<=90||e>=97&&e<=122}_.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(r&&s>=55296&&s<=56319){var n=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(a>=56320&&a<=57343)return e.lastIntValue=(s-55296)*1024+(a-56320)+65536,!0}e.pos=n,e.lastIntValue=s}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Yr(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function Yr(e){return e>=0&&e<=1114111}_.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1},_.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Ri=0,Ee=1,ce=2;_.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Qr(t))return e.lastIntValue=-1,e.advance(),Ee;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&r===ce&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return Ri};function Qr(e){return e===100||e===68||e===115||e===83||e===119||e===87}_.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,r),Ee}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,s)}return Ri},_.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){$e(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")},_.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Ee;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ce;e.raise("Invalid property name")},_.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Di(t=e.current());)e.lastStringValue+=_e(t),e.advance();return e.lastStringValue!==""};function Di(e){return Ti(e)||e===95}_.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Xr(t=e.current());)e.lastStringValue+=_e(t),e.advance();return e.lastStringValue!==""};function Xr(e){return Di(e)||ft(e)}_.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},_.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===ce&&e.raise("Negated character class may contain strings"),!0}return!1},_.regexp_classContents=function(e){return e.current()===93?Ee:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Ee)},_.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}},_.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||Mi(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var r=e.current();return r!==93?(e.lastIntValue=r,e.advance(),!0):!1},_.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},_.regexp_classSetExpression=function(e){var t=Ee,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===ce&&(t=ce);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==ce&&(t=Ee);continue}e.raise("Invalid character in character class")}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(r!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===ce&&(t=ce)}},_.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return i!==-1&&r!==-1&&i>r&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},_.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Ee:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},_.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return i&&r===ce&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var s=this.regexp_eatCharacterClassEscape(e);if(s)return s;e.pos=t}return null},_.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null},_.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===ce&&(t=ce);return t},_.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Ee:ce},_.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var i=e.current();return i<0||i===e.lookahead()&&Zr(i)||Jr(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function Zr(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function Jr(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}_.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return es(t)?(e.lastIntValue=t,e.advance(),!0):!1};function es(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}_.regexp_eatClassControlLetter=function(e){var t=e.current();return ft(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},_.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},_.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;ft(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function ft(e){return e>=48&&e<=57}_.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Vi(i=e.current());)e.lastIntValue=16*e.lastIntValue+Oi(i),e.advance();return e.pos!==t};function Vi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Oi(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}_.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1},_.regexp_eatOctalDigit=function(e){var t=e.current();return Mi(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Mi(e){return e>=48&&e<=55}_.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var s=e.current();if(!Vi(s))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+Oi(s),e.advance()}return!0};var Vt=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new at(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},D=q.prototype;D.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Vt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},D.getToken=function(){return this.next(),new Vt(this)},typeof Symbol<"u"&&(D[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===c.eof,value:t}}}}),D.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(c.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},D.readToken=function(e){return ve(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},D.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},D.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var r=void 0,s=t;(r=ei(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())},D.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!je(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())},D.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(e>8&&e<14||e>=5760&&ti.test(String.fromCharCode(e)))++this.pos;else break e}}},D.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)},D.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(c.ellipsis)):(++this.pos,this.finishToken(c.dot))},D.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(c.assign,2):this.finishOp(c.slash,1)},D.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?c.star:c.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=c.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(c.assign,i+1):this.finishOp(r,i)},D.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(c.assign,3)}return this.finishOp(e===124?c.logicalOR:c.logicalAND,2)}return t===61?this.finishOp(c.assign,2):this.finishOp(e===124?c.bitwiseOR:c.bitwiseAND,1)},D.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(c.assign,2):this.finishOp(c.bitwiseXOR,1)},D.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||oe.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(c.incDec,2):t===61?this.finishOp(c.assign,2):this.finishOp(c.plusMin,1)},D.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(c.assign,i+1):this.finishOp(c.bitShift,i)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(i=2),this.finishOp(c.relational,i))},D.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(c.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(c.arrow)):this.finishOp(e===61?c.eq:c.prefix,1)},D.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(c.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(c.assign,3)}return this.finishOp(c.coalesce,2)}}return this.finishOp(c.question,1)},D.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),ve(t,!0)||t===92))return this.finishToken(c.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+_e(t)+"'")},D.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(c.parenL);case 41:return++this.pos,this.finishToken(c.parenR);case 59:return++this.pos,this.finishToken(c.semi);case 44:return++this.pos,this.finishToken(c.comma);case 91:return++this.pos,this.finishToken(c.bracketL);case 93:return++this.pos,this.finishToken(c.bracketR);case 123:return++this.pos,this.finishToken(c.braceL);case 125:return++this.pos,this.finishToken(c.braceR);case 58:return++this.pos,this.finishToken(c.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(c.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(c.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+_e(e)+"'")},D.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)},D.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(oe.test(r)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(r==="[")t=!0;else if(r==="]"&&t)t=!1;else if(r==="/"&&!t)break;e=r==="\\"}++this.pos}var s=this.input.slice(i,this.pos);++this.pos;var n=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(n);var o=this.regexpState||(this.regexpState=new we(this));o.reset(i,s,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var h=null;try{h=new RegExp(s,a)}catch{}return this.finishToken(c.regexp,{pattern:s,flags:a,value:h})},D.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&t===void 0,s=i&&this.input.charCodeAt(this.pos)===48,n=this.pos,a=0,o=0,h=0,u=t??1/0;h<u;++h,++this.pos){var l=this.input.charCodeAt(this.pos),f=void 0;if(r&&l===95){s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),o===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),h===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=l;continue}if(l>=97?f=l-97+10:l>=65?f=l-65+10:l>=48&&l<=57?f=l-48:f=1/0,f>=e)break;o=l,a=a*e+f}return r&&o===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||t!=null&&this.pos-n!==t?null:a};function ts(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Li(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}D.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Li(this.input.slice(t,this.pos)),++this.pos):ve(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(c.num,i)},D.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&r===110){var s=Li(this.input.slice(t,this.pos));return++this.pos,ve(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(c.num,s)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),r===46&&!i&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!i&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),ve(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=ts(this.input.slice(t,this.pos),i);return this.finishToken(c.num,n)},D.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t},D.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(je(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(c.string,t)};var Bi={};D.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Bi)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},D.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Bi;this.raise(e,t)},D.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===c.template||this.type===c.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(c.dollarBraceL)):(++this.pos,this.finishToken(c.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(c.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(je(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
22
+ `),cooked:this.value},this.next(),i.tail=this.type===c.backQuote,this.finishNode(i,"TemplateElement")},P.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(i.quasis=[r];!r.tail;)this.type===c.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(c.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(c.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")},P.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===c.name||this.type===c.num||this.type===c.string||this.type===c.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===c.star)&&!oe.test(this.input.slice(this.lastTokEnd,this.start))},P.parseObj=function(e,t){var i=this.startNode(),r=!0,s={};for(i.properties=[],this.next();!this.eat(c.braceR);){if(r)r=!1;else if(this.expect(c.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(c.braceR))break;var n=this.parseProperty(e,t);e||this.checkPropClash(n,s,t),i.properties.push(n)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},P.parseProperty=function(e,t){var i=this.startNode(),r,s,n,a;if(this.options.ecmaVersion>=9&&this.eat(c.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===c.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===c.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(n=this.start,a=this.startLoc),e||(r=this.eat(c.star)));var o=this.containsEsc;return this.parsePropertyName(i),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(s=!0,r=this.options.ecmaVersion>=9&&this.eat(c.star),this.parsePropertyName(i)):s=!1,this.parsePropertyValue(i,e,r,s,n,a,t,o),this.finishNode(i,"Property")},P.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t=e.kind==="get"?0:1;if(e.value.params.length!==t){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},P.parsePropertyValue=function(e,t,i,r,s,n,a,o){(i||r)&&this.type===c.colon&&this.unexpected(),this.eat(c.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===c.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,r)):!t&&!o&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==c.comma&&this.type!==c.braceR&&this.type!==c.eq?((i||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),e.kind="init",t?e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key)):this.type===c.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(s,n,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()},P.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(c.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(c.bracketR),e.key;e.computed=!1}return e.key=this.type===c.num||this.type===c.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},P.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},P.parseMethod=function(e,t,i){var r=this.startNode(),s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(At(t,r.generator)|kt|(i?li:0)),this.expect(c.parenL),r.params=this.parseBindingList(c.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(r,"FunctionExpression")},P.parseArrowExpression=function(e,t,i,r){var s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(At(i,!1)|ui),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},P.parseFunctionBody=function(e,t,i,r){var s=t&&this.type!==c.braceL,n=this.strict,a=!1;if(s)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!n||o)&&(a=this.strictDirective(this.end),a&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var h=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!n&&!a&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,mi),e.body=this.parseBlock(!1,void 0,a&&!n),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=h}this.exitScope()},P.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){var r=i[t];if(r.type!=="Identifier")return!1}return!0},P.checkParams=function(e,t){for(var i=Object.create(null),r=0,s=e.params;r<s.length;r+=1){var n=s[r];this.checkLValInnerPattern(n,Pt,t?null:i)}},P.parseExprList=function(e,t,i,r){for(var s=[],n=!0;!this.eat(e);){if(n)n=!1;else if(this.expect(c.comma),t&&this.afterTrailingComma(e))break;var a=void 0;i&&this.type===c.comma?a=null:this.type===c.ellipsis?(a=this.parseSpread(r),r&&this.type===c.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):a=this.parseMaybeAssign(!1,r),s.push(a)}return s},P.checkUnreserved=function(e){var t=e.start,i=e.end,r=e.name;if(this.inGenerator&&r==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&r==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(r==="arguments"||r==="await")&&this.raise(t,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(t,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,i).indexOf("\\")!==-1)){var s=this.strict?this.reservedWordsStrict:this.reservedWords;s.test(r)&&(!this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+r+"' is reserved"))}},P.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),t.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},P.parseIdentNode=function(){var e=this.startNode();return this.type===c.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name==="class"||e.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=c.name):this.unexpected(),e},P.parsePrivateIdent=function(){var e=this.startNode();return this.type===c.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},P.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===c.semi||this.canInsertSemicolon()||this.type!==c.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(c.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},P.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var ct=q.prototype;ct.raise=function(e,t){var i=ai(this.input,e);t+=" ("+i.line+":"+i.column+")";var r=new SyntaxError(t);throw r.pos=e,r.loc=i,r.raisedAt=this.pos,r},ct.raiseRecoverable=ct.raise,ct.curPosition=function(){if(this.options.locations)return new Ye(this.curLine,this.pos-this.lineStart)};var Ie=q.prototype,Mr=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Ie.enterScope=function(e){this.scopeStack.push(new Mr(e))},Ie.exitScope=function(){this.scopeStack.pop()},Ie.treatFunctionsAsVarInScope=function(e){return e.flags&We||!this.inModule&&e.flags&Qe},Ie.declareName=function(e,t,i){var r=!1;if(t===Se){var s=this.currentScope();r=s.lexical.indexOf(e)>-1||s.functions.indexOf(e)>-1||s.var.indexOf(e)>-1,s.lexical.push(e),this.inModule&&s.flags&Qe&&delete this.undefinedExports[e]}else if(t===fi){var n=this.currentScope();n.lexical.push(e)}else if(t===pi){var a=this.currentScope();this.treatFunctionsAsVar?r=a.lexical.indexOf(e)>-1:r=a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var h=this.scopeStack[o];if(h.lexical.indexOf(e)>-1&&!(h.flags&ci&&h.lexical[0]===e)||!this.treatFunctionsAsVarInScope(h)&&h.functions.indexOf(e)>-1){r=!0;break}if(h.var.push(e),this.inModule&&h.flags&Qe&&delete this.undefinedExports[e],h.flags&It)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},Ie.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Ie.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Ie.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&It)return t}},Ie.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&It&&!(t.flags&ui))return t}};var lt=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new at(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},Je=q.prototype;Je.startNode=function(){return new lt(this,this.start,this.startLoc)},Je.startNodeAt=function(e,t){return new lt(this,e,t)};function xi(e,t,i,r){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=i),e}Je.finishNode=function(e,t){return xi.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},Je.finishNodeAt=function(e,t,i,r){return xi.call(this,e,t,i,r)},Je.copyNode=function(e){var t=new lt(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Lr="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",yi="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",wi=yi+" Extended_Pictographic",bi=wi,vi=bi+" EBase EComp EMod EPres ExtPict",_i=vi,Br=_i,Fr={9:yi,10:wi,11:bi,12:vi,13:_i,14:Br},jr="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",$r={9:"",10:"",11:"",12:"",13:"",14:jr},Si="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Ei="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Ni=Ei+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ci=Ni+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",ki=Ci+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Ii=ki+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Wr=Ii+" "+Lr,qr={9:Ei,10:Ni,11:Ci,12:ki,13:Ii,14:Wr},Ai={};function Ur(e){var t=Ai[e]={binary:ke(Fr[e]+" "+Si),binaryOfStrings:ke($r[e]),nonBinary:{General_Category:ke(Si),Script:ke(qr[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Vt=0,Pi=[9,10,11,12,13,14];Vt<Pi.length;Vt+=1){var Kr=Pi[Vt];Ur(Kr)}var _=q.prototype,pt=function(t,i){this.parent=t,this.base=i||this};pt.prototype.separatedFrom=function(t){for(var i=this;i;i=i.parent)for(var r=t;r;r=r.parent)if(i.base===r.base&&i!==r)return!0;return!1},pt.prototype.sibling=function(){return new pt(this.parent,this.base)};var we=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Ai[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};we.prototype.reset=function(t,i,r){var s=r.indexOf("v")!==-1,n=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=n&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=n&&this.parser.options.ecmaVersion>=9)},we.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},we.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return-1;var n=r.charCodeAt(t);if(!(i||this.switchU)||n<=55295||n>=57344||t+1>=s)return n;var a=r.charCodeAt(t+1);return a>=56320&&a<=57343?(n<<10)+a-56613888:n},we.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return s;var n=r.charCodeAt(t),a;return!(i||this.switchU)||n<=55295||n>=57344||t+1>=s||(a=r.charCodeAt(t+1))<56320||a>57343?t+1:t+2},we.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)},we.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},we.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)},we.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1},we.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var r=this.pos,s=0,n=t;s<n.length;s+=1){var a=n[s],o=this.at(r,i);if(o===-1||o!==a)return!1;r=this.nextIndex(r,i)}return this.pos=r,!0},_.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,r=!1,s=!1,n=0;n<i.length;n++){var a=i.charAt(n);t.indexOf(a)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(a,n+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),a==="u"&&(r=!0),a==="v"&&(s=!0)}this.options.ecmaVersion>=15&&r&&s&&this.raise(e.start,"Invalid regular expression flag")};function zr(e){for(var t in e)return!0;return!1}_.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&zr(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},_.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t<i.length;t+=1){var r=i[t];e.groupNames[r]||e.raise("Invalid named capture referenced")}},_.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new pt(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},_.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},_.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},_.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1},_.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},_.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},_.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var r=0,s=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue),e.eat(125)))return s!==-1&&s<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1},_.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},_.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},_.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(e),r=e.eat(45);if(i||r){for(var s=0;s<i.length;s++){var n=i.charAt(s);i.indexOf(n,s+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(r){var a=this.regexp_eatModifiers(e);!i&&!a&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var h=a.charAt(o);(a.indexOf(h,o+1)>-1||i.indexOf(h)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},_.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},_.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&Hr(i);)t+=_e(i),e.advance();return t};function Hr(e){return e===105||e===109||e===115}_.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},_.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},_.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Ti(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Ti(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}_.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Ti(i);)e.advance();return e.pos!==t},_.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1},_.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var r=0,s=i;r<s.length;r+=1){var n=s[r];n.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},_.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},_.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=_e(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=_e(e.lastIntValue);return!0}return!1},_.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),Gr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Gr(e){return ve(e,!0)||e===36||e===95}_.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),Yr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Yr(e){return Fe(e,!0)||e===36||e===95||e===8204||e===8205}_.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},_.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1},_.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},_.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},_.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},_.regexp_eatZero=function(e){return e.current()===48&&!ft(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1},_.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1},_.regexp_eatControlLetter=function(e){var t=e.current();return Ri(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Ri(e){return e>=65&&e<=90||e>=97&&e<=122}_.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(r&&s>=55296&&s<=56319){var n=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(a>=56320&&a<=57343)return e.lastIntValue=(s-55296)*1024+(a-56320)+65536,!0}e.pos=n,e.lastIntValue=s}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Qr(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function Qr(e){return e>=0&&e<=1114111}_.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1},_.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Di=0,Ee=1,ce=2;_.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Xr(t))return e.lastIntValue=-1,e.advance(),Ee;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&r===ce&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return Di};function Xr(e){return e===100||e===68||e===115||e===83||e===119||e===87}_.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,r),Ee}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,s)}return Di},_.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){$e(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")},_.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Ee;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ce;e.raise("Invalid property name")},_.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Vi(t=e.current());)e.lastStringValue+=_e(t),e.advance();return e.lastStringValue!==""};function Vi(e){return Ri(e)||e===95}_.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Zr(t=e.current());)e.lastStringValue+=_e(t),e.advance();return e.lastStringValue!==""};function Zr(e){return Vi(e)||ft(e)}_.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},_.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===ce&&e.raise("Negated character class may contain strings"),!0}return!1},_.regexp_classContents=function(e){return e.current()===93?Ee:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Ee)},_.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}},_.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||Li(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var r=e.current();return r!==93?(e.lastIntValue=r,e.advance(),!0):!1},_.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},_.regexp_classSetExpression=function(e){var t=Ee,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===ce&&(t=ce);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==ce&&(t=Ee);continue}e.raise("Invalid character in character class")}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(r!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===ce&&(t=ce)}},_.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return i!==-1&&r!==-1&&i>r&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},_.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Ee:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},_.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return i&&r===ce&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var s=this.regexp_eatCharacterClassEscape(e);if(s)return s;e.pos=t}return null},_.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null},_.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===ce&&(t=ce);return t},_.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Ee:ce},_.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var i=e.current();return i<0||i===e.lookahead()&&Jr(i)||es(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function Jr(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function es(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}_.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return ts(t)?(e.lastIntValue=t,e.advance(),!0):!1};function ts(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}_.regexp_eatClassControlLetter=function(e){var t=e.current();return ft(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},_.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},_.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;ft(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function ft(e){return e>=48&&e<=57}_.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Oi(i=e.current());)e.lastIntValue=16*e.lastIntValue+Mi(i),e.advance();return e.pos!==t};function Oi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Mi(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}_.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1},_.regexp_eatOctalDigit=function(e){var t=e.current();return Li(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Li(e){return e>=48&&e<=55}_.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var s=e.current();if(!Oi(s))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+Mi(s),e.advance()}return!0};var Ot=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new at(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},D=q.prototype;D.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Ot(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},D.getToken=function(){return this.next(),new Ot(this)},typeof Symbol<"u"&&(D[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===c.eof,value:t}}}}),D.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(c.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},D.readToken=function(e){return ve(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},D.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},D.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var r=void 0,s=t;(r=ti(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())},D.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!je(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())},D.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(e>8&&e<14||e>=5760&&ii.test(String.fromCharCode(e)))++this.pos;else break e}}},D.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)},D.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(c.ellipsis)):(++this.pos,this.finishToken(c.dot))},D.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(c.assign,2):this.finishOp(c.slash,1)},D.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?c.star:c.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=c.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(c.assign,i+1):this.finishOp(r,i)},D.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(c.assign,3)}return this.finishOp(e===124?c.logicalOR:c.logicalAND,2)}return t===61?this.finishOp(c.assign,2):this.finishOp(e===124?c.bitwiseOR:c.bitwiseAND,1)},D.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(c.assign,2):this.finishOp(c.bitwiseXOR,1)},D.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||oe.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(c.incDec,2):t===61?this.finishOp(c.assign,2):this.finishOp(c.plusMin,1)},D.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(c.assign,i+1):this.finishOp(c.bitShift,i)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(i=2),this.finishOp(c.relational,i))},D.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(c.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(c.arrow)):this.finishOp(e===61?c.eq:c.prefix,1)},D.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(c.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(c.assign,3)}return this.finishOp(c.coalesce,2)}}return this.finishOp(c.question,1)},D.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),ve(t,!0)||t===92))return this.finishToken(c.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+_e(t)+"'")},D.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(c.parenL);case 41:return++this.pos,this.finishToken(c.parenR);case 59:return++this.pos,this.finishToken(c.semi);case 44:return++this.pos,this.finishToken(c.comma);case 91:return++this.pos,this.finishToken(c.bracketL);case 93:return++this.pos,this.finishToken(c.bracketR);case 123:return++this.pos,this.finishToken(c.braceL);case 125:return++this.pos,this.finishToken(c.braceR);case 58:return++this.pos,this.finishToken(c.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(c.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(c.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+_e(e)+"'")},D.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)},D.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(oe.test(r)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(r==="[")t=!0;else if(r==="]"&&t)t=!1;else if(r==="/"&&!t)break;e=r==="\\"}++this.pos}var s=this.input.slice(i,this.pos);++this.pos;var n=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(n);var o=this.regexpState||(this.regexpState=new we(this));o.reset(i,s,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var h=null;try{h=new RegExp(s,a)}catch{}return this.finishToken(c.regexp,{pattern:s,flags:a,value:h})},D.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&t===void 0,s=i&&this.input.charCodeAt(this.pos)===48,n=this.pos,a=0,o=0,h=0,u=t??1/0;h<u;++h,++this.pos){var l=this.input.charCodeAt(this.pos),f=void 0;if(r&&l===95){s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),o===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),h===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=l;continue}if(l>=97?f=l-97+10:l>=65?f=l-65+10:l>=48&&l<=57?f=l-48:f=1/0,f>=e)break;o=l,a=a*e+f}return r&&o===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||t!=null&&this.pos-n!==t?null:a};function is(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Bi(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}D.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Bi(this.input.slice(t,this.pos)),++this.pos):ve(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(c.num,i)},D.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&r===110){var s=Bi(this.input.slice(t,this.pos));return++this.pos,ve(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(c.num,s)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),r===46&&!i&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!i&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),ve(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=is(this.input.slice(t,this.pos),i);return this.finishToken(c.num,n)},D.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t},D.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(je(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(c.string,t)};var Fi={};D.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Fi)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},D.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Fi;this.raise(e,t)},D.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===c.template||this.type===c.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(c.dollarBraceL)):(++this.pos,this.finishToken(c.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(c.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(je(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
23
23
  `;break;default:e+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},D.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(c.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
24
24
  `&&++this.pos;case`
25
25
  `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},D.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
26
- `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return _e(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(r,8);return s>255&&(r=r.slice(0,-1),s=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return je(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},D.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i},D.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if(Fe(s,r))this.pos+=s<=65535?1:2;else if(s===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var n=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?ve:Fe)(a,r)||this.invalidStringToken(n,"Invalid Unicode escape"),e+=_e(a),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)},D.readWord=function(){var e=this.readWord1(),t=c.name;return this.keywords.test(e)&&(t=St[e]),this.finishToken(t,e)};var is="8.14.0";q.acorn={Parser:q,version:is,defaultOptions:Et,Position:Ye,SourceLocation:at,getLineInfo:ni,Node:lt,TokenType:O,tokTypes:c,keywordTypes:St,TokContext:me,tokContexts:$,isIdentifierChar:Fe,isIdentifierStart:ve,Token:Vt,isNewLine:je,lineBreak:oe,lineBreakG:Er,nonASCIIwhitespace:ti};function Fi(e,t){return q.parse(e,t)}const{stringify:rs}=JSON;if(!String.prototype.repeat)throw new Error("String.prototype.repeat is undefined, see https://github.com/davidbonnet/astring#installation");if(!String.prototype.endsWith)throw new Error("String.prototype.endsWith is undefined, see https://github.com/davidbonnet/astring#installation");const mt={"||":2,"??":3,"&&":4,"|":5,"^":6,"&":7,"==":8,"!=":8,"===":8,"!==":8,"<":9,">":9,"<=":9,">=":9,in:9,instanceof:9,"<<":10,">>":10,">>>":10,"+":11,"-":11,"*":12,"%":12,"/":12,"**":13},de=17,ss={ArrayExpression:20,TaggedTemplateExpression:20,ThisExpression:20,Identifier:20,PrivateIdentifier:20,Literal:18,TemplateLiteral:20,Super:20,SequenceExpression:20,MemberExpression:19,ChainExpression:19,CallExpression:19,NewExpression:19,ArrowFunctionExpression:de,ClassExpression:de,FunctionExpression:de,ObjectExpression:de,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function Ue(e,t){const{generator:i}=e;if(e.write("("),t!=null&&t.length>0){i[t[0].type](t[0],e);const{length:r}=t;for(let s=1;s<r;s++){const n=t[s];e.write(", "),i[n.type](n,e)}}e.write(")")}function ji(e,t,i,r){const s=e.expressionsPrecedence[t.type];if(s===de)return!0;const n=e.expressionsPrecedence[i.type];return s!==n?!r&&s===15&&n===14&&i.operator==="**"||s<n:s!==13&&s!==14?!1:t.operator==="**"&&i.operator==="**"?!r:s===13&&n===13&&(t.operator==="??"||i.operator==="??")?!0:r?mt[t.operator]<=mt[i.operator]:mt[t.operator]<mt[i.operator]}function dt(e,t,i,r){const{generator:s}=e;ji(e,t,i,r)?(e.write("("),s[t.type](t,e),e.write(")")):s[t.type](t,e)}function ns(e,t,i,r){const s=t.split(`
26
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return _e(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(r,8);return s>255&&(r=r.slice(0,-1),s=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return je(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},D.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i},D.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if(Fe(s,r))this.pos+=s<=65535?1:2;else if(s===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var n=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?ve:Fe)(a,r)||this.invalidStringToken(n,"Invalid Unicode escape"),e+=_e(a),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)},D.readWord=function(){var e=this.readWord1(),t=c.name;return this.keywords.test(e)&&(t=Et[e]),this.finishToken(t,e)};var rs="8.14.0";q.acorn={Parser:q,version:rs,defaultOptions:Nt,Position:Ye,SourceLocation:at,getLineInfo:ai,Node:lt,TokenType:O,tokTypes:c,keywordTypes:Et,TokContext:me,tokContexts:$,isIdentifierChar:Fe,isIdentifierStart:ve,Token:Ot,isNewLine:je,lineBreak:oe,lineBreakG:Nr,nonASCIIwhitespace:ii};function ji(e,t){return q.parse(e,t)}const{stringify:ss}=JSON;if(!String.prototype.repeat)throw new Error("String.prototype.repeat is undefined, see https://github.com/davidbonnet/astring#installation");if(!String.prototype.endsWith)throw new Error("String.prototype.endsWith is undefined, see https://github.com/davidbonnet/astring#installation");const mt={"||":2,"??":3,"&&":4,"|":5,"^":6,"&":7,"==":8,"!=":8,"===":8,"!==":8,"<":9,">":9,"<=":9,">=":9,in:9,instanceof:9,"<<":10,">>":10,">>>":10,"+":11,"-":11,"*":12,"%":12,"/":12,"**":13},de=17,ns={ArrayExpression:20,TaggedTemplateExpression:20,ThisExpression:20,Identifier:20,PrivateIdentifier:20,Literal:18,TemplateLiteral:20,Super:20,SequenceExpression:20,MemberExpression:19,ChainExpression:19,CallExpression:19,NewExpression:19,ArrowFunctionExpression:de,ClassExpression:de,FunctionExpression:de,ObjectExpression:de,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function Ue(e,t){const{generator:i}=e;if(e.write("("),t!=null&&t.length>0){i[t[0].type](t[0],e);const{length:r}=t;for(let s=1;s<r;s++){const n=t[s];e.write(", "),i[n.type](n,e)}}e.write(")")}function $i(e,t,i,r){const s=e.expressionsPrecedence[t.type];if(s===de)return!0;const n=e.expressionsPrecedence[i.type];return s!==n?!r&&s===15&&n===14&&i.operator==="**"||s<n:s!==13&&s!==14?!1:t.operator==="**"&&i.operator==="**"?!r:s===13&&n===13&&(t.operator==="??"||i.operator==="??")?!0:r?mt[t.operator]<=mt[i.operator]:mt[t.operator]<mt[i.operator]}function dt(e,t,i,r){const{generator:s}=e;$i(e,t,i,r)?(e.write("("),s[t.type](t,e),e.write(")")):s[t.type](t,e)}function as(e,t,i,r){const s=t.split(`
27
27
  `),n=s.length-1;if(e.write(s[0].trim()),n>0){e.write(r);for(let a=1;a<n;a++)e.write(i+s[a].trim()+r);e.write(i+s[n].trim())}}function X(e,t,i,r){const{length:s}=t;for(let n=0;n<s;n++){const a=t[n];e.write(i),a.type[0]==="L"?e.write("// "+a.value.trim()+`
28
- `,a):(e.write("/*"),ns(e,a.value,i,r),e.write("*/"+r))}}function as(e){let t=e;for(;t!=null;){const{type:i}=t;if(i[0]==="C"&&i[1]==="a")return!0;if(i[0]==="M"&&i[1]==="e"&&i[2]==="m")t=t.object;else return!1}}function Ot(e,t){const{generator:i}=e,{declarations:r}=t;e.write(t.kind+" ");const{length:s}=r;if(s>0){i.VariableDeclarator(r[0],e);for(let n=1;n<s;n++)e.write(", "),i.VariableDeclarator(r[n],e)}}let $i,Wi,qi,Ui,Ki,zi;const Mt={Program(e,t){const i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:s}=t;s&&e.comments!=null&&X(t,e.comments,i,r);const n=e.body,{length:a}=n;for(let o=0;o<a;o++){const h=n[o];s&&h.comments!=null&&X(t,h.comments,i,r),t.write(i),this[h.type](h,t),t.write(r)}s&&e.trailingComments!=null&&X(t,e.trailingComments,i,r)},BlockStatement:zi=function(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t,n=i+t.indent;t.write("{");const a=e.body;if(a!=null&&a.length>0){t.write(r),s&&e.comments!=null&&X(t,e.comments,n,r);const{length:o}=a;for(let h=0;h<o;h++){const u=a[h];s&&u.comments!=null&&X(t,u.comments,n,r),t.write(n),this[u.type](u,t),t.write(r)}t.write(i)}else s&&e.comments!=null&&(t.write(r),X(t,e.comments,n,r),t.write(i));s&&e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write("}"),t.indentLevel--},ClassBody:zi,StaticBlock(e,t){t.write("static "),this.BlockStatement(e,t)},EmptyStatement(e,t){t.write(";")},ExpressionStatement(e,t){const i=t.expressionsPrecedence[e.expression.type];i===de||i===3&&e.expression.left.type[0]==="O"?(t.write("("),this[e.expression.type](e.expression,t),t.write(")")):this[e.expression.type](e.expression,t),t.write(";")},IfStatement(e,t){t.write("if ("),this[e.test.type](e.test,t),t.write(") "),this[e.consequent.type](e.consequent,t),e.alternate!=null&&(t.write(" else "),this[e.alternate.type](e.alternate,t))},LabeledStatement(e,t){this[e.label.type](e.label,t),t.write(": "),this[e.body.type](e.body,t)},BreakStatement(e,t){t.write("break"),e.label!=null&&(t.write(" "),this[e.label.type](e.label,t)),t.write(";")},ContinueStatement(e,t){t.write("continue"),e.label!=null&&(t.write(" "),this[e.label.type](e.label,t)),t.write(";")},WithStatement(e,t){t.write("with ("),this[e.object.type](e.object,t),t.write(") "),this[e.body.type](e.body,t)},SwitchStatement(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t;t.indentLevel++;const n=i+t.indent,a=n+t.indent;t.write("switch ("),this[e.discriminant.type](e.discriminant,t),t.write(") {"+r);const{cases:o}=e,{length:h}=o;for(let u=0;u<h;u++){const l=o[u];s&&l.comments!=null&&X(t,l.comments,n,r),l.test?(t.write(n+"case "),this[l.test.type](l.test,t),t.write(":"+r)):t.write(n+"default:"+r);const{consequent:f}=l,{length:g}=f;for(let p=0;p<g;p++){const x=f[p];s&&x.comments!=null&&X(t,x.comments,a,r),t.write(a),this[x.type](x,t),t.write(r)}}t.indentLevel-=2,t.write(i+"}")},ReturnStatement(e,t){t.write("return"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t)),t.write(";")},ThrowStatement(e,t){t.write("throw "),this[e.argument.type](e.argument,t),t.write(";")},TryStatement(e,t){if(t.write("try "),this[e.block.type](e.block,t),e.handler){const{handler:i}=e;i.param==null?t.write(" catch "):(t.write(" catch ("),this[i.param.type](i.param,t),t.write(") ")),this[i.body.type](i.body,t)}e.finalizer&&(t.write(" finally "),this[e.finalizer.type](e.finalizer,t))},WhileStatement(e,t){t.write("while ("),this[e.test.type](e.test,t),t.write(") "),this[e.body.type](e.body,t)},DoWhileStatement(e,t){t.write("do "),this[e.body.type](e.body,t),t.write(" while ("),this[e.test.type](e.test,t),t.write(");")},ForStatement(e,t){if(t.write("for ("),e.init!=null){const{init:i}=e;i.type[0]==="V"?Ot(t,i):this[i.type](i,t)}t.write("; "),e.test&&this[e.test.type](e.test,t),t.write("; "),e.update&&this[e.update.type](e.update,t),t.write(") "),this[e.body.type](e.body,t)},ForInStatement:$i=function(e,t){t.write(`for ${e.await?"await ":""}(`);const{left:i}=e;i.type[0]==="V"?Ot(t,i):this[i.type](i,t),t.write(e.type[3]==="I"?" in ":" of "),this[e.right.type](e.right,t),t.write(") "),this[e.body.type](e.body,t)},ForOfStatement:$i,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:Wi=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),Ue(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:Wi,VariableDeclaration(e,t){Ot(t,e),t.write(";")},VariableDeclarator(e,t){this[e.id.type](e.id,t),e.init!=null&&(t.write(" = "),this[e.init.type](e.init,t))},ClassDeclaration(e,t){if(t.write("class "+(e.id?`${e.id.name} `:""),e),e.superClass){t.write("extends ");const{superClass:i}=e,{type:r}=i,s=t.expressionsPrecedence[r];(r[0]!=="C"||r[1]!=="l"||r[5]!=="E")&&(s===de||s<t.expressionsPrecedence.ClassExpression)?(t.write("("),this[e.superClass.type](i,t),t.write(")")):this[i.type](i,t),t.write(" ")}this.ClassBody(e.body,t)},ImportDeclaration(e,t){t.write("import ");const{specifiers:i,attributes:r}=e,{length:s}=i;let n=0;if(s>0){for(;n<s;){n>0&&t.write(", ");const a=i[n],o=a.type[6];if(o==="D")t.write(a.local.name,a),n++;else if(o==="N")t.write("* as "+a.local.name,a),n++;else break}if(n<s){for(t.write("{");;){const a=i[n],{name:o}=a.imported;if(t.write(o,a),o!==a.local.name&&t.write(" as "+a.local.name),++n<s)t.write(", ");else break}t.write("}")}t.write(" from ")}if(this.Literal(e.source,t),r&&r.length>0){t.write(" with { ");for(let a=0;a<r.length;a++)this.ImportAttribute(r[a],t),a<r.length-1&&t.write(", ");t.write(" }")}t.write(";")},ImportAttribute(e,t){this.Identifier(e.key,t),t.write(": "),this.Literal(e.value,t)},ImportExpression(e,t){t.write("import("),this[e.source.type](e.source,t),t.write(")")},ExportDefaultDeclaration(e,t){t.write("export default "),this[e.declaration.type](e.declaration,t),t.expressionsPrecedence[e.declaration.type]!=null&&e.declaration.type[0]!=="F"&&t.write(";")},ExportNamedDeclaration(e,t){if(t.write("export "),e.declaration)this[e.declaration.type](e.declaration,t);else{t.write("{");const{specifiers:i}=e,{length:r}=i;if(r>0)for(let s=0;;){const n=i[s],{name:a}=n.local;if(t.write(a,n),a!==n.exported.name&&t.write(" as "+n.exported.name),++s<r)t.write(", ");else break}if(t.write("}"),e.source&&(t.write(" from "),this.Literal(e.source,t)),e.attributes&&e.attributes.length>0){t.write(" with { ");for(let s=0;s<e.attributes.length;s++)this.ImportAttribute(e.attributes[s],t),s<e.attributes.length-1&&t.write(", ");t.write(" }")}t.write(";")}},ExportAllDeclaration(e,t){if(e.exported!=null?t.write("export * as "+e.exported.name+" from "):t.write("export * from "),this.Literal(e.source,t),e.attributes&&e.attributes.length>0){t.write(" with { ");for(let i=0;i<e.attributes.length;i++)this.ImportAttribute(e.attributes[i],t),i<e.attributes.length-1&&t.write(", ");t.write(" }")}t.write(";")},MethodDefinition(e,t){e.static&&t.write("static ");const i=e.kind[0];(i==="g"||i==="s")&&t.write(e.kind+" "),e.value.async&&t.write("async "),e.value.generator&&t.write("*"),e.computed?(t.write("["),this[e.key.type](e.key,t),t.write("]")):this[e.key.type](e.key,t),Ue(t,e.value.params),t.write(" "),this[e.value.body.type](e.value.body,t)},ClassExpression(e,t){this.ClassDeclaration(e,t)},ArrowFunctionExpression(e,t){t.write(e.async?"async ":"",e);const{params:i}=e;i!=null&&(i.length===1&&i[0].type[0]==="I"?t.write(i[0].name,i[0]):Ue(t,e.params)),t.write(" => "),e.body.type[0]==="O"?(t.write("("),this.ObjectExpression(e.body,t),t.write(")")):this[e.body.type](e.body,t)},ThisExpression(e,t){t.write("this",e)},Super(e,t){t.write("super",e)},RestElement:qi=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:qi,YieldExpression(e,t){t.write(e.delegate?"yield*":"yield"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t))},AwaitExpression(e,t){t.write("await ",e),dt(t,e.argument,e)},TemplateLiteral(e,t){const{quasis:i,expressions:r}=e;t.write("`");const{length:s}=r;for(let a=0;a<s;a++){const o=r[a],h=i[a];t.write(h.value.raw,h),t.write("${"),this[o.type](o,t),t.write("}")}const n=i[i.length-1];t.write(n.value.raw,n),t.write("`")},TemplateElement(e,t){t.write(e.value.raw,e)},TaggedTemplateExpression(e,t){dt(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:Ki=function(e,t){if(t.write("["),e.elements.length>0){const{elements:i}=e,{length:r}=i;for(let s=0;;){const n=i[s];if(n!=null&&this[n.type](n,t),++s<r)t.write(", ");else{n==null&&t.write(", ");break}}}t.write("]")},ArrayPattern:Ki,ObjectExpression(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t,n=i+t.indent;if(t.write("{"),e.properties.length>0){t.write(r),s&&e.comments!=null&&X(t,e.comments,n,r);const a=","+r,{properties:o}=e,{length:h}=o;for(let u=0;;){const l=o[u];if(s&&l.comments!=null&&X(t,l.comments,n,r),t.write(n),this[l.type](l,t),++u<h)t.write(a);else break}t.write(r),s&&e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write(i+"}")}else s?e.comments!=null?(t.write(r),X(t,e.comments,n,r),e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),X(t,e.trailingComments,n,r),t.write(i+"}")):t.write("}"):t.write("}");t.indentLevel--},Property(e,t){e.method||e.kind[0]!=="i"?this.MethodDefinition(e,t):(e.shorthand||(e.computed?(t.write("["),this[e.key.type](e.key,t),t.write("]")):this[e.key.type](e.key,t),t.write(": ")),this[e.value.type](e.value,t))},PropertyDefinition(e,t){if(e.static&&t.write("static "),e.computed&&t.write("["),this[e.key.type](e.key,t),e.computed&&t.write("]"),e.value==null){e.key.type[0]!=="F"&&t.write(";");return}t.write(" = "),this[e.value.type](e.value,t),t.write(";")},ObjectPattern(e,t){if(t.write("{"),e.properties.length>0){const{properties:i}=e,{length:r}=i;for(let s=0;this[i[s].type](i[s],t),++s<r;)t.write(", ")}t.write("}")},SequenceExpression(e,t){Ue(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){const{operator:i,argument:r,argument:{type:s}}=e;t.write(i);const n=ji(t,r,e);!n&&(i.length>1||s[0]==="U"&&(s[1]==="n"||s[1]==="p")&&r.prefix&&r.operator[0]===i&&(i==="+"||i==="-"))&&t.write(" "),n?(t.write(i.length>1?" (":"("),this[s](r,t),t.write(")")):this[s](r,t)}else this[e.argument.type](e.argument,t),t.write(e.operator)},UpdateExpression(e,t){e.prefix?(t.write(e.operator),this[e.argument.type](e.argument,t)):(this[e.argument.type](e.argument,t),t.write(e.operator))},AssignmentExpression(e,t){this[e.left.type](e.left,t),t.write(" "+e.operator+" "),this[e.right.type](e.right,t)},AssignmentPattern(e,t){this[e.left.type](e.left,t),t.write(" = "),this[e.right.type](e.right,t)},BinaryExpression:Ui=function(e,t){const i=e.operator==="in";i&&t.write("("),dt(t,e.left,e,!1),t.write(" "+e.operator+" "),dt(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:Ui,ConditionalExpression(e,t){const{test:i}=e,r=t.expressionsPrecedence[i.type];r===de||r<=t.expressionsPrecedence.ConditionalExpression?(t.write("("),this[i.type](i,t),t.write(")")):this[i.type](i,t),t.write(" ? "),this[e.consequent.type](e.consequent,t),t.write(" : "),this[e.alternate.type](e.alternate,t)},NewExpression(e,t){t.write("new ");const i=t.expressionsPrecedence[e.callee.type];i===de||i<t.expressionsPrecedence.CallExpression||as(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),Ue(t,e.arguments)},CallExpression(e,t){const i=t.expressionsPrecedence[e.callee.type];i===de||i<t.expressionsPrecedence.CallExpression?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),e.optional&&t.write("?."),Ue(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){const i=t.expressionsPrecedence[e.object.type];i===de||i<t.expressionsPrecedence.MemberExpression?(t.write("("),this[e.object.type](e.object,t),t.write(")")):this[e.object.type](e.object,t),e.computed?(e.optional&&t.write("?."),t.write("["),this[e.property.type](e.property,t),t.write("]")):(e.optional?t.write("?."):t.write("."),this[e.property.type](e.property,t))},MetaProperty(e,t){t.write(e.meta.name+"."+e.property.name,e)},Identifier(e,t){t.write(e.name,e)},PrivateIdentifier(e,t){t.write(`#${e.name}`,e)},Literal(e,t){e.raw!=null?t.write(e.raw,e):e.regex!=null?this.RegExpLiteral(e,t):e.bigint!=null?t.write(e.bigint+"n",e):t.write(rs(e.value),e)},RegExpLiteral(e,t){const{regex:i}=e;t.write(`/${i.pattern}/${i.flags}`,e)}},os={},hs=Mt;class us{constructor(t){const i=t??os;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:Mt,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:ss,this.indent=i.indent!=null?i.indent:" ",this.lineEnd=i.lineEnd!=null?i.lineEnd:`
28
+ `,a):(e.write("/*"),as(e,a.value,i,r),e.write("*/"+r))}}function os(e){let t=e;for(;t!=null;){const{type:i}=t;if(i[0]==="C"&&i[1]==="a")return!0;if(i[0]==="M"&&i[1]==="e"&&i[2]==="m")t=t.object;else return!1}}function Mt(e,t){const{generator:i}=e,{declarations:r}=t;e.write(t.kind+" ");const{length:s}=r;if(s>0){i.VariableDeclarator(r[0],e);for(let n=1;n<s;n++)e.write(", "),i.VariableDeclarator(r[n],e)}}let Wi,qi,Ui,Ki,zi,Hi;const Lt={Program(e,t){const i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:s}=t;s&&e.comments!=null&&X(t,e.comments,i,r);const n=e.body,{length:a}=n;for(let o=0;o<a;o++){const h=n[o];s&&h.comments!=null&&X(t,h.comments,i,r),t.write(i),this[h.type](h,t),t.write(r)}s&&e.trailingComments!=null&&X(t,e.trailingComments,i,r)},BlockStatement:Hi=function(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t,n=i+t.indent;t.write("{");const a=e.body;if(a!=null&&a.length>0){t.write(r),s&&e.comments!=null&&X(t,e.comments,n,r);const{length:o}=a;for(let h=0;h<o;h++){const u=a[h];s&&u.comments!=null&&X(t,u.comments,n,r),t.write(n),this[u.type](u,t),t.write(r)}t.write(i)}else s&&e.comments!=null&&(t.write(r),X(t,e.comments,n,r),t.write(i));s&&e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write("}"),t.indentLevel--},ClassBody:Hi,StaticBlock(e,t){t.write("static "),this.BlockStatement(e,t)},EmptyStatement(e,t){t.write(";")},ExpressionStatement(e,t){const i=t.expressionsPrecedence[e.expression.type];i===de||i===3&&e.expression.left.type[0]==="O"?(t.write("("),this[e.expression.type](e.expression,t),t.write(")")):this[e.expression.type](e.expression,t),t.write(";")},IfStatement(e,t){t.write("if ("),this[e.test.type](e.test,t),t.write(") "),this[e.consequent.type](e.consequent,t),e.alternate!=null&&(t.write(" else "),this[e.alternate.type](e.alternate,t))},LabeledStatement(e,t){this[e.label.type](e.label,t),t.write(": "),this[e.body.type](e.body,t)},BreakStatement(e,t){t.write("break"),e.label!=null&&(t.write(" "),this[e.label.type](e.label,t)),t.write(";")},ContinueStatement(e,t){t.write("continue"),e.label!=null&&(t.write(" "),this[e.label.type](e.label,t)),t.write(";")},WithStatement(e,t){t.write("with ("),this[e.object.type](e.object,t),t.write(") "),this[e.body.type](e.body,t)},SwitchStatement(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t;t.indentLevel++;const n=i+t.indent,a=n+t.indent;t.write("switch ("),this[e.discriminant.type](e.discriminant,t),t.write(") {"+r);const{cases:o}=e,{length:h}=o;for(let u=0;u<h;u++){const l=o[u];s&&l.comments!=null&&X(t,l.comments,n,r),l.test?(t.write(n+"case "),this[l.test.type](l.test,t),t.write(":"+r)):t.write(n+"default:"+r);const{consequent:f}=l,{length:g}=f;for(let p=0;p<g;p++){const x=f[p];s&&x.comments!=null&&X(t,x.comments,a,r),t.write(a),this[x.type](x,t),t.write(r)}}t.indentLevel-=2,t.write(i+"}")},ReturnStatement(e,t){t.write("return"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t)),t.write(";")},ThrowStatement(e,t){t.write("throw "),this[e.argument.type](e.argument,t),t.write(";")},TryStatement(e,t){if(t.write("try "),this[e.block.type](e.block,t),e.handler){const{handler:i}=e;i.param==null?t.write(" catch "):(t.write(" catch ("),this[i.param.type](i.param,t),t.write(") ")),this[i.body.type](i.body,t)}e.finalizer&&(t.write(" finally "),this[e.finalizer.type](e.finalizer,t))},WhileStatement(e,t){t.write("while ("),this[e.test.type](e.test,t),t.write(") "),this[e.body.type](e.body,t)},DoWhileStatement(e,t){t.write("do "),this[e.body.type](e.body,t),t.write(" while ("),this[e.test.type](e.test,t),t.write(");")},ForStatement(e,t){if(t.write("for ("),e.init!=null){const{init:i}=e;i.type[0]==="V"?Mt(t,i):this[i.type](i,t)}t.write("; "),e.test&&this[e.test.type](e.test,t),t.write("; "),e.update&&this[e.update.type](e.update,t),t.write(") "),this[e.body.type](e.body,t)},ForInStatement:Wi=function(e,t){t.write(`for ${e.await?"await ":""}(`);const{left:i}=e;i.type[0]==="V"?Mt(t,i):this[i.type](i,t),t.write(e.type[3]==="I"?" in ":" of "),this[e.right.type](e.right,t),t.write(") "),this[e.body.type](e.body,t)},ForOfStatement:Wi,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:qi=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),Ue(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:qi,VariableDeclaration(e,t){Mt(t,e),t.write(";")},VariableDeclarator(e,t){this[e.id.type](e.id,t),e.init!=null&&(t.write(" = "),this[e.init.type](e.init,t))},ClassDeclaration(e,t){if(t.write("class "+(e.id?`${e.id.name} `:""),e),e.superClass){t.write("extends ");const{superClass:i}=e,{type:r}=i,s=t.expressionsPrecedence[r];(r[0]!=="C"||r[1]!=="l"||r[5]!=="E")&&(s===de||s<t.expressionsPrecedence.ClassExpression)?(t.write("("),this[e.superClass.type](i,t),t.write(")")):this[i.type](i,t),t.write(" ")}this.ClassBody(e.body,t)},ImportDeclaration(e,t){t.write("import ");const{specifiers:i,attributes:r}=e,{length:s}=i;let n=0;if(s>0){for(;n<s;){n>0&&t.write(", ");const a=i[n],o=a.type[6];if(o==="D")t.write(a.local.name,a),n++;else if(o==="N")t.write("* as "+a.local.name,a),n++;else break}if(n<s){for(t.write("{");;){const a=i[n],{name:o}=a.imported;if(t.write(o,a),o!==a.local.name&&t.write(" as "+a.local.name),++n<s)t.write(", ");else break}t.write("}")}t.write(" from ")}if(this.Literal(e.source,t),r&&r.length>0){t.write(" with { ");for(let a=0;a<r.length;a++)this.ImportAttribute(r[a],t),a<r.length-1&&t.write(", ");t.write(" }")}t.write(";")},ImportAttribute(e,t){this.Identifier(e.key,t),t.write(": "),this.Literal(e.value,t)},ImportExpression(e,t){t.write("import("),this[e.source.type](e.source,t),t.write(")")},ExportDefaultDeclaration(e,t){t.write("export default "),this[e.declaration.type](e.declaration,t),t.expressionsPrecedence[e.declaration.type]!=null&&e.declaration.type[0]!=="F"&&t.write(";")},ExportNamedDeclaration(e,t){if(t.write("export "),e.declaration)this[e.declaration.type](e.declaration,t);else{t.write("{");const{specifiers:i}=e,{length:r}=i;if(r>0)for(let s=0;;){const n=i[s],{name:a}=n.local;if(t.write(a,n),a!==n.exported.name&&t.write(" as "+n.exported.name),++s<r)t.write(", ");else break}if(t.write("}"),e.source&&(t.write(" from "),this.Literal(e.source,t)),e.attributes&&e.attributes.length>0){t.write(" with { ");for(let s=0;s<e.attributes.length;s++)this.ImportAttribute(e.attributes[s],t),s<e.attributes.length-1&&t.write(", ");t.write(" }")}t.write(";")}},ExportAllDeclaration(e,t){if(e.exported!=null?t.write("export * as "+e.exported.name+" from "):t.write("export * from "),this.Literal(e.source,t),e.attributes&&e.attributes.length>0){t.write(" with { ");for(let i=0;i<e.attributes.length;i++)this.ImportAttribute(e.attributes[i],t),i<e.attributes.length-1&&t.write(", ");t.write(" }")}t.write(";")},MethodDefinition(e,t){e.static&&t.write("static ");const i=e.kind[0];(i==="g"||i==="s")&&t.write(e.kind+" "),e.value.async&&t.write("async "),e.value.generator&&t.write("*"),e.computed?(t.write("["),this[e.key.type](e.key,t),t.write("]")):this[e.key.type](e.key,t),Ue(t,e.value.params),t.write(" "),this[e.value.body.type](e.value.body,t)},ClassExpression(e,t){this.ClassDeclaration(e,t)},ArrowFunctionExpression(e,t){t.write(e.async?"async ":"",e);const{params:i}=e;i!=null&&(i.length===1&&i[0].type[0]==="I"?t.write(i[0].name,i[0]):Ue(t,e.params)),t.write(" => "),e.body.type[0]==="O"?(t.write("("),this.ObjectExpression(e.body,t),t.write(")")):this[e.body.type](e.body,t)},ThisExpression(e,t){t.write("this",e)},Super(e,t){t.write("super",e)},RestElement:Ui=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:Ui,YieldExpression(e,t){t.write(e.delegate?"yield*":"yield"),e.argument&&(t.write(" "),this[e.argument.type](e.argument,t))},AwaitExpression(e,t){t.write("await ",e),dt(t,e.argument,e)},TemplateLiteral(e,t){const{quasis:i,expressions:r}=e;t.write("`");const{length:s}=r;for(let a=0;a<s;a++){const o=r[a],h=i[a];t.write(h.value.raw,h),t.write("${"),this[o.type](o,t),t.write("}")}const n=i[i.length-1];t.write(n.value.raw,n),t.write("`")},TemplateElement(e,t){t.write(e.value.raw,e)},TaggedTemplateExpression(e,t){dt(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:zi=function(e,t){if(t.write("["),e.elements.length>0){const{elements:i}=e,{length:r}=i;for(let s=0;;){const n=i[s];if(n!=null&&this[n.type](n,t),++s<r)t.write(", ");else{n==null&&t.write(", ");break}}}t.write("]")},ArrayPattern:zi,ObjectExpression(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:s}=t,n=i+t.indent;if(t.write("{"),e.properties.length>0){t.write(r),s&&e.comments!=null&&X(t,e.comments,n,r);const a=","+r,{properties:o}=e,{length:h}=o;for(let u=0;;){const l=o[u];if(s&&l.comments!=null&&X(t,l.comments,n,r),t.write(n),this[l.type](l,t),++u<h)t.write(a);else break}t.write(r),s&&e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write(i+"}")}else s?e.comments!=null?(t.write(r),X(t,e.comments,n,r),e.trailingComments!=null&&X(t,e.trailingComments,n,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),X(t,e.trailingComments,n,r),t.write(i+"}")):t.write("}"):t.write("}");t.indentLevel--},Property(e,t){e.method||e.kind[0]!=="i"?this.MethodDefinition(e,t):(e.shorthand||(e.computed?(t.write("["),this[e.key.type](e.key,t),t.write("]")):this[e.key.type](e.key,t),t.write(": ")),this[e.value.type](e.value,t))},PropertyDefinition(e,t){if(e.static&&t.write("static "),e.computed&&t.write("["),this[e.key.type](e.key,t),e.computed&&t.write("]"),e.value==null){e.key.type[0]!=="F"&&t.write(";");return}t.write(" = "),this[e.value.type](e.value,t),t.write(";")},ObjectPattern(e,t){if(t.write("{"),e.properties.length>0){const{properties:i}=e,{length:r}=i;for(let s=0;this[i[s].type](i[s],t),++s<r;)t.write(", ")}t.write("}")},SequenceExpression(e,t){Ue(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){const{operator:i,argument:r,argument:{type:s}}=e;t.write(i);const n=$i(t,r,e);!n&&(i.length>1||s[0]==="U"&&(s[1]==="n"||s[1]==="p")&&r.prefix&&r.operator[0]===i&&(i==="+"||i==="-"))&&t.write(" "),n?(t.write(i.length>1?" (":"("),this[s](r,t),t.write(")")):this[s](r,t)}else this[e.argument.type](e.argument,t),t.write(e.operator)},UpdateExpression(e,t){e.prefix?(t.write(e.operator),this[e.argument.type](e.argument,t)):(this[e.argument.type](e.argument,t),t.write(e.operator))},AssignmentExpression(e,t){this[e.left.type](e.left,t),t.write(" "+e.operator+" "),this[e.right.type](e.right,t)},AssignmentPattern(e,t){this[e.left.type](e.left,t),t.write(" = "),this[e.right.type](e.right,t)},BinaryExpression:Ki=function(e,t){const i=e.operator==="in";i&&t.write("("),dt(t,e.left,e,!1),t.write(" "+e.operator+" "),dt(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:Ki,ConditionalExpression(e,t){const{test:i}=e,r=t.expressionsPrecedence[i.type];r===de||r<=t.expressionsPrecedence.ConditionalExpression?(t.write("("),this[i.type](i,t),t.write(")")):this[i.type](i,t),t.write(" ? "),this[e.consequent.type](e.consequent,t),t.write(" : "),this[e.alternate.type](e.alternate,t)},NewExpression(e,t){t.write("new ");const i=t.expressionsPrecedence[e.callee.type];i===de||i<t.expressionsPrecedence.CallExpression||os(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),Ue(t,e.arguments)},CallExpression(e,t){const i=t.expressionsPrecedence[e.callee.type];i===de||i<t.expressionsPrecedence.CallExpression?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),e.optional&&t.write("?."),Ue(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){const i=t.expressionsPrecedence[e.object.type];i===de||i<t.expressionsPrecedence.MemberExpression?(t.write("("),this[e.object.type](e.object,t),t.write(")")):this[e.object.type](e.object,t),e.computed?(e.optional&&t.write("?."),t.write("["),this[e.property.type](e.property,t),t.write("]")):(e.optional?t.write("?."):t.write("."),this[e.property.type](e.property,t))},MetaProperty(e,t){t.write(e.meta.name+"."+e.property.name,e)},Identifier(e,t){t.write(e.name,e)},PrivateIdentifier(e,t){t.write(`#${e.name}`,e)},Literal(e,t){e.raw!=null?t.write(e.raw,e):e.regex!=null?this.RegExpLiteral(e,t):e.bigint!=null?t.write(e.bigint+"n",e):t.write(ss(e.value),e)},RegExpLiteral(e,t){const{regex:i}=e;t.write(`/${i.pattern}/${i.flags}`,e)}},hs={},us=Lt;class cs{constructor(t){const i=t??hs;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:Lt,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:ns,this.indent=i.indent!=null?i.indent:" ",this.lineEnd=i.lineEnd!=null?i.lineEnd:`
29
29
  `,this.indentLevel=i.startingIndentLevel!=null?i.startingIndentLevel:0,this.writeComments=i.comments?i.comments:!1,i.sourceMap!=null&&(this.write=i.output==null?this.writeAndMap:this.writeToStreamAndMap,this.sourceMap=i.sourceMap,this.line=1,this.column=0,this.lineEndSize=this.lineEnd.split(`
30
30
  `).length-1,this.mapping={original:null,generated:this,name:void 0,source:i.sourceMap.file||i.sourceMap._file})}write(t){this.output+=t}writeToStream(t){this.output.write(t)}writeAndMap(t,i){this.output+=t,this.map(t,i)}writeToStreamAndMap(t,i){this.output.write(t),this.map(t,i)}map(t,i){if(i!=null){const{type:n}=i;if(n[0]==="L"&&n[2]==="n"){this.column=0,this.line++;return}if(i.loc!=null){const{mapping:a}=this;a.original=i.loc.start,a.name=i.name,this.sourceMap.addMapping(a)}if(n[0]==="T"&&n[8]==="E"||n[0]==="L"&&n[1]==="i"&&typeof i.value=="string"){const{length:a}=t;let{column:o,line:h}=this;for(let u=0;u<a;u++)t[u]===`
31
- `?(o=0,h++):o++;this.column=o,this.line=h;return}}const{length:r}=t,{lineEnd:s}=this;r>0&&(this.lineEndSize>0&&(s.length===1?t[r-1]===s:t.endsWith(s))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}}function Hi(e,t){const i=new us(t);return i.generator[e.type](e,i),i.output}var cs=Object.defineProperty,ls=(e,t,i)=>t in e?cs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,G=(e,t,i)=>ls(e,typeof t!="symbol"?t+"":t,i);const ps=new Set(["Infinity","NaN","undefined","null","true","false"]),fs=new Set(["Math","Array","Object","String","Number","Boolean","Date","RegExp","Error","JSON","Promise","Set","Map","WeakSet","WeakMap","Symbol","BigInt","Proxy","Reflect","console","isNaN","isFinite","parseInt","parseFloat","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent"]);class ms{constructor(){G(this,"scopes",[]),G(this,"scopeTypes",[]),G(this,"scopeCounts",new Map),G(this,"contextBoundVars",new Set),G(this,"arrayPatternElements",new Set),G(this,"rootParams",new Set),G(this,"localSeriesVars",new Set),G(this,"varKinds",new Map),G(this,"loopVars",new Set),G(this,"loopVarNames",new Map),G(this,"paramIdCounter",0),G(this,"cacheIdCounter",0),G(this,"tempVarCounter",0),G(this,"taCallIdCounter",0),G(this,"hoistingStack",[]),G(this,"suppressHoisting",!1),this.pushScope("glb")}get nextParamIdArg(){return{type:"Identifier",name:`'p${this.paramIdCounter++}'`}}get nextCacheIdArg(){return{type:"Identifier",name:`'cache_${this.cacheIdCounter++}'`}}getNextTACallId(){return{type:"Literal",value:`_ta${this.taCallIdCounter++}`}}pushScope(t){this.scopes.push(new Map),this.scopeTypes.push(t),this.scopeCounts.set(t,(this.scopeCounts.get(t)||0)+1)}popScope(){this.scopes.pop(),this.scopeTypes.pop()}getCurrentScopeType(){return this.scopeTypes[this.scopeTypes.length-1]}getCurrentScopeCount(){return this.scopeCounts.get(this.getCurrentScopeType())||1}addLocalSeriesVar(t){this.localSeriesVars.add(t)}isLocalSeriesVar(t){return this.localSeriesVars.has(t)}addContextBoundVar(t,i=!1){this.contextBoundVars.add(t),i&&this.rootParams.add(t)}removeContextBoundVar(t){this.contextBoundVars.has(t)&&(this.contextBoundVars.delete(t),this.rootParams.has(t)&&this.rootParams.delete(t))}addArrayPatternElement(t){this.arrayPatternElements.add(t)}isContextBound(t){return ps.has(t)||fs.has(t)?!1:this.contextBoundVars.has(t)}isArrayPatternElement(t){return this.arrayPatternElements.has(t)}isRootParam(t){return this.rootParams.has(t)}addLoopVariable(t,i){this.loopVars.add(t),this.loopVarNames.set(t,i)}getLoopVariableName(t){return this.loopVarNames.get(t)}isLoopVariable(t){return this.loopVars.has(t)}addVariable(t,i){if(this.isContextBound(t))return t;const r=this.scopes[this.scopes.length-1],s=this.scopeTypes[this.scopeTypes.length-1],n=this.scopeCounts.get(s)||1,a=`${s}${n}_${t}`;return r.set(t,a),this.varKinds.set(a,i),a}getVariable(t){if(this.loopVars.has(t)){const i=this.loopVarNames.get(t);if(i)return[i,"let"]}if(this.isContextBound(t))return[t,"let"];for(let i=this.scopes.length-1;i>=0;i--){const r=this.scopes[i];if(r.has(t)){const s=r.get(t),n=this.varKinds.get(s)||"let";return[s,n]}}return[t,"let"]}generateTempVar(){return`temp_${++this.tempVarCounter}`}enterHoistingScope(){this.hoistingStack.push([])}exitHoistingScope(){return this.hoistingStack.pop()||[]}addHoistedStatement(t){this.hoistingStack.length>0&&!this.suppressHoisting&&this.hoistingStack[this.hoistingStack.length-1].push(t)}setSuppressHoisting(t){this.suppressHoisting=t}shouldSuppressHoisting(){return this.suppressHoisting}generateParamId(){return`p${this.paramIdCounter++}`}}function Lt(e,t,i,r,s){i||(i=b),function n(a,o,h){var u=h||a.type;i[u](a,o,n),t[u]&&t[u](a,o)}(e,r,s)}function z(e,t,i,r,s){var n=i?ds(i,r||void 0):r;(function a(o,h,u){n[u||o.type](o,h,a)})(e,t,s)}function ds(e,t){var i=Object.create(t||b);for(var r in e)i[r]=e[r];return i}function Bt(e,t,i){i(e,t)}function Re(e,t,i){}var b={};b.Program=b.BlockStatement=b.StaticBlock=function(e,t,i){for(var r=0,s=e.body;r<s.length;r+=1){var n=s[r];i(n,t,"Statement")}},b.Statement=Bt,b.EmptyStatement=Re,b.ExpressionStatement=b.ParenthesizedExpression=b.ChainExpression=function(e,t,i){return i(e.expression,t,"Expression")},b.IfStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Statement"),e.alternate&&i(e.alternate,t,"Statement")},b.LabeledStatement=function(e,t,i){return i(e.body,t,"Statement")},b.BreakStatement=b.ContinueStatement=Re,b.WithStatement=function(e,t,i){i(e.object,t,"Expression"),i(e.body,t,"Statement")},b.SwitchStatement=function(e,t,i){i(e.discriminant,t,"Expression");for(var r=0,s=e.cases;r<s.length;r+=1){var n=s[r];i(n,t)}},b.SwitchCase=function(e,t,i){e.test&&i(e.test,t,"Expression");for(var r=0,s=e.consequent;r<s.length;r+=1){var n=s[r];i(n,t,"Statement")}},b.ReturnStatement=b.YieldExpression=b.AwaitExpression=function(e,t,i){e.argument&&i(e.argument,t,"Expression")},b.ThrowStatement=b.SpreadElement=function(e,t,i){return i(e.argument,t,"Expression")},b.TryStatement=function(e,t,i){i(e.block,t,"Statement"),e.handler&&i(e.handler,t),e.finalizer&&i(e.finalizer,t,"Statement")},b.CatchClause=function(e,t,i){e.param&&i(e.param,t,"Pattern"),i(e.body,t,"Statement")},b.WhileStatement=b.DoWhileStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.body,t,"Statement")},b.ForStatement=function(e,t,i){e.init&&i(e.init,t,"ForInit"),e.test&&i(e.test,t,"Expression"),e.update&&i(e.update,t,"Expression"),i(e.body,t,"Statement")},b.ForInStatement=b.ForOfStatement=function(e,t,i){i(e.left,t,"ForInit"),i(e.right,t,"Expression"),i(e.body,t,"Statement")},b.ForInit=function(e,t,i){e.type==="VariableDeclaration"?i(e,t):i(e,t,"Expression")},b.DebuggerStatement=Re,b.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")},b.VariableDeclaration=function(e,t,i){for(var r=0,s=e.declarations;r<s.length;r+=1){var n=s[r];i(n,t)}},b.VariableDeclarator=function(e,t,i){i(e.id,t,"Pattern"),e.init&&i(e.init,t,"Expression")},b.Function=function(e,t,i){e.id&&i(e.id,t,"Pattern");for(var r=0,s=e.params;r<s.length;r+=1){var n=s[r];i(n,t,"Pattern")}i(e.body,t,e.expression?"Expression":"Statement")},b.Pattern=function(e,t,i){e.type==="Identifier"?i(e,t,"VariablePattern"):e.type==="MemberExpression"?i(e,t,"MemberPattern"):i(e,t)},b.VariablePattern=Re,b.MemberPattern=Bt,b.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")},b.ArrayPattern=function(e,t,i){for(var r=0,s=e.elements;r<s.length;r+=1){var n=s[r];n&&i(n,t,"Pattern")}},b.ObjectPattern=function(e,t,i){for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];n.type==="Property"?(n.computed&&i(n.key,t,"Expression"),i(n.value,t,"Pattern")):n.type==="RestElement"&&i(n.argument,t,"Pattern")}},b.Expression=Bt,b.ThisExpression=b.Super=b.MetaProperty=Re,b.ArrayExpression=function(e,t,i){for(var r=0,s=e.elements;r<s.length;r+=1){var n=s[r];n&&i(n,t,"Expression")}},b.ObjectExpression=function(e,t,i){for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];i(n,t)}},b.FunctionExpression=b.ArrowFunctionExpression=b.FunctionDeclaration,b.SequenceExpression=function(e,t,i){for(var r=0,s=e.expressions;r<s.length;r+=1){var n=s[r];i(n,t,"Expression")}},b.TemplateLiteral=function(e,t,i){for(var r=0,s=e.quasis;r<s.length;r+=1){var n=s[r];i(n,t)}for(var a=0,o=e.expressions;a<o.length;a+=1){var h=o[a];i(h,t,"Expression")}},b.TemplateElement=Re,b.UnaryExpression=b.UpdateExpression=function(e,t,i){i(e.argument,t,"Expression")},b.BinaryExpression=b.LogicalExpression=function(e,t,i){i(e.left,t,"Expression"),i(e.right,t,"Expression")},b.AssignmentExpression=b.AssignmentPattern=function(e,t,i){i(e.left,t,"Pattern"),i(e.right,t,"Expression")},b.ConditionalExpression=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Expression"),i(e.alternate,t,"Expression")},b.NewExpression=b.CallExpression=function(e,t,i){if(i(e.callee,t,"Expression"),e.arguments)for(var r=0,s=e.arguments;r<s.length;r+=1){var n=s[r];i(n,t,"Expression")}},b.MemberExpression=function(e,t,i){i(e.object,t,"Expression"),e.computed&&i(e.property,t,"Expression")},b.ExportNamedDeclaration=b.ExportDefaultDeclaration=function(e,t,i){e.declaration&&i(e.declaration,t,e.type==="ExportNamedDeclaration"||e.declaration.id?"Statement":"Expression"),e.source&&i(e.source,t,"Expression")},b.ExportAllDeclaration=function(e,t,i){e.exported&&i(e.exported,t),i(e.source,t,"Expression")},b.ImportDeclaration=function(e,t,i){for(var r=0,s=e.specifiers;r<s.length;r+=1){var n=s[r];i(n,t)}i(e.source,t,"Expression")},b.ImportExpression=function(e,t,i){i(e.source,t,"Expression")},b.ImportSpecifier=b.ImportDefaultSpecifier=b.ImportNamespaceSpecifier=b.Identifier=b.PrivateIdentifier=b.Literal=Re,b.TaggedTemplateExpression=function(e,t,i){i(e.tag,t,"Expression"),i(e.quasi,t,"Expression")},b.ClassDeclaration=b.ClassExpression=function(e,t,i){return i(e,t,"Class")},b.Class=function(e,t,i){e.id&&i(e.id,t,"Pattern"),e.superClass&&i(e.superClass,t,"Expression"),i(e.body,t)},b.ClassBody=function(e,t,i){for(var r=0,s=e.body;r<s.length;r+=1){var n=s[r];i(n,t)}},b.MethodDefinition=b.PropertyDefinition=b.Property=function(e,t,i){e.computed&&i(e.key,t,"Expression"),e.value&&i(e.value,t,"Expression")};const U="$",v={createIdentifier(e){return{type:"Identifier",name:e}},createLiteral(e){return{type:"Literal",value:e}},createMemberExpression(e,t,i=!1){return{type:"MemberExpression",object:e,property:t,computed:i}},createContextIdentifier(){return this.createIdentifier(U)},createContextVariableReference(e,t){const i=this.createContextIdentifier(),r=this.createIdentifier(e),s=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),s,!1)},createContextVariableAccess0(e,t){const i=this.createContextVariableReference(e,t);return this.createGetCall(i,0)},createArrayAccess(e,t){const i=typeof t=="number"?this.createLiteral(t):t;return this.createMemberExpression(e,i,!0)},createCallExpression(e,t){return{type:"CallExpression",callee:e,arguments:t}},createAssignmentExpression(e,t,i="="){return{type:"AssignmentExpression",operator:i,left:e,right:t}},createExpressionStatement(e){return{type:"ExpressionStatement",expression:e}},createInitCall(e,t,i){const r=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("init"),!1),s=[e,t];return i&&s.push(i),this.createCallExpression(r,s)},createInitVarCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("initVar"),!1),r=[e,t];return this.createCallExpression(i,r)},createGetCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("get"),!1),r=typeof t=="number"?this.createLiteral(t):t;return this.createCallExpression(i,[e,r])},createSetCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("set"),!1);return this.createCallExpression(i,[e,t])},createMathEqCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("math"),!1),r=this.createMemberExpression(i,this.createIdentifier("__eq"),!1);return this.createCallExpression(r,[e,t])},createWrapperFunction(e){return{type:"FunctionDeclaration",id:null,params:[this.createIdentifier("context")],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:e}]}}},createVariableDeclaration(e,t){return{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:this.createIdentifier(e),init:t}]}},createAwaitExpression(e){return{type:"AwaitExpression",argument:e}}},et=["ta","math","request","array","input"],gs=["hline"],xs=["request.security","request.security_lower_tf"],Gi=["open","high","low","close","volume","hl2","hlc3","ohlc4","openTime","closeTime"],Yi=[...et,"plotchar","plot","hline","indicator","strategy","library","alertcondition","fixnan","na","color","nz","str","box","line","label","table","map","matrix","log","map","bool","timeframe","syminfo","barstate","bar_index","last_bar_index","last_bar_time","order","currency","display","dayofweek"],ys=["na","nz","plot","plotchar","color","hline"];function ws(e){let t=null,i=U;if(e.type==="Program"&&e.body.length>0){const p=e.body[0];if(p.type==="ExpressionStatement"&&(p.expression.type==="ArrowFunctionExpression"||p.expression.type==="FunctionExpression")){const x=p.expression;x.body.type==="BlockStatement"&&(t=x.body.body,x.params.length>0&&x.params[0].type==="Identifier"&&(i=x.params[0].name))}}if(!t)return;const r=new Set,s=new Set,n=p=>{p.type==="Identifier"?r.add(p.name):p.type==="ObjectPattern"?p.properties.forEach(x=>n(x.value)):p.type==="ArrayPattern"&&p.elements.forEach(x=>{x&&n(x)})};z(e,{},{VariableDeclarator(p,x,y){n(p.id),p.init&&y(p.init,x)},FunctionDeclaration(p,x,y){n(p.id),y(p.body,x)},Identifier(p,x,y){s.add(p.name)},MemberExpression(p,x,y){y(p.object,x),p.computed&&y(p.property,x)},Property(p,x,y){p.computed&&y(p.key,x),y(p.value,x)}}),t.forEach(p=>{p.type==="VariableDeclaration"?p.declarations.forEach(x=>n(x.id)):p.type==="FunctionDeclaration"&&n(p.id)});const a=Gi,o=Yi,h=a.filter(p=>!r.has(p)),u=o.filter(p=>!r.has(p)),l=h.filter(p=>s.has(p)),f=u.filter(p=>s.has(p)),g=[];l.length>0&&g.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:l.map(p=>({type:"Property",key:{type:"Identifier",name:p},value:{type:"Identifier",name:p},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"data"},computed:!1}}]}),f.length>0&&g.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:f.map(p=>({type:"Property",key:{type:"Identifier",name:p},value:{type:"Identifier",name:p},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"pine"},computed:!1}}]}),g.length>0&&t.unshift(...g)}function bs(e){let t=null,i=U;if(e.type==="Program"&&e.body.length>0){const o=e.body[0];if(o.type==="ExpressionStatement"&&(o.expression.type==="ArrowFunctionExpression"||o.expression.type==="FunctionExpression")){const h=o.expression;h.body.type==="BlockStatement"&&(t=h.body.body,h.params.length>0&&h.params[0].type==="Identifier"&&(i=h.params[0].name))}}if(!t)return;const r=new Set(Gi),s=new Set(Yi),n=new Set(ys),a=new Map;t.forEach(o=>{o.type==="VariableDeclaration"&&o.declarations.forEach(h=>{if(h.init&&h.init.type==="MemberExpression"&&h.init.object.type==="Identifier"&&h.init.object.name===i&&h.init.property.type==="Identifier"){const u=h.init.property.name;let l=null;if(u==="data"?l=r:u==="pine"?l=s:u==="core"&&(l=n),l&&h.id.type==="ObjectPattern")h.id.properties.forEach(f=>{if(f.type==="Property"&&f.key.type==="Identifier"&&f.value.type==="Identifier"){const g=f.key.name,p=f.value.name;l.has(g)&&g!==p&&(a.set(p,g),f.value.name=g,f.shorthand=!0)}});else if(h.id.type==="Identifier"&&et.includes(u)){const f=u,g=h.id.name;f!==g&&(a.set(g,f),h.id.name=f)}}})}),a.size>0&&z(e,{},{Identifier(o){a.has(o.name)&&(o.name=a.get(o.name))},MemberExpression(o,h,u){u(o.object,h),o.computed&&u(o.property,h)},Property(o,h,u){o.computed&&u(o.key,h),u(o.value,h)}})}function vs(e){try{const t=Fi(e,{ecmaVersion:"latest",sourceType:"module"});if(t.type==="Program"&&t.body.length===1){const i=t.body[0];if(i.type==="ExpressionStatement"){const r=i.expression;if(r.type==="ArrowFunctionExpression"||r.type==="FunctionExpression")return{isWrapped:!0,isAsync:r.async||!1,functionNode:r}}if(i.type==="FunctionDeclaration")return{isWrapped:!0,isAsync:i.async||!1,functionNode:i}}return{isWrapped:!1,isAsync:!1}}catch{return{isWrapped:!1,isAsync:!1}}}function _s(e){return e.async=!0,Hi(e)}function Ss(e){e=e.trim();const{isWrapped:t,isAsync:i,functionNode:r}=vs(e);return t&&r?i?e:_s(r):`async (context) => {
31
+ `?(o=0,h++):o++;this.column=o,this.line=h;return}}const{length:r}=t,{lineEnd:s}=this;r>0&&(this.lineEndSize>0&&(s.length===1?t[r-1]===s:t.endsWith(s))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}}function Gi(e,t){const i=new cs(t);return i.generator[e.type](e,i),i.output}var ls=Object.defineProperty,ps=(e,t,i)=>t in e?ls(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,G=(e,t,i)=>ps(e,typeof t!="symbol"?t+"":t,i);const fs=new Set(["Infinity","NaN","undefined","null","true","false"]),ms=new Set(["Math","Array","Object","String","Number","Boolean","Date","RegExp","Error","JSON","Promise","Set","Map","WeakSet","WeakMap","Symbol","BigInt","Proxy","Reflect","console","isNaN","isFinite","parseInt","parseFloat","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent"]);class ds{constructor(){G(this,"scopes",[]),G(this,"scopeTypes",[]),G(this,"scopeCounts",new Map),G(this,"contextBoundVars",new Set),G(this,"arrayPatternElements",new Set),G(this,"rootParams",new Set),G(this,"localSeriesVars",new Set),G(this,"varKinds",new Map),G(this,"loopVars",new Set),G(this,"loopVarNames",new Map),G(this,"paramIdCounter",0),G(this,"cacheIdCounter",0),G(this,"tempVarCounter",0),G(this,"taCallIdCounter",0),G(this,"hoistingStack",[]),G(this,"suppressHoisting",!1),this.pushScope("glb")}get nextParamIdArg(){return{type:"Identifier",name:`'p${this.paramIdCounter++}'`}}get nextCacheIdArg(){return{type:"Identifier",name:`'cache_${this.cacheIdCounter++}'`}}getNextTACallId(){return{type:"Literal",value:`_ta${this.taCallIdCounter++}`}}pushScope(t){this.scopes.push(new Map),this.scopeTypes.push(t),this.scopeCounts.set(t,(this.scopeCounts.get(t)||0)+1)}popScope(){this.scopes.pop(),this.scopeTypes.pop()}getCurrentScopeType(){return this.scopeTypes[this.scopeTypes.length-1]}getCurrentScopeCount(){return this.scopeCounts.get(this.getCurrentScopeType())||1}addLocalSeriesVar(t){this.localSeriesVars.add(t)}isLocalSeriesVar(t){return this.localSeriesVars.has(t)}addContextBoundVar(t,i=!1){this.contextBoundVars.add(t),i&&this.rootParams.add(t)}removeContextBoundVar(t){this.contextBoundVars.has(t)&&(this.contextBoundVars.delete(t),this.rootParams.has(t)&&this.rootParams.delete(t))}addArrayPatternElement(t){this.arrayPatternElements.add(t)}isContextBound(t){return fs.has(t)||ms.has(t)?!1:this.contextBoundVars.has(t)}isArrayPatternElement(t){return this.arrayPatternElements.has(t)}isRootParam(t){return this.rootParams.has(t)}addLoopVariable(t,i){this.loopVars.add(t),this.loopVarNames.set(t,i)}getLoopVariableName(t){return this.loopVarNames.get(t)}isLoopVariable(t){return this.loopVars.has(t)}addVariable(t,i){if(this.isContextBound(t))return t;const r=this.scopes[this.scopes.length-1],s=this.scopeTypes[this.scopeTypes.length-1],n=this.scopeCounts.get(s)||1,a=`${s}${n}_${t}`;return r.set(t,a),this.varKinds.set(a,i),a}getVariable(t){if(this.loopVars.has(t)){const i=this.loopVarNames.get(t);if(i)return[i,"let"]}if(this.isContextBound(t))return[t,"let"];for(let i=this.scopes.length-1;i>=0;i--){const r=this.scopes[i];if(r.has(t)){const s=r.get(t),n=this.varKinds.get(s)||"let";return[s,n]}}return[t,"let"]}generateTempVar(){return`temp_${++this.tempVarCounter}`}enterHoistingScope(){this.hoistingStack.push([])}exitHoistingScope(){return this.hoistingStack.pop()||[]}addHoistedStatement(t){this.hoistingStack.length>0&&!this.suppressHoisting&&this.hoistingStack[this.hoistingStack.length-1].push(t)}setSuppressHoisting(t){this.suppressHoisting=t}shouldSuppressHoisting(){return this.suppressHoisting}generateParamId(){return`p${this.paramIdCounter++}`}}function Bt(e,t,i,r,s){i||(i=b),function n(a,o,h){var u=h||a.type;i[u](a,o,n),t[u]&&t[u](a,o)}(e,r,s)}function z(e,t,i,r,s){var n=i?gs(i,r||void 0):r;(function a(o,h,u){n[u||o.type](o,h,a)})(e,t,s)}function gs(e,t){var i=Object.create(t||b);for(var r in e)i[r]=e[r];return i}function Ft(e,t,i){i(e,t)}function Re(e,t,i){}var b={};b.Program=b.BlockStatement=b.StaticBlock=function(e,t,i){for(var r=0,s=e.body;r<s.length;r+=1){var n=s[r];i(n,t,"Statement")}},b.Statement=Ft,b.EmptyStatement=Re,b.ExpressionStatement=b.ParenthesizedExpression=b.ChainExpression=function(e,t,i){return i(e.expression,t,"Expression")},b.IfStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Statement"),e.alternate&&i(e.alternate,t,"Statement")},b.LabeledStatement=function(e,t,i){return i(e.body,t,"Statement")},b.BreakStatement=b.ContinueStatement=Re,b.WithStatement=function(e,t,i){i(e.object,t,"Expression"),i(e.body,t,"Statement")},b.SwitchStatement=function(e,t,i){i(e.discriminant,t,"Expression");for(var r=0,s=e.cases;r<s.length;r+=1){var n=s[r];i(n,t)}},b.SwitchCase=function(e,t,i){e.test&&i(e.test,t,"Expression");for(var r=0,s=e.consequent;r<s.length;r+=1){var n=s[r];i(n,t,"Statement")}},b.ReturnStatement=b.YieldExpression=b.AwaitExpression=function(e,t,i){e.argument&&i(e.argument,t,"Expression")},b.ThrowStatement=b.SpreadElement=function(e,t,i){return i(e.argument,t,"Expression")},b.TryStatement=function(e,t,i){i(e.block,t,"Statement"),e.handler&&i(e.handler,t),e.finalizer&&i(e.finalizer,t,"Statement")},b.CatchClause=function(e,t,i){e.param&&i(e.param,t,"Pattern"),i(e.body,t,"Statement")},b.WhileStatement=b.DoWhileStatement=function(e,t,i){i(e.test,t,"Expression"),i(e.body,t,"Statement")},b.ForStatement=function(e,t,i){e.init&&i(e.init,t,"ForInit"),e.test&&i(e.test,t,"Expression"),e.update&&i(e.update,t,"Expression"),i(e.body,t,"Statement")},b.ForInStatement=b.ForOfStatement=function(e,t,i){i(e.left,t,"ForInit"),i(e.right,t,"Expression"),i(e.body,t,"Statement")},b.ForInit=function(e,t,i){e.type==="VariableDeclaration"?i(e,t):i(e,t,"Expression")},b.DebuggerStatement=Re,b.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")},b.VariableDeclaration=function(e,t,i){for(var r=0,s=e.declarations;r<s.length;r+=1){var n=s[r];i(n,t)}},b.VariableDeclarator=function(e,t,i){i(e.id,t,"Pattern"),e.init&&i(e.init,t,"Expression")},b.Function=function(e,t,i){e.id&&i(e.id,t,"Pattern");for(var r=0,s=e.params;r<s.length;r+=1){var n=s[r];i(n,t,"Pattern")}i(e.body,t,e.expression?"Expression":"Statement")},b.Pattern=function(e,t,i){e.type==="Identifier"?i(e,t,"VariablePattern"):e.type==="MemberExpression"?i(e,t,"MemberPattern"):i(e,t)},b.VariablePattern=Re,b.MemberPattern=Ft,b.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")},b.ArrayPattern=function(e,t,i){for(var r=0,s=e.elements;r<s.length;r+=1){var n=s[r];n&&i(n,t,"Pattern")}},b.ObjectPattern=function(e,t,i){for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];n.type==="Property"?(n.computed&&i(n.key,t,"Expression"),i(n.value,t,"Pattern")):n.type==="RestElement"&&i(n.argument,t,"Pattern")}},b.Expression=Ft,b.ThisExpression=b.Super=b.MetaProperty=Re,b.ArrayExpression=function(e,t,i){for(var r=0,s=e.elements;r<s.length;r+=1){var n=s[r];n&&i(n,t,"Expression")}},b.ObjectExpression=function(e,t,i){for(var r=0,s=e.properties;r<s.length;r+=1){var n=s[r];i(n,t)}},b.FunctionExpression=b.ArrowFunctionExpression=b.FunctionDeclaration,b.SequenceExpression=function(e,t,i){for(var r=0,s=e.expressions;r<s.length;r+=1){var n=s[r];i(n,t,"Expression")}},b.TemplateLiteral=function(e,t,i){for(var r=0,s=e.quasis;r<s.length;r+=1){var n=s[r];i(n,t)}for(var a=0,o=e.expressions;a<o.length;a+=1){var h=o[a];i(h,t,"Expression")}},b.TemplateElement=Re,b.UnaryExpression=b.UpdateExpression=function(e,t,i){i(e.argument,t,"Expression")},b.BinaryExpression=b.LogicalExpression=function(e,t,i){i(e.left,t,"Expression"),i(e.right,t,"Expression")},b.AssignmentExpression=b.AssignmentPattern=function(e,t,i){i(e.left,t,"Pattern"),i(e.right,t,"Expression")},b.ConditionalExpression=function(e,t,i){i(e.test,t,"Expression"),i(e.consequent,t,"Expression"),i(e.alternate,t,"Expression")},b.NewExpression=b.CallExpression=function(e,t,i){if(i(e.callee,t,"Expression"),e.arguments)for(var r=0,s=e.arguments;r<s.length;r+=1){var n=s[r];i(n,t,"Expression")}},b.MemberExpression=function(e,t,i){i(e.object,t,"Expression"),e.computed&&i(e.property,t,"Expression")},b.ExportNamedDeclaration=b.ExportDefaultDeclaration=function(e,t,i){e.declaration&&i(e.declaration,t,e.type==="ExportNamedDeclaration"||e.declaration.id?"Statement":"Expression"),e.source&&i(e.source,t,"Expression")},b.ExportAllDeclaration=function(e,t,i){e.exported&&i(e.exported,t),i(e.source,t,"Expression")},b.ImportDeclaration=function(e,t,i){for(var r=0,s=e.specifiers;r<s.length;r+=1){var n=s[r];i(n,t)}i(e.source,t,"Expression")},b.ImportExpression=function(e,t,i){i(e.source,t,"Expression")},b.ImportSpecifier=b.ImportDefaultSpecifier=b.ImportNamespaceSpecifier=b.Identifier=b.PrivateIdentifier=b.Literal=Re,b.TaggedTemplateExpression=function(e,t,i){i(e.tag,t,"Expression"),i(e.quasi,t,"Expression")},b.ClassDeclaration=b.ClassExpression=function(e,t,i){return i(e,t,"Class")},b.Class=function(e,t,i){e.id&&i(e.id,t,"Pattern"),e.superClass&&i(e.superClass,t,"Expression"),i(e.body,t)},b.ClassBody=function(e,t,i){for(var r=0,s=e.body;r<s.length;r+=1){var n=s[r];i(n,t)}},b.MethodDefinition=b.PropertyDefinition=b.Property=function(e,t,i){e.computed&&i(e.key,t,"Expression"),e.value&&i(e.value,t,"Expression")};const U="$",v={createIdentifier(e){return{type:"Identifier",name:e}},createLiteral(e){return{type:"Literal",value:e}},createMemberExpression(e,t,i=!1){return{type:"MemberExpression",object:e,property:t,computed:i}},createContextIdentifier(){return this.createIdentifier(U)},createContextVariableReference(e,t){const i=this.createContextIdentifier(),r=this.createIdentifier(e),s=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),s,!1)},createContextVariableAccess0(e,t){const i=this.createContextVariableReference(e,t);return this.createGetCall(i,0)},createArrayAccess(e,t){const i=typeof t=="number"?this.createLiteral(t):t;return this.createMemberExpression(e,i,!0)},createCallExpression(e,t){return{type:"CallExpression",callee:e,arguments:t}},createAssignmentExpression(e,t,i="="){return{type:"AssignmentExpression",operator:i,left:e,right:t}},createExpressionStatement(e){return{type:"ExpressionStatement",expression:e}},createInitCall(e,t,i){const r=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("init"),!1),s=[e,t];return i&&s.push(i),this.createCallExpression(r,s)},createInitVarCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("initVar"),!1),r=[e,t];return this.createCallExpression(i,r)},createGetCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("get"),!1),r=typeof t=="number"?this.createLiteral(t):t;return this.createCallExpression(i,[e,r])},createSetCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("set"),!1);return this.createCallExpression(i,[e,t])},createMathEqCall(e,t){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("math"),!1),r=this.createMemberExpression(i,this.createIdentifier("__eq"),!1);return this.createCallExpression(r,[e,t])},createWrapperFunction(e){return{type:"FunctionDeclaration",id:null,params:[this.createIdentifier("context")],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:e}]}}},createVariableDeclaration(e,t){return{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:this.createIdentifier(e),init:t}]}},createAwaitExpression(e){return{type:"AwaitExpression",argument:e}}},et=["ta","math","request","array","input"],xs=["hline"],ys=["request.security","request.security_lower_tf"],Yi=["open","high","low","close","volume","hl2","hlc3","ohlc4","openTime","closeTime"],Qi=[...et,"plotchar","plot","hline","indicator","strategy","library","alertcondition","fixnan","na","color","nz","str","box","line","label","table","map","matrix","log","map","bool","timeframe","syminfo","barstate","bar_index","last_bar_index","last_bar_time","order","currency","display","dayofweek"],ws=["na","nz","plot","plotchar","color","hline"];function bs(e){let t=null,i=U;if(e.type==="Program"&&e.body.length>0){const p=e.body[0];if(p.type==="ExpressionStatement"&&(p.expression.type==="ArrowFunctionExpression"||p.expression.type==="FunctionExpression")){const x=p.expression;x.body.type==="BlockStatement"&&(t=x.body.body,x.params.length>0&&x.params[0].type==="Identifier"&&(i=x.params[0].name))}}if(!t)return;const r=new Set,s=new Set,n=p=>{p.type==="Identifier"?r.add(p.name):p.type==="ObjectPattern"?p.properties.forEach(x=>n(x.value)):p.type==="ArrayPattern"&&p.elements.forEach(x=>{x&&n(x)})};z(e,{},{VariableDeclarator(p,x,y){n(p.id),p.init&&y(p.init,x)},FunctionDeclaration(p,x,y){n(p.id),y(p.body,x)},Identifier(p,x,y){s.add(p.name)},MemberExpression(p,x,y){y(p.object,x),p.computed&&y(p.property,x)},Property(p,x,y){p.computed&&y(p.key,x),y(p.value,x)}}),t.forEach(p=>{p.type==="VariableDeclaration"?p.declarations.forEach(x=>n(x.id)):p.type==="FunctionDeclaration"&&n(p.id)});const a=Yi,o=Qi,h=a.filter(p=>!r.has(p)),u=o.filter(p=>!r.has(p)),l=h.filter(p=>s.has(p)),f=u.filter(p=>s.has(p)),g=[];l.length>0&&g.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:l.map(p=>({type:"Property",key:{type:"Identifier",name:p},value:{type:"Identifier",name:p},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"data"},computed:!1}}]}),f.length>0&&g.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:f.map(p=>({type:"Property",key:{type:"Identifier",name:p},value:{type:"Identifier",name:p},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"pine"},computed:!1}}]}),g.length>0&&t.unshift(...g)}function vs(e){let t=null,i=U;if(e.type==="Program"&&e.body.length>0){const o=e.body[0];if(o.type==="ExpressionStatement"&&(o.expression.type==="ArrowFunctionExpression"||o.expression.type==="FunctionExpression")){const h=o.expression;h.body.type==="BlockStatement"&&(t=h.body.body,h.params.length>0&&h.params[0].type==="Identifier"&&(i=h.params[0].name))}}if(!t)return;const r=new Set(Yi),s=new Set(Qi),n=new Set(ws),a=new Map;t.forEach(o=>{o.type==="VariableDeclaration"&&o.declarations.forEach(h=>{if(h.init&&h.init.type==="MemberExpression"&&h.init.object.type==="Identifier"&&h.init.object.name===i&&h.init.property.type==="Identifier"){const u=h.init.property.name;let l=null;if(u==="data"?l=r:u==="pine"?l=s:u==="core"&&(l=n),l&&h.id.type==="ObjectPattern")h.id.properties.forEach(f=>{if(f.type==="Property"&&f.key.type==="Identifier"&&f.value.type==="Identifier"){const g=f.key.name,p=f.value.name;l.has(g)&&g!==p&&(a.set(p,g),f.value.name=g,f.shorthand=!0)}});else if(h.id.type==="Identifier"&&et.includes(u)){const f=u,g=h.id.name;f!==g&&(a.set(g,f),h.id.name=f)}}})}),a.size>0&&z(e,{},{Identifier(o){a.has(o.name)&&(o.name=a.get(o.name))},MemberExpression(o,h,u){u(o.object,h),o.computed&&u(o.property,h)},Property(o,h,u){o.computed&&u(o.key,h),u(o.value,h)}})}function _s(e){try{const t=ji(e,{ecmaVersion:"latest",sourceType:"module"});if(t.type==="Program"&&t.body.length===1){const i=t.body[0];if(i.type==="ExpressionStatement"){const r=i.expression;if(r.type==="ArrowFunctionExpression"||r.type==="FunctionExpression")return{isWrapped:!0,isAsync:r.async||!1,functionNode:r}}if(i.type==="FunctionDeclaration")return{isWrapped:!0,isAsync:i.async||!1,functionNode:i}}return{isWrapped:!1,isAsync:!1}}catch{return{isWrapped:!1,isAsync:!1}}}function Ss(e){return e.async=!0,Gi(e)}function Es(e){e=e.trim();const{isWrapped:t,isAsync:i,functionNode:r}=_s(e);return t&&r?i?e:Ss(r):`async (context) => {
32
32
  ${e}
33
- }`}function Es(e){z(e,null,{VariableDeclaration(t,i,r){t.declarations&&t.declarations.length>0&&t.declarations.forEach(s=>{if(s.init&&s.init.type==="ArrowFunctionExpression"&&s.init.start!==0){const n={type:"FunctionDeclaration",id:s.id,params:s.init.params,body:s.init.body.type==="BlockStatement"?s.init.body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:s.init.body}]},async:s.init.async,generator:!1};Object.assign(t,n)}}),t.body&&t.body.body&&t.body.body.forEach(s=>r(s,i))}})}function Ns(e,t){Lt(e,{VariableDeclaration(i){i.declarations.forEach(r=>{const s=r.init&&r.init.type==="MemberExpression"&&r.init.object&&(r.init.object.name==="context"||r.init.object.name===U||r.init.object.name==="context2"),n=r.init&&r.init.type==="MemberExpression"&&r.init.object?.object&&(r.init.object.object.name==="context"||r.init.object.object.name===U||r.init.object.object.name==="context2");(s||n)&&(r.id.name&&t.addContextBoundVar(r.id.name),r.id.properties&&r.id.properties.forEach(a=>{a.key.name&&t.addContextBoundVar(a.key.name)}))})}})}function Cs(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&t.addContextBoundVar(r.name,i)})}function ks(e,t){e.params.forEach(i=>{i.type==="Identifier"&&t.addContextBoundVar(i.name,!1)})}function Is(e,t){let i;return Lt(e,{FunctionDeclaration(r){ks(r,t)},ArrowFunctionExpression(r){const s=r.start===0;s&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=U),Cs(r,t,s)},VariableDeclaration(r){r.declarations.forEach(s=>{if(s.id.type==="ArrayPattern"){const n=t.generateTempVar(),a={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:n},init:s.init}]};s.id.elements?.forEach(h=>{h.type==="Identifier"&&t.addArrayPatternElement(h.name)});const o=s.id.elements.map((h,u)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:h,init:{type:"MemberExpression",object:{type:"Identifier",name:n},property:{type:"Literal",value:u},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[a,...o]})}})},ForStatement(r){}}),i}const Ft={type:"Identifier",name:"undefined"};function Ae(e,t){if(e.computed&&e.property.type==="Identifier"){if(t.isLoopVariable(e.property.name)){if(e.object.type==="Identifier"&&!t.isLoopVariable(e.object.name)&&!t.isContextBound(e.object.name)){const[i,r]=t.getVariable(e.object.name),s=v.createContextVariableReference(r,i),n=v.createGetCall(s,e.property);Object.assign(e,n),e._indexTransformed=!0}return}if(!t.isContextBound(e.property.name)){const[i,r]=t.getVariable(e.property.name);e.property=v.createContextVariableReference(r,i),e.property=v.createGetCall(e.property,0)}}if(e.computed&&e.object.type==="Identifier"){if(t.isLoopVariable(e.object.name))return;if(!t.isContextBound(e.object.name)){const[i,r]=t.getVariable(e.object.name);e.object=v.createContextVariableReference(r,i)}if(e.property.type==="MemberExpression"){const i=e.property;i._indexTransformed||(Ae(i,t),i._indexTransformed=!0)}}}function Ne(e,t){const i=v.createGetCall(v.createIdentifier(e.name),0);e.start!==void 0&&(i.start=e.start),e.end!==void 0&&(i.end=e.end),i._indexTransformed=!0,Object.assign(e,i)}function te(e,t){if(e.name!==U){if(e.name==="na"&&!(e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e)){e.name="NaN";return}if(e.name==="Math"||e.name==="NaN"||e.name==="undefined"||e.name==="Infinity"||e.name==="null"||e.name.startsWith("'")&&e.name.endsWith("'")||e.name.startsWith('"')&&e.name.endsWith('"')||e.name.startsWith("`")&&e.name.endsWith("`")||t.isLoopVariable(e.name))return;let i=!1;if(e.parent&&e.parent.type==="CallExpression"&&e.parent.arguments.includes(e)){const g=e.parent.callee;if(g.type==="MemberExpression"&&g.object&&g.object.name===U&&["get","set","init","param"].includes(g.property.name))e.parent.arguments.indexOf(e)===0&&(i=!0);else{const p=g.type==="MemberExpression"&&g.object&&g.object.type==="Identifier"&&et.includes(g.object.name);g.type==="MemberExpression"&&!p?i=!1:i=!0}}const r=e.parent&&e.parent.type==="MemberExpression"&&e.parent.object===e&&t.isContextBound(e.name),s=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee&&e.parent.callee.type==="MemberExpression"&&e.parent.callee.property.name==="param";e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left;const n=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,a=e.parent&&e.parent.type==="MemberExpression"&&e.parent.computed&&e.parent.object===e,o=e.parent&&e.parent.type==="MemberExpression"&&e.parent.computed&&e.parent.property===e&&e.parent.parent&&e.parent.parent.type==="CallExpression"&&e.parent.parent.callee&&e.parent.parent.callee.type==="MemberExpression"&&t.isContextBound(e.parent.parent.callee.object.name);if(r||s||i||o||n){if(n||t.isLocalSeriesVar(e.name)||t.isContextBound(e.name)&&!t.isRootParam(e.name))return;const[g,p]=t.getVariable(e.name),x=v.createContextVariableReference(p,g);Object.assign(e,x);return}const h=t.isContextBound(e.name)&&!t.isRootParam(e.name);if(h&&!(e.parent&&e.parent.type==="CallExpression"&&e.parent.arguments.includes(e)))return;if(t.isLocalSeriesVar(e.name)){if(!a){const g=v.createIdentifier(e.name),p=v.createGetCall(g,0);Object.assign(e,p)}return}const[u,l]=t.getVariable(e.name);let f;if(h)f=v.createIdentifier(e.name);else{if(u===e.name&&!t.isContextBound(e.name))return;f=v.createContextVariableReference(l,u)}if(a)Object.assign(e,f);else{const g=v.createGetCall(f,0);Object.assign(e,g)}}}function le(e,t,i){if(e.object&&e.object.type==="Identifier"&&e.object.name==="Math")return;if(e.object&&e.object.type==="Identifier"&&et.includes(e.object.name)&&i.isContextBound(e.object.name)&&!e.computed){const h=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,u=e.parent&&(e.parent.type==="VariableDeclarator"||e.parent.type==="Property"||e.parent.type==="AssignmentExpression");if(!h&&!u){const l={type:"CallExpression",callee:{type:"MemberExpression",object:e.object,property:e.property,computed:!1},arguments:[],_transformed:!1};e.start!==void 0&&(l.start=e.start),e.end!==void 0&&(l.end=e.end),Object.assign(e,l);return}}const r=i.getCurrentScopeType()=="if",s=i.getCurrentScopeType()=="els",n=i.getCurrentScopeType()=="for";if(!r&&!s&&!n&&e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)&&!e.computed)return;e._indexTransformed||(Ae(e,i),e._indexTransformed=!0);const a=e.object&&e.object.type==="MemberExpression"&&e.object.object&&e.object.object.type==="MemberExpression"&&e.object.object.object&&e.object.object.object.name===U,o=e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name);if(e.computed&&(a||o)){if(e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e)return;const h=v.createGetCall(e.object,e.property);e.start&&(h.start=e.start),e.end&&(h.end=e.end),Object.assign(e,h),delete e.object,delete e.property,delete e.computed}}function tt(e,t){if(e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(t.isLoopVariable(e.name))return e;if(t.isRootParam(e.name)){const[s,n]=t.getVariable(e.name);return v.createContextVariableReference(n,s)}if(t.isContextBound(e.name)||t.isLocalSeriesVar(e.name))return e;const[i,r]=t.getVariable(e.name);return i===e.name&&!t.isContextBound(e.name)?e:v.createContextVariableReference(r,i)}return e}function Pe(e,t,i=""){switch(e.type){case"BinaryExpression":return jt(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?tt(e.object,t):e.object,property:e.property,computed:e.computed};case"Identifier":{if(t.isLoopVariable(e.name)||e.parent&&e.parent.type==="MemberExpression"&&e.parent.property===e)return e;const r=tt(e,t);return r.type==="Identifier"&&(r.name==="NaN"||r.name==="undefined"||r.name==="Infinity"||r.name==="null"||r.name==="Math")?r:v.createGetCall(r,0)}case"UnaryExpression":return $t(e,t,i);case"ConditionalExpression":{const r=Pe(e.test,t,i),s=Pe(e.consequent,t,i),n=Pe(e.alternate,t,i);return{type:"ConditionalExpression",test:r,consequent:s,alternate:n,start:e.start,end:e.end}}}return e}function jt(e,t,i){const r=Pe(e.left,t,i),s=Pe(e.right,t,i),n={type:"BinaryExpression",operator:e.operator,left:r,right:s,start:e.start,end:e.end};return z(n,t,{CallExpression(a,o){a._transformed||pe(a,o)},MemberExpression(a){le(a,"",t)}}),n}function Qi(e,t,i){const r=Pe(e.left,t,i),s=Pe(e.right,t,i),n={type:"LogicalExpression",operator:e.operator,left:r,right:s,start:e.start,end:e.end};return z(n,t,{CallExpression(a,o){a._transformed||pe(a,o)}}),n}function Xi(e,t,i){z(e,{parent:e,inNamespaceCall:!1},{Identifier(a,o,h){if(a.name=="NaN")return;if(a.name=="na"){a.name="NaN";return}a.parent=o.parent,te(a,t);const u=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||u)&&(a.type==="MemberExpression"?Ae(a,t):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===U&&a.parent.callee.property.name==="get"||Ne(a)))},MemberExpression(a,o,h){Ae(a,t),a.object&&h(a.object,{parent:a,inNamespaceCall:o.inNamespaceCall})},ConditionalExpression(a,o,h){const u={...o,parent:a};a.test&&h(a.test,u),a.consequent&&h(a.consequent,u),a.alternate&&h(a.alternate,u)},BinaryExpression(a,o,h){const u={...o,parent:a};h(a.left,u),h(a.right,u)},LogicalExpression(a,o,h){const u={...o,parent:a};h(a.left,u),h(a.right,u)},UnaryExpression(a,o,h){const u={...o,parent:a};h(a.argument,u)},CallExpression(a,o,h){const u=a.callee&&a.callee.type==="MemberExpression"&&a.callee.object&&a.callee.object.type==="Identifier"&&t.isContextBound(a.callee.object.name);pe(a,t),a.arguments.forEach(l=>h(l,{parent:a,inNamespaceCall:u||o.inNamespaceCall}))}});const r=v.createMemberExpression(v.createIdentifier(i),v.createIdentifier("param")),s=t.generateParamId(),n={type:"CallExpression",callee:r,arguments:[e,Ft,{type:"Identifier",name:`'${s}'`}],_transformed:!0,_isParamCall:!0};if(!t.shouldSuppressHoisting()){const a=s;t.addLocalSeriesVar(a);const o=v.createVariableDeclaration(a,n);return t.addHoistedStatement(o),v.createIdentifier(a)}return n}function $t(e,t,i){const r=Pe(e.argument,t,i);return{type:"UnaryExpression",operator:e.operator,prefix:e.prefix,argument:r,start:e.start,end:e.end}}function Wt(e,t,i){switch(e?.type){case"BinaryExpression":e=jt(e,i,t);break;case"LogicalExpression":e=Qi(e,i,t);break;case"ConditionalExpression":return Xi(e,i,t);case"UnaryExpression":e=$t(e,i,t);break;case"ArrayExpression":e.elements=e.elements.map(o=>{if(o.type==="Identifier"){if(i.isContextBound(o.name)&&!i.isRootParam(o.name))return o;const[h,u]=i.getVariable(o.name);return v.createContextVariableAccess0(u,h)}return o});break}if(e.type==="MemberExpression"&&e.computed&&e.property){e.object.type==="CallExpression"?pe(e.object,i):e.object.type==="MemberExpression"?le(e.object,"",i):e.object.type==="BinaryExpression"?e.object=jt(e.object,i,t):e.object.type==="LogicalExpression"?e.object=Qi(e.object,i,t):e.object.type==="ConditionalExpression"?e.object=Xi(e.object,i,t):e.object.type==="UnaryExpression"&&(e.object=$t(e.object,i,t));const o=e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)?e.object:tt(e.object,i),h=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?tt(e.property,i):e.property,u=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),l=i.generateParamId(),f={type:"CallExpression",callee:u,arguments:[o,h,{type:"Identifier",name:`'${l}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const g=l;i.addLocalSeriesVar(g);const p=v.createVariableDeclaration(g,f);return i.addHoistedStatement(p),v.createIdentifier(g)}return f}if(e.type==="ObjectExpression"&&(e.properties=e.properties.map(o=>{if(o.value.name){if(i.isContextBound(o.value.name)&&!i.isRootParam(o.value.name))return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createIdentifier(o.value.name),kind:"init",method:!1,shorthand:!1,computed:!1};const[h,u]=i.getVariable(o.value.name);return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createContextVariableReference(u,h),kind:"init",method:!1,shorthand:!1,computed:!1}}else o.value.type!=="Literal"&&(o.value=Wt(o.value,t,i));return o})),e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(i.isContextBound(e.name)&&!i.isRootParam(e.name)){const o=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),h=i.generateParamId(),u={type:"CallExpression",callee:o,arguments:[e,Ft,{type:"Identifier",name:`'${h}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const l=h;i.addLocalSeriesVar(l);const f=v.createVariableDeclaration(l,u);return i.addHoistedStatement(f),v.createIdentifier(l)}return u}}e?.type==="CallExpression"&&pe(e,i);const r=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),s=e.type==="Identifier"?tt(e,i):e,n=i.generateParamId(),a={type:"CallExpression",callee:r,arguments:[s,Ft,{type:"Identifier",name:`'${n}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const o=n;i.addLocalSeriesVar(o);const h=v.createVariableDeclaration(o,a);return i.addHoistedStatement(h),v.createIdentifier(o)}return a}function pe(e,t,i){if(e._transformed)return;e.callee&&e.callee.type==="Identifier"&&(et.includes(e.callee.name)||gs.includes(e.callee.name))&&t.isContextBound(e.callee.name)&&(e.callee=v.createMemberExpression(e.callee,v.createIdentifier("any")));const r=e.callee&&e.callee.type==="MemberExpression"&&e.callee.object&&e.callee.object.type==="Identifier"&&(t.isContextBound(e.callee.object.name)||e.callee.object.name==="math"||e.callee.object.name==="ta");if(r){if(e.callee.object.name===U&&["get","init","param"].includes(e.callee.property.name))return;const s=e.callee.object.name,n=[];e.arguments.forEach(l=>{if(l._isParamCall){n.push(l);return}n.push(Wt(l,s,t))}),e.arguments=n,s==="ta"&&e.arguments.push(t.getNextTACallId());const a=e.callee.property.name,o=`${s}.${a}`,h=xs.includes(o),u=e._insideAwait===!0;if(h&&!u){const l=Object.assign({},e),f=v.createAwaitExpression(l);Object.assign(e,f)}if(!t.shouldSuppressHoisting()){const l=t.generateTempVar();t.addLocalSeriesVar(l);const f=e._insideAwait===!0;let g=Object.assign({},e);f&&(g=v.createAwaitExpression(g));const p=v.createVariableDeclaration(l,g);t.addHoistedStatement(p);const x=v.createIdentifier(l);Object.assign(e,x),e._wasHoisted=!0,e._wasInsideAwait=f;return}e._transformed=!0}else e.callee&&e.callee.type==="Identifier"&&(e.arguments=e.arguments.map(s=>s._isParamCall?s:Wt(s,U,t)),e._transformed=!0);!r&&e.callee&&e.callee.type==="MemberExpression"&&e.callee.object.type==="Identifier"&&te(e.callee.object,t),e.arguments.forEach(s=>{z(s,{parent:e},{Identifier(n,a,o){n.parent=a.parent,te(n,t);const h=n.parent&&n.parent.type==="BinaryExpression";(n.parent&&n.parent.type==="ConditionalExpression"||h)&&(n.type==="MemberExpression"?Ae(n,t):n.type==="Identifier"&&(n.parent&&n.parent.type==="CallExpression"&&n.parent.callee&&n.parent.callee.object&&n.parent.callee.object.name===U&&n.parent.callee.property.name==="get"||Ne(n)))},BinaryExpression(n,a,o){const h={...a,parent:n};o(n.left,h),o(n.right,h)},LogicalExpression(n,a,o){const h={...a,parent:n};o(n.left,h),o(n.right,h)},UnaryExpression(n,a,o){const h={...a,parent:n};o(n.argument,h)},CallExpression(n,a,o){n._transformed||pe(n,t)},MemberExpression(n,a,o){le(n,"",t),n.object&&o(n.object,{parent:n})}})})}function Zi(e,t){let i=null;if(e.left.type==="Identifier"){const[r,s]=t.getVariable(e.left.name);i=v.createContextVariableReference(s,r)}else if(e.left.type==="MemberExpression"&&e.left.computed&&e.left.object.type==="Identifier"){const r=e.left.object.name,[s,n]=t.getVariable(r),a=s!==r,o=t.isContextBound(r);(a||o)&&!t.isLoopVariable(r)&&e.left.property.type==="Literal"&&e.left.property.value===0&&(i=v.createContextVariableReference(n,s))}if(z(e.right,{parent:e.right,inNamespaceCall:!1},{Identifier(r,s,n){r.name=="na"&&(r.name="NaN"),r.parent=s.parent,te(r,t);const a=r.parent&&r.parent.type==="BinaryExpression",o=r.parent&&r.parent.type==="ConditionalExpression",h=t.isContextBound(r.name)&&!t.isRootParam(r.name),u=r.parent&&r.parent.type==="MemberExpression"&&r.parent.computed&&r.parent.object===r,l=r.parent&&r.parent._isParamCall,f=r.parent&&r.parent.type==="MemberExpression",g=r.name==="NaN",p=r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===U&&r.parent.callee.property.name==="get";(h||o||a)&&(r.type==="MemberExpression"?Ae(r,t):r.type==="Identifier"&&!f&&!u&&!l&&!g&&!p&&Ne(r))},MemberExpression(r,s,n){le(r,"",t),r.type==="CallExpression"?r.arguments.forEach(a=>n(a,{parent:r,inNamespaceCall:s.inNamespaceCall})):r.object&&n(r.object,{parent:r,inNamespaceCall:s.inNamespaceCall})},CallExpression(r,s,n){const a=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&t.isContextBound(r.callee.object.name);pe(r,t),r.type==="CallExpression"&&r.arguments.forEach(o=>n(o,{parent:r,inNamespaceCall:a||s.inNamespaceCall}))}}),i){let r=e.right;if(e.operator!=="="){const n=e.operator.replace("=",""),a=v.createGetCall(i,0);r={type:"BinaryExpression",operator:n,left:a,right:e.right,start:e.start,end:e.end}}const s=v.createSetCall(i,r);e.start&&(s.start=e.start),e.end&&(s.end=e.end),Object.assign(e,s)}}function Ji(e,t){e.declarations.forEach(i=>{i.init.name=="na"&&(i.init.name="NaN");const r=i.init&&i.init.type==="MemberExpression"&&i.init.object&&(i.init.object.name==="context"||i.init.object.name===U||i.init.object.name==="context2"),s=i.init&&i.init.type==="MemberExpression"&&i.init.object?.object&&(i.init.object.object.name==="context"||i.init.object.object.name===U||i.init.object.object.name==="context2"),n=i.init&&i.init.type==="ArrowFunctionExpression";if(r){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(p=>{p.key.name&&t.addContextBoundVar(p.key.name)}),i.init.object.name=U;return}if(s){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(p=>{p.key.name&&t.addContextBoundVar(p.key.name)}),i.init.object.object.name=U;return}n&&i.init.params.forEach(p=>{p.type==="Identifier"&&t.addContextBoundVar(p.name)});const a=t.addVariable(i.id.name,e.kind),o=e.kind,h=t.isArrayPatternElement(i.id.name);i.init&&!n&&!h&&(i.init.type==="CallExpression"&&i.init.callee.type==="MemberExpression"&&i.init.callee.object&&i.init.callee.object.type==="Identifier"&&t.isContextBound(i.init.callee.object.name)?pe(i.init,t):z(i.init,{parent:i.init},{Identifier(p,x){p.parent=x.parent,te(p,t);const y=p.parent&&p.parent.type==="BinaryExpression",w=p.parent&&p.parent.type==="UnaryExpression",E=p.parent&&p.parent.type==="ConditionalExpression",A=p.parent&&p.parent.type==="CallExpression"&&p.parent.callee&&p.parent.callee.object&&p.parent.callee.object.name===U&&p.parent.callee.property.name==="get";p.type==="Identifier"&&(y||w||E)&&!A&&Ne(p)},CallExpression(p,x,y){p.callee.type==="Identifier"&&(p.callee.parent=p),p.arguments.forEach(w=>{w.type==="Identifier"&&(w.parent=p)}),pe(p,t),p.type==="CallExpression"&&p.arguments.forEach(w=>y(w,{parent:p}))},BinaryExpression(p,x,y){p.left.type==="Identifier"&&(p.left.parent=p),p.right.type==="Identifier"&&(p.right.parent=p),y(p.left,{parent:p}),y(p.right,{parent:p})},MemberExpression(p,x,y){p.object&&p.object.type==="Identifier"&&(p.object.parent=p),p.property&&p.property.type==="Identifier"&&(p.property.parent=p),le(p,"",t),p.type==="CallExpression"?p.arguments.forEach(w=>y(w,{parent:p})):p.object&&y(p.object,{parent:p})},AwaitExpression(p,x,y){p.argument&&(p.argument._insideAwait=!0,y(p.argument,{parent:p}),p.argument.type==="Identifier"&&p.argument._wasInsideAwait&&Object.assign(p,p.argument))}}));const u=v.createContextVariableReference(o,a),l=!h&&i.init&&i.init.type==="MemberExpression"&&i.init.computed&&i.init.property&&(i.init.property.type==="Literal"||i.init.property.type==="MemberExpression");i.init?.property?.type==="MemberExpression"&&(i.init.property._indexTransformed||(Ae(i.init.property,t),i.init.property._indexTransformed=!0));let f;i.init?n||h?f=i.init:o==="var"?f=v.createInitVarCall(u,i.init):f=v.createInitCall(u,l?i.init.object:i.init,l?i.init.property:void 0):f=v.createIdentifier("undefined");const g=v.createExpressionStatement(v.createAssignmentExpression(u,f));if(h){const p=i.init.object.name,[x,y]=t.getVariable(p),w=v.createContextVariableReference(y,x),E=i.init.property.value,A={type:"MemberExpression",object:v.createGetCall(w,0),property:{type:"Literal",value:E},computed:!0};g.expression.right=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("init")),[u,A])}n&&(t.pushScope("fn"),z(i.init.body,t,{BlockStatement(p,x,y){p.body.forEach(w=>y(w,x))},IfStatement(p,x,y){x.pushScope("if"),y(p.consequent,x),p.alternate&&(x.pushScope("els"),y(p.alternate,x),x.popScope()),x.popScope()},VariableDeclaration(p,x){Ji(p,x)},Identifier(p,x){te(p,x)},AssignmentExpression(p,x){Zi(p,x)}}),t.popScope()),Object.assign(e,g)})}function As(e,t,i){if(t.setSuppressHoisting(!0),e.init&&e.init.type==="VariableDeclaration"){const r=e.init.declarations[0],s=r.id.name;t.addLoopVariable(s,s),e.init={type:"VariableDeclaration",kind:e.init.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:s},init:r.init}]},r.init&&z(r.init,t,{Identifier(n,a){t.isLoopVariable(n.name)||(t.pushScope("for"),te(n,a),t.popScope())},MemberExpression(n){t.pushScope("for"),le(n,"",t),t.popScope()}})}e.test&&z(e.test,t,{Identifier(r,s){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),te(r,s),r.type==="Identifier"&&(r.computed=!0,Ne(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),le(r,"",t),t.popScope()}}),e.update&&z(e.update,t,{Identifier(r,s){t.isLoopVariable(r.name)||(t.pushScope("for"),te(r,s),t.popScope())}}),t.setSuppressHoisting(!1),t.pushScope("for"),i(e.body,t),t.popScope()}function Ps(e,t){z(e,t,{MemberExpression(i){le(i,"",t)},CallExpression(i,r){pe(i,r)},Identifier(i,r){te(i,r);const s=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&s&&Ne(i)}})}function Ts(e,t,i){e.test&&(t.pushScope("if"),Ps(e.test,t),t.popScope()),t.pushScope("if"),i(e.consequent,t),t.popScope(),e.alternate&&(t.pushScope("els"),i(e.alternate,t),t.popScope())}function Rs(e,t){const i=t.getCurrentScopeType();if(e.argument&&(e.argument.type==="ArrayExpression"?(e.argument.elements=e.argument.elements.map(r=>{if(r.type==="Identifier"){if(t.isContextBound(r.name)&&!t.isRootParam(r.name))return v.createGetCall(r,0);const[s,n]=t.getVariable(r.name);return v.createContextVariableAccess0(n,s)}else if(r.type==="MemberExpression")return r.object&&r.object.type==="MemberExpression"&&r.object.object&&r.object.object.type==="Identifier"&&r.object.object.name==="$"&&r.object.property&&["const","let","var","params"].includes(r.object.property.name)?v.createGetCall(r,0):(r.computed&&r.object.type==="Identifier"&&t.isContextBound(r.object.name)&&!t.isRootParam(r.object.name)||le(r,"",t),r);return r}),e.argument={type:"ArrayExpression",elements:[e.argument]}):e.argument.type==="BinaryExpression"?z(e.argument,t,{Identifier(r,s){te(r,s),r.type==="Identifier"&&Ne(r)},MemberExpression(r){le(r,"",t)}}):e.argument.type==="ObjectExpression"?e.argument.properties=e.argument.properties.map(r=>{if(r.shorthand){if(t.isContextBound(r.value.name))return r;const[s,n]=t.getVariable(r.value.name);return{type:"Property",key:v.createIdentifier(r.key.name),value:v.createContextVariableReference(n,s),kind:"init",method:!1,shorthand:!1,computed:!1}}if(r.value&&r.value.type==="Identifier"&&!(t.isContextBound(r.value.name)&&!t.isRootParam(r.value.name))&&!t.isContextBound(r.value.name)){const[s,n]=t.getVariable(r.value.name);r.value=v.createContextVariableReference(n,s)}return r}):e.argument.type==="Identifier"&&(te(e.argument,t),e.argument.type==="Identifier"&&Ne(e.argument)),i==="fn")){e.argument.type==="Identifier"&&t.isContextBound(e.argument.name)&&!t.isRootParam(e.argument.name)?e.argument=v.createArrayAccess(e.argument,0):e.argument.type==="MemberExpression"?e.argument.object.type==="Identifier"&&t.isContextBound(e.argument.object.name)&&!t.isRootParam(e.argument.object.name)&&(e.argument._indexTransformed||(Ae(e.argument,t),e.argument._indexTransformed=!0)):(e.argument.type==="BinaryExpression"||e.argument.type==="LogicalExpression"||e.argument.type==="ConditionalExpression"||e.argument.type==="CallExpression")&&z(e.argument,t,{Identifier(s,n){te(s,n),s.type==="Identifier"&&!s._arrayAccessed&&(Ne(s),s._arrayAccessed=!0)},MemberExpression(s){le(s,"",t)},CallExpression(s,n){pe(s,n)}});const r=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("precision")),[e.argument]);e.argument=r}}function Ds(e,t,i){e.body&&e.body.type==="BlockStatement"&&(t.pushScope("fn"),i(e.body,t),t.popScope())}function Vs(e){const t={...b,LineComment:()=>{}};Lt(e,{BinaryExpression(i){if(i.operator==="=="||i.operator==="==="){const r=i.left,s=i.right,n=v.createMathEqCall(r,s);n._transformed=!0,Object.assign(i,n)}}},t)}function Os(e,t,i,r={debug:!1,ln:!1},s=[]){const n=a=>{if(!r.debug||!a.loc||!s.length)return null;const o=a.loc.start.line-1;if(o>=0&&o<s.length){const h=s[o].trim();if(h)return{type:"LineComment",value:`${r.ln?` [Line ${a.loc.start.line}]`:""} ${h}`}}return null};z(e,t,{Program(a,o,h){const u=[];a.body.forEach(l=>{o.enterHoistingScope(),h(l,o);const f=o.exitHoistingScope(),g=n(l);g&&u.push(g),u.push(...f),u.push(l)}),a.body=u},BlockStatement(a,o,h){const u=[];a.body.forEach(l=>{o.enterHoistingScope(),h(l,o);const f=o.exitHoistingScope(),g=n(l);g&&u.push(g),u.push(...f),u.push(l)}),a.body=u},ReturnStatement(a,o){Rs(a,o)},VariableDeclaration(a,o){Ji(a,o)},Identifier(a,o){te(a,o)},CallExpression(a,o){pe(a,o)},MemberExpression(a,o){le(a,i,o)},AssignmentExpression(a,o){Zi(a,o)},FunctionDeclaration(a,o,h){Ds(a,o,h)},ForStatement(a,o,h){As(a,o,h)},IfStatement(a,o,h){Ts(a,o,h)},AwaitExpression(a,o,h){a.argument&&(a.argument._insideAwait=!0,h(a.argument,o),a.argument.type==="Identifier"&&a.argument._wasInsideAwait===!0&&(a.type="Identifier",a.name=a.argument.name,a.argument._wasHoisted&&(a._wasHoisted=a.argument._wasHoisted),delete a.argument))}})}const m={NUMBER:"NUMBER",STRING:"STRING",BOOLEAN:"BOOLEAN",IDENTIFIER:"IDENTIFIER",KEYWORD:"KEYWORD",OPERATOR:"OPERATOR",LPAREN:"LPAREN",RPAREN:"RPAREN",LBRACKET:"LBRACKET",RBRACKET:"RBRACKET",LBRACE:"LBRACE",RBRACE:"RBRACE",COMMA:"COMMA",DOT:"DOT",COLON:"COLON",SEMICOLON:"SEMICOLON",INDENT:"INDENT",DEDENT:"DEDENT",NEWLINE:"NEWLINE",COMMENT:"COMMENT",EOF:"EOF"},Ms=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends"]),Ls=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class Bs{constructor(t,i,r,s,n=0){this.type=t,this.value=i,this.line=r,this.column=s,this.indent=n}toString(){return`Token(${this.type}, ${JSON.stringify(this.value)}, ${this.line}:${this.column}, indent=${this.indent})`}}var Fs=Object.defineProperty,js=(e,t,i)=>t in e?Fs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,be=(e,t,i)=>js(e,typeof t!="symbol"?t+"":t,i);class $s{constructor(t){be(this,"source"),be(this,"pos"),be(this,"line"),be(this,"column"),be(this,"tokens"),be(this,"indentStack"),be(this,"atLineStart"),be(this,"parenDepth"),be(this,"bracketDepth"),be(this,"braceDepth"),this.source=t,this.pos=0,this.line=1,this.column=1,this.tokens=[],this.indentStack=[0],this.atLineStart=!0,this.parenDepth=0,this.bracketDepth=0,this.braceDepth=0}tokenize(){for(;this.pos<this.source.length;){const t=this.peek();if(t==="\r"){this.advance();continue}if(t===`
33
+ }`}function Ns(e){z(e,null,{VariableDeclaration(t,i,r){t.declarations&&t.declarations.length>0&&t.declarations.forEach(s=>{if(s.init&&s.init.type==="ArrowFunctionExpression"&&s.init.start!==0){const n={type:"FunctionDeclaration",id:s.id,params:s.init.params,body:s.init.body.type==="BlockStatement"?s.init.body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:s.init.body}]},async:s.init.async,generator:!1};Object.assign(t,n)}}),t.body&&t.body.body&&t.body.body.forEach(s=>r(s,i))}})}function Cs(e,t){Bt(e,{VariableDeclaration(i){i.declarations.forEach(r=>{const s=r.init&&r.init.type==="MemberExpression"&&r.init.object&&(r.init.object.name==="context"||r.init.object.name===U||r.init.object.name==="context2"),n=r.init&&r.init.type==="MemberExpression"&&r.init.object?.object&&(r.init.object.object.name==="context"||r.init.object.object.name===U||r.init.object.object.name==="context2");(s||n)&&(r.id.name&&t.addContextBoundVar(r.id.name),r.id.properties&&r.id.properties.forEach(a=>{a.key.name&&t.addContextBoundVar(a.key.name)}))})}})}function ks(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&t.addContextBoundVar(r.name,i)})}function Is(e,t){e.params.forEach(i=>{i.type==="Identifier"&&t.addContextBoundVar(i.name,!1)})}function As(e,t){let i;return Bt(e,{FunctionDeclaration(r){Is(r,t)},ArrowFunctionExpression(r){const s=r.start===0;s&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=U),ks(r,t,s)},VariableDeclaration(r){r.declarations.forEach(s=>{if(s.id.type==="ArrayPattern"){const n=t.generateTempVar(),a={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:n},init:s.init}]};s.id.elements?.forEach(h=>{h.type==="Identifier"&&t.addArrayPatternElement(h.name)});const o=s.id.elements.map((h,u)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:h,init:{type:"MemberExpression",object:{type:"Identifier",name:n},property:{type:"Literal",value:u},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[a,...o]})}})},ForStatement(r){}}),i}const jt={type:"Identifier",name:"undefined"};function Ae(e,t){if(e.computed&&e.property.type==="Identifier"){if(t.isLoopVariable(e.property.name)){if(e.object.type==="Identifier"&&!t.isLoopVariable(e.object.name)&&!t.isContextBound(e.object.name)){const[i,r]=t.getVariable(e.object.name),s=v.createContextVariableReference(r,i),n=v.createGetCall(s,e.property);Object.assign(e,n),e._indexTransformed=!0}return}if(!t.isContextBound(e.property.name)){const[i,r]=t.getVariable(e.property.name);e.property=v.createContextVariableReference(r,i),e.property=v.createGetCall(e.property,0)}}if(e.computed&&e.object.type==="Identifier"){if(t.isLoopVariable(e.object.name))return;if(!t.isContextBound(e.object.name)){const[i,r]=t.getVariable(e.object.name);e.object=v.createContextVariableReference(r,i)}if(e.property.type==="MemberExpression"){const i=e.property;i._indexTransformed||(Ae(i,t),i._indexTransformed=!0)}}}function Ne(e,t){const i=v.createGetCall(v.createIdentifier(e.name),0);e.start!==void 0&&(i.start=e.start),e.end!==void 0&&(i.end=e.end),i._indexTransformed=!0,Object.assign(e,i)}function te(e,t){if(e.name!==U){if(e.name==="na"&&!(e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e)){e.name="NaN";return}if(e.name==="Math"||e.name==="NaN"||e.name==="undefined"||e.name==="Infinity"||e.name==="null"||e.name.startsWith("'")&&e.name.endsWith("'")||e.name.startsWith('"')&&e.name.endsWith('"')||e.name.startsWith("`")&&e.name.endsWith("`")||t.isLoopVariable(e.name))return;let i=!1;if(e.parent&&e.parent.type==="CallExpression"&&e.parent.arguments.includes(e)){const g=e.parent.callee;if(g.type==="MemberExpression"&&g.object&&g.object.name===U&&["get","set","init","param"].includes(g.property.name))e.parent.arguments.indexOf(e)===0&&(i=!0);else{const p=g.type==="MemberExpression"&&g.object&&g.object.type==="Identifier"&&et.includes(g.object.name);g.type==="MemberExpression"&&!p?i=!1:i=!0}}const r=e.parent&&e.parent.type==="MemberExpression"&&e.parent.object===e&&t.isContextBound(e.name),s=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee&&e.parent.callee.type==="MemberExpression"&&e.parent.callee.property.name==="param";e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left;const n=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,a=e.parent&&e.parent.type==="MemberExpression"&&e.parent.computed&&e.parent.object===e,o=e.parent&&e.parent.type==="MemberExpression"&&e.parent.computed&&e.parent.property===e&&e.parent.parent&&e.parent.parent.type==="CallExpression"&&e.parent.parent.callee&&e.parent.parent.callee.type==="MemberExpression"&&t.isContextBound(e.parent.parent.callee.object.name);if(r||s||i||o||n){if(n||t.isLocalSeriesVar(e.name)||t.isContextBound(e.name)&&!t.isRootParam(e.name))return;const[g,p]=t.getVariable(e.name),x=v.createContextVariableReference(p,g);Object.assign(e,x);return}const h=t.isContextBound(e.name)&&!t.isRootParam(e.name);if(h&&!(e.parent&&e.parent.type==="CallExpression"&&e.parent.arguments.includes(e)))return;if(t.isLocalSeriesVar(e.name)){if(!a){const g=v.createIdentifier(e.name),p=v.createGetCall(g,0);Object.assign(e,p)}return}const[u,l]=t.getVariable(e.name);let f;if(h)f=v.createIdentifier(e.name);else{if(u===e.name&&!t.isContextBound(e.name))return;f=v.createContextVariableReference(l,u)}if(a)Object.assign(e,f);else{const g=v.createGetCall(f,0);Object.assign(e,g)}}}function le(e,t,i){if(e.object&&e.object.type==="Identifier"&&e.object.name==="Math")return;if(e.object&&e.object.type==="Identifier"&&et.includes(e.object.name)&&i.isContextBound(e.object.name)&&!e.computed){const h=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,u=e.parent&&(e.parent.type==="VariableDeclarator"||e.parent.type==="Property"||e.parent.type==="AssignmentExpression");if(!h&&!u){const l={type:"CallExpression",callee:{type:"MemberExpression",object:e.object,property:e.property,computed:!1},arguments:[],_transformed:!1};e.start!==void 0&&(l.start=e.start),e.end!==void 0&&(l.end=e.end),Object.assign(e,l);return}}const r=i.getCurrentScopeType()=="if",s=i.getCurrentScopeType()=="els",n=i.getCurrentScopeType()=="for";if(!r&&!s&&!n&&e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)&&!e.computed)return;e._indexTransformed||(Ae(e,i),e._indexTransformed=!0);const a=e.object&&e.object.type==="MemberExpression"&&e.object.object&&e.object.object.type==="MemberExpression"&&e.object.object.object&&e.object.object.object.name===U,o=e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name);if(e.computed&&(a||o)){if(e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e)return;const h=v.createGetCall(e.object,e.property);e.start&&(h.start=e.start),e.end&&(h.end=e.end),Object.assign(e,h),delete e.object,delete e.property,delete e.computed}}function tt(e,t){if(e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(t.isLoopVariable(e.name))return e;if(t.isRootParam(e.name)){const[s,n]=t.getVariable(e.name);return v.createContextVariableReference(n,s)}if(t.isContextBound(e.name)||t.isLocalSeriesVar(e.name))return e;const[i,r]=t.getVariable(e.name);return i===e.name&&!t.isContextBound(e.name)?e:v.createContextVariableReference(r,i)}return e}function Pe(e,t,i=""){switch(e.type){case"BinaryExpression":return $t(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?tt(e.object,t):e.object,property:e.property,computed:e.computed};case"Identifier":{if(t.isLoopVariable(e.name)||e.parent&&e.parent.type==="MemberExpression"&&e.parent.property===e)return e;const r=tt(e,t);return r.type==="Identifier"&&(r.name==="NaN"||r.name==="undefined"||r.name==="Infinity"||r.name==="null"||r.name==="Math")?r:v.createGetCall(r,0)}case"UnaryExpression":return Wt(e,t,i);case"ConditionalExpression":{const r=Pe(e.test,t,i),s=Pe(e.consequent,t,i),n=Pe(e.alternate,t,i);return{type:"ConditionalExpression",test:r,consequent:s,alternate:n,start:e.start,end:e.end}}}return e}function $t(e,t,i){const r=Pe(e.left,t,i),s=Pe(e.right,t,i),n={type:"BinaryExpression",operator:e.operator,left:r,right:s,start:e.start,end:e.end};return z(n,t,{CallExpression(a,o){a._transformed||pe(a,o)},MemberExpression(a){le(a,"",t)}}),n}function Xi(e,t,i){const r=Pe(e.left,t,i),s=Pe(e.right,t,i),n={type:"LogicalExpression",operator:e.operator,left:r,right:s,start:e.start,end:e.end};return z(n,t,{CallExpression(a,o){a._transformed||pe(a,o)}}),n}function Zi(e,t,i){z(e,{parent:e,inNamespaceCall:!1},{Identifier(a,o,h){if(a.name=="NaN")return;if(a.name=="na"){a.name="NaN";return}a.parent=o.parent,te(a,t);const u=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||u)&&(a.type==="MemberExpression"?Ae(a,t):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===U&&a.parent.callee.property.name==="get"||Ne(a)))},MemberExpression(a,o,h){Ae(a,t),a.object&&h(a.object,{parent:a,inNamespaceCall:o.inNamespaceCall})},ConditionalExpression(a,o,h){const u={...o,parent:a};a.test&&h(a.test,u),a.consequent&&h(a.consequent,u),a.alternate&&h(a.alternate,u)},BinaryExpression(a,o,h){const u={...o,parent:a};h(a.left,u),h(a.right,u)},LogicalExpression(a,o,h){const u={...o,parent:a};h(a.left,u),h(a.right,u)},UnaryExpression(a,o,h){const u={...o,parent:a};h(a.argument,u)},CallExpression(a,o,h){const u=a.callee&&a.callee.type==="MemberExpression"&&a.callee.object&&a.callee.object.type==="Identifier"&&t.isContextBound(a.callee.object.name);pe(a,t),a.arguments.forEach(l=>h(l,{parent:a,inNamespaceCall:u||o.inNamespaceCall}))}});const r=v.createMemberExpression(v.createIdentifier(i),v.createIdentifier("param")),s=t.generateParamId(),n={type:"CallExpression",callee:r,arguments:[e,jt,{type:"Identifier",name:`'${s}'`}],_transformed:!0,_isParamCall:!0};if(!t.shouldSuppressHoisting()){const a=s;t.addLocalSeriesVar(a);const o=v.createVariableDeclaration(a,n);return t.addHoistedStatement(o),v.createIdentifier(a)}return n}function Wt(e,t,i){const r=Pe(e.argument,t,i);return{type:"UnaryExpression",operator:e.operator,prefix:e.prefix,argument:r,start:e.start,end:e.end}}function qt(e,t,i){switch(e?.type){case"BinaryExpression":e=$t(e,i,t);break;case"LogicalExpression":e=Xi(e,i,t);break;case"ConditionalExpression":return Zi(e,i,t);case"UnaryExpression":e=Wt(e,i,t);break;case"ArrayExpression":e.elements=e.elements.map(o=>{if(o.type==="Identifier"){if(i.isContextBound(o.name)&&!i.isRootParam(o.name))return o;const[h,u]=i.getVariable(o.name);return v.createContextVariableAccess0(u,h)}return o});break}if(e.type==="MemberExpression"&&e.computed&&e.property){e.object.type==="CallExpression"?pe(e.object,i):e.object.type==="MemberExpression"?le(e.object,"",i):e.object.type==="BinaryExpression"?e.object=$t(e.object,i,t):e.object.type==="LogicalExpression"?e.object=Xi(e.object,i,t):e.object.type==="ConditionalExpression"?e.object=Zi(e.object,i,t):e.object.type==="UnaryExpression"&&(e.object=Wt(e.object,i,t));const o=e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)?e.object:tt(e.object,i),h=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?tt(e.property,i):e.property,u=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),l=i.generateParamId(),f={type:"CallExpression",callee:u,arguments:[o,h,{type:"Identifier",name:`'${l}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const g=l;i.addLocalSeriesVar(g);const p=v.createVariableDeclaration(g,f);return i.addHoistedStatement(p),v.createIdentifier(g)}return f}if(e.type==="ObjectExpression"&&(e.properties=e.properties.map(o=>{if(o.value.name){if(i.isContextBound(o.value.name)&&!i.isRootParam(o.value.name))return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createIdentifier(o.value.name),kind:"init",method:!1,shorthand:!1,computed:!1};const[h,u]=i.getVariable(o.value.name);return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createContextVariableReference(u,h),kind:"init",method:!1,shorthand:!1,computed:!1}}else o.value.type!=="Literal"&&(o.value=qt(o.value,t,i));return o})),e.type==="Identifier"){if(e.name==="na")return e.name="NaN",e;if(i.isContextBound(e.name)&&!i.isRootParam(e.name)){const o=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),h=i.generateParamId(),u={type:"CallExpression",callee:o,arguments:[e,jt,{type:"Identifier",name:`'${h}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const l=h;i.addLocalSeriesVar(l);const f=v.createVariableDeclaration(l,u);return i.addHoistedStatement(f),v.createIdentifier(l)}return u}}e?.type==="CallExpression"&&pe(e,i);const r=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),s=e.type==="Identifier"?tt(e,i):e,n=i.generateParamId(),a={type:"CallExpression",callee:r,arguments:[s,jt,{type:"Identifier",name:`'${n}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const o=n;i.addLocalSeriesVar(o);const h=v.createVariableDeclaration(o,a);return i.addHoistedStatement(h),v.createIdentifier(o)}return a}function pe(e,t,i){if(e._transformed)return;e.callee&&e.callee.type==="Identifier"&&(et.includes(e.callee.name)||xs.includes(e.callee.name))&&t.isContextBound(e.callee.name)&&(e.callee=v.createMemberExpression(e.callee,v.createIdentifier("any")));const r=e.callee&&e.callee.type==="MemberExpression"&&e.callee.object&&e.callee.object.type==="Identifier"&&(t.isContextBound(e.callee.object.name)||e.callee.object.name==="math"||e.callee.object.name==="ta");if(r){if(e.callee.object.name===U&&["get","init","param"].includes(e.callee.property.name))return;const s=e.callee.object.name,n=[];e.arguments.forEach(l=>{if(l._isParamCall){n.push(l);return}n.push(qt(l,s,t))}),e.arguments=n,s==="ta"&&e.arguments.push(t.getNextTACallId());const a=e.callee.property.name,o=`${s}.${a}`,h=ys.includes(o),u=e._insideAwait===!0;if(h&&!u){const l=Object.assign({},e),f=v.createAwaitExpression(l);Object.assign(e,f)}if(!t.shouldSuppressHoisting()){const l=t.generateTempVar();t.addLocalSeriesVar(l);const f=e._insideAwait===!0;let g=Object.assign({},e);f&&(g=v.createAwaitExpression(g));const p=v.createVariableDeclaration(l,g);t.addHoistedStatement(p);const x=v.createIdentifier(l);Object.assign(e,x),e._wasHoisted=!0,e._wasInsideAwait=f;return}e._transformed=!0}else e.callee&&e.callee.type==="Identifier"&&(e.arguments=e.arguments.map(s=>s._isParamCall?s:qt(s,U,t)),e._transformed=!0);!r&&e.callee&&e.callee.type==="MemberExpression"&&e.callee.object.type==="Identifier"&&te(e.callee.object,t),e.arguments.forEach(s=>{z(s,{parent:e},{Identifier(n,a,o){n.parent=a.parent,te(n,t);const h=n.parent&&n.parent.type==="BinaryExpression";(n.parent&&n.parent.type==="ConditionalExpression"||h)&&(n.type==="MemberExpression"?Ae(n,t):n.type==="Identifier"&&(n.parent&&n.parent.type==="CallExpression"&&n.parent.callee&&n.parent.callee.object&&n.parent.callee.object.name===U&&n.parent.callee.property.name==="get"||Ne(n)))},BinaryExpression(n,a,o){const h={...a,parent:n};o(n.left,h),o(n.right,h)},LogicalExpression(n,a,o){const h={...a,parent:n};o(n.left,h),o(n.right,h)},UnaryExpression(n,a,o){const h={...a,parent:n};o(n.argument,h)},CallExpression(n,a,o){n._transformed||pe(n,t)},MemberExpression(n,a,o){le(n,"",t),n.object&&o(n.object,{parent:n})}})})}function Ji(e,t){let i=null;if(e.left.type==="Identifier"){const[r,s]=t.getVariable(e.left.name);i=v.createContextVariableReference(s,r)}else if(e.left.type==="MemberExpression"&&e.left.computed&&e.left.object.type==="Identifier"){const r=e.left.object.name,[s,n]=t.getVariable(r),a=s!==r,o=t.isContextBound(r);(a||o)&&!t.isLoopVariable(r)&&e.left.property.type==="Literal"&&e.left.property.value===0&&(i=v.createContextVariableReference(n,s))}if(z(e.right,{parent:e.right,inNamespaceCall:!1},{Identifier(r,s,n){r.name=="na"&&(r.name="NaN"),r.parent=s.parent,te(r,t);const a=r.parent&&r.parent.type==="BinaryExpression",o=r.parent&&r.parent.type==="ConditionalExpression",h=t.isContextBound(r.name)&&!t.isRootParam(r.name),u=r.parent&&r.parent.type==="MemberExpression"&&r.parent.computed&&r.parent.object===r,l=r.parent&&r.parent._isParamCall,f=r.parent&&r.parent.type==="MemberExpression",g=r.name==="NaN",p=r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===U&&r.parent.callee.property.name==="get";(h||o||a)&&(r.type==="MemberExpression"?Ae(r,t):r.type==="Identifier"&&!f&&!u&&!l&&!g&&!p&&Ne(r))},MemberExpression(r,s,n){le(r,"",t),r.type==="CallExpression"?r.arguments.forEach(a=>n(a,{parent:r,inNamespaceCall:s.inNamespaceCall})):r.object&&n(r.object,{parent:r,inNamespaceCall:s.inNamespaceCall})},CallExpression(r,s,n){const a=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&t.isContextBound(r.callee.object.name);pe(r,t),r.type==="CallExpression"&&r.arguments.forEach(o=>n(o,{parent:r,inNamespaceCall:a||s.inNamespaceCall}))}}),i){let r=e.right;if(e.operator!=="="){const n=e.operator.replace("=",""),a=v.createGetCall(i,0);r={type:"BinaryExpression",operator:n,left:a,right:e.right,start:e.start,end:e.end}}const s=v.createSetCall(i,r);e.start&&(s.start=e.start),e.end&&(s.end=e.end),Object.assign(e,s)}}function er(e,t){e.declarations.forEach(i=>{i.init.name=="na"&&(i.init.name="NaN");const r=i.init&&i.init.type==="MemberExpression"&&i.init.object&&(i.init.object.name==="context"||i.init.object.name===U||i.init.object.name==="context2"),s=i.init&&i.init.type==="MemberExpression"&&i.init.object?.object&&(i.init.object.object.name==="context"||i.init.object.object.name===U||i.init.object.object.name==="context2"),n=i.init&&i.init.type==="ArrowFunctionExpression";if(r){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(p=>{p.key.name&&t.addContextBoundVar(p.key.name)}),i.init.object.name=U;return}if(s){i.id.name&&t.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(p=>{p.key.name&&t.addContextBoundVar(p.key.name)}),i.init.object.object.name=U;return}n&&i.init.params.forEach(p=>{p.type==="Identifier"&&t.addContextBoundVar(p.name)});const a=t.addVariable(i.id.name,e.kind),o=e.kind,h=t.isArrayPatternElement(i.id.name);i.init&&!n&&!h&&(i.init.type==="CallExpression"&&i.init.callee.type==="MemberExpression"&&i.init.callee.object&&i.init.callee.object.type==="Identifier"&&t.isContextBound(i.init.callee.object.name)?pe(i.init,t):z(i.init,{parent:i.init},{Identifier(p,x){p.parent=x.parent,te(p,t);const y=p.parent&&p.parent.type==="BinaryExpression",w=p.parent&&p.parent.type==="UnaryExpression",E=p.parent&&p.parent.type==="ConditionalExpression",A=p.parent&&p.parent.type==="CallExpression"&&p.parent.callee&&p.parent.callee.object&&p.parent.callee.object.name===U&&p.parent.callee.property.name==="get";p.type==="Identifier"&&(y||w||E)&&!A&&Ne(p)},CallExpression(p,x,y){p.callee.type==="Identifier"&&(p.callee.parent=p),p.arguments.forEach(w=>{w.type==="Identifier"&&(w.parent=p)}),pe(p,t),p.type==="CallExpression"&&p.arguments.forEach(w=>y(w,{parent:p}))},BinaryExpression(p,x,y){p.left.type==="Identifier"&&(p.left.parent=p),p.right.type==="Identifier"&&(p.right.parent=p),y(p.left,{parent:p}),y(p.right,{parent:p})},MemberExpression(p,x,y){p.object&&p.object.type==="Identifier"&&(p.object.parent=p),p.property&&p.property.type==="Identifier"&&(p.property.parent=p),le(p,"",t),p.type==="CallExpression"?p.arguments.forEach(w=>y(w,{parent:p})):p.object&&y(p.object,{parent:p})},AwaitExpression(p,x,y){p.argument&&(p.argument._insideAwait=!0,y(p.argument,{parent:p}),p.argument.type==="Identifier"&&p.argument._wasInsideAwait&&Object.assign(p,p.argument))}}));const u=v.createContextVariableReference(o,a),l=!h&&i.init&&i.init.type==="MemberExpression"&&i.init.computed&&i.init.property&&(i.init.property.type==="Literal"||i.init.property.type==="MemberExpression");i.init?.property?.type==="MemberExpression"&&(i.init.property._indexTransformed||(Ae(i.init.property,t),i.init.property._indexTransformed=!0));let f;i.init?n||h?f=i.init:o==="var"?f=v.createInitVarCall(u,i.init):f=v.createInitCall(u,l?i.init.object:i.init,l?i.init.property:void 0):f=v.createIdentifier("undefined");const g=v.createExpressionStatement(v.createAssignmentExpression(u,f));if(h){const p=i.init.object.name,[x,y]=t.getVariable(p),w=v.createContextVariableReference(y,x),E=i.init.property.value,A={type:"MemberExpression",object:v.createGetCall(w,0),property:{type:"Literal",value:E},computed:!0};g.expression.right=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("init")),[u,A])}n&&(t.pushScope("fn"),z(i.init.body,t,{BlockStatement(p,x,y){p.body.forEach(w=>y(w,x))},IfStatement(p,x,y){x.pushScope("if"),y(p.consequent,x),p.alternate&&(x.pushScope("els"),y(p.alternate,x),x.popScope()),x.popScope()},VariableDeclaration(p,x){er(p,x)},Identifier(p,x){te(p,x)},AssignmentExpression(p,x){Ji(p,x)}}),t.popScope()),Object.assign(e,g)})}function Ps(e,t,i){if(t.setSuppressHoisting(!0),e.init&&e.init.type==="VariableDeclaration"){const r=e.init.declarations[0],s=r.id.name;t.addLoopVariable(s,s),e.init={type:"VariableDeclaration",kind:e.init.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:s},init:r.init}]},r.init&&z(r.init,t,{Identifier(n,a){t.isLoopVariable(n.name)||(t.pushScope("for"),te(n,a),t.popScope())},MemberExpression(n){t.pushScope("for"),le(n,"",t),t.popScope()}})}e.test&&z(e.test,t,{Identifier(r,s){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),te(r,s),r.type==="Identifier"&&(r.computed=!0,Ne(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),le(r,"",t),t.popScope()}}),e.update&&z(e.update,t,{Identifier(r,s){t.isLoopVariable(r.name)||(t.pushScope("for"),te(r,s),t.popScope())}}),t.setSuppressHoisting(!1),t.pushScope("for"),i(e.body,t),t.popScope()}function Ts(e,t){z(e,t,{MemberExpression(i){le(i,"",t)},CallExpression(i,r){pe(i,r)},Identifier(i,r){te(i,r);const s=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&s&&Ne(i)}})}function Rs(e,t,i){e.test&&(t.pushScope("if"),Ts(e.test,t),t.popScope()),t.pushScope("if"),i(e.consequent,t),t.popScope(),e.alternate&&(t.pushScope("els"),i(e.alternate,t),t.popScope())}function Ds(e,t){const i=t.getCurrentScopeType();if(e.argument&&(e.argument.type==="ArrayExpression"?(e.argument.elements=e.argument.elements.map(r=>{if(r.type==="Identifier"){if(t.isContextBound(r.name)&&!t.isRootParam(r.name))return v.createGetCall(r,0);const[s,n]=t.getVariable(r.name);return v.createContextVariableAccess0(n,s)}else if(r.type==="MemberExpression")return r.object&&r.object.type==="MemberExpression"&&r.object.object&&r.object.object.type==="Identifier"&&r.object.object.name==="$"&&r.object.property&&["const","let","var","params"].includes(r.object.property.name)?v.createGetCall(r,0):(r.computed&&r.object.type==="Identifier"&&t.isContextBound(r.object.name)&&!t.isRootParam(r.object.name)||le(r,"",t),r);return r}),e.argument={type:"ArrayExpression",elements:[e.argument]}):e.argument.type==="BinaryExpression"?z(e.argument,t,{Identifier(r,s){te(r,s),r.type==="Identifier"&&Ne(r)},MemberExpression(r){le(r,"",t)}}):e.argument.type==="ObjectExpression"?e.argument.properties=e.argument.properties.map(r=>{if(r.shorthand){if(t.isContextBound(r.value.name))return r;const[s,n]=t.getVariable(r.value.name);return{type:"Property",key:v.createIdentifier(r.key.name),value:v.createContextVariableReference(n,s),kind:"init",method:!1,shorthand:!1,computed:!1}}if(r.value&&r.value.type==="Identifier"&&!(t.isContextBound(r.value.name)&&!t.isRootParam(r.value.name))&&!t.isContextBound(r.value.name)){const[s,n]=t.getVariable(r.value.name);r.value=v.createContextVariableReference(n,s)}return r}):e.argument.type==="Identifier"&&(te(e.argument,t),e.argument.type==="Identifier"&&Ne(e.argument)),i==="fn")){e.argument.type==="Identifier"&&t.isContextBound(e.argument.name)&&!t.isRootParam(e.argument.name)?e.argument=v.createArrayAccess(e.argument,0):e.argument.type==="MemberExpression"?e.argument.object.type==="Identifier"&&t.isContextBound(e.argument.object.name)&&!t.isRootParam(e.argument.object.name)&&(e.argument._indexTransformed||(Ae(e.argument,t),e.argument._indexTransformed=!0)):(e.argument.type==="BinaryExpression"||e.argument.type==="LogicalExpression"||e.argument.type==="ConditionalExpression"||e.argument.type==="CallExpression")&&z(e.argument,t,{Identifier(s,n){te(s,n),s.type==="Identifier"&&!s._arrayAccessed&&(Ne(s),s._arrayAccessed=!0)},MemberExpression(s){le(s,"",t)},CallExpression(s,n){pe(s,n)}});const r=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("precision")),[e.argument]);e.argument=r}}function Vs(e,t,i){e.body&&e.body.type==="BlockStatement"&&(t.pushScope("fn"),i(e.body,t),t.popScope())}function Os(e){const t={...b,LineComment:()=>{}};Bt(e,{BinaryExpression(i){if(i.operator==="=="||i.operator==="==="){const r=i.left,s=i.right,n=v.createMathEqCall(r,s);n._transformed=!0,Object.assign(i,n)}}},t)}function Ms(e,t,i,r={debug:!1,ln:!1},s=[]){const n=a=>{if(!r.debug||!a.loc||!s.length)return null;const o=a.loc.start.line-1;if(o>=0&&o<s.length){const h=s[o].trim();if(h)return{type:"LineComment",value:`${r.ln?` [Line ${a.loc.start.line}]`:""} ${h}`}}return null};z(e,t,{Program(a,o,h){const u=[];a.body.forEach(l=>{o.enterHoistingScope(),h(l,o);const f=o.exitHoistingScope(),g=n(l);g&&u.push(g),u.push(...f),u.push(l)}),a.body=u},BlockStatement(a,o,h){const u=[];a.body.forEach(l=>{o.enterHoistingScope(),h(l,o);const f=o.exitHoistingScope(),g=n(l);g&&u.push(g),u.push(...f),u.push(l)}),a.body=u},ReturnStatement(a,o){Ds(a,o)},VariableDeclaration(a,o){er(a,o)},Identifier(a,o){te(a,o)},CallExpression(a,o){pe(a,o)},MemberExpression(a,o){le(a,i,o)},AssignmentExpression(a,o){Ji(a,o)},FunctionDeclaration(a,o,h){Vs(a,o,h)},ForStatement(a,o,h){Ps(a,o,h)},IfStatement(a,o,h){Rs(a,o,h)},AwaitExpression(a,o,h){a.argument&&(a.argument._insideAwait=!0,h(a.argument,o),a.argument.type==="Identifier"&&a.argument._wasInsideAwait===!0&&(a.type="Identifier",a.name=a.argument.name,a.argument._wasHoisted&&(a._wasHoisted=a.argument._wasHoisted),delete a.argument))}})}const m={NUMBER:"NUMBER",STRING:"STRING",BOOLEAN:"BOOLEAN",IDENTIFIER:"IDENTIFIER",KEYWORD:"KEYWORD",OPERATOR:"OPERATOR",LPAREN:"LPAREN",RPAREN:"RPAREN",LBRACKET:"LBRACKET",RBRACKET:"RBRACKET",LBRACE:"LBRACE",RBRACE:"RBRACE",COMMA:"COMMA",DOT:"DOT",COLON:"COLON",SEMICOLON:"SEMICOLON",INDENT:"INDENT",DEDENT:"DEDENT",NEWLINE:"NEWLINE",COMMENT:"COMMENT",EOF:"EOF"},Ls=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends"]),Bs=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class Fs{constructor(t,i,r,s,n=0){this.type=t,this.value=i,this.line=r,this.column=s,this.indent=n}toString(){return`Token(${this.type}, ${JSON.stringify(this.value)}, ${this.line}:${this.column}, indent=${this.indent})`}}var js=Object.defineProperty,$s=(e,t,i)=>t in e?js(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,be=(e,t,i)=>$s(e,typeof t!="symbol"?t+"":t,i);class Ws{constructor(t){be(this,"source"),be(this,"pos"),be(this,"line"),be(this,"column"),be(this,"tokens"),be(this,"indentStack"),be(this,"atLineStart"),be(this,"parenDepth"),be(this,"bracketDepth"),be(this,"braceDepth"),this.source=t,this.pos=0,this.line=1,this.column=1,this.tokens=[],this.indentStack=[0],this.atLineStart=!0,this.parenDepth=0,this.bracketDepth=0,this.braceDepth=0}tokenize(){for(;this.pos<this.source.length;){const t=this.peek();if(t==="\r"){this.advance();continue}if(t===`
34
34
  `){this.handleNewline();continue}if(this.atLineStart&&t!==`
35
35
  `){this.handleIndentation(),this.atLineStart=!1;continue}if(t===" "||t===" "){this.advance();continue}if(this.pos>=this.source.length)break;if(t==="/"&&this.peek(1)==="/"){this.readComment();continue}if(t==='"'||t==="'"){this.readString();continue}if(t==="#"){this.readColorLiteral();continue}if(this.isDigit(t)){this.readNumber();continue}if(this.isIdentifierStart(t)){this.readIdentifier();continue}if(!this.readOperatorOrPunctuation())throw new Error(`Unexpected character '${t}' at ${this.line}:${this.column}`)}for(;this.indentStack.length>1;)this.indentStack.pop(),this.addToken(m.DEDENT,"",this.getCurrentIndent());return this.addToken(m.EOF,""),this.tokens}handleNewline(){this.parenDepth===0&&this.bracketDepth===0&&this.braceDepth===0&&(this.addToken(m.NEWLINE,`
36
36
  `),this.atLineStart=!0),this.advance(),this.line++,this.column=1}handleIndentation(){let t=0,i=0;for(this.pos;this.pos<this.source.length;){const s=this.peek();if(s===" ")i++,this.advance();else if(s===" ")t++,this.advance();else break}if(this.peek()===`
37
37
  `||this.peek()==="\0")return;t+=Math.floor(i/4);const r=this.indentStack[this.indentStack.length-1];if(t>r)this.indentStack.push(t),this.addToken(m.INDENT,"",t);else if(t<r){for(;this.indentStack.length>1&&this.indentStack[this.indentStack.length-1]>t;)this.indentStack.pop(),this.addToken(m.DEDENT,"",this.indentStack[this.indentStack.length-1]);if(this.indentStack[this.indentStack.length-1]!==t)throw new Error(`Indentation error at ${this.line}:${this.column} - misaligned dedent`)}}readComment(){this.column;let t="";for(this.advance(),this.advance();this.pos<this.source.length&&this.peek()!==`
38
38
  `;)t+=this.advance();this.addToken(m.COMMENT,t.trim())}readString(){const t=this.advance(),i=this.column-1;let r="";for(;this.pos<this.source.length&&this.peek()!==t;)if(this.peek()==="\\"){this.advance();const s=this.advance();switch(s){case"n":r+=`
39
- `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case t:r+=t;break;default:r+=s}}else r+=this.advance();if(this.peek()!==t)throw new Error(`Unterminated string at ${this.line}:${i}`);this.advance(),this.addToken(m.STRING,r)}readColorLiteral(){const t=this.column;let i="#";for(this.advance();this.pos<this.source.length&&i.length<9;){const r=this.peek();if(r>="0"&&r<="9"||r>="A"&&r<="F"||r>="a"&&r<="f")i+=this.advance();else break}if(i.length!==7&&i.length!==9)throw new Error(`Invalid color literal '${i}' at ${this.line}:${t}`);this.addToken(m.STRING,i)}readNumber(){this.column;let t="",i=!1;for(;this.pos<this.source.length;){const r=this.peek();if(this.isDigit(r))t+=this.advance();else if(r==="."&&!i){const s=this.peek(1);if(this.isDigit(s)||!this.isIdentifierStart(s)){if(i=!0,t+=this.advance(),!this.isDigit(this.peek()))break}else break}else break}this.addToken(m.NUMBER,parseFloat(t))}readIdentifier(){this.column;let t="";for(;this.pos<this.source.length&&this.isIdentifierChar(this.peek());)t+=this.advance();Ms.has(t)?this.addToken(m.KEYWORD,t):t==="true"||t==="false"?this.addToken(m.BOOLEAN,t==="true"):this.addToken(m.IDENTIFIER,t)}readOperatorOrPunctuation(){const t=this.peek(),i=this.peek(1),r=t+i;if(Ls.includes(r))return this.advance(),this.advance(),this.addToken(m.OPERATOR,r),!0;if("+-*/%<>=!?".includes(t))return this.advance(),this.addToken(m.OPERATOR,t),!0;switch(t){case"(":return this.parenDepth++,this.advance(),this.addToken(m.LPAREN,t),!0;case")":return this.parenDepth--,this.advance(),this.addToken(m.RPAREN,t),!0;case"[":return this.bracketDepth++,this.advance(),this.addToken(m.LBRACKET,t),!0;case"]":return this.bracketDepth--,this.advance(),this.addToken(m.RBRACKET,t),!0;case"{":return this.braceDepth++,this.advance(),this.addToken(m.LBRACE,t),!0;case"}":return this.braceDepth--,this.advance(),this.addToken(m.RBRACE,t),!0;case",":return this.advance(),this.addToken(m.COMMA,t),!0;case".":return this.advance(),this.addToken(m.DOT,t),!0;case":":return this.advance(),this.addToken(m.COLON,t),!0;case";":return this.advance(),this.addToken(m.SEMICOLON,t),!0}return!1}peek(t=0){const i=this.pos+t;return i<this.source.length?this.source[i]:"\0"}advance(){const t=this.source[this.pos++];return this.column++,t}skipWhitespaceInline(){if(!this.atLineStart)for(;this.pos<this.source.length&&(this.peek()===" "||this.peek()===" ");)this.advance()}isDigit(t){return t>="0"&&t<="9"}isIdentifierStart(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="_"}isIdentifierChar(t){return this.isIdentifierStart(t)||this.isDigit(t)}getCurrentIndent(){return this.indentStack[this.indentStack.length-1]}addToken(t,i,r=null){const s=new Bs(t,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(s)}}var Ws=Object.defineProperty,qs=(e,t,i)=>t in e?Ws(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,se=(e,t,i)=>qs(e,typeof t!="symbol"?t+"":t,i);class B{constructor(t){this.type=t}}class Us extends B{constructor(t){super("Program"),this.body=t}}class fe extends B{constructor(t){super("ExpressionStatement"),this.expression=t}}var De=(e=>(e.VAR="var",e.LET="let",e.CONST="const",e))(De||{});class Ve extends B{constructor(t,i="let"){super("VariableDeclaration"),this.declarations=t,this.kind=i}}class Oe extends B{constructor(t,i,r=null){super("VariableDeclarator"),this.id=t,this.init=i,this.varType=r}}class er extends B{constructor(t,i,r,s=null){super("FunctionDeclaration"),this.id=t,this.params=i,this.body=r,this.returnType=s}}class Ks extends B{constructor(t,i){super("TypeDefinition"),this.name=t,this.fields=i}}class zs extends B{constructor(t,i,r=null){super("IfStatement"),this.test=t,this.consequent=i,this.alternate=r,se(this,"_line")}}class tr extends B{constructor(t,i,r,s){super("ForStatement"),this.init=t,this.test=i,this.update=r,this.body=s,se(this,"isForIn")}}class Hs extends B{constructor(t,i){super("WhileStatement"),this.test=t,this.body=i}}class Me extends B{constructor(t){super("BlockStatement"),this.body=t}}class ir extends B{constructor(t){super("ReturnStatement"),this.argument=t}}class ie extends B{constructor(t){super("Identifier"),this.name=t,se(this,"varType"),se(this,"returnType"),se(this,"isMethod")}}class Ke extends B{constructor(t,i=null){super("Literal"),this.value=t,this.raw=i}}class Le extends B{constructor(t,i,r){super("BinaryExpression"),this.operator=t,this.left=i,this.right=r}}class rr extends B{constructor(t,i,r=!0){super("UnaryExpression"),this.operator=t,this.argument=i,this.prefix=r}}class qt extends B{constructor(t,i,r){super("AssignmentExpression"),this.operator=t,this.left=i,this.right=r}}class Gs extends B{constructor(t,i,r=!1){super("UpdateExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Ys extends B{constructor(t,i){super("CallExpression"),this.callee=t,this.args=i,se(this,"arguments"),this.callee=t,this.arguments=i}}class sr extends B{constructor(t,i,r=!1){super("MemberExpression"),this.object=t,this.property=i,this.computed=r}}class it extends B{constructor(t,i,r){super("ConditionalExpression"),this.test=t,this.consequent=i,this.alternate=r,se(this,"needsIIFE"),se(this,"consequentStmts"),se(this,"alternateStmts")}}class Qs extends B{constructor(t){super("ArrayExpression"),this.elements=t}}class Xs extends B{constructor(t){super("ObjectExpression"),this.properties=t}}class Zs extends B{constructor(t,i){super("Property"),this.key=t,this.value=i,se(this,"kind"),se(this,"method"),se(this,"shorthand"),se(this,"computed"),this.kind="init",this.method=!1,this.shorthand=!1,this.computed=!1}}class nr extends B{constructor(t){super("ArrayPattern"),this.elements=t}}class ar extends B{constructor(t,i){super("AssignmentPattern"),this.left=t,this.right=i}}class Js extends B{constructor(t,i){super("SwitchExpression"),this.discriminant=t,this.cases=i}}class en extends B{constructor(t,i){super("SwitchCase"),this.test=t,this.consequent=i}}var tn=Object.defineProperty,rn=(e,t,i)=>t in e?tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,or=(e,t,i)=>rn(e,typeof t!="symbol"?t+"":t,i);class sn{constructor(t){or(this,"tokens"),or(this,"pos"),this.tokens=t,this.pos=0}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){return this.tokens[this.pos++]}match(t,i=null){const r=this.peek();return!(r.type!==t||i!==null&&r.value!==i)}expect(t,i=null){const r=this.peek();if(r.type!==t)throw new Error(`Expected ${t} but got ${r.type} at ${r.line}:${r.column}`);if(i!==null&&r.value!==i)throw new Error(`Expected '${i}' but got '${r.value}' at ${r.line}:${r.column}`);return this.advance()}skipNewlines(){for(;this.match(m.NEWLINE);)this.advance()}parse(){const t=[];for(;!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.EOF));){const i=this.parseStatement();i&&t.push(i),this.skipNewlines()}return new Us(t)}parseStatement(){this.skipNewlines();const t=this.peek().line;if(this.match(m.COMMENT))return this.advance(),null;let i;if(this.match(m.KEYWORD,"type"))i=this.parseTypeDefinition();else if(this.match(m.KEYWORD,"var")||this.match(m.KEYWORD,"varip"))i=this.parseVarDeclaration();else if(this.match(m.KEYWORD,"method"))i=this.parseMethodDeclaration();else if(this.isFunctionDeclaration())i=this.parseFunctionDeclaration();else if(this.match(m.KEYWORD,"if"))i=this.parseIfStatement();else if(this.match(m.KEYWORD,"for"))i=this.parseForStatement();else if(this.match(m.KEYWORD,"while"))i=this.parseWhileStatement();else if(this.match(m.KEYWORD,"break")||this.match(m.KEYWORD,"continue")){const r=this.advance().value;i=new fe(new ie(r))}else if(this.isTupleDestructuring())i=this.parseTupleDestructuring();else if(this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER){let r=2;for(;this.peek(r).type===m.IDENTIFIER;)r++;this.peek(r).type===m.OPERATOR&&this.peek(r).value==="="&&(i=this.parseTypedVarDeclaration())}if(!i){const r=this.parseExpression();if(this.match(m.OPERATOR)){const s=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(s)){this.advance(),this.skipNewlines();const n=this.parseExpression();s==="="&&r.type==="Identifier"?i=new Ve([new Oe(r,n)],De.LET):i=new fe(new qt(s===":="?"=":s,r,n))}else i=new fe(r)}else i=new fe(r)}return i&&(i._line=t),i}isFunctionDeclaration(){const t=this.pos;try{let i=0;if(this.peek(i).type===m.IDENTIFIER&&this.peek(i+1).type===m.IDENTIFIER&&i++,this.peek(i).type!==m.IDENTIFIER||(i++,this.peek(i).type!==m.LPAREN))return!1;i++;let r=1;for(;r>0&&this.peek(i).type!==m.EOF;)this.peek(i).type===m.LPAREN&&r++,this.peek(i).type===m.RPAREN&&r--,i++;for(;this.peek(i).type===m.NEWLINE;)i++;return this.peek(i).type===m.OPERATOR&&this.peek(i).value==="=>"}finally{this.pos=t}}parseTypeDefinition(){this.expect(m.KEYWORD,"type");const t=this.expect(m.IDENTIFIER).value;this.match(m.OPERATOR,"=>")&&this.advance(),this.skipNewlines(),this.expect(m.INDENT);const i=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const r=this.expect(m.IDENTIFIER).value,s=this.expect(m.IDENTIFIER).value;let n=null;this.match(m.OPERATOR,"=")&&(this.advance(),this.skipNewlines(),n=this.parseExpression()),i.push({type:r,name:s,defaultValue:n}),this.skipNewlines()}return this.match(m.DEDENT)&&this.advance(),new Ks(t,i)}parseVarDeclaration(){const t=this.advance().value;let i=null,r=null;if(this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.LBRACKET&&this.peek(2).type===m.RBRACKET)i=this.advance().value,this.advance(),i+="[]",this.advance(),r=this.expect(m.IDENTIFIER).value;else if(this.peek().type===m.IDENTIFIER&&(this.peek(1).type===m.IDENTIFIER||this.peek(1).type===m.OPERATOR&&this.peek(1).value==="<")){if(i=this.advance().value,this.match(m.OPERATOR,"<")){for(this.advance(),i+="<";!this.match(m.OPERATOR,">");)if(this.match(m.IDENTIFIER))i+=this.advance().value;else if(this.match(m.COMMA))i+=this.advance().value,this.skipNewlines();else break;this.match(m.OPERATOR,">")&&(i+=">",this.advance())}r=this.expect(m.IDENTIFIER).value}else if(this.peek().type===m.IDENTIFIER)r=this.advance().value;else throw new Error(`Expected identifier after ${t} at ${this.peek().line}:${this.peek().column}`);this.expect(m.OPERATOR,"="),this.skipNewlines();const s=this.parseExpression(),n=new ie(r);return i&&(n.varType=i),new Ve([new Oe(n,s,i)],t)}parseTypedVarDeclaration(){let t=this.advance().value;for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER;)t+=" "+this.advance().value;const i=this.expect(m.IDENTIFIER).value;this.expect(m.OPERATOR,"="),this.skipNewlines();const r=this.parseExpression(),s=new ie(i);return s.varType=t,new Ve([new Oe(s,r,t)],De.LET)}parseFunctionDeclaration(){let t=null;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&(t=this.advance().value);const i=this.expect(m.IDENTIFIER).value;this.expect(m.LPAREN);const r=[];for(;!this.match(m.RPAREN)&&(this.skipNewlines(),!this.match(m.RPAREN));){let a=null;for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&this.peek(2).type!==m.LPAREN;)a&&(a+=" "),a=(a||"")+this.advance().value;const o=this.expect(m.IDENTIFIER).value,h=new ie(o);if(a&&(h.varType=a),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new ar(h,u))}else r.push(h);this.match(m.COMMA)&&this.advance()}this.expect(m.RPAREN),this.skipNewlines(),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),n=new ie(i);return t&&(n.returnType=t),new er(n,r,s,t)}parseMethodDeclaration(){this.expect(m.KEYWORD,"method");let t=null;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&this.peek(2).type===m.LPAREN&&(t=this.advance().value);const i=this.expect(m.IDENTIFIER).value;this.expect(m.LPAREN);const r=[];for(;!this.match(m.RPAREN)&&(this.skipNewlines(),!this.match(m.RPAREN));){let a=null;for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&this.peek(2).type!==m.LPAREN;)a&&(a+=" "),a=(a||"")+this.advance().value;const o=this.expect(m.IDENTIFIER).value,h=new ie(o);if(a&&(h.varType=a),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new ar(h,u))}else r.push(h);this.match(m.COMMA)&&this.advance()}this.expect(m.RPAREN),this.skipNewlines(),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),n=new ie(i);return t&&(n.returnType=t),n.isMethod=!0,new er(n,r,s,t)}parseFunctionBody(){const t=[];if(!this.match(m.INDENT)){const i=this.parseExpression();return new Me([new ir(i)])}for(this.advance();!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const i=this.parseStatementOrSequence();Array.isArray(i)?t.push(...i):i&&t.push(i)}if(this.match(m.DEDENT)&&this.advance(),t.length>0){const i=t[t.length-1];i.type==="ExpressionStatement"&&(t[t.length-1]=new ir(i.expression))}return new Me(t)}parseStatementOrSequence(){this.pos;const t=this.peek().line;if(this.match(m.KEYWORD,"if")){const r=this.parseIfStatement();return r&&(r._line=t),r}if(this.match(m.KEYWORD,"for"))return this.parseForStatement();if(this.match(m.KEYWORD,"while"))return this.parseWhileStatement();if(this.match(m.KEYWORD,"break")||this.match(m.KEYWORD,"continue")){const r=this.advance().value;return new fe(new ie(r))}if(this.match(m.KEYWORD,"var")||this.match(m.KEYWORD,"varip"))return this.parseVarDeclaration();if(this.isTupleDestructuring())return this.parseTupleDestructuring();if(this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER){let r=2;for(;this.peek(r).type===m.IDENTIFIER;)r++;if(this.peek(r).type===m.OPERATOR&&this.peek(r).value==="=")return this.parseTypedVarDeclaration()}const i=[];for(;;){const r=this.parseExpression();if(this.match(m.OPERATOR)){const s=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(s)){this.advance(),this.skipNewlines();const n=this.parseExpression();if(s==="="&&r.type==="Identifier"?i.push(new Ve([new Oe(r,n)],De.LET)):i.push(new fe(new qt(s===":="?"=":s,r,n))),this.match(m.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new fe(r));else return new fe(r);break}}else if(this.match(m.COMMA)){i.push(new fe(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new fe(r));else return new fe(r);break}}return i.length>1?i:i.length===1?i[0]:null}parseIfStatement(){this.expect(m.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();let r=null;return this.match(m.KEYWORD,"else")&&(this.advance(),this.skipNewlines(),this.match(m.KEYWORD,"if")?r=this.parseIfStatement():r=this.parseBlock()),new zs(t,i,r)}parseForStatement(){this.expect(m.KEYWORD,"for");let t=null,i=!1;if(this.match(m.LBRACKET)){this.advance();const r=[];for(;!this.match(m.RBRACKET);)this.skipNewlines(),r.push(new ie(this.expect(m.IDENTIFIER).value)),this.match(m.COMMA)&&this.advance();this.expect(m.RBRACKET),t=new nr(r),i=!0}else{const r=this.expect(m.IDENTIFIER).value;t=new ie(r)}if(this.match(m.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const s=this.parseBlock(),n=new Ve([new Oe(t,r)],De.CONST),a=new tr(n,null,null,s);return a.isForIn=!0,a}else{if(i)throw new Error(`Range-based for loops don't support destructuring at ${this.peek().line}:${this.peek().column}`);this.expect(m.OPERATOR,"=");const r=this.parseExpression();this.expect(m.KEYWORD,"to");const s=this.parseExpression();let n=null;this.match(m.KEYWORD,"by")&&(this.advance(),n=this.parseExpression()),this.skipNewlines();const a=this.parseBlock(),o=new Ve([new Oe(t,r)],De.LET),h=new Le("<=",t,s),u=n?new qt("+=",t,n):new Gs("++",t);return new tr(o,h,u,a)}}parseWhileStatement(){this.expect(m.KEYWORD,"while");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new Hs(t,i)}parseBlock(){if(!this.match(m.INDENT)){const i=this.parseStatement();return new Me(i?[i]:[])}this.advance();const t=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const i=this.parseStatement();i&&t.push(i)}return this.match(m.DEDENT)&&this.advance(),new Me(t)}isTupleDestructuring(){if(!this.match(m.LBRACKET))return!1;let t=1;for(;;){for(;this.peek(t).type===m.NEWLINE;)t++;if(this.peek(t).type!==m.IDENTIFIER)return!1;for(t++;this.peek(t).type===m.NEWLINE;)t++;if(this.peek(t).type===m.RBRACKET){t++;break}else if(this.peek(t).type===m.COMMA){t++;continue}else return!1}for(;this.peek(t).type===m.NEWLINE;)t++;return this.peek(t).type===m.OPERATOR&&this.peek(t).value==="="}parseTupleDestructuring(){this.expect(m.LBRACKET);const t=[];for(;!this.match(m.RBRACKET);)this.skipNewlines(),t.push(new ie(this.expect(m.IDENTIFIER).value)),this.match(m.COMMA)&&this.advance();this.expect(m.RBRACKET),this.skipNewlines(),this.expect(m.OPERATOR,"="),this.skipNewlines();const i=this.parseExpression();return new Ve([new Oe(new nr(t),i)],De.CONST)}parseExpression(){return this.parseTernary()}parseTernary(){let t=this.parseLogicalOr();if(this.match(m.OPERATOR,"?")){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(m.COLON),this.skipNewlines();const r=this.parseExpression();return new it(t,i,r)}return t}parseLogicalOr(){let t=this.parseLogicalAnd();for(;this.match(m.KEYWORD,"or")||this.match(m.OPERATOR)&&this.peek().value==="||";){this.advance(),this.skipNewlines();const i=this.parseLogicalAnd();t=new Le("||",t,i)}return t}parseLogicalAnd(){let t=this.parseEquality();for(;this.match(m.KEYWORD,"and")||this.match(m.OPERATOR)&&this.peek().value==="&&";){this.advance(),this.skipNewlines();const i=this.parseEquality();t=new Le("&&",t,i)}return t}parseEquality(){let t=this.parseComparison();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["==","!="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseComparison();t=new Le(i,t,r)}return t}parseComparison(){let t=this.parseAdditive();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["<",">","<=",">="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseAdditive();t=new Le(i,t,r)}return t}parseAdditive(){let t=this.parseMultiplicative();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["+","-"].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseMultiplicative();t=new Le(i,t,r)}return t}parseMultiplicative(){let t=this.parseUnary();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["*","/","%"].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseUnary();t=new Le(i,t,r)}return t}parseUnary(){if(this.match(m.OPERATOR)){const t=this.peek().value;if(["+","-","!"].includes(t))return this.advance(),this.skipNewlines(),new rr(t,this.parseUnary())}return this.match(m.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new rr("!",this.parseUnary())):this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match(m.OPERATOR,"<")){const i=this.pos;this.advance();let r=1,s=!0;for(;r>0&&!this.match(m.EOF);)if(this.match(m.OPERATOR,"<"))r++,this.advance();else if(this.match(m.OPERATOR,">"))r--,this.advance();else if(this.match(m.IDENTIFIER)||this.match(m.COMMA))this.advance();else{s=!1,this.pos=i;break}if(s&&this.match(m.LPAREN)){t=this.parseCallExpression(t);continue}else{if(s)continue;break}}else if(this.match(m.LPAREN))t=this.parseCallExpression(t);else if(this.match(m.DOT)){this.advance(),this.skipNewlines();const i=this.expect(m.IDENTIFIER).value;t=new sr(t,new ie(i),!1)}else if(this.match(m.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(m.RBRACKET),t=new sr(t,i,!0)}else break;return t}parseCallExpression(t){this.expect(m.LPAREN);const i=[],r=[];for(;!this.match(m.RPAREN)&&(this.skipNewlines(),!this.match(m.RPAREN));){if((this.peek().type===m.IDENTIFIER||this.peek().type===m.KEYWORD)&&this.peek(1).type===m.OPERATOR&&this.peek(1).value==="="){const s=this.advance().value;this.advance(),this.skipNewlines();const n=this.parseExpression();r.push(new Zs(new ie(s),n))}else i.push(this.parseExpression());this.match(m.COMMA)&&this.advance(),this.skipNewlines()}return this.expect(m.RPAREN),r.length>0&&i.push(new Xs(r)),new Ys(t,i)}parsePrimary(){const t=this.peek();if(this.match(m.NUMBER)){const i=this.advance();return new Ke(i.value)}if(this.match(m.STRING)){const i=this.advance();return new Ke(i.value)}if(this.match(m.BOOLEAN)){const i=this.advance();return new Ke(i.value)}if(this.match(m.IDENTIFIER)){const i=this.advance();return new ie(i.value)}if(this.match(m.LBRACKET))return this.parseArrayLiteral();if(this.match(m.LPAREN)){this.advance(),this.skipNewlines();const i=this.parseExpression();return this.skipNewlines(),this.expect(m.RPAREN),i}if(this.match(m.KEYWORD,"if"))return this.parseIfExpression();if(this.match(m.KEYWORD,"switch"))return this.parseSwitchExpression();throw new Error(`Unexpected token ${t.type} '${t.value}' at ${t.line}:${t.column}`)}parseArrayLiteral(){this.expect(m.LBRACKET);const t=[];for(;!this.match(m.RBRACKET)&&(this.skipNewlines(),!this.match(m.RBRACKET));)t.push(this.parseExpression()),this.match(m.COMMA)&&this.advance(),this.skipNewlines();return this.expect(m.RBRACKET),new Qs(t)}parseIfExpression(){this.expect(m.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines(),this.expect(m.INDENT);const i=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const a=this.parseStatement();a&&i.push(a)}this.advance();let r=[];if(this.match(m.KEYWORD,"else"))if(this.advance(),this.skipNewlines(),this.match(m.KEYWORD,"if")){const a=this.parseIfExpression();if(this.needsIIFE(i,r)){const o=new it(t,new Me(i),a);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=a,o}else return new it(t,this.getBlockValue(i),a)}else{for(this.expect(m.INDENT);!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const a=this.parseStatement();a&&r.push(a)}this.advance()}if(this.needsIIFE(i,r)){const a=new it(t,new Me(i),new Me(r));return a.needsIIFE=!0,a.consequentStmts=i,a.alternateStmts=r,a}const s=this.getBlockValue(i),n=r.length>0?this.getBlockValue(r):new Ke(null);return new it(t,s,n)}needsIIFE(t,i){if(t.length>1||i.length>1)return!0;const r=s=>s.some(n=>n.type==="IfStatement"||n.type==="ForStatement"||n.type==="WhileStatement"||n.type==="BlockStatement");return r(t)||r(i)}parseSwitchExpression(){this.expect(m.KEYWORD,"switch");const t=this.parseExpression();this.skipNewlines(),this.expect(m.INDENT);const i=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){let r=null;this.match(m.OPERATOR,"=>")||(r=this.parseExpression()),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const s=[];if(this.match(m.INDENT)){for(this.advance();!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const a=this.parseStatement();a&&s.push(a)}this.advance()}else s.push(new fe(this.parseExpression()));const n=this.getBlockValue(s);i.push(new en(r,n)),this.skipNewlines()}return this.advance(),new Js(t,i)}getBlockValue(t){if(t.length===0)return new Ke(null);const i=t[t.length-1];return i.type==="ExpressionStatement"?i.expression:i.type==="VariableDeclaration"&&i.declarations.length>0?i.declarations[0].id:new Ke(null)}}var nn=Object.defineProperty,an=(e,t,i)=>t in e?nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Be=(e,t,i)=>an(e,typeof t!="symbol"?t+"":t,i);class on{constructor(t={}){Be(this,"indent"),Be(this,"indentStr"),Be(this,"output"),Be(this,"sourceCode"),Be(this,"sourceLines"),Be(this,"lastCommentedLine"),Be(this,"includeSourceComments"),this.indent=0,this.indentStr=t.indentStr||" ",this.output=[],this.sourceCode=t.sourceCode||null,this.sourceLines=this.sourceCode?this.sourceCode.split(`
39
+ `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case t:r+=t;break;default:r+=s}}else r+=this.advance();if(this.peek()!==t)throw new Error(`Unterminated string at ${this.line}:${i}`);this.advance(),this.addToken(m.STRING,r)}readColorLiteral(){const t=this.column;let i="#";for(this.advance();this.pos<this.source.length&&i.length<9;){const r=this.peek();if(r>="0"&&r<="9"||r>="A"&&r<="F"||r>="a"&&r<="f")i+=this.advance();else break}if(i.length!==7&&i.length!==9)throw new Error(`Invalid color literal '${i}' at ${this.line}:${t}`);this.addToken(m.STRING,i)}readNumber(){this.column;let t="",i=!1;for(;this.pos<this.source.length;){const r=this.peek();if(this.isDigit(r))t+=this.advance();else if(r==="."&&!i){const s=this.peek(1);if(this.isDigit(s)||!this.isIdentifierStart(s)){if(i=!0,t+=this.advance(),!this.isDigit(this.peek()))break}else break}else break}this.addToken(m.NUMBER,parseFloat(t))}readIdentifier(){this.column;let t="";for(;this.pos<this.source.length&&this.isIdentifierChar(this.peek());)t+=this.advance();Ls.has(t)?this.addToken(m.KEYWORD,t):t==="true"||t==="false"?this.addToken(m.BOOLEAN,t==="true"):this.addToken(m.IDENTIFIER,t)}readOperatorOrPunctuation(){const t=this.peek(),i=this.peek(1),r=t+i;if(Bs.includes(r))return this.advance(),this.advance(),this.addToken(m.OPERATOR,r),!0;if("+-*/%<>=!?".includes(t))return this.advance(),this.addToken(m.OPERATOR,t),!0;switch(t){case"(":return this.parenDepth++,this.advance(),this.addToken(m.LPAREN,t),!0;case")":return this.parenDepth--,this.advance(),this.addToken(m.RPAREN,t),!0;case"[":return this.bracketDepth++,this.advance(),this.addToken(m.LBRACKET,t),!0;case"]":return this.bracketDepth--,this.advance(),this.addToken(m.RBRACKET,t),!0;case"{":return this.braceDepth++,this.advance(),this.addToken(m.LBRACE,t),!0;case"}":return this.braceDepth--,this.advance(),this.addToken(m.RBRACE,t),!0;case",":return this.advance(),this.addToken(m.COMMA,t),!0;case".":return this.advance(),this.addToken(m.DOT,t),!0;case":":return this.advance(),this.addToken(m.COLON,t),!0;case";":return this.advance(),this.addToken(m.SEMICOLON,t),!0}return!1}peek(t=0){const i=this.pos+t;return i<this.source.length?this.source[i]:"\0"}advance(){const t=this.source[this.pos++];return this.column++,t}skipWhitespaceInline(){if(!this.atLineStart)for(;this.pos<this.source.length&&(this.peek()===" "||this.peek()===" ");)this.advance()}isDigit(t){return t>="0"&&t<="9"}isIdentifierStart(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="_"}isIdentifierChar(t){return this.isIdentifierStart(t)||this.isDigit(t)}getCurrentIndent(){return this.indentStack[this.indentStack.length-1]}addToken(t,i,r=null){const s=new Fs(t,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(s)}}var qs=Object.defineProperty,Us=(e,t,i)=>t in e?qs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,se=(e,t,i)=>Us(e,typeof t!="symbol"?t+"":t,i);class B{constructor(t){this.type=t}}class Ks extends B{constructor(t){super("Program"),this.body=t}}class fe extends B{constructor(t){super("ExpressionStatement"),this.expression=t}}var De=(e=>(e.VAR="var",e.LET="let",e.CONST="const",e))(De||{});class Ve extends B{constructor(t,i="let"){super("VariableDeclaration"),this.declarations=t,this.kind=i}}class Oe extends B{constructor(t,i,r=null){super("VariableDeclarator"),this.id=t,this.init=i,this.varType=r}}class tr extends B{constructor(t,i,r,s=null){super("FunctionDeclaration"),this.id=t,this.params=i,this.body=r,this.returnType=s}}class zs extends B{constructor(t,i){super("TypeDefinition"),this.name=t,this.fields=i}}class Hs extends B{constructor(t,i,r=null){super("IfStatement"),this.test=t,this.consequent=i,this.alternate=r,se(this,"_line")}}class ir extends B{constructor(t,i,r,s){super("ForStatement"),this.init=t,this.test=i,this.update=r,this.body=s,se(this,"isForIn")}}class Gs extends B{constructor(t,i){super("WhileStatement"),this.test=t,this.body=i}}class Me extends B{constructor(t){super("BlockStatement"),this.body=t}}class rr extends B{constructor(t){super("ReturnStatement"),this.argument=t}}class ie extends B{constructor(t){super("Identifier"),this.name=t,se(this,"varType"),se(this,"returnType"),se(this,"isMethod")}}class Ke extends B{constructor(t,i=null){super("Literal"),this.value=t,this.raw=i}}class Le extends B{constructor(t,i,r){super("BinaryExpression"),this.operator=t,this.left=i,this.right=r}}class sr extends B{constructor(t,i,r=!0){super("UnaryExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Ut extends B{constructor(t,i,r){super("AssignmentExpression"),this.operator=t,this.left=i,this.right=r}}class Ys extends B{constructor(t,i,r=!1){super("UpdateExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Qs extends B{constructor(t,i){super("CallExpression"),this.callee=t,this.args=i,se(this,"arguments"),this.callee=t,this.arguments=i}}class nr extends B{constructor(t,i,r=!1){super("MemberExpression"),this.object=t,this.property=i,this.computed=r}}class it extends B{constructor(t,i,r){super("ConditionalExpression"),this.test=t,this.consequent=i,this.alternate=r,se(this,"needsIIFE"),se(this,"consequentStmts"),se(this,"alternateStmts")}}class Xs extends B{constructor(t){super("ArrayExpression"),this.elements=t}}class Zs extends B{constructor(t){super("ObjectExpression"),this.properties=t}}class Js extends B{constructor(t,i){super("Property"),this.key=t,this.value=i,se(this,"kind"),se(this,"method"),se(this,"shorthand"),se(this,"computed"),this.kind="init",this.method=!1,this.shorthand=!1,this.computed=!1}}class ar extends B{constructor(t){super("ArrayPattern"),this.elements=t}}class or extends B{constructor(t,i){super("AssignmentPattern"),this.left=t,this.right=i}}class en extends B{constructor(t,i){super("SwitchExpression"),this.discriminant=t,this.cases=i}}class tn extends B{constructor(t,i){super("SwitchCase"),this.test=t,this.consequent=i}}var rn=Object.defineProperty,sn=(e,t,i)=>t in e?rn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,hr=(e,t,i)=>sn(e,typeof t!="symbol"?t+"":t,i);class nn{constructor(t){hr(this,"tokens"),hr(this,"pos"),this.tokens=t,this.pos=0}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){return this.tokens[this.pos++]}match(t,i=null){const r=this.peek();return!(r.type!==t||i!==null&&r.value!==i)}expect(t,i=null){const r=this.peek();if(r.type!==t)throw new Error(`Expected ${t} but got ${r.type} at ${r.line}:${r.column}`);if(i!==null&&r.value!==i)throw new Error(`Expected '${i}' but got '${r.value}' at ${r.line}:${r.column}`);return this.advance()}skipNewlines(){for(;this.match(m.NEWLINE);)this.advance()}parse(){const t=[];for(;!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.EOF));){const i=this.parseStatement();i&&t.push(i),this.skipNewlines()}return new Ks(t)}parseStatement(){this.skipNewlines();const t=this.peek().line;if(this.match(m.COMMENT))return this.advance(),null;let i;if(this.match(m.KEYWORD,"type"))i=this.parseTypeDefinition();else if(this.match(m.KEYWORD,"var")||this.match(m.KEYWORD,"varip"))i=this.parseVarDeclaration();else if(this.match(m.KEYWORD,"method"))i=this.parseMethodDeclaration();else if(this.isFunctionDeclaration())i=this.parseFunctionDeclaration();else if(this.match(m.KEYWORD,"if"))i=this.parseIfStatement();else if(this.match(m.KEYWORD,"for"))i=this.parseForStatement();else if(this.match(m.KEYWORD,"while"))i=this.parseWhileStatement();else if(this.match(m.KEYWORD,"break")||this.match(m.KEYWORD,"continue")){const r=this.advance().value;i=new fe(new ie(r))}else if(this.isTupleDestructuring())i=this.parseTupleDestructuring();else if(this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER){let r=2;for(;this.peek(r).type===m.IDENTIFIER;)r++;this.peek(r).type===m.OPERATOR&&this.peek(r).value==="="&&(i=this.parseTypedVarDeclaration())}if(!i){const r=this.parseExpression();if(this.match(m.OPERATOR)){const s=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(s)){this.advance(),this.skipNewlines();const n=this.parseExpression();s==="="&&r.type==="Identifier"?i=new Ve([new Oe(r,n)],De.LET):i=new fe(new Ut(s===":="?"=":s,r,n))}else i=new fe(r)}else i=new fe(r)}return i&&(i._line=t),i}isFunctionDeclaration(){const t=this.pos;try{let i=0;if(this.peek(i).type===m.IDENTIFIER&&this.peek(i+1).type===m.IDENTIFIER&&i++,this.peek(i).type!==m.IDENTIFIER||(i++,this.peek(i).type!==m.LPAREN))return!1;i++;let r=1;for(;r>0&&this.peek(i).type!==m.EOF;)this.peek(i).type===m.LPAREN&&r++,this.peek(i).type===m.RPAREN&&r--,i++;for(;this.peek(i).type===m.NEWLINE;)i++;return this.peek(i).type===m.OPERATOR&&this.peek(i).value==="=>"}finally{this.pos=t}}parseTypeDefinition(){this.expect(m.KEYWORD,"type");const t=this.expect(m.IDENTIFIER).value;this.match(m.OPERATOR,"=>")&&this.advance(),this.skipNewlines(),this.expect(m.INDENT);const i=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const r=this.expect(m.IDENTIFIER).value,s=this.expect(m.IDENTIFIER).value;let n=null;this.match(m.OPERATOR,"=")&&(this.advance(),this.skipNewlines(),n=this.parseExpression()),i.push({type:r,name:s,defaultValue:n}),this.skipNewlines()}return this.match(m.DEDENT)&&this.advance(),new zs(t,i)}parseVarDeclaration(){const t=this.advance().value;let i=null,r=null;if(this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.LBRACKET&&this.peek(2).type===m.RBRACKET)i=this.advance().value,this.advance(),i+="[]",this.advance(),r=this.expect(m.IDENTIFIER).value;else if(this.peek().type===m.IDENTIFIER&&(this.peek(1).type===m.IDENTIFIER||this.peek(1).type===m.OPERATOR&&this.peek(1).value==="<")){if(i=this.advance().value,this.match(m.OPERATOR,"<")){for(this.advance(),i+="<";!this.match(m.OPERATOR,">");)if(this.match(m.IDENTIFIER))i+=this.advance().value;else if(this.match(m.COMMA))i+=this.advance().value,this.skipNewlines();else break;this.match(m.OPERATOR,">")&&(i+=">",this.advance())}r=this.expect(m.IDENTIFIER).value}else if(this.peek().type===m.IDENTIFIER)r=this.advance().value;else throw new Error(`Expected identifier after ${t} at ${this.peek().line}:${this.peek().column}`);this.expect(m.OPERATOR,"="),this.skipNewlines();const s=this.parseExpression(),n=new ie(r);return i&&(n.varType=i),new Ve([new Oe(n,s,i)],t)}parseTypedVarDeclaration(){let t=this.advance().value;for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER;)t+=" "+this.advance().value;const i=this.expect(m.IDENTIFIER).value;this.expect(m.OPERATOR,"="),this.skipNewlines();const r=this.parseExpression(),s=new ie(i);return s.varType=t,new Ve([new Oe(s,r,t)],De.LET)}parseFunctionDeclaration(){let t=null;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&(t=this.advance().value);const i=this.expect(m.IDENTIFIER).value;this.expect(m.LPAREN);const r=[];for(;!this.match(m.RPAREN)&&(this.skipNewlines(),!this.match(m.RPAREN));){let a=null;for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&this.peek(2).type!==m.LPAREN;)a&&(a+=" "),a=(a||"")+this.advance().value;const o=this.expect(m.IDENTIFIER).value,h=new ie(o);if(a&&(h.varType=a),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new or(h,u))}else r.push(h);this.match(m.COMMA)&&this.advance()}this.expect(m.RPAREN),this.skipNewlines(),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),n=new ie(i);return t&&(n.returnType=t),new tr(n,r,s,t)}parseMethodDeclaration(){this.expect(m.KEYWORD,"method");let t=null;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&this.peek(2).type===m.LPAREN&&(t=this.advance().value);const i=this.expect(m.IDENTIFIER).value;this.expect(m.LPAREN);const r=[];for(;!this.match(m.RPAREN)&&(this.skipNewlines(),!this.match(m.RPAREN));){let a=null;for(;this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER&&this.peek(2).type!==m.LPAREN;)a&&(a+=" "),a=(a||"")+this.advance().value;const o=this.expect(m.IDENTIFIER).value,h=new ie(o);if(a&&(h.varType=a),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const u=this.parseExpression();r.push(new or(h,u))}else r.push(h);this.match(m.COMMA)&&this.advance()}this.expect(m.RPAREN),this.skipNewlines(),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),n=new ie(i);return t&&(n.returnType=t),n.isMethod=!0,new tr(n,r,s,t)}parseFunctionBody(){const t=[];if(!this.match(m.INDENT)){const i=this.parseExpression();return new Me([new rr(i)])}for(this.advance();!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const i=this.parseStatementOrSequence();Array.isArray(i)?t.push(...i):i&&t.push(i)}if(this.match(m.DEDENT)&&this.advance(),t.length>0){const i=t[t.length-1];i.type==="ExpressionStatement"&&(t[t.length-1]=new rr(i.expression))}return new Me(t)}parseStatementOrSequence(){this.pos;const t=this.peek().line;if(this.match(m.KEYWORD,"if")){const r=this.parseIfStatement();return r&&(r._line=t),r}if(this.match(m.KEYWORD,"for"))return this.parseForStatement();if(this.match(m.KEYWORD,"while"))return this.parseWhileStatement();if(this.match(m.KEYWORD,"break")||this.match(m.KEYWORD,"continue")){const r=this.advance().value;return new fe(new ie(r))}if(this.match(m.KEYWORD,"var")||this.match(m.KEYWORD,"varip"))return this.parseVarDeclaration();if(this.isTupleDestructuring())return this.parseTupleDestructuring();if(this.peek().type===m.IDENTIFIER&&this.peek(1).type===m.IDENTIFIER){let r=2;for(;this.peek(r).type===m.IDENTIFIER;)r++;if(this.peek(r).type===m.OPERATOR&&this.peek(r).value==="=")return this.parseTypedVarDeclaration()}const i=[];for(;;){const r=this.parseExpression();if(this.match(m.OPERATOR)){const s=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(s)){this.advance(),this.skipNewlines();const n=this.parseExpression();if(s==="="&&r.type==="Identifier"?i.push(new Ve([new Oe(r,n)],De.LET)):i.push(new fe(new Ut(s===":="?"=":s,r,n))),this.match(m.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new fe(r));else return new fe(r);break}}else if(this.match(m.COMMA)){i.push(new fe(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new fe(r));else return new fe(r);break}}return i.length>1?i:i.length===1?i[0]:null}parseIfStatement(){this.expect(m.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();let r=null;return this.match(m.KEYWORD,"else")&&(this.advance(),this.skipNewlines(),this.match(m.KEYWORD,"if")?r=this.parseIfStatement():r=this.parseBlock()),new Hs(t,i,r)}parseForStatement(){this.expect(m.KEYWORD,"for");let t=null,i=!1;if(this.match(m.LBRACKET)){this.advance();const r=[];for(;!this.match(m.RBRACKET);)this.skipNewlines(),r.push(new ie(this.expect(m.IDENTIFIER).value)),this.match(m.COMMA)&&this.advance();this.expect(m.RBRACKET),t=new ar(r),i=!0}else{const r=this.expect(m.IDENTIFIER).value;t=new ie(r)}if(this.match(m.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const s=this.parseBlock(),n=new Ve([new Oe(t,r)],De.CONST),a=new ir(n,null,null,s);return a.isForIn=!0,a}else{if(i)throw new Error(`Range-based for loops don't support destructuring at ${this.peek().line}:${this.peek().column}`);this.expect(m.OPERATOR,"=");const r=this.parseExpression();this.expect(m.KEYWORD,"to");const s=this.parseExpression();let n=null;this.match(m.KEYWORD,"by")&&(this.advance(),n=this.parseExpression()),this.skipNewlines();const a=this.parseBlock(),o=new Ve([new Oe(t,r)],De.LET),h=new Le("<=",t,s),u=n?new Ut("+=",t,n):new Ys("++",t);return new ir(o,h,u,a)}}parseWhileStatement(){this.expect(m.KEYWORD,"while");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new Gs(t,i)}parseBlock(){if(!this.match(m.INDENT)){const i=this.parseStatement();return new Me(i?[i]:[])}this.advance();const t=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const i=this.parseStatement();i&&t.push(i)}return this.match(m.DEDENT)&&this.advance(),new Me(t)}isTupleDestructuring(){if(!this.match(m.LBRACKET))return!1;let t=1;for(;;){for(;this.peek(t).type===m.NEWLINE;)t++;if(this.peek(t).type!==m.IDENTIFIER)return!1;for(t++;this.peek(t).type===m.NEWLINE;)t++;if(this.peek(t).type===m.RBRACKET){t++;break}else if(this.peek(t).type===m.COMMA){t++;continue}else return!1}for(;this.peek(t).type===m.NEWLINE;)t++;return this.peek(t).type===m.OPERATOR&&this.peek(t).value==="="}parseTupleDestructuring(){this.expect(m.LBRACKET);const t=[];for(;!this.match(m.RBRACKET);)this.skipNewlines(),t.push(new ie(this.expect(m.IDENTIFIER).value)),this.match(m.COMMA)&&this.advance();this.expect(m.RBRACKET),this.skipNewlines(),this.expect(m.OPERATOR,"="),this.skipNewlines();const i=this.parseExpression();return new Ve([new Oe(new ar(t),i)],De.CONST)}parseExpression(){return this.parseTernary()}parseTernary(){let t=this.parseLogicalOr();if(this.match(m.OPERATOR,"?")){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(m.COLON),this.skipNewlines();const r=this.parseExpression();return new it(t,i,r)}return t}parseLogicalOr(){let t=this.parseLogicalAnd();for(;this.match(m.KEYWORD,"or")||this.match(m.OPERATOR)&&this.peek().value==="||";){this.advance(),this.skipNewlines();const i=this.parseLogicalAnd();t=new Le("||",t,i)}return t}parseLogicalAnd(){let t=this.parseEquality();for(;this.match(m.KEYWORD,"and")||this.match(m.OPERATOR)&&this.peek().value==="&&";){this.advance(),this.skipNewlines();const i=this.parseEquality();t=new Le("&&",t,i)}return t}parseEquality(){let t=this.parseComparison();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["==","!="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseComparison();t=new Le(i,t,r)}return t}parseComparison(){let t=this.parseAdditive();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["<",">","<=",">="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseAdditive();t=new Le(i,t,r)}return t}parseAdditive(){let t=this.parseMultiplicative();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["+","-"].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseMultiplicative();t=new Le(i,t,r)}return t}parseMultiplicative(){let t=this.parseUnary();for(;this.match(m.OPERATOR);){const i=this.peek().value;if(!["*","/","%"].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseUnary();t=new Le(i,t,r)}return t}parseUnary(){if(this.match(m.OPERATOR)){const t=this.peek().value;if(["+","-","!"].includes(t))return this.advance(),this.skipNewlines(),new sr(t,this.parseUnary())}return this.match(m.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new sr("!",this.parseUnary())):this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match(m.OPERATOR,"<")){const i=this.pos;this.advance();let r=1,s=!0;for(;r>0&&!this.match(m.EOF);)if(this.match(m.OPERATOR,"<"))r++,this.advance();else if(this.match(m.OPERATOR,">"))r--,this.advance();else if(this.match(m.IDENTIFIER)||this.match(m.COMMA))this.advance();else{s=!1,this.pos=i;break}if(s&&this.match(m.LPAREN)){t=this.parseCallExpression(t);continue}else{if(s)continue;break}}else if(this.match(m.LPAREN))t=this.parseCallExpression(t);else if(this.match(m.DOT)){this.advance(),this.skipNewlines();const i=this.expect(m.IDENTIFIER).value;t=new nr(t,new ie(i),!1)}else if(this.match(m.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(m.RBRACKET),t=new nr(t,i,!0)}else break;return t}parseCallExpression(t){this.expect(m.LPAREN);const i=[],r=[];for(;!this.match(m.RPAREN)&&(this.skipNewlines(),!this.match(m.RPAREN));){if((this.peek().type===m.IDENTIFIER||this.peek().type===m.KEYWORD)&&this.peek(1).type===m.OPERATOR&&this.peek(1).value==="="){const s=this.advance().value;this.advance(),this.skipNewlines();const n=this.parseExpression();r.push(new Js(new ie(s),n))}else i.push(this.parseExpression());this.match(m.COMMA)&&this.advance(),this.skipNewlines()}return this.expect(m.RPAREN),r.length>0&&i.push(new Zs(r)),new Qs(t,i)}parsePrimary(){const t=this.peek();if(this.match(m.NUMBER)){const i=this.advance();return new Ke(i.value)}if(this.match(m.STRING)){const i=this.advance();return new Ke(i.value)}if(this.match(m.BOOLEAN)){const i=this.advance();return new Ke(i.value)}if(this.match(m.IDENTIFIER)){const i=this.advance();return new ie(i.value)}if(this.match(m.LBRACKET))return this.parseArrayLiteral();if(this.match(m.LPAREN)){this.advance(),this.skipNewlines();const i=this.parseExpression();return this.skipNewlines(),this.expect(m.RPAREN),i}if(this.match(m.KEYWORD,"if"))return this.parseIfExpression();if(this.match(m.KEYWORD,"switch"))return this.parseSwitchExpression();throw new Error(`Unexpected token ${t.type} '${t.value}' at ${t.line}:${t.column}`)}parseArrayLiteral(){this.expect(m.LBRACKET);const t=[];for(;!this.match(m.RBRACKET)&&(this.skipNewlines(),!this.match(m.RBRACKET));)t.push(this.parseExpression()),this.match(m.COMMA)&&this.advance(),this.skipNewlines();return this.expect(m.RBRACKET),new Xs(t)}parseIfExpression(){this.expect(m.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines(),this.expect(m.INDENT);const i=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const a=this.parseStatement();a&&i.push(a)}this.advance();let r=[];if(this.match(m.KEYWORD,"else"))if(this.advance(),this.skipNewlines(),this.match(m.KEYWORD,"if")){const a=this.parseIfExpression();if(this.needsIIFE(i,r)){const o=new it(t,new Me(i),a);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=a,o}else return new it(t,this.getBlockValue(i),a)}else{for(this.expect(m.INDENT);!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const a=this.parseStatement();a&&r.push(a)}this.advance()}if(this.needsIIFE(i,r)){const a=new it(t,new Me(i),new Me(r));return a.needsIIFE=!0,a.consequentStmts=i,a.alternateStmts=r,a}const s=this.getBlockValue(i),n=r.length>0?this.getBlockValue(r):new Ke(null);return new it(t,s,n)}needsIIFE(t,i){if(t.length>1||i.length>1)return!0;const r=s=>s.some(n=>n.type==="IfStatement"||n.type==="ForStatement"||n.type==="WhileStatement"||n.type==="BlockStatement");return r(t)||r(i)}parseSwitchExpression(){this.expect(m.KEYWORD,"switch");const t=this.parseExpression();this.skipNewlines(),this.expect(m.INDENT);const i=[];for(;!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){let r=null;this.match(m.OPERATOR,"=>")||(r=this.parseExpression()),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const s=[];if(this.match(m.INDENT)){for(this.advance();!this.match(m.DEDENT)&&!this.match(m.EOF)&&(this.skipNewlines(),!this.match(m.DEDENT));){const a=this.parseStatement();a&&s.push(a)}this.advance()}else s.push(new fe(this.parseExpression()));const n=this.getBlockValue(s);i.push(new tn(r,n)),this.skipNewlines()}return this.advance(),new en(t,i)}getBlockValue(t){if(t.length===0)return new Ke(null);const i=t[t.length-1];return i.type==="ExpressionStatement"?i.expression:i.type==="VariableDeclaration"&&i.declarations.length>0?i.declarations[0].id:new Ke(null)}}var an=Object.defineProperty,on=(e,t,i)=>t in e?an(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Be=(e,t,i)=>on(e,typeof t!="symbol"?t+"":t,i);class hn{constructor(t={}){Be(this,"indent"),Be(this,"indentStr"),Be(this,"output"),Be(this,"sourceCode"),Be(this,"sourceLines"),Be(this,"lastCommentedLine"),Be(this,"includeSourceComments"),this.indent=0,this.indentStr=t.indentStr||" ",this.output=[],this.sourceCode=t.sourceCode||null,this.sourceLines=this.sourceCode?this.sourceCode.split(`
40
40
  `):[],this.lastCommentedLine=-1,this.includeSourceComments=t.includeSourceComments||!1}generate(t){if(this.output=[],this.indent=0,this.lastCommentedLine=-1,t.type==="Program")this.generateProgram(t);else throw new Error(`Expected Program node, got ${t.type}`);return this.output.join("")}writeSourceComment(t,i=null){if(!this.sourceLines.length)return;const r=i||t,s=[];for(let n=t-1;n<r&&n<this.sourceLines.length;n++)if(n>this.lastCommentedLine){const a=this.sourceLines[n].trim();a&&!a.startsWith("//@")&&!a.startsWith("//")&&s.push(this.sourceLines[n])}if(s.length>0){for(const n of s)this.write(this.indentStr.repeat(this.indent)),this.write("/// "),this.write(n.trimEnd()),this.write(`
41
41
  `);this.lastCommentedLine=Math.max(this.lastCommentedLine,r-1)}}write(t){this.output.push(t)}writeLine(t=""){t?this.output.push(this.indentStr.repeat(this.indent)+t+`
42
42
  `):this.output.push(`
@@ -110,8 +110,8 @@ ${e}
110
110
  `)}else this.write(` else {
111
111
  `),this.indent++,this.write(this.indentStr.repeat(this.indent)),this.write(`return false;
112
112
  `),this.indent--,this.write(this.indentStr.repeat(this.indent)),this.write(`}
113
- `)}generateNestedIfAsExpression(t){if(t.type==="IfStatement"){if(this.write("("),this.generateExpression(t.test),this.write(" ? "),t.consequent.type==="BlockStatement"&&t.consequent.body.length>0){const i=t.consequent.body[t.consequent.body.length-1];i.type==="ExpressionStatement"?this.generateExpression(i.expression):i.type==="IfStatement"&&this.generateNestedIfAsExpression(i)}if(this.write(" : "),t.alternate)if(t.alternate.type==="IfStatement")this.generateNestedIfAsExpression(t.alternate);else if(t.alternate.type==="BlockStatement"&&t.alternate.body.length>0){const i=t.alternate.body[t.alternate.body.length-1];i.type==="ExpressionStatement"&&this.generateExpression(i.expression)}else this.write("false");else this.write("false");this.write(")")}}generateArrayExpression(t){this.write("[");for(let i=0;i<t.elements.length;i++)this.generateExpression(t.elements[i]),i<t.elements.length-1&&this.write(", ");this.write("]")}generateObjectExpression(t){this.write("{");for(let i=0;i<t.properties.length;i++){const r=t.properties[i];r.key.type==="Identifier"?this.write(r.key.name):this.generateExpression(r.key),this.write(": "),this.generateExpression(r.value),i<t.properties.length-1&&this.write(", ")}this.write("}")}generateSwitchExpression(t){this.write("(");for(let i=0;i<t.cases.length;i++){const r=t.cases[i];r.test?(this.generateExpression(t.discriminant),this.write(" == "),this.generateExpression(r.test),this.write(" ? "),this.generateExpression(r.consequent),this.write(" : ")):this.generateExpression(r.consequent)}t.cases.some(i=>!i.test)||this.write("undefined"),this.write(")")}generateSequenceExpression(t){this.write("(");for(let i=0;i<t.expressions.length;i++)this.generateExpression(t.expressions[i]),i<t.expressions.length-1&&this.write(", ");this.write(")")}needsParentheses(t){return!1}}function hr(e){const t=/^\s*\/\/\s*@version\s*=\s*(\d+)\s*$/im,i=e.match(t);return i&&i[1]?parseInt(i[1],10):null}function hn(e,t={}){const i=hr(e);if(i===null)return{success:!1,version:null,error:"Pine Script version not found. Please add //@version=X comment to your script."};if(i<5)return{success:!1,version:i,error:`Pine Script version ${i} is not supported. Only version 5 and above are supported.`};try{const r=new $s(e).tokenize(),s=new sn(r).parse(),n={...t,sourceCode:e},a=new on(n).generate(s);return{success:!0,version:i,code:a,ast:s,tokens:r}}catch(r){return{success:!1,version:i,error:r.message,stack:r.stack}}}function un(e){if(typeof e=="function")return e.toString();{const t=hr(e);if(t===null)return e;if(t>=5){const i=hn(e);if(i.success)return i.code;throw new Error(`Failed to transpile Pine Script version ${t}: ${i.error}`)}else throw new Error(`Unsupported Pine Script version ${t}. Only version 5 and above are supported.`)}}function cn(e,t={debug:!1,ln:!1}){typeof t=="boolean"&&(t={debug:t,ln:!0});const{debug:i}=t;let r=un(e);r=Ss(r);const s=i?r.split(`
114
- `):[],n=Fi(r,{ecmaVersion:"latest",sourceType:"module",locations:i});Es(n),bs(n),ws(n);const a=new ms;Ns(n,a);const o=Is(n,a)||"";Os(n,a,o,t,s),Vs(n);const h=hs||Mt||void 0,u=Object.assign({},h,{LineComment(f,g){g.write("//"+f.value)}}),l=Hi(n,{generator:u,comments:i});return new Function("",`var _r = ${l}
115
- ; return _r;`)(this)}function ln(e){return t=>new F(t.array.map(i=>Math.abs(i)),t.type,e)}function pn(e){return t=>{let i=0,r=0;for(const s of t.array){const n=Number(s);isNaN(n)||(r++,i+=(n-i)/r)}return r===0?NaN:e.precision(i)}}function fn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length-1;for(;s<=n;){const a=Math.floor((s+n)/2),o=r[a];if(o===i)return a;o<i?s=a+1:n=a-1}return-1}}function mn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length;for(;s<n;){const a=Math.floor((s+n)/2);r[a]<i?s=a+1:n=a}return s<r.length&&r[s]===i?s:s-1}}function dn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length;for(;s<n;){const a=Math.floor((s+n)/2);r[a]<=i?s=a+1:n=a}return s>0&&r[s-1]===i?s-1:s}}function gn(e){return t=>{t.array.length=0}}function xn(e){return(t,i)=>(t.array.push(...i.array),t)}function yn(e){return t=>new F([...t.array],t.type,e)}function wn(e){return(t,i,r=!0)=>{const s=t.array,n=i.array;if(s.length!==n.length)return NaN;let a=0,o=0,h=0;const u=[];for(let x=0;x<s.length;x++){const y=Number(s[x]),w=Number(n[x]);!isNaN(y)&&y!==null&&y!==void 0&&!isNaN(w)&&w!==null&&w!==void 0&&(a+=y,o+=w,h++,u.push(x))}if(h===0)return NaN;const l=a/h,f=o/h;let g=0;for(const x of u){const y=Number(s[x]),w=Number(n[x]);g+=(y-l)*(w-f)}const p=r?h:h-1;return p<=0?NaN:e.precision(g/p)}}function bn(e){return t=>t.array.every(i=>!isNaN(i)&&i)}function vn(e){if(e.every(t=>typeof t=="number"))return e.every(t=>(t|0)===t)?W.int:W.float;if(e.every(t=>typeof t=="string"))return W.string;if(e.every(t=>typeof t=="boolean"))return W.bool;throw new Error("Cannot infer type from values")}function ge(e){if(typeof e=="number")return(e|0)===e?W.int:W.float;if(typeof e=="string")return W.string;if(typeof e=="boolean")return W.bool;throw new Error("Cannot infer type from value")}function rt(e,t){switch(t){case W.int:return typeof e=="number"&&(e|0)===e||isNaN(e);case W.float:return typeof e=="number"||isNaN(e);case W.string:return typeof e=="string";case W.bool:return typeof e=="boolean"}return!1}function _n(e){return(t,i,r=0,s)=>{const n=t.array.length,a=s!==void 0?Math.min(s,n):n;for(let o=r;o<a;o++){if(!rt(i,t.type))throw new Error(`Cannot call 'array.fill' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array[o]=e.precision(i)}}}function Sn(e){return t=>t.array.length>0?t.array[0]:e.NA}function En(e){return(t,i)=>t.array[i]}function Nn(e){return(t,i)=>t.array.includes(i)}function Cn(e){return(t,i)=>t.array.indexOf(i)}function kn(e){return(t,i,r)=>{if(!rt(r,t.type))throw new Error(`Cannot call 'array.insert' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${t.type}' is expected.`);t.array.splice(i,0,r)}}function In(e){return(t,i=",")=>t.array.join(i)}function An(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function Pn(e){return(t,i)=>t.array.lastIndexOf(i)}function Tn(e){return(t,i=0)=>[...t.array].sort((r,s)=>s-r)[i]??e.NA}function Rn(e){return t=>{if(t.array.length===0)return NaN;const i=[...t.array].sort((s,n)=>typeof s=="number"&&typeof n=="number"?s-n:0),r=Math.floor(i.length/2);return i.length%2!==0?i[r]:(i[r-1]+i[r])/2}}function Dn(e){return(t,i=0)=>[...t.array].sort((r,s)=>r-s)[i]??e.NA}function Vn(e){return t=>{if(t.array.length===0)return NaN;const i=new Map;let r=0;for(const n of t.array){const a=(i.get(n)||0)+1;i.set(n,a),a>r&&(r=a)}const s=[];for(const[n,a]of i)a===r&&s.push(n);return s.sort((n,a)=>typeof n=="number"&&typeof a=="number"?n-a:typeof n=="string"&&typeof a=="string"?n<a?-1:n>a?1:0:0),s[0]}}function On(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const s=[];for(const h of r){const u=Number(h);if(isNaN(u)||u===null||u===void 0)return NaN;s.push(u)}s.sort((h,u)=>h-u),i<0&&(i=0),i>100&&(i=100);const n=i/100*s.length-.5;if(n<=0)return e.precision(s[0]);if(n>=s.length-1)return e.precision(s[s.length-1]);const a=Math.floor(n),o=n-a;return e.precision(s[a]*(1-o)+s[a+1]*o)}}function Mn(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const s=[];for(const o of r){const h=Number(o);!isNaN(h)&&h!==null&&h!==void 0&&s.push(h)}if(s.length===0)return NaN;s.sort((o,h)=>o-h),i<0&&(i=0),i>100&&(i=100);const n=r.length,a=Math.ceil(i/100*n);return a<=0?s[0]:a>s.length?NaN:s[a-1]}}function Ln(e){return(t,i)=>{if(t.array.length===0)return NaN;const r=Math.floor(i);if(r<0||r>=t.array.length)return NaN;const s=Number(t.array[r]);if(isNaN(s)||s===null||s===void 0)return NaN;let n=0;for(const o of t.array){const h=Number(o);!isNaN(h)&&h!==null&&h!==void 0&&h<s&&n++}const a=t.array.length-1;return a<=0?NaN:n/a*100}}function Bn(e){return t=>t.array.pop()}function Fn(e){return(t,i)=>{if(!rt(i,t.type))throw new Error(`Cannot call 'array.push' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array.push(e.precision(i))}}function jn(e){return t=>e.precision(e.pine.array.max(t)-e.pine.array.min(t))}function $n(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function Wn(e){return t=>{t.array.reverse()}}function qn(e){return(t,i,r)=>{if(!rt(r,t.type))throw new Error(`Cannot call 'array.set' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${t.type}' is expected.`);t.array[i]=e.precision(r)}}function Un(e){return t=>t.array.shift()}function Kn(e){return t=>t.array.length}function zn(e){return(t,i,r)=>{const s=r!==void 0?r:void 0;return new F(t.array.slice(i,s),t.type,e)}}function Hn(e){return t=>t.array.some(i=>!isNaN(i)&&i)}var ze=(e=>(e[e.ascending=1]="ascending",e[e.descending=0]="descending",e))(ze||{}),ur=(e=>(e.AED="AED",e.ARS="ARS",e.AUD="AUD",e.BDT="BDT",e.BHD="BHD",e.BRL="BRL",e.BTC="BTC",e.CAD="CAD",e.CHF="CHF",e.CLP="CLP",e.CNY="CNY",e.COP="COP",e.CZK="CZK",e.DKK="DKK",e.EGP="EGP",e.ETH="ETH",e.EUR="EUR",e.GBP="GBP",e.HKD="HKD",e.HUF="HUF",e.IDR="IDR",e.ILS="ILS",e.INR="INR",e.ISK="ISK",e.JPY="JPY",e.KES="KES",e.KRW="KRW",e.KWD="KWD",e.LKR="LKR",e.MAD="MAD",e.MXN="MXN",e.MYR="MYR",e.NGN="NGN",e.NOK="NOK",e.NONE="NONE",e.NZD="NZD",e.PEN="PEN",e.PHP="PHP",e.PKR="PKR",e.PLN="PLN",e.QAR="QAR",e.RON="RON",e.RSD="RSD",e.RUB="RUB",e.SAR="SAR",e.SEK="SEK",e.SGD="SGD",e.THB="THB",e.TND="TND",e.TRY="TRY",e.TWD="TWD",e.USD="USD",e.USDT="USDT",e.VES="VES",e.VND="VND",e.ZAR="ZAR",e))(ur||{}),cr=(e=>(e[e.sunday=1]="sunday",e[e.monday=2]="monday",e[e.tuesday=3]="tuesday",e[e.wednesday=4]="wednesday",e[e.thursday=5]="thursday",e[e.friday=6]="friday",e[e.saturday=7]="saturday",e))(cr||{}),lr=(e=>(e.all="all",e.data_window="data_window",e.none="none",e.pane="pane",e.price_scale="price_scale",e.status_line="status_line",e))(lr||{});const Gn={order:ze,currency:ur,dayofweek:cr,display:lr};function Yn(e){return(t,i=ze.ascending)=>{t.array.sort((r,s)=>{let n=isNaN(r)?1/0:r,a=isNaN(s)?1/0:s;return i===ze.ascending?n-a:a-n})}}function Qn(e){return(t,i=ze.ascending)=>{const r=t.array.map((s,n)=>n);return r.sort((s,n)=>{const a=isNaN(t.array[s])?1/0:t.array[s],o=isNaN(t.array[n])?1/0:t.array[n];return i===ze.ascending?a-o:o-a}),new F(r,W.int,e)}}function Xn(e){return t=>{const i=e.array.avg(t),r=e.array.stdev(t);return isNaN(r)?new F(t.array.map(()=>NaN),W.int,e):r===0?new F(t.array.map(()=>1),W.int,e):new F(t.array.map(s=>(s-i)/r),W.int,e)}}function Zn(e){return(t,i=!0)=>{const r=t.array,s=r.length;if(s===0)return NaN;let n=0,a=0,o=0;for(let l=0;l<s;l++){const f=Number(r[l]);!isNaN(f)&&f!==null&&f!==void 0&&(n+=f,a+=f*f,o++)}if(o===0)return NaN;const h=n/o;let u=a/o-h*h;return u<0?NaN:(!i&&o>1&&(u=u*o/(o-1)),!i&&o===1?0:e.precision(Math.sqrt(u)))}}function Jn(e){return t=>e.precision(t.array.reduce((i,r)=>{const s=Number(r);return isNaN(s)?i:i+s},0))}function ea(e){return(t,i)=>{if(!rt(i,t.type))throw new Error(`Cannot call 'array.unshift' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array.unshift(e.precision(i))}}function ta(e){return(t,i=!0)=>{let r=0,s=0;for(const h of t.array){const u=Number(h);!isNaN(u)&&u!==null&&u!==void 0&&(r+=u,s++)}if(s===0)return NaN;const n=r/s;let a=0;for(const h of t.array){const u=Number(h);!isNaN(u)&&u!==null&&u!==void 0&&(a+=(u-n)*(u-n))}const o=i?s:s-1;return o<=0?NaN:e.precision(a/o)}}var ia=Object.defineProperty,ra=(e,t,i)=>t in e?ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,R=(e,t,i)=>ra(e,typeof t!="symbol"?t+"":t,i),W=(e=>(e.any="",e.box="box",e.bool="bool",e.color="color",e.float="float",e.int="int",e.label="label",e.line="line",e.linefill="linefill",e.string="string",e.table="table",e))(W||{});class F{constructor(t,i,r){this.array=t,this.type=i,this.context=r,R(this,"_abs"),R(this,"_avg"),R(this,"_binary_search"),R(this,"_binary_search_leftmost"),R(this,"_binary_search_rightmost"),R(this,"_clear"),R(this,"_concat"),R(this,"_copy"),R(this,"_covariance"),R(this,"_every"),R(this,"_fill"),R(this,"_first"),R(this,"_get"),R(this,"_includes"),R(this,"_indexof"),R(this,"_insert"),R(this,"_join"),R(this,"_last"),R(this,"_lastindexof"),R(this,"_max"),R(this,"_median"),R(this,"_min"),R(this,"_mode"),R(this,"_percentile_linear_interpolation"),R(this,"_percentile_nearest_rank"),R(this,"_percentrank"),R(this,"_pop"),R(this,"_push"),R(this,"_range"),R(this,"_remove"),R(this,"_reverse"),R(this,"_set"),R(this,"_shift"),R(this,"_size"),R(this,"_slice"),R(this,"_some"),R(this,"_sort"),R(this,"_sort_indices"),R(this,"_standardize"),R(this,"_stdev"),R(this,"_sum"),R(this,"_unshift"),R(this,"_variance"),this._abs=ln(this.context),this._avg=pn(this.context),this._binary_search=fn(this.context),this._binary_search_leftmost=mn(this.context),this._binary_search_rightmost=dn(this.context),this._clear=gn(this.context),this._concat=xn(this.context),this._copy=yn(this.context),this._covariance=wn(this.context),this._every=bn(this.context),this._fill=_n(this.context),this._first=Sn(this.context),this._get=En(this.context),this._includes=Nn(this.context),this._indexof=Cn(this.context),this._insert=kn(this.context),this._join=In(this.context),this._last=An(this.context),this._lastindexof=Pn(this.context),this._max=Tn(this.context),this._median=Rn(this.context),this._min=Dn(this.context),this._mode=Vn(this.context),this._percentile_linear_interpolation=On(this.context),this._percentile_nearest_rank=Mn(this.context),this._percentrank=Ln(this.context),this._pop=Bn(this.context),this._push=Fn(this.context),this._range=jn(this.context),this._remove=$n(this.context),this._reverse=Wn(this.context),this._set=qn(this.context),this._shift=Un(this.context),this._size=Kn(this.context),this._slice=zn(this.context),this._some=Hn(this.context),this._sort=Yn(this.context),this._sort_indices=Qn(this.context),this._standardize=Xn(this.context),this._stdev=Zn(this.context),this._sum=Jn(this.context),this._unshift=ea(this.context),this._variance=ta(this.context)}toString(){return"["+this.array.toString().replace(/,/g,", ")+"]"}abs(...t){return this._abs(this,...t)}avg(...t){return this._avg(this,...t)}binary_search(...t){return this._binary_search(this,...t)}binary_search_leftmost(...t){return this._binary_search_leftmost(this,...t)}binary_search_rightmost(...t){return this._binary_search_rightmost(this,...t)}clear(...t){return this._clear(this,...t)}concat(...t){return this._concat(this,...t)}copy(...t){return this._copy(this,...t)}covariance(...t){return this._covariance(this,...t)}every(...t){return this._every(this,...t)}fill(...t){return this._fill(this,...t)}first(...t){return this._first(this,...t)}get(...t){return this._get(this,...t)}includes(...t){return this._includes(this,...t)}indexof(...t){return this._indexof(this,...t)}insert(...t){return this._insert(this,...t)}join(...t){return this._join(this,...t)}last(...t){return this._last(this,...t)}lastindexof(...t){return this._lastindexof(this,...t)}max(...t){return this._max(this,...t)}median(...t){return this._median(this,...t)}min(...t){return this._min(this,...t)}mode(...t){return this._mode(this,...t)}percentile_linear_interpolation(...t){return this._percentile_linear_interpolation(this,...t)}percentile_nearest_rank(...t){return this._percentile_nearest_rank(this,...t)}percentrank(...t){return this._percentrank(this,...t)}pop(...t){return this._pop(this,...t)}push(...t){return this._push(this,...t)}range(...t){return this._range(this,...t)}remove(...t){return this._remove(this,...t)}reverse(...t){return this._reverse(this,...t)}set(...t){return this._set(this,...t)}shift(...t){return this._shift(this,...t)}size(...t){return this._size(this,...t)}slice(...t){return this._slice(this,...t)}some(...t){return this._some(this,...t)}sort(...t){return this._sort(this,...t)}sort_indices(...t){return this._sort_indices(this,...t)}standardize(...t){return this._standardize(this,...t)}stdev(...t){return this._stdev(this,...t)}sum(...t){return this._sum(this,...t)}unshift(...t){return this._unshift(this,...t)}variance(...t){return this._variance(this,...t)}}function sa(e){return(...t)=>new F([...t],vn(t),e)}function na(e){return(t,i)=>new F(Array(t).fill(e.precision(i||0)),ge(i||0),e)}function aa(e){return(t,i=!1)=>new F(Array(t).fill(i),W.bool,e)}function oa(e){return(t,i=NaN)=>new F(Array(t).fill(e.precision(i)),W.float,e)}function ha(e){return(t,i=0)=>new F(Array(t).fill(e.precision(i)),W.int,e)}function ua(e){return(t,i="")=>new F(Array(t).fill(i),W.string,e)}class d{constructor(t,i=0){this.data=t,this.offset=i}get(t){const i=this.data.length-1-(this.offset+t);return i<0||i>=this.data.length?NaN:this.data[i]}set(t,i){const r=this.data.length-1-(this.offset+t);r>=0&&r<this.data.length&&(this.data[r]=i)}get length(){return this.data.length}toArray(){return this.data}static from(t){return t instanceof d?t:Array.isArray(t)?new d(t):new d([t])}}function ca(e){return(t,i=0)=>d.from(t).get(i)}class la{constructor(t){this.context=t,this.abs=(i,...r)=>i.abs(...r),this.avg=(i,...r)=>i.avg(...r),this.binary_search=(i,...r)=>i.binary_search(...r),this.binary_search_leftmost=(i,...r)=>i.binary_search_leftmost(...r),this.binary_search_rightmost=(i,...r)=>i.binary_search_rightmost(...r),this.clear=(i,...r)=>i.clear(...r),this.concat=(i,...r)=>i.concat(...r),this.copy=(i,...r)=>i.copy(...r),this.covariance=(i,...r)=>i.covariance(...r),this.every=(i,...r)=>i.every(...r),this.fill=(i,...r)=>i.fill(...r),this.first=(i,...r)=>i.first(...r),this.from=sa(t),this.get=(i,...r)=>i.get(...r),this.includes=(i,...r)=>i.includes(...r),this.indexof=(i,...r)=>i.indexof(...r),this.insert=(i,...r)=>i.insert(...r),this.join=(i,...r)=>i.join(...r),this.last=(i,...r)=>i.last(...r),this.lastindexof=(i,...r)=>i.lastindexof(...r),this.max=(i,...r)=>i.max(...r),this.median=(i,...r)=>i.median(...r),this.min=(i,...r)=>i.min(...r),this.mode=(i,...r)=>i.mode(...r),this.new=na(t),this.new_bool=aa(t),this.new_float=oa(t),this.new_int=ha(t),this.new_string=ua(t),this.param=ca(),this.percentile_linear_interpolation=(i,...r)=>i.percentile_linear_interpolation(...r),this.percentile_nearest_rank=(i,...r)=>i.percentile_nearest_rank(...r),this.percentrank=(i,...r)=>i.percentrank(...r),this.pop=(i,...r)=>i.pop(...r),this.push=(i,...r)=>i.push(...r),this.range=(i,...r)=>i.range(...r),this.remove=(i,...r)=>i.remove(...r),this.reverse=(i,...r)=>i.reverse(...r),this.set=(i,...r)=>i.set(...r),this.shift=(i,...r)=>i.shift(...r),this.size=(i,...r)=>i.size(...r),this.slice=(i,...r)=>i.slice(...r),this.some=(i,...r)=>i.some(...r),this.sort=(i,...r)=>i.sort(...r),this.sort_indices=(i,...r)=>i.sort_indices(...r),this.standardize=(i,...r)=>i.standardize(...r),this.stdev=(i,...r)=>i.stdev(...r),this.sum=(i,...r)=>i.sum(...r),this.unshift=(i,...r)=>i.unshift(...r),this.variance=(i,...r)=>i.variance(...r)}}function pa(e){return t=>{t.map.clear()}}function fa(e){return(t,i)=>t.map.has(i)}function ma(e){return t=>{const i=new pr(e);return i.map=new Map(t.map),i}}function da(e){return(t,i)=>{const r=t.map.get(i);return r===void 0?NaN:r}}function ga(e){return t=>{const i=Array.from(t.map.keys()),r=ge(i[0]);return new F(i,r,e)}}function xa(e){return(t,i,r)=>{const s=t.map.get(i);return t.map.set(i,r),s===void 0?NaN:s}}function ya(e){return(t,i)=>{for(const[r,s]of i.map)t.map.set(r,s)}}function wa(e){return(t,i)=>{const r=t.map.get(i);return t.map.delete(i)?r:NaN}}function ba(e){return t=>t.map.size}function va(e){return t=>{const i=Array.from(t.map.values()),r=ge(i[0]);return new F(i,r,e)}}var _a=Object.defineProperty,Sa=(e,t,i)=>t in e?_a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,xe=(e,t,i)=>Sa(e,typeof t!="symbol"?t+"":t,i);class pr{constructor(t){this.context=t,xe(this,"map"),xe(this,"_clear"),xe(this,"_contains"),xe(this,"_copy"),xe(this,"_get"),xe(this,"_keys"),xe(this,"_put"),xe(this,"_put_all"),xe(this,"_remove"),xe(this,"_size"),xe(this,"_values"),this.map=new Map,this._clear=pa(this.context),this._contains=fa(this.context),this._copy=ma(this.context),this._get=da(this.context),this._keys=ga(this.context),this._put=xa(this.context),this._put_all=ya(this.context),this._remove=wa(this.context),this._size=ba(this.context),this._values=va(this.context)}toString(){return`PineMapObject(${this.map.size})`}clear(...t){return this._clear(this,...t)}contains(...t){return this._contains(this,...t)}copy(...t){return this._copy(this,...t)}get(...t){return this._get(this,...t)}keys(...t){return this._keys(this,...t)}put(...t){return this._put(this,...t)}put_all(...t){return this._put_all(this,...t)}remove(...t){return this._remove(this,...t)}size(...t){return this._size(this,...t)}values(...t){return this._values(this,...t)}}function Ea(e){return()=>new pr(e)}function Na(e){return(t,i=0)=>d.from(t).get(i)}class Ca{constructor(t){this.context=t,this.clear=(i,...r)=>i.clear(...r),this.contains=(i,...r)=>i.contains(...r),this.copy=(i,...r)=>i.copy(...r),this.get=(i,...r)=>i.get(...r),this.keys=(i,...r)=>i.keys(...r),this.new=Ea(t),this.param=Na(),this.put=(i,...r)=>i.put(...r),this.put_all=(i,...r)=>i.put_all(...r),this.remove=(i,...r)=>i.remove(...r),this.size=(i,...r)=>i.size(...r),this.values=(i,...r)=>i.values(...r)}}function ka(e){return(t,i,r)=>{const s=t.matrix.length;let n=[];if(r&&(r instanceof F?n=r.array:Array.isArray(r)?n=r:n=[r]),s===0){for(let h=0;h<n.length;h++){let u=n[h];u instanceof d&&(u=u.get(0)),t.matrix.push([u])}return}const a=t.matrix[0].length,o=i!==void 0?i:a;for(let h=0;h<s;h++){let u=h<n.length?n[h]:NaN;u instanceof d&&(u=u.get(0)),t.matrix[h].splice(o,0,u)}}}function Ia(e){return(t,i,r)=>{const s=t.matrix.length;let n=[];if(r)if(r instanceof F)n=r.array;else if(Array.isArray(r))n=r;else if(r instanceof d){const u=r.get(0);Array.isArray(u)?n=u:n=[u]}else n=[r];const a=s>0?t.matrix[0].length:n.length,o=i!==void 0?i:s,h=[];for(let u=0;u<a;u++)if(u<n.length){let l=n[u];l instanceof d&&(l=l.get(0)),h.push(l)}else h.push(NaN);t.matrix.splice(o,0,h)}}function Aa(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;if(r===0)return NaN;let s=0,n=0;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(s+=h,n++)}return n===0?NaN:s/n}}function Pa(e){return(t,i)=>{const r=t.matrix.length,s=[];for(let a=0;a<r;a++)s.push(t.matrix[a][i]);const n=ge(s[0]);return new F(s,n,e)}}function Ta(e){return t=>t.matrix.length===0?0:t.matrix[0].length}function Ra(e){return(t,i)=>{const r=t.matrix.length,s=i.matrix.length;if(r===0){for(let o=0;o<s;o++)t.matrix.push([...i.matrix[o]]);return}const n=t.matrix[0].length,a=s>0?i.matrix[0].length:0;if(n!==a&&s>0){console.error(`matrix.concat: Column count mismatch ${n} vs ${a}`);return}for(let o=0;o<s;o++)t.matrix.push([...i.matrix[o]])}}function Da(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0,s=new M(i,r,NaN,e);return s.matrix=t.matrix.map(n=>[...n]),s}}function Va(e){const t=e.length;if(t===0)return 0;if(t===1)return e[0][0];if(t===2)return e[0][0]*e[1][1]-e[0][1]*e[1][0];const i=e.map(s=>[...s]);let r=1;for(let s=0;s<t;s++){let n=s;for(;n<t&&i[n][s]===0;)n++;if(n===t)return 0;n!==s&&([i[s],i[n]]=[i[n],i[s]],r*=-1),r*=i[s][s];for(let a=s+1;a<t;a++){const o=i[a][s]/i[s][s];for(let h=s;h<t;h++)i[a][h]-=o*i[s][h]}}return r}function Oa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i!==r?NaN:Va(t.matrix)}}function Ma(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new M(0,0,NaN,e);const s=t.matrix[0].length,n=new M(r,s,NaN,e);if(i instanceof M)for(let a=0;a<r;a++)for(let o=0;o<s;o++){const h=t.matrix[a][o],u=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;n.matrix[a][o]=h-u}else{const a=i;for(let o=0;o<r;o++)for(let h=0;h<s;h++)n.matrix[o][h]=t.matrix[o][h]-a}return n}}function La(e){const t=e.length;if(t!==2)return Array(t).fill(NaN);const i=e[0][0],r=e[0][1],s=e[1][0],n=e[1][1],a=i+n,o=i*n-r*s,h=a*a-4*o;if(h<0)return[NaN,NaN];const u=(a+Math.sqrt(h))/2,l=(a-Math.sqrt(h))/2;return[u,l]}function Ba(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r){const a=ge(t.matrix[0][0]);return new F([],a,e)}const s=La(t.matrix),n=ge(s[0]);return new F(s,n,e)}}function Fa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new M(0,0,NaN,e);const s=new M(i,r,0,e);for(let n=0;n<i;n++)s.matrix[n][n]=1;return s}}function ja(e){return t=>{const i=t.matrix.length;return i===0?0:i*t.matrix[0].length}}function $a(e){return(t,i,r,s,n,a)=>{const o=t.matrix.length;if(o===0)return;const h=t.matrix[0].length,u=r!==void 0?r:0,l=s!==void 0?s:o,f=n!==void 0?n:0,g=a!==void 0?a:h;for(let p=u;p<l&&!(p>=o);p++)for(let x=f;x<g&&!(x>=h);x++)t.matrix[p][x]=i}}function Wa(e){return(t,i,r)=>{if(!t.matrix[i])return NaN;const s=t.matrix[i][r];return s===void 0?NaN:s}}function qa(e){if(e.length!==2)return e.map(i=>i.map(()=>NaN));const t=e[0][0]*e[1][1]-e[0][1]*e[1][0];return t===0?[[NaN,NaN],[NaN,NaN]]:[[e[1][1]/t,-e[0][1]/t],[-e[1][0]/t,e[0][0]/t]]}function Ua(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new M(i,r,NaN,e);const s=qa(t.matrix),n=new M(i,r,NaN,e);return n.matrix=s,n}}function Ka(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s+n!==i-1&&t.matrix[s][n]!==0)return!1;return!0}}function za(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(t.matrix[n][s]!==-t.matrix[s][n])return!1;return!0}}function Ha(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let s=0;s<i;s++)for(let n=0;n<r;n++){const a=t.matrix[s][n];if(a!==0&&a!==1)return!1}return!0}}function Ga(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s!==n&&t.matrix[s][n]!==0)return!1;return!0}}function Ya(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s===n){if(t.matrix[s][n]!==1)return!1}else if(t.matrix[s][n]!==0)return!1;return!0}}function Qa(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;return i===r}}function Xa(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let s=0;s<i;s++){let n=0;for(let a=0;a<r;a++){const o=t.matrix[s][a];if(o<0)return!1;n+=o}if(Math.abs(n-1)>1e-10)return!1}return!0}}function Za(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<s;n++)if(t.matrix[s][n]!==t.matrix[n][s])return!1;return!0}}function Ja(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;let s=!0,n=!0;for(let a=0;a<i;a++)for(let o=0;o<r;o++)a>o&&t.matrix[a][o]!==0&&(s=!1),a<o&&t.matrix[a][o]!==0&&(n=!1);return s||n}}function eo(e){return t=>{const i=t.matrix.length;if(i===0)return!0;const r=t.matrix[0].length;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(t.matrix[s][n]!==0)return!1;return!0}}function to(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0,n=i.matrix.length,a=n>0?i.matrix[0].length:0,o=r*n,h=s*a,u=new M(o,h,NaN,e);for(let l=0;l<r;l++)for(let f=0;f<s;f++){const g=t.matrix[l][f];for(let p=0;p<n;p++)for(let x=0;x<a;x++){const y=i.matrix[p][x];u.matrix[l*n+p][f*a+x]=g*y}}return u}}function io(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let s=-1/0,n=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(h>s&&(s=h),n=!0)}return n?s:NaN}}function ro(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,s=[];for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||s.push(h)}if(s.length===0)return NaN;s.sort((a,o)=>a-o);const n=Math.floor(s.length/2);return s.length%2!==0?s[n]:(s[n-1]+s[n])/2}}function so(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let s=1/0,n=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(h<s&&(s=h),n=!0)}return n?s:NaN}}function no(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,s=new Map;let n=0,a=NaN;for(let o=0;o<i;o++)for(let h=0;h<r;h++){const u=t.matrix[o][h];if(!isNaN(u)){const l=(s.get(u)||0)+1;s.set(u,l),l>n?(n=l,a=u):l===n&&u<a&&(a=u)}}return a}}function ao(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0;if(i instanceof M){const n=i.matrix.length,a=n>0?i.matrix[0].length:0;if(s!==n)return new M(0,0,NaN,e);const o=new M(r,a,0,e);for(let h=0;h<r;h++)for(let u=0;u<a;u++){let l=0;for(let f=0;f<s;f++)l+=t.matrix[h][f]*i.matrix[f][u];o.matrix[h][u]=l}return o}else if(i instanceof F||Array.isArray(i.array||i)){const n=i.array||i;if(s!==n.length)return new M(0,0,NaN,e);const a=new M(r,1,0,e);for(let o=0;o<r;o++){let h=0;for(let u=0;u<s;u++)h+=t.matrix[o][u]*n[u];a.matrix[o][0]=h}return a}else{const n=i,a=new M(r,s,NaN,e);for(let o=0;o<r;o++)for(let h=0;h<s;h++)a.matrix[o][h]=t.matrix[o][h]*n;return a}}}function oo(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i===r?new M(i,r,NaN,e):new M(r,i,NaN,e)}}function ho(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0;if(r!==s)return new M(0,0,NaN,e);let n=new M(r,s,0,e);for(let h=0;h<r;h++)n.matrix[h][h]=1;let a=new M(r,s,NaN,e);for(let h=0;h<r;h++)a.matrix[h]=[...t.matrix[h]];let o=Math.floor(i);if(o<0)return new M(r,s,NaN,e);for(;o>0;){if(o%2===1){const u=new M(r,s,0,e);for(let l=0;l<r;l++)for(let f=0;f<s;f++){let g=0;for(let p=0;p<r;p++)g+=n.matrix[l][p]*a.matrix[p][f];u.matrix[l][f]=g}n=u}const h=new M(r,s,0,e);for(let u=0;u<r;u++)for(let l=0;l<s;l++){let f=0;for(let g=0;g<r;g++)f+=a.matrix[u][g]*a.matrix[g][l];h.matrix[u][l]=f}a=h,o=Math.floor(o/2)}return n}}function uo(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,s=t.matrix.map(a=>[...a]);let n=0;for(let a=0;a<r&&n<i;a++){let o=n;for(;o<i&&Math.abs(s[o][a])<1e-10;)o++;if(o<i){[s[n],s[o]]=[s[o],s[n]];const h=s[n][a];for(let u=a;u<r;u++)s[n][u]/=h;for(let u=0;u<i;u++)if(u!==n){const l=s[u][a];for(let f=a;f<r;f++)s[u][f]-=l*s[n][f]}n++}}return n}}function co(e){return(t,i)=>{const r=t.matrix.length;if(r===0){const a=ge(t.matrix[0][0]);return new F([],a,e)}const s=[];for(let a=0;a<r;a++){const o=t.matrix[a].splice(i,1);s.push(o[0])}const n=ge(s[0]);return new F(s,n,e)}}function lo(e){return(t,i)=>{const r=t.matrix.splice(i,1),s=ge(r[0][0]);return new F(r[0]||[],s,e)}}function po(e){return(t,i,r)=>{const s=t.matrix.length,n=s>0?t.matrix[0].length:0,a=i*r,o=[];for(let l=0;l<s;l++)for(let f=0;f<n;f++)o.push(t.matrix[l][f]);for(;o.length<a;)o.push(NaN);o.length>a&&(o.length=a);const h=[];let u=0;for(let l=0;l<i;l++){const f=[];for(let g=0;g<r;g++)f.push(o[u++]);h.push(f)}t.matrix=h}}function fo(e){return t=>{t.matrix.reverse();for(const i of t.matrix)i.reverse()}}function mo(e){return(t,i)=>{if(!t.matrix[i]){const s=ge(t.matrix[0][0]);return new F([],s,e)}const r=ge(t.matrix[i][0]);return new F([...t.matrix[i]],r,e)}}function go(e){return t=>t.matrix.length}function xo(e){return(t,i,r,s)=>{t.matrix[i]&&(t.matrix[i][r]=s)}}function yo(e){return(t,i=0,r="asc")=>{t.matrix.length!==0&&t.matrix.sort((s,n)=>{const a=s[i],o=n[i];return a<o?r==="asc"?-1:1:a>o?r==="asc"?1:-1:0})}}function wo(e){return(t,i,r,s,n)=>{const a=r-i,o=n-s,h=new M(a,o,NaN,e);for(let u=0;u<a;u++){const l=i+u;if(l>=t.matrix.length)break;for(let f=0;f<o;f++){const g=s+f;if(g>=t.matrix[l].length)break;h.matrix[u][f]=t.matrix[l][g]}}return h}}function bo(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new M(0,0,NaN,e);const s=t.matrix[0].length,n=new M(r,s,NaN,e);if(i instanceof M)for(let a=0;a<r;a++)for(let o=0;o<s;o++){const h=t.matrix[a][o],u=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;n.matrix[a][o]=h+u}else{const a=i;for(let o=0;o<r;o++)for(let h=0;h<s;h++)n.matrix[o][h]=t.matrix[o][h]+a}return n}}function vo(e){return(t,i,r)=>{const s=t.matrix.length;for(let n=0;n<s;n++){const a=t.matrix[n][i];t.matrix[n][i]=t.matrix[n][r],t.matrix[n][r]=a}}}function _o(e){return(t,i,r)=>{const s=t.matrix[i];t.matrix[i]=t.matrix[r],t.matrix[r]=s}}function So(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,s=Math.min(i,r);let n=0;for(let a=0;a<s;a++)n+=t.matrix[a][a];return n}}function Eo(e){return t=>{const i=t.matrix.length;if(i===0)return new M(0,0,NaN,e);const r=t.matrix[0].length,s=new M(r,i,NaN,e);for(let n=0;n<i;n++)for(let a=0;a<r;a++)s.matrix[a][n]=t.matrix[n][a];return s}}var No=Object.defineProperty,Co=(e,t,i)=>t in e?No(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,I=(e,t,i)=>Co(e,typeof t!="symbol"?t+"":t,i);class M{constructor(t=0,i=0,r=NaN,s){if(this.context=s,I(this,"matrix"),I(this,"_add_col"),I(this,"_add_row"),I(this,"_avg"),I(this,"_col"),I(this,"_columns"),I(this,"_concat"),I(this,"_copy"),I(this,"_det"),I(this,"_diff"),I(this,"_eigenvalues"),I(this,"_eigenvectors"),I(this,"_elements_count"),I(this,"_fill"),I(this,"_get"),I(this,"_inv"),I(this,"_is_antidiagonal"),I(this,"_is_antisymmetric"),I(this,"_is_binary"),I(this,"_is_diagonal"),I(this,"_is_identity"),I(this,"_is_square"),I(this,"_is_stochastic"),I(this,"_is_symmetric"),I(this,"_is_triangular"),I(this,"_is_zero"),I(this,"_kron"),I(this,"_max"),I(this,"_median"),I(this,"_min"),I(this,"_mode"),I(this,"_mult"),I(this,"_pinv"),I(this,"_pow"),I(this,"_rank"),I(this,"_remove_col"),I(this,"_remove_row"),I(this,"_reshape"),I(this,"_reverse"),I(this,"_row"),I(this,"_rows"),I(this,"_set"),I(this,"_sort"),I(this,"_submatrix"),I(this,"_sum"),I(this,"_swap_columns"),I(this,"_swap_rows"),I(this,"_trace"),I(this,"_transpose"),this.matrix=[],t>0&&i>0)for(let n=0;n<t;n++)this.matrix.push(Array(i).fill(r));this._add_col=ka(this.context),this._add_row=Ia(this.context),this._avg=Aa(this.context),this._col=Pa(this.context),this._columns=Ta(this.context),this._concat=Ra(this.context),this._copy=Da(this.context),this._det=Oa(this.context),this._diff=Ma(this.context),this._eigenvalues=Ba(this.context),this._eigenvectors=Fa(this.context),this._elements_count=ja(this.context),this._fill=$a(this.context),this._get=Wa(this.context),this._inv=Ua(this.context),this._is_antidiagonal=Ka(this.context),this._is_antisymmetric=za(this.context),this._is_binary=Ha(this.context),this._is_diagonal=Ga(this.context),this._is_identity=Ya(this.context),this._is_square=Qa(this.context),this._is_stochastic=Xa(this.context),this._is_symmetric=Za(this.context),this._is_triangular=Ja(this.context),this._is_zero=eo(this.context),this._kron=to(this.context),this._max=io(this.context),this._median=ro(this.context),this._min=so(this.context),this._mode=no(this.context),this._mult=ao(this.context),this._pinv=oo(this.context),this._pow=ho(this.context),this._rank=uo(this.context),this._remove_col=co(this.context),this._remove_row=lo(this.context),this._reshape=po(this.context),this._reverse=fo(this.context),this._row=mo(this.context),this._rows=go(this.context),this._set=xo(this.context),this._sort=yo(this.context),this._submatrix=wo(this.context),this._sum=bo(this.context),this._swap_columns=vo(this.context),this._swap_rows=_o(this.context),this._trace=So(this.context),this._transpose=Eo(this.context)}toString(){let t="";for(let i=0;i<this.matrix.length;i++)t+=t===""?"":`
116
- `,t+="["+this.matrix[i].join(", ")+"]";return t}add_col(...t){return this._add_col(this,...t)}add_row(...t){return this._add_row(this,...t)}avg(...t){return this._avg(this,...t)}col(...t){return this._col(this,...t)}columns(...t){return this._columns(this,...t)}concat(...t){return this._concat(this,...t)}copy(...t){return this._copy(this,...t)}det(...t){return this._det(this,...t)}diff(...t){return this._diff(this,...t)}eigenvalues(...t){return this._eigenvalues(this,...t)}eigenvectors(...t){return this._eigenvectors(this,...t)}elements_count(...t){return this._elements_count(this,...t)}fill(...t){return this._fill(this,...t)}get(...t){return this._get(this,...t)}inv(...t){return this._inv(this,...t)}is_antidiagonal(...t){return this._is_antidiagonal(this,...t)}is_antisymmetric(...t){return this._is_antisymmetric(this,...t)}is_binary(...t){return this._is_binary(this,...t)}is_diagonal(...t){return this._is_diagonal(this,...t)}is_identity(...t){return this._is_identity(this,...t)}is_square(...t){return this._is_square(this,...t)}is_stochastic(...t){return this._is_stochastic(this,...t)}is_symmetric(...t){return this._is_symmetric(this,...t)}is_triangular(...t){return this._is_triangular(this,...t)}is_zero(...t){return this._is_zero(this,...t)}kron(...t){return this._kron(this,...t)}max(...t){return this._max(this,...t)}median(...t){return this._median(this,...t)}min(...t){return this._min(this,...t)}mode(...t){return this._mode(this,...t)}mult(...t){return this._mult(this,...t)}pinv(...t){return this._pinv(this,...t)}pow(...t){return this._pow(this,...t)}rank(...t){return this._rank(this,...t)}remove_col(...t){return this._remove_col(this,...t)}remove_row(...t){return this._remove_row(this,...t)}reshape(...t){return this._reshape(this,...t)}reverse(...t){return this._reverse(this,...t)}row(...t){return this._row(this,...t)}rows(...t){return this._rows(this,...t)}set(...t){return this._set(this,...t)}sort(...t){return this._sort(this,...t)}submatrix(...t){return this._submatrix(this,...t)}sum(...t){return this._sum(this,...t)}swap_columns(...t){return this._swap_columns(this,...t)}swap_rows(...t){return this._swap_rows(this,...t)}trace(...t){return this._trace(this,...t)}transpose(...t){return this._transpose(this,...t)}}function ko(e){return(t,i,r)=>new M(t,i,r,e)}function Io(e){return(t,i=0)=>d.from(t).get(i)}class Ao{constructor(t){this.context=t,this.add_col=(i,...r)=>i.add_col(...r),this.add_row=(i,...r)=>i.add_row(...r),this.avg=(i,...r)=>i.avg(...r),this.col=(i,...r)=>i.col(...r),this.columns=(i,...r)=>i.columns(...r),this.concat=(i,...r)=>i.concat(...r),this.copy=(i,...r)=>i.copy(...r),this.det=(i,...r)=>i.det(...r),this.diff=(i,...r)=>i.diff(...r),this.eigenvalues=(i,...r)=>i.eigenvalues(...r),this.eigenvectors=(i,...r)=>i.eigenvectors(...r),this.elements_count=(i,...r)=>i.elements_count(...r),this.fill=(i,...r)=>i.fill(...r),this.get=(i,...r)=>i.get(...r),this.inv=(i,...r)=>i.inv(...r),this.is_antidiagonal=(i,...r)=>i.is_antidiagonal(...r),this.is_antisymmetric=(i,...r)=>i.is_antisymmetric(...r),this.is_binary=(i,...r)=>i.is_binary(...r),this.is_diagonal=(i,...r)=>i.is_diagonal(...r),this.is_identity=(i,...r)=>i.is_identity(...r),this.is_square=(i,...r)=>i.is_square(...r),this.is_stochastic=(i,...r)=>i.is_stochastic(...r),this.is_symmetric=(i,...r)=>i.is_symmetric(...r),this.is_triangular=(i,...r)=>i.is_triangular(...r),this.is_zero=(i,...r)=>i.is_zero(...r),this.kron=(i,...r)=>i.kron(...r),this.max=(i,...r)=>i.max(...r),this.median=(i,...r)=>i.median(...r),this.min=(i,...r)=>i.min(...r),this.mode=(i,...r)=>i.mode(...r),this.mult=(i,...r)=>i.mult(...r),this.new=ko(t),this.param=Io(),this.pinv=(i,...r)=>i.pinv(...r),this.pow=(i,...r)=>i.pow(...r),this.rank=(i,...r)=>i.rank(...r),this.remove_col=(i,...r)=>i.remove_col(...r),this.remove_row=(i,...r)=>i.remove_row(...r),this.reshape=(i,...r)=>i.reshape(...r),this.reverse=(i,...r)=>i.reverse(...r),this.row=(i,...r)=>i.row(...r),this.rows=(i,...r)=>i.rows(...r),this.set=(i,...r)=>i.set(...r),this.sort=(i,...r)=>i.sort(...r),this.submatrix=(i,...r)=>i.submatrix(...r),this.sum=(i,...r)=>i.sum(...r),this.swap_columns=(i,...r)=>i.swap_columns(...r),this.swap_rows=(i,...r)=>i.swap_rows(...r),this.trace=(i,...r)=>i.trace(...r),this.transpose=(i,...r)=>i.transpose(...r)}}var Po=Object.defineProperty,To=(e,t,i)=>t in e?Po(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ro=(e,t,i)=>To(e,typeof t!="symbol"?t+"":t,i);class Do{constructor(t){this.context=t,Ro(this,"_live",!1)}setLive(){this._live=!0}get isnew(){return!this._live}get islast(){return this.context.idx===this.context.data.close.data.length-1}get isfirst(){return this.context.idx===0}get ishistory(){return this.context.idx<this.context.data.close.data.length-1}get isrealtime(){return this.context.idx===this.context.data.close.data.length-1}get isconfirmed(){return this.context.data.closeTime[this.context.data.closeTime.length-1]<=new Date().getTime()}get islastconfirmedhistory(){return this.context.data.closeTime[this.context.data.closeTime.length-1]<=new Date().getTime()}}const fr={series:e=>e instanceof d||typeof e=="number",string:e=>typeof e=="string",number:e=>typeof e=="number",boolean:e=>typeof e=="boolean",array:e=>Array.isArray(e),object:e=>typeof e=="object",primitive:e=>typeof e===null||typeof e!="object"&&typeof e!="function",function:e=>typeof e=="function",undefined:e=>e===void 0,null:e=>e===null,NaN:e=>isNaN(e),remaining_options:e=>typeof e=="object"&&!(e instanceof d)};function Ut(e,t,i){Array.isArray(t)&&typeof t[0]=="string"&&(t=[t]);const r={};let s={};const n=new Array(t.length).fill(!0);for(let a=0;a<e.length;a++){const o=e[a];if(fr.remaining_options(o)){s=o;break}const h=t.map((u,l)=>n[l]?u[a]:void 0);for(let u=0;u<h.length;u++){const l=h[u];if(l===void 0){n[u]=!1;continue}const f=fr[i[l]];typeof f=="function"&&f(o)?r[l]=o:n[u]=!1}}return{...s,...r}}var Vo=Object.defineProperty,Oo=(e,t,i)=>t in e?Vo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Mo=(e,t,i)=>Oo(e,typeof t!="symbol"?t+"":t,i);const Lo=["title","shorttitle","overlay","format","precision","scale","max_bars_back","timeframe","timeframe_gaps","explicit_plot_zorder","max_lines_count","max_labels_count","max_boxes_count","calc_bars_count","max_polylines_count","dynamic_requests","behind_chart"],Bo={title:"string",shorttitle:"string",overlay:"boolean",format:"string",precision:"number",scale:"string",max_bars_back:"number",timeframe:"string",timeframe_gaps:"boolean",explicit_plot_zorder:"boolean",max_lines_count:"number",max_labels_count:"number",max_boxes_count:"number",calc_bars_count:"number",max_polylines_count:"number",dynamic_requests:"boolean",behind_chart:"boolean"};function Fo(e){return Ut(e,Lo,Bo)}class jo{constructor(t){this.context=t,Mo(this,"color",{param:(i,r=0)=>d.from(i).get(r),rgb:(i,r,s,n)=>n?`rgba(${i}, ${r}, ${s}, ${n})`:`rgb(${i}, ${r}, ${s})`,new:(i,r)=>{if(i&&i.startsWith("#")){const s=i.slice(1),n=parseInt(s.slice(0,2),16),a=parseInt(s.slice(2,4),16),o=parseInt(s.slice(4,6),16);return r?`rgba(${n}, ${a}, ${o}, ${r})`:`rgb(${n}, ${a}, ${o})`}return r?`rgba(${i}, ${r})`:i},white:"white",lime:"lime",green:"green",red:"red",maroon:"maroon",black:"black",gray:"gray",blue:"blue",yellow:"yellow",orange:"orange",purple:"purple",pink:"pink",brown:"brown",teal:"teal",cyan:"cyan",navy:"navy",indigo:"indigo",violet:"violet",magenta:"magenta",rose:"rose",gold:"gold",silver:"silver",bronze:"bronze"})}extractPlotOptions(t){const i={};for(let r in t)i[r]=d.from(t[r]).get(0);return i}indicator(...t){const i=Fo(t),r={title:"",shorttitle:"",overlay:!1,format:"inherit",precision:10,scale:"points",max_bars_back:0,timeframe:"",timeframe_gaps:!0,explicit_plot_zorder:!1,max_lines_count:50,max_labels_count:50,max_boxes_count:50,calc_bars_count:0,max_polylines_count:50,dynamic_requests:!1,behind_chart:!0};return this.context.indicator={...r,...i},this.context.indicator}get bar_index(){return this.context.idx}na(t){return isNaN(d.from(t).get(0))}nz(t,i=0){const r=d.from(t).get(0),s=d.from(i).get(0);return isNaN(r)?s:r}fixnan(t){const i=d.from(t);for(let r=0;r<i.length;r++){const s=i.get(r);if(!isNaN(s))return s}return NaN}alertcondition(t,i,r){}bool(t){const i=d.from(t).get(0);return!isNaN(i)&&i!==0}int(t){const i=d.from(t).get(0);if(typeof i!="number")throw new Error(`Cannot call "int" with argument "x"="${i}". An argument of "literal string" type was used but a "simple int" is expected.`);return Math.floor(i)}float(t){const i=d.from(t).get(0);if(typeof i!="number")throw new Error(`Cannot call "float" with argument "x"="${i}". An argument of "literal string" type was used but a "const float" is expected.`);return i}string(t){return d.from(t).get(0).toString()}}const $o=[["defval","title","tooltip","inline","group","display"],["defval","title","tooltip","group","confirm","display"],["defval","title","tooltip","inline","group","confirm","display"],["defval","title","options","tooltip","inline","group","confirm","display"],["defval","title","minval","maxval","step","tooltip","inline","group","confirm","display"]],Wo={defval:"primitive",title:"string",tooltip:"string",inline:"string",group:"string",display:"string",confirm:"boolean",options:"array",minval:"number",maxval:"number",step:"number"};function re(e){return Ut(e,$o,Wo)}function qo(e){return(...t)=>re(t).defval}function Uo(e){return(...t)=>re(t).defval}function Ko(e){return(...t)=>re(t).defval}function zo(e){return(...t)=>re(t).defval}function Ho(e){return(...t)=>re(t).defval}function Go(e){return(...t)=>re(t).defval}function Yo(e){return(t,i=0)=>d.from(t).get(i)}function Qo(e){return(...t)=>re(t).defval}function Xo(e){return(...t)=>re(t).defval}function Zo(e){return(...t)=>re(t).defval}function Jo(e){return(...t)=>re(t).defval}function eh(e){return(...t)=>re(t).defval}function th(e){return(...t)=>re(t).defval}function ih(e){return(...t)=>re(t).defval}function rh(e){return(...t)=>re(t).defval}var sh=Object.defineProperty,nh=(e,t,i)=>t in e?sh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Z=(e,t,i)=>nh(e,typeof t!="symbol"?t+"":t,i);const ah={any:qo,bool:Uo,color:Ko,enum:zo,float:Ho,int:Go,param:Yo,price:Qo,session:Xo,source:Zo,string:Jo,symbol:eh,text_area:th,time:ih,timeframe:rh};class oh{constructor(t){this.context=t,Z(this,"any"),Z(this,"bool"),Z(this,"color"),Z(this,"enum"),Z(this,"float"),Z(this,"int"),Z(this,"param"),Z(this,"price"),Z(this,"session"),Z(this,"source"),Z(this,"string"),Z(this,"symbol"),Z(this,"text_area"),Z(this,"time"),Z(this,"timeframe"),Object.entries(ah).forEach(([i,r])=>{this[i]=r(t)})}}function hh(e){return t=>Math.abs(d.from(t).get(0))}function uh(e){return t=>Math.acos(d.from(t).get(0))}function ch(e){return t=>Math.asin(d.from(t).get(0))}function lh(e){return t=>Math.atan(d.from(t).get(0))}function ph(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return i.reduce((r,s)=>r+s,0)/i.length}}function fh(e){return t=>Math.ceil(d.from(t).get(0))}function mh(e){return t=>Math.cos(d.from(t).get(0))}function dh(e){return()=>Math.E}function gh(e){return t=>Math.exp(d.from(t).get(0))}function xh(e){return t=>Math.floor(d.from(t).get(0))}function yh(e){return t=>Math.log(d.from(t).get(0))}function wh(e){return t=>Math.log(d.from(t).get(0))}function bh(e){return t=>Math.log10(d.from(t).get(0))}function vh(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return Math.max(...i)}}function _h(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return Math.min(...i)}}function Sh(e){return(t,i,r)=>typeof t=="string"?t:t instanceof d?i?new d(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new d(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new d(e.params[r],0)))}function Eh(e){return()=>1.618033988749895}function Nh(e){return()=>Math.PI}function Ch(e){return(t,i)=>Math.pow(d.from(t).get(0),d.from(i).get(0))}function kh(e){return()=>Math.random()}function Ih(e){return t=>Math.round(d.from(t).get(0))}function Ah(e){return t=>e.precision(Math.round(d.from(t).get(0)/e.pine.syminfo.mintick)*e.pine.syminfo.mintick)}function Ph(e){return()=>.6180339887498948}function Th(e){return t=>Math.sign(d.from(t).get(0))}function Rh(e){return t=>Math.sin(d.from(t).get(0))}function Dh(e){return t=>Math.sqrt(d.from(t).get(0))}function Vh(e){return(t,i)=>{const r=d.from(i).get(0),s=d.from(t);let n=0;for(let a=0;a<r;a++){const o=s.get(a);n+=o}return n}}function Oh(e){return t=>Math.tan(d.from(t).get(0))}function Mh(e){return(t,i)=>{const r=d.from(t).get(0),s=d.from(i).get(0);return typeof r=="number"&&typeof s=="number"?isNaN(r)&&isNaN(s)?!0:isNaN(r)||isNaN(s)?!1:Math.abs(r-s)<1e-8:r===s}}var Lh=Object.defineProperty,Bh=(e,t,i)=>t in e?Lh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t,i)=>Bh(e,typeof t!="symbol"?t+"":t,i);const Fh={abs:hh,acos:uh,asin:ch,atan:lh,avg:ph,ceil:fh,cos:mh,e:dh,exp:gh,floor:xh,ln:yh,log:wh,log10:bh,max:vh,min:_h,param:Sh,phi:Eh,pi:Nh,pow:Ch,random:kh,round:Ih,round_to_mintick:Ah,rphi:Ph,sign:Th,sin:Rh,sqrt:Dh,sum:Vh,tan:Oh,__eq:Mh};class jh{constructor(t){this.context=t,L(this,"_cache",{}),L(this,"abs"),L(this,"acos"),L(this,"asin"),L(this,"atan"),L(this,"avg"),L(this,"ceil"),L(this,"cos"),L(this,"e"),L(this,"exp"),L(this,"floor"),L(this,"ln"),L(this,"log"),L(this,"log10"),L(this,"max"),L(this,"min"),L(this,"param"),L(this,"phi"),L(this,"pi"),L(this,"pow"),L(this,"random"),L(this,"round"),L(this,"round_to_mintick"),L(this,"rphi"),L(this,"sign"),L(this,"sin"),L(this,"sqrt"),L(this,"sum"),L(this,"tan"),L(this,"__eq"),Object.entries(Fh).forEach(([i,r])=>{this[i]=r(t)})}}function $h(e){return(t,i,r)=>{e.params[r]||(e.params[r]=[]);let s;if(t instanceof d)s=t.get(i||0);else if(Array.isArray(t)){const n=t.every(o=>o instanceof d),a=t.every(o=>!(o instanceof d)&&!Array.isArray(o));(n||a)&&t.length>=1?n?s=t.map(o=>o.get(0)):s=t:s=d.from(t).get(i||0)}else s=t;return e.params[r].length===0?e.params[r].push(s):e.params[r][e.params[r].length-1]=s,[s,r]}}const gt=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function mr(e,t,i,r,s=!1){for(let n=0;n<i.length;n++)if(i[n]<=e&&t<=r[n])return s||t>=r[n]?n:n-1;return-1}function dr(e,t,i,r,s=!1,n,a=!1){for(let o=i.length-1;o>=0;o--){if(r[o]<=t&&i[o]>=e){const h=n&&t>n;if(a&&s)for(let u=0;u<i.length;u++){if(i[u]>=e&&i[u]<t)return u;if(i[u]>=t)break}if(h&&s&&!a)for(let u=0;u<i.length;u++){if(i[u]>=e&&i[u]<t)return u;if(i[u]>=t)break}return o}if(r[o]<e)break}return-1}function Wh(e){return async(t,i,r,s=!1,n=!1,a=!1,o=null,h=null)=>{const u=t[0],l=i[0],f=r[0],g=r[1],p=Array.isArray(s)?s[0]:s,x=Array.isArray(n)?n[0]:n;if(e.isSecondaryContext)return f;const y=gt.indexOf(e.timeframe),w=gt.indexOf(l);if(y==-1||w==-1)throw new Error("Invalid timeframe");if(y===w)return f;const E=y>w,A=d.from(e.data.openTime).get(0),k=d.from(e.data.closeTime).get(0),T=`${u}_${l}_${g}`,C=`${T}_prevIdx`;if(e.cache[T]){const nt=e.cache[T],wt=E?dr(A,k,nt.data.openTime.data,nt.data.closeTime.data,x,e.eDate,p):mr(A,k,nt.data.openTime.data,nt.data.closeTime.data,x);if(wt==-1)return NaN;const He=nt.params[g][wt];if(!E&&p){const yr=e.cache[C];return yr!==void 0&&yr===wt?NaN:(e.cache[C]=wt,Array.isArray(He)?[He]:He)}return Array.isArray(He)?[He]:He}const J=1e3*60*60*24*30,Y=e.sDate?e.sDate-J:void 0,H=e.sDate&&e.eDate?void 0:e.limit||1e3,st=new zt(e.source,u,l,H,Y,void 0);st.markAsSecondary();const Te=await st.run(e.pineTSCode);e.cache[T]=Te;const Yt=E?dr(A,k,Te.data.openTime.data,Te.data.closeTime.data,x,e.eDate,p):mr(A,k,Te.data.openTime.data,Te.data.closeTime.data,x);if(Yt==-1)return NaN;const Qt=Te.params[g][Yt];return!E&&p?(e.cache[C]=Yt,NaN):Array.isArray(Qt)?[Qt]:Qt}}function qh(e){return async(t,i,r,s=!1,n=null,a=!1,o=0)=>{const h=t[0],u=i[0],l=r[0],f=r[1];Array.isArray(s)&&s[0];const g=Array.isArray(a)?a[0]:a;if(e.isSecondaryContext)return Array.isArray(l)?[l]:l;const p=gt.indexOf(e.timeframe),x=gt.indexOf(u);if(p===-1||x===-1){if(g)return NaN;throw new Error("Invalid timeframe")}if(x>p){if(g)return NaN;throw new Error(`Timeframe ${u} is not lower than or equal to chart timeframe ${e.timeframe}`)}if(x===p)return[[l]];const y=`${h}_${u}_${f}_lower`;if(!e.cache[y]){const Y=e.sDate?e.sDate-2592e6:void 0,H=e.sDate&&e.eDate?void 0:e.limit||1e3,st=new zt(e.source,h,u,H,Y,e.eDate);st.markAsSecondary();const Te=await st.run(e.pineTSCode);e.cache[y]=Te}const w=e.cache[y],E=d.from(e.data.openTime).get(0),A=d.from(e.data.closeTime).get(0),k=w.data.openTime.data,T=w.data.closeTime.data,C=w.params[f];if(!C)return[];const J=[];for(let Y=0;Y<k.length;Y++){const H=k[Y];if(!(T[Y]<=E)){if(H>=A)break;H>=E&&H<A&&J.push(C[Y])}}return[J]}}var Uh=Object.defineProperty,Kh=(e,t,i)=>t in e?Uh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,xt=(e,t,i)=>Kh(e,typeof t!="symbol"?t+"":t,i);const zh={param:$h,security:Wh,security_lower_tf:qh};class Hh{constructor(t){this.context=t,xt(this,"_cache",{}),xt(this,"param"),xt(this,"security"),xt(this,"security_lower_tf"),Object.entries(zh).forEach(([i,r])=>{this[i]=r(t)})}}function Gh(e){return t=>{e.taState||(e.taState={});const i=t||"accdist";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.volume,0);if(isNaN(s)||isNaN(n)||isNaN(a)||isNaN(o))return e.precision(r.cumulativeSum);const h=n-a;let u=0;return h!==0&&(u=(s-a-(n-s))/h*o),r.cumulativeSum+=u,e.precision(r.cumulativeSum)}}function Yh(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0),h=d.from(s).get(0);e.taState||(e.taState={});const u=n||`alma_${a}_${o}_${h}`;if(!e.taState[u]){const p=o*(a-1),x=a/h,y=[];let w=0;for(let E=0;E<a;E++){const A=Math.exp(-Math.pow(E-p,2)/(2*x*x));y.push(A),w+=A}for(let E=0;E<y.length;E++)y[E]/=w;e.taState[u]={window:[],weights:y}}const l=e.taState[u],f=d.from(t).get(0);if(l.window.unshift(f),l.window.length<a)return NaN;l.window.length>a&&l.window.pop();let g=0;for(let p=0;p<a;p++)g+=l.weights[p]*l.window[a-1-p];return e.precision(g)}}function Qh(e){return(t,i)=>{const r=d.from(t).get(0);e.taState||(e.taState={});const s=i||`atr_${r}`;e.taState[s]||(e.taState[s]={prevAtr:null,initSum:0,initCount:0,prevClose:null});const n=e.taState[s],a=e.get(e.data.high,0),o=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(h))return NaN;let u;if(n.prevClose!==null){const f=a-o,g=Math.abs(a-n.prevClose),p=Math.abs(o-n.prevClose);u=Math.max(f,g,p)}else u=a-o;if(n.prevClose=h,n.initCount<r)return n.initSum+=u,n.initCount++,n.initCount===r?(n.prevAtr=n.initSum/r,e.precision(n.prevAtr)):NaN;const l=(n.prevAtr*(r-1)+u)/r;return n.prevAtr=l,e.precision(l)}}function Xh(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"barssince";e.taState[r]||(e.taState[r]={lastTrueIndex:null});const s=e.taState[r];return d.from(t).get(0)?(s.lastTrueIndex=e.idx,0):s.lastTrueIndex===null?NaN:e.idx-s.lastTrueIndex}}function Zh(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`bb_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],u=d.from(t).get(0);if(isNaN(u))return[[NaN,NaN,NaN]];if(h.window.unshift(u),h.sum+=u,h.window.length<n)return[[NaN,NaN,NaN]];if(h.window.length>n){const y=h.window.pop();h.sum-=y}const l=h.sum/n;let f=0;for(let y=0;y<n;y++)f+=Math.pow(h.window[y]-l,2);const g=Math.sqrt(f/n),p=l+a*g,x=l-a*g;return[[e.precision(p),e.precision(l),e.precision(x)]]}}function Jh(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`bbw_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],u=d.from(t).get(0);if(isNaN(u))return NaN;if(h.window.unshift(u),h.sum+=u,h.window.length<n)return NaN;if(h.window.length>n){const w=h.window.pop();h.sum-=w}const l=h.sum/n;let f=0;for(let w=0;w<n;w++){const E=h.window[w]-l;f+=E*E}const g=f/n,p=Math.sqrt(g),x=a*p;if(l===0)return e.precision(0);const y=2*x/l*100;return e.precision(y)}}function eu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`cci_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=d.from(t).get(0);if(isNaN(o))return NaN;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const g=a.window.pop();a.sum-=g}const h=a.sum/s;let u=0;for(let g=0;g<s;g++)u+=Math.abs(a.window[g]-h);const l=u/s;if(l===0)return 0;const f=(o-h)/(.015*l);return e.precision(f)}}function tu(e){return(t,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`change_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<=s)return NaN;a.window.length>s+1&&a.window.pop();const h=o-a.window[s];return e.precision(h)}}function iu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`cmo_${s}`;e.taState[n]||(e.taState[n]={gainsWindow:[],lossesWindow:[],gainsSum:0,lossesSum:0});const a=e.taState[n],o=d.from(t).get(0),h=d.from(t).get(1);if(isNaN(o)||isNaN(h))return NaN;const u=o-h,l=u>=0?u:0,f=u>=0?0:-u;if(a.gainsWindow.unshift(l),a.lossesWindow.unshift(f),a.gainsSum+=l,a.lossesSum+=f,a.gainsWindow.length<s)return NaN;if(a.gainsWindow.length>s){const x=a.gainsWindow.pop(),y=a.lossesWindow.pop();a.gainsSum-=x,a.lossesSum-=y}const g=a.gainsSum+a.lossesSum;if(g===0)return e.precision(0);const p=100*(a.gainsSum-a.lossesSum)/g;return e.precision(p)}}function ru(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);let a=0,o=!1;for(let l=0;l<s;l++){const f=n.get(l);if(isNaN(f)){o=!0;break}a+=f}if(o)return NaN;let h=0;for(let l=0;l<s;l++){const f=n.get(l);h+=f*(l+1)}if(a===0)return NaN;const u=-h/a;return e.precision(u)}}function su(e){return(t,i,r,s)=>{const n=d.from(r).get(0),a=d.from(t),o=d.from(i);if(e.idx<n-1)return NaN;let h=0,u=0,l=0,f=0,g=0,p=0;for(let A=0;A<n;A++){const k=a.get(A),T=o.get(A);isNaN(k)||isNaN(T)||(h+=k,u+=T,l+=k*T,f+=k*k,g+=T*T,p++)}if(p<2)return NaN;const x=p*l-h*u,y=p*f-h*h,w=p*g-u*u;if(y<=0||w<=0)return e.precision(0);const E=x/Math.sqrt(y*w);return e.precision(E)}}function nu(e){return(t,i,r)=>{const s=d.from(t),n=d.from(i),a=s.get(0),o=n.get(0),h=s.get(1),u=n.get(1);if(isNaN(a)||isNaN(o)||isNaN(h)||isNaN(u))return!1;const l=a>o&&h<=u,f=a<o&&h>=u;return l||f}}function au(e){return(t,i)=>{const r=d.from(t),s=d.from(i),n=r.get(0),a=s.get(0),o=r.get(1),h=s.get(1);return o<h&&n>a}}function ou(e){return(t,i)=>{const r=d.from(t),s=d.from(i),n=r.get(0),a=s.get(0),o=r.get(1),h=s.get(1);return o>h&&n<a}}function hu(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"cum";e.taState[r]||(e.taState[r]={cumulativeSum:0});const s=e.taState[r],n=d.from(t).get(0);return isNaN(n)||(s.cumulativeSum+=n),e.precision(s.cumulativeSum)}}function uu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`dev_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=d.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const f=a.window.pop();a.sum-=f}const h=a.sum/s;let u=0;for(let f=0;f<s;f++)u+=Math.abs(a.window[f]-h);const l=u/s;return e.precision(l)}}function cu(e){return(t,i,r)=>{const s=d.from(t).get(0),n=d.from(i).get(0);e.taState||(e.taState={});const a=r||`dmi_${s}_${n}`;e.taState[a]||(e.taState[a]={prevHigh:NaN,prevLow:NaN,prevClose:NaN,trInitSum:0,plusInitSum:0,minusInitSum:0,initCount:0,prevSmoothedTR:NaN,prevSmoothedPlus:NaN,prevSmoothedMinus:NaN,dxInitSum:0,adxInitCount:0,prevADX:NaN});const o=e.taState[a],h=e.get(e.data.high,0),u=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(h)||isNaN(u)||isNaN(l))return[[NaN,NaN,NaN]];if(isNaN(o.prevHigh))return o.prevHigh=h,o.prevLow=u,o.prevClose=l,[[NaN,NaN,NaN]];const f=Math.max(h-u,Math.abs(h-o.prevClose),Math.abs(u-o.prevClose)),g=h-o.prevHigh,p=o.prevLow-u,x=g>p&&g>0?g:0,y=p>g&&p>0?p:0;o.prevHigh=h,o.prevLow=u,o.prevClose=l;let w,E,A;if(o.initCount++,o.initCount<=s)o.trInitSum+=f,o.plusInitSum+=x,o.minusInitSum+=y,o.initCount===s&&(o.prevSmoothedTR=o.trInitSum/s,o.prevSmoothedPlus=o.plusInitSum/s,o.prevSmoothedMinus=o.minusInitSum/s);else{const H=1/s;o.prevSmoothedTR=H*f+(1-H)*o.prevSmoothedTR,o.prevSmoothedPlus=H*x+(1-H)*o.prevSmoothedPlus,o.prevSmoothedMinus=H*y+(1-H)*o.prevSmoothedMinus}if(w=o.prevSmoothedTR,E=o.prevSmoothedPlus,A=o.prevSmoothedMinus,o.initCount<s)return[[NaN,NaN,NaN]];const k=w===0?0:100*E/w,T=w===0?0:100*A/w,C=k+T,J=C===0?0:100*Math.abs(k-T)/C;let Y=NaN;if(o.adxInitCount++,o.adxInitCount<=n)o.dxInitSum+=J,o.adxInitCount===n&&(o.prevADX=o.dxInitSum/n,Y=o.prevADX);else{const H=1/n;o.prevADX=H*J+(1-H)*o.prevADX,Y=o.prevADX}return[[e.precision(k),e.precision(T),e.precision(Y)]]}}function lu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`ema_${s}`;e.taState[n]||(e.taState[n]={prevEma:null,initSum:0,initCount:0});const a=e.taState[n],o=d.from(t).get(0);if(o==null||isNaN(o))return NaN;if(a.initCount<s)return a.initSum+=o,a.initCount++,a.initCount===s?(a.prevEma=a.initSum/s,e.precision(a.prevEma)):NaN;const h=2/(s+1),u=o*h+a.prevEma*(1-h);return a.prevEma=u,e.precision(u)}}function pu(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);for(let a=0;a<s;a++){const o=n.get(a),h=n.get(a+1);if(isNaN(o)||isNaN(h)||o>=h)return!1}return!0}}function fu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`highest_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=Math.max(...a.window.filter(u=>!isNaN(u)));return e.precision(h)}}function mu(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s-1)return NaN;let a=-1/0,o=NaN;for(let h=0;h<s;h++){const u=n.get(h);isNaN(u)||(isNaN(o)||u>a)&&(a=u,o=-h)}return o}}function du(e){return(t,i,r)=>{const s=d.from(i).get(0),n=Math.floor(s/2),a=Math.floor(Math.sqrt(s)),o=e.ta.wma,h=o(t,n,r?`${r}_wma1`:void 0),u=o(t,s,r?`${r}_wma2`:void 0);if(isNaN(h)||isNaN(u))return NaN;e.taState||(e.taState={});const l=r||`hma_raw_${s}`;e.taState[l]||(e.taState[l]=[]);const f=2*h-u;e.taState[l].unshift(f);const g=r?`${r}_hma_final`:`hma_final_${s}`;e.taState[g]||(e.taState[g]={window:[]});const p=e.taState[g];if(p.window.unshift(f),p.window.length<a)return NaN;p.window.length>a&&p.window.pop();let x=0,y=0;for(let E=0;E<a;E++){const A=a-E;x+=p.window[E]*A,y+=A}const w=x/y;return e.precision(w)}}function gu(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.high,0),s=e.get(e.data.low,0),n=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(n))return NaN;const a=(r-s)*n;if(a===0)return e.precision(0);const o=(2*i-r-s)/a;return e.precision(o)}}function xu(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0);let h=!0;typeof s=="string"?n=s:s!==void 0&&(h=d.from(s).get(0));let u;const l=e.get(e.data.high,0),f=e.get(e.data.low,0);if(h){const T=e.get(e.data.close,1);isNaN(T)?u=NaN:u=Math.max(l-f,Math.abs(l-T),Math.abs(f-T))}else u=l-f;const g=d.from(t).get(0);e.taState||(e.taState={});const p=n||`kc_${a}_${o}_${h}`;e.taState[p]||(e.taState[p]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const x=e.taState[p],y=(T,C,J)=>{if(isNaN(C))return NaN;if(T.initCount<J)return T.initSum+=C,T.initCount++,T.initCount===J?(T.prevEma=T.initSum/J,T.prevEma):NaN;const Y=2/(J+1);return T.prevEma=C*Y+T.prevEma*(1-Y),T.prevEma},w=y(x.basisState,g,a),E=y(x.rangeState,u,a);if(isNaN(w)||isNaN(E))return[[NaN,NaN,NaN]];const A=w+E*o,k=w-E*o;return[[e.precision(w),e.precision(A),e.precision(k)]]}}function yu(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0);let h=!0;typeof s=="string"?n=s:s!==void 0&&(h=d.from(s).get(0)),e.taState||(e.taState={});const u=n||`kcw_${a}_${o}_${h}`;e.taState[u]||(e.taState[u]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const l=e.taState[u],f=(k,T,C)=>{if(isNaN(T))return NaN;if(k.initCount<C)return k.initSum+=T,k.initCount++,k.initCount===C?(k.prevEma=k.initSum/C,k.prevEma):NaN;const J=2/(C+1);return k.prevEma=T*J+k.prevEma*(1-J),k.prevEma};let g;const p=e.get(e.data.high,0),x=e.get(e.data.low,0);if(h){const k=e.get(e.data.close,1);isNaN(k)?g=NaN:g=Math.max(p-x,Math.abs(p-k),Math.abs(x-k))}else g=p-x;const y=d.from(t).get(0),w=f(l.basisState,y,a),E=f(l.rangeState,g,a);if(isNaN(w)||isNaN(E))return NaN;if(w===0)return e.precision(0);const A=2*E*o/w;return e.precision(A)}}function wu(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`linreg_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[]});const h=e.taState[o],u=d.from(t).get(0);if(h.window.unshift(u),h.window.length<n)return NaN;h.window.length>n&&h.window.pop();let l=0,f=0,g=0,p=0;const x=n;for(let A=0;A<n;A++){const k=n-1-A,T=h.window[A];l+=k,f+=T,g+=k*T,p+=k*k}const y=x*p-l*l;if(y===0)return NaN;const w=(x*g-l*f)/y,E=(f-w*l)/x+w*(n-1-a);return e.precision(E)}}function bu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`lowest_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=a.window.filter(l=>!isNaN(l)&&l!==void 0),u=h.length>0?Math.min(...h):NaN;return e.precision(u)}}function vu(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s-1)return NaN;let a=1/0,o=NaN;for(let h=0;h<s;h++){const u=n.get(h);isNaN(u)||(isNaN(o)||u<a)&&(a=u,o=-h)}return o}}function _u(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0),h=d.from(s).get(0),u=n||`macd_${a}_${o}_${h}`,l=`${u}_fast`,f=`${u}_slow`,g=`${u}_signal`,p=e.ta.ema(t,a,l),x=e.ta.ema(t,o,f);let y=NaN;!isNaN(p)&&!isNaN(x)&&(y=p-x);let w=NaN;isNaN(y)||(w=e.ta.ema(y,h,g));let E=NaN;return!isNaN(y)&&!isNaN(w)&&(E=y-w),[[e.precision(y),e.precision(w),e.precision(E)]]}}function Su(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`median_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=a.window.slice().sort((f,g)=>f-g),u=Math.floor(s/2),l=s%2===0?(h[u-1]+h[u])/2:h[u];return e.precision(l)}}function Eu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`mfi_${s}`;e.taState[n]||(e.taState[n]={upperWindow:[],lowerWindow:[],upperSum:0,lowerSum:0});const a=e.taState[n],o=d.from(t).get(0),h=d.from(t).get(1),u=e.get(e.data.volume,0);if(isNaN(o)||isNaN(u))return NaN;const l=isNaN(h)?NaN:o-h;let f=0,g=0;if(f=u*(l<=0?0:o),g=u*(l>=0?0:o),a.upperWindow.unshift(f),a.lowerWindow.unshift(g),a.upperSum+=f,a.lowerSum+=g,a.upperWindow.length<s)return NaN;if(a.upperWindow.length>s){const x=a.upperWindow.pop(),y=a.lowerWindow.pop();a.upperSum-=x,a.lowerSum-=y}if(a.lowerSum===0)return a.upperSum,e.precision(100);if(a.upperSum===0)return e.precision(0);const p=100-100/(1+a.upperSum/a.lowerSum);return e.precision(p)}}function Nu(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s-1)return NaN;const a=new Map;for(let u=0;u<s;u++){const l=n.get(u);isNaN(l)||a.set(l,(a.get(l)||0)+1)}if(a.size===0)return NaN;let o=NaN,h=-1;for(const[u,l]of a.entries())l>h?(h=l,o=u):l===h&&u<o&&(o=u);return o}}function Cu(e){return(t,i,r)=>{const s=d.from(i).get(0);return e.ta.change(t,s)}}function ku(e){return t=>{e.taState||(e.taState={});const i=t||"nvi";e.taState[i]||(e.taState[i]={nvi:1});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),h=isNaN(s)?0:s,u=isNaN(n)?0:n,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(h===0||u===0)&&l<f){const g=(h-u)/u;r.nvi=r.nvi+g*r.nvi}return e.precision(r.nvi)}}function Iu(e){return()=>{e.taState||(e.taState={});const t="obv";e.taState[t]||(e.taState[t]={prevOBV:0});const i=e.taState[t],r=e.get(e.data.close,0),s=e.get(e.data.volume,0),n=e.get(e.data.close,1);if(isNaN(n))return i.prevOBV=0,e.precision(0);let a;return r>n?a=i.prevOBV+s:r<n?a=i.prevOBV-s:a=i.prevOBV,i.prevOBV=a,e.precision(a)}}function Au(e){return(t,i,r)=>t instanceof d?i?new d(t.data,t.offset+i):t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new d(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new d(e.params[r],0)))}function Pu(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t);if(e.idx<n-1)return NaN;const h=[];for(let x=0;x<n;x++){const y=o.get(x);if(isNaN(y))return NaN;h.push(y)}h.sort((x,y)=>x-y);let u=a/100*n-.5;u<0&&(u=0),u>n-1&&(u=n-1);const l=Math.floor(u),f=Math.ceil(u);if(l===f)return e.precision(h[l]);const g=u-l,p=h[l]+g*(h[f]-h[l]);return e.precision(p)}}function Tu(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t);if(e.idx<n-1)return NaN;const h=[];for(let l=0;l<n;l++){const f=o.get(l);isNaN(f)||h.push(f)}if(h.length===0)return NaN;h.sort((l,f)=>l-f);let u=Math.ceil(a/100*h.length)-1;return u<0&&(u=0),u>=h.length&&(u=h.length-1),e.precision(h[u])}}function Ru(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s)return NaN;const a=n.get(0);if(isNaN(a))return NaN;let o=0,h=0;for(let u=1;u<=s;u++){const l=n.get(u);isNaN(l)||(h++,l<=a&&o++)}return h===0?NaN:e.precision(o/h*100)}}function Du(e,t,i){const r=new Array(e.length).fill(NaN);for(let s=t+i;s<e.length;s++){const n=e[s-i];let a=!0;for(let o=1;o<=t;o++)if(e[s-i-o]>=n){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[s-i+o]>=n){a=!1;break}}a&&(r[s]=n)}return r}function Vu(e){return(t,i,r,s)=>{typeof r=="string"&&(r=i,i=t,t=e.data.high);const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t).toArray(),h=Du(o,n,a),u=e.idx;return e.precision(h[u])}}function Ou(e,t,i){const r=new Array(e.length).fill(NaN);for(let s=t+i;s<e.length;s++){const n=e[s-i];let a=!0;for(let o=1;o<=t;o++)if(e[s-i-o]<=n){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[s-i+o]<=n){a=!1;break}}a&&(r[s]=n)}return r}function Mu(e){return(t,i,r,s)=>{typeof r=="string"&&(r=i,i=t,t=e.data.low);const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t).toArray(),h=Ou(o,n,a),u=e.idx;return e.precision(h[u])}}function Lu(e){return t=>{e.taState||(e.taState={});const i=t||"pvi";e.taState[i]||(e.taState[i]={pvi:1});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),h=isNaN(s)?0:s,u=isNaN(n)?0:n,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(h===0||u===0)&&l>f){const g=(h-u)/u;r.pvi=r.pvi+g*r.pvi}return e.precision(r.pvi)}}function Bu(e){return t=>{e.taState||(e.taState={});const i=t||"pvt";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0);if(!isNaN(s)&&!isNaN(n)&&!isNaN(a)&&n!==0){const o=(s-n)/n*a;r.cumulativeSum+=o}return e.precision(r.cumulativeSum)}}function Fu(e){return(t,i,r)=>{const s=e.pine.ta.highest(t,i,(r||"range")+"_h"),n=e.pine.ta.lowest(t,i,(r||"range")+"_l");return isNaN(s)||isNaN(n)?NaN:e.precision(s-n)}}function ju(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);for(let a=0;a<s;a++){const o=n.get(a),h=n.get(a+1);if(isNaN(o)||isNaN(h)||o<=h)return!1}return!0}}function $u(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`rma_${s}`;e.taState[n]||(e.taState[n]={prevRma:null,initSum:0,initCount:0});const a=e.taState[n],o=d.from(t).get(0)||0;if(a.initCount<s)return a.initSum+=o,a.initCount++,a.initCount===s?(a.prevRma=a.initSum/s,e.precision(a.prevRma)):NaN;const h=1/s,u=o*h+a.prevRma*(1-h);return a.prevRma=u,e.precision(u)}}function Wu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`roc_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<=s)return NaN;a.window.length>s+1&&a.window.pop();const h=a.window[s],u=(o-h)/h*100;return e.precision(u)}}function qu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`rsi_${s}`;e.taState[n]||(e.taState[n]={prevValue:null,avgGain:0,avgLoss:0,initGains:[],initLosses:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.prevValue!==null){const h=o-a.prevValue,u=h>0?h:0,l=h<0?-h:0;if(a.initGains.length<s){if(a.initGains.push(u),a.initLosses.push(l),a.initGains.length===s){a.avgGain=a.initGains.reduce((p,x)=>p+x,0)/s,a.avgLoss=a.initLosses.reduce((p,x)=>p+x,0)/s,a.prevValue=o;const g=a.avgLoss===0?100:100-100/(1+a.avgGain/a.avgLoss);return e.precision(g)}return a.prevValue=o,NaN}a.avgGain=(a.avgGain*(s-1)+u)/s,a.avgLoss=(a.avgLoss*(s-1)+l)/s;const f=a.avgLoss===0?100:100-100/(1+a.avgGain/a.avgLoss);return a.prevValue=o,e.precision(f)}return a.prevValue=o,NaN}}function Uu(e){return(t,i,r,s)=>{const n=d.from(t).get(0),a=d.from(i).get(0),o=d.from(r).get(0);e.taState||(e.taState={});const h=s||`sar_${n}_${a}_${o}`;e.taState[h]||(e.taState[h]={result:NaN,maxMin:NaN,acceleration:NaN,isBelow:!1,barIndex:0});const u=e.taState[h],l=e.get(e.data.high,0),f=e.get(e.data.low,0),g=e.get(e.data.close,0),p=e.get(e.data.close,1),x=e.get(e.data.high,1),y=e.get(e.data.low,1),w=e.get(e.data.high,2),E=e.get(e.data.low,2);if(isNaN(l)||isNaN(f)||isNaN(g))return NaN;let A=!1;return u.barIndex===1&&(g>p?(u.isBelow=!0,u.maxMin=l,u.result=y):(u.isBelow=!1,u.maxMin=f,u.result=x),A=!0,u.acceleration=n),u.barIndex>=1&&(u.result=u.result+u.acceleration*(u.maxMin-u.result),u.isBelow?u.result>f&&(A=!0,u.isBelow=!1,u.result=Math.max(l,u.maxMin),u.maxMin=f,u.acceleration=n):u.result<l&&(A=!0,u.isBelow=!0,u.result=Math.min(f,u.maxMin),u.maxMin=l,u.acceleration=n),A||(u.isBelow?l>u.maxMin&&(u.maxMin=l,u.acceleration=Math.min(u.acceleration+a,o)):f<u.maxMin&&(u.maxMin=f,u.acceleration=Math.min(u.acceleration+a,o))),u.isBelow?(u.result=Math.min(u.result,y),u.barIndex>1&&(u.result=Math.min(u.result,E))):(u.result=Math.max(u.result,x),u.barIndex>1&&(u.result=Math.max(u.result,w)))),u.barIndex++,u.barIndex<=1?NaN:e.precision(u.result)}}function Ku(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`sma_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=d.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const u=a.window.pop();a.sum-=u}const h=a.sum/s;return e.precision(h)}}function zu(e){return(t,i,r=!0,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`stdev_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],u=d.from(t).get(0);if(u==null||isNaN(u))return NaN;if(h.window.unshift(u),h.sum+=u,h.window.length<n)return NaN;if(h.window.length>n){const x=h.window.pop();h.sum-=x}const l=h.sum/n;let f=0;for(let x=0;x<n;x++)f+=Math.pow(h.window[x]-l,2);const g=a?n:n-1,p=Math.sqrt(f/g);return e.precision(p)}}function Hu(e){return(t,i,r,s,n)=>{const a=d.from(s).get(0);e.taState||(e.taState={});const o=n||`stoch_${a}`;e.taState[o]||(e.taState[o]={highWindow:[],lowWindow:[]});const h=e.taState[o],u=d.from(t).get(0),l=d.from(i).get(0),f=d.from(r).get(0);if(isNaN(u)||isNaN(l)||isNaN(f))return NaN;if(h.highWindow.unshift(l),h.lowWindow.unshift(f),h.highWindow.length<a)return NaN;h.highWindow.length>a&&(h.highWindow.pop(),h.lowWindow.pop());let g=h.highWindow[0],p=h.lowWindow[0];for(let w=1;w<a;w++)h.highWindow[w]>g&&(g=h.highWindow[w]),h.lowWindow[w]<p&&(p=h.lowWindow[w]);const x=g-p;if(x===0)return NaN;const y=100*(u-p)/x;return e.precision(y)}}function Gu(e){return(t,i,r)=>{const s=d.from(t).get(0),n=d.from(i).get(0);e.taState||(e.taState={});const a=r||`supertrend_${s}_${n}`;e.taState[a]||(e.taState[a]={trWindow:[],trSum:0,atrValue:NaN,atrCount:0,prevLowerBand:NaN,prevUpperBand:NaN,prevSuperTrend:NaN,prevDirection:NaN,prevClose:NaN});const o=e.taState[a],h=e.get(e.data.high,0),u=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(h)||isNaN(u)||isNaN(l))return[[NaN,NaN]];const f=(h+u)/2;let g;isNaN(o.prevClose)?g=h-u:g=Math.max(h-u,Math.abs(h-o.prevClose),Math.abs(u-o.prevClose)),o.atrCount++,o.atrCount<=n?(o.trWindow.push(g),o.trSum+=g,o.atrCount===n&&(o.atrValue=o.trSum/n)):o.atrValue=(o.atrValue*(n-1)+g)/n;const p=o.atrValue,x=o.prevClose;if(o.prevClose=l,isNaN(p))return[[NaN,NaN]];let y=f+s*p,w=f-s*p;const E=isNaN(o.prevLowerBand)?0:o.prevLowerBand,A=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||w>E||x<E||(w=E),isNaN(o.prevUpperBand)||y<A||x>A||(y=A);let k,T;const C=o.prevSuperTrend;return o.atrCount===n?k=1:C===o.prevUpperBand?k=l>y?-1:1:k=l<w?1:-1,T=k===-1?w:y,o.prevLowerBand=w,o.prevUpperBand=y,o.prevSuperTrend=T,o.prevDirection=k,[[e.precision(T),k]]}}function Yu(e){return(t,i)=>{const r=[1,2,2,1],s=6;e.taState||(e.taState={});const n=i||"swma";e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<4)return NaN;a.window.length>4&&a.window.pop();let h=0;for(let u=0;u<4;u++)h+=r[u]*a.window[3-u];return h/=s,e.precision(h)}}function Qu(e){return(t,i)=>{let r=!0;typeof t=="string"||t!==void 0&&(r=d.from(t).get(0));const s=e.get(e.data.high,0),n=e.get(e.data.low,0),a=e.get(e.data.close,1);if(isNaN(a))return r?e.precision(s-n):NaN;const o=Math.max(s-n,Math.abs(s-a),Math.abs(n-a));return e.precision(o)}}function Xu(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`tsi_${n}_${a}`;e.taState[o]||(e.taState[o]={prevSource:NaN,ema1_pc_multiplier:2/(a+1),ema1_pc_value:NaN,ema1_pc_count:0,ema1_pc_sum:0,ema2_pc_multiplier:2/(n+1),ema2_pc_value:NaN,ema2_pc_count:0,ema2_pc_sum:0,ema1_abs_multiplier:2/(a+1),ema1_abs_value:NaN,ema1_abs_count:0,ema1_abs_sum:0,ema2_abs_multiplier:2/(n+1),ema2_abs_value:NaN,ema2_abs_count:0,ema2_abs_sum:0});const h=e.taState[o],u=d.from(t).get(0);if(isNaN(u))return NaN;const l=isNaN(h.prevSource)?NaN:u-h.prevSource;if(h.prevSource=u,isNaN(l))return NaN;const f=Math.abs(l);if(h.ema1_pc_count++,h.ema1_pc_count<=a?(h.ema1_pc_sum+=l,h.ema1_pc_count===a&&(h.ema1_pc_value=h.ema1_pc_sum/a)):h.ema1_pc_value=l*h.ema1_pc_multiplier+h.ema1_pc_value*(1-h.ema1_pc_multiplier),h.ema1_abs_count++,h.ema1_abs_count<=a?(h.ema1_abs_sum+=f,h.ema1_abs_count===a&&(h.ema1_abs_value=h.ema1_abs_sum/a)):h.ema1_abs_value=f*h.ema1_abs_multiplier+h.ema1_abs_value*(1-h.ema1_abs_multiplier),isNaN(h.ema1_pc_value)||isNaN(h.ema1_abs_value))return NaN;if(h.ema2_pc_count++,h.ema2_pc_count<=n?(h.ema2_pc_sum+=h.ema1_pc_value,h.ema2_pc_count===n&&(h.ema2_pc_value=h.ema2_pc_sum/n)):h.ema2_pc_value=h.ema1_pc_value*h.ema2_pc_multiplier+h.ema2_pc_value*(1-h.ema2_pc_multiplier),h.ema2_abs_count++,h.ema2_abs_count<=n?(h.ema2_abs_sum+=h.ema1_abs_value,h.ema2_abs_count===n&&(h.ema2_abs_value=h.ema2_abs_sum/n)):h.ema2_abs_value=h.ema1_abs_value*h.ema2_abs_multiplier+h.ema2_abs_value*(1-h.ema2_abs_multiplier),isNaN(h.ema2_pc_value)||isNaN(h.ema2_abs_value))return NaN;if(h.ema2_abs_value===0)return e.precision(0);const g=h.ema2_pc_value/h.ema2_abs_value;return e.precision(g)}}function Zu(e){return(t,i,r,s)=>{e.taState||(e.taState={});const n=s||"valuewhen";e.taState[n]||(e.taState[n]={values:[]});const a=e.taState[n],o=d.from(t).get(0),h=d.from(i).get(0),u=d.from(r).get(0);if(o&&a.values.push(h),isNaN(u)||u<0)return NaN;const l=a.values.length-1-u;if(l<0)return NaN;const f=a.values[l];return typeof f=="number"?e.precision(f):f}}function Ju(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`variance_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();let h=0,u=0;for(let g=0;g<s;g++)h+=a.window[g],u+=a.window[g]*a.window[g];const l=h/s,f=u/s-l*l;return e.precision(f)}}function ec(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"vwap";e.taState[r]||(e.taState[r]={cumulativePV:0,cumulativeVolume:0,lastSessionDate:null});const s=e.taState[r],n=d.from(t).get(0),a=d.from(e.data.volume).get(0),o=d.from(e.data.openTime).get(0),h=new Date(o).toISOString().slice(0,10);if(s.lastSessionDate!==h&&(s.cumulativePV=0,s.cumulativeVolume=0,s.lastSessionDate=h),s.cumulativePV+=n*a,s.cumulativeVolume+=a,s.cumulativeVolume===0)return NaN;const u=s.cumulativePV/s.cumulativeVolume;return e.precision(u)}}function tc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`vwma_${s}`;e.taState[n]||(e.taState[n]={window:[],volumeWindow:[]});const a=e.taState[n],o=d.from(t).get(0),h=e.get(e.data.volume,0);if(a.window.unshift(o),a.volumeWindow.unshift(h),a.window.length<s)return NaN;a.window.length>s&&(a.window.pop(),a.volumeWindow.pop());let u=0,l=0;for(let g=0;g<s;g++)u+=a.window[g]*a.volumeWindow[g],l+=a.volumeWindow[g];const f=u/l;return e.precision(f)}}function ic(e){return t=>{e.taState||(e.taState={});const i=t||"wad";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.close,1);if(isNaN(s)||isNaN(n)||isNaN(a))return e.precision(r.cumulativeSum);let h=0;if(!isNaN(o)){const u=Math.max(n,o),l=Math.min(a,o),f=s-o;f>0?h=s-l:f<0&&(h=s-u)}return r.cumulativeSum+=h,e.precision(r.cumulativeSum)}}function rc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`wma_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();let h=0,u=0;for(let f=0;f<s;f++){const g=s-f;h+=a.window[f]*g,u+=g}const l=h/u;return e.precision(l)}}function sc(e){return(t,i)=>{const r=d.from(t).get(0);e.taState||(e.taState={});const s=i||`wpr_${r}`;e.taState[s]||(e.taState[s]={highWindow:[],lowWindow:[]});const n=e.taState[s],a=e.get(e.data.high,0),o=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(h))return NaN;if(n.highWindow.unshift(a),n.lowWindow.unshift(o),n.highWindow.length<r)return NaN;n.highWindow.length>r&&(n.highWindow.pop(),n.lowWindow.pop());let u=n.highWindow[0],l=n.lowWindow[0];for(let p=1;p<r;p++)n.highWindow[p]>u&&(u=n.highWindow[p]),n.lowWindow[p]<l&&(l=n.lowWindow[p]);const f=u-l;if(f===0)return e.precision(0);const g=(u-h)/f*-100;return e.precision(g)}}function nc(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.open,0),s=e.get(e.data.high,0),n=e.get(e.data.low,0),a=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(n)||isNaN(a))return NaN;const o=s-n;if(o===0)return e.precision(0);const h=(i-r)/o*a;return e.precision(h)}}var ac=Object.defineProperty,oc=(e,t,i)=>t in e?ac(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,S=(e,t,i)=>oc(e,typeof t!="symbol"?t+"":t,i);const hc={accdist:Gh,alma:Yh,atr:Qh,barssince:Xh,bb:Zh,bbw:Jh,cci:eu,change:tu,cmo:iu,cog:ru,correlation:su,cross:nu,crossover:au,crossunder:ou,cum:hu,dev:uu,dmi:cu,ema:lu,falling:pu,highest:fu,highestbars:mu,hma:du,iii:gu,kc:xu,kcw:yu,linreg:wu,lowest:bu,lowestbars:vu,macd:_u,median:Su,mfi:Eu,mode:Nu,mom:Cu,nvi:ku,obv:Iu,param:Au,percentile_linear_interpolation:Pu,percentile_nearest_rank:Tu,percentrank:Ru,pivothigh:Vu,pivotlow:Mu,pvi:Lu,pvt:Bu,range:Fu,rising:ju,rma:$u,roc:Wu,rsi:qu,sar:Uu,sma:Ku,stdev:zu,stoch:Hu,supertrend:Gu,swma:Yu,tr:Qu,tsi:Xu,valuewhen:Zu,variance:Ju,vwap:ec,vwma:tc,wad:ic,wma:rc,wpr:sc,wvad:nc};class uc{constructor(t){this.context=t,S(this,"accdist"),S(this,"alma"),S(this,"atr"),S(this,"barssince"),S(this,"bb"),S(this,"bbw"),S(this,"cci"),S(this,"change"),S(this,"cmo"),S(this,"cog"),S(this,"correlation"),S(this,"cross"),S(this,"crossover"),S(this,"crossunder"),S(this,"cum"),S(this,"dev"),S(this,"dmi"),S(this,"ema"),S(this,"falling"),S(this,"highest"),S(this,"highestbars"),S(this,"hma"),S(this,"iii"),S(this,"kc"),S(this,"kcw"),S(this,"linreg"),S(this,"lowest"),S(this,"lowestbars"),S(this,"macd"),S(this,"median"),S(this,"mfi"),S(this,"mode"),S(this,"mom"),S(this,"nvi"),S(this,"obv"),S(this,"param"),S(this,"percentile_linear_interpolation"),S(this,"percentile_nearest_rank"),S(this,"percentrank"),S(this,"pivothigh"),S(this,"pivotlow"),S(this,"pvi"),S(this,"pvt"),S(this,"range"),S(this,"rising"),S(this,"rma"),S(this,"roc"),S(this,"rsi"),S(this,"sar"),S(this,"sma"),S(this,"stdev"),S(this,"stoch"),S(this,"supertrend"),S(this,"swma"),S(this,"tr"),S(this,"tsi"),S(this,"valuewhen"),S(this,"variance"),S(this,"vwap"),S(this,"vwma"),S(this,"wad"),S(this,"wma"),S(this,"wpr"),S(this,"wvad"),Object.entries(hc).forEach(([i,r])=>{this[i]=r(t)})}}class cc{constructor(t){this.context=t}logFormat(t,...i){return t.replace(/{(\d+)}/g,(r,s)=>i[s])}param(t,i=0,r){return d.from(t).get(i)}warning(t,...i){console.warn(this.logFormat(t,...i))}error(t,...i){console.error(this.logFormat(t,...i))}info(t,...i){console.log(this.logFormat(t,...i))}}class lc{constructor(t){this.context=t}param(t,i=0,r){return d.from(t).get(i)}tostring(t){return String(t)}tonumber(t){return Number(t)}lower(t){return String(t).toLowerCase()}upper(t){return String(t).toUpperCase()}trim(t){return String(t).trim()}repeat(t,i,r=""){return Array(i).fill(t).join(r||"")}replace_all(t,i,r){return String(t).replaceAll(i,r)}replace(t,i,r,s=0){const n=String(t),a=String(i),o=String(r),h=Math.floor(Number(s))||0;if(a==="")return n;let u=0,l=0;for(;;){const f=n.indexOf(a,u);if(f===-1)return n;if(l===h)return n.substring(0,f)+o+n.substring(f+a.length);l++,u=f+a.length}}contains(t,i){return String(t).includes(i)}endswith(t,i){return String(t).endsWith(i)}startswith(t,i){return String(t).startsWith(i)}pos(t,i){const r=String(t).indexOf(i);return r===-1?NaN:r}length(t){return String(t).length}match(t,i){return String(t).match(new RegExp(i))}split(t,i){return[String(t).split(i)]}substring(t,i,r){return String(t).substring(i,r)}format(t,...i){return t.replace(/{(\d+)}/g,(r,s)=>i[s])}}class pc{constructor(t){this.context=t}param(t,i=0,r){return d.from(t).get(i)}get main_period(){return this.context.timeframe}get period(){return this.context.timeframe}get multiplier(){const t=parseInt(this.context.timeframe);return isNaN(t)?1:t}get isdwm(){return["D","W","M"].includes(this.context.timeframe.slice(-1))}get isdaily(){return this.context.timeframe.slice(-1)==="D"}get isweekly(){return this.context.timeframe.slice(-1)==="W"}get ismonthly(){return this.context.timeframe.slice(-1)==="M"}get isseconds(){return this.context.timeframe.slice(-1)==="S"}get isminutes(){return parseInt(this.context.timeframe).toString()==this.context.timeframe.trim()}get isintraday(){return!this.isdwm}from_seconds(t){return t<60?Math.ceil(t/5)*5+"S":t<60*60*24?Math.ceil(t/60):t<=60*60*24*7*52?t%(60*60*24*7)===0?Math.ceil(t/604800)+"W":Math.ceil(t/(60*60*24))+"D":"12M"}in_seconds(t){const i=parseInt(t),r=t.slice(-1);return r==="S"?i:r==="D"?i*60*60*24:r==="W"?i*60*60*24*7:r==="M"?i*60*60*24*30:isNaN(i)?0:i*60}}const fc=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],mc={series:"series",title:"string",color:"string",linewidth:"number",style:"string",trackprice:"boolean",histbase:"number",offset:"number",join:"bool",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"};class dc{constructor(t){this.context=t}extractPlotOptions(t){const i={};for(let r in t)i[r]=d.from(t[r]).get(0);return i}plotchar(t,i,r){this.context.plots[i]||(this.context.plots[i]={data:[],options:this.extractPlotOptions(r),title:i});const s=d.from(t).get(0);this.context.plots[i].data.push({time:this.context.marketData[this.context.idx].openTime,value:s,options:{...this.extractPlotOptions(r),style:"char"}})}plot(...t){const i=Ut(t,fc,mc),{series:r,title:s,...n}=i,a=this.extractPlotOptions(n);this.context.plots[s]||(this.context.plots[s]={data:[],options:a,title:s});const o=d.from(r).get(0);this.context.plots[s].data.push({time:this.context.marketData[this.context.idx].openTime,value:o,options:{color:a.color,offset:a.offset}})}}class gc{constructor(t){this.context=t}get style_dashed(){return"dashed"}get style_solid(){return"solid"}get style_dotted(){return"dotted"}param(t,i=0,r){return d.from(t).get(i)}any(t,i,r,s,n,a,o){return this.context.pine.plot(t,{title:i,color:r,linestyle:s,linewidth:n,editable:a,display:o})}}var xc=Object.defineProperty,yc=(e,t,i)=>t in e?xc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,j=(e,t,i)=>yc(e,typeof t!="symbol"?t+"":t,i);const gr=class Xt{constructor({marketData:t,source:i,tickerId:r,timeframe:s,limit:n,sDate:a,eDate:o,fullContext:h}){j(this,"data",{open:new d([]),high:new d([]),low:new d([]),close:new d([]),volume:new d([]),hl2:new d([]),hlc3:new d([]),ohlc4:new d([]),hlcc4:new d([])}),j(this,"indicator"),j(this,"cache",{}),j(this,"taState",{}),j(this,"isSecondaryContext",!1),j(this,"NA",NaN),j(this,"lang"),j(this,"pine"),j(this,"idx",0),j(this,"params",{}),j(this,"const",{}),j(this,"var",{}),j(this,"let",{}),j(this,"result"),j(this,"plots",{}),j(this,"marketData"),j(this,"source"),j(this,"tickerId"),j(this,"timeframe",""),j(this,"limit"),j(this,"sDate"),j(this,"eDate"),j(this,"fullContext"),j(this,"pineTSCode"),this.marketData=t,this.source=i,this.tickerId=r,this.timeframe=s,this.limit=n,this.sDate=a,this.eDate=o,this.fullContext=h||this;const u=new jo(this),l={na:u.na.bind(u),color:u.color,nz:u.nz.bind(u),indicator:u.indicator.bind(u),fixnan:u.fixnan.bind(u),alertcondition:u.alertcondition.bind(u),bool:u.bool.bind(u)},f=this;this.pine={input:new oh(this),ta:new uc(this),math:new jh(this),request:new Hh(this),array:new la(this),map:new Ca(this),matrix:new Ao(this),syminfo:null,timeframe:new pc(this),barstate:new Do(this),get bar_index(){return f.idx},get last_bar_index(){return f.data.close.length-1},get last_bar_time(){return f.data.openTime.get(f.data.openTime.length-1)},get timenow(){return new Date().getTime()},log:new cc(this),str:new lc(this),...l,...Gn};const g=new dc(this),p=new gc(this);this.bindContextObject(g,["plot","plotchar"]),this.bindContextObject(p,["any","style_dashed","style_solid","style_dotted","param"],"hline")}bindContextObject(t,i,r=""){r&&!this.pine[r]&&(this.pine[r]={});const s=r?this.pine[r]:this.pine;for(const n of i)typeof t[n]=="function"?s[n]=t[n].bind(t):s[n]=t[n]}init(t,i,r=0){let s;return i instanceof d?s=i.get(0):Array.isArray(i)?Array.isArray(i[0])?s=i[0]:s=i[i.length-1+r]:s=i,t?t instanceof d?(t.data[t.data.length-1]=s,t):Array.isArray(t)?(t[t.length-1]=s,new d(t)):new d([s]):new d([s])}initVar(t,i){if(t)return t;let r;return i instanceof d?r=i.get(0):Array.isArray(i)?Array.isArray(i[0])?r=i[0]:r=this.precision(i[i.length-1]):r=this.precision(i),new d([r])}precision(t,i=10){const r=10**i;return typeof t=="number"?Math.round(t*r)/r:t}param(t,i,r){return typeof t=="string"?t:t instanceof d?i?new d(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(this.params[r]||(this.params[r]=[]),Array.isArray(t)?new d(t,i||0):(this.params[r].length===0?this.params[r].push(t):this.params[r][this.params[r].length-1]=t,new d(this.params[r],0)))}get(t,i){if(t instanceof d)return t.get(i);if(Array.isArray(t)){const r=t.length-1-i;return r<0||r>=t.length?NaN:t[r]}return t}set(t,i){if(t instanceof d){t.set(0,i);return}if(Array.isArray(t)){t.length>0?t[t.length-1]=i:t.push(i);return}}get math(){return this._showDeprecationWarning("const math = context.math","const { math, ta, input } = context.pine"),this.pine.math}get ta(){return this._showDeprecationWarning("const ta = context.ta","const { ta, math, input } = context.pine"),this.pine.ta}get input(){return this._showDeprecationWarning("const input = context.input","const { input, math, ta } = context.pine"),this.pine.input}get request(){return this._showDeprecationWarning("const request = context.request","const { request, math, ta } = context.pine"),this.pine.request}get array(){return this._showDeprecationWarning("const array = context.array","const { array, math, ta } = context.pine"),this.pine.array}get core(){return this._showDeprecationWarning("context.core.*","context.pine (e.g., const { na, plotchar, color, plot, nz } = context.pine)"),{na:this.pine.na,plotchar:this.pine.plotchar,color:this.pine.color,plot:this.pine.plot,nz:this.pine.nz}}_showDeprecationWarning(t,i){const r=`${t}->${i}`;Xt._deprecationWarningsShown.has(r)||(Xt._deprecationWarningsShown.add(r),typeof window<"u"?console.warn("%c[WARNING]%c %s syntax is deprecated. Use %s instead. This will be removed in a future version.","color: #FFA500; font-weight: bold;","color: #FFA500;",t,i):console.warn(`\x1B[33m[WARNING] ${t} syntax is deprecated. Use ${i} instead. This will be removed in a future version.\x1B[0m`))}};j(gr,"_deprecationWarningsShown",new Set);let Kt=gr;var wc=Object.defineProperty,bc=(e,t,i)=>t in e?wc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,K=(e,t,i)=>bc(e,typeof t!="symbol"?t+"":t,i);class zt{constructor(t,i,r,s,n,a){this.source=t,this.tickerId=i,this.timeframe=r,this.limit=s,this.sDate=n,this.eDate=a,K(this,"data",[]),K(this,"open",[]),K(this,"high",[]),K(this,"low",[]),K(this,"close",[]),K(this,"volume",[]),K(this,"hl2",[]),K(this,"hlc3",[]),K(this,"ohlc4",[]),K(this,"hlcc4",[]),K(this,"openTime",[]),K(this,"closeTime",[]),K(this,"_readyPromise",null),K(this,"_ready",!1),K(this,"_debugSettings",{ln:!1,debug:!1}),K(this,"_transpiledCode",null),K(this,"_isSecondaryContext",!1),K(this,"_syminfo"),this._readyPromise=new Promise(o=>{this.loadMarketData(t,i,r,s,n,a).then(h=>{const u=h;this.data=u;const l=u.map(C=>C.open),f=u.map(C=>C.close),g=u.map(C=>C.high),p=u.map(C=>C.low),x=u.map(C=>C.volume),y=u.map(C=>(C.high+C.low+C.close)/3),w=u.map(C=>(C.high+C.low)/2),E=u.map(C=>(C.high+C.low+C.open+C.close)/4),A=u.map(C=>(C.high+C.low+C.close+C.close)/4),k=u.map(C=>C.openTime),T=u.map(C=>C.closeTime);this.open=l,this.close=f,this.high=g,this.low=p,this.volume=x,this.hl2=w,this.hlc3=y,this.ohlc4=E,this.hlcc4=A,this.openTime=k,this.closeTime=T,t&&t.getSymbolInfo?t.getSymbolInfo(i).then(C=>{this._syminfo=C,this._ready=!0,o(!0)}).catch(C=>{console.warn("Failed to get symbol info, using default values:",C),this._ready=!0,o(!0)}):(this._ready=!0,o(!0))})})}get transpiledCode(){return this._transpiledCode}markAsSecondary(){this._isSecondaryContext=!0}setDebugSettings({ln:t,debug:i}){this._debugSettings.ln=t,this._debugSettings.debug=i}async loadMarketData(t,i,r,s,n,a){return Array.isArray(t)?t:t.getMarketData(i,r,s,n,a)}async ready(){if(this._ready)return!0;if(!this._readyPromise)throw new Error("PineTS is not ready");return this._readyPromise}run(t,i,r){if(r&&r>0){const s=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(t,i,r,s)}else return this._runComplete(t,i)}async _runComplete(t,i){await this.ready(),i||(i=this.data.length);const r=this._initializeContext(t,this._isSecondaryContext);return this._transpiledCode=this._transpileCode(t),await this._executeIterations(r,this._transpiledCode,this.data.length-i,this.data.length),r}async*_runPaginated(t,i,r,s=!1){await this.ready(),i||(i=this.data.length);const n=this._initializeContext(t,this._isSecondaryContext);this._transpiledCode=this._transpileCode(t);let a=this.data.length-i;for(;;){const o=this.data.length-a;if(o>0){const l=Math.min(o,r),f=this._getResultLength(n.result);await this._executeIterations(n,this._transpiledCode,a,a+l),a+=l,yield this._createPageContext(n,f);continue}if(!s||Array.isArray(this.source))break;const{newCandles:h,updatedLastCandle:u}=await this._updateMarketData();if(h===0&&!u){yield null;continue}this._removeLastResult(n),a=this.data.length-(h+1),n.pine.barstate.setLive()}}_getResultLength(t){if(Array.isArray(t))return t.length;if(typeof t=="object"&&t!==null){const i=Object.keys(t);if(i.length>0&&Array.isArray(t[i[0]]))return t[i[0]].length}return 0}_createPageContext(t,i){const r=new Kt({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,fullContext:t});if(r.pineTSCode=t.pineTSCode,r.idx=t.idx,Array.isArray(t.result))r.result=t.result.slice(i);else if(typeof t.result=="object"&&t.result!==null){r.result={};for(let s in t.result)Array.isArray(t.result[s])?r.result[s]=t.result[s].slice(i):r.result[s]=t.result[s]}else r.result=t.result;return r.plots={...t.plots},r}async _updateMarketData(t){if(Array.isArray(this.source))return{newCandles:0,updatedLastCandle:!1};const i=this.source,r=this.data.length-1,s=this.data[r].openTime;try{const n=await i.getMarketData(this.tickerId,this.timeframe,void 0,s,t);if(!n||n.length===0)return{newCandles:0,updatedLastCandle:!1};let a=!1,o=0;for(let h=0;h<n.length;h++){const u=n[h];u.openTime===s?(this._replaceCandle(r,u),a=!0):u.openTime>s&&(this._appendCandle(u),o++)}return{newCandles:o,updatedLastCandle:a}}catch(n){return console.error("Error updating market data:",n),{newCandles:0,updatedLastCandle:!1}}}_replaceCandle(t,i){this.data[t]=i,this.open[t]=i.open,this.close[t]=i.close,this.high[t]=i.high,this.low[t]=i.low,this.volume[t]=i.volume,this.hl2[t]=(i.high+i.low)/2,this.hlc3[t]=(i.high+i.low+i.close)/3,this.ohlc4[t]=(i.high+i.low+i.open+i.close)/4,this.hlcc4[t]=(i.high+i.low+i.close+i.close)/4,this.openTime[t]=i.openTime,this.closeTime[t]=i.closeTime}_appendCandle(t){this.data.push(t),this.open.push(t.open),this.close.push(t.close),this.high.push(t.high),this.low.push(t.low),this.volume.push(t.volume),this.hl2.push((t.high+t.low)/2),this.hlc3.push((t.high+t.low+t.close)/3),this.ohlc4.push((t.high+t.low+t.open+t.close)/4),this.hlcc4.push((t.high+t.low+t.close+t.close)/4),this.openTime.push(t.openTime),this.closeTime.push(t.closeTime)}_removeLastResult(t){if(Array.isArray(t.result))t.result.pop();else if(typeof t.result=="object"&&t.result!==null)for(let i in t.result)Array.isArray(t.result[i])&&t.result[i].pop();t.data.close.data.pop(),t.data.open.data.pop(),t.data.high.data.pop(),t.data.low.data.pop(),t.data.volume.data.pop(),t.data.hl2.data.pop(),t.data.hlc3.data.pop(),t.data.ohlc4.data.pop(),t.data.hlcc4.data.pop(),t.data.openTime.data.pop(),t.data.closeTime&&t.data.closeTime.data.pop()}_initializeContext(t,i=!1){const r=new Kt({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate});return r.pine.syminfo=this._syminfo,r.pineTSCode=t,r.isSecondaryContext=i,r.data.close=new d([]),r.data.open=new d([]),r.data.high=new d([]),r.data.low=new d([]),r.data.volume=new d([]),r.data.hl2=new d([]),r.data.hlc3=new d([]),r.data.ohlc4=new d([]),r.data.hlcc4=new d([]),r.data.openTime=new d([]),r.data.closeTime=new d([]),r}_transpileCode(t){return cn.bind(this)(t,this._debugSettings)}async _executeIterations(t,i,r,s){const n=["const","var","let","params"];for(let a=r;a<s;a++){t.idx=a,t.data.close.data.push(this.close[a]),t.data.open.data.push(this.open[a]),t.data.high.data.push(this.high[a]),t.data.low.data.push(this.low[a]),t.data.volume.data.push(this.volume[a]),t.data.hl2.data.push(this.hl2[a]),t.data.hlc3.data.push(this.hlc3[a]),t.data.ohlc4.data.push(this.ohlc4[a]),t.data.hlcc4.data.push(this.hlcc4[a]),t.data.openTime.data.push(this.openTime[a]),t.data.closeTime.data.push(this.closeTime[a]);const o=await i(t);if(typeof o=="object"){typeof t.result!="object"&&(t.result={});for(let h in o){t.result[h]===void 0&&(t.result[h]=[]);let u;o[h]instanceof d?u=o[h].get(0):Array.isArray(o[h])?u=o[h][o[h].length-1]:u=o[h],t.result[h].push(u)}}else Array.isArray(t.result)||(t.result=[]),t.result.push(o);for(let h of n)for(let u in t[h]){const l=t[h][u];if(l instanceof d){const f=l.get(0);l.data.push(f)}else if(Array.isArray(l)){const f=l[l.length-1];l.push(f)}}}}}var vc=Object.defineProperty,_c=(e,t,i)=>t in e?vc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Ht=(e,t,i)=>_c(e,typeof t!="symbol"?t+"":t,i);const xr="https://api.binance.com/api/v3",Gt={1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",45:null,60:"1h",120:"2h",180:null,240:"4h","4H":"4h","1D":"1d",D:"1d","1W":"1w",W:"1w","1M":"1M",M:"1M"};class Sc{constructor(t=5*60*1e3){Ht(this,"cache"),Ht(this,"cacheDuration"),this.cache=new Map,this.cacheDuration=t}generateKey(t){return Object.entries(t).filter(([i,r])=>r!==void 0).map(([i,r])=>`${i}:${r}`).join("|")}get(t){const i=this.generateKey(t),r=this.cache.get(i);return r?Date.now()-r.timestamp>this.cacheDuration?(this.cache.delete(i),null):r.data:null}set(t,i){const r=this.generateKey(t);this.cache.set(r,{data:i,timestamp:Date.now()})}clear(){this.cache.clear()}cleanup(){const t=Date.now();for(const[i,r]of this.cache.entries())t-r.timestamp>this.cacheDuration&&this.cache.delete(i)}}class Ec{constructor(){Ht(this,"cacheManager"),this.cacheManager=new Sc(5*60*1e3)}async getMarketDataInterval(t,i,r,s){try{const n=Gt[i.toUpperCase()];if(!n)return console.error(`Unsupported timeframe: ${i}`),[];const a={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3};let o=[],h=r;const u=s,l=a[n];if(!l)return console.error(`Duration not defined for interval: ${n}`),[];for(;h<u;){const f=Math.min(h+1e3*l,u),g=await this.getMarketData(t,i,1e3,h,f);if(g.length===0)break;o=o.concat(g),h=g[g.length-1].closeTime+1}return o}catch(n){return console.error("Error in getMarketDataInterval:",n),[]}}async getMarketData(t,i,r,s,n){try{const a=n!==void 0,o={tickerId:t,timeframe:i,limit:r,sDate:s,eDate:n};if(a){const g=this.cacheManager.get(o);if(g)return g}const h=Gt[i.toUpperCase()];if(!h)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,s,n)&&s&&n){const g=await this.getMarketDataInterval(t,i,s,n),p=r?g.slice(0,r):g;return this.cacheManager.set(o,p),p}let u=`${xr}/klines?symbol=${t}&interval=${h}`;r&&(u+=`&limit=${Math.min(r,1e3)}`),s&&(u+=`&startTime=${s}`),n&&(u+=`&endTime=${n}`);const l=await fetch(u);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const f=(await l.json()).map(g=>({openTime:parseInt(g[0]),open:parseFloat(g[1]),high:parseFloat(g[2]),low:parseFloat(g[3]),close:parseFloat(g[4]),volume:parseFloat(g[5]),closeTime:parseInt(g[6]),quoteAssetVolume:parseFloat(g[7]),numberOfTrades:parseInt(g[8]),takerBuyBaseAssetVolume:parseFloat(g[9]),takerBuyQuoteAssetVolume:parseFloat(g[10]),ignore:g[11]}));return a&&this.cacheManager.set(o,f),f}catch(a){return console.error("Error in binance.klines:",a),[]}}shouldPaginate(t,i,r,s){if(i&&i>1e3)return!0;if(r&&s){const n=Gt[t.toUpperCase()],a={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3}[n];if(a)return Math.ceil((s-r)/a)>1e3}return!1}async getSymbolInfo(t){try{let i="crypto",r=xr,s=t,n="";t.endsWith(".P")?(i="futures",s=t.replace(".P",""),r="https://fapi.binance.com/fapi/v1",n="Perpetual"):t.includes("_")&&(i="futures",s=t,r="https://dapi.binance.com/dapi/v1",n="Delivery");const a=i==="crypto"?`${r}/exchangeInfo?symbol=${s}`:`${r}/exchangeInfo`,o=await fetch(a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const h=(await o.json()).symbols;if(!h||h.length===0)return console.error(`Symbol ${t} not found`),null;const u=i==="futures"?h.find(k=>k.symbol===s):h[0];if(!u)return console.error(`Symbol ${s} not found in exchange info`),null;const l=u.filters?.find(k=>k.filterType==="PRICE_FILTER"),f=u.filters?.find(k=>k.filterType==="LOT_SIZE"),g=l?parseFloat(l.tickSize):.01,p=f?parseFloat(f.minQty):0,x=Math.round(1/g),y=u.baseAsset,w=u.quoteAsset,E=n?` ${n}`:"",A=`${y} / ${w}${E}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:y,description:A,type:i,main_tickerid:`BINANCE:${t}`,current_contract:n,isin:"",basecurrency:y,currency:w,timezone:"Etc/UTC",country:"",mintick:g,pricescale:x,minmove:1,pointvalue:u.contractSize||1,mincontract:p,session:"24x7",volumetype:"base",expiration_date:u.deliveryDate||0,employees:0,industry:"",sector:"",shareholders:0,shares_outstanding_float:0,shares_outstanding_total:0,recommendations_buy:0,recommendations_buy_strong:0,recommendations_date:0,recommendations_hold:0,recommendations_sell:0,recommendations_sell_strong:0,recommendations_total:0,target_price_average:0,target_price_date:0,target_price_estimates:0,target_price_high:0,target_price_low:0,target_price_median:0}}catch(i){return console.error("Error in binance.exchangeInfo:",i),null}}}class Nc{async getMarketData(){return[]}}const Cc=typeof process<"u"&&process.versions&&process.versions.node;let yt=null;if(Cc)try{yt=new Nc}catch{yt=null}const kc={Binance:new Ec,...yt?{Mock:yt}:{}};Ce.Context=Kt,Ce.PineTS=zt,Ce.Provider=kc,Object.defineProperty(Ce,"__esModule",{value:!0})});
113
+ `)}generateNestedIfAsExpression(t){if(t.type==="IfStatement"){if(this.write("("),this.generateExpression(t.test),this.write(" ? "),t.consequent.type==="BlockStatement"&&t.consequent.body.length>0){const i=t.consequent.body[t.consequent.body.length-1];i.type==="ExpressionStatement"?this.generateExpression(i.expression):i.type==="IfStatement"&&this.generateNestedIfAsExpression(i)}if(this.write(" : "),t.alternate)if(t.alternate.type==="IfStatement")this.generateNestedIfAsExpression(t.alternate);else if(t.alternate.type==="BlockStatement"&&t.alternate.body.length>0){const i=t.alternate.body[t.alternate.body.length-1];i.type==="ExpressionStatement"&&this.generateExpression(i.expression)}else this.write("false");else this.write("false");this.write(")")}}generateArrayExpression(t){this.write("[");for(let i=0;i<t.elements.length;i++)this.generateExpression(t.elements[i]),i<t.elements.length-1&&this.write(", ");this.write("]")}generateObjectExpression(t){this.write("{");for(let i=0;i<t.properties.length;i++){const r=t.properties[i];r.key.type==="Identifier"?this.write(r.key.name):this.generateExpression(r.key),this.write(": "),this.generateExpression(r.value),i<t.properties.length-1&&this.write(", ")}this.write("}")}generateSwitchExpression(t){this.write("(");for(let i=0;i<t.cases.length;i++){const r=t.cases[i];r.test?(this.generateExpression(t.discriminant),this.write(" == "),this.generateExpression(r.test),this.write(" ? "),this.generateExpression(r.consequent),this.write(" : ")):this.generateExpression(r.consequent)}t.cases.some(i=>!i.test)||this.write("undefined"),this.write(")")}generateSequenceExpression(t){this.write("(");for(let i=0;i<t.expressions.length;i++)this.generateExpression(t.expressions[i]),i<t.expressions.length-1&&this.write(", ");this.write(")")}needsParentheses(t){return!1}}function ur(e){const t=/^\s*\/\/\s*@version\s*=\s*(\d+)\s*$/im,i=e.match(t);return i&&i[1]?parseInt(i[1],10):null}function un(e,t={}){const i=ur(e);if(i===null)return{success:!1,version:null,error:"Pine Script version not found. Please add //@version=X comment to your script."};if(i<5)return{success:!1,version:i,error:`Pine Script version ${i} is not supported. Only version 5 and above are supported.`};try{const r=new Ws(e).tokenize(),s=new nn(r).parse(),n={...t,sourceCode:e},a=new hn(n).generate(s);return{success:!0,version:i,code:a,ast:s,tokens:r}}catch(r){return{success:!1,version:i,error:r.message,stack:r.stack}}}function cn(e){if(typeof e=="function")return e.toString();{const t=ur(e);if(t===null)return e;if(t>=5){const i=un(e);if(i.success)return i.code;throw new Error(`Failed to transpile Pine Script version ${t}: ${i.error}`)}else throw new Error(`Unsupported Pine Script version ${t}. Only version 5 and above are supported.`)}}function ln(e,t={debug:!1,ln:!1}){typeof t=="boolean"&&(t={debug:t,ln:!0});const{debug:i}=t;let r=cn(e);r=Es(r);const s=i?r.split(`
114
+ `):[],n=ji(r,{ecmaVersion:"latest",sourceType:"module",locations:i});Ns(n),vs(n),bs(n);const a=new ds;Cs(n,a);const o=As(n,a)||"";Ms(n,a,o,t,s),Os(n);const h=us||Lt||void 0,u=Object.assign({},h,{LineComment(f,g){g.write("//"+f.value)}}),l=Gi(n,{generator:u,comments:i});return new Function("",`var _r = ${l}
115
+ ; return _r;`)(this)}function pn(e){return t=>new F(t.array.map(i=>Math.abs(i)),t.type,e)}function fn(e){return t=>{let i=0,r=0;for(const s of t.array){const n=Number(s);isNaN(n)||(r++,i+=(n-i)/r)}return r===0?NaN:e.precision(i)}}function mn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length-1;for(;s<=n;){const a=Math.floor((s+n)/2),o=r[a];if(o===i)return a;o<i?s=a+1:n=a-1}return-1}}function dn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length;for(;s<n;){const a=Math.floor((s+n)/2);r[a]<i?s=a+1:n=a}return s<r.length&&r[s]===i?s:s-1}}function gn(e){return(t,i)=>{const r=t.array;let s=0,n=r.length;for(;s<n;){const a=Math.floor((s+n)/2);r[a]<=i?s=a+1:n=a}return s>0&&r[s-1]===i?s-1:s}}function xn(e){return t=>{t.array.length=0}}function yn(e){return(t,i)=>(t.array.push(...i.array),t)}function wn(e){return t=>new F([...t.array],t.type,e)}function bn(e){return(t,i,r=!0)=>{const s=t.array,n=i.array;if(s.length!==n.length)return NaN;let a=0,o=0,h=0;const u=[];for(let x=0;x<s.length;x++){const y=Number(s[x]),w=Number(n[x]);!isNaN(y)&&y!==null&&y!==void 0&&!isNaN(w)&&w!==null&&w!==void 0&&(a+=y,o+=w,h++,u.push(x))}if(h===0)return NaN;const l=a/h,f=o/h;let g=0;for(const x of u){const y=Number(s[x]),w=Number(n[x]);g+=(y-l)*(w-f)}const p=r?h:h-1;return p<=0?NaN:e.precision(g/p)}}function vn(e){return t=>t.array.every(i=>!isNaN(i)&&i)}function _n(e){if(e.every(t=>typeof t=="number"))return e.every(t=>(t|0)===t)?W.int:W.float;if(e.every(t=>typeof t=="string"))return W.string;if(e.every(t=>typeof t=="boolean"))return W.bool;throw new Error("Cannot infer type from values")}function ge(e){if(typeof e=="number")return(e|0)===e?W.int:W.float;if(typeof e=="string")return W.string;if(typeof e=="boolean")return W.bool;throw new Error("Cannot infer type from value")}function rt(e,t){switch(t){case W.int:return typeof e=="number"&&(e|0)===e||isNaN(e);case W.float:return typeof e=="number"||isNaN(e);case W.string:return typeof e=="string";case W.bool:return typeof e=="boolean"}return!1}function Sn(e){return(t,i,r=0,s)=>{const n=t.array.length,a=s!==void 0?Math.min(s,n):n;for(let o=r;o<a;o++){if(!rt(i,t.type))throw new Error(`Cannot call 'array.fill' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array[o]=e.precision(i)}}}function En(e){return t=>t.array.length>0?t.array[0]:e.NA}function Nn(e){return(t,i)=>t.array[i]}function Cn(e){return(t,i)=>t.array.includes(i)}function kn(e){return(t,i)=>t.array.indexOf(i)}function In(e){return(t,i,r)=>{if(!rt(r,t.type))throw new Error(`Cannot call 'array.insert' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${t.type}' is expected.`);t.array.splice(i,0,r)}}function An(e){return(t,i=",")=>t.array.join(i)}function Pn(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function Tn(e){return(t,i)=>t.array.lastIndexOf(i)}function Rn(e){return(t,i=0)=>[...t.array].sort((r,s)=>s-r)[i]??e.NA}function Dn(e){return t=>{if(t.array.length===0)return NaN;const i=[...t.array].sort((s,n)=>typeof s=="number"&&typeof n=="number"?s-n:0),r=Math.floor(i.length/2);return i.length%2!==0?i[r]:(i[r-1]+i[r])/2}}function Vn(e){return(t,i=0)=>[...t.array].sort((r,s)=>r-s)[i]??e.NA}function On(e){return t=>{if(t.array.length===0)return NaN;const i=new Map;let r=0;for(const n of t.array){const a=(i.get(n)||0)+1;i.set(n,a),a>r&&(r=a)}const s=[];for(const[n,a]of i)a===r&&s.push(n);return s.sort((n,a)=>typeof n=="number"&&typeof a=="number"?n-a:typeof n=="string"&&typeof a=="string"?n<a?-1:n>a?1:0:0),s[0]}}function Mn(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const s=[];for(const h of r){const u=Number(h);if(isNaN(u)||u===null||u===void 0)return NaN;s.push(u)}s.sort((h,u)=>h-u),i<0&&(i=0),i>100&&(i=100);const n=i/100*s.length-.5;if(n<=0)return e.precision(s[0]);if(n>=s.length-1)return e.precision(s[s.length-1]);const a=Math.floor(n),o=n-a;return e.precision(s[a]*(1-o)+s[a+1]*o)}}function Ln(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const s=[];for(const o of r){const h=Number(o);!isNaN(h)&&h!==null&&h!==void 0&&s.push(h)}if(s.length===0)return NaN;s.sort((o,h)=>o-h),i<0&&(i=0),i>100&&(i=100);const n=r.length,a=Math.ceil(i/100*n);return a<=0?s[0]:a>s.length?NaN:s[a-1]}}function Bn(e){return(t,i)=>{if(t.array.length===0)return NaN;const r=Math.floor(i);if(r<0||r>=t.array.length)return NaN;const s=Number(t.array[r]);if(isNaN(s)||s===null||s===void 0)return NaN;let n=0;for(const o of t.array){const h=Number(o);!isNaN(h)&&h!==null&&h!==void 0&&h<s&&n++}const a=t.array.length-1;return a<=0?NaN:n/a*100}}function Fn(e){return t=>t.array.pop()}function jn(e){return(t,i)=>{if(!rt(i,t.type))throw new Error(`Cannot call 'array.push' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array.push(e.precision(i))}}function $n(e){return t=>e.precision(e.pine.array.max(t)-e.pine.array.min(t))}function Wn(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function qn(e){return t=>{t.array.reverse()}}function Un(e){return(t,i,r)=>{if(!rt(r,t.type))throw new Error(`Cannot call 'array.set' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${t.type}' is expected.`);t.array[i]=e.precision(r)}}function Kn(e){return t=>t.array.shift()}function zn(e){return t=>t.array.length}function Hn(e){return(t,i,r)=>{const s=r!==void 0?r:void 0;return new F(t.array.slice(i,s),t.type,e)}}function Gn(e){return t=>t.array.some(i=>!isNaN(i)&&i)}var ze=(e=>(e[e.ascending=1]="ascending",e[e.descending=0]="descending",e))(ze||{}),cr=(e=>(e.AED="AED",e.ARS="ARS",e.AUD="AUD",e.BDT="BDT",e.BHD="BHD",e.BRL="BRL",e.BTC="BTC",e.CAD="CAD",e.CHF="CHF",e.CLP="CLP",e.CNY="CNY",e.COP="COP",e.CZK="CZK",e.DKK="DKK",e.EGP="EGP",e.ETH="ETH",e.EUR="EUR",e.GBP="GBP",e.HKD="HKD",e.HUF="HUF",e.IDR="IDR",e.ILS="ILS",e.INR="INR",e.ISK="ISK",e.JPY="JPY",e.KES="KES",e.KRW="KRW",e.KWD="KWD",e.LKR="LKR",e.MAD="MAD",e.MXN="MXN",e.MYR="MYR",e.NGN="NGN",e.NOK="NOK",e.NONE="NONE",e.NZD="NZD",e.PEN="PEN",e.PHP="PHP",e.PKR="PKR",e.PLN="PLN",e.QAR="QAR",e.RON="RON",e.RSD="RSD",e.RUB="RUB",e.SAR="SAR",e.SEK="SEK",e.SGD="SGD",e.THB="THB",e.TND="TND",e.TRY="TRY",e.TWD="TWD",e.USD="USD",e.USDT="USDT",e.VES="VES",e.VND="VND",e.ZAR="ZAR",e))(cr||{}),lr=(e=>(e[e.sunday=1]="sunday",e[e.monday=2]="monday",e[e.tuesday=3]="tuesday",e[e.wednesday=4]="wednesday",e[e.thursday=5]="thursday",e[e.friday=6]="friday",e[e.saturday=7]="saturday",e))(lr||{}),pr=(e=>(e.all="all",e.data_window="data_window",e.none="none",e.pane="pane",e.price_scale="price_scale",e.status_line="status_line",e))(pr||{});const Yn={order:ze,currency:cr,dayofweek:lr,display:pr};function Qn(e){return(t,i=ze.ascending)=>{t.array.sort((r,s)=>{let n=isNaN(r)?1/0:r,a=isNaN(s)?1/0:s;return i===ze.ascending?n-a:a-n})}}function Xn(e){return(t,i=ze.ascending)=>{const r=t.array.map((s,n)=>n);return r.sort((s,n)=>{const a=isNaN(t.array[s])?1/0:t.array[s],o=isNaN(t.array[n])?1/0:t.array[n];return i===ze.ascending?a-o:o-a}),new F(r,W.int,e)}}function Zn(e){return t=>{const i=e.array.avg(t),r=e.array.stdev(t);return isNaN(r)?new F(t.array.map(()=>NaN),W.int,e):r===0?new F(t.array.map(()=>1),W.int,e):new F(t.array.map(s=>(s-i)/r),W.int,e)}}function Jn(e){return(t,i=!0)=>{const r=t.array,s=r.length;if(s===0)return NaN;let n=0,a=0,o=0;for(let l=0;l<s;l++){const f=Number(r[l]);!isNaN(f)&&f!==null&&f!==void 0&&(n+=f,a+=f*f,o++)}if(o===0)return NaN;const h=n/o;let u=a/o-h*h;return u<0?NaN:(!i&&o>1&&(u=u*o/(o-1)),!i&&o===1?0:e.precision(Math.sqrt(u)))}}function ea(e){return t=>e.precision(t.array.reduce((i,r)=>{const s=Number(r);return isNaN(s)?i:i+s},0))}function ta(e){return(t,i)=>{if(!rt(i,t.type))throw new Error(`Cannot call 'array.unshift' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${t.type}' is expected.`);t.array.unshift(e.precision(i))}}function ia(e){return(t,i=!0)=>{let r=0,s=0;for(const h of t.array){const u=Number(h);!isNaN(u)&&u!==null&&u!==void 0&&(r+=u,s++)}if(s===0)return NaN;const n=r/s;let a=0;for(const h of t.array){const u=Number(h);!isNaN(u)&&u!==null&&u!==void 0&&(a+=(u-n)*(u-n))}const o=i?s:s-1;return o<=0?NaN:e.precision(a/o)}}var ra=Object.defineProperty,sa=(e,t,i)=>t in e?ra(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,R=(e,t,i)=>sa(e,typeof t!="symbol"?t+"":t,i),W=(e=>(e.any="",e.box="box",e.bool="bool",e.color="color",e.float="float",e.int="int",e.label="label",e.line="line",e.linefill="linefill",e.string="string",e.table="table",e))(W||{});class F{constructor(t,i,r){this.array=t,this.type=i,this.context=r,R(this,"_abs"),R(this,"_avg"),R(this,"_binary_search"),R(this,"_binary_search_leftmost"),R(this,"_binary_search_rightmost"),R(this,"_clear"),R(this,"_concat"),R(this,"_copy"),R(this,"_covariance"),R(this,"_every"),R(this,"_fill"),R(this,"_first"),R(this,"_get"),R(this,"_includes"),R(this,"_indexof"),R(this,"_insert"),R(this,"_join"),R(this,"_last"),R(this,"_lastindexof"),R(this,"_max"),R(this,"_median"),R(this,"_min"),R(this,"_mode"),R(this,"_percentile_linear_interpolation"),R(this,"_percentile_nearest_rank"),R(this,"_percentrank"),R(this,"_pop"),R(this,"_push"),R(this,"_range"),R(this,"_remove"),R(this,"_reverse"),R(this,"_set"),R(this,"_shift"),R(this,"_size"),R(this,"_slice"),R(this,"_some"),R(this,"_sort"),R(this,"_sort_indices"),R(this,"_standardize"),R(this,"_stdev"),R(this,"_sum"),R(this,"_unshift"),R(this,"_variance"),this._abs=pn(this.context),this._avg=fn(this.context),this._binary_search=mn(this.context),this._binary_search_leftmost=dn(this.context),this._binary_search_rightmost=gn(this.context),this._clear=xn(this.context),this._concat=yn(this.context),this._copy=wn(this.context),this._covariance=bn(this.context),this._every=vn(this.context),this._fill=Sn(this.context),this._first=En(this.context),this._get=Nn(this.context),this._includes=Cn(this.context),this._indexof=kn(this.context),this._insert=In(this.context),this._join=An(this.context),this._last=Pn(this.context),this._lastindexof=Tn(this.context),this._max=Rn(this.context),this._median=Dn(this.context),this._min=Vn(this.context),this._mode=On(this.context),this._percentile_linear_interpolation=Mn(this.context),this._percentile_nearest_rank=Ln(this.context),this._percentrank=Bn(this.context),this._pop=Fn(this.context),this._push=jn(this.context),this._range=$n(this.context),this._remove=Wn(this.context),this._reverse=qn(this.context),this._set=Un(this.context),this._shift=Kn(this.context),this._size=zn(this.context),this._slice=Hn(this.context),this._some=Gn(this.context),this._sort=Qn(this.context),this._sort_indices=Xn(this.context),this._standardize=Zn(this.context),this._stdev=Jn(this.context),this._sum=ea(this.context),this._unshift=ta(this.context),this._variance=ia(this.context)}toString(){return"["+this.array.toString().replace(/,/g,", ")+"]"}abs(...t){return this._abs(this,...t)}avg(...t){return this._avg(this,...t)}binary_search(...t){return this._binary_search(this,...t)}binary_search_leftmost(...t){return this._binary_search_leftmost(this,...t)}binary_search_rightmost(...t){return this._binary_search_rightmost(this,...t)}clear(...t){return this._clear(this,...t)}concat(...t){return this._concat(this,...t)}copy(...t){return this._copy(this,...t)}covariance(...t){return this._covariance(this,...t)}every(...t){return this._every(this,...t)}fill(...t){return this._fill(this,...t)}first(...t){return this._first(this,...t)}get(...t){return this._get(this,...t)}includes(...t){return this._includes(this,...t)}indexof(...t){return this._indexof(this,...t)}insert(...t){return this._insert(this,...t)}join(...t){return this._join(this,...t)}last(...t){return this._last(this,...t)}lastindexof(...t){return this._lastindexof(this,...t)}max(...t){return this._max(this,...t)}median(...t){return this._median(this,...t)}min(...t){return this._min(this,...t)}mode(...t){return this._mode(this,...t)}percentile_linear_interpolation(...t){return this._percentile_linear_interpolation(this,...t)}percentile_nearest_rank(...t){return this._percentile_nearest_rank(this,...t)}percentrank(...t){return this._percentrank(this,...t)}pop(...t){return this._pop(this,...t)}push(...t){return this._push(this,...t)}range(...t){return this._range(this,...t)}remove(...t){return this._remove(this,...t)}reverse(...t){return this._reverse(this,...t)}set(...t){return this._set(this,...t)}shift(...t){return this._shift(this,...t)}size(...t){return this._size(this,...t)}slice(...t){return this._slice(this,...t)}some(...t){return this._some(this,...t)}sort(...t){return this._sort(this,...t)}sort_indices(...t){return this._sort_indices(this,...t)}standardize(...t){return this._standardize(this,...t)}stdev(...t){return this._stdev(this,...t)}sum(...t){return this._sum(this,...t)}unshift(...t){return this._unshift(this,...t)}variance(...t){return this._variance(this,...t)}}function na(e){return(...t)=>new F([...t],_n(t),e)}function aa(e){return(t,i)=>new F(Array(t).fill(e.precision(i||0)),ge(i||0),e)}function oa(e){return(t,i=!1)=>new F(Array(t).fill(i),W.bool,e)}function ha(e){return(t,i=NaN)=>new F(Array(t).fill(e.precision(i)),W.float,e)}function ua(e){return(t,i=0)=>new F(Array(t).fill(e.precision(i)),W.int,e)}function ca(e){return(t,i="")=>new F(Array(t).fill(i),W.string,e)}class d{constructor(t,i=0){this.data=t,this.offset=i}get(t){const i=this.data.length-1-(this.offset+t);return i<0||i>=this.data.length?NaN:this.data[i]}set(t,i){const r=this.data.length-1-(this.offset+t);r>=0&&r<this.data.length&&(this.data[r]=i)}get length(){return this.data.length}toArray(){return this.data}static from(t){return t instanceof d?t:Array.isArray(t)?new d(t):new d([t])}}function la(e){return(t,i=0)=>d.from(t).get(i)}class pa{constructor(t){this.context=t,this.abs=(i,...r)=>i.abs(...r),this.avg=(i,...r)=>i.avg(...r),this.binary_search=(i,...r)=>i.binary_search(...r),this.binary_search_leftmost=(i,...r)=>i.binary_search_leftmost(...r),this.binary_search_rightmost=(i,...r)=>i.binary_search_rightmost(...r),this.clear=(i,...r)=>i.clear(...r),this.concat=(i,...r)=>i.concat(...r),this.copy=(i,...r)=>i.copy(...r),this.covariance=(i,...r)=>i.covariance(...r),this.every=(i,...r)=>i.every(...r),this.fill=(i,...r)=>i.fill(...r),this.first=(i,...r)=>i.first(...r),this.from=na(t),this.get=(i,...r)=>i.get(...r),this.includes=(i,...r)=>i.includes(...r),this.indexof=(i,...r)=>i.indexof(...r),this.insert=(i,...r)=>i.insert(...r),this.join=(i,...r)=>i.join(...r),this.last=(i,...r)=>i.last(...r),this.lastindexof=(i,...r)=>i.lastindexof(...r),this.max=(i,...r)=>i.max(...r),this.median=(i,...r)=>i.median(...r),this.min=(i,...r)=>i.min(...r),this.mode=(i,...r)=>i.mode(...r),this.new=aa(t),this.new_bool=oa(t),this.new_float=ha(t),this.new_int=ua(t),this.new_string=ca(t),this.param=la(),this.percentile_linear_interpolation=(i,...r)=>i.percentile_linear_interpolation(...r),this.percentile_nearest_rank=(i,...r)=>i.percentile_nearest_rank(...r),this.percentrank=(i,...r)=>i.percentrank(...r),this.pop=(i,...r)=>i.pop(...r),this.push=(i,...r)=>i.push(...r),this.range=(i,...r)=>i.range(...r),this.remove=(i,...r)=>i.remove(...r),this.reverse=(i,...r)=>i.reverse(...r),this.set=(i,...r)=>i.set(...r),this.shift=(i,...r)=>i.shift(...r),this.size=(i,...r)=>i.size(...r),this.slice=(i,...r)=>i.slice(...r),this.some=(i,...r)=>i.some(...r),this.sort=(i,...r)=>i.sort(...r),this.sort_indices=(i,...r)=>i.sort_indices(...r),this.standardize=(i,...r)=>i.standardize(...r),this.stdev=(i,...r)=>i.stdev(...r),this.sum=(i,...r)=>i.sum(...r),this.unshift=(i,...r)=>i.unshift(...r),this.variance=(i,...r)=>i.variance(...r)}}function fa(e){return t=>{t.map.clear()}}function ma(e){return(t,i)=>t.map.has(i)}function da(e){return t=>{const i=new fr(e);return i.map=new Map(t.map),i}}function ga(e){return(t,i)=>{const r=t.map.get(i);return r===void 0?NaN:r}}function xa(e){return t=>{const i=Array.from(t.map.keys()),r=ge(i[0]);return new F(i,r,e)}}function ya(e){return(t,i,r)=>{const s=t.map.get(i);return t.map.set(i,r),s===void 0?NaN:s}}function wa(e){return(t,i)=>{for(const[r,s]of i.map)t.map.set(r,s)}}function ba(e){return(t,i)=>{const r=t.map.get(i);return t.map.delete(i)?r:NaN}}function va(e){return t=>t.map.size}function _a(e){return t=>{const i=Array.from(t.map.values()),r=ge(i[0]);return new F(i,r,e)}}var Sa=Object.defineProperty,Ea=(e,t,i)=>t in e?Sa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,xe=(e,t,i)=>Ea(e,typeof t!="symbol"?t+"":t,i);class fr{constructor(t){this.context=t,xe(this,"map"),xe(this,"_clear"),xe(this,"_contains"),xe(this,"_copy"),xe(this,"_get"),xe(this,"_keys"),xe(this,"_put"),xe(this,"_put_all"),xe(this,"_remove"),xe(this,"_size"),xe(this,"_values"),this.map=new Map,this._clear=fa(this.context),this._contains=ma(this.context),this._copy=da(this.context),this._get=ga(this.context),this._keys=xa(this.context),this._put=ya(this.context),this._put_all=wa(this.context),this._remove=ba(this.context),this._size=va(this.context),this._values=_a(this.context)}toString(){return`PineMapObject(${this.map.size})`}clear(...t){return this._clear(this,...t)}contains(...t){return this._contains(this,...t)}copy(...t){return this._copy(this,...t)}get(...t){return this._get(this,...t)}keys(...t){return this._keys(this,...t)}put(...t){return this._put(this,...t)}put_all(...t){return this._put_all(this,...t)}remove(...t){return this._remove(this,...t)}size(...t){return this._size(this,...t)}values(...t){return this._values(this,...t)}}function Na(e){return()=>new fr(e)}function Ca(e){return(t,i=0)=>d.from(t).get(i)}class ka{constructor(t){this.context=t,this.clear=(i,...r)=>i.clear(...r),this.contains=(i,...r)=>i.contains(...r),this.copy=(i,...r)=>i.copy(...r),this.get=(i,...r)=>i.get(...r),this.keys=(i,...r)=>i.keys(...r),this.new=Na(t),this.param=Ca(),this.put=(i,...r)=>i.put(...r),this.put_all=(i,...r)=>i.put_all(...r),this.remove=(i,...r)=>i.remove(...r),this.size=(i,...r)=>i.size(...r),this.values=(i,...r)=>i.values(...r)}}function Ia(e){return(t,i,r)=>{const s=t.matrix.length;let n=[];if(r&&(r instanceof F?n=r.array:Array.isArray(r)?n=r:n=[r]),s===0){for(let h=0;h<n.length;h++){let u=n[h];u instanceof d&&(u=u.get(0)),t.matrix.push([u])}return}const a=t.matrix[0].length,o=i!==void 0?i:a;for(let h=0;h<s;h++){let u=h<n.length?n[h]:NaN;u instanceof d&&(u=u.get(0)),t.matrix[h].splice(o,0,u)}}}function Aa(e){return(t,i,r)=>{const s=t.matrix.length;let n=[];if(r)if(r instanceof F)n=r.array;else if(Array.isArray(r))n=r;else if(r instanceof d){const u=r.get(0);Array.isArray(u)?n=u:n=[u]}else n=[r];const a=s>0?t.matrix[0].length:n.length,o=i!==void 0?i:s,h=[];for(let u=0;u<a;u++)if(u<n.length){let l=n[u];l instanceof d&&(l=l.get(0)),h.push(l)}else h.push(NaN);t.matrix.splice(o,0,h)}}function Pa(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;if(r===0)return NaN;let s=0,n=0;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(s+=h,n++)}return n===0?NaN:s/n}}function Ta(e){return(t,i)=>{const r=t.matrix.length,s=[];for(let a=0;a<r;a++)s.push(t.matrix[a][i]);const n=ge(s[0]);return new F(s,n,e)}}function Ra(e){return t=>t.matrix.length===0?0:t.matrix[0].length}function Da(e){return(t,i)=>{const r=t.matrix.length,s=i.matrix.length;if(r===0){for(let o=0;o<s;o++)t.matrix.push([...i.matrix[o]]);return}const n=t.matrix[0].length,a=s>0?i.matrix[0].length:0;if(n!==a&&s>0){console.error(`matrix.concat: Column count mismatch ${n} vs ${a}`);return}for(let o=0;o<s;o++)t.matrix.push([...i.matrix[o]])}}function Va(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0,s=new M(i,r,NaN,e);return s.matrix=t.matrix.map(n=>[...n]),s}}function Oa(e){const t=e.length;if(t===0)return 0;if(t===1)return e[0][0];if(t===2)return e[0][0]*e[1][1]-e[0][1]*e[1][0];const i=e.map(s=>[...s]);let r=1;for(let s=0;s<t;s++){let n=s;for(;n<t&&i[n][s]===0;)n++;if(n===t)return 0;n!==s&&([i[s],i[n]]=[i[n],i[s]],r*=-1),r*=i[s][s];for(let a=s+1;a<t;a++){const o=i[a][s]/i[s][s];for(let h=s;h<t;h++)i[a][h]-=o*i[s][h]}}return r}function Ma(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i!==r?NaN:Oa(t.matrix)}}function La(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new M(0,0,NaN,e);const s=t.matrix[0].length,n=new M(r,s,NaN,e);if(i instanceof M)for(let a=0;a<r;a++)for(let o=0;o<s;o++){const h=t.matrix[a][o],u=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;n.matrix[a][o]=h-u}else{const a=i;for(let o=0;o<r;o++)for(let h=0;h<s;h++)n.matrix[o][h]=t.matrix[o][h]-a}return n}}function Ba(e){const t=e.length;if(t!==2)return Array(t).fill(NaN);const i=e[0][0],r=e[0][1],s=e[1][0],n=e[1][1],a=i+n,o=i*n-r*s,h=a*a-4*o;if(h<0)return[NaN,NaN];const u=(a+Math.sqrt(h))/2,l=(a-Math.sqrt(h))/2;return[u,l]}function Fa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r){const a=ge(t.matrix[0][0]);return new F([],a,e)}const s=Ba(t.matrix),n=ge(s[0]);return new F(s,n,e)}}function ja(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new M(0,0,NaN,e);const s=new M(i,r,0,e);for(let n=0;n<i;n++)s.matrix[n][n]=1;return s}}function $a(e){return t=>{const i=t.matrix.length;return i===0?0:i*t.matrix[0].length}}function Wa(e){return(t,i,r,s,n,a)=>{const o=t.matrix.length;if(o===0)return;const h=t.matrix[0].length,u=r!==void 0?r:0,l=s!==void 0?s:o,f=n!==void 0?n:0,g=a!==void 0?a:h;for(let p=u;p<l&&!(p>=o);p++)for(let x=f;x<g&&!(x>=h);x++)t.matrix[p][x]=i}}function qa(e){return(t,i,r)=>{if(!t.matrix[i])return NaN;const s=t.matrix[i][r];return s===void 0?NaN:s}}function Ua(e){if(e.length!==2)return e.map(i=>i.map(()=>NaN));const t=e[0][0]*e[1][1]-e[0][1]*e[1][0];return t===0?[[NaN,NaN],[NaN,NaN]]:[[e[1][1]/t,-e[0][1]/t],[-e[1][0]/t,e[0][0]/t]]}function Ka(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new M(i,r,NaN,e);const s=Ua(t.matrix),n=new M(i,r,NaN,e);return n.matrix=s,n}}function za(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s+n!==i-1&&t.matrix[s][n]!==0)return!1;return!0}}function Ha(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(t.matrix[n][s]!==-t.matrix[s][n])return!1;return!0}}function Ga(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let s=0;s<i;s++)for(let n=0;n<r;n++){const a=t.matrix[s][n];if(a!==0&&a!==1)return!1}return!0}}function Ya(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s!==n&&t.matrix[s][n]!==0)return!1;return!0}}function Qa(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(s===n){if(t.matrix[s][n]!==1)return!1}else if(t.matrix[s][n]!==0)return!1;return!0}}function Xa(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;return i===r}}function Za(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let s=0;s<i;s++){let n=0;for(let a=0;a<r;a++){const o=t.matrix[s][a];if(o<0)return!1;n+=o}if(Math.abs(n-1)>1e-10)return!1}return!0}}function Ja(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let n=0;n<s;n++)if(t.matrix[s][n]!==t.matrix[n][s])return!1;return!0}}function eo(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;if(i!==r)return!1;let s=!0,n=!0;for(let a=0;a<i;a++)for(let o=0;o<r;o++)a>o&&t.matrix[a][o]!==0&&(s=!1),a<o&&t.matrix[a][o]!==0&&(n=!1);return s||n}}function to(e){return t=>{const i=t.matrix.length;if(i===0)return!0;const r=t.matrix[0].length;for(let s=0;s<i;s++)for(let n=0;n<r;n++)if(t.matrix[s][n]!==0)return!1;return!0}}function io(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0,n=i.matrix.length,a=n>0?i.matrix[0].length:0,o=r*n,h=s*a,u=new M(o,h,NaN,e);for(let l=0;l<r;l++)for(let f=0;f<s;f++){const g=t.matrix[l][f];for(let p=0;p<n;p++)for(let x=0;x<a;x++){const y=i.matrix[p][x];u.matrix[l*n+p][f*a+x]=g*y}}return u}}function ro(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let s=-1/0,n=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(h>s&&(s=h),n=!0)}return n?s:NaN}}function so(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,s=[];for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||s.push(h)}if(s.length===0)return NaN;s.sort((a,o)=>a-o);const n=Math.floor(s.length/2);return s.length%2!==0?s[n]:(s[n-1]+s[n])/2}}function no(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let s=1/0,n=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const h=t.matrix[a][o];isNaN(h)||(h<s&&(s=h),n=!0)}return n?s:NaN}}function ao(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,s=new Map;let n=0,a=NaN;for(let o=0;o<i;o++)for(let h=0;h<r;h++){const u=t.matrix[o][h];if(!isNaN(u)){const l=(s.get(u)||0)+1;s.set(u,l),l>n?(n=l,a=u):l===n&&u<a&&(a=u)}}return a}}function oo(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0;if(i instanceof M){const n=i.matrix.length,a=n>0?i.matrix[0].length:0;if(s!==n)return new M(0,0,NaN,e);const o=new M(r,a,0,e);for(let h=0;h<r;h++)for(let u=0;u<a;u++){let l=0;for(let f=0;f<s;f++)l+=t.matrix[h][f]*i.matrix[f][u];o.matrix[h][u]=l}return o}else if(i instanceof F||Array.isArray(i.array||i)){const n=i.array||i;if(s!==n.length)return new M(0,0,NaN,e);const a=new M(r,1,0,e);for(let o=0;o<r;o++){let h=0;for(let u=0;u<s;u++)h+=t.matrix[o][u]*n[u];a.matrix[o][0]=h}return a}else{const n=i,a=new M(r,s,NaN,e);for(let o=0;o<r;o++)for(let h=0;h<s;h++)a.matrix[o][h]=t.matrix[o][h]*n;return a}}}function ho(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i===r?new M(i,r,NaN,e):new M(r,i,NaN,e)}}function uo(e){return(t,i)=>{const r=t.matrix.length,s=r>0?t.matrix[0].length:0;if(r!==s)return new M(0,0,NaN,e);let n=new M(r,s,0,e);for(let h=0;h<r;h++)n.matrix[h][h]=1;let a=new M(r,s,NaN,e);for(let h=0;h<r;h++)a.matrix[h]=[...t.matrix[h]];let o=Math.floor(i);if(o<0)return new M(r,s,NaN,e);for(;o>0;){if(o%2===1){const u=new M(r,s,0,e);for(let l=0;l<r;l++)for(let f=0;f<s;f++){let g=0;for(let p=0;p<r;p++)g+=n.matrix[l][p]*a.matrix[p][f];u.matrix[l][f]=g}n=u}const h=new M(r,s,0,e);for(let u=0;u<r;u++)for(let l=0;l<s;l++){let f=0;for(let g=0;g<r;g++)f+=a.matrix[u][g]*a.matrix[g][l];h.matrix[u][l]=f}a=h,o=Math.floor(o/2)}return n}}function co(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,s=t.matrix.map(a=>[...a]);let n=0;for(let a=0;a<r&&n<i;a++){let o=n;for(;o<i&&Math.abs(s[o][a])<1e-10;)o++;if(o<i){[s[n],s[o]]=[s[o],s[n]];const h=s[n][a];for(let u=a;u<r;u++)s[n][u]/=h;for(let u=0;u<i;u++)if(u!==n){const l=s[u][a];for(let f=a;f<r;f++)s[u][f]-=l*s[n][f]}n++}}return n}}function lo(e){return(t,i)=>{const r=t.matrix.length;if(r===0){const a=ge(t.matrix[0][0]);return new F([],a,e)}const s=[];for(let a=0;a<r;a++){const o=t.matrix[a].splice(i,1);s.push(o[0])}const n=ge(s[0]);return new F(s,n,e)}}function po(e){return(t,i)=>{const r=t.matrix.splice(i,1),s=ge(r[0][0]);return new F(r[0]||[],s,e)}}function fo(e){return(t,i,r)=>{const s=t.matrix.length,n=s>0?t.matrix[0].length:0,a=i*r,o=[];for(let l=0;l<s;l++)for(let f=0;f<n;f++)o.push(t.matrix[l][f]);for(;o.length<a;)o.push(NaN);o.length>a&&(o.length=a);const h=[];let u=0;for(let l=0;l<i;l++){const f=[];for(let g=0;g<r;g++)f.push(o[u++]);h.push(f)}t.matrix=h}}function mo(e){return t=>{t.matrix.reverse();for(const i of t.matrix)i.reverse()}}function go(e){return(t,i)=>{if(!t.matrix[i]){const s=ge(t.matrix[0][0]);return new F([],s,e)}const r=ge(t.matrix[i][0]);return new F([...t.matrix[i]],r,e)}}function xo(e){return t=>t.matrix.length}function yo(e){return(t,i,r,s)=>{t.matrix[i]&&(t.matrix[i][r]=s)}}function wo(e){return(t,i=0,r="asc")=>{t.matrix.length!==0&&t.matrix.sort((s,n)=>{const a=s[i],o=n[i];return a<o?r==="asc"?-1:1:a>o?r==="asc"?1:-1:0})}}function bo(e){return(t,i,r,s,n)=>{const a=r-i,o=n-s,h=new M(a,o,NaN,e);for(let u=0;u<a;u++){const l=i+u;if(l>=t.matrix.length)break;for(let f=0;f<o;f++){const g=s+f;if(g>=t.matrix[l].length)break;h.matrix[u][f]=t.matrix[l][g]}}return h}}function vo(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new M(0,0,NaN,e);const s=t.matrix[0].length,n=new M(r,s,NaN,e);if(i instanceof M)for(let a=0;a<r;a++)for(let o=0;o<s;o++){const h=t.matrix[a][o],u=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;n.matrix[a][o]=h+u}else{const a=i;for(let o=0;o<r;o++)for(let h=0;h<s;h++)n.matrix[o][h]=t.matrix[o][h]+a}return n}}function _o(e){return(t,i,r)=>{const s=t.matrix.length;for(let n=0;n<s;n++){const a=t.matrix[n][i];t.matrix[n][i]=t.matrix[n][r],t.matrix[n][r]=a}}}function So(e){return(t,i,r)=>{const s=t.matrix[i];t.matrix[i]=t.matrix[r],t.matrix[r]=s}}function Eo(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,s=Math.min(i,r);let n=0;for(let a=0;a<s;a++)n+=t.matrix[a][a];return n}}function No(e){return t=>{const i=t.matrix.length;if(i===0)return new M(0,0,NaN,e);const r=t.matrix[0].length,s=new M(r,i,NaN,e);for(let n=0;n<i;n++)for(let a=0;a<r;a++)s.matrix[a][n]=t.matrix[n][a];return s}}var Co=Object.defineProperty,ko=(e,t,i)=>t in e?Co(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,I=(e,t,i)=>ko(e,typeof t!="symbol"?t+"":t,i);class M{constructor(t=0,i=0,r=NaN,s){if(this.context=s,I(this,"matrix"),I(this,"_add_col"),I(this,"_add_row"),I(this,"_avg"),I(this,"_col"),I(this,"_columns"),I(this,"_concat"),I(this,"_copy"),I(this,"_det"),I(this,"_diff"),I(this,"_eigenvalues"),I(this,"_eigenvectors"),I(this,"_elements_count"),I(this,"_fill"),I(this,"_get"),I(this,"_inv"),I(this,"_is_antidiagonal"),I(this,"_is_antisymmetric"),I(this,"_is_binary"),I(this,"_is_diagonal"),I(this,"_is_identity"),I(this,"_is_square"),I(this,"_is_stochastic"),I(this,"_is_symmetric"),I(this,"_is_triangular"),I(this,"_is_zero"),I(this,"_kron"),I(this,"_max"),I(this,"_median"),I(this,"_min"),I(this,"_mode"),I(this,"_mult"),I(this,"_pinv"),I(this,"_pow"),I(this,"_rank"),I(this,"_remove_col"),I(this,"_remove_row"),I(this,"_reshape"),I(this,"_reverse"),I(this,"_row"),I(this,"_rows"),I(this,"_set"),I(this,"_sort"),I(this,"_submatrix"),I(this,"_sum"),I(this,"_swap_columns"),I(this,"_swap_rows"),I(this,"_trace"),I(this,"_transpose"),this.matrix=[],t>0&&i>0)for(let n=0;n<t;n++)this.matrix.push(Array(i).fill(r));this._add_col=Ia(this.context),this._add_row=Aa(this.context),this._avg=Pa(this.context),this._col=Ta(this.context),this._columns=Ra(this.context),this._concat=Da(this.context),this._copy=Va(this.context),this._det=Ma(this.context),this._diff=La(this.context),this._eigenvalues=Fa(this.context),this._eigenvectors=ja(this.context),this._elements_count=$a(this.context),this._fill=Wa(this.context),this._get=qa(this.context),this._inv=Ka(this.context),this._is_antidiagonal=za(this.context),this._is_antisymmetric=Ha(this.context),this._is_binary=Ga(this.context),this._is_diagonal=Ya(this.context),this._is_identity=Qa(this.context),this._is_square=Xa(this.context),this._is_stochastic=Za(this.context),this._is_symmetric=Ja(this.context),this._is_triangular=eo(this.context),this._is_zero=to(this.context),this._kron=io(this.context),this._max=ro(this.context),this._median=so(this.context),this._min=no(this.context),this._mode=ao(this.context),this._mult=oo(this.context),this._pinv=ho(this.context),this._pow=uo(this.context),this._rank=co(this.context),this._remove_col=lo(this.context),this._remove_row=po(this.context),this._reshape=fo(this.context),this._reverse=mo(this.context),this._row=go(this.context),this._rows=xo(this.context),this._set=yo(this.context),this._sort=wo(this.context),this._submatrix=bo(this.context),this._sum=vo(this.context),this._swap_columns=_o(this.context),this._swap_rows=So(this.context),this._trace=Eo(this.context),this._transpose=No(this.context)}toString(){let t="";for(let i=0;i<this.matrix.length;i++)t+=t===""?"":`
116
+ `,t+="["+this.matrix[i].join(", ")+"]";return t}add_col(...t){return this._add_col(this,...t)}add_row(...t){return this._add_row(this,...t)}avg(...t){return this._avg(this,...t)}col(...t){return this._col(this,...t)}columns(...t){return this._columns(this,...t)}concat(...t){return this._concat(this,...t)}copy(...t){return this._copy(this,...t)}det(...t){return this._det(this,...t)}diff(...t){return this._diff(this,...t)}eigenvalues(...t){return this._eigenvalues(this,...t)}eigenvectors(...t){return this._eigenvectors(this,...t)}elements_count(...t){return this._elements_count(this,...t)}fill(...t){return this._fill(this,...t)}get(...t){return this._get(this,...t)}inv(...t){return this._inv(this,...t)}is_antidiagonal(...t){return this._is_antidiagonal(this,...t)}is_antisymmetric(...t){return this._is_antisymmetric(this,...t)}is_binary(...t){return this._is_binary(this,...t)}is_diagonal(...t){return this._is_diagonal(this,...t)}is_identity(...t){return this._is_identity(this,...t)}is_square(...t){return this._is_square(this,...t)}is_stochastic(...t){return this._is_stochastic(this,...t)}is_symmetric(...t){return this._is_symmetric(this,...t)}is_triangular(...t){return this._is_triangular(this,...t)}is_zero(...t){return this._is_zero(this,...t)}kron(...t){return this._kron(this,...t)}max(...t){return this._max(this,...t)}median(...t){return this._median(this,...t)}min(...t){return this._min(this,...t)}mode(...t){return this._mode(this,...t)}mult(...t){return this._mult(this,...t)}pinv(...t){return this._pinv(this,...t)}pow(...t){return this._pow(this,...t)}rank(...t){return this._rank(this,...t)}remove_col(...t){return this._remove_col(this,...t)}remove_row(...t){return this._remove_row(this,...t)}reshape(...t){return this._reshape(this,...t)}reverse(...t){return this._reverse(this,...t)}row(...t){return this._row(this,...t)}rows(...t){return this._rows(this,...t)}set(...t){return this._set(this,...t)}sort(...t){return this._sort(this,...t)}submatrix(...t){return this._submatrix(this,...t)}sum(...t){return this._sum(this,...t)}swap_columns(...t){return this._swap_columns(this,...t)}swap_rows(...t){return this._swap_rows(this,...t)}trace(...t){return this._trace(this,...t)}transpose(...t){return this._transpose(this,...t)}}function Io(e){return(t,i,r)=>new M(t,i,r,e)}function Ao(e){return(t,i=0)=>d.from(t).get(i)}class Po{constructor(t){this.context=t,this.add_col=(i,...r)=>i.add_col(...r),this.add_row=(i,...r)=>i.add_row(...r),this.avg=(i,...r)=>i.avg(...r),this.col=(i,...r)=>i.col(...r),this.columns=(i,...r)=>i.columns(...r),this.concat=(i,...r)=>i.concat(...r),this.copy=(i,...r)=>i.copy(...r),this.det=(i,...r)=>i.det(...r),this.diff=(i,...r)=>i.diff(...r),this.eigenvalues=(i,...r)=>i.eigenvalues(...r),this.eigenvectors=(i,...r)=>i.eigenvectors(...r),this.elements_count=(i,...r)=>i.elements_count(...r),this.fill=(i,...r)=>i.fill(...r),this.get=(i,...r)=>i.get(...r),this.inv=(i,...r)=>i.inv(...r),this.is_antidiagonal=(i,...r)=>i.is_antidiagonal(...r),this.is_antisymmetric=(i,...r)=>i.is_antisymmetric(...r),this.is_binary=(i,...r)=>i.is_binary(...r),this.is_diagonal=(i,...r)=>i.is_diagonal(...r),this.is_identity=(i,...r)=>i.is_identity(...r),this.is_square=(i,...r)=>i.is_square(...r),this.is_stochastic=(i,...r)=>i.is_stochastic(...r),this.is_symmetric=(i,...r)=>i.is_symmetric(...r),this.is_triangular=(i,...r)=>i.is_triangular(...r),this.is_zero=(i,...r)=>i.is_zero(...r),this.kron=(i,...r)=>i.kron(...r),this.max=(i,...r)=>i.max(...r),this.median=(i,...r)=>i.median(...r),this.min=(i,...r)=>i.min(...r),this.mode=(i,...r)=>i.mode(...r),this.mult=(i,...r)=>i.mult(...r),this.new=Io(t),this.param=Ao(),this.pinv=(i,...r)=>i.pinv(...r),this.pow=(i,...r)=>i.pow(...r),this.rank=(i,...r)=>i.rank(...r),this.remove_col=(i,...r)=>i.remove_col(...r),this.remove_row=(i,...r)=>i.remove_row(...r),this.reshape=(i,...r)=>i.reshape(...r),this.reverse=(i,...r)=>i.reverse(...r),this.row=(i,...r)=>i.row(...r),this.rows=(i,...r)=>i.rows(...r),this.set=(i,...r)=>i.set(...r),this.sort=(i,...r)=>i.sort(...r),this.submatrix=(i,...r)=>i.submatrix(...r),this.sum=(i,...r)=>i.sum(...r),this.swap_columns=(i,...r)=>i.swap_columns(...r),this.swap_rows=(i,...r)=>i.swap_rows(...r),this.trace=(i,...r)=>i.trace(...r),this.transpose=(i,...r)=>i.transpose(...r)}}var To=Object.defineProperty,Ro=(e,t,i)=>t in e?To(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Do=(e,t,i)=>Ro(e,typeof t!="symbol"?t+"":t,i);class Vo{constructor(t){this.context=t,Do(this,"_live",!1)}setLive(){this._live=!0}get isnew(){return!this._live}get islast(){return this.context.idx===this.context.data.close.data.length-1}get isfirst(){return this.context.idx===0}get ishistory(){return this.context.idx<this.context.data.close.data.length-1}get isrealtime(){return this.context.idx===this.context.data.close.data.length-1}get isconfirmed(){return this.context.data.closeTime[this.context.data.closeTime.length-1]<=new Date().getTime()}get islastconfirmedhistory(){return this.context.data.closeTime[this.context.data.closeTime.length-1]<=new Date().getTime()}}const mr={series:e=>e instanceof d||typeof e=="number",string:e=>typeof e=="string",number:e=>typeof e=="number",boolean:e=>typeof e=="boolean",array:e=>Array.isArray(e),object:e=>typeof e=="object",primitive:e=>typeof e===null||typeof e!="object"&&typeof e!="function",function:e=>typeof e=="function",undefined:e=>e===void 0,null:e=>e===null,NaN:e=>isNaN(e),remaining_options:e=>typeof e=="object"&&!(e instanceof d)};function Kt(e,t,i){Array.isArray(t)&&typeof t[0]=="string"&&(t=[t]);const r={};let s={};const n=new Array(t.length).fill(!0);for(let a=0;a<e.length;a++){const o=e[a];if(mr.remaining_options(o)){s=o;break}const h=t.map((u,l)=>n[l]?u[a]:void 0);for(let u=0;u<h.length;u++){const l=h[u];if(l===void 0){n[u]=!1;continue}const f=mr[i[l]];typeof f=="function"&&f(o)?r[l]=o:n[u]=!1}}return{...s,...r}}var Oo=Object.defineProperty,Mo=(e,t,i)=>t in e?Oo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Lo=(e,t,i)=>Mo(e,typeof t!="symbol"?t+"":t,i);const Bo=["title","shorttitle","overlay","format","precision","scale","max_bars_back","timeframe","timeframe_gaps","explicit_plot_zorder","max_lines_count","max_labels_count","max_boxes_count","calc_bars_count","max_polylines_count","dynamic_requests","behind_chart"],Fo={title:"string",shorttitle:"string",overlay:"boolean",format:"string",precision:"number",scale:"string",max_bars_back:"number",timeframe:"string",timeframe_gaps:"boolean",explicit_plot_zorder:"boolean",max_lines_count:"number",max_labels_count:"number",max_boxes_count:"number",calc_bars_count:"number",max_polylines_count:"number",dynamic_requests:"boolean",behind_chart:"boolean"};function jo(e){return Kt(e,Bo,Fo)}class $o{constructor(t){this.context=t,Lo(this,"color",{param:(i,r=0)=>d.from(i).get(r),rgb:(i,r,s,n)=>n?`rgba(${i}, ${r}, ${s}, ${n})`:`rgb(${i}, ${r}, ${s})`,new:(i,r)=>{if(i&&i.startsWith("#")){const s=i.slice(1),n=parseInt(s.slice(0,2),16),a=parseInt(s.slice(2,4),16),o=parseInt(s.slice(4,6),16);return r?`rgba(${n}, ${a}, ${o}, ${r})`:`rgb(${n}, ${a}, ${o})`}return r?`rgba(${i}, ${r})`:i},white:"white",lime:"lime",green:"green",red:"red",maroon:"maroon",black:"black",gray:"gray",blue:"blue",yellow:"yellow",orange:"orange",purple:"purple",pink:"pink",brown:"brown",teal:"teal",cyan:"cyan",navy:"navy",indigo:"indigo",violet:"violet",magenta:"magenta",rose:"rose",gold:"gold",silver:"silver",bronze:"bronze"})}extractPlotOptions(t){const i={};for(let r in t)i[r]=d.from(t[r]).get(0);return i}indicator(...t){const i=jo(t),r={title:"",shorttitle:"",overlay:!1,format:"inherit",precision:10,scale:"points",max_bars_back:0,timeframe:"",timeframe_gaps:!0,explicit_plot_zorder:!1,max_lines_count:50,max_labels_count:50,max_boxes_count:50,calc_bars_count:0,max_polylines_count:50,dynamic_requests:!1,behind_chart:!0};return this.context.indicator={...r,...i},this.context.indicator}get bar_index(){return this.context.idx}na(t){return isNaN(d.from(t).get(0))}nz(t,i=0){const r=d.from(t).get(0),s=d.from(i).get(0);return isNaN(r)?s:r}fixnan(t){const i=d.from(t);for(let r=0;r<i.length;r++){const s=i.get(r);if(!isNaN(s))return s}return NaN}alertcondition(t,i,r){}bool(t){const i=d.from(t).get(0);return!isNaN(i)&&i!==0}int(t){const i=d.from(t).get(0);if(typeof i!="number")throw new Error(`Cannot call "int" with argument "x"="${i}". An argument of "literal string" type was used but a "simple int" is expected.`);return Math.floor(i)}float(t){const i=d.from(t).get(0);if(typeof i!="number")throw new Error(`Cannot call "float" with argument "x"="${i}". An argument of "literal string" type was used but a "const float" is expected.`);return i}string(t){return d.from(t).get(0).toString()}}const Wo=[["defval","title","tooltip","inline","group","display"],["defval","title","tooltip","group","confirm","display"],["defval","title","tooltip","inline","group","confirm","display"],["defval","title","options","tooltip","inline","group","confirm","display"],["defval","title","minval","maxval","step","tooltip","inline","group","confirm","display"]],qo={defval:"primitive",title:"string",tooltip:"string",inline:"string",group:"string",display:"string",confirm:"boolean",options:"array",minval:"number",maxval:"number",step:"number"};function re(e){return Kt(e,Wo,qo)}function Uo(e){return(...t)=>re(t).defval}function Ko(e){return(...t)=>re(t).defval}function zo(e){return(...t)=>re(t).defval}function Ho(e){return(...t)=>re(t).defval}function Go(e){return(...t)=>re(t).defval}function Yo(e){return(...t)=>re(t).defval}function Qo(e){return(t,i=0)=>d.from(t).get(i)}function Xo(e){return(...t)=>re(t).defval}function Zo(e){return(...t)=>re(t).defval}function Jo(e){return(...t)=>re(t).defval}function eh(e){return(...t)=>re(t).defval}function th(e){return(...t)=>re(t).defval}function ih(e){return(...t)=>re(t).defval}function rh(e){return(...t)=>re(t).defval}function sh(e){return(...t)=>re(t).defval}var nh=Object.defineProperty,ah=(e,t,i)=>t in e?nh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Z=(e,t,i)=>ah(e,typeof t!="symbol"?t+"":t,i);const oh={any:Uo,bool:Ko,color:zo,enum:Ho,float:Go,int:Yo,param:Qo,price:Xo,session:Zo,source:Jo,string:eh,symbol:th,text_area:ih,time:rh,timeframe:sh};class hh{constructor(t){this.context=t,Z(this,"any"),Z(this,"bool"),Z(this,"color"),Z(this,"enum"),Z(this,"float"),Z(this,"int"),Z(this,"param"),Z(this,"price"),Z(this,"session"),Z(this,"source"),Z(this,"string"),Z(this,"symbol"),Z(this,"text_area"),Z(this,"time"),Z(this,"timeframe"),Object.entries(oh).forEach(([i,r])=>{this[i]=r(t)})}}function uh(e){return t=>Math.abs(d.from(t).get(0))}function ch(e){return t=>Math.acos(d.from(t).get(0))}function lh(e){return t=>Math.asin(d.from(t).get(0))}function ph(e){return t=>Math.atan(d.from(t).get(0))}function fh(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return i.reduce((r,s)=>r+s,0)/i.length}}function mh(e){return t=>Math.ceil(d.from(t).get(0))}function dh(e){return t=>Math.cos(d.from(t).get(0))}function gh(e){return()=>Math.E}function xh(e){return t=>Math.exp(d.from(t).get(0))}function yh(e){return t=>Math.floor(d.from(t).get(0))}function wh(e){return t=>Math.log(d.from(t).get(0))}function bh(e){return t=>Math.log(d.from(t).get(0))}function vh(e){return t=>Math.log10(d.from(t).get(0))}function _h(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return Math.max(...i)}}function Sh(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return Math.min(...i)}}function Eh(e){return(t,i,r)=>typeof t=="string"?t:t instanceof d?i?new d(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new d(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new d(e.params[r],0)))}function Nh(e){return()=>1.618033988749895}function Ch(e){return()=>Math.PI}function kh(e){return(t,i)=>Math.pow(d.from(t).get(0),d.from(i).get(0))}function Ih(e){return()=>Math.random()}function Ah(e){return t=>Math.round(d.from(t).get(0))}function Ph(e){return t=>e.precision(Math.round(d.from(t).get(0)/e.pine.syminfo.mintick)*e.pine.syminfo.mintick)}function Th(e){return()=>.6180339887498948}function Rh(e){return t=>Math.sign(d.from(t).get(0))}function Dh(e){return t=>Math.sin(d.from(t).get(0))}function Vh(e){return t=>Math.sqrt(d.from(t).get(0))}function Oh(e){return(t,i)=>{const r=d.from(i).get(0),s=d.from(t);let n=0;for(let a=0;a<r;a++){const o=s.get(a);n+=o}return n}}function Mh(e){return t=>Math.tan(d.from(t).get(0))}function Lh(e){return(t,i)=>{const r=d.from(t).get(0),s=d.from(i).get(0);return typeof r=="number"&&typeof s=="number"?isNaN(r)&&isNaN(s)?!0:isNaN(r)||isNaN(s)?!1:Math.abs(r-s)<1e-8:r===s}}var Bh=Object.defineProperty,Fh=(e,t,i)=>t in e?Bh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t,i)=>Fh(e,typeof t!="symbol"?t+"":t,i);const jh={abs:uh,acos:ch,asin:lh,atan:ph,avg:fh,ceil:mh,cos:dh,e:gh,exp:xh,floor:yh,ln:wh,log:bh,log10:vh,max:_h,min:Sh,param:Eh,phi:Nh,pi:Ch,pow:kh,random:Ih,round:Ah,round_to_mintick:Ph,rphi:Th,sign:Rh,sin:Dh,sqrt:Vh,sum:Oh,tan:Mh,__eq:Lh};class $h{constructor(t){this.context=t,L(this,"_cache",{}),L(this,"abs"),L(this,"acos"),L(this,"asin"),L(this,"atan"),L(this,"avg"),L(this,"ceil"),L(this,"cos"),L(this,"e"),L(this,"exp"),L(this,"floor"),L(this,"ln"),L(this,"log"),L(this,"log10"),L(this,"max"),L(this,"min"),L(this,"param"),L(this,"phi"),L(this,"pi"),L(this,"pow"),L(this,"random"),L(this,"round"),L(this,"round_to_mintick"),L(this,"rphi"),L(this,"sign"),L(this,"sin"),L(this,"sqrt"),L(this,"sum"),L(this,"tan"),L(this,"__eq"),Object.entries(jh).forEach(([i,r])=>{this[i]=r(t)})}}function Wh(e){return(t,i,r)=>{e.params[r]||(e.params[r]=[]);let s;if(t instanceof d)s=t.get(i||0);else if(Array.isArray(t)){const n=t.every(o=>o instanceof d),a=t.every(o=>!(o instanceof d)&&!Array.isArray(o));(n||a)&&t.length>=1?n?s=t.map(o=>o.get(0)):s=t:s=d.from(t).get(i||0)}else s=t;return e.params[r].length===0?e.params[r].push(s):e.params[r][e.params[r].length-1]=s,[s,r]}}const gt=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function dr(e,t,i,r,s=!1){for(let n=0;n<i.length;n++)if(i[n]<=e&&t<=r[n])return s||t>=r[n]?n:n-1;return-1}function gr(e,t,i,r,s=!1,n,a=!1){for(let o=i.length-1;o>=0;o--){if(r[o]<=t&&i[o]>=e){const h=n&&t>n;if(a&&s)for(let u=0;u<i.length;u++){if(i[u]>=e&&i[u]<t)return u;if(i[u]>=t)break}if(h&&s&&!a)for(let u=0;u<i.length;u++){if(i[u]>=e&&i[u]<t)return u;if(i[u]>=t)break}return o}if(r[o]<e)break}return-1}function qh(e){return async(t,i,r,s=!1,n=!1,a=!1,o=null,h=null)=>{const u=t[0],l=i[0],f=r[0],g=r[1],p=Array.isArray(s)?s[0]:s,x=Array.isArray(n)?n[0]:n;if(e.isSecondaryContext)return f;const y=gt.indexOf(e.timeframe),w=gt.indexOf(l);if(y==-1||w==-1)throw new Error("Invalid timeframe");if(y===w)return f;const E=y>w,A=d.from(e.data.openTime).get(0),k=d.from(e.data.closeTime).get(0),T=`${u}_${l}_${g}`,C=`${T}_prevIdx`;if(e.cache[T]){const nt=e.cache[T],bt=E?gr(A,k,nt.data.openTime.data,nt.data.closeTime.data,x,e.eDate,p):dr(A,k,nt.data.openTime.data,nt.data.closeTime.data,x);if(bt==-1)return NaN;const He=nt.params[g][bt];if(!E&&p){const wr=e.cache[C];return wr!==void 0&&wr===bt?NaN:(e.cache[C]=bt,Array.isArray(He)?[He]:He)}return Array.isArray(He)?[He]:He}const J=1e3*60*60*24*30,Y=e.sDate?e.sDate-J:void 0,H=e.sDate&&e.eDate?void 0:e.limit||1e3,st=new Ht(e.source,u,l,H,Y,void 0);st.markAsSecondary();const Te=await st.run(e.pineTSCode);e.cache[T]=Te;const Qt=E?gr(A,k,Te.data.openTime.data,Te.data.closeTime.data,x,e.eDate,p):dr(A,k,Te.data.openTime.data,Te.data.closeTime.data,x);if(Qt==-1)return NaN;const Xt=Te.params[g][Qt];return!E&&p?(e.cache[C]=Qt,NaN):Array.isArray(Xt)?[Xt]:Xt}}function Uh(e){return async(t,i,r,s=!1,n=null,a=!1,o=0)=>{const h=t[0],u=i[0],l=r[0],f=r[1];Array.isArray(s)&&s[0];const g=Array.isArray(a)?a[0]:a;if(e.isSecondaryContext)return Array.isArray(l)?[l]:l;const p=gt.indexOf(e.timeframe),x=gt.indexOf(u);if(p===-1||x===-1){if(g)return NaN;throw new Error("Invalid timeframe")}if(x>p){if(g)return NaN;throw new Error(`Timeframe ${u} is not lower than or equal to chart timeframe ${e.timeframe}`)}if(x===p)return[[l]];const y=`${h}_${u}_${f}_lower`;if(!e.cache[y]){const Y=e.sDate?e.sDate-2592e6:void 0,H=e.sDate&&e.eDate?void 0:e.limit||1e3,st=new Ht(e.source,h,u,H,Y,e.eDate);st.markAsSecondary();const Te=await st.run(e.pineTSCode);e.cache[y]=Te}const w=e.cache[y],E=d.from(e.data.openTime).get(0),A=d.from(e.data.closeTime).get(0),k=w.data.openTime.data,T=w.data.closeTime.data,C=w.params[f];if(!C)return[];const J=[];for(let Y=0;Y<k.length;Y++){const H=k[Y];if(!(T[Y]<=E)){if(H>=A)break;H>=E&&H<A&&J.push(C[Y])}}return[J]}}var Kh=Object.defineProperty,zh=(e,t,i)=>t in e?Kh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,xt=(e,t,i)=>zh(e,typeof t!="symbol"?t+"":t,i);const Hh={param:Wh,security:qh,security_lower_tf:Uh};class Gh{constructor(t){this.context=t,xt(this,"_cache",{}),xt(this,"param"),xt(this,"security"),xt(this,"security_lower_tf"),Object.entries(Hh).forEach(([i,r])=>{this[i]=r(t)})}}function Yh(e){return t=>{e.taState||(e.taState={});const i=t||"accdist";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.volume,0);if(isNaN(s)||isNaN(n)||isNaN(a)||isNaN(o))return e.precision(r.cumulativeSum);const h=n-a;let u=0;return h!==0&&(u=(s-a-(n-s))/h*o),r.cumulativeSum+=u,e.precision(r.cumulativeSum)}}function Qh(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0),h=d.from(s).get(0);e.taState||(e.taState={});const u=n||`alma_${a}_${o}_${h}`;if(!e.taState[u]){const p=o*(a-1),x=a/h,y=[];let w=0;for(let E=0;E<a;E++){const A=Math.exp(-Math.pow(E-p,2)/(2*x*x));y.push(A),w+=A}for(let E=0;E<y.length;E++)y[E]/=w;e.taState[u]={window:[],weights:y}}const l=e.taState[u],f=d.from(t).get(0);if(l.window.unshift(f),l.window.length<a)return NaN;l.window.length>a&&l.window.pop();let g=0;for(let p=0;p<a;p++)g+=l.weights[p]*l.window[a-1-p];return e.precision(g)}}function Xh(e){return(t,i)=>{const r=d.from(t).get(0);e.taState||(e.taState={});const s=i||`atr_${r}`;e.taState[s]||(e.taState[s]={prevAtr:null,initSum:0,initCount:0,prevClose:null});const n=e.taState[s],a=e.get(e.data.high,0),o=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(h))return NaN;let u;if(n.prevClose!==null){const f=a-o,g=Math.abs(a-n.prevClose),p=Math.abs(o-n.prevClose);u=Math.max(f,g,p)}else u=a-o;if(n.prevClose=h,n.initCount<r)return n.initSum+=u,n.initCount++,n.initCount===r?(n.prevAtr=n.initSum/r,e.precision(n.prevAtr)):NaN;const l=(n.prevAtr*(r-1)+u)/r;return n.prevAtr=l,e.precision(l)}}function Zh(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"barssince";e.taState[r]||(e.taState[r]={lastTrueIndex:null});const s=e.taState[r];return d.from(t).get(0)?(s.lastTrueIndex=e.idx,0):s.lastTrueIndex===null?NaN:e.idx-s.lastTrueIndex}}function Jh(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`bb_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],u=d.from(t).get(0);if(isNaN(u))return[[NaN,NaN,NaN]];if(h.window.unshift(u),h.sum+=u,h.window.length<n)return[[NaN,NaN,NaN]];if(h.window.length>n){const y=h.window.pop();h.sum-=y}const l=h.sum/n;let f=0;for(let y=0;y<n;y++)f+=Math.pow(h.window[y]-l,2);const g=Math.sqrt(f/n),p=l+a*g,x=l-a*g;return[[e.precision(p),e.precision(l),e.precision(x)]]}}function eu(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`bbw_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],u=d.from(t).get(0);if(isNaN(u))return NaN;if(h.window.unshift(u),h.sum+=u,h.window.length<n)return NaN;if(h.window.length>n){const w=h.window.pop();h.sum-=w}const l=h.sum/n;let f=0;for(let w=0;w<n;w++){const E=h.window[w]-l;f+=E*E}const g=f/n,p=Math.sqrt(g),x=a*p;if(l===0)return e.precision(0);const y=2*x/l*100;return e.precision(y)}}function tu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`cci_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=d.from(t).get(0);if(isNaN(o))return NaN;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const g=a.window.pop();a.sum-=g}const h=a.sum/s;let u=0;for(let g=0;g<s;g++)u+=Math.abs(a.window[g]-h);const l=u/s;if(l===0)return 0;const f=(o-h)/(.015*l);return e.precision(f)}}function iu(e){return(t,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`change_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<=s)return NaN;a.window.length>s+1&&a.window.pop();const h=o-a.window[s];return e.precision(h)}}function ru(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`cmo_${s}`;e.taState[n]||(e.taState[n]={gainsWindow:[],lossesWindow:[],gainsSum:0,lossesSum:0});const a=e.taState[n],o=d.from(t).get(0),h=d.from(t).get(1);if(isNaN(o)||isNaN(h))return NaN;const u=o-h,l=u>=0?u:0,f=u>=0?0:-u;if(a.gainsWindow.unshift(l),a.lossesWindow.unshift(f),a.gainsSum+=l,a.lossesSum+=f,a.gainsWindow.length<s)return NaN;if(a.gainsWindow.length>s){const x=a.gainsWindow.pop(),y=a.lossesWindow.pop();a.gainsSum-=x,a.lossesSum-=y}const g=a.gainsSum+a.lossesSum;if(g===0)return e.precision(0);const p=100*(a.gainsSum-a.lossesSum)/g;return e.precision(p)}}function su(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);let a=0,o=!1;for(let l=0;l<s;l++){const f=n.get(l);if(isNaN(f)){o=!0;break}a+=f}if(o)return NaN;let h=0;for(let l=0;l<s;l++){const f=n.get(l);h+=f*(l+1)}if(a===0)return NaN;const u=-h/a;return e.precision(u)}}function nu(e){return(t,i,r,s)=>{const n=d.from(r).get(0),a=d.from(t),o=d.from(i);if(e.idx<n-1)return NaN;let h=0,u=0,l=0,f=0,g=0,p=0;for(let A=0;A<n;A++){const k=a.get(A),T=o.get(A);isNaN(k)||isNaN(T)||(h+=k,u+=T,l+=k*T,f+=k*k,g+=T*T,p++)}if(p<2)return NaN;const x=p*l-h*u,y=p*f-h*h,w=p*g-u*u;if(y<=0||w<=0)return e.precision(0);const E=x/Math.sqrt(y*w);return e.precision(E)}}function au(e){return(t,i,r)=>{const s=d.from(t),n=d.from(i),a=s.get(0),o=n.get(0),h=s.get(1),u=n.get(1);if(isNaN(a)||isNaN(o)||isNaN(h)||isNaN(u))return!1;const l=a>o&&h<=u,f=a<o&&h>=u;return l||f}}function ou(e){return(t,i)=>{const r=d.from(t),s=d.from(i),n=r.get(0),a=s.get(0),o=r.get(1),h=s.get(1);return o<h&&n>a}}function hu(e){return(t,i)=>{const r=d.from(t),s=d.from(i),n=r.get(0),a=s.get(0),o=r.get(1),h=s.get(1);return o>h&&n<a}}function uu(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"cum";e.taState[r]||(e.taState[r]={cumulativeSum:0});const s=e.taState[r],n=d.from(t).get(0);return isNaN(n)||(s.cumulativeSum+=n),e.precision(s.cumulativeSum)}}function cu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`dev_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=d.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const f=a.window.pop();a.sum-=f}const h=a.sum/s;let u=0;for(let f=0;f<s;f++)u+=Math.abs(a.window[f]-h);const l=u/s;return e.precision(l)}}function lu(e){return(t,i,r)=>{const s=d.from(t).get(0),n=d.from(i).get(0);e.taState||(e.taState={});const a=r||`dmi_${s}_${n}`;e.taState[a]||(e.taState[a]={prevHigh:NaN,prevLow:NaN,prevClose:NaN,trInitSum:0,plusInitSum:0,minusInitSum:0,initCount:0,prevSmoothedTR:NaN,prevSmoothedPlus:NaN,prevSmoothedMinus:NaN,dxInitSum:0,adxInitCount:0,prevADX:NaN});const o=e.taState[a],h=e.get(e.data.high,0),u=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(h)||isNaN(u)||isNaN(l))return[[NaN,NaN,NaN]];if(isNaN(o.prevHigh))return o.prevHigh=h,o.prevLow=u,o.prevClose=l,[[NaN,NaN,NaN]];const f=Math.max(h-u,Math.abs(h-o.prevClose),Math.abs(u-o.prevClose)),g=h-o.prevHigh,p=o.prevLow-u,x=g>p&&g>0?g:0,y=p>g&&p>0?p:0;o.prevHigh=h,o.prevLow=u,o.prevClose=l;let w,E,A;if(o.initCount++,o.initCount<=s)o.trInitSum+=f,o.plusInitSum+=x,o.minusInitSum+=y,o.initCount===s&&(o.prevSmoothedTR=o.trInitSum/s,o.prevSmoothedPlus=o.plusInitSum/s,o.prevSmoothedMinus=o.minusInitSum/s);else{const H=1/s;o.prevSmoothedTR=H*f+(1-H)*o.prevSmoothedTR,o.prevSmoothedPlus=H*x+(1-H)*o.prevSmoothedPlus,o.prevSmoothedMinus=H*y+(1-H)*o.prevSmoothedMinus}if(w=o.prevSmoothedTR,E=o.prevSmoothedPlus,A=o.prevSmoothedMinus,o.initCount<s)return[[NaN,NaN,NaN]];const k=w===0?0:100*E/w,T=w===0?0:100*A/w,C=k+T,J=C===0?0:100*Math.abs(k-T)/C;let Y=NaN;if(o.adxInitCount++,o.adxInitCount<=n)o.dxInitSum+=J,o.adxInitCount===n&&(o.prevADX=o.dxInitSum/n,Y=o.prevADX);else{const H=1/n;o.prevADX=H*J+(1-H)*o.prevADX,Y=o.prevADX}return[[e.precision(k),e.precision(T),e.precision(Y)]]}}function pu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`ema_${s}`;e.taState[n]||(e.taState[n]={prevEma:null,initSum:0,initCount:0});const a=e.taState[n],o=d.from(t).get(0);if(o==null||isNaN(o))return NaN;if(a.initCount<s)return a.initSum+=o,a.initCount++,a.initCount===s?(a.prevEma=a.initSum/s,e.precision(a.prevEma)):NaN;const h=2/(s+1),u=o*h+a.prevEma*(1-h);return a.prevEma=u,e.precision(u)}}function fu(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);for(let a=0;a<s;a++){const o=n.get(a),h=n.get(a+1);if(isNaN(o)||isNaN(h)||o>=h)return!1}return!0}}function mu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`highest_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=Math.max(...a.window.filter(u=>!isNaN(u)));return e.precision(h)}}function du(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s-1)return NaN;let a=-1/0,o=NaN;for(let h=0;h<s;h++){const u=n.get(h);isNaN(u)||(isNaN(o)||u>a)&&(a=u,o=-h)}return o}}function gu(e){return(t,i,r)=>{const s=d.from(i).get(0),n=Math.floor(s/2),a=Math.floor(Math.sqrt(s)),o=e.ta.wma,h=o(t,n,r?`${r}_wma1`:void 0),u=o(t,s,r?`${r}_wma2`:void 0);if(isNaN(h)||isNaN(u))return NaN;e.taState||(e.taState={});const l=r||`hma_raw_${s}`;e.taState[l]||(e.taState[l]=[]);const f=2*h-u;e.taState[l].unshift(f);const g=r?`${r}_hma_final`:`hma_final_${s}`;e.taState[g]||(e.taState[g]={window:[]});const p=e.taState[g];if(p.window.unshift(f),p.window.length<a)return NaN;p.window.length>a&&p.window.pop();let x=0,y=0;for(let E=0;E<a;E++){const A=a-E;x+=p.window[E]*A,y+=A}const w=x/y;return e.precision(w)}}function xu(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.high,0),s=e.get(e.data.low,0),n=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(n))return NaN;const a=(r-s)*n;if(a===0)return e.precision(0);const o=(2*i-r-s)/a;return e.precision(o)}}function yu(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0);let h=!0;typeof s=="string"?n=s:s!==void 0&&(h=d.from(s).get(0));let u;const l=e.get(e.data.high,0),f=e.get(e.data.low,0);if(h){const T=e.get(e.data.close,1);isNaN(T)?u=NaN:u=Math.max(l-f,Math.abs(l-T),Math.abs(f-T))}else u=l-f;const g=d.from(t).get(0);e.taState||(e.taState={});const p=n||`kc_${a}_${o}_${h}`;e.taState[p]||(e.taState[p]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const x=e.taState[p],y=(T,C,J)=>{if(isNaN(C))return NaN;if(T.initCount<J)return T.initSum+=C,T.initCount++,T.initCount===J?(T.prevEma=T.initSum/J,T.prevEma):NaN;const Y=2/(J+1);return T.prevEma=C*Y+T.prevEma*(1-Y),T.prevEma},w=y(x.basisState,g,a),E=y(x.rangeState,u,a);if(isNaN(w)||isNaN(E))return[[NaN,NaN,NaN]];const A=w+E*o,k=w-E*o;return[[e.precision(w),e.precision(A),e.precision(k)]]}}function wu(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0);let h=!0;typeof s=="string"?n=s:s!==void 0&&(h=d.from(s).get(0)),e.taState||(e.taState={});const u=n||`kcw_${a}_${o}_${h}`;e.taState[u]||(e.taState[u]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const l=e.taState[u],f=(k,T,C)=>{if(isNaN(T))return NaN;if(k.initCount<C)return k.initSum+=T,k.initCount++,k.initCount===C?(k.prevEma=k.initSum/C,k.prevEma):NaN;const J=2/(C+1);return k.prevEma=T*J+k.prevEma*(1-J),k.prevEma};let g;const p=e.get(e.data.high,0),x=e.get(e.data.low,0);if(h){const k=e.get(e.data.close,1);isNaN(k)?g=NaN:g=Math.max(p-x,Math.abs(p-k),Math.abs(x-k))}else g=p-x;const y=d.from(t).get(0),w=f(l.basisState,y,a),E=f(l.rangeState,g,a);if(isNaN(w)||isNaN(E))return NaN;if(w===0)return e.precision(0);const A=2*E*o/w;return e.precision(A)}}function bu(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`linreg_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[]});const h=e.taState[o],u=d.from(t).get(0);if(h.window.unshift(u),h.window.length<n)return NaN;h.window.length>n&&h.window.pop();let l=0,f=0,g=0,p=0;const x=n;for(let A=0;A<n;A++){const k=n-1-A,T=h.window[A];l+=k,f+=T,g+=k*T,p+=k*k}const y=x*p-l*l;if(y===0)return NaN;const w=(x*g-l*f)/y,E=(f-w*l)/x+w*(n-1-a);return e.precision(E)}}function vu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`lowest_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=a.window.filter(l=>!isNaN(l)&&l!==void 0),u=h.length>0?Math.min(...h):NaN;return e.precision(u)}}function _u(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s-1)return NaN;let a=1/0,o=NaN;for(let h=0;h<s;h++){const u=n.get(h);isNaN(u)||(isNaN(o)||u<a)&&(a=u,o=-h)}return o}}function Su(e){return(t,i,r,s,n)=>{const a=d.from(i).get(0),o=d.from(r).get(0),h=d.from(s).get(0),u=n||`macd_${a}_${o}_${h}`,l=`${u}_fast`,f=`${u}_slow`,g=`${u}_signal`,p=e.ta.ema(t,a,l),x=e.ta.ema(t,o,f);let y=NaN;!isNaN(p)&&!isNaN(x)&&(y=p-x);let w=NaN;isNaN(y)||(w=e.ta.ema(y,h,g));let E=NaN;return!isNaN(y)&&!isNaN(w)&&(E=y-w),[[e.precision(y),e.precision(w),e.precision(E)]]}}function Eu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`median_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();const h=a.window.slice().sort((f,g)=>f-g),u=Math.floor(s/2),l=s%2===0?(h[u-1]+h[u])/2:h[u];return e.precision(l)}}function Nu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`mfi_${s}`;e.taState[n]||(e.taState[n]={upperWindow:[],lowerWindow:[],upperSum:0,lowerSum:0});const a=e.taState[n],o=d.from(t).get(0),h=d.from(t).get(1),u=e.get(e.data.volume,0);if(isNaN(o)||isNaN(u))return NaN;const l=isNaN(h)?NaN:o-h;let f=0,g=0;if(f=u*(l<=0?0:o),g=u*(l>=0?0:o),a.upperWindow.unshift(f),a.lowerWindow.unshift(g),a.upperSum+=f,a.lowerSum+=g,a.upperWindow.length<s)return NaN;if(a.upperWindow.length>s){const x=a.upperWindow.pop(),y=a.lowerWindow.pop();a.upperSum-=x,a.lowerSum-=y}if(a.lowerSum===0)return a.upperSum,e.precision(100);if(a.upperSum===0)return e.precision(0);const p=100-100/(1+a.upperSum/a.lowerSum);return e.precision(p)}}function Cu(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s-1)return NaN;const a=new Map;for(let u=0;u<s;u++){const l=n.get(u);isNaN(l)||a.set(l,(a.get(l)||0)+1)}if(a.size===0)return NaN;let o=NaN,h=-1;for(const[u,l]of a.entries())l>h?(h=l,o=u):l===h&&u<o&&(o=u);return o}}function ku(e){return(t,i,r)=>{const s=d.from(i).get(0);return e.ta.change(t,s)}}function Iu(e){return t=>{e.taState||(e.taState={});const i=t||"nvi";e.taState[i]||(e.taState[i]={nvi:1});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),h=isNaN(s)?0:s,u=isNaN(n)?0:n,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(h===0||u===0)&&l<f){const g=(h-u)/u;r.nvi=r.nvi+g*r.nvi}return e.precision(r.nvi)}}function Au(e){return()=>{e.taState||(e.taState={});const t="obv";e.taState[t]||(e.taState[t]={prevOBV:0});const i=e.taState[t],r=e.get(e.data.close,0),s=e.get(e.data.volume,0),n=e.get(e.data.close,1);if(isNaN(n))return i.prevOBV=0,e.precision(0);let a;return r>n?a=i.prevOBV+s:r<n?a=i.prevOBV-s:a=i.prevOBV,i.prevOBV=a,e.precision(a)}}function Pu(e){return(t,i,r)=>t instanceof d?i?new d(t.data,t.offset+i):t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new d(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new d(e.params[r],0)))}function Tu(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t);if(e.idx<n-1)return NaN;const h=[];for(let x=0;x<n;x++){const y=o.get(x);if(isNaN(y))return NaN;h.push(y)}h.sort((x,y)=>x-y);let u=a/100*n-.5;u<0&&(u=0),u>n-1&&(u=n-1);const l=Math.floor(u),f=Math.ceil(u);if(l===f)return e.precision(h[l]);const g=u-l,p=h[l]+g*(h[f]-h[l]);return e.precision(p)}}function Ru(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t);if(e.idx<n-1)return NaN;const h=[];for(let l=0;l<n;l++){const f=o.get(l);isNaN(f)||h.push(f)}if(h.length===0)return NaN;h.sort((l,f)=>l-f);let u=Math.ceil(a/100*h.length)-1;return u<0&&(u=0),u>=h.length&&(u=h.length-1),e.precision(h[u])}}function Du(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);if(e.idx<s)return NaN;const a=n.get(0);if(isNaN(a))return NaN;let o=0,h=0;for(let u=1;u<=s;u++){const l=n.get(u);isNaN(l)||(h++,l<=a&&o++)}return h===0?NaN:e.precision(o/h*100)}}function Vu(e,t,i){const r=new Array(e.length).fill(NaN);for(let s=t+i;s<e.length;s++){const n=e[s-i];let a=!0;for(let o=1;o<=t;o++)if(e[s-i-o]>=n){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[s-i+o]>=n){a=!1;break}}a&&(r[s]=n)}return r}function Ou(e){return(t,i,r,s)=>{typeof r=="string"&&(r=i,i=t,t=e.data.high);const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t).toArray(),h=Vu(o,n,a),u=e.idx;return e.precision(h[u])}}function Mu(e,t,i){const r=new Array(e.length).fill(NaN);for(let s=t+i;s<e.length;s++){const n=e[s-i];let a=!0;for(let o=1;o<=t;o++)if(e[s-i-o]<=n){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[s-i+o]<=n){a=!1;break}}a&&(r[s]=n)}return r}function Lu(e){return(t,i,r,s)=>{typeof r=="string"&&(r=i,i=t,t=e.data.low);const n=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t).toArray(),h=Mu(o,n,a),u=e.idx;return e.precision(h[u])}}function Bu(e){return t=>{e.taState||(e.taState={});const i=t||"pvi";e.taState[i]||(e.taState[i]={pvi:1});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),h=isNaN(s)?0:s,u=isNaN(n)?0:n,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(h===0||u===0)&&l>f){const g=(h-u)/u;r.pvi=r.pvi+g*r.pvi}return e.precision(r.pvi)}}function Fu(e){return t=>{e.taState||(e.taState={});const i=t||"pvt";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.close,1),a=e.get(e.data.volume,0);if(!isNaN(s)&&!isNaN(n)&&!isNaN(a)&&n!==0){const o=(s-n)/n*a;r.cumulativeSum+=o}return e.precision(r.cumulativeSum)}}function ju(e){return(t,i,r)=>{const s=e.pine.ta.highest(t,i,(r||"range")+"_h"),n=e.pine.ta.lowest(t,i,(r||"range")+"_l");return isNaN(s)||isNaN(n)?NaN:e.precision(s-n)}}function $u(e){return(t,i,r)=>{const s=d.from(i).get(0),n=d.from(t);for(let a=0;a<s;a++){const o=n.get(a),h=n.get(a+1);if(isNaN(o)||isNaN(h)||o<=h)return!1}return!0}}function Wu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`rma_${s}`;e.taState[n]||(e.taState[n]={prevRma:null,initSum:0,initCount:0});const a=e.taState[n],o=d.from(t).get(0)||0;if(a.initCount<s)return a.initSum+=o,a.initCount++,a.initCount===s?(a.prevRma=a.initSum/s,e.precision(a.prevRma)):NaN;const h=1/s,u=o*h+a.prevRma*(1-h);return a.prevRma=u,e.precision(u)}}function qu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`roc_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<=s)return NaN;a.window.length>s+1&&a.window.pop();const h=a.window[s],u=(o-h)/h*100;return e.precision(u)}}function Uu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`rsi_${s}`;e.taState[n]||(e.taState[n]={prevValue:null,avgGain:0,avgLoss:0,initGains:[],initLosses:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.prevValue!==null){const h=o-a.prevValue,u=h>0?h:0,l=h<0?-h:0;if(a.initGains.length<s){if(a.initGains.push(u),a.initLosses.push(l),a.initGains.length===s){a.avgGain=a.initGains.reduce((p,x)=>p+x,0)/s,a.avgLoss=a.initLosses.reduce((p,x)=>p+x,0)/s,a.prevValue=o;const g=a.avgLoss===0?100:100-100/(1+a.avgGain/a.avgLoss);return e.precision(g)}return a.prevValue=o,NaN}a.avgGain=(a.avgGain*(s-1)+u)/s,a.avgLoss=(a.avgLoss*(s-1)+l)/s;const f=a.avgLoss===0?100:100-100/(1+a.avgGain/a.avgLoss);return a.prevValue=o,e.precision(f)}return a.prevValue=o,NaN}}function Ku(e){return(t,i,r,s)=>{const n=d.from(t).get(0),a=d.from(i).get(0),o=d.from(r).get(0);e.taState||(e.taState={});const h=s||`sar_${n}_${a}_${o}`;e.taState[h]||(e.taState[h]={result:NaN,maxMin:NaN,acceleration:NaN,isBelow:!1,barIndex:0});const u=e.taState[h],l=e.get(e.data.high,0),f=e.get(e.data.low,0),g=e.get(e.data.close,0),p=e.get(e.data.close,1),x=e.get(e.data.high,1),y=e.get(e.data.low,1),w=e.get(e.data.high,2),E=e.get(e.data.low,2);if(isNaN(l)||isNaN(f)||isNaN(g))return NaN;let A=!1;return u.barIndex===1&&(g>p?(u.isBelow=!0,u.maxMin=l,u.result=y):(u.isBelow=!1,u.maxMin=f,u.result=x),A=!0,u.acceleration=n),u.barIndex>=1&&(u.result=u.result+u.acceleration*(u.maxMin-u.result),u.isBelow?u.result>f&&(A=!0,u.isBelow=!1,u.result=Math.max(l,u.maxMin),u.maxMin=f,u.acceleration=n):u.result<l&&(A=!0,u.isBelow=!0,u.result=Math.min(f,u.maxMin),u.maxMin=l,u.acceleration=n),A||(u.isBelow?l>u.maxMin&&(u.maxMin=l,u.acceleration=Math.min(u.acceleration+a,o)):f<u.maxMin&&(u.maxMin=f,u.acceleration=Math.min(u.acceleration+a,o))),u.isBelow?(u.result=Math.min(u.result,y),u.barIndex>1&&(u.result=Math.min(u.result,E))):(u.result=Math.max(u.result,x),u.barIndex>1&&(u.result=Math.max(u.result,w)))),u.barIndex++,u.barIndex<=1?NaN:e.precision(u.result)}}function zu(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`sma_${s}`;e.taState[n]||(e.taState[n]={window:[],sum:0});const a=e.taState[n],o=d.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<s)return NaN;if(a.window.length>s){const u=a.window.pop();a.sum-=u}const h=a.sum/s;return e.precision(h)}}function Hu(e){return(t,i,r=!0,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`stdev_${n}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const h=e.taState[o],u=d.from(t).get(0);if(u==null||isNaN(u))return NaN;if(h.window.unshift(u),h.sum+=u,h.window.length<n)return NaN;if(h.window.length>n){const x=h.window.pop();h.sum-=x}const l=h.sum/n;let f=0;for(let x=0;x<n;x++)f+=Math.pow(h.window[x]-l,2);const g=a?n:n-1,p=Math.sqrt(f/g);return e.precision(p)}}function Gu(e){return(t,i,r,s,n)=>{const a=d.from(s).get(0);e.taState||(e.taState={});const o=n||`stoch_${a}`;e.taState[o]||(e.taState[o]={highWindow:[],lowWindow:[]});const h=e.taState[o],u=d.from(t).get(0),l=d.from(i).get(0),f=d.from(r).get(0);if(isNaN(u)||isNaN(l)||isNaN(f))return NaN;if(h.highWindow.unshift(l),h.lowWindow.unshift(f),h.highWindow.length<a)return NaN;h.highWindow.length>a&&(h.highWindow.pop(),h.lowWindow.pop());let g=h.highWindow[0],p=h.lowWindow[0];for(let w=1;w<a;w++)h.highWindow[w]>g&&(g=h.highWindow[w]),h.lowWindow[w]<p&&(p=h.lowWindow[w]);const x=g-p;if(x===0)return NaN;const y=100*(u-p)/x;return e.precision(y)}}function Yu(e){return(t,i,r)=>{const s=d.from(t).get(0),n=d.from(i).get(0);e.taState||(e.taState={});const a=r||`supertrend_${s}_${n}`;e.taState[a]||(e.taState[a]={trWindow:[],trSum:0,atrValue:NaN,atrCount:0,prevLowerBand:NaN,prevUpperBand:NaN,prevSuperTrend:NaN,prevDirection:NaN,prevClose:NaN});const o=e.taState[a],h=e.get(e.data.high,0),u=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(h)||isNaN(u)||isNaN(l))return[[NaN,NaN]];const f=(h+u)/2;let g;isNaN(o.prevClose)?g=h-u:g=Math.max(h-u,Math.abs(h-o.prevClose),Math.abs(u-o.prevClose)),o.atrCount++,o.atrCount<=n?(o.trWindow.push(g),o.trSum+=g,o.atrCount===n&&(o.atrValue=o.trSum/n)):o.atrValue=(o.atrValue*(n-1)+g)/n;const p=o.atrValue,x=o.prevClose;if(o.prevClose=l,isNaN(p))return[[NaN,NaN]];let y=f+s*p,w=f-s*p;const E=isNaN(o.prevLowerBand)?0:o.prevLowerBand,A=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||w>E||x<E||(w=E),isNaN(o.prevUpperBand)||y<A||x>A||(y=A);let k,T;const C=o.prevSuperTrend;return o.atrCount===n?k=1:C===o.prevUpperBand?k=l>y?-1:1:k=l<w?1:-1,T=k===-1?w:y,o.prevLowerBand=w,o.prevUpperBand=y,o.prevSuperTrend=T,o.prevDirection=k,[[e.precision(T),k]]}}function Qu(e){return(t,i)=>{const r=[1,2,2,1],s=6;e.taState||(e.taState={});const n=i||"swma";e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<4)return NaN;a.window.length>4&&a.window.pop();let h=0;for(let u=0;u<4;u++)h+=r[u]*a.window[3-u];return h/=s,e.precision(h)}}function Xu(e){return(t,i)=>{let r=!0;typeof t=="string"||t!==void 0&&(r=d.from(t).get(0));const s=e.get(e.data.high,0),n=e.get(e.data.low,0),a=e.get(e.data.close,1);if(isNaN(a))return r?e.precision(s-n):NaN;const o=Math.max(s-n,Math.abs(s-a),Math.abs(n-a));return e.precision(o)}}function Zu(e){return(t,i,r,s)=>{const n=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=s||`tsi_${n}_${a}`;e.taState[o]||(e.taState[o]={prevSource:NaN,ema1_pc_multiplier:2/(a+1),ema1_pc_value:NaN,ema1_pc_count:0,ema1_pc_sum:0,ema2_pc_multiplier:2/(n+1),ema2_pc_value:NaN,ema2_pc_count:0,ema2_pc_sum:0,ema1_abs_multiplier:2/(a+1),ema1_abs_value:NaN,ema1_abs_count:0,ema1_abs_sum:0,ema2_abs_multiplier:2/(n+1),ema2_abs_value:NaN,ema2_abs_count:0,ema2_abs_sum:0});const h=e.taState[o],u=d.from(t).get(0);if(isNaN(u))return NaN;const l=isNaN(h.prevSource)?NaN:u-h.prevSource;if(h.prevSource=u,isNaN(l))return NaN;const f=Math.abs(l);if(h.ema1_pc_count++,h.ema1_pc_count<=a?(h.ema1_pc_sum+=l,h.ema1_pc_count===a&&(h.ema1_pc_value=h.ema1_pc_sum/a)):h.ema1_pc_value=l*h.ema1_pc_multiplier+h.ema1_pc_value*(1-h.ema1_pc_multiplier),h.ema1_abs_count++,h.ema1_abs_count<=a?(h.ema1_abs_sum+=f,h.ema1_abs_count===a&&(h.ema1_abs_value=h.ema1_abs_sum/a)):h.ema1_abs_value=f*h.ema1_abs_multiplier+h.ema1_abs_value*(1-h.ema1_abs_multiplier),isNaN(h.ema1_pc_value)||isNaN(h.ema1_abs_value))return NaN;if(h.ema2_pc_count++,h.ema2_pc_count<=n?(h.ema2_pc_sum+=h.ema1_pc_value,h.ema2_pc_count===n&&(h.ema2_pc_value=h.ema2_pc_sum/n)):h.ema2_pc_value=h.ema1_pc_value*h.ema2_pc_multiplier+h.ema2_pc_value*(1-h.ema2_pc_multiplier),h.ema2_abs_count++,h.ema2_abs_count<=n?(h.ema2_abs_sum+=h.ema1_abs_value,h.ema2_abs_count===n&&(h.ema2_abs_value=h.ema2_abs_sum/n)):h.ema2_abs_value=h.ema1_abs_value*h.ema2_abs_multiplier+h.ema2_abs_value*(1-h.ema2_abs_multiplier),isNaN(h.ema2_pc_value)||isNaN(h.ema2_abs_value))return NaN;if(h.ema2_abs_value===0)return e.precision(0);const g=h.ema2_pc_value/h.ema2_abs_value;return e.precision(g)}}function Ju(e){return(t,i,r,s)=>{e.taState||(e.taState={});const n=s||"valuewhen";e.taState[n]||(e.taState[n]={values:[]});const a=e.taState[n],o=d.from(t).get(0),h=d.from(i).get(0),u=d.from(r).get(0);if(o&&a.values.push(h),isNaN(u)||u<0)return NaN;const l=a.values.length-1-u;if(l<0)return NaN;const f=a.values[l];return typeof f=="number"?e.precision(f):f}}function ec(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`variance_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();let h=0,u=0;for(let g=0;g<s;g++)h+=a.window[g],u+=a.window[g]*a.window[g];const l=h/s,f=u/s-l*l;return e.precision(f)}}function tc(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"vwap";e.taState[r]||(e.taState[r]={cumulativePV:0,cumulativeVolume:0,lastSessionDate:null});const s=e.taState[r],n=d.from(t).get(0),a=d.from(e.data.volume).get(0),o=d.from(e.data.openTime).get(0),h=new Date(o).toISOString().slice(0,10);if(s.lastSessionDate!==h&&(s.cumulativePV=0,s.cumulativeVolume=0,s.lastSessionDate=h),s.cumulativePV+=n*a,s.cumulativeVolume+=a,s.cumulativeVolume===0)return NaN;const u=s.cumulativePV/s.cumulativeVolume;return e.precision(u)}}function ic(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`vwma_${s}`;e.taState[n]||(e.taState[n]={window:[],volumeWindow:[]});const a=e.taState[n],o=d.from(t).get(0),h=e.get(e.data.volume,0);if(a.window.unshift(o),a.volumeWindow.unshift(h),a.window.length<s)return NaN;a.window.length>s&&(a.window.pop(),a.volumeWindow.pop());let u=0,l=0;for(let g=0;g<s;g++)u+=a.window[g]*a.volumeWindow[g],l+=a.volumeWindow[g];const f=u/l;return e.precision(f)}}function rc(e){return t=>{e.taState||(e.taState={});const i=t||"wad";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],s=e.get(e.data.close,0),n=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.close,1);if(isNaN(s)||isNaN(n)||isNaN(a))return e.precision(r.cumulativeSum);let h=0;if(!isNaN(o)){const u=Math.max(n,o),l=Math.min(a,o),f=s-o;f>0?h=s-l:f<0&&(h=s-u)}return r.cumulativeSum+=h,e.precision(r.cumulativeSum)}}function sc(e){return(t,i,r)=>{const s=d.from(i).get(0);e.taState||(e.taState={});const n=r||`wma_${s}`;e.taState[n]||(e.taState[n]={window:[]});const a=e.taState[n],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<s)return NaN;a.window.length>s&&a.window.pop();let h=0,u=0;for(let f=0;f<s;f++){const g=s-f;h+=a.window[f]*g,u+=g}const l=h/u;return e.precision(l)}}function nc(e){return(t,i)=>{const r=d.from(t).get(0);e.taState||(e.taState={});const s=i||`wpr_${r}`;e.taState[s]||(e.taState[s]={highWindow:[],lowWindow:[]});const n=e.taState[s],a=e.get(e.data.high,0),o=e.get(e.data.low,0),h=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(h))return NaN;if(n.highWindow.unshift(a),n.lowWindow.unshift(o),n.highWindow.length<r)return NaN;n.highWindow.length>r&&(n.highWindow.pop(),n.lowWindow.pop());let u=n.highWindow[0],l=n.lowWindow[0];for(let p=1;p<r;p++)n.highWindow[p]>u&&(u=n.highWindow[p]),n.lowWindow[p]<l&&(l=n.lowWindow[p]);const f=u-l;if(f===0)return e.precision(0);const g=(u-h)/f*-100;return e.precision(g)}}function ac(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.open,0),s=e.get(e.data.high,0),n=e.get(e.data.low,0),a=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(n)||isNaN(a))return NaN;const o=s-n;if(o===0)return e.precision(0);const h=(i-r)/o*a;return e.precision(h)}}var oc=Object.defineProperty,hc=(e,t,i)=>t in e?oc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,S=(e,t,i)=>hc(e,typeof t!="symbol"?t+"":t,i);const uc={accdist:Yh,alma:Qh,atr:Xh,barssince:Zh,bb:Jh,bbw:eu,cci:tu,change:iu,cmo:ru,cog:su,correlation:nu,cross:au,crossover:ou,crossunder:hu,cum:uu,dev:cu,dmi:lu,ema:pu,falling:fu,highest:mu,highestbars:du,hma:gu,iii:xu,kc:yu,kcw:wu,linreg:bu,lowest:vu,lowestbars:_u,macd:Su,median:Eu,mfi:Nu,mode:Cu,mom:ku,nvi:Iu,obv:Au,param:Pu,percentile_linear_interpolation:Tu,percentile_nearest_rank:Ru,percentrank:Du,pivothigh:Ou,pivotlow:Lu,pvi:Bu,pvt:Fu,range:ju,rising:$u,rma:Wu,roc:qu,rsi:Uu,sar:Ku,sma:zu,stdev:Hu,stoch:Gu,supertrend:Yu,swma:Qu,tr:Xu,tsi:Zu,valuewhen:Ju,variance:ec,vwap:tc,vwma:ic,wad:rc,wma:sc,wpr:nc,wvad:ac};class cc{constructor(t){this.context=t,S(this,"accdist"),S(this,"alma"),S(this,"atr"),S(this,"barssince"),S(this,"bb"),S(this,"bbw"),S(this,"cci"),S(this,"change"),S(this,"cmo"),S(this,"cog"),S(this,"correlation"),S(this,"cross"),S(this,"crossover"),S(this,"crossunder"),S(this,"cum"),S(this,"dev"),S(this,"dmi"),S(this,"ema"),S(this,"falling"),S(this,"highest"),S(this,"highestbars"),S(this,"hma"),S(this,"iii"),S(this,"kc"),S(this,"kcw"),S(this,"linreg"),S(this,"lowest"),S(this,"lowestbars"),S(this,"macd"),S(this,"median"),S(this,"mfi"),S(this,"mode"),S(this,"mom"),S(this,"nvi"),S(this,"obv"),S(this,"param"),S(this,"percentile_linear_interpolation"),S(this,"percentile_nearest_rank"),S(this,"percentrank"),S(this,"pivothigh"),S(this,"pivotlow"),S(this,"pvi"),S(this,"pvt"),S(this,"range"),S(this,"rising"),S(this,"rma"),S(this,"roc"),S(this,"rsi"),S(this,"sar"),S(this,"sma"),S(this,"stdev"),S(this,"stoch"),S(this,"supertrend"),S(this,"swma"),S(this,"tr"),S(this,"tsi"),S(this,"valuewhen"),S(this,"variance"),S(this,"vwap"),S(this,"vwma"),S(this,"wad"),S(this,"wma"),S(this,"wpr"),S(this,"wvad"),Object.entries(uc).forEach(([i,r])=>{this[i]=r(t)})}}class lc{constructor(t){this.context=t}logFormat(t,...i){return t.replace(/{(\d+)}/g,(r,s)=>i[s])}param(t,i=0,r){return d.from(t).get(i)}warning(t,...i){console.warn(this.logFormat(t,...i))}error(t,...i){console.error(this.logFormat(t,...i))}info(t,...i){console.log(this.logFormat(t,...i))}}class pc{constructor(t){this.context=t}param(t,i=0,r){return d.from(t).get(i)}tostring(t){return String(t)}tonumber(t){return Number(t)}lower(t){return String(t).toLowerCase()}upper(t){return String(t).toUpperCase()}trim(t){return String(t).trim()}repeat(t,i,r=""){return Array(i).fill(t).join(r||"")}replace_all(t,i,r){return String(t).replaceAll(i,r)}replace(t,i,r,s=0){const n=String(t),a=String(i),o=String(r),h=Math.floor(Number(s))||0;if(a==="")return n;let u=0,l=0;for(;;){const f=n.indexOf(a,u);if(f===-1)return n;if(l===h)return n.substring(0,f)+o+n.substring(f+a.length);l++,u=f+a.length}}contains(t,i){return String(t).includes(i)}endswith(t,i){return String(t).endsWith(i)}startswith(t,i){return String(t).startsWith(i)}pos(t,i){const r=String(t).indexOf(i);return r===-1?NaN:r}length(t){return String(t).length}match(t,i){return String(t).match(new RegExp(i))}split(t,i){return[String(t).split(i)]}substring(t,i,r){return String(t).substring(i,r)}format(t,...i){return t.replace(/{(\d+)}/g,(r,s)=>i[s])}}class fc{constructor(t){this.context=t}param(t,i=0,r){return d.from(t).get(i)}get main_period(){return this.context.timeframe}get period(){return this.context.timeframe}get multiplier(){const t=parseInt(this.context.timeframe);return isNaN(t)?1:t}get isdwm(){return["D","W","M"].includes(this.context.timeframe.slice(-1))}get isdaily(){return this.context.timeframe.slice(-1)==="D"}get isweekly(){return this.context.timeframe.slice(-1)==="W"}get ismonthly(){return this.context.timeframe.slice(-1)==="M"}get isseconds(){return this.context.timeframe.slice(-1)==="S"}get isminutes(){return parseInt(this.context.timeframe).toString()==this.context.timeframe.trim()}get isintraday(){return!this.isdwm}from_seconds(t){return t<60?Math.ceil(t/5)*5+"S":t<60*60*24?Math.ceil(t/60):t<=60*60*24*7*52?t%(60*60*24*7)===0?Math.ceil(t/604800)+"W":Math.ceil(t/(60*60*24))+"D":"12M"}in_seconds(t){const i=parseInt(t),r=t.slice(-1);return r==="S"?i:r==="D"?i*60*60*24:r==="W"?i*60*60*24*7:r==="M"?i*60*60*24*30:isNaN(i)?0:i*60}}const mc=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],dc={series:"series",title:"string",color:"string",linewidth:"number",style:"string",trackprice:"boolean",histbase:"number",offset:"number",join:"bool",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"};class gc{constructor(t){this.context=t}extractPlotOptions(t){const i={};for(let r in t)i[r]=d.from(t[r]).get(0);return i}plotchar(t,i,r){this.context.plots[i]||(this.context.plots[i]={data:[],options:this.extractPlotOptions(r),title:i});const s=d.from(t).get(0);this.context.plots[i].data.push({time:this.context.marketData[this.context.idx].openTime,value:s,options:{...this.extractPlotOptions(r),style:"char"}})}plot(...t){const i=Kt(t,mc,dc),{series:r,title:s,...n}=i,a=this.extractPlotOptions(n);this.context.plots[s]||(this.context.plots[s]={data:[],options:a,title:s});const o=d.from(r).get(0);this.context.plots[s].data.push({time:this.context.marketData[this.context.idx].openTime,value:o,options:{color:a.color,offset:a.offset}})}}class xc{constructor(t){this.context=t}get style_dashed(){return"dashed"}get style_solid(){return"solid"}get style_dotted(){return"dotted"}param(t,i=0,r){return d.from(t).get(i)}any(t,i,r,s,n,a,o){return this.context.pine.plot(t,{title:i,color:r,linestyle:s,linewidth:n,editable:a,display:o})}}var yc=Object.defineProperty,wc=(e,t,i)=>t in e?yc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,j=(e,t,i)=>wc(e,typeof t!="symbol"?t+"":t,i);const xr=class Zt{constructor({marketData:t,source:i,tickerId:r,timeframe:s,limit:n,sDate:a,eDate:o,fullContext:h}){j(this,"data",{open:new d([]),high:new d([]),low:new d([]),close:new d([]),volume:new d([]),hl2:new d([]),hlc3:new d([]),ohlc4:new d([]),hlcc4:new d([])}),j(this,"indicator"),j(this,"cache",{}),j(this,"taState",{}),j(this,"isSecondaryContext",!1),j(this,"NA",NaN),j(this,"lang"),j(this,"pine"),j(this,"idx",0),j(this,"params",{}),j(this,"const",{}),j(this,"var",{}),j(this,"let",{}),j(this,"result"),j(this,"plots",{}),j(this,"marketData"),j(this,"source"),j(this,"tickerId"),j(this,"timeframe",""),j(this,"limit"),j(this,"sDate"),j(this,"eDate"),j(this,"fullContext"),j(this,"pineTSCode"),this.marketData=t,this.source=i,this.tickerId=r,this.timeframe=s,this.limit=n,this.sDate=a,this.eDate=o,this.fullContext=h||this;const u=new $o(this),l={na:u.na.bind(u),color:u.color,nz:u.nz.bind(u),indicator:u.indicator.bind(u),fixnan:u.fixnan.bind(u),alertcondition:u.alertcondition.bind(u),bool:u.bool.bind(u)},f=this;this.pine={input:new hh(this),ta:new cc(this),math:new $h(this),request:new Gh(this),array:new pa(this),map:new ka(this),matrix:new Po(this),syminfo:null,timeframe:new fc(this),barstate:new Vo(this),get bar_index(){return f.idx},get last_bar_index(){return f.data.close.length-1},get last_bar_time(){return f.data.openTime.get(f.data.openTime.length-1)},get timenow(){return new Date().getTime()},log:new lc(this),str:new pc(this),...l,...Yn};const g=new gc(this),p=new xc(this);this.bindContextObject(g,["plot","plotchar"]),this.bindContextObject(p,["any","style_dashed","style_solid","style_dotted","param"],"hline")}bindContextObject(t,i,r=""){r&&!this.pine[r]&&(this.pine[r]={});const s=r?this.pine[r]:this.pine;for(const n of i)typeof t[n]=="function"?s[n]=t[n].bind(t):s[n]=t[n]}init(t,i,r=0){let s;return i instanceof d?s=i.get(0):Array.isArray(i)?Array.isArray(i[0])?s=i[0]:s=i[i.length-1+r]:s=i,t?t instanceof d?(t.data[t.data.length-1]=s,t):Array.isArray(t)?(t[t.length-1]=s,new d(t)):new d([s]):new d([s])}initVar(t,i){if(t)return t;let r;return i instanceof d?r=i.get(0):Array.isArray(i)?Array.isArray(i[0])?r=i[0]:r=this.precision(i[i.length-1]):r=this.precision(i),new d([r])}precision(t,i=10){const r=10**i;return typeof t=="number"?Math.round(t*r)/r:t}param(t,i,r){return typeof t=="string"?t:t instanceof d?i?new d(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(this.params[r]||(this.params[r]=[]),Array.isArray(t)?new d(t,i||0):(this.params[r].length===0?this.params[r].push(t):this.params[r][this.params[r].length-1]=t,new d(this.params[r],0)))}get(t,i){if(t instanceof d)return t.get(i);if(Array.isArray(t)){const r=t.length-1-i;return r<0||r>=t.length?NaN:t[r]}return t}set(t,i){if(t instanceof d){t.set(0,i);return}if(Array.isArray(t)){t.length>0?t[t.length-1]=i:t.push(i);return}}get math(){return this._showDeprecationWarning("const math = context.math","const { math, ta, input } = context.pine"),this.pine.math}get ta(){return this._showDeprecationWarning("const ta = context.ta","const { ta, math, input } = context.pine"),this.pine.ta}get input(){return this._showDeprecationWarning("const input = context.input","const { input, math, ta } = context.pine"),this.pine.input}get request(){return this._showDeprecationWarning("const request = context.request","const { request, math, ta } = context.pine"),this.pine.request}get array(){return this._showDeprecationWarning("const array = context.array","const { array, math, ta } = context.pine"),this.pine.array}get core(){return this._showDeprecationWarning("context.core.*","context.pine (e.g., const { na, plotchar, color, plot, nz } = context.pine)"),{na:this.pine.na,plotchar:this.pine.plotchar,color:this.pine.color,plot:this.pine.plot,nz:this.pine.nz}}_showDeprecationWarning(t,i){const r=`${t}->${i}`;Zt._deprecationWarningsShown.has(r)||(Zt._deprecationWarningsShown.add(r),typeof window<"u"?console.warn("%c[WARNING]%c %s syntax is deprecated. Use %s instead. This will be removed in a future version.","color: #FFA500; font-weight: bold;","color: #FFA500;",t,i):console.warn(`\x1B[33m[WARNING] ${t} syntax is deprecated. Use ${i} instead. This will be removed in a future version.\x1B[0m`))}};j(xr,"_deprecationWarningsShown",new Set);let zt=xr;var bc=Object.defineProperty,vc=(e,t,i)=>t in e?bc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,K=(e,t,i)=>vc(e,typeof t!="symbol"?t+"":t,i);class Ht{constructor(t,i,r,s,n,a){this.source=t,this.tickerId=i,this.timeframe=r,this.limit=s,this.sDate=n,this.eDate=a,K(this,"data",[]),K(this,"open",[]),K(this,"high",[]),K(this,"low",[]),K(this,"close",[]),K(this,"volume",[]),K(this,"hl2",[]),K(this,"hlc3",[]),K(this,"ohlc4",[]),K(this,"hlcc4",[]),K(this,"openTime",[]),K(this,"closeTime",[]),K(this,"_readyPromise",null),K(this,"_ready",!1),K(this,"_debugSettings",{ln:!1,debug:!1}),K(this,"_transpiledCode",null),K(this,"_isSecondaryContext",!1),K(this,"_syminfo"),this._readyPromise=new Promise(o=>{this.loadMarketData(t,i,r,s,n,a).then(h=>{const u=h;this.data=u;const l=u.map(C=>C.open),f=u.map(C=>C.close),g=u.map(C=>C.high),p=u.map(C=>C.low),x=u.map(C=>C.volume),y=u.map(C=>(C.high+C.low+C.close)/3),w=u.map(C=>(C.high+C.low)/2),E=u.map(C=>(C.high+C.low+C.open+C.close)/4),A=u.map(C=>(C.high+C.low+C.close+C.close)/4),k=u.map(C=>C.openTime),T=u.map(C=>C.closeTime);this.open=l,this.close=f,this.high=g,this.low=p,this.volume=x,this.hl2=w,this.hlc3=y,this.ohlc4=E,this.hlcc4=A,this.openTime=k,this.closeTime=T,t&&t.getSymbolInfo?t.getSymbolInfo(i).then(C=>{this._syminfo=C,this._ready=!0,o(!0)}).catch(C=>{console.warn("Failed to get symbol info, using default values:",C),this._ready=!0,o(!0)}):(this._ready=!0,o(!0))})})}get transpiledCode(){return this._transpiledCode}markAsSecondary(){this._isSecondaryContext=!0}setDebugSettings({ln:t,debug:i}){this._debugSettings.ln=t,this._debugSettings.debug=i}async loadMarketData(t,i,r,s,n,a){return Array.isArray(t)?t:t.getMarketData(i,r,s,n,a)}async ready(){if(this._ready)return!0;if(!this._readyPromise)throw new Error("PineTS is not ready");return this._readyPromise}run(t,i,r){if(r&&r>0){const s=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(t,i,r,s)}else return this._runComplete(t,i)}async _runComplete(t,i){await this.ready(),i||(i=this.data.length);const r=this._initializeContext(t,this._isSecondaryContext);return this._transpiledCode=this._transpileCode(t),await this._executeIterations(r,this._transpiledCode,this.data.length-i,this.data.length),r}async*_runPaginated(t,i,r,s=!1){await this.ready(),i||(i=this.data.length);const n=this._initializeContext(t,this._isSecondaryContext);this._transpiledCode=this._transpileCode(t);let a=this.data.length-i;for(;;){const o=this.data.length-a;if(o>0){const l=Math.min(o,r),f=this._getResultLength(n.result);await this._executeIterations(n,this._transpiledCode,a,a+l),a+=l,yield this._createPageContext(n,f);continue}if(!s||Array.isArray(this.source))break;const{newCandles:h,updatedLastCandle:u}=await this._updateMarketData();if(h===0&&!u){yield null;continue}this._removeLastResult(n),a=this.data.length-(h+1),n.pine.barstate.setLive()}}_getResultLength(t){if(Array.isArray(t))return t.length;if(typeof t=="object"&&t!==null){const i=Object.keys(t);if(i.length>0&&Array.isArray(t[i[0]]))return t[i[0]].length}return 0}_createPageContext(t,i){const r=new zt({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,fullContext:t});if(r.pineTSCode=t.pineTSCode,r.idx=t.idx,Array.isArray(t.result))r.result=t.result.slice(i);else if(typeof t.result=="object"&&t.result!==null){r.result={};for(let s in t.result)Array.isArray(t.result[s])?r.result[s]=t.result[s].slice(i):r.result[s]=t.result[s]}else r.result=t.result;return r.plots={...t.plots},r}async _updateMarketData(t){if(Array.isArray(this.source))return{newCandles:0,updatedLastCandle:!1};const i=this.source,r=this.data.length-1,s=this.data[r].openTime;try{const n=await i.getMarketData(this.tickerId,this.timeframe,void 0,s,t);if(!n||n.length===0)return{newCandles:0,updatedLastCandle:!1};let a=!1,o=0;for(let h=0;h<n.length;h++){const u=n[h];u.openTime===s?(this._replaceCandle(r,u),a=!0):u.openTime>s&&(this._appendCandle(u),o++)}return{newCandles:o,updatedLastCandle:a}}catch(n){return console.error("Error updating market data:",n),{newCandles:0,updatedLastCandle:!1}}}_replaceCandle(t,i){this.data[t]=i,this.open[t]=i.open,this.close[t]=i.close,this.high[t]=i.high,this.low[t]=i.low,this.volume[t]=i.volume,this.hl2[t]=(i.high+i.low)/2,this.hlc3[t]=(i.high+i.low+i.close)/3,this.ohlc4[t]=(i.high+i.low+i.open+i.close)/4,this.hlcc4[t]=(i.high+i.low+i.close+i.close)/4,this.openTime[t]=i.openTime,this.closeTime[t]=i.closeTime}_appendCandle(t){this.data.push(t),this.open.push(t.open),this.close.push(t.close),this.high.push(t.high),this.low.push(t.low),this.volume.push(t.volume),this.hl2.push((t.high+t.low)/2),this.hlc3.push((t.high+t.low+t.close)/3),this.ohlc4.push((t.high+t.low+t.open+t.close)/4),this.hlcc4.push((t.high+t.low+t.close+t.close)/4),this.openTime.push(t.openTime),this.closeTime.push(t.closeTime)}_removeLastResult(t){if(Array.isArray(t.result))t.result.pop();else if(typeof t.result=="object"&&t.result!==null)for(let i in t.result)Array.isArray(t.result[i])&&t.result[i].pop();t.data.close.data.pop(),t.data.open.data.pop(),t.data.high.data.pop(),t.data.low.data.pop(),t.data.volume.data.pop(),t.data.hl2.data.pop(),t.data.hlc3.data.pop(),t.data.ohlc4.data.pop(),t.data.hlcc4.data.pop(),t.data.openTime.data.pop(),t.data.closeTime&&t.data.closeTime.data.pop()}_initializeContext(t,i=!1){const r=new zt({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate});return r.pine.syminfo=this._syminfo,r.pineTSCode=t,r.isSecondaryContext=i,r.data.close=new d([]),r.data.open=new d([]),r.data.high=new d([]),r.data.low=new d([]),r.data.volume=new d([]),r.data.hl2=new d([]),r.data.hlc3=new d([]),r.data.ohlc4=new d([]),r.data.hlcc4=new d([]),r.data.openTime=new d([]),r.data.closeTime=new d([]),r}_transpileCode(t){return ln.bind(this)(t,this._debugSettings)}async _executeIterations(t,i,r,s){const n=["const","var","let","params"];for(let a=r;a<s;a++){t.idx=a,t.data.close.data.push(this.close[a]),t.data.open.data.push(this.open[a]),t.data.high.data.push(this.high[a]),t.data.low.data.push(this.low[a]),t.data.volume.data.push(this.volume[a]),t.data.hl2.data.push(this.hl2[a]),t.data.hlc3.data.push(this.hlc3[a]),t.data.ohlc4.data.push(this.ohlc4[a]),t.data.hlcc4.data.push(this.hlcc4[a]),t.data.openTime.data.push(this.openTime[a]),t.data.closeTime.data.push(this.closeTime[a]);const o=await i(t);if(typeof o=="object"){typeof t.result!="object"&&(t.result={});for(let h in o){t.result[h]===void 0&&(t.result[h]=[]);let u;o[h]instanceof d?u=o[h].get(0):Array.isArray(o[h])?u=o[h][o[h].length-1]:u=o[h],t.result[h].push(u)}}else Array.isArray(t.result)||(t.result=[]),t.result.push(o);for(let h of n)for(let u in t[h]){const l=t[h][u];if(l instanceof d){const f=l.get(0);l.data.push(f)}else if(Array.isArray(l)){const f=l[l.length-1];l.push(f)}}}}}var _c=Object.defineProperty,Sc=(e,t,i)=>t in e?_c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,yt=(e,t,i)=>Sc(e,typeof t!="symbol"?t+"":t,i);const Gt="https://api.binance.com/api/v3",yr="https://api.binance.us/api/v3",Yt={1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",45:null,60:"1h",120:"2h",180:null,240:"4h","4H":"4h","1D":"1d",D:"1d","1W":"1w",W:"1w","1M":"1M",M:"1M"};class Ec{constructor(t=5*60*1e3){yt(this,"cache"),yt(this,"cacheDuration"),this.cache=new Map,this.cacheDuration=t}generateKey(t){return Object.entries(t).filter(([i,r])=>r!==void 0).map(([i,r])=>`${i}:${r}`).join("|")}get(t){const i=this.generateKey(t),r=this.cache.get(i);return r?Date.now()-r.timestamp>this.cacheDuration?(this.cache.delete(i),null):r.data:null}set(t,i){const r=this.generateKey(t);this.cache.set(r,{data:i,timestamp:Date.now()})}clear(){this.cache.clear()}cleanup(){const t=Date.now();for(const[i,r]of this.cache.entries())t-r.timestamp>this.cacheDuration&&this.cache.delete(i)}}class Nc{constructor(){yt(this,"cacheManager"),yt(this,"activeApiUrl",null),this.cacheManager=new Ec(5*60*1e3)}async getBaseUrl(){if(this.activeApiUrl)return this.activeApiUrl;try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${Gt}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=Gt,this.activeApiUrl}catch{}try{const t=new AbortController,i=setTimeout(()=>t.abort(),5e3),r=await fetch(`${yr}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=yr,this.activeApiUrl}catch{}return Gt}async getMarketDataInterval(t,i,r,s){try{const n=Yt[i.toUpperCase()];if(!n)return console.error(`Unsupported timeframe: ${i}`),[];const a={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3};let o=[],h=r;const u=s,l=a[n];if(!l)return console.error(`Duration not defined for interval: ${n}`),[];for(;h<u;){const f=Math.min(h+1e3*l,u),g=await this.getMarketData(t,i,1e3,h,f);if(g.length===0)break;o=o.concat(g),h=g[g.length-1].closeTime+1}return o}catch(n){return console.error("Error in getMarketDataInterval:",n),[]}}async getMarketData(t,i,r,s,n){try{const a=n!==void 0,o={tickerId:t,timeframe:i,limit:r,sDate:s,eDate:n};if(a){const g=this.cacheManager.get(o);if(g)return g}const h=Yt[i.toUpperCase()];if(!h)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,s,n)&&s&&n){const g=await this.getMarketDataInterval(t,i,s,n),p=r?g.slice(0,r):g;return this.cacheManager.set(o,p),p}let u=`${await this.getBaseUrl()}/klines?symbol=${t}&interval=${h}`;r&&(u+=`&limit=${Math.min(r,1e3)}`),s&&(u+=`&startTime=${s}`),n&&(u+=`&endTime=${n}`);const l=await fetch(u);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const f=(await l.json()).map(g=>({openTime:parseInt(g[0]),open:parseFloat(g[1]),high:parseFloat(g[2]),low:parseFloat(g[3]),close:parseFloat(g[4]),volume:parseFloat(g[5]),closeTime:parseInt(g[6]),quoteAssetVolume:parseFloat(g[7]),numberOfTrades:parseInt(g[8]),takerBuyBaseAssetVolume:parseFloat(g[9]),takerBuyQuoteAssetVolume:parseFloat(g[10]),ignore:g[11]}));return a&&this.cacheManager.set(o,f),f}catch(a){return console.error("Error in binance.klines:",a),[]}}shouldPaginate(t,i,r,s){if(i&&i>1e3)return!0;if(r&&s){const n=Yt[t.toUpperCase()],a={"1m":60*1e3,"3m":3*60*1e3,"5m":5*60*1e3,"15m":15*60*1e3,"30m":30*60*1e3,"1h":60*60*1e3,"2h":2*60*60*1e3,"4h":4*60*60*1e3,"1d":24*60*60*1e3,"1w":7*24*60*60*1e3,"1M":30*24*60*60*1e3}[n];if(a)return Math.ceil((s-r)/a)>1e3}return!1}async getSymbolInfo(t){try{let i="crypto",r=await this.getBaseUrl(),s=t,n="";t.endsWith(".P")?(i="futures",s=t.replace(".P",""),r="https://fapi.binance.com/fapi/v1",n="Perpetual"):t.includes("_")&&(i="futures",s=t,r="https://dapi.binance.com/dapi/v1",n="Delivery");const a=i==="crypto"?`${r}/exchangeInfo?symbol=${s}`:`${r}/exchangeInfo`,o=await fetch(a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const h=(await o.json()).symbols;if(!h||h.length===0)return console.error(`Symbol ${t} not found`),null;const u=i==="futures"?h.find(k=>k.symbol===s):h[0];if(!u)return console.error(`Symbol ${s} not found in exchange info`),null;const l=u.filters?.find(k=>k.filterType==="PRICE_FILTER"),f=u.filters?.find(k=>k.filterType==="LOT_SIZE"),g=l?parseFloat(l.tickSize):.01,p=f?parseFloat(f.minQty):0,x=Math.round(1/g),y=u.baseAsset,w=u.quoteAsset,E=n?` ${n}`:"",A=`${y} / ${w}${E}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:y,description:A,type:i,main_tickerid:`BINANCE:${t}`,current_contract:n,isin:"",basecurrency:y,currency:w,timezone:"Etc/UTC",country:"",mintick:g,pricescale:x,minmove:1,pointvalue:u.contractSize||1,mincontract:p,session:"24x7",volumetype:"base",expiration_date:u.deliveryDate||0,employees:0,industry:"",sector:"",shareholders:0,shares_outstanding_float:0,shares_outstanding_total:0,recommendations_buy:0,recommendations_buy_strong:0,recommendations_date:0,recommendations_hold:0,recommendations_sell:0,recommendations_sell_strong:0,recommendations_total:0,target_price_average:0,target_price_date:0,target_price_estimates:0,target_price_high:0,target_price_low:0,target_price_median:0}}catch(i){return console.error("Error in binance.exchangeInfo:",i),null}}}class Cc{async getMarketData(){return[]}}const kc=typeof process<"u"&&process.versions&&process.versions.node;let wt=null;if(kc)try{wt=new Cc}catch{wt=null}const Ic={Binance:new Nc,...wt?{Mock:wt}:{}};Ce.Context=zt,Ce.PineTS=Ht,Ce.Provider=Ic,Object.defineProperty(Ce,"__esModule",{value:!0})});
117
117
  ;var PineTS = PineTSLib.PineTS;PineTS.Provider = PineTSLib.Provider;PineTS.Context = PineTSLib.Context;//# sourceMappingURL=pinets.min.browser.js.map