Files
BlueLotus_XSSReceiver/static/js/beautify.min.js

1 line
34 KiB
JavaScript
Raw Normal View History

(function(){function k(d,h){for(var e=0;e<h.length;e+=1)if(h[e]===d)return!0;return!1}function C(d,h){return(new O(d,h)).beautify()}function O(d,h){function N(a,b){var c=0;a&&(c=a.indentation_level,!l.just_added_newline()&&a.line_indent_level>c&&(c=a.line_indent_level));return{mode:b,parent:a,last_text:a?a.last_text:"",last_word:a?a.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,if_block:!1,else_block:!1,do_block:!1,do_while:!1,in_case_statement:!1,in_case:!1,case_body:!1,indentation_level:c,line_indent_level:a?a.line_indent_level:c,start_line_index:l.get_line_number(),ternary_depth:0}}function K(a){var c=a.newlines;if(g.keep_array_indentation&&b.mode===e.ArrayLiteral)for(d=0;d<c;d+=1)p(0<d);else if(g.max_preserve_newlines&&c>g.max_preserve_newlines&&(c=g.max_preserve_newlines),g.preserve_newlines&&1<a.newlines){p();for(var d=1;d<c;d+=1)p(!0)}f=a;w[f.type]()}function t(a){a=void 0===a?!1:a;l.just_added_newline()||(g.preserve_newlines&&f.wanted_newline||a?p(!1,!0):g.wrap_line_length&&l.current_line.get_character_count()+f.text.length+(l.space_before_token?1:0)>=g.wrap_line_length&&p(!1,!0))}function p(c,d){if(!d&&";"!==b.last_text&&","!==b.last_text&&"\x3d"!==b.last_text&&"TK_OPERATOR"!==a)for(;b.mode===e.Statement&&!b.if_block&&!b.do_block;)y();l.add_new_line(c)&&(b.multiline_frame=!0)}function C(){l.just_added_newline()&&(g.keep_array_indentation&&b.mode===e.ArrayLiteral&&f.wanted_newline?(l.current_line.push(f.whitespace_before),l.space_before_token=!1):l.set_indent(b.indentation_level)&&(b.line_indent_level=b.indentation_level))}function r(b){l.raw?l.add_raw_token(f):(g.comma_first&&"TK_COMMA"===a&&l.just_added_newline()&&","===l.previous_line.last()&&(l.previous_line.pop(),C(),l.add_token(","),l.space_before_token=!0),b=b||f.text,C(),l.add_token(b))}function A(a){b?(c.push(b),m=b):m=N(null,a);b=N(m,a)}function F(a){return k(a,[e.Expression,e.ForInitializer,e.Conditional])}function y(){0<c.length&&(m=b,b=c.pop(),m.mode===e.Statement&&l.remove_redundant_indentation(m))}function H(){return b.parent.mode===e.ObjectLiteral&&b.mode===e.Statement&&(":"===b.last_text&&0===b.ternary_depth||"TK_RESERVED"===a&&k(b.last_text,["get","set"]))}function B(){return"TK_RESERVED"===a&&k(b.last_text,["var","let","const"])&&"TK_WORD"===f.type||"TK_RESERVED"===a&&"do"===b.last_text||"TK_RESERVED"===a&&"return"===b.last_text&&!f.wanted_newline||"TK_RESERVED"===a&&"else"===b.last_text&&("TK_RESERVED"!==f.type||"if"!==f.text)||"TK_END_EXPR"===a&&(m.mode===e.ForInitializer||m.mode===e.Conditional)||"TK_WORD"===a&&b.mode===e.BlockStatement&&!b.in_case&&"--"!==f.text&&"++"!==f.text&&"function"!==q&&"TK_WORD"!==f.type&&"TK_RESERVED"!==f.type||b.mode===e.ObjectLiteral&&(":"===b.last_text&&0===b.ternary_depth||"TK_RESERVED"===a&&k(b.last_text,["get","set"]))?(A(e.Statement),b.indentation_level+=1,"TK_RESERVED"===a&&k(b.last_text,["var","let","const"])&&"TK_WORD"===f.type&&(b.declaration_statement=!0),H()||t("TK_RESERVED"===f.type&&k(f.text,["do","for","if","while"])),!0):!1}function I(a){return k(a,"case return do if throw else".split(" "))}function G(a){a=D+(a||0);return 0>a||a>=E.length?null:E[a]}function L(){"TK_RESERVED"===f.type&&b.mode!==e.ObjectLiteral&&k(f.text,["set","get"])&&(f.type="TK_WORD");"TK_RESERVED"===f.type&&b.mode===e.ObjectLiteral&&":"==G(1).text&&(f.type="TK_WORD");B()||!f.wanted_newline||F(b.mode)||"TK_OPERATOR"===a&&"--"!==b.last_text&&"++"!==b.last_text||"TK_EQUALS"===a||!g.preserve_newlines&&"TK_RESERVED"===a&&k(b.last_text,["var","let","const","set","get"])||p();if(b.do_block&&!b.do_while){if("TK_RESERVED"===f.type&&"while"===f.text){l.space_before_token=!0;r();l.space_before_token=!0;b.do_while=!0;return}p();b.do_block=!1}if(b.if_block)if(b.else_block||"TK_RESERVED"!==f.type||"else"!==f.text){for(;b.mode===e.Statement;)y();b.if_block=!1;b.else_block=!1}else b.else_block=!0;if("TK_RESERVED"===f.type&&("case"===f.text||"default"===f.text&&b.in_case_statement)){p();if(b.case_body||g.jslint_happy)0<b.indentation_level&&(!b.parent||b.indentation_level>b.parent.indentation_level)&&--b.inde