1 line
72 KiB
JavaScript
1 line
72 KiB
JavaScript
|
!function(){var t=function(u){var i={};function n(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return u[t].call(e.exports,e,e.exports,n),e.l=!0,e.exports}return n.m=u,n.c=i,n.d=function(t,e,u){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:u})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var u=Object.create(null);if(n.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(u,i,function(t){return e[t]}.bind(null,i));return u},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,u){"use strict";var i=u(1).Beautifier,n=u(5).Options;t.exports=function(t,e){return new i(t,e).beautify()},t.exports.defaultOptions=function(){return new n}},function(t,e,u){"use strict";var i=u(2).Output,n=u(3).Token,o=u(4),_=u(5).Options,s=u(7).Tokenizer,p=u(7).line_starters,l=u(7).positionable_operators,f=u(7).TOKEN;function c(t,e){return-1!==e.indexOf(t)}function a(t,e){return t&&t.type===f.RESERVED&&t.text===e}function d(t,e){return t&&t.type===f.RESERVED&&c(t.text,e)}var b=["case","return","do","if","throw","else","await","break","continue","async"],g=function(t){for(var e={},u=0;u<t.length;u++)e[t[u].replace(/-/g,"_")]=t[u];return e}(["before-newline","after-newline","preserve-newline"]),k=[g.before_newline,g.preserve_newline],m="BlockStatement",w="Statement",r="ObjectLiteral",h="ArrayLiteral",y="ForInitializer",x="Conditional",v="Expression";function E(t,e){e.multiline_frame||e.mode===y||e.mode===x||t.remove_indent(e.start_line_index)}function R(t){return t===h}function O(t){return c(t,[v,y,x])}function T(t,e){e=e||{},this._source_text=t||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new _(e)}T.prototype.create_flags=function(t,e){var u=0;return t&&(u=t.indentation_level,!this._output.just_added_newline()&&t.line_indent_level>u&&(u=t.line_indent_level)),{mode:e,parent:t,last_token:t?t.last_token:new n(f.START_BLOCK,""),last_word:t?t.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,indentation_level:u,alignment:0,line_indent_level:t?t.line_indent_level:u,start_line_index:this._output.get_line_number(),ternary_depth:0}},T.prototype._reset=function(t){var e=t.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new i(this._options,e),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(m);var u=new s(t,this._options);return this._tokens=u.tokenize(),t},T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._reset(this._source_text),e=this._options.eol;"auto"===this._options.eol&&(e="\n",t&&o.lineBreak.test(t||"")&&(e=t.match(o.lineBreak)[0]));for(var u=this._tokens.next();u;)this.handle_token(u),this._last_last_text=this._flags.last_token.text,this._flags.last_token=u,u=this._tokens.next();return this._output.get_code(e)},T.prototype.handle_token=function(t,e){t.type===f.START_EXPR?this.handle_start_expr(t):t.type===f.END_EXPR?this.handle_end_expr(t):t.type===f.START_BLOCK?this.handle_start_block(t):t.type===f.END_BLOCK?this.handle_end_block(t):t.type===f.WORD?this.handle_word(t):t.type===f.RESERVED?this.handle_word(t):t.type===f.SEMICOLON?this.handle_semicolon(t):t.type===f.STRING?this.handle_string(t):t.type===f.EQUALS?this.handle_equals(t):t.type===f.OPERATOR?this.handle_operator(t):t.type===f.COMMA?this.handle_comma(t):t.type===f.BLOCK_COMMENT?this.handle_block_comment(t,e):t.type===f.COMMENT?this.handle_comment(t,e):t.type===f.DOT?this.handle_dot(t):t.type
|