',sweetWrap=document.createElement('div');sweetWrap.innerHTML=sweetHTML;document.body.appendChild(sweetWrap);}
-window.sweetAlert=window.swal=function(){if(arguments[0]===undefined){window.console.error('sweetAlert expects at least 1 attribute!');return false;}var params=extend({},defaultParams);switch(typeof arguments[0]){case'string':params.title=arguments[0];params.text=arguments[1]||'';params.type=arguments[2]||'';break;case'object':if(arguments[0].title===undefined){window.console.error('Missing "title" argument!');return false;}params.title=arguments[0].title;params.text=arguments[0].text||defaultParams.text;params.type=arguments[0].type||defaultParams.type;params.allowOutsideClick=arguments[0].allowOutsideClick||defaultParams.allowOutsideClick;params.showCancelButton=arguments[0].showCancelButton!==undefined?arguments[0].showCancelButton:defaultParams.showCancelButton;params.showConfirmButton=arguments[0].showConfirmButton!==undefined?arguments[0].showConfirmButton:defaultParams.showConfirmButton;params.closeOnConfirm=arguments[0].closeOnConfirm!==undefined?arguments[0].closeOnConfirm:
-defaultParams.closeOnConfirm;params.closeOnCancel=arguments[0].closeOnCancel!==undefined?arguments[0].closeOnCancel:defaultParams.closeOnCancel;params.timer=arguments[0].timer||defaultParams.timer;params.confirmButtonText=(defaultParams.showCancelButton)?'Confirm':defaultParams.confirmButtonText;params.confirmButtonText=arguments[0].confirmButtonText||defaultParams.confirmButtonText;params.confirmButtonClass=arguments[0].confirmButtonClass||(arguments[0].type?'btn-'+arguments[0].type:null)||defaultParams.confirmButtonClass;params.cancelButtonText=arguments[0].cancelButtonText||defaultParams.cancelButtonText;params.cancelButtonClass=arguments[0].cancelButtonClass||defaultParams.cancelButtonClass;params.containerClass=arguments[0].containerClass||defaultParams.containerClass;params.titleClass=arguments[0].titleClass||defaultParams.titleClass;params.textClass=arguments[0].textClass||defaultParams.textClass;params.imageUrl=arguments[0].imageUrl||defaultParams.imageUrl;params.imageSize=
-arguments[0].imageSize||defaultParams.imageSize;params.doneFunction=arguments[1]||null;break;default:window.console.error('Unexpected type of argument! Expected "string" or "object", got '+typeof arguments[0]);return false;}setParameters(params);fixVerticalPosition();openModal();var modal=getModal();var onButtonEvent=function(e){var target=e.target||e.srcElement,targetedConfirm=(target.className.indexOf('confirm')>-1),modalIsVisible=hasClass(modal,'visible'),doneFunctionExists=(params.doneFunction&&modal.getAttribute('data-has-done-function')==='true');switch(e.type){case("click"):if(targetedConfirm&&doneFunctionExists&&modalIsVisible){params.doneFunction(true);if(params.closeOnConfirm){closeModal();}}else if(doneFunctionExists&&modalIsVisible){var functionAsStr=String(params.doneFunction).replace(/\s/g,'');var functionHandlesCancel=functionAsStr.substring(0,9)==="function("&&functionAsStr.substring(9,10)!==")";if(functionHandlesCancel){params.doneFunction(false);}if(params.
-closeOnCancel){closeModal();}}else{closeModal();}break;}};var $buttons=modal.querySelectorAll('button');for(var i=0;i<$buttons.length;i++){$buttons[i].onclick=onButtonEvent;}previousDocumentClick=document.onclick;document.onclick=function(e){var target=e.target||e.srcElement;var clickedOnModal=(modal===target),clickedOnModalChild=isDescendant(modal,e.target),modalIsVisible=hasClass(modal,'visible'),outsideClickIsAllowed=modal.getAttribute('data-allow-ouside-click')==='true';if(!clickedOnModal&&!clickedOnModalChild&&modalIsVisible&&outsideClickIsAllowed){closeModal();}};var $okButton=modal.querySelector('button.confirm'),$cancelButton=modal.querySelector('button.cancel'),$modalButtons=modal.querySelectorAll('button:not([type=hidden])');function handleKeyDown(e){var keyCode=e.keyCode||e.which;if([9,13,32,27].indexOf(keyCode)===-1){return;}var $targetElement=e.target||e.srcElement;var btnIndex=-1;for(var i=0;i<$modalButtons.length;i++){if($targetElement===$modalButtons[i]){btnIndex=i;
-break;}}if(keyCode===9){if(btnIndex===-1){$targetElement=$okButton;}else{if(btnIndex===$modalButtons.length-1){$targetElement=$modalButtons[0];}else{$targetElement=$modalButtons[btnIndex+1];}}stopEventPropagation(e);$targetElement.focus();}else{if(keyCode===13||keyCode===32){if(btnIndex===-1){$targetElement=$okButton;}else{$targetElement=undefined;}}else if(keyCode===27&&!($cancelButton.hidden||$cancelButton.style.display==='none')){$targetElement=$cancelButton;}else{$targetElement=undefined;}if($targetElement!==undefined){fireClick($targetElement,e);}}}previousWindowKeyDown=window.onkeydown;window.onkeydown=handleKeyDown;function handleOnBlur(e){var $targetElement=e.target||e.srcElement,$focusElement=e.relatedTarget,modalIsVisible=hasClass(modal,'visible'),bootstrapModalIsVisible=document.querySelector('.control-popup.modal')||false;if(bootstrapModalIsVisible){return;}if(modalIsVisible){var btnIndex=-1;if($focusElement!==null){for(var i=0;i<$modalButtons.length;i++){if($focusElement
-===$modalButtons[i]){btnIndex=i;break;}}if(btnIndex===-1){$targetElement.focus();}}else{lastFocusedButton=$targetElement;}}}$okButton.onblur=handleOnBlur;$cancelButton.onblur=handleOnBlur;window.onfocus=function(){window.setTimeout(function(){if(lastFocusedButton!==undefined){lastFocusedButton.focus();lastFocusedButton=undefined;}},0);};};window.swal.setDefaults=function(userParams){if(!userParams){throw new Error('userParams is required');}if(typeof userParams!=='object'){throw new Error('userParams has to be a object');}extend(defaultParams,userParams);};window.swal.close=function(){closeModal();}
-function setParameters(params){var modal=getModal();var $title=modal.querySelector('h2'),$text=modal.querySelector('p'),$cancelBtn=modal.querySelector('button.cancel'),$confirmBtn=modal.querySelector('button.confirm');$title.innerHTML=escapeHtml(params.title).split("\n").join(" ");$text.innerHTML=escapeHtml(params.text||'').split("\n").join(" ");if(params.text){show($text);}hide(modal.querySelectorAll('.icon'));if(params.type){var validType=false;for(var i=0;iw)&&w>0){nw=w;nh=(w/$obj.width())*$obj.height();}if((nh>h)&&h>0){nh=h;nw=(h/$obj.height())*$obj.width();}xscale=$obj.width()/nw;yscale=$obj.height()/nh;$obj.width(nw).height(nh);}function unscale(c){return{x:c.x*xscale,y:c.y*yscale,x2:c.x2*xscale,y2:c.y2*yscale,w:c.w*xscale,h:c.h*yscale};}function doneSelect(pos){var c=Coords.getFixed();if((c.w>options.minSelect[0])&&(c.h>options.minSelect[1])){Selection.enableHandles();Selection.done();}else{Selection.release();}Tracker.setCursor(options.
-allowSelect?'crosshair':'default');}function newSelection(e){if(options.disabled){return false;}if(!options.allowSelect){return false;}btndown=true;docOffset=getPos($img);Selection.disableHandles();Tracker.setCursor('crosshair');var pos=mouseAbs(e);Coords.setPressed(pos);Selection.update();Tracker.activateHandlers(selectDrag,doneSelect,e.type.substring(0,5)==='touch');KeyManager.watchKeys();e.stopPropagation();e.preventDefault();return false;}function selectDrag(pos){Coords.setCurrent(pos);Selection.update();}function newTracker(){var trk=$('').addClass(cssClass('tracker'));if(is_msie){trk.css({opacity:0,backgroundColor:'white'});}return trk;}if(typeof(obj)!=='object'){obj=$(obj)[0];}if(typeof(opt)!=='object'){opt={};}setOptions(opt);var img_css={border:'none',visibility:'visible',margin:0,padding:0,position:'absolute',top:0,left:0};var $origimg=$(obj),img_mode=true;if(obj.tagName=='IMG'){if($origimg[0].width!=0&&$origimg[0].height!=0){$origimg.width($origimg[0].width);
-$origimg.height($origimg[0].height);}else{var tempImage=new Image();tempImage.src=$origimg[0].src;$origimg.width(tempImage.width);$origimg.height(tempImage.height);}var $img=$origimg.clone().removeAttr('id').css(img_css).show();$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();}else{$img=$origimg.css(img_css).show();img_mode=false;if(options.shade===null){options.shade=true;}}presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);if(options.addClass){$div.addClass(options.addClass);}var $img2=$(''),$img_holder=$('').width('100%').height('100%').css({zIndex:310,position:'absolute',overflow:'hidden'}),$hdl_holder=$('').width('100%').height('100%').css('zIndex',320),$sel=$('').css({position:'absolute',zIndex:600}).
-dblclick(function(){var c=Coords.getFixed();options.onDblClick.call(api,c);}).insertBefore($img).append($img_holder,$hdl_holder);if(img_mode){$img2=$('').attr('src',$img.attr('src')).css(img_css).width(boundx).height(boundy),$img_holder.append($img2);}if(ie6mode){$sel.css({overflowY:'hidden'});}var bound=options.boundary;var $trk=newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)).css({position:'absolute',top:px(-bound),left:px(-bound),zIndex:290}).mousedown(newSelection);var bgcolor=options.bgColor,bgopacity=options.bgOpacity,xlimit,ylimit,xmin,ymin,xscale,yscale,enabled=true,btndown,animating,shift_down;docOffset=getPos($img);var Touch=(function(){function hasTouchSupport(){var support={},events=['touchstart','touchmove','touchend'],el=document.createElement('div'),i;try{for(i=0;ix1+ox){ox-=ox+x1;}if(0>y1+oy){oy-=oy+y1;}if(boundyboundx
-){xx=boundx;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}}else{xx=x2;h=rwa/aspect;yy=rh<0?y1-h:y1+h;if(yy<0){yy=0;w=Math.abs((yy-y1)*aspect);xx=rw<0?x1-w:w+x1;}else if(yy>boundy){yy=boundy;w=Math.abs(yy-y1)*aspect;xx=rw<0?x1-w:w+x1;}}if(xx>x1){if(xx-x1max_x){xx=x1+max_x;}if(yy>y1){yy=y1+(xx-x1)/aspect;}else{yy=y1-(xx-x1)/aspect;}}else if(xxmax_x){xx=x1-max_x;}if(yy>y1){yy=y1+(x1-xx)/aspect;}else{yy=y1-(x1-xx)/aspect;}}if(xx<0){x1-=xx;xx=0;}else if(xx>boundx){x1-=xx-boundx;xx=boundx;}if(yy<0){y1-=yy;yy=0;}else if(yy>boundy){y1-=yy-boundy;yy=boundy;}return makeObj(flipCoords(x1,y1,xx,yy));}function rebound(p){if(p[0]<0)p[0]=0;if(p[1]<0)p[1]=0;if(p[0]>boundx)p[0]=boundx;if(p[1]>boundy)p[1]=boundy;return[Math.round(p[0]),Math.round(p[1])];}function flipCoords(x1,y1,x2,y2){var xa=x1,xb=x2,ya=y1,yb=y2;if(x2xlimit)){x2=(xsize>0)?(x1+xlimit):(x1-xlimit);}if(ylimit&&(Math.abs(ysize)>ylimit)){y2=(ysize>0)?(y1+ylimit):(y1-ylimit);}if(ymin/yscale&&(Math.abs(ysize)0)?(y1+ymin/yscale):(y1-ymin/yscale);}if(xmin/xscale&&(Math.abs(xsize)0)?(x1+xmin/xscale):(x1-xmin/xscale);}if(x1<0){x2-=x1;x1-=x1;}if(y1<0){y2-=y1;y1-=y1;}if(x2<0){x1-=x2;x2-=x2;}if(y2<0){y1-=y2;y2-=y2;}if(x2>boundx){delta=x2-boundx;x1-=delta;x2-=delta;}if(y2>boundy){delta=y2-boundy;y1-=delta;y2-=delta;}if(x1>boundx){delta=x1-boundy;y2-=delta;y1-=delta;}if(y1>boundy){delta=y1-boundy;y2-=delta;y1-=delta;}return makeObj(flipCoords(x1,y1,x2,y2));}function makeObj(a){return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]};}return{flipCoords:flipCoords,setPressed:setPressed,setCurrent:setCurrent,getOffset:getOffset,moveOffset:moveOffset,getCorner:getCorner,getFixed:getFixed};}());var Shade=(function(){var enabled=false,holder=$('').css({
-position:'absolute',zIndex:240,opacity:0}),shades={top:createShade(),left:createShade().height(boundy),right:createShade().height(boundy),bottom:createShade()};function resizeShades(w,h){shades.left.css({height:px(h)});shades.right.css({height:px(h)});}function updateAuto(){return updateShade(Coords.getFixed());}function updateShade(c){shades.top.css({left:px(c.x),width:px(c.w),height:px(c.y)});shades.bottom.css({top:px(c.y2),left:px(c.x),width:px(c.w),height:px(boundy-c.y2)});shades.right.css({left:px(c.x2),width:px(boundx-c.x2)});shades.left.css({width:px(c.x)});}function createShade(){return $('').css({position:'absolute',backgroundColor:options.shadeColor||options.bgColor}).appendTo(holder);}function enableShade(){if(!enabled){enabled=true;holder.insertBefore($img);updateAuto();Selection.setBgOpacity(1,0,1);$img2.hide();setBgColor(options.shadeColor||options.bgColor,1);if(Selection.isAwake()){setOpacity(options.bgOpacity,1);}else setOpacity(1,1);}}function setBgColor(color,
-now){colorChangeMacro(getShades(),color,now);}function disableShade(){if(enabled){holder.remove();$img2.show();enabled=false;if(Selection.isAwake()){Selection.setBgOpacity(options.bgOpacity,1,1);}else{Selection.setBgOpacity(1,1,1);Selection.disableHandles();}colorChangeMacro($div,0,1);}}function setOpacity(opacity,now){if(enabled){if(options.bgFade&&!now){holder.animate({opacity:1-opacity},{queue:false,duration:options.fadeTime});}else holder.css({opacity:1-opacity});}}function refreshAll(){options.shade?enableShade():disableShade();if(Selection.isAwake())setOpacity(options.bgOpacity);}function getShades(){return holder.children();}return{update:updateAuto,updateRaw:updateShade,getShades:getShades,setBgColor:setBgColor,enable:enableShade,disable:disableShade,resize:resizeShades,refresh:refreshAll,opacity:setOpacity};}());var Selection=(function(){var awake,hdep=370,borders={},handle={},dragbar={},seehandles=false;function insertBorder(type){var jq=$('').css({position:'absolute',
-opacity:options.borderOpacity}).addClass(cssClass(type));$img_holder.append(jq);return jq;}function dragDiv(ord,zi){var jq=$('').mousedown(createDragger(ord)).css({cursor:ord+'-resize',position:'absolute',zIndex:zi}).addClass('ord-'+ord);if(Touch.support){jq.bind('touchstart.jcrop',Touch.createDragger(ord));}$hdl_holder.append(jq);return jq;}function insertHandle(ord){var hs=options.handleSize,div=dragDiv(ord,hdep++).css({opacity:options.handleOpacity}).addClass(cssClass('handle'));if(hs){div.width(hs).height(hs);}return div;}function insertDragbar(ord){return dragDiv(ord,hdep++).addClass('jcrop-dragbar');}function createDragbars(li){var i;for(i=0;i').css({position:'fixed',left:'-120px',width:'12px'}).addClass('jcrop-keymgr'),$keywrap=$('').css({position:'absolute',overflow:'hidden'}).append($keymgr);function watchKeys(){if(options.keySupport){$keymgr.show();$keymgr.focus();}}function onBlur(e){$keymgr.hide();}function doNudge(e,x,y){if(options.allowMove){Coords.moveOffset([x,y]);Selection.updateVisible(true);}e.preventDefault();e.
-stopPropagation();}function parseKey(e){if(e.ctrlKey||e.metaKey){return true;}shift_down=e.shiftKey?true:false;var nudge=shift_down?10:1;switch(e.keyCode){case 37:doNudge(e,-nudge,0);break;case 39:doNudge(e,nudge,0);break;case 38:doNudge(e,0,-nudge);break;case 40:doNudge(e,0,nudge);break;case 27:if(options.allowSelect)Selection.release();break;case 9:return true;}return false;}if(options.keySupport){$keymgr.keydown(parseKey).blur(onBlur);if(ie6mode||!options.fixedSupport){$keymgr.css({position:'absolute',left:'-20px'});$keywrap.append($keymgr).insertBefore($img);}else{$keymgr.insertBefore($img);}}return{watchKeys:watchKeys};}());function setClass(cname){$div.removeClass().addClass(cssClass('holder')).addClass(cname);}function animateTo(a,callback){var x1=a[0]/xscale,y1=a[1]/yscale,x2=a[2]/xscale,y2=a[3]/yscale;if(animating){return;}var animto=Coords.flipCoords(x1,y1,x2,y2),c=Coords.getFixed(),initcr=[c.x,c.y,c.x2,c.y2],animat=initcr,interv=options.animationDelay,ix1=animto[0]-initcr[0]
-,iy1=animto[1]-initcr[1],ix2=animto[2]-initcr[2],iy2=animto[3]-initcr[3],pcent=0,velocity=options.swingSpeed;x1=animat[0];y1=animat[1];x2=animat[2];y2=animat[3];Selection.animMode(true);var anim_timer;function queueAnimator(){window.setTimeout(animator,interv);}var animator=(function(){return function(){pcent+=(100-pcent)/velocity;animat[0]=Math.round(x1+((pcent/100)*ix1));animat[1]=Math.round(y1+((pcent/100)*iy1));animat[2]=Math.round(x2+((pcent/100)*ix2));animat[3]=Math.round(y2+((pcent/100)*iy2));if(pcent>=99.8){pcent=100;}if(pcent<100){setSelectRaw(animat);queueAnimator();}else{Selection.done();Selection.animMode(false);if(typeof(callback)==='function'){callback.call(api);}}};}());queueAnimator();}function setSelect(rect){setSelectRaw([rect[0]/xscale,rect[1]/yscale,rect[2]/xscale,rect[3]/yscale]);options.onSelect.call(api,unscale(Coords.getFixed()));Selection.enableHandles();}function setSelectRaw(l){Coords.setPressed([l[0],l[1]]);Coords.setCurrent([l[2],l[3]]);Selection.update();}
-function tellSelect(){return unscale(Coords.getFixed());}function tellScaled(){return Coords.getFixed();}function setOptionsNew(opt){setOptions(opt);interfaceUpdate();}function disableCrop(){options.disabled=true;Selection.disableHandles();Selection.setCursor('default');Tracker.setCursor('default');}function enableCrop(){options.disabled=false;interfaceUpdate();}function cancelCrop(){Selection.done();Tracker.activateHandlers(null,null);}function destroy(){$(document).unbind('touchstart.jcrop-ios',Touch.fixTouchSupport);$div.remove();$origimg.show();$origimg.css('visibility','visible');$(obj).removeData('Jcrop');}function setImage(src,callback){Selection.release();disableCrop();var img=new Image();img.onload=function(){var iw=img.width;var ih=img.height;var bw=options.boxWidth;var bh=options.boxHeight;$img.width(iw).height(ih);$img.attr('src',src);$img2.attr('src',src);presize($img,bw,bh);boundx=$img.width();boundy=$img.height();$img2.width(boundx).height(boundy);$trk.width(boundx+(
-bound*2)).height(boundy+(bound*2));$div.width(boundx).height(boundy);Shade.resize(boundx,boundy);enableCrop();if(typeof(callback)==='function'){callback.call(api);}};img.src=src;}function colorChangeMacro($obj,color,now){var mycolor=color||options.bgColor;if(options.bgFade&&supportsColorFade()&&options.fadeTime&&!now){$obj.animate({backgroundColor:mycolor},{queue:false,duration:options.fadeTime});}else{$obj.css('backgroundColor',mycolor);}}function interfaceUpdate(alt){if(options.allowResize){if(alt){Selection.enableOnly();}else{Selection.enableHandles();}}else{Selection.disableHandles();}Tracker.setCursor(options.allowSelect?'crosshair':'default');Selection.setCursor(options.allowMove?'move':'default');if(options.hasOwnProperty('trueSize')){xscale=options.trueSize[0]/boundx;yscale=options.trueSize[1]/boundy;}if(options.hasOwnProperty('setSelect')){setSelect(options.setSelect);Selection.done();delete(options.setSelect);}Shade.refresh();if(options.bgColor!=bgcolor){colorChangeMacro(
-options.shade?Shade.getShades():$div,options.shade?(options.shadeColor||options.bgColor):options.bgColor);bgcolor=options.bgColor;}if(bgopacity!=options.bgOpacity){bgopacity=options.bgOpacity;if(options.shade)Shade.refresh();else Selection.setBgOpacity(bgopacity);}xlimit=options.maxSize[0]||0;ylimit=options.maxSize[1]||0;xmin=options.minSize[0]||0;ymin=options.minSize[1]||0;if(options.hasOwnProperty('outerImage')){$img.attr('src',options.outerImage);delete(options.outerImage);}Selection.refresh();}if(Touch.support)$trk.bind('touchstart.jcrop',Touch.newSelection);$hdl_holder.hide();interfaceUpdate(true);var api={setImage:setImage,animateTo:animateTo,setSelect:setSelect,setOptions:setOptionsNew,tellSelect:tellSelect,tellScaled:tellScaled,setClass:setClass,disable:disableCrop,enable:enableCrop,cancel:cancelCrop,release:Selection.release,destroy:destroy,focus:KeyManager.watchKeys,getBounds:function(){return[boundx*xscale,boundy*yscale];},getWidgetSize:function(){return[boundx,boundy];},
-getScaleFactor:function(){return[xscale,yscale];},getOptions:function(){return options;},ui:{holder:$div,selection:$sel}};if(is_msie)$div.bind('selectstart',function(){return false;});$origimg.data('Jcrop',api);return api;};$.fn.Jcrop=function(options,callback){var api;this.each(function(){if($(this).data('Jcrop')){if(options==='api')return $(this).data('Jcrop');else $(this).data('Jcrop').setOptions(options);}else{if(this.tagName=='IMG')$.Jcrop.Loader(this,function(){$(this).css({display:'block',visibility:'hidden'});api=$.Jcrop(this,options);if($.isFunction(callback))callback.call(api);});else{$(this).css({display:'block',visibility:'hidden'});api=$.Jcrop(this,options);if($.isFunction(callback))callback.call(api);}}});return this;};$.Jcrop.Loader=function(imgobj,success,error){var $img=$(imgobj),img=$img[0];function completeCheck(){if(img.complete){$img.unbind('.jcloader');if($.isFunction(success))success.call(img);}else window.setTimeout(completeCheck,50);}$img.bind('load.jcloader',
-completeCheck).bind('error.jcloader',function(e){$img.unbind('.jcloader');if($.isFunction(error))error.call(img);});if(img.complete&&$.isFunction(success)){$img.unbind('.jcloader');success.call(img);}};$.Jcrop.defaults={allowSelect:true,allowMove:true,allowResize:true,trackDocument:true,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:0.6,bgFade:false,borderOpacity:0.4,handleOpacity:0.5,handleSize:null,aspectRatio:0,keySupport:true,createHandles:['n','s','e','w','nw','ne','se','sw'],createDragbars:['n','s','e','w'],createBorders:['n','s','e','w'],drawBorders:true,dragEdges:true,fixedSupport:true,touchSupport:null,shade:null,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}};}(jQuery));!function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;(function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)
-return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;ah[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.
-push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,q,"'\"`"]):d
-.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com",/^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+s+
-")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(
-a,c){var d=c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,
-"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,
-"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:
-!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^]+/],["dec",/^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^
+
+
+
+
+
+
+
+
diff --git a/modules/backend/formwidgets/CodeEditor.php b/modules/backend/formwidgets/CodeEditor.php
index 2a360e01d3..30fc3b93ea 100644
--- a/modules/backend/formwidgets/CodeEditor.php
+++ b/modules/backend/formwidgets/CodeEditor.php
@@ -1,7 +1,7 @@
vars['stretch'] = $this->formField->stretch;
$this->vars['size'] = $this->formField->size;
$this->vars['readOnly'] = $this->readOnly;
- $this->vars['autocompletion'] = $this->autocompletion;
- $this->vars['enableSnippets'] = $this->enableSnippets;
$this->vars['displayIndentGuides'] = $this->displayIndentGuides;
$this->vars['showPrintMargin'] = $this->showPrintMargin;
+ $this->vars['showMinimap'] = $this->showMinimap;
+ $this->vars['bracketColors'] = $this->bracketColors;
+ $this->vars['showColors'] = $this->showColors;
// Double encode when escaping
$this->vars['value'] = htmlentities($this->getLoadValue(), ENT_QUOTES, 'UTF-8', true);
@@ -195,7 +202,7 @@ public function prepareVars()
protected function loadAssets()
{
$this->addCss('css/codeeditor.css', 'core');
- $this->addJs('js/build-min.js', 'core');
+ $this->addJs('js/build/codeeditor.bundle.js', 'core');
}
/**
@@ -209,7 +216,7 @@ protected function applyEditorPreferences()
$this->fontSize = $preferences->editor_font_size;
$this->wordWrap = $preferences->editor_word_wrap;
- $this->codeFolding = $preferences->editor_code_folding;
+ $this->codeFolding = $preferences->editor_enable_folding ?? ($preferences->editor_code_folding !== 'manual');
$this->autoClosing = $preferences->editor_auto_closing;
$this->tabSize = $preferences->editor_tab_size;
$this->theme = $preferences->editor_theme;
@@ -217,9 +224,10 @@ protected function applyEditorPreferences()
$this->highlightActiveLine = $preferences->editor_highlight_active_line;
$this->useSoftTabs = !$preferences->editor_use_hard_tabs;
$this->showGutter = $preferences->editor_show_gutter;
- $this->autocompletion = $preferences->editor_autocompletion;
- $this->enableSnippets = $preferences->editor_enable_snippets;
$this->displayIndentGuides = $preferences->editor_display_indent_guides;
$this->showPrintMargin = $preferences->editor_show_print_margin;
+ $this->showMinimap = $preferences->editor_show_minimap;
+ $this->bracketColors = $preferences->editor_bracket_colors;
+ $this->showColors = $preferences->editor_show_colors;
}
}
diff --git a/modules/backend/formwidgets/MarkdownEditor.php b/modules/backend/formwidgets/MarkdownEditor.php
index a884fe5c1c..105e0d5cbc 100644
--- a/modules/backend/formwidgets/MarkdownEditor.php
+++ b/modules/backend/formwidgets/MarkdownEditor.php
@@ -1,9 +1,11 @@
-addCss('css/markdowneditor.css', 'core');
$this->addJs('js/markdowneditor.js', 'core');
- $this->addJs('/modules/backend/formwidgets/codeeditor/assets/js/build-min.js', 'core');
+ $this->addJs('/modules/backend/assets/vendor/ace-codeeditor/build-min.js', 'core');
}
/**
diff --git a/modules/backend/formwidgets/RichEditor.php b/modules/backend/formwidgets/RichEditor.php
index 15b7f8b1a1..02c9949f66 100644
--- a/modules/backend/formwidgets/RichEditor.php
+++ b/modules/backend/formwidgets/RichEditor.php
@@ -1,15 +1,17 @@
-addJs('js/build-plugins-min.js', 'core');
}
- $this->addJs('/modules/backend/formwidgets/codeeditor/assets/js/build-min.js', 'core');
+ $this->addJs('/modules/backend/assets/vendor/ace-codeeditor/build-min.js', 'core');
if ($lang = $this->getValidEditorLang()) {
$this->addJs('vendor/froala/js/languages/'.$lang.'.js', 'core');
diff --git a/modules/backend/formwidgets/codeeditor/README.md b/modules/backend/formwidgets/codeeditor/README.md
new file mode 100644
index 0000000000..04ca53a862
--- /dev/null
+++ b/modules/backend/formwidgets/codeeditor/README.md
@@ -0,0 +1,586 @@
+# Monaco Code Editor for Winter CMS
+
+This is the Monaco Editor integration for Winter CMS Backend, replacing the legacy Ace Editor with Microsoft's Monaco Editor (the same editor that powers VS Code).
+
+## Overview
+
+**Monaco Editor** provides a rich, modern code editing experience with:
+- IntelliSense (code completion)
+- Syntax highlighting for 15+ languages
+- Advanced find/replace with regex support
+- Multi-cursor editing
+- Code folding
+- Bracket matching and colorization
+- Minimap overview
+- Color picker for CSS colors
+- And many more VS Code features
+
+## Features
+
+### Supported Languages (15)
+
+1. **TypeScript** - Full TypeScript support with type checking
+2. **JavaScript** - Modern ES6+ support
+3. **CSS** - Including CSS3 properties
+4. **JSON** - With schema validation
+5. **HTML** - HTML5 support
+6. **INI** - Configuration files
+7. **LESS** - CSS preprocessor
+8. **Markdown** - Rich markdown editing
+9. **MySQL** - SQL syntax highlighting
+10. **PHP** - Full PHP support
+11. **SCSS** - Sass CSS preprocessor
+12. **Twig** - Template engine syntax
+13. **XML** - Markup language support
+14. **YAML** - Configuration file support
+
+### Monaco Features (20+)
+
+Enabled features include:
+- Anchor select
+- Bracket matching
+- Caret operations
+- Clipboard operations
+- Code lens
+- Color picker
+- Comment toggling
+- Context menu
+- Cursor undo/redo
+- Find and replace
+- Code folding
+- Go to symbol
+- Hover information
+- In-place replace
+- Indentation
+- Inline hints
+- Links
+- Multi-cursor editing
+- Parameter hints
+- Rename symbol
+- Smart select
+- Snippets
+- Suggest (autocomplete)
+- Word highlighter
+- Word operations
+
+### Themes (35+)
+
+Includes legacy tmTheme themes plus modern JSON themes
+
+### User Preferences
+
+All editor preferences are configurable from **Backend → Preferences → Code editor**:
+
+**Appearance:**
+- Font size (default: 12px)
+- Theme selection
+- Show/hide line numbers (gutter)
+- Show/hide invisibles (whitespace)
+- Highlight active line
+- Show minimap
+- Bracket colorization
+- Color picker for CSS
+
+**Behavior:**
+- Tab size (default: 4 spaces)
+- Use soft tabs (spaces) vs hard tabs
+- Word wrap
+- Auto-closing brackets/quotes
+- Code folding
+- Indent guides
+- Print margin
+
+All preferences persist across sessions and are stored per-user.
+
+## Editor Architecture
+
+Winter CMS uses a **dual-editor architecture** to optimize for different use cases:
+
+### Monaco Editor (this FormWidget)
+**Used by:** CodeEditor FormWidget
+**Location:** `/modules/backend/formwidgets/codeeditor/`
+**Purpose:** Advanced code editing with IntelliSense, syntax highlighting, and modern IDE features
+**Bundle Size:** ~15 MB gzipped (main bundle + workers)
+**Best for:** Writing PHP, JavaScript, CSS, YAML, and other code files
+
+### Ace Editor (preserved)
+**Used by:** RichEditor and MarkdownEditor FormWidgets
+**Location:** `/modules/backend/assets/vendor/ace-codeeditor/`
+**Purpose:** HTML source code editing within WYSIWYG editors
+**Bundle Size:** ~500 KB (significantly lighter)
+**Best for:** Viewing/editing raw HTML in rich text contexts
+
+### Why Both?
+
+**Monaco for CodeEditor:**
+- Full IntelliSense and code completion
+- Advanced refactoring tools
+- Multi-cursor editing
+- Rich language support
+- Worth the bundle size for dedicated code editing
+
+**Ace for RichEditor/MarkdownEditor:**
+- Users rarely need advanced IDE features for HTML source view
+- Lighter bundle improves page load performance
+- Sufficient for basic HTML editing needs
+- Reduces total application bundle by keeping WYSIWYG tools lean
+
+This architecture balances modern features where they matter most (code editing) with performance optimization for general-purpose rich text editing.
+
+## Technical Details
+
+### Architecture
+
+```text
+modules/backend/formwidgets/codeeditor/
+├── assets/
+│ ├── css/
+│ │ └── codeeditor.css - Compiled styles
+│ ├── fonts/
+│ │ └── codicon.ttf - Monaco icons font
+│ ├── js/
+│ │ ├── codeeditor.js - Main Monaco integration
+│ │ └── build/
+│ │ ├── codeeditor.bundle.js - Main bundle (19 MB)
+│ │ ├── css.worker.js - CSS language worker
+│ │ ├── editor.worker.js - Base editor worker
+│ │ ├── html.worker.js - HTML language worker
+│ │ ├── json.worker.js - JSON language worker
+│ │ ├── ts.worker.js - TypeScript worker
+│ │ └── [language-chunks] - 15 language modules
+│ ├── less/
+│ │ └── codeeditor.less - Source styles
+│ ├── themes/
+│ │ ├── [34 .tmTheme files] - Legacy TextMate themes
+│ │ ├── one-dark-pro.json - Modern JSON theme
+│ │ └── winter.json - Modern JSON theme
+│ ├── winter.mix.js - Laravel Mix build configuration
+│ └── package.json - NPM dependencies (in parent)
+├── partials/
+│ └── codeeditor.htm - Widget template
+└── CodeEditor.php - FormWidget class
+```
+
+### Build System
+
+**Current:** Laravel Mix 6 with Webpack 5
+
+#### Build Command
+```bash
+php artisan mix:compile --package=module-backend.formwidgets.codeeditor -p
+```
+
+#### Build Configuration
+
+See `assets/winter.mix.js`:
+- Uses `monaco-editor-webpack-plugin` for proper worker splitting
+- Polyfills for browser compatibility (> 0.5%, last 2 versions, Firefox ESR)
+- Removes inline codicon font CSS (post-build hook)
+- Minification and terser optimization
+
+### Web Workers
+
+Monaco Editor uses Web Workers for language services:
+
+| Worker | Size | Purpose |
+|--------|------|---------|
+| editor.worker.js | 1.6 MB | Base editor operations |
+| ts.worker.js | 22 MB | TypeScript/JavaScript IntelliSense |
+| css.worker.js | 4.7 MB | CSS validation and completion |
+| html.worker.js | 3.3 MB | HTML validation |
+| json.worker.js | 2.2 MB | JSON schema validation |
+
+Workers are loaded asynchronously and run in separate threads for better performance.
+
+### Theme System
+
+Themes are loaded directly as static assets via HTTP fetch (no PHP handler required). Theme preference values include the file extension (e.g., `twilight.tmTheme`, `one-dark-pro.json`).
+
+#### Supported Formats
+
+**1. TextMate Themes (.tmTheme)**
+Legacy XML-based themes. Converted to Monaco format at runtime using `fast-plist` library.
+
+**2. JSON Themes (.json)**
+Modern VS Code theme format. Parsed and mapped to Monaco's theme structure.
+
+```javascript
+// codeeditor.js - Themes loaded via static fetch
+async fetchTheme(themeName) {
+ // Theme name includes extension (e.g., "twilight.tmTheme", "one-dark-pro.json")
+ // Legacy values without extension default to .tmTheme
+ const basePath = window.Snowboard.url().asset('/modules/backend/formwidgets/codeeditor/assets/themes/');
+ const response = await fetch(`${basePath}${themeName}`);
+ // Format determined from file extension
+}
+```
+
+## Usage
+
+### Basic Usage
+
+```yaml
+# fields.yaml
+code:
+ type: codeeditor
+ size: giant
+ language: php
+```
+
+### Available Options
+
+```yaml
+code:
+ type: codeeditor
+ # Editor size
+ size: tiny|small|large|huge|giant # Default: large
+
+ # Programming language
+ language: php|javascript|css|html|twig|yaml|etc # Default: php
+
+ # Theme (overrides user preference)
+ theme: twilight|monokai|github|one-dark-pro|etc
+
+ # Line numbers
+ showGutter: true|false # Default: true
+
+ # Word wrapping
+ wordWrap: true|false # Default: true
+
+ # Code folding
+ codeFolding: true|false # Default: true
+
+ # Auto-closing brackets
+ autoClosing: true|false # Default: true
+
+ # Soft tabs (spaces)
+ useSoftTabs: true|false # Default: true
+ tabSize: 2|4|8 # Default: 4
+
+ # Font size (px)
+ fontSize: 10|12|14|16|18 # Default: 12
+
+ # Read-only mode
+ readOnly: true|false # Default: false
+ disabled: true|false # Sets readOnly
+
+ # Display options
+ showInvisibles: true|false # Default: false
+ highlightActiveLine: true|false # Default: true
+ displayIndentGuides: true|false # Default: true
+ showPrintMargin: true|false # Default: false
+ showMinimap: true|false # Default: true
+ bracketColors: true|false # Default: false
+ showColors: true|false # Default: true (CSS color picker)
+```
+
+### JavaScript API
+
+```javascript
+// Get editor instance
+const $editor = $('#my-editor');
+const wrapper = $editor.data('oc.codeeditor');
+
+// Access Monaco instance directly
+const monacoEditor = wrapper.editor;
+
+// Get/set content (via wrapper)
+const code = wrapper.getValue();
+wrapper.setValue('function test() {}');
+
+// Get/set language
+wrapper.setLanguage('javascript');
+
+// Change theme
+wrapper.setTheme('one-dark-pro');
+
+// Insert at cursor
+wrapper.insert('code here');
+
+// Get cursor position
+const position = wrapper.getPosition(); // { lineNumber: 1, column: 1 }
+
+// Fullscreen
+wrapper.enterFullscreen();
+wrapper.exitFullscreen();
+```
+
+### Migrating from ACE to Monaco API
+
+Winter CMS has migrated from ACE Editor to Monaco Editor. While backward compatibility is maintained for accessing the editor instance via jQuery `.data('oc.codeEditor')`, direct ACE API calls need to be updated.
+
+#### Breaking Changes
+
+**ACE's Session API is Removed:**
+- `editor.getSession()` → No longer available
+- ACE used a separate "session" object for document operations
+- Monaco combines session and model into a single API
+
+**Position Indexing Changed:**
+- ACE uses **0-indexed** positions (rows and columns start at 0)
+- Monaco uses **1-indexed** positions (lines and columns start at 1)
+- Example: ACE row 5 = Monaco line 6, ACE column 0 = Monaco column 1
+
+**Annotations Replaced with Markers:**
+- ACE's `setAnnotations()` → Monaco's `monaco.editor.setModelMarkers()`
+- Different data structure and API
+
+#### Quick Migration Guide
+
+**Getting/Setting Editor Value:**
+
+```javascript
+// ❌ OLD (ACE API - Deprecated)
+const editor = $('[data-control=codeeditor]').data('oc.codeEditor').editor;
+const value = editor.getSession().getValue();
+editor.getSession().setValue('new value');
+
+// ✅ NEW (Recommended - Use Wrapper)
+const wrapper = $('[data-control=codeeditor]').data('oc.codeEditor');
+const value = wrapper.getValue();
+wrapper.setValue('new value');
+
+// ✅ ALTERNATIVE (Direct Monaco API)
+const monacoEditor = wrapper.editor;
+const value = monacoEditor.getModel().getValue();
+monacoEditor.getModel().setValue('new value');
+```
+
+**Inserting Text at Cursor:**
+
+```javascript
+// ❌ OLD (ACE API)
+editor.insert('text');
+
+// ✅ NEW (Wrapper provides this method)
+wrapper.insert('text');
+```
+
+**Working with Annotations/Markers:**
+
+```javascript
+// ❌ OLD (ACE Annotations)
+editor.getSession().setAnnotations([
+ { row: 5, column: 0, text: 'Warning message', type: 'warning' }
+]);
+
+// Clear annotations
+editor.getSession().setAnnotations([]);
+
+// ✅ NEW (Monaco Wrapper Method - Recommended)
+wrapper.setMarkers('sourceId', [
+ {
+ startLineNumber: 6, // ACE row 5 = Monaco line 6 (1-indexed!)
+ startColumn: 1, // ACE column 0 = Monaco column 1
+ endLineNumber: 6,
+ endColumn: Number.MAX_VALUE, // End of line
+ message: 'Warning message',
+ severity: wrapper.monaco.MarkerSeverity.Warning // Info, Warning, or Error
+ }
+]);
+
+// Clear markers
+wrapper.setMarkers('sourceId', []);
+```
+
+**Getting Cursor Position:**
+
+```javascript
+// ❌ OLD (ACE API)
+const cursor = editor.getCursorPosition(); // { row: 5, column: 10 } (0-indexed)
+
+// ✅ NEW (Wrapper)
+const position = wrapper.getPosition(); // { lineNumber: 6, column: 11 } (1-indexed)
+
+// ✅ ALTERNATIVE (Direct Monaco)
+const position = wrapper.editor.getPosition();
+```
+
+**Getting Selection:**
+
+```javascript
+// ❌ OLD (ACE API)
+const range = editor.getSelection().getRange();
+
+// ✅ NEW (Wrapper)
+const selection = wrapper.getSelection();
+
+// ✅ ALTERNATIVE (Direct Monaco)
+const selection = wrapper.editor.getSelection();
+```
+
+#### API Comparison Table
+
+| Operation | ACE API (Deprecated) | Monaco Wrapper (Recommended) | Direct Monaco API |
+|-----------|---------------------|------------------------------|-------------------|
+| Get value | `editor.getSession().getValue()` | `wrapper.getValue()` | `editor.getModel().getValue()` |
+| Set value | `editor.getSession().setValue(v)` | `wrapper.setValue(v)` | `editor.getModel().setValue(v)` |
+| Insert text | `editor.insert(text)` | `wrapper.insert(text)` | Complex - use wrapper |
+| Get position | `editor.getCursorPosition()` | `wrapper.getPosition()` | `editor.getPosition()` |
+| Get selection | `editor.getSelection()` | `wrapper.getSelection()` | `editor.getSelection()` |
+| Set annotations | `editor.getSession().setAnnotations()` | `wrapper.setMarkers(id, markers)` | `monaco.editor.setModelMarkers()` |
+| Focus editor | `editor.focus()` | `wrapper.focus()` | `editor.focus()` |
+| Set language | N/A | `wrapper.setLanguage(lang)` | Complex - use wrapper |
+
+#### Migration Checklist for Plugin Developers
+
+If your plugin interacts with the CodeEditor widget, follow these steps:
+
+1. **Update Editor Instance Access:**
+ - ✅ Keep: `.data('oc.codeEditor')` - Returns the wrapper
+ - ⚠️ Avoid: `.data('oc.codeEditor').editor` - Returns raw Monaco (advanced use only)
+
+2. **Replace ACE Session Methods:**
+ - ❌ Remove all: `getSession().getValue()` → ✅ Use: `getValue()`
+ - ❌ Remove all: `getSession().setValue()` → ✅ Use: `setValue()`
+
+3. **Update Annotations:**
+ - ❌ Remove: `getSession().setAnnotations(annotations)`
+ - ✅ Add: `wrapper.setMarkers(sourceId, markers)`
+ - ⚠️ Remember: Convert 0-indexed row/column to 1-indexed line/column
+ - Use `wrapper.monaco.MarkerSeverity` for severity constants
+
+4. **Test Thoroughly:**
+ - Verify all editor interactions work
+ - Check that cursor operations use correct indexing
+ - Ensure markers/warnings display correctly
+
+#### Available Wrapper Methods
+
+The Monaco Snowboard editor wrapper provides these convenience methods:
+
+```javascript
+const wrapper = $('[data-control=codeeditor]').data('oc.codeEditor');
+
+// Content
+wrapper.getValue() // Get editor content
+wrapper.setValue(value) // Set editor content
+wrapper.insert(text) // Insert at cursor position
+
+// Position & Selection
+wrapper.getPosition() // Get cursor position (1-indexed)
+wrapper.getSelection() // Get selection range
+
+// Markers (Errors/Warnings/Info with squiggly underlines)
+wrapper.setMarkers(sourceId, markers) // Set error/warning markers in editor
+// Example: wrapper.setMarkers('myPlugin', [{ startLineNumber: 5, startColumn: 1,
+// endLineNumber: 5, endColumn: Number.MAX_VALUE, message: 'Warning',
+// severity: wrapper.monaco.MarkerSeverity.Warning }])
+
+// Decorations (Visual highlights WITHOUT error semantics)
+wrapper.setDecorations(sourceId, decorations) // Set visual highlights (no squiggles)
+// Example: wrapper.setDecorations('myHighlight', [{ range: new monaco.Range(5, 1, 5, Number.MAX_VALUE),
+// options: { isWholeLine: true, className: 'myHighlightClass',
+// linesDecorationsClassName: 'myGutterClass' } }])
+
+// Configuration
+wrapper.setLanguage(lang) // Change syntax highlighting language
+wrapper.setTheme(theme) // Change color theme
+wrapper.focus() // Focus the editor
+
+// View
+wrapper.enterFullscreen() // Enter fullscreen mode
+wrapper.exitFullscreen() // Exit fullscreen mode
+wrapper.refresh() // Refresh editor (re-create instance)
+
+// Direct Access (Advanced)
+wrapper.editor // Access Monaco editor instance
+wrapper.getEditor() // Same as wrapper.editor
+wrapper.getModel() // Get Monaco model
+wrapper.monaco // Access Monaco namespace (for constants like MarkerSeverity)
+```
+
+#### Example: Winter.Builder Plugin Migration
+
+The Winter.Builder plugin was migrated to use Monaco API. Here's a real example:
+
+**Before (ACE):**
+```javascript
+Localization.prototype.copyStringsFromDone = function(data) {
+ var codeEditor = this.getCodeEditor($masterTabPane);
+
+ // Set value using ACE Session API
+ codeEditor.getSession().setValue(responseData.strings);
+
+ // Set annotations using ACE
+ var annotations = [];
+ for (var i = 0; i < updatedLines.length; i++) {
+ annotations.push({
+ row: updatedLines[i], // 0-indexed
+ column: 0,
+ text: 'New String',
+ type: 'warning'
+ });
+ }
+ codeEditor.getSession().setAnnotations(annotations);
+}
+```
+
+**After (Monaco):**
+```javascript
+Localization.prototype.copyStringsFromDone = function(data) {
+ var wrapper = this.getCodeEditor($masterTabPane);
+
+ // Set value using wrapper method
+ wrapper.setValue(responseData.strings);
+
+ // Convert to Monaco decorations (visual highlights without error semantics)
+ var decorations = [];
+ for (var i = 0; i < updatedLines.length; i++) {
+ decorations.push({
+ range: new wrapper.monaco.Range(
+ updatedLines[i] + 1, // Convert to 1-indexed!
+ 1, // Start column
+ updatedLines[i] + 1, // End line (same line)
+ Number.MAX_VALUE // End column (end of line)
+ ),
+ options: {
+ isWholeLine: true,
+ className: 'builder-new-translation-line', // Background highlight
+ linesDecorationsClassName: 'builder-new-translation-gutter', // Gutter indicator
+ hoverMessage: { value: 'New string or section' } // Tooltip on hover
+ }
+ });
+ }
+ wrapper.setDecorations('builderLocalization', decorations);
+}
+```
+
+## Testing
+
+### Playwright E2E Tests
+
+Comprehensive test suite with 55+ tests:
+
+```bash
+# Run all tests
+npm run test:e2e
+
+# Run with UI
+npm run test:e2e:ui
+
+# Run specific test file
+npx playwright test fullscreen.spec.js
+
+# Debug tests
+npm run test:e2e:debug
+```
+
+### Test Coverage
+
+- **Fullscreen functionality** (6 tests)
+- **Theme loading and switching** (9 tests)
+- **Language support** (14 tests for all 15 languages)
+- **Monaco features** (14 tests: find, replace, folding, multi-cursor, etc.)
+- **Preferences persistence** (12 tests)
+
+See `tests/e2e/README-TESTING.md` for full testing documentation.
+
+## Resources
+
+- **Monaco Editor Documentation:** https://microsoft.github.io/monaco-editor/
+- **Monaco Editor GitHub:** https://github.com/microsoft/monaco-editor
+- **VS Code Themes:** https://marketplace.visualstudio.com/search?target=VSCode&category=Themes
+- **Winter CMS Docs:** https://wintercms.com/docs
+- **PR #801:** https://github.com/wintercms/winter/pull/801
+- **Issue #431:** https://github.com/wintercms/winter/issues/431
diff --git a/modules/backend/formwidgets/codeeditor/assets/css/codeeditor.css b/modules/backend/formwidgets/codeeditor/assets/css/codeeditor.css
index 8f8aaa18b5..36214a76c6 100644
--- a/modules/backend/formwidgets/codeeditor/assets/css/codeeditor.css
+++ b/modules/backend/formwidgets/codeeditor/assets/css/codeeditor.css
@@ -1,27 +1 @@
-.field-codeeditor{width:100%;position:relative;border:2px solid #d1d6d9;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}
-.field-codeeditor textarea{opacity:0;filter:alpha(opacity=0)}
-.field-codeeditor.editor-focus{border:2px solid #d1d6d9}
-.field-codeeditor.size-tiny{min-height:50px}
-.field-codeeditor.size-small{min-height:100px}
-.field-codeeditor.size-large{min-height:200px}
-.field-codeeditor.size-huge{min-height:250px}
-.field-codeeditor.size-giant{min-height:350px}
-.field-codeeditor .ace_search{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;color:#333;z-index:13}
-.field-codeeditor .ace_search .ace_search_form.ace_nomatch{outline:none !important}
-.field-codeeditor .ace_search .ace_search_form.ace_nomatch .ace_search_field{border:0.0625rem solid red;-webkit-box-shadow:0 0 0.1875rem 0.125rem red;box-shadow:0 0 0.1875rem 0.125rem red;z-index:1;position:relative}
-.field-codeeditor .editor-code{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}
-.field-codeeditor .editor-toolbar{position:absolute;padding:0 5px;bottom:10px;right:25px;z-index:10;background:rgba(0,0,0,0.8);border-radius:5px}
-.field-codeeditor .editor-toolbar>ul,
-.field-codeeditor .editor-toolbar ul>li{list-style-type:none;padding:0;margin:0}
-.field-codeeditor .editor-toolbar>ul>li{float:left}
-.field-codeeditor .editor-toolbar>ul>li .tooltip.left{margin-right:25px}
-.field-codeeditor .editor-toolbar>ul>li>a{display:block;height:25px;width:25px;color:#666;font-size:20px;text-align:center;text-decoration:none;text-shadow:0 0 5px #000}
-.field-codeeditor .editor-toolbar>ul>li>a>abbr{position:absolute;font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}
-.field-codeeditor .editor-toolbar>ul>li>a>i{opacity:1;filter:alpha(opacity=100);display:block}
-.field-codeeditor .editor-toolbar>ul>li>a>i:before{font-size:15px}
-.field-codeeditor .editor-toolbar>ul>li>a:hover>i,
-.field-codeeditor .editor-toolbar>ul>li>a:focus>i{opacity:1;filter:alpha(opacity=100);color:#fff}
-.field-codeeditor.editor-fullscreen{z-index:301;position:fixed !important;top:0;left:0;height:100%;border-width:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}
-.field-codeeditor.editor-fullscreen .editor-toolbar{z-index:302}
-.field-codeeditor.editor-fullscreen .editor-code{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}
-.field-codeeditor.editor-fullscreen .ace_search{z-index:303}
\ No newline at end of file
+.field-codeeditor{border:2px solid #d1d6d9;border-radius:3px;display:flex;flex-direction:column;position:relative;width:100%}.field-codeeditor.editor-focus{border:2px solid #d1d6d9}.field-codeeditor .editor-code{border-radius:3px}.field-codeeditor.size-tiny{height:50px}.field-codeeditor.size-small{height:100px}.field-codeeditor.size-large{height:200px}.field-codeeditor.size-huge{height:250px}.field-codeeditor.size-giant{height:350px}.field-codeeditor .editor-container{flex-grow:1;flex-shrink:1;height:100%;width:100%}.field-codeeditor .editor-toolbar{align-items:center;background:rgba(0,0,0,.8);display:flex;flex-direction:row;flex-grow:0;flex-shrink:0;font-size:11px;gap:20px;height:24px;padding:2px 8px;position:relative;z-index:10}.field-codeeditor .editor-toolbar:before{background:rgba(0,0,0,.08);content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:9}.field-codeeditor .editor-toolbar.is-dark:before{background:hsla(0,0%,100%,.08)}.field-codeeditor .editor-toolbar>div{z-index:11}.field-codeeditor .editor-toolbar .position{flex-grow:1}.field-codeeditor .editor-toolbar .actions .action{color:inherit;font-size:1.1rem;margin:-2px 0;opacity:.4;padding:0 5px}.field-codeeditor .editor-toolbar .actions .action:hover{opacity:.8}.field-codeeditor .editor-toolbar .actions .action.active{opacity:1}@font-face{font-display:block;font-family:codicon;src:url(../fonts/codicon.ttf?9d44d5a6cc2c9ad0152755e704fa37ba) format("truetype")}.codicon[class*=codicon-]{text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;font:normal normal normal 16px/1 codicon;text-align:center;text-decoration:none;-moz-user-select:none;user-select:none;-webkit-user-select:none;-ms-user-select:none}@keyframes codicon-spin{to{transform:rotate(1turn)}}.codicon-gear.codicon-modifier-spin,.codicon-loading.codicon-modifier-spin,.codicon-sync.codicon-modifier-spin{animation:codicon-spin 1.5s steps(30) infinite}.codicon-modifier-disabled{opacity:.5}.codicon-modifier-hidden{opacity:0}.codicon-loading{animation-duration:1s!important;animation-timing-function:cubic-bezier(.53,.21,.29,.67)!important}.codicon-add:before,.codicon-gist-new:before,.codicon-plus:before,.codicon-repo-create:before{content:"\ea60"}.codicon-light-bulb:before,.codicon-lightbulb:before{content:"\ea61"}.codicon-repo-delete:before,.codicon-repo:before{content:"\ea62"}.codicon-gist-fork:before,.codicon-repo-forked:before{content:"\ea63"}.codicon-git-pull-request-abandoned:before,.codicon-git-pull-request:before{content:"\ea64"}.codicon-keyboard:before,.codicon-record-keys:before{content:"\ea65"}.codicon-tag-add:before,.codicon-tag-remove:before,.codicon-tag:before{content:"\ea66"}.codicon-person-filled:before,.codicon-person-follow:before,.codicon-person-outline:before,.codicon-person:before{content:"\ea67"}.codicon-git-branch-create:before,.codicon-git-branch-delete:before,.codicon-git-branch:before,.codicon-source-control:before{content:"\ea68"}.codicon-mirror-public:before,.codicon-mirror:before{content:"\ea69"}.codicon-star-add:before,.codicon-star-delete:before,.codicon-star-empty:before,.codicon-star:before{content:"\ea6a"}.codicon-comment-add:before,.codicon-comment:before{content:"\ea6b"}.codicon-alert:before,.codicon-warning:before{content:"\ea6c"}.codicon-search-save:before,.codicon-search:before{content:"\ea6d"}.codicon-log-out:before,.codicon-sign-out:before{content:"\ea6e"}.codicon-log-in:before,.codicon-sign-in:before{content:"\ea6f"}.codicon-eye-unwatch:before,.codicon-eye-watch:before,.codicon-eye:before{content:"\ea70"}.codicon-circle-filled:before,.codicon-close-dirty:before,.codicon-debug-breakpoint-disabled:before,.codicon-debug-breakpoint:before,.codicon-debug-hint:before,.codicon-primitive-dot:before,.codicon-terminal-decoration-success:before{content:"\ea71"}.codicon-primitive-square:before{content:"\ea72"}.codicon-edit:before,.codicon-pencil:before{content:"\ea73"}.codicon-info:before,.codicon-issue-opened:before{content:"\ea74"}.codicon-gist-private:before,.codicon-git-fork-private:before,.codicon-lock:before,.codicon-mirror-private:before{content:"\ea75"}.codicon-close:before,.codicon-remove-close:before,.codicon-x:before{content:"\ea76"}.codicon-repo-sync:before,.codicon-sync:before{content:"\ea77"}.codicon-clone:before,.codicon-desktop-download:before{content:"\ea78"}.codicon-beaker:before,.codicon-microscope:before{content:"\ea79"}.codicon-device-desktop:before,.codicon-vm:before{content:"\ea7a"}.codicon-file-text:before,.codicon-file:before{content:"\ea7b"}.codicon-ellipsis:before,.codicon-kebab-horizontal:before,.codicon-more:before{content:"\ea7c"}.codicon-mail-reply:before,.codicon-reply:before{content:"\ea7d"}.codicon-organization-filled:before,.codicon-organization-outline:before,.codicon-organization:before{content:"\ea7e"}.codicon-file-add:before,.codicon-new-file:before{content:"\ea7f"}.codicon-file-directory-create:before,.codicon-new-folder:before{content:"\ea80"}.codicon-trash:before,.codicon-trashcan:before{content:"\ea81"}.codicon-clock:before,.codicon-history:before{content:"\ea82"}.codicon-file-directory:before,.codicon-folder:before,.codicon-symbol-folder:before{content:"\ea83"}.codicon-github:before,.codicon-logo-github:before,.codicon-mark-github:before{content:"\ea84"}.codicon-console:before,.codicon-repl:before,.codicon-terminal:before{content:"\ea85"}.codicon-symbol-event:before,.codicon-zap:before{content:"\ea86"}.codicon-error:before,.codicon-stop:before{content:"\ea87"}.codicon-symbol-variable:before,.codicon-variable:before{content:"\ea88"}.codicon-array:before,.codicon-symbol-array:before{content:"\ea8a"}.codicon-symbol-module:before,.codicon-symbol-namespace:before,.codicon-symbol-object:before,.codicon-symbol-package:before{content:"\ea8b"}.codicon-symbol-constructor:before,.codicon-symbol-function:before,.codicon-symbol-method:before{content:"\ea8c"}.codicon-symbol-boolean:before,.codicon-symbol-null:before{content:"\ea8f"}.codicon-symbol-number:before,.codicon-symbol-numeric:before{content:"\ea90"}.codicon-symbol-struct:before,.codicon-symbol-structure:before{content:"\ea91"}.codicon-symbol-parameter:before,.codicon-symbol-type-parameter:before{content:"\ea92"}.codicon-symbol-key:before,.codicon-symbol-text:before{content:"\ea93"}.codicon-go-to-file:before,.codicon-symbol-reference:before{content:"\ea94"}.codicon-symbol-enum:before,.codicon-symbol-value:before{content:"\ea95"}.codicon-symbol-ruler:before,.codicon-symbol-unit:before{content:"\ea96"}.codicon-activate-breakpoints:before{content:"\ea97"}.codicon-archive:before{content:"\ea98"}.codicon-arrow-both:before{content:"\ea99"}.codicon-arrow-down:before{content:"\ea9a"}.codicon-arrow-left:before{content:"\ea9b"}.codicon-arrow-right:before{content:"\ea9c"}.codicon-arrow-small-down:before{content:"\ea9d"}.codicon-arrow-small-left:before{content:"\ea9e"}.codicon-arrow-small-right:before{content:"\ea9f"}.codicon-arrow-small-up:before{content:"\eaa0"}.codicon-arrow-up:before{content:"\eaa1"}.codicon-bell:before{content:"\eaa2"}.codicon-bold:before{content:"\eaa3"}.codicon-book:before{content:"\eaa4"}.codicon-bookmark:before{content:"\eaa5"}.codicon-debug-breakpoint-conditional-unverified:before{content:"\eaa6"}.codicon-debug-breakpoint-conditional-disabled:before,.codicon-debug-breakpoint-conditional:before{content:"\eaa7"}.codicon-debug-breakpoint-data-unverified:before{content:"\eaa8"}.codicon-debug-breakpoint-data-disabled:before,.codicon-debug-breakpoint-data:before{content:"\eaa9"}.codicon-debug-breakpoint-log-unverified:before{content:"\eaaa"}.codicon-debug-breakpoint-log-disabled:before,.codicon-debug-breakpoint-log:before{content:"\eaab"}.codicon-briefcase:before{content:"\eaac"}.codicon-broadcast:before{content:"\eaad"}.codicon-browser:before{content:"\eaae"}.codicon-bug:before{content:"\eaaf"}.codicon-calendar:before{content:"\eab0"}.codicon-case-sensitive:before{content:"\eab1"}.codicon-check:before{content:"\eab2"}.codicon-checklist:before{content:"\eab3"}.codicon-chevron-down:before{content:"\eab4"}.codicon-chevron-left:before{content:"\eab5"}.codicon-chevron-right:before{content:"\eab6"}.codicon-chevron-up:before{content:"\eab7"}.codicon-chrome-close:before{content:"\eab8"}.codicon-chrome-maximize:before{content:"\eab9"}.codicon-chrome-minimize:before{content:"\eaba"}.codicon-chrome-restore:before{content:"\eabb"}.codicon-circle-outline:before,.codicon-circle:before,.codicon-debug-breakpoint-unverified:before,.codicon-terminal-decoration-incomplete:before{content:"\eabc"}.codicon-circle-slash:before{content:"\eabd"}.codicon-circuit-board:before{content:"\eabe"}.codicon-clear-all:before{content:"\eabf"}.codicon-clippy:before{content:"\eac0"}.codicon-close-all:before{content:"\eac1"}.codicon-cloud-download:before{content:"\eac2"}.codicon-cloud-upload:before{content:"\eac3"}.codicon-code:before{content:"\eac4"}.codicon-collapse-all:before{content:"\eac5"}.codicon-color-mode:before{content:"\eac6"}.codicon-comment-discussion:before{content:"\eac7"}.codicon-credit-card:before{content:"\eac9"}.codicon-dash:before{content:"\eacc"}.codicon-dashboard:before{content:"\eacd"}.codicon-database:before{content:"\eace"}.codicon-debug-continue:before{content:"\eacf"}.codicon-debug-disconnect:before{content:"\ead0"}.codicon-debug-pause:before{content:"\ead1"}.codicon-debug-restart:before{content:"\ead2"}.codicon-debug-start:before{content:"\ead3"}.codicon-debug-step-into:before{content:"\ead4"}.codicon-debug-step-out:before{content:"\ead5"}.codicon-debug-step-over:before{content:"\ead6"}.codicon-debug-stop:before{content:"\ead7"}.codicon-debug:before{content:"\ead8"}.codicon-device-camera-video:before{content:"\ead9"}.codicon-device-camera:before{content:"\eada"}.codicon-device-mobile:before{content:"\eadb"}.codicon-diff-added:before{content:"\eadc"}.codicon-diff-ignored:before{content:"\eadd"}.codicon-diff-modified:before{content:"\eade"}.codicon-diff-removed:before{content:"\eadf"}.codicon-diff-renamed:before{content:"\eae0"}.codicon-diff:before{content:"\eae1"}.codicon-discard:before{content:"\eae2"}.codicon-editor-layout:before{content:"\eae3"}.codicon-empty-window:before{content:"\eae4"}.codicon-exclude:before{content:"\eae5"}.codicon-extensions:before{content:"\eae6"}.codicon-eye-closed:before{content:"\eae7"}.codicon-file-binary:before{content:"\eae8"}.codicon-file-code:before{content:"\eae9"}.codicon-file-media:before{content:"\eaea"}.codicon-file-pdf:before{content:"\eaeb"}.codicon-file-submodule:before{content:"\eaec"}.codicon-file-symlink-directory:before{content:"\eaed"}.codicon-file-symlink-file:before{content:"\eaee"}.codicon-file-zip:before{content:"\eaef"}.codicon-files:before{content:"\eaf0"}.codicon-filter:before{content:"\eaf1"}.codicon-flame:before{content:"\eaf2"}.codicon-fold-down:before{content:"\eaf3"}.codicon-fold-up:before{content:"\eaf4"}.codicon-fold:before{content:"\eaf5"}.codicon-folder-active:before{content:"\eaf6"}.codicon-folder-opened:before{content:"\eaf7"}.codicon-gear:before{content:"\eaf8"}.codicon-gift:before{content:"\eaf9"}.codicon-gist-secret:before{content:"\eafa"}.codicon-gist:before{content:"\eafb"}.codicon-git-commit:before{content:"\eafc"}.codicon-compare-changes:before,.codicon-git-compare:before{content:"\eafd"}.codicon-git-merge:before{content:"\eafe"}.codicon-github-action:before{content:"\eaff"}.codicon-github-alt:before{content:"\eb00"}.codicon-globe:before{content:"\eb01"}.codicon-grabber:before{content:"\eb02"}.codicon-graph:before{content:"\eb03"}.codicon-gripper:before{content:"\eb04"}.codicon-heart:before{content:"\eb05"}.codicon-home:before{content:"\eb06"}.codicon-horizontal-rule:before{content:"\eb07"}.codicon-hubot:before{content:"\eb08"}.codicon-inbox:before{content:"\eb09"}.codicon-issue-reopened:before{content:"\eb0b"}.codicon-issues:before{content:"\eb0c"}.codicon-italic:before{content:"\eb0d"}.codicon-jersey:before{content:"\eb0e"}.codicon-json:before{content:"\eb0f"}.codicon-kebab-vertical:before{content:"\eb10"}.codicon-key:before{content:"\eb11"}.codicon-law:before{content:"\eb12"}.codicon-lightbulb-autofix:before{content:"\eb13"}.codicon-link-external:before{content:"\eb14"}.codicon-link:before{content:"\eb15"}.codicon-list-ordered:before{content:"\eb16"}.codicon-list-unordered:before{content:"\eb17"}.codicon-live-share:before{content:"\eb18"}.codicon-loading:before{content:"\eb19"}.codicon-location:before{content:"\eb1a"}.codicon-mail-read:before{content:"\eb1b"}.codicon-mail:before{content:"\eb1c"}.codicon-markdown:before{content:"\eb1d"}.codicon-megaphone:before{content:"\eb1e"}.codicon-mention:before{content:"\eb1f"}.codicon-milestone:before{content:"\eb20"}.codicon-mortar-board:before{content:"\eb21"}.codicon-move:before{content:"\eb22"}.codicon-multiple-windows:before{content:"\eb23"}.codicon-mute:before{content:"\eb24"}.codicon-no-newline:before{content:"\eb25"}.codicon-note:before{content:"\eb26"}.codicon-octoface:before{content:"\eb27"}.codicon-open-preview:before{content:"\eb28"}.codicon-package:before{content:"\eb29"}.codicon-paintcan:before{content:"\eb2a"}.codicon-pin:before{content:"\eb2b"}.codicon-play:before,.codicon-run:before{content:"\eb2c"}.codicon-plug:before{content:"\eb2d"}.codicon-preserve-case:before{content:"\eb2e"}.codicon-preview:before{content:"\eb2f"}.codicon-project:before{content:"\eb30"}.codicon-pulse:before{content:"\eb31"}.codicon-question:before{content:"\eb32"}.codicon-quote:before{content:"\eb33"}.codicon-radio-tower:before{content:"\eb34"}.codicon-reactions:before{content:"\eb35"}.codicon-references:before{content:"\eb36"}.codicon-refresh:before{content:"\eb37"}.codicon-regex:before{content:"\eb38"}.codicon-remote-explorer:before{content:"\eb39"}.codicon-remote:before{content:"\eb3a"}.codicon-remove:before{content:"\eb3b"}.codicon-replace-all:before{content:"\eb3c"}.codicon-replace:before{content:"\eb3d"}.codicon-repo-clone:before{content:"\eb3e"}.codicon-repo-force-push:before{content:"\eb3f"}.codicon-repo-pull:before{content:"\eb40"}.codicon-repo-push:before{content:"\eb41"}.codicon-report:before{content:"\eb42"}.codicon-request-changes:before{content:"\eb43"}.codicon-rocket:before{content:"\eb44"}.codicon-root-folder-opened:before{content:"\eb45"}.codicon-root-folder:before{content:"\eb46"}.codicon-rss:before{content:"\eb47"}.codicon-ruby:before{content:"\eb48"}.codicon-save-all:before{content:"\eb49"}.codicon-save-as:before{content:"\eb4a"}.codicon-save:before{content:"\eb4b"}.codicon-screen-full:before{content:"\eb4c"}.codicon-screen-normal:before{content:"\eb4d"}.codicon-search-stop:before{content:"\eb4e"}.codicon-server:before{content:"\eb50"}.codicon-settings-gear:before{content:"\eb51"}.codicon-settings:before{content:"\eb52"}.codicon-shield:before{content:"\eb53"}.codicon-smiley:before{content:"\eb54"}.codicon-sort-precedence:before{content:"\eb55"}.codicon-split-horizontal:before{content:"\eb56"}.codicon-split-vertical:before{content:"\eb57"}.codicon-squirrel:before{content:"\eb58"}.codicon-star-full:before{content:"\eb59"}.codicon-star-half:before{content:"\eb5a"}.codicon-symbol-class:before{content:"\eb5b"}.codicon-symbol-color:before{content:"\eb5c"}.codicon-symbol-constant:before{content:"\eb5d"}.codicon-symbol-enum-member:before{content:"\eb5e"}.codicon-symbol-field:before{content:"\eb5f"}.codicon-symbol-file:before{content:"\eb60"}.codicon-symbol-interface:before{content:"\eb61"}.codicon-symbol-keyword:before{content:"\eb62"}.codicon-symbol-misc:before{content:"\eb63"}.codicon-symbol-operator:before{content:"\eb64"}.codicon-symbol-property:before,.codicon-wrench-subaction:before,.codicon-wrench:before{content:"\eb65"}.codicon-symbol-snippet:before{content:"\eb66"}.codicon-tasklist:before{content:"\eb67"}.codicon-telescope:before{content:"\eb68"}.codicon-text-size:before{content:"\eb69"}.codicon-three-bars:before{content:"\eb6a"}.codicon-thumbsdown:before{content:"\eb6b"}.codicon-thumbsup:before{content:"\eb6c"}.codicon-tools:before{content:"\eb6d"}.codicon-triangle-down:before{content:"\eb6e"}.codicon-triangle-left:before{content:"\eb6f"}.codicon-triangle-right:before{content:"\eb70"}.codicon-triangle-up:before{content:"\eb71"}.codicon-twitter:before{content:"\eb72"}.codicon-unfold:before{content:"\eb73"}.codicon-unlock:before{content:"\eb74"}.codicon-unmute:before{content:"\eb75"}.codicon-unverified:before{content:"\eb76"}.codicon-verified:before{content:"\eb77"}.codicon-versions:before{content:"\eb78"}.codicon-vm-active:before{content:"\eb79"}.codicon-vm-outline:before{content:"\eb7a"}.codicon-vm-running:before{content:"\eb7b"}.codicon-watch:before{content:"\eb7c"}.codicon-whitespace:before{content:"\eb7d"}.codicon-whole-word:before{content:"\eb7e"}.codicon-window:before{content:"\eb7f"}.codicon-word-wrap:before{content:"\eb80"}.codicon-zoom-in:before{content:"\eb81"}.codicon-zoom-out:before{content:"\eb82"}.codicon-list-filter:before{content:"\eb83"}.codicon-list-flat:before{content:"\eb84"}.codicon-list-selection:before,.codicon-selection:before{content:"\eb85"}.codicon-list-tree:before{content:"\eb86"}.codicon-debug-breakpoint-function-unverified:before{content:"\eb87"}.codicon-debug-breakpoint-function-disabled:before,.codicon-debug-breakpoint-function:before{content:"\eb88"}.codicon-debug-stackframe-active:before{content:"\eb89"}.codicon-circle-small-filled:before,.codicon-debug-stackframe-dot:before,.codicon-terminal-decoration-mark:before{content:"\eb8a"}.codicon-debug-stackframe-focused:before,.codicon-debug-stackframe:before{content:"\eb8b"}.codicon-debug-breakpoint-unsupported:before{content:"\eb8c"}.codicon-symbol-string:before{content:"\eb8d"}.codicon-debug-reverse-continue:before{content:"\eb8e"}.codicon-debug-step-back:before{content:"\eb8f"}.codicon-debug-restart-frame:before{content:"\eb90"}.codicon-debug-alt:before{content:"\eb91"}.codicon-call-incoming:before{content:"\eb92"}.codicon-call-outgoing:before{content:"\eb93"}.codicon-menu:before{content:"\eb94"}.codicon-expand-all:before{content:"\eb95"}.codicon-feedback:before{content:"\eb96"}.codicon-group-by-ref-type:before{content:"\eb97"}.codicon-ungroup-by-ref-type:before{content:"\eb98"}.codicon-account:before{content:"\eb99"}.codicon-bell-dot:before{content:"\eb9a"}.codicon-debug-console:before{content:"\eb9b"}.codicon-library:before{content:"\eb9c"}.codicon-output:before{content:"\eb9d"}.codicon-run-all:before{content:"\eb9e"}.codicon-sync-ignored:before{content:"\eb9f"}.codicon-pinned:before{content:"\eba0"}.codicon-github-inverted:before{content:"\eba1"}.codicon-server-process:before{content:"\eba2"}.codicon-server-environment:before{content:"\eba3"}.codicon-issue-closed:before,.codicon-pass:before{content:"\eba4"}.codicon-stop-circle:before{content:"\eba5"}.codicon-play-circle:before{content:"\eba6"}.codicon-record:before{content:"\eba7"}.codicon-debug-alt-small:before{content:"\eba8"}.codicon-vm-connect:before{content:"\eba9"}.codicon-cloud:before{content:"\ebaa"}.codicon-merge:before{content:"\ebab"}.codicon-export:before{content:"\ebac"}.codicon-graph-left:before{content:"\ebad"}.codicon-magnet:before{content:"\ebae"}.codicon-notebook:before{content:"\ebaf"}.codicon-redo:before{content:"\ebb0"}.codicon-check-all:before{content:"\ebb1"}.codicon-pinned-dirty:before{content:"\ebb2"}.codicon-pass-filled:before{content:"\ebb3"}.codicon-circle-large-filled:before{content:"\ebb4"}.codicon-circle-large-outline:before,.codicon-circle-large:before{content:"\ebb5"}.codicon-combine:before,.codicon-gather:before{content:"\ebb6"}.codicon-table:before{content:"\ebb7"}.codicon-variable-group:before{content:"\ebb8"}.codicon-type-hierarchy:before{content:"\ebb9"}.codicon-type-hierarchy-sub:before{content:"\ebba"}.codicon-type-hierarchy-super:before{content:"\ebbb"}.codicon-git-pull-request-create:before{content:"\ebbc"}.codicon-run-above:before{content:"\ebbd"}.codicon-run-below:before{content:"\ebbe"}.codicon-notebook-template:before{content:"\ebbf"}.codicon-debug-rerun:before{content:"\ebc0"}.codicon-workspace-trusted:before{content:"\ebc1"}.codicon-workspace-untrusted:before{content:"\ebc2"}.codicon-workspace-unknown:before{content:"\ebc3"}.codicon-terminal-cmd:before{content:"\ebc4"}.codicon-terminal-debian:before{content:"\ebc5"}.codicon-terminal-linux:before{content:"\ebc6"}.codicon-terminal-powershell:before{content:"\ebc7"}.codicon-terminal-tmux:before{content:"\ebc8"}.codicon-terminal-ubuntu:before{content:"\ebc9"}.codicon-terminal-bash:before{content:"\ebca"}.codicon-arrow-swap:before{content:"\ebcb"}.codicon-copy:before{content:"\ebcc"}.codicon-person-add:before{content:"\ebcd"}.codicon-filter-filled:before{content:"\ebce"}.codicon-wand:before{content:"\ebcf"}.codicon-debug-line-by-line:before{content:"\ebd0"}.codicon-inspect:before{content:"\ebd1"}.codicon-layers:before{content:"\ebd2"}.codicon-layers-dot:before{content:"\ebd3"}.codicon-layers-active:before{content:"\ebd4"}.codicon-compass:before{content:"\ebd5"}.codicon-compass-dot:before{content:"\ebd6"}.codicon-compass-active:before{content:"\ebd7"}.codicon-azure:before{content:"\ebd8"}.codicon-issue-draft:before{content:"\ebd9"}.codicon-git-pull-request-closed:before{content:"\ebda"}.codicon-git-pull-request-draft:before{content:"\ebdb"}.codicon-debug-all:before{content:"\ebdc"}.codicon-debug-coverage:before{content:"\ebdd"}.codicon-run-errors:before{content:"\ebde"}.codicon-folder-library:before{content:"\ebdf"}.codicon-debug-continue-small:before{content:"\ebe0"}.codicon-beaker-stop:before{content:"\ebe1"}.codicon-graph-line:before{content:"\ebe2"}.codicon-graph-scatter:before{content:"\ebe3"}.codicon-pie-chart:before{content:"\ebe4"}.codicon-bracket:before{content:"\eb0f"}.codicon-bracket-dot:before{content:"\ebe5"}.codicon-bracket-error:before{content:"\ebe6"}.codicon-lock-small:before{content:"\ebe7"}.codicon-azure-devops:before{content:"\ebe8"}.codicon-verified-filled:before{content:"\ebe9"}.codicon-newline:before{content:"\ebea"}.codicon-layout:before{content:"\ebeb"}.codicon-layout-activitybar-left:before{content:"\ebec"}.codicon-layout-activitybar-right:before{content:"\ebed"}.codicon-layout-panel-left:before{content:"\ebee"}.codicon-layout-panel-center:before{content:"\ebef"}.codicon-layout-panel-justify:before{content:"\ebf0"}.codicon-layout-panel-right:before{content:"\ebf1"}.codicon-layout-panel:before{content:"\ebf2"}.codicon-layout-sidebar-left:before{content:"\ebf3"}.codicon-layout-sidebar-right:before{content:"\ebf4"}.codicon-layout-statusbar:before{content:"\ebf5"}.codicon-layout-menubar:before{content:"\ebf6"}.codicon-layout-centered:before{content:"\ebf7"}.codicon-target:before{content:"\ebf8"}.codicon-indent:before{content:"\ebf9"}.codicon-record-small:before{content:"\ebfa"}.codicon-error-small:before,.codicon-terminal-decoration-error:before{content:"\ebfb"}.codicon-arrow-circle-down:before{content:"\ebfc"}.codicon-arrow-circle-left:before{content:"\ebfd"}.codicon-arrow-circle-right:before{content:"\ebfe"}.codicon-arrow-circle-up:before{content:"\ebff"}.codicon-layout-sidebar-right-off:before{content:"\ec00"}.codicon-layout-panel-off:before{content:"\ec01"}.codicon-layout-sidebar-left-off:before{content:"\ec02"}.codicon-blank:before{content:"\ec03"}.codicon-heart-filled:before{content:"\ec04"}.codicon-map:before{content:"\ec05"}.codicon-map-filled:before{content:"\ec06"}.codicon-circle-small:before{content:"\ec07"}.codicon-bell-slash:before{content:"\ec08"}.codicon-bell-slash-dot:before{content:"\ec09"}.codicon-comment-unresolved:before{content:"\ec0a"}.codicon-git-pull-request-go-to-changes:before{content:"\ec0b"}.codicon-git-pull-request-new-changes:before{content:"\ec0c"}.codicon-search-fuzzy:before{content:"\ec0d"}.codicon-comment-draft:before{content:"\ec0e"}
diff --git a/modules/backend/formwidgets/codeeditor/assets/fonts/codicon.ttf b/modules/backend/formwidgets/codeeditor/assets/fonts/codicon.ttf
new file mode 100644
index 0000000000..6d9ce31e08
Binary files /dev/null and b/modules/backend/formwidgets/codeeditor/assets/fonts/codicon.ttf differ
diff --git a/modules/backend/formwidgets/codeeditor/assets/js/build-min.js b/modules/backend/formwidgets/codeeditor/assets/js/build-min.js
deleted file mode 100644
index 4a6c376976..0000000000
--- a/modules/backend/formwidgets/codeeditor/assets/js/build-min.js
+++ /dev/null
@@ -1,2381 +0,0 @@
-var _=(function(){var root=this;var previousUnderscore=root._;var breaker={};var ArrayProto=Array.prototype,ObjProto=Object.prototype,FuncProto=Function.prototype;var slice=ArrayProto.slice,unshift=ArrayProto.unshift,toString=ObjProto.toString,hasOwnProperty=ObjProto.hasOwnProperty;var nativeForEach=ArrayProto.forEach,nativeMap=ArrayProto.map,nativeReduce=ArrayProto.reduce,nativeReduceRight=ArrayProto.reduceRight,nativeFilter=ArrayProto.filter,nativeEvery=ArrayProto.every,nativeSome=ArrayProto.some,nativeIndexOf=ArrayProto.indexOf,nativeLastIndexOf=ArrayProto.lastIndexOf,nativeIsArray=Array.isArray,nativeKeys=Object.keys,nativeBind=FuncProto.bind;var _=function(obj){return new wrapper(obj);};if(typeof exports!=='undefined'){if(typeof module!=='undefined'&&module.exports){exports=module.exports=_;}exports._=_;}else{root['_']=_;}_.VERSION='1.3.3';var each=_.each=_.forEach=function(obj,iterator,context){if(obj==null)return;if(nativeForEach&&obj.forEach===nativeForEach){obj.forEach(
-iterator,context);}else if(obj.length===+obj.length){for(var i=0,l=obj.length;i2;if(obj==null)obj=[];if(nativeReduce&&obj.reduce===nativeReduce){if(context)iterator=_.bind(iterator,context);return initial?obj.reduce(iterator,memo):obj.reduce(iterator);}each(obj,function(value,index,list){if(!initial){memo=value;initial=true;}else{memo=iterator.call(context,memo,value,index,list);}});if(!
-initial)throw new TypeError('Reduce of empty array with no initial value');return memo;};_.reduceRight=_.foldr=function(obj,iterator,memo,context){var initial=arguments.length>2;if(obj==null)obj=[];if(nativeReduceRight&&obj.reduceRight===nativeReduceRight){if(context)iterator=_.bind(iterator,context);return initial?obj.reduceRight(iterator,memo):obj.reduceRight(iterator);}var reversed=_.toArray(obj).reverse();if(context&&!initial)iterator=_.bind(iterator,context);return initial?_.reduce(reversed,iterator,memo,context):_.reduce(reversed,iterator);};_.find=_.detect=function(obj,iterator,context){var result;any(obj,function(value,index,list){if(iterator.call(context,value,index,list)){result=value;return true;}});return result;};_.filter=_.select=function(obj,iterator,context){var results=[];if(obj==null)return results;if(nativeFilter&&obj.filter===nativeFilter)return obj.filter(iterator,context);each(obj,function(value,index,list){if(iterator.call(context,value,index,list))results[
-results.length]=value;});return results;};_.reject=function(obj,iterator,context){var results=[];if(obj==null)return results;each(obj,function(value,index,list){if(!iterator.call(context,value,index,list))results[results.length]=value;});return results;};_.every=_.all=function(obj,iterator,context){var result=true;if(obj==null)return result;if(nativeEvery&&obj.every===nativeEvery)return obj.every(iterator,context);each(obj,function(value,index,list){if(!(result=result&&iterator.call(context,value,index,list)))return breaker;});return!!result;};var any=_.some=_.any=function(obj,iterator,context){iterator||(iterator=_.identity);var result=false;if(obj==null)return result;if(nativeSome&&obj.some===nativeSome)return obj.some(iterator,context);each(obj,function(value,index,list){if(result||(result=iterator.call(context,value,index,list)))return breaker;});return!!result;};_.include=_.contains=function(obj,target){var found=false;if(obj==null)return found;if(nativeIndexOf&&obj.indexOf===
-nativeIndexOf)return obj.indexOf(target)!=-1;found=any(obj,function(value){return value===target;});return found;};_.invoke=function(obj,method){var args=slice.call(arguments,2);return _.map(obj,function(value){return(_.isFunction(method)?method||value:value[method]).apply(value,args);});};_.pluck=function(obj,key){return _.map(obj,function(value){return value[key];});};_.max=function(obj,iterator,context){if(!iterator&&_.isArray(obj)&&obj[0]===+obj[0])return Math.max.apply(Math,obj);if(!iterator&&_.isEmpty(obj))return-Infinity;var result={computed:-Infinity};each(obj,function(value,index,list){var computed=iterator?iterator.call(context,value,index,list):value;computed>=result.computed&&(result={value:value,computed:computed});});return result.value;};_.min=function(obj,iterator,context){if(!iterator&&_.isArray(obj)&&obj[0]===+obj[0])return Math.min.apply(Math,obj);if(!iterator&&_.isEmpty(obj))return Infinity;var result={computed:Infinity};each(obj,function(value,index,list){var
-computed=iterator?iterator.call(context,value,index,list):value;computedb?1:0;}),'value');};_.groupBy=function(obj,val){var result={};var iterator=_.isFunction(val)?val:function(obj){return obj[val];};each(obj,function(value,index){var key=iterator(value,index);(result[key]||(result[key]=[])).push(value);});return result;};_.sortedIndex=function(array,obj,iterator){
-iterator||(iterator=_.identity);var low=0,high=array.length;while(low>1;iterator(array[mid])=0;});});};_.difference=function(array){var rest=_.flatten(slice.call(arguments,1),true);return _.filter(array,function(value){return!_.include(rest,value);});
-};_.zip=function(){var args=slice.call(arguments);var length=_.max(_.pluck(args,'length'));var results=new Array(length);for(var i=0;i=0;i--){args=[funcs[i].apply(this,args)];}return args[0];};};_.after=function(times,func){if(times<=0)return func();return function(){if(--times<1){return func.apply(this,arguments);}};};_.keys=nativeKeys||function(obj){if(obj!==Object(obj))throw new TypeError('Invalid object');var keys=[];for(var key in obj)if(_.has(obj,key))keys[keys.length]=key;return keys;};_.values=function(obj){return _.map(obj,_.identity);};_.functions=_.methods=function(obj){var names=[];for(var key in obj){if(_.isFunction(obj[key]))names.push(key);}return names.sort();};_.extend=function(obj){each(slice.call(arguments,1),function(source){for(var prop in source){obj[prop]=source[prop];}});return obj;};_.pick=function(obj){var result={};each(_.flatten(slice.call(arguments,1)),function(key){if(key in obj)result[key]=obj[key];});return result;};_.defaults=
-function(obj){each(slice.call(arguments,1),function(source){for(var prop in source){if(obj[prop]==null)obj[prop]=source[prop];}});return obj;};_.clone=function(obj){if(!_.isObject(obj))return obj;return _.isArray(obj)?obj.slice():_.extend({},obj);};_.tap=function(obj,interceptor){interceptor(obj);return obj;};function eq(a,b,stack){if(a===b)return a!==0||1/a==1/b;if(a==null||b==null)return a===b;if(a._chain)a=a._wrapped;if(b._chain)b=b._wrapped;if(a.isEqual&&_.isFunction(a.isEqual))return a.isEqual(b);if(b.isEqual&&_.isFunction(b.isEqual))return b.isEqual(a);var className=toString.call(a);if(className!=toString.call(b))return false;switch(className){case'[object String]':return a==String(b);case'[object Number]':return a!=+a?b!=+b:(a==0?1/a==1/b:a==+b);case'[object Date]':case'[object Boolean]':return+a==+b;case'[object RegExp]':return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase;}if(typeof a!='object'||typeof b!='object')return false;var
-length=stack.length;while(length--){if(stack[length]==a)return true;}stack.push(a);var size=0,result=true;if(className=='[object Array]'){size=a.length;result=size==b.length;if(result){while(size--){if(!(result=size in a==size in b&&eq(a[size],b[size],stack)))break;}}}else{if('constructor'in a!='constructor'in b||a.constructor!=b.constructor)return false;for(var key in a){if(_.has(a,key)){size++;if(!(result=_.has(b,key)&&eq(a[key],b[key],stack)))break;}}if(result){for(key in b){if(_.has(b,key)&&!(size--))break;}result=!size;}}stack.pop();return result;}_.isEqual=function(a,b){return eq(a,b,[]);};_.isEmpty=function(obj){if(obj==null)return true;if(_.isArray(obj)||_.isString(obj))return obj.length===0;for(var key in obj)if(_.has(obj,key))return false;return true;};_.isElement=function(obj){return!!(obj&&obj.nodeType==1);};_.isArray=nativeIsArray||function(obj){return toString.call(obj)=='[object Array]';};_.isObject=function(obj){return obj===Object(obj);};_.isArguments=function(obj){
-return toString.call(obj)=='[object Arguments]';};if(!_.isArguments(arguments)){_.isArguments=function(obj){return!!(obj&&_.has(obj,'callee'));};}_.isFunction=function(obj){return toString.call(obj)=='[object Function]';};_.isString=function(obj){return toString.call(obj)=='[object String]';};_.isNumber=function(obj){return toString.call(obj)=='[object Number]';};_.isFinite=function(obj){return _.isNumber(obj)&&isFinite(obj);};_.isNaN=function(obj){return obj!==obj;};_.isBoolean=function(obj){return obj===true||obj===false||toString.call(obj)=='[object Boolean]';};_.isDate=function(obj){return toString.call(obj)=='[object Date]';};_.isRegExp=function(obj){return toString.call(obj)=='[object RegExp]';};_.isNull=function(obj){return obj===null;};_.isUndefined=function(obj){return obj===void 0;};_.has=function(obj,key){return hasOwnProperty.call(obj,key);};_.noConflict=function(){root._=previousUnderscore;return this;};_.identity=function(value){return value;};_.times=function(n,iterator,
-context){for(var i=0;i/g,'>').replace(/"/g,'"').replace(/'/g,''').replace(/\//g,'/');};_.result=function(object,property){if(object==null)return null;var value=object[property];return _.isFunction(value)?value.call(object):value;};_.mixin=function(obj){each(_.functions(obj),function(name){addToWrapper(name,_[name]=obj[name]);});};var idCounter=0;_.uniqueId=function(prefix){var id=idCounter++;return prefix?prefix+id:id;};_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var noMatch=/.^/;var escapes={'\\':'\\',"'":"'",'r':'\r','n':'\n','t':'\t','u2028':'\u2028','u2029':'\u2029'};for(var p in escapes)escapes[escapes[p]]=p;var escaper=/\\|'|\r|\n|\t|\u2028|\u2029/g;var unescaper=/\\(\\|'|r|n|t|u2028|u2029)/g;var unescape=function(code){return code.replace(unescaper,function(match,escape){
-return escapes[escape];});};_.template=function(text,data,settings){settings=_.defaults(settings||{},_.templateSettings);var source="__p+='"+text.replace(escaper,function(match){return'\\'+escapes[match];}).replace(settings.escape||noMatch,function(match,code){return"'+\n_.escape("+unescape(code)+")+\n'";}).replace(settings.interpolate||noMatch,function(match,code){return"'+\n("+unescape(code)+")+\n'";}).replace(settings.evaluate||noMatch,function(match,code){return"';\n"+unescape(code)+"\n;__p+='";})+"';\n";if(!settings.variable)source='with(obj||{}){\n'+source+'}\n';source="var __p='';"+"var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+source+"return __p;\n";var render=new Function(settings.variable||'obj','_',source);if(data)return render(data,_);var template=function(data){return render.call(this,data,_);};template.source='function('+(settings.variable||'obj')+'){\n'+source+'}';return template;};_.chain=function(obj){return _(obj).chain();};var wrapper=
-function(obj){this._wrapped=obj;};_.prototype=wrapper.prototype;var result=function(obj,chain){return chain?_(obj).chain():obj;};var addToWrapper=function(name,func){wrapper.prototype[name]=function(){var args=slice.call(arguments);unshift.call(args,this._wrapped);return result(func.apply(_,args),this._chain);};};_.mixin(_);each(['pop','push','reverse','shift','sort','splice','unshift'],function(name){var method=ArrayProto[name];wrapper.prototype[name]=function(){var wrapped=this._wrapped;method.apply(wrapped,arguments);var length=wrapped.length;if((name=='shift'||name=='splice')&&length===0)delete wrapped[0];return result(wrapped,this._chain);};});each(['concat','join','slice'],function(name){var method=ArrayProto[name];wrapper.prototype[name]=function(){return result(method.apply(this._wrapped,arguments),this._chain);};});wrapper.prototype.chain=function(){this._chain=true;return this;};wrapper.prototype.value=function(){return this._wrapped;};return _;}).call({});var emmet=(function
-(global){var defaultSyntax='html';var defaultProfile='plain';if(typeof _=='undefined'){try{_=global[['require'][0]]('underscore');}catch(e){}}if(typeof _=='undefined'){throw'Cannot access to Underscore.js lib';}var modules={_:_};var ctor=function(){};function inherits(parent,protoProps,staticProps){var child;if(protoProps&&protoProps.hasOwnProperty('constructor')){child=protoProps.constructor;}else{child=function(){parent.apply(this,arguments);};}_.extend(child,parent);ctor.prototype=parent.prototype;child.prototype=new ctor();if(protoProps)_.extend(child.prototype,protoProps);if(staticProps)_.extend(child,staticProps);child.prototype.constructor=child;child.__super__=parent.prototype;return child;};var moduleLoader=null;function r(name){if(!(name in modules)&&moduleLoader)moduleLoader(name);return modules[name];}return{define:function(name,factory){if(!(name in modules)){modules[name]=_.isFunction(factory)?this.exec(factory):factory;}},require:r,exec:function(fn,context){return fn.
-call(context||global,_.bind(r,this),_,this);},extend:function(protoProps,classProps){var child=inherits(this,protoProps,classProps);child.extend=this.extend;if(protoProps.hasOwnProperty('toString'))child.prototype.toString=protoProps.toString;return child;},expandAbbreviation:function(abbr,syntax,profile,contextNode){if(!abbr)return'';syntax=syntax||defaultSyntax;var filters=r('filters');var parser=r('abbreviationParser');profile=r('profile').get(profile,syntax);r('tabStops').resetTabstopIndex();var data=filters.extractFromAbbreviation(abbr);var outputTree=parser.parse(data[0],{syntax:syntax,contextNode:contextNode});var filtersList=filters.composeList(syntax,profile,data[1]);filters.apply(outputTree,filtersList,profile);return outputTree.toString();},defaultSyntax:function(){return defaultSyntax;},defaultProfile:function(){return defaultProfile;},log:function(){if(global.console&&global.console.log)global.console.log.apply(global.console,arguments);},setModuleLoader:function(fn){
-moduleLoader=fn;}};})(this);if(typeof exports!=='undefined'){if(typeof module!=='undefined'&&module.exports){exports=module.exports=emmet;}exports.emmet=emmet;}if(typeof define!=='undefined'){define('emmet',[],emmet);}emmet.define('abbreviationParser',function(require,_){var reValidName=/^[\w\-\$\:@\!%]+\+?$/i;var reWord=/[\w\-:\$@]/;var pairs={'[':']','(':')','{':'}'};var spliceFn=Array.prototype.splice;var preprocessors=[];var postprocessors=[];var outputProcessors=[];function AbbreviationNode(parent){this.parent=null;this.children=[];this._attributes=[];this.abbreviation='';this.counter=1;this._name=null;this._text='';this.repeatCount=1;this.hasImplicitRepeat=false;this._data={};this.start='';this.end='';this.content='';this.padding='';}AbbreviationNode.prototype={addChild:function(child,position){child=child||new AbbreviationNode;child.parent=this;if(_.isUndefined(position)){this.children.push(child);}else{this.children.splice(position,0,child);}return child;},clone:function(){var
-node=new AbbreviationNode();var attrs=['abbreviation','counter','_name','_text','repeatCount','hasImplicitRepeat','start','end','content','padding'];_.each(attrs,function(a){node[a]=this[a];},this);node._attributes=_.map(this._attributes,function(attr){return _.clone(attr);});node._data=_.clone(this._data);node.children=_.map(this.children,function(child){child=child.clone();child.parent=node;return child;});return node;},remove:function(){if(this.parent){this.parent.children=_.without(this.parent.children,this);}return this;},replace:function(){var parent=this.parent;var ix=_.indexOf(parent.children,this);var items=_.flatten(arguments);spliceFn.apply(parent.children,[ix,1].concat(items));_.each(items,function(item){item.parent=parent;});},updateProperty:function(name,value){this[name]=value;_.each(this.children,function(child){child.updateProperty(name,value);});return this;},find:function(fn){return this.findAll(fn)[0];},findAll:function(fn){if(!_.isFunction(fn)){var elemName=fn.
-toLowerCase();fn=function(item){return item.name().toLowerCase()==elemName;};}var result=[];_.each(this.children,function(child){if(fn(child))result.push(child);result=result.concat(child.findAll(fn));});return _.compact(result);},data:function(name,value){if(arguments.length==2){this._data[name]=value;if(name=='resource'&&require('elements').is(value,'snippet')){this.content=value.data;if(this._text){this.content=require('abbreviationUtils').insertChildContent(value.data,this._text);}}}return this._data[name];},name:function(){var res=this.matchedResource();if(require('elements').is(res,'element')){return res.name;}return this._name;},attributeList:function(){var attrs=[];var res=this.matchedResource();if(require('elements').is(res,'element')&&_.isArray(res.attributes)){attrs=attrs.concat(res.attributes);}return optimizeAttributes(attrs.concat(this._attributes));},attribute:function(name,value){if(arguments.length==2){var ix=_.indexOf(_.pluck(this._attributes,'name'),name.toLowerCase(
-));if(~ix){this._attributes[ix].value=value;}else{this._attributes.push({name:name,value:value});}}return(_.find(this.attributeList(),function(attr){return attr.name==name;})||{}).value;},matchedResource:function(){return this.data('resource');},index:function(){return this.parent?_.indexOf(this.parent.children,this):-1;},_setRepeat:function(count){if(count){this.repeatCount=parseInt(count,10)||1;}else{this.hasImplicitRepeat=true;}},setAbbreviation:function(abbr){abbr=abbr||'';var that=this;abbr=abbr.replace(/\*(\d+)?$/,function(str,repeatCount){that._setRepeat(repeatCount);return'';});this.abbreviation=abbr;var abbrText=extractText(abbr);if(abbrText){abbr=abbrText.element;this.content=this._text=abbrText.text;}var abbrAttrs=parseAttributes(abbr);if(abbrAttrs){abbr=abbrAttrs.element;this._attributes=abbrAttrs.attributes;}this._name=abbr;if(this._name&&!reValidName.test(this._name)){throw'Invalid abbreviation';}},toString:function(){var utils=require('utils');var start=this.start;var end
-=this.end;var content=this.content;var node=this;_.each(outputProcessors,function(fn){start=fn(start,node,'start');content=fn(content,node,'content');end=fn(end,node,'end');});var innerContent=_.map(this.children,function(child){return child.toString();}).join('');content=require('abbreviationUtils').insertChildContent(content,innerContent,{keepVariable:false});return start+utils.padString(content,this.padding)+end;},hasEmptyChildren:function(){return!!_.find(this.children,function(child){return child.isEmpty();});},hasImplicitName:function(){return!this._name&&!this.isTextNode();},isGroup:function(){return!this.abbreviation;},isEmpty:function(){return!this.abbreviation&&!this.children.length;},isRepeating:function(){return this.repeatCount>1||this.hasImplicitRepeat;},isTextNode:function(){return!this.name()&&!this.attributeList().length;},isElement:function(){return!this.isEmpty()&&!this.isTextNode();},deepestChild:function(){if(!this.children.length)return null;var deepestChild=this;
-while(deepestChild.children.length){deepestChild=_.last(deepestChild.children);}return deepestChild;}};function stripped(str){return str.substring(1,str.length-1);}function consumeQuotedValue(stream,quote){var ch;while(ch=stream.next()){if(ch===quote)return true;if(ch=='\\')continue;}return false;}function parseAbbreviation(abbr){abbr=require('utils').trim(abbr);var root=new AbbreviationNode;var context=root.addChild(),ch;var stream=require('stringStream').create(abbr);var loopProtector=1000,multiplier;while(!stream.eol()&&--loopProtector>0){ch=stream.peek();switch(ch){case'(':stream.start=stream.pos;if(stream.skipToPair('(',')')){var inner=parseAbbreviation(stripped(stream.current()));if(multiplier=stream.match(/^\*(\d+)?/,true)){context._setRepeat(multiplier[1]);}_.each(inner.children,function(child){context.addChild(child);});}else{throw'Invalid abbreviation: mo matching ")" found for character at '+stream.pos;}break;case'>':context=context.addChild();stream.next();break;case'+':
-context=context.parent.addChild();stream.next();break;case'^':var parent=context.parent||context;context=(parent.parent||parent).addChild();stream.next();break;default:stream.start=stream.pos;stream.eatWhile(function(c){if(c=='['||c=='{'){if(stream.skipToPair(c,pairs[c])){stream.backUp(1);return true;}throw'Invalid abbreviation: mo matching "'+pairs[c]+'" found for character at '+stream.pos;}if(c=='+'){stream.next();var isMarker=stream.eol()||~'+>^*'.indexOf(stream.peek());stream.backUp(1);return isMarker;}return c!='('&&isAllowedChar(c);});context.setAbbreviation(stream.current());stream.start=stream.pos;}}if(loopProtector<1)throw'Endless loop detected';return root;}function extractAttributes(attrSet,attrs){attrSet=require('utils').trim(attrSet);var result=[];var stream=require('stringStream').create(attrSet);stream.eatSpace();while(!stream.eol()){stream.start=stream.pos;if(stream.eatWhile(reWord)){var attrName=stream.current();var attrValue='';if(stream.peek()=='='){stream.next();
-stream.start=stream.pos;var quote=stream.peek();if(quote=='"'||quote=="'"){stream.next();if(consumeQuotedValue(stream,quote)){attrValue=stream.current();attrValue=attrValue.substring(1,attrValue.length-1);}else{throw'Invalid attribute value';}}else if(stream.eatWhile(/[^\s\]]/)){attrValue=stream.current();}else{throw'Invalid attribute value';}}result.push({name:attrName,value:attrValue});stream.eatSpace();}else{break;}}return result;}function parseAttributes(abbr){var result=[];var attrMap={'#':'id','.':'class'};var nameEnd=null;var stream=require('stringStream').create(abbr);while(!stream.eol()){switch(stream.peek()){case'#':case'.':if(nameEnd===null)nameEnd=stream.pos;var attrName=attrMap[stream.peek()];stream.next();stream.start=stream.pos;stream.eatWhile(reWord);result.push({name:attrName,value:stream.current()});break;case'[':if(nameEnd===null)nameEnd=stream.pos;stream.start=stream.pos;if(!stream.skipToPair('[',']'))throw'Invalid attribute set definition';result=result.concat(
-extractAttributes(stripped(stream.current())));break;default:stream.next();}}if(!result.length)return null;return{element:abbr.substring(0,nameEnd),attributes:optimizeAttributes(result)};}function optimizeAttributes(attrs){attrs=_.map(attrs,function(attr){return _.clone(attr);});var lookup={};return _.filter(attrs,function(attr){if(!(attr.name in lookup)){return lookup[attr.name]=attr;}var la=lookup[attr.name];if(attr.name.toLowerCase()=='class'){la.value+=(la.value.length?' ':'')+attr.value;}else{la.value=attr.value;}return false;});}function extractText(abbr){if(!~abbr.indexOf('{'))return null;var stream=require('stringStream').create(abbr);while(!stream.eol()){switch(stream.peek()){case'[':case'(':stream.skipToPair(stream.peek(),pairs[stream.peek()]);break;case'{':stream.start=stream.pos;stream.skipToPair('{','}');return{element:abbr.substring(0,stream.start),text:stripped(stream.current())};default:stream.next();}}}function unroll(node){for(var i=node.children.length-1,j,child,
-maxCount;i>=0;i--){child=node.children[i];if(child.isRepeating()){maxCount=j=child.repeatCount;child.repeatCount=1;child.updateProperty('counter',1);child.updateProperty('maxCount',maxCount);while(--j>0){child.parent.addChild(child.clone(),i+1).updateProperty('counter',j+1).updateProperty('maxCount',maxCount);}}}_.each(node.children,unroll);return node;}function squash(node){for(var i=node.children.length-1;i>=0;i--){var n=node.children[i];if(n.isGroup()){n.replace(squash(n).children);}else if(n.isEmpty()){n.remove();}}_.each(node.children,squash);return node;}function isAllowedChar(ch){var charCode=ch.charCodeAt(0);var specialChars='#.*:$-_!@|%';return(charCode>64&&charCode<91)||(charCode>96&&charCode<123)||(charCode>47&&charCode<58)||specialChars.indexOf(ch)!=-1;}outputProcessors.push(function(text,node){return require('utils').replaceCounter(text,node.counter,node.maxCount);});return{parse:function(abbr,options){options=options||{};var tree=parseAbbreviation(abbr);if(options.
-contextNode){tree._name=options.contextNode.name;var attrLookup={};_.each(tree._attributes,function(attr){attrLookup[attr.name]=attr;});_.each(options.contextNode.attributes,function(attr){if(attr.name in attrLookup){attrLookup[attr.name].value=attr.value;}else{attr=_.clone(attr);tree._attributes.push(attr);attrLookup[attr.name]=attr;}});}_.each(preprocessors,function(fn){fn(tree,options);});tree=squash(unroll(tree));_.each(postprocessors,function(fn){fn(tree,options);});return tree;},AbbreviationNode:AbbreviationNode,addPreprocessor:function(fn){if(!_.include(preprocessors,fn))preprocessors.push(fn);},removeFilter:function(fn){preprocessor=_.without(preprocessors,fn);},addPostprocessor:function(fn){if(!_.include(postprocessors,fn))postprocessors.push(fn);},removePostprocessor:function(fn){postprocessors=_.without(postprocessors,fn);},addOutputProcessor:function(fn){if(!_.include(outputProcessors,fn))outputProcessors.push(fn);},removeOutputProcessor:function(fn){outputProcessors=_.
-without(outputProcessors,fn);},isAllowedChar:function(ch){ch=String(ch);return isAllowedChar(ch)||~'>+^[](){}'.indexOf(ch);}};});emmet.exec(function(require,_){function matchResources(node,syntax){var resources=require('resources');var elements=require('elements');var parser=require('abbreviationParser');_.each(_.clone(node.children),function(child){var r=resources.getMatchedResource(child,syntax);if(_.isString(r)){child.data('resource',elements.create('snippet',r));}else if(elements.is(r,'reference')){var subtree=parser.parse(r.data,{syntax:syntax});if(child.repeatCount>1){var repeatedChildren=subtree.findAll(function(node){return node.hasImplicitRepeat;});_.each(repeatedChildren,function(node){node.repeatCount=child.repeatCount;node.hasImplicitRepeat=false;});}var deepestChild=subtree.deepestChild();if(deepestChild){_.each(child.children,function(c){deepestChild.addChild(c);});}_.each(subtree.children,function(node){_.each(child.attributeList(),function(attr){node.attribute(attr.name
-,attr.value);});});child.replace(subtree.children);}else{child.data('resource',r);}matchResources(child,syntax);});}require('abbreviationParser').addPreprocessor(function(tree,options){var syntax=options.syntax||emmet.defaultSyntax();matchResources(tree,syntax);});});emmet.exec(function(require,_){var parser=require('abbreviationParser');var outputPlaceholder='$#';function locateOutputPlaceholder(text){var range=require('range');var result=[];var stream=require('stringStream').create(text);while(!stream.eol()){if(stream.peek()=='\\'){stream.next();}else{stream.start=stream.pos;if(stream.match(outputPlaceholder,true)){result.push(range.create(stream.start,outputPlaceholder));continue;}}stream.next();}return result;}function replaceOutputPlaceholders(source,value){var utils=require('utils');var ranges=locateOutputPlaceholder(source);ranges.reverse();_.each(ranges,function(r){source=utils.replaceSubstring(source,value,r);});return source;}function hasOutputPlaceholder(node){if(
-locateOutputPlaceholder(node.content).length)return true;return!!_.find(node.attributeList(),function(attr){return!!locateOutputPlaceholder(attr.value).length;});}function insertPastedContent(node,content,overwrite){var nodesWithPlaceholders=node.findAll(function(item){return hasOutputPlaceholder(item);});if(hasOutputPlaceholder(node))nodesWithPlaceholders.unshift(node);if(nodesWithPlaceholders.length){_.each(nodesWithPlaceholders,function(item){item.content=replaceOutputPlaceholders(item.content,content);_.each(item._attributes,function(attr){attr.value=replaceOutputPlaceholders(attr.value,content);});});}else{var deepest=node.deepestChild()||node;if(overwrite){deepest.content=content;}else{deepest.content=require('abbreviationUtils').insertChildContent(deepest.content,content);}}}parser.addPreprocessor(function(tree,options){if(options.pastedContent){var utils=require('utils');var lines=_.map(utils.splitByLines(options.pastedContent,true),utils.trim);tree.findAll(function(item){if(
-item.hasImplicitRepeat){item.data('paste',lines);return item.repeatCount=lines.length;}});}});parser.addPostprocessor(function(tree,options){var targets=tree.findAll(function(item){var pastedContentObj=item.data('paste');var pastedContent='';if(_.isArray(pastedContentObj)){pastedContent=pastedContentObj[item.counter-1];}else if(_.isFunction(pastedContentObj)){pastedContent=pastedContentObj(item.counter-1,item.content);}else if(pastedContentObj){pastedContent=pastedContentObj;}if(pastedContent){insertPastedContent(item,pastedContent,!!item.data('pasteOverwrites'));}item.data('paste',null);return!!pastedContentObj;});if(!targets.length&&options.pastedContent){insertPastedContent(tree,options.pastedContent);}});});emmet.exec(function(require,_){function resolveNodeNames(tree){var tagName=require('tagName');_.each(tree.children,function(node){if(node.hasImplicitName()||node.data('forceNameResolving')){node._name=tagName.resolve(node.parent.name());}resolveNodeNames(node);});return tree;}
-require('abbreviationParser').addPostprocessor(resolveNodeNames);});emmet.define('cssParser',function(require,_){var walker,tokens=[],isOp,isNameChar,isDigit;walker={lines:null,total_lines:0,linenum:-1,line:'',ch:'',chnum:-1,init:function(source){var me=walker;me.lines=source.replace(/\r\n/g,'\n').replace(/\r/g,'\n').split('\n');me.total_lines=me.lines.length;me.chnum=-1;me.linenum=-1;me.ch='';me.line='';me.nextLine();me.nextChar();},nextLine:function(){var me=this;me.linenum+=1;if(me.total_lines<=me.linenum){me.line=false;}else{me.line=me.lines[me.linenum];}if(me.chnum!==-1){me.chnum=0;}return me.line;},nextChar:function(){var me=this;me.chnum+=1;while(me.line.charAt(me.chnum)===''){if(this.nextLine()===false){me.ch=false;return false;}me.chnum=-1;me.ch='\n';return'\n';}me.ch=me.line.charAt(me.chnum);return me.ch;},peek:function(){return this.line.charAt(this.chnum+1);}};isNameChar=function(c){return(c=='&'||c==='_'||c==='-'||(c>='a'&&c<='z')||(c>='A'&&c<='Z'));};isDigit=function(ch){
-return(ch!==false&&ch>='0'&&ch<='9');};isOp=(function(){var opsa="{}[]()+*=.,;:>~|\\%$#@^!".split(''),opsmatcha="*^|$~".split(''),ops={},opsmatch={},i=0;for(;i"));else return null;}else if(stream.match("--"))return chain(inBlock("comment","-->"));else if(stream.match("DOCTYPE",true,true)){stream.eatWhile(/[\w\._\-]/);return chain(doctype(1));}else return null;}else if(stream.eat("?")){stream.eatWhile(/[\w\._\-]/);state.tokenize=inBlock("meta","?>");return"meta";}else{type=stream.eat("/")?"closeTag":"openTag";stream.eatSpace();tagName="";var c;while((c=stream.eat(/[^\s\u00a0=<>\"\'\/?]/)))tagName+=c;state.tokenize=inTag;return"tag";}}else if(ch=="&"){var ok;if(stream.eat("#")){if(stream.eat("x")
-){ok=stream.eatWhile(/[a-fA-F\d]/)&&stream.eat(";");}else{ok=stream.eatWhile(/[\d]/)&&stream.eat(";");}}else{ok=stream.eatWhile(/[\w\.\-:]/)&&stream.eat(";");}return ok?"atom":"error";}else{stream.eatWhile(/[^&<]/);return"text";}}function inTag(stream,state){var ch=stream.next();if(ch==">"||(ch=="/"&&stream.eat(">"))){state.tokenize=inText;type=ch==">"?"endTag":"selfcloseTag";return"tag";}else if(ch=="="){type="equals";return null;}else if(/[\'\"]/.test(ch)){state.tokenize=inAttribute(ch);return state.tokenize(stream,state);}else{stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/);return"word";}}function inAttribute(quote){return function(stream,state){while(!stream.eol()){if(stream.next()==quote){state.tokenize=inTag;break;}}return"string";};}function inBlock(style,terminator){return function(stream,state){while(!stream.eol()){if(stream.match(terminator)){state.tokenize=inText;break;}stream.next();}return style;};}function doctype(depth){return function(stream,state){var ch;while((ch=stream.next
-())!=null){if(ch=="<"){state.tokenize=doctype(depth+1);return state.tokenize(stream,state);}else if(ch==">"){if(depth==1){state.tokenize=inText;break;}else{state.tokenize=doctype(depth-1);return state.tokenize(stream,state);}}}return"meta";};}var curState=null,setStyle;function pass(){for(var i=arguments.length-1;i>=0;i--)curState.cc.push(arguments[i]);}function cont(){pass.apply(null,arguments);return true;}function pushContext(tagName,startOfLine){var noIndent=Kludges.doNotIndent.hasOwnProperty(tagName)||(curState.context&&curState.context.noIndent);curState.context={prev:curState.context,tagName:tagName,indent:curState.indented,startOfLine:startOfLine,noIndent:noIndent};}function popContext(){if(curState.context)curState.context=curState.context.prev;}function element(type){if(type=="openTag"){curState.tagName=tagName;return cont(attributes,endtag(curState.startOfLine));}else if(type=="closeTag"){var err=false;if(curState.context){if(curState.context.tagName!=tagName){if(Kludges.
-implicitlyClosed.hasOwnProperty(curState.context.tagName.toLowerCase())){popContext();}err=!curState.context||curState.context.tagName!=tagName;}}else{err=true;}if(err)setStyle="error";return cont(endclosetag(err));}return cont();}function endtag(startOfLine){return function(type){if(type=="selfcloseTag"||(type=="endTag"&&Kludges.autoSelfClosers.hasOwnProperty(curState.tagName.toLowerCase()))){maybePopContext(curState.tagName.toLowerCase());return cont();}if(type=="endTag"){maybePopContext(curState.tagName.toLowerCase());pushContext(curState.tagName,startOfLine);return cont();}return cont();};}function endclosetag(err){return function(type){if(err)setStyle="error";if(type=="endTag"){popContext();return cont();}setStyle="error";return cont(arguments.callee);};}function maybePopContext(nextTagName){var parentTagName;while(true){if(!curState.context){return;}parentTagName=curState.context.tagName.toLowerCase();if(!Kludges.contextGrabbers.hasOwnProperty(parentTagName)||!Kludges.
-contextGrabbers[parentTagName].hasOwnProperty(nextTagName)){return;}popContext();}}function attributes(type){if(type=="word"){setStyle="attribute";return cont(attribute,attributes);}if(type=="endTag"||type=="selfcloseTag")return pass();setStyle="error";return cont(attributes);}function attribute(type){if(type=="equals")return cont(attvalue,attributes);if(!Kludges.allowMissing)setStyle="error";return(type=="endTag"||type=="selfcloseTag")?pass():cont();}function attvalue(type){if(type=="string")return cont(attvaluemaybe);if(type=="word"&&Kludges.allowUnquoted){setStyle="string";return cont();}setStyle="error";return(type=="endTag"||type=="selfCloseTag")?pass():cont();}function attvaluemaybe(type){if(type=="string")return cont(attvaluemaybe);else return pass();}function startState(){return{tokenize:inText,cc:[],indented:0,startOfLine:true,tagName:null,context:null};}function token(stream,state){if(stream.sol()){state.startOfLine=true;state.indented=0;}if(stream.eatSpace())return null;
-setStyle=type=tagName=null;var style=state.tokenize(stream,state);state.type=type;if((style||type)&&style!="comment"){curState=state;while(true){var comb=state.cc.pop()||element;if(comb(type||style))break;}}state.startOfLine=false;return setStyle||style;}return{parse:function(data,offset){offset=offset||0;var state=startState();var stream=require('stringStream').create(data);var tokens=[];while(!stream.eol()){tokens.push({type:token(stream,state),start:stream.start+offset,end:stream.pos+offset});stream.start=stream.pos;}return tokens;}};});emmet.define('string-score',function(require,_){return{score:function(string,abbreviation,fuzziness){if(string==abbreviation){return 1;}if(abbreviation==""){return 0;}var total_character_score=0,abbreviation_length=abbreviation.length,string_length=string.length,start_of_string_bonus,abbreviation_score,fuzzies=1,final_score;for(var i=0,character_score,index_in_string,c,index_c_lowercase,index_c_uppercase,min_index;i-1)?min_index:Math.max(index_c_lowercase,index_c_uppercase);if(index_in_string===-1){if(fuzziness){fuzzies+=1-fuzziness;continue;}else{return 0;}}else{character_score=0.1;}if(string[index_in_string]===c){character_score+=0.1;}if(index_in_string===0){character_score+=0.6;if(i===0){start_of_string_bonus=1;}}else{if(string.charAt(index_in_string-1)===' '){character_score+=0.8;}}string=string.substring(index_in_string+1,string_length);total_character_score+=character_score;}abbreviation_score=total_character_score/abbreviation_length;final_score=((abbreviation_score*(abbreviation_length/string_length))+abbreviation_score)/2;final_score=final_score/fuzzies;if(start_of_string_bonus&&(final_score+0.15<1)){final_score+=0.15;}return final_score;}};});emmet.define('utils',function(require,_){
-var caretPlaceholder='${0}';function StringBuilder(value){this._data=[];this.length=0;if(value)this.append(value);}StringBuilder.prototype={append:function(text){this._data.push(text);this.length+=text.length;},toString:function(){return this._data.join('');},valueOf:function(){return this.toString();}};return{reTag:/<\/?[\w:\-]+(?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*\s*(\/?)>$/,endsWithTag:function(str){return this.reTag.test(str);},isNumeric:function(ch){if(typeof(ch)=='string')ch=ch.charCodeAt(0);return(ch&&ch>47&&ch<58);},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},getNewline:function(){var res=require('resources');if(!res){return'\n';}var nl=res.getVariable('newline');return _.isString(nl)?nl:'\n';},setNewline:function(str){var res=require('resources');res.setVariable('newline',str);res.setVariable('nl',str);},splitByLines:function(text,removeEmpty){var nl=this.getNewline();var lines=(text||'').replace(/\r\n/g,'\n').replace(/\n\r/g,'\n')
-.replace(/\r/g,'\n').replace(/\n/g,nl).split(nl);if(removeEmpty){lines=_.filter(lines,function(line){return line.length&&!!this.trim(line);},this);}return lines;},normalizeNewline:function(text){return this.splitByLines(text).join(this.getNewline());},repeatString:function(str,howMany){var result=[];for(var i=0;iil++)
-padding+='0';return padding+str;},unindentString:function(text,pad){var lines=this.splitByLines(text);for(var i=0;istr.length)return str;return str.substring(0,start)+value+str.substring(end);},narrowToNonSpace:function(text,start,end){var range=require('range').create(start,end);var reSpace=/[\s\n\r\u00a0]/;while(range.startrange.start){range.end--;if(!reSpace.test(text.charAt(range.end))){range.end++;break;}}return range;},findNewlineBounds:function(text,from){var len=text.length,start=0,end=len-1;for(var i=from-1;i>0;i--){var ch=text.charAt(i);if(ch=='\n'||ch=='\r'){start=i+1;break;}}for(var j=from;j':return a>b;case'gte':case'>=':return a>=b;}}function Range(start,len){if(_.isObject(start)&&'start'in start){this.start=Math.min(start.start,start.end);this.end=Math.max(start.start,start.end);}else if(_.isArray(start)){this.start=start[0];this.end=start[1];}else{len=_.isString(len)?len.length:+len;this.start=start;this.end=start+len;}}Range.prototype={length:function(){return Math.abs(this.end-this.start);},equal:function(range){return this.cmp(range,'eq','eq');},shift:function(delta){this.start+=delta;this.end
-+=delta;return this;},overlap:function(range){return range.start<=this.end&&range.end>=this.start;},intersection:function(range){if(this.overlap(range)){var start=Math.max(range.start,this.start);var end=Math.min(range.end,this.end);return new Range(start,end-start);}return null;},union:function(range){if(this.overlap(range)){var start=Math.min(range.start,this.start);var end=Math.max(range.end,this.end);return new Range(start,end-start);}return null;},inside:function(loc){return this.cmp(loc,'lte','gt');},contains:function(loc){return this.cmp(loc,'lt','gt');},include:function(r){return this.cmp(loc,'lte','gte');},cmp:function(loc,left,right){var a,b;if(loc instanceof Range){a=loc.start;b=loc.end;}else{a=b=loc;}return cmp(this.start,a,left||'<=')&&cmp(this.end,b,right||'>');},substring:function(str){return this.length()>0?str.substring(this.start,this.end):'';},clone:function(){return new Range(this.start,this.length());},toArray:function(){return[this.start,this.end];},toString:
-function(){return'{'+this.start+', '+this.length()+'}';}};return{create:function(start,len){if(_.isUndefined(start)||start===null)return null;if(start instanceof Range)return start;if(_.isObject(start)&&'start'in start&&'end'in start){len=start.end-start.start;start=start.start;}return new Range(start,len);},create2:function(start,end){if(_.isNumber(start)&&_.isNumber(end)){end-=start;}return this.create(start,end);}};});emmet.define('handlerList',function(require,_){function HandlerList(){this._list=[];}HandlerList.prototype={add:function(fn,options){this._list.push(_.extend({order:0},options||{},{fn:fn}));},remove:function(fn){this._list=_.without(this._list,_.find(this._list,function(item){return item.fn===fn;}));},list:function(){return _.sortBy(this._list,'order').reverse();},listFn:function(){return _.pluck(this.list(),'fn');},exec:function(skipValue,args){args=args||[];var result=null;_.find(this.list(),function(h){result=h.fn.apply(h,args);if(result!==skipValue)return true;});
-return result;}};return{create:function(){return new HandlerList();}};});emmet.define('tokenIterator',function(require,_){function TokenIterator(tokens){this.tokens=tokens;this._position=0;this.reset();}TokenIterator.prototype={next:function(){if(this.hasNext()){var token=this.tokens[++this._i];this._position=token.start;return token;}return null;},current:function(){return this.tokens[this._i];},position:function(){return this._position;},hasNext:function(){return this._i=this.string.length;},sol:function(){return this.pos==0;},peek:function(){return this.string.charAt(this.pos);},next:function(){if(this.posstart;},eatSpace:function(){var start=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>start;},skipToEnd:function(){this.pos=this.string.length;},skipTo:function(ch){var found=this.string.indexOf(ch,this.pos);if(found>-1){this.pos=found;return true;}},skipToPair:function(open,close){var braceCount=0,ch;var pos=this.pos,len=this.
-string.length;while(pos/;var systemSettings={};var userSettings={};var resolvers
-=require('handlerList').create();function normalizeCaretPlaceholder(text){var utils=require('utils');return utils.replaceUnescapedSymbol(text,'|',utils.getCaretPlaceholder());}function parseItem(name,value,type){value=normalizeCaretPlaceholder(value);if(type=='snippets'){return require('elements').create('snippet',value);}if(type=='abbreviations'){return parseAbbreviation(name,value);}}function parseAbbreviation(key,value){key=require('utils').trim(key);var elements=require('elements');var m;if(m=reTag.exec(value)){return elements.create('element',m[1],m[2],m[4]=='/');}else{return elements.create('reference',value);}}function normalizeName(str){return str.replace(/:$/,'').replace(/:/g,'-');}return{setVocabulary:function(data,type){cache={};if(type==VOC_SYSTEM)systemSettings=data;else userSettings=data;},getVocabulary:function(name){return name==VOC_SYSTEM?systemSettings:userSettings;},getMatchedResource:function(node,syntax){return resolvers.exec(null,_.toArray(arguments))||this.
-findSnippet(syntax,node.name());},getVariable:function(name){return(this.getSection('variables')||{})[name];},setVariable:function(name,value){var voc=this.getVocabulary('user')||{};if(!('variables'in voc))voc.variables={};voc.variables[name]=value;this.setVocabulary(voc,'user');},hasSyntax:function(syntax){return syntax in this.getVocabulary(VOC_USER)||syntax in this.getVocabulary(VOC_SYSTEM);},addResolver:function(fn,options){resolvers.add(fn,options);},removeResolver:function(fn){resolvers.remove(fn);},getSection:function(name){if(!name)return null;if(!(name in cache)){cache[name]=require('utils').deepMerge({},systemSettings[name],userSettings[name]);}var data=cache[name],subsections=_.rest(arguments),key;while(data&&(key=subsections.shift())){if(key in data){data=data[key];}else{return null;}}return data;},findItem:function(topSection,subsection){var data=this.getSection(topSection);while(data){if(subsection in data)return data[subsection];data=this.getSection(data['extends']);}},
-findSnippet:function(syntax,name,memo){if(!syntax||!name)return null;memo=memo||[];var names=[name];if(~name.indexOf('-'))names.push(name.replace(/\-/g,':'));var data=this.getSection(syntax),matchedItem=null;_.find(['snippets','abbreviations'],function(sectionName){var data=this.getSection(syntax,sectionName);if(data){return _.find(names,function(n){if(data[n])return matchedItem=parseItem(n,data[n],sectionName);});}},this);memo.push(syntax);if(!matchedItem&&data['extends']&&!_.include(memo,data['extends'])){return this.findSnippet(data['extends'],name,memo);}return matchedItem;},fuzzyFindSnippet:function(syntax,name,minScore){minScore=minScore||0.3;var payload=this.getAllSnippets(syntax);var sc=require('string-score');name=normalizeName(name);var scores=_.map(payload,function(value,key){return{key:key,score:sc.score(value.nk,name,0.1)};});var result=_.last(_.sortBy(scores,'score'));if(result&&result.score>=minScore){var k=result.key;return payload[k].parsedValue;}},getAllSnippets:
-function(syntax){var cacheKey='all-'+syntax;if(!cache[cacheKey]){var stack=[],sectionKey=syntax;var memo=[];do{var section=this.getSection(sectionKey);if(!section)break;_.each(['snippets','abbreviations'],function(sectionName){var stackItem={};_.each(section[sectionName]||null,function(v,k){stackItem[k]={nk:normalizeName(k),value:v,parsedValue:parseItem(k,v,sectionName),type:sectionName};});stack.push(stackItem);});memo.push(sectionKey);sectionKey=section['extends'];}while(sectionKey&&!_.include(memo,sectionKey));cache[cacheKey]=_.extend.apply(_,stack.reverse());}return cache[cacheKey];}};});emmet.define('actions',function(require,_,zc){var actions={};function humanizeActionName(name){return require('utils').trim(name.charAt(0).toUpperCase()+name.substring(1).replace(/_[a-z]/g,function(str){return' '+str.charAt(1).toUpperCase();}));}return{add:function(name,fn,options){name=name.toLowerCase();options=options||{};if(!options.label){options.label=humanizeActionName(name);}actions[name]={
-name:name,fn:fn,options:options};},get:function(name){return actions[name.toLowerCase()];},run:function(name,args){if(!_.isArray(args)){args=_.rest(arguments);}var action=this.get(name);if(action){return action.fn.apply(emmet,args);}else{emmet.log('Action "%s" is not defined',name);return false;}},getAll:function(){return actions;},getList:function(){return _.values(this.getAll());},getMenu:function(skipActions){var result=[];skipActions=skipActions||[];_.each(this.getList(),function(action){if(action.options.hidden||_.include(skipActions,action.name))return;var actionName=humanizeActionName(action.name);var ctx=result;if(action.options.label){var parts=action.options.label.split('/');actionName=parts.pop();var menuName,submenu;while(menuName=parts.shift()){submenu=_.find(ctx,function(item){return item.type=='submenu'&&item.name==menuName;});if(!submenu){submenu={name:menuName,type:'submenu',items:[]};ctx.push(submenu);}ctx=submenu.items;}}ctx.push({type:'action',name:action.name,label
-:actionName});});return result;},getActionNameForMenuTitle:function(title,menu){var item=null;_.find(menu||this.getMenu(),function(val){if(val.type=='action'){if(val.label==title||val.name==title){return item=val.name;}}else{return item=this.getActionNameForMenuTitle(title,val.items);}},this);return item||null;}};});emmet.define('profile',function(require,_){var profiles={};var defaultProfile={tag_case:'asis',attr_case:'asis',attr_quotes:'double',tag_nl:'decide',tag_nl_leaf:false,place_cursor:true,indent:true,inline_break:3,self_closing_tag:'xhtml',filters:'',extraFilters:''};function OutputProfile(options){_.extend(this,defaultProfile,options);}OutputProfile.prototype={tagName:function(name){return stringCase(name,this.tag_case);},attributeName:function(name){return stringCase(name,this.attr_case);},attributeQuote:function(){return this.attr_quotes=='single'?"'":'"';},selfClosing:function(param){if(this.self_closing_tag=='xhtml')return' /';if(this.self_closing_tag===true)return'/';
-return'';},cursor:function(){return this.place_cursor?require('utils').getCaretPlaceholder():'';}};function stringCase(str,caseValue){switch(String(caseValue||'').toLowerCase()){case'lower':return str.toLowerCase();case'upper':return str.toUpperCase();}return str;}function createProfile(name,options){return profiles[name.toLowerCase()]=new OutputProfile(options);}function createDefaultProfiles(){createProfile('xhtml');createProfile('html',{self_closing_tag:false});createProfile('xml',{self_closing_tag:true,tag_nl:true});createProfile('plain',{tag_nl:false,indent:false,place_cursor:false});createProfile('line',{tag_nl:false,indent:false,extraFilters:'s'});}createDefaultProfiles();return{create:function(name,options){if(arguments.length==2)return createProfile(name,options);else return new OutputProfile(_.defaults(name||{},defaultProfile));},get:function(name,syntax){if(!name&&syntax){var profile=require('resources').findItem(syntax,'profile');if(profile){name=profile;}}if(!name){return profiles
-.plain;}if(name instanceof OutputProfile){return name;}if(_.isString(name)&&name.toLowerCase()in profiles){return profiles[name.toLowerCase()];}return this.create(name);},remove:function(name){name=(name||'').toLowerCase();if(name in profiles)delete profiles[name];},reset:function(){profiles={};createDefaultProfiles();},stringCase:stringCase};});emmet.define('editorUtils',function(require,_){return{isInsideTag:function(html,caretPos){var reTag=/^<\/?\w[\w\:\-]*.*?>/;var pos=caretPos;while(pos>-1){if(html.charAt(pos)=='<')break;pos--;}if(pos!=-1){var m=reTag.exec(html.substring(pos));if(m&&caretPos>pos&&caretPos'&&utils.endsWithTag(str.substring(0,
-curOffset+1)))){startIndex=curOffset+1;break;}}}if(startIndex!=-1&&!textCount&&!braceCount&&!groupCount)return str.substring(startIndex).replace(/^[\*\+\>\^]+/,'');else return'';},getImageSize:function(stream){var pngMagicNum="\211PNG\r\n\032\n",jpgMagicNum="\377\330",gifMagicNum="GIF8",nextByte=function(){return stream.charCodeAt(pos++);};if(stream.substr(0,8)===pngMagicNum){var pos=stream.indexOf('IHDR')+4;return{width:(nextByte()<<24)|(nextByte()<<16)|(nextByte()<<8)|nextByte(),height:(nextByte()<<24)|(nextByte()<<16)|(nextByte()<<8)|nextByte()};}else if(stream.substr(0,4)===gifMagicNum){pos=6;return{width:nextByte()|(nextByte()<<8),height:nextByte()|(nextByte()<<8)};}else if(stream.substr(0,2)===jpgMagicNum){pos=2;var l=stream.length;while(pos=0xC0&&marker<=0xCF&&!(marker&0x4)&&!(marker&0x8)){pos+=1;return{height:(nextByte()<<8)|nextByte(),width:(nextByte()<<8)|
-nextByte()};}else{pos+=size-2;}}}},captureContext:function(editor){var allowedSyntaxes={'html':1,'xml':1,'xsl':1};var syntax=String(editor.getSyntax());if(syntax in allowedSyntaxes){var content=String(editor.getContent());var tag=require('htmlMatcher').find(content,editor.getCaretPos());if(tag&&tag.type=='tag'){var startTag=tag.open;var contextNode={name:startTag.name,attributes:[]};var tagTree=require('xmlEditTree').parse(startTag.range.substring(content));if(tagTree){contextNode.attributes=_.map(tagTree.getAll(),function(item){return{name:item.name(),value:item.value()};});}return contextNode;}}return null;},findExpressionBounds:function(editor,fn){var content=String(editor.getContent());var il=content.length;var exprStart=editor.getCaretPos()-1;var exprEnd=exprStart+1;while(exprStart>=0&&fn(content.charAt(exprStart),exprStart,content))exprStart--;while(exprEndexprStart){return require('range').create([++exprStart,
-exprEnd]);}},compoundUpdate:function(editor,data){if(data){var sel=editor.getSelectionRange();editor.replaceContent(data.data,data.start,data.end,true);editor.createSelection(data.caret,data.caret+sel.end-sel.start);return true;}return false;},detectSyntax:function(editor,hint){var syntax=hint||'html';if(!require('resources').hasSyntax(syntax)){syntax='html';}if(syntax=='html'&&(this.isStyle(editor)||this.isInlineCSS(editor))){syntax='css';}return syntax;},detectProfile:function(editor){var syntax=editor.getSyntax();var profile=require('resources').findItem(syntax,'profile');if(profile){return profile;}switch(syntax){case'xml':case'xsl':return'xml';case'css':if(this.isInlineCSS(editor)){return'line';}break;case'html':var profile=require('resources').getVariable('profile');if(!profile){profile=this.isXHTML(editor)?'xhtml':'html';}return profile;}return'xhtml';},isXHTML:function(editor){return editor.getContent().search(/]+XHTML/i)!=-1;},isStyle:function(editor){var content=
-String(editor.getContent());var caretPos=editor.getCaretPos();var tag=require('htmlMatcher').tag(content,caretPos);return tag&&tag.open.name.toLowerCase()=='style'&&tag.innerRange.cmp(caretPos,'lte','gte');},isInlineCSS:function(editor){var content=String(editor.getContent());var caretPos=editor.getCaretPos();var tree=require('xmlEditTree').parseFromPosition(content,caretPos,true);if(tree){var attr=tree.itemFromPosition(caretPos,true);return attr&&attr.name().toLowerCase()=='style'&&attr.valueRange(true).cmp(caretPos,'lte','gte');}return false;}};});emmet.define('abbreviationUtils',function(require,_){return{isSnippet:function(node){return require('elements').is(node.matchedResource(),'snippet');},isUnary:function(node){if(node.children.length||node._text||this.isSnippet(node)){return false;}var r=node.matchedResource();return r&&r.is_empty;},isInline:function(node){return node.isTextNode()||!node.name()||require('tagName').isInlineLevel(node.name());},isBlock:function(node){return this
-.isSnippet(node)||!this.isInline(node);},isSnippet:function(node){return require('elements').is(node.matchedResource(),'snippet');},hasTagsInContent:function(node){return require('utils').matchesTag(node.content);},hasBlockChildren:function(node){return(this.hasTagsInContent(node)&&this.isBlock(node))||_.any(node.children,function(child){return this.isBlock(child);},this);},insertChildContent:function(text,childContent,options){options=_.extend({keepVariable:true,appendIfNoChild:true},options||{});var childVariableReplaced=false;var utils=require('utils');text=utils.replaceVariables(text,function(variable,name,data){var output=variable;if(name=='child'){output=utils.padString(childContent,utils.getLinePaddingFromPosition(text,data.start));childVariableReplaced=true;if(options.keepVariable)output+=variable;}return output;});if(!childVariableReplaced&&options.appendIfNoChild){text+=childContent;}return text;}};});emmet.define('base64',function(require,_){var chars=
-'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';return{encode:function(input){var output=[];var chr1,chr2,chr3,enc1,enc2,enc3,enc4,cdp1,cdp2,cdp3;var i=0,il=input.length,b64=chars;while(i>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(cdp2)){enc3=enc4=64;}else if(isNaN(cdp3)){enc4=64;}output.push(b64.charAt(enc1)+b64.charAt(enc2)+b64.charAt(enc3)+b64.charAt(enc4));}return output.join('');},decode:function(data){var o1,o2,o3,h1,h2,h3,h4,bits,i=0,ac=0,tmpArr=[];var b64=chars,il=data.length;if(!data){return data;}data+='';do{h1=b64.indexOf(data.charAt(i++));h2=b64.indexOf(data.charAt(i++));h3=b64.indexOf(data.charAt(i++));h4=b64.indexOf(data.charAt(i++));bits=h1<<18|h2<<12|h3<<6|h4;o1=bits>>16&0xff;o2=bits>>8&0xff;o3=bits&0xff;if(h3==64){tmpArr[ac++]=String.fromCharCode(o1);}else if(h4==64){
-tmpArr[ac++]=String.fromCharCode(o1,o2);}else{tmpArr[ac++]=String.fromCharCode(o1,o2,o3);}}while(i\s]+))?)*)\s*(\/?)>/;var reCloseTag=/^<\/([\w\:\-]+)[^>]*>/;function openTag(i,match){return{name:match[1],selfClose:!!match[3],range:require('range').create(i,match[0]),type:'open'};}function closeTag(i,match){return{name:match[1],range:require('range').create(i,match[0]),type:'close'};}function comment(i,match){return{range:require('range').create(i,_.isNumber(match)?match-i:match[0]),type:'comment'};}function createMatcher(text){var memo={},m;return{open:function(i){var m=this.matches(i);return m&&m.type=='open'?m:null;},close:function(i){var m=this.matches(i);return m&&m.type=='close'?m:null;},matches:function(i){var key='p'+i;if(!(key in memo)){if(text.charAt(i)=='<'){var substr=text.slice(i);if(m=substr.match(reOpenTag)){
-memo[key]=openTag(i,m);}else if(m=substr.match(reCloseTag)){memo[key]=closeTag(i,m);}else{memo[key]=false;}}}return memo[key];},text:function(){return text;}};}function matches(text,pos,pattern){return text.substring(pos,pos+pattern.length)==pattern;}function findClosingPair(open,matcher){var stack=[],tag=null;var text=matcher.text();for(var pos=open.range.end,len=text.length;pos')){pos=j+3;break;}}}if(tag=matcher.matches(pos)){if(tag.type=='open'&&!tag.selfClose){stack.push(tag.name);}else if(tag.type=='close'){if(!stack.length){return tag.name==open.name?tag:null;}if(_.last(stack)==tag.name){stack.pop();}else{var found=false;while(stack.length&&!found){var last=stack.pop();if(last==tag.name){found=true;}}if(!stack.length&&!found){return tag.name==open.name?tag:null;}}}}}}return{find:function(text,pos){var range=require('range');var matcher=createMatcher(text);var open=null,close=null;for(var i=pos
-;i>=0;i--){if(open=matcher.open(i)){if(open.selfClose){if(open.range.cmp(pos,'lt','gt')){break;}continue;}close=findClosingPair(open,matcher);if(close){var r=range.create2(open.range.start,close.range.end);if(r.contains(pos)){break;}}else if(open.range.contains(pos)){break;}open=null;}else if(matches(text,i,'-->')){for(var j=i-1;j>=0;j--){if(matches(text,j,'-->')){break;}else if(matches(text,j,'')){j+=3;break;}}open=comment(i,j);break;}}if(open){var outerRange=null;var innerRange=null;if(close){outerRange=range.create2(open.range.start,close.range.end);innerRange=range.create2(open.range.end,close.range.start);}else{outerRange=innerRange=range.create2(open.range.start,open.range.end);}if(open.type=='comment'){var _c=outerRange.substring(text);innerRange.start+=_c.length-_c.replace(/^<\!--\s*/,'').length;innerRange.end-=_c.length-_c.replace(/\s*-->$/,'').length;}return{open
-:open,close:close,type:open.type=='comment'?'comment':'tag',innerRange:innerRange,innerContent:function(){return this.innerRange.substring(text);},outerRange:outerRange,outerContent:function(){return this.outerRange.substring(text);},range:!innerRange.length()||!innerRange.cmp(pos,'lte','gte')?outerRange:innerRange,content:function(){return this.range.substring(text);},source:text};}},tag:function(text,pos){var result=this.find(text,pos);if(result&&result.type=='tag'){return result;}}};});emmet.define('tabStops',function(require,_){var startPlaceholderNum=100;var tabstopIndex=0;var defaultOptions={replaceCarets:false,escape:function(ch){return'\\'+ch;},tabstop:function(data){return data.token;},variable:function(data){return data.token;}};require('abbreviationParser').addOutputProcessor(function(text,node,type){var maxNum=0;var tabstops=require('tabStops');var utils=require('utils');var tsOptions={tabstop:function(data){var group=parseInt(data.group);if(group==0)return'${0}';if(group>
-maxNum)maxNum=group;if(data.placeholder){var ix=group+tabstopIndex;var placeholder=tabstops.processText(data.placeholder,tsOptions);return'${'+ix+':'+placeholder+'}';}else{return'${'+(group+tabstopIndex)+'}';}}};text=tabstops.processText(text,tsOptions);text=utils.replaceVariables(text,tabstops.variablesResolver(node));tabstopIndex+=maxNum+1;return text;});return{extract:function(text,options){var utils=require('utils');var placeholders={carets:''};var marks=[];options=_.extend({},defaultOptions,options,{tabstop:function(data){var token=data.token;var ret='';if(data.placeholder=='cursor'){marks.push({start:data.start,end:data.start+token.length,group:'carets',value:''});}else{if('placeholder'in data)placeholders[data.group]=data.placeholder;if(data.group in placeholders)ret=placeholders[data.group];marks.push({start:data.start,end:data.start+token.length,group:data.group,value:ret});}return token;}});if(options.replaceCarets){text=text.replace(new RegExp(utils.escapeForRegexp(utils.
-getCaretPlaceholder()),'g'),'${0:cursor}');}text=this.processText(text,options);var buf=utils.stringBuilder(),lastIx=0;var tabStops=_.map(marks,function(mark){buf.append(text.substring(lastIx,mark.start));var pos=buf.length;var ph=placeholders[mark.group]||'';buf.append(ph);lastIx=mark.end;return{group:mark.group,start:pos,end:pos+ph.length};});buf.append(text.substring(lastIx));return{text:buf.toString(),tabstops:_.sortBy(tabStops,'start')};},processText:function(text,options){options=_.extend({},defaultOptions,options);var buf=require('utils').stringBuilder();var stream=require('stringStream').create(text);var ch,m,a;while(ch=stream.next()){if(ch=='\\'&&!stream.eol()){buf.append(options.escape(stream.next()));continue;}a=ch;if(ch=='$'){stream.start=stream.pos-1;if(m=stream.match(/^[0-9]+/)){a=options.tabstop({start:buf.length,group:stream.current().substr(1),token:stream.current()});}else if(m=stream.match(/^\{([a-z_\-][\w\-]*)\}/)){a=options.variable({start:buf.length,name:m[1],
-token:stream.current()});}else if(m=stream.match(/^\{([0-9]+)(:.+?)?\}/,false)){stream.skipToPair('{','}');var obj={start:buf.length,group:m[1],token:stream.current()};var placeholder=obj.token.substring(obj.group.length+2,obj.token.length-1);if(placeholder){obj.placeholder=placeholder.substr(1);}a=options.tabstop(obj);}}buf.append(a);}return buf.toString();},upgrade:function(node,offset){var maxNum=0;var options={tabstop:function(data){var group=parseInt(data.group);if(group>maxNum)maxNum=group;if(data.placeholder)return'${'+(group+offset)+':'+data.placeholder+'}';else return'${'+(group+offset)+'}';}};_.each(['start','end','content'],function(p){node[p]=this.processText(node[p],options);},this);return maxNum;},variablesResolver:function(node){var placeholderMemo={};var res=require('resources');return function(str,varName){if(varName=='child')return str;if(varName=='cursor')return require('utils').getCaretPlaceholder();var attr=node.attribute(varName);if(!_.isUndefined(attr)&&attr!==
-str){return attr;}var varValue=res.getVariable(varName);if(varValue)return varValue;if(!placeholderMemo[varName])placeholderMemo[varName]=startPlaceholderNum++;return'${'+placeholderMemo[varName]+':'+varName+'}';};},resetTabstopIndex:function(){tabstopIndex=0;startPlaceholderNum=100;}};});emmet.define('preferences',function(require,_){var preferences={};var defaults={};var _dbgDefaults=null;var _dbgPreferences=null;function toBoolean(val){if(_.isString(val)){val=val.toLowerCase();return val=='yes'||val=='true'||val=='1';}return!!val;}function isValueObj(obj){return _.isObject(obj)&&'value'in obj&&_.keys(obj).length<3;}return{define:function(name,value,description){var prefs=name;if(_.isString(name)){prefs={};prefs[name]={value:value,description:description};}_.each(prefs,function(v,k){defaults[k]=isValueObj(v)?v:{value:v};});},set:function(name,value){var prefs=name;if(_.isString(name)){prefs={};prefs[name]=value;}_.each(prefs,function(v,k){if(!(k in defaults)){throw'Property "'+k+
-'" is not defined. You should define it first with `define` method of current module';}if(v!==defaults[k].value){switch(typeof defaults[k].value){case'boolean':v=toBoolean(v);break;case'number':v=parseInt(v+'',10)||0;break;default:if(v!==null){v+='';}}preferences[k]=v;}else if(k in preferences){delete preferences[k];}});},get:function(name){if(name in preferences)return preferences[name];if(name in defaults)return defaults[name].value;return void 0;},getArray:function(name){var val=this.get(name);if(_.isUndefined(val)||val===null||val===''){return null;}val=_.map(val.split(','),require('utils').trim);if(!val.length){return null;}return val;},getDict:function(name){var result={};_.each(this.getArray(name),function(val){var parts=val.split(':');result[parts[0]]=parts[1];});return result;},description:function(name){return name in defaults?defaults[name].description:void 0;},remove:function(name){if(!_.isArray(name))name=[name];_.each(name,function(key){if(key in preferences)delete
-preferences[key];if(key in defaults)delete defaults[key];});},list:function(){return _.map(_.keys(defaults).sort(),function(key){return{name:key,value:this.get(key),type:typeof defaults[key].value,description:defaults[key].description};},this);},load:function(json){_.each(json,function(value,key){this.set(key,value);},this);},exportModified:function(){return _.clone(preferences);},reset:function(){preferences={};},_startTest:function(){_dbgDefaults=defaults;_dbgPreferences=preferences;defaults={};preferences={};},_stopTest:function(){defaults=_dbgDefaults;preferences=_dbgPreferences;}};});emmet.define('filters',function(require,_){var registeredFilters={};var basicFilters='html';function list(filters){if(!filters)return[];if(_.isString(filters))return filters.split(/[\|,]/g);return filters;}return{add:function(name,fn){registeredFilters[name]=fn;},apply:function(tree,filters,profile){var utils=require('utils');profile=require('profile').get(profile);_.each(list(filters),function(filter
-){var name=utils.trim(filter.toLowerCase());if(name&&name in registeredFilters){tree=registeredFilters[name](tree,profile);}});return tree;},composeList:function(syntax,profile,additionalFilters){profile=require('profile').get(profile);var filters=list(profile.filters||require('resources').findItem(syntax,'filters')||basicFilters);if(profile.extraFilters){filters=filters.concat(list(profile.extraFilters));}if(additionalFilters){filters=filters.concat(list(additionalFilters));}if(!filters||!filters.length){filters=list(basicFilters);}return filters;},extractFromAbbreviation:function(abbr){var filters='';abbr=abbr.replace(/\|([\w\|\-]+)$/,function(str,p1){filters=p1;return'';});return[abbr,list(filters)];}};});emmet.define('elements',function(require,_){var factories={};var reAttrs=/([\w\-:]+)\s*=\s*(['"])(.*?)\2/g;var result={add:function(name,factory){var that=this;factories[name]=function(){var elem=factory.apply(that,arguments);if(elem)elem.type=name;return elem;};},get:function(name
-){return factories[name];},create:function(name){var args=[].slice.call(arguments,1);var factory=this.get(name);return factory?factory.apply(this,args):null;},is:function(elem,type){return elem&&elem.type===type;}};function commonFactory(value){return{data:value};}result.add('element',function(elementName,attrs,isEmpty){var ret={name:elementName,is_empty:!!isEmpty};if(attrs){ret.attributes=[];if(_.isArray(attrs)){ret.attributes=attrs;}else if(_.isString(attrs)){var m;while(m=reAttrs.exec(attrs)){ret.attributes.push({name:m[1],value:m[3]});}}else{_.each(attrs,function(value,name){ret.attributes.push({name:name,value:value});});}}return ret;});result.add('snippet',commonFactory);result.add('reference',commonFactory);result.add('empty',function(){return{};});return result;});emmet.define('editTree',function(require,_,core){var range=require('range').create;function EditContainer(source,options){this.options=_.extend({offset:0},options);this.source=source;this._children=[];this._positions=
-{name:0};this.initialize.apply(this,arguments);}EditContainer.extend=core.extend;EditContainer.prototype={initialize:function(){},_updateSource:function(value,start,end){var r=range(start,_.isUndefined(end)?0:end-start);var delta=value.length-r.length();var update=function(obj){_.each(obj,function(v,k){if(v>=r.end)obj[k]+=delta;});};update(this._positions);_.each(this.list(),function(item){update(item._positions);});this.source=require('utils').replaceSubstring(this.source,value,r);},add:function(name,value,pos){var item=new EditElement(name,value);this._children.push(item);return item;},get:function(name){if(_.isNumber(name))return this.list()[name];if(_.isString(name))return _.find(this.list(),function(prop){return prop.name()===name;});return name;},getAll:function(name){if(!_.isArray(name))name=[name];var names=[],indexes=[];_.each(name,function(item){if(_.isString(item))names.push(item);else if(_.isNumber(item))indexes.push(item);});return _.filter(this.list(),function(attribute,i
-){return _.include(indexes,i)||_.include(names,attribute.name());});},value:function(name,value,pos){var element=this.get(name);if(element)return element.value(value);if(!_.isUndefined(value)){return this.add(name,value,pos);}},values:function(name){return _.map(this.getAll(name),function(element){return element.value();});},remove:function(name){var element=this.get(name);if(element){this._updateSource('',element.fullRange());this._children=_.without(this._children,element);}},list:function(){return this._children;},indexOf:function(item){return _.indexOf(this.list(),this.get(item));},name:function(val){if(!_.isUndefined(val)&&this._name!==(val=String(val))){this._updateSource(val,this._positions.name,this._positions.name+this._name.length);this._name=val;}return this._name;},nameRange:function(isAbsolute){return range(this._positions.name+(isAbsolute?this.options.offset:0),this.name());},range:function(isAbsolute){return range(isAbsolute?this.options.offset:0,this.toString());},
-itemFromPosition:function(pos,isAbsolute){return _.find(this.list(),function(elem){return elem.range(isAbsolute).inside(pos);});},toString:function(){return this.source;}};function EditElement(parent,nameToken,valueToken){this.parent=parent;this._name=nameToken.value;this._value=valueToken?valueToken.value:'';this._positions={name:nameToken.start,value:valueToken?valueToken.start:-1};this.initialize.apply(this,arguments);}EditElement.extend=core.extend;EditElement.prototype={initialize:function(){},_pos:function(num,isAbsolute){return num+(isAbsolute?this.parent.options.offset:0);},value:function(val){if(!_.isUndefined(val)&&this._value!==(val=String(val))){this.parent._updateSource(val,this.valueRange());this._value=val;}return this._value;},name:function(val){if(!_.isUndefined(val)&&this._name!==(val=String(val))){this.parent._updateSource(val,this.nameRange());this._name=val;}return this._name;},namePosition:function(isAbsolute){return this._pos(this._positions.name,isAbsolute);},
-valuePosition:function(isAbsolute){return this._pos(this._positions.value,isAbsolute);},range:function(isAbsolute){return range(this.namePosition(isAbsolute),this.toString());},fullRange:function(isAbsolute){return this.range(isAbsolute);},nameRange:function(isAbsolute){return range(this.namePosition(isAbsolute),this.name());},valueRange:function(isAbsolute){return range(this.valuePosition(isAbsolute),this.value());},toString:function(){return this.name()+this.value();},valueOf:function(){return this.toString();}};return{EditContainer:EditContainer,EditElement:EditElement,createToken:function(start,value,type){var obj={start:start||0,value:value||'',type:type};obj.end=obj.start+obj.value.length;return obj;}};});emmet.define('cssEditTree',function(require,_){var defaultOptions={styleBefore:'\n\t',styleSeparator:': ',offset:0};var WHITESPACE_REMOVE_FROM_START=1;var WHITESPACE_REMOVE_FROM_END=2;function range(start,len){return require('range').create(start,len);}function
-trimWhitespaceTokens(tokens,mask){mask=mask||(WHITESPACE_REMOVE_FROM_START|WHITESPACE_REMOVE_FROM_END);var whitespace=['white','line'];if((mask&WHITESPACE_REMOVE_FROM_END)==WHITESPACE_REMOVE_FROM_END)while(tokens.length&&_.include(whitespace,_.last(tokens).type)){tokens.pop();}if((mask&WHITESPACE_REMOVE_FROM_START)==WHITESPACE_REMOVE_FROM_START)while(tokens.length&&_.include(whitespace,tokens[0].type)){tokens.shift();}return tokens;}function findSelectorRange(it){var tokens=[],token;var start=it.position(),end;while(token=it.next()){if(token.type=='{')break;tokens.push(token);}trimWhitespaceTokens(tokens);if(tokens.length){start=tokens[0].start;end=_.last(tokens).end;}else{end=start;}return range(start,end-start);}function findValueRange(it){var skipTokens=['white','line',':'];var tokens=[],token,start,end;it.nextUntil(function(tok){return!_.include(skipTokens,this.itemNext().type);});start=it.current().end;while(token=it.next()){if(token.type=='}'||token.type==';'){
-trimWhitespaceTokens(tokens,WHITESPACE_REMOVE_FROM_START|(token.type=='}'?WHITESPACE_REMOVE_FROM_END:0));if(tokens.length){start=tokens[0].start;end=_.last(tokens).end;}else{end=start;}return range(start,end-start);}tokens.push(token);}if(tokens.length){return range(tokens[0].start,_.last(tokens).end-tokens[0].start);}}function findParts(str){var stream=require('stringStream').create(str);var ch;var result=[];var sep=/[\s\u00a0,]/;var add=function(){stream.next();result.push(range(stream.start,stream.current()));stream.start=stream.pos;};stream.eatSpace();stream.start=stream.pos;while(ch=stream.next()){if(ch=='"'||ch=="'"){stream.next();if(!stream.skipTo(ch))break;add();}else if(ch=='('){stream.backUp(1);if(!stream.skipToPair('(',')'))break;stream.backUp(1);add();}else{if(sep.test(ch)){result.push(range(stream.start,stream.current().length-1));stream.eatWhile(sep);stream.start=stream.pos;}}}add();return _.chain(result).filter(function(item){return!!item.length();}).uniq(false,function(
-item){return item.toString();}).value();}function isValidIdentifier(it){var tokens=it.tokens;for(var i=it._i+1,il=tokens.length;i1){p.styleBefore='\n'+_.last(lines);}p.styleSeparator=source.substring(p.nameRange().end,p.valuePosition());p.styleBefore=_.last(p.styleBefore.split('*/'));p.styleSeparator=p.styleSeparator.replace(/\/\*.*?\*\//g,'');start=p.range().end;});},add:function(name,value,pos){var list=this.list();var start=this._positions.contentStart;var styles=_.pick(this.options,'styleBefore','styleSeparator');var editTree=require('editTree');if(_.isUndefined(pos))pos=list.length;var donor=list[pos
-];if(donor){start=donor.fullRange().start;}else if(donor=list[pos-1]){donor.end(';');start=donor.range().end;}if(donor){styles=_.pick(donor,'styleBefore','styleSeparator');}var nameToken=editTree.createToken(start+styles.styleBefore.length,name);var valueToken=editTree.createToken(nameToken.end+styles.styleSeparator.length,value);var property=new CSSEditElement(this,nameToken,valueToken,editTree.createToken(valueToken.end,';'));_.extend(property,styles);this._updateSource(property.styleBefore+property.toString(),start);this._children.splice(pos,0,property);return property;}});var CSSEditElement=require('editTree').EditElement.extend({initialize:function(rule,name,value,end){this.styleBefore=rule.options.styleBefore;this.styleSeparator=rule.options.styleSeparator;this._end=end.value;this._positions.end=end.start;},valueParts:function(isAbsolute){var parts=findParts(this.value());if(isAbsolute){var offset=this.valuePosition(true);_.each(parts,function(p){p.shift(offset);});}return parts;
-},end:function(val){if(!_.isUndefined(val)&&this._end!==val){this.parent._updateSource(val,this._positions.end,this._positions.end+this._end.length);this._end=val;}return this._end;},fullRange:function(isAbsolute){var r=this.range(isAbsolute);r.start-=this.styleBefore.length;return r;},toString:function(){return this.name()+this.styleSeparator+this.value()+this.end();}});return{parse:function(source,options){return new CSSEditContainer(source,options);},parseFromPosition:function(content,pos,isBackward){var bounds=this.extractRule(content,pos,isBackward);if(!bounds||!bounds.inside(pos))return null;return this.parse(bounds.substring(content),{offset:bounds.start});},extractRule:function(content,pos,isBackward){var result='';var len=content.length;var offset=pos;var stopChars='{}/\\<>\n\r';var bracePos=-1,ch;while(offset>=0){ch=content.charAt(offset);if(ch=='{'){bracePos=offset;break;}else if(ch=='}'&&!isBackward){offset++;break;}offset--;}while(offset=0){ch=content.charAt(offset);if(stopChars.indexOf(ch)!=-1)break;offset--;}selector=content.substring(offset+1,bracePos).replace(/^[\s\n\r]+/m,'');return require('range').create(bracePos-selector.length,result.length+selector.length);}return null;},baseName:function(name){return name.replace(/^\s*\-\w+\-/,'');},findParts:findParts};});emmet.define('xmlEditTree',function(require,_){var defaultOptions={styleBefore:' ',styleSeparator:'=',styleQuote:'"',offset:0};var startTag=/^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/m;var XMLEditContainer=require('editTree').EditContainer.extend({initialize:function(source,options){_.defaults(this.options,defaultOptions);this._positions.name=1;var attrToken=null;var tokens=require('xmlParser').parse(source);var range=require('range');
-_.each(tokens,function(token){token.value=range.create(token).substring(source);switch(token.type){case'tag':if(/^<[^\/]+/.test(token.value)){this._name=token.value.substring(1);}break;case'attribute':if(attrToken){this._children.push(new XMLEditElement(this,attrToken));}attrToken=token;break;case'string':this._children.push(new XMLEditElement(this,attrToken,token));attrToken=null;break;}},this);if(attrToken){this._children.push(new XMLEditElement(this,attrToken));}this._saveStyle();},_saveStyle:function(){var start=this.nameRange().end;var source=this.source;_.each(this.list(),function(p){p.styleBefore=source.substring(start,p.namePosition());if(p.valuePosition()!==-1){p.styleSeparator=source.substring(p.namePosition()+p.name().length,p.valuePosition()-p.styleQuote.length);}start=p.range().end;});},add:function(name,value,pos){var list=this.list();var start=this.nameRange().end;var editTree=require('editTree');var styles=_.pick(this.options,'styleBefore','styleSeparator','styleQuote')
-;if(_.isUndefined(pos))pos=list.length;var donor=list[pos];if(donor){start=donor.fullRange().start;}else if(donor=list[pos-1]){start=donor.range().end;}if(donor){styles=_.pick(donor,'styleBefore','styleSeparator','styleQuote');}value=styles.styleQuote+value+styles.styleQuote;var attribute=new XMLEditElement(this,editTree.createToken(start+styles.styleBefore.length,name),editTree.createToken(start+styles.styleBefore.length+name.length+styles.styleSeparator.length,value));_.extend(attribute,styles);this._updateSource(attribute.styleBefore+attribute.toString(),start);this._children.splice(pos,0,attribute);return attribute;}});var XMLEditElement=require('editTree').EditElement.extend({initialize:function(parent,nameToken,valueToken){this.styleBefore=parent.options.styleBefore;this.styleSeparator=parent.options.styleSeparator;var value='',quote=parent.options.styleQuote;if(valueToken){value=valueToken.value;quote=value.charAt(0);if(quote=='"'||quote=="'"){value=value.substring(1);}else{
-quote='';}if(quote&&value.charAt(value.length-1)==quote){value=value.substring(0,value.length-1);}}this.styleQuote=quote;this._value=value;this._positions.value=valueToken?valueToken.start+quote.length:-1;},fullRange:function(isAbsolute){var r=this.range(isAbsolute);r.start-=this.styleBefore.length;return r;},toString:function(){return this.name()+this.styleSeparator+this.styleQuote+this.value()+this.styleQuote;}});return{parse:function(source,options){return new XMLEditContainer(source,options);},parseFromPosition:function(content,pos,isBackward){var bounds=this.extractTag(content,pos,isBackward);if(!bounds||!bounds.inside(pos))return null;return this.parse(bounds.substring(content),{offset:bounds.start});},extractTag:function(content,pos,isBackward){var len=content.length,i;var range=require('range');var maxLen=Math.min(2000,len);var r=null;var match=function(pos){var m;if(content.charAt(pos)=='<'&&(m=content.substr(pos,maxLen).match(startTag)))return range.create(pos,m[0]);};for(i=
-pos;i>=0;i--){if(r=match(i))break;}if(r&&(r.inside(pos)||isBackward))return r;if(!r&&isBackward)return null;for(i=pos;i',range);}function
-toggleCSSComment(editor){var range=require('range').create(editor.getSelectionRange());var info=require('editorUtils').outputInfo(editor);if(!range.length()){var rule=require('cssEditTree').parseFromPosition(info.content,editor.getCaretPos());if(rule){var property=cssItemFromPosition(rule,editor.getCaretPos());range=property?property.range(true):require('range').create(rule.nameRange(true).start,rule.source);}}if(!range.length()){range=require('range').create(editor.getCurrentLineRange());require('utils').narrowToNonSpace(info.content,range);}return genericCommentToggle(editor,'/*','*/',range);}function cssItemFromPosition(rule,absPos){var relPos=absPos-(rule.options.offset||0);var reSafeChar=/^[\s\n\r]/;return _.find(rule.list(),function(item){if(item.range().end===relPos){return reSafeChar.test(rule.source.charAt(relPos));}return item.range().inside(relPos);});}function searchComment(text,from,startToken,endToken){var commentStart=-1;var commentEnd=-1;var hasMatch=function(str,start)
-{return text.substr(start,str.length)==str;};while(from--){if(hasMatch(startToken,from)){commentStart=from;break;}}if(commentStart!=-1){from=commentStart;var contentLen=text.length;while(contentLen>=from++){if(hasMatch(endToken,from)){commentEnd=from+endToken.length;break;}}}return(commentStart!=-1&&commentEnd!=-1)?require('range').create(commentStart,commentEnd-commentStart):null;}function genericCommentToggle(editor,commentStart,commentEnd,range){var editorUtils=require('editorUtils');var content=editorUtils.outputInfo(editor).content;var caretPos=editor.getCaretPos();var newContent=null;var utils=require('utils');function removeComment(str){return str.replace(new RegExp('^'+utils.escapeForRegexp(commentStart)+'\\s*'),function(str){caretPos-=str.length;return'';}).replace(new RegExp('\\s*'+utils.escapeForRegexp(commentEnd)+'$'),'');}var commentRange=searchComment(content,caretPos,commentStart,commentEnd);if(commentRange&&commentRange.overlap(range)){range=commentRange;newContent=
-removeComment(range.substring(content));}else{newContent=commentStart+' '+range.substring(content).replace(new RegExp(utils.escapeForRegexp(commentStart)+'\\s*|\\s*'+utils.escapeForRegexp(commentEnd),'g'),'')+' '+commentEnd;caretPos+=commentStart.length+1;}if(newContent!==null){newContent=utils.escapeText(newContent);editor.setCaretPos(range.start);editor.replaceContent(editorUtils.unindent(editor,newContent),range.start,range.end);editor.setCaretPos(caretPos);return true;}return false;}require('actions').add('toggle_comment',function(editor){var info=require('editorUtils').outputInfo(editor);if(info.syntax=='css'){var caretPos=editor.getCaretPos();var tag=require('htmlMatcher').tag(info.content,caretPos);if(tag&&tag.open.range.inside(caretPos)){info.syntax='html';}}if(info.syntax=='css')return toggleCSSComment(editor);return toggleHTMLComment(editor);});});emmet.exec(function(require,_){function findNewEditPoint(editor,inc,offset){inc=inc||1;offset=offset||0;var curPoint=editor.
-getCaretPos()+offset;var content=String(editor.getContent());var maxLen=content.length;var nextPoint=-1;var reEmptyLine=/^\s+$/;function getLine(ix){var start=ix;while(start>=0){var c=content.charAt(start);if(c=='\n'||c=='\r')break;start--;}return content.substring(start,ix);}while(curPoint<=maxLen&&curPoint>=0){curPoint+=inc;var curChar=content.charAt(curPoint);var nextChar=content.charAt(curPoint+1);var prevChar=content.charAt(curPoint-1);switch(curChar){case'"':case'\'':if(nextChar==curChar&&prevChar=='='){nextPoint=curPoint+1;}break;case'>':if(nextChar=='<'){nextPoint=curPoint+1;}break;case'\n':case'\r':if(reEmptyLine.test(getLine(curPoint-1))){nextPoint=curPoint;}break;}if(nextPoint!=-1)break;}return nextPoint;}var actions=require('actions');actions.add('prev_edit_point',function(editor){var curPos=editor.getCaretPos();var newPoint=findNewEditPoint(editor,-1);if(newPoint==curPos)newPoint=findNewEditPoint(editor,-1,-2);if(newPoint!=-1){editor.setCaretPos(newPoint);return true;}
-return false;},{label:'Previous Edit Point'});actions.add('next_edit_point',function(editor){var newPoint=findNewEditPoint(editor,1);if(newPoint!=-1){editor.setCaretPos(newPoint);return true;}return false;});});emmet.exec(function(require,_){var startTag=/^<([\w\:\-]+)((?:\s+[\w\-:]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;function findItem(editor,isBackward,extractFn,rangeFn){var range=require('range');var content=require('editorUtils').outputInfo(editor).content;var contentLength=content.length;var itemRange,rng;var prevRange=range.create(-1,0);var sel=range.create(editor.getSelectionRange());var searchPos=sel.start,loop=100000;while(searchPos>=0&&searchPos0){if((itemRange=extractFn(content,searchPos,isBackward))){if(prevRange.equal(itemRange)){break;}prevRange=itemRange.clone();rng=rangeFn(itemRange.substring(content),itemRange.start,sel.clone());if(rng){editor.createSelection(rng.start,rng.end);return true;}else{searchPos=isBackward?
-itemRange.start:itemRange.end-1;}}searchPos+=isBackward?-1:1;}return false;}function findNextHTMLItem(editor){var isFirst=true;return findItem(editor,false,function(content,searchPos){if(isFirst){isFirst=false;return findOpeningTagFromPosition(content,searchPos);}else{return getOpeningTagFromPosition(content,searchPos);}},function(tag,offset,selRange){return getRangeForHTMLItem(tag,offset,selRange,false);});}function findPrevHTMLItem(editor){return findItem(editor,true,getOpeningTagFromPosition,function(tag,offset,selRange){return getRangeForHTMLItem(tag,offset,selRange,true);});}function makePossibleRangesHTML(source,tokens,offset){offset=offset||0;var range=require('range');var result=[];var attrStart=-1,attrName='',attrValue='',attrValueRange,tagName;_.each(tokens,function(tok){switch(tok.type){case'tag':tagName=source.substring(tok.start,tok.end);if(/^<[\w\:\-]/.test(tagName)){result.push(range.create({start:tok.start+1,end:tok.end}));}break;case'attribute':attrStart=tok.start;
-attrName=source.substring(tok.start,tok.end);break;case'string':result.push(range.create(attrStart,tok.end-attrStart));attrValueRange=range.create(tok);attrValue=attrValueRange.substring(source);if(isQuote(attrValue.charAt(0)))attrValueRange.start++;if(isQuote(attrValue.charAt(attrValue.length-1)))attrValueRange.end--;result.push(attrValueRange);if(attrName=='class'){result=result.concat(classNameRanges(attrValueRange.substring(source),attrValueRange.start));}break;}});_.each(result,function(r){r.shift(offset);});return _.chain(result).filter(function(item){return!!item.length();}).uniq(false,function(item){return item.toString();}).value();}function classNameRanges(className,offset){offset=offset||0;var result=[];var stream=require('stringStream').create(className);var range=require('range');stream.eatSpace();stream.start=stream.pos;var ch;while(ch=stream.next()){if(/[\s\u00a0]/.test(ch)){result.push(range.create(stream.start+offset,stream.pos-stream.start-1));stream.eatSpace();stream
-.start=stream.pos;}}result.push(range.create(stream.start+offset,stream.pos-stream.start));return result;}function getRangeForHTMLItem(tag,offset,selRange,isBackward){var ranges=makePossibleRangesHTML(tag,require('xmlParser').parse(tag),offset);if(isBackward)ranges.reverse();var curRange=_.find(ranges,function(r){return r.equal(selRange);});if(curRange){var ix=_.indexOf(ranges,curRange);if(ix1)return matchedRanges[1];}return _.find(ranges,function(r){return r.end>selRange.end;});}function findOpeningTagFromPosition(html,pos){var tag;while(pos>=0){if(tag=getOpeningTagFromPosition(html,pos))return tag;pos--;}return null;}function getOpeningTagFromPosition(html,pos){var m;if(html.charAt(pos)=='<'&&(m=html.substring(pos,html.length).match(startTag
-))){return require('range').create(pos,m[0]);}}function isQuote(ch){return ch=='"'||ch=="'";}function makePossibleRangesCSS(property){var valueRange=property.valueRange(true);var result=[property.range(true),valueRange];var stringStream=require('stringStream');var cssEditTree=require('cssEditTree');var range=require('range');var value=property.value();_.each(property.valueParts(),function(r){var clone=r.clone();result.push(clone.shift(valueRange.start));var stream=stringStream.create(r.substring(value));if(stream.match(/^[\w\-]+\(/,true)){stream.start=stream.pos;stream.skipToPair('(',')');var fnBody=stream.current();result.push(range.create(clone.start+stream.start,fnBody));_.each(cssEditTree.findParts(fnBody),function(part){result.push(range.create(clone.start+stream.start+part.start,part.substring(fnBody)));});}});return _.chain(result).filter(function(item){return!!item.length();}).uniq(false,function(item){return item.toString();}).value();}function matchedRangeForCSSProperty(rule,
-selRange,isBackward){var property=null;var possibleRanges,curRange=null,ix;var list=rule.list();var searchFn,nearestItemFn;if(isBackward){list.reverse();searchFn=function(p){return p.range(true).start<=selRange.start;};nearestItemFn=function(r){return r.start=selRange.end;};nearestItemFn=function(r){return r.end>selRange.start;};}while(property=_.find(list,searchFn)){possibleRanges=makePossibleRangesCSS(property);if(isBackward)possibleRanges.reverse();curRange=_.find(possibleRanges,function(r){return r.equal(selRange);});if(!curRange){var matchedRanges=_.filter(possibleRanges,function(r){return r.inside(selRange.end);});if(matchedRanges.length>1){curRange=matchedRanges[1];break;}if(curRange=_.find(possibleRanges,nearestItemFn))break;}else{ix=_.indexOf(possibleRanges,curRange);if(ix!=possibleRanges.length-1){curRange=possibleRanges[ix+1];break;}}curRange=null;selRange.start=selRange.end=isBackward?property.range(true)
-.start-1:property.range(true).end+1;}return curRange;}function findNextCSSItem(editor){return findItem(editor,false,require('cssEditTree').extractRule,getRangeForNextItemInCSS);}function findPrevCSSItem(editor){return findItem(editor,true,require('cssEditTree').extractRule,getRangeForPrevItemInCSS);}function getRangeForNextItemInCSS(rule,offset,selRange){var tree=require('cssEditTree').parse(rule,{offset:offset});var range=tree.nameRange(true);if(selRange.endrange.start){return range;}}return curRange;}var actions=require('actions');actions.add('select_next_item',function(editor){if(editor.getSyntax()=='css')return findNextCSSItem(editor);else return findNextHTMLItem(
-editor);});actions.add('select_previous_item',function(editor){if(editor.getSyntax()=='css')return findPrevCSSItem(editor);else return findPrevHTMLItem(editor);});});emmet.exec(function(require,_){var actions=require('actions');var matcher=require('htmlMatcher');var lastMatch=null;function matchPair(editor,direction){direction=String((direction||'out').toLowerCase());var info=require('editorUtils').outputInfo(editor);var range=require('range');var sel=range.create(editor.getSelectionRange());var content=info.content;if(lastMatch&&!lastMatch.range.equal(sel)){lastMatch=null;}if(lastMatch&&sel.length()){if(direction=='in'){if(lastMatch.type=='tag'&&!lastMatch.close){return false;}else{if(lastMatch.range.equal(lastMatch.outerRange)){lastMatch.range=lastMatch.innerRange;}else{var narrowed=require('utils').narrowToNonSpace(content,lastMatch.innerRange);lastMatch=matcher.find(content,narrowed.start+1);if(lastMatch&&lastMatch.range.equal(sel)&&lastMatch.outerRange.equal(sel)){lastMatch.range=
-lastMatch.innerRange;}}}}else{if(!lastMatch.innerRange.equal(lastMatch.outerRange)&&lastMatch.range.equal(lastMatch.innerRange)&&sel.equal(lastMatch.range)){lastMatch.range=lastMatch.outerRange;}else{lastMatch=matcher.find(content,sel.start);if(lastMatch&&lastMatch.range.equal(sel)&&lastMatch.innerRange.equal(sel)){lastMatch.range=lastMatch.outerRange;}}}}else{lastMatch=matcher.find(content,sel.start);}if(lastMatch&&!lastMatch.range.equal(sel)){editor.createSelection(lastMatch.range.start,lastMatch.range.end);return true;}lastMatch=null;return false;}actions.add('match_pair',matchPair,{hidden:true});actions.add('match_pair_inward',function(editor){return matchPair(editor,'in');},{label:'HTML/Match Pair Tag (inward)'});actions.add('match_pair_outward',function(editor){return matchPair(editor,'out');},{label:'HTML/Match Pair Tag (outward)'});actions.add('matching_pair',function(editor){var content=String(editor.getContent());var caretPos=editor.getCaretPos();if(content.charAt(caretPos)==
-'<')caretPos++;var tag=matcher.tag(content,caretPos);if(tag&&tag.close){if(tag.open.range.inside(caretPos)){editor.setCaretPos(tag.close.range.start);}else{editor.setCaretPos(tag.open.range.start);}return true;}return false;},{label:'HTML/Go To Matching Tag Pair'});});emmet.exec(function(require,_){require('actions').add('remove_tag',function(editor){var utils=require('utils');var info=require('editorUtils').outputInfo(editor);var tag=require('htmlMatcher').tag(info.content,editor.getCaretPos());if(tag){if(!tag.close){editor.replaceContent(utils.getCaretPlaceholder(),tag.range.start,tag.range.end);}else{var tagContentRange=utils.narrowToNonSpace(info.content,tag.innerRange);var startLineBounds=utils.findNewlineBounds(info.content,tagContentRange.start);var startLinePad=utils.getLinePadding(startLineBounds.substring(info.content));var tagContent=tagContentRange.substring(info.content);tagContent=utils.unindentString(tagContent,startLinePad);editor.replaceContent(utils.
-getCaretPlaceholder()+utils.escapeText(tagContent),tag.outerRange.start,tag.outerRange.end);}return true;}return false;},{label:'HTML/Remove Tag'});});emmet.exec(function(require,_){function joinTag(editor,profile,tag){var utils=require('utils');var slash=profile.selfClosing()||' /';var content=tag.open.range.substring(tag.source).replace(/\s*>$/,slash+'>');var caretPos=editor.getCaretPos();if(content.length+tag.outerRange.start$/,'>');caretPos=tag.outerRange.start+content.length;content+=tagContent+''+tag.
-open.name+'>';content=utils.escapeText(content);editor.replaceContent(content,tag.outerRange.start,tag.outerRange.end);editor.setCaretPos(caretPos);return true;}require('actions').add('split_join_tag',function(editor,profileName){var matcher=require('htmlMatcher');var info=require('editorUtils').outputInfo(editor,null,profileName);var profile=require('profile').get(info.profile);var tag=matcher.tag(info.content,editor.getCaretPos());if(tag){return tag.close?joinTag(editor,profile,tag):splitTag(editor,profile,tag);}return false;},{label:'HTML/Split\\Join Tag Declaration'});});emmet.define('reflectCSSValue',function(require,_){var handlers=require('handlerList').create();require('actions').add('reflect_css_value',function(editor){if(editor.getSyntax()!='css')return false;return require('actionUtils').compoundUpdate(editor,doCSSReflection(editor));},{label:'CSS/Reflect Value'});function doCSSReflection(editor){var cssEditTree=require('cssEditTree');var outputInfo=require('editorUtils').
-outputInfo(editor);var caretPos=editor.getCaretPos();var cssRule=cssEditTree.parseFromPosition(outputInfo.content,caretPos);if(!cssRule)return;var property=cssRule.itemFromPosition(caretPos,true);if(!property)return;var oldRule=cssRule.source;var offset=cssRule.options.offset;var caretDelta=caretPos-offset-property.range().start;handlers.exec(false,[property]);if(oldRule!==cssRule.source){return{data:cssRule.source,start:offset,end:offset+oldRule.length,caret:offset+property.range().start+caretDelta};}}function getReflectedCSSName(name){name=require('cssEditTree').baseName(name);var vendorPrefix='^(?:\\-\\w+\\-)?',m;if(name=='opacity'||name=='filter'){return new RegExp(vendorPrefix+'(?:opacity|filter)$');}else if(m=name.match(/^border-radius-(top|bottom)(left|right)/)){return new RegExp(vendorPrefix+'(?:'+name+'|border-'+m[1]+'-'+m[2]+'-radius)$');}else if(m=name.match(/^border-(top|bottom)-(left|right)-radius/)){return new RegExp(vendorPrefix+'(?:'+name+'|border-radius-'+m[1]+m[2]+
-')$');}return new RegExp(vendorPrefix+name+'$');}function reflectValue(donor,receiver){var value=getReflectedValue(donor.name(),donor.value(),receiver.name(),receiver.value());receiver.value(value);}function getReflectedValue(curName,curValue,refName,refValue){var cssEditTree=require('cssEditTree');var utils=require('utils');curName=cssEditTree.baseName(curName);refName=cssEditTree.baseName(refName);if(curName=='opacity'&&refName=='filter'){return refValue.replace(/opacity=[^)]*/i,'opacity='+Math.floor(parseFloat(curValue)*100));}else if(curName=='filter'&&refName=='opacity'){var m=curValue.match(/opacity=([^)]*)/i);return m?utils.prettifyNumber(parseInt(m[1])/100):refValue;}return curValue;}handlers.add(function(property){var reName=getReflectedCSSName(property.name());_.each(property.parent.list(),function(p){if(reName.test(p.name())){reflectValue(property,p);}});},{order:-1});return{addHandler:function(fn,options){handlers.add(fn,options);},removeHandler:function(fn){handlers.remove
-(fn,options);}};});emmet.exec(function(require,_){require('actions').add('evaluate_math_expression',function(editor){var actionUtils=require('actionUtils');var utils=require('utils');var content=String(editor.getContent());var chars='.+-*/\\';var sel=require('range').create(editor.getSelectionRange());if(!sel.length()){sel=actionUtils.findExpressionBounds(editor,function(ch){return utils.isNumeric(ch)||chars.indexOf(ch)!=-1;});}if(sel&&sel.length()){var expr=sel.substring(content);expr=expr.replace(/([\d\.\-]+)\\([\d\.\-]+)/g,'Math.round($1/$2)');try{var result=utils.prettifyNumber(new Function('return '+expr)());editor.replaceContent(result,sel.start,sel.end);editor.setCaretPos(sel.start+result.length);return true;}catch(e){}}return false;},{label:'Numbers/Evaluate Math Expression'});});emmet.exec(function(require,_){function incrementNumber(editor,step){var utils=require('utils');var actionUtils=require('actionUtils');var hasSign=false;var hasDecimal=false;var r=actionUtils.
-findExpressionBounds(editor,function(ch,pos,content){if(utils.isNumeric(ch))return true;if(ch=='.'){if(!utils.isNumeric(content.charAt(pos+1)))return false;return hasDecimal?false:hasDecimal=true;}if(ch=='-')return hasSign?false:hasSign=true;return false;});if(r&&r.length()){var strNum=r.substring(String(editor.getContent()));var num=parseFloat(strNum);if(!_.isNaN(num)){num=utils.prettifyNumber(num+step);if(/^(\-?)0+[1-9]/.test(strNum)){var minus='';if(RegExp.$1){minus='-';num=num.substring(1);}var parts=num.split('.');parts[0]=utils.zeroPadString(parts[0],intLength(strNum));num=minus+parts.join('.');}editor.replaceContent(num,r.start,r.end);editor.createSelection(r.start,r.start+num.length);return true;}}return false;}function intLength(num){num=num.replace(/^\-/,'');if(~num.indexOf('.')){return num.split('.')[0].length;}return num.length;}var actions=require('actions');_.each([1,-1,10,-10,0.1,-0.1],function(num){var prefix=num>0?'increment':'decrement';actions.add(prefix+
-'_number_by_'+String(Math.abs(num)).replace('.','').substring(0,2),function(editor){return incrementNumber(editor,num);},{label:'Numbers/'+prefix.charAt(0).toUpperCase()+prefix.substring(1)+' number by '+Math.abs(num)});});});emmet.exec(function(require,_){var actions=require('actions');var prefs=require('preferences');prefs.define('css.closeBraceIndentation','\n','Indentation before closing brace of CSS rule. Some users prefere '+'indented closing brace of CSS rule for better readability. '+'This preference’s value will be automatically inserted before '+'closing brace when user adds newline in newly created CSS rule '+'(e.g. when “Insert formatted linebreak” action will be performed '+'in CSS file). If you’re such user, you may want to write put a value '+'like \\n\\t in this preference.');actions.add('insert_formatted_line_break_only',function(editor){var utils=require('utils');var res=require('resources');var info=require('editorUtils').outputInfo(editor);var
-caretPos=editor.getCaretPos();var nl=utils.getNewline();if(_.include(['html','xml','xsl'],info.syntax)){var pad=res.getVariable('indentation');var tag=require('htmlMatcher').tag(info.content,caretPos);if(tag&&!tag.innerRange.length()){editor.replaceContent(nl+pad+utils.getCaretPlaceholder()+nl,caretPos);return true;}}else if(info.syntax=='css'){var content=info.content;if(caretPos&&content.charAt(caretPos-1)=='{'){var append=prefs.get('css.closeBraceIndentation');var pad=res.getVariable('indentation');var hasCloseBrace=content.charAt(caretPos)=='}';if(!hasCloseBrace){for(var i=caretPos,il=content.length,ch;icurPadding.length)editor.replaceContent(nl+nextPadding,caretPos,caretPos,true);else editor.replaceContent(nl,caretPos);}return true;},{hidden:true});});emmet.exec(function(require,_){require('actions').add('merge_lines',function(editor){var matcher=require('htmlMatcher');var utils=require('utils');var editorUtils=require('editorUtils');var info=editorUtils.outputInfo(editor);var selection=require('range').create(editor.getSelectionRange());if(!selection.length()){var pair=matcher.find(info.content,editor.getCaretPos());if(pair){selection=pair.outerRange;}}if(selection.
-length()){var text=selection.substring(info.content);var lines=utils.splitByLines(text);for(var i=1;i=0){if(startsWith('src=',text,caretPos)){if(m=text.substr(caretPos).match(/^(src=(["'])?)([^'"<>\s]+)\1?/)){data=m[3];caretPos+=m[1].length;}break;}else if(startsWith('url(',text,caretPos)){if(m=text.substr(caretPos).match(/^(url\((['"])?)([^'"\)\s]+)\1?/)){data=m[3];caretPos+=m[1].length;}break;}}}if(data){if(startsWith('data:',data))return decodeFromBase64
-(editor,data,caretPos);else return encodeToBase64(editor,data,caretPos);}return false;},{label:'Encode\\Decode data:URL image'});function startsWith(token,text,pos){pos=pos||0;return text.charAt(pos)==token.charAt(0)&&text.substr(pos,token.length)==token;}function encodeToBase64(editor,imgPath,pos){var file=require('file');var actionUtils=require('actionUtils');var editorFile=editor.getFilePath();var defaultMimeType='application/octet-stream';if(editorFile===null){throw"You should save your file before using this action";}var realImgPath=file.locateFile(editorFile,imgPath);if(realImgPath===null){throw"Can't find "+imgPath+' file';}file.read(realImgPath,function(err,content){if(err){throw'Unable to read '+realImgPath+': '+err;}var b64=require('base64').encode(String(content));if(!b64){throw"Can't encode file content to base64";}b64='data:'+(actionUtils.mimeTypes[String(file.getExt(realImgPath))]||defaultMimeType)+';base64,'+b64;editor.replaceContent('$0'+b64,pos,pos+imgPath.length);});
-return true;}function decodeFromBase64(editor,data,pos){var filePath=String(editor.prompt('Enter path to file (absolute or relative)'));if(!filePath)return false;var file=require('file');var absPath=file.createPath(editor.getFilePath(),filePath);if(!absPath){throw"Can't save file";}file.save(absPath,require('base64').decode(data.replace(/^data\:.+?;.+?,/,'')));editor.replaceContent('$0'+filePath,pos,pos+data.length);return true;}});emmet.exec(function(require,_){function updateImageSizeHTML(editor){var offset=editor.getCaretPos();var info=require('editorUtils').outputInfo(editor);var xmlElem=require('xmlEditTree').parseFromPosition(info.content,offset,true);if(xmlElem&&(xmlElem.name()||'').toLowerCase()=='img'){getImageSizeForSource(editor,xmlElem.value('src'),function(size){if(size){var compoundData=xmlElem.range(true);xmlElem.value('width',size.width);xmlElem.value('height',size.height,xmlElem.indexOf('width')+1);require('actionUtils').compoundUpdate(editor,_.extend(compoundData,{
-data:xmlElem.toString(),caret:offset}));}});}}function updateImageSizeCSS(editor){var offset=editor.getCaretPos();var info=require('editorUtils').outputInfo(editor);var cssRule=require('cssEditTree').parseFromPosition(info.content,offset,true);if(cssRule){var prop=cssRule.itemFromPosition(offset,true),m;if(prop&&(m=/url\((["']?)(.+?)\1\)/i.exec(prop.value()||''))){getImageSizeForSource(editor,m[2],function(size){if(size){var compoundData=cssRule.range(true);cssRule.value('width',size.width+'px');cssRule.value('height',size.height+'px',cssRule.indexOf('width')+1);require('actionUtils').compoundUpdate(editor,_.extend(compoundData,{data:cssRule.toString(),caret:offset}));}});}}}function getImageSizeForSource(editor,src,callback){var fileContent;var au=require('actionUtils');if(src){if(/^data:/.test(src)){fileContent=require('base64').decode(src.replace(/^data\:.+?;.+?,/,''));return callback(au.getImageSize(fileContent));}var file=require('file');var absPath=file.locateFile(editor.
-getFilePath(),src);if(absPath===null){throw"Can't find "+src+' file';}file.read(absPath,function(err,content){if(err){throw'Unable to read '+absPath+': '+err;}content=String(content);callback(au.getImageSize(content));});}}require('actions').add('update_image_size',function(editor){if(_.include(['css','less','scss'],String(editor.getSyntax()))){updateImageSizeCSS(editor);}else{updateImageSizeHTML(editor);}return true;});});emmet.define('cssResolver',function(require,_){var module=null;var prefixObj={prefix:'emmet',obsolete:false,transformName:function(name){return'-'+this.prefix+'-'+name;},properties:function(){return getProperties('css.'+this.prefix+'Properties')||[];},supports:function(name){return _.include(this.properties(),name);}};var vendorPrefixes={};var defaultValue='${1};';var prefs=require('preferences');prefs.define('css.valueSeparator',': ','Defines a symbol that should be placed between CSS property and '+'value when expanding CSS abbreviations.');prefs.define(
-'css.propertyEnd',';','Defines a symbol that should be placed at the end of CSS property '+'when expanding CSS abbreviations.');prefs.define('stylus.valueSeparator',' ','Defines a symbol that should be placed between CSS property and '+'value when expanding CSS abbreviations in Stylus dialect.');prefs.define('stylus.propertyEnd','','Defines a symbol that should be placed at the end of CSS property '+'when expanding CSS abbreviations in Stylus dialect.');prefs.define('sass.propertyEnd','','Defines a symbol that should be placed at the end of CSS property '+'when expanding CSS abbreviations in SASS dialect.');prefs.define('css.autoInsertVendorPrefixes',true,'Automatically generate vendor-prefixed copies of expanded CSS '+'property. By default, Emmet will generate vendor-prefixed '+'properties only when you put dash before abbreviation '+'(e.g. -bxsh). With this option enabled, you don’t '+'need dashes before abbreviations: Emmet will produce '+
-'vendor-prefixed properties for you.');var descTemplate=_.template('A comma-separated list of CSS properties that may have '+'<%= vendor %> vendor prefix. This list is used to generate '+'a list of prefixed properties when expanding -property '+'abbreviations. Empty list means that all possible CSS values may '+'have <%= vendor %> prefix.');var descAddonTemplate=_.template('A comma-separated list of additional CSS properties '+'for css.<%= vendor %>Preperties preference. '+'You should use this list if you want to add or remove a few CSS '+'properties to original set. To add a new property, simply write its name, '+'to remove it, precede property with hyphen. '+'For example, to add foo property and remove border-radius one, '+'the preference value will look like this: foo, -border-radius.');var props={'webkit':
-'animation, animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, appearance, backface-visibility, background-clip, background-composite, background-origin, background-size, border-fit, border-horizontal-spacing, border-image, border-vertical-spacing, box-align, box-direction, box-flex, box-flex-group, box-lines, box-ordinal-group, box-orient, box-pack, box-reflect, box-shadow, color-correction, column-break-after, column-break-before, column-break-inside, column-count, column-gap, column-rule-color, column-rule-style, column-rule-width, column-span, column-width, dashboard-region, font-smoothing, highlight, hyphenate-character, hyphenate-limit-after, hyphenate-limit-before, hyphens, line-box-contain, line-break, line-clamp, locale, margin-before-collapse, margin-after-collapse, marquee-direction, marquee-increment, marquee-repetition, marquee-style, mask-attachment, mask-box-image, mask-box-image-outset, mask-box-image-repeat, mask-box-image-slice, mask-box-image-source, mask-box-image-width, mask-clip, mask-composite, mask-image, mask-origin, mask-position, mask-repeat, mask-size, nbsp-mode, perspective, perspective-origin, rtl-ordering, text-combine, text-decorations-in-effect, text-emphasis-color, text-emphasis-position, text-emphasis-style, text-fill-color, text-orientation, text-security, text-stroke-color, text-stroke-width, transform, transition, transform-origin, transform-style, transition-delay, transition-duration, transition-property, transition-timing-function, user-drag, user-modify, user-select, writing-mode, svg-shadow, box-sizing, border-radius'
-,'moz':
-'animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, appearance, backface-visibility, background-inline-policy, binding, border-bottom-colors, border-image, border-left-colors, border-right-colors, border-top-colors, box-align, box-direction, box-flex, box-ordinal-group, box-orient, box-pack, box-shadow, box-sizing, column-count, column-gap, column-rule-color, column-rule-style, column-rule-width, column-width, float-edge, font-feature-settings, font-language-override, force-broken-image-icon, hyphens, image-region, orient, outline-radius-bottomleft, outline-radius-bottomright, outline-radius-topleft, outline-radius-topright, perspective, perspective-origin, stack-sizing, tab-size, text-blink, text-decoration-color, text-decoration-line, text-decoration-style, text-size-adjust, transform, transform-origin, transform-style, transition, transition-delay, transition-duration, transition-property, transition-timing-function, user-focus, user-input, user-modify, user-select, window-shadow, background-clip, border-radius'
-,'ms':
-'accelerator, backface-visibility, background-position-x, background-position-y, behavior, block-progression, box-align, box-direction, box-flex, box-line-progression, box-lines, box-ordinal-group, box-orient, box-pack, content-zoom-boundary, content-zoom-boundary-max, content-zoom-boundary-min, content-zoom-chaining, content-zoom-snap, content-zoom-snap-points, content-zoom-snap-type, content-zooming, filter, flow-from, flow-into, font-feature-settings, grid-column, grid-column-align, grid-column-span, grid-columns, grid-layer, grid-row, grid-row-align, grid-row-span, grid-rows, high-contrast-adjust, hyphenate-limit-chars, hyphenate-limit-lines, hyphenate-limit-zone, hyphens, ime-mode, interpolation-mode, layout-flow, layout-grid, layout-grid-char, layout-grid-line, layout-grid-mode, layout-grid-type, line-break, overflow-style, perspective, perspective-origin, perspective-origin-x, perspective-origin-y, scroll-boundary, scroll-boundary-bottom, scroll-boundary-left, scroll-boundary-right, scroll-boundary-top, scroll-chaining, scroll-rails, scroll-snap-points-x, scroll-snap-points-y, scroll-snap-type, scroll-snap-x, scroll-snap-y, scrollbar-arrow-color, scrollbar-base-color, scrollbar-darkshadow-color, scrollbar-face-color, scrollbar-highlight-color, scrollbar-shadow-color, scrollbar-track-color, text-align-last, text-autospace, text-justify, text-kashida-space, text-overflow, text-size-adjust, text-underline-position, touch-action, transform, transform-origin, transform-origin-x, transform-origin-y, transform-origin-z, transform-style, transition, transition-delay, transition-duration, transition-property, transition-timing-function, user-select, word-break, word-wrap, wrap-flow, wrap-margin, wrap-through, writing-mode'
-,'o':'dashboard-region, animation, animation-delay, animation-direction, animation-duration, animation-fill-mode, animation-iteration-count, animation-name, animation-play-state, animation-timing-function, border-image, link, link-source, object-fit, object-position, tab-size, table-baseline, transform, transform-origin, transition, transition-delay, transition-duration, transition-property, transition-timing-function, accesskey, input-format, input-required, marquee-dir, marquee-loop, marquee-speed, marquee-style'};_.each(props,function(v,k){prefs.define('css.'+k+'Properties',v,descTemplate({vendor:k}));prefs.define('css.'+k+'PropertiesAddon','',descAddonTemplate({vendor:k}));});prefs.define('css.unitlessProperties','z-index, line-height, opacity, font-weight, zoom','The list of properties whose values must not contain units.');prefs.define('css.intUnit','px','Default unit for integer values');prefs.define('css.floatUnit','em','Default unit for float values');prefs.define(
-'css.keywords','auto, inherit','A comma-separated list of valid keywords that can be used in CSS abbreviations.');prefs.define('css.keywordAliases','a:auto, i:inherit, s:solid, da:dashed, do:dotted, t:transparent','A comma-separated list of keyword aliases, used in CSS abbreviation. '+'Each alias should be defined as alias:keyword_name.');prefs.define('css.unitAliases','e:em, p:%, x:ex, r:rem','A comma-separated list of unit aliases, used in CSS abbreviation. '+'Each alias should be defined as alias:unit_value.');prefs.define('css.color.short',true,'Should color values like #ffffff be shortened to '+'#fff after abbreviation with color was expanded.');prefs.define('css.color.case','keep','Letter case of color values generated by abbreviations with color '+'(like c#0). Possible values are upper, '+'lower and keep.');prefs.define('css.fuzzySearch',true,
-'Enable fuzzy search among CSS snippet names. When enabled, every '+'unknown snippet will be scored against available snippet '+'names (not values or CSS properties!). The match with best score '+'will be used to resolve snippet value. For example, with this '+'preference enabled, the following abbreviations are equal: '+'ov:h == ov-h == o-h == '+'oh');prefs.define('css.fuzzySearchMinScore',0.3,'The minium score (from 0 to 1) that fuzzy-matched abbreviation should '+'achive. Lower values may produce many false-positive matches, '+'higher values may reduce possible matches.');prefs.define('css.alignVendor',false,'If set to true, all generated vendor-prefixed properties '+'will be aligned by real property name.');function isNumeric(ch){var code=ch&&ch.charCodeAt(0);return(ch&&ch=='.'||(code>47&&code<58));}function isSingleProperty(snippet){var utils=require('utils');snippet=utils.trim(snippet);if(~snippet.indexOf(
-'/*')||/[\n\r]/.test(snippet)){return false;}if(!/^[a-z0-9\-]+\s*\:/i.test(snippet)){return false;}snippet=require('tabStops').processText(snippet,{replaceCarets:true,tabstop:function(){return'value';}});return snippet.split(':').length==2;}function normalizeValue(value){if(value.charAt(0)=='-'&&!/^\-[\.\d]/.test(value)){value=value.replace(/^\-+/,'');}if(value.charAt(0)=='#'){return normalizeHexColor(value);}return getKeyword(value);}function normalizeHexColor(value){var hex=value.replace(/^#+/,'')||'0';if(hex.toLowerCase()=='t'){return'transparent';}var repeat=require('utils').repeatString;var color=null;switch(hex.length){case 1:color=repeat(hex,6);break;case 2:color=repeat(hex,3);break;case 3:color=hex.charAt(0)+hex.charAt(0)+hex.charAt(1)+hex.charAt(1)+hex.charAt(2)+hex.charAt(2);break;case 4:color=hex+hex.substr(0,2);break;case 5:color=hex+hex.charAt(0);break;default:color=hex.substr(0,6);}if(prefs.get('css.color.short')){var p=color.split('');if(p[0]==p[1]&&p[2]==p[3]&&p[4]==p[5
-]){color=p[0]+p[2]+p[4];}}switch(prefs.get('css.color.case')){case'upper':color=color.toUpperCase();break;case'lower':color=color.toLowerCase();break;}return'#'+color;}function getKeyword(name){var aliases=prefs.getDict('css.keywordAliases');return name in aliases?aliases[name]:name;}function getUnit(name){var aliases=prefs.getDict('css.unitAliases');return name in aliases?aliases[name]:name;}function isValidKeyword(keyword){return _.include(prefs.getArray('css.keywords'),getKeyword(keyword));}function hasPrefix(property,prefix){var info=vendorPrefixes[prefix];if(!info)info=_.find(vendorPrefixes,function(data){return data.prefix==prefix;});return info&&info.supports(property);}function findPrefixes(property,noAutofill){var result=[];_.each(vendorPrefixes,function(obj,prefix){if(hasPrefix(property,prefix)){result.push(prefix);}});if(!result.length&&!noAutofill){_.each(vendorPrefixes,function(obj,prefix){if(!obj.obsolete)result.push(prefix);});}return result;}function addPrefix(name,obj)
-{if(_.isString(obj))obj={prefix:obj};vendorPrefixes[name]=_.extend({},prefixObj,obj);}function getSyntaxPreference(name,syntax){if(syntax){var val=prefs.get(syntax+'.'+name);if(!_.isUndefined(val))return val;}return prefs.get('css.'+name);}function formatProperty(property,syntax){var ix=property.indexOf(':');property=property.substring(0,ix).replace(/\s+$/,'')+getSyntaxPreference('valueSeparator',syntax)+require('utils').trim(property.substring(ix+1));return property.replace(/\s*;\s*$/,getSyntaxPreference('propertyEnd',syntax));}function transformSnippet(snippet,isImportant,syntax){if(!_.isString(snippet))snippet=snippet.data;if(!isSingleProperty(snippet))return snippet;if(isImportant){if(~snippet.indexOf(';')){snippet=snippet.split(';').join(' !important;');}else{snippet+=' !important';}}return formatProperty(snippet,syntax);}function parseList(list){var result=_.map((list||'').split(','),require('utils').trim);return result.length?result:null;}function getProperties(key){var list=
-prefs.getArray(key);_.each(prefs.getArray(key+'Addon'),function(prop){if(prop.charAt(0)=='-'){list=_.without(list,prop.substr(1));}else{if(prop.charAt(0)=='+')prop=prop.substr(1);list.push(prop);}});return list;}addPrefix('w',{prefix:'webkit'});addPrefix('m',{prefix:'moz'});addPrefix('s',{prefix:'ms'});addPrefix('o',{prefix:'o'});var cssSyntaxes=['css','less','sass','scss','stylus'];require('resources').addResolver(function(node,syntax){if(_.include(cssSyntaxes,syntax)&&node.isElement()){return module.expandToSnippet(node.abbreviation,syntax);}return null;});var ea=require('expandAbbreviation');ea.addHandler(function(editor,syntax,profile){if(!_.include(cssSyntaxes,syntax)){return false;}var caretPos=editor.getSelectionRange().end;var abbr=ea.findAbbreviation(editor);if(abbr){var content=emmet.expandAbbreviation(abbr,syntax,profile);if(content){var replaceFrom=caretPos-abbr.length;var replaceTo=caretPos;if(editor.getContent().charAt(caretPos)==';'&&content.charAt(content.length-1)==';'
-){replaceTo++;}editor.replaceContent(content,replaceFrom,replaceTo);return true;}}return false;});return module={addPrefix:addPrefix,supportsPrefix:hasPrefix,prefixed:function(property,prefix){return hasPrefix(property,prefix)?'-'+prefix+'-'+property:property;},listPrefixes:function(){return _.map(vendorPrefixes,function(obj){return obj.prefix;});},getPrefix:function(name){return vendorPrefixes[name];},removePrefix:function(name){if(name in vendorPrefixes)delete vendorPrefixes[name];},extractPrefixes:function(abbr){if(abbr.charAt(0)!='-'){return{property:abbr,prefixes:null};}var i=1,il=abbr.length,ch;var prefixes=[];while(ibackground-color property with gradient first color '+'as fallback for old browsers.');function normalizeSpace(str){return require('utils').trim(str).replace(/\s+/g,' ');}function parseLinearGradient(gradient){var direction=defaultLinearDirections[0];var stream=require('stringStream').create(require('utils').trim(gradient));var colorStops=[],ch;while(ch=stream.next()){if(stream.peek()==','){colorStops.push(stream.current());stream.next();stream.eatSpace();stream.start=stream.pos;}else if(ch=='('){stream.skipTo(')');}}colorStops.push(stream.current());colorStops=_.compact(_.map(colorStops,normalizeSpace));if(!colorStops.length)return null;if(reDeg.test(colorStops[0])||reKeyword.test(colorStops[0])){direction=colorStops.shift();}return{type:'linear',direction:direction,colorStops:_.map(colorStops,parseColorStop)};}function parseColorStop(colorStop){colorStop=normalizeSpace(colorStop);var color=null;colorStop=colorStop.replace(/^(\w+\(.+?\))\s*/,function(str,c){color=c;
-return'';});if(!color){var parts=colorStop.split(' ');color=parts[0];colorStop=parts[1]||'';}var result={color:color};if(colorStop){colorStop.replace(/^(\-?[\d\.]+)([a-z%]+)?$/,function(str,pos,unit){result.position=pos;if(~pos.indexOf('.')){unit='';}else if(!unit){unit='%';}if(unit)result.unit=unit;});}return result;}function resolvePropertyName(name,syntax){var res=require('resources');var prefs=require('preferences');var snippet=res.findSnippet(syntax,name);if(!snippet&&prefs.get('css.fuzzySearch')){snippet=res.fuzzyFindSnippet(syntax,name,parseFloat(prefs.get('css.fuzzySearchMinScore')));}if(snippet){if(!_.isString(snippet)){snippet=snippet.data;}return require('cssResolver').splitSnippet(snippet).name;}}function fillImpliedPositions(colorStops){var from=0;_.each(colorStops,function(cs,i){if(!i)return cs.position=cs.position||0;if(i==colorStops.length-1&&!('position'in cs))cs.position=1;if('position'in cs){var start=colorStops[from].position||0;var step=(cs.position-start)/(i-from)
-;_.each(colorStops.slice(from,i),function(cs2,j){cs2.position=start+step*j;});from=i;}});}function textualDirection(direction){var angle=parseFloat(direction);if(!_.isNaN(angle)){switch(angle%360){case 0:return'left';case 90:return'bottom';case 180:return'right';case 240:return'top';}}return direction;}function oldWebkitDirection(direction){direction=textualDirection(direction);if(reDeg.test(direction))throw"The direction is an angle that can’t be converted.";var v=function(pos){return~direction.indexOf(pos)?'100%':'0';};return v('right')+' '+v('bottom')+', '+v('left')+' '+v('top');}function getPrefixedNames(name){var prefixes=prefs.getArray('css.gradient.prefixes');var names=prefixes?_.map(prefixes,function(p){return'-'+p+'-'+name;}):[];names.push(name);return names;}function getPropertiesForGradient(gradient,propertyName){var props=[];var css=require('cssResolver');if(prefs.get('css.gradient.fallback')&&~propertyName.toLowerCase().indexOf('background')){props.push({name:
-'background-color',value:'${1:'+gradient.colorStops[0].color+'}'});}_.each(prefs.getArray('css.gradient.prefixes'),function(prefix){var name=css.prefixed(propertyName,prefix);if(prefix=='webkit'&&prefs.get('css.gradient.oldWebkit')){try{props.push({name:name,value:module.oldWebkitLinearGradient(gradient)});}catch(e){}}props.push({name:name,value:module.toString(gradient,prefix)});});return props.sort(function(a,b){return b.name.length-a.name.length;});}function pasteGradient(property,gradient,valueRange){var rule=property.parent;var utils=require('utils');var alignVendor=require('preferences').get('css.alignVendor');var sep=property.styleSeparator;var before=property.styleBefore;_.each(rule.getAll(getPrefixedNames(property.name())),function(item){if(item!=property&&/gradient/i.test(item.value())){if(item.styleSeparator.length<%= attr("class", ".") %> -->','A definition of comment that should be placed after matched '+'element when comment filter is applied. This definition '+'is an ERB-style template passed to _.template() '+'function (see Underscore.js docs for details). In template context, '+'the following properties and functions are availabe:\n'+'
'+'
attr(name, before, after) – a function that outputs'+'specified attribute value concatenated with before '+'and after strings. If attribute doesn\'t exists, the '+
-'empty string will be returned.
'+'
node – current node (instance of AbbreviationNode)
'+'
name – name of current tag
'+'
padding – current string padding, can be used '+'for formatting
'+'
');prefs.define('filter.commentBefore','','A definition of comment that should be placed before matched '+'element when comment filter is applied. '+'For more info, read description of filter.commentAfter '+'property');prefs.define('filter.commentTrigger','id, class','A comma-separated list of attribute names that should exist in abbreviatoin '+'where comment should be added. If you wish to add comment for '+'every element, set this option to *');function addComments(node,templateBefore,templateAfter){var utils=require('utils');var trigger=prefs.get('filter.commentTrigger');if(trigger!='*'){var shouldAdd=_.find(trigger.split(','),function(name){return!!node.attribute(
-utils.trim(name));});if(!shouldAdd)return;}var ctx={node:node,name:node.name(),padding:node.parent?node.parent.padding:'',attr:function(name,before,after){var attr=node.attribute(name);if(attr){return(before||'')+attr+(after||'');}return'';}};var nodeBefore=utils.normalizeNewline(templateBefore?templateBefore(ctx):'');var nodeAfter=utils.normalizeNewline(templateAfter?templateAfter(ctx):'');node.start=node.start.replace(/,nodeBefore+'<');node.end=node.end.replace(/>/,'>'+nodeAfter);}function process(tree,before,after){var abbrUtils=require('abbreviationUtils');_.each(tree.children,function(item){if(abbrUtils.isBlock(item))addComments(item,before,after);process(item,before,after);});return tree;}require('filters').add('c',function(tree){var templateBefore=_.template(prefs.get('filter.commentBefore'));var templateAfter=_.template(prefs.get('filter.commentAfter'));return process(tree,templateBefore,templateAfter);});});emmet.exec(function(require,_){var charMap={'<':'<','>':'>',
-'&':'&'};function escapeChars(str){return str.replace(/([<>&])/g,function(str,p1){return charMap[p1];});}require('filters').add('e',function process(tree){_.each(tree.children,function(item){item.start=escapeChars(item.start);item.end=escapeChars(item.end);item.content=escapeChars(item.content);process(item);});return tree;});});emmet.exec(function(require,_){var placeholder='%s';var prefs=require('preferences');prefs.define('format.noIndentTags','html','A comma-separated list of tag names that should not get inner indentation.');prefs.define('format.forceIndentationForTags','body','A comma-separated list of tag names that should always get inner indentation.');function getIndentation(node){if(_.include(prefs.getArray('format.noIndentTags')||[],node.name())){return'';}return require('resources').getVariable('indentation');}function hasBlockSibling(item){return item.parent&&require('abbreviationUtils').hasBlockChildren(item.parent);}function isVeryFirstChild(item){return item
-.parent&&!item.parent.parent&&!item.index();}function shouldAddLineBreak(node,profile){var abbrUtils=require('abbreviationUtils');if(profile.tag_nl===true||abbrUtils.isBlock(node))return true;if(!node.parent||!profile.inline_break)return false;return shouldFormatInline(node.parent,profile);}function shouldBreakChild(node,profile){return node.children.length&&shouldAddLineBreak(node.children[0],profile);}function shouldFormatInline(node,profile){var nodeCount=0;var abbrUtils=require('abbreviationUtils');return!!_.find(node.children,function(child){if(child.isTextNode()||!abbrUtils.isInline(child))nodeCount=0;else if(abbrUtils.isInline(child))nodeCount++;if(nodeCount>=profile.inline_break)return true;});}function isRoot(item){return!item.parent;}function processSnippet(item,profile,level){item.start=item.end='';if(!isVeryFirstChild(item)&&profile.tag_nl!==false&&shouldAddLineBreak(item,profile)){if(isRoot(item.parent)||!require('abbreviationUtils').isInline(item.parent)){item.start=
-require('utils').getNewline()+item.start;}}return item;}function shouldBreakInsideInline(node,profile){var abbrUtils=require('abbreviationUtils');var hasBlockElems=_.any(node.children,function(child){if(abbrUtils.isSnippet(child))return false;return!abbrUtils.isInline(child);});if(!hasBlockElems){return shouldFormatInline(node,profile);}return true;}function processTag(item,profile,level){item.start=item.end=placeholder;var utils=require('utils');var abbrUtils=require('abbreviationUtils');var isUnary=abbrUtils.isUnary(item);var nl=utils.getNewline();var indent=getIndentation(item);if(profile.tag_nl!==false){var forceNl=profile.tag_nl===true&&(profile.tag_nl_leaf||item.children.length);if(!forceNl){forceNl=_.include(prefs.getArray('format.forceIndentationForTags')||[],item.name());}if(!item.isTextNode()){if(shouldAddLineBreak(item,profile)){if(!isVeryFirstChild(item)&&(!abbrUtils.isSnippet(item.parent)||item.index()))item.start=nl+item.start;if(abbrUtils.hasBlockChildren(item)||
-shouldBreakChild(item,profile)||(forceNl&&!isUnary))item.end=nl+item.end;if(abbrUtils.hasTagsInContent(item)||(forceNl&&!item.children.length&&!isUnary))item.start+=nl+indent;}else if(abbrUtils.isInline(item)&&hasBlockSibling(item)&&!isVeryFirstChild(item)){item.start=nl+item.start;}else if(abbrUtils.isInline(item)&&shouldBreakInsideInline(item,profile)){item.end=nl+item.end;}item.padding=indent;}}return item;}require('filters').add('_format',function process(tree,profile,level){level=level||0;var abbrUtils=require('abbreviationUtils');_.each(tree.children,function(item){if(abbrUtils.isSnippet(item))processSnippet(item,profile,level);else processTag(item,profile,level);process(item,profile,level+1);});return tree;});});emmet.exec(function(require,_){var childToken='${child}';function transformClassName(className){return require('utils').trim(className).replace(/\s+/g,'.');}function makeAttributesString(tag,profile){var attrs='';var otherAttrs=[];var attrQuote=profile.attributeQuote();
-var cursor=profile.cursor();_.each(tag.attributeList(),function(a){var attrName=profile.attributeName(a.name);switch(attrName.toLowerCase()){case'id':attrs+='#'+(a.value||cursor);break;case'class':attrs+='.'+transformClassName(a.value||cursor);break;default:otherAttrs.push(':'+attrName+' => '+attrQuote+(a.value||cursor)+attrQuote);}});if(otherAttrs.length)attrs+='{'+otherAttrs.join(', ')+'}';return attrs;}function hasBlockSibling(item){return item.parent&&item.parent.hasBlockChildren();}function processTag(item,profile,level){if(!item.parent)return item;var abbrUtils=require('abbreviationUtils');var utils=require('utils');var attrs=makeAttributesString(item,profile);var cursor=profile.cursor();var isUnary=abbrUtils.isUnary(item);var selfClosing=profile.self_closing_tag&&isUnary?'/':'';var start='';var tagName='%'+profile.tagName(item.name());if(tagName.toLowerCase()=='%div'&&attrs&&attrs.indexOf('{')==-1)tagName='';item.end='';start=tagName+attrs+selfClosing+' ';var placeholder='%s';
-item.start=utils.replaceSubstring(item.start,start,item.start.indexOf(placeholder),placeholder);if(!item.children.length&&!isUnary)item.start+=cursor;return item;}require('filters').add('haml',function process(tree,profile,level){level=level||0;var abbrUtils=require('abbreviationUtils');if(!level){tree=require('filters').apply(tree,'_format',profile);}_.each(tree.children,function(item){if(!abbrUtils.isSnippet(item))processTag(item,profile,level);process(item,profile,level+1);});return tree;});});emmet.exec(function(require,_){function makeAttributesString(node,profile){var attrQuote=profile.attributeQuote();var cursor=profile.cursor();return _.map(node.attributeList(),function(a){var attrName=profile.attributeName(a.name);return' '+attrName+'='+attrQuote+(a.value||cursor)+attrQuote;}).join('');}function processTag(item,profile,level){if(!item.parent)return item;var abbrUtils=require('abbreviationUtils');var utils=require('utils');var attrs=makeAttributesString(item,profile);var cursor
-=profile.cursor();var isUnary=abbrUtils.isUnary(item);var start='';var end='';if(!item.isTextNode()){var tagName=profile.tagName(item.name());if(isUnary){start='<'+tagName+attrs+profile.selfClosing()+'>';item.end='';}else{start='<'+tagName+attrs+'>';end=''+tagName+'>';}}var placeholder='%s';item.start=utils.replaceSubstring(item.start,start,item.start.indexOf(placeholder),placeholder);item.end=utils.replaceSubstring(item.end,end,item.end.indexOf(placeholder),placeholder);if(!item.children.length&&!isUnary&&!~item.content.indexOf(cursor)&&!require('tabStops').extract(item.content).tabstops.length){item.start+=cursor;}return item;}require('filters').add('html',function process(tree,profile,level){level=level||0;var abbrUtils=require('abbreviationUtils');if(!level){tree=require('filters').apply(tree,'_format',profile);}_.each(tree.children,function(item){if(!abbrUtils.isSnippet(item))processTag(item,profile,level);process(item,profile,level+1);});return tree;});});emmet.exec(function(
-require,_){var rePad=/^\s+/;var reNl=/[\n\r]/g;require('filters').add('s',function process(tree,profile,level){var abbrUtils=require('abbreviationUtils');_.each(tree.children,function(item){if(!abbrUtils.isSnippet(item)){item.start=item.start.replace(rePad,'');item.end=item.end.replace(rePad,'');}item.start=item.start.replace(reNl,'');item.end=item.end.replace(reNl,'');item.content=item.content.replace(reNl,'');process(item);});return tree;});});emmet.exec(function(require,_){require('preferences').define('filter.trimRegexp','[\\s|\\u00a0]*[\\d|#|\\-|\*|\\u2022]+\\.?\\s*','Regular expression used to remove list markers (numbers, dashes, '+'bullets, etc.) in t (trim) filter. The trim filter '+'is useful for wrapping with abbreviation lists, pased from other '+'documents (for example, Word documents).');function process(tree,re){_.each(tree.children,function(item){if(item.content)item.content=item.content.replace(re,'');process(item,re);});return tree;}require('filters').add
-('t',function(tree){var re=new RegExp(require('preferences').get('filter.trimRegexp'));return process(tree,re);});});emmet.exec(function(require,_){var tags={'xsl:variable':1,'xsl:with-param':1};function trimAttribute(node){node.start=node.start.replace(/\s+select\s*=\s*(['"]).*?\1/,'');}require('filters').add('xsl',function process(tree){var abbrUtils=require('abbreviationUtils');_.each(tree.children,function(item){if(!abbrUtils.isSnippet(item)&&(item.name()||'').toLowerCase()in tags&&item.children.length)trimAttribute(item);process(item);});return tree;});});emmet.define('lorem',function(require,_){var langs={en:{common:['lorem','ipsum','dolor','sit','amet','consectetur','adipisicing','elit'],words:['exercitationem','perferendis','perspiciatis','laborum','eveniet','sunt','iure','nam','nobis','eum','cum','officiis','excepturi','odio','consectetur','quasi','aut','quisquam','vel','eligendi','itaque','non','odit','tempore','quaerat','dignissimos','facilis','neque','nihil','expedita',
-'vitae','vero','ipsum','nisi','animi','cumque','pariatur','velit','modi','natus','iusto','eaque','sequi','illo','sed','ex','et','voluptatibus','tempora','veritatis','ratione','assumenda','incidunt','nostrum','placeat','aliquid','fuga','provident','praesentium','rem','necessitatibus','suscipit','adipisci','quidem','possimus','voluptas','debitis','sint','accusantium','unde','sapiente','voluptate','qui','aspernatur','laudantium','soluta','amet','quo','aliquam','saepe','culpa','libero','ipsa','dicta','reiciendis','nesciunt','doloribus','autem','impedit','minima','maiores','repudiandae','ipsam','obcaecati','ullam','enim','totam','delectus','ducimus','quis','voluptates','dolores','molestiae','harum','dolorem','quia','voluptatem','molestias','magni','distinctio','omnis','illum','dolorum','voluptatum','ea','quas','quam','corporis','quae','blanditiis','atque','deserunt','laboriosam','earum','consequuntur','hic','cupiditate','quibusdam','accusamus','ut','rerum','error','minus','eius','ab','ad',
-'nemo','fugit','officia','at','in','id','quos','reprehenderit','numquam','iste','fugiat','sit','inventore','beatae','repellendus','magnam','recusandae','quod','explicabo','doloremque','aperiam','consequatur','asperiores','commodi','optio','dolor','labore','temporibus','repellat','veniam','architecto','est','esse','mollitia','nulla','a','similique','eos','alias','dolore','tenetur','deleniti','porro','facere','maxime','corrupti']},ru:{common:['далеко-далеко','за','словесными','горами','в стране','гласных','и согласных','живут','рыбные','тексты'],words:['вдали','от всех','они','буквенных','домах','на берегу','семантика','большого','языкового','океана','маленький','ручеек','даль','журчит','по всей','обеспечивает','ее','всеми','необходимыми','правилами','эта',
-'парадигматическая','страна','которой','жаренные','предложения','залетают','прямо','рот','даже','всемогущая','пунктуация','не','имеет','власти','над','рыбными','текстами','ведущими','безорфографичный','образ','жизни','однажды','одна','маленькая','строчка','рыбного','текста','имени','lorem','ipsum','решила','выйти','большой','мир','грамматики','великий','оксмокс','предупреждал','о','злых','запятых','диких','знаках','вопроса','коварных','точках','запятой','но','текст','дал','сбить','себя','толку','он','собрал','семь','своих','заглавных','букв','подпоясал','инициал','за','пояс','пустился','дорогу',
-'взобравшись','первую','вершину','курсивных','гор','бросил','последний','взгляд','назад','силуэт','своего','родного','города','буквоград','заголовок','деревни','алфавит','подзаголовок','своего','переулка','грустный','реторический','вопрос','скатился','его','щеке','продолжил','свой','путь','дороге','встретил','рукопись','она','предупредила','моей','все','переписывается','несколько','раз','единственное','что','меня','осталось','это','приставка','возвращайся','ты','лучше','свою','безопасную','страну','послушавшись','рукописи','наш','продолжил','свой','путь','вскоре','ему',
-'повстречался','коварный','составитель','рекламных','текстов','напоивший','языком','речью','заманивший','свое','агенство','которое','использовало','снова','снова','своих','проектах','если','переписали','то','живет','там','до','сих','пор']}};var prefs=require('preferences');prefs.define('lorem.defaultLang','en');require('abbreviationParser').addPreprocessor(function(tree,options){var re=/^(?:lorem|lipsum)([a-z]{2})?(\d*)$/i,match;tree.findAll(function(node){if(node._name&&(match=node._name.match(re))){var wordCound=match[2]||30;var lang=match[1]||prefs.get('lorem.defaultLang')||'en';node._name='';node.data('forceNameResolving',node.isRepeating()||node.attributeList().length);node.data('pasteOverwrites',true);node.data('paste',function(i,content){return paragraph(lang,wordCound,!i);});}});});function randint(from,to){return Math
-.round(Math.random()*(to-from)+from);}function sample(arr,count){var len=arr.length;var iterations=Math.min(len,count);var result=[];while(result.length3&&len<=6){totalCommas=randint(0,1);}else if(len>6&&len<=12){totalCommas=randint(0,2);}else{totalCommas=randint(1,4);}_.each(_.range(totalCommas),function(ix){if(ix5)words[4]+=',';totalWords+=words.length;result.push(sentence(words,'.'));}while(totalWords","!!!4t":"","!!!4s":"","!!!xt":"","!!!xs":"","!!!xxs":
-"","c":"","cc:ie6":"","cc:ie":"","cc:noie":"\n\t${child}|\n"},"abbreviations":{"!":"html:5","a":"","a:link":"","a:mail":"","abbr":"","acronym":"","base":"","basefont":"","br":" ","frame":"","hr":"","bdo":"","bdo:r":"","bdo:l":"","col":"