pinets 0.7.1 → 0.7.3

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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var rr=require("fs"),nr=require("path"),sr=require("url");function ci(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(i){if(i!=="default"){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,Object.freeze(t)}var ke=ci(rr),je=ci(nr),ar=[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],hi=[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],or="\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",ui="\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",ut={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"},lt="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",cr={5:lt,"5module":lt+" export import",6:lt+" const class extends export import super"},hr=/^in(stanceof)?$/,ur=new RegExp("["+ui+"]"),lr=new RegExp("["+ui+or+"]");function gt(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 le(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ur.test(String.fromCharCode(e)):t===!1?!1:gt(e,hi)}function Te(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&&lr.test(String.fromCharCode(e)):t===!1?!1:gt(e,hi)||gt(e,ar)}var R=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 Q(e,t){return new R(e,{beforeExpr:!0,binop:t})}var X={beforeExpr:!0},z={startsExpr:!0},Et={};function P(e,t){return t===void 0&&(t={}),t.keyword=e,Et[e]=new R(e,t)}var u={num:new R("num",z),regexp:new R("regexp",z),string:new R("string",z),name:new R("name",z),privateId:new R("privateId",z),eof:new R("eof"),bracketL:new R("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new R("]"),braceL:new R("{",{beforeExpr:!0,startsExpr:!0}),braceR:new R("}"),parenL:new R("(",{beforeExpr:!0,startsExpr:!0}),parenR:new R(")"),comma:new R(",",X),semi:new R(";",X),colon:new R(":",X),dot:new R("."),question:new R("?",X),questionDot:new R("?."),arrow:new R("=>",X),template:new R("template"),invalidTemplate:new R("invalidTemplate"),ellipsis:new R("...",X),backQuote:new R("`",z),dollarBraceL:new R("${",{beforeExpr:!0,startsExpr:!0}),eq:new R("=",{beforeExpr:!0,isAssign:!0}),assign:new R("_=",{beforeExpr:!0,isAssign:!0}),incDec:new R("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new R("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Q("||",1),logicalAND:Q("&&",2),bitwiseOR:Q("|",3),bitwiseXOR:Q("^",4),bitwiseAND:Q("&",5),equality:Q("==/!=/===/!==",6),relational:Q("</>/<=/>=",7),bitShift:Q("<</>>/>>>",8),plusMin:new R("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Q("%",10),star:Q("*",10),slash:Q("/",10),starstar:new R("**",{beforeExpr:!0}),coalesce:Q("??",1),_break:P("break"),_case:P("case",X),_catch:P("catch"),_continue:P("continue"),_debugger:P("debugger"),_default:P("default",X),_do:P("do",{isLoop:!0,beforeExpr:!0}),_else:P("else",X),_finally:P("finally"),_for:P("for",{isLoop:!0}),_function:P("function",z),_if:P("if"),_return:P("return",X),_switch:P("switch"),_throw:P("throw",X),_try:P("try"),_var:P("var"),_const:P("const"),_while:P("while",{isLoop:!0}),_with:P("with"),_new:P("new",{beforeExpr:!0,startsExpr:!0}),_this:P("this",z),_super:P("super",z),_class:P("class",z),_extends:P("extends",X),_export:P("export"),_import:P("import",z),_null:P("null",z),_true:P("true",z),_false:P("false",z),_in:P("in",{beforeExpr:!0,binop:7}),_instanceof:P("instanceof",{beforeExpr:!0,binop:7}),_typeof:P("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:P("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:P("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},re=/\r\n?|\n|\u2028|\u2029/,pr=new RegExp(re.source,"g");function De(e){return e===10||e===13||e===8232||e===8233}function li(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var n=e.charCodeAt(r);if(De(n))return r<i-1&&n===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var pi=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,J=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,fi=Object.prototype,fr=fi.hasOwnProperty,mr=fi.toString,Me=Object.hasOwn||function(e,t){return fr.call(e,t)},Bt=Array.isArray||function(e){return mr.call(e)==="[object Array]"},Ft=Object.create(null);function ge(e){return Ft[e]||(Ft[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function pe(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var dr=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,qe=function(t,i){this.line=t,this.column=i};qe.prototype.offset=function(t){return new qe(this.line,this.column+t)};var nt=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function mi(e,t){for(var i=1,r=0;;){var n=li(e,r,t);if(n<0)return new qe(i,t-r);++i,r=n}}var xt={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},jt=!1;function gr(e){var t={};for(var i in xt)t[i]=e&&Me(e,i)?e[i]:xt[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!jt&&typeof console=="object"&&console.warn&&(jt=!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),Bt(t.onToken)){var r=t.onToken;t.onToken=function(n){return r.push(n)}}return Bt(t.onComment)&&(t.onComment=xr(t,t.onComment)),t}function xr(e,t){return function(i,r,n,s,a,o){var c={type:i?"Block":"Line",value:r,start:n,end:s};e.locations&&(c.loc=new nt(this,a,o)),e.ranges&&(c.range=[n,s]),t.push(c)}}var Ue=1,Ve=2,Nt=4,di=8,gi=16,xi=32,Ct=64,yi=128,Ke=256,kt=Ue|Ve|Ke;function It(e,t){return Ve|(e?Nt:0)|(t?di:0)}var Ze=0,At=1,me=2,wi=3,bi=4,vi=5,F=function(t,i,r){this.options=t=gr(t),this.sourceFile=t.sourceFile,this.keywords=ge(cr[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var n="";t.allowReserved!==!0&&(n=ut[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(n+=" await")),this.reservedWords=ge(n);var s=(n?n+" ":"")+ut.strict;this.reservedWordsStrict=ge(s),this.reservedWordsStrictBind=ge(s+" "+ut.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(re).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=u.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(Ue),this.regexpState=null,this.privateNameStack=[]},ce={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}};F.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};ce.inFunction.get=function(){return(this.currentVarScope().flags&Ve)>0};ce.inGenerator.get=function(){return(this.currentVarScope().flags&di)>0&&!this.currentVarScope().inClassFieldInit};ce.inAsync.get=function(){return(this.currentVarScope().flags&Nt)>0&&!this.currentVarScope().inClassFieldInit};ce.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&Ke)return!1;if(t.flags&Ve)return(t.flags&Nt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};ce.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&Ct)>0||i||this.options.allowSuperOutsideMethod};ce.allowDirectSuper.get=function(){return(this.currentThisScope().flags&yi)>0};ce.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};ce.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(Ve|Ke))>0||i};ce.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Ke)>0};F.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var r=this,n=0;n<t.length;n++)r=t[n](r);return r};F.parse=function(t,i){return new this(i,t).parse()};F.parseExpressionAt=function(t,i,r){var n=new this(r,t,i);return n.nextToken(),n.parseExpression()};F.tokenizer=function(t,i){return new this(i,t)};Object.defineProperties(F.prototype,ce);var K=F.prototype,yr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;K.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){J.lastIndex=e,e+=J.exec(this.input)[0].length;var t=yr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){J.lastIndex=e+t[0].length;var i=J.exec(this.input),r=i.index+i[0].length,n=this.input.charAt(r);return n===";"||n==="}"||re.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||n==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,J.lastIndex=e,e+=J.exec(this.input)[0].length,this.input[e]===";"&&e++}};K.eat=function(e){return this.type===e?(this.next(),!0):!1};K.isContextual=function(e){return this.type===u.name&&this.value===e&&!this.containsEsc};K.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};K.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};K.canInsertSemicolon=function(){return this.type===u.eof||this.type===u.braceR||re.test(this.input.slice(this.lastTokEnd,this.start))};K.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};K.semicolon=function(){!this.eat(u.semi)&&!this.insertSemicolon()&&this.unexpected()};K.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};K.expect=function(e){this.eat(e)||this.unexpected()};K.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var st=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};K.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")}};K.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")};K.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")};K.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var E=F.prototype;E.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==u.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,n=Object.keys(this.undefinedExports);r<n.length;r+=1){var s=n[r];this.raiseRecoverable(this.undefinedExports[s].start,"Export '"+s+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Tt={kind:"loop"},wr={kind:"switch"};E.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;J.lastIndex=this.pos;var t=J.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(le(r,!0)){for(var n=i+1;Te(r=this.input.charCodeAt(n),!0);)++n;if(r===92||r>55295&&r<56320)return!0;var s=this.input.slice(i,n);if(!hr.test(s))return!0}return!1};E.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;J.lastIndex=this.pos;var e=J.exec(this.input),t=this.pos+e[0].length,i;return!re.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(Te(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))};E.parseStatement=function(e,t,i){var r=this.type,n=this.startNode(),s;switch(this.isLet(e)&&(r=u._var,s="let"),r){case u._break:case u._continue:return this.parseBreakContinueStatement(n,r.keyword);case u._debugger:return this.parseDebuggerStatement(n);case u._do:return this.parseDoStatement(n);case u._for:return this.parseForStatement(n);case u._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,!1,!e);case u._class:return e&&this.unexpected(),this.parseClass(n,!0);case u._if:return this.parseIfStatement(n);case u._return:return this.parseReturnStatement(n);case u._switch:return this.parseSwitchStatement(n);case u._throw:return this.parseThrowStatement(n);case u._try:return this.parseTryStatement(n);case u._const:case u._var:return s=s||this.value,e&&s!=="var"&&this.unexpected(),this.parseVarStatement(n,s);case u._while:return this.parseWhileStatement(n);case u._with:return this.parseWithStatement(n);case u.braceL:return this.parseBlock(!0,n);case u.semi:return this.parseEmptyStatement(n);case u._export:case u._import:if(this.options.ecmaVersion>10&&r===u._import){J.lastIndex=this.pos;var a=J.exec(this.input),o=this.pos+a[0].length,c=this.input.charCodeAt(o);if(c===40||c===46)return this.parseExpressionStatement(n,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===u._import?this.parseImport(n):this.parseExport(n,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(n,!0,!e);var h=this.value,l=this.parseExpression();return r===u.name&&l.type==="Identifier"&&this.eat(u.colon)?this.parseLabeledStatement(n,h,l,e):this.parseExpressionStatement(n,l)}};E.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(u.semi)||this.insertSemicolon()?e.label=null:this.type!==u.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var n=this.labels[r];if((e.label==null||n.name===e.label.name)&&(n.kind!=null&&(i||n.kind==="loop")||e.label&&i))break}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")};E.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")};E.parseDoStatement=function(e){return this.next(),this.labels.push(Tt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(u._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(u.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};E.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(u.parenL),this.type===u.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===u._var||this.type===u._const||i){var r=this.startNode(),n=i?"let":this.value;return this.next(),this.parseVar(r,!0,n),this.finishNode(r,"VariableDeclaration"),(this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===u._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var s=this.isContextual("let"),a=!1,o=this.containsEsc,c=new st,h=this.start,l=t>-1?this.parseExprSubscripts(c,"await"):this.parseExpression(!0,c);return this.type===u._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===u._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(l.start===h&&!o&&l.type==="Identifier"&&l.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),s&&a&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,c),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(c,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))};E.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,$e|(i?0:yt),!1,t)};E.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(u._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};E.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(u.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};E.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(u.braceL),this.labels.push(wr),this.enterScope(0);for(var t,i=!1;this.type!==u.braceR;)if(this.type===u._case||this.type===u._default){var r=this.type===u._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(u.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")};E.parseThrowStatement=function(e){return this.next(),re.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 br=[];E.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?xi:0),this.checkLValPattern(e,t?bi:me),this.expect(u.parenR),e};E.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===u._catch){var t=this.startNode();this.next(),this.eat(u.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(u._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};E.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")};E.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")};E.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")};E.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};E.parseLabeledStatement=function(e,t,i,r){for(var n=0,s=this.labels;n<s.length;n+=1){var a=s[n];a.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===u._switch?"switch":null,c=this.labels.length-1;c>=0;c--){var h=this.labels[c];if(h.statementStart===e.start)h.statementStart=this.start,h.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")};E.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};E.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(u.braceL),e&&this.enterScope(0);this.type!==u.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};E.parseFor=function(e,t){return e.init=t,this.expect(u.semi),e.test=this.type===u.semi?null:this.parseExpression(),this.expect(u.semi),e.update=this.type===u.parenR?null:this.parseExpression(),this.expect(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};E.parseForIn=function(e,t){var i=this.type===u._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(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};E.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var n=this.startNode();if(this.parseVarId(n,i),this.eat(u.eq)?n.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&n.id.type!=="Identifier"&&!(t&&(this.type===u._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):n.init=null,e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(u.comma))break}return e};E.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?At:me,!1)};var $e=1,yt=2,_i=4;E.parseFunction=function(e,t,i,r,n){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===u.star&&t&yt&&this.unexpected(),e.generator=this.eat(u.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&$e&&(e.id=t&_i&&this.type!==u.name?null:this.parseIdent(),e.id&&!(t&yt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?At:me:wi));var s=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&$e||(e.id=this.type===u.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,n),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&$e?"FunctionDeclaration":"FunctionExpression")};E.parseFunctionParams=function(e){this.expect(u.parenL),e.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};E.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),n=this.startNode(),s=!1;for(n.body=[],this.expect(u.braceL);this.type!==u.braceR;){var a=this.parseClassElement(e.superClass!==null);a&&(n.body.push(a),a.type==="MethodDefinition"&&a.kind==="constructor"?(s&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),s=!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(n,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};E.parseClassElement=function(e){if(this.eat(u.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",n=!1,s=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(u.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===u.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===u.star)&&!this.canInsertSemicolon()?s=!0:r="async"),!r&&(t>=9||!s)&&this.eat(u.star)&&(n=!0),!r&&!s&&!n){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=c:r=c)}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===u.parenL||a!=="method"||n||s){var h=!i.static&&Je(i,"constructor"),l=h&&e;h&&a!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=h?"constructor":a,this.parseClassMethod(i,n,s,l)}else this.parseClassField(i);return i};E.isClassElementNameStart=function(){return this.type===u.name||this.type===u.privateId||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword};E.parseClassElementName=function(e){this.type===u.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)};E.parseClassMethod=function(e,t,i,r){var n=e.key;e.kind==="constructor"?(t&&this.raise(n.start,"Constructor can't be a generator"),i&&this.raise(n.start,"Constructor can't be an async method")):e.static&&Je(e,"prototype")&&this.raise(n.start,"Classes may not have a static property named prototype");var s=e.value=this.parseMethod(t,i,r);return e.kind==="get"&&s.params.length!==0&&this.raiseRecoverable(s.start,"getter should have no params"),e.kind==="set"&&s.params.length!==1&&this.raiseRecoverable(s.start,"setter should have exactly one param"),e.kind==="set"&&s.params[0].type==="RestElement"&&this.raiseRecoverable(s.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};E.parseClassField=function(e){if(Je(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&Je(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(u.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")};E.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Ke|Ct);this.type!==u.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};E.parseClassId=function(e,t){this.type===u.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,me,!1)):(t===!0&&this.unexpected(),e.id=null)};E.parseClassSuper=function(e){e.superClass=this.eat(u._extends)?this.parseExprSubscripts(null,!1):null};E.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};E.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,n=r===0?null:this.privateNameStack[r-1],s=0;s<i.length;++s){var a=i[s];Me(t,a.name)||(n?n.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],n="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(n=(t.static?"s":"i")+t.kind),r==="iget"&&n==="iset"||r==="iset"&&n==="iget"||r==="sget"&&n==="sset"||r==="sset"&&n==="sget"?(e[i]="true",!1):r?!0:(e[i]=n,!1)}function Je(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}E.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!==u.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};E.parseExport=function(e,t){if(this.next(),this.eat(u.star))return this.parseExportAllDeclaration(e,t);if(this.eat(u._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!==u.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 n=r[i];this.checkUnreserved(n.local),this.checkLocalExport(n.local),n.local.type==="Literal"&&this.raise(n.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")};E.parseExportDeclaration=function(e){return this.parseStatement(null)};E.parseExportDefaultDeclaration=function(){var e;if(this.type===u._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,$e|_i,!1,e)}else if(this.type===u._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};E.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),Me(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)};E.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,n=t.properties;r<n.length;r+=1){var s=n[r];this.checkPatternExport(e,s)}else if(i==="ArrayPattern")for(var a=0,o=t.elements;a<o.length;a+=1){var c=o[a];c&&this.checkPatternExport(e,c)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)};E.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var n=r[i];this.checkPatternExport(e,n.id)}};E.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};E.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")};E.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(u.braceL);!this.eat(u.braceR);){if(i)i=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;t.push(this.parseExportSpecifier(e))}return t};E.parseImport=function(e){return this.next(),this.type===u.string?(e.specifiers=br,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===u.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")};E.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,me),this.finishNode(e,"ImportSpecifier")};E.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,me),this.finishNode(e,"ImportDefaultSpecifier")};E.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,me),this.finishNode(e,"ImportNamespaceSpecifier")};E.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===u.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(u.comma)))return e;if(this.type===u.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(u.braceL);!this.eat(u.braceR);){if(t)t=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;e.push(this.parseImportSpecifier())}return e};E.parseWithClause=function(){var e=[];if(!this.eat(u._with))return e;this.expect(u.braceL);for(var t={},i=!0;!this.eat(u.braceR);){if(i)i=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;var r=this.parseImportAttribute(),n=r.key.type==="Identifier"?r.key.name:r.key.value;Me(t,n)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+n+"'"),t[n]=!0,e.push(r)}return e};E.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===u.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(u.colon),this.type!==u.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")};E.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===u.string){var e=this.parseLiteral(this.value);return dr.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};E.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)};E.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 ne=F.prototype;ne.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,n=e.properties;r<n.length;r+=1){var s=n[r];this.toAssignable(s,t),s.type==="RestElement"&&(s.argument.type==="ArrayPattern"||s.argument.type==="ObjectPattern")&&this.raise(s.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};ne.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var n=e[r];n&&this.toAssignable(n,t)}if(i){var s=e[i-1];this.options.ecmaVersion===6&&t&&s&&s.type==="RestElement"&&s.argument.type!=="Identifier"&&this.unexpected(s.argument.start)}return e};ne.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")};ne.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==u.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")};ne.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case u.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(u.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case u.braceL:return this.parseObj(!0)}return this.parseIdent()};ne.parseBindingList=function(e,t,i,r){for(var n=[],s=!0;!this.eat(e);)if(s?s=!1:this.expect(u.comma),t&&this.type===u.comma)n.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===u.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),n.push(a),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else n.push(this.parseAssignableListItem(r))}return n};ne.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};ne.parseBindingListItem=function(e){return e};ne.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(u.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};ne.checkLValSimple=function(e,t,i){t===void 0&&(t=Ze);var r=t!==Ze;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===me&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(Me(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==vi&&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")}};ne.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=Ze),e.type){case"ObjectPattern":for(var r=0,n=e.properties;r<n.length;r+=1){var s=n[r];this.checkLValInnerPattern(s,t,i)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var c=o[a];c&&this.checkLValInnerPattern(c,t,i)}break;default:this.checkLValSimple(e,t,i)}};ne.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=Ze),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 se=function(t,i,r,n,s){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=n,this.generator=!!s},O={b_stat:new se("{",!1),b_expr:new se("{",!0),b_tmpl:new se("${",!1),p_stat:new se("(",!1),p_expr:new se("(",!0),q_tmpl:new se("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new se("function",!1),f_expr:new se("function",!0),f_expr_gen:new se("function",!0,!1,null,!0),f_gen:new se("function",!1,!1,null,!0)},Oe=F.prototype;Oe.initialContext=function(){return[O.b_stat]};Oe.curContext=function(){return this.context[this.context.length-1]};Oe.braceIsBlock=function(e){var t=this.curContext();return t===O.f_expr||t===O.f_stat?!0:e===u.colon&&(t===O.b_stat||t===O.b_expr)?!t.isExpr:e===u._return||e===u.name&&this.exprAllowed?re.test(this.input.slice(this.lastTokEnd,this.start)):e===u._else||e===u.semi||e===u.eof||e===u.parenR||e===u.arrow?!0:e===u.braceL?t===O.b_stat:e===u._var||e===u._const||e===u.name?!1:!this.exprAllowed};Oe.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};Oe.updateContext=function(e){var t,i=this.type;i.keyword&&e===u.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};Oe.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};u.parenR.updateContext=u.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===O.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};u.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?O.b_stat:O.b_expr),this.exprAllowed=!0};u.dollarBraceL.updateContext=function(){this.context.push(O.b_tmpl),this.exprAllowed=!0};u.parenL.updateContext=function(e){var t=e===u._if||e===u._for||e===u._with||e===u._while;this.context.push(t?O.p_stat:O.p_expr),this.exprAllowed=!0};u.incDec.updateContext=function(){};u._function.updateContext=u._class.updateContext=function(e){e.beforeExpr&&e!==u._else&&!(e===u.semi&&this.curContext()!==O.p_stat)&&!(e===u._return&&re.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===u.colon||e===u.braceL)&&this.curContext()===O.b_stat)?this.context.push(O.f_expr):this.context.push(O.f_stat),this.exprAllowed=!1};u.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};u.backQuote.updateContext=function(){this.curContext()===O.q_tmpl?this.context.pop():this.context.push(O.q_tmpl),this.exprAllowed=!1};u.star.updateContext=function(e){if(e===u._function){var t=this.context.length-1;this.context[t]===O.f_expr?this.context[t]=O.f_expr_gen:this.context[t]=O.f_gen}this.exprAllowed=!0};u.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==u.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var I=F.prototype;I.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,n;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var s=e.kind;if(this.options.ecmaVersion>=6){n==="__proto__"&&s==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);return}n="$"+n;var a=t[n];if(a){var o;s==="init"?o=this.strict&&a.init||a.get||a.set:o=a.init||a[s],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else a=t[n]={init:!1,get:!1,set:!1};a[s]=!0}};I.parseExpression=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeAssign(e,t);if(this.type===u.comma){var s=this.startNodeAt(i,r);for(s.expressions=[n];this.eat(u.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(s,"SequenceExpression")}return n};I.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,n=-1,s=-1,a=-1;t?(n=t.parenthesizedAssign,s=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new st,r=!0);var o=this.start,c=this.startLoc;(this.type===u.parenL||this.type===u.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var h=this.parseMaybeConditional(e,t);if(i&&(h=i.call(this,h,o,c)),this.type.isAssign){var l=this.startNodeAt(o,c);return l.operator=this.value,this.type===u.eq&&(h=this.toAssignable(h,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=h.start&&(t.shorthandAssign=-1),this.type===u.eq?this.checkLValPattern(h):this.checkLValSimple(h),l.left=h,this.next(),l.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(l,"AssignmentExpression")}else r&&this.checkExpressionErrors(t,!0);return n>-1&&(t.parenthesizedAssign=n),s>-1&&(t.trailingComma=s),h};I.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,n=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return n;if(this.eat(u.question)){var s=this.startNodeAt(i,r);return s.test=n,s.consequent=this.parseMaybeAssign(),this.expect(u.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return n};I.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||n.start===i&&n.type==="ArrowFunctionExpression"?n:this.parseExprOp(n,i,r,-1,e)};I.parseExprOp=function(e,t,i,r,n){var s=this.type.binop;if(s!=null&&(!n||this.type!==u._in)&&s>r){var a=this.type===u.logicalOR||this.type===u.logicalAND,o=this.type===u.coalesce;o&&(s=u.logicalAND.binop);var c=this.value;this.next();var h=this.start,l=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),h,l,s,n),g=this.buildBinary(t,i,e,f,c,a||o);return(a&&this.type===u.coalesce||o&&(this.type===u.logicalOR||this.type===u.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(g,t,i,r,n)}return e};I.buildBinary=function(e,t,i,r,n,s){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=n,a.right=r,this.finishNode(a,s?"LogicalExpression":"BinaryExpression")};I.parseMaybeUnary=function(e,t,i,r){var n=this.start,s=this.startLoc,a;if(this.isContextual("await")&&this.canAwait)a=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),c=this.type===u.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&Si(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&wt(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,a=this.finishNode(o,c?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===u.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),a=this.parsePrivateIdent(),this.type!==u._in&&this.unexpected();else{if(a=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return a;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(n,s);h.operator=this.value,h.prefix=!1,h.argument=a,this.checkLValSimple(a),this.next(),a=this.finishNode(h,"UpdateExpression")}}if(!i&&this.eat(u.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(n,s,a,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return a};function Si(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Si(e.expression)}function wt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&wt(e.expression)||e.type==="ParenthesizedExpression"&&wt(e.expression)}I.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,n=this.parseExprAtom(e,t);if(n.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return n;var s=this.parseSubscripts(n,i,r,!1,t);return e&&s.type==="MemberExpression"&&(e.parenthesizedAssign>=s.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=s.start&&(e.parenthesizedBind=-1),e.trailingComma>=s.start&&(e.trailingComma=-1)),s};I.parseSubscripts=function(e,t,i,r,n){for(var s=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,s,a,n);if(o.optional&&(a=!0),o===e||o.type==="ArrowFunctionExpression"){if(a){var c=this.startNodeAt(t,i);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}e=o}};I.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(u.arrow)};I.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)};I.parseSubscript=function(e,t,i,r,n,s,a){var o=this.options.ecmaVersion>=11,c=o&&this.eat(u.questionDot);r&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(u.bracketL);if(h||c&&this.type!==u.parenL&&this.type!==u.backQuote||this.eat(u.dot)){var l=this.startNodeAt(t,i);l.object=e,h?(l.property=this.parseExpression(),this.expect(u.bracketR)):this.type===u.privateId&&e.type!=="Super"?l.property=this.parsePrivateIdent():l.property=this.parseIdent(this.options.allowReserved!=="never"),l.computed=!!h,o&&(l.optional=c),e=this.finishNode(l,"MemberExpression")}else if(!r&&this.eat(u.parenL)){var f=new st,g=this.yieldPos,p=this.awaitPos,x=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var y=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1,f);if(n&&!c&&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=c),e=this.finishNode(w,"CallExpression")}else if(this.type===u.backQuote){(c||s)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var S=this.startNodeAt(t,i);S.tag=e,S.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(S,"TaggedTemplateExpression")}return e};I.parseExprAtom=function(e,t,i){this.type===u.slash&&this.readRegexp();var r,n=this.potentialArrowAt===this.start;switch(this.type){case u._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===u.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==u.dot&&this.type!==u.bracketL&&this.type!==u.parenL&&this.unexpected(),this.finishNode(r,"Super");case u._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case u.name:var s=this.start,a=this.startLoc,o=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&c.name==="async"&&!this.canInsertSemicolon()&&this.eat(u._function))return this.overrideContext(O.f_expr),this.parseFunction(this.startNodeAt(s,a),0,!1,!0,t);if(n&&!this.canInsertSemicolon()){if(this.eat(u.arrow))return this.parseArrowExpression(this.startNodeAt(s,a),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===u.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(u.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,a),[c],!0,t)}return c;case u.regexp:var h=this.value;return r=this.parseLiteral(h.value),r.regex={pattern:h.pattern,flags:h.flags},r;case u.num:case u.string:return this.parseLiteral(this.value);case u._null:case u._true:case u._false:return r=this.startNode(),r.value=this.type===u._null?null:this.type===u._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case u.parenL:var l=this.start,f=this.parseParenAndDistinguishExpression(n,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),f;case u.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(u.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case u.braceL:return this.overrideContext(O.b_expr),this.parseObj(!1,e);case u._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case u._class:return this.parseClass(this.startNode(),!1);case u._new:return this.parseNew();case u.backQuote:return this.parseTemplate();case u._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};I.parseExprAtomDefault=function(){this.unexpected()};I.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===u.parenL&&!e)return this.parseDynamicImport(t);if(this.type===u.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()};I.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(u.parenR)?e.options=null:(this.expect(u.comma),this.afterTrailingComma(u.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(u.parenR)||(this.expect(u.comma),this.afterTrailingComma(u.parenR)||this.unexpected())));else if(!this.eat(u.parenR)){var t=this.start;this.eat(u.comma)&&this.eat(u.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};I.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")};I.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")};I.parseParenExpression=function(){this.expect(u.parenL);var e=this.parseExpression();return this.expect(u.parenR),e};I.shouldParseArrow=function(e){return!this.canInsertSemicolon()};I.parseParenAndDistinguishExpression=function(e,t){var i=this.start,r=this.startLoc,n,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a=this.start,o=this.startLoc,c=[],h=!0,l=!1,f=new st,g=this.yieldPos,p=this.awaitPos,x;for(this.yieldPos=0,this.awaitPos=0;this.type!==u.parenR;)if(h?h=!1:this.expect(u.comma),s&&this.afterTrailingComma(u.parenR,!0)){l=!0;break}else if(this.type===u.ellipsis){x=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var y=this.lastTokEnd,w=this.lastTokEndLoc;if(this.expect(u.parenR),e&&this.shouldParseArrow(c)&&this.eat(u.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=g,this.awaitPos=p,this.parseParenArrowList(i,r,c,t);(!c.length||l)&&this.unexpected(this.lastTokStart),x&&this.unexpected(x),this.checkExpressionErrors(f,!0),this.yieldPos=g||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(n=this.startNodeAt(a,o),n.expressions=c,this.finishNodeAt(n,"SequenceExpression",y,w)):n=c[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var S=this.startNodeAt(i,r);return S.expression=n,this.finishNode(S,"ParenthesizedExpression")}else return n};I.parseParenItem=function(e){return e};I.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var _r=[];I.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===u.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,n=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,n,!0,!1),this.eat(u.parenL)?e.arguments=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1):e.arguments=_r,this.finishNode(e,"NewExpression")};I.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===u.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
18
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var hr=require("fs"),ur=require("path"),lr=require("url");function hi(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(i){if(i!=="default"){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,Object.freeze(t)}var ke=hi(hr),je=hi(ur),pr=[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],ui=[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],fr="\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",li="\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",lt={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"},pt="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",mr={5:pt,"5module":pt+" export import",6:pt+" const class extends export import super"},dr=/^in(stanceof)?$/,gr=new RegExp("["+li+"]"),xr=new RegExp("["+li+fr+"]");function yt(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 le(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&gr.test(String.fromCharCode(e)):t===!1?!1:yt(e,ui)}function Te(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&&xr.test(String.fromCharCode(e)):t===!1?!1:yt(e,ui)||yt(e,pr)}var R=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 Q(e,t){return new R(e,{beforeExpr:!0,binop:t})}var X={beforeExpr:!0},z={startsExpr:!0},Ct={};function P(e,t){return t===void 0&&(t={}),t.keyword=e,Ct[e]=new R(e,t)}var u={num:new R("num",z),regexp:new R("regexp",z),string:new R("string",z),name:new R("name",z),privateId:new R("privateId",z),eof:new R("eof"),bracketL:new R("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new R("]"),braceL:new R("{",{beforeExpr:!0,startsExpr:!0}),braceR:new R("}"),parenL:new R("(",{beforeExpr:!0,startsExpr:!0}),parenR:new R(")"),comma:new R(",",X),semi:new R(";",X),colon:new R(":",X),dot:new R("."),question:new R("?",X),questionDot:new R("?."),arrow:new R("=>",X),template:new R("template"),invalidTemplate:new R("invalidTemplate"),ellipsis:new R("...",X),backQuote:new R("`",z),dollarBraceL:new R("${",{beforeExpr:!0,startsExpr:!0}),eq:new R("=",{beforeExpr:!0,isAssign:!0}),assign:new R("_=",{beforeExpr:!0,isAssign:!0}),incDec:new R("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new R("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Q("||",1),logicalAND:Q("&&",2),bitwiseOR:Q("|",3),bitwiseXOR:Q("^",4),bitwiseAND:Q("&",5),equality:Q("==/!=/===/!==",6),relational:Q("</>/<=/>=",7),bitShift:Q("<</>>/>>>",8),plusMin:new R("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Q("%",10),star:Q("*",10),slash:Q("/",10),starstar:new R("**",{beforeExpr:!0}),coalesce:Q("??",1),_break:P("break"),_case:P("case",X),_catch:P("catch"),_continue:P("continue"),_debugger:P("debugger"),_default:P("default",X),_do:P("do",{isLoop:!0,beforeExpr:!0}),_else:P("else",X),_finally:P("finally"),_for:P("for",{isLoop:!0}),_function:P("function",z),_if:P("if"),_return:P("return",X),_switch:P("switch"),_throw:P("throw",X),_try:P("try"),_var:P("var"),_const:P("const"),_while:P("while",{isLoop:!0}),_with:P("with"),_new:P("new",{beforeExpr:!0,startsExpr:!0}),_this:P("this",z),_super:P("super",z),_class:P("class",z),_extends:P("extends",X),_export:P("export"),_import:P("import",z),_null:P("null",z),_true:P("true",z),_false:P("false",z),_in:P("in",{beforeExpr:!0,binop:7}),_instanceof:P("instanceof",{beforeExpr:!0,binop:7}),_typeof:P("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:P("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:P("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},re=/\r\n?|\n|\u2028|\u2029/,yr=new RegExp(re.source,"g");function De(e){return e===10||e===13||e===8232||e===8233}function pi(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var n=e.charCodeAt(r);if(De(n))return r<i-1&&n===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var fi=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,J=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,mi=Object.prototype,wr=mi.hasOwnProperty,br=mi.toString,Me=Object.hasOwn||function(e,t){return wr.call(e,t)},Ft=Array.isArray||function(e){return br.call(e)==="[object Array]"},jt=Object.create(null);function ge(e){return jt[e]||(jt[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function pe(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var vr=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ue=function(t,i){this.line=t,this.column=i};Ue.prototype.offset=function(t){return new Ue(this.line,this.column+t)};var st=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function di(e,t){for(var i=1,r=0;;){var n=pi(e,r,t);if(n<0)return new Ue(i,t-r);++i,r=n}}var wt={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},$t=!1;function _r(e){var t={};for(var i in wt)t[i]=e&&Me(e,i)?e[i]:wt[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!$t&&typeof console=="object"&&console.warn&&($t=!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),Ft(t.onToken)){var r=t.onToken;t.onToken=function(n){return r.push(n)}}return Ft(t.onComment)&&(t.onComment=Sr(t,t.onComment)),t}function Sr(e,t){return function(i,r,n,s,a,o){var c={type:i?"Block":"Line",value:r,start:n,end:s};e.locations&&(c.loc=new st(this,a,o)),e.ranges&&(c.range=[n,s]),t.push(c)}}var Ke=1,Ve=2,kt=4,gi=8,xi=16,yi=32,It=64,wi=128,ze=256,At=Ke|Ve|ze;function Tt(e,t){return Ve|(e?kt:0)|(t?gi:0)}var Je=0,Pt=1,me=2,bi=3,vi=4,_i=5,F=function(t,i,r){this.options=t=_r(t),this.sourceFile=t.sourceFile,this.keywords=ge(mr[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var n="";t.allowReserved!==!0&&(n=lt[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(n+=" await")),this.reservedWords=ge(n);var s=(n?n+" ":"")+lt.strict;this.reservedWordsStrict=ge(s),this.reservedWordsStrictBind=ge(s+" "+lt.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(re).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=u.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(Ke),this.regexpState=null,this.privateNameStack=[]},ce={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}};F.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};ce.inFunction.get=function(){return(this.currentVarScope().flags&Ve)>0};ce.inGenerator.get=function(){return(this.currentVarScope().flags&gi)>0&&!this.currentVarScope().inClassFieldInit};ce.inAsync.get=function(){return(this.currentVarScope().flags&kt)>0&&!this.currentVarScope().inClassFieldInit};ce.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&ze)return!1;if(t.flags&Ve)return(t.flags&kt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};ce.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&It)>0||i||this.options.allowSuperOutsideMethod};ce.allowDirectSuper.get=function(){return(this.currentThisScope().flags&wi)>0};ce.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};ce.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(t&(Ve|ze))>0||i};ce.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ze)>0};F.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var r=this,n=0;n<t.length;n++)r=t[n](r);return r};F.parse=function(t,i){return new this(i,t).parse()};F.parseExpressionAt=function(t,i,r){var n=new this(r,t,i);return n.nextToken(),n.parseExpression()};F.tokenizer=function(t,i){return new this(i,t)};Object.defineProperties(F.prototype,ce);var K=F.prototype,Er=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;K.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){J.lastIndex=e,e+=J.exec(this.input)[0].length;var t=Er.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){J.lastIndex=e+t[0].length;var i=J.exec(this.input),r=i.index+i[0].length,n=this.input.charAt(r);return n===";"||n==="}"||re.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||n==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,J.lastIndex=e,e+=J.exec(this.input)[0].length,this.input[e]===";"&&e++}};K.eat=function(e){return this.type===e?(this.next(),!0):!1};K.isContextual=function(e){return this.type===u.name&&this.value===e&&!this.containsEsc};K.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};K.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};K.canInsertSemicolon=function(){return this.type===u.eof||this.type===u.braceR||re.test(this.input.slice(this.lastTokEnd,this.start))};K.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};K.semicolon=function(){!this.eat(u.semi)&&!this.insertSemicolon()&&this.unexpected()};K.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};K.expect=function(e){this.eat(e)||this.unexpected()};K.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var at=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};K.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")}};K.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")};K.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")};K.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var E=F.prototype;E.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==u.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,n=Object.keys(this.undefinedExports);r<n.length;r+=1){var s=n[r];this.raiseRecoverable(this.undefinedExports[s].start,"Export '"+s+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Rt={kind:"loop"},Nr={kind:"switch"};E.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;J.lastIndex=this.pos;var t=J.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(le(r,!0)){for(var n=i+1;Te(r=this.input.charCodeAt(n),!0);)++n;if(r===92||r>55295&&r<56320)return!0;var s=this.input.slice(i,n);if(!dr.test(s))return!0}return!1};E.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;J.lastIndex=this.pos;var e=J.exec(this.input),t=this.pos+e[0].length,i;return!re.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(Te(i=this.input.charCodeAt(t+8))||i>55295&&i<56320))};E.parseStatement=function(e,t,i){var r=this.type,n=this.startNode(),s;switch(this.isLet(e)&&(r=u._var,s="let"),r){case u._break:case u._continue:return this.parseBreakContinueStatement(n,r.keyword);case u._debugger:return this.parseDebuggerStatement(n);case u._do:return this.parseDoStatement(n);case u._for:return this.parseForStatement(n);case u._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,!1,!e);case u._class:return e&&this.unexpected(),this.parseClass(n,!0);case u._if:return this.parseIfStatement(n);case u._return:return this.parseReturnStatement(n);case u._switch:return this.parseSwitchStatement(n);case u._throw:return this.parseThrowStatement(n);case u._try:return this.parseTryStatement(n);case u._const:case u._var:return s=s||this.value,e&&s!=="var"&&this.unexpected(),this.parseVarStatement(n,s);case u._while:return this.parseWhileStatement(n);case u._with:return this.parseWithStatement(n);case u.braceL:return this.parseBlock(!0,n);case u.semi:return this.parseEmptyStatement(n);case u._export:case u._import:if(this.options.ecmaVersion>10&&r===u._import){J.lastIndex=this.pos;var a=J.exec(this.input),o=this.pos+a[0].length,c=this.input.charCodeAt(o);if(c===40||c===46)return this.parseExpressionStatement(n,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===u._import?this.parseImport(n):this.parseExport(n,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(n,!0,!e);var h=this.value,l=this.parseExpression();return r===u.name&&l.type==="Identifier"&&this.eat(u.colon)?this.parseLabeledStatement(n,h,l,e):this.parseExpressionStatement(n,l)}};E.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(u.semi)||this.insertSemicolon()?e.label=null:this.type!==u.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var n=this.labels[r];if((e.label==null||n.name===e.label.name)&&(n.kind!=null&&(i||n.kind==="loop")||e.label&&i))break}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")};E.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")};E.parseDoStatement=function(e){return this.next(),this.labels.push(Rt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(u._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(u.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};E.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Rt),this.enterScope(0),this.expect(u.parenL),this.type===u.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===u._var||this.type===u._const||i){var r=this.startNode(),n=i?"let":this.value;return this.next(),this.parseVar(r,!0,n),this.finishNode(r,"VariableDeclaration"),(this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===u._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var s=this.isContextual("let"),a=!1,o=this.containsEsc,c=new at,h=this.start,l=t>-1?this.parseExprSubscripts(c,"await"):this.parseExpression(!0,c);return this.type===u._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===u._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(l.start===h&&!o&&l.type==="Identifier"&&l.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),s&&a&&this.raise(l.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(l,!1,c),this.checkLValPattern(l),this.parseForIn(e,l)):(this.checkExpressionErrors(c,!0),t>-1&&this.unexpected(t),this.parseFor(e,l))};E.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,$e|(i?0:bt),!1,t)};E.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(u._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};E.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(u.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};E.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(u.braceL),this.labels.push(Nr),this.enterScope(0);for(var t,i=!1;this.type!==u.braceR;)if(this.type===u._case||this.type===u._default){var r=this.type===u._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(u.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")};E.parseThrowStatement=function(e){return this.next(),re.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 Cr=[];E.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?yi:0),this.checkLValPattern(e,t?vi:me),this.expect(u.parenR),e};E.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===u._catch){var t=this.startNode();this.next(),this.eat(u.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(u._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};E.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")};E.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Rt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};E.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")};E.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};E.parseLabeledStatement=function(e,t,i,r){for(var n=0,s=this.labels;n<s.length;n+=1){var a=s[n];a.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===u._switch?"switch":null,c=this.labels.length-1;c>=0;c--){var h=this.labels[c];if(h.statementStart===e.start)h.statementStart=this.start,h.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")};E.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};E.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(u.braceL),e&&this.enterScope(0);this.type!==u.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};E.parseFor=function(e,t){return e.init=t,this.expect(u.semi),e.test=this.type===u.semi?null:this.parseExpression(),this.expect(u.semi),e.update=this.type===u.parenR?null:this.parseExpression(),this.expect(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};E.parseForIn=function(e,t){var i=this.type===u._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(u.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};E.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var n=this.startNode();if(this.parseVarId(n,i),this.eat(u.eq)?n.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===u._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&n.id.type!=="Identifier"&&!(t&&(this.type===u._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):n.init=null,e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(u.comma))break}return e};E.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Pt:me,!1)};var $e=1,bt=2,Si=4;E.parseFunction=function(e,t,i,r,n){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===u.star&&t&bt&&this.unexpected(),e.generator=this.eat(u.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&$e&&(e.id=t&Si&&this.type!==u.name?null:this.parseIdent(),e.id&&!(t&bt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Pt:me:bi));var s=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Tt(e.async,e.generator)),t&$e||(e.id=this.type===u.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,n),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&$e?"FunctionDeclaration":"FunctionExpression")};E.parseFunctionParams=function(e){this.expect(u.parenL),e.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};E.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),n=this.startNode(),s=!1;for(n.body=[],this.expect(u.braceL);this.type!==u.braceR;){var a=this.parseClassElement(e.superClass!==null);a&&(n.body.push(a),a.type==="MethodDefinition"&&a.kind==="constructor"?(s&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),s=!0):a.key&&a.key.type==="PrivateIdentifier"&&kr(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(n,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};E.parseClassElement=function(e){if(this.eat(u.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",n=!1,s=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(u.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===u.star?o=!0:r="static"}if(i.static=o,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===u.star)&&!this.canInsertSemicolon()?s=!0:r="async"),!r&&(t>=9||!s)&&this.eat(u.star)&&(n=!0),!r&&!s&&!n){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=c:r=c)}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===u.parenL||a!=="method"||n||s){var h=!i.static&&et(i,"constructor"),l=h&&e;h&&a!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=h?"constructor":a,this.parseClassMethod(i,n,s,l)}else this.parseClassField(i);return i};E.isClassElementNameStart=function(){return this.type===u.name||this.type===u.privateId||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword};E.parseClassElementName=function(e){this.type===u.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)};E.parseClassMethod=function(e,t,i,r){var n=e.key;e.kind==="constructor"?(t&&this.raise(n.start,"Constructor can't be a generator"),i&&this.raise(n.start,"Constructor can't be an async method")):e.static&&et(e,"prototype")&&this.raise(n.start,"Classes may not have a static property named prototype");var s=e.value=this.parseMethod(t,i,r);return e.kind==="get"&&s.params.length!==0&&this.raiseRecoverable(s.start,"getter should have no params"),e.kind==="set"&&s.params.length!==1&&this.raiseRecoverable(s.start,"setter should have exactly one param"),e.kind==="set"&&s.params[0].type==="RestElement"&&this.raiseRecoverable(s.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};E.parseClassField=function(e){if(et(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&et(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(u.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")};E.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(ze|It);this.type!==u.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};E.parseClassId=function(e,t){this.type===u.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,me,!1)):(t===!0&&this.unexpected(),e.id=null)};E.parseClassSuper=function(e){e.superClass=this.eat(u._extends)?this.parseExprSubscripts(null,!1):null};E.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};E.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,n=r===0?null:this.privateNameStack[r-1],s=0;s<i.length;++s){var a=i[s];Me(t,a.name)||(n?n.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}};function kr(e,t){var i=t.key.name,r=e[i],n="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(n=(t.static?"s":"i")+t.kind),r==="iget"&&n==="iset"||r==="iset"&&n==="iget"||r==="sget"&&n==="sset"||r==="sset"&&n==="sget"?(e[i]="true",!1):r?!0:(e[i]=n,!1)}function et(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}E.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!==u.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};E.parseExport=function(e,t){if(this.next(),this.eat(u.star))return this.parseExportAllDeclaration(e,t);if(this.eat(u._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!==u.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 n=r[i];this.checkUnreserved(n.local),this.checkLocalExport(n.local),n.local.type==="Literal"&&this.raise(n.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")};E.parseExportDeclaration=function(e){return this.parseStatement(null)};E.parseExportDefaultDeclaration=function(){var e;if(this.type===u._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,$e|Si,!1,e)}else if(this.type===u._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};E.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),Me(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)};E.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,n=t.properties;r<n.length;r+=1){var s=n[r];this.checkPatternExport(e,s)}else if(i==="ArrayPattern")for(var a=0,o=t.elements;a<o.length;a+=1){var c=o[a];c&&this.checkPatternExport(e,c)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)};E.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var n=r[i];this.checkPatternExport(e,n.id)}};E.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};E.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")};E.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(u.braceL);!this.eat(u.braceR);){if(i)i=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;t.push(this.parseExportSpecifier(e))}return t};E.parseImport=function(e){return this.next(),this.type===u.string?(e.specifiers=Cr,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===u.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")};E.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,me),this.finishNode(e,"ImportSpecifier")};E.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,me),this.finishNode(e,"ImportDefaultSpecifier")};E.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,me),this.finishNode(e,"ImportNamespaceSpecifier")};E.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===u.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(u.comma)))return e;if(this.type===u.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(u.braceL);!this.eat(u.braceR);){if(t)t=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;e.push(this.parseImportSpecifier())}return e};E.parseWithClause=function(){var e=[];if(!this.eat(u._with))return e;this.expect(u.braceL);for(var t={},i=!0;!this.eat(u.braceR);){if(i)i=!1;else if(this.expect(u.comma),this.afterTrailingComma(u.braceR))break;var r=this.parseImportAttribute(),n=r.key.type==="Identifier"?r.key.name:r.key.value;Me(t,n)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+n+"'"),t[n]=!0,e.push(r)}return e};E.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===u.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(u.colon),this.type!==u.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")};E.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===u.string){var e=this.parseLiteral(this.value);return vr.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};E.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)};E.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 ne=F.prototype;ne.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,n=e.properties;r<n.length;r+=1){var s=n[r];this.toAssignable(s,t),s.type==="RestElement"&&(s.argument.type==="ArrayPattern"||s.argument.type==="ObjectPattern")&&this.raise(s.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};ne.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var n=e[r];n&&this.toAssignable(n,t)}if(i){var s=e[i-1];this.options.ecmaVersion===6&&t&&s&&s.type==="RestElement"&&s.argument.type!=="Identifier"&&this.unexpected(s.argument.start)}return e};ne.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")};ne.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==u.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")};ne.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case u.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(u.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case u.braceL:return this.parseObj(!0)}return this.parseIdent()};ne.parseBindingList=function(e,t,i,r){for(var n=[],s=!0;!this.eat(e);)if(s?s=!1:this.expect(u.comma),t&&this.type===u.comma)n.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===u.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),n.push(a),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else n.push(this.parseAssignableListItem(r))}return n};ne.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};ne.parseBindingListItem=function(e){return e};ne.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(u.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};ne.checkLValSimple=function(e,t,i){t===void 0&&(t=Je);var r=t!==Je;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===me&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(Me(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==_i&&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")}};ne.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=Je),e.type){case"ObjectPattern":for(var r=0,n=e.properties;r<n.length;r+=1){var s=n[r];this.checkLValInnerPattern(s,t,i)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var c=o[a];c&&this.checkLValInnerPattern(c,t,i)}break;default:this.checkLValSimple(e,t,i)}};ne.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=Je),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 se=function(t,i,r,n,s){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=n,this.generator=!!s},O={b_stat:new se("{",!1),b_expr:new se("{",!0),b_tmpl:new se("${",!1),p_stat:new se("(",!1),p_expr:new se("(",!0),q_tmpl:new se("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new se("function",!1),f_expr:new se("function",!0),f_expr_gen:new se("function",!0,!1,null,!0),f_gen:new se("function",!1,!1,null,!0)},Oe=F.prototype;Oe.initialContext=function(){return[O.b_stat]};Oe.curContext=function(){return this.context[this.context.length-1]};Oe.braceIsBlock=function(e){var t=this.curContext();return t===O.f_expr||t===O.f_stat?!0:e===u.colon&&(t===O.b_stat||t===O.b_expr)?!t.isExpr:e===u._return||e===u.name&&this.exprAllowed?re.test(this.input.slice(this.lastTokEnd,this.start)):e===u._else||e===u.semi||e===u.eof||e===u.parenR||e===u.arrow?!0:e===u.braceL?t===O.b_stat:e===u._var||e===u._const||e===u.name?!1:!this.exprAllowed};Oe.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};Oe.updateContext=function(e){var t,i=this.type;i.keyword&&e===u.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};Oe.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};u.parenR.updateContext=u.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===O.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};u.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?O.b_stat:O.b_expr),this.exprAllowed=!0};u.dollarBraceL.updateContext=function(){this.context.push(O.b_tmpl),this.exprAllowed=!0};u.parenL.updateContext=function(e){var t=e===u._if||e===u._for||e===u._with||e===u._while;this.context.push(t?O.p_stat:O.p_expr),this.exprAllowed=!0};u.incDec.updateContext=function(){};u._function.updateContext=u._class.updateContext=function(e){e.beforeExpr&&e!==u._else&&!(e===u.semi&&this.curContext()!==O.p_stat)&&!(e===u._return&&re.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===u.colon||e===u.braceL)&&this.curContext()===O.b_stat)?this.context.push(O.f_expr):this.context.push(O.f_stat),this.exprAllowed=!1};u.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};u.backQuote.updateContext=function(){this.curContext()===O.q_tmpl?this.context.pop():this.context.push(O.q_tmpl),this.exprAllowed=!1};u.star.updateContext=function(e){if(e===u._function){var t=this.context.length-1;this.context[t]===O.f_expr?this.context[t]=O.f_expr_gen:this.context[t]=O.f_gen}this.exprAllowed=!0};u.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==u.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var I=F.prototype;I.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,n;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var s=e.kind;if(this.options.ecmaVersion>=6){n==="__proto__"&&s==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);return}n="$"+n;var a=t[n];if(a){var o;s==="init"?o=this.strict&&a.init||a.get||a.set:o=a.init||a[s],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else a=t[n]={init:!1,get:!1,set:!1};a[s]=!0}};I.parseExpression=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeAssign(e,t);if(this.type===u.comma){var s=this.startNodeAt(i,r);for(s.expressions=[n];this.eat(u.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(s,"SequenceExpression")}return n};I.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,n=-1,s=-1,a=-1;t?(n=t.parenthesizedAssign,s=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new at,r=!0);var o=this.start,c=this.startLoc;(this.type===u.parenL||this.type===u.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var h=this.parseMaybeConditional(e,t);if(i&&(h=i.call(this,h,o,c)),this.type.isAssign){var l=this.startNodeAt(o,c);return l.operator=this.value,this.type===u.eq&&(h=this.toAssignable(h,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=h.start&&(t.shorthandAssign=-1),this.type===u.eq?this.checkLValPattern(h):this.checkLValSimple(h),l.left=h,this.next(),l.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(l,"AssignmentExpression")}else r&&this.checkExpressionErrors(t,!0);return n>-1&&(t.parenthesizedAssign=n),s>-1&&(t.trailingComma=s),h};I.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,n=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return n;if(this.eat(u.question)){var s=this.startNodeAt(i,r);return s.test=n,s.consequent=this.parseMaybeAssign(),this.expect(u.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return n};I.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,n=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||n.start===i&&n.type==="ArrowFunctionExpression"?n:this.parseExprOp(n,i,r,-1,e)};I.parseExprOp=function(e,t,i,r,n){var s=this.type.binop;if(s!=null&&(!n||this.type!==u._in)&&s>r){var a=this.type===u.logicalOR||this.type===u.logicalAND,o=this.type===u.coalesce;o&&(s=u.logicalAND.binop);var c=this.value;this.next();var h=this.start,l=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),h,l,s,n),g=this.buildBinary(t,i,e,f,c,a||o);return(a&&this.type===u.coalesce||o&&(this.type===u.logicalOR||this.type===u.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(g,t,i,r,n)}return e};I.buildBinary=function(e,t,i,r,n,s){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=n,a.right=r,this.finishNode(a,s?"LogicalExpression":"BinaryExpression")};I.parseMaybeUnary=function(e,t,i,r){var n=this.start,s=this.startLoc,a;if(this.isContextual("await")&&this.canAwait)a=this.parseAwait(r),t=!0;else if(this.type.prefix){var o=this.startNode(),c=this.type===u.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&Ei(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&vt(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,a=this.finishNode(o,c?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===u.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),a=this.parsePrivateIdent(),this.type!==u._in&&this.unexpected();else{if(a=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return a;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(n,s);h.operator=this.value,h.prefix=!1,h.argument=a,this.checkLValSimple(a),this.next(),a=this.finishNode(h,"UpdateExpression")}}if(!i&&this.eat(u.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(n,s,a,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return a};function Ei(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Ei(e.expression)}function vt(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&vt(e.expression)||e.type==="ParenthesizedExpression"&&vt(e.expression)}I.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,n=this.parseExprAtom(e,t);if(n.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return n;var s=this.parseSubscripts(n,i,r,!1,t);return e&&s.type==="MemberExpression"&&(e.parenthesizedAssign>=s.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=s.start&&(e.parenthesizedBind=-1),e.trailingComma>=s.start&&(e.trailingComma=-1)),s};I.parseSubscripts=function(e,t,i,r,n){for(var s=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,s,a,n);if(o.optional&&(a=!0),o===e||o.type==="ArrowFunctionExpression"){if(a){var c=this.startNodeAt(t,i);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}e=o}};I.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(u.arrow)};I.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)};I.parseSubscript=function(e,t,i,r,n,s,a){var o=this.options.ecmaVersion>=11,c=o&&this.eat(u.questionDot);r&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(u.bracketL);if(h||c&&this.type!==u.parenL&&this.type!==u.backQuote||this.eat(u.dot)){var l=this.startNodeAt(t,i);l.object=e,h?(l.property=this.parseExpression(),this.expect(u.bracketR)):this.type===u.privateId&&e.type!=="Super"?l.property=this.parsePrivateIdent():l.property=this.parseIdent(this.options.allowReserved!=="never"),l.computed=!!h,o&&(l.optional=c),e=this.finishNode(l,"MemberExpression")}else if(!r&&this.eat(u.parenL)){var f=new at,g=this.yieldPos,p=this.awaitPos,x=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var y=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1,f);if(n&&!c&&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=c),e=this.finishNode(w,"CallExpression")}else if(this.type===u.backQuote){(c||s)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var S=this.startNodeAt(t,i);S.tag=e,S.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(S,"TaggedTemplateExpression")}return e};I.parseExprAtom=function(e,t,i){this.type===u.slash&&this.readRegexp();var r,n=this.potentialArrowAt===this.start;switch(this.type){case u._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===u.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==u.dot&&this.type!==u.bracketL&&this.type!==u.parenL&&this.unexpected(),this.finishNode(r,"Super");case u._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case u.name:var s=this.start,a=this.startLoc,o=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&c.name==="async"&&!this.canInsertSemicolon()&&this.eat(u._function))return this.overrideContext(O.f_expr),this.parseFunction(this.startNodeAt(s,a),0,!1,!0,t);if(n&&!this.canInsertSemicolon()){if(this.eat(u.arrow))return this.parseArrowExpression(this.startNodeAt(s,a),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===u.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(u.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,a),[c],!0,t)}return c;case u.regexp:var h=this.value;return r=this.parseLiteral(h.value),r.regex={pattern:h.pattern,flags:h.flags},r;case u.num:case u.string:return this.parseLiteral(this.value);case u._null:case u._true:case u._false:return r=this.startNode(),r.value=this.type===u._null?null:this.type===u._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case u.parenL:var l=this.start,f=this.parseParenAndDistinguishExpression(n,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),f;case u.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(u.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case u.braceL:return this.overrideContext(O.b_expr),this.parseObj(!1,e);case u._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case u._class:return this.parseClass(this.startNode(),!1);case u._new:return this.parseNew();case u.backQuote:return this.parseTemplate();case u._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};I.parseExprAtomDefault=function(){this.unexpected()};I.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===u.parenL&&!e)return this.parseDynamicImport(t);if(this.type===u.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()};I.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(u.parenR)?e.options=null:(this.expect(u.comma),this.afterTrailingComma(u.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(u.parenR)||(this.expect(u.comma),this.afterTrailingComma(u.parenR)||this.unexpected())));else if(!this.eat(u.parenR)){var t=this.start;this.eat(u.comma)&&this.eat(u.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};I.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")};I.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")};I.parseParenExpression=function(){this.expect(u.parenL);var e=this.parseExpression();return this.expect(u.parenR),e};I.shouldParseArrow=function(e){return!this.canInsertSemicolon()};I.parseParenAndDistinguishExpression=function(e,t){var i=this.start,r=this.startLoc,n,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a=this.start,o=this.startLoc,c=[],h=!0,l=!1,f=new at,g=this.yieldPos,p=this.awaitPos,x;for(this.yieldPos=0,this.awaitPos=0;this.type!==u.parenR;)if(h?h=!1:this.expect(u.comma),s&&this.afterTrailingComma(u.parenR,!0)){l=!0;break}else if(this.type===u.ellipsis){x=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===u.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var y=this.lastTokEnd,w=this.lastTokEndLoc;if(this.expect(u.parenR),e&&this.shouldParseArrow(c)&&this.eat(u.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=g,this.awaitPos=p,this.parseParenArrowList(i,r,c,t);(!c.length||l)&&this.unexpected(this.lastTokStart),x&&this.unexpected(x),this.checkExpressionErrors(f,!0),this.yieldPos=g||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(n=this.startNodeAt(a,o),n.expressions=c,this.finishNodeAt(n,"SequenceExpression",y,w)):n=c[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var S=this.startNodeAt(i,r);return S.expression=n,this.finishNode(S,"ParenthesizedExpression")}else return n};I.parseParenItem=function(e){return e};I.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var Ir=[];I.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===u.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,n=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,n,!0,!1),this.eat(u.parenL)?e.arguments=this.parseExprList(u.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Ir,this.finishNode(e,"NewExpression")};I.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===u.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===u.backQuote,this.finishNode(i,"TemplateElement")};I.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===u.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(u.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(u.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};I.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===u.name||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===u.star)&&!re.test(this.input.slice(this.lastTokEnd,this.start))};I.parseObj=function(e,t){var i=this.startNode(),r=!0,n={};for(i.properties=[],this.next();!this.eat(u.braceR);){if(r)r=!1;else if(this.expect(u.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(u.braceR))break;var s=this.parseProperty(e,t);e||this.checkPropClash(s,n,t),i.properties.push(s)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")};I.parseProperty=function(e,t){var i=this.startNode(),r,n,s,a;if(this.options.ecmaVersion>=9&&this.eat(u.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===u.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===u.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)&&(s=this.start,a=this.startLoc),e||(r=this.eat(u.star)));var o=this.containsEsc;return this.parsePropertyName(i),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(n=!0,r=this.options.ecmaVersion>=9&&this.eat(u.star),this.parsePropertyName(i)):n=!1,this.parsePropertyValue(i,e,r,n,s,a,t,o),this.finishNode(i,"Property")};I.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")};I.parsePropertyValue=function(e,t,i,r,n,s,a,o){(i||r)&&this.type===u.colon&&this.unexpected(),this.eat(u.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===u.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!==u.comma&&this.type!==u.braceR&&this.type!==u.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=n),e.kind="init",t?e.value=this.parseMaybeDefault(n,s,this.copyNode(e.key)):this.type===u.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(n,s,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};I.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(u.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(u.bracketR),e.key;e.computed=!1}return e.key=this.type===u.num||this.type===u.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};I.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};I.parseMethod=function(e,t,i){var r=this.startNode(),n=this.yieldPos,s=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?yi:0)),this.expect(u.parenL),r.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=n,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(r,"FunctionExpression")};I.parseArrowExpression=function(e,t,i,r){var n=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(It(i,!1)|gi),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=n,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")};I.parseFunctionBody=function(e,t,i,r){var n=t&&this.type!==u.braceL,s=this.strict,a=!1;if(n)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!s||o)&&(a=this.strictDirective(this.end),a&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!s&&!a&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,vi),e.body=this.parseBlock(!1,void 0,a&&!s),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()};I.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};I.checkParams=function(e,t){for(var i=Object.create(null),r=0,n=e.params;r<n.length;r+=1){var s=n[r];this.checkLValInnerPattern(s,At,t?null:i)}};I.parseExprList=function(e,t,i,r){for(var n=[],s=!0;!this.eat(e);){if(s)s=!1;else if(this.expect(u.comma),t&&this.afterTrailingComma(e))break;var a=void 0;i&&this.type===u.comma?a=null:this.type===u.ellipsis?(a=this.parseSpread(r),r&&this.type===u.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):a=this.parseMaybeAssign(!1,r),n.push(a)}return n};I.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 n=this.strict?this.reservedWordsStrict:this.reservedWords;n.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"))}};I.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};I.parseIdentNode=function(){var e=this.startNode();return this.type===u.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=u.name):this.unexpected(),e};I.parsePrivateIdent=function(){var e=this.startNode();return this.type===u.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};I.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===u.semi||this.canInsertSemicolon()||this.type!==u.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(u.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")};I.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 et=F.prototype;et.raise=function(e,t){var i=mi(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};et.raiseRecoverable=et.raise;et.curPosition=function(){if(this.options.locations)return new qe(this.curLine,this.pos-this.lineStart)};var we=F.prototype,Sr=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};we.enterScope=function(e){this.scopeStack.push(new Sr(e))};we.exitScope=function(){this.scopeStack.pop()};we.treatFunctionsAsVarInScope=function(e){return e.flags&Ve||!this.inModule&&e.flags&Ue};we.declareName=function(e,t,i){var r=!1;if(t===me){var n=this.currentScope();r=n.lexical.indexOf(e)>-1||n.functions.indexOf(e)>-1||n.var.indexOf(e)>-1,n.lexical.push(e),this.inModule&&n.flags&Ue&&delete this.undefinedExports[e]}else if(t===bi){var s=this.currentScope();s.lexical.push(e)}else if(t===wi){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 c=this.scopeStack[o];if(c.lexical.indexOf(e)>-1&&!(c.flags&xi&&c.lexical[0]===e)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(e)>-1){r=!0;break}if(c.var.push(e),this.inModule&&c.flags&Ue&&delete this.undefinedExports[e],c.flags&kt)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};we.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};we.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};we.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&kt)return t}};we.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&kt&&!(t.flags&gi))return t}};var at=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new nt(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},ze=F.prototype;ze.startNode=function(){return new at(this,this.start,this.startLoc)};ze.startNodeAt=function(e,t){return new at(this,e,t)};function Ei(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}ze.finishNode=function(e,t){return Ei.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};ze.finishNodeAt=function(e,t,i,r){return Ei.call(this,e,t,i,r)};ze.copyNode=function(e){var t=new at(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Er="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",Ni="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",Ci=Ni+" Extended_Pictographic",ki=Ci,Ii=ki+" EBase EComp EMod EPres ExtPict",Ai=Ii,Nr=Ai,Cr={9:Ni,10:Ci,11:ki,12:Ii,13:Ai,14:Nr},kr="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Ir={9:"",10:"",11:"",12:"",13:"",14:kr},$t="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",Ti="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",Pi=Ti+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ri=Pi+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Di=Ri+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Mi=Di+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ar=Mi+" "+Er,Tr={9:Ti,10:Pi,11:Ri,12:Di,13:Mi,14:Ar},Vi={};function Pr(e){var t=Vi[e]={binary:ge(Cr[e]+" "+$t),binaryOfStrings:ge(Ir[e]),nonBinary:{General_Category:ge($t),Script:ge(Tr[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 pt=0,Wt=[9,10,11,12,13,14];pt<Wt.length;pt+=1){var Rr=Wt[pt];Pr(Rr)}var _=F.prototype,tt=function(t,i){this.parent=t,this.base=i||this};tt.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};tt.prototype.sibling=function(){return new tt(this.parent,this.base)};var he=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=Vi[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};he.prototype.reset=function(t,i,r){var n=r.indexOf("v")!==-1,s=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,n&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=s&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=s&&this.parser.options.ecmaVersion>=9)};he.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};he.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,n=r.length;if(t>=n)return-1;var s=r.charCodeAt(t);if(!(i||this.switchU)||s<=55295||s>=57344||t+1>=n)return s;var a=r.charCodeAt(t+1);return a>=56320&&a<=57343?(s<<10)+a-56613888:s};he.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,n=r.length;if(t>=n)return n;var s=r.charCodeAt(t),a;return!(i||this.switchU)||s<=55295||s>=57344||t+1>=n||(a=r.charCodeAt(t+1))<56320||a>57343?t+1:t+2};he.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};he.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};he.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};he.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};he.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var r=this.pos,n=0,s=t;n<s.length;n+=1){var a=s[n],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,n=!1,s=0;s<i.length;s++){var a=i.charAt(s);t.indexOf(a)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(a,s+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),a==="u"&&(r=!0),a==="v"&&(n=!0)}this.options.ecmaVersion>=15&&r&&n&&this.raise(e.start,"Invalid regular expression flag")};function Dr(e){for(var t in e)return!0;return!1}_.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Dr(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 tt(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,n=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue),e.eat(125)))return n!==-1&&n<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 n=0;n<i.length;n++){var s=i.charAt(n);i.indexOf(s,n+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 c=a.charAt(o);(a.indexOf(c,o+1)>-1||i.indexOf(c)>-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&&Mr(i);)t+=pe(i),e.advance();return t};function Mr(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 Oi(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Oi(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&&!Oi(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,n=i;r<n.length;r+=1){var s=n[r];s.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+=pe(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=pe(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),Vr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Vr(e){return le(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),Or(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Or(e){return Te(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&&!ot(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 Li(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Li(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 n=e.lastIntValue;if(r&&n>=55296&&n<=56319){var s=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=(n-55296)*1024+(a-56320)+65536,!0}e.pos=s,e.lastIntValue=n}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Lr(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function Lr(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 Bi=0,fe=1,ee=2;_.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Br(t))return e.lastIntValue=-1,e.advance(),fe;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===ee&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return Bi};function Br(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),fe}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,n)}return Bi};_.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){Me(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 fe;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ee;e.raise("Invalid property name")};_.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Fi(t=e.current());)e.lastStringValue+=pe(t),e.advance();return e.lastStringValue!==""};function Fi(e){return Li(e)||e===95}_.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Fr(t=e.current());)e.lastStringValue+=pe(t),e.advance();return e.lastStringValue!==""};function Fr(e){return Fi(e)||ot(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===ee&&e.raise("Negated character class may contain strings"),!0}return!1};_.regexp_classContents=function(e){return e.current()===93?fe:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),fe)};_.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||Wi(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=fe,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===ee&&(t=ee);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==ee&&(t=fe);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===ee&&(t=ee)}};_.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)?fe: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===ee&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var n=this.regexp_eatCharacterClassEscape(e);if(n)return n;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)===ee&&(t=ee);return t};_.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?fe:ee};_.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)||$r(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 $r(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 Wr(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Wr(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 ot(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;ot(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function ot(e){return e>=48&&e<=57}_.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;ji(i=e.current());)e.lastIntValue=16*e.lastIntValue+$i(i),e.advance();return e.pos!==t};function ji(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function $i(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 Wi(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Wi(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 n=e.current();if(!ji(n))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+$i(n),e.advance()}return!0};var Pt=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new nt(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},T=F.prototype;T.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 Pt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};T.getToken=function(){return this.next(),new Pt(this)};typeof Symbol<"u"&&(T[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===u.eof,value:t}}}});T.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(u.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};T.readToken=function(e){return le(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};T.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};T.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,n=t;(r=li(this.input,n,this.pos))>-1;)++this.curLine,n=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())};T.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&&!De(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())};T.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&&pi.test(String.fromCharCode(e)))++this.pos;else break e}}};T.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)};T.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(u.ellipsis)):(++this.pos,this.finishToken(u.dot))};T.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(u.assign,2):this.finishOp(u.slash,1)};T.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?u.star:u.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=u.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(u.assign,i+1):this.finishOp(r,i)};T.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(u.assign,3)}return this.finishOp(e===124?u.logicalOR:u.logicalAND,2)}return t===61?this.finishOp(u.assign,2):this.finishOp(e===124?u.bitwiseOR:u.bitwiseAND,1)};T.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(u.assign,2):this.finishOp(u.bitwiseXOR,1)};T.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||re.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(u.incDec,2):t===61?this.finishOp(u.assign,2):this.finishOp(u.plusMin,1)};T.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(u.assign,i+1):this.finishOp(u.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(u.relational,i))};T.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(u.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(u.arrow)):this.finishOp(e===61?u.eq:u.prefix,1)};T.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(u.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(u.assign,3)}return this.finishOp(u.coalesce,2)}}return this.finishOp(u.question,1)};T.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),le(t,!0)||t===92))return this.finishToken(u.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+pe(t)+"'")};T.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(u.parenL);case 41:return++this.pos,this.finishToken(u.parenR);case 59:return++this.pos,this.finishToken(u.semi);case 44:return++this.pos,this.finishToken(u.comma);case 91:return++this.pos,this.finishToken(u.bracketL);case 93:return++this.pos,this.finishToken(u.bracketR);case 123:return++this.pos,this.finishToken(u.braceL);case 125:return++this.pos,this.finishToken(u.braceR);case 58:return++this.pos,this.finishToken(u.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(u.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(u.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+pe(e)+"'")};T.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};T.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(re.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 n=this.input.slice(i,this.pos);++this.pos;var s=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(s);var o=this.regexpState||(this.regexpState=new he(this));o.reset(i,n,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var c=null;try{c=new RegExp(n,a)}catch{}return this.finishToken(u.regexp,{pattern:n,flags:a,value:c})};T.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&t===void 0,n=i&&this.input.charCodeAt(this.pos)===48,s=this.pos,a=0,o=0,c=0,h=t??1/0;c<h;++c,++this.pos){var l=this.input.charCodeAt(this.pos),f=void 0;if(r&&l===95){n&&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"),c===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===s||t!=null&&this.pos-s!==t?null:a};function qr(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function qi(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}T.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=qi(this.input.slice(t,this.pos)),++this.pos):le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,i)};T.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 n=qi(this.input.slice(t,this.pos));return++this.pos,le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,n)}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")),le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=qr(this.input.slice(t,this.pos),i);return this.finishToken(u.num,s)};T.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};T.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)):(De(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(u.string,t)};var Ui={};T.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Ui)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};T.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ui;this.raise(e,t)};T.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===u.template||this.type===u.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(u.dollarBraceL)):(++this.pos,this.finishToken(u.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(u.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(De(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===u.backQuote,this.finishNode(i,"TemplateElement")};I.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===u.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(u.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(u.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};I.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===u.name||this.type===u.num||this.type===u.string||this.type===u.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===u.star)&&!re.test(this.input.slice(this.lastTokEnd,this.start))};I.parseObj=function(e,t){var i=this.startNode(),r=!0,n={};for(i.properties=[],this.next();!this.eat(u.braceR);){if(r)r=!1;else if(this.expect(u.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(u.braceR))break;var s=this.parseProperty(e,t);e||this.checkPropClash(s,n,t),i.properties.push(s)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")};I.parseProperty=function(e,t){var i=this.startNode(),r,n,s,a;if(this.options.ecmaVersion>=9&&this.eat(u.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===u.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===u.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)&&(s=this.start,a=this.startLoc),e||(r=this.eat(u.star)));var o=this.containsEsc;return this.parsePropertyName(i),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(n=!0,r=this.options.ecmaVersion>=9&&this.eat(u.star),this.parsePropertyName(i)):n=!1,this.parsePropertyValue(i,e,r,n,s,a,t,o),this.finishNode(i,"Property")};I.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")};I.parsePropertyValue=function(e,t,i,r,n,s,a,o){(i||r)&&this.type===u.colon&&this.unexpected(),this.eat(u.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===u.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!==u.comma&&this.type!==u.braceR&&this.type!==u.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=n),e.kind="init",t?e.value=this.parseMaybeDefault(n,s,this.copyNode(e.key)):this.type===u.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(n,s,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};I.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(u.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(u.bracketR),e.key;e.computed=!1}return e.key=this.type===u.num||this.type===u.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};I.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};I.parseMethod=function(e,t,i){var r=this.startNode(),n=this.yieldPos,s=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(Tt(t,r.generator)|It|(i?wi:0)),this.expect(u.parenL),r.params=this.parseBindingList(u.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=n,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(r,"FunctionExpression")};I.parseArrowExpression=function(e,t,i,r){var n=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(Tt(i,!1)|xi),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=n,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")};I.parseFunctionBody=function(e,t,i,r){var n=t&&this.type!==u.braceL,s=this.strict,a=!1;if(n)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!s||o)&&(a=this.strictDirective(this.end),a&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!s&&!a&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,_i),e.body=this.parseBlock(!1,void 0,a&&!s),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()};I.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};I.checkParams=function(e,t){for(var i=Object.create(null),r=0,n=e.params;r<n.length;r+=1){var s=n[r];this.checkLValInnerPattern(s,Pt,t?null:i)}};I.parseExprList=function(e,t,i,r){for(var n=[],s=!0;!this.eat(e);){if(s)s=!1;else if(this.expect(u.comma),t&&this.afterTrailingComma(e))break;var a=void 0;i&&this.type===u.comma?a=null:this.type===u.ellipsis?(a=this.parseSpread(r),r&&this.type===u.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):a=this.parseMaybeAssign(!1,r),n.push(a)}return n};I.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 n=this.strict?this.reservedWordsStrict:this.reservedWords;n.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"))}};I.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};I.parseIdentNode=function(){var e=this.startNode();return this.type===u.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=u.name):this.unexpected(),e};I.parsePrivateIdent=function(){var e=this.startNode();return this.type===u.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};I.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===u.semi||this.canInsertSemicolon()||this.type!==u.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(u.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")};I.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 tt=F.prototype;tt.raise=function(e,t){var i=di(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};tt.raiseRecoverable=tt.raise;tt.curPosition=function(){if(this.options.locations)return new Ue(this.curLine,this.pos-this.lineStart)};var we=F.prototype,Ar=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};we.enterScope=function(e){this.scopeStack.push(new Ar(e))};we.exitScope=function(){this.scopeStack.pop()};we.treatFunctionsAsVarInScope=function(e){return e.flags&Ve||!this.inModule&&e.flags&Ke};we.declareName=function(e,t,i){var r=!1;if(t===me){var n=this.currentScope();r=n.lexical.indexOf(e)>-1||n.functions.indexOf(e)>-1||n.var.indexOf(e)>-1,n.lexical.push(e),this.inModule&&n.flags&Ke&&delete this.undefinedExports[e]}else if(t===vi){var s=this.currentScope();s.lexical.push(e)}else if(t===bi){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 c=this.scopeStack[o];if(c.lexical.indexOf(e)>-1&&!(c.flags&yi&&c.lexical[0]===e)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(e)>-1){r=!0;break}if(c.var.push(e),this.inModule&&c.flags&Ke&&delete this.undefinedExports[e],c.flags&At)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};we.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};we.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};we.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&At)return t}};we.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&At&&!(t.flags&xi))return t}};var ot=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new st(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},He=F.prototype;He.startNode=function(){return new ot(this,this.start,this.startLoc)};He.startNodeAt=function(e,t){return new ot(this,e,t)};function Ni(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}He.finishNode=function(e,t){return Ni.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};He.finishNodeAt=function(e,t,i,r){return Ni.call(this,e,t,i,r)};He.copyNode=function(e){var t=new ot(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Tr="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",Ci="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",ki=Ci+" Extended_Pictographic",Ii=ki,Ai=Ii+" EBase EComp EMod EPres ExtPict",Ti=Ai,Pr=Ti,Rr={9:Ci,10:ki,11:Ii,12:Ai,13:Ti,14:Pr},Dr="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Mr={9:"",10:"",11:"",12:"",13:"",14:Dr},Wt="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",Pi="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",Ri=Pi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Di=Ri+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Mi=Di+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Vi=Mi+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Vr=Vi+" "+Tr,Or={9:Pi,10:Ri,11:Di,12:Mi,13:Vi,14:Vr},Oi={};function Lr(e){var t=Oi[e]={binary:ge(Rr[e]+" "+Wt),binaryOfStrings:ge(Mr[e]),nonBinary:{General_Category:ge(Wt),Script:ge(Or[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 ft=0,qt=[9,10,11,12,13,14];ft<qt.length;ft+=1){var Br=qt[ft];Lr(Br)}var _=F.prototype,it=function(t,i){this.parent=t,this.base=i||this};it.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};it.prototype.sibling=function(){return new it(this.parent,this.base)};var he=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=Oi[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};he.prototype.reset=function(t,i,r){var n=r.indexOf("v")!==-1,s=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,n&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=s&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=s&&this.parser.options.ecmaVersion>=9)};he.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};he.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,n=r.length;if(t>=n)return-1;var s=r.charCodeAt(t);if(!(i||this.switchU)||s<=55295||s>=57344||t+1>=n)return s;var a=r.charCodeAt(t+1);return a>=56320&&a<=57343?(s<<10)+a-56613888:s};he.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,n=r.length;if(t>=n)return n;var s=r.charCodeAt(t),a;return!(i||this.switchU)||s<=55295||s>=57344||t+1>=n||(a=r.charCodeAt(t+1))<56320||a>57343?t+1:t+2};he.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};he.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};he.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};he.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};he.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var r=this.pos,n=0,s=t;n<s.length;n+=1){var a=s[n],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,n=!1,s=0;s<i.length;s++){var a=i.charAt(s);t.indexOf(a)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(a,s+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),a==="u"&&(r=!0),a==="v"&&(n=!0)}this.options.ecmaVersion>=15&&r&&n&&this.raise(e.start,"Invalid regular expression flag")};function Fr(e){for(var t in e)return!0;return!1}_.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Fr(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 it(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,n=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue),e.eat(125)))return n!==-1&&n<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 n=0;n<i.length;n++){var s=i.charAt(n);i.indexOf(s,n+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 c=a.charAt(o);(a.indexOf(c,o+1)>-1||i.indexOf(c)>-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&&jr(i);)t+=pe(i),e.advance();return t};function jr(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 Li(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Li(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&&!Li(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,n=i;r<n.length;r+=1){var s=n[r];s.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+=pe(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=pe(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),$r(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function $r(e){return le(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),Wr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Wr(e){return Te(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&&!ct(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 Bi(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Bi(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 n=e.lastIntValue;if(r&&n>=55296&&n<=56319){var s=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=(n-55296)*1024+(a-56320)+65536,!0}e.pos=s,e.lastIntValue=n}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 Fi=0,fe=1,ee=2;_.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Ur(t))return e.lastIntValue=-1,e.advance(),fe;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===ee&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return Fi};function Ur(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),fe}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,n)}return Fi};_.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){Me(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 fe;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ee;e.raise("Invalid property name")};_.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";ji(t=e.current());)e.lastStringValue+=pe(t),e.advance();return e.lastStringValue!==""};function ji(e){return Bi(e)||e===95}_.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Kr(t=e.current());)e.lastStringValue+=pe(t),e.advance();return e.lastStringValue!==""};function Kr(e){return ji(e)||ct(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===ee&&e.raise("Negated character class may contain strings"),!0}return!1};_.regexp_classContents=function(e){return e.current()===93?fe:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),fe)};_.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||qi(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=fe,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===ee&&(t=ee);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==ee&&(t=fe);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===ee&&(t=ee)}};_.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)?fe: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===ee&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var n=this.regexp_eatCharacterClassEscape(e);if(n)return n;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)===ee&&(t=ee);return t};_.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?fe:ee};_.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)||Hr(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 Hr(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 Gr(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Gr(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 ct(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;ct(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function ct(e){return e>=48&&e<=57}_.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;$i(i=e.current());)e.lastIntValue=16*e.lastIntValue+Wi(i),e.advance();return e.pos!==t};function $i(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Wi(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 qi(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function qi(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 n=e.current();if(!$i(n))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+Wi(n),e.advance()}return!0};var Dt=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new st(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},T=F.prototype;T.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 Dt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};T.getToken=function(){return this.next(),new Dt(this)};typeof Symbol<"u"&&(T[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===u.eof,value:t}}}});T.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(u.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};T.readToken=function(e){return le(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};T.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};T.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,n=t;(r=pi(this.input,n,this.pos))>-1;)++this.curLine,n=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())};T.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&&!De(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())};T.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&&fi.test(String.fromCharCode(e)))++this.pos;else break e}}};T.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)};T.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(u.ellipsis)):(++this.pos,this.finishToken(u.dot))};T.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(u.assign,2):this.finishOp(u.slash,1)};T.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?u.star:u.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=u.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(u.assign,i+1):this.finishOp(r,i)};T.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(u.assign,3)}return this.finishOp(e===124?u.logicalOR:u.logicalAND,2)}return t===61?this.finishOp(u.assign,2):this.finishOp(e===124?u.bitwiseOR:u.bitwiseAND,1)};T.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(u.assign,2):this.finishOp(u.bitwiseXOR,1)};T.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||re.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(u.incDec,2):t===61?this.finishOp(u.assign,2):this.finishOp(u.plusMin,1)};T.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(u.assign,i+1):this.finishOp(u.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(u.relational,i))};T.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(u.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(u.arrow)):this.finishOp(e===61?u.eq:u.prefix,1)};T.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(u.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(u.assign,3)}return this.finishOp(u.coalesce,2)}}return this.finishOp(u.question,1)};T.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),le(t,!0)||t===92))return this.finishToken(u.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+pe(t)+"'")};T.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(u.parenL);case 41:return++this.pos,this.finishToken(u.parenR);case 59:return++this.pos,this.finishToken(u.semi);case 44:return++this.pos,this.finishToken(u.comma);case 91:return++this.pos,this.finishToken(u.bracketL);case 93:return++this.pos,this.finishToken(u.bracketR);case 123:return++this.pos,this.finishToken(u.braceL);case 125:return++this.pos,this.finishToken(u.braceR);case 58:return++this.pos,this.finishToken(u.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(u.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(u.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+pe(e)+"'")};T.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};T.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(re.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 n=this.input.slice(i,this.pos);++this.pos;var s=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(s);var o=this.regexpState||(this.regexpState=new he(this));o.reset(i,n,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var c=null;try{c=new RegExp(n,a)}catch{}return this.finishToken(u.regexp,{pattern:n,flags:a,value:c})};T.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&t===void 0,n=i&&this.input.charCodeAt(this.pos)===48,s=this.pos,a=0,o=0,c=0,h=t??1/0;c<h;++c,++this.pos){var l=this.input.charCodeAt(this.pos),f=void 0;if(r&&l===95){n&&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"),c===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===s||t!=null&&this.pos-s!==t?null:a};function Yr(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Ui(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}T.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=Ui(this.input.slice(t,this.pos)),++this.pos):le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,i)};T.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 n=Ui(this.input.slice(t,this.pos));return++this.pos,le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(u.num,n)}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")),le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=Yr(this.input.slice(t,this.pos),i);return this.finishToken(u.num,s)};T.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};T.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)):(De(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(u.string,t)};var Ki={};T.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Ki)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};T.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ki;this.raise(e,t)};T.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===u.template||this.type===u.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(u.dollarBraceL)):(++this.pos,this.finishToken(u.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(u.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(De(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}};T.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(u.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")};T.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 pe(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],n=parseInt(r,8);return n>255&&(r=r.slice(0,-1),n=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(n)}return De(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}};T.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i};T.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(Te(n,r))this.pos+=n<=65535?1:2;else if(n===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var s=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?le:Te)(a,r)||this.invalidStringToken(s,"Invalid Unicode escape"),e+=pe(a),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)};T.readWord=function(){var e=this.readWord1(),t=u.name;return this.keywords.test(e)&&(t=Et[e]),this.finishToken(t,e)};var Ur="8.14.0";F.acorn={Parser:F,version:Ur,defaultOptions:xt,Position:qe,SourceLocation:nt,getLineInfo:mi,Node:at,TokenType:R,tokTypes:u,keywordTypes:Et,TokContext:se,tokContexts:O,isIdentifierChar:Te,isIdentifierStart:le,Token:Pt,isNewLine:De,lineBreak:re,lineBreakG:pr,nonASCIIwhitespace:pi};function Ki(e,t){return F.parse(e,t)}const{stringify:Kr}=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 Qe={"||":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},ae=17,zr={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:ae,ClassExpression:ae,FunctionExpression:ae,ObjectExpression:ae,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function Ie(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 n=1;n<r;n++){const s=t[n];e.write(", "),i[s.type](s,e)}}e.write(")")}function zi(e,t,i,r){const n=e.expressionsPrecedence[t.type];if(n===ae)return!0;const s=e.expressionsPrecedence[i.type];return n!==s?!r&&n===15&&s===14&&i.operator==="**"||n<s:n!==13&&n!==14?!1:t.operator==="**"&&i.operator==="**"?!r:n===13&&s===13&&(t.operator==="??"||i.operator==="??")?!0:r?Qe[t.operator]<=Qe[i.operator]:Qe[t.operator]<Qe[i.operator]}function Xe(e,t,i,r){const{generator:n}=e;zi(e,t,i,r)?(e.write("("),n[t.type](t,e),e.write(")")):n[t.type](t,e)}function Hr(e,t,i,r){const n=t.split(`
26
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return pe(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],n=parseInt(r,8);return n>255&&(r=r.slice(0,-1),n=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(n)}return De(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}};T.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i};T.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(Te(n,r))this.pos+=n<=65535?1:2;else if(n===92){this.containsEsc=!0,e+=this.input.slice(i,this.pos);var s=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?le:Te)(a,r)||this.invalidStringToken(s,"Invalid Unicode escape"),e+=pe(a),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)};T.readWord=function(){var e=this.readWord1(),t=u.name;return this.keywords.test(e)&&(t=Ct[e]),this.finishToken(t,e)};var Qr="8.14.0";F.acorn={Parser:F,version:Qr,defaultOptions:wt,Position:Ue,SourceLocation:st,getLineInfo:di,Node:ot,TokenType:R,tokTypes:u,keywordTypes:Ct,TokContext:se,tokContexts:O,isIdentifierChar:Te,isIdentifierStart:le,Token:Dt,isNewLine:De,lineBreak:re,lineBreakG:yr,nonASCIIwhitespace:fi};function zi(e,t){return F.parse(e,t)}const{stringify:Xr}=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 Xe={"||":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},ae=17,Zr={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:ae,ClassExpression:ae,FunctionExpression:ae,ObjectExpression:ae,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function Ie(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 n=1;n<r;n++){const s=t[n];e.write(", "),i[s.type](s,e)}}e.write(")")}function Hi(e,t,i,r){const n=e.expressionsPrecedence[t.type];if(n===ae)return!0;const s=e.expressionsPrecedence[i.type];return n!==s?!r&&n===15&&s===14&&i.operator==="**"||n<s:n!==13&&n!==14?!1:t.operator==="**"&&i.operator==="**"?!r:n===13&&s===13&&(t.operator==="??"||i.operator==="??")?!0:r?Xe[t.operator]<=Xe[i.operator]:Xe[t.operator]<Xe[i.operator]}function Ze(e,t,i,r){const{generator:n}=e;Hi(e,t,i,r)?(e.write("("),n[t.type](t,e),e.write(")")):n[t.type](t,e)}function Jr(e,t,i,r){const n=t.split(`
27
27
  `),s=n.length-1;if(e.write(n[0].trim()),s>0){e.write(r);for(let a=1;a<s;a++)e.write(i+n[a].trim()+r);e.write(i+n[s].trim())}}function U(e,t,i,r){const{length:n}=t;for(let s=0;s<n;s++){const a=t[s];e.write(i),a.type[0]==="L"?e.write("// "+a.value.trim()+`
28
- `,a):(e.write("/*"),Hr(e,a.value,i,r),e.write("*/"+r))}}function Gr(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 ft(e,t){const{generator:i}=e,{declarations:r}=t;e.write(t.kind+" ");const{length:n}=r;if(n>0){i.VariableDeclarator(r[0],e);for(let s=1;s<n;s++)e.write(", "),i.VariableDeclarator(r[s],e)}}let qt,Ut,Kt,zt,Ht,Gt;const Rt={Program(e,t){const i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:n}=t;n&&e.comments!=null&&U(t,e.comments,i,r);const s=e.body,{length:a}=s;for(let o=0;o<a;o++){const c=s[o];n&&c.comments!=null&&U(t,c.comments,i,r),t.write(i),this[c.type](c,t),t.write(r)}n&&e.trailingComments!=null&&U(t,e.trailingComments,i,r)},BlockStatement:Gt=function(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:n}=t,s=i+t.indent;t.write("{");const a=e.body;if(a!=null&&a.length>0){t.write(r),n&&e.comments!=null&&U(t,e.comments,s,r);const{length:o}=a;for(let c=0;c<o;c++){const h=a[c];n&&h.comments!=null&&U(t,h.comments,s,r),t.write(s),this[h.type](h,t),t.write(r)}t.write(i)}else n&&e.comments!=null&&(t.write(r),U(t,e.comments,s,r),t.write(i));n&&e.trailingComments!=null&&U(t,e.trailingComments,s,r),t.write("}"),t.indentLevel--},ClassBody:Gt,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===ae||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:n}=t;t.indentLevel++;const s=i+t.indent,a=s+t.indent;t.write("switch ("),this[e.discriminant.type](e.discriminant,t),t.write(") {"+r);const{cases:o}=e,{length:c}=o;for(let h=0;h<c;h++){const l=o[h];n&&l.comments!=null&&U(t,l.comments,s,r),l.test?(t.write(s+"case "),this[l.test.type](l.test,t),t.write(":"+r)):t.write(s+"default:"+r);const{consequent:f}=l,{length:g}=f;for(let p=0;p<g;p++){const x=f[p];n&&x.comments!=null&&U(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"?ft(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:qt=function(e,t){t.write(`for ${e.await?"await ":""}(`);const{left:i}=e;i.type[0]==="V"?ft(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:qt,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:Ut=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),Ie(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:Ut,VariableDeclaration(e,t){ft(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,n=t.expressionsPrecedence[r];(r[0]!=="C"||r[1]!=="l"||r[5]!=="E")&&(n===ae||n<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:n}=i;let s=0;if(n>0){for(;s<n;){s>0&&t.write(", ");const a=i[s],o=a.type[6];if(o==="D")t.write(a.local.name,a),s++;else if(o==="N")t.write("* as "+a.local.name,a),s++;else break}if(s<n){for(t.write("{");;){const a=i[s],{name:o}=a.imported;if(t.write(o,a),o!==a.local.name&&t.write(" as "+a.local.name),++s<n)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 n=0;;){const s=i[n],{name:a}=s.local;if(t.write(a,s),a!==s.exported.name&&t.write(" as "+s.exported.name),++n<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 n=0;n<e.attributes.length;n++)this.ImportAttribute(e.attributes[n],t),n<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),Ie(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]):Ie(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:Kt=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:Kt,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),Xe(t,e.argument,e)},TemplateLiteral(e,t){const{quasis:i,expressions:r}=e;t.write("`");const{length:n}=r;for(let a=0;a<n;a++){const o=r[a],c=i[a];t.write(c.value.raw,c),t.write("${"),this[o.type](o,t),t.write("}")}const s=i[i.length-1];t.write(s.value.raw,s),t.write("`")},TemplateElement(e,t){t.write(e.value.raw,e)},TaggedTemplateExpression(e,t){Xe(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:Ht=function(e,t){if(t.write("["),e.elements.length>0){const{elements:i}=e,{length:r}=i;for(let n=0;;){const s=i[n];if(s!=null&&this[s.type](s,t),++n<r)t.write(", ");else{s==null&&t.write(", ");break}}}t.write("]")},ArrayPattern:Ht,ObjectExpression(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:n}=t,s=i+t.indent;if(t.write("{"),e.properties.length>0){t.write(r),n&&e.comments!=null&&U(t,e.comments,s,r);const a=","+r,{properties:o}=e,{length:c}=o;for(let h=0;;){const l=o[h];if(n&&l.comments!=null&&U(t,l.comments,s,r),t.write(s),this[l.type](l,t),++h<c)t.write(a);else break}t.write(r),n&&e.trailingComments!=null&&U(t,e.trailingComments,s,r),t.write(i+"}")}else n?e.comments!=null?(t.write(r),U(t,e.comments,s,r),e.trailingComments!=null&&U(t,e.trailingComments,s,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),U(t,e.trailingComments,s,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 n=0;this[i[n].type](i[n],t),++n<r;)t.write(", ")}t.write("}")},SequenceExpression(e,t){Ie(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){const{operator:i,argument:r,argument:{type:n}}=e;t.write(i);const s=zi(t,r,e);!s&&(i.length>1||n[0]==="U"&&(n[1]==="n"||n[1]==="p")&&r.prefix&&r.operator[0]===i&&(i==="+"||i==="-"))&&t.write(" "),s?(t.write(i.length>1?" (":"("),this[n](r,t),t.write(")")):this[n](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:zt=function(e,t){const i=e.operator==="in";i&&t.write("("),Xe(t,e.left,e,!1),t.write(" "+e.operator+" "),Xe(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:zt,ConditionalExpression(e,t){const{test:i}=e,r=t.expressionsPrecedence[i.type];r===ae||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===ae||i<t.expressionsPrecedence.CallExpression||Gr(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),Ie(t,e.arguments)},CallExpression(e,t){const i=t.expressionsPrecedence[e.callee.type];i===ae||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("?."),Ie(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){const i=t.expressionsPrecedence[e.object.type];i===ae||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(Kr(e.value),e)},RegExpLiteral(e,t){const{regex:i}=e;t.write(`/${i.pattern}/${i.flags}`,e)}},Yr={},Qr=Rt;class Xr{constructor(t){const i=t??Yr;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:Rt,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:zr,this.indent=i.indent!=null?i.indent:" ",this.lineEnd=i.lineEnd!=null?i.lineEnd:`
28
+ `,a):(e.write("/*"),Jr(e,a.value,i,r),e.write("*/"+r))}}function en(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:n}=r;if(n>0){i.VariableDeclarator(r[0],e);for(let s=1;s<n;s++)e.write(", "),i.VariableDeclarator(r[s],e)}}let Ut,Kt,zt,Ht,Gt,Yt;const Mt={Program(e,t){const i=t.indent.repeat(t.indentLevel),{lineEnd:r,writeComments:n}=t;n&&e.comments!=null&&U(t,e.comments,i,r);const s=e.body,{length:a}=s;for(let o=0;o<a;o++){const c=s[o];n&&c.comments!=null&&U(t,c.comments,i,r),t.write(i),this[c.type](c,t),t.write(r)}n&&e.trailingComments!=null&&U(t,e.trailingComments,i,r)},BlockStatement:Yt=function(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:n}=t,s=i+t.indent;t.write("{");const a=e.body;if(a!=null&&a.length>0){t.write(r),n&&e.comments!=null&&U(t,e.comments,s,r);const{length:o}=a;for(let c=0;c<o;c++){const h=a[c];n&&h.comments!=null&&U(t,h.comments,s,r),t.write(s),this[h.type](h,t),t.write(r)}t.write(i)}else n&&e.comments!=null&&(t.write(r),U(t,e.comments,s,r),t.write(i));n&&e.trailingComments!=null&&U(t,e.trailingComments,s,r),t.write("}"),t.indentLevel--},ClassBody:Yt,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===ae||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:n}=t;t.indentLevel++;const s=i+t.indent,a=s+t.indent;t.write("switch ("),this[e.discriminant.type](e.discriminant,t),t.write(") {"+r);const{cases:o}=e,{length:c}=o;for(let h=0;h<c;h++){const l=o[h];n&&l.comments!=null&&U(t,l.comments,s,r),l.test?(t.write(s+"case "),this[l.test.type](l.test,t),t.write(":"+r)):t.write(s+"default:"+r);const{consequent:f}=l,{length:g}=f;for(let p=0;p<g;p++){const x=f[p];n&&x.comments!=null&&U(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:Ut=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:Ut,DebuggerStatement(e,t){t.write("debugger;",e)},FunctionDeclaration:Kt=function(e,t){t.write((e.async?"async ":"")+(e.generator?"function* ":"function ")+(e.id?e.id.name:""),e),Ie(t,e.params),t.write(" "),this[e.body.type](e.body,t)},FunctionExpression:Kt,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,n=t.expressionsPrecedence[r];(r[0]!=="C"||r[1]!=="l"||r[5]!=="E")&&(n===ae||n<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:n}=i;let s=0;if(n>0){for(;s<n;){s>0&&t.write(", ");const a=i[s],o=a.type[6];if(o==="D")t.write(a.local.name,a),s++;else if(o==="N")t.write("* as "+a.local.name,a),s++;else break}if(s<n){for(t.write("{");;){const a=i[s],{name:o}=a.imported;if(t.write(o,a),o!==a.local.name&&t.write(" as "+a.local.name),++s<n)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 n=0;;){const s=i[n],{name:a}=s.local;if(t.write(a,s),a!==s.exported.name&&t.write(" as "+s.exported.name),++n<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 n=0;n<e.attributes.length;n++)this.ImportAttribute(e.attributes[n],t),n<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),Ie(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]):Ie(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:zt=function(e,t){t.write("..."),this[e.argument.type](e.argument,t)},SpreadElement:zt,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),Ze(t,e.argument,e)},TemplateLiteral(e,t){const{quasis:i,expressions:r}=e;t.write("`");const{length:n}=r;for(let a=0;a<n;a++){const o=r[a],c=i[a];t.write(c.value.raw,c),t.write("${"),this[o.type](o,t),t.write("}")}const s=i[i.length-1];t.write(s.value.raw,s),t.write("`")},TemplateElement(e,t){t.write(e.value.raw,e)},TaggedTemplateExpression(e,t){Ze(t,e.tag,e),this[e.quasi.type](e.quasi,t)},ArrayExpression:Gt=function(e,t){if(t.write("["),e.elements.length>0){const{elements:i}=e,{length:r}=i;for(let n=0;;){const s=i[n];if(s!=null&&this[s.type](s,t),++n<r)t.write(", ");else{s==null&&t.write(", ");break}}}t.write("]")},ArrayPattern:Gt,ObjectExpression(e,t){const i=t.indent.repeat(t.indentLevel++),{lineEnd:r,writeComments:n}=t,s=i+t.indent;if(t.write("{"),e.properties.length>0){t.write(r),n&&e.comments!=null&&U(t,e.comments,s,r);const a=","+r,{properties:o}=e,{length:c}=o;for(let h=0;;){const l=o[h];if(n&&l.comments!=null&&U(t,l.comments,s,r),t.write(s),this[l.type](l,t),++h<c)t.write(a);else break}t.write(r),n&&e.trailingComments!=null&&U(t,e.trailingComments,s,r),t.write(i+"}")}else n?e.comments!=null?(t.write(r),U(t,e.comments,s,r),e.trailingComments!=null&&U(t,e.trailingComments,s,r),t.write(i+"}")):e.trailingComments!=null?(t.write(r),U(t,e.trailingComments,s,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 n=0;this[i[n].type](i[n],t),++n<r;)t.write(", ")}t.write("}")},SequenceExpression(e,t){Ie(t,e.expressions)},UnaryExpression(e,t){if(e.prefix){const{operator:i,argument:r,argument:{type:n}}=e;t.write(i);const s=Hi(t,r,e);!s&&(i.length>1||n[0]==="U"&&(n[1]==="n"||n[1]==="p")&&r.prefix&&r.operator[0]===i&&(i==="+"||i==="-"))&&t.write(" "),s?(t.write(i.length>1?" (":"("),this[n](r,t),t.write(")")):this[n](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:Ht=function(e,t){const i=e.operator==="in";i&&t.write("("),Ze(t,e.left,e,!1),t.write(" "+e.operator+" "),Ze(t,e.right,e,!0),i&&t.write(")")},LogicalExpression:Ht,ConditionalExpression(e,t){const{test:i}=e,r=t.expressionsPrecedence[i.type];r===ae||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===ae||i<t.expressionsPrecedence.CallExpression||en(e.callee)?(t.write("("),this[e.callee.type](e.callee,t),t.write(")")):this[e.callee.type](e.callee,t),Ie(t,e.arguments)},CallExpression(e,t){const i=t.expressionsPrecedence[e.callee.type];i===ae||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("?."),Ie(t,e.arguments)},ChainExpression(e,t){this[e.expression.type](e.expression,t)},MemberExpression(e,t){const i=t.expressionsPrecedence[e.object.type];i===ae||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(Xr(e.value),e)},RegExpLiteral(e,t){const{regex:i}=e;t.write(`/${i.pattern}/${i.flags}`,e)}},tn={},rn=Mt;class nn{constructor(t){const i=t??tn;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:Zr,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:s}=i;if(s[0]==="L"&&s[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(s[0]==="T"&&s[8]==="E"||s[0]==="L"&&s[1]==="i"&&typeof i.value=="string"){const{length:a}=t;let{column:o,line:c}=this;for(let h=0;h<a;h++)t[h]===`
31
- `?(o=0,c++):o++;this.column=o,this.line=c;return}}const{length:r}=t,{lineEnd:n}=this;r>0&&(this.lineEndSize>0&&(n.length===1?t[r-1]===n:t.endsWith(n))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}}function Hi(e,t){const i=new Xr(t);return i.generator[e.type](e,i),i.output}const Zr=new Set(["Infinity","NaN","undefined","null","true","false"]),Jr=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 en{scopes=[];scopeTypes=[];scopeCounts=new Map;contextBoundVars=new Set;arrayPatternElements=new Set;rootParams=new Set;localSeriesVars=new Set;varKinds=new Map;loopVars=new Set;loopVarNames=new Map;paramIdCounter=0;cacheIdCounter=0;tempVarCounter=0;taCallIdCounter=0;hoistingStack=[];suppressHoisting=!1;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++}`}}constructor(){this.pushScope("glb")}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 Zr.has(t)||Jr.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],n=this.scopeTypes[this.scopeTypes.length-1],s=this.scopeCounts.get(n)||1,a=`${n}${s}_${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 n=r.get(t),s=this.varKinds.get(n)||"let";return[n,s]}}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 Dt(e,t,i,r,n){i||(i=b),function s(a,o,c){var h=c||a.type;i[h](a,o,s),t[h]&&t[h](a,o)}(e,r,n)}function $(e,t,i,r,n){var s=i?tn(i,r||void 0):r;(function a(o,c,h){s[h||o.type](o,c,a)})(e,t,n)}function tn(e,t){var i=Object.create(t||b);for(var r in e)i[r]=e[r];return i}function Mt(e,t,i){i(e,t)}function Ne(e,t,i){}var b={};b.Program=b.BlockStatement=b.StaticBlock=function(e,t,i){for(var r=0,n=e.body;r<n.length;r+=1){var s=n[r];i(s,t,"Statement")}};b.Statement=Mt;b.EmptyStatement=Ne;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=Ne;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,n=e.cases;r<n.length;r+=1){var s=n[r];i(s,t)}};b.SwitchCase=function(e,t,i){e.test&&i(e.test,t,"Expression");for(var r=0,n=e.consequent;r<n.length;r+=1){var s=n[r];i(s,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=Ne;b.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")};b.VariableDeclaration=function(e,t,i){for(var r=0,n=e.declarations;r<n.length;r+=1){var s=n[r];i(s,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,n=e.params;r<n.length;r+=1){var s=n[r];i(s,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=Ne;b.MemberPattern=Mt;b.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")};b.ArrayPattern=function(e,t,i){for(var r=0,n=e.elements;r<n.length;r+=1){var s=n[r];s&&i(s,t,"Pattern")}};b.ObjectPattern=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){var s=n[r];s.type==="Property"?(s.computed&&i(s.key,t,"Expression"),i(s.value,t,"Pattern")):s.type==="RestElement"&&i(s.argument,t,"Pattern")}};b.Expression=Mt;b.ThisExpression=b.Super=b.MetaProperty=Ne;b.ArrayExpression=function(e,t,i){for(var r=0,n=e.elements;r<n.length;r+=1){var s=n[r];s&&i(s,t,"Expression")}};b.ObjectExpression=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){var s=n[r];i(s,t)}};b.FunctionExpression=b.ArrowFunctionExpression=b.FunctionDeclaration;b.SequenceExpression=function(e,t,i){for(var r=0,n=e.expressions;r<n.length;r+=1){var s=n[r];i(s,t,"Expression")}};b.TemplateLiteral=function(e,t,i){for(var r=0,n=e.quasis;r<n.length;r+=1){var s=n[r];i(s,t)}for(var a=0,o=e.expressions;a<o.length;a+=1){var c=o[a];i(c,t,"Expression")}};b.TemplateElement=Ne;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,n=e.arguments;r<n.length;r+=1){var s=n[r];i(s,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,n=e.specifiers;r<n.length;r+=1){var s=n[r];i(s,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=Ne;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,n=e.body;r<n.length;r+=1){var s=n[r];i(s,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 B="$",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(B)},createContextVariableReference(e,t){const i=this.createContextIdentifier(),r=this.createIdentifier(e),n=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),n,!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),n=[e,t];return i&&n.push(i),this.createCallExpression(r,n)},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}}},He=["ta","math","request","array","input"],rn=["hline"],nn=["request.security","request.security_lower_tf"],Gi=["open","high","low","close","volume","hl2","hlc3","ohlc4","openTime","closeTime"],Yi=[...He,"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"],sn=["na","nz","plot","plotchar","color","hline"];function an(e){let t=null,i=B;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,n=new Set,s=p=>{p.type==="Identifier"?r.add(p.name):p.type==="ObjectPattern"?p.properties.forEach(x=>s(x.value)):p.type==="ArrayPattern"&&p.elements.forEach(x=>{x&&s(x)})};$(e,{},{VariableDeclarator(p,x,y){s(p.id),p.init&&y(p.init,x)},FunctionDeclaration(p,x,y){s(p.id),y(p.body,x)},Identifier(p,x,y){n.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=>s(x.id)):p.type==="FunctionDeclaration"&&s(p.id)});const a=Gi,o=Yi,c=a.filter(p=>!r.has(p)),h=o.filter(p=>!r.has(p)),l=c.filter(p=>n.has(p)),f=h.filter(p=>n.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 on(e){let t=null,i=B;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 c=o.expression;c.body.type==="BlockStatement"&&(t=c.body.body,c.params.length>0&&c.params[0].type==="Identifier"&&(i=c.params[0].name))}}if(!t)return;const r=new Set(Gi),n=new Set(Yi),s=new Set(sn),a=new Map;t.forEach(o=>{o.type==="VariableDeclaration"&&o.declarations.forEach(c=>{if(c.init&&c.init.type==="MemberExpression"&&c.init.object.type==="Identifier"&&c.init.object.name===i&&c.init.property.type==="Identifier"){const h=c.init.property.name;let l=null;if(h==="data"?l=r:h==="pine"?l=n:h==="core"&&(l=s),l&&c.id.type==="ObjectPattern")c.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(c.id.type==="Identifier"&&He.includes(h)){const f=h,g=c.id.name;f!==g&&(a.set(g,f),c.id.name=f)}}})}),a.size>0&&$(e,{},{Identifier(o){a.has(o.name)&&(o.name=a.get(o.name))},MemberExpression(o,c,h){h(o.object,c),o.computed&&h(o.property,c)},Property(o,c,h){o.computed&&h(o.key,c),h(o.value,c)}})}function cn(e){try{const t=Ki(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 hn(e){return e.async=!0,Hi(e)}function un(e){e=e.trim();const{isWrapped:t,isAsync:i,functionNode:r}=cn(e);return t&&r?i?e:hn(r):`async (context) => {
31
+ `?(o=0,c++):o++;this.column=o,this.line=c;return}}const{length:r}=t,{lineEnd:n}=this;r>0&&(this.lineEndSize>0&&(n.length===1?t[r-1]===n:t.endsWith(n))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}}function Gi(e,t){const i=new nn(t);return i.generator[e.type](e,i),i.output}const sn=new Set(["Infinity","NaN","undefined","null","true","false"]),an=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 on{scopes=[];scopeTypes=[];scopeCounts=new Map;contextBoundVars=new Set;arrayPatternElements=new Set;rootParams=new Set;localSeriesVars=new Set;varKinds=new Map;loopVars=new Set;loopVarNames=new Map;paramIdCounter=0;cacheIdCounter=0;tempVarCounter=0;taCallIdCounter=0;hoistingStack=[];suppressHoisting=!1;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++}`}}constructor(){this.pushScope("glb")}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 sn.has(t)||an.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],n=this.scopeTypes[this.scopeTypes.length-1],s=this.scopeCounts.get(n)||1,a=`${n}${s}_${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 n=r.get(t),s=this.varKinds.get(n)||"let";return[n,s]}}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 Vt(e,t,i,r,n){i||(i=b),function s(a,o,c){var h=c||a.type;i[h](a,o,s),t[h]&&t[h](a,o)}(e,r,n)}function $(e,t,i,r,n){var s=i?cn(i,r||void 0):r;(function a(o,c,h){s[h||o.type](o,c,a)})(e,t,n)}function cn(e,t){var i=Object.create(t||b);for(var r in e)i[r]=e[r];return i}function Ot(e,t,i){i(e,t)}function Ne(e,t,i){}var b={};b.Program=b.BlockStatement=b.StaticBlock=function(e,t,i){for(var r=0,n=e.body;r<n.length;r+=1){var s=n[r];i(s,t,"Statement")}};b.Statement=Ot;b.EmptyStatement=Ne;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=Ne;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,n=e.cases;r<n.length;r+=1){var s=n[r];i(s,t)}};b.SwitchCase=function(e,t,i){e.test&&i(e.test,t,"Expression");for(var r=0,n=e.consequent;r<n.length;r+=1){var s=n[r];i(s,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=Ne;b.FunctionDeclaration=function(e,t,i){return i(e,t,"Function")};b.VariableDeclaration=function(e,t,i){for(var r=0,n=e.declarations;r<n.length;r+=1){var s=n[r];i(s,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,n=e.params;r<n.length;r+=1){var s=n[r];i(s,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=Ne;b.MemberPattern=Ot;b.RestElement=function(e,t,i){return i(e.argument,t,"Pattern")};b.ArrayPattern=function(e,t,i){for(var r=0,n=e.elements;r<n.length;r+=1){var s=n[r];s&&i(s,t,"Pattern")}};b.ObjectPattern=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){var s=n[r];s.type==="Property"?(s.computed&&i(s.key,t,"Expression"),i(s.value,t,"Pattern")):s.type==="RestElement"&&i(s.argument,t,"Pattern")}};b.Expression=Ot;b.ThisExpression=b.Super=b.MetaProperty=Ne;b.ArrayExpression=function(e,t,i){for(var r=0,n=e.elements;r<n.length;r+=1){var s=n[r];s&&i(s,t,"Expression")}};b.ObjectExpression=function(e,t,i){for(var r=0,n=e.properties;r<n.length;r+=1){var s=n[r];i(s,t)}};b.FunctionExpression=b.ArrowFunctionExpression=b.FunctionDeclaration;b.SequenceExpression=function(e,t,i){for(var r=0,n=e.expressions;r<n.length;r+=1){var s=n[r];i(s,t,"Expression")}};b.TemplateLiteral=function(e,t,i){for(var r=0,n=e.quasis;r<n.length;r+=1){var s=n[r];i(s,t)}for(var a=0,o=e.expressions;a<o.length;a+=1){var c=o[a];i(c,t,"Expression")}};b.TemplateElement=Ne;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,n=e.arguments;r<n.length;r+=1){var s=n[r];i(s,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,n=e.specifiers;r<n.length;r+=1){var s=n[r];i(s,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=Ne;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,n=e.body;r<n.length;r+=1){var s=n[r];i(s,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 B="$",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(B)},createContextVariableReference(e,t){const i=this.createContextIdentifier(),r=this.createIdentifier(e),n=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),n,!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),n=[e,t];return i&&n.push(i),this.createCallExpression(r,n)},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}}},Ge=["ta","math","request","array","input"],hn=["hline"],un=["request.security","request.security_lower_tf"],Yi=["open","high","low","close","volume","hl2","hlc3","ohlc4","openTime","closeTime"],Qi=[...Ge,"plotchar","plotshape","plotarrow","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","shape","location","size","format","dayofweek"],ln=["na","nz","plot","plotchar","color","hline"];function pn(e){let t=null,i=B;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,n=new Set,s=p=>{p.type==="Identifier"?r.add(p.name):p.type==="ObjectPattern"?p.properties.forEach(x=>s(x.value)):p.type==="ArrayPattern"&&p.elements.forEach(x=>{x&&s(x)})};$(e,{},{VariableDeclarator(p,x,y){s(p.id),p.init&&y(p.init,x)},FunctionDeclaration(p,x,y){s(p.id),y(p.body,x)},Identifier(p,x,y){n.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=>s(x.id)):p.type==="FunctionDeclaration"&&s(p.id)});const a=Yi,o=Qi,c=a.filter(p=>!r.has(p)),h=o.filter(p=>!r.has(p)),l=c.filter(p=>n.has(p)),f=h.filter(p=>n.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 fn(e){let t=null,i=B;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 c=o.expression;c.body.type==="BlockStatement"&&(t=c.body.body,c.params.length>0&&c.params[0].type==="Identifier"&&(i=c.params[0].name))}}if(!t)return;const r=new Set(Yi),n=new Set(Qi),s=new Set(ln),a=new Map;t.forEach(o=>{o.type==="VariableDeclaration"&&o.declarations.forEach(c=>{if(c.init&&c.init.type==="MemberExpression"&&c.init.object.type==="Identifier"&&c.init.object.name===i&&c.init.property.type==="Identifier"){const h=c.init.property.name;let l=null;if(h==="data"?l=r:h==="pine"?l=n:h==="core"&&(l=s),l&&c.id.type==="ObjectPattern")c.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(c.id.type==="Identifier"&&Ge.includes(h)){const f=h,g=c.id.name;f!==g&&(a.set(g,f),c.id.name=f)}}})}),a.size>0&&$(e,{},{Identifier(o){a.has(o.name)&&(o.name=a.get(o.name))},MemberExpression(o,c,h){h(o.object,c),o.computed&&h(o.property,c)},Property(o,c,h){o.computed&&h(o.key,c),h(o.value,c)}})}function mn(e){try{const t=zi(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 dn(e){return e.async=!0,Gi(e)}function gn(e){e=e.trim();const{isWrapped:t,isAsync:i,functionNode:r}=mn(e);return t&&r?i?e:dn(r):`async (context) => {
32
32
  ${e}
33
- }`}function ln(e){$(e,null,{VariableDeclaration(t,i,r){t.declarations&&t.declarations.length>0&&t.declarations.forEach(n=>{if(n.init&&n.init.type==="ArrowFunctionExpression"&&n.init.start!==0){const s={type:"FunctionDeclaration",id:n.id,params:n.init.params,body:n.init.body.type==="BlockStatement"?n.init.body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:n.init.body}]},async:n.init.async,generator:!1};Object.assign(t,s)}}),t.body&&t.body.body&&t.body.body.forEach(n=>r(n,i))}})}function pn(e,t){Dt(e,{VariableDeclaration(i){i.declarations.forEach(r=>{const n=r.init&&r.init.type==="MemberExpression"&&r.init.object&&(r.init.object.name==="context"||r.init.object.name===B||r.init.object.name==="context2"),s=r.init&&r.init.type==="MemberExpression"&&r.init.object?.object&&(r.init.object.object.name==="context"||r.init.object.object.name===B||r.init.object.object.name==="context2");(n||s)&&(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 fn(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&t.addContextBoundVar(r.name,i)})}function mn(e,t){e.params.forEach(i=>{i.type==="Identifier"&&t.addContextBoundVar(i.name,!1)})}function dn(e,t){let i;return Dt(e,{FunctionDeclaration(r){mn(r,t)},ArrowFunctionExpression(r){const n=r.start===0;n&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=B),fn(r,t,n)},VariableDeclaration(r){r.declarations.forEach(n=>{if(n.id.type==="ArrayPattern"){const s=t.generateTempVar(),a={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:s},init:n.init}]};n.id.elements?.forEach(c=>{c.type==="Identifier"&&t.addArrayPatternElement(c.name)});const o=n.id.elements.map((c,h)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:c,init:{type:"MemberExpression",object:{type:"Identifier",name:s},property:{type:"Literal",value:h},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[a,...o]})}})},ForStatement(r){}}),i}const bt={type:"Identifier",name:"undefined"};function ye(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),n=v.createContextVariableReference(r,i),s=v.createGetCall(n,e.property);Object.assign(e,s),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||(ye(i,t),i._indexTransformed=!0)}}}function ue(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 G(e,t){if(e.name!==B){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===B&&["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"&&He.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),n=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 s=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||n||i||o||s){if(s||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 c=t.isContextBound(e.name)&&!t.isRootParam(e.name);if(c&&!(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[h,l]=t.getVariable(e.name);let f;if(c)f=v.createIdentifier(e.name);else{if(h===e.name&&!t.isContextBound(e.name))return;f=v.createContextVariableReference(l,h)}if(a)Object.assign(e,f);else{const g=v.createGetCall(f,0);Object.assign(e,g)}}}function te(e,t,i){if(e.object&&e.object.type==="Identifier"&&e.object.name==="Math")return;if(e.object&&e.object.type==="Identifier"&&He.includes(e.object.name)&&i.isContextBound(e.object.name)&&!e.computed){const c=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,h=e.parent&&(e.parent.type==="VariableDeclarator"||e.parent.type==="Property"||e.parent.type==="AssignmentExpression");if(!c&&!h){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",n=i.getCurrentScopeType()=="els",s=i.getCurrentScopeType()=="for";if(!r&&!n&&!s&&e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)&&!e.computed)return;e._indexTransformed||(ye(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===B,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 c=v.createGetCall(e.object,e.property);e.start&&(c.start=e.start),e.end&&(c.end=e.end),Object.assign(e,c),delete e.object,delete e.property,delete e.computed}}function We(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[n,s]=t.getVariable(e.name);return v.createContextVariableReference(s,n)}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 xe(e,t,i=""){switch(e.type){case"BinaryExpression":return vt(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?We(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=We(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=xe(e.test,t,i),n=xe(e.consequent,t,i),s=xe(e.alternate,t,i);return{type:"ConditionalExpression",test:r,consequent:n,alternate:s,start:e.start,end:e.end}}}return e}function vt(e,t,i){const r=xe(e.left,t,i),n=xe(e.right,t,i),s={type:"BinaryExpression",operator:e.operator,left:r,right:n,start:e.start,end:e.end};return $(s,t,{CallExpression(a,o){a._transformed||ie(a,o)},MemberExpression(a){te(a,"",t)}}),s}function Yt(e,t,i){const r=xe(e.left,t,i),n=xe(e.right,t,i),s={type:"LogicalExpression",operator:e.operator,left:r,right:n,start:e.start,end:e.end};return $(s,t,{CallExpression(a,o){a._transformed||ie(a,o)}}),s}function Qt(e,t,i){$(e,{parent:e,inNamespaceCall:!1},{Identifier(a,o,c){if(a.name=="NaN")return;if(a.name=="na"){a.name="NaN";return}a.parent=o.parent,G(a,t);const h=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||h)&&(a.type==="MemberExpression"?ye(a,t):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===B&&a.parent.callee.property.name==="get"||ue(a)))},MemberExpression(a,o,c){ye(a,t),a.object&&c(a.object,{parent:a,inNamespaceCall:o.inNamespaceCall})},ConditionalExpression(a,o,c){const h={...o,parent:a};a.test&&c(a.test,h),a.consequent&&c(a.consequent,h),a.alternate&&c(a.alternate,h)},BinaryExpression(a,o,c){const h={...o,parent:a};c(a.left,h),c(a.right,h)},LogicalExpression(a,o,c){const h={...o,parent:a};c(a.left,h),c(a.right,h)},UnaryExpression(a,o,c){const h={...o,parent:a};c(a.argument,h)},CallExpression(a,o,c){const h=a.callee&&a.callee.type==="MemberExpression"&&a.callee.object&&a.callee.object.type==="Identifier"&&t.isContextBound(a.callee.object.name);ie(a,t),a.arguments.forEach(l=>c(l,{parent:a,inNamespaceCall:h||o.inNamespaceCall}))}});const r=v.createMemberExpression(v.createIdentifier(i),v.createIdentifier("param")),n=t.generateParamId(),s={type:"CallExpression",callee:r,arguments:[e,bt,{type:"Identifier",name:`'${n}'`}],_transformed:!0,_isParamCall:!0};if(!t.shouldSuppressHoisting()){const a=n;t.addLocalSeriesVar(a);const o=v.createVariableDeclaration(a,s);return t.addHoistedStatement(o),v.createIdentifier(a)}return s}function _t(e,t,i){const r=xe(e.argument,t,i);return{type:"UnaryExpression",operator:e.operator,prefix:e.prefix,argument:r,start:e.start,end:e.end}}function St(e,t,i){switch(e?.type){case"BinaryExpression":e=vt(e,i,t);break;case"LogicalExpression":e=Yt(e,i,t);break;case"ConditionalExpression":return Qt(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[c,h]=i.getVariable(o.name);return v.createContextVariableAccess0(h,c)}return o});break}if(e.type==="MemberExpression"&&e.computed&&e.property){e.object.type==="CallExpression"?ie(e.object,i):e.object.type==="MemberExpression"?te(e.object,"",i):e.object.type==="BinaryExpression"?e.object=vt(e.object,i,t):e.object.type==="LogicalExpression"?e.object=Yt(e.object,i,t):e.object.type==="ConditionalExpression"?e.object=Qt(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:We(e.object,i),c=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?We(e.property,i):e.property,h=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),l=i.generateParamId(),f={type:"CallExpression",callee:h,arguments:[o,c,{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[c,h]=i.getVariable(o.value.name);return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createContextVariableReference(h,c),kind:"init",method:!1,shorthand:!1,computed:!1}}else o.value.type!=="Literal"&&(o.value=St(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")),c=i.generateParamId(),h={type:"CallExpression",callee:o,arguments:[e,bt,{type:"Identifier",name:`'${c}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const l=c;i.addLocalSeriesVar(l);const f=v.createVariableDeclaration(l,h);return i.addHoistedStatement(f),v.createIdentifier(l)}return h}}e?.type==="CallExpression"&&ie(e,i);const r=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),n=e.type==="Identifier"?We(e,i):e,s=i.generateParamId(),a={type:"CallExpression",callee:r,arguments:[n,bt,{type:"Identifier",name:`'${s}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const o=s;i.addLocalSeriesVar(o);const c=v.createVariableDeclaration(o,a);return i.addHoistedStatement(c),v.createIdentifier(o)}return a}function ie(e,t,i){if(e._transformed)return;e.callee&&e.callee.type==="Identifier"&&(He.includes(e.callee.name)||rn.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===B&&["get","init","param"].includes(e.callee.property.name))return;const n=e.callee.object.name,s=[];e.arguments.forEach(l=>{if(l._isParamCall){s.push(l);return}s.push(St(l,n,t))}),e.arguments=s,n==="ta"&&e.arguments.push(t.getNextTACallId());const a=e.callee.property.name,o=`${n}.${a}`,c=nn.includes(o),h=e._insideAwait===!0;if(c&&!h){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(n=>n._isParamCall?n:St(n,B,t)),e._transformed=!0);!r&&e.callee&&e.callee.type==="MemberExpression"&&e.callee.object.type==="Identifier"&&G(e.callee.object,t),e.arguments.forEach(n=>{$(n,{parent:e},{Identifier(s,a,o){s.parent=a.parent,G(s,t);const c=s.parent&&s.parent.type==="BinaryExpression";(s.parent&&s.parent.type==="ConditionalExpression"||c)&&(s.type==="MemberExpression"?ye(s,t):s.type==="Identifier"&&(s.parent&&s.parent.type==="CallExpression"&&s.parent.callee&&s.parent.callee.object&&s.parent.callee.object.name===B&&s.parent.callee.property.name==="get"||ue(s)))},BinaryExpression(s,a,o){const c={...a,parent:s};o(s.left,c),o(s.right,c)},LogicalExpression(s,a,o){const c={...a,parent:s};o(s.left,c),o(s.right,c)},UnaryExpression(s,a,o){const c={...a,parent:s};o(s.argument,c)},CallExpression(s,a,o){s._transformed||ie(s,t)},MemberExpression(s,a,o){te(s,"",t),s.object&&o(s.object,{parent:s})}})})}function Qi(e,t){let i=null;if(e.left.type==="Identifier"){const[r,n]=t.getVariable(e.left.name);i=v.createContextVariableReference(n,r)}else if(e.left.type==="MemberExpression"&&e.left.computed&&e.left.object.type==="Identifier"){const r=e.left.object.name,[n,s]=t.getVariable(r),a=n!==r,o=t.isContextBound(r);(a||o)&&!t.isLoopVariable(r)&&e.left.property.type==="Literal"&&e.left.property.value===0&&(i=v.createContextVariableReference(s,n))}if($(e.right,{parent:e.right,inNamespaceCall:!1},{Identifier(r,n,s){r.name=="na"&&(r.name="NaN"),r.parent=n.parent,G(r,t);const a=r.parent&&r.parent.type==="BinaryExpression",o=r.parent&&r.parent.type==="ConditionalExpression",c=t.isContextBound(r.name)&&!t.isRootParam(r.name),h=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===B&&r.parent.callee.property.name==="get";(c||o||a)&&(r.type==="MemberExpression"?ye(r,t):r.type==="Identifier"&&!f&&!h&&!l&&!g&&!p&&ue(r))},MemberExpression(r,n,s){te(r,"",t),r.type==="CallExpression"?r.arguments.forEach(a=>s(a,{parent:r,inNamespaceCall:n.inNamespaceCall})):r.object&&s(r.object,{parent:r,inNamespaceCall:n.inNamespaceCall})},CallExpression(r,n,s){const a=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&t.isContextBound(r.callee.object.name);ie(r,t),r.type==="CallExpression"&&r.arguments.forEach(o=>s(o,{parent:r,inNamespaceCall:a||n.inNamespaceCall}))}}),i){let r=e.right;if(e.operator!=="="){const s=e.operator.replace("=",""),a=v.createGetCall(i,0);r={type:"BinaryExpression",operator:s,left:a,right:e.right,start:e.start,end:e.end}}const n=v.createSetCall(i,r);e.start&&(n.start=e.start),e.end&&(n.end=e.end),Object.assign(e,n)}}function Xi(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===B||i.init.object.name==="context2"),n=i.init&&i.init.type==="MemberExpression"&&i.init.object?.object&&(i.init.object.object.name==="context"||i.init.object.object.name===B||i.init.object.object.name==="context2"),s=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=B;return}if(n){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=B;return}s&&i.init.params.forEach(p=>{p.type==="Identifier"&&t.addContextBoundVar(p.name)});const a=t.addVariable(i.id.name,e.kind),o=e.kind,c=t.isArrayPatternElement(i.id.name);i.init&&!s&&!c&&(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)?ie(i.init,t):$(i.init,{parent:i.init},{Identifier(p,x){p.parent=x.parent,G(p,t);const y=p.parent&&p.parent.type==="BinaryExpression",w=p.parent&&p.parent.type==="UnaryExpression",S=p.parent&&p.parent.type==="ConditionalExpression",k=p.parent&&p.parent.type==="CallExpression"&&p.parent.callee&&p.parent.callee.object&&p.parent.callee.object.name===B&&p.parent.callee.property.name==="get";p.type==="Identifier"&&(y||w||S)&&!k&&ue(p)},CallExpression(p,x,y){p.callee.type==="Identifier"&&(p.callee.parent=p),p.arguments.forEach(w=>{w.type==="Identifier"&&(w.parent=p)}),ie(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),te(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 h=v.createContextVariableReference(o,a),l=!c&&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||(ye(i.init.property,t),i.init.property._indexTransformed=!0));let f;i.init?s||c?f=i.init:o==="var"?f=v.createInitVarCall(h,i.init):f=v.createInitCall(h,l?i.init.object:i.init,l?i.init.property:void 0):f=v.createIdentifier("undefined");const g=v.createExpressionStatement(v.createAssignmentExpression(h,f));if(c){const p=i.init.object.name,[x,y]=t.getVariable(p),w=v.createContextVariableReference(y,x),S=i.init.property.value,k={type:"MemberExpression",object:v.createGetCall(w,0),property:{type:"Literal",value:S},computed:!0};g.expression.right=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("init")),[h,k])}s&&(t.pushScope("fn"),$(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){Xi(p,x)},Identifier(p,x){G(p,x)},AssignmentExpression(p,x){Qi(p,x)}}),t.popScope()),Object.assign(e,g)})}function gn(e,t,i){if(t.setSuppressHoisting(!0),e.init&&e.init.type==="VariableDeclaration"){const r=e.init.declarations[0],n=r.id.name;t.addLoopVariable(n,n),e.init={type:"VariableDeclaration",kind:e.init.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:n},init:r.init}]},r.init&&$(r.init,t,{Identifier(s,a){t.isLoopVariable(s.name)||(t.pushScope("for"),G(s,a),t.popScope())},MemberExpression(s){t.pushScope("for"),te(s,"",t),t.popScope()}})}e.test&&$(e.test,t,{Identifier(r,n){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),G(r,n),r.type==="Identifier"&&(r.computed=!0,ue(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),te(r,"",t),t.popScope()}}),e.update&&$(e.update,t,{Identifier(r,n){t.isLoopVariable(r.name)||(t.pushScope("for"),G(r,n),t.popScope())}}),t.setSuppressHoisting(!1),t.pushScope("for"),i(e.body,t),t.popScope()}function xn(e,t){$(e,t,{MemberExpression(i){te(i,"",t)},CallExpression(i,r){ie(i,r)},Identifier(i,r){G(i,r);const n=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&n&&ue(i)}})}function yn(e,t,i){e.test&&(t.pushScope("if"),xn(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 wn(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[n,s]=t.getVariable(r.name);return v.createContextVariableAccess0(s,n)}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)||te(r,"",t),r);return r}),e.argument={type:"ArrayExpression",elements:[e.argument]}):e.argument.type==="BinaryExpression"?$(e.argument,t,{Identifier(r,n){G(r,n),r.type==="Identifier"&&ue(r)},MemberExpression(r){te(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[n,s]=t.getVariable(r.value.name);return{type:"Property",key:v.createIdentifier(r.key.name),value:v.createContextVariableReference(s,n),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[n,s]=t.getVariable(r.value.name);r.value=v.createContextVariableReference(s,n)}return r}):e.argument.type==="Identifier"&&(G(e.argument,t),e.argument.type==="Identifier"&&ue(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||(ye(e.argument,t),e.argument._indexTransformed=!0)):(e.argument.type==="BinaryExpression"||e.argument.type==="LogicalExpression"||e.argument.type==="ConditionalExpression"||e.argument.type==="CallExpression")&&$(e.argument,t,{Identifier(n,s){G(n,s),n.type==="Identifier"&&!n._arrayAccessed&&(ue(n),n._arrayAccessed=!0)},MemberExpression(n){te(n,"",t)},CallExpression(n,s){ie(n,s)}});const r=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("precision")),[e.argument]);e.argument=r}}function bn(e,t,i){e.body&&e.body.type==="BlockStatement"&&(t.pushScope("fn"),i(e.body,t),t.popScope())}function vn(e){const t={...b,LineComment:()=>{}};Dt(e,{BinaryExpression(i){if(i.operator==="=="||i.operator==="==="){const r=i.left,n=i.right,s=v.createMathEqCall(r,n);s._transformed=!0,Object.assign(i,s)}}},t)}function _n(e,t,i,r={debug:!1,ln:!1},n=[]){const s=a=>{if(!r.debug||!a.loc||!n.length)return null;const o=a.loc.start.line-1;if(o>=0&&o<n.length){const c=n[o].trim();if(c)return{type:"LineComment",value:`${r.ln?` [Line ${a.loc.start.line}]`:""} ${c}`}}return null};$(e,t,{Program(a,o,c){const h=[];a.body.forEach(l=>{o.enterHoistingScope(),c(l,o);const f=o.exitHoistingScope(),g=s(l);g&&h.push(g),h.push(...f),h.push(l)}),a.body=h},BlockStatement(a,o,c){const h=[];a.body.forEach(l=>{o.enterHoistingScope(),c(l,o);const f=o.exitHoistingScope(),g=s(l);g&&h.push(g),h.push(...f),h.push(l)}),a.body=h},ReturnStatement(a,o){wn(a,o)},VariableDeclaration(a,o){Xi(a,o)},Identifier(a,o){G(a,o)},CallExpression(a,o){ie(a,o)},MemberExpression(a,o){te(a,i,o)},AssignmentExpression(a,o){Qi(a,o)},FunctionDeclaration(a,o,c){bn(a,o,c)},ForStatement(a,o,c){gn(a,o,c)},IfStatement(a,o,c){yn(a,o,c)},AwaitExpression(a,o,c){a.argument&&(a.argument._insideAwait=!0,c(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"},Sn=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends"]),En=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class Nn{constructor(t,i,r,n,s=0){this.type=t,this.value=i,this.line=r,this.column=n,this.indent=s}toString(){return`Token(${this.type}, ${JSON.stringify(this.value)}, ${this.line}:${this.column}, indent=${this.indent})`}}class Cn{source;pos;line;column;tokens;indentStack;atLineStart;parenDepth;bracketDepth;braceDepth;constructor(t){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 xn(e){$(e,null,{VariableDeclaration(t,i,r){t.declarations&&t.declarations.length>0&&t.declarations.forEach(n=>{if(n.init&&n.init.type==="ArrowFunctionExpression"&&n.init.start!==0){const s={type:"FunctionDeclaration",id:n.id,params:n.init.params,body:n.init.body.type==="BlockStatement"?n.init.body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:n.init.body}]},async:n.init.async,generator:!1};Object.assign(t,s)}}),t.body&&t.body.body&&t.body.body.forEach(n=>r(n,i))}})}function yn(e,t){Vt(e,{VariableDeclaration(i){i.declarations.forEach(r=>{const n=r.init&&r.init.type==="MemberExpression"&&r.init.object&&(r.init.object.name==="context"||r.init.object.name===B||r.init.object.name==="context2"),s=r.init&&r.init.type==="MemberExpression"&&r.init.object?.object&&(r.init.object.object.name==="context"||r.init.object.object.name===B||r.init.object.object.name==="context2");(n||s)&&(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 wn(e,t,i=!1){e.params.forEach(r=>{r.type==="Identifier"&&t.addContextBoundVar(r.name,i)})}function bn(e,t){e.params.forEach(i=>{i.type==="Identifier"&&t.addContextBoundVar(i.name,!1)})}function vn(e,t){let i;return Vt(e,{FunctionDeclaration(r){bn(r,t)},ArrowFunctionExpression(r){const n=r.start===0;n&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=B),wn(r,t,n)},VariableDeclaration(r){r.declarations.forEach(n=>{if(n.id.type==="ArrayPattern"){const s=t.generateTempVar(),a={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:s},init:n.init}]};n.id.elements?.forEach(c=>{c.type==="Identifier"&&t.addArrayPatternElement(c.name)});const o=n.id.elements.map((c,h)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:c,init:{type:"MemberExpression",object:{type:"Identifier",name:s},property:{type:"Literal",value:h},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[a,...o]})}})},ForStatement(r){}}),i}const _t={type:"Identifier",name:"undefined"};function ye(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),n=v.createContextVariableReference(r,i),s=v.createGetCall(n,e.property);Object.assign(e,s),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||(ye(i,t),i._indexTransformed=!0)}}}function ue(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 G(e,t){if(e.name!==B){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===B&&["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"&&Ge.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),n=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 s=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||n||i||o||s){if(s||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 c=t.isContextBound(e.name)&&!t.isRootParam(e.name);if(c&&!(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[h,l]=t.getVariable(e.name);let f;if(c)f=v.createIdentifier(e.name);else{if(h===e.name&&!t.isContextBound(e.name))return;f=v.createContextVariableReference(l,h)}if(a)Object.assign(e,f);else{const g=v.createGetCall(f,0);Object.assign(e,g)}}}function te(e,t,i){if(e.object&&e.object.type==="Identifier"&&e.object.name==="Math")return;if(e.object&&e.object.type==="Identifier"&&Ge.includes(e.object.name)&&i.isContextBound(e.object.name)&&!e.computed){const c=e.parent&&e.parent.type==="CallExpression"&&e.parent.callee===e,h=e.parent&&(e.parent.type==="VariableDeclarator"||e.parent.type==="Property"||e.parent.type==="AssignmentExpression");if(!c&&!h){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",n=i.getCurrentScopeType()=="els",s=i.getCurrentScopeType()=="for";if(!r&&!n&&!s&&e.object&&e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)&&!e.computed)return;e._indexTransformed||(ye(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===B,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 c=v.createGetCall(e.object,e.property);e.start&&(c.start=e.start),e.end&&(c.end=e.end),Object.assign(e,c),delete e.object,delete e.property,delete e.computed}}function We(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[n,s]=t.getVariable(e.name);return v.createContextVariableReference(s,n)}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 xe(e,t,i=""){switch(e.type){case"BinaryExpression":return St(e,t,i);case"MemberExpression":return{type:"MemberExpression",object:e.object.type==="Identifier"?We(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=We(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 Et(e,t,i);case"ConditionalExpression":{const r=xe(e.test,t,i),n=xe(e.consequent,t,i),s=xe(e.alternate,t,i);return{type:"ConditionalExpression",test:r,consequent:n,alternate:s,start:e.start,end:e.end}}}return e}function St(e,t,i){const r=xe(e.left,t,i),n=xe(e.right,t,i),s={type:"BinaryExpression",operator:e.operator,left:r,right:n,start:e.start,end:e.end};return $(s,t,{CallExpression(a,o){a._transformed||ie(a,o)},MemberExpression(a){te(a,"",t)}}),s}function Qt(e,t,i){const r=xe(e.left,t,i),n=xe(e.right,t,i),s={type:"LogicalExpression",operator:e.operator,left:r,right:n,start:e.start,end:e.end};return $(s,t,{CallExpression(a,o){a._transformed||ie(a,o)}}),s}function Xt(e,t,i){$(e,{parent:e,inNamespaceCall:!1},{Identifier(a,o,c){if(a.name=="NaN")return;if(a.name=="na"){a.name="NaN";return}a.parent=o.parent,G(a,t);const h=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||h)&&(a.type==="MemberExpression"?ye(a,t):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===B&&a.parent.callee.property.name==="get"||ue(a)))},MemberExpression(a,o,c){ye(a,t),a.object&&c(a.object,{parent:a,inNamespaceCall:o.inNamespaceCall})},ConditionalExpression(a,o,c){const h={...o,parent:a};a.test&&c(a.test,h),a.consequent&&c(a.consequent,h),a.alternate&&c(a.alternate,h)},BinaryExpression(a,o,c){const h={...o,parent:a};c(a.left,h),c(a.right,h)},LogicalExpression(a,o,c){const h={...o,parent:a};c(a.left,h),c(a.right,h)},UnaryExpression(a,o,c){const h={...o,parent:a};c(a.argument,h)},CallExpression(a,o,c){const h=a.callee&&a.callee.type==="MemberExpression"&&a.callee.object&&a.callee.object.type==="Identifier"&&t.isContextBound(a.callee.object.name);ie(a,t),a.arguments.forEach(l=>c(l,{parent:a,inNamespaceCall:h||o.inNamespaceCall}))}});const r=v.createMemberExpression(v.createIdentifier(i),v.createIdentifier("param")),n=t.generateParamId(),s={type:"CallExpression",callee:r,arguments:[e,_t,{type:"Identifier",name:`'${n}'`}],_transformed:!0,_isParamCall:!0};if(!t.shouldSuppressHoisting()){const a=n;t.addLocalSeriesVar(a);const o=v.createVariableDeclaration(a,s);return t.addHoistedStatement(o),v.createIdentifier(a)}return s}function Et(e,t,i){const r=xe(e.argument,t,i);return{type:"UnaryExpression",operator:e.operator,prefix:e.prefix,argument:r,start:e.start,end:e.end}}function Nt(e,t,i){switch(e?.type){case"BinaryExpression":e=St(e,i,t);break;case"LogicalExpression":e=Qt(e,i,t);break;case"ConditionalExpression":return Xt(e,i,t);case"UnaryExpression":e=Et(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[c,h]=i.getVariable(o.name);return v.createContextVariableAccess0(h,c)}return o});break}if(e.type==="MemberExpression"&&e.computed&&e.property){e.object.type==="CallExpression"?ie(e.object,i):e.object.type==="MemberExpression"?te(e.object,"",i):e.object.type==="BinaryExpression"?e.object=St(e.object,i,t):e.object.type==="LogicalExpression"?e.object=Qt(e.object,i,t):e.object.type==="ConditionalExpression"?e.object=Xt(e.object,i,t):e.object.type==="UnaryExpression"&&(e.object=Et(e.object,i,t));const o=e.object.type==="Identifier"&&i.isContextBound(e.object.name)&&!i.isRootParam(e.object.name)?e.object:We(e.object,i),c=e.property.type==="Identifier"&&!i.isContextBound(e.property.name)&&!i.isLoopVariable(e.property.name)?We(e.property,i):e.property,h=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),l=i.generateParamId(),f={type:"CallExpression",callee:h,arguments:[o,c,{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[c,h]=i.getVariable(o.value.name);return{type:"Property",key:{type:"Identifier",name:o.key.name},value:v.createContextVariableReference(h,c),kind:"init",method:!1,shorthand:!1,computed:!1}}else o.value.type!=="Literal"&&(o.value=Nt(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")),c=i.generateParamId(),h={type:"CallExpression",callee:o,arguments:[e,_t,{type:"Identifier",name:`'${c}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const l=c;i.addLocalSeriesVar(l);const f=v.createVariableDeclaration(l,h);return i.addHoistedStatement(f),v.createIdentifier(l)}return h}}e?.type==="CallExpression"&&ie(e,i);const r=v.createMemberExpression(v.createIdentifier(t),v.createIdentifier("param")),n=e.type==="Identifier"?We(e,i):e,s=i.generateParamId(),a={type:"CallExpression",callee:r,arguments:[n,_t,{type:"Identifier",name:`'${s}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const o=s;i.addLocalSeriesVar(o);const c=v.createVariableDeclaration(o,a);return i.addHoistedStatement(c),v.createIdentifier(o)}return a}function ie(e,t,i){if(e._transformed)return;e.callee&&e.callee.type==="Identifier"&&(Ge.includes(e.callee.name)||hn.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===B&&["get","init","param"].includes(e.callee.property.name))return;const n=e.callee.object.name,s=[];e.arguments.forEach(l=>{if(l._isParamCall){s.push(l);return}s.push(Nt(l,n,t))}),e.arguments=s,n==="ta"&&e.arguments.push(t.getNextTACallId());const a=e.callee.property.name,o=`${n}.${a}`,c=un.includes(o),h=e._insideAwait===!0;if(c&&!h){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(n=>n._isParamCall?n:Nt(n,B,t)),e._transformed=!0);!r&&e.callee&&e.callee.type==="MemberExpression"&&e.callee.object.type==="Identifier"&&G(e.callee.object,t),e.arguments.forEach(n=>{$(n,{parent:e},{Identifier(s,a,o){s.parent=a.parent,G(s,t);const c=s.parent&&s.parent.type==="BinaryExpression";(s.parent&&s.parent.type==="ConditionalExpression"||c)&&(s.type==="MemberExpression"?ye(s,t):s.type==="Identifier"&&(s.parent&&s.parent.type==="CallExpression"&&s.parent.callee&&s.parent.callee.object&&s.parent.callee.object.name===B&&s.parent.callee.property.name==="get"||ue(s)))},BinaryExpression(s,a,o){const c={...a,parent:s};o(s.left,c),o(s.right,c)},LogicalExpression(s,a,o){const c={...a,parent:s};o(s.left,c),o(s.right,c)},UnaryExpression(s,a,o){const c={...a,parent:s};o(s.argument,c)},CallExpression(s,a,o){s._transformed||ie(s,t)},MemberExpression(s,a,o){te(s,"",t),s.object&&o(s.object,{parent:s})}})})}function Xi(e,t){let i=null;if(e.left.type==="Identifier"){const[r,n]=t.getVariable(e.left.name);i=v.createContextVariableReference(n,r)}else if(e.left.type==="MemberExpression"&&e.left.computed&&e.left.object.type==="Identifier"){const r=e.left.object.name,[n,s]=t.getVariable(r),a=n!==r,o=t.isContextBound(r);(a||o)&&!t.isLoopVariable(r)&&e.left.property.type==="Literal"&&e.left.property.value===0&&(i=v.createContextVariableReference(s,n))}if($(e.right,{parent:e.right,inNamespaceCall:!1},{Identifier(r,n,s){r.name=="na"&&(r.name="NaN"),r.parent=n.parent,G(r,t);const a=r.parent&&r.parent.type==="BinaryExpression",o=r.parent&&r.parent.type==="ConditionalExpression",c=t.isContextBound(r.name)&&!t.isRootParam(r.name),h=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===B&&r.parent.callee.property.name==="get";(c||o||a)&&(r.type==="MemberExpression"?ye(r,t):r.type==="Identifier"&&!f&&!h&&!l&&!g&&!p&&ue(r))},MemberExpression(r,n,s){te(r,"",t),r.type==="CallExpression"?r.arguments.forEach(a=>s(a,{parent:r,inNamespaceCall:n.inNamespaceCall})):r.object&&s(r.object,{parent:r,inNamespaceCall:n.inNamespaceCall})},CallExpression(r,n,s){const a=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&t.isContextBound(r.callee.object.name);ie(r,t),r.type==="CallExpression"&&r.arguments.forEach(o=>s(o,{parent:r,inNamespaceCall:a||n.inNamespaceCall}))}}),i){let r=e.right;if(e.operator!=="="){const s=e.operator.replace("=",""),a=v.createGetCall(i,0);r={type:"BinaryExpression",operator:s,left:a,right:e.right,start:e.start,end:e.end}}const n=v.createSetCall(i,r);e.start&&(n.start=e.start),e.end&&(n.end=e.end),Object.assign(e,n)}}function Zi(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===B||i.init.object.name==="context2"),n=i.init&&i.init.type==="MemberExpression"&&i.init.object?.object&&(i.init.object.object.name==="context"||i.init.object.object.name===B||i.init.object.object.name==="context2"),s=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=B;return}if(n){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=B;return}s&&i.init.params.forEach(p=>{p.type==="Identifier"&&t.addContextBoundVar(p.name)});const a=t.addVariable(i.id.name,e.kind),o=e.kind,c=t.isArrayPatternElement(i.id.name);i.init&&!s&&!c&&(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)?ie(i.init,t):$(i.init,{parent:i.init},{Identifier(p,x){p.parent=x.parent,G(p,t);const y=p.parent&&p.parent.type==="BinaryExpression",w=p.parent&&p.parent.type==="UnaryExpression",S=p.parent&&p.parent.type==="ConditionalExpression",k=p.parent&&p.parent.type==="CallExpression"&&p.parent.callee&&p.parent.callee.object&&p.parent.callee.object.name===B&&p.parent.callee.property.name==="get";p.type==="Identifier"&&(y||w||S)&&!k&&ue(p)},CallExpression(p,x,y){p.callee.type==="Identifier"&&(p.callee.parent=p),p.arguments.forEach(w=>{w.type==="Identifier"&&(w.parent=p)}),ie(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),te(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 h=v.createContextVariableReference(o,a),l=!c&&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||(ye(i.init.property,t),i.init.property._indexTransformed=!0));let f;i.init?s||c?f=i.init:o==="var"?f=v.createInitVarCall(h,i.init):f=v.createInitCall(h,l?i.init.object:i.init,l?i.init.property:void 0):f=v.createIdentifier("undefined");const g=v.createExpressionStatement(v.createAssignmentExpression(h,f));if(c){const p=i.init.object.name,[x,y]=t.getVariable(p),w=v.createContextVariableReference(y,x),S=i.init.property.value,k={type:"MemberExpression",object:v.createGetCall(w,0),property:{type:"Literal",value:S},computed:!0};g.expression.right=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("init")),[h,k])}s&&(t.pushScope("fn"),$(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){Zi(p,x)},Identifier(p,x){G(p,x)},AssignmentExpression(p,x){Xi(p,x)}}),t.popScope()),Object.assign(e,g)})}function _n(e,t,i){if(t.setSuppressHoisting(!0),e.init&&e.init.type==="VariableDeclaration"){const r=e.init.declarations[0],n=r.id.name;t.addLoopVariable(n,n),e.init={type:"VariableDeclaration",kind:e.init.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:n},init:r.init}]},r.init&&$(r.init,t,{Identifier(s,a){t.isLoopVariable(s.name)||(t.pushScope("for"),G(s,a),t.popScope())},MemberExpression(s){t.pushScope("for"),te(s,"",t),t.popScope()}})}e.test&&$(e.test,t,{Identifier(r,n){!t.isLoopVariable(r.name)&&!r.computed&&(t.pushScope("for"),G(r,n),r.type==="Identifier"&&(r.computed=!0,ue(r)),t.popScope())},MemberExpression(r){t.pushScope("for"),te(r,"",t),t.popScope()}}),e.update&&$(e.update,t,{Identifier(r,n){t.isLoopVariable(r.name)||(t.pushScope("for"),G(r,n),t.popScope())}}),t.setSuppressHoisting(!1),t.pushScope("for"),i(e.body,t),t.popScope()}function Sn(e,t){$(e,t,{MemberExpression(i){te(i,"",t)},CallExpression(i,r){ie(i,r)},Identifier(i,r){G(i,r);const n=t.getCurrentScopeType()==="if";t.isContextBound(i.name)&&!t.isRootParam(i.name)&&n&&ue(i)}})}function En(e,t,i){e.test&&(t.pushScope("if"),Sn(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 Nn(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[n,s]=t.getVariable(r.name);return v.createContextVariableAccess0(s,n)}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)||te(r,"",t),r);return r}),e.argument={type:"ArrayExpression",elements:[e.argument]}):e.argument.type==="BinaryExpression"?$(e.argument,t,{Identifier(r,n){G(r,n),r.type==="Identifier"&&ue(r)},MemberExpression(r){te(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[n,s]=t.getVariable(r.value.name);return{type:"Property",key:v.createIdentifier(r.key.name),value:v.createContextVariableReference(s,n),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[n,s]=t.getVariable(r.value.name);r.value=v.createContextVariableReference(s,n)}return r}):e.argument.type==="Identifier"&&(G(e.argument,t),e.argument.type==="Identifier"&&ue(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||(ye(e.argument,t),e.argument._indexTransformed=!0)):(e.argument.type==="BinaryExpression"||e.argument.type==="LogicalExpression"||e.argument.type==="ConditionalExpression"||e.argument.type==="CallExpression")&&$(e.argument,t,{Identifier(n,s){G(n,s),n.type==="Identifier"&&!n._arrayAccessed&&(ue(n),n._arrayAccessed=!0)},MemberExpression(n){te(n,"",t)},CallExpression(n,s){ie(n,s)}});const r=v.createCallExpression(v.createMemberExpression(v.createContextIdentifier(),v.createIdentifier("precision")),[e.argument]);e.argument=r}}function Cn(e,t,i){e.body&&e.body.type==="BlockStatement"&&(t.pushScope("fn"),i(e.body,t),t.popScope())}function kn(e){const t={...b,LineComment:()=>{}};Vt(e,{BinaryExpression(i){if(i.operator==="=="||i.operator==="==="){const r=i.left,n=i.right,s=v.createMathEqCall(r,n);s._transformed=!0,Object.assign(i,s)}}},t)}function In(e,t,i,r={debug:!1,ln:!1},n=[]){const s=a=>{if(!r.debug||!a.loc||!n.length)return null;const o=a.loc.start.line-1;if(o>=0&&o<n.length){const c=n[o].trim();if(c)return{type:"LineComment",value:`${r.ln?` [Line ${a.loc.start.line}]`:""} ${c}`}}return null};$(e,t,{Program(a,o,c){const h=[];a.body.forEach(l=>{o.enterHoistingScope(),c(l,o);const f=o.exitHoistingScope(),g=s(l);g&&h.push(g),h.push(...f),h.push(l)}),a.body=h},BlockStatement(a,o,c){const h=[];a.body.forEach(l=>{o.enterHoistingScope(),c(l,o);const f=o.exitHoistingScope(),g=s(l);g&&h.push(g),h.push(...f),h.push(l)}),a.body=h},ReturnStatement(a,o){Nn(a,o)},VariableDeclaration(a,o){Zi(a,o)},Identifier(a,o){G(a,o)},CallExpression(a,o){ie(a,o)},MemberExpression(a,o){te(a,i,o)},AssignmentExpression(a,o){Xi(a,o)},FunctionDeclaration(a,o,c){Cn(a,o,c)},ForStatement(a,o,c){_n(a,o,c)},IfStatement(a,o,c){En(a,o,c)},AwaitExpression(a,o,c){a.argument&&(a.argument._insideAwait=!0,c(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 d={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"},An=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends"]),Tn=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class Pn{constructor(t,i,r,n,s=0){this.type=t,this.value=i,this.line=r,this.column=n,this.indent=s}toString(){return`Token(${this.type}, ${JSON.stringify(this.value)}, ${this.line}:${this.column}, indent=${this.indent})`}}class Rn{source;pos;line;column;tokens;indentStack;atLineStart;parenDepth;bracketDepth;braceDepth;constructor(t){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
- `){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,`
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(d.DEDENT,"",this.getCurrentIndent());return this.addToken(d.EOF,""),this.tokens}handleNewline(){this.parenDepth===0&&this.bracketDepth===0&&this.braceDepth===0&&(this.addToken(d.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 n=this.peek();if(n===" ")i++,this.advance();else if(n===" ")t++,this.advance();else break}if(this.peek()===`
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
- `;)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 n=this.advance();switch(n){case"n":r+=`
39
- `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case t:r+=t;break;default:r+=n}}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 n=this.peek(1);if(this.isDigit(n)||!this.isIdentifierStart(n)){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();Sn.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(En.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 n=new Nn(t,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(n)}}class M{constructor(t){this.type=t}}class kn extends M{constructor(t){super("Program"),this.body=t}}class Z extends M{constructor(t){super("ExpressionStatement"),this.expression=t}}var Ee=(e=>(e.VAR="var",e.LET="let",e.CONST="const",e))(Ee||{});class be extends M{constructor(t,i="let"){super("VariableDeclaration"),this.declarations=t,this.kind=i}}class ve extends M{constructor(t,i,r=null){super("VariableDeclarator"),this.id=t,this.init=i,this.varType=r}}class Xt extends M{constructor(t,i,r,n=null){super("FunctionDeclaration"),this.id=t,this.params=i,this.body=r,this.returnType=n}}class In extends M{constructor(t,i){super("TypeDefinition"),this.name=t,this.fields=i}}class An extends M{constructor(t,i,r=null){super("IfStatement"),this.test=t,this.consequent=i,this.alternate=r}_line}class Zt extends M{constructor(t,i,r,n){super("ForStatement"),this.init=t,this.test=i,this.update=r,this.body=n}isForIn}class Tn extends M{constructor(t,i){super("WhileStatement"),this.test=t,this.body=i}}class _e extends M{constructor(t){super("BlockStatement"),this.body=t}}class Jt extends M{constructor(t){super("ReturnStatement"),this.argument=t}}class H extends M{constructor(t){super("Identifier"),this.name=t}varType;returnType;isMethod}class Ae extends M{constructor(t,i=null){super("Literal"),this.value=t,this.raw=i}}class Se extends M{constructor(t,i,r){super("BinaryExpression"),this.operator=t,this.left=i,this.right=r}}class ei extends M{constructor(t,i,r=!0){super("UnaryExpression"),this.operator=t,this.argument=i,this.prefix=r}}class mt extends M{constructor(t,i,r){super("AssignmentExpression"),this.operator=t,this.left=i,this.right=r}}class Pn extends M{constructor(t,i,r=!1){super("UpdateExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Rn extends M{constructor(t,i){super("CallExpression"),this.callee=t,this.args=i,this.callee=t,this.arguments=i}arguments}class ti extends M{constructor(t,i,r=!1){super("MemberExpression"),this.object=t,this.property=i,this.computed=r}}class Fe extends M{constructor(t,i,r){super("ConditionalExpression"),this.test=t,this.consequent=i,this.alternate=r}needsIIFE;consequentStmts;alternateStmts}class Dn extends M{constructor(t){super("ArrayExpression"),this.elements=t}}class Mn extends M{constructor(t){super("ObjectExpression"),this.properties=t}}class Vn extends M{constructor(t,i){super("Property"),this.key=t,this.value=i,this.kind="init",this.method=!1,this.shorthand=!1,this.computed=!1}kind;method;shorthand;computed}class ii extends M{constructor(t){super("ArrayPattern"),this.elements=t}}class ri extends M{constructor(t,i){super("AssignmentPattern"),this.left=t,this.right=i}}class On extends M{constructor(t,i){super("SwitchExpression"),this.discriminant=t,this.cases=i}}class Ln extends M{constructor(t,i){super("SwitchCase"),this.test=t,this.consequent=i}}class Bn{tokens;pos;constructor(t){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 kn(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 Z(new H(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 n=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(n)){this.advance(),this.skipNewlines();const s=this.parseExpression();n==="="&&r.type==="Identifier"?i=new be([new ve(r,s)],Ee.LET):i=new Z(new mt(n===":="?"=":n,r,s))}else i=new Z(r)}else i=new Z(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,n=this.expect(m.IDENTIFIER).value;let s=null;this.match(m.OPERATOR,"=")&&(this.advance(),this.skipNewlines(),s=this.parseExpression()),i.push({type:r,name:n,defaultValue:s}),this.skipNewlines()}return this.match(m.DEDENT)&&this.advance(),new In(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 n=this.parseExpression(),s=new H(r);return i&&(s.varType=i),new be([new ve(s,n,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(),n=new H(i);return n.varType=t,new be([new ve(n,r,t)],Ee.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,c=new H(o);if(a&&(c.varType=a),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const h=this.parseExpression();r.push(new ri(c,h))}else r.push(c);this.match(m.COMMA)&&this.advance()}this.expect(m.RPAREN),this.skipNewlines(),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const n=this.parseFunctionBody(),s=new H(i);return t&&(s.returnType=t),new Xt(s,r,n,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,c=new H(o);if(a&&(c.varType=a),this.match(m.OPERATOR,"=")){this.advance(),this.skipNewlines();const h=this.parseExpression();r.push(new ri(c,h))}else r.push(c);this.match(m.COMMA)&&this.advance()}this.expect(m.RPAREN),this.skipNewlines(),this.expect(m.OPERATOR,"=>"),this.skipNewlines();const n=this.parseFunctionBody(),s=new H(i);return t&&(s.returnType=t),s.isMethod=!0,new Xt(s,r,n,t)}parseFunctionBody(){const t=[];if(!this.match(m.INDENT)){const i=this.parseExpression();return new _e([new Jt(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 Jt(i.expression))}return new _e(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 Z(new H(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 n=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(n)){this.advance(),this.skipNewlines();const s=this.parseExpression();if(n==="="&&r.type==="Identifier"?i.push(new be([new ve(r,s)],Ee.LET)):i.push(new Z(new mt(n===":="?"=":n,r,s))),this.match(m.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new Z(r));else return new Z(r);break}}else if(this.match(m.COMMA)){i.push(new Z(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new Z(r));else return new Z(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 An(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 H(this.expect(m.IDENTIFIER).value)),this.match(m.COMMA)&&this.advance();this.expect(m.RBRACKET),t=new ii(r),i=!0}else{const r=this.expect(m.IDENTIFIER).value;t=new H(r)}if(this.match(m.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const n=this.parseBlock(),s=new be([new ve(t,r)],Ee.CONST),a=new Zt(s,null,null,n);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 n=this.parseExpression();let s=null;this.match(m.KEYWORD,"by")&&(this.advance(),s=this.parseExpression()),this.skipNewlines();const a=this.parseBlock(),o=new be([new ve(t,r)],Ee.LET),c=new Se("<=",t,n),h=s?new mt("+=",t,s):new Pn("++",t);return new Zt(o,c,h,a)}}parseWhileStatement(){this.expect(m.KEYWORD,"while");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new Tn(t,i)}parseBlock(){if(!this.match(m.INDENT)){const i=this.parseStatement();return new _e(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 _e(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 H(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 be([new ve(new ii(t),i)],Ee.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 Fe(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 Se("||",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 Se("&&",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 Se(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 Se(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 Se(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 Se(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 ei(t,this.parseUnary())}return this.match(m.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new ei("!",this.parseUnary())):this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match(m.OPERATOR,"<")){const i=this.pos;this.advance();let r=1,n=!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{n=!1,this.pos=i;break}if(n&&this.match(m.LPAREN)){t=this.parseCallExpression(t);continue}else{if(n)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 ti(t,new H(i),!1)}else if(this.match(m.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(m.RBRACKET),t=new ti(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 n=this.advance().value;this.advance(),this.skipNewlines();const s=this.parseExpression();r.push(new Vn(new H(n),s))}else i.push(this.parseExpression());this.match(m.COMMA)&&this.advance(),this.skipNewlines()}return this.expect(m.RPAREN),r.length>0&&i.push(new Mn(r)),new Rn(t,i)}parsePrimary(){const t=this.peek();if(this.match(m.NUMBER)){const i=this.advance();return new Ae(i.value)}if(this.match(m.STRING)){const i=this.advance();return new Ae(i.value)}if(this.match(m.BOOLEAN)){const i=this.advance();return new Ae(i.value)}if(this.match(m.IDENTIFIER)){const i=this.advance();return new H(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 Dn(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 Fe(t,new _e(i),a);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=a,o}else return new Fe(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 Fe(t,new _e(i),new _e(r));return a.needsIIFE=!0,a.consequentStmts=i,a.alternateStmts=r,a}const n=this.getBlockValue(i),s=r.length>0?this.getBlockValue(r):new Ae(null);return new Fe(t,n,s)}needsIIFE(t,i){if(t.length>1||i.length>1)return!0;const r=n=>n.some(s=>s.type==="IfStatement"||s.type==="ForStatement"||s.type==="WhileStatement"||s.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 n=[];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&&n.push(a)}this.advance()}else n.push(new Z(this.parseExpression()));const s=this.getBlockValue(n);i.push(new Ln(r,s)),this.skipNewlines()}return this.advance(),new On(t,i)}getBlockValue(t){if(t.length===0)return new Ae(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 Ae(null)}}class Fn{indent;indentStr;output;sourceCode;sourceLines;lastCommentedLine;includeSourceComments;constructor(t={}){this.indent=0,this.indentStr=t.indentStr||" ",this.output=[],this.sourceCode=t.sourceCode||null,this.sourceLines=this.sourceCode?this.sourceCode.split(`
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(d.INDENT,"",t);else if(t<r){for(;this.indentStack.length>1&&this.indentStack[this.indentStack.length-1]>t;)this.indentStack.pop(),this.addToken(d.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
+ `;)t+=this.advance();this.addToken(d.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 n=this.advance();switch(n){case"n":r+=`
39
+ `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case t:r+=t;break;default:r+=n}}else r+=this.advance();if(this.peek()!==t)throw new Error(`Unterminated string at ${this.line}:${i}`);this.advance(),this.addToken(d.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(d.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 n=this.peek(1);if(this.isDigit(n)||!this.isIdentifierStart(n)){if(i=!0,t+=this.advance(),!this.isDigit(this.peek()))break}else break}else break}this.addToken(d.NUMBER,parseFloat(t))}readIdentifier(){this.column;let t="";for(;this.pos<this.source.length&&this.isIdentifierChar(this.peek());)t+=this.advance();An.has(t)?this.addToken(d.KEYWORD,t):t==="true"||t==="false"?this.addToken(d.BOOLEAN,t==="true"):this.addToken(d.IDENTIFIER,t)}readOperatorOrPunctuation(){const t=this.peek(),i=this.peek(1),r=t+i;if(Tn.includes(r))return this.advance(),this.advance(),this.addToken(d.OPERATOR,r),!0;if("+-*/%<>=!?".includes(t))return this.advance(),this.addToken(d.OPERATOR,t),!0;switch(t){case"(":return this.parenDepth++,this.advance(),this.addToken(d.LPAREN,t),!0;case")":return this.parenDepth--,this.advance(),this.addToken(d.RPAREN,t),!0;case"[":return this.bracketDepth++,this.advance(),this.addToken(d.LBRACKET,t),!0;case"]":return this.bracketDepth--,this.advance(),this.addToken(d.RBRACKET,t),!0;case"{":return this.braceDepth++,this.advance(),this.addToken(d.LBRACE,t),!0;case"}":return this.braceDepth--,this.advance(),this.addToken(d.RBRACE,t),!0;case",":return this.advance(),this.addToken(d.COMMA,t),!0;case".":return this.advance(),this.addToken(d.DOT,t),!0;case":":return this.advance(),this.addToken(d.COLON,t),!0;case";":return this.advance(),this.addToken(d.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 n=new Pn(t,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(n)}}class M{constructor(t){this.type=t}}class Dn extends M{constructor(t){super("Program"),this.body=t}}class Z extends M{constructor(t){super("ExpressionStatement"),this.expression=t}}var Ee=(e=>(e.VAR="var",e.LET="let",e.CONST="const",e))(Ee||{});class be extends M{constructor(t,i="let"){super("VariableDeclaration"),this.declarations=t,this.kind=i}}class ve extends M{constructor(t,i,r=null){super("VariableDeclarator"),this.id=t,this.init=i,this.varType=r}}class Zt extends M{constructor(t,i,r,n=null){super("FunctionDeclaration"),this.id=t,this.params=i,this.body=r,this.returnType=n}}class Mn extends M{constructor(t,i){super("TypeDefinition"),this.name=t,this.fields=i}}class Vn extends M{constructor(t,i,r=null){super("IfStatement"),this.test=t,this.consequent=i,this.alternate=r}_line}class Jt extends M{constructor(t,i,r,n){super("ForStatement"),this.init=t,this.test=i,this.update=r,this.body=n}isForIn}class On extends M{constructor(t,i){super("WhileStatement"),this.test=t,this.body=i}}class _e extends M{constructor(t){super("BlockStatement"),this.body=t}}class ei extends M{constructor(t){super("ReturnStatement"),this.argument=t}}class H extends M{constructor(t){super("Identifier"),this.name=t}varType;returnType;isMethod}class Ae extends M{constructor(t,i=null){super("Literal"),this.value=t,this.raw=i}}class Se extends M{constructor(t,i,r){super("BinaryExpression"),this.operator=t,this.left=i,this.right=r}}class ti extends M{constructor(t,i,r=!0){super("UnaryExpression"),this.operator=t,this.argument=i,this.prefix=r}}class dt extends M{constructor(t,i,r){super("AssignmentExpression"),this.operator=t,this.left=i,this.right=r}}class Ln extends M{constructor(t,i,r=!1){super("UpdateExpression"),this.operator=t,this.argument=i,this.prefix=r}}class Bn extends M{constructor(t,i){super("CallExpression"),this.callee=t,this.args=i,this.callee=t,this.arguments=i}arguments}class ii extends M{constructor(t,i,r=!1){super("MemberExpression"),this.object=t,this.property=i,this.computed=r}}class Fe extends M{constructor(t,i,r){super("ConditionalExpression"),this.test=t,this.consequent=i,this.alternate=r}needsIIFE;consequentStmts;alternateStmts}class Fn extends M{constructor(t){super("ArrayExpression"),this.elements=t}}class jn extends M{constructor(t){super("ObjectExpression"),this.properties=t}}class $n extends M{constructor(t,i){super("Property"),this.key=t,this.value=i,this.kind="init",this.method=!1,this.shorthand=!1,this.computed=!1}kind;method;shorthand;computed}class ri extends M{constructor(t){super("ArrayPattern"),this.elements=t}}class ni extends M{constructor(t,i){super("AssignmentPattern"),this.left=t,this.right=i}}class Wn extends M{constructor(t,i){super("SwitchExpression"),this.discriminant=t,this.cases=i}}class qn extends M{constructor(t,i){super("SwitchCase"),this.test=t,this.consequent=i}}class Un{tokens;pos;constructor(t){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(d.NEWLINE);)this.advance()}parse(){const t=[];for(;!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.EOF));){const i=this.parseStatement();i&&t.push(i),this.skipNewlines()}return new Dn(t)}parseStatement(){this.skipNewlines();const t=this.peek().line;if(this.match(d.COMMENT))return this.advance(),null;let i;if(this.match(d.KEYWORD,"type"))i=this.parseTypeDefinition();else if(this.match(d.KEYWORD,"var")||this.match(d.KEYWORD,"varip"))i=this.parseVarDeclaration();else if(this.match(d.KEYWORD,"method"))i=this.parseMethodDeclaration();else if(this.isFunctionDeclaration())i=this.parseFunctionDeclaration();else if(this.match(d.KEYWORD,"if"))i=this.parseIfStatement();else if(this.match(d.KEYWORD,"for"))i=this.parseForStatement();else if(this.match(d.KEYWORD,"while"))i=this.parseWhileStatement();else if(this.match(d.KEYWORD,"break")||this.match(d.KEYWORD,"continue")){const r=this.advance().value;i=new Z(new H(r))}else if(this.isTupleDestructuring())i=this.parseTupleDestructuring();else if(this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER){let r=2;for(;this.peek(r).type===d.IDENTIFIER;)r++;this.peek(r).type===d.OPERATOR&&this.peek(r).value==="="&&(i=this.parseTypedVarDeclaration())}if(!i){const r=this.parseExpression();if(this.match(d.OPERATOR)){const n=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(n)){this.advance(),this.skipNewlines();const s=this.parseExpression();n==="="&&r.type==="Identifier"?i=new be([new ve(r,s)],Ee.LET):i=new Z(new dt(n===":="?"=":n,r,s))}else i=new Z(r)}else i=new Z(r)}return i&&(i._line=t),i}isFunctionDeclaration(){const t=this.pos;try{let i=0;if(this.peek(i).type===d.IDENTIFIER&&this.peek(i+1).type===d.IDENTIFIER&&i++,this.peek(i).type!==d.IDENTIFIER||(i++,this.peek(i).type!==d.LPAREN))return!1;i++;let r=1;for(;r>0&&this.peek(i).type!==d.EOF;)this.peek(i).type===d.LPAREN&&r++,this.peek(i).type===d.RPAREN&&r--,i++;for(;this.peek(i).type===d.NEWLINE;)i++;return this.peek(i).type===d.OPERATOR&&this.peek(i).value==="=>"}finally{this.pos=t}}parseTypeDefinition(){this.expect(d.KEYWORD,"type");const t=this.expect(d.IDENTIFIER).value;this.match(d.OPERATOR,"=>")&&this.advance(),this.skipNewlines(),this.expect(d.INDENT);const i=[];for(;!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const r=this.expect(d.IDENTIFIER).value,n=this.expect(d.IDENTIFIER).value;let s=null;this.match(d.OPERATOR,"=")&&(this.advance(),this.skipNewlines(),s=this.parseExpression()),i.push({type:r,name:n,defaultValue:s}),this.skipNewlines()}return this.match(d.DEDENT)&&this.advance(),new Mn(t,i)}parseVarDeclaration(){const t=this.advance().value;let i=null,r=null;if(this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.LBRACKET&&this.peek(2).type===d.RBRACKET)i=this.advance().value,this.advance(),i+="[]",this.advance(),r=this.expect(d.IDENTIFIER).value;else if(this.peek().type===d.IDENTIFIER&&(this.peek(1).type===d.IDENTIFIER||this.peek(1).type===d.OPERATOR&&this.peek(1).value==="<")){if(i=this.advance().value,this.match(d.OPERATOR,"<")){for(this.advance(),i+="<";!this.match(d.OPERATOR,">");)if(this.match(d.IDENTIFIER))i+=this.advance().value;else if(this.match(d.COMMA))i+=this.advance().value,this.skipNewlines();else break;this.match(d.OPERATOR,">")&&(i+=">",this.advance())}r=this.expect(d.IDENTIFIER).value}else if(this.peek().type===d.IDENTIFIER)r=this.advance().value;else throw new Error(`Expected identifier after ${t} at ${this.peek().line}:${this.peek().column}`);this.expect(d.OPERATOR,"="),this.skipNewlines();const n=this.parseExpression(),s=new H(r);return i&&(s.varType=i),new be([new ve(s,n,i)],t)}parseTypedVarDeclaration(){let t=this.advance().value;for(;this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER;)t+=" "+this.advance().value;const i=this.expect(d.IDENTIFIER).value;this.expect(d.OPERATOR,"="),this.skipNewlines();const r=this.parseExpression(),n=new H(i);return n.varType=t,new be([new ve(n,r,t)],Ee.LET)}parseFunctionDeclaration(){let t=null;this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER&&(t=this.advance().value);const i=this.expect(d.IDENTIFIER).value;this.expect(d.LPAREN);const r=[];for(;!this.match(d.RPAREN)&&(this.skipNewlines(),!this.match(d.RPAREN));){let a=null;for(;this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER&&this.peek(2).type!==d.LPAREN;)a&&(a+=" "),a=(a||"")+this.advance().value;const o=this.expect(d.IDENTIFIER).value,c=new H(o);if(a&&(c.varType=a),this.match(d.OPERATOR,"=")){this.advance(),this.skipNewlines();const h=this.parseExpression();r.push(new ni(c,h))}else r.push(c);this.match(d.COMMA)&&this.advance()}this.expect(d.RPAREN),this.skipNewlines(),this.expect(d.OPERATOR,"=>"),this.skipNewlines();const n=this.parseFunctionBody(),s=new H(i);return t&&(s.returnType=t),new Zt(s,r,n,t)}parseMethodDeclaration(){this.expect(d.KEYWORD,"method");let t=null;this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER&&this.peek(2).type===d.LPAREN&&(t=this.advance().value);const i=this.expect(d.IDENTIFIER).value;this.expect(d.LPAREN);const r=[];for(;!this.match(d.RPAREN)&&(this.skipNewlines(),!this.match(d.RPAREN));){let a=null;for(;this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER&&this.peek(2).type!==d.LPAREN;)a&&(a+=" "),a=(a||"")+this.advance().value;const o=this.expect(d.IDENTIFIER).value,c=new H(o);if(a&&(c.varType=a),this.match(d.OPERATOR,"=")){this.advance(),this.skipNewlines();const h=this.parseExpression();r.push(new ni(c,h))}else r.push(c);this.match(d.COMMA)&&this.advance()}this.expect(d.RPAREN),this.skipNewlines(),this.expect(d.OPERATOR,"=>"),this.skipNewlines();const n=this.parseFunctionBody(),s=new H(i);return t&&(s.returnType=t),s.isMethod=!0,new Zt(s,r,n,t)}parseFunctionBody(){const t=[];if(!this.match(d.INDENT)){const i=this.parseExpression();return new _e([new ei(i)])}for(this.advance();!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const i=this.parseStatementOrSequence();Array.isArray(i)?t.push(...i):i&&t.push(i)}if(this.match(d.DEDENT)&&this.advance(),t.length>0){const i=t[t.length-1];i.type==="ExpressionStatement"&&(t[t.length-1]=new ei(i.expression))}return new _e(t)}parseStatementOrSequence(){this.pos;const t=this.peek().line;if(this.match(d.KEYWORD,"if")){const r=this.parseIfStatement();return r&&(r._line=t),r}if(this.match(d.KEYWORD,"for"))return this.parseForStatement();if(this.match(d.KEYWORD,"while"))return this.parseWhileStatement();if(this.match(d.KEYWORD,"break")||this.match(d.KEYWORD,"continue")){const r=this.advance().value;return new Z(new H(r))}if(this.match(d.KEYWORD,"var")||this.match(d.KEYWORD,"varip"))return this.parseVarDeclaration();if(this.isTupleDestructuring())return this.parseTupleDestructuring();if(this.peek().type===d.IDENTIFIER&&this.peek(1).type===d.IDENTIFIER){let r=2;for(;this.peek(r).type===d.IDENTIFIER;)r++;if(this.peek(r).type===d.OPERATOR&&this.peek(r).value==="=")return this.parseTypedVarDeclaration()}const i=[];for(;;){const r=this.parseExpression();if(this.match(d.OPERATOR)){const n=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(n)){this.advance(),this.skipNewlines();const s=this.parseExpression();if(n==="="&&r.type==="Identifier"?i.push(new be([new ve(r,s)],Ee.LET)):i.push(new Z(new dt(n===":="?"=":n,r,s))),this.match(d.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new Z(r));else return new Z(r);break}}else if(this.match(d.COMMA)){i.push(new Z(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new Z(r));else return new Z(r);break}}return i.length>1?i:i.length===1?i[0]:null}parseIfStatement(){this.expect(d.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();let r=null;return this.match(d.KEYWORD,"else")&&(this.advance(),this.skipNewlines(),this.match(d.KEYWORD,"if")?r=this.parseIfStatement():r=this.parseBlock()),new Vn(t,i,r)}parseForStatement(){this.expect(d.KEYWORD,"for");let t=null,i=!1;if(this.match(d.LBRACKET)){this.advance();const r=[];for(;!this.match(d.RBRACKET);)this.skipNewlines(),r.push(new H(this.expect(d.IDENTIFIER).value)),this.match(d.COMMA)&&this.advance();this.expect(d.RBRACKET),t=new ri(r),i=!0}else{const r=this.expect(d.IDENTIFIER).value;t=new H(r)}if(this.match(d.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const n=this.parseBlock(),s=new be([new ve(t,r)],Ee.CONST),a=new Jt(s,null,null,n);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(d.OPERATOR,"=");const r=this.parseExpression();this.expect(d.KEYWORD,"to");const n=this.parseExpression();let s=null;this.match(d.KEYWORD,"by")&&(this.advance(),s=this.parseExpression()),this.skipNewlines();const a=this.parseBlock(),o=new be([new ve(t,r)],Ee.LET),c=new Se("<=",t,n),h=s?new dt("+=",t,s):new Ln("++",t);return new Jt(o,c,h,a)}}parseWhileStatement(){this.expect(d.KEYWORD,"while");const t=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new On(t,i)}parseBlock(){if(!this.match(d.INDENT)){const i=this.parseStatement();return new _e(i?[i]:[])}this.advance();const t=[];for(;!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const i=this.parseStatement();i&&t.push(i)}return this.match(d.DEDENT)&&this.advance(),new _e(t)}isTupleDestructuring(){if(!this.match(d.LBRACKET))return!1;let t=1;for(;;){for(;this.peek(t).type===d.NEWLINE;)t++;if(this.peek(t).type!==d.IDENTIFIER)return!1;for(t++;this.peek(t).type===d.NEWLINE;)t++;if(this.peek(t).type===d.RBRACKET){t++;break}else if(this.peek(t).type===d.COMMA){t++;continue}else return!1}for(;this.peek(t).type===d.NEWLINE;)t++;return this.peek(t).type===d.OPERATOR&&this.peek(t).value==="="}parseTupleDestructuring(){this.expect(d.LBRACKET);const t=[];for(;!this.match(d.RBRACKET);)this.skipNewlines(),t.push(new H(this.expect(d.IDENTIFIER).value)),this.match(d.COMMA)&&this.advance();this.expect(d.RBRACKET),this.skipNewlines(),this.expect(d.OPERATOR,"="),this.skipNewlines();const i=this.parseExpression();return new be([new ve(new ri(t),i)],Ee.CONST)}parseExpression(){return this.parseTernary()}parseTernary(){let t=this.parseLogicalOr();if(this.match(d.OPERATOR,"?")){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(d.COLON),this.skipNewlines();const r=this.parseExpression();return new Fe(t,i,r)}return t}parseLogicalOr(){let t=this.parseLogicalAnd();for(;this.match(d.KEYWORD,"or")||this.match(d.OPERATOR)&&this.peek().value==="||";){this.advance(),this.skipNewlines();const i=this.parseLogicalAnd();t=new Se("||",t,i)}return t}parseLogicalAnd(){let t=this.parseEquality();for(;this.match(d.KEYWORD,"and")||this.match(d.OPERATOR)&&this.peek().value==="&&";){this.advance(),this.skipNewlines();const i=this.parseEquality();t=new Se("&&",t,i)}return t}parseEquality(){let t=this.parseComparison();for(;this.match(d.OPERATOR);){const i=this.peek().value;if(!["==","!="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseComparison();t=new Se(i,t,r)}return t}parseComparison(){let t=this.parseAdditive();for(;this.match(d.OPERATOR);){const i=this.peek().value;if(!["<",">","<=",">="].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseAdditive();t=new Se(i,t,r)}return t}parseAdditive(){let t=this.parseMultiplicative();for(;this.match(d.OPERATOR);){const i=this.peek().value;if(!["+","-"].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseMultiplicative();t=new Se(i,t,r)}return t}parseMultiplicative(){let t=this.parseUnary();for(;this.match(d.OPERATOR);){const i=this.peek().value;if(!["*","/","%"].includes(i))break;this.advance(),this.skipNewlines();const r=this.parseUnary();t=new Se(i,t,r)}return t}parseUnary(){if(this.match(d.OPERATOR)){const t=this.peek().value;if(["+","-","!"].includes(t))return this.advance(),this.skipNewlines(),new ti(t,this.parseUnary())}return this.match(d.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new ti("!",this.parseUnary())):this.parsePostfix()}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match(d.OPERATOR,"<")){const i=this.pos;this.advance();let r=1,n=!0;for(;r>0&&!this.match(d.EOF);)if(this.match(d.OPERATOR,"<"))r++,this.advance();else if(this.match(d.OPERATOR,">"))r--,this.advance();else if(this.match(d.IDENTIFIER)||this.match(d.COMMA))this.advance();else{n=!1,this.pos=i;break}if(n&&this.match(d.LPAREN)){t=this.parseCallExpression(t);continue}else{if(n)continue;break}}else if(this.match(d.LPAREN))t=this.parseCallExpression(t);else if(this.match(d.DOT)){this.advance(),this.skipNewlines();const i=this.expect(d.IDENTIFIER).value;t=new ii(t,new H(i),!1)}else if(this.match(d.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(d.RBRACKET),t=new ii(t,i,!0)}else break;return t}parseCallExpression(t){this.expect(d.LPAREN);const i=[],r=[];for(;!this.match(d.RPAREN)&&(this.skipNewlines(),!this.match(d.RPAREN));){if((this.peek().type===d.IDENTIFIER||this.peek().type===d.KEYWORD)&&this.peek(1).type===d.OPERATOR&&this.peek(1).value==="="){const n=this.advance().value;this.advance(),this.skipNewlines();const s=this.parseExpression();r.push(new $n(new H(n),s))}else i.push(this.parseExpression());this.match(d.COMMA)&&this.advance(),this.skipNewlines()}return this.expect(d.RPAREN),r.length>0&&i.push(new jn(r)),new Bn(t,i)}parsePrimary(){const t=this.peek();if(this.match(d.NUMBER)){const i=this.advance();return new Ae(i.value)}if(this.match(d.STRING)){const i=this.advance();return new Ae(i.value)}if(this.match(d.BOOLEAN)){const i=this.advance();return new Ae(i.value)}if(this.match(d.IDENTIFIER)){const i=this.advance();return new H(i.value)}if(this.match(d.LBRACKET))return this.parseArrayLiteral();if(this.match(d.LPAREN)){this.advance(),this.skipNewlines();const i=this.parseExpression();return this.skipNewlines(),this.expect(d.RPAREN),i}if(this.match(d.KEYWORD,"if"))return this.parseIfExpression();if(this.match(d.KEYWORD,"switch"))return this.parseSwitchExpression();throw new Error(`Unexpected token ${t.type} '${t.value}' at ${t.line}:${t.column}`)}parseArrayLiteral(){this.expect(d.LBRACKET);const t=[];for(;!this.match(d.RBRACKET)&&(this.skipNewlines(),!this.match(d.RBRACKET));)t.push(this.parseExpression()),this.match(d.COMMA)&&this.advance(),this.skipNewlines();return this.expect(d.RBRACKET),new Fn(t)}parseIfExpression(){this.expect(d.KEYWORD,"if");const t=this.parseExpression();this.skipNewlines(),this.expect(d.INDENT);const i=[];for(;!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const a=this.parseStatement();a&&i.push(a)}this.advance();let r=[];if(this.match(d.KEYWORD,"else"))if(this.advance(),this.skipNewlines(),this.match(d.KEYWORD,"if")){const a=this.parseIfExpression();if(this.needsIIFE(i,r)){const o=new Fe(t,new _e(i),a);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=a,o}else return new Fe(t,this.getBlockValue(i),a)}else{for(this.expect(d.INDENT);!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const a=this.parseStatement();a&&r.push(a)}this.advance()}if(this.needsIIFE(i,r)){const a=new Fe(t,new _e(i),new _e(r));return a.needsIIFE=!0,a.consequentStmts=i,a.alternateStmts=r,a}const n=this.getBlockValue(i),s=r.length>0?this.getBlockValue(r):new Ae(null);return new Fe(t,n,s)}needsIIFE(t,i){if(t.length>1||i.length>1)return!0;const r=n=>n.some(s=>s.type==="IfStatement"||s.type==="ForStatement"||s.type==="WhileStatement"||s.type==="BlockStatement");return r(t)||r(i)}parseSwitchExpression(){this.expect(d.KEYWORD,"switch");const t=this.parseExpression();this.skipNewlines(),this.expect(d.INDENT);const i=[];for(;!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){let r=null;this.match(d.OPERATOR,"=>")||(r=this.parseExpression()),this.expect(d.OPERATOR,"=>"),this.skipNewlines();const n=[];if(this.match(d.INDENT)){for(this.advance();!this.match(d.DEDENT)&&!this.match(d.EOF)&&(this.skipNewlines(),!this.match(d.DEDENT));){const a=this.parseStatement();a&&n.push(a)}this.advance()}else n.push(new Z(this.parseExpression()));const s=this.getBlockValue(n);i.push(new qn(r,s)),this.skipNewlines()}return this.advance(),new Wn(t,i)}getBlockValue(t){if(t.length===0)return new Ae(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 Ae(null)}}class Kn{indent;indentStr;output;sourceCode;sourceLines;lastCommentedLine;includeSourceComments;constructor(t={}){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,n=[];for(let s=t-1;s<r&&s<this.sourceLines.length;s++)if(s>this.lastCommentedLine){const a=this.sourceLines[s].trim();a&&!a.startsWith("//@")&&!a.startsWith("//")&&n.push(this.sourceLines[s])}if(n.length>0){for(const s of n)this.write(this.indentStr.repeat(this.indent)),this.write("/// "),this.write(s.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 Zi(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 jn(e,t={}){const i=Zi(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 Cn(e).tokenize(),n=new Bn(r).parse(),s={...t,sourceCode:e},a=new Fn(s).generate(n);return{success:!0,version:i,code:a,ast:n,tokens:r}}catch(r){return{success:!1,version:i,error:r.message,stack:r.stack}}}function $n(e){if(typeof e=="function")return e.toString();{const t=Zi(e);if(t===null)return e;if(t>=5){const i=jn(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 Wn(e,t={debug:!1,ln:!1}){typeof t=="boolean"&&(t={debug:t,ln:!0});const{debug:i}=t;let r=$n(e);r=un(r);const n=i?r.split(`
114
- `):[],s=Ki(r,{ecmaVersion:"latest",sourceType:"module",locations:i});ln(s),on(s),an(s);const a=new en;pn(s,a);const o=dn(s,a)||"";_n(s,a,o,t,n),vn(s);const c=Qr||Rt||void 0,h=Object.assign({},c,{LineComment(f,g){g.write("//"+f.value)}}),l=Hi(s,{generator:h,comments:i});return new Function("",`var _r = ${l}
115
- ; return _r;`)(this)}function qn(e){return t=>new V(t.array.map(i=>Math.abs(i)),t.type,e)}function Un(e){return t=>{let i=0,r=0;for(const n of t.array){const s=Number(n);isNaN(s)||(r++,i+=(s-i)/r)}return r===0?NaN:e.precision(i)}}function Kn(e){return(t,i)=>{const r=t.array;let n=0,s=r.length-1;for(;n<=s;){const a=Math.floor((n+s)/2),o=r[a];if(o===i)return a;o<i?n=a+1:s=a-1}return-1}}function zn(e){return(t,i)=>{const r=t.array;let n=0,s=r.length;for(;n<s;){const a=Math.floor((n+s)/2);r[a]<i?n=a+1:s=a}return n<r.length&&r[n]===i?n:n-1}}function Hn(e){return(t,i)=>{const r=t.array;let n=0,s=r.length;for(;n<s;){const a=Math.floor((n+s)/2);r[a]<=i?n=a+1:s=a}return n>0&&r[n-1]===i?n-1:n}}function Gn(e){return t=>{t.array.length=0}}function Yn(e){return(t,i)=>(t.array.push(...i.array),t)}function Qn(e){return t=>new V([...t.array],t.type,e)}function Xn(e){return(t,i,r=!0)=>{const n=t.array,s=i.array;if(n.length!==s.length)return NaN;let a=0,o=0,c=0;const h=[];for(let x=0;x<n.length;x++){const y=Number(n[x]),w=Number(s[x]);!isNaN(y)&&y!==null&&y!==void 0&&!isNaN(w)&&w!==null&&w!==void 0&&(a+=y,o+=w,c++,h.push(x))}if(c===0)return NaN;const l=a/c,f=o/c;let g=0;for(const x of h){const y=Number(n[x]),w=Number(s[x]);g+=(y-l)*(w-f)}const p=r?c:c-1;return p<=0?NaN:e.precision(g/p)}}function Zn(e){return t=>t.array.every(i=>!isNaN(i)&&i)}function Jn(e){if(e.every(t=>typeof t=="number"))return e.every(t=>(t|0)===t)?L.int:L.float;if(e.every(t=>typeof t=="string"))return L.string;if(e.every(t=>typeof t=="boolean"))return L.bool;throw new Error("Cannot infer type from values")}function oe(e){if(typeof e=="number")return(e|0)===e?L.int:L.float;if(typeof e=="string")return L.string;if(typeof e=="boolean")return L.bool;throw new Error("Cannot infer type from value")}function Ge(e,t){switch(t){case L.int:return typeof e=="number"&&(e|0)===e||isNaN(e);case L.float:return typeof e=="number"||isNaN(e);case L.string:return typeof e=="string";case L.bool:return typeof e=="boolean"}return!1}function es(e){return(t,i,r=0,n)=>{const s=t.array.length,a=n!==void 0?Math.min(n,s):s;for(let o=r;o<a;o++){if(!Ge(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 ts(e){return t=>t.array.length>0?t.array[0]:e.NA}function is(e){return(t,i)=>t.array[i]}function rs(e){return(t,i)=>t.array.includes(i)}function ns(e){return(t,i)=>t.array.indexOf(i)}function ss(e){return(t,i,r)=>{if(!Ge(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 as(e){return(t,i=",")=>t.array.join(i)}function os(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function cs(e){return(t,i)=>t.array.lastIndexOf(i)}function hs(e){return(t,i=0)=>[...t.array].sort((r,n)=>n-r)[i]??e.NA}function us(e){return t=>{if(t.array.length===0)return NaN;const i=[...t.array].sort((n,s)=>typeof n=="number"&&typeof s=="number"?n-s:0),r=Math.floor(i.length/2);return i.length%2!==0?i[r]:(i[r-1]+i[r])/2}}function ls(e){return(t,i=0)=>[...t.array].sort((r,n)=>r-n)[i]??e.NA}function ps(e){return t=>{if(t.array.length===0)return NaN;const i=new Map;let r=0;for(const s of t.array){const a=(i.get(s)||0)+1;i.set(s,a),a>r&&(r=a)}const n=[];for(const[s,a]of i)a===r&&n.push(s);return n.sort((s,a)=>typeof s=="number"&&typeof a=="number"?s-a:typeof s=="string"&&typeof a=="string"?s<a?-1:s>a?1:0:0),n[0]}}function fs(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const n=[];for(const c of r){const h=Number(c);if(isNaN(h)||h===null||h===void 0)return NaN;n.push(h)}n.sort((c,h)=>c-h),i<0&&(i=0),i>100&&(i=100);const s=i/100*n.length-.5;if(s<=0)return e.precision(n[0]);if(s>=n.length-1)return e.precision(n[n.length-1]);const a=Math.floor(s),o=s-a;return e.precision(n[a]*(1-o)+n[a+1]*o)}}function ms(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const n=[];for(const o of r){const c=Number(o);!isNaN(c)&&c!==null&&c!==void 0&&n.push(c)}if(n.length===0)return NaN;n.sort((o,c)=>o-c),i<0&&(i=0),i>100&&(i=100);const s=r.length,a=Math.ceil(i/100*s);return a<=0?n[0]:a>n.length?NaN:n[a-1]}}function ds(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 n=Number(t.array[r]);if(isNaN(n)||n===null||n===void 0)return NaN;let s=0;for(const o of t.array){const c=Number(o);!isNaN(c)&&c!==null&&c!==void 0&&c<n&&s++}const a=t.array.length-1;return a<=0?NaN:s/a*100}}function gs(e){return t=>t.array.pop()}function xs(e){return(t,i)=>{if(!Ge(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 ys(e){return t=>e.precision(e.pine.array.max(t)-e.pine.array.min(t))}function ws(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function bs(e){return t=>{t.array.reverse()}}function vs(e){return(t,i,r)=>{if(!Ge(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 _s(e){return t=>t.array.shift()}function Ss(e){return t=>t.array.length}function Es(e){return(t,i,r)=>{const n=r!==void 0?r:void 0;return new V(t.array.slice(i,n),t.type,e)}}function Ns(e){return t=>t.array.some(i=>!isNaN(i)&&i)}var Pe=(e=>(e[e.ascending=1]="ascending",e[e.descending=0]="descending",e))(Pe||{}),Ji=(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))(Ji||{}),er=(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))(er||{}),tr=(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))(tr||{});const Cs={order:Pe,currency:Ji,dayofweek:er,display:tr};function ks(e){return(t,i=Pe.ascending)=>{t.array.sort((r,n)=>{let s=isNaN(r)?1/0:r,a=isNaN(n)?1/0:n;return i===Pe.ascending?s-a:a-s})}}function Is(e){return(t,i=Pe.ascending)=>{const r=t.array.map((n,s)=>s);return r.sort((n,s)=>{const a=isNaN(t.array[n])?1/0:t.array[n],o=isNaN(t.array[s])?1/0:t.array[s];return i===Pe.ascending?a-o:o-a}),new V(r,L.int,e)}}function As(e){return t=>{const i=e.array.avg(t),r=e.array.stdev(t);return isNaN(r)?new V(t.array.map(()=>NaN),L.int,e):r===0?new V(t.array.map(()=>1),L.int,e):new V(t.array.map(n=>(n-i)/r),L.int,e)}}function Ts(e){return(t,i=!0)=>{const r=t.array,n=r.length;if(n===0)return NaN;let s=0,a=0,o=0;for(let l=0;l<n;l++){const f=Number(r[l]);!isNaN(f)&&f!==null&&f!==void 0&&(s+=f,a+=f*f,o++)}if(o===0)return NaN;const c=s/o;let h=a/o-c*c;return h<0?NaN:(!i&&o>1&&(h=h*o/(o-1)),!i&&o===1?0:e.precision(Math.sqrt(h)))}}function Ps(e){return t=>e.precision(t.array.reduce((i,r)=>{const n=Number(r);return isNaN(n)?i:i+n},0))}function Rs(e){return(t,i)=>{if(!Ge(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 Ds(e){return(t,i=!0)=>{let r=0,n=0;for(const c of t.array){const h=Number(c);!isNaN(h)&&h!==null&&h!==void 0&&(r+=h,n++)}if(n===0)return NaN;const s=r/n;let a=0;for(const c of t.array){const h=Number(c);!isNaN(h)&&h!==null&&h!==void 0&&(a+=(h-s)*(h-s))}const o=i?n:n-1;return o<=0?NaN:e.precision(a/o)}}var L=(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))(L||{});class V{constructor(t,i,r){this.array=t,this.type=i,this.context=r,this._abs=qn(this.context),this._avg=Un(this.context),this._binary_search=Kn(this.context),this._binary_search_leftmost=zn(this.context),this._binary_search_rightmost=Hn(this.context),this._clear=Gn(this.context),this._concat=Yn(this.context),this._copy=Qn(this.context),this._covariance=Xn(this.context),this._every=Zn(this.context),this._fill=es(this.context),this._first=ts(this.context),this._get=is(this.context),this._includes=rs(this.context),this._indexof=ns(this.context),this._insert=ss(this.context),this._join=as(this.context),this._last=os(this.context),this._lastindexof=cs(this.context),this._max=hs(this.context),this._median=us(this.context),this._min=ls(this.context),this._mode=ps(this.context),this._percentile_linear_interpolation=fs(this.context),this._percentile_nearest_rank=ms(this.context),this._percentrank=ds(this.context),this._pop=gs(this.context),this._push=xs(this.context),this._range=ys(this.context),this._remove=ws(this.context),this._reverse=bs(this.context),this._set=vs(this.context),this._shift=_s(this.context),this._size=Ss(this.context),this._slice=Es(this.context),this._some=Ns(this.context),this._sort=ks(this.context),this._sort_indices=Is(this.context),this._standardize=As(this.context),this._stdev=Ts(this.context),this._sum=Ps(this.context),this._unshift=Rs(this.context),this._variance=Ds(this.context)}_abs;_avg;_binary_search;_binary_search_leftmost;_binary_search_rightmost;_clear;_concat;_copy;_covariance;_every;_fill;_first;_get;_includes;_indexof;_insert;_join;_last;_lastindexof;_max;_median;_min;_mode;_percentile_linear_interpolation;_percentile_nearest_rank;_percentrank;_pop;_push;_range;_remove;_reverse;_set;_shift;_size;_slice;_some;_sort;_sort_indices;_standardize;_stdev;_sum;_unshift;_variance;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 Ms(e){return(...t)=>new V([...t],Jn(t),e)}function Vs(e){return(t,i)=>new V(Array(t).fill(e.precision(i||0)),oe(i||0),e)}function Os(e){return(t,i=!1)=>new V(Array(t).fill(i),L.bool,e)}function Ls(e){return(t,i=NaN)=>new V(Array(t).fill(e.precision(i)),L.float,e)}function Bs(e){return(t,i=0)=>new V(Array(t).fill(e.precision(i)),L.int,e)}function Fs(e){return(t,i="")=>new V(Array(t).fill(i),L.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 js(e){return(t,i=0)=>d.from(t).get(i)}class $s{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=Ms(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=Vs(t),this.new_bool=Os(t),this.new_float=Ls(t),this.new_int=Bs(t),this.new_string=Fs(t),this.param=js(),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 Ws(e){return t=>{t.map.clear()}}function qs(e){return(t,i)=>t.map.has(i)}function Us(e){return t=>{const i=new ir(e);return i.map=new Map(t.map),i}}function Ks(e){return(t,i)=>{const r=t.map.get(i);return r===void 0?NaN:r}}function zs(e){return t=>{const i=Array.from(t.map.keys()),r=oe(i[0]);return new V(i,r,e)}}function Hs(e){return(t,i,r)=>{const n=t.map.get(i);return t.map.set(i,r),n===void 0?NaN:n}}function Gs(e){return(t,i)=>{for(const[r,n]of i.map)t.map.set(r,n)}}function Ys(e){return(t,i)=>{const r=t.map.get(i);return t.map.delete(i)?r:NaN}}function Qs(e){return t=>t.map.size}function Xs(e){return t=>{const i=Array.from(t.map.values()),r=oe(i[0]);return new V(i,r,e)}}class ir{constructor(t){this.context=t,this.map=new Map,this._clear=Ws(this.context),this._contains=qs(this.context),this._copy=Us(this.context),this._get=Ks(this.context),this._keys=zs(this.context),this._put=Hs(this.context),this._put_all=Gs(this.context),this._remove=Ys(this.context),this._size=Qs(this.context),this._values=Xs(this.context)}map;_clear;_contains;_copy;_get;_keys;_put;_put_all;_remove;_size;_values;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 Zs(e){return()=>new ir(e)}function Js(e){return(t,i=0)=>d.from(t).get(i)}class ea{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=Zs(t),this.param=Js(),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 ta(e){return(t,i,r)=>{const n=t.matrix.length;let s=[];if(r&&(r instanceof V?s=r.array:Array.isArray(r)?s=r:s=[r]),n===0){for(let c=0;c<s.length;c++){let h=s[c];h instanceof d&&(h=h.get(0)),t.matrix.push([h])}return}const a=t.matrix[0].length,o=i!==void 0?i:a;for(let c=0;c<n;c++){let h=c<s.length?s[c]:NaN;h instanceof d&&(h=h.get(0)),t.matrix[c].splice(o,0,h)}}}function ia(e){return(t,i,r)=>{const n=t.matrix.length;let s=[];if(r)if(r instanceof V)s=r.array;else if(Array.isArray(r))s=r;else if(r instanceof d){const h=r.get(0);Array.isArray(h)?s=h:s=[h]}else s=[r];const a=n>0?t.matrix[0].length:s.length,o=i!==void 0?i:n,c=[];for(let h=0;h<a;h++)if(h<s.length){let l=s[h];l instanceof d&&(l=l.get(0)),c.push(l)}else c.push(NaN);t.matrix.splice(o,0,c)}}function ra(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 n=0,s=0;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const c=t.matrix[a][o];isNaN(c)||(n+=c,s++)}return s===0?NaN:n/s}}function na(e){return(t,i)=>{const r=t.matrix.length,n=[];for(let a=0;a<r;a++)n.push(t.matrix[a][i]);const s=oe(n[0]);return new V(n,s,e)}}function sa(e){return t=>t.matrix.length===0?0:t.matrix[0].length}function aa(e){return(t,i)=>{const r=t.matrix.length,n=i.matrix.length;if(r===0){for(let o=0;o<n;o++)t.matrix.push([...i.matrix[o]]);return}const s=t.matrix[0].length,a=n>0?i.matrix[0].length:0;if(s!==a&&n>0){console.error(`matrix.concat: Column count mismatch ${s} vs ${a}`);return}for(let o=0;o<n;o++)t.matrix.push([...i.matrix[o]])}}function oa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0,n=new D(i,r,NaN,e);return n.matrix=t.matrix.map(s=>[...s]),n}}function ca(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(n=>[...n]);let r=1;for(let n=0;n<t;n++){let s=n;for(;s<t&&i[s][n]===0;)s++;if(s===t)return 0;s!==n&&([i[n],i[s]]=[i[s],i[n]],r*=-1),r*=i[n][n];for(let a=n+1;a<t;a++){const o=i[a][n]/i[n][n];for(let c=n;c<t;c++)i[a][c]-=o*i[n][c]}}return r}function ha(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i!==r?NaN:ca(t.matrix)}}function ua(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new D(0,0,NaN,e);const n=t.matrix[0].length,s=new D(r,n,NaN,e);if(i instanceof D)for(let a=0;a<r;a++)for(let o=0;o<n;o++){const c=t.matrix[a][o],h=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;s.matrix[a][o]=c-h}else{const a=i;for(let o=0;o<r;o++)for(let c=0;c<n;c++)s.matrix[o][c]=t.matrix[o][c]-a}return s}}function la(e){const t=e.length;if(t!==2)return Array(t).fill(NaN);const i=e[0][0],r=e[0][1],n=e[1][0],s=e[1][1],a=i+s,o=i*s-r*n,c=a*a-4*o;if(c<0)return[NaN,NaN];const h=(a+Math.sqrt(c))/2,l=(a-Math.sqrt(c))/2;return[h,l]}function pa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r){const a=oe(t.matrix[0][0]);return new V([],a,e)}const n=la(t.matrix),s=oe(n[0]);return new V(n,s,e)}}function fa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new D(0,0,NaN,e);const n=new D(i,r,0,e);for(let s=0;s<i;s++)n.matrix[s][s]=1;return n}}function ma(e){return t=>{const i=t.matrix.length;return i===0?0:i*t.matrix[0].length}}function da(e){return(t,i,r,n,s,a)=>{const o=t.matrix.length;if(o===0)return;const c=t.matrix[0].length,h=r!==void 0?r:0,l=n!==void 0?n:o,f=s!==void 0?s:0,g=a!==void 0?a:c;for(let p=h;p<l&&!(p>=o);p++)for(let x=f;x<g&&!(x>=c);x++)t.matrix[p][x]=i}}function ga(e){return(t,i,r)=>{if(!t.matrix[i])return NaN;const n=t.matrix[i][r];return n===void 0?NaN:n}}function xa(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 ya(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new D(i,r,NaN,e);const n=xa(t.matrix),s=new D(i,r,NaN,e);return s.matrix=n,s}}function wa(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 n=0;n<i;n++)for(let s=0;s<r;s++)if(n+s!==i-1&&t.matrix[n][s]!==0)return!1;return!0}}function ba(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 n=0;n<i;n++)for(let s=0;s<r;s++)if(t.matrix[s][n]!==-t.matrix[n][s])return!1;return!0}}function va(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let n=0;n<i;n++)for(let s=0;s<r;s++){const a=t.matrix[n][s];if(a!==0&&a!==1)return!1}return!0}}function _a(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 n=0;n<i;n++)for(let s=0;s<r;s++)if(n!==s&&t.matrix[n][s]!==0)return!1;return!0}}function Sa(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 n=0;n<i;n++)for(let s=0;s<r;s++)if(n===s){if(t.matrix[n][s]!==1)return!1}else if(t.matrix[n][s]!==0)return!1;return!0}}function Ea(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;return i===r}}function Na(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let n=0;n<i;n++){let s=0;for(let a=0;a<r;a++){const o=t.matrix[n][a];if(o<0)return!1;s+=o}if(Math.abs(s-1)>1e-10)return!1}return!0}}function Ca(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 n=0;n<i;n++)for(let s=0;s<n;s++)if(t.matrix[n][s]!==t.matrix[s][n])return!1;return!0}}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;let n=!0,s=!0;for(let a=0;a<i;a++)for(let o=0;o<r;o++)a>o&&t.matrix[a][o]!==0&&(n=!1),a<o&&t.matrix[a][o]!==0&&(s=!1);return n||s}}function Ia(e){return t=>{const i=t.matrix.length;if(i===0)return!0;const r=t.matrix[0].length;for(let n=0;n<i;n++)for(let s=0;s<r;s++)if(t.matrix[n][s]!==0)return!1;return!0}}function Aa(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0,s=i.matrix.length,a=s>0?i.matrix[0].length:0,o=r*s,c=n*a,h=new D(o,c,NaN,e);for(let l=0;l<r;l++)for(let f=0;f<n;f++){const g=t.matrix[l][f];for(let p=0;p<s;p++)for(let x=0;x<a;x++){const y=i.matrix[p][x];h.matrix[l*s+p][f*a+x]=g*y}}return h}}function Ta(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let n=-1/0,s=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const c=t.matrix[a][o];isNaN(c)||(c>n&&(n=c),s=!0)}return s?n:NaN}}function Pa(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,n=[];for(let a=0;a<i;a++)for(let o=0;o<r;o++){const c=t.matrix[a][o];isNaN(c)||n.push(c)}if(n.length===0)return NaN;n.sort((a,o)=>a-o);const s=Math.floor(n.length/2);return n.length%2!==0?n[s]:(n[s-1]+n[s])/2}}function Ra(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let n=1/0,s=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const c=t.matrix[a][o];isNaN(c)||(c<n&&(n=c),s=!0)}return s?n:NaN}}function Da(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,n=new Map;let s=0,a=NaN;for(let o=0;o<i;o++)for(let c=0;c<r;c++){const h=t.matrix[o][c];if(!isNaN(h)){const l=(n.get(h)||0)+1;n.set(h,l),l>s?(s=l,a=h):l===s&&h<a&&(a=h)}}return a}}function Ma(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(i instanceof D){const s=i.matrix.length,a=s>0?i.matrix[0].length:0;if(n!==s)return new D(0,0,NaN,e);const o=new D(r,a,0,e);for(let c=0;c<r;c++)for(let h=0;h<a;h++){let l=0;for(let f=0;f<n;f++)l+=t.matrix[c][f]*i.matrix[f][h];o.matrix[c][h]=l}return o}else if(i instanceof V||Array.isArray(i.array||i)){const s=i.array||i;if(n!==s.length)return new D(0,0,NaN,e);const a=new D(r,1,0,e);for(let o=0;o<r;o++){let c=0;for(let h=0;h<n;h++)c+=t.matrix[o][h]*s[h];a.matrix[o][0]=c}return a}else{const s=i,a=new D(r,n,NaN,e);for(let o=0;o<r;o++)for(let c=0;c<n;c++)a.matrix[o][c]=t.matrix[o][c]*s;return a}}}function Va(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i===r?new D(i,r,NaN,e):new D(r,i,NaN,e)}}function Oa(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(r!==n)return new D(0,0,NaN,e);let s=new D(r,n,0,e);for(let c=0;c<r;c++)s.matrix[c][c]=1;let a=new D(r,n,NaN,e);for(let c=0;c<r;c++)a.matrix[c]=[...t.matrix[c]];let o=Math.floor(i);if(o<0)return new D(r,n,NaN,e);for(;o>0;){if(o%2===1){const h=new D(r,n,0,e);for(let l=0;l<r;l++)for(let f=0;f<n;f++){let g=0;for(let p=0;p<r;p++)g+=s.matrix[l][p]*a.matrix[p][f];h.matrix[l][f]=g}s=h}const c=new D(r,n,0,e);for(let h=0;h<r;h++)for(let l=0;l<n;l++){let f=0;for(let g=0;g<r;g++)f+=a.matrix[h][g]*a.matrix[g][l];c.matrix[h][l]=f}a=c,o=Math.floor(o/2)}return s}}function La(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,n=t.matrix.map(a=>[...a]);let s=0;for(let a=0;a<r&&s<i;a++){let o=s;for(;o<i&&Math.abs(n[o][a])<1e-10;)o++;if(o<i){[n[s],n[o]]=[n[o],n[s]];const c=n[s][a];for(let h=a;h<r;h++)n[s][h]/=c;for(let h=0;h<i;h++)if(h!==s){const l=n[h][a];for(let f=a;f<r;f++)n[h][f]-=l*n[s][f]}s++}}return s}}function Ba(e){return(t,i)=>{const r=t.matrix.length;if(r===0){const a=oe(t.matrix[0][0]);return new V([],a,e)}const n=[];for(let a=0;a<r;a++){const o=t.matrix[a].splice(i,1);n.push(o[0])}const s=oe(n[0]);return new V(n,s,e)}}function Fa(e){return(t,i)=>{const r=t.matrix.splice(i,1),n=oe(r[0][0]);return new V(r[0]||[],n,e)}}function ja(e){return(t,i,r)=>{const n=t.matrix.length,s=n>0?t.matrix[0].length:0,a=i*r,o=[];for(let l=0;l<n;l++)for(let f=0;f<s;f++)o.push(t.matrix[l][f]);for(;o.length<a;)o.push(NaN);o.length>a&&(o.length=a);const c=[];let h=0;for(let l=0;l<i;l++){const f=[];for(let g=0;g<r;g++)f.push(o[h++]);c.push(f)}t.matrix=c}}function $a(e){return t=>{t.matrix.reverse();for(const i of t.matrix)i.reverse()}}function Wa(e){return(t,i)=>{if(!t.matrix[i]){const n=oe(t.matrix[0][0]);return new V([],n,e)}const r=oe(t.matrix[i][0]);return new V([...t.matrix[i]],r,e)}}function qa(e){return t=>t.matrix.length}function Ua(e){return(t,i,r,n)=>{t.matrix[i]&&(t.matrix[i][r]=n)}}function Ka(e){return(t,i=0,r="asc")=>{t.matrix.length!==0&&t.matrix.sort((n,s)=>{const a=n[i],o=s[i];return a<o?r==="asc"?-1:1:a>o?r==="asc"?1:-1:0})}}function za(e){return(t,i,r,n,s)=>{const a=r-i,o=s-n,c=new D(a,o,NaN,e);for(let h=0;h<a;h++){const l=i+h;if(l>=t.matrix.length)break;for(let f=0;f<o;f++){const g=n+f;if(g>=t.matrix[l].length)break;c.matrix[h][f]=t.matrix[l][g]}}return c}}function Ha(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new D(0,0,NaN,e);const n=t.matrix[0].length,s=new D(r,n,NaN,e);if(i instanceof D)for(let a=0;a<r;a++)for(let o=0;o<n;o++){const c=t.matrix[a][o],h=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;s.matrix[a][o]=c+h}else{const a=i;for(let o=0;o<r;o++)for(let c=0;c<n;c++)s.matrix[o][c]=t.matrix[o][c]+a}return s}}function Ga(e){return(t,i,r)=>{const n=t.matrix.length;for(let s=0;s<n;s++){const a=t.matrix[s][i];t.matrix[s][i]=t.matrix[s][r],t.matrix[s][r]=a}}}function Ya(e){return(t,i,r)=>{const n=t.matrix[i];t.matrix[i]=t.matrix[r],t.matrix[r]=n}}function Qa(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,n=Math.min(i,r);let s=0;for(let a=0;a<n;a++)s+=t.matrix[a][a];return s}}function Xa(e){return t=>{const i=t.matrix.length;if(i===0)return new D(0,0,NaN,e);const r=t.matrix[0].length,n=new D(r,i,NaN,e);for(let s=0;s<i;s++)for(let a=0;a<r;a++)n.matrix[a][s]=t.matrix[s][a];return n}}class D{constructor(t=0,i=0,r=NaN,n){if(this.context=n,this.matrix=[],t>0&&i>0)for(let s=0;s<t;s++)this.matrix.push(Array(i).fill(r));this._add_col=ta(this.context),this._add_row=ia(this.context),this._avg=ra(this.context),this._col=na(this.context),this._columns=sa(this.context),this._concat=aa(this.context),this._copy=oa(this.context),this._det=ha(this.context),this._diff=ua(this.context),this._eigenvalues=pa(this.context),this._eigenvectors=fa(this.context),this._elements_count=ma(this.context),this._fill=da(this.context),this._get=ga(this.context),this._inv=ya(this.context),this._is_antidiagonal=wa(this.context),this._is_antisymmetric=ba(this.context),this._is_binary=va(this.context),this._is_diagonal=_a(this.context),this._is_identity=Sa(this.context),this._is_square=Ea(this.context),this._is_stochastic=Na(this.context),this._is_symmetric=Ca(this.context),this._is_triangular=ka(this.context),this._is_zero=Ia(this.context),this._kron=Aa(this.context),this._max=Ta(this.context),this._median=Pa(this.context),this._min=Ra(this.context),this._mode=Da(this.context),this._mult=Ma(this.context),this._pinv=Va(this.context),this._pow=Oa(this.context),this._rank=La(this.context),this._remove_col=Ba(this.context),this._remove_row=Fa(this.context),this._reshape=ja(this.context),this._reverse=$a(this.context),this._row=Wa(this.context),this._rows=qa(this.context),this._set=Ua(this.context),this._sort=Ka(this.context),this._submatrix=za(this.context),this._sum=Ha(this.context),this._swap_columns=Ga(this.context),this._swap_rows=Ya(this.context),this._trace=Qa(this.context),this._transpose=Xa(this.context)}matrix;_add_col;_add_row;_avg;_col;_columns;_concat;_copy;_det;_diff;_eigenvalues;_eigenvectors;_elements_count;_fill;_get;_inv;_is_antidiagonal;_is_antisymmetric;_is_binary;_is_diagonal;_is_identity;_is_square;_is_stochastic;_is_symmetric;_is_triangular;_is_zero;_kron;_max;_median;_min;_mode;_mult;_pinv;_pow;_rank;_remove_col;_remove_row;_reshape;_reverse;_row;_rows;_set;_sort;_submatrix;_sum;_swap_columns;_swap_rows;_trace;_transpose;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 Za(e){return(t,i,r)=>new D(t,i,r,e)}function Ja(e){return(t,i=0)=>d.from(t).get(i)}class eo{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=Za(t),this.param=Ja(),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)}}class to{constructor(t){this.context=t}_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 ni={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 Vt(e,t,i){Array.isArray(t)&&typeof t[0]=="string"&&(t=[t]);const r={};let n={};const s=new Array(t.length).fill(!0);for(let a=0;a<e.length;a++){const o=e[a];if(ni.remaining_options(o)){n=o;break}const c=t.map((h,l)=>s[l]?h[a]:void 0);for(let h=0;h<c.length;h++){const l=c[h];if(l===void 0){s[h]=!1;continue}const f=ni[i[l]];typeof f=="function"&&f(o)?r[l]=o:s[h]=!1}}return{...n,...r}}const io=["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"],ro={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 no(e){return Vt(e,io,ro)}class so{constructor(t){this.context=t}color={param:(t,i=0)=>d.from(t).get(i),rgb:(t,i,r,n)=>n?`rgba(${t}, ${i}, ${r}, ${n})`:`rgb(${t}, ${i}, ${r})`,new:(t,i)=>{if(t&&t.startsWith("#")){const r=t.slice(1),n=parseInt(r.slice(0,2),16),s=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16);return i?`rgba(${n}, ${s}, ${a}, ${i})`:`rgb(${n}, ${s}, ${a})`}return i?`rgba(${t}, ${i})`:t},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=no(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),n=d.from(i).get(0);return isNaN(r)?n:r}fixnan(t){const i=d.from(t);for(let r=0;r<i.length;r++){const n=i.get(r);if(!isNaN(n))return n}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 ao=[["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"]],oo={defval:"primitive",title:"string",tooltip:"string",inline:"string",group:"string",display:"string",confirm:"boolean",options:"array",minval:"number",maxval:"number",step:"number"};function Y(e){return Vt(e,ao,oo)}function co(e){return(...t)=>Y(t).defval}function ho(e){return(...t)=>Y(t).defval}function uo(e){return(...t)=>Y(t).defval}function lo(e){return(...t)=>Y(t).defval}function po(e){return(...t)=>Y(t).defval}function fo(e){return(...t)=>Y(t).defval}function mo(e){return(t,i=0)=>d.from(t).get(i)}function go(e){return(...t)=>Y(t).defval}function xo(e){return(...t)=>Y(t).defval}function yo(e){return(...t)=>Y(t).defval}function wo(e){return(...t)=>Y(t).defval}function bo(e){return(...t)=>Y(t).defval}function vo(e){return(...t)=>Y(t).defval}function _o(e){return(...t)=>Y(t).defval}function So(e){return(...t)=>Y(t).defval}const Eo={any:co,bool:ho,color:uo,enum:lo,float:po,int:fo,param:mo,price:go,session:xo,source:yo,string:wo,symbol:bo,text_area:vo,time:_o,timeframe:So};class No{constructor(t){this.context=t,Object.entries(Eo).forEach(([i,r])=>{this[i]=r(t)})}any;bool;color;enum;float;int;param;price;session;source;string;symbol;text_area;time;timeframe}function Co(e){return t=>Math.abs(d.from(t).get(0))}function ko(e){return t=>Math.acos(d.from(t).get(0))}function Io(e){return t=>Math.asin(d.from(t).get(0))}function Ao(e){return t=>Math.atan(d.from(t).get(0))}function To(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return i.reduce((r,n)=>r+n,0)/i.length}}function Po(e){return t=>Math.ceil(d.from(t).get(0))}function Ro(e){return t=>Math.cos(d.from(t).get(0))}function Do(e){return()=>Math.E}function Mo(e){return t=>Math.exp(d.from(t).get(0))}function Vo(e){return t=>Math.floor(d.from(t).get(0))}function Oo(e){return t=>Math.log(d.from(t).get(0))}function Lo(e){return t=>Math.log(d.from(t).get(0))}function Bo(e){return t=>Math.log10(d.from(t).get(0))}function Fo(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return Math.max(...i)}}function jo(e){return(...t)=>{const i=t.map(r=>d.from(r).get(0));return Math.min(...i)}}function $o(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 Wo(e){return()=>1.618033988749895}function qo(e){return()=>Math.PI}function Uo(e){return(t,i)=>Math.pow(d.from(t).get(0),d.from(i).get(0))}function Ko(e){return()=>Math.random()}function zo(e){return t=>Math.round(d.from(t).get(0))}function Ho(e){return t=>e.precision(Math.round(d.from(t).get(0)/e.pine.syminfo.mintick)*e.pine.syminfo.mintick)}function Go(e){return()=>.6180339887498948}function Yo(e){return t=>Math.sign(d.from(t).get(0))}function Qo(e){return t=>Math.sin(d.from(t).get(0))}function Xo(e){return t=>Math.sqrt(d.from(t).get(0))}function Zo(e){return(t,i)=>{const r=d.from(i).get(0),n=d.from(t);let s=0;for(let a=0;a<r;a++){const o=n.get(a);s+=o}return s}}function Jo(e){return t=>Math.tan(d.from(t).get(0))}function ec(e){return(t,i)=>{const r=d.from(t).get(0),n=d.from(i).get(0);return typeof r=="number"&&typeof n=="number"?isNaN(r)&&isNaN(n)?!0:isNaN(r)||isNaN(n)?!1:Math.abs(r-n)<1e-8:r===n}}const tc={abs:Co,acos:ko,asin:Io,atan:Ao,avg:To,ceil:Po,cos:Ro,e:Do,exp:Mo,floor:Vo,ln:Oo,log:Lo,log10:Bo,max:Fo,min:jo,param:$o,phi:Wo,pi:qo,pow:Uo,random:Ko,round:zo,round_to_mintick:Ho,rphi:Go,sign:Yo,sin:Qo,sqrt:Xo,sum:Zo,tan:Jo,__eq:ec};class ic{constructor(t){this.context=t,Object.entries(tc).forEach(([i,r])=>{this[i]=r(t)})}_cache={};abs;acos;asin;atan;avg;ceil;cos;e;exp;floor;ln;log;log10;max;min;param;phi;pi;pow;random;round;round_to_mintick;rphi;sign;sin;sqrt;sum;tan;__eq}function rc(e){return(t,i,r)=>{e.params[r]||(e.params[r]=[]);let n;if(t instanceof d)n=t.get(i||0);else if(Array.isArray(t)){const s=t.every(o=>o instanceof d),a=t.every(o=>!(o instanceof d)&&!Array.isArray(o));(s||a)&&t.length>=1?s?n=t.map(o=>o.get(0)):n=t:n=d.from(t).get(i||0)}else n=t;return e.params[r].length===0?e.params[r].push(n):e.params[r][e.params[r].length-1]=n,[n,r]}}const it=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function si(e,t,i,r,n=!1){for(let s=0;s<i.length;s++)if(i[s]<=e&&t<=r[s])return n||t>=r[s]?s:s-1;return-1}function ai(e,t,i,r,n=!1,s,a=!1){for(let o=i.length-1;o>=0;o--){if(r[o]<=t&&i[o]>=e){const c=s&&t>s;if(a&&n)for(let h=0;h<i.length;h++){if(i[h]>=e&&i[h]<t)return h;if(i[h]>=t)break}if(c&&n&&!a)for(let h=0;h<i.length;h++){if(i[h]>=e&&i[h]<t)return h;if(i[h]>=t)break}return o}if(r[o]<e)break}return-1}function nc(e){return async(t,i,r,n=!1,s=!1,a=!1,o=null,c=null)=>{const h=t[0],l=i[0],f=r[0],g=r[1],p=Array.isArray(n)?n[0]:n,x=Array.isArray(s)?s[0]:s;if(e.isSecondaryContext)return f;const y=it.indexOf(e.timeframe),w=it.indexOf(l);if(y==-1||w==-1)throw new Error("Invalid timeframe");if(y===w)return f;const S=y>w,k=d.from(e.data.openTime).get(0),C=d.from(e.data.closeTime).get(0),A=`${h}_${l}_${g}`,N=`${A}_prevIdx`;if(e.cache[A]){const Be=e.cache[A],Ye=S?ai(k,C,Be.data.openTime.data,Be.data.closeTime.data,x,e.eDate,p):si(k,C,Be.data.openTime.data,Be.data.closeTime.data,x);if(Ye==-1)return NaN;const Ce=Be.params[g][Ye];if(!S&&p){const Lt=e.cache[N];return Lt!==void 0&&Lt===Ye?NaN:(e.cache[N]=Ye,Array.isArray(Ce)?[Ce]:Ce)}return Array.isArray(Ce)?[Ce]:Ce}const q=1e3*60*60*24*30,W=e.sDate?e.sDate-q:void 0,j=e.sDate&&e.eDate?void 0:e.limit||1e3,Le=new Ot(e.source,h,l,j,W,void 0);Le.markAsSecondary();const de=await Le.run(e.pineTSCode);e.cache[A]=de;const ct=S?ai(k,C,de.data.openTime.data,de.data.closeTime.data,x,e.eDate,p):si(k,C,de.data.openTime.data,de.data.closeTime.data,x);if(ct==-1)return NaN;const ht=de.params[g][ct];return!S&&p?(e.cache[N]=ct,NaN):Array.isArray(ht)?[ht]:ht}}function sc(e){return async(t,i,r,n=!1,s=null,a=!1,o=0)=>{const c=t[0],h=i[0],l=r[0],f=r[1];Array.isArray(n)&&n[0];const g=Array.isArray(a)?a[0]:a;if(e.isSecondaryContext)return Array.isArray(l)?[l]:l;const p=it.indexOf(e.timeframe),x=it.indexOf(h);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 ${h} is not lower than or equal to chart timeframe ${e.timeframe}`)}if(x===p)return[[l]];const y=`${c}_${h}_${f}_lower`;if(!e.cache[y]){const W=e.sDate?e.sDate-2592e6:void 0,j=e.sDate&&e.eDate?void 0:e.limit||1e3,Le=new Ot(e.source,c,h,j,W,e.eDate);Le.markAsSecondary();const de=await Le.run(e.pineTSCode);e.cache[y]=de}const w=e.cache[y],S=d.from(e.data.openTime).get(0),k=d.from(e.data.closeTime).get(0),C=w.data.openTime.data,A=w.data.closeTime.data,N=w.params[f];if(!N)return[];const q=[];for(let W=0;W<C.length;W++){const j=C[W];if(!(A[W]<=S)){if(j>=k)break;j>=S&&j<k&&q.push(N[W])}}return[q]}}const ac={param:rc,security:nc,security_lower_tf:sc};class oc{constructor(t){this.context=t,Object.entries(ac).forEach(([i,r])=>{this[i]=r(t)})}_cache={};param;security;security_lower_tf}function cc(e){return t=>{e.taState||(e.taState={});const i=t||"accdist";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],n=e.get(e.data.close,0),s=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.volume,0);if(isNaN(n)||isNaN(s)||isNaN(a)||isNaN(o))return e.precision(r.cumulativeSum);const c=s-a;let h=0;return c!==0&&(h=(n-a-(s-n))/c*o),r.cumulativeSum+=h,e.precision(r.cumulativeSum)}}function hc(e){return(t,i,r,n,s)=>{const a=d.from(i).get(0),o=d.from(r).get(0),c=d.from(n).get(0);e.taState||(e.taState={});const h=s||`alma_${a}_${o}_${c}`;if(!e.taState[h]){const p=o*(a-1),x=a/c,y=[];let w=0;for(let S=0;S<a;S++){const k=Math.exp(-Math.pow(S-p,2)/(2*x*x));y.push(k),w+=k}for(let S=0;S<y.length;S++)y[S]/=w;e.taState[h]={window:[],weights:y}}const l=e.taState[h],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 uc(e){return(t,i)=>{const r=d.from(t).get(0);e.taState||(e.taState={});const n=i||`atr_${r}`;e.taState[n]||(e.taState[n]={prevAtr:null,initSum:0,initCount:0,prevClose:null});const s=e.taState[n],a=e.get(e.data.high,0),o=e.get(e.data.low,0),c=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(c))return NaN;let h;if(s.prevClose!==null){const f=a-o,g=Math.abs(a-s.prevClose),p=Math.abs(o-s.prevClose);h=Math.max(f,g,p)}else h=a-o;if(s.prevClose=c,s.initCount<r)return s.initSum+=h,s.initCount++,s.initCount===r?(s.prevAtr=s.initSum/r,e.precision(s.prevAtr)):NaN;const l=(s.prevAtr*(r-1)+h)/r;return s.prevAtr=l,e.precision(l)}}function lc(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"barssince";e.taState[r]||(e.taState[r]={lastTrueIndex:null});const n=e.taState[r];return d.from(t).get(0)?(n.lastTrueIndex=e.idx,0):n.lastTrueIndex===null?NaN:e.idx-n.lastTrueIndex}}function pc(e){return(t,i,r,n)=>{const s=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=n||`bb_${s}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const c=e.taState[o],h=d.from(t).get(0);if(isNaN(h))return[[NaN,NaN,NaN]];if(c.window.unshift(h),c.sum+=h,c.window.length<s)return[[NaN,NaN,NaN]];if(c.window.length>s){const y=c.window.pop();c.sum-=y}const l=c.sum/s;let f=0;for(let y=0;y<s;y++)f+=Math.pow(c.window[y]-l,2);const g=Math.sqrt(f/s),p=l+a*g,x=l-a*g;return[[e.precision(p),e.precision(l),e.precision(x)]]}}function fc(e){return(t,i,r,n)=>{const s=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=n||`bbw_${s}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const c=e.taState[o],h=d.from(t).get(0);if(isNaN(h))return NaN;if(c.window.unshift(h),c.sum+=h,c.window.length<s)return NaN;if(c.window.length>s){const w=c.window.pop();c.sum-=w}const l=c.sum/s;let f=0;for(let w=0;w<s;w++){const S=c.window[w]-l;f+=S*S}const g=f/s,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 mc(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`cci_${n}`;e.taState[s]||(e.taState[s]={window:[],sum:0});const a=e.taState[s],o=d.from(t).get(0);if(isNaN(o))return NaN;if(a.window.unshift(o),a.sum+=o,a.window.length<n)return NaN;if(a.window.length>n){const g=a.window.pop();a.sum-=g}const c=a.sum/n;let h=0;for(let g=0;g<n;g++)h+=Math.abs(a.window[g]-c);const l=h/n;if(l===0)return 0;const f=(o-c)/(.015*l);return e.precision(f)}}function dc(e){return(t,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`change_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<=n)return NaN;a.window.length>n+1&&a.window.pop();const c=o-a.window[n];return e.precision(c)}}function gc(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`cmo_${n}`;e.taState[s]||(e.taState[s]={gainsWindow:[],lossesWindow:[],gainsSum:0,lossesSum:0});const a=e.taState[s],o=d.from(t).get(0),c=d.from(t).get(1);if(isNaN(o)||isNaN(c))return NaN;const h=o-c,l=h>=0?h:0,f=h>=0?0:-h;if(a.gainsWindow.unshift(l),a.lossesWindow.unshift(f),a.gainsSum+=l,a.lossesSum+=f,a.gainsWindow.length<n)return NaN;if(a.gainsWindow.length>n){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 xc(e){return(t,i,r)=>{const n=d.from(i).get(0),s=d.from(t);let a=0,o=!1;for(let l=0;l<n;l++){const f=s.get(l);if(isNaN(f)){o=!0;break}a+=f}if(o)return NaN;let c=0;for(let l=0;l<n;l++){const f=s.get(l);c+=f*(l+1)}if(a===0)return NaN;const h=-c/a;return e.precision(h)}}function yc(e){return(t,i,r,n)=>{const s=d.from(r).get(0),a=d.from(t),o=d.from(i);if(e.idx<s-1)return NaN;let c=0,h=0,l=0,f=0,g=0,p=0;for(let k=0;k<s;k++){const C=a.get(k),A=o.get(k);isNaN(C)||isNaN(A)||(c+=C,h+=A,l+=C*A,f+=C*C,g+=A*A,p++)}if(p<2)return NaN;const x=p*l-c*h,y=p*f-c*c,w=p*g-h*h;if(y<=0||w<=0)return e.precision(0);const S=x/Math.sqrt(y*w);return e.precision(S)}}function wc(e){return(t,i,r)=>{const n=d.from(t),s=d.from(i),a=n.get(0),o=s.get(0),c=n.get(1),h=s.get(1);if(isNaN(a)||isNaN(o)||isNaN(c)||isNaN(h))return!1;const l=a>o&&c<=h,f=a<o&&c>=h;return l||f}}function bc(e){return(t,i)=>{const r=d.from(t),n=d.from(i),s=r.get(0),a=n.get(0),o=r.get(1),c=n.get(1);return o<c&&s>a}}function vc(e){return(t,i)=>{const r=d.from(t),n=d.from(i),s=r.get(0),a=n.get(0),o=r.get(1),c=n.get(1);return o>c&&s<a}}function _c(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"cum";e.taState[r]||(e.taState[r]={cumulativeSum:0});const n=e.taState[r],s=d.from(t).get(0);return isNaN(s)||(n.cumulativeSum+=s),e.precision(n.cumulativeSum)}}function Sc(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`dev_${n}`;e.taState[s]||(e.taState[s]={window:[],sum:0});const a=e.taState[s],o=d.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<n)return NaN;if(a.window.length>n){const f=a.window.pop();a.sum-=f}const c=a.sum/n;let h=0;for(let f=0;f<n;f++)h+=Math.abs(a.window[f]-c);const l=h/n;return e.precision(l)}}function Ec(e){return(t,i,r)=>{const n=d.from(t).get(0),s=d.from(i).get(0);e.taState||(e.taState={});const a=r||`dmi_${n}_${s}`;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],c=e.get(e.data.high,0),h=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(c)||isNaN(h)||isNaN(l))return[[NaN,NaN,NaN]];if(isNaN(o.prevHigh))return o.prevHigh=c,o.prevLow=h,o.prevClose=l,[[NaN,NaN,NaN]];const f=Math.max(c-h,Math.abs(c-o.prevClose),Math.abs(h-o.prevClose)),g=c-o.prevHigh,p=o.prevLow-h,x=g>p&&g>0?g:0,y=p>g&&p>0?p:0;o.prevHigh=c,o.prevLow=h,o.prevClose=l;let w,S,k;if(o.initCount++,o.initCount<=n)o.trInitSum+=f,o.plusInitSum+=x,o.minusInitSum+=y,o.initCount===n&&(o.prevSmoothedTR=o.trInitSum/n,o.prevSmoothedPlus=o.plusInitSum/n,o.prevSmoothedMinus=o.minusInitSum/n);else{const j=1/n;o.prevSmoothedTR=j*f+(1-j)*o.prevSmoothedTR,o.prevSmoothedPlus=j*x+(1-j)*o.prevSmoothedPlus,o.prevSmoothedMinus=j*y+(1-j)*o.prevSmoothedMinus}if(w=o.prevSmoothedTR,S=o.prevSmoothedPlus,k=o.prevSmoothedMinus,o.initCount<n)return[[NaN,NaN,NaN]];const C=w===0?0:100*S/w,A=w===0?0:100*k/w,N=C+A,q=N===0?0:100*Math.abs(C-A)/N;let W=NaN;if(o.adxInitCount++,o.adxInitCount<=s)o.dxInitSum+=q,o.adxInitCount===s&&(o.prevADX=o.dxInitSum/s,W=o.prevADX);else{const j=1/s;o.prevADX=j*q+(1-j)*o.prevADX,W=o.prevADX}return[[e.precision(C),e.precision(A),e.precision(W)]]}}function Nc(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`ema_${n}`;e.taState[s]||(e.taState[s]={prevEma:null,initSum:0,initCount:0});const a=e.taState[s],o=d.from(t).get(0);if(o==null||isNaN(o))return NaN;if(a.initCount<n)return a.initSum+=o,a.initCount++,a.initCount===n?(a.prevEma=a.initSum/n,e.precision(a.prevEma)):NaN;const c=2/(n+1),h=o*c+a.prevEma*(1-c);return a.prevEma=h,e.precision(h)}}function Cc(e){return(t,i,r)=>{const n=d.from(i).get(0),s=d.from(t);for(let a=0;a<n;a++){const o=s.get(a),c=s.get(a+1);if(isNaN(o)||isNaN(c)||o>=c)return!1}return!0}}function kc(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`highest_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<n)return NaN;a.window.length>n&&a.window.pop();const c=Math.max(...a.window.filter(h=>!isNaN(h)));return e.precision(c)}}function Ic(e){return(t,i,r)=>{const n=d.from(i).get(0),s=d.from(t);if(e.idx<n-1)return NaN;let a=-1/0,o=NaN;for(let c=0;c<n;c++){const h=s.get(c);isNaN(h)||(isNaN(o)||h>a)&&(a=h,o=-c)}return o}}function Ac(e){return(t,i,r)=>{const n=d.from(i).get(0),s=Math.floor(n/2),a=Math.floor(Math.sqrt(n)),o=e.ta.wma,c=o(t,s,r?`${r}_wma1`:void 0),h=o(t,n,r?`${r}_wma2`:void 0);if(isNaN(c)||isNaN(h))return NaN;e.taState||(e.taState={});const l=r||`hma_raw_${n}`;e.taState[l]||(e.taState[l]=[]);const f=2*c-h;e.taState[l].unshift(f);const g=r?`${r}_hma_final`:`hma_final_${n}`;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 S=0;S<a;S++){const k=a-S;x+=p.window[S]*k,y+=k}const w=x/y;return e.precision(w)}}function Tc(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.high,0),n=e.get(e.data.low,0),s=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(n)||isNaN(s))return NaN;const a=(r-n)*s;if(a===0)return e.precision(0);const o=(2*i-r-n)/a;return e.precision(o)}}function Pc(e){return(t,i,r,n,s)=>{const a=d.from(i).get(0),o=d.from(r).get(0);let c=!0;typeof n=="string"?s=n:n!==void 0&&(c=d.from(n).get(0));let h;const l=e.get(e.data.high,0),f=e.get(e.data.low,0);if(c){const A=e.get(e.data.close,1);isNaN(A)?h=NaN:h=Math.max(l-f,Math.abs(l-A),Math.abs(f-A))}else h=l-f;const g=d.from(t).get(0);e.taState||(e.taState={});const p=s||`kc_${a}_${o}_${c}`;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=(A,N,q)=>{if(isNaN(N))return NaN;if(A.initCount<q)return A.initSum+=N,A.initCount++,A.initCount===q?(A.prevEma=A.initSum/q,A.prevEma):NaN;const W=2/(q+1);return A.prevEma=N*W+A.prevEma*(1-W),A.prevEma},w=y(x.basisState,g,a),S=y(x.rangeState,h,a);if(isNaN(w)||isNaN(S))return[[NaN,NaN,NaN]];const k=w+S*o,C=w-S*o;return[[e.precision(w),e.precision(k),e.precision(C)]]}}function Rc(e){return(t,i,r,n,s)=>{const a=d.from(i).get(0),o=d.from(r).get(0);let c=!0;typeof n=="string"?s=n:n!==void 0&&(c=d.from(n).get(0)),e.taState||(e.taState={});const h=s||`kcw_${a}_${o}_${c}`;e.taState[h]||(e.taState[h]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const l=e.taState[h],f=(C,A,N)=>{if(isNaN(A))return NaN;if(C.initCount<N)return C.initSum+=A,C.initCount++,C.initCount===N?(C.prevEma=C.initSum/N,C.prevEma):NaN;const q=2/(N+1);return C.prevEma=A*q+C.prevEma*(1-q),C.prevEma};let g;const p=e.get(e.data.high,0),x=e.get(e.data.low,0);if(c){const C=e.get(e.data.close,1);isNaN(C)?g=NaN:g=Math.max(p-x,Math.abs(p-C),Math.abs(x-C))}else g=p-x;const y=d.from(t).get(0),w=f(l.basisState,y,a),S=f(l.rangeState,g,a);if(isNaN(w)||isNaN(S))return NaN;if(w===0)return e.precision(0);const k=2*S*o/w;return e.precision(k)}}function Dc(e){return(t,i,r,n)=>{const s=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=n||`linreg_${s}_${a}`;e.taState[o]||(e.taState[o]={window:[]});const c=e.taState[o],h=d.from(t).get(0);if(c.window.unshift(h),c.window.length<s)return NaN;c.window.length>s&&c.window.pop();let l=0,f=0,g=0,p=0;const x=s;for(let k=0;k<s;k++){const C=s-1-k,A=c.window[k];l+=C,f+=A,g+=C*A,p+=C*C}const y=x*p-l*l;if(y===0)return NaN;const w=(x*g-l*f)/y,S=(f-w*l)/x+w*(s-1-a);return e.precision(S)}}function Mc(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`lowest_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<n)return NaN;a.window.length>n&&a.window.pop();const c=a.window.filter(l=>!isNaN(l)&&l!==void 0),h=c.length>0?Math.min(...c):NaN;return e.precision(h)}}function Vc(e){return(t,i,r)=>{const n=d.from(i).get(0),s=d.from(t);if(e.idx<n-1)return NaN;let a=1/0,o=NaN;for(let c=0;c<n;c++){const h=s.get(c);isNaN(h)||(isNaN(o)||h<a)&&(a=h,o=-c)}return o}}function Oc(e){return(t,i,r,n,s)=>{const a=d.from(i).get(0),o=d.from(r).get(0),c=d.from(n).get(0),h=s||`macd_${a}_${o}_${c}`,l=`${h}_fast`,f=`${h}_slow`,g=`${h}_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,c,g));let S=NaN;return!isNaN(y)&&!isNaN(w)&&(S=y-w),[[e.precision(y),e.precision(w),e.precision(S)]]}}function Lc(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`median_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<n)return NaN;a.window.length>n&&a.window.pop();const c=a.window.slice().sort((f,g)=>f-g),h=Math.floor(n/2),l=n%2===0?(c[h-1]+c[h])/2:c[h];return e.precision(l)}}function Bc(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`mfi_${n}`;e.taState[s]||(e.taState[s]={upperWindow:[],lowerWindow:[],upperSum:0,lowerSum:0});const a=e.taState[s],o=d.from(t).get(0),c=d.from(t).get(1),h=e.get(e.data.volume,0);if(isNaN(o)||isNaN(h))return NaN;const l=isNaN(c)?NaN:o-c;let f=0,g=0;if(f=h*(l<=0?0:o),g=h*(l>=0?0:o),a.upperWindow.unshift(f),a.lowerWindow.unshift(g),a.upperSum+=f,a.lowerSum+=g,a.upperWindow.length<n)return NaN;if(a.upperWindow.length>n){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 Fc(e){return(t,i,r)=>{const n=d.from(i).get(0),s=d.from(t);if(e.idx<n-1)return NaN;const a=new Map;for(let h=0;h<n;h++){const l=s.get(h);isNaN(l)||a.set(l,(a.get(l)||0)+1)}if(a.size===0)return NaN;let o=NaN,c=-1;for(const[h,l]of a.entries())l>c?(c=l,o=h):l===c&&h<o&&(o=h);return o}}function jc(e){return(t,i,r)=>{const n=d.from(i).get(0);return e.ta.change(t,n)}}function $c(e){return t=>{e.taState||(e.taState={});const i=t||"nvi";e.taState[i]||(e.taState[i]={nvi:1});const r=e.taState[i],n=e.get(e.data.close,0),s=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),c=isNaN(n)?0:n,h=isNaN(s)?0:s,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(c===0||h===0)&&l<f){const g=(c-h)/h;r.nvi=r.nvi+g*r.nvi}return e.precision(r.nvi)}}function Wc(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),n=e.get(e.data.volume,0),s=e.get(e.data.close,1);if(isNaN(s))return i.prevOBV=0,e.precision(0);let a;return r>s?a=i.prevOBV+n:r<s?a=i.prevOBV-n:a=i.prevOBV,i.prevOBV=a,e.precision(a)}}function qc(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 Uc(e){return(t,i,r,n)=>{const s=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t);if(e.idx<s-1)return NaN;const c=[];for(let x=0;x<s;x++){const y=o.get(x);if(isNaN(y))return NaN;c.push(y)}c.sort((x,y)=>x-y);let h=a/100*s-.5;h<0&&(h=0),h>s-1&&(h=s-1);const l=Math.floor(h),f=Math.ceil(h);if(l===f)return e.precision(c[l]);const g=h-l,p=c[l]+g*(c[f]-c[l]);return e.precision(p)}}function Kc(e){return(t,i,r,n)=>{const s=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t);if(e.idx<s-1)return NaN;const c=[];for(let l=0;l<s;l++){const f=o.get(l);isNaN(f)||c.push(f)}if(c.length===0)return NaN;c.sort((l,f)=>l-f);let h=Math.ceil(a/100*c.length)-1;return h<0&&(h=0),h>=c.length&&(h=c.length-1),e.precision(c[h])}}function zc(e){return(t,i,r)=>{const n=d.from(i).get(0),s=d.from(t);if(e.idx<n)return NaN;const a=s.get(0);if(isNaN(a))return NaN;let o=0,c=0;for(let h=1;h<=n;h++){const l=s.get(h);isNaN(l)||(c++,l<=a&&o++)}return c===0?NaN:e.precision(o/c*100)}}function Hc(e,t,i){const r=new Array(e.length).fill(NaN);for(let n=t+i;n<e.length;n++){const s=e[n-i];let a=!0;for(let o=1;o<=t;o++)if(e[n-i-o]>=s){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[n-i+o]>=s){a=!1;break}}a&&(r[n]=s)}return r}function Gc(e){return(t,i,r,n)=>{typeof r=="string"&&(r=i,i=t,t=e.data.high);const s=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t).toArray(),c=Hc(o,s,a),h=e.idx;return e.precision(c[h])}}function Yc(e,t,i){const r=new Array(e.length).fill(NaN);for(let n=t+i;n<e.length;n++){const s=e[n-i];let a=!0;for(let o=1;o<=t;o++)if(e[n-i-o]<=s){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[n-i+o]<=s){a=!1;break}}a&&(r[n]=s)}return r}function Qc(e){return(t,i,r,n)=>{typeof r=="string"&&(r=i,i=t,t=e.data.low);const s=d.from(i).get(0),a=d.from(r).get(0),o=d.from(t).toArray(),c=Yc(o,s,a),h=e.idx;return e.precision(c[h])}}function Xc(e){return t=>{e.taState||(e.taState={});const i=t||"pvi";e.taState[i]||(e.taState[i]={pvi:1});const r=e.taState[i],n=e.get(e.data.close,0),s=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),c=isNaN(n)?0:n,h=isNaN(s)?0:s,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(c===0||h===0)&&l>f){const g=(c-h)/h;r.pvi=r.pvi+g*r.pvi}return e.precision(r.pvi)}}function Zc(e){return t=>{e.taState||(e.taState={});const i=t||"pvt";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],n=e.get(e.data.close,0),s=e.get(e.data.close,1),a=e.get(e.data.volume,0);if(!isNaN(n)&&!isNaN(s)&&!isNaN(a)&&s!==0){const o=(n-s)/s*a;r.cumulativeSum+=o}return e.precision(r.cumulativeSum)}}function Jc(e){return(t,i,r)=>{const n=e.pine.ta.highest(t,i,(r||"range")+"_h"),s=e.pine.ta.lowest(t,i,(r||"range")+"_l");return isNaN(n)||isNaN(s)?NaN:e.precision(n-s)}}function eh(e){return(t,i,r)=>{const n=d.from(i).get(0),s=d.from(t);for(let a=0;a<n;a++){const o=s.get(a),c=s.get(a+1);if(isNaN(o)||isNaN(c)||o<=c)return!1}return!0}}function th(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`rma_${n}`;e.taState[s]||(e.taState[s]={prevRma:null,initSum:0,initCount:0});const a=e.taState[s],o=d.from(t).get(0)||0;if(a.initCount<n)return a.initSum+=o,a.initCount++,a.initCount===n?(a.prevRma=a.initSum/n,e.precision(a.prevRma)):NaN;const c=1/n,h=o*c+a.prevRma*(1-c);return a.prevRma=h,e.precision(h)}}function ih(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`roc_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<=n)return NaN;a.window.length>n+1&&a.window.pop();const c=a.window[n],h=(o-c)/c*100;return e.precision(h)}}function rh(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`rsi_${n}`;e.taState[s]||(e.taState[s]={prevValue:null,avgGain:0,avgLoss:0,initGains:[],initLosses:[]});const a=e.taState[s],o=d.from(t).get(0);if(a.prevValue!==null){const c=o-a.prevValue,h=c>0?c:0,l=c<0?-c:0;if(a.initGains.length<n){if(a.initGains.push(h),a.initLosses.push(l),a.initGains.length===n){a.avgGain=a.initGains.reduce((p,x)=>p+x,0)/n,a.avgLoss=a.initLosses.reduce((p,x)=>p+x,0)/n,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*(n-1)+h)/n,a.avgLoss=(a.avgLoss*(n-1)+l)/n;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 nh(e){return(t,i,r,n)=>{const s=d.from(t).get(0),a=d.from(i).get(0),o=d.from(r).get(0);e.taState||(e.taState={});const c=n||`sar_${s}_${a}_${o}`;e.taState[c]||(e.taState[c]={result:NaN,maxMin:NaN,acceleration:NaN,isBelow:!1,barIndex:0});const h=e.taState[c],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),S=e.get(e.data.low,2);if(isNaN(l)||isNaN(f)||isNaN(g))return NaN;let k=!1;return h.barIndex===1&&(g>p?(h.isBelow=!0,h.maxMin=l,h.result=y):(h.isBelow=!1,h.maxMin=f,h.result=x),k=!0,h.acceleration=s),h.barIndex>=1&&(h.result=h.result+h.acceleration*(h.maxMin-h.result),h.isBelow?h.result>f&&(k=!0,h.isBelow=!1,h.result=Math.max(l,h.maxMin),h.maxMin=f,h.acceleration=s):h.result<l&&(k=!0,h.isBelow=!0,h.result=Math.min(f,h.maxMin),h.maxMin=l,h.acceleration=s),k||(h.isBelow?l>h.maxMin&&(h.maxMin=l,h.acceleration=Math.min(h.acceleration+a,o)):f<h.maxMin&&(h.maxMin=f,h.acceleration=Math.min(h.acceleration+a,o))),h.isBelow?(h.result=Math.min(h.result,y),h.barIndex>1&&(h.result=Math.min(h.result,S))):(h.result=Math.max(h.result,x),h.barIndex>1&&(h.result=Math.max(h.result,w)))),h.barIndex++,h.barIndex<=1?NaN:e.precision(h.result)}}function sh(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`sma_${n}`;e.taState[s]||(e.taState[s]={window:[],sum:0});const a=e.taState[s],o=d.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<n)return NaN;if(a.window.length>n){const h=a.window.pop();a.sum-=h}const c=a.sum/n;return e.precision(c)}}function ah(e){return(t,i,r=!0,n)=>{const s=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=n||`stdev_${s}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const c=e.taState[o],h=d.from(t).get(0);if(h==null||isNaN(h))return NaN;if(c.window.unshift(h),c.sum+=h,c.window.length<s)return NaN;if(c.window.length>s){const x=c.window.pop();c.sum-=x}const l=c.sum/s;let f=0;for(let x=0;x<s;x++)f+=Math.pow(c.window[x]-l,2);const g=a?s:s-1,p=Math.sqrt(f/g);return e.precision(p)}}function oh(e){return(t,i,r,n,s)=>{const a=d.from(n).get(0);e.taState||(e.taState={});const o=s||`stoch_${a}`;e.taState[o]||(e.taState[o]={highWindow:[],lowWindow:[]});const c=e.taState[o],h=d.from(t).get(0),l=d.from(i).get(0),f=d.from(r).get(0);if(isNaN(h)||isNaN(l)||isNaN(f))return NaN;if(c.highWindow.unshift(l),c.lowWindow.unshift(f),c.highWindow.length<a)return NaN;c.highWindow.length>a&&(c.highWindow.pop(),c.lowWindow.pop());let g=c.highWindow[0],p=c.lowWindow[0];for(let w=1;w<a;w++)c.highWindow[w]>g&&(g=c.highWindow[w]),c.lowWindow[w]<p&&(p=c.lowWindow[w]);const x=g-p;if(x===0)return NaN;const y=100*(h-p)/x;return e.precision(y)}}function ch(e){return(t,i,r)=>{const n=d.from(t).get(0),s=d.from(i).get(0);e.taState||(e.taState={});const a=r||`supertrend_${n}_${s}`;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],c=e.get(e.data.high,0),h=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(c)||isNaN(h)||isNaN(l))return[[NaN,NaN]];const f=(c+h)/2;let g;isNaN(o.prevClose)?g=c-h:g=Math.max(c-h,Math.abs(c-o.prevClose),Math.abs(h-o.prevClose)),o.atrCount++,o.atrCount<=s?(o.trWindow.push(g),o.trSum+=g,o.atrCount===s&&(o.atrValue=o.trSum/s)):o.atrValue=(o.atrValue*(s-1)+g)/s;const p=o.atrValue,x=o.prevClose;if(o.prevClose=l,isNaN(p))return[[NaN,NaN]];let y=f+n*p,w=f-n*p;const S=isNaN(o.prevLowerBand)?0:o.prevLowerBand,k=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||w>S||x<S||(w=S),isNaN(o.prevUpperBand)||y<k||x>k||(y=k);let C,A;const N=o.prevSuperTrend;return o.atrCount===s?C=1:N===o.prevUpperBand?C=l>y?-1:1:C=l<w?1:-1,A=C===-1?w:y,o.prevLowerBand=w,o.prevUpperBand=y,o.prevSuperTrend=A,o.prevDirection=C,[[e.precision(A),C]]}}function hh(e){return(t,i)=>{const r=[1,2,2,1],n=6;e.taState||(e.taState={});const s=i||"swma";e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],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 c=0;for(let h=0;h<4;h++)c+=r[h]*a.window[3-h];return c/=n,e.precision(c)}}function uh(e){return(t,i)=>{let r=!0;typeof t=="string"||t!==void 0&&(r=d.from(t).get(0));const n=e.get(e.data.high,0),s=e.get(e.data.low,0),a=e.get(e.data.close,1);if(isNaN(a))return r?e.precision(n-s):NaN;const o=Math.max(n-s,Math.abs(n-a),Math.abs(s-a));return e.precision(o)}}function lh(e){return(t,i,r,n)=>{const s=d.from(i).get(0),a=d.from(r).get(0);e.taState||(e.taState={});const o=n||`tsi_${s}_${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/(s+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/(s+1),ema2_abs_value:NaN,ema2_abs_count:0,ema2_abs_sum:0});const c=e.taState[o],h=d.from(t).get(0);if(isNaN(h))return NaN;const l=isNaN(c.prevSource)?NaN:h-c.prevSource;if(c.prevSource=h,isNaN(l))return NaN;const f=Math.abs(l);if(c.ema1_pc_count++,c.ema1_pc_count<=a?(c.ema1_pc_sum+=l,c.ema1_pc_count===a&&(c.ema1_pc_value=c.ema1_pc_sum/a)):c.ema1_pc_value=l*c.ema1_pc_multiplier+c.ema1_pc_value*(1-c.ema1_pc_multiplier),c.ema1_abs_count++,c.ema1_abs_count<=a?(c.ema1_abs_sum+=f,c.ema1_abs_count===a&&(c.ema1_abs_value=c.ema1_abs_sum/a)):c.ema1_abs_value=f*c.ema1_abs_multiplier+c.ema1_abs_value*(1-c.ema1_abs_multiplier),isNaN(c.ema1_pc_value)||isNaN(c.ema1_abs_value))return NaN;if(c.ema2_pc_count++,c.ema2_pc_count<=s?(c.ema2_pc_sum+=c.ema1_pc_value,c.ema2_pc_count===s&&(c.ema2_pc_value=c.ema2_pc_sum/s)):c.ema2_pc_value=c.ema1_pc_value*c.ema2_pc_multiplier+c.ema2_pc_value*(1-c.ema2_pc_multiplier),c.ema2_abs_count++,c.ema2_abs_count<=s?(c.ema2_abs_sum+=c.ema1_abs_value,c.ema2_abs_count===s&&(c.ema2_abs_value=c.ema2_abs_sum/s)):c.ema2_abs_value=c.ema1_abs_value*c.ema2_abs_multiplier+c.ema2_abs_value*(1-c.ema2_abs_multiplier),isNaN(c.ema2_pc_value)||isNaN(c.ema2_abs_value))return NaN;if(c.ema2_abs_value===0)return e.precision(0);const g=c.ema2_pc_value/c.ema2_abs_value;return e.precision(g)}}function ph(e){return(t,i,r,n)=>{e.taState||(e.taState={});const s=n||"valuewhen";e.taState[s]||(e.taState[s]={values:[]});const a=e.taState[s],o=d.from(t).get(0),c=d.from(i).get(0),h=d.from(r).get(0);if(o&&a.values.push(c),isNaN(h)||h<0)return NaN;const l=a.values.length-1-h;if(l<0)return NaN;const f=a.values[l];return typeof f=="number"?e.precision(f):f}}function fh(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`variance_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<n)return NaN;a.window.length>n&&a.window.pop();let c=0,h=0;for(let g=0;g<n;g++)c+=a.window[g],h+=a.window[g]*a.window[g];const l=c/n,f=h/n-l*l;return e.precision(f)}}function mh(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 n=e.taState[r],s=d.from(t).get(0),a=d.from(e.data.volume).get(0),o=d.from(e.data.openTime).get(0),c=new Date(o).toISOString().slice(0,10);if(n.lastSessionDate!==c&&(n.cumulativePV=0,n.cumulativeVolume=0,n.lastSessionDate=c),n.cumulativePV+=s*a,n.cumulativeVolume+=a,n.cumulativeVolume===0)return NaN;const h=n.cumulativePV/n.cumulativeVolume;return e.precision(h)}}function dh(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`vwma_${n}`;e.taState[s]||(e.taState[s]={window:[],volumeWindow:[]});const a=e.taState[s],o=d.from(t).get(0),c=e.get(e.data.volume,0);if(a.window.unshift(o),a.volumeWindow.unshift(c),a.window.length<n)return NaN;a.window.length>n&&(a.window.pop(),a.volumeWindow.pop());let h=0,l=0;for(let g=0;g<n;g++)h+=a.window[g]*a.volumeWindow[g],l+=a.volumeWindow[g];const f=h/l;return e.precision(f)}}function gh(e){return t=>{e.taState||(e.taState={});const i=t||"wad";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],n=e.get(e.data.close,0),s=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.close,1);if(isNaN(n)||isNaN(s)||isNaN(a))return e.precision(r.cumulativeSum);let c=0;if(!isNaN(o)){const h=Math.max(s,o),l=Math.min(a,o),f=n-o;f>0?c=n-l:f<0&&(c=n-h)}return r.cumulativeSum+=c,e.precision(r.cumulativeSum)}}function xh(e){return(t,i,r)=>{const n=d.from(i).get(0);e.taState||(e.taState={});const s=r||`wma_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=d.from(t).get(0);if(a.window.unshift(o),a.window.length<n)return NaN;a.window.length>n&&a.window.pop();let c=0,h=0;for(let f=0;f<n;f++){const g=n-f;c+=a.window[f]*g,h+=g}const l=c/h;return e.precision(l)}}function yh(e){return(t,i)=>{const r=d.from(t).get(0);e.taState||(e.taState={});const n=i||`wpr_${r}`;e.taState[n]||(e.taState[n]={highWindow:[],lowWindow:[]});const s=e.taState[n],a=e.get(e.data.high,0),o=e.get(e.data.low,0),c=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(c))return NaN;if(s.highWindow.unshift(a),s.lowWindow.unshift(o),s.highWindow.length<r)return NaN;s.highWindow.length>r&&(s.highWindow.pop(),s.lowWindow.pop());let h=s.highWindow[0],l=s.lowWindow[0];for(let p=1;p<r;p++)s.highWindow[p]>h&&(h=s.highWindow[p]),s.lowWindow[p]<l&&(l=s.lowWindow[p]);const f=h-l;if(f===0)return e.precision(0);const g=(h-c)/f*-100;return e.precision(g)}}function wh(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.open,0),n=e.get(e.data.high,0),s=e.get(e.data.low,0),a=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(n)||isNaN(s)||isNaN(a))return NaN;const o=n-s;if(o===0)return e.precision(0);const c=(i-r)/o*a;return e.precision(c)}}const bh={accdist:cc,alma:hc,atr:uc,barssince:lc,bb:pc,bbw:fc,cci:mc,change:dc,cmo:gc,cog:xc,correlation:yc,cross:wc,crossover:bc,crossunder:vc,cum:_c,dev:Sc,dmi:Ec,ema:Nc,falling:Cc,highest:kc,highestbars:Ic,hma:Ac,iii:Tc,kc:Pc,kcw:Rc,linreg:Dc,lowest:Mc,lowestbars:Vc,macd:Oc,median:Lc,mfi:Bc,mode:Fc,mom:jc,nvi:$c,obv:Wc,param:qc,percentile_linear_interpolation:Uc,percentile_nearest_rank:Kc,percentrank:zc,pivothigh:Gc,pivotlow:Qc,pvi:Xc,pvt:Zc,range:Jc,rising:eh,rma:th,roc:ih,rsi:rh,sar:nh,sma:sh,stdev:ah,stoch:oh,supertrend:ch,swma:hh,tr:uh,tsi:lh,valuewhen:ph,variance:fh,vwap:mh,vwma:dh,wad:gh,wma:xh,wpr:yh,wvad:wh};class vh{constructor(t){this.context=t,Object.entries(bh).forEach(([i,r])=>{this[i]=r(t)})}accdist;alma;atr;barssince;bb;bbw;cci;change;cmo;cog;correlation;cross;crossover;crossunder;cum;dev;dmi;ema;falling;highest;highestbars;hma;iii;kc;kcw;linreg;lowest;lowestbars;macd;median;mfi;mode;mom;nvi;obv;param;percentile_linear_interpolation;percentile_nearest_rank;percentrank;pivothigh;pivotlow;pvi;pvt;range;rising;rma;roc;rsi;sar;sma;stdev;stoch;supertrend;swma;tr;tsi;valuewhen;variance;vwap;vwma;wad;wma;wpr;wvad}class _h{constructor(t){this.context=t}logFormat(t,...i){return t.replace(/{(\d+)}/g,(r,n)=>i[n])}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 Sh{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,n=0){const s=String(t),a=String(i),o=String(r),c=Math.floor(Number(n))||0;if(a==="")return s;let h=0,l=0;for(;;){const f=s.indexOf(a,h);if(f===-1)return s;if(l===c)return s.substring(0,f)+o+s.substring(f+a.length);l++,h=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,n)=>i[n])}}class Eh{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 Nh=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],Ch={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 kh{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 n=d.from(t).get(0);this.context.plots[i].data.push({time:this.context.marketData[this.context.idx].openTime,value:n,options:{...this.extractPlotOptions(r),style:"char"}})}plot(...t){const i=Vt(t,Nh,Ch),{series:r,title:n,...s}=i,a=this.extractPlotOptions(s);this.context.plots[n]||(this.context.plots[n]={data:[],options:a,title:n});const o=d.from(r).get(0);this.context.plots[n].data.push({time:this.context.marketData[this.context.idx].openTime,value:o,options:{color:a.color,offset:a.offset}})}}class Ih{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,n,s,a,o){return this.context.pine.plot(t,{title:i,color:r,linestyle:n,linewidth:s,editable:a,display:o})}}class Re{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([])};indicator;cache={};taState={};isSecondaryContext=!1;NA=NaN;lang;pine;static _deprecationWarningsShown=new Set;idx=0;params={};const={};var={};let={};result=void 0;plots={};marketData;source;tickerId;timeframe="";limit;sDate;eDate;fullContext;pineTSCode;constructor({marketData:t,source:i,tickerId:r,timeframe:n,limit:s,sDate:a,eDate:o,fullContext:c}){this.marketData=t,this.source=i,this.tickerId=r,this.timeframe=n,this.limit=s,this.sDate=a,this.eDate=o,this.fullContext=c||this;const h=new so(this),l={na:h.na.bind(h),color:h.color,nz:h.nz.bind(h),indicator:h.indicator.bind(h),fixnan:h.fixnan.bind(h),alertcondition:h.alertcondition.bind(h),bool:h.bool.bind(h)},f=this;this.pine={input:new No(this),ta:new vh(this),math:new ic(this),request:new oc(this),array:new $s(this),map:new ea(this),matrix:new eo(this),syminfo:null,timeframe:new Eh(this),barstate:new to(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 _h(this),str:new Sh(this),...l,...Cs};const g=new kh(this),p=new Ih(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 n=r?this.pine[r]:this.pine;for(const s of i)typeof t[s]=="function"?n[s]=t[s].bind(t):n[s]=t[s]}init(t,i,r=0){let n;return i instanceof d?n=i.get(0):Array.isArray(i)?Array.isArray(i[0])?n=i[0]:n=i[i.length-1+r]:n=i,t?t instanceof d?(t.data[t.data.length-1]=n,t):Array.isArray(t)?(t[t.length-1]=n,new d(t)):new d([n]):new d([n])}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}`;Re._deprecationWarningsShown.has(r)||(Re._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`))}}class Ot{constructor(t,i,r,n,s,a){this.source=t,this.tickerId=i,this.timeframe=r,this.limit=n,this.sDate=s,this.eDate=a,this._readyPromise=new Promise(o=>{this.loadMarketData(t,i,r,n,s,a).then(c=>{const h=c;this.data=h;const l=h.map(N=>N.open),f=h.map(N=>N.close),g=h.map(N=>N.high),p=h.map(N=>N.low),x=h.map(N=>N.volume),y=h.map(N=>(N.high+N.low+N.close)/3),w=h.map(N=>(N.high+N.low)/2),S=h.map(N=>(N.high+N.low+N.open+N.close)/4),k=h.map(N=>(N.high+N.low+N.close+N.close)/4),C=h.map(N=>N.openTime),A=h.map(N=>N.closeTime);this.open=l,this.close=f,this.high=g,this.low=p,this.volume=x,this.hl2=w,this.hlc3=y,this.ohlc4=S,this.hlcc4=k,this.openTime=C,this.closeTime=A,t&&t.getSymbolInfo?t.getSymbolInfo(i).then(N=>{this._syminfo=N,this._ready=!0,o(!0)}).catch(N=>{console.warn("Failed to get symbol info, using default values:",N),this._ready=!0,o(!0)}):(this._ready=!0,o(!0))})})}data=[];open=[];high=[];low=[];close=[];volume=[];hl2=[];hlc3=[];ohlc4=[];hlcc4=[];openTime=[];closeTime=[];_readyPromise=null;_ready=!1;_debugSettings={ln:!1,debug:!1};_transpiledCode=null;get transpiledCode(){return this._transpiledCode}_isSecondaryContext=!1;markAsSecondary(){this._isSecondaryContext=!0}_syminfo;setDebugSettings({ln:t,debug:i}){this._debugSettings.ln=t,this._debugSettings.debug=i}async loadMarketData(t,i,r,n,s,a){return Array.isArray(t)?t:t.getMarketData(i,r,n,s,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 n=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(t,i,r,n)}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,n=!1){await this.ready(),i||(i=this.data.length);const s=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(s.result);await this._executeIterations(s,this._transpiledCode,a,a+l),a+=l,yield this._createPageContext(s,f);continue}if(!n||Array.isArray(this.source))break;const{newCandles:c,updatedLastCandle:h}=await this._updateMarketData();if(c===0&&!h){yield null;continue}this._removeLastResult(s),a=this.data.length-(c+1),s.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 Re({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 n in t.result)Array.isArray(t.result[n])?r.result[n]=t.result[n].slice(i):r.result[n]=t.result[n]}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,n=this.data[r].openTime;try{const s=await i.getMarketData(this.tickerId,this.timeframe,void 0,n,t);if(!s||s.length===0)return{newCandles:0,updatedLastCandle:!1};let a=!1,o=0;for(let c=0;c<s.length;c++){const h=s[c];h.openTime===n?(this._replaceCandle(r,h),a=!0):h.openTime>n&&(this._appendCandle(h),o++)}return{newCandles:o,updatedLastCandle:a}}catch(s){return console.error("Error updating market data:",s),{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 Re({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 Wn.bind(this)(t,this._debugSettings)}async _executeIterations(t,i,r,n){const s=["const","var","let","params"];for(let a=r;a<n;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 c in o){t.result[c]===void 0&&(t.result[c]=[]);let h;o[c]instanceof d?h=o[c].get(0):Array.isArray(o[c])?h=o[c][o[c].length-1]:h=o[c],t.result[c].push(h)}}else Array.isArray(t.result)||(t.result=[]),t.result.push(o);for(let c of s)for(let h in t[c]){const l=t[c][h];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)}}}}}const oi="https://api.binance.com/api/v3",dt={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 Ah{cache;cacheDuration;constructor(t=5*60*1e3){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 Th{cacheManager;constructor(){this.cacheManager=new Ah(5*60*1e3)}async getMarketDataInterval(t,i,r,n){try{const s=dt[i.toUpperCase()];if(!s)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=[],c=r;const h=n,l=a[s];if(!l)return console.error(`Duration not defined for interval: ${s}`),[];for(;c<h;){const f=Math.min(c+1e3*l,h),g=await this.getMarketData(t,i,1e3,c,f);if(g.length===0)break;o=o.concat(g),c=g[g.length-1].closeTime+1}return o}catch(s){return console.error("Error in getMarketDataInterval:",s),[]}}async getMarketData(t,i,r,n,s){try{const a=s!==void 0,o={tickerId:t,timeframe:i,limit:r,sDate:n,eDate:s};if(a){const g=this.cacheManager.get(o);if(g)return g}const c=dt[i.toUpperCase()];if(!c)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,n,s)&&n&&s){const g=await this.getMarketDataInterval(t,i,n,s),p=r?g.slice(0,r):g;return this.cacheManager.set(o,p),p}let h=`${oi}/klines?symbol=${t}&interval=${c}`;r&&(h+=`&limit=${Math.min(r,1e3)}`),n&&(h+=`&startTime=${n}`),s&&(h+=`&endTime=${s}`);const l=await fetch(h);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,n){if(i&&i>1e3)return!0;if(r&&n){const s=dt[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}[s];if(a)return Math.ceil((n-r)/a)>1e3}return!1}async getSymbolInfo(t){try{let i="crypto",r=oi,n=t,s="";t.endsWith(".P")?(i="futures",n=t.replace(".P",""),r="https://fapi.binance.com/fapi/v1",s="Perpetual"):t.includes("_")&&(i="futures",n=t,r="https://dapi.binance.com/dapi/v1",s="Delivery");const a=i==="crypto"?`${r}/exchangeInfo?symbol=${n}`:`${r}/exchangeInfo`,o=await fetch(a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const c=(await o.json()).symbols;if(!c||c.length===0)return console.error(`Symbol ${t} not found`),null;const h=i==="futures"?c.find(C=>C.symbol===n):c[0];if(!h)return console.error(`Symbol ${n} not found in exchange info`),null;const l=h.filters?.find(C=>C.filterType==="PRICE_FILTER"),f=h.filters?.find(C=>C.filterType==="LOT_SIZE"),g=l?parseFloat(l.tickSize):.01,p=f?parseFloat(f.minQty):0,x=Math.round(1/g),y=h.baseAsset,w=h.quoteAsset,S=s?` ${s}`:"",k=`${y} / ${w}${S}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:y,description:k,type:i,main_tickerid:`BINANCE:${t}`,current_contract:s,isin:"",basecurrency:y,currency:w,timezone:"Etc/UTC",country:"",mintick:g,pricescale:x,minmove:1,pointvalue:h.contractSize||1,mincontract:p,session:"24x7",volumetype:"base",expiration_date:h.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}}}const Ph=sr.fileURLToPath(typeof document>"u"?new(require("url")).URL("file:"+__filename).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||new URL("pinets.min.cjs",document.baseURI).href),Rh=je.dirname(Ph);class Dh{dataCache=new Map;exchangeInfoCache={};dataDirectory;constructor(t){if(t)this.dataDirectory=t;else{const i=je.resolve(Rh,"../../../");this.dataDirectory=je.join(i,"tests","compatibility","_data")}}getDataFileName(t,i,r,n){return r&&n?`${t}-${i}-${r}-${n}.json`:null}loadDataFromFile(t){const i=`file:${t}`;if(this.dataCache.has(i))return this.dataCache.get(i);const r=je.join(this.dataDirectory,t);if(!ke.existsSync(r))throw new Error(`Mock data file not found: ${r}`);const n=ke.readFileSync(r,"utf-8"),s=JSON.parse(n);return this.dataCache.set(i,s),s}findDataFile(t,i,r,n){if(!ke.existsSync(this.dataDirectory))return null;const s=ke.readdirSync(this.dataDirectory).filter(c=>c.endsWith(".json"));if(r&&n){const c=`${t}-${i}-${r}-${n}.json`;if(s.includes(c))return c}const a=new RegExp(`^${t}-${i}-(\\d+)-(\\d+)\\.json$`),o=s.filter(c=>a.test(c)).map(c=>{const h=c.match(a);return{file:c,startTime:parseInt(h[1]),endTime:parseInt(h[2])}}).sort((c,h)=>h.endTime-c.endTime);if(o.length===0)return null;if(r&&n){const c=o.find(h=>h.startTime<=r&&h.endTime>=n);if(c)return c.file}return o[0].file}filterData(t,i,r,n){let s=t;return(i||r)&&(s=t.filter(a=>{const o=!i||a.openTime>=i,c=!r||a.openTime<=r;return o&&c})),s.sort((a,o)=>a.openTime-o.openTime),n&&n>0&&(s=s.slice(0,n)),s}normalizeTimeframe(t){return{1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",60:"1h",120:"2h",240:"4h","4H":"4h","1D":"1d",D:"1d","1W":"1w",W:"1w","1M":"1M",M:"1M"}[t.toUpperCase()]||t.toLowerCase()}async getMarketData(t,i,r,n,s){try{const a=this.normalizeTimeframe(i),o=this.findDataFile(t,a,n,s);if(!o)return console.warn(`No mock data file found for ${t} ${a}. Searched in: ${this.dataDirectory}`),[];const c=this.loadDataFromFile(o);return this.filterData(c,n,s,r)}catch(a){return console.error("Error in MockProvider.getMarketData:",a),[]}}loadExchangeInfo(t){if(this.exchangeInfoCache[t])return this.exchangeInfoCache[t];const i=t==="spot"?"api-exchangeInfo.json":"fapi-exchangeInfo.json",r=je.join(this.dataDirectory,i);if(!ke.existsSync(r))return console.warn(`Exchange info file not found: ${r}`),null;try{const n=ke.readFileSync(r,"utf-8"),s=JSON.parse(n);return this.exchangeInfoCache[t]=s,s}catch(n){return console.error(`Error loading exchange info from ${i}:`,n),null}}async getSymbolInfo(t){try{let i="crypto",r=t,n="";t.endsWith(".P")?(i="futures",r=t.replace(".P",""),n="Perpetual"):t.includes("_")&&(i="futures",r=t,n="Delivery");const s=this.loadExchangeInfo(i==="futures"?"futures":"spot");if(!s||!s.symbols)return console.error(`Exchange info not available for ${i}`),null;const a=s.symbols.find(w=>w.symbol===r);if(!a)return console.error(`Symbol ${r} not found in ${i} exchange info`),null;const o=a.filters?.find(w=>w.filterType==="PRICE_FILTER"),c=a.filters?.find(w=>w.filterType==="LOT_SIZE"),h=o?parseFloat(o.tickSize):.01,l=c?parseFloat(c.minQty):0,f=Math.round(1/h),g=a.baseAsset,p=a.quoteAsset,x=n?` ${n}`:"",y=`${g} / ${p}${x}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:g,description:y,type:i,main_tickerid:`BINANCE:${t}`,current_contract:n,isin:"",basecurrency:g,currency:p,timezone:"Etc/UTC",country:"",mintick:h,pricescale:f,minmove:1,pointvalue:a.contractSize||1,mincontract:l,session:"24x7",volumetype:"base",expiration_date:a.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 MockProvider.getSymbolInfo:",i),null}}clearCache(){this.dataCache.clear(),this.exchangeInfoCache={}}setDataDirectory(t){this.dataDirectory=t,this.clearCache()}}const Mh=typeof process<"u"&&process.versions&&process.versions.node;let rt=null;if(Mh)try{rt=new Dh}catch{rt=null}const Vh={Binance:new Th,...rt?{Mock:rt}:{}};exports.Context=Re;exports.PineTS=Ot;exports.Provider=Vh;
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 Ji(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 zn(e,t={}){const i=Ji(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 Rn(e).tokenize(),n=new Un(r).parse(),s={...t,sourceCode:e},a=new Kn(s).generate(n);return{success:!0,version:i,code:a,ast:n,tokens:r}}catch(r){return{success:!1,version:i,error:r.message,stack:r.stack}}}function Hn(e){if(typeof e=="function")return e.toString();{const t=Ji(e);if(t===null)return e;if(t>=5){const i=zn(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 Gn(e,t={debug:!1,ln:!1}){typeof t=="boolean"&&(t={debug:t,ln:!0});const{debug:i}=t;let r=Hn(e);r=gn(r);const n=i?r.split(`
114
+ `):[],s=zi(r,{ecmaVersion:"latest",sourceType:"module",locations:i});xn(s),fn(s),pn(s);const a=new on;yn(s,a);const o=vn(s,a)||"";In(s,a,o,t,n),kn(s);const c=rn||Mt||void 0,h=Object.assign({},c,{LineComment(f,g){g.write("//"+f.value)}}),l=Gi(s,{generator:h,comments:i});return new Function("",`var _r = ${l}
115
+ ; return _r;`)(this)}function Yn(e){return t=>new V(t.array.map(i=>Math.abs(i)),t.type,e)}function Qn(e){return t=>{let i=0,r=0;for(const n of t.array){const s=Number(n);isNaN(s)||(r++,i+=(s-i)/r)}return r===0?NaN:e.precision(i)}}function Xn(e){return(t,i)=>{const r=t.array;let n=0,s=r.length-1;for(;n<=s;){const a=Math.floor((n+s)/2),o=r[a];if(o===i)return a;o<i?n=a+1:s=a-1}return-1}}function Zn(e){return(t,i)=>{const r=t.array;let n=0,s=r.length;for(;n<s;){const a=Math.floor((n+s)/2);r[a]<i?n=a+1:s=a}return n<r.length&&r[n]===i?n:n-1}}function Jn(e){return(t,i)=>{const r=t.array;let n=0,s=r.length;for(;n<s;){const a=Math.floor((n+s)/2);r[a]<=i?n=a+1:s=a}return n>0&&r[n-1]===i?n-1:n}}function es(e){return t=>{t.array.length=0}}function ts(e){return(t,i)=>(t.array.push(...i.array),t)}function is(e){return t=>new V([...t.array],t.type,e)}function rs(e){return(t,i,r=!0)=>{const n=t.array,s=i.array;if(n.length!==s.length)return NaN;let a=0,o=0,c=0;const h=[];for(let x=0;x<n.length;x++){const y=Number(n[x]),w=Number(s[x]);!isNaN(y)&&y!==null&&y!==void 0&&!isNaN(w)&&w!==null&&w!==void 0&&(a+=y,o+=w,c++,h.push(x))}if(c===0)return NaN;const l=a/c,f=o/c;let g=0;for(const x of h){const y=Number(n[x]),w=Number(s[x]);g+=(y-l)*(w-f)}const p=r?c:c-1;return p<=0?NaN:e.precision(g/p)}}function ns(e){return t=>t.array.every(i=>!isNaN(i)&&i)}function ss(e){if(e.every(t=>typeof t=="number"))return e.every(t=>(t|0)===t)?L.int:L.float;if(e.every(t=>typeof t=="string"))return L.string;if(e.every(t=>typeof t=="boolean"))return L.bool;throw new Error("Cannot infer type from values")}function oe(e){if(typeof e=="number")return(e|0)===e?L.int:L.float;if(typeof e=="string")return L.string;if(typeof e=="boolean")return L.bool;throw new Error("Cannot infer type from value")}function Ye(e,t){switch(t){case L.int:return typeof e=="number"&&(e|0)===e||isNaN(e);case L.float:return typeof e=="number"||isNaN(e);case L.string:return typeof e=="string";case L.bool:return typeof e=="boolean"}return!1}function as(e){return(t,i,r=0,n)=>{const s=t.array.length,a=n!==void 0?Math.min(n,s):s;for(let o=r;o<a;o++){if(!Ye(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 os(e){return t=>t.array.length>0?t.array[0]:e.NA}function cs(e){return(t,i)=>t.array[i]}function hs(e){return(t,i)=>t.array.includes(i)}function us(e){return(t,i)=>t.array.indexOf(i)}function ls(e){return(t,i,r)=>{if(!Ye(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 ps(e){return(t,i=",")=>t.array.join(i)}function fs(e){return t=>t.array.length>0?t.array[t.array.length-1]:e.NA}function ms(e){return(t,i)=>t.array.lastIndexOf(i)}function ds(e){return(t,i=0)=>[...t.array].sort((r,n)=>n-r)[i]??e.NA}function gs(e){return t=>{if(t.array.length===0)return NaN;const i=[...t.array].sort((n,s)=>typeof n=="number"&&typeof s=="number"?n-s:0),r=Math.floor(i.length/2);return i.length%2!==0?i[r]:(i[r-1]+i[r])/2}}function xs(e){return(t,i=0)=>[...t.array].sort((r,n)=>r-n)[i]??e.NA}function ys(e){return t=>{if(t.array.length===0)return NaN;const i=new Map;let r=0;for(const s of t.array){const a=(i.get(s)||0)+1;i.set(s,a),a>r&&(r=a)}const n=[];for(const[s,a]of i)a===r&&n.push(s);return n.sort((s,a)=>typeof s=="number"&&typeof a=="number"?s-a:typeof s=="string"&&typeof a=="string"?s<a?-1:s>a?1:0:0),n[0]}}function ws(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const n=[];for(const c of r){const h=Number(c);if(isNaN(h)||h===null||h===void 0)return NaN;n.push(h)}n.sort((c,h)=>c-h),i<0&&(i=0),i>100&&(i=100);const s=i/100*n.length-.5;if(s<=0)return e.precision(n[0]);if(s>=n.length-1)return e.precision(n[n.length-1]);const a=Math.floor(s),o=s-a;return e.precision(n[a]*(1-o)+n[a+1]*o)}}function bs(e){return(t,i)=>{const r=t.array;if(r.length===0)return NaN;const n=[];for(const o of r){const c=Number(o);!isNaN(c)&&c!==null&&c!==void 0&&n.push(c)}if(n.length===0)return NaN;n.sort((o,c)=>o-c),i<0&&(i=0),i>100&&(i=100);const s=r.length,a=Math.ceil(i/100*s);return a<=0?n[0]:a>n.length?NaN:n[a-1]}}function vs(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 n=Number(t.array[r]);if(isNaN(n)||n===null||n===void 0)return NaN;let s=0;for(const o of t.array){const c=Number(o);!isNaN(c)&&c!==null&&c!==void 0&&c<n&&s++}const a=t.array.length-1;return a<=0?NaN:s/a*100}}function _s(e){return t=>t.array.pop()}function Ss(e){return(t,i)=>{if(!Ye(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 Es(e){return t=>e.precision(e.pine.array.max(t)-e.pine.array.min(t))}function Ns(e){return(t,i)=>i>=0&&i<t.array.length?t.array.splice(i,1)[0]:e.NA}function Cs(e){return t=>{t.array.reverse()}}function ks(e){return(t,i,r)=>{if(!Ye(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 Is(e){return t=>t.array.shift()}function As(e){return t=>t.array.length}function Ts(e){return(t,i,r)=>{const n=r!==void 0?r:void 0;return new V(t.array.slice(i,n),t.type,e)}}function Ps(e){return t=>t.array.some(i=>!isNaN(i)&&i)}var Pe=(e=>(e[e.ascending=1]="ascending",e[e.descending=0]="descending",e))(Pe||{}),er=(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))(er||{}),tr=(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))(tr||{}),ir=(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))(ir||{}),rr=(e=>(e.flag="flag",e.arrowdown="arrowdown",e.arrowup="arrowup",e.circle="circle",e.cross="cross",e.diamond="diamond",e.labeldown="labeldown",e.labelup="labelup",e.square="square",e.triangledown="triangledown",e.triangleup="triangleup",e.xcross="xcross",e))(rr||{}),nr=(e=>(e.abovebar="abovebar",e.belowbar="belowbar",e.absolute="absolute",e.bottom="bottom",e.top="top",e))(nr||{}),sr=(e=>(e.auto="auto",e.tiny="tiny",e.small="small",e.normal="normal",e.large="large",e.huge="huge",e))(sr||{}),ar=(e=>(e.inherit="inherit",e.mintick="mintick",e.percent="percent",e.price="price",e.volume="volume",e))(ar||{}),or=(e=>(e.linestyle_dashed="linestyle_dashed",e.linestyle_dotted="linestyle_dotted",e.linestyle_solid="linestyle_solid",e.style_area="style_area",e.style_areabr="style_areabr",e.style_circles="style_circles",e.style_columns="style_columns",e.style_cross="style_cross",e.style_histogram="style_histogram",e.style_line="style_line",e.style_linebr="style_linebr",e.style_stepline="style_stepline",e.style_stepline_diamond="style_stepline_diamond",e.style_steplinebr="style_steplinebr",e))(or||{});const Rs={order:Pe,currency:er,dayofweek:tr,display:ir,shape:rr,location:nr,size:sr,format:ar,plot:or};function Ds(e){return(t,i=Pe.ascending)=>{t.array.sort((r,n)=>{let s=isNaN(r)?1/0:r,a=isNaN(n)?1/0:n;return i===Pe.ascending?s-a:a-s})}}function Ms(e){return(t,i=Pe.ascending)=>{const r=t.array.map((n,s)=>s);return r.sort((n,s)=>{const a=isNaN(t.array[n])?1/0:t.array[n],o=isNaN(t.array[s])?1/0:t.array[s];return i===Pe.ascending?a-o:o-a}),new V(r,L.int,e)}}function Vs(e){return t=>{const i=e.array.avg(t),r=e.array.stdev(t);return isNaN(r)?new V(t.array.map(()=>NaN),L.int,e):r===0?new V(t.array.map(()=>1),L.int,e):new V(t.array.map(n=>(n-i)/r),L.int,e)}}function Os(e){return(t,i=!0)=>{const r=t.array,n=r.length;if(n===0)return NaN;let s=0,a=0,o=0;for(let l=0;l<n;l++){const f=Number(r[l]);!isNaN(f)&&f!==null&&f!==void 0&&(s+=f,a+=f*f,o++)}if(o===0)return NaN;const c=s/o;let h=a/o-c*c;return h<0?NaN:(!i&&o>1&&(h=h*o/(o-1)),!i&&o===1?0:e.precision(Math.sqrt(h)))}}function Ls(e){return t=>e.precision(t.array.reduce((i,r)=>{const n=Number(r);return isNaN(n)?i:i+n},0))}function Bs(e){return(t,i)=>{if(!Ye(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 Fs(e){return(t,i=!0)=>{let r=0,n=0;for(const c of t.array){const h=Number(c);!isNaN(h)&&h!==null&&h!==void 0&&(r+=h,n++)}if(n===0)return NaN;const s=r/n;let a=0;for(const c of t.array){const h=Number(c);!isNaN(h)&&h!==null&&h!==void 0&&(a+=(h-s)*(h-s))}const o=i?n:n-1;return o<=0?NaN:e.precision(a/o)}}var L=(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))(L||{});class V{constructor(t,i,r){this.array=t,this.type=i,this.context=r,this._abs=Yn(this.context),this._avg=Qn(this.context),this._binary_search=Xn(this.context),this._binary_search_leftmost=Zn(this.context),this._binary_search_rightmost=Jn(this.context),this._clear=es(this.context),this._concat=ts(this.context),this._copy=is(this.context),this._covariance=rs(this.context),this._every=ns(this.context),this._fill=as(this.context),this._first=os(this.context),this._get=cs(this.context),this._includes=hs(this.context),this._indexof=us(this.context),this._insert=ls(this.context),this._join=ps(this.context),this._last=fs(this.context),this._lastindexof=ms(this.context),this._max=ds(this.context),this._median=gs(this.context),this._min=xs(this.context),this._mode=ys(this.context),this._percentile_linear_interpolation=ws(this.context),this._percentile_nearest_rank=bs(this.context),this._percentrank=vs(this.context),this._pop=_s(this.context),this._push=Ss(this.context),this._range=Es(this.context),this._remove=Ns(this.context),this._reverse=Cs(this.context),this._set=ks(this.context),this._shift=Is(this.context),this._size=As(this.context),this._slice=Ts(this.context),this._some=Ps(this.context),this._sort=Ds(this.context),this._sort_indices=Ms(this.context),this._standardize=Vs(this.context),this._stdev=Os(this.context),this._sum=Ls(this.context),this._unshift=Bs(this.context),this._variance=Fs(this.context)}_abs;_avg;_binary_search;_binary_search_leftmost;_binary_search_rightmost;_clear;_concat;_copy;_covariance;_every;_fill;_first;_get;_includes;_indexof;_insert;_join;_last;_lastindexof;_max;_median;_min;_mode;_percentile_linear_interpolation;_percentile_nearest_rank;_percentrank;_pop;_push;_range;_remove;_reverse;_set;_shift;_size;_slice;_some;_sort;_sort_indices;_standardize;_stdev;_sum;_unshift;_variance;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 js(e){return(...t)=>new V([...t],ss(t),e)}function $s(e){return(t,i)=>new V(Array(t).fill(e.precision(i||0)),oe(i||0),e)}function Ws(e){return(t,i=!1)=>new V(Array(t).fill(i),L.bool,e)}function qs(e){return(t,i=NaN)=>new V(Array(t).fill(e.precision(i)),L.float,e)}function Us(e){return(t,i=0)=>new V(Array(t).fill(e.precision(i)),L.int,e)}function Ks(e){return(t,i="")=>new V(Array(t).fill(i),L.string,e)}class m{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 m?t:Array.isArray(t)?new m(t):new m([t])}}function zs(e){return(t,i=0)=>m.from(t).get(i)}class Hs{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=js(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=$s(t),this.new_bool=Ws(t),this.new_float=qs(t),this.new_int=Us(t),this.new_string=Ks(t),this.param=zs(),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 Gs(e){return t=>{t.map.clear()}}function Ys(e){return(t,i)=>t.map.has(i)}function Qs(e){return t=>{const i=new cr(e);return i.map=new Map(t.map),i}}function Xs(e){return(t,i)=>{const r=t.map.get(i);return r===void 0?NaN:r}}function Zs(e){return t=>{const i=Array.from(t.map.keys()),r=oe(i[0]);return new V(i,r,e)}}function Js(e){return(t,i,r)=>{const n=t.map.get(i);return t.map.set(i,r),n===void 0?NaN:n}}function ea(e){return(t,i)=>{for(const[r,n]of i.map)t.map.set(r,n)}}function ta(e){return(t,i)=>{const r=t.map.get(i);return t.map.delete(i)?r:NaN}}function ia(e){return t=>t.map.size}function ra(e){return t=>{const i=Array.from(t.map.values()),r=oe(i[0]);return new V(i,r,e)}}class cr{constructor(t){this.context=t,this.map=new Map,this._clear=Gs(this.context),this._contains=Ys(this.context),this._copy=Qs(this.context),this._get=Xs(this.context),this._keys=Zs(this.context),this._put=Js(this.context),this._put_all=ea(this.context),this._remove=ta(this.context),this._size=ia(this.context),this._values=ra(this.context)}map;_clear;_contains;_copy;_get;_keys;_put;_put_all;_remove;_size;_values;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 cr(e)}function sa(e){return(t,i=0)=>m.from(t).get(i)}class aa{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=sa(),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 oa(e){return(t,i,r)=>{const n=t.matrix.length;let s=[];if(r&&(r instanceof V?s=r.array:Array.isArray(r)?s=r:s=[r]),n===0){for(let c=0;c<s.length;c++){let h=s[c];h instanceof m&&(h=h.get(0)),t.matrix.push([h])}return}const a=t.matrix[0].length,o=i!==void 0?i:a;for(let c=0;c<n;c++){let h=c<s.length?s[c]:NaN;h instanceof m&&(h=h.get(0)),t.matrix[c].splice(o,0,h)}}}function ca(e){return(t,i,r)=>{const n=t.matrix.length;let s=[];if(r)if(r instanceof V)s=r.array;else if(Array.isArray(r))s=r;else if(r instanceof m){const h=r.get(0);Array.isArray(h)?s=h:s=[h]}else s=[r];const a=n>0?t.matrix[0].length:s.length,o=i!==void 0?i:n,c=[];for(let h=0;h<a;h++)if(h<s.length){let l=s[h];l instanceof m&&(l=l.get(0)),c.push(l)}else c.push(NaN);t.matrix.splice(o,0,c)}}function ha(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 n=0,s=0;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const c=t.matrix[a][o];isNaN(c)||(n+=c,s++)}return s===0?NaN:n/s}}function ua(e){return(t,i)=>{const r=t.matrix.length,n=[];for(let a=0;a<r;a++)n.push(t.matrix[a][i]);const s=oe(n[0]);return new V(n,s,e)}}function la(e){return t=>t.matrix.length===0?0:t.matrix[0].length}function pa(e){return(t,i)=>{const r=t.matrix.length,n=i.matrix.length;if(r===0){for(let o=0;o<n;o++)t.matrix.push([...i.matrix[o]]);return}const s=t.matrix[0].length,a=n>0?i.matrix[0].length:0;if(s!==a&&n>0){console.error(`matrix.concat: Column count mismatch ${s} vs ${a}`);return}for(let o=0;o<n;o++)t.matrix.push([...i.matrix[o]])}}function fa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0,n=new D(i,r,NaN,e);return n.matrix=t.matrix.map(s=>[...s]),n}}function ma(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(n=>[...n]);let r=1;for(let n=0;n<t;n++){let s=n;for(;s<t&&i[s][n]===0;)s++;if(s===t)return 0;s!==n&&([i[n],i[s]]=[i[s],i[n]],r*=-1),r*=i[n][n];for(let a=n+1;a<t;a++){const o=i[a][n]/i[n][n];for(let c=n;c<t;c++)i[a][c]-=o*i[n][c]}}return r}function da(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i!==r?NaN:ma(t.matrix)}}function ga(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new D(0,0,NaN,e);const n=t.matrix[0].length,s=new D(r,n,NaN,e);if(i instanceof D)for(let a=0;a<r;a++)for(let o=0;o<n;o++){const c=t.matrix[a][o],h=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;s.matrix[a][o]=c-h}else{const a=i;for(let o=0;o<r;o++)for(let c=0;c<n;c++)s.matrix[o][c]=t.matrix[o][c]-a}return s}}function xa(e){const t=e.length;if(t!==2)return Array(t).fill(NaN);const i=e[0][0],r=e[0][1],n=e[1][0],s=e[1][1],a=i+s,o=i*s-r*n,c=a*a-4*o;if(c<0)return[NaN,NaN];const h=(a+Math.sqrt(c))/2,l=(a-Math.sqrt(c))/2;return[h,l]}function ya(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r){const a=oe(t.matrix[0][0]);return new V([],a,e)}const n=xa(t.matrix),s=oe(n[0]);return new V(n,s,e)}}function wa(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new D(0,0,NaN,e);const n=new D(i,r,0,e);for(let s=0;s<i;s++)n.matrix[s][s]=1;return n}}function ba(e){return t=>{const i=t.matrix.length;return i===0?0:i*t.matrix[0].length}}function va(e){return(t,i,r,n,s,a)=>{const o=t.matrix.length;if(o===0)return;const c=t.matrix[0].length,h=r!==void 0?r:0,l=n!==void 0?n:o,f=s!==void 0?s:0,g=a!==void 0?a:c;for(let p=h;p<l&&!(p>=o);p++)for(let x=f;x<g&&!(x>=c);x++)t.matrix[p][x]=i}}function _a(e){return(t,i,r)=>{if(!t.matrix[i])return NaN;const n=t.matrix[i][r];return n===void 0?NaN:n}}function Sa(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 Ea(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;if(i!==r)return new D(i,r,NaN,e);const n=Sa(t.matrix),s=new D(i,r,NaN,e);return s.matrix=n,s}}function Na(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 n=0;n<i;n++)for(let s=0;s<r;s++)if(n+s!==i-1&&t.matrix[n][s]!==0)return!1;return!0}}function Ca(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 n=0;n<i;n++)for(let s=0;s<r;s++)if(t.matrix[s][n]!==-t.matrix[n][s])return!1;return!0}}function ka(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let n=0;n<i;n++)for(let s=0;s<r;s++){const a=t.matrix[n][s];if(a!==0&&a!==1)return!1}return!0}}function Ia(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 n=0;n<i;n++)for(let s=0;s<r;s++)if(n!==s&&t.matrix[n][s]!==0)return!1;return!0}}function Aa(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 n=0;n<i;n++)for(let s=0;s<r;s++)if(n===s){if(t.matrix[n][s]!==1)return!1}else if(t.matrix[n][s]!==0)return!1;return!0}}function Ta(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;return i===r}}function Pa(e){return t=>{const i=t.matrix.length;if(i===0)return!1;const r=t.matrix[0].length;for(let n=0;n<i;n++){let s=0;for(let a=0;a<r;a++){const o=t.matrix[n][a];if(o<0)return!1;s+=o}if(Math.abs(s-1)>1e-10)return!1}return!0}}function Ra(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 n=0;n<i;n++)for(let s=0;s<n;s++)if(t.matrix[n][s]!==t.matrix[s][n])return!1;return!0}}function Da(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 n=!0,s=!0;for(let a=0;a<i;a++)for(let o=0;o<r;o++)a>o&&t.matrix[a][o]!==0&&(n=!1),a<o&&t.matrix[a][o]!==0&&(s=!1);return n||s}}function Ma(e){return t=>{const i=t.matrix.length;if(i===0)return!0;const r=t.matrix[0].length;for(let n=0;n<i;n++)for(let s=0;s<r;s++)if(t.matrix[n][s]!==0)return!1;return!0}}function Va(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0,s=i.matrix.length,a=s>0?i.matrix[0].length:0,o=r*s,c=n*a,h=new D(o,c,NaN,e);for(let l=0;l<r;l++)for(let f=0;f<n;f++){const g=t.matrix[l][f];for(let p=0;p<s;p++)for(let x=0;x<a;x++){const y=i.matrix[p][x];h.matrix[l*s+p][f*a+x]=g*y}}return h}}function Oa(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let n=-1/0,s=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const c=t.matrix[a][o];isNaN(c)||(c>n&&(n=c),s=!0)}return s?n:NaN}}function La(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,n=[];for(let a=0;a<i;a++)for(let o=0;o<r;o++){const c=t.matrix[a][o];isNaN(c)||n.push(c)}if(n.length===0)return NaN;n.sort((a,o)=>a-o);const s=Math.floor(n.length/2);return n.length%2!==0?n[s]:(n[s-1]+n[s])/2}}function Ba(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length;let n=1/0,s=!1;for(let a=0;a<i;a++)for(let o=0;o<r;o++){const c=t.matrix[a][o];isNaN(c)||(c<n&&(n=c),s=!0)}return s?n:NaN}}function Fa(e){return t=>{const i=t.matrix.length;if(i===0)return NaN;const r=t.matrix[0].length,n=new Map;let s=0,a=NaN;for(let o=0;o<i;o++)for(let c=0;c<r;c++){const h=t.matrix[o][c];if(!isNaN(h)){const l=(n.get(h)||0)+1;n.set(h,l),l>s?(s=l,a=h):l===s&&h<a&&(a=h)}}return a}}function ja(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(i instanceof D){const s=i.matrix.length,a=s>0?i.matrix[0].length:0;if(n!==s)return new D(0,0,NaN,e);const o=new D(r,a,0,e);for(let c=0;c<r;c++)for(let h=0;h<a;h++){let l=0;for(let f=0;f<n;f++)l+=t.matrix[c][f]*i.matrix[f][h];o.matrix[c][h]=l}return o}else if(i instanceof V||Array.isArray(i.array||i)){const s=i.array||i;if(n!==s.length)return new D(0,0,NaN,e);const a=new D(r,1,0,e);for(let o=0;o<r;o++){let c=0;for(let h=0;h<n;h++)c+=t.matrix[o][h]*s[h];a.matrix[o][0]=c}return a}else{const s=i,a=new D(r,n,NaN,e);for(let o=0;o<r;o++)for(let c=0;c<n;c++)a.matrix[o][c]=t.matrix[o][c]*s;return a}}}function $a(e){return t=>{const i=t.matrix.length,r=i>0?t.matrix[0].length:0;return i===r?new D(i,r,NaN,e):new D(r,i,NaN,e)}}function Wa(e){return(t,i)=>{const r=t.matrix.length,n=r>0?t.matrix[0].length:0;if(r!==n)return new D(0,0,NaN,e);let s=new D(r,n,0,e);for(let c=0;c<r;c++)s.matrix[c][c]=1;let a=new D(r,n,NaN,e);for(let c=0;c<r;c++)a.matrix[c]=[...t.matrix[c]];let o=Math.floor(i);if(o<0)return new D(r,n,NaN,e);for(;o>0;){if(o%2===1){const h=new D(r,n,0,e);for(let l=0;l<r;l++)for(let f=0;f<n;f++){let g=0;for(let p=0;p<r;p++)g+=s.matrix[l][p]*a.matrix[p][f];h.matrix[l][f]=g}s=h}const c=new D(r,n,0,e);for(let h=0;h<r;h++)for(let l=0;l<n;l++){let f=0;for(let g=0;g<r;g++)f+=a.matrix[h][g]*a.matrix[g][l];c.matrix[h][l]=f}a=c,o=Math.floor(o/2)}return s}}function qa(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,n=t.matrix.map(a=>[...a]);let s=0;for(let a=0;a<r&&s<i;a++){let o=s;for(;o<i&&Math.abs(n[o][a])<1e-10;)o++;if(o<i){[n[s],n[o]]=[n[o],n[s]];const c=n[s][a];for(let h=a;h<r;h++)n[s][h]/=c;for(let h=0;h<i;h++)if(h!==s){const l=n[h][a];for(let f=a;f<r;f++)n[h][f]-=l*n[s][f]}s++}}return s}}function Ua(e){return(t,i)=>{const r=t.matrix.length;if(r===0){const a=oe(t.matrix[0][0]);return new V([],a,e)}const n=[];for(let a=0;a<r;a++){const o=t.matrix[a].splice(i,1);n.push(o[0])}const s=oe(n[0]);return new V(n,s,e)}}function Ka(e){return(t,i)=>{const r=t.matrix.splice(i,1),n=oe(r[0][0]);return new V(r[0]||[],n,e)}}function za(e){return(t,i,r)=>{const n=t.matrix.length,s=n>0?t.matrix[0].length:0,a=i*r,o=[];for(let l=0;l<n;l++)for(let f=0;f<s;f++)o.push(t.matrix[l][f]);for(;o.length<a;)o.push(NaN);o.length>a&&(o.length=a);const c=[];let h=0;for(let l=0;l<i;l++){const f=[];for(let g=0;g<r;g++)f.push(o[h++]);c.push(f)}t.matrix=c}}function Ha(e){return t=>{t.matrix.reverse();for(const i of t.matrix)i.reverse()}}function Ga(e){return(t,i)=>{if(!t.matrix[i]){const n=oe(t.matrix[0][0]);return new V([],n,e)}const r=oe(t.matrix[i][0]);return new V([...t.matrix[i]],r,e)}}function Ya(e){return t=>t.matrix.length}function Qa(e){return(t,i,r,n)=>{t.matrix[i]&&(t.matrix[i][r]=n)}}function Xa(e){return(t,i=0,r="asc")=>{t.matrix.length!==0&&t.matrix.sort((n,s)=>{const a=n[i],o=s[i];return a<o?r==="asc"?-1:1:a>o?r==="asc"?1:-1:0})}}function Za(e){return(t,i,r,n,s)=>{const a=r-i,o=s-n,c=new D(a,o,NaN,e);for(let h=0;h<a;h++){const l=i+h;if(l>=t.matrix.length)break;for(let f=0;f<o;f++){const g=n+f;if(g>=t.matrix[l].length)break;c.matrix[h][f]=t.matrix[l][g]}}return c}}function Ja(e){return(t,i)=>{const r=t.matrix.length;if(r===0)return new D(0,0,NaN,e);const n=t.matrix[0].length,s=new D(r,n,NaN,e);if(i instanceof D)for(let a=0;a<r;a++)for(let o=0;o<n;o++){const c=t.matrix[a][o],h=i.matrix[a]&&i.matrix[a][o]!==void 0?i.matrix[a][o]:NaN;s.matrix[a][o]=c+h}else{const a=i;for(let o=0;o<r;o++)for(let c=0;c<n;c++)s.matrix[o][c]=t.matrix[o][c]+a}return s}}function eo(e){return(t,i,r)=>{const n=t.matrix.length;for(let s=0;s<n;s++){const a=t.matrix[s][i];t.matrix[s][i]=t.matrix[s][r],t.matrix[s][r]=a}}}function to(e){return(t,i,r)=>{const n=t.matrix[i];t.matrix[i]=t.matrix[r],t.matrix[r]=n}}function io(e){return t=>{const i=t.matrix.length;if(i===0)return 0;const r=t.matrix[0].length,n=Math.min(i,r);let s=0;for(let a=0;a<n;a++)s+=t.matrix[a][a];return s}}function ro(e){return t=>{const i=t.matrix.length;if(i===0)return new D(0,0,NaN,e);const r=t.matrix[0].length,n=new D(r,i,NaN,e);for(let s=0;s<i;s++)for(let a=0;a<r;a++)n.matrix[a][s]=t.matrix[s][a];return n}}class D{constructor(t=0,i=0,r=NaN,n){if(this.context=n,this.matrix=[],t>0&&i>0)for(let s=0;s<t;s++)this.matrix.push(Array(i).fill(r));this._add_col=oa(this.context),this._add_row=ca(this.context),this._avg=ha(this.context),this._col=ua(this.context),this._columns=la(this.context),this._concat=pa(this.context),this._copy=fa(this.context),this._det=da(this.context),this._diff=ga(this.context),this._eigenvalues=ya(this.context),this._eigenvectors=wa(this.context),this._elements_count=ba(this.context),this._fill=va(this.context),this._get=_a(this.context),this._inv=Ea(this.context),this._is_antidiagonal=Na(this.context),this._is_antisymmetric=Ca(this.context),this._is_binary=ka(this.context),this._is_diagonal=Ia(this.context),this._is_identity=Aa(this.context),this._is_square=Ta(this.context),this._is_stochastic=Pa(this.context),this._is_symmetric=Ra(this.context),this._is_triangular=Da(this.context),this._is_zero=Ma(this.context),this._kron=Va(this.context),this._max=Oa(this.context),this._median=La(this.context),this._min=Ba(this.context),this._mode=Fa(this.context),this._mult=ja(this.context),this._pinv=$a(this.context),this._pow=Wa(this.context),this._rank=qa(this.context),this._remove_col=Ua(this.context),this._remove_row=Ka(this.context),this._reshape=za(this.context),this._reverse=Ha(this.context),this._row=Ga(this.context),this._rows=Ya(this.context),this._set=Qa(this.context),this._sort=Xa(this.context),this._submatrix=Za(this.context),this._sum=Ja(this.context),this._swap_columns=eo(this.context),this._swap_rows=to(this.context),this._trace=io(this.context),this._transpose=ro(this.context)}matrix;_add_col;_add_row;_avg;_col;_columns;_concat;_copy;_det;_diff;_eigenvalues;_eigenvectors;_elements_count;_fill;_get;_inv;_is_antidiagonal;_is_antisymmetric;_is_binary;_is_diagonal;_is_identity;_is_square;_is_stochastic;_is_symmetric;_is_triangular;_is_zero;_kron;_max;_median;_min;_mode;_mult;_pinv;_pow;_rank;_remove_col;_remove_row;_reshape;_reverse;_row;_rows;_set;_sort;_submatrix;_sum;_swap_columns;_swap_rows;_trace;_transpose;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 no(e){return(t,i,r)=>new D(t,i,r,e)}function so(e){return(t,i=0)=>m.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=no(t),this.param=so(),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)}}class oo{constructor(t){this.context=t}_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 si={series:e=>e instanceof m||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 m)};function qe(e,t,i){Array.isArray(t)&&typeof t[0]=="string"&&(t=[t]);const r={};let n={};const s=new Array(t.length).fill(!0);for(let a=0;a<e.length;a++){const o=e[a];if(si.remaining_options(o)){n=o;break}const c=t.map((h,l)=>s[l]?h[a]:void 0);for(let h=0;h<c.length;h++){const l=c[h];if(l===void 0){s[h]=!1;continue}const f=si[i[l]];typeof f=="function"&&f(o)?r[l]=o:s[h]=!1}}return{...n,...r}}const co=["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"],ho={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 uo(e){return qe(e,co,ho)}class lo{constructor(t){this.context=t}color={param:(t,i=0)=>m.from(t).get(i),rgb:(t,i,r,n)=>n?`rgba(${t}, ${i}, ${r}, ${n})`:`rgb(${t}, ${i}, ${r})`,new:(t,i)=>{if(t&&t.startsWith("#")){const r=t.slice(1),n=parseInt(r.slice(0,2),16),s=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16);return i?`rgba(${n}, ${s}, ${a}, ${i})`:`rgb(${n}, ${s}, ${a})`}return i?`rgba(${t}, ${i})`:t},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]=m.from(t[r]).get(0);return i}indicator(...t){const i=uo(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(m.from(t).get(0))}nz(t,i=0){const r=m.from(t).get(0),n=m.from(i).get(0);return isNaN(r)?n:r}fixnan(t){const i=m.from(t);for(let r=0;r<i.length;r++){const n=i.get(r);if(!isNaN(n))return n}return NaN}alertcondition(t,i,r){}bool(t){const i=m.from(t).get(0);return!isNaN(i)&&i!==0}int(t){const i=m.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=m.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 m.from(t).get(0).toString()}}const po=[["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"]],fo={defval:"primitive",title:"string",tooltip:"string",inline:"string",group:"string",display:"string",confirm:"boolean",options:"array",minval:"number",maxval:"number",step:"number"};function Y(e){return qe(e,po,fo)}function mo(e){return(...t)=>Y(t).defval}function go(e){return(...t)=>Y(t).defval}function xo(e){return(...t)=>Y(t).defval}function yo(e){return(...t)=>Y(t).defval}function wo(e){return(...t)=>Y(t).defval}function bo(e){return(...t)=>Y(t).defval}function vo(e){return(t,i=0)=>m.from(t).get(i)}function _o(e){return(...t)=>Y(t).defval}function So(e){return(...t)=>Y(t).defval}function Eo(e){return(...t)=>Y(t).defval}function No(e){return(...t)=>Y(t).defval}function Co(e){return(...t)=>Y(t).defval}function ko(e){return(...t)=>Y(t).defval}function Io(e){return(...t)=>Y(t).defval}function Ao(e){return(...t)=>Y(t).defval}const To={any:mo,bool:go,color:xo,enum:yo,float:wo,int:bo,param:vo,price:_o,session:So,source:Eo,string:No,symbol:Co,text_area:ko,time:Io,timeframe:Ao};class Po{constructor(t){this.context=t,Object.entries(To).forEach(([i,r])=>{this[i]=r(t)})}any;bool;color;enum;float;int;param;price;session;source;string;symbol;text_area;time;timeframe}function Ro(e){return t=>Math.abs(m.from(t).get(0))}function Do(e){return t=>Math.acos(m.from(t).get(0))}function Mo(e){return t=>Math.asin(m.from(t).get(0))}function Vo(e){return t=>Math.atan(m.from(t).get(0))}function Oo(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return i.reduce((r,n)=>r+n,0)/i.length}}function Lo(e){return t=>Math.ceil(m.from(t).get(0))}function Bo(e){return t=>Math.cos(m.from(t).get(0))}function Fo(e){return()=>Math.E}function jo(e){return t=>Math.exp(m.from(t).get(0))}function $o(e){return t=>Math.floor(m.from(t).get(0))}function Wo(e){return t=>Math.log(m.from(t).get(0))}function qo(e){return t=>Math.log(m.from(t).get(0))}function Uo(e){return t=>Math.log10(m.from(t).get(0))}function Ko(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return Math.max(...i)}}function zo(e){return(...t)=>{const i=t.map(r=>m.from(r).get(0));return Math.min(...i)}}function Ho(e){return(t,i,r)=>typeof t=="string"?t:t instanceof m?i?new m(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new m(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new m(e.params[r],0)))}function Go(e){return()=>1.618033988749895}function Yo(e){return()=>Math.PI}function Qo(e){return(t,i)=>Math.pow(m.from(t).get(0),m.from(i).get(0))}function Xo(e){return()=>Math.random()}function Zo(e){return t=>Math.round(m.from(t).get(0))}function Jo(e){return t=>e.precision(Math.round(m.from(t).get(0)/e.pine.syminfo.mintick)*e.pine.syminfo.mintick)}function ec(e){return()=>.6180339887498948}function tc(e){return t=>Math.sign(m.from(t).get(0))}function ic(e){return t=>Math.sin(m.from(t).get(0))}function rc(e){return t=>Math.sqrt(m.from(t).get(0))}function nc(e){return(t,i)=>{const r=m.from(i).get(0),n=m.from(t);let s=0;for(let a=0;a<r;a++){const o=n.get(a);s+=o}return s}}function sc(e){return t=>Math.tan(m.from(t).get(0))}function ac(e){return(t,i)=>{const r=m.from(t).get(0),n=m.from(i).get(0);return typeof r=="number"&&typeof n=="number"?isNaN(r)&&isNaN(n)?!0:isNaN(r)||isNaN(n)?!1:Math.abs(r-n)<1e-8:r===n}}const oc={abs:Ro,acos:Do,asin:Mo,atan:Vo,avg:Oo,ceil:Lo,cos:Bo,e:Fo,exp:jo,floor:$o,ln:Wo,log:qo,log10:Uo,max:Ko,min:zo,param:Ho,phi:Go,pi:Yo,pow:Qo,random:Xo,round:Zo,round_to_mintick:Jo,rphi:ec,sign:tc,sin:ic,sqrt:rc,sum:nc,tan:sc,__eq:ac};class cc{constructor(t){this.context=t,Object.entries(oc).forEach(([i,r])=>{this[i]=r(t)})}_cache={};abs;acos;asin;atan;avg;ceil;cos;e;exp;floor;ln;log;log10;max;min;param;phi;pi;pow;random;round;round_to_mintick;rphi;sign;sin;sqrt;sum;tan;__eq}function hc(e){return(t,i,r)=>{e.params[r]||(e.params[r]=[]);let n;if(t instanceof m)n=t.get(i||0);else if(Array.isArray(t)){const s=t.every(o=>o instanceof m),a=t.every(o=>!(o instanceof m)&&!Array.isArray(o));(s||a)&&t.length>=1?s?n=t.map(o=>o.get(0)):n=t:n=m.from(t).get(i||0)}else n=t;return e.params[r].length===0?e.params[r].push(n):e.params[r][e.params[r].length-1]=n,[n,r]}}const rt=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function ai(e,t,i,r,n=!1){for(let s=0;s<i.length;s++)if(i[s]<=e&&t<=r[s])return n||t>=r[s]?s:s-1;return-1}function oi(e,t,i,r,n=!1,s,a=!1){for(let o=i.length-1;o>=0;o--){if(r[o]<=t&&i[o]>=e){const c=s&&t>s;if(a&&n)for(let h=0;h<i.length;h++){if(i[h]>=e&&i[h]<t)return h;if(i[h]>=t)break}if(c&&n&&!a)for(let h=0;h<i.length;h++){if(i[h]>=e&&i[h]<t)return h;if(i[h]>=t)break}return o}if(r[o]<e)break}return-1}function uc(e){return async(t,i,r,n=!1,s=!1,a=!1,o=null,c=null)=>{const h=t[0],l=i[0],f=r[0],g=r[1],p=Array.isArray(n)?n[0]:n,x=Array.isArray(s)?s[0]:s;if(e.isSecondaryContext)return f;const y=rt.indexOf(e.timeframe),w=rt.indexOf(l);if(y==-1||w==-1)throw new Error("Invalid timeframe");if(y===w)return f;const S=y>w,k=m.from(e.data.openTime).get(0),C=m.from(e.data.closeTime).get(0),A=`${h}_${l}_${g}`,N=`${A}_prevIdx`;if(e.cache[A]){const Be=e.cache[A],Qe=S?oi(k,C,Be.data.openTime.data,Be.data.closeTime.data,x,e.eDate,p):ai(k,C,Be.data.openTime.data,Be.data.closeTime.data,x);if(Qe==-1)return NaN;const Ce=Be.params[g][Qe];if(!S&&p){const Bt=e.cache[N];return Bt!==void 0&&Bt===Qe?NaN:(e.cache[N]=Qe,Array.isArray(Ce)?[Ce]:Ce)}return Array.isArray(Ce)?[Ce]:Ce}const q=1e3*60*60*24*30,W=e.sDate?e.sDate-q:void 0,j=e.sDate&&e.eDate?void 0:e.limit||1e3,Le=new Lt(e.source,h,l,j,W,void 0);Le.markAsSecondary();const de=await Le.run(e.pineTSCode);e.cache[A]=de;const ht=S?oi(k,C,de.data.openTime.data,de.data.closeTime.data,x,e.eDate,p):ai(k,C,de.data.openTime.data,de.data.closeTime.data,x);if(ht==-1)return NaN;const ut=de.params[g][ht];return!S&&p?(e.cache[N]=ht,NaN):Array.isArray(ut)?[ut]:ut}}function lc(e){return async(t,i,r,n=!1,s=null,a=!1,o=0)=>{const c=t[0],h=i[0],l=r[0],f=r[1];Array.isArray(n)&&n[0];const g=Array.isArray(a)?a[0]:a;if(e.isSecondaryContext)return Array.isArray(l)?[l]:l;const p=rt.indexOf(e.timeframe),x=rt.indexOf(h);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 ${h} is not lower than or equal to chart timeframe ${e.timeframe}`)}if(x===p)return[[l]];const y=`${c}_${h}_${f}_lower`;if(!e.cache[y]){const W=e.sDate?e.sDate-2592e6:void 0,j=e.sDate&&e.eDate?void 0:e.limit||1e3,Le=new Lt(e.source,c,h,j,W,e.eDate);Le.markAsSecondary();const de=await Le.run(e.pineTSCode);e.cache[y]=de}const w=e.cache[y],S=m.from(e.data.openTime).get(0),k=m.from(e.data.closeTime).get(0),C=w.data.openTime.data,A=w.data.closeTime.data,N=w.params[f];if(!N)return[];const q=[];for(let W=0;W<C.length;W++){const j=C[W];if(!(A[W]<=S)){if(j>=k)break;j>=S&&j<k&&q.push(N[W])}}return[q]}}const pc={param:hc,security:uc,security_lower_tf:lc};class fc{constructor(t){this.context=t,Object.entries(pc).forEach(([i,r])=>{this[i]=r(t)})}_cache={};param;security;security_lower_tf}function mc(e){return t=>{e.taState||(e.taState={});const i=t||"accdist";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],n=e.get(e.data.close,0),s=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.volume,0);if(isNaN(n)||isNaN(s)||isNaN(a)||isNaN(o))return e.precision(r.cumulativeSum);const c=s-a;let h=0;return c!==0&&(h=(n-a-(s-n))/c*o),r.cumulativeSum+=h,e.precision(r.cumulativeSum)}}function dc(e){return(t,i,r,n,s)=>{const a=m.from(i).get(0),o=m.from(r).get(0),c=m.from(n).get(0);e.taState||(e.taState={});const h=s||`alma_${a}_${o}_${c}`;if(!e.taState[h]){const p=o*(a-1),x=a/c,y=[];let w=0;for(let S=0;S<a;S++){const k=Math.exp(-Math.pow(S-p,2)/(2*x*x));y.push(k),w+=k}for(let S=0;S<y.length;S++)y[S]/=w;e.taState[h]={window:[],weights:y}}const l=e.taState[h],f=m.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 gc(e){return(t,i)=>{const r=m.from(t).get(0);e.taState||(e.taState={});const n=i||`atr_${r}`;e.taState[n]||(e.taState[n]={prevAtr:null,initSum:0,initCount:0,prevClose:null});const s=e.taState[n],a=e.get(e.data.high,0),o=e.get(e.data.low,0),c=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(c))return NaN;let h;if(s.prevClose!==null){const f=a-o,g=Math.abs(a-s.prevClose),p=Math.abs(o-s.prevClose);h=Math.max(f,g,p)}else h=a-o;if(s.prevClose=c,s.initCount<r)return s.initSum+=h,s.initCount++,s.initCount===r?(s.prevAtr=s.initSum/r,e.precision(s.prevAtr)):NaN;const l=(s.prevAtr*(r-1)+h)/r;return s.prevAtr=l,e.precision(l)}}function xc(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"barssince";e.taState[r]||(e.taState[r]={lastTrueIndex:null});const n=e.taState[r];return m.from(t).get(0)?(n.lastTrueIndex=e.idx,0):n.lastTrueIndex===null?NaN:e.idx-n.lastTrueIndex}}function yc(e){return(t,i,r,n)=>{const s=m.from(i).get(0),a=m.from(r).get(0);e.taState||(e.taState={});const o=n||`bb_${s}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const c=e.taState[o],h=m.from(t).get(0);if(isNaN(h))return[[NaN,NaN,NaN]];if(c.window.unshift(h),c.sum+=h,c.window.length<s)return[[NaN,NaN,NaN]];if(c.window.length>s){const y=c.window.pop();c.sum-=y}const l=c.sum/s;let f=0;for(let y=0;y<s;y++)f+=Math.pow(c.window[y]-l,2);const g=Math.sqrt(f/s),p=l+a*g,x=l-a*g;return[[e.precision(p),e.precision(l),e.precision(x)]]}}function wc(e){return(t,i,r,n)=>{const s=m.from(i).get(0),a=m.from(r).get(0);e.taState||(e.taState={});const o=n||`bbw_${s}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const c=e.taState[o],h=m.from(t).get(0);if(isNaN(h))return NaN;if(c.window.unshift(h),c.sum+=h,c.window.length<s)return NaN;if(c.window.length>s){const w=c.window.pop();c.sum-=w}const l=c.sum/s;let f=0;for(let w=0;w<s;w++){const S=c.window[w]-l;f+=S*S}const g=f/s,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 bc(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`cci_${n}`;e.taState[s]||(e.taState[s]={window:[],sum:0});const a=e.taState[s],o=m.from(t).get(0);if(isNaN(o))return NaN;if(a.window.unshift(o),a.sum+=o,a.window.length<n)return NaN;if(a.window.length>n){const g=a.window.pop();a.sum-=g}const c=a.sum/n;let h=0;for(let g=0;g<n;g++)h+=Math.abs(a.window[g]-c);const l=h/n;if(l===0)return 0;const f=(o-c)/(.015*l);return e.precision(f)}}function vc(e){return(t,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`change_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<=n)return NaN;a.window.length>n+1&&a.window.pop();const c=o-a.window[n];return e.precision(c)}}function _c(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`cmo_${n}`;e.taState[s]||(e.taState[s]={gainsWindow:[],lossesWindow:[],gainsSum:0,lossesSum:0});const a=e.taState[s],o=m.from(t).get(0),c=m.from(t).get(1);if(isNaN(o)||isNaN(c))return NaN;const h=o-c,l=h>=0?h:0,f=h>=0?0:-h;if(a.gainsWindow.unshift(l),a.lossesWindow.unshift(f),a.gainsSum+=l,a.lossesSum+=f,a.gainsWindow.length<n)return NaN;if(a.gainsWindow.length>n){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 Sc(e){return(t,i,r)=>{const n=m.from(i).get(0),s=m.from(t);let a=0,o=!1;for(let l=0;l<n;l++){const f=s.get(l);if(isNaN(f)){o=!0;break}a+=f}if(o)return NaN;let c=0;for(let l=0;l<n;l++){const f=s.get(l);c+=f*(l+1)}if(a===0)return NaN;const h=-c/a;return e.precision(h)}}function Ec(e){return(t,i,r,n)=>{const s=m.from(r).get(0),a=m.from(t),o=m.from(i);if(e.idx<s-1)return NaN;let c=0,h=0,l=0,f=0,g=0,p=0;for(let k=0;k<s;k++){const C=a.get(k),A=o.get(k);isNaN(C)||isNaN(A)||(c+=C,h+=A,l+=C*A,f+=C*C,g+=A*A,p++)}if(p<2)return NaN;const x=p*l-c*h,y=p*f-c*c,w=p*g-h*h;if(y<=0||w<=0)return e.precision(0);const S=x/Math.sqrt(y*w);return e.precision(S)}}function Nc(e){return(t,i,r)=>{const n=m.from(t),s=m.from(i),a=n.get(0),o=s.get(0),c=n.get(1),h=s.get(1);if(isNaN(a)||isNaN(o)||isNaN(c)||isNaN(h))return!1;const l=a>o&&c<=h,f=a<o&&c>=h;return l||f}}function Cc(e){return(t,i)=>{const r=m.from(t),n=m.from(i),s=r.get(0),a=n.get(0),o=r.get(1),c=n.get(1);return o<c&&s>a}}function kc(e){return(t,i)=>{const r=m.from(t),n=m.from(i),s=r.get(0),a=n.get(0),o=r.get(1),c=n.get(1);return o>c&&s<a}}function Ic(e){return(t,i)=>{e.taState||(e.taState={});const r=i||"cum";e.taState[r]||(e.taState[r]={cumulativeSum:0});const n=e.taState[r],s=m.from(t).get(0);return isNaN(s)||(n.cumulativeSum+=s),e.precision(n.cumulativeSum)}}function Ac(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`dev_${n}`;e.taState[s]||(e.taState[s]={window:[],sum:0});const a=e.taState[s],o=m.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<n)return NaN;if(a.window.length>n){const f=a.window.pop();a.sum-=f}const c=a.sum/n;let h=0;for(let f=0;f<n;f++)h+=Math.abs(a.window[f]-c);const l=h/n;return e.precision(l)}}function Tc(e){return(t,i,r)=>{const n=m.from(t).get(0),s=m.from(i).get(0);e.taState||(e.taState={});const a=r||`dmi_${n}_${s}`;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],c=e.get(e.data.high,0),h=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(c)||isNaN(h)||isNaN(l))return[[NaN,NaN,NaN]];if(isNaN(o.prevHigh))return o.prevHigh=c,o.prevLow=h,o.prevClose=l,[[NaN,NaN,NaN]];const f=Math.max(c-h,Math.abs(c-o.prevClose),Math.abs(h-o.prevClose)),g=c-o.prevHigh,p=o.prevLow-h,x=g>p&&g>0?g:0,y=p>g&&p>0?p:0;o.prevHigh=c,o.prevLow=h,o.prevClose=l;let w,S,k;if(o.initCount++,o.initCount<=n)o.trInitSum+=f,o.plusInitSum+=x,o.minusInitSum+=y,o.initCount===n&&(o.prevSmoothedTR=o.trInitSum/n,o.prevSmoothedPlus=o.plusInitSum/n,o.prevSmoothedMinus=o.minusInitSum/n);else{const j=1/n;o.prevSmoothedTR=j*f+(1-j)*o.prevSmoothedTR,o.prevSmoothedPlus=j*x+(1-j)*o.prevSmoothedPlus,o.prevSmoothedMinus=j*y+(1-j)*o.prevSmoothedMinus}if(w=o.prevSmoothedTR,S=o.prevSmoothedPlus,k=o.prevSmoothedMinus,o.initCount<n)return[[NaN,NaN,NaN]];const C=w===0?0:100*S/w,A=w===0?0:100*k/w,N=C+A,q=N===0?0:100*Math.abs(C-A)/N;let W=NaN;if(o.adxInitCount++,o.adxInitCount<=s)o.dxInitSum+=q,o.adxInitCount===s&&(o.prevADX=o.dxInitSum/s,W=o.prevADX);else{const j=1/s;o.prevADX=j*q+(1-j)*o.prevADX,W=o.prevADX}return[[e.precision(C),e.precision(A),e.precision(W)]]}}function Pc(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`ema_${n}`;e.taState[s]||(e.taState[s]={prevEma:null,initSum:0,initCount:0});const a=e.taState[s],o=m.from(t).get(0);if(o==null||isNaN(o))return NaN;if(a.initCount<n)return a.initSum+=o,a.initCount++,a.initCount===n?(a.prevEma=a.initSum/n,e.precision(a.prevEma)):NaN;const c=2/(n+1),h=o*c+a.prevEma*(1-c);return a.prevEma=h,e.precision(h)}}function Rc(e){return(t,i,r)=>{const n=m.from(i).get(0),s=m.from(t);for(let a=0;a<n;a++){const o=s.get(a),c=s.get(a+1);if(isNaN(o)||isNaN(c)||o>=c)return!1}return!0}}function Dc(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`highest_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<n)return NaN;a.window.length>n&&a.window.pop();const c=Math.max(...a.window.filter(h=>!isNaN(h)));return e.precision(c)}}function Mc(e){return(t,i,r)=>{const n=m.from(i).get(0),s=m.from(t);if(e.idx<n-1)return NaN;let a=-1/0,o=NaN;for(let c=0;c<n;c++){const h=s.get(c);isNaN(h)||(isNaN(o)||h>a)&&(a=h,o=-c)}return o}}function Vc(e){return(t,i,r)=>{const n=m.from(i).get(0),s=Math.floor(n/2),a=Math.floor(Math.sqrt(n)),o=e.ta.wma,c=o(t,s,r?`${r}_wma1`:void 0),h=o(t,n,r?`${r}_wma2`:void 0);if(isNaN(c)||isNaN(h))return NaN;e.taState||(e.taState={});const l=r||`hma_raw_${n}`;e.taState[l]||(e.taState[l]=[]);const f=2*c-h;e.taState[l].unshift(f);const g=r?`${r}_hma_final`:`hma_final_${n}`;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 S=0;S<a;S++){const k=a-S;x+=p.window[S]*k,y+=k}const w=x/y;return e.precision(w)}}function Oc(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.high,0),n=e.get(e.data.low,0),s=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(n)||isNaN(s))return NaN;const a=(r-n)*s;if(a===0)return e.precision(0);const o=(2*i-r-n)/a;return e.precision(o)}}function Lc(e){return(t,i,r,n,s)=>{const a=m.from(i).get(0),o=m.from(r).get(0);let c=!0;typeof n=="string"?s=n:n!==void 0&&(c=m.from(n).get(0));let h;const l=e.get(e.data.high,0),f=e.get(e.data.low,0);if(c){const A=e.get(e.data.close,1);isNaN(A)?h=NaN:h=Math.max(l-f,Math.abs(l-A),Math.abs(f-A))}else h=l-f;const g=m.from(t).get(0);e.taState||(e.taState={});const p=s||`kc_${a}_${o}_${c}`;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=(A,N,q)=>{if(isNaN(N))return NaN;if(A.initCount<q)return A.initSum+=N,A.initCount++,A.initCount===q?(A.prevEma=A.initSum/q,A.prevEma):NaN;const W=2/(q+1);return A.prevEma=N*W+A.prevEma*(1-W),A.prevEma},w=y(x.basisState,g,a),S=y(x.rangeState,h,a);if(isNaN(w)||isNaN(S))return[[NaN,NaN,NaN]];const k=w+S*o,C=w-S*o;return[[e.precision(w),e.precision(k),e.precision(C)]]}}function Bc(e){return(t,i,r,n,s)=>{const a=m.from(i).get(0),o=m.from(r).get(0);let c=!0;typeof n=="string"?s=n:n!==void 0&&(c=m.from(n).get(0)),e.taState||(e.taState={});const h=s||`kcw_${a}_${o}_${c}`;e.taState[h]||(e.taState[h]={basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0}});const l=e.taState[h],f=(C,A,N)=>{if(isNaN(A))return NaN;if(C.initCount<N)return C.initSum+=A,C.initCount++,C.initCount===N?(C.prevEma=C.initSum/N,C.prevEma):NaN;const q=2/(N+1);return C.prevEma=A*q+C.prevEma*(1-q),C.prevEma};let g;const p=e.get(e.data.high,0),x=e.get(e.data.low,0);if(c){const C=e.get(e.data.close,1);isNaN(C)?g=NaN:g=Math.max(p-x,Math.abs(p-C),Math.abs(x-C))}else g=p-x;const y=m.from(t).get(0),w=f(l.basisState,y,a),S=f(l.rangeState,g,a);if(isNaN(w)||isNaN(S))return NaN;if(w===0)return e.precision(0);const k=2*S*o/w;return e.precision(k)}}function Fc(e){return(t,i,r,n)=>{const s=m.from(i).get(0),a=m.from(r).get(0);e.taState||(e.taState={});const o=n||`linreg_${s}_${a}`;e.taState[o]||(e.taState[o]={window:[]});const c=e.taState[o],h=m.from(t).get(0);if(c.window.unshift(h),c.window.length<s)return NaN;c.window.length>s&&c.window.pop();let l=0,f=0,g=0,p=0;const x=s;for(let k=0;k<s;k++){const C=s-1-k,A=c.window[k];l+=C,f+=A,g+=C*A,p+=C*C}const y=x*p-l*l;if(y===0)return NaN;const w=(x*g-l*f)/y,S=(f-w*l)/x+w*(s-1-a);return e.precision(S)}}function jc(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`lowest_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<n)return NaN;a.window.length>n&&a.window.pop();const c=a.window.filter(l=>!isNaN(l)&&l!==void 0),h=c.length>0?Math.min(...c):NaN;return e.precision(h)}}function $c(e){return(t,i,r)=>{const n=m.from(i).get(0),s=m.from(t);if(e.idx<n-1)return NaN;let a=1/0,o=NaN;for(let c=0;c<n;c++){const h=s.get(c);isNaN(h)||(isNaN(o)||h<a)&&(a=h,o=-c)}return o}}function Wc(e){return(t,i,r,n,s)=>{const a=m.from(i).get(0),o=m.from(r).get(0),c=m.from(n).get(0),h=s||`macd_${a}_${o}_${c}`,l=`${h}_fast`,f=`${h}_slow`,g=`${h}_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,c,g));let S=NaN;return!isNaN(y)&&!isNaN(w)&&(S=y-w),[[e.precision(y),e.precision(w),e.precision(S)]]}}function qc(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`median_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<n)return NaN;a.window.length>n&&a.window.pop();const c=a.window.slice().sort((f,g)=>f-g),h=Math.floor(n/2),l=n%2===0?(c[h-1]+c[h])/2:c[h];return e.precision(l)}}function Uc(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`mfi_${n}`;e.taState[s]||(e.taState[s]={upperWindow:[],lowerWindow:[],upperSum:0,lowerSum:0});const a=e.taState[s],o=m.from(t).get(0),c=m.from(t).get(1),h=e.get(e.data.volume,0);if(isNaN(o)||isNaN(h))return NaN;const l=isNaN(c)?NaN:o-c;let f=0,g=0;if(f=h*(l<=0?0:o),g=h*(l>=0?0:o),a.upperWindow.unshift(f),a.lowerWindow.unshift(g),a.upperSum+=f,a.lowerSum+=g,a.upperWindow.length<n)return NaN;if(a.upperWindow.length>n){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 Kc(e){return(t,i,r)=>{const n=m.from(i).get(0),s=m.from(t);if(e.idx<n-1)return NaN;const a=new Map;for(let h=0;h<n;h++){const l=s.get(h);isNaN(l)||a.set(l,(a.get(l)||0)+1)}if(a.size===0)return NaN;let o=NaN,c=-1;for(const[h,l]of a.entries())l>c?(c=l,o=h):l===c&&h<o&&(o=h);return o}}function zc(e){return(t,i,r)=>{const n=m.from(i).get(0);return e.ta.change(t,n)}}function Hc(e){return t=>{e.taState||(e.taState={});const i=t||"nvi";e.taState[i]||(e.taState[i]={nvi:1});const r=e.taState[i],n=e.get(e.data.close,0),s=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),c=isNaN(n)?0:n,h=isNaN(s)?0:s,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(c===0||h===0)&&l<f){const g=(c-h)/h;r.nvi=r.nvi+g*r.nvi}return e.precision(r.nvi)}}function Gc(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),n=e.get(e.data.volume,0),s=e.get(e.data.close,1);if(isNaN(s))return i.prevOBV=0,e.precision(0);let a;return r>s?a=i.prevOBV+n:r<s?a=i.prevOBV-n:a=i.prevOBV,i.prevOBV=a,e.precision(a)}}function Yc(e){return(t,i,r)=>t instanceof m?i?new m(t.data,t.offset+i):t:(e.params[r]||(e.params[r]=[]),Array.isArray(t)?new m(t,i||0):(e.params[r].length===0?e.params[r].push(t):e.params[r][e.params[r].length-1]=t,new m(e.params[r],0)))}function Qc(e){return(t,i,r,n)=>{const s=m.from(i).get(0),a=m.from(r).get(0),o=m.from(t);if(e.idx<s-1)return NaN;const c=[];for(let x=0;x<s;x++){const y=o.get(x);if(isNaN(y))return NaN;c.push(y)}c.sort((x,y)=>x-y);let h=a/100*s-.5;h<0&&(h=0),h>s-1&&(h=s-1);const l=Math.floor(h),f=Math.ceil(h);if(l===f)return e.precision(c[l]);const g=h-l,p=c[l]+g*(c[f]-c[l]);return e.precision(p)}}function Xc(e){return(t,i,r,n)=>{const s=m.from(i).get(0),a=m.from(r).get(0),o=m.from(t);if(e.idx<s-1)return NaN;const c=[];for(let l=0;l<s;l++){const f=o.get(l);isNaN(f)||c.push(f)}if(c.length===0)return NaN;c.sort((l,f)=>l-f);let h=Math.ceil(a/100*c.length)-1;return h<0&&(h=0),h>=c.length&&(h=c.length-1),e.precision(c[h])}}function Zc(e){return(t,i,r)=>{const n=m.from(i).get(0),s=m.from(t);if(e.idx<n)return NaN;const a=s.get(0);if(isNaN(a))return NaN;let o=0,c=0;for(let h=1;h<=n;h++){const l=s.get(h);isNaN(l)||(c++,l<=a&&o++)}return c===0?NaN:e.precision(o/c*100)}}function Jc(e,t,i){const r=new Array(e.length).fill(NaN);for(let n=t+i;n<e.length;n++){const s=e[n-i];let a=!0;for(let o=1;o<=t;o++)if(e[n-i-o]>=s){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[n-i+o]>=s){a=!1;break}}a&&(r[n]=s)}return r}function eh(e){return(t,i,r,n)=>{typeof r=="string"&&(r=i,i=t,t=e.data.high);const s=m.from(i).get(0),a=m.from(r).get(0),o=m.from(t).toArray(),c=Jc(o,s,a),h=e.idx;return e.precision(c[h])}}function th(e,t,i){const r=new Array(e.length).fill(NaN);for(let n=t+i;n<e.length;n++){const s=e[n-i];let a=!0;for(let o=1;o<=t;o++)if(e[n-i-o]<=s){a=!1;break}if(a){for(let o=1;o<=i;o++)if(e[n-i+o]<=s){a=!1;break}}a&&(r[n]=s)}return r}function ih(e){return(t,i,r,n)=>{typeof r=="string"&&(r=i,i=t,t=e.data.low);const s=m.from(i).get(0),a=m.from(r).get(0),o=m.from(t).toArray(),c=th(o,s,a),h=e.idx;return e.precision(c[h])}}function rh(e){return t=>{e.taState||(e.taState={});const i=t||"pvi";e.taState[i]||(e.taState[i]={pvi:1});const r=e.taState[i],n=e.get(e.data.close,0),s=e.get(e.data.close,1),a=e.get(e.data.volume,0),o=e.get(e.data.volume,1),c=isNaN(n)?0:n,h=isNaN(s)?0:s,l=isNaN(a)?0:a,f=isNaN(o)?0:o;if(!(c===0||h===0)&&l>f){const g=(c-h)/h;r.pvi=r.pvi+g*r.pvi}return e.precision(r.pvi)}}function nh(e){return t=>{e.taState||(e.taState={});const i=t||"pvt";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],n=e.get(e.data.close,0),s=e.get(e.data.close,1),a=e.get(e.data.volume,0);if(!isNaN(n)&&!isNaN(s)&&!isNaN(a)&&s!==0){const o=(n-s)/s*a;r.cumulativeSum+=o}return e.precision(r.cumulativeSum)}}function sh(e){return(t,i,r)=>{const n=e.pine.ta.highest(t,i,(r||"range")+"_h"),s=e.pine.ta.lowest(t,i,(r||"range")+"_l");return isNaN(n)||isNaN(s)?NaN:e.precision(n-s)}}function ah(e){return(t,i,r)=>{const n=m.from(i).get(0),s=m.from(t);for(let a=0;a<n;a++){const o=s.get(a),c=s.get(a+1);if(isNaN(o)||isNaN(c)||o<=c)return!1}return!0}}function oh(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`rma_${n}`;e.taState[s]||(e.taState[s]={prevRma:null,initSum:0,initCount:0});const a=e.taState[s],o=m.from(t).get(0)||0;if(a.initCount<n)return a.initSum+=o,a.initCount++,a.initCount===n?(a.prevRma=a.initSum/n,e.precision(a.prevRma)):NaN;const c=1/n,h=o*c+a.prevRma*(1-c);return a.prevRma=h,e.precision(h)}}function ch(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`roc_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<=n)return NaN;a.window.length>n+1&&a.window.pop();const c=a.window[n],h=(o-c)/c*100;return e.precision(h)}}function hh(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`rsi_${n}`;e.taState[s]||(e.taState[s]={prevValue:null,avgGain:0,avgLoss:0,initGains:[],initLosses:[]});const a=e.taState[s],o=m.from(t).get(0);if(a.prevValue!==null){const c=o-a.prevValue,h=c>0?c:0,l=c<0?-c:0;if(a.initGains.length<n){if(a.initGains.push(h),a.initLosses.push(l),a.initGains.length===n){a.avgGain=a.initGains.reduce((p,x)=>p+x,0)/n,a.avgLoss=a.initLosses.reduce((p,x)=>p+x,0)/n,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*(n-1)+h)/n,a.avgLoss=(a.avgLoss*(n-1)+l)/n;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 uh(e){return(t,i,r,n)=>{const s=m.from(t).get(0),a=m.from(i).get(0),o=m.from(r).get(0);e.taState||(e.taState={});const c=n||`sar_${s}_${a}_${o}`;e.taState[c]||(e.taState[c]={result:NaN,maxMin:NaN,acceleration:NaN,isBelow:!1,barIndex:0});const h=e.taState[c],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),S=e.get(e.data.low,2);if(isNaN(l)||isNaN(f)||isNaN(g))return NaN;let k=!1;return h.barIndex===1&&(g>p?(h.isBelow=!0,h.maxMin=l,h.result=y):(h.isBelow=!1,h.maxMin=f,h.result=x),k=!0,h.acceleration=s),h.barIndex>=1&&(h.result=h.result+h.acceleration*(h.maxMin-h.result),h.isBelow?h.result>f&&(k=!0,h.isBelow=!1,h.result=Math.max(l,h.maxMin),h.maxMin=f,h.acceleration=s):h.result<l&&(k=!0,h.isBelow=!0,h.result=Math.min(f,h.maxMin),h.maxMin=l,h.acceleration=s),k||(h.isBelow?l>h.maxMin&&(h.maxMin=l,h.acceleration=Math.min(h.acceleration+a,o)):f<h.maxMin&&(h.maxMin=f,h.acceleration=Math.min(h.acceleration+a,o))),h.isBelow?(h.result=Math.min(h.result,y),h.barIndex>1&&(h.result=Math.min(h.result,S))):(h.result=Math.max(h.result,x),h.barIndex>1&&(h.result=Math.max(h.result,w)))),h.barIndex++,h.barIndex<=1?NaN:e.precision(h.result)}}function lh(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`sma_${n}`;e.taState[s]||(e.taState[s]={window:[],sum:0});const a=e.taState[s],o=m.from(t).get(0)||0;if(a.window.unshift(o),a.sum+=o,a.window.length<n)return NaN;if(a.window.length>n){const h=a.window.pop();a.sum-=h}const c=a.sum/n;return e.precision(c)}}function ph(e){return(t,i,r=!0,n)=>{const s=m.from(i).get(0),a=m.from(r).get(0);e.taState||(e.taState={});const o=n||`stdev_${s}_${a}`;e.taState[o]||(e.taState[o]={window:[],sum:0});const c=e.taState[o],h=m.from(t).get(0);if(h==null||isNaN(h))return NaN;if(c.window.unshift(h),c.sum+=h,c.window.length<s)return NaN;if(c.window.length>s){const x=c.window.pop();c.sum-=x}const l=c.sum/s;let f=0;for(let x=0;x<s;x++)f+=Math.pow(c.window[x]-l,2);const g=a?s:s-1,p=Math.sqrt(f/g);return e.precision(p)}}function fh(e){return(t,i,r,n,s)=>{const a=m.from(n).get(0);e.taState||(e.taState={});const o=s||`stoch_${a}`;e.taState[o]||(e.taState[o]={highWindow:[],lowWindow:[]});const c=e.taState[o],h=m.from(t).get(0),l=m.from(i).get(0),f=m.from(r).get(0);if(isNaN(h)||isNaN(l)||isNaN(f))return NaN;if(c.highWindow.unshift(l),c.lowWindow.unshift(f),c.highWindow.length<a)return NaN;c.highWindow.length>a&&(c.highWindow.pop(),c.lowWindow.pop());let g=c.highWindow[0],p=c.lowWindow[0];for(let w=1;w<a;w++)c.highWindow[w]>g&&(g=c.highWindow[w]),c.lowWindow[w]<p&&(p=c.lowWindow[w]);const x=g-p;if(x===0)return NaN;const y=100*(h-p)/x;return e.precision(y)}}function mh(e){return(t,i,r)=>{const n=m.from(t).get(0),s=m.from(i).get(0);e.taState||(e.taState={});const a=r||`supertrend_${n}_${s}`;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],c=e.get(e.data.high,0),h=e.get(e.data.low,0),l=e.get(e.data.close,0);if(isNaN(c)||isNaN(h)||isNaN(l))return[[NaN,NaN]];const f=(c+h)/2;let g;isNaN(o.prevClose)?g=c-h:g=Math.max(c-h,Math.abs(c-o.prevClose),Math.abs(h-o.prevClose)),o.atrCount++,o.atrCount<=s?(o.trWindow.push(g),o.trSum+=g,o.atrCount===s&&(o.atrValue=o.trSum/s)):o.atrValue=(o.atrValue*(s-1)+g)/s;const p=o.atrValue,x=o.prevClose;if(o.prevClose=l,isNaN(p))return[[NaN,NaN]];let y=f+n*p,w=f-n*p;const S=isNaN(o.prevLowerBand)?0:o.prevLowerBand,k=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||w>S||x<S||(w=S),isNaN(o.prevUpperBand)||y<k||x>k||(y=k);let C,A;const N=o.prevSuperTrend;return o.atrCount===s?C=1:N===o.prevUpperBand?C=l>y?-1:1:C=l<w?1:-1,A=C===-1?w:y,o.prevLowerBand=w,o.prevUpperBand=y,o.prevSuperTrend=A,o.prevDirection=C,[[e.precision(A),C]]}}function dh(e){return(t,i)=>{const r=[1,2,2,1],n=6;e.taState||(e.taState={});const s=i||"swma";e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<4)return NaN;a.window.length>4&&a.window.pop();let c=0;for(let h=0;h<4;h++)c+=r[h]*a.window[3-h];return c/=n,e.precision(c)}}function gh(e){return(t,i)=>{let r=!0;typeof t=="string"||t!==void 0&&(r=m.from(t).get(0));const n=e.get(e.data.high,0),s=e.get(e.data.low,0),a=e.get(e.data.close,1);if(isNaN(a))return r?e.precision(n-s):NaN;const o=Math.max(n-s,Math.abs(n-a),Math.abs(s-a));return e.precision(o)}}function xh(e){return(t,i,r,n)=>{const s=m.from(i).get(0),a=m.from(r).get(0);e.taState||(e.taState={});const o=n||`tsi_${s}_${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/(s+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/(s+1),ema2_abs_value:NaN,ema2_abs_count:0,ema2_abs_sum:0});const c=e.taState[o],h=m.from(t).get(0);if(isNaN(h))return NaN;const l=isNaN(c.prevSource)?NaN:h-c.prevSource;if(c.prevSource=h,isNaN(l))return NaN;const f=Math.abs(l);if(c.ema1_pc_count++,c.ema1_pc_count<=a?(c.ema1_pc_sum+=l,c.ema1_pc_count===a&&(c.ema1_pc_value=c.ema1_pc_sum/a)):c.ema1_pc_value=l*c.ema1_pc_multiplier+c.ema1_pc_value*(1-c.ema1_pc_multiplier),c.ema1_abs_count++,c.ema1_abs_count<=a?(c.ema1_abs_sum+=f,c.ema1_abs_count===a&&(c.ema1_abs_value=c.ema1_abs_sum/a)):c.ema1_abs_value=f*c.ema1_abs_multiplier+c.ema1_abs_value*(1-c.ema1_abs_multiplier),isNaN(c.ema1_pc_value)||isNaN(c.ema1_abs_value))return NaN;if(c.ema2_pc_count++,c.ema2_pc_count<=s?(c.ema2_pc_sum+=c.ema1_pc_value,c.ema2_pc_count===s&&(c.ema2_pc_value=c.ema2_pc_sum/s)):c.ema2_pc_value=c.ema1_pc_value*c.ema2_pc_multiplier+c.ema2_pc_value*(1-c.ema2_pc_multiplier),c.ema2_abs_count++,c.ema2_abs_count<=s?(c.ema2_abs_sum+=c.ema1_abs_value,c.ema2_abs_count===s&&(c.ema2_abs_value=c.ema2_abs_sum/s)):c.ema2_abs_value=c.ema1_abs_value*c.ema2_abs_multiplier+c.ema2_abs_value*(1-c.ema2_abs_multiplier),isNaN(c.ema2_pc_value)||isNaN(c.ema2_abs_value))return NaN;if(c.ema2_abs_value===0)return e.precision(0);const g=c.ema2_pc_value/c.ema2_abs_value;return e.precision(g)}}function yh(e){return(t,i,r,n)=>{e.taState||(e.taState={});const s=n||"valuewhen";e.taState[s]||(e.taState[s]={values:[]});const a=e.taState[s],o=m.from(t).get(0),c=m.from(i).get(0),h=m.from(r).get(0);if(o&&a.values.push(c),isNaN(h)||h<0)return NaN;const l=a.values.length-1-h;if(l<0)return NaN;const f=a.values[l];return typeof f=="number"?e.precision(f):f}}function wh(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`variance_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<n)return NaN;a.window.length>n&&a.window.pop();let c=0,h=0;for(let g=0;g<n;g++)c+=a.window[g],h+=a.window[g]*a.window[g];const l=c/n,f=h/n-l*l;return e.precision(f)}}function bh(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 n=e.taState[r],s=m.from(t).get(0),a=m.from(e.data.volume).get(0),o=m.from(e.data.openTime).get(0),c=new Date(o).toISOString().slice(0,10);if(n.lastSessionDate!==c&&(n.cumulativePV=0,n.cumulativeVolume=0,n.lastSessionDate=c),n.cumulativePV+=s*a,n.cumulativeVolume+=a,n.cumulativeVolume===0)return NaN;const h=n.cumulativePV/n.cumulativeVolume;return e.precision(h)}}function vh(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`vwma_${n}`;e.taState[s]||(e.taState[s]={window:[],volumeWindow:[]});const a=e.taState[s],o=m.from(t).get(0),c=e.get(e.data.volume,0);if(a.window.unshift(o),a.volumeWindow.unshift(c),a.window.length<n)return NaN;a.window.length>n&&(a.window.pop(),a.volumeWindow.pop());let h=0,l=0;for(let g=0;g<n;g++)h+=a.window[g]*a.volumeWindow[g],l+=a.volumeWindow[g];const f=h/l;return e.precision(f)}}function _h(e){return t=>{e.taState||(e.taState={});const i=t||"wad";e.taState[i]||(e.taState[i]={cumulativeSum:0});const r=e.taState[i],n=e.get(e.data.close,0),s=e.get(e.data.high,0),a=e.get(e.data.low,0),o=e.get(e.data.close,1);if(isNaN(n)||isNaN(s)||isNaN(a))return e.precision(r.cumulativeSum);let c=0;if(!isNaN(o)){const h=Math.max(s,o),l=Math.min(a,o),f=n-o;f>0?c=n-l:f<0&&(c=n-h)}return r.cumulativeSum+=c,e.precision(r.cumulativeSum)}}function Sh(e){return(t,i,r)=>{const n=m.from(i).get(0);e.taState||(e.taState={});const s=r||`wma_${n}`;e.taState[s]||(e.taState[s]={window:[]});const a=e.taState[s],o=m.from(t).get(0);if(a.window.unshift(o),a.window.length<n)return NaN;a.window.length>n&&a.window.pop();let c=0,h=0;for(let f=0;f<n;f++){const g=n-f;c+=a.window[f]*g,h+=g}const l=c/h;return e.precision(l)}}function Eh(e){return(t,i)=>{const r=m.from(t).get(0);e.taState||(e.taState={});const n=i||`wpr_${r}`;e.taState[n]||(e.taState[n]={highWindow:[],lowWindow:[]});const s=e.taState[n],a=e.get(e.data.high,0),o=e.get(e.data.low,0),c=e.get(e.data.close,0);if(isNaN(a)||isNaN(o)||isNaN(c))return NaN;if(s.highWindow.unshift(a),s.lowWindow.unshift(o),s.highWindow.length<r)return NaN;s.highWindow.length>r&&(s.highWindow.pop(),s.lowWindow.pop());let h=s.highWindow[0],l=s.lowWindow[0];for(let p=1;p<r;p++)s.highWindow[p]>h&&(h=s.highWindow[p]),s.lowWindow[p]<l&&(l=s.lowWindow[p]);const f=h-l;if(f===0)return e.precision(0);const g=(h-c)/f*-100;return e.precision(g)}}function Nh(e){return t=>{const i=e.get(e.data.close,0),r=e.get(e.data.open,0),n=e.get(e.data.high,0),s=e.get(e.data.low,0),a=e.get(e.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(n)||isNaN(s)||isNaN(a))return NaN;const o=n-s;if(o===0)return e.precision(0);const c=(i-r)/o*a;return e.precision(c)}}const Ch={accdist:mc,alma:dc,atr:gc,barssince:xc,bb:yc,bbw:wc,cci:bc,change:vc,cmo:_c,cog:Sc,correlation:Ec,cross:Nc,crossover:Cc,crossunder:kc,cum:Ic,dev:Ac,dmi:Tc,ema:Pc,falling:Rc,highest:Dc,highestbars:Mc,hma:Vc,iii:Oc,kc:Lc,kcw:Bc,linreg:Fc,lowest:jc,lowestbars:$c,macd:Wc,median:qc,mfi:Uc,mode:Kc,mom:zc,nvi:Hc,obv:Gc,param:Yc,percentile_linear_interpolation:Qc,percentile_nearest_rank:Xc,percentrank:Zc,pivothigh:eh,pivotlow:ih,pvi:rh,pvt:nh,range:sh,rising:ah,rma:oh,roc:ch,rsi:hh,sar:uh,sma:lh,stdev:ph,stoch:fh,supertrend:mh,swma:dh,tr:gh,tsi:xh,valuewhen:yh,variance:wh,vwap:bh,vwma:vh,wad:_h,wma:Sh,wpr:Eh,wvad:Nh};class kh{constructor(t){this.context=t,Object.entries(Ch).forEach(([i,r])=>{this[i]=r(t)})}accdist;alma;atr;barssince;bb;bbw;cci;change;cmo;cog;correlation;cross;crossover;crossunder;cum;dev;dmi;ema;falling;highest;highestbars;hma;iii;kc;kcw;linreg;lowest;lowestbars;macd;median;mfi;mode;mom;nvi;obv;param;percentile_linear_interpolation;percentile_nearest_rank;percentrank;pivothigh;pivotlow;pvi;pvt;range;rising;rma;roc;rsi;sar;sma;stdev;stoch;supertrend;swma;tr;tsi;valuewhen;variance;vwap;vwma;wad;wma;wpr;wvad}class Ih{constructor(t){this.context=t}logFormat(t,...i){return t.replace(/{(\d+)}/g,(r,n)=>i[n])}param(t,i=0,r){return m.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 Ah{constructor(t){this.context=t}param(t,i=0,r){return m.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,n=0){const s=String(t),a=String(i),o=String(r),c=Math.floor(Number(n))||0;if(a==="")return s;let h=0,l=0;for(;;){const f=s.indexOf(a,h);if(f===-1)return s;if(l===c)return s.substring(0,f)+o+s.substring(f+a.length);l++,h=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,n)=>i[n])}}class Th{constructor(t){this.context=t}param(t,i=0,r){return m.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 Ph=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],Rh=["series","title","style","location","color","offset","text","textcolor","editable","size","show_last","display","format","precision","force_overlay"],Dh=["series","title","colorup","colordown","offset","minheight","maxheight","editable","show_last","display","format","precision","force_overlay"],Mh={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"},Vh={series:"series",title:"string",style:"string",location:"string",color:"string",offset:"number",text:"string",textcolor:"string",editable:"boolean",size:"string",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"},Oh={series:"series",title:"string",colorup:"string",colordown:"string",offset:"number",minheight:"number",maxheight:"number",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"};class Lh{constructor(t){this.context=t}extractPlotOptions(t){const i={};for(let r in t)i[r]=m.from(t[r]).get(0);return i}plotchar(...t){this.plot(...t)}plot(...t){const i=qe(t,Ph,Mh),{series:r,title:n,...s}=i,a=this.extractPlotOptions(s);this.context.plots[n]||(this.context.plots[n]={data:[],options:a,title:n});const o=m.from(r).get(0);this.context.plots[n].data.push({time:this.context.marketData[this.context.idx].openTime,value:o,options:{color:a.color,offset:a.offset}})}plotshape(...t){const i=qe(t,Rh,Vh),{series:r,title:n,...s}=i,a=this.extractPlotOptions(s);this.context.plots[n]||(this.context.plots[n]={data:[],options:{...a,style:"shape",shape:a.style},title:n});const o=m.from(r).get(0);this.context.plots[n].data.push({time:this.context.marketData[this.context.idx].openTime,value:o,options:a?.location==="absolute"||o?{text:a.text,textcolor:a.textcolor,color:a.color,offset:a.offset,shape:a.style,location:a.location,size:a.size}:void 0})}plotarrow(...t){const i=qe(t,Dh,Oh),{series:r,title:n,...s}=i,a=m.from(r).get(0),o=this.extractPlotOptions(s);this.context.plots[n]||(this.context.plots[n]={data:[],options:{...o,style:"shape"},title:n}),this.context.plots[n].data.push({time:this.context.marketData[this.context.idx].openTime,value:a,options:typeof a=="number"&&!isNaN(a)&&a!==0?{text:void 0,textcolor:void 0,color:a>0?o.colorup:o.colordown,offset:o.offset,shape:a>0?"arrowup":"arrowdown",location:a>0?"belowbar":"abovebar",height:o.maxheight}:void 0})}}class Bh{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 m.from(t).get(i)}any(t,i,r,n,s,a,o){return this.context.pine.plot(t,{title:i,color:r,linestyle:n,linewidth:s,editable:a,display:o})}}class Re{data={open:new m([]),high:new m([]),low:new m([]),close:new m([]),volume:new m([]),hl2:new m([]),hlc3:new m([]),ohlc4:new m([]),hlcc4:new m([])};indicator;cache={};taState={};isSecondaryContext=!1;NA=NaN;lang;pine;static _deprecationWarningsShown=new Set;idx=0;params={};const={};var={};let={};result=void 0;plots={};marketData;source;tickerId;timeframe="";limit;sDate;eDate;fullContext;pineTSCode;constructor({marketData:t,source:i,tickerId:r,timeframe:n,limit:s,sDate:a,eDate:o,fullContext:c}){this.marketData=t,this.source=i,this.tickerId=r,this.timeframe=n,this.limit=s,this.sDate=a,this.eDate=o,this.fullContext=c||this;const h=new lo(this),l={na:h.na.bind(h),color:h.color,nz:h.nz.bind(h),indicator:h.indicator.bind(h),fixnan:h.fixnan.bind(h),alertcondition:h.alertcondition.bind(h),bool:h.bool.bind(h)},f=this;this.pine={input:new Po(this),ta:new kh(this),math:new cc(this),request:new fc(this),array:new Hs(this),map:new aa(this),matrix:new ao(this),syminfo:null,timeframe:new Th(this),barstate:new oo(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 Ih(this),str:new Ah(this),...l,...Rs};const g=new Lh(this),p=new Bh(this);this.bindContextObject(g,["plot","plotchar","plotshape","plotarrow"]),this.bindContextObject(p,["any","style_dashed","style_solid","style_dotted","param"],"hline")}bindContextObject(t,i,r=""){r&&!this.pine[r]&&(this.pine[r]={});const n=r?this.pine[r]:this.pine;for(const s of i)typeof t[s]=="function"?n[s]=t[s].bind(t):n[s]=t[s]}init(t,i,r=0){let n;return i instanceof m?n=i.get(0):Array.isArray(i)?Array.isArray(i[0])?n=i[0]:n=i[i.length-1+r]:n=i,t?t instanceof m?(t.data[t.data.length-1]=n,t):Array.isArray(t)?(t[t.length-1]=n,new m(t)):new m([n]):new m([n])}initVar(t,i){if(t)return t;let r;return i instanceof m?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 m([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 m?i?new m(t.data,t.offset+i):t:!Array.isArray(t)&&typeof t=="object"?t:(this.params[r]||(this.params[r]=[]),Array.isArray(t)?new m(t,i||0):(this.params[r].length===0?this.params[r].push(t):this.params[r][this.params[r].length-1]=t,new m(this.params[r],0)))}get(t,i){if(t instanceof m)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 m){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,plotshape:this.pine.plotshape,plotarrow:this.pine.plotarrow,color:this.pine.color,plot:this.pine.plot,nz:this.pine.nz}}_showDeprecationWarning(t,i){const r=`${t}->${i}`;Re._deprecationWarningsShown.has(r)||(Re._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`))}}class Lt{constructor(t,i,r,n,s,a){this.source=t,this.tickerId=i,this.timeframe=r,this.limit=n,this.sDate=s,this.eDate=a,this._readyPromise=new Promise(o=>{this.loadMarketData(t,i,r,n,s,a).then(c=>{const h=c;this.data=h;const l=h.map(N=>N.open),f=h.map(N=>N.close),g=h.map(N=>N.high),p=h.map(N=>N.low),x=h.map(N=>N.volume),y=h.map(N=>(N.high+N.low+N.close)/3),w=h.map(N=>(N.high+N.low)/2),S=h.map(N=>(N.high+N.low+N.open+N.close)/4),k=h.map(N=>(N.high+N.low+N.close+N.close)/4),C=h.map(N=>N.openTime),A=h.map(N=>N.closeTime);this.open=l,this.close=f,this.high=g,this.low=p,this.volume=x,this.hl2=w,this.hlc3=y,this.ohlc4=S,this.hlcc4=k,this.openTime=C,this.closeTime=A,t&&t.getSymbolInfo?t.getSymbolInfo(i).then(N=>{this._syminfo=N,this._ready=!0,o(!0)}).catch(N=>{console.warn("Failed to get symbol info, using default values:",N),this._ready=!0,o(!0)}):(this._ready=!0,o(!0))})})}data=[];open=[];high=[];low=[];close=[];volume=[];hl2=[];hlc3=[];ohlc4=[];hlcc4=[];openTime=[];closeTime=[];_readyPromise=null;_ready=!1;_debugSettings={ln:!1,debug:!1};_transpiledCode=null;get transpiledCode(){return this._transpiledCode}_isSecondaryContext=!1;markAsSecondary(){this._isSecondaryContext=!0}_syminfo;setDebugSettings({ln:t,debug:i}){this._debugSettings.ln=t,this._debugSettings.debug=i}async loadMarketData(t,i,r,n,s,a){return Array.isArray(t)?t:t.getMarketData(i,r,n,s,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 n=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(t,i,r,n)}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,n=!1){await this.ready(),i||(i=this.data.length);const s=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(s.result);await this._executeIterations(s,this._transpiledCode,a,a+l),a+=l,yield this._createPageContext(s,f);continue}if(!n||Array.isArray(this.source))break;const{newCandles:c,updatedLastCandle:h}=await this._updateMarketData();if(c===0&&!h){yield null;continue}this._removeLastResult(s),a=this.data.length-(c+1),s.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 Re({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 n in t.result)Array.isArray(t.result[n])?r.result[n]=t.result[n].slice(i):r.result[n]=t.result[n]}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,n=this.data[r].openTime;try{const s=await i.getMarketData(this.tickerId,this.timeframe,void 0,n,t);if(!s||s.length===0)return{newCandles:0,updatedLastCandle:!1};let a=!1,o=0;for(let c=0;c<s.length;c++){const h=s[c];h.openTime===n?(this._replaceCandle(r,h),a=!0):h.openTime>n&&(this._appendCandle(h),o++)}return{newCandles:o,updatedLastCandle:a}}catch(s){return console.error("Error updating market data:",s),{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 Re({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 m([]),r.data.open=new m([]),r.data.high=new m([]),r.data.low=new m([]),r.data.volume=new m([]),r.data.hl2=new m([]),r.data.hlc3=new m([]),r.data.ohlc4=new m([]),r.data.hlcc4=new m([]),r.data.openTime=new m([]),r.data.closeTime=new m([]),r}_transpileCode(t){return Gn.bind(this)(t,this._debugSettings)}async _executeIterations(t,i,r,n){const s=["const","var","let","params"];for(let a=r;a<n;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 c in o){t.result[c]===void 0&&(t.result[c]=[]);let h;o[c]instanceof m?h=o[c].get(0):Array.isArray(o[c])?h=o[c][o[c].length-1]:h=o[c],t.result[c].push(h)}}else Array.isArray(t.result)||(t.result=[]),t.result.push(o);for(let c of s)for(let h in t[c]){const l=t[c][h];if(l instanceof m){const f=l.get(0);l.data.push(f)}else if(Array.isArray(l)){const f=l[l.length-1];l.push(f)}}}}}const gt="https://api.binance.com/api/v3",ci="https://api.binance.us/api/v3",xt={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 Fh{cache;cacheDuration;constructor(t=5*60*1e3){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 jh{cacheManager;activeApiUrl=null;constructor(){this.cacheManager=new Fh(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(`${ci}/ping`,{signal:t.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=ci,this.activeApiUrl}catch{}return gt}async getMarketDataInterval(t,i,r,n){try{const s=xt[i.toUpperCase()];if(!s)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=[],c=r;const h=n,l=a[s];if(!l)return console.error(`Duration not defined for interval: ${s}`),[];for(;c<h;){const f=Math.min(c+1e3*l,h),g=await this.getMarketData(t,i,1e3,c,f);if(g.length===0)break;o=o.concat(g),c=g[g.length-1].closeTime+1}return o}catch(s){return console.error("Error in getMarketDataInterval:",s),[]}}async getMarketData(t,i,r,n,s){try{const a=s!==void 0,o={tickerId:t,timeframe:i,limit:r,sDate:n,eDate:s};if(a){const g=this.cacheManager.get(o);if(g)return g}const c=xt[i.toUpperCase()];if(!c)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,n,s)&&n&&s){const g=await this.getMarketDataInterval(t,i,n,s),p=r?g.slice(0,r):g;return this.cacheManager.set(o,p),p}let h=`${await this.getBaseUrl()}/klines?symbol=${t}&interval=${c}`;r&&(h+=`&limit=${Math.min(r,1e3)}`),n&&(h+=`&startTime=${n}`),s&&(h+=`&endTime=${s}`);const l=await fetch(h);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,n){if(i&&i>1e3)return!0;if(r&&n){const s=xt[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}[s];if(a)return Math.ceil((n-r)/a)>1e3}return!1}async getSymbolInfo(t){try{let i="crypto",r=await this.getBaseUrl(),n=t,s="";t.endsWith(".P")?(i="futures",n=t.replace(".P",""),r="https://fapi.binance.com/fapi/v1",s="Perpetual"):t.includes("_")&&(i="futures",n=t,r="https://dapi.binance.com/dapi/v1",s="Delivery");const a=i==="crypto"?`${r}/exchangeInfo?symbol=${n}`:`${r}/exchangeInfo`,o=await fetch(a);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const c=(await o.json()).symbols;if(!c||c.length===0)return console.error(`Symbol ${t} not found`),null;const h=i==="futures"?c.find(C=>C.symbol===n):c[0];if(!h)return console.error(`Symbol ${n} not found in exchange info`),null;const l=h.filters?.find(C=>C.filterType==="PRICE_FILTER"),f=h.filters?.find(C=>C.filterType==="LOT_SIZE"),g=l?parseFloat(l.tickSize):.01,p=f?parseFloat(f.minQty):0,x=Math.round(1/g),y=h.baseAsset,w=h.quoteAsset,S=s?` ${s}`:"",k=`${y} / ${w}${S}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:y,description:k,type:i,main_tickerid:`BINANCE:${t}`,current_contract:s,isin:"",basecurrency:y,currency:w,timezone:"Etc/UTC",country:"",mintick:g,pricescale:x,minmove:1,pointvalue:h.contractSize||1,mincontract:p,session:"24x7",volumetype:"base",expiration_date:h.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}}}const $h=lr.fileURLToPath(typeof document>"u"?new(require("url")).URL("file:"+__filename).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||new URL("pinets.min.cjs",document.baseURI).href),Wh=je.dirname($h);class qh{dataCache=new Map;exchangeInfoCache={};dataDirectory;constructor(t){if(t)this.dataDirectory=t;else{const i=je.resolve(Wh,"../../../");this.dataDirectory=je.join(i,"tests","compatibility","_data")}}getDataFileName(t,i,r,n){return r&&n?`${t}-${i}-${r}-${n}.json`:null}loadDataFromFile(t){const i=`file:${t}`;if(this.dataCache.has(i))return this.dataCache.get(i);const r=je.join(this.dataDirectory,t);if(!ke.existsSync(r))throw new Error(`Mock data file not found: ${r}`);const n=ke.readFileSync(r,"utf-8"),s=JSON.parse(n);return this.dataCache.set(i,s),s}findDataFile(t,i,r,n){if(!ke.existsSync(this.dataDirectory))return null;const s=ke.readdirSync(this.dataDirectory).filter(c=>c.endsWith(".json"));if(r&&n){const c=`${t}-${i}-${r}-${n}.json`;if(s.includes(c))return c}const a=new RegExp(`^${t}-${i}-(\\d+)-(\\d+)\\.json$`),o=s.filter(c=>a.test(c)).map(c=>{const h=c.match(a);return{file:c,startTime:parseInt(h[1]),endTime:parseInt(h[2])}}).sort((c,h)=>h.endTime-c.endTime);if(o.length===0)return null;if(r&&n){const c=o.find(h=>h.startTime<=r&&h.endTime>=n);if(c)return c.file}return o[0].file}filterData(t,i,r,n){let s=t;return(i||r)&&(s=t.filter(a=>{const o=!i||a.openTime>=i,c=!r||a.openTime<=r;return o&&c})),s.sort((a,o)=>a.openTime-o.openTime),n&&n>0&&(s=s.slice(0,n)),s}normalizeTimeframe(t){return{1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",60:"1h",120:"2h",240:"4h","4H":"4h","1D":"1d",D:"1d","1W":"1w",W:"1w","1M":"1M",M:"1M"}[t.toUpperCase()]||t.toLowerCase()}async getMarketData(t,i,r,n,s){try{const a=this.normalizeTimeframe(i),o=this.findDataFile(t,a,n,s);if(!o)return console.warn(`No mock data file found for ${t} ${a}. Searched in: ${this.dataDirectory}`),[];const c=this.loadDataFromFile(o);return this.filterData(c,n,s,r)}catch(a){return console.error("Error in MockProvider.getMarketData:",a),[]}}loadExchangeInfo(t){if(this.exchangeInfoCache[t])return this.exchangeInfoCache[t];const i=t==="spot"?"api-exchangeInfo.json":"fapi-exchangeInfo.json",r=je.join(this.dataDirectory,i);if(!ke.existsSync(r))return console.warn(`Exchange info file not found: ${r}`),null;try{const n=ke.readFileSync(r,"utf-8"),s=JSON.parse(n);return this.exchangeInfoCache[t]=s,s}catch(n){return console.error(`Error loading exchange info from ${i}:`,n),null}}async getSymbolInfo(t){try{let i="crypto",r=t,n="";t.endsWith(".P")?(i="futures",r=t.replace(".P",""),n="Perpetual"):t.includes("_")&&(i="futures",r=t,n="Delivery");const s=this.loadExchangeInfo(i==="futures"?"futures":"spot");if(!s||!s.symbols)return console.error(`Exchange info not available for ${i}`),null;const a=s.symbols.find(w=>w.symbol===r);if(!a)return console.error(`Symbol ${r} not found in ${i} exchange info`),null;const o=a.filters?.find(w=>w.filterType==="PRICE_FILTER"),c=a.filters?.find(w=>w.filterType==="LOT_SIZE"),h=o?parseFloat(o.tickSize):.01,l=c?parseFloat(c.minQty):0,f=Math.round(1/h),g=a.baseAsset,p=a.quoteAsset,x=n?` ${n}`:"",y=`${g} / ${p}${x}`;return{ticker:t,tickerid:`BINANCE:${t}`,prefix:"BINANCE",root:g,description:y,type:i,main_tickerid:`BINANCE:${t}`,current_contract:n,isin:"",basecurrency:g,currency:p,timezone:"Etc/UTC",country:"",mintick:h,pricescale:f,minmove:1,pointvalue:a.contractSize||1,mincontract:l,session:"24x7",volumetype:"base",expiration_date:a.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 MockProvider.getSymbolInfo:",i),null}}clearCache(){this.dataCache.clear(),this.exchangeInfoCache={}}setDataDirectory(t){this.dataDirectory=t,this.clearCache()}}const Uh=typeof process<"u"&&process.versions&&process.versions.node;let nt=null;if(Uh)try{nt=new qh}catch{nt=null}const Kh={Binance:new jh,...nt?{Mock:nt}:{}};exports.Context=Re;exports.PineTS=Lt;exports.Provider=Kh;
117
117
  //# sourceMappingURL=pinets.min.cjs.map