define("ace/ext/emmet",["require","exports","module","ace/keyboard/hash_handler","ace/editor","ace/snippets","ace/range","ace/config"],function(e,t,n){function a(){}var r=e("ace/keyboard/hash_handler").HashHandler,i=e("ace/editor").Editor,s=e("ace/snippets").snippetManager,o=e("ace/range").Range,u;i.prototype.indexToPosition=function(e){return this.session.doc.indexToPosition(e)},i.prototype.positionToIndex=function(e){return this.session.doc.positionToIndex(e)},a.prototype={setupContext:function(e){this.ace=e,this.indentation=e.session.getTabString(),u||(u=window.emmet),u.require("resources").setVariable("indentation",this.indentation),this.$syntax=null,this.$syntax=this.getSyntax()},getSelectionRange:function(){var e=this.ace.getSelectionRange();return{start:this.ace.positionToIndex(e.start),end:this.ace.positionToIndex(e.end)}},createSelection:function(e,t){this.ace.selection.setRange({start:this.ace.indexToPosition(e),end:this.ace.indexToPosition(t)})},getCurrentLineRange:function(){var e=this.ace.getCursorPosition().row,t=this.ace.session.getLine(e).length,n=this.ace.positionToIndex({row:e,column:0});return{start:n,end:n+t}},getCaretPos:function(){var e=this.ace.getCursorPosition();return this.ace.positionToIndex(e)},setCaretPos:function(e){var t=this.ace.indexToPosition(e);this.ace.clearSelection(),this.ace.selection.moveCursorToPosition(t)},getCurrentLine:function(){var e=this.ace.getCursorPosition().row;return this.ace.session.getLine(e)},replaceContent:function(e,t,n,r){n==null&&(n=t==null?this.getContent().length:t),t==null&&(t=0);var i=this.ace,u=o.fromPoints(i.indexToPosition(t),i.indexToPosition(n));i.session.remove(u),u.end=u.start,e=this.$updateTabstops(e),s.insertSnippet(i,e)},getContent:function(){return this.ace.getValue()},getSyntax:function(){if(this.$syntax)return this.$syntax;var e=this.ace.session.$modeId.split("/").pop();if(e=="html"||e=="php"){var t=this.ace.getCursorPosition(),n=this.ace.session.getState(t.row);typeof n!="string"&&(n=n[0]),n&&(n=n.split("-"),n.length>1?e=n[0]:e=="php"&&(e="html"))}return e},getProfileName:function(){switch(this.getSyntax()){case"css":return"css";case"xml":case"xsl":return"xml";case"html":var e=u.require("resources").getVariable("profile");return e||(e=this.ace.session.getLines(0,2).join("").search(/]+XHTML/i)!=-1?"xhtml":"html"),e}return"xhtml"},prompt:function(e){return prompt(e)},getSelection:function(){return this.ace.session.getTextRange()},getFilePath:function(){return""},$updateTabstops:function(e){var t=1e3,n=0,r=null,i=u.require("range"),s=u.require("tabStops"),o=u.require("resources").getVocabulary("user"),a={tabstop:function(e){var o=parseInt(e.group,10),u=o===0;u?o=++n:o+=t;var f=e.placeholder;f&&(f=s.processText(f,a));var l="${"+o+(f?":"+f:"")+"}";return u&&(r=i.create(e.start,l)),l},escape:function(e){return e=="$"?"\\$":e=="\\"?"\\\\":e}};return e=s.processText(e,a),o.variables.insert_final_tabstop&&!/\$\{0\}$/.test(e)?e+="${0}":r&&(e=u.require("utils").replaceSubstring(e,"${0}",r)),e}};var f={expand_abbreviation:{mac:"ctrl+alt+e",win:"alt+e"},match_pair_outward:{mac:"ctrl+d",win:"ctrl+,"},match_pair_inward:{mac:"ctrl+j",win:"ctrl+shift+0"},matching_pair:{mac:"ctrl+alt+j",win:"alt+j"},next_edit_point:"alt+right",prev_edit_point:"alt+left",toggle_comment:{mac:"command+/",win:"ctrl+/"},split_join_tag:{mac:"shift+command+'",win:"shift+ctrl+`"},remove_tag:{mac:"command+'",win:"shift+ctrl+;"},evaluate_math_expression:{mac:"shift+command+y",win:"shift+ctrl+y"},increment_number_by_1:"ctrl+up",decrement_number_by_1:"ctrl+down",increment_number_by_01:"alt+up",decrement_number_by_01:"alt+down",increment_number_by_10:{mac:"alt+command+up",win:"shift+alt+up"},decrement_number_by_10:{mac:"alt+command+down",win:"shift+alt+down"},select_next_item:{mac:"shift+command+.",win:"shift+ctrl+."},select_previous_item:{mac:"shift+command+,",win:"shift+ctrl+,"},reflect_css_value:{mac:"shift+command+r",win:"shift+ctrl+r"},encode_decode_data_url:{mac:"shift+ctrl+d",win:"ctrl+'"},expand_abbreviation_with_tab:"Tab",wrap_with_abbreviation:{mac:"shift+ctrl+a",win:"shift+ctrl+a"}},l=new a;t.commands=new r,t.runEmmetCommand=function(e){l.setupContext(e);if(l.getSyntax()=="php")return!1;var t=u.require("actions");if(this.action=="expand_abbreviation_with_tab"&&!e.selection.isEmpty())return!1;if(this.action=="wrap_with_abbreviation")return setTimeout(function(){t.run("wrap_with_abbreviation",l)},0);try{var n=t.run(this.action,l)}catch(r){e._signal("changeStatus",typeof r=="string"?r:r.message),console.log(r)}return n};for(var c in f)t.commands.addCommand({name:"emmet:"+c,action:c,bindKey:f[c],exec:t.runEmmetCommand,multiSelectAction:"forEach"});var h=function(e,n){var r=n;if(!r)return;var i=r.session.$modeId,s=i&&/css|less|scss|sass|stylus|html|php/.test(i);e.enableEmmet===!1&&(s=!1),s?r.keyBinding.addKeyboardHandler(t.commands):r.keyBinding.removeKeyboardHandler(t.commands)};t.AceEmmetEditor=a,e("ace/config").defineOptions(i.prototype,"editor",{enableEmmet:{set:function(e){this[e?"on":"removeListener"]("changeMode",h),h({enableEmmet:!!e},this)},value:!0}}),t.setCore=function(e){u=e}}),define("ace/snippets",["require","exports","module","ace/lib/lang","ace/range","ace/keyboard/hash_handler","ace/tokenizer","ace/lib/dom"],function(t,n,r){var i=t("./lib/lang"),s=t("./range").Range,o=t("./keyboard/hash_handler").HashHandler,u=t("./tokenizer").Tokenizer,a=s.comparePoints,f=function(){this.snippetMap={},this.snippetNameMap={}};(function(){this.getTokenizer=function(){function e(e,t,n){return e=e.substr(1),/^\d+$/.test(e)&&!n.inFormatString?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function t(e){return"(?:[^\\\\"+e+"]|\\\\.)"}return f.$tokenizer=new u({start:[{regex:/:/,onMatch:function(e,t,n){return n.length&&n[0].expectIf?(n[0].expectIf=!1,n[0].elseBranch=n[0],[n[0]]):":"}},{regex:/\\./,onMatch:function(e,t,n){var r=e[1];return r=="}"&&n.length?e=r:"`$\\".indexOf(r)!=-1?e=r:n.inFormatString&&(r=="n"?e="\n":r=="t"?e="\n":"ulULE".indexOf(r)!=-1&&(e={changeCase:r,local:r>"a"})),[e]}},{regex:/}/,onMatch:function(e,t,n){return[n.length?n.shift():e]}},{regex:/\$(?:\d+|\w+)/,onMatch:e},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(t,n,r){var i=e(t.substr(1),n,r);return r.unshift(i[0]),i},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+t("\\|")+"*\\|",onMatch:function(e,t,n){n[0].choices=e.slice(1,-1).split(",")},next:"start"},{regex:"/("+t("/")+"+)/(?:("+t("/")+"*)/)(\\w*):?",onMatch:function(e,t,n){var r=n[0];return r.fmtString=e,e=this.splitRegex.exec(e),r.guard=e[1],r.fmt=e[2],r.flag=e[3],""},next:"start"},{regex:"`"+t("`")+"*`",onMatch:function(e,t,n){return n[0].code=e.splice(1,-1),""},next:"start"},{regex:"\\?",onMatch:function(e,t,n){n[0]&&(n[0].expectIf=!0)},next:"start"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:"/("+t("/")+"+)/",token:"regex"},{regex:"",onMatch:function(e,t,n){n.inFormatString=!0},next:"start"}]}),f.prototype.getTokenizer=function(){return f.$tokenizer},f.$tokenizer},this.tokenizeTmSnippet=function(e,t){return this.getTokenizer().getLineTokens(e,t).tokens.map(function(e){return e.value||e})},this.$getDefaultValue=function(t,n){if(/^[A-Z]\d+$/.test(n)){var r=n.substr(1);return(this.variables[n[0]+"__"]||{})[r]}if(/^\d+$/.test(n))return(this.variables.__||{})[n];n=n.replace(/^TM_/,"");if(!t)return;var i=t.session;switch(n){case"CURRENT_WORD":var s=i.getWordRange();case"SELECTION":case"SELECTED_TEXT":return i.getTextRange(s);case"CURRENT_LINE":return i.getLine(e.getCursorPosition().row);case"LINE_INDEX":return e.getCursorPosition().column;case"LINE_NUMBER":return e.getCursorPosition().row+1;case"SOFT_TABS":return i.getUseSoftTabs()?"YES":"NO";case"TAB_SIZE":return i.getTabSize();case"FILENAME":case"FILEPATH":return"ace.ajax.org";case"FULLNAME":return"Ace"}},this.variables={},this.getVariableValue=function(e,t){return this.variables.hasOwnProperty(t)?this.variables[t](e,t)||"":this.$getDefaultValue(e,t)||""},this.tmStrFormat=function(e,t,n){var r=t.flag||"",i=t.guard;i=new RegExp(i,r.replace(/[^gi]/,""));var s=this.tokenizeTmSnippet(t.fmt,"formatString"),o=this,u=e.replace(i,function(){o.variables.__=arguments;var e=o.resolveVariables(s,n),t="E";for(var r=0;r=0&&s.splice(o,1)}}var n=this.snippetMap,r=this.snippetNameMap;e.content?i(e):Array.isArray(e)&&e.forEach(i)},this.parseSnippetFile=function(e){e=e.replace(/\r/g,"");var t=[],n={},r=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm,i;while(i=r.exec(e)){if(i[1])try{n=JSON.parse(i[1]),t.push(n)}catch(s){}if(i[4])n.content=i[4].replace(/^\t/gm,""),t.push(n),n={};else{var o=i[2],u=i[3];if(o=="regex"){var a=/\/((?:[^\/\\]|\\.)*)|$/g;n.guard=a.exec(u)[1],n.trigger=a.exec(u)[1],n.endTrigger=a.exec(u)[1],n.endGuard=a.exec(u)[1]}else o=="snippet"?(n.tabTrigger=u.match(/^\S*/)[0],n.name||(n.name=u)):n[o]=u}}return t},this.getSnippetByName=function(e,t){var n=t&&this.$getScope(t),r=this.snippetNameMap,i;return[n,"_"].some(function(t){var n=r[t];return n&&(i=n[e]),!!i},this),i}}).call(f.prototype);var l=function(e){if(e.tabstopManager)return e.tabstopManager;e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=i.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)};(function(){this.attach=function(e){this.index=-1,this.ranges=[],this.tabstops=[],this.selectedTabstop=null,this.editor=e,this.editor.on("change",this.$onChange),this.editor.on("changeSelection",this.$onChangeSelection),this.editor.on("changeSession",this.$onChangeSession),this.editor.commands.on("afterExec",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges=null,this.tabstops=null,this.selectedTabstop=null,this.editor.removeListener("change",this.$onChange),this.editor.removeListener("changeSelection",this.$onChangeSelection),this.editor.removeListener("changeSession",this.$onChangeSession),this.editor.commands.removeListener("afterExec",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.editor=null},this.onChange=function(e){var t=e.data.range,n=e.data.action[0]=="r",r=t.start,i=t.end,s=r.row,o=i.row,u=o-s,f=i.column-r.column;n&&(u=-u,f=-f);if(!this.$inChange&&n){var l=this.selectedTabstop,c=!l.some(function(e){return a(e.start,r)<=0&&a(e.end,i)>=0});if(c)return this.detach()}var h=this.ranges;for(var p=0;p0){this.removeRange(d),p--;continue}d.start.row==s&&d.start.column>r.column&&(d.start.column+=f),d.end.row==s&&d.end.column>=r.column&&(d.end.column+=f),d.start.row>=s&&(d.start.row+=u),d.end.row>=s&&(d.end.row+=u),a(d.start,d.end)>0&&this.removeRange(d)}h.length||this.detach()},this.updateLinkedFields=function(){var e=this.selectedTabstop;if(!e.hasLinkedRanges)return;this.$inChange=!0;var t=this.editor.session,r=t.getTextRange(e.firstNonLinked);for(var i=e.length;i--;){var s=e[i];if(!s.linked)continue;var o=n.snippetManager.tmStrFormat(r,s.original);t.replace(s,o)}this.$inChange=!1},this.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},this.onChangeSelection=function(){if(!this.editor)return;var e=this.editor.selection.lead,t=this.editor.selection.anchor,n=this.editor.selection.isEmpty();for(var r=this.ranges.length;r--;){if(this.ranges[r].linked)continue;var i=this.ranges[r].contains(e.row,e.column),s=n||this.ranges[r].contains(t.row,t.column);if(i&&s)return}this.detach()},this.onChangeSession=function(){this.detach()},this.tabNext=function(e){var t=this.tabstops.length-1,n=this.index+(e||1);n=Math.min(Math.max(n,0),t),this.selectTabstop(n),n==t&&this.detach()},this.selectTabstop=function(e){var t=this.tabstops[this.index];t&&this.addTabstopMarkers(t),this.index=e,t=this.tabstops[this.index];if(!t||!t.length)return;this.selectedTabstop=t;if(!this.editor.inVirtualSelectionMode){var n=this.editor.multiSelect;n.toSingleRange(t.firstNonLinked.clone());for(var r=t.length;r--;){if(t.hasLinkedRanges&&t[r].linked)continue;n.addRange(t[r].clone(),!0)}}else this.editor.selection.setRange(t.firstNonLinked);this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.addTabstops=function(e,t,n){if(!e[0]){var r=s.fromPoints(n,n);h(r.start,t),h(r.end,t),e[0]=[r],e[0].index=0}var i=this.index,o=[i,0],u=this.ranges,a=this.editor;e.forEach(function(e){for(var n=e.length;n--;){var r=e[n],i=s.fromPoints(r.start,r.end||r.start);c(i.start,t),c(i.end,t),i.original=r,i.tabstop=e,u.push(i),e[n]=i,r.fmtString?(i.linked=!0,e.hasLinkedRanges=!0):e.firstNonLinked||(e.firstNonLinked=i)}e.firstNonLinked||(e.hasLinkedRanges=!1),o.push(e),this.addTabstopMarkers(e)},this),o.push(o.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,o)},this.addTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){e.markerId||(e.markerId=t.addMarker(e,"ace_snippet-marker","text"))})},this.removeTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){t.removeMarker(e.markerId),e.markerId=null})},this.removeRange=function(e){var t=e.tabstop.indexOf(e);e.tabstop.splice(t,1),t=this.ranges.indexOf(e),this.ranges.splice(t,1),this.editor.session.removeMarker(e.markerId)},this.keyboardHandler=new o,this.keyboardHandler.bindKeys({Tab:function(e){e.tabstopManager.tabNext(1)},"Shift-Tab":function(e){e.tabstopManager.tabNext(-1)},Esc:function(e){e.tabstopManager.detach()},Return:function(e){return!1}})}).call(l.prototype);var c=function(e,t){e.row==0&&(e.column+=t.column),e.row+=t.row},h=function(e,t){e.row==t.row&&(e.column-=t.column),e.row-=t.row};t("./lib/dom").importCssString(".ace_snippet-marker { -moz-box-sizing: border-box; box-sizing: border-box; background: rgba(194, 193, 208, 0.09); border: 1px dotted rgba(211, 208, 235, 0.62); position: absolute;}"),n.snippetManager=new f})