diff --git a/build/content-edit.min.css b/build/content-edit.min.css index bcda918..800fb45 100644 --- a/build/content-edit.min.css +++ b/build/content-edit.min.css @@ -1,2 +1,2 @@ -/*! ContentEdit v1.2.0 by Anthony Blackshaw (https://github.com/anthonyjb) */ +/*! ContentEdit v1.2.1 by Anthony Blackshaw (https://github.com/anthonyjb) */ .ce--dragging,.ce--resizing{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce--dragging{cursor:move !important}.ce--resizing{cursor:nwse-resize !important}.ce-element--type-image,.ce-element--type-video{background-repeat:no-repeat;position:relative;cursor:pointer;z-index:1}.ce-element--type-image:after,.ce-element--type-image:before,.ce-element--type-video:after,.ce-element--type-video:before{background:rgba(0,0,0,0.5);border-radius:2px;color:white;display:none;font-family:arial, sans-serif;font-size:10px;line-height:10px;padding:4px 4px 3px;position:absolute}.ce-element--type-image:before,.ce-element--type-video:before{content:attr(data-ce-size);right:10px;top:10px}.ce-element--type-image.ce-element--over:before,.ce-element--type-image.ce-element--resizing:before,.ce-element--type-video.ce-element--over:before,.ce-element--type-video.ce-element--resizing:before{display:block}.ce-element--type-image{background-position:0 0;background-size:cover}.ce-element--type-image:after{background:transparent;content:'';display:block;left:0;position:relative;top:0;height:100%;width:100%}.ce-element--type-video{background:#333 url("images/video.svg") center/auto 48px no-repeat}.ce-element--type-video:after{bottom:10px;content:attr(data-ce-title);display:block;left:10px}.ce-element--empty:after{content:'...';display:inline-block;font-style:italic;opacity:0.5}.ce-element--empty[data-ce-placeholder]:after{content:attr(data-ce-placeholder)}.ce-element--dragging{background-color:rgba(51,51,51,0.1) !important;opacity:0.5;z-index:-1}.ce-element--dragging.ce-element--type-image,.ce-element--dragging.ce-element--type-video{background-color:#333 !important;opacity:1.0;outline-color:rgba(51,51,51,0.1) !important}.ce-element--drop{position:relative !important}.ce-element--drop:before{background:#f39c12 url("images/drop-vert-above.svg") center/auto 32px repeat;bottom:0;content:'' !important;left:0;opacity:0.8;position:absolute;right:0;top:0;z-index:9}.ce-element--drop-below:before{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.ce-element--drop-left:before{background-image:url("images/drop-horz.svg");-ms-transform:rotate(0deg);-webkit-transform:rotate(0deg);transform:rotate(0deg)}.ce-element--drop-right:before{background-image:url("images/drop-horz.svg");-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.ce-element--drop.ce-element--type-table-row{background:#f39c12 url("images/drop-vert-above.svg") center/auto 32px repeat}.ce-element--drop.ce-element--type-table-row:before{display:none}.ce-element--drop.ce-element--type-table-row.ce-element--drop-below{background:#f39c12 url("images/drop-vert-below.svg") center/auto 32px repeat}.ce-element--focused,.ce-element--over{background-color:rgba(243,156,18,0.1);outline:none}.ce-element--focused.ce-element--type-image,.ce-element--focused.ce-element--type-video,.ce-element--over.ce-element--type-image,.ce-element--over.ce-element--type-video{background-color:#333;outline:4px solid rgba(243,156,18,0.35)}.ce-element--resize-top-left{cursor:nw-resize}.ce-element--resize-top-right{cursor:ne-resize}.ce-element--resize-bottom-right{cursor:se-resize}.ce-element--resize-bottom-left{cursor:sw-resize}.ce-drag-helper{background:#fff;border-radius:2px;box-shadow:0 3px 3px rgba(0,0,0,0.25);color:#4e4e4e;font:arial, sans-serif;font-size:12px;height:120px;left:0;line-height:135%;margin:5px 0px 0px 5px;overflow:hidden;padding:15px;position:absolute;top:0;width:120px;word-wrap:break-word;z-index:9}.ce-drag-helper:before{background:#2980b9;color:white;content:attr(data-ce-type);display:block;font-family:arial, sans-serif;font-size:10px;line-height:10px;padding:4px 4px 3px;position:absolute;right:0;top:0}.ce-drag-helper--type-list:after,.ce-drag-helper--type-list-item-text:after,.ce-drag-helper--type-pre-text:after,.ce-drag-helper--type-table:after,.ce-drag-helper--type-table-row:after,.ce-drag-helper--type-text:after{background-image:linear-gradient(rgba(255,255,255,0), #fff 66%);bottom:0;content:'';display:block;height:40px;left:0;position:absolute;width:100%}.ce-drag-helper--type-image{background-repeat:no-repeat;background-size:cover}.ce-element--type-image,.ce-element--type-video{display:block;margin-left:auto;margin-right:auto}.ce-element--type-image.align-left,.ce-element--type-video.align-left{clear:initial;float:left}.ce-element--type-image.align-right,.ce-element--type-video.align-right{clear:initial;float:right}.ce-measure{display:block !important} diff --git a/build/content-edit.min.js b/build/content-edit.min.js index de71a44..67f1756 100644 --- a/build/content-edit.min.js +++ b/build/content-edit.min.js @@ -1,4 +1,4 @@ -/*! ContentEdit v1.2.0 by Anthony Blackshaw (https://github.com/anthonyjb) */ +/*! ContentEdit v1.2.1 by Anthony Blackshaw (https://github.com/anthonyjb) */ (function(){var a,b;a={},a.Machine=function(){function a(a){this.context=a,this._stateTransitions={},this._stateTransitionsAny={},this._defaultTransition=null,this._initialState=null,this._currentState=null}return a.prototype.addTransition=function(a,b,c,d){return c||(c=b),this._stateTransitions[[a,b]]=[c,d]},a.prototype.addTransitions=function(a,b,c,d){var e,f,g,h;for(c||(c=b),h=[],f=0,g=a.length;g>f;f++)e=a[f],h.push(this.addTransition(e,b,c,d));return h},a.prototype.addTransitionAny=function(a,b,c){return b||(b=a),this._stateTransitionsAny[a]=[b,c]},a.prototype.setDefaultTransition=function(a,b){return this._defaultTransition=[a,b]},a.prototype.getTransition=function(a,b){if(this._stateTransitions[[a,b]])return this._stateTransitions[[a,b]];if(this._stateTransitionsAny[b])return this._stateTransitionsAny[b];if(this._defaultTransition)return this._defaultTransition;throw new Error("Transition is undefined: ("+a+", "+b+")")},a.prototype.getCurrentState=function(){return this._currentState},a.prototype.setInitialState=function(a){return this._initialState=a,this._currentState?void 0:this.reset()},a.prototype.reset=function(){return this._currentState=this._initialState},a.prototype.process=function(a){var b;return b=this.getTransition(a,this._currentState),b[1]&&b[1].call(this.context||(this.context=this),a),this._currentState=b[0]},a}(),"undefined"!=typeof window&&(window.FSM=a),"undefined"!=typeof module&&module.exports&&(b=module.exports=a)}).call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=[].slice,C=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};r={},"undefined"!=typeof window&&(window.HTMLString=r),"undefined"!=typeof module&&module.exports&&(z=module.exports=r),r.String=function(){function a(a,b){null==b&&(b=!1),this._preserveWhitespace=b,a?(null===r.String._parser&&(r.String._parser=new A),this.characters=r.String._parser.parse(a,this._preserveWhitespace).characters):this.characters=[]}return a._parser=null,a.prototype.isWhitespace=function(){var a,b,c,d;for(d=this.characters,b=0,c=d.length;c>b;b++)if(a=d[b],!a.isWhitespace())return!1;return!0},a.prototype.length=function(){return this.characters.length},a.prototype.preserveWhitespace=function(){return this._preserveWhitespace},a.prototype.capitalize=function(){var a,b;return b=this.copy(),b.length()&&(a=b.characters[0]._c.toUpperCase(),b.characters[0]._c=a),b},a.prototype.charAt=function(a){return this.characters[a].copy()},a.prototype.concat=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;for(g=2<=arguments.length?B.call(arguments,0,i=arguments.length-1):(i=0,[]),c=arguments[i++],"undefined"!=typeof c&&"boolean"!=typeof c&&(g.push(c),c=!0),e=this.copy(),j=0,m=g.length;m>j;j++)if(f=g[j],0!==f.length){if(h=f,"string"==typeof f&&(h=new r.String(f,this._preserveWhitespace)),c&&e.length())for(b=e.charAt(e.length()-1),d=b.tags(),b.isTag()&&d.shift(),"string"!=typeof f&&(h=h.copy()),p=h.characters,k=0,n=p.length;n>k;k++)a=p[k],a.addTags.apply(a,d);for(q=h.characters,l=0,o=q.length;o>l;l++)a=q[l],e.characters.push(a)}return e},a.prototype.contains=function(a){var b,c,d,e,f,g,h;if("string"==typeof a)return this.text().indexOf(a)>-1;for(d=0;d<=this.length()-a.length();){for(c=!0,h=a.characters,e=f=0,g=h.length;g>f;e=++f)if(b=h[e],!b.eq(this.characters[e+d])){c=!1;break}if(c)return!0;d++}return!1},a.prototype.endsWith=function(a){var b,c,d,e,f,g;if("string"==typeof a)return""===a||this.text().slice(-a.length)===a;for(c=this.characters.slice().reverse(),g=a.characters.slice().reverse(),d=e=0,f=g.length;f>e;d=++e)if(b=g[d],!b.eq(c[d]))return!1;return!0},a.prototype.format=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?B.call(arguments,2):[],0>f&&(f=this.length()+f+1),0>b&&(b=this.length()+b),d=this.copy(),c=g=b;f>=b?f>g:g>f;c=f>=b?++g:--g)a=d.characters[c],a.addTags.apply(a,e);return d},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h;for(d=2<=arguments.length?B.call(arguments,0,e=arguments.length-1):(e=0,[]),c=arguments[e++],"undefined"!=typeof c&&"boolean"!=typeof c&&(d.push(c),c=!1),b=!1,h=this.characters,f=0,g=h.length;g>f;f++)if(a=h[f],a.hasTags.apply(a,d))b=!0;else if(c)return!1;return b},a.prototype.html=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;for(e="",h=[],f=[],c=[],t=this.characters,j=0,n=t.length;n>j;j++){for(a=t[j],c=[],u=h.slice().reverse(),k=0,o=u.length;o>k;k++)if(g=u[k],c.push(g),!a.hasTags(g)){for(l=0,p=c.length;p>l;l++)b=c[l],e+=b.tail(),h.pop(),f.pop();c=[]}for(v=a._tags,m=0,q=v.length;q>m;m++)i=v[m],-1===f.indexOf(i.head())&&(i.selfClosing()||(d=i.head(),e+=d,h.push(i),f.push(d)));a._tags.length>0&&a._tags[0].selfClosing()&&(e+=a._tags[0].head()),e+=a.c()}for(w=h.reverse(),s=0,r=w.length;r>s;s++)i=w[s],e+=i.tail();return e},a.prototype.indexOf=function(a,b){var c,d,e,f,g,h;if(null==b&&(b=0),0>b&&(b=0),"string"==typeof a)return this.text().indexOf(a,b);for(;b<=this.length()-a.length();){for(d=!0,h=a.characters,e=f=0,g=h.length;g>f;e=++f)if(c=h[e],!c.eq(this.characters[e+b])){d=!1;break}if(d)return b;b++}return-1},a.prototype.insert=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t;if(null==c&&(c=!0),e=this.slice(0,a),j=this.slice(a),0>a&&(a=this.length()+a),h=b,"string"==typeof b&&(h=new r.String(b,this._preserveWhitespace)),c&&a>0)for(f=this.charAt(a-1),g=f.tags(),f.isTag()&&g.shift(),"string"!=typeof b&&(h=h.copy()),q=h.characters,k=0,n=q.length;n>k;k++)d=q[k],d.addTags.apply(d,g);for(i=e,s=h.characters,l=0,o=s.length;o>l;l++)d=s[l],i.characters.push(d);for(t=j.characters,m=0,p=t.length;p>m;m++)d=t[m],i.characters.push(d);return i},a.prototype.lastIndexOf=function(a,b){var c,d,e,f,g,h,i,j,k;if(null==b&&(b=0),0>b&&(b=0),d=this.characters.slice(b).reverse(),b=0,"string"==typeof a){if(!this.contains(a))return-1;for(a=a.split("").reverse();b<=d.length-a.length;){for(e=!0,g=0,f=h=0,j=a.length;j>h;f=++h)if(c=a[f],d[f+b].isTag()&&(g+=1),c!==d[g+f+b].c()){e=!1;break}if(e)return b;b++}return-1}for(a=a.characters.slice().reverse();b<=d.length-a.length;){for(e=!0,f=i=0,k=a.length;k>i;f=++i)if(c=a[f],!c.eq(d[f+b])){e=!1;break}if(e)return b;b++}return-1},a.prototype.optimize=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J;for(i=[],g=[],e=null,D=this.characters.slice().reverse(),p=0,t=D.length;t>p;p++){for(a=D[p],a._runLengthMap={},a._runLengthMapSize=0,c=[],E=i.slice().reverse(),q=0,u=E.length;u>q;q++)if(h=E[q],c.push(h),!a.hasTags(h)){for(r=0,v=c.length;v>r;r++)b=c[r],i.pop(),g.pop();c=[]}for(F=a._tags,s=0,w=F.length;w>s;s++)o=F[s],-1===g.indexOf(o.head())&&(o.selfClosing()||(i.push(o),g.push(o.head())));for(A=0,x=i.length;x>A;A++)o=i[A],d=o.head(),e?(a._runLengthMap[d]||(a._runLengthMap[d]=[o,0]),m=0,e._runLengthMap[d]&&(m=e._runLengthMap[d][1]),a._runLengthMap[d][1]=m+1):a._runLengthMap[d]=[o,1];e=a}for(k=function(a,b){return b[1]-a[1]},G=this.characters,J=[],B=0,y=G.length;y>B;B++)if(a=G[B],f=a._tags.length,!(f>0&&a._tags[0].selfClosing()&&3>f||2>f)){l=[],H=a._runLengthMap;for(o in H)j=H[o],l.push(j);for(l.sort(k),I=a._tags.slice(),C=0,z=I.length;z>C;C++)o=I[C],o.selfClosing()||a.removeTags(o);J.push(a.addTags.apply(a,function(){var a,b,c;for(c=[],b=0,a=l.length;a>b;b++)n=l[b],c.push(n[0]);return c}()))}return J},a.prototype.slice=function(a,b){var c,d;return d=new r.String("",this._preserveWhitespace),d.characters=function(){var d,e,f,g;for(f=this.characters.slice(a,b),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.copy());return g}.call(this),d},a.prototype.split=function(a,b){var c,d,e,f,g,h,i,j,k,l;for(null==a&&(a=""),null==b&&(b=0),h=0,c=0,g=[0];;){if(b>0&&c>b)break;if(f=this.indexOf(a,h),-1===f)break;g.push(f),h=f+1}for(g.push(this.length()),j=[],e=k=0,l=g.length-2;l>=0?l>=k:k>=l;e=l>=0?++k:--k)i=g[e],e>0&&(i+=1),d=g[e+1],j.push(this.slice(i,d));return j},a.prototype.startsWith=function(a){var b,c,d,e,f;if("string"==typeof a)return this.text().slice(0,a.length)===a;for(f=a.characters,c=d=0,e=f.length;e>d;c=++d)if(b=f[c],!b.eq(this.characters[c]))return!1;return!0},a.prototype.substr=function(a,b){return 0>=b?new r.String("",this._preserveWhitespace):(0>a&&(a=this.length()+a),void 0===b&&(b=this.length()-a),this.slice(a,a+b))},a.prototype.substring=function(a,b){return void 0===b&&(b=this.length()),this.slice(a,b)},a.prototype.text=function(){var a,b,c,d,e;for(b="",e=this.characters,c=0,d=e.length;d>c;c++)a=e[c],a.isTag()?a.isTag("br")&&(b+="\n"):b+=(" "!==a.c(),a.c());return this.constructor.decode(b)},a.prototype.toLowerCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;d>c;c++)a=e[c],1===a._c.length&&(a._c=a._c.toLowerCase());return b},a.prototype.toUpperCase=function(){var a,b,c,d,e;for(b=this.copy(),e=b.characters,c=0,d=e.length;d>c;c++)a=e[c],1===a._c.length&&(a._c=a._c.toUpperCase());return b},a.prototype.trim=function(){var a,b,c,d,e,f,g,h,i,j;for(i=this.characters,b=e=0,g=i.length;g>e&&(a=i[b],a.isWhitespace());b=++e);for(j=this.characters.slice().reverse(),d=f=0,h=j.length;h>f&&(a=j[d],a.isWhitespace());d=++f);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;e>c;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimLeft=function(){var a,b,c,d,e,f,g;for(d=this.length()-1,g=this.characters,b=e=0,f=g.length;f>e&&(a=g[b],a.isWhitespace());b=++e);return c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;e>c;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.trimRight=function(){var a,b,c,d,e,f,g;for(b=0,g=this.characters.slice().reverse(),d=e=0,f=g.length;f>e&&(a=g[d],a.isWhitespace());d=++e);return d=this.length()-d-1,c=new r.String("",this._preserveWhitespace),c.characters=function(){var c,e,f,g;for(f=this.characters.slice(b,+d+1||9e9),g=[],c=0,e=f.length;e>c;c++)a=f[c],g.push(a.copy());return g}.call(this),c},a.prototype.unformat=function(){var a,b,c,d,e,f,g;for(b=arguments[0],f=arguments[1],e=3<=arguments.length?B.call(arguments,2):[],0>f&&(f=this.length()+f+1),0>b&&(b=this.length()+b),d=this.copy(),c=g=b;f>=b?f>g:g>f;c=f>=b?++g:--g)a=d.characters[c],a.removeTags.apply(a,e);return d},a.prototype.copy=function(){var a,b;return b=new r.String("",this._preserveWhitespace),b.characters=function(){var b,c,d,e;for(d=this.characters,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.copy());return e}.call(this),b},a.decode=function(a){var b;return b=document.createElement("textarea"),b.innerHTML=a,b.textContent},a.encode=function(a){var b;return b=document.createElement("textarea"),b.textContent=a,b.innerHTML},a.join=function(a,b){var c,d,e,f;for(c=b.shift(),e=0,f=b.length;f>e;e++)d=b[e],c=c.concat(a,d);return c},a}(),a="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-_$".split(""),b=a.concat("1234567890".split("")),h=b.concat([":"]),q=b.concat(["#"]),u=b.concat([":"]),n=1,p=2,t=3,s=4,o=5,x=6,v=7,y=8,w=9,j=10,g=11,i=12,c=13,m=14,k=15,l=16,e=17,f=18,d=19,A=function(){function z(){this.fsm=new FSM.Machine(this),this.fsm.setInitialState(n),this.fsm.addTransitionAny(n,null,function(a){return this._pushChar(a)}),this.fsm.addTransition("<",n,t),this.fsm.addTransition("&",n,p),this.fsm.addTransitions(q,p,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",p,n,function(){return this._pushChar("&"+this.entity+";"),this.entity=""}),this.fsm.addTransitions([" ","\n"],t),this.fsm.addTransitions(a,t,s,function(){return this._back()}),this.fsm.addTransition("/",t,o),this.fsm.addTransitions([" ","\n"],s),this.fsm.addTransitions(a,s,x,function(){return this._back()}),this.fsm.addTransitions([" ","\n"],o),this.fsm.addTransitions(a,o,v,function(){return this._back()}),this.fsm.addTransitions(u,x,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],x,j),this.fsm.addTransition("/",x,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",x,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],y),this.fsm.addTransition(">",y,n,function(){return this._pushTag()}),this.fsm.addTransitions([" ","\n"],j),this.fsm.addTransition("/",j,y,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",j,n,function(){return this._pushTag()}),this.fsm.addTransitions(a,j,g,function(){return this._back()}),this.fsm.addTransitions(u,v,null,function(a){return this.tagName+=a}),this.fsm.addTransitions([" ","\n"],v,w),this.fsm.addTransition(">",v,n,function(){return this._popTag()}),this.fsm.addTransitions([" ","\n"],w),this.fsm.addTransition(">",w,n,function(){return this._popTag()}),this.fsm.addTransitions(h,g,null,function(a){return this.attributeName+=a}),this.fsm.addTransitions([" ","\n"],g,i),this.fsm.addTransition("=",g,c),this.fsm.addTransitions([" ","\n"],i),this.fsm.addTransition("=",i,c),this.fsm.addTransitions(">",g,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitionAny(i,j,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitions([" ","\n"],c),this.fsm.addTransition("'",c,m),this.fsm.addTransition('"',c,k),this.fsm.addTransitions(b.concat(["&"],c,l,function(){return this._back()})),this.fsm.addTransition(" ",l,j,function(){return this._pushAttribute()}),this.fsm.addTransitions(["/",">"],l,j,function(){return this._back(),this._pushAttribute()}),this.fsm.addTransition("&",l,e),this.fsm.addTransitionAny(l,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition("'",m,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",m,f),this.fsm.addTransitionAny(m,null,function(a){return this.attributeValue+=a}),this.fsm.addTransition('"',k,j,function(){return this._pushAttribute()}),this.fsm.addTransition("&",k,d),this.fsm.addTransitionAny(k,null,function(a){return this.attributeValue+=a}),this.fsm.addTransitions(q,e,null,function(a){return this.entity+=a}),this.fsm.addTransitions(q,f,function(a){return this.entity+=a}),this.fsm.addTransitions(q,d,null,function(a){return this.entity+=a}),this.fsm.addTransition(";",e,l,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",f,m,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",d,k,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""})}return z.prototype._back=function(){return this.head--},z.prototype._pushAttribute=function(){return this.attributes[this.attributeName]=this.attributeValue,this.attributeName="",this.attributeValue=""},z.prototype._pushChar=function(a){var b,c;return b=new r.Character(a,this.tags),this._preserveWhitespace?void this.string.characters.push(b):!this.string.length()||b.isTag()||b.isEntity()||!b.isWhitespace()||(c=this.string.characters[this.string.length()-1],!c.isWhitespace()||c.isTag()||c.isEntity())?this.string.characters.push(b):void 0},z.prototype._pushTag=function(){var a,b;return a=new r.Tag(this.tagName,this.attributes),this.tags.push(a),a.selfClosing()&&(this._pushChar(""),this.tags.pop(),!this.selfClosed&&(b=this.tagName,C.call(r.Tag.SELF_CLOSING,b)>=0)&&this.fsm.reset()),this.tagName="",this.selfClosed=!1,this.attributes={}},z.prototype._popTag=function(){for(var a,b;;)if(b=this.tags.pop(),this.string.length()&&(a=this.string.characters[this.string.length()-1],a.isTag()||a.isEntity()||!a.isWhitespace()||a.removeTags(b)),b.name()===this.tagName.toLowerCase())break;return this.tagName=""},z.prototype.parse=function(a,b){var c,d;for(this._preserveWhitespace=b,this.reset(),a=this.preprocess(a),this.fsm.parser=this;this.head> "+d)}this.head++}return this.string},z.prototype.preprocess=function(a){return a=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),a=a.replace(//g,""),this._preserveWhitespace||(a=a.replace(/\s+/g," ")),a},z.prototype.reset=function(){return this.fsm.reset(),this.head=0,this.string=new r.String,this.entity="",this.tags=[],this.tagName="",this.selfClosing=!1,this.attributes={},this.attributeName="",this.attributeValue=""},z}(),r.Tag=function(){function a(a,b){var c,d;this._name=a.toLowerCase(),this._selfClosing=r.Tag.SELF_CLOSING[this._name]===!0,this._head=null,this._attributes={};for(c in b)d=b[c],this._attributes[c]=d}return a.SELF_CLOSING={area:!0,base:!0,br:!0,hr:!0,img:!0,input:!0,"link meta":!0,wbr:!0},a.prototype.head=function(){var a,b,c,d;if(!this._head){a=[],d=this._attributes;for(b in d)c=d[b],a.push(c?""+b+'="'+c+'"':""+b);a.sort(),a.unshift(this._name),this._head="<"+a.join(" ")+">"}return this._head},a.prototype.name=function(){return this._name},a.prototype.selfClosing=function(){return this._selfClosing},a.prototype.tail=function(){return this._selfClosing?"":""},a.prototype.attr=function(a,b){return void 0===b?this._attributes[a]:(this._attributes[a]=b,this._head=null)},a.prototype.removeAttr=function(a){return void 0!==this._attributes[a]?(delete this._attributes[a],this._head=null):void 0},a.prototype.copy=function(){return new r.Tag(this._name,this._attributes)},a}(),r.Character=function(){function a(a,b){this._c=a,a.length>1&&(this._c=a.toLowerCase()),this._tags=[],this.addTags.apply(this,b)}return a.prototype.c=function(){return this._c},a.prototype.isEntity=function(){return this._c.length>1},a.prototype.isTag=function(a){return 0!==this._tags.length&&this._tags[0].selfClosing()?a&&this._tags[0].name()!==a?!1:!0:!1},a.prototype.isWhitespace=function(){var a;return" "===(a=this._c)||"\n"===a||" "===a||this.isTag("br")},a.prototype.tags=function(){var a;return function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.copy());return e}.call(this)},a.prototype.addTags=function(){var a,b,c,d,e;for(b=1<=arguments.length?B.call(arguments,0):[],e=[],c=0,d=b.length;d>c;c++)a=b[c],Array.isArray(a)||(a.selfClosing()?this.isTag()||this._tags.unshift(a.copy()):e.push(this._tags.push(a.copy())));return e},a.prototype.eq=function(a){var b,c,d,e,f,g,h,i;if(this.c()!==a.c())return!1;if(this._tags.length!==a._tags.length)return!1;for(c={},h=this._tags,d=0,f=h.length;f>d;d++)b=h[d],c[b.head()]=!0;for(i=a._tags,e=0,g=i.length;g>e;e++)if(b=i[e],!c[b.head()])return!1;return!0},a.prototype.hasTags=function(){var a,b,c,d,e,f,g,h,i;for(d=1<=arguments.length?B.call(arguments,0):[],c={},b={},i=this._tags,e=0,g=i.length;g>e;e++)a=i[e],c[a.name()]=!0,b[a.head()]=!0;for(f=0,h=d.length;h>f;f++)if(a=d[f],"string"==typeof a){if(void 0===c[a])return!1}else if(void 0===b[a.head()])return!1;return!0},a.prototype.removeTags=function(){var a,b,c,d,e,f,g;if(e=1<=arguments.length?B.call(arguments,0):[],0===e.length)return void(this._tags=[]);for(b={},a={},f=0,g=e.length;g>f;f++)d=e[f],"string"==typeof d?b[d]=d:a[d.head()]=d;return c=[],this._tags=this._tags.filter(function(c){return a[c.head()]||b[c.name()]?void 0:c})},a.prototype.copy=function(){var a;return new r.Character(this._c,function(){var b,c,d,e;for(d=this._tags,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.copy());return e}.call(this))},a}()}.call(this),function(){var a,b,c,d,e,f,g,h=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};a={},a.Range=function(){function c(a,b){this.set(a,b)}return c.prototype.isCollapsed=function(){return this._from===this._to},c.prototype.span=function(){return this._to-this._from},c.prototype.collapse=function(){return this._to=this._from},c.prototype.eq=function(a){return this.get()[0]===a.get()[0]&&this.get()[1]===a.get()[1]},c.prototype.get=function(){return[this._from,this._to]},c.prototype.select=function(b){var c,d,f,g,h,i,j,k,l;return a.Range.unselectAll(),c=document.createRange(),k=e(b,this._from),h=k[0],j=k[1],l=e(b,this._to),d=l[0],g=l[1],i=h.length||0,f=d.length||0,c.setStart(h,Math.min(j,i)),c.setEnd(d,Math.min(g,f)),window.getSelection().addRange(c)},c.prototype.set=function(a,b){return a=Math.max(0,a),b=Math.max(0,b),this._from=Math.min(a,b),this._to=Math.max(a,b)},c.prepareElement=function(a){var c,d,e,f,g,h;for(e=a.querySelectorAll(b.join(", ")),h=[],c=f=0,g=e.length;g>f;c=++f)d=e[c],d.parentNode.insertBefore(document.createTextNode(""),d),h.push(cb;b++)g=d[b],e.push(g);return e}();f.length>0;)switch(d=f.shift(),d.nodeType){case Node.TEXT_NODE:if(d.textContent.length>=e)return[d,e];e-=d.textContent.length;break;case Node.ELEMENT_NODE:if(i=d.nodeName.toLowerCase(),h.call(b,i)>=0){if(0===e)return[d,0];e=Math.max(0,e-1)}else d.childNodes&&Array.prototype.unshift.apply(f,function(){var a,b,c,e;for(c=d.childNodes,e=[],a=0,b=c.length;b>a;a++)g=c[a],e.push(g);return e}())}return[d,e]},g=function(a,c){var d,e,f,g,i,j;if(0===a.childNodes.length)return 0;for(f=0,d=function(){var b,c,d,f;for(d=a.childNodes,f=[],b=0,c=d.length;c>b;b++)e=d[b],f.push(e);return f}();d.length>0;){if(g=d.shift(),g===c)return i=g.nodeName.toLowerCase(),h.call(b,i)>=0?f+1:f;switch(g.nodeType){case Node.TEXT_NODE:f+=g.textContent.length;break;case Node.ELEMENT_NODE:j=g.nodeName.toLowerCase(),h.call(b,j)>=0?f+=1:g.childNodes&&Array.prototype.unshift.apply(d,function(){var a,b,c,d;for(c=g.childNodes,d=[],a=0,b=c.length;b>a;a++)e=c[a],d.push(e);return d}())}}return f},f=function(a,c){var d,e,f,g,i,j,k,l,m,n,o,p,q,r;if(e=a.childNodes,m=c.cloneRange(),m.collapse(!0),i=c.cloneRange(),i.collapse(!1),k=m.startContainer,l=m.startOffset,f=i.endContainer,g=i.endOffset,!m.comparePoint)return[k,l,f,g];if(k===a)for(k=e[e.length-1],l=k.textContent.length,j=n=0,p=e.length;p>n;j=++n)if(d=e[j],1===m.comparePoint(d,0)){0===j?(k=d,l=0):(k=e[j-1],l=d.textContent.length),r=k.nodeName.toLowerCase,h.call(b,r)>=0&&(l=1);break}if(c.collapsed)return[k,l,k,l];if(f===a)for(f=e[e.length-1],g=f.textContent.length,j=o=0,q=e.length;q>o;j=++o)d=e[j],1===i.comparePoint(d,0)&&(f=0===j?d:e[j-1],g=d.textContent.length+1);return[k,l,f,g]},"undefined"!=typeof window&&(window.ContentSelect=a),"undefined"!=typeof module&&module.exports&&(c=module.exports=a)}.call(this),function(){var a,b,c,d,e,f=[].slice,g=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},h={}.hasOwnProperty,i=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},j=function(a,b){return function(){return a.apply(b,arguments)}};a={ALIGNMENT_CLASS_NAMES:{left:"align-left",right:"align-right"},DEFAULT_MAX_ELEMENT_WIDTH:800,DEFAULT_MIN_ELEMENT_WIDTH:80,DRAG_HOLD_DURATION:500,DROP_EDGE_SIZE:50,HELPER_CHAR_LIMIT:250,INDENT:" ",LANGUAGE:"en",LINE_ENDINGS:"\n",PREFER_LINE_BREAKS:!1,RESIZE_CORNER_SIZE:15,TRIM_WHITESPACE:!0,_translations:{},_:function(b){var c;return c=a.LANGUAGE,a._translations[c]&&a._translations[c][b]?a._translations[c][b]:b},addTranslations:function(b,c){return a._translations[b]=c},addCSSClass:function(a,b){var c,d,e;return a.classList?void a.classList.add(b):(d=a.getAttribute("class"),d?(e=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;b>a;a++)c=e[a],f.push(c);return f}(),-1===e.indexOf(b)?a.setAttribute("class",""+d+" "+b):void 0):a.setAttribute("class",b))},attributesToString:function(a){var b,c,d,e,f,g;if(!a)return"";for(d=function(){var b;b=[];for(c in a)b.push(c);return b}(),d.sort(),b=[],f=0,g=d.length;g>f;f++)c=d[f],e=a[c],""===e?b.push(c):(e=HTMLString.String.encode(e),e=e.replace(/"/g,"""),b.push(""+c+'="'+e+'"'));return b.join(" ")},removeCSSClass:function(a,b){var c,d,e,f;return a.classList?(a.classList.remove(b),void(0===a.classList.length&&a.removeAttribute("class"))):(d=a.getAttribute("class"),d&&(f=function(){var a,b,e,f;for(e=d.split(" "),f=[],a=0,b=e.length;b>a;a++)c=e[a],f.push(c);return f}(),e=f.indexOf(b),e>-1)?(f.splice(e,1),f.length?a.setAttribute("class",f.join(" ")):a.removeAttribute("class")):void 0)}},"undefined"!=typeof window&&(window.ContentEdit=a),"undefined"!=typeof module&&module.exports&&(b=module.exports=a),d=function(){function b(){this._tagNames={}}return b.prototype.register=function(){var a,b,c,d,e,g;for(a=arguments[0],c=2<=arguments.length?f.call(arguments,1):[],g=[],d=0,e=c.length;e>d;d++)b=c[d],g.push(this._tagNames[b.toLowerCase()]=a);return g},b.prototype.match=function(b){return b=b.toLowerCase(),this._tagNames[b]?this._tagNames[b]:a.Static},b}(),a.TagNames=function(){function a(){}var b;return b=null,a.get=function(){return null!=b?b:b=new d},a}(),a.Node=function(){function b(){this._bindings={},this._parent=null,this._modified=null}return b.prototype.lastModified=function(){return this._modified},b.prototype.parent=function(){return this._parent},b.prototype.parents=function(){var a,b;for(b=[],a=this._parent;a;)b.push(a),a=a._parent;return b},b.prototype.type=function(){return"Node"},b.prototype.html=function(a){throw null==a&&(a=""),new Error("`html` not implemented")},b.prototype.bind=function(a,b){return void 0===this._bindings[a]&&(this._bindings[a]=[]),this._bindings[a].push(b),b},b.prototype.trigger=function(){var a,b,c,d,e,g,h;if(c=arguments[0],a=2<=arguments.length?f.call(arguments,1):[],this._bindings[c]){for(g=this._bindings[c],h=[],d=0,e=g.length;e>d;d++)b=g[d],b&&h.push(b.call.apply(b,[this].concat(f.call(a))));return h}},b.prototype.unbind=function(a,b){var c,d,e,f,g,h;if(!a)return void(this._bindings={});if(!b)return void(this._bindings[a]=void 0);if(this._bindings[a]){for(g=this._bindings[a],h=[],c=e=0,f=g.length;f>e;c=++e)d=g[c],h.push(d===b?this._bindings[a].splice(c,1):void 0);return h}},b.prototype.commit=function(){return this._modified=null,a.Root.get().trigger("commit",this)},b.prototype.taint=function(){var b,c,d,e,f,g;for(b=Date.now(),this._modified=b,g=this.parents(),e=0,f=g.length;f>e;e++)c=g[e],c._modified=b;return d=a.Root.get(),d._modified=b,d.trigger("taint",this)},b.prototype.closest=function(a){var b;for(b=this.parent();b&&!a(b);)b=b.parent?b.parent():null;return b},b.prototype.next=function(){var a,b,c,d,e,f;if(this.children&&this.children.length>0)return this.children[0];for(f=[this].concat(this.parents()),d=0,e=f.length;e>d;d++){if(c=f[d],!c.parent())return null;if(a=c.parent().children,b=a.indexOf(c),b=0||(this.prototype[b]=c);return this},b.fromDOMElement=function(){throw new Error("`fromDOMElement` not implemented")},b}(),a.NodeCollection=function(b){function c(){c.__super__.constructor.call(this),this.children=[]}return i(c,b),c.prototype.descendants=function(){var a,b,c;for(a=[],c=this.children.slice();c.length>0;)b=c.shift(),a.push(b),b.children&&b.children.length>0&&(c=b.children.slice().concat(c));return a},c.prototype.isMounted=function(){return!1},c.prototype.type=function(){return"NodeCollection"},c.prototype.attach=function(b,c){return b.parent()&&b.parent().detach(b),b._parent=this,void 0!==c?this.children.splice(c,0,b):this.children.push(b),b.mount&&this.isMounted()&&b.mount(),this.taint(),a.Root.get().trigger("attach",this,b)},c.prototype.commit=function(){var b,c,d,e;for(e=this.descendants(),c=0,d=e.length;d>c;c++)b=e[c],b._modified=null;return this._modified=null,a.Root.get().trigger("commit",this)},c.prototype.detach=function(b){var c;return c=this.children.indexOf(b),-1!==c?(b.unmount&&this.isMounted()&&b.isMounted()&&b.unmount(),this.children.splice(c,1),b._parent=null,this.taint(),a.Root.get().trigger("detach",this,b)):void 0},c}(a.Node),a.Element=function(b){function c(a,b){c.__super__.constructor.call(this),this._tagName=a.toLowerCase(),this._attributes=b?b:{},this._domElement=null,this._behaviours={drag:!0,drop:!0,merge:!0,remove:!0,resize:!0,spawn:!0}}return i(c,b),c.prototype.attributes=function(){var a,b,c,d;a={},d=this._attributes;for(b in d)c=d[b],a[b]=c;return a},c.prototype.cssTypeName=function(){return"element"},c.prototype.domElement=function(){return this._domElement},c.prototype.isFixed=function(){return this.parent()&&"Fixture"===this.parent().type()},c.prototype.isFocused=function(){return a.Root.get().focused()===this},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"Element"},c.prototype.typeName=function(){return"Element"},c.prototype.addCSSClass=function(a){var b;return b=!1,this.hasCSSClass(a)||(b=!0,this.attr("class")?this.attr("class",""+this.attr("class")+" "+a):this.attr("class",a)),this._addCSSClass(a),b?this.taint():void 0},c.prototype.attr=function(a,b){return a=a.toLowerCase(),void 0===b?this._attributes[a]:(this._attributes[a]=b,this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.setAttribute(a,b),this.taint())},c.prototype.blur=function(){var b;return b=a.Root.get(),this.isFocused()?(this._removeCSSClass("ce-element--focused"),b._focused=null,b.trigger("blur",this)):void 0},c.prototype.can=function(a,b){return void 0===b?!this.isFixed()&&this._behaviours[a]:this._behaviours[a]=b},c.prototype.createDraggingDOMElement=function(){var b;if(this.isMounted())return b=document.createElement("div"),b.setAttribute("class","ce-drag-helper ce-drag-helper--type-"+this.cssTypeName()),b.setAttribute("data-ce-type",a._(this.typeName())),b},c.prototype.drag=function(b,c){var d;if(this.isMounted()&&this.can("drag"))return d=a.Root.get(),d.startDragging(this,b,c),d.trigger("drag",this)},c.prototype.drop=function(b,c){var d;if(this.can("drop")){if(d=a.Root.get(),b){if(b._removeCSSClass("ce-element--drop"),b._removeCSSClass("ce-element--drop-"+c[0]),b._removeCSSClass("ce-element--drop-"+c[1]),this.constructor.droppers[b.type()])return this.constructor.droppers[b.type()](this,b,c),void d.trigger("drop",this,b,c);if(b.constructor.droppers[this.type()])return b.constructor.droppers[this.type()](this,b,c),void d.trigger("drop",this,b,c)}return d.trigger("drop",this,null,null)}},c.prototype.focus=function(b){var c;return c=a.Root.get(),this.isFocused()?void 0:(c.focused()&&c.focused().blur(),this._addCSSClass("ce-element--focused"),c._focused=this,this.isMounted()&&!b&&this.domElement().focus(),c.trigger("focus",this)) },c.prototype.hasCSSClass=function(a){var b,c;return this.attr("class")&&(c=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(b);return e}.call(this),c.indexOf(a)>-1)?!0:!1},c.prototype.merge=function(a){return this.can("merge")&&this.can("remove")?this.constructor.mergers[a.type()]?this.constructor.mergers[a.type()](a,this):a.constructor.mergers[this.type()]?a.constructor.mergers[this.type()](a,this):void 0:!1},c.prototype.mount=function(){var b;return this._domElement||(this._domElement=document.createElement(this.tagName())),b=this.nextSibling(),b?this.parent().domElement().insertBefore(this._domElement,b.domElement()):this.isFixed()?(this.parent().domElement().parentNode.replaceChild(this._domElement,this.parent().domElement()),this.parent()._domElement=this._domElement):this.parent().domElement().appendChild(this._domElement),this._addDOMEventListeners(),this._addCSSClass("ce-element"),this._addCSSClass("ce-element--type-"+this.cssTypeName()),this.isFocused()&&this._addCSSClass("ce-element--focused"),a.Root.get().trigger("mount",this)},c.prototype.removeAttr=function(a){return a=a.toLowerCase(),this._attributes[a]?(delete this._attributes[a],this.isMounted()&&"class"!==a.toLowerCase()&&this._domElement.removeAttribute(a),this.taint()):void 0},c.prototype.removeCSSClass=function(a){var b,c,d;if(this.hasCSSClass(a))return d=function(){var a,c,d,e;for(d=this.attr("class").split(" "),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(b);return e}.call(this),c=d.indexOf(a),c>-1&&d.splice(c,1),d.length?this.attr("class",d.join(" ")):this.removeAttr("class"),this._removeCSSClass(a),this.taint()},c.prototype.tagName=function(a){return void 0===a?this._tagName:(this._tagName=a.toLowerCase(),this.isMounted()&&(this.unmount(),this.mount()),this.taint())},c.prototype.unmount=function(){return this._removeDOMEventListeners(),this.isFixed()?(this._removeCSSClass("ce-element"),this._removeCSSClass("ce-element--type-"+this.cssTypeName()),void this._removeCSSClass("ce-element--focused")):(this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,a.Root.get().trigger("unmount",this))},c.prototype._addDOMEventListeners=function(){var a,b,c,d;this._domEventHandlers={dragstart:function(){return function(a){return a.preventDefault()}}(this),focus:function(){return function(a){return a.preventDefault()}}(this),keydown:function(a){return function(b){return a._onKeyDown(b)}}(this),keyup:function(a){return function(b){return a._onKeyUp(b)}}(this),mousedown:function(a){return function(b){return 0===b.button?a._onMouseDown(b):void 0}}(this),mousemove:function(a){return function(b){return a._onMouseMove(b)}}(this),mouseover:function(a){return function(b){return a._onMouseOver(b)}}(this),mouseout:function(a){return function(b){return a._onMouseOut(b)}}(this),mouseup:function(a){return function(b){return 0===b.button?a._onMouseUp(b):void 0}}(this),dragover:function(){return function(a){return a.preventDefault()}}(this),drop:function(a){return function(b){return a._onNativeDrop(b)}}(this),paste:function(a){return function(b){return a._onPaste(b)}}(this)},c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.addEventListener(b,a));return d},c.prototype._onKeyDown=function(){},c.prototype._onKeyUp=function(){},c.prototype._onMouseDown=function(){return this.focus?this.focus(!0):void 0},c.prototype._onMouseMove=function(a){return this._onOver(a)},c.prototype._onMouseOver=function(a){return this._onOver(a)},c.prototype._onMouseOut=function(){var b,c;return this._removeCSSClass("ce-element--over"),c=a.Root.get(),b=c.dragging(),b?(this._removeCSSClass("ce-element--drop"),this._removeCSSClass("ce-element--drop-above"),this._removeCSSClass("ce-element--drop-below"),this._removeCSSClass("ce-element--drop-center"),this._removeCSSClass("ce-element--drop-left"),this._removeCSSClass("ce-element--drop-right"),c._dropTarget=null):void 0},c.prototype._onMouseUp=function(){return this._ieMouseDownEchoed=!1},c.prototype._onNativeDrop=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("native-drop",this,b)},c.prototype._onPaste=function(b){return b.preventDefault(),b.stopPropagation(),a.Root.get().trigger("paste",this,b)},c.prototype._onOver=function(){var b,c;return this._addCSSClass("ce-element--over"),c=a.Root.get(),b=c.dragging(),b&&b!==this&&!c._dropTarget&&this.can("drop")&&(this.constructor.droppers[b.type()]||b.constructor.droppers[this.type()])?(this._addCSSClass("ce-element--drop"),c._dropTarget=this):void 0},c.prototype._removeDOMEventListeners=function(){var a,b,c,d;c=this._domEventHandlers,d=[];for(b in c)a=c[b],d.push(this._domElement.removeEventListener(b,a));return d},c.prototype._addCSSClass=function(b){return this.isMounted()?a.addCSSClass(this._domElement,b):void 0},c.prototype._attributesToString=function(){return Object.getOwnPropertyNames(this._attributes).length>0?" "+a.attributesToString(this._attributes):""},c.prototype._removeCSSClass=function(b){return this.isMounted()?a.removeCSSClass(this._domElement,b):void 0},c.droppers={},c.mergers={},c.placements=["above","below"],c.getDOMElementAttributes=function(a){var b,c,d,e,f;if(!a.hasAttributes())return{};for(c={},f=a.attributes,d=0,e=f.length;e>d;d++)b=f[d],c[b.name.toLowerCase()]=b.value;return c},c._dropVert=function(a,b,c){var d;return a.parent().detach(a),d=b.parent().children.indexOf(b),"below"===c[0]&&(d+=1),b.parent().attach(a,d)},c._dropBoth=function(b,c,d){var e,f,g,h,i,j,k,l;if(b.parent().detach(b),i=c.parent().children.indexOf(c),"below"===d[0]&&"center"===d[1]&&(i+=1),f=a.ALIGNMENT_CLASS_NAMES.left,g=a.ALIGNMENT_CLASS_NAMES.right,b.a){if(b._removeCSSClass(f),b._removeCSSClass(g),b.a["class"]){for(e=[],l=b.a["class"].split(" "),j=0,k=l.length;k>j;j++)h=l[j],h!==f&&h!==g&&e.push(h);e.length?b.a["class"]=e.join(" "):delete b.a["class"]}}else b.removeCSSClass(f),b.removeCSSClass(g);return"left"===d[1]&&(b.a?(b.a["class"]?b.a["class"]+=" "+f:b.a["class"]=f,b._addCSSClass(f)):b.addCSSClass(f)),"right"===d[1]&&(b.a?(b.a["class"]?b.a["class"]+=" "+g:b.a["class"]=g,b._addCSSClass(g)):b.addCSSClass(g)),c.parent().attach(b,i)},c}(a.Node),a.ElementCollection=function(b){function c(b,d){c.__super__.constructor.call(this,b,d),a.NodeCollection.prototype.constructor.call(this)}return i(c,b),c.extend(a.NodeCollection),c.prototype.cssTypeName=function(){return"element-collection"},c.prototype.isMounted=function(){return null!==this._domElement},c.prototype.type=function(){return"ElementCollection"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.detach=function(b){return a.NodeCollection.prototype.detach.call(this,b),0===this.children.length&&this.parent()?this.parent().detach(this):void 0},c.prototype.html=function(b){var c,d,e,f;return null==b&&(b=""),e=function(){var c,e,f,g;for(f=this.children,g=[],c=0,e=f.length;e>c;c++)d=f[c],g.push(d.html(b+a.INDENT));return g}.call(this),f=a.LINE_ENDINGS,this.isFixed()?e.join(f):(c=this._attributesToString(),""+b+"<"+this.tagName()+c+">"+f+(""+e.join(f)+f)+(""+b+""))},c.prototype.mount=function(){var a,b,d,e,f,g,h,i;this._domElement=document.createElement(this._tagName),g=this._attributes;for(b in g)d=g[b],this._domElement.setAttribute(b,d);for(c.__super__.mount.call(this),h=this.children,i=[],e=0,f=h.length;f>e;e++)a=h[e],i.push(a.mount());return i},c.prototype.unmount=function(){var a,b,d,e;for(e=this.children,b=0,d=e.length;d>b;b++)a=e[b],a.unmount();return c.__super__.unmount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c}(a.Element),a.ResizableElement=function(b){function c(a,b){c.__super__.constructor.call(this,a,b),this._domSizeInfoElement=null,this._aspectRatio=1}return i(c,b),c.prototype.aspectRatio=function(){return this._aspectRatio},c.prototype.maxSize=function(){var b;return b=parseInt(this.attr("data-ce-max-width")||0),b||(b=a.DEFAULT_MAX_ELEMENT_WIDTH),b=Math.max(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.minSize=function(){var b;return b=parseInt(this.attr("data-ce-min-width")||0),b||(b=a.DEFAULT_MIN_ELEMENT_WIDTH),b=Math.min(b,this.size()[0]),[b,b*this.aspectRatio()]},c.prototype.type=function(){return"ResizableElement"},c.prototype.mount=function(){return c.__super__.mount.call(this),this._domElement.setAttribute("data-ce-size",this._getSizeInfo())},c.prototype.resize=function(b,c,d){return this.isMounted()&&this.can("resize")?a.Root.get().startResizing(this,b,c,d,!0):void 0},c.prototype.size=function(a){var b,c,d,e;return a?(a[0]=parseInt(a[0]),a[1]=parseInt(a[1]),d=this.minSize(),a[0]=Math.max(a[0],d[0]),a[1]=Math.max(a[1],d[1]),c=this.maxSize(),a[0]=Math.min(a[0],c[0]),a[1]=Math.min(a[1],c[1]),this.attr("width",parseInt(a[0])),this.attr("height",parseInt(a[1])),this.isMounted()?(this._domElement.style.width=""+a[0]+"px",this._domElement.style.height=""+a[1]+"px",this._domElement.setAttribute("data-ce-size",this._getSizeInfo())):void 0):(e=parseInt(this.attr("width")||1),b=parseInt(this.attr("height")||1),[e,b])},c.prototype._onMouseDown=function(a){var b;return c.__super__._onMouseDown.call(this,a),b=this._getResizeCorner(a.clientX,a.clientY),b?this.resize(b,a.clientX,a.clientY):(clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150))},c.prototype._onMouseMove=function(a){var b;return c.__super__._onMouseMove.call(this),this.can("resize")?(this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right"),b=this._getResizeCorner(a.clientX,a.clientY),b?this._addCSSClass("ce-element--resize-"+b[0]+"-"+b[1]):void 0):void 0},c.prototype._onMouseOut=function(){return c.__super__._onMouseOut.call(this),this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right")},c.prototype._onMouseUp=function(){return c.__super__._onMouseUp.call(this),this._dragTimeout?clearTimeout(this._dragTimeout):void 0},c.prototype._getResizeCorner=function(b,c){var d,e,f,g,h;return f=this._domElement.getBoundingClientRect(),h=[b-f.left,c-f.top],b=h[0],c=h[1],g=this.size(),e=a.RESIZE_CORNER_SIZE,e=Math.min(e,Math.max(parseInt(g[0]/4),1)),e=Math.min(e,Math.max(parseInt(g[1]/4),1)),d=null,e>b?e>c?d=["top","left"]:c>f.height-e&&(d=["bottom","left"]):b>f.width-e&&(e>c?d=["top","right"]:c>f.height-e&&(d=["bottom","right"])),d},c.prototype._getSizeInfo=function(){var a;return a=this.size(),"w "+a[0]+" × h "+a[1]},c}(a.Element),a.Region=function(b){function c(a){c.__super__.constructor.call(this),this._domElement=a,this.setContent(a)}return i(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Region"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c.prototype.setContent=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;for(h=b,void 0===b.childNodes&&(k=document.createElement("div"),k.innerHTML=b,h=k),p=this.children.slice(),l=0,n=p.length;n>l;l++)d=p[l],this.detach(d);for(j=a.TagNames.get(),f=function(){var a,b,d,e;for(d=h.childNodes,e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(c);return e}(),m=0,o=f.length;o>m;m++)e=f[m],1===e.nodeType&&(g=j.match(e.getAttribute("data-ce-tag")?e.getAttribute("data-ce-tag"):e.tagName),i=g.fromDOMElement(e),h.removeChild(e),i&&this.attach(i));return a.Root.get().trigger("ready",this)},c}(a.NodeCollection),a.Fixture=function(b){function c(b){var d,e,f;c.__super__.constructor.call(this),this._domElement=b,f=a.TagNames.get(),d=f.match(this._domElement.getAttribute("data-ce-tag")?this._domElement.getAttribute("data-ce-tag"):this._domElement.tagName),e=d.fromDOMElement(this._domElement),this.children=[e],e._parent=this,e.mount(),a.Root.get().trigger("ready",this)}return i(c,b),c.prototype.domElement=function(){return this._domElement},c.prototype.isMounted=function(){return!0},c.prototype.type=function(){return"Fixture"},c.prototype.html=function(b){var c,d;return null==b&&(b=""),d=a.LINE_ENDINGS,function(){var a,d,e,f;for(e=this.children,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c.html(b));return f}.call(this).join(d).trim()},c}(a.NodeCollection),c=function(b){function c(){this._onStopResizing=j(this._onStopResizing,this),this._onResize=j(this._onResize,this),this._onStopDragging=j(this._onStopDragging,this),this._onDrag=j(this._onDrag,this),c.__super__.constructor.call(this),this._focused=null,this._dragging=null,this._dropTarget=null,this._draggingDOMElement=null,this._resizing=null,this._resizingInit=null}return i(c,b),c.prototype.dragging=function(){return this._dragging},c.prototype.dropTarget=function(){return this._dropTarget},c.prototype.focused=function(){return this._focused},c.prototype.resizing=function(){return this._resizing},c.prototype.type=function(){return"Root"},c.prototype.cancelDragging=function(){return this._dragging?(document.body.removeChild(this._draggingDOMElement),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._dragging._removeCSSClass("ce-element--dragging"),this._dragging=null,this._dropTarget=null,a.removeCSSClass(document.body,"ce--dragging")):void 0},c.prototype.startDragging=function(b,c,d){return this._dragging?void 0:(this._dragging=b,this._dragging._addCSSClass("ce-element--dragging"),this._draggingDOMElement=this._dragging.createDraggingDOMElement(),document.body.appendChild(this._draggingDOMElement),this._draggingDOMElement.style.left=""+c+"px",this._draggingDOMElement.style.top=""+d+"px",document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),a.addCSSClass(document.body,"ce--dragging"))},c.prototype._getDropPlacement=function(b,c){var d,e,f,g;return this._dropTarget?(e=this._dropTarget.domElement().getBoundingClientRect(),g=[b-e.left,c-e.top],b=g[0],c=g[1],d="center",be.width-a.DROP_EDGE_SIZE&&(d="right"),f="above",c>e.height/2&&(f="below"),[f,d]):null},c.prototype._onDrag=function(a){var b,c,d;return ContentSelect.Range.unselectAll(),this._draggingDOMElement.style.left=""+a.pageX+"px",this._draggingDOMElement.style.top=""+a.pageY+"px",this._dropTarget&&(b=this._getDropPlacement(a.clientX,a.clientY),this._dropTarget._removeCSSClass("ce-element--drop-above"),this._dropTarget._removeCSSClass("ce-element--drop-below"),this._dropTarget._removeCSSClass("ce-element--drop-center"),this._dropTarget._removeCSSClass("ce-element--drop-left"),this._dropTarget._removeCSSClass("ce-element--drop-right"),c=b[0],g.call(this._dragging.constructor.placements,c)>=0&&this._dropTarget._addCSSClass("ce-element--drop-"+b[0]),d=b[1],g.call(this._dragging.constructor.placements,d)>=0)?this._dropTarget._addCSSClass("ce-element--drop-"+b[1]):void 0},c.prototype._onStopDragging=function(a){var b;return b=this._getDropPlacement(a.clientX,a.clientY),this._dragging.drop(this._dropTarget,b),this.cancelDragging()},c.prototype.startResizing=function(b,c,d,e,f){var g,h;if(!this._resizing)return this._resizing=b,this._resizingInit={corner:c,fixed:f,origin:[d,e],size:b.size()},this._resizing._addCSSClass("ce-element--resizing"),h=this._resizing.parent().domElement(),g=document.createElement("div"),g.setAttribute("class","ce-measure"),h.appendChild(g),this._resizingParentWidth=g.getBoundingClientRect().width,h.removeChild(g),document.addEventListener("mousemove",this._onResize),document.addEventListener("mouseup",this._onStopResizing),a.addCSSClass(document.body,"ce--resizing")},c.prototype._onResize=function(a){var b,c,d,e;return ContentSelect.Range.unselectAll(),d=this._resizingInit.origin[0]-a.clientX,"right"===this._resizingInit.corner[1]&&(d=-d),c=this._resizingInit.size[0]+d,c=Math.min(c,this._resizingParentWidth),this._resizingInit.fixed?b=c*this._resizing.aspectRatio():(e=this._resizingInit.origin[1]-a.clientY,"bottom"===this._resizingInit.corner[0]&&(e=-e),b=this._resizingInit.size[1]+e),this._resizing.size([c,b])},c.prototype._onStopResizing=function(){return document.removeEventListener("mousemove",this._onResize),document.removeEventListener("mouseup",this._onStopResizing),this._resizing._removeCSSClass("ce-element--resizing"),this._resizing=null,this._resizingInit=null,this._resizingParentWidth=null,a.removeCSSClass(document.body,"ce--resizing")},c}(a.Node),a.Root=function(){function a(){}var b;return b=null,a.get=function(){return null!=b?b:b=new c},a}(),a.Static=function(b){function c(a,b,d){c.__super__.constructor.call(this,a,b),this._content=d}return i(c,b),c.prototype.cssTypeName=function(){return"static"},c.prototype.type=function(){return"Static"},c.prototype.typeName=function(){return"Static"},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=this._domElement.textContent,d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.html=function(a){return null==a&&(a=""),HTMLString.Tag.SELF_CLOSING[this._tagName]?""+a+"<"+this._tagName+this._attributesToString()+">":""+a+"<"+this._tagName+this._attributesToString()+">"+this._content+(""+a+"")},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this._domElement.innerHTML=this._content,c.__super__.mount.call(this)},c.prototype.blur=void 0,c.prototype.focus=void 0,c.prototype._onMouseDown=function(a){return c.__super__._onMouseDown.call(this,a),void 0!==this.attr("data-ce-moveable")?(clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(b){return function(){return b.drag(a.pageX,a.pageY)}}(this),150)):void 0},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._onMouseUp=function(a){return c.__super__._onMouseUp.call(this,a),this._dragTimeout?clearTimeout(this._dragTimeout):void 0},c.droppers={Static:a.Element._dropVert},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Element),a.TagNames.get().register(a.Static,"static"),a.Text=function(b){function c(b,d,e){c.__super__.constructor.call(this,b,d),this.content=e instanceof HTMLString.String?e:a.TRIM_WHITESPACE?new HTMLString.String(e).trim():new HTMLString.String(e,!0)}return i(c,b),c.prototype.cssTypeName=function(){return"text"},c.prototype.type=function(){return"Text"},c.prototype.typeName=function(){return"Text"},c.prototype.blur=function(){return this.isMounted()&&this._syncContent(),this.content.isWhitespace()&&this.can("remove")?this.parent()&&this.parent().detach(this):this.isMounted()&&(document.documentMode||/Edge/.test(navigator.userAgent)||this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),c.__super__.blur.call(this)},c.prototype.createDraggingDOMElement=function(){var b,d;if(this.isMounted())return b=c.__super__.createDraggingDOMElement.call(this),d=HTMLString.String.encode(this._domElement.textContent),d.length>a.HELPER_CHAR_LIMIT&&(d=d.substr(0,a.HELPER_CHAR_LIMIT)),b.innerHTML=d,b},c.prototype.drag=function(a,b){return this.storeState(),this._domElement.removeAttribute("contenteditable"),c.__super__.drag.call(this,a,b)},c.prototype.drop=function(a,b){return c.__super__.drop.call(this,a,b),this.restoreState()},c.prototype.focus=function(a){return this.isMounted()&&this._domElement.setAttribute("contenteditable",""),c.__super__.focus.call(this,a)},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),(!this._lastCached||this._lastCached"+e+(""+b+a.INDENT+this._cached+e)+(""+b+""))},c.prototype.mount=function(){var a,b,d;this._domElement=document.createElement(this._tagName),d=this._attributes;for(a in d)b=d[a],this._domElement.setAttribute(a,b);return this.updateInnerHTML(),c.__super__.mount.call(this)},c.prototype.restoreState=function(){return this._savedSelection?this.isMounted()&&this.isFocused()?(this._domElement.setAttribute("contenteditable",""),this._addCSSClass("ce-element--focused"),document.activeElement!==this.domElement()&&this.domElement().focus(),this._savedSelection.select(this._domElement),this._savedSelection=void 0):void(this._savedSelection=void 0):void 0},c.prototype.selection=function(a){return void 0===a?this.isMounted()?ContentSelect.Range.query(this._domElement):new ContentSelect.Range(0,0):a.select(this._domElement)},c.prototype.storeState=function(){return this.isMounted()&&this.isFocused()?this._savedSelection=ContentSelect.Range.query(this._domElement):void 0},c.prototype.unmount=function(){return this._domElement.removeAttribute("contenteditable"),c.__super__.unmount.call(this)},c.prototype.updateInnerHTML=function(){return this._domElement.innerHTML=this.content.html(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._onKeyDown=function(a){switch(a.keyCode){case 40:return this._keyDown(a);case 37:return this._keyLeft(a);case 39:return this._keyRight(a);case 38:return this._keyUp(a);case 9:return this._keyTab(a);case 8:return this._keyBack(a);case 46:return this._keyDelete(a);case 13:return this._keyReturn(a)}},c.prototype._onKeyUp=function(a){return c.__super__._onKeyUp.call(this,a),this._syncContent()},c.prototype._onMouseDown=function(b){return c.__super__._onMouseDown.call(this,b),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(function(a){return function(){return a.drag(b.pageX,b.pageY)}}(this),a.DRAG_HOLD_DURATION),0===this.content.length()&&a.Root.get().focused()===this?(b.preventDefault(),document.activeElement!==this._domElement&&this._domElement.focus(),new ContentSelect.Range(0,0).select(this._domElement)):void 0},c.prototype._onMouseMove=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseMove.call(this,a)},c.prototype._onMouseOut=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseOut.call(this,a)},c.prototype._onMouseUp=function(a){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.__super__._onMouseUp.call(this,a)},c.prototype._keyBack=function(a){var b,c;return c=ContentSelect.Range.query(this._domElement),0===c.get()[0]&&c.isCollapsed()?(a.preventDefault(),b=this.previousContent(),this._syncContent(),b?b.merge(this):void 0):void 0},c.prototype._keyDelete=function(a){var b,c;return c=ContentSelect.Range.query(this._domElement),this._atEnd(c)&&c.isCollapsed()?(a.preventDefault(),b=this.nextContent(),b?this.merge(b):void 0):void 0},c.prototype._keyDown=function(a){return this._keyRight(a)},c.prototype._keyLeft=function(b){var c,d;return d=ContentSelect.Range.query(this._domElement),0===d.get()[0]&&d.isCollapsed()?(b.preventDefault(),c=this.previousContent(),c?(c.focus(),d=new ContentSelect.Range(c.content.length(),c.content.length()),d.select(c.domElement())):a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):void 0},c.prototype._keyReturn=function(b){var c,d,e,f,g,h;if(b.preventDefault(),!(this.content.isWhitespace()&&!b.shiftKey^a.PREFER_LINE_BREAKS)){if(f=ContentSelect.Range.query(this._domElement),h=this.content.substring(0,f.get()[0]),g=this.content.substring(f.get()[1]),b.shiftKey^a.PREFER_LINE_BREAKS)return d=f.get()[0],e="
",this.content.length()===d&&(0!==this.content.length()&&this.content.characters[d-1].isTag("br")||(e="

")),this.content=this.content.insert(d,new HTMLString.String(e,!0),!0),this.updateInnerHTML(),d+=1,f=new ContentSelect.Range(d,d),f.select(this.domElement()),void this.taint();if(this.can("spawn"))return this.content=h.trim(),this.updateInnerHTML(),c=new this.constructor("p",{},g.trim()),this.parent().attach(c,this.parent().children.indexOf(this)+1),h.length()?(c.focus(),f=new ContentSelect.Range(0,0),f.select(c.domElement())):(f=new ContentSelect.Range(0,h.length()),f.select(this._domElement)),this.taint()}},c.prototype._keyRight=function(b){var c,d;return d=ContentSelect.Range.query(this._domElement),this._atEnd(d)&&d.isCollapsed()?(b.preventDefault(),c=this.nextContent(),c?(c.focus(),d=new ContentSelect.Range(0,0),d.select(c.domElement())):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):void 0},c.prototype._keyTab=function(b){return b.preventDefault(),this.isFixed()?b.shiftKey?a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()})):a.Root.get().trigger("next-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()})):void 0},c.prototype._keyUp=function(a){return this._keyLeft(a)},c.prototype._atEnd=function(a){return a.get()[0]>=this.content.length()},c.prototype._flagIfEmpty=function(){return 0===this.content.length()?this._addCSSClass("ce-element--empty"):this._removeCSSClass("ce-element--empty")},c.prototype._syncContent=function(){var a,b;return b=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML,this.content.preserveWhitespace()),a=this.content.html(),b!==a&&this.taint(),this._flagIfEmpty()},c.droppers={Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={Text:function(a,b){var c;return c=b.content.length(),a.content.length()&&(b.content=b.content.concat(a.content)),b.isMounted()&&b.updateInnerHTML(),b.focus(),new ContentSelect.Range(c,c).select(b._domElement),a.parent()&&a.parent().detach(a),b.taint()}},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML.replace(/^\s+|\s+$/g,""))},c}(a.Element),a.TagNames.get().register(a.Text,"address","blockquote","h1","h2","h3","h4","h5","h6","p"),a.PreText=function(b){function c(b,c,d){this.content=d instanceof HTMLString.String?d:new HTMLString.String(d,!0),a.Element.call(this,b,c)}return i(c,b),c.TAB_INDENT=" ",c.prototype.cssTypeName=function(){return"pre-text"},c.prototype.type=function(){return"PreText"},c.prototype.typeName=function(){return"Preformatted"},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.innerHTML=this.content.html()),c.__super__.blur.call(this)},c.prototype.html=function(a){var b;return null==a&&(a=""),(!this._lastCached||this._lastCached"+(""+this._cached+"")},c.prototype.updateInnerHTML=function(){var a;return a=this.content.html(),this._domElement.innerHTML=a,this._ensureEndZWS(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},c.prototype._keyBack=function(a){var b;return b=ContentSelect.Range.query(this._domElement),b.get()[0]<=this.content.length()?c.__super__._keyBack.call(this,a):(b.set(this.content.length(),this.content.length()),b.select(this._domElement))},c.prototype._keyReturn=function(a){var b,c,d,e;return a.preventDefault(),c=ContentSelect.Range.query(this._domElement),b=c.get()[0]+1,0===c.get()[0]&&c.isCollapsed()?this.content=new HTMLString.String("\n",!0).concat(this.content):this._atEnd(c)&&c.isCollapsed()?this.content=this.content.concat(new HTMLString.String("\n",!0)):0===c.get()[0]&&c.get()[1]===this.content.length()?(this.content=new HTMLString.String("\n",!0),b=0):(e=this.content.substring(0,c.get()[0]),d=this.content.substring(c.get()[1]),this.content=e.concat(new HTMLString.String("\n",!0),d)),this.updateInnerHTML(),c.set(b,b),c.select(this._domElement),this.taint()},c.prototype._keyTab=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;for(b.preventDefault(),c=this.content.length(),k=a.PreText.TAB_INDENT,j=k.length,o=this.content.split("\n"),p=this.selection().get(),p[0]=Math.min(p[0],c),p[1]=Math.min(p[1],c),e=0,s=-1,f=-1,h=v=0,z=o.length;z>v&&(m=o[h],n=m.length()+1,p[0]-1&&f>-1));h=++v)e+=n;if(s===f)j-=(p[0]-e)%j,i=new HTMLString.String(Array(j+1).join(" "),!0),u=o[s].substring(0,p[0]-e),t=o[s].substring(p[1]-e),o[s]=u.concat(i,t),r=j;else if(b.shiftKey){for(g=0,h=w=s;f>=s?f>=w:w>=f;h=f>=s?++w:--w){for(B=o[h].characters.slice(),l=x=0,A=B.length;A>x&&(d=B[l],!(l>j-1))&&d.isWhitespace();l=++x)o[h].characters.shift();h===s&&(g=l)}r=Math.max(-j,-g)}else{for(i=new HTMLString.String(k,!0),h=y=s;f>=s?f>=y:y>=f;h=f>=s?++y:--y)o[h]=i.concat(o[h]);r=j}return this.content=HTMLString.String.join(new HTMLString.String("\n",!0),o),this.updateInnerHTML(),q=this.content.length()-c,new ContentSelect.Range(p[0]+r,p[1]+q).select(this._domElement)},c.prototype._syncContent=function(){var a,b;return this._ensureEndZWS(),b=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML.replace(/\u200B$/g,""),this.content.preserveWhitespace()),a=this.content.html(),b!==a&&this.taint(),this._flagIfEmpty()},c.prototype._ensureEndZWS=function(){var a,b;if(this._domElement.lastChild&&(a=this._domElement.innerHTML,!("​"===a[a.length-1]&&a.indexOf("​")-1&&(b._domElement.innerHTML=a.replace(/\u200B/g,"")),b._domElement.lastChild.textContent+="​"}}(this),this._savedSelection?b():(this.storeState(),b(),this.restoreState())},c.droppers={PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert},c.mergers={},c.fromDOMElement=function(a){return new this(a.tagName,this.getDOMElementAttributes(a),a.innerHTML)},c}(a.Text),a.TagNames.get().register(a.PreText,"pre"),a.Image=function(b){function c(a,b){var d;c.__super__.constructor.call(this,"img",a),this.a=b?b:null,d=this.size(),this._aspectRatio=d[1]/d[0]}return i(c,b),c.prototype.cssTypeName=function(){return"image"},c.prototype.type=function(){return"Image"},c.prototype.typeName=function(){return"Image"},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.style.backgroundImage="url('"+this._attributes.src+"')",a},c.prototype.html=function(b){var c,d,e;return null==b&&(b=""),d=""+b+"",this.a?(e=a.LINE_ENDINGS,c=a.attributesToString(this.a),c=""+c+' data-ce-tag="img"',""+b+""+e+(""+a.INDENT+d+e)+(""+b+"")):d},c.prototype.mount=function(){var a,b;return this._domElement=document.createElement("div"),a="",this.a&&this.a["class"]&&(a+=" "+this.a["class"]),this._attributes["class"]&&(a+=" "+this._attributes["class"]),this._domElement.setAttribute("class",a),b=this._attributes.style?this._attributes.style:"",b+="background-image:url('"+this._attributes.src+"');",this._attributes.width&&(b+="width:"+this._attributes.width+"px;"),this._attributes.height&&(b+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",b),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("a, img"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth},c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g,h; if(b=null,"a"===a.tagName.toLowerCase()){for(b=this.getDOMElementAttributes(a),f=function(){var b,c,e,f;for(e=a.childNodes,f=[],b=0,c=e.length;c>b;b++)d=e[b],f.push(d);return f}(),g=0,h=f.length;h>g;g++)if(e=f[g],1===e.nodeType&&"img"===e.tagName.toLowerCase()){a=e;break}"a"===a.tagName.toLowerCase()&&(a=document.createElement("img"))}return c=this.getDOMElementAttributes(a),void 0===c.width&&(c.width=void 0===c.height?a.naturalWidth:a.clientWidth),void 0===c.height&&(c.height=void 0===c.width?a.naturalHeight:a.clientHeight),new this(c,b)},c}(a.ResizableElement),a.TagNames.get().register(a.Image,"img"),a.Video=function(b){function c(a,b,d){var e;null==d&&(d=[]),c.__super__.constructor.call(this,a,b),this.sources=d,e=this.size(),this._aspectRatio=e[1]/e[0]}return i(c,b),c.prototype.cssTypeName=function(){return"video"},c.prototype.type=function(){return"Video"},c.prototype.typeName=function(){return"Video"},c.prototype._title=function(){var a;return a="",this.attr("src")?a=this.attr("src"):this.sources.length&&(a=this.sources[0].src),a||(a="No video source set"),a.length>80&&(a=a.substr(0,80)+"..."),a},c.prototype.createDraggingDOMElement=function(){var a;if(this.isMounted())return a=c.__super__.createDraggingDOMElement.call(this),a.innerHTML=this._title(),a},c.prototype.html=function(b){var c,d,e,f,g,h,i;if(null==b&&(b=""),d=a.LINE_ENDINGS,"video"===this.tagName()){for(f=[],i=this.sources,g=0,h=i.length;h>g;g++)e=i[g],c=a.attributesToString(e),f.push(""+b+a.INDENT+"");return""+b+""+d+f.join(d)+(""+d+b+"")}return""+b+"<"+this._tagName+this._attributesToString()+">"+("")},c.prototype.mount=function(){var a;return this._domElement=document.createElement("div"),this.a&&this.a["class"]?this._domElement.setAttribute("class",this.a["class"]):this._attributes["class"]&&this._domElement.setAttribute("class",this._attributes["class"]),a=this._attributes.style?this._attributes.style:"",this._attributes.width&&(a+="width:"+this._attributes.width+"px;"),this._attributes.height&&(a+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",a),this._domElement.setAttribute("data-ce-title",this._title()),c.__super__.mount.call(this)},c.prototype.unmount=function(){var a,b;return this.isFixed()&&(b=document.createElement("div"),b.innerHTML=this.html(),a=b.querySelector("iframe"),this._domElement.parentNode.replaceChild(a,this._domElement),this._domElement=a),c.__super__.unmount.call(this)},c.droppers={Image:a.Element._dropBoth,PreText:a.Element._dropBoth,Static:a.Element._dropBoth,Text:a.Element._dropBoth,Video:a.Element._dropBoth},c.placements=["above","below","left","right","center"],c.fromDOMElement=function(a){var b,c,d,e,f,g;for(d=function(){var c,d,e,f;for(e=a.childNodes,f=[],c=0,d=e.length;d>c;c++)b=e[c],f.push(b);return f}(),e=[],f=0,g=d.length;g>f;f++)c=d[f],1===c.nodeType&&"source"===c.tagName.toLowerCase()&&e.push(this.getDOMElementAttributes(c));return new this(a.tagName,this.getDOMElementAttributes(a),e)},c}(a.ResizableElement),a.TagNames.get().register(a.Video,"iframe","video"),a.List=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return i(c,b),c.prototype.cssTypeName=function(){return"list"},c.prototype.type=function(){return"List"},c.prototype.typeName=function(){return"List"},c.prototype._onMouseOver=function(a){return"ListItem"!==this.parent().type()?(c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")):void 0},c.droppers={Image:a.Element._dropBoth,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;h>g;g++)d=e[g],1===d.nodeType&&"li"===d.tagName.toLowerCase()&&f.attach(a.ListItem.fromDOMElement(d));return 0===f.children.length?null:f},c}(a.ElementCollection),a.TagNames.get().register(a.List,"ol","ul"),a.ListItem=function(b){function c(a){c.__super__.constructor.call(this,"li",a),this._behaviours.indent=!0}return i(c,b),c.prototype.cssTypeName=function(){return"list-item"},c.prototype.list=function(){return 2===this.children.length?this.children[1]:null},c.prototype.listItemText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"ListItem"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[""+b+""],this.listItemText()&&c.push(this.listItemText().html(b+a.INDENT)),this.list()&&c.push(this.list().html(b+a.INDENT)),c.push(""+b+""),c.join(a.LINE_ENDINGS)},c.prototype.indent=function(){var b;if(this.can("indent")&&0!==this.parent().children.indexOf(this))return b=this.previousSibling(),b.list()||b.attach(new a.List(b.parent().tagName())),this.listItemText().storeState(),this.parent().detach(this),b.list().attach(this),this.listItemText().restoreState()},c.prototype.remove=function(){var a,b,c,d,e,f;if(this.parent()){if(c=this.parent().children.indexOf(this),this.list())for(f=this.list().children.slice(),b=d=0,e=f.length;e>d;b=++d)a=f[b],a.parent().detach(a),this.parent().attach(a,b+c);return this.parent().detach(this)}},c.prototype.unindent=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(this.can("indent")){if(g=this.parent(),c=g.parent(),k=g.children.slice(g.children.indexOf(this)+1,g.children.length),"ListItem"===c.type()){for(this.listItemText().storeState(),g.detach(this),c.parent().attach(this,c.parent().children.indexOf(c)+1),k.length&&!this.list()&&this.attach(new a.List(g.tagName())),m=0,q=k.length;q>m;m++)j=k[m],j.parent().detach(j),this.list().attach(j);return this.listItemText().restoreState()}if(l=new a.Text("p",this.attr("class")?{"class":this.attr("class")}:{},this.listItemText().content),i=null,this.listItemText().isFocused()&&(i=ContentSelect.Range.query(this.listItemText().domElement())),h=c.children.indexOf(g),e=g.children.indexOf(this),0===e){if(f=null,1===g.children.length?(this.list()&&(f=new a.List(g.tagName())),c.detach(g)):g.detach(this),c.attach(l,h),f&&c.attach(f,h+1),this.list())for(u=this.list().children.slice(),d=n=0,r=u.length;r>n;d=++n)b=u[d],b.parent().detach(b),f?f.attach(b):g.attach(b,d)}else if(e===g.children.length-1)g.detach(this),c.attach(l,h+1),this.list()&&c.attach(this.list(),h+2);else{if(g.detach(this),c.attach(l,h+1),f=new a.List(g.tagName()),c.attach(f,h+2),this.list())for(v=this.list().children.slice(),o=0,s=v.length;s>o;o++)b=v[o],b.parent().detach(b),f.attach(b);for(p=0,t=k.length;t>p;p++)j=k[p],j.parent().detach(j),f.attach(j)}return i?(l.focus(),i.select(l.domElement())):void 0}},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l;for(g=new this(this.getDOMElementAttributes(b)),d="",e=null,k=b.childNodes,i=0,j=k.length;j>i;i++)c=k[i],1===c.nodeType?"ul"===(l=c.tagName.toLowerCase())||"ol"===l||"li"===l?e||(e=c):d+=c.outerHTML:d+=HTMLString.String.encode(c.textContent);return d=d.replace(/^\s+|\s+$/g,""),h=new a.ListItemText(d),g.attach(h),e&&(f=a.List.fromDOMElement(e),g.attach(f)),g},c}(a.ElementCollection),a.ListItemText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return i(c,b),c.prototype.cssTypeName=function(){return"list-item-text"},c.prototype.type=function(){return"ListItemText"},c.prototype.typeName=function(){return"List item"},c.prototype.blur=function(){return this.content.isWhitespace()&&this.can("remove")?this.parent().remove():this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCachedc;c++)if(b=e[c],b.tagName()===a)return b;return null},c.droppers={Image:a.Element._dropBoth,List:a.Element._dropVert,PreText:a.Element._dropVert,Static:a.Element._dropVert,Table:a.Element._dropVert,Text:a.Element._dropVert,Video:a.Element._dropBoth},c.fromDOMElement=function(b){var c,d,e,f,g,h,i,j,k,l,m,n;for(i=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c);return f}(),f=[],k=0,m=e.length;m>k;k++)if(d=e[k],1===d.nodeType&&(j=d.tagName.toLowerCase(),!i._getChild(j)))switch(j){case"tbody":case"tfoot":case"thead":h=a.TableSection.fromDOMElement(d),i.attach(h);break;case"tr":f.push(a.TableRow.fromDOMElement(d))}if(f.length>0)for(i._getChild("tbody")||i.attach(new a.TableSection("tbody")),l=0,n=f.length;n>l;l++)g=f[l],i.tbody().attach(g);return 0===i.children.length?null:i},c}(a.ElementCollection),a.TagNames.get().register(a.Table,"table"),a.TableSection=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return i(c,b),c.prototype.cssTypeName=function(){return"table-section"},c.prototype.type=function(){return"TableSection"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.fromDOMElement=function(b){var c,d,e,f,g,h;for(f=new this(b.tagName,this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c);return f}(),g=0,h=e.length;h>g;g++)d=e[g],1===d.nodeType&&"tr"===d.tagName.toLowerCase()&&f.attach(a.TableRow.fromDOMElement(d));return f},c}(a.ElementCollection),a.TableRow=function(b){function c(a){c.__super__.constructor.call(this,"tr",a)}return i(c,b),c.prototype.cssTypeName=function(){return"table-row"},c.prototype.isEmpty=function(){var a,b,c,d,e;for(e=this.children,c=0,d=e.length;d>c;c++)if(a=e[c],b=a.tableCellText(),b&&b.content.length()>0)return!1;return!0},c.prototype.type=function(){return"TableRow"},c.prototype.typeName=function(){return"Table row"},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.droppers={TableRow:a.Element._dropVert},c.fromDOMElement=function(b){var c,d,e,f,g,h,i;for(f=new this(this.getDOMElementAttributes(b)),e=function(){var a,d,e,f;for(e=b.childNodes,f=[],a=0,d=e.length;d>a;a++)c=e[a],f.push(c);return f}(),h=0,i=e.length;i>h;h++)d=e[h],1===d.nodeType&&(g=d.tagName.toLowerCase(),("td"===g||"th"===g)&&f.attach(a.TableCell.fromDOMElement(d)));return f},c}(a.ElementCollection),a.TableCell=function(b){function c(a,b){c.__super__.constructor.call(this,a,b)}return i(c,b),c.prototype.cssTypeName=function(){return"table-cell"},c.prototype.tableCellText=function(){return this.children.length>0?this.children[0]:null},c.prototype.type=function(){return"TableCell"},c.prototype.html=function(b){var c;return null==b&&(b=""),c=[""+b+"<"+this.tagName()+this._attributesToString()+">"],this.tableCellText()&&c.push(this.tableCellText().html(b+a.INDENT)),c.push(""+b+""),c.join(a.LINE_ENDINGS)},c.prototype._onMouseOver=function(a){return c.__super__._onMouseOver.call(this,a),this._removeCSSClass("ce-element--over")},c.prototype._addDOMEventListeners=function(){},c.prototype._removeDOMEventListners=function(){},c.fromDOMElement=function(b){var c,d;return c=new this(b.tagName,this.getDOMElementAttributes(b)),d=new a.TableCellText(b.innerHTML.replace(/^\s+|\s+$/g,"")),c.attach(d),c},c}(a.ElementCollection),a.TableCellText=function(b){function c(a){c.__super__.constructor.call(this,"div",{},a)}return i(c,b),c.prototype.cssTypeName=function(){return"table-cell-text"},c.prototype.type=function(){return"TableCellText"},c.prototype._isInFirstRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c!==d.firstSection()?!1:b===c.children[0]},c.prototype._isInLastRow=function(){var a,b,c,d;return a=this.parent(),b=a.parent(),c=b.parent(),d=c.parent(),c!==d.lastSection()?!1:b===c.children[c.children.length-1]},c.prototype._isLastInSection=function(){var a,b,c;return a=this.parent(),b=a.parent(),c=b.parent(),b!==c.children[c.children.length-1]?!1:a===b.children[b.children.length-1]},c.prototype.blur=function(){return this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),a.Element.prototype.blur.call(this)},c.prototype.can=function(a,b){if(b)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(a)},c.prototype.html=function(b){var c;return null==b&&(b=""),(!this._lastCached||this._lastCachedj;j++)d=l[j],f=new a.TableCell(d.tagName(),d._attributes),g=new a.TableCellText(""),f.attach(g),h.attach(f);return i=this.closest(function(a){return"TableSection"===a.type()}),i.attach(h),h.children[0].tableCellText().focus()}return this.nextContent().focus()}},c.prototype._keyUp=function(b){var c,d,e,f,g,h;return h=ContentSelect.Range.query(this._domElement),0===h.get()[0]&&h.isCollapsed()?(b.preventDefault(),c=this.parent(),this._isInFirstRow()?(g=c.parent(),e=g.children[0].previousContent(),e?e.focus():a.Root.get().trigger("previous-region",this.closest(function(a){return"Fixture"===a.type()||"Region"===a.type()}))):(f=c.parent().previousWithTest(function(a){return"TableRow"===a.type()}),d=c.parent().children.indexOf(c),d=Math.min(d,f.children.length),f.children[d].tableCellText().focus())):void 0},c.droppers={},c.mergers={},c}(a.Text)}.call(this); \ No newline at end of file diff --git a/package.json b/package.json index 8d0e570..d9f0ffa 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ContentEdit", "description": "A JavaScript library that provides a set of classes for building content-editable HTML elements.", - "version": "1.2.0", + "version": "1.2.1", "keywords": [ "wysiwyg", "inline",