pinets 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pinets.min.browser.es.js +15 -15
- package/dist/pinets.min.browser.es.js.map +1 -1
- package/dist/pinets.min.browser.js +13 -13
- package/dist/pinets.min.browser.js.map +1 -1
- package/dist/pinets.min.cjs +13 -13
- package/dist/pinets.min.cjs.map +1 -1
- package/dist/pinets.min.es.js +15 -15
- package/dist/pinets.min.es.js.map +1 -1
- package/dist/types/Context.class.d.ts +1 -0
- package/dist/types/namespaces/matrix/methods/inv.d.ts +7 -0
- package/dist/types/namespaces/matrix/methods/pinv.d.ts +6 -0
- package/package.json +1 -1
|
@@ -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
|
-
var ws=[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,78,5,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,199,7,137,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,55,9,266,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,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],or=[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,7,25,39,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,5,57,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,24,43,261,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,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,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,208,30,2,2,2,1,2,6,3,4,10,1,225,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,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],Ss="\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-\u1ADD\u1AE0-\u1AEB\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",lr="\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-\u088F\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\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\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-\uA7DC\uA7F1-\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",Ht={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"},Gt="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",Es={5:Gt,"5module":Gt+" export import",6:Gt+" const class extends export import super"},cr=/^in(stanceof)?$/,Ns=new RegExp("["+lr+"]"),Cs=new RegExp("["+lr+Ss+"]");function ri(t,e){for(var i=65536,r=0;r<e.length;r+=2){if(i+=e[r],i>t)return!1;if(i+=e[r+1],i>=t)return!0}return!1}function Le(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&Ns.test(String.fromCharCode(t)):e===!1?!1:ri(t,or)}function it(t,e){return t<48?t===36:t<58?!0:t<65?!1:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&Cs.test(String.fromCharCode(t)):e===!1?!1:ri(t,or)||ri(t,ws)}var j=function(e,i){i===void 0&&(i={}),this.label=e,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 ve(t,e){return new j(t,{beforeExpr:!0,binop:e})}var we={beforeExpr:!0},fe={startsExpr:!0},di={};function L(t,e){return e===void 0&&(e={}),e.keyword=t,di[t]=new j(t,e)}var d={num:new j("num",fe),regexp:new j("regexp",fe),string:new j("string",fe),name:new j("name",fe),privateId:new j("privateId",fe),eof:new j("eof"),bracketL:new j("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new j("]"),braceL:new j("{",{beforeExpr:!0,startsExpr:!0}),braceR:new j("}"),parenL:new j("(",{beforeExpr:!0,startsExpr:!0}),parenR:new j(")"),comma:new j(",",we),semi:new j(";",we),colon:new j(":",we),dot:new j("."),question:new j("?",we),questionDot:new j("?."),arrow:new j("=>",we),template:new j("template"),invalidTemplate:new j("invalidTemplate"),ellipsis:new j("...",we),backQuote:new j("`",fe),dollarBraceL:new j("${",{beforeExpr:!0,startsExpr:!0}),eq:new j("=",{beforeExpr:!0,isAssign:!0}),assign:new j("_=",{beforeExpr:!0,isAssign:!0}),incDec:new j("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new j("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:ve("||",1),logicalAND:ve("&&",2),bitwiseOR:ve("|",3),bitwiseXOR:ve("^",4),bitwiseAND:ve("&",5),equality:ve("==/!=/===/!==",6),relational:ve("</>/<=/>=",7),bitShift:ve("<</>>/>>>",8),plusMin:new j("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:ve("%",10),star:ve("*",10),slash:ve("/",10),starstar:new j("**",{beforeExpr:!0}),coalesce:ve("??",1),_break:L("break"),_case:L("case",we),_catch:L("catch"),_continue:L("continue"),_debugger:L("debugger"),_default:L("default",we),_do:L("do",{isLoop:!0,beforeExpr:!0}),_else:L("else",we),_finally:L("finally"),_for:L("for",{isLoop:!0}),_function:L("function",fe),_if:L("if"),_return:L("return",we),_switch:L("switch"),_throw:L("throw",we),_try:L("try"),_var:L("var"),_const:L("const"),_while:L("while",{isLoop:!0}),_with:L("with"),_new:L("new",{beforeExpr:!0,startsExpr:!0}),_this:L("this",fe),_super:L("super",fe),_class:L("class",fe),_extends:L("extends",we),_export:L("export"),_import:L("import",fe),_null:L("null",fe),_true:L("true",fe),_false:L("false",fe),_in:L("in",{beforeExpr:!0,binop:7}),_instanceof:L("instanceof",{beforeExpr:!0,binop:7}),_typeof:L("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:L("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:L("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},ge=/\r\n?|\n|\u2028|\u2029/,Is=new RegExp(ge.source,"g");function gt(t){return t===10||t===13||t===8232||t===8233}function hr(t,e,i){i===void 0&&(i=t.length);for(var r=e;r<i;r++){var s=t.charCodeAt(r);if(gt(s))return r<i-1&&s===13&&t.charCodeAt(r+1)===10?r+2:r+1}return-1}var ur=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ne=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,pr=Object.prototype,ks=pr.hasOwnProperty,As=pr.toString,xt=Object.hasOwn||(function(t,e){return ks.call(t,e)}),Ci=Array.isArray||(function(t){return As.call(t)==="[object Array]"}),Ii=Object.create(null);function et(t){return Ii[t]||(Ii[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function Ue(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}var Ts=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,St=function(e,i){this.line=e,this.column=i};St.prototype.offset=function(e){return new St(this.line,this.column+e)};var $t=function(e,i,r){this.start=i,this.end=r,e.sourceFile!==null&&(this.source=e.sourceFile)};function fr(t,e){for(var i=1,r=0;;){var s=hr(t,r,e);if(s<0)return new St(i,e-r);++i,r=s}}var si={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},ki=!1;function Ps(t){var e={};for(var i in si)e[i]=t&&xt(t,i)?t[i]:si[i];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!ki&&typeof console=="object"&&console.warn&&(ki=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
19
|
-
Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),(!t||t.allowHashBang==null)&&(e.allowHashBang=e.ecmaVersion>=14),
|
|
20
|
-
`,r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(ge).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=d.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=e.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&&e.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?ct:lt),this.regexpState=null,this.privateNameStack=[]},Ce={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};Z.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};Ce.inFunction.get=function(){return(this.currentVarScope().flags&ct)>0};Ce.inGenerator.get=function(){return(this.currentVarScope().flags&dr)>0};Ce.inAsync.get=function(){return(this.currentVarScope().flags&mi)>0};Ce.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],i=e.flags;if(i&(ht|Et))return!1;if(i&ct)return(i&mi)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Ce.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags<)};Ce.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags;return(e&Wt)>0||this.options.allowSuperOutsideMethod};Ce.allowDirectSuper.get=function(){return(this.currentThisScope().flags&gr)>0};Ce.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Ce.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],i=e.flags;if(i&(ht|Et)||i&ct&&!(i&gi))return!0}return!1};Ce.allowUsing.get=function(){var t=this.currentScope(),e=t.flags;return!(e&xr||!this.inModule&&e<)};Ce.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ht)>0};Z.extend=function(){for(var e=[],i=arguments.length;i--;)e[i]=arguments[i];for(var r=this,s=0;s<e.length;s++)r=e[s](r);return r};Z.parse=function(e,i){return new this(i,e).parse()};Z.parseExpressionAt=function(e,i,r){var s=new this(r,e,i);return s.nextToken(),s.parseExpression()};Z.tokenizer=function(e,i){return new this(i,e)};Object.defineProperties(Z.prototype,Ce);var ue=Z.prototype,Rs=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ue.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){ne.lastIndex=t,t+=ne.exec(this.input)[0].length;var e=Rs.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){ne.lastIndex=t+e[0].length;var i=ne.exec(this.input),r=i.index+i[0].length,s=this.input.charAt(r);return s===";"||s==="}"||ge.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||s==="!"&&this.input.charAt(r+1)==="=")}t+=e[0].length,ne.lastIndex=t,t+=ne.exec(this.input)[0].length,this.input[t]===";"&&t++}};ue.eat=function(t){return this.type===t?(this.next(),!0):!1};ue.isContextual=function(t){return this.type===d.name&&this.value===t&&!this.containsEsc};ue.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};ue.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};ue.canInsertSemicolon=function(){return this.type===d.eof||this.type===d.braceR||ge.test(this.input.slice(this.lastTokEnd,this.start))};ue.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};ue.semicolon=function(){!this.eat(d.semi)&&!this.insertSemicolon()&&this.unexpected()};ue.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};ue.expect=function(t){this.eat(t)||this.unexpected()};ue.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var qt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ue.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var i=e?t.parenthesizedAssign:t.parenthesizedBind;i>-1&&this.raiseRecoverable(i,e?"Assigning to rvalue":"Parenthesized pattern")}};ue.checkExpressionErrors=function(t,e){if(!t)return!1;var i=t.shorthandAssign,r=t.doubleProto;if(!e)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")};ue.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")};ue.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var A=Z.prototype;A.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==d.eof;){var i=this.parseStatement(null,!0,e);t.body.push(i)}if(this.inModule)for(var r=0,s=Object.keys(this.undefinedExports);r<s.length;r+=1){var a=s[r];this.raiseRecoverable(this.undefinedExports[a].start,"Export '"+a+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(t,"Program")};var _i={kind:"loop"},Os={kind:"switch"};A.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;ne.lastIndex=this.pos;var e=ne.exec(this.input),i=this.pos+e[0].length,r=this.fullCharCodeAt(i);if(r===91||r===92)return!0;if(t)return!1;if(r===123)return!0;if(Le(r)){var s=i;do i+=r<=65535?1:2;while(it(r=this.fullCharCodeAt(i)));if(r===92)return!0;var a=this.input.slice(s,i);if(!cr.test(a))return!0}return!1};A.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;ne.lastIndex=this.pos;var t=ne.exec(this.input),e=this.pos+t[0].length,i;return!ge.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(it(i=this.fullCharCodeAt(e+8))||i===92))};A.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;ne.lastIndex=this.pos;var i=ne.exec(this.input),r=this.pos+i[0].length;if(ge.test(this.input.slice(this.pos,r)))return!1;if(t){var s=r+5,a;if(this.input.slice(r,s)!=="using"||s===this.input.length||it(a=this.fullCharCodeAt(s))||a===92)return!1;ne.lastIndex=s;var n=ne.exec(this.input);if(r=s+n[0].length,n&&ge.test(this.input.slice(s,r)))return!1}var o=this.fullCharCodeAt(r);if(!Le(o)&&o!==92)return!1;var l=r;do r+=o<=65535?1:2;while(it(o=this.fullCharCodeAt(r)));if(o===92)return!0;var c=this.input.slice(l,r);return!(cr.test(c)||e&&c==="of")};A.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)};A.isUsing=function(t){return this.isUsingKeyword(!1,t)};A.parseStatement=function(t,e,i){var r=this.type,s=this.startNode(),a;switch(this.isLet(t)&&(r=d._var,a="let"),r){case d._break:case d._continue:return this.parseBreakContinueStatement(s,r.keyword);case d._debugger:return this.parseDebuggerStatement(s);case d._do:return this.parseDoStatement(s);case d._for:return this.parseForStatement(s);case d._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!t);case d._class:return t&&this.unexpected(),this.parseClass(s,!0);case d._if:return this.parseIfStatement(s);case d._return:return this.parseReturnStatement(s);case d._switch:return this.parseSwitchStatement(s);case d._throw:return this.parseThrowStatement(s);case d._try:return this.parseTryStatement(s);case d._const:case d._var:return a=a||this.value,t&&a!=="var"&&this.unexpected(),this.parseVarStatement(s,a);case d._while:return this.parseWhileStatement(s);case d._with:return this.parseWithStatement(s);case d.braceL:return this.parseBlock(!0,s);case d.semi:return this.parseEmptyStatement(s);case d._export:case d._import:if(this.options.ecmaVersion>10&&r===d._import){ne.lastIndex=this.pos;var n=ne.exec(this.input),o=this.pos+n[0].length,l=this.input.charCodeAt(o);if(l===40||l===46)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||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===d._import?this.parseImport(s):this.parseExport(s,i);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!t);var c=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(c)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),c==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(s,!1,c),this.semicolon(),this.finishNode(s,"VariableDeclaration");var h=this.value,p=this.parseExpression();return r===d.name&&p.type==="Identifier"&&this.eat(d.colon)?this.parseLabeledStatement(s,h,p,t):this.parseExpressionStatement(s,p)}};A.parseBreakContinueStatement=function(t,e){var i=e==="break";this.next(),this.eat(d.semi)||this.insertSemicolon()?t.label=null:this.type!==d.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var s=this.labels[r];if((t.label==null||s.name===t.label.name)&&(s.kind!=null&&(i||s.kind==="loop")||t.label&&i))break}return r===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,i?"BreakStatement":"ContinueStatement")};A.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};A.parseDoStatement=function(t){return this.next(),this.labels.push(_i),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(d._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(d.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};A.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(_i),this.enterScope(0),this.expect(d.parenL),this.type===d.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var i=this.isLet();if(this.type===d._var||this.type===d._const||i){var r=this.startNode(),s=i?"let":this.value;return this.next(),this.parseVar(r,!0,s),this.finishNode(r,"VariableDeclaration"),this.parseForAfterInit(t,r,e)}var a=this.isContextual("let"),n=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var l=this.startNode();return this.next(),o==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(l,!0,o),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(t,l,e)}var c=this.containsEsc,h=new qt,p=this.start,u=e>-1?this.parseExprSubscripts(h,"await"):this.parseExpression(!0,h);return this.type===d._in||(n=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===d._in&&this.unexpected(e),t.await=!0):n&&this.options.ecmaVersion>=8&&(u.start===p&&!c&&u.type==="Identifier"&&u.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(t.await=!1)),a&&n&&this.raise(u.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(u,!1,h),this.checkLValPattern(u),this.parseForIn(t,u)):(this.checkExpressionErrors(h,!0),e>-1&&this.unexpected(e),this.parseFor(t,u))};A.parseForAfterInit=function(t,e,i){return(this.type===d._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&e.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===d._in?i>-1&&this.unexpected(i):t.await=i>-1),this.parseForIn(t,e)):(i>-1&&this.unexpected(i),this.parseFor(t,e))};A.parseFunctionStatement=function(t,e,i){return this.next(),this.parseFunction(t,vt|(i?0:ni),!1,e)};A.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(d._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};A.parseReturnStatement=function(t){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(d.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};A.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(d.braceL),this.labels.push(Os),this.enterScope(xr);for(var e,i=!1;this.type!==d.braceR;)if(this.type===d._case||this.type===d._default){var r=this.type===d._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),r?e.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,e.test=null),this.expect(d.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")};A.parseThrowStatement=function(t){return this.next(),ge.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var Vs=[];A.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?mr:0),this.checkLValPattern(t,e?_r:Ke),this.expect(d.parenR),t};A.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===d._catch){var e=this.startNode();this.next(),this.eat(d.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(d._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};A.parseVarStatement=function(t,e,i){return this.next(),this.parseVar(t,!1,e,i),this.semicolon(),this.finishNode(t,"VariableDeclaration")};A.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(_i),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};A.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")};A.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};A.parseLabeledStatement=function(t,e,i,r){for(var s=0,a=this.labels;s<a.length;s+=1){var n=a[s];n.name===e&&this.raise(i.start,"Label '"+e+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===d._switch?"switch":null,l=this.labels.length-1;l>=0;l--){var c=this.labels[l];if(c.statementStart===t.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:e,kind:o,statementStart:this.start}),t.body=this.parseStatement(r?r.indexOf("label")===-1?r+"label":r:"label"),this.labels.pop(),t.label=i,this.finishNode(t,"LabeledStatement")};A.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};A.parseBlock=function(t,e,i){for(t===void 0&&(t=!0),e===void 0&&(e=this.startNode()),e.body=[],this.expect(d.braceL),t&&this.enterScope(0);this.type!==d.braceR;){var r=this.parseStatement(null);e.body.push(r)}return i&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};A.parseFor=function(t,e){return t.init=e,this.expect(d.semi),t.test=this.type===d.semi?null:this.parseExpression(),this.expect(d.semi),t.update=this.type===d.parenR?null:this.parseExpression(),this.expect(d.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};A.parseForIn=function(t,e){var i=this.type===d._in;return this.next(),e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(e.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(d.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,i?"ForInStatement":"ForOfStatement")};A.parseVar=function(t,e,i,r){for(t.declarations=[],t.kind=i;;){var s=this.startNode();if(this.parseVarId(s,i),this.eat(d.eq)?s.init=this.parseMaybeAssign(e):!r&&i==="const"&&!(this.type===d._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&(i==="using"||i==="await using")&&this.options.ecmaVersion>=17&&this.type!==d._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+i+" declaration"):!r&&s.id.type!=="Identifier"&&!(e&&(this.type===d._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):s.init=null,t.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(d.comma))break}return t};A.parseVarId=function(t,e){t.id=e==="using"||e==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?yi:Ke,!1)};var vt=1,ni=2,vr=4;A.parseFunction=function(t,e,i,r,s){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===d.star&&e&ni&&this.unexpected(),t.generator=this.eat(d.star)),this.options.ecmaVersion>=8&&(t.async=!!r),e&vt&&(t.id=e&vr&&this.type!==d.name?null:this.parseIdent(),t.id&&!(e&ni)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?yi:Ke:yr));var a=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(xi(t.async,t.generator)),e&vt||(t.id=this.type===d.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,i,!1,s),this.yieldPos=a,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(t,e&vt?"FunctionDeclaration":"FunctionExpression")};A.parseFunctionParams=function(t){this.expect(d.parenL),t.params=this.parseBindingList(d.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};A.parseClass=function(t,e){this.next();var i=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var r=this.enterClassBody(),s=this.startNode(),a=!1;for(s.body=[],this.expect(d.braceL);this.type!==d.braceR;){var n=this.parseClassElement(t.superClass!==null);n&&(s.body.push(n),n.type==="MethodDefinition"&&n.kind==="constructor"?(a&&this.raiseRecoverable(n.start,"Duplicate constructor in the same class"),a=!0):n.key&&n.key.type==="PrivateIdentifier"&&Ms(r,n)&&this.raiseRecoverable(n.key.start,"Identifier '#"+n.key.name+"' has already been declared"))}return this.strict=i,this.next(),t.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};A.parseClassElement=function(t){if(this.eat(d.semi))return null;var e=this.options.ecmaVersion,i=this.startNode(),r="",s=!1,a=!1,n="method",o=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(d.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===d.star?o=!0:r="static"}if(i.static=o,!r&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===d.star)&&!this.canInsertSemicolon()?a=!0:r="async"),!r&&(e>=9||!a)&&this.eat(d.star)&&(s=!0),!r&&!a&&!s){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?n=l:r=l)}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),e<13||this.type===d.parenL||n!=="method"||s||a){var c=!i.static&&Dt(i,"constructor"),h=c&&t;c&&n!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=c?"constructor":n,this.parseClassMethod(i,s,a,h)}else this.parseClassField(i);return i};A.isClassElementNameStart=function(){return this.type===d.name||this.type===d.privateId||this.type===d.num||this.type===d.string||this.type===d.bracketL||this.type.keyword};A.parseClassElementName=function(t){this.type===d.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)};A.parseClassMethod=function(t,e,i,r){var s=t.key;t.kind==="constructor"?(e&&this.raise(s.start,"Constructor can't be a generator"),i&&this.raise(s.start,"Constructor can't be an async method")):t.static&&Dt(t,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var a=t.value=this.parseMethod(e,i,r);return t.kind==="get"&&a.params.length!==0&&this.raiseRecoverable(a.start,"getter should have no params"),t.kind==="set"&&a.params.length!==1&&this.raiseRecoverable(a.start,"setter should have exactly one param"),t.kind==="set"&&a.params[0].type==="RestElement"&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")};A.parseClassField=function(t){return Dt(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&Dt(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(d.eq)?(this.enterScope(Et|Wt),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")};A.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(ht|Wt);this.type!==d.braceR;){var i=this.parseStatement(null);t.body.push(i)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")};A.parseClassId=function(t,e){this.type===d.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,Ke,!1)):(e===!0&&this.unexpected(),t.id=null)};A.parseClassSuper=function(t){t.superClass=this.eat(d._extends)?this.parseExprSubscripts(null,!1):null};A.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};A.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,i=t.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,s=r===0?null:this.privateNameStack[r-1],a=0;a<i.length;++a){var n=i[a];xt(e,n.name)||(s?s.used.push(n):this.raiseRecoverable(n.start,"Private field '#"+n.name+"' must be declared in an enclosing class"))}};function Ms(t,e){var i=e.key.name,r=t[i],s="true";return e.type==="MethodDefinition"&&(e.kind==="get"||e.kind==="set")&&(s=(e.static?"s":"i")+e.kind),r==="iget"&&s==="iset"||r==="iset"&&s==="iget"||r==="sget"&&s==="sset"||r==="sset"&&s==="sget"?(t[i]="true",!1):r?!0:(t[i]=s,!1)}function Dt(t,e){var i=t.computed,r=t.key;return!i&&(r.type==="Identifier"&&r.name===e||r.type==="Literal"&&r.value===e)}A.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==d.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")};A.parseExport=function(t,e){if(this.next(),this.eat(d.star))return this.parseExportAllDeclaration(t,e);if(this.eat(d._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),t.declaration.type==="VariableDeclaration"?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==d.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var i=0,r=t.specifiers;i<r.length;i+=1){var s=r[i];this.checkUnreserved(s.local),this.checkLocalExport(s.local),s.local.type==="Literal"&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")};A.parseExportDeclaration=function(t){return this.parseStatement(null)};A.parseExportDefaultDeclaration=function(){var t;if(this.type===d._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,vt|vr,!1,t)}else if(this.type===d._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};A.checkExport=function(t,e,i){t&&(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),xt(t,e)&&this.raiseRecoverable(i,"Duplicate export '"+e+"'"),t[e]=!0)};A.checkPatternExport=function(t,e){var i=e.type;if(i==="Identifier")this.checkExport(t,e,e.start);else if(i==="ObjectPattern")for(var r=0,s=e.properties;r<s.length;r+=1){var a=s[r];this.checkPatternExport(t,a)}else if(i==="ArrayPattern")for(var n=0,o=e.elements;n<o.length;n+=1){var l=o[n];l&&this.checkPatternExport(t,l)}else i==="Property"?this.checkPatternExport(t,e.value):i==="AssignmentPattern"?this.checkPatternExport(t,e.left):i==="RestElement"&&this.checkPatternExport(t,e.argument)};A.checkVariableExport=function(t,e){if(t)for(var i=0,r=e;i<r.length;i+=1){var s=r[i];this.checkPatternExport(t,s.id)}};A.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};A.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")};A.parseExportSpecifiers=function(t){var e=[],i=!0;for(this.expect(d.braceL);!this.eat(d.braceR);){if(i)i=!1;else if(this.expect(d.comma),this.afterTrailingComma(d.braceR))break;e.push(this.parseExportSpecifier(t))}return e};A.parseImport=function(t){return this.next(),this.type===d.string?(t.specifiers=Vs,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===d.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};A.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,Ke),this.finishNode(t,"ImportSpecifier")};A.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,Ke),this.finishNode(t,"ImportDefaultSpecifier")};A.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,Ke),this.finishNode(t,"ImportNamespaceSpecifier")};A.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===d.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(d.comma)))return t;if(this.type===d.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(d.braceL);!this.eat(d.braceR);){if(e)e=!1;else if(this.expect(d.comma),this.afterTrailingComma(d.braceR))break;t.push(this.parseImportSpecifier())}return t};A.parseWithClause=function(){var t=[];if(!this.eat(d._with))return t;this.expect(d.braceL);for(var e={},i=!0;!this.eat(d.braceR);){if(i)i=!1;else if(this.expect(d.comma),this.afterTrailingComma(d.braceR))break;var r=this.parseImportAttribute(),s=r.key.type==="Identifier"?r.key.name:r.key.value;xt(e,s)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+s+"'"),e[s]=!0,t.push(r)}return t};A.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===d.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(d.colon),this.type!==d.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")};A.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===d.string){var t=this.parseLiteral(this.value);return Ts.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)};A.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)};A.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&(this.input[t.start]==='"'||this.input[t.start]==="'")};var Ie=Z.prototype;Ie.toAssignable=function(t,e,i){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&t.name==="await"&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var r=0,s=t.properties;r<s.length;r+=1){var a=s[r];this.toAssignable(a,e),a.type==="RestElement"&&(a.argument.type==="ArrayPattern"||a.argument.type==="ObjectPattern")&&this.raise(a.argument.start,"Unexpected token")}break;case"Property":t.kind!=="init"&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),t.argument.type==="AssignmentPattern"&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":t.operator!=="="&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,i);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return t};Ie.toAssignableList=function(t,e){for(var i=t.length,r=0;r<i;r++){var s=t[r];s&&this.toAssignable(s,e)}if(i){var a=t[i-1];this.options.ecmaVersion===6&&e&&a&&a.type==="RestElement"&&a.argument.type!=="Identifier"&&this.unexpected(a.argument.start)}return t};Ie.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};Ie.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==d.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};Ie.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case d.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(d.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case d.braceL:return this.parseObj(!0)}return this.parseIdent()};Ie.parseBindingList=function(t,e,i,r){for(var s=[],a=!0;!this.eat(t);)if(a?a=!1:this.expect(d.comma),e&&this.type===d.comma)s.push(null);else{if(i&&this.afterTrailingComma(t))break;if(this.type===d.ellipsis){var n=this.parseRestBinding();this.parseBindingListItem(n),s.push(n),this.type===d.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else s.push(this.parseAssignableListItem(r))}return s};Ie.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};Ie.parseBindingListItem=function(t){return t};Ie.parseMaybeDefault=function(t,e,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(d.eq))return i;var r=this.startNodeAt(t,e);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};Ie.checkLValSimple=function(t,e,i){e===void 0&&(e=Pt);var r=e!==Pt;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(r?"Binding ":"Assigning to ")+t.name+" in strict mode"),r&&(e===Ke&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),i&&(xt(i,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),i[t.name]=!0),e!==br&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":r&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,i);default:this.raise(t.start,(r?"Binding":"Assigning to")+" rvalue")}};Ie.checkLValPattern=function(t,e,i){switch(e===void 0&&(e=Pt),t.type){case"ObjectPattern":for(var r=0,s=t.properties;r<s.length;r+=1){var a=s[r];this.checkLValInnerPattern(a,e,i)}break;case"ArrayPattern":for(var n=0,o=t.elements;n<o.length;n+=1){var l=o[n];l&&this.checkLValInnerPattern(l,e,i)}break;default:this.checkLValSimple(t,e,i)}};Ie.checkLValInnerPattern=function(t,e,i){switch(e===void 0&&(e=Pt),t.type){case"Property":this.checkLValInnerPattern(t.value,e,i);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,i);break;case"RestElement":this.checkLValPattern(t.argument,e,i);break;default:this.checkLValPattern(t,e,i)}};var Pe=function(e,i,r,s,a){this.token=e,this.isExpr=!!i,this.preserveSpace=!!r,this.override=s,this.generator=!!a},z={b_stat:new Pe("{",!1),b_expr:new Pe("{",!0),b_tmpl:new Pe("${",!1),p_stat:new Pe("(",!1),p_expr:new Pe("(",!0),q_tmpl:new Pe("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new Pe("function",!1),f_expr:new Pe("function",!0),f_expr_gen:new Pe("function",!0,!1,null,!0),f_gen:new Pe("function",!1,!1,null,!0)},yt=Z.prototype;yt.initialContext=function(){return[z.b_stat]};yt.curContext=function(){return this.context[this.context.length-1]};yt.braceIsBlock=function(t){var e=this.curContext();return e===z.f_expr||e===z.f_stat?!0:t===d.colon&&(e===z.b_stat||e===z.b_expr)?!e.isExpr:t===d._return||t===d.name&&this.exprAllowed?ge.test(this.input.slice(this.lastTokEnd,this.start)):t===d._else||t===d.semi||t===d.eof||t===d.parenR||t===d.arrow?!0:t===d.braceL?e===z.b_stat:t===d._var||t===d._const||t===d.name?!1:!this.exprAllowed};yt.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if(e.token==="function")return e.generator}return!1};yt.updateContext=function(t){var e,i=this.type;i.keyword&&t===d.dot?this.exprAllowed=!1:(e=i.updateContext)?e.call(this,t):this.exprAllowed=i.beforeExpr};yt.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)};d.parenR.updateContext=d.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var t=this.context.pop();t===z.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};d.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?z.b_stat:z.b_expr),this.exprAllowed=!0};d.dollarBraceL.updateContext=function(){this.context.push(z.b_tmpl),this.exprAllowed=!0};d.parenL.updateContext=function(t){var e=t===d._if||t===d._for||t===d._with||t===d._while;this.context.push(e?z.p_stat:z.p_expr),this.exprAllowed=!0};d.incDec.updateContext=function(){};d._function.updateContext=d._class.updateContext=function(t){t.beforeExpr&&t!==d._else&&!(t===d.semi&&this.curContext()!==z.p_stat)&&!(t===d._return&&ge.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===d.colon||t===d.braceL)&&this.curContext()===z.b_stat)?this.context.push(z.f_expr):this.context.push(z.f_stat),this.exprAllowed=!1};d.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};d.backQuote.updateContext=function(){this.curContext()===z.q_tmpl?this.context.pop():this.context.push(z.q_tmpl),this.exprAllowed=!1};d.star.updateContext=function(t){if(t===d._function){var e=this.context.length-1;this.context[e]===z.f_expr?this.context[e]=z.f_expr_gen:this.context[e]=z.f_gen}this.exprAllowed=!0};d.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==d.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var P=Z.prototype;P.checkPropClash=function(t,e,i){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var r=t.key,s;switch(r.type){case"Identifier":s=r.name;break;case"Literal":s=String(r.value);break;default:return}var a=t.kind;if(this.options.ecmaVersion>=6){s==="__proto__"&&a==="init"&&(e.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),e.proto=!0);return}s="$"+s;var n=e[s];if(n){var o;a==="init"?o=this.strict&&n.init||n.get||n.set:o=n.init||n[a],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else n=e[s]={init:!1,get:!1,set:!1};n[a]=!0}};P.parseExpression=function(t,e){var i=this.start,r=this.startLoc,s=this.parseMaybeAssign(t,e);if(this.type===d.comma){var a=this.startNodeAt(i,r);for(a.expressions=[s];this.eat(d.comma);)a.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(a,"SequenceExpression")}return s};P.parseMaybeAssign=function(t,e,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var r=!1,s=-1,a=-1,n=-1;e?(s=e.parenthesizedAssign,a=e.trailingComma,n=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new qt,r=!0);var o=this.start,l=this.startLoc;(this.type===d.parenL||this.type===d.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=t==="await");var c=this.parseMaybeConditional(t,e);if(i&&(c=i.call(this,c,o,l)),this.type.isAssign){var h=this.startNodeAt(o,l);return h.operator=this.value,this.type===d.eq&&(c=this.toAssignable(c,!1,e)),r||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=c.start&&(e.shorthandAssign=-1),this.type===d.eq?this.checkLValPattern(c):this.checkLValSimple(c),h.left=c,this.next(),h.right=this.parseMaybeAssign(t),n>-1&&(e.doubleProto=n),this.finishNode(h,"AssignmentExpression")}else r&&this.checkExpressionErrors(e,!0);return s>-1&&(e.parenthesizedAssign=s),a>-1&&(e.trailingComma=a),c};P.parseMaybeConditional=function(t,e){var i=this.start,r=this.startLoc,s=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return s;if(this.eat(d.question)){var a=this.startNodeAt(i,r);return a.test=s,a.consequent=this.parseMaybeAssign(),this.expect(d.colon),a.alternate=this.parseMaybeAssign(t),this.finishNode(a,"ConditionalExpression")}return s};P.parseExprOps=function(t,e){var i=this.start,r=this.startLoc,s=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||s.start===i&&s.type==="ArrowFunctionExpression"?s:this.parseExprOp(s,i,r,-1,t)};P.parseExprOp=function(t,e,i,r,s){var a=this.type.binop;if(a!=null&&(!s||this.type!==d._in)&&a>r){var n=this.type===d.logicalOR||this.type===d.logicalAND,o=this.type===d.coalesce;o&&(a=d.logicalAND.binop);var l=this.value;this.next();var c=this.start,h=this.startLoc,p=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),c,h,a,s),u=this.buildBinary(e,i,t,p,l,n||o);return(n&&this.type===d.coalesce||o&&(this.type===d.logicalOR||this.type===d.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(u,e,i,r,s)}return t};P.buildBinary=function(t,e,i,r,s,a){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var n=this.startNodeAt(t,e);return n.left=i,n.operator=s,n.right=r,this.finishNode(n,a?"LogicalExpression":"BinaryExpression")};P.parseMaybeUnary=function(t,e,i,r){var s=this.start,a=this.startLoc,n;if(this.isContextual("await")&&this.canAwait)n=this.parseAwait(r),e=!0;else if(this.type.prefix){var o=this.startNode(),l=this.type===d.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,l,r),this.checkExpressionErrors(t,!0),l?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&wr(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&ai(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):e=!0,n=this.finishNode(o,l?"UpdateExpression":"UnaryExpression")}else if(!e&&this.type===d.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),n=this.parsePrivateIdent(),this.type!==d._in&&this.unexpected();else{if(n=this.parseExprSubscripts(t,r),this.checkExpressionErrors(t))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var c=this.startNodeAt(s,a);c.operator=this.value,c.prefix=!1,c.argument=n,this.checkLValSimple(n),this.next(),n=this.finishNode(c,"UpdateExpression")}}if(!i&&this.eat(d.starstar))if(e)this.unexpected(this.lastTokStart);else return this.buildBinary(s,a,n,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return n};function wr(t){return t.type==="Identifier"||t.type==="ParenthesizedExpression"&&wr(t.expression)}function ai(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&ai(t.expression)||t.type==="ParenthesizedExpression"&&ai(t.expression)}P.parseExprSubscripts=function(t,e){var i=this.start,r=this.startLoc,s=this.parseExprAtom(t,e);if(s.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return s;var a=this.parseSubscripts(s,i,r,!1,e);return t&&a.type==="MemberExpression"&&(t.parenthesizedAssign>=a.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=a.start&&(t.parenthesizedBind=-1),t.trailingComma>=a.start&&(t.trailingComma=-1)),a};P.parseSubscripts=function(t,e,i,r,s){for(var a=this.options.ecmaVersion>=8&&t.type==="Identifier"&&t.name==="async"&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,n=!1;;){var o=this.parseSubscript(t,e,i,r,a,n,s);if(o.optional&&(n=!0),o===t||o.type==="ArrowFunctionExpression"){if(n){var l=this.startNodeAt(e,i);l.expression=o,o=this.finishNode(l,"ChainExpression")}return o}t=o}};P.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(d.arrow)};P.parseSubscriptAsyncArrow=function(t,e,i,r){return this.parseArrowExpression(this.startNodeAt(t,e),i,!0,r)};P.parseSubscript=function(t,e,i,r,s,a,n){var o=this.options.ecmaVersion>=11,l=o&&this.eat(d.questionDot);r&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var c=this.eat(d.bracketL);if(c||l&&this.type!==d.parenL&&this.type!==d.backQuote||this.eat(d.dot)){var h=this.startNodeAt(e,i);h.object=t,c?(h.property=this.parseExpression(),this.expect(d.bracketR)):this.type===d.privateId&&t.type!=="Super"?h.property=this.parsePrivateIdent():h.property=this.parseIdent(this.options.allowReserved!=="never"),h.computed=!!c,o&&(h.optional=l),t=this.finishNode(h,"MemberExpression")}else if(!r&&this.eat(d.parenL)){var p=new qt,u=this.yieldPos,f=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var y=this.parseExprList(d.parenR,this.options.ecmaVersion>=8,!1,p);if(s&&!l&&this.shouldParseAsyncArrow())return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=u,this.awaitPos=f,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(e,i,y,n);this.checkExpressionErrors(p,!0),this.yieldPos=u||this.yieldPos,this.awaitPos=f||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var _=this.startNodeAt(e,i);_.callee=t,_.arguments=y,o&&(_.optional=l),t=this.finishNode(_,"CallExpression")}else if(this.type===d.backQuote){(l||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var b=this.startNodeAt(e,i);b.tag=t,b.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(b,"TaggedTemplateExpression")}return t};P.parseExprAtom=function(t,e,i){this.type===d.slash&&this.readRegexp();var r,s=this.potentialArrowAt===this.start;switch(this.type){case d._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===d.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==d.dot&&this.type!==d.bracketL&&this.type!==d.parenL&&this.unexpected(),this.finishNode(r,"Super");case d._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case d.name:var a=this.start,n=this.startLoc,o=this.containsEsc,l=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&l.name==="async"&&!this.canInsertSemicolon()&&this.eat(d._function))return this.overrideContext(z.f_expr),this.parseFunction(this.startNodeAt(a,n),0,!1,!0,e);if(s&&!this.canInsertSemicolon()){if(this.eat(d.arrow))return this.parseArrowExpression(this.startNodeAt(a,n),[l],!1,e);if(this.options.ecmaVersion>=8&&l.name==="async"&&this.type===d.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return l=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(d.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,n),[l],!0,e)}return l;case d.regexp:var c=this.value;return r=this.parseLiteral(c.value),r.regex={pattern:c.pattern,flags:c.flags},r;case d.num:case d.string:return this.parseLiteral(this.value);case d._null:case d._true:case d._false:return r=this.startNode(),r.value=this.type===d._null?null:this.type===d._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case d.parenL:var h=this.start,p=this.parseParenAndDistinguishExpression(s,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(p)&&(t.parenthesizedAssign=h),t.parenthesizedBind<0&&(t.parenthesizedBind=h)),p;case d.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(d.bracketR,!0,!0,t),this.finishNode(r,"ArrayExpression");case d.braceL:return this.overrideContext(z.b_expr),this.parseObj(!1,t);case d._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case d._class:return this.parseClass(this.startNode(),!1);case d._new:return this.parseNew();case d.backQuote:return this.parseTemplate();case d._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};P.parseExprAtomDefault=function(){this.unexpected()};P.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===d.parenL&&!t)return this.parseDynamicImport(e);if(this.type===d.dot){var i=this.startNodeAt(e.start,e.loc&&e.loc.start);return i.name="import",e.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(e)}else this.unexpected()};P.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(d.parenR)?t.options=null:(this.expect(d.comma),this.afterTrailingComma(d.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(d.parenR)||(this.expect(d.comma),this.afterTrailingComma(d.parenR)||this.unexpected())));else if(!this.eat(d.parenR)){var e=this.start;this.eat(d.comma)&&this.eat(d.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};P.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="meta"&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")};P.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),e.raw.charCodeAt(e.raw.length-1)===110&&(e.bigint=e.value!=null?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")};P.parseParenExpression=function(){this.expect(d.parenL);var t=this.parseExpression();return this.expect(d.parenR),t};P.shouldParseArrow=function(t){return!this.canInsertSemicolon()};P.parseParenAndDistinguishExpression=function(t,e){var i=this.start,r=this.startLoc,s,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var n=this.start,o=this.startLoc,l=[],c=!0,h=!1,p=new qt,u=this.yieldPos,f=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==d.parenR;)if(c?c=!1:this.expect(d.comma),a&&this.afterTrailingComma(d.parenR,!0)){h=!0;break}else if(this.type===d.ellipsis){m=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===d.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else l.push(this.parseMaybeAssign(!1,p,this.parseParenItem));var y=this.lastTokEnd,_=this.lastTokEndLoc;if(this.expect(d.parenR),t&&this.shouldParseArrow(l)&&this.eat(d.arrow))return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=u,this.awaitPos=f,this.parseParenArrowList(i,r,l,e);(!l.length||h)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(p,!0),this.yieldPos=u||this.yieldPos,this.awaitPos=f||this.awaitPos,l.length>1?(s=this.startNodeAt(n,o),s.expressions=l,this.finishNodeAt(s,"SequenceExpression",y,_)):s=l[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var b=this.startNodeAt(i,r);return b.expression=s,this.finishNode(b,"ParenthesizedExpression")}else return s};P.parseParenItem=function(t){return t};P.parseParenArrowList=function(t,e,i,r){return this.parseArrowExpression(this.startNodeAt(t,e),i,!1,r)};var Ls=[];P.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===d.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var i=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="target"&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var r=this.start,s=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,s,!0,!1),this.eat(d.parenL)?t.arguments=this.parseExprList(d.parenR,this.options.ecmaVersion>=8,!1):t.arguments=Ls,this.finishNode(t,"NewExpression")};P.parseTemplateElement=function(t){var e=t.isTagged,i=this.startNode();return this.type===d.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
|
|
18
|
+
var Ss=[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,78,5,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,199,7,137,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,55,9,266,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,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],cr=[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,7,25,39,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,5,57,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,24,43,261,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,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,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,208,30,2,2,2,1,2,6,3,4,10,1,225,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,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],Es="\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-\u1ADD\u1AE0-\u1AEB\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",hr="\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-\u088F\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\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\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-\uA7DC\uA7F1-\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",Yt={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"},Qt="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",Ns={5:Qt,"5module":Qt+" export import",6:Qt+" const class extends export import super"},ur=/^in(stanceof)?$/,Cs=new RegExp("["+hr+"]"),Is=new RegExp("["+hr+Es+"]");function ni(t,e){for(var i=65536,r=0;r<e.length;r+=2){if(i+=e[r],i>t)return!1;if(i+=e[r+1],i>=t)return!0}return!1}function Le(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&Cs.test(String.fromCharCode(t)):e===!1?!1:ni(t,cr)}function it(t,e){return t<48?t===36:t<58?!0:t<65?!1:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&Is.test(String.fromCharCode(t)):e===!1?!1:ni(t,cr)||ni(t,Ss)}var j=function(e,i){i===void 0&&(i={}),this.label=e,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 ve(t,e){return new j(t,{beforeExpr:!0,binop:e})}var we={beforeExpr:!0},fe={startsExpr:!0},gi={};function L(t,e){return e===void 0&&(e={}),e.keyword=t,gi[t]=new j(t,e)}var d={num:new j("num",fe),regexp:new j("regexp",fe),string:new j("string",fe),name:new j("name",fe),privateId:new j("privateId",fe),eof:new j("eof"),bracketL:new j("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new j("]"),braceL:new j("{",{beforeExpr:!0,startsExpr:!0}),braceR:new j("}"),parenL:new j("(",{beforeExpr:!0,startsExpr:!0}),parenR:new j(")"),comma:new j(",",we),semi:new j(";",we),colon:new j(":",we),dot:new j("."),question:new j("?",we),questionDot:new j("?."),arrow:new j("=>",we),template:new j("template"),invalidTemplate:new j("invalidTemplate"),ellipsis:new j("...",we),backQuote:new j("`",fe),dollarBraceL:new j("${",{beforeExpr:!0,startsExpr:!0}),eq:new j("=",{beforeExpr:!0,isAssign:!0}),assign:new j("_=",{beforeExpr:!0,isAssign:!0}),incDec:new j("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new j("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:ve("||",1),logicalAND:ve("&&",2),bitwiseOR:ve("|",3),bitwiseXOR:ve("^",4),bitwiseAND:ve("&",5),equality:ve("==/!=/===/!==",6),relational:ve("</>/<=/>=",7),bitShift:ve("<</>>/>>>",8),plusMin:new j("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:ve("%",10),star:ve("*",10),slash:ve("/",10),starstar:new j("**",{beforeExpr:!0}),coalesce:ve("??",1),_break:L("break"),_case:L("case",we),_catch:L("catch"),_continue:L("continue"),_debugger:L("debugger"),_default:L("default",we),_do:L("do",{isLoop:!0,beforeExpr:!0}),_else:L("else",we),_finally:L("finally"),_for:L("for",{isLoop:!0}),_function:L("function",fe),_if:L("if"),_return:L("return",we),_switch:L("switch"),_throw:L("throw",we),_try:L("try"),_var:L("var"),_const:L("const"),_while:L("while",{isLoop:!0}),_with:L("with"),_new:L("new",{beforeExpr:!0,startsExpr:!0}),_this:L("this",fe),_super:L("super",fe),_class:L("class",fe),_extends:L("extends",we),_export:L("export"),_import:L("import",fe),_null:L("null",fe),_true:L("true",fe),_false:L("false",fe),_in:L("in",{beforeExpr:!0,binop:7}),_instanceof:L("instanceof",{beforeExpr:!0,binop:7}),_typeof:L("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:L("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:L("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},ge=/\r\n?|\n|\u2028|\u2029/,ks=new RegExp(ge.source,"g");function gt(t){return t===10||t===13||t===8232||t===8233}function pr(t,e,i){i===void 0&&(i=t.length);for(var r=e;r<i;r++){var s=t.charCodeAt(r);if(gt(s))return r<i-1&&s===13&&t.charCodeAt(r+1)===10?r+2:r+1}return-1}var fr=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ne=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,dr=Object.prototype,As=dr.hasOwnProperty,Ts=dr.toString,xt=Object.hasOwn||(function(t,e){return As.call(t,e)}),ki=Array.isArray||(function(t){return Ts.call(t)==="[object Array]"}),Ai=Object.create(null);function et(t){return Ai[t]||(Ai[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function Ue(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}var Ps=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,St=function(e,i){this.line=e,this.column=i};St.prototype.offset=function(e){return new St(this.line,this.column+e)};var Ut=function(e,i,r){this.start=i,this.end=r,e.sourceFile!==null&&(this.source=e.sourceFile)};function mr(t,e){for(var i=1,r=0;;){var s=pr(t,r,e);if(s<0)return new St(i,e-r);++i,r=s}}var ai={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},Ti=!1;function Ds(t){var e={};for(var i in ai)e[i]=t&&xt(t,i)?t[i]:ai[i];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!Ti&&typeof console=="object"&&console.warn&&(Ti=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
19
|
+
Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),(!t||t.allowHashBang==null)&&(e.allowHashBang=e.ecmaVersion>=14),ki(e.onToken)){var r=e.onToken;e.onToken=function(s){return r.push(s)}}if(ki(e.onComment)&&(e.onComment=Rs(e,e.onComment)),e.sourceType==="commonjs"&&e.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return e}function Rs(t,e){return function(i,r,s,a,n,o){var l={type:i?"Block":"Line",value:r,start:s,end:a};t.locations&&(l.loc=new Ut(this,n,o)),t.ranges&&(l.range=[s,a]),e.push(l)}}var lt=1,ct=2,xi=4,gr=8,yi=16,xr=32,qt=64,yr=128,ht=256,Et=512,_r=1024,Kt=lt|ct|ht;function _i(t,e){return ct|(t?xi:0)|(e?gr:0)}var Rt=0,bi=1,Ke=2,br=3,vr=4,wr=5,Z=function(e,i,r){this.options=e=Ds(e),this.sourceFile=e.sourceFile,this.keywords=et(Ns[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var s="";e.allowReserved!==!0&&(s=Yt[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType==="module"&&(s+=" await")),this.reservedWords=et(s);var a=(s?s+" ":"")+Yt.strict;this.reservedWordsStrict=et(a),this.reservedWordsStrictBind=et(a+" "+Yt.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(ge).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=d.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=e.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&&e.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?ct:lt),this.regexpState=null,this.privateNameStack=[]},Ce={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};Z.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};Ce.inFunction.get=function(){return(this.currentVarScope().flags&ct)>0};Ce.inGenerator.get=function(){return(this.currentVarScope().flags&gr)>0};Ce.inAsync.get=function(){return(this.currentVarScope().flags&xi)>0};Ce.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],i=e.flags;if(i&(ht|Et))return!1;if(i&ct)return(i&xi)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Ce.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags<)};Ce.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags;return(e&qt)>0||this.options.allowSuperOutsideMethod};Ce.allowDirectSuper.get=function(){return(this.currentThisScope().flags&yr)>0};Ce.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Ce.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],i=e.flags;if(i&(ht|Et)||i&ct&&!(i&yi))return!0}return!1};Ce.allowUsing.get=function(){var t=this.currentScope(),e=t.flags;return!(e&_r||!this.inModule&&e<)};Ce.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ht)>0};Z.extend=function(){for(var e=[],i=arguments.length;i--;)e[i]=arguments[i];for(var r=this,s=0;s<e.length;s++)r=e[s](r);return r};Z.parse=function(e,i){return new this(i,e).parse()};Z.parseExpressionAt=function(e,i,r){var s=new this(r,e,i);return s.nextToken(),s.parseExpression()};Z.tokenizer=function(e,i){return new this(i,e)};Object.defineProperties(Z.prototype,Ce);var ue=Z.prototype,Os=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ue.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){ne.lastIndex=t,t+=ne.exec(this.input)[0].length;var e=Os.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){ne.lastIndex=t+e[0].length;var i=ne.exec(this.input),r=i.index+i[0].length,s=this.input.charAt(r);return s===";"||s==="}"||ge.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||s==="!"&&this.input.charAt(r+1)==="=")}t+=e[0].length,ne.lastIndex=t,t+=ne.exec(this.input)[0].length,this.input[t]===";"&&t++}};ue.eat=function(t){return this.type===t?(this.next(),!0):!1};ue.isContextual=function(t){return this.type===d.name&&this.value===t&&!this.containsEsc};ue.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};ue.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};ue.canInsertSemicolon=function(){return this.type===d.eof||this.type===d.braceR||ge.test(this.input.slice(this.lastTokEnd,this.start))};ue.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};ue.semicolon=function(){!this.eat(d.semi)&&!this.insertSemicolon()&&this.unexpected()};ue.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};ue.expect=function(t){this.eat(t)||this.unexpected()};ue.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var zt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ue.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var i=e?t.parenthesizedAssign:t.parenthesizedBind;i>-1&&this.raiseRecoverable(i,e?"Assigning to rvalue":"Parenthesized pattern")}};ue.checkExpressionErrors=function(t,e){if(!t)return!1;var i=t.shorthandAssign,r=t.doubleProto;if(!e)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")};ue.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")};ue.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var A=Z.prototype;A.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==d.eof;){var i=this.parseStatement(null,!0,e);t.body.push(i)}if(this.inModule)for(var r=0,s=Object.keys(this.undefinedExports);r<s.length;r+=1){var a=s[r];this.raiseRecoverable(this.undefinedExports[a].start,"Export '"+a+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(t,"Program")};var vi={kind:"loop"},Ms={kind:"switch"};A.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;ne.lastIndex=this.pos;var e=ne.exec(this.input),i=this.pos+e[0].length,r=this.fullCharCodeAt(i);if(r===91||r===92)return!0;if(t)return!1;if(r===123)return!0;if(Le(r)){var s=i;do i+=r<=65535?1:2;while(it(r=this.fullCharCodeAt(i)));if(r===92)return!0;var a=this.input.slice(s,i);if(!ur.test(a))return!0}return!1};A.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;ne.lastIndex=this.pos;var t=ne.exec(this.input),e=this.pos+t[0].length,i;return!ge.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(it(i=this.fullCharCodeAt(e+8))||i===92))};A.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;ne.lastIndex=this.pos;var i=ne.exec(this.input),r=this.pos+i[0].length;if(ge.test(this.input.slice(this.pos,r)))return!1;if(t){var s=r+5,a;if(this.input.slice(r,s)!=="using"||s===this.input.length||it(a=this.fullCharCodeAt(s))||a===92)return!1;ne.lastIndex=s;var n=ne.exec(this.input);if(r=s+n[0].length,n&&ge.test(this.input.slice(s,r)))return!1}var o=this.fullCharCodeAt(r);if(!Le(o)&&o!==92)return!1;var l=r;do r+=o<=65535?1:2;while(it(o=this.fullCharCodeAt(r)));if(o===92)return!0;var c=this.input.slice(l,r);return!(ur.test(c)||e&&c==="of")};A.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)};A.isUsing=function(t){return this.isUsingKeyword(!1,t)};A.parseStatement=function(t,e,i){var r=this.type,s=this.startNode(),a;switch(this.isLet(t)&&(r=d._var,a="let"),r){case d._break:case d._continue:return this.parseBreakContinueStatement(s,r.keyword);case d._debugger:return this.parseDebuggerStatement(s);case d._do:return this.parseDoStatement(s);case d._for:return this.parseForStatement(s);case d._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!t);case d._class:return t&&this.unexpected(),this.parseClass(s,!0);case d._if:return this.parseIfStatement(s);case d._return:return this.parseReturnStatement(s);case d._switch:return this.parseSwitchStatement(s);case d._throw:return this.parseThrowStatement(s);case d._try:return this.parseTryStatement(s);case d._const:case d._var:return a=a||this.value,t&&a!=="var"&&this.unexpected(),this.parseVarStatement(s,a);case d._while:return this.parseWhileStatement(s);case d._with:return this.parseWithStatement(s);case d.braceL:return this.parseBlock(!0,s);case d.semi:return this.parseEmptyStatement(s);case d._export:case d._import:if(this.options.ecmaVersion>10&&r===d._import){ne.lastIndex=this.pos;var n=ne.exec(this.input),o=this.pos+n[0].length,l=this.input.charCodeAt(o);if(l===40||l===46)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||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===d._import?this.parseImport(s):this.parseExport(s,i);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!t);var c=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(c)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),c==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(s,!1,c),this.semicolon(),this.finishNode(s,"VariableDeclaration");var h=this.value,p=this.parseExpression();return r===d.name&&p.type==="Identifier"&&this.eat(d.colon)?this.parseLabeledStatement(s,h,p,t):this.parseExpressionStatement(s,p)}};A.parseBreakContinueStatement=function(t,e){var i=e==="break";this.next(),this.eat(d.semi)||this.insertSemicolon()?t.label=null:this.type!==d.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var s=this.labels[r];if((t.label==null||s.name===t.label.name)&&(s.kind!=null&&(i||s.kind==="loop")||t.label&&i))break}return r===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,i?"BreakStatement":"ContinueStatement")};A.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};A.parseDoStatement=function(t){return this.next(),this.labels.push(vi),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(d._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(d.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};A.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(vi),this.enterScope(0),this.expect(d.parenL),this.type===d.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var i=this.isLet();if(this.type===d._var||this.type===d._const||i){var r=this.startNode(),s=i?"let":this.value;return this.next(),this.parseVar(r,!0,s),this.finishNode(r,"VariableDeclaration"),this.parseForAfterInit(t,r,e)}var a=this.isContextual("let"),n=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var l=this.startNode();return this.next(),o==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(l,!0,o),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(t,l,e)}var c=this.containsEsc,h=new zt,p=this.start,u=e>-1?this.parseExprSubscripts(h,"await"):this.parseExpression(!0,h);return this.type===d._in||(n=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===d._in&&this.unexpected(e),t.await=!0):n&&this.options.ecmaVersion>=8&&(u.start===p&&!c&&u.type==="Identifier"&&u.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(t.await=!1)),a&&n&&this.raise(u.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(u,!1,h),this.checkLValPattern(u),this.parseForIn(t,u)):(this.checkExpressionErrors(h,!0),e>-1&&this.unexpected(e),this.parseFor(t,u))};A.parseForAfterInit=function(t,e,i){return(this.type===d._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&e.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===d._in?i>-1&&this.unexpected(i):t.await=i>-1),this.parseForIn(t,e)):(i>-1&&this.unexpected(i),this.parseFor(t,e))};A.parseFunctionStatement=function(t,e,i){return this.next(),this.parseFunction(t,vt|(i?0:oi),!1,e)};A.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(d._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};A.parseReturnStatement=function(t){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(d.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};A.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(d.braceL),this.labels.push(Ms),this.enterScope(_r);for(var e,i=!1;this.type!==d.braceR;)if(this.type===d._case||this.type===d._default){var r=this.type===d._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),r?e.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,e.test=null),this.expect(d.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")};A.parseThrowStatement=function(t){return this.next(),ge.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var Vs=[];A.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?xr:0),this.checkLValPattern(t,e?vr:Ke),this.expect(d.parenR),t};A.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===d._catch){var e=this.startNode();this.next(),this.eat(d.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(d._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};A.parseVarStatement=function(t,e,i){return this.next(),this.parseVar(t,!1,e,i),this.semicolon(),this.finishNode(t,"VariableDeclaration")};A.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(vi),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};A.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")};A.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};A.parseLabeledStatement=function(t,e,i,r){for(var s=0,a=this.labels;s<a.length;s+=1){var n=a[s];n.name===e&&this.raise(i.start,"Label '"+e+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===d._switch?"switch":null,l=this.labels.length-1;l>=0;l--){var c=this.labels[l];if(c.statementStart===t.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:e,kind:o,statementStart:this.start}),t.body=this.parseStatement(r?r.indexOf("label")===-1?r+"label":r:"label"),this.labels.pop(),t.label=i,this.finishNode(t,"LabeledStatement")};A.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};A.parseBlock=function(t,e,i){for(t===void 0&&(t=!0),e===void 0&&(e=this.startNode()),e.body=[],this.expect(d.braceL),t&&this.enterScope(0);this.type!==d.braceR;){var r=this.parseStatement(null);e.body.push(r)}return i&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};A.parseFor=function(t,e){return t.init=e,this.expect(d.semi),t.test=this.type===d.semi?null:this.parseExpression(),this.expect(d.semi),t.update=this.type===d.parenR?null:this.parseExpression(),this.expect(d.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};A.parseForIn=function(t,e){var i=this.type===d._in;return this.next(),e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(e.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(d.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,i?"ForInStatement":"ForOfStatement")};A.parseVar=function(t,e,i,r){for(t.declarations=[],t.kind=i;;){var s=this.startNode();if(this.parseVarId(s,i),this.eat(d.eq)?s.init=this.parseMaybeAssign(e):!r&&i==="const"&&!(this.type===d._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&(i==="using"||i==="await using")&&this.options.ecmaVersion>=17&&this.type!==d._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+i+" declaration"):!r&&s.id.type!=="Identifier"&&!(e&&(this.type===d._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):s.init=null,t.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(d.comma))break}return t};A.parseVarId=function(t,e){t.id=e==="using"||e==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?bi:Ke,!1)};var vt=1,oi=2,Sr=4;A.parseFunction=function(t,e,i,r,s){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===d.star&&e&oi&&this.unexpected(),t.generator=this.eat(d.star)),this.options.ecmaVersion>=8&&(t.async=!!r),e&vt&&(t.id=e&Sr&&this.type!==d.name?null:this.parseIdent(),t.id&&!(e&oi)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?bi:Ke:br));var a=this.yieldPos,n=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(_i(t.async,t.generator)),e&vt||(t.id=this.type===d.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,i,!1,s),this.yieldPos=a,this.awaitPos=n,this.awaitIdentPos=o,this.finishNode(t,e&vt?"FunctionDeclaration":"FunctionExpression")};A.parseFunctionParams=function(t){this.expect(d.parenL),t.params=this.parseBindingList(d.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};A.parseClass=function(t,e){this.next();var i=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var r=this.enterClassBody(),s=this.startNode(),a=!1;for(s.body=[],this.expect(d.braceL);this.type!==d.braceR;){var n=this.parseClassElement(t.superClass!==null);n&&(s.body.push(n),n.type==="MethodDefinition"&&n.kind==="constructor"?(a&&this.raiseRecoverable(n.start,"Duplicate constructor in the same class"),a=!0):n.key&&n.key.type==="PrivateIdentifier"&&Ls(r,n)&&this.raiseRecoverable(n.key.start,"Identifier '#"+n.key.name+"' has already been declared"))}return this.strict=i,this.next(),t.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};A.parseClassElement=function(t){if(this.eat(d.semi))return null;var e=this.options.ecmaVersion,i=this.startNode(),r="",s=!1,a=!1,n="method",o=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(d.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===d.star?o=!0:r="static"}if(i.static=o,!r&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===d.star)&&!this.canInsertSemicolon()?a=!0:r="async"),!r&&(e>=9||!a)&&this.eat(d.star)&&(s=!0),!r&&!a&&!s){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?n=l:r=l)}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),e<13||this.type===d.parenL||n!=="method"||s||a){var c=!i.static&&Ot(i,"constructor"),h=c&&t;c&&n!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=c?"constructor":n,this.parseClassMethod(i,s,a,h)}else this.parseClassField(i);return i};A.isClassElementNameStart=function(){return this.type===d.name||this.type===d.privateId||this.type===d.num||this.type===d.string||this.type===d.bracketL||this.type.keyword};A.parseClassElementName=function(t){this.type===d.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)};A.parseClassMethod=function(t,e,i,r){var s=t.key;t.kind==="constructor"?(e&&this.raise(s.start,"Constructor can't be a generator"),i&&this.raise(s.start,"Constructor can't be an async method")):t.static&&Ot(t,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var a=t.value=this.parseMethod(e,i,r);return t.kind==="get"&&a.params.length!==0&&this.raiseRecoverable(a.start,"getter should have no params"),t.kind==="set"&&a.params.length!==1&&this.raiseRecoverable(a.start,"setter should have exactly one param"),t.kind==="set"&&a.params[0].type==="RestElement"&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")};A.parseClassField=function(t){return Ot(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&Ot(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(d.eq)?(this.enterScope(Et|qt),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")};A.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(ht|qt);this.type!==d.braceR;){var i=this.parseStatement(null);t.body.push(i)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")};A.parseClassId=function(t,e){this.type===d.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,Ke,!1)):(e===!0&&this.unexpected(),t.id=null)};A.parseClassSuper=function(t){t.superClass=this.eat(d._extends)?this.parseExprSubscripts(null,!1):null};A.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};A.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,i=t.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,s=r===0?null:this.privateNameStack[r-1],a=0;a<i.length;++a){var n=i[a];xt(e,n.name)||(s?s.used.push(n):this.raiseRecoverable(n.start,"Private field '#"+n.name+"' must be declared in an enclosing class"))}};function Ls(t,e){var i=e.key.name,r=t[i],s="true";return e.type==="MethodDefinition"&&(e.kind==="get"||e.kind==="set")&&(s=(e.static?"s":"i")+e.kind),r==="iget"&&s==="iset"||r==="iset"&&s==="iget"||r==="sget"&&s==="sset"||r==="sset"&&s==="sget"?(t[i]="true",!1):r?!0:(t[i]=s,!1)}function Ot(t,e){var i=t.computed,r=t.key;return!i&&(r.type==="Identifier"&&r.name===e||r.type==="Literal"&&r.value===e)}A.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==d.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")};A.parseExport=function(t,e){if(this.next(),this.eat(d.star))return this.parseExportAllDeclaration(t,e);if(this.eat(d._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),t.declaration.type==="VariableDeclaration"?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==d.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var i=0,r=t.specifiers;i<r.length;i+=1){var s=r[i];this.checkUnreserved(s.local),this.checkLocalExport(s.local),s.local.type==="Literal"&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")};A.parseExportDeclaration=function(t){return this.parseStatement(null)};A.parseExportDefaultDeclaration=function(){var t;if(this.type===d._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,vt|Sr,!1,t)}else if(this.type===d._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};A.checkExport=function(t,e,i){t&&(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),xt(t,e)&&this.raiseRecoverable(i,"Duplicate export '"+e+"'"),t[e]=!0)};A.checkPatternExport=function(t,e){var i=e.type;if(i==="Identifier")this.checkExport(t,e,e.start);else if(i==="ObjectPattern")for(var r=0,s=e.properties;r<s.length;r+=1){var a=s[r];this.checkPatternExport(t,a)}else if(i==="ArrayPattern")for(var n=0,o=e.elements;n<o.length;n+=1){var l=o[n];l&&this.checkPatternExport(t,l)}else i==="Property"?this.checkPatternExport(t,e.value):i==="AssignmentPattern"?this.checkPatternExport(t,e.left):i==="RestElement"&&this.checkPatternExport(t,e.argument)};A.checkVariableExport=function(t,e){if(t)for(var i=0,r=e;i<r.length;i+=1){var s=r[i];this.checkPatternExport(t,s.id)}};A.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};A.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")};A.parseExportSpecifiers=function(t){var e=[],i=!0;for(this.expect(d.braceL);!this.eat(d.braceR);){if(i)i=!1;else if(this.expect(d.comma),this.afterTrailingComma(d.braceR))break;e.push(this.parseExportSpecifier(t))}return e};A.parseImport=function(t){return this.next(),this.type===d.string?(t.specifiers=Vs,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===d.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};A.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,Ke),this.finishNode(t,"ImportSpecifier")};A.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,Ke),this.finishNode(t,"ImportDefaultSpecifier")};A.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,Ke),this.finishNode(t,"ImportNamespaceSpecifier")};A.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===d.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(d.comma)))return t;if(this.type===d.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(d.braceL);!this.eat(d.braceR);){if(e)e=!1;else if(this.expect(d.comma),this.afterTrailingComma(d.braceR))break;t.push(this.parseImportSpecifier())}return t};A.parseWithClause=function(){var t=[];if(!this.eat(d._with))return t;this.expect(d.braceL);for(var e={},i=!0;!this.eat(d.braceR);){if(i)i=!1;else if(this.expect(d.comma),this.afterTrailingComma(d.braceR))break;var r=this.parseImportAttribute(),s=r.key.type==="Identifier"?r.key.name:r.key.value;xt(e,s)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+s+"'"),e[s]=!0,t.push(r)}return t};A.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===d.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(d.colon),this.type!==d.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")};A.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===d.string){var t=this.parseLiteral(this.value);return Ps.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)};A.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)};A.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&(this.input[t.start]==='"'||this.input[t.start]==="'")};var Ie=Z.prototype;Ie.toAssignable=function(t,e,i){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&t.name==="await"&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var r=0,s=t.properties;r<s.length;r+=1){var a=s[r];this.toAssignable(a,e),a.type==="RestElement"&&(a.argument.type==="ArrayPattern"||a.argument.type==="ObjectPattern")&&this.raise(a.argument.start,"Unexpected token")}break;case"Property":t.kind!=="init"&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),t.argument.type==="AssignmentPattern"&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":t.operator!=="="&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,i);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return t};Ie.toAssignableList=function(t,e){for(var i=t.length,r=0;r<i;r++){var s=t[r];s&&this.toAssignable(s,e)}if(i){var a=t[i-1];this.options.ecmaVersion===6&&e&&a&&a.type==="RestElement"&&a.argument.type!=="Identifier"&&this.unexpected(a.argument.start)}return t};Ie.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};Ie.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==d.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};Ie.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case d.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(d.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case d.braceL:return this.parseObj(!0)}return this.parseIdent()};Ie.parseBindingList=function(t,e,i,r){for(var s=[],a=!0;!this.eat(t);)if(a?a=!1:this.expect(d.comma),e&&this.type===d.comma)s.push(null);else{if(i&&this.afterTrailingComma(t))break;if(this.type===d.ellipsis){var n=this.parseRestBinding();this.parseBindingListItem(n),s.push(n),this.type===d.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else s.push(this.parseAssignableListItem(r))}return s};Ie.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};Ie.parseBindingListItem=function(t){return t};Ie.parseMaybeDefault=function(t,e,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(d.eq))return i;var r=this.startNodeAt(t,e);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};Ie.checkLValSimple=function(t,e,i){e===void 0&&(e=Rt);var r=e!==Rt;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(r?"Binding ":"Assigning to ")+t.name+" in strict mode"),r&&(e===Ke&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),i&&(xt(i,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),i[t.name]=!0),e!==wr&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":r&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,i);default:this.raise(t.start,(r?"Binding":"Assigning to")+" rvalue")}};Ie.checkLValPattern=function(t,e,i){switch(e===void 0&&(e=Rt),t.type){case"ObjectPattern":for(var r=0,s=t.properties;r<s.length;r+=1){var a=s[r];this.checkLValInnerPattern(a,e,i)}break;case"ArrayPattern":for(var n=0,o=t.elements;n<o.length;n+=1){var l=o[n];l&&this.checkLValInnerPattern(l,e,i)}break;default:this.checkLValSimple(t,e,i)}};Ie.checkLValInnerPattern=function(t,e,i){switch(e===void 0&&(e=Rt),t.type){case"Property":this.checkLValInnerPattern(t.value,e,i);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,i);break;case"RestElement":this.checkLValPattern(t.argument,e,i);break;default:this.checkLValPattern(t,e,i)}};var Pe=function(e,i,r,s,a){this.token=e,this.isExpr=!!i,this.preserveSpace=!!r,this.override=s,this.generator=!!a},z={b_stat:new Pe("{",!1),b_expr:new Pe("{",!0),b_tmpl:new Pe("${",!1),p_stat:new Pe("(",!1),p_expr:new Pe("(",!0),q_tmpl:new Pe("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new Pe("function",!1),f_expr:new Pe("function",!0),f_expr_gen:new Pe("function",!0,!1,null,!0),f_gen:new Pe("function",!1,!1,null,!0)},yt=Z.prototype;yt.initialContext=function(){return[z.b_stat]};yt.curContext=function(){return this.context[this.context.length-1]};yt.braceIsBlock=function(t){var e=this.curContext();return e===z.f_expr||e===z.f_stat?!0:t===d.colon&&(e===z.b_stat||e===z.b_expr)?!e.isExpr:t===d._return||t===d.name&&this.exprAllowed?ge.test(this.input.slice(this.lastTokEnd,this.start)):t===d._else||t===d.semi||t===d.eof||t===d.parenR||t===d.arrow?!0:t===d.braceL?e===z.b_stat:t===d._var||t===d._const||t===d.name?!1:!this.exprAllowed};yt.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if(e.token==="function")return e.generator}return!1};yt.updateContext=function(t){var e,i=this.type;i.keyword&&t===d.dot?this.exprAllowed=!1:(e=i.updateContext)?e.call(this,t):this.exprAllowed=i.beforeExpr};yt.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)};d.parenR.updateContext=d.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var t=this.context.pop();t===z.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};d.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?z.b_stat:z.b_expr),this.exprAllowed=!0};d.dollarBraceL.updateContext=function(){this.context.push(z.b_tmpl),this.exprAllowed=!0};d.parenL.updateContext=function(t){var e=t===d._if||t===d._for||t===d._with||t===d._while;this.context.push(e?z.p_stat:z.p_expr),this.exprAllowed=!0};d.incDec.updateContext=function(){};d._function.updateContext=d._class.updateContext=function(t){t.beforeExpr&&t!==d._else&&!(t===d.semi&&this.curContext()!==z.p_stat)&&!(t===d._return&&ge.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===d.colon||t===d.braceL)&&this.curContext()===z.b_stat)?this.context.push(z.f_expr):this.context.push(z.f_stat),this.exprAllowed=!1};d.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};d.backQuote.updateContext=function(){this.curContext()===z.q_tmpl?this.context.pop():this.context.push(z.q_tmpl),this.exprAllowed=!1};d.star.updateContext=function(t){if(t===d._function){var e=this.context.length-1;this.context[e]===z.f_expr?this.context[e]=z.f_expr_gen:this.context[e]=z.f_gen}this.exprAllowed=!0};d.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==d.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var P=Z.prototype;P.checkPropClash=function(t,e,i){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var r=t.key,s;switch(r.type){case"Identifier":s=r.name;break;case"Literal":s=String(r.value);break;default:return}var a=t.kind;if(this.options.ecmaVersion>=6){s==="__proto__"&&a==="init"&&(e.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),e.proto=!0);return}s="$"+s;var n=e[s];if(n){var o;a==="init"?o=this.strict&&n.init||n.get||n.set:o=n.init||n[a],o&&this.raiseRecoverable(r.start,"Redefinition of property")}else n=e[s]={init:!1,get:!1,set:!1};n[a]=!0}};P.parseExpression=function(t,e){var i=this.start,r=this.startLoc,s=this.parseMaybeAssign(t,e);if(this.type===d.comma){var a=this.startNodeAt(i,r);for(a.expressions=[s];this.eat(d.comma);)a.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(a,"SequenceExpression")}return s};P.parseMaybeAssign=function(t,e,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var r=!1,s=-1,a=-1,n=-1;e?(s=e.parenthesizedAssign,a=e.trailingComma,n=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new zt,r=!0);var o=this.start,l=this.startLoc;(this.type===d.parenL||this.type===d.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=t==="await");var c=this.parseMaybeConditional(t,e);if(i&&(c=i.call(this,c,o,l)),this.type.isAssign){var h=this.startNodeAt(o,l);return h.operator=this.value,this.type===d.eq&&(c=this.toAssignable(c,!1,e)),r||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=c.start&&(e.shorthandAssign=-1),this.type===d.eq?this.checkLValPattern(c):this.checkLValSimple(c),h.left=c,this.next(),h.right=this.parseMaybeAssign(t),n>-1&&(e.doubleProto=n),this.finishNode(h,"AssignmentExpression")}else r&&this.checkExpressionErrors(e,!0);return s>-1&&(e.parenthesizedAssign=s),a>-1&&(e.trailingComma=a),c};P.parseMaybeConditional=function(t,e){var i=this.start,r=this.startLoc,s=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return s;if(this.eat(d.question)){var a=this.startNodeAt(i,r);return a.test=s,a.consequent=this.parseMaybeAssign(),this.expect(d.colon),a.alternate=this.parseMaybeAssign(t),this.finishNode(a,"ConditionalExpression")}return s};P.parseExprOps=function(t,e){var i=this.start,r=this.startLoc,s=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||s.start===i&&s.type==="ArrowFunctionExpression"?s:this.parseExprOp(s,i,r,-1,t)};P.parseExprOp=function(t,e,i,r,s){var a=this.type.binop;if(a!=null&&(!s||this.type!==d._in)&&a>r){var n=this.type===d.logicalOR||this.type===d.logicalAND,o=this.type===d.coalesce;o&&(a=d.logicalAND.binop);var l=this.value;this.next();var c=this.start,h=this.startLoc,p=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),c,h,a,s),u=this.buildBinary(e,i,t,p,l,n||o);return(n&&this.type===d.coalesce||o&&(this.type===d.logicalOR||this.type===d.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(u,e,i,r,s)}return t};P.buildBinary=function(t,e,i,r,s,a){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var n=this.startNodeAt(t,e);return n.left=i,n.operator=s,n.right=r,this.finishNode(n,a?"LogicalExpression":"BinaryExpression")};P.parseMaybeUnary=function(t,e,i,r){var s=this.start,a=this.startLoc,n;if(this.isContextual("await")&&this.canAwait)n=this.parseAwait(r),e=!0;else if(this.type.prefix){var o=this.startNode(),l=this.type===d.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,l,r),this.checkExpressionErrors(t,!0),l?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&Er(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&li(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):e=!0,n=this.finishNode(o,l?"UpdateExpression":"UnaryExpression")}else if(!e&&this.type===d.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),n=this.parsePrivateIdent(),this.type!==d._in&&this.unexpected();else{if(n=this.parseExprSubscripts(t,r),this.checkExpressionErrors(t))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var c=this.startNodeAt(s,a);c.operator=this.value,c.prefix=!1,c.argument=n,this.checkLValSimple(n),this.next(),n=this.finishNode(c,"UpdateExpression")}}if(!i&&this.eat(d.starstar))if(e)this.unexpected(this.lastTokStart);else return this.buildBinary(s,a,n,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return n};function Er(t){return t.type==="Identifier"||t.type==="ParenthesizedExpression"&&Er(t.expression)}function li(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&li(t.expression)||t.type==="ParenthesizedExpression"&&li(t.expression)}P.parseExprSubscripts=function(t,e){var i=this.start,r=this.startLoc,s=this.parseExprAtom(t,e);if(s.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return s;var a=this.parseSubscripts(s,i,r,!1,e);return t&&a.type==="MemberExpression"&&(t.parenthesizedAssign>=a.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=a.start&&(t.parenthesizedBind=-1),t.trailingComma>=a.start&&(t.trailingComma=-1)),a};P.parseSubscripts=function(t,e,i,r,s){for(var a=this.options.ecmaVersion>=8&&t.type==="Identifier"&&t.name==="async"&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,n=!1;;){var o=this.parseSubscript(t,e,i,r,a,n,s);if(o.optional&&(n=!0),o===t||o.type==="ArrowFunctionExpression"){if(n){var l=this.startNodeAt(e,i);l.expression=o,o=this.finishNode(l,"ChainExpression")}return o}t=o}};P.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(d.arrow)};P.parseSubscriptAsyncArrow=function(t,e,i,r){return this.parseArrowExpression(this.startNodeAt(t,e),i,!0,r)};P.parseSubscript=function(t,e,i,r,s,a,n){var o=this.options.ecmaVersion>=11,l=o&&this.eat(d.questionDot);r&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var c=this.eat(d.bracketL);if(c||l&&this.type!==d.parenL&&this.type!==d.backQuote||this.eat(d.dot)){var h=this.startNodeAt(e,i);h.object=t,c?(h.property=this.parseExpression(),this.expect(d.bracketR)):this.type===d.privateId&&t.type!=="Super"?h.property=this.parsePrivateIdent():h.property=this.parseIdent(this.options.allowReserved!=="never"),h.computed=!!c,o&&(h.optional=l),t=this.finishNode(h,"MemberExpression")}else if(!r&&this.eat(d.parenL)){var p=new zt,u=this.yieldPos,f=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var y=this.parseExprList(d.parenR,this.options.ecmaVersion>=8,!1,p);if(s&&!l&&this.shouldParseAsyncArrow())return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=u,this.awaitPos=f,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(e,i,y,n);this.checkExpressionErrors(p,!0),this.yieldPos=u||this.yieldPos,this.awaitPos=f||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var _=this.startNodeAt(e,i);_.callee=t,_.arguments=y,o&&(_.optional=l),t=this.finishNode(_,"CallExpression")}else if(this.type===d.backQuote){(l||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var b=this.startNodeAt(e,i);b.tag=t,b.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(b,"TaggedTemplateExpression")}return t};P.parseExprAtom=function(t,e,i){this.type===d.slash&&this.readRegexp();var r,s=this.potentialArrowAt===this.start;switch(this.type){case d._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===d.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==d.dot&&this.type!==d.bracketL&&this.type!==d.parenL&&this.unexpected(),this.finishNode(r,"Super");case d._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case d.name:var a=this.start,n=this.startLoc,o=this.containsEsc,l=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&l.name==="async"&&!this.canInsertSemicolon()&&this.eat(d._function))return this.overrideContext(z.f_expr),this.parseFunction(this.startNodeAt(a,n),0,!1,!0,e);if(s&&!this.canInsertSemicolon()){if(this.eat(d.arrow))return this.parseArrowExpression(this.startNodeAt(a,n),[l],!1,e);if(this.options.ecmaVersion>=8&&l.name==="async"&&this.type===d.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return l=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(d.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,n),[l],!0,e)}return l;case d.regexp:var c=this.value;return r=this.parseLiteral(c.value),r.regex={pattern:c.pattern,flags:c.flags},r;case d.num:case d.string:return this.parseLiteral(this.value);case d._null:case d._true:case d._false:return r=this.startNode(),r.value=this.type===d._null?null:this.type===d._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case d.parenL:var h=this.start,p=this.parseParenAndDistinguishExpression(s,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(p)&&(t.parenthesizedAssign=h),t.parenthesizedBind<0&&(t.parenthesizedBind=h)),p;case d.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(d.bracketR,!0,!0,t),this.finishNode(r,"ArrayExpression");case d.braceL:return this.overrideContext(z.b_expr),this.parseObj(!1,t);case d._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case d._class:return this.parseClass(this.startNode(),!1);case d._new:return this.parseNew();case d.backQuote:return this.parseTemplate();case d._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};P.parseExprAtomDefault=function(){this.unexpected()};P.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===d.parenL&&!t)return this.parseDynamicImport(e);if(this.type===d.dot){var i=this.startNodeAt(e.start,e.loc&&e.loc.start);return i.name="import",e.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(e)}else this.unexpected()};P.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(d.parenR)?t.options=null:(this.expect(d.comma),this.afterTrailingComma(d.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(d.parenR)||(this.expect(d.comma),this.afterTrailingComma(d.parenR)||this.unexpected())));else if(!this.eat(d.parenR)){var e=this.start;this.eat(d.comma)&&this.eat(d.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};P.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="meta"&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")};P.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),e.raw.charCodeAt(e.raw.length-1)===110&&(e.bigint=e.value!=null?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")};P.parseParenExpression=function(){this.expect(d.parenL);var t=this.parseExpression();return this.expect(d.parenR),t};P.shouldParseArrow=function(t){return!this.canInsertSemicolon()};P.parseParenAndDistinguishExpression=function(t,e){var i=this.start,r=this.startLoc,s,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var n=this.start,o=this.startLoc,l=[],c=!0,h=!1,p=new zt,u=this.yieldPos,f=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==d.parenR;)if(c?c=!1:this.expect(d.comma),a&&this.afterTrailingComma(d.parenR,!0)){h=!0;break}else if(this.type===d.ellipsis){m=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===d.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else l.push(this.parseMaybeAssign(!1,p,this.parseParenItem));var y=this.lastTokEnd,_=this.lastTokEndLoc;if(this.expect(d.parenR),t&&this.shouldParseArrow(l)&&this.eat(d.arrow))return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=u,this.awaitPos=f,this.parseParenArrowList(i,r,l,e);(!l.length||h)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(p,!0),this.yieldPos=u||this.yieldPos,this.awaitPos=f||this.awaitPos,l.length>1?(s=this.startNodeAt(n,o),s.expressions=l,this.finishNodeAt(s,"SequenceExpression",y,_)):s=l[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var b=this.startNodeAt(i,r);return b.expression=s,this.finishNode(b,"ParenthesizedExpression")}else return s};P.parseParenItem=function(t){return t};P.parseParenArrowList=function(t,e,i,r){return this.parseArrowExpression(this.startNodeAt(t,e),i,!1,r)};var js=[];P.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===d.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var i=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="target"&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var r=this.start,s=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,s,!0,!1),this.eat(d.parenL)?t.arguments=this.parseExprList(d.parenR,this.options.ecmaVersion>=8,!1):t.arguments=js,this.finishNode(t,"NewExpression")};P.parseTemplateElement=function(t){var e=t.isTagged,i=this.startNode();return this.type===d.invalidTemplate?(e||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===d.backQuote,this.finishNode(i,"TemplateElement")};P.parseTemplate=function(t){t===void 0&&(t={});var e=t.isTagged;e===void 0&&(e=!1);var i=this.startNode();this.next(),i.expressions=[];var r=this.parseTemplateElement({isTagged:e});for(i.quasis=[r];!r.tail;)this.type===d.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(d.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(d.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(i,"TemplateLiteral")};P.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===d.name||this.type===d.num||this.type===d.string||this.type===d.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===d.star)&&!ge.test(this.input.slice(this.lastTokEnd,this.start))};P.parseObj=function(t,e){var i=this.startNode(),r=!0,s={};for(i.properties=[],this.next();!this.eat(d.braceR);){if(r)r=!1;else if(this.expect(d.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(d.braceR))break;var a=this.parseProperty(t,e);t||this.checkPropClash(a,s,e),i.properties.push(a)}return this.finishNode(i,t?"ObjectPattern":"ObjectExpression")};P.parseProperty=function(t,e){var i=this.startNode(),r,s,a,n;if(this.options.ecmaVersion>=9&&this.eat(d.ellipsis))return t?(i.argument=this.parseIdent(!1),this.type===d.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,e),this.type===d.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(t||e)&&(a=this.start,n=this.startLoc),t||(r=this.eat(d.star)));var o=this.containsEsc;return this.parsePropertyName(i),!t&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(s=!0,r=this.options.ecmaVersion>=9&&this.eat(d.star),this.parsePropertyName(i)):s=!1,this.parsePropertyValue(i,t,r,s,a,n,e,o),this.finishNode(i,"Property")};P.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(!1),t.kind=e;var i=t.kind==="get"?0:1;if(t.value.params.length!==i){var r=t.value.start;t.kind==="get"?this.raiseRecoverable(r,"getter should have no params"):this.raiseRecoverable(r,"setter should have exactly one param")}else t.kind==="set"&&t.value.params[0].type==="RestElement"&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")};P.parsePropertyValue=function(t,e,i,r,s,a,n,o){(i||r)&&this.type===d.colon&&this.unexpected(),this.eat(d.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,n),t.kind="init"):this.options.ecmaVersion>=6&&this.type===d.parenL?(e&&this.unexpected(),t.method=!0,t.value=this.parseMethod(i,r),t.kind="init"):!e&&!o&&this.options.ecmaVersion>=5&&!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.type!==d.comma&&this.type!==d.braceR&&this.type!==d.eq?((i||r)&&this.unexpected(),this.parseGetterSetter(t)):this.options.ecmaVersion>=6&&!t.computed&&t.key.type==="Identifier"?((i||r)&&this.unexpected(),this.checkUnreserved(t.key),t.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),e?t.value=this.parseMaybeDefault(s,a,this.copyNode(t.key)):this.type===d.eq&&n?(n.shorthandAssign<0&&(n.shorthandAssign=this.start),t.value=this.parseMaybeDefault(s,a,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected()};P.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(d.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(d.bracketR),t.key;t.computed=!1}return t.key=this.type===d.num||this.type===d.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};P.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)};P.parseMethod=function(t,e,i){var r=this.startNode(),s=this.yieldPos,a=this.awaitPos,n=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=t),this.options.ecmaVersion>=8&&(r.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(xi(e,r.generator)|Wt|(i?gr:0)),this.expect(d.parenL),r.params=this.parseBindingList(d.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=n,this.finishNode(r,"FunctionExpression")};P.parseArrowExpression=function(t,e,i,r){var s=this.yieldPos,a=this.awaitPos,n=this.awaitIdentPos;return this.enterScope(xi(i,!1)|gi),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,r),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=n,this.finishNode(t,"ArrowFunctionExpression")};P.parseFunctionBody=function(t,e,i,r){var s=e&&this.type!==d.braceL,a=this.strict,n=!1;if(s)t.body=this.parseMaybeAssign(r),t.expression=!0,this.checkParams(t,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!a||o)&&(n=this.strictDirective(this.end),n&&o&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],n&&(this.strict=!0),this.checkParams(t,!a&&!n&&!e&&!i&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,br),t.body=this.parseBlock(!1,void 0,n&&!a),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=l}this.exitScope()};P.isSimpleParamList=function(t){for(var e=0,i=t;e<i.length;e+=1){var r=i[e];if(r.type!=="Identifier")return!1}return!0};P.checkParams=function(t,e){for(var i=Object.create(null),r=0,s=t.params;r<s.length;r+=1){var a=s[r];this.checkLValInnerPattern(a,yi,e?null:i)}};P.parseExprList=function(t,e,i,r){for(var s=[],a=!0;!this.eat(t);){if(a)a=!1;else if(this.expect(d.comma),e&&this.afterTrailingComma(t))break;var n=void 0;i&&this.type===d.comma?n=null:this.type===d.ellipsis?(n=this.parseSpread(r),r&&this.type===d.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):n=this.parseMaybeAssign(!1,r),s.push(n)}return s};P.checkUnreserved=function(t){var e=t.start,i=t.end,r=t.name;if(this.inGenerator&&r==="yield"&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&r==="await"&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Ut)&&r==="arguments"&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(r==="arguments"||r==="await")&&this.raise(e,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(e,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,i).indexOf("\\")!==-1)){var s=this.strict?this.reservedWordsStrict:this.reservedWords;s.test(r)&&(!this.inAsync&&r==="await"&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+r+"' is reserved"))}};P.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),e.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e};P.parseIdentNode=function(){var t=this.startNode();return this.type===d.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,(t.name==="class"||t.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=d.name):this.unexpected(),t};P.parsePrivateIdent=function(){var t=this.startNode();return this.type===d.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t};P.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===d.semi||this.canInsertSemicolon()||this.type!==d.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(d.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};P.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var Rt=Z.prototype;Rt.raise=function(t,e){var i=fr(this.input,t);e+=" ("+i.line+":"+i.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var r=new SyntaxError(e);throw r.pos=t,r.loc=i,r.raisedAt=this.pos,r};Rt.raiseRecoverable=Rt.raise;Rt.curPosition=function(){if(this.options.locations)return new St(this.curLine,this.pos-this.lineStart)};var rt=Z.prototype,js=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};rt.enterScope=function(t){this.scopeStack.push(new js(t))};rt.exitScope=function(){this.scopeStack.pop()};rt.treatFunctionsAsVarInScope=function(t){return t.flags&ct||!this.inModule&&t.flags<};rt.declareName=function(t,e,i){var r=!1;if(e===Ke){var s=this.currentScope();r=s.lexical.indexOf(t)>-1||s.functions.indexOf(t)>-1||s.var.indexOf(t)>-1,s.lexical.push(t),this.inModule&&s.flags<&&delete this.undefinedExports[t]}else if(e===_r){var a=this.currentScope();a.lexical.push(t)}else if(e===yr){var n=this.currentScope();this.treatFunctionsAsVar?r=n.lexical.indexOf(t)>-1:r=n.lexical.indexOf(t)>-1||n.var.indexOf(t)>-1,n.functions.push(t)}else for(var o=this.scopeStack.length-1;o>=0;--o){var l=this.scopeStack[o];if(l.lexical.indexOf(t)>-1&&!(l.flags&mr&&l.lexical[0]===t)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(t)>-1){r=!0;break}if(l.var.push(t),this.inModule&&l.flags<&&delete this.undefinedExports[t],l.flags&Ut)break}r&&this.raiseRecoverable(i,"Identifier '"+t+"' has already been declared")};rt.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};rt.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};rt.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Ut|Et|ht))return e}};rt.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Ut|Et|ht)&&!(e.flags&gi))return e}};var Kt=function(e,i,r){this.type="",this.start=i,this.end=0,e.options.locations&&(this.loc=new $t(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[i,0])},Nt=Z.prototype;Nt.startNode=function(){return new Kt(this,this.start,this.startLoc)};Nt.startNodeAt=function(t,e){return new Kt(this,t,e)};function Sr(t,e,i,r){return t.type=e,t.end=i,this.options.locations&&(t.loc.end=r),this.options.ranges&&(t.range[1]=i),t}Nt.finishNode=function(t,e){return Sr.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};Nt.finishNodeAt=function(t,e,i,r){return Sr.call(this,t,e,i,r)};Nt.copyNode=function(t){var e=new Kt(this,t.start,this.startLoc);for(var i in t)e[i]=t[i];return e};var Bs="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",Er="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",Nr=Er+" Extended_Pictographic",Cr=Nr,Ir=Cr+" EBase EComp EMod EPres ExtPict",kr=Ir,Fs=kr,$s={9:Er,10:Nr,11:Cr,12:Ir,13:kr,14:Fs},Ws="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Us={9:"",10:"",11:"",12:"",13:"",14:Ws},Ai="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",Ar="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",Tr=Ar+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Pr=Tr+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Dr=Pr+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Rr=Dr+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",qs=Rr+" "+Bs,Ks={9:Ar,10:Tr,11:Pr,12:Dr,13:Rr,14:qs},Or={};function zs(t){var e=Or[t]={binary:et($s[t]+" "+Ai),binaryOfStrings:et(Us[t]),nonBinary:{General_Category:et(Ai),Script:et(Ks[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(var Yt=0,Ti=[9,10,11,12,13,14];Yt<Ti.length;Yt+=1){var Hs=Ti[Yt];zs(Hs)}var k=Z.prototype,Ot=function(e,i){this.parent=e,this.base=i||this};Ot.prototype.separatedFrom=function(e){for(var i=this;i;i=i.parent)for(var r=e;r;r=r.parent)if(i.base===r.base&&i!==r)return!0;return!1};Ot.prototype.sibling=function(){return new Ot(this.parent,this.base)};var Be=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Or[e.options.ecmaVersion>=14?14:e.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};Be.prototype.reset=function(e,i,r){var s=r.indexOf("v")!==-1,a=r.indexOf("u")!==-1;this.start=e|0,this.source=i+"",this.flags=r,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=a&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=a&&this.parser.options.ecmaVersion>=9)};Be.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};Be.prototype.at=function(e,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(e>=s)return-1;var a=r.charCodeAt(e);if(!(i||this.switchU)||a<=55295||a>=57344||e+1>=s)return a;var n=r.charCodeAt(e+1);return n>=56320&&n<=57343?(a<<10)+n-56613888:a};Be.prototype.nextIndex=function(e,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(e>=s)return s;var a=r.charCodeAt(e),n;return!(i||this.switchU)||a<=55295||a>=57344||e+1>=s||(n=r.charCodeAt(e+1))<56320||n>57343?e+1:e+2};Be.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)};Be.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)};Be.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)};Be.prototype.eat=function(e,i){return i===void 0&&(i=!1),this.current(i)===e?(this.advance(i),!0):!1};Be.prototype.eatChars=function(e,i){i===void 0&&(i=!1);for(var r=this.pos,s=0,a=e;s<a.length;s+=1){var n=a[s],o=this.at(r,i);if(o===-1||o!==n)return!1;r=this.nextIndex(r,i)}return this.pos=r,!0};k.validateRegExpFlags=function(t){for(var e=t.validFlags,i=t.flags,r=!1,s=!1,a=0;a<i.length;a++){var n=i.charAt(a);e.indexOf(n)===-1&&this.raise(t.start,"Invalid regular expression flag"),i.indexOf(n,a+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),n==="u"&&(r=!0),n==="v"&&(s=!0)}this.options.ecmaVersion>=15&&r&&s&&this.raise(t.start,"Invalid regular expression flag")};function Gs(t){for(var e in t)return!0;return!1}k.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&Gs(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))};k.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,i=t.backReferenceNames;e<i.length;e+=1){var r=i[e];t.groupNames[r]||t.raise("Invalid named capture referenced")}};k.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new Ot(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")};k.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};k.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))?(this.regexp_eatQuantifier(t),!0):!1};k.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!i,!0}return t.pos=e,!1};k.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=!1),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),!0):!1};k.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};k.regexp_eatBracedQuantifier=function(t,e){var i=t.pos;if(t.eat(123)){var r=0,s=-1;if(this.regexp_eatDecimalDigits(t)&&(r=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(s=t.lastIntValue),t.eat(125)))return s!==-1&&s<r&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=i}return!1};k.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)};k.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1};k.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(t),r=t.eat(45);if(i||r){for(var s=0;s<i.length;s++){var a=i.charAt(s);i.indexOf(a,s+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(r){var n=this.regexp_eatModifiers(t);!i&&!n&&t.current()===58&&t.raise("Invalid regular expression modifiers");for(var o=0;o<n.length;o++){var l=n.charAt(o);(n.indexOf(l,o+1)>-1||i.indexOf(l)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}}t.pos=e}return!1};k.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):t.current()===63&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1};k.regexp_eatModifiers=function(t){for(var e="",i=0;(i=t.current())!==-1&&Ys(i);)e+=Ue(i),t.advance();return e};function Ys(t){return t===105||t===109||t===115}k.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)};k.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1};k.regexp_eatSyntaxCharacter=function(t){var e=t.current();return Vr(e)?(t.lastIntValue=e,t.advance(),!0):!1};function Vr(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}k.regexp_eatPatternCharacters=function(t){for(var e=t.pos,i=0;(i=t.current())!==-1&&!Vr(i);)t.advance();return t.pos!==e};k.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return e!==-1&&e!==36&&!(e>=40&&e<=43)&&e!==46&&e!==63&&e!==91&&e!==94&&e!==124?(t.advance(),!0):!1};k.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,i=t.groupNames[t.lastStringValue];if(i)if(e)for(var r=0,s=i;r<s.length;r+=1){var a=s[r];a.separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(i||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=!0}};k.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1};k.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=Ue(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=Ue(t.lastIntValue);return!0}return!1};k.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,i=this.options.ecmaVersion>=11,r=t.current(i);return t.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,i)&&(r=t.lastIntValue),Qs(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function Qs(t){return Le(t,!0)||t===36||t===95}k.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,i=this.options.ecmaVersion>=11,r=t.current(i);return t.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,i)&&(r=t.lastIntValue),Xs(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function Xs(t){return it(t,!0)||t===36||t===95||t===8204||t===8205}k.regexp_eatAtomEscape=function(t){return this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t)?!0:(t.switchU&&(t.current()===99&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)};k.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var i=t.lastIntValue;if(t.switchU)return i>t.maxBackReference&&(t.maxBackReference=i),!0;if(i<=t.numCapturingParens)return!0;t.pos=e}return!1};k.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1};k.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)};k.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1};k.regexp_eatZero=function(t){return t.current()===48&&!zt(t.lookahead())?(t.lastIntValue=0,t.advance(),!0):!1};k.regexp_eatControlEscape=function(t){var e=t.current();return e===116?(t.lastIntValue=9,t.advance(),!0):e===110?(t.lastIntValue=10,t.advance(),!0):e===118?(t.lastIntValue=11,t.advance(),!0):e===102?(t.lastIntValue=12,t.advance(),!0):e===114?(t.lastIntValue=13,t.advance(),!0):!1};k.regexp_eatControlLetter=function(t){var e=t.current();return Mr(e)?(t.lastIntValue=e%32,t.advance(),!0):!1};function Mr(t){return t>=65&&t<=90||t>=97&&t<=122}k.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){e===void 0&&(e=!1);var i=t.pos,r=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var s=t.lastIntValue;if(r&&s>=55296&&s<=56319){var a=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var n=t.lastIntValue;if(n>=56320&&n<=57343)return t.lastIntValue=(s-55296)*1024+(n-56320)+65536,!0}t.pos=a,t.lastIntValue=s}return!0}if(r&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&Zs(t.lastIntValue))return!0;r&&t.raise("Invalid unicode escape"),t.pos=i}return!1};function Zs(t){return t>=0&&t<=1114111}k.regexp_eatIdentityEscape=function(t){if(t.switchU)return this.regexp_eatSyntaxCharacter(t)?!0:t.eat(47)?(t.lastIntValue=47,!0):!1;var e=t.current();return e!==99&&(!t.switchN||e!==107)?(t.lastIntValue=e,t.advance(),!0):!1};k.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do t.lastIntValue=10*t.lastIntValue+(e-48),t.advance();while((e=t.current())>=48&&e<=57);return!0}return!1};var Lr=0,qe=1,Ne=2;k.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(Js(e))return t.lastIntValue=-1,t.advance(),qe;var i=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((i=e===80)||e===112)){t.lastIntValue=-1,t.advance();var r;if(t.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return i&&r===Ne&&t.raise("Invalid property name"),r;t.raise("Invalid property name")}return Lr};function Js(t){return t===100||t===68||t===115||t===83||t===119||t===87}k.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var i=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var r=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,i,r),qe}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var s=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,s)}return Lr};k.regexp_validateUnicodePropertyNameAndValue=function(t,e,i){xt(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(i)||t.raise("Invalid property value")};k.regexp_validateUnicodePropertyNameOrValue=function(t,e){if(t.unicodeProperties.binary.test(e))return qe;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return Ne;t.raise("Invalid property name")};k.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";jr(e=t.current());)t.lastStringValue+=Ue(e),t.advance();return t.lastStringValue!==""};function jr(t){return Mr(t)||t===95}k.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";en(e=t.current());)t.lastStringValue+=Ue(e),t.advance();return t.lastStringValue!==""};function en(t){return jr(t)||zt(t)}k.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};k.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),i=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&i===Ne&&t.raise("Negated character class may contain strings"),!0}return!1};k.regexp_classContents=function(t){return t.current()===93?qe:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),qe)};k.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var i=t.lastIntValue;t.switchU&&(e===-1||i===-1)&&t.raise("Invalid character class"),e!==-1&&i!==-1&&e>i&&t.raise("Range out of order in character class")}}};k.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var i=t.current();(i===99||$r(i))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var r=t.current();return r!==93?(t.lastIntValue=r,t.advance(),!0):!1};k.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)};k.regexp_classSetExpression=function(t){var e=qe,i;if(!this.regexp_eatClassSetRange(t))if(i=this.regexp_eatClassSetOperand(t)){i===Ne&&(e=Ne);for(var r=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(i=this.regexp_eatClassSetOperand(t))){i!==Ne&&(e=qe);continue}t.raise("Invalid character in character class")}if(r!==t.pos)return e;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(r!==t.pos)return e}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(i=this.regexp_eatClassSetOperand(t),!i)return e;i===Ne&&(e=Ne)}};k.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var r=t.lastIntValue;return i!==-1&&r!==-1&&i>r&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1};k.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?qe:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)};k.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var i=t.eat(94),r=this.regexp_classContents(t);if(t.eat(93))return i&&r===Ne&&t.raise("Negated character class may contain strings"),r;t.pos=e}if(t.eat(92)){var s=this.regexp_eatCharacterClassEscape(t);if(s)return s;t.pos=e}return null};k.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var i=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return i}else t.raise("Invalid escape");t.pos=e}return null};k.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===Ne&&(e=Ne);return e};k.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?qe:Ne};k.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return this.regexp_eatCharacterEscape(t)||this.regexp_eatClassSetReservedPunctuator(t)?!0:t.eat(98)?(t.lastIntValue=8,!0):(t.pos=e,!1);var i=t.current();return i<0||i===t.lookahead()&&tn(i)||rn(i)?!1:(t.advance(),t.lastIntValue=i,!0)};function tn(t){return t===33||t>=35&&t<=38||t>=42&&t<=44||t===46||t>=58&&t<=64||t===94||t===96||t===126}function rn(t){return t===40||t===41||t===45||t===47||t>=91&&t<=93||t>=123&&t<=125}k.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return sn(e)?(t.lastIntValue=e,t.advance(),!0):!1};function sn(t){return t===33||t===35||t===37||t===38||t===44||t===45||t>=58&&t<=62||t===64||t===96||t===126}k.regexp_eatClassControlLetter=function(t){var e=t.current();return zt(e)||e===95?(t.lastIntValue=e%32,t.advance(),!0):!1};k.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1};k.regexp_eatDecimalDigits=function(t){var e=t.pos,i=0;for(t.lastIntValue=0;zt(i=t.current());)t.lastIntValue=10*t.lastIntValue+(i-48),t.advance();return t.pos!==e};function zt(t){return t>=48&&t<=57}k.regexp_eatHexDigits=function(t){var e=t.pos,i=0;for(t.lastIntValue=0;Br(i=t.current());)t.lastIntValue=16*t.lastIntValue+Fr(i),t.advance();return t.pos!==e};function Br(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function Fr(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}k.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var i=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=e*64+i*8+t.lastIntValue:t.lastIntValue=e*8+i}else t.lastIntValue=e;return!0}return!1};k.regexp_eatOctalDigit=function(t){var e=t.current();return $r(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)};function $r(t){return t>=48&&t<=55}k.regexp_eatFixedHexDigits=function(t,e){var i=t.pos;t.lastIntValue=0;for(var r=0;r<e;++r){var s=t.current();if(!Br(s))return t.pos=i,!1;t.lastIntValue=16*t.lastIntValue+Fr(s),t.advance()}return!0};var bi=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new $t(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},V=Z.prototype;V.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new bi(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};V.getToken=function(){return this.next(),new bi(this)};typeof Symbol<"u"&&(V[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===d.eof,value:e}}}});V.nextToken=function(){var t=this.curContext();if((!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(d.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};V.readToken=function(t){return Le(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};V.fullCharCodeAt=function(t){var e=this.input.charCodeAt(t);if(e<=55295||e>=56320)return e;var i=this.input.charCodeAt(t+1);return i<=56319||i>=57344?e:(e<<10)+i-56613888};V.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};V.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var r=void 0,s=e;(r=hr(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,i),e,this.pos,t,this.curPosition())};V.skipLineComment=function(t){for(var e=this.pos,i=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!gt(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,i,this.curPosition())};V.skipSpace=function(){e:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){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(t>8&&t<14||t>=5760&&ur.test(String.fromCharCode(t)))++this.pos;else break e}}};V.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=t,this.value=e,this.updateContext(i)};V.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&t===46&&e===46?(this.pos+=3,this.finishToken(d.ellipsis)):(++this.pos,this.finishToken(d.dot))};V.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(d.assign,2):this.finishOp(d.slash,1)};V.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),i=1,r=t===42?d.star:d.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++i,r=d.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(d.assign,i+1):this.finishOp(r,i)};V.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(d.assign,3)}return this.finishOp(t===124?d.logicalOR:d.logicalAND,2)}return e===61?this.finishOp(d.assign,2):this.finishOp(t===124?d.bitwiseOR:d.bitwiseAND,1)};V.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(d.assign,2):this.finishOp(d.bitwiseXOR,1)};V.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?e===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||ge.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(d.incDec,2):e===61?this.finishOp(d.assign,2):this.finishOp(d.plusMin,1)};V.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),i=1;return e===t?(i=t===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(d.assign,i+1):this.finishOp(d.bitShift,i)):e===33&&t===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(e===61&&(i=2),this.finishOp(d.relational,i))};V.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(d.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(d.arrow)):this.finishOp(t===61?d.eq:d.prefix,1)};V.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(e===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(d.questionDot,2)}if(e===63){if(t>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(d.assign,3)}return this.finishOp(d.coalesce,2)}}return this.finishOp(d.question,1)};V.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),Le(e,!0)||e===92))return this.finishToken(d.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Ue(e)+"'")};V.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(d.parenL);case 41:return++this.pos,this.finishToken(d.parenR);case 59:return++this.pos,this.finishToken(d.semi);case 44:return++this.pos,this.finishToken(d.comma);case 91:return++this.pos,this.finishToken(d.bracketL);case 93:return++this.pos,this.finishToken(d.bracketR);case 123:return++this.pos,this.finishToken(d.braceL);case 125:return++this.pos,this.finishToken(d.braceR);case 58:return++this.pos,this.finishToken(d.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(d.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(e===120||e===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(e===111||e===79)return this.readRadixNumber(8);if(e===98||e===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(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(d.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Ue(t)+"'")};V.finishOp=function(t,e){var i=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,i)};V.readRegexp=function(){for(var t,e,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(ge.test(r)&&this.raise(i,"Unterminated regular expression"),t)t=!1;else{if(r==="[")e=!0;else if(r==="]"&&e)e=!1;else if(r==="/"&&!e)break;t=r==="\\"}++this.pos}var s=this.input.slice(i,this.pos);++this.pos;var a=this.pos,n=this.readWord1();this.containsEsc&&this.unexpected(a);var o=this.regexpState||(this.regexpState=new Be(this));o.reset(i,s,n),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var l=null;try{l=new RegExp(s,n)}catch{}return this.finishToken(d.regexp,{pattern:s,flags:n,value:l})};V.readInt=function(t,e,i){for(var r=this.options.ecmaVersion>=12&&e===void 0,s=i&&this.input.charCodeAt(this.pos)===48,a=this.pos,n=0,o=0,l=0,c=e??1/0;l<c;++l,++this.pos){var h=this.input.charCodeAt(this.pos),p=void 0;if(r&&h===95){s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),o===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),l===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=h;continue}if(h>=97?p=h-97+10:h>=65?p=h-65+10:h>=48&&h<=57?p=h-48:p=1/0,p>=t)break;o=h,n=n*t+p}return r&&o===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||e!=null&&this.pos-a!==e?null:n};function nn(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function Wr(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}V.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var i=this.readInt(t);return i==null&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Wr(this.input.slice(e,this.pos)),++this.pos):Le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(d.num,i)};V.readNumber=function(t){var e=this.pos;!t&&this.readInt(10,void 0,!0)===null&&this.raise(e,"Invalid number");var i=this.pos-e>=2&&this.input.charCodeAt(e)===48;i&&this.strict&&this.raise(e,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!i&&!t&&this.options.ecmaVersion>=11&&r===110){var s=Wr(this.input.slice(e,this.pos));return++this.pos,Le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(d.num,s)}i&&/[89]/.test(this.input.slice(e,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(e,"Invalid number")),Le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=nn(this.input.slice(e,this.pos),i);return this.finishToken(d.num,a)};V.readCodePoint=function(){var t=this.input.charCodeAt(this.pos),e;if(t===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else e=this.readHexChar(4);return e};V.readString=function(t){for(var e="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===t)break;r===92?(e+=this.input.slice(i,this.pos),e+=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)):(gt(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(i,this.pos++),this.finishToken(d.string,e)};var Ur={};V.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t===Ur)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=!1};V.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ur;this.raise(t,e)};V.readTmplToken=function(){for(var t="",e=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===d.template||this.type===d.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(d.dollarBraceL)):(++this.pos,this.finishToken(d.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(d.template,t));if(i===92)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(gt(i)){switch(t+=this.input.slice(e,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:t+=`
|
|
23
|
-
`;break;default:t+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}};
|
|
22
|
+
`),cooked:this.value},this.next(),i.tail=this.type===d.backQuote,this.finishNode(i,"TemplateElement")};P.parseTemplate=function(t){t===void 0&&(t={});var e=t.isTagged;e===void 0&&(e=!1);var i=this.startNode();this.next(),i.expressions=[];var r=this.parseTemplateElement({isTagged:e});for(i.quasis=[r];!r.tail;)this.type===d.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(d.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(d.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(i,"TemplateLiteral")};P.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===d.name||this.type===d.num||this.type===d.string||this.type===d.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===d.star)&&!ge.test(this.input.slice(this.lastTokEnd,this.start))};P.parseObj=function(t,e){var i=this.startNode(),r=!0,s={};for(i.properties=[],this.next();!this.eat(d.braceR);){if(r)r=!1;else if(this.expect(d.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(d.braceR))break;var a=this.parseProperty(t,e);t||this.checkPropClash(a,s,e),i.properties.push(a)}return this.finishNode(i,t?"ObjectPattern":"ObjectExpression")};P.parseProperty=function(t,e){var i=this.startNode(),r,s,a,n;if(this.options.ecmaVersion>=9&&this.eat(d.ellipsis))return t?(i.argument=this.parseIdent(!1),this.type===d.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,e),this.type===d.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(t||e)&&(a=this.start,n=this.startLoc),t||(r=this.eat(d.star)));var o=this.containsEsc;return this.parsePropertyName(i),!t&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(s=!0,r=this.options.ecmaVersion>=9&&this.eat(d.star),this.parsePropertyName(i)):s=!1,this.parsePropertyValue(i,t,r,s,a,n,e,o),this.finishNode(i,"Property")};P.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(!1),t.kind=e;var i=t.kind==="get"?0:1;if(t.value.params.length!==i){var r=t.value.start;t.kind==="get"?this.raiseRecoverable(r,"getter should have no params"):this.raiseRecoverable(r,"setter should have exactly one param")}else t.kind==="set"&&t.value.params[0].type==="RestElement"&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")};P.parsePropertyValue=function(t,e,i,r,s,a,n,o){(i||r)&&this.type===d.colon&&this.unexpected(),this.eat(d.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,n),t.kind="init"):this.options.ecmaVersion>=6&&this.type===d.parenL?(e&&this.unexpected(),t.method=!0,t.value=this.parseMethod(i,r),t.kind="init"):!e&&!o&&this.options.ecmaVersion>=5&&!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.type!==d.comma&&this.type!==d.braceR&&this.type!==d.eq?((i||r)&&this.unexpected(),this.parseGetterSetter(t)):this.options.ecmaVersion>=6&&!t.computed&&t.key.type==="Identifier"?((i||r)&&this.unexpected(),this.checkUnreserved(t.key),t.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),e?t.value=this.parseMaybeDefault(s,a,this.copyNode(t.key)):this.type===d.eq&&n?(n.shorthandAssign<0&&(n.shorthandAssign=this.start),t.value=this.parseMaybeDefault(s,a,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected()};P.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(d.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(d.bracketR),t.key;t.computed=!1}return t.key=this.type===d.num||this.type===d.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};P.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)};P.parseMethod=function(t,e,i){var r=this.startNode(),s=this.yieldPos,a=this.awaitPos,n=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=t),this.options.ecmaVersion>=8&&(r.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(_i(e,r.generator)|qt|(i?yr:0)),this.expect(d.parenL),r.params=this.parseBindingList(d.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=n,this.finishNode(r,"FunctionExpression")};P.parseArrowExpression=function(t,e,i,r){var s=this.yieldPos,a=this.awaitPos,n=this.awaitIdentPos;return this.enterScope(_i(i,!1)|yi),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,r),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=n,this.finishNode(t,"ArrowFunctionExpression")};P.parseFunctionBody=function(t,e,i,r){var s=e&&this.type!==d.braceL,a=this.strict,n=!1;if(s)t.body=this.parseMaybeAssign(r),t.expression=!0,this.checkParams(t,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!a||o)&&(n=this.strictDirective(this.end),n&&o&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],n&&(this.strict=!0),this.checkParams(t,!a&&!n&&!e&&!i&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,wr),t.body=this.parseBlock(!1,void 0,n&&!a),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=l}this.exitScope()};P.isSimpleParamList=function(t){for(var e=0,i=t;e<i.length;e+=1){var r=i[e];if(r.type!=="Identifier")return!1}return!0};P.checkParams=function(t,e){for(var i=Object.create(null),r=0,s=t.params;r<s.length;r+=1){var a=s[r];this.checkLValInnerPattern(a,bi,e?null:i)}};P.parseExprList=function(t,e,i,r){for(var s=[],a=!0;!this.eat(t);){if(a)a=!1;else if(this.expect(d.comma),e&&this.afterTrailingComma(t))break;var n=void 0;i&&this.type===d.comma?n=null:this.type===d.ellipsis?(n=this.parseSpread(r),r&&this.type===d.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):n=this.parseMaybeAssign(!1,r),s.push(n)}return s};P.checkUnreserved=function(t){var e=t.start,i=t.end,r=t.name;if(this.inGenerator&&r==="yield"&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&r==="await"&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Kt)&&r==="arguments"&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(r==="arguments"||r==="await")&&this.raise(e,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(e,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,i).indexOf("\\")!==-1)){var s=this.strict?this.reservedWordsStrict:this.reservedWords;s.test(r)&&(!this.inAsync&&r==="await"&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+r+"' is reserved"))}};P.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),e.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e};P.parseIdentNode=function(){var t=this.startNode();return this.type===d.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,(t.name==="class"||t.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=d.name):this.unexpected(),t};P.parsePrivateIdent=function(){var t=this.startNode();return this.type===d.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t};P.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===d.semi||this.canInsertSemicolon()||this.type!==d.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(d.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};P.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var Mt=Z.prototype;Mt.raise=function(t,e){var i=mr(this.input,t);e+=" ("+i.line+":"+i.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var r=new SyntaxError(e);throw r.pos=t,r.loc=i,r.raisedAt=this.pos,r};Mt.raiseRecoverable=Mt.raise;Mt.curPosition=function(){if(this.options.locations)return new St(this.curLine,this.pos-this.lineStart)};var rt=Z.prototype,Bs=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};rt.enterScope=function(t){this.scopeStack.push(new Bs(t))};rt.exitScope=function(){this.scopeStack.pop()};rt.treatFunctionsAsVarInScope=function(t){return t.flags&ct||!this.inModule&&t.flags<};rt.declareName=function(t,e,i){var r=!1;if(e===Ke){var s=this.currentScope();r=s.lexical.indexOf(t)>-1||s.functions.indexOf(t)>-1||s.var.indexOf(t)>-1,s.lexical.push(t),this.inModule&&s.flags<&&delete this.undefinedExports[t]}else if(e===vr){var a=this.currentScope();a.lexical.push(t)}else if(e===br){var n=this.currentScope();this.treatFunctionsAsVar?r=n.lexical.indexOf(t)>-1:r=n.lexical.indexOf(t)>-1||n.var.indexOf(t)>-1,n.functions.push(t)}else for(var o=this.scopeStack.length-1;o>=0;--o){var l=this.scopeStack[o];if(l.lexical.indexOf(t)>-1&&!(l.flags&xr&&l.lexical[0]===t)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(t)>-1){r=!0;break}if(l.var.push(t),this.inModule&&l.flags<&&delete this.undefinedExports[t],l.flags&Kt)break}r&&this.raiseRecoverable(i,"Identifier '"+t+"' has already been declared")};rt.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};rt.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};rt.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Kt|Et|ht))return e}};rt.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Kt|Et|ht)&&!(e.flags&yi))return e}};var Ht=function(e,i,r){this.type="",this.start=i,this.end=0,e.options.locations&&(this.loc=new Ut(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[i,0])},Nt=Z.prototype;Nt.startNode=function(){return new Ht(this,this.start,this.startLoc)};Nt.startNodeAt=function(t,e){return new Ht(this,t,e)};function Nr(t,e,i,r){return t.type=e,t.end=i,this.options.locations&&(t.loc.end=r),this.options.ranges&&(t.range[1]=i),t}Nt.finishNode=function(t,e){return Nr.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};Nt.finishNodeAt=function(t,e,i,r){return Nr.call(this,t,e,i,r)};Nt.copyNode=function(t){var e=new Ht(this,t.start,this.startLoc);for(var i in t)e[i]=t[i];return e};var Fs="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",Cr="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",Ir=Cr+" Extended_Pictographic",kr=Ir,Ar=kr+" EBase EComp EMod EPres ExtPict",Tr=Ar,$s=Tr,Ws={9:Cr,10:Ir,11:kr,12:Ar,13:Tr,14:$s},Us="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",qs={9:"",10:"",11:"",12:"",13:"",14:Us},Pi="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",Pr="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",Dr=Pr+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Rr=Dr+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Or=Rr+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Mr=Or+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ks=Mr+" "+Fs,zs={9:Pr,10:Dr,11:Rr,12:Or,13:Mr,14:Ks},Vr={};function Hs(t){var e=Vr[t]={binary:et(Ws[t]+" "+Pi),binaryOfStrings:et(qs[t]),nonBinary:{General_Category:et(Pi),Script:et(zs[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(var Xt=0,Di=[9,10,11,12,13,14];Xt<Di.length;Xt+=1){var Gs=Di[Xt];Hs(Gs)}var k=Z.prototype,Vt=function(e,i){this.parent=e,this.base=i||this};Vt.prototype.separatedFrom=function(e){for(var i=this;i;i=i.parent)for(var r=e;r;r=r.parent)if(i.base===r.base&&i!==r)return!0;return!1};Vt.prototype.sibling=function(){return new Vt(this.parent,this.base)};var Be=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Vr[e.options.ecmaVersion>=14?14:e.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};Be.prototype.reset=function(e,i,r){var s=r.indexOf("v")!==-1,a=r.indexOf("u")!==-1;this.start=e|0,this.source=i+"",this.flags=r,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=a&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=a&&this.parser.options.ecmaVersion>=9)};Be.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};Be.prototype.at=function(e,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(e>=s)return-1;var a=r.charCodeAt(e);if(!(i||this.switchU)||a<=55295||a>=57344||e+1>=s)return a;var n=r.charCodeAt(e+1);return n>=56320&&n<=57343?(a<<10)+n-56613888:a};Be.prototype.nextIndex=function(e,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(e>=s)return s;var a=r.charCodeAt(e),n;return!(i||this.switchU)||a<=55295||a>=57344||e+1>=s||(n=r.charCodeAt(e+1))<56320||n>57343?e+1:e+2};Be.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)};Be.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)};Be.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)};Be.prototype.eat=function(e,i){return i===void 0&&(i=!1),this.current(i)===e?(this.advance(i),!0):!1};Be.prototype.eatChars=function(e,i){i===void 0&&(i=!1);for(var r=this.pos,s=0,a=e;s<a.length;s+=1){var n=a[s],o=this.at(r,i);if(o===-1||o!==n)return!1;r=this.nextIndex(r,i)}return this.pos=r,!0};k.validateRegExpFlags=function(t){for(var e=t.validFlags,i=t.flags,r=!1,s=!1,a=0;a<i.length;a++){var n=i.charAt(a);e.indexOf(n)===-1&&this.raise(t.start,"Invalid regular expression flag"),i.indexOf(n,a+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),n==="u"&&(r=!0),n==="v"&&(s=!0)}this.options.ecmaVersion>=15&&r&&s&&this.raise(t.start,"Invalid regular expression flag")};function Ys(t){for(var e in t)return!0;return!1}k.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&Ys(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))};k.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,i=t.backReferenceNames;e<i.length;e+=1){var r=i[e];t.groupNames[r]||t.raise("Invalid named capture referenced")}};k.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new Vt(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")};k.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};k.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))?(this.regexp_eatQuantifier(t),!0):!1};k.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!i,!0}return t.pos=e,!1};k.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=!1),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),!0):!1};k.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};k.regexp_eatBracedQuantifier=function(t,e){var i=t.pos;if(t.eat(123)){var r=0,s=-1;if(this.regexp_eatDecimalDigits(t)&&(r=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(s=t.lastIntValue),t.eat(125)))return s!==-1&&s<r&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=i}return!1};k.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)};k.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1};k.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(t),r=t.eat(45);if(i||r){for(var s=0;s<i.length;s++){var a=i.charAt(s);i.indexOf(a,s+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(r){var n=this.regexp_eatModifiers(t);!i&&!n&&t.current()===58&&t.raise("Invalid regular expression modifiers");for(var o=0;o<n.length;o++){var l=n.charAt(o);(n.indexOf(l,o+1)>-1||i.indexOf(l)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}}t.pos=e}return!1};k.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):t.current()===63&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1};k.regexp_eatModifiers=function(t){for(var e="",i=0;(i=t.current())!==-1&&Qs(i);)e+=Ue(i),t.advance();return e};function Qs(t){return t===105||t===109||t===115}k.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)};k.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1};k.regexp_eatSyntaxCharacter=function(t){var e=t.current();return Lr(e)?(t.lastIntValue=e,t.advance(),!0):!1};function Lr(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}k.regexp_eatPatternCharacters=function(t){for(var e=t.pos,i=0;(i=t.current())!==-1&&!Lr(i);)t.advance();return t.pos!==e};k.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return e!==-1&&e!==36&&!(e>=40&&e<=43)&&e!==46&&e!==63&&e!==91&&e!==94&&e!==124?(t.advance(),!0):!1};k.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,i=t.groupNames[t.lastStringValue];if(i)if(e)for(var r=0,s=i;r<s.length;r+=1){var a=s[r];a.separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(i||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=!0}};k.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1};k.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=Ue(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=Ue(t.lastIntValue);return!0}return!1};k.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,i=this.options.ecmaVersion>=11,r=t.current(i);return t.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,i)&&(r=t.lastIntValue),Xs(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function Xs(t){return Le(t,!0)||t===36||t===95}k.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,i=this.options.ecmaVersion>=11,r=t.current(i);return t.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,i)&&(r=t.lastIntValue),Zs(r)?(t.lastIntValue=r,!0):(t.pos=e,!1)};function Zs(t){return it(t,!0)||t===36||t===95||t===8204||t===8205}k.regexp_eatAtomEscape=function(t){return this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t)?!0:(t.switchU&&(t.current()===99&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)};k.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var i=t.lastIntValue;if(t.switchU)return i>t.maxBackReference&&(t.maxBackReference=i),!0;if(i<=t.numCapturingParens)return!0;t.pos=e}return!1};k.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1};k.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)};k.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1};k.regexp_eatZero=function(t){return t.current()===48&&!Gt(t.lookahead())?(t.lastIntValue=0,t.advance(),!0):!1};k.regexp_eatControlEscape=function(t){var e=t.current();return e===116?(t.lastIntValue=9,t.advance(),!0):e===110?(t.lastIntValue=10,t.advance(),!0):e===118?(t.lastIntValue=11,t.advance(),!0):e===102?(t.lastIntValue=12,t.advance(),!0):e===114?(t.lastIntValue=13,t.advance(),!0):!1};k.regexp_eatControlLetter=function(t){var e=t.current();return jr(e)?(t.lastIntValue=e%32,t.advance(),!0):!1};function jr(t){return t>=65&&t<=90||t>=97&&t<=122}k.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){e===void 0&&(e=!1);var i=t.pos,r=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var s=t.lastIntValue;if(r&&s>=55296&&s<=56319){var a=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var n=t.lastIntValue;if(n>=56320&&n<=57343)return t.lastIntValue=(s-55296)*1024+(n-56320)+65536,!0}t.pos=a,t.lastIntValue=s}return!0}if(r&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&Js(t.lastIntValue))return!0;r&&t.raise("Invalid unicode escape"),t.pos=i}return!1};function Js(t){return t>=0&&t<=1114111}k.regexp_eatIdentityEscape=function(t){if(t.switchU)return this.regexp_eatSyntaxCharacter(t)?!0:t.eat(47)?(t.lastIntValue=47,!0):!1;var e=t.current();return e!==99&&(!t.switchN||e!==107)?(t.lastIntValue=e,t.advance(),!0):!1};k.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do t.lastIntValue=10*t.lastIntValue+(e-48),t.advance();while((e=t.current())>=48&&e<=57);return!0}return!1};var Br=0,qe=1,Ne=2;k.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(en(e))return t.lastIntValue=-1,t.advance(),qe;var i=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((i=e===80)||e===112)){t.lastIntValue=-1,t.advance();var r;if(t.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return i&&r===Ne&&t.raise("Invalid property name"),r;t.raise("Invalid property name")}return Br};function en(t){return t===100||t===68||t===115||t===83||t===119||t===87}k.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var i=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var r=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,i,r),qe}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var s=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,s)}return Br};k.regexp_validateUnicodePropertyNameAndValue=function(t,e,i){xt(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(i)||t.raise("Invalid property value")};k.regexp_validateUnicodePropertyNameOrValue=function(t,e){if(t.unicodeProperties.binary.test(e))return qe;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return Ne;t.raise("Invalid property name")};k.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Fr(e=t.current());)t.lastStringValue+=Ue(e),t.advance();return t.lastStringValue!==""};function Fr(t){return jr(t)||t===95}k.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";tn(e=t.current());)t.lastStringValue+=Ue(e),t.advance();return t.lastStringValue!==""};function tn(t){return Fr(t)||Gt(t)}k.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};k.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),i=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&i===Ne&&t.raise("Negated character class may contain strings"),!0}return!1};k.regexp_classContents=function(t){return t.current()===93?qe:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),qe)};k.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var i=t.lastIntValue;t.switchU&&(e===-1||i===-1)&&t.raise("Invalid character class"),e!==-1&&i!==-1&&e>i&&t.raise("Range out of order in character class")}}};k.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var i=t.current();(i===99||Ur(i))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var r=t.current();return r!==93?(t.lastIntValue=r,t.advance(),!0):!1};k.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)};k.regexp_classSetExpression=function(t){var e=qe,i;if(!this.regexp_eatClassSetRange(t))if(i=this.regexp_eatClassSetOperand(t)){i===Ne&&(e=Ne);for(var r=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(i=this.regexp_eatClassSetOperand(t))){i!==Ne&&(e=qe);continue}t.raise("Invalid character in character class")}if(r!==t.pos)return e;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(r!==t.pos)return e}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(i=this.regexp_eatClassSetOperand(t),!i)return e;i===Ne&&(e=Ne)}};k.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var r=t.lastIntValue;return i!==-1&&r!==-1&&i>r&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1};k.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?qe:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)};k.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var i=t.eat(94),r=this.regexp_classContents(t);if(t.eat(93))return i&&r===Ne&&t.raise("Negated character class may contain strings"),r;t.pos=e}if(t.eat(92)){var s=this.regexp_eatCharacterClassEscape(t);if(s)return s;t.pos=e}return null};k.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var i=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return i}else t.raise("Invalid escape");t.pos=e}return null};k.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===Ne&&(e=Ne);return e};k.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?qe:Ne};k.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return this.regexp_eatCharacterEscape(t)||this.regexp_eatClassSetReservedPunctuator(t)?!0:t.eat(98)?(t.lastIntValue=8,!0):(t.pos=e,!1);var i=t.current();return i<0||i===t.lookahead()&&rn(i)||sn(i)?!1:(t.advance(),t.lastIntValue=i,!0)};function rn(t){return t===33||t>=35&&t<=38||t>=42&&t<=44||t===46||t>=58&&t<=64||t===94||t===96||t===126}function sn(t){return t===40||t===41||t===45||t===47||t>=91&&t<=93||t>=123&&t<=125}k.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return nn(e)?(t.lastIntValue=e,t.advance(),!0):!1};function nn(t){return t===33||t===35||t===37||t===38||t===44||t===45||t>=58&&t<=62||t===64||t===96||t===126}k.regexp_eatClassControlLetter=function(t){var e=t.current();return Gt(e)||e===95?(t.lastIntValue=e%32,t.advance(),!0):!1};k.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1};k.regexp_eatDecimalDigits=function(t){var e=t.pos,i=0;for(t.lastIntValue=0;Gt(i=t.current());)t.lastIntValue=10*t.lastIntValue+(i-48),t.advance();return t.pos!==e};function Gt(t){return t>=48&&t<=57}k.regexp_eatHexDigits=function(t){var e=t.pos,i=0;for(t.lastIntValue=0;$r(i=t.current());)t.lastIntValue=16*t.lastIntValue+Wr(i),t.advance();return t.pos!==e};function $r(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function Wr(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}k.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var i=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=e*64+i*8+t.lastIntValue:t.lastIntValue=e*8+i}else t.lastIntValue=e;return!0}return!1};k.regexp_eatOctalDigit=function(t){var e=t.current();return Ur(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)};function Ur(t){return t>=48&&t<=55}k.regexp_eatFixedHexDigits=function(t,e){var i=t.pos;t.lastIntValue=0;for(var r=0;r<e;++r){var s=t.current();if(!$r(s))return t.pos=i,!1;t.lastIntValue=16*t.lastIntValue+Wr(s),t.advance()}return!0};var wi=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Ut(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},M=Z.prototype;M.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new wi(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};M.getToken=function(){return this.next(),new wi(this)};typeof Symbol<"u"&&(M[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===d.eof,value:e}}}});M.nextToken=function(){var t=this.curContext();if((!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(d.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};M.readToken=function(t){return Le(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};M.fullCharCodeAt=function(t){var e=this.input.charCodeAt(t);if(e<=55295||e>=56320)return e;var i=this.input.charCodeAt(t+1);return i<=56319||i>=57344?e:(e<<10)+i-56613888};M.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};M.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var r=void 0,s=e;(r=pr(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,i),e,this.pos,t,this.curPosition())};M.skipLineComment=function(t){for(var e=this.pos,i=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!gt(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,i,this.curPosition())};M.skipSpace=function(){e:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){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(t>8&&t<14||t>=5760&&fr.test(String.fromCharCode(t)))++this.pos;else break e}}};M.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=t,this.value=e,this.updateContext(i)};M.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&t===46&&e===46?(this.pos+=3,this.finishToken(d.ellipsis)):(++this.pos,this.finishToken(d.dot))};M.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(d.assign,2):this.finishOp(d.slash,1)};M.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),i=1,r=t===42?d.star:d.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++i,r=d.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(d.assign,i+1):this.finishOp(r,i)};M.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(d.assign,3)}return this.finishOp(t===124?d.logicalOR:d.logicalAND,2)}return e===61?this.finishOp(d.assign,2):this.finishOp(t===124?d.bitwiseOR:d.bitwiseAND,1)};M.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(d.assign,2):this.finishOp(d.bitwiseXOR,1)};M.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?e===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||ge.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(d.incDec,2):e===61?this.finishOp(d.assign,2):this.finishOp(d.plusMin,1)};M.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),i=1;return e===t?(i=t===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(d.assign,i+1):this.finishOp(d.bitShift,i)):e===33&&t===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(e===61&&(i=2),this.finishOp(d.relational,i))};M.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(d.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(d.arrow)):this.finishOp(t===61?d.eq:d.prefix,1)};M.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(e===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(d.questionDot,2)}if(e===63){if(t>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(d.assign,3)}return this.finishOp(d.coalesce,2)}}return this.finishOp(d.question,1)};M.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),Le(e,!0)||e===92))return this.finishToken(d.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Ue(e)+"'")};M.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(d.parenL);case 41:return++this.pos,this.finishToken(d.parenR);case 59:return++this.pos,this.finishToken(d.semi);case 44:return++this.pos,this.finishToken(d.comma);case 91:return++this.pos,this.finishToken(d.bracketL);case 93:return++this.pos,this.finishToken(d.bracketR);case 123:return++this.pos,this.finishToken(d.braceL);case 125:return++this.pos,this.finishToken(d.braceR);case 58:return++this.pos,this.finishToken(d.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(d.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(e===120||e===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(e===111||e===79)return this.readRadixNumber(8);if(e===98||e===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(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(d.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Ue(t)+"'")};M.finishOp=function(t,e){var i=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,i)};M.readRegexp=function(){for(var t,e,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(ge.test(r)&&this.raise(i,"Unterminated regular expression"),t)t=!1;else{if(r==="[")e=!0;else if(r==="]"&&e)e=!1;else if(r==="/"&&!e)break;t=r==="\\"}++this.pos}var s=this.input.slice(i,this.pos);++this.pos;var a=this.pos,n=this.readWord1();this.containsEsc&&this.unexpected(a);var o=this.regexpState||(this.regexpState=new Be(this));o.reset(i,s,n),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var l=null;try{l=new RegExp(s,n)}catch{}return this.finishToken(d.regexp,{pattern:s,flags:n,value:l})};M.readInt=function(t,e,i){for(var r=this.options.ecmaVersion>=12&&e===void 0,s=i&&this.input.charCodeAt(this.pos)===48,a=this.pos,n=0,o=0,l=0,c=e??1/0;l<c;++l,++this.pos){var h=this.input.charCodeAt(this.pos),p=void 0;if(r&&h===95){s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),o===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),l===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=h;continue}if(h>=97?p=h-97+10:h>=65?p=h-65+10:h>=48&&h<=57?p=h-48:p=1/0,p>=t)break;o=h,n=n*t+p}return r&&o===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||e!=null&&this.pos-a!==e?null:n};function an(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function qr(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}M.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var i=this.readInt(t);return i==null&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=qr(this.input.slice(e,this.pos)),++this.pos):Le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(d.num,i)};M.readNumber=function(t){var e=this.pos;!t&&this.readInt(10,void 0,!0)===null&&this.raise(e,"Invalid number");var i=this.pos-e>=2&&this.input.charCodeAt(e)===48;i&&this.strict&&this.raise(e,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!i&&!t&&this.options.ecmaVersion>=11&&r===110){var s=qr(this.input.slice(e,this.pos));return++this.pos,Le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(d.num,s)}i&&/[89]/.test(this.input.slice(e,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(e,"Invalid number")),Le(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=an(this.input.slice(e,this.pos),i);return this.finishToken(d.num,a)};M.readCodePoint=function(){var t=this.input.charCodeAt(this.pos),e;if(t===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else e=this.readHexChar(4);return e};M.readString=function(t){for(var e="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===t)break;r===92?(e+=this.input.slice(i,this.pos),e+=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)):(gt(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(i,this.pos++),this.finishToken(d.string,e)};var Kr={};M.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t===Kr)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=!1};M.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Kr;this.raise(t,e)};M.readTmplToken=function(){for(var t="",e=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===d.template||this.type===d.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(d.dollarBraceL)):(++this.pos,this.finishToken(d.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(d.template,t));if(i===92)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(gt(i)){switch(t+=this.input.slice(e,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:t+=`
|
|
23
|
+
`;break;default:t+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}};M.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(d.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
|
|
24
24
|
`&&++this.pos;case`
|
|
25
|
-
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};
|
|
26
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Ue(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"),t){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(r,8);return s>255&&(r=r.slice(0,-1),s=parseInt(r,8)),this.pos+=r.length-1,e=this.input.charCodeAt(this.pos),(r!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-r.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return gt(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}};
|
|
25
|
+
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};M.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return`
|
|
26
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Ue(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"),t){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(r,8);return s>255&&(r=r.slice(0,-1),s=parseInt(r,8)),this.pos+=r.length-1,e=this.input.charCodeAt(this.pos),(r!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-r.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return gt(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}};M.readHexChar=function(t){var e=this.pos,i=this.readInt(16,t);return i===null&&this.invalidStringToken(e,"Bad character escape sequence"),i};M.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if(it(s,r))this.pos+=s<=65535?1:2;else if(s===92){this.containsEsc=!0,t+=this.input.slice(i,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var n=this.readCodePoint();(e?Le:it)(n,r)||this.invalidStringToken(a,"Invalid Unicode escape"),t+=Ue(n),i=this.pos}else break;e=!1}return t+this.input.slice(i,this.pos)};M.readWord=function(){var t=this.readWord1(),e=d.name;return this.keywords.test(t)&&(e=gi[t]),this.finishToken(e,t)};var on="8.16.0";Z.acorn={Parser:Z,version:on,defaultOptions:ai,Position:St,SourceLocation:Ut,getLineInfo:mr,Node:Ht,TokenType:j,tokTypes:d,keywordTypes:gi,TokContext:Pe,tokContexts:z,isIdentifierChar:it,isIdentifierStart:Le,Token:wi,isNewLine:gt,lineBreak:ge,lineBreakG:ks,nonASCIIwhitespace:fr};function zr(t,e){return Z.parse(t,e)}const{stringify:ln}=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 It={"||":2,"??":3,"&&":4,"|":5,"^":6,"&":7,"==":8,"!=":8,"===":8,"!==":8,"<":9,">":9,"<=":9,">=":9,in:9,instanceof:9,"<<":10,">>":10,">>>":10,"+":11,"-":11,"*":12,"%":12,"/":12,"**":13},De=17,cn={ArrayExpression:20,TaggedTemplateExpression:20,ThisExpression:20,Identifier:20,PrivateIdentifier:20,Literal:18,TemplateLiteral:20,Super:20,SequenceExpression:20,MemberExpression:19,ChainExpression:19,CallExpression:19,NewExpression:19,ArrowFunctionExpression:De,ClassExpression:De,FunctionExpression:De,ObjectExpression:De,UpdateExpression:16,UnaryExpression:15,AwaitExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,YieldExpression:2,RestElement:1};function dt(t,e){const{generator:i}=t;if(t.write("("),e!=null&&e.length>0){i[e[0].type](e[0],t);const{length:r}=e;for(let s=1;s<r;s++){const a=e[s];t.write(", "),i[a.type](a,t)}}t.write(")")}function Hr(t,e,i,r){const s=t.expressionsPrecedence[e.type];if(s===De)return!0;const a=t.expressionsPrecedence[i.type];return s!==a?!r&&s===15&&a===14&&i.operator==="**"||s<a:s!==13&&s!==14?!1:e.operator==="**"&&i.operator==="**"?!r:s===13&&a===13&&(e.operator==="??"||i.operator==="??")?!0:r?It[e.operator]<=It[i.operator]:It[e.operator]<It[i.operator]}function kt(t,e,i,r){const{generator:s}=t;Hr(t,e,i,r)?(t.write("("),s[e.type](e,t),t.write(")")):s[e.type](e,t)}function hn(t,e,i,r){const s=e.split(`
|
|
27
27
|
`),a=s.length-1;if(t.write(s[0].trim()),a>0){t.write(r);for(let n=1;n<a;n++)t.write(i+s[n].trim()+r);t.write(i+s[a].trim())}}function le(t,e,i,r){const{length:s}=e;for(let a=0;a<s;a++){const n=e[a];t.write(i),n.type[0]==="L"?t.write("// "+n.value.trim()+`
|
|
28
|
-
`,n):(t.write("/*"),cn(t,n.value,i,r),t.write("*/"+r))}}function hn(t){let e=t;for(;e!=null;){const{type:i}=e;if(i[0]==="C"&&i[1]==="a")return!0;if(i[0]==="M"&&i[1]==="e"&&i[2]==="m")e=e.object;else return!1}}function Qt(t,e){const{generator:i}=t,{declarations:r}=e;t.write(e.kind+" ");const{length:s}=r;if(s>0){i.VariableDeclarator(r[0],t);for(let a=1;a<s;a++)t.write(", "),i.VariableDeclarator(r[a],t)}}let Pi,Di,Ri,Oi,Vi,Mi;const vi={Program(t,e){const i=e.indent.repeat(e.indentLevel),{lineEnd:r,writeComments:s}=e;s&&t.comments!=null&&le(e,t.comments,i,r);const a=t.body,{length:n}=a;for(let o=0;o<n;o++){const l=a[o];s&&l.comments!=null&&le(e,l.comments,i,r),e.write(i),this[l.type](l,e),e.write(r)}s&&t.trailingComments!=null&&le(e,t.trailingComments,i,r)},BlockStatement:Mi=function(t,e){const i=e.indent.repeat(e.indentLevel++),{lineEnd:r,writeComments:s}=e,a=i+e.indent;e.write("{");const n=t.body;if(n!=null&&n.length>0){e.write(r),s&&t.comments!=null&&le(e,t.comments,a,r);const{length:o}=n;for(let l=0;l<o;l++){const c=n[l];s&&c.comments!=null&&le(e,c.comments,a,r),e.write(a),this[c.type](c,e),e.write(r)}e.write(i)}else s&&t.comments!=null&&(e.write(r),le(e,t.comments,a,r),e.write(i));s&&t.trailingComments!=null&&le(e,t.trailingComments,a,r),e.write("}"),e.indentLevel--},ClassBody:Mi,StaticBlock(t,e){e.write("static "),this.BlockStatement(t,e)},EmptyStatement(t,e){e.write(";")},ExpressionStatement(t,e){const i=e.expressionsPrecedence[t.expression.type];i===De||i===3&&t.expression.left.type[0]==="O"?(e.write("("),this[t.expression.type](t.expression,e),e.write(")")):this[t.expression.type](t.expression,e),e.write(";")},IfStatement(t,e){e.write("if ("),this[t.test.type](t.test,e),e.write(") "),this[t.consequent.type](t.consequent,e),t.alternate!=null&&(e.write(" else "),this[t.alternate.type](t.alternate,e))},LabeledStatement(t,e){this[t.label.type](t.label,e),e.write(": "),this[t.body.type](t.body,e)},BreakStatement(t,e){e.write("break"),t.label!=null&&(e.write(" "),this[t.label.type](t.label,e)),e.write(";")},ContinueStatement(t,e){e.write("continue"),t.label!=null&&(e.write(" "),this[t.label.type](t.label,e)),e.write(";")},WithStatement(t,e){e.write("with ("),this[t.object.type](t.object,e),e.write(") "),this[t.body.type](t.body,e)},SwitchStatement(t,e){const i=e.indent.repeat(e.indentLevel++),{lineEnd:r,writeComments:s}=e;e.indentLevel++;const a=i+e.indent,n=a+e.indent;e.write("switch ("),this[t.discriminant.type](t.discriminant,e),e.write(") {"+r);const{cases:o}=t,{length:l}=o;for(let c=0;c<l;c++){const h=o[c];s&&h.comments!=null&&le(e,h.comments,a,r),h.test?(e.write(a+"case "),this[h.test.type](h.test,e),e.write(":"+r)):e.write(a+"default:"+r);const{consequent:p}=h,{length:u}=p;for(let f=0;f<u;f++){const m=p[f];s&&m.comments!=null&&le(e,m.comments,n,r),e.write(n),this[m.type](m,e),e.write(r)}}e.indentLevel-=2,e.write(i+"}")},ReturnStatement(t,e){e.write("return"),t.argument&&(e.write(" "),this[t.argument.type](t.argument,e)),e.write(";")},ThrowStatement(t,e){e.write("throw "),this[t.argument.type](t.argument,e),e.write(";")},TryStatement(t,e){if(e.write("try "),this[t.block.type](t.block,e),t.handler){const{handler:i}=t;i.param==null?e.write(" catch "):(e.write(" catch ("),this[i.param.type](i.param,e),e.write(") ")),this[i.body.type](i.body,e)}t.finalizer&&(e.write(" finally "),this[t.finalizer.type](t.finalizer,e))},WhileStatement(t,e){e.write("while ("),this[t.test.type](t.test,e),e.write(") "),this[t.body.type](t.body,e)},DoWhileStatement(t,e){e.write("do "),this[t.body.type](t.body,e),e.write(" while ("),this[t.test.type](t.test,e),e.write(");")},ForStatement(t,e){if(e.write("for ("),t.init!=null){const{init:i}=t;i.type[0]==="V"?Qt(e,i):this[i.type](i,e)}e.write("; "),t.test&&this[t.test.type](t.test,e),e.write("; "),t.update&&this[t.update.type](t.update,e),e.write(") "),this[t.body.type](t.body,e)},ForInStatement:Pi=function(t,e){e.write(`for ${t.await?"await ":""}(`);const{left:i}=t;i.type[0]==="V"?Qt(e,i):this[i.type](i,e),e.write(t.type[3]==="I"?" in ":" of "),this[t.right.type](t.right,e),e.write(") "),this[t.body.type](t.body,e)},ForOfStatement:Pi,DebuggerStatement(t,e){e.write("debugger;",t)},FunctionDeclaration:Di=function(t,e){e.write((t.async?"async ":"")+(t.generator?"function* ":"function ")+(t.id?t.id.name:""),t),dt(e,t.params),e.write(" "),this[t.body.type](t.body,e)},FunctionExpression:Di,VariableDeclaration(t,e){Qt(e,t),e.write(";")},VariableDeclarator(t,e){this[t.id.type](t.id,e),t.init!=null&&(e.write(" = "),this[t.init.type](t.init,e))},ClassDeclaration(t,e){if(e.write("class "+(t.id?`${t.id.name} `:""),t),t.superClass){e.write("extends ");const{superClass:i}=t,{type:r}=i,s=e.expressionsPrecedence[r];(r[0]!=="C"||r[1]!=="l"||r[5]!=="E")&&(s===De||s<e.expressionsPrecedence.ClassExpression)?(e.write("("),this[t.superClass.type](i,e),e.write(")")):this[i.type](i,e),e.write(" ")}this.ClassBody(t.body,e)},ImportDeclaration(t,e){e.write("import ");const{specifiers:i,attributes:r}=t,{length:s}=i;let a=0;if(s>0){for(;a<s;){a>0&&e.write(", ");const n=i[a],o=n.type[6];if(o==="D")e.write(n.local.name,n),a++;else if(o==="N")e.write("* as "+n.local.name,n),a++;else break}if(a<s){for(e.write("{");;){const n=i[a],{name:o}=n.imported;if(e.write(o,n),o!==n.local.name&&e.write(" as "+n.local.name),++a<s)e.write(", ");else break}e.write("}")}e.write(" from ")}if(this.Literal(t.source,e),r&&r.length>0){e.write(" with { ");for(let n=0;n<r.length;n++)this.ImportAttribute(r[n],e),n<r.length-1&&e.write(", ");e.write(" }")}e.write(";")},ImportAttribute(t,e){this.Identifier(t.key,e),e.write(": "),this.Literal(t.value,e)},ImportExpression(t,e){e.write("import("),this[t.source.type](t.source,e),e.write(")")},ExportDefaultDeclaration(t,e){e.write("export default "),this[t.declaration.type](t.declaration,e),e.expressionsPrecedence[t.declaration.type]!=null&&t.declaration.type[0]!=="F"&&e.write(";")},ExportNamedDeclaration(t,e){if(e.write("export "),t.declaration)this[t.declaration.type](t.declaration,e);else{e.write("{");const{specifiers:i}=t,{length:r}=i;if(r>0)for(let s=0;;){const a=i[s],{name:n}=a.local;if(e.write(n,a),n!==a.exported.name&&e.write(" as "+a.exported.name),++s<r)e.write(", ");else break}if(e.write("}"),t.source&&(e.write(" from "),this.Literal(t.source,e)),t.attributes&&t.attributes.length>0){e.write(" with { ");for(let s=0;s<t.attributes.length;s++)this.ImportAttribute(t.attributes[s],e),s<t.attributes.length-1&&e.write(", ");e.write(" }")}e.write(";")}},ExportAllDeclaration(t,e){if(t.exported!=null?e.write("export * as "+t.exported.name+" from "):e.write("export * from "),this.Literal(t.source,e),t.attributes&&t.attributes.length>0){e.write(" with { ");for(let i=0;i<t.attributes.length;i++)this.ImportAttribute(t.attributes[i],e),i<t.attributes.length-1&&e.write(", ");e.write(" }")}e.write(";")},MethodDefinition(t,e){t.static&&e.write("static ");const i=t.kind[0];(i==="g"||i==="s")&&e.write(t.kind+" "),t.value.async&&e.write("async "),t.value.generator&&e.write("*"),t.computed?(e.write("["),this[t.key.type](t.key,e),e.write("]")):this[t.key.type](t.key,e),dt(e,t.value.params),e.write(" "),this[t.value.body.type](t.value.body,e)},ClassExpression(t,e){this.ClassDeclaration(t,e)},ArrowFunctionExpression(t,e){e.write(t.async?"async ":"",t);const{params:i}=t;i!=null&&(i.length===1&&i[0].type[0]==="I"?e.write(i[0].name,i[0]):dt(e,t.params)),e.write(" => "),t.body.type[0]==="O"?(e.write("("),this.ObjectExpression(t.body,e),e.write(")")):this[t.body.type](t.body,e)},ThisExpression(t,e){e.write("this",t)},Super(t,e){e.write("super",t)},RestElement:Ri=function(t,e){e.write("..."),this[t.argument.type](t.argument,e)},SpreadElement:Ri,YieldExpression(t,e){e.write(t.delegate?"yield*":"yield"),t.argument&&(e.write(" "),this[t.argument.type](t.argument,e))},AwaitExpression(t,e){e.write("await ",t),kt(e,t.argument,t)},TemplateLiteral(t,e){const{quasis:i,expressions:r}=t;e.write("`");const{length:s}=r;for(let n=0;n<s;n++){const o=r[n],l=i[n];e.write(l.value.raw,l),e.write("${"),this[o.type](o,e),e.write("}")}const a=i[i.length-1];e.write(a.value.raw,a),e.write("`")},TemplateElement(t,e){e.write(t.value.raw,t)},TaggedTemplateExpression(t,e){kt(e,t.tag,t),this[t.quasi.type](t.quasi,e)},ArrayExpression:Vi=function(t,e){if(e.write("["),t.elements.length>0){const{elements:i}=t,{length:r}=i;for(let s=0;;){const a=i[s];if(a!=null&&this[a.type](a,e),++s<r)e.write(", ");else{a==null&&e.write(", ");break}}}e.write("]")},ArrayPattern:Vi,ObjectExpression(t,e){const i=e.indent.repeat(e.indentLevel++),{lineEnd:r,writeComments:s}=e,a=i+e.indent;if(e.write("{"),t.properties.length>0){e.write(r),s&&t.comments!=null&&le(e,t.comments,a,r);const n=","+r,{properties:o}=t,{length:l}=o;for(let c=0;;){const h=o[c];if(s&&h.comments!=null&&le(e,h.comments,a,r),e.write(a),this[h.type](h,e),++c<l)e.write(n);else break}e.write(r),s&&t.trailingComments!=null&&le(e,t.trailingComments,a,r),e.write(i+"}")}else s?t.comments!=null?(e.write(r),le(e,t.comments,a,r),t.trailingComments!=null&&le(e,t.trailingComments,a,r),e.write(i+"}")):t.trailingComments!=null?(e.write(r),le(e,t.trailingComments,a,r),e.write(i+"}")):e.write("}"):e.write("}");e.indentLevel--},Property(t,e){t.method||t.kind[0]!=="i"?this.MethodDefinition(t,e):(t.shorthand||(t.computed?(e.write("["),this[t.key.type](t.key,e),e.write("]")):this[t.key.type](t.key,e),e.write(": ")),this[t.value.type](t.value,e))},PropertyDefinition(t,e){if(t.static&&e.write("static "),t.computed&&e.write("["),this[t.key.type](t.key,e),t.computed&&e.write("]"),t.value==null){t.key.type[0]!=="F"&&e.write(";");return}e.write(" = "),this[t.value.type](t.value,e),e.write(";")},ObjectPattern(t,e){if(e.write("{"),t.properties.length>0){const{properties:i}=t,{length:r}=i;for(let s=0;this[i[s].type](i[s],e),++s<r;)e.write(", ")}e.write("}")},SequenceExpression(t,e){dt(e,t.expressions)},UnaryExpression(t,e){if(t.prefix){const{operator:i,argument:r,argument:{type:s}}=t;e.write(i);const a=Kr(e,r,t);!a&&(i.length>1||s[0]==="U"&&(s[1]==="n"||s[1]==="p")&&r.prefix&&r.operator[0]===i&&(i==="+"||i==="-"))&&e.write(" "),a?(e.write(i.length>1?" (":"("),this[s](r,e),e.write(")")):this[s](r,e)}else this[t.argument.type](t.argument,e),e.write(t.operator)},UpdateExpression(t,e){t.prefix?(e.write(t.operator),this[t.argument.type](t.argument,e)):(this[t.argument.type](t.argument,e),e.write(t.operator))},AssignmentExpression(t,e){this[t.left.type](t.left,e),e.write(" "+t.operator+" "),this[t.right.type](t.right,e)},AssignmentPattern(t,e){this[t.left.type](t.left,e),e.write(" = "),this[t.right.type](t.right,e)},BinaryExpression:Oi=function(t,e){const i=t.operator==="in";i&&e.write("("),kt(e,t.left,t,!1),e.write(" "+t.operator+" "),kt(e,t.right,t,!0),i&&e.write(")")},LogicalExpression:Oi,ConditionalExpression(t,e){const{test:i}=t,r=e.expressionsPrecedence[i.type];r===De||r<=e.expressionsPrecedence.ConditionalExpression?(e.write("("),this[i.type](i,e),e.write(")")):this[i.type](i,e),e.write(" ? "),this[t.consequent.type](t.consequent,e),e.write(" : "),this[t.alternate.type](t.alternate,e)},NewExpression(t,e){e.write("new ");const i=e.expressionsPrecedence[t.callee.type];i===De||i<e.expressionsPrecedence.CallExpression||hn(t.callee)?(e.write("("),this[t.callee.type](t.callee,e),e.write(")")):this[t.callee.type](t.callee,e),dt(e,t.arguments)},CallExpression(t,e){const i=e.expressionsPrecedence[t.callee.type];i===De||i<e.expressionsPrecedence.CallExpression?(e.write("("),this[t.callee.type](t.callee,e),e.write(")")):this[t.callee.type](t.callee,e),t.optional&&e.write("?."),dt(e,t.arguments)},ChainExpression(t,e){this[t.expression.type](t.expression,e)},MemberExpression(t,e){const i=e.expressionsPrecedence[t.object.type];i===De||i<e.expressionsPrecedence.MemberExpression?(e.write("("),this[t.object.type](t.object,e),e.write(")")):this[t.object.type](t.object,e),t.computed?(t.optional&&e.write("?."),e.write("["),this[t.property.type](t.property,e),e.write("]")):(t.optional?e.write("?."):e.write("."),this[t.property.type](t.property,e))},MetaProperty(t,e){e.write(t.meta.name+"."+t.property.name,t)},Identifier(t,e){e.write(t.name,t)},PrivateIdentifier(t,e){e.write(`#${t.name}`,t)},Literal(t,e){t.raw!=null?e.write(t.raw,t):t.regex!=null?this.RegExpLiteral(t,e):t.bigint!=null?e.write(t.bigint+"n",t):e.write(on(t.value),t)},RegExpLiteral(t,e){const{regex:i}=t;e.write(`/${i.pattern}/${i.flags}`,t)}},un={},pn=vi;class fn{constructor(e){const i=e??un;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:vi,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:ln,this.indent=i.indent!=null?i.indent:" ",this.lineEnd=i.lineEnd!=null?i.lineEnd:`
|
|
28
|
+
`,n):(t.write("/*"),hn(t,n.value,i,r),t.write("*/"+r))}}function un(t){let e=t;for(;e!=null;){const{type:i}=e;if(i[0]==="C"&&i[1]==="a")return!0;if(i[0]==="M"&&i[1]==="e"&&i[2]==="m")e=e.object;else return!1}}function Zt(t,e){const{generator:i}=t,{declarations:r}=e;t.write(e.kind+" ");const{length:s}=r;if(s>0){i.VariableDeclarator(r[0],t);for(let a=1;a<s;a++)t.write(", "),i.VariableDeclarator(r[a],t)}}let Ri,Oi,Mi,Vi,Li,ji;const Si={Program(t,e){const i=e.indent.repeat(e.indentLevel),{lineEnd:r,writeComments:s}=e;s&&t.comments!=null&&le(e,t.comments,i,r);const a=t.body,{length:n}=a;for(let o=0;o<n;o++){const l=a[o];s&&l.comments!=null&&le(e,l.comments,i,r),e.write(i),this[l.type](l,e),e.write(r)}s&&t.trailingComments!=null&&le(e,t.trailingComments,i,r)},BlockStatement:ji=function(t,e){const i=e.indent.repeat(e.indentLevel++),{lineEnd:r,writeComments:s}=e,a=i+e.indent;e.write("{");const n=t.body;if(n!=null&&n.length>0){e.write(r),s&&t.comments!=null&&le(e,t.comments,a,r);const{length:o}=n;for(let l=0;l<o;l++){const c=n[l];s&&c.comments!=null&&le(e,c.comments,a,r),e.write(a),this[c.type](c,e),e.write(r)}e.write(i)}else s&&t.comments!=null&&(e.write(r),le(e,t.comments,a,r),e.write(i));s&&t.trailingComments!=null&&le(e,t.trailingComments,a,r),e.write("}"),e.indentLevel--},ClassBody:ji,StaticBlock(t,e){e.write("static "),this.BlockStatement(t,e)},EmptyStatement(t,e){e.write(";")},ExpressionStatement(t,e){const i=e.expressionsPrecedence[t.expression.type];i===De||i===3&&t.expression.left.type[0]==="O"?(e.write("("),this[t.expression.type](t.expression,e),e.write(")")):this[t.expression.type](t.expression,e),e.write(";")},IfStatement(t,e){e.write("if ("),this[t.test.type](t.test,e),e.write(") "),this[t.consequent.type](t.consequent,e),t.alternate!=null&&(e.write(" else "),this[t.alternate.type](t.alternate,e))},LabeledStatement(t,e){this[t.label.type](t.label,e),e.write(": "),this[t.body.type](t.body,e)},BreakStatement(t,e){e.write("break"),t.label!=null&&(e.write(" "),this[t.label.type](t.label,e)),e.write(";")},ContinueStatement(t,e){e.write("continue"),t.label!=null&&(e.write(" "),this[t.label.type](t.label,e)),e.write(";")},WithStatement(t,e){e.write("with ("),this[t.object.type](t.object,e),e.write(") "),this[t.body.type](t.body,e)},SwitchStatement(t,e){const i=e.indent.repeat(e.indentLevel++),{lineEnd:r,writeComments:s}=e;e.indentLevel++;const a=i+e.indent,n=a+e.indent;e.write("switch ("),this[t.discriminant.type](t.discriminant,e),e.write(") {"+r);const{cases:o}=t,{length:l}=o;for(let c=0;c<l;c++){const h=o[c];s&&h.comments!=null&&le(e,h.comments,a,r),h.test?(e.write(a+"case "),this[h.test.type](h.test,e),e.write(":"+r)):e.write(a+"default:"+r);const{consequent:p}=h,{length:u}=p;for(let f=0;f<u;f++){const m=p[f];s&&m.comments!=null&&le(e,m.comments,n,r),e.write(n),this[m.type](m,e),e.write(r)}}e.indentLevel-=2,e.write(i+"}")},ReturnStatement(t,e){e.write("return"),t.argument&&(e.write(" "),this[t.argument.type](t.argument,e)),e.write(";")},ThrowStatement(t,e){e.write("throw "),this[t.argument.type](t.argument,e),e.write(";")},TryStatement(t,e){if(e.write("try "),this[t.block.type](t.block,e),t.handler){const{handler:i}=t;i.param==null?e.write(" catch "):(e.write(" catch ("),this[i.param.type](i.param,e),e.write(") ")),this[i.body.type](i.body,e)}t.finalizer&&(e.write(" finally "),this[t.finalizer.type](t.finalizer,e))},WhileStatement(t,e){e.write("while ("),this[t.test.type](t.test,e),e.write(") "),this[t.body.type](t.body,e)},DoWhileStatement(t,e){e.write("do "),this[t.body.type](t.body,e),e.write(" while ("),this[t.test.type](t.test,e),e.write(");")},ForStatement(t,e){if(e.write("for ("),t.init!=null){const{init:i}=t;i.type[0]==="V"?Zt(e,i):this[i.type](i,e)}e.write("; "),t.test&&this[t.test.type](t.test,e),e.write("; "),t.update&&this[t.update.type](t.update,e),e.write(") "),this[t.body.type](t.body,e)},ForInStatement:Ri=function(t,e){e.write(`for ${t.await?"await ":""}(`);const{left:i}=t;i.type[0]==="V"?Zt(e,i):this[i.type](i,e),e.write(t.type[3]==="I"?" in ":" of "),this[t.right.type](t.right,e),e.write(") "),this[t.body.type](t.body,e)},ForOfStatement:Ri,DebuggerStatement(t,e){e.write("debugger;",t)},FunctionDeclaration:Oi=function(t,e){e.write((t.async?"async ":"")+(t.generator?"function* ":"function ")+(t.id?t.id.name:""),t),dt(e,t.params),e.write(" "),this[t.body.type](t.body,e)},FunctionExpression:Oi,VariableDeclaration(t,e){Zt(e,t),e.write(";")},VariableDeclarator(t,e){this[t.id.type](t.id,e),t.init!=null&&(e.write(" = "),this[t.init.type](t.init,e))},ClassDeclaration(t,e){if(e.write("class "+(t.id?`${t.id.name} `:""),t),t.superClass){e.write("extends ");const{superClass:i}=t,{type:r}=i,s=e.expressionsPrecedence[r];(r[0]!=="C"||r[1]!=="l"||r[5]!=="E")&&(s===De||s<e.expressionsPrecedence.ClassExpression)?(e.write("("),this[t.superClass.type](i,e),e.write(")")):this[i.type](i,e),e.write(" ")}this.ClassBody(t.body,e)},ImportDeclaration(t,e){e.write("import ");const{specifiers:i,attributes:r}=t,{length:s}=i;let a=0;if(s>0){for(;a<s;){a>0&&e.write(", ");const n=i[a],o=n.type[6];if(o==="D")e.write(n.local.name,n),a++;else if(o==="N")e.write("* as "+n.local.name,n),a++;else break}if(a<s){for(e.write("{");;){const n=i[a],{name:o}=n.imported;if(e.write(o,n),o!==n.local.name&&e.write(" as "+n.local.name),++a<s)e.write(", ");else break}e.write("}")}e.write(" from ")}if(this.Literal(t.source,e),r&&r.length>0){e.write(" with { ");for(let n=0;n<r.length;n++)this.ImportAttribute(r[n],e),n<r.length-1&&e.write(", ");e.write(" }")}e.write(";")},ImportAttribute(t,e){this.Identifier(t.key,e),e.write(": "),this.Literal(t.value,e)},ImportExpression(t,e){e.write("import("),this[t.source.type](t.source,e),e.write(")")},ExportDefaultDeclaration(t,e){e.write("export default "),this[t.declaration.type](t.declaration,e),e.expressionsPrecedence[t.declaration.type]!=null&&t.declaration.type[0]!=="F"&&e.write(";")},ExportNamedDeclaration(t,e){if(e.write("export "),t.declaration)this[t.declaration.type](t.declaration,e);else{e.write("{");const{specifiers:i}=t,{length:r}=i;if(r>0)for(let s=0;;){const a=i[s],{name:n}=a.local;if(e.write(n,a),n!==a.exported.name&&e.write(" as "+a.exported.name),++s<r)e.write(", ");else break}if(e.write("}"),t.source&&(e.write(" from "),this.Literal(t.source,e)),t.attributes&&t.attributes.length>0){e.write(" with { ");for(let s=0;s<t.attributes.length;s++)this.ImportAttribute(t.attributes[s],e),s<t.attributes.length-1&&e.write(", ");e.write(" }")}e.write(";")}},ExportAllDeclaration(t,e){if(t.exported!=null?e.write("export * as "+t.exported.name+" from "):e.write("export * from "),this.Literal(t.source,e),t.attributes&&t.attributes.length>0){e.write(" with { ");for(let i=0;i<t.attributes.length;i++)this.ImportAttribute(t.attributes[i],e),i<t.attributes.length-1&&e.write(", ");e.write(" }")}e.write(";")},MethodDefinition(t,e){t.static&&e.write("static ");const i=t.kind[0];(i==="g"||i==="s")&&e.write(t.kind+" "),t.value.async&&e.write("async "),t.value.generator&&e.write("*"),t.computed?(e.write("["),this[t.key.type](t.key,e),e.write("]")):this[t.key.type](t.key,e),dt(e,t.value.params),e.write(" "),this[t.value.body.type](t.value.body,e)},ClassExpression(t,e){this.ClassDeclaration(t,e)},ArrowFunctionExpression(t,e){e.write(t.async?"async ":"",t);const{params:i}=t;i!=null&&(i.length===1&&i[0].type[0]==="I"?e.write(i[0].name,i[0]):dt(e,t.params)),e.write(" => "),t.body.type[0]==="O"?(e.write("("),this.ObjectExpression(t.body,e),e.write(")")):this[t.body.type](t.body,e)},ThisExpression(t,e){e.write("this",t)},Super(t,e){e.write("super",t)},RestElement:Mi=function(t,e){e.write("..."),this[t.argument.type](t.argument,e)},SpreadElement:Mi,YieldExpression(t,e){e.write(t.delegate?"yield*":"yield"),t.argument&&(e.write(" "),this[t.argument.type](t.argument,e))},AwaitExpression(t,e){e.write("await ",t),kt(e,t.argument,t)},TemplateLiteral(t,e){const{quasis:i,expressions:r}=t;e.write("`");const{length:s}=r;for(let n=0;n<s;n++){const o=r[n],l=i[n];e.write(l.value.raw,l),e.write("${"),this[o.type](o,e),e.write("}")}const a=i[i.length-1];e.write(a.value.raw,a),e.write("`")},TemplateElement(t,e){e.write(t.value.raw,t)},TaggedTemplateExpression(t,e){kt(e,t.tag,t),this[t.quasi.type](t.quasi,e)},ArrayExpression:Li=function(t,e){if(e.write("["),t.elements.length>0){const{elements:i}=t,{length:r}=i;for(let s=0;;){const a=i[s];if(a!=null&&this[a.type](a,e),++s<r)e.write(", ");else{a==null&&e.write(", ");break}}}e.write("]")},ArrayPattern:Li,ObjectExpression(t,e){const i=e.indent.repeat(e.indentLevel++),{lineEnd:r,writeComments:s}=e,a=i+e.indent;if(e.write("{"),t.properties.length>0){e.write(r),s&&t.comments!=null&&le(e,t.comments,a,r);const n=","+r,{properties:o}=t,{length:l}=o;for(let c=0;;){const h=o[c];if(s&&h.comments!=null&&le(e,h.comments,a,r),e.write(a),this[h.type](h,e),++c<l)e.write(n);else break}e.write(r),s&&t.trailingComments!=null&&le(e,t.trailingComments,a,r),e.write(i+"}")}else s?t.comments!=null?(e.write(r),le(e,t.comments,a,r),t.trailingComments!=null&&le(e,t.trailingComments,a,r),e.write(i+"}")):t.trailingComments!=null?(e.write(r),le(e,t.trailingComments,a,r),e.write(i+"}")):e.write("}"):e.write("}");e.indentLevel--},Property(t,e){t.method||t.kind[0]!=="i"?this.MethodDefinition(t,e):(t.shorthand||(t.computed?(e.write("["),this[t.key.type](t.key,e),e.write("]")):this[t.key.type](t.key,e),e.write(": ")),this[t.value.type](t.value,e))},PropertyDefinition(t,e){if(t.static&&e.write("static "),t.computed&&e.write("["),this[t.key.type](t.key,e),t.computed&&e.write("]"),t.value==null){t.key.type[0]!=="F"&&e.write(";");return}e.write(" = "),this[t.value.type](t.value,e),e.write(";")},ObjectPattern(t,e){if(e.write("{"),t.properties.length>0){const{properties:i}=t,{length:r}=i;for(let s=0;this[i[s].type](i[s],e),++s<r;)e.write(", ")}e.write("}")},SequenceExpression(t,e){dt(e,t.expressions)},UnaryExpression(t,e){if(t.prefix){const{operator:i,argument:r,argument:{type:s}}=t;e.write(i);const a=Hr(e,r,t);!a&&(i.length>1||s[0]==="U"&&(s[1]==="n"||s[1]==="p")&&r.prefix&&r.operator[0]===i&&(i==="+"||i==="-"))&&e.write(" "),a?(e.write(i.length>1?" (":"("),this[s](r,e),e.write(")")):this[s](r,e)}else this[t.argument.type](t.argument,e),e.write(t.operator)},UpdateExpression(t,e){t.prefix?(e.write(t.operator),this[t.argument.type](t.argument,e)):(this[t.argument.type](t.argument,e),e.write(t.operator))},AssignmentExpression(t,e){this[t.left.type](t.left,e),e.write(" "+t.operator+" "),this[t.right.type](t.right,e)},AssignmentPattern(t,e){this[t.left.type](t.left,e),e.write(" = "),this[t.right.type](t.right,e)},BinaryExpression:Vi=function(t,e){const i=t.operator==="in";i&&e.write("("),kt(e,t.left,t,!1),e.write(" "+t.operator+" "),kt(e,t.right,t,!0),i&&e.write(")")},LogicalExpression:Vi,ConditionalExpression(t,e){const{test:i}=t,r=e.expressionsPrecedence[i.type];r===De||r<=e.expressionsPrecedence.ConditionalExpression?(e.write("("),this[i.type](i,e),e.write(")")):this[i.type](i,e),e.write(" ? "),this[t.consequent.type](t.consequent,e),e.write(" : "),this[t.alternate.type](t.alternate,e)},NewExpression(t,e){e.write("new ");const i=e.expressionsPrecedence[t.callee.type];i===De||i<e.expressionsPrecedence.CallExpression||un(t.callee)?(e.write("("),this[t.callee.type](t.callee,e),e.write(")")):this[t.callee.type](t.callee,e),dt(e,t.arguments)},CallExpression(t,e){const i=e.expressionsPrecedence[t.callee.type];i===De||i<e.expressionsPrecedence.CallExpression?(e.write("("),this[t.callee.type](t.callee,e),e.write(")")):this[t.callee.type](t.callee,e),t.optional&&e.write("?."),dt(e,t.arguments)},ChainExpression(t,e){this[t.expression.type](t.expression,e)},MemberExpression(t,e){const i=e.expressionsPrecedence[t.object.type];i===De||i<e.expressionsPrecedence.MemberExpression?(e.write("("),this[t.object.type](t.object,e),e.write(")")):this[t.object.type](t.object,e),t.computed?(t.optional&&e.write("?."),e.write("["),this[t.property.type](t.property,e),e.write("]")):(t.optional?e.write("?."):e.write("."),this[t.property.type](t.property,e))},MetaProperty(t,e){e.write(t.meta.name+"."+t.property.name,t)},Identifier(t,e){e.write(t.name,t)},PrivateIdentifier(t,e){e.write(`#${t.name}`,t)},Literal(t,e){t.raw!=null?e.write(t.raw,t):t.regex!=null?this.RegExpLiteral(t,e):t.bigint!=null?e.write(t.bigint+"n",t):e.write(ln(t.value),t)},RegExpLiteral(t,e){const{regex:i}=t;e.write(`/${i.pattern}/${i.flags}`,t)}},pn={},fn=Si;class dn{constructor(e){const i=e??pn;this.output="",i.output!=null?(this.output=i.output,this.write=this.writeToStream):this.output="",this.generator=i.generator!=null?i.generator:Si,this.expressionsPrecedence=i.expressionsPrecedence!=null?i.expressionsPrecedence:cn,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(e){this.output+=e}writeToStream(e){this.output.write(e)}writeAndMap(e,i){this.output+=e,this.map(e,i)}writeToStreamAndMap(e,i){this.output.write(e),this.map(e,i)}map(e,i){if(i!=null){const{type:a}=i;if(a[0]==="L"&&a[2]==="n"){this.column=0,this.line++;return}if(i.loc!=null){const{mapping:n}=this;n.original=i.loc.start,n.name=i.name,this.sourceMap.addMapping(n)}if(a[0]==="T"&&a[8]==="E"||a[0]==="L"&&a[1]==="i"&&typeof i.value=="string"){const{length:n}=e;let{column:o,line:l}=this;for(let c=0;c<n;c++)e[c]===`
|
|
31
|
-
`?(o=0,l++):o++;this.column=o,this.line=l;return}}const{length:r}=e,{lineEnd:s}=this;r>0&&(this.lineEndSize>0&&(s.length===1?e[r-1]===s:e.endsWith(s))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}}function zr(t,e){const i=new fn(e);return i.generator[t.type](t,i),i.output}var dn=Object.defineProperty,mn=(t,e,i)=>e in t?dn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,X=(t,e,i)=>mn(t,typeof e!="symbol"?e+"":e,i);const gn=new Set(["Infinity","NaN","undefined","null","true","false"]),xn=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 yn{constructor(){X(this,"scopes",[]),X(this,"scopeTypes",[]),X(this,"scopeCounts",new Map),X(this,"contextBoundVars",new Set),X(this,"arrayPatternElements",new Set),X(this,"rootParams",new Set),X(this,"localSeriesVars",new Set),X(this,"varKinds",new Map),X(this,"loopVars",new Set),X(this,"loopVarNames",new Map),X(this,"paramIdCounter",0),X(this,"cacheIdCounter",0),X(this,"tempVarCounter",0),X(this,"taCallIdCounter",0),X(this,"userCallIdCounter",0),X(this,"plotCallIdCounter",0),X(this,"hoistingStack",[]),X(this,"suppressHoisting",!1),X(this,"reservedNames",new Set),X(this,"userFunctions",new Set),this.pushScope("glb")}get nextParamIdArg(){return{type:"Identifier",name:`'p${this.paramIdCounter++}'`}}get nextCacheIdArg(){return{type:"Identifier",name:`'cache_${this.cacheIdCounter++}'`}}getNextTACallId(){return{type:"Literal",value:`_ta${this.taCallIdCounter++}`}}getNextUserCallId(){return{type:"Literal",value:`_fn${this.userCallIdCounter++}`}}getNextPlotCallId(){return{type:"Literal",value:`#${this.plotCallIdCounter++}`}}pushScope(e){this.scopes.push(new Map),this.scopeTypes.push(e),this.scopeCounts.set(e,(this.scopeCounts.get(e)||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(e){this.localSeriesVars.add(e)}removeLocalSeriesVar(e){this.localSeriesVars.delete(e)}isLocalSeriesVar(e){return this.localSeriesVars.has(e)}addContextBoundVar(e,i=!1){this.contextBoundVars.add(e),i&&this.rootParams.add(e)}removeContextBoundVar(e){this.contextBoundVars.has(e)&&(this.contextBoundVars.delete(e),this.rootParams.has(e)&&this.rootParams.delete(e))}addArrayPatternElement(e){this.arrayPatternElements.add(e)}isContextBound(e){return gn.has(e)||xn.has(e)?!1:this.contextBoundVars.has(e)}isArrayPatternElement(e){return this.arrayPatternElements.has(e)}isRootParam(e){return this.rootParams.has(e)}addLoopVariable(e,i){this.loopVars.add(e),this.loopVarNames.set(e,i)}removeLoopVariable(e){this.loopVars.delete(e),this.loopVarNames.delete(e)}getLoopVariableName(e){return this.loopVarNames.get(e)}isLoopVariable(e){return this.loopVars.has(e)}addReservedName(e){this.reservedNames.add(e)}addUserFunction(e){this.userFunctions.add(e)}isUserFunction(e){return this.userFunctions.has(e)}addVariable(e,i){if(this.isContextBound(e))return e;const r=this.scopes[this.scopes.length-1],s=this.scopeTypes[this.scopeTypes.length-1],a=this.scopeCounts.get(s)||1,n=`${s}${a}_${e}`;return r.set(e,n),this.varKinds.set(n,i),n}getVariable(e){if(this.loopVars.has(e)){const i=this.loopVarNames.get(e);if(i)return[i,"let"]}if(this.isContextBound(e))return[e,"let"];for(let i=this.scopes.length-1;i>=0;i--){const r=this.scopes[i];if(r.has(e)){const s=r.get(e),a=this.varKinds.get(s)||"let";return[s,a]}}return[e,"let"]}generateTempVar(){return`temp_${++this.tempVarCounter}`}enterHoistingScope(){this.hoistingStack.push([])}exitHoistingScope(){return this.hoistingStack.pop()||[]}addHoistedStatement(e){this.hoistingStack.length>0&&!this.suppressHoisting&&this.hoistingStack[this.hoistingStack.length-1].push(e)}addOuterHoistedStatement(e){if(this.hoistingStack.length>0&&!this.suppressHoisting){const i=Math.min(1,this.hoistingStack.length-1);this.hoistingStack[i].push(e)}}getCurrentHoistingScope(){return this.hoistingStack.length===0?null:this.hoistingStack[this.hoistingStack.length-1]}setSuppressHoisting(e){this.suppressHoisting=e}shouldSuppressHoisting(){return this.suppressHoisting}hasVariableInScope(e){if(this.reservedNames.has(e))return!0;for(let i=this.scopes.length-1;i>=0;i--)if(this.scopes[i].has(e))return!0;return!!(this.contextBoundVars.has(e)||this.loopVars.has(e)||this.localSeriesVars.has(e))}generateParamId(){let e=`p${this.paramIdCounter++}`;for(;this.hasVariableInScope(e);)e=`p${this.paramIdCounter++}`;const i=this.scopes[this.scopes.length-1];return i&&i.set(e,e),e}}function Hr(t,e,i,r,s){i||(i=C),(function a(n,o,l){var c=l||n.type;Gr(i,c,n,o,a),e[c]&&e[c](n,o)})(t,r,s)}function _n(t,e,i,r,s){var a=[];i||(i=C),(function n(o,l,c){var h=c||o.type,p=o!==a[a.length-1];p&&a.push(o),Gr(i,h,o,l,n),e[h]&&e[h](o,l||a,a),p&&a.pop()})(t,r,s)}function ie(t,e,i,r,s){var a=i?bn(i,r||void 0):r;(function n(o,l,c){a[c||o.type](o,l,n)})(t,e,s)}function bn(t,e){var i=Object.create(e||C);for(var r in t)i[r]=t[r];return i}function wi(t,e,i){i(t,e)}function ut(t,e,i){}function Gr(t,e,i,r,s){if(t[e]==null)throw new Error("No walker function defined for node type "+e);t[e](i,r,s)}var C={};C.Program=C.BlockStatement=C.StaticBlock=function(t,e,i){for(var r=0,s=t.body;r<s.length;r+=1){var a=s[r];i(a,e,"Statement")}};C.Statement=wi;C.EmptyStatement=ut;C.ExpressionStatement=C.ParenthesizedExpression=C.ChainExpression=function(t,e,i){return i(t.expression,e,"Expression")};C.IfStatement=function(t,e,i){i(t.test,e,"Expression"),i(t.consequent,e,"Statement"),t.alternate&&i(t.alternate,e,"Statement")};C.LabeledStatement=function(t,e,i){return i(t.body,e,"Statement")};C.BreakStatement=C.ContinueStatement=ut;C.WithStatement=function(t,e,i){i(t.object,e,"Expression"),i(t.body,e,"Statement")};C.SwitchStatement=function(t,e,i){i(t.discriminant,e,"Expression");for(var r=0,s=t.cases;r<s.length;r+=1){var a=s[r];i(a,e)}};C.SwitchCase=function(t,e,i){t.test&&i(t.test,e,"Expression");for(var r=0,s=t.consequent;r<s.length;r+=1){var a=s[r];i(a,e,"Statement")}};C.ReturnStatement=C.YieldExpression=C.AwaitExpression=function(t,e,i){t.argument&&i(t.argument,e,"Expression")};C.ThrowStatement=C.SpreadElement=function(t,e,i){return i(t.argument,e,"Expression")};C.TryStatement=function(t,e,i){i(t.block,e,"Statement"),t.handler&&i(t.handler,e),t.finalizer&&i(t.finalizer,e,"Statement")};C.CatchClause=function(t,e,i){t.param&&i(t.param,e,"Pattern"),i(t.body,e,"Statement")};C.WhileStatement=C.DoWhileStatement=function(t,e,i){i(t.test,e,"Expression"),i(t.body,e,"Statement")};C.ForStatement=function(t,e,i){t.init&&i(t.init,e,"ForInit"),t.test&&i(t.test,e,"Expression"),t.update&&i(t.update,e,"Expression"),i(t.body,e,"Statement")};C.ForInStatement=C.ForOfStatement=function(t,e,i){i(t.left,e,"ForInit"),i(t.right,e,"Expression"),i(t.body,e,"Statement")};C.ForInit=function(t,e,i){t.type==="VariableDeclaration"?i(t,e):i(t,e,"Expression")};C.DebuggerStatement=ut;C.FunctionDeclaration=function(t,e,i){return i(t,e,"Function")};C.VariableDeclaration=function(t,e,i){for(var r=0,s=t.declarations;r<s.length;r+=1){var a=s[r];i(a,e)}};C.VariableDeclarator=function(t,e,i){i(t.id,e,"Pattern"),t.init&&i(t.init,e,"Expression")};C.Function=function(t,e,i){t.id&&i(t.id,e,"Pattern");for(var r=0,s=t.params;r<s.length;r+=1){var a=s[r];i(a,e,"Pattern")}i(t.body,e,t.expression?"Expression":"Statement")};C.Pattern=function(t,e,i){t.type==="Identifier"?i(t,e,"VariablePattern"):t.type==="MemberExpression"?i(t,e,"MemberPattern"):i(t,e)};C.VariablePattern=ut;C.MemberPattern=wi;C.RestElement=function(t,e,i){return i(t.argument,e,"Pattern")};C.ArrayPattern=function(t,e,i){for(var r=0,s=t.elements;r<s.length;r+=1){var a=s[r];a&&i(a,e,"Pattern")}};C.ObjectPattern=function(t,e,i){for(var r=0,s=t.properties;r<s.length;r+=1){var a=s[r];a.type==="Property"?(a.computed&&i(a.key,e,"Expression"),i(a.value,e,"Pattern")):a.type==="RestElement"&&i(a.argument,e,"Pattern")}};C.Expression=wi;C.ThisExpression=C.Super=C.MetaProperty=ut;C.ArrayExpression=function(t,e,i){for(var r=0,s=t.elements;r<s.length;r+=1){var a=s[r];a&&i(a,e,"Expression")}};C.ObjectExpression=function(t,e,i){for(var r=0,s=t.properties;r<s.length;r+=1){var a=s[r];i(a,e)}};C.FunctionExpression=C.ArrowFunctionExpression=C.FunctionDeclaration;C.SequenceExpression=function(t,e,i){for(var r=0,s=t.expressions;r<s.length;r+=1){var a=s[r];i(a,e,"Expression")}};C.TemplateLiteral=function(t,e,i){for(var r=0,s=t.quasis;r<s.length;r+=1){var a=s[r];i(a,e)}for(var n=0,o=t.expressions;n<o.length;n+=1){var l=o[n];i(l,e,"Expression")}};C.TemplateElement=ut;C.UnaryExpression=C.UpdateExpression=function(t,e,i){i(t.argument,e,"Expression")};C.BinaryExpression=C.LogicalExpression=function(t,e,i){i(t.left,e,"Expression"),i(t.right,e,"Expression")};C.AssignmentExpression=C.AssignmentPattern=function(t,e,i){i(t.left,e,"Pattern"),i(t.right,e,"Expression")};C.ConditionalExpression=function(t,e,i){i(t.test,e,"Expression"),i(t.consequent,e,"Expression"),i(t.alternate,e,"Expression")};C.NewExpression=C.CallExpression=function(t,e,i){if(i(t.callee,e,"Expression"),t.arguments)for(var r=0,s=t.arguments;r<s.length;r+=1){var a=s[r];i(a,e,"Expression")}};C.MemberExpression=function(t,e,i){i(t.object,e,"Expression"),t.computed&&i(t.property,e,"Expression")};C.ExportNamedDeclaration=C.ExportDefaultDeclaration=function(t,e,i){if(t.declaration&&i(t.declaration,e,t.type==="ExportNamedDeclaration"||t.declaration.id?"Statement":"Expression"),t.source&&i(t.source,e,"Expression"),t.attributes)for(var r=0,s=t.attributes;r<s.length;r+=1){var a=s[r];i(a,e)}};C.ExportAllDeclaration=function(t,e,i){if(t.exported&&i(t.exported,e),i(t.source,e,"Expression"),t.attributes)for(var r=0,s=t.attributes;r<s.length;r+=1){var a=s[r];i(a,e)}};C.ImportAttribute=function(t,e,i){i(t.value,e,"Expression")};C.ImportDeclaration=function(t,e,i){for(var r=0,s=t.specifiers;r<s.length;r+=1){var a=s[r];i(a,e)}if(i(t.source,e,"Expression"),t.attributes)for(var n=0,o=t.attributes;n<o.length;n+=1){var l=o[n];i(l,e)}};C.ImportExpression=function(t,e,i){i(t.source,e,"Expression"),t.options&&i(t.options,e,"Expression")};C.ImportSpecifier=C.ImportDefaultSpecifier=C.ImportNamespaceSpecifier=C.Identifier=C.PrivateIdentifier=C.Literal=ut;C.TaggedTemplateExpression=function(t,e,i){i(t.tag,e,"Expression"),i(t.quasi,e,"Expression")};C.ClassDeclaration=C.ClassExpression=function(t,e,i){return i(t,e,"Class")};C.Class=function(t,e,i){t.id&&i(t.id,e,"Pattern"),t.superClass&&i(t.superClass,e,"Expression"),i(t.body,e)};C.ClassBody=function(t,e,i){for(var r=0,s=t.body;r<s.length;r+=1){var a=s[r];i(a,e)}};C.MethodDefinition=C.PropertyDefinition=C.Property=function(t,e,i){t.computed&&i(t.key,e,"Expression"),t.value&&i(t.value,e,"Expression")};const Y="$",w={createIdentifier(t){return{type:"Identifier",name:t}},createLiteral(t){return{type:"Literal",value:t}},createMemberExpression(t,e,i=!1){return{type:"MemberExpression",object:t,property:e,computed:i}},createContextIdentifier(){return this.createIdentifier("$")},createLocalContextIdentifier(){return this.createIdentifier("$$")},createContextVariableReference(t,e){const i=this.createContextIdentifier(),r=this.createIdentifier(t),s=this.createIdentifier(e);return this.createMemberExpression(this.createMemberExpression(i,r,!1),s,!1)},createLocalContextVariableReference(t,e){const i=this.createLocalContextIdentifier(),r=this.createIdentifier(t),s=this.createIdentifier(e);return this.createMemberExpression(this.createMemberExpression(i,r,!1),s,!1)},createDynamicContextVariableReference(t,e){const i=this.createContextIdentifier(),r=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),e,!0)},createContextVariableAccess0(t,e){const i=this.createContextVariableReference(t,e);return this.createGetCall(i,0)},createDynamicContextVariableAccess0(t,e){const i=this.createDynamicContextVariableReference(t,e);return this.createGetCall(i,0)},createArrayAccess(t,e){const i=typeof e=="number"?this.createLiteral(e):e;return this.createMemberExpression(t,i,!0)},createCallExpression(t,e){return{type:"CallExpression",callee:t,arguments:e}},createAssignmentExpression(t,e,i="="){return{type:"AssignmentExpression",operator:i,left:t,right:e}},createExpressionStatement(t){return{type:"ExpressionStatement",expression:t}},createInitCall(t,e,i){const r=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("init"),!1),s=[t,e];return i&&s.push(i),this.createCallExpression(r,s)},createInitVarCall(t,e){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("initVar"),!1),r=[t,e];return this.createCallExpression(i,r)},createGetCall(t,e){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("get"),!1),r=typeof e=="number"?this.createLiteral(e):e;return this.createCallExpression(i,[t,r])},createSetCall(t,e){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("set"),!1);return this.createCallExpression(i,[t,e])},createMathEqCall(t,e){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("pine"),!1),r=this.createMemberExpression(i,this.createIdentifier("math"),!1),s=this.createMemberExpression(r,this.createIdentifier("__eq"),!1);return this.createCallExpression(s,[t,e])},createWrapperFunction(t){return{type:"FunctionDeclaration",id:null,params:[this.createIdentifier("context")],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:t}]}}},createVariableDeclaration(t,e){return{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:this.createIdentifier(t),init:e}]}},createAwaitExpression(t){return{type:"AwaitExpression",argument:t}}},_t=["ta","math","request","array","input"],st=["hline","plot","fill","label","line","na","time","time_close","dayofmonth","dayofweek","hour","minute","month","second","weekofyear","year"],vn=["request.security","request.security_lower_tf"],wn=["line.new","line.copy","label.new","label.copy","polyline.new","box.new","box.copy","table.new"],Yr=["open","high","low","close","volume","hl2","hlc3","ohlc4","hlcc4","openTime","closeTime"],Qr=[..._t,"plotchar","plotshape","plotarrow","plotbar","plotcandle","plot","bgcolor","barcolor","hline","fill","indicator","strategy","library","alertcondition","fixnan","na","color","nz","timestamp","str","box","line","label","table","chart","linefill","polyline","map","matrix","log","map","Type","bool","int","float","string","timeframe","syminfo","barstate","bar_index","last_bar_index","last_bar_time","inputs","time","time_close","time_tradingday","dayofmonth","hour","minute","month","second","weekofyear","year","order","currency","display","shape","location","size","format","dayofweek","xloc","yloc","text","font","extend","position","adjustment","backadjustment","earnings","dividends","splits"],Sn=["na","nz","plot","plotchar","color","hline","fill"];function En(t){let e=null,i=Y;if(t.type==="Program"&&t.body.length>0){const f=t.body[0];if(f.type==="ExpressionStatement"&&(f.expression.type==="ArrowFunctionExpression"||f.expression.type==="FunctionExpression")){const m=f.expression;m.body.type==="BlockStatement"&&(e=m.body.body,m.params.length>0&&m.params[0].type==="Identifier"&&(i=m.params[0].name))}}if(!e)return;const r=new Set,s=new Set,a=f=>{f.type==="Identifier"?r.add(f.name):f.type==="ObjectPattern"?f.properties.forEach(m=>a(m.value)):f.type==="ArrayPattern"&&f.elements.forEach(m=>{m&&a(m)})};ie(t,{},{VariableDeclarator(f,m,y){a(f.id),f.init&&y(f.init,m)},FunctionDeclaration(f,m,y){a(f.id),y(f.body,m)},Identifier(f,m,y){s.add(f.name)},MemberExpression(f,m,y){y(f.object,m),f.computed&&y(f.property,m)},Property(f,m,y){f.computed&&y(f.key,m),y(f.value,m)}}),e.forEach(f=>{f.type==="VariableDeclaration"?f.declarations.forEach(m=>a(m.id)):f.type==="FunctionDeclaration"&&a(f.id)});const n=Yr,o=Qr,l=n.filter(f=>!r.has(f)),c=o.filter(f=>!r.has(f)),h=l.filter(f=>s.has(f)),p=c.filter(f=>s.has(f)),u=[];h.length>0&&u.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:h.map(f=>({type:"Property",key:{type:"Identifier",name:f},value:{type:"Identifier",name:f},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"data"},computed:!1}}]}),p.length>0&&u.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:p.map(f=>({type:"Property",key:{type:"Identifier",name:f},value:{type:"Identifier",name:f},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"pine"},computed:!1}}]}),u.length>0&&e.unshift(...u)}function Nn(t){let e=null,i=Y;if(t.type==="Program"&&t.body.length>0){const o=t.body[0];if(o.type==="ExpressionStatement"&&(o.expression.type==="ArrowFunctionExpression"||o.expression.type==="FunctionExpression")){const l=o.expression;l.body.type==="BlockStatement"&&(e=l.body.body,l.params.length>0&&l.params[0].type==="Identifier"&&(i=l.params[0].name))}}if(!e)return;const r=new Set(Yr),s=new Set(Qr),a=new Set(Sn),n=new Map;e.forEach(o=>{o.type==="VariableDeclaration"&&o.declarations.forEach(l=>{if(l.init&&l.init.type==="MemberExpression"&&l.init.object.type==="Identifier"&&l.init.object.name===i&&l.init.property.type==="Identifier"){const c=l.init.property.name;let h=null;if(c==="data"?h=r:c==="pine"?h=s:c==="core"&&(h=a),h&&l.id.type==="ObjectPattern")l.id.properties.forEach(p=>{if(p.type==="Property"&&p.key.type==="Identifier"&&p.value.type==="Identifier"){const u=p.key.name,f=p.value.name;h.has(u)&&u!==f&&(n.set(f,u),p.value.name=u,p.shorthand=!0)}});else if(l.id.type==="Identifier"&&_t.includes(c)){const p=c,u=l.id.name;p!==u&&(n.set(u,p),l.id.name=p)}}})}),n.size>0&&ie(t,{},{Identifier(o){n.has(o.name)&&(o.name=n.get(o.name))},MemberExpression(o,l,c){c(o.object,l),o.computed&&c(o.property,l)},Property(o,l,c){o.computed&&c(o.key,l),c(o.value,l)}})}function Cn(t){try{const e=qr(t,{ecmaVersion:"latest",sourceType:"module"});if(e.type==="Program"&&e.body.length===1){const i=e.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 In(t){return t.async=!0,zr(t)}function kn(t){t=t.trim();const{isWrapped:e,isAsync:i,functionNode:r}=Cn(t);return e&&r?i?t:In(r):`async (context) => {
|
|
31
|
+
`?(o=0,l++):o++;this.column=o,this.line=l;return}}const{length:r}=e,{lineEnd:s}=this;r>0&&(this.lineEndSize>0&&(s.length===1?e[r-1]===s:e.endsWith(s))?(this.line+=this.lineEndSize,this.column=0):this.column+=r)}toString(){return this.output}}function Gr(t,e){const i=new dn(e);return i.generator[t.type](t,i),i.output}var mn=Object.defineProperty,gn=(t,e,i)=>e in t?mn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,X=(t,e,i)=>gn(t,typeof e!="symbol"?e+"":e,i);const xn=new Set(["Infinity","NaN","undefined","null","true","false"]),yn=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 _n{constructor(){X(this,"scopes",[]),X(this,"scopeTypes",[]),X(this,"scopeCounts",new Map),X(this,"contextBoundVars",new Set),X(this,"arrayPatternElements",new Set),X(this,"rootParams",new Set),X(this,"localSeriesVars",new Set),X(this,"varKinds",new Map),X(this,"loopVars",new Set),X(this,"loopVarNames",new Map),X(this,"paramIdCounter",0),X(this,"cacheIdCounter",0),X(this,"tempVarCounter",0),X(this,"taCallIdCounter",0),X(this,"userCallIdCounter",0),X(this,"plotCallIdCounter",0),X(this,"hoistingStack",[]),X(this,"suppressHoisting",!1),X(this,"reservedNames",new Set),X(this,"userFunctions",new Set),this.pushScope("glb")}get nextParamIdArg(){return{type:"Identifier",name:`'p${this.paramIdCounter++}'`}}get nextCacheIdArg(){return{type:"Identifier",name:`'cache_${this.cacheIdCounter++}'`}}getNextTACallId(){return{type:"Literal",value:`_ta${this.taCallIdCounter++}`}}getNextUserCallId(){return{type:"Literal",value:`_fn${this.userCallIdCounter++}`}}getNextPlotCallId(){return{type:"Literal",value:`#${this.plotCallIdCounter++}`}}pushScope(e){this.scopes.push(new Map),this.scopeTypes.push(e),this.scopeCounts.set(e,(this.scopeCounts.get(e)||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(e){this.localSeriesVars.add(e)}removeLocalSeriesVar(e){this.localSeriesVars.delete(e)}isLocalSeriesVar(e){return this.localSeriesVars.has(e)}addContextBoundVar(e,i=!1){this.contextBoundVars.add(e),i&&this.rootParams.add(e)}removeContextBoundVar(e){this.contextBoundVars.has(e)&&(this.contextBoundVars.delete(e),this.rootParams.has(e)&&this.rootParams.delete(e))}addArrayPatternElement(e){this.arrayPatternElements.add(e)}isContextBound(e){return xn.has(e)||yn.has(e)?!1:this.contextBoundVars.has(e)}isArrayPatternElement(e){return this.arrayPatternElements.has(e)}isRootParam(e){return this.rootParams.has(e)}addLoopVariable(e,i){this.loopVars.add(e),this.loopVarNames.set(e,i)}removeLoopVariable(e){this.loopVars.delete(e),this.loopVarNames.delete(e)}getLoopVariableName(e){return this.loopVarNames.get(e)}isLoopVariable(e){return this.loopVars.has(e)}addReservedName(e){this.reservedNames.add(e)}addUserFunction(e){this.userFunctions.add(e)}isUserFunction(e){return this.userFunctions.has(e)}addVariable(e,i){if(this.isContextBound(e))return e;const r=this.scopes[this.scopes.length-1],s=this.scopeTypes[this.scopeTypes.length-1],a=this.scopeCounts.get(s)||1,n=`${s}${a}_${e}`;return r.set(e,n),this.varKinds.set(n,i),n}getVariable(e){if(this.loopVars.has(e)){const i=this.loopVarNames.get(e);if(i)return[i,"let"]}if(this.isContextBound(e))return[e,"let"];for(let i=this.scopes.length-1;i>=0;i--){const r=this.scopes[i];if(r.has(e)){const s=r.get(e),a=this.varKinds.get(s)||"let";return[s,a]}}return[e,"let"]}generateTempVar(){return`temp_${++this.tempVarCounter}`}enterHoistingScope(){this.hoistingStack.push([])}exitHoistingScope(){return this.hoistingStack.pop()||[]}addHoistedStatement(e){this.hoistingStack.length>0&&!this.suppressHoisting&&this.hoistingStack[this.hoistingStack.length-1].push(e)}addOuterHoistedStatement(e){if(this.hoistingStack.length>0&&!this.suppressHoisting){const i=Math.min(1,this.hoistingStack.length-1);this.hoistingStack[i].push(e)}}getCurrentHoistingScope(){return this.hoistingStack.length===0?null:this.hoistingStack[this.hoistingStack.length-1]}setSuppressHoisting(e){this.suppressHoisting=e}shouldSuppressHoisting(){return this.suppressHoisting}hasVariableInScope(e){if(this.reservedNames.has(e))return!0;for(let i=this.scopes.length-1;i>=0;i--)if(this.scopes[i].has(e))return!0;return!!(this.contextBoundVars.has(e)||this.loopVars.has(e)||this.localSeriesVars.has(e))}generateParamId(){let e=`p${this.paramIdCounter++}`;for(;this.hasVariableInScope(e);)e=`p${this.paramIdCounter++}`;const i=this.scopes[this.scopes.length-1];return i&&i.set(e,e),e}}function Yr(t,e,i,r,s){i||(i=C),(function a(n,o,l){var c=l||n.type;Qr(i,c,n,o,a),e[c]&&e[c](n,o)})(t,r,s)}function bn(t,e,i,r,s){var a=[];i||(i=C),(function n(o,l,c){var h=c||o.type,p=o!==a[a.length-1];p&&a.push(o),Qr(i,h,o,l,n),e[h]&&e[h](o,l||a,a),p&&a.pop()})(t,r,s)}function ie(t,e,i,r,s){var a=i?vn(i,r||void 0):r;(function n(o,l,c){a[c||o.type](o,l,n)})(t,e,s)}function vn(t,e){var i=Object.create(e||C);for(var r in t)i[r]=t[r];return i}function Ei(t,e,i){i(t,e)}function ut(t,e,i){}function Qr(t,e,i,r,s){if(t[e]==null)throw new Error("No walker function defined for node type "+e);t[e](i,r,s)}var C={};C.Program=C.BlockStatement=C.StaticBlock=function(t,e,i){for(var r=0,s=t.body;r<s.length;r+=1){var a=s[r];i(a,e,"Statement")}};C.Statement=Ei;C.EmptyStatement=ut;C.ExpressionStatement=C.ParenthesizedExpression=C.ChainExpression=function(t,e,i){return i(t.expression,e,"Expression")};C.IfStatement=function(t,e,i){i(t.test,e,"Expression"),i(t.consequent,e,"Statement"),t.alternate&&i(t.alternate,e,"Statement")};C.LabeledStatement=function(t,e,i){return i(t.body,e,"Statement")};C.BreakStatement=C.ContinueStatement=ut;C.WithStatement=function(t,e,i){i(t.object,e,"Expression"),i(t.body,e,"Statement")};C.SwitchStatement=function(t,e,i){i(t.discriminant,e,"Expression");for(var r=0,s=t.cases;r<s.length;r+=1){var a=s[r];i(a,e)}};C.SwitchCase=function(t,e,i){t.test&&i(t.test,e,"Expression");for(var r=0,s=t.consequent;r<s.length;r+=1){var a=s[r];i(a,e,"Statement")}};C.ReturnStatement=C.YieldExpression=C.AwaitExpression=function(t,e,i){t.argument&&i(t.argument,e,"Expression")};C.ThrowStatement=C.SpreadElement=function(t,e,i){return i(t.argument,e,"Expression")};C.TryStatement=function(t,e,i){i(t.block,e,"Statement"),t.handler&&i(t.handler,e),t.finalizer&&i(t.finalizer,e,"Statement")};C.CatchClause=function(t,e,i){t.param&&i(t.param,e,"Pattern"),i(t.body,e,"Statement")};C.WhileStatement=C.DoWhileStatement=function(t,e,i){i(t.test,e,"Expression"),i(t.body,e,"Statement")};C.ForStatement=function(t,e,i){t.init&&i(t.init,e,"ForInit"),t.test&&i(t.test,e,"Expression"),t.update&&i(t.update,e,"Expression"),i(t.body,e,"Statement")};C.ForInStatement=C.ForOfStatement=function(t,e,i){i(t.left,e,"ForInit"),i(t.right,e,"Expression"),i(t.body,e,"Statement")};C.ForInit=function(t,e,i){t.type==="VariableDeclaration"?i(t,e):i(t,e,"Expression")};C.DebuggerStatement=ut;C.FunctionDeclaration=function(t,e,i){return i(t,e,"Function")};C.VariableDeclaration=function(t,e,i){for(var r=0,s=t.declarations;r<s.length;r+=1){var a=s[r];i(a,e)}};C.VariableDeclarator=function(t,e,i){i(t.id,e,"Pattern"),t.init&&i(t.init,e,"Expression")};C.Function=function(t,e,i){t.id&&i(t.id,e,"Pattern");for(var r=0,s=t.params;r<s.length;r+=1){var a=s[r];i(a,e,"Pattern")}i(t.body,e,t.expression?"Expression":"Statement")};C.Pattern=function(t,e,i){t.type==="Identifier"?i(t,e,"VariablePattern"):t.type==="MemberExpression"?i(t,e,"MemberPattern"):i(t,e)};C.VariablePattern=ut;C.MemberPattern=Ei;C.RestElement=function(t,e,i){return i(t.argument,e,"Pattern")};C.ArrayPattern=function(t,e,i){for(var r=0,s=t.elements;r<s.length;r+=1){var a=s[r];a&&i(a,e,"Pattern")}};C.ObjectPattern=function(t,e,i){for(var r=0,s=t.properties;r<s.length;r+=1){var a=s[r];a.type==="Property"?(a.computed&&i(a.key,e,"Expression"),i(a.value,e,"Pattern")):a.type==="RestElement"&&i(a.argument,e,"Pattern")}};C.Expression=Ei;C.ThisExpression=C.Super=C.MetaProperty=ut;C.ArrayExpression=function(t,e,i){for(var r=0,s=t.elements;r<s.length;r+=1){var a=s[r];a&&i(a,e,"Expression")}};C.ObjectExpression=function(t,e,i){for(var r=0,s=t.properties;r<s.length;r+=1){var a=s[r];i(a,e)}};C.FunctionExpression=C.ArrowFunctionExpression=C.FunctionDeclaration;C.SequenceExpression=function(t,e,i){for(var r=0,s=t.expressions;r<s.length;r+=1){var a=s[r];i(a,e,"Expression")}};C.TemplateLiteral=function(t,e,i){for(var r=0,s=t.quasis;r<s.length;r+=1){var a=s[r];i(a,e)}for(var n=0,o=t.expressions;n<o.length;n+=1){var l=o[n];i(l,e,"Expression")}};C.TemplateElement=ut;C.UnaryExpression=C.UpdateExpression=function(t,e,i){i(t.argument,e,"Expression")};C.BinaryExpression=C.LogicalExpression=function(t,e,i){i(t.left,e,"Expression"),i(t.right,e,"Expression")};C.AssignmentExpression=C.AssignmentPattern=function(t,e,i){i(t.left,e,"Pattern"),i(t.right,e,"Expression")};C.ConditionalExpression=function(t,e,i){i(t.test,e,"Expression"),i(t.consequent,e,"Expression"),i(t.alternate,e,"Expression")};C.NewExpression=C.CallExpression=function(t,e,i){if(i(t.callee,e,"Expression"),t.arguments)for(var r=0,s=t.arguments;r<s.length;r+=1){var a=s[r];i(a,e,"Expression")}};C.MemberExpression=function(t,e,i){i(t.object,e,"Expression"),t.computed&&i(t.property,e,"Expression")};C.ExportNamedDeclaration=C.ExportDefaultDeclaration=function(t,e,i){if(t.declaration&&i(t.declaration,e,t.type==="ExportNamedDeclaration"||t.declaration.id?"Statement":"Expression"),t.source&&i(t.source,e,"Expression"),t.attributes)for(var r=0,s=t.attributes;r<s.length;r+=1){var a=s[r];i(a,e)}};C.ExportAllDeclaration=function(t,e,i){if(t.exported&&i(t.exported,e),i(t.source,e,"Expression"),t.attributes)for(var r=0,s=t.attributes;r<s.length;r+=1){var a=s[r];i(a,e)}};C.ImportAttribute=function(t,e,i){i(t.value,e,"Expression")};C.ImportDeclaration=function(t,e,i){for(var r=0,s=t.specifiers;r<s.length;r+=1){var a=s[r];i(a,e)}if(i(t.source,e,"Expression"),t.attributes)for(var n=0,o=t.attributes;n<o.length;n+=1){var l=o[n];i(l,e)}};C.ImportExpression=function(t,e,i){i(t.source,e,"Expression"),t.options&&i(t.options,e,"Expression")};C.ImportSpecifier=C.ImportDefaultSpecifier=C.ImportNamespaceSpecifier=C.Identifier=C.PrivateIdentifier=C.Literal=ut;C.TaggedTemplateExpression=function(t,e,i){i(t.tag,e,"Expression"),i(t.quasi,e,"Expression")};C.ClassDeclaration=C.ClassExpression=function(t,e,i){return i(t,e,"Class")};C.Class=function(t,e,i){t.id&&i(t.id,e,"Pattern"),t.superClass&&i(t.superClass,e,"Expression"),i(t.body,e)};C.ClassBody=function(t,e,i){for(var r=0,s=t.body;r<s.length;r+=1){var a=s[r];i(a,e)}};C.MethodDefinition=C.PropertyDefinition=C.Property=function(t,e,i){t.computed&&i(t.key,e,"Expression"),t.value&&i(t.value,e,"Expression")};const Y="$",S={createIdentifier(t){return{type:"Identifier",name:t}},createLiteral(t){return{type:"Literal",value:t}},createMemberExpression(t,e,i=!1){return{type:"MemberExpression",object:t,property:e,computed:i}},createContextIdentifier(){return this.createIdentifier("$")},createLocalContextIdentifier(){return this.createIdentifier("$$")},createContextVariableReference(t,e){const i=this.createContextIdentifier(),r=this.createIdentifier(t),s=this.createIdentifier(e);return this.createMemberExpression(this.createMemberExpression(i,r,!1),s,!1)},createLocalContextVariableReference(t,e){const i=this.createLocalContextIdentifier(),r=this.createIdentifier(t),s=this.createIdentifier(e);return this.createMemberExpression(this.createMemberExpression(i,r,!1),s,!1)},createDynamicContextVariableReference(t,e){const i=this.createContextIdentifier(),r=this.createIdentifier(t);return this.createMemberExpression(this.createMemberExpression(i,r,!1),e,!0)},createContextVariableAccess0(t,e){const i=this.createContextVariableReference(t,e);return this.createGetCall(i,0)},createDynamicContextVariableAccess0(t,e){const i=this.createDynamicContextVariableReference(t,e);return this.createGetCall(i,0)},createArrayAccess(t,e){const i=typeof e=="number"?this.createLiteral(e):e;return this.createMemberExpression(t,i,!0)},createCallExpression(t,e){return{type:"CallExpression",callee:t,arguments:e}},createAssignmentExpression(t,e,i="="){return{type:"AssignmentExpression",operator:i,left:t,right:e}},createExpressionStatement(t){return{type:"ExpressionStatement",expression:t}},createInitCall(t,e,i){const r=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("init"),!1),s=[t,e];return i&&s.push(i),this.createCallExpression(r,s)},createInitVarCall(t,e){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("initVar"),!1),r=[t,e];return this.createCallExpression(i,r)},createGetCall(t,e){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("get"),!1),r=typeof e=="number"?this.createLiteral(e):e;return this.createCallExpression(i,[t,r])},createSetCall(t,e){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("set"),!1);return this.createCallExpression(i,[t,e])},createMathEqCall(t,e){const i=this.createMemberExpression(this.createContextIdentifier(),this.createIdentifier("pine"),!1),r=this.createMemberExpression(i,this.createIdentifier("math"),!1),s=this.createMemberExpression(r,this.createIdentifier("__eq"),!1);return this.createCallExpression(s,[t,e])},createWrapperFunction(t){return{type:"FunctionDeclaration",id:null,params:[this.createIdentifier("context")],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:t}]}}},createVariableDeclaration(t,e){return{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:this.createIdentifier(t),init:e}]}},createAwaitExpression(t){return{type:"AwaitExpression",argument:t}}},_t=["ta","math","request","array","input"],st=["hline","plot","fill","label","line","na","time","time_close","dayofmonth","dayofweek","hour","minute","month","second","weekofyear","year"],wn=["request.security","request.security_lower_tf"],Sn=["line.new","line.copy","label.new","label.copy","polyline.new","box.new","box.copy","table.new"],Xr=["open","high","low","close","volume","hl2","hlc3","ohlc4","hlcc4","openTime","closeTime"],Zr=[..._t,"plotchar","plotshape","plotarrow","plotbar","plotcandle","plot","bgcolor","barcolor","hline","fill","indicator","strategy","library","alertcondition","fixnan","na","color","nz","timestamp","str","box","line","label","table","chart","linefill","polyline","map","matrix","log","map","Type","bool","int","float","string","timeframe","syminfo","barstate","bar_index","last_bar_index","last_bar_time","inputs","time","time_close","time_tradingday","dayofmonth","hour","minute","month","second","weekofyear","year","order","currency","display","shape","location","size","format","dayofweek","xloc","yloc","text","font","extend","position","adjustment","backadjustment","earnings","dividends","splits"],En=["na","nz","plot","plotchar","color","hline","fill"];function Nn(t){let e=null,i=Y;if(t.type==="Program"&&t.body.length>0){const f=t.body[0];if(f.type==="ExpressionStatement"&&(f.expression.type==="ArrowFunctionExpression"||f.expression.type==="FunctionExpression")){const m=f.expression;m.body.type==="BlockStatement"&&(e=m.body.body,m.params.length>0&&m.params[0].type==="Identifier"&&(i=m.params[0].name))}}if(!e)return;const r=new Set,s=new Set,a=f=>{f.type==="Identifier"?r.add(f.name):f.type==="ObjectPattern"?f.properties.forEach(m=>a(m.value)):f.type==="ArrayPattern"&&f.elements.forEach(m=>{m&&a(m)})};ie(t,{},{VariableDeclarator(f,m,y){a(f.id),f.init&&y(f.init,m)},FunctionDeclaration(f,m,y){a(f.id),y(f.body,m)},Identifier(f,m,y){s.add(f.name)},MemberExpression(f,m,y){y(f.object,m),f.computed&&y(f.property,m)},Property(f,m,y){f.computed&&y(f.key,m),y(f.value,m)}}),e.forEach(f=>{f.type==="VariableDeclaration"?f.declarations.forEach(m=>a(m.id)):f.type==="FunctionDeclaration"&&a(f.id)});const n=Xr,o=Zr,l=n.filter(f=>!r.has(f)),c=o.filter(f=>!r.has(f)),h=l.filter(f=>s.has(f)),p=c.filter(f=>s.has(f)),u=[];h.length>0&&u.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:h.map(f=>({type:"Property",key:{type:"Identifier",name:f},value:{type:"Identifier",name:f},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"data"},computed:!1}}]}),p.length>0&&u.push({type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"ObjectPattern",properties:p.map(f=>({type:"Property",key:{type:"Identifier",name:f},value:{type:"Identifier",name:f},kind:"init",shorthand:!0}))},init:{type:"MemberExpression",object:{type:"Identifier",name:i},property:{type:"Identifier",name:"pine"},computed:!1}}]}),u.length>0&&e.unshift(...u)}function Cn(t){let e=null,i=Y;if(t.type==="Program"&&t.body.length>0){const o=t.body[0];if(o.type==="ExpressionStatement"&&(o.expression.type==="ArrowFunctionExpression"||o.expression.type==="FunctionExpression")){const l=o.expression;l.body.type==="BlockStatement"&&(e=l.body.body,l.params.length>0&&l.params[0].type==="Identifier"&&(i=l.params[0].name))}}if(!e)return;const r=new Set(Xr),s=new Set(Zr),a=new Set(En),n=new Map;e.forEach(o=>{o.type==="VariableDeclaration"&&o.declarations.forEach(l=>{if(l.init&&l.init.type==="MemberExpression"&&l.init.object.type==="Identifier"&&l.init.object.name===i&&l.init.property.type==="Identifier"){const c=l.init.property.name;let h=null;if(c==="data"?h=r:c==="pine"?h=s:c==="core"&&(h=a),h&&l.id.type==="ObjectPattern")l.id.properties.forEach(p=>{if(p.type==="Property"&&p.key.type==="Identifier"&&p.value.type==="Identifier"){const u=p.key.name,f=p.value.name;h.has(u)&&u!==f&&(n.set(f,u),p.value.name=u,p.shorthand=!0)}});else if(l.id.type==="Identifier"&&_t.includes(c)){const p=c,u=l.id.name;p!==u&&(n.set(u,p),l.id.name=p)}}})}),n.size>0&&ie(t,{},{Identifier(o){n.has(o.name)&&(o.name=n.get(o.name))},MemberExpression(o,l,c){c(o.object,l),o.computed&&c(o.property,l)},Property(o,l,c){o.computed&&c(o.key,l),c(o.value,l)}})}function In(t){try{const e=zr(t,{ecmaVersion:"latest",sourceType:"module"});if(e.type==="Program"&&e.body.length===1){const i=e.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 kn(t){return t.async=!0,Gr(t)}function An(t){t=t.trim();const{isWrapped:e,isAsync:i,functionNode:r}=In(t);return e&&r?i?t:kn(r):`async (context) => {
|
|
32
32
|
${t}
|
|
33
|
-
}`}function An(t){ie(t,null,{VariableDeclaration(e,i,r){e.declarations&&e.declarations.length>0&&e.declarations.forEach(s=>{if(s.init&&s.init.type==="ArrowFunctionExpression"&&s.init.start!==0){const a={type:"FunctionDeclaration",id:s.id,params:s.init.params,body:s.init.body.type==="BlockStatement"?s.init.body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:s.init.body}]},async:s.init.async,generator:!1};Object.assign(e,a)}}),e.body&&e.body.body&&e.body.body.forEach(s=>r(s,i))}})}function Tn(t,e){Hr(t,{VariableDeclaration(i){i.declarations.forEach(r=>{const s=r.init&&r.init.type==="MemberExpression"&&r.init.object&&(r.init.object.name==="context"||r.init.object.name===Y||r.init.object.name==="context2"),a=r.init&&r.init.type==="MemberExpression"&&r.init.object?.object&&(r.init.object.object.name==="context"||r.init.object.object.name===Y||r.init.object.object.name==="context2");(s||a)&&(r.id.name&&e.addContextBoundVar(r.id.name),r.id.properties&&r.id.properties.forEach(n=>{n.key.name&&e.addContextBoundVar(n.key.name)}))})}})}function Pn(t,e,i=!1){t.params.forEach(r=>{r.type==="Identifier"&&i&&e.addContextBoundVar(r.name,i)})}function Dn(t,e){let i;return _n(t,{FunctionDeclaration(r){r.id&&r.id.name&&(e.addReservedName(r.id.name),e.addUserFunction(r.id.name))},ArrowFunctionExpression(r){const s=r.start===0;s&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=Y),Pn(r,e,s)},VariableDeclaration(r,s){const a=s.length>1?s[s.length-2]:null,n=a&&(a.type==="ForOfStatement"||a.type==="ForInStatement")&&a.left===r;r.declarations.forEach(o=>{if(o.id.type==="Identifier")e.addReservedName(o.id.name);else if(o.id.type==="ObjectPattern")o.id.properties.forEach(l=>{l.key&&l.key.type==="Identifier"&&e.addReservedName(l.key.name)});else if(o.id.type==="ArrayPattern"){if(o.id.elements?.forEach(p=>{p&&p.type==="Identifier"&&e.addReservedName(p.name)}),n)return;const l=e.generateTempVar(),c={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:l},init:o.init}]};o.id.elements?.forEach(p=>{p.type==="Identifier"&&e.addArrayPatternElement(p.name)});const h=o.id.elements.map((p,u)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:p,init:{type:"MemberExpression",object:{type:"Identifier",name:l},property:{type:"Literal",value:u},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[c,...h]})}})},ForStatement(r){}}),i}const oi={type:"Identifier",name:"undefined"};function ae(t,e){const[i,r]=e.getVariable(t);if(i.match(/^fn\d+_/)&&t!=="$$"){const[s]=e.getVariable("$$");if(s)return w.createLocalContextVariableReference(r,i)}return w.createContextVariableReference(r,i)}function Xr(t,e){const i=ae(t,e);return w.createGetCall(i,0)}function pt(t,e){if(t.computed&&t.property.type==="Identifier"){if(e.isLoopVariable(t.property.name)){if(t.object.type==="Identifier"&&!e.isLoopVariable(t.object.name)){if(e.isLocalSeriesVar(t.object.name)){const i=w.createIdentifier(t.object.name);i._skipTransformation=!0;const r=w.createGetCall(i,t.property);Object.assign(t,r),t._indexTransformed=!0;return}if(!e.isContextBound(t.object.name)){const i=ae(t.object.name,e),r=w.createGetCall(i,t.property);Object.assign(t,r),t._indexTransformed=!0}}return}e.isContextBound(t.property.name)||(t.property=ae(t.property.name,e),t.property=w.createGetCall(t.property,0))}if(t.computed&&t.object.type==="Identifier"){if(e.isLoopVariable(t.object.name))return;if(e.isLocalSeriesVar(t.object.name)){const i=w.createIdentifier(t.object.name);i._skipTransformation=!0;const r=w.createGetCall(i,t.property);Object.assign(t,r),t._indexTransformed=!0;return}if(e.isContextBound(t.object.name)||(t.object=ae(t.object.name,e)),t.property.type==="MemberExpression"){const i=t.property;i._indexTransformed||(pt(i,e),i._indexTransformed=!0)}}}function je(t,e){const i=w.createGetCall(w.createIdentifier(t.name),0);t.start!==void 0&&(i.start=t.start),t.end!==void 0&&(i.end=t.end),i._indexTransformed=!0,Object.assign(t,i)}function re(t,e){if(!t._skipTransformation&&t.name!==Y){if(st.includes(t.name)&&e.isContextBound(t.name)){const u=t.parent&&t.parent.type==="CallExpression"&&t.parent.callee===t,f=t.parent&&t.parent.type==="MemberExpression"&&t.parent.object===t&&!t.parent.computed;if(!u&&!f){const m={type:"MemberExpression",object:{type:"Identifier",name:t.name},property:{type:"Identifier",name:"__value"},computed:!1},y=w.createGetCall(m,0);Object.assign(t,y),delete t.name;return}}if(t.name==="Math"||t.name==="NaN"||t.name==="undefined"||t.name==="Infinity"||t.name==="null"||t.name.startsWith("'")&&t.name.endsWith("'")||t.name.startsWith('"')&&t.name.endsWith('"')||t.name.startsWith("`")&&t.name.endsWith("`")||e.isLoopVariable(t.name))return;let i=!1;if(t.parent&&t.parent.type==="CallExpression"&&t.parent.arguments.includes(t)){const u=t.parent.callee;if(u.type==="MemberExpression"&&u.object&&u.object.name===Y&&["get","set","init","param","call"].includes(u.property.name)){const f=t.parent.arguments.indexOf(t);u.property.name==="call"?f>=2&&(i=!0):f===0&&(i=!0)}else{const f=u.type==="MemberExpression"&&u.object&&u.object.type==="Identifier"&&_t.includes(u.object.name);u.type==="MemberExpression"&&!f?i=!1:i=!0}}const r=t.parent&&t.parent.type==="MemberExpression"&&t.parent.object===t&&e.isContextBound(t.name),s=t.parent&&t.parent.type==="CallExpression"&&t.parent.callee&&t.parent.callee.type==="MemberExpression"&&t.parent.callee.property.name==="param";t.parent&&t.parent.type==="AssignmentExpression"&&t.parent.left;const a=t.parent&&t.parent.type==="CallExpression"&&t.parent.callee===t,n=t.parent&&t.parent.type==="MemberExpression"&&t.parent.computed&&t.parent.object===t,o=t.parent&&t.parent.type==="MemberExpression"&&t.parent.computed&&t.parent.property===t&&t.parent.parent&&t.parent.parent.type==="CallExpression"&&t.parent.parent.callee&&t.parent.parent.callee.type==="MemberExpression"&&e.isContextBound(t.parent.parent.callee.object.name);if(r||s||i||o||a){if(a||t.parent&&t.parent.type==="CallExpression"&&t.parent.callee&&t.parent.callee.type==="MemberExpression"&&t.parent.callee.object&&t.parent.callee.object.name===Y&&t.parent.callee.property.name==="call"&&t.parent.arguments[0]===t||e.isLocalSeriesVar(t.name)||e.isContextBound(t.name)&&!e.isRootParam(t.name))return;const u=ae(t.name,e);Object.assign(t,u);return}const l=e.isContextBound(t.name)&&!e.isRootParam(t.name);if(l){const u=t.parent&&t.parent.type==="CallExpression"&&t.parent.arguments.includes(t),f=t.parent&&t.parent.type==="SwitchStatement"&&t.parent.discriminant===t,m=t.parent&&t.parent.type==="SwitchCase"&&t.parent.test===t;if(!u&&!f&&!m)return}if(e.isLocalSeriesVar(t.name)){if(!n){const u=w.createIdentifier(t.name),f=w.createGetCall(u,0);Object.assign(t,f)}return}const[c,h]=e.getVariable(t.name);let p;if(l)p=w.createIdentifier(t.name);else{if(c===t.name&&!e.isContextBound(t.name))return;p=ae(t.name,e)}if(n)Object.assign(t,p);else{const u=w.createGetCall(p,0);Object.assign(t,u)}}}function be(t,e,i){if(t.object&&t.object.type==="Identifier"&&t.object.name==="Math")return;if(t.object&&t.object.type==="Identifier"&&_t.includes(t.object.name)&&i.isContextBound(t.object.name)&&!t.computed){const l=t.parent&&t.parent.type==="CallExpression"&&t.parent.callee===t,c=t.parent&&(t.parent.type==="VariableDeclarator"&&(t.parent.id.type==="ArrayPattern"||t.parent.id.type==="ObjectPattern")||t.parent.type==="AssignmentExpression"&&(t.parent.left.type==="ArrayPattern"||t.parent.left.type==="ObjectPattern")||t.parent.type==="Property");if(!l&&!c){const h={type:"CallExpression",callee:{type:"MemberExpression",object:t.object,property:t.property,computed:!1},arguments:[],_transformed:!1};t.start!==void 0&&(h.start=t.start),t.end!==void 0&&(h.end=t.end),Object.assign(t,h);return}}const r=i.getCurrentScopeType()=="if",s=i.getCurrentScopeType()=="els",a=i.getCurrentScopeType()=="for";if(!r&&!s&&!a&&t.object&&t.object.type==="Identifier"&&i.isContextBound(t.object.name)&&!i.isRootParam(t.object.name)&&!t.computed)return;t._indexTransformed||(pt(t,i),t._indexTransformed=!0);const n=t.object&&t.object.type==="MemberExpression"&&t.object.object&&t.object.object.type==="MemberExpression"&&t.object.object.object&&(t.object.object.object.name===Y||t.object.object.object.name==="$$"),o=t.object&&t.object.type==="Identifier"&&i.isContextBound(t.object.name);if(t.computed&&(n||o)){if(t.parent&&t.parent.type==="AssignmentExpression"&&t.parent.left===t)return;t.object.type==="Identifier"&&st.includes(t.object.name)&&i.isContextBound(t.object.name)&&(t.object={type:"MemberExpression",object:{type:"Identifier",name:t.object.name},property:{type:"Identifier",name:"__value"},computed:!1});const l=w.createGetCall(t.object,t.property);t.start&&(l.start=t.start),t.end&&(l.end=t.end),Object.assign(t,l),delete t.object,delete t.property,delete t.computed}}function wt(t,e){if(t.type==="Identifier"){if(st.includes(t.name)&&e.isContextBound(t.name)){const a=t.name;return Object.assign(t,{type:"MemberExpression",object:{type:"Identifier",name:a},property:{type:"Identifier",name:"__value"},computed:!1}),delete t.name,t}if(e.isLoopVariable(t.name))return t;if(e.isRootParam(t.name)){const[a,n]=e.getVariable(t.name);return w.createContextVariableReference(n,a)}if(e.isContextBound(t.name))return t;const[i,r]=e.getVariable(t.name),s=i!==t.name;return e.isLocalSeriesVar(t.name)&&!s?t:s?ae(t.name,e):i===t.name&&!e.isContextBound(t.name)?t:ae(t.name,e)}return t}function tt(t,e,i=""){switch(t.type){case"BinaryExpression":return li(t,e,i);case"LogicalExpression":return ci(t,e,i);case"MemberExpression":{const r=t.object.type==="Identifier"?wt(t.object,e):t.object;let s=r;if(!t.computed&&t.object.type==="Identifier"){const[a]=e.getVariable(t.object.name);a!==t.object.name&&!e.isLoopVariable(t.object.name)&&(s=w.createGetCall(r,0))}return{type:"MemberExpression",object:s,property:t.property,computed:t.computed}}case"Identifier":{if(e.isLoopVariable(t.name)||t.parent&&t.parent.type==="MemberExpression"&&t.parent.property===t)return t;const r=wt(t,e);return r.type==="Identifier"&&(r.name==="NaN"||r.name==="undefined"||r.name==="Infinity"||r.name==="null"||r.name==="Math")?r:w.createGetCall(r,0)}case"UnaryExpression":return hi(t,e,i);case"ConditionalExpression":{const r=tt(t.test,e,i),s=tt(t.consequent,e,i),a=tt(t.alternate,e,i);return{type:"ConditionalExpression",test:r,consequent:s,alternate:a,start:t.start,end:t.end}}}return t}function li(t,e,i){const r=tt(t.left,e,i),s=tt(t.right,e,i),a={type:"BinaryExpression",operator:t.operator,left:r,right:s,start:t.start,end:t.end};return ie(a,e,{CallExpression(n,o){n._transformed||oe(n,o)},MemberExpression(n){be(n,"",e)}}),a}function ci(t,e,i){const r=tt(t.left,e,i),s=tt(t.right,e,i),a={type:"LogicalExpression",operator:t.operator,left:r,right:s,start:t.start,end:t.end};return ie(a,e,{CallExpression(n,o){n._transformed||oe(n,o)}}),a}function Li(t,e,i){ie(t,{parent:t,inNamespaceCall:!1},{Identifier(n,o,l){if(n.name=="NaN")return;if(st.includes(n.name)&&e.isContextBound(n.name)){const h={type:"MemberExpression",object:{type:"Identifier",name:n.name},property:{type:"Identifier",name:"__value"},computed:!1},p=w.createGetCall(h,0);Object.assign(n,p),delete n.name;return}n.parent=o.parent,re(n,e);const c=n.parent&&n.parent.type==="BinaryExpression";(n.parent&&n.parent.type==="ConditionalExpression"||c)&&(n.type==="MemberExpression"?pt(n,e):n.type==="Identifier"&&(n.parent&&n.parent.type==="CallExpression"&&n.parent.callee&&n.parent.callee.object&&n.parent.callee.object.name===Y&&n.parent.callee.property.name==="get"||je(n)))},MemberExpression(n,o,l){be(n,"",e),n.object&&l(n.object,{parent:n,inNamespaceCall:o.inNamespaceCall})},ConditionalExpression(n,o,l){const c={...o,parent:n};n.test&&l(n.test,c),n.consequent&&l(n.consequent,c),n.alternate&&l(n.alternate,c)},BinaryExpression(n,o,l){const c={...o,parent:n};l(n.left,c),l(n.right,c)},LogicalExpression(n,o,l){const c={...o,parent:n};l(n.left,c),l(n.right,c)},UnaryExpression(n,o,l){const c={...o,parent:n};l(n.argument,c)},CallExpression(n,o,l){const c=n.callee&&n.callee.type==="MemberExpression"&&n.callee.object&&n.callee.object.type==="Identifier"&&e.isContextBound(n.callee.object.name);oe(n,e),n.arguments.forEach(h=>l(h,{parent:n,inNamespaceCall:c||o.inNamespaceCall}))}});const r=w.createMemberExpression(w.createIdentifier(i),w.createIdentifier("param")),s=e.generateParamId(),a={type:"CallExpression",callee:r,arguments:[t,oi,{type:"Identifier",name:`'${s}'`}],_transformed:!0,_isParamCall:!0};if(!e.shouldSuppressHoisting()){const n=s;e.addLocalSeriesVar(n);const o=w.createVariableDeclaration(n,a);return e.addHoistedStatement(o),w.createIdentifier(n)}return a}function hi(t,e,i){const r=tt(t.argument,e,i),s={type:"UnaryExpression",operator:t.operator,prefix:t.prefix,argument:r,start:t.start,end:t.end};return ie(s,e,{CallExpression(a,n){a._transformed||oe(a,n)},MemberExpression(a){be(a,"",e)}}),s}function ot(t,e,i){switch(t?.type){case"BinaryExpression":t=li(t,i,e);break;case"LogicalExpression":t=ci(t,i,e);break;case"ConditionalExpression":return Li(t,i,e);case"UnaryExpression":t=hi(t,i,e);break;case"ArrayExpression":t.elements=t.elements.map(c=>c.type==="Identifier"?i.isContextBound(c.name)&&!i.isRootParam(c.name)?c:Xr(c.name,i):c);break}const r=t.type==="MemberExpression"&&t.computed&&t.property,s=t.type==="MemberExpression"&&!t.computed;if(r){t.object.type==="CallExpression"?oe(t.object,i):t.object.type==="MemberExpression"?be(t.object,"",i):t.object.type==="BinaryExpression"?t.object=li(t.object,i,e):t.object.type==="LogicalExpression"?t.object=ci(t.object,i,e):t.object.type==="ConditionalExpression"?t.object=Li(t.object,i,e):t.object.type==="UnaryExpression"&&(t.object=hi(t.object,i,e));const c=t.object.type==="Identifier"&&i.isContextBound(t.object.name)&&!i.isRootParam(t.object.name)?t.object:wt(t.object,i),h=t.property.type==="Identifier"&&!i.isContextBound(t.property.name)&&!i.isLoopVariable(t.property.name)?w.createGetCall(wt(t.property,i),0):t.property,p=w.createMemberExpression(w.createIdentifier(e),w.createIdentifier("param")),u=i.generateParamId(),f={type:"CallExpression",callee:p,arguments:[c,h,{type:"Identifier",name:`'${u}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const m=u;i.addLocalSeriesVar(m);const y=w.createVariableDeclaration(m,f);return i.addHoistedStatement(y),w.createIdentifier(m)}return f}if(s){if(t.object.type==="Identifier"&&_t.includes(t.object.name)&&i.isContextBound(t.object.name)&&!t.computed){const c=t.object.name,h={type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:c},property:{type:"Identifier",name:t.property.name},computed:!1},arguments:[],_transformed:!0};c==="ta"&&h.arguments.push(i.getNextTACallId());const p=i.generateTempVar();i.addLocalSeriesVar(p);const u=w.createVariableDeclaration(p,h);return i.addOuterHoistedStatement(u),Object.assign(t,w.createIdentifier(p)),t}if(t.object.type==="Identifier"){const c=t.object.name,[h,p]=i.getVariable(c);if(h!==c&&!i.isLoopVariable(c)){const u=w.createContextVariableReference(p,h),f=w.createGetCall(u,0);t.object=f}}else t.object.type==="MemberExpression"?ot(t.object,e,i):t.object.type==="CallExpression"&&(t.object._transformed||oe(t.object,i))}if(t.type==="ObjectExpression"&&(t.properties=t.properties.map(c=>c.value.name?i.isContextBound(c.value.name)&&!i.isRootParam(c.value.name)?{type:"Property",key:{type:"Identifier",name:c.key.name},value:w.createIdentifier(c.value.name),kind:"init",method:!1,shorthand:!1,computed:!1}:{type:"Property",key:{type:"Identifier",name:c.key.name},value:ae(c.value.name,i),kind:"init",method:!1,shorthand:!1,computed:!1}:(c.value.type!=="Literal"&&(c.value=ot(c.value,e,i)),c))),t.type==="Identifier"){if(st.includes(t.name)&&i.isContextBound(t.name)){const c=t.name;Object.assign(t,{type:"MemberExpression",object:{type:"Identifier",name:c},property:{type:"Identifier",name:"__value"},computed:!1}),delete t.name}else if(i.isContextBound(t.name)&&!i.isRootParam(t.name)){const c=w.createMemberExpression(w.createIdentifier(e),w.createIdentifier("param")),h=i.generateParamId(),p={type:"CallExpression",callee:c,arguments:[t,oi,{type:"Identifier",name:`'${h}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const u=h;i.addLocalSeriesVar(u);const f=w.createVariableDeclaration(u,p);return i.addHoistedStatement(f),w.createIdentifier(u)}return p}}t?.type==="CallExpression"&&oe(t,i);const a=w.createMemberExpression(w.createIdentifier(e),w.createIdentifier("param")),n=t.type==="Identifier"?wt(t,i):t,o=i.generateParamId(),l={type:"CallExpression",callee:a,arguments:[n,oi,{type:"Identifier",name:`'${o}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const c=o;i.addLocalSeriesVar(c);const h=w.createVariableDeclaration(c,l);return i.addHoistedStatement(h),w.createIdentifier(c)}return l}function ui(t,e,i){t&&(t.type==="Identifier"?(t.parent=e,re(t,i)):t.type==="MemberExpression"?ui(t.object,t,i):t.type==="CallExpression"&&(t.callee&&t.callee.type==="MemberExpression"&&ui(t.callee.object,t.callee,i),t._transformed||oe(t,i)))}function oe(t,e,i){if(t._transformed)return;t.callee&&t.callee.name,t.callee&&t.callee.type==="Identifier"&&(_t.includes(t.callee.name)||st.includes(t.callee.name))&&e.isContextBound(t.callee.name)&&(t.callee=w.createMemberExpression(t.callee,w.createIdentifier("any")));const r=t.callee&&t.callee.type==="MemberExpression"&&t.callee.object&&t.callee.object.type==="Identifier"&&(e.isContextBound(t.callee.object.name)||t.callee.object.name==="math"||t.callee.object.name==="ta");if(r){if(t.callee.object.name===Y&&["get","init","param"].includes(t.callee.property.name))return;const s=t.callee.object.name,a=[];if(t.arguments.forEach(h=>{if(h._isParamCall){a.push(h);return}a.push(ot(h,s,e))}),t.arguments=a,["plot","hline","fill"].includes(s)){const h=e.getNextPlotCallId();t.arguments.push({type:"ObjectExpression",properties:[{type:"Property",key:{type:"Identifier",name:"__callsiteId"},value:h,kind:"init",computed:!1,shorthand:!1}]})}if(s==="ta")if(e.getCurrentScopeType()==="fn"){const h=e.getNextTACallId(),[p]=e.getVariable("$$");let u;p?u=w.createMemberExpression(w.createLocalContextIdentifier(),w.createIdentifier("id")):u=w.createLiteral("");const f={type:"BinaryExpression",operator:"+",left:u,right:h};t.arguments.push(f)}else t.arguments.push(e.getNextTACallId());const n=t.callee.property.name,o=`${s}.${n}`,l=vn.includes(o),c=t._insideAwait===!0;if(l&&!c){const h=Object.assign({},t),p=w.createAwaitExpression(h);Object.assign(t,p)}if(!e.shouldSuppressHoisting()){const h=e.generateTempVar();e.addLocalSeriesVar(h);const p=t._insideAwait===!0;let u=Object.assign({},t);p&&(u=w.createAwaitExpression(u));const f=w.createVariableDeclaration(h,u);e.addHoistedStatement(f);const m=w.createIdentifier(h);Object.assign(t,m),t._wasHoisted=!0,t._wasInsideAwait=p;return}t._transformed=!0}else if(t.callee&&t.callee.type==="Identifier"){if(t.arguments=t.arguments.map(s=>s._isParamCall?s:ot(s,Y,e)),!e.isContextBound(t.callee.name)){const s=e.getNextUserCallId(),a=w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("call")),n=[t.callee,s,...t.arguments];t.callee=a,t.arguments=n}t._transformed=!0}if(!r&&t.callee&&t.callee.type==="MemberExpression"){const s=t.callee.property.name;if(e.isUserFunction(s)&&!e.isContextBound(s)){const a=t.callee.object;t.callee.property;const n=t.arguments.map(p=>p._isParamCall?p:ot(p,Y,e));let o=a;a.type==="Identifier"?o=ot(a,Y,e):a.type==="CallExpression"&&(oe(a,e),o=ot(a,Y,e));const l=w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("call")),c=e.getNextUserCallId(),h=[w.createIdentifier(s),c,o,...n];t.callee=l,t.arguments=h,t._transformed=!0;return}t.callee.object.type==="Identifier"?re(t.callee.object,e):ui(t.callee.object,t.callee,e)}t.arguments.forEach(s=>{ie(s,{parent:t},{Identifier(a,n,o){a.parent=n.parent,re(a,e);const l=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||l)&&(a.type==="MemberExpression"?pt(a,e):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===Y&&a.parent.callee.property.name==="get"||je(a)))},BinaryExpression(a,n,o){const l={...n,parent:a};o(a.left,l),o(a.right,l)},LogicalExpression(a,n,o){const l={...n,parent:a};o(a.left,l),o(a.right,l)},UnaryExpression(a,n,o){const l={...n,parent:a};o(a.argument,l)},CallExpression(a,n,o){a.callee&&a.callee.type==="MemberExpression"&&a.callee.object&&(a.callee.object.parent=a.callee,o(a.callee.object,{parent:a.callee})),a._transformed||oe(a,e)},MemberExpression(a,n,o){be(a,"",e),a.object&&o(a.object,{parent:a})}})})}function pi(t,e){let i=null;if(t.left.type==="Identifier")i=ae(t.left.name,e);else if(t.left.type==="MemberExpression"&&t.left.computed){if(t.left.object.type==="Identifier"){const r=t.left.object.name,[s,a]=e.getVariable(r),n=s!==r,o=e.isContextBound(r);(n||o)&&!e.isLoopVariable(r)&&t.left.property.type==="Literal"&&t.left.property.value===0&&(i=ae(r,e))}}else if(t.left.type==="MemberExpression"&&!t.left.computed&&t.left.object.type==="Identifier"){const r=t.left.object.name,[s,a]=e.getVariable(r);if(s!==r&&!e.isLoopVariable(r)){const n=ae(r,e),o=w.createGetCall(n,0);t.left.object=o}}if(ie(t.right,{parent:t.right,inNamespaceCall:!1},{Identifier(r,s,a){if(st.includes(r.name)&&e.isContextBound(r.name)){const m={type:"MemberExpression",object:{type:"Identifier",name:r.name},property:{type:"Identifier",name:"__value"},computed:!1},y=w.createGetCall(m,0);Object.assign(r,y),delete r.name;return}r.parent=s.parent,re(r,e);const n=r.parent&&r.parent.type==="BinaryExpression",o=r.parent&&r.parent.type==="ConditionalExpression",l=e.isContextBound(r.name)&&!e.isRootParam(r.name),c=r.parent&&r.parent.type==="MemberExpression"&&r.parent.computed&&r.parent.object===r,h=r.parent&&r.parent._isParamCall,p=r.parent&&r.parent.type==="MemberExpression",u=r.name==="NaN",f=r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===Y&&r.parent.callee.property.name==="get";(l||o||n)&&(r.type==="MemberExpression"?pt(r,e):r.type==="Identifier"&&!p&&!c&&!h&&!u&&!f&&je(r))},MemberExpression(r,s,a){be(r,"",e),r.type==="CallExpression"?r.arguments.forEach(n=>a(n,{parent:r,inNamespaceCall:s.inNamespaceCall})):r.object&&a(r.object,{parent:r,inNamespaceCall:s.inNamespaceCall})},CallExpression(r,s,a){const n=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&e.isContextBound(r.callee.object.name);oe(r,e),r.type==="CallExpression"&&(r.callee.type==="MemberExpression"&&a(r.callee,{parent:r,inNamespaceCall:n||s.inNamespaceCall}),r.arguments.forEach(o=>a(o,{parent:r,inNamespaceCall:n||s.inNamespaceCall})))}}),i){let r=t.right;if(t.operator!=="="){const a=t.operator.replace("=",""),n=w.createGetCall(i,0);r={type:"BinaryExpression",operator:a,left:n,right:t.right,start:t.start,end:t.end}}const s=w.createSetCall(i,r);t.start&&(s.start=t.start),t.end&&(s.end=t.end),Object.assign(t,s)}}function Zr(t,e){t._skipTransformation||t.declarations.forEach(i=>{if(i.init&&i.init.type==="Identifier"&&st.includes(i.init.name)&&e.isContextBound(i.init.name)){const u=i.init.name;Object.assign(i.init,{type:"MemberExpression",object:{type:"Identifier",name:u},property:{type:"Identifier",name:"__value"},computed:!1}),delete i.init.name}const r=i.init&&i.init.type==="MemberExpression"&&i.init.object&&(i.init.object.name==="context"||i.init.object.name===Y||i.init.object.name==="context2"),s=i.init&&i.init.type==="MemberExpression"&&i.init.object?.object&&(i.init.object.object.name==="context"||i.init.object.object.name===Y||i.init.object.object.name==="context2"),a=i.init&&i.init.type==="ArrowFunctionExpression";if(r){i.id.name&&e.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(u=>{u.key.name&&e.addContextBoundVar(u.key.name)}),i.init.object.name=Y;return}if(s){i.id.name&&e.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(u=>{u.key.name&&e.addContextBoundVar(u.key.name)}),i.init.object.object.name=Y;return}e.addVariable(i.id.name,t.kind);const n=t.kind,o=e.isArrayPatternElement(i.id.name);i.init&&!a&&!o&&(i.init.type==="CallExpression"&&i.init.callee.type==="MemberExpression"&&i.init.callee.object&&i.init.callee.object.type==="Identifier"&&e.isContextBound(i.init.callee.object.name)?oe(i.init,e):ie(i.init,{parent:i.init},{Identifier(u,f){u.parent=f.parent,re(u,e);const m=u.parent&&u.parent.type==="BinaryExpression",y=u.parent&&u.parent.type==="UnaryExpression",_=u.parent&&u.parent.type==="ConditionalExpression",b=u.parent&&u.parent.type==="CallExpression"&&u.parent.callee&&u.parent.callee.object&&u.parent.callee.object.name===Y&&u.parent.callee.property.name==="get";u.type==="Identifier"&&(m||y||_)&&!b&&je(u)},CallExpression(u,f,m){u.callee.type==="Identifier"&&(u.callee.parent=u),u.arguments.forEach(y=>{y.type==="Identifier"&&(y.parent=u)}),(u.callee.type==="ArrowFunctionExpression"||u.callee.type==="FunctionExpression")&&m(u.callee,{parent:u}),oe(u,e),u.type==="CallExpression"&&(u.callee.type==="MemberExpression"&&m(u.callee,{parent:u}),u.arguments.forEach(y=>m(y,{parent:u})))},BinaryExpression(u,f,m){u.left.type==="Identifier"&&(u.left.parent=u),u.right.type==="Identifier"&&(u.right.parent=u),m(u.left,{parent:u}),m(u.right,{parent:u})},MemberExpression(u,f,m){u.object&&u.object.type==="Identifier"&&(u.object.parent=u),u.property&&u.property.type==="Identifier"&&(u.property.parent=u),be(u,"",e),u.type==="CallExpression"?u.arguments.forEach(y=>m(y,{parent:u})):u.object&&m(u.object,{parent:u})},AwaitExpression(u,f,m){u.argument&&(u.argument._insideAwait=!0,m(u.argument,{parent:u}),u.argument.type==="Identifier"&&u.argument._wasInsideAwait&&Object.assign(u,u.argument))},ArrowFunctionExpression(u,f,m){if(u.body)if(u.body.type==="BlockStatement"){const y=[];u.body.body.forEach(_=>{e.enterHoistingScope(),m(_,{parent:u.body,insideIIFE:!0});const b=e.exitHoistingScope();y.push(...b),y.push(_)}),u.body.body=y}else m(u.body,{parent:u,insideIIFE:!0})},FunctionExpression(u,f,m){if(u.body&&u.body.type==="BlockStatement"){const y=[];u.body.body.forEach(_=>{e.enterHoistingScope(),m(_,{parent:u.body,insideIIFE:!0});const b=e.exitHoistingScope();y.push(...b),y.push(_)}),u.body.body=y}},SwitchStatement(u,f,m){u.discriminant&&(u.discriminant.parent=u,m(u.discriminant,{parent:u})),u.cases&&u.cases.forEach(y=>{y.parent=u,m(y,{parent:u})})},SwitchCase(u,f,m){if(u.test&&(u.test.parent=u,m(u.test,{parent:u})),u.consequent){const y=[];u.consequent.forEach(_=>{e.enterHoistingScope(),_.parent=u,m(_,{parent:u});const b=e.exitHoistingScope();y.push(...b),y.push(_)}),u.consequent=y}},AssignmentExpression(u,f,m){if(f.insideIIFE){if(u.left.type==="Identifier"){const[y]=e.getVariable(u.left.name);if(y===u.left.name&&!e.isContextBound(u.left.name)){m(u.right,{parent:u});return}}pi(u,e)}}}));const l=ae(i.id.name,e),c=!o&&i.init&&i.init.type==="MemberExpression"&&i.init.computed&&i.init.property&&(i.init.property.type==="Literal"||i.init.property.type==="MemberExpression");if(i.init?.property?.type==="MemberExpression"&&(i.init.property._indexTransformed||(pt(i.init.property,e),i.init.property._indexTransformed=!0)),n==="var"){const u=e.getCurrentHoistingScope();if(u){for(const f of u)if(f.type==="VariableDeclaration")for(const m of f.declarations){if(!m.init||m.init.type!=="CallExpression")continue;const y=m.init.callee;if(y?.type!=="MemberExpression")continue;let _;const b=y.property?.name;if(y.object?.type==="Identifier"?_=y.object.name:y.object?.type==="MemberExpression"&&y.object.property?.name&&(_=y.object.property.name),_&&b){const S=`${_}.${b}`;wn.includes(S)&&(m.init={type:"ArrowFunctionExpression",params:[],body:m.init,expression:!0,async:!1})}}}}let h;i.init?a||o?h=i.init:n==="var"?h=w.createInitVarCall(l,i.init):h=w.createInitCall(l,c?i.init.object:i.init,c?i.init.property:void 0):h=w.createIdentifier("undefined");const p=w.createExpressionStatement(w.createAssignmentExpression(l,h));if(o){const u=i.init.object.name,f=ae(u,e),m=i.init.property.value,y={type:"MemberExpression",object:w.createGetCall(f,0),property:{type:"Literal",value:m},computed:!0};p.expression.right=w.createCallExpression(w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("init")),[l,y])}a&&(e.pushScope("fn"),ie(i.init.body,e,{IfStatement(u,f,m){f.pushScope("if"),m(u.consequent,f),u.alternate&&(f.pushScope("els"),m(u.alternate,f),f.popScope()),f.popScope()},VariableDeclaration(u,f){Zr(u,f)},Identifier(u,f){re(u,f)},AssignmentExpression(u,f){pi(u,f)},SwitchStatement(u,f,m){u.discriminant.parent=u,m(u.discriminant,f),u.cases.forEach(y=>{y.parent=u,m(y,f)})},SwitchCase(u,f,m){u.test&&(u.test.parent=u,m(u.test,f));const y=[];u.consequent.forEach(_=>{f.enterHoistingScope(),m(_,f);const b=f.exitHoistingScope();y.push(...b),y.push(_)}),u.consequent=y},BlockStatement(u,f,m){const y=[];u.body.forEach(_=>{f.enterHoistingScope(),m(_,f);const b=f.exitHoistingScope();y.push(...b),y.push(_)}),u.body=y}}),e.popScope()),Object.assign(t,p)})}function Rn(t,e,i){if(e.setSuppressHoisting(!0),t.init&&t.init.type==="VariableDeclaration"){const r=t.init.declarations[0],s=r.id.name;e.addLoopVariable(s,s),t.init={type:"VariableDeclaration",kind:t.init.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:s},init:r.init}]},r.init&&ie(r.init,e,{Identifier(a,n){e.isLoopVariable(a.name)||(e.pushScope("for"),re(a,n),e.popScope())},MemberExpression(a){e.pushScope("for"),be(a,"",e),e.popScope()},CallExpression(a,n,o){a.callee.parent=a,o(a.callee,n);for(const l of a.arguments)o(l,n)}})}if(t.test&&ie(t.test,e,{Identifier(r,s){!e.isLoopVariable(r.name)&&!r.computed&&(e.pushScope("for"),re(r,s),r.type==="Identifier"&&(r.computed=!0,je(r)),e.popScope())},MemberExpression(r){e.pushScope("for"),be(r,"",e),e.popScope()},CallExpression(r,s,a){r.callee.parent=r,a(r.callee,s);for(const n of r.arguments)a(n,s)}}),t.update&&ie(t.update,e,{Identifier(r,s){e.isLoopVariable(r.name)||(e.pushScope("for"),re(r,s),e.popScope())}}),e.setSuppressHoisting(!1),e.pushScope("for"),i(t.body,e),e.popScope(),t.init&&t.init.type==="VariableDeclaration"){const r=t.init.declarations[0];e.removeLoopVariable(r.id.name)}}function On(t,e){ie(t,e,{MemberExpression(i,r,s){i.object&&i.object.type==="Identifier"&&!e.isContextBound(i.object.name)&&!i.computed&&(i.object.parent=i,s(i.object,r)),be(i,"",e)},CallExpression(i,r){oe(i,r)},Identifier(i,r){re(i,r);const s=e.getCurrentScopeType()==="if";e.isContextBound(i.name)&&!e.isRootParam(i.name)&&s&&je(i)}})}function Vn(t,e,i){t.test&&(e.pushScope("if"),On(t.test,e),e.popScope()),e.pushScope("if"),i(t.consequent,e),e.popScope(),t.alternate&&(e.pushScope("els"),i(t.alternate,e),e.popScope())}function Mn(t,e){const i=e.getCurrentScopeType();if(t.argument&&(t.argument.type==="ArrayExpression"?(t.argument.elements=t.argument.elements.map(r=>r.type==="Identifier"?e.isContextBound(r.name)&&!e.isRootParam(r.name)?w.createGetCall(r,0):Xr(r.name,e):r.type==="MemberExpression"?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)?w.createGetCall(r,0):(r.computed&&r.object.type==="Identifier"&&e.isContextBound(r.object.name)&&!e.isRootParam(r.object.name)||be(r,"",e),r):r),t.argument={type:"ArrayExpression",elements:[t.argument]}):t.argument.type==="ObjectExpression"?t.argument.properties=t.argument.properties.map(r=>r.shorthand?e.isContextBound(r.value.name)?r:(e.getVariable(r.value.name),{type:"Property",key:w.createIdentifier(r.key.name),value:ae(r.value.name,e),kind:"init",method:!1,shorthand:!1,computed:!1}):(r.value&&r.value.type==="Identifier"&&(e.isContextBound(r.value.name)&&!e.isRootParam(r.value.name)||e.isContextBound(r.value.name)||(r.value=ae(r.value.name,e))),r)):t.argument.type==="Identifier"?(re(t.argument,e),t.argument.type==="Identifier"&&je(t.argument)):t.argument.type==="MemberExpression"&&t.argument.object.type==="Identifier"&&!e.isContextBound(t.argument.object.name)&&!e.isLoopVariable(t.argument.object.name)&&re(t.argument.object,e),i==="fn")){t.argument.type==="Identifier"&&e.isContextBound(t.argument.name)&&!e.isRootParam(t.argument.name)?t.argument=w.createArrayAccess(t.argument,0):t.argument.type==="MemberExpression"?t.argument.object.type==="Identifier"&&e.isContextBound(t.argument.object.name)&&!e.isRootParam(t.argument.object.name)&&(t.argument._indexTransformed||(pt(t.argument,e),t.argument._indexTransformed=!0)):(t.argument.type==="BinaryExpression"||t.argument.type==="LogicalExpression"||t.argument.type==="ConditionalExpression"||t.argument.type==="CallExpression")&&ie(t.argument,e,{Identifier(s,a){re(s,a),s.type==="Identifier"&&!s._arrayAccessed&&(je(s),s._arrayAccessed=!0)},MemberExpression(s){be(s,"",e)},CallExpression(s,a,n){(s.callee.type==="ArrowFunctionExpression"||s.callee.type==="FunctionExpression")&&n(s.callee,a),oe(s,a),s.type==="CallExpression"&&s.arguments.forEach(o=>n(o,a))},BinaryExpression(s,a,n){n(s.left,a),n(s.right,a)},ArrowFunctionExpression(s,a,n){if(s.body)if(s.body.type==="BlockStatement"){const o=[];s.body.body.forEach(l=>{e.enterHoistingScope(),n(l,a);const c=e.exitHoistingScope();o.push(...c),o.push(l)}),s.body.body=o}else n(s.body,a)},FunctionExpression(s,a,n){if(s.body&&s.body.type==="BlockStatement"){const o=[];s.body.body.forEach(l=>{e.enterHoistingScope(),n(l,a);const c=e.exitHoistingScope();o.push(...c),o.push(l)}),s.body.body=o}},SwitchStatement(s,a,n){s.discriminant.parent=s,n(s.discriminant,a),s.cases.forEach(o=>{o.parent=s,n(o,a)})},SwitchCase(s,a,n){s.test&&(s.test.parent=s,n(s.test,a));const o=[];s.consequent.forEach(l=>{e.enterHoistingScope(),n(l,a);const c=e.exitHoistingScope();o.push(...c),o.push(l)}),s.consequent=o},BlockStatement(s,a,n){const o=[];s.body.forEach(l=>{a.enterHoistingScope(),n(l,a);const c=a.exitHoistingScope();o.push(...c),o.push(l)}),s.body=o}});const r=w.createCallExpression(w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("precision")),[t.argument]);t.argument=r}}function Ln(t,e,i){const r=w.createVariableDeclaration("$$",w.createCallExpression(w.createMemberExpression(w.createContextIdentifier(),w.createIdentifier("peekCtx")),[]));r._skipTransformation=!0,e.addLoopVariable("$$","$$"),t.body&&t.body.type==="BlockStatement"&&(t.body.body.unshift(r),e.pushScope("fn"),t.params.forEach(s=>{s.type==="Identifier"&&e.addLocalSeriesVar(s.name)}),i(t.body,e),t.params.forEach(s=>{s.type==="Identifier"&&e.removeLocalSeriesVar(s.name)}),e.popScope())}function jn(t){const e={...C,LineComment:()=>{}};Hr(t,{BinaryExpression(i){if(i.operator==="=="||i.operator==="==="){const r=i.left,s=i.right,a=w.createMathEqCall(r,s);a._transformed=!0,Object.assign(i,a)}}},e)}function Bn(t,e,i,r={debug:!1,ln:!1},s=[]){const a=n=>{if(!r.debug||!n.loc||!s.length)return null;const o=n.loc.start.line-1;if(o>=0&&o<s.length){const l=s[o].trim();if(l)return{type:"LineComment",value:`${r.ln?` [Line ${n.loc.start.line}]`:""} ${l}`}}return null};ie(t,e,{Program(n,o,l){const c=[];n.body.forEach(h=>{o.enterHoistingScope(),l(h,o);const p=o.exitHoistingScope(),u=a(h);u&&c.push(u),c.push(...p),c.push(h)}),n.body=c},BlockStatement(n,o,l){const c=[];n.body.forEach(h=>{o.enterHoistingScope(),l(h,o);const p=o.exitHoistingScope(),u=a(h);u&&c.push(u),c.push(...p),c.push(h)}),n.body=c},ReturnStatement(n,o){Mn(n,o)},VariableDeclaration(n,o){Zr(n,o)},Identifier(n,o){re(n,o)},CallExpression(n,o,l){n.callee&&(n.callee.type==="ArrowFunctionExpression"||n.callee.type==="FunctionExpression")?l(n.callee,o):n.callee&&n.callee.type==="MemberExpression"&&n.callee.object&&(n.callee.object.parent=n.callee,l(n.callee.object,o)),oe(n,o)},ArrowFunctionExpression(n,o,l){n.body&&l(n.body,o)},FunctionExpression(n,o,l){n.body&&l(n.body,o)},ForOfStatement(n,o,l){if(n.left&&n.left.type==="VariableDeclaration"){n.left._skipTransformation=!0;const c=n.left.declarations[0];c.id.type==="Identifier"?o.addLoopVariable(c.id.name,c.id.name):c.id.type==="ArrayPattern"&&c.id.elements.forEach(h=>{h.type==="Identifier"&&o.addLoopVariable(h.name,h.name)})}if(n.right&&n.right.type==="Identifier"){re(n.right,o),n.right.type==="Identifier"&&je(n.right);const c={...n.right};let h=w.createMemberExpression(c,w.createIdentifier("array"),!1);n.left&&n.left.type==="VariableDeclaration"&&n.left.declarations[0].id.type==="ArrayPattern"&&(h=w.createCallExpression(w.createMemberExpression(h,w.createIdentifier("entries"),!1),[])),Object.assign(n.right,h)}else n.right&&l(n.right,o);if(n.body&&l(n.body,o),n.left&&n.left.type==="VariableDeclaration"){const c=n.left.declarations[0];c.id.type==="Identifier"?o.removeLoopVariable(c.id.name):c.id.type==="ArrayPattern"&&c.id.elements.forEach(h=>{h.type==="Identifier"&&o.removeLoopVariable(h.name)})}},ForInStatement(n,o,l){n.left&&n.left.type==="VariableDeclaration"&&(n.left._skipTransformation=!0),n.right&&n.right.type==="Identifier"?(re(n.right,o),n.right.type==="Identifier"&&je(n.right)):n.right&&l(n.right,o),n.body&&l(n.body,o)},MemberExpression(n,o,l){n.object&&(n.object.type==="CallExpression"||n.object.type==="MemberExpression")&&(n.object.parent=n,l(n.object,o)),n.object&&n.object.type==="Identifier"&&!o.isContextBound(n.object.name)&&(n.object.parent=n,l(n.object,o)),be(n,i,o)},AssignmentExpression(n,o,l){if(pi(n,o),n.type==="CallExpression"&&n.arguments){const c=h=>{h&&(h.type==="CallExpression"&&h.callee&&(h.callee.type==="ArrowFunctionExpression"||h.callee.type==="FunctionExpression")&&l(h.callee,o),h.type==="BinaryExpression"&&(c(h.left),c(h.right)))};n.arguments.forEach(h=>c(h))}},FunctionDeclaration(n,o,l){Ln(n,o,l)},ForStatement(n,o,l){Rn(n,o,l)},IfStatement(n,o,l){Vn(n,o,l)},SwitchStatement(n,o,l){n.discriminant.parent=n,l(n.discriminant,o),n.cases.forEach(c=>{c.parent=n,l(c,o)})},SwitchCase(n,o,l){n.test&&(n.test.parent=n,l(n.test,o));const c=[];n.consequent.forEach(h=>{o.enterHoistingScope(),l(h,o);const p=o.exitHoistingScope();c.push(...p),c.push(h)}),n.consequent=c},AwaitExpression(n,o,l){n.argument&&(n.argument._insideAwait=!0,l(n.argument,o),n.argument.type==="Identifier"&&n.argument._wasInsideAwait===!0&&(n.type="Identifier",n.name=n.argument.name,n.argument._wasHoisted&&(n._wasHoisted=n.argument._wasHoisted),delete n.argument))}})}const g={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"},Fn=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends","enum"]),$n=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class Wn{constructor(e,i,r,s,a=0){this.type=e,this.value=i,this.line=r,this.column=s,this.indent=a}}var Un=Object.defineProperty,qn=(t,e,i)=>e in t?Un(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ve=(t,e,i)=>qn(t,typeof e!="symbol"?e+"":e,i);class Kn{constructor(e){Ve(this,"source"),Ve(this,"pos"),Ve(this,"line"),Ve(this,"column"),Ve(this,"tokens"),Ve(this,"indentStack"),Ve(this,"atLineStart"),Ve(this,"parenDepth"),Ve(this,"bracketDepth"),Ve(this,"braceDepth"),this.source=e,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 e=this.peek();if(e==="\r"){this.advance();continue}if(e===`
|
|
33
|
+
}`}function Tn(t){ie(t,null,{VariableDeclaration(e,i,r){e.declarations&&e.declarations.length>0&&e.declarations.forEach(s=>{if(s.init&&s.init.type==="ArrowFunctionExpression"&&s.init.start!==0){const a={type:"FunctionDeclaration",id:s.id,params:s.init.params,body:s.init.body.type==="BlockStatement"?s.init.body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:s.init.body}]},async:s.init.async,generator:!1};Object.assign(e,a)}}),e.body&&e.body.body&&e.body.body.forEach(s=>r(s,i))}})}function Pn(t,e){Yr(t,{VariableDeclaration(i){i.declarations.forEach(r=>{const s=r.init&&r.init.type==="MemberExpression"&&r.init.object&&(r.init.object.name==="context"||r.init.object.name===Y||r.init.object.name==="context2"),a=r.init&&r.init.type==="MemberExpression"&&r.init.object?.object&&(r.init.object.object.name==="context"||r.init.object.object.name===Y||r.init.object.object.name==="context2");(s||a)&&(r.id.name&&e.addContextBoundVar(r.id.name),r.id.properties&&r.id.properties.forEach(n=>{n.key.name&&e.addContextBoundVar(n.key.name)}))})}})}function Dn(t,e,i=!1){t.params.forEach(r=>{r.type==="Identifier"&&i&&e.addContextBoundVar(r.name,i)})}function Rn(t,e){let i;return bn(t,{FunctionDeclaration(r){r.id&&r.id.name&&(e.addReservedName(r.id.name),e.addUserFunction(r.id.name))},ArrowFunctionExpression(r){const s=r.start===0;s&&r.params&&r.params.length>0&&(i=r.params[0].name,r.params[0].name=Y),Dn(r,e,s)},VariableDeclaration(r,s){const a=s.length>1?s[s.length-2]:null,n=a&&(a.type==="ForOfStatement"||a.type==="ForInStatement")&&a.left===r;r.declarations.forEach(o=>{if(o.id.type==="Identifier")e.addReservedName(o.id.name);else if(o.id.type==="ObjectPattern")o.id.properties.forEach(l=>{l.key&&l.key.type==="Identifier"&&e.addReservedName(l.key.name)});else if(o.id.type==="ArrayPattern"){if(o.id.elements?.forEach(p=>{p&&p.type==="Identifier"&&e.addReservedName(p.name)}),n)return;const l=e.generateTempVar(),c={type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:l},init:o.init}]};o.id.elements?.forEach(p=>{p.type==="Identifier"&&e.addArrayPatternElement(p.name)});const h=o.id.elements.map((p,u)=>({type:"VariableDeclaration",kind:r.kind,declarations:[{type:"VariableDeclarator",id:p,init:{type:"MemberExpression",object:{type:"Identifier",name:l},property:{type:"Literal",value:u},computed:!0}}]}));Object.assign(r,{type:"BlockStatement",body:[c,...h]})}})},ForStatement(r){}}),i}const ci={type:"Identifier",name:"undefined"};function ae(t,e){const[i,r]=e.getVariable(t);if(i.match(/^fn\d+_/)&&t!=="$$"){const[s]=e.getVariable("$$");if(s)return S.createLocalContextVariableReference(r,i)}return S.createContextVariableReference(r,i)}function Jr(t,e){const i=ae(t,e);return S.createGetCall(i,0)}function pt(t,e){if(t.computed&&t.property.type==="Identifier"){if(e.isLoopVariable(t.property.name)){if(t.object.type==="Identifier"&&!e.isLoopVariable(t.object.name)){if(e.isLocalSeriesVar(t.object.name)){const i=S.createIdentifier(t.object.name);i._skipTransformation=!0;const r=S.createGetCall(i,t.property);Object.assign(t,r),t._indexTransformed=!0;return}if(!e.isContextBound(t.object.name)){const i=ae(t.object.name,e),r=S.createGetCall(i,t.property);Object.assign(t,r),t._indexTransformed=!0}}return}e.isContextBound(t.property.name)||(t.property=ae(t.property.name,e),t.property=S.createGetCall(t.property,0))}if(t.computed&&t.object.type==="Identifier"){if(e.isLoopVariable(t.object.name))return;if(e.isLocalSeriesVar(t.object.name)){const i=S.createIdentifier(t.object.name);i._skipTransformation=!0;const r=S.createGetCall(i,t.property);Object.assign(t,r),t._indexTransformed=!0;return}if(e.isContextBound(t.object.name)||(t.object=ae(t.object.name,e)),t.property.type==="MemberExpression"){const i=t.property;i._indexTransformed||(pt(i,e),i._indexTransformed=!0)}}}function je(t,e){const i=S.createGetCall(S.createIdentifier(t.name),0);t.start!==void 0&&(i.start=t.start),t.end!==void 0&&(i.end=t.end),i._indexTransformed=!0,Object.assign(t,i)}function re(t,e){if(!t._skipTransformation&&t.name!==Y){if(st.includes(t.name)&&e.isContextBound(t.name)){const u=t.parent&&t.parent.type==="CallExpression"&&t.parent.callee===t,f=t.parent&&t.parent.type==="MemberExpression"&&t.parent.object===t&&!t.parent.computed;if(!u&&!f){const m={type:"MemberExpression",object:{type:"Identifier",name:t.name},property:{type:"Identifier",name:"__value"},computed:!1},y=S.createGetCall(m,0);Object.assign(t,y),delete t.name;return}}if(t.name==="Math"||t.name==="NaN"||t.name==="undefined"||t.name==="Infinity"||t.name==="null"||t.name.startsWith("'")&&t.name.endsWith("'")||t.name.startsWith('"')&&t.name.endsWith('"')||t.name.startsWith("`")&&t.name.endsWith("`")||e.isLoopVariable(t.name))return;let i=!1;if(t.parent&&t.parent.type==="CallExpression"&&t.parent.arguments.includes(t)){const u=t.parent.callee;if(u.type==="MemberExpression"&&u.object&&u.object.name===Y&&["get","set","init","param","call"].includes(u.property.name)){const f=t.parent.arguments.indexOf(t);u.property.name==="call"?f>=2&&(i=!0):f===0&&(i=!0)}else{const f=u.type==="MemberExpression"&&u.object&&u.object.type==="Identifier"&&_t.includes(u.object.name);u.type==="MemberExpression"&&!f?i=!1:i=!0}}const r=t.parent&&t.parent.type==="MemberExpression"&&t.parent.object===t&&e.isContextBound(t.name),s=t.parent&&t.parent.type==="CallExpression"&&t.parent.callee&&t.parent.callee.type==="MemberExpression"&&t.parent.callee.property.name==="param";t.parent&&t.parent.type==="AssignmentExpression"&&t.parent.left;const a=t.parent&&t.parent.type==="CallExpression"&&t.parent.callee===t,n=t.parent&&t.parent.type==="MemberExpression"&&t.parent.computed&&t.parent.object===t,o=t.parent&&t.parent.type==="MemberExpression"&&t.parent.computed&&t.parent.property===t&&t.parent.parent&&t.parent.parent.type==="CallExpression"&&t.parent.parent.callee&&t.parent.parent.callee.type==="MemberExpression"&&e.isContextBound(t.parent.parent.callee.object.name);if(r||s||i||o||a){if(a||t.parent&&t.parent.type==="CallExpression"&&t.parent.callee&&t.parent.callee.type==="MemberExpression"&&t.parent.callee.object&&t.parent.callee.object.name===Y&&t.parent.callee.property.name==="call"&&t.parent.arguments[0]===t||e.isLocalSeriesVar(t.name)||e.isContextBound(t.name)&&!e.isRootParam(t.name))return;const u=ae(t.name,e);Object.assign(t,u);return}const l=e.isContextBound(t.name)&&!e.isRootParam(t.name);if(l){const u=t.parent&&t.parent.type==="CallExpression"&&t.parent.arguments.includes(t),f=t.parent&&t.parent.type==="SwitchStatement"&&t.parent.discriminant===t,m=t.parent&&t.parent.type==="SwitchCase"&&t.parent.test===t;if(!u&&!f&&!m)return}if(e.isLocalSeriesVar(t.name)){if(!n){const u=S.createIdentifier(t.name),f=S.createGetCall(u,0);Object.assign(t,f)}return}const[c,h]=e.getVariable(t.name);let p;if(l)p=S.createIdentifier(t.name);else{if(c===t.name&&!e.isContextBound(t.name))return;p=ae(t.name,e)}if(n)Object.assign(t,p);else{const u=S.createGetCall(p,0);Object.assign(t,u)}}}function be(t,e,i){if(t.object&&t.object.type==="Identifier"&&t.object.name==="Math")return;if(t.object&&t.object.type==="Identifier"&&_t.includes(t.object.name)&&i.isContextBound(t.object.name)&&!t.computed){const l=t.parent&&t.parent.type==="CallExpression"&&t.parent.callee===t,c=t.parent&&(t.parent.type==="VariableDeclarator"&&(t.parent.id.type==="ArrayPattern"||t.parent.id.type==="ObjectPattern")||t.parent.type==="AssignmentExpression"&&(t.parent.left.type==="ArrayPattern"||t.parent.left.type==="ObjectPattern")||t.parent.type==="Property");if(!l&&!c){const h={type:"CallExpression",callee:{type:"MemberExpression",object:t.object,property:t.property,computed:!1},arguments:[],_transformed:!1};t.start!==void 0&&(h.start=t.start),t.end!==void 0&&(h.end=t.end),Object.assign(t,h);return}}const r=i.getCurrentScopeType()=="if",s=i.getCurrentScopeType()=="els",a=i.getCurrentScopeType()=="for";if(!r&&!s&&!a&&t.object&&t.object.type==="Identifier"&&i.isContextBound(t.object.name)&&!i.isRootParam(t.object.name)&&!t.computed)return;t._indexTransformed||(pt(t,i),t._indexTransformed=!0);const n=t.object&&t.object.type==="MemberExpression"&&t.object.object&&t.object.object.type==="MemberExpression"&&t.object.object.object&&(t.object.object.object.name===Y||t.object.object.object.name==="$$"),o=t.object&&t.object.type==="Identifier"&&i.isContextBound(t.object.name);if(t.computed&&(n||o)){if(t.parent&&t.parent.type==="AssignmentExpression"&&t.parent.left===t)return;t.object.type==="Identifier"&&st.includes(t.object.name)&&i.isContextBound(t.object.name)&&(t.object={type:"MemberExpression",object:{type:"Identifier",name:t.object.name},property:{type:"Identifier",name:"__value"},computed:!1});const l=S.createGetCall(t.object,t.property);t.start&&(l.start=t.start),t.end&&(l.end=t.end),Object.assign(t,l),delete t.object,delete t.property,delete t.computed}}function wt(t,e){if(t.type==="Identifier"){if(st.includes(t.name)&&e.isContextBound(t.name)){const a=t.name;return Object.assign(t,{type:"MemberExpression",object:{type:"Identifier",name:a},property:{type:"Identifier",name:"__value"},computed:!1}),delete t.name,t}if(e.isLoopVariable(t.name))return t;if(e.isRootParam(t.name)){const[a,n]=e.getVariable(t.name);return S.createContextVariableReference(n,a)}if(e.isContextBound(t.name))return t;const[i,r]=e.getVariable(t.name),s=i!==t.name;return e.isLocalSeriesVar(t.name)&&!s?t:s?ae(t.name,e):i===t.name&&!e.isContextBound(t.name)?t:ae(t.name,e)}return t}function tt(t,e,i=""){switch(t.type){case"BinaryExpression":return hi(t,e,i);case"LogicalExpression":return ui(t,e,i);case"MemberExpression":{const r=t.object.type==="Identifier"?wt(t.object,e):t.object;let s=r;if(!t.computed&&t.object.type==="Identifier"){const[a]=e.getVariable(t.object.name);a!==t.object.name&&!e.isLoopVariable(t.object.name)&&(s=S.createGetCall(r,0))}return{type:"MemberExpression",object:s,property:t.property,computed:t.computed}}case"Identifier":{if(e.isLoopVariable(t.name)||t.parent&&t.parent.type==="MemberExpression"&&t.parent.property===t)return t;const r=wt(t,e);return r.type==="Identifier"&&(r.name==="NaN"||r.name==="undefined"||r.name==="Infinity"||r.name==="null"||r.name==="Math")?r:S.createGetCall(r,0)}case"UnaryExpression":return pi(t,e,i);case"ConditionalExpression":{const r=tt(t.test,e,i),s=tt(t.consequent,e,i),a=tt(t.alternate,e,i);return{type:"ConditionalExpression",test:r,consequent:s,alternate:a,start:t.start,end:t.end}}}return t}function hi(t,e,i){const r=tt(t.left,e,i),s=tt(t.right,e,i),a={type:"BinaryExpression",operator:t.operator,left:r,right:s,start:t.start,end:t.end};return ie(a,e,{CallExpression(n,o){n._transformed||oe(n,o)},MemberExpression(n){be(n,"",e)}}),a}function ui(t,e,i){const r=tt(t.left,e,i),s=tt(t.right,e,i),a={type:"LogicalExpression",operator:t.operator,left:r,right:s,start:t.start,end:t.end};return ie(a,e,{CallExpression(n,o){n._transformed||oe(n,o)}}),a}function Bi(t,e,i){ie(t,{parent:t,inNamespaceCall:!1},{Identifier(n,o,l){if(n.name=="NaN")return;if(st.includes(n.name)&&e.isContextBound(n.name)){const h={type:"MemberExpression",object:{type:"Identifier",name:n.name},property:{type:"Identifier",name:"__value"},computed:!1},p=S.createGetCall(h,0);Object.assign(n,p),delete n.name;return}n.parent=o.parent,re(n,e);const c=n.parent&&n.parent.type==="BinaryExpression";(n.parent&&n.parent.type==="ConditionalExpression"||c)&&(n.type==="MemberExpression"?pt(n,e):n.type==="Identifier"&&(n.parent&&n.parent.type==="CallExpression"&&n.parent.callee&&n.parent.callee.object&&n.parent.callee.object.name===Y&&n.parent.callee.property.name==="get"||je(n)))},MemberExpression(n,o,l){be(n,"",e),n.object&&l(n.object,{parent:n,inNamespaceCall:o.inNamespaceCall})},ConditionalExpression(n,o,l){const c={...o,parent:n};n.test&&l(n.test,c),n.consequent&&l(n.consequent,c),n.alternate&&l(n.alternate,c)},BinaryExpression(n,o,l){const c={...o,parent:n};l(n.left,c),l(n.right,c)},LogicalExpression(n,o,l){const c={...o,parent:n};l(n.left,c),l(n.right,c)},UnaryExpression(n,o,l){const c={...o,parent:n};l(n.argument,c)},CallExpression(n,o,l){const c=n.callee&&n.callee.type==="MemberExpression"&&n.callee.object&&n.callee.object.type==="Identifier"&&e.isContextBound(n.callee.object.name);oe(n,e),n.arguments.forEach(h=>l(h,{parent:n,inNamespaceCall:c||o.inNamespaceCall}))}});const r=S.createMemberExpression(S.createIdentifier(i),S.createIdentifier("param")),s=e.generateParamId(),a={type:"CallExpression",callee:r,arguments:[t,ci,{type:"Identifier",name:`'${s}'`}],_transformed:!0,_isParamCall:!0};if(!e.shouldSuppressHoisting()){const n=s;e.addLocalSeriesVar(n);const o=S.createVariableDeclaration(n,a);return e.addHoistedStatement(o),S.createIdentifier(n)}return a}function pi(t,e,i){const r=tt(t.argument,e,i),s={type:"UnaryExpression",operator:t.operator,prefix:t.prefix,argument:r,start:t.start,end:t.end};return ie(s,e,{CallExpression(a,n){a._transformed||oe(a,n)},MemberExpression(a){be(a,"",e)}}),s}function ot(t,e,i){switch(t?.type){case"BinaryExpression":t=hi(t,i,e);break;case"LogicalExpression":t=ui(t,i,e);break;case"ConditionalExpression":return Bi(t,i,e);case"UnaryExpression":t=pi(t,i,e);break;case"ArrayExpression":t.elements=t.elements.map(c=>c.type==="Identifier"?i.isContextBound(c.name)&&!i.isRootParam(c.name)?c:Jr(c.name,i):c);break}const r=t.type==="MemberExpression"&&t.computed&&t.property,s=t.type==="MemberExpression"&&!t.computed;if(r){t.object.type==="CallExpression"?oe(t.object,i):t.object.type==="MemberExpression"?be(t.object,"",i):t.object.type==="BinaryExpression"?t.object=hi(t.object,i,e):t.object.type==="LogicalExpression"?t.object=ui(t.object,i,e):t.object.type==="ConditionalExpression"?t.object=Bi(t.object,i,e):t.object.type==="UnaryExpression"&&(t.object=pi(t.object,i,e));const c=t.object.type==="Identifier"&&i.isContextBound(t.object.name)&&!i.isRootParam(t.object.name)?t.object:wt(t.object,i),h=t.property.type==="Identifier"&&!i.isContextBound(t.property.name)&&!i.isLoopVariable(t.property.name)?S.createGetCall(wt(t.property,i),0):t.property,p=S.createMemberExpression(S.createIdentifier(e),S.createIdentifier("param")),u=i.generateParamId(),f={type:"CallExpression",callee:p,arguments:[c,h,{type:"Identifier",name:`'${u}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const m=u;i.addLocalSeriesVar(m);const y=S.createVariableDeclaration(m,f);return i.addHoistedStatement(y),S.createIdentifier(m)}return f}if(s){if(t.object.type==="Identifier"&&_t.includes(t.object.name)&&i.isContextBound(t.object.name)&&!t.computed){const c=t.object.name,h={type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:c},property:{type:"Identifier",name:t.property.name},computed:!1},arguments:[],_transformed:!0};c==="ta"&&h.arguments.push(i.getNextTACallId());const p=i.generateTempVar();i.addLocalSeriesVar(p);const u=S.createVariableDeclaration(p,h);return i.addOuterHoistedStatement(u),Object.assign(t,S.createIdentifier(p)),t}if(t.object.type==="Identifier"){const c=t.object.name,[h,p]=i.getVariable(c);if(h!==c&&!i.isLoopVariable(c)){const u=S.createContextVariableReference(p,h),f=S.createGetCall(u,0);t.object=f}}else t.object.type==="MemberExpression"?ot(t.object,e,i):t.object.type==="CallExpression"&&(t.object._transformed||oe(t.object,i))}if(t.type==="ObjectExpression"&&(t.properties=t.properties.map(c=>c.value.name?i.isContextBound(c.value.name)&&!i.isRootParam(c.value.name)?{type:"Property",key:{type:"Identifier",name:c.key.name},value:S.createIdentifier(c.value.name),kind:"init",method:!1,shorthand:!1,computed:!1}:{type:"Property",key:{type:"Identifier",name:c.key.name},value:ae(c.value.name,i),kind:"init",method:!1,shorthand:!1,computed:!1}:(c.value.type!=="Literal"&&(c.value=ot(c.value,e,i)),c))),t.type==="Identifier"){if(st.includes(t.name)&&i.isContextBound(t.name)){const c=t.name;Object.assign(t,{type:"MemberExpression",object:{type:"Identifier",name:c},property:{type:"Identifier",name:"__value"},computed:!1}),delete t.name}else if(i.isContextBound(t.name)&&!i.isRootParam(t.name)){const c=S.createMemberExpression(S.createIdentifier(e),S.createIdentifier("param")),h=i.generateParamId(),p={type:"CallExpression",callee:c,arguments:[t,ci,{type:"Identifier",name:`'${h}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const u=h;i.addLocalSeriesVar(u);const f=S.createVariableDeclaration(u,p);return i.addHoistedStatement(f),S.createIdentifier(u)}return p}}t?.type==="CallExpression"&&oe(t,i);const a=S.createMemberExpression(S.createIdentifier(e),S.createIdentifier("param")),n=t.type==="Identifier"?wt(t,i):t,o=i.generateParamId(),l={type:"CallExpression",callee:a,arguments:[n,ci,{type:"Identifier",name:`'${o}'`}],_transformed:!0,_isParamCall:!0};if(!i.shouldSuppressHoisting()){const c=o;i.addLocalSeriesVar(c);const h=S.createVariableDeclaration(c,l);return i.addHoistedStatement(h),S.createIdentifier(c)}return l}function fi(t,e,i){t&&(t.type==="Identifier"?(t.parent=e,re(t,i)):t.type==="MemberExpression"?fi(t.object,t,i):t.type==="CallExpression"&&(t.callee&&t.callee.type==="MemberExpression"&&fi(t.callee.object,t.callee,i),t._transformed||oe(t,i)))}function oe(t,e,i){if(t._transformed)return;t.callee&&t.callee.name,t.callee&&t.callee.type==="Identifier"&&(_t.includes(t.callee.name)||st.includes(t.callee.name))&&e.isContextBound(t.callee.name)&&(t.callee=S.createMemberExpression(t.callee,S.createIdentifier("any")));const r=t.callee&&t.callee.type==="MemberExpression"&&t.callee.object&&t.callee.object.type==="Identifier"&&(e.isContextBound(t.callee.object.name)||t.callee.object.name==="math"||t.callee.object.name==="ta");if(r){if(t.callee.object.name===Y&&["get","init","param"].includes(t.callee.property.name))return;const s=t.callee.object.name,a=[];if(t.arguments.forEach(h=>{if(h._isParamCall){a.push(h);return}a.push(ot(h,s,e))}),t.arguments=a,["plot","hline","fill"].includes(s)){const h=e.getNextPlotCallId();t.arguments.push({type:"ObjectExpression",properties:[{type:"Property",key:{type:"Identifier",name:"__callsiteId"},value:h,kind:"init",computed:!1,shorthand:!1}]})}if(s==="ta")if(e.getCurrentScopeType()==="fn"){const h=e.getNextTACallId(),[p]=e.getVariable("$$");let u;p?u=S.createMemberExpression(S.createLocalContextIdentifier(),S.createIdentifier("id")):u=S.createLiteral("");const f={type:"BinaryExpression",operator:"+",left:u,right:h};t.arguments.push(f)}else t.arguments.push(e.getNextTACallId());const n=t.callee.property.name,o=`${s}.${n}`,l=wn.includes(o),c=t._insideAwait===!0;if(l&&!c){const h=Object.assign({},t),p=S.createAwaitExpression(h);Object.assign(t,p)}if(!e.shouldSuppressHoisting()){const h=e.generateTempVar();e.addLocalSeriesVar(h);const p=t._insideAwait===!0;let u=Object.assign({},t);p&&(u=S.createAwaitExpression(u));const f=S.createVariableDeclaration(h,u);e.addHoistedStatement(f);const m=S.createIdentifier(h);Object.assign(t,m),t._wasHoisted=!0,t._wasInsideAwait=p;return}t._transformed=!0}else if(t.callee&&t.callee.type==="Identifier"){if(t.arguments=t.arguments.map(s=>s._isParamCall?s:ot(s,Y,e)),!e.isContextBound(t.callee.name)){const s=e.getNextUserCallId(),a=S.createMemberExpression(S.createContextIdentifier(),S.createIdentifier("call")),n=[t.callee,s,...t.arguments];t.callee=a,t.arguments=n}t._transformed=!0}if(!r&&t.callee&&t.callee.type==="MemberExpression"){const s=t.callee.property.name;if(e.isUserFunction(s)&&!e.isContextBound(s)){const a=t.callee.object;t.callee.property;const n=t.arguments.map(p=>p._isParamCall?p:ot(p,Y,e));let o=a;a.type==="Identifier"?o=ot(a,Y,e):a.type==="CallExpression"&&(oe(a,e),o=ot(a,Y,e));const l=S.createMemberExpression(S.createContextIdentifier(),S.createIdentifier("call")),c=e.getNextUserCallId(),h=[S.createIdentifier(s),c,o,...n];t.callee=l,t.arguments=h,t._transformed=!0;return}t.callee.object.type==="Identifier"?re(t.callee.object,e):fi(t.callee.object,t.callee,e)}t.arguments.forEach(s=>{ie(s,{parent:t},{Identifier(a,n,o){a.parent=n.parent,re(a,e);const l=a.parent&&a.parent.type==="BinaryExpression";(a.parent&&a.parent.type==="ConditionalExpression"||l)&&(a.type==="MemberExpression"?pt(a,e):a.type==="Identifier"&&(a.parent&&a.parent.type==="CallExpression"&&a.parent.callee&&a.parent.callee.object&&a.parent.callee.object.name===Y&&a.parent.callee.property.name==="get"||je(a)))},BinaryExpression(a,n,o){const l={...n,parent:a};o(a.left,l),o(a.right,l)},LogicalExpression(a,n,o){const l={...n,parent:a};o(a.left,l),o(a.right,l)},UnaryExpression(a,n,o){const l={...n,parent:a};o(a.argument,l)},CallExpression(a,n,o){a.callee&&a.callee.type==="MemberExpression"&&a.callee.object&&(a.callee.object.parent=a.callee,o(a.callee.object,{parent:a.callee})),a._transformed||oe(a,e)},MemberExpression(a,n,o){be(a,"",e),a.object&&o(a.object,{parent:a})}})})}function di(t,e){let i=null;if(t.left.type==="Identifier")i=ae(t.left.name,e);else if(t.left.type==="MemberExpression"&&t.left.computed){if(t.left.object.type==="Identifier"){const r=t.left.object.name,[s,a]=e.getVariable(r),n=s!==r,o=e.isContextBound(r);(n||o)&&!e.isLoopVariable(r)&&t.left.property.type==="Literal"&&t.left.property.value===0&&(i=ae(r,e))}}else if(t.left.type==="MemberExpression"&&!t.left.computed&&t.left.object.type==="Identifier"){const r=t.left.object.name,[s,a]=e.getVariable(r);if(s!==r&&!e.isLoopVariable(r)){const n=ae(r,e),o=S.createGetCall(n,0);t.left.object=o}}if(ie(t.right,{parent:t.right,inNamespaceCall:!1},{Identifier(r,s,a){if(st.includes(r.name)&&e.isContextBound(r.name)){const m={type:"MemberExpression",object:{type:"Identifier",name:r.name},property:{type:"Identifier",name:"__value"},computed:!1},y=S.createGetCall(m,0);Object.assign(r,y),delete r.name;return}r.parent=s.parent,re(r,e);const n=r.parent&&r.parent.type==="BinaryExpression",o=r.parent&&r.parent.type==="ConditionalExpression",l=e.isContextBound(r.name)&&!e.isRootParam(r.name),c=r.parent&&r.parent.type==="MemberExpression"&&r.parent.computed&&r.parent.object===r,h=r.parent&&r.parent._isParamCall,p=r.parent&&r.parent.type==="MemberExpression",u=r.name==="NaN",f=r.parent&&r.parent.type==="CallExpression"&&r.parent.callee&&r.parent.callee.object&&r.parent.callee.object.name===Y&&r.parent.callee.property.name==="get";(l||o||n)&&(r.type==="MemberExpression"?pt(r,e):r.type==="Identifier"&&!p&&!c&&!h&&!u&&!f&&je(r))},MemberExpression(r,s,a){be(r,"",e),r.type==="CallExpression"?r.arguments.forEach(n=>a(n,{parent:r,inNamespaceCall:s.inNamespaceCall})):r.object&&a(r.object,{parent:r,inNamespaceCall:s.inNamespaceCall})},CallExpression(r,s,a){const n=r.callee&&r.callee.type==="MemberExpression"&&r.callee.object&&r.callee.object.type==="Identifier"&&e.isContextBound(r.callee.object.name);oe(r,e),r.type==="CallExpression"&&(r.callee.type==="MemberExpression"&&a(r.callee,{parent:r,inNamespaceCall:n||s.inNamespaceCall}),r.arguments.forEach(o=>a(o,{parent:r,inNamespaceCall:n||s.inNamespaceCall})))}}),i){let r=t.right;if(t.operator!=="="){const a=t.operator.replace("=",""),n=S.createGetCall(i,0);r={type:"BinaryExpression",operator:a,left:n,right:t.right,start:t.start,end:t.end}}const s=S.createSetCall(i,r);t.start&&(s.start=t.start),t.end&&(s.end=t.end),Object.assign(t,s)}}function es(t,e){t._skipTransformation||t.declarations.forEach(i=>{if(i.init&&i.init.type==="Identifier"&&st.includes(i.init.name)&&e.isContextBound(i.init.name)){const u=i.init.name;Object.assign(i.init,{type:"MemberExpression",object:{type:"Identifier",name:u},property:{type:"Identifier",name:"__value"},computed:!1}),delete i.init.name}const r=i.init&&i.init.type==="MemberExpression"&&i.init.object&&(i.init.object.name==="context"||i.init.object.name===Y||i.init.object.name==="context2"),s=i.init&&i.init.type==="MemberExpression"&&i.init.object?.object&&(i.init.object.object.name==="context"||i.init.object.object.name===Y||i.init.object.object.name==="context2"),a=i.init&&i.init.type==="ArrowFunctionExpression";if(r){i.id.name&&e.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(u=>{u.key.name&&e.addContextBoundVar(u.key.name)}),i.init.object.name=Y;return}if(s){i.id.name&&e.addContextBoundVar(i.id.name),i.id.properties&&i.id.properties.forEach(u=>{u.key.name&&e.addContextBoundVar(u.key.name)}),i.init.object.object.name=Y;return}e.addVariable(i.id.name,t.kind);const n=t.kind,o=e.isArrayPatternElement(i.id.name);i.init&&!a&&!o&&(i.init.type==="CallExpression"&&i.init.callee.type==="MemberExpression"&&i.init.callee.object&&i.init.callee.object.type==="Identifier"&&e.isContextBound(i.init.callee.object.name)?oe(i.init,e):ie(i.init,{parent:i.init},{Identifier(u,f){u.parent=f.parent,re(u,e);const m=u.parent&&u.parent.type==="BinaryExpression",y=u.parent&&u.parent.type==="UnaryExpression",_=u.parent&&u.parent.type==="ConditionalExpression",b=u.parent&&u.parent.type==="CallExpression"&&u.parent.callee&&u.parent.callee.object&&u.parent.callee.object.name===Y&&u.parent.callee.property.name==="get";u.type==="Identifier"&&(m||y||_)&&!b&&je(u)},CallExpression(u,f,m){u.callee.type==="Identifier"&&(u.callee.parent=u),u.arguments.forEach(y=>{y.type==="Identifier"&&(y.parent=u)}),(u.callee.type==="ArrowFunctionExpression"||u.callee.type==="FunctionExpression")&&m(u.callee,{parent:u}),oe(u,e),u.type==="CallExpression"&&(u.callee.type==="MemberExpression"&&m(u.callee,{parent:u}),u.arguments.forEach(y=>m(y,{parent:u})))},BinaryExpression(u,f,m){u.left.type==="Identifier"&&(u.left.parent=u),u.right.type==="Identifier"&&(u.right.parent=u),m(u.left,{parent:u}),m(u.right,{parent:u})},MemberExpression(u,f,m){u.object&&u.object.type==="Identifier"&&(u.object.parent=u),u.property&&u.property.type==="Identifier"&&(u.property.parent=u),be(u,"",e),u.type==="CallExpression"?u.arguments.forEach(y=>m(y,{parent:u})):u.object&&m(u.object,{parent:u})},AwaitExpression(u,f,m){u.argument&&(u.argument._insideAwait=!0,m(u.argument,{parent:u}),u.argument.type==="Identifier"&&u.argument._wasInsideAwait&&Object.assign(u,u.argument))},ArrowFunctionExpression(u,f,m){if(u.body)if(u.body.type==="BlockStatement"){const y=[];u.body.body.forEach(_=>{e.enterHoistingScope(),m(_,{parent:u.body,insideIIFE:!0});const b=e.exitHoistingScope();y.push(...b),y.push(_)}),u.body.body=y}else m(u.body,{parent:u,insideIIFE:!0})},FunctionExpression(u,f,m){if(u.body&&u.body.type==="BlockStatement"){const y=[];u.body.body.forEach(_=>{e.enterHoistingScope(),m(_,{parent:u.body,insideIIFE:!0});const b=e.exitHoistingScope();y.push(...b),y.push(_)}),u.body.body=y}},SwitchStatement(u,f,m){u.discriminant&&(u.discriminant.parent=u,m(u.discriminant,{parent:u})),u.cases&&u.cases.forEach(y=>{y.parent=u,m(y,{parent:u})})},SwitchCase(u,f,m){if(u.test&&(u.test.parent=u,m(u.test,{parent:u})),u.consequent){const y=[];u.consequent.forEach(_=>{e.enterHoistingScope(),_.parent=u,m(_,{parent:u});const b=e.exitHoistingScope();y.push(...b),y.push(_)}),u.consequent=y}},AssignmentExpression(u,f,m){if(f.insideIIFE){if(u.left.type==="Identifier"){const[y]=e.getVariable(u.left.name);if(y===u.left.name&&!e.isContextBound(u.left.name)){m(u.right,{parent:u});return}}di(u,e)}}}));const l=ae(i.id.name,e),c=!o&&i.init&&i.init.type==="MemberExpression"&&i.init.computed&&i.init.property&&(i.init.property.type==="Literal"||i.init.property.type==="MemberExpression");if(i.init?.property?.type==="MemberExpression"&&(i.init.property._indexTransformed||(pt(i.init.property,e),i.init.property._indexTransformed=!0)),n==="var"){const u=e.getCurrentHoistingScope();if(u){for(const f of u)if(f.type==="VariableDeclaration")for(const m of f.declarations){if(!m.init||m.init.type!=="CallExpression")continue;const y=m.init.callee;if(y?.type!=="MemberExpression")continue;let _;const b=y.property?.name;if(y.object?.type==="Identifier"?_=y.object.name:y.object?.type==="MemberExpression"&&y.object.property?.name&&(_=y.object.property.name),_&&b){const w=`${_}.${b}`;Sn.includes(w)&&(m.init={type:"ArrowFunctionExpression",params:[],body:m.init,expression:!0,async:!1})}}}}let h;i.init?a||o?h=i.init:n==="var"?h=S.createInitVarCall(l,i.init):h=S.createInitCall(l,c?i.init.object:i.init,c?i.init.property:void 0):h=S.createIdentifier("undefined");const p=S.createExpressionStatement(S.createAssignmentExpression(l,h));if(o){const u=i.init.object.name,f=ae(u,e),m=i.init.property.value,y={type:"MemberExpression",object:S.createGetCall(f,0),property:{type:"Literal",value:m},computed:!0};p.expression.right=S.createCallExpression(S.createMemberExpression(S.createContextIdentifier(),S.createIdentifier("init")),[l,y])}a&&(e.pushScope("fn"),ie(i.init.body,e,{IfStatement(u,f,m){f.pushScope("if"),m(u.consequent,f),u.alternate&&(f.pushScope("els"),m(u.alternate,f),f.popScope()),f.popScope()},VariableDeclaration(u,f){es(u,f)},Identifier(u,f){re(u,f)},AssignmentExpression(u,f){di(u,f)},SwitchStatement(u,f,m){u.discriminant.parent=u,m(u.discriminant,f),u.cases.forEach(y=>{y.parent=u,m(y,f)})},SwitchCase(u,f,m){u.test&&(u.test.parent=u,m(u.test,f));const y=[];u.consequent.forEach(_=>{f.enterHoistingScope(),m(_,f);const b=f.exitHoistingScope();y.push(...b),y.push(_)}),u.consequent=y},BlockStatement(u,f,m){const y=[];u.body.forEach(_=>{f.enterHoistingScope(),m(_,f);const b=f.exitHoistingScope();y.push(...b),y.push(_)}),u.body=y}}),e.popScope()),Object.assign(t,p)})}function On(t,e,i){if(e.setSuppressHoisting(!0),t.init&&t.init.type==="VariableDeclaration"){const r=t.init.declarations[0],s=r.id.name;e.addLoopVariable(s,s),t.init={type:"VariableDeclaration",kind:t.init.kind,declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:s},init:r.init}]},r.init&&ie(r.init,e,{Identifier(a,n){e.isLoopVariable(a.name)||(e.pushScope("for"),re(a,n),e.popScope())},MemberExpression(a){e.pushScope("for"),be(a,"",e),e.popScope()},CallExpression(a,n,o){a.callee.parent=a,o(a.callee,n);for(const l of a.arguments)o(l,n)}})}if(t.test&&ie(t.test,e,{Identifier(r,s){!e.isLoopVariable(r.name)&&!r.computed&&(e.pushScope("for"),re(r,s),r.type==="Identifier"&&(r.computed=!0,je(r)),e.popScope())},MemberExpression(r){e.pushScope("for"),be(r,"",e),e.popScope()},CallExpression(r,s,a){r.callee.parent=r,a(r.callee,s);for(const n of r.arguments)a(n,s)}}),t.update&&ie(t.update,e,{Identifier(r,s){e.isLoopVariable(r.name)||(e.pushScope("for"),re(r,s),e.popScope())}}),e.setSuppressHoisting(!1),e.pushScope("for"),i(t.body,e),e.popScope(),t.init&&t.init.type==="VariableDeclaration"){const r=t.init.declarations[0];e.removeLoopVariable(r.id.name)}}function Mn(t,e){ie(t,e,{MemberExpression(i,r,s){i.object&&i.object.type==="Identifier"&&!e.isContextBound(i.object.name)&&!i.computed&&(i.object.parent=i,s(i.object,r)),be(i,"",e)},CallExpression(i,r){oe(i,r)},Identifier(i,r){re(i,r);const s=e.getCurrentScopeType()==="if";e.isContextBound(i.name)&&!e.isRootParam(i.name)&&s&&je(i)}})}function Vn(t,e,i){t.test&&(e.pushScope("if"),Mn(t.test,e),e.popScope()),e.pushScope("if"),i(t.consequent,e),e.popScope(),t.alternate&&(e.pushScope("els"),i(t.alternate,e),e.popScope())}function Ln(t,e){const i=e.getCurrentScopeType();if(t.argument&&(t.argument.type==="ArrayExpression"?(t.argument.elements=t.argument.elements.map(r=>r.type==="Identifier"?e.isContextBound(r.name)&&!e.isRootParam(r.name)?S.createGetCall(r,0):Jr(r.name,e):r.type==="MemberExpression"?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)?S.createGetCall(r,0):(r.computed&&r.object.type==="Identifier"&&e.isContextBound(r.object.name)&&!e.isRootParam(r.object.name)||be(r,"",e),r):r),t.argument={type:"ArrayExpression",elements:[t.argument]}):t.argument.type==="ObjectExpression"?t.argument.properties=t.argument.properties.map(r=>r.shorthand?e.isContextBound(r.value.name)?r:(e.getVariable(r.value.name),{type:"Property",key:S.createIdentifier(r.key.name),value:ae(r.value.name,e),kind:"init",method:!1,shorthand:!1,computed:!1}):(r.value&&r.value.type==="Identifier"&&(e.isContextBound(r.value.name)&&!e.isRootParam(r.value.name)||e.isContextBound(r.value.name)||(r.value=ae(r.value.name,e))),r)):t.argument.type==="Identifier"?(re(t.argument,e),t.argument.type==="Identifier"&&je(t.argument)):t.argument.type==="MemberExpression"&&t.argument.object.type==="Identifier"&&!e.isContextBound(t.argument.object.name)&&!e.isLoopVariable(t.argument.object.name)&&re(t.argument.object,e),i==="fn")){t.argument.type==="Identifier"&&e.isContextBound(t.argument.name)&&!e.isRootParam(t.argument.name)?t.argument=S.createArrayAccess(t.argument,0):t.argument.type==="MemberExpression"?t.argument.object.type==="Identifier"&&e.isContextBound(t.argument.object.name)&&!e.isRootParam(t.argument.object.name)&&(t.argument._indexTransformed||(pt(t.argument,e),t.argument._indexTransformed=!0)):(t.argument.type==="BinaryExpression"||t.argument.type==="LogicalExpression"||t.argument.type==="ConditionalExpression"||t.argument.type==="CallExpression")&&ie(t.argument,e,{Identifier(s,a){re(s,a),s.type==="Identifier"&&!s._arrayAccessed&&(je(s),s._arrayAccessed=!0)},MemberExpression(s){be(s,"",e)},CallExpression(s,a,n){(s.callee.type==="ArrowFunctionExpression"||s.callee.type==="FunctionExpression")&&n(s.callee,a),oe(s,a),s.type==="CallExpression"&&s.arguments.forEach(o=>n(o,a))},BinaryExpression(s,a,n){n(s.left,a),n(s.right,a)},ArrowFunctionExpression(s,a,n){if(s.body)if(s.body.type==="BlockStatement"){const o=[];s.body.body.forEach(l=>{e.enterHoistingScope(),n(l,a);const c=e.exitHoistingScope();o.push(...c),o.push(l)}),s.body.body=o}else n(s.body,a)},FunctionExpression(s,a,n){if(s.body&&s.body.type==="BlockStatement"){const o=[];s.body.body.forEach(l=>{e.enterHoistingScope(),n(l,a);const c=e.exitHoistingScope();o.push(...c),o.push(l)}),s.body.body=o}},SwitchStatement(s,a,n){s.discriminant.parent=s,n(s.discriminant,a),s.cases.forEach(o=>{o.parent=s,n(o,a)})},SwitchCase(s,a,n){s.test&&(s.test.parent=s,n(s.test,a));const o=[];s.consequent.forEach(l=>{e.enterHoistingScope(),n(l,a);const c=e.exitHoistingScope();o.push(...c),o.push(l)}),s.consequent=o},BlockStatement(s,a,n){const o=[];s.body.forEach(l=>{a.enterHoistingScope(),n(l,a);const c=a.exitHoistingScope();o.push(...c),o.push(l)}),s.body=o}});const r=S.createCallExpression(S.createMemberExpression(S.createContextIdentifier(),S.createIdentifier("precision")),[t.argument]);t.argument=r}}function jn(t,e,i){const r=S.createVariableDeclaration("$$",S.createCallExpression(S.createMemberExpression(S.createContextIdentifier(),S.createIdentifier("peekCtx")),[]));r._skipTransformation=!0,e.addLoopVariable("$$","$$"),t.body&&t.body.type==="BlockStatement"&&(t.body.body.unshift(r),e.pushScope("fn"),t.params.forEach(s=>{s.type==="Identifier"&&e.addLocalSeriesVar(s.name)}),i(t.body,e),t.params.forEach(s=>{s.type==="Identifier"&&e.removeLocalSeriesVar(s.name)}),e.popScope())}function Bn(t){const e={...C,LineComment:()=>{}};Yr(t,{BinaryExpression(i){if(i.operator==="=="||i.operator==="==="){const r=i.left,s=i.right,a=S.createMathEqCall(r,s);a._transformed=!0,Object.assign(i,a)}}},e)}function Fn(t,e,i,r={debug:!1,ln:!1},s=[]){const a=n=>{if(!r.debug||!n.loc||!s.length)return null;const o=n.loc.start.line-1;if(o>=0&&o<s.length){const l=s[o].trim();if(l)return{type:"LineComment",value:`${r.ln?` [Line ${n.loc.start.line}]`:""} ${l}`}}return null};ie(t,e,{Program(n,o,l){const c=[];n.body.forEach(h=>{o.enterHoistingScope(),l(h,o);const p=o.exitHoistingScope(),u=a(h);u&&c.push(u),c.push(...p),c.push(h)}),n.body=c},BlockStatement(n,o,l){const c=[];n.body.forEach(h=>{o.enterHoistingScope(),l(h,o);const p=o.exitHoistingScope(),u=a(h);u&&c.push(u),c.push(...p),c.push(h)}),n.body=c},ReturnStatement(n,o){Ln(n,o)},VariableDeclaration(n,o){es(n,o)},Identifier(n,o){re(n,o)},CallExpression(n,o,l){n.callee&&(n.callee.type==="ArrowFunctionExpression"||n.callee.type==="FunctionExpression")?l(n.callee,o):n.callee&&n.callee.type==="MemberExpression"&&n.callee.object&&(n.callee.object.parent=n.callee,l(n.callee.object,o)),oe(n,o)},ArrowFunctionExpression(n,o,l){n.body&&l(n.body,o)},FunctionExpression(n,o,l){n.body&&l(n.body,o)},ForOfStatement(n,o,l){if(n.left&&n.left.type==="VariableDeclaration"){n.left._skipTransformation=!0;const c=n.left.declarations[0];c.id.type==="Identifier"?o.addLoopVariable(c.id.name,c.id.name):c.id.type==="ArrayPattern"&&c.id.elements.forEach(h=>{h.type==="Identifier"&&o.addLoopVariable(h.name,h.name)})}if(n.right&&n.right.type==="Identifier"){re(n.right,o),n.right.type==="Identifier"&&je(n.right);const c={...n.right};let h=S.createMemberExpression(c,S.createIdentifier("array"),!1);n.left&&n.left.type==="VariableDeclaration"&&n.left.declarations[0].id.type==="ArrayPattern"&&(h=S.createCallExpression(S.createMemberExpression(h,S.createIdentifier("entries"),!1),[])),Object.assign(n.right,h)}else n.right&&l(n.right,o);if(n.body&&l(n.body,o),n.left&&n.left.type==="VariableDeclaration"){const c=n.left.declarations[0];c.id.type==="Identifier"?o.removeLoopVariable(c.id.name):c.id.type==="ArrayPattern"&&c.id.elements.forEach(h=>{h.type==="Identifier"&&o.removeLoopVariable(h.name)})}},ForInStatement(n,o,l){n.left&&n.left.type==="VariableDeclaration"&&(n.left._skipTransformation=!0),n.right&&n.right.type==="Identifier"?(re(n.right,o),n.right.type==="Identifier"&&je(n.right)):n.right&&l(n.right,o),n.body&&l(n.body,o)},MemberExpression(n,o,l){n.object&&(n.object.type==="CallExpression"||n.object.type==="MemberExpression")&&(n.object.parent=n,l(n.object,o)),n.object&&n.object.type==="Identifier"&&!o.isContextBound(n.object.name)&&(n.object.parent=n,l(n.object,o)),be(n,i,o)},AssignmentExpression(n,o,l){if(di(n,o),n.type==="CallExpression"&&n.arguments){const c=h=>{h&&(h.type==="CallExpression"&&h.callee&&(h.callee.type==="ArrowFunctionExpression"||h.callee.type==="FunctionExpression")&&l(h.callee,o),h.type==="BinaryExpression"&&(c(h.left),c(h.right)))};n.arguments.forEach(h=>c(h))}},FunctionDeclaration(n,o,l){jn(n,o,l)},ForStatement(n,o,l){On(n,o,l)},IfStatement(n,o,l){Vn(n,o,l)},SwitchStatement(n,o,l){n.discriminant.parent=n,l(n.discriminant,o),n.cases.forEach(c=>{c.parent=n,l(c,o)})},SwitchCase(n,o,l){n.test&&(n.test.parent=n,l(n.test,o));const c=[];n.consequent.forEach(h=>{o.enterHoistingScope(),l(h,o);const p=o.exitHoistingScope();c.push(...p),c.push(h)}),n.consequent=c},AwaitExpression(n,o,l){n.argument&&(n.argument._insideAwait=!0,l(n.argument,o),n.argument.type==="Identifier"&&n.argument._wasInsideAwait===!0&&(n.type="Identifier",n.name=n.argument.name,n.argument._wasHoisted&&(n._wasHoisted=n.argument._wasHoisted),delete n.argument))}})}const g={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"},$n=new Set(["if","else","for","while","switch","break","continue","var","varip","type","and","or","not","to","by","in","import","export","method","extends","enum"]),Wn=["==","!=","<=",">=",":=","+=","-=","*=","/=","%=","=>","//","and","or","not"];class Un{constructor(e,i,r,s,a=0){this.type=e,this.value=i,this.line=r,this.column=s,this.indent=a}}var qn=Object.defineProperty,Kn=(t,e,i)=>e in t?qn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Me=(t,e,i)=>Kn(t,typeof e!="symbol"?e+"":e,i);class zn{constructor(e){Me(this,"source"),Me(this,"pos"),Me(this,"line"),Me(this,"column"),Me(this,"tokens"),Me(this,"indentStack"),Me(this,"atLineStart"),Me(this,"parenDepth"),Me(this,"bracketDepth"),Me(this,"braceDepth"),this.source=e,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 e=this.peek();if(e==="\r"){this.advance();continue}if(e===`
|
|
34
34
|
`){this.handleNewline();continue}if(this.atLineStart&&e!==`
|
|
35
35
|
`){this.handleIndentation(),this.atLineStart=!1;continue}if(e===" "||e===" "){this.advance();continue}if(this.pos>=this.source.length)break;if(e==="/"&&this.peek(1)==="/"){this.readComment();continue}if(e==='"'||e==="'"){this.readString();continue}if(e==="#"){this.readColorLiteral();continue}if(this.isDigit(e)){this.readNumber();continue}if(this.isIdentifierStart(e)){this.readIdentifier();continue}if(!this.readOperatorOrPunctuation())throw new Error(`Unexpected character '${e}' at ${this.line}:${this.column}`)}for(;this.indentStack.length>1;)this.indentStack.pop(),this.addToken(g.DEDENT,"",this.getCurrentIndent());return this.addToken(g.EOF,""),this.tokens}handleNewline(){this.parenDepth===0&&this.bracketDepth===0&&this.braceDepth===0&&(this.addToken(g.NEWLINE,`
|
|
36
36
|
`),this.atLineStart=!0),this.advance(),this.line++,this.column=1}handleIndentation(){let e=0,i=0;for(this.pos;this.pos<this.source.length;){const s=this.peek();if(s===" ")i++,this.advance();else if(s===" ")e++,this.advance();else break}if(this.peek()===`
|
|
37
37
|
`||this.peek()==="\r"||this.peek()==="\0")return;e+=Math.floor(i/4);const r=this.indentStack[this.indentStack.length-1];if(e>r)this.indentStack.push(e),this.addToken(g.INDENT,"",e);else if(e<r){for(;this.indentStack.length>1&&this.indentStack[this.indentStack.length-1]>e;)this.indentStack.pop(),this.addToken(g.DEDENT,"",this.indentStack[this.indentStack.length-1]);if(this.indentStack[this.indentStack.length-1]!==e)throw new Error(`Indentation error at ${this.line}:${this.column} - misaligned dedent`)}}readComment(){this.column;let e="";for(this.advance(),this.advance();this.pos<this.source.length&&this.peek()!==`
|
|
38
38
|
`;)e+=this.advance();this.addToken(g.COMMENT,e.trim())}readString(){const e=this.advance(),i=this.column-1;let r="";for(;this.pos<this.source.length&&this.peek()!==e;)if(this.peek()==="\\"){this.advance();const s=this.advance();switch(s){case"n":r+=`
|
|
39
|
-
`;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case e:r+=e;break;default:r+=s}}else r+=this.advance();if(this.peek()!==e)throw new Error(`Unterminated string at ${this.line}:${i}`);this.advance(),this.addToken(g.STRING,r)}readColorLiteral(){const e=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}:${e}`);this.addToken(g.STRING,i)}readNumber(){this.column;let e="",i=!1;for(this.peek()==="."&&this.isDigit(this.peek(1))&&(i=!0,e+=this.advance());this.pos<this.source.length;){const r=this.peek();if(this.isDigit(r))e+=this.advance();else if(r==="."&&!i){const s=this.peek(1);if(this.isDigit(s)||!this.isIdentifierStart(s)){if(i=!0,e+=this.advance(),!this.isDigit(this.peek()))break}else break}else break}if(this.pos<this.source.length){const r=this.peek();if(r==="e"||r==="E"){const s=this.peek(1);if(this.isDigit(s))for(e+=this.advance();this.pos<this.source.length&&this.isDigit(this.peek());)e+=this.advance();else if(s==="+"||s==="-"){const a=this.peek(2);if(this.isDigit(a))for(e+=this.advance(),e+=this.advance();this.pos<this.source.length&&this.isDigit(this.peek());)e+=this.advance()}}}this.addToken(g.NUMBER,parseFloat(e))}readIdentifier(){this.column;let e="";for(;this.pos<this.source.length&&this.isIdentifierChar(this.peek());)e+=this.advance();Fn.has(e)?this.addToken(g.KEYWORD,e):e==="true"||e==="false"?this.addToken(g.BOOLEAN,e==="true"):this.addToken(g.IDENTIFIER,e)}readOperatorOrPunctuation(){const e=this.peek(),i=this.peek(1),r=e+i;if($n.includes(r))return this.advance(),this.advance(),this.addToken(g.OPERATOR,r),!0;if("+-*/%<>=!?".includes(e))return this.advance(),this.addToken(g.OPERATOR,e),!0;switch(e){case"(":return this.parenDepth++,this.advance(),this.addToken(g.LPAREN,e),!0;case")":return this.parenDepth--,this.advance(),this.addToken(g.RPAREN,e),!0;case"[":return this.bracketDepth++,this.advance(),this.addToken(g.LBRACKET,e),!0;case"]":return this.bracketDepth--,this.advance(),this.addToken(g.RBRACKET,e),!0;case"{":return this.braceDepth++,this.advance(),this.addToken(g.LBRACE,e),!0;case"}":return this.braceDepth--,this.advance(),this.addToken(g.RBRACE,e),!0;case",":return this.advance(),this.addToken(g.COMMA,e),!0;case".":return this.isDigit(this.peek(1))?(this.readNumber(),!0):(this.advance(),this.addToken(g.DOT,e),!0);case":":return this.advance(),this.addToken(g.COLON,e),!0;case";":return this.advance(),this.addToken(g.SEMICOLON,e),!0}return!1}peek(e=0){const i=this.pos+e;return i<this.source.length?this.source[i]:"\0"}advance(){const e=this.source[this.pos++];return this.column++,e}skipWhitespaceInline(){if(!this.atLineStart)for(;this.pos<this.source.length&&(this.peek()===" "||this.peek()===" ");)this.advance()}isDigit(e){return e>="0"&&e<="9"}isIdentifierStart(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}isIdentifierChar(e){return this.isIdentifierStart(e)||this.isDigit(e)}getCurrentIndent(){return this.indentStack[this.indentStack.length-1]}addToken(e,i,r=null){const s=new Wn(e,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(s)}}var zn=Object.defineProperty,Hn=(t,e,i)=>e in t?zn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,_e=(t,e,i)=>Hn(t,typeof e!="symbol"?e+"":e,i);class U{constructor(e){this.type=e}}class Gn extends U{constructor(e){super("Program"),this.body=e}}class Se extends U{constructor(e){super("ExpressionStatement"),this.expression=e}}var Je=(t=>(t.VAR="var",t.LET="let",t.CONST="const",t))(Je||{});class He extends U{constructor(e,i="let"){super("VariableDeclaration"),this.declarations=e,this.kind=i}}class Ge extends U{constructor(e,i,r=null){super("VariableDeclarator"),this.id=e,this.init=i,this.varType=r}}class ji extends U{constructor(e,i,r,s=null){super("FunctionDeclaration"),this.id=e,this.params=i,this.body=r,this.returnType=s}}class Yn extends U{constructor(e,i){super("TypeDefinition"),this.name=e,this.fields=i}}class Qn extends U{constructor(e,i,r=null){super("IfStatement"),this.test=e,this.consequent=i,this.alternate=r,_e(this,"_line")}}class Bi extends U{constructor(e,i,r,s){super("ForStatement"),this.init=e,this.test=i,this.update=r,this.body=s,_e(this,"isForIn")}}class Xn extends U{constructor(e,i){super("WhileStatement"),this.test=e,this.body=i}}class Ye extends U{constructor(e){super("BlockStatement"),this.body=e}}class Fi extends U{constructor(e){super("ReturnStatement"),this.argument=e}}class se extends U{constructor(e){super("Identifier"),this.name=e,_e(this,"varType"),_e(this,"returnType"),_e(this,"isMethod")}}class nt extends U{constructor(e,i=null){super("Literal"),this.value=e,this.raw=i}}class We extends U{constructor(e,i,r){super("BinaryExpression"),this.operator=e,this.left=i,this.right=r}}class $i extends U{constructor(e,i,r=!0){super("UnaryExpression"),this.operator=e,this.argument=i,this.prefix=r}}class At extends U{constructor(e,i,r){super("AssignmentExpression"),this.operator=e,this.left=i,this.right=r}}class Wi extends U{constructor(e,i,r=!1){super("UpdateExpression"),this.operator=e,this.argument=i,this.prefix=r}}class Zn extends U{constructor(e,i){super("CallExpression"),this.callee=e,this.args=i,_e(this,"arguments"),this.callee=e,this.arguments=i}}class Ui extends U{constructor(e,i,r=!1){super("MemberExpression"),this.object=e,this.property=i,this.computed=r}}class Qe extends U{constructor(e,i,r){super("ConditionalExpression"),this.test=e,this.consequent=i,this.alternate=r,_e(this,"needsIIFE"),_e(this,"consequentStmts"),_e(this,"alternateStmts")}}class Jn extends U{constructor(e){super("ArrayExpression"),this.elements=e}}class qi extends U{constructor(e){super("ObjectExpression"),this.properties=e}}class Ki extends U{constructor(e,i){super("Property"),this.key=e,this.value=i,_e(this,"kind"),_e(this,"method"),_e(this,"shorthand"),_e(this,"computed"),this.kind="init",this.method=!1,this.shorthand=!1,this.computed=!1}}class zi extends U{constructor(e){super("ArrayPattern"),this.elements=e}}class Hi extends U{constructor(e,i){super("AssignmentPattern"),this.left=e,this.right=i}}class ea extends U{constructor(e,i){super("SwitchExpression"),this.discriminant=e,this.cases=i}}class ta extends U{constructor(e,i,r){super("SwitchCase"),this.test=e,this.consequent=i,this.statements=r,this.statements=r}}var ia=Object.defineProperty,ra=(t,e,i)=>e in t?ia(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Xt=(t,e,i)=>ra(t,typeof e!="symbol"?e+"":e,i);class sa{constructor(e){Xt(this,"tokens"),Xt(this,"pos"),Xt(this,"functionNames",new Set),this.tokens=e,this.pos=0}peek(e=0){return this.tokens[this.pos+e]||this.tokens[this.tokens.length-1]}advance(){return this.tokens[this.pos++]}match(e,i=null){const r=this.peek();return!(r.type!==e||i!==null&&r.value!==i)}expect(e,i=null){const r=this.peek();if(r.type!==e)throw new Error(`Expected ${e} 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()}matchEx(e,i=null,r=!1){if(!r)return this.match(e,i);let s=0,a=this.peek(s);if(a.type===g.NEWLINE&&(s++,a=this.peek(s),a.type===g.INDENT&&(s++,a=this.peek(s))),a.type!==e||i!==null&&a.value!==i)return!1;for(let n=0;n<s;n++)this.advance();return!0}peekOperatorEx(e){let i=0,r=this.peek(i),s=!1;if(r.type===g.NEWLINE&&(i++,r=this.peek(i),r.type===g.INDENT&&(s=!0,i++,r=this.peek(i))),r.type!==g.OPERATOR||!e.includes(r.value)||s&&(r.value==="+"||r.value==="-"))return null;for(let a=0;a<i;a++)this.advance();return r.value}skipNewlines(e=!1){for(;this.match(g.NEWLINE)||this.match(g.COMMENT);)this.advance();e&&this.match(g.INDENT)&&this.advance()}parse(){const e=[];for(;!this.match(g.EOF);){if(this.skipNewlines(),this.match(g.DEDENT)){this.advance();continue}if(this.match(g.EOF))break;const i=this.parseStatement();i&&e.push(i),this.skipNewlines()}return new Gn(e)}parseStatement(e=!0){this.skipNewlines();const i=this.peek().line;if(this.match(g.COMMENT))return this.advance(),null;let r;if(this.match(g.KEYWORD,"enum"))r=this.parseEnumDefinition();else if(this.match(g.KEYWORD,"type"))r=this.parseTypeDefinition();else if(this.match(g.KEYWORD,"var")||this.match(g.KEYWORD,"varip"))r=this.parseVarDeclaration();else if(this.match(g.KEYWORD,"method"))r=this.parseMethodDeclaration();else if(this.isFunctionDeclaration())r=this.parseFunctionDeclaration();else if(this.match(g.KEYWORD,"if"))r=this.parseIfStatement();else if(this.match(g.KEYWORD,"for"))r=this.parseForStatement();else if(this.match(g.KEYWORD,"while"))r=this.parseWhileStatement();else if(this.match(g.KEYWORD,"break")||this.match(g.KEYWORD,"continue")){const s=this.advance().value;r=new Se(new se(s))}else this.isTupleDestructuring()?r=this.parseTupleDestructuring():this.peek().type===g.IDENTIFIER&&this.isTypedVarDeclaration()&&(r=this.parseTypedVarDeclaration());if(!r){const s=this.parseExpression();if(this.match(g.OPERATOR)){const a=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(a)){this.advance(),this.skipNewlines(!0);const n=this.parseExpression();a==="="&&s.type==="Identifier"?r=new He([new Ge(s,n)],Je.LET):r=new Se(new At(a===":="?"=":a,s,n))}else r=new Se(s)}else r=new Se(s)}if(r&&(r._line=i,e&&this.match(g.COMMA)&&this.peek().line===i)){const s=[r];for(;this.match(g.COMMA)&&this.peek().line===i;){this.advance(),this.skipNewlines(!0);const a=this.parseStatement(!1);a&&s.push(a)}return new Ye(s)}return r}isFunctionDeclaration(){const e=this.pos;try{let i=0;if(this.peek(i).type===g.IDENTIFIER&&this.peek(i+1).type===g.IDENTIFIER&&i++,this.peek(i).type!==g.IDENTIFIER||(i++,this.peek(i).type!==g.LPAREN))return!1;i++;let r=1;for(;r>0&&this.peek(i).type!==g.EOF;)this.peek(i).type===g.LPAREN&&r++,this.peek(i).type===g.RPAREN&&r--,i++;for(;this.peek(i).type===g.NEWLINE;)i++;return this.peek(i).type===g.OPERATOR&&this.peek(i).value==="=>"}finally{this.pos=e}}parseTypeExpression(){let e=this.expect(g.IDENTIFIER).value;for(;this.match(g.DOT)&&this.peek(1).type===g.IDENTIFIER;)this.advance(),e+="."+this.advance().value;if(this.match(g.OPERATOR,"<")){this.advance();const i=[];for(i.push(this.parseTypeExpression());this.match(g.COMMA);)this.advance(),this.skipNewlines(),i.push(this.parseTypeExpression());return this.expect(g.OPERATOR,">"),e+"<"+i.join(", ")+">"}return e}parseEnumDefinition(){this.expect(g.KEYWORD,"enum");const e=this.expect(g.IDENTIFIER).value;this.skipNewlines(),this.expect(g.INDENT);const i=[];for(;!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){if(this.match(g.COMMENT)){this.advance();continue}const a=this.expect(g.IDENTIFIER).value;i.push(a),this.skipNewlines()}this.match(g.DEDENT)&&this.advance();const r=i.map(a=>new Ki(new se(a),new nt(`${e}.${a}`))),s=new qi(r);return new He([new Ge(new se(e),s)],Je.CONST)}parseTypeDefinition(){this.expect(g.KEYWORD,"type");const e=this.expect(g.IDENTIFIER).value;this.match(g.OPERATOR,"=>")&&this.advance(),this.skipNewlines(),this.expect(g.INDENT);const i=[];for(;!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){const r=this.parseTypeExpression(),s=this.expect(g.IDENTIFIER).value;let a=null;this.match(g.OPERATOR,"=")&&(this.advance(),this.skipNewlines(),a=this.parseExpression()),i.push({type:r,name:s,defaultValue:a}),this.skipNewlines()}return this.match(g.DEDENT)&&this.advance(),new Yn(e,i)}parseVarDeclaration(){const e=this.advance().value;let i=null,r=null;if(this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.LBRACKET&&this.peek(2).type===g.RBRACKET)i=this.advance().value,this.advance(),i+="[]",this.advance(),r=this.expect(g.IDENTIFIER).value;else if(this.peek().type===g.IDENTIFIER&&(this.peek(1).type===g.DOT||this.peek(1).type===g.IDENTIFIER||this.peek(1).type===g.OPERATOR&&this.peek(1).value==="<")){for(i=this.advance().value;this.match(g.DOT)&&this.peek(1).type===g.IDENTIFIER;)this.advance(),i+="."+this.advance().value;if(this.match(g.LBRACKET)&&this.peek(1).type===g.RBRACKET)this.advance(),this.advance(),i+="[]",r=this.expect(g.IDENTIFIER).value;else if(this.match(g.OPERATOR,"<")){for(this.advance(),i+="<";!this.match(g.OPERATOR,">");)if(this.match(g.IDENTIFIER))for(i+=this.advance().value;this.match(g.DOT)&&this.peek(1).type===g.IDENTIFIER;)i+=".",this.advance(),i+=this.advance().value;else if(this.match(g.COMMA))i+=this.advance().value,this.skipNewlines();else break;this.match(g.OPERATOR,">")&&(i+=">",this.advance()),r=this.expect(g.IDENTIFIER).value}else r=this.expect(g.IDENTIFIER).value}else if(this.peek().type===g.IDENTIFIER)r=this.advance().value;else throw new Error(`Expected identifier after ${e} at ${this.peek().line}:${this.peek().column}`);this.functionNames.has(r)&&(r=r+"_var"),this.expect(g.OPERATOR,"="),this.skipNewlines(!0);const s=this.parseExpression(),a=new se(r);return i&&(a.varType=i),new He([new Ge(a,s,i)],e)}isTypedVarDeclaration(){let e=0;if(this.peek(e).type!==g.IDENTIFIER)return!1;for(e++;this.peek(e).type===g.DOT&&this.peek(e+1).type===g.IDENTIFIER;)e+=2;if(this.peek(e).type===g.LBRACKET&&this.peek(e+1).type===g.RBRACKET)return e+=2,this.peek(e).type!==g.IDENTIFIER?!1:(e++,this.peek(e).type===g.OPERATOR&&this.peek(e).value==="=");if(this.peek(e).type===g.OPERATOR&&this.peek(e).value==="<"){e++;let i=1;for(;i>0&&this.peek(e).type!==g.EOF;)this.peek(e).type===g.OPERATOR&&this.peek(e).value==="<"?i++:this.peek(e).type===g.OPERATOR&&this.peek(e).value===">"&&i--,e++;return this.peek(e).type!==g.IDENTIFIER?!1:(e++,this.peek(e).type===g.OPERATOR&&this.peek(e).value==="=")}if(this.peek(e).type!==g.IDENTIFIER)return!1;for(e++;this.peek(e).type===g.IDENTIFIER;)e++;return this.peek(e).type===g.OPERATOR&&this.peek(e).value==="="}parseTypedVarDeclaration(){let e=this.advance().value;for(;this.match(g.DOT)&&this.peek(1).type===g.IDENTIFIER;)this.advance(),e+="."+this.advance().value;if(this.match(g.LBRACKET)&&this.peek(1).type===g.RBRACKET)this.advance(),this.advance(),e+="[]";else if(this.match(g.OPERATOR,"<")){for(this.advance(),e+="<";!this.match(g.OPERATOR,">");)if(this.match(g.IDENTIFIER))for(e+=this.advance().value;this.match(g.DOT)&&this.peek(1).type===g.IDENTIFIER;)e+=".",this.advance(),e+=this.advance().value;else if(this.match(g.COMMA))e+=this.advance().value,this.skipNewlines();else break;this.match(g.OPERATOR,">")&&(e+=">",this.advance())}else for(;this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.IDENTIFIER;)e+=" "+this.advance().value;let i=this.expect(g.IDENTIFIER).value;this.functionNames.has(i)&&(i=i+"_var"),this.expect(g.OPERATOR,"="),this.skipNewlines(!0);const r=this.parseExpression(),s=new se(i);return s.varType=e,new He([new Ge(s,r,e)],Je.LET)}parseFunctionDeclaration(){let e=null;this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.IDENTIFIER&&(e=this.advance().value);const i=this.expect(g.IDENTIFIER).value;this.functionNames.add(i),this.expect(g.LPAREN);const r=[];for(;!this.match(g.RPAREN)&&(this.skipNewlines(),!this.match(g.RPAREN));){let n=null;for(;this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.IDENTIFIER&&this.peek(2).type!==g.LPAREN;)n&&(n+=" "),n=(n||"")+this.advance().value;const o=this.expect(g.IDENTIFIER).value,l=new se(o);if(n&&(l.varType=n),this.match(g.OPERATOR,"=")){this.advance(),this.skipNewlines();const c=this.parseExpression();r.push(new Hi(l,c))}else r.push(l);this.match(g.COMMA)&&this.advance()}this.expect(g.RPAREN),this.skipNewlines(),this.expect(g.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),a=new se(i);return e&&(a.returnType=e),new ji(a,r,s,e)}parseMethodDeclaration(){this.expect(g.KEYWORD,"method");let e=null;this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.IDENTIFIER&&this.peek(2).type===g.LPAREN&&(e=this.advance().value);const i=this.expect(g.IDENTIFIER).value;this.expect(g.LPAREN);const r=[];for(;!this.match(g.RPAREN)&&(this.skipNewlines(),!this.match(g.RPAREN));){let n=null;for(;this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.IDENTIFIER&&this.peek(2).type!==g.LPAREN;)n&&(n+=" "),n=(n||"")+this.advance().value;const o=this.expect(g.IDENTIFIER).value,l=new se(o);if(n&&(l.varType=n),this.match(g.OPERATOR,"=")){this.advance(),this.skipNewlines();const c=this.parseExpression();r.push(new Hi(l,c))}else r.push(l);this.match(g.COMMA)&&this.advance()}this.expect(g.RPAREN),this.skipNewlines(),this.expect(g.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),a=new se(i);return e&&(a.returnType=e),a.isMethod=!0,new ji(a,r,s,e)}parseFunctionBody(){const e=[];if(!this.match(g.INDENT)){const i=this.parseExpression();return new Ye([new Fi(i)])}for(this.advance();!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){const i=this.parseStatementOrSequence();Array.isArray(i)?e.push(...i):i&&e.push(i)}return this.match(g.DEDENT)&&this.advance(),e.length>0&&this._addImplicitReturn(e),new Ye(e)}_addImplicitReturn(e){const i=e[e.length-1];i.type==="ExpressionStatement"?e[e.length-1]=new Fi(i.expression):i.type==="IfStatement"&&this._addImplicitReturnToIf(i)}_addImplicitReturnToIf(e){e.consequent&&e.consequent.type==="BlockStatement"&&e.consequent.body.length>0&&this._addImplicitReturn(e.consequent.body),e.alternate&&(e.alternate.type==="IfStatement"?this._addImplicitReturnToIf(e.alternate):e.alternate.type==="BlockStatement"&&e.alternate.body.length>0&&this._addImplicitReturn(e.alternate.body))}parseStatementOrSequence(){this.pos;const e=this.peek().line;if(this.match(g.KEYWORD,"if")){const r=this.parseIfStatement();return r&&(r._line=e),r}if(this.match(g.KEYWORD,"for"))return this.parseForStatement();if(this.match(g.KEYWORD,"while"))return this.parseWhileStatement();if(this.match(g.KEYWORD,"break")||this.match(g.KEYWORD,"continue")){const r=this.advance().value;return new Se(new se(r))}if(this.match(g.KEYWORD,"var")||this.match(g.KEYWORD,"varip"))return this.parseVarDeclaration();if(this.isTupleDestructuring())return this.parseTupleDestructuring();if(this.peek().type===g.IDENTIFIER&&this.isTypedVarDeclaration())return this.parseTypedVarDeclaration();const i=[];for(;;){const r=this.parseExpression();if(this.match(g.OPERATOR)){const s=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(s)){this.advance(),this.skipNewlines(!0);const a=this.parseExpression();if(s==="="&&r.type==="Identifier"?i.push(new He([new Ge(r,a)],Je.LET)):i.push(new Se(new At(s===":="?"=":s,r,a))),this.match(g.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new Se(r));else return new Se(r);break}}else if(this.match(g.COMMA)){i.push(new Se(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new Se(r));else return new Se(r);break}}return i.length>1?i:i.length===1?i[0]:null}parseIfStatement(){this.expect(g.KEYWORD,"if");const e=this.parseExpression();this.skipNewlines();const i=this.parseBlock();let r=null;return this.skipNewlines(),this.match(g.KEYWORD,"else")&&(this.advance(),this.skipNewlines(),this.match(g.KEYWORD,"if")?r=this.parseIfStatement():r=this.parseBlock()),new Qn(e,i,r)}parseForStatement(){this.expect(g.KEYWORD,"for");let e=null,i=!1;if(this.match(g.LBRACKET)){this.advance();const r=[];for(;!this.match(g.RBRACKET);)this.skipNewlines(),r.push(new se(this.expect(g.IDENTIFIER).value)),this.match(g.COMMA)&&this.advance();this.expect(g.RBRACKET),e=new zi(r),i=!0}else{const r=this.expect(g.IDENTIFIER).value;e=new se(r)}if(this.match(g.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const s=this.parseBlock(),a=new He([new Ge(e,r)],Je.CONST),n=new Bi(a,null,null,s);return n.isForIn=!0,n}else{if(i)throw new Error(`Range-based for loops don't support destructuring at ${this.peek().line}:${this.peek().column}`);this.expect(g.OPERATOR,"=");const r=this.parseExpression();this.expect(g.KEYWORD,"to");const s=this.parseExpression();let a=null;this.match(g.KEYWORD,"by")&&(this.advance(),a=this.parseExpression()),this.skipNewlines();const n=this.parseBlock(),o=new He([new Ge(e,r)],Je.LET),l=new We("<=",r,s),c=new Qe(l,new We("<=",e,s),new We(">=",e,s));let h;return a?h=new Qe(l,new At("+=",e,a),new At("-=",e,a)):h=new Qe(l,new Wi("++",e),new Wi("--",e)),new Bi(o,c,h,n)}}parseWhileStatement(){this.expect(g.KEYWORD,"while");const e=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new Xn(e,i)}parseBlock(){if(!this.match(g.INDENT)){const r=this.parseStatement();return new Ye(r?[r]:[])}const e=this.peek().indent;this.advance();const i=[];for(;!this.match(g.EOF);){if(this.skipNewlines(),this.match(g.DEDENT)){if(this.peek().indent<e)break;this.advance();continue}if(this.match(g.EOF))break;const r=this.parseStatement();r&&i.push(r)}return this.match(g.DEDENT)&&this.peek().indent<e&&this.advance(),new Ye(i)}isTupleDestructuring(){if(!this.match(g.LBRACKET))return!1;let e=1;for(;;){for(;this.peek(e).type===g.NEWLINE;)e++;if(this.peek(e).type!==g.IDENTIFIER)return!1;for(e++;this.peek(e).type===g.NEWLINE;)e++;if(this.peek(e).type===g.RBRACKET){e++;break}else if(this.peek(e).type===g.COMMA){e++;continue}else return!1}for(;this.peek(e).type===g.NEWLINE;)e++;return this.peek(e).type===g.OPERATOR&&this.peek(e).value==="="}parseTupleDestructuring(){this.expect(g.LBRACKET);const e=[];for(;!this.match(g.RBRACKET);){this.skipNewlines();let r=this.expect(g.IDENTIFIER).value;this.functionNames.has(r)&&(r=r+"_var"),e.push(new se(r)),this.match(g.COMMA)&&this.advance()}this.expect(g.RBRACKET),this.skipNewlines(),this.expect(g.OPERATOR,"="),this.skipNewlines(!0);const i=this.parseExpression();return new He([new Ge(new zi(e),i)],Je.CONST)}parseExpression(){return this.parseTernary()}parseTernary(){let e=this.parseLogicalOr();if(this.matchEx(g.OPERATOR,"?",!0)){this.advance(),this.skipNewlines(!0);const i=this.parseExpression();this.matchEx(g.COLON,null,!0)?this.advance():this.expect(g.COLON),this.skipNewlines(!0);const r=this.parseExpression();return new Qe(e,i,r)}return e}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.matchEx(g.KEYWORD,"or",!0)||this.peekOperatorEx(["||"]);){this.advance(),this.skipNewlines(!0);const i=this.parseLogicalAnd();e=new We("||",e,i)}return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.matchEx(g.KEYWORD,"and",!0)||this.peekOperatorEx(["&&"]);){this.advance(),this.skipNewlines();const i=this.parseEquality();e=new We("&&",e,i)}return e}parseEquality(){let e=this.parseComparison();for(;this.peekOperatorEx(["==","!="]);){const i=this.advance().value;this.skipNewlines(!0);const r=this.parseComparison();e=new We(i,e,r)}return e}parseComparison(){let e=this.parseAdditive();for(;this.peekOperatorEx(["<",">","<=",">="]);){const i=this.advance().value;this.skipNewlines();const r=this.parseAdditive();e=new We(i,e,r)}return e}parseAdditive(){let e=this.parseMultiplicative();for(;this.peekOperatorEx(["+","-"]);){const i=this.advance().value;this.skipNewlines(!0);const r=this.parseMultiplicative();e=new We(i,e,r)}return e}parseMultiplicative(){let e=this.parseUnary();for(;this.peekOperatorEx(["*","/","%"]);){const i=this.advance().value;this.skipNewlines(!0);const r=this.parseUnary();e=new We(i,e,r)}return e}parseUnary(){if(this.match(g.OPERATOR)){const e=this.peek().value;if(["+","-","!"].includes(e))return this.advance(),this.skipNewlines(),new $i(e,this.parseUnary())}return this.match(g.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new $i("!",this.parseUnary())):this.parsePostfix()}parsePostfix(){let e=this.parsePrimary();for(;;)if(this.match(g.OPERATOR,"<")){const i=this.pos;this.advance();let r=1,s=!0;for(;r>0&&!this.match(g.EOF);)if(this.match(g.OPERATOR,"<"))r++,this.advance();else if(this.match(g.OPERATOR,">"))r--,this.advance();else if(this.match(g.IDENTIFIER)||this.match(g.COMMA)||this.match(g.DOT))this.advance();else{s=!1,this.pos=i;break}if(s&&this.match(g.LPAREN)){e=this.parseCallExpression(e);continue}else{if(s)continue;break}}else if(this.match(g.LPAREN))e=this.parseCallExpression(e);else if(this.match(g.DOT)){this.advance(),this.skipNewlines();const i=this.expect(g.IDENTIFIER).value;e=new Ui(e,new se(i),!1)}else if(this.match(g.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(g.RBRACKET),e=new Ui(e,i,!0)}else break;return e}parseCallExpression(e){this.expect(g.LPAREN);const i=[],r=[];for(;!this.match(g.RPAREN)&&(this.skipNewlines(),!this.match(g.RPAREN));){if((this.peek().type===g.IDENTIFIER||this.peek().type===g.KEYWORD)&&this.peek(1).type===g.OPERATOR&&this.peek(1).value==="="){const s=this.advance().value;this.advance(),this.skipNewlines();const a=this.parseExpression();r.push(new Ki(new se(s),a))}else i.push(this.parseExpression());this.match(g.COMMA)&&this.advance(),this.skipNewlines()}return this.expect(g.RPAREN),r.length>0&&i.push(new qi(r)),new Zn(e,i)}parsePrimary(){const e=this.peek();if(this.match(g.NUMBER)){const i=this.advance();return new nt(i.value)}if(this.match(g.STRING)){const i=this.advance();return new nt(i.value)}if(this.match(g.BOOLEAN)){const i=this.advance();return new nt(i.value)}if(this.match(g.IDENTIFIER)){let i=this.advance().value;return this.functionNames.has(i)&&this.peek().type!==g.LPAREN&&(i=i+"_var"),new se(i)}if(this.match(g.LBRACKET))return this.parseArrayLiteral();if(this.match(g.LPAREN)){this.advance(),this.skipNewlines();const i=this.parseExpression();return this.skipNewlines(),this.expect(g.RPAREN),i}if(this.match(g.KEYWORD,"if"))return this.parseIfExpression();if(this.match(g.KEYWORD,"switch"))return this.parseSwitchExpression();if(this.match(g.KEYWORD,"for"))return this.parseForExpression();if(this.match(g.KEYWORD,"while"))return this.parseWhileExpression();throw new Error(`Unexpected token ${e.type} '${e.value}' at ${e.line}:${e.column}`)}parseArrayLiteral(){this.expect(g.LBRACKET);const e=[];for(;!this.match(g.RBRACKET)&&(this.skipNewlines(),!this.match(g.RBRACKET));)e.push(this.parseExpression()),this.match(g.COMMA)&&this.advance(),this.skipNewlines();return this.expect(g.RBRACKET),new Jn(e)}parseIfExpression(){this.expect(g.KEYWORD,"if");const e=this.parseExpression();this.skipNewlines(),this.expect(g.INDENT);const i=[];for(;!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){const n=this.parseStatement();n&&i.push(n)}this.advance();let r=[];if(this.match(g.KEYWORD,"else"))if(this.advance(),this.skipNewlines(),this.match(g.KEYWORD,"if")){const n=this.parseIfExpression();if(this.needsIIFE(i,r)){const o=new Qe(e,new Ye(i),n);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=n,o}else return new Qe(e,this.getBlockValue(i),n)}else{for(this.expect(g.INDENT);!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){const n=this.parseStatement();n&&r.push(n)}this.advance()}if(this.needsIIFE(i,r)){const n=new Qe(e,new Ye(i),new Ye(r));return n.needsIIFE=!0,n.consequentStmts=i,n.alternateStmts=r,n}const s=this.getBlockValue(i),a=r.length>0?this.getBlockValue(r):new nt(null);return new Qe(e,s,a)}needsIIFE(e,i){if(e.length>1||i.length>1)return!0;const r=s=>s.some(a=>a.type==="IfStatement"||a.type==="ForStatement"||a.type==="WhileStatement"||a.type==="BlockStatement");return r(e)||r(i)}parseSwitchExpression(){this.expect(g.KEYWORD,"switch");let e=null;!this.match(g.NEWLINE)&&!this.match(g.INDENT)&&(e=this.parseExpression()),this.skipNewlines(),this.expect(g.INDENT);const i=[];for(;!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){let r=null;this.match(g.OPERATOR,"=>")||(r=this.parseExpression()),this.expect(g.OPERATOR,"=>"),this.skipNewlines();const s=[];if(this.match(g.INDENT)){for(this.advance();!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){const n=this.parseStatement();n&&s.push(n)}this.advance()}else s.push(new Se(this.parseExpression()));const a=this.getBlockValue(s);i.push(new ta(r,a,s)),this.skipNewlines()}return this.advance(),new ea(e,i)}parseForExpression(){const e=this.parseForStatement();return e.isExpression=!0,e}parseWhileExpression(){const e=this.parseWhileStatement();return e.isExpression=!0,e}getBlockValue(e){if(e.length===0)return new nt(null);const i=e[e.length-1];return i.type==="ExpressionStatement"?i.expression:i.type==="VariableDeclaration"&&i.declarations.length>0?i.declarations[0].id:new nt(null)}}var na=Object.defineProperty,aa=(t,e,i)=>e in t?na(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,at=(t,e,i)=>aa(t,typeof e!="symbol"?e+"":e,i);class oa{constructor(e={}){at(this,"indent"),at(this,"indentStr"),at(this,"output"),at(this,"sourceCode"),at(this,"sourceLines"),at(this,"lastCommentedLine"),at(this,"includeSourceComments"),this.indent=0,this.indentStr=e.indentStr||" ",this.output=[],this.sourceCode=e.sourceCode||null,this.sourceLines=this.sourceCode?this.sourceCode.split(`
|
|
39
|
+
`;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case e:r+=e;break;default:r+=s}}else r+=this.advance();if(this.peek()!==e)throw new Error(`Unterminated string at ${this.line}:${i}`);this.advance(),this.addToken(g.STRING,r)}readColorLiteral(){const e=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}:${e}`);this.addToken(g.STRING,i)}readNumber(){this.column;let e="",i=!1;for(this.peek()==="."&&this.isDigit(this.peek(1))&&(i=!0,e+=this.advance());this.pos<this.source.length;){const r=this.peek();if(this.isDigit(r))e+=this.advance();else if(r==="."&&!i){const s=this.peek(1);if(this.isDigit(s)||!this.isIdentifierStart(s)){if(i=!0,e+=this.advance(),!this.isDigit(this.peek()))break}else break}else break}if(this.pos<this.source.length){const r=this.peek();if(r==="e"||r==="E"){const s=this.peek(1);if(this.isDigit(s))for(e+=this.advance();this.pos<this.source.length&&this.isDigit(this.peek());)e+=this.advance();else if(s==="+"||s==="-"){const a=this.peek(2);if(this.isDigit(a))for(e+=this.advance(),e+=this.advance();this.pos<this.source.length&&this.isDigit(this.peek());)e+=this.advance()}}}this.addToken(g.NUMBER,parseFloat(e))}readIdentifier(){this.column;let e="";for(;this.pos<this.source.length&&this.isIdentifierChar(this.peek());)e+=this.advance();$n.has(e)?this.addToken(g.KEYWORD,e):e==="true"||e==="false"?this.addToken(g.BOOLEAN,e==="true"):this.addToken(g.IDENTIFIER,e)}readOperatorOrPunctuation(){const e=this.peek(),i=this.peek(1),r=e+i;if(Wn.includes(r))return this.advance(),this.advance(),this.addToken(g.OPERATOR,r),!0;if("+-*/%<>=!?".includes(e))return this.advance(),this.addToken(g.OPERATOR,e),!0;switch(e){case"(":return this.parenDepth++,this.advance(),this.addToken(g.LPAREN,e),!0;case")":return this.parenDepth--,this.advance(),this.addToken(g.RPAREN,e),!0;case"[":return this.bracketDepth++,this.advance(),this.addToken(g.LBRACKET,e),!0;case"]":return this.bracketDepth--,this.advance(),this.addToken(g.RBRACKET,e),!0;case"{":return this.braceDepth++,this.advance(),this.addToken(g.LBRACE,e),!0;case"}":return this.braceDepth--,this.advance(),this.addToken(g.RBRACE,e),!0;case",":return this.advance(),this.addToken(g.COMMA,e),!0;case".":return this.isDigit(this.peek(1))?(this.readNumber(),!0):(this.advance(),this.addToken(g.DOT,e),!0);case":":return this.advance(),this.addToken(g.COLON,e),!0;case";":return this.advance(),this.addToken(g.SEMICOLON,e),!0}return!1}peek(e=0){const i=this.pos+e;return i<this.source.length?this.source[i]:"\0"}advance(){const e=this.source[this.pos++];return this.column++,e}skipWhitespaceInline(){if(!this.atLineStart)for(;this.pos<this.source.length&&(this.peek()===" "||this.peek()===" ");)this.advance()}isDigit(e){return e>="0"&&e<="9"}isIdentifierStart(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}isIdentifierChar(e){return this.isIdentifierStart(e)||this.isDigit(e)}getCurrentIndent(){return this.indentStack[this.indentStack.length-1]}addToken(e,i,r=null){const s=new Un(e,i,this.line,this.column,r!==null?r:this.getCurrentIndent());this.tokens.push(s)}}var Hn=Object.defineProperty,Gn=(t,e,i)=>e in t?Hn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,_e=(t,e,i)=>Gn(t,typeof e!="symbol"?e+"":e,i);class U{constructor(e){this.type=e}}class Yn extends U{constructor(e){super("Program"),this.body=e}}class Se extends U{constructor(e){super("ExpressionStatement"),this.expression=e}}var Je=(t=>(t.VAR="var",t.LET="let",t.CONST="const",t))(Je||{});class He extends U{constructor(e,i="let"){super("VariableDeclaration"),this.declarations=e,this.kind=i}}class Ge extends U{constructor(e,i,r=null){super("VariableDeclarator"),this.id=e,this.init=i,this.varType=r}}class Fi extends U{constructor(e,i,r,s=null){super("FunctionDeclaration"),this.id=e,this.params=i,this.body=r,this.returnType=s}}class Qn extends U{constructor(e,i){super("TypeDefinition"),this.name=e,this.fields=i}}class Xn extends U{constructor(e,i,r=null){super("IfStatement"),this.test=e,this.consequent=i,this.alternate=r,_e(this,"_line")}}class $i extends U{constructor(e,i,r,s){super("ForStatement"),this.init=e,this.test=i,this.update=r,this.body=s,_e(this,"isForIn")}}class Zn extends U{constructor(e,i){super("WhileStatement"),this.test=e,this.body=i}}class Ye extends U{constructor(e){super("BlockStatement"),this.body=e}}class Wi extends U{constructor(e){super("ReturnStatement"),this.argument=e}}class se extends U{constructor(e){super("Identifier"),this.name=e,_e(this,"varType"),_e(this,"returnType"),_e(this,"isMethod")}}class nt extends U{constructor(e,i=null){super("Literal"),this.value=e,this.raw=i}}class We extends U{constructor(e,i,r){super("BinaryExpression"),this.operator=e,this.left=i,this.right=r}}class Ui extends U{constructor(e,i,r=!0){super("UnaryExpression"),this.operator=e,this.argument=i,this.prefix=r}}class At extends U{constructor(e,i,r){super("AssignmentExpression"),this.operator=e,this.left=i,this.right=r}}class qi extends U{constructor(e,i,r=!1){super("UpdateExpression"),this.operator=e,this.argument=i,this.prefix=r}}class Jn extends U{constructor(e,i){super("CallExpression"),this.callee=e,this.args=i,_e(this,"arguments"),this.callee=e,this.arguments=i}}class Ki extends U{constructor(e,i,r=!1){super("MemberExpression"),this.object=e,this.property=i,this.computed=r}}class Qe extends U{constructor(e,i,r){super("ConditionalExpression"),this.test=e,this.consequent=i,this.alternate=r,_e(this,"needsIIFE"),_e(this,"consequentStmts"),_e(this,"alternateStmts")}}class ea extends U{constructor(e){super("ArrayExpression"),this.elements=e}}class zi extends U{constructor(e){super("ObjectExpression"),this.properties=e}}class Hi extends U{constructor(e,i){super("Property"),this.key=e,this.value=i,_e(this,"kind"),_e(this,"method"),_e(this,"shorthand"),_e(this,"computed"),this.kind="init",this.method=!1,this.shorthand=!1,this.computed=!1}}class Gi extends U{constructor(e){super("ArrayPattern"),this.elements=e}}class Yi extends U{constructor(e,i){super("AssignmentPattern"),this.left=e,this.right=i}}class ta extends U{constructor(e,i){super("SwitchExpression"),this.discriminant=e,this.cases=i}}class ia extends U{constructor(e,i,r){super("SwitchCase"),this.test=e,this.consequent=i,this.statements=r,this.statements=r}}var ra=Object.defineProperty,sa=(t,e,i)=>e in t?ra(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Jt=(t,e,i)=>sa(t,typeof e!="symbol"?e+"":e,i);class na{constructor(e){Jt(this,"tokens"),Jt(this,"pos"),Jt(this,"functionNames",new Set),this.tokens=e,this.pos=0}peek(e=0){return this.tokens[this.pos+e]||this.tokens[this.tokens.length-1]}advance(){return this.tokens[this.pos++]}match(e,i=null){const r=this.peek();return!(r.type!==e||i!==null&&r.value!==i)}expect(e,i=null){const r=this.peek();if(r.type!==e)throw new Error(`Expected ${e} 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()}matchEx(e,i=null,r=!1){if(!r)return this.match(e,i);let s=0,a=this.peek(s);if(a.type===g.NEWLINE&&(s++,a=this.peek(s),a.type===g.INDENT&&(s++,a=this.peek(s))),a.type!==e||i!==null&&a.value!==i)return!1;for(let n=0;n<s;n++)this.advance();return!0}peekOperatorEx(e){let i=0,r=this.peek(i),s=!1;if(r.type===g.NEWLINE&&(i++,r=this.peek(i),r.type===g.INDENT&&(s=!0,i++,r=this.peek(i))),r.type!==g.OPERATOR||!e.includes(r.value)||s&&(r.value==="+"||r.value==="-"))return null;for(let a=0;a<i;a++)this.advance();return r.value}skipNewlines(e=!1){for(;this.match(g.NEWLINE)||this.match(g.COMMENT);)this.advance();e&&this.match(g.INDENT)&&this.advance()}parse(){const e=[];for(;!this.match(g.EOF);){if(this.skipNewlines(),this.match(g.DEDENT)){this.advance();continue}if(this.match(g.EOF))break;const i=this.parseStatement();i&&e.push(i),this.skipNewlines()}return new Yn(e)}parseStatement(e=!0){this.skipNewlines();const i=this.peek().line;if(this.match(g.COMMENT))return this.advance(),null;let r;if(this.match(g.KEYWORD,"enum"))r=this.parseEnumDefinition();else if(this.match(g.KEYWORD,"type"))r=this.parseTypeDefinition();else if(this.match(g.KEYWORD,"var")||this.match(g.KEYWORD,"varip"))r=this.parseVarDeclaration();else if(this.match(g.KEYWORD,"method"))r=this.parseMethodDeclaration();else if(this.isFunctionDeclaration())r=this.parseFunctionDeclaration();else if(this.match(g.KEYWORD,"if"))r=this.parseIfStatement();else if(this.match(g.KEYWORD,"for"))r=this.parseForStatement();else if(this.match(g.KEYWORD,"while"))r=this.parseWhileStatement();else if(this.match(g.KEYWORD,"break")||this.match(g.KEYWORD,"continue")){const s=this.advance().value;r=new Se(new se(s))}else this.isTupleDestructuring()?r=this.parseTupleDestructuring():this.peek().type===g.IDENTIFIER&&this.isTypedVarDeclaration()&&(r=this.parseTypedVarDeclaration());if(!r){const s=this.parseExpression();if(this.match(g.OPERATOR)){const a=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(a)){this.advance(),this.skipNewlines(!0);const n=this.parseExpression();a==="="&&s.type==="Identifier"?r=new He([new Ge(s,n)],Je.LET):r=new Se(new At(a===":="?"=":a,s,n))}else r=new Se(s)}else r=new Se(s)}if(r&&(r._line=i,e&&this.match(g.COMMA)&&this.peek().line===i)){const s=[r];for(;this.match(g.COMMA)&&this.peek().line===i;){this.advance(),this.skipNewlines(!0);const a=this.parseStatement(!1);a&&s.push(a)}return new Ye(s)}return r}isFunctionDeclaration(){const e=this.pos;try{let i=0;if(this.peek(i).type===g.IDENTIFIER&&this.peek(i+1).type===g.IDENTIFIER&&i++,this.peek(i).type!==g.IDENTIFIER||(i++,this.peek(i).type!==g.LPAREN))return!1;i++;let r=1;for(;r>0&&this.peek(i).type!==g.EOF;)this.peek(i).type===g.LPAREN&&r++,this.peek(i).type===g.RPAREN&&r--,i++;for(;this.peek(i).type===g.NEWLINE;)i++;return this.peek(i).type===g.OPERATOR&&this.peek(i).value==="=>"}finally{this.pos=e}}parseTypeExpression(){let e=this.expect(g.IDENTIFIER).value;for(;this.match(g.DOT)&&this.peek(1).type===g.IDENTIFIER;)this.advance(),e+="."+this.advance().value;if(this.match(g.OPERATOR,"<")){this.advance();const i=[];for(i.push(this.parseTypeExpression());this.match(g.COMMA);)this.advance(),this.skipNewlines(),i.push(this.parseTypeExpression());return this.expect(g.OPERATOR,">"),e+"<"+i.join(", ")+">"}return e}parseEnumDefinition(){this.expect(g.KEYWORD,"enum");const e=this.expect(g.IDENTIFIER).value;this.skipNewlines(),this.expect(g.INDENT);const i=[];for(;!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){if(this.match(g.COMMENT)){this.advance();continue}const a=this.expect(g.IDENTIFIER).value;i.push(a),this.skipNewlines()}this.match(g.DEDENT)&&this.advance();const r=i.map(a=>new Hi(new se(a),new nt(`${e}.${a}`))),s=new zi(r);return new He([new Ge(new se(e),s)],Je.CONST)}parseTypeDefinition(){this.expect(g.KEYWORD,"type");const e=this.expect(g.IDENTIFIER).value;this.match(g.OPERATOR,"=>")&&this.advance(),this.skipNewlines(),this.expect(g.INDENT);const i=[];for(;!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){const r=this.parseTypeExpression(),s=this.expect(g.IDENTIFIER).value;let a=null;this.match(g.OPERATOR,"=")&&(this.advance(),this.skipNewlines(),a=this.parseExpression()),i.push({type:r,name:s,defaultValue:a}),this.skipNewlines()}return this.match(g.DEDENT)&&this.advance(),new Qn(e,i)}parseVarDeclaration(){const e=this.advance().value;let i=null,r=null;if(this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.LBRACKET&&this.peek(2).type===g.RBRACKET)i=this.advance().value,this.advance(),i+="[]",this.advance(),r=this.expect(g.IDENTIFIER).value;else if(this.peek().type===g.IDENTIFIER&&(this.peek(1).type===g.DOT||this.peek(1).type===g.IDENTIFIER||this.peek(1).type===g.OPERATOR&&this.peek(1).value==="<")){for(i=this.advance().value;this.match(g.DOT)&&this.peek(1).type===g.IDENTIFIER;)this.advance(),i+="."+this.advance().value;if(this.match(g.LBRACKET)&&this.peek(1).type===g.RBRACKET)this.advance(),this.advance(),i+="[]",r=this.expect(g.IDENTIFIER).value;else if(this.match(g.OPERATOR,"<")){for(this.advance(),i+="<";!this.match(g.OPERATOR,">");)if(this.match(g.IDENTIFIER))for(i+=this.advance().value;this.match(g.DOT)&&this.peek(1).type===g.IDENTIFIER;)i+=".",this.advance(),i+=this.advance().value;else if(this.match(g.COMMA))i+=this.advance().value,this.skipNewlines();else break;this.match(g.OPERATOR,">")&&(i+=">",this.advance()),r=this.expect(g.IDENTIFIER).value}else r=this.expect(g.IDENTIFIER).value}else if(this.peek().type===g.IDENTIFIER)r=this.advance().value;else throw new Error(`Expected identifier after ${e} at ${this.peek().line}:${this.peek().column}`);this.functionNames.has(r)&&(r=r+"_var"),this.expect(g.OPERATOR,"="),this.skipNewlines(!0);const s=this.parseExpression(),a=new se(r);return i&&(a.varType=i),new He([new Ge(a,s,i)],e)}isTypedVarDeclaration(){let e=0;if(this.peek(e).type!==g.IDENTIFIER)return!1;for(e++;this.peek(e).type===g.DOT&&this.peek(e+1).type===g.IDENTIFIER;)e+=2;if(this.peek(e).type===g.LBRACKET&&this.peek(e+1).type===g.RBRACKET)return e+=2,this.peek(e).type!==g.IDENTIFIER?!1:(e++,this.peek(e).type===g.OPERATOR&&this.peek(e).value==="=");if(this.peek(e).type===g.OPERATOR&&this.peek(e).value==="<"){e++;let i=1;for(;i>0&&this.peek(e).type!==g.EOF;)this.peek(e).type===g.OPERATOR&&this.peek(e).value==="<"?i++:this.peek(e).type===g.OPERATOR&&this.peek(e).value===">"&&i--,e++;return this.peek(e).type!==g.IDENTIFIER?!1:(e++,this.peek(e).type===g.OPERATOR&&this.peek(e).value==="=")}if(this.peek(e).type!==g.IDENTIFIER)return!1;for(e++;this.peek(e).type===g.IDENTIFIER;)e++;return this.peek(e).type===g.OPERATOR&&this.peek(e).value==="="}parseTypedVarDeclaration(){let e=this.advance().value;for(;this.match(g.DOT)&&this.peek(1).type===g.IDENTIFIER;)this.advance(),e+="."+this.advance().value;if(this.match(g.LBRACKET)&&this.peek(1).type===g.RBRACKET)this.advance(),this.advance(),e+="[]";else if(this.match(g.OPERATOR,"<")){for(this.advance(),e+="<";!this.match(g.OPERATOR,">");)if(this.match(g.IDENTIFIER))for(e+=this.advance().value;this.match(g.DOT)&&this.peek(1).type===g.IDENTIFIER;)e+=".",this.advance(),e+=this.advance().value;else if(this.match(g.COMMA))e+=this.advance().value,this.skipNewlines();else break;this.match(g.OPERATOR,">")&&(e+=">",this.advance())}else for(;this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.IDENTIFIER;)e+=" "+this.advance().value;let i=this.expect(g.IDENTIFIER).value;this.functionNames.has(i)&&(i=i+"_var"),this.expect(g.OPERATOR,"="),this.skipNewlines(!0);const r=this.parseExpression(),s=new se(i);return s.varType=e,new He([new Ge(s,r,e)],Je.LET)}parseFunctionDeclaration(){let e=null;this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.IDENTIFIER&&(e=this.advance().value);const i=this.expect(g.IDENTIFIER).value;this.functionNames.add(i),this.expect(g.LPAREN);const r=[];for(;!this.match(g.RPAREN)&&(this.skipNewlines(),!this.match(g.RPAREN));){let n=null;for(;this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.IDENTIFIER&&this.peek(2).type!==g.LPAREN;)n&&(n+=" "),n=(n||"")+this.advance().value;const o=this.expect(g.IDENTIFIER).value,l=new se(o);if(n&&(l.varType=n),this.match(g.OPERATOR,"=")){this.advance(),this.skipNewlines();const c=this.parseExpression();r.push(new Yi(l,c))}else r.push(l);this.match(g.COMMA)&&this.advance()}this.expect(g.RPAREN),this.skipNewlines(),this.expect(g.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),a=new se(i);return e&&(a.returnType=e),new Fi(a,r,s,e)}parseMethodDeclaration(){this.expect(g.KEYWORD,"method");let e=null;this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.IDENTIFIER&&this.peek(2).type===g.LPAREN&&(e=this.advance().value);const i=this.expect(g.IDENTIFIER).value;this.expect(g.LPAREN);const r=[];for(;!this.match(g.RPAREN)&&(this.skipNewlines(),!this.match(g.RPAREN));){let n=null;for(;this.peek().type===g.IDENTIFIER&&this.peek(1).type===g.IDENTIFIER&&this.peek(2).type!==g.LPAREN;)n&&(n+=" "),n=(n||"")+this.advance().value;const o=this.expect(g.IDENTIFIER).value,l=new se(o);if(n&&(l.varType=n),this.match(g.OPERATOR,"=")){this.advance(),this.skipNewlines();const c=this.parseExpression();r.push(new Yi(l,c))}else r.push(l);this.match(g.COMMA)&&this.advance()}this.expect(g.RPAREN),this.skipNewlines(),this.expect(g.OPERATOR,"=>"),this.skipNewlines();const s=this.parseFunctionBody(),a=new se(i);return e&&(a.returnType=e),a.isMethod=!0,new Fi(a,r,s,e)}parseFunctionBody(){const e=[];if(!this.match(g.INDENT)){const i=this.parseExpression();return new Ye([new Wi(i)])}for(this.advance();!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){const i=this.parseStatementOrSequence();Array.isArray(i)?e.push(...i):i&&e.push(i)}return this.match(g.DEDENT)&&this.advance(),e.length>0&&this._addImplicitReturn(e),new Ye(e)}_addImplicitReturn(e){const i=e[e.length-1];i.type==="ExpressionStatement"?e[e.length-1]=new Wi(i.expression):i.type==="IfStatement"&&this._addImplicitReturnToIf(i)}_addImplicitReturnToIf(e){e.consequent&&e.consequent.type==="BlockStatement"&&e.consequent.body.length>0&&this._addImplicitReturn(e.consequent.body),e.alternate&&(e.alternate.type==="IfStatement"?this._addImplicitReturnToIf(e.alternate):e.alternate.type==="BlockStatement"&&e.alternate.body.length>0&&this._addImplicitReturn(e.alternate.body))}parseStatementOrSequence(){this.pos;const e=this.peek().line;if(this.match(g.KEYWORD,"if")){const r=this.parseIfStatement();return r&&(r._line=e),r}if(this.match(g.KEYWORD,"for"))return this.parseForStatement();if(this.match(g.KEYWORD,"while"))return this.parseWhileStatement();if(this.match(g.KEYWORD,"break")||this.match(g.KEYWORD,"continue")){const r=this.advance().value;return new Se(new se(r))}if(this.match(g.KEYWORD,"var")||this.match(g.KEYWORD,"varip"))return this.parseVarDeclaration();if(this.isTupleDestructuring())return this.parseTupleDestructuring();if(this.peek().type===g.IDENTIFIER&&this.isTypedVarDeclaration())return this.parseTypedVarDeclaration();const i=[];for(;;){const r=this.parseExpression();if(this.match(g.OPERATOR)){const s=this.peek().value;if(["=",":=","+=","-=","*=","/=","%="].includes(s)){this.advance(),this.skipNewlines(!0);const a=this.parseExpression();if(s==="="&&r.type==="Identifier"?i.push(new He([new Ge(r,a)],Je.LET)):i.push(new Se(new At(s===":="?"=":s,r,a))),this.match(g.COMMA)){this.advance(),this.skipNewlines();continue}break}else{if(i.length>0)i.push(new Se(r));else return new Se(r);break}}else if(this.match(g.COMMA)){i.push(new Se(r)),this.advance(),this.skipNewlines();continue}else{if(i.length>0)i.push(new Se(r));else return new Se(r);break}}return i.length>1?i:i.length===1?i[0]:null}parseIfStatement(){this.expect(g.KEYWORD,"if");const e=this.parseExpression();this.skipNewlines();const i=this.parseBlock();let r=null;return this.skipNewlines(),this.match(g.KEYWORD,"else")&&(this.advance(),this.skipNewlines(),this.match(g.KEYWORD,"if")?r=this.parseIfStatement():r=this.parseBlock()),new Xn(e,i,r)}parseForStatement(){this.expect(g.KEYWORD,"for");let e=null,i=!1;if(this.match(g.LBRACKET)){this.advance();const r=[];for(;!this.match(g.RBRACKET);)this.skipNewlines(),r.push(new se(this.expect(g.IDENTIFIER).value)),this.match(g.COMMA)&&this.advance();this.expect(g.RBRACKET),e=new Gi(r),i=!0}else{const r=this.expect(g.IDENTIFIER).value;e=new se(r)}if(this.match(g.KEYWORD,"in")){this.advance();const r=this.parseExpression();this.skipNewlines();const s=this.parseBlock(),a=new He([new Ge(e,r)],Je.CONST),n=new $i(a,null,null,s);return n.isForIn=!0,n}else{if(i)throw new Error(`Range-based for loops don't support destructuring at ${this.peek().line}:${this.peek().column}`);this.expect(g.OPERATOR,"=");const r=this.parseExpression();this.expect(g.KEYWORD,"to");const s=this.parseExpression();let a=null;this.match(g.KEYWORD,"by")&&(this.advance(),a=this.parseExpression()),this.skipNewlines();const n=this.parseBlock(),o=new He([new Ge(e,r)],Je.LET),l=new We("<=",r,s),c=new Qe(l,new We("<=",e,s),new We(">=",e,s));let h;return a?h=new Qe(l,new At("+=",e,a),new At("-=",e,a)):h=new Qe(l,new qi("++",e),new qi("--",e)),new $i(o,c,h,n)}}parseWhileStatement(){this.expect(g.KEYWORD,"while");const e=this.parseExpression();this.skipNewlines();const i=this.parseBlock();return new Zn(e,i)}parseBlock(){if(!this.match(g.INDENT)){const r=this.parseStatement();return new Ye(r?[r]:[])}const e=this.peek().indent;this.advance();const i=[];for(;!this.match(g.EOF);){if(this.skipNewlines(),this.match(g.DEDENT)){if(this.peek().indent<e)break;this.advance();continue}if(this.match(g.EOF))break;const r=this.parseStatement();r&&i.push(r)}return this.match(g.DEDENT)&&this.peek().indent<e&&this.advance(),new Ye(i)}isTupleDestructuring(){if(!this.match(g.LBRACKET))return!1;let e=1;for(;;){for(;this.peek(e).type===g.NEWLINE;)e++;if(this.peek(e).type!==g.IDENTIFIER)return!1;for(e++;this.peek(e).type===g.NEWLINE;)e++;if(this.peek(e).type===g.RBRACKET){e++;break}else if(this.peek(e).type===g.COMMA){e++;continue}else return!1}for(;this.peek(e).type===g.NEWLINE;)e++;return this.peek(e).type===g.OPERATOR&&this.peek(e).value==="="}parseTupleDestructuring(){this.expect(g.LBRACKET);const e=[];for(;!this.match(g.RBRACKET);){this.skipNewlines();let r=this.expect(g.IDENTIFIER).value;this.functionNames.has(r)&&(r=r+"_var"),e.push(new se(r)),this.match(g.COMMA)&&this.advance()}this.expect(g.RBRACKET),this.skipNewlines(),this.expect(g.OPERATOR,"="),this.skipNewlines(!0);const i=this.parseExpression();return new He([new Ge(new Gi(e),i)],Je.CONST)}parseExpression(){return this.parseTernary()}parseTernary(){let e=this.parseLogicalOr();if(this.matchEx(g.OPERATOR,"?",!0)){this.advance(),this.skipNewlines(!0);const i=this.parseExpression();this.matchEx(g.COLON,null,!0)?this.advance():this.expect(g.COLON),this.skipNewlines(!0);const r=this.parseExpression();return new Qe(e,i,r)}return e}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.matchEx(g.KEYWORD,"or",!0)||this.peekOperatorEx(["||"]);){this.advance(),this.skipNewlines(!0);const i=this.parseLogicalAnd();e=new We("||",e,i)}return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.matchEx(g.KEYWORD,"and",!0)||this.peekOperatorEx(["&&"]);){this.advance(),this.skipNewlines();const i=this.parseEquality();e=new We("&&",e,i)}return e}parseEquality(){let e=this.parseComparison();for(;this.peekOperatorEx(["==","!="]);){const i=this.advance().value;this.skipNewlines(!0);const r=this.parseComparison();e=new We(i,e,r)}return e}parseComparison(){let e=this.parseAdditive();for(;this.peekOperatorEx(["<",">","<=",">="]);){const i=this.advance().value;this.skipNewlines();const r=this.parseAdditive();e=new We(i,e,r)}return e}parseAdditive(){let e=this.parseMultiplicative();for(;this.peekOperatorEx(["+","-"]);){const i=this.advance().value;this.skipNewlines(!0);const r=this.parseMultiplicative();e=new We(i,e,r)}return e}parseMultiplicative(){let e=this.parseUnary();for(;this.peekOperatorEx(["*","/","%"]);){const i=this.advance().value;this.skipNewlines(!0);const r=this.parseUnary();e=new We(i,e,r)}return e}parseUnary(){if(this.match(g.OPERATOR)){const e=this.peek().value;if(["+","-","!"].includes(e))return this.advance(),this.skipNewlines(),new Ui(e,this.parseUnary())}return this.match(g.KEYWORD,"not")?(this.advance(),this.skipNewlines(),new Ui("!",this.parseUnary())):this.parsePostfix()}parsePostfix(){let e=this.parsePrimary();for(;;)if(this.match(g.OPERATOR,"<")){const i=this.pos;this.advance();let r=1,s=!0;for(;r>0&&!this.match(g.EOF);)if(this.match(g.OPERATOR,"<"))r++,this.advance();else if(this.match(g.OPERATOR,">"))r--,this.advance();else if(this.match(g.IDENTIFIER)||this.match(g.COMMA)||this.match(g.DOT))this.advance();else{s=!1,this.pos=i;break}if(s&&this.match(g.LPAREN)){e=this.parseCallExpression(e);continue}else{if(s)continue;break}}else if(this.match(g.LPAREN))e=this.parseCallExpression(e);else if(this.match(g.DOT)){this.advance(),this.skipNewlines();const i=this.expect(g.IDENTIFIER).value;e=new Ki(e,new se(i),!1)}else if(this.match(g.LBRACKET)){this.advance(),this.skipNewlines();const i=this.parseExpression();this.expect(g.RBRACKET),e=new Ki(e,i,!0)}else break;return e}parseCallExpression(e){this.expect(g.LPAREN);const i=[],r=[];for(;!this.match(g.RPAREN)&&(this.skipNewlines(),!this.match(g.RPAREN));){if((this.peek().type===g.IDENTIFIER||this.peek().type===g.KEYWORD)&&this.peek(1).type===g.OPERATOR&&this.peek(1).value==="="){const s=this.advance().value;this.advance(),this.skipNewlines();const a=this.parseExpression();r.push(new Hi(new se(s),a))}else i.push(this.parseExpression());this.match(g.COMMA)&&this.advance(),this.skipNewlines()}return this.expect(g.RPAREN),r.length>0&&i.push(new zi(r)),new Jn(e,i)}parsePrimary(){const e=this.peek();if(this.match(g.NUMBER)){const i=this.advance();return new nt(i.value)}if(this.match(g.STRING)){const i=this.advance();return new nt(i.value)}if(this.match(g.BOOLEAN)){const i=this.advance();return new nt(i.value)}if(this.match(g.IDENTIFIER)){let i=this.advance().value;return this.functionNames.has(i)&&this.peek().type!==g.LPAREN&&(i=i+"_var"),new se(i)}if(this.match(g.LBRACKET))return this.parseArrayLiteral();if(this.match(g.LPAREN)){this.advance(),this.skipNewlines();const i=this.parseExpression();return this.skipNewlines(),this.expect(g.RPAREN),i}if(this.match(g.KEYWORD,"if"))return this.parseIfExpression();if(this.match(g.KEYWORD,"switch"))return this.parseSwitchExpression();if(this.match(g.KEYWORD,"for"))return this.parseForExpression();if(this.match(g.KEYWORD,"while"))return this.parseWhileExpression();throw new Error(`Unexpected token ${e.type} '${e.value}' at ${e.line}:${e.column}`)}parseArrayLiteral(){this.expect(g.LBRACKET);const e=[];for(;!this.match(g.RBRACKET)&&(this.skipNewlines(),!this.match(g.RBRACKET));)e.push(this.parseExpression()),this.match(g.COMMA)&&this.advance(),this.skipNewlines();return this.expect(g.RBRACKET),new ea(e)}parseIfExpression(){this.expect(g.KEYWORD,"if");const e=this.parseExpression();this.skipNewlines(),this.expect(g.INDENT);const i=[];for(;!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){const n=this.parseStatement();n&&i.push(n)}this.advance();let r=[];if(this.match(g.KEYWORD,"else"))if(this.advance(),this.skipNewlines(),this.match(g.KEYWORD,"if")){const n=this.parseIfExpression();if(this.needsIIFE(i,r)){const o=new Qe(e,new Ye(i),n);return o.needsIIFE=!0,o.consequentStmts=i,o.alternateExpr=n,o}else return new Qe(e,this.getBlockValue(i),n)}else{for(this.expect(g.INDENT);!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){const n=this.parseStatement();n&&r.push(n)}this.advance()}if(this.needsIIFE(i,r)){const n=new Qe(e,new Ye(i),new Ye(r));return n.needsIIFE=!0,n.consequentStmts=i,n.alternateStmts=r,n}const s=this.getBlockValue(i),a=r.length>0?this.getBlockValue(r):new nt(null);return new Qe(e,s,a)}needsIIFE(e,i){if(e.length>1||i.length>1)return!0;const r=s=>s.some(a=>a.type==="IfStatement"||a.type==="ForStatement"||a.type==="WhileStatement"||a.type==="BlockStatement");return r(e)||r(i)}parseSwitchExpression(){this.expect(g.KEYWORD,"switch");let e=null;!this.match(g.NEWLINE)&&!this.match(g.INDENT)&&(e=this.parseExpression()),this.skipNewlines(),this.expect(g.INDENT);const i=[];for(;!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){let r=null;this.match(g.OPERATOR,"=>")||(r=this.parseExpression()),this.expect(g.OPERATOR,"=>"),this.skipNewlines();const s=[];if(this.match(g.INDENT)){for(this.advance();!this.match(g.DEDENT)&&!this.match(g.EOF)&&(this.skipNewlines(),!this.match(g.DEDENT));){const n=this.parseStatement();n&&s.push(n)}this.advance()}else s.push(new Se(this.parseExpression()));const a=this.getBlockValue(s);i.push(new ia(r,a,s)),this.skipNewlines()}return this.advance(),new ta(e,i)}parseForExpression(){const e=this.parseForStatement();return e.isExpression=!0,e}parseWhileExpression(){const e=this.parseWhileStatement();return e.isExpression=!0,e}getBlockValue(e){if(e.length===0)return new nt(null);const i=e[e.length-1];return i.type==="ExpressionStatement"?i.expression:i.type==="VariableDeclaration"&&i.declarations.length>0?i.declarations[0].id:new nt(null)}}var aa=Object.defineProperty,oa=(t,e,i)=>e in t?aa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,at=(t,e,i)=>oa(t,typeof e!="symbol"?e+"":e,i);class la{constructor(e={}){at(this,"indent"),at(this,"indentStr"),at(this,"output"),at(this,"sourceCode"),at(this,"sourceLines"),at(this,"lastCommentedLine"),at(this,"includeSourceComments"),this.indent=0,this.indentStr=e.indentStr||" ",this.output=[],this.sourceCode=e.sourceCode||null,this.sourceLines=this.sourceCode?this.sourceCode.split(`
|
|
40
40
|
`):[],this.lastCommentedLine=-1,this.includeSourceComments=e.includeSourceComments||!1}generate(e){if(this.output=[],this.indent=0,this.lastCommentedLine=-1,e.type==="Program")this.generateProgram(e);else throw new Error(`Expected Program node, got ${e.type}`);return this.output.join("")}writeSourceComment(e,i=null){if(!this.sourceLines.length)return;const r=i||e,s=[];for(let a=e-1;a<r&&a<this.sourceLines.length;a++)if(a>this.lastCommentedLine){const n=this.sourceLines[a].trim();n&&!n.startsWith("//@")&&!n.startsWith("//")&&s.push(this.sourceLines[a])}if(s.length>0){for(const a of s)this.write(this.indentStr.repeat(this.indent)),this.write("/// "),this.write(a.trimEnd()),this.write(`
|
|
41
41
|
`);this.lastCommentedLine=Math.max(this.lastCommentedLine,r-1)}}write(e){this.output.push(e)}writeLine(e=""){e?this.output.push(this.indentStr.repeat(this.indent)+e+`
|
|
42
42
|
`):this.output.push(`
|
|
@@ -131,8 +131,8 @@ ${t}
|
|
|
131
131
|
`)}}generateLoopAsExpression(e,i){this.write(`(() => {
|
|
132
132
|
`),this.indent++,this.write(this.indentStr.repeat(this.indent)),this.write(`let __result;
|
|
133
133
|
`);const r=e.body;if(r&&r.body&&r.body.length>0){const s=r.body.length-1,a=r.body[s];a.type==="ExpressionStatement"&&(r.body[s]={type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"__result"},right:a.expression},_line:a._line})}i==="for"?this.generateForStatement(e):this.generateWhileStatement(e),this.write(this.indentStr.repeat(this.indent)),this.write(`return __result;
|
|
134
|
-
`),this.indent--,this.write(this.indentStr.repeat(this.indent)),this.write("})()")}generateSequenceExpression(e){this.write("(");for(let i=0;i<e.expressions.length;i++)this.generateExpression(e.expressions[i]),i<e.expressions.length-1&&this.write(", ");this.write(")")}getPrecedence(e){switch(e.type){case"Literal":case"Identifier":case"ArrayExpression":case"ObjectExpression":return 20;case"CallExpression":case"MemberExpression":return 19;case"UnaryExpression":case"UpdateExpression":return 15;case"BinaryExpression":case"LogicalExpression":switch(e.operator){case"*":case"/":case"%":return 13;case"+":case"-":return 12;case"<":case"<=":case">":case">=":return 10;case"==":case"!=":return 9;case"and":case"&&":return 5;case"or":case"||":return 4;default:return 0}case"ConditionalExpression":return 3;case"AssignmentExpression":case"AssignmentPattern":return 2;case"SequenceExpression":return 1;default:return 0}}}function
|
|
135
|
-
`):[],a=
|
|
136
|
-
; return _r;`)(this)}function ua(t){return e=>new W(e.array.map(i=>Math.abs(i)),e.type,t)}function pa(t){return e=>{let i=0,r=0;for(const s of e.array){const a=Number(s);isNaN(a)||(r++,i+=(a-i)/r)}return r===0?NaN:t.precision(i)}}function fa(t){return(e,i)=>{const r=e.array;let s=0,a=r.length-1;for(;s<=a;){const n=Math.floor((s+a)/2),o=r[n];if(o===i)return n;o<i?s=n+1:a=n-1}return-1}}function da(t){return(e,i)=>{const r=e.array;let s=0,a=r.length;for(;s<a;){const n=Math.floor((s+a)/2);r[n]<i?s=n+1:a=n}return s<r.length&&r[s]===i?s:s-1}}function ma(t){return(e,i)=>{const r=e.array;let s=0,a=r.length;for(;s<a;){const n=Math.floor((s+a)/2);r[n]<=i?s=n+1:a=n}return s>0&&r[s-1]===i?s-1:s}}function ga(t){return e=>{e.array.length=0}}function xa(t){return(e,i)=>(e.array.push(...i.array),e)}function ya(t){return e=>new W([...e.array],e.type,t)}function _a(t){return(e,i,r=!0)=>{const s=e.array,a=i.array;if(s.length!==a.length)return NaN;let n=0,o=0,l=0;const c=[];for(let m=0;m<s.length;m++){const y=Number(s[m]),_=Number(a[m]);!isNaN(y)&&y!==null&&y!==void 0&&!isNaN(_)&&_!==null&&_!==void 0&&(n+=y,o+=_,l++,c.push(m))}if(l===0)return NaN;const h=n/l,p=o/l;let u=0;for(const m of c){const y=Number(s[m]),_=Number(a[m]);u+=(y-h)*(_-p)}const f=r?l:l-1;return f<=0?NaN:t.precision(u/f)}}function ba(t){return e=>e.array.every(i=>!isNaN(i)&&i)}function va(t){return t.every(e=>typeof e=="number")?t.every(e=>(e|0)===e)?H.int:H.float:t.every(e=>typeof e=="string")?H.string:t.every(e=>typeof e=="boolean")?H.bool:H.any}function Re(t){if(typeof t=="number")return(t|0)===t?H.int:H.float;if(typeof t=="string")return H.string;if(typeof t=="boolean")return H.bool;throw new Error("Cannot infer type from value")}function Ct(t,e){if(e===H.any)return!0;switch(e){case H.int:return typeof t=="number"&&((t|0)===t||isNaN(t));case H.float:return typeof t=="number";case H.string:return typeof t=="string";case H.bool:return typeof t=="boolean"}return!1}function wa(t){return(e,i,r=0,s)=>{const a=e.array.length,n=s!==void 0?Math.min(s,a):a;for(let o=r;o<n;o++){if(!Ct(i,e.type))throw new Error(`Cannot call 'array.fill' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${e.type}' is expected.`);e.array[o]=typeof i=="number"?t.precision(i):i}}}function Sa(t){return e=>e.array.length>0?e.array[0]:t.NA}function Ea(t){return(e,i)=>e.array[i]}function Na(t){return(e,i)=>e.array.includes(i)}function Ca(t){return(e,i)=>typeof i=="number"&&i!==i?e.array.findIndex(r=>typeof r=="number"&&r!==r):e.array.indexOf(i)}function Ia(t){return(e,i,r)=>{if(!Ct(r,e.type))throw new Error(`Cannot call 'array.insert' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${e.type}' is expected.`);e.array.splice(i,0,r)}}function ka(t){return(e,i=",")=>e.array.join(i)}function Aa(t){return e=>e.array.length>0?e.array[e.array.length-1]:t.NA}function Ta(t){return(e,i)=>e.array.lastIndexOf(i)}function Pa(t){return(e,i=0)=>[...e.array].sort((r,s)=>s-r)[i]??t.NA}function Da(t){return e=>{if(e.array.length===0)return NaN;const i=[...e.array].sort((s,a)=>typeof s=="number"&&typeof a=="number"?s-a:0),r=Math.floor(i.length/2);return i.length%2!==0?i[r]:(i[r-1]+i[r])/2}}function Ra(t){return(e,i=0)=>[...e.array].sort((r,s)=>r-s)[i]??t.NA}function Oa(t){return e=>{if(e.array.length===0)return NaN;const i=new Map;let r=0;for(const a of e.array){const n=(i.get(a)||0)+1;i.set(a,n),n>r&&(r=n)}const s=[];for(const[a,n]of i)n===r&&s.push(a);return s.sort((a,n)=>typeof a=="number"&&typeof n=="number"?a-n:typeof a=="string"&&typeof n=="string"?a<n?-1:a>n?1:0:0),s[0]}}function Va(t){return(e,i)=>{const r=e.array;if(r.length===0)return NaN;const s=[];for(const l of r){const c=Number(l);if(isNaN(c)||c===null||c===void 0)return NaN;s.push(c)}s.sort((l,c)=>l-c),i<0&&(i=0),i>100&&(i=100);const a=i/100*s.length-.5;if(a<=0)return t.precision(s[0]);if(a>=s.length-1)return t.precision(s[s.length-1]);const n=Math.floor(a),o=a-n;return t.precision(s[n]*(1-o)+s[n+1]*o)}}function Ma(t){return(e,i)=>{const r=e.array;if(r.length===0)return NaN;const s=[];for(const o of r){const l=Number(o);!isNaN(l)&&l!==null&&l!==void 0&&s.push(l)}if(s.length===0)return NaN;s.sort((o,l)=>o-l),i<0&&(i=0),i>100&&(i=100);const a=r.length,n=Math.ceil(i/100*a);return n<=0?s[0]:n>s.length?NaN:s[n-1]}}function La(t){return(e,i)=>{if(e.array.length===0)return NaN;const r=Math.floor(i);if(r<0||r>=e.array.length)return NaN;const s=Number(e.array[r]);if(isNaN(s)||s===null||s===void 0)return NaN;let a=0;for(const o of e.array){const l=Number(o);!isNaN(l)&&l!==null&&l!==void 0&&l<s&&a++}const n=e.array.length-1;return n<=0?NaN:a/n*100}}function ja(t){return e=>e.array.pop()}function Ba(t){return(e,i)=>{if(!Ct(i,e.type))throw new Error(`Cannot call 'array.push' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${e.type}' is expected.`);e.array.push(typeof i=="number"?t.precision(i):i)}}function Fa(t){return e=>t.precision(t.pine.array.max(e)-t.pine.array.min(e))}function $a(t){return(e,i)=>i>=0&&i<e.array.length?e.array.splice(i,1)[0]:t.NA}function Wa(t){return e=>{e.array.reverse()}}function Ua(t){return(e,i,r)=>{if(!Ct(r,e.type))throw new Error(`Cannot call 'array.set' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${e.type}' is expected.`);e.array[i]=typeof r=="number"?t.precision(r):r}}function qa(t){return e=>e.array.shift()}function Ka(t){return e=>e.array.length}function za(t){return(e,i,r)=>{const s=r!==void 0?r:void 0;return new W(e.array.slice(i,s),e.type,t)}}function Ha(t){return e=>e.array.some(i=>!isNaN(i)&&i)}var mt=(t=>(t[t.ascending=1]="ascending",t[t.descending=0]="descending",t))(mt||{}),es=(t=>(t.AED="AED",t.ARS="ARS",t.AUD="AUD",t.BDT="BDT",t.BHD="BHD",t.BRL="BRL",t.BTC="BTC",t.CAD="CAD",t.CHF="CHF",t.CLP="CLP",t.CNY="CNY",t.COP="COP",t.CZK="CZK",t.DKK="DKK",t.EGP="EGP",t.ETH="ETH",t.EUR="EUR",t.GBP="GBP",t.HKD="HKD",t.HUF="HUF",t.IDR="IDR",t.ILS="ILS",t.INR="INR",t.ISK="ISK",t.JPY="JPY",t.KES="KES",t.KRW="KRW",t.KWD="KWD",t.LKR="LKR",t.MAD="MAD",t.MXN="MXN",t.MYR="MYR",t.NGN="NGN",t.NOK="NOK",t.NONE="NONE",t.NZD="NZD",t.PEN="PEN",t.PHP="PHP",t.PKR="PKR",t.PLN="PLN",t.QAR="QAR",t.RON="RON",t.RSD="RSD",t.RUB="RUB",t.SAR="SAR",t.SEK="SEK",t.SGD="SGD",t.THB="THB",t.TND="TND",t.TRY="TRY",t.TWD="TWD",t.USD="USD",t.USDT="USDT",t.VES="VES",t.VND="VND",t.ZAR="ZAR",t))(es||{}),ts=(t=>(t[t.sunday=1]="sunday",t[t.monday=2]="monday",t[t.tuesday=3]="tuesday",t[t.wednesday=4]="wednesday",t[t.thursday=5]="thursday",t[t.friday=6]="friday",t[t.saturday=7]="saturday",t))(ts||{}),is=(t=>(t.all="all",t.data_window="data_window",t.none="none",t.pane="pane",t.price_scale="price_scale",t.status_line="status_line",t))(is||{}),rs=(t=>(t.flag="shape_flag",t.arrowdown="shape_arrow_down",t.arrowup="shape_arrow_up",t.circle="shape_circle",t.cross="shape_cross",t.diamond="shape_diamond",t.labeldown="shape_label_down",t.labelup="shape_label_up",t.square="shape_square",t.triangledown="shape_triangle_down",t.triangleup="shape_triangle_up",t.xcross="shape_xcross",t))(rs||{}),ss=(t=>(t.abovebar="AboveBar",t.belowbar="BelowBar",t.absolute="Absolute",t.bottom="Bottom",t.top="Top",t))(ss||{}),ns=(t=>(t.auto="auto",t.tiny="tiny",t.small="small",t.normal="normal",t.large="large",t.huge="huge",t))(ns||{}),as=(t=>(t.inherit="inherit",t.mintick="mintick",t.percent="percent",t.price="price",t.volume="volume",t))(as||{}),Ga=(t=>(t.linestyle_dashed="linestyle_dashed",t.linestyle_dotted="linestyle_dotted",t.linestyle_solid="linestyle_solid",t.style_area="style_area",t.style_areabr="style_areabr",t.style_circles="style_circles",t.style_columns="style_columns",t.style_cross="style_cross",t.style_histogram="style_histogram",t.style_line="style_line",t.style_linebr="style_linebr",t.style_stepline="style_stepline",t.style_stepline_diamond="style_stepline_diamond",t.style_steplinebr="style_steplinebr",t))(Ga||{}),os=(t=>(t.gaps_on="gaps_on",t.gaps_off="gaps_off",t.lookahead_on="lookahead_on",t.lookahead_off="lookahead_off",t))(os||{}),ls=(t=>(t.bar_index="bi",t.bar_time="bt",t))(ls||{}),cs=(t=>(t.price="pr",t.abovebar="ab",t.belowbar="bl",t))(cs||{}),hs=(t=>(t.left="l",t.right="r",t.both="b",t.none="n",t))(hs||{}),us=(t=>(t.align_left="left",t.align_center="center",t.align_right="right",t.wrap_auto="auto",t.wrap_none="none",t))(us||{}),ps=(t=>(t.family_default="default",t.family_monospace="monospace",t))(ps||{}),fs=(t=>(t.none="none",t.splits="splits",t.dividends="dividends",t))(fs||{}),ds=(t=>(t.inherit="inherit",t.off="off",t.on="on",t))(ds||{}),ms=(t=>(t.actual="earnings_actual",t.estimate="earnings_estimate",t.standardized="earnings_standardized",t.future_eps="earnings_future_eps",t.future_period_end_time="earnings_future_period_end_time",t.future_revenue="earnings_future_revenue",t.future_time="earnings_future_time",t))(ms||{}),gs=(t=>(t.gross="dividends_gross",t.net="dividends_net",t.future_amount="dividends_future_amount",t.future_ex_date="dividends_future_ex_date",t.future_pay_date="dividends_future_pay_date",t))(gs||{}),xs=(t=>(t.denominator="splits_denominator",t.numerator="splits_numerator",t))(xs||{}),ys=(t=>(t.top_left="top_left",t.top_center="top_center",t.top_right="top_right",t.middle_left="middle_left",t.middle_center="middle_center",t.middle_right="middle_right",t.bottom_left="bottom_left",t.bottom_center="bottom_center",t.bottom_right="bottom_right",t))(ys||{});const Ya={order:mt,currency:es,dayofweek:ts,display:is,shape:rs,location:ss,size:ns,format:as,barmerge:os,xloc:ls,yloc:cs,extend:hs,text:us,font:ps,adjustment:fs,backadjustment:ds,earnings:ms,dividends:gs,splits:xs,position:ys};function Qa(t){return(e,i=mt.ascending)=>{e.array.sort((r,s)=>{let a=isNaN(r)?1/0:r,n=isNaN(s)?1/0:s;return i===mt.ascending?a-n:n-a})}}function Xa(t){return(e,i=mt.ascending)=>{const r=e.array.map((s,a)=>a);return r.sort((s,a)=>{const n=isNaN(e.array[s])?1/0:e.array[s],o=isNaN(e.array[a])?1/0:e.array[a];return i===mt.ascending?n-o:o-n}),new W(r,H.int,t)}}function Za(t){return e=>{const i=t.array.avg(e),r=t.array.stdev(e);return isNaN(r)?new W(e.array.map(()=>NaN),H.int,t):r===0?new W(e.array.map(()=>1),H.int,t):new W(e.array.map(s=>(s-i)/r),H.int,t)}}function Ja(t){return(e,i=!0)=>{const r=e.array,s=r.length;if(s===0)return NaN;let a=0,n=0,o=0;for(let h=0;h<s;h++){const p=Number(r[h]);!isNaN(p)&&p!==null&&p!==void 0&&(a+=p,n+=p*p,o++)}if(o===0)return NaN;const l=a/o;let c=n/o-l*l;return c<0?NaN:(!i&&o>1&&(c=c*o/(o-1)),!i&&o===1?0:t.precision(Math.sqrt(c)))}}function eo(t){return e=>t.precision(e.array.reduce((i,r)=>{const s=Number(r);return isNaN(s)?i:i+s},0))}function to(t){return(e,i)=>{if(!Ct(i,e.type))throw new Error(`Cannot call 'array.unshift' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${e.type}' is expected.`);e.array.unshift(typeof i=="number"?t.precision(i):i)}}function io(t){return(e,i=!0)=>{let r=0,s=0;for(const l of e.array){const c=Number(l);!isNaN(c)&&c!==null&&c!==void 0&&(r+=c,s++)}if(s===0)return NaN;const a=r/s;let n=0;for(const l of e.array){const c=Number(l);!isNaN(c)&&c!==null&&c!==void 0&&(n+=(c-a)*(c-a))}const o=i?s:s-1;return o<=0?NaN:t.precision(n/o)}}var ro=Object.defineProperty,so=(t,e,i)=>e in t?ro(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,R=(t,e,i)=>so(t,typeof e!="symbol"?e+"":e,i),H=(t=>(t.any="",t.box="box",t.bool="bool",t.color="color",t.float="float",t.int="int",t.label="label",t.line="line",t.linefill="linefill",t.string="string",t.table="table",t))(H||{});class W{constructor(e,i,r){this.array=e,this.type=i,this.context=r,R(this,"_abs"),R(this,"_avg"),R(this,"_binary_search"),R(this,"_binary_search_leftmost"),R(this,"_binary_search_rightmost"),R(this,"_clear"),R(this,"_concat"),R(this,"_copy"),R(this,"_covariance"),R(this,"_every"),R(this,"_fill"),R(this,"_first"),R(this,"_get"),R(this,"_includes"),R(this,"_indexof"),R(this,"_insert"),R(this,"_join"),R(this,"_last"),R(this,"_lastindexof"),R(this,"_max"),R(this,"_median"),R(this,"_min"),R(this,"_mode"),R(this,"_percentile_linear_interpolation"),R(this,"_percentile_nearest_rank"),R(this,"_percentrank"),R(this,"_pop"),R(this,"_push"),R(this,"_range"),R(this,"_remove"),R(this,"_reverse"),R(this,"_set"),R(this,"_shift"),R(this,"_size"),R(this,"_slice"),R(this,"_some"),R(this,"_sort"),R(this,"_sort_indices"),R(this,"_standardize"),R(this,"_stdev"),R(this,"_sum"),R(this,"_unshift"),R(this,"_variance"),this._abs=ua(this.context),this._avg=pa(this.context),this._binary_search=fa(this.context),this._binary_search_leftmost=da(this.context),this._binary_search_rightmost=ma(this.context),this._clear=ga(this.context),this._concat=xa(this.context),this._copy=ya(this.context),this._covariance=_a(this.context),this._every=ba(this.context),this._fill=wa(this.context),this._first=Sa(this.context),this._get=Ea(this.context),this._includes=Na(this.context),this._indexof=Ca(this.context),this._insert=Ia(this.context),this._join=ka(this.context),this._last=Aa(this.context),this._lastindexof=Ta(this.context),this._max=Pa(this.context),this._median=Da(this.context),this._min=Ra(this.context),this._mode=Oa(this.context),this._percentile_linear_interpolation=Va(this.context),this._percentile_nearest_rank=Ma(this.context),this._percentrank=La(this.context),this._pop=ja(this.context),this._push=Ba(this.context),this._range=Fa(this.context),this._remove=$a(this.context),this._reverse=Wa(this.context),this._set=Ua(this.context),this._shift=qa(this.context),this._size=Ka(this.context),this._slice=za(this.context),this._some=Ha(this.context),this._sort=Qa(this.context),this._sort_indices=Xa(this.context),this._standardize=Za(this.context),this._stdev=Ja(this.context),this._sum=eo(this.context),this._unshift=to(this.context),this._variance=io(this.context)}toString(){return"["+this.array.toString().replace(/,/g,", ")+"]"}[Symbol.iterator](){return this.array[Symbol.iterator]()}abs(...e){return this._abs(this,...e)}avg(...e){return this._avg(this,...e)}binary_search(...e){return this._binary_search(this,...e)}binary_search_leftmost(...e){return this._binary_search_leftmost(this,...e)}binary_search_rightmost(...e){return this._binary_search_rightmost(this,...e)}clear(...e){return this._clear(this,...e)}concat(...e){return this._concat(this,...e)}copy(...e){return this._copy(this,...e)}covariance(...e){return this._covariance(this,...e)}every(...e){return this._every(this,...e)}fill(...e){return this._fill(this,...e)}first(...e){return this._first(this,...e)}get(...e){return this._get(this,...e)}includes(...e){return this._includes(this,...e)}indexof(...e){return this._indexof(this,...e)}insert(...e){return this._insert(this,...e)}join(...e){return this._join(this,...e)}last(...e){return this._last(this,...e)}lastindexof(...e){return this._lastindexof(this,...e)}max(...e){return this._max(this,...e)}median(...e){return this._median(this,...e)}min(...e){return this._min(this,...e)}mode(...e){return this._mode(this,...e)}percentile_linear_interpolation(...e){return this._percentile_linear_interpolation(this,...e)}percentile_nearest_rank(...e){return this._percentile_nearest_rank(this,...e)}percentrank(...e){return this._percentrank(this,...e)}pop(...e){return this._pop(this,...e)}push(...e){return this._push(this,...e)}range(...e){return this._range(this,...e)}remove(...e){return this._remove(this,...e)}reverse(...e){return this._reverse(this,...e)}set(...e){return this._set(this,...e)}shift(...e){return this._shift(this,...e)}size(...e){return this._size(this,...e)}slice(...e){return this._slice(this,...e)}some(...e){return this._some(this,...e)}sort(...e){return this._sort(this,...e)}sort_indices(...e){return this._sort_indices(this,...e)}standardize(...e){return this._standardize(this,...e)}stdev(...e){return this._stdev(this,...e)}sum(...e){return this._sum(this,...e)}unshift(...e){return this._unshift(this,...e)}variance(...e){return this._variance(this,...e)}}function no(t){return(...e)=>new W([...e],va(e),t)}function ao(t){return(e,i)=>{if(i===void 0){const r=e?Array(e).fill(0):[];return new W(r,H.any,t)}return new W(Array(e).fill(t.precision(i||0)),Re(i||0),t)}}function oo(t){return(e,i=!1)=>new W(Array(e).fill(i),H.bool,t)}function lo(t){return(e,i=NaN)=>new W(Array(e).fill(t.precision(i)),H.float,t)}function co(t){return(e,i=0)=>new W(Array(e).fill(t.precision(i)),H.int,t)}function ho(t){return(e,i="")=>new W(Array(e).fill(i),H.string,t)}class x{constructor(e,i=0){this.data=e,this.offset=i}get(e){const i=this.data.length-1-(this.offset+e);return i<0||i>=this.data.length?NaN:this.data[i]}set(e,i){const r=this.data.length-1-(this.offset+e);r>=0&&r<this.data.length&&(this.data[r]=i)}get length(){return this.data.length}toArray(){return this.data}static from(e){return e instanceof x?e:Array.isArray(e)?new x(e):new x([e])}}function uo(t){return(e,i=0)=>x.from(e).get(i)}class po{constructor(e){this.context=e,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=no(e),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=ao(e),this.new_bool=oo(e),this.new_float=lo(e),this.new_int=co(e),this.new_string=ho(e),this.param=uo(),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 fo(t){return e=>{e.map.clear()}}function mo(t){return(e,i)=>e.map.has(i)}function go(t){return e=>{const i=new _s(t);return i.map=new Map(e.map),i}}function xo(t){return(e,i)=>{const r=e.map.get(i);return r===void 0?NaN:r}}function yo(t){return e=>{const i=Array.from(e.map.keys()),r=Re(i[0]);return new W(i,r,t)}}function _o(t){return(e,i,r)=>{const s=e.map.get(i);return e.map.set(i,r),s===void 0?NaN:s}}function bo(t){return(e,i)=>{for(const[r,s]of i.map)e.map.set(r,s)}}function vo(t){return(e,i)=>{const r=e.map.get(i);return e.map.delete(i)?r:NaN}}function wo(t){return e=>e.map.size}function So(t){return e=>{const i=Array.from(e.map.values()),r=Re(i[0]);return new W(i,r,t)}}var Eo=Object.defineProperty,No=(t,e,i)=>e in t?Eo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ae=(t,e,i)=>No(t,typeof e!="symbol"?e+"":e,i);class _s{constructor(e){this.context=e,Ae(this,"map"),Ae(this,"_clear"),Ae(this,"_contains"),Ae(this,"_copy"),Ae(this,"_get"),Ae(this,"_keys"),Ae(this,"_put"),Ae(this,"_put_all"),Ae(this,"_remove"),Ae(this,"_size"),Ae(this,"_values"),this.map=new Map,this._clear=fo(this.context),this._contains=mo(this.context),this._copy=go(this.context),this._get=xo(this.context),this._keys=yo(this.context),this._put=_o(this.context),this._put_all=bo(this.context),this._remove=vo(this.context),this._size=wo(this.context),this._values=So(this.context)}toString(){return`PineMapObject(${this.map.size})`}clear(...e){return this._clear(this,...e)}contains(...e){return this._contains(this,...e)}copy(...e){return this._copy(this,...e)}get(...e){return this._get(this,...e)}keys(...e){return this._keys(this,...e)}put(...e){return this._put(this,...e)}put_all(...e){return this._put_all(this,...e)}remove(...e){return this._remove(this,...e)}size(...e){return this._size(this,...e)}values(...e){return this._values(this,...e)}}function Co(t){return()=>new _s(t)}function Io(t){return(e,i=0)=>x.from(e).get(i)}class ko{constructor(e){this.context=e,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=Co(e),this.param=Io(),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 Ao(t){return(e,i,r)=>{const s=e.matrix.length;let a=[];if(r&&(r instanceof W?a=r.array:Array.isArray(r)?a=r:a=[r]),s===0){for(let l=0;l<a.length;l++){let c=a[l];c instanceof x&&(c=c.get(0)),e.matrix.push([c])}return}const n=e.matrix[0].length,o=i!==void 0?i:n;for(let l=0;l<s;l++){let c=l<a.length?a[l]:NaN;c instanceof x&&(c=c.get(0)),e.matrix[l].splice(o,0,c)}}}function To(t){return(e,i,r)=>{const s=e.matrix.length;let a=[];if(r)if(r instanceof W)a=r.array;else if(Array.isArray(r))a=r;else if(r instanceof x){const c=r.get(0);Array.isArray(c)?a=c:a=[c]}else a=[r];const n=s>0?e.matrix[0].length:a.length,o=i!==void 0?i:s,l=[];for(let c=0;c<n;c++)if(c<a.length){let h=a[c];h instanceof x&&(h=h.get(0)),l.push(h)}else l.push(NaN);e.matrix.splice(o,0,l)}}function Po(t){return e=>{const i=e.matrix.length;if(i===0)return NaN;const r=e.matrix[0].length;if(r===0)return NaN;let s=0,a=0;for(let n=0;n<i;n++)for(let o=0;o<r;o++){const l=e.matrix[n][o];isNaN(l)||(s+=l,a++)}return a===0?NaN:s/a}}function Do(t){return(e,i)=>{const r=e.matrix.length,s=[];for(let n=0;n<r;n++)s.push(e.matrix[n][i]);const a=Re(s[0]);return new W(s,a,t)}}function Ro(t){return e=>e.matrix.length===0?0:e.matrix[0].length}function Oo(t){return(e,i)=>{const r=e.matrix.length,s=i.matrix.length;if(r===0){for(let o=0;o<s;o++)e.matrix.push([...i.matrix[o]]);return}const a=e.matrix[0].length,n=s>0?i.matrix[0].length:0;if(a!==n&&s>0){console.error(`matrix.concat: Column count mismatch ${a} vs ${n}`);return}for(let o=0;o<s;o++)e.matrix.push([...i.matrix[o]])}}function Vo(t){return e=>{const i=e.matrix.length,r=i>0?e.matrix[0].length:0,s=new F(i,r,NaN,t);return s.matrix=e.matrix.map(a=>[...a]),s}}function Mo(t){const e=t.length;if(e===0)return 0;if(e===1)return t[0][0];if(e===2)return t[0][0]*t[1][1]-t[0][1]*t[1][0];const i=t.map(s=>[...s]);let r=1;for(let s=0;s<e;s++){let a=s;for(;a<e&&i[a][s]===0;)a++;if(a===e)return 0;a!==s&&([i[s],i[a]]=[i[a],i[s]],r*=-1),r*=i[s][s];for(let n=s+1;n<e;n++){const o=i[n][s]/i[s][s];for(let l=s;l<e;l++)i[n][l]-=o*i[s][l]}}return r}function Lo(t){return e=>{const i=e.matrix.length,r=i>0?e.matrix[0].length:0;return i!==r?NaN:Mo(e.matrix)}}function jo(t){return(e,i)=>{const r=e.matrix.length;if(r===0)return new F(0,0,NaN,t);const s=e.matrix[0].length,a=new F(r,s,NaN,t);if(i instanceof F)for(let n=0;n<r;n++)for(let o=0;o<s;o++){const l=e.matrix[n][o],c=i.matrix[n]&&i.matrix[n][o]!==void 0?i.matrix[n][o]:NaN;a.matrix[n][o]=l-c}else{const n=i;for(let o=0;o<r;o++)for(let l=0;l<s;l++)a.matrix[o][l]=e.matrix[o][l]-n}return a}}function Bo(t){const e=t.length;if(e!==2)return Array(e).fill(NaN);const i=t[0][0],r=t[0][1],s=t[1][0],a=t[1][1],n=i+a,o=i*a-r*s,l=n*n-4*o;if(l<0)return[NaN,NaN];const c=(n+Math.sqrt(l))/2,h=(n-Math.sqrt(l))/2;return[c,h]}function Fo(t){return e=>{const i=e.matrix.length,r=i>0?e.matrix[0].length:0;if(i!==r){const n=Re(e.matrix[0][0]);return new W([],n,t)}const s=Bo(e.matrix),a=Re(s[0]);return new W(s,a,t)}}function $o(t){return e=>{const i=e.matrix.length,r=i>0?e.matrix[0].length:0;if(i!==r)return new F(0,0,NaN,t);const s=new F(i,r,0,t);for(let a=0;a<i;a++)s.matrix[a][a]=1;return s}}function Wo(t){return e=>{const i=e.matrix.length;return i===0?0:i*e.matrix[0].length}}function Uo(t){return(e,i,r,s,a,n)=>{const o=e.matrix.length;if(o===0)return;const l=e.matrix[0].length,c=r!==void 0?r:0,h=s!==void 0?s:o,p=a!==void 0?a:0,u=n!==void 0?n:l;for(let f=c;f<h&&!(f>=o);f++)for(let m=p;m<u&&!(m>=l);m++)e.matrix[f][m]=i}}function qo(t){return(e,i,r)=>{if(!e.matrix[i])return NaN;const s=e.matrix[i][r];return s===void 0?NaN:s}}function Ko(t){if(t.length!==2)return t.map(i=>i.map(()=>NaN));const e=t[0][0]*t[1][1]-t[0][1]*t[1][0];return e===0?[[NaN,NaN],[NaN,NaN]]:[[t[1][1]/e,-t[0][1]/e],[-t[1][0]/e,t[0][0]/e]]}function zo(t){return e=>{const i=e.matrix.length,r=i>0?e.matrix[0].length:0;if(i!==r)return new F(i,r,NaN,t);const s=Ko(e.matrix),a=new F(i,r,NaN,t);return a.matrix=s,a}}function Ho(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let a=0;a<r;a++)if(s+a!==i-1&&e.matrix[s][a]!==0)return!1;return!0}}function Go(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let a=0;a<r;a++)if(e.matrix[a][s]!==-e.matrix[s][a])return!1;return!0}}function Yo(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;for(let s=0;s<i;s++)for(let a=0;a<r;a++){const n=e.matrix[s][a];if(n!==0&&n!==1)return!1}return!0}}function Qo(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let a=0;a<r;a++)if(s!==a&&e.matrix[s][a]!==0)return!1;return!0}}function Xo(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let a=0;a<r;a++)if(s===a){if(e.matrix[s][a]!==1)return!1}else if(e.matrix[s][a]!==0)return!1;return!0}}function Zo(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;return i===r}}function Jo(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;for(let s=0;s<i;s++){let a=0;for(let n=0;n<r;n++){const o=e.matrix[s][n];if(o<0)return!1;a+=o}if(Math.abs(a-1)>1e-10)return!1}return!0}}function el(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let a=0;a<s;a++)if(e.matrix[s][a]!==e.matrix[a][s])return!1;return!0}}function tl(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;let s=!0,a=!0;for(let n=0;n<i;n++)for(let o=0;o<r;o++)n>o&&e.matrix[n][o]!==0&&(s=!1),n<o&&e.matrix[n][o]!==0&&(a=!1);return s||a}}function il(t){return e=>{const i=e.matrix.length;if(i===0)return!0;const r=e.matrix[0].length;for(let s=0;s<i;s++)for(let a=0;a<r;a++)if(e.matrix[s][a]!==0)return!1;return!0}}function rl(t){return(e,i)=>{const r=e.matrix.length,s=r>0?e.matrix[0].length:0,a=i.matrix.length,n=a>0?i.matrix[0].length:0,o=r*a,l=s*n,c=new F(o,l,NaN,t);for(let h=0;h<r;h++)for(let p=0;p<s;p++){const u=e.matrix[h][p];for(let f=0;f<a;f++)for(let m=0;m<n;m++){const y=i.matrix[f][m];c.matrix[h*a+f][p*n+m]=u*y}}return c}}function sl(t){return e=>{const i=e.matrix.length;if(i===0)return NaN;const r=e.matrix[0].length;let s=-1/0,a=!1;for(let n=0;n<i;n++)for(let o=0;o<r;o++){const l=e.matrix[n][o];isNaN(l)||(l>s&&(s=l),a=!0)}return a?s:NaN}}function nl(t){return e=>{const i=e.matrix.length;if(i===0)return NaN;const r=e.matrix[0].length,s=[];for(let n=0;n<i;n++)for(let o=0;o<r;o++){const l=e.matrix[n][o];isNaN(l)||s.push(l)}if(s.length===0)return NaN;s.sort((n,o)=>n-o);const a=Math.floor(s.length/2);return s.length%2!==0?s[a]:(s[a-1]+s[a])/2}}function al(t){return e=>{const i=e.matrix.length;if(i===0)return NaN;const r=e.matrix[0].length;let s=1/0,a=!1;for(let n=0;n<i;n++)for(let o=0;o<r;o++){const l=e.matrix[n][o];isNaN(l)||(l<s&&(s=l),a=!0)}return a?s:NaN}}function ol(t){return e=>{const i=e.matrix.length;if(i===0)return NaN;const r=e.matrix[0].length,s=new Map;let a=0,n=NaN;for(let o=0;o<i;o++)for(let l=0;l<r;l++){const c=e.matrix[o][l];if(!isNaN(c)){const h=(s.get(c)||0)+1;s.set(c,h),h>a?(a=h,n=c):h===a&&c<n&&(n=c)}}return n}}function ll(t){return(e,i)=>{const r=e.matrix.length,s=r>0?e.matrix[0].length:0;if(i instanceof F){const a=i.matrix.length,n=a>0?i.matrix[0].length:0;if(s!==a)return new F(0,0,NaN,t);const o=new F(r,n,0,t);for(let l=0;l<r;l++)for(let c=0;c<n;c++){let h=0;for(let p=0;p<s;p++)h+=e.matrix[l][p]*i.matrix[p][c];o.matrix[l][c]=h}return o}else if(i instanceof W||Array.isArray(i.array||i)){const a=i.array||i;if(s!==a.length)return new F(0,0,NaN,t);const n=new F(r,1,0,t);for(let o=0;o<r;o++){let l=0;for(let c=0;c<s;c++)l+=e.matrix[o][c]*a[c];n.matrix[o][0]=l}return n}else{const a=i,n=new F(r,s,NaN,t);for(let o=0;o<r;o++)for(let l=0;l<s;l++)n.matrix[o][l]=e.matrix[o][l]*a;return n}}}function cl(t){return e=>{const i=e.matrix.length,r=i>0?e.matrix[0].length:0;return i===r?new F(i,r,NaN,t):new F(r,i,NaN,t)}}function hl(t){return(e,i)=>{const r=e.matrix.length,s=r>0?e.matrix[0].length:0;if(r!==s)return new F(0,0,NaN,t);let a=new F(r,s,0,t);for(let l=0;l<r;l++)a.matrix[l][l]=1;let n=new F(r,s,NaN,t);for(let l=0;l<r;l++)n.matrix[l]=[...e.matrix[l]];let o=Math.floor(i);if(o<0)return new F(r,s,NaN,t);for(;o>0;){if(o%2===1){const c=new F(r,s,0,t);for(let h=0;h<r;h++)for(let p=0;p<s;p++){let u=0;for(let f=0;f<r;f++)u+=a.matrix[h][f]*n.matrix[f][p];c.matrix[h][p]=u}a=c}const l=new F(r,s,0,t);for(let c=0;c<r;c++)for(let h=0;h<s;h++){let p=0;for(let u=0;u<r;u++)p+=n.matrix[c][u]*n.matrix[u][h];l.matrix[c][h]=p}n=l,o=Math.floor(o/2)}return a}}function ul(t){return e=>{const i=e.matrix.length;if(i===0)return 0;const r=e.matrix[0].length,s=e.matrix.map(n=>[...n]);let a=0;for(let n=0;n<r&&a<i;n++){let o=a;for(;o<i&&Math.abs(s[o][n])<1e-10;)o++;if(o<i){[s[a],s[o]]=[s[o],s[a]];const l=s[a][n];for(let c=n;c<r;c++)s[a][c]/=l;for(let c=0;c<i;c++)if(c!==a){const h=s[c][n];for(let p=n;p<r;p++)s[c][p]-=h*s[a][p]}a++}}return a}}function pl(t){return(e,i)=>{const r=e.matrix.length;if(r===0){const n=Re(e.matrix[0][0]);return new W([],n,t)}const s=[];for(let n=0;n<r;n++){const o=e.matrix[n].splice(i,1);s.push(o[0])}const a=Re(s[0]);return new W(s,a,t)}}function fl(t){return(e,i)=>{const r=e.matrix.splice(i,1),s=Re(r[0][0]);return new W(r[0]||[],s,t)}}function dl(t){return(e,i,r)=>{const s=e.matrix.length,a=s>0?e.matrix[0].length:0,n=i*r,o=[];for(let h=0;h<s;h++)for(let p=0;p<a;p++)o.push(e.matrix[h][p]);for(;o.length<n;)o.push(NaN);o.length>n&&(o.length=n);const l=[];let c=0;for(let h=0;h<i;h++){const p=[];for(let u=0;u<r;u++)p.push(o[c++]);l.push(p)}e.matrix=l}}function ml(t){return e=>{e.matrix.reverse();for(const i of e.matrix)i.reverse()}}function gl(t){return(e,i)=>{if(!e.matrix[i]){const s=Re(e.matrix[0][0]);return new W([],s,t)}const r=Re(e.matrix[i][0]);return new W([...e.matrix[i]],r,t)}}function xl(t){return e=>e.matrix.length}function yl(t){return(e,i,r,s)=>{e.matrix[i]&&(e.matrix[i][r]=s)}}function _l(t){return(e,i=0,r="asc")=>{e.matrix.length!==0&&e.matrix.sort((s,a)=>{const n=s[i],o=a[i];return n<o?r==="asc"?-1:1:n>o?r==="asc"?1:-1:0})}}function bl(t){return(e,i,r,s,a)=>{const n=r-i,o=a-s,l=new F(n,o,NaN,t);for(let c=0;c<n;c++){const h=i+c;if(h>=e.matrix.length)break;for(let p=0;p<o;p++){const u=s+p;if(u>=e.matrix[h].length)break;l.matrix[c][p]=e.matrix[h][u]}}return l}}function vl(t){return(e,i)=>{const r=e.matrix.length;if(r===0)return new F(0,0,NaN,t);const s=e.matrix[0].length,a=new F(r,s,NaN,t);if(i instanceof F)for(let n=0;n<r;n++)for(let o=0;o<s;o++){const l=e.matrix[n][o],c=i.matrix[n]&&i.matrix[n][o]!==void 0?i.matrix[n][o]:NaN;a.matrix[n][o]=l+c}else{const n=i;for(let o=0;o<r;o++)for(let l=0;l<s;l++)a.matrix[o][l]=e.matrix[o][l]+n}return a}}function wl(t){return(e,i,r)=>{const s=e.matrix.length;for(let a=0;a<s;a++){const n=e.matrix[a][i];e.matrix[a][i]=e.matrix[a][r],e.matrix[a][r]=n}}}function Sl(t){return(e,i,r)=>{const s=e.matrix[i];e.matrix[i]=e.matrix[r],e.matrix[r]=s}}function El(t){return e=>{const i=e.matrix.length;if(i===0)return 0;const r=e.matrix[0].length,s=Math.min(i,r);let a=0;for(let n=0;n<s;n++)a+=e.matrix[n][n];return a}}function Nl(t){return e=>{const i=e.matrix.length;if(i===0)return new F(0,0,NaN,t);const r=e.matrix[0].length,s=new F(r,i,NaN,t);for(let a=0;a<i;a++)for(let n=0;n<r;n++)s.matrix[n][a]=e.matrix[a][n];return s}}var Cl=Object.defineProperty,Il=(t,e,i)=>e in t?Cl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,T=(t,e,i)=>Il(t,typeof e!="symbol"?e+"":e,i);class F{constructor(e=0,i=0,r=NaN,s){if(this.context=s,T(this,"matrix"),T(this,"_add_col"),T(this,"_add_row"),T(this,"_avg"),T(this,"_col"),T(this,"_columns"),T(this,"_concat"),T(this,"_copy"),T(this,"_det"),T(this,"_diff"),T(this,"_eigenvalues"),T(this,"_eigenvectors"),T(this,"_elements_count"),T(this,"_fill"),T(this,"_get"),T(this,"_inv"),T(this,"_is_antidiagonal"),T(this,"_is_antisymmetric"),T(this,"_is_binary"),T(this,"_is_diagonal"),T(this,"_is_identity"),T(this,"_is_square"),T(this,"_is_stochastic"),T(this,"_is_symmetric"),T(this,"_is_triangular"),T(this,"_is_zero"),T(this,"_kron"),T(this,"_max"),T(this,"_median"),T(this,"_min"),T(this,"_mode"),T(this,"_mult"),T(this,"_pinv"),T(this,"_pow"),T(this,"_rank"),T(this,"_remove_col"),T(this,"_remove_row"),T(this,"_reshape"),T(this,"_reverse"),T(this,"_row"),T(this,"_rows"),T(this,"_set"),T(this,"_sort"),T(this,"_submatrix"),T(this,"_sum"),T(this,"_swap_columns"),T(this,"_swap_rows"),T(this,"_trace"),T(this,"_transpose"),this.matrix=[],e>0&&i>0)for(let a=0;a<e;a++)this.matrix.push(Array(i).fill(r));this._add_col=Ao(this.context),this._add_row=To(this.context),this._avg=Po(this.context),this._col=Do(this.context),this._columns=Ro(this.context),this._concat=Oo(this.context),this._copy=Vo(this.context),this._det=Lo(this.context),this._diff=jo(this.context),this._eigenvalues=Fo(this.context),this._eigenvectors=$o(this.context),this._elements_count=Wo(this.context),this._fill=Uo(this.context),this._get=qo(this.context),this._inv=zo(this.context),this._is_antidiagonal=Ho(this.context),this._is_antisymmetric=Go(this.context),this._is_binary=Yo(this.context),this._is_diagonal=Qo(this.context),this._is_identity=Xo(this.context),this._is_square=Zo(this.context),this._is_stochastic=Jo(this.context),this._is_symmetric=el(this.context),this._is_triangular=tl(this.context),this._is_zero=il(this.context),this._kron=rl(this.context),this._max=sl(this.context),this._median=nl(this.context),this._min=al(this.context),this._mode=ol(this.context),this._mult=ll(this.context),this._pinv=cl(this.context),this._pow=hl(this.context),this._rank=ul(this.context),this._remove_col=pl(this.context),this._remove_row=fl(this.context),this._reshape=dl(this.context),this._reverse=ml(this.context),this._row=gl(this.context),this._rows=xl(this.context),this._set=yl(this.context),this._sort=_l(this.context),this._submatrix=bl(this.context),this._sum=vl(this.context),this._swap_columns=wl(this.context),this._swap_rows=Sl(this.context),this._trace=El(this.context),this._transpose=Nl(this.context)}toString(){let e="";for(let i=0;i<this.matrix.length;i++)e+=e===""?"":`
|
|
137
|
-
`,e+="["+this.matrix[i].join(", ")+"]";return e}add_col(...e){return this._add_col(this,...e)}add_row(...e){return this._add_row(this,...e)}avg(...e){return this._avg(this,...e)}col(...e){return this._col(this,...e)}columns(...e){return this._columns(this,...e)}concat(...e){return this._concat(this,...e)}copy(...e){return this._copy(this,...e)}det(...e){return this._det(this,...e)}diff(...e){return this._diff(this,...e)}eigenvalues(...e){return this._eigenvalues(this,...e)}eigenvectors(...e){return this._eigenvectors(this,...e)}elements_count(...e){return this._elements_count(this,...e)}fill(...e){return this._fill(this,...e)}get(...e){return this._get(this,...e)}inv(...e){return this._inv(this,...e)}is_antidiagonal(...e){return this._is_antidiagonal(this,...e)}is_antisymmetric(...e){return this._is_antisymmetric(this,...e)}is_binary(...e){return this._is_binary(this,...e)}is_diagonal(...e){return this._is_diagonal(this,...e)}is_identity(...e){return this._is_identity(this,...e)}is_square(...e){return this._is_square(this,...e)}is_stochastic(...e){return this._is_stochastic(this,...e)}is_symmetric(...e){return this._is_symmetric(this,...e)}is_triangular(...e){return this._is_triangular(this,...e)}is_zero(...e){return this._is_zero(this,...e)}kron(...e){return this._kron(this,...e)}max(...e){return this._max(this,...e)}median(...e){return this._median(this,...e)}min(...e){return this._min(this,...e)}mode(...e){return this._mode(this,...e)}mult(...e){return this._mult(this,...e)}pinv(...e){return this._pinv(this,...e)}pow(...e){return this._pow(this,...e)}rank(...e){return this._rank(this,...e)}remove_col(...e){return this._remove_col(this,...e)}remove_row(...e){return this._remove_row(this,...e)}reshape(...e){return this._reshape(this,...e)}reverse(...e){return this._reverse(this,...e)}row(...e){return this._row(this,...e)}rows(...e){return this._rows(this,...e)}set(...e){return this._set(this,...e)}sort(...e){return this._sort(this,...e)}submatrix(...e){return this._submatrix(this,...e)}sum(...e){return this._sum(this,...e)}swap_columns(...e){return this._swap_columns(this,...e)}swap_rows(...e){return this._swap_rows(this,...e)}trace(...e){return this._trace(this,...e)}transpose(...e){return this._transpose(this,...e)}}function kl(t){return(e,i,r)=>new F(e,i,r,t)}function Al(t){return(e,i=0)=>x.from(e).get(i)}class Tl{constructor(e){this.context=e,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=kl(e),this.param=Al(),this.pinv=(i,...r)=>i.pinv(...r),this.pow=(i,...r)=>i.pow(...r),this.rank=(i,...r)=>i.rank(...r),this.remove_col=(i,...r)=>i.remove_col(...r),this.remove_row=(i,...r)=>i.remove_row(...r),this.reshape=(i,...r)=>i.reshape(...r),this.reverse=(i,...r)=>i.reverse(...r),this.row=(i,...r)=>i.row(...r),this.rows=(i,...r)=>i.rows(...r),this.set=(i,...r)=>i.set(...r),this.sort=(i,...r)=>i.sort(...r),this.submatrix=(i,...r)=>i.submatrix(...r),this.sum=(i,...r)=>i.sum(...r),this.swap_columns=(i,...r)=>i.swap_columns(...r),this.swap_rows=(i,...r)=>i.swap_rows(...r),this.trace=(i,...r)=>i.trace(...r),this.transpose=(i,...r)=>i.transpose(...r)}}var Pl=Object.defineProperty,Dl=(t,e,i)=>e in t?Pl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Rl=(t,e,i)=>Dl(t,typeof e!="symbol"?e+"":e,i);class Ol{constructor(e){this.context=e,Rl(this,"_live",!1)}setLive(){this._live=!0}get isnew(){return!this._live}get islast(){return this.context.idx===this.context.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()}}class Vt{constructor(e,i){this._definition=e,this.context=i;for(let r in e)this[r]=e[r]}get __def__(){return this._definition}copy(){return new Vt(this.__def__,this.context)}toString(){const e={};for(let i in this.__def__){const r=this[i];r!=null&&typeof r=="object"&&typeof r.toString=="function"&&!(r instanceof Array)?e[i]=r.toString():e[i]=r}try{return JSON.stringify(e)}catch{return"{"+Object.keys(e).map(i=>`"${i}":${String(e[i])}`).join(",")+"}"}}}var Vl=Object.defineProperty,Ml=(t,e,i)=>e in t?Vl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Zt=(t,e,i)=>Ml(t,typeof e!="symbol"?e+"":e,i);class me{constructor(e,i,r){Zt(this,"time"),Zt(this,"index"),Zt(this,"price"),this.time=e,this.index=i,this.price=r}copy(){return new me(this.time,this.index,this.price)}toString(){return JSON.stringify({time:this.time,index:this.index,price:this.price})}}function Ll(t){return typeof t=="object"&&t&&(t.title!==void 0||t._plotKey!==void 0)&&t.data!==void 0&&t.options!==void 0}const Gi={series:t=>t instanceof x||typeof t=="number"||typeof t=="string"||typeof t=="boolean",string:t=>typeof t=="string",number:t=>typeof t=="number",boolean:t=>typeof t=="boolean",array:t=>Array.isArray(t),object:t=>typeof t=="object",point:t=>t instanceof me,primitive:t=>typeof t===null||typeof t!="object"&&typeof t!="function",function:t=>typeof t=="function",undefined:t=>t===void 0,null:t=>t===null,NaN:t=>isNaN(t),remaining_options:t=>typeof t=="object"&&!(t instanceof x)&&!(t instanceof me)&&!Ll(t)};function Me(t){const e=t[t.length-1];if(e&&typeof e=="object"&&"__callsiteId"in e)return t.pop().__callsiteId}function te(t,e,i,r){Array.isArray(e)&&typeof e[0]=="string"&&(e=[e]);const s={};let a={};const n=new Array(e.length).fill(!0);for(let o=0;o<t.length;o++){const l=t[o];if(Gi.remaining_options(l)){a=l;break}const c=e.map((h,p)=>n[p]?h[o]:void 0);for(let h=0;h<c.length;h++){const p=c[h];if(p===void 0){n[h]=!1;continue}const u=Gi[i[p]];typeof u=="function"&&u(l)?s[p]=l:n[h]=!1}}return{...a,...s,...r}}var jl=Object.defineProperty,Bl=(t,e,i)=>e in t?jl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Fl=(t,e,i)=>Bl(t,typeof e!="symbol"?e+"":e,i);const $l=[["dateString"],["year","month","day","hour","minute","second"],["timezone","year","month","day","hour","minute","second"]],Wl={dateString:"string",timezone:"string",year:"number",month:"number",day:"number",hour:"number",minute:"number",second:"number"},Ul=["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"],ql={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 Yi(t){if(!t||typeof t!="string")return null;if(t.startsWith("#")){const i=t.slice(1);return i.length===6?[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),1]:i.length===8?[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),parseInt(i.slice(6,8),16)/255]:null}const e=t.match(/rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\s*\)/);return e?[parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),e[4]?parseFloat(e[4]):1]:null}function Kl(t,e,i,r){const s=Math.round(Math.max(0,Math.min(255,t))).toString(16).padStart(2,"0"),a=Math.round(Math.max(0,Math.min(255,e))).toString(16).padStart(2,"0"),n=Math.round(Math.max(0,Math.min(255,i))).toString(16).padStart(2,"0");if(r>=1)return`#${s}${a}${n}`.toUpperCase();const o=Math.round(Math.max(0,Math.min(255,r*255))).toString(16).padStart(2,"0");return`#${s}${a}${n}${o}`.toUpperCase()}const J={aqua:"#00BCD4",black:"#363A45",blue:"#2196F3",fuchsia:"#E040FB",gray:"#787B86",green:"#4CAF50",lime:"#00E676",maroon:"#880E4F",navy:"#311B92",olive:"#808000",orange:"#FF9800",purple:"#9C27B0",red:"#F23645",silver:"#B2B5BE",teal:"#089981",white:"#FFFFFF",yellow:"#FDD835"};function zl(t){return te(t,Ul,ql)}class Hl{get __value(){return NaN}param(e,i=0){return x.from(e).get(i)}any(e){const i=x.from(e).get(0);return i==null?!0:typeof i=="number"?i!==i:!1}}class Gl{constructor(e){this.context=e,Fl(this,"color",{param:(i,r=0)=>x.from(i).get(r),rgb:(i,r,s,a)=>a?`rgba(${i}, ${r}, ${s}, ${(100-a)/100})`:`rgb(${i}, ${r}, ${s})`,new:(i,r)=>{if(typeof i=="function"&&(i=i()),i&&typeof i=="object"&&Array.isArray(i.data)&&typeof i.get=="function"&&(i=i.get(0)),!i||typeof i!="string")return i;if(i.startsWith("#")){const s=i.slice(1);return r?`#${s}${Math.round(255/100*(100-r)).toString(16).padStart(2,"0").toUpperCase()}`:`#${s}`}else{const s=J[i];return s?r?`#${s}${Math.round(255/100*(100-r)).toString(16).padStart(2,"0").toUpperCase()}`:`#${s}`:r?`rgba(${i}, ${(100-r)/100})`:i}},from_gradient:(i,r,s,a,n)=>{typeof i=="function"&&(i=i()),typeof r=="function"&&(r=r()),typeof s=="function"&&(s=s()),typeof a=="function"&&(a=a()),typeof n=="function"&&(n=n()),i&&typeof i=="object"&&typeof i.get=="function"&&(i=i.get(0)),r&&typeof r=="object"&&typeof r.get=="function"&&(r=r.get(0)),s&&typeof s=="object"&&typeof s.get=="function"&&(s=s.get(0)),a&&typeof a=="object"&&typeof a.get=="function"&&(a=a.get(0)),n&&typeof n=="object"&&typeof n.get=="function"&&(n=n.get(0));let o=0;s!==r&&(o=(i-r)/(s-r)),o=Math.max(0,Math.min(1,o));const l=Yi(typeof a=="string"?a:"#000000")||[0,0,0,1],c=Yi(typeof n=="string"?n:"#FFFFFF")||[255,255,255,1],h=l[0]+(c[0]-l[0])*o,p=l[1]+(c[1]-l[1])*o,u=l[2]+(c[2]-l[2])*o,f=l[3]+(c[3]-l[3])*o;return Kl(h,p,u,f)},aqua:J.aqua,black:J.black,blue:J.blue,fuchsia:J.fuchsia,gray:J.gray,green:J.green,lime:J.lime,maroon:J.maroon,navy:J.navy,olive:J.olive,orange:J.orange,purple:J.purple,red:J.red,silver:J.silver,teal:J.teal,white:J.white,yellow:J.yellow})}extractPlotOptions(e){const i={};for(let r in e)i[r]=x.from(e[r]).get(0);return i}indicator(...e){const i=zl(e),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(e){return isNaN(x.from(e).get(0))}nz(e,i=0){const r=x.from(e).get(0),s=x.from(i).get(0);return isNaN(r)?s:r}fixnan(e){const i=x.from(e);for(let r=0;r<i.length;r++){const s=i.get(r);if(!isNaN(s))return s}return NaN}alertcondition(e,i,r){}timestamp(...e){const i=e.map(s=>s instanceof x?s.get(0):s),r=te(i,$l,Wl);if(r.year!==void 0){const s=r.year,a=r.month,n=r.day,o=r.hour||0,l=r.minute||0,c=r.second||0,h=r.timezone||this.context.pine?.syminfo?.timezone||"UTC";return this._timestampFromComponents(h,s,a,n,o,l,c)}return r.dateString!==void 0?new Date(r.dateString).getTime():NaN}_timestampFromComponents(e,i,r,s,a,n,o){const l=new Date(Date.UTC(i,r-1,s,a,n,o));i>=0&&i<100&&l.setUTCFullYear(i);const c=e.trim();if(c==="UTC"||c==="GMT")return l.getTime();const h=c.match(/^(?:UTC|GMT)([+-])(\d{1,2})(?::(\d{2}))?$/i);if(h){const p=h[1]==="+"?1:-1,u=parseInt(h[2],10),f=parseInt(h[3]||"0",10),m=p*(u*60+f)*60*1e3;return l.getTime()-m}try{return this._timestampFromIANA(e,i,r,s,a,n,o)}catch{return l.getTime()}}_timestampFromIANA(e,i,r,s,a,n,o){const l=new Date(Date.UTC(i,r-1,s,a,n,o));i>=0&&i<100&&l.setUTCFullYear(i);const c=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}).formatToParts(l),h=v=>parseInt(c.find(E=>E.type===v)?.value||"0",10),p=h("year"),u=h("month"),f=h("day");let m=h("hour");m===24&&(m=0);const y=h("minute"),_=h("second"),b=new Date(Date.UTC(p,u-1,f,m,y,_));p>=0&&p<100&&b.setUTCFullYear(p);const S=b.getTime()-l.getTime();return l.getTime()-S}bool(e){const i=x.from(e).get(0);return!isNaN(i)&&i!==0}int(e){const i=x.from(e).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.trunc(i)}float(e){const i=x.from(e).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(e){return x.from(e).get(0).toString()}Type(e){const i=Object.keys(e),r={};for(const s of i){let a=e[s];a instanceof x&&(a=a.data),Array.isArray(a)&&(a[0],r[s]=a[1])}return{new:function(...s){const a={};for(let n=0;n<i.length;n++){const o=i[n];n<s.length?a[o]=s[n]:o in r&&(a[o]=x.from(r[o]).get(0))}return new Vt(a,this.context)},copy:function(s){return new Vt(s.__def__,this.context)}}}}var Yl=Object.defineProperty,Ql=(t,e,i)=>e in t?Yl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Mt=(t,e,i)=>Ql(t,typeof e!="symbol"?e+"":e,i);function Lt(t,e){const i=e.trim();if(i==="UTC"||i==="GMT"){const s=new Date(t);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),hour:s.getUTCHours(),minute:s.getUTCMinutes(),second:s.getUTCSeconds(),dayOfWeek:s.getUTCDay()}}const r=i.match(/^(?:UTC|GMT)([+-])(\d{1,2})(?::(\d{2}))?$/i);if(r){const s=r[1]==="+"?1:-1,a=parseInt(r[2],10),n=parseInt(r[3]||"0",10),o=s*(a*60+n)*60*1e3,l=new Date(t+o);return{year:l.getUTCFullYear(),month:l.getUTCMonth()+1,day:l.getUTCDate(),hour:l.getUTCHours(),minute:l.getUTCMinutes(),second:l.getUTCSeconds(),dayOfWeek:l.getUTCDay()}}try{const s=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",weekday:"short",hour12:!1}).formatToParts(new Date(t)),a=c=>parseInt(s.find(h=>h.type===c)?.value||"0",10);let n=a("hour");n===24&&(n=0);const o=s.find(c=>c.type==="weekday")?.value||"Sun",l={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return{year:a("year"),month:a("month"),day:a("day"),hour:n,minute:a("minute"),second:a("second"),dayOfWeek:l[o]??0}}catch{const s=new Date(t);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),hour:s.getUTCHours(),minute:s.getUTCMinutes(),second:s.getUTCSeconds(),dayOfWeek:s.getUTCDay()}}}function Xl(t,e,i){const r=new Date(Date.UTC(t,e-1,i)),s=r.getUTCDay()||7;r.setUTCDate(r.getUTCDate()+4-s);const a=new Date(Date.UTC(r.getUTCFullYear(),0,1));return Math.ceil(((r.getTime()-a.getTime())/864e5+1)/7)}const Zl=[["timeframe"],["timeframe","bars_back"],["timeframe","session","bars_back"],["timeframe","session","bars_back","timeframe_bars_back"],["timeframe","session","timezone","bars_back","timeframe_bars_back"]],Jl={timeframe:"string",session:"string",timezone:"string",bars_back:"number",timeframe_bars_back:"number"};class Qi{constructor(e,i="openTime"){Mt(this,"context"),Mt(this,"dataField"),this.context=e,this.dataField=i}get __value(){return this.context.data[this.dataField]}param(e,i=0){return x.from(e).get(i)}any(...e){const i=e.map(c=>c instanceof x?c.get(0):c),r=te(i,Zl,Jl),s=r.bars_back??0,a=r.timeframe_bars_back??0,n=s+a,o=this.context.data[this.dataField],l=x.from(o).get(n);if(r.session!==void 0){const c=r.timezone||this.context.pine?.syminfo?.timezone||"UTC";return this._isInSession(l,r.session,c)?l:NaN}return l}_isInSession(e,i,r){const s=i.match(/^(\d{2})(\d{2})-(\d{2})(\d{2})$/);if(!s)return!0;const a=parseInt(s[1],10),n=parseInt(s[2],10),o=parseInt(s[3],10),l=parseInt(s[4],10),c=Lt(e,r),h=c.hour,p=c.minute,u=h*60+p,f=a*60+n,m=o*60+l;return f<=m?u>=f&&u<m:u>=f||u<m}}const ec=[[],["time"],["time","timezone"]],tc={time:"number",timezone:"string"};class Xe{constructor(e,i){Mt(this,"context"),Mt(this,"extractor"),this.context=e,this.extractor=i}get __value(){const e=x.from(this.context.data.openTime).get(0);if(isNaN(e))return NaN;const i=this.context.pine?.syminfo?.timezone||"UTC",r=Lt(e,i);return this.extractor(r)}param(e,i=0){return x.from(e).get(i)}any(...e){const i=e.map(o=>o instanceof x?o.get(0):o);if(i.length===0)return this.__value;const r=te(i,ec,tc),s=r.time;if(s===void 0||isNaN(s))return NaN;const a=r.timezone||this.context.pine?.syminfo?.timezone||"UTC",n=Lt(s,a);return this.extractor(n)}}const Ze={dayofmonth:t=>t.day,dayofweek:t=>t.dayOfWeek===0?1:t.dayOfWeek+1,hour:t=>t.hour,minute:t=>t.minute,month:t=>t.month,second:t=>t.second,weekofyear:t=>Xl(t.year,t.month,t.day),year:t=>t.year},ic=[["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"]],rc={defval:"primitive",title:"string",tooltip:"string",inline:"string",group:"string",display:"string",confirm:"boolean",options:"array",minval:"number",maxval:"number",step:"number"};function xe(t){return te(t,ic,rc)}function ke(t,e){return e.title&&t.inputs&&t.inputs[e.title]!==void 0?t.inputs[e.title]:e.defval}function sc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function nc(t){return(...e)=>xe(e).defval}function ac(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function oc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function lc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function cc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function hc(t){return(e,i=0)=>x.from(e).get(i)}function uc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function pc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function fc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function dc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function mc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function gc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function xc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function yc(t){return(...e)=>xe(e).defval}var _c=Object.defineProperty,bc=(t,e,i)=>e in t?_c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ce=(t,e,i)=>bc(t,typeof e!="symbol"?e+"":e,i);const vc={any:sc,bool:nc,color:ac,enum:oc,float:lc,int:cc,param:hc,price:uc,session:pc,source:fc,string:dc,symbol:mc,text_area:gc,time:xc,timeframe:yc};class wc{constructor(e){this.context=e,ce(this,"any"),ce(this,"bool"),ce(this,"color"),ce(this,"enum"),ce(this,"float"),ce(this,"int"),ce(this,"param"),ce(this,"price"),ce(this,"session"),ce(this,"source"),ce(this,"string"),ce(this,"symbol"),ce(this,"text_area"),ce(this,"time"),ce(this,"timeframe"),Object.entries(vc).forEach(([i,r])=>{this[i]=r(e)})}}function Sc(t){return e=>Math.abs(x.from(e).get(0))}function Ec(t){return e=>Math.acos(x.from(e).get(0))}function Nc(t){return e=>Math.asin(x.from(e).get(0))}function Cc(t){return e=>Math.atan(x.from(e).get(0))}function Ic(t){return(...e)=>{const i=e.map(r=>x.from(r).get(0));return i.reduce((r,s)=>r+s,0)/i.length}}function kc(t){return e=>Math.ceil(x.from(e).get(0))}function Ac(t){return e=>Math.cos(x.from(e).get(0))}function Tc(t){return()=>Math.E}function Pc(t){return e=>Math.exp(x.from(e).get(0))}function Dc(t){return e=>Math.floor(x.from(e).get(0))}function Rc(t){return e=>Math.log(x.from(e).get(0))}function Oc(t){return e=>Math.log(x.from(e).get(0))}function Vc(t){return e=>Math.log10(x.from(e).get(0))}function Mc(t){return(...e)=>{const i=e.map(r=>x.from(r).get(0));return Math.max(...i)}}function Lc(t){return(...e)=>{const i=e.map(r=>x.from(r).get(0));return Math.min(...i)}}function jc(t){return(e,i,r)=>typeof e=="string"?e:e instanceof x?i?new x(e.data,e.offset+i):e:!Array.isArray(e)&&typeof e=="object"?e:(t.params[r]||(t.params[r]=[]),Array.isArray(e)?new x(e,i||0):(t.params[r].length===0?t.params[r].push(e):t.params[r][t.params[r].length-1]=e,new x(t.params[r],i||0)))}function Bc(t){return()=>1.618033988749895}function Fc(t){return()=>Math.PI}function $c(t){return(e,i)=>Math.pow(x.from(e).get(0),x.from(i).get(0))}function Wc(t){return()=>Math.random()}function Jt(t){return t!==t?NaN:Math.sign(t)*Math.round(Math.abs(t))}function Uc(t){return(e,i)=>{const r=x.from(e).get(0);if(i==null)return Jt(r);const s=x.from(i).get(0);if(s===0)return Jt(r);const a=Math.pow(10,s);return Jt(r*a)/a}}function qc(t){return e=>t.precision(Math.round(x.from(e).get(0)/t.pine.syminfo.mintick)*t.pine.syminfo.mintick)}function Kc(t){return()=>.6180339887498948}function zc(t){return e=>Math.sign(x.from(e).get(0))}function Hc(t){return e=>Math.sin(x.from(e).get(0))}function Gc(t){return e=>Math.sqrt(x.from(e).get(0))}function Yc(t){return(e,i)=>{const r=x.from(i).get(0),s=x.from(e);let a=0;for(let n=0;n<r;n++){const o=s.get(n);a+=o}return a}}function Qc(t){return e=>Math.tan(x.from(e).get(0))}function Xc(t){return e=>{const i=x.from(e).get(0);return i==null||Number.isNaN(i)?NaN:i*(180/Math.PI)}}function Zc(t){return e=>{const i=x.from(e).get(0);return i==null||Number.isNaN(i)?NaN:i*(Math.PI/180)}}function Jc(t){return(e,i)=>{const r=x.from(e).get(0),s=x.from(i).get(0);return typeof r=="number"&&typeof s=="number"?isNaN(r)||isNaN(s)?!1:Math.abs(r-s)<1e-8:r===s}}var eh=Object.defineProperty,th=(t,e,i)=>e in t?eh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,B=(t,e,i)=>th(t,typeof e!="symbol"?e+"":e,i);const ih={abs:Sc,acos:Ec,asin:Nc,atan:Cc,avg:Ic,ceil:kc,cos:Ac,e:Tc,exp:Pc,floor:Dc,ln:Rc,log:Oc,log10:Vc,max:Mc,min:Lc,param:jc,phi:Bc,pi:Fc,pow:$c,random:Wc,round:Uc,round_to_mintick:qc,rphi:Kc,sign:zc,sin:Hc,sqrt:Gc,sum:Yc,tan:Qc,todegrees:Xc,toradians:Zc,__eq:Jc};class rh{constructor(e){this.context=e,B(this,"_cache",{}),B(this,"abs"),B(this,"acos"),B(this,"asin"),B(this,"atan"),B(this,"avg"),B(this,"ceil"),B(this,"cos"),B(this,"e"),B(this,"exp"),B(this,"floor"),B(this,"ln"),B(this,"log"),B(this,"log10"),B(this,"max"),B(this,"min"),B(this,"param"),B(this,"phi"),B(this,"pi"),B(this,"pow"),B(this,"random"),B(this,"round"),B(this,"round_to_mintick"),B(this,"rphi"),B(this,"sign"),B(this,"sin"),B(this,"sqrt"),B(this,"sum"),B(this,"tan"),B(this,"todegrees"),B(this,"toradians"),B(this,"__eq"),Object.entries(ih).forEach(([i,r])=>{this[i]=r(e)})}}function sh(t){return(e,i,r)=>{t.params[r]||(t.params[r]=[]);let s;if(e instanceof x)s=e.get(i||0);else if(Array.isArray(e)){const a=e.every(o=>o instanceof x),n=e.every(o=>!(o instanceof x)&&!Array.isArray(o));(a||n)&&e.length>=1?a?s=e.map(o=>o.get(0)):s=e:s=x.from(e).get(i||0)}else s=e;return t.params[r].length===0?t.params[r].push(s):t.params[r][t.params[r].length-1]=s,[s,r]}}const jt=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function Xi(t,e,i,r,s=!1){for(let a=0;a<i.length;a++)if(i[a]<=t&&t<r[a])return s||e>=r[a]?a:a-1;return-1}function Zi(t,e,i,r,s=!1,a,n=!1){for(let o=i.length-1;o>=0;o--){if(r[o]<=e&&i[o]>=t){const l=a&&e>a;if(n&&s)for(let c=0;c<i.length;c++){if(i[c]>=t&&i[c]<e)return c;if(i[c]>=e)break}if(l&&s&&!n)for(let c=0;c<i.length;c++){if(i[c]>=t&&i[c]<e)return c;if(i[c]>=e)break}return o}if(r[o]<t)break}return-1}function nh(t){return async(e,i,r,s=!1,a=!1,n=!1,o=null,l=null)=>{const c=e[0],h=typeof c=="string"&&c.includes(":")?c.split(":")[1]:c,p=i[0],u=r[0],f=r[1],m=Array.isArray(s)?s[0]:s,y=Array.isArray(a)?a[0]:a;if(t.isSecondaryContext)return Array.isArray(u)?[u]:u;const _=jt.indexOf(t.timeframe),b=jt.indexOf(p);if(_==-1||b==-1)throw new Error("Invalid timeframe");if(_===b)return Array.isArray(u)?[u]:u;const S=_>b,v=x.from(t.data.openTime).get(0),E=x.from(t.data.closeTime).get(0),N=`${h}_${p}_${f}`,O=`${N}_prevIdx`;if(t.cache[N]){const Oe=t.cache[N],ze=S?Zi(v,E,Oe.data.openTime.data,Oe.data.closeTime.data,y,t.eDate,m):Xi(v,E,Oe.data.openTime.data,Oe.data.closeTime.data,y);if(ze==-1)return NaN;const ye=Oe.params[f][ze];if(!S&&m){const ft=t.cache[O];return ft!==void 0&&ft===ze?NaN:(t.cache[O]=ze,Array.isArray(ye)?[ye]:ye)}return Array.isArray(ye)?[ye]:ye}const D=1e3*60*60*24*30,M=t.sDate?t.sDate-D:void 0,q=t.sDate&&t.eDate?void 0:t.limit||1e3,G=new vs(t.source,h,p,q,M,void 0);G.markAsSecondary();const K=await G.run(t.pineTSCode);t.cache[N]=K;const pe=S?Zi(v,E,K.data.openTime.data,K.data.closeTime.data,y,t.eDate,m):Xi(v,E,K.data.openTime.data,K.data.closeTime.data,y);if(pe==-1)return NaN;const Fe=K.params[f][pe];return!S&&m?(t.cache[O]=pe,NaN):Array.isArray(Fe)?[Fe]:Fe}}function ah(t){return async(e,i,r,s=!1,a=null,n=!1,o=0)=>{const l=e[0],c=i[0],h=r[0],p=r[1];Array.isArray(s)&&s[0];const u=Array.isArray(n)?n[0]:n;if(t.isSecondaryContext)return Array.isArray(h)?[h]:h;const f=jt.indexOf(t.timeframe),m=jt.indexOf(c);if(f===-1||m===-1){if(u)return NaN;throw new Error("Invalid timeframe")}if(m>f){if(u)return NaN;throw new Error(`Timeframe ${c} is not lower than or equal to chart timeframe ${t.timeframe}`)}if(m===f)return[[h]];const y=`${l}_${c}_${p}_lower`;if(!t.cache[y]){const D=t.sDate?t.sDate-2592e6:void 0,M=t.sDate&&t.eDate?void 0:t.limit||1e3,q=new vs(t.source,l,c,M,D,t.eDate);q.markAsSecondary();const G=await q.run(t.pineTSCode);t.cache[y]=G}const _=t.cache[y],b=x.from(t.data.openTime).get(0),S=x.from(t.data.closeTime).get(0),v=_.data.openTime.data,E=_.data.closeTime.data,N=_.params[p];if(!N)return[];const O=[];for(let D=0;D<v.length;D++){const M=v[D];if(!(E[D]<=b)){if(M>=S)break;M>=b&&M<S&&O.push(N[D])}}return[O]}}var oh=Object.defineProperty,lh=(t,e,i)=>e in t?oh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Tt=(t,e,i)=>lh(t,typeof e!="symbol"?e+"":e,i);const ch={param:sh,security:nh,security_lower_tf:ah};class hh{constructor(e){this.context=e,Tt(this,"_cache",{}),Tt(this,"param"),Tt(this,"security"),Tt(this,"security_lower_tf"),Object.entries(ch).forEach(([i,r])=>{this[i]=r(e)})}}function uh(t){return e=>{t.taState||(t.taState={});const i=e||"accdist";t.taState[i]||(t.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=t.taState[i];t.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=t.idx);const s=t.get(t.data.close,0),a=t.get(t.data.high,0),n=t.get(t.data.low,0),o=t.get(t.data.volume,0);if(isNaN(s)||isNaN(a)||isNaN(n)||isNaN(o))return r.currentCumulativeSum=r.prevCumulativeSum,t.precision(r.prevCumulativeSum);const l=a-n;let c=0;l!==0&&(c=(s-n-(a-s))/l*o);const h=r.prevCumulativeSum+c;return r.currentCumulativeSum=h,t.precision(h)}}function ph(t){return(e,i,r,s,a)=>{const n=x.from(i).get(0),o=x.from(r).get(0),l=x.from(s).get(0);t.taState||(t.taState={});const c=a||`alma_${n}_${o}_${l}`;if(!t.taState[c]){const y=o*(n-1),_=n/l,b=[];let S=0;for(let v=0;v<n;v++){const E=Math.exp(-Math.pow(v-y,2)/(2*_*_));b.push(E),S+=E}for(let v=0;v<b.length;v++)b[v]/=S;t.taState[c]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0,weights:b}}const h=t.taState[c];t.idx>h.lastIdx&&(h.lastIdx>=0&&(h.prevWindow=[...h.currentWindow],h.prevCallCount=h.currentCallCount),h.lastIdx=t.idx);const p=x.from(e).get(0),u=[...h.prevWindow];for(u.unshift(p);u.length>n;)u.pop();const f=h.prevCallCount+1;if(u.length<n&&(f>=n||t.idx>=n-1)){const y=x.from(e);for(;u.length<n;)u.push(y.get(u.length))}if(h.currentWindow=u,h.currentCallCount=f,u.length<n)return NaN;let m=0;for(let y=0;y<n;y++)m+=h.weights[y]*u[n-1-y];return t.precision(m)}}function fh(t){return(e,i)=>{const r=x.from(e).get(0);t.taState||(t.taState={});const s=i||`atr_${r}`;t.taState[s]||(t.taState[s]={lastIdx:-1,prevAtr:null,prevInitSum:0,prevInitCount:0,currentAtr:null,currentInitSum:0,currentInitCount:0});const a=t.taState[s];t.idx>a.lastIdx&&(a.lastIdx>=0&&(a.prevAtr=a.currentAtr,a.prevInitSum=a.currentInitSum,a.prevInitCount=a.currentInitCount),a.lastIdx=t.idx);const n=t.get(t.data.high,0),o=t.get(t.data.low,0),l=t.get(t.data.close,0);if(isNaN(n)||isNaN(o)||isNaN(l))return NaN;const c=t.idx>0?t.get(t.data.close,1):null;let h;if(c!==null&&!isNaN(c)){const y=n-o,_=Math.abs(n-c),b=Math.abs(o-c);h=Math.max(y,_,b)}else h=n-o;let p=a.prevInitCount,u=a.prevInitSum,f=a.prevAtr;if(p<r){if(u+=h,p++,a.currentInitSum=u,a.currentInitCount=p,p===r){const y=u/r;return a.currentAtr=y,t.precision(y)}return NaN}const m=(f*(r-1)+h)/r;return a.currentAtr=m,t.precision(m)}}function dh(t){return(e,i)=>{t.taState||(t.taState={});const r=i||"barssince";t.taState[r]||(t.taState[r]={lastIdx:-1,prevLastTrueIndex:null,currentLastTrueIndex:null});const s=t.taState[r];t.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevLastTrueIndex=s.currentLastTrueIndex),s.lastIdx=t.idx);const a=x.from(e).get(0);let n=s.prevLastTrueIndex;return a&&(n=t.idx),s.currentLastTrueIndex=n,n===null?NaN:t.idx-n}}function mh(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0);t.taState||(t.taState={});const o=s||`bb_${a}_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevWindow=[...l.currentWindow],l.prevSum=l.currentSum),l.lastIdx=t.idx);const c=x.from(e).get(0);if(isNaN(c))return l.currentWindow=[...l.prevWindow],l.currentSum=l.prevSum,[[NaN,NaN,NaN]];const h=[...l.prevWindow];let p=l.prevSum;for(h.unshift(c),p+=c;h.length>a;){const b=h.pop();p-=b}if(h.length<a&&t.idx>=a-1){const b=x.from(e);for(;h.length<a;){const S=b.get(h.length);if(isNaN(S))break;h.push(S),p+=S}}if(l.currentWindow=h,l.currentSum=p,h.length<a)return[[NaN,NaN,NaN]];const u=p/a;let f=0;for(let b=0;b<a;b++)f+=Math.pow(h[b]-u,2);const m=Math.sqrt(f/a),y=u+n*m,_=u-n*m;return[[t.precision(u),t.precision(y),t.precision(_)]]}}function gh(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0);t.taState||(t.taState={});const o=s||`bbw_${a}_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevWindow=[...l.currentWindow],l.prevSum=l.currentSum),l.lastIdx=t.idx);const c=x.from(e).get(0);if(isNaN(c))return l.currentWindow=[...l.prevWindow],l.currentSum=l.prevSum,NaN;const h=[...l.prevWindow];let p=l.prevSum;for(h.unshift(c),p+=c;h.length>a;){const S=h.pop();p-=S}if(h.length<a&&t.idx>=a-1){const S=x.from(e);for(;h.length<a;){const v=S.get(h.length);if(isNaN(v))break;h.push(v),p+=v}}if(l.currentWindow=h,l.currentSum=p,h.length<a)return NaN;const u=p/a;let f=0;for(let S=0;S<a;S++){const v=h[S]-u;f+=v*v}const m=f/a,y=Math.sqrt(m),_=n*y;if(u===0)return t.precision(0);const b=2*_/u*100;return t.precision(b)}}function xh(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`cci_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,prevCallCount:0,currentWindow:[],currentSum:0,currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevSum=n.currentSum,n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0);if(isNaN(o))return NaN;const l=[...n.prevWindow];let c=n.prevSum;for(l.unshift(o),c+=o;l.length>s;){const y=l.pop();c-=y}const h=n.prevCallCount+1;if(l.length<s&&(h>=s||t.idx>=s-1)){const y=x.from(e);for(;l.length<s;){const _=y.get(l.length);if(isNaN(_))break;l.push(_),c+=_}}if(n.currentWindow=l,n.currentSum=c,n.currentCallCount=h,l.length<s)return NaN;const p=c/s;let u=0;for(let y=0;y<s;y++)u+=Math.abs(l[y]-p);const f=u/s;if(f===0)return 0;const m=(o-p)/(.015*f);return t.precision(m)}}function yh(t){return(e,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`change_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s+1;)l.pop();const c=n.prevCallCount+1;if(l.length<s+1&&(c>=s+1||t.idx>=s)){const p=x.from(e);for(;l.length<s+1;)l.push(p.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<=s)return NaN;const h=o-l[s];return t.precision(h)}}function _h(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`cmo_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevGainsWindow:[],prevLossesWindow:[],prevGainsSum:0,prevLossesSum:0,currentGainsWindow:[],currentLossesWindow:[],currentGainsSum:0,currentLossesSum:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevGainsWindow=[...n.currentGainsWindow],n.prevLossesWindow=[...n.currentLossesWindow],n.prevGainsSum=n.currentGainsSum,n.prevLossesSum=n.currentLossesSum),n.lastIdx=t.idx);const o=x.from(e).get(0),l=x.from(e).get(1);if(isNaN(o)||isNaN(l))return NaN;const c=o-l,h=c>=0?c:0,p=c>=0?0:-c,u=[...n.prevGainsWindow],f=[...n.prevLossesWindow];let m=n.prevGainsSum,y=n.prevLossesSum;if(u.unshift(h),f.unshift(p),m+=h,y+=p,u.length<s)return n.currentGainsWindow=u,n.currentLossesWindow=f,n.currentGainsSum=m,n.currentLossesSum=y,NaN;if(u.length>s){const S=u.pop(),v=f.pop();m-=S,y-=v}n.currentGainsWindow=u,n.currentLossesWindow=f,n.currentGainsSum=m,n.currentLossesSum=y;const _=m+y;if(_===0)return t.precision(0);const b=100*(m-y)/_;return t.precision(b)}}function bh(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);let n=0,o=!1;for(let h=0;h<s;h++){const p=a.get(h);if(isNaN(p)){o=!0;break}n+=p}if(o)return NaN;let l=0;for(let h=0;h<s;h++){const p=a.get(h);l+=p*(h+1)}if(n===0)return NaN;const c=-l/n;return t.precision(c)}}function vh(t){return(e,i,r,s)=>{const a=x.from(r).get(0),n=x.from(e),o=x.from(i);if(t.idx<a-1)return NaN;let l=0,c=0,h=0,p=0,u=0,f=0;for(let S=0;S<a;S++){const v=n.get(S),E=o.get(S);isNaN(v)||isNaN(E)||(l+=v,c+=E,h+=v*E,p+=v*v,u+=E*E,f++)}if(f<2)return NaN;const m=f*h-l*c,y=f*p-l*l,_=f*u-c*c;if(y<=0||_<=0)return t.precision(0);const b=m/Math.sqrt(y*_);return t.precision(b)}}function wh(t){return(e,i,r)=>{const s=x.from(e),a=x.from(i),n=s.get(0),o=a.get(0),l=s.get(1),c=a.get(1);if(isNaN(n)||isNaN(o)||isNaN(l)||isNaN(c))return!1;const h=n>o&&l<=c,p=n<o&&l>=c;return h||p}}function Sh(t){return(e,i)=>{const r=x.from(e),s=x.from(i),a=r.get(0),n=s.get(0),o=r.get(1),l=s.get(1);return o<l&&a>n}}function Eh(t){return(e,i)=>{const r=x.from(e),s=x.from(i),a=r.get(0),n=s.get(0),o=r.get(1),l=s.get(1);return o>l&&a<n}}function Nh(t){return(e,i)=>{t.taState||(t.taState={});const r=i||"cum";t.taState[r]||(t.taState[r]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const s=t.taState[r];t.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevCumulativeSum=s.currentCumulativeSum),s.lastIdx=t.idx);const a=x.from(e).get(0);if(isNaN(a))return s.currentCumulativeSum=s.prevCumulativeSum,t.precision(s.prevCumulativeSum);const n=s.prevCumulativeSum+a;return s.currentCumulativeSum=n,t.precision(n)}}function Ch(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`dev_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,prevCallCount:0,currentWindow:[],currentSum:0,currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevSum=n.currentSum,n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0)||0,l=[...n.prevWindow];let c=n.prevSum;for(l.unshift(o),c+=o;l.length>s;){const m=l.pop();c-=m}const h=n.prevCallCount+1;if(l.length<s&&(h>=s||t.idx>=s-1)){const m=x.from(e);for(;l.length<s;){const y=m.get(l.length);l.push(y),c+=y}}if(n.currentWindow=l,n.currentSum=c,n.currentCallCount=h,l.length<s)return NaN;const p=c/s;let u=0;for(let m=0;m<s;m++)u+=Math.abs(l[m]-p);const f=u/s;return t.precision(f)}}function Ih(t){return(e,i,r)=>{const s=x.from(e).get(0),a=x.from(i).get(0);t.taState||(t.taState={});const n=r||`dmi_${s}_${a}`;t.taState[n]||(t.taState[n]={lastIdx:-1,prevTrInitSum:0,prevPlusInitSum:0,prevMinusInitSum:0,prevInitCount:0,prevSmoothedTR:NaN,prevSmoothedPlus:NaN,prevSmoothedMinus:NaN,prevDxInitSum:0,prevAdxInitCount:0,prevADX:NaN,currentTrInitSum:0,currentPlusInitSum:0,currentMinusInitSum:0,currentInitCount:0,currentSmoothedTR:NaN,currentSmoothedPlus:NaN,currentSmoothedMinus:NaN,currentDxInitSum:0,currentAdxInitCount:0,currentADX:NaN});const o=t.taState[n];t.idx>o.lastIdx&&(o.lastIdx>=0&&(o.prevTrInitSum=o.currentTrInitSum,o.prevPlusInitSum=o.currentPlusInitSum,o.prevMinusInitSum=o.currentMinusInitSum,o.prevInitCount=o.currentInitCount,o.prevSmoothedTR=o.currentSmoothedTR,o.prevSmoothedPlus=o.currentSmoothedPlus,o.prevSmoothedMinus=o.currentSmoothedMinus,o.prevDxInitSum=o.currentDxInitSum,o.prevAdxInitCount=o.currentAdxInitCount,o.prevADX=o.currentADX),o.lastIdx=t.idx);const l=t.get(t.data.high,0),c=t.get(t.data.low,0),h=t.get(t.data.close,0);if(isNaN(l)||isNaN(c)||isNaN(h))return[[NaN,NaN,NaN]];const p=t.idx>0?t.get(t.data.high,1):NaN,u=t.idx>0?t.get(t.data.low,1):NaN,f=t.idx>0?t.get(t.data.close,1):NaN;if(isNaN(p))return[[NaN,NaN,NaN]];const m=Math.max(l-c,Math.abs(l-f),Math.abs(c-f)),y=l-p,_=u-c,b=y>_&&y>0?y:0,S=_>y&&_>0?_:0;let v=o.prevInitCount,E=o.prevTrInitSum,N=o.prevPlusInitSum,O=o.prevMinusInitSum,D=o.prevSmoothedTR,M=o.prevSmoothedPlus,q=o.prevSmoothedMinus;if(v++,v<=s)E+=m,N+=b,O+=S,v===s&&(D=E/s,M=N/s,q=O/s);else{const $e=1/s;D=$e*m+(1-$e)*D,M=$e*b+(1-$e)*M,q=$e*S+(1-$e)*q}if(o.currentInitCount=v,o.currentTrInitSum=E,o.currentPlusInitSum=N,o.currentMinusInitSum=O,o.currentSmoothedTR=D,o.currentSmoothedPlus=M,o.currentSmoothedMinus=q,v<s)return[[NaN,NaN,NaN]];const G=D===0?0:100*M/D,K=D===0?0:100*q/D,pe=G+K,Fe=pe===0?0:100*Math.abs(G-K)/pe;let Oe=o.prevAdxInitCount,ze=o.prevDxInitSum,ye=o.prevADX,ft=NaN;if(Oe++,Oe<=a)ze+=Fe,Oe===a&&(ye=ze/a,ft=ye);else{const $e=1/a;ye=$e*Fe+(1-$e)*ye,ft=ye}return o.currentAdxInitCount=Oe,o.currentDxInitSum=ze,o.currentADX=ye,[[t.precision(G),t.precision(K),t.precision(ft)]]}}function kh(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`ema_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevEma:null,prevInitSum:0,prevInitCount:0,currentEma:null,currentInitSum:0,currentInitCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevEma=n.currentEma,n.prevInitSum=n.currentInitSum,n.prevInitCount=n.currentInitCount),n.lastIdx=t.idx);const o=x.from(e).get(0);if(o==null||isNaN(o))return NaN;let l=n.prevInitCount,c=n.prevInitSum,h=n.prevEma;if(l<s){if(c+=o,l++,n.currentInitSum=c,n.currentInitCount=l,l===s){const f=c/s;return n.currentEma=f,t.precision(f)}return NaN}const p=2/(s+1),u=o*p+h*(1-p);return n.currentEma=u,t.precision(u)}}function Ah(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);for(let n=0;n<s;n++){const o=a.get(n),l=a.get(n+1);if(isNaN(o)||isNaN(l)||o>=l)return!1}return!0}}function Th(t){return(e,i,r)=>{typeof i=="string"&&r===void 0&&(r=i,i=e,e=t.data.high);const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`highest_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;if(l.length<s&&(c>=s||t.idx>=s-1)){const u=x.from(e);for(;l.length<s;)l.push(u.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<s)return NaN;const h=l.filter(u=>!isNaN(u)&&u!==void 0);if(h.length===0)return NaN;const p=Math.max(...h);return t.precision(p)}}function Ph(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);if(t.idx<s-1)return NaN;let n=-1/0,o=NaN;for(let l=0;l<s;l++){const c=a.get(l);isNaN(c)||(isNaN(o)||c>n)&&(n=c,o=-l)}return o}}function Dh(t){return(e,i,r)=>{const s=x.from(i).get(0),a=Math.floor(s/2),n=Math.floor(Math.sqrt(s)),o=t.pine.ta.wma,l=o(e,a,r?`${r}_wma1`:void 0),c=o(e,s,r?`${r}_wma2`:void 0);if(isNaN(l)||isNaN(c))return NaN;t.taState||(t.taState={});const h=r||`hma_raw_${s}`;t.taState[h]||(t.taState[h]={lastIdx:-1,prevValues:[],currentValues:[]});const p=t.taState[h];t.idx>p.lastIdx&&(p.lastIdx>=0&&(p.prevValues=[...p.currentValues]),p.lastIdx=t.idx);const u=2*l-c,f=[...p.prevValues];f.unshift(u),f.length>n+1&&f.pop(),p.currentValues=f;const m=r?`${r}_hma_final`:`hma_final_${s}`;t.taState[m]||(t.taState[m]={lastIdx:-1,prevWindow:[],currentWindow:[]});const y=t.taState[m];t.idx>y.lastIdx&&(y.lastIdx>=0&&(y.prevWindow=[...y.currentWindow]),y.lastIdx=t.idx);const _=[...y.prevWindow];if(_.unshift(u),_.length<n)return y.currentWindow=_,NaN;for(;_.length>n;)_.pop();y.currentWindow=_;let b=0,S=0;for(let E=0;E<n;E++){const N=n-E;b+=_[E]*N,S+=N}const v=b/S;return t.precision(v)}}function Rh(t){return e=>{const i=t.get(t.data.close,0),r=t.get(t.data.high,0),s=t.get(t.data.low,0),a=t.get(t.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(a))return NaN;const n=(r-s)*a;if(n===0)return t.precision(0);const o=(2*i-r-s)/n;return t.precision(o)}}function Oh(t){return(e,i,r,s,a)=>{const n=x.from(i).get(0),o=x.from(r).get(0);let l=!0;typeof s=="string"?a=s:s!==void 0&&(l=x.from(s).get(0));let c;const h=t.get(t.data.high,0),p=t.get(t.data.low,0);if(l){const E=t.get(t.data.close,1);isNaN(E)?c=NaN:c=Math.max(h-p,Math.abs(h-E),Math.abs(p-E))}else c=h-p;const u=x.from(e).get(0);t.taState||(t.taState={});const f=a||`kc_${n}_${o}_${l}`;t.taState[f]||(t.taState[f]={lastIdx:-1,basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0},currentBasisState:{prevEma:null,initSum:0,initCount:0},currentRangeState:{prevEma:null,initSum:0,initCount:0}});const m=t.taState[f];t.idx>m.lastIdx&&(m.lastIdx>=0&&(m.basisState={...m.currentBasisState},m.rangeState={...m.currentRangeState}),m.lastIdx=t.idx);const y=(E,N,O,D)=>{if(isNaN(O))return Object.assign(N,E),N.prevEma!==null?N.prevEma:NaN;let M=E.initCount,q=E.initSum,G=E.prevEma;if(M<D){if(q+=O,M++,N.initSum=q,N.initCount=M,N.prevEma=G,M===D){const Fe=q/D;return N.prevEma=Fe,Fe}return NaN}const K=2/(D+1),pe=O*K+G*(1-K);return N.prevEma=pe,N.initSum=q,N.initCount=M,pe},_=y(m.basisState,m.currentBasisState,u,n),b=y(m.rangeState,m.currentRangeState,c,n);if(isNaN(_)||isNaN(b))return[[NaN,NaN,NaN]];const S=_+b*o,v=_-b*o;return[[t.precision(_),t.precision(S),t.precision(v)]]}}function Vh(t){return(e,i,r,s,a)=>{const n=x.from(i).get(0),o=x.from(r).get(0);let l=!0;typeof s=="string"?a=s:s!==void 0&&(l=x.from(s).get(0)),t.taState||(t.taState={});const c=a||`kcw_${n}_${o}_${l}`;t.taState[c]||(t.taState[c]={lastIdx:-1,basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0},currentBasisState:{prevEma:null,initSum:0,initCount:0},currentRangeState:{prevEma:null,initSum:0,initCount:0}});const h=t.taState[c];t.idx>h.lastIdx&&(h.lastIdx>=0&&(h.basisState={...h.currentBasisState},h.rangeState={...h.currentRangeState}),h.lastIdx=t.idx);const p=(v,E,N,O)=>{if(isNaN(N))return Object.assign(E,v),E.prevEma!==null?E.prevEma:NaN;let D=v.initCount,M=v.initSum,q=v.prevEma;if(D<O){if(M+=N,D++,E.initSum=M,E.initCount=D,E.prevEma=q,D===O){const pe=M/O;return E.prevEma=pe,pe}return NaN}const G=2/(O+1),K=N*G+q*(1-G);return E.prevEma=K,E.initSum=M,E.initCount=D,K};let u;const f=t.get(t.data.high,0),m=t.get(t.data.low,0);if(l){const v=t.get(t.data.close,1);isNaN(v)?u=NaN:u=Math.max(f-m,Math.abs(f-v),Math.abs(m-v))}else u=f-m;const y=x.from(e).get(0),_=p(h.basisState,h.currentBasisState,y,n),b=p(h.rangeState,h.currentRangeState,u,n);if(isNaN(_)||isNaN(b))return NaN;if(_===0)return t.precision(0);const S=2*b*o/_;return t.precision(S)}}function Mh(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0);t.taState||(t.taState={});const o=s||`linreg_${a}_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevWindow=[...l.currentWindow],l.prevCallCount=l.currentCallCount),l.lastIdx=t.idx);const c=x.from(e).get(0),h=[...l.prevWindow];for(h.unshift(c);h.length>a;)h.pop();const p=l.prevCallCount+1;if(h.length<a&&(p>=a||t.idx>=a-1)){const E=x.from(e);for(;h.length<a;)h.push(E.get(h.length))}if(l.currentWindow=h,l.currentCallCount=p,h.length<a)return NaN;let u=0,f=0,m=0,y=0;const _=a;for(let E=0;E<a;E++){const N=a-1-E,O=h[E];u+=N,f+=O,m+=N*O,y+=N*N}const b=_*y-u*u;if(b===0)return NaN;const S=(_*m-u*f)/b,v=(f-S*u)/_+S*(a-1-n);return t.precision(v)}}function Lh(t){return(e,i,r)=>{typeof i=="string"&&r===void 0&&(r=i,i=e,e=t.data.low);const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`lowest_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;if(l.length<s&&(c>=s||t.idx>=s-1)){const u=x.from(e);for(;l.length<s;)l.push(u.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<s)return NaN;const h=l.filter(u=>!isNaN(u)&&u!==void 0);if(h.length===0)return NaN;const p=Math.min(...h);return t.precision(p)}}function jh(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);if(t.idx<s-1)return NaN;let n=1/0,o=NaN;for(let l=0;l<s;l++){const c=a.get(l);isNaN(c)||(isNaN(o)||c<n)&&(n=c,o=-l)}return o}}function Bh(t){return(e,i,r,s,a)=>{const n=x.from(i).get(0),o=x.from(r).get(0),l=x.from(s).get(0),c=a||`macd_${n}_${o}_${l}`,h=`${c}_fast`,p=`${c}_slow`,u=`${c}_signal`,f=t.pine.ta.ema(e,n,h),m=t.pine.ta.ema(e,o,p);let y=NaN;!isNaN(f)&&!isNaN(m)&&(y=f-m);let _=NaN;isNaN(y)||(_=t.pine.ta.ema(y,l,u));let b=NaN;return!isNaN(y)&&!isNaN(_)&&(b=y-_),[[t.precision(y),t.precision(_),t.precision(b)]]}}function Fh(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`median_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;if(l.length<s&&(c>=s||t.idx>=s-1)){const f=x.from(e);for(;l.length<s;)l.push(f.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<s)return NaN;const h=l.slice().sort((f,m)=>f-m),p=Math.floor(s/2),u=s%2===0?(h[p-1]+h[p])/2:h[p];return t.precision(u)}}function $h(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`mfi_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevUpperWindow:[],prevLowerWindow:[],prevUpperSum:0,prevLowerSum:0,currentUpperWindow:[],currentLowerWindow:[],currentUpperSum:0,currentLowerSum:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevUpperWindow=[...n.currentUpperWindow],n.prevLowerWindow=[...n.currentLowerWindow],n.prevUpperSum=n.currentUpperSum,n.prevLowerSum=n.currentLowerSum),n.lastIdx=t.idx);const o=x.from(e).get(0),l=x.from(e).get(1),c=t.get(t.data.volume,0);if(isNaN(o)||isNaN(c))return NaN;const h=isNaN(l)?NaN:o-l,p=c*(h<=0?0:o),u=c*(h>=0?0:o),f=[...n.prevUpperWindow],m=[...n.prevLowerWindow];let y=n.prevUpperSum,_=n.prevLowerSum;if(f.unshift(p),m.unshift(u),y+=p,_+=u,f.length<s)return n.currentUpperWindow=f,n.currentLowerWindow=m,n.currentUpperSum=y,n.currentLowerSum=_,NaN;if(f.length>s){const S=f.pop(),v=m.pop();y-=S,_-=v}if(n.currentUpperWindow=f,n.currentLowerWindow=m,n.currentUpperSum=y,n.currentLowerSum=_,_===0)return t.precision(100);if(y===0)return t.precision(0);const b=100-100/(1+y/_);return t.precision(b)}}function Wh(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);if(t.idx<s-1)return NaN;const n=new Map;for(let c=0;c<s;c++){const h=a.get(c);isNaN(h)||n.set(h,(n.get(h)||0)+1)}if(n.size===0)return NaN;let o=NaN,l=-1;for(const[c,h]of n.entries())h>l?(l=h,o=c):h===l&&c<o&&(o=c);return o}}function Uh(t){return(e,i,r)=>{const s=x.from(i).get(0);return t.pine.ta.change(e,s,r)}}function qh(t){return e=>{t.taState||(t.taState={});const i=e||"nvi";t.taState[i]||(t.taState[i]={lastIdx:-1,committedNVI:1,tentativeNVI:1});const r=t.taState[i];t.idx>r.lastIdx&&(r.lastIdx>=0&&(r.committedNVI=r.tentativeNVI),r.lastIdx=t.idx);const s=t.get(t.data.close,0),a=t.get(t.data.close,1),n=t.get(t.data.volume,0),o=t.get(t.data.volume,1),l=isNaN(s)?0:s,c=isNaN(a)?0:a,h=isNaN(n)?0:n,p=isNaN(o)?0:o;let u=r.committedNVI;if(!(l===0||c===0)&&h<p){const f=(l-c)/c;u=u+f*u}return r.tentativeNVI=u,t.precision(u)}}function Kh(t){return()=>{t.taState||(t.taState={});const e="obv";t.taState[e]||(t.taState[e]={lastIdx:-1,committedOBV:0,tentativeOBV:0});const i=t.taState[e];t.idx>i.lastIdx&&(i.lastIdx>=0&&(i.committedOBV=i.tentativeOBV),i.lastIdx=t.idx);const r=t.get(t.data.close,0),s=t.get(t.data.volume,0),a=t.get(t.data.close,1);if(isNaN(a))return i.tentativeOBV=0,t.precision(0);let n=i.committedOBV;return r>a?n+=s:r<a&&(n-=s),i.tentativeOBV=n,t.precision(n)}}function zh(t){return(e,i,r)=>e instanceof x?i?new x(e.data,e.offset+i):e:(t.params[r]||(t.params[r]=[]),Array.isArray(e)?new x(e,i||0):(t.params[r].length===0?t.params[r].push(e):t.params[r][t.params[r].length-1]=e,new x(t.params[r],i||0)))}function Hh(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0),o=x.from(e);if(t.idx<a-1)return NaN;const l=[];for(let m=0;m<a;m++){const y=o.get(m);if(isNaN(y))return NaN;l.push(y)}l.sort((m,y)=>m-y);let c=n/100*a-.5;c<0&&(c=0),c>a-1&&(c=a-1);const h=Math.floor(c),p=Math.ceil(c);if(h===p)return t.precision(l[h]);const u=c-h,f=l[h]+u*(l[p]-l[h]);return t.precision(f)}}function Gh(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0),o=x.from(e);if(t.idx<a-1)return NaN;const l=[];for(let h=0;h<a;h++){const p=o.get(h);isNaN(p)||l.push(p)}if(l.length===0)return NaN;l.sort((h,p)=>h-p);let c=Math.ceil(n/100*l.length)-1;return c<0&&(c=0),c>=l.length&&(c=l.length-1),t.precision(l[c])}}function Yh(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);if(t.idx<s)return NaN;const n=a.get(0);if(isNaN(n))return NaN;let o=0,l=0;for(let c=1;c<=s;c++){const h=a.get(c);isNaN(h)||(l++,h<=n&&o++)}return l===0?NaN:t.precision(o/l*100)}}function Qh(t,e,i){const r=new Array(t.length).fill(NaN);for(let s=e+i;s<t.length;s++){const a=t[s-i];let n=!0;for(let o=1;o<=e;o++)if(t[s-i-o]>=a){n=!1;break}if(n){for(let o=1;o<=i;o++)if(t[s-i+o]>=a){n=!1;break}}n&&(r[s]=a)}return r}function Xh(t){return(e,i,r,s)=>{typeof r=="string"&&(r=i,i=e,e=t.data.high);const a=x.from(i).get(0),n=x.from(r).get(0),o=x.from(e).toArray(),l=Qh(o,a,n),c=t.idx;return t.precision(l[c])}}function Zh(t,e,i){const r=new Array(t.length).fill(NaN);for(let s=e+i;s<t.length;s++){const a=t[s-i];let n=!0;for(let o=1;o<=e;o++)if(t[s-i-o]<=a){n=!1;break}if(n){for(let o=1;o<=i;o++)if(t[s-i+o]<=a){n=!1;break}}n&&(r[s]=a)}return r}function Jh(t){return(e,i,r,s)=>{typeof r=="string"&&(r=i,i=e,e=t.data.low);const a=x.from(i).get(0),n=x.from(r).get(0),o=x.from(e).toArray(),l=Zh(o,a,n),c=t.idx;return t.precision(l[c])}}function eu(t){return e=>{t.taState||(t.taState={});const i=e||"pvi";t.taState[i]||(t.taState[i]={lastIdx:-1,committedPVI:1,tentativePVI:1});const r=t.taState[i];t.idx>r.lastIdx&&(r.lastIdx>=0&&(r.committedPVI=r.tentativePVI),r.lastIdx=t.idx);const s=t.get(t.data.close,0),a=t.get(t.data.close,1),n=t.get(t.data.volume,0),o=t.get(t.data.volume,1),l=isNaN(s)?0:s,c=isNaN(a)?0:a,h=isNaN(n)?0:n,p=isNaN(o)?0:o;let u=r.committedPVI;if(!(l===0||c===0)&&h>p){const f=(l-c)/c;u=u+f*u}return r.tentativePVI=u,t.precision(u)}}function tu(t){return e=>{t.taState||(t.taState={});const i=e||"pvt";t.taState[i]||(t.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=t.taState[i];t.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=t.idx);const s=t.get(t.data.close,0),a=t.get(t.data.close,1),n=t.get(t.data.volume,0);let o=r.prevCumulativeSum;if(!isNaN(s)&&!isNaN(a)&&!isNaN(n)&&a!==0){const l=(s-a)/a*n;o+=l}return r.currentCumulativeSum=o,t.precision(o)}}function iu(t){return(e,i,r)=>{const s=t.pine.ta.highest(e,i,(r||"range")+"_h"),a=t.pine.ta.lowest(e,i,(r||"range")+"_l");return isNaN(s)||isNaN(a)?NaN:t.precision(s-a)}}function ru(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);for(let n=0;n<s;n++){const o=a.get(n),l=a.get(n+1);if(isNaN(o)||isNaN(l)||o<=l)return!1}return!0}}function su(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`rma_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevRma:null,prevInitSum:0,prevInitCount:0,currentRma:null,currentInitSum:0,currentInitCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevRma=n.currentRma,n.prevInitSum=n.currentInitSum,n.prevInitCount=n.currentInitCount),n.lastIdx=t.idx);const o=x.from(e).get(0)||0;let l=n.prevInitCount,c=n.prevInitSum,h=n.prevRma;if(l<s){if(c+=o,l++,n.currentInitSum=c,n.currentInitCount=l,l===s){const f=c/s;return n.currentRma=f,t.precision(f)}return NaN}const p=1/s,u=o*p+h*(1-p);return n.currentRma=u,t.precision(u)}}function nu(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`roc_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s+1;)l.pop();const c=n.prevCallCount+1;if(l.length<s+1&&(c>=s+1||t.idx>=s)){const u=x.from(e);for(;l.length<s+1;)l.push(u.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<=s)return NaN;const h=l[s],p=(o-h)/h*100;return t.precision(p)}}function au(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`rsi_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevPrevValue:null,prevAvgGain:0,prevAvgLoss:0,prevInitGains:[],prevInitLosses:[],currentPrevValue:null,currentAvgGain:0,currentAvgLoss:0,currentInitGains:[],currentInitLosses:[]});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevPrevValue=n.currentPrevValue,n.prevAvgGain=n.currentAvgGain,n.prevAvgLoss=n.currentAvgLoss,n.prevInitGains=[...n.currentInitGains],n.prevInitLosses=[...n.currentInitLosses]),n.lastIdx=t.idx);const o=x.from(e).get(0);if(o==null||isNaN(o))return NaN;const l=n.prevPrevValue;if(l===null||isNaN(l))return n.currentPrevValue=o,n.currentInitGains=[...n.prevInitGains],n.currentInitLosses=[...n.prevInitLosses],n.currentAvgGain=n.prevAvgGain,n.currentAvgLoss=n.prevAvgLoss,NaN;let c=n.prevAvgGain,h=n.prevAvgLoss;const p=[...n.prevInitGains],u=[...n.prevInitLosses],f=o-l,m=f>0?f:0,y=f<0?-f:0;if(p.length<s){if(p.push(m),u.push(y),n.currentInitGains=p,n.currentInitLosses=u,n.currentPrevValue=o,p.length===s){c=p.reduce((S,v)=>S+v,0)/s,h=u.reduce((S,v)=>S+v,0)/s,n.currentAvgGain=c,n.currentAvgLoss=h;const b=h===0?100:100-100/(1+c/h);return t.precision(b)}return NaN}c=(c*(s-1)+m)/s,h=(h*(s-1)+y)/s,n.currentAvgGain=c,n.currentAvgLoss=h,n.currentPrevValue=o;const _=h===0?100:100-100/(1+c/h);return t.precision(_)}}function ou(t){return(e,i,r,s)=>{const a=x.from(e).get(0),n=x.from(i).get(0),o=x.from(r).get(0);t.taState||(t.taState={});const l=s||`sar_${a}_${n}_${o}`;t.taState[l]||(t.taState[l]={lastIdx:-1,prevResult:NaN,prevMaxMin:NaN,prevAcceleration:NaN,prevIsBelow:!1,prevBarIndex:0,currentResult:NaN,currentMaxMin:NaN,currentAcceleration:NaN,currentIsBelow:!1,currentBarIndex:0});const c=t.taState[l];t.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevResult=c.currentResult,c.prevMaxMin=c.currentMaxMin,c.prevAcceleration=c.currentAcceleration,c.prevIsBelow=c.currentIsBelow,c.prevBarIndex=c.currentBarIndex),c.lastIdx=t.idx);let h=c.prevResult,p=c.prevMaxMin,u=c.prevAcceleration,f=c.prevIsBelow,m=c.prevBarIndex;const y=t.get(t.data.high,0),_=t.get(t.data.low,0),b=t.get(t.data.close,0),S=t.get(t.data.close,1),v=t.get(t.data.high,1),E=t.get(t.data.low,1),N=t.get(t.data.high,2),O=t.get(t.data.low,2);if(isNaN(y)||isNaN(_)||isNaN(b))return c.currentResult=h,c.currentMaxMin=p,c.currentAcceleration=u,c.currentIsBelow=f,c.currentBarIndex=m,NaN;let D=!1;return m===1&&(b>S?(f=!0,p=y,h=E):(f=!1,p=_,h=v),D=!0,u=a),m>=1&&(h=h+u*(p-h),f?h>_&&(D=!0,f=!1,h=Math.max(y,p),p=_,u=a):h<y&&(D=!0,f=!0,h=Math.min(_,p),p=y,u=a),D||(f?y>p&&(p=y,u=Math.min(u+n,o)):_<p&&(p=_,u=Math.min(u+n,o))),f?(h=Math.min(h,E),m>1&&(h=Math.min(h,O))):(h=Math.max(h,v),m>1&&(h=Math.max(h,N)))),m++,c.currentResult=h,c.currentMaxMin=p,c.currentAcceleration=u,c.currentIsBelow=f,c.currentBarIndex=m,m<=1?NaN:t.precision(h)}}function lu(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`sma_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,prevCallCount:0,currentWindow:[],currentSum:0,currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevSum=n.currentSum,n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;let h=!1;if(l.length<s&&(c>=s||t.idx>=s-1)){const y=x.from(e);for(;l.length<s;)l.push(y.get(l.length));h=!0}let p;const u=o==null||Number.isNaN(o);let f=!Number.isNaN(n.prevSum)&&!u&&!h;if(f){let y=n.prevSum+o;if(n.prevWindow.length>=s){const _=n.prevWindow[n.prevWindow.length-1];_==null||Number.isNaN(_)?f=!1:y-=_}f&&(p=y)}if(!f){p=0;let y=!1;for(const _ of l){if(_==null||Number.isNaN(_)){y=!0;break}p+=_}y&&(p=NaN)}if(n.currentWindow=l,n.currentSum=p,n.currentCallCount=c,l.length<s)return NaN;const m=p/s;return t.precision(m)}}function cu(t){return(e,i,r=!0,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0);t.taState||(t.taState={});const o=s||`stdev_${a}_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,prevCallCount:0,currentWindow:[],currentSum:0,currentCallCount:0});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevWindow=[...l.currentWindow],l.prevSum=l.currentSum,l.prevCallCount=l.currentCallCount),l.lastIdx=t.idx);const c=x.from(e).get(0);if(c==null||isNaN(c))return NaN;const h=[...l.prevWindow];let p=l.prevSum;for(h.unshift(c),p+=c;h.length>a;){const b=h.pop();p-=b}const u=l.prevCallCount+1;if(h.length<a&&(u>=a||t.idx>=a-1)){const b=x.from(e);for(;h.length<a;){const S=b.get(h.length);if(S==null||isNaN(S))break;h.push(S),p+=S}}if(l.currentWindow=h,l.currentSum=p,l.currentCallCount=u,h.length<a)return NaN;const f=p/a;let m=0;for(let b=0;b<a;b++)m+=Math.pow(h[b]-f,2);const y=n?a:a-1,_=Math.sqrt(m/y);return t.precision(_)}}function hu(t){return(e,i,r,s,a)=>{const n=x.from(s).get(0);t.taState||(t.taState={});const o=a||`stoch_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevHighWindow:[],prevLowWindow:[],currentHighWindow:[],currentLowWindow:[]});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevHighWindow=[...l.currentHighWindow],l.prevLowWindow=[...l.currentLowWindow]),l.lastIdx=t.idx);const c=x.from(e).get(0),h=x.from(i).get(0),p=x.from(r).get(0);if(isNaN(c)||isNaN(h)||isNaN(p))return l.currentHighWindow=[...l.prevHighWindow],l.currentLowWindow=[...l.prevLowWindow],NaN;const u=[...l.prevHighWindow],f=[...l.prevLowWindow];if(u.unshift(h),f.unshift(p),u.length>n&&(u.pop(),f.pop()),l.currentHighWindow=u,l.currentLowWindow=f,u.length<n)return NaN;let m=u[0],y=f[0];for(let S=1;S<n;S++)u[S]>m&&(m=u[S]),f[S]<y&&(y=f[S]);const _=m-y;if(_===0)return NaN;const b=100*(c-y)/_;return t.precision(b)}}function uu(t){return(e,i,r)=>{const s=x.from(e).get(0),a=x.from(i).get(0);t.taState||(t.taState={});const n=r||`supertrend_${s}_${a}`;t.taState[n]||(t.taState[n]={lastIdx:-1,prevTrSum:0,prevAtrValue:NaN,prevAtrCount:0,prevLowerBand:NaN,prevUpperBand:NaN,prevSuperTrend:NaN,prevDirection:NaN,currentTrSum:0,currentAtrValue:NaN,currentAtrCount:0,currentLowerBand:NaN,currentUpperBand:NaN,currentSuperTrend:NaN,currentDirection:NaN});const o=t.taState[n];t.idx>o.lastIdx&&(o.lastIdx>=0&&(o.prevTrSum=o.currentTrSum,o.prevAtrValue=o.currentAtrValue,o.prevAtrCount=o.currentAtrCount,o.prevLowerBand=o.currentLowerBand,o.prevUpperBand=o.currentUpperBand,o.prevSuperTrend=o.currentSuperTrend,o.prevDirection=o.currentDirection),o.lastIdx=t.idx);const l=t.get(t.data.high,0),c=t.get(t.data.low,0),h=t.get(t.data.close,0);if(isNaN(l)||isNaN(c)||isNaN(h))return[[NaN,NaN]];const p=(l+c)/2,u=t.idx>0?t.get(t.data.close,1):NaN;let f;isNaN(u)?f=l-c:f=Math.max(l-c,Math.abs(l-u),Math.abs(c-u));let m=o.prevAtrCount,y=o.prevTrSum,_=o.prevAtrValue;m++,m<=a?(y+=f,m===a&&(_=y/a)):_=(_*(a-1)+f)/a;const b=_;if(o.currentAtrCount=m,o.currentTrSum=y,o.currentAtrValue=_,isNaN(b))return[[NaN,NaN]];let S=p+s*b,v=p-s*b;const E=isNaN(o.prevLowerBand)?0:o.prevLowerBand,N=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||v>E||u<E||(v=E),isNaN(o.prevUpperBand)||S<N||u>N||(S=N);let O,D;const M=o.prevSuperTrend;return m===a?O=1:M===o.prevUpperBand?O=h>S?-1:1:O=h<v?1:-1,D=O===-1?v:S,o.currentLowerBand=v,o.currentUpperBand=S,o.currentSuperTrend=D,o.currentDirection=O,[[t.precision(D),O]]}}function pu(t){return(e,i)=>{const r=[1,2,2,1],s=6;t.taState||(t.taState={});const a=i||"swma";t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow]),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>4;)l.pop();if(l.length<4&&t.idx>=3){const h=x.from(e);for(;l.length<4;)l.push(h.get(l.length))}if(n.currentWindow=l,l.length<4)return NaN;let c=0;for(let h=0;h<4;h++)c+=r[h]*l[3-h];return c/=s,t.precision(c)}}function fu(t){return(e,i)=>{let r=!0;typeof e=="string"||e!==void 0&&(r=x.from(e).get(0));const s=t.get(t.data.high,0),a=t.get(t.data.low,0),n=t.get(t.data.close,1);if(isNaN(n))return r?t.precision(s-a):NaN;const o=Math.max(s-a,Math.abs(s-n),Math.abs(a-n));return t.precision(o)}}function du(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0);t.taState||(t.taState={});const o=s||`tsi_${a}_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevSource:NaN,prevEma1PcValue:NaN,prevEma1PcCount:0,prevEma1PcSum:0,prevEma2PcValue:NaN,prevEma2PcCount:0,prevEma2PcSum:0,prevEma1AbsValue:NaN,prevEma1AbsCount:0,prevEma1AbsSum:0,prevEma2AbsValue:NaN,prevEma2AbsCount:0,prevEma2AbsSum:0,currentSource:NaN,currentEma1PcValue:NaN,currentEma1PcCount:0,currentEma1PcSum:0,currentEma2PcValue:NaN,currentEma2PcCount:0,currentEma2PcSum:0,currentEma1AbsValue:NaN,currentEma1AbsCount:0,currentEma1AbsSum:0,currentEma2AbsValue:NaN,currentEma2AbsCount:0,currentEma2AbsSum:0});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevSource=l.currentSource,l.prevEma1PcValue=l.currentEma1PcValue,l.prevEma1PcCount=l.currentEma1PcCount,l.prevEma1PcSum=l.currentEma1PcSum,l.prevEma2PcValue=l.currentEma2PcValue,l.prevEma2PcCount=l.currentEma2PcCount,l.prevEma2PcSum=l.currentEma2PcSum,l.prevEma1AbsValue=l.currentEma1AbsValue,l.prevEma1AbsCount=l.currentEma1AbsCount,l.prevEma1AbsSum=l.currentEma1AbsSum,l.prevEma2AbsValue=l.currentEma2AbsValue,l.prevEma2AbsCount=l.currentEma2AbsCount,l.prevEma2AbsSum=l.currentEma2AbsSum),l.lastIdx=t.idx);const c=x.from(e).get(0);if(isNaN(c))return NaN;const h=isNaN(l.prevSource)?NaN:c-l.prevSource;if(l.currentSource=c,isNaN(h))return NaN;const p=Math.abs(h),u=2/(n+1),f=2/(a+1),m=2/(n+1),y=2/(a+1);let _=l.prevEma1PcCount,b=l.prevEma1PcSum,S=l.prevEma1PcValue;_++,_<=n?(b+=h,_===n&&(S=b/n)):S=h*u+S*(1-u);let v=l.prevEma1AbsCount,E=l.prevEma1AbsSum,N=l.prevEma1AbsValue;if(v++,v<=n?(E+=p,v===n&&(N=E/n)):N=p*m+N*(1-m),isNaN(S)||isNaN(N))return l.currentEma1PcCount=_,l.currentEma1PcSum=b,l.currentEma1PcValue=S,l.currentEma1AbsCount=v,l.currentEma1AbsSum=E,l.currentEma1AbsValue=N,NaN;let O=l.prevEma2PcCount,D=l.prevEma2PcSum,M=l.prevEma2PcValue;O++,O<=a?(D+=S,O===a&&(M=D/a)):M=S*f+M*(1-f);let q=l.prevEma2AbsCount,G=l.prevEma2AbsSum,K=l.prevEma2AbsValue;if(q++,q<=a?(G+=N,q===a&&(K=G/a)):K=N*y+K*(1-y),l.currentEma1PcCount=_,l.currentEma1PcSum=b,l.currentEma1PcValue=S,l.currentEma1AbsCount=v,l.currentEma1AbsSum=E,l.currentEma1AbsValue=N,l.currentEma2PcCount=O,l.currentEma2PcSum=D,l.currentEma2PcValue=M,l.currentEma2AbsCount=q,l.currentEma2AbsSum=G,l.currentEma2AbsValue=K,isNaN(M)||isNaN(K))return NaN;if(K===0)return t.precision(0);const pe=M/K;return t.precision(pe)}}function mu(t){return(e,i,r,s)=>{t.taState||(t.taState={});const a=s||"valuewhen";t.taState[a]||(t.taState[a]={lastIdx:-1,prevValues:[],currentValues:[]});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevValues=[...n.currentValues]),n.lastIdx=t.idx);const o=x.from(e).get(0),l=x.from(i).get(0),c=x.from(r).get(0),h=[...n.prevValues];if(o&&h.push(l),n.currentValues=h,isNaN(c)||c<0)return NaN;const p=h.length-1-c;if(p<0)return NaN;const u=h[p];return typeof u=="number"?t.precision(u):u}}function gu(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`variance_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;if(l.length<s&&(c>=s||t.idx>=s-1)){const m=x.from(e);for(;l.length<s;)l.push(m.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<s)return NaN;let h=0,p=0;for(let m=0;m<s;m++)h+=l[m],p+=l[m]*l[m];const u=h/s,f=p/s-u*u;return t.precision(f)}}function xu(t){return(e,i)=>{t.taState||(t.taState={});const r=i||"vwap";t.taState[r]||(t.taState[r]={lastIdx:-1,prevCumulativePV:0,prevCumulativeVolume:0,prevLastSessionDate:null,currentCumulativePV:0,currentCumulativeVolume:0,currentLastSessionDate:null});const s=t.taState[r];t.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevCumulativePV=s.currentCumulativePV,s.prevCumulativeVolume=s.currentCumulativeVolume,s.prevLastSessionDate=s.currentLastSessionDate),s.lastIdx=t.idx);const a=x.from(e).get(0),n=x.from(t.data.volume).get(0),o=x.from(t.data.openTime).get(0),l=new Date(o).toISOString().slice(0,10);let c=s.prevCumulativePV,h=s.prevCumulativeVolume,p=s.prevLastSessionDate;if(p!==l&&(c=0,h=0,p=l),c+=a*n,h+=n,s.currentCumulativePV=c,s.currentCumulativeVolume=h,s.currentLastSessionDate=p,h===0)return NaN;const u=c/h;return t.precision(u)}}function yu(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`vwma_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevVolumeWindow:[],currentWindow:[],currentVolumeWindow:[]});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevVolumeWindow=[...n.currentVolumeWindow]),n.lastIdx=t.idx);const o=x.from(e).get(0),l=t.get(t.data.volume,0),c=[...n.prevWindow],h=[...n.prevVolumeWindow];for(c.unshift(o),h.unshift(l);c.length>s;)c.pop(),h.pop();if(c.length<s&&t.idx>=s-1){const m=x.from(e),y=x.from(t.data.volume);for(;c.length<s;)c.push(m.get(c.length)),h.push(y.get(h.length))}if(n.currentWindow=c,n.currentVolumeWindow=h,c.length<s)return NaN;let p=0,u=0;for(let m=0;m<s;m++)p+=c[m]*h[m],u+=h[m];const f=p/u;return t.precision(f)}}function _u(t){return e=>{t.taState||(t.taState={});const i=e||"wad";t.taState[i]||(t.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=t.taState[i];t.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=t.idx);const s=t.get(t.data.close,0),a=t.get(t.data.high,0),n=t.get(t.data.low,0),o=t.get(t.data.close,1);if(isNaN(s)||isNaN(a)||isNaN(n))return r.currentCumulativeSum=r.prevCumulativeSum,t.precision(r.prevCumulativeSum);let l=0;if(!isNaN(o)){const h=Math.max(a,o),p=Math.min(n,o),u=s-o;u>0?l=s-p:u<0&&(l=s-h)}const c=r.prevCumulativeSum+l;return r.currentCumulativeSum=c,t.precision(c)}}function bu(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`wma_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;if(l.length<s&&(c>=s||t.idx>=s-1)){const f=x.from(e);for(;l.length<s;)l.push(f.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<s)return NaN;let h=0,p=0;for(let f=0;f<s;f++){const m=s-f;h+=l[f]*m,p+=m}const u=h/p;return t.precision(u)}}function vu(t){return(e,i)=>{const r=x.from(e).get(0);t.taState||(t.taState={});const s=i||`wpr_${r}`;t.taState[s]||(t.taState[s]={lastIdx:-1,prevHighWindow:[],prevLowWindow:[],currentHighWindow:[],currentLowWindow:[]});const a=t.taState[s];t.idx>a.lastIdx&&(a.lastIdx>=0&&(a.prevHighWindow=[...a.currentHighWindow],a.prevLowWindow=[...a.currentLowWindow]),a.lastIdx=t.idx);const n=t.get(t.data.high,0),o=t.get(t.data.low,0),l=t.get(t.data.close,0);if(isNaN(n)||isNaN(o)||isNaN(l))return a.currentHighWindow=[...a.prevHighWindow],a.currentLowWindow=[...a.prevLowWindow],NaN;const c=[...a.prevHighWindow],h=[...a.prevLowWindow];if(c.unshift(n),h.unshift(o),c.length>r&&(c.pop(),h.pop()),a.currentHighWindow=c,a.currentLowWindow=h,c.length<r)return NaN;let p=c[0],u=h[0];for(let y=1;y<r;y++)c[y]>p&&(p=c[y]),h[y]<u&&(u=h[y]);const f=p-u;if(f===0)return t.precision(0);const m=(p-l)/f*-100;return t.precision(m)}}function wu(t){return e=>{const i=t.get(t.data.close,0),r=t.get(t.data.open,0),s=t.get(t.data.high,0),a=t.get(t.data.low,0),n=t.get(t.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(a)||isNaN(n))return NaN;const o=s-a;if(o===0)return t.precision(0);const l=(i-r)/o*n;return t.precision(l)}}var Su=Object.defineProperty,Eu=(t,e,i)=>e in t?Su(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,I=(t,e,i)=>Eu(t,typeof e!="symbol"?e+"":e,i);const Nu={accdist:uh,alma:ph,atr:fh,barssince:dh,bb:mh,bbw:gh,cci:xh,change:yh,cmo:_h,cog:bh,correlation:vh,cross:wh,crossover:Sh,crossunder:Eh,cum:Nh,dev:Ch,dmi:Ih,ema:kh,falling:Ah,highest:Th,highestbars:Ph,hma:Dh,iii:Rh,kc:Oh,kcw:Vh,linreg:Mh,lowest:Lh,lowestbars:jh,macd:Bh,median:Fh,mfi:$h,mode:Wh,mom:Uh,nvi:qh,obv:Kh,param:zh,percentile_linear_interpolation:Hh,percentile_nearest_rank:Gh,percentrank:Yh,pivothigh:Xh,pivotlow:Jh,pvi:eu,pvt:tu,range:iu,rising:ru,rma:su,roc:nu,rsi:au,sar:ou,sma:lu,stdev:cu,stoch:hu,supertrend:uu,swma:pu,tr:fu,tsi:du,valuewhen:mu,variance:gu,vwap:xu,vwma:yu,wad:_u,wma:bu,wpr:vu,wvad:wu};class Cu{constructor(e){this.context=e,I(this,"accdist"),I(this,"alma"),I(this,"atr"),I(this,"barssince"),I(this,"bb"),I(this,"bbw"),I(this,"cci"),I(this,"change"),I(this,"cmo"),I(this,"cog"),I(this,"correlation"),I(this,"cross"),I(this,"crossover"),I(this,"crossunder"),I(this,"cum"),I(this,"dev"),I(this,"dmi"),I(this,"ema"),I(this,"falling"),I(this,"highest"),I(this,"highestbars"),I(this,"hma"),I(this,"iii"),I(this,"kc"),I(this,"kcw"),I(this,"linreg"),I(this,"lowest"),I(this,"lowestbars"),I(this,"macd"),I(this,"median"),I(this,"mfi"),I(this,"mode"),I(this,"mom"),I(this,"nvi"),I(this,"obv"),I(this,"param"),I(this,"percentile_linear_interpolation"),I(this,"percentile_nearest_rank"),I(this,"percentrank"),I(this,"pivothigh"),I(this,"pivotlow"),I(this,"pvi"),I(this,"pvt"),I(this,"range"),I(this,"rising"),I(this,"rma"),I(this,"roc"),I(this,"rsi"),I(this,"sar"),I(this,"sma"),I(this,"stdev"),I(this,"stoch"),I(this,"supertrend"),I(this,"swma"),I(this,"tr"),I(this,"tsi"),I(this,"valuewhen"),I(this,"variance"),I(this,"vwap"),I(this,"vwma"),I(this,"wad"),I(this,"wma"),I(this,"wpr"),I(this,"wvad"),Object.entries(Nu).forEach(([i,r])=>{this[i]=r(e)})}}function ei(t=new Date,e){const i=e??-t.getTimezoneOffset(),r=i>=0?"+":"-",s=n=>String(Math.floor(Math.abs(n))).padStart(2,"0"),a=r+s(i/60)+":"+s(i%60);return`[${t.toISOString().slice(0,-1)}${a}]`}class Iu{constructor(e){this.context=e}logFormat(e,...i){return e.replace(/{(\d+)}/g,(r,s)=>i[s])}param(e,i=0,r){return x.from(e).get(i)}warning(e,...i){if(this.context.isSecondaryContext)return;const r=this.context.data.openTime.data[this.context.idx],s=ei(new Date(r),0);console.warn(`${s} ${this.logFormat(e,...i)}`)}error(e,...i){if(this.context.isSecondaryContext)return;const r=this.context.data.openTime.data[this.context.idx],s=ei(new Date(r),0);console.error(`${s} ${this.logFormat(e,...i)}`)}info(e,...i){if(this.context.isSecondaryContext)return;const r=this.context.data.openTime.data[this.context.idx],s=ei(new Date(r),0);console.log(`${s} ${this.logFormat(e,...i)}`)}}class ku{constructor(e){this.context=e}param(e,i=0,r){return x.from(e).get(i)}tostring(e,i){if(i==="mintick"&&typeof e=="number"){const r=this.context.pine?.syminfo?.mintick||.01,s=Math.max(0,-Math.floor(Math.log10(r)));return e.toFixed(s)}return String(e)}tonumber(e){return Number(e)}lower(e){return String(e).toLowerCase()}upper(e){return String(e).toUpperCase()}trim(e){return String(e).trim()}repeat(e,i,r=""){return Array(i).fill(e).join(r||"")}replace_all(e,i,r){return String(e).replaceAll(i,r)}replace(e,i,r,s=0){const a=String(e),n=String(i),o=String(r),l=Math.floor(Number(s))||0;if(n==="")return a;let c=0,h=0;for(;;){const p=a.indexOf(n,c);if(p===-1)return a;if(h===l)return a.substring(0,p)+o+a.substring(p+n.length);h++,c=p+n.length}}contains(e,i){return String(e).includes(i)}endswith(e,i){return String(e).endsWith(i)}startswith(e,i){return String(e).startsWith(i)}pos(e,i){const r=String(e).indexOf(i);return r===-1?NaN:r}length(e){return String(e).length}match(e,i){return String(e).match(new RegExp(i))}split(e,i){return[String(e).split(i)]}substring(e,i,r){return String(e).substring(i,r)}format(e,...i){return e.replace(/{(\d+)}/g,(r,s)=>i[s])}}class Au{constructor(e){this.context=e}param(e,i=0,r){return x.from(e).get(i)}get main_period(){return this.context.timeframe}get period(){return this.context.timeframe}get multiplier(){const e=parseInt(this.context.timeframe);return isNaN(e)?1:e}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(e){return e<60?Math.ceil(e/5)*5+"S":e<3600*24?Math.ceil(e/60):e<=3600*24*7*52?e%(3600*24*7)===0?Math.ceil(e/604800)+"W":Math.ceil(e/(3600*24))+"D":"12M"}in_seconds(e){const i=parseInt(e),r=e.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 Ji=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],Tu=["series","title","style","location","color","offset","text","textcolor","editable","size","show_last","display","format","precision","force_overlay"],Pu=["series","title","colorup","colordown","offset","minheight","maxheight","editable","show_last","display","format","precision","force_overlay"],Du=["open","high","low","close","title","color","editable","show_last","display","format","precision","force_overlay"],Ru=["open","high","low","close","title","color","wickcolor","editable","show_last","bordercolor","display","format","precision","force_overlay"],er=["color","offset","editable","show_last","title","display","force_overlay"],Ou=["price","title","color","linestyle","linewidth","editable","display"],Vu=["plot1","plot2","color","title","editable","show_last","fillgaps","display"],tr={series:"series",title:"string",color:"series",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"},Mu={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"},Lu={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"},ju={open:"series",high:"series",low:"series",close:"series",title:"string",color:"string",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"},Bu={open:"series",high:"series",low:"series",close:"series",title:"string",color:"string",wickcolor:"string",bordercolor:"string",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"},ir={color:"string",offset:"number",editable:"boolean",show_last:"number",title:"string",display:"string",force_overlay:"boolean"},Fu={price:"series",title:"string",color:"string",linestyle:"string",linewidth:"number",editable:"boolean",display:"string"},$u={plot1:"object",plot2:"object",color:"string",title:"string",editable:"boolean",show_last:"number",fillgaps:"boolean",display:"string"};class Wu{constructor(e){this.context=e}_resolvePlotKey(e,i){if(e){const r=this.context.plots[e];return!r||!i||r._callsiteId===i?e:e+i}return i||"plot"}extractPlotOptions(e){const i={};for(let r in e)i[r]=x.from(e[r]).get(0);return i}get linestyle_dashed(){return"linestyle_dashed"}get linestyle_dotted(){return"linestyle_dotted"}get linestyle_solid(){return"linestyle_solid"}get style_area(){return"style_area"}get style_areabr(){return"style_areabr"}get style_circles(){return"style_circles"}get style_columns(){return"style_columns"}get style_cross(){return"style_cross"}get style_histogram(){return"style_histogram"}get style_line(){return"style_line"}get style_linebr(){return"style_linebr"}get style_stepline(){return"style_stepline"}get style_stepline_diamond(){return"style_stepline_diamond"}get style_steplinebr(){return"style_steplinebr"}param(e,i=0,r){return x.from(e).get(i)}plotchar(...e){const i=Me(e),r=te(e,Ji,tr),{series:s,title:a,...n}=r,o=this.extractPlotOptions(n),l=this._resolvePlotKey(a,i);this.context.plots[l]||(this.context.plots[l]={data:[],options:{...o,style:"char"},title:a,_plotKey:l,_callsiteId:i});const c=x.from(s).get(0);return this.context.plots[l].data.push({title:a,time:this.context.marketData[this.context.idx].openTime,value:c}),this.context.plots[l]}any(...e){const i=Me(e),r=te(e,Ji,tr),{series:s,title:a,...n}=r,o=this.extractPlotOptions(n),l=this._resolvePlotKey(a,i);if(!this.context.plots[l]){const u=o.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[l]={data:[],options:{...o,overlay:u},title:a,_plotKey:l,_callsiteId:i}}const c=x.from(s).get(0),h=o.color,p={color:"color"in n?typeof h=="string"?h:void 0:h||"#2962ff"};return"offset"in n&&(p.offset=o.offset),this.context.plots[l].data.push({title:a,time:this.context.marketData[this.context.idx].openTime,value:c,options:p}),this.context.plots[l]}plotshape(...e){const i=Me(e),r=te(e,Tu,Mu),{series:s,title:a,...n}=r,o=this.extractPlotOptions(n),l=this._resolvePlotKey(a,i);if(!this.context.plots[l]){const h=o.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[l]={data:[],options:{...o,style:"shape",shape:o.style,overlay:h},title:a,_plotKey:l,_callsiteId:i}}const c=x.from(s).get(0);return this.context.plots[l].data.push({title:a,time:this.context.marketData[this.context.idx].openTime,value:c,options:o?.location==="absolute"||c?{text:o.text,textcolor:o.textcolor,color:o.color,offset:o.offset,shape:o.style,location:o.location,size:o.size}:void 0}),this.context.plots[l]}plotarrow(...e){const i=Me(e),r=te(e,Pu,Lu),{series:s,title:a,...n}=r,o=x.from(s).get(0),l=this.extractPlotOptions(n),c=this._resolvePlotKey(a,i);if(!this.context.plots[c]){const h=l.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[c]={data:[],options:{...l,style:"shape",overlay:h},title:a,_plotKey:c,_callsiteId:i}}return this.context.plots[c].data.push({title:a,time:this.context.marketData[this.context.idx].openTime,value:o,options:typeof o=="number"&&!isNaN(o)&&o!==0?{text:void 0,textcolor:void 0,color:o>0?l.colorup:l.colordown,offset:l.offset,shape:o>0?"shape_arrow_up":"shape_arrow_down",location:o>0?"BelowBar":"AboveBar",height:l.maxheight}:void 0}),this.context.plots[c]}plotbar(...e){const i=Me(e),r=te(e,Du,ju),{open:s,high:a,low:n,close:o,title:l,...c}=r,h=this.extractPlotOptions(c),p=this._resolvePlotKey(l,i);if(!this.context.plots[p]){const f=h.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[p]={data:[],options:{...h,style:"bar",overlay:f},title:l,_plotKey:p,_callsiteId:i}}const u=[x.from(s).get(0),x.from(a).get(0),x.from(n).get(0),x.from(o).get(0)];this.context.plots[p].data.push({title:l,time:this.context.marketData[this.context.idx].openTime,value:u,options:{color:h.color}})}plotcandle(...e){const i=Me(e),r=te(e,Ru,Bu),{open:s,high:a,low:n,close:o,title:l,...c}=r,h=this.extractPlotOptions(c),p=this._resolvePlotKey(l,i);if(!this.context.plots[p]){const f=h.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[p]={data:[],options:{...h,style:"candle",overlay:f},title:l,_plotKey:p,_callsiteId:i}}const u=[x.from(s).get(0),x.from(a).get(0),x.from(n).get(0),x.from(o).get(0)];return this.context.plots[p].data.push({title:l,time:this.context.marketData[this.context.idx].openTime,value:u,options:{color:h.color,wickcolor:h.wickcolor,bordercolor:h.bordercolor}}),this.context.plots[p]}bgcolor(...e){const i=Me(e),r=te(e,er,ir),{title:s,...a}=r,n=this.extractPlotOptions(a),o=this._resolvePlotKey(s,i);if(!this.context.plots[o]){const l=n.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[o]={data:[],options:{...n,style:"background",overlay:l},title:s,_plotKey:o,_callsiteId:i}}this.context.plots[o].data.push({title:s,time:this.context.marketData[this.context.idx].openTime,value:n.color&&n.color!=="na"&&n?.color.toString()!=="NaN",options:{color:n.color}})}barcolor(...e){const i=Me(e),r=te(e,er,ir),{title:s,...a}=r,n=this.extractPlotOptions(a),o=this._resolvePlotKey(s,i);return this.context.plots[o]||(this.context.plots[o]={data:[],options:{...n,style:"barcolor"},title:s,_plotKey:o,_callsiteId:i}),this.context.plots[o].data.push({title:s,time:this.context.marketData[this.context.idx].openTime,value:n.color&&n.color!=="na"&&n?.color.toString()!=="NaN",options:{color:n.color}}),this.context.plots[o]}}class Uu{constructor(e){this.context=e}get style_dashed(){return"dashed"}get style_solid(){return"solid"}get style_dotted(){return"dotted"}param(e,i=0,r){return x.from(e).get(i)}any(...e){const i=Me(e),r=te(e,Ou,Fu),{price:s,title:a,color:n,linestyle:o,linewidth:l,editable:c,display:h}=r,p=[s,{title:a,color:n,linestyle:o,linewidth:l,editable:c,display:h,style:"hline"}];return i&&p.push({__callsiteId:i}),this.context.pine.plot.any(...p)}}class qu{constructor(e){this.context=e}param(e,i=0,r){return x.from(e).get(i)}any(...e){const i=Me(e),r=te(e,Vu,$u),{plot1:s,plot2:a,color:n,title:o,editable:l,show_last:c,fillgaps:h,display:p}=r;let u=o||"fill";const f=this.context.plots[u];if(f&&i&&f._callsiteId!==i&&(u=i),!this.context.plots[u]){const m=s?._plotKey||s?.title,y=a?._plotKey||a?.title;this.context.plots[u]={title:o||"Fill",plot1:m,plot2:y,options:{plot1:m,plot2:y,color:n,editable:l,show_last:c,fillgaps:h,display:p,style:"fill"},_plotKey:u,_callsiteId:i}}}}var Ku=Object.defineProperty,zu=(t,e,i)=>e in t?Ku(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Hu=(t,e,i)=>zu(t,typeof e!="symbol"?e+"":e,i);class Gu{constructor(e){this.context=e,Hu(this,"point");const i=this.context;this.point={new(r,s,a){return new me(r,s,a??NaN)},from_index(r,s){return new me(void 0,r,s)},from_time(r,s){return new me(r,void 0,s)},copy(r){return r.copy()},now(r){const s=i.idx,a=i.marketData[s]?.openTime;return new me(a,s,r)}}}param(e,i=0,r){return x.from(e).get(i)}bg_color(){return"#1e293b"}fg_color(){return"#ffffff"}is_standard(){return!0}is_heikinashi(){return!1}is_kagi(){return!1}is_linebreak(){return!1}is_pnf(){return!1}is_range(){return!1}is_renko(){return!1}}var Yu=Object.defineProperty,Qu=(t,e,i)=>e in t?Yu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,he=(t,e,i)=>Qu(t,typeof e!="symbol"?e+"":e,i);let Xu=0;class Si{constructor(e,i,r="",s="bi",a="pr",n="",o="style_label_down",l="",c="normal",h="center",p="",u="default",f=!1){he(this,"id"),he(this,"x"),he(this,"y"),he(this,"text"),he(this,"xloc"),he(this,"yloc"),he(this,"color"),he(this,"style"),he(this,"textcolor"),he(this,"size"),he(this,"textalign"),he(this,"tooltip"),he(this,"text_font_family"),he(this,"force_overlay"),he(this,"_deleted"),this.id=Xu++,this.x=e,this.y=i,this.text=r,this.xloc=s,this.yloc=a,this.color=n,this.style=o,this.textcolor=l,this.size=c,this.textalign=h,this.tooltip=p,this.text_font_family=u,this.force_overlay=f,this._deleted=!1}delete(){this._deleted=!0}copy(){return new Si(this.x,this.y,this.text,this.xloc,this.yloc,this.color,this.style,this.textcolor,this.size,this.textalign,this.tooltip,this.text_font_family,this.force_overlay)}toPlotData(){return{id:this.id,x:this.x,y:this.y,text:this.text,xloc:this.xloc,yloc:this.yloc,color:this.color,style:this.style,textcolor:this.textcolor,size:this.size,textalign:this.textalign,tooltip:this.tooltip,text_font_family:this.text_font_family,force_overlay:this.force_overlay}}}var Zu=Object.defineProperty,Ju=(t,e,i)=>e in t?Zu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ep=(t,e,i)=>Ju(t,typeof e!="symbol"?e+"":e,i);const tp=[["x","y","text","xloc","yloc","color","style","textcolor","size","textalign","tooltip","text_font_family","force_overlay"],["point","text","xloc","yloc","color","style","textcolor","size","textalign","tooltip","text_font_family","force_overlay"]],ip={x:"number",y:"number",text:"string",xloc:"string",yloc:"string",color:"string",style:"string",textcolor:"string",size:"string",textalign:"string",tooltip:"string",text_font_family:"string",force_overlay:"boolean",point:"point"};class rp{constructor(e){this.context=e,ep(this,"_labels",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__labels__||(this.context.plots.__labels__={title:"__labels__",data:[],options:{style:"label",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__labels__.data=[{time:e,value:this._labels,options:{style:"label"}}]}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}_createLabel(e,i,r="",s="bi",a="pr",n="",o="style_label_down",l="",c="normal",h="center",p="",u="default",f=!1){const m=new Si(e,i,this._resolve(r),this._resolve(s),this._resolve(a),this._resolve(n),this._resolve(o),this._resolve(l),this._resolve(c),this._resolve(h),this._resolve(p),this._resolve(u),f);return this._labels.push(m),this._syncToPlot(),m}new(...e){const i=te(e,tp,ip);let r,s,a=i.xloc;if(i.point instanceof me){const n=i.point;n.index!==void 0?(r=n.index,a=a||"bi"):n.time!==void 0?(r=n.time,a=a||"bt"):(r=0,a=a||"bi"),s=n.price}else r=i.x,s=i.y;return this._createLabel(r,s,i.text,a,i.yloc,i.color,i.style,i.textcolor,i.size,i.textalign,i.tooltip,i.text_font_family,i.force_overlay)}any(...e){return this.new(...e)}set_x(e,i){e&&!e._deleted&&(e.x=i)}set_y(e,i){e&&!e._deleted&&(e.y=i)}set_xy(e,i,r){e&&!e._deleted&&(e.x=i,e.y=r)}set_text(e,i){e&&!e._deleted&&(e.text=i)}set_color(e,i){e&&!e._deleted&&(e.color=i)}set_textcolor(e,i){e&&!e._deleted&&(e.textcolor=i)}set_size(e,i){e&&!e._deleted&&(e.size=i)}set_style(e,i){e&&!e._deleted&&(e.style=i)}set_textalign(e,i){e&&!e._deleted&&(e.textalign=i)}set_tooltip(e,i){e&&!e._deleted&&(e.tooltip=i)}set_xloc(e,i){e&&!e._deleted&&(e.xloc=i)}set_yloc(e,i){e&&!e._deleted&&(e.yloc=i)}set_point(e,i){e&&!e._deleted&&i&&(i.index!==void 0?(e.x=i.index,e.xloc="bi"):i.time!==void 0&&(e.x=i.time,e.xloc="bt"),e.y=i.price)}get_x(e){return e?e.x:NaN}get_y(e){return e?e.y:NaN}get_text(e){return e?e.text:""}copy(e){if(!e)return;const i=e.copy();return this._labels.push(i),this._syncToPlot(),i}delete(e){e&&(e._deleted=!0)}get all(){return this._labels.filter(e=>!e._deleted)}get style_label_down(){return"style_label_down"}get style_label_up(){return"style_label_up"}get style_label_left(){return"style_label_left"}get style_label_right(){return"style_label_right"}get style_label_lower_left(){return"style_label_lower_left"}get style_label_lower_right(){return"style_label_lower_right"}get style_label_upper_left(){return"style_label_upper_left"}get style_label_upper_right(){return"style_label_upper_right"}get style_label_center(){return"style_label_center"}get style_circle(){return"style_circle"}get style_square(){return"style_square"}get style_diamond(){return"style_diamond"}get style_flag(){return"style_flag"}get style_arrowup(){return"style_arrowup"}get style_arrowdown(){return"style_arrowdown"}get style_cross(){return"style_cross"}get style_xcross(){return"style_xcross"}get style_triangleup(){return"style_triangleup"}get style_triangledown(){return"style_triangledown"}get style_none(){return"style_none"}get style_text_outline(){return"style_text_outline"}}var sp=Object.defineProperty,np=(t,e,i)=>e in t?sp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ee=(t,e,i)=>np(t,typeof e!="symbol"?e+"":e,i);let ap=0;class Ei{constructor(e,i,r,s,a="bi",n="none",o="",l="style_solid",c=1,h=!1){Ee(this,"id"),Ee(this,"x1"),Ee(this,"y1"),Ee(this,"x2"),Ee(this,"y2"),Ee(this,"xloc"),Ee(this,"extend"),Ee(this,"color"),Ee(this,"style"),Ee(this,"width"),Ee(this,"force_overlay"),Ee(this,"_deleted"),this.id=ap++,this.x1=e,this.y1=i,this.x2=r,this.y2=s,this.xloc=a,this.extend=n,this.color=o,this.style=l,this.width=c,this.force_overlay=h,this._deleted=!1}delete(){this._deleted=!0}copy(){return new Ei(this.x1,this.y1,this.x2,this.y2,this.xloc,this.extend,this.color,this.style,this.width,this.force_overlay)}toPlotData(){return{id:this.id,x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2,xloc:this.xloc,extend:this.extend,color:this.color,style:this.style,width:this.width,force_overlay:this.force_overlay}}}var op=Object.defineProperty,lp=(t,e,i)=>e in t?op(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,cp=(t,e,i)=>lp(t,typeof e!="symbol"?e+"":e,i);const hp=[["x1","y1","x2","y2","xloc","extend","color","style","width","force_overlay"],["first_point","second_point","xloc","extend","color","style","width","force_overlay"]],up={x1:"number",y1:"number",x2:"number",y2:"number",xloc:"string",extend:"string",color:"string",style:"string",width:"number",force_overlay:"boolean",first_point:"point",second_point:"point"};class pp{constructor(e){this.context=e,cp(this,"_lines",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__lines__||(this.context.plots.__lines__={title:"__lines__",data:[],options:{style:"drawing_line",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__lines__.data=[{time:e,value:this._lines,options:{style:"drawing_line"}}]}_resolvePoint(e){return e.index!==void 0?{x:e.index,xloc:"bi"}:e.time!==void 0?{x:e.time,xloc:"bt"}:{x:0,xloc:"bi"}}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}_createLine(e,i,r,s,a="bi",n="none",o="",l="style_solid",c=1,h=!1){const p=new Ei(e,i,r,s,a,this._resolve(n),this._resolve(o),this._resolve(l),this._resolve(c)||1,h);return this._lines.push(p),this._syncToPlot(),p}new(...e){const i=te(e,hp,up);let r,s,a,n,o=i.xloc;if(i.first_point instanceof me){const l=i.first_point,c=i.second_point,h=this._resolvePoint(l);r=h.x,s=l.price,o=o||h.xloc,c instanceof me?(a=this._resolvePoint(c).x,n=c.price):(a=0,n=NaN)}else r=i.x1,s=i.y1,a=i.x2,n=i.y2;return this._createLine(r,s,a,n,o,i.extend,i.color,i.style,i.width,i.force_overlay)}any(...e){return this.new(...e)}set_x1(e,i){e&&!e._deleted&&(e.x1=i)}set_y1(e,i){e&&!e._deleted&&(e.y1=i)}set_x2(e,i){e&&!e._deleted&&(e.x2=i)}set_y2(e,i){e&&!e._deleted&&(e.y2=i)}set_xy1(e,i,r){e&&!e._deleted&&(e.x1=i,e.y1=r)}set_xy2(e,i,r){e&&!e._deleted&&(e.x2=i,e.y2=r)}set_color(e,i){e&&!e._deleted&&(e.color=this._resolve(i))}set_width(e,i){e&&!e._deleted&&(e.width=this._resolve(i)||1)}set_style(e,i){e&&!e._deleted&&(e.style=this._resolve(i))}set_extend(e,i){e&&!e._deleted&&(e.extend=this._resolve(i))}set_xloc(e,i,r,s){e&&!e._deleted&&(e.x1=i,e.x2=r,e.xloc=s)}set_first_point(e,i){if(e&&!e._deleted&&i){const r=this._resolvePoint(i);e.x1=r.x,e.y1=i.price,e.xloc=r.xloc}}set_second_point(e,i){if(e&&!e._deleted&&i){const r=this._resolvePoint(i);e.x2=r.x,e.y2=i.price,e.xloc=r.xloc}}get_x1(e){return e?e.x1:NaN}get_y1(e){return e?e.y1:NaN}get_x2(e){return e?e.x2:NaN}get_y2(e){return e?e.y2:NaN}get_price(e,i){if(!e||e._deleted)return NaN;if(e.xloc!=="bi")return NaN;const r=e.x2-e.x1;return r===0?e.y1:e.y1+(i-e.x1)/r*(e.y2-e.y1)}copy(e){if(!e)return;const i=e.copy();return this._lines.push(i),this._syncToPlot(),i}delete(e){e&&(e._deleted=!0)}get all(){return this._lines.filter(e=>!e._deleted)}get style_solid(){return"style_solid"}get style_dotted(){return"style_dotted"}get style_dashed(){return"style_dashed"}get style_arrow_left(){return"style_arrow_left"}get style_arrow_right(){return"style_arrow_right"}get style_arrow_both(){return"style_arrow_both"}}var fp=Object.defineProperty,dp=(t,e,i)=>e in t?fp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Q=(t,e,i)=>dp(t,typeof e!="symbol"?e+"":e,i);let mp=0;class Ni{constructor(e,i,r,s,a="bi",n="none",o="#2962ff",l="style_solid",c=1,h="#2962ff",p="",u="#000000",f="auto",m="center",y="center",_="wrap_none",b="default",S="format_none",v=!1){Q(this,"id"),Q(this,"left"),Q(this,"top"),Q(this,"right"),Q(this,"bottom"),Q(this,"xloc"),Q(this,"extend"),Q(this,"border_color"),Q(this,"border_style"),Q(this,"border_width"),Q(this,"bgcolor"),Q(this,"text"),Q(this,"text_color"),Q(this,"text_size"),Q(this,"text_halign"),Q(this,"text_valign"),Q(this,"text_wrap"),Q(this,"text_font_family"),Q(this,"text_formatting"),Q(this,"force_overlay"),Q(this,"_deleted"),this.id=mp++,this.left=e,this.top=i,this.right=r,this.bottom=s,this.xloc=a,this.extend=n,this.border_color=o,this.border_style=l,this.border_width=c,this.bgcolor=h,this.text=p,this.text_color=u,this.text_size=f,this.text_halign=m,this.text_valign=y,this.text_wrap=_,this.text_font_family=b,this.text_formatting=S,this.force_overlay=v,this._deleted=!1}delete(){this._deleted=!0}copy(){return new Ni(this.left,this.top,this.right,this.bottom,this.xloc,this.extend,this.border_color,this.border_style,this.border_width,this.bgcolor,this.text,this.text_color,this.text_size,this.text_halign,this.text_valign,this.text_wrap,this.text_font_family,this.text_formatting,this.force_overlay)}}var gp=Object.defineProperty,xp=(t,e,i)=>e in t?gp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,yp=(t,e,i)=>xp(t,typeof e!="symbol"?e+"":e,i);const _p=[["left","top","right","bottom","border_color","border_width","border_style","extend","xloc","bgcolor","text","text_size","text_color","text_halign","text_valign","text_wrap","text_font_family","force_overlay"],["top_left","bottom_right","border_color","border_width","border_style","extend","xloc","bgcolor","text","text_size","text_color","text_halign","text_valign","text_wrap","text_font_family","force_overlay"]],bp={left:"number",top:"number",right:"number",bottom:"number",top_left:"point",bottom_right:"point",border_color:"string",border_width:"number",border_style:"string",extend:"string",xloc:"string",bgcolor:"string",text:"string",text_size:"string",text_color:"string",text_halign:"string",text_valign:"string",text_wrap:"string",text_font_family:"string",force_overlay:"boolean"};class vp{constructor(e){this.context=e,yp(this,"_boxes",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__boxes__||(this.context.plots.__boxes__={title:"__boxes__",data:[],options:{style:"drawing_box",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__boxes__.data=[{time:e,value:this._boxes,options:{style:"drawing_box"}}]}_resolvePoint(e){return e.index!==void 0?{x:e.index,xloc:"bi"}:e.time!==void 0?{x:e.time,xloc:"bt"}:{x:0,xloc:"bi"}}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}_createBox(e,i,r,s,a="bi",n="none",o="#2962ff",l="style_solid",c=1,h="#2962ff",p="",u="#000000",f="auto",m="center",y="center",_="wrap_none",b="default",S="format_none",v=!1){const E=new Ni(e,i,r,s,a,this._resolve(n),this._resolve(o)||"#2962ff",this._resolve(l)||"style_solid",this._resolve(c)??1,this._resolve(h)||"#2962ff",this._resolve(p)||"",this._resolve(u)||"#000000",this._resolve(f)||"auto",this._resolve(m)||"center",this._resolve(y)||"center",this._resolve(_)||"wrap_none",this._resolve(b)||"default",this._resolve(S)||"format_none",v);return this._boxes.push(E),this._syncToPlot(),E}new(...e){const i=te(e,_p,bp);let r,s,a,n,o=i.xloc;if(i.top_left instanceof me){const l=i.top_left,c=i.bottom_right,h=this._resolvePoint(l);r=h.x,s=l.price,o=o||h.xloc,c instanceof me?(a=this._resolvePoint(c).x,n=c.price):(a=0,n=NaN)}else r=this._resolve(i.left),s=this._resolve(i.top),a=this._resolve(i.right),n=this._resolve(i.bottom);return this._createBox(r,s,a,n,o,i.extend,i.border_color,i.border_style,i.border_width,i.bgcolor,i.text,i.text_color,i.text_size,i.text_halign,i.text_valign,i.text_wrap,i.text_font_family,void 0,i.force_overlay)}any(...e){return this.new(...e)}set_left(e,i){e&&!e._deleted&&(e.left=i)}set_right(e,i){e&&!e._deleted&&(e.right=i)}set_top(e,i){e&&!e._deleted&&(e.top=i)}set_bottom(e,i){e&&!e._deleted&&(e.bottom=i)}set_lefttop(e,i,r){e&&!e._deleted&&(e.left=i,e.top=r)}set_rightbottom(e,i,r){e&&!e._deleted&&(e.right=i,e.bottom=r)}set_top_left_point(e,i){if(e&&!e._deleted&&i){const r=this._resolvePoint(i);e.left=r.x,e.top=i.price,e.xloc=r.xloc}}set_bottom_right_point(e,i){if(e&&!e._deleted&&i){const r=this._resolvePoint(i);e.right=r.x,e.bottom=i.price,e.xloc=r.xloc}}set_xloc(e,i,r,s){e&&!e._deleted&&(e.left=i,e.right=r,e.xloc=s)}set_bgcolor(e,i){e&&!e._deleted&&(e.bgcolor=this._resolve(i))}set_border_color(e,i){e&&!e._deleted&&(e.border_color=this._resolve(i))}set_border_width(e,i){e&&!e._deleted&&(e.border_width=this._resolve(i)??1)}set_border_style(e,i){e&&!e._deleted&&(e.border_style=this._resolve(i))}set_extend(e,i){e&&!e._deleted&&(e.extend=this._resolve(i))}set_text(e,i){e&&!e._deleted&&(e.text=this._resolve(i)||"")}set_text_color(e,i){e&&!e._deleted&&(e.text_color=this._resolve(i))}set_text_size(e,i){e&&!e._deleted&&(e.text_size=this._resolve(i))}set_text_halign(e,i){e&&!e._deleted&&(e.text_halign=this._resolve(i))}set_text_valign(e,i){e&&!e._deleted&&(e.text_valign=this._resolve(i))}set_text_wrap(e,i){e&&!e._deleted&&(e.text_wrap=this._resolve(i))}set_text_font_family(e,i){e&&!e._deleted&&(e.text_font_family=this._resolve(i))}set_text_formatting(e,i){e&&!e._deleted&&(e.text_formatting=this._resolve(i))}get_left(e){return e?e.left:NaN}get_right(e){return e?e.right:NaN}get_top(e){return e?e.top:NaN}get_bottom(e){return e?e.bottom:NaN}copy(e){if(!e)return;const i=e.copy();return this._boxes.push(i),this._syncToPlot(),i}delete(e){e&&(e._deleted=!0)}get all(){return this._boxes.filter(e=>!e._deleted)}}var wp=Object.defineProperty,Sp=(t,e,i)=>e in t?wp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,bt=(t,e,i)=>Sp(t,typeof e!="symbol"?e+"":e,i);let Ep=0;class Np{constructor(e,i,r){bt(this,"id"),bt(this,"line1"),bt(this,"line2"),bt(this,"color"),bt(this,"_deleted"),this.id=Ep++,this.line1=e,this.line2=i,this.color=r,this._deleted=!1}delete(){this._deleted=!0}}var Cp=Object.defineProperty,Ip=(t,e,i)=>e in t?Cp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,kp=(t,e,i)=>Ip(t,typeof e!="symbol"?e+"":e,i);class Ap{constructor(e){this.context=e,kp(this,"_linefills",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__linefills__||(this.context.plots.__linefills__={title:"__linefills__",data:[],options:{style:"linefill",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__linefills__.data=[{time:e,value:this._linefills,options:{style:"linefill"}}]}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}new(e,i,r){const s=this._resolve(r)||"",a=new Np(e,i,s);return this._linefills.push(a),this._syncToPlot(),a}any(...e){return this.new(e[0],e[1],e[2])}set_color(e,i){e&&!e._deleted&&(e.color=this._resolve(i)||"")}get_line1(e){return e?e.line1:void 0}get_line2(e){return e?e.line2:void 0}delete(e){e&&(e._deleted=!0)}get all(){return this._linefills.filter(e=>!e._deleted)}}var Tp=Object.defineProperty,Pp=(t,e,i)=>e in t?Tp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Te=(t,e,i)=>Pp(t,typeof e!="symbol"?e+"":e,i);let Dp=0;class Rp{constructor(e,i=!1,r=!1,s="bi",a="#2962ff",n="",o="style_solid",l=1,c=!1){Te(this,"id"),Te(this,"points"),Te(this,"curved"),Te(this,"closed"),Te(this,"xloc"),Te(this,"line_color"),Te(this,"fill_color"),Te(this,"line_style"),Te(this,"line_width"),Te(this,"force_overlay"),Te(this,"_deleted"),this.id=Dp++,this.points=e,this.curved=i,this.closed=r,this.xloc=s,this.line_color=a,this.fill_color=n,this.line_style=o,this.line_width=l,this.force_overlay=c,this._deleted=!1}delete(){this._deleted=!0}}var Op=Object.defineProperty,Vp=(t,e,i)=>e in t?Op(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Mp=(t,e,i)=>Vp(t,typeof e!="symbol"?e+"":e,i);class Lp{constructor(e){this.context=e,Mp(this,"_polylines",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__polylines__||(this.context.plots.__polylines__={title:"__polylines__",data:[],options:{style:"drawing_polyline",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__polylines__.data=[{time:e,value:this._polylines,options:{style:"drawing_polyline"}}]}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}_extractPoints(e){let i=this._resolve(e);const r=i&&i.array?i.array:i;return Array.isArray(r)?r.filter(s=>s instanceof me):[]}new(...e){let i,r=!1,s=!1,a="bi",n="#2962ff",o="",l="style_solid",c=1,h=!1;const p=y=>y&&typeof y=="object"&&!Array.isArray(y)&&("points"in y||"curved"in y||"closed"in y||"line_color"in y||"fill_color"in y||"line_style"in y||"line_width"in y),u=y=>{r=y.curved??r,s=y.closed??s,a=y.xloc??a,n=y.line_color??n,o=y.fill_color??o,l=y.line_style??l,c=y.line_width??c,h=y.force_overlay??h};e.length===1&&p(e[0])&&"points"in e[0]?(i=e[0].points,u(e[0])):e.length===2&&e[1]&&typeof e[1]=="object"&&!Array.isArray(e[1])&&p(e[1])?(i=e[0],u(e[1])):(i=e[0],r=e[1]??r,s=e[2]??s,a=e[3]??a,n=e[4]??n,o=e[5]??o,l=e[6]??l,c=e[7]??c,h=e[8]??h);const f=this._extractPoints(i),m=new Rp(f,this._resolve(r)??!1,this._resolve(s)??!1,this._resolve(a)||"bi",this._resolve(n)||"#2962ff",this._resolve(o)||"",this._resolve(l)||"style_solid",this._resolve(c)||1,this._resolve(h)??!1);return this._polylines.push(m),this._syncToPlot(),m}any(...e){return this.new(...e)}delete(e){e&&(e._deleted=!0)}get all(){return this._polylines.filter(e=>!e._deleted)}}var jp=Object.defineProperty,Bp=(t,e,i)=>e in t?jp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,de=(t,e,i)=>Bp(t,typeof e!="symbol"?e+"":e,i);let Fp=0;class $p{constructor(e="top_right",i=1,r=1,s="",a="",n=0,o="",l=0,c=!1){de(this,"id"),de(this,"position"),de(this,"columns"),de(this,"rows"),de(this,"bgcolor"),de(this,"frame_color"),de(this,"frame_width"),de(this,"border_color"),de(this,"border_width"),de(this,"force_overlay"),de(this,"_deleted"),de(this,"cells"),de(this,"merges"),de(this,"_helper"),this.id=Fp++,this.position=e,this.columns=i,this.rows=r,this.bgcolor=s,this.frame_color=a,this.frame_width=n,this.border_color=o,this.border_width=l,this.force_overlay=c,this._deleted=!1,this.merges=[],this.cells=[];for(let h=0;h<r;h++){this.cells[h]=[];for(let p=0;p<i;p++)this.cells[h][p]=null}}delete(){this._deleted=!0}setCell(e,i,r){if(i<0||i>=this.rows||e<0||e>=this.columns)return;const s=this.cells[i][e];if(s&&s._merged&&s._merge_parent){const[n,o]=s._merge_parent;this.setCell(n,o,r);return}const a=s||this._defaultCell();Object.assign(a,r),this.cells[i][e]=a}getCell(e,i){return i<0||i>=this.rows||e<0||e>=this.columns?null:this.cells[i][e]}clearCell(e,i){i<0||i>=this.rows||e<0||e>=this.columns||(this.cells[i][e]=null)}_setHelper(e){this._helper=e}cell(...e){return this._helper.cell(this,...e)}clear(...e){return this._helper.clear(this,...e)}merge_cells(...e){return this._helper.merge_cells(this,...e)}cell_set_text(...e){return this._helper.cell_set_text(this,...e)}cell_set_bgcolor(...e){return this._helper.cell_set_bgcolor(this,...e)}cell_set_text_color(...e){return this._helper.cell_set_text_color(this,...e)}cell_set_text_size(...e){return this._helper.cell_set_text_size(this,...e)}cell_set_height(...e){return this._helper.cell_set_height(this,...e)}cell_set_width(...e){return this._helper.cell_set_width(this,...e)}cell_set_tooltip(...e){return this._helper.cell_set_tooltip(this,...e)}cell_set_text_halign(...e){return this._helper.cell_set_text_halign(this,...e)}cell_set_text_valign(...e){return this._helper.cell_set_text_valign(this,...e)}cell_set_text_font_family(...e){return this._helper.cell_set_text_font_family(this,...e)}set_position(...e){return this._helper.set_position(this,...e)}set_bgcolor(...e){return this._helper.set_bgcolor(this,...e)}set_border_color(...e){return this._helper.set_border_color(this,...e)}set_border_width(...e){return this._helper.set_border_width(this,...e)}set_frame_color(...e){return this._helper.set_frame_color(this,...e)}set_frame_width(...e){return this._helper.set_frame_width(this,...e)}_defaultCell(){return{text:"",width:0,height:0,text_color:"#000000",text_halign:"center",text_valign:"center",text_size:"normal",bgcolor:"",tooltip:"",text_font_family:"default",_merged:!1,_merge_parent:null}}}var Wp=Object.defineProperty,Up=(t,e,i)=>e in t?Wp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,qp=(t,e,i)=>Up(t,typeof e!="symbol"?e+"":e,i);class Kp{constructor(e){this.context=e,qp(this,"_tables",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__tables__||(this.context.plots.__tables__={title:"__tables__",data:[],options:{style:"table",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__tables__.data=[{time:e,value:this._tables,options:{style:"table"}}]}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}new(...e){let i="top_right",r=1,s=1,a="",n="",o=0,l="",c=0,h=!1;const p=e[e.length-1];if(p&&typeof p=="object"&&!Array.isArray(p)&&("bgcolor"in p||"frame_color"in p||"border_color"in p||"position"in p||"columns"in p||"rows"in p)){const f=p,m=e.slice(0,-1);i=m[0]??f.position??i,r=m[1]??f.columns??r,s=m[2]??f.rows??s,a=f.bgcolor??a,n=f.frame_color??n,o=f.frame_width??o,l=f.border_color??l,c=f.border_width??c,h=f.force_overlay??h}else i=e[0]??i,r=e[1]??r,s=e[2]??s,a=e[3]??a,n=e[4]??n,o=e[5]??o,l=e[6]??l,c=e[7]??c,h=e[8]??h;const u=new $p(this._resolve(i)||"top_right",this._resolve(r)||1,this._resolve(s)||1,this._resolve(a)||"",this._resolve(n)||"",this._resolve(o)||0,this._resolve(l)||"",this._resolve(c)||0,this._resolve(h)??!1);return u._setHelper(this),this._tables.push(u),this._syncToPlot(),u}any(...e){return this.new(...e)}cell(...e){let i,r,s,a="",n=0,o=0,l="#000000",c="center",h="center",p="normal",u="",f="",m="default";const y=e[e.length-1];if(y&&typeof y=="object"&&!Array.isArray(y)&&("text"in y||"bgcolor"in y||"text_color"in y||"text_size"in y||"text_halign"in y||"tooltip"in y||"column"in y||"row"in y)){const v=y,E=e.slice(0,-1);i=E[0],r=E.length>1?E[1]:v.column??0,s=E.length>2?E[2]:v.row??0,a=E[3]??v.text??a,n=E[4]??v.width??n,o=E[5]??v.height??o,l=E[6]??v.text_color??l,c=E[7]??v.text_halign??c,h=E[8]??v.text_valign??h,p=E[9]??v.text_size??p,u=E[10]??v.bgcolor??u,f=E[11]??v.tooltip??f,m=E[12]??v.text_font_family??m}else i=e[0],r=e[1]??0,s=e[2]??0,a=e[3]??a,n=e[4]??n,o=e[5]??o,l=e[6]??l,c=e[7]??c,h=e[8]??h,p=e[9]??p,u=e[10]??u,f=e[11]??f,m=e[12]??m;const _=this._resolve(i);if(!_||_._deleted)return;const b=this._resolve(r)??0,S=this._resolve(s)??0;_.setCell(b,S,{text:this._resolveText(this._resolve(a)),width:this._resolve(n)||0,height:this._resolve(o)||0,text_color:this._resolve(l)||"#000000",text_halign:this._resolve(c)||"center",text_valign:this._resolve(h)||"center",text_size:this._resolve(p)||"normal",bgcolor:this._resolve(u)||"",tooltip:this._resolveText(this._resolve(f)),text_font_family:this._resolve(m)||"default"}),this._syncToPlot()}delete(e){e&&(e._deleted=!0)}clear(...e){let i,r,s,a,n;const o=e[e.length-1];if(o&&typeof o=="object"&&!Array.isArray(o)&&("start_column"in o||"start_row"in o||"end_column"in o)){const f=o;i=e[0],r=e.length>2?e[1]:f.start_column??0,s=e.length>3?e[2]:f.start_row??0,a=f.end_column??(e.length>4?e[3]:r),n=f.end_row??(e.length>5?e[4]:s)}else i=e[0],r=e[1]??0,s=e[2]??0,a=e[3]??r,n=e[4]??s;const l=this._resolve(i);if(!l||l._deleted)return;const c=this._resolve(r)??0,h=this._resolve(s)??0,p=this._resolve(a)??c,u=this._resolve(n)??h;for(let f=h;f<=u;f++)for(let m=c;m<=p;m++)l.clearCell(m,f);this._syncToPlot()}merge_cells(...e){let i,r,s,a,n;const o=e[e.length-1];if(o&&typeof o=="object"&&!Array.isArray(o)&&("start_column"in o||"start_row"in o||"end_column"in o)){const f=o;i=e[0],r=e.length>2?e[1]:f.start_column??0,s=e.length>3?e[2]:f.start_row??0,a=f.end_column??(e.length>4?e[3]:0),n=f.end_row??(e.length>5?e[4]:0)}else i=e[0],r=e[1]??0,s=e[2]??0,a=e[3]??0,n=e[4]??0;const l=this._resolve(i);if(!l||l._deleted)return;const c=this._resolve(r)??0,h=this._resolve(s)??0,p=this._resolve(a)??0,u=this._resolve(n)??0;for(let f=h;f<=u;f++)for(let m=c;m<=p;m++)f===h&&m===c||l.setCell(m,f,{_merged:!0,_merge_parent:[c,h]});l.merges.push({startCol:c,startRow:h,endCol:p,endRow:u}),this._syncToPlot()}cell_set_text(e,i,r,s){this._setCellProp(e,i,r,"text",s,!0)}cell_set_bgcolor(e,i,r,s){this._setCellProp(e,i,r,"bgcolor",s)}cell_set_text_color(e,i,r,s){this._setCellProp(e,i,r,"text_color",s)}cell_set_text_size(e,i,r,s){this._setCellProp(e,i,r,"text_size",s)}cell_set_height(e,i,r,s){this._setCellProp(e,i,r,"height",s)}cell_set_width(e,i,r,s){this._setCellProp(e,i,r,"width",s)}cell_set_tooltip(e,i,r,s){this._setCellProp(e,i,r,"tooltip",s,!0)}cell_set_text_halign(e,i,r,s){this._setCellProp(e,i,r,"text_halign",s)}cell_set_text_valign(e,i,r,s){this._setCellProp(e,i,r,"text_valign",s)}cell_set_text_font_family(e,i,r,s){this._setCellProp(e,i,r,"text_font_family",s)}set_position(e,i){const r=this._resolve(e);!r||r._deleted||(r.position=this._resolve(i)||r.position,this._syncToPlot())}set_bgcolor(e,i){const r=this._resolve(e);!r||r._deleted||(r.bgcolor=this._resolve(i)||"",this._syncToPlot())}set_border_color(e,i){const r=this._resolve(e);!r||r._deleted||(r.border_color=this._resolve(i)||"",this._syncToPlot())}set_border_width(e,i){const r=this._resolve(e);!r||r._deleted||(r.border_width=this._resolve(i)||0,this._syncToPlot())}set_frame_color(e,i){const r=this._resolve(e);!r||r._deleted||(r.frame_color=this._resolve(i)||"",this._syncToPlot())}set_frame_width(e,i){const r=this._resolve(e);!r||r._deleted||(r.frame_width=this._resolve(i)||0,this._syncToPlot())}get all(){return this._tables.filter(e=>!e._deleted)}_setCellProp(e,i,r,s,a,n=!1){const o=this._resolve(e);if(!o||o._deleted)return;const l=this._resolve(i)??0,c=this._resolve(r)??0,h=this._resolve(a);o.setCell(l,c,{[s]:n?this._resolveText(h):h}),this._syncToPlot()}_resolveText(e){return e==null||e!==e?"":String(e)}}var zp=Object.defineProperty,Hp=(t,e,i)=>e in t?zp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,$=(t,e,i)=>Hp(t,typeof e!="symbol"?e+"":e,i);const bs=class fi{constructor({marketData:e,source:i,tickerId:r,timeframe:s,limit:a,sDate:n,eDate:o,fullContext:l,inputs:c}){$(this,"data",{open:new x([]),high:new x([]),low:new x([]),close:new x([]),volume:new x([]),hl2:new x([]),hlc3:new x([]),ohlc4:new x([]),hlcc4:new x([]),bar_index:new x([])}),$(this,"indicator"),$(this,"cache",{}),$(this,"taState",{}),$(this,"isSecondaryContext",!1),$(this,"NA",NaN),$(this,"lang"),$(this,"length",0),$(this,"pine"),$(this,"idx",0),$(this,"params",{}),$(this,"const",{}),$(this,"var",{}),$(this,"let",{}),$(this,"lctx",new Map),$(this,"result"),$(this,"plots",{}),$(this,"marketData"),$(this,"source"),$(this,"tickerId"),$(this,"timeframe",""),$(this,"limit"),$(this,"sDate"),$(this,"eDate"),$(this,"fullContext"),$(this,"pineTSCode"),$(this,"inputs",{}),$(this,"_callStack",[]),this.marketData=e,this.source=i,this.tickerId=r,this.timeframe=s,this.limit=a,this.sDate=n,this.eDate=o,this.fullContext=l||this,this.inputs=c||{};const h=new Gl(this),p={Type:h.Type.bind(h),na:new Hl,color:h.color,nz:h.nz.bind(h),indicator:h.indicator.bind(h),fixnan:h.fixnan.bind(h),alertcondition:h.alertcondition.bind(h),timestamp:h.timestamp.bind(h),time:new Qi(this,"openTime"),time_close:new Qi(this,"closeTime"),dayofmonth:new Xe(this,Ze.dayofmonth),dayofweek:new Xe(this,Ze.dayofweek),hour:new Xe(this,Ze.hour),minute:new Xe(this,Ze.minute),month:new Xe(this,Ze.month),second:new Xe(this,Ze.second),weekofyear:new Xe(this,Ze.weekofyear),year:new Xe(this,Ze.year),bool:h.bool.bind(h),int:h.int.bind(h),float:h.float.bind(h),string:h.string.bind(h)},u=this;this.pine={input:new wc(this),ta:new Cu(this),math:new rh(this),request:new hh(this),array:new po(this),map:new ko(this),matrix:new Tl(this),syminfo:null,timeframe:new Au(this),barstate:new Ol(this),get bar_index(){return u.data.bar_index},get last_bar_index(){return u.data.close.length-1},get last_bar_time(){return u.data.openTime.get(u.data.openTime.length-1)},get timenow(){return new Date().getTime()},get time_tradingday(){const M=x.from(u.data.openTime).get(0);if(isNaN(M))return NaN;const q=u.pine?.syminfo?.timezone||"UTC",G=Lt(M,q);return Date.UTC(G.year,G.month-1,G.day,0,0,0)},get inputs(){return u.inputs},log:new Iu(this),str:new ku(this),...p,...Ya};const f=p.dayofweek;Object.assign(f,{sunday:1,monday:2,tuesday:3,wednesday:4,thursday:5,friday:6,saturday:7}),this.pine.dayofweek=f;const m=new Wu(this),y=new Uu(this),_=new qu(this);this.bindContextObject(m,["plotchar","plotshape","plotarrow","plotbar","plotcandle","bgcolor","barcolor"]),this.bindContextObject(m,["any","param","linestyle_dashed","linestyle_dotted","linestyle_solid","style_area","style_areabr","style_circles","style_columns","style_cross","style_histogram","style_line","style_linebr","style_stepline","style_stepline_diamond","style_steplinebr"],"plot"),this.bindContextObject(y,["any","style_dashed","style_solid","style_dotted","param"],"hline"),this.bindContextObject(_,["any","param"],"fill");const b=new Gu(this);this.pine.chart={param:b.param.bind(b),bg_color:b.bg_color.bind(b),fg_color:b.fg_color.bind(b),is_standard:b.is_standard.bind(b),is_heikinashi:b.is_heikinashi.bind(b),is_kagi:b.is_kagi.bind(b),is_linebreak:b.is_linebreak.bind(b),is_pnf:b.is_pnf.bind(b),is_range:b.is_range.bind(b),is_renko:b.is_renko.bind(b),point:b.point};const S=new rp(this);this.bindContextObject(S,["any","new","param","set_x","set_y","set_xy","set_text","set_color","set_textcolor","set_size","set_style","set_textalign","set_tooltip","set_point","set_xloc","set_yloc","get_x","get_y","get_text","copy","delete","style_label_down","style_label_up","style_label_left","style_label_right","style_label_lower_left","style_label_lower_right","style_label_upper_left","style_label_upper_right","style_label_center","style_circle","style_square","style_diamond","style_flag","style_arrowup","style_arrowdown","style_cross","style_xcross","style_triangleup","style_triangledown","style_none","style_text_outline"],"label"),Object.defineProperty(this.pine.label,"all",{get:()=>S.all});const v=new pp(this);this.bindContextObject(v,["any","new","param","set_x1","set_y1","set_x2","set_y2","set_xy1","set_xy2","set_color","set_width","set_style","set_extend","set_xloc","set_first_point","set_second_point","get_x1","get_y1","get_x2","get_y2","get_price","copy","delete","style_solid","style_dotted","style_dashed","style_arrow_left","style_arrow_right","style_arrow_both"],"line"),Object.defineProperty(this.pine.line,"all",{get:()=>v.all});const E=new vp(this);this.bindContextObject(E,["any","new","param","copy","delete","set_left","set_right","set_top","set_bottom","set_lefttop","set_rightbottom","set_top_left_point","set_bottom_right_point","set_bgcolor","set_border_color","set_border_width","set_border_style","set_extend","set_xloc","set_text","set_text_color","set_text_size","set_text_halign","set_text_valign","set_text_wrap","set_text_font_family","set_text_formatting","get_left","get_right","get_top","get_bottom"],"box"),Object.defineProperty(this.pine.box,"all",{get:()=>E.all});const N=new Ap(this);this.bindContextObject(N,["any","new","param","set_color","get_line1","get_line2","delete"],"linefill"),Object.defineProperty(this.pine.linefill,"all",{get:()=>N.all});const O=new Lp(this);this.bindContextObject(O,["any","new","param","delete"],"polyline"),Object.defineProperty(this.pine.polyline,"all",{get:()=>O.all});const D=new Kp(this);this.bindContextObject(D,["any","new","param","cell","delete","clear","merge_cells","cell_set_text","cell_set_bgcolor","cell_set_text_color","cell_set_text_size","cell_set_height","cell_set_width","cell_set_tooltip","cell_set_text_halign","cell_set_text_valign","cell_set_text_font_family","set_position","set_bgcolor","set_border_color","set_border_width","set_frame_color","set_frame_width"],"table"),Object.defineProperty(this.pine.table,"all",{get:()=>D.all})}bindContextObject(e,i,r=""){r&&!this.pine[r]&&(this.pine[r]={});const s=r?this.pine[r]:this.pine;for(const a of i)typeof e[a]=="function"?s[a]=e[a].bind(e):s[a]=e[a]}init(e,i,r=0){let s;return i instanceof x?s=i.get(0):Array.isArray(i)?Array.isArray(i[0])?s=i[0]:s=i[i.length-1+r]:s=i,e?e instanceof x?(e.data[e.data.length-1]=s,e):Array.isArray(e)?(e[e.length-1]=s,new x(e)):new x([s]):new x([s])}initVar(e,i){if(e)return e;typeof i=="function"&&(i=i());let r;return i instanceof x?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 x([r])}precision(e,i=10){const r=10**i;return typeof e=="number"?Math.round(e*r)/r:e}param(e,i,r){return typeof e=="string"?e:e instanceof x?i?new x(e.data,e.offset+i):e:!Array.isArray(e)&&typeof e=="object"?e:(this.params[r]||(this.params[r]=[]),Array.isArray(e)?new x(e,i||0):(this.params[r].length===0?this.params[r].push(e):this.params[r][this.params[r].length-1]=e,new x(this.params[r],i||0)))}get(e,i){if(e instanceof x)return e.get(i);if(Array.isArray(e)){const r=e.length-1-i;return r<0||r>=e.length?NaN:e[r]}return e}set(e,i){if(e instanceof x){e.set(0,i);return}if(Array.isArray(e)){e.length>0?e[e.length-1]=i:e.push(i);return}}pushId(e){this._callStack.push(e)}popId(){this._callStack.pop()}peekId(){return this._callStack.length>0?this._callStack[this._callStack.length-1]:""}peekCtx(){const e=this.peekId();if(!e)return this;let i=this.lctx.get(e);return i||(i={id:e,let:{},const:{},var:{}},this.lctx.set(e,i)),i}call(e,i,...r){this.pushId(i);try{return e(...r)}finally{this.popId()}}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,fill:this.pine.fill,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(e,i){const r=`${e}->${i}`;fi._deprecationWarningsShown.has(r)||(fi._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;",e,i):console.warn(`\x1B[33m[WARNING] ${e} syntax is deprecated. Use ${i} instead. This will be removed in a future version.\x1B[0m`))}};$(bs,"_deprecationWarningsShown",new Set);let rr=bs;var Gp=Object.defineProperty,Yp=(t,e,i)=>e in t?Gp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,sr=(t,e,i)=>Yp(t,typeof e!="symbol"?e+"":e,i);class nr{constructor(e,i={}){sr(this,"source"),sr(this,"inputs"),this.source=e,this.inputs=i}}var Qp=Object.defineProperty,Xp=(t,e,i)=>e in t?Qp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ee=(t,e,i)=>Xp(t,typeof e!="symbol"?e+"":e,i);class vs{constructor(e,i,r,s,a,n){this.source=e,this.tickerId=i,this.timeframe=r,this.limit=s,this.sDate=a,this.eDate=n,ee(this,"data",[]),ee(this,"open",[]),ee(this,"high",[]),ee(this,"low",[]),ee(this,"close",[]),ee(this,"volume",[]),ee(this,"hl2",[]),ee(this,"hlc3",[]),ee(this,"ohlc4",[]),ee(this,"hlcc4",[]),ee(this,"openTime",[]),ee(this,"closeTime",[]),ee(this,"_readyPromise",null),ee(this,"_ready",!1),ee(this,"_debugSettings",{ln:!1,debug:!1}),ee(this,"_transpiledCode",null),ee(this,"_isSecondaryContext",!1),ee(this,"_syminfo"),this._readyPromise=new Promise(o=>{this.loadMarketData(e,i,r,s,a,n).then(l=>{const c=l;this.data=c;const h=c.map(N=>N.open),p=c.map(N=>N.close),u=c.map(N=>N.high),f=c.map(N=>N.low),m=c.map(N=>N.volume),y=c.map(N=>(N.high+N.low+N.close)/3),_=c.map(N=>(N.high+N.low)/2),b=c.map(N=>(N.high+N.low+N.open+N.close)/4),S=c.map(N=>(N.high+N.low+N.close+N.close)/4),v=c.map(N=>N.openTime),E=c.map(N=>N.closeTime);this.open=h,this.close=p,this.high=u,this.low=f,this.volume=m,this.hl2=_,this.hlc3=y,this.ohlc4=b,this.hlcc4=S,this.openTime=v,this.closeTime=E,e&&e.getSymbolInfo?e.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))})})}get transpiledCode(){return this._transpiledCode}markAsSecondary(){this._isSecondaryContext=!0}setDebugSettings({ln:e,debug:i}){this._debugSettings.ln=e,this._debugSettings.debug=i}async loadMarketData(e,i,r,s,a,n){return Array.isArray(e)?e:e.getMarketData(i,r,s,a,n)}async ready(){if(this._ready)return!0;if(!this._readyPromise)throw new Error("PineTS is not ready");return this._readyPromise}run(e,i,r){let s,a={};if(e instanceof nr?(s=e.source,a=e.inputs||{}):s=e,r&&r>0){const n=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(s,a,i,r,n)}else return this._runComplete(s,a,i)}stream(e,i={}){const{live:r=!0,interval:s=1e3}=i,a=i.pageSize||this.data.length;let n,o={};e instanceof nr?(n=e.source,o=e.inputs||{}):n=e;const l={data:[],error:[]};let c=!1;const h=(f,...m)=>{l[f]&&l[f].forEach(y=>y(...m))},p=(f,m)=>{l[f]||(l[f]=[]),l[f].push(m)},u=()=>{c=!0};return(async()=>{try{const f=typeof this.eDate>"u"&&!Array.isArray(this.source)&&r,m=this._runPaginated(n,o,void 0,a,f);for await(const y of m){if(c)break;if(y===null){await new Promise(_=>setTimeout(_,s));continue}if(h("data",y),f&&!c){const _=y.marketData[y.idx];_&&_.closeTime<Date.now()||await new Promise(b=>setTimeout(b,s))}}}catch(f){h("error",f)}})(),{on:p,stop:u}}async _runComplete(e,i,r){await this.ready(),r||(r=this.data.length);const s=this._initializeContext(e,i,this._isSecondaryContext);return this._transpiledCode=this._transpileCode(e),await this._executeIterations(s,this._transpiledCode,this.data.length-r,this.data.length),s}async*_runPaginated(e,i,r,s,a=!1){await this.ready(),r||(r=this.data.length);const n=this._initializeContext(e,i,this._isSecondaryContext);this._transpiledCode=this._transpileCode(e);let o=this.data.length-r;for(;;){const l=this.data.length-o;if(l>0){const p=Math.min(l,s),u=this._getResultLength(n.result);await this._executeIterations(n,this._transpiledCode,o,o+p),o+=p,yield this._createPageContext(n,u);continue}if(!a||Array.isArray(this.source))break;const{newCandles:c,updatedLastCandle:h}=await this._updateMarketData();if(c===0&&!h){yield null;continue}this._removeLastResult(n),o=this.data.length-(c+1),n.pine.barstate.setLive()}}_getResultLength(e){if(Array.isArray(e))return e.length;if(typeof e=="object"&&e!==null){const i=Object.keys(e);if(i.length>0&&Array.isArray(e[i[0]]))return e[i[0]].length}return 0}_createPageContext(e,i){const r=new rr({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,fullContext:e,inputs:e.inputs});if(r.pineTSCode=e.pineTSCode,r.idx=e.idx,Array.isArray(e.result))r.result=e.result.slice(i);else if(typeof e.result=="object"&&e.result!==null){r.result={};for(let s in e.result)Array.isArray(e.result[s])?r.result[s]=e.result[s].slice(i):r.result[s]=e.result[s]}else r.result=e.result;return r.plots={...e.plots},r}async _updateMarketData(e){if(Array.isArray(this.source))return{newCandles:0,updatedLastCandle:!1};const i=this.source,r=this.data.length-1,s=this.data[r].openTime;try{const a=await i.getMarketData(this.tickerId,this.timeframe,void 0,s,e);if(!a||a.length===0)return{newCandles:0,updatedLastCandle:!1};let n=!1,o=0;for(let l=0;l<a.length;l++){const c=a[l];c.openTime===s?(this._replaceCandle(r,c),n=!0):c.openTime>s&&(this._appendCandle(c),o++)}return{newCandles:o,updatedLastCandle:n}}catch(a){return console.error("Error updating market data:",a),{newCandles:0,updatedLastCandle:!1}}}_replaceCandle(e,i){this.data[e]=i,this.open[e]=i.open,this.close[e]=i.close,this.high[e]=i.high,this.low[e]=i.low,this.volume[e]=i.volume,this.hl2[e]=(i.high+i.low)/2,this.hlc3[e]=(i.high+i.low+i.close)/3,this.ohlc4[e]=(i.high+i.low+i.open+i.close)/4,this.hlcc4[e]=(i.high+i.low+i.close+i.close)/4,this.openTime[e]=i.openTime,this.closeTime[e]=i.closeTime}_appendCandle(e){this.data.push(e),this.open.push(e.open),this.close.push(e.close),this.high.push(e.high),this.low.push(e.low),this.volume.push(e.volume),this.hl2.push((e.high+e.low)/2),this.hlc3.push((e.high+e.low+e.close)/3),this.ohlc4.push((e.high+e.low+e.open+e.close)/4),this.hlcc4.push((e.high+e.low+e.close+e.close)/4),this.openTime.push(e.openTime),this.closeTime.push(e.closeTime)}_removeLastResult(e){if(Array.isArray(e.result))e.result.pop();else if(typeof e.result=="object"&&e.result!==null)for(let s in e.result)Array.isArray(e.result[s])&&e.result[s].pop();e.data.close.data.pop(),e.data.open.data.pop(),e.data.high.data.pop(),e.data.low.data.pop(),e.data.volume.data.pop(),e.data.hl2.data.pop(),e.data.hlc3.data.pop(),e.data.ohlc4.data.pop(),e.data.hlcc4.data.pop(),e.data.openTime.data.pop(),e.data.closeTime&&e.data.closeTime.data.pop(),e.data.bar_index.data.pop();const i=["const","var","let","params"],r=s=>{for(let a of i)if(s[a])for(let n in s[a]){const o=s[a][n];o instanceof x?o.data.pop():Array.isArray(o)&&o.pop()}};r(e),e.lctx&&e.lctx.forEach(s=>r(s))}_initializeContext(e,i={},r=!1){const s=new rr({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,inputs:i});return s.pine.syminfo=this._syminfo,s.pineTSCode=e,s.isSecondaryContext=r,s.data.close=new x([]),s.data.open=new x([]),s.data.high=new x([]),s.data.low=new x([]),s.data.volume=new x([]),s.data.hl2=new x([]),s.data.hlc3=new x([]),s.data.ohlc4=new x([]),s.data.hlcc4=new x([]),s.data.openTime=new x([]),s.data.closeTime=new x([]),s.length=this.data.length,s}_transpileCode(e){return ha.bind(this)(e,this._debugSettings)}async _executeIterations(e,i,r,s){const a=["const","var","let","params"];for(let n=r;n<s;n++){e.idx=n,e.data.close.data.push(this.close[n]),e.data.open.data.push(this.open[n]),e.data.high.data.push(this.high[n]),e.data.low.data.push(this.low[n]),e.data.volume.data.push(this.volume[n]),e.data.hl2.data.push(this.hl2[n]),e.data.hlc3.data.push(this.hlc3[n]),e.data.ohlc4.data.push(this.ohlc4[n]),e.data.hlcc4.data.push(this.hlcc4[n]),e.data.openTime.data.push(this.openTime[n]),e.data.closeTime.data.push(this.closeTime[n]),e.data.bar_index.data.push(n);const o=await i(e);if(typeof o=="object"){typeof e.result!="object"&&(e.result={});for(let c in o){e.result[c]===void 0&&(e.result[c]=[]);let h;o[c]instanceof x?h=o[c].get(0):Array.isArray(o[c])?h=o[c][o[c].length-1]:h=o[c],e.result[c].push(h)}}else Array.isArray(e.result)||(e.result=[]),e.result.push(o);const l=c=>{for(let h of a)if(c[h])for(let p in c[h]){const u=c[h][p];if(u instanceof x){const f=u.get(0);u.data.push(f)}else if(Array.isArray(u)){const f=u[u.length-1];u.push(f)}}};l(e),e.lctx&&e.lctx.forEach(c=>l(c))}}}var Zp=Object.defineProperty,Jp=(t,e,i)=>e in t?Zp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Bt=(t,e,i)=>Jp(t,typeof e!="symbol"?e+"":e,i);const ti="https://api.binance.com/api/v3",ar="https://api.binance.us/api/v3",ii={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 ef{constructor(e=300*1e3){Bt(this,"cache"),Bt(this,"cacheDuration"),this.cache=new Map,this.cacheDuration=e}generateKey(e){return Object.entries(e).filter(([i,r])=>r!==void 0).map(([i,r])=>`${i}:${r}`).join("|")}get(e){const i=this.generateKey(e),r=this.cache.get(i);return r?Date.now()-r.timestamp>this.cacheDuration?(this.cache.delete(i),null):r.data:null}set(e,i){const r=this.generateKey(e);this.cache.set(r,{data:i,timestamp:Date.now()})}clear(){this.cache.clear()}cleanup(){const e=Date.now();for(const[i,r]of this.cache.entries())e-r.timestamp>this.cacheDuration&&this.cache.delete(i)}}class tf{constructor(){Bt(this,"cacheManager"),Bt(this,"activeApiUrl",null),this.cacheManager=new ef(300*1e3)}async getBaseUrl(){if(this.activeApiUrl)return this.activeApiUrl;try{const e=new AbortController,i=setTimeout(()=>e.abort(),5e3),r=await fetch(`${ti}/ping`,{signal:e.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=ti,this.activeApiUrl}catch{}try{const e=new AbortController,i=setTimeout(()=>e.abort(),5e3),r=await fetch(`${ar}/ping`,{signal:e.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=ar,this.activeApiUrl}catch{}return ti}async getMarketDataInterval(e,i,r,s){try{const a=ii[i.toUpperCase()];if(!a)return console.error(`Unsupported timeframe: ${i}`),[];const n={"1m":60*1e3,"3m":180*1e3,"5m":300*1e3,"15m":900*1e3,"30m":1800*1e3,"1h":3600*1e3,"2h":7200*1e3,"4h":14400*1e3,"1d":1440*60*1e3,"1w":10080*60*1e3,"1M":720*60*60*1e3};let o=[],l=r;const c=s,h=n[a];if(!h)return console.error(`Duration not defined for interval: ${a}`),[];for(;l<c;){const p=Math.min(l+1e3*h,c),u=await this.getMarketData(e,i,1e3,l,p);if(u.length===0)break;o=o.concat(u),l=u[u.length-1].closeTime+1}return o}catch(a){return console.error("Error in getMarketDataInterval:",a),[]}}async getMarketDataBackwards(e,i,r,s){let a=r,n=[],o=s,l=0;const c=Math.ceil(r/1e3)+5;for(;a>0&&l<c;){l++;const h=Math.min(a,1e3),p=await this.getMarketData(e,i,h,void 0,o);if(p.length===0||(n=p.concat(n),a-=p.length,o=p[0].openTime-1,p.length<h))break}return n}async getMarketData(e,i,r,s,a){try{const n=a!==void 0,o={tickerId:e,timeframe:i,limit:r,sDate:s,eDate:a};if(n){const u=this.cacheManager.get(o);if(u)return u}const l=ii[i.toUpperCase()];if(!l)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,s,a)){if(s&&a){const u=await this.getMarketDataInterval(e,i,s,a),f=r?u.slice(0,r):u;return this.cacheManager.set(o,f),f}else if(r&&r>1e3){const u=await this.getMarketDataBackwards(e,i,r,a);return this.cacheManager.set(o,u),u}}let c=`${await this.getBaseUrl()}/klines?symbol=${e}&interval=${l}`;r&&(c+=`&limit=${Math.min(r,1e3)}`),s&&(c+=`&startTime=${s}`),a&&(c+=`&endTime=${a}`);const h=await fetch(c);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);const p=(await h.json()).map(u=>({openTime:parseInt(u[0]),open:parseFloat(u[1]),high:parseFloat(u[2]),low:parseFloat(u[3]),close:parseFloat(u[4]),volume:parseFloat(u[5]),closeTime:parseInt(u[6]),quoteAssetVolume:parseFloat(u[7]),numberOfTrades:parseInt(u[8]),takerBuyBaseAssetVolume:parseFloat(u[9]),takerBuyQuoteAssetVolume:parseFloat(u[10]),ignore:u[11]}));return n&&this.cacheManager.set(o,p),p}catch(n){return console.error("Error in binance.klines:",n),[]}}shouldPaginate(e,i,r,s){if(i&&i>1e3)return!0;if(r&&s){const a=ii[e.toUpperCase()],n={"1m":60*1e3,"3m":180*1e3,"5m":300*1e3,"15m":900*1e3,"30m":1800*1e3,"1h":3600*1e3,"2h":7200*1e3,"4h":14400*1e3,"1d":1440*60*1e3,"1w":10080*60*1e3,"1M":720*60*60*1e3}[a];if(n)return Math.ceil((s-r)/n)>1e3}return!1}async getSymbolInfo(e){try{let i="crypto",r=await this.getBaseUrl(),s=e,a="";e.endsWith(".P")?(i="futures",s=e.replace(".P",""),r="https://fapi.binance.com/fapi/v1",a="Perpetual"):e.includes("_")&&(i="futures",s=e,r="https://dapi.binance.com/dapi/v1",a="Delivery");const n=i==="crypto"?`${r}/exchangeInfo?symbol=${s}`:`${r}/exchangeInfo`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const l=(await o.json()).symbols;if(!l||l.length===0)return console.error(`Symbol ${e} not found`),null;const c=i==="futures"?l.find(v=>v.symbol===s):l[0];if(!c)return console.error(`Symbol ${s} not found in exchange info`),null;const h=c.filters?.find(v=>v.filterType==="PRICE_FILTER"),p=c.filters?.find(v=>v.filterType==="LOT_SIZE"),u=h?parseFloat(h.tickSize):.01,f=p?parseFloat(p.minQty):0,m=Math.round(1/u),y=c.baseAsset,_=c.quoteAsset,b=a?` ${a}`:"",S=`${y} / ${_}${b}`;return{ticker:e,tickerid:`BINANCE:${e}`,prefix:"BINANCE",root:y,description:S,type:i,main_tickerid:`BINANCE:${e}`,current_contract:a,isin:"",basecurrency:y,currency:_,timezone:"Etc/UTC",country:"",mintick:u,pricescale:m,minmove:1,pointvalue:c.contractSize||1,mincontract:f,session:"24x7",volumetype:"base",expiration_date:c.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}}configure(e){}}class rf{async getMarketData(){return[]}}const sf=typeof process<"u"&&process.versions&&process.versions.node;let Ft=null;if(sf)try{Ft=new rf}catch{Ft=null}const nf={Binance:new tf,...Ft?{Mock:Ft}:{}};export{rr as Context,nr as Indicator,vs as PineTS,nf as Provider};
|
|
134
|
+
`),this.indent--,this.write(this.indentStr.repeat(this.indent)),this.write("})()")}generateSequenceExpression(e){this.write("(");for(let i=0;i<e.expressions.length;i++)this.generateExpression(e.expressions[i]),i<e.expressions.length-1&&this.write(", ");this.write(")")}getPrecedence(e){switch(e.type){case"Literal":case"Identifier":case"ArrayExpression":case"ObjectExpression":return 20;case"CallExpression":case"MemberExpression":return 19;case"UnaryExpression":case"UpdateExpression":return 15;case"BinaryExpression":case"LogicalExpression":switch(e.operator){case"*":case"/":case"%":return 13;case"+":case"-":return 12;case"<":case"<=":case">":case">=":return 10;case"==":case"!=":return 9;case"and":case"&&":return 5;case"or":case"||":return 4;default:return 0}case"ConditionalExpression":return 3;case"AssignmentExpression":case"AssignmentPattern":return 2;case"SequenceExpression":return 1;default:return 0}}}function ts(t){const e=/^\s*\/\/\s*@version\s*=\s*(\d+)\s*$/im,i=t.match(e);return i&&i[1]?parseInt(i[1],10):null}function ca(t,e={}){const i=ts(t);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 zn(t).tokenize(),s=new na(r).parse(),a={...e,sourceCode:t},n=new la(a).generate(s);return{success:!0,version:i,code:n,ast:s,tokens:r}}catch(r){return{success:!1,version:i,error:r.message,stack:r.stack}}}function ha(t){if(typeof t=="function")return t.toString();{const e=ts(t);if(e===null)return t;if(e>=5){const i=ca(t);if(i.success)return i.code;throw new Error(`Failed to transpile Pine Script version ${e}: ${i.error}`)}else throw new Error(`Unsupported Pine Script version ${e}. Only version 5 and above are supported.`)}}function ua(t,e={debug:!1,ln:!1}){typeof e=="boolean"&&(e={debug:e,ln:!0});const{debug:i}=e;let r=ha(t);r=An(r);const s=i?r.split(`
|
|
135
|
+
`):[],a=zr(r,{ecmaVersion:"latest",sourceType:"module",locations:i});Tn(a),Cn(a),Nn(a);const n=new _n;Pn(a,n);const o=Rn(a,n)||"";Fn(a,n,o,e,s),Bn(a);const l=fn||Si||void 0,c=Object.assign({},l,{LineComment(p,u){u.write("//"+p.value)}}),h=Gr(a,{generator:c,comments:i});return new Function("",`var _r = ${h}
|
|
136
|
+
; return _r;`)(this)}function pa(t){return e=>new W(e.array.map(i=>Math.abs(i)),e.type,t)}function fa(t){return e=>{let i=0,r=0;for(const s of e.array){const a=Number(s);isNaN(a)||(r++,i+=(a-i)/r)}return r===0?NaN:t.precision(i)}}function da(t){return(e,i)=>{const r=e.array;let s=0,a=r.length-1;for(;s<=a;){const n=Math.floor((s+a)/2),o=r[n];if(o===i)return n;o<i?s=n+1:a=n-1}return-1}}function ma(t){return(e,i)=>{const r=e.array;let s=0,a=r.length;for(;s<a;){const n=Math.floor((s+a)/2);r[n]<i?s=n+1:a=n}return s<r.length&&r[s]===i?s:s-1}}function ga(t){return(e,i)=>{const r=e.array;let s=0,a=r.length;for(;s<a;){const n=Math.floor((s+a)/2);r[n]<=i?s=n+1:a=n}return s>0&&r[s-1]===i?s-1:s}}function xa(t){return e=>{e.array.length=0}}function ya(t){return(e,i)=>(e.array.push(...i.array),e)}function _a(t){return e=>new W([...e.array],e.type,t)}function ba(t){return(e,i,r=!0)=>{const s=e.array,a=i.array;if(s.length!==a.length)return NaN;let n=0,o=0,l=0;const c=[];for(let m=0;m<s.length;m++){const y=Number(s[m]),_=Number(a[m]);!isNaN(y)&&y!==null&&y!==void 0&&!isNaN(_)&&_!==null&&_!==void 0&&(n+=y,o+=_,l++,c.push(m))}if(l===0)return NaN;const h=n/l,p=o/l;let u=0;for(const m of c){const y=Number(s[m]),_=Number(a[m]);u+=(y-h)*(_-p)}const f=r?l:l-1;return f<=0?NaN:t.precision(u/f)}}function va(t){return e=>e.array.every(i=>!isNaN(i)&&i)}function wa(t){return t.every(e=>typeof e=="number")?t.every(e=>(e|0)===e)?H.int:H.float:t.every(e=>typeof e=="string")?H.string:t.every(e=>typeof e=="boolean")?H.bool:H.any}function Re(t){if(typeof t=="number")return(t|0)===t?H.int:H.float;if(typeof t=="string")return H.string;if(typeof t=="boolean")return H.bool;throw new Error("Cannot infer type from value")}function Ct(t,e){if(e===H.any)return!0;switch(e){case H.int:return typeof t=="number"&&((t|0)===t||isNaN(t));case H.float:return typeof t=="number";case H.string:return typeof t=="string";case H.bool:return typeof t=="boolean"}return!1}function Sa(t){return(e,i,r=0,s)=>{const a=e.array.length,n=s!==void 0?Math.min(s,a):a;for(let o=r;o<n;o++){if(!Ct(i,e.type))throw new Error(`Cannot call 'array.fill' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${e.type}' is expected.`);e.array[o]=typeof i=="number"?t.precision(i):i}}}function Ea(t){return e=>e.array.length>0?e.array[0]:t.NA}function Na(t){return(e,i)=>e.array[i]}function Ca(t){return(e,i)=>e.array.includes(i)}function Ia(t){return(e,i)=>typeof i=="number"&&i!==i?e.array.findIndex(r=>typeof r=="number"&&r!==r):e.array.indexOf(i)}function ka(t){return(e,i,r)=>{if(!Ct(r,e.type))throw new Error(`Cannot call 'array.insert' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${e.type}' is expected.`);e.array.splice(i,0,r)}}function Aa(t){return(e,i=",")=>e.array.join(i)}function Ta(t){return e=>e.array.length>0?e.array[e.array.length-1]:t.NA}function Pa(t){return(e,i)=>e.array.lastIndexOf(i)}function Da(t){return(e,i=0)=>{const r=e.array;if(r.length===0)return t.NA;if(i===0){let s=r[0];for(let a=1;a<r.length;a++)r[a]>s&&(s=r[a]);return s??t.NA}return[...r].sort((s,a)=>a-s)[i]??t.NA}}function Ra(t){return e=>{const i=e.array;if(i.length===0)return NaN;const r=new Array(i.length);for(let a=0;a<i.length;a++)r[a]=i[a];r.sort((a,n)=>a-n);const s=Math.floor(r.length/2);return r.length%2!==0?r[s]:(r[s-1]+r[s])/2}}function Oa(t){return(e,i=0)=>{const r=e.array;if(r.length===0)return t.NA;if(i===0){let s=r[0];for(let a=1;a<r.length;a++)r[a]<s&&(s=r[a]);return s??t.NA}return[...r].sort((s,a)=>s-a)[i]??t.NA}}function Ma(t){return e=>{if(e.array.length===0)return NaN;const i=new Map;let r=0;for(const a of e.array){const n=(i.get(a)||0)+1;i.set(a,n),n>r&&(r=n)}const s=[];for(const[a,n]of i)n===r&&s.push(a);return s.sort((a,n)=>typeof a=="number"&&typeof n=="number"?a-n:typeof a=="string"&&typeof n=="string"?a<n?-1:a>n?1:0:0),s[0]}}function Va(t){return(e,i)=>{const r=e.array,s=r.length;if(s===0)return NaN;const a=new Array(s);for(let c=0;c<s;c++){const h=Number(r[c]);if(isNaN(h)||h===null||h===void 0)return NaN;a[c]=h}a.sort((c,h)=>c-h),i<0&&(i=0),i>100&&(i=100);const n=i/100*s-.5;if(n<=0)return t.precision(a[0]);if(n>=s-1)return t.precision(a[s-1]);const o=Math.floor(n),l=n-o;return t.precision(a[o]*(1-l)+a[o+1]*l)}}function La(t){return(e,i)=>{const r=e.array,s=r.length;if(s===0)return NaN;const a=new Array;for(let o=0;o<s;o++){const l=Number(r[o]);!isNaN(l)&&l!==null&&l!==void 0&&a.push(l)}if(a.length===0)return NaN;a.sort((o,l)=>o-l),i<0&&(i=0),i>100&&(i=100);const n=Math.ceil(i/100*s);return n<=0?a[0]:n>a.length?NaN:a[n-1]}}function ja(t){return(e,i)=>{if(e.array.length===0)return NaN;const r=Math.floor(i);if(r<0||r>=e.array.length)return NaN;const s=Number(e.array[r]);if(isNaN(s)||s===null||s===void 0)return NaN;let a=0;for(const o of e.array){const l=Number(o);!isNaN(l)&&l!==null&&l!==void 0&&l<s&&a++}const n=e.array.length-1;return n<=0?NaN:a/n*100}}function Ba(t){return e=>e.array.pop()}function Fa(t){return(e,i)=>{if(!Ct(i,e.type))throw new Error(`Cannot call 'array.push' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${e.type}' is expected.`);e.array.push(typeof i=="number"?t.precision(i):i)}}function $a(t){return e=>t.precision(t.pine.array.max(e)-t.pine.array.min(e))}function Wa(t){return(e,i)=>i>=0&&i<e.array.length?e.array.splice(i,1)[0]:t.NA}function Ua(t){return e=>{e.array.reverse()}}function qa(t){return(e,i,r)=>{if(!Ct(r,e.type))throw new Error(`Cannot call 'array.set' with argument 'value'='${r}'. An argument of 'literal ${typeof r}' type was used but a '${e.type}' is expected.`);e.array[i]=typeof r=="number"?t.precision(r):r}}function Ka(t){return e=>e.array.shift()}function za(t){return e=>e.array.length}function Ha(t){return(e,i,r)=>{const s=r!==void 0?r:void 0;return new W(e.array.slice(i,s),e.type,t)}}function Ga(t){return e=>e.array.some(i=>!isNaN(i)&&i)}var mt=(t=>(t[t.ascending=1]="ascending",t[t.descending=0]="descending",t))(mt||{}),is=(t=>(t.AED="AED",t.ARS="ARS",t.AUD="AUD",t.BDT="BDT",t.BHD="BHD",t.BRL="BRL",t.BTC="BTC",t.CAD="CAD",t.CHF="CHF",t.CLP="CLP",t.CNY="CNY",t.COP="COP",t.CZK="CZK",t.DKK="DKK",t.EGP="EGP",t.ETH="ETH",t.EUR="EUR",t.GBP="GBP",t.HKD="HKD",t.HUF="HUF",t.IDR="IDR",t.ILS="ILS",t.INR="INR",t.ISK="ISK",t.JPY="JPY",t.KES="KES",t.KRW="KRW",t.KWD="KWD",t.LKR="LKR",t.MAD="MAD",t.MXN="MXN",t.MYR="MYR",t.NGN="NGN",t.NOK="NOK",t.NONE="NONE",t.NZD="NZD",t.PEN="PEN",t.PHP="PHP",t.PKR="PKR",t.PLN="PLN",t.QAR="QAR",t.RON="RON",t.RSD="RSD",t.RUB="RUB",t.SAR="SAR",t.SEK="SEK",t.SGD="SGD",t.THB="THB",t.TND="TND",t.TRY="TRY",t.TWD="TWD",t.USD="USD",t.USDT="USDT",t.VES="VES",t.VND="VND",t.ZAR="ZAR",t))(is||{}),rs=(t=>(t[t.sunday=1]="sunday",t[t.monday=2]="monday",t[t.tuesday=3]="tuesday",t[t.wednesday=4]="wednesday",t[t.thursday=5]="thursday",t[t.friday=6]="friday",t[t.saturday=7]="saturday",t))(rs||{}),ss=(t=>(t.all="all",t.data_window="data_window",t.none="none",t.pane="pane",t.price_scale="price_scale",t.status_line="status_line",t))(ss||{}),ns=(t=>(t.flag="shape_flag",t.arrowdown="shape_arrow_down",t.arrowup="shape_arrow_up",t.circle="shape_circle",t.cross="shape_cross",t.diamond="shape_diamond",t.labeldown="shape_label_down",t.labelup="shape_label_up",t.square="shape_square",t.triangledown="shape_triangle_down",t.triangleup="shape_triangle_up",t.xcross="shape_xcross",t))(ns||{}),as=(t=>(t.abovebar="AboveBar",t.belowbar="BelowBar",t.absolute="Absolute",t.bottom="Bottom",t.top="Top",t))(as||{}),os=(t=>(t.auto="auto",t.tiny="tiny",t.small="small",t.normal="normal",t.large="large",t.huge="huge",t))(os||{}),ls=(t=>(t.inherit="inherit",t.mintick="mintick",t.percent="percent",t.price="price",t.volume="volume",t))(ls||{}),Ya=(t=>(t.linestyle_dashed="linestyle_dashed",t.linestyle_dotted="linestyle_dotted",t.linestyle_solid="linestyle_solid",t.style_area="style_area",t.style_areabr="style_areabr",t.style_circles="style_circles",t.style_columns="style_columns",t.style_cross="style_cross",t.style_histogram="style_histogram",t.style_line="style_line",t.style_linebr="style_linebr",t.style_stepline="style_stepline",t.style_stepline_diamond="style_stepline_diamond",t.style_steplinebr="style_steplinebr",t))(Ya||{}),cs=(t=>(t.gaps_on="gaps_on",t.gaps_off="gaps_off",t.lookahead_on="lookahead_on",t.lookahead_off="lookahead_off",t))(cs||{}),hs=(t=>(t.bar_index="bi",t.bar_time="bt",t))(hs||{}),us=(t=>(t.price="pr",t.abovebar="ab",t.belowbar="bl",t))(us||{}),ps=(t=>(t.left="l",t.right="r",t.both="b",t.none="n",t))(ps||{}),fs=(t=>(t.align_left="left",t.align_center="center",t.align_right="right",t.wrap_auto="auto",t.wrap_none="none",t))(fs||{}),ds=(t=>(t.family_default="default",t.family_monospace="monospace",t))(ds||{}),ms=(t=>(t.none="none",t.splits="splits",t.dividends="dividends",t))(ms||{}),gs=(t=>(t.inherit="inherit",t.off="off",t.on="on",t))(gs||{}),xs=(t=>(t.actual="earnings_actual",t.estimate="earnings_estimate",t.standardized="earnings_standardized",t.future_eps="earnings_future_eps",t.future_period_end_time="earnings_future_period_end_time",t.future_revenue="earnings_future_revenue",t.future_time="earnings_future_time",t))(xs||{}),ys=(t=>(t.gross="dividends_gross",t.net="dividends_net",t.future_amount="dividends_future_amount",t.future_ex_date="dividends_future_ex_date",t.future_pay_date="dividends_future_pay_date",t))(ys||{}),_s=(t=>(t.denominator="splits_denominator",t.numerator="splits_numerator",t))(_s||{}),bs=(t=>(t.top_left="top_left",t.top_center="top_center",t.top_right="top_right",t.middle_left="middle_left",t.middle_center="middle_center",t.middle_right="middle_right",t.bottom_left="bottom_left",t.bottom_center="bottom_center",t.bottom_right="bottom_right",t))(bs||{});const Qa={order:mt,currency:is,dayofweek:rs,display:ss,shape:ns,location:as,size:os,format:ls,barmerge:cs,xloc:hs,yloc:us,extend:ps,text:fs,font:ds,adjustment:ms,backadjustment:gs,earnings:xs,dividends:ys,splits:_s,position:bs};function Xa(t){return(e,i=mt.ascending)=>{e.array.sort((r,s)=>{let a=isNaN(r)?1/0:r,n=isNaN(s)?1/0:s;return i===mt.ascending?a-n:n-a})}}function Za(t){return(e,i=mt.ascending)=>{const r=e.array.map((s,a)=>a);return r.sort((s,a)=>{const n=isNaN(e.array[s])?1/0:e.array[s],o=isNaN(e.array[a])?1/0:e.array[a];return i===mt.ascending?n-o:o-n}),new W(r,H.int,t)}}function Ja(t){return e=>{const i=t.array.avg(e),r=t.array.stdev(e);return isNaN(r)?new W(e.array.map(()=>NaN),H.int,t):r===0?new W(e.array.map(()=>1),H.int,t):new W(e.array.map(s=>(s-i)/r),H.int,t)}}function eo(t){return(e,i=!0)=>{const r=e.array,s=r.length;if(s===0)return NaN;let a=0,n=0,o=0;for(let h=0;h<s;h++){const p=Number(r[h]);!isNaN(p)&&p!==null&&p!==void 0&&(a+=p,n+=p*p,o++)}if(o===0)return NaN;const l=a/o;let c=n/o-l*l;return c<0?NaN:(!i&&o>1&&(c=c*o/(o-1)),!i&&o===1?0:t.precision(Math.sqrt(c)))}}function to(t){return e=>t.precision(e.array.reduce((i,r)=>{const s=Number(r);return isNaN(s)?i:i+s},0))}function io(t){return(e,i)=>{if(!Ct(i,e.type))throw new Error(`Cannot call 'array.unshift' with argument 'value'='${i}'. An argument of 'literal ${typeof i}' type was used but a '${e.type}' is expected.`);e.array.unshift(typeof i=="number"?t.precision(i):i)}}function ro(t){return(e,i=!0)=>{let r=0,s=0;for(const l of e.array){const c=Number(l);!isNaN(c)&&c!==null&&c!==void 0&&(r+=c,s++)}if(s===0)return NaN;const a=r/s;let n=0;for(const l of e.array){const c=Number(l);!isNaN(c)&&c!==null&&c!==void 0&&(n+=(c-a)*(c-a))}const o=i?s:s-1;return o<=0?NaN:t.precision(n/o)}}var so=Object.defineProperty,no=(t,e,i)=>e in t?so(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,R=(t,e,i)=>no(t,typeof e!="symbol"?e+"":e,i),H=(t=>(t.any="",t.box="box",t.bool="bool",t.color="color",t.float="float",t.int="int",t.label="label",t.line="line",t.linefill="linefill",t.string="string",t.table="table",t))(H||{});class W{constructor(e,i,r){this.array=e,this.type=i,this.context=r,R(this,"_abs"),R(this,"_avg"),R(this,"_binary_search"),R(this,"_binary_search_leftmost"),R(this,"_binary_search_rightmost"),R(this,"_clear"),R(this,"_concat"),R(this,"_copy"),R(this,"_covariance"),R(this,"_every"),R(this,"_fill"),R(this,"_first"),R(this,"_get"),R(this,"_includes"),R(this,"_indexof"),R(this,"_insert"),R(this,"_join"),R(this,"_last"),R(this,"_lastindexof"),R(this,"_max"),R(this,"_median"),R(this,"_min"),R(this,"_mode"),R(this,"_percentile_linear_interpolation"),R(this,"_percentile_nearest_rank"),R(this,"_percentrank"),R(this,"_pop"),R(this,"_push"),R(this,"_range"),R(this,"_remove"),R(this,"_reverse"),R(this,"_set"),R(this,"_shift"),R(this,"_size"),R(this,"_slice"),R(this,"_some"),R(this,"_sort"),R(this,"_sort_indices"),R(this,"_standardize"),R(this,"_stdev"),R(this,"_sum"),R(this,"_unshift"),R(this,"_variance"),this._abs=pa(this.context),this._avg=fa(this.context),this._binary_search=da(this.context),this._binary_search_leftmost=ma(this.context),this._binary_search_rightmost=ga(this.context),this._clear=xa(this.context),this._concat=ya(this.context),this._copy=_a(this.context),this._covariance=ba(this.context),this._every=va(this.context),this._fill=Sa(this.context),this._first=Ea(this.context),this._get=Na(this.context),this._includes=Ca(this.context),this._indexof=Ia(this.context),this._insert=ka(this.context),this._join=Aa(this.context),this._last=Ta(this.context),this._lastindexof=Pa(this.context),this._max=Da(this.context),this._median=Ra(this.context),this._min=Oa(this.context),this._mode=Ma(this.context),this._percentile_linear_interpolation=Va(this.context),this._percentile_nearest_rank=La(this.context),this._percentrank=ja(this.context),this._pop=Ba(this.context),this._push=Fa(this.context),this._range=$a(this.context),this._remove=Wa(this.context),this._reverse=Ua(this.context),this._set=qa(this.context),this._shift=Ka(this.context),this._size=za(this.context),this._slice=Ha(this.context),this._some=Ga(this.context),this._sort=Xa(this.context),this._sort_indices=Za(this.context),this._standardize=Ja(this.context),this._stdev=eo(this.context),this._sum=to(this.context),this._unshift=io(this.context),this._variance=ro(this.context)}toString(){return"["+this.array.toString().replace(/,/g,", ")+"]"}[Symbol.iterator](){return this.array[Symbol.iterator]()}abs(...e){return this._abs(this,...e)}avg(...e){return this._avg(this,...e)}binary_search(...e){return this._binary_search(this,...e)}binary_search_leftmost(...e){return this._binary_search_leftmost(this,...e)}binary_search_rightmost(...e){return this._binary_search_rightmost(this,...e)}clear(...e){return this._clear(this,...e)}concat(...e){return this._concat(this,...e)}copy(...e){return this._copy(this,...e)}covariance(...e){return this._covariance(this,...e)}every(...e){return this._every(this,...e)}fill(...e){return this._fill(this,...e)}first(...e){return this._first(this,...e)}get(...e){return this._get(this,...e)}includes(...e){return this._includes(this,...e)}indexof(...e){return this._indexof(this,...e)}insert(...e){return this._insert(this,...e)}join(...e){return this._join(this,...e)}last(...e){return this._last(this,...e)}lastindexof(...e){return this._lastindexof(this,...e)}max(...e){return this._max(this,...e)}median(...e){return this._median(this,...e)}min(...e){return this._min(this,...e)}mode(...e){return this._mode(this,...e)}percentile_linear_interpolation(...e){return this._percentile_linear_interpolation(this,...e)}percentile_nearest_rank(...e){return this._percentile_nearest_rank(this,...e)}percentrank(...e){return this._percentrank(this,...e)}pop(...e){return this._pop(this,...e)}push(...e){return this._push(this,...e)}range(...e){return this._range(this,...e)}remove(...e){return this._remove(this,...e)}reverse(...e){return this._reverse(this,...e)}set(...e){return this._set(this,...e)}shift(...e){return this._shift(this,...e)}size(...e){return this._size(this,...e)}slice(...e){return this._slice(this,...e)}some(...e){return this._some(this,...e)}sort(...e){return this._sort(this,...e)}sort_indices(...e){return this._sort_indices(this,...e)}standardize(...e){return this._standardize(this,...e)}stdev(...e){return this._stdev(this,...e)}sum(...e){return this._sum(this,...e)}unshift(...e){return this._unshift(this,...e)}variance(...e){return this._variance(this,...e)}}function ao(t){return(...e)=>new W([...e],wa(e),t)}function oo(t){return(e,i)=>{if(i===void 0){const r=e?Array(e).fill(0):[];return new W(r,H.any,t)}return new W(Array(e).fill(t.precision(i||0)),Re(i||0),t)}}function lo(t){return(e,i=!1)=>new W(Array(e).fill(i),H.bool,t)}function co(t){return(e,i=NaN)=>new W(Array(e).fill(t.precision(i)),H.float,t)}function ho(t){return(e,i=0)=>new W(Array(e).fill(t.precision(i)),H.int,t)}function uo(t){return(e,i="")=>new W(Array(e).fill(i),H.string,t)}class x{constructor(e,i=0){this.data=e,this.offset=i}get(e){const i=this.data.length-1-(this.offset+e);return i<0||i>=this.data.length?NaN:this.data[i]}set(e,i){const r=this.data.length-1-(this.offset+e);r>=0&&r<this.data.length&&(this.data[r]=i)}get length(){return this.data.length}toArray(){return this.data}static from(e){return e instanceof x?e:Array.isArray(e)?new x(e):new x([e])}}function po(t){return(e,i=0)=>x.from(e).get(i)}class fo{constructor(e){this.context=e,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=ao(e),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=oo(e),this.new_bool=lo(e),this.new_float=co(e),this.new_int=ho(e),this.new_string=uo(e),this.param=po(),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 mo(t){return e=>{e.map.clear()}}function go(t){return(e,i)=>e.map.has(i)}function xo(t){return e=>{const i=new vs(t);return i.map=new Map(e.map),i}}function yo(t){return(e,i)=>{const r=e.map.get(i);return r===void 0?NaN:r}}function _o(t){return e=>{const i=Array.from(e.map.keys()),r=Re(i[0]);return new W(i,r,t)}}function bo(t){return(e,i,r)=>{const s=e.map.get(i);return e.map.set(i,r),s===void 0?NaN:s}}function vo(t){return(e,i)=>{for(const[r,s]of i.map)e.map.set(r,s)}}function wo(t){return(e,i)=>{const r=e.map.get(i);return e.map.delete(i)?r:NaN}}function So(t){return e=>e.map.size}function Eo(t){return e=>{const i=Array.from(e.map.values()),r=Re(i[0]);return new W(i,r,t)}}var No=Object.defineProperty,Co=(t,e,i)=>e in t?No(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ae=(t,e,i)=>Co(t,typeof e!="symbol"?e+"":e,i);class vs{constructor(e){this.context=e,Ae(this,"map"),Ae(this,"_clear"),Ae(this,"_contains"),Ae(this,"_copy"),Ae(this,"_get"),Ae(this,"_keys"),Ae(this,"_put"),Ae(this,"_put_all"),Ae(this,"_remove"),Ae(this,"_size"),Ae(this,"_values"),this.map=new Map,this._clear=mo(this.context),this._contains=go(this.context),this._copy=xo(this.context),this._get=yo(this.context),this._keys=_o(this.context),this._put=bo(this.context),this._put_all=vo(this.context),this._remove=wo(this.context),this._size=So(this.context),this._values=Eo(this.context)}toString(){return`PineMapObject(${this.map.size})`}clear(...e){return this._clear(this,...e)}contains(...e){return this._contains(this,...e)}copy(...e){return this._copy(this,...e)}get(...e){return this._get(this,...e)}keys(...e){return this._keys(this,...e)}put(...e){return this._put(this,...e)}put_all(...e){return this._put_all(this,...e)}remove(...e){return this._remove(this,...e)}size(...e){return this._size(this,...e)}values(...e){return this._values(this,...e)}}function Io(t){return()=>new vs(t)}function ko(t){return(e,i=0)=>x.from(e).get(i)}class Ao{constructor(e){this.context=e,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=Io(e),this.param=ko(),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 To(t){return(e,i,r)=>{const s=e.matrix.length;let a=[];if(r&&(r instanceof W?a=r.array:Array.isArray(r)?a=r:a=[r]),s===0){for(let l=0;l<a.length;l++){let c=a[l];c instanceof x&&(c=c.get(0)),e.matrix.push([c])}return}const n=e.matrix[0].length,o=i!==void 0?i:n;for(let l=0;l<s;l++){let c=l<a.length?a[l]:NaN;c instanceof x&&(c=c.get(0)),e.matrix[l].splice(o,0,c)}}}function Po(t){return(e,i,r)=>{const s=e.matrix.length;let a=[];if(r)if(r instanceof W)a=r.array;else if(Array.isArray(r))a=r;else if(r instanceof x){const c=r.get(0);Array.isArray(c)?a=c:a=[c]}else a=[r];const n=s>0?e.matrix[0].length:a.length,o=i!==void 0?i:s,l=[];for(let c=0;c<n;c++)if(c<a.length){let h=a[c];h instanceof x&&(h=h.get(0)),l.push(h)}else l.push(NaN);e.matrix.splice(o,0,l)}}function Do(t){return e=>{const i=e.matrix.length;if(i===0)return NaN;const r=e.matrix[0].length;if(r===0)return NaN;let s=0,a=0;for(let n=0;n<i;n++)for(let o=0;o<r;o++){const l=e.matrix[n][o];isNaN(l)||(s+=l,a++)}return a===0?NaN:s/a}}function Ro(t){return(e,i)=>{const r=e.matrix.length,s=[];for(let n=0;n<r;n++)s.push(e.matrix[n][i]);const a=Re(s[0]);return new W(s,a,t)}}function Oo(t){return e=>e.matrix.length===0?0:e.matrix[0].length}function Mo(t){return(e,i)=>{const r=e.matrix.length,s=i.matrix.length;if(r===0){for(let o=0;o<s;o++)e.matrix.push([...i.matrix[o]]);return}const a=e.matrix[0].length,n=s>0?i.matrix[0].length:0;if(a!==n&&s>0){console.error(`matrix.concat: Column count mismatch ${a} vs ${n}`);return}for(let o=0;o<s;o++)e.matrix.push([...i.matrix[o]])}}function Vo(t){return e=>{const i=e.matrix.length,r=i>0?e.matrix[0].length:0,s=new F(i,r,NaN,t);return s.matrix=e.matrix.map(a=>[...a]),s}}function Lo(t){const e=t.length;if(e===0)return 0;if(e===1)return t[0][0];if(e===2)return t[0][0]*t[1][1]-t[0][1]*t[1][0];const i=t.map(s=>[...s]);let r=1;for(let s=0;s<e;s++){let a=s;for(;a<e&&i[a][s]===0;)a++;if(a===e)return 0;a!==s&&([i[s],i[a]]=[i[a],i[s]],r*=-1),r*=i[s][s];for(let n=s+1;n<e;n++){const o=i[n][s]/i[s][s];for(let l=s;l<e;l++)i[n][l]-=o*i[s][l]}}return r}function jo(t){return e=>{const i=e.matrix.length,r=i>0?e.matrix[0].length:0;return i!==r?NaN:Lo(e.matrix)}}function Bo(t){return(e,i)=>{const r=e.matrix.length;if(r===0)return new F(0,0,NaN,t);const s=e.matrix[0].length,a=new F(r,s,NaN,t);if(i instanceof F)for(let n=0;n<r;n++)for(let o=0;o<s;o++){const l=e.matrix[n][o],c=i.matrix[n]&&i.matrix[n][o]!==void 0?i.matrix[n][o]:NaN;a.matrix[n][o]=l-c}else{const n=i;for(let o=0;o<r;o++)for(let l=0;l<s;l++)a.matrix[o][l]=e.matrix[o][l]-n}return a}}function Fo(t){const e=t.length;if(e!==2)return Array(e).fill(NaN);const i=t[0][0],r=t[0][1],s=t[1][0],a=t[1][1],n=i+a,o=i*a-r*s,l=n*n-4*o;if(l<0)return[NaN,NaN];const c=(n+Math.sqrt(l))/2,h=(n-Math.sqrt(l))/2;return[c,h]}function $o(t){return e=>{const i=e.matrix.length,r=i>0?e.matrix[0].length:0;if(i!==r){const n=Re(e.matrix[0][0]);return new W([],n,t)}const s=Fo(e.matrix),a=Re(s[0]);return new W(s,a,t)}}function Wo(t){return e=>{const i=e.matrix.length,r=i>0?e.matrix[0].length:0;if(i!==r)return new F(0,0,NaN,t);const s=new F(i,r,0,t);for(let a=0;a<i;a++)s.matrix[a][a]=1;return s}}function Uo(t){return e=>{const i=e.matrix.length;return i===0?0:i*e.matrix[0].length}}function qo(t){return(e,i,r,s,a,n)=>{const o=e.matrix.length;if(o===0)return;const l=e.matrix[0].length,c=r!==void 0?r:0,h=s!==void 0?s:o,p=a!==void 0?a:0,u=n!==void 0?n:l;for(let f=c;f<h&&!(f>=o);f++)for(let m=p;m<u&&!(m>=l);m++)e.matrix[f][m]=i}}function Ko(t){return(e,i,r)=>{if(!e.matrix[i])return NaN;const s=e.matrix[i][r];return s===void 0?NaN:s}}function Pt(t){const e=t.length;if(e===0)return[];const i=new Array(e);for(let s=0;s<e;s++){i[s]=new Array(2*e);for(let a=0;a<e;a++)i[s][a]=t[s][a];for(let a=0;a<e;a++)i[s][e+a]=s===a?1:0}for(let s=0;s<e;s++){let a=Math.abs(i[s][s]),n=s;for(let l=s+1;l<e;l++){const c=Math.abs(i[l][s]);c>a&&(a=c,n=l)}if(a<1e-14)return t.map(l=>l.map(()=>NaN));if(n!==s){const l=i[s];i[s]=i[n],i[n]=l}const o=i[s][s];for(let l=s;l<2*e;l++)i[s][l]/=o;for(let l=0;l<e;l++){if(l===s)continue;const c=i[l][s];if(c!==0)for(let h=s;h<2*e;h++)i[l][h]-=c*i[s][h]}}const r=new Array(e);for(let s=0;s<e;s++){r[s]=new Array(e);for(let a=0;a<e;a++)r[s][a]=i[s][e+a]}return r}function zo(t){return e=>{const i=e.matrix.length,r=i>0?e.matrix[0].length:0;if(i!==r)return new F(i,r,NaN,t);const s=Pt(e.matrix),a=new F(i,r,NaN,t);return a.matrix=s,a}}function Ho(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let a=0;a<r;a++)if(s+a!==i-1&&e.matrix[s][a]!==0)return!1;return!0}}function Go(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let a=0;a<r;a++)if(e.matrix[a][s]!==-e.matrix[s][a])return!1;return!0}}function Yo(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;for(let s=0;s<i;s++)for(let a=0;a<r;a++){const n=e.matrix[s][a];if(n!==0&&n!==1)return!1}return!0}}function Qo(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let a=0;a<r;a++)if(s!==a&&e.matrix[s][a]!==0)return!1;return!0}}function Xo(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let a=0;a<r;a++)if(s===a){if(e.matrix[s][a]!==1)return!1}else if(e.matrix[s][a]!==0)return!1;return!0}}function Zo(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;return i===r}}function Jo(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;for(let s=0;s<i;s++){let a=0;for(let n=0;n<r;n++){const o=e.matrix[s][n];if(o<0)return!1;a+=o}if(Math.abs(a-1)>1e-10)return!1}return!0}}function el(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;for(let s=0;s<i;s++)for(let a=0;a<s;a++)if(e.matrix[s][a]!==e.matrix[a][s])return!1;return!0}}function tl(t){return e=>{const i=e.matrix.length;if(i===0)return!1;const r=e.matrix[0].length;if(i!==r)return!1;let s=!0,a=!0;for(let n=0;n<i;n++)for(let o=0;o<r;o++)n>o&&e.matrix[n][o]!==0&&(s=!1),n<o&&e.matrix[n][o]!==0&&(a=!1);return s||a}}function il(t){return e=>{const i=e.matrix.length;if(i===0)return!0;const r=e.matrix[0].length;for(let s=0;s<i;s++)for(let a=0;a<r;a++)if(e.matrix[s][a]!==0)return!1;return!0}}function rl(t){return(e,i)=>{const r=e.matrix.length,s=r>0?e.matrix[0].length:0,a=i.matrix.length,n=a>0?i.matrix[0].length:0,o=r*a,l=s*n,c=new F(o,l,NaN,t);for(let h=0;h<r;h++)for(let p=0;p<s;p++){const u=e.matrix[h][p];for(let f=0;f<a;f++)for(let m=0;m<n;m++){const y=i.matrix[f][m];c.matrix[h*a+f][p*n+m]=u*y}}return c}}function sl(t){return e=>{const i=e.matrix.length;if(i===0)return NaN;const r=e.matrix[0].length;let s=-1/0,a=!1;for(let n=0;n<i;n++)for(let o=0;o<r;o++){const l=e.matrix[n][o];isNaN(l)||(l>s&&(s=l),a=!0)}return a?s:NaN}}function nl(t){return e=>{const i=e.matrix.length;if(i===0)return NaN;const r=e.matrix[0].length,s=[];for(let n=0;n<i;n++)for(let o=0;o<r;o++){const l=e.matrix[n][o];isNaN(l)||s.push(l)}if(s.length===0)return NaN;s.sort((n,o)=>n-o);const a=Math.floor(s.length/2);return s.length%2!==0?s[a]:(s[a-1]+s[a])/2}}function al(t){return e=>{const i=e.matrix.length;if(i===0)return NaN;const r=e.matrix[0].length;let s=1/0,a=!1;for(let n=0;n<i;n++)for(let o=0;o<r;o++){const l=e.matrix[n][o];isNaN(l)||(l<s&&(s=l),a=!0)}return a?s:NaN}}function ol(t){return e=>{const i=e.matrix.length;if(i===0)return NaN;const r=e.matrix[0].length,s=new Map;let a=0,n=NaN;for(let o=0;o<i;o++)for(let l=0;l<r;l++){const c=e.matrix[o][l];if(!isNaN(c)){const h=(s.get(c)||0)+1;s.set(c,h),h>a?(a=h,n=c):h===a&&c<n&&(n=c)}}return n}}function ll(t){return(e,i)=>{const r=e.matrix.length,s=r>0?e.matrix[0].length:0;if(i instanceof F){const a=i.matrix.length,n=a>0?i.matrix[0].length:0;if(s!==a)return new F(0,0,NaN,t);const o=new F(r,n,0,t);for(let l=0;l<r;l++)for(let c=0;c<n;c++){let h=0;for(let p=0;p<s;p++)h+=e.matrix[l][p]*i.matrix[p][c];o.matrix[l][c]=h}return o}else if(i instanceof W||Array.isArray(i.array||i)){const a=i.array||i;if(s!==a.length)return new F(0,0,NaN,t);const n=new F(r,1,0,t);for(let o=0;o<r;o++){let l=0;for(let c=0;c<s;c++)l+=e.matrix[o][c]*a[c];n.matrix[o][0]=l}return n}else{const a=i,n=new F(r,s,NaN,t);for(let o=0;o<r;o++)for(let l=0;l<s;l++)n.matrix[o][l]=e.matrix[o][l]*a;return n}}}function cl(t){return e=>{const i=e.matrix.length;if(i===0)return new F(0,0,NaN,t);const r=e.matrix[0].length;if(i===r){const h=Pt(e.matrix),p=new F(i,r,NaN,t);return p.matrix=h,p}const s=h=>{const p=h.length,u=h[0].length,f=new Array(u);for(let m=0;m<u;m++){f[m]=new Array(p);for(let y=0;y<p;y++)f[m][y]=h[y][m]}return f},a=(h,p)=>{const u=h.length,f=h[0].length,m=p[0].length,y=new Array(u);for(let _=0;_<u;_++){y[_]=new Array(m).fill(0);for(let b=0;b<f;b++){const w=h[_][b];if(w!==0)for(let v=0;v<m;v++)y[_][v]+=w*p[b][v]}}return y},n=e.matrix,o=s(n);let l;if(i>r){const h=a(o,n),p=Pt(h);l=a(p,o)}else{const h=a(n,o),p=Pt(h);l=a(o,p)}const c=new F(r,i,NaN,t);return c.matrix=l,c}}function hl(t){return(e,i)=>{const r=e.matrix.length,s=r>0?e.matrix[0].length:0;if(r!==s)return new F(0,0,NaN,t);let a=new F(r,s,0,t);for(let l=0;l<r;l++)a.matrix[l][l]=1;let n=new F(r,s,NaN,t);for(let l=0;l<r;l++)n.matrix[l]=[...e.matrix[l]];let o=Math.floor(i);if(o<0)return new F(r,s,NaN,t);for(;o>0;){if(o%2===1){const c=new F(r,s,0,t);for(let h=0;h<r;h++)for(let p=0;p<s;p++){let u=0;for(let f=0;f<r;f++)u+=a.matrix[h][f]*n.matrix[f][p];c.matrix[h][p]=u}a=c}const l=new F(r,s,0,t);for(let c=0;c<r;c++)for(let h=0;h<s;h++){let p=0;for(let u=0;u<r;u++)p+=n.matrix[c][u]*n.matrix[u][h];l.matrix[c][h]=p}n=l,o=Math.floor(o/2)}return a}}function ul(t){return e=>{const i=e.matrix.length;if(i===0)return 0;const r=e.matrix[0].length,s=e.matrix.map(n=>[...n]);let a=0;for(let n=0;n<r&&a<i;n++){let o=a;for(;o<i&&Math.abs(s[o][n])<1e-10;)o++;if(o<i){[s[a],s[o]]=[s[o],s[a]];const l=s[a][n];for(let c=n;c<r;c++)s[a][c]/=l;for(let c=0;c<i;c++)if(c!==a){const h=s[c][n];for(let p=n;p<r;p++)s[c][p]-=h*s[a][p]}a++}}return a}}function pl(t){return(e,i)=>{const r=e.matrix.length;if(r===0){const n=Re(e.matrix[0][0]);return new W([],n,t)}const s=[];for(let n=0;n<r;n++){const o=e.matrix[n].splice(i,1);s.push(o[0])}const a=Re(s[0]);return new W(s,a,t)}}function fl(t){return(e,i)=>{const r=e.matrix.splice(i,1),s=Re(r[0][0]);return new W(r[0]||[],s,t)}}function dl(t){return(e,i,r)=>{const s=e.matrix.length,a=s>0?e.matrix[0].length:0,n=i*r,o=[];for(let h=0;h<s;h++)for(let p=0;p<a;p++)o.push(e.matrix[h][p]);for(;o.length<n;)o.push(NaN);o.length>n&&(o.length=n);const l=[];let c=0;for(let h=0;h<i;h++){const p=[];for(let u=0;u<r;u++)p.push(o[c++]);l.push(p)}e.matrix=l}}function ml(t){return e=>{e.matrix.reverse();for(const i of e.matrix)i.reverse()}}function gl(t){return(e,i)=>{if(!e.matrix[i]){const s=Re(e.matrix[0][0]);return new W([],s,t)}const r=Re(e.matrix[i][0]);return new W([...e.matrix[i]],r,t)}}function xl(t){return e=>e.matrix.length}function yl(t){return(e,i,r,s)=>{e.matrix[i]&&(e.matrix[i][r]=s)}}function _l(t){return(e,i=0,r="asc")=>{e.matrix.length!==0&&e.matrix.sort((s,a)=>{const n=s[i],o=a[i];return n<o?r==="asc"?-1:1:n>o?r==="asc"?1:-1:0})}}function bl(t){return(e,i,r,s,a)=>{const n=r-i,o=a-s,l=new F(n,o,NaN,t);for(let c=0;c<n;c++){const h=i+c;if(h>=e.matrix.length)break;for(let p=0;p<o;p++){const u=s+p;if(u>=e.matrix[h].length)break;l.matrix[c][p]=e.matrix[h][u]}}return l}}function vl(t){return(e,i)=>{const r=e.matrix.length;if(r===0)return new F(0,0,NaN,t);const s=e.matrix[0].length,a=new F(r,s,NaN,t);if(i instanceof F)for(let n=0;n<r;n++)for(let o=0;o<s;o++){const l=e.matrix[n][o],c=i.matrix[n]&&i.matrix[n][o]!==void 0?i.matrix[n][o]:NaN;a.matrix[n][o]=l+c}else{const n=i;for(let o=0;o<r;o++)for(let l=0;l<s;l++)a.matrix[o][l]=e.matrix[o][l]+n}return a}}function wl(t){return(e,i,r)=>{const s=e.matrix.length;for(let a=0;a<s;a++){const n=e.matrix[a][i];e.matrix[a][i]=e.matrix[a][r],e.matrix[a][r]=n}}}function Sl(t){return(e,i,r)=>{const s=e.matrix[i];e.matrix[i]=e.matrix[r],e.matrix[r]=s}}function El(t){return e=>{const i=e.matrix.length;if(i===0)return 0;const r=e.matrix[0].length,s=Math.min(i,r);let a=0;for(let n=0;n<s;n++)a+=e.matrix[n][n];return a}}function Nl(t){return e=>{const i=e.matrix.length;if(i===0)return new F(0,0,NaN,t);const r=e.matrix[0].length,s=new F(r,i,NaN,t);for(let a=0;a<i;a++)for(let n=0;n<r;n++)s.matrix[n][a]=e.matrix[a][n];return s}}var Cl=Object.defineProperty,Il=(t,e,i)=>e in t?Cl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,T=(t,e,i)=>Il(t,typeof e!="symbol"?e+"":e,i);class F{constructor(e=0,i=0,r=NaN,s){if(this.context=s,T(this,"matrix"),T(this,"_add_col"),T(this,"_add_row"),T(this,"_avg"),T(this,"_col"),T(this,"_columns"),T(this,"_concat"),T(this,"_copy"),T(this,"_det"),T(this,"_diff"),T(this,"_eigenvalues"),T(this,"_eigenvectors"),T(this,"_elements_count"),T(this,"_fill"),T(this,"_get"),T(this,"_inv"),T(this,"_is_antidiagonal"),T(this,"_is_antisymmetric"),T(this,"_is_binary"),T(this,"_is_diagonal"),T(this,"_is_identity"),T(this,"_is_square"),T(this,"_is_stochastic"),T(this,"_is_symmetric"),T(this,"_is_triangular"),T(this,"_is_zero"),T(this,"_kron"),T(this,"_max"),T(this,"_median"),T(this,"_min"),T(this,"_mode"),T(this,"_mult"),T(this,"_pinv"),T(this,"_pow"),T(this,"_rank"),T(this,"_remove_col"),T(this,"_remove_row"),T(this,"_reshape"),T(this,"_reverse"),T(this,"_row"),T(this,"_rows"),T(this,"_set"),T(this,"_sort"),T(this,"_submatrix"),T(this,"_sum"),T(this,"_swap_columns"),T(this,"_swap_rows"),T(this,"_trace"),T(this,"_transpose"),this.matrix=[],e>0&&i>0)for(let a=0;a<e;a++)this.matrix.push(Array(i).fill(r));this._add_col=To(this.context),this._add_row=Po(this.context),this._avg=Do(this.context),this._col=Ro(this.context),this._columns=Oo(this.context),this._concat=Mo(this.context),this._copy=Vo(this.context),this._det=jo(this.context),this._diff=Bo(this.context),this._eigenvalues=$o(this.context),this._eigenvectors=Wo(this.context),this._elements_count=Uo(this.context),this._fill=qo(this.context),this._get=Ko(this.context),this._inv=zo(this.context),this._is_antidiagonal=Ho(this.context),this._is_antisymmetric=Go(this.context),this._is_binary=Yo(this.context),this._is_diagonal=Qo(this.context),this._is_identity=Xo(this.context),this._is_square=Zo(this.context),this._is_stochastic=Jo(this.context),this._is_symmetric=el(this.context),this._is_triangular=tl(this.context),this._is_zero=il(this.context),this._kron=rl(this.context),this._max=sl(this.context),this._median=nl(this.context),this._min=al(this.context),this._mode=ol(this.context),this._mult=ll(this.context),this._pinv=cl(this.context),this._pow=hl(this.context),this._rank=ul(this.context),this._remove_col=pl(this.context),this._remove_row=fl(this.context),this._reshape=dl(this.context),this._reverse=ml(this.context),this._row=gl(this.context),this._rows=xl(this.context),this._set=yl(this.context),this._sort=_l(this.context),this._submatrix=bl(this.context),this._sum=vl(this.context),this._swap_columns=wl(this.context),this._swap_rows=Sl(this.context),this._trace=El(this.context),this._transpose=Nl(this.context)}toString(){let e="";for(let i=0;i<this.matrix.length;i++)e+=e===""?"":`
|
|
137
|
+
`,e+="["+this.matrix[i].join(", ")+"]";return e}add_col(...e){return this._add_col(this,...e)}add_row(...e){return this._add_row(this,...e)}avg(...e){return this._avg(this,...e)}col(...e){return this._col(this,...e)}columns(...e){return this._columns(this,...e)}concat(...e){return this._concat(this,...e)}copy(...e){return this._copy(this,...e)}det(...e){return this._det(this,...e)}diff(...e){return this._diff(this,...e)}eigenvalues(...e){return this._eigenvalues(this,...e)}eigenvectors(...e){return this._eigenvectors(this,...e)}elements_count(...e){return this._elements_count(this,...e)}fill(...e){return this._fill(this,...e)}get(...e){return this._get(this,...e)}inv(...e){return this._inv(this,...e)}is_antidiagonal(...e){return this._is_antidiagonal(this,...e)}is_antisymmetric(...e){return this._is_antisymmetric(this,...e)}is_binary(...e){return this._is_binary(this,...e)}is_diagonal(...e){return this._is_diagonal(this,...e)}is_identity(...e){return this._is_identity(this,...e)}is_square(...e){return this._is_square(this,...e)}is_stochastic(...e){return this._is_stochastic(this,...e)}is_symmetric(...e){return this._is_symmetric(this,...e)}is_triangular(...e){return this._is_triangular(this,...e)}is_zero(...e){return this._is_zero(this,...e)}kron(...e){return this._kron(this,...e)}max(...e){return this._max(this,...e)}median(...e){return this._median(this,...e)}min(...e){return this._min(this,...e)}mode(...e){return this._mode(this,...e)}mult(...e){return this._mult(this,...e)}pinv(...e){return this._pinv(this,...e)}pow(...e){return this._pow(this,...e)}rank(...e){return this._rank(this,...e)}remove_col(...e){return this._remove_col(this,...e)}remove_row(...e){return this._remove_row(this,...e)}reshape(...e){return this._reshape(this,...e)}reverse(...e){return this._reverse(this,...e)}row(...e){return this._row(this,...e)}rows(...e){return this._rows(this,...e)}set(...e){return this._set(this,...e)}sort(...e){return this._sort(this,...e)}submatrix(...e){return this._submatrix(this,...e)}sum(...e){return this._sum(this,...e)}swap_columns(...e){return this._swap_columns(this,...e)}swap_rows(...e){return this._swap_rows(this,...e)}trace(...e){return this._trace(this,...e)}transpose(...e){return this._transpose(this,...e)}}function kl(t){return(e,i,r)=>new F(e,i,r,t)}function Al(t){return(e,i=0)=>x.from(e).get(i)}class Tl{constructor(e){this.context=e,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=kl(e),this.param=Al(),this.pinv=(i,...r)=>i.pinv(...r),this.pow=(i,...r)=>i.pow(...r),this.rank=(i,...r)=>i.rank(...r),this.remove_col=(i,...r)=>i.remove_col(...r),this.remove_row=(i,...r)=>i.remove_row(...r),this.reshape=(i,...r)=>i.reshape(...r),this.reverse=(i,...r)=>i.reverse(...r),this.row=(i,...r)=>i.row(...r),this.rows=(i,...r)=>i.rows(...r),this.set=(i,...r)=>i.set(...r),this.sort=(i,...r)=>i.sort(...r),this.submatrix=(i,...r)=>i.submatrix(...r),this.sum=(i,...r)=>i.sum(...r),this.swap_columns=(i,...r)=>i.swap_columns(...r),this.swap_rows=(i,...r)=>i.swap_rows(...r),this.trace=(i,...r)=>i.trace(...r),this.transpose=(i,...r)=>i.transpose(...r)}}var Pl=Object.defineProperty,Dl=(t,e,i)=>e in t?Pl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Rl=(t,e,i)=>Dl(t,typeof e!="symbol"?e+"":e,i);class Ol{constructor(e){this.context=e,Rl(this,"_live",!1)}setLive(){this._live=!0}get isnew(){return!this._live}get islast(){return this.context.idx===this.context.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()}}class Lt{constructor(e,i){this._definition=e,this.context=i;for(let r in e)this[r]=e[r]}get __def__(){return this._definition}copy(){return new Lt(this.__def__,this.context)}toString(){const e={};for(let i in this.__def__){const r=this[i];r!=null&&typeof r=="object"&&typeof r.toString=="function"&&!(r instanceof Array)?e[i]=r.toString():e[i]=r}try{return JSON.stringify(e)}catch{return"{"+Object.keys(e).map(i=>`"${i}":${String(e[i])}`).join(",")+"}"}}}var Ml=Object.defineProperty,Vl=(t,e,i)=>e in t?Ml(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ei=(t,e,i)=>Vl(t,typeof e!="symbol"?e+"":e,i);class me{constructor(e,i,r){ei(this,"time"),ei(this,"index"),ei(this,"price"),this.time=e,this.index=i,this.price=r}copy(){return new me(this.time,this.index,this.price)}toString(){return JSON.stringify({time:this.time,index:this.index,price:this.price})}}function Ll(t){return typeof t=="object"&&t&&(t.title!==void 0||t._plotKey!==void 0)&&t.data!==void 0&&t.options!==void 0}const Qi={series:t=>t instanceof x||typeof t=="number"||typeof t=="string"||typeof t=="boolean",string:t=>typeof t=="string",number:t=>typeof t=="number",boolean:t=>typeof t=="boolean",array:t=>Array.isArray(t),object:t=>typeof t=="object",point:t=>t instanceof me,primitive:t=>typeof t===null||typeof t!="object"&&typeof t!="function",function:t=>typeof t=="function",undefined:t=>t===void 0,null:t=>t===null,NaN:t=>isNaN(t),remaining_options:t=>typeof t=="object"&&!(t instanceof x)&&!(t instanceof me)&&!Ll(t)};function Ve(t){const e=t[t.length-1];if(e&&typeof e=="object"&&"__callsiteId"in e)return t.pop().__callsiteId}function te(t,e,i,r){Array.isArray(e)&&typeof e[0]=="string"&&(e=[e]);const s={};let a={};const n=new Array(e.length).fill(!0);for(let o=0;o<t.length;o++){const l=t[o];if(Qi.remaining_options(l)){a=l;break}const c=e.map((h,p)=>n[p]?h[o]:void 0);for(let h=0;h<c.length;h++){const p=c[h];if(p===void 0){n[h]=!1;continue}const u=Qi[i[p]];typeof u=="function"&&u(l)?s[p]=l:n[h]=!1}}return{...a,...s,...r}}var jl=Object.defineProperty,Bl=(t,e,i)=>e in t?jl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Fl=(t,e,i)=>Bl(t,typeof e!="symbol"?e+"":e,i);const $l=[["dateString"],["year","month","day","hour","minute","second"],["timezone","year","month","day","hour","minute","second"]],Wl={dateString:"string",timezone:"string",year:"number",month:"number",day:"number",hour:"number",minute:"number",second:"number"},Ul=["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"],ql={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 Xi(t){if(!t||typeof t!="string")return null;if(t.startsWith("#")){const i=t.slice(1);return i.length===6?[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),1]:i.length===8?[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),parseInt(i.slice(6,8),16)/255]:null}const e=t.match(/rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\s*\)/);return e?[parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),e[4]?parseFloat(e[4]):1]:null}function Kl(t,e,i,r){const s=Math.round(Math.max(0,Math.min(255,t))).toString(16).padStart(2,"0"),a=Math.round(Math.max(0,Math.min(255,e))).toString(16).padStart(2,"0"),n=Math.round(Math.max(0,Math.min(255,i))).toString(16).padStart(2,"0");if(r>=1)return`#${s}${a}${n}`.toUpperCase();const o=Math.round(Math.max(0,Math.min(255,r*255))).toString(16).padStart(2,"0");return`#${s}${a}${n}${o}`.toUpperCase()}const J={aqua:"#00BCD4",black:"#363A45",blue:"#2196F3",fuchsia:"#E040FB",gray:"#787B86",green:"#4CAF50",lime:"#00E676",maroon:"#880E4F",navy:"#311B92",olive:"#808000",orange:"#FF9800",purple:"#9C27B0",red:"#F23645",silver:"#B2B5BE",teal:"#089981",white:"#FFFFFF",yellow:"#FDD835"};function zl(t){return te(t,Ul,ql)}class Hl{get __value(){return NaN}param(e,i=0){return x.from(e).get(i)}any(e){const i=x.from(e).get(0);return i==null?!0:typeof i=="number"?i!==i:!1}}class Gl{constructor(e){this.context=e,Fl(this,"color",{param:(i,r=0)=>x.from(i).get(r),rgb:(i,r,s,a)=>a?`rgba(${i}, ${r}, ${s}, ${(100-a)/100})`:`rgb(${i}, ${r}, ${s})`,new:(i,r)=>{if(typeof i=="function"&&(i=i()),i&&typeof i=="object"&&Array.isArray(i.data)&&typeof i.get=="function"&&(i=i.get(0)),!i||typeof i!="string")return i;if(i.startsWith("#")){const s=i.slice(1);return r?`#${s}${Math.round(255/100*(100-r)).toString(16).padStart(2,"0").toUpperCase()}`:`#${s}`}else{const s=J[i];return s?r?`#${s}${Math.round(255/100*(100-r)).toString(16).padStart(2,"0").toUpperCase()}`:`#${s}`:r?`rgba(${i}, ${(100-r)/100})`:i}},from_gradient:(i,r,s,a,n)=>{typeof i=="function"&&(i=i()),typeof r=="function"&&(r=r()),typeof s=="function"&&(s=s()),typeof a=="function"&&(a=a()),typeof n=="function"&&(n=n()),i&&typeof i=="object"&&typeof i.get=="function"&&(i=i.get(0)),r&&typeof r=="object"&&typeof r.get=="function"&&(r=r.get(0)),s&&typeof s=="object"&&typeof s.get=="function"&&(s=s.get(0)),a&&typeof a=="object"&&typeof a.get=="function"&&(a=a.get(0)),n&&typeof n=="object"&&typeof n.get=="function"&&(n=n.get(0));let o=0;s!==r&&(o=(i-r)/(s-r)),o=Math.max(0,Math.min(1,o));const l=Xi(typeof a=="string"?a:"#000000")||[0,0,0,1],c=Xi(typeof n=="string"?n:"#FFFFFF")||[255,255,255,1],h=l[0]+(c[0]-l[0])*o,p=l[1]+(c[1]-l[1])*o,u=l[2]+(c[2]-l[2])*o,f=l[3]+(c[3]-l[3])*o;return Kl(h,p,u,f)},aqua:J.aqua,black:J.black,blue:J.blue,fuchsia:J.fuchsia,gray:J.gray,green:J.green,lime:J.lime,maroon:J.maroon,navy:J.navy,olive:J.olive,orange:J.orange,purple:J.purple,red:J.red,silver:J.silver,teal:J.teal,white:J.white,yellow:J.yellow})}extractPlotOptions(e){const i={};for(let r in e)i[r]=x.from(e[r]).get(0);return i}indicator(...e){const i=zl(e),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(e){return isNaN(x.from(e).get(0))}nz(e,i=0){const r=x.from(e).get(0),s=x.from(i).get(0);return isNaN(r)?s:r}fixnan(e){const i=x.from(e);for(let r=0;r<i.length;r++){const s=i.get(r);if(!isNaN(s))return s}return NaN}alertcondition(e,i,r){}timestamp(...e){const i=e.map(s=>s instanceof x?s.get(0):s),r=te(i,$l,Wl);if(r.year!==void 0){const s=r.year,a=r.month,n=r.day,o=r.hour||0,l=r.minute||0,c=r.second||0,h=r.timezone||this.context.pine?.syminfo?.timezone||"UTC";return this._timestampFromComponents(h,s,a,n,o,l,c)}return r.dateString!==void 0?new Date(r.dateString).getTime():NaN}_timestampFromComponents(e,i,r,s,a,n,o){const l=new Date(Date.UTC(i,r-1,s,a,n,o));i>=0&&i<100&&l.setUTCFullYear(i);const c=e.trim();if(c==="UTC"||c==="GMT")return l.getTime();const h=c.match(/^(?:UTC|GMT)([+-])(\d{1,2})(?::(\d{2}))?$/i);if(h){const p=h[1]==="+"?1:-1,u=parseInt(h[2],10),f=parseInt(h[3]||"0",10),m=p*(u*60+f)*60*1e3;return l.getTime()-m}try{return this._timestampFromIANA(e,i,r,s,a,n,o)}catch{return l.getTime()}}_timestampFromIANA(e,i,r,s,a,n,o){const l=new Date(Date.UTC(i,r-1,s,a,n,o));i>=0&&i<100&&l.setUTCFullYear(i);const c=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}).formatToParts(l),h=v=>parseInt(c.find(E=>E.type===v)?.value||"0",10),p=h("year"),u=h("month"),f=h("day");let m=h("hour");m===24&&(m=0);const y=h("minute"),_=h("second"),b=new Date(Date.UTC(p,u-1,f,m,y,_));p>=0&&p<100&&b.setUTCFullYear(p);const w=b.getTime()-l.getTime();return l.getTime()-w}bool(e){const i=x.from(e).get(0);return!isNaN(i)&&i!==0}int(e){const i=x.from(e).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.trunc(i)}float(e){const i=x.from(e).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(e){return x.from(e).get(0).toString()}Type(e){const i=Object.keys(e),r={};for(const s of i){let a=e[s];a instanceof x&&(a=a.data),Array.isArray(a)&&(a[0],r[s]=a[1])}return{new:function(...s){const a={};for(let n=0;n<i.length;n++){const o=i[n];n<s.length?a[o]=s[n]:o in r&&(a[o]=x.from(r[o]).get(0))}return new Lt(a,this.context)},copy:function(s){return new Lt(s.__def__,this.context)}}}}var Yl=Object.defineProperty,Ql=(t,e,i)=>e in t?Yl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,jt=(t,e,i)=>Ql(t,typeof e!="symbol"?e+"":e,i);function Bt(t,e){const i=e.trim();if(i==="UTC"||i==="GMT"){const s=new Date(t);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),hour:s.getUTCHours(),minute:s.getUTCMinutes(),second:s.getUTCSeconds(),dayOfWeek:s.getUTCDay()}}const r=i.match(/^(?:UTC|GMT)([+-])(\d{1,2})(?::(\d{2}))?$/i);if(r){const s=r[1]==="+"?1:-1,a=parseInt(r[2],10),n=parseInt(r[3]||"0",10),o=s*(a*60+n)*60*1e3,l=new Date(t+o);return{year:l.getUTCFullYear(),month:l.getUTCMonth()+1,day:l.getUTCDate(),hour:l.getUTCHours(),minute:l.getUTCMinutes(),second:l.getUTCSeconds(),dayOfWeek:l.getUTCDay()}}try{const s=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",weekday:"short",hour12:!1}).formatToParts(new Date(t)),a=c=>parseInt(s.find(h=>h.type===c)?.value||"0",10);let n=a("hour");n===24&&(n=0);const o=s.find(c=>c.type==="weekday")?.value||"Sun",l={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return{year:a("year"),month:a("month"),day:a("day"),hour:n,minute:a("minute"),second:a("second"),dayOfWeek:l[o]??0}}catch{const s=new Date(t);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),hour:s.getUTCHours(),minute:s.getUTCMinutes(),second:s.getUTCSeconds(),dayOfWeek:s.getUTCDay()}}}function Xl(t,e,i){const r=new Date(Date.UTC(t,e-1,i)),s=r.getUTCDay()||7;r.setUTCDate(r.getUTCDate()+4-s);const a=new Date(Date.UTC(r.getUTCFullYear(),0,1));return Math.ceil(((r.getTime()-a.getTime())/864e5+1)/7)}const Zl=[["timeframe"],["timeframe","bars_back"],["timeframe","session","bars_back"],["timeframe","session","bars_back","timeframe_bars_back"],["timeframe","session","timezone","bars_back","timeframe_bars_back"]],Jl={timeframe:"string",session:"string",timezone:"string",bars_back:"number",timeframe_bars_back:"number"};class Zi{constructor(e,i="openTime"){jt(this,"context"),jt(this,"dataField"),this.context=e,this.dataField=i}get __value(){return this.context.data[this.dataField]}param(e,i=0){return x.from(e).get(i)}any(...e){const i=e.map(c=>c instanceof x?c.get(0):c),r=te(i,Zl,Jl),s=r.bars_back??0,a=r.timeframe_bars_back??0,n=s+a,o=this.context.data[this.dataField],l=x.from(o).get(n);if(r.session!==void 0){const c=r.timezone||this.context.pine?.syminfo?.timezone||"UTC";return this._isInSession(l,r.session,c)?l:NaN}return l}_isInSession(e,i,r){const s=i.match(/^(\d{2})(\d{2})-(\d{2})(\d{2})$/);if(!s)return!0;const a=parseInt(s[1],10),n=parseInt(s[2],10),o=parseInt(s[3],10),l=parseInt(s[4],10),c=Bt(e,r),h=c.hour,p=c.minute,u=h*60+p,f=a*60+n,m=o*60+l;return f<=m?u>=f&&u<m:u>=f||u<m}}const ec=[[],["time"],["time","timezone"]],tc={time:"number",timezone:"string"};class Xe{constructor(e,i){jt(this,"context"),jt(this,"extractor"),this.context=e,this.extractor=i}get __value(){const e=x.from(this.context.data.openTime).get(0);if(isNaN(e))return NaN;const i=this.context.pine?.syminfo?.timezone||"UTC",r=Bt(e,i);return this.extractor(r)}param(e,i=0){return x.from(e).get(i)}any(...e){const i=e.map(o=>o instanceof x?o.get(0):o);if(i.length===0)return this.__value;const r=te(i,ec,tc),s=r.time;if(s===void 0||isNaN(s))return NaN;const a=r.timezone||this.context.pine?.syminfo?.timezone||"UTC",n=Bt(s,a);return this.extractor(n)}}const Ze={dayofmonth:t=>t.day,dayofweek:t=>t.dayOfWeek===0?1:t.dayOfWeek+1,hour:t=>t.hour,minute:t=>t.minute,month:t=>t.month,second:t=>t.second,weekofyear:t=>Xl(t.year,t.month,t.day),year:t=>t.year},ic=[["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"]],rc={defval:"primitive",title:"string",tooltip:"string",inline:"string",group:"string",display:"string",confirm:"boolean",options:"array",minval:"number",maxval:"number",step:"number"};function xe(t){return te(t,ic,rc)}function ke(t,e){return e.title&&t.inputs&&t.inputs[e.title]!==void 0?t.inputs[e.title]:e.defval}function sc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function nc(t){return(...e)=>xe(e).defval}function ac(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function oc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function lc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function cc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function hc(t){return(e,i=0)=>x.from(e).get(i)}function uc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function pc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function fc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function dc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function mc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function gc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function xc(t){return(...e)=>{const i=xe(e);return ke(t,i)}}function yc(t){return(...e)=>xe(e).defval}var _c=Object.defineProperty,bc=(t,e,i)=>e in t?_c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ce=(t,e,i)=>bc(t,typeof e!="symbol"?e+"":e,i);const vc={any:sc,bool:nc,color:ac,enum:oc,float:lc,int:cc,param:hc,price:uc,session:pc,source:fc,string:dc,symbol:mc,text_area:gc,time:xc,timeframe:yc};class wc{constructor(e){this.context=e,ce(this,"any"),ce(this,"bool"),ce(this,"color"),ce(this,"enum"),ce(this,"float"),ce(this,"int"),ce(this,"param"),ce(this,"price"),ce(this,"session"),ce(this,"source"),ce(this,"string"),ce(this,"symbol"),ce(this,"text_area"),ce(this,"time"),ce(this,"timeframe"),Object.entries(vc).forEach(([i,r])=>{this[i]=r(e)})}}function Sc(t){return e=>Math.abs(x.from(e).get(0))}function Ec(t){return e=>Math.acos(x.from(e).get(0))}function Nc(t){return e=>Math.asin(x.from(e).get(0))}function Cc(t){return e=>Math.atan(x.from(e).get(0))}function Ic(t){return(...e)=>{const i=e.map(r=>x.from(r).get(0));return i.reduce((r,s)=>r+s,0)/i.length}}function kc(t){return e=>Math.ceil(x.from(e).get(0))}function Ac(t){return e=>Math.cos(x.from(e).get(0))}function Tc(t){return()=>Math.E}function Pc(t){return e=>Math.exp(x.from(e).get(0))}function Dc(t){return e=>Math.floor(x.from(e).get(0))}function Rc(t){return e=>Math.log(x.from(e).get(0))}function Oc(t){return e=>Math.log(x.from(e).get(0))}function Mc(t){return e=>Math.log10(x.from(e).get(0))}function Vc(t){return(...e)=>{const i=e.map(r=>x.from(r).get(0));return Math.max(...i)}}function Lc(t){return(...e)=>{const i=e.map(r=>x.from(r).get(0));return Math.min(...i)}}function jc(t){return(e,i,r)=>typeof e=="string"?e:e instanceof x?i?new x(e.data,e.offset+i):e:!Array.isArray(e)&&typeof e=="object"?e:(t.params[r]||(t.params[r]=[]),Array.isArray(e)?new x(e,i||0):(t.params[r].length===0?t.params[r].push(e):t.params[r][t.params[r].length-1]=e,new x(t.params[r],i||0)))}function Bc(t){return()=>1.618033988749895}function Fc(t){return()=>Math.PI}function $c(t){return(e,i)=>Math.pow(x.from(e).get(0),x.from(i).get(0))}function Wc(t){return()=>Math.random()}function ti(t){return t!==t?NaN:Math.sign(t)*Math.round(Math.abs(t))}function Uc(t){return(e,i)=>{const r=x.from(e).get(0);if(i==null)return ti(r);const s=x.from(i).get(0);if(s===0)return ti(r);const a=Math.pow(10,s);return ti(r*a)/a}}function qc(t){return e=>t.precision(Math.round(x.from(e).get(0)/t.pine.syminfo.mintick)*t.pine.syminfo.mintick)}function Kc(t){return()=>.6180339887498948}function zc(t){return e=>Math.sign(x.from(e).get(0))}function Hc(t){return e=>Math.sin(x.from(e).get(0))}function Gc(t){return e=>Math.sqrt(x.from(e).get(0))}function Yc(t){return(e,i)=>{const r=x.from(i).get(0),s=x.from(e);let a=0;for(let n=0;n<r;n++){const o=s.get(n);a+=o}return a}}function Qc(t){return e=>Math.tan(x.from(e).get(0))}function Xc(t){return e=>{const i=x.from(e).get(0);return i==null||Number.isNaN(i)?NaN:i*(180/Math.PI)}}function Zc(t){return e=>{const i=x.from(e).get(0);return i==null||Number.isNaN(i)?NaN:i*(Math.PI/180)}}function Jc(t){return(e,i)=>{const r=x.from(e).get(0),s=x.from(i).get(0);return typeof r=="number"&&typeof s=="number"?isNaN(r)||isNaN(s)?!1:Math.abs(r-s)<1e-8:r===s}}var eh=Object.defineProperty,th=(t,e,i)=>e in t?eh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,B=(t,e,i)=>th(t,typeof e!="symbol"?e+"":e,i);const ih={abs:Sc,acos:Ec,asin:Nc,atan:Cc,avg:Ic,ceil:kc,cos:Ac,e:Tc,exp:Pc,floor:Dc,ln:Rc,log:Oc,log10:Mc,max:Vc,min:Lc,param:jc,phi:Bc,pi:Fc,pow:$c,random:Wc,round:Uc,round_to_mintick:qc,rphi:Kc,sign:zc,sin:Hc,sqrt:Gc,sum:Yc,tan:Qc,todegrees:Xc,toradians:Zc,__eq:Jc};class rh{constructor(e){this.context=e,B(this,"_cache",{}),B(this,"abs"),B(this,"acos"),B(this,"asin"),B(this,"atan"),B(this,"avg"),B(this,"ceil"),B(this,"cos"),B(this,"e"),B(this,"exp"),B(this,"floor"),B(this,"ln"),B(this,"log"),B(this,"log10"),B(this,"max"),B(this,"min"),B(this,"param"),B(this,"phi"),B(this,"pi"),B(this,"pow"),B(this,"random"),B(this,"round"),B(this,"round_to_mintick"),B(this,"rphi"),B(this,"sign"),B(this,"sin"),B(this,"sqrt"),B(this,"sum"),B(this,"tan"),B(this,"todegrees"),B(this,"toradians"),B(this,"__eq"),Object.entries(ih).forEach(([i,r])=>{this[i]=r(e)})}}function sh(t){return(e,i,r)=>{t.params[r]||(t.params[r]=[]);let s;if(e instanceof x)s=e.get(i||0);else if(Array.isArray(e)){const a=e.every(o=>o instanceof x),n=e.every(o=>!(o instanceof x)&&!Array.isArray(o));(a||n)&&e.length>=1?a?s=e.map(o=>o.get(0)):s=e:s=x.from(e).get(i||0)}else s=e;return t.params[r].length===0?t.params[r].push(s):t.params[r][t.params[r].length-1]=s,[s,r]}}const Ft=["1","3","5","15","30","45","60","120","180","240","D","W","M"];function Ji(t,e,i,r,s=!1){for(let a=0;a<i.length;a++)if(i[a]<=t&&t<r[a])return s||e>=r[a]?a:a-1;return-1}function er(t,e,i,r,s=!1,a,n=!1){for(let o=i.length-1;o>=0;o--){if(r[o]<=e&&i[o]>=t){const l=a&&e>a;if(n&&s)for(let c=0;c<i.length;c++){if(i[c]>=t&&i[c]<e)return c;if(i[c]>=e)break}if(l&&s&&!n)for(let c=0;c<i.length;c++){if(i[c]>=t&&i[c]<e)return c;if(i[c]>=e)break}return o}if(r[o]<t)break}return-1}function nh(t){return async(e,i,r,s=!1,a=!1,n=!1,o=null,l=null)=>{const c=e[0],h=typeof c=="string"&&c.includes(":")?c.split(":")[1]:c,p=i[0],u=r[0],f=r[1],m=Array.isArray(s)?s[0]:s,y=Array.isArray(a)?a[0]:a;if(t.isSecondaryContext)return Array.isArray(u)?[u]:u;const _=Ft.indexOf(t.timeframe),b=Ft.indexOf(p);if(_==-1||b==-1)throw new Error("Invalid timeframe");if(_===b)return Array.isArray(u)?[u]:u;const w=_>b,v=x.from(t.data.openTime).get(0),E=x.from(t.data.closeTime).get(0),N=`${h}_${p}_${f}`,O=`${N}_prevIdx`;if(t.cache[N]){const Oe=t.cache[N],ze=w?er(v,E,Oe.data.openTime.data,Oe.data.closeTime.data,y,t.eDate,m):Ji(v,E,Oe.data.openTime.data,Oe.data.closeTime.data,y);if(ze==-1)return NaN;const ye=Oe.params[f][ze];if(!w&&m){const ft=t.cache[O];return ft!==void 0&&ft===ze?NaN:(t.cache[O]=ze,Array.isArray(ye)?[ye]:ye)}return Array.isArray(ye)?[ye]:ye}const D=1e3*60*60*24*30,V=t.sDate?t.sDate-D:void 0,q=t.sDate&&t.eDate?void 0:t.limit||1e3,G=new ws(t.source,h,p,q,V,void 0);G.markAsSecondary();const K=await G.run(t.pineTSCode);t.cache[N]=K;const pe=w?er(v,E,K.data.openTime.data,K.data.closeTime.data,y,t.eDate,m):Ji(v,E,K.data.openTime.data,K.data.closeTime.data,y);if(pe==-1)return NaN;const Fe=K.params[f][pe];return!w&&m?(t.cache[O]=pe,NaN):Array.isArray(Fe)?[Fe]:Fe}}function ah(t){return async(e,i,r,s=!1,a=null,n=!1,o=0)=>{const l=e[0],c=i[0],h=r[0],p=r[1];Array.isArray(s)&&s[0];const u=Array.isArray(n)?n[0]:n;if(t.isSecondaryContext)return Array.isArray(h)?[h]:h;const f=Ft.indexOf(t.timeframe),m=Ft.indexOf(c);if(f===-1||m===-1){if(u)return NaN;throw new Error("Invalid timeframe")}if(m>f){if(u)return NaN;throw new Error(`Timeframe ${c} is not lower than or equal to chart timeframe ${t.timeframe}`)}if(m===f)return[[h]];const y=`${l}_${c}_${p}_lower`;if(!t.cache[y]){const D=t.sDate?t.sDate-2592e6:void 0,V=t.sDate&&t.eDate?void 0:t.limit||1e3,q=new ws(t.source,l,c,V,D,t.eDate);q.markAsSecondary();const G=await q.run(t.pineTSCode);t.cache[y]=G}const _=t.cache[y],b=x.from(t.data.openTime).get(0),w=x.from(t.data.closeTime).get(0),v=_.data.openTime.data,E=_.data.closeTime.data,N=_.params[p];if(!N)return[];const O=[];for(let D=0;D<v.length;D++){const V=v[D];if(!(E[D]<=b)){if(V>=w)break;V>=b&&V<w&&O.push(N[D])}}return[O]}}var oh=Object.defineProperty,lh=(t,e,i)=>e in t?oh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Tt=(t,e,i)=>lh(t,typeof e!="symbol"?e+"":e,i);const ch={param:sh,security:nh,security_lower_tf:ah};class hh{constructor(e){this.context=e,Tt(this,"_cache",{}),Tt(this,"param"),Tt(this,"security"),Tt(this,"security_lower_tf"),Object.entries(ch).forEach(([i,r])=>{this[i]=r(e)})}}function uh(t){return e=>{t.taState||(t.taState={});const i=e||"accdist";t.taState[i]||(t.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=t.taState[i];t.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=t.idx);const s=t.get(t.data.close,0),a=t.get(t.data.high,0),n=t.get(t.data.low,0),o=t.get(t.data.volume,0);if(isNaN(s)||isNaN(a)||isNaN(n)||isNaN(o))return r.currentCumulativeSum=r.prevCumulativeSum,t.precision(r.prevCumulativeSum);const l=a-n;let c=0;l!==0&&(c=(s-n-(a-s))/l*o);const h=r.prevCumulativeSum+c;return r.currentCumulativeSum=h,t.precision(h)}}function ph(t){return(e,i,r,s,a)=>{const n=x.from(i).get(0),o=x.from(r).get(0),l=x.from(s).get(0);t.taState||(t.taState={});const c=a||`alma_${n}_${o}_${l}`;if(!t.taState[c]){const y=o*(n-1),_=n/l,b=[];let w=0;for(let v=0;v<n;v++){const E=Math.exp(-Math.pow(v-y,2)/(2*_*_));b.push(E),w+=E}for(let v=0;v<b.length;v++)b[v]/=w;t.taState[c]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0,weights:b}}const h=t.taState[c];t.idx>h.lastIdx&&(h.lastIdx>=0&&(h.prevWindow=[...h.currentWindow],h.prevCallCount=h.currentCallCount),h.lastIdx=t.idx);const p=x.from(e).get(0),u=[...h.prevWindow];for(u.unshift(p);u.length>n;)u.pop();const f=h.prevCallCount+1;if(u.length<n&&(f>=n||t.idx>=n-1)){const y=x.from(e);for(;u.length<n;)u.push(y.get(u.length))}if(h.currentWindow=u,h.currentCallCount=f,u.length<n)return NaN;let m=0;for(let y=0;y<n;y++)m+=h.weights[y]*u[n-1-y];return t.precision(m)}}function fh(t){return(e,i)=>{const r=x.from(e).get(0);t.taState||(t.taState={});const s=i||`atr_${r}`;t.taState[s]||(t.taState[s]={lastIdx:-1,prevAtr:null,prevInitSum:0,prevInitCount:0,currentAtr:null,currentInitSum:0,currentInitCount:0});const a=t.taState[s];t.idx>a.lastIdx&&(a.lastIdx>=0&&(a.prevAtr=a.currentAtr,a.prevInitSum=a.currentInitSum,a.prevInitCount=a.currentInitCount),a.lastIdx=t.idx);const n=t.get(t.data.high,0),o=t.get(t.data.low,0),l=t.get(t.data.close,0);if(isNaN(n)||isNaN(o)||isNaN(l))return NaN;const c=t.idx>0?t.get(t.data.close,1):null;let h;if(c!==null&&!isNaN(c)){const y=n-o,_=Math.abs(n-c),b=Math.abs(o-c);h=Math.max(y,_,b)}else h=n-o;let p=a.prevInitCount,u=a.prevInitSum,f=a.prevAtr;if(p<r){if(u+=h,p++,a.currentInitSum=u,a.currentInitCount=p,p===r){const y=u/r;return a.currentAtr=y,t.precision(y)}return NaN}const m=(f*(r-1)+h)/r;return a.currentAtr=m,t.precision(m)}}function dh(t){return(e,i)=>{t.taState||(t.taState={});const r=i||"barssince";t.taState[r]||(t.taState[r]={lastIdx:-1,prevLastTrueIndex:null,currentLastTrueIndex:null});const s=t.taState[r];t.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevLastTrueIndex=s.currentLastTrueIndex),s.lastIdx=t.idx);const a=x.from(e).get(0);let n=s.prevLastTrueIndex;return a&&(n=t.idx),s.currentLastTrueIndex=n,n===null?NaN:t.idx-n}}function mh(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0);t.taState||(t.taState={});const o=s||`bb_${a}_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevWindow=[...l.currentWindow],l.prevSum=l.currentSum),l.lastIdx=t.idx);const c=x.from(e).get(0);if(isNaN(c))return l.currentWindow=[...l.prevWindow],l.currentSum=l.prevSum,[[NaN,NaN,NaN]];const h=[...l.prevWindow];let p=l.prevSum;for(h.unshift(c),p+=c;h.length>a;){const b=h.pop();p-=b}if(h.length<a&&t.idx>=a-1){const b=x.from(e);for(;h.length<a;){const w=b.get(h.length);if(isNaN(w))break;h.push(w),p+=w}}if(l.currentWindow=h,l.currentSum=p,h.length<a)return[[NaN,NaN,NaN]];const u=p/a;let f=0;for(let b=0;b<a;b++)f+=Math.pow(h[b]-u,2);const m=Math.sqrt(f/a),y=u+n*m,_=u-n*m;return[[t.precision(u),t.precision(y),t.precision(_)]]}}function gh(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0);t.taState||(t.taState={});const o=s||`bbw_${a}_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,currentWindow:[],currentSum:0});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevWindow=[...l.currentWindow],l.prevSum=l.currentSum),l.lastIdx=t.idx);const c=x.from(e).get(0);if(isNaN(c))return l.currentWindow=[...l.prevWindow],l.currentSum=l.prevSum,NaN;const h=[...l.prevWindow];let p=l.prevSum;for(h.unshift(c),p+=c;h.length>a;){const w=h.pop();p-=w}if(h.length<a&&t.idx>=a-1){const w=x.from(e);for(;h.length<a;){const v=w.get(h.length);if(isNaN(v))break;h.push(v),p+=v}}if(l.currentWindow=h,l.currentSum=p,h.length<a)return NaN;const u=p/a;let f=0;for(let w=0;w<a;w++){const v=h[w]-u;f+=v*v}const m=f/a,y=Math.sqrt(m),_=n*y;if(u===0)return t.precision(0);const b=2*_/u*100;return t.precision(b)}}function xh(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`cci_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,prevCallCount:0,currentWindow:[],currentSum:0,currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevSum=n.currentSum,n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0);if(isNaN(o))return NaN;const l=[...n.prevWindow];let c=n.prevSum;for(l.unshift(o),c+=o;l.length>s;){const y=l.pop();c-=y}const h=n.prevCallCount+1;if(l.length<s&&(h>=s||t.idx>=s-1)){const y=x.from(e);for(;l.length<s;){const _=y.get(l.length);if(isNaN(_))break;l.push(_),c+=_}}if(n.currentWindow=l,n.currentSum=c,n.currentCallCount=h,l.length<s)return NaN;const p=c/s;let u=0;for(let y=0;y<s;y++)u+=Math.abs(l[y]-p);const f=u/s;if(f===0)return 0;const m=(o-p)/(.015*f);return t.precision(m)}}function yh(t){return(e,i=1,r)=>{typeof i=="string"&&(r=i,i=1);const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`change_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s+1;)l.pop();const c=n.prevCallCount+1;if(l.length<s+1&&(c>=s+1||t.idx>=s)){const p=x.from(e);for(;l.length<s+1;)l.push(p.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<=s)return NaN;const h=o-l[s];return t.precision(h)}}function _h(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`cmo_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevGainsWindow:[],prevLossesWindow:[],prevGainsSum:0,prevLossesSum:0,currentGainsWindow:[],currentLossesWindow:[],currentGainsSum:0,currentLossesSum:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevGainsWindow=[...n.currentGainsWindow],n.prevLossesWindow=[...n.currentLossesWindow],n.prevGainsSum=n.currentGainsSum,n.prevLossesSum=n.currentLossesSum),n.lastIdx=t.idx);const o=x.from(e).get(0),l=x.from(e).get(1);if(isNaN(o)||isNaN(l))return NaN;const c=o-l,h=c>=0?c:0,p=c>=0?0:-c,u=[...n.prevGainsWindow],f=[...n.prevLossesWindow];let m=n.prevGainsSum,y=n.prevLossesSum;if(u.unshift(h),f.unshift(p),m+=h,y+=p,u.length<s)return n.currentGainsWindow=u,n.currentLossesWindow=f,n.currentGainsSum=m,n.currentLossesSum=y,NaN;if(u.length>s){const w=u.pop(),v=f.pop();m-=w,y-=v}n.currentGainsWindow=u,n.currentLossesWindow=f,n.currentGainsSum=m,n.currentLossesSum=y;const _=m+y;if(_===0)return t.precision(0);const b=100*(m-y)/_;return t.precision(b)}}function bh(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);let n=0,o=!1;for(let h=0;h<s;h++){const p=a.get(h);if(isNaN(p)){o=!0;break}n+=p}if(o)return NaN;let l=0;for(let h=0;h<s;h++){const p=a.get(h);l+=p*(h+1)}if(n===0)return NaN;const c=-l/n;return t.precision(c)}}function vh(t){return(e,i,r,s)=>{const a=x.from(r).get(0),n=x.from(e),o=x.from(i);if(t.idx<a-1)return NaN;let l=0,c=0,h=0,p=0,u=0,f=0;for(let w=0;w<a;w++){const v=n.get(w),E=o.get(w);isNaN(v)||isNaN(E)||(l+=v,c+=E,h+=v*E,p+=v*v,u+=E*E,f++)}if(f<2)return NaN;const m=f*h-l*c,y=f*p-l*l,_=f*u-c*c;if(y<=0||_<=0)return t.precision(0);const b=m/Math.sqrt(y*_);return t.precision(b)}}function wh(t){return(e,i,r)=>{const s=x.from(e),a=x.from(i),n=s.get(0),o=a.get(0),l=s.get(1),c=a.get(1);if(isNaN(n)||isNaN(o)||isNaN(l)||isNaN(c))return!1;const h=n>o&&l<=c,p=n<o&&l>=c;return h||p}}function Sh(t){return(e,i)=>{const r=x.from(e),s=x.from(i),a=r.get(0),n=s.get(0),o=r.get(1),l=s.get(1);return o<l&&a>n}}function Eh(t){return(e,i)=>{const r=x.from(e),s=x.from(i),a=r.get(0),n=s.get(0),o=r.get(1),l=s.get(1);return o>l&&a<n}}function Nh(t){return(e,i)=>{t.taState||(t.taState={});const r=i||"cum";t.taState[r]||(t.taState[r]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const s=t.taState[r];t.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevCumulativeSum=s.currentCumulativeSum),s.lastIdx=t.idx);const a=x.from(e).get(0);if(isNaN(a))return s.currentCumulativeSum=s.prevCumulativeSum,t.precision(s.prevCumulativeSum);const n=s.prevCumulativeSum+a;return s.currentCumulativeSum=n,t.precision(n)}}function Ch(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`dev_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,prevCallCount:0,currentWindow:[],currentSum:0,currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevSum=n.currentSum,n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0)||0,l=[...n.prevWindow];let c=n.prevSum;for(l.unshift(o),c+=o;l.length>s;){const m=l.pop();c-=m}const h=n.prevCallCount+1;if(l.length<s&&(h>=s||t.idx>=s-1)){const m=x.from(e);for(;l.length<s;){const y=m.get(l.length);l.push(y),c+=y}}if(n.currentWindow=l,n.currentSum=c,n.currentCallCount=h,l.length<s)return NaN;const p=c/s;let u=0;for(let m=0;m<s;m++)u+=Math.abs(l[m]-p);const f=u/s;return t.precision(f)}}function Ih(t){return(e,i,r)=>{const s=x.from(e).get(0),a=x.from(i).get(0);t.taState||(t.taState={});const n=r||`dmi_${s}_${a}`;t.taState[n]||(t.taState[n]={lastIdx:-1,prevTrInitSum:0,prevPlusInitSum:0,prevMinusInitSum:0,prevInitCount:0,prevSmoothedTR:NaN,prevSmoothedPlus:NaN,prevSmoothedMinus:NaN,prevDxInitSum:0,prevAdxInitCount:0,prevADX:NaN,currentTrInitSum:0,currentPlusInitSum:0,currentMinusInitSum:0,currentInitCount:0,currentSmoothedTR:NaN,currentSmoothedPlus:NaN,currentSmoothedMinus:NaN,currentDxInitSum:0,currentAdxInitCount:0,currentADX:NaN});const o=t.taState[n];t.idx>o.lastIdx&&(o.lastIdx>=0&&(o.prevTrInitSum=o.currentTrInitSum,o.prevPlusInitSum=o.currentPlusInitSum,o.prevMinusInitSum=o.currentMinusInitSum,o.prevInitCount=o.currentInitCount,o.prevSmoothedTR=o.currentSmoothedTR,o.prevSmoothedPlus=o.currentSmoothedPlus,o.prevSmoothedMinus=o.currentSmoothedMinus,o.prevDxInitSum=o.currentDxInitSum,o.prevAdxInitCount=o.currentAdxInitCount,o.prevADX=o.currentADX),o.lastIdx=t.idx);const l=t.get(t.data.high,0),c=t.get(t.data.low,0),h=t.get(t.data.close,0);if(isNaN(l)||isNaN(c)||isNaN(h))return[[NaN,NaN,NaN]];const p=t.idx>0?t.get(t.data.high,1):NaN,u=t.idx>0?t.get(t.data.low,1):NaN,f=t.idx>0?t.get(t.data.close,1):NaN;if(isNaN(p))return[[NaN,NaN,NaN]];const m=Math.max(l-c,Math.abs(l-f),Math.abs(c-f)),y=l-p,_=u-c,b=y>_&&y>0?y:0,w=_>y&&_>0?_:0;let v=o.prevInitCount,E=o.prevTrInitSum,N=o.prevPlusInitSum,O=o.prevMinusInitSum,D=o.prevSmoothedTR,V=o.prevSmoothedPlus,q=o.prevSmoothedMinus;if(v++,v<=s)E+=m,N+=b,O+=w,v===s&&(D=E/s,V=N/s,q=O/s);else{const $e=1/s;D=$e*m+(1-$e)*D,V=$e*b+(1-$e)*V,q=$e*w+(1-$e)*q}if(o.currentInitCount=v,o.currentTrInitSum=E,o.currentPlusInitSum=N,o.currentMinusInitSum=O,o.currentSmoothedTR=D,o.currentSmoothedPlus=V,o.currentSmoothedMinus=q,v<s)return[[NaN,NaN,NaN]];const G=D===0?0:100*V/D,K=D===0?0:100*q/D,pe=G+K,Fe=pe===0?0:100*Math.abs(G-K)/pe;let Oe=o.prevAdxInitCount,ze=o.prevDxInitSum,ye=o.prevADX,ft=NaN;if(Oe++,Oe<=a)ze+=Fe,Oe===a&&(ye=ze/a,ft=ye);else{const $e=1/a;ye=$e*Fe+(1-$e)*ye,ft=ye}return o.currentAdxInitCount=Oe,o.currentDxInitSum=ze,o.currentADX=ye,[[t.precision(G),t.precision(K),t.precision(ft)]]}}function kh(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`ema_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevEma:null,prevInitSum:0,prevInitCount:0,currentEma:null,currentInitSum:0,currentInitCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevEma=n.currentEma,n.prevInitSum=n.currentInitSum,n.prevInitCount=n.currentInitCount),n.lastIdx=t.idx);const o=x.from(e).get(0);if(o==null||isNaN(o))return NaN;let l=n.prevInitCount,c=n.prevInitSum,h=n.prevEma;if(l<s){if(c+=o,l++,n.currentInitSum=c,n.currentInitCount=l,l===s){const f=c/s;return n.currentEma=f,t.precision(f)}return NaN}const p=2/(s+1),u=o*p+h*(1-p);return n.currentEma=u,t.precision(u)}}function Ah(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);for(let n=0;n<s;n++){const o=a.get(n),l=a.get(n+1);if(isNaN(o)||isNaN(l)||o>=l)return!1}return!0}}function Th(t){return(e,i,r)=>{typeof i=="string"&&r===void 0&&(r=i,i=e,e=t.data.high);const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`highest_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;if(l.length<s&&(c>=s||t.idx>=s-1)){const u=x.from(e);for(;l.length<s;)l.push(u.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<s)return NaN;const h=l.filter(u=>!isNaN(u)&&u!==void 0);if(h.length===0)return NaN;const p=Math.max(...h);return t.precision(p)}}function Ph(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);if(t.idx<s-1)return NaN;let n=-1/0,o=NaN;for(let l=0;l<s;l++){const c=a.get(l);isNaN(c)||(isNaN(o)||c>n)&&(n=c,o=-l)}return o}}function Dh(t){return(e,i,r)=>{const s=x.from(i).get(0),a=Math.floor(s/2),n=Math.floor(Math.sqrt(s)),o=t.pine.ta.wma,l=o(e,a,r?`${r}_wma1`:void 0),c=o(e,s,r?`${r}_wma2`:void 0);if(isNaN(l)||isNaN(c))return NaN;t.taState||(t.taState={});const h=r||`hma_raw_${s}`;t.taState[h]||(t.taState[h]={lastIdx:-1,prevValues:[],currentValues:[]});const p=t.taState[h];t.idx>p.lastIdx&&(p.lastIdx>=0&&(p.prevValues=[...p.currentValues]),p.lastIdx=t.idx);const u=2*l-c,f=[...p.prevValues];f.unshift(u),f.length>n+1&&f.pop(),p.currentValues=f;const m=r?`${r}_hma_final`:`hma_final_${s}`;t.taState[m]||(t.taState[m]={lastIdx:-1,prevWindow:[],currentWindow:[]});const y=t.taState[m];t.idx>y.lastIdx&&(y.lastIdx>=0&&(y.prevWindow=[...y.currentWindow]),y.lastIdx=t.idx);const _=[...y.prevWindow];if(_.unshift(u),_.length<n)return y.currentWindow=_,NaN;for(;_.length>n;)_.pop();y.currentWindow=_;let b=0,w=0;for(let E=0;E<n;E++){const N=n-E;b+=_[E]*N,w+=N}const v=b/w;return t.precision(v)}}function Rh(t){return e=>{const i=t.get(t.data.close,0),r=t.get(t.data.high,0),s=t.get(t.data.low,0),a=t.get(t.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(a))return NaN;const n=(r-s)*a;if(n===0)return t.precision(0);const o=(2*i-r-s)/n;return t.precision(o)}}function Oh(t){return(e,i,r,s,a)=>{const n=x.from(i).get(0),o=x.from(r).get(0);let l=!0;typeof s=="string"?a=s:s!==void 0&&(l=x.from(s).get(0));let c;const h=t.get(t.data.high,0),p=t.get(t.data.low,0);if(l){const E=t.get(t.data.close,1);isNaN(E)?c=NaN:c=Math.max(h-p,Math.abs(h-E),Math.abs(p-E))}else c=h-p;const u=x.from(e).get(0);t.taState||(t.taState={});const f=a||`kc_${n}_${o}_${l}`;t.taState[f]||(t.taState[f]={lastIdx:-1,basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0},currentBasisState:{prevEma:null,initSum:0,initCount:0},currentRangeState:{prevEma:null,initSum:0,initCount:0}});const m=t.taState[f];t.idx>m.lastIdx&&(m.lastIdx>=0&&(m.basisState={...m.currentBasisState},m.rangeState={...m.currentRangeState}),m.lastIdx=t.idx);const y=(E,N,O,D)=>{if(isNaN(O))return Object.assign(N,E),N.prevEma!==null?N.prevEma:NaN;let V=E.initCount,q=E.initSum,G=E.prevEma;if(V<D){if(q+=O,V++,N.initSum=q,N.initCount=V,N.prevEma=G,V===D){const Fe=q/D;return N.prevEma=Fe,Fe}return NaN}const K=2/(D+1),pe=O*K+G*(1-K);return N.prevEma=pe,N.initSum=q,N.initCount=V,pe},_=y(m.basisState,m.currentBasisState,u,n),b=y(m.rangeState,m.currentRangeState,c,n);if(isNaN(_)||isNaN(b))return[[NaN,NaN,NaN]];const w=_+b*o,v=_-b*o;return[[t.precision(_),t.precision(w),t.precision(v)]]}}function Mh(t){return(e,i,r,s,a)=>{const n=x.from(i).get(0),o=x.from(r).get(0);let l=!0;typeof s=="string"?a=s:s!==void 0&&(l=x.from(s).get(0)),t.taState||(t.taState={});const c=a||`kcw_${n}_${o}_${l}`;t.taState[c]||(t.taState[c]={lastIdx:-1,basisState:{prevEma:null,initSum:0,initCount:0},rangeState:{prevEma:null,initSum:0,initCount:0},currentBasisState:{prevEma:null,initSum:0,initCount:0},currentRangeState:{prevEma:null,initSum:0,initCount:0}});const h=t.taState[c];t.idx>h.lastIdx&&(h.lastIdx>=0&&(h.basisState={...h.currentBasisState},h.rangeState={...h.currentRangeState}),h.lastIdx=t.idx);const p=(v,E,N,O)=>{if(isNaN(N))return Object.assign(E,v),E.prevEma!==null?E.prevEma:NaN;let D=v.initCount,V=v.initSum,q=v.prevEma;if(D<O){if(V+=N,D++,E.initSum=V,E.initCount=D,E.prevEma=q,D===O){const pe=V/O;return E.prevEma=pe,pe}return NaN}const G=2/(O+1),K=N*G+q*(1-G);return E.prevEma=K,E.initSum=V,E.initCount=D,K};let u;const f=t.get(t.data.high,0),m=t.get(t.data.low,0);if(l){const v=t.get(t.data.close,1);isNaN(v)?u=NaN:u=Math.max(f-m,Math.abs(f-v),Math.abs(m-v))}else u=f-m;const y=x.from(e).get(0),_=p(h.basisState,h.currentBasisState,y,n),b=p(h.rangeState,h.currentRangeState,u,n);if(isNaN(_)||isNaN(b))return NaN;if(_===0)return t.precision(0);const w=2*b*o/_;return t.precision(w)}}function Vh(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0);t.taState||(t.taState={});const o=s||`linreg_${a}_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevWindow=[...l.currentWindow],l.prevCallCount=l.currentCallCount),l.lastIdx=t.idx);const c=x.from(e).get(0),h=[...l.prevWindow];for(h.unshift(c);h.length>a;)h.pop();const p=l.prevCallCount+1;if(h.length<a&&(p>=a||t.idx>=a-1)){const E=x.from(e);for(;h.length<a;)h.push(E.get(h.length))}if(l.currentWindow=h,l.currentCallCount=p,h.length<a)return NaN;let u=0,f=0,m=0,y=0;const _=a;for(let E=0;E<a;E++){const N=a-1-E,O=h[E];u+=N,f+=O,m+=N*O,y+=N*N}const b=_*y-u*u;if(b===0)return NaN;const w=(_*m-u*f)/b,v=(f-w*u)/_+w*(a-1-n);return t.precision(v)}}function Lh(t){return(e,i,r)=>{typeof i=="string"&&r===void 0&&(r=i,i=e,e=t.data.low);const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`lowest_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;if(l.length<s&&(c>=s||t.idx>=s-1)){const u=x.from(e);for(;l.length<s;)l.push(u.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<s)return NaN;const h=l.filter(u=>!isNaN(u)&&u!==void 0);if(h.length===0)return NaN;const p=Math.min(...h);return t.precision(p)}}function jh(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);if(t.idx<s-1)return NaN;let n=1/0,o=NaN;for(let l=0;l<s;l++){const c=a.get(l);isNaN(c)||(isNaN(o)||c<n)&&(n=c,o=-l)}return o}}function Bh(t){return(e,i,r,s,a)=>{const n=x.from(i).get(0),o=x.from(r).get(0),l=x.from(s).get(0),c=a||`macd_${n}_${o}_${l}`,h=`${c}_fast`,p=`${c}_slow`,u=`${c}_signal`,f=t.pine.ta.ema(e,n,h),m=t.pine.ta.ema(e,o,p);let y=NaN;!isNaN(f)&&!isNaN(m)&&(y=f-m);let _=NaN;isNaN(y)||(_=t.pine.ta.ema(y,l,u));let b=NaN;return!isNaN(y)&&!isNaN(_)&&(b=y-_),[[t.precision(y),t.precision(_),t.precision(b)]]}}function Fh(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`median_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;if(l.length<s&&(c>=s||t.idx>=s-1)){const f=x.from(e);for(;l.length<s;)l.push(f.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<s)return NaN;const h=l.slice().sort((f,m)=>f-m),p=Math.floor(s/2),u=s%2===0?(h[p-1]+h[p])/2:h[p];return t.precision(u)}}function $h(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`mfi_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevUpperWindow:[],prevLowerWindow:[],prevUpperSum:0,prevLowerSum:0,currentUpperWindow:[],currentLowerWindow:[],currentUpperSum:0,currentLowerSum:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevUpperWindow=[...n.currentUpperWindow],n.prevLowerWindow=[...n.currentLowerWindow],n.prevUpperSum=n.currentUpperSum,n.prevLowerSum=n.currentLowerSum),n.lastIdx=t.idx);const o=x.from(e).get(0),l=x.from(e).get(1),c=t.get(t.data.volume,0);if(isNaN(o)||isNaN(c))return NaN;const h=isNaN(l)?NaN:o-l,p=c*(h<=0?0:o),u=c*(h>=0?0:o),f=[...n.prevUpperWindow],m=[...n.prevLowerWindow];let y=n.prevUpperSum,_=n.prevLowerSum;if(f.unshift(p),m.unshift(u),y+=p,_+=u,f.length<s)return n.currentUpperWindow=f,n.currentLowerWindow=m,n.currentUpperSum=y,n.currentLowerSum=_,NaN;if(f.length>s){const w=f.pop(),v=m.pop();y-=w,_-=v}if(n.currentUpperWindow=f,n.currentLowerWindow=m,n.currentUpperSum=y,n.currentLowerSum=_,_===0)return t.precision(100);if(y===0)return t.precision(0);const b=100-100/(1+y/_);return t.precision(b)}}function Wh(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);if(t.idx<s-1)return NaN;const n=new Map;for(let c=0;c<s;c++){const h=a.get(c);isNaN(h)||n.set(h,(n.get(h)||0)+1)}if(n.size===0)return NaN;let o=NaN,l=-1;for(const[c,h]of n.entries())h>l?(l=h,o=c):h===l&&c<o&&(o=c);return o}}function Uh(t){return(e,i,r)=>{const s=x.from(i).get(0);return t.pine.ta.change(e,s,r)}}function qh(t){return e=>{t.taState||(t.taState={});const i=e||"nvi";t.taState[i]||(t.taState[i]={lastIdx:-1,committedNVI:1,tentativeNVI:1});const r=t.taState[i];t.idx>r.lastIdx&&(r.lastIdx>=0&&(r.committedNVI=r.tentativeNVI),r.lastIdx=t.idx);const s=t.get(t.data.close,0),a=t.get(t.data.close,1),n=t.get(t.data.volume,0),o=t.get(t.data.volume,1),l=isNaN(s)?0:s,c=isNaN(a)?0:a,h=isNaN(n)?0:n,p=isNaN(o)?0:o;let u=r.committedNVI;if(!(l===0||c===0)&&h<p){const f=(l-c)/c;u=u+f*u}return r.tentativeNVI=u,t.precision(u)}}function Kh(t){return()=>{t.taState||(t.taState={});const e="obv";t.taState[e]||(t.taState[e]={lastIdx:-1,committedOBV:0,tentativeOBV:0});const i=t.taState[e];t.idx>i.lastIdx&&(i.lastIdx>=0&&(i.committedOBV=i.tentativeOBV),i.lastIdx=t.idx);const r=t.get(t.data.close,0),s=t.get(t.data.volume,0),a=t.get(t.data.close,1);if(isNaN(a))return i.tentativeOBV=0,t.precision(0);let n=i.committedOBV;return r>a?n+=s:r<a&&(n-=s),i.tentativeOBV=n,t.precision(n)}}function zh(t){return(e,i,r)=>e instanceof x?i?new x(e.data,e.offset+i):e:(t.params[r]||(t.params[r]=[]),Array.isArray(e)?new x(e,i||0):(t.params[r].length===0?t.params[r].push(e):t.params[r][t.params[r].length-1]=e,new x(t.params[r],i||0)))}function Hh(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0),o=x.from(e);if(t.idx<a-1)return NaN;const l=[];for(let m=0;m<a;m++){const y=o.get(m);if(isNaN(y))return NaN;l.push(y)}l.sort((m,y)=>m-y);let c=n/100*a-.5;c<0&&(c=0),c>a-1&&(c=a-1);const h=Math.floor(c),p=Math.ceil(c);if(h===p)return t.precision(l[h]);const u=c-h,f=l[h]+u*(l[p]-l[h]);return t.precision(f)}}function Gh(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0),o=x.from(e);if(t.idx<a-1)return NaN;const l=[];for(let h=0;h<a;h++){const p=o.get(h);isNaN(p)||l.push(p)}if(l.length===0)return NaN;l.sort((h,p)=>h-p);let c=Math.ceil(n/100*l.length)-1;return c<0&&(c=0),c>=l.length&&(c=l.length-1),t.precision(l[c])}}function Yh(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);if(t.idx<s)return NaN;const n=a.get(0);if(isNaN(n))return NaN;let o=0,l=0;for(let c=1;c<=s;c++){const h=a.get(c);isNaN(h)||(l++,h<=n&&o++)}return l===0?NaN:t.precision(o/l*100)}}function Qh(t,e,i){const r=new Array(t.length).fill(NaN);for(let s=e+i;s<t.length;s++){const a=t[s-i];let n=!0;for(let o=1;o<=e;o++)if(t[s-i-o]>=a){n=!1;break}if(n){for(let o=1;o<=i;o++)if(t[s-i+o]>=a){n=!1;break}}n&&(r[s]=a)}return r}function Xh(t){return(e,i,r,s)=>{typeof r=="string"&&(r=i,i=e,e=t.data.high);const a=x.from(i).get(0),n=x.from(r).get(0),o=x.from(e).toArray(),l=Qh(o,a,n),c=t.idx;return t.precision(l[c])}}function Zh(t,e,i){const r=new Array(t.length).fill(NaN);for(let s=e+i;s<t.length;s++){const a=t[s-i];let n=!0;for(let o=1;o<=e;o++)if(t[s-i-o]<=a){n=!1;break}if(n){for(let o=1;o<=i;o++)if(t[s-i+o]<=a){n=!1;break}}n&&(r[s]=a)}return r}function Jh(t){return(e,i,r,s)=>{typeof r=="string"&&(r=i,i=e,e=t.data.low);const a=x.from(i).get(0),n=x.from(r).get(0),o=x.from(e).toArray(),l=Zh(o,a,n),c=t.idx;return t.precision(l[c])}}function eu(t){return e=>{t.taState||(t.taState={});const i=e||"pvi";t.taState[i]||(t.taState[i]={lastIdx:-1,committedPVI:1,tentativePVI:1});const r=t.taState[i];t.idx>r.lastIdx&&(r.lastIdx>=0&&(r.committedPVI=r.tentativePVI),r.lastIdx=t.idx);const s=t.get(t.data.close,0),a=t.get(t.data.close,1),n=t.get(t.data.volume,0),o=t.get(t.data.volume,1),l=isNaN(s)?0:s,c=isNaN(a)?0:a,h=isNaN(n)?0:n,p=isNaN(o)?0:o;let u=r.committedPVI;if(!(l===0||c===0)&&h>p){const f=(l-c)/c;u=u+f*u}return r.tentativePVI=u,t.precision(u)}}function tu(t){return e=>{t.taState||(t.taState={});const i=e||"pvt";t.taState[i]||(t.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=t.taState[i];t.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=t.idx);const s=t.get(t.data.close,0),a=t.get(t.data.close,1),n=t.get(t.data.volume,0);let o=r.prevCumulativeSum;if(!isNaN(s)&&!isNaN(a)&&!isNaN(n)&&a!==0){const l=(s-a)/a*n;o+=l}return r.currentCumulativeSum=o,t.precision(o)}}function iu(t){return(e,i,r)=>{const s=t.pine.ta.highest(e,i,(r||"range")+"_h"),a=t.pine.ta.lowest(e,i,(r||"range")+"_l");return isNaN(s)||isNaN(a)?NaN:t.precision(s-a)}}function ru(t){return(e,i,r)=>{const s=x.from(i).get(0),a=x.from(e);for(let n=0;n<s;n++){const o=a.get(n),l=a.get(n+1);if(isNaN(o)||isNaN(l)||o<=l)return!1}return!0}}function su(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`rma_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevRma:null,prevInitSum:0,prevInitCount:0,currentRma:null,currentInitSum:0,currentInitCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevRma=n.currentRma,n.prevInitSum=n.currentInitSum,n.prevInitCount=n.currentInitCount),n.lastIdx=t.idx);const o=x.from(e).get(0)||0;let l=n.prevInitCount,c=n.prevInitSum,h=n.prevRma;if(l<s){if(c+=o,l++,n.currentInitSum=c,n.currentInitCount=l,l===s){const f=c/s;return n.currentRma=f,t.precision(f)}return NaN}const p=1/s,u=o*p+h*(1-p);return n.currentRma=u,t.precision(u)}}function nu(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`roc_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s+1;)l.pop();const c=n.prevCallCount+1;if(l.length<s+1&&(c>=s+1||t.idx>=s)){const u=x.from(e);for(;l.length<s+1;)l.push(u.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<=s)return NaN;const h=l[s],p=(o-h)/h*100;return t.precision(p)}}function au(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`rsi_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevPrevValue:null,prevAvgGain:0,prevAvgLoss:0,prevInitGains:[],prevInitLosses:[],currentPrevValue:null,currentAvgGain:0,currentAvgLoss:0,currentInitGains:[],currentInitLosses:[]});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevPrevValue=n.currentPrevValue,n.prevAvgGain=n.currentAvgGain,n.prevAvgLoss=n.currentAvgLoss,n.prevInitGains=[...n.currentInitGains],n.prevInitLosses=[...n.currentInitLosses]),n.lastIdx=t.idx);const o=x.from(e).get(0);if(o==null||isNaN(o))return NaN;const l=n.prevPrevValue;if(l===null||isNaN(l))return n.currentPrevValue=o,n.currentInitGains=[...n.prevInitGains],n.currentInitLosses=[...n.prevInitLosses],n.currentAvgGain=n.prevAvgGain,n.currentAvgLoss=n.prevAvgLoss,NaN;let c=n.prevAvgGain,h=n.prevAvgLoss;const p=[...n.prevInitGains],u=[...n.prevInitLosses],f=o-l,m=f>0?f:0,y=f<0?-f:0;if(p.length<s){if(p.push(m),u.push(y),n.currentInitGains=p,n.currentInitLosses=u,n.currentPrevValue=o,p.length===s){c=p.reduce((w,v)=>w+v,0)/s,h=u.reduce((w,v)=>w+v,0)/s,n.currentAvgGain=c,n.currentAvgLoss=h;const b=h===0?100:100-100/(1+c/h);return t.precision(b)}return NaN}c=(c*(s-1)+m)/s,h=(h*(s-1)+y)/s,n.currentAvgGain=c,n.currentAvgLoss=h,n.currentPrevValue=o;const _=h===0?100:100-100/(1+c/h);return t.precision(_)}}function ou(t){return(e,i,r,s)=>{const a=x.from(e).get(0),n=x.from(i).get(0),o=x.from(r).get(0);t.taState||(t.taState={});const l=s||`sar_${a}_${n}_${o}`;t.taState[l]||(t.taState[l]={lastIdx:-1,prevResult:NaN,prevMaxMin:NaN,prevAcceleration:NaN,prevIsBelow:!1,prevBarIndex:0,currentResult:NaN,currentMaxMin:NaN,currentAcceleration:NaN,currentIsBelow:!1,currentBarIndex:0});const c=t.taState[l];t.idx>c.lastIdx&&(c.lastIdx>=0&&(c.prevResult=c.currentResult,c.prevMaxMin=c.currentMaxMin,c.prevAcceleration=c.currentAcceleration,c.prevIsBelow=c.currentIsBelow,c.prevBarIndex=c.currentBarIndex),c.lastIdx=t.idx);let h=c.prevResult,p=c.prevMaxMin,u=c.prevAcceleration,f=c.prevIsBelow,m=c.prevBarIndex;const y=t.get(t.data.high,0),_=t.get(t.data.low,0),b=t.get(t.data.close,0),w=t.get(t.data.close,1),v=t.get(t.data.high,1),E=t.get(t.data.low,1),N=t.get(t.data.high,2),O=t.get(t.data.low,2);if(isNaN(y)||isNaN(_)||isNaN(b))return c.currentResult=h,c.currentMaxMin=p,c.currentAcceleration=u,c.currentIsBelow=f,c.currentBarIndex=m,NaN;let D=!1;return m===1&&(b>w?(f=!0,p=y,h=E):(f=!1,p=_,h=v),D=!0,u=a),m>=1&&(h=h+u*(p-h),f?h>_&&(D=!0,f=!1,h=Math.max(y,p),p=_,u=a):h<y&&(D=!0,f=!0,h=Math.min(_,p),p=y,u=a),D||(f?y>p&&(p=y,u=Math.min(u+n,o)):_<p&&(p=_,u=Math.min(u+n,o))),f?(h=Math.min(h,E),m>1&&(h=Math.min(h,O))):(h=Math.max(h,v),m>1&&(h=Math.max(h,N)))),m++,c.currentResult=h,c.currentMaxMin=p,c.currentAcceleration=u,c.currentIsBelow=f,c.currentBarIndex=m,m<=1?NaN:t.precision(h)}}function lu(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`sma_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevSum:0,prevCallCount:0,currentWindow:[],currentSum:0,currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevSum=n.currentSum,n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;let h=!1;if(l.length<s&&(c>=s||t.idx>=s-1)){const y=x.from(e);for(;l.length<s;)l.push(y.get(l.length));h=!0}let p;const u=o==null||Number.isNaN(o);let f=!Number.isNaN(n.prevSum)&&!u&&!h;if(f){let y=n.prevSum+o;if(n.prevWindow.length>=s){const _=n.prevWindow[n.prevWindow.length-1];_==null||Number.isNaN(_)?f=!1:y-=_}f&&(p=y)}if(!f){p=0;let y=!1;for(const _ of l){if(_==null||Number.isNaN(_)){y=!0;break}p+=_}y&&(p=NaN)}if(n.currentWindow=l,n.currentSum=p,n.currentCallCount=c,l.length<s)return NaN;const m=p/s;return t.precision(m)}}function cu(t){return(e,i,r=!0,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0);t.taState||(t.taState={});const o=s||`stdev_${a}_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevWindow:[],prevSum:0,prevCallCount:0,currentWindow:[],currentSum:0,currentCallCount:0});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevWindow=[...l.currentWindow],l.prevSum=l.currentSum,l.prevCallCount=l.currentCallCount),l.lastIdx=t.idx);const c=x.from(e).get(0);if(c==null||isNaN(c))return NaN;const h=[...l.prevWindow];let p=l.prevSum;for(h.unshift(c),p+=c;h.length>a;){const b=h.pop();p-=b}const u=l.prevCallCount+1;if(h.length<a&&(u>=a||t.idx>=a-1)){const b=x.from(e);for(;h.length<a;){const w=b.get(h.length);if(w==null||isNaN(w))break;h.push(w),p+=w}}if(l.currentWindow=h,l.currentSum=p,l.currentCallCount=u,h.length<a)return NaN;const f=p/a;let m=0;for(let b=0;b<a;b++)m+=Math.pow(h[b]-f,2);const y=n?a:a-1,_=Math.sqrt(m/y);return t.precision(_)}}function hu(t){return(e,i,r,s,a)=>{const n=x.from(s).get(0);t.taState||(t.taState={});const o=a||`stoch_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevHighWindow:[],prevLowWindow:[],currentHighWindow:[],currentLowWindow:[]});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevHighWindow=[...l.currentHighWindow],l.prevLowWindow=[...l.currentLowWindow]),l.lastIdx=t.idx);const c=x.from(e).get(0),h=x.from(i).get(0),p=x.from(r).get(0);if(isNaN(c)||isNaN(h)||isNaN(p))return l.currentHighWindow=[...l.prevHighWindow],l.currentLowWindow=[...l.prevLowWindow],NaN;const u=[...l.prevHighWindow],f=[...l.prevLowWindow];if(u.unshift(h),f.unshift(p),u.length>n&&(u.pop(),f.pop()),l.currentHighWindow=u,l.currentLowWindow=f,u.length<n)return NaN;let m=u[0],y=f[0];for(let w=1;w<n;w++)u[w]>m&&(m=u[w]),f[w]<y&&(y=f[w]);const _=m-y;if(_===0)return NaN;const b=100*(c-y)/_;return t.precision(b)}}function uu(t){return(e,i,r)=>{const s=x.from(e).get(0),a=x.from(i).get(0);t.taState||(t.taState={});const n=r||`supertrend_${s}_${a}`;t.taState[n]||(t.taState[n]={lastIdx:-1,prevTrSum:0,prevAtrValue:NaN,prevAtrCount:0,prevLowerBand:NaN,prevUpperBand:NaN,prevSuperTrend:NaN,prevDirection:NaN,currentTrSum:0,currentAtrValue:NaN,currentAtrCount:0,currentLowerBand:NaN,currentUpperBand:NaN,currentSuperTrend:NaN,currentDirection:NaN});const o=t.taState[n];t.idx>o.lastIdx&&(o.lastIdx>=0&&(o.prevTrSum=o.currentTrSum,o.prevAtrValue=o.currentAtrValue,o.prevAtrCount=o.currentAtrCount,o.prevLowerBand=o.currentLowerBand,o.prevUpperBand=o.currentUpperBand,o.prevSuperTrend=o.currentSuperTrend,o.prevDirection=o.currentDirection),o.lastIdx=t.idx);const l=t.get(t.data.high,0),c=t.get(t.data.low,0),h=t.get(t.data.close,0);if(isNaN(l)||isNaN(c)||isNaN(h))return[[NaN,NaN]];const p=(l+c)/2,u=t.idx>0?t.get(t.data.close,1):NaN;let f;isNaN(u)?f=l-c:f=Math.max(l-c,Math.abs(l-u),Math.abs(c-u));let m=o.prevAtrCount,y=o.prevTrSum,_=o.prevAtrValue;m++,m<=a?(y+=f,m===a&&(_=y/a)):_=(_*(a-1)+f)/a;const b=_;if(o.currentAtrCount=m,o.currentTrSum=y,o.currentAtrValue=_,isNaN(b))return[[NaN,NaN]];let w=p+s*b,v=p-s*b;const E=isNaN(o.prevLowerBand)?0:o.prevLowerBand,N=isNaN(o.prevUpperBand)?0:o.prevUpperBand;isNaN(o.prevLowerBand)||v>E||u<E||(v=E),isNaN(o.prevUpperBand)||w<N||u>N||(w=N);let O,D;const V=o.prevSuperTrend;return m===a?O=1:V===o.prevUpperBand?O=h>w?-1:1:O=h<v?1:-1,D=O===-1?v:w,o.currentLowerBand=v,o.currentUpperBand=w,o.currentSuperTrend=D,o.currentDirection=O,[[t.precision(D),O]]}}function pu(t){return(e,i)=>{const r=[1,2,2,1],s=6;t.taState||(t.taState={});const a=i||"swma";t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],currentWindow:[]});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow]),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>4;)l.pop();if(l.length<4&&t.idx>=3){const h=x.from(e);for(;l.length<4;)l.push(h.get(l.length))}if(n.currentWindow=l,l.length<4)return NaN;let c=0;for(let h=0;h<4;h++)c+=r[h]*l[3-h];return c/=s,t.precision(c)}}function fu(t){return(e,i)=>{let r=!0;typeof e=="string"||e!==void 0&&(r=x.from(e).get(0));const s=t.get(t.data.high,0),a=t.get(t.data.low,0),n=t.get(t.data.close,1);if(isNaN(n))return r?t.precision(s-a):NaN;const o=Math.max(s-a,Math.abs(s-n),Math.abs(a-n));return t.precision(o)}}function du(t){return(e,i,r,s)=>{const a=x.from(i).get(0),n=x.from(r).get(0);t.taState||(t.taState={});const o=s||`tsi_${a}_${n}`;t.taState[o]||(t.taState[o]={lastIdx:-1,prevSource:NaN,prevEma1PcValue:NaN,prevEma1PcCount:0,prevEma1PcSum:0,prevEma2PcValue:NaN,prevEma2PcCount:0,prevEma2PcSum:0,prevEma1AbsValue:NaN,prevEma1AbsCount:0,prevEma1AbsSum:0,prevEma2AbsValue:NaN,prevEma2AbsCount:0,prevEma2AbsSum:0,currentSource:NaN,currentEma1PcValue:NaN,currentEma1PcCount:0,currentEma1PcSum:0,currentEma2PcValue:NaN,currentEma2PcCount:0,currentEma2PcSum:0,currentEma1AbsValue:NaN,currentEma1AbsCount:0,currentEma1AbsSum:0,currentEma2AbsValue:NaN,currentEma2AbsCount:0,currentEma2AbsSum:0});const l=t.taState[o];t.idx>l.lastIdx&&(l.lastIdx>=0&&(l.prevSource=l.currentSource,l.prevEma1PcValue=l.currentEma1PcValue,l.prevEma1PcCount=l.currentEma1PcCount,l.prevEma1PcSum=l.currentEma1PcSum,l.prevEma2PcValue=l.currentEma2PcValue,l.prevEma2PcCount=l.currentEma2PcCount,l.prevEma2PcSum=l.currentEma2PcSum,l.prevEma1AbsValue=l.currentEma1AbsValue,l.prevEma1AbsCount=l.currentEma1AbsCount,l.prevEma1AbsSum=l.currentEma1AbsSum,l.prevEma2AbsValue=l.currentEma2AbsValue,l.prevEma2AbsCount=l.currentEma2AbsCount,l.prevEma2AbsSum=l.currentEma2AbsSum),l.lastIdx=t.idx);const c=x.from(e).get(0);if(isNaN(c))return NaN;const h=isNaN(l.prevSource)?NaN:c-l.prevSource;if(l.currentSource=c,isNaN(h))return NaN;const p=Math.abs(h),u=2/(n+1),f=2/(a+1),m=2/(n+1),y=2/(a+1);let _=l.prevEma1PcCount,b=l.prevEma1PcSum,w=l.prevEma1PcValue;_++,_<=n?(b+=h,_===n&&(w=b/n)):w=h*u+w*(1-u);let v=l.prevEma1AbsCount,E=l.prevEma1AbsSum,N=l.prevEma1AbsValue;if(v++,v<=n?(E+=p,v===n&&(N=E/n)):N=p*m+N*(1-m),isNaN(w)||isNaN(N))return l.currentEma1PcCount=_,l.currentEma1PcSum=b,l.currentEma1PcValue=w,l.currentEma1AbsCount=v,l.currentEma1AbsSum=E,l.currentEma1AbsValue=N,NaN;let O=l.prevEma2PcCount,D=l.prevEma2PcSum,V=l.prevEma2PcValue;O++,O<=a?(D+=w,O===a&&(V=D/a)):V=w*f+V*(1-f);let q=l.prevEma2AbsCount,G=l.prevEma2AbsSum,K=l.prevEma2AbsValue;if(q++,q<=a?(G+=N,q===a&&(K=G/a)):K=N*y+K*(1-y),l.currentEma1PcCount=_,l.currentEma1PcSum=b,l.currentEma1PcValue=w,l.currentEma1AbsCount=v,l.currentEma1AbsSum=E,l.currentEma1AbsValue=N,l.currentEma2PcCount=O,l.currentEma2PcSum=D,l.currentEma2PcValue=V,l.currentEma2AbsCount=q,l.currentEma2AbsSum=G,l.currentEma2AbsValue=K,isNaN(V)||isNaN(K))return NaN;if(K===0)return t.precision(0);const pe=V/K;return t.precision(pe)}}function mu(t){return(e,i,r,s)=>{t.taState||(t.taState={});const a=s||"valuewhen";t.taState[a]||(t.taState[a]={lastIdx:-1,prevValues:[],currentValues:[]});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevValues=[...n.currentValues]),n.lastIdx=t.idx);const o=x.from(e).get(0),l=x.from(i).get(0),c=x.from(r).get(0),h=[...n.prevValues];if(o&&h.push(l),n.currentValues=h,isNaN(c)||c<0)return NaN;const p=h.length-1-c;if(p<0)return NaN;const u=h[p];return typeof u=="number"?t.precision(u):u}}function gu(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`variance_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;if(l.length<s&&(c>=s||t.idx>=s-1)){const m=x.from(e);for(;l.length<s;)l.push(m.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<s)return NaN;let h=0,p=0;for(let m=0;m<s;m++)h+=l[m],p+=l[m]*l[m];const u=h/s,f=p/s-u*u;return t.precision(f)}}function xu(t){return(e,i)=>{t.taState||(t.taState={});const r=i||"vwap";t.taState[r]||(t.taState[r]={lastIdx:-1,prevCumulativePV:0,prevCumulativeVolume:0,prevLastSessionDate:null,currentCumulativePV:0,currentCumulativeVolume:0,currentLastSessionDate:null});const s=t.taState[r];t.idx>s.lastIdx&&(s.lastIdx>=0&&(s.prevCumulativePV=s.currentCumulativePV,s.prevCumulativeVolume=s.currentCumulativeVolume,s.prevLastSessionDate=s.currentLastSessionDate),s.lastIdx=t.idx);const a=x.from(e).get(0),n=x.from(t.data.volume).get(0),o=x.from(t.data.openTime).get(0),l=new Date(o).toISOString().slice(0,10);let c=s.prevCumulativePV,h=s.prevCumulativeVolume,p=s.prevLastSessionDate;if(p!==l&&(c=0,h=0,p=l),c+=a*n,h+=n,s.currentCumulativePV=c,s.currentCumulativeVolume=h,s.currentLastSessionDate=p,h===0)return NaN;const u=c/h;return t.precision(u)}}function yu(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`vwma_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevVolumeWindow:[],currentWindow:[],currentVolumeWindow:[]});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevVolumeWindow=[...n.currentVolumeWindow]),n.lastIdx=t.idx);const o=x.from(e).get(0),l=t.get(t.data.volume,0),c=[...n.prevWindow],h=[...n.prevVolumeWindow];for(c.unshift(o),h.unshift(l);c.length>s;)c.pop(),h.pop();if(c.length<s&&t.idx>=s-1){const m=x.from(e),y=x.from(t.data.volume);for(;c.length<s;)c.push(m.get(c.length)),h.push(y.get(h.length))}if(n.currentWindow=c,n.currentVolumeWindow=h,c.length<s)return NaN;let p=0,u=0;for(let m=0;m<s;m++)p+=c[m]*h[m],u+=h[m];const f=p/u;return t.precision(f)}}function _u(t){return e=>{t.taState||(t.taState={});const i=e||"wad";t.taState[i]||(t.taState[i]={lastIdx:-1,prevCumulativeSum:0,currentCumulativeSum:0});const r=t.taState[i];t.idx>r.lastIdx&&(r.lastIdx>=0&&(r.prevCumulativeSum=r.currentCumulativeSum),r.lastIdx=t.idx);const s=t.get(t.data.close,0),a=t.get(t.data.high,0),n=t.get(t.data.low,0),o=t.get(t.data.close,1);if(isNaN(s)||isNaN(a)||isNaN(n))return r.currentCumulativeSum=r.prevCumulativeSum,t.precision(r.prevCumulativeSum);let l=0;if(!isNaN(o)){const h=Math.max(a,o),p=Math.min(n,o),u=s-o;u>0?l=s-p:u<0&&(l=s-h)}const c=r.prevCumulativeSum+l;return r.currentCumulativeSum=c,t.precision(c)}}function bu(t){return(e,i,r)=>{const s=x.from(i).get(0);t.taState||(t.taState={});const a=r||`wma_${s}`;t.taState[a]||(t.taState[a]={lastIdx:-1,prevWindow:[],prevCallCount:0,currentWindow:[],currentCallCount:0});const n=t.taState[a];t.idx>n.lastIdx&&(n.lastIdx>=0&&(n.prevWindow=[...n.currentWindow],n.prevCallCount=n.currentCallCount),n.lastIdx=t.idx);const o=x.from(e).get(0),l=[...n.prevWindow];for(l.unshift(o);l.length>s;)l.pop();const c=n.prevCallCount+1;if(l.length<s&&(c>=s||t.idx>=s-1)){const f=x.from(e);for(;l.length<s;)l.push(f.get(l.length))}if(n.currentWindow=l,n.currentCallCount=c,l.length<s)return NaN;let h=0,p=0;for(let f=0;f<s;f++){const m=s-f;h+=l[f]*m,p+=m}const u=h/p;return t.precision(u)}}function vu(t){return(e,i)=>{const r=x.from(e).get(0);t.taState||(t.taState={});const s=i||`wpr_${r}`;t.taState[s]||(t.taState[s]={lastIdx:-1,prevHighWindow:[],prevLowWindow:[],currentHighWindow:[],currentLowWindow:[]});const a=t.taState[s];t.idx>a.lastIdx&&(a.lastIdx>=0&&(a.prevHighWindow=[...a.currentHighWindow],a.prevLowWindow=[...a.currentLowWindow]),a.lastIdx=t.idx);const n=t.get(t.data.high,0),o=t.get(t.data.low,0),l=t.get(t.data.close,0);if(isNaN(n)||isNaN(o)||isNaN(l))return a.currentHighWindow=[...a.prevHighWindow],a.currentLowWindow=[...a.prevLowWindow],NaN;const c=[...a.prevHighWindow],h=[...a.prevLowWindow];if(c.unshift(n),h.unshift(o),c.length>r&&(c.pop(),h.pop()),a.currentHighWindow=c,a.currentLowWindow=h,c.length<r)return NaN;let p=c[0],u=h[0];for(let y=1;y<r;y++)c[y]>p&&(p=c[y]),h[y]<u&&(u=h[y]);const f=p-u;if(f===0)return t.precision(0);const m=(p-l)/f*-100;return t.precision(m)}}function wu(t){return e=>{const i=t.get(t.data.close,0),r=t.get(t.data.open,0),s=t.get(t.data.high,0),a=t.get(t.data.low,0),n=t.get(t.data.volume,0);if(isNaN(i)||isNaN(r)||isNaN(s)||isNaN(a)||isNaN(n))return NaN;const o=s-a;if(o===0)return t.precision(0);const l=(i-r)/o*n;return t.precision(l)}}var Su=Object.defineProperty,Eu=(t,e,i)=>e in t?Su(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,I=(t,e,i)=>Eu(t,typeof e!="symbol"?e+"":e,i);const Nu={accdist:uh,alma:ph,atr:fh,barssince:dh,bb:mh,bbw:gh,cci:xh,change:yh,cmo:_h,cog:bh,correlation:vh,cross:wh,crossover:Sh,crossunder:Eh,cum:Nh,dev:Ch,dmi:Ih,ema:kh,falling:Ah,highest:Th,highestbars:Ph,hma:Dh,iii:Rh,kc:Oh,kcw:Mh,linreg:Vh,lowest:Lh,lowestbars:jh,macd:Bh,median:Fh,mfi:$h,mode:Wh,mom:Uh,nvi:qh,obv:Kh,param:zh,percentile_linear_interpolation:Hh,percentile_nearest_rank:Gh,percentrank:Yh,pivothigh:Xh,pivotlow:Jh,pvi:eu,pvt:tu,range:iu,rising:ru,rma:su,roc:nu,rsi:au,sar:ou,sma:lu,stdev:cu,stoch:hu,supertrend:uu,swma:pu,tr:fu,tsi:du,valuewhen:mu,variance:gu,vwap:xu,vwma:yu,wad:_u,wma:bu,wpr:vu,wvad:wu};class Cu{constructor(e){this.context=e,I(this,"accdist"),I(this,"alma"),I(this,"atr"),I(this,"barssince"),I(this,"bb"),I(this,"bbw"),I(this,"cci"),I(this,"change"),I(this,"cmo"),I(this,"cog"),I(this,"correlation"),I(this,"cross"),I(this,"crossover"),I(this,"crossunder"),I(this,"cum"),I(this,"dev"),I(this,"dmi"),I(this,"ema"),I(this,"falling"),I(this,"highest"),I(this,"highestbars"),I(this,"hma"),I(this,"iii"),I(this,"kc"),I(this,"kcw"),I(this,"linreg"),I(this,"lowest"),I(this,"lowestbars"),I(this,"macd"),I(this,"median"),I(this,"mfi"),I(this,"mode"),I(this,"mom"),I(this,"nvi"),I(this,"obv"),I(this,"param"),I(this,"percentile_linear_interpolation"),I(this,"percentile_nearest_rank"),I(this,"percentrank"),I(this,"pivothigh"),I(this,"pivotlow"),I(this,"pvi"),I(this,"pvt"),I(this,"range"),I(this,"rising"),I(this,"rma"),I(this,"roc"),I(this,"rsi"),I(this,"sar"),I(this,"sma"),I(this,"stdev"),I(this,"stoch"),I(this,"supertrend"),I(this,"swma"),I(this,"tr"),I(this,"tsi"),I(this,"valuewhen"),I(this,"variance"),I(this,"vwap"),I(this,"vwma"),I(this,"wad"),I(this,"wma"),I(this,"wpr"),I(this,"wvad"),Object.entries(Nu).forEach(([i,r])=>{this[i]=r(e)})}}function ii(t=new Date,e){const i=e??-t.getTimezoneOffset(),r=i>=0?"+":"-",s=n=>String(Math.floor(Math.abs(n))).padStart(2,"0"),a=r+s(i/60)+":"+s(i%60);return`[${t.toISOString().slice(0,-1)}${a}]`}class Iu{constructor(e){this.context=e}logFormat(e,...i){return e.replace(/{(\d+)}/g,(r,s)=>i[s])}param(e,i=0,r){return x.from(e).get(i)}warning(e,...i){if(this.context.isSecondaryContext)return;const r=this.context.data.openTime.data[this.context.idx],s=ii(new Date(r),0);console.warn(`${s} ${this.logFormat(e,...i)}`)}error(e,...i){if(this.context.isSecondaryContext)return;const r=this.context.data.openTime.data[this.context.idx],s=ii(new Date(r),0);console.error(`${s} ${this.logFormat(e,...i)}`)}info(e,...i){if(this.context.isSecondaryContext)return;const r=this.context.data.openTime.data[this.context.idx],s=ii(new Date(r),0);console.log(`${s} ${this.logFormat(e,...i)}`)}}class ku{constructor(e){this.context=e}param(e,i=0,r){return x.from(e).get(i)}tostring(e,i){if(i==="mintick"&&typeof e=="number"){const r=this.context.pine?.syminfo?.mintick||.01,s=Math.max(0,-Math.floor(Math.log10(r)));return e.toFixed(s)}return String(e)}tonumber(e){return Number(e)}lower(e){return String(e).toLowerCase()}upper(e){return String(e).toUpperCase()}trim(e){return String(e).trim()}repeat(e,i,r=""){return Array(i).fill(e).join(r||"")}replace_all(e,i,r){return String(e).replaceAll(i,r)}replace(e,i,r,s=0){const a=String(e),n=String(i),o=String(r),l=Math.floor(Number(s))||0;if(n==="")return a;let c=0,h=0;for(;;){const p=a.indexOf(n,c);if(p===-1)return a;if(h===l)return a.substring(0,p)+o+a.substring(p+n.length);h++,c=p+n.length}}contains(e,i){return String(e).includes(i)}endswith(e,i){return String(e).endsWith(i)}startswith(e,i){return String(e).startsWith(i)}pos(e,i){const r=String(e).indexOf(i);return r===-1?NaN:r}length(e){return String(e).length}match(e,i){return String(e).match(new RegExp(i))}split(e,i){return[String(e).split(i)]}substring(e,i,r){return String(e).substring(i,r)}format(e,...i){return e.replace(/{(\d+)}/g,(r,s)=>i[s])}}class Au{constructor(e){this.context=e}param(e,i=0,r){return x.from(e).get(i)}get main_period(){return this.context.timeframe}get period(){return this.context.timeframe}get multiplier(){const e=parseInt(this.context.timeframe);return isNaN(e)?1:e}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(e){return e<60?Math.ceil(e/5)*5+"S":e<3600*24?Math.ceil(e/60):e<=3600*24*7*52?e%(3600*24*7)===0?Math.ceil(e/604800)+"W":Math.ceil(e/(3600*24))+"D":"12M"}in_seconds(e){const i=parseInt(e),r=e.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 tr=["series","title","color","linewidth","style","trackprice","histbase","offset","join","editable","show_last","display","format","precision","force_overlay"],Tu=["series","title","style","location","color","offset","text","textcolor","editable","size","show_last","display","format","precision","force_overlay"],Pu=["series","title","colorup","colordown","offset","minheight","maxheight","editable","show_last","display","format","precision","force_overlay"],Du=["open","high","low","close","title","color","editable","show_last","display","format","precision","force_overlay"],Ru=["open","high","low","close","title","color","wickcolor","editable","show_last","bordercolor","display","format","precision","force_overlay"],ir=["color","offset","editable","show_last","title","display","force_overlay"],Ou=["price","title","color","linestyle","linewidth","editable","display"],Mu=["plot1","plot2","color","title","editable","show_last","fillgaps","display"],rr={series:"series",title:"string",color:"series",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"},Vu={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"},Lu={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"},ju={open:"series",high:"series",low:"series",close:"series",title:"string",color:"string",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"},Bu={open:"series",high:"series",low:"series",close:"series",title:"string",color:"string",wickcolor:"string",bordercolor:"string",editable:"boolean",show_last:"number",display:"string",format:"string",precision:"number",force_overlay:"boolean"},sr={color:"string",offset:"number",editable:"boolean",show_last:"number",title:"string",display:"string",force_overlay:"boolean"},Fu={price:"series",title:"string",color:"string",linestyle:"string",linewidth:"number",editable:"boolean",display:"string"},$u={plot1:"object",plot2:"object",color:"string",title:"string",editable:"boolean",show_last:"number",fillgaps:"boolean",display:"string"};class Wu{constructor(e){this.context=e}_resolvePlotKey(e,i){if(e){const r=this.context.plots[e];return!r||!i||r._callsiteId===i?e:e+i}return i||"plot"}extractPlotOptions(e){const i={};for(let r in e)i[r]=x.from(e[r]).get(0);return i}get linestyle_dashed(){return"linestyle_dashed"}get linestyle_dotted(){return"linestyle_dotted"}get linestyle_solid(){return"linestyle_solid"}get style_area(){return"style_area"}get style_areabr(){return"style_areabr"}get style_circles(){return"style_circles"}get style_columns(){return"style_columns"}get style_cross(){return"style_cross"}get style_histogram(){return"style_histogram"}get style_line(){return"style_line"}get style_linebr(){return"style_linebr"}get style_stepline(){return"style_stepline"}get style_stepline_diamond(){return"style_stepline_diamond"}get style_steplinebr(){return"style_steplinebr"}param(e,i=0,r){return x.from(e).get(i)}plotchar(...e){const i=Ve(e),r=te(e,tr,rr),{series:s,title:a,...n}=r,o=this.extractPlotOptions(n),l=this._resolvePlotKey(a,i);this.context.plots[l]||(this.context.plots[l]={data:[],options:{...o,style:"char"},title:a,_plotKey:l,_callsiteId:i});const c=x.from(s).get(0);return this.context.plots[l].data.push({title:a,time:this.context.marketData[this.context.idx].openTime,value:c}),this.context.plots[l]}any(...e){const i=Ve(e),r=te(e,tr,rr),{series:s,title:a,...n}=r,o=this.extractPlotOptions(n),l=this._resolvePlotKey(a,i);if(!this.context.plots[l]){const u=o.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[l]={data:[],options:{...o,overlay:u},title:a,_plotKey:l,_callsiteId:i}}const c=x.from(s).get(0),h=o.color,p={color:"color"in n?typeof h=="string"?h:void 0:h||"#2962ff"};return"offset"in n&&(p.offset=o.offset),this.context.plots[l].data.push({title:a,time:this.context.marketData[this.context.idx].openTime,value:c,options:p}),this.context.plots[l]}plotshape(...e){const i=Ve(e),r=te(e,Tu,Vu),{series:s,title:a,...n}=r,o=this.extractPlotOptions(n),l=this._resolvePlotKey(a,i);if(!this.context.plots[l]){const h=o.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[l]={data:[],options:{...o,style:"shape",shape:o.style,overlay:h},title:a,_plotKey:l,_callsiteId:i}}const c=x.from(s).get(0);return this.context.plots[l].data.push({title:a,time:this.context.marketData[this.context.idx].openTime,value:c,options:o?.location==="absolute"||c?{text:o.text,textcolor:o.textcolor,color:o.color,offset:o.offset,shape:o.style,location:o.location,size:o.size}:void 0}),this.context.plots[l]}plotarrow(...e){const i=Ve(e),r=te(e,Pu,Lu),{series:s,title:a,...n}=r,o=x.from(s).get(0),l=this.extractPlotOptions(n),c=this._resolvePlotKey(a,i);if(!this.context.plots[c]){const h=l.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[c]={data:[],options:{...l,style:"shape",overlay:h},title:a,_plotKey:c,_callsiteId:i}}return this.context.plots[c].data.push({title:a,time:this.context.marketData[this.context.idx].openTime,value:o,options:typeof o=="number"&&!isNaN(o)&&o!==0?{text:void 0,textcolor:void 0,color:o>0?l.colorup:l.colordown,offset:l.offset,shape:o>0?"shape_arrow_up":"shape_arrow_down",location:o>0?"BelowBar":"AboveBar",height:l.maxheight}:void 0}),this.context.plots[c]}plotbar(...e){const i=Ve(e),r=te(e,Du,ju),{open:s,high:a,low:n,close:o,title:l,...c}=r,h=this.extractPlotOptions(c),p=this._resolvePlotKey(l,i);if(!this.context.plots[p]){const f=h.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[p]={data:[],options:{...h,style:"bar",overlay:f},title:l,_plotKey:p,_callsiteId:i}}const u=[x.from(s).get(0),x.from(a).get(0),x.from(n).get(0),x.from(o).get(0)];this.context.plots[p].data.push({title:l,time:this.context.marketData[this.context.idx].openTime,value:u,options:{color:h.color}})}plotcandle(...e){const i=Ve(e),r=te(e,Ru,Bu),{open:s,high:a,low:n,close:o,title:l,...c}=r,h=this.extractPlotOptions(c),p=this._resolvePlotKey(l,i);if(!this.context.plots[p]){const f=h.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[p]={data:[],options:{...h,style:"candle",overlay:f},title:l,_plotKey:p,_callsiteId:i}}const u=[x.from(s).get(0),x.from(a).get(0),x.from(n).get(0),x.from(o).get(0)];return this.context.plots[p].data.push({title:l,time:this.context.marketData[this.context.idx].openTime,value:u,options:{color:h.color,wickcolor:h.wickcolor,bordercolor:h.bordercolor}}),this.context.plots[p]}bgcolor(...e){const i=Ve(e),r=te(e,ir,sr),{title:s,...a}=r,n=this.extractPlotOptions(a),o=this._resolvePlotKey(s,i);if(!this.context.plots[o]){const l=n.force_overlay??(this.context?.indicator?.overlay||!1);this.context.plots[o]={data:[],options:{...n,style:"background",overlay:l},title:s,_plotKey:o,_callsiteId:i}}this.context.plots[o].data.push({title:s,time:this.context.marketData[this.context.idx].openTime,value:n.color&&n.color!=="na"&&n?.color.toString()!=="NaN",options:{color:n.color}})}barcolor(...e){const i=Ve(e),r=te(e,ir,sr),{title:s,...a}=r,n=this.extractPlotOptions(a),o=this._resolvePlotKey(s,i);return this.context.plots[o]||(this.context.plots[o]={data:[],options:{...n,style:"barcolor"},title:s,_plotKey:o,_callsiteId:i}),this.context.plots[o].data.push({title:s,time:this.context.marketData[this.context.idx].openTime,value:n.color&&n.color!=="na"&&n?.color.toString()!=="NaN",options:{color:n.color}}),this.context.plots[o]}}class Uu{constructor(e){this.context=e}get style_dashed(){return"dashed"}get style_solid(){return"solid"}get style_dotted(){return"dotted"}param(e,i=0,r){return x.from(e).get(i)}any(...e){const i=Ve(e),r=te(e,Ou,Fu),{price:s,title:a,color:n,linestyle:o,linewidth:l,editable:c,display:h}=r,p=[s,{title:a,color:n,linestyle:o,linewidth:l,editable:c,display:h,style:"hline"}];return i&&p.push({__callsiteId:i}),this.context.pine.plot.any(...p)}}class qu{constructor(e){this.context=e}param(e,i=0,r){return x.from(e).get(i)}any(...e){const i=Ve(e);if(e.length>=6&&typeof e[2]=="number"){const r=e[0],s=e[1],a=e[2],n=e[3],o=e[4],l=e[5],c=e.length>6&&typeof e[6]=="string"?e[6]:void 0,h=r?._plotKey||r?.title,p=s?._plotKey||s?.title;let u=c||"fill";const f=this.context.plots[u];f&&i&&f._callsiteId!==i&&(u=i),this.context.plots[u]||(this.context.plots[u]={title:c||"Fill",plot1:h,plot2:p,data:[],options:{plot1:h,plot2:p,style:"fill",gradient:!0},_plotKey:u,_callsiteId:i}),this.context.plots[u].data.push({time:this.context.marketData[this.context.idx].openTime,value:null,options:{top_value:a,bottom_value:n,top_color:o,bottom_color:l}})}else{const r=te(e,Mu,$u),{plot1:s,plot2:a,color:n,title:o,editable:l,show_last:c,fillgaps:h,display:p}=r;let u=o||"fill";const f=this.context.plots[u];if(f&&i&&f._callsiteId!==i&&(u=i),!this.context.plots[u]){const m=s?._plotKey||s?.title,y=a?._plotKey||a?.title;this.context.plots[u]={title:o||"Fill",plot1:m,plot2:y,options:{plot1:m,plot2:y,color:n,editable:l,show_last:c,fillgaps:h,display:p,style:"fill"},_plotKey:u,_callsiteId:i}}}}}var Ku=Object.defineProperty,zu=(t,e,i)=>e in t?Ku(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Hu=(t,e,i)=>zu(t,typeof e!="symbol"?e+"":e,i);class Gu{constructor(e){this.context=e,Hu(this,"point");const i=this.context;this.point={new(r,s,a){return new me(r,s,a??NaN)},from_index(r,s){return new me(void 0,r,s)},from_time(r,s){return new me(r,void 0,s)},copy(r){return r.copy()},now(r){const s=i.idx,a=i.marketData[s]?.openTime;return new me(a,s,r)}}}param(e,i=0,r){return x.from(e).get(i)}bg_color(){return"#1e293b"}fg_color(){return"#ffffff"}is_standard(){return!0}is_heikinashi(){return!1}is_kagi(){return!1}is_linebreak(){return!1}is_pnf(){return!1}is_range(){return!1}is_renko(){return!1}}var Yu=Object.defineProperty,Qu=(t,e,i)=>e in t?Yu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,he=(t,e,i)=>Qu(t,typeof e!="symbol"?e+"":e,i);let Xu=0;class Ni{constructor(e,i,r="",s="bi",a="pr",n="",o="style_label_down",l="",c="normal",h="center",p="",u="default",f=!1){he(this,"id"),he(this,"x"),he(this,"y"),he(this,"text"),he(this,"xloc"),he(this,"yloc"),he(this,"color"),he(this,"style"),he(this,"textcolor"),he(this,"size"),he(this,"textalign"),he(this,"tooltip"),he(this,"text_font_family"),he(this,"force_overlay"),he(this,"_deleted"),this.id=Xu++,this.x=e,this.y=i,this.text=r,this.xloc=s,this.yloc=a,this.color=n,this.style=o,this.textcolor=l,this.size=c,this.textalign=h,this.tooltip=p,this.text_font_family=u,this.force_overlay=f,this._deleted=!1}delete(){this._deleted=!0}copy(){return new Ni(this.x,this.y,this.text,this.xloc,this.yloc,this.color,this.style,this.textcolor,this.size,this.textalign,this.tooltip,this.text_font_family,this.force_overlay)}toPlotData(){return{id:this.id,x:this.x,y:this.y,text:this.text,xloc:this.xloc,yloc:this.yloc,color:this.color,style:this.style,textcolor:this.textcolor,size:this.size,textalign:this.textalign,tooltip:this.tooltip,text_font_family:this.text_font_family,force_overlay:this.force_overlay}}}var Zu=Object.defineProperty,Ju=(t,e,i)=>e in t?Zu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ep=(t,e,i)=>Ju(t,typeof e!="symbol"?e+"":e,i);const tp=[["x","y","text","xloc","yloc","color","style","textcolor","size","textalign","tooltip","text_font_family","force_overlay"],["point","text","xloc","yloc","color","style","textcolor","size","textalign","tooltip","text_font_family","force_overlay"]],ip={x:"number",y:"number",text:"string",xloc:"string",yloc:"string",color:"string",style:"string",textcolor:"string",size:"string",textalign:"string",tooltip:"string",text_font_family:"string",force_overlay:"boolean",point:"point"};class rp{constructor(e){this.context=e,ep(this,"_labels",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__labels__||(this.context.plots.__labels__={title:"__labels__",data:[],options:{style:"label",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__labels__.data=[{time:e,value:this._labels,options:{style:"label"}}]}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}_createLabel(e,i,r="",s="bi",a="pr",n="",o="style_label_down",l="",c="normal",h="center",p="",u="default",f=!1){const m=new Ni(e,i,this._resolve(r),this._resolve(s),this._resolve(a),this._resolve(n),this._resolve(o),this._resolve(l),this._resolve(c),this._resolve(h),this._resolve(p),this._resolve(u),f);return this._labels.push(m),this._syncToPlot(),m}new(...e){const i=te(e,tp,ip);let r,s,a=i.xloc;if(i.point instanceof me){const n=i.point;n.index!==void 0?(r=n.index,a=a||"bi"):n.time!==void 0?(r=n.time,a=a||"bt"):(r=0,a=a||"bi"),s=n.price}else r=i.x,s=i.y;return this._createLabel(r,s,i.text,a,i.yloc,i.color,i.style,i.textcolor,i.size,i.textalign,i.tooltip,i.text_font_family,i.force_overlay)}any(...e){return this.new(...e)}set_x(e,i){e&&!e._deleted&&(e.x=i)}set_y(e,i){e&&!e._deleted&&(e.y=i)}set_xy(e,i,r){e&&!e._deleted&&(e.x=i,e.y=r)}set_text(e,i){e&&!e._deleted&&(e.text=i)}set_color(e,i){e&&!e._deleted&&(e.color=i)}set_textcolor(e,i){e&&!e._deleted&&(e.textcolor=i)}set_size(e,i){e&&!e._deleted&&(e.size=i)}set_style(e,i){e&&!e._deleted&&(e.style=i)}set_textalign(e,i){e&&!e._deleted&&(e.textalign=i)}set_tooltip(e,i){e&&!e._deleted&&(e.tooltip=i)}set_xloc(e,i){e&&!e._deleted&&(e.xloc=i)}set_yloc(e,i){e&&!e._deleted&&(e.yloc=i)}set_point(e,i){e&&!e._deleted&&i&&(i.index!==void 0?(e.x=i.index,e.xloc="bi"):i.time!==void 0&&(e.x=i.time,e.xloc="bt"),e.y=i.price)}get_x(e){return e?e.x:NaN}get_y(e){return e?e.y:NaN}get_text(e){return e?e.text:""}copy(e){if(!e)return;const i=e.copy();return this._labels.push(i),this._syncToPlot(),i}delete(e){e&&(e._deleted=!0)}get all(){return this._labels.filter(e=>!e._deleted)}get style_label_down(){return"style_label_down"}get style_label_up(){return"style_label_up"}get style_label_left(){return"style_label_left"}get style_label_right(){return"style_label_right"}get style_label_lower_left(){return"style_label_lower_left"}get style_label_lower_right(){return"style_label_lower_right"}get style_label_upper_left(){return"style_label_upper_left"}get style_label_upper_right(){return"style_label_upper_right"}get style_label_center(){return"style_label_center"}get style_circle(){return"style_circle"}get style_square(){return"style_square"}get style_diamond(){return"style_diamond"}get style_flag(){return"style_flag"}get style_arrowup(){return"style_arrowup"}get style_arrowdown(){return"style_arrowdown"}get style_cross(){return"style_cross"}get style_xcross(){return"style_xcross"}get style_triangleup(){return"style_triangleup"}get style_triangledown(){return"style_triangledown"}get style_none(){return"style_none"}get style_text_outline(){return"style_text_outline"}}var sp=Object.defineProperty,np=(t,e,i)=>e in t?sp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ee=(t,e,i)=>np(t,typeof e!="symbol"?e+"":e,i);let ap=0;class Ci{constructor(e,i,r,s,a="bi",n="none",o="",l="style_solid",c=1,h=!1){Ee(this,"id"),Ee(this,"x1"),Ee(this,"y1"),Ee(this,"x2"),Ee(this,"y2"),Ee(this,"xloc"),Ee(this,"extend"),Ee(this,"color"),Ee(this,"style"),Ee(this,"width"),Ee(this,"force_overlay"),Ee(this,"_deleted"),this.id=ap++,this.x1=e,this.y1=i,this.x2=r,this.y2=s,this.xloc=a,this.extend=n,this.color=o,this.style=l,this.width=c,this.force_overlay=h,this._deleted=!1}delete(){this._deleted=!0}copy(){return new Ci(this.x1,this.y1,this.x2,this.y2,this.xloc,this.extend,this.color,this.style,this.width,this.force_overlay)}toPlotData(){return{id:this.id,x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2,xloc:this.xloc,extend:this.extend,color:this.color,style:this.style,width:this.width,force_overlay:this.force_overlay}}}var op=Object.defineProperty,lp=(t,e,i)=>e in t?op(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,cp=(t,e,i)=>lp(t,typeof e!="symbol"?e+"":e,i);const hp=[["x1","y1","x2","y2","xloc","extend","color","style","width","force_overlay"],["first_point","second_point","xloc","extend","color","style","width","force_overlay"]],up={x1:"number",y1:"number",x2:"number",y2:"number",xloc:"string",extend:"string",color:"string",style:"string",width:"number",force_overlay:"boolean",first_point:"point",second_point:"point"};class pp{constructor(e){this.context=e,cp(this,"_lines",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__lines__||(this.context.plots.__lines__={title:"__lines__",data:[],options:{style:"drawing_line",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__lines__.data=[{time:e,value:this._lines,options:{style:"drawing_line"}}]}_resolvePoint(e){return e.index!==void 0?{x:e.index,xloc:"bi"}:e.time!==void 0?{x:e.time,xloc:"bt"}:{x:0,xloc:"bi"}}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}_createLine(e,i,r,s,a="bi",n="none",o="",l="style_solid",c=1,h=!1){const p=new Ci(e,i,r,s,a,this._resolve(n),this._resolve(o),this._resolve(l),this._resolve(c)||1,h);return this._lines.push(p),this._syncToPlot(),p}new(...e){const i=te(e,hp,up);let r,s,a,n,o=i.xloc;if(i.first_point instanceof me){const l=i.first_point,c=i.second_point,h=this._resolvePoint(l);r=h.x,s=l.price,o=o||h.xloc,c instanceof me?(a=this._resolvePoint(c).x,n=c.price):(a=0,n=NaN)}else r=i.x1,s=i.y1,a=i.x2,n=i.y2;return this._createLine(r,s,a,n,o,i.extend,i.color,i.style,i.width,i.force_overlay)}any(...e){return this.new(...e)}set_x1(e,i){e&&!e._deleted&&(e.x1=i)}set_y1(e,i){e&&!e._deleted&&(e.y1=i)}set_x2(e,i){e&&!e._deleted&&(e.x2=i)}set_y2(e,i){e&&!e._deleted&&(e.y2=i)}set_xy1(e,i,r){e&&!e._deleted&&(e.x1=i,e.y1=r)}set_xy2(e,i,r){e&&!e._deleted&&(e.x2=i,e.y2=r)}set_color(e,i){e&&!e._deleted&&(e.color=this._resolve(i))}set_width(e,i){e&&!e._deleted&&(e.width=this._resolve(i)||1)}set_style(e,i){e&&!e._deleted&&(e.style=this._resolve(i))}set_extend(e,i){e&&!e._deleted&&(e.extend=this._resolve(i))}set_xloc(e,i,r,s){e&&!e._deleted&&(e.x1=i,e.x2=r,e.xloc=s)}set_first_point(e,i){if(e&&!e._deleted&&i){const r=this._resolvePoint(i);e.x1=r.x,e.y1=i.price,e.xloc=r.xloc}}set_second_point(e,i){if(e&&!e._deleted&&i){const r=this._resolvePoint(i);e.x2=r.x,e.y2=i.price,e.xloc=r.xloc}}get_x1(e){return e?e.x1:NaN}get_y1(e){return e?e.y1:NaN}get_x2(e){return e?e.x2:NaN}get_y2(e){return e?e.y2:NaN}get_price(e,i){if(!e||e._deleted)return NaN;if(e.xloc!=="bi")return NaN;const r=e.x2-e.x1;return r===0?e.y1:e.y1+(i-e.x1)/r*(e.y2-e.y1)}copy(e){if(!e)return;const i=e.copy();return this._lines.push(i),this._syncToPlot(),i}delete(e){e&&(e._deleted=!0)}get all(){return this._lines.filter(e=>!e._deleted)}get style_solid(){return"style_solid"}get style_dotted(){return"style_dotted"}get style_dashed(){return"style_dashed"}get style_arrow_left(){return"style_arrow_left"}get style_arrow_right(){return"style_arrow_right"}get style_arrow_both(){return"style_arrow_both"}}var fp=Object.defineProperty,dp=(t,e,i)=>e in t?fp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Q=(t,e,i)=>dp(t,typeof e!="symbol"?e+"":e,i);let mp=0;class Ii{constructor(e,i,r,s,a="bi",n="none",o="#2962ff",l="style_solid",c=1,h="#2962ff",p="",u="#000000",f="auto",m="center",y="center",_="wrap_none",b="default",w="format_none",v=!1){Q(this,"id"),Q(this,"left"),Q(this,"top"),Q(this,"right"),Q(this,"bottom"),Q(this,"xloc"),Q(this,"extend"),Q(this,"border_color"),Q(this,"border_style"),Q(this,"border_width"),Q(this,"bgcolor"),Q(this,"text"),Q(this,"text_color"),Q(this,"text_size"),Q(this,"text_halign"),Q(this,"text_valign"),Q(this,"text_wrap"),Q(this,"text_font_family"),Q(this,"text_formatting"),Q(this,"force_overlay"),Q(this,"_deleted"),this.id=mp++,this.left=e,this.top=i,this.right=r,this.bottom=s,this.xloc=a,this.extend=n,this.border_color=o,this.border_style=l,this.border_width=c,this.bgcolor=h,this.text=p,this.text_color=u,this.text_size=f,this.text_halign=m,this.text_valign=y,this.text_wrap=_,this.text_font_family=b,this.text_formatting=w,this.force_overlay=v,this._deleted=!1}delete(){this._deleted=!0}copy(){return new Ii(this.left,this.top,this.right,this.bottom,this.xloc,this.extend,this.border_color,this.border_style,this.border_width,this.bgcolor,this.text,this.text_color,this.text_size,this.text_halign,this.text_valign,this.text_wrap,this.text_font_family,this.text_formatting,this.force_overlay)}}var gp=Object.defineProperty,xp=(t,e,i)=>e in t?gp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,yp=(t,e,i)=>xp(t,typeof e!="symbol"?e+"":e,i);const _p=[["left","top","right","bottom","border_color","border_width","border_style","extend","xloc","bgcolor","text","text_size","text_color","text_halign","text_valign","text_wrap","text_font_family","force_overlay"],["top_left","bottom_right","border_color","border_width","border_style","extend","xloc","bgcolor","text","text_size","text_color","text_halign","text_valign","text_wrap","text_font_family","force_overlay"]],bp={left:"number",top:"number",right:"number",bottom:"number",top_left:"point",bottom_right:"point",border_color:"string",border_width:"number",border_style:"string",extend:"string",xloc:"string",bgcolor:"string",text:"string",text_size:"string",text_color:"string",text_halign:"string",text_valign:"string",text_wrap:"string",text_font_family:"string",force_overlay:"boolean"};class vp{constructor(e){this.context=e,yp(this,"_boxes",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__boxes__||(this.context.plots.__boxes__={title:"__boxes__",data:[],options:{style:"drawing_box",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__boxes__.data=[{time:e,value:this._boxes,options:{style:"drawing_box"}}]}_resolvePoint(e){return e.index!==void 0?{x:e.index,xloc:"bi"}:e.time!==void 0?{x:e.time,xloc:"bt"}:{x:0,xloc:"bi"}}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}_createBox(e,i,r,s,a="bi",n="none",o="#2962ff",l="style_solid",c=1,h="#2962ff",p="",u="#000000",f="auto",m="center",y="center",_="wrap_none",b="default",w="format_none",v=!1){const E=new Ii(e,i,r,s,a,this._resolve(n),this._resolve(o)||"#2962ff",this._resolve(l)||"style_solid",this._resolve(c)??1,this._resolve(h)||"#2962ff",this._resolve(p)||"",this._resolve(u)||"#000000",this._resolve(f)||"auto",this._resolve(m)||"center",this._resolve(y)||"center",this._resolve(_)||"wrap_none",this._resolve(b)||"default",this._resolve(w)||"format_none",v);return this._boxes.push(E),this._syncToPlot(),E}new(...e){const i=te(e,_p,bp);let r,s,a,n,o=i.xloc;if(i.top_left instanceof me){const l=i.top_left,c=i.bottom_right,h=this._resolvePoint(l);r=h.x,s=l.price,o=o||h.xloc,c instanceof me?(a=this._resolvePoint(c).x,n=c.price):(a=0,n=NaN)}else r=this._resolve(i.left),s=this._resolve(i.top),a=this._resolve(i.right),n=this._resolve(i.bottom);return this._createBox(r,s,a,n,o,i.extend,i.border_color,i.border_style,i.border_width,i.bgcolor,i.text,i.text_color,i.text_size,i.text_halign,i.text_valign,i.text_wrap,i.text_font_family,void 0,i.force_overlay)}any(...e){return this.new(...e)}set_left(e,i){e&&!e._deleted&&(e.left=i)}set_right(e,i){e&&!e._deleted&&(e.right=i)}set_top(e,i){e&&!e._deleted&&(e.top=i)}set_bottom(e,i){e&&!e._deleted&&(e.bottom=i)}set_lefttop(e,i,r){e&&!e._deleted&&(e.left=i,e.top=r)}set_rightbottom(e,i,r){e&&!e._deleted&&(e.right=i,e.bottom=r)}set_top_left_point(e,i){if(e&&!e._deleted&&i){const r=this._resolvePoint(i);e.left=r.x,e.top=i.price,e.xloc=r.xloc}}set_bottom_right_point(e,i){if(e&&!e._deleted&&i){const r=this._resolvePoint(i);e.right=r.x,e.bottom=i.price,e.xloc=r.xloc}}set_xloc(e,i,r,s){e&&!e._deleted&&(e.left=i,e.right=r,e.xloc=s)}set_bgcolor(e,i){e&&!e._deleted&&(e.bgcolor=this._resolve(i))}set_border_color(e,i){e&&!e._deleted&&(e.border_color=this._resolve(i))}set_border_width(e,i){e&&!e._deleted&&(e.border_width=this._resolve(i)??1)}set_border_style(e,i){e&&!e._deleted&&(e.border_style=this._resolve(i))}set_extend(e,i){e&&!e._deleted&&(e.extend=this._resolve(i))}set_text(e,i){e&&!e._deleted&&(e.text=this._resolve(i)||"")}set_text_color(e,i){e&&!e._deleted&&(e.text_color=this._resolve(i))}set_text_size(e,i){e&&!e._deleted&&(e.text_size=this._resolve(i))}set_text_halign(e,i){e&&!e._deleted&&(e.text_halign=this._resolve(i))}set_text_valign(e,i){e&&!e._deleted&&(e.text_valign=this._resolve(i))}set_text_wrap(e,i){e&&!e._deleted&&(e.text_wrap=this._resolve(i))}set_text_font_family(e,i){e&&!e._deleted&&(e.text_font_family=this._resolve(i))}set_text_formatting(e,i){e&&!e._deleted&&(e.text_formatting=this._resolve(i))}get_left(e){return e?e.left:NaN}get_right(e){return e?e.right:NaN}get_top(e){return e?e.top:NaN}get_bottom(e){return e?e.bottom:NaN}copy(e){if(!e)return;const i=e.copy();return this._boxes.push(i),this._syncToPlot(),i}delete(e){e&&(e._deleted=!0)}get all(){return this._boxes.filter(e=>!e._deleted)}}var wp=Object.defineProperty,Sp=(t,e,i)=>e in t?wp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,bt=(t,e,i)=>Sp(t,typeof e!="symbol"?e+"":e,i);let Ep=0;class Np{constructor(e,i,r){bt(this,"id"),bt(this,"line1"),bt(this,"line2"),bt(this,"color"),bt(this,"_deleted"),this.id=Ep++,this.line1=e,this.line2=i,this.color=r,this._deleted=!1}delete(){this._deleted=!0}}var Cp=Object.defineProperty,Ip=(t,e,i)=>e in t?Cp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,kp=(t,e,i)=>Ip(t,typeof e!="symbol"?e+"":e,i);class Ap{constructor(e){this.context=e,kp(this,"_linefills",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__linefills__||(this.context.plots.__linefills__={title:"__linefills__",data:[],options:{style:"linefill",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__linefills__.data=[{time:e,value:this._linefills,options:{style:"linefill"}}]}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}new(e,i,r){const s=this._resolve(r)||"",a=new Np(e,i,s);return this._linefills.push(a),this._syncToPlot(),a}any(...e){return this.new(e[0],e[1],e[2])}set_color(e,i){e&&!e._deleted&&(e.color=this._resolve(i)||"")}get_line1(e){return e?e.line1:void 0}get_line2(e){return e?e.line2:void 0}delete(e){e&&(e._deleted=!0)}get all(){return this._linefills.filter(e=>!e._deleted)}}var Tp=Object.defineProperty,Pp=(t,e,i)=>e in t?Tp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Te=(t,e,i)=>Pp(t,typeof e!="symbol"?e+"":e,i);let Dp=0;class Rp{constructor(e,i=!1,r=!1,s="bi",a="#2962ff",n="",o="style_solid",l=1,c=!1){Te(this,"id"),Te(this,"points"),Te(this,"curved"),Te(this,"closed"),Te(this,"xloc"),Te(this,"line_color"),Te(this,"fill_color"),Te(this,"line_style"),Te(this,"line_width"),Te(this,"force_overlay"),Te(this,"_deleted"),this.id=Dp++,this.points=e,this.curved=i,this.closed=r,this.xloc=s,this.line_color=a,this.fill_color=n,this.line_style=o,this.line_width=l,this.force_overlay=c,this._deleted=!1}delete(){this._deleted=!0}}var Op=Object.defineProperty,Mp=(t,e,i)=>e in t?Op(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Vp=(t,e,i)=>Mp(t,typeof e!="symbol"?e+"":e,i);class Lp{constructor(e){this.context=e,Vp(this,"_polylines",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__polylines__||(this.context.plots.__polylines__={title:"__polylines__",data:[],options:{style:"drawing_polyline",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__polylines__.data=[{time:e,value:this._polylines,options:{style:"drawing_polyline"}}]}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}_extractPoints(e){let i=this._resolve(e);const r=i&&i.array?i.array:i;return Array.isArray(r)?r.filter(s=>s instanceof me):[]}new(...e){let i,r=!1,s=!1,a="bi",n="#2962ff",o="",l="style_solid",c=1,h=!1;const p=y=>y&&typeof y=="object"&&!Array.isArray(y)&&("points"in y||"curved"in y||"closed"in y||"line_color"in y||"fill_color"in y||"line_style"in y||"line_width"in y),u=y=>{r=y.curved??r,s=y.closed??s,a=y.xloc??a,n=y.line_color??n,o=y.fill_color??o,l=y.line_style??l,c=y.line_width??c,h=y.force_overlay??h};e.length===1&&p(e[0])&&"points"in e[0]?(i=e[0].points,u(e[0])):e.length===2&&e[1]&&typeof e[1]=="object"&&!Array.isArray(e[1])&&p(e[1])?(i=e[0],u(e[1])):(i=e[0],r=e[1]??r,s=e[2]??s,a=e[3]??a,n=e[4]??n,o=e[5]??o,l=e[6]??l,c=e[7]??c,h=e[8]??h);const f=this._extractPoints(i),m=new Rp(f,this._resolve(r)??!1,this._resolve(s)??!1,this._resolve(a)||"bi",this._resolve(n)||"#2962ff",this._resolve(o)||"",this._resolve(l)||"style_solid",this._resolve(c)||1,this._resolve(h)??!1);return this._polylines.push(m),this._syncToPlot(),m}any(...e){return this.new(...e)}delete(e){e&&(e._deleted=!0)}get all(){return this._polylines.filter(e=>!e._deleted)}}var jp=Object.defineProperty,Bp=(t,e,i)=>e in t?jp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,de=(t,e,i)=>Bp(t,typeof e!="symbol"?e+"":e,i);let Fp=0;class $p{constructor(e="top_right",i=1,r=1,s="",a="",n=0,o="",l=0,c=!1){de(this,"id"),de(this,"position"),de(this,"columns"),de(this,"rows"),de(this,"bgcolor"),de(this,"frame_color"),de(this,"frame_width"),de(this,"border_color"),de(this,"border_width"),de(this,"force_overlay"),de(this,"_deleted"),de(this,"cells"),de(this,"merges"),de(this,"_helper"),this.id=Fp++,this.position=e,this.columns=i,this.rows=r,this.bgcolor=s,this.frame_color=a,this.frame_width=n,this.border_color=o,this.border_width=l,this.force_overlay=c,this._deleted=!1,this.merges=[],this.cells=[];for(let h=0;h<r;h++){this.cells[h]=[];for(let p=0;p<i;p++)this.cells[h][p]=null}}delete(){this._deleted=!0}setCell(e,i,r){if(i<0||i>=this.rows||e<0||e>=this.columns)return;const s=this.cells[i][e];if(s&&s._merged&&s._merge_parent){const[n,o]=s._merge_parent;this.setCell(n,o,r);return}const a=s||this._defaultCell();Object.assign(a,r),this.cells[i][e]=a}getCell(e,i){return i<0||i>=this.rows||e<0||e>=this.columns?null:this.cells[i][e]}clearCell(e,i){i<0||i>=this.rows||e<0||e>=this.columns||(this.cells[i][e]=null)}_setHelper(e){this._helper=e}cell(...e){return this._helper.cell(this,...e)}clear(...e){return this._helper.clear(this,...e)}merge_cells(...e){return this._helper.merge_cells(this,...e)}cell_set_text(...e){return this._helper.cell_set_text(this,...e)}cell_set_bgcolor(...e){return this._helper.cell_set_bgcolor(this,...e)}cell_set_text_color(...e){return this._helper.cell_set_text_color(this,...e)}cell_set_text_size(...e){return this._helper.cell_set_text_size(this,...e)}cell_set_height(...e){return this._helper.cell_set_height(this,...e)}cell_set_width(...e){return this._helper.cell_set_width(this,...e)}cell_set_tooltip(...e){return this._helper.cell_set_tooltip(this,...e)}cell_set_text_halign(...e){return this._helper.cell_set_text_halign(this,...e)}cell_set_text_valign(...e){return this._helper.cell_set_text_valign(this,...e)}cell_set_text_font_family(...e){return this._helper.cell_set_text_font_family(this,...e)}set_position(...e){return this._helper.set_position(this,...e)}set_bgcolor(...e){return this._helper.set_bgcolor(this,...e)}set_border_color(...e){return this._helper.set_border_color(this,...e)}set_border_width(...e){return this._helper.set_border_width(this,...e)}set_frame_color(...e){return this._helper.set_frame_color(this,...e)}set_frame_width(...e){return this._helper.set_frame_width(this,...e)}_defaultCell(){return{text:"",width:0,height:0,text_color:"#000000",text_halign:"center",text_valign:"center",text_size:"normal",bgcolor:"",tooltip:"",text_font_family:"default",_merged:!1,_merge_parent:null}}}var Wp=Object.defineProperty,Up=(t,e,i)=>e in t?Wp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,qp=(t,e,i)=>Up(t,typeof e!="symbol"?e+"":e,i);class Kp{constructor(e){this.context=e,qp(this,"_tables",[])}param(e,i=0,r){return x.from(e).get(i)}_ensurePlotsEntry(){this.context.plots.__tables__||(this.context.plots.__tables__={title:"__tables__",data:[],options:{style:"table",overlay:!0}})}_syncToPlot(){this._ensurePlotsEntry();const e=this.context.marketData[0]?.openTime||0;this.context.plots.__tables__.data=[{time:e,value:this._tables,options:{style:"table"}}]}_resolve(e){return e==null?e:typeof e=="object"&&Array.isArray(e.data)&&typeof e.get=="function"?e.get(0):typeof e=="function"?e():e}new(...e){let i="top_right",r=1,s=1,a="",n="",o=0,l="",c=0,h=!1;const p=e[e.length-1];if(p&&typeof p=="object"&&!Array.isArray(p)&&("bgcolor"in p||"frame_color"in p||"border_color"in p||"position"in p||"columns"in p||"rows"in p)){const f=p,m=e.slice(0,-1);i=m[0]??f.position??i,r=m[1]??f.columns??r,s=m[2]??f.rows??s,a=f.bgcolor??a,n=f.frame_color??n,o=f.frame_width??o,l=f.border_color??l,c=f.border_width??c,h=f.force_overlay??h}else i=e[0]??i,r=e[1]??r,s=e[2]??s,a=e[3]??a,n=e[4]??n,o=e[5]??o,l=e[6]??l,c=e[7]??c,h=e[8]??h;const u=new $p(this._resolve(i)||"top_right",this._resolve(r)||1,this._resolve(s)||1,this._resolve(a)||"",this._resolve(n)||"",this._resolve(o)||0,this._resolve(l)||"",this._resolve(c)||0,this._resolve(h)??!1);return u._setHelper(this),this._tables.push(u),this._syncToPlot(),u}any(...e){return this.new(...e)}cell(...e){let i,r,s,a="",n=0,o=0,l="#000000",c="center",h="center",p="normal",u="",f="",m="default";const y=e[e.length-1];if(y&&typeof y=="object"&&!Array.isArray(y)&&("text"in y||"bgcolor"in y||"text_color"in y||"text_size"in y||"text_halign"in y||"tooltip"in y||"column"in y||"row"in y)){const v=y,E=e.slice(0,-1);i=E[0],r=E.length>1?E[1]:v.column??0,s=E.length>2?E[2]:v.row??0,a=E[3]??v.text??a,n=E[4]??v.width??n,o=E[5]??v.height??o,l=E[6]??v.text_color??l,c=E[7]??v.text_halign??c,h=E[8]??v.text_valign??h,p=E[9]??v.text_size??p,u=E[10]??v.bgcolor??u,f=E[11]??v.tooltip??f,m=E[12]??v.text_font_family??m}else i=e[0],r=e[1]??0,s=e[2]??0,a=e[3]??a,n=e[4]??n,o=e[5]??o,l=e[6]??l,c=e[7]??c,h=e[8]??h,p=e[9]??p,u=e[10]??u,f=e[11]??f,m=e[12]??m;const _=this._resolve(i);if(!_||_._deleted)return;const b=this._resolve(r)??0,w=this._resolve(s)??0;_.setCell(b,w,{text:this._resolveText(this._resolve(a)),width:this._resolve(n)||0,height:this._resolve(o)||0,text_color:this._resolve(l)||"#000000",text_halign:this._resolve(c)||"center",text_valign:this._resolve(h)||"center",text_size:this._resolve(p)||"normal",bgcolor:this._resolve(u)||"",tooltip:this._resolveText(this._resolve(f)),text_font_family:this._resolve(m)||"default"}),this._syncToPlot()}delete(e){e&&(e._deleted=!0)}clear(...e){let i,r,s,a,n;const o=e[e.length-1];if(o&&typeof o=="object"&&!Array.isArray(o)&&("start_column"in o||"start_row"in o||"end_column"in o)){const f=o;i=e[0],r=e.length>2?e[1]:f.start_column??0,s=e.length>3?e[2]:f.start_row??0,a=f.end_column??(e.length>4?e[3]:r),n=f.end_row??(e.length>5?e[4]:s)}else i=e[0],r=e[1]??0,s=e[2]??0,a=e[3]??r,n=e[4]??s;const l=this._resolve(i);if(!l||l._deleted)return;const c=this._resolve(r)??0,h=this._resolve(s)??0,p=this._resolve(a)??c,u=this._resolve(n)??h;for(let f=h;f<=u;f++)for(let m=c;m<=p;m++)l.clearCell(m,f);this._syncToPlot()}merge_cells(...e){let i,r,s,a,n;const o=e[e.length-1];if(o&&typeof o=="object"&&!Array.isArray(o)&&("start_column"in o||"start_row"in o||"end_column"in o)){const f=o;i=e[0],r=e.length>2?e[1]:f.start_column??0,s=e.length>3?e[2]:f.start_row??0,a=f.end_column??(e.length>4?e[3]:0),n=f.end_row??(e.length>5?e[4]:0)}else i=e[0],r=e[1]??0,s=e[2]??0,a=e[3]??0,n=e[4]??0;const l=this._resolve(i);if(!l||l._deleted)return;const c=this._resolve(r)??0,h=this._resolve(s)??0,p=this._resolve(a)??0,u=this._resolve(n)??0;for(let f=h;f<=u;f++)for(let m=c;m<=p;m++)f===h&&m===c||l.setCell(m,f,{_merged:!0,_merge_parent:[c,h]});l.merges.push({startCol:c,startRow:h,endCol:p,endRow:u}),this._syncToPlot()}cell_set_text(e,i,r,s){this._setCellProp(e,i,r,"text",s,!0)}cell_set_bgcolor(e,i,r,s){this._setCellProp(e,i,r,"bgcolor",s)}cell_set_text_color(e,i,r,s){this._setCellProp(e,i,r,"text_color",s)}cell_set_text_size(e,i,r,s){this._setCellProp(e,i,r,"text_size",s)}cell_set_height(e,i,r,s){this._setCellProp(e,i,r,"height",s)}cell_set_width(e,i,r,s){this._setCellProp(e,i,r,"width",s)}cell_set_tooltip(e,i,r,s){this._setCellProp(e,i,r,"tooltip",s,!0)}cell_set_text_halign(e,i,r,s){this._setCellProp(e,i,r,"text_halign",s)}cell_set_text_valign(e,i,r,s){this._setCellProp(e,i,r,"text_valign",s)}cell_set_text_font_family(e,i,r,s){this._setCellProp(e,i,r,"text_font_family",s)}set_position(e,i){const r=this._resolve(e);!r||r._deleted||(r.position=this._resolve(i)||r.position,this._syncToPlot())}set_bgcolor(e,i){const r=this._resolve(e);!r||r._deleted||(r.bgcolor=this._resolve(i)||"",this._syncToPlot())}set_border_color(e,i){const r=this._resolve(e);!r||r._deleted||(r.border_color=this._resolve(i)||"",this._syncToPlot())}set_border_width(e,i){const r=this._resolve(e);!r||r._deleted||(r.border_width=this._resolve(i)||0,this._syncToPlot())}set_frame_color(e,i){const r=this._resolve(e);!r||r._deleted||(r.frame_color=this._resolve(i)||"",this._syncToPlot())}set_frame_width(e,i){const r=this._resolve(e);!r||r._deleted||(r.frame_width=this._resolve(i)||0,this._syncToPlot())}get all(){return this._tables.filter(e=>!e._deleted)}_setCellProp(e,i,r,s,a,n=!1){const o=this._resolve(e);if(!o||o._deleted)return;const l=this._resolve(i)??0,c=this._resolve(r)??0,h=this._resolve(a);o.setCell(l,c,{[s]:n?this._resolveText(h):h}),this._syncToPlot()}_resolveText(e){return e==null||e!==e?"":String(e)}}var zp=Object.defineProperty,Hp=(t,e,i)=>e in t?zp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,$=(t,e,i)=>Hp(t,typeof e!="symbol"?e+"":e,i);const mi=class Dt{constructor({marketData:e,source:i,tickerId:r,timeframe:s,limit:a,sDate:n,eDate:o,fullContext:l,inputs:c}){$(this,"data",{open:new x([]),high:new x([]),low:new x([]),close:new x([]),volume:new x([]),hl2:new x([]),hlc3:new x([]),ohlc4:new x([]),hlcc4:new x([]),bar_index:new x([])}),$(this,"indicator"),$(this,"cache",{}),$(this,"taState",{}),$(this,"isSecondaryContext",!1),$(this,"NA",NaN),$(this,"lang"),$(this,"length",0),$(this,"pine"),$(this,"idx",0),$(this,"params",{}),$(this,"const",{}),$(this,"var",{}),$(this,"let",{}),$(this,"lctx",new Map),$(this,"result"),$(this,"plots",{}),$(this,"marketData"),$(this,"source"),$(this,"tickerId"),$(this,"timeframe",""),$(this,"limit"),$(this,"sDate"),$(this,"eDate"),$(this,"fullContext"),$(this,"pineTSCode"),$(this,"inputs",{}),$(this,"_callStack",[]),this.marketData=e,this.source=i,this.tickerId=r,this.timeframe=s,this.limit=a,this.sDate=n,this.eDate=o,this.fullContext=l||this,this.inputs=c||{};const h=new Gl(this),p={Type:h.Type.bind(h),na:new Hl,color:h.color,nz:h.nz.bind(h),indicator:h.indicator.bind(h),fixnan:h.fixnan.bind(h),alertcondition:h.alertcondition.bind(h),timestamp:h.timestamp.bind(h),time:new Zi(this,"openTime"),time_close:new Zi(this,"closeTime"),dayofmonth:new Xe(this,Ze.dayofmonth),dayofweek:new Xe(this,Ze.dayofweek),hour:new Xe(this,Ze.hour),minute:new Xe(this,Ze.minute),month:new Xe(this,Ze.month),second:new Xe(this,Ze.second),weekofyear:new Xe(this,Ze.weekofyear),year:new Xe(this,Ze.year),bool:h.bool.bind(h),int:h.int.bind(h),float:h.float.bind(h),string:h.string.bind(h)},u=this;this.pine={input:new wc(this),ta:new Cu(this),math:new rh(this),request:new hh(this),array:new fo(this),map:new Ao(this),matrix:new Tl(this),syminfo:null,timeframe:new Au(this),barstate:new Ol(this),get bar_index(){return u.data.bar_index},get last_bar_index(){return u.data.close.length-1},get last_bar_time(){return u.data.openTime.get(u.data.openTime.length-1)},get timenow(){return new Date().getTime()},get time_tradingday(){const V=x.from(u.data.openTime).get(0);if(isNaN(V))return NaN;const q=u.pine?.syminfo?.timezone||"UTC",G=Bt(V,q);return Date.UTC(G.year,G.month-1,G.day,0,0,0)},get inputs(){return u.inputs},log:new Iu(this),str:new ku(this),...p,...Qa};const f=p.dayofweek;Object.assign(f,{sunday:1,monday:2,tuesday:3,wednesday:4,thursday:5,friday:6,saturday:7}),this.pine.dayofweek=f;const m=new Wu(this),y=new Uu(this),_=new qu(this);this.bindContextObject(m,["plotchar","plotshape","plotarrow","plotbar","plotcandle","bgcolor","barcolor"]),this.bindContextObject(m,["any","param","linestyle_dashed","linestyle_dotted","linestyle_solid","style_area","style_areabr","style_circles","style_columns","style_cross","style_histogram","style_line","style_linebr","style_stepline","style_stepline_diamond","style_steplinebr"],"plot"),this.bindContextObject(y,["any","style_dashed","style_solid","style_dotted","param"],"hline"),this.bindContextObject(_,["any","param"],"fill");const b=new Gu(this);this.pine.chart={param:b.param.bind(b),bg_color:b.bg_color.bind(b),fg_color:b.fg_color.bind(b),is_standard:b.is_standard.bind(b),is_heikinashi:b.is_heikinashi.bind(b),is_kagi:b.is_kagi.bind(b),is_linebreak:b.is_linebreak.bind(b),is_pnf:b.is_pnf.bind(b),is_range:b.is_range.bind(b),is_renko:b.is_renko.bind(b),point:b.point};const w=new rp(this);this.bindContextObject(w,["any","new","param","set_x","set_y","set_xy","set_text","set_color","set_textcolor","set_size","set_style","set_textalign","set_tooltip","set_point","set_xloc","set_yloc","get_x","get_y","get_text","copy","delete","style_label_down","style_label_up","style_label_left","style_label_right","style_label_lower_left","style_label_lower_right","style_label_upper_left","style_label_upper_right","style_label_center","style_circle","style_square","style_diamond","style_flag","style_arrowup","style_arrowdown","style_cross","style_xcross","style_triangleup","style_triangledown","style_none","style_text_outline"],"label"),Object.defineProperty(this.pine.label,"all",{get:()=>w.all});const v=new pp(this);this.bindContextObject(v,["any","new","param","set_x1","set_y1","set_x2","set_y2","set_xy1","set_xy2","set_color","set_width","set_style","set_extend","set_xloc","set_first_point","set_second_point","get_x1","get_y1","get_x2","get_y2","get_price","copy","delete","style_solid","style_dotted","style_dashed","style_arrow_left","style_arrow_right","style_arrow_both"],"line"),Object.defineProperty(this.pine.line,"all",{get:()=>v.all});const E=new vp(this);this.bindContextObject(E,["any","new","param","copy","delete","set_left","set_right","set_top","set_bottom","set_lefttop","set_rightbottom","set_top_left_point","set_bottom_right_point","set_bgcolor","set_border_color","set_border_width","set_border_style","set_extend","set_xloc","set_text","set_text_color","set_text_size","set_text_halign","set_text_valign","set_text_wrap","set_text_font_family","set_text_formatting","get_left","get_right","get_top","get_bottom"],"box"),Object.defineProperty(this.pine.box,"all",{get:()=>E.all});const N=new Ap(this);this.bindContextObject(N,["any","new","param","set_color","get_line1","get_line2","delete"],"linefill"),Object.defineProperty(this.pine.linefill,"all",{get:()=>N.all});const O=new Lp(this);this.bindContextObject(O,["any","new","param","delete"],"polyline"),Object.defineProperty(this.pine.polyline,"all",{get:()=>O.all});const D=new Kp(this);this.bindContextObject(D,["any","new","param","cell","delete","clear","merge_cells","cell_set_text","cell_set_bgcolor","cell_set_text_color","cell_set_text_size","cell_set_height","cell_set_width","cell_set_tooltip","cell_set_text_halign","cell_set_text_valign","cell_set_text_font_family","set_position","set_bgcolor","set_border_color","set_border_width","set_frame_color","set_frame_width"],"table"),Object.defineProperty(this.pine.table,"all",{get:()=>D.all})}bindContextObject(e,i,r=""){r&&!this.pine[r]&&(this.pine[r]={});const s=r?this.pine[r]:this.pine;for(const a of i)typeof e[a]=="function"?s[a]=e[a].bind(e):s[a]=e[a]}init(e,i,r=0){let s;return i instanceof x?s=i.get(0):Array.isArray(i)?Array.isArray(i[0])?s=i[0]:s=i[i.length-1+r]:s=i,e?e instanceof x?(e.data[e.data.length-1]=s,e):Array.isArray(e)?(e[e.length-1]=s,new x(e)):new x([s]):new x([s])}initVar(e,i){if(e)return e;typeof i=="function"&&(i=i());let r;return i instanceof x?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 x([r])}precision(e,i=10){const r=i===10?Dt.PRECISION_EPSILON:10**i;return typeof e=="number"?Math.round(e*r)/r:e}param(e,i,r){return typeof e=="string"?e:e instanceof x?i?new x(e.data,e.offset+i):e:!Array.isArray(e)&&typeof e=="object"?e:(this.params[r]||(this.params[r]=[]),Array.isArray(e)?new x(e,i||0):(this.params[r].length===0?this.params[r].push(e):this.params[r][this.params[r].length-1]=e,new x(this.params[r],i||0)))}get(e,i){if(e instanceof x)return e.get(i);if(Array.isArray(e)){const r=e.length-1-i;return r<0||r>=e.length?NaN:e[r]}return e}set(e,i){if(e instanceof x){e.set(0,i);return}if(Array.isArray(e)){e.length>0?e[e.length-1]=i:e.push(i);return}}pushId(e){this._callStack.push(e)}popId(){this._callStack.pop()}peekId(){return this._callStack.length>0?this._callStack[this._callStack.length-1]:""}peekCtx(){const e=this.peekId();if(!e)return this;let i=this.lctx.get(e);return i||(i={id:e,let:{},const:{},var:{}},this.lctx.set(e,i)),i}call(e,i,...r){this.pushId(i);try{return e(...r)}finally{this.popId()}}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,fill:this.pine.fill,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(e,i){const r=`${e}->${i}`;Dt._deprecationWarningsShown.has(r)||(Dt._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;",e,i):console.warn(`\x1B[33m[WARNING] ${e} syntax is deprecated. Use ${i} instead. This will be removed in a future version.\x1B[0m`))}};$(mi,"_deprecationWarningsShown",new Set),$(mi,"PRECISION_EPSILON",10**10);let nr=mi;var Gp=Object.defineProperty,Yp=(t,e,i)=>e in t?Gp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ar=(t,e,i)=>Yp(t,typeof e!="symbol"?e+"":e,i);class or{constructor(e,i={}){ar(this,"source"),ar(this,"inputs"),this.source=e,this.inputs=i}}var Qp=Object.defineProperty,Xp=(t,e,i)=>e in t?Qp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ee=(t,e,i)=>Xp(t,typeof e!="symbol"?e+"":e,i);class ws{constructor(e,i,r,s,a,n){this.source=e,this.tickerId=i,this.timeframe=r,this.limit=s,this.sDate=a,this.eDate=n,ee(this,"data",[]),ee(this,"open",[]),ee(this,"high",[]),ee(this,"low",[]),ee(this,"close",[]),ee(this,"volume",[]),ee(this,"hl2",[]),ee(this,"hlc3",[]),ee(this,"ohlc4",[]),ee(this,"hlcc4",[]),ee(this,"openTime",[]),ee(this,"closeTime",[]),ee(this,"_readyPromise",null),ee(this,"_ready",!1),ee(this,"_debugSettings",{ln:!1,debug:!1}),ee(this,"_transpiledCode",null),ee(this,"_isSecondaryContext",!1),ee(this,"_syminfo"),this._readyPromise=new Promise(o=>{this.loadMarketData(e,i,r,s,a,n).then(l=>{const c=l;this.data=c;const h=c.map(N=>N.open),p=c.map(N=>N.close),u=c.map(N=>N.high),f=c.map(N=>N.low),m=c.map(N=>N.volume),y=c.map(N=>(N.high+N.low+N.close)/3),_=c.map(N=>(N.high+N.low)/2),b=c.map(N=>(N.high+N.low+N.open+N.close)/4),w=c.map(N=>(N.high+N.low+N.close+N.close)/4),v=c.map(N=>N.openTime),E=c.map(N=>N.closeTime);this.open=h,this.close=p,this.high=u,this.low=f,this.volume=m,this.hl2=_,this.hlc3=y,this.ohlc4=b,this.hlcc4=w,this.openTime=v,this.closeTime=E,e&&e.getSymbolInfo?e.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))})})}get transpiledCode(){return this._transpiledCode}markAsSecondary(){this._isSecondaryContext=!0}setDebugSettings({ln:e,debug:i}){this._debugSettings.ln=e,this._debugSettings.debug=i}async loadMarketData(e,i,r,s,a,n){return Array.isArray(e)?e:e.getMarketData(i,r,s,a,n)}async ready(){if(this._ready)return!0;if(!this._readyPromise)throw new Error("PineTS is not ready");return this._readyPromise}run(e,i,r){let s,a={};if(e instanceof or?(s=e.source,a=e.inputs||{}):s=e,r&&r>0){const n=typeof this.eDate>"u"&&!Array.isArray(this.source);return this._runPaginated(s,a,i,r,n)}else return this._runComplete(s,a,i)}stream(e,i={}){const{live:r=!0,interval:s=1e3}=i,a=i.pageSize||this.data.length;let n,o={};e instanceof or?(n=e.source,o=e.inputs||{}):n=e;const l={data:[],error:[]};let c=!1;const h=(f,...m)=>{l[f]&&l[f].forEach(y=>y(...m))},p=(f,m)=>{l[f]||(l[f]=[]),l[f].push(m)},u=()=>{c=!0};return(async()=>{try{const f=typeof this.eDate>"u"&&!Array.isArray(this.source)&&r,m=this._runPaginated(n,o,void 0,a,f);for await(const y of m){if(c)break;if(y===null){await new Promise(_=>setTimeout(_,s));continue}if(h("data",y),f&&!c){const _=y.marketData[y.idx];_&&_.closeTime<Date.now()||await new Promise(b=>setTimeout(b,s))}}}catch(f){h("error",f)}})(),{on:p,stop:u}}async _runComplete(e,i,r){await this.ready(),r||(r=this.data.length);const s=this._initializeContext(e,i,this._isSecondaryContext);return this._transpiledCode=this._transpileCode(e),await this._executeIterations(s,this._transpiledCode,this.data.length-r,this.data.length),s}async*_runPaginated(e,i,r,s,a=!1){await this.ready(),r||(r=this.data.length);const n=this._initializeContext(e,i,this._isSecondaryContext);this._transpiledCode=this._transpileCode(e);let o=this.data.length-r;for(;;){const l=this.data.length-o;if(l>0){const p=Math.min(l,s),u=this._getResultLength(n.result);await this._executeIterations(n,this._transpiledCode,o,o+p),o+=p,yield this._createPageContext(n,u);continue}if(!a||Array.isArray(this.source))break;const{newCandles:c,updatedLastCandle:h}=await this._updateMarketData();if(c===0&&!h){yield null;continue}this._removeLastResult(n),o=this.data.length-(c+1),n.pine.barstate.setLive()}}_getResultLength(e){if(Array.isArray(e))return e.length;if(typeof e=="object"&&e!==null){const i=Object.keys(e);if(i.length>0&&Array.isArray(e[i[0]]))return e[i[0]].length}return 0}_createPageContext(e,i){const r=new nr({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,fullContext:e,inputs:e.inputs});if(r.pineTSCode=e.pineTSCode,r.idx=e.idx,Array.isArray(e.result))r.result=e.result.slice(i);else if(typeof e.result=="object"&&e.result!==null){r.result={};for(let s in e.result)Array.isArray(e.result[s])?r.result[s]=e.result[s].slice(i):r.result[s]=e.result[s]}else r.result=e.result;return r.plots={...e.plots},r}async _updateMarketData(e){if(Array.isArray(this.source))return{newCandles:0,updatedLastCandle:!1};const i=this.source,r=this.data.length-1,s=this.data[r].openTime;try{const a=await i.getMarketData(this.tickerId,this.timeframe,void 0,s,e);if(!a||a.length===0)return{newCandles:0,updatedLastCandle:!1};let n=!1,o=0;for(let l=0;l<a.length;l++){const c=a[l];c.openTime===s?(this._replaceCandle(r,c),n=!0):c.openTime>s&&(this._appendCandle(c),o++)}return{newCandles:o,updatedLastCandle:n}}catch(a){return console.error("Error updating market data:",a),{newCandles:0,updatedLastCandle:!1}}}_replaceCandle(e,i){this.data[e]=i,this.open[e]=i.open,this.close[e]=i.close,this.high[e]=i.high,this.low[e]=i.low,this.volume[e]=i.volume,this.hl2[e]=(i.high+i.low)/2,this.hlc3[e]=(i.high+i.low+i.close)/3,this.ohlc4[e]=(i.high+i.low+i.open+i.close)/4,this.hlcc4[e]=(i.high+i.low+i.close+i.close)/4,this.openTime[e]=i.openTime,this.closeTime[e]=i.closeTime}_appendCandle(e){this.data.push(e),this.open.push(e.open),this.close.push(e.close),this.high.push(e.high),this.low.push(e.low),this.volume.push(e.volume),this.hl2.push((e.high+e.low)/2),this.hlc3.push((e.high+e.low+e.close)/3),this.ohlc4.push((e.high+e.low+e.open+e.close)/4),this.hlcc4.push((e.high+e.low+e.close+e.close)/4),this.openTime.push(e.openTime),this.closeTime.push(e.closeTime)}_removeLastResult(e){if(Array.isArray(e.result))e.result.pop();else if(typeof e.result=="object"&&e.result!==null)for(let s in e.result)Array.isArray(e.result[s])&&e.result[s].pop();e.data.close.data.pop(),e.data.open.data.pop(),e.data.high.data.pop(),e.data.low.data.pop(),e.data.volume.data.pop(),e.data.hl2.data.pop(),e.data.hlc3.data.pop(),e.data.ohlc4.data.pop(),e.data.hlcc4.data.pop(),e.data.openTime.data.pop(),e.data.closeTime&&e.data.closeTime.data.pop(),e.data.bar_index.data.pop();const i=["const","var","let","params"],r=s=>{for(let a of i)if(s[a])for(let n in s[a]){const o=s[a][n];o instanceof x?o.data.pop():Array.isArray(o)&&o.pop()}};r(e),e.lctx&&e.lctx.forEach(s=>r(s))}_initializeContext(e,i={},r=!1){const s=new nr({marketData:this.data,source:this.source,tickerId:this.tickerId,timeframe:this.timeframe,limit:this.limit,sDate:this.sDate,eDate:this.eDate,inputs:i});return s.pine.syminfo=this._syminfo,s.pineTSCode=e,s.isSecondaryContext=r,s.data.close=new x([]),s.data.open=new x([]),s.data.high=new x([]),s.data.low=new x([]),s.data.volume=new x([]),s.data.hl2=new x([]),s.data.hlc3=new x([]),s.data.ohlc4=new x([]),s.data.hlcc4=new x([]),s.data.openTime=new x([]),s.data.closeTime=new x([]),s.length=this.data.length,s}_transpileCode(e){return ua.bind(this)(e,this._debugSettings)}async _executeIterations(e,i,r,s){const a=["const","var","let","params"];for(let n=r;n<s;n++){e.idx=n,e.data.close.data.push(this.close[n]),e.data.open.data.push(this.open[n]),e.data.high.data.push(this.high[n]),e.data.low.data.push(this.low[n]),e.data.volume.data.push(this.volume[n]),e.data.hl2.data.push(this.hl2[n]),e.data.hlc3.data.push(this.hlc3[n]),e.data.ohlc4.data.push(this.ohlc4[n]),e.data.hlcc4.data.push(this.hlcc4[n]),e.data.openTime.data.push(this.openTime[n]),e.data.closeTime.data.push(this.closeTime[n]),e.data.bar_index.data.push(n);const o=await i(e);if(typeof o=="object"){typeof e.result!="object"&&(e.result={});for(let c in o){e.result[c]===void 0&&(e.result[c]=[]);let h;o[c]instanceof x?h=o[c].get(0):Array.isArray(o[c])?h=o[c][o[c].length-1]:h=o[c],e.result[c].push(h)}}else Array.isArray(e.result)||(e.result=[]),e.result.push(o);const l=c=>{for(let h of a)if(c[h])for(let p in c[h]){const u=c[h][p];if(u instanceof x){const f=u.get(0);u.data.push(f)}else if(Array.isArray(u)){const f=u[u.length-1];u.push(f)}}};l(e),e.lctx&&e.lctx.forEach(c=>l(c))}}}var Zp=Object.defineProperty,Jp=(t,e,i)=>e in t?Zp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,$t=(t,e,i)=>Jp(t,typeof e!="symbol"?e+"":e,i);const ri="https://api.binance.com/api/v3",lr="https://api.binance.us/api/v3",si={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 ef{constructor(e=300*1e3){$t(this,"cache"),$t(this,"cacheDuration"),this.cache=new Map,this.cacheDuration=e}generateKey(e){return Object.entries(e).filter(([i,r])=>r!==void 0).map(([i,r])=>`${i}:${r}`).join("|")}get(e){const i=this.generateKey(e),r=this.cache.get(i);return r?Date.now()-r.timestamp>this.cacheDuration?(this.cache.delete(i),null):r.data:null}set(e,i){const r=this.generateKey(e);this.cache.set(r,{data:i,timestamp:Date.now()})}clear(){this.cache.clear()}cleanup(){const e=Date.now();for(const[i,r]of this.cache.entries())e-r.timestamp>this.cacheDuration&&this.cache.delete(i)}}class tf{constructor(){$t(this,"cacheManager"),$t(this,"activeApiUrl",null),this.cacheManager=new ef(300*1e3)}async getBaseUrl(){if(this.activeApiUrl)return this.activeApiUrl;try{const e=new AbortController,i=setTimeout(()=>e.abort(),5e3),r=await fetch(`${ri}/ping`,{signal:e.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=ri,this.activeApiUrl}catch{}try{const e=new AbortController,i=setTimeout(()=>e.abort(),5e3),r=await fetch(`${lr}/ping`,{signal:e.signal});if(clearTimeout(i),r.ok)return this.activeApiUrl=lr,this.activeApiUrl}catch{}return ri}async getMarketDataInterval(e,i,r,s){try{const a=si[i.toUpperCase()];if(!a)return console.error(`Unsupported timeframe: ${i}`),[];const n={"1m":60*1e3,"3m":180*1e3,"5m":300*1e3,"15m":900*1e3,"30m":1800*1e3,"1h":3600*1e3,"2h":7200*1e3,"4h":14400*1e3,"1d":1440*60*1e3,"1w":10080*60*1e3,"1M":720*60*60*1e3};let o=[],l=r;const c=s,h=n[a];if(!h)return console.error(`Duration not defined for interval: ${a}`),[];for(;l<c;){const p=Math.min(l+1e3*h,c),u=await this.getMarketData(e,i,1e3,l,p);if(u.length===0)break;o=o.concat(u),l=u[u.length-1].closeTime+1}return o}catch(a){return console.error("Error in getMarketDataInterval:",a),[]}}async getMarketDataBackwards(e,i,r,s){let a=r,n=[],o=s,l=0;const c=Math.ceil(r/1e3)+5;for(;a>0&&l<c;){l++;const h=Math.min(a,1e3),p=await this.getMarketData(e,i,h,void 0,o);if(p.length===0||(n=p.concat(n),a-=p.length,o=p[0].openTime-1,p.length<h))break}return n}async getMarketData(e,i,r,s,a){try{const n=a!==void 0,o={tickerId:e,timeframe:i,limit:r,sDate:s,eDate:a};if(n){const u=this.cacheManager.get(o);if(u)return u}const l=si[i.toUpperCase()];if(!l)return console.error(`Unsupported timeframe: ${i}`),[];if(this.shouldPaginate(i,r,s,a)){if(s&&a){const u=await this.getMarketDataInterval(e,i,s,a),f=r?u.slice(0,r):u;return this.cacheManager.set(o,f),f}else if(r&&r>1e3){const u=await this.getMarketDataBackwards(e,i,r,a);return this.cacheManager.set(o,u),u}}let c=`${await this.getBaseUrl()}/klines?symbol=${e}&interval=${l}`;r&&(c+=`&limit=${Math.min(r,1e3)}`),s&&(c+=`&startTime=${s}`),a&&(c+=`&endTime=${a}`);const h=await fetch(c);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);const p=(await h.json()).map(u=>({openTime:parseInt(u[0]),open:parseFloat(u[1]),high:parseFloat(u[2]),low:parseFloat(u[3]),close:parseFloat(u[4]),volume:parseFloat(u[5]),closeTime:parseInt(u[6]),quoteAssetVolume:parseFloat(u[7]),numberOfTrades:parseInt(u[8]),takerBuyBaseAssetVolume:parseFloat(u[9]),takerBuyQuoteAssetVolume:parseFloat(u[10]),ignore:u[11]}));return n&&this.cacheManager.set(o,p),p}catch(n){return console.error("Error in binance.klines:",n),[]}}shouldPaginate(e,i,r,s){if(i&&i>1e3)return!0;if(r&&s){const a=si[e.toUpperCase()],n={"1m":60*1e3,"3m":180*1e3,"5m":300*1e3,"15m":900*1e3,"30m":1800*1e3,"1h":3600*1e3,"2h":7200*1e3,"4h":14400*1e3,"1d":1440*60*1e3,"1w":10080*60*1e3,"1M":720*60*60*1e3}[a];if(n)return Math.ceil((s-r)/n)>1e3}return!1}async getSymbolInfo(e){try{let i="crypto",r=await this.getBaseUrl(),s=e,a="";e.endsWith(".P")?(i="futures",s=e.replace(".P",""),r="https://fapi.binance.com/fapi/v1",a="Perpetual"):e.includes("_")&&(i="futures",s=e,r="https://dapi.binance.com/dapi/v1",a="Delivery");const n=i==="crypto"?`${r}/exchangeInfo?symbol=${s}`:`${r}/exchangeInfo`,o=await fetch(n);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const l=(await o.json()).symbols;if(!l||l.length===0)return console.error(`Symbol ${e} not found`),null;const c=i==="futures"?l.find(v=>v.symbol===s):l[0];if(!c)return console.error(`Symbol ${s} not found in exchange info`),null;const h=c.filters?.find(v=>v.filterType==="PRICE_FILTER"),p=c.filters?.find(v=>v.filterType==="LOT_SIZE"),u=h?parseFloat(h.tickSize):.01,f=p?parseFloat(p.minQty):0,m=Math.round(1/u),y=c.baseAsset,_=c.quoteAsset,b=a?` ${a}`:"",w=`${y} / ${_}${b}`;return{ticker:e,tickerid:`BINANCE:${e}`,prefix:"BINANCE",root:y,description:w,type:i,main_tickerid:`BINANCE:${e}`,current_contract:a,isin:"",basecurrency:y,currency:_,timezone:"Etc/UTC",country:"",mintick:u,pricescale:m,minmove:1,pointvalue:c.contractSize||1,mincontract:f,session:"24x7",volumetype:"base",expiration_date:c.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}}configure(e){}}class rf{async getMarketData(){return[]}}const sf=typeof process<"u"&&process.versions&&process.versions.node;let Wt=null;if(sf)try{Wt=new rf}catch{Wt=null}const nf={Binance:new tf,...Wt?{Mock:Wt}:{}};export{nr as Context,or as Indicator,ws as PineTS,nf as Provider};
|
|
138
138
|
//# sourceMappingURL=pinets.min.browser.es.js.map
|