/*jslint onevar: false, plusplus: false *//*

 JS Beautifier
---------------


  Written by Einar Lielmanis, <einar@jsbeautifier.org>
      http://jsbeautifier.org/

  Originally converted to javascript by Vital, <vital76@gmail.com>
  "End braces on own line" added by Chris J. Shull, <chrisjshull@gmail.com>

  You are free to use this in any way you want, in case you find this useful or working for you.

  Usage:
    js_beautify(js_source_text);
    js_beautify(js_source_text, options);

  The options are:
    indent_size (default 4)          — indentation size,
    indent_char (default space)      — character to indent with,
    preserve_newlines (default true) — whether existing line breaks should be preserved,
    preserve_max_newlines (default unlimited) - maximum number of line breaks to be preserved in one chunk,

    jslint_happy (default false) — if true, then jslint-stricter mode is enforced.

            jslint_happy   !jslint_happy
            ---------------------------------
             function ()      function()

    brace_style (default "collapse") - "collapse" | "expand" | "end-expand" | "expand-strict"
            put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line.

            expand-strict: put brace on own line even in such cases:

                var a =
                {
                    a: 5,
                    b: 6
                }
            This mode may break your scripts - e.g "return { a: 1 }" will be broken into two lines, so beware.

    space_before_conditional: should the space before conditional statement be added, "if(true)" vs "if (true)"

    e.g

    js_beautify(js_source_text, {
      'indent_size': 1,
      'indent_char': '\t'
    });


*///inside_using("qybase");
//qyboot.forbidLoadDefaultBase();
//using("wwliu_qiyun/qybase");
function js_beautify(e,t){function H(e){e=typeof e=="undefined"?!1:e;while(r.length&&(r[r.length-1]===" "||r[r.length-1]===c||r[r.length-1]===T||e&&(r[r.length-1]==="\n"||r[r.length-1]==="\r")))r.pop()}function B(e){return e.replace(/^\s\s*|\s\s*$/,"")}function j(){var e=M;M=!1,F(),M=e}function F(e){f.eat_next_space=!1;if(M&&W(f.mode))return;e=typeof e=="undefined"?!0:e,f.if_line=!1,H();if(!r.length)return;if(r[r.length-1]!=="\n"||!e)S=!0,r.push("\n");T&&r.push(T);for(var t=0;t<f.indentation_level;t+=1)r.push(c);f.var_line&&f.var_line_reindented&&r.push(c),f.case_body&&r.push(c)}function I(){if(s==="TK_COMMENT")return F(!0);if(f.eat_next_space){f.eat_next_space=!1;return}var e=" ";r.length&&(e=r[r.length-1]),e!==" "&&e!=="\n"&&e!==c&&r.push(" ")}function q(){S=!1,f.eat_next_space=!1,r.push(i)}function R(){f.indentation_level+=1}function U(){r.length&&r[r.length-1]===c&&r.pop()}function z(e){f&&l.push(f),f={previous_mode:f?f.mode:"BLOCK",mode:e,var_line:!1,var_line_tainted:!1,var_line_reindented:!1,in_html_comment:!1,if_line:!1,in_case:!1,case_body:!1,eat_next_space:!1,indentation_baseline:-1,indentation_level:f?f.indentation_level+(f.case_body?1:0)+(f.var_line&&f.var_line_reindented?1:0):0,ternary_depth:0}}function W(e){return e==="[EXPRESSION]"||e==="[INDENTED-EXPRESSION]"}function X(e){return e==="[EXPRESSION]"||e==="[INDENTED-EXPRESSION]"||e==="(EXPRESSION)"}function V(){w=f.mode==="DO_BLOCK",l.length>0&&(f=l.pop())}function $(e,t){for(var n=0;n<e.length;n++)if(B(e[n])[0]!=t)return!1;return!0}function J(e,t){for(var n=0;n<t.length;n+=1)if(t[n]===e)return!0;return!1}function K(e){var t=v,r=n.charAt(t);while(J(r,h)&&r!=e){t++;if(t>=P)return 0;r=n.charAt(t)}return r}function Q(){x=0;if(v>=P)return["","TK_EOF"];E=!1;var e=n.charAt(v);v+=1;var t=M&&W(f.mode);if(t){var i=0;while(J(e,h)){e==="\n"?(H(),r.push("\n"),S=!0,i=0):e==="	"?i+=4:e!=="\r"&&(i+=1);if(v>=P)return["","TK_EOF"];e=n.charAt(v),v+=1}f.indentation_baseline===-1&&(f.indentation_baseline=i);if(S){var u;for(u=0;u<f.indentation_level+1;u+=1)r.push(c);if(f.indentation_baseline!==-1)for(u=0;u<i-f.indentation_baseline;u++)r.push(" ")}}else{while(J(e,h)){e==="\n"&&(x+=A?x<=A?1:0:1);if(v>=P)return["","TK_EOF"];e=n.charAt(v),v+=1}if(L&&x>1)for(u=0;u<x;u+=1)F(u===0),S=!0;E=x>0}if(J(e,p)){if(v<P)while(J(n.charAt(v),p)){e+=n.charAt(v),v+=1;if(v===P)break}if(v===P||!e.match(/^[0-9]+[Ee]$/)||n.charAt(v)!=="-"&&n.charAt(v)!=="+")return e==="in"?[e,"TK_OPERATOR"]:(E&&s!=="TK_OPERATOR"&&s!=="TK_EQUALS"&&!f.if_line&&(L||o!=="var")&&F(),[e,"TK_WORD"]);var a=n.charAt(v);v+=1;var l=Q(v);return e+=a+l[0],[e,"TK_WORD"]}if(e==="("||e==="[")return[e,"TK_START_EXPR"];if(e===")"||e==="]")return[e,"TK_END_EXPR"];if(e==="{")return[e,"TK_START_BLOCK"];if(e==="}")return[e,"TK_END_BLOCK"];if(e===";")return[e,"TK_SEMICOLON"];if(e==="/"){var m="",y=!0;if(n.charAt(v)==="*"){v+=1;if(v<P)while((n.charAt(v)!=="*"||!n.charAt(v+1)||n.charAt(v+1)!=="/")&&v<P){e=n.charAt(v),m+=e;if(e==="\r"||e==="\n")y=!1;v+=1;if(v>=P)break}return v+=2,y&&x==0?["/*"+m+"*/","TK_INLINE_COMMENT"]:["/*"+m+"*/","TK_BLOCK_COMMENT"]}if(n.charAt(v)==="/"){m=e;while(n.charAt(v)!=="\r"&&n.charAt(v)!=="\n"){m+=n.charAt(v),v+=1;if(v>=P)break}return v+=1,E&&F(),[m,"TK_COMMENT"]}}if(e==="'"||e==='"'||e==="/"&&(s==="TK_WORD"&&J(o,["return","do","else"])||s==="TK_COMMENT"||s==="TK_START_EXPR"||s==="TK_START_BLOCK"||s==="TK_END_BLOCK"||s==="TK_OPERATOR"||s==="TK_EQUALS"||s==="TK_EOF"||s==="TK_SEMICOLON")){var b=e,w=!1,T=e;if(v<P)if(b==="/"){var N=!1;while(w||N||n.charAt(v)!==b){T+=n.charAt(v),w?w=!1:(w=n.charAt(v)==="\\",n.charAt(v)==="["?N=!0:n.charAt(v)==="]"&&(N=!1)),v+=1;if(v>=P)return[T,"TK_STRING"]}}else while(w||n.charAt(v)!==b){T+=n.charAt(v),w?w=!1:w=n.charAt(v)==="\\",v+=1;if(v>=P)return[T,"TK_STRING"]}v+=1,T+=b;if(b==="/")while(v<P&&J(n.charAt(v),p))T+=n.charAt(v),v+=1;return[T,"TK_STRING"]}if(e==="#"){if(r.length===0&&n.charAt(v)==="!"){T=e;while(v<P&&e!="\n")e=n.charAt(v),T+=e,v+=1;return r.push(B(T)+"\n"),F(),Q()}var C="#";if(v<P&&J(n.charAt(v),g)){do e=n.charAt(v),C+=e,v+=1;while(v<P&&e!=="#"&&e!=="=");return e!=="#"&&(n.charAt(v)==="["&&n.charAt(v+1)==="]"?(C+="[]",v+=2):n.charAt(v)==="{"&&n.charAt(v+1)==="}"&&(C+="{}",v+=2)),[C,"TK_WORD"]}}if(e==="<"&&n.substring(v-1,v+3)==="<!--"){v+=3,e="<!--";while(n[v]!="\n"&&v<P)e+=n[v],v++;return f.in_html_comment=!0,[e,"TK_COMMENT"]}if(e==="-"&&f.in_html_comment&&n.substring(v-1,v+2)==="-->")return f.in_html_comment=!1,v+=2,E&&F(),["-->","TK_COMMENT"];if(J(e,d)){while(v<P&&J(e+n.charAt(v),d)){e+=n.charAt(v),v+=1;if(v>=P)break}return e==="="?[e,"TK_EQUALS"]:[e,"TK_OPERATOR"]}return[e,"TK_UNKNOWN"]}var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T="";t=t?t:{};var N;t.space_after_anon_function!==undefined&&t.jslint_happy===undefined&&(t.jslint_happy=t.space_after_anon_function),t.braces_on_own_line!==undefined&&(N=t.braces_on_own_line?"expand":"collapse"),N=t.brace_style?t.brace_style:N?N:"collapse";var C=t.indent_size?t.indent_size:4,k=t.indent_char?t.indent_char:" ",L=typeof t.preserve_newlines=="undefined"?!0:t.preserve_newlines,A=typeof t.max_preserve_newlines=="undefined"?!1:t.max_preserve_newlines,O=t.jslint_happy==="undefined"?!1:t.jslint_happy,M=typeof t.keep_array_indentation=="undefined"?!1:t.keep_array_indentation,_=typeof t.space_before_conditional=="undefined"?!0:t.space_before_conditional,D=typeof t.indent_case=="undefined"?!1:t.indent_case;S=!1;var P=e.length;c="";while(C>0)c+=k,C-=1;while(e&&(e[0]===" "||e[0]==="	"))T+=e[0],e=e.substring(1);n=e,a="",s="TK_START_EXPR",o="",u="",r=[],w=!1,h="\n\r	 ".split(""),p="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$".split(""),g="0123456789".split(""),d="+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |= ::",d+=" <%= <% %> <?= <? ?>",d=d.split(" "),m="continue,try,throw,return,var,if,switch,case,default,for,while,break,function".split(","),l=[],z("BLOCK"),v=0;for(;;){var G=Q(v);i=G[0],b=G[1];if(b==="TK_EOF")break;switch(b){case"TK_START_EXPR":if(i==="["){if(s==="TK_WORD"||o===")"){J(o,m)&&I(),z("(EXPRESSION)"),q();break}f.mode==="[EXPRESSION]"||f.mode==="[INDENTED-EXPRESSION]"?u==="]"&&o===","?(f.mode==="[EXPRESSION]"&&(f.mode="[INDENTED-EXPRESSION]",M||R()),z("[EXPRESSION]"),M||F()):o==="["?(f.mode==="[EXPRESSION]"&&(f.mode="[INDENTED-EXPRESSION]",M||R()),z("[EXPRESSION]"),M||F()):z("[EXPRESSION]"):z("[EXPRESSION]")}else z("(EXPRESSION)");o===";"||s==="TK_START_BLOCK"?F():s==="TK_END_EXPR"||s==="TK_START_EXPR"||s==="TK_END_BLOCK"||o==="."?E&&F():s!=="TK_WORD"&&s!=="TK_OPERATOR"?I():a==="function"||a==="typeof"?O&&I():(J(o,m)||o==="catch")&&_&&I(),q();break;case"TK_END_EXPR":if(i==="]")if(M){if(o==="}"){U(),q(),V();break}}else if(f.mode==="[INDENTED-EXPRESSION]"&&o==="]"){V(),F(),q();break}V(),q();break;case"TK_START_BLOCK":a==="do"?z("DO_BLOCK"):z("BLOCK");if(N=="expand"||N=="expand-strict"){var Y=!1;N=="expand-strict"?(Y=K()=="}",Y||F(!0)):s!=="TK_OPERATOR"&&(o==="return"||o==="="||o==="throw"?I():F(!0)),q(),Y||R()}else s!=="TK_OPERATOR"&&s!=="TK_START_EXPR"?s==="TK_START_BLOCK"?F():I():W(f.previous_mode)&&o===","&&(u==="}"?I():F()),R(),q();break;case"TK_END_BLOCK":V(),N=="expand"||N=="expand-strict"?(o!=="{"&&F(),q()):(s==="TK_START_BLOCK"?S?U():H():W(f.mode)&&M?(M=!1,F(),M=!0):F(),q());break;case"TK_WORD":if(w){I(),q(),I(),w=!1;break}if(i==="function"){f.var_line&&(f.var_line_reindented=!0);if((S||o===";")&&o!=="{"&&s!="TK_BLOCK_COMMENT"&&s!="TK_COMMENT"){x=S?x:0,L||(x=1);for(var Z=0;Z<2-x;Z++)F(!1)}}if(i==="case"||i==="default"){o===":"||f.case_body?U():(D||f.indentation_level--,F(),D||f.indentation_level++),q(),f.in_case=!0,f.case_body=!1;break}y="NONE",s==="TK_END_BLOCK"?J(i.toLowerCase(),["else","catch","finally"])?N=="expand"||N=="end-expand"||N=="expand-strict"?y="NEWLINE":(y="SPACE",I()):y="NEWLINE":s!=="TK_SEMICOLON"||f.mode!=="BLOCK"&&f.mode!=="DO_BLOCK"?s==="TK_SEMICOLON"&&X(f.mode)?y="SPACE":s==="TK_STRING"?y="NEWLINE":s==="TK_WORD"?(o==="else"&&H(!0),y="SPACE"):s==="TK_START_BLOCK"?y="NEWLINE":s==="TK_END_EXPR"&&(I(),y="NEWLINE"):y="NEWLINE",J(i,m)&&o!==")"&&(o=="else"?y="SPACE":y="NEWLINE",i==="function"&&(o==="get"||o==="set")&&(y="SPACE")),f.if_line&&s==="TK_END_EXPR"&&(f.if_line=!1);if(J(i.toLowerCase(),["else","catch","finally"]))s!=="TK_END_BLOCK"||N=="expand"||N=="end-expand"||N=="expand-strict"?F():(H(!0),I());else if(y==="NEWLINE"){if(s!=="TK_START_EXPR"&&o!=="="&&o!==","||i!=="function")i==="function"&&o=="new"?I():o==="return"||o==="throw"?I():s!=="TK_END_EXPR"?(s!=="TK_START_EXPR"||i!=="var")&&o!==":"&&(i==="if"&&a==="else"&&o!=="{"?I():(f.var_line=!1,f.var_line_reindented=!1,F())):J(i,m)&&o!=")"&&(f.var_line=!1,f.var_line_reindented=!1,F())}else W(f.mode)&&o===","&&u==="}"?F():y==="SPACE"&&I();q(),a=i,i==="var"&&(f.var_line=!0,f.var_line_reindented=!1,f.var_line_tainted=!1),i==="if"&&(f.if_line=!0),i==="else"&&(f.if_line=!1);break;case"TK_SEMICOLON":q(),f.var_line=!1,f.var_line_reindented=!1,f.mode=="OBJECT"&&(f.mode="BLOCK");break;case"TK_STRING":s=="TK_STRING"||s==="TK_START_BLOCK"||s==="TK_END_BLOCK"||s==="TK_SEMICOLON"?F():s==="TK_WORD"&&I(),q();break;case"TK_EQUALS":f.var_line&&(f.var_line_tainted=!0),I(),q(),I();break;case"TK_OPERATOR":var et=!0,tt=!0;f.var_line&&i===","&&X(f.mode)&&(f.var_line_tainted=!1);if(f.var_line&&i===","){if(f.var_line_tainted){q(),f.var_line_reindented=!0,f.var_line_tainted=!1,F();break}f.var_line_tainted=!1}if(o==="return"||o==="throw"){I(),q();break}if(i===":"&&f.in_case){D&&(f.case_body=!0),q(),F(),f.in_case=!1;break}if(i==="::"){q();break}if(i===","){f.var_line?f.var_line_tainted?(q(),F(),f.var_line_tainted=!1):(q(),I()):s==="TK_END_BLOCK"&&f.mode!=="(EXPRESSION)"?(q(),f.mode==="OBJECT"&&o==="}"?F():I()):f.mode==="OBJECT"?(q(),F()):(q(),I());break}J(i,["--","++","!"])||J(i,["-","+"])&&(J(s,["TK_START_BLOCK","TK_START_EXPR","TK_EQUALS","TK_OPERATOR"])||J(o,m))?(et=!1,tt=!1,o===";"&&X(f.mode)&&(et=!0),s==="TK_WORD"&&J(o,m)&&(et=!0),f.mode==="BLOCK"&&(o==="{"||o===";")&&F()):i==="."?et=!1:i===":"?f.ternary_depth==0?(f.mode="OBJECT",et=!1):f.ternary_depth-=1:i==="?"&&(f.ternary_depth+=1),et&&I(),q(),tt&&I(),i==="!";break;case"TK_BLOCK_COMMENT":var nt=i.split(/\x0a|\x0d\x0a/);if($(nt.slice(1),"*")){F(),r.push(nt[0]);for(Z=1;Z<nt.length;Z++)F(),r.push(" "),r.push(B(nt[Z]))}else{nt.length>1?F():s==="TK_END_BLOCK"?F():I();for(Z=0;Z<nt.length;Z++)r.push(nt[Z]),r.push("\n")}K("\n")!="\n"&&F();break;case"TK_INLINE_COMMENT":I(),q(),X(f.mode)?I():j();break;case"TK_COMMENT":E?F():I(),q(),K("\n")!="\n"&&j();break;case"TK_UNKNOWN":(o==="return"||o==="throw")&&I(),q()}u=o,s=b,o=i}var rt=T+r.join("").replace(/[\n ]+$/,"");return rt}window.js_beautify=js_beautify;