Files
leanote/public/libs/ace/ck/ext-emmet-min.js
2015-03-31 14:27:26 +08:00

1 line
20 KiB
JavaScript

ace.define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/anchor","ace/keyboard/hash_handler","ace/tokenizer","ace/lib/dom","ace/editor"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./lib/event_emitter").EventEmitter,s=e("./lib/lang"),a=e("./range").Range,o=e("./anchor").Anchor,c=e("./keyboard/hash_handler").HashHandler,h=e("./tokenizer").Tokenizer,p=a.comparePoints,u=function(){this.snippetMap={},this.snippetNameMap={}};(function(){i.implement(this,r),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 u.$tokenizer=new h({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 i=e[1];return"}"==i&&n.length?e=i:-1!="`$\\".indexOf(i)?e=i:n.inFormatString&&("n"==i?e="\n":"t"==i?e="\n":-1!="ulULE".indexOf(i)&&(e={changeCase:i,local:i>"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,i){var r=e(t.substr(1),n,i);return i.unshift(r[0]),r},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 i=n[0];return i.fmtString=e,e=this.splitRegex.exec(e),i.guard=e[1],i.fmt=e[2],i.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"}]}),u.prototype.getTokenizer=function(){return u.$tokenizer},u.$tokenizer},this.tokenizeTmSnippet=function(e,t){return this.getTokenizer().getLineTokens(e,t).tokens.map(function(e){return e.value||e})},this.$getDefaultValue=function(e,t){if(/^[A-Z]\d+$/.test(t)){var n=t.substr(1);return(this.variables[t[0]+"__"]||{})[n]}if(/^\d+$/.test(t))return(this.variables.__||{})[t];if(t=t.replace(/^TM_/,""),e){var i=e.session;switch(t){case"CURRENT_WORD":var r=i.getWordRange();case"SELECTION":case"SELECTED_TEXT":return i.getTextRange(r);case"CURRENT_LINE":return i.getLine(e.getCursorPosition().row);case"PREV_LINE":return i.getLine(e.getCursorPosition().row-1);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"";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 i=t.flag||"",r=t.guard;r=new RegExp(r,i.replace(/[^gi]/,""));var s=this.tokenizeTmSnippet(t.fmt,"formatString"),a=this,o=e.replace(r,function(){a.variables.__=arguments;for(var e=a.resolveVariables(s,n),t="E",i=0;i<e.length;i++){var r=e[i];if("object"==typeof r)if(e[i]="",r.changeCase&&r.local){var o=e[i+1];o&&"string"==typeof o&&(e[i]="u"==r.changeCase?o[0].toUpperCase():o[0].toLowerCase(),e[i+1]=o.substr(1))}else r.changeCase&&(t=r.changeCase);else"U"==t?e[i]=r.toUpperCase():"L"==t&&(e[i]=r.toLowerCase())}return e.join("")});return this.variables.__=null,o},this.resolveVariables=function(e,t){function n(t){var n=e.indexOf(t,r+1);-1!=n&&(r=n)}for(var i=[],r=0;r<e.length;r++){var s=e[r];if("string"==typeof s)i.push(s);else{if("object"!=typeof s)continue;if(s.skip)n(s);else{if(s.processed<r)continue;if(s.text){var a=this.getVariableValue(t,s.text);a&&s.fmtString&&(a=this.tmStrFormat(a,s)),s.processed=r,null==s.expectIf?a&&(i.push(a),n(s)):a?s.skip=s.elseBranch:n(s)}else null!=s.tabstopId?i.push(s):null!=s.changeCase&&i.push(s)}}}return i},this.insertSnippetForSelection=function(e,t){function n(e){for(var t=[],n=0;n<e.length;n++){var i=e[n];if("object"==typeof i){if(h[i.tabstopId])continue;var r=e.lastIndexOf(i,n-1);i=t[r]||{tabstopId:i.tabstopId}}t[n]=i}return t}var i=e.getCursorPosition(),r=e.session.getLine(i.row),s=e.session.getTabString(),a=r.match(/^\s*/)[0];i.column<a.length&&(a=a.slice(0,i.column));var o=this.tokenizeTmSnippet(t);o=this.resolveVariables(o,e),o=o.map(function(e){return"\n"==e?e+a:"string"==typeof e?e.replace(/\t/g,s):e});var c=[];o.forEach(function(e,t){if("object"==typeof e){var n=e.tabstopId,i=c[n];if(i||(i=c[n]=[],i.index=n,i.value=""),-1===i.indexOf(e)){i.push(e);var r=o.indexOf(e,t+1);if(-1!==r){var s=o.slice(t+1,r),a=s.some(function(e){return"object"==typeof e});a&&!i.value?i.value=s:s.length&&(!i.value||"string"!=typeof i.value)&&(i.value=s.join(""))}}}}),c.forEach(function(e){e.length=0});for(var h={},p=0;p<o.length;p++){var u=o[p];if("object"==typeof u){var d=u.tabstopId,g=o.indexOf(u,p+1);if(h[d])h[d]===u&&(h[d]=null);else{var f=c[d],m="string"==typeof f.value?[f.value]:n(f.value);m.unshift(p+1,Math.max(0,g-p)),m.push(u),h[d]=u,o.splice.apply(o,m),-1===f.indexOf(u)&&f.push(u)}}}var b=0,v=0,x="";o.forEach(function(e){"string"==typeof e?("\n"===e[0]?(v=e.length-1,b++):v+=e.length,x+=e):e.start?e.end={row:b,column:v}:e.start={row:b,column:v}});var S=e.getSelectionRange(),_=e.session.replace(S,x),T=new l(e),w=e.inVirtualSelectionMode&&e.selection.index;T.addTabstops(c,S.start,_,w)},this.insertSnippet=function(e,t){var n=this;return e.inVirtualSelectionMode?n.insertSnippetForSelection(e,t):(e.forEachSelection(function(){n.insertSnippetForSelection(e,t)},null,{keepOrder:!0}),void(e.tabstopManager&&e.tabstopManager.tabNext()))},this.$getScope=function(e){var t=e.session.$mode.$id||"";if(t=t.split("/").pop(),"html"===t||"php"===t){"php"===t&&!e.session.$mode.inlinePhp&&(t="html");var n=e.getCursorPosition(),i=e.session.getState(n.row);"object"==typeof i&&(i=i[0]),i.substring&&("js-"==i.substring(0,3)?t="javascript":"css-"==i.substring(0,4)?t="css":"php-"==i.substring(0,4)&&(t="php"))}return t},this.getActiveScopes=function(e){var t=this.$getScope(e),n=[t],i=this.snippetMap;return i[t]&&i[t].includeScopes&&n.push.apply(n,i[t].includeScopes),n.push("_"),n},this.expandWithTab=function(e,t){var n=this,i=e.forEachSelection(function(){return n.expandSnippetForSelection(e,t)},null,{keepOrder:!0});return i&&e.tabstopManager&&e.tabstopManager.tabNext(),i},this.expandSnippetForSelection=function(e,t){var n=e.getCursorPosition(),i=e.session.getLine(n.row),r=i.substring(0,n.column),s=i.substr(n.column),a=this.snippetMap,o;return this.getActiveScopes(e).some(function(e){var t=a[e];return t&&(o=this.findMatchingSnippet(t,r,s)),!!o},this),o?t&&t.dryRun?!0:(e.session.doc.removeInLine(n.row,n.column-o.replaceBefore.length,n.column+o.replaceAfter.length),this.variables.M__=o.matchBefore,this.variables.T__=o.matchAfter,this.insertSnippetForSelection(e,o.content),this.variables.M__=this.variables.T__=null,!0):!1},this.findMatchingSnippet=function(e,t,n){for(var i=e.length;i--;){var r=e[i];if(!(r.startRe&&!r.startRe.test(t)||r.endRe&&!r.endRe.test(n)||!r.startRe&&!r.endRe))return r.matchBefore=r.startRe?r.startRe.exec(t):[""],r.matchAfter=r.endRe?r.endRe.exec(n):[""],r.replaceBefore=r.triggerRe?r.triggerRe.exec(t)[0]:"",r.replaceAfter=r.endTriggerRe?r.endTriggerRe.exec(n)[0]:"",r}},this.snippetMap={},this.snippetNameMap={},this.register=function(e,t){function n(e){return e&&!/^\^?\(.*\)\$?$|^\\b$/.test(e)&&(e="(?:"+e+")"),e||""}function i(e,t,i){return e=n(e),t=n(t),i?(e=t+e,e&&"$"!=e[e.length-1]&&(e+="$")):(e+=t,e&&"^"!=e[0]&&(e="^"+e)),new RegExp(e)}function r(e){e.scope||(e.scope=t||"_"),t=e.scope,a[t]||(a[t]=[],o[t]={});var n=o[t];if(e.name){var r=n[e.name];r&&c.unregister(r),n[e.name]=e}a[t].push(e),e.tabTrigger&&!e.trigger&&(!e.guard&&/^\w/.test(e.tabTrigger)&&(e.guard="\\b"),e.trigger=s.escapeRegExp(e.tabTrigger)),e.startRe=i(e.trigger,e.guard,!0),e.triggerRe=new RegExp(e.trigger,"",!0),e.endRe=i(e.endTrigger,e.endGuard,!0),e.endTriggerRe=new RegExp(e.endTrigger,"",!0)}var a=this.snippetMap,o=this.snippetNameMap,c=this;e||(e=[]),e&&e.content?r(e):Array.isArray(e)&&e.forEach(r),this._signal("registerSnippets",{scope:t})},this.unregister=function(e,t){function n(e){var n=r[e.scope||t];if(n&&n[e.name]){delete n[e.name];var s=i[e.scope||t],a=s&&s.indexOf(e);a>=0&&s.splice(a,1)}}var i=this.snippetMap,r=this.snippetNameMap;e.content?n(e):Array.isArray(e)&&e.forEach(n)},this.parseSnippetFile=function(e){e=e.replace(/\r/g,"");for(var t=[],n={},i=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm,r;r=i.exec(e);){if(r[1])try{n=JSON.parse(r[1]),t.push(n)}catch(s){}if(r[4])n.content=r[4].replace(/^\t/gm,""),t.push(n),n={};else{var a=r[2],o=r[3];if("regex"==a){var c=/\/((?:[^\/\\]|\\.)*)|$/g;n.guard=c.exec(o)[1],n.trigger=c.exec(o)[1],n.endTrigger=c.exec(o)[1],n.endGuard=c.exec(o)[1]}else"snippet"==a?(n.tabTrigger=o.match(/^\S*/)[0],n.name||(n.name=o)):n[a]=o}}return t},this.getSnippetByName=function(e,t){var n=this.snippetNameMap,i;return this.getActiveScopes(t).some(function(t){var r=n[t];return r&&(i=r[e]),!!i},this),i}}).call(u.prototype);var l=function(e){return e.tabstopManager?e.tabstopManager:(e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=s.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e),void 0)};(function(){this.attach=function(e){this.index=0,this.ranges=[],this.tabstops=[],this.$openTabstops=null,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="r"==e.data.action[0],i=t.start,r=t.end,s=i.row,a=r.row,o=a-s,c=r.column-i.column;if(n&&(o=-o,c=-c),!this.$inChange&&n){var h=this.selectedTabstop,u=h&&!h.some(function(e){return p(e.start,i)<=0&&p(e.end,r)>=0});if(u)return this.detach()}for(var l=this.ranges,d=0;d<l.length;d++){var g=l[d];g.end.row<i.row||(n&&p(i,g.start)<0&&p(r,g.end)>0?(this.removeRange(g),d--):(g.start.row==s&&g.start.column>i.column&&(g.start.column+=c),g.end.row==s&&g.end.column>=i.column&&(g.end.column+=c),g.start.row>=s&&(g.start.row+=o),g.end.row>=s&&(g.end.row+=o),p(g.start,g.end)>0&&this.removeRange(g)))}l.length||this.detach()},this.updateLinkedFields=function(){var e=this.selectedTabstop;if(e&&e.hasLinkedRanges){this.$inChange=!0;for(var n=this.editor.session,i=n.getTextRange(e.firstNonLinked),r=e.length;r--;){var s=e[r];if(s.linked){var a=t.snippetManager.tmStrFormat(i,s.original);n.replace(s,a)}}this.$inChange=!1}},this.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},this.onChangeSelection=function(){if(this.editor){for(var e=this.editor.selection.lead,t=this.editor.selection.anchor,n=this.editor.selection.isEmpty(),i=this.ranges.length;i--;)if(!this.ranges[i].linked){var r=this.ranges[i].contains(e.row,e.column),s=n||this.ranges[i].contains(t.row,t.column);if(r&&s)return}this.detach()}},this.onChangeSession=function(){this.detach()},this.tabNext=function(e){var t=this.tabstops.length,n=this.index+(e||1);n=Math.min(Math.max(n,1),t),n==t&&(n=0),this.selectTabstop(n),0===n&&this.detach()},this.selectTabstop=function(e){this.$openTabstops=null;var t=this.tabstops[this.index];if(t&&this.addTabstopMarkers(t),this.index=e,t=this.tabstops[this.index],t&&t.length){if(this.selectedTabstop=t,this.editor.inVirtualSelectionMode)this.editor.selection.setRange(t.firstNonLinked);else{var n=this.editor.multiSelect;n.toSingleRange(t.firstNonLinked.clone());for(var i=t.length;i--;)t.hasLinkedRanges&&t[i].linked||n.addRange(t[i].clone(),!0);n.ranges[0]&&n.addRange(n.ranges[0].clone())}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)}},this.addTabstops=function(e,t,n){if(this.$openTabstops||(this.$openTabstops=[]),!e[0]){var i=a.fromPoints(n,n);f(i.start,t),f(i.end,t),e[0]=[i],e[0].index=0}var r=this.index,s=[r+1,0],o=this.ranges;e.forEach(function(e,n){for(var i=this.$openTabstops[n]||e,r=e.length;r--;){var c=e[r],h=a.fromPoints(c.start,c.end||c.start);g(h.start,t),g(h.end,t),h.original=c,h.tabstop=i,o.push(h),i!=e?i.unshift(h):i[r]=h,c.fmtString?(h.linked=!0,i.hasLinkedRanges=!0):i.firstNonLinked||(i.firstNonLinked=h)}i.firstNonLinked||(i.hasLinkedRanges=!1),i===e&&(s.push(i),this.$openTabstops[n]=i),this.addTabstopMarkers(i)},this),s.length>2&&(this.tabstops.length&&s.push(s.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,s))},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),e.tabstop.length||(t=this.tabstops.indexOf(e.tabstop),-1!=t&&this.tabstops.splice(t,1),this.tabstops.length||this.detach())},this.keyboardHandler=new c,this.keyboardHandler.bindKeys({Tab:function(e){t.snippetManager&&t.snippetManager.expandWithTab(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 d={};d.onChange=o.prototype.onChange,d.setPosition=function(e,t){this.pos.row=e,this.pos.column=t},d.update=function(e,t,n){this.$insertRight=n,this.pos=e,this.onChange(t)};var g=function(e,t){0==e.row&&(e.column+=t.column),e.row+=t.row},f=function(e,t){e.row==t.row&&(e.column-=t.column),e.row-=t.row};e("./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;}"),t.snippetManager=new u;var m=e("./editor").Editor;(function(){this.insertSnippet=function(e,n){return t.snippetManager.insertSnippet(this,e,n)},this.expandSnippet=function(e){return t.snippetManager.expandWithTab(this,e)}}).call(m.prototype)}),ace.define("ace/ext/emmet",["require","exports","module","ace/keyboard/hash_handler","ace/editor","ace/snippets","ace/range","resources","resources","range","tabStops","resources","utils","actions","ace/config"],function(e,t,n){"use strict";function i(){}var r=e("ace/keyboard/hash_handler").HashHandler,s=e("ace/editor").Editor,a=e("ace/snippets").snippetManager,o=e("ace/range").Range,c;s.prototype.indexToPosition=function(e){return this.session.doc.indexToPosition(e)},s.prototype.positionToIndex=function(e){return this.session.doc.positionToIndex(e)},i.prototype={setupContext:function(e){this.ace=e,this.indentation=e.session.getTabString(),c||(c=window.emmet),c.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.selection.moveToPosition(t)},getCurrentLine:function(){var e=this.ace.getCursorPosition().row;return this.ace.session.getLine(e)},replaceContent:function(e,t,n,i){null==n&&(n=null==t?this.getContent().length:t),null==t&&(t=0);var r=this.ace,s=o.fromPoints(r.indexToPosition(t),r.indexToPosition(n));r.session.remove(s),s.end=s.start,e=this.$updateTabstops(e),a.insertSnippet(r,e)},getContent:function(){return this.ace.getValue()},getSyntax:function(){if(this.$syntax)return this.$syntax;var e=this.ace.session.$modeId.split("/").pop();if("html"==e||"php"==e){var t=this.ace.getCursorPosition(),n=this.ace.session.getState(t.row);"string"!=typeof n&&(n=n[0]),n&&(n=n.split("-"),n.length>1?e=n[0]:"php"==e&&(e="html"))}return e},getProfileName:function(){switch(this.getSyntax()){case"css":return"css";case"xml":case"xsl":return"xml";case"html":var e=c.require("resources").getVariable("profile");return e||(e=-1!=this.ace.session.getLines(0,2).join("").search(/<!DOCTYPE[^>]+XHTML/i)?"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,i=null,r=c.require("range"),s=c.require("tabStops"),a=c.require("resources").getVocabulary("user"),o={tabstop:function(e){var a=parseInt(e.group,10),c=0===a;c?a=++n:a+=t;var h=e.placeholder;h&&(h=s.processText(h,o));var p="${"+a+(h?":"+h:"")+"}";return c&&(i=r.create(e.start,p)),p},escape:function(e){return"$"==e?"\\$":"\\"==e?"\\\\":e}};return e=s.processText(e,o),a.variables.insert_final_tabstop&&!/\$\{0\}$/.test(e)?e+="${0}":i&&(e=c.require("utils").replaceSubstring(e,"${0}",i)),e}};var h={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"}},p=new i;t.commands=new r,t.runEmmetCommand=function(e){if(p.setupContext(e),"php"==p.getSyntax())return!1;var t=c.require("actions");if("expand_abbreviation_with_tab"==this.action&&!e.selection.isEmpty())return!1;if("wrap_with_abbreviation"==this.action)return setTimeout(function(){t.run("wrap_with_abbreviation",p)},0);try{var n=t.run(this.action,p)}catch(i){e._signal("changeStatus","string"==typeof i?i:i.message),console.log(i),n=!1}return n};for(var u in h)t.commands.addCommand({name:"emmet:"+u,action:u,bindKey:h[u],exec:t.runEmmetCommand,multiSelectAction:"forEach"});var l=function(e,n){var i=n;if(i){var r=i.session.$modeId,s=r&&/css|less|scss|sass|stylus|html|php/.test(r);e.enableEmmet===!1&&(s=!1),s?i.keyBinding.addKeyboardHandler(t.commands):i.keyBinding.removeKeyboardHandler(t.commands)}};t.AceEmmetEditor=i,e("ace/config").defineOptions(s.prototype,"editor",{enableEmmet:{set:function(e){this[e?"on":"removeListener"]("changeMode",l),l({enableEmmet:!!e},this)},value:!0}}),t.setCore=function(e){c=e}}),function(){ace.require(["ace/ext/emmet"],function(){})}();