"),this.$cn2.append(o.render().el);var a=t.Panels;(a.getPanel("views-container")?a.getPanel("views-container"):a.addPanel({id:"views-container"})).set("appendContent",this.$cn.get(0)).trigger("change:appendContent"),this.target=t.getModel(),this.listenTo(this.target,"component:toggled",this.toggleTm)}this.toggleTm()},toggleTm:function(){var t=this.sender;t&&t.get&&!t.get("active")||(1===this.target.getSelectedAll().length?(this.$cn2.show(),this.$header.hide()):(this.$cn2.hide(),this.$header.show()))},stop:function(){this.$cn2&&this.$cn2.hide(),this.$header&&this.$header.hide()}}},function(t,e,n){"use strict";var i=n(1);t.exports={run:function(t){var e=t.getModel().get("clipboard"),n=t.getSelected();e&&n&&(t.getSelectedAll().forEach(function(n){if(n){var r=n.collection,o=r.indexOf(n)+1,s=e.filter(function(t){return t.get("copyable")}),a=void 0;a=(0,i.contains)(e,n)&&n.get("copyable")?r.add(n.clone(),{at:o}):r.add(s.map(function(t){return t.clone()}),{at:o}),(a=(0,i.isArray)(a)?a:[a]).forEach(function(e){return t.trigger("component:paste",e)})}}),n.emitUpdate())}}},function(t,e,n){"use strict";var i=n(1);t.exports={getPanels:function(t){return this.panels||(this.panels=t.Panels.getPanelsEl()),this.panels},tglPointers:function(t,e){var n=t.Canvas.getBody().querySelectorAll("."+this.ppfx+"no-pointer");(0,i.each)(n,function(t){return t.style.pointerEvents=e?"":"all"})},run:function(t,e){this.sender=e,t.stopCommand("sw-visibility"),t.getModel().stopDefault();var n=this.getPanels(t),i=t.Canvas.getElement(),r=t.getEl(),o=t.Config.stylePrefix;if(!this.helper){var s=document.createElement("span");s.className=o+"off-prv fa fa-eye-slash",r.appendChild(s),s.onclick=function(){return t.stopCommand("preview")},this.helper=s}this.helper.style.display="inline-block",this.tglPointers(t),n.style.display="none";var a=i.style;a.width="100%",a.height="100%",a.top="0",a.left="0",a.padding="0",a.margin="0",t.refresh()},stop:function(t){var e=this.sender,n=void 0===e?{}:e;n.set&&n.set("active",0);var i=this.getPanels(t);t.runCommand("sw-visibility"),t.getModel().runDefault(),i.style.display="",t.Canvas.getElement().setAttribute("style",""),this.helper&&(this.helper.style.display="none"),t.refresh(),this.tglPointers(t,1)}}},function(t,e,n){"use strict";t.exports={run:function(t,e,n){var i=n||{},r=i.el||"",o=t.Canvas,s=this.canvasResizer,a=i.options||{},l=o.getCanvasView();return a.appendTo=o.getResizerEl(),a.prefix=t.getConfig().stylePrefix,a.posFetcher=l.getElementPos.bind(l),a.mousePosFetcher=o.getMouseRelativePos,s&&!i.forceNew||(this.canvasResizer=t.Utils.Resizer.init(a),s=this.canvasResizer),s.setOptions(a),s.blur(),s.focus(r),s},stop:function(){var t=this.canvasResizer;t&&t.blur()}}},function(t,e,n){"use strict";var i,r=n(0),o=(i=r)&&i.__esModule?i:{default:i},s=n(2);var a=o.default.$;t.exports={getOffsetMethod:function(t){return"get"+(t||"")+"OffsetViewerEl"},run:function(t,e,n){var i=n||{},r=i.state||"",o=t.getConfig(),l=this.em.getZoomDecimal(),c=i.el||"";if(!o.showOffsets||(0,s.isTextNode)(c)||!o.showOffsetsSelected&&"Fixed"==r)t.stopCommand(this.id,n);else{var u=t.Canvas,h=i.elPos||u.getElementPos(c),d=window.getComputedStyle(c),f=this.ppfx,p=r+"State",g=u[this.getOffsetMethod(r)]();g.style.display="block";var v=this["marginT"+r],m=this["marginB"+r],y=this["marginL"+r],b=this["marginR"+r],x=this["padT"+r],w=this["padB"+r],C=this["padL"+r],k=this["padR"+r];if(!this[p]){var S=r.toLowerCase(),T=S+"margin-v",E=S+"padding-v",M=a('
').get(0),A=a('
').get(0),O=f+T+"-el"+" "+(f+T),P=f+E+"-el"+" "+(f+E);v=a('
').get(0),m=a('
').get(0),y=a('
').get(0),b=a('
').get(0),x=a('
').get(0),w=a('
').get(0),C=a('
').get(0),k=a('
').get(0),this["marginT"+r]=v,this["marginB"+r]=m,this["marginL"+r]=y,this["marginR"+r]=b,this["padT"+r]=x,this["padB"+r]=w,this["padL"+r]=C,this["padR"+r]=k,M.appendChild(v),M.appendChild(m),M.appendChild(y),M.appendChild(b),A.appendChild(x),A.appendChild(w),A.appendChild(C),A.appendChild(k),g.appendChild(M),g.appendChild(A),this[p]="1"}var _=parseFloat(d.marginLeft.replace("px",""))*l,L=parseFloat(d.marginRight.replace("px",""))*l,N=parseFloat(d.marginTop.replace("px",""))*l,D=parseFloat(d.marginBottom.replace("px",""))*l,I=v.style,F=m.style,j=y.style,R=b.style,H=x.style,z=w.style,V=C.style,$=k.style,B=parseFloat(h.left),U=parseFloat(d.width)*l+"px";I.height=N+"px",I.width=U,I.top=h.top-N+"px",I.left=B+"px",F.height=D+"px",F.width=U,F.top=h.top+h.height+"px",F.left=B+"px";var W=h.height+N+D+"px",q=h.top-N+"px";j.height=W,j.width=_+"px",j.top=q,j.left=B-_+"px",R.height=W,R.width=L+"px",R.top=q,R.left=B+h.width+"px";var K=parseFloat(d.paddingTop)*l;H.height=K+"px",H.width=U,H.top=h.top+"px",H.left=B+"px";var G=parseFloat(d.paddingBottom)*l;z.height=G+"px",z.width=U,z.top=h.top+h.height-G+"px",z.left=B+"px";var Y=h.height-G-K+"px",X=h.top+K+"px";V.height=Y,V.width=parseFloat(d.paddingLeft)*l+"px",V.top=X,V.left=h.left+"px";var J=parseFloat(d.paddingRight)*l;$.height=Y,$.width=J+"px",$.top=X,$.left=h.left+h.width-J+"px"}},stop:function(t,e,n){var i=(n||{}).state||"",r=this.getOffsetMethod(i);t.Canvas[r]().style.display="none"}}},function(t,e,n){"use strict";t.exports={run:function(t){t.Canvas.getBody().className=this.ppfx+"dashed"},stop:function(t){t.Canvas.getBody().className=""}}},function(t,e,n){"use strict";var i,r=n(0),o=(i=r)&&i.__esModule?i:{default:i};t.exports=o.default.Model.extend({defaults:{id:"",label:"",open:!0,attributes:{}}})},function(t,e,n){"use strict";var i,r,o,s=Object.assign||function(t){for(var e=1;e
0&&void 0!==arguments[0]?arguments[0]:{},e=t.container;if(!e)throw new Error("'container' is required");(t=s({},o,t)).el=(0,c.isElement)(e)?e:document.querySelector(e);var n=new l.default(t).init();return t.plugins.forEach(function(e){var r=i.get(e),o=t.pluginsOpts[e]||{};if(!r){var s=window[e];r=s&&s.default?s.default:s}r?r(n,o):(0,c.isFunction)(e)?e(n,o):console.warn("Plugin "+e+" not found")}),n.getModel().loadOnStart(),t.autorender&&n.render(),r.push(n),n}})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,r=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{},e=n(87),i=n(88),o=n(236),a=r({},e,t);a.pStylePrefix=a.stylePrefix;var l=new i(a),c=new o({model:l,config:a});return{$:s.default,editor:l,DomComponents:l.get("DomComponents"),LayerManager:l.get("LayerManager"),CssComposer:l.get("CssComposer"),StorageManager:l.get("StorageManager"),AssetManager:l.get("AssetManager"),BlockManager:l.get("BlockManager"),TraitManager:l.get("TraitManager"),SelectorManager:l.get("SelectorManager"),CodeManager:l.get("CodeManager"),Commands:l.get("Commands"),Keymaps:l.get("Keymaps"),Modal:l.get("Modal"),Panels:l.get("Panels"),StyleManager:l.get("StyleManager"),Canvas:l.get("Canvas"),UndoManager:l.get("UndoManager"),DeviceManager:l.get("DeviceManager"),RichTextEditor:l.get("RichTextEditor"),Parser:l.get("Parser"),Utils:l.get("Utils"),Config:l.get("Config"),init:function(){return l.init(this),this},getConfig:function(t){return l.getConfig(t)},getHtml:function(t){return l.getHtml(t)},getCss:function(t){return l.getCss(t)},getJs:function(){return l.getJs()},getComponents:function(){return l.get("DomComponents").getComponents()},getWrapper:function(){return l.get("DomComponents").getWrapper()},setComponents:function(t){return l.setComponents(t),this},addComponents:function(t,e){return this.getComponents().add(t,e)},getStyle:function(){return l.get("CssComposer").getAll()},setStyle:function(t){return l.setStyle(t),this},getSelected:function(){return l.getSelected()},getSelectedAll:function(){return l.getSelectedAll()},getSelectedToStyle:function(){var t=l.getSelected();if(t)return this.StyleManager.getModelToStyle(t)},select:function(t,e){return l.setSelected(t,e),this},selectAdd:function(t){return l.addSelected(t),this},selectRemove:function(t){return l.removeSelected(t),this},selectToggle:function(t){return l.toggleSelected(t),this},setDevice:function(t){return l.set("device",t),this},getDevice:function(){return l.get("device")},runCommand:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l.get("Commands").run(t,e)},stopCommand:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l.get("Commands").stop(t,e)},store:function(t){return l.store(t)},load:function(t){return l.load(t)},getContainer:function(){return a.el},getDirtyCount:function(){return l.getDirtyCount()},refresh:function(){l.refreshCanvas()},setCustomRte:function(t){this.RichTextEditor.customRte=t},setCustomParserCss:function(t){return this.Parser.getConfig().parserCss=t,this},log:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l.log(t,e),this},on:function(t,e){return l.on(t,e),this},once:function(t,e){return l.once(t,e),this},off:function(t,e){return l.off(t,e),this},trigger:function(t){return l.trigger.apply(l,arguments),this},destroy:function(){return l.destroyAll()},getEl:function(){return c.el},getModel:function(){return l},render:function(){var t=this;return l.on("loaded",function(){t.UndoManager.clear(),l.get("modules").forEach(function(t){t.postRender&&t.postRender(c)})}),c.render(),c.el}}}},function(t,e,n){"use strict";t.exports={stylePrefix:"gjs-",components:"",style:"",fromElement:0,noticeOnUnload:!0,showOffsets:!1,showOffsetsSelected:!1,forceClass:!0,height:"900px",width:"100%",log:["warning","error"],baseCss:"\n * {\n box-sizing: border-box;\n }\n html, body, #wrapper {\n min-height: 100%;\n }\n body {\n margin: 0;\n height: 100%;\n background-color: #fff\n }\n #wrapper {\n overflow: auto;\n overflow-x: hidden;\n }\n\n * ::-webkit-scrollbar-track {\n background: rgba(0, 0, 0, 0.1)\n }\n\n * ::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.2)\n }\n\n * ::-webkit-scrollbar {\n width: 10px\n }\n ",protectedCss:"* { box-sizing: border-box; } body {margin: 0;}",canvasCss:"",defaultCommand:"select-comp",showToolbar:1,allowScripts:0,showDevices:1,devicePreviewMode:0,mediaCondition:"max-width",tagVarStart:"{[ ",tagVarEnd:" ]}",keepEmptyTextNodes:0,jsInHtml:!0,nativeDnD:1,multipleSelection:1,exportWrapper:0,wrappesIsBody:1,avoidInlineStyle:0,avoidDefaults:0,clearStyles:0,el:"",undoManager:{},assetManager:{},canvas:{},layers:{},storageManager:{},rte:{},domComponents:{},modal:{},codeManager:{},panels:{},commands:{},cssComposer:{},selectorManager:{},deviceManager:{devices:[{name:"Desktop",width:""},{name:"Tablet",width:"768px",widthMedia:"992px"},{name:"Mobile landscape",width:"568px",widthMedia:"768px"},{name:"Mobile portrait",width:"320px",widthMedia:"480px"}]},styleManager:{sectors:[{name:"General",open:!1,buildProps:["float","display","position","top","right","left","bottom"]},{name:"Flex",open:!1,buildProps:["flex-direction","flex-wrap","justify-content","align-items","align-content","order","flex-basis","flex-grow","flex-shrink","align-self"]},{name:"Dimension",open:!1,buildProps:["width","height","max-width","min-height","margin","padding"]},{name:"Typography",open:!1,buildProps:["font-family","font-size","font-weight","letter-spacing","color","line-height","text-align","text-shadow"],properties:[{property:"text-align",list:[{value:"left",className:"fa fa-align-left"},{value:"center",className:"fa fa-align-center"},{value:"right",className:"fa fa-align-right"},{value:"justify",className:"fa fa-align-justify"}]}]},{name:"Decorations",open:!1,buildProps:["border-radius-c","background-color","border-radius","border","box-shadow","background"]},{name:"Extra",open:!1,buildProps:["transition","perspective","transform"]}]},blockManager:{},traitManager:{},textViewCode:"Code",keepUnusedStyles:0,multiFrames:0}},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};this.config=e,this.set("Config",e),this.set("modules",[]),this.set("toLoad",[]),this.set("storables",[]);var n=e.el,i=e.log,o=!0===i?(0,r.keys)(d):(0,r.isArray)(i)?i:[];n&&e.fromElement&&(this.config.components=n.innerHTML),this.attrsOrig=n?(0,r.toArray)(n.attributes).reduce(function(t,e){return t[e.nodeName]=e.nodeValue,t},{}):"",s.forEach(function(e){return t.loadModule(e)}),this.on("change:componentHovered",this.componentHovered,this),this.on("change:changesCount",this.updateChanges,this),o.forEach(function(e){return t.listenLog(e)}),[{from:"change:selectedComponent",to:"component:toggled"}].forEach(function(e){var n=e.from,i=e.to;t.listenTo(t,n,function(){for(var e=arguments.length,r=Array(e),o=0;o0&&void 0!==arguments[0]?arguments[0]:null,n=this.get("StorageManager");this.get("toLoad").forEach(function(t){t.onLoad()});var i=function(){t.get("modules").forEach(function(e){return e.postLoad&&e.postLoad(t)}),e&&e()};n&&n.canAutoload()?this.load(i):i()},updateChanges:function(){var t=this,e=this.get("StorageManager"),n=this.get("changesCount");u&&clearTimeout(u),u=setTimeout(function(){return t.trigger("update")}),this.config.noticeOnUnload&&(window.onbeforeunload=n?function(t){return 1}:null),e.isAutosave()&&n>=e.getStepsBeforeSave()&&this.store()},loadModule:function(t){var e=this.config,n=new t,o=n.name.charAt(0).toLowerCase()+n.name.slice(1),s=(0,r.isUndefined)(e[o])?e[n.name]:e[o],a=s||{},l=this.get("StorageManager");if(a.pStylePrefix=e.pStylePrefix||"",(0,r.isUndefined)(s)||s||(a._disable=1),n.storageKey&&n.store&&n.load&&l){a.stm=l;var c=this.get("storables");c.push(n),this.set("storables",c)}return a.em=this,n.init(i({},a)),!n.private&&this.set(n.name,n),n.onLoad&&this.get("toLoad").push(n),this.get("modules").push(n),this},init:function(t){this.set("Editor",t)},getEditor:function(){return this.get("Editor")},handleUpdates:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i.temporary||(c&&clearInterval(c),c=setTimeout(function(){i.avoidStore||n.set("changesCount",n.get("changesCount")+1,i)},0))},componentHovered:function(t,e,n){var i=this.previous("componentHovered");i&&this.trigger("component:unhovered",i,n),e&&this.trigger("component:hovered",e,n)},getSelected:function(){return this.get("selected").last()},getSelectedAll:function(){return this.get("selected").models},setSelected:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.scroll,s=(0,r.isArray)(t),a=s?t:[t],l=this.get("selected"),c=void 0;s&&this.removeSelected(l.filter(function(t){return!(0,r.contains)(a,t)})),a.forEach(function(t){var i=(0,o.getModel)(t,h);i&&!i.get("selectable")||(!s&&e.removeSelected(l.filter(function(t){return t!==i})),e.addSelected(i,n),c=i)}),i&&c&&this.get("Canvas").scrollTo(c,i)},addSelected:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,o.getModel)(t,h);((0,r.isArray)(i)?i:[i]).forEach(function(t){if(!t||t.get("selectable")){var i=e.get("selected");n.forceChange&&i.remove(t,n),i.push(t,n)}})},removeSelected:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.get("selected").remove((0,o.getModel)(t,h),e)},toggleSelected:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,o.getModel)(t,h);((0,r.isArray)(i)?i:[i]).forEach(function(t){e.get("selected").contains(t)?e.removeSelected(t,n):e.addSelected(t,n)})},setHovered:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(0,o.getModel)(t,h);n&&!n.get("hoverable")||(e.forceChange&&this.set("componentHovered",""),this.set("componentHovered",n,e))},setComponents:function(t){return this.get("DomComponents").setComponents(t)},getComponents:function(){var t=this.get("DomComponents"),e=this.get("CodeManager");if(t&&e){var n=t.getComponents();return e.getCode(n,"json")}},setStyle:function(t){for(var e=this.get("CssComposer").getAll(),n=0,i=e.length;n"+i+"<\/script>":""},getCss:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.config,n=e.wrappesIsBody,i=t.avoidProtected,o=(0,r.isUndefined)(t.keepUnusedStyles)?e.keepUnusedStyles:t.keepUnusedStyles,s=this.get("CssComposer"),a=this.get("DomComponents").getComponent();return(i?"":e.protectedCss)+this.get("CodeManager").getCode(a,"css",{cssc:s,wrappesIsBody:n,keepUnusedStyles:o})},getJs:function(){var t=this.get("DomComponents").getWrapper();return this.get("CodeManager").getCode(t,"js").trim()},store:function(t){var e=this,n=this.get("StorageManager"),i={};if(n)return this.get("storables").forEach(function(t){var e=t.store(1);for(var n in e)i[n]=e[n]}),n.store(i,function(n){t&&t(n),e.set("changesCount",0),e.trigger("storage:store",i)}),i},load:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.getCacheLoad(1,function(n){t.get("storables").forEach(function(t){return t.load(n)}),e&&e(n)})},getCacheLoad:function(t,e){var n=this,i=t?1:0;if(this.cacheLoad&&!i)return this.cacheLoad;var r=this.get("StorageManager"),o=[];if(!r)return{};this.get("storables").forEach(function(t){var e=t.storageKey;((e="function"==typeof e?e():e)instanceof Array?e:[e]).forEach(function(t){o.push(t)})}),r.load(o,function(t){n.cacheLoad=t,e&&e(t),setTimeout(function(){return n.trigger("storage:load",t)},0)})},getDeviceModel:function(){var t=this.get("device");return this.get("DeviceManager").get(t)},runDefault:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.get("Commands").get(this.config.defaultCommand);e&&!this.defaultRunning&&(e.stop(this,this,t),e.run(this,this,t),this.defaultRunning=1)},stopDefault:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.get("Commands").get(this.config.defaultCommand);e&&(e.stop(this,this,t),this.defaultRunning=0)},refreshCanvas:function(){this.set("canvasOffset",null),this.set("canvasOffset",this.get("Canvas").getOffset())},clearSelection:function(t){(t||window).getSelection().removeAllRanges()},getCurrentMedia:function(){var t=this.config,e=this.getDeviceModel(),n=t.mediaCondition,i=t.devicePreviewMode,r=e&&e.get("widthMedia");return e&&r&&!i?"("+n+": "+r+")":""},getWrapper:function(){return this.get("DomComponents").getWrapper()},getDirtyCount:function(){return this.get("changesCount")},getZoomDecimal:function(){return this.get("Canvas").getZoomDecimal()},inAbsoluteMode:function(){return"absolute"===this.get("dmode")},destroyAll:function(){var t=this.attributes,e=t.DomComponents,n=t.CssComposer,i=t.UndoManager,r=t.Panels,o=t.Canvas,s=t.Keymaps;e.clear(),n.clear(),i.clear().removeAll(),r.getPanels().reset(),o.getCanvasView().remove(),s.removeAll(),this.view.remove(),this.stopListening(),h(this.config.el).empty().attr(this.attrsOrig)},setEditing:function(t){return this.set("editing",t),this},isEditing:function(){return!!this.get("editing")},log:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.ns,i=e.level,r=void 0===i?"debug":i;if(this.trigger("log",t,e),r&&this.trigger("log:"+r,t,e),n){var o="log-"+n;this.trigger(o,t,e),r&&this.trigger(o+":"+r,t,e)}},logInfo:function(t,e){this.log(t,i({},e,{level:"info"}))},logWarning:function(t,e){this.log(t,i({},e,{level:"warning"}))},logError:function(t,e){this.log(t,i({},e,{level:"error"}))},data:function(t,e,n){if(t["_gjs-data"]||(t["_gjs-data"]={}),(0,r.isUndefined)(n))return t["_gjs-data"][e];t["_gjs-data"][e]=n}})},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";var i,r=n(18),o=(i=r)&&i.__esModule?i:{default:i};t.exports=function(){return{name:"Utils",init:function(){return this},Sorter:n(91),Resizer:n(92),Dragger:o.default}}},function(t,e,n){"use strict";(function(e){var i,r=Object.assign||function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},i=n.target,o=n.avoidChildren,s=void 0===o?1:o,a=this.em,l=this.eV,u=t||l,h=this.dropModel,d=this.dropContent,f=function(t){return t&&i&&t.opt&&t.opt.avoidChildren&&e.isTextableActive(t,i)};if(d&&a){if(f(h)&&(h=null),!h){var p=a.get("DomComponents").getComponents(),g={avoidChildren:s,avoidStore:1,avoidUpdateStyle:1},v=p.add(d,r({},g,{temporary:1}));if(h=(h=p.remove(v,g))instanceof Array?h[0]:h,this.dropModel=h,f(h))return this.getSourceModel(u,{target:i,avoidChildren:0})}return h}return u&&c(u).data("model")},selectTargetModel:function(t){if(!(t instanceof s.default.Collection)){var e=this.targetModel;e&&e.set("status",""),t&&t.set&&(t.set("status","selected-parent"),this.targetModel=t)}},onMove:function(t){var e=t,n=this.em,i=this.onMoveClb,r=this.plh;this.moved=1;var o=r.style.display;o&&"none"!==o||(r.style.display="block");var s=this.offset(this.el);this.elT=this.wmargin?Math.abs(s.top):s.top,this.elL=this.wmargin?Math.abs(s.left):s.left;var l=t.pageY-this.elT+this.el.scrollTop,u=t.pageX-this.elL+this.el.scrollLeft;if(this.canvasRelative&&n){var h=n.get("Canvas").getMouseRelativeCanvas(t);u=h.x,l=h.y}this.rX=u,this.rY=l,this.eventMove=t;var d=this.getSourceModel(),f=this.dimsFromTarget(t.target,u,l),p=this.target,g=this.getTargetModel(p);this.selectTargetModel(g),g||(r.style.display="none"),this.lastDims=f;var v=this.findPosition(f,u,l);this.isTextableActive(d,g)?(this.activeTextModel=g,this.setContentEditable(g,!0),r.style.display="none",this.lastPos=v,this.updateTextViewCursorPosition(e)):(this.disableTextable(),this.activeTextModel=null,this.lastPos&&this.lastPos.index==v.index&&this.lastPos.method==v.method||(this.movePlaceholder(this.plh,f,v,this.prevTargetDim),this.$plh||(this.$plh=c(this.plh)),this.canvasRelative||(this.offTop&&this.$plh.css("top","+="+this.offTop+"px"),this.offLeft&&this.$plh.css("left","+="+this.offLeft+"px")),this.lastPos=v)),(0,a.isFunction)(i)&&i(t),n&&n.trigger("sorter:drag",{target:p,targetModel:g,sourceModel:d,dims:f,pos:v,x:u,y:l})},isTextableActive:function(t,e){return t&&t.get&&t.get("textable")&&e&&e.is("text")},disableTextable:function(){var t=this.activeTextModel;t&&t.getView().disableEditing()},isInFlow:function(t,e){if(!t)return!1;e=e||document.body;var n=t;return n.offsetHeight,!!this.styleInFlow(n,e)},styleInFlow:function(t,e){if(!(0,l.isTextNode)(t)){var n=t.style||{},i=c(t),r=e&&c(e);if(!(n.overflow&&"visible"!==n.overflow||"none"!==i.css("float")||r&&"flex"==r.css("display")&&"column"!==r.css("flex-direction"))){switch(n.position){case"static":case"relative":case"":break;default:return}switch(t.tagName){case"TR":case"TBODY":case"THEAD":case"TFOOT":return!0}switch(i.css("display")){case"block":case"list-item":case"table":case"flex":return!0}}}},validTarget:function(t,e){var n=this.getTargetModel(t),i=this.getSourceModel(e,{target:n}),r={valid:!0,src:e=i&&i.view&&i.view.el,srcModel:i,trg:t=n&&n.view&&n.view.el,trgModel:n};if(!e||!t)return r.valid=!1,r;var o=i.get("draggable");o=o instanceof Array?o.join(", "):o,r.dragInfo=o,o=(0,a.isString)(o)?this.matches(t,o):o,r.draggable=o;var l=n.get("droppable");return l=(l=l instanceof s.default.Collection?1:l)instanceof Array?l.join(", "):l,r.dropInfo=l,l=(0,a.isString)(l)?this.matches(e,l):l,l=o&&this.isTextableActive(i,n)?1:l,r.droppable=l,l&&o||(r.valid=!1),r},dimsFromTarget:function(t,e,n){var i=this.em,r=[];if(!t)return r;if(this.matches(t,this.itemSel+", "+this.containerSel)||(t=this.closest(t,this.itemSel)),this.draggable instanceof Array&&(t=this.closest(t,this.draggable.join(","))),!t)return r;if(this.prevTarget&&this.prevTarget!=t&&(this.prevTarget=null),!this.prevTarget){this.targetP=this.closest(t,this.containerSel);var o=this.validTarget(t);if(i&&i.trigger("sorter:drag:validation",o),!o.valid&&this.targetP)return this.dimsFromTarget(this.targetP,e,n);this.prevTarget=t,this.prevTargetDim=this.getDim(t),this.cacheDimsP=this.getChildrenDim(this.targetP),this.cacheDims=this.getChildrenDim(t)}if(this.prevTarget==t&&(r=this.cacheDims),this.target=this.prevTarget,this.nearBorders(this.prevTargetDim,e,n)||!this.nested&&!this.cacheDims.length){var s=this.targetP;s&&this.validTarget(s).valid&&(r=this.cacheDimsP,this.target=s)}return this.lastPos=null,r},getTargetFromEl:function(t){var e=t,n=void 0,i=this.targetPrev,r=this.em,o=this.containerSel,s=this.itemSel;if(this.matches(e,s+", "+o)||(e=this.closest(e,s)),this.draggable instanceof Array&&(e=this.closest(e,this.draggable.join(","))),i&&i!=e&&(this.targetPrev=""),!this.targetPrev){n=this.closest(e,o);var a=this.validTarget(e);if(r&&r.trigger("sorter:drag:validation",a),!a.valid&&n)return this.getTargetFromEl(n);this.targetPrev=e}return this.nearElBorders(e)&&(n=this.closest(e,o))&&this.validTarget(n).valid&&(e=n),e},nearElBorders:function(t){var e=t.getBoundingClientRect(),n=t.ownerDocument.body,i=this.getCurrentPos(),r=i.x,o=i.y,s=e.top+n.scrollTop,a=e.left+n.scrollLeft,l=e.width,c=e.height;if(os+c-10||ra+l-10)return 1},getCurrentPos:function(){var t=this.eventMove;return{x:t.pageX||0,y:t.pageY||0}},getDim:function(t){var e,n,i,r,o=this.em;if(this.canvasRelative&&o){var s=o.get("Canvas"),a=s.getElementPos(t),l=s.getElementOffsets(t);e=a.top-l.marginTop,n=a.left-l.marginLeft,i=a.height+l.marginTop+l.marginBottom,r=a.width+l.marginLeft+l.marginRight}else{var c=this.offset(t);e=this.relative?t.offsetTop:c.top-(this.wmargin?-1:1)*this.elT,n=this.relative?t.offsetLeft:c.left-(this.wmargin?-1:1)*this.elL,i=t.offsetHeight,r=t.offsetWidth}return[e,n,i,r]},getChildrenDim:function(t){var e=this,n=[];if(!t)return n;var i=this.getTargetModel(t);return i&&i.view&&!this.ignoreViewChildren&&(t=i.view.getChildrenContainer()),(0,a.each)(t.children,function(i,r){var o=(0,l.getModel)(i,c),s=o&&o.index?o.index():r;if((0,l.isTextNode)(i)||e.matches(i,e.itemSel)){var a=e.getDim(i),u=e.direction;u="v"==u||"h"!=u&&e.isInFlow(i,t),a.push(u,i,s),n.push(a)}}),n},nearBorders:function(t,e,n){var i=0,r=this.borderOffset,o=e||0,s=n||0,a=t[0],l=t[1],c=t[2],u=t[3];return(a+r>s||s>a+c-r||l+r>o||o>l+u-r)&&(i=1),!!i},findPosition:function(t,e,n){for(var i={index:0,indexEl:0,method:"before"},r=0,o=0,s=0,a=0,l=0,c=0,u=0,h=0,d=0,f=t.length;do||a&&c>=a||r&&s0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.setOptions(e),(0,r.bindAll)(this,"handleKeyDown","handleMouseDown","move","stop"),this}return i(t,[{key:"getConfig",value:function(){return this.opts}},{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.opts=(0,r.defaults)(t,s),this.setup()}},{key:"setup",value:function(){var t=this.opts,e=t.prefix||"",n=t.appendTo||document.body,i=this.container;for(i||((i=document.createElement("div")).className=e+"resizer-c",n.appendChild(i),this.container=i);i.firstChild;)i.removeChild(i.firstChild);var r={};for(var o in["tl","tc","tr","cl","cr","bl","bc","br"].forEach(function(e){return r[e]=t[e]?function(t,e){var n=e.prefix||"",i=document.createElement("i");return i.className=n+"resizer-h "+n+"resizer-h-"+t,i.setAttribute("data-"+n+"handler",t),i}(e,t):""}),r){var s=r[o];s&&i.appendChild(s)}this.handlers=r,this.mousePosFetcher=t.mousePosFetcher,this.updateTarget=t.updateTarget,this.posFetcher=t.posFetcher,this.onStart=t.onStart,this.onMove=t.onMove,this.onEnd=t.onEnd}},{key:"toggleFrames",value:function(t){if(this.opts.silentFrames){var e=document.querySelectorAll("iframe");(0,r.each)(e,function(e){return e.style.pointerEvents=t?"none":""})}}},{key:"isHandler",value:function(t){var e=this.handlers;for(var n in e)if(e[n]===t)return!0;return!1}},{key:"getFocusedEl",value:function(){return this.el}},{key:"getDocumentEl",value:function(){return[this.el.ownerDocument,document]}},{key:"getElementPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.posFetcher||"";return n?n(t,e):function(t,e){var n=e||window,i=t.getBoundingClientRect();return{left:i.left+n.pageXOffset,top:i.top+n.pageYOffset,width:i.width,height:i.height}}(t)}},{key:"focus",value:function(t){t&&t===this.el||(this.el=t,this.updateContainer({forceShow:1}),(0,o.on)(this.getDocumentEl(),"mousedown",this.handleMouseDown))}},{key:"blur",value:function(){this.container.style.display="none",this.el&&((0,o.off)(this.getDocumentEl(),"mousedown",this.handleMouseDown),this.el=null)}},{key:"start",value:function(t){if(0===t.button){t.preventDefault(),t.stopPropagation();var e=this.el,n=this.opts||{},i="data-"+n.prefix+"handler",s=this.getElementPos(e,{target:"el"});this.handlerAttr=t.target.getAttribute(i),this.clickedHandler=t.target,this.startDim={t:s.top,l:s.left,w:s.width,h:s.height},this.rectDim={t:s.top,l:s.left,w:s.width,h:s.height},this.startPos={x:t.clientX,y:t.clientY};var a=this.getDocumentEl();(0,o.on)(a,"mousemove",this.move),(0,o.on)(a,"keydown",this.handleKeyDown),(0,o.on)(a,"mouseup",this.stop),(0,r.isFunction)(this.onStart)&&this.onStart(t,{docs:a,config:n,el:e,resizer:this}),this.toggleFrames(1),this.move(t)}}},{key:"move",value:function(t){var e=this.onMove,n=this.mousePosFetcher,i=n?n(t):{x:t.clientX,y:t.clientY};this.currentPos=i,this.delta={x:i.x-this.startPos.x,y:i.y-this.startPos.y},this.keys={shift:t.shiftKey,ctrl:t.ctrlKey,alt:t.altKey},this.rectDim=this.calc(this),this.updateRect(0),e&&e(t),0===t.which&&this.stop(t)}},{key:"stop",value:function(t){var e=this.opts,n=this.getDocumentEl();(0,o.off)(n,"mousemove",this.move),(0,o.off)(n,"keydown",this.handleKeyDown),(0,o.off)(n,"mouseup",this.stop),this.updateRect(1),this.toggleFrames(),(0,r.isFunction)(this.onEnd)&&this.onEnd(t,{docs:n,config:e})}},{key:"updateRect",value:function(t){var e=this.el,n=this.opts,i=this.rectDim,o=this.updateTarget,s=this.getSelectedHandler(),a=n.unitHeight,l=n.unitWidth,c=n.keyWidth,u=n.keyHeight;if((0,r.isFunction)(o))o(e,i,{store:t,selectedHandler:s,resizer:this,config:n});else{var h=e.style;h[c]=i.w+l,h[u]=i.h+a}this.updateContainer()}},{key:"updateContainer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.opts,n=this.container,i=this.el,r=n.style;if(!e.avoidContainerUpdate&&i){var o=this.getElementPos(i,{target:"container"});["left","top","width","height"].forEach(function(t){return r[t]=o[t]+"px"}),t.forceShow&&(r.display="block")}}},{key:"getSelectedHandler",value:function(){var t=this.handlers;if(this.selectedHandler)for(var e in t)if(t[e]===this.selectedHandler)return e}},{key:"handleKeyDown",value:function(t){27===t.keyCode&&(this.rectDim=this.startDim,this.stop(t))}},{key:"handleMouseDown",value:function(t){var e=t.target;this.isHandler(e)?(this.selectedHandler=e,this.start(t)):e!==this.el&&(this.selectedHandler="",this.blur())}},{key:"calc",value:function(t){var e=void 0,n=this.opts||{},i=n.step,r=this.startDim,s=n.minDim,a=n.maxDim,l=t.delta.x,c=t.delta.y,u=r.w,h=r.h,d={t:0,l:0,w:u,h:h};if(t){var f=t.handlerAttr;~f.indexOf("r")&&(e=(0,o.normalizeFloat)(u+l*i,i),e=Math.max(s,e),a&&(e=Math.min(a,e)),d.w=e),~f.indexOf("b")&&(e=(0,o.normalizeFloat)(h+c*i,i),e=Math.max(s,e),a&&(e=Math.min(a,e)),d.h=e),~f.indexOf("l")&&(e=(0,o.normalizeFloat)(u-l*i,i),e=Math.max(s,e),a&&(e=Math.min(a,e)),d.w=e),~f.indexOf("t")&&(e=(0,o.normalizeFloat)(h-c*i,i),e=Math.max(s,e),a&&(e=Math.min(a,e)),d.h=e);var p=n.ratioDefault?!t.keys.shift:t.keys.shift;if(f.indexOf("c")<0&&p){var g=r.w/r.h;d.w/d.h>g?d.h=Math.round(d.w/g):d.w=Math.round(d.h*g)}return~f.indexOf("l")&&(d.l=r.w-d.w),~f.indexOf("t")&&(d.t=r.h-d.h),d}}}]),t}();t.exports={init:function(t){return new a(t)}}},function(t,e,n){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};return e=r({},a,n),t=e.em,this.em=t,this},onLoad:function(){var t=e.defaults;for(var n in t){var i=t[n];this.add(n,i.keys,i.handler)}},add:function(t,e,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l=this.em,c=l.get("Commands"),u=l.getEditor(),h=l.get("Canvas"),d={id:t,keys:e,handler:r};return n[t]&&this.remove(t),n[t]=d,s(e,function(e,n){var s={event:e,h:n};if(r=(0,o.isString)(r)?c.get(r):r,a.prevent&&h.getCanvasView().preventDefault(e),!l.isEditing()&&!u.Canvas.isInputFocused()||a.force){"object"==(void 0===r?"undefined":i(r))?r.run(u,0,s):r(u,0,s);var d=[t,n.shortcut,e];l.trigger.apply(l,["keymap:emit"].concat(d)),l.trigger.apply(l,["keymap:emit:"+t].concat(d))}}),l.trigger("keymap:add",d),d},get:function(t){return n[t]},getAll:function(){return n},remove:function(t){var e=this.em,i=this.get(t);if(i)return delete n[t],s.unbind(i.keys),e&&e.trigger("keymap:remove",i),i},removeAll:function(){var t=this;return Object.keys(n).forEach(function(e){return t.remove(e)}),this}}}},function(t,e,n){!function(e){var n,i={},r={16:!1,18:!1,17:!1,91:!1},o="all",s={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},a={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220},l=function(t){return a[t]||t.toUpperCase().charCodeAt(0)},c=[];for(n=1;n<20;n++)a["f"+n]=111+n;function u(t,e){for(var n=t.length;n--;)if(t[n]===e)return n;return-1}function h(t,e){if(t.length!=e.length)return!1;for(var n=0;n1&&(o=m(t),t=[t[t.length-1]]),t=t[0],(t=l(t))in i||(i[t]=[]),i[t].push({shortcut:r[s],scope:e,method:n,key:r[s],mods:o})}for(n in s)p[n]=!1;function g(){return o||"all"}function v(t){var e;return""==(e=(t=t.replace(/\s/g,"")).split(","))[e.length-1]&&(e[e.length-2]+=","),e}function m(t){for(var e=t.slice(0,t.length-1),n=0;n0,r)(!r[o]&&u(n.mods,+o)>-1||r[o]&&-1==u(n.mods,+o))&&(l=!1);(0!=n.mods.length||r[16]||r[18]||r[17]||r[91])&&!l||!1===n.method(t,n)&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}(t)}),y(document,"keyup",function(t){var e,n=t.keyCode,i=u(c,n);if(i>=0&&c.splice(i,1),93!=n&&224!=n||(n=91),n in r)for(e in r[n]=!1,s)s[e]==n&&(p[e]=!1)}),y(window,"focus",function(){for(n in r)r[n]=!1;for(n in s)p[n]=!1});var b=e.key;e.key=p,e.key.setScope=function(t){o=t||"all"},e.key.getScope=g,e.key.deleteScope=function(t){var e,n,r;for(e in i)for(n=i[e],r=0;r1&&(c=m(r),t=r[r.length-1]),t=l(t),void 0===e&&(e=g()),!i[t])return;for(o=0;o0&&void 0!==arguments[0]?arguments[0]:{};n=r({},a,o),t=n.em,this.em=t,(e=new s.default({track:!0,register:[]})).changeUndoType("change",{condition:!1}),e.changeUndoType("add",{on:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!n.avoidStore)return{object:e,before:void 0,after:t,options:r({},n)}}}),e.changeUndoType("remove",{on:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!n.avoidStore)return{object:e,before:t,after:void 0,options:r({},n)}}});var l={on:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!i&&(i=t.previousAttributes()),!n.avoidStore){var r={object:t,before:i,after:t.toJSON()};return i=null,r}},undo:function(t,e,n,i){t.set(e)},redo:function(t,e,n,i){t.set(n)}};return["style","attributes","content","src"].forEach(function(t){return e.addUndoType("change:"+t,l)}),e.on("undo redo",function(){return t.trigger("component:toggled change:canvasOffset")}),["undo","redo"].forEach(function(n){return e.on(n,function(){return t.trigger(n)})}),this},getConfig:function(){return n},add:function(t){return e.register(t),this},remove:function(t){return e.unregister(t),this},removeAll:function(){return e.unregisterAll(),this},start:function(){return e.startTracking(),this},stop:function(){return e.stopTracking(),this},undo:function(){return!t.isEditing()&&e.undo(1),this},undoAll:function(){return e.undoAll(),this},redo:function(){return!t.isEditing()&&e.redo(1),this},redoAll:function(){return e.redoAll(),this},hasUndo:function(){return e.isAvailable("undo")},hasRedo:function(){return e.isAvailable("redo")},getStack:function(){return e.stack},clear:function(){return e.clear(),this},getInstance:function(){return e}}}},function(t,e,n){var i,r,o;
+/*! grapesjs - 0.14.64 */
+!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.grapesjs=e():t.grapesjs=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=85)}([function(t,e,n){(function(i){var r,o,s;s="object"==typeof self&&self.self===self&&self||"object"==typeof i&&i.global===i&&i,r=[n(1),n(11),e],void 0===(o=function(t,e,n){s.Backbone=function(t,e,n,i){var r=t.Backbone,o=Array.prototype.slice;e.VERSION="1.3.3",e.$=i,e.noConflict=function(){return t.Backbone=r,this},e.emulateHTTP=!1,e.emulateJSON=!1;var s=function(t,e,i){n.each(e,function(e,r){n[r]&&(t.prototype[r]=function(t,e,i){switch(t){case 1:return function(){return n[e](this[i])};case 2:return function(t){return n[e](this[i],t)};case 3:return function(t,r){return n[e](this[i],a(t,this),r)};case 4:return function(t,r,o){return n[e](this[i],a(t,this),r,o)};default:return function(){var t=o.call(arguments);return t.unshift(this[i]),n[e].apply(n,t)}}}(e,r,i))})},a=function(t,e){return n.isFunction(t)?t:n.isObject(t)&&!e._isModel(t)?l(t):n.isString(t)?function(e){return e.get(t)}:t},l=function(t){var e=n.matches(t);return function(t){return e(t.attributes)}},c=e.Events={},u=/\s+/,h=function(t,e,i,r,o){var s,a=0;if(i&&"object"==typeof i){void 0!==r&&"context"in o&&void 0===o.context&&(o.context=r);for(s=n.keys(i);athis.length&&(r=this.length),r<0&&(r+=this.length+1);var o,s,a=[],l=[],c=[],u=[],h={},d=e.add,f=e.merge,p=e.remove,g=!1,v=this.comparator&&null==r&&!1!==e.sort,m=n.isString(this.comparator)?this.comparator:null;for(s=0;s7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(D,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var i=document.body,r=i.insertBefore(this.iframe,i.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash="#"+this.fragment}var o=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState?o("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?o("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};this._usePushState?t("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&t("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),L.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe&&(e=this.getHash(this.iframe.contentWindow)),e===this.fragment)return!1;this.iframe&&this.navigate(e),this.loadUrl()},loadUrl:function(t){return!!this.matchRoot()&&(t=this.fragment=this.getFragment(t),n.some(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0}))},navigate:function(t,e){if(!L.started)return!1;e&&!0!==e||(e={trigger:!!e}),t=this.getFragment(t||"");var n=this.root;""!==t&&"?"!==t.charAt(0)||(n=n.slice(0,-1)||"/");var i=n+t;if(t=this.decodeFragment(t.replace(I,"")),this.fragment!==t){if(this.fragment=t,this._usePushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);if(this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var r=this.iframe.contentWindow;e.replace||(r.document.open(),r.document.close()),this._updateHash(r.location,t,e.replace)}}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,n){if(n){var i=t.href.replace(/(javascript:|#).*$/,"");t.replace(i+"#"+e)}else t.hash="#"+e}}),e.history=new L,y.extend=b.extend=M.extend=k.extend=L.extend=function(t,e){var i,r=this;return i=t&&n.has(t,"constructor")?t.constructor:function(){return r.apply(this,arguments)},n.extend(i,r,e),i.prototype=n.create(r.prototype,t),i.prototype.constructor=i,i.__super__=r.prototype,i};var F=function(){throw new Error('A "url" property or function must be specified')},j=function(t,e){var n=e.error;e.error=function(i){n&&n.call(e.context,t,i,e),t.trigger("error",t,i,e)}};return e}(s,n,t,e)}.apply(e,r))||(t.exports=o)}).call(this,n(8))},function(t,e,n){(function(t,n){var i;!function(){var r="object"==typeof self&&self.self===self&&self||"object"==typeof t&&t.global===t&&t||this||{},o=r._,s=Array.prototype,a=Object.prototype,l="undefined"!=typeof Symbol?Symbol.prototype:null,c=s.push,u=s.slice,h=a.toString,d=a.hasOwnProperty,f=Array.isArray,p=Object.keys,g=Object.create,v=function(){},m=function(t){return t instanceof m?t:this instanceof m?void(this._wrapped=t):new m(t)};e.nodeType?r._=m:(!n.nodeType&&n.exports&&(e=n.exports=m),e._=m),m.VERSION="1.9.1";var y,b=function(t,e,n){if(void 0===e)return t;switch(null==n?3:n){case 1:return function(n){return t.call(e,n)};case 3:return function(n,i,r){return t.call(e,n,i,r)};case 4:return function(n,i,r,o){return t.call(e,n,i,r,o)}}return function(){return t.apply(e,arguments)}},x=function(t,e,n){return m.iteratee!==y?m.iteratee(t,e):null==t?m.identity:m.isFunction(t)?b(t,e,n):m.isObject(t)&&!m.isArray(t)?m.matcher(t):m.property(t)};m.iteratee=y=function(t,e){return x(t,e,1/0)};var w=function(t,e){return e=null==e?t.length-1:+e,function(){for(var n=Math.max(arguments.length-e,0),i=Array(n),r=0;r=0&&e<=E};m.each=m.forEach=function(t,e,n){var i,r;if(e=b(e,n),A(t))for(i=0,r=t.length;i=3;return function(e,n,i,r){var o=!A(e)&&m.keys(e),s=(o||e).length,a=t>0?0:s-1;for(r||(i=e[o?o[a]:a],a+=t);a>=0&&a=0},m.invoke=w(function(t,e,n){var i,r;return m.isFunction(e)?r=e:m.isArray(e)&&(i=e.slice(0,-1),e=e[e.length-1]),m.map(t,function(t){var o=r;if(!o){if(i&&i.length&&(t=T(t,i)),null==t)return;o=t[e]}return null==o?o:o.apply(t,n)})}),m.pluck=function(t,e){return m.map(t,m.property(e))},m.where=function(t,e){return m.filter(t,m.matcher(e))},m.findWhere=function(t,e){return m.find(t,m.matcher(e))},m.max=function(t,e,n){var i,r,o=-1/0,s=-1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t)for(var a=0,l=(t=A(t)?t:m.values(t)).length;ao&&(o=i);else e=x(e,n),m.each(t,function(t,n,i){((r=e(t,n,i))>s||r===-1/0&&o===-1/0)&&(o=t,s=r)});return o},m.min=function(t,e,n){var i,r,o=1/0,s=1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t)for(var a=0,l=(t=A(t)?t:m.values(t)).length;ai||void 0===n)return 1;if(n0?0:r-1;o>=0&&o0?s=o>=0?o:Math.max(o+a,s):a=o>=0?Math.min(o+1,a):o+a+1;else if(n&&o&&a)return i[o=n(i,r)]===r?o:-1;if(r!=r)return(o=e(u.call(i,s,a),m.isNaN))>=0?o+s:-1;for(o=t>0?s:a-1;o>=0&&oe?(i&&(clearTimeout(i),i=null),a=c,s=t.apply(r,o),i||(r=o=null)):i||!1===n.trailing||(i=setTimeout(l,u)),s};return c.cancel=function(){clearTimeout(i),a=0,i=r=o=null},c},m.debounce=function(t,e,n){var i,r,o=function(e,n){i=null,n&&(r=t.apply(e,n))},s=w(function(s){if(i&&clearTimeout(i),n){var a=!i;i=setTimeout(o,e),a&&(r=t.apply(this,s))}else i=m.delay(o,e,this,s);return r});return s.cancel=function(){clearTimeout(i),i=null},s},m.wrap=function(t,e){return m.partial(e,t)},m.negate=function(t){return function(){return!t.apply(this,arguments)}},m.compose=function(){var t=arguments,e=t.length-1;return function(){for(var n=e,i=t[e].apply(this,arguments);n--;)i=t[n].call(this,i);return i}},m.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},m.before=function(t,e){var n;return function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=null),n}},m.once=m.partial(m.before,2),m.restArguments=w;var F=!{toString:null}.propertyIsEnumerable("toString"),j=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],R=function(t,e){var n=j.length,i=t.constructor,r=m.isFunction(i)&&i.prototype||a,o="constructor";for(S(t,o)&&!m.contains(e,o)&&e.push(o);n--;)(o=j[n])in t&&t[o]!==r[o]&&!m.contains(e,o)&&e.push(o)};m.keys=function(t){if(!m.isObject(t))return[];if(p)return p(t);var e=[];for(var n in t)S(t,n)&&e.push(n);return F&&R(t,e),e},m.allKeys=function(t){if(!m.isObject(t))return[];var e=[];for(var n in t)e.push(n);return F&&R(t,e),e},m.values=function(t){for(var e=m.keys(t),n=e.length,i=Array(n),r=0;r1&&(i=b(i,e[1])),e=m.allKeys(t)):(i=$,e=L(e,!1,!1),t=Object(t));for(var r=0,o=e.length;r1&&(n=e[1])):(e=m.map(L(e,!1,!1),String),i=function(t,n){return!m.contains(e,n)}),m.pick(t,i,n)}),m.defaults=z(m.allKeys,!0),m.create=function(t,e){var n=C(t);return e&&m.extendOwn(n,e),n},m.clone=function(t){return m.isObject(t)?m.isArray(t)?t.slice():m.extend({},t):t},m.tap=function(t,e){return e(t),t},m.isMatch=function(t,e){var n=m.keys(e),i=n.length;if(null==t)return!i;for(var r=Object(t),o=0;o":">",'"':""","'":"'","`":"`"},U=m.invert(W),q=function(t){var e=function(e){return t[e]},n="(?:"+m.keys(t).join("|")+")",i=RegExp(n),r=RegExp(n,"g");return function(t){return t=null==t?"":""+t,i.test(t)?t.replace(r,e):t}};m.escape=q(W),m.unescape=q(U),m.result=function(t,e,n){m.isArray(e)||(e=[e]);var i=e.length;if(!i)return m.isFunction(n)?n.call(t):n;for(var r=0;r/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var G=/(.)^/,Y={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},X=/\\|'|\r|\n|\u2028|\u2029/g,J=function(t){return"\\"+Y[t]};m.template=function(t,e,n){!e&&n&&(e=n),e=m.defaults({},e,m.templateSettings);var i,r=RegExp([(e.escape||G).source,(e.interpolate||G).source,(e.evaluate||G).source].join("|")+"|$","g"),o=0,s="__p+='";t.replace(r,function(e,n,i,r,a){return s+=t.slice(o,a).replace(X,J),o=a+e.length,n?s+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":i?s+="'+\n((__t=("+i+"))==null?'':__t)+\n'":r&&(s+="';\n"+r+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{i=new Function(e.variable||"obj","_",s)}catch(t){throw t.source=s,t}var a=function(t){return i.call(this,t,m)},l=e.variable||"obj";return a.source="function("+l+"){\n"+s+"}",a},m.chain=function(t){var e=m(t);return e._chain=!0,e};var Z=function(t,e){return t._chain?m(e).chain():e};m.mixin=function(t){return m.each(m.functions(t),function(e){var n=m[e]=t[e];m.prototype[e]=function(){var t=[this._wrapped];return c.apply(t,arguments),Z(this,n.apply(m,t))}}),m},m.mixin(m),m.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=s[t];m.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0],Z(this,n)}}),m.each(["concat","join","slice"],function(t){var e=s[t];m.prototype[t]=function(){return Z(this,e.apply(this._wrapped,arguments))}}),m.prototype.value=function(){return this._wrapped},m.prototype.valueOf=m.prototype.toJSON=m.prototype.value,m.prototype.toString=function(){return String(this._wrapped)},void 0===(i=function(){return m}.apply(e,[]))||(n.exports=i)}()}).call(this,n(8),n(89)(t))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.capitalize=e.getUnitFromValue=e.getPointerEvent=e.normalizeFloat=e.shallowDiff=e.getElement=e.isEscKey=e.getKeyChar=e.getKeyCode=e.isTextNode=e.camelCase=e.getElRect=e.getModel=e.matches=e.upFirst=e.hasDnd=e.off=e.on=e.isTaggableNode=e.isCommentNode=void 0;var i=n(1),r=window.Element.prototype,o=r.matches||r.webkitMatchesSelector||r.mozMatchesSelector||r.msMatchesSelector,s=function(t){return t[0].toUpperCase()+t.toLowerCase().slice(1)},a=function(t){return t&&3===t.nodeType},l=e.isCommentNode=function(t){return t&&8===t.nodeType},c=(e.isTaggableNode=function(t){return t&&!a(t)&&!l(t)},function(t){return t.which||t.keyCode});e.on=function(t,e,n){e=e.split(/\s+/),t=t instanceof Array?t:[t];for(var i=function(i){t.forEach(function(t){return t.addEventListener(e[i],n)})},r=0;r=0?s!==a&&(n[o]=a):n[o]=null}for(var l in e)e.hasOwnProperty(l)&&(0,i.isUndefined)(t[l])&&(n[l]=e[l]);return n},e.normalizeFloat=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=0;if(isNaN(t))return n;if(t=parseFloat(t),Math.floor(t)!==t){var r=e.toString().split(".")[1];i=r?r.length:0}return i?parseFloat(t.toFixed(i)):t},e.getPointerEvent=function(t){return t.touches&&t.touches[0]?t.touches[0]:t},e.getUnitFromValue=function(t){return t.replace(parseFloat(t),"")},e.capitalize=function(t){return t.charAt(0).toUpperCase()+t.substring(1)}},function(t,e,n){"use strict";var i,r=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.em,s=this.parent(),a=s&&s.attributes;if(a&&a.propagate){var l={},c=a.propagate;c.forEach(function(t){return l[t]=s.get(t)}),l.propagate=c,l=r({},l,e),this.set(l)}var u=this.get("propagate");u&&this.set("propagate",(0,o.isArray)(u)?u:[u]),n&&n.config&&n.config.voidElements.indexOf(this.get("tagName"))>=0&&this.set("void",!0),n.em=i,this.opt=n,this.em=i,this.config=n.config||{},this.set("attributes",r({},this.defaults.attributes||{},this.get("attributes")||{})),this.ccid=v.createId(this),this.initClasses(),this.initTraits(),this.initComponents(),this.initToolbar(),this.listenTo(this,"change:script",this.scriptUpdated),this.listenTo(this,"change:tagName",this.tagUpdated),this.listenTo(this,"change:attributes",this.attrUpdated),this.set("status",""),["classes","traits","components"].forEach(function(e){var n="add remove "+("components"!==e?"change":"");t.listenTo(t.get(e),n.trim(),function(){for(var n=arguments.length,i=Array(n),r=0;r1&&void 0!==arguments[1]?arguments[1]:{},i=(t=r({},t)).class;i&&this.setClass(i),delete t.class;var a=t.style;a&&this.setStyle(a),delete t.style,this.set("attributes",t,n);var l=r({},this.previous("attributes")),c=(0,s.shallowDiff)(l,t);return(0,o.keys)(c).forEach(function(t){return e.trigger("change:attributes:"+t,e,c[t])}),this},addAttributes:function(t){var e=r({},this.getAttributes(),t);return this.setAttributes(e),this},getStyle:function(){var t=this.em;if(t&&t.getConfig("avoidInlineStyle")){var e=this.get("state"),n=t.get("CssComposer").getIdRule(this.getId(),{state:e});if(this.rule=n,n)return n.getStyle()}return l.default.getStyle.call(this)},setStyle:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.em,a=this.opt;if(i&&i.getConfig("avoidInlineStyle")&&!a.temporary){e=(0,o.isString)(e)?this.parseStyle(e):e,e=r({},e,this.get("style"));var c=this.get("state"),u=i.get("CssComposer"),h=this.getStyle();this.rule=u.setIdRule(this.getId(),e,r({},n,{state:c}));var d=(0,s.shallowDiff)(h,e);this.set("style",{},{silent:1}),(0,o.keys)(d).forEach(function(e){return t.trigger("change:style:"+e)})}else e=l.default.setStyle.apply(this,arguments);return e},getAttributes:function(){var t=this.em,e=[],n=r({},this.get("attributes")),i=t&&t.get("SelectorManager"),s=this.getId();if(this.get("classes").forEach(function(t){return e.push((0,o.isString)(t)?t:t.get("name"))}),e.length&&(n.class=e.join(" ")),!(0,o.has)(n,"id")){var a=void 0;!function(t){return t&&t.getConfig("avoidInlineStyle")}(t)?(0,o.isEmpty)(this.getStyle())||(a=1):a=i&&i.get(s,i.Selector.TYPE_ID),a&&(n.id=this.getId())}return n},addClass:function(t){var e=this.em.get("SelectorManager").addClass(t);return this.get("classes").add(e)},setClass:function(t){return this.get("classes").reset(),this.addClass(t)},removeClass:function(t){var e=[];t=(0,o.isArray)(t)?t:[t];var n=this.get("classes"),i=d.TYPE_CLASS;return t.forEach(function(t){t.split(" ").forEach(function(t){var r=n.where({name:t,type:i})[0];r&&e.push(n.remove(r))})}),e},getClasses:function(){var t=this.getAttributes().class;return t?t.split(" "):[]},initClasses:function(){var t=[this,"change:classes",this.initClasses],e=this.get("classes")||[],n=(0,o.isString)(e)?e.split(" "):e;this.stopListening.apply(this,t);var i=this.normalizeClasses(n),r=new f([]);return this.set("classes",r),r.add(i),this.listenTo.apply(this,t),this},initComponents:function(){var t=[this,"change:components",this.initComponents];this.stopListening.apply(this,t);var e=new h(null,this.opt);e.parent=this;var n=this.get("components"),i=!this.opt.avoidChildren;return this.set("components",e),i&&e.add((0,o.isFunction)(n)?n(this):n),this.listenTo.apply(this,t),this},initTraits:function(t){var e=this.em,n=[this,"change:traits",this.initTraits];this.stopListening.apply(this,n),this.loadTraits();var i=r({},this.get("attributes")),o=this.get("traits");return o.each(function(t){if(!t.get("changeProp")){var e=t.get("name"),n=t.getInitValue();e&&n&&(i[e]=n)}}),o.length&&this.set("attributes",i),this.listenTo.apply(this,n),t&&e&&e.trigger("component:toggled"),this},append:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.components().add(t,e);return(0,o.isArray)(n)?n:[n]},components:function(t){var e=this.get("components");return(0,o.isUndefined)(t)?e:(e.reset(),t&&this.append(t))},parent:function(){var t=this.collection;return t&&t.parent},scriptUpdated:function(){this.set("scriptUpdated",1)},initToolbar:function(){var t=this.em,e=t&&t.getConfig("stylePrefix")||"";if(!this.get("toolbar")){var n=[];this.collection&&n.push({attributes:{class:"fa fa-arrow-up"},command:function(t){return t.runCommand("core:component-exit",{force:1})}}),this.get("draggable")&&n.push({attributes:{class:"fa fa-arrows "+e+"no-touch-actions",draggable:!0},command:"tlb-move"}),this.get("copyable")&&n.push({attributes:{class:"fa fa-clone"},command:"tlb-clone"}),this.get("removable")&&n.push({attributes:{class:"fa fa-trash-o"},command:"tlb-delete"}),this.set("toolbar",n)}},loadTraits:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!((t=t||this.get("traits"))instanceof p)){var n=new p([],this.opt);n.setTarget(this),t.length&&(t.forEach(function(t){return t.attributes&&delete t.attributes.value}),n.add(t)),this.set("traits",n,e)}return this},getTrait:function(t){return this.get("traits").filter(function(e){return e.get("id")===t||e.get("name")===t})[0]},updateTrait:function(t,e){var n=this.em,i=this.getTrait(t);return i&&i.set(e),n&&n.trigger("component:toggled"),this},getTraitIndex:function(t){var e=this.getTrait(t);return e?this.get("traits").indexOf(e):e},removeTrait:function(t){var e=this,n=this.em,i=((0,o.isArray)(t)?t:[t]).map(function(t){return e.getTrait(t)}),r=this.get("traits").remove(i);return n&&n.trigger("component:toggled"),r},addTrait:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.em,i=this.get("traits").add(t,e);return n&&n.trigger("component:toggled"),i},normalizeClasses:function(t){var e=[],n=this.em;if(n){var i=n.get("SelectorManager");if(i)return t.forEach(function(t){var n="";n="string"==typeof t?t:t.name;var r=i.add(n);e.push(r)}),e}},clone:function(){var t=this.em,e=this.getStyle(),n=r({},this.attributes),i=r({},this.opt);n.attributes=r({},n.attributes),delete n.attributes.id,n.components=[],n.classes=[],n.traits=[],this.get("components").each(function(t,e){n.components[e]=t.clone()}),this.get("traits").each(function(t,e){n.traits[e]=t.clone()}),this.get("classes").each(function(t,e){n.classes[e]=t.get("name")}),n.status="",n.view="",i.collection=null,t&&t.getConfig("avoidInlineStyle")&&!(0,o.isEmpty)(e)&&(n.style=e);var s=new this.constructor(n,i);return t&&t.trigger("component:clone",s),this.trigger("component:clone",s),s},getName:function(){var t=this.get("name")||this.get("custom-name"),e=this.get("tagName");e="div"==e?"box":e;var n=this.get("type")||e;return n=n.charAt(0).toUpperCase()+n.slice(1),t||n},getIcon:function(){var t=this.get("icon");return t?t+" ":""},toHTML:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=[],n=this.get("tagName"),i=this.get("void"),r=t.attributes,s=this.getAttrToHTML();for(var a in r&&((0,o.isFunction)(r)?s=r(this,s)||{}:(0,o.isObject)(r)&&(s=r)),s){var l=s[a],c=(0,o.isString)(l)?l.replace(/"/g,"""):l;(0,o.isUndefined)(c)||((0,o.isBoolean)(c)?c&&e.push(a):e.push(a+'="'+c+'"'))}var u="<"+n+(e.length?" "+e.join(" "):"")+(i?"/":"")+">"+this.get("content");return this.get("components").each(function(e){return u+=e.toHTML(t)}),!i&&(u+=""+n+">"),u},getAttrToHTML:function(){var t=this.getAttributes();return delete t.style,t},toJSON:function(){for(var t=arguments.length,e=Array(t),n=0;n1?i-1:0),o=1;o0&&void 0!==arguments[0]&&arguments[0];var t=this.em,e=this.getId();if(e){var n=v.createId(this);this.setId(n);var i=t&&t.get("CssComposer").getIdRule(e),r=i&&i.get("selectors").at(0);return r&&r.set("name",n),this}}},{isComponent:function(t){return{tagName:t.tagName?t.tagName.toLowerCase():""}},createId:function(t){var e=v.getList(t),n=t.get("attributes").id,i=void 0;return n?(i=v.getIncrementId(n,e),t.setId(i)):i=v.getNewId(e),e[i]=t,i},getNewId:function(t){for(var e=Object.keys(t).length.toString().length+2,n="i"+(Math.random()+1.1).toString(36).slice(-e);t[n];)n=v.getNewId(t);return n},getIncrementId:function(t,e){for(var n=1,i=t;e[i];)i=t+"-"+ ++n;return i},getList:function(t){var e=t.opt&&t.opt.domc;return e?e.componentsById:{}},checkId:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};((0,o.isArray)(t)?t:[t]).forEach(function(t){var i=t.attributes,r=void 0===i?{}:i,s=t.components,a=r.id;if(a&&n[a]){var l=v.getIncrementId(a,n);r.id=l,(0,o.isArray)(e)&&e.forEach(function(t){var e=t.selectors;e.forEach(function(t,n){t==="#"+a&&(e[n]="#"+l)})})}s&&v.checkId(s,e,n)})}});t.exports=v},function(t,e,n){"use strict";var i,r=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{},e=this.model,n=t.config||{},i=n.em,o=e.opt||{},s=this.$el,a=n.draggableComponents;this.opts=t,this.modelOpt=o,this.config=n,this.em=i||"",this.pfx=n.stylePrefix||"",this.ppfx=n.pStylePrefix||"",this.attr=e.get("attributes"),this.classe=this.attr.class||[],this.listenTo(e,"change:style",this.updateStyle),this.listenTo(e,"change:attributes",this.renderAttributes),this.listenTo(e,"change:highlightable",this.updateHighlight),this.listenTo(e,"change:status",this.updateStatus),this.listenTo(e,"change:state",this.updateState),this.listenTo(e,"change:script",this.render),this.listenTo(e,"change:content",this.updateContent),this.listenTo(e,"change",this.handleChange),this.listenTo(e,"active",this.onActive),s.data("model",e),e.view=this,this.initClasses(),this.initComponents({avoidRender:1}),this.events=r({},this.events,a&&{dragstart:"handleDragStart"}),this.delegateEvents(),!o.temporary&&this.init()},init:function(){},onActive:function(){},handleDragStart:function(t){t.preventDefault(),t.stopPropagation(),this.em.get("Commands").run("tlb-move",{target:this.model,event:t})},initClasses:function(){var t=this.model,e=t.get("classes");e instanceof u&&(this.stopListening(t,"change:classes",this.initClasses),this.listenTo(t,"change:classes",this.initClasses),this.listenTo(e,"add remove change",this.updateClasses),e.length&&this.importClasses())},initComponents:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.model,n=this.$el,i=this.childrenView,r=e.get("components"),o=[e,"change:components",this.initComponents];r instanceof l&&(n.data("collection",r),i&&i.remove(),this.stopListening.apply(this,o),!t.avoidRender&&this.renderChildren(),this.listenTo.apply(this,o))},handleChange:function(){var t=this.model;for(var e in t.emitUpdate(),t.changed)t.emitUpdate(e)},importClasses:function(){var t=this.config.em.get("SelectorManager");t&&this.model.get("classes").each(function(e){t.add(e.get("name"))})},updateState:function(t){var e="hc-state";this.model.get("state")?this.$el.addClass(e):this.$el.removeClass(e)},updateStatus:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(this.em,this.el),n=this.model.get("status"),i=this.pfx,r=this.ppfx,o=i+"selected",s=o+"-parent",a=r+"freezed",l=r+"hovered",c=[o,s,a,l];this.$el.removeClass(c.join(" "));var u=e.getAttribute("class")||"",h="";switch(n){case"selected":h=u+" "+o;break;case"selected-parent":h=u+" "+s;break;case"freezed":h=u+" "+a;break;case"freezed-selected":h=u+" "+a+" "+o;break;case"hovered":h=t.avoidHover?"":u+" "+l}(h=h.trim())&&e.setAttribute("class",h)},updateHighlight:function(){var t=this.model.get("highlightable");this.setAttribute("data-highlightable",t?1:"")},updateStyle:function(){var t=this.em,e=this.model;if(t&&t.get("avoidInlineStyle")){this.el.id=e.getId();var n=e.getStyle();!(0,a.isEmpty)(n)&&e.setStyle(n)}else this.setAttribute("style",e.styleToString())},updateClasses:function(){var t=this.model.get("classes").pluck("name").join(" ");this.setAttribute("class",t),this.updateStatus()},setAttribute:function(t,e){var n=this.$el;e?n.attr(t,e):n.removeAttr(t)},getClasses:function(){return this.model.getClasses().join(" ")},updateAttributes:function(){var t=[],e=this.model,n=this.$el,i=this.el,o=this.config,s=e.attributes,l=s.highlightable,c=s.textable,u=s.type,h=o.draggableComponents,d=r({"data-gjs-type":u||"default"},h&&{draggable:!0},l&&{"data-highlightable":1},c&&{contenteditable:"false","data-gjs-textable":"true"});(0,a.each)(i.attributes,function(e){return t.push(e.nodeName)}),t.forEach(function(t){return n.removeAttr(t)});var f=r({},d,e.getAttributes());(0,a.keys)(f).forEach(function(t){return!1===f[t]&&delete f[t]}),n.attr(f),this.updateStyle()},updateContent:function(){this.getChildrenContainer().innerHTML=this.model.get("content")},prevDef:function(t){t.preventDefault()},updateScript:function(){var t=this.model,e=this.em;t.get("script")&&e&&e.get("Canvas").getCanvasView().updateScript(this)},getChildrenContainer:function(){var t=this.el;return"function"==typeof this.getChildrenSelector?t=this.el.querySelector(this.getChildrenSelector()):this.getTemplate,t},renderChildren:function(){this.updateContent();var t=this.getChildrenContainer(),e=new c({collection:this.model.get("components"),config:this.config,componentTypes:this.opts.componentTypes});e.render(t),this.childrenView=e;for(var n=Array.prototype.slice.call(e.el.childNodes),i=0,r=n.length;i\n '+this.templateLabel(t)+'\n \n
\n '+this.templateInput(t)+"\n
\n "},templateLabel:function(t){var e=this.pfx,n=t.get("icon"),i=t.get("info"),r=t.parent;return'\n
\n '+t.get("name")+"\n \n "+(r?"":'
⨯')+"\n "},templateInput:function(t){return'\n
\n \n
\n '},events:function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}({change:"inputValueChanged"},"click [data-clear-style]","clear"),initialize:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,s.bindAll)(this,"targetUpdated"),this.config=e.config||{};var n=this.config.em;this.em=n,this.pfx=this.config.stylePrefix||"",this.ppfx=this.config.pStylePrefix||"",this.target=e.target||{},this.propTarget=e.propTarget||{},this.onChange=e.onChange,this.onInputRender=e.onInputRender||{},this.customValue=e.customValue||{};var i=this.model;this.property=i.get("property"),this.input=null;var r=this.pfx;this.inputHolderId="#"+r+"input-holder",this.sector=i.collection&&i.collection.sector,i.view=this,i.get("value")||i.set("value",i.getDefaultValue()),n&&n.on("update:component:style:"+this.property,this.targetUpdated);var o=i.get("requires");o&&Object.keys(o).forEach(function(e){n&&n.on("component:styleUpdate:"+e,t.targetUpdated)}),this.listenTo(this.propTarget,"update styleManager:update",this.targetUpdated),this.listenTo(i,"destroy remove",this.remove),this.listenTo(i,"change:value",this.modelValueChanged),this.listenTo(i,"targetUpdated",this.targetUpdated),this.listenTo(i,"change:visible",this.updateVisibility),this.listenTo(i,"change:status",this.updateStatus);var a=this.init&&this.init.bind(this);a&&a()},updateStatus:function(){var t=this.model,e=t.get("status"),n=t.parent,i=this.pfx,r=this.ppfx,o=this.config,s=r+"four-color",a=r+"color-warn",l=this.$el.children("."+i+"label"),c=this.getClearEl(),u=c?c.style:{};switch(l.removeClass(s+" "+a),u.display="none",e){case"updated":!n&&l.addClass(s),o.clearProperties&&(u.display="inline");break;case"computed":l.addClass(a)}},clear:function(t){var e=this;t&&t.stopPropagation(),this.model.clearValue(),setTimeout(function(){return e.targetUpdated()})},getClearEl:function(){return this.clearEl||(this.clearEl=this.el.querySelector("[data-clear-style]")),this.clearEl},getTarget:function(){return this.getTargetModel()},getTargetModel:function(){return this.propTarget&&this.propTarget.model},getHelperModel:function(){return this.propTarget&&this.propTarget.helper},inputValueChanged:function(t){t&&t.stopPropagation(),this.model.setValue(this.getInputValue(),1,{fromInput:1}),this.elementUpdated()},elementUpdated:function(){this.setStatus("updated")},setStatus:function(t){this.model.set("status",t);var e=this.model.parent;e&&t&&e.set("status",t)},emitUpdateTarget:(0,s.debounce)(function(){var t=this.config.em;t&&t.trigger("styleManager:update:target",this.getTarget())}),targetUpdated:function(){if(this.emitUpdateTarget(),this.checkVisibility()){var t=this.config,e=t.em,n=this.model,i=n.get("property"),r="",o="",s=this.getTargetValue({ignoreDefault:1}),a=n.getDefaultValue(),l=this.getComputedValue();s?(r=s,t.highlightChanged&&(o="updated")):l&&t.showComputed&&l!=a?(r=l,t.highlightComputed&&(o="computed")):(r=a,o=""),n.setValue(r,0,{fromTarget:1}),this.setStatus(o),e&&(e.trigger("styleManager:change",this,i,r),e.trigger("styleManager:change:"+i,this,r))}},checkVisibility:function(){var t=1;return this.config.hideNotStylable&&(this.isTargetStylable()&&this.isComponentStylable()?this.show():(this.hide(),t=0),this.sector&&this.sector.trigger("updateVisibility")),t},getTargetValue:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.model,i=this.getTargetModel(),r=this.customValue;if(!i)return t;if((t=i.getStyle()[n.get("property")])||e.ignoreDefault||(t=n.getDefaultValue()),"function"==typeof r&&!e.ignoreCustomValue){var o=r(this,n.collection.indexOf(n));o&&(t=o)}return t},getComputedValue:function(){var t=this.propTarget,e=t.computed||{},n=t.computedDefault||{},i=this.config.avoidComputed||[],r=this.model.get("property"),o=i.indexOf(r)<0,s=e[r],l=n[(0,a.camelCase)(r)];return e&&o&&l!==s&&s},getInputValue:function(){var t=this.getInputEl();return t?t.value:""},modelValueChanged:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this.config.em,r=this.model,o=r.getFullValue(),s=this.getTarget(),a=r.get("property"),l=this.onChange;if(n.fromInput||this.setValue(o),s&&this.isTargetStylable()&&this.isComponentStylable()){n.fromTarget||(l&&!n.fromParent?l(s,this,n):this.updateTargetStyle(o,null,n));var c=i&&i.getSelected();i&&c&&(i.trigger("component:update",c),i.trigger("component:styleUpdate",c,a),i.trigger("component:styleUpdate:"+a,c))}},updateTargetStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=e||this.model.get("property"),r=this.getTarget(),o=r.getStyle();t?o[i]=t:delete o[i],r.setStyle(o,n);var s=this.getHelperModel();s&&s.setStyle(o,n)},isTargetStylable:function(t){var e=t||this.getTarget(),n=this.model,i=n.get("id"),r=n.get("property"),o=n.get("toRequire"),a=e.get("unstylable"),l=e.get("stylable-require"),c=n.get("requires"),u=n.get("requiresParent"),h=this.sector?this.sector.collection:null,d=this.em?this.em.getSelected():null,f=e.get("stylable");if((0,s.isArray)(f)&&(f=f.indexOf(r)>=0),(0,s.isArray)(a)&&(f=a.indexOf(r)<0),o&&(f=!t||l&&(l.indexOf(i)>=0||l.indexOf(r)>=0)),h&&c){var p=Object.keys(c);h.each(function(t){t.get("properties").each(function(t){if((0,s.includes)(p,t.id)){var e=c[t.id];f=f&&(0,s.includes)(e,t.get("value"))}})})}if(u){var g=d&&d.parent(),v=g&&g.getEl();if(v){var m=window.getComputedStyle(v);(0,s.each)(u,function(t,e){f=f&&m[e]&&(0,s.includes)(t,m[e])})}else f=!1}return f},isComponentStylable:function(){var t=this.em,e=t&&t.getSelected();return!e||this.isTargetStylable(e)},setRawValue:function(t){this.setValue(this.model.parseValue(t))},setValue:function(t){var e=this.model,n=(0,s.isUndefined)(t)?e.getDefaultValue():t,i=this.getInputEl();i&&(i.value=n)},getInputEl:function(){return this.input||(this.input=this.el.querySelector("input")),this.input},updateVisibility:function(){this.el.style.display=this.model.get("visible")?"block":"none"},show:function(){this.model.set("visible",1)},hide:function(){this.model.set("visible",0)},cleanValue:function(){this.setValue("")},clearCached:function(){this.clearEl=null,this.input=null,this.$input=null},render:function(){this.clearCached();var t=this.pfx,e=this.model,n=this.el,i=e.get("property"),r=e.get("full"),o=t+"property";n.innerHTML=this.template(e),n.className=o+" "+t+e.get("type")+" "+o+"__"+i,n.className+=r?" "+o+"--full":"",this.updateStatus();var s=this.onRender&&this.onRender.bind(this);s&&s(),this.setValue(e.get("value"),{targetUpdate:1})}})},function(t,e,n){t.exports=function(){"use strict";var t=navigator.userAgent,e=navigator.platform,n=/gecko\/\d/i.test(t),i=/MSIE \d/.test(t),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),o=/Edge\/(\d+)/.exec(t),s=i||r||o,a=s&&(i?document.documentMode||6:+(o||r)[1]),l=!o&&/WebKit\//.test(t),c=l&&/Qt\/\d+\.\d+/.test(t),u=!o&&/Chrome\//.test(t),h=/Opera\//.test(t),d=/Apple Computer/.test(navigator.vendor),f=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),p=/PhantomJS/.test(t),g=!o&&/AppleWebKit/.test(t)&&/Mobile\/\w+/.test(t),v=/Android/.test(t),m=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),y=g||/Mac/.test(e),b=/\bCrOS\b/.test(t),x=/win/i.test(e),w=h&&t.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(h=!1,l=!0);var C=y&&(c||h&&(null==w||w<12.11)),k=n||s&&a>=9;function S(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var T,E=function(t,e){var n=t.className,i=S(e).exec(n);if(i){var r=n.slice(i.index+i[0].length);t.className=n.slice(0,i.index)+(r?i[1]+r:"")}};function M(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function A(t,e){return M(t).appendChild(e)}function O(t,e,n,i){var r=document.createElement(t);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var o=0;o
=e)return s+(e-o);s+=a-o,s+=n-s%n,o=a+1}}g?I=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:s&&(I=function(t){try{t.select()}catch(t){}});var z=function(){this.id=null};function H(t,e){for(var n=0;n=e)return i+Math.min(s,e-r);if(r+=o-i,i=o+1,(r+=n-r%n)>=e)return i}}var K=[""];function G(t){for(;K.length<=t;)K.push(Y(K)+" ");return K[t]}function Y(t){return t[t.length-1]}function X(t,e){for(var n=[],i=0;i""&&(t.toUpperCase()!=t.toLowerCase()||Q.test(t))}function et(t,e){return e?!!(e.source.indexOf("\\w")>-1&&tt(t))||e.test(t):tt(t)}function nt(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}var it=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function rt(t){return t.charCodeAt(0)>=768&&it.test(t)}function ot(t,e,n){for(;(n<0?e>0:en?-1:1;;){if(e==n)return e;var r=(e+n)/2,o=i<0?Math.ceil(r):Math.floor(r);if(o==e)return t(o)?e:n;t(o)?n=o:e=o+i}}var at=null;function lt(t,e,n){var i;at=null;for(var r=0;re)return r;o.to==e&&(o.from!=o.to&&"before"==n?i=r:at=r),o.from==e&&(o.from!=o.to&&"before"!=n?i=r:at=r)}return null!=i?i:at}var ct=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",e="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,r=/[LRr]/,o=/[Lb1n]/,s=/[1n]/;function a(t,e,n){this.level=t,this.from=e,this.to=n}return function(l,c){var u,h="ltr"==c?"L":"R";if(0==l.length||"ltr"==c&&!n.test(l))return!1;for(var d=l.length,f=[],p=0;p-1&&(i[e]=r.slice(0,o).concat(r.slice(o+1)))}}}function gt(t,e){var n=ft(t,e);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r0}function bt(t){t.prototype.on=function(t,e){dt(this,t,e)},t.prototype.off=function(t,e){pt(this,t,e)}}function xt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function wt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function Ct(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function kt(t){xt(t),wt(t)}function St(t){return t.target||t.srcElement}function Tt(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),y&&t.ctrlKey&&1==e&&(e=3),e}var Et,Mt,At=function(){if(s&&a<9)return!1;var t=O("div");return"draggable"in t||"dragDrop"in t}();function Ot(t){if(null==Et){var e=O("span","");A(t,O("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Et=e.offsetWidth<=1&&e.offsetHeight>2&&!(s&&a<8))}var n=Et?O("span",""):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Pt(t){if(null!=Mt)return Mt;var e=A(t,document.createTextNode("AخA")),n=T(e,0,1).getBoundingClientRect(),i=T(e,1,2).getBoundingClientRect();return M(t),!(!n||n.left==n.right)&&(Mt=i.right-n.right<3)}var _t,Lt=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],i=t.length;e<=i;){var r=t.indexOf("\n",e);-1==r&&(r=t.length);var o=t.slice(e,"\r"==t.charAt(r-1)?r-1:r),s=o.indexOf("\r");-1!=s?(n.push(o.slice(0,s)),e+=s+1):(n.push(o),e=r+1)}return n}:function(t){return t.split(/\r\n?|\n/)},Nt=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(t){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},Dt="oncopy"in(_t=O("div"))||(_t.setAttribute("oncopy","return;"),"function"==typeof _t.oncopy),It=null,Ft={},jt={};function Rt(t){if("string"==typeof t&&jt.hasOwnProperty(t))t=jt[t];else if(t&&"string"==typeof t.name&&jt.hasOwnProperty(t.name)){var e=jt[t.name];"string"==typeof e&&(e={name:e}),(t=Z(e,t)).name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Rt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Rt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function zt(t,e){e=Rt(e);var n=Ft[e.name];if(!n)return zt(t,"text/plain");var i=n(t,e);if(Ht.hasOwnProperty(e.name)){var r=Ht[e.name];for(var o in r)r.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=r[o])}if(i.name=e.name,e.helperType&&(i.helperType=e.helperType),e.modeProps)for(var s in e.modeProps)i[s]=e.modeProps[s];return i}var Ht={};function Vt(t,e){var n=Ht.hasOwnProperty(t)?Ht[t]:Ht[t]={};j(e,n)}function $t(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var n={};for(var i in e){var r=e[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function Bt(t,e){for(var n;t.innerMode&&(n=t.innerMode(e))&&n.mode!=t;)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Wt(t,e,n){return!t.startState||t.startState(e,n)}var Ut=function(t,e,n){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function qt(t,e){if((e-=t.first)<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(e=t.first&&en?te(n,qt(t,n).text.length):function(t,e){var n=t.ch;return null==n||n>e?te(t.line,e):n<0?te(t.line,0):t}(e,qt(t,e.line).text.length)}function le(t,e){for(var n=[],i=0;i=this.string.length},Ut.prototype.sol=function(){return this.pos==this.lineStart},Ut.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ut.prototype.next=function(){if(this.pose},Ut.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Ut.prototype.skipToEnd=function(){this.pos=this.string.length},Ut.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},Ut.prototype.backUp=function(t){this.pos-=t},Ut.prototype.column=function(){return this.lastColumnPos0?null:(i&&!1!==e&&(this.pos+=i[0].length),i)}var r=function(t){return n?t.toLowerCase():t},o=this.string.substr(this.pos,t.length);if(r(o)==r(t))return!1!==e&&(this.pos+=t.length),!0},Ut.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ut.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},Ut.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},Ut.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var ce=function(t,e){this.state=t,this.lookAhead=e},ue=function(t,e,n,i){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function he(t,e,n,i){var r=[t.state.modeGen],o={};xe(t,e.text,t.doc.mode,n,function(t,e){return r.push(t,e)},o,i);for(var s=n.state,a=function(i){n.baseTokens=r;var a=t.state.overlays[i],l=1,c=0;n.state=!0,xe(t,e.text,a.mode,n,function(t,e){for(var n=l;ct&&r.splice(l,1,t,r[l+1],i),l+=2,c=Math.min(t,i)}if(e)if(a.opaque)r.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;nt.options.maxHighlightLength&&$t(t.doc.mode,i.state),o=he(t,e,i);r&&(i.state=r),e.stateAfter=i.save(!r),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function fe(t,e,n){var i=t.doc,r=t.display;if(!i.mode.startState)return new ue(i,!0,e);var o=function(t,e,n){for(var i,r,o=t.doc,s=n?-1:e-(t.doc.mode.innerMode?1e3:100),a=e;a>s;--a){if(a<=o.first)return o.first;var l=qt(o,a-1),c=l.stateAfter;if(c&&(!n||a+(c instanceof ce?c.lookAhead:0)<=o.modeFrontier))return a;var u=R(l.text,null,t.options.tabSize);(null==r||i>u)&&(r=a-1,i=u)}return r}(t,e,n),s=o>i.first&&qt(i,o-1).stateAfter,a=s?ue.fromSaved(i,s,o):new ue(i,Wt(i.mode),o);return i.iter(o,e,function(n){pe(t,n.text,a);var i=a.line;n.stateAfter=i==e-1||i%5==0||i>=r.viewFrom&&ie.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}ue.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},ue.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var e=this.baseTokens[this.baseTokenPos+1];return{type:e&&e.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},ue.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ue.fromSaved=function(t,e,n){return e instanceof ce?new ue(t,$t(t.mode,e.state),n,e.lookAhead):new ue(t,$t(t.mode,e),n)},ue.prototype.save=function(t){var e=!1!==t?$t(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ce(e,this.maxLookAhead):e};var me=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n};function ye(t,e,n,i){var r,o=t.doc,s=o.mode;e=ae(o,e);var a,l=qt(o,e.line),c=fe(t,e.line,n),u=new Ut(l.text,t.options.tabSize,c);for(i&&(a=[]);(i||u.post.options.maxHighlightLength?(a=!1,s&&pe(t,e,i,h.pos),h.pos=e.length,l=null):l=be(ve(n,h,i.state,d),o),d){var f=d[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!a||u!=l){for(;c=e:o.to>e);(i||(i=[])).push(new ke(s,o.from,l?null:o.to))}}return i}(n,r,s),l=function(t,e,n){var i;if(t)for(var r=0;r=e:o.to>e);if(a||o.from==e&&"bookmark"==s.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(s.inclusiveLeft?o.from<=e:o.from0&&a)for(var x=0;xe)&&(!n||Le(n,o.marker)<0)&&(n=o.marker)}return n}function je(t,e,n,i,r){var o=qt(t,e),s=Ce&&o.markedSpans;if(s)for(var a=0;a=0&&h<=0||u<=0&&h>=0)&&(u<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ee(c.to,n)>=0:ee(c.to,n)>0)||u>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ee(c.from,i)<=0:ee(c.from,i)<0)))return!0}}}function Re(t){for(var e;e=De(t);)t=e.find(-1,!0).line;return t}function ze(t,e){var n=qt(t,e),i=Re(n);return n==i?e:Xt(i)}function He(t,e){if(e>t.lastLine())return e;var n,i=qt(t,e);if(!Ve(t,i))return e;for(;n=Ie(i);)i=n.find(1,!0).line;return Xt(i)+1}function Ve(t,e){var n=Ce&&e.markedSpans;if(n)for(var i=void 0,r=0;re.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)})}var qe=function(t,e,n){this.text=t,Oe(this,e),this.height=n?n(this):1};function Ke(t){t.parent=null,Ae(t)}qe.prototype.lineNo=function(){return Xt(this)},bt(qe);var Ge={},Ye={};function Xe(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?Ye:Ge;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function Je(t,e){var n=P("span",null,null,l?"padding-right: .1px":null),i={pre:P("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};e.measure={};for(var r=0;r<=(e.rest?e.rest.length:0);r++){var o=r?e.rest[r-1]:e.line,s=void 0;i.pos=0,i.addToken=Qe,Pt(t.display.measure)&&(s=ut(o,t.doc.direction))&&(i.addToken=tn(i.addToken,s)),i.map=[];var a=e!=t.display.externalMeasured&&Xt(o);nn(o,i,de(t,o,a)),o.styleClasses&&(o.styleClasses.bgClass&&(i.bgClass=D(o.styleClasses.bgClass,i.bgClass||"")),o.styleClasses.textClass&&(i.textClass=D(o.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(Ot(t.display.measure))),0==r?(e.measure.map=i.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(i.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(l){var c=i.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return gt(t,"renderLine",t,e.line,i.pre),i.pre.className&&(i.textClass=D(i.pre.className,i.textClass||"")),i}function Ze(t){var e=O("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function Qe(t,e,n,i,r,o,l){if(e){var c,u=t.splitSpaces?function(t,e){if(t.length>1&&!/ /.test(t))return t;for(var n=e,i="",r=0;rc&&h.from<=c);d++);if(h.to>=u)return t(n,i,r,o,s,a,l);t(n,i.slice(0,h.to-c),r,o,null,a,l),o=null,i=i.slice(h.to-c),c=h.to}}}function en(t,e,n,i){var r=!i&&n.widgetNode;r&&t.map.push(t.pos,t.pos+e,r),!i&&t.cm.display.input.needsContentAttribute&&(r||(r=t.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(t.cm.display.input.setUneditable(r),t.content.appendChild(r)),t.pos+=e,t.trailingSpace=!1}function nn(t,e,n){var i=t.markedSpans,r=t.text,o=0;if(i)for(var s,a,l,c,u,h,d,f=r.length,p=0,g=1,v="",m=0;;){if(m==p){l=c=u=a="",d=null,h=null,m=1/0;for(var y=[],b=void 0,x=0;xp||C.collapsed&&w.to==p&&w.from==p)){if(null!=w.to&&w.to!=p&&m>w.to&&(m=w.to,c=""),C.className&&(l+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&w.from==p&&(u+=" "+C.startStyle),C.endStyle&&w.to==m&&(b||(b=[])).push(C.endStyle,w.to),C.title&&((d||(d={})).title=C.title),C.attributes)for(var k in C.attributes)(d||(d={}))[k]=C.attributes[k];C.collapsed&&(!h||Le(h.marker,C)<0)&&(h=w)}else w.from>p&&m>w.from&&(m=w.from)}if(b)for(var S=0;S=f)break;for(var E=Math.min(f,m);;){if(v){var M=p+v.length;if(!h){var A=M>E?v.slice(0,E-p):v;e.addToken(e,A,s?s+l:l,u,p+A.length==m?c:"",a,d)}if(M>=E){v=v.slice(E-p),p=E;break}p=M,u=""}v=r.slice(o,o=n[g++]),s=Xe(n[g++],e.cm.options)}}else for(var O=1;On)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}function Pn(t,e,n,i){return Nn(t,Ln(t,e),n,i)}function _n(t,e){if(e>=t.display.viewFrom&&e=n.lineN&&e2&&o.push((l.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}(t,e.view,e.rect),e.hasHeights=!0),(o=function(t,e,n,i){var r,o=Fn(e.map,n,i),l=o.node,c=o.start,u=o.end,h=o.collapse;if(3==l.nodeType){for(var d=0;d<4;d++){for(;c&&rt(e.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u1}(t))return e;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*n,right:e.right*n,top:e.top*i,bottom:e.bottom*i}}(t.display.measure,r))}else{var f;c>0&&(h=i="right"),r=t.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==i?f.length-1:0]:l.getBoundingClientRect()}if(s&&a<9&&!c&&(!r||!r.left&&!r.right)){var p=l.parentNode.getClientRects()[0];r=p?{left:p.left,right:p.left+ni(t.display),top:p.top,bottom:p.bottom}:In}for(var g=r.top-e.rect.top,v=r.bottom-e.rect.top,m=(g+v)/2,y=e.view.measure.heights,b=0;be)&&(r=(o=l-a)-1,e>=l&&(s="right")),null!=r){if(i=t[c+2],a==l&&n==(i.insertLeft?"left":"right")&&(s=n),"left"==n&&0==r)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)i=t[2+(c-=3)],s="left";if("right"==n&&r==l-a)for(;c=0&&(n=t[r]).left==n.right;r--);return n}function Rn(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var e=0;e=i.text.length?(l=i.text.length,c="before"):l<=0&&(l=0,c="after"),!a)return s("before"==c?l-1:l,"before"==c);function u(t,e,n){var i=a[e],r=1==i.level;return s(n?t-1:t,r!=n)}var h=lt(a,l,c),d=at,f=u(l,h,"before"==c);return null!=d&&(f.other=u(l,d,"before"!=c)),f}function Gn(t,e){var n=0;e=ae(t.doc,e),t.options.lineWrapping||(n=ni(t.display)*e.ch);var i=qt(t.doc,e.line),r=Be(i)+kn(t.display);return{left:n,right:n,top:r,bottom:r+i.height}}function Yn(t,e,n,i,r){var o=te(t,e,n);return o.xRel=r,i&&(o.outside=!0),o}function Xn(t,e,n){var i=t.doc;if((n+=t.display.viewOffset)<0)return Yn(i.first,0,null,!0,-1);var r=Jt(i,n),o=i.first+i.size-1;if(r>o)return Yn(i.first+i.size-1,qt(i,o).text.length,null,!0,1);e<0&&(e=0);for(var s=qt(i,r);;){var a=ti(t,s,r,e,n),l=Fe(s,a.ch+(a.xRel>0?1:0));if(!l)return a;var c=l.find(1);if(c.line==r)return c;s=qt(i,r=c.line)}}function Jn(t,e,n,i){i-=Bn(e);var r=e.text.length,o=st(function(e){return Nn(t,n,e-1).bottom<=i},r,0);return r=st(function(e){return Nn(t,n,e).top>i},o,r),{begin:o,end:r}}function Zn(t,e,n,i){n||(n=Ln(t,e));var r=Wn(t,e,Nn(t,n,i),"line").top;return Jn(t,e,n,r)}function Qn(t,e,n,i){return!(t.bottom<=n)&&(t.top>n||(i?t.left:t.right)>e)}function ti(t,e,n,i,r){r-=Be(e);var o=Ln(t,e),s=Bn(e),a=0,l=e.text.length,c=!0,u=ut(e,t.doc.direction);if(u){var h=(t.options.lineWrapping?function(t,e,n,i,r,o,s){var a=Jn(t,e,i,s),l=a.begin,c=a.end;/\s/.test(e.text.charAt(c-1))&&c--;for(var u=null,h=null,d=0;d=c||f.to<=l)){var p=1!=f.level,g=Nn(t,i,p?Math.min(c,f.to)-1:Math.max(l,f.from)).right,v=gv)&&(u=f,h=v)}}return u||(u=r[r.length-1]),u.fromc&&(u={from:u.from,to:c,level:u.level}),u}:function(t,e,n,i,r,o,s){var a=st(function(a){var l=r[a],c=1!=l.level;return Qn(Kn(t,te(n,c?l.to:l.from,c?"before":"after"),"line",e,i),o,s,!0)},0,r.length-1),l=r[a];if(a>0){var c=1!=l.level,u=Kn(t,te(n,c?l.from:l.to,c?"after":"before"),"line",e,i);Qn(u,o,s,!0)&&u.top>s&&(l=r[a-1])}return l})(t,e,n,o,u,i,r);c=1!=h.level,a=c?h.from:h.to-1,l=c?h.to:h.from-1}var d,f,p=null,g=null,v=st(function(e){var n=Nn(t,o,e);return n.top+=s,n.bottom+=s,!!Qn(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(p=e,g=n),!0)},a,l),m=!1;if(g){var y=i-g.left=x.bottom}return v=ot(e.text,v,1),Yn(n,v,f,m,i-d)}function ei(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==Dn){Dn=O("pre");for(var e=0;e<49;++e)Dn.appendChild(document.createTextNode("x")),Dn.appendChild(O("br"));Dn.appendChild(document.createTextNode("x"))}A(t.measure,Dn);var n=Dn.offsetHeight/50;return n>3&&(t.cachedTextHeight=n),M(t.measure),n||1}function ni(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=O("span","xxxxxxxxxx"),n=O("pre",[e]);A(t.measure,n);var i=e.getBoundingClientRect(),r=(i.right-i.left)/10;return r>2&&(t.cachedCharWidth=r),r||10}function ii(t){for(var e=t.display,n={},i={},r=e.gutters.clientLeft,o=e.gutters.firstChild,s=0;o;o=o.nextSibling,++s){var a=t.display.gutterSpecs[s].className;n[a]=o.offsetLeft+o.clientLeft+r,i[a]=o.clientWidth}return{fixedPos:ri(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:e.wrapper.clientWidth}}function ri(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function oi(t){var e=ei(t.display),n=t.options.lineWrapping,i=n&&Math.max(5,t.display.scroller.clientWidth/ni(t.display)-3);return function(r){if(Ve(t.doc,r))return 0;var o=0;if(r.widgets)for(var s=0;s=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var n=t.display.view,i=0;ie)&&(r.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=r.viewTo)Ce&&ze(t.doc,e)r.viewFrom?hi(t):(r.viewFrom+=i,r.viewTo+=i);else if(e<=r.viewFrom&&n>=r.viewTo)hi(t);else if(e<=r.viewFrom){var o=di(t,n,n+i,1);o?(r.view=r.view.slice(o.index),r.viewFrom=o.lineN,r.viewTo+=i):hi(t)}else if(n>=r.viewTo){var s=di(t,e,e,-1);s?(r.view=r.view.slice(0,s.index),r.viewTo=s.lineN):hi(t)}else{var a=di(t,e,e,-1),l=di(t,n,n+i,1);a&&l?(r.view=r.view.slice(0,a.index).concat(on(t,a.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=i):hi(t)}var c=r.externalMeasured;c&&(n=r.lineN&&e=i.viewTo)){var o=i.view[li(t,e)];if(null!=o.node){var s=o.changes||(o.changes=[]);-1==H(s,n)&&s.push(n)}}}function hi(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function di(t,e,n,i){var r,o=li(t,e),s=t.display.view;if(!Ce||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var a=t.display.viewFrom,l=0;l0){if(o==s.length-1)return null;r=a+s[o].size-e,o++}else r=a-e;e+=r,n+=r}for(;ze(t.doc,n)!=n;){if(o==(i<0?0:s.length-1))return null;n+=i*s[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:n}}function fi(t){for(var e=t.display.view,n=0,i=0;i=t.display.viewTo||a.to().linee||e==n&&s.to==e)&&(i(Math.max(s.from,e),Math.min(s.to,n),1==s.level?"rtl":"ltr",o),r=!0)}r||i(e,n,"ltr")}(g,n||0,null==i?d:i,function(t,e,r,h){var v="ltr"==r,m=f(t,v?"left":"right"),y=f(e-1,v?"right":"left"),b=null==n&&0==t,x=null==i&&e==d,w=0==h,C=!g||h==g.length-1;if(y.top-m.top<=3){var k=(c?b:x)&&w,S=(c?x:b)&&C,T=k?a:(v?m:y).left,E=S?l:(v?y:m).right;u(T,m.top,E-T,m.bottom)}else{var M,A,O,P;v?(M=c&&b&&w?a:m.left,A=c?l:p(t,r,"before"),O=c?a:p(e,r,"after"),P=c&&x&&C?l:y.right):(M=c?p(t,r,"before"):a,A=!c&&b&&w?l:m.right,O=!c&&x&&C?a:y.left,P=c?p(e,r,"after"):l),u(M,m.top,A-M,m.bottom),m.bottom0?e.blinker=setInterval(function(){return e.cursorDiv.style.visibility=(n=!n)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function xi(t){t.state.focused||(t.display.input.focus(),Ci(t))}function wi(t){t.state.delayingBlurEvent=!0,setTimeout(function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,ki(t))},100)}function Ci(t,e){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(gt(t,"focus",t,e),t.state.focused=!0,N(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),l&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),bi(t))}function ki(t,e){t.state.delayingBlurEvent||(t.state.focused&&(gt(t,"blur",t,e),t.state.focused=!1,E(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function Si(t){for(var e=t.display,n=e.lineDiv.offsetTop,i=0;i.005||d<-.005)&&(Yt(r.line,l),Ti(r.line),r.rest))for(var f=0;ft.display.sizerWidth){var p=Math.ceil(c/ni(t.display));p>t.display.maxLineLength&&(t.display.maxLineLength=p,t.display.maxLine=r.line,t.display.maxLineChanged=!0)}}}}function Ti(t){if(t.widgets)for(var e=0;e=s&&(o=Jt(e,Be(qt(e,l))-t.wrapper.clientHeight),s=l)}return{from:o,to:Math.max(s,o+1)}}function Mi(t,e){var n=t.display,i=ei(t.display);e.top<0&&(e.top=0);var r=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,o=An(t),s={};e.bottom-e.top>o&&(e.bottom=e.top+o);var a=t.doc.height+Sn(n),l=e.topa-i;if(e.topr+o){var u=Math.min(e.top,(c?a:e.bottom)-o);u!=r&&(s.scrollTop=u)}var h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft,d=Mn(t)-(t.options.fixedGutter?n.gutters.offsetWidth:0),f=e.right-e.left>d;return f&&(e.right=e.left+d),e.left<10?s.scrollLeft=0:e.leftd+h-3&&(s.scrollLeft=e.right+(f?0:10)-d),s}function Ai(t,e){null!=e&&(_i(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function Oi(t){_i(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function Pi(t,e,n){null==e&&null==n||_i(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function _i(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;var n=Gn(t,e.from),i=Gn(t,e.to);Li(t,n,i,e.margin)}}function Li(t,e,n,i){var r=Mi(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-i,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+i});Pi(t,r.scrollLeft,r.scrollTop)}function Ni(t,e){Math.abs(t.doc.scrollTop-e)<2||(n||or(t,{top:e}),Di(t,e,!0),n&&or(t),tr(t,100))}function Di(t,e,n){e=Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function Ii(t,e,n,i){e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!i||(t.doc.scrollLeft=e,lr(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function Fi(t){var e=t.display,n=e.gutters.offsetWidth,i=Math.round(t.doc.height+Sn(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+En(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}var ji=function(t,e,n){this.cm=n;var i=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1,t(i),t(r),dt(i,"scroll",function(){i.clientHeight&&e(i.scrollTop,"vertical")}),dt(r,"scroll",function(){r.clientWidth&&e(r.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,s&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ji.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,i=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?i+"px":"0";var r=t.viewHeight-(e?i:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:e?i:0}},ji.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ji.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ji.prototype.zeroWidthHack=function(){var t=y&&!f?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new z,this.disableVert=new z},ji.prototype.enableZeroWidthBar=function(t,e,n){t.style.pointerEvents="auto",e.set(1e3,function i(){var r=t.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);o!=t?t.style.pointerEvents="none":e.set(1e3,i)})},ji.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var Ri=function(){};function zi(t,e){e||(e=Fi(t));var n=t.display.barWidth,i=t.display.barHeight;Hi(t,e);for(var r=0;r<4&&n!=t.display.barWidth||i!=t.display.barHeight;r++)n!=t.display.barWidth&&t.options.lineWrapping&&Si(t),Hi(t,Fi(t)),n=t.display.barWidth,i=t.display.barHeight}function Hi(t,e){var n=t.display,i=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}Ri.prototype.update=function(){return{bottom:0,right:0}},Ri.prototype.setScrollLeft=function(){},Ri.prototype.setScrollTop=function(){},Ri.prototype.clear=function(){};var Vi={native:ji,null:Ri};function $i(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&E(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new Vi[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),dt(e,"mousedown",function(){t.state.focused&&setTimeout(function(){return t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?Ii(t,e):Ni(t,e)},t),t.display.scrollbars.addClass&&N(t.display.wrapper,t.display.scrollbars.addClass)}var Bi=0;function Wi(t){var e;t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Bi},e=t.curOp,sn?sn.ops.push(e):e.ownsGroup=sn={ops:[e],delayedCallbacks:[]}}function Ui(t){var e=t.curOp;e&&function(t,e){var n=t.ownsGroup;if(n)try{!function(t){var e=t.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new nr(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function Ki(t){var e=t.cm,n=e.display;t.updatedDisplay&&Si(e),t.barMeasure=Fi(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=Pn(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+En(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-Mn(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function Gi(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft1&&(s=!0)),null!=c.scrollLeft&&(Ii(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-h)>1&&(s=!0)),!s)break}return r}(e,ae(i,t.scrollToPos.from),ae(i,t.scrollToPos.to),t.scrollToPos.margin);!function(t,e){if(!vt(t,"scrollCursorIntoView")){var n=t.display,i=n.sizer.getBoundingClientRect(),r=null;if(e.top+i.top<0?r=!0:e.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),null!=r&&!p){var o=O("div","",null,"position: absolute;\n top: "+(e.top-n.viewOffset-kn(t.display))+"px;\n height: "+(e.bottom-e.top+En(t)+n.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(r),t.display.lineSpace.removeChild(o)}}}(e,r)}var o=t.maybeHiddenMarkers,s=t.maybeUnhiddenMarkers;if(o)for(var a=0;a=t.display.viewTo)){var n=+new Date+t.options.workTime,i=fe(t,e.highlightFrontier),r=[];e.iter(i.line,Math.min(e.first+e.size,t.display.viewTo+500),function(o){if(i.line>=t.display.viewFrom){var s=o.styles,a=o.text.length>t.options.maxHighlightLength?$t(e.mode,i.state):null,l=he(t,o,i,!0);a&&(i.state=a),o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var h=!s||s.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),d=0;!h&&dn)return tr(t,t.options.workDelay),!0}),e.highlightFrontier=i.line,e.modeFrontier=Math.max(e.modeFrontier,i.line),r.length&&Xi(t,function(){for(var e=0;e=n.viewFrom&&e.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==fi(t))return!1;cr(t)&&(hi(t),e.dims=ii(t));var r=i.first+i.size,o=Math.max(e.visible.from-t.options.viewportMargin,i.first),s=Math.min(r,e.visible.to+t.options.viewportMargin);n.viewFroms&&n.viewTo-s<20&&(s=Math.min(r,n.viewTo)),Ce&&(o=ze(t.doc,o),s=He(t.doc,s));var a=o!=n.viewFrom||s!=n.viewTo||n.lastWrapHeight!=e.wrapperHeight||n.lastWrapWidth!=e.wrapperWidth;!function(t,e,n){var i=t.display;0==i.view.length||e>=i.viewTo||n<=i.viewFrom?(i.view=on(t,e,n),i.viewFrom=e):(i.viewFrom>e?i.view=on(t,e,i.viewFrom).concat(i.view):i.viewFromn&&(i.view=i.view.slice(0,li(t,n)))),i.viewTo=n}(t,o,s),n.viewOffset=Be(qt(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";var c=fi(t);if(!a&&0==c&&!e.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=function(t){if(t.hasFocus())return null;var e=L();if(!e||!_(t.display.lineDiv,e))return null;var n={activeElt:e};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&_(t.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}(t);return c>4&&(n.lineDiv.style.display="none"),function(t,e,n){var i=t.display,r=t.options.lineNumbers,o=i.lineDiv,s=o.firstChild;function a(e){var n=e.nextSibling;return l&&y&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var c=i.view,u=i.viewFrom,h=0;h-1&&(f=!1),un(t,d,u,n)),f&&(M(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(Qt(t.options,u)))),s=d.node.nextSibling}else{var p=mn(t,d,u,n);o.insertBefore(p,s)}u+=d.size}for(;s;)s=a(s)}(t,n.updateLineNumbers,e.dims),c>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(t){if(t&&t.activeElt&&t.activeElt!=L()&&(t.activeElt.focus(),t.anchorNode&&_(document.body,t.anchorNode)&&_(document.body,t.focusNode))){var e=window.getSelection(),n=document.createRange();n.setEnd(t.anchorNode,t.anchorOffset),n.collapse(!1),e.removeAllRanges(),e.addRange(n),e.extend(t.focusNode,t.focusOffset)}}(u),M(n.cursorDiv),M(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=e.wrapperHeight,n.lastWrapWidth=e.wrapperWidth,tr(t,400)),n.updateLineNumbers=null,!0}function rr(t,e){for(var n=e.viewport,i=!0;(i&&t.options.lineWrapping&&e.oldDisplayWidth!=Mn(t)||(n&&null!=n.top&&(n={top:Math.min(t.doc.height+Sn(t.display)-An(t),n.top)}),e.visible=Ei(t.display,t.doc,n),!(e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)))&&ir(t,e);i=!1){Si(t);var r=Fi(t);pi(t),zi(t,r),ar(t,r),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function or(t,e){var n=new nr(t,e);if(ir(t,n)){Si(t),rr(t,n);var i=Fi(t);pi(t),zi(t,i),ar(t,i),n.finish()}}function sr(t){var e=t.gutters.offsetWidth;t.sizer.style.marginLeft=e+"px"}function ar(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+En(t)+"px"}function lr(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var i=ri(e)-e.scroller.scrollLeft+t.doc.scrollLeft,r=e.gutters.offsetWidth,o=i+"px",s=0;sa.clientWidth,u=a.scrollHeight>a.clientHeight;if(r&&c||o&&u){if(o&&y&&l)t:for(var d=e.target,f=s.view;d!=a;d=d.parentNode)for(var p=0;p=0&&ee(t,i.to())<=0)return n}return-1};var xr=function(t,e){this.anchor=t,this.head=e};function wr(t,e,n){var i=t&&t.options.selectionsMayTouch,r=e[n];e.sort(function(t,e){return ee(t.from(),e.from())}),n=H(e,r);for(var o=1;o0:l>=0){var c=oe(a.from(),s.from()),u=re(a.to(),s.to()),h=a.empty()?s.from()==s.head:a.from()==a.head;o<=n&&--n,e.splice(--o,2,new xr(h?u:c,h?c:u))}}return new br(e,n)}function Cr(t,e){return new br([new xr(t,e||t)],0)}function kr(t){return t.text?te(t.from.line+t.text.length-1,Y(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function Sr(t,e){if(ee(t,e.from)<0)return t;if(ee(t,e.to)<=0)return kr(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=kr(e).ch-e.to.ch),te(n,i)}function Tr(t,e){for(var n=[],i=0;i1&&t.remove(a.line+1,p-1),t.insert(a.line+1,m)}ln(t,"change",t,e)}function _r(t,e,n){!function t(i,r,o){if(i.linked)for(var s=0;sa-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(o=function(t,e){return e?(Fr(t.done),Y(t.done)):t.done.length&&!Y(t.done).ranges?Y(t.done):t.done.length>1&&!t.done[t.done.length-2].ranges?(t.done.pop(),Y(t.done)):void 0}(r,r.lastOp==i)))s=Y(o.changes),0==ee(e.from,e.to)&&0==ee(e.from,s.to)?s.to=kr(e):o.changes.push(Ir(t,e));else{var l=Y(r.done);for(l&&l.ranges||zr(t.sel,r.done),o={changes:[Ir(t,e)],generation:r.generation},r.done.push(o);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=e.origin,s||gt(t,"historyAdded")}function Rr(t,e,n,i){var r=t.history,o=i&&i.origin;n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||function(t,e,n,i){var r=e.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}(t,o,Y(r.done),e))?r.done[r.done.length-1]=e:zr(e,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=o,r.lastSelOp=n,i&&!1!==i.clearRedo&&Fr(r.undone)}function zr(t,e){var n=Y(e);n&&n.ranges&&n.equals(t)||e.push(t)}function Hr(t,e,n,i){var r=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,i),function(n){n.markedSpans&&((r||(r=e["spans_"+t.id]={}))[o]=n.markedSpans),++o})}function Vr(t){if(!t)return null;for(var e,n=0;n-1&&(Y(a)[h]=c[h],delete c[h])}}}return i}function Wr(t,e,n,i){if(i){var r=t.anchor;if(n){var o=ee(e,r)<0;o!=ee(n,r)<0?(r=e,e=n):o!=ee(e,n)<0&&(e=n)}return new xr(r,e)}return new xr(n||e,e)}function Ur(t,e,n,i,r){null==r&&(r=t.cm&&(t.cm.display.shift||t.extend)),Xr(t,new br([Wr(t.sel.primary(),e,n,r)],0),i)}function qr(t,e,n){for(var i=[],r=t.cm&&(t.cm.display.shift||t.extend),o=0;o=e.ch:a.to>e.ch))){if(r&&(gt(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--s;continue}break}if(!l.atomic)continue;if(n){var h=l.find(i<0?1:-1),d=void 0;if((i<0?u:c)&&(h=io(t,h,-i,h&&h.line==e.line?o:null)),h&&h.line==e.line&&(d=ee(h,n))&&(i<0?d<0:d>0))return eo(t,h,e,i,r)}var f=l.find(i<0?-1:1);return(i<0?c:u)&&(f=io(t,f,i,f.line==e.line?o:null)),f?eo(t,f,e,i,r):null}}return e}function no(t,e,n,i,r){var o=i||1,s=eo(t,e,n,o,r)||!r&&eo(t,e,n,o,!0)||eo(t,e,n,-o,r)||!r&&eo(t,e,n,-o,!0);return s||(t.cantEdit=!0,te(t.first,0))}function io(t,e,n,i){return n<0&&0==e.ch?e.line>t.first?ae(t,te(e.line-1)):null:n>0&&e.ch==(i||qt(t,e.line)).text.length?e.line0)){var u=[l,1],h=ee(c.from,a.from),d=ee(c.to,a.to);(h<0||!s.inclusiveLeft&&!h)&&u.push({from:c.from,to:a.from}),(d>0||!s.inclusiveRight&&!d)&&u.push({from:a.to,to:c.to}),r.splice.apply(r,u),l+=u.length-3}}return r}(t,e.from,e.to);if(i)for(var r=i.length-1;r>=0;--r)ao(t,{from:i[r].from,to:i[r].to,text:r?[""]:e.text,origin:e.origin});else ao(t,e)}}function ao(t,e){if(1!=e.text.length||""!=e.text[0]||0!=ee(e.from,e.to)){var n=Tr(t,e);jr(t,e,n,t.cm?t.cm.curOp.id:NaN),uo(t,e,n,Ee(t,e));var i=[];_r(t,function(t,n){n||-1!=H(i,t.history)||(go(t.history,e),i.push(t.history)),uo(t,e,null,Ee(t,e))})}}function lo(t,e,n){var i=t.cm&&t.cm.state.suppressEdits;if(!i||n){for(var r,o=t.history,s=t.sel,a="undo"==e?o.done:o.undone,l="undo"==e?o.undone:o.done,c=0;c=0;--f){var p=d(f);if(p)return p.v}}}}function co(t,e){if(0!=e&&(t.first+=e,t.sel=new br(X(t.sel.ranges,function(t){return new xr(te(t.anchor.line+e,t.anchor.ch),te(t.head.line+e,t.head.ch))}),t.sel.primIndex),t.cm)){ci(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,i=n.viewFrom;it.lastLine())){if(e.from.lineo&&(e={from:e.from,to:te(o,qt(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=Kt(t,e.from,e.to),n||(n=Tr(t,e)),t.cm?function(t,e,n){var i=t.doc,r=t.display,o=e.from,s=e.to,a=!1,l=o.line;t.options.lineWrapping||(l=Xt(Re(qt(i,o.line))),i.iter(l,s.line+1,function(t){if(t==r.maxLine)return a=!0,!0})),i.sel.contains(e.from,e.to)>-1&&mt(t),Pr(i,e,n,oi(t)),t.options.lineWrapping||(i.iter(l,o.line+e.text.length,function(t){var e=We(t);e>r.maxLineLength&&(r.maxLine=t,r.maxLineLength=e,r.maxLineChanged=!0,a=!1)}),a&&(t.curOp.updateMaxLine=!0)),function(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontiern;i--){var r=qt(t,i).stateAfter;if(r&&(!(r instanceof ce)||i+r.lookAhead1||!(this.children[0]instanceof mo))){var a=[];this.collapse(a),this.children=[new mo(a)],this.children[0].parent=this}},collapse:function(t){for(var e=0;e50){for(var s=r.lines.length%25+25,a=s;a10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var i=0;i0||0==s&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=P("span",[o.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(je(t,e.line,e,n,o)||e.line!=n.line&&je(t,n.line,e,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ce=!0}o.addToHistory&&jr(t,{from:e,to:n,origin:"markText"},t.sel,NaN);var a,l=e.line,c=t.cm;if(t.iter(l,n.line+1,function(t){c&&o.collapsed&&!c.options.lineWrapping&&Re(t)==c.display.maxLine&&(a=!0),o.collapsed&&l!=e.line&&Yt(t,0),function(t,e){t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],e.marker.attachLine(t)}(t,new ke(o,l==e.line?e.ch:null,l==n.line?n.ch:null)),++l}),o.collapsed&&t.iter(e.line,n.line+1,function(e){Ve(t,e)&&Yt(e,0)}),o.clearOnEnter&&dt(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(we=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++wo,o.atomic=!0),c){if(a&&(c.curOp.updateMaxLine=!0),o.collapsed)ci(c,e.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=e.line;u<=n.line;u++)ui(c,u,"text");o.atomic&&Qr(c.doc),ln(c,"markerAdded",c,o)}return o}Co.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&Wi(t),yt(this,"clear")){var n=this.find();n&&ln(this,"clear",n.from,n.to)}for(var i=null,r=null,o=0;ot.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&ci(t,i,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Qr(t.doc)),t&&ln(t,"markerCleared",t,this,i,r),e&&Ui(t),this.parent&&this.parent.clear()}},Co.prototype.find=function(t,e){var n,i;null==t&&"bookmark"==this.type&&(t=1);for(var r=0;r=0;l--)so(this,i[l]);a?Yr(this,a):this.cm&&Oi(this.cm)}),undo:Qi(function(){lo(this,"undo")}),redo:Qi(function(){lo(this,"redo")}),undoSelection:Qi(function(){lo(this,"undo",!0)}),redoSelection:Qi(function(){lo(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,i=0;i=t.ch)&&e.push(r.marker.parent||r.marker)}return e},findMarks:function(t,e,n){t=ae(this,t),e=ae(this,e);var i=[],r=t.line;return this.iter(t.line,e.line+1,function(o){var s=o.markedSpans;if(s)for(var a=0;a=l.to||null==l.from&&r!=t.line||null!=l.from&&r==e.line&&l.from>=e.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++r}),i},getAllMarks:function(){var t=[];return this.iter(function(e){var n=e.markedSpans;if(n)for(var i=0;i