1import{a as Xe,c as Ye,m as $e}from"./chunk-JEQCOGCD.js";import"./chunk-JDQTM4TK.js";import{b as Ge}from"./chunk-X2JJBX2U.js";import{b as Ze,c as Je}from"./chunk-GMS5YTYV.js";import"./chunk-KJ4QD3SP.js";import{a as We}from"./chunk-3ORFLDEQ.js";import"./chunk-DR3JU5EU.js";import{a as Ve,b as je}from"./chunk-ZRDGGLZM.js";import"./chunk-76DJPXSG.js";import"./chunk-ZUTNCURO.js";import{a as re,b as Qe}from"./chunk-4MJYK4HN.js";import"./chunk-GQIMCUCB.js";import"./chunk-5M4XIZMD.js";import{a as qe,b as Ke,c as Vt,g as jt}from"./chunk-2BFVK5HI.js";import"./chunk-3LVDM64V.js";import"./chunk-6HN5HIFJ.js";import"./chunk-VTF4T7ID.js";import{d as Ne,l as ke,n as He,v as Ue,y as Pe}from"./chunk-TUKI65JW.js";import{r as Oe,s as oe}from"./chunk-E7TZAWVT.js";import{b as De}from"./chunk-EKVTZPVT.js";import"./chunk-S54BMOKL.js";import"./chunk-3ZR4SHJC.js";import{d as Ut}from"./chunk-K75VSEIY.js";import"./chunk-7FRBKRRG.js";import"./chunk-WPWHXKEF.js";import"./chunk-ZWC24XOW.js";import{Ua as Ae,kb as zt,lb as Ft,w as ft}from"./chunk-2U5T7ZRU.js";import"./chunk-HFHRXST3.js";import{D as Le,H as Be,L as ze,P as Fe,Q as Pt,R as Bt,h as we,w as Ie,y as Ht,z as Me}from"./chunk-EHK3LLER.js";import{K as Re}from"./chunk-UZFNZKCX.js";import{D as kt,k as Se,y as xe}from"./chunk-YDFILND7.js";import{Ac as Ct,Ad as Te,Da as tt,Ea as et,Gb as pe,Hb as j,Hc as nt,K as he,Kc as st,La as ee,Ob as Dt,Oc as At,Od as be,Pb as Rt,Pc as Nt,Qb as me,Qc as Ot,Uc as Tt,Xa as ue,Zc as it,_c as bt,dd as ge,ed as fe,f as ce,fd as ve,gc as _e,ia as Et,jc as ct,la as rt,lc as ht,nd as ye,od as Ee,qb as de,qc as ut,r as te,ra as Mt,rc as G,sa as Lt,sc as W,tc as dt,vb as ne,wa as lt,wd as ie,xb as $,yd as Ce}from"./chunk-TROGQXTX.js";import{e as an,g as ln,i as q}from"./chunk-S6MAVN2Q.js";var sn=an((yt,Q)=>{q();(function(){var c;c={},c.Machine=(function(){function m(v){this.context=v,this._stateTransitions={},this._stateTransitionsAny={},this._defaultTransition=null,this._initialState=null,this._currentState=null}return m.prototype.addTransition=function(v,b,w,N){return w||(w=b),this._stateTransitions[[v,b]]=[w,N]},m.prototype.addTransitions=function(v,b,w,N){var D,I,O,l;for(w||(w=b),l=[],I=0,O=v.length;I<O;I++)D=v[I],l.push(this.addTransition(D,b,w,N));return l},m.prototype.addTransitionAny=function(v,b,w){return b||(b=v),this._stateTransitionsAny[v]=[b,w]},m.prototype.setDefaultTransition=function(v,b){return this._defaultTransition=[v,b]},m.prototype.getTransition=function(v,b){if(this._stateTransitions[[v,b]])return this._stateTransitions[[v,b]];if(this._stateTransitionsAny[b])return this._stateTransitionsAny[b];if(this._defaultTransition)return this._defaultTransition;throw new Error("Transition is undefined: ("+v+", "+b+")")},m.prototype.getCurrentState=function(){return this._currentState},m.prototype.setInitialState=function(v){if(this._initialState=v,!this._currentState)return this.reset()},m.prototype.reset=function(){return this._currentState=this._initialState},m.prototype.process=function(v){var b;return b=this.getTransition(v,this._currentState),b[1]&&b[1].call(this.context||(this.context=this),v),this._currentState=b[0]},m})(),typeof window<"u"&&(window.FSM=c),typeof Q<"u"&&Q.exports&&(Q.exports=c)}).call(yt),function(){var c,m,v,b,w,N,D,I,O,l,e,t,n,i,o,r,s,a,u,p,g,E,T,x,L,R,U=[].slice,H=[].indexOf||function(C){for(var h=0,d=this.length;h<d;h++)if(h in this&&this[h]===C)return h;return-1};a={},typeof window<"u"&&(window.HTMLString=a),typeof Q<"u"&&Q.exports&&(Q.exports=a),a.String=(function(){function C(h,d){d==null&&(d=!1),this._preserveWhitespace=d,h?(a.String._parser===null&&(a.String._parser=new R),this.characters=a.String._parser.parse(h,this._preserveWhitespace).characters):this.characters=[]}return C._parser=null,C.prototype.isWhitespace=function(){var h,d,_,f;for(f=this.characters,d=0,_=f.length;d<_;d++)if(h=f[d],!h.isWhitespace())return!1;return!0},C.prototype.length=function(){return this.characters.length},C.prototype.preserveWhitespace=function(){return this._preserveWhitespace},C.prototype.capitalize=function(){var h,d;return d=this.copy(),d.length()&&(h=d.characters[0]._c.toUpperCase(),d.characters[0]._c=h),d},C.prototype.charAt=function(h){return this.characters[h].copy()},C.prototype.concat=function(){var h,d,_,f,y,S,M,A,k,B,P,F,V,z,K,X,Y;for(M=2<=arguments.length?U.call(arguments,0,k=arguments.length-1):(k=0,[]),_=arguments[k++],_!==void 0&&typeof _!="boolean"&&(M.push(_),_=!0),y=this.copy(),B=0,V=M.length;B<V;B++)if(S=M[B],S.length!==0){if(A=S,typeof S=="string"&&(A=new a.String(S,this._preserveWhitespace)),_&&y.length())for(d=y.charAt(y.length()-1),f=d.tags(),d.isTag()&&f.shift(),typeof S!="str
1ing"&&(A=A.copy()),X=A.characters,P=0,z=X.length;P<z;P++)h=X[P],h.addTags.apply(h,f);for(Y=A.characters,F=0,K=Y.length;F<K;F++)h=Y[F],y.characters.push(h)}return y},C.prototype.contains=function(h){var d,_,f,y,S,M,A;if(typeof h=="string")return this.text().indexOf(h)>-1;for(f=0;f<=this.length()-h.length();){for(_=!0,A=h.characters,y=S=0,M=A.length;S<M;y=++S)if(d=A[y],!d.eq(this.characters[y+f])){_=!1;break}if(_)return!0;f++}return!1},C.prototype.endsWith=function(h){var d,_,f,y,S,M;if(typeof h=="string")return h===""||this.text().slice(-h.length)===h;for(_=this.characters.slice().reverse(),M=h.characters.slice().reverse(),f=y=0,S=M.length;y<S;f=++y)if(d=M[f],!d.eq(_[f]))return!1;return!0},C.prototype.format=function(){var h,d,_,f,y,S,M;for(d=arguments[0],S=arguments[1],y=3<=arguments.length?U.call(arguments,2):[],S<0&&(S=this.length()+S+1),d<0&&(d=this.length()+d),f=this.copy(),_=M=d;d<=S?M<S:M>S;_=d<=S?++M:--M)h=f.characters[_],h.addTags.apply(h,y);return f},C.prototype.hasTags=function(){var h,d,_,f,y,S,M,A;for(f=2<=arguments.length?U.call(arguments,0,y=arguments.length-1):(y=0,[]),_=arguments[y++],_!==void 0&&typeof _!="boolean"&&(f.push(_),_=!1),d=!1,A=this.characters,S=0,M=A.length;S<M;S++)if(h=A[S],h.hasTags.apply(h,f))d=!0;else if(_)return!1;return d},C.prototype.html=function(){var h,d,_,f,y,S,M,A,k,B,P,F,V,z,K,X,Y,Z,J,ot,pt,mt,_t;for(y="",A=[],S=[],_=[],ot=this.characters,B=0,z=ot.length;B<z;B++){for(h=ot[B],_=[],pt=A.slice().reverse(),P=0,K=pt.length;P<K;P++)if(M=pt[P],_.push(M),!h.hasTags(M)){for(F=0,X=_.length;F<X;F++)d=_[F],y+=d.tail(),A.pop(),S.pop();_=[]}for(mt=h._tags,V=0,Y=mt.length;V<Y;V++)k=mt[V],S.indexOf(k.head())===-1&&(k.selfClosing()||(f=k.head(),y+=f,A.push(k),S.push(f)));h._tags.length>0&&h._tags[0].selfClosing()&&(y+=h._tags[0].head()),y+=h.c()}for(_t=A.reverse(),J=0,Z=_t.length;J<Z;J++)k=_t[J],y+=k.tail();return y},C.prototype.indexOf=function(h,d){var _,f,y,S,M,A;if(d==null&&(d=0),d<0&&(d=0),typeof h=="string")return this.text().indexOf(h,d);for(;d<=this.length()-h.length();){for(f=!0,A=h.characters,y=S=0,M=A.length;S<M;y=++S)if(_=A[y],!_.eq(this.characters[y+d])){f=!1;break}if(f)return d;d++}return-1},C.prototype.insert=function(h,d,_){var f,y,S,M,A,k,B,P,F,V,z,K,X,Y,Z,J;if(_==null&&(_=!0),y=this.slice(0,h),B=this.slice(h),h<0&&(h=this.length()+h),A=d,typeof d=="string"&&(A=new a.String(d,this._preserveWhitespace)),_&&h>0)for(S=this.charAt(h-1),M=S.tags(),S.isTag()&&M.shift(),typeof d!="string"&&(A=A.copy()),Y=A.characters,P=0,z=Y.length;P<z;P++)f=Y[P],f.addTags.apply(f,M);for(k=y,Z=A.characters,F=0,K=Z.length;F<K;F++)f=Z[F],k.characters.push(f);for(J=B.characters,V=0,X=J.length;V<X;V++)f=J[V],k.characters.push(f);return k},C.prototype.lastIndexOf=function(h,d){var _,f,y,S,M,A,k,B,P;if(d==null&&(d=0),d<0&&(d=0),f=this.characters.slice(d).reverse(),d=0,typeof h=="string"){if(!this.contains(h))return-1;for(h=h.split("").reverse();d<=f.length-h.length;){for(y=!0,M=0,S=A=0,B=h.length;A<B;S=++A)if(_=h[S],f[S+d].isTag()&&(M+=1),_!==f[M+S+d].c()){y=!1;break}if(y)return d;d++}return-1}for(h=h.characters.slice().reverse();d<=f.length-h.length;){for(y=!0,S=k=0,P=h.length;k<P;S=++k)if(_=h[S],!_.eq(f[S+d])){y=!1;break}if(y)return d;d++}return-1},C.prototype.optimize=function(){var h,d,_,f,y,S,M,A,k,B,P,F,V,z,K,X,Y,Z,J,ot,pt,mt,_t,ae,le,St,xt,wt,qt,Kt,Xt,Yt,$t,Qt,Zt;for(A=[],S=[],f=null,qt=this.characters.slice().reverse(),K=0,J=qt.length;K<J;K++){for(h=qt[K],h._runLengthMap={},h._runLengthMapSize=0,d=[],Kt=A.slice().reverse(),X=0,ot=Kt.length;X<ot;X++)if(M=Kt[X],d.push(M),!h.hasTags(M)){for(Y=0,pt=d.length;Y<pt;Y++)d[Y],A.pop(),S.pop();d=[]}for(Xt=h._tags,Z=0,mt=Xt.length;Z<mt;Z++)z=Xt[Z],S.indexOf(z.head())===-1&&(z.selfClosing()||(A.push(z),S.push(z.head())));for(St=0,_t=A.length;St<_t;St++)z=A[St],_=z.head(),f?(h._runLengthMap[_]||(h._runLengthMap[_]=[z,0]),F=0,f._runLengthMap[_]&&(F=f._runLengthMap[_][1]),h._runLengthMap[_][1]=F+1):h._runLengthMap[_]=[z,1];f=h}for(B=function(It,gt){return gt[1]-It[1]},Yt=this.characters,Zt=[],xt=0,ae=Yt.length;xt<ae;xt++)if(h=Yt[xt],!((y=h._tags.length)>0&&h._tags[0].selfClosing()&&y<3||y<2)){P=[],$t=h._runLengthMap;
1for(z in $t)k=$t[z],P.push(k);for(P.sort(B),Qt=h._tags.slice(),wt=0,le=Qt.length;wt<le;wt++)z=Qt[wt],z.selfClosing()||h.removeTags(z);Zt.push(h.addTags.apply(h,(function(){var It,gt,Jt;for(Jt=[],gt=0,It=P.length;gt<It;gt++)V=P[gt],Jt.push(V[0]);return Jt})()))}return Zt},C.prototype.slice=function(h,d){var _,f;return f=new a.String("",this._preserveWhitespace),f.characters=function(){var y,S,M,A;for(M=this.characters.slice(h,d),A=[],y=0,S=M.length;y<S;y++)_=M[y],A.push(_.copy());return A}.call(this),f},C.prototype.split=function(h,d){var _,f,y,S,M,A,k,B,P,F;for(h==null&&(h=""),d==null&&(d=0),A=0,_=0,M=[0];!(d>0&&_>d||(S=this.indexOf(h,A))===-1);)M.push(S),A=S+1;for(M.push(this.length()),B=[],y=P=0,F=M.length-2;0<=F?P<=F:P>=F;y=0<=F?++P:--P)k=M[y],y>0&&(k+=1),f=M[y+1],B.push(this.slice(k,f));return B},C.prototype.startsWith=function(h){var d,_,f,y,S;if(typeof h=="string")return this.text().slice(0,h.length)===h;for(S=h.characters,_=f=0,y=S.length;f<y;_=++f)if(d=S[_],!d.eq(this.characters[_]))return!1;return!0},C.prototype.substr=function(h,d){return d<=0?new a.String("",this._preserveWhitespace):(h<0&&(h=this.length()+h),d===void 0&&(d=this.length()-h),this.slice(h,h+d))},C.prototype.substring=function(h,d){return d===void 0&&(d=this.length()),this.slice(h,d)},C.prototype.text=function(){var h,d,_,f,y;for(d="",y=this.characters,_=0,f=y.length;_<f;_++)h=y[_],h.isTag()?h.isTag("br")&&(d+=` 2`):(h.c(),d+=h.c());return this.constructor.decode(d)},C.prototype.toLowerCase=function(){var h,d,_,f,y;for(d=this.copy(),y=d.characters,_=0,f=y.length;_<f;_++)h=y[_],h._c.length===1&&(h._c=h._c.toLowerCase());return d},C.prototype.toUpperCase=function(){var h,d,_,f,y;for(d=this.copy(),y=d.characters,_=0,f=y.length;_<f;_++)h=y[_],h._c.length===1&&(h._c=h._c.toUpperCase());return d},C.prototype.trim=function(){var h,d,_,f,y,S,M,A,k,B;for(k=this.characters,d=y=0,M=k.length;y<M&&(h=k[d],h.isWhitespace());d=++y);for(B=this.characters.slice().reverse(),f=S=0,A=B.length;S<A&&(h=B[f],h.isWhitespace());f=++S);return f=this.length()-f-1,_=new a.String("",this._preserveWhitespace),_.characters=function(){var P,F,V,z;for(V=this.characters.slice(d,+f+1||9e9),z=[],P=0,F=V.length;P<F;P++)h=V[P],z.push(h.copy());return z}.call(this),_},C.prototype.trimLeft=function(){var h,d,_,f,y,S,M;for(f=this.length()-1,M=this.characters,d=y=0,S=M.length;y<S&&(h=M[d],h.isWhitespace());d=++y);return _=new a.String("",this._preserveWhitespace),_.characters=function(){var A,k,B,P;for(B=this.characters.slice(d,+f+1||9e9),P=[],A=0,k=B.length;A<k;A++)h=B[A],P.push(h.copy());return P}.call(this),_},C.prototype.trimRight=function(){var h,d,_,f,y,S,M;for(d=0,M=this.characters.slice().reverse(),f=y=0,S=M.length;y<S&&(h=M[f],h.isWhitespace());f=++y);return f=this.length()-f-1,_=new a.String("",this._preserveWhitespace),_.characters=function(){var A,k,B,P;for(B=this.characters.slice(d,+f+1||9e9),P=[],A=0,k=B.length;A<k;A++)h=B[A],P.push(h.copy());return P}.call(this),_},C.prototype.unformat=function(){var h,d,_,f,y,S,M;for(d=arguments[0],S=arguments[1],y=3<=arguments.length?U.call(arguments,2):[],S<0&&(S=this.length()+S+1),d<0&&(d=this.length()+d),f=this.copy(),_=M=d;d<=S?M<S:M>S;_=d<=S?++M:--M)h=f.characters[_],h.removeTags.apply(h,y);return f},C.prototype.copy=function(){var h,d;return d=new a.String("",this._preserveWhitespace),d.characters=function(){var _,f,y,S;for(y=this.characters,S=[],_=0,f=y.length;_<f;_++)h=y[_],S.push(h.copy());return S}.call(this),d},C.decode=function(h){var d;return d=document.createElement("textarea"),d.innerHTML=h,d.textContent},C.encode=function(h){var d;return d=document.createElement("textarea"),d.textContent=h,d.innerHTML},C.join=function(h,d){var _,f,y,S;for(_=d.shift(),y=0,S=d.length;y<S;y++)f=d[y],_=_.concat(h,f);return _},C})(),c="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-_$".split(""),m=c.concat("1234567890".split("")),I=m.concat([":"]),s=m.concat(["#"]),g=m.concat([":"]),i=1,r=2,p=3,u=4,o=5,x=6,E=7,L=8,T=9,l=10,D=11,O=12,v=13,n=14,e=15,t=16,w=17,N=18,b=19,R=(function(){function C(){this.fsm=new FSM.Machine(this),this.fsm.setInitialState(i),this.fsm.addTransitionAny(i,null,function(h){return this._pushChar(h)}),this.fsm.addTransition("<",i,p),this.fsm.addTransition("&",i,r),this.fsm.addTransitions(s,r,null,function(h){return this.entity+=h}),this.fsm.addTransition(";",r,i,function(){return this._pushChar("&"+this.entity+";"),this.entity=""}),this.fsm.addTransitions([" ",` 3`],p),this.fsm.addTransitions(c,p,u,function(){return this._back()}),this.fsm.addTransition("/",p,o),this.fsm.addTransitions([" ",` 4`],u),this.fsm.addTransitions(c,u,x,function(){return this._back()}),this.fsm.addTransitions([" ",` 5`],o),this.fsm.addTransitions(c,o,E,function(){return this._back()}),this.fsm.addTransitions(g,x,null,function(h){return this.tagName+=h}),this.fsm.addTransitions([" ",` 6`],x,l),this.fsm.addTransition("/",x,L,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",x,i,function(){return this._pushTag()}),this.fsm.addTransitions([" ",` 7`],L),this.fsm.addTransition(">",L,i,function(){return this._pushTag()}),this.fsm.addTransitions([" ",` 8`],l),this.fsm.addTransition("/",l,L,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",l,i,function(){return this._pushTag()}),this.fsm.addTransitions(c,l,D,function(){return this._back()}),this.fsm.addTransitions(g,E,null,function(h){return this.tagName+=h}),this.fsm.addTransitions([" ",` 9`],E,T),this.fsm.addTransition(">",E,i,function(){return this._popTag()}),this.fsm.addTransitions([" ",` 10`],T),this.fsm.addTransition(">",T,i,function(){return this._popTag()}),this.fsm.addTransitions(I,D,null,function(h){return this.attributeName+=h}),this.fsm.addTransitions([" ",` 11`],D,O),this.fsm.addTransition("=",D,v),this.fsm.addTransitions([" ",` 12`],O),this.fsm.addTransition("=",O,v),this.fsm.addTransitions(">",D,l,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitionAny(O,l,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitions([" ",` 13`],v),this.fsm.addTransition("'",v,n),this.fsm.addTransition('"',v,e),this.fsm.addTransitions(m.concat(["&"],v,t,function(){return this._back()})),this.fsm.addTransition(" ",t,l,function(){return this._pushAttribute()}),this.fsm.addTransitions(["/",">"],t,l,function(){return this._back(),this._pushAttribute()}),this.fsm.addTransition("&",t,w),this.fsm.addTransitionAny(t,null,function(h){return this.attributeValue+=h}),this.fsm.addTransition("'",n,l,function(){return this._pushAttribute()}),this.fsm.addTransition("&",n,N),this.fsm.addTransitionAny(n,null,function(h){return this.attributeValue+=h}),this.fsm.addTransition('"',e,l,function(){return this._pushAttribute()}),this.fsm.addTransition("&",e,b),this.fsm.addTransitionAny(e,null,function(h){return this.attributeValue+=h}),this.fsm.addTransitions(s,w,null,function(h){return this.entity+=h}),this.fsm.addTransitions(s,N,function(h){return this.entity+=h}),this.fsm.addTransitions(s,b,null,function(h){return this.entity+=h}),this.fsm.addTransition(";",w,t,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",N,n,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",b,e,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""})}return C.prototype._back=function(){return this.head--},C.prototype._pushAttribute=function(){return this.attributes[this.attributeName]=this.attributeValue,this.attributeName="",this.attributeValue=""},C.prototype._pushChar=function(h){var d,_;return d=new a.Character(h,this.tags),this._preserveWhitespace?void this.string.characters.push(d):!this.string.length()||d.isTag()||d.isEntity()||
13!d.isWhitespace()||(_=this.string.characters[this.string.length()-1],!_.isWhitespace()||_.isTag()||_.isEntity())?this.string.characters.push(d):void 0},C.prototype._pushTag=function(){var h,d;return h=new a.Tag(this.tagName,this.attributes),this.tags.push(h),h.selfClosing()&&(this._pushChar(""),this.tags.pop(),!this.selfClosed&&(d=this.tagName,H.call(a.Tag.SELF_CLOSING,d)>=0)&&this.fsm.reset()),this.tagName="",this.selfClosed=!1,this.attributes={}},C.prototype._popTag=function(){for(var h,d;d=this.tags.pop(),this.string.length()&&(h=this.string.characters[this.string.length()-1],h.isTag()||h.isEntity()||!h.isWhitespace()||h.removeTags(d)),d.name()!==this.tagName.toLowerCase(););return this.tagName=""},C.prototype.parse=function(h,d){var _,f;for(this._preserveWhitespace=d,this.reset(),h=this.preprocess(h),this.fsm.parser=this;this.head<h.length;){_=h[this.head];try{this.fsm.process(_)}catch(y){throw f=y,new Error("Error at char "+this.head+" >> "+f)}this.head++}return this.string},C.prototype.preprocess=function(h){return h=h.replace(/\r\n/g,` 14`).replace(/\r/g,` 15`),h=h.replace(/<!--[\s\S]*?-->/g,""),this._preserveWhitespace||(h=h.replace(/\s+/g," ")),h},C.prototype.reset=function(){return this.fsm.reset(),this.head=0,this.string=new a.String,this.entity="",this.tags=[],this.tagName="",this.selfClosing=!1,this.attributes={},this.attributeName="",this.attributeValue=""},C})(),a.Tag=(function(){function C(h,d){var _,f;this._name=h.toLowerCase(),this._selfClosing=a.Tag.SELF_CLOSING[this._name]===!0,this._head=null,this._attributes={};for(_ in d)f=d[_],this._attributes[_]=f}return C.SELF_CLOSING={area:!0,base:!0,br:!0,hr:!0,img:!0,input:!0,"link meta":!0,wbr:!0},C.prototype.head=function(){var h,d,_,f;if(!this._head){h=[],f=this._attributes;for(d in f)_=f[d],_?h.push(d+'="'+_+'"'):h.push(""+d);h.sort(),h.unshift(this._name),this._head="<"+h.join(" ")+">"}return this._head},C.prototype.name=function(){return this._name},C.prototype.selfClosing=function(){return this._selfClosing},C.prototype.tail=function(){return this._selfClosing?"":"</"+this._name+">"},C.prototype.attr=function(h,d){return d===void 0?this._attributes[h]:(this._attributes[h]=d,this._head=null)},C.prototype.removeAttr=function(h){if(this._attributes[h]!==void 0)return delete this._attributes[h],this._head=null},C.prototype.copy=function(){return new a.Tag(this._name,this._attributes)},C})(),a.Character=(function(){function C(h,d){this._c=h,h.length>1&&(this._c=h.toLowerCase()),this._tags=[],this.addTags.apply(this,d)}return C.prototype.c=function(){return this._c},C.prototype.isEntity=function(){return this._c.length>1},C.prototype.isTag=function(h){return!(this._tags.length===0||!this._tags[0].selfClosing())&&(!h||this._tags[0].name()===h)},C.prototype.isWhitespace=function(){var h;return(h=this._c)===" "||h===` 16`||h===" "||this.isTag("br")},C.prototype.tags=function(){var h;return function(){var d,_,f,y;for(f=this._tags,y=[],d=0,_=f.length;d<_;d++)h=f[d],y.push(h.copy());return y}.call(this)},C.prototype.addTags=function(){var h,d,_,f,y;for(d=1<=arguments.length?U.call(arguments,0):[],y=[],_=0,f=d.length;_<f;_++)h=d[_],Array.isArray(h)||(h.selfClosing()?this.isTag()||this._tags.unshift(h.copy()):y.push(this._tags.push(h.copy())));return y},C.prototype.eq=function(h){var d,_,f,y,S,M,A,k;if(this.c()!==h.c()||this._tags.length!==h._tags.length)return!1;for(_={},A=this._tags,f=0,S=A.length;f<S;f++)d=A[f],_[d.head()]=!0;for(k=h._tags,y=0,M=k.length;y<M;y++)if(d=k[y],!_[d.head()])return!1;return!0},C.prototype.hasTags=function(){var h,d,_,f,y,S,M,A,k;for(f=1<=arguments.length?U.call(arguments,0):[],_={},d={},k=this._tags,y=0,M=k.length;y<M;y++)h=k[y],_[h.name()]=!0,d[h.head()]=!0;for(S=0,A=f.length;S<A;S++)if(typeof(h=f[S])=="string"){if(_[h]===void 0)return!1}else if(d[h.head()]===void 0)return!1;return!0},C.prototype.removeTags=function(){var h,d,_,f,y,S;if(f=1<=arguments.length?U.call(arguments,0):[],f.length===0)return void(this._tags=[]);for(d={},h={},y=0,S=f.length;y<S;y++)_=f[y],typeof _=="string"?d[_]=_:h[_.head()]=_;return this._tags=this._tags.filter(function(M){if(!h[M.head()]&&!d[M.name()])return M})},C.prototype.copy=function(){var h;return new a.Character(this._c,function(){var d,_,f,y;for(f=this._tags,y=[],d=0,_=f.length;d<_;d++)h=f[d],y.push(h.copy());return y}.call(this))},C})()}.call(yt),function(){var c,m,v,b,w,N,D=[].indexOf||function(I){for(var O=0,l=this.length;O<l;O++)if(O in this&&this[O]===I)return O;return-1};c={},c.Range=(function(){function I(O,l){this.set(O,l)}return I.prototype.isCollapsed=function(){return this._from===this._to},I.prototype.span=function(){return this._to-this._from},I.prototype.collapse=function(){return this._to=this._from},I.prototype.eq=function(O){return this.get()[0]===O.get()[0]&&this.get()[1]===O.get()[1]},I.prototype.get=function(){return[this._from,this._to]},I.prototype.select=function(O){var l,e,t,n,i,o,r,s,a;return c.Range.unselectAll(),l=document.createRange(),s=b(O,this._from),i=s[0],r=s[1],a=b(O,this._to),e=a[0],n=a[1],o=i.length||0,t=e.length||0,l.setStart(i,Math.min(r,o)),l.setEnd(e,Math.min(n,t)),window.getSelection().addRange(l)},I.prototype.set=function(O,l){return O=Math.max(0,O),l=Math.max(0,l),this._from=Math.min(O,l),this._to=Math.max(O,l)},I.prepareElement=function(O){var l,e,t,n,i,o;for(t=O.querySelectorAll(m.join(", ")),o=[],l=n=0,i=t.length;n<i;l=++n)e=t[l],e.parentNode.insertBefore(document.createTextNode(""),e),l<t.length-1?o.push(e.parentNode.insertBefore(document.createTextNode(""),e.nextSibling)):o.push(void 0);return o},I.query=function(O){var l,e,t,n,i,o,r;n=new c.Range(0,0);try{l=window.getSelection().getRangeAt(0)}catch{return n}
16return O.firstChild===null&&O.lastChild===null||v(l.startContainer,O)&&v(l.endContainer,O)&&(r=w(O,l),i=r[0],o=r[1],e=r[2],t=r[3],n.set(N(O,i)+o,N(O,e)+t)),n},I.rect=function(){var O,l,e;try{O=window.getSelection().getRangeAt(0)}catch{return null}return O.collapsed?(l=document.createElement("span"),O.insertNode(l),e=l.getBoundingClientRect(),l.parentNode.removeChild(l),e):O.getBoundingClientRect()},I.unselectAll=function(){if(window.getSelection())return window.getSelection().removeAllRanges()},I})(),m=["br","img","input"],v=function(I,O){for(;I;){if(I===O)return!0;I=I.parentNode}return!1},b=function(I,O){var l,e,t,n,i;if(I.childNodes.length===0)return[I,O];for(l=null,e=O,t=(function(){var o,r,s,a;for(s=I.childNodes,a=[],o=0,r=s.length;o<r;o++)n=s[o],a.push(n);return a})();t.length>0;)switch(l=t.shift(),l.nodeType){case Node.TEXT_NODE:if(l.textContent.length>=e)return[l,e];e-=l.textContent.length;break;case Node.ELEMENT_NODE:if(i=l.nodeName.toLowerCase(),D.call(m,i)>=0){if(e===0)return[l,0];e=Math.max(0,e-1)}else l.childNodes&&Array.prototype.unshift.apply(t,(function(){var o,r,s,a;for(s=l.childNodes,a=[],o=0,r=s.length;o<r;o++)n=s[o],a.push(n);return a})())}return[l,e]},N=function(I,O){var l,e,t,n,i,o;if(I.childNodes.length===0)return 0;for(t=0,l=(function(){var r,s,a,u;for(a=I.childNodes,u=[],r=0,s=a.length;r<s;r++)e=a[r],u.push(e);return u})();l.length>0;){if((n=l.shift())===O)return i=n.nodeName.toLowerCase(),D.call(m,i)>=0?t+1:t;switch(n.nodeType){case Node.TEXT_NODE:t+=n.textContent.length;break;case Node.ELEMENT_NODE:o=n.nodeName.toLowerCase(),D.call(m,o)>=0?t+=1:n.childNodes&&Array.prototype.unshift.apply(l,(function(){var r,s,a,u;
16for(a=n.childNodes,u=[],r=0,s=a.length;r<s;r++)e=a[r],u.push(e);return u})())}}return t},w=function(I,O){var l,e,t,n,i,o,r,s,a,u,p,g,E,T;if(e=I.childNodes,a=O.cloneRange(),a.collapse(!0),i=O.cloneRange(),i.collapse(!1),r=a.startContainer,s=a.startOffset,t=i.endContainer,n=i.endOffset,!a.comparePoint)return[r,s,t,n];if(r===I){for(r=e[e.length-1],s=r.textContent.length,o=u=0,g=e.length;u<g;o=++u)if(l=e[o],a.comparePoint(l,0)===1){o===0?(r=l,s=0):(r=e[o-1],s=l.textContent.length),T=r.nodeName.toLowerCase,D.call(m,T)>=0&&(s=1);break}}if(O.collapsed)return[r,s,r,s];if(t===I)for(t=e[e.length-1],n=t.textContent.length,o=p=0,E=e.length;p<E;o=++p)l=e[o],i.comparePoint(l,0)===1&&(t=o===0?l:e[o-1],n=l.textContent.length+1);return[r,s,t,n]},typeof window<"u"&&(window.ContentSelect=c),typeof Q<"u"&&Q.exports&&(Q.exports=c)}.call(yt),function(){var c,m,v,b,w=[].slice,N=[].indexOf||function(l){for(var e=0,t=this.length;e<t;e++)if(e in this&&this[e]===l)return e;return-1},D={}.hasOwnProperty,I=function(l,e){function t(){this.constructor=l}for(var n in e)D.call(e,n)&&(l[n]=e[n]);return t.prototype=e.prototype,l.prototype=new t,l.__super__=e.prototype,l},O=function(l,e){return function(){return l.apply(e,arguments)}};c={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,ENABLE_DRAG_CLONING:!1,HELPER_CHAR_LIMIT:250,INDENT:" ",LANGUAGE:"en",LINE_ENDINGS:` 17`,PREFER_LINE_BREAKS:!1,RESIZE_CORNER_SIZE:15,TRIM_WHITESPACE:!0,_translations:{},_:function(l){var e;return e=c.LANGUAGE,c._translations[e]&&c._translations[e][l]?c._translations[e][l]:l},addTranslations:function(l,e){return c._translations[l]=e},addCSSClass:function(l,e){var t,n,i;return l.classList?void l.classList.add(e):(n=l.getAttribute("class"),n?(i=(function(){var o,r,s,a;for(s=n.split(" "),a=[],o=0,r=s.length;o<r;o++)t=s[o],a.push(t);return a})(),i.indexOf(e)===-1?l.setAttribute("class",n+" "+e):void 0):l.setAttribute("class",e))},attributesToString:function(l){var e,t,n,i,o,r;if(!l)return"";for(n=(function(){var s;s=[];for(t in l)s.push(t);return s})(),n.sort(),e=[],o=0,r=n.length;o<r;o++)t=n[o],i=l[t],i===""?e.push(t):(i=HTMLString.String.encode(i),i=i.replace(/"/g,"""),e.push(t+'="'+i+'"'));return e.join(" ")},removeCSSClass:function(l,e){var t,n,i,o;return l.classList?(l.classList.remove(e),void(l.classList.length===0&&l.removeAttribute("class"))):(n=l.getAttribute("class"),n&&(o=(function(){var r,s,a,u;for(a=n.split(" "),u=[],r=0,s=a.length;r<s;r++)t=a[r],u.push(t);return u})(),(i=o.indexOf(e))>-1)?(o.splice(i,1),o.length?l.setAttribute("class",o.join(" ")):l.removeAttribute("class")):void 0)}},typeof window<"u"&&(window.ContentEdit=c),typeof Q<"u"&&Q.exports&&(Q.exports=c),v=(function(){function l(){this._tagNames={}}return l.prototype.register=function(){var e,t,n,i,o,r;for(e=arguments[0],n=2<=arguments.length?w.call(arguments,1):[],r=[],i=0,o=n.length;i<o;i++)t=n[i],r.push(this._tagNames[t.toLowerCase()]=e);return r},l.prototype.match=function(e){return e=e.toLowerCase(),this._tagNames[e]?this._tagNames[e]:c.Static},l})(),c.TagNames=(function(){function l(){}var e;return e=null,l.get=function(){return e??(e=new v)},l})(),c.Node=(function(){function l(){this._bindings={},this._parent=null,this._modified=null}return l.prototype.lastModified=function(){return this._modified},l.prototype.parent=function(){return this._parent},l.prototype.parents=function(){var e,t;for(t=[],e=this._parent;e;)t.push(e),e=e._parent;return t},l.prototype.type=function(){return"Node"},l.prototype.html=function(e){throw e==null&&(e=""),new Error("`html` not implemented")},l.prototype.bind=function(e,t){return this._bindings[e]===void 0&&(this._bindings[e]=[]),this._bindings[e].push(t),t},l.prototype.trigger=function(){var e,t,n,i,o,r,s;if(n=arguments[0],e=2<=arguments.length?w.call(arguments,1):[],this._bindings[n]){for(r=this._bindings[n],s=[],i=0,o=r.length;i<o;i++)(t=r[i])&&s.push(t.call.apply(t,[this].concat(w.call(e))));return s}},l.prototype.unbind=function(e,t){var n,i,o,r,s,a;if(!e)return void(this._bindings={});if(!t)return void(this._bindings[e]=void 0);if(this._bindings[e]){for(s=this._bindings[e],a=[],n=o=0,r=s.length;o<r;n=++o)i=s[n],i===t?a.push(this._bindings[e].splice(n,1)):a.push(void 0);return a}},l.prototype.commit=function(){return this._modified=null,c.Root.get().trigger("commit",this)},l.prototype.taint=function(){var e,t,n,i,o,r;for(e=Date.now(),this._modified=e,r=this.parents(),i=0,o=r.length;i<o;i++)t=r[i],t._modified=e;return n=c.Root.get(),n._modified=e,n.trigger("taint",this)},l.prototype.closest=function(e){var t;for(t=this.parent();t&&!e(t);)t=t.parent?t.parent():null;return t},l.prototype.next=function(){var e,t,n,i,o,r;if(this.children&&this.children.length>0)return this.children[0];for(r=[this].concat(this.parents()),i=0,o=r.length;i<o;i++){if(n=r[i],!n.parent())return null;if(e=n.parent().children,(t=e.indexOf(n))<e.length-1)return e[t+1]}},l.prototype.nextContent=function(){return this.nextWithTest(function(e){return e.content!==void 0})},l.prototype.nextSibling=function(){var e;return e=this.parent().children.indexOf(this),e===this.parent().children.length-1?null:this.parent().children[e+1]},l.prototype.nextWithTest=function(e){var t;for(t=this;t;)if((t=t.next())&&e(t))return t},l.prototype.previous=function(){var e,t;if(!this.parent())return null;if(e=this.parent().children,e[0]===this)return this.parent();for(t=e[e.indexOf(this)-1];t.children&&t.children.length;)t=t.children[t.children.length-1];return t},l.prototype.previousContent=function(){return this.previousWithTest(function(e){return e.content!==void 0})},l.prototype.previousSibling=function(){var e;return e=this.parent().children.indexOf(this),e===0?null:this.parent().children[e-1]},l.prototype.previousWithTest=function(e){var t;for(t=this;t;)if((t=t.previous())&&e(t))return t},l.extend=function(e){var t,n,i;i=e.prototype;for(t in i)n=i[t],t!=="constructor"&&(this.prototype[t]=n);for(t in e)n=e[t],N.call("__super__",t)>=0||(this.prototype[t]=n);return this},l.fromDOMElement=function(e){throw new Error("`fromDOMElement` not implemented")},l})(),c.NodeCollection=(function(l){function e(){e.__super__.constructor.call(this),this.children=[]}return I(e,l),e.prototype.descendants=function(){var t,n,i;for(t=[],i=this.children.slice();i.length>0;)n=i.shift(),t.push(n),n.children&&n.children.length>0&&(i=n.children.slice().concat(i));return t},e.prototype.isMounted=function(){return!1},e.prototype.type=function(){return"NodeCollection"},e.prototype.attach=function(t,n){return t.parent()&&t.parent().detach(t),t._parent=this,n!==void 0?this.children.splice(n,0,t):this.children.push(t),t.mount&&this.isMounted()&&t.mount(),this.taint(),c.Root.get().trigger("attach",this,t)},e.prototype.commit=function(){var t,n,i,o;for(o=this.descendants(),n=0,i=o.length;n<i;n++)t=o[n],t._modified=null;return this._modified=null,c.Root.get().trigger("commit",this)},e.prototype.detach=function(t){var n;if((n=this.children.indexOf(t))!==-1)return t.unmount&&this.isMounted()&&t.isMounted()&&t.unmount(),this.children.splice(n,1),t._parent=null,this.taint(),c.Root.get().trigger("detach",this,t)},e})(c.Node),c.Element=(function(l){function e(t,n){e.__super__.constructor.call(this),this._tagName=t.toLowerCase(),this._attributes=n||{},this._domElement=null,this._behaviours={drag:!0,drop:!0,merge:!0,remove:!0,resize:!0,spawn:!0}}return I(e,l),e.prototype.attributes=function(){var t,n,i,o;t={},o=this._attributes;for(n in o)i=o[n],t[n]=i;return t},e.prototype.cssTypeName=function(){return"element"},e.prototype.domElement=function(){return this._domElement},e.prototype.isFixed=function(){return this.parent()&&this.parent().type()==="Fixture"},e.prototype.isFocused=function(){return c.Root.get().focused()===this},e.prototype.isMounted=function(){return this._domElement!==null},e.prototype.type=function(){return"Element"},e.prototype.typeName=function(){return"Element"},e.prototype.addCSSClass=function(t){var n;if(n=!1,this.hasCSSClass(t)||(n=!0,this.attr("class")?this.attr("class",this.attr("class")+" "+t):this.attr("class",t)),this._addCSSClass(t),n)return this.taint()},e.prototype.attr=function(t,n){return t=t.toLowerCase(),n===void 0?this._attributes[t]:(this._attributes[t]=n,this.isMounted()&&t.toLowerCase()!=="class"&&this._domElement.setAttribute(t,n),this.taint())},e.prototype.blur=function(){var t;if(t=c.Root.get(),this.isFocused())return this._removeCSSClass("ce-element--focused"),t._focused=null,t.trigger("blur",this)},e.prototype.can=function(t,n){return n===void 0?!this.isFixed()&&this._behaviours[t]:this._behaviours[t]=n},e.prototype.clone=function(){var t;return t=document.createElement("div"),t.innerHTML=this.html(),this.constructor.fromDOMElement(t.children[0])},e.prototype.createDraggingDOMElement=function(){var t;if(this.isMounted())return t=document.createElement("div"),t.setAttribute("class","ce-drag-helper ce-drag-helper--type-"+this.cssTypeName()),t.setAttribute("data-ce-type",c._(this.t
17ypeName())),t},e.prototype.drag=function(t,n){var i;if(this.isMounted()&&this.can("drag"))return i=c.Root.get(),i.startDragging(this,t,n),i.trigger("drag",this)},e.prototype.drop=function(t,n){var i;if(this.can("drop")){if(i=c.Root.get(),t){if(t._removeCSSClass("ce-element--drop"),t._removeCSSClass("ce-element--drop-"+n[0]),t._removeCSSClass("ce-element--drop-"+n[1]),this.constructor.droppers[t.type()])return this.constructor.droppers[t.type()](this,t,n),void i.trigger("drop",this,t,n);if(t.constructor.droppers[this.type()])return t.constructor.droppers[this.type()](this,t,n),void i.trigger("drop",this,t,n)}return i.trigger("drop",this,null,null)}},e.prototype.focus=function(t){var n;if(n=c.Root.get(),!this.isFocused())return n.focused()&&n.focused().blur(),this._addCSSClass("ce-element--focused"),n._focused=this,this.isMounted()&&!t&&this.domElement().focus(),n.trigger("focus",this)},e.prototype.hasCSSClass=function(t){var n,i;return!!(this.attr("class")&&(i=function(){var o,r,s,a;for(s=this.attr("class").split(" "),a=[],o=0,r=s.length;o<r;o++)n=s[o],a.push(n);return a}.call(this),i.indexOf(t)>-1))},e.prototype.merge=function(t){return!(!this.can("merge")||!this.can("remove"))&&(this.constructor.mergers[t.type()]?this.constructor.mergers[t.type()](t,this):t.constructor.mergers[this.type()]?t.constructor.mergers[this.type()](t,this):void 0)},e.prototype.mount=function(){var t;return this._domElement||(this._domElement=document.createElement(this.tagName())),t=this.nextSibling(),t?this.parent().domElement().insertBefore(this._domElement,t.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"),c.Root.get().trigger("mount",this)},e.prototype.removeAttr=function(t){if(t=t.toLowerCase(),this._attributes[t])return delete this._attributes[t],this.isMounted()&&t.toLowerCase()!=="class"&&this._domElement.removeAttribute(t),this.taint()},e.prototype.removeCSSClass=function(t){var n,i,o;if(this.hasCSSClass(t))return o=function(){var r,s,a,u;for(a=this.attr("class").split(" "),u=[],r=0,s=a.length;r<s;r++)n=a[r],u.push(n);return u}.call(this),i=o.indexOf(t),i>-1&&o.splice(i,1),o.length?this.attr("class",o.join(" ")):this.removeAttr("class"),this._removeCSSClass(t),this.taint()},e.prototype.tagName=function(t){return t===void 0?this._tagName:(this._tagName=t.toLowerCase(),this.isMounted()&&(this.unmount(),this.mount()),this.taint())},e.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,c.Root.get().trigger("unmount",this))},e.prototype._addDOMEventListeners=function(){var t,n,i,o;this._domEventHandlers={dragstart:(function(r){return function(s){return s.preventDefault()}})(),focus:(function(r){return function(s){return s.preventDefault()}})(),keydown:(function(r){return function(s){return r._onKeyDown(s)}})(this),keyup:(function(r){return function(s){return r._onKeyUp(s)}})(this),mousedown:(function(r){return function(s){if(s.button===0)return r._onMouseDown(s)}})(this),mousemove:(function(r){return function(s){return r._onMouseMove(s)}})(this),mouseover:(function(r){return function(s){return r._onMouseOver(s)}})(this),mouseout:(function(r){return function(s){return r._onMouseOut(s)}})(this),mouseup:(function(r){return function(s){if(s.button===0)return r._onMouseUp(s)}})(this),dragover:(function(r){return function(s){return s.preventDefault()}})(),drop:(function(r){return function(s){return r._onNativeDrop(s)}})(this),paste:(function(r){return function(s){return r._onPaste(s)}})(this)},i=this._domEventHandlers,o=[];for(n in i)t=i[n],o.push(this._domElement.addEventListener(n,t));return o},e.prototype._onKeyDown=function(t){},e.prototype._onKeyUp=function(t){},e.prototype._onMouseDown=function(t){if(this.focus)return this.focus(!0)},e.prototype._onMouseMove=function(t){return this._onOver(t)},e.prototype._onMouseOver=function(t){return this._onOver(t)},e.prototype._onMouseOut=function(t){var n;if(this._removeCSSClass("ce-element--over"),n=c.Root.get(),n.dragging())return 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"),n._dropTarget=null},e.prototype._onMouseUp=function(t){return this._ieMouseDownEchoed=!1},e.prototype._onNativeDrop=function(t){return t.preventDefault(),t.stopPropagation(),c.Root.get().trigger("native-drop",this,t)},e.prototype._onPaste=function(t){return t.preventDefault(),t.stopPropagation(),c.Root.get().trigger("paste",this,t)},e.prototype._onOver=function(t){var n,i;if(this._addCSSClass("ce-element--over"),i=c.Root.get(),(n=i.dragging())&&n!==this&&!i._dropTarget&&this.can("drop")&&(this.constructor.droppers[n.type()]||n.constructor.droppers[this.type()]))return this._addCSSClass("ce-element--drop"),i._dropTarget=this},e.prototype._removeDOMEventListeners=function(){var t,n,i,o;i=this._domEventHandlers,o=[];for(n in i)t=i[n],o.push(this._domElement.removeEventListener(n,t));return o},e.prototype._addCSSClass=function(t){if(this.isMounted())return c.addCSSClass(this._domElement,t)},e.prototype._attributesToString=function(){return Object.getOwnPropertyNames(this._attributes).length>0?" "+c.attributesToString(this._attributes):""},e.prototype._removeCSSClass=function(t){if(this.isMounted())return c.removeCSSClass(this._domElement,t)},e.droppers={},e.mergers={},e.placements=["above","below"],e.getDOMElementAttributes=function(t){var n,i,o,r,s;if(!t.hasAttributes())return{};for(i={},s=t.attributes,o=0,r=s.length;o<r;o++)n=s[o],i[n.name.toLowerCase()]=n.value;return i},e._dropVert=function(t,n,i){var o;return c.ENABLE_DRAG_CLONING&&window.event.altKey?t=t.clone():t.parent().detach(t),o=n.parent().children.indexOf(n),i[0]==="below"&&(o+=1),n.parent().attach(t,o)},e._dropBoth=function(t,n,i){var o,r,s,a,u,p,g,E;if(c.ENABLE_DRAG_CLONING&&window.event.altKey?t=t.clone():t.parent().detach(t),u=n.parent().children.indexOf(n),i[0]==="below"&&i[1]==="center"&&(u+=1),r=c.ALIGNMENT_CLASS_NAMES.left,s=c.ALIGNMENT_CLASS_NAMES.right,t.a){if(t._removeCSSClass(r),t._removeCSSClass(s),t.a.class){for(o=[],E=t.a.class.split(" "),p=0,g=E.length;p<g;p++)(a=E[p])!==r&&a!==s&&o.push(a);o.length?t.a.class=o.join(" "):delete t.a.class}}else t.removeCSSClass(r),t.removeCSSClass(s);
17return i[1]==="left"&&(t.a?(t.a.class?t.a.class+=" "+r:t.a.class=r,t._addCSSClass(r)):t.addCSSClass(r)),i[1]==="right"&&(t.a?(t.a.class?t.a.class+=" "+s:t.a.class=s,t._addCSSClass(s)):t.addCSSClass(s)),n.parent().attach(t,u)},e})(c.Node),c.ElementCollection=(function(l){function e(t,n){e.__super__.constructor.call(this,t,n),c.NodeCollection.prototype.constructor.call(this)}return I(e,l),e.extend(c.NodeCollection),e.prototype.cssTypeName=function(){return"element-collection"},e.prototype.isMounted=function(){return this._domElement!==null},e.prototype.type=function(){return"ElementCollection"},e.prototype.createDraggingDOMElement=function(){var t,n;if(this.isMounted())return t=e.__super__.createDraggingDOMElement.call(this),n=this._domElement.textContent,n.length>c.HELPER_CHAR_LIMIT&&(n=n.substr(0,c.HELPER_CHAR_LIMIT)),t.innerHTML=n,t},e.prototype.detach=function(t){if(c.NodeCollection.prototype.detach.call(this,t),this.children.length===0&&this.parent())return this.parent().detach(this)},e.prototype.html=function(t){var n,i,o,r;return t==null&&(t=""),o=function(){var s,a,u,p;for(u=this.children,p=[],s=0,a=u.length;s<a;s++)i=u[s],p.push(i.html(t+c.INDENT));return p}.call(this),r=c.LINE_ENDINGS,this.isFixed()?o.join(r):(n=this._attributesToString(),t+"<"+this.tagName()+n+">"+r+o.join(r)+r+t+"</"+this.tagName()+">")},e.prototype.mount=function(){var t,n,i,o,r,s,a,u;this._domElement=document.createElement(this._tagName),s=this._attributes;for(n in s)i=s[n],this._domElement.setAttribute(n,i);for(e.__super__.mount.call(this),a=this.children,u=[],o=0,r=a.length;o<r;o++)t=a[o],u.push(t.mount());return u},e.prototype.unmount=function(){var t,n,i,o;for(o=this.children,n=0,i=o.length;n<i;n++)t=o[n],t.unmount();return e.__super__.unmount.call(this)},e.prototype.blur=void 0,e.prototype.focus=void 0,e})(c.Element),c.ResizableElement=(function(l){function e(t,n){e.__super__.constructor.call(this,t,n),this._domSizeInfoElement=null,this._aspectRatio=1}return I(e,l),e.prototype.aspectRatio=function(){return this._aspectRatio},e.prototype.maxSize=function(){var t;return t=parseInt(this.attr("data-ce-max-width")||0),t||(t=c.DEFAULT_MAX_ELEMENT_WIDTH),t=Math.max(t,this.size()[0]),[t,t*this.aspectRatio()]},e.prototype.minSize=function(){var t;return t=parseInt(this.attr("data-ce-min-width")||0),t||(t=c.DEFAULT_MIN_ELEMENT_WIDTH),t=Math.min(t,this.size()[0]),[t,t*this.aspectRatio()]},e.prototype.type=function(){return"ResizableElement"},e.prototype.mount=function(){return e.__super__.mount.call(this),this._domElement.setAttribute("data-ce-size",this._getSizeInfo())},e.prototype.resize=function(t,n,i){if(this.isMounted()&&this.can("resize"))return c.Root.get().startResizing(this,t,n,i,!0)},e.prototype.size=function(t){var n,i,o,r;return t?(t[0]=parseInt(t[0]),t[1]=parseInt(t[1]),o=this.minSize(),t[0]=Math.max(t[0],o[0]),t[1]=Math.max(t[1],o[1]),i=this.maxSize(),t[0]=Math.min(t[0],i[0]),t[1]=Math.min(t[1],i[1]),this.attr("width",parseInt(t[0])),this.attr("height",parseInt(t[1])),this.isMounted()?(this._domElement.style.width=t[0]+"px",this._domElement.style.height=t[1]+"px",this._domElement.setAttribute("data-ce-size",this._getSizeInfo())):void 0):(r=parseInt(this.attr("width")||1),n=parseInt(this.attr("height")||1),[r,n])},e.prototype._onMouseDown=function(t){var n;return e.__super__._onMouseDown.call(this,t),n=this._getResizeCorner(t.clientX,t.clientY),n?this.resize(n,t.clientX,t.clientY):(clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout((function(i){return function(){return i.drag(t.pageX,t.pageY)}})(this),150))},e.prototype._onMouseMove=function(t){var n;if(e.__super__._onMouseMove.call(this),this.can("resize"))return 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"),n=this._getResizeCorner(t.clientX,t.clientY),n?this._addCSSClass("ce-element--resize-"+n[0]+"-"+n[1]):void 0},e.prototype._onMouseOut=function(t){return e.__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")},e.prototype._onMouseUp=function(t){if(e.__super__._onMouseUp.call(this),this._dragTimeout)return clearTimeout(this._dragTimeout)},e.prototype._getResizeCorner=function(t,n){var i,o,r,s,a;return r=this._domElement.getBoundingClientRect(),a=[t-r.left,n-r.top],t=a[0],n=a[1],s=this.size(),o=c.RESIZE_CORNER_SIZE,o=Math.min(o,Math.max(parseInt(s[0]/4),1)),o=Math.min(o,Math.max(parseInt(s[1]/4),1)),i=null,t<o?n<o?i=["top","left"]:n>r.height-o&&(i=["bottom","left"]):t>r.width-o&&(n<o?i=["top","right"]:n>r.height-o&&(i=["bottom","right"])),i},e.prototype._getSizeInfo=function(){var t;return t=this.size(),"w "+t[0]+" \xD7 h "+t[1]},e})(c.Element),c.Region=(function(l){function e(t){e.__super__.constructor.call(this),this._domElement=t,this.setContent(t)}return I(e,l),e.prototype.domElement=function(){return this._domElement},e.prototype.isMounted=function(){return!0},e.prototype.type=function(){return"Region"},e.prototype.html=function(t){var n,i;return t==null&&(t=""),i=c.LINE_ENDINGS,function(){var o,r,s,a;for(s=this.children,a=[],o=0,r=s.length;o<r;o++)n=s[o],a.push(n.html(t));return a}.call(this).join(i).trim()},e.prototype.setContent=function(t){var n,i,o,r,s,a,u,p,g,E,T,x,L,R;for(a=t,t.childNodes===void 0&&(g=document.createElement("div"),g.innerHTML=t,a=g),R=this.children.slice(),E=0,x=R.length;E<x;E++)i=R[E],this.detach(i);for(p=c.TagNames.get(),r=(function(){var U,H,C,h;for(C=a.childNodes,h=[],U=0,H=C.length;U<H;U++)n=C[U],h.push(n);return h})(),T=0,L=r.length;T<L;T++)o=r[T],o.nodeType===1&&(s=o.getAttribute("data-ce-tag")?p.match(o.getAttribute("data-ce-tag")):p.match(o.tagName),u=s.fromDOMElement(o),a.removeChild(o),u&&this.attach(u));return c.Root.get().trigger("ready",this)},e})(c.NodeCollection),c.Fixture=(function(l){function e(t){var n,i,o;e.__super__.constructor.call(this),this._domElement=t,o=c.TagNames.get(),n=this._domElement.getAttribute("data-ce-tag")?o.match(this._domElement.getAttribute("data-ce-tag")):o.match(this._domElement.tagName),i=n.fromDOMElement(this._domElement),this.children=[i],i._parent=this,i.mount(),c.Root.get().trigger("ready",this)}return I(e,l),e.prototype.domElement=function(){return this._domElement},e.prototype.isMounted=function(){return!0},e.prototype.type=function(){return"Fixture"},e.prototype.html=function(t){var n,i;return t==null&&(t=""),i=c.LINE_ENDINGS,function(){var o,r,s,a;for(s=this.children,a=[],o=0,r=s.length;o<r;o++)n=s[o],a.push(n.html(t));return a}.call(this).join(i).trim()},e})(c.NodeCollection),m=(function(l){function e(){this._onStopResizing=O(this._onStopResizing,this),this._onResize=O(this._onResize,this),this._onStopDragging=O(this._onStopDragging,this),this._onDrag=O(this._onDrag,this),e.__super__.constructor.call(this),this._focused=null,this._dragging=null,this._dropTarget=null,this._draggingDOMElement=null,this._resizing=null,this._resizingInit=null}return I(e,l),e.prototype.dragging=function(){return this._dragging},e.prototype.dropTarget=function(){return this._dropTarget}
17,e.prototype.focused=function(){return this._focused},e.prototype.resizing=function(){return this._resizing},e.prototype.type=function(){return"Root"},e.prototype.cancelDragging=function(){if(this._dragging)return 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,c.removeCSSClass(document.body,"ce--dragging")},e.prototype.startDragging=function(t,n,i){if(!this._dragging)return this._dragging=t,this._dragging._addCSSClass("ce-element--dragging"),this._draggingDOMElement=this._dragging.createDraggingDOMElement(),document.body.appendChild(this._draggingDOMElement),this._draggingDOMElement.style.left=n+"px",this._draggingDOMElement.style.top=i+"px",document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),c.addCSSClass(document.body,"ce--dragging")},e.prototype._getDropPlacement=function(t,n){var i,o,r,s;return this._dropTarget?(o=this._dropTarget.domElement().getBoundingClientRect(),s=[t-o.left,n-o.top],t=s[0],n=s[1],i="center",t<c.DROP_EDGE_SIZE?i="left":t>o.width-c.DROP_EDGE_SIZE&&(i="right"),r="above",n>o.height/2&&(r="below"),[r,i]):null},e.prototype._onDrag=function(t){var n,i,o;if(ContentSelect.Range.unselectAll(),this._draggingDOMElement.style.left=t.pageX+"px",this._draggingDOMElement.style.top=t.pageY+"px",this._dropTarget&&(n=this._getDropPlacement(t.clientX,t.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"),i=n[0],N.call(this._dragging.constructor.placements,i)>=0&&this._dropTarget._addCSSClass("ce-element--drop-"+n[0]),o=n[1],N.call(this._dragging.constructor.placements,o)>=0))return this._dropTarget._addCSSClass("ce-element--drop-"+n[1])},e.prototype._onStopDragging=function(t){var n;return n=this._getDropPlacement(t.clientX,t.clientY),this._dragging.drop(this._dropTarget,n),this.cancelDragging()},e.prototype.startResizing=function(t,n,i,o,r){var s,a;if(!this._resizing)return this._resizing=t,this._resizingInit={corner:n,fixed:r,origin:[i,o],size:t.size()},this._resizing._addCSSClass("ce-element--resizing"),a=this._resizing.parent().domElement(),s=document.createElement("div"),s.setAttribute("class","ce-measure"),a.appendChild(s),this._resizingParentWidth=s.getBoundingClientRect().width,a.removeChild(s),document.addEventListener("mousemove",this._onResize),document.addEventListener("mouseup",this._onStopResizing),c.addCSSClass(document.body,"ce--resizing")},e.prototype._onResize=function(t){var n,i,o,r;return ContentSelect.Range.unselectAll(),o=this._resizingInit.origin[0]-t.clientX,this._resizingInit.corner[1]==="right"&&(o=-o),i=this._resizingInit.size[0]+o,i=Math.min(i,this._resizingParentWidth),this._resizingInit.fixed?n=i*this._resizing.aspectRatio():(r=this._resizingInit.origin[1]-t.clientY,this._resizingInit.corner[0]==="bottom"&&(r=-r),n=this._resizingInit.size[1]+r),this._resizing.size([i,n])},e.prototype._onStopResizing=function(t){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,c.removeCSSClass(document.body,"ce--resizing")},e})(c.Node),c.Root=(function(){function l(){}var e;return e=null,l.get=function(){return e??(e=new m)},l})(),c.Static=(function(l){function e(t,n,i){e.__super__.constructor.call(this,t,n),this._content=i}return I(e,l),e.prototype.cssTypeName=function(){return"static"},e.prototype.type=function(){return"Static"},e.prototype.typeName=function(){return"Static"},e.prototype.createDraggingDOMElement=function(){var t,n;if(this.isMounted())return t=e.__super__.createDraggingDOMElement.call(this),n=this._domElement.textContent,n.length>c.HELPER_CHAR_LIMIT&&(n=n.substr(0,c.HELPER_CHAR_LIMIT)),t.innerHTML=n,t},e.prototype.html=function(t){return t==null&&(t=""),HTMLString.Tag.SELF_CLOSING[this._tagName]?t+"<"+this._tagName+this._attributesToString()+">":t+"<"+this._tagName+this._attributesToString()+">"+this._content+t+"</"+this._tagName+">"},e.prototype.mount=function(){var t,n,i;this._domElement=document.createElement(this._tagName),i=this._attributes;for(t in i)n=i[t],this._domElement.setAttribute(t,n);return this._domElement.innerHTML=this._content,e.__super__.mount.call(this)}
17,e.prototype.blur=void 0,e.prototype.focus=void 0,e.prototype._onMouseDown=function(t){if(e.__super__._onMouseDown.call(this,t),this.attr("data-ce-moveable")!==void 0)return clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout((function(n){return function(){return n.drag(t.pageX,t.pageY)}})(this),150)},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.prototype._onMouseUp=function(t){if(e.__super__._onMouseUp.call(this,t),this._dragTimeout)return clearTimeout(this._dragTimeout)},e.droppers={Static:c.Element._dropVert},e.fromDOMElement=function(t){return new this(t.tagName,this.getDOMElementAttributes(t),t.innerHTML)},e})(c.Element),c.TagNames.get().register(c.Static,"static"),c.Text=(function(l){function e(t,n,i){e.__super__.constructor.call(this,t,n),i instanceof HTMLString.String?this.content=i:c.TRIM_WHITESPACE?this.content=new HTMLString.String(i).trim():this.content=new HTMLString.String(i,!0)}return I(e,l),e.prototype.cssTypeName=function(){return"text"},e.prototype.type=function(){return"Text"},e.prototype.typeName=function(){return"Text"},e.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")),e.__super__.blur.call(this)},e.prototype.createDraggingDOMElement=function(){var t,n;if(this.isMounted())return t=e.__super__.createDraggingDOMElement.call(this),n=HTMLString.String.encode(this._domElement.textContent),n.length>c.HELPER_CHAR_LIMIT&&(n=n.substr(0,c.HELPER_CHAR_LIMIT)),t.innerHTML=n,t},e.prototype.drag=function(t,n){return this.storeState(),this._domElement.removeAttribute("contenteditable"),e.__super__.drag.call(this,t,n)},e.prototype.drop=function(t,n){return e.__super__.drop.call(this,t,n),this.restoreState()},e.prototype.focus=function(t){return this.isMounted()&&this._domElement.setAttribute("contenteditable",""),e.__super__.focus.call(this,t)},e.prototype.html=function(t){var n,i,o;return t==null&&(t=""),(!this._lastCached||this._lastCached<this._modified)&&(i=c.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),i.optimize(),this._lastCached=Date.now(),this._cached=i.html()),o=c.LINE_ENDINGS,n=this._attributesToString(),t+"<"+this._tagName+n+">"+o+t+c.INDENT+this._cached+o+t+"</"+this._tagName+">"},e.prototype.mount=function(){var t,n,i;this._domElement=document.createElement(this._tagName),i=this._attributes;for(t in i)n=i[t],this._domElement.setAttribute(t,n);return this.updateInnerHTML(),e.__super__.mount.call(this)},e.prototype.restoreState=function(){if(this._savedSelection)return 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)},e.prototype.selection=function(t){return t===void 0?this.isMounted()?ContentSelect.Range.query(this._domElement):new ContentSelect.Range(0,0):t.select(this._domElement)},e.prototype.storeState=function(){if(this.isMounted()&&this.isFocused())return this._savedSelection=ContentSelect.Range.query(this._domElement)},e.prototype.unmount=function(){return this._domElement.removeAttribute("contenteditable"),e.__super__.unmount.call(this)},e.prototype.updateInnerHTML=function(){return this._domElement.innerHTML=this.content.html(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},e.prototype._onKeyDown=function(t){switch(t.keyCode){case 40:return this._keyDown(t);case 37:return this._keyLeft(t);case 39:return this._keyRight(t);case 38:return this._keyUp(t);case 9:return this._keyTab(t);case 8:return this._keyBack(t);case 46:return this._keyDelete(t);case 13:return this._keyReturn(t)}},e.prototype._onKeyUp=function(t){return e.__super__._onKeyUp.call(this,t),this._syncContent()},e.prototype._onMouseDown=function(t){if(e.__super__._onMouseDown.call(this,t),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout((function(n){return function(){return n.drag(t.pageX,t.pageY)}})(this),c.DRAG_HOLD_DURATION),this.content.length()===0&&c.Root.get().focused()===this)return t.preventDefault(),document.activeElement!==this._domElement&&this._domElement.focus(),new ContentSelect.Range(0,0).select(this._domElement)},e.prototype._onMouseMove=function(t){return this._dragTimeout&&clearTimeout(this._dragTimeout),e.__super__._onMouseMove.call(this,t)},e.prototype._onMouseOut=function(t){return this._dragTimeout&&clearTimeout(this._dragTimeout),e.__super__._onMouseOut.call(this,t)},e.prototype._onMouseUp=function(t){return this._dragTimeout&&clearTimeout(this._dragTimeout),e.__super__._onMouseUp.call(this,t)},e.prototype._keyBack=function(t){var n,i;if(i=ContentSelect.Range.query(this._domElement),i.get()[0]===0&&i.isCollapsed())return t.preventDefault(),n=this.previousContent(),this._syncContent(),n?n.merge(this):void 0},e.prototype._keyDelete=function(t){var n,i;if(i=ContentSelect.Range.query(this._domElement),this._atEnd(i)&&i.isCollapsed())return t.preventDefault(),n=this.nextContent(),n?this.merge
17(n):void 0},e.prototype._keyDown=function(t){return this._keyRight(t)},e.prototype._keyLeft=function(t){var n,i;if(i=ContentSelect.Range.query(this._domElement),i.get()[0]===0&&i.isCollapsed())return t.preventDefault(),n=this.previousContent(),n?(n.focus(),i=new ContentSelect.Range(n.content.length(),n.content.length()),i.select(n.domElement())):c.Root.get().trigger("previous-region",this.closest(function(o){return o.type()==="Fixture"||o.type()==="Region"}))},e.prototype._keyReturn=function(t){var n,i,o,r,s,a;if(t.preventDefault(),!(this.content.isWhitespace()&&!t.shiftKey^c.PREFER_LINE_BREAKS)){if(r=ContentSelect.Range.query(this._domElement),a=this.content.substring(0,r.get()[0]),s=this.content.substring(r.get()[1]),t.shiftKey^c.PREFER_LINE_BREAKS)return i=r.get()[0],o="<br>",this.content.length()===i&&(this.content.length()!==0&&this.content.characters[i-1].isTag("br")||(o="<br><br>")),this.content=this.content.insert(i,new HTMLString.String(o,!0),!0),this.updateInnerHTML(),i+=1,r=new ContentSelect.Range(i,i),r.select(this.domElement()),void this.taint();if(this.can("spawn"))return this.content=a.trim(),this.updateInnerHTML(),n=new this.constructor("p",{},s.trim()),this.parent().attach(n,this.parent().children.indexOf(this)+1),a.length()?(n.focus(),r=new ContentSelect.Range(0,0),r.select(n.domElement())):(r=new ContentSelect.Range(0,a.length()),r.select(this._domElement)),this.taint()}},e.prototype._keyRight=function(t){var n,i;if(i=ContentSelect.Range.query(this._domElement),this._atEnd(i)&&i.isCollapsed())return t.preventDefault(),n=this.nextContent(),n?(n.focus(),i=new ContentSelect.Range(0,0),i.select(n.domElement())):c.Root.get().trigger("next-region",this.closest(function(o){return o.type()==="Fixture"||o.type()==="Region"}))},e.prototype._keyTab=function(t){if(t.preventDefault(),this.isFixed())return t.shiftKey?c.Root.get().trigger("previous-region",this.closest(function(n){return n.type()==="Fixture"||n.type()==="Region"})):c.Root.get().trigger("next-region",this.closest(function(n){return n.type()==="Fixture"||n.type()==="Region"}))},e.prototype._keyUp=function(t){return this._keyLeft(t)},e.prototype._atEnd=function(t){return t.get()[0]>=this.content.length()},e.prototype._flagIfEmpty=function(){return this.content.length()===0?this._addCSSClass("ce-element--empty"):this._removeCSSClass("ce-element--empty")},e.prototype._syncContent=function(t){var n,i;return i=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML,this.content.preserveWhitespace()),n=this.content.html(),i!==n&&this.taint(),this._flagIfEmpty()},e.droppers={Static:c.Element._dropVert,Text:c.Element._dropVert},e.mergers={Text:function(t,n){var i;return i=n.content.length(),t.content.length()&&(n.content=n.content.concat(t.content)),n.isMounted()&&n.updateInnerHTML(),n.focus(),new ContentSelect.Range(i,i).select(n._domElement),t.parent()&&t.parent().detach(t),n.taint()}},e.fromDOMElement=function(t){return new this(t.tagName,this.getDOMElementAttributes(t),t.innerHTML.replace(/^\s+|\s+$/g,""))},e})(c.Element),c.TagNames.get().register(c.Text,"address","blockquote","h1","h2","h3","h4","h5","h6","p"),c.PreText=(function(l){function e(t,n,i){i instanceof HTMLString.String?this.content=i:this.content=new HTMLString.String(i,!0),c.Element.call(this,t,n)}return I(e,l),e.TAB_INDENT=" ",e.prototype.cssTypeName=function(){return"pre-text"},e.prototype.type=function(){return"PreText"},e.prototype.typeName=function(){return"Preformatted"},e.prototype.blur=function(){return this.isMounted()&&(this._domElement.innerHTML=this.content.html()),e.__super__.blur.call(this)},e.prototype.html=function(t){var n;return t==null&&(t=""),(!this._lastCached||this._lastCached<this._modified)&&(n=this.content.copy(),n.optimize(),this._lastCached=Date.now(),this._cached=n.html()),t+"<"+this._tagName+this._attributesToString()+">"+this._cached+"</"+this._tagName+">"},e.prototype.updateInnerHTML=function(){var t;return t=this.content.html(),this._domElement.innerHTML=t,this._ensureEndZWS(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},e.prototype._keyBack=function(t){var n;return n=ContentSelect.Range.query(this._domElement),n.get()[0]<=this.content.length()?e.__super__._keyBack.call(this,t):(n.set(this.content.length(),this.content.length()),n.select(this._domElement))},e.prototype._keyReturn=function(t){var n,i,o,r;return t.preventDefault(),i=ContentSelect.Range.query(this._domElement),n=i.get()[0]+1,i.get()[0]===0&&i.isCollapsed()?this.content=new HTMLString.String(` 18`,!0).concat(this.content):this._atEnd(i)&&i.isCollapsed()?this.content=this.content.concat(new HTMLString.String(` 19`,!0)):i.get()[0]===0&&i.get()[1]===this.content.length()?(this.content=new HTMLString.String(` 20`,!0),n=0):(r=this.content.substring(0,i.get()[0]),o=this.content.substring(i.get()[1]),this.content=r.concat(new HTMLString.String(` 21`,!0),o)),this.updateInnerHTML(),i.set(n,n),i.select(this._domElement),this.taint()},e.prototype._keyTab=function(t){var n,i,o,r,s,a,u,p,g,E,T,x,L,R,U,H,C,h,d,_,f,y,S,M,A,k;for(t.preventDefault(),n=this.content.length(),g=c.PreText.TAB_INDENT,p=g.length,L=this.content.split(` 22`),R=this.selection().get(),R[0]=Math.min(R[0],n),R[1]=Math.min(R[1],n),o=0,C=-1,r=-1,a=_=0,M=L.length;_<M&&(T=L[a],x=T.length()+1,R[0]<o+x&&C===-1&&(C=a),R[1]<o+x&&r===-1&&(r=a),!(C>-1&&r>-1));a=++_)o+=x;if(C===r)p-=(R[0]-o)%p,u=new HTMLString.String(Array(p+1).join(" "),!0),d=L[
22C].substring(0,R[0]-o),h=L[C].substring(R[1]-o),L[C]=d.concat(u,h),H=p;else if(t.shiftKey){for(s=0,a=f=C;C<=r?f<=r:f>=r;a=C<=r?++f:--f){for(k=L[a].characters.slice(),E=y=0,A=k.length;y<A&&(i=k[E],!(E>p-1))&&i.isWhitespace();E=++y)L[a].characters.shift();a===C&&(s=E)}H=Math.max(-p,-s)}else{for(u=new HTMLString.String(g,!0),a=S=C;C<=r?S<=r:S>=r;a=C<=r?++S:--S)L[a]=u.concat(L[a]);H=p}return this.content=HTMLString.String.join(new HTMLString.String(` 23`,!0),L),this.updateInnerHTML(),U=this.content.length()-n,new ContentSelect.Range(R[0]+H,R[1]+U).select(this._domElement)},e.prototype._syncContent=function(t){var n,i;return this._ensureEndZWS(),i=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML.replace(/\u200B$/g,""),this.content.preserveWhitespace()),n=this.content.html(),i!==n&&this.taint(),this._flagIfEmpty()},e.prototype._ensureEndZWS=function(){var t,n;if(this._domElement.lastChild&&(t=this._domElement.innerHTML,!(t[t.length-1]==="\u200B"&&t.indexOf("\u200B")<t.length-1)))return n=(function(i){return function(){return t.indexOf("\u200B")>-1&&(i._domElement.innerHTML=t.replace(/\u200B/g,"")),i._domElement.lastChild.textContent+="\u200B"}})(this),this._savedSelection?n():(this.storeState(),n(),this.restoreState())},e.droppers={PreText:c.Element._dropVert,Static:c.Element._dropVert,Text:c.Element._dropVert},e.mergers={},e.fromDOMElement=function(t){return new this(t.tagName,this.getDOMElementAttributes(t),t.innerHTML)},e})(c.Text),c.TagNames.get().register(c.PreText,"pre"),c.Image=(function(l){function e(t,n){var i;e.__super__.constructor.call(this,"img",t),this.a=n||null,i=this.size(),this._aspectRatio=i[1]/i[0]}return I(e,l),e.prototype.cssTypeName=function(){return"image"},e.prototype.type=function(){return"Image"},e.prototype.typeName=function(){return"Image"},e.prototype.createDraggingDOMElement=function(){var t;if(this.isMounted())return t=e.__super__.createDraggingDOMElement.call(this),t.style.backgroundImage="url('"+this._attributes.src+"')",t},e.prototype.html=function(t){var n,i,o;return t==null&&(t=""),i=t+"<img"+this._attributesToString()+">",this.a?(o=c.LINE_ENDINGS,n=c.attributesToString(this.a),n+=' data-ce-tag="img"',t+"<a "+n+">"+o+c.INDENT+i+o+t+"</a>"):i},e.prototype.mount=function(){var t,n;return this._domElement=document.createElement("div"),t="",this.a&&this.a.class&&(t+=" "+this.a.class),this._attributes.class&&(t+=" "+this._attributes.class),this._domElement.setAttribute("class",t),n=this._attributes.style?this._attributes.style:"",n+="background-image:url('"+this._attributes.src+"');",this._attributes.width&&(n+="width:"+this._attributes.width+"px;"),this._attributes.height&&(n+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",n),e.__super__.mount.call(this)},e.prototype.unmount=function(){var t,n;return this.isFixed()&&(n=document.createElement("div"),n.innerHTML=this.html(),t=n.querySelector("a, img"),this._domElement.parentNode.replaceChild(t,this._domElement),this._domElement=t),e.__super__.unmount.call(this)},e.droppers={Image:c.Element._dropBoth,PreText:c.Element._dropBoth,Static:c.Element._dropBoth,Text:c.Element._dropBoth},e.placements=["above","below","left","right","center"],e.fromDOMElement=function(t){var n,i,o,r,s,a,u,p,g;if(n=null,t.tagName.toLowerCase()==="a"){for(n=this.getDOMElementAttributes(t),s=(function(){var E,T,x,L;for(x=t.childNodes,L=[],E=0,T=x.length;E<T;E++)o=x[E],L.push(o);return L})(),p=0,g=s.length;p<g;p++)if(r=s[p],r.nodeType===1&&r.tagName.toLowerCase()==="img"){t=r;break}t.tagName.toLowerCase()==="a"&&(t=document.createElement("img"))}return i=this.getDOMElementAttributes(t),u=i.width,a=i.height,i.width===void 0&&(u=i.height===void 0?t.naturalWidth:t.clientWidth),i.height===void 0&&(a=i.width===void 0?t.naturalHeight:t.clientHeight),i.width=u,i.height=a,new this(i,n)},e})(c.ResizableElement),c.TagNames.get().register(c.Image,"img"),c.ImageFixture=(function(l){function e(t,n,i){e.__super__.constructor.call(this,t,n),this._src=i}return I(e,l),e.prototype.cssTypeName=function(){return"image-fixture"},e.prototype.type=function(){return"ImageFixture"},e.prototype.typeName=function(){return"ImageFixture"},e.prototype.html=function(t){var n,i,o,r;return t==null&&(t=""),r=c.LINE_ENDINGS,i=this._attributesToString(),n="",this._attributes.alt!==void 0&&(n='alt="'+this._attributes.alt+'"'),o=t+'<img src="'+this.src()+'"'+n+">",t+"<"+this.tagName()+" "+i+">"+r+c.INDENT+o+r+t+"</"+this.tagName()+">"},e.prototype.mount=function(){var t,n,i,o,r,s;this._domElement=document.createElement(this.tagName()),s=this._attributes;for(n in s)r=s[n],n!=="alt"&&n!=="style"&&this._domElement.setAttribute(n,r);return t="",this.a&&this.a.class&&(t+=" "+this.a.class),this._attributes.class&&(t+=" "+this._attributes.class),this._domElement.setAttribute("class",t),i=this._attributes.style?this._attributes.style:"",o=document.createElement("div"),o.setAttribute("style",i.trim()),o.style.backgroundImage=null,i=o.getAttribute("style"),i=[i.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._domElement.setAttribute("style",i.trim()),e.__super__.mount.call(this)},e.prototype.src=function(t){return t===void 0?this._src:(this._src=t,this.isMounted()&&(this.unmount(),this.mount()),this.taint())},e.prototype.unmount=function(){var t,n;return this.isFixed()?(n=document.createElement("div"),n.innerHTML=this.html(),t=n.firstElementChild,this._domElement.parentNode.replaceChild(t,this._domElement),this._domElement=t,this.parent()._domElement=this._domElement):e.__super__.unmount.call(this)},e.prototype._attributesToString=function(){var t,n,i,o,r,s;this._attributes.style?(i=this._attributes.style?this._attributes.style:"",o=document.createElement("div"),o.setAttribute("style",i.trim()),o.style.backgroundImage=null,i=o.getAttribute("style"),i=[i.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._attributes.style=i.trim()):this._attributes.style="background-image:url('"+this.src()+"');",t={},s=this._attributes;for(n in s)r=s[n],n!=="alt"&&(t[n]=r);return" "+c.attributesToString(t)},e.droppers={ImageFixture:c.Element._dropVert,Image:c.Element._dropVert,PreText:c.Element._dropVert,Text:c.Element._dropVert},e.fromDOMElement=function(t){var n,i,o,r,s,a,u,p;for(t.tagName,i=this.getDOMElementAttributes(t),a="",n="",s=(function(){var g,E,T,x;for(T=t.childNodes,x=[],g=0,E=T.length;g<E;g++)o=T[g],x.push(o);return x})(),u=0,p=s.length;u<p;u++)if(r=s[u],r.nodeType===1&&r.tagName.toLowerCase()==="img"){a=r.getAttribute("src")||"",n=r.getAttribute("alt")||"";break}return i=this.getDOMElementAttributes(t),i.alt=n,new this(t.tagName,i,a)},e})(c.Element),c.TagNames.get().register(c.ImageFixture,"img-fixture"),c.Video=(function(l){function e(t,n,i){var o;i==null&&(i=[]),e.__super__.constructor.call(this,t,n),this.sources=i,o=this.size(),this._aspectRatio=o[1]/o[0]}return I(e,l),e.prototype.cssTypeName=function(){return"video"},e.prototype.type=function(){return"Video"},e.prototype.typeName=function(){return"Video"},e.prototype._title=function(){var t;return t="",this.attr("src")?t=this.attr("src"):this.sources.length&&(t=this.sources[0].src),t||(t="No video source set"),t.length>80&&(t=t.substr(0,80)+"..."),t},e.prototype.createDraggingDOMElement=function(){var t;if(this.isMounted())return t=e.__super__.createDraggingDOMElement.call(this),t.innerHTML=this._title(),t},e.prototype.html=function(t){var n,i,o,r,s,a,u;if(t==null&&(t=""),i=c.LINE_ENDINGS,this.tagName()==="video"){for(r=[],u=this.sources,s=0,a=u.length;s<a;s++)o=u[s],n=c.attributesToString(o),r.push(""+t+c.INDENT+"<source "+n+">");return t+"<video"+this._attributesToString()+">"+i+r.join(i)+i+t+"</video>"}return t+"<"+this._tagName+this._attributesToString()+"></"+this._tagName+">"},e.prototype.mount=function(){var t;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),t=this._attributes.style?this._attributes.style:"",this._attributes.width&&(t+="width:"+this._attributes.width+"px;"),this._attributes.height&&(t+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",t),this._domElement.setAttribute("data-ce-title",this._title()),e.__super__.mount.call(this)},e.prototype.unmount=function(){var t,n;return this.isFixed()&&(n=document.createElement("div"),n.innerHTML=this.html(),t=n.querySelector("iframe"),this._domElement.parentNode.replaceChild(t,this._domElement),this._domElement=t),e.__super__.unmount.call(this)},e.droppers={Image:c.Element._dropBoth,PreText:c.Element._dropBoth,Static:c.Element._dropBoth,Text:c.Element._dropBoth,Video:c.Element._dropBoth},e.placements=["above","below","left","right","center"],e.fromDOMElement=function(t){var n,i,o,r,s,a;for(o=(function(){var u,p,g,E;for(g=t.childNodes,E=[],u=0,p=g.length;u<p;u++)n=g[u],E.push(n);return E})(),r=[],s=0,a=o.length;s<a;s++)i=o[s],i.nodeType===1&&i.tagName.toLowerCase()==="source"&&r.push(this.getDOMElementAttributes(i));return new this(t.tagName,this.getDOMElementAttributes(t),r)},e})(c.ResizableElement),c.TagNames.get().register(c.Video,"iframe","video"),c.List=(function(l){function e(t,n){e.__super__.constructor.call(this,t,n)}return I(e,l),e.prototype.cssTypeName=function(){return"list"},e.prototype.type=function(){return"List"},e.prototype.typeName=function(){return"List"},e.prototype._onMouseOver=function(t){if(this.parent().type()!=="ListItem")return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.droppers={Image:c.Element._dropBoth,ImageFixture:c.Element._dropVert,List:c.Element._dropVert,PreText:c.Element._dropVert,Static:c.Element._dropVert,Text:c.Element._dropVert,Video:c.Element._dropBoth},e.fromDOMElement=function(t){var n,i,o,r,s,a;for(r=new this(t.tagName,this.getDOMElementAttributes(t)),o=(function(){var u,p,g,E;for(g=t.childNodes,E=[],u=0,p=g.length;u<p;u++)n=g[u],E.push(n);return E})(),s=0,a=o.length;s<a;s++)i=o[s],i.nodeType===1&&i.tagName.toLowerCase()==="li"&&r.attach(c.ListItem.fromDOMElement(i));return r.children.length===0?null:r},e})(c.ElementCollection),c.TagNames.get().register(c.List,"ol","ul"),c.ListItem=(function(l){function e(t){e.__super__.constructor.call(this,"li",t),this._behaviours.indent=!0}return I(e,l),e.prototype.cssTypeName=function(){return"list-item"},e.prototype.list=function(){return this.children.length===2?this.children[1]:null},e.prototype.listItemText=function(){return this.children.length>0?this.children[0]:null},e.prototype.type=function(){return"ListItem"},e.prototype.html=function(t){var n;return t==null&&(t=""),n=[t+"<li"+this._attributesToString()+">"],this.listItemText()&&n.push(this.listItemText().html(t+c.INDENT)),this.list()&&n.push(this.list().html(t+c.INDENT)),n.push(t+"</li>"),n.join(c.LINE_ENDINGS)},e.prototype.indent=function(){var t;if(this.can("indent")&&this.parent().children.indexOf(this)!==0)return t=this.previousSibling(),t.list()||t.attach(new c.List(t.parent().tagName())),this.listItemText().storeState(),this.parent().detach(this),t.list().attach(this),this.listItemText().restoreState()},e.prototype.remove=function(){var t,n,i,o,r,s;if(this.parent()){if(i=this.parent().children.indexOf(this),this.list())for(s=this.list().children.slice(),n=o=0,r=s.length;o<r;n=++o)t=s[n],t.parent().detach(t),this.parent().attach(t,n+i);return this.parent().detach(this)}},e.prototype.unindent=function(){var t,n,i,o,r,s,a,u,p,g,E,T,x,L,R,U,H,C,h,d,_;if(this.can("indent")){if(s=this.parent(),n=s.parent(),g=s.children.slice(s.children.indexOf(this)+1,s.children.length),n.type()==="ListItem"){for(this.listItemText().storeState(),s.detach(this),n.parent().attach(this,n.parent().children.indexOf(n)+1),g.length&&!this.list()&&this.attach(new c.List(s.tagName())),T=0,U=g.length;T<U;T++)p=g[T],p.parent().detach(p),this.list().attach(p);return this.listItemText().restoreState()}if(E=new c.Text("p",this.attr("class")?{class:this.attr("class")}:{},this.listItemText().content),u=null,this.listItemText().isFocused()&&(u=ContentSelect.Range.query(this.listItemText().domElement())),a=n.children.indexOf(s),(o=s.
23children.indexOf(this))===0){if(r=null,s.children.length===1?(this.list()&&(r=new c.List(s.tagName())),n.detach(s)):s.detach(this),n.attach(E,a),r&&n.attach(r,a+1),this.list())for(d=this.list().children.slice(),i=x=0,H=d.length;x<H;i=++x)t=d[i],t.parent().detach(t),r?r.attach(t):s.attach(t,i)}else if(o===s.children.length-1)s.detach(this),n.attach(E,a+1),this.list()&&n.attach(this.list(),a+2);else{if(s.detach(this),n.attach(E,a+1),r=new c.List(s.tagName()),n.attach(r,a+2),this.list())for(_=this.list().children.slice(),L=0,C=_.length;L<C;L++)t=_[L],t.parent().detach(t),r.attach(t);for(R=0,h=g.length;R<h;R++)p=g[R],p.parent().detach(p),r.attach(p)}return u?(E.focus(),u.select(E.domElement())):void 0}},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.prototype._addDOMEventListeners=function(){},e.prototype._removeDOMEventListners=function(){},e.fromDOMElement=function(t){var n,i,o,r,s,a,u,p,g,E;for(s=new this(this.getDOMElementAttributes(t)),i="",o=null,g=t.childNodes,u=0,p=g.length;u<p;u++)n=g[u],n.nodeType===1?(E=n.tagName.toLowerCase())==="ul"||E==="ol"||E==="li"?o||(o=n):i+=n.outerHTML:i+=HTMLString.String.encode(n.textContent);return i=i.replace(/^\s+|\s+$/g,""),a=new c.ListItemText(i),s.attach(a),o&&(r=c.List.fromDOMElement(o),s.attach(r)),s},e})(c.ElementCollection),c.ListItemText=(function(l){function e(t){e.__super__.constructor.call(this,"div",{},t)}return I(e,l),e.prototype.cssTypeName=function(){return"list-item-text"},e.prototype.type=function(){return"ListItemText"},e.prototype.typeName=function(){return"List item"},e.prototype.blur=function(){return this.content.isWhitespace()&&this.can("remove")?this.parent().remove():this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),c.Element.prototype.blur.call(this)},e.prototype.can=function(t,n){if(n)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(t)},e.prototype.html=function(t){var n;return t==null&&(t=""),(!this._lastCached||this._lastCached<this._modified)&&(n=c.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),n.optimize(),this._lastCached=Date.now(),this._cached=n.html()),""+t+this._cached},e.prototype._onMouseDown=function(t){var n;return c.Element.prototype._onMouseDown.call(this,t),n=(function(i){return function(){var o;return c.Root.get().dragging()===i?(c.Root.get().cancelDragging(),o=i.closest(function(r){return r.parent().type()==="Region"}),o.drag(t.pageX,t.pageY)):(i.drag(t.pageX,t.pageY),i._dragTimeout=setTimeout(n,2*c.DRAG_HOLD_DURATION))}})(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(n,c.DRAG_HOLD_DURATION)},e.prototype._onMouseMove=function(t){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.Element.prototype._onMouseMove.call(this,t)},e.prototype._onMouseUp=function(t){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.Element.prototype._onMouseUp.call(this,t)},e.prototype._keyTab=function(t){return t.preventDefault(),t.shiftKey?this.parent().unindent():this.parent().indent()},e.prototype._keyReturn=function(t){var n,i,o,r,s,a;return t.preventDefault(),this.content.isWhitespace()?void this.parent().unindent():this.can("spawn")?(ContentSelect.Range.query(this._domElement),r=ContentSelect.Range.query(this._domElement),a=this.content.substring(0,r.get()[0]),s=this.content.substring(r.get()[1]),a.length()+s.length()===0?void this.parent().unindent():(this.content=a.trim(),this.updateInnerHTML(),n=this.parent().parent(),o=new c.ListItem(this.attr("class")?{class:this.attr("class")}:{}),n.attach(o,n.children.indexOf(this.parent())+1),o.attach(new c.ListItemText(s.trim())),i=this.parent().list(),i&&(this.parent().detach(i),o.attach(i)),a.length()?(o.listItemText().focus(),r=new ContentSelect.Range(0,0),r.select(o.listItemText().domElement())):(r=new ContentSelect.Range(0,a.length()),r.select(this._domElement)),this.taint())):void 0},e.droppers={ListItemText:function(t,n,i){var o,r,s,a;return o=t.parent(),a=n.parent(),o.remove(),o.detach(t),s=new c.ListItem(o._attributes),s.attach(t),a.list()&&i[0]==="below"?void a.list().attach(s,0):(r=a.parent().children.indexOf(a),i[0]==="below"&&(r+=1),a.parent().attach(s,r))},Text:function(t,n,i){var o,r,s,a,u;if(t.type()==="Text"){if(a=n.parent(),t.parent().detach(t),o=t.attr("class"),s=new c.ListItem(o?{class:o}:{}),s.attach(new c.ListItemText(t.content)),a.list()&&i[0]==="below")return void a.list().attach(s,0);if(r=a.parent().children.indexOf(a),i[0]==="below"&&(r+=1),a.parent().attach(s,r),s.listItemText().focus(),t._savedSelection)return t._savedSelection.select(s.listItemText().domElement())}else if(o=t.attr("class"),u=new c.Text("p",o?{class:o}:{},t.content),t.parent().remove(),r=n.parent().children.indexOf(n),i[0]==="below"&&(r+=1),n.parent().attach(u,r),u.focus(),t._savedSelection)return t._savedSelection.select(u.domElement())}},e.mergers={ListItemText:function(t,n){var i;return i=n.content.length(),t.content.length()&&(n.content=n.content.concat(t.content)),n.isMounted()&&(n._domElement.innerHTML=n.content.html()),n.focus(),new ContentSelect.Range(i,i).select(n._domElement),t.type()==="Text"?t.parent()&&t.parent().detach(t):t.parent().remove(),n.taint()}},e})(c.Text),b=c.ListItemText.mergers,b.Text=b.ListItemText,c.Table=(function(l){function e(t){e.__super__.constructor.call(this,"table",t)}return I(e,l),e.prototype.cssTypeName=function(){return"table"},e.prototype.typeName=function(){return"Table"},e.prototype.type=function(){return"Table"},e.prototype.firstSection=function(){var t;
23return(t=this.thead())||(t=this.tbody())||(t=this.tfoot())?t:null},e.prototype.lastSection=function(){var t;return(t=this.tfoot())||(t=this.tbody())||(t=this.thead())?t:null},e.prototype.tbody=function(){return this._getChild("tbody")},e.prototype.tfoot=function(){return this._getChild("tfoot")},e.prototype.thead=function(){return this._getChild("thead")},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.prototype._getChild=function(t){var n,i,o,r;for(r=this.children,i=0,o=r.length;i<o;i++)if(n=r[i],n.tagName()===t)return n;return null},e.droppers={Image:c.Element._dropBoth,ImageFixture:c.Element._dropVert,List:c.Element._dropVert,PreText:c.Element._dropVert,Static:c.Element._dropVert,Table:c.Element._dropVert,Text:c.Element._dropVert,Video:c.Element._dropBoth},e.fromDOMElement=function(t){var n,i,o,r,s,a,u,p,g,E,T,x;for(u=new this(this.getDOMElementAttributes(t)),o=(function(){var L,R,U,H;for(U=t.childNodes,H=[],L=0,R=U.length;L<R;L++)n=U[L],H.push(n);return H})(),r=[],g=0,T=o.length;g<T;g++)if(i=o[g],i.nodeType===1&&(p=i.tagName.toLowerCase(),!u._getChild(p)))switch(p){case"tbody":case"tfoot":case"thead":a=c.TableSection.fromDOMElement(i),u.attach(a);break;case"tr":r.push(c.TableRow.fromDOMElement(i))}if(r.length>0)for(u._getChild("tbody")||u.attach(new c.TableSection("tbody")),E=0,x=r.length;E<x;E++)s=r[E],u.tbody().attach(s);return u.children.length===0?null:u},e})(c.ElementCollection),c.TagNames.get().register(c.Table,"table"),c.TableSection=(function(l){function e(t,n){e.__super__.constructor.call(this,t,n)}return I(e,l),e.prototype.cssTypeName=function(){return"table-section"},e.prototype.type=function(){return"TableSection"},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.fromDOMElement=function(t){var n,i,o,r,s,a;for(r=new this(t.tagName,this.getDOMElementAttributes(t)),o=(function(){var u,p,g,E;for(g=t.childNodes,E=[],u=0,p=g.length;u<p;u++)n=g[u],E.push(n);return E})(),s=0,a=o.length;s<a;s++)i=o[s],i.nodeType===1&&i.tagName.toLowerCase()==="tr"&&r.attach(c.TableRow.fromDOMElement(i));return r},e})(c.ElementCollection),c.TableRow=(function(l){function e(t){e.__super__.constructor.call(this,"tr",t)}return I(e,l),e.prototype.cssTypeName=function(){return"table-row"},e.prototype.isEmpty=function(){var t,n,i,o,r;for(r=this.children,i=0,o=r.length;i<o;i++)if(t=r[i],(n=t.tableCellText())&&n.content.length()>0)return!1;return!0},e.prototype.type=function(){return"TableRow"},e.prototype.typeName=function(){return"Table row"},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.droppers={TableRow:c.Element._dropVert},e.fromDOMElement=function(t){var n,i,o,r,s,a,u;for(r=new this(this.getDOMElementAttributes(t)),o=(function(){var p,g,E,T;for(E=t.childNodes,T=[],p=0,g=E.length;p<g;p++)n=E[p],T.push(n);return T})(),a=0,u=o.length;a<u;a++)i=o[a],i.nodeType===1&&((s=i.tagName.toLowerCase())!=="td"&&s!=="th"||r.attach(c.TableCell.fromDOMElement(i)));return r},e})(c.ElementCollection),c.TableCell=(function(l){function e(t,n){e.__super__.constructor.call(this,t,n)}return I(e,l),e.prototype.cssTypeName=function(){return"table-cell"},e.prototype.tableCellText=function(){return this.children.length>0?this.children[0]:null},e.prototype.type=function(){return"TableCell"},e.prototype.html=function(t){var n;return t==null&&(t=""),n=[t+"<"+this.tagName()+this._attributesToString()+">"],this.tableCellText()&&n.push(this.tableCellText().html(t+c.INDENT)),n.push(t+"</"+this.tagName()+">"),n.join(c.LINE_ENDINGS)},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.prototype._addDOMEventListeners=function(){},e.prototype._removeDOMEventListners=function(){},e.fromDOMElement=function(t){var n,i;return n=new this(t.tagName,this.getDOMElementAttributes(t)),i=new c.TableCellText(t.innerHTML.replace(/^\s+|\s+$/g,"")),n.attach(i),n},e})(c.ElementCollection),c.TableCellText=(function(l){function e(t){e.__super__.constructor.call(this,"div",{},t)}return I(e,l),e.prototype.cssTypeName=function(){return"table-cell-text"},e.prototype.type=function(){return"TableCellText"},e.prototype._isInFirstRow=function(){var t,n,i,o;return t=this.parent(),n=t.parent(),i=n.parent(),o=i.parent(),i===o.firstSection()&&n===i.children[0]},e.prototype._isInLastRow=function(){var t,n,i,o;return t=this.parent(),n=t.parent(),i=n.parent(),o=i.parent(),i===o.lastSection()&&n===i.children[i.children.length-1]},e.prototype._isLastInSection=function(){var t,n,i;return t=this.parent(),n=t.parent(),i=n.parent(),n===i.children[i.children.length-1]&&t===n.children[n.children.length-1]},e.prototype.blur=function(){return this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),c.Element.prototype.blur.call(this)},e.prototype.can=function(t,n){if(n)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(t)},e.prototype.html=function(t){var n;return t==null&&(t=""),(!this._lastCached||this._lastCached<this._modified)&&(n=c.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),n.optimize(),this._lastCached=Date.now(),this._cached=n.html()),""+t+this._cached},e.prototype._onMouseDown=function(t){var n;return c.Element.prototype._onMouseDown.call(this,t),n=(function(i){return function(){var o,r;return o=i.parent(),c.Root.get().dragging()===o.parent()?(c.Root.get().cancelDragging(),r=o.parent().parent().parent(),r.drag(t.pageX,t.pageY)):(o.parent().drag(t.pageX,t.pageY),i._dragTimeout=setTimeout(n,2*c.DRAG_HOLD_DURATION))}})(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(n,c.DRAG_HOLD_DURATION)},e.prototype._keyBack=function(t){var n,i,o,r;if(r=ContentSelect.Range.query(this._domElement),r.get()[0]===0&&r.isCollapsed()&&(t.preventDefault(),n=this.parent(),o=n.parent(),o.isEmpty()&&o.can("remove")))return this.content.length()===0&&o.children.indexOf(n)===0?(i=this.previousContent(),i&&(i.focus(),r=new ContentSelect.Range(i.content.length(),i.content.length()),r.select(i.domElement())),o.parent().detach(o)):void 0},e.prototype._keyDelete=function(t){var n,i,o,r;if(o=this.parent().parent(),o.isEmpty()&&o.can("remove"))return t.preventDefault(),n=o.children[o.children.length-1],i=n.tableCellText().nextContent(),i&&(i.focus(),r=new ContentSelect.Range(0,0),r.select(i.domElement())),o.parent().detach(o)}
23,e.prototype._keyDown=function(t){var n,i,o,r,s,a,u;if(u=ContentSelect.Range.query(this._domElement),this._atEnd(u)&&u.isCollapsed())return t.preventDefault(),n=this.parent(),this._isInLastRow()?(a=n.parent(),o=a.children[a.children.length-1].tableCellText(),r=o.nextContent(),r?r.focus():c.Root.get().trigger("next-region",this.closest(function(p){return p.type()==="Fixture"||p.type()==="Region"}))):(s=n.parent().nextWithTest(function(p){return p.type()==="TableRow"}),i=n.parent().children.indexOf(n),i=Math.min(i,s.children.length),s.children[i].tableCellText().focus())},e.prototype._keyReturn=function(t){return t.preventDefault(),this._keyTab({shiftKey:!1,preventDefault:function(){}})},e.prototype._keyTab=function(t){var n,i,o,r,s,a,u,p,g,E;if(t.preventDefault(),n=this.parent(),t.shiftKey)return this._isInFirstRow()&&n.parent().children[0]===n?void 0:this.previousContent().focus();if(this.can("spawn")){if(o=n.parent().parent(),o.tagName()==="tbody"&&this._isLastInSection()){for(a=new c.TableRow,E=n.parent().children,p=0,g=E.length;p<g;p++)i=E[p],r=new c.TableCell(i.tagName(),i._attributes),s=new c.TableCellText(""),r.attach(s),a.attach(r);return u=this.closest(function(T){return T.type()==="TableSection"}),u.attach(a),a.children[0].tableCellText().focus()}return this.nextContent().focus()}},e.prototype._keyUp=function(t){var n,i,o,r,s,a;if(a=ContentSelect.Range.query(this._domElement),a.get()[0]===0&&a.isCollapsed())return t.preventDefault(),n=this.parent(),this._isInFirstRow()?(s=n.parent(),o=s.children[0].previousContent(),o?o.focus():c.Root.get().trigger("previous-region",this.closest(function(u){return u.type()==="Fixture"||u.type()==="Region"}))):(r=n.parent().previousWithTest(function(u){return u.type()==="TableRow"}),i=n.parent().children.indexOf(n),i=Math.min(i,r.children.length),r.children[i].tableCellText().focus())},e.droppers={},e.mergers={},e})(c.Text)}.call(yt),function(){var c,m,v,b,w,N={}.hasOwnProperty,D=function(l,e){function t(){this.constructor=l}for(var n in e)N.call(e,n)&&(l[n]=e[n]);return t.prototype=e.prototype,l.prototype=new t,l.__super__=e.prototype,l},I=function(l,e){return function(){return l.apply(e,arguments)}},O=[].slice;m={Tools:{},CANCEL_MESSAGE:"Your changes have not been saved, do you really want to lose them?".trim(),DEFAULT_TOOLS:[["bold","italic","link","align-left","align-center","align-right"],["heading","subheading","paragraph","unordered-list","ordered-list","table","indent","unindent","line-break"],["image","video","preformatted"],["undo","redo","remove"]],DEFAULT_VIDEO_HEIGHT:300,DEFAULT_VIDEO_WIDTH:400,HIGHLIGHT_HOLD_DURATION:2e3,IMAGE_UPLOADER:null,INLINE_TAGS:["a","address","b","code","del","em","i","ins","span","strong","sup","u"],INSPECTOR_IGNORED_ELEMENTS:["Fixture","ListItemText","Region","TableCellText"],MIN_CROP:10,RESTRICTED_ATTRIBUTES:{"*":["style"],img:["height","src","width","data-ce-max-width","data-ce-min-width"],iframe:["height","width"]},getEmbedVideoURL:function(l){var e,t,n,i,o,r,s,a,u,p,g,E,T,x,L;for(e={"www.youtube.com":"youtube","youtu.be":"youtube","vimeo.com":"vimeo","player.vimeo.com":"vimeo"},p=document.createElement("a"),p.href=l,r=p.hostname.toLowerCase(),g=p.pathname,g!==null&&g.substr(0,1)!=="/"&&(g="/"+g),a={},u=p.search.slice(1),L=u.split("&"),T=0,x=L.length;T<x;T++)i=L[T],i=i.split("="),i[0]&&(a[i[0]]=i[1]);switch(e[r]){case"youtube":if(g.toLowerCase()==="/watch"){if(!a.v)return null;t=a.v,delete a.v}else{if(!(o=g.match(/\/([A-Za-z0-9_-]+)$/i)))return null;t=o[1]}return l="https://www.youtube.com/embed/"+t,s=(function(){var R;R=[];for(n in a)E=a[n],R.push(n+"="+E);return R})().join("&"),s&&(l+="?"+s),l;case"vimeo":return(o=g.match(/\/(\w+\/\w+\/){0,1}(\d+)/i))?(l="https://player.vimeo.com/video/"+o[2],s=(function(){var R;R=[];for(n in a)E=a[n],R.push(n+"="+E);return R})().join("&"),s&&(l+="?"+s),l):null}return null},getHTMLCleaner:function(){return new m.HTMLCleaner},getRestrictedAtributes:function(l){var e;return e=[],m.RESTRICTED_ATTRIBUTES[l]&&(e=e.concat(m.RESTRICTED_ATTRIBUTES[l])),m.RESTRICTED_ATTRIBUTES["*"]&&(e=e.concat(m.RESTRICTED_ATTRIBUTES["*"])),e},getScrollPosition:function(){var l,e;return e=window.pageXOffset!==void 0,l=(document.compatMode||4)===4,e?[window.pageXOffset,window.pageYOffset]:l?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[document.body.scrollLeft,document.body.scrollTop]}},typeof window<"u"&&(window.ContentTools=m),typeof Q<"u"&&Q.exports&&(Q.exports=m),m.ComponentUI=(function(){function l(){this._bindings={},this._parent=null,this._children=[],this._domElement=null}return l.prototype.children=function(){return this._children.slice()},l.prototype.domElement=function(){return this._domElement},l.prototype.isMounted=function(){return this._domElement!==null},l.prototype.parent=function(){return this._parent},l.prototype.attach=function(e,t){return e.parent()&&e.parent().detach(e),e._parent=this,t!==void 0?this._children.splice(t,0,e):this._children.push(e)},l.prototype.addCSSClass=function(e){if(this.isMounted())return ContentEdit.addCSSClass(this._domElement,e)},l.prototype.detach=function(e){var t;if((t=this._children.indexOf(e))!==-1)return this._children.splice(t,1)},l.prototype.mount=function(){},l.prototype.removeCSSClass=function(e){if(this.isMounted())return ContentEdit.removeCSSClass(this._domElement,e)},l.prototype.unmount=function(){if(this.isMounted())return this._removeDOMEventListeners(),this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null},l.prototype.addEventListener=function(e,t){this._bindings[e]===void 0&&(this._bindings[e]=[]),this._bindings[e].push(t)},l.prototype.createEvent=function(e,t){return new m.Event(e,t)},l.prototype.dispatchEvent=function(e){var t,n,i,o;if(!this._bindings[e.name()])return!e.defaultPrevented();for(o=this._bindings[e.name()],n=0,i=o.length;n<i&&(t=o[n],!e.propagationStopped());n++)t&&t.call(this,e);return!e.defaultPrevented()},l.prototype.removeEventListener=function(e,t){var n,i,o,r,s,a;if(!e)return void(this._bindings={});if(!t)return void(this._bindings[e]=void 0);if(this._bindings[e]){for(s=this._bindings[e],a=[],n=o=0,r=s.length;o<r;n=++o)i=s[n],i===t?a.push(this._bindings[e].splice(n,1)):a.push(void 0);return a}},l.prototype._addDOMEventListeners=function(){},l.prototype._removeDOMEventListeners=function(){},l.createDiv=function(e,t,n){var i,o,r;if(i=document.createElement("div"),e&&e.length>0&&i.setAttribute("class",e.join(" ")),t)for(o in t)r=t[o],i.setAttribute(o,r);return n&&(i.innerHTML=n),i},l})(),m.WidgetUI=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),e.prototype.attach=function(t,n){if(e.__super__.attach.call(this,t,n),!this.isMounted())return t.mount()},e.prototype.detach=function(t){if(e.__super__.detach.call(this,t),this.isMounted())return t.unmount()},e.prototype.detatch=function(t){return console.log("Please call detach, detatch will be removed in release 1.4.x"),this.detach(t)},e.prototype.show=function(){var t;return this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null,this.unmount()),this.isMounted()||this.mount(),t=(function(n){return function(){return n.addCSSClass("ct-widget--active"),n._showTimeout=null}})(this),this._showTimeout=setTimeout(t,100)},e.prototype.hide=function(){var t;if(this._showTimeout&&(clearTimeout(this._showTimeout),this._showTimeout=null),this.removeCSSClass("ct-widget--active"),t=(function(n){return function(){return n._hideTimeout=null,window.getComputedStyle?parseFloat(window.getComputedStyle(n._domElement).opacity)<.01?n.unmount():n._hideTimeout=setTimeout(t,250):void n.unmount()}})(this),this.isMounted())return this._hideTimeout=setTimeout(t,250)},e})(m.ComponentUI),m.AnchoredComponentUI=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),e.prototype.mount=function(t,n){return n==null&&(n=null),t.insertBefore(this._domElement,n),this._addDOMEventListeners()},e})(m.ComponentUI),m.Event=(function(){function l(e,t){this._name=e,this._detail=t,this._timeStamp=Date.now(),this._defaultPrevented=!1,this._propagationStopped=!1}return l.prototype.defaultPrevented=function(){return this._defaultPrevented},l.prototype.detail=function(){return this._detail},l.prototype.name=function(){return this._name},l.prototype.propagationStopped=function(){return this._propagationStopped},l.prototype.timeStamp=function(){return this._timeStamp},l.prototype.preventDefault=function(){return this._defaultPrevented=!0},l.prototype.stopImmediatePropagation=function(){return this._propagationStopped=!0},l})(),m.FlashUI=(function(l){function e(t){e.__super__.constructor.call(this),this.mount(t)}return D(e,l),e.prototype.mount=function(t){var n;return this._domElement=this.constructor.createDiv(["ct-flash","ct-flash--active","ct-flash--"+t,"ct-widget","ct-widget--active"]),e.__super__.mount.call(this,m.EditorApp.get().domElement()),n=(function(i){return function(){return window.getComputedStyle?parseFloat(window.getComputedStyle(i._domElement).opacity)<.01?i.unmount():setTimeout(n,250):void i.unmount()}})(this),setTimeout(n,250)},e})(m.AnchoredComponentUI),m.IgnitionUI=(function(l){function e(){e.__super__.constructor.call(this),this._revertToState="ready",this._state="ready"}return D(e,l),e.prototype.busy=function(t){if(this.dispatchEvent(this.createEvent("busy",{busy:t})))return t===(this._state==="busy")?void 0:t?(this._revertToState=this._state,this.state("busy")):this.state(this._revertToState)},e.prototype.cancel=function(){if(this.dispatchEvent(this.createEvent("cancel")))return this.state("ready")},e.prototype.confirm=function(){if(this.dispatchEvent(this.createEvent("confirm")))return this.state("ready")},e.prototype.edit=function(){if(this.dispatchEvent(this.createEvent("edit")))return this.state("editing")},e.prototype.mount=function(){return e.__super__.mount.call(this),this._domElement=this.constructor.createDiv(["ct-widget","ct-ignition","ct-ignition--ready"]),this.parent().domElement().appendChild(this._domElement),this._domEdit=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--edit"]),this._domElement.appendChild(this._domEdit),this._domConfirm=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--confirm"]),this._domElement.appendChild(this._domConfirm),this._domCancel=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--cancel"]),this._domElement.appendChild(this._domCancel),this._domBusy=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--busy"]),this._domElement.appendChild(this._domBusy),this._addDOMEventListeners()},e.prototype.state=function(t){if(t===void 0)return this._state;if(this._state!==t&&this.dispatchEvent(this.createEvent("statechange",{state:t})))return this._state=t,this.removeCSSClass("ct-ignition--busy"),this.removeCSSClass("ct-ignition--editing"),this.removeCSSClass("ct-ignition--ready"),this._state==="busy"?this.addCSSClass("ct-ignition--busy"):this._state==="editing"?this.addCSSClass("ct-ignition--editing"):this._state==="ready"?this.addCSSClass("ct-ignition--ready"):void 0},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domEdit=null,this._domConfirm=null,this._domCancel=null},e.prototype._addDOMEventListeners=function(){return this._domEdit.addEventListener("click",(function(t){return function(n){return n.preventDefault(),t.edit()}})(this)),this._domConfirm.addEventListener("click",(function(t){return function(n){return n.preventDefault(),t.confirm()}})(this)),this._domCancel.addEventListener("click",(function(t){return function(n){return n.preventDefault(),t.cancel()}})(this))},e})(m.WidgetUI),m.InspectorUI=(function(l){function e(){e.__super__.constructor.call(this),this._tagUIs=[]}return D(e,l),e.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-inspector"]),this.parent().domElement().appendChild(this._domElement),this._domTags=this.constructor.createDiv(["ct-inspector__tags","ct-tags"]),this._domElement.appendChild(this._domTags),this._domCounter=this.constructor.createDiv(["ct-inspector__counter"]),this._domElement.appendChild(this._domCounter),this.updateCounter(),this._addDOMEventListeners(),this._handleFocusChange=(function(t){return function(){return t.updateTags()}})(this),ContentEdit.Root.get().bind("blur",this._handleFocusChange),ContentEdit.Root.get().bind("focus",this._handleFocusChange),ContentEdit.Root.get().bind("mount",this._handleFocusChange)},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domTags=null,ContentEdit.Root.get().unbind("blur",this._handleFocusChange),ContentEdit.Root.get().unbind("focus",this._handleFocusChange),ContentEdit.Root.get().unbind("mount",this._handleFocusChange)},e.prototype.updateCounter=function(){var t,n,i,o,r,s,a,u,p,g,E;if(this.isMounted()){for(n="",E=m.EditorApp.get().orderedRegions(),p=0,g=E.length;p<g;p++)(s=E[p])&&(n+=s.domElement().textContent);return n=n.trim(),n=n.replace(/<\/?[a-z][^>]*>/gi,""),n=n.replace(/[\u200B]+/,""),n=n.replace(/['";:,.?¿\-!¡]+/g,""),u=(n.match(/\S+/g)||[]).length,u=u.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),(i=ContentEdit.Root.get().focused())&&i.type()==="PreText"&&i.selection().isCollapsed()?(o=0,t=1,a=i.content.substring(0,i.selection().get()[0]),r
23=a.text().split(` 24`),o=r.length,t=r[r.length-1].length+1,o=o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),t=t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),this._domCounter.textContent=u+" / "+o+":"+t):void(this._domCounter.textContent=u)}},e.prototype.updateTags=function(){var t,n,i,o,r,s,a,u,p;for(t=ContentEdit.Root.get().focused(),u=this._tagUIs,o=0,s=u.length;o<s;o++)i=u[o],i.unmount();if(this._tagUIs=[],t){for(n=t.parents(),n.reverse(),n.push(t),p=[],r=0,a=n.length;r<a;r++)t=n[r],m.INSPECTOR_IGNORED_ELEMENTS.indexOf(t.type())===-1&&(i=new m.TagUI(t),this._tagUIs.push(i),p.push(i.mount(this._domTags)));return p}},e.prototype._addDOMEventListeners=function(){return this._updateCounterInterval=setInterval((function(t){return function(){return t.updateCounter()}})(this),250)},e.prototype._removeDOMEventListeners=function(){return clearInterval(this._updateCounterInterval)},e})(m.WidgetUI),m.TagUI=(function(l){function e(t){this.element=t,this._onMouseDown=I(this._onMouseDown,this),e.__super__.constructor.call(this)}return D(e,l),e.prototype.mount=function(t,n){return n==null&&(n=null),this._domElement=this.constructor.createDiv(["ct-tag"]),this._domElement.textContent=this.element.tagName(),e.__super__.mount.call(this,t,n)},e.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown)},e.prototype._onMouseDown=function(t){var n,i,o;return t.preventDefault(),this.element.storeState&&this.element.storeState(),n=m.EditorApp.get(),o=new m.ModalUI,i=new m.PropertiesDialog(this.element),i.addEventListener("cancel",(function(r){return function(){if(o.hide(),i.hide(),r.element.restoreState)return r.element.restoreState()}})(this)),i.addEventListener("save",(function(r){return function(s){var a,u,p,g,E,T,x,L,R,U,H,C,h,d,_,f,y;T=s.detail(),u=T.changedAttributes,U=T.changedStyles,L=T.innerHTML;for(R in u)if(H=u[R],R==="class"){for(H===null&&(H=""),g={},f=H.split(" "),C=0,d=f.length;C<d;C++)p=f[C],(p=p.trim())&&(g[p]=!0,r.element.hasCSSClass(p)||r.element.addCSSClass(p));for(y=r.element.attr("class").split(" "),h=0,_=y.length;h<_;h++)p=y[h],p=p.trim(),g[p]===void 0&&r.element.removeCSSClass(p)}else H===null?r.element.removeAttr(R):r.element.attr(R,H);for(E in U)a=U[E],a?r.element.addCSSClass(E):r.element.removeCSSClass(E);if(L!==null&&L!==i.getElementInnerHTML()&&(x=r.element,x.content||(x=x.children[0]),x.content=new HTMLString.String(L,x.content.preserveWhitespace()),x.updateInnerHTML(),x.taint(),x.selection(new ContentSelect.Range(0,0)),x.storeState()),o.hide(),i.hide(),r.element.restoreState)return r.element.restoreState()}})(this)),n.attach(o),n.attach(i),o.show(),i.show()},e})(m.AnchoredComponentUI),m.ModalUI=(function(l){function e(t,n){e.__super__.constructor.call(this),this._transparent=t,this._allowScrolling=n}return D(e,l),e.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-modal"]),this.parent().domElement().appendChild(this._domElement),this._transparent&&this.addCSSClass("ct-modal--transparent"),this._allowScrolling||ContentEdit.addCSSClass(document.body,"ct--no-scroll"),this._addDOMEventListeners()},e.prototype.unmount=function(){return this._allowScrolling||ContentEdit.removeCSSClass(document.body,"ct--no-scroll"),e.__super__.unmount.call(this)},e.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("click",(function(t){return function(n){return t.dispatchEvent(t.createEvent("click"))}})(this))},e})(m.WidgetUI),m.ToolboxUI=(function(l){function e(t){this._onStopDragging=I(this._onStopDragging,this),this._onStartDragging=I(this._onStartDragging,this),this._onDrag=I(this._onDrag,this),e.__super__.constructor.call(this),this._tools=t,this._dragging=!1,this._draggingOffset=null,this._domGrip=null,this._toolUIs={}}return D(e,l),e.prototype.isDragging=function(){return this._dragging},e.prototype.hide=function(){return this._removeDOMEventListeners(),e.__super__.hide.call(this)},e.prototype.mount=function(){var t,n,i;return this._domElement=this.constructor.createDiv(["ct-widget","ct-toolbox"]),this.parent().domElement().appendChild(this._domElement),this._domGrip=this.constructor.createDiv(["ct-toolbox__grip","ct-grip"]),this._domElement.appendChild(this._domGrip),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domToolGroups=this.constructor.createDiv(["ct-tool-groups"]),this._domElement.appendChild(this._domToolGroups),this.tools(this._tools),i=window.localStorage.getItem("ct-toolbox-position"),i&&/^\d+,\d+$/.test(i)&&(n=(function(){var o,r,s,a;for(s=i.split(","),a=[],o=0,r=s.length;o<r;o++)t=s[o],a.push(parseInt(t));return a})(),this._domElement.style.left=n[0]+"px",this._domElement.style.top=n[1]+"px",this._contain()),this._addDOMEventListeners()},e.prototype.tools=function(t){var n,i,o,r,s,a,u,p,g,E,T;if(t===void 0)return this._tools;if(this._tools=t,this.isMounted()){g=this._toolUIs;for(s in g)a=g[s],a.unmount();for(this._toolUIs={};this._domToolGroups.lastChild;)this._domToolGroups.removeChild(this._domToolGroups.lastChild);for(E=this._tools,T=[],i=u=0,p=E.length;u<p;i=++u)r=E[i],n=this.constructor.createDiv(["ct-tool-group"]),this._domToolGroups.appendChild(n),T.push(function(){var x,L,R;for(R=[],x=0,L=r.length;x<L;x++)s=r[x],o=m.ToolShelf.fetch(s),this._toolUIs[s]=new m.ToolUI(o),this._toolUIs[s].mount(n),this._toolUIs[s].disabled(!0),R.push(this._toolUIs[s].addEventListener("applied",(function(U){return function(){return U.updateTools()}})(this)));return R}.call(this));return T}},e.prototype.updateTools=function(){var t,n,i,o,r,s;t=ContentEdit.Root.get().focused(),i=null,t&&t.selection&&(i=t.selection()),r=this._toolUIs,s=[];for(n in r)o=r[n],s.push(o.update(t,i));return s},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domGrip=null},e.prototype._addDOMEventListeners=function(){return this._domGrip.addEventListener("mousedown",this._onStartDragging),this._handleResize=(function(t){return function(n){var i;return t._resizeTimeout&&clearTimeout(t._resizeTimeout),i=function(){return t._contain()},t._resizeTimeout=setTimeout(i,250)}})(this),window.addEventListener("resize",this._handleResize),this._updateTools=(function(t){return function(){var n,i,o,r,s,a,u,p;if(n=m.EditorApp.get(),a=!1,i=ContentEdit.Root.get().focused(),r=null,i===t._lastUpdateElement?i&&i.selection&&(r=i.selection(),t._lastUpdateSelection&&r.eq(t._lastUpdateSelection)||(a=!0)):a=!0,n.history&&(t._lastUpdateHistoryLength!==n.history.length()&&(a=!0),t._lastUpdateHistoryLength=n.history.length(),t._lastUpdateHistoryIndex!==n.history.index()&&(a=!0),t._lastUpdateHistoryIndex=n.history.index()),t._lastUpdateElement=i,t._lastUpdateSelection=r,a){u=t._toolUIs,p=[];for(o in u)s=u[o],p.push(s.update(i,r));return p}}})(this),this._updateToolsInterval=setInterval(this._updateTools,100),this._handleKeyDown=(function(t){return function(n){var i,o,r,s,a,u;if((o=ContentEdit.Root.get().focused())&&!o.content){if(n.keyCode===46)return n.preventDefault(),m.Tools.Remove.apply(o,null,function(){});if(n.keyCode===13)return n.preventDefault(),i=m.Tools.Paragraph,i.apply(o,null,function(){})}switch(u=navigator.appVersion,r="linux",u.indexOf("Mac")!==-1?r="mac":u.indexOf("Win")!==-1&&(r="windows"),s=!1,a=!1,r){case"linux":n.altKey||n.keyCode===90&&n.ctrlKey&&(s=n.shiftKey,a=!s);break;case"mac":n.altKey||n.ctrlKey||n.keyCode===90&&n.metaKey&&(s=n.shiftKey,a=!s);break;case"windows":n.altKey&&!n.shiftKey||(n.keyCode===89&&n.ctrlKey&&(s=!0),n.keyCode===90&&n.ctrlKey&&(a=!0))}if(a&&m.Tools.Undo.canApply(null,null)&&m.Tools.Undo.apply(null,null,function(){}),s&&m.Tools.Redo.canApply(null,null))return m.Tools.Redo.apply(null,null,function(){})}})(),window.addEventListener("keydown",this._handleKeyDown)},e.prototype._contain=function(){var t;if(this.isMounted())return t=this._domElement.getBoundingClientRect(),t.left+t.width>window.innerWidth&&(this._domElement.style.left=window.innerWidth-t.width+"px"),t.top+t.height>window.innerHeight&&(this._domElement.style.top=window.innerHeight-t.height+"px"),t.left<0&&(this._domElement.style.left="0px"),t.top<0&&(this._domElement.style.top="0px"),t=this._domElement.getBoundingClientRect(),window.localStorage.setItem("ct-toolbox-position",t.left+","+t.top)},e.prototype._removeDOMEventListeners=function(){return this.isMounted()&&this._domGrip.removeEventListener("mousedown",this._onStartDragging),window.removeEventListener("keydown",this._handleKeyDown),window.removeEventListener("resize",this._handleResize),clearInterval(this._updateToolsInterval)},e.prototype._onDrag=function(t){return ContentSelect.Range.unselectAll(),this._domElement.style.left=t.clientX-this._draggingOffset.x+"px",this._domElement.style.top=t.clientY-this._draggingOffset.y+"px"},e.prototype._onStartDragging=function(t){var n;if(t.preventDefault(),!this.isDragging())return this._dragging=!0,this.addCSSClass("ct-toolbox--dragging"),n=this._domElement.getBoundingClientRect(),this._draggingOffset={x:t.clientX-n.left,y:t.clientY-n.top},document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),ContentEdit.addCSSClass(document.body,"ce--dragging")},e.prototype._onStopDragging=function(t){if(this.isDragging())return this._contain(),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._draggingOffset=null,this._dragging=!1,this.removeCSSClass("ct-toolbox--dragging"),ContentEdit.removeCSSClass(document.body,"ce--dragging")},e})(m.WidgetUI),m.ToolUI=(function(l){function e(t){this._onMouseUp=I(this._onMouseUp,this),this._onMouseLeave=I(this._onMouseLeave,this),this._onMouseDown=I(this._onMouseDown,this),this._addDOMEventListeners=I(this._addDOMEventListeners,this),e.__super__.constructor.call(this),this.tool=t,this._mouseDown=!1,this._disabled=!1}return D(e,l),e.prototype.apply=function(t,n){var i,o;if(this.tool.canApply(t,n))return o={element:t,selection:n},i=(function(r){return function(s){if(s)return r.dispatchEvent(r.createEvent("applied",o))}})(this),this.dispatchEvent(this.createEvent("apply",o))?this.tool.apply(t,n,i):void 0},e.prototype.disabled=function(t){if(t===void 0)return this._disabled;if(this._disabled!==t)return this._disabled=t,t?(this._mouseDown=!1,this.addCSSClass("ct-tool--disabled"),this.removeCSSClass("ct-tool--applied")):this.removeCSSClass("ct-tool--disabled")},e.prototype.mount=function(t,n){return n==null&&(n=null),this._domElement=this.constructor.createDiv(["ct-tool","ct-tool--"+this.tool.icon]),this._domElement.setAttribute("data-ct-tooltip",ContentEdit._(this.tool.label)),e.__super__.mount.call(this,t,n)},e.prototype.update=function(t,n){return(!this.tool.requiresElement||t&&t.isMounted())&&this.tool.canApply(t,n)?(this.disabled(!1),this.tool.isApplied(t,n)?this.addCSSClass("ct-tool--applied"):this.removeCSSClass("ct-tool--applied")):void this.disabled(!0)},e.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown),this._domElement.addEventListener("mouseleave",this._onMouseLeave),this._domElement.addEventListener("mouseup",this._onMouseUp)},e.prototype._onMouseDown=function(t){if(t.preventDefault(),!this.disabled())return this._mouseDown=!0,this.addCSSClass("ct-tool--down")},e.prototype._onMouseLeave=function(t){return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},e.prototype._onMouseUp=function(t){var n,i;if(this._mouseDown){if(n=ContentEdit.Root.get().focused(),this.tool.requiresElement&&(!n||!n.isMounted()))return;i=null,n&&n.selection&&(i=n.selection()),this.apply(n,i)}return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},e})(m.AnchoredComponentUI),m.AnchoredDialogUI=(function(l){function e(){e.__super__.constructor.call(this),this._position=[0,0]}return D(e,l),e.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-anchored-dialog"]),this.parent().domElement().appendChild(this._domElement),this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"},e.prototype.position=function(t){return t===void 0?this._position.slice():(this._position=t.slice(),this.isMounted()?(this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"):void 0)},e.prototype._contain=function(){var t,n,i;if(this.isMounted())return i=this._domElement.getBoundingClientRect(),t=i.width/2+5,n=document.documentElement.clientWidth||document.body.clientWidth,this._position[0]+t>n&&(this._position[0]=n-t),this._position[0]<t&&(this._position[0]=t),this._position[1]+i.top<5?this._position[1]=Math.abs(i.top)+5:void 0},e})(m.WidgetUI),m.DialogUI=(function(l){function e(t){t==null&&(t=""),e.__super__.constructor.call(this),this._busy=!1,this._caption=t}return D(e,l),e.prototype.busy=function(t){if(t===void 0)return this._busy;if(this._busy!==t&&(this._busy=t,this.isMounted()))return this._busy?ContentEdit.addCSSClass(this._domElement,"ct-dialog--busy"):ContentEdit.removeCSSClass(this._domElement,"ct-dialog--busy")},e.prototype.caption=function(t){return t===void 0?this._caption:(this._caption=t,this._domCaption.textContent=ContentEdit._(t))},e.prototype.mount=function(){var t,n,i;return document.activeElement&&(document.activeElement.blur(),window.getSelection().removeAllRanges()),t=["ct-widget","ct-dialog"],this._busy&&t.push("ct-dialog--busy"),this._domElement=this.constructor.createDiv(t),this.parent().domElement().appendChild(this._domElement),i=this.constructor.createDiv(["ct-dialog__header"]),this._domElement.appendChild(i),this._domCaption=this.constructor.createDiv(["ct-dialog__caption"]),i.appendChild(this._domCaption),this.caption(this._caption),this._domClose=this.constructor.createDiv(["ct-dialog__close"]),i.appendChild(this._domClose),n=this.constructor.createDiv(["ct-dialog__body"]),this._domElement.appendChild(n),this._domView=this.constructor.createDiv(["ct-dialog__view"]),n.appendChild(this._domView),this._domControls=this.constructor.createDiv(["ct-dialog__controls"]),n.appendChild(this._domControls),this._domBusy=this.constructor.createDiv(["ct-dialog__busy"]),this._domElement.appendChild(this._domBusy)},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domBusy=null,this._domCaption=null,this._domClose=null,this._domControls=null,this._domView=null},e.prototype._addDOMEventListeners=function(){return this._handleEscape=(function(t){return function(n){if(!t._busy)return n.keyCode===27?t.dispatchEvent(t.createEvent("cancel")):void 0}})(this),document.addEventListener("keyup",this._handleEscape),this._domClose.addEventListener("click",(function(t){return function(n){if(n.preventDefault(),!t._busy)return t.dispatchEvent(t.createEvent("cancel"))}})(this))},e.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keyup",this._handleEscape)},e})(m.WidgetUI),m.ImageDialog=(function(l){function e(){e.__super__.constructor.call(this,"Insert image"),this._cropMarks=null,this._imageURL=null,this._imageSize=null,this._progress=0,this._state="empty",m.IMAGE_UPLOADER&&m.IMAGE_UPLOADER(this)}return D(e,l),e.prototype.cropRegion=function(){return this._cropMarks?this._cropMarks.region():[0,0,1,1]},e.prototype.addCropMarks=function(){if(!this._cropMarks)return this._cropMarks=new v(this._imageSize),this._cropMarks.mount(this._domView),ContentEdit.addCSSClass(this._domCrop,"ct-control--active")},e.prototype.clear=function(){return this._domImage&&(this._domImage.parentNode.removeChild(this._domImage),this._domImage=null),this._imageURL=null,this._imageSize=null,this.state("empty")},e.prototype.mount=function(){var t,n,i;return e.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog"),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--empty"),ContentEdit.addCSSClass(this._domView,"ct-image-dialog__view"),i=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(i),this._domRotateCCW=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--rotate-ccw"]),this._domRotateCCW.setAttribute("data-ct-to
24oltip",ContentEdit._("Rotate")+" -90\xB0"),i.appendChild(this._domRotateCCW),this._domRotateCW=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--rotate-cw"]),this._domRotateCW.setAttribute("data-ct-tooltip",ContentEdit._("Rotate")+" 90\xB0"),i.appendChild(this._domRotateCW),this._domCrop=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--crop"]),this._domCrop.setAttribute("data-ct-tooltip",ContentEdit._("Crop marks")),i.appendChild(this._domCrop),n=this.constructor.createDiv(["ct-progress-bar"]),i.appendChild(n),this._domProgress=this.constructor.createDiv(["ct-progress-bar__progress"]),n.appendChild(this._domProgress),t=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(t),this._domUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--upload"]),this._domUpload.textContent=ContentEdit._("Upload"),t.appendChild(this._domUpload),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-image-dialog__file-upload"),this._domInput.setAttribute("name","file"),this._domInput.setAttribute("type","file"),this._domInput.setAttribute("accept","image/*"),this._domUpload.appendChild(this._domInput),this._domInsert=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert"]),this._domInsert.textContent=ContentEdit._("Insert"),t.appendChild(this._domInsert),this._domCancelUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--cancel"]),this._domCancelUpload.textContent=ContentEdit._("Cancel"),t.appendChild(this._domCancelUpload),this._domClear=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--clear"]),this._domClear.textContent=ContentEdit._("Clear"),t.appendChild(this._domClear),this._addDOMEventListeners(),this.dispatchEvent(this.createEvent("imageuploader.mount"))},e.prototype.populate=function(t,n){return this._imageURL=t,this._imageSize=n,this._domImage||(this._domImage=this.constructor.createDiv(["ct-image-dialog__image"]),this._domView.appendChild(this._domImage)),this._domImage.style["background-image"]="url("+t+")",this.state("populated")},e.prototype.progress=function(t){return t===void 0?this._progress:(this._progress=t,this.isMounted()?this._domProgress.style.width=this._progress+"%":void 0)},e.prototype.removeCropMarks=function(){if(this._cropMarks)return this._cropMarks.unmount(),this._cropMarks=null,ContentEdit.removeCSSClass(this._domCrop,"ct-control--active")},e.prototype.save=function(t,n,i){return this.dispatchEvent(this.createEvent("save",{imageURL:t,imageSize:n,imageAttrs:i}))},e.prototype.state=function(t){var n;if(t===void 0)return this._state;if(this._state!==t&&(n=this._state,this._state=t,this.isMounted()))return ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--"+this._state),ContentEdit.removeCSSClass(this._domElement,"ct-image-dialog--"+n)},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domCancelUpload=null,this._domClear=null,this._domCrop=null,this._domInput=null,this._domInsert=null,this._domProgress=null,this._domRotateCCW=null,this._domRotateCW=null,this._domUpload=null,this.dispatchEvent(this.createEvent("imageuploader.unmount"))},e.prototype._addDOMEventListeners=function(){return e.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("change",(function(t){return function(n){var i;if(i=n.target.files[0])return n.target.value="",n.target.value&&(n.target.type="text",n.target.type="file"),t.dispatchEvent(t.createEvent("imageuploader.fileready",{file:i}))}})(this)),this._domCancelUpload.addEventListener("click",(function(t){return function(n){return t.dispatchEvent(t.createEvent("imageuploader.cancelupload"))}})(this)),this._domClear.addEventListener("click",(function(t){return function(n){return t.removeCropMarks(),t.dispatchEvent(t.createEvent("imageuploader.clear"))}})(this)),this._domRotateCCW.addEventListener("click",(function(t){return function(n){return t.removeCropMarks(),t.dispatchEvent(t.createEvent("imageuploader.rotateccw"))}})(this)),this._domRotateCW.addEventListener("click",(function(t){return function(n){return t.removeCropMarks(),t.dispatchEvent(t.createEvent("imageuploader.rotatecw"))}})(this)),this._domCrop.addEventListener("click",(function(t){return function(n){return t._cropMarks?t.removeCropMarks():t.addCropMarks()}})(this)),this._domInsert.addEventListener("click",(function(t){return function(n){return t.dispatchEvent(t.createEvent("imageuploader.save"))}})(this))},e})(m.DialogUI),v=(function(l){function e(t){e.__super__.constructor.call(this),this._bounds=null,this._dragging=null,this._draggingOrigin=null,this._imageSize=t}return D(e,l),e.prototype.mount=function(t,n){return n==null&&(n=null),this._domElement=this.constructor.createDiv(["ct-crop-marks"]),this._domClipper=this.constructor.createDiv(["ct-crop-marks__clipper"]),this._domElement.appendChild(this._domClipper),this._domRulers=[this.constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--top-left"]),this.constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--bottom-right"])],this._domClipper.appendChild(this._domRulers[0]),this._domClipper.appendChild(this._domRulers[1]),this._domHandles=[this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--top-left"]),this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--bottom-right"])],this._domElement.appendChild(this._domHandles[0]),this._domElement.appendChild(this._domHandles[1]),e.__super__.mount.call(this,t,n),this._fit(t)},e.prototype.region=function(){return[parseFloat(this._domHandles[0].style.top)/this._bounds[1],parseFloat(this._domHandles[0].style.left)/this._bounds[0],parseFloat(this._domHandles[1].style.top)/this._bounds[1],parseFloat(this._domHandles[1].style.left)/this._bounds[0]]},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domClipper=null,this._domHandles=null,this._domRulers=null},e.prototype._addDOMEventListeners=function(){return e.__super__._addDOMEventListeners.call(this),this._domHandles[0].addEventListener("mousedown",(function(t){return function(n){if(n.button===0)return t._startDrag(0,n.clientY,n.clientX)}})(this)),this._domHandles[1].addEventListener("mousedown",(function(t){return function(n){if(n.button===0)return t._startDrag(1,n.clientY,n.clientX)}})(this))},e.prototype._drag=function(t,n){var i,o,r,s,a;if(this._dragging!==null)return ContentSelect.Range.unselectAll(),s=t-this._draggingOrigin[1],r=n-this._draggingOrigin[0],i=this._bounds[1],n=0,t=0,a=this._bounds[0],o=Math.min(Math.min(m.MIN_CROP,i),a),this._dragging===0?(i=parseInt(this._domHandles[1].style.top)-o,a=parseInt(this._domHandles[1].style.left)-o):(n=parseInt(this._domHandles[0].style.left)+o,t=parseInt(this._domHandles[0].style.top)+o),s=Math.min(Math.max(t,s),i),r=Math.min(Math.max(n,r),a),this._domHandles[this._dragging].style.top=s+"px",this._domHandles[this._dragging].style.left=r+"px",this._domRulers[this._dragging].style.top=s+"px",this._domRulers[this._dragging].style.left=r+"px"},e.prototype._fit=function(t){var n,i,o,r,s,a,u,p;return s=t.getBoundingClientRect(),p=s.width/this._imageSize[0],i=s.height/this._imageSize[1],r=Math.min(p,i),u=r*this._imageSize[0],n=r*this._imageSize[1],o=(s.width-u)/2,a=(s.height-n)/2,this._domElement.style.width=u+"px",this._domElement.style.height=n+"px",this._domElement.style.top=a+"px",this._domElement.style.left=o+"px",this._domHandles[0].style.top="0px",this._domHandles[0].style.left="0px",this._domHandles[1].style.top=n+"px",this._domHandles[1].style.left=u+"px",this._domRulers[0].style.top="0px",this._domRulers[0].style.left="0px",this._domRulers[1].style.top=n+"px",this._domRulers[1].style.left=u+"px",this._bounds=[u,
24n]},e.prototype._startDrag=function(t,n,i){var o;return o=this._domHandles[t],this._dragging=t,this._draggingOrigin=[i-parseInt(o.style.left),n-parseInt(o.style.top)],this._onMouseMove=(function(r){return function(s){return r._drag(s.clientY,s.clientX)}})(this),document.addEventListener("mousemove",this._onMouseMove),this._onMouseUp=(function(r){return function(s){return r._stopDrag()}})(this),document.addEventListener("mouseup",this._onMouseUp)},e.prototype._stopDrag=function(){return document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._dragging=null,this._draggingOrigin=null},e})(m.AnchoredComponentUI),m.LinkDialog=(function(l){function e(n,i){n==null&&(n=""),i==null&&(i=""),e.__super__.constructor.call(this),this._href=n,this._target=i}var t;return D(e,l),t="_blank",e.prototype.mount=function(){return e.__super__.mount.call(this),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-anchored-dialog__input"),this._domInput.setAttribute("name","href"),this._domInput.setAttribute("placeholder",ContentEdit._("Enter a link")+"..."),this._domInput.setAttribute("type","text"),this._domInput.setAttribute("value",this._href),this._domElement.appendChild(this._domInput),this._domTargetButton=this.constructor.createDiv(["ct-anchored-dialog__target-button"]),this._domElement.appendChild(this._domTargetButton),this._target===t&&ContentEdit.addCSSClass(this._domTargetButton,"ct-anchored-dialog__target-button--active"),this._domButton=this.constructor.createDiv(["ct-anchored-dialog__button"]),this._domElement.appendChild(this._domButton),this._addDOMEventListeners()},e.prototype.save=function(){var n;return this.isMounted()?(n={href:this._domInput.value.trim()},this._target&&(n.target=this._target),this.dispatchEvent(this.createEvent("save",n))):void this.dispatchEvent(this.createEvent("save"))},e.prototype.show=function(){if(e.__super__.show.call(this),this._domInput.focus(),this._href)return this._domInput.select()},e.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),e.__super__.unmount.call(this),this._domButton=null,this._domInput=null},e.prototype._addDOMEventListeners=function(){return this._domInput.addEventListener("keypress",(function(n){return function(i){if(i.keyCode===13)return n.save()}})(this)),this._domTargetButton.addEventListener("click",(function(n){return function(i){return i.preventDefault(),n._target===t?(n._target="",ContentEdit.removeCSSClass(n._domTargetButton,"ct-anchored-dialog__target-button--active")):(n._target=t,ContentEdit.addCSSClass(n._domTargetButton,"ct-anchored-dialog__target-button--active"))}})(this)),this._domButton.addEventListener("click",(function(n){return function(i){return i.preventDefault(),n.save()}})(this))},e})(m.AnchoredDialogUI),m.PropertiesDialog=(function(l){function e(t){var n;this.element=t,e.__super__.constructor.call(this,"Properties"),this._attributeUIs=[],this._focusedAttributeUI=null,this._styleUIs=[],this._supportsCoding=this.element.content,(n=this.element.type())!=="ListItem"&&n!=="TableCell"||(this._supportsCoding=!0)}return D(e,l),e.prototype.caption=function(t){return t===void 0?this._caption:(this._caption=t,this._domCaption.textContent=ContentEdit._(t)+": "+this.element.tagName())},e.prototype.changedAttributes=function(){var t,n,i,o,r,s,a,u,p,g;for(n={},i={},p=this._attributeUIs,a=0,u=p.length;a<u;a++)t=p[a],o=t.name(),s=t.value(),o!==""&&(n[o.toLowerCase()]=!0,this.element.attr(o)!==s&&(i[o]=s));r=m.getRestrictedAtributes(this.element.tagName()),g=this.element.attributes();for(o in g)s=g[o],r&&r.indexOf(o.toLowerCase())!==-1||n[o]===void 0&&(i[o]=null);return i},e.prototype.changedStyles=function(){var t,n,i,o,r,s;for(i={},s=this._styleUIs,o=0,r=s.length;o<r;o++)n=s[o],t=n.style.cssClass(),this.element.hasCSSClass(t)!==n.applied()&&(i[t]=n.applied());return i},e.prototype.getElementInnerHTML=function(){return this._supportsCoding?this.element.content?this.element.content.html():this.element.children[0].content.html():null},e.prototype.mount=function(){var t,n,i,o,r,s,a,u,p,g,E,T,x,L,R;for(e.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog"),ContentEdit.addCSSClass(this._domView,"ct-properties-dialog__view"),this._domStyles=this.constructor.createDiv(["ct-properties-dialog__styles"]),this._domStyles.setAttribute("data-ct-empty",ContentEdit._("No styles available for this tag")),this._domView.appendChild(this._domStyles),R=m.StylePalette.styles(this.element),E=0,x=R.length;E<x;E++)u=R[E],p=new b(u,this.element.hasCSSClass(u.cssClass())),this._styleUIs.push(p),p.mount(this._domStyles);this._domAttributes=this.constructor.createDiv(["ct-properties-dialog__attributes"]),this._domView.appendChild(this._domAttributes),a=m.getRestrictedAtributes(this.element.tagName()),n=this.element.attributes(),t=[];for(s in n)g=n[s],a&&a.indexOf(s.toLowerCase())!==-1||t.push(s);for(t.sort(),T=0,L=t.length;T<L;T++)s=t[T],g=n[s],this._addAttributeUI(s,g);return this._addAttributeUI("",""),this._domCode=this.constructor.createDiv(["ct-properties-dialog__code"]),this._domView.appendChild(this._domCode),this._domInnerHTML=document.createElement("textarea"),this._domInnerHTML.setAttribute("class","ct-properties-dialog__inner-html"),this._domInnerHTML.setAttribute("name","code"),this._domInnerHTML.value=this.getElementInnerHTML(),this._domCode.appendChild(this._domInnerHTML),o=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(o),this._domStylesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--styles"]),this._domStylesTab.setAttribute("data-ct-tooltip",ContentEdit._("Styles")),o.appendChild(this._domStylesTab),this._domAttributesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--attributes"]),this._domAttributesTab.setAttribute("data-ct-tooltip",ContentEdit._("Attributes")),o.appendChild(this._domAttributesTab),this._domCodeTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--code"]),this._domCodeTab.setAttribute("data-ct-tooltip",ContentEdit._("Code")),o.appendChild(this._domCodeTab),this._supportsCoding||ContentEdit.addCSSClass(this._domCodeTab,"ct-control--muted"),this._domRemoveAttribute=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--remove","ct-control--muted"]),this._domRemoveAttribute.setAttribute("data-ct-tooltip",ContentEdit._("Remove")),o.appendChild(this._domRemoveAttribute),i=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(i),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent=ContentEdit._("Apply"),i.appendChild(this._domApply),r=window.localStorage.getItem("ct-properties-dialog-tab"),r==="attributes"?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--attributes"),ContentEdit.addCSSClass(this._domAttributesTab,"ct-control--active")):r==="code"&&this._supportsCoding?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--code"),ContentEdit.addCSSClass(this._domCodeTab,"ct-control--active")):(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--styles"),ContentEdit.addCSSClass(this._domStylesTab,"ct-control--active")),this._addDOMEventListeners()},e.prototype.save=function(){var t,n;return n=null,this._supportsCoding&&(n=this._domInnerHTML.value),t={changedAttributes:this.changedAttributes(),changedStyles:this.changedStyles(),innerHTML:n},this.dispatchEvent(this.createEvent("save",t))},e.prototype._addAttributeUI=function(t,n){var i,o;return o=this,i=new c(t,n),this._attributeUIs.push(i),i.addEventListener("blur",function(r){var s,a,u;if(o._focusedAttributeUI=null,ContentEdit.addCSSClass(o._domRemoveAttribute,"ct-control--muted"),s=o._attributeUIs.indexOf(this),u=o._attributeUIs.length,this.name()===""&&s<u-1&&(this.unmount(),o._attributeUIs.splice(s,1)),(a=o._attributeUIs[u-1])&&a.name()&&a.value())return o._addAttributeUI("","")}),i.addEventListener("focus",function(r){return o._focusedAttributeUI=this,ContentEdit.removeCSSClass(o._domRemoveAttribute,"ct-control--muted")}),i.addEventListener("namechange",function(r){var s,a,u,p,g,E,T;for(s=o.element,t=this.name().toLowerCase(),u=m.getRestrictedAtributes(s.tagName()),p=!0,u&&u.indexOf(t)!==-1&&(p=!1),T=o._attributeUIs,g=0,E=T.length;g<E;g++)a=T[g],t!==""&&a!==this&&a.name().toLowerCase()===t&&(p=!1);return this.valid(p),p?ContentEdit.removeCSSClass(o._domApply,"ct-control--muted"):ContentEdit.addCSSClass(o._domApply,"ct-control--muted")}),i.mount(this._domAttributes),i},e.prototype._addDOMEventListeners=function(){var t,n;return e.__super__._addDOMEventListeners.call(this),t=(function(i){return function(o){var r,s,a,u,p,g;for(u=["attributes","code","styles"],p=0,g=u.length;p<g;p++)(s=u[p])!==o&&(a=s.charAt(0).toUpperCase()+s.slice(1),ContentEdit.removeCSSClass(i._domElement,"ct-properties-dialog--"+s),ContentEdit.removeCSSClass(i["_dom"+a+"Tab"],"ct-control--active"));return r=o.charAt(0).toUpperCase()+o.slice(1),ContentEdit.addCSSClass(i._domElement,"ct-properties-dialog--"+o),ContentEdit.addCSSClass(i["_dom"+r+"Tab"],"ct-control--active"),window.localStorage.setItem("ct-properties-dialog-tab",o)}})(this),this._domStylesTab.addEventListener("mousedown",(function(i){return function(){return t("styles")}})()),this._domAttributesTab.addEventListener("mousedown",(function(i){return function(){return t("attributes")}})()),this._supportsCoding&&this._domCodeTab.addEventListener("mousedown",(function(i){return function(){return t("code")}})()),this._domRemoveAttribute.addEventListener("mousedown",(function(i){return function(o){var r,s;if(o.preventDefault(),i._focusedAttributeUI&&(r=i._attributeUIs.indexOf(i._focusedAttributeUI),s=r===i._attributeUIs.length-1,i._focusedAttributeUI.unmount(),i._attributeUIs.splice(r,1),s))return i._addAttributeUI("","")}})(this)),n=(function(i){return function(o){try{return new HTMLString.String(i._domInnerHTML.value),ContentEdit.removeCSSClass(i._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.removeCSSClass(i._domApply,"ct-control--muted")}catch{return ContentEdit.addCSSClass(i._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.addCSSClass(i._domApply,"ct-control--muted")}}})(this),this._domInnerHTML.addEventListener("input",n),this._domInnerHTML.addEventListener("propertychange",n),this._domApply.addEventListener("click",(function(i){return function(o){var r;
24if(o.preventDefault(),r=i._domApply.getAttribute("class"),r.indexOf("ct-control--muted")===-1)return i.save()}})(this))},e})(m.DialogUI),b=(function(l){function e(t,n){this.style=t,e.__super__.constructor.call(this),this._applied=n}return D(e,l),e.prototype.applied=function(t){if(t===void 0)return this._applied;if(this._applied!==t)return this._applied=t,this._applied?ContentEdit.addCSSClass(this._domElement,"ct-section--applied"):ContentEdit.removeCSSClass(this._domElement,"ct-section--applied")},e.prototype.mount=function(t,n){var i;return n==null&&(n=null),this._domElement=this.constructor.createDiv(["ct-section"]),this._applied&&ContentEdit.addCSSClass(this._domElement,"ct-section--applied"),i=this.constructor.createDiv(["ct-section__label"]),i.textContent=this.style.name(),this._domElement.appendChild(i),this._domElement.appendChild(this.constructor.createDiv(["ct-section__switch"])),e.__super__.mount.call(this,t,n)},e.prototype._addDOMEventListeners=function(){var t;return t=(function(n){return function(i){return i.preventDefault(),n.applied()?n.applied(!1):n.applied(!0)}})(this),this._domElement.addEventListener("click",t)},e})(m.AnchoredComponentUI),c=(function(l){function e(t,n){e.__super__.constructor.call(this),this._initialName=t,this._initialValue=n}return D(e,l),e.prototype.name=function(){return this._domName.value.trim()},e.prototype.value=function(){return this._domValue.value.trim()},e.prototype.mount=function(t,n){return n==null&&(n=null),this._domElement=this.constructor.createDiv(["ct-attribute"]),this._domName=document.createElement("input"),this._domName.setAttribute("class","ct-attribute__name"),this._domName.setAttribute("name","name"),this._domName.setAttribute("placeholder",ContentEdit._("Name")),this._domName.setAttribute("type","text"),this._domName.setAttribute("value",this._initialName),this._domElement.appendChild(this._domName),this._domValue=document.createElement("input"),this._domValue.setAttribute("class","ct-attribute__value"),this._domValue.setAttribute("name","value"),this._domValue.setAttribute("placeholder",ContentEdit._("Value")),this._domValue.setAttribute("type","text"),this._domValue.setAttribute("value",this._initialValue),this._domElement.appendChild(this._domValue),e.__super__.mount.call(this,t,n)},e.prototype.valid=function(t){return t?ContentEdit.removeCSSClass(this._domName,"ct-attribute__name--invalid"):ContentEdit.addCSSClass(this._domName,"ct-attribute__name--invalid")},e.prototype._addDOMEventListeners=function(){return this._domName.addEventListener("blur",(function(t){return function(){var n,i,o;if(n=t.name(),i=t._domElement.nextSibling,t.dispatchEvent(t.createEvent("blur")),n===""&&i)return o=i.querySelector(".ct-attribute__name"),o.focus()}})(this)),this._domName.addEventListener("focus",(function(t){return function(){return t.dispatchEvent(t.createEvent("focus"))}})(this)),this._domName.addEventListener("input",(function(t){return function(){return t.dispatchEvent(t.createEvent("namechange"))}})(this)),this._domName.addEventListener("keydown",(function(t){return function(n){if(n.keyCode===13)return t._domValue.focus()}})(this)),this._domValue.addEventListener("blur",(function(t){return function(){return t.dispatchEvent(t.createEvent("blur"))}})(this)),this._domValue.addEventListener("focus",(function(t){return function(){return t.dispatchEvent(t.createEvent("focus"))}})(this)),this._domValue.addEventListener("keydown",(function(t){return function(n){var i,o;if(n.keyCode===13||n.keyCode===9&&!n.shiftKey)return n.preventDefault(),i=t._domElement.nextSibling,i||(t._domValue.blur(),i=t._domElement.nextSibling),i?(o=i.querySelector(".ct-attribute__name"),o.focus()):void 0}})(this))},e})(m.AnchoredComponentUI),m.TableDialog=(function(l){function e(t){this.table=t,this.table?e.__super__.constructor.call(this,"Update table"):e.__super__.constructor.call(this,"Insert table")}return D(e,l),e.prototype.mount=function(){var t,n,i,o,r,s,a;return e.__super__.mount.call(this),t={columns:3,foot:!1,head:!0},this.table&&(t={columns:this.table.firstSection().children[0].children.length,foot:this.table.tfoot(),head:this.table.thead()}),ContentEdit.addCSSClass(this._domElement,"ct-table-dialog"),ContentEdit.addCSSClass(this._domView,"ct-table-dialog__view"),a=["ct-section"],t.head&&a.push("ct-section--applied"),this._domHeadSection=this.constructor.createDiv(a),this._domView.appendChild(this._domHeadSection),r=this.constructor.createDiv(["ct-section__label"]),r.textContent=ContentEdit._("Table head"),this._domHeadSection.appendChild(r),this._domHeadSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domHeadSection.appendChild(this._domHeadSwitch),this._domBodySection=this.constructor.createDiv(["ct-section","ct-section--applied","ct-section--contains-input"]),this._domView.appendChild(this._domBodySection),n=this.constructor.createDiv(["ct-section__label"]),n.textContent=ContentEdit._("Table body (columns)"),this._domBodySection.appendChild(n),this._domBodyInput=document.createElement("input"),this._domBodyInput.setAttribute("class","ct-section__input"),this._domBodyInput.setAttribute("maxlength","2"),this._domBodyInput.setAttribute("name","columns"),this._domBodyInput.setAttribute("type","text"),this._domBodyInput.setAttribute("value",t.columns),this._domBodySection.appendChild(this._domBodyInput),s=["ct-section"],t.foot&&s.push("ct-section--applied"),this._domFootSection=this.constructor.createDiv(s),this._domView.appendChild(this._domFootSection),o=this.constructor.createDiv(["ct-section__label"]),o.textContent=ContentEdit._("Table foot"),this._domFootSection.appendChild(o),this._domFootSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domFootSection.appendChild(this._domFootSwitch),i=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(i),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent="Apply",i.appendChild(this._domApply),this._addDOMEventListeners()},e.prototype.save=function(){var t,n,i;return n=this._domFootSection.getAttribute("class"),i=this._domHeadSection.getAttribute("class"),t={columns:parseInt(this._domBodyInput.value),foot:n.indexOf("ct-section--applied")>-1,head:i.indexOf("ct-section--applied")>-1},this.dispatchEvent(this.createEvent("save",t))},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domBodyInput=null,this._domBodySection=null,this._domApply=null,this._domHeadSection=null,this._domHeadSwitch=null,this._domFootSection=null,this._domFootSwitch=null},e.prototype._addDOMEventListeners=function(){var t;return e.__super__._addDOMEventListeners.call(this),t=function(n){return n.preventDefault(),this.getAttribute("class").indexOf("ct-section--applied")>-1?ContentEdit.removeCSSClass(this,"ct-section--applied"):ContentEdit.addCSSClass(this,"ct-section--applied")},this._domHeadSection.addEventListener("click",t),this._domFootSection.addEventListener("click",t),this._domBodySection.addEventListener("click",(function(n){return function(i){return n._domBodyInput.focus()}})(this)),this._domBodyInput.addEventListener("input",(function(n){return function(i){var o;return o=/^[1-9]\d{0,1}$/.test(i.target.value),o?(ContentEdit.removeCSSClass(n._domBodyInput,"ct-section__input--invalid"),ContentEdit.removeCSSClass(n._domApply,"ct-control--muted")):(ContentEdit.addCSSClass(n._domBodyInput,"ct-section__input--invalid"),ContentEdit.addCSSClass(n._domApply,"ct-control--muted"))}})(this)),this._domApply.addEventListener("click",(function(n){return function(i){var o;if(i.preventDefault(),o=n._domApply.getAttribute("class"),o.indexOf("ct-control--muted")===-1)return n.save()}})(this))},e})(m.DialogUI),m.VideoDialog=(function(l){function e(){e.__super__.constructor.call(this,"Insert video")}return D(e,l),e.prototype.clearPreview=function(){if(this._domPreview)return this._domPreview.parentNode.removeChild(this._domPreview),this._domPreview=void 0},e.prototype.mount=function(){var t;return e.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-video-dialog"),ContentEdit.addCSSClass(this._domView,"ct-video-dialog__preview"),t=this.constructor.createDiv(["ct-control-group"]),this._domControls.appendChild(t),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-video-dialog__input"),this._domInput.setAttribute("name","url"),this._domInput.setAttribute("placeholder",ContentEdit._("Paste YouTube or Vimeo URL")+"..."),this._domInput.setAttribute("type","text"),t.appendChild(this._domInput),this._domButton=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert","ct-control--muted"]),this._domButton.textContent=ContentEdit._("Insert"),t.appendChild(this._domButton),this._addDOMEventListeners()},e.prototype.preview=function(t){return this.clearPreview(),this._domPreview=document.createElement("iframe"),this._domPreview.setAttribute("frameborder","0"),this._domPreview.setAttribute("height","100%"),this._domPreview.setAttribute("src",t),this._domPreview.setAttribute("width","100%"),this._domView.appendChild(this._domPreview)},e.prototype.save=function(){var t,n;return n=this._domInput.value.trim(),t=m.getEmbedVideoURL(n),t?this.dispatchEvent(this.createEvent("save",{url:t})):this.dispatchEvent(this.createEvent("save",{url:n}))},e.prototype.show=function(){return e.__super__.show.call(this),this._domInput.focus()},e.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),e.__super__.unmount.call(this),this._domButton=null,this._domInput=null,this._domPreview=null},e.prototype._addDOMEventListeners=function(){return e.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("input",(function(t){return function(n){var i;return n.target.value?ContentEdit.removeCSSClass(t._domButton,"ct-control--muted"):ContentEdit.addCSSClass(t._domButton,"ct-control--muted"),t._updatePreviewTimeout&&clearTimeout(t._updatePreviewTimeout),i=function(){var o,r;return r=t._domInput.value.trim(),o=m.getEmbedVideoURL(r),o?t.preview(o):t.clearPreview()},t._updatePreviewTimeout=setTimeout(i,500)}})(this)),this._domInput.addEventListener("keypress",(function(t){return function(n){if(n.keyCode===13)return t.save()}})(this)),this._domButton.addEventListener("click",(function(t){return function(n){var i;if(n.preventDefault(),i=t._domButton.getAttribute("class"),i.indexOf("ct-control--muted")===-1)return t.save()}})(this))},e})(m.DialogUI),m.HTMLCleaner=(function(){function l(e,t){this.tagWhitelist=e||this.constructor.DEFAULT_TAG_WHITELIST,this.attributeWhitelist=t||this.constructor.DEFAULT_ATTRIBUTE_WHITELIST}return l.DEFAULT_ATTRIBUTE_WHITELIST={a:["href"],td:["colspan"]},l.DEFAULT_TAG_WHITELIST=["a","address","b","blockquote","code","del","em","h1","h2","h3","h4","h5","h6","i","ins","li","ol","p","pre","strong","sup","table","tbody","td","tfoot","th","thead","tr","u","ul","#text"],l.NO_CONTENT_TAGS=["head","meta","style","script","title"],l.prototype.clean=function(e){var t,n,i,o,r,s,a,u,p,g,E,T,x,L,R,U,H;
24for(e=e.replace(/<span( class="Apple-converted-space")?> <\/span>/g," "),p=document.implementation.createHTMLDocument(),T=p.createElement("div"),T.innerHTML=e,g=(function(){var C,h,d,_;for(d=T.childNodes,_=[],C=0,h=d.length;C<h;C++)i=d[C],_.push(i);return _})();g.length>0;)if(r=g.shift(),s=r.nodeName.toLowerCase(),this.tagWhitelist.indexOf(s)<0){if(this.constructor.NO_CONTENT_TAGS.indexOf(s)>-1){r.remove();continue}for(H=r.childNodes,x=0,R=H.length;x<R;x++)(o=H[x])&&(o=o.cloneNode(!0),o.nodeName.toLowerCase(),r.parentNode.insertBefore(o,r),g.push(o));r.remove()}else if(s==="#text"||r.textContent.trim()!==""){if(s!=="td"&&s!=="th"&&s!=="li"||r.querySelector("p")&&(r.innerHTML=r.textContent),r.attributes)for(u=this.attributeWhitelist[s]||[],a=(function(){var C,h,d,_;for(d=r.attributes,_=[],C=0,h=d.length;C<h;C++)t=d[C],_.push(t);return _})(),L=0,U=a.length;L<U;L++)n=a[L],(u.indexOf(n.name.toLowerCase())<0||n.name.toLowerCase()==="href"&&(E=r.getAttribute(n.name),E.startsWith("javascript:")))&&r.removeAttribute(n.name);g.push.apply(g,(function(){var C,h,d,_;for(d=r.childNodes,_=[],C=0,h=d.length;C<h;C++)i=d[C],_.push(i);return _})())}else r.textContent===""||r.parentNode===T?r.remove():r.parentNode.replaceChild(p.createTextNode(" "),r);return T.innerHTML},l})(),w=(function(l){function e(){e.__super__.constructor.call(this),this.history=null,this._state="dormant",this._busy=!1,this._namingProp=null,this._fixtureTest=function(t){return t.hasAttribute("data-fixture")},this._regionQuery=null,this._domRegions=null,this._regions={},this._orderedRegions=[],this._rootLastModified=null,this._regionsLastModified={},this._ignition=null,this._inspector=null,this._toolbox=null,this._emptyRegionsAllowed=!1}return D(e,l),e.prototype.ctrlDown=function(){return this._ctrlDown},e.prototype.domRegions=function(){return this._domRegions},e.prototype.getState=function(){return this._state},e.prototype.ignition=function(){return this._ignition},e.prototype.inspector=function(){return this._inspector},e.prototype.isDormant=function(){return this._state==="dormant"},e.prototype.isReady=function(){return this._state==="ready"},e.prototype.isEditing=function(){return this._state==="editing"},e.prototype.orderedRegions=function(){var t;return function(){var n,i,o,r;for(o=this._orderedRegions,r=[],n=0,i=o.length;n<i;n++)t=o[n],r.push(this._regions[t]);return r}.call(this)},e.prototype.regions=function(){return this._regions},e.prototype.shiftDown=function(){return this._shiftDown},e.prototype.toolbox=function(){return this._toolbox},e.prototype.busy=function(t){return t===void 0?this._busy:(this._busy=t,this._ignition?this._ignition.busy(t):void 0)},e.prototype.createPlaceholderElement=function(t){return new ContentEdit.Text("p",{},"")},e.prototype.init=function(t,n,i,o){return n==null&&(n="id"),i==null&&(i=null),o==null&&(o=!0),this._namingProp=n,i&&(this._fixtureTest=i),this.mount(),o&&(this._ignition=new m.IgnitionUI,this.attach(this._ignition),this._ignition.addEventListener("edit",(function(r){return function(s){return s.preventDefault(),r.start(),r._ignition.state("editing")}})(this)),this._ignition.addEventListener("confirm",(function(r){return function(s){if(s.preventDefault(),r._ignition.state()==="editing")return r._ignition.state("ready"),r.stop(!0)}})(this)),this._ignition.addEventListener("cancel",(function(r){return function(s){if(s.preventDefault(),r._ignition.state()==="editing")return r.stop(!1),r.isEditing()?r._ignition.state("editing"):r._ignition.state("ready")}})(this))),this._toolbox=new m.ToolboxUI(m.DEFAULT_TOOLS),this.attach(this._toolbox),this._inspector=new m.InspectorUI,this.attach(this._inspector),this._state="ready",this._handleDetach=(function(r){return function(s){return r._preventEmptyRegions()}})(this),this._handleClipboardPaste=(function(r){return function(s,a){return a.clipboardData?void(a.clipboardData.getData("text/html")&&s.type()!=="PreText"?r.pasteHTML(s,a.clipboardData.getData("text/html")):r.pasteText(s,a.clipboardData.getData("text/plain"))):window.clipboardData?(window.clipboardData.getData("TEXT"),r.pasteText(s,window.clipboardData.getData("TEXT"))):void 0}})(this),this._handleNextRegionTransition=(function(r){return function(s){var a,u,p,g,E,T,x;if(g=r.orderedRegions(),!((p=g.indexOf(s))>=g.length-1)){for(s=g[p+1],u=null,x=s.descendants(),E=0,T=x.length;E<T;E++)if(a=x[E],a.content!==void 0){u=a;break}
24return u?(u.focus(),void u.selection(new ContentSelect.Range(0,0))):ContentEdit.Root.get().trigger("next-region",s)}}})(this),this._handlePreviousRegionTransition=(function(r){return function(s){var a,u,p,g,E,T,x,L;if(T=r.orderedRegions(),!((g=T.indexOf(s))<=0)){for(s=T[g-1],p=null,u=s.descendants(),u.reverse(),x=0,L=u.length;x<L;x++)if(a=u[x],a.content!==void 0){p=a;break}return p?(E=p.content.length(),p.focus(),void p.selection(new ContentSelect.Range(E,E))):ContentEdit.Root.get().trigger("previous-region",s)}}})(this),ContentEdit.Root.get().bind("detach",this._handleDetach),ContentEdit.Root.get().bind("paste",this._handleClipboardPaste),ContentEdit.Root.get().bind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().bind("previous-region",this._handlePreviousRegionTransition),this.syncRegions(t)},e.prototype.destroy=function(){return ContentEdit.Root.get().unbind("detach",this._handleDetach),ContentEdit.Root.get().unbind("paste",this._handleClipboardPaste),ContentEdit.Root.get().unbind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().unbind("previous-region",this._handlePreviousRegionTransition),this.removeEventListener(),this.unmount(),this._children=[]},e.prototype.highlightRegions=function(t){var n,i,o,r,s;for(r=this._domRegions,s=[],i=0,o=r.length;i<o;i++)n=r[i],t?s.push(ContentEdit.addCSSClass(n,"ct--highlight")):s.push(ContentEdit.removeCSSClass(n,"ct--highlight"));return s},e.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-app"]),document.body.insertBefore(this._domElement,null),this._addDOMEventListeners()},e.prototype.unmount=function(){var t,n,i,o;if(this.isMounted()){for(o=this._children,n=0,i=o.length;n<i;n++)t=o[n],t.unmount();return this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,this._removeDOMEventListeners(),this._ignition=null,this._inspector=null,this._toolbox=null}},e.prototype.pasteHTML=function(t,n){var i,o,r,s,a,u,p,g,E,T,x,L,R,U,H,C,h,d,_,f,y,S,M,A,k,B,P,F,V;for(_=ContentEdit.TagNames.get(),h=document.implementation.createHTMLDocument(),M=h.createElement("div"),M.innerHTML=m.getHTMLCleaner().clean(n.trim()),r=[],F=M.childNodes,A=0,B=F.length;A<B;A++)(o=F[A])&&(o.nodeName.toLowerCase()==="#text"&&o.textContent.trim()===""||r.push(o));if(r.length){if(g=m.INLINE_TAGS.slice(),g.push("#text"),u=r[0].nodeName.toLowerCase(),T=r[r.length-1].nodeName.toLowerCase(),t.isFixed()||g.indexOf(u)>-1&&g.indexOf(T)>-1){if(n=g.indexOf(u)>-1&&g.indexOf(T)>-1?new HTMLString.String(M.innerHTML):new HTMLString.String(HTMLString.String.encode(M.textContent)),t.content)return d=t.selection(),s=d.get()[0]+n.length(),S=t.content.substring(0,d.get()[0]),y=t.content.substring(d.get()[1]),C=t.content.substring(d.get()[0],d.get()[1]),C.length()&&(i=C.characters[0],f=i.tags(),i.isTag()&&f.shift(),f.length>=1&&(n=n.format.apply(n,[0,n.length()].concat(O.call(f))))),t.content=S.concat(n),t.content=t.content.concat(y,!1),t.updateInnerHTML(),t.taint(),d.set(s,s),void t.selection(d);M.innerHTML="<p>"+n.html()+"</p>"}if(R=t,t.parent().type()!=="Region"&&(t=t.closest(function(z){return z.parent().type()==="Region"})),H=t.parent(),g.indexOf(u)>-1&&g.indexOf(T)>-1){for(E=M.createElement("p");M.childNodes.length>0;)E.appendChild(M.childNodes[0]);M.appendChild(E)}for(p=0,x=R,V=M.childNodes,k=0,P=V.length;k<P;k++)(L=V[k])&&(L.nodeName==="#text"&&L.textContent.trim()===""||(a=_.match(L.nodeName),a===ContentEdit.Static&&(U=document.createElement("p"),U.appendChild(L),L=U,a=ContentEdit.Text),x=a.fromDOMElement(L),H.attach(x,H.children.indexOf(t)+(1+p)),p+=1));return x.focus?x.focus():x.nextSibling()?(x=x.nextSibling().previousWithTest(function(z){if(z.focus)return z}))?x.focus():void 0:(x=x.nextWithTest(function(z){if(z.focus)return z}),x?x.focus():R.focus())}},e.prototype.pasteText=function(t,n){var i,o,r,s,a,u,p,g,E,T,x,L,R,U,H,C,h,d,_,f,y,S;if(R=t.type()!=="PreText"?n.split(` 25`):[n],R=R.filter(function(M){return M.trim()!==""})){if(r=HTMLString.String.encode,C=!0,f=t.type(),R.length===1&&(C=!1),f==="PreText"&&(C=!1),t.can("spawn")||(C=!1),C){for(f==="ListItemText"?(p=t.parent(),u=t.parent().parent(),a=u.children.indexOf(p)+1):(p=t,p.parent().type()!=="Region"&&(p=t.closest(function(M){return M.parent().type()==="Region"})),u=p.parent(),a=u.children.indexOf(p)+1),s=y=0,S=R.length;y<S;s=++y)x=R[s],x=r(x),f==="ListItemText"?(g=new ContentEdit.ListItem,E=new ContentEdit.ListItemText(x),g.attach(E),T=E):(g=new ContentEdit.Text("p",{},x),T=g),u.attach(g,a+s);return L=T.content.length(),T.focus(),T.selection(new ContentSelect.Range(L,L))}return n=r(n),n=new HTMLString.String(n,f==="PreText"),H=t.selection(),o=H.get()[0]+n.length(),_=t.content.substring(0,H.get()[0]),d=t.content.substring(H.get()[1]),U=t.content.substring(H.get()[0],H.get()[1]),U.length()&&(i=U.characters[0],h=i.tags(),i.isTag()&&h.shift(),h.length>=1&&(n=n.format.apply(n,[0,n.length()].concat(O.call(h))))),t.content=_.concat(n),t.content=t.content.concat(d,!1),t.updateInnerHTML(),t.taint(),H.set(o,o),t.selection(H)}},e.prototype.revert=function(){var t;if(this.dispatchEvent(this.createEvent("revert")))return!(m.CANCEL_MESSAGE&&(t=ContentEdit._(m.CANCEL_MESSAGE),ContentEdit.Root.get().lastModified()>this._rootLastModified&&!window.confirm(t)))&&(this.revertToSnapshot(this.history.goTo(0),!1),!0)},e.prototype.revertToSnapshot=function(t,n){var i,o,r,s,a,u,p,g,E,T;n==null&&(n=!0),o=[],g=this._regions;for(r in g){for(s=g[r],E=s.children,u=0,p=E.length;u<p;u++)i=E[u],i.unmount();t.regions[r]!==void 0?s.children.length===1&&s.children[0].isFixed()?(a=this.constructor.createDiv(),a.innerHTML=t.regions[r],o.push(a.firstElementChild),s.domElement().parentNode.replaceChild(a.firstElementChild,s.domElement())):(o.push(s.domElement()),s.domElement().innerHTML=t.regions[r]):(s.domElement().remove(),delete this._regions[r])}if(this._domRegions=o,n){ContentEdit.Root.get().focused()&&ContentEdit.Root.get().focused().blur(),this._regions={},this.syncRegions(null,!0),ContentEdit.Root.get()._modified=t.rootModified,T=this._regions;for(r in T)s=T[r],t.regionModifieds[r]&&(s._modified=t.regionModifieds[r]);return this.history.replaceRegions(this._regions),this.history.restoreSelection(t),this._inspector.updateTags()}},e.prototype.save=function(t){var n,i,o,r,s,a,u,p,g,E,T,x;if(this.dispatchEvent(this.createEvent("save",{passive:t}))){if(u=ContentEdit.Root.get(),u.focused()&&!t&&u.focused().blur(),u.lastModified()===this._rootLastModified&&t)return void this.dispatchEvent(this.createEvent("saved",{regions:{},passive:t}));i=[],r={},T=this._regions;for(s in T){if(a=T[s],o=a.html(),a.children.length===1&&!a.type()==="Fixture"&&(n=a.children[0],n.content&&!n.content.html()&&(o="")),!t){for(x=a.children,g=0,E=x.length;g<E;g++)n=x[g],n.unmount();a.children.length===1&&a.children[0].isFixed()?(p=this.constructor.createDiv(),p.innerHTML=o,i.push(p.firstElementChild),a.domElement().parentNode.replaceChild(p.firstElementChild,a.domElement())):(i.push(a.domElement()),a.domElement().innerHTML=o)}a.lastModified()!==this._regionsLastModified[s]&&(r[s]=o,this._regionsLastModified[s]=a.lastModified())}return this._domRegions=i,this.dispatchEvent(this.createEvent("saved",{regions:r,passive:t}))}},e.prototype.setRegionOrder=function(t){return this._orderedRegions=t.slice()},e.prototype.start=function(){if(this.dispatchEvent(this.createEvent("start")))return this.busy(!0),this.syncRegions(),this._initRegions(),this._preventEmptyRegions(),this._rootLastModified=ContentEdit.Root.get().lastModified(),this.history=new m.History(this._regions),this.history.watch(),this._state="editing",this._toolbox.show(),this._inspector.show(),this.busy(!1),this.dispatchEvent(this.createEvent("started"))},e.prototype.stop=function(t){var n;if(this.dispatchEvent(this.createEvent("stop",{save:t}))){if(n=ContentEdit.Root.get().focused(),n&&n.isMounted()&&n._syncContent!==void 0&&n._syncContent(),t)this.save();else if(!this.revert())return;return this.history.stopWatching(),this.history=null,this._toolbox.hide(),this._inspector.hide(),this._regions={},this._state="ready",ContentEdit.Root.get().focused()&&this._allowEmptyRegions((function(i){return function(){return ContentEdit.Root.get().focused().blur()}})()),this.dispatchEvent(this.createEvent("stopped"))}},e.prototype.syncRegions=function(t,n){if(t&&(this._regionQuery=t),this._domRegions=[],this._regionQuery&&(typeof this._regionQuery=="string"||this._regionQuery instanceof String?this._domRegions=document.querySelectorAll(this._regionQuery):this._domRegions=this._regionQuery),this._state==="editing"&&(this._initRegions(n),this._preventEmptyRegions()),this._ignition)return this._domRegions.length?this._ignition.show():this._ignition.hide()},e.prototype._addDOMEventListeners=function(){return this._handleHighlightOn=(function(t){return function(n){var i;return(i=n.keyCode)!==17&&i!==224&&i!==91&&i!==93||(t._ctrlDown=!0),n.keyCode===16&&!t._ctrlDown?t._highlightTimeout?void 0:(t._shiftDown=!0,void(t._highlightTimeout=setTimeout(function(){return t.highlightRegions(!0)},m.HIGHLIGHT_HOLD_DURATION))):(clearTimeout(t._highlightTimeout),t.highlightRegions(!1))}})(this),this._handleHighlightOff=(function(t){return function(n){var i;return(i=n.keyCode)===17||i===224||i===91||i===93?void(t._ctrlDown=!1):n.keyCode===16?(t._shiftDown=!1,t._highlightTimeout&&(clearTimeout(t._highlightTimeout),t._highlightTimeout=null),t.highlightRegions(!1)):void 0}})(this),this._handleVisibility=(function(t){return function(n){if(!document.hasFocus())return clearTimeout(t._highlightTimeout),t.highlightRegions(!1)}})(this),document.addEventListener("keydown",this._handleHighlightOn),document.addEventListener("keyup",this._handleHighlightOff),document.addEventListener("visibilitychange",this._handleVisibility),this._handleBeforeUnload=(function(t){return function(n){var i;if(t._state==="editing"&&m.CANCEL_MESSAGE&&t.history&&t.history._snapshotIndex)return i=ContentEdit._(m.CANCEL_MESSAGE),(n||window.event).returnValue=i,i}})(this),window.addEventListener("beforeunload",this._handleBeforeUnload),this._handleUnload=(function(t){return function(n){return t.destroy()}})(this),window.addEventListener("unload",this._handleUnload)},e.prototype._allowEmptyRegions=function(t){return this._emptyRegionsAllowed=!0,t(),this._emptyRegionsAllowed=!1},e.prototype._preventEmptyRegions=function(){var t,n,i,o,r,s,a,u,p,g,E;if(!this._emptyRegionsAllowed){p=this._regions,E=[];for(o in p){for(s=p[o],i=s.lastModified(),n=!1,g=s.children,a=0,u=g.length;a<u;a++)if(t=g[a],t.type()!=="Static"){n=!0;break}n||(r=this.createPlaceholderElement(s),s.attach(r),E.push(s._modified=i))}return E}},e.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keydown",this._handleHighlightOn),document.removeEventListener("keyup",this._handleHighlightOff),window.removeEventListener("beforeunload",this._handleBeforeUnload),window.removeEventListener("unload",this._handleUnload)},e.prototype._initRegions=function(t){var n,i,o,r,s,a,u,p,g,E,T;for(t==null&&(t=!1),o={},i=[],this._orderedRegions=[],g=this._domRegions,r=u=0,p=g.length;u<p;r=++u)n=g[r],a=n.getAttribute(this._namingProp),a||(a=r),o[a]=!0,this._orderedRegions.push(a),this._regions[a]&&this._regions[a].domElement()===n||(this._fixtureTest(n)?this._regions[a]=new ContentEdit.Fixture(n):this._regions[a]=new ContentEdit.Region(n),i.push(this._regions[a].domElement()),t||(this._regionsLastModified[a]=this._regions[a].lastModified()));this._domRegions=i,E=this._regions,T=[];for(a in E)E[a],o[a]||(delete this._regions[a],delete this._regionsLastModified[a],s=this._orderedRegions.indexOf(a),s>-1?T.push(this._orderedRegions.splice(s,1)):T.push(void 0));return T},e})(m.ComponentUI),m.EditorApp=(function(){function l(){}var e;return e=null,l.get=function(){var t;return t=m.EditorApp.getCls(),e??(e=new t)},l.getCls=function(){return w},l})(),m.History=(function(){function l(e){this._lastSnapshotTaken=null,this._regions={},this.replaceRegions(e),this._snapshotIndex=-1,this._snapshots=[],this._store()}return l.prototype.canRedo=function(){return this._snapshotIndex<this._snapshots.length-1},l.prototype.canUndo=function(){return this._snapshotIndex>0},l.prototype.index=function(){return this._snapshotIndex},l.prototype.length=function(){return this._snapshots.length},l.prototype.snapshot=function(){return this._snapshots[this._snapshotIndex]},l.prototype.goTo=function(e){return this._snapshotIndex=Math.min(this._snapshots.length-1,Math.max(0,e)),this.snapshot()},l.prototype.redo=function(){return this.goTo(this._snapshotIndex+1)},l.prototype.replaceRegions=function(e){var t,n,i;this._regions={},i=[];for(t in e)n=e[t],i.push(this._regions[t]=n);return i},l.prototype.restoreSelection=function(e){var t,n;if(e.selected)return n=this._regions[e.selected.region],t=n.descendants()[e.selected.element],t.focu
25s(),t.selection&&e.selected.selection?t.selection(e.selected.selection):void 0},l.prototype.stopWatching=function(){if(this._watchInterval&&clearInterval(this._watchInterval),this._delayedStoreTimeout)return clearTimeout(this._delayedStoreTimeout)},l.prototype.undo=function(){return this.goTo(this._snapshotIndex-1)},l.prototype.watch=function(){var e;return this._lastSnapshotTaken=Date.now(),e=(function(t){return function(){var n,i;if((i=ContentEdit.Root.get().lastModified())!==null&&i>t._lastSnapshotTaken)return t._delayedStoreRequested===i?void 0:(t._delayedStoreTimeout&&clearTimeout(t._delayedStoreTimeout),n=function(){return t._lastSnapshotTaken=i,t._store()},t._delayedStoreRequested=i,t._delayedStoreTimeout=setTimeout(n,500))}})(this),this._watchInterval=setInterval(e,50)},l.prototype._store=function(){var e,t,n,i,o,r,s;o={regions:{},regionModifieds:{},rootModified:ContentEdit.Root.get().lastModified(),selected:null},r=this._regions;for(t in r)i=r[t],o.regions[t]=i.html(),o.regionModifieds[t]=i.lastModified();if(e=ContentEdit.Root.get().focused()){if(o.selected={},!(i=e.closest(function(a){return a.type()==="Region"||a.type()==="Fixture"})))return;s=this._regions;for(t in s)if(n=s[t],i===n){o.selected.region=t;break}o.selected.element=i.descendants().indexOf(e),e.selection&&(o.selected.selection=e.selection())}return this._snapshotIndex<this._snapshots.length-1&&(this._snapshots=this._snapshots.slice(0,this._snapshotIndex+1)),this._snapshotIndex++,this._snapshots.splice(this._snapshotIndex,0,o)},l})(),m.StylePalette=(function(){function l(){}return l._styles=[],l.add=function(e){return this._styles=this._styles.concat(e)},l.styles=function(e){var t;return e===void 0?this._styles.slice():(t=e.tagName(),this._styles.filter(function(n){return!n._applicableTo||n._applicableTo.indexOf(t)!==-1}))},l})(),m.Style=(function(){function l(e,t,n){this._name=e,this._cssClass=t,this._applicableTo=n||null}return l.prototype.applicableTo=function(){return this._applicableTo},l.prototype.cssClass=function(){return this._cssClass},l.prototype.name=function(){return this._name},l})(),m.ToolShelf=(function(){function l(){}return l._tools={},l.stow=function(e,t){return this._tools[t]=e},l.fetch=function(e){if(!this._tools[e])throw new Error("`"+e+"` has not been stowed on the tool shelf");return this._tools[e]},l})(),m.Tool=(function(){function l(){}return l.label="Tool",l.icon="tool",l.requiresElement=!0,l.canApply=function(e,t){return!1},l.isApplied=function(e,t){return!1},l.apply=function(e,t,n){throw new Error("Not implemented")},l.editor=function(){return m.EditorApp.get()},l.dispatchEditorEvent=function(e,t){return this.editor().dispatchEvent(this.editor().createEvent(e,t))},l._insertAt=function(e){var t,n;return n=e,n.parent().type()!=="Region"&&(n=e.closest(function(i){return i.parent().type()==="Region"})),t=n.parent().children.indexOf(n)+1,[n,t]},l})(),m.Tools.Bold=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"bold"),e.label="Bold",e.icon="bold",e.tagName="b",e.canApply=function(t,n){return!!t.content&&n&&!n.isCollapsed()},e.isApplied=function(t,n){var i,o,r;return!(t.content===void 0||!t.content.length())&&(r=n.get(),i=r[0],o=r[1],i===o&&(o+=1),t.content.slice(i,o).hasTags(this.tagName,!0))},e.apply=function(t,n,i){var o,r,s,a;if(s={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",s))return t.storeState(),a=n.get(),o=a[0],r=a[1],this.isApplied(t,n)?t.content=t.content.unformat(o,r,new HTMLString.Tag(this.tagName)):t.content=t.content.format(o,r,new HTMLString.Tag(this.tagName)),t.content.optimize(),t.updateInnerHTML(),t.taint(),t.restoreState(),i(!0),this.dispatchEditorEvent("tool-applied",s)},e})(m.Tool),m.Tools.Italic=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"italic"),e.label="Italic",e.icon="italic",e.tagName="i",e})(m.Tools.Bold),m.Tools.Link=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"link"),e.label="Link",e.icon="link",e.tagName="a",e.getAttr=function(t,n,i){var o,r,s,a,u,p,g,E,T,x,L,R;if(n.type()==="Image"){if(n.a)return n.a[t]}else{if(n.isFixed()&&n.tagName()==="a")return n.attr(t);for(x=i.get(),r=x[0],u=x[1],s=n.content.slice(r,u),L=s.characters,p=0,E=L.length;p<E;p++)if(o=L[p],o.hasTags("a")){for(R=o.tags(),g=0,T=R.length;g<T;g++)if(a=R[g],a.name()==="a")return a.attr(t)}}return""},e.canApply=function(t,n){var i;return t.type()==="Image"||!(!t.isFixed()||t.tagName()!=="a")||!!t.content&&!!n&&!!(!n.isCollapsed()||(i=t.content.characters[n.get()[0]])&&i.hasTags("a"))}
25,e.isApplied=function(t,n){return t.type()==="Image"?t.a:!(!t.isFixed()||t.tagName()!=="a")||e.__super__.constructor.isApplied.call(this,t,n)},e.apply=function(t,n,i){var o,r,s,a,u,p,g,E,T,x,L,R,U,H,C,h,d,_;if(h={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",h)){if(r=!1,t.type()==="Image")x=t.domElement().getBoundingClientRect();else if(t.isFixed()&&t.tagName()==="a")x=t.domElement().getBoundingClientRect();else{if(n.isCollapsed()){for(s=t.content.characters,H=n.get(0)[0],p=H;H>0&&s[H-1].hasTags("a");)H-=1;for(;p<s.length&&s[p].hasTags("a");)p+=1;n=new ContentSelect.Range(H,p),n.select(t.domElement())}t.storeState(),U=new HTMLString.Tag("span",{class:"ct--pseudo-select"}),d=n.get(),g=d[0],C=d[1],t.content=t.content.format(g,C,U),t.updateInnerHTML(),u=t.domElement(),E=u.getElementsByClassName("ct--pseudo-select"),x=E[0].getBoundingClientRect()}return o=m.EditorApp.get(),T=new m.ModalUI(!0,!0),T.addEventListener("click",function(){if(this.unmount(),a.hide(),t.content&&(t.content=t.content.unformat(g,C,U),t.updateInnerHTML(),t.restoreState()),i(r),r)return m.Tools.Link.dispatchEditorEvent("tool-applied",h)}),a=new m.LinkDialog(this.getAttr("href",t,n),this.getAttr("target",t,n)),_=m.getScrollPosition(),L=_[0],R=_[1],a.position([x.left+x.width/2+L,x.top+x.height/2+R]),a.addEventListener("save",function(f){var y,S,M,A,k,B,P,F,V,z,K,X,Y,Z,J,ot;if(A=f.detail(),r=!0,t.type()==="Image"){if(S=["align-center","align-left","align-right"],A.href){for(t.a={href:A.href},A.target&&(t.a.target=A.target),V=0,Y=S.length;V<Y;V++)if(M=S[V],t.hasCSSClass(M)){t.removeCSSClass(M),t.a.class=M;break}}else{for(P=[],t.a.class&&(P=t.a.class.split(" ")),z=0,Z=S.length;z<Z;z++)if(M=S[z],P.indexOf(M)>-1){t.addCSSClass(M);break}t.a=null}t.unmount(),t.mount()}else if(t.isFixed()&&t.tagName()==="a")t.attr("href",A.href);else{for(k=null,B=K=g;g<=C?K<C:K>C;B=g<=C?++K:--K){for(ot=t.content.characters[B].tags(),X=0,J=ot.length;X<J;X++)if(F=ot[X],F.name()==="a"){k=F;break}if(k)break}t.content=t.content.unformat(g,C,"a"),A.href&&(y=k?k.copy():new HTMLString.Tag("a"),y.attr("href",A.href),A.target?y.attr("target",A.target):y.removeAttr("target"),console.log(y),t.content=t.content.format(g,C,y),t.content.optimize()),t.updateInnerHTML()}return t.taint(),T.dispatchEvent(T.createEvent("click"))}),o.attach(T),o.attach(a),T.show(),a.show()}},e})(m.Tools.Bold),m.Tools.Heading=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"heading"),e.label="Heading",e.icon="heading",e.tagName="h1",e.canApply=function(t,n){return!t.isFixed()&&t.content!==void 0&&["Text","PreText"].indexOf(t.type())!==-1},e.isApplied=function(t,n){return!!t.content&&["Text","PreText"].indexOf(t.type())!==-1&&t.tagName()===this.tagName},e.apply=function(t,n,i){var o,r,s,a,u;if(u={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",u))return t.storeState(),t.type()==="PreText"?(o=t.content.html().replace(/ /g," "),a=new ContentEdit.Text(this.tagName,{},o),s=t.parent(),r=s.children.indexOf(t),s.detach(t),s.attach(a,r),t.blur(),a.focus(),a.selection(n)):(t.removeAttr("class"),t.tagName()===this.tagName?t.tagName("p"):t.tagName(this.tagName),t.restoreState()),this.dispatchEditorEvent("tool-applied",u),i(!0)},e})(m.Tool),m.Tools.Subheading=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"subheading"),e.label="Subheading",e.icon="subheading",e.tagName="h2",e})(m.Tools.Heading),m.Tools.Paragraph=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"paragraph"),e.label="Paragraph",e.icon="paragraph",e.tagName="p",e.canApply=function(t,n){return!t.isFixed()&&t!==void 0},e.apply=function(t,n,i){var o,r,s,a;return o=this.editor().ctrlDown(),m.Tools.Heading.canApply(t)&&!o?e.__super__.constructor.apply.call(this,t,n,i):(a={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",a)?(t.parent().type()!=="Region"&&(t=t.closest(function(u){return u.parent().type()==="Region"})),s=t.parent(),r=new ContentEdit.Text("p"),s.attach(r,s.children.indexOf(t)+1),r.focus(),i(!0),this.dispatchEditorEvent("tool-applied",a)):void 0)},e})(m.Tools.Heading),m.Tools.Preformatted=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"preformatted"),e.label="Preformatted",e.icon="preformatted",e.tagName="pre",e.apply=function(t,n,i){var o,r,s,a,u;if(u={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",u))return t.type()==="PreText"?void m.Tools.Paragraph.apply(t,n,i):(a=t.content.text(),s=new ContentEdit.PreText("pre",{},HTMLString.String.encode(a)),r=t.parent(),o=r.children.indexOf(t),r.detach(t),r.attach(s,o),t.blur(),s.focus(),s.selection(n),i(!0),this.dispatchEditorEvent("tool-applied",u))},e})(m.Tools.Heading),m.Tools.AlignLeft=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"align-left"),e.label="Align left",e.icon="align-left",e.className="text-left",e.canApply=function(t,n){return t.content!==void 0},e.isApplied=function(t,n){var i;return!!this.canApply(t)&&((i=t.type())!=="ListItemText"&&i!=="TableCellText"||(t=t.parent()),t.hasCSSClass(this.className))},e.apply=function(t,n,i){var o,r,s,a,u,p;if(s={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",s)){for((p=t.type())!=="ListItemText"&&p!=="TableCellText"||(t=t.parent()),o=[m.Tools.AlignLeft.className,m.Tools.AlignCenter.className,m.Tools.AlignRight.className],a=0,u=o.length;a<u;a++)if(r=o[a],t.hasCSSClass(r)&&(t.removeCSSClass(r),r===this.className))return i(!0);return t.addCSSClass(this.className),i(!0),this.dispatchEditorEvent("tool-applied",s)}},e})(m.Tool),m.Tools.AlignCenter=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"align-center"),e.label="Align center",e.icon="align-center",e.className="text-center",e})(m.Tools.AlignLeft),m.Tools.AlignRight=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"align-right"),e.label="Align right",e.icon="align-right",e.className="text-right",e})(m.Tools.AlignLeft),m.Tools.UnorderedList=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"unordered-list"),e.label="Bullet list",e.icon="unordered-list",e.listTag="ul",e.canApply=function(t,n){var i;return!t.isFixed()&&t.content!==void 0&&((i=t.parent().type())==="Region"||i==="ListItem")},e.apply=function(t,n,i){var o,r,s,a,u,p;if(p={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",p))return t.parent().type()==="ListItem"?(t.storeState(),r=t.closest(function(g){return g.type()==="List"}),r.tagName(this.listTag),t.restoreState()):(a=new ContentEdit.ListItemText(t.content.copy()),s=new ContentEdit.ListItem,s.attach(a),r=new ContentEdit.List(this.listTag,{}),r.attach(s),u=t.parent(),o=u.children.indexOf(t),u.detach(t),u.attach(r,o),a.focus(),a.selection(n)),i(!0),this.dispatchEditorEvent("tool-applied",p)},e})(m.Tool),m.Tools.OrderedList=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"ordered-list"),e.label="Numbers list",e.icon="ordered-list",e.listTag="ol",e})(m.Tools.UnorderedList),m.Tools.Table=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"table"),e.label="Table",e.icon="table",e.canApply=function(t,n){return!t.isFixed()&&t!==void 0},e.apply=function(t,n,i){var o,r,s,a,u;if(u={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",u))return t.storeState&&t.storeState(),o=m.EditorApp.get(),s=new m.ModalUI,a=t.closest(function(p){return p&&p.type()==="Table"}),r=new m.TableDialog(a),r.addEventListener("cancel",(function(p){return function(){return s.hide(),r.hide(),t.restoreState&&t.restoreState(),i(!1)}})()),r.addEventListener("save",(function(p){return function(g){var E,T,x,L,R;return L=g.detail(),T=!0,a?(p._updateTable(L,a),T=t.closest(function(U){return U&&U.type()==="Table"})):(a=p._createTable(L),R=p._insertAt(t),x=R[0],E=R[1],x.parent().attach(a,E),T=!1),T?t.restoreState():a.firstSection().children[0].children[0].children[0].focus(),s.hide(),r.hide(),i(!0),p.dispatchEditorEvent("tool-applied",u)}})(this)),o.attach(s),o.attach(r),s.show(),r.show()},e._adjustColumns=function(t,n){var i,o,r,s,a,u,p,g,E,T,x;for(T=t.children,x=[],g=0,E=T.length;g<E;g++)p=T[g],o=p.children[0].tagName(),s=p.children.length,a=n-s,a<0?x.push((function(){var L,R;for(R=[],u=L=a;a<=0?L<0:L>0;u=a<=0?++L:--L)i=p.children[p.children.length-1],R.push(p.detach(i));return R})()):a>0?x.push((function(){var L,R;for(R=[],u=L=0;0<=a?L<a:L>a;u=0<=a?++L:--L)i=new ContentEdit.TableCell(o),p.attach(i),r=new ContentEdit.TableCellText(""),R.push(i.attach(r));return R})()):x.push(void 0);return x},e._createTable=function(t){var n,i,o,r;return r=new ContentEdit.Table,t.head&&(o=this._createTableSection("thead","th",t.columns),r.attach(o)),n=this._createTableSection("tbody","td",t.columns),r.attach(n),t.foot&&(i=this._createTableSection("tfoot","td",t.columns),r.attach(i)),r},e._createTableSection=function(t,n,i){var o,r,s,a,u;for(a=new ContentEdit.TableSection(t),s=new ContentEdit.TableRow,a.attach(s),u=0;0<=i?u<i:u>i;0<=i?++u:--u)o=new ContentEdit.TableCell(n),s.attach(o),r=new ContentEdit.TableCellText(""),o.attach(r);return a},e._updateTable=function(t,n){var i,o,r,s,a,u,p;if(!t.head&&n.thead()&&n.detach(n.thead()),!t.foot&&n.tfoot()&&n.detach(n.tfoot()),i=n.firstSection().children[0].children.length,t.columns!==i)for(p=n.children,a=0,u=p.length;a<u;a++)s=p[a],this._adjustColumns(s,t.columns);if(t.head&&!n.thead()&&(r=this._createTableSection("thead","th",t.columns),n.attach(r,0)),t.foot&&!n.tfoot())return o=this._createTableSection("tfoot","td",t.columns),n.attach(o)},e})(m.Tool),m.Tools.Indent=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"indent"),e.label="Indent",e.icon="indent",e.canApply=function(t,n){return t.parent().type()==="ListItem"&&t.parent().parent().children.indexOf(t.parent())>0},e.apply=function(t,n,i){var o;if(o={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",o))return t.parent().indent(),i(!0),this.dispatchEditorEvent("tool-applied",o)},e})(m.Tool),m.Tools.Unindent=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"unindent"),e.label="Unindent",e.icon="unindent",e.canApply=function(t,n){return t.parent().type()==="ListItem"},e.apply=function(t,n,i){var o;if(o={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",o))return t.parent().unindent(),i(!0),this.dispatchEditorEvent("tool-applied",o)},e})(m.Tool),m.Tools.LineBreak=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"line-break"),e.label="Line break",e.icon="line-break",e.canApply=function(t,n){return t.content},e.apply=function(t,n,i){var o,r,s,a,u;if(u={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",u))return r=n.get()[0]+1,a=t.content.substring(0,n.get()[0]),s=t.content.substring(n.get()[1]),o=new HTMLString.String("<br>",t.content.preserveWhitespace()),t.content=a.concat(o,s),t.updateInnerHTML(),t.taint(),n.set(r,r),t.selection(n),i(!0),this.dispatchEditorEvent("tool-applied",u)},e})(m.Tool),m.Tools.Image=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"image"),e.label="Image",e.icon="image",e.canApply=function(t,n){return!t.isFixed()||t.type()==="ImageFixture"}
25,e.apply=function(t,n,i){var o,r,s,a;if(a={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",a))return t.storeState&&t.storeState(),o=m.EditorApp.get(),s=new m.ModalUI,r=new m.ImageDialog,r.addEventListener("cancel",(function(u){return function(){return s.hide(),r.hide(),t.restoreState&&t.restoreState(),i(!1)}})()),r.addEventListener("save",(function(u){return function(p){var g,E,T,x,L,R,U,H;return g=p.detail(),L=g.imageURL,x=g.imageSize,T=g.imageAttrs,T||(T={}),T.height=x[1],T.src=L,T.width=x[0],t.type()==="ImageFixture"?t.src(L):(E=new ContentEdit.Image(T),H=u._insertAt(t),U=H[0],R=H[1],U.parent().attach(E,R),E.focus()),s.hide(),r.hide(),i(!0),u.dispatchEditorEvent("tool-applied",a)}})(this)),o.attach(s),o.attach(r),s.show(),r.show()},e})(m.Tool),m.Tools.Video=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"video"),e.label="Video",e.icon="video",e.canApply=function(t,n){return!t.isFixed()},e.apply=function(t,n,i){var o,r,s,a;if(a={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",a))return t.storeState&&t.storeState(),o=m.EditorApp.get(),s=new m.ModalUI,r=new m.VideoDialog,r.addEventListener("cancel",(function(u){return function(){return s.hide(),r.hide(),t.restoreState&&t.restoreState(),i(!1)}})()),r.addEventListener("save",(function(u){return function(p){var g,E,T,x,L,R;if(x=p.detail().url,x?(L=new ContentEdit.Video("iframe",{frameborder:0,height:m.DEFAULT_VIDEO_HEIGHT,src:x,width:m.DEFAULT_VIDEO_WIDTH}),R=u._insertAt(t),T=R[0],E=R[1],T.parent().attach(L,E),L.focus()):t.restoreState&&t.restoreState(),s.hide(),r.hide(),g=x!=="",i(g),g)return u.dispatchEditorEvent("tool-applied",a)}})(this)),o.attach(s),o.attach(r),s.show(),r.show()},e})(m.Tool),m.Tools.Undo=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"undo"),e.label="Undo",e.icon="undo",e.requiresElement=!1,e.canApply=function(t,n){var i;return i=m.EditorApp.get(),i.history&&i.history.canUndo()},e.apply=function(t,n,i){var o,r,s;if(s={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",s))return o=this.editor(),o.history.stopWatching(),r=o.history.undo(),o.revertToSnapshot(r),o.history.watch(),this.dispatchEditorEvent("tool-applied",s)},e})(m.Tool),m.Tools.Redo=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"redo"),e.label="Redo",e.icon="redo",e.requiresElement=!1,e.canApply=function(t,n){var i;return i=m.EditorApp.get(),i.history&&i.history.canRedo()},e.apply=function(t,n,i){var o,r,s;if(s={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",s))return o=m.EditorApp.get(),o.history.stopWatching(),r=o.history.redo(),o.revertToSnapshot(r),o.history.watch(),this.dispatchEditorEvent("tool-applied",s)},e})(m.Tool),m.Tools.Remove=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return D(e,l),m.ToolShelf.stow(e,"remove"),e.label="Remove",e.icon="remove",e.canApply=function(t,n){return!t.isFixed()},e.apply=function(t,n,i){var o,r,s,a,u;if(u={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",u)){if(o=this.editor(),t.blur(),t.nextContent()?t.nextContent().focus():t.previousContent()&&t.previousContent().focus(),!t.isMounted())return i(!0),void this.dispatchEditorEvent("tool-applied",u);switch(t.type()){case"ListItemText":o.ctrlDown()?(r=t.closest(function(p){return p.parent().type()==="Region"}),r.parent().detach(r)):t.parent().parent().detach(t.parent());break;case"TableCellText":o.ctrlDown()?(a=t.closest(function(p){return p.type()==="Table"}),a.parent().detach(a)):(s=t.parent().parent(),s.parent().detach(s));break;default:t.parent().detach(t)}return i(!0),this.dispatchEditorEvent("tool-applied",u)}},e})(m.Tool)}.call(yt)});q();q();q();var un=["Cropping"],dn=()=>({autoCrop:!1,fill:"#FFF",extraZoomOut:!0});function pn(c,m){c&1&&(G(0,"div",8)(1,"p",13),it(2,"images.text-2"),W()())}function mn(c,m){c&1&&dt(0,"td-loader")}function _n(c,m){if(c&1){let v=Ct();G(0,"div",9)(1,"div",14)(2,"em",15),nt("click",function(){tt(v),st();let w=Tt(8);return et(w.zoomOut())}),W(),G(3,"em",16),nt("click",function(){tt(v),st();let w=Tt(8);return et(w.zoomIn())}),W()(),G(4,"div",17)(5,"em",18),nt("click",function(){tt(v),st();let w=Tt(8);return et(w.clean())}),W()()()}}var en=(()=>{class c{constructor(v,b,w){this._dialogRef=w,this.scale=.2;let N=b.isMatched([oe.XSmall,oe.HandsetPortrait]);this.title=v&&v.title?v.title:"images.text-1",this.width=v&&v.width?v.width:N?window.innerWidth*.67:600,this.height=v&&v.height?v.height:N?250:337.5}close(v){this._dialogRef.close(v)}submit(){this.cropAndClose=!0,this.cropping.crop()}onCropped(v){this.cropAndClose&&this.close(v.dataURL)}onError(v){console.log(v)}static{this.\u0275fac=function(b){return new(b||c)(j(Ke),j(Oe),j(qe))}}static{this.\u0275cmp=Dt({type:c,selectors:[["ng-component"]],viewQuery:function(b,w){if(b&1&&At(un,5),b&2){let N;Nt(N=Ot())&&(w.cropping=N.first)}},standalone:!1,decls:17,vars:9,consts:[["Cropping","tdImageCropper"],[1,"container","mx-auto","h-full","flex","flex-col","justify-between","bg-white","rounded-lg"],[1,"flex","justify-between","items-center","px-3","md:px-4","pb-2","text-blue-grey","border-b","pt-4"],["l10nTranslate","",1,"text-xl"],[1,"ai","ai-close","text-xl","cursor-pointer",3,"click"],[1,"mt-3"],[1,"td-image-dialog-cropper-container","relative","mx-auto","mb-3"],["type","image/jpeg",1,"td-image-dialog-cropper","block","overflow-hidden","rounded",3,"scaleChange","cropped","loaded","error","width","height","config","scale"],[1,"w-full","h-full","border","border-dashed","border-cyan","flex","justify-center","items-center","rounded","border-2"],[1,"td-image-dialog-cropper-options","absolute"],[1,"flex","flex-wrap","justify-center"],["l10nTranslate","",1,"btn","btn-flat-blue-black","btn-md","btn-100","mx-3","my-2",3,"click"],["l10nTranslate","",1,"btn","btn-contained-deep-purple","btn-md","btn-100","mx-3","my-2",3,"click","disabled"],["l10nTranslate","",1,"m-0","font-bold","text-blue-grey","text-center"],[1,"td-image-dialog-cropper-option","rounded","bg-white","flex","flex-col","p-1","mb-2"],[1,"ai","ai-square-minus","cursor-pointer","text-xl","text-blue-grey","mb-2",3,"click"],[1,"ai","ai-square-plus","cursor-pointer","text-xl","text-blue-grey",3,"click"],[1,"td-image-dialog-cropper-option","rounded","bg-white","flex","flex-col","p-1"],[1,"ai","ai-tras
25h","cursor-pointer","text-xl","text-blue-grey",3,"click"]],template:function(b,w){if(b&1){let N=Ct();G(0,"div",1)(1,"div",2)(2,"h5",3),it(3),W(),G(4,"em",4),nt("click",function(){return tt(N),et(w.close())}),W()(),G(5,"div",5)(6,"div",6)(7,"td-image-cropper",7,0),ve("scaleChange",function(I){return tt(N),fe(w.scale,I)||(w.scale=I),et(I)}),nt("cropped",function(I){return tt(N),et(w.onCropped(I))})("loaded",function(){return tt(N),et(w.loadImage=!0)})("error",function(I){return tt(N),et(w.onError(I))}),ct(9,pn,3,0,"div",8)(10,mn,1,0,"td-loader"),W(),ct(11,_n,6,0,"div",9),W()(),G(12,"div",10)(13,"button",11),nt("click",function(){return tt(N),et(w.close())}),it(14,"actions.cancel"),W(),G(15,"button",12),nt("click",function(){return tt(N),et(w.submit())}),it(16,"actions.accept"),W()()()}if(b&2){let N=Tt(8);$(3),bt(w.title),$(4),ut("width",w.width)("height",w.height)("config",ye(8,dn)),ge("scale",w.scale),$(2),ht(w.loadImage?10:9),$(2),ht(N.isLoaded?11:-1),$(4),ut("disabled",!w.loadImage)}},dependencies:[Pt,zt,Ze],styles:[".td-image-dialog-cropper-container[_ngcontent-%COMP%], .td-image-dialog-cropper[_ngcontent-%COMP%]{max-width:560px;height:260px}@media(min-width:768px){.td-image-dialog-cropper-container[_ngcontent-%COMP%], .td-image-dialog-cropper[_ngcontent-%COMP%]{max-width:660px;height:360px}}.td-image-dialog-cropper-options[_ngcontent-%COMP%]{bottom:25px;right:30px}.td-image-dialog-cropper-option[_ngcontent-%COMP%]{background-color:#fffc;-webkit-box-shadow:0px 3px 6px 0px rgba(0,0,0,.16);-moz-box-shadow:0px 3px 6px 0px rgba(0,0,0,.16);box-shadow:0 3px 6px #00000029}"]})}}return c})();q();var nn=(()=>{class c{static{this.\u0275fac=function(b){return new(b||c)}}static{this.\u0275mod=Rt({type:c})}static{this.\u0275inj=Lt({imports:[kt,jt,Bt,Ft,Je]})}}return c})();q();q();q();q();var Wt=(()=>{class c{constructor(){this.id="td-image",this.label="Image",this.icon="image",this._dialog=lt(Vt)}register(){ContentTools.ToolShelf.stow(this,this.id)}canApply(){return!0}apply(v,b,w){this._dialog.open(en,{width:"700px",height:"520px"}).afterClosed().subscribe(D=>{if(!D)w(!1);else{let I=new Image;I.onload=()=>{let O=I.naturalWidth,l=I.naturalHeight;I.setAttribute("width",`${O}`),I.setAttribute("height",`${l}`);let e=ContentEdit.Image.fromDOMElement(I),t=ContentTools.EditorApp.get().regions().region_2_body,n,i=t?t.children.length:0;if(v){for(let o=0;o<i;o++)if(t.children[o].domElement()===v.domElement()){n=o+1;break}}if(t.attach(e,n),typeof n>"u"||n===i){let o=new ContentEdit.Text("p");t.attach(o,typeof n=="number"?n+1:void 0),o.focus()}},I.src=D,w(!0)}})}isApplied(){}static{this.\u0275fac=function(b){return new(b||c)}}static{this.\u0275prov=Mt({token:c,factory:c.\u0275fac})}}return c})();var Gt=(()=>{class c{set autosave(v){this._setAutoSave(v)}constructor(v,b,w,N,D){this._el=v,this._renderer=b,this._translate=w,this._imageTool=N,this._platform=D,this.saved=new ee,this.changed=new ee}ngAfterViewInit(){this._platform.isBrowser&&(this._init("*[data-editable]","data-name",v=>v.hasAttribute("data-fixture"),!1),this._setInitialContent(this.tdTextEditor),this._setTitleMaxLength())}ngOnDestroy(){this._stopAutoSave(),this.stop(!!this.autosave),this._translationSubs&&this._translationSubs.unsubscribe(),ContentEdit.Root.get().unbind("taint"),ContentEdit.Root.get().unbind("paste")}start(v){this._editor.syncRegions(v||this._defaultQuerySelector),this._editor.start(),this._editor.ignition()&&this._editor.ignition().state("editing")}
25stop(v=!0){this._editor.getState()==="editing"&&(this._editor.stop(v),this._editor.syncRegions(this._defaultQuerySelector),this._editor.ignition()&&this._editor.ignition().state("ready"))}save(v=!0){return this._editor.save(v)}focusNextRegion(v){let b=ContentTools.EditorApp.get().orderedRegions(),w=v?b.indexOf(v):b.length-2;if(w>=b.length-1)return;let N=b[w+1],D=null;for(let I of N.descendants())if(I.content!==void 0){D=I;break}if(D){D.focus(),D.selection(new ContentSelect.Range(0,0));return}ContentEdit.Root.get().trigger("next-region",N)}_init(v,b,w,N){this._imageTool.register(),this._editor=ContentTools.EditorApp.get(),ContentTools.DEFAULT_TOOLS=[["bold","italic","unordered-list"],["align-left","align-center","align-right"],["heading","subheading",this._imageTool.id],["undo","redo","remove"]],ContentEdit.TRIM_WHITESPACE=!0,ContentEdit.DEFAULT_MAX_ELEMENT_WIDTH=1200,ContentTools.CANCEL_MESSAGE=null,this._defaultQuerySelector=v,this._editor.init(v,b,w,N),this._overrideClipboardPasteHandler(),this._overrideCreatePlaceholderElement(),this._editor.addEventListener("saved",D=>this.saved.emit(D.detail().regions))}_refresh(){this._editor.syncRegions()}_setAutoSave(v){this._stopAutoSave(),this._autosaveInterval=setInterval(()=>!this.saving&&this._editor.save(!0),v)}_stopAutoSave(){this._autosaveInterval&&(clearInterval(this._autosaveInterval),this._autosaveInterval=null)}_setInitialContent(v){if(this.start(),v){let b=this._editor.regions();for(let w in b)this._editor._emptyRegionsAllowed=!0,w==="region_2_body"&&b[w].setContent(v),this._editor._emptyRegionsAllowed=!1}this._taintBinded||(this._taintBinded=!0,ContentEdit.Root.get().bind("taint",b=>this.changed.emit()))}_overrideCreatePlaceholderElement(){this._translationSubs=this._translate.onChange().subscribe(v=>{this._editor.createPlaceholderElement=N=>{if(N.domElement().getAttribute("data-name")==="region_2_body"){let D=this._translate.translate("classes.text-editor.hint-body",null);return new ContentEdit.Text("p",{"data-ce-placeholder":D},"")}};let b=this._el.nativeElement.querySelector('h1[data-name="region_1_title"]');if(b){let N=this._translate.translate("classes.text-editor.hint-title",null);b.setAttribute("data-ce-placeholder",N)}let w=this._el.nativeElement.querySelector('div[data-name="region_2_body"]');if(w){let N=w.querySelector("p[data-ce-placeholder]");if(N){let D=this._translate.translate("classes.text-editor.hint-body",null);N.setAttribute("data-ce-placeholder",D)}}})}_overrideClipboardPasteHandler(){ContentEdit.Root.get().unbind("paste",this._editor._handleClipboardPaste),ContentEdit.Root.get().bind("paste",(v,b)=>{if(!(!v||!v.domElement())){if(v.attr("data-max-length")){let w=b.clipboardData.getData("text/plain");this._editor.pasteText(v,w.substring(0,+v.attr("data-max-length")-v.content.characters.length));return}if(b.clipboardData){if(b.clipboardData){if(v.type()!=="PreText"&&b.clipboardData.getData("text/html")){let w=b.clipboardData.getData("text/html");w=w.replace(/<a([^>]*)>([^<]*)<\/a>/gim,"$2"),this._editor.pasteHTML(v,w)}else this._editor.pasteText(v,b.clipboardData.getData("text/plain"));return}window.clipboardData&&this._editor.pasteText(v,window.clipboardData.getData("TEXT"))}}})}_setTitleMaxLength(){let v=this._el.nativeElement.querySelector('h1[data-name="region_1_title"]');if(v){let b=[8,37,38,39,40];this._renderer.listen(v,"keydown",w=>{if(w.keyCode===13){w.preventDefault(),this.focusNextRegion();return}b.indexOf(w.keyCode)===-1&&w.target.innerText.length>+w.target.getAttribute("data-max-length")&&w.preventDefault()})}}static{this.\u0275fac=function(b){return new(b||c)(j(ue),j(pe),j(ze),j(Wt),j(ft))}}static{this.\u0275dir=me({type:c,selectors:[["","tdTextEditor",""]],inputs:{tdTextEditor:"tdTextEditor",saving:"saving",autosave:"autosave"},outputs:{saved:"saved",changed:"changed"},standalone:!1})}}return c})();var yn=c=>["/teacher",c,"edit"];function En(c,m){c&1&&(G(0,"em",9),it(1,"classes.edit.0056"),W())}function Cn(c,m){if(c&1&&(G(0,"em",10),it(1),W()),c&2){let v=st();$(),bt(v.errorMsg)}}function Tn(c,m){if(c&1&&(G(0,"em",9),it(1,"classes.edit.0057 "),G(2,"span"),it(3),ie(4,"date"),W()()),c&2){let v=st();$(3),bt(Te(4,1,v.resource.updated_at,"MMM d, yyyy h:mm a",null,v.locale.language))}}function bn(c,m){c&1&&dt(0,"td-loader",14)}function Sn(c,m){if(c&1){let v=Ct();G(0,"div",15)(1,"div",16)(2,"div",17),nt("saved",function(w){tt(v);let N=st();return et(N.saved(w))})("changed",function(){tt(v);
25let w=st();return et(w.askConfirmation=!0)}),dt(3,"h1",18),ie(4,"translate"),dt(5,"div",19),W()()()}if(c&2){let v=st();$(2),ut("saving",v.isCreatingResource||v.isUpdatingResource)("tdTextEditor",v.contentBody),$(),ut("innerHTML",v.contentTitle,de)("ngClass",v.alignTitle),_e("data-ce-placeholder",Ce(4,5,"classes.text-editor.hint-title",v.locale.language))}}var se=(()=>{class c{constructor(v,b,w,N,D,I,O,l,e,t,n,i){this.locale=v,this._store=b,this._actions=w,this._router=N,this._dialog=D,this._activeRoure=I,this._changeDetector=O,this._httpClient=l,this._lessonService=e,this._resourceService=t,this._assetsService=n,this._platform=i,this._titleRegExp=/<h1[^>]*td-title[^>]*>([\w|\W]*?(?=<\/h1))<\/h1>/gim,this.isCreatingResource=!1,this.isUpdatingResource=!1,this._destroyed$=new ce}ngOnInit(){if(this._platform.isBrowser){this.loading=!0;let{id:v,resourceId:b}=this._activeRoure.snapshot.params;this._lessonId=v,this._resourceId=b,b&&!this.resource&&this._loadResource(),this.resource={},this.confirmDialogConfig={type:re.Warning,icon:!0,title:"alerts.exit-unsaved.title",message:"alerts.exit-unsaved.message",close:{enabled:!0,label:"alerts.exit-unsaved.action-ok"},action:{enabled:!0,label:"alerts.exit-unsaved.action-cancel"}}}}ngAfterViewInit(){this._resourceId||(this.loading=!1,this._changeDetector.detectChanges())}ngOnDestroy(){this._destroyed$.next(!0),this._destroyed$.complete()}beforeUnload(v){this.askConfirmation&&(v.returnValue=!0)}close(){history.back()}saved(v){if(!this.askConfirmation)return;v.region_1_title&&(this._titleHtml=v.region_1_title),v.region_2_body&&(this._bodyHtml=v.region_2_body);let b=this._titleHtml?this._titleHtml.replace(/<h1[^>]*>([\w|\W]*)<\/h1>/gim,(D,I)=>I.replace(/<[^>]+>/g,"")).trim():void 0,w=` 26 ${this._prepareTitleToSave(this._titleHtml)} 27 ${this._bodyHtml?this._bodyHtml:""} 28 `.replace(/[ \n\r\t\f\xA0]+/g,D=>D===" "?" ":D.replace(/(^|\xA0+)[^\xA0]+/g,"$1 ")).replace(/<[^\/>][^>]*>[\s]*<\/[^>]+>/gim,"").replace(/<(\w+)[^>]*data-[^>]*>([^<]*)<\/[^>]+>/gim,"<$1>$2</$1>").trim();this.errorMsg=null;let N=this.resource.id>0;if(!(b||w)){this.errorMsg="classes.text-editor.errors.empty-doc";return}if(this.saving=!0,!N){this.isCreatingResource=!0,this._assetsService.uploadHTML(w).pipe(Et(({uri:D})=>this._lessonService.addResource(this._lessonId,{title:b,resource_type_id:6,time:20,asset_url:D}).pipe(rt(I=>this.askConfirmation=!1),rt(I=>this._resourceId=I.id),rt(I=>this.resource=I),rt(()=>this.isCreatingResource=!1),rt(I=>this._router.navigate(["/",this._lessonId,"document",I.id],{skipLocationChange:!0}))))).subscribe();return}this.isUpdatingResource=!0,this._assetsService.uploadHTML(w).pipe(Et(({uri:D})=>this._lessonService.updateResource(this._lessonId,this._resourceId,{title:b,time:20,asset_url:D}).pipe(rt(I=>this.askConfirmation=!1),rt(I=>this.resource=I),rt(()=>this.isUpdatingResource=!1),rt(I=>this._changeDetector.detectChanges())))).subscribe()}_loadResource(){this.loading=!0,this._resourceService.getById(this._resourceId).subscribe(v=>{this.resource=v,this._httpClient.get(v.asset_url,{responseType:"text"}).toPromise().then(b=>{this._prepareDisplayContent(v,b),this.loading=!1}).catch(()=>this._showLoadError()).finally(()=>this._changeDetector.detectChanges())})}_prepareDisplayContent(v,b){this._titleRegExp.lastIndex=0;let w=this._titleRegExp.exec(b);if(w)this._titleHtml=w[0],this.alignTitle=this._getCSSAlignmentClass(this._titleHtml),this.contentTitle=w[1];else{let N=v.title?v.title:"";this._titleHtml=`<h1 class="td-title">${N}</h1>`}this._bodyHtml=b.replace(this._titleRegExp,""),this.contentBody=this._bodyHtml}_getCSSAlignmentClass(v){return v.includes("text-center")?" text-center":v.includes("text-left")?" text-left":v.includes("text-right")?" text-right":""}_prepareTitleToSave(v){let b=`${v||""}`,w=this._getCSSAlignmentClass(b);this._titleRegExp.lastIndex=0;let N=this._titleRegExp.exec(b);return N?`<h1 class="td-title${w}">${N[1]}</h1>`:""}_showLoadError(){this._dialog.open(Qe,{width:"520px",height:"300px",disableClose:!0,data:{type:re.Error,icon:!0,title:"classes.text-editor.errors.loading.title",message:"classes.text-editor.errors.loading.message",close:{enabled:!0,label:"classes.text-editor.errors.loading.action-cancel"},action:{enabled:!0,label:"classes.text-editor.errors.loading.action-ok"}}}).afterClosed().subscribe(b=>{typeof b<"u"&&(b?this._loadResource():this._router.navigate(["../../"],{relativeTo:this._activeRoure}))})}static{this.\u0275fac=function(b){return new(b||c)(j(Be),j(Ut),j(De),j(Ht),j(Vt),j(Ie),j(be),j(we),j(Ue),j(Pe),j(He),j(ft))}}static{this.\u0275cmp=Dt({type:c,selectors:[["ng-component"]],viewQuery:function(b,w){if(b&1&&At(Gt,5),b&2){let N;Nt(N=Ot())&&(w.textEditor=N.first)}},hostBindings:function(b,w){b&1&&nt("beforeunload",function(D){return w.beforeUnload(D)},ne)("pagehide",function(D){return w.beforeUnload(D)},ne)},standalone:!1,decls:21,vars:8,consts:[[1,"bg-white","shadow"],[1,"btn-icon","btn-md","btn-flat-blue-black","mr-4","md:mr-0",3,"routerLink"],[1,"ai","ai-arrow-left","text-lg"],["l10nTranslate","",1,"text-xl","text-blue-grey","ml-4"],["src","assets/images/tomi-grey.png","alt","TOMi Digital",1,"hidden","md:block","mx-auto"],[1,"ml-4","md:ml-10"],[1,"w-full","md:py-10","bg-blue-grey-light-1","td-text-editor"],[1,"container","mx-auto","h-full","px-3","md:px-10","relative","md:rounded","md:border","bg-white"],[1,"flex","justify-between","items-center","py-4","text-blue-grey"],["l10nTranslate",""],["l10nTranslate","",1,"text-red"],[1,"flex","items-center"],["l10nTranslate","",1,"btn","btn-flat-blue-black",3,"click","disabled"],[1,"ai","ai-circle-close","text-xl","cursor-pointer","p-2","ml-2","text-blue-grey","hover:font-bold","focus:outline-none",3,"click"],["color","#3ea6df",1,"flex","h-full","absolute","
28inset-0"],[1,"flex","overflow-auto","td-text-editor-content"],[1,"w-full","h-pull"],["autosave","30000",1,"h-full",3,"saved","changed","saving","tdTextEditor"],["data-editable","","data-fixture","","data-name","region_1_title","data-max-length","60",1,"td-title","text-5xl","mb-10","border-b","text-break",3,"innerHTML","ngClass"],["data-editable","","data-name","region_2_body",1,"td-text-editor-body","td-html-viewer","td-html-viewer-document"]],template:function(b,w){b&1&&(G(0,"td-toolbar",0)(1,"a",1),dt(2,"em",2),W(),G(3,"strong",3),it(4,"classes.edit.0015"),W(),dt(5,"img",4)(6,"td-apps-menu",5)(7,"td-avatar",5),W(),G(8,"div",6)(9,"div",7)(10,"div",8)(11,"div"),ct(12,En,2,0,"em",9),ct(13,Cn,2,1,"em",10),ct(14,Tn,5,6,"em",9),W(),G(15,"div",11)(16,"button",12),nt("click",function(){return w.textEditor.save()}),it(17,"actions.save"),W(),G(18,"em",13),nt("click",function(){return w.close()}),W()()(),ct(19,bn,1,0,"td-loader",14)(20,Sn,6,8,"div",15),W()()),b&2&&($(),ut("routerLink",Ee(6,yn,w._lessonId)),$(11),ht(w.isCreatingResource||w.isUpdatingResource?12:-1),$(),ht(!w.isCreatingResource&&!w.isUpdatingResource&&w.errorMsg?13:-1),$(),ht(!w.isCreatingResource&&!w.isUpdatingResource&&!w.errorMsg&&w.resource.updated_at?14:-1),$(2),ut("disabled",!w.askConfirmation),$(3),ht(w.loading?19:20))},dependencies:[Se,Pt,Me,zt,Ve,Xe,Ye,Gt,xe,Fe],styles:[`.ce-element--focused,.ce-element--over{background-color:#9fddf333}.ce-element--drop{position:relative}.ce-element--drop:before{background:#f0f3f4;border-top:2px dashed #9FB2B8}.ce-element--type-image{margin-top:16px;margin-bottom:16px;max-width:100%;max-height:500px}.ce-element--type-image.align-left,.ce-element--type-image.align-right{float:none}.ce-element--type-list{padding-left:16px;margin-bottom:16px;list-style-type:disc;list-style-position:inside}.ce-element--type-list-item-text{display:inline}.ce-element--type-pre-text{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}.ce-element--empty[data-td-title]:after{font-style:normal}.ct-inspector{display:none}.ct-widget.ct-toolbox{width:auto;padding:0;z-index:999;border-radius:5px;border:1px solid #9FB2B8;background:#ffffffe6;-webkit-box-shadow:0px 3px 6px 1px rgba(211,107,107,.16);-moz-box-shadow:0px 3px 6px 1px rgba(0,0,0,.16);box-shadow:0 3px 6px 1px #00000029}.ct-widget.ct-toolbox .ct-toolbox__grip{padding-bottom:0;margin-bottom:8px;background-color:#e3e8ea;border-top-left-radius:5px;border-top-right-radius:5px}.ct-widget.ct-toolbox .ct-toolbox__grip .ct-grip__bump{background:#9fb2b8}.ct-widget.ct-toolbox .ct-tool-group{display:flex;justify-content:center}.ct-widget .ct-tool{color:#0f3e4d;margin:0 4px}.ct-widget .ct-tool--time:before{content:"\\e94e"}.ct-widget .ct-tool--disabled{color:#9fb2b8}.ct-widget.ct-anchored-dialog{display:flex;align-items:center;border-radius:18px;background-color:#fff;border:1px solid #9FB2B8;-webkit-box-shadow:0px 3px 6px 1px rgba(211,107,107,.16);-moz-box-shadow:0px 3px 6px 1px rgba(0,0,0,.16);box-shadow:0 3px 6px 1px #00000029}.ct-widget.ct-anchored-dialog:after{display:none}.ct-widget .ct-anchored-dialog__input{flex:1;color:#333;padding-right:0;border-top-left-radius:18px;border-bottom-left-radius:18px}.ct-widget .ct-anchored-dialog__target-button{display:none}.ct-widget .ct-anchored-dialog__button{width:20px;height:20px;margin:0 12px;line-height:20px;font-size:12px;background:#fff;border:2px solid #0f3e4d;border-radius:50%;display:flex;justify-content:center;align-items:center}.ct-widget .ct-anchored-dialog__button:before{color:#0f3e4d}.ct-widget .ct-anchored-dialog__button:hover{font-size:13px;background:#fff;border-color:#071c22}.ct-widget.ct-dialog{border-radius:10px}.ct-widget.ct-image-dialog .ct-dialog__header{color:#395469}.ct-widget.ct-image-dialog .ct-dialog__caption{font-size:20px;font-family:Lato,sans-serif}.ct-widget.ct-image-dialog .ct-dialog__close{border:none}.ct-widget.ct-image-dialog .ct-dialog__controls{display:flex;justify-content:center}.ct-widget.ct-image-dialog .ct-control-group--left{display:none}.ct-widget.ct-image-dialog .ct-control--text{width:150px;height:38px;font-size:15px;line-height:38px;font-weight:400;border-radius:25px;font-family:Lato,sans-serif}.ct-widget.ct-image-dialog .ct-control--upload,.ct-widget.ct-image-dialog .ct-control--insert{margin-left:0;cursor:pointer;background-color:#a9d42d}.ct-widget.ct-image-dialog .ct-control--upload:hover,.ct-widget.ct-image-dialog .ct-control--insert:hover{background-color:#88ab23}.ct-widget.ct-image-dialog .ct-control--cancel,.ct-widget.ct-image-dialog .ct-control--clear{color:#0f3e4d;border:1px solid #0f3e4d;background-color:transparent}.ct-widget.ct-image-dialog .ct-control--cancel:hover,.ct-widget.ct-image-dialog .ct-control--clear:hover{color:#fff;border:1px solid #0f3e4d;background-color:#0f3e4d}.ce-drag-helper{width:auto;height:80px;max-width:500px;border:4px solid rgba(15,170,224,.4);-webkit-box-shadow:0px 3px 10px 1px rgba(211,107,107,.16);-moz-box-shadow:0px 3px 10px 1px rgba(0,0,0,.16);box-shadow:0 3px 10px 1px #00000029}.ce-drag-helper:before{display:none}.td-text-editor{height:calc(100vh - 60px)}.td-text-editor-content{height:calc(100% - 83px)}.td-text-editor-body h1.ce-element--focused,.td-text-editor-body h1.ce-element--over,.td-text-editor-body h2.ce-element--focused,.td-text-editor-body h2.ce-element--over{background-image:none;background-clip:border-box;-webkit-background-clip:border-box;-webkit-text-fill-color:currentColor} 29`],encapsulation:2,changeDetection:0})}}return c})();q();var xn="navigate_after_login",on=(()=>{class c{constructor(){this._localStorage=lt(Ne),this._authService=lt(ke),this._platform=lt(ft),this._router=lt(Ht),this._store=lt(Ut)}canActivate(v,b){let w=v.data.redirectTo||"/auth/login",N=v.data.profileTypes;return this._authService.ping().pipe(Et(D=>te(!0)),he(D=>(this._platform.isBrowser&&D?.status===401&&this._authService.getAccessToken()&&this._authService.logout(),this._localStorage.setItem(xn,b.url),this._router.navigate([w],{queryParamsHandling:"preserve"}),te(!1))))}static{this.\u0275fac=function(b){return new(b||c)}}static{this.\u0275prov=Mt({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var wn=[{path:"",canActivate:[on],data:{profileTypes:[Ae.Teacher]},children:[{path:"",component:se},{path:":resourceId",component:se}]}],rn=Le.forChild(wn);var oo=ln(sn());var ro=(()=>{class c{static{this.\u0275fac=function(b){return new(b||c)}}static{this.\u0275mod=Rt({type:c})}static{this.\u0275inj=Lt({providers:[Wt],imports:[Re,kt,We,jt,Bt,rn,Ft,je,nn,$e,Ge]})}}return c})();export{ro as TdTextEditorModule};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.