').get(0),E=i('
').get(0),M=h+k+"-el"+" "+(h+k),A=h+S+"-el"+" "+(h+S);p=i('
').get(0),g=i('
').get(0),v=i('
').get(0),m=i('
').get(0),y=i('
').get(0),b=i('
').get(0),x=i('
').get(0),w=i('
').get(0),this["marginT"+o]=p,this["marginB"+o]=g,this["marginL"+o]=v,this["marginR"+o]=m,this["padT"+o]=y,this["padB"+o]=b,this["padL"+o]=x,this["padR"+o]=w,T.appendChild(p),T.appendChild(g),T.appendChild(v),T.appendChild(m),E.appendChild(y),E.appendChild(b),E.appendChild(x),E.appendChild(w),f.appendChild(T),f.appendChild(E),this[d]="1"}var O=u.marginLeft.replace("px",""),P=parseInt(u.marginTop.replace("px","")),_=parseInt(u.marginBottom.replace("px","")),L=p.style,N=g.style,D=v.style,I=m.style,F=y.style,R=b.style,j=x.style,z=w.style,V=parseInt(c.left);L.height=u.marginTop,L.width=u.width,L.top=c.top-u.marginTop.replace("px","")+"px",L.left=V+"px",N.height=u.marginBottom,N.width=u.width,N.top=c.top+c.height+"px",N.left=V+"px";var H=c.height+P+_+"px",$=c.top-P+"px";D.height=H,D.width=u.marginLeft,D.top=$,D.left=V-O+"px",I.height=H,I.width=u.marginRight,I.top=$,I.left=V+c.width+"px";var B=parseInt(u.paddingTop.replace("px",""));F.height=u.paddingTop,F.width=u.width,F.top=c.top+"px",F.left=V+"px";var W=parseInt(u.paddingBottom.replace("px",""));R.height=u.paddingBottom,R.width=u.width,R.top=c.top+c.height-W+"px",R.left=V+"px";var U=c.height-W-B+"px",q=c.top+B+"px";j.height=U,j.width=u.paddingLeft,j.top=q,j.left=c.left+"px";var K=parseInt(u.paddingRight.replace("px",""));z.height=U,z.width=u.paddingRight,z.top=q,z.left=c.left+c.width-K+"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,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.Modal,r=t.AssetManager,o=r.getConfig(),s=r.getContainer(),a=n.modalTitle||o.modalTitle||"",l=n.types,c=n.accept;if(r.setTarget(n.target),r.onClick(n.onClick),r.onDblClick(n.onDblClick),r.onSelect(n.onSelect),!this.rendered||l){var u=r.getAll();l&&(u=u.filter(function(t){return-1!==l.indexOf(t.get("type"))})),r.render(u),this.rendered=1}if(c){var h=s.querySelector("input#"+o.stylePrefix+"uploadFile");h&&h.setAttribute("accept",c)}i.setTitle(a),i.setContent(s),i.open()}}},function(t,e,n){"use strict";t.exports={run:function(t,e){var n=t.BlockManager,i=t.Panels;if(!this.blocks){n.render();var r="views-container",o=document.createElement("div"),s=i.getPanel(r)||i.addPanel({id:r});o.appendChild(n.getContainer()),s.set("appendContent",o).trigger("change:appendContent"),this.blocks=o}this.blocks.style.display="block"},stop:function(){var t=this.blocks;t&&(t.style.display="none")}}},function(t,e,n){"use strict";var i=n(0).$;t.exports={run:function(t,e){this.sender=e;var n=t.Config.stylePrefix,r=t.TraitManager;if(!this.$cn){var o=r.getTraitsViewer(),s=r.getConfig();this.$cn=i("
"),this.$cn2=i("
"),this.$cn.append(this.$cn2),this.$header=i("
").append('"),this.$cn.append(this.$header),this.$cn2.append('
'+s.labelContainer+"
"),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=function(t){return t&&t.__esModule?t:{default:t}}(n(0));n(77);var r=i.default.$;t.exports={run:function(t,e){if(this.sender=e,!this.$cn){var n=t.getConfig(),i=t.Panels;this.$cn=r("
"),this.$cn2=r("
"),this.$cn.append(this.$cn2);var o=t.DeviceManager;if(o&&n.showDevices)i.addPanel({id:"devices-c"}).set("appendContent",o.render()).trigger("change:appendContent");var s=t.SelectorManager;s&&this.$cn2.append(s.render([])),this.$cn2.append(t.StyleManager.render());var a=t.StyleManager.getConfig(),l=a.stylePrefix;this.$header=r('"),this.$cn.append(this.$header),i.getPanel("views-container")?this.panel=i.getPanel("views-container"):this.panel=i.addPanel({id:"views-container"}),this.panel.set("appendContent",this.$cn).trigger("change:appendContent"),this.target=t.editor,this.listenTo(this.target,"component:toggled",this.toggleSm)}this.toggleSm()},toggleSm:function(){var t=this.target,e=this.sender;e&&e.get&&!e.get("active")||(1===t.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=function(t){return t&&t.__esModule?t:{default:t}}(n(0));n(54),i.default.$;t.exports={run:function(t){var e=t.LayerManager,n=t.Panels;if(!this.layers){var i="views-container",r=document.createElement("div"),o=n.getPanel(i)||n.addPanel({id:i});r.appendChild(e.render()),o.set("appendContent",r).trigger("change:appendContent"),this.layers=r}this.layers.style.display="block"},stop:function(){var t=this.layers;t&&(t.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(1));r(n(0));function r(t){return t&&t.__esModule?t:{default:t}}var o=n(7);t.exports=i.default.extend({},o,{beforeDraw:function(t){t.type="text",t.style||(t.style={}),t.style.padding="10px"},afterDraw:function(t){t&&t.set&&(t.trigger("focus"),this.sender&&this.sender.set("active",!1))}})},function(t,e,n){"use strict";var i=s(n(1)),r=s(n(0)),o=n(2);function s(t){return t&&t.__esModule?t:{default:t}}var a=n(8),l=n(13),c=r.default.$;t.exports=i.default.extend({},l,a,{init:function(t){a.init.apply(this,arguments),i.default.bindAll(this,"initSorter","rollback","onEndMove"),this.opt=t,this.hoverClass=this.ppfx+"highlighter-warning",this.badgeClass=this.ppfx+"badge-warning",this.noSelClass=this.ppfx+"no-select"},enable:function(){for(var t=arguments.length,e=Array(t),n=0;n
2&&void 0!==arguments[2]&&arguments[2];e&&e.set&&e.set("active",0);var n=t.getConfig(),r=t.Modal,o=n.stylePrefix;if(this.cm=t.CodeManager||null,!this.$editors){var s=this.buildEditor("htmlmixed","hopscotch","HTML"),a=this.buildEditor("css","hopscotch","CSS");this.htmlEditor=s.el,this.cssEditor=a.el;var l=i('');l.append(s.$el).append(a.$el),this.$editors=l}r.setTitle(n.textViewCode),r.setContent(this.$editors),r.open(),this.htmlEditor.setContent(t.getHtml()),this.cssEditor.setContent(t.getCss())},stop:function(t){var e=t.Modal;e&&e.close()},buildEditor:function(t,e,n){var i=document.createElement("textarea");!this.codeMirror&&(this.codeMirror=this.cm.getViewer("CodeMirror"));var r=this.codeMirror.clone().set({label:n,codeName:t,theme:e,input:i}),o=new this.cm.EditorView({model:r,config:this.cm.getConfig()}).render().$el;return r.init(i),{el:r,$el:o}}}},function(t,e,n){"use strict";var i=function(t){return t&&t.__esModule?t:{default:t}}(n(0));var r=i.default.$;t.exports=i.default.View.extend({initialize:function(t){this.config=t||{},this.editorModel=this.em=this.config.em||{},this.pfx=this.config.stylePrefix,this.ppfx=this.config.pStylePrefix,this.hoverClass=this.pfx+"hover",this.badgeClass=this.pfx+"badge",this.plhClass=this.pfx+"placeholder",this.freezClass=this.ppfx+"freezed",this.canvas=this.em.get&&this.em.get("Canvas"),this.em.get&&this.setElement(this.getCanvas()),this.canvas&&(this.$canvas=this.$el,this.$wrapper=r(this.getCanvasWrapper()),this.frameEl=this.canvas.getFrameEl(),this.canvasTool=this.getCanvasTools(),this.bodyEl=this.getCanvasBody()),this.init(this.config)},onFrameScroll:function(t){},getCanvas:function(){return this.canvas.getElement()},getCanvasBody:function(){return this.canvas.getBody()},getCanvasWrapper:function(){return this.canvas.getWrapperEl()},getCanvasTools:function(){return this.canvas.getToolsEl()},offset:function(t){var e=t.getBoundingClientRect();return{top:e.top+t.ownerDocument.body.scrollTop,left:e.left+t.ownerDocument.body.scrollLeft}},init:function(t){},callRun:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.id;if(t.trigger("run:"+n+":before",e),!e||!e.abort){var i=e.sender||t,r=this.run(t,i,e);return t.trigger("run:"+n,r,e),r}t.trigger("abort:"+n,e)},callStop:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.id,i=e.sender||t;t.trigger("stop:"+n+":before",e);var r=this.stop(t,i,e);return t.trigger("stop:"+n,r,e),r},run:function(t,e){},stop:function(t,e){}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e\n \n \n '},inputClass:function(){var t=this.ppfx;return this.opts.contClass||t+"field "+t+"field-integer"},initialize:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];o.prototype.initialize.apply(this,arguments),(0,i.bindAll)(this,"moveIncrement","upIncrement"),this.doc=document,this.listenTo(this.model,"change:unit",this.handleModelChange)},setValue:function(t,e){var n=e||{},i=this.validateInputValue(t,{deepCheck:1}),r={value:i.value};(i.unit||i.force)&&(r.unit=i.unit),this.model.set(r,n),n.silent&&this.handleModelChange()},handleChange:function(t){t.stopPropagation(),this.setValue(this.getInputEl().value),this.elementUpdated()},handleUnitChange:function(t){t.stopPropagation();var e=this.getUnitEl().value;this.model.set("unit",e),this.elementUpdated()},elementUpdated:function(){this.model.trigger("el:change")},handleModelChange:function(){var t=this.model;this.getInputEl().value=t.get("value");var e=this.getUnitEl();e&&(e.value=t.get("unit")||"")},getUnitEl:function(){if(!this.unitEl){var t=this.model,e=t.get("units")||[];if(e.length){var n=[];e.forEach(function(e){var i=e==t.get("unit")?"selected":"";n.push("")});var i=document.createElement("div");i.innerHTML='",this.unitEl=i.firstChild}}return this.unitEl},upArrowClick:function(){var t=this.model,e=t.get("step"),n=parseInt(t.get("value"),10);n=this.normalizeValue(n+e);var i=this.validateInputValue(n);t.set("value",i.value),this.elementUpdated()},downArrowClick:function(){var t=this.model,e=t.get("step"),n=parseInt(t.get("value"),10),i=this.normalizeValue(n-e),r=this.validateInputValue(i);t.set("value",r.value),this.elementUpdated()},downIncrement:function(t){t.preventDefault(),this.moved=0;var e=this.model.get("value");e=this.normalizeValue(e),this.current={y:t.pageY,val:e},(0,r.on)(this.doc,"mousemove",this.moveIncrement),(0,r.on)(this.doc,"mouseup",this.upIncrement)},moveIncrement:function(t){this.moved=1;var e=this.model,n=e.get("step"),i=this.current,r=this.normalizeValue(i.val+(i.y-t.pageY)*n);return this.prValue=this.validateInputValue(r).value,e.set("value",this.prValue,{avoidStore:1}),!1},upIncrement:function(){var t=this.model,e=t.get("step");if((0,r.off)(this.doc,"mouseup",this.upIncrement),(0,r.off)(this.doc,"mousemove",this.moveIncrement),this.prValue&&this.moved){var n=this.prValue-e;t.set("value",n,{avoidStore:1}).set("value",n+e),this.elementUpdated()}},normalizeValue:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.model.get("step"),i=0;if(isNaN(t))return e;if(t=parseFloat(t),Math.floor(t)!==t){var r=n.toString().split(".")[1];i=r?r.length:0}return i?parseFloat(t.toFixed(i)):t},validateInputValue:function(t,n){var r=0,o=n||{},s=this.model,a=(0,i.isUndefined)(t)?"":t,l=s.get("units")||[],c=s.get("unit")||l.length&&l[0]||"",u=s.get("max"),h=s.get("min");if(o.deepCheck){var d=s.get("fixedValues")||[];if(a){var f=new RegExp("^"+d.join("|"),"g");if(d.length&&f.test(a))a=a.match(f)[0],c="",r=1;else{var p=a+"";a+="",a=parseFloat(a.replace(",",".")),a=isNaN(a)?"":a;var g=p.replace(a,"");e.indexOf(l,g)>=0&&(c=g)}}}return(0,i.isUndefined)(u)||""===u||(a=a>u?u:a),(0,i.isUndefined)(h)||""===h||(a=a\n \n \n '},inputValueChanged:function(){if(!this.model.get("detached")){for(var t=arguments.length,e=Array(t),n=0;n
'),this.input=this.$input.get(0)),this.props||(this.props=t.get("properties")),!this.$props)){this.props.each(function(e,n){e&&"composite"==e.get("type")&&(this.props.remove(e),console.warn("Nested composite types not yet allowed.")),e.parent=t},this);var i=new(n(16))(this.getPropsConfig());this.$props=i.render().$el,this.properties=i.properties,this.$el.find("#"+this.pfx+"input-holder").append(this.$props)}},getPropsConfig:function(t){var e=this,n=this.model,i={config:this.config,collection:this.props,target:this.target,propTarget:this.propTarget,onChange:function(t,e,i){n.set("value",n.getFullValue(),i)},customValue:function(t,n){return e.valueOnIndex(n,t)}};return n.get("detached")&&delete i.onChange,i},valueOnIndex:function(t,e){var n=void 0,i=this.getTargetValue({ignoreDefault:1});i?n=i.split(" ")[t]:n=e&&e.getTargetValue({ignoreCustomValue:1,ignoreDefault:1});return e&&(n=e.model.parseValue(n).value),n}})},function(t,e,n){"use strict";var i=function(t){return t&&t.__esModule?t:{default:t}}(n(0));t.exports=i.default.Model.extend({defaults:{id:"",label:"",open:!0,attributes:{}}})},function(t,e,n){"use strict";var i=n(1);t.exports={run:function(t){var e=t.getModel(),n=e.get("clipboard"),r=t.getSelected();n&&r&&!e.isEditing()&&(t.getSelectedAll().forEach(function(e){if(e){var r=e.collection,o=r.indexOf(e)+1,s=n.filter(function(t){return t.get("copyable")}),a=void 0;a=(0,i.contains)(n,e)&&e.get("copyable")?r.add(e.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:clone",e)})}}),r.emitUpdate())}}},function(t,e,n){"use strict";t.exports={run:function(t){var e=t.getModel(),n=[].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e=0?r:t)}),e.length&&t.select(e)}}}},function(t,e,n){"use strict";t.exports={run:function(t){if(t.Canvas.hasFocus()&&!t.getModel().isEditing()){var e=[];t.getSelectedAll().forEach(function(t){var n=t.collection,i=n.indexOf(t),r=n.at(i+1);e.push(r||t)}),e.length&&t.select(e)}}}},function(t,e,n){"use strict";t.exports={run:function(t){if(t.Canvas.hasFocus()&&!t.getModel().isEditing()){var e=[];t.getSelectedAll().forEach(function(t){var n=t.parent();n&&e.push(n)}),e.length&&t.select(e)}}}},function(t,e,n){"use strict";t.exports={run:function(t){if(t.Canvas.hasFocus()&&!t.getModel().isEditing()){var e=[];t.getSelectedAll().forEach(function(t){var n=t.components(),i=n&&n.at(0);i&&e.push(i)}),e.length&&t.select(e)}}}},function(t,e,n){"use strict";var i=n(1);t.exports={run:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t.Canvas.hasFocus()&&!t.getModel().isEditing()){var r=n.component||t.getSelectedAll();return r=(0,i.isArray)(r)?[].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e':"")+'\n \n
\n
\n \n '+t.getIcon()+'\n '+h+'\n
\n
\n
\n '+(r||"")+'
\n \n \n
\n '},initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.opt=t,this.level=t.level,this.config=t.config,this.em=t.config.em,this.ppfx=this.em.get("Config").stylePrefix,this.sorter=t.sorter||"",this.pfx=this.config.stylePrefix;var e=this.pfx,n=this.ppfx,i=this.model,r=i.get("components");i.set("open",!1),this.listenTo(r,"remove add change reset",this.checkChildren),this.listenTo(i,"change:status",this.updateStatus),this.listenTo(i,"change:open",this.updateOpening),this.listenTo(i,"change:style:display",this.updateVisibility),this.className=e+"layer no-select "+n+"two-color",this.inputNameCls=n+"layer-name",this.clsTitleC=e+"layer-title-c",this.clsTitle=e+"layer-title",this.clsCaret=e+"layer-caret",this.clsCount=e+"layer-count",this.clsMove=e+"layer-move",this.clsChildren=e+"layer-children",this.clsNoChild=e+"layer-no-chld",this.$el.data("model",i),this.$el.data("collection",r),i.viewLayer=this},getVisibilityEl:function(){return this.eyeEl||(this.eyeEl=this.$el.children("."+this.pfx+"layer-vis")),this.eyeEl},updateVisibility:function(){var t=this.pfx+"layer-hidden",e="none"==this.model.getStyle().display?"addClass":"removeClass";this.$el[e](t),this.getVisibilityEl()[e]("fa-eye-slash")},toggleVisibility:function(t){t&&t.stopPropagation();var e=this.model,n=e.getStyle();"none"==n.display?delete n.display:n.display="none",e.setStyle(n)},handleEdit:function(t){t&&t.stopPropagation();var e=this.getInputName();e.contentEditable=!0,e.focus()},handleEditEnd:function(t){t&&t.stopPropagation();var e=this.getInputName(),n=e.textContent;e.contentEditable=!1,this.model.set({name:n})},getInputName:function(){return this.inputName||(this.inputName=this.el.querySelector("."+this.inputNameCls)),this.inputName},updateOpening:function(){var t=this.opt.opened||{},e=this.model;e.get("open")?(this.$el.addClass("open"),this.getCaret().addClass("fa-chevron-down"),t[e.cid]=e):(this.$el.removeClass("open"),this.getCaret().removeClass("fa-chevron-down"),delete t[e.cid])},toggleOpening:function(t){t.stopPropagation(),this.model.get("components").length&&this.model.set("open",!this.model.get("open"))},handleSelect:function(t){t.stopPropagation();var e=this.em,n=this.config;if(e){var i=this.model;e.setSelected(i,{fromLayers:1});var r=n.scrollCanvas;r&&e.get("Canvas").scrollTo(i,r)}},handleHover:function(t){t.stopPropagation();var e=this.em,n=this.config,i=this.model;e&&n.showHover&&e.setHovered(i,{fromLayers:1})},startSort:function(t){t.stopPropagation();var e=this.sorter;0===t.button&&e&&e.startSort(t.target)},freeze:function(){this.$el.addClass(this.pfx+"opac50"),this.model.set("open",0)},unfreeze:function(){this.$el.removeClass(this.pfx+"opac50")},updateStatus:function(t){s.prototype.updateStatus.apply(this,[{avoidHover:!this.config.highlightHover}])},isVisible:function(){var t=this.model.get("style").display;if(!t||"none"!=t)return 1},checkChildren:function(){var t=this.model,e=this.countChildren(t),n=(this.pfx,this.clsNoChild),i=this.$el.children("."+this.clsTitleC).children("."+this.clsTitle);this.cnt||(this.cnt=this.$el.children("."+this.clsCount)),e?(i.removeClass(n),this.cnt.html(e)):(i.addClass(n),this.cnt.empty(),t.set("open",0))},countChildren:function(t){var e=0;return t.get("components").each(function(t){var n=this.opt.isCountable,i=this.config.hideTextnode;n&&!n(t,i)||e++},this),e},getCaret:function(){if(!this.caret||!this.caret.length){this.pfx;this.caret=this.$el.children("."+this.clsTitleC).find("."+this.clsCaret)}return this.caret},setRoot:function(t){t=(0,i.isString)(t)?this.em.getWrapper().find(t)[0]:t;var e=(0,r.getModel)(t,a);e&&(this.stopListening(),this.model=e,this.initialize(this.opt),this.render())},render:function(){var t=this.model,e=this.pfx,r=this.isVisible(),o=this.$el.empty(),s=this.level+1;(0,i.isUndefined)(l)&&(l=n(113));var a=new l({collection:t.get("components"),config:this.config,sorter:this.sorter,opened:this.opt.opened,parent:t,level:s}).render().$el;return this.config.showWrapper||1!==s?(o.html(this.template(t)),o.find("."+this.clsChildren).append(a)):o.append(a),t.get("draggable")&&this.config.sortable||o.children("."+this.clsMove).remove(),!r&&(this.className+=" "+e+"hide"),o.attr("class",this.className),this.updateOpening(),this.updateStatus(),this.updateVisibility(),this}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};return(n=i({},r.default,e)).stylePrefix=e.pStylePrefix,t=n.em,this},getConfig:function(){return n},onLoad:function(){e=new o.default({level:0,config:n,opened:n.opened||{},model:t.get("DomComponents").getWrapper()}),t&&t.on("component:selected",this.componentChanged),this.componentChanged()},postRender:function(){var t=n.appendTo,e=n.root;(e&&this.setRoot(e),t)&&((0,s.isElement)(t)?t:document.querySelector(t)).appendChild(this.render())},setRoot:function(t){return e.setRoot(t),this},getRoot:function(){return e.model},getAll:function(){return e},componentChanged:function(e){if(!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).fromLayers){var i=t.get("opened"),r=t.getSelected(),o=n.scrollLayers,s=r&&r.collection?r.collection.parent:null;for(var a in i)i[a].set("open",0);for(;s;)s.set("open",1),i[s.cid]=s,s=s.collection?s.collection.parent:null;if(r&&o){var l=r.viewLayer&&r.viewLayer.el;l&&l.scrollIntoView(o)}}},render:function(){return e.render().el}}}},function(t,e,n){"use strict";var i=n(2),r=n(3);t.exports=r.extend({events:{dblclick:"enableEditing",input:"onInput"},initialize:function(t){r.prototype.initialize.apply(this,arguments),this.disableEditing=this.disableEditing.bind(this);var e=this.model,n=this.em;this.listenTo(e,"focus active",this.enableEditing),this.listenTo(e,"change:content",this.updateContent),this.rte=n&&n.get("RichTextEditor")},enableEditing:function(t){t&&t.stopPropagation&&t.stopPropagation();var e=this.rte;if(!this.rteEnabled&&this.model.get("editable")){if(e)try{this.activeRte=e.enable(this,this.activeRte)}catch(t){console.error(t)}this.rteEnabled=1,this.toggleEvents(1)}},disableEditing:function(){var t=this.model,e=t.get("editable"),n=this.rte;if(n&&e){try{n.disable(this,this.activeRte)}catch(t){console.error(t)}var i=this.getChildrenContainer().innerHTML,r=t.get("components");if(r.length&&r.reset(),t.set("content",""),n.customRte)t.set("content",i);else{t.trigger("change:content",t),r.add(i),r.each(function(t){return function t(e){e.set({editable:0,highlightable:0,removable:0,draggable:0,copyable:0,toolbar:""}),e.get("components").each(function(e){return t(e)})}(t)}),r.trigger("resetNavigator")}}this.rteEnabled=0,this.toggleEvents()},onInput:function(t){var e=this.em;e&&e.trigger("change:canvasOffset")},disablePropagation:function(t){t.stopPropagation()},toggleEvents:function(t){var e=t?"on":"off",n={on:i.on,off:i.off};this.em.setEditing(t);var r=[this.el.ownerDocument,document];n.off(r,"mousedown",this.disableEditing),n[e](r,"mousedown",this.disableEditing),this.$el.off("mousedown",this.disablePropagation),this.$el[e]("mousedown",this.disablePropagation)}})},function(t,e,n){"use strict";n(0);var i=n(55);t.exports=i.extend({render:function(){for(var t=arguments.length,e=Array(t),n=0;n1&&void 0!==arguments[1]&&arguments[1];var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.config.em,i=this.collection.indexOf(t);this.addToCollection(t,null,i),n&&!e.temporary&&n.trigger("component:add",t)},addToCollection:function(t,e,i){this.compView||(this.compView=n(3));for(var o=e||null,s=this.compView,a=this.opts.componentTypes,l=t.get("type"),c=0;c1&&void 0!==arguments[1]?arguments[1]:{};this.listenTo(this,"add",this.onAdd),this.config=e.config,this.em=e.em,this.model=function(t,n){var i,r=e.componentTypes;n.em=e.em,n.config=e.config,n.componentTypes=r;for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t){var n=this.em.get("CssComposer"),i=this.em.get("Parser").parseHtml(t);if(t=i.html,i.css&&n){var o=e.avoidUpdateStyle;n.addCollection(i.css,{extend:1,avoidUpdateStyle:o})}}return r.Collection.prototype.add.apply(this,[t,e])},onAdd:function(t,e,n){var r=this.em,o=t.getStyle(),s=r&&r.getConfig("avoidInlineStyle");if(!(0,i.isEmpty)(o)&&!s&&r&&r.get&&r.getConfig("forceClass")){var a=t.cid;r.get("CssComposer").setClassRule(a,o);t.setStyle({}),t.addClass(a)}}})},function(t,e,n){"use strict";var i=n(0);t.exports=i.View.extend({itemView:"",itemsView:"",itemType:"type",initialize:function(t,e){this.config=e||{}},addTo:function(t){this.add(t)},add:function(t,e){var n=e||null,i=this.itemView,r=t.get(this.itemType);this.itemsView&&this.itemsView[r]&&(i=this.itemsView[r]);var o=new i({model:t,config:this.config},this.config).render().el;n?n.appendChild(o):this.$el.append(o)},render:function(){var t=document.createDocumentFragment();return this.$el.empty(),this.collection.length&&this.collection.each(function(e){this.add(e,t)},this),this.$el.append(t),this}})},function(t,e,n){"use strict";t.exports=n(0).View.extend({tagName:"style",initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.config=t.config||{};var e=this.model;this.listenTo(e,"change:style change:state change:mediaText",this.render),this.listenTo(e,"destroy remove",this.remove),this.listenTo(e.get("selectors"),"change",this.render)},render:function(){var t=this.model.get("important");return this.el.innerHTML=this.model.toCSS({important:t}),this}})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=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]:{};(0,r.isString)(e)&&(e=s(e));var a=this.getStyle(),l=i({},e);this.set("style",l,n);var c=(0,o.shallowDiff)(a,l);return(0,r.keys)(c).forEach(function(e){var n=t.em;t.trigger("change:style:"+e),n&&(n.trigger("styleable:change",t,e),n.trigger("styleable:change:"+e,t,e))}),l},addStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"string"==typeof t?t={prop:e}:n=e||{},t=this.extendStyle(t),this.setStyle(t,n)},removeStyle:function(t){var e=this.getStyle();delete e[t],this.setStyle(e)},styleToString:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=[],n=this.getStyle();for(var i in n){var o=t.important,s=(0,r.isArray)(o)?o.indexOf(i)>=0:o,a=n[i]+(s?" !important":"");a&&e.push(i+":"+a+";")}return e.join("")}}},function(t,e,n){"use strict";var i=n(1),r=a(i),o=a(n(0)),s=a(n(61));function a(t){return t&&t.__esModule?t:{default:t}}var l=n(19);t.exports=o.default.Model.extend(s.default).extend({defaults:{selectors:{},selectorsAdd:"",style:{},mediaText:"",state:"",stylable:!0,atRuleType:"",singleAtRule:0,important:0},initialize:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.config=t||{};var n=e.em,i=this.config.selectors||[];if(this.em=n,n){var r=n.get("SelectorManager"),o=[];i.forEach(function(t){o.push(r.add(t))}),i=o}this.set("selectors",new l(i))},getAtRule:function(){var t=this.get("atRuleType"),e=this.get("mediaText"),n=t?"@"+t:e?"@media":"";return n+(e&&n?" "+e:"")},selectorsToString:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=[],n=this.get("state"),i=this.get("selectorsAdd"),r=this.get("selectors").getFullString(),o=n?":"+n:"";return r&&e.push(""+r+o),i&&!t.skipAdd&&e.push(i),e.join(", ")},getDeclaration:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="",n=this.selectorsToString(),i=this.styleToString(t),r=this.get("singleAtRule");return(n||r)&&i&&(e=r?i:n+"{"+i+"}"),e},toCSS:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="",n=this.getAtRule(),i=this.getDeclaration(t);return i&&(e=i),n&&e&&(e=n+"{"+e+"}"),e},toJSON:function(){for(var t=arguments.length,e=Array(t),n=0;n3&&void 0!==arguments[3]?arguments[3]:{},o=e||"",s=n||"",a=i.selectorsAdd||"",l=i.atRuleType||"";t instanceof Array||t.models||(t=[t]);var c=r.default.map(t.models||t,function(t){return t.get("name")}),u=r.default.map(this.get("selectors").models,function(t){return t.get("name")});if(c.length!==u.length)return!1;for(var h=0;h\n <%= title %>
\n multiple/>\n \n \n '),events:{},initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=t;var e=t.config||{};this.config=e,this.pfx=e.stylePrefix||"",this.ppfx=e.pStylePrefix||"",this.target=this.options.globalCollection||{},this.uploadId=this.pfx+"uploadFile",this.disabled=void 0!==e.disableUpload?e.disableUpload:!e.upload&&!e.embedAsBase64,this.events["change #"+this.uploadId]="uploadFile";var n=e.uploadFile;n?this.uploadFile=n.bind(this):e.embedAsBase64&&(this.uploadFile=this.constructor.embedAsBase64),this.delegateEvents()},onUploadStart:function(){var t=this.config.em;t&&t.trigger("asset:upload:start")},onUploadEnd:function(t){var e=this.config.em;e&&e.trigger("asset:upload:end",t)},onUploadError:function(t){var e=this.config.em;console.error(t),this.onUploadEnd(t),e&&e.trigger("asset:upload:error",t)},onUploadResponse:function(t,e){var n=this.config.em,i=this.config,r=this.target,o="string"==typeof t?JSON.parse(t):t;n&&n.trigger("asset:upload:response",o),i.autoAdd&&r&&r.add(o.data,{at:0}),this.onUploadEnd(t),e&&e(o)},uploadFile:function(t,e){for(var n=this,i=t.dataTransfer?t.dataTransfer.files:t.target.files,r=new FormData,s=this.config,a=s.params,l=0;l'+i.dropzoneContent+""),h(),"draggable"in o&&[o,a].forEach(function(t){t.ondragover=d,t.ondragleave=f,t.ondrop=p})},render:function(){return this.$el.html(this.template({title:this.config.uploadText,uploadId:this.uploadId,disabled:this.disabled,pfx:this.pfx})),this.initDrop(),this.$el.attr("class",this.pfx+"file-uploader"),this}},{embedAsBase64:function(t,e){var n=this,i=t.dataTransfer?t.dataTransfer.files:t.target.files,r={data:[]};if(FileReader){var o=[],s=/^(.+)\/(.+)$/,a=function(t){var e=new Promise(function(e,n){var i=new FileReader;i.addEventListener("load",function(r){var o=void 0,a=t.name,l=s.exec(t.type);if("image"===(o=l?l[1]:t.type)){var c={src:i.result,name:a,type:o,height:0,width:0},u=new Image;u.addEventListener("error",function(t){n(t)}),u.addEventListener("load",function(){c.height=u.height,c.width=u.width,e(c)}),u.src=c.src}else e(o?{src:i.result,name:a,type:o}:i.result)}),i.addEventListener("error",function(t){n(t)}),i.addEventListener("abort",function(t){n("Aborted")}),i.readAsDataURL(t)});o.push(e)},l=!0,c=!1,u=void 0;try{for(var h,d=i[Symbol.iterator]();!(l=(h=d.next()).done);l=!0){a(h.value)}}catch(t){c=!0,u=t}finally{try{!l&&d.return&&d.return()}finally{if(c)throw u}}Promise.all(o).then(function(t){r.data=t,n.onUploadResponse(r,e)},function(t){n.onUploadError(t)})}else this.onUploadError(new Error("Unsupported platform, FileReader is not defined"))}})},function(t,e,n){"use strict";(function(e){var i=function(t){return t&&t.__esModule?t:{default:t}}(n(0));t.exports=i.default.View.extend({initialize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=t,this.collection=t.collection;var e=t.config||{};this.config=e,this.pfx=e.stylePrefix||"",this.ppfx=e.pStylePrefix||"",this.em=e.em,this.className=this.pfx+"asset",this.listenTo(this.model,"destroy remove",this.remove),this.model.view=this;var n=this.init&&this.init.bind(this);n&&n(t)},template:function(){var t=this.pfx;return'\n
\n '+this.getPreview()+'\n
\n
\n '+this.getInfo()+'\n
\n
\n ⨯\n
\n '},updateTarget:function(t){t&&t.set&&(t.set("attributes",e.clone(t.get("attributes"))),t.set("src",this.model.get("src")))},getPreview:function(){return""},getInfo:function(){return""},render:function(){var t=this.el;return t.innerHTML=this.template(this,this.model),t.className=this.className,this}})}).call(this,n(1))},function(t,e,n){"use strict";t.exports=n(64).extend({events:{"click [data-toggle=asset-remove]":"onRemove",click:"onClick",dblclick:"onDblClick"},getPreview:function(){var t=this.pfx;return'\n
\n
\n '},getInfo:function(){var t=this.pfx,e=this.model,n=e.get("name"),i=e.get("width"),r=e.get("height"),o=e.get("unitDim"),s=i&&r?i+"x"+r+o:"";return'\n
'+(n=n||e.getFilename())+'
\n
'+s+"
\n "},init:function(t){var e=this.pfx;this.className+=" "+e+"asset-image"},onClick:function(){var t=this.config.onClick,e=this.model;this.collection.trigger("deselectAll"),this.$el.addClass(this.pfx+"highlight"),"function"==typeof t?t(e):this.updateTarget(this.collection.target)},onDblClick:function(){var t=this.em,e=this.config.onDblClick,n=this.model;"function"==typeof e?e(n):(this.updateTarget(this.collection.target),t&&t.get("Modal").close());var i=this.collection.onSelect;"function"==typeof i&&i(this.model)},onRemove:function(t){t.stopImmediatePropagation(),this.model.collection.remove(this.model)}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e
0&&void 0!==arguments[0]?arguments[0]:{};return this.set({value:void 0,unit:void 0},t),this},parseValue:function(t){var e=o.prototype.parseValue.apply(this,arguments),n=this.input.validateInputValue(e.value,{deepCheck:1}),i=n.value,r=n.unit;return e.value=i,e.unit=r,e},getFullValue:function(){var t=this.get("value"),e=this.get("unit");return t=""+(t=(0,r.isUndefined)(t)?"":t)+(e=!(0,r.isUndefined)(e)&&t?e:""),o.prototype.getFullValue.apply(this,[t])}})},function(t,e,n){"use strict";var i=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:[];return this.set("options",t),this},addOption:function(t){if(t){var e=this.getOptions();this.setOptions([].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e\n \n \n \n '},init:function(){var t=this.em;this.modal=t.get("Modal"),this.am=t.get("AssetManager"),this.events["click #"+this.pfx+"close"]="removeFile",this.events["click #"+this.pfx+"images"]="openAssetManager",this.delegateEvents()},onRender:function(){if(!this.$input){var t=this.model.getDefaultValue();this.$input=o('