From dacc8afbe9f70136d859264ea47dfa0511d1cc0b Mon Sep 17 00:00:00 2001 From: Christopher Hoult Date: Mon, 17 Mar 2014 14:37:56 +0000 Subject: [PATCH] Added new operators --- minified/csdleditor.config.js | 6 +- minified/csdleditor.min.js | 15009 +++++++++++++++++++++++++++++++- src/csdleditor.config.js | 6 +- 3 files changed, 14590 insertions(+), 431 deletions(-) diff --git a/minified/csdleditor.config.js b/minified/csdleditor.config.js index afc29d3..0eccaac 100644 --- a/minified/csdleditor.config.js +++ b/minified/csdleditor.config.js @@ -53,7 +53,9 @@ var CSDLEditorConfig = CSDLEditorConfig || { 'all', 'contains_all', 'wild', - 'wildcard' + 'wildcard', + 'list_in', + 'list_any' ], logical : [ @@ -479,4 +481,4 @@ var CSDLEditorConfig = CSDLEditorConfig || { "trends.content", "trends.source" ] -}; \ No newline at end of file +}; diff --git a/minified/csdleditor.min.js b/minified/csdleditor.min.js index ff8a55e..0236356 100644 --- a/minified/csdleditor.min.js +++ b/minified/csdleditor.min.js @@ -1,427 +1,14582 @@ -var CSDLEditor={}; -(function(n,l){n.Loader={compnts:[],loaded:[],isLoaded:!1,addComponent:function(l){"function"===typeof l&&n.Loader.compnts.push(l)},addLoaded:function(l){"function"===typeof l&&n.Loader.loaded.push(l)},load:function(){var u=l.jQuery;u(function(){u.each(n.Loader.compnts,function(){this.apply(l,[u,n])});u.each(n.Loader.loaded,function(){this.apply(l,[u,n])});n.Loader.isLoaded=!0})},timeout:function(u){setTimeout(function(){l.jQuery?(u&&l.jQuery.noConflict(),n.Loader.load()):n.Loader.timeout()},100)}}; -n.onLoad=function(u){if("function"!==typeof u)return!1;n.Loader.isLoaded?u.apply(l,[l.jQuery]):n.Loader.addLoaded(u)}})(CSDLEditor,window);window.CodeMirror=function(){function n(a,b){if(!(this instanceof n))return new n(a,b);this.options=b=b||{};for(var h in ec)!b.hasOwnProperty(h)&&ec.hasOwnProperty(h)&&(b[h]=ec[h]);p(b);h="string"==typeof b.value?0:b.value.first;var j={},r=j.input=C("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");V?r.style.width="1000px":r.setAttribute("wrap","off");db&&(r.style.border="1px solid black");r.setAttribute("autocorrect","off");r.setAttribute("autocapitalize", -"off");r.setAttribute("spellcheck","false");j.inputDiv=C("div",[r],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");j.scrollbarH=C("div",[C("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");j.scrollbarV=C("div",[C("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");j.scrollbarFiller=C("div",null,"CodeMirror-scrollbar-filler");j.gutterFiller=C("div",null,"CodeMirror-gutter-filler");j.lineDiv=C("div",null,"CodeMirror-code");j.selectionDiv=C("div",null,null,"position: relative; z-index: 1"); -j.cursor=C("div","\u00a0","CodeMirror-cursor");j.otherCursor=C("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor");j.measure=C("div",null,"CodeMirror-measure");j.lineSpace=C("div",[j.measure,j.selectionDiv,j.lineDiv,j.cursor,j.otherCursor],null,"position: relative; outline: none");j.mover=C("div",[C("div",[j.lineSpace],"CodeMirror-lines")],null,"position: relative");j.sizer=C("div",[j.mover],"CodeMirror-sizer");j.heightForcer=C("div",null,null,"position: absolute; height: "+Na+"px; width: 1px;"); -j.gutters=C("div",null,"CodeMirror-gutters");j.lineGutter=null;j.scroller=C("div",[j.sizer,j.heightForcer,j.gutters],"CodeMirror-scroll");j.scroller.setAttribute("tabIndex","-1");j.wrapper=C("div",[j.inputDiv,j.scrollbarH,j.scrollbarV,j.scrollbarFiller,j.gutterFiller,j.scroller],"CodeMirror");Oa&&(j.gutters.style.zIndex=-1,j.scroller.style.paddingRight=0);a.appendChild?a.appendChild(j.wrapper):a(j.wrapper);db&&(r.style.width="0px");V||(j.scroller.draggable=!0);fc?(j.inputDiv.style.height="1px",j.inputDiv.style.position= -"absolute"):Oa&&(j.scrollbarH.style.minWidth=j.scrollbarV.style.minWidth="18px");j.viewOffset=j.lastSizeC=0;j.showingFrom=j.showingTo=h;j.lineNumWidth=j.lineNumInnerWidth=j.lineNumChars=null;j.prevInput="";j.alignWidgets=!1;j.pollingFast=!1;j.poll=new gc;j.cachedCharWidth=j.cachedTextHeight=null;j.measureLineCache=[];j.measureLineCachePos=0;j.inaccurateSelection=!1;j.maxLine=null;j.maxLineLength=0;j.maxLineChanged=!1;j.wheelDX=j.wheelDY=j.wheelStartX=j.wheelStartY=null;h=this.display=j;h.wrapper.CodeMirror= -this;d(this);b.autofocus&&!hc&&ga(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new gc};f(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");j=b.value;"string"==typeof j&&(j=new $(b.value,b.mode));J(this,Qc)(this,j);Q&&setTimeout(ia(ra,this,!0),20);var w=this,j=function(){w.state.focused&&setTimeout(ia(ga,w),0)},c=function(){null==t&&(t=setTimeout(function(){t=null;e.cachedCharWidth=e.cachedTextHeight= -eb=null;W(w);ic(w,ia(S,w))},100))},g=function(){for(var a=e.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);a?setTimeout(g,5E3):sa(window,"resize",c)},r=function(a){ma(w,a)||w.options.onDragEvent&&w.options.onDragEvent(w,fb(a))||gb(a)},k=function(){e.inaccurateSelection&&(e.prevInput="",e.inaccurateSelection=!1,e.input.value=w.getSelection(),Sc(e.input))},e=w.display;K(e.scroller,"mousedown",J(w,Ud));Q?K(e.scroller,"dblclick",J(w,function(a){if(!ma(w,a)){var b=hb(w,a);b&&(!jc(w,a,"gutterClick", -!0,aa)&&!Ca(w.display,a))&&(T(a),a=kc(E(w.doc,b.line).text,b),Y(w.doc,a.from,a.to))}})):K(e.scroller,"dblclick",function(a){ma(w,a)||T(a)});K(e.lineSpace,"selectstart",function(a){Ca(e,a)||T(a)});lc||K(e.scroller,"contextmenu",function(a){Tc(w,a)});K(e.scroller,"scroll",function(){e.scroller.clientHeight&&(ib(w,e.scroller.scrollTop),Qa(w,e.scroller.scrollLeft,!0),X(w,"scroll",w))});K(e.scrollbarV,"scroll",function(){e.scroller.clientHeight&&ib(w,e.scrollbarV.scrollTop)});K(e.scrollbarH,"scroll",function(){e.scroller.clientHeight&& -Qa(w,e.scrollbarH.scrollLeft)});K(e.scroller,"mousewheel",function(a){Uc(w,a)});K(e.scroller,"DOMMouseScroll",function(a){Uc(w,a)});K(e.scrollbarH,"mousedown",j);K(e.scrollbarV,"mousedown",j);K(e.wrapper,"scroll",function(){e.wrapper.scrollTop=e.wrapper.scrollLeft=0});var t;K(window,"resize",c);setTimeout(g,5E3);K(e.input,"keyup",J(w,function(a){if(!(ma(w,a)||w.options.onKeyEvent&&w.options.onKeyEvent(w,fb(a)))&&16==a.keyCode)w.doc.sel.shift=!1}));K(e.input,"input",function(){Q&&(!da&&w.display.inputHasSelection)&& -(w.display.inputHasSelection=null);jb(w)});K(e.input,"keydown",J(w,Vc));K(e.input,"keypress",J(w,Vd));K(e.input,"focus",ia(Da,w));K(e.input,"blur",ia(mc,w));w.options.dragDrop&&(K(e.scroller,"dragstart",function(a){if(Q&&(!w.state.draggingText||100>+new Date-Wc))gb(a);else if(!ma(w,a)&&!Ca(w.display,a)){var b=w.getSelection();a.dataTransfer.setData("Text",b);a.dataTransfer.setDragImage&&!nc&&(b=C("img",null,null,"position: fixed; left: 0; top: 0;"),b.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", -ja&&(b.width=b.height=1,w.display.wrapper.appendChild(b),b._top=b.offsetTop),a.dataTransfer.setDragImage(b,0,0),ja&&b.parentNode.removeChild(b))}}),K(e.scroller,"dragenter",r),K(e.scroller,"dragover",r),K(e.scroller,"drop",J(w,Wd)));K(e.scroller,"paste",function(a){Ca(e,a)||(ga(w),jb(w))});K(e.input,"paste",function(){if(V&&!w.state.fakedLastChar&&!(200>new Date-w.state.lastMiddleDown)){var a=e.input.selectionStart,b=e.input.selectionEnd;e.input.value+="$";e.input.selectionStart=a;e.input.selectionEnd= -b;w.state.fakedLastChar=!0}w.state.pasteIncoming=!0;jb(w)});K(e.input,"cut",k);K(e.input,"copy",k);fc&&K(e.sizer,"mouseup",function(){document.activeElement==e.input&&e.input.blur();ga(w)});var q;try{q=document.activeElement==h.input}catch(s){}q||b.autofocus&&!hc?setTimeout(ia(Da,this),20):mc(this);J(this,function(){for(var a in Ra)if(Ra.propertyIsEnumerable(a))Ra[a](this,b[a],Xc);for(a=0;ab.maxLineLength&&(b.maxLineLength=r,b.maxLine=a)})}function p(a){var b=na(a.gutters, -"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1b.scroller.clientWidth+1,r=h>b.scroller.clientHeight+ -1;r?(b.scrollbarV.style.display="block",b.scrollbarV.style.bottom=j?lb(b.measure)+"px":"0",b.scrollbarV.firstChild.style.height=h-b.scroller.clientHeight+b.scrollbarV.clientHeight+"px"):(b.scrollbarV.style.display="",b.scrollbarV.firstChild.style.height="0");j?(b.scrollbarH.style.display="block",b.scrollbarH.style.right=r?lb(b.measure)+"px":"0",b.scrollbarH.firstChild.style.width=b.scroller.scrollWidth-b.scroller.clientWidth+b.scrollbarH.clientWidth+"px"):(b.scrollbarH.style.display="",b.scrollbarH.firstChild.style.width= -"0");j&&r?(b.scrollbarFiller.style.display="block",b.scrollbarFiller.style.height=b.scrollbarFiller.style.width=lb(b.measure)+"px"):b.scrollbarFiller.style.display="";j&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(b.gutterFiller.style.display="block",b.gutterFiller.style.height=lb(b.measure)+"px",b.gutterFiller.style.width=b.gutters.offsetWidth+"px"):b.gutterFiller.style.display="";Xd&&0===lb(b.measure)&&(b.scrollbarV.style.minWidth=b.scrollbarH.style.minHeight=Yd?"18px":"12px",b.scrollbarV.style.pointerEvents= -b.scrollbarH.style.pointerEvents="none")}function D(a,b,h){var j=a.scroller.scrollTop,r=a.wrapper.clientHeight;"number"==typeof h?j=h:h&&(j=h.top,r=h.bottom-h.top);j=Math.floor(j-a.lineSpace.offsetTop);a=Math.ceil(j+r);return{from:mb(b,j),to:mb(b,a)}}function q(a){var b=a.display;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var h=y(b)-b.scroller.scrollLeft+a.doc.scrollLeft,j=b.gutters.offsetWidth,r=h+"px",w=b.lineDiv.firstChild;w;w=w.nextSibling)if(w.alignable)for(var c=0,g= -w.alignable;c=a.display.showingFrom&&d.to<=a.display.showingTo)break}c&&(aa(a,"update",a),(a.display.showingFrom!=r||a.display.showingTo!=w)&&aa(a,"viewportChange",a,a.display.showingFrom,a.display.showingTo));return c}function g(a,b,h,j){var r=a.display,w=a.doc;if(r.wrapper.clientWidth){if(j||!(0==b.length&&h.from>r.showingFrom&&h.toc-r.showingFrom&&(c=Math.max(w.first,r.showingFrom));r.showingTo>h&&20>r.showingTo-h&&(h=Math.min(e,r.showingTo));if(nb)for(c=ha(ua(w,E(w,c)));h=e[0].to)e=[];else for(var d=0,k=b.length||0;d=l.to?q.push(l):(f.from>l.from&&q.push({from:l.from,to:f.from}),f.tob.from)b.to=k;else{e.splice(d--,1);break}for(d=w=0;dh&&(b.to=h),b.from>=b.to?e.splice(d--,1):w+=b.to-b.from;if(!j&&w==h-c&&c==r.showingFrom&&h==r.showingTo)t(a);else{e.sort(function(a,b){return a.from-b.from});try{var u=document.activeElement}catch(n){}w<0.7*(h-c)&&(r.lineDiv.style.display="none");j=c;var w=h,v=e,x=g,D=function(b){var h=b.nextSibling;V&&Ta&&a.display.currentWheelTarget==b?(b.style.display="none",b.lineObj=null):b.parentNode.removeChild(b);return h},G,g=a.display;b={};e={};d=g.gutters.firstChild;for(k=0;d;d=d.nextSibling,++k)b[a.options.gutters[k]]= -d.offsetLeft,e[a.options.gutters[k]]=d.offsetWidth;G={fixedPos:y(g),gutterTotalWidth:g.gutters.offsetWidth,gutterLeft:b,gutterWidth:e,wrapperWidth:g.wrapper.clientWidth};var g=a.display,I=a.options.lineNumbers;!v.length&&(!V||!a.display.currentWheelTarget)&&kb(g.lineDiv);var O=g.lineDiv,z=O.firstChild,ba=v.shift(),M=j;for(a.doc.iter(j,w,function(b){ba&&ba.to==M&&(ba=v.shift());if(Ea(a.doc,b)){if(0!=b.height&&ka(b,0),b.widgets&&z&&z.previousSibling)for(var h=0;hM){for(;z.lineObj!=b;)z=D(z);I&&(x<=M&&z.lineNumber)&&Zc(z.lineNumber,String(a.options.lineNumberFormatter(M+a.options.firstLineNumber)));z=z.nextSibling}else{if(b.widgets)for(var c=0,w=z;w&& -20>c;++c,w=w.nextSibling)if(w.lineObj==b&&/div/i.test(w.nodeName)){h=w;break}var d=M,w=h,g=pc(a,b),c=g.pre,e=b.gutterMarkers,k=a.display,f=g.bgClass?g.bgClass+" "+(b.bgClass||""):b.bgClass;if(!a.options.lineNumbers&&!e&&!f&&!b.wrapClass&&!b.widgets)j=c;else{if(w){w.alignable=null;for(var Pa=!0,t=0,q=null,s=w.firstChild,p;s;s=p)if(p=s.nextSibling,/\bCodeMirror-linewidget\b/.test(s.className)){for(g=0;gc&&(c=va(r)),0.0010w))if(ka(j.lineObj,c),c=j.lineObj.widgets)for(w=0;wb&&(b=0);d.appendChild(C("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==h?e-a:h)+"px; height: "+(j-b)+"px"))},j=function(b,h,j){var r=E(g,b),d=r.text.length,f,t;var q=oa(r),s=h||0,p=null==j?d:j,m=function(g,Pa,s){var q=ea(a,B(b,g),"div",r,"left"),p,m;g==Pa?(p=q,s=m=q.left):(p=ea(a,B(b,Pa-1),"div",r,"right"),"rtl"==s&&(s=q,q=p,p=s),s=q.left, -m=p.right);null==h&&0==g&&(s=k);3t.bottom||p.bottom==t.bottom&&p.right>t.right)t=p;ss||s==p&&F.to==s)m(Math.max(F.from,s),Math.min(F.to,p),1==F.level?"rtl":"ltr"),Rc=!0}Rc||m(s,p,"ltr")}else m(s,p,"ltr");return{start:f, -end:t}},h=a.display,g=a.doc,r=a.doc.sel,d=document.createDocumentFragment(),e=h.lineSpace.offsetWidth,k=pa(a.display.measure,C("pre",null,null,"text-align: left")).appendChild(C("span","x")).offsetLeft;if(r.from.line==r.to.line)j(r.from.line,r.from.ch,r.to.ch);else{var f=E(g,r.from.line),t=E(g,r.to.line),t=ua(g,f)==ua(g,t),f=j(r.from.line,r.from.ch,t?f.text.length:null).end,j=j(r.to.line,t?0:null,r.to.ch).start;t&&(f.top=a.display.showingTo)){var h=+new Date+a.options.workTime,j=Ua(b.mode,I(a,b.frontier)),r=[],c;b.iter(b.frontier, -Math.min(b.first+b.size,a.display.showingTo+500),function(g){if(b.frontier>=a.display.showingFrom){var d=g.styles;g.styles=$c(a,g,j);for(var e=!d||d.length!=g.styles.length,k=0;!e&&kh)return A(a,a.options.workDelay),!0});r.length&&J(a,function(){for(var a=0;ak;--f){if(f<=e.first){c=e.first;break a}var t=E(e,f-1);if(t.stateAfter&&(!h||f<=e.frontier)){c=f;break a}t=Va(t.text,null,a.options.tabSize);if(null==d||g>t)d=f-1,g=t}c=d}var q=c>j.first&&E(j,c-1).stateAfter,q=q?Ua(j.mode,q):bd(j.mode);j.iter(c,b,function(h){ad(a,h,q);h.stateAfter=c==b-1||0==c%5||c>=r.showingFrom&&cc&&0==a&&(c=1)}r=a>h?"left":ah?g.left:g.right,top:g.top,bottom:g.bottom}}function ba(a,b){for(var h=a.display.measureLineCache,j=0;jm&&(h=m);0>b&&(b=0);for(var j=p.length-2;0<=j;j-=2){var r=p[j],c=p[j+1];if(!(r>h||c=h||b<=r&&h>=c||Math.min(h,c)-Math.max(b,r)>=h-b>>1){p[j]=Math.min(b,r);p[j+1]=Math.max(h,c);break}}0>j&&(j=p.length,p.push(b,h));return{left:a.left-s.left,right:a.right-s.left,top:j,bottom:null}}function j(a){a.bottom=p[a.top+1];a.top=p[a.top]}if(!a.options.lineWrapping&&b.text.length>=a.options.crudeMeasuringFrom){var r=new Ga(b.text.slice(0,100),null);b.textClass&&(r.textClass=b.textClass);var c= -pb(a,r),g=O(a,r,0,c,"left"),r=O(a,r,99,c,"right");return{crude:!0,top:g.top,left:g.left,bottom:g.bottom,width:(r.right-g.left)/100}}var c=a.display,g=cd(b.text.length),d=pc(a,b,g,!0).pre;if(Q&&!Oa&&!a.options.lineWrapping&&100q&&k;++q)t.appendChild(d.firstChild),--k;e.appendChild(t)}d.appendChild(e)}pa(c.measure,d);var s= -R(c.lineDiv),p=[],e=cd(b.text.length),m=d.offsetHeight;da&&c.measure.first!=d&&pa(c.measure,d);for(r=0;rh.from?c(a-1):c(a,j)}j=j||E(a.doc,b.line);r||(r=Fa(a,j));var d=oa(j);b=b.ch;if(!d)return c(b);var e=rc(d,b),e=g(b,e);null!=Wa&&(e.other=g(b,Wa));return e}function fa(a,b,h,j){a=new B(a,b);a.xRel=j;h&&(a.outside=!0);return a}function Ha(a,b,h){var j=a.doc;h+=a.display.viewOffset;if(0>h)return fa(j.first,0,!0,-1);var r=mb(j,h),c=j.first+j.size-1;if(r>c)return fa(j.first+j.size-1,E(j,c).text.length,!0, -1);for(0>b&&(b=0);;){var c=E(j,r),r=qb(a,c,r,b,h),g=(c=Hb(c))&&c.find();if(c&&(r.ch>g.from.ch||r.ch==g.from.ch&&0j.bottom)return j.left-e;if(gm)return fa(h,q,l,1);for(;;){if(f?q==r||q==sc(b,r,1):1>=q-r){f=jj?-1:j?1:0)}var F=Math.ceil(t/2),y=r+F;if(f)for(var y=r,u=0;uj){q=y;m=u;if(l=d)m+=1E3;t=F}else r=y,s=u,p=d,t-=F}}function va(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Ia){Ia=C("pre");for(var b=0;49>b;++b)Ia.appendChild(document.createTextNode("x")),Ia.appendChild(C("br"));Ia.appendChild(document.createTextNode("x"))}pa(a.measure,Ia);b=Ia.offsetHeight/50;3=a.options.crudeMeasuringFrom?r=O(a,r,r.text.length,w&&w.measure,"right").right:(r=pc(a,r,null,!0).pre,w=r.appendChild(rb(a.display.measure)),pa(a.display.measure,r),r=R(w).right-R(a.display.lineDiv).left);j.sizer.style.minWidth=Math.max(0,r+3+Na)+"px";j.maxLineChanged=!1;r=Math.max(0, -j.sizer.offsetLeft+j.sizer.offsetWidth-j.scroller.clientWidth);rh.top+e.top)k=!0;else if(h.bottom+e.top>(window.innerHeight||document.documentElement.clientHeight))k=!1;if(null!=k&&!$d){if(e="none"==j.cursor.style.display)j.cursor.style.display= -"",j.cursor.style.left=h.left+"px",j.cursor.style.top=h.top-j.viewOffset+"px";j.cursor.scrollIntoView(k);e&&(j.cursor.style.display="none")}}b.selectionChanged&&z(a);a.state.focused&&b.updateInput&&ra(a,b.userSelChange);h=b.maybeHiddenMarkers;j=b.maybeUnhiddenMarkers;if(h)for(k=0;kl.bottom?20:0;e&&setTimeout(J(j,function(){F==h&&(r.scroller.scrollTop+=e,b(a))}),50)}else{j.state.focused||Da(j);q=g;if(!N(m,g))if(m=g,"single"== -k)Y(j.doc,H(c,d),g);else if(s=H(c,s),p=H(c,p),"double"==k){var f=kc(E(c,g.line).text,g);P(g,s)?Y(j.doc,f.from,p):Y(j.doc,s,f.to)}else"triple"==k&&(P(g,s)?Y(j.doc,p,H(c,B(g.line,0))):Y(j.doc,s,H(c,B(g.line+1,0))));f=D(r,c);(g.line>=f.to||g.linee-400&&N(Pb.pos,d)){k="triple";T(a);setTimeout(ia(ga,j),20);var e=j,f=d.line;Y(e.doc,B(f,0),H(e.doc,B(f+1,0)))}else Qb&&Qb.time>e-400&&N(Qb.pos,d)?(k="double",Pb={time:e,pos:d},T(a),e=kc(E(c,d.line).text,d),Y(j.doc,e.from,e.to)): -Qb={time:e,pos:d};var q=d;if(j.options.dragDrop&&vc&&!tb(j)&&!N(g.from,g.to)&&!P(d,g.from)&&!P(g.to,d)&&"single"==k){var t=J(j,function(b){V&&(r.scroller.draggable=!1);j.state.draggingText=!1;sa(document,"mouseup",t);sa(r.scroller,"drop",t);10>Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)&&(T(b),Y(j.doc,d),ga(j))});V&&(r.scroller.draggable=!0);j.state.draggingText=t;r.scroller.dragDrop&&r.scroller.dragDrop();K(document,"mouseup",t);K(r.scroller,"drop",t)}else{T(a);"single"==k&&Y(j.doc, -H(c,d));var s=g.from,p=g.to,m=d,l=R(r.wrapper),F=0,y=J(j,function(a){!Q&&!ed(a)?h(a):b(a)}),u=J(j,h);K(document,"mousemove",y);K(document,"mouseup",u)}}else(a.target||a.srcElement)==r.scroller&&T(a)}}}function jc(a,b,h,j,c){try{var g=b.clientX,d=b.clientY}catch(e){return!1}if(g>=Math.floor(R(a.display.gutters).right))return!1;j&&T(b);j=a.display;var k=R(j.lineDiv);if(d>k.bottom||!qa(a,h))return wc(b);d-=k.top-j.viewOffset;for(k=0;k=g)return g=mb(a.doc,d),c(a,h,a,g,a.options.gutters[k],b),wc(b)}}function Wd(a){var b=this;if(!ma(b,a)&&!(Ca(b.display,a)||b.options.onDragEvent&&b.options.onDragEvent(b,fb(a)))){T(a);Q&&(Wc=+new Date);var h=hb(b,a,!0),j=a.dataTransfer.files;if(h&&!tb(b))if(j&&j.length&&window.FileReader&&window.File){var c=j.length,g=Array(c),d=0;a=function(a,j){var e=new FileReader;e.onload=function(){g[j]=e.result;++d==c&&(h=H(b.doc,h),Za(b.doc,{from:h,to:h,text:Ja(g.join("\n")),origin:"paste"},"around"))}; -e.readAsText(a)};for(var e=0;eMath.abs(a.doc.scrollTop-b)||(a.doc.scrollTop=b,$a||c(a,[],b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop= -b),a.display.scrollbarV.scrollTop!=b&&(a.display.scrollbarV.scrollTop=b),$a&&c(a,[]),A(a,100))}function Qa(a,b,h){if(!(h?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b)))b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,q(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b)}function Uc(a,b){var h=b.wheelDeltaX,j=b.wheelDeltaY;null==h&&(b.detail&&b.axis==b.HORIZONTAL_AXIS)&& -(h=b.detail);null==j&&b.detail&&b.axis==b.VERTICAL_AXIS?j=b.detail:null==j&&(j=b.wheelDelta);var r=a.display,g=r.scroller;if(h&&g.scrollWidth>g.clientWidth||j&&g.scrollHeight>g.clientHeight){if(j&&Ta&&V)for(var d=b.target;d!=g;d=d.parentNode)if(d.lineObj){a.display.currentWheelTarget=d;break}if(h&&!$a&&!ja&&null!=la)j&&ib(a,Math.max(0,Math.min(g.scrollTop+j*la,g.scrollHeight-g.clientHeight))),Qa(a,Math.max(0,Math.min(g.scrollLeft+h*la,g.scrollWidth-g.clientWidth))),T(b),r.wheelStartX=null;else{if(j&& -null!=la){var d=j*la,e=a.doc.scrollTop,k=e+r.wrapper.clientHeight;0>d?e=Math.max(0,e+d-50):k=Math.min(a.doc.height,k+d+50);c(a,[],{top:e,bottom:k})}20>Rb&&(null==r.wheelStartX?(r.wheelStartX=g.scrollLeft,r.wheelStartY=g.scrollTop,r.wheelDX=h,r.wheelDY=j,setTimeout(function(){if(null!=r.wheelStartX){var a=g.scrollLeft-r.wheelStartX,b=g.scrollTop-r.wheelStartY,a=b&&r.wheelDY&&b/r.wheelDY||a&&r.wheelDX&&a/r.wheelDX;r.wheelStartX=r.wheelStartY=null;a&&(la=(la*Rb+a)/(Rb+1),++Rb)}},200)):(r.wheelDX+=h, -r.wheelDY+=j))}}}function Sb(a,b,h){if("string"==typeof b&&(b=xc[b],!b))return!1;a.display.pollingFast&&uc(a)&&(a.display.pollingFast=!1);var j=a.doc,c=j.sel.shift,g=!1;try{tb(a)&&(a.state.suppressEdits=!0),h&&(j.sel.shift=!1),g=b(a)!=fd}finally{j.sel.shift=c,a.state.suppressEdits=!1}return g}function gd(a){var b=a.state.keyMaps.slice(0);a.options.extraKeys&&b.push(a.options.extraKeys);b.push(a.options.keyMap);return b}function hd(a,b){var h=yc(a.options.keyMap),j=h.auto;clearTimeout(id);j&&!jd(b)&& -(id=setTimeout(function(){yc(a.options.keyMap)==h&&(a.options.keyMap=j.call?j.call(null,a):j,v(a))},50));var c=kd(b,!0),g=!1;if(!c)return!1;g=gd(a);if(g=b.shiftKey?ub("Shift-"+c,g,function(b){return Sb(a,b,!0)})||ub(c,g,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return Sb(a,b)}):ub(c,g,function(b){return Sb(a,b)}))T(b),z(a),da&&(b.oldKeyCode=b.keyCode,b.keyCode=0),aa(a,"keyHandled",a,c,b);return g}function Vc(a){this.state.focused||Da(this);if(!(ma(this,a)||this.options.onKeyEvent&& -this.options.onKeyEvent(this,fb(a)))){Q&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.doc.sel.shift=16==b||a.shiftKey;var h=hd(this,a);ja&&(zc=h?b:null,!h&&(88==b&&!Ob&&(Ta?a.metaKey:a.ctrlKey))&&this.replaceSelection(""))}}function Vd(a){var b=this;if(!(ma(b,a)||b.options.onKeyEvent&&b.options.onKeyEvent(b,fb(a)))){var h=a.keyCode,j=a.charCode;if(ja&&h==zc)zc=null,T(a);else if(!(ja&&(!a.which||10>a.which)||fc)||!hd(b,a)){h=String.fromCharCode(null==j?h:j);this.options.electricChars&&(this.doc.mode.electricChars&& -this.options.smartIndent&&!tb(this)&&-1b++?Ac=setTimeout(j,500):ra(a)};Ac=setTimeout(j,200)}}if(!ma(a,b,"contextmenu")){var c=a.display,g=a.doc.sel,d;if(!(d=Ca(c,b)))d=a,d=qa(d,"gutterContextMenu")?jc(d,b,"gutterContextMenu",!1,X):!1;if(!d){d=hb(a, -b);var e=c.scroller.scrollTop;if(d&&!ja){(N(g.from,g.to)||P(d,g.from)||!P(d,g.to))&&J(a,za)(a.doc,d,d);var k=c.input.style.cssText;c.inputDiv.style.position="absolute";c.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: white; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";ga(a);ra(a,!0);N(g.from,g.to)&&(c.input.value=c.prevInput= -" ");Q&&!da&&h();if(lc){gb(b);var f=function(){sa(window,"mouseup",f);setTimeout(j,20)};K(window,"mouseup",f)}else setTimeout(j,50)}}}}function ld(a,b,h){if(!P(b.from,h))return H(a,h);var j=b.text.length-1-(b.to.line-b.from.line);if(h.line>b.to.line+j)return b=h.line-j,j=a.first+a.size-1,b>j?B(j,E(a,j).text.length):Ub(h,E(a,b).text.length);if(h.line==b.to.line+j)return Ub(h,ca(b.text).length+(1==b.text.length?b.from.ch:0)+E(a,b.to.line).text.length-b.to.ch);a=h.line-b.from.line;return Ub(h,b.text[a].length+ -(a?0:b.from.ch))}function Bc(a,b,h){if(h&&"object"==typeof h)return{anchor:ld(a,b,h.anchor),head:ld(a,b,h.head)};if("start"==h)return{anchor:b.from,head:b.from};var j=Cc(b);if("around"==h)return{anchor:b.from,head:j};if("end"==h)return{anchor:j,head:j};h=function(a){if(P(a,b.from))return a;if(!P(b.to,a))return j;var h=a.line+b.text.length-(b.to.line-b.from.line)-1,c=a.ch;a.line==b.to.line&&(c+=j.ch-b.to.ch);return B(h,c)};return{anchor:h(a.sel.anchor),head:h(a.sel.head)}}function md(a,b,h){b={canceled:!1, -from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};h&&(b.update=function(b,h,c,g){b&&(this.from=H(a,b));h&&(this.to=H(a,h));c&&(this.text=c);void 0!==g&&(this.origin=g)});X(a,"beforeChange",a,b);a.cm&&X(a.cm,"beforeChange",a.cm,b);return b.canceled?null:{from:b.from,to:b.to,text:b.text,origin:b.origin}}function Za(a,b,h,j){if(a.cm){if(!a.cm.curOp)return J(a.cm,Za)(a,b,h,j);if(a.cm.state.suppressEdits)return}if(qa(a,"beforeChange")||a.cm&&qa(a.cm,"beforeChange"))if(b= -md(a,b,!0),!b)return;var c;if(c=nd){if(j=!j){j=b.from;c=b.to;var g=null;a.iter(j.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;ba.lastLine())){if(b.from.linec&&(b={from:b.from,to:B(c,E(a,c).text.length),text:[b.text[0]],origin:b.origin});b.removed=Gc(a,b.from,b.to);h||(h=Bc(a,b,null));if(a.cm){a=a.cm;var g=a.doc,d=a.display,c=b.from,e=b.to,f=!1,t=c.line;a.options.lineWrapping|| -(t=ha(ua(g,E(g,c.line))),g.iter(t,e.line+1,function(a){if(a==d.maxLine)return f=!0}));!P(g.sel.head,b.from)&&!P(b.to,g.sel.head)&&(a.curOp.cursorActivity=!0);Hc(g,b,j,h,u(a));a.options.lineWrapping||(g.iter(t,c.line+b.text.length,function(a){var b=k(g,a);b>d.maxLineLength&&(d.maxLine=a,d.maxLineLength=b,d.maxLineChanged=!0,f=!1)}),f&&(a.curOp.updateMaxLine=!0));g.frontier=Math.min(g.frontier,c.line);A(a,400);S(a,c.line,e.line+1,b.text.length-(e.line-c.line)-1);if(qa(a,"change"))if(j={from:c,to:e, -text:b.text,removed:b.removed,origin:b.origin},a.curOp.textChanged){for(a=a.curOp.textChanged;a.next;a=a.next);a.next=j}else a.curOp.textChanged=j}else Hc(a,b,j,h)}}function Aa(a,b,h,j,c){j||(j=h);if(P(j,h)){var g=j;j=h;h=g}"string"==typeof b&&(b=Ja(b));Za(a,{from:h,to:j,text:b,origin:c},null)}function B(a,b){if(!(this instanceof B))return new B(a,b);this.line=a;this.ch=b}function N(a,b){return a.line==b.line&&a.ch==b.ch}function P(a,b){return a.lineh?B(h,E(a,h).text.length):Ub(b,E(a,b.line).text.length)}function Ub(a,b){var h=a.ch;return null==h||h>b?B(a.line,b):0>h?B(a.line,0):a}function bb(a,b){return b>=a.first&&b=g.ch:f.to>g.ch))){if(j&&(X(t,"beforeCursorEnter"),t.explicitlyCleared))if(e.markedSpans){--k;continue}else break; -if(t.atomic){k=t.find()[0>d?"from":"to"];if(N(k,g)&&(k.ch+=d,0>k.ch?k=k.line>a.first?H(a,B(k.line-1)):null:k.ch>e.text.length&&(k=k.lineh&&(h=0);var e=g.scroller.clientHeight-Na,k=g.scroller.scrollTop,f={};a=a.doc.height+(g.mover.offsetHeight-g.lineSpace.offsetHeight);var t=ha-d;hk+e&&(h=Math.min(h,(d?a:c)-e),h!=k&&(f.scrollTop=h));k=g.scroller.clientWidth-Na;h=g.scroller.scrollLeft;b+=g.gutters.offsetWidth;j+=g.gutters.offsetWidth;g=g.gutters.offsetWidth; -c=bk+h-3&&(f.scrollLeft=j+10-k);return f}function Wb(a,b,h){a.curOp.updateScrollPos={scrollLeft:null==b?a.doc.scrollLeft:b,scrollTop:null==h?a.doc.scrollTop:h}}function Ic(a,b,h){var j=a.curOp.updateScrollPos||(a.curOp.updateScrollPos={scrollLeft:a.doc.scrollLeft,scrollTop:a.doc.scrollTop});a=a.display.scroller;j.scrollTop=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,j.scrollTop+h));j.scrollLeft=Math.max(0,Math.min(a.scrollWidth-a.clientWidth, -j.scrollLeft+b))}function Tb(a,b,h,j){var c=a.doc;null==h&&(h="add");if("smart"==h)if(a.doc.mode.indent)var g=I(a,b);else h="prev";var d=a.options.tabSize,e=E(c,b),k=Va(e.text,null,d),f=e.text.match(/^\s*/)[0],t;if("smart"==h&&(t=a.doc.mode.indent(g,e.text.slice(f.length),e.text),t==fd)){if(!j)return;h="prev"}"prev"==h?t=b>c.first?Va(E(c,b-1).text,null,d):0:"add"==h?t=k+a.options.indentUnit:"subtract"==h?t=k-a.options.indentUnit:"number"==typeof h&&(t=k+h);t=Math.max(0,t);h="";j=0;if(a.options.indentWithTabs)for(c= -Math.floor(t/d);c;--c)j+=d,h+="\t";j=a.first+a.size?b=f=!1:(d=b,b=k=E(a,b));if(b)e=c?(0>h?Kb:Jb)(k):0>h?k.text.length:0;else return f=!1}else e= -j;return!0}var d=b.line,e=b.ch;b=h;var k=E(a,d),f=!0;if("char"==j)g();else if("column"==j)g(!0);else if("word"==j||"group"==j){var t=null;j="group"==j;for(var q=!0;!(0>h)||g(!q);q=!1){var s=k.text.charAt(e)||"\n",s=wb(s)?"w":!j?null:/\s/.test(s)?null:"p";if(t&&t!=s){0>h&&(h=1,g());break}s&&(t=s);if(0h?1.5:0.5)*va(a.display))):"line"==j&&(d=0h?0>=d:d>=c.height){e.hitSide=!0;break}d+=5*h}return e}function kc(a,b){var h=b.ch,j=b.ch;if(a){(0>b.xRel||j==a.length)&&h?--h:++j;for(var c=a.charAt(h),c=wb(c)?wb:/\s/.test(c)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!wb(a)};0=c:f.to>c);(k||(k=[])).push({from:f.from,to:q?null:f.to,marker:t})}}h=k;if(j)for(var e=0,s;e=g:k.to>g)||"bookmark"==f.type&&k.from==g&&(!d||k.marker.insertLeft))t=null==k.from||(f.inclusiveLeft?k.from<=g:k.fromb)&&(!j||j.widtha.options.maxHighlightLength?(g=!1,k.pos=b.length,f=null):f=h.token(k,j);if(!g||e!=f)da&&j.splice(g,1,a,j[g+1],e);g+=2;d=Math.min(a,e)}if(b)if(c.opaque)j.splice(h,g-h,a,b),g=h+2;else for(;hq)){if(null!=I.to&&F>I.to&&(F=I.to,u=""),z.className&&(y+=" "+z.className),z.startStyle&&I.from==q&&(v+=" "+z.startStyle),z.endStyle&&I.to==F&&(u+=" "+z.endStyle),z.title&&!n&&(n=z.title),z.collapsed&&(!x||x.marker.sizeq&&F>I.from&&(F=I.from);"bookmark"==z.type&&(I.from==q&&z.replacedWith)&&D.push(z)}if(x&&(x.from||0)==q)if(Gd(c,(null==x.to?s:x.to)-q,x.marker,null==x.from),null==x.to){c=x.marker.find();break a}if(!x&&D.length)for(G=0;G= -s)break;for(D=Math.min(s,F);;){if(m){G=q+m.length;x||(I=G>D?m.slice(0,D-q):m,c.addToken(c,I,l?l+y:y,v,q+I.length==F?u:"",n));if(G>=D){m=m.slice(D-q);q=D;break}q=G;v=""}m=f.slice(t,t=e[p++]);l=Dd(e[p++],c)}}else for(var p=1;pe&&dd-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))){var k=ca(e.changes);N(b.from,b.to)&&N(b.from,k.to)?k.to=Cc(b):e.changes.push(Fc(a,b));e.anchorAfter=h.anchor;e.headAfter=h.head}else{e={changes:[Fc(a,b)],generation:g.generation,anchorBefore:a.sel.anchor,headBefore:a.sel.head,anchorAfter:h.anchor,headAfter:h.head}; -g.done.push(e);for(g.generation=++g.maxGeneration;g.done.length>g.undoDepth;)g.done.shift()}g.lastTime=d;g.lastOp=c;g.lastOrigin=b.origin}function be(a){if(!a)return null;for(var b=0,h;b=b.offsetWidth&&2b)return Wa=null,h;if(g.from==b||g.to==b)if(null==c)c=h;else{var g=g.level,d=a[c].level,e=a[0].level,g=g==e?!0:d==e?!1:ge.from&&bb||b>a.text.length?null:b}var $a=/gecko\/\d/i.test(navigator.userAgent),Q=/MSIE \d/.test(navigator.userAgent),Oa=Q&&(null==document.documentMode||8>document.documentMode), -da=Q&&(null==document.documentMode||9>document.documentMode),V=/WebKit\//.test(navigator.userAgent),ie=V&&/Qt\/\d+\.\d+/.test(navigator.userAgent),je=/Chrome\//.test(navigator.userAgent),ja=/Opera\//.test(navigator.userAgent),nc=/Apple Computer/.test(navigator.vendor),fc=/KHTML\//.test(navigator.userAgent),Xd=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),Yd=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),$d=/PhantomJS/.test(navigator.userAgent),db=/AppleWebKit/.test(navigator.userAgent)&& -/Mobile\/\w+/.test(navigator.userAgent),hc=db||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Ta=db||/Mac/.test(navigator.platform),ke=/win/i.test(navigator.platform),Ma=ja&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Ma&&(Ma=Number(Ma[1]));Ma&&15<=Ma&&(ja=!1,V=!0);var xd=Ta&&(ie||ja&&(null==Ma||12.11>Ma)),lc=$a||Q&&!da,nd=!1,nb=!1,Ia,Zd=0,Qb,Pb,Wc=0,Rb=0,la=null;Q?la=-0.53:$a?la=15:je?la=-0.7:nc&&(la=-1/3);var id,zc=null,Ac,Cc=n.changeEnd=function(a){return!a.text? -a.to:B(a.from.line+a.text.length-1,ca(a.text).length+(1==a.text.length?a.from.ch:0))};n.Pos=B;n.prototype={constructor:n,focus:function(){window.focus();ga(this);Da(this);jb(this)},setOption:function(a,b){var h=this.options,c=h[a];h[a]==b&&"mode"!=a||(h[a]=b,Ra.hasOwnProperty(a)&&J(this,Ra[a])(this,b,c))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps, -h=0;h>1;if((g?b[2*g-1]:0)>=a)c=g;else if(b[2*g+1]c&&(a=c,h=!0);c=E(this.doc,a);return wa(this,E(this.doc,a),{top:0,left:0},b||"page").top+(h?c.height:0)},defaultTextHeight:function(){return va(this.display)},defaultCharWidth:function(){return Yc(this.display)},setGutterMarker:J(null,function(a,b,h){return Xb(this,a,function(a){var c= -a.gutterMarkers||(a.gutterMarkers={});c[b]=h;!h&&Md(c)&&(a.gutterMarkers=null);return!0})}),clearGutter:J(null,function(a){var b=this,h=b.doc,c=h.first;h.iter(function(h){h.gutterMarkers&&h.gutterMarkers[a]&&(h.gutterMarkers[a]=null,S(b,c,c+1),Md(h.gutterMarkers)&&(h.gutterMarkers=null));++c})}),addLineClass:J(null,function(a,b,h){return Xb(this,a,function(a){var c="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[c]){if(RegExp("(?:^|\\s)"+h+"(?:$|\\s)").test(a[c]))return!1;a[c]+=" "+ -h}else a[c]=h;return!0})}),removeLineClass:J(null,function(a,b,h){return Xb(this,a,function(a){var c="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",g=a[c];if(g)if(null==h)a[c]=null;else{var d=g.match(RegExp("(?:^|\\s+)"+h+"(?:$|\\s+)"));if(!d)return!1;var e=d.index+d[0].length;a[c]=g.slice(0,d.index)+(!d.index||e==g.length?"":" ")+g.slice(e)||null}else return!1;return!0})}),addLineWidget:J(null,function(a,b,h){var c=this,g=new dc(c,b,h);g.noHScroll&&(c.display.alignWidgets=!0);Xb(c,a, -function(a){var b=a.widgets||(a.widgets=[]);null==g.insertAt?b.push(g):b.splice(Math.min(b.length-1,Math.max(0,g.insertAt)),0,g);g.line=a;if(!Ea(c.doc,a)||g.showIfHidden)b=ob(c,a)f)&&a.top>b.offsetHeight?e=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=f&&(e=a.bottom);k+b.offsetWidth>t&&(k=t-b.offsetWidth)}b.style.top=e+"px";b.style.left=b.style.right="";"right"==g?(k=d.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==g?k=0:"middle"==g&&(k=(d.sizer.clientWidth-b.offsetWidth)/2),b.style.left=k+"px");h&&(a=Mb(this,k,e,k+b.offsetWidth,e+b.offsetHeight),null!=a.scrollTop&&ib(this,a.scrollTop),null!=a.scrollLeft&&Qa(this,a.scrollLeft))},triggerOnKeyDown:J(null, -Vc),execCommand:function(a){return xc[a](this)},findPosH:function(a,b,h,c){var g=1;0>b&&(g=-1,b=-b);var d=0;for(a=H(this.doc,a);da?h.from:h.to;Y(this.doc,h,h,a)}),deleteH:J(null,function(a,b){var h=this.doc.sel;N(h.from,h.to)?Aa(this.doc,"",h.from,Jc(this.doc,h.head,a,b,!1),"+delete"):Aa(this.doc,"",h.from,h.to, -"+delete");this.curOp.userSelChange=!0}),findPosV:function(a,b,h,c){var g=1;0>b&&(g=-1,b=-b);var d=0;for(a=H(this.doc,a);d=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.posb},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1a.display.maxLineLength&&(a.display.maxLine=e,a.display.maxLineLength=f,a.display.maxLineChanged=!0);null!=c&&a&&S(a,c,g+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&td(a));b&&Ya(a)}};Ba.prototype.find=function(){for(var a,b,c= -0;c=b.display.showingFrom&&a.linethis.size-b&&(c=[],this.collapse(c),this.children=[new Zb(c)],this.children[0].parent= -this)},collapse:function(a){for(var b=0,c=this.children.length;b= -this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new Cb(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=na(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new Cb(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10=a.ch))b.push(d.marker.parent|| -d.marker)}return b},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;ca)return b=a,!0;a-=g;++c});return H(this,B(c,b))},indexFromPos:function(a){a=H(this,a);var b=a.ch;if(a.linea.ch)return 0;this.iter(this.first,a.line,function(a){b+=a.text.length+1});return b},copy:function(a){var b=new $(Mc(this, -this.first,this.first+this.size),this.modeOption,this.first);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn};a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.tona(me,Gb)&&(n.prototype[Gb]=function(a){return function(){return a.apply(this.doc,arguments)}}($.prototype[Gb]));cb($);n.e_stop=gb;n.e_preventDefault=T;n.e_stopPropagation=Kd;var ya,Lb=0;n.on= -K;n.off=sa;n.signal=X;var Na=30,fd=n.Pass={toString:function(){return"CodeMirror.Pass"}};gc.prototype={set:function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)}};n.countColumn=Va;var cc=[""],ge=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,tc=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff]/; -n.replaceGetRect=function(a){R=a};var vc;if(da)vc=!1;else{var Pd=C("div");vc="draggable"in Pd||"dragDrop"in Pd}$a?Bb=function(a,b){return 36==a.charCodeAt(b-1)&&39==a.charCodeAt(b)}:nc&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?Bb=function(a,b){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(a.slice(b-1,b+1))}:V&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)?Bb=function(a,b){var c=a.charCodeAt(b-1);return 8208<=c&&8212>=c}:V&&(Bb=function(a,b){if(1,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(a.slice(b-1,b+1))});var eb,Nc,Ja=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],g=a.length;b<=g;){var d=a.indexOf("\n",b);-1==d&&(d=a.length);var e=a.slice(b,"\r"==a.charAt(d-1)?d-1:d),k=e.indexOf("\r");-1!=k?(c.push(e.slice(0, -k)),b+=k+1):(c.push(e),b=d+1)}return c}:function(a){return a.split(/\r\n?|\n/)};n.splitLines=Ja;var ae=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return!b||b.parentElement()!=a?!1:0!=b.compareEndPoints("StartToEnd",b)},Ob;var Pc=C("div");"oncopy"in Pc?Ob=!0:(Pc.setAttribute("oncopy","return;"),Ob="function"==typeof Pc.oncopy);var La={3:"Enter",8:"Backspace",9:"Tab",13:"Enter", -16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};n.keyNames=La; -for(var Z=0;10>Z;Z++)La[Z+48]=String(Z);for(Z=65;90>=Z;Z++)La[Z]=String.fromCharCode(Z);for(Z=1;12>=Z;Z++)La[Z+111]=La[Z+63235]="F"+Z;var Wa,Hd,pe=function(a){return 255>=a?ne.charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1791>=a?oe.charAt(a-1536):1792<=a&&2220>=a?"r":"L"},ne="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL", -oe="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",qe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,Qd=/[stwN]/,Rd=/[LRr]/,Sd=/[Lb1n]/,Td=/[1n]/;Hd=function(a){if(!qe.test(a))return!1;for(var b=a.length,c=[],g=0,d;gA.scrollTop+A.clientHeight&&(A.scrollTop=g.offsetTop+ -g.offsetHeight-A.clientHeight+3);CodeMirror.signal(f,"select",t[M],g)}}function l(){ea=setTimeout(y,100)}function D(){clearTimeout(ea)}function q(){var c=n.getScrollInfo(),g=n.getWrapperElement().getBoundingClientRect(),d=Fa+U.top-c.top,e=d;pb||(e+=A.offsetHeight);if(e<=g.top||e>=g.bottom)return y();A.style.top=d+"px";A.style.left=ba+U.left-c.left+"px"}function y(c){fa||(fa=!0,clearTimeout(Ha),A.parentNode.removeChild(A),n.removeKeyMap(xa),n.off("cursorActivity",g),n.off("blur",l),n.off("focus",D), -n.off("scroll",q),!0!==c&&CodeMirror.signal(f,"close"))}function c(){var c=n,g=f,d=t[M];d.hint?d.hint(c,g,d):c.replaceRange(v(d),g.from,g.to);y()}function g(){clearTimeout(Ha);var c=n.getCursor(),g=n.getLine(c.line);c.line!=qb.line||g.length-c.ch!=va-qb.ch||c.chW&&(A.style.width=W-5+"px",wa-=I.right-I.left-W),A.style.left=(ba=G.left-wa)+"px");0z&&(A.style.height=z-5+"px",O-=W-z),A.style.top=(Fa=G.bottom-O)+"px");var xa,G={Up:function(){p(M-1)},Down:function(){p(M+1)},PageUp:function(){p(M-(Math.floor(A.clientHeight/A.firstChild.offsetHeight)||1))},PageDown:function(){p(M+(Math.floor(A.clientHeight/A.firstChild.offsetHeight)||1))},Home:function(){p(0)},End:function(){p(t.length-1)},Enter:c,Tab:c,Esc:y};if(u.customKeys)for(F in xa={},u.customKeys)u.customKeys.hasOwnProperty(F)&&(z=u.customKeys[F],G.hasOwnProperty(z)&&(z=G[z]), -xa[F]=z);else xa=G;n.addKeyMap(xa);n.on("cursorActivity",g);var ea;n.on("blur",l);n.on("focus",D);var U=n.getScrollInfo();n.on("scroll",q);CodeMirror.on(A,"dblclick",function(g){g=g.target||g.srcElement;null!=g.hintId&&(M=g.hintId,c())});CodeMirror.on(A,"click",function(c){c=c.target||c.srcElement;null!=c.hintId&&p(c.hintId)});CodeMirror.on(A,"mousedown",function(){setTimeout(function(){n.focus()},20)});var fa=!1,Ha,qb=n.getCursor(),va=n.getLine(qb.line).length;CodeMirror.signal(f,"select",t[0],A.firstChild); -return!0}}u||(u={});var e=n.getCursor().ch,d=!1,k=u.closeCharacters||/[\s()\[\]{};:]/;return m()};(function(){function n(l){"activeLine"in l.state&&(l.removeLineClass(l.state.activeLine,"wrap",u),l.removeLineClass(l.state.activeLine,"background",m))}function l(l){var f=l.getLineHandle(l.getCursor().line);l.state.activeLine!=f&&(n(l),l.addLineClass(f,"wrap",u),l.addLineClass(f,"background",m),l.state.activeLine=f)}var u="CodeMirror-activeline",m="CodeMirror-activeline-background";CodeMirror.defineOption("styleActiveLine",!1,function(m,f,e){e=e&&e!=CodeMirror.Init;f&&!e?(l(m),m.on("cursorActivity", -l)):!f&&e&&(m.off("cursorActivity",l),n(m),delete m.state.activeLine)})})();(function(){function n(u){for(var m={name:"autoCloseBrackets",Backspace:function(e){if(e.somethingSelected())return CodeMirror.Pass;var d=e.getCursor(),k=e.getLine(d.line);if(d.ch&&d.chf.start&&/^\s*$/.test(l.slice(0,s)))d=l.slice(0,s)}if(null!=d)m.replaceSelection("\n"+d+e.blockCommentContinue,"end");else return CodeMirror.Pass}for(var l=["clike","css","javascript"],u=0;u=u(p,n.from))f(d);else{for(;0u(s,n.from)&&(n.to.line-s.lineu(p,q.to);)l.pop().clear(),q=l[l.length-1].find();0=p.line,t=g?p:d(y,0),c=k.markText(c,t,{className:q});null==m?l.push(c):l.splice(m++,0,c);if(g)break}}function v(d){d=d.state.markedSelection;for(var e=0;em)return null;var n=1E3>k.text.length;for(null!=p&&(l=p+c);l!=u;l+=c)if(p=k.text.charAt(l),F.test(p)&&(!n||d.getTokenAt(v(q,l+1)).type==g)){var x=f[p];if(">"==x.charAt(1)==y)t.push(p);else{if(t.pop()!=x.charAt(0))return{pos:l,match:!1};if(!t.length)return{pos:l,match:!0}}}}}var m=d.state._matchBrackets.maxScanLineLength||1E4,p=d.getCursor(),l=d.getLineHandle(p.line),u=p.ch-1,q=0<= -u&&f[l.text.charAt(u)]||f[l.text.charAt(++u)];if(!q)return null;for(var y=">"==q.charAt(1),c=y?1:-1,g=d.getTokenAt(v(p.line,u+1)).type,t=[l.text.charAt(u)],F=/[(){}[\]]/,q=p.line,n,z=y?Math.min(q+100,d.lineCount()):Math.max(-1,q-100);q!=z&&!(n=q==p.line?e(l,q,u):e(d.getLineHandle(q),q));q+=c);return{from:v(p.line,u),to:n&&v(q,n.pos),match:n&&n.match}}function l(d,e){var f=d.state._matchBrackets.maxHighlightLineLength||1E3,p=n(d);if(p&&!(d.getLine(p.from.line).length>f||p.to&&d.getLine(p.to.line).length> -f)){var f=p.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",l=d.markText(p.from,v(p.from.line,p.from.ch+1),{className:f}),u=p.to&&d.markText(p.to,v(p.to.line,p.to.ch+1),{className:f});m&&d.state.focused&&d.display.input.focus();p=function(){d.operation(function(){l.clear();u&&u.clear()})};if(e)setTimeout(p,800);else return p}}function u(d){d.operation(function(){e&&(e(),e=null);d.somethingSelected()||(e=l(d,!1))})}var m=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode|| -8>document.documentMode),v=CodeMirror.Pos,f={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},e=null;CodeMirror.defineOption("matchBrackets",!1,function(d,e,f){f&&f!=CodeMirror.Init&&d.off("cursorActivity",u);e&&(d.state._matchBrackets="object"==typeof e?e:{},d.on("cursorActivity",u))});CodeMirror.defineExtension("matchBrackets",function(){l(this,!0)});CodeMirror.defineExtension("findMatchingBracket",function(){return n(this)})})();(function(){function n(f){this.minChars="object"==typeof f&&f.minChars||m;this.style="object"==typeof f&&f.style||v;this.overlay=null}function l(f){f.operation(function(){var e=f.state.matchHighlighter;e.overlay&&(f.removeOverlay(e.overlay),e.overlay=null);if(f.somethingSelected()){var d=f.getSelection().replace(/^\s+|\s+$/g,"");d.length/g,">").replace(/"/g,""")}, -unescapeHtml:function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')}},number:{format:function(e,d,f,s){d=d===v?2:d;f=f||".";s=s||",";e=e.toString().replace(/[^0-9+\-Ee.]/g,"");e=!isFinite(+e)?0:+e;d=!isFinite(+d)?0:m.abs(d);var p="",p=function(d,e){var f=m.pow(10,e);return""+m.round(d*f)/f},p=(d?p(e,d):""+m.round(e)).split(".");3=m.end&&(D=!0)}m.state.rowNum++;m.state.colNum=1}function f(){if(void 0=== -m.onParseValue)s.push(x);else{var c=m.onParseValue(x,m.state);!1!==c&&s.push(c)}x="";p=0;m.state.colNum++}var e=m.separator,d=m.delimiter;m.state.rowNum||(m.state.rowNum=1);m.state.colNum||(m.state.colNum=1);var k=[],s=[],p=0,x="",D=!1,q=RegExp.escape(e),y=RegExp.escape(d),c=/(D|S|\n|\r|[^DS\r\n]+)/,c=c.source,c=c.replace(/S/g,q),c=c.replace(/D/g,y),c=RegExp(c,"gm");l.replace(c,function(c){if(!D)switch(p){case 0:if(c===e){x+="";f();break}if(c===d){p=1;break}if("\n"===c){f();n();break}if(/^\r$/.test(c))break; -x+=c;p=3;break;case 1:if(c===d){p=2;break}x+=c;p=1;break;case 2:if(c===d){x+=c;p=1;break}if(c===e){f();break}if("\n"===c){f();n();break}if(/^\r$/.test(c))break;throw Error("CSVDataError: Illegal State [Row:"+m.state.rowNum+"][Col:"+m.state.colNum+"]");case 3:if(c===e){f();break}if("\n"===c){f();n();break}if(/^\r$/.test(c))break;if(c===d)throw Error("CSVDataError: Illegal Quote [Row:"+m.state.rowNum+"][Col:"+m.state.colNum+"]");throw Error("CSVDataError: Illegal Data [Row:"+m.state.rowNum+"][Col:"+ -m.state.colNum+"]");default:throw Error("CSVDataError: Unknown State [Row:"+m.state.rowNum+"][Col:"+m.state.colNum+"]");}});0!==s.length&&(f(),n());return k},splitLines:function(l,m){function n(){k=0;if(m.start&&m.state.rowNum=m.end&&(p=!0)}m.state.rowNum++}var f=m.separator,e=m.delimiter;m.state.rowNum||(m.state.rowNum=1);var d=[],k=0,s="",p=!1,x=RegExp.escape(f), -D=RegExp.escape(e),q=/(D|S|\n|\r|[^DS\r\n]+)/,q=q.source,q=q.replace(/S/g,x),q=q.replace(/D/g,D),q=RegExp(q,"gm");l.replace(q,function(d){if(!p)switch(k){case 0:if(d===f){s+=d;k=0;break}if(d===e){s+=d;k=1;break}if("\n"===d){n();break}if(/^\r$/.test(d))break;s+=d;k=3;break;case 1:if(d===e){s+=d;k=2;break}s+=d;k=1;break;case 2:var c=s.substr(s.length-1);if(d===e&&c===e){s+=d;k=1;break}if(d===f){s+=d;k=0;break}if("\n"===d){n();break}if("\r"===d)break;throw Error("CSVDataError: Illegal state [Row:"+m.state.rowNum+ -"]");case 3:if(d===f){s+=d;k=0;break}if("\n"===d){n();break}if("\r"===d)break;if(d===e)throw Error("CSVDataError: Illegal quote [Row:"+m.state.rowNum+"]");throw Error("CSVDataError: Illegal state [Row:"+m.state.rowNum+"]");default:throw Error("CSVDataError: Unknown state [Row:"+m.state.rowNum+"]");}});""!==s&&n();return d},parseEntry:function(l,m){function n(){if(void 0===m.onParseValue)d.push(s);else{var e=m.onParseValue(s,m.state);!1!==e&&d.push(e)}s="";k=0;m.state.colNum++}var f=m.separator,e= -m.delimiter;m.state.rowNum||(m.state.rowNum=1);m.state.colNum||(m.state.colNum=1);var d=[],k=0,s="";if(!m.match){var p=RegExp.escape(f),x=RegExp.escape(e),D=/(D|S|\n|\r|[^DS\r\n]+)/.source,D=D.replace(/S/g,p),D=D.replace(/D/g,x);m.match=RegExp(D,"gm")}l.replace(m.match,function(d){switch(k){case 0:if(d===f){s+="";n();break}if(d===e){k=1;break}if("\n"===d||"\r"===d)break;s+=d;k=3;break;case 1:if(d===e){k=2;break}s+=d;k=1;break;case 2:if(d===e){s+=d;k=1;break}if(d===f){n();break}if("\n"===d||"\r"=== -d)break;throw Error("CSVDataError: Illegal State [Row:"+m.state.rowNum+"][Col:"+m.state.colNum+"]");case 3:if(d===f){n();break}if("\n"===d||"\r"===d)break;if(d===e)throw Error("CSVDataError: Illegal Quote [Row:"+m.state.rowNum+"][Col:"+m.state.colNum+"]");throw Error("CSVDataError: Illegal Data [Row:"+m.state.rowNum+"][Col:"+m.state.colNum+"]");default:throw Error("CSVDataError: Unknown State [Row:"+m.state.rowNum+"][Col:"+m.state.colNum+"]");}});n();return d}},toArray:function(n,m,v){m=void 0!== -m?m:{};var f={};f.callback=void 0!==v&&"function"===typeof v?v:!1;f.separator="separator"in m?m.separator:l.csv.defaults.separator;f.delimiter="delimiter"in m?m.delimiter:l.csv.defaults.delimiter;m={delimiter:f.delimiter,separator:f.separator,onParseEntry:m.onParseEntry,onParseValue:m.onParseValue,state:void 0!==m.state?m.state:{}};n=l.csv.parsers.parseEntry(n,m);if(f.callback)f.callback("",n);else return n},toArrays:function(n,m,v){m=void 0!==m?m:{};var f={};f.callback=void 0!==v&&"function"===typeof v? -v:!1;f.separator="separator"in m?m.separator:l.csv.defaults.separator;f.delimiter="delimiter"in m?m.delimiter:l.csv.defaults.delimiter;v=[];m={delimiter:f.delimiter,separator:f.separator,onParseEntry:m.onParseEntry,onParseValue:m.onParseValue,start:m.start,end:m.end,state:{rowNum:1,colNum:1}};v=l.csv.parsers.parse(n,m);if(f.callback)f.callback("",v);else return v},toObjects:function(n,m,v){m=void 0!==m?m:{};var f={};f.callback=void 0!==v&&"function"===typeof v?v:!1;f.separator="separator"in m?m.separator: -l.csv.defaults.separator;f.delimiter="delimiter"in m?m.delimiter:l.csv.defaults.delimiter;f.headers="headers"in m?m.headers:l.csv.defaults.headers;m.start="start"in m?m.start:1;f.headers&&m.start++;m.end&&f.headers&&m.end++;var e=[];v=[];m={delimiter:f.delimiter,separator:f.separator,onParseEntry:m.onParseEntry,onParseValue:m.onParseValue,start:m.start,end:m.end,state:{rowNum:1,colNum:1},match:!1};var e=l.csv.parsers.splitLines(n,{delimiter:f.delimiter,separator:f.separator,start:1,end:1,state:{rowNum:1, -colNum:1}}),d=l.csv.toArray(e[0],m),e=l.csv.parsers.splitLines(n,m);m.state.colNum=1;m.state.rowNum=d?2:1;n=0;for(var k=e.length;n").outerWidth(1).jquery||n.each(["Width","Height"],function(c,g){function d(c,g,f,k){n.each(e,function(){g-=parseFloat(n.css(c,"padding"+this))||0;f&&(g-=parseFloat(n.css(c,"border"+this+"Width"))||0);k&& -(g-=parseFloat(n.css(c,"margin"+this))||0)});return g}var e="Width"===g?["Left","Right"]:["Top","Bottom"],f=g.toLowerCase(),k={innerWidth:n.fn.innerWidth,innerHeight:n.fn.innerHeight,outerWidth:n.fn.outerWidth,outerHeight:n.fn.outerHeight};n.fn["inner"+g]=function(c){return void 0===c?k["inner"+g].call(this):this.each(function(){n(this).css(f,d(this,c)+"px")})};n.fn["outer"+g]=function(c,e){return"number"!==typeof c?k["outer"+g].call(this,c):this.each(function(){n(this).css(f,d(this,c,!0,e)+"px")})}}); -n.fn.addBack||(n.fn.addBack=function(c){return this.add(null==c?this.prevObject:this.prevObject.filter(c))});if(n("").data("a-b","a").removeData("a-b").data("a-b")){var d=n.fn.removeData;n.fn.removeData=function(c){return arguments.length?d.call(this,n.camelCase(c)):d.call(this)}}n.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());n.support.selectstart="onselectstart"in document.createElement("div");n.fn.extend({disableSelection:function(){return this.bind((n.support.selectstart?"selectstart": -"mousedown")+".ui-disableSelection",function(c){c.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});n.extend(n.ui,{plugin:{add:function(c,g,d){var e;c=n.ui[c].prototype;for(e in d)c.plugins[e]=c.plugins[e]||[],c.plugins[e].push([g,d[e]])},call:function(c,g,d){var e=c.plugins[g];if(e&&c.element[0].parentNode&&11!==c.element[0].parentNode.nodeType)for(g=0;g",options:{disabled:!1,create:null},_createWidget:function(c,g){g=k(g||this.defaultElement||this)[0];this.element=k(g);this.uuid=s++;this.eventNamespace= -"."+this.widgetName+this.uuid;this.options=k.widget.extend({},this.options,this._getCreateOptions(),c);this.bindings=k();this.hoverable=k();this.focusable=k();g!==this&&(k.data(g,this.widgetFullName,this),this._on(!0,this.element,{remove:function(c){c.target===g&&this.destroy()}}),this.document=k(g.style?g.ownerDocument:g.document||g),this.window=k(this.document[0].defaultView||this.document[0].parentWindow));this._create();this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:k.noop, -_getCreateEventData:k.noop,_create:k.noop,_init:k.noop,destroy:function(){this._destroy();this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(k.camelCase(this.widgetFullName));this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled");this.bindings.unbind(this.eventNamespace);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")}, -_destroy:k.noop,widget:function(){return this.element},option:function(c,g){var d=c,e,f,q;if(0===arguments.length)return k.widget.extend({},this.options);if("string"===typeof c)if(d={},e=c.split("."),c=e.shift(),e.length){f=d[c]=k.widget.extend({},this.options[c]);for(q=0;qdocument.documentMode)&&!c.button)return this._mouseUp(c); -if(this._mouseStarted)return this._mouseDrag(c),c.preventDefault();this._mouseDistanceMet(c)&&this._mouseDelayMet(c)&&((this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,c))?this._mouseDrag(c):this._mouseUp(c));return!this._mouseStarted},_mouseUp:function(c){l(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);this._mouseStarted&&(this._mouseStarted=!1,c.target===this._mouseDownEvent.target&&l.data(c.target,this.widgetName+ -".preventClickEvent",!0),this._mouseStop(c));return!1},_mouseDistanceMet:function(c){return Math.max(Math.abs(this._mouseDownEvent.pageX-c.pageX),Math.abs(this._mouseDownEvent.pageY-c.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}});var q=function(c){return/left|right/.test(c.css("float"))||/inline|table-cell/.test(c.css("display"))},y=document.createElement("div"); -"draggable"in y||"ondragstart"in y&&"ondrop"in y||l.widget("ui.sortable",l.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3,activate:null,beforeStop:null,change:null, -deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var c=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?"x"===c.axis||q(this.items[0].item):!1;this.offset=this.element.offset();this._mouseInit();this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled");this._mouseDestroy();for(var c=this.items.length-1;0<=c;c--)this.items[c].item.removeData(this.widgetName+ -"-item");return this},_setOption:function(c,g){"disabled"===c?(this.options[c]=g,this.widget().toggleClass("ui-sortable-disabled",!!g)):l.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(c,g){var d=null,e=!1,f=this;if(this.reverting||this.options.disabled||"static"===this.options.type)return!1;this._refreshItems(c);l(c.target).parents().each(function(){if(l.data(this,f.widgetName+"-item")===f)return d=l(this),!1});l.data(c.target,f.widgetName+"-item")===f&&(d=l(c.target)); -if(!d||this.options.handle&&!g&&(l(this.options.handle,d).find("*").addBack().each(function(){this===c.target&&(e=!0)}),!e))return!1;this.currentItem=d;this._removeCurrentsFromItems();return!0},_mouseStart:function(c,g,d){var e;g=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(c);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top, -left:this.offset.left-this.margins.left};l.extend(this.offset,{click:{left:c.pageX-this.offset.left,top:c.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");this.originalPosition=this._generatePosition(c);this.originalPageX=c.pageX;this.originalPageY=c.pageY;g.cursorAt&&this._adjustOffsetFromHelper(g.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]}; -this.helper[0]!==this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();g.containment&&this._setContainment();g.cursor&&"auto"!==g.cursor&&(e=this.document.find("body"),this.storedCursor=e.css("cursor"),e.css("cursor",g.cursor),this.storedStylesheet=l("").appendTo(e));g.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",g.opacity));g.zIndex&&(this.helper.css("zIndex")&& -(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",g.zIndex));this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset());this._trigger("start",c,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(d=this.containers.length-1;0<=d;d--)this.containers[d]._trigger("activate",c,this._uiHash(this));l.ui.ddmanager&&(l.ui.ddmanager.current=this);l.ui.ddmanager&&!g.dropBehaviour&&l.ui.ddmanager.prepareOffsets(this, -c);this.dragging=!0;this.helper.addClass("ui-sortable-helper");this._mouseDrag(c);return!0},_mouseDrag:function(c){var g,d,e,f;g=this.options;d=!1;this.position=this._generatePosition(c);this.positionAbs=this._convertPositionTo("absolute");this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-c.pageYq&&d+sl&&f+nc[this.floating?"width":"height"]?n:qc.left&&this.positionAbs.left+this.offset.click.leftc.top&&this.positionAbs.top+this.offset.click.topc.top+c.height/2&&this.positionAbs.top+this.offset.click.topc.left+c.width/2&&this.positionAbs.left+this.offset.click.left",c.document[0]).addClass(d||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");"tr"===e?c.currentItem.children().each(function(){l(" ",c.document[0]).attr("colspan",l(this).attr("colspan")||1).appendTo(f)}):"img"===e&&f.attr("src",c.currentItem.attr("src"));d||f.css("visibility","hidden");return f},update:function(f,k){if(!d||e.forcePlaceholderSize)k.height()||k.height(c.currentItem.innerHeight()- -parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),k.width()||k.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}};c.placeholder=l(e.placeholder.element.call(c.element,c.currentItem));c.currentItem.after(c.placeholder);e.placeholder.update(c,c.placeholder)},_contactContainers:function(c){var d,e,f,k,m,p,n,s,y,x=e=null;for(d=this.containers.length-1;0<=d;d--)if(!l.contains(this.currentItem[0], -this.containers[d].element[0]))if(this._intersectsWith(this.containers[d].containerCache)){if(!e||!l.contains(this.containers[d].element[0],e.element[0]))e=this.containers[d],x=d}else this.containers[d].containerCache.over&&(this.containers[d]._trigger("out",c,this._uiHash(this)),this.containers[d].containerCache.over=0);if(e)if(1===this.containers.length)this.containers[x].containerCache.over||(this.containers[x]._trigger("over",c,this._uiHash(this)),this.containers[x].containerCache.over=1);else{d= -1E4;f=null;k=(y=e.floating||q(this.currentItem))?"left":"top";m=y?"width":"height";p=this.positionAbs[k]+this.offset.click[k];for(e=this.items.length-1;0<=e;e--)if(l.contains(this.containers[x].element[0],this.items[e].item[0])&&this.items[e].item[0]!==this.currentItem[0]&&(!y||this.positionAbs.top+this.offset.click.top>this.items[e].top&&this.positionAbs.top+this.offset.click.topMath.abs(n+this.items[e][m]- -p)&&(s=!0,n+=this.items[e][m]),Math.abs(n-p)this.containment[2]&&(e=this.containment[2]+this.offset.click.left),c.pageY-this.offset.click.top>this.containment[3]&&(d=this.containment[3]+this.offset.click.top)),f.grid&&(d=this.originalPageY+Math.round((d- -this.originalPageY)/f.grid[1])*f.grid[1],d=this.containment?d-this.offset.click.top>=this.containment[1]&&d-this.offset.click.top<=this.containment[3]?d:d-this.offset.click.top>=this.containment[1]?d-f.grid[1]:d+f.grid[1]:d,e=this.originalPageX+Math.round((e-this.originalPageX)/f.grid[0])*f.grid[0],e=this.containment?e-this.offset.click.left>=this.containment[0]&&e-this.offset.click.left<=this.containment[2]?e:e-this.offset.click.left>=this.containment[0]?e-f.grid[0]:e+f.grid[0]:e));return{top:d- -this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():q?0:k.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():q?0:k.scrollLeft())}},_rearrange:function(c,d,e,f){e?e[0].appendChild(this.placeholder[0]):d.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?d.item[0]:d.item[0].nextSibling);var k=this.counter= -this.counter?++this.counter:1;this._delay(function(){k===this.counter&&this.refreshPositions(!f)})},_clear:function(c,d){this.reverting=!1;var e,f=[];!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]===this.currentItem[0]){for(e in this._storedCSS)if("auto"===this._storedCSS[e]||"static"===this._storedCSS[e])this._storedCSS[e]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show(); -this.fromOutside&&!d&&f.push(function(c){this._trigger("receive",c,this._uiHash(this.fromOutside))});(this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!d&&f.push(function(c){this._trigger("update",c,this._uiHash())});this!==this.currentContainer&&!d&&(f.push(function(c){this._trigger("remove",c,this._uiHash())}),f.push(function(c){return function(d){c._trigger("receive",d,this._uiHash(this))}}.call(this, -this.currentContainer)),f.push(function(c){return function(d){c._trigger("update",d,this._uiHash(this))}}.call(this,this.currentContainer)));for(e=this.containers.length-1;0<=e;e--)d||f.push(function(c){return function(d){c._trigger("deactivate",d,this._uiHash(this))}}.call(this,this.containers[e])),this.containers[e].containerCache.over&&(f.push(function(c){return function(d){c._trigger("out",d,this._uiHash(this))}}.call(this,this.containers[e])),this.containers[e].containerCache.over=0);this.storedCursor&& -(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove());this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex);this.dragging=!1;if(this.cancelHelperRemoval){if(!d){this._trigger("beforeStop",c,this._uiHash());for(e=0;e');d.find(f.handle).mousedown(function(){k=!0}).mouseup(function(){k=!1});l(this).data("items",f.items);n=n.add(p);f.connectWith&&l(f.connectWith).add(this).data("connectWith",f.connectWith);d.attr("draggable","true").on("dragstart.h5s",function(d){if(f.handle&&!k)return!1;k=!1;d=d.originalEvent.dataTransfer;d.effectAllowed="move";d.setData("Text","dummy");s=(m=l(this)).addClass("sortable-dragging").index()}).on("dragend.h5s", -function(){m&&(m.removeClass("sortable-dragging").show(),n.detach(),s!=m.index()&&m.parent().trigger("sortupdate",{item:m}),m=null)}).not("a[href], img").on("selectstart.h5s",function(){this.dragDrop&&this.dragDrop();return!1}).end().add([this,p]).on("dragover.h5s dragenter.h5s drop.h5s",function(e){if(!d.is(m)&&f.connectWith!==l(m).parent().data("connectWith"))return!0;if("drop"==e.type)return e.stopPropagation(),n.filter(":visible").after(m),m.trigger("dragend.h5s"),!1;e.preventDefault();e.originalEvent.dataTransfer.dropEffect= -"move";d.is(this)?(f.forcePlaceholderSize&&p.height(m.outerHeight()),m.hide(),l(this)[p.index()');else d+='';return d},hide:function(){this.div&&(this.div.style.left="-2000px")}, -show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var f=document.getElementsByTagName("body")[0];try{f.removeChild(this.div)}catch(e){}this.div=this.domElement=null}},reposition:function(f){f&&((this.domElement=n.$(f))||this.hide());if(this.domElement&&this.div){f=n.getDOMObjectPosition(this.domElement);var e=this.div.style;e.left=""+f.left+"px";e.top=""+f.top+"px"}},setText:function(f){this.clipText=f;this.ready&&this.movie.setText(f)}, -addEventListener:function(f,e){f=f.toString().toLowerCase().replace(/^on/,"");this.handlers[f]||(this.handlers[f]=[]);this.handlers[f].push(e)},setHandCursor:function(f){this.handCursorEnabled=f;this.ready&&this.movie.setHandCursor(f)},setCSSEffects:function(f){this.cssEffects=!!f},receiveEvent:function(f,e){f=f.toString().toLowerCase().replace(/^on/,"");switch(f){case "load":this.movie=document.getElementById(this.movieId);if(!this.movie){var d=this;setTimeout(function(){d.receiveEvent("load",null)}, -1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){d=this;setTimeout(function(){d.receiveEvent("load",null)},100);this.ready=!0;return}this.ready=!0;try{this.movie.setText(this.clipText)}catch(k){}try{this.movie.setHandCursor(this.handCursorEnabled)}catch(m){}break;case "mouseover":this.domElement&&this.cssEffects&&(this.domElement.addClass("hover"),this.recoverActive&&this.domElement.addClass("active"));break;case "mouseout":this.domElement&&this.cssEffects&& -(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0),this.domElement.removeClass("hover"));break;case "mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case "mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[f])for(var p=0,n=this.handlers[f].length;pg||p.hasOwnProperty(g)&&(y[p[g]]=g)}e=y[c]?"keydown":"keypress"}"keypress"==e&&d.length&&(e="keydown");return e}function s(e,p,n,y,x){g[e+":"+n]=p;e=e.replace(/\s+/g," ");var v=e.split(" "),A,M,ea=[];if(1":".","?":"/","|":"\\"},q={option:"alt",command:"meta", -"return":"enter",escape:"esc",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},y,c={},g={},t={},F,G=!1,z=!1,A=1;20>A;++A)p[111+A]="f"+A;for(A=0;9>=A;++A)p[A+96]=A;n(document,"keypress",e);n(document,"keydown",e);n(document,"keyup",e);var M={bind:function(c,d,e){c=c instanceof Array?c:[c];for(var g=0;g'+f.string.substr(0,d.getOption("foldedLength"))+'..."')[0];c=d.markText(l.Pos(e,f.start),l.Pos(e,f.end),{className:"csdl-folded-string",atomic:!0,replacedWith:g});d.refresh();m(g).on("click",function(){var e=c.find();c.clear();e&&(s(d,e.from.line),d.focus(),d.setCursor({line:e.from.line, -ch:e.from.ch+1}))})}},e=function(d,e,f,c){if(c=c||n(d,e,f))c.clear(),d.refresh()},d=function(d,e,f){f=f||"string";var c=[],g=d.getLineHandle(e),k=null,m=1;if(!g)return c;for(;md.getOption("foldableLength")},x=function(d){d=d||"fold";var e=u.createElement("div");e.className="CodeMirror-foldmarker CodeMirror-foldmarker-"+d;return e};l.defineOption("foldOnLoad",!1);l.defineOption("foldableLength",20);l.defineOption("foldedLength",5);l.defineInitHook(function(m){var q=m.getOption("foldOnLoad"),l=0;m.eachLine(function(){var c= -s(m,l);if(q&&c){var e=l;setTimeout(function(){for(var c=d(m,e,"string"),q=0;qs.charCodeAt(0)&&!/^[\w]$/.test(p.peek()))return p.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),n.type="number";if("."===s&&p.match(/^[0-9eE]+/))return n.type="number";p.eatWhile(/^[^\s\(\)\{\}]/);var q=p.current().toLowerCase();if(m.hasOwnProperty(q))return"operator";if(v.hasOwnProperty(q))return"logical";if(f.hasOwnProperty(q)||"tag."===q.substr(0,4)||"tags."===q.substr(0,5))return"keyword";"[keep"===q&&(p.eatWhile(/^[^\s]/),q=p.current().toLowerCase()); -return e.hasOwnProperty(q)?"punctuation":u.hasOwnProperty(q)?"target":null},k=function(e,f){for(;;)if(f.type="comment",e.skipTo("*")){if(e.next(),e.eat("/")){f.type=null;f.tokenize=d;break}}else{e.skipToEnd();break}return"comment"},s=function(d){if(d===l||null===d||!d||!d.length)return{};var e={},f,k;for(k=0;k=!\.\(\)\[\]]+$/.test(k.string)){var p=n.getPreviousToken(f,d,k),l=[],x=[],D=k.string.toLowerCase(),q=D.length;if(p&&("target"===p.type||"operator"===p.type&&"cs"===p.string))l=l.concat(e.operators);if(p&&("operator"===p.type||"string"===p.type||"number"===p.type||"closebracket"===p.type||"keyword"=== -p.type))l=l.concat(e.logical);if(p===u||null===p||!p||null===p.type||"openbracket"===p.type||"keyword"===p.type||"logical"===p.type)l=l.concat(e.targets);if(p===u||null===p||!p||null===p.type||"openbracket"===p.type||"closebracket"===p.type)l=l.concat(e.keywords);if(p!==u&&null!==p&&"operator"===p.type&&("contains"===p.string.toLowerCase()||"contains_any"===p.string.toLowerCase()||"continas_near"===p.string.toLowerCase()))l=l.concat(e.punctuationControl);for(p=0;p'),v=!0)};n.mapsInit=function(){n.mapsOptions={center:new google.maps.LatLng(40, -0),zoom:1,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:!0,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},navigationControl:!0,navigationControlOptions:{style:google.maps.NavigationControlStyle.SMALL}};google.maps.Polygon.prototype.getBounds||(google.maps.Polygon.prototype.getBounds=function(){var d=new google.maps.LatLngBounds,e=this.getPaths(),f,m,l;for(m=0;m2");d.find(".csdl-map-instructions").html(e.config.geo_box.instructions[0]);m(this).hide();return!1})};n.GeoSelection.box.prototype={setValue:function(e){e=e.split(":"); -if(2!==e.length)return!1;var d=this,f=e[0].split(","),l=e[1].split(",");setTimeout(function(){var e=d.$view.data("map"),m=d.$view.data("rect"),n=d.getAllTipsFromNWSE(f,l),q=new google.maps.LatLngBounds(n.sw,n.ne);d.drawRectangleFromBounds(e,m,q);q=d.$view.data("markers");q[0].setMap(e);q[0].setPosition(n.ne);q[1].setMap(e);q[1].setPosition(n.sw);e.fitBounds(m.getBounds());d.updateInfo(m);d.$view.find(".csdl-map-instructions").html(d.editor.config.geo_box.instructions[2]);d.$view.find(".csdl-clear-map").fadeIn()}, -400)},getValue:function(){var e=this.$view.data("rect");if(!e.getMap())return"";e=this.getAllTipsFromBounds(e.getBounds());return e.nw.lat()+","+e.nw.lng()+":"+e.se.lat()+","+e.se.lng()},updateInfo:function(e){var d=this;e=this.getAllTipsFromBounds(e.getBounds());var f=google.maps.geometry.spherical.computeArea([e.nw,e.ne,e.se,e.sw]);this.$view.find(".csdl-map-area span").html(l(Math.round(f/1E6))+" km2");m.each(e,function(e,f){d.$view.find(".csdl-map-coordinates ."+e+" span").html(l(f.lat(), -2)+", "+l(f.lng(),2))})},drawRectangle:function(e,d,f){if(2!==f.length)return!1;f=this.getAllTipsFromUnspecified(f[0],f[1]);f=new google.maps.LatLngBounds(f.sw,f.ne);this.drawRectangleFromBounds(e,d,f);return!0},drawRectangleFromBounds:function(e,d,f){d.setBounds(f);d.setMap(e)},getAllTipsFromBounds:function(e){var d={};d.ne=e.getNorthEast();d.sw=e.getSouthWest();d.nw=new google.maps.LatLng(d.ne.lat(),d.sw.lng());d.se=new google.maps.LatLng(d.sw.lat(),d.ne.lng());return d},getAllTipsFromNWSE:function(e, -d){var f={};f.nw=new google.maps.LatLng(parseFloat(e[0]),parseFloat(e[1]));f.se=new google.maps.LatLng(parseFloat(d[0]),parseFloat(d[1]));f.ne=new google.maps.LatLng(f.nw.lat(),f.se.lng());f.sw=new google.maps.LatLng(f.se.lat(),f.nw.lng());return f},getAllTipsFromUnspecified:function(e,d){var f,l,m,n;e.lat()>=d.lat()?(f=e,l=d):(f=d,l=e);e.lng()>=d.lng()?(n=e,m=d):(n=d,m=e);return{nw:new google.maps.LatLng(f.lat(),m.lng()),ne:new google.maps.LatLng(f.lat(),n.lng()),se:new google.maps.LatLng(l.lat(), -n.lng()),sw:new google.maps.LatLng(l.lat(),m.lng())}}};n.GeoSelection.radius=function(e,d){this.editor=e;this.$view=d;var k=this,l=new google.maps.Map(d.find(".csdl-map-canvas")[0],n.mapsOptions),p=new google.maps.Circle(e.options.mapsOverlay),x={position:new google.maps.LatLng(0,0),draggable:!0,icon:e.options.mapsMarker},v=new google.maps.Marker(x),q=new google.maps.Marker(x);d.data("map",l).data("circle",p).data("centerMarker",v).data("radiusMarker",q).data("center",!1);d.find(".csdl-map-instructions").html(e.config.geo_radius.instructions[0]); -f(d);google.maps.event.addListener(l,"click",function(f){if(d.data("center")){var c=google.maps.geometry.spherical.computeDistanceBetween(p.getCenter(),f.latLng);p.setRadius(c);p.setMap(l);q.setPosition(f.latLng);q.setMap(l);k.updateInfo(p);d.find(".csdl-map-instructions").html(e.config.geo_radius.instructions[2])}else p.setCenter(f.latLng),v.setPosition(f.latLng),v.setMap(l),d.data("center",!0),d.find(".csdl-map-instructions").html(e.config.geo_radius.instructions[1]);d.find(".csdl-clear-map").fadeIn()}); -google.maps.event.addListener(v,"position_changed",function(){var d=this.getPosition(),c=p.getCenter();p.setCenter(d);if(c!==u){var e=d.lat()-c.lat(),d=d.lng()-c.lng(),c=q.getPosition(),e=new google.maps.LatLng(c.lat()+e,c.lng()+d);q.setPosition(e)}});google.maps.event.addListener(q,"position_changed",function(){p.getCenter()!==u&&(p.setRadius(google.maps.geometry.spherical.computeDistanceBetween(p.getCenter(),this.getPosition())),k.updateInfo(p))});d.find(".csdl-clear-map").on("click",function(){p.setCenter(null); -p.setMap(null);v.setMap(null);q.setMap(null);d.data("center",!1);d.find(".csdl-map-area span").html("0 km2");d.find(".csdl-map-instructions").html(e.geo_radius.instructions[0]);m(this).hide();return!1})};n.GeoSelection.radius.prototype={setValue:function(e){e=e.split(":");var d=this,f=e[0].split(","),l=1E3*parseFloat(e[1]);setTimeout(function(){var e=d.$view.data("map"),m=d.$view.data("circle"),n=new google.maps.LatLng(f[0],f[1]),q=d.$view.data("centerMarker");q.setPosition(n);q.setMap(e); -var q=d.$view.data("radiusMarker"),y=google.maps.geometry.spherical.computeOffset(n,l,90);q.setPosition(y);q.setMap(e);m.setCenter(n);m.setRadius(l);m.setMap(e);d.$view.data("center",!0);e.fitBounds(m.getBounds());d.updateInfo(m);d.$view.find(".csdl-map-instructions").html(d.editor.config.geo_radius.instructions[2]);d.$view.find(".csdl-clear-map").fadeIn()},200)},getValue:function(){var e=this.$view.data("circle");if(!e.getMap())return"";var d=e.getCenter();return d.lat()+","+d.lng()+":"+e.getRadius()/ -1E3},updateInfo:function(e){var d=e.getRadius(),d=d*d*Math.PI,f=e.getCenter();this.$view.find(".csdl-map-area span").html(l(Math.round(d/1E6))+" km2");this.$view.find(".csdl-map-coordinates .center span").html(l(f.lat(),2)+", "+l(f.lng(),2));this.$view.find(".csdl-map-coordinates .radius span").html(l(e.getRadius()/1E3,2)+" km")}};n.GeoSelection.polygon=function(e,d){this.editor=e;this.$view=d;var k=this,l=new google.maps.Map(d.find(".csdl-map-canvas")[0],n.mapsOptions),p=m.extend({},e.options.mapsOverlay, -{paths:[[]],editable:!0}),u=new google.maps.Polygon(p),v=u.getPath(),q=new google.maps.MVCArray,y=1;d.data("map",l).data("polygon",u).data("markers",q);f(d);google.maps.event.addListener(l,"click",function(c){v.push(c.latLng)});google.maps.event.addListener(v,"insert_at",function(c){var g=new google.maps.Marker({map:l,position:v.getAt(c),draggable:!0,icon:e.options.mapsMarker,zIndex:y++});q.insertAt(c,g);3<=v.getLength()&&u.setMap(l);c=3>=v.getLength()?v.getLength():3;d.find(".csdl-map-instructions").html(e.config.geo_polygon.instructions[c]); -k.updateInfo(u);d.find(".csdl-clear-map").fadeIn();google.maps.event.addListener(g,"position_changed",function(){var c=k.getMarkerIndex(g,q);-1!==c&&(v.setAt(c,this.getPosition()),k.updateInfo(u))});google.maps.event.addListener(g,"dblclick",function(){var c=k.getMarkerIndex(g,q);-1!==c&&(v.removeAt(c),q.removeAt(c),this.setMap(null),k.updateInfo(u))})});google.maps.event.addListener(v,"set_at",function(c){var d=q.getAt(c);c=v.getAt(c);d.getPosition().equals(c)||d.setPosition(c)});d.find(".csdl-clear-map").on("click", -function(){q.forEach(function(c){c.setMap(null)});q.clear();v.clear();k.updateInfo(u);d.find(".csdl-map-instructions").html(e.config.geo_polygon.instructions[0]);m(this).hide();return!1});d.find(".csdl-map-instructions").html(e.config.geo_polygon.instructions[0])};n.GeoSelection.polygon.prototype={setValue:function(e){var d=this;e=e.split(":");setTimeout(function(){var f=d.$view.data("polygon"),l=d.$view.data("map");m.each(e,function(d,e){e=e.split(",");var l=new google.maps.LatLng(parseFloat(e[0]), -parseFloat(e[1]));f.getPath().push(l)});l.fitBounds(f.getBounds());d.updateInfo(f);d.$view.find(".csdl-map-instructions").html(d.editor.config.geo_polygon.instructions[3]);d.$view.find(".csdl-clear-map").fadeIn()},400)},getValue:function(){var e=[];this.$view.data("polygon").getPath().forEach(function(d){e.push(d.lat()+","+d.lng())});return e.join(":")},getMarkerIndex:function(e,d){var f=-1;d.forEach(function(d,l){d.getZIndex()===e.getZIndex()&&(f=l)});return f},updateInfo:function(e){e=e.getPath(); -var d=this.$view.find(".csdl-map-coordinates ul").html("");e.forEach(function(e){m("
  • ").html("("+l(e.lat(),4)+", "+l(e.lng(),4)+")").appendTo(d)});3<=e.getLength()?(e=google.maps.geometry.spherical.computeArea(e),this.$view.find(".csdl-map-area span").html(l(Math.round(e/1E6))+" km2")):this.$view.find(".csdl-map-area span").html("0 km2")}}})})(CSDLEditor,window);(function(n,l,u,m){n.Loader.addComponent(function(v){n.ListEditor=function(f,e){var d=this;this.editor=f;this.$view=e;this.$list=this.$view.find(".csdl-list-elements");this.$copyBtn=this.$view.find("a[data-copy]").attr("id","csdl-copy-to-clipboard-"+l.floor(1E4*l.random()));this.$importBtn=this.$view.find("a[data-import]");this.$modeBtns=this.$view.find("a[data-list-mode]");this.$searchInput=this.$view.find('input[name="search"]');this.$counter=this.$view.find("[data-counter]");this.$list.sortable({cursor:"move", -items:":not(.csdl-list-add)"});setTimeout(function(){d.$list.sortable("disable")},100);this.$list.on("keypress","[data-add-item] input",function(e){if(13===e.which){e=v(this);var f=this.value;v.string.trim(f).length&&(d.addItem(f,d.$list.find(".csdl-list-add")),e.val(""))}});this.$list.on("click","li:not([data-add-item])",function(){var e=v(this),f=e.find("span").width();d.$list.find("li.csdl-list-active").removeClass("csdl-list-active");d.mode===d.EDIT_MODE?e.addClass("csdl-list-active").find(".csdl-list-item-input").width(f).focus(): -d.mode===d.DELETE_MODE&&(e.remove(),d.updateCounter());return!1});this.$list.on("keypress","li:not([data-add-item]) input",function(d){13===d.which&&v(this).blur()});this.$list.on("blur","li:not([data-add-item]) input",function(){var e=v(this).closest("li");v.string.trim(this.value).length?e.removeClass("csdl-list-active").data("value",this.value).find(".csdl-list-item-label").text(this.value):(e.remove(),d.updateCounter())});this.$list.on("keydown","li:not([data-add-item]) input",function(d){if(-1!== -v.inArray(d.which,[9,27])){var e=v(this),f=e.closest("li"),l;switch(d.which){case 9:d=d.shiftKey?f.prev("li"):f.next("li");d.length&&d.click();l=!1;break;case 27:e.blur()}return l}});this.$view.find("a[data-sort]").click(function(){var e=d.$list.children().not("[data-add-item]").get();e.sort(function(d,e){return v(d).find("input").val().toUpperCase().localeCompare(v(e).find("input").val().toUpperCase())});v.each(e,function(e,f){d.$list.append(f)});return!1});this.$copyBtn.zclip({path:this.editor.options.zeroClipboard, -copy:function(){return d.getValue()},afterCopy:function(){clearTimeout(void 0);d.$copyBtn.find("span").html("Copied");setTimeout(function(){d.$copyBtn.find("span").html("Copy to Clipboard")},3E3)}});this.$importBtn.click(function(){d.toggleImportView();return!1});this.$searchInput.on("keyup",function(e){if(27===e.which)d.$searchInput.val("").blur(),d.$list.children().show();else{e=d.$searchInput.val();var f=RegExp("^"+e,"i");d.$list.children().not("[data-add-item]").quickEach(function(){f.test(this.data("value"))? -this.show():this.hide()})}});this.$modeBtns.click(function(){d.setMode(v(this).data("listMode"));return!1})};n.ListEditor.prototype={importing:!1,$importView:null,mode:"edit",EDIT_MODE:"edit",MOVE_MODE:"move",DELETE_MODE:"delete",addItem:function(f,e,d){e=e||null;d=d===m?!0:d;f=this.editor.getTemplate("listElement",{value:v.string.escapeHtml(f)});e&&e.length?f.insertAfter(e):f.appendTo(this.$list);d&&(this.$list.sortable("refresh"),this.updateCounter());return f},addItems:function(f,e){e&&this.$list.find("li:not([data-add-item])").remove(); -for(var d=0;dm&&(m=e.length);l.push(e)})}catch(u){this.showCSVImportError(u.message+" on line "+(n+1)+".");return}if(1===m){var q=[];v.each(l,function(d,c){q.push(c[0])});this.addItems(q,e);this.hideImportView()}else this.configureDataImport(l,m)}},configureDataImport:function(f, -e){var d=this;this.$importView.find("[data-step-one]").remove();for(var k=this.editor.getTemplate("listEditor_import_table").prependTo(this.$importView),l=k.find("table thead tr:first"),n=k.find("table tfoot"),u=k.find("table tbody"),D=k.find('input[name="ignoreheaders"]'),k=0;k"),g=0;g"+(f[g]!==m?f[g]:"")+"");c.appendTo(u);d||c.addClass("ignored")});D.change(function(){u.find("tr:first")[this.checked?"addClass":"removeClass"]("ignored")});this.$importView.find("a[data-import-csv]").off("click").on("click",function(){var e=[];l.find('input[name="column"]:checked').each(function(){e.push(parseInt(this.value,10))});if(!e.length)return d.$importView.find("thead").addClass("csdl-error"),!1;D.is(":checked")&&f.shift();var k=[];v.each(f, -function(c,d){v.each(e,function(c,e){d[e]!==m&&k.push(d[e])})});d.addItems(k,d.$importView.find('input[name="replace"]').is(":checked"));d.hideImportView();return!1})}}})})(CSDLEditor,Math,window);(function(n){n.Loader.addComponent(function(){n.Templates={container:'
    ', -indicator:'
    ',popup:'
    ×

    {title}

    {content}
    ',hintHelp:'
    Loading...
    ',geo:'
    ', -geo_box:'
    ',geo_boxCoordinates:'
    ',geo_radius:'
    ',geo_radiusCoordinates:'
    ',geo_polygon:'
    ', -geo_polygonCoordinates:"