4 lines
4.3 KiB
JavaScript
4 lines
4.3 KiB
JavaScript
|
(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[28134],{28134:function(C,G,F){C=F.nmd(C),ace.define("ace/ext/beautify",["require","exports","module","ace/token_iterator"],function(S,c,H){"use strict";var K=S("../token_iterator").TokenIterator;function f(m,v){return m.type.lastIndexOf(v+".xml")>-1}c.singletonTags=["area","base","br","col","command","embed","hr","html","img","input","keygen","link","meta","param","source","track","wbr"],c.blockTags=["article","aside","blockquote","body","div","dl","fieldset","footer","form","head","header","html","nav","ol","p","script","section","style","table","tbody","tfoot","thead","ul"],c.formatOptions={lineBreaksAfterCommasInCurlyBlock:!0},c.beautify=function(m){for(var v=new K(m,0,0),t=v.getCurrentToken(),V=m.getTabString(),j=c.singletonTags,D=c.blockTags,z=c.formatOptions||{},s,p=!1,n=!1,h=!1,a="",e="",q="",r=0,_=0,L=0,u=0,d=0,b=0,A=0,B,x=0,i=0,E=[],J=!1,l,w=!1,R=!1,I=!1,g=!1,N={0:0},y=[],O=!1,k=function(){s&&s.value&&s.type!=="string.regexp"&&(s.value=s.value.replace(/^\s*/,""))},$=function(){for(var T=a.length-1;!(T==0||a[T]!==" ");)T=T-1;a=a.slice(0,T+1)},o=function(){a=a.trimRight(),p=!1};t!==null;){if(x=v.getCurrentTokenRow(),E=v.$rowTokens,s=v.stepForward(),typeof t!="undefined"){if(e=t.value,d=0,I=q==="style"||m.$modeId==="ace/mode/css",f(t,"tag-open")?(R=!0,s&&(g=D.indexOf(s.value)!==-1),e==="</"&&(g&&!p&&i<1&&i++,I&&(i=1),d=1,g=!1)):f(t,"tag-close")?R=!1:f(t,"comment.start")?g=!0:f(t,"comment.end")&&(g=!1),!R&&!i&&t.type==="paren.rparen"&&t.value.substr(0,1)==="}"&&i++,x!==B&&(i=x,B&&(i-=B)),i){for(o();i>0;i--)a+=`
|
||
|
`;p=!0,!f(t,"comment")&&!t.type.match(/^(comment|string)$/)&&(e=e.trimLeft())}if(e){if(t.type==="keyword"&&e.match(/^(if|else|elseif|for|foreach|while|switch)$/)?(y[r]=e,k(),h=!0,e.match(/^(else|elseif)$/)&&a.match(/\}[\s]*$/)&&(o(),n=!0)):t.type==="paren.lparen"?(k(),e.substr(-1)==="{"&&(h=!0,w=!1,R||(i=1)),e.substr(0,1)==="{"&&(n=!0,a.substr(-1)!=="["&&a.trimRight().substr(-1)==="["?(o(),n=!1):a.trimRight().substr(-1)===")"?o():$())):t.type==="paren.rparen"?(d=1,e.substr(0,1)==="}"&&(y[r-1]==="case"&&d++,a.trimRight().substr(-1)==="{"?o():(n=!0,I&&(i+=2))),e.substr(0,1)==="]"&&a.substr(-1)!=="}"&&a.trimRight().substr(-1)==="}"&&(n=!1,u++,o()),e.substr(0,1)===")"&&a.substr(-1)!=="("&&a.trimRight().substr(-1)==="("&&(n=!1,u++,o()),$()):(t.type==="keyword.operator"||t.type==="keyword")&&e.match(/^(=|==|===|!=|!==|&&|\|\||and|or|xor|\+=|.=|>|>=|<|<=|=>)$/)?(o(),k(),n=!0,h=!0):t.type==="punctuation.operator"&&e===";"?(o(),k(),h=!0,I&&i++):t.type==="punctuation.operator"&&e.match(/^(:|,)$/)?(o(),k(),e.match(/^(,)$/)&&A>0&&b===0&&z.lineBreaksAfterCommasInCurlyBlock?i++:(h=!0,p=!1)):t.type==="support.php_tag"&&e==="?>"&&!p?(o(),n=!0):f(t,"attribute-name")&&a.substr(-1).match(/^\s$/)?n=!0:f(t,"attribute-equals")?($(),k()):f(t,"tag-close")?($(),e==="/>"&&(n=!0)):t.type==="keyword"&&e.match(/^(case|default)$/)&&O&&(d=1),p&&!(t.type.match(/^(comment)$/)&&!e.substr(0,1).match(/^[/#]$/))&&!(t.type.match(/^(string)$/)&&!e.substr(0,1).match(/^['"@]$/))){if(u=L,r>_)for(u++,l=r;l>_;l--)N[l]=u;else r<_&&(u=N[r]);for(_=r,L=u,d&&(u-=d),w&&!b&&(u++,w=!1),l=0;l<u;l++)a+=V}if(t.type==="keyword"&&e.match(/^(case|default)$/)?O===!1&&(y[r]=e,r++,O=!0):t.type==="keyword"&&e.match(/^(break)$/)&&y[r-1]&&y[r-1].match(/^(case|default)$/)&&(r--,O=!1),t.type==="paren.lparen"&&(b+=(e.match(/\(/g)||[]).length,A+=(e.match(/\{/g)||[]).length,r+=e.length),t.type==="keyword"&&e.match(/^(if|else|elseif|for|while)$/)?(w=!0,b=0):!b&&e.trim()&&t.type!=="comment"&&(w=!1),t.type==="paren.rparen")for(b-=(e.match(/\)/g)||[]).length,A-=(e.match(/\}/g)||[]).length,l=0;l<e.length;l++)r--,e.substr(l,1)==="}"&&y[r]==="case"&&r--;t.type=="text"&&(e=e.replace(/\s+$/," ")),n&&!p&&($(),a.substr(-1)!==`
|
||
|
`&&(a+=" ")),a+=e,h&&(a+=" "),p=!1,n=!1,h=!1,(f(t,"tag-close")&&(g||D.indexOf(q)!==-1)||f(t,"doctype")&&e===">")&&(g&&s&&s.value==="</"?i=-1:i=1),s&&j.indexOf(s.value)===-1&&(f(t,"tag-open")&&e==="</"?r--:f(t,"tag-open")&&e==="<"?r++:f(t,"tag-close")&&e==="/>"&&r--),f(t,"tag-name")&&(q=e),B=x}}t=s}a=a.trim(),m.doc.setValue(a)},c.commands=[{name:"beautify",description:"Format selection (Beautify)",exec:function(m){c.beautify(m.session)},bindKey:"Ctrl-Shift-B"}]}),function(){ace.require(["ace/ext/beautify"],function(S){C&&(C.exports=S)})}()}}]);
|