/** * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing **/ !function(){"use strict";function mimeToExt(mime){var mimes={"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png"};return mimes[mime.toLowerCase()]||"dat"}function create(o,blob,base64,filename){return toBlobInfo("object"==typeof o?o:{id:o,name:filename,blob:blob,base64:base64})}function toBlobInfo(o){var id,name;if(!o.blob||!o.base64)throw"blob and base64 representations of the image are required for BlobInfo to be created";return id=o.id||Uuid.uuid("blobid"),name=o.name||id,{id:constant(id),name:constant(name),filename:constant(name+"."+mimeToExt(o.blob.type)),blob:constant(o.blob),base64:constant(o.base64),blobUri:constant(o.blobUri||URL.createObjectURL(o.blob)),uri:constant(o.uri)}}function add(blobInfo){get(blobInfo.id())||cache.push(blobInfo)}function get(id){return findFirst(function(cachedBlobInfo){return cachedBlobInfo.id()===id})}function findFirst(predicate){return Arr.filter(cache,predicate)[0]}function getByUri(blobUri){return findFirst(function(blobInfo){return blobInfo.blobUri()==blobUri})}function removeByUri(blobUri){cache=Arr.filter(cache,function(blobInfo){return blobInfo.blobUri()!==blobUri||(URL.revokeObjectURL(blobInfo.blobUri()),!1)})}function destroy(){Arr.each(cache,function(cachedBlobInfo){URL.revokeObjectURL(cachedBlobInfo.blobUri())}),cache=[]}function blobUriToBlob(url){return new Promise(function(resolve,reject){var rejectWithError=function(){reject("Cannot convert "+url+" to Blob. Resource might not exist or is inaccessible.")};try{var xhr=new XMLHttpRequest;xhr.open("GET",url,!0),xhr.responseType="blob",xhr.onload=function(){200==this.status?resolve(this.response):rejectWithError()},xhr.onerror=rejectWithError,xhr.send()}catch(ex){rejectWithError()}})}function parseDataUri(uri){var type,matches;return uri=decodeURIComponent(uri).split(","),matches=/data:([^;]+)/.exec(uri[0]),matches&&(type=matches[1]),{type:type,data:uri[1]}}function dataUriToBlob(uri){return new Promise(function(resolve){var str,arr,i;uri=parseDataUri(uri);try{str=atob(uri.data)}catch(e){return void resolve(new Blob([]))}for(arr=new Uint8Array(str.length),i=0;i=534,self.suffix="",nl=doc.getElementsByTagName("base"),i=0;i=fn.length?fn.apply(this,args.slice(1)):function(){var tempArgs=args.concat([].slice.call(arguments));return tinymce.curry.apply(this,tempArgs)}},_addVer:function(u){var v;return this.query?(v=(u.indexOf("?")==-1?"?":"&")+this.query,u.indexOf("#")==-1?u+v:u.replace("#",v+"#")):u}};tinymce._init(),win.tinymce=win.tinyMCE=tinymce,tinymce.dom={},tinymce.geom={},tinymce.text={},tinymce.caret={},tinymce.html={},tinymce.ui={},tinymce.util={},tinymce.file={}}(window);var count=0,seed=function(){var rnd=function(){return Math.round(4294967295*Math.random()).toString(36)},now=(new Date).getTime();return"s"+now.toString(36)+rnd()+rnd()+rnd()},uuid=function(prefix){return prefix+count++ +seed()};tinymce.util.Uuid={uuid:uuid},function(tinymce){function requestAnimationFrame(callback,element){function featurefill(callback){window.setTimeout(callback,0)}var i,requestAnimationFrameFunc=window.requestAnimationFrame,vendors=["ms","moz","webkit"];for(i=0;i0?args:[listener.scope]),returnValue!==!1);i++);return self.inDispatch=!1,returnValue}}),function(tinymce){var each=tinymce.each,trim=tinymce.trim,queryParts="source protocol authority userInfo user password host port relative path directory file query anchor".split(" "),DEFAULT_PORTS={ftp:21,http:80,https:443,mailto:25};tinymce.create("tinymce.util.URI",{URI:function(url,settings){var baseUri,base_url,self=this;if(url=trim(url),settings=self.settings=settings||{},baseUri=settings.base_uri,/^([\w\-]+):([^\/]{2})/i.test(url)||/^\s*#/.test(url))return void(self.source=url);var isProtocolRelative=0===url.indexOf("//");0!==url.indexOf("/")||isProtocolRelative||(url=(baseUri?baseUri.protocol||"http":"http")+"://mce_host"+url),/^[\w\-]*:?\/\//.test(url)||(base_url=settings.base_uri?settings.base_uri.path:new tinymce.util.URI(location.href).directory,""===settings.base_uri.protocol?url="//mce_host"+self.toAbsPath(base_url,url):(url=/([^#?]*)([#?]?.*)/.exec(url),url=(baseUri&&baseUri.protocol||"http")+"://mce_host"+self.toAbsPath(base_url,url[1])+url[2])),url=url.replace(/@@/g,"(mce_at)"),url=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url),each(queryParts,function(v,i){var part=url[i];part&&(part=part.replace(/\(mce_at\)/g,"@@")),self[v]=part}),baseUri&&(self.protocol||(self.protocol=baseUri.protocol),self.userInfo||(self.userInfo=baseUri.userInfo),self.port||"mce_host"!==self.host||(self.port=baseUri.port),self.host&&"mce_host"!==self.host||(self.host=baseUri.host),self.source=""),isProtocolRelative&&(self.protocol="")},setPath:function(path){var self=this;path=/^(.*?)\/?(\w+)?$/.exec(path),self.path=path[0],self.directory=path[1],self.file=path[2],self.source="",self.getURI()},toRelative:function(uri){var output,self=this;if("./"===uri)return uri;if(uri=new tinymce.util.URI(uri,{base_uri:self}),"mce_host"!=uri.host&&self.host!=uri.host&&uri.host||self.port!=uri.port||self.protocol!=uri.protocol&&""!==uri.protocol)return uri.getURI();var tu=self.getURI(),uu=uri.getURI();return tu==uu||"/"==tu.charAt(tu.length-1)&&tu.substr(0,tu.length-1)==uu?tu:(output=self.toRelPath(self.path,uri.path),uri.query&&(output+="?"+uri.query),uri.anchor&&(output+="#"+uri.anchor),output)},toAbsolute:function(uri,noHost){return uri=new tinymce.util.URI(uri,{base_uri:this}),uri.getURI(noHost&&this.isSameOrigin(uri))},isSameOrigin:function(uri){if(this.host==uri.host&&this.protocol==uri.protocol){if(this.port==uri.port)return!0;var defaultPort=DEFAULT_PORTS[this.protocol];if(defaultPort&&(this.port||defaultPort)==(uri.port||defaultPort))return!0}return!1},toRelPath:function(base,path){var items,i,l,breakPoint=0,out="";if(base=base.substring(0,base.lastIndexOf("/")),base=base.split("/"),items=path.split("/"),base.length>=items.length)for(i=0,l=base.length;i=items.length||base[i]!=items[i]){breakPoint=i+1;break}if(base.length=base.length||base[i]!=items[i]){breakPoint=i+1;break}if(1===breakPoint)return path;for(i=0,l=base.length-(breakPoint-1);i=0;i--)0!==path[i].length&&"."!==path[i]&&(".."!==path[i]?nb>0?nb--:o.push(path[i]):nb++);return i=base.length-nb,outPath=i<=0?o.reverse().join("/"):base.slice(0,i).join("/")+"/"+o.reverse().join("/"),0!==outPath.indexOf("/")&&(outPath="/"+outPath),tr&&outPath.lastIndexOf("/")!==outPath.length-1&&(outPath+=tr),outPath},getURI:function(noProtoHost){var s,self=this;return self.source&&!noProtoHost||(s="",noProtoHost||(s+=self.protocol?self.protocol+"://":"//",self.userInfo&&(s+=self.userInfo+"@"),self.host&&(s+=self.host),self.port&&(s+=":"+self.port)),self.path&&(s+=self.path),self.query&&(s+="?"+self.query),self.anchor&&(s+="#"+self.anchor),self.source=s),self.source}}),tinymce.util.URI.parseDataUri=function(uri){var type,matches;return uri=decodeURIComponent(uri).split(","),matches=/data:([^;]+)/.exec(uri[0]),matches&&(type=matches[1]),{type:type,data:uri[1]}},tinymce.util.URI.getDocumentBaseUrl=function(loc){var baseUrl;return baseUrl=0!==loc.protocol.indexOf("http")&&"file:"!==loc.protocol?loc.href:loc.protocol+"//"+loc.host+loc.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(baseUrl)&&(baseUrl=baseUrl.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(baseUrl)||(baseUrl+="/")),baseUrl}}(tinymce),function(tinymce){tinymce.create("static tinymce.util.Storage",{getHash:function(n){var h,v=this.get(n);if(v)try{h=JSON.parse(v)}catch(e){}return h},setHash:function(n,v){this.set(n,JSON.stringify(v))},get:function(n,s){if(!window.sessionStorage)return null;var val=sessionStorage.getItem(n);return tinymce.is(val)&&null!=val?"true"===val||"false"!==val&&("null"===val?null:val):s},set:function(n,v){window.sessionStorage&&sessionStorage.setItem(n,v)}}),tinymce.create("static tinymce.util.Cookie",{getHash:function(n){return tinymce.util.Storage.getHash(n)},setHash:function(n,v){return tinymce.util.Storage.setHash(n,v)},get:function(n,s){return tinymce.util.Storage.get(n,s)},set:function(n,v){return tinymce.util.Storage.set(n,v)}})}(tinymce),function(tinymce){tinymce.util.JSON={serialize:function(obj){try{return JSON.stringify(obj)}catch(ex){}},parse:function(str){try{return JSON.parse(str)}catch(ex){}}}}(tinymce),tinymce.create("static tinymce.util.JSONP",{callbacks:{},count:0,send:function(o){var self=this,dom=tinymce.DOM,count=void 0!==o.count?o.count:this.count,id="tinymce_jsonp_"+count;this.callbacks[count]=function(json){dom.remove(id),delete self.callbacks[count],o.callback(json)},dom.add(dom.doc.body,"script",{id:id,src:o.url,type:"text/javascript"}),this.count++}}),tinymce.create("static tinymce.util.XHR",{send:function(o){function ready(){!o.async||4==xhr.readyState||c++>1e4?(o.success&&c<1e4&&200==xhr.status?o.success.call(o.success_scope,""+xhr.responseText,xhr,o):o.error&&o.error.call(o.error_scope,c>1e4?"TIMED_OUT":"GENERAL",xhr,o),xhr=null):window.setTimeout(ready,10)}var xhr,c=0;if(o.scope=o.scope||this,o.success_scope=o.success_scope||o.scope,o.error_scope=o.error_scope||o.scope,o.async=o.async!==!1,o.data=o.data||"",xhr=new XMLHttpRequest){if(xhr.overrideMimeType&&xhr.overrideMimeType(o.content_type),xhr.open(o.type||(o.data?"POST":"GET"),o.url,o.async),o.content_type&&xhr.setRequestHeader("Content-Type",o.content_type),xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),xhr.send(o.data),!o.async)return ready();window.setTimeout(ready,10)}}}),function(tinymce){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(s){this.settings=extend({},s),this.count=0},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o),o.success=function(c,x){c=JSON.parse(c),"undefined"==typeof c&&(c={error:"JSON Parse error."}),c.error?ecb.call(o.error_scope||o.scope,c.error,x):scb.call(o.success_scope||o.scope,c.result)},o.error=function(ty,x){ecb&&ecb.call(o.error_scope||o.scope,ty,x)},o.data=JSON.serialize({id:o.id||"c"+this.count++,method:o.method,params:o.params}),o.content_type="application/json",XHR.send(o)},static:{sendRPC:function(o){return(new tinymce.util.JSONRequest).send(o)}}})}(tinymce),function(tinymce){tinymce.VK={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,modifierPressed:function(e){return e.shiftKey||e.ctrlKey||e.altKey||this.metaKeyPressed(e)},metaKeyPressed:function(e){return tinymce.isMac?e.metaKey:e.ctrlKey&&!e.altKey}}}(tinymce),tinymce.util.Quirks=function(editor){function setEditorCommandState(cmd,state){try{editor.getDoc().execCommand(cmd,!1,state)}catch(ex){}}function isDefaultPrevented(e){return e.isDefaultPrevented()}function setMceInternalContent(e){var selectionHtml,internalContent;e.dataTransfer&&(editor.selection.isCollapsed()&&"IMG"==e.target.tagName&&selection.select(e.target),selectionHtml=editor.selection.getContent(),selectionHtml.length>0&&(internalContent=mceInternalUrlPrefix+escape(editor.id)+","+escape(selectionHtml),e.dataTransfer.setData(mceInternalDataType,internalContent)))}function getMceInternalContent(e){var internalContent;return e.dataTransfer&&(internalContent=e.dataTransfer.getData(mceInternalDataType),internalContent&&internalContent.indexOf(mceInternalUrlPrefix)>=0)?(internalContent=internalContent.substr(mceInternalUrlPrefix.length).split(","),{id:unescape(internalContent[0]),html:unescape(internalContent[1])}):null}function insertClipboardContents(content){editor.queryCommandSupported("mceInsertClipboardContent")?editor.execCommand("mceInsertClipboardContent",!1,{content:content}):editor.execCommand("mceInsertContent",!1,content)}function cleanupStylesWhenDeleting(){function isTrailingBr(node){var blockElements=dom.schema.getBlockElements(),rootNode=editor.getBody();if("BR"!=node.nodeName)return!1;for(;node!=rootNode&&!blockElements[node.nodeName];node=node.parentNode)if(node.nextSibling)return!1;return!0}function isSiblingsIgnoreWhiteSpace(node1,node2){var node;for(node=node1.nextSibling;node&&node!=node2;node=node.nextSibling)if((3!=node.nodeType||0!==tinymce.trim(node.data).length)&&node!==node2)return!1;return node===node2}function findCaretNode(node,forward,startNode){var walker,current,nonEmptyElements;if(dom.isChildOf(node,editor.getBody()))for(nonEmptyElements=dom.schema.getNonEmptyElements(),walker=new TreeWalker(startNode||node,node);current=walker[forward?"next":"prev"]();){if(nonEmptyElements[current.nodeName]&&!isTrailingBr(current))return current;if(3==current.nodeType&¤t.data.length>0)return current}}function deleteRangeBetweenTextBlocks(rng){var startBlock,endBlock,caretNodeBefore,caretNodeAfter,textBlockElements;if(!rng.collapsed&&(startBlock=dom.getParent(RangeUtils.getNode(rng.startContainer,rng.startOffset),dom.isBlock),endBlock=dom.getParent(RangeUtils.getNode(rng.endContainer,rng.endOffset),dom.isBlock),textBlockElements=editor.schema.getTextBlockElements(),startBlock!=endBlock&&textBlockElements[startBlock.nodeName]&&textBlockElements[endBlock.nodeName]&&"false"!==dom.getContentEditable(startBlock)&&"false"!==dom.getContentEditable(endBlock))){if(rng.deleteContents(),caretNodeBefore=findCaretNode(startBlock,!1),caretNodeAfter=findCaretNode(endBlock,!0),caretNodeBefore&&caretNodeAfter){if(!dom.isEmpty(endBlock)){var nodes=tinymce.toArray(endBlock.childNodes);each(nodes,function(node){node&&node.nodeType&&startBlock.appendChild(node)})}dom.remove(endBlock)}return each([startBlock,endBlock],function(node){dom.isEmpty(node)&&dom.remove(node)}),caretNodeBefore?1==caretNodeBefore.nodeType?"BR"==caretNodeBefore.nodeName?(rng.setStartBefore(caretNodeBefore),rng.setEndBefore(caretNodeBefore)):(rng.setStartAfter(caretNodeBefore),rng.setEndAfter(caretNodeBefore)):(rng.setStart(caretNodeBefore,caretNodeBefore.data.length),rng.setEnd(caretNodeBefore,caretNodeBefore.data.length)):caretNodeAfter&&(1==caretNodeAfter.nodeType?(rng.setStartBefore(caretNodeAfter),rng.setEndBefore(caretNodeAfter)):(rng.setStart(caretNodeAfter,0),rng.setEnd(caretNodeAfter,0))),selection.setRng(rng),!0}}function expandBetweenBlocks(rng,isForward){var caretNode,targetCaretNode,textBlock,targetTextBlock,container,offset;if(!rng.collapsed)return rng;if(container=rng.startContainer,offset=rng.startOffset,3==container.nodeType)if(isForward){if(offset0)return rng;caretNode=RangeUtils.getNode(container,offset),textBlock=dom.getParent(caretNode,dom.isBlock),targetCaretNode=findCaretNode(editor.getBody(),isForward,caretNode),targetTextBlock=dom.getParent(targetCaretNode,dom.isBlock);var isAfter=1===container.nodeType&&offset>container.childNodes.length-1;if(!caretNode||!targetCaretNode)return rng;if(targetTextBlock&&textBlock!=targetTextBlock)if(isForward){if(!isSiblingsIgnoreWhiteSpace(textBlock,targetTextBlock))return rng;1==caretNode.nodeType?"BR"==caretNode.nodeName?rng.setStartBefore(caretNode):rng.setStartAfter(caretNode):rng.setStart(caretNode,caretNode.data.length),1==targetCaretNode.nodeType?rng.setEnd(targetCaretNode,0):rng.setEndBefore(targetCaretNode)}else{if(!isSiblingsIgnoreWhiteSpace(targetTextBlock,textBlock))return rng;1==targetCaretNode.nodeType?"BR"==targetCaretNode.nodeName?rng.setStartBefore(targetCaretNode):rng.setStartAfter(targetCaretNode):rng.setStart(targetCaretNode,targetCaretNode.data.length),1==caretNode.nodeType&&isAfter?rng.setEndAfter(caretNode):rng.setEndBefore(caretNode)}return rng}function handleTextBlockMergeDelete(isForward){var rng=selection.getRng();if(rng=expandBetweenBlocks(rng,isForward),deleteRangeBetweenTextBlocks(rng))return!0}function handleLastBlockCharacterDelete(isForward,rng){function cloneTextBlockWithFormats(blockElm,node){return currentFormatNodes=dom.getParents(node,function(n){return!!editor.schema.getTextInlineElements()[n.nodeName]}),newBlockElm=blockElm.cloneNode(!1),currentFormatNodes=tinymce.map(currentFormatNodes,function(formatNode){return formatNode=formatNode.cloneNode(!1),newBlockElm.hasChildNodes()?(formatNode.appendChild(newBlockElm.firstChild),newBlockElm.appendChild(formatNode)):newBlockElm.appendChild(formatNode),newBlockElm.appendChild(formatNode),formatNode}),currentFormatNodes.length?(br=dom.create("br"),currentFormatNodes[0].appendChild(br),dom.replace(newBlockElm,blockElm),rng.setStartBefore(br),rng.setEndBefore(br),editor.selection.setRng(rng),br):null}function isTextBlock(node){return node&&editor.schema.getTextBlockElements()[node.tagName]}function NodePathCreate(rootNode,targetNode,normalized){for(var path=[];targetNode&&targetNode!=rootNode;targetNode=targetNode.parentNode)path.push(tinymce.DOM.nodeIndex(targetNode,normalized));return path}function NodePathResolve(rootNode,path){var i,node,children;for(node=rootNode,i=path.length-1;i>=0;i--){if(children=node.childNodes,path[i]>children.length-1)return null;node=children[path[i]]}return node}var path,blockElm,newBlockElm,clonedBlockElm,sibling,container,offset,br,currentFormatNodes;if(rng.collapsed&&(container=rng.startContainer,offset=rng.startOffset,blockElm=dom.getParent(container,dom.isBlock),isTextBlock(blockElm)))if(1==container.nodeType){if(container=container.childNodes[offset],container&&"BR"!=container.tagName)return;if(sibling=isForward?blockElm.nextSibling:blockElm.previousSibling,dom.isEmpty(blockElm)&&isTextBlock(sibling)&&dom.isEmpty(sibling)&&cloneTextBlockWithFormats(blockElm,container))return dom.remove(sibling),!0}else if(3==container.nodeType){if(path=NodePathCreate(blockElm,container),clonedBlockElm=blockElm.cloneNode(!0),container=NodePathResolve(clonedBlockElm,path),isForward){if(offset>=container.data.length)return;container.deleteData(offset,1)}else{if(offset<=0)return;container.deleteData(offset-1,1)}if(dom.isEmpty(clonedBlockElm))return cloneTextBlockWithFormats(blockElm,container)}}function customDelete(isForward){var mutationObserver,rng,caretElement;handleTextBlockMergeDelete(isForward)||(tinymce.each(editor.getBody().getElementsByTagName("*"),function(elm){"SPAN"==elm.tagName&&elm.setAttribute("mce-data-marked",1),!elm.hasAttribute("data-mce-style")&&elm.hasAttribute("style")&&editor.dom.setAttrib(elm,"style",editor.dom.getAttrib(elm,"style"))}),mutationObserver=new MutationObserver(function(){}),mutationObserver.observe(editor.getDoc(),{childList:!0,attributes:!0,subtree:!0,attributeFilter:["style"]}),editor.getDoc().execCommand(isForward?"ForwardDelete":"Delete",!1,null),rng=editor.selection.getRng(),caretElement=rng.startContainer.parentNode,tinymce.each(mutationObserver.takeRecords(),function(record){if(dom.isChildOf(record.target,editor.getBody())){if("style"==record.attributeName){var oldValue=record.target.getAttribute("data-mce-style");oldValue?record.target.setAttribute("style",oldValue):record.target.removeAttribute("style")}tinymce.each(record.addedNodes,function(node){if(1!==node.nodeType)return!0;if(node.getAttribute("style")&&!node.getAttribute("data-mce-style")&&node.removeAttribute("style"),"SPAN"==node.nodeName&&!node.getAttribute("mce-data-marked")){var offset,container;node==caretElement&&(offset=rng.startOffset,container=node.firstChild),dom.remove(node,!0),container&&(rng.setStart(container,offset),rng.setEnd(container,offset),editor.selection.setRng(rng))}})}}),mutationObserver.disconnect(),tinymce.each(editor.dom.select("span[mce-data-marked]"),function(span){span.removeAttribute("mce-data-marked")}))}function transactCustomDelete(isForward){customDelete(isForward),editor.undoManager.add()}var dragStartRng,doc=editor.getDoc(),dom=editor.dom,selection=editor.selection,MutationObserver=window.MutationObserver;editor.onKeyDown.add(function(editor,e){var isForward=e.keyCode==DELETE,isMetaOrCtrl=e.ctrlKey||e.metaKey;if(!isDefaultPrevented(e)&&(isForward||e.keyCode==BACKSPACE)){var rng=editor.selection.getRng(),container=rng.startContainer,offset=rng.startOffset;if(isForward&&e.shiftKey)return;if(handleLastBlockCharacterDelete(isForward,rng))return void e.preventDefault();if(!isMetaOrCtrl&&rng.collapsed&&3==container.nodeType&&(isForward?offset0))return;e.preventDefault(),isMetaOrCtrl&&editor.selection.getSel().modify("extend",isForward?"forward":"backward",e.metaKey?"lineboundary":"word"),customDelete(isForward)}}),editor.addCommand("Delete",function(){customDelete()}),editor.addCommand("ForwardDelete",function(){customDelete(!0)}),editor.dom.bind(editor.getBody(),"dragstart",function(e){dragStartRng=selection.getRng(),setMceInternalContent(e)}),editor.dom.bind(editor.getBody(),"drop",function(e){if(!isDefaultPrevented(e)){var internalContent=getMceInternalContent(e);internalContent&&(e.preventDefault(),setTimeout(function(){var pointRng=RangeUtils.getCaretRangeFromPoint(e.x,e.y,doc);dragStartRng&&(selection.setRng(dragStartRng),dragStartRng=null,transactCustomDelete()),selection.setRng(pointRng),insertClipboardContents(internalContent.html)},0))}})}function cleanupRuntimeStyles(){function removeRuntimeStyle(node){var style=node.attr("style");style&&(style=style.replace(/\s/g,""),"color:inherit;font-family:inherit;font-size:1rem;"===style&&node.unwrap())}editor.parser.addNodeFilter("span",function(nodes){for(var node,i=nodes.length;i--;)node=nodes[i],removeRuntimeStyle(node)}),editor.serializer.addNodeFilter("span",function(nodes){for(var node,i=nodes.length;i--;)node=nodes[i],removeRuntimeStyle(node)})}function emptyEditorWhenDeleting(){function serializeRng(rng){var body=dom.create("body"),contents=rng.cloneContents();return body.appendChild(contents),selection.serializer.serialize(body,{format:"html"})}function allContentsSelected(rng){if(!rng.setStart){if(rng.item)return!1;var bodyRng=rng.duplicate();return bodyRng.moveToElementText(editor.getBody()),RangeUtils.compareRanges(rng,bodyRng)}var selection=serializeRng(rng),allRng=dom.createRng();allRng.selectNode(editor.getBody());var allSelection=serializeRng(allRng);return selection===allSelection}editor.onKeyDown.add(function(editor,e){var isCollapsed,body,keyCode=e.keyCode;if(!isDefaultPrevented(e)&&(keyCode==DELETE||keyCode==BACKSPACE)){if(isCollapsed=editor.selection.isCollapsed(),body=editor.getBody(),isCollapsed&&!dom.isEmpty(body)){if(!tinymce.util.isFakeRoot(body.firstChild))return;if(tinymce.util.isFakeRoot(body.firstChild)&&!dom.isEmpty(body.firstChild))return}if(!isCollapsed&&!allContentsSelected(editor.selection.getRng()))return;e.preventDefault(),editor.setContent(""),body.firstChild&&dom.isBlock(body.firstChild)?editor.selection.setCursorLocation(body.firstChild,0):editor.selection.setCursorLocation(body,0),editor.nodeChanged()}})}function selectAll(){editor.onKeyDown.add(function(editor,e){!isDefaultPrevented(e)&&65==e.keyCode&&VK.metaKeyPressed(e)&&(e.preventDefault(),editor.execCommand("SelectAll"))})}function inputMethodFocus(){editor.settings.content_editable||dom.bind(editor.getDoc(),"mousedown mouseup",function(e){var rng;e.target==editor.getDoc().documentElement&&(rng=selection.getRng(),editor.getBody().focus(),"mousedown"==e.type?selection.placeCaretAt(e.clientX,e.clientY):selection.setRng(rng))})}function removeHrOnBackspace(){editor.onKeyDown.add(function(editor,e){if(!isDefaultPrevented(e)&&e.keyCode===BACKSPACE){if(!editor.getBody().getElementsByTagName("hr").length)return;if(selection.isCollapsed()&&0===selection.getRng(!0).startOffset){var node=selection.getNode(),previousSibling=node.previousSibling; if("HR"==node.nodeName)return dom.remove(node),void e.preventDefault();previousSibling&&previousSibling.nodeName&&"hr"===previousSibling.nodeName.toLowerCase()&&(dom.remove(previousSibling),e.preventDefault())}}})}function removeStylesWhenDeletingAcrossBlockElements(){function getAttributeApplyFunction(){var template=dom.getAttribs(selection.getStart().cloneNode(!1));return function(){var target=selection.getStart();target!==editor.getBody()&&(dom.setAttrib(target,"style",null),each(template,function(attr){target.setAttributeNode(attr.cloneNode(!0))}))}}function isSelectionAcrossElements(){return!selection.isCollapsed()&&dom.getParent(selection.getStart(),dom.isBlock)!=dom.getParent(selection.getEnd(),dom.isBlock)}editor.onKeyPress.add(function(editor,e){var applyAttributes;if(!isDefaultPrevented(e)&&(8==e.keyCode||46==e.keyCode)&&isSelectionAcrossElements())return applyAttributes=getAttributeApplyFunction(),editor.getDoc().execCommand("delete",!1,null),applyAttributes(),e.preventDefault(),!1}),dom.bind(editor.getDoc(),"cut",function(e){var applyAttributes;!isDefaultPrevented(e)&&isSelectionAcrossElements()&&(applyAttributes=getAttributeApplyFunction(),setTimeout(function(){applyAttributes()},0))})}function disableBackspaceIntoATable(){editor.onKeyDown.add(function(editor,e){if(!isDefaultPrevented(e)&&e.keyCode===BACKSPACE&&selection.isCollapsed()&&0===selection.getRng(!0).startOffset){var previousSibling=selection.getNode().previousSibling;if(previousSibling&&previousSibling.nodeName&&"table"===previousSibling.nodeName.toLowerCase())return e.preventDefault(),!1}})}function removeBlockQuoteOnBackSpace(){editor.onKeyDown.add(function(editor,e){var rng,container,offset,root,parent;if(!isDefaultPrevented(e)&&e.keyCode==VK.BACKSPACE&&(rng=selection.getRng(),container=rng.startContainer,offset=rng.startOffset,root=dom.getRoot(),parent=container,rng.collapsed&&0===offset)){for(;parent&&parent.parentNode&&parent.parentNode.firstChild==parent&&parent.parentNode!=root;)parent=parent.parentNode;"BLOCKQUOTE"===parent.tagName&&(editor.formatter.toggle("blockquote",null,parent),rng=dom.createRng(),rng.setStart(container,0),rng.setEnd(container,0),selection.setRng(rng))}})}function setGeckoEditingOptions(){function setOpts(){setEditorCommandState("StyleWithCSS",!1),setEditorCommandState("enableInlineTableEditing",!1),settings.object_resizing||setEditorCommandState("enableObjectResizing",!1)}settings.readonly||(editor.onBeforeExecCommand.add(setOpts),editor.onMouseDown.add(setOpts))}function addBrAfterLastLinks(){function fixLinks(){each(dom.select("a"),function(node){var parentNode=node.parentNode,root=dom.getRoot();if(parentNode.lastChild===node){for(;parentNode&&!dom.isBlock(parentNode);){if(parentNode.parentNode.lastChild!==parentNode||parentNode===root)return;parentNode=parentNode.parentNode}dom.add(parentNode,"br",{"data-mce-bogus":1})}})}editor.onExecCommand.add(function(editor,cmd){"mceInsertLink"===cmd&&fixLinks()}),editor.onSetContent.add(selection.onSetContent.add(fixLinks))}function setDefaultBlockType(){settings.forced_root_block&&editor.onInit.add(function(){setEditorCommandState("DefaultParagraphSeparator",settings.forced_root_block)})}function showBrokenImageIcon(){editor.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")}function restoreFocusOnKeyDown(){editor.onKeyDown.add(function(){document.activeElement==document.body&&editor.getWin().focus()})}function bodyHeight(){editor.inline||(editor.contentStyles.push("body {min-height: 150px}"),editor.onClick.add(function(editor,e){var rng;if("HTML"==e.target.nodeName){if(tinymce.isIE12)return void editor.getBody().focus();rng=editor.selection.getRng(),editor.getBody().focus(),editor.selection.setRng(rng),editor.selection.normalize(),editor.nodeChanged()}}))}function blockCmdArrowNavigation(){tinymce.isMac&&editor.onKeyDown.add(function(editor,e){!VK.metaKeyPressed(e)||e.shiftKey||37!=e.keyCode&&39!=e.keyCode||(e.preventDefault(),editor.selection.getSel().modify("move",37==e.keyCode?"backward":"forward","lineboundary"))})}function disableAutoUrlDetect(){setEditorCommandState("AutoUrlDetect",!1)}function tapLinksAndImages(){editor.onClick.add(function(editor,e){var elm=e.target;do if("A"===elm.tagName)return void e.preventDefault();while(elm=elm.parentNode)}),editor.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")}function blockFormSubmitInsideEditor(){editor.onInit.add(function(){editor.dom.bind(editor.getBody(),"submit",function(e){e.preventDefault()})})}function removeAppleInterchangeBrs(){parser.addNodeFilter("br",function(nodes){for(var i=nodes.length;i--;)"Apple-interchange-newline"==nodes[i].attr("class")&&nodes[i].remove()})}function ieInternalDragAndDrop(){editor.dom.bind("dragstart",function(e){setMceInternalContent(e)}),editor.dom.bind("dragstart",function(e){if(!isDefaultPrevented(e)){var internalContent=getMceInternalContent(e);if(internalContent&&internalContent.id!=editor.id){e.preventDefault();var rng=RangeUtils.getCaretRangeFromPoint(e.x,e.y,editor.getDoc());selection.setRng(rng),insertClipboardContents(internalContent.html)}}})}function imageFloatLinkBug(){editor.onBeforeExecCommand.add(function(ed,cmd){if("mceInsertLink"==cmd){var se=ed.selection,n=se.getNode();n&&"IMG"==n.nodeName&&(ed.dom.setAttrib(n,"data-mce-style",n.style.cssText),n.style.cssText=null)}}),editor.onExecCommand.add(function(ed,cmd){if("mceInsertLink"==cmd){var se=ed.selection,n=se.getNode();tinymce.each(ed.dom.select("img[data-mce-style]",n),function(el){"A"!=el.parentNode.nodeName||el.style.cssText||(el.style.cssText=ed.dom.getAttrib(el,"data-mce-style"))})}})}function selectControlElements(){editor.onClick.add(function(editor,e){function selectElm(e){e.preventDefault(),selection.select(target),editor.nodeChanged()}var target=e.target;/^(IMG|HR)$/.test(target.nodeName)&&selectElm(e),"A"==target.nodeName&&dom.hasClass(target,"mce-item-anchor")&&selectElm(e)})}function normalizeSelection(){var normalize=function(e){65==e.keyCode&&VK.metaKeyPressed(e)||selection.normalize()};editor.onKeyUp.add(normalize),editor.onMouseUp.add(normalize)}function inlineBoundary(){function isBr(node){return node&&1==node.nodeType&&"BR"==node.nodeName}function isRootNode(node){return node==editor.getBody()||tinymce.util.isFakeRoot(node)}function isLastChild(node){var parent=node.parentNode;return!!isRootNode(parent)||node==parent.lastChild||!(!node.nextSibling||!isBr(node.nextSibling)||node.nextSibling!=parent.lastChild)}function isEmpty(node){return isBr(node)||node&&3==node.nodeType&&/^[ \t\r\n]*$/.test(node.nodeValue)}function isChildOf(container,node){return node.lastChild&&1==node.lastChild.nodeType&&(node=node.lastChild),dom.isChildOf(container,node)}function moveCursorToEnd(e){function moveToMarker(){rng=dom.createRng(),rng.setStart(marker,0),rng.setEnd(marker,0),rng.collapse(),selection.setRng(rng)}var rng=selection.getRng(),container=rng.startContainer,node=container.parentNode;if(node&&node!=editor.getBody()&&(node=dom.getParent(node,"a"),node&&(isLastChild(node)||isEmpty(node.nextSibling))&&3==container.nodeType&&isChildOf(container,node))){var text=container.data;text&&text.length&&rng.startOffset==text.length&&(marker=dom.create("span",{"data-mce-type":"caret"},"\ufeff"),dom.isBlock(node.parentNode)&&isLastChild(node)?(node.parentNode.appendChild(marker),moveToMarker(),dom.remove(marker)):(isBr(node.nextSibling)&&node.nextSibling==node.parentNode.lastChild&&(node=node.nextSibling),node.insertAdjacentElement("afterend",marker),moveToMarker()),e.preventDefault(),editor.nodeChanged())}}var marker;editor.onKeyDown.addToTop(function(editor,e){dom.remove(marker),e.keyCode==VK.RIGHT&&moveCursorToEnd(e)}),editor.onMouseDown.add(function(editor,e){dom.remove(marker),moveCursorToEnd(e)})}var VK=tinymce.VK,BACKSPACE=VK.BACKSPACE,DELETE=VK.DELETE,dom=editor.dom,selection=editor.selection,settings=editor.settings,parser=editor.parser,each=tinymce.each,RangeUtils=tinymce.dom.RangeUtils,TreeWalker=tinymce.dom.TreeWalker,mceInternalUrlPrefix="data:text/mce-internal,",mceInternalDataType=tinymce.isIE?"Text":"URL";normalizeSelection(),removeBlockQuoteOnBackSpace(),emptyEditorWhenDeleting(),inlineBoundary(),tinymce.isWebKit&&(cleanupStylesWhenDeleting(),inputMethodFocus(),setDefaultBlockType(),blockFormSubmitInsideEditor(),disableBackspaceIntoATable(),removeAppleInterchangeBrs(),imageFloatLinkBug(),selectControlElements(),cleanupRuntimeStyles(),tinymce.isIOS?(restoreFocusOnKeyDown(),bodyHeight(),tapLinksAndImages()):selectAll()),tinymce.isIE&&(bodyHeight(),selectAll(),disableAutoUrlDetect(),ieInternalDragAndDrop()),tinymce.isIE>=11&&disableBackspaceIntoATable(),tinymce.isGecko&&(removeHrOnBackspace(),removeStylesWhenDeletingAcrossBlockElements(),setGeckoEditingOptions(),addBrAfterLastLinks(),showBrokenImageIcon(),blockCmdArrowNavigation(),disableBackspaceIntoATable(),selectControlElements())},function(tinymce){function getRGBA(val){if(!rgba[val]){var values,match,r=0,b=0,g=0,a=1;val.indexOf("#")!==-1?(val=val.substr(1),3===val.length&&(val+=val),r=parseInt(val.substring(0,2),16),g=parseInt(val.substring(2,4),16),b=parseInt(val.substring(4,6),16),val.length>6&&(a=parseInt(val.substring(6,8),16),a=+(a/255).toFixed(2))):(val=val.replace(/\s/g,""),match=/^(?:rgb|rgba)\(([^\)]*)\)$/.exec(val),match&&(values=match[1].split(",").map(function(x){return parseFloat(x)})),values&&(r=values[0],g=values[1],b=values[2],4===values.length&&(a=values[3]||1))),rgba[val]={r:r,g:g,b:b,a:a}}return rgba[val]}function getLuminance(val){if(!luma[val]){var RsRGB,GsRGB,BsRGB,R,G,B,col=getRGBA(val);RsRGB=col.r/255,GsRGB=col.g/255,BsRGB=col.b/255,R=RsRGB<=.03928?RsRGB/12.92:Math.pow((RsRGB+.055)/1.055,2.4),G=GsRGB<=.03928?GsRGB/12.92:Math.pow((GsRGB+.055)/1.055,2.4),B=BsRGB<=.03928?BsRGB/12.92:Math.pow((BsRGB+.055)/1.055,2.4),luma[val]=.2126*R+.7152*G+.0722*B}return luma[val]}function isReadable(color1,color2){var l1=getLuminance(color1),l2=getLuminance(color2),lvl=(Math.max(l1,l2)+.05)/(Math.min(l1,l2)+.05);return lvl>=2}var previewElm,each=tinymce.each,extend=tinymce.extend,rgba={},luma={},white="rgb(255, 255, 255)",resetElm=function(){previewElm&&previewElm.parentNode&&(previewElm.parentNode.removeChild(previewElm),previewElm=null)},getCssText=function(ed,fmt,reset){function removeVars(val){return val&&"string"==typeof val&&(val=val.replace(/%(\w+)/g,"")),val}var name,dom=ed.dom,previewCss={};fmt=extend({styles:[],attributes:[],classes:""},fmt);var previewStyles=ed.settings.preview_styles;if(previewStyles===!1)return"";previewStyles||(previewStyles="font-family font-size font-weight text-decoration text-transform background-color color"),name=fmt.block||fmt.inline||"div",previewElm&&previewElm.nodeName==name.toUpperCase()||(previewElm=dom.create(name),ed.getBody().appendChild(previewElm)),dom.removeAllAttribs(previewElm),each(fmt.styles,function(value,name){value=removeVars(value),value&&dom.setStyle(previewElm,name,value)}),each(fmt.attributes,function(value,name){value=removeVars(value),value&&dom.setAttrib(previewElm,name,value)}),each(fmt.classes,function(value){value=removeVars(value),dom.addClass(previewElm,value)}),dom.setStyles(previewElm,{position:"absolute",left:-65535}),previewElm.setAttribute("data-mce-type","temp");for(var bodybg=dom.getStyle(ed.getBody(),"background-color",!0),elmbg=dom.getStyle(previewElm,"background-color",!0),styles=previewStyles.split(" "),css="",i=0,len=styles.length;i-1}function forall(xs,pred){for(var i=0,len=xs.length;i=fn.length?fn.apply(this,args.slice(1)):function(){var tempArgs=args.concat([].slice.call(arguments));return curry.apply(this,tempArgs)}};tinymce.util.Fun={constant:constant,negate:negate,and:and,or:or,curry:curry,compose:compose,noop:noop}}(tinymce);var Arr=tinymce.util.Arr,Fun=tinymce.util.Fun,Uuid=tinymce.util.Uuid,cache=[],constant=Fun.constant;tinymce.file.BlobCache={create:create,add:add,get:get,getByUri:getByUri,findFirst:findFirst,removeByUri:removeByUri,destroy:destroy},tinymce.file.Conversions={uriToBlob:uriToBlob,blobToDataUri:blobToDataUri,parseDataUri:parseDataUri},function(tinymce){function nativeDecode(text){var elm;return elm=document.createElement("div"),elm.innerHTML=text,elm.textContent||elm.innerText||text}function buildEntitiesLookup(items,radix){var i,chr,entity,lookup={};if(items){for(items=items.split(","),radix=radix||10,i=0;i\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,textCharsRegExp=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,rawCharsRegExp=/[<>&\"\']/g,entityRegExp=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,asciiMap={128:"\u20ac",130:"\u201a",131:"\u0192",132:"\u201e",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02c6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017d",145:"\u2018",146:"\u2019",147:"\u201c",148:"\u201d",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02dc",153:"\u2122",154:"\u0161",155:"\u203a",156:"\u0153",158:"\u017e",159:"\u0178"};baseEntities={'"':""","'":"'","<":"<",">":">","&":"&","`":"`"},reverseEntities={"<":"<",">":">","&":"&",""":'"',"'":"'"},namedEntities=buildEntitiesLookup("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),tinymce.html=tinymce.html||{},tinymce.html.Entities={encodeRaw:function(text,attr){return text.replace(attr?attrsCharsRegExp:textCharsRegExp,function(chr){return baseEntities[chr]||chr})},encodeAllRaw:function(text){return(""+text).replace(rawCharsRegExp,function(chr){return baseEntities[chr]||chr})},encodeNumeric:function(text,attr){return text.replace(attr?attrsCharsRegExp:textCharsRegExp,function(chr){return chr.length>1?"&#"+(1024*(chr.charCodeAt(0)-55296)+(chr.charCodeAt(1)-56320)+65536)+";":baseEntities[chr]||"&#"+chr.charCodeAt(0)+";"})},encodeNamed:function(text,attr,entities){return entities=entities||namedEntities,text.replace(attr?attrsCharsRegExp:textCharsRegExp,function(chr){return baseEntities[chr]||entities[chr]||chr})},getEncodeFunc:function(name,entities){function encodeNamedAndNumeric(text,attr){return text.replace(attr?attrsCharsRegExp:textCharsRegExp,function(chr){return baseEntities[chr]||entities[chr]||"&#"+chr.charCodeAt(0)+";"||chr})}function encodeCustomNamed(text,attr){return Entities.encodeNamed(text,attr,entities)}var Entities=tinymce.html.Entities;return entities=buildEntitiesLookup(entities)||namedEntities,name=tinymce.makeMap(name.replace(/\+/g,",")),name.named&&name.numeric?encodeNamedAndNumeric:name.named?entities?encodeCustomNamed:Entities.encodeNamed:name.numeric?Entities.encodeNumeric:Entities.encodeRaw},decode:function(text){return text.replace(entityRegExp,function(all,numeric){return numeric?(numeric="x"===numeric.charAt(0).toLowerCase()?parseInt(numeric.substr(1),16):parseInt(numeric,10),numeric>65535?(numeric-=65536,String.fromCharCode(55296+(numeric>>10),56320+(1023&numeric))):asciiMap[numeric]||String.fromCharCode(numeric)):reverseEntities[all]||namedEntities[all]||nativeDecode(all)})}}}(tinymce),tinymce.html.Styles=function(settings,schema){function toHex(match,r,g,b){function hex(val){return val=parseInt(val,10).toString(16),val.length>1?val:"0"+val}return"#"+hex(r)+hex(g)+hex(b)}var undef,i,encodingItems,validStyles,invalidStyles,rgbRegExp=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,urlOrStrRegExp=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,styleRegExp=/\s*([^:]+):\s*([^;]+);?/g,trimRightRegExp=/\s+$/,encodingLookup={},invisibleChar="\ufeff";for(settings=settings||{},schema&&(validStyles=schema.getValidStyles(),invalidStyles=schema.getInvalidStyles()),encodingItems=("\\\" \\' \\; \\: ; : "+invisibleChar).split(" "),i=0;i-1&&noJoin||(styles[prefix+suffix]=i==-1?box[0]:box.join(" "),delete styles[prefix+"-top"+suffix],delete styles[prefix+"-right"+suffix],delete styles[prefix+"-bottom"+suffix],delete styles[prefix+"-left"+suffix])}}function canCompress(key){var i,value=styles[key];if(value){for(value=value.split(" "),i=value.length;i--;)if(value[i]!==value[0])return!1;return styles[key]=value[0],!0}}function compress2(target,a,b,c){canCompress(a)&&canCompress(b)&&canCompress(c)&&(styles[target]=styles[a]+" "+styles[b]+" "+styles[c],delete styles[a],delete styles[b],delete styles[c])}function encode(str){return isEncoded=!0,encodingLookup[str]}function decode(str,keep_slashes){return isEncoded&&(str=str.replace(/\uFEFF[0-9]/g,function(str){return encodingLookup[str]})),keep_slashes||(str=str.replace(/\\([\'\";:])/g,"$1")),str}function processUrl(match,url,url2,url3,str,str2){if(str=str||str2)return str=decode(str),"'"+str.replace(/\'/g,"\\'")+"'";if(url=decode(url||url2||url3),!settings.allow_script_urls){var scriptUrl=url.replace(/[\s\r\n]+/,"");if(/(java|vb)script:/i.test(scriptUrl))return"";if(!settings.allow_svg_data_urls&&/^data:image\/svg/i.test(scriptUrl))return""}return urlConverter&&(url=urlConverter.call(urlConverterScope,url,"style")),"url('"+url.replace(/\'/g,"\\'")+"')"}var matches,name,value,isEncoded,styles={},urlConverter=settings.url_converter,urlConverterScope=settings.url_converter_scope||this;if(css){for(css=css.replace(/[\u0000-\u001F]/g,""),css=css.replace(/\\[\"\';:\uFEFF]/g,encode).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(str){return str.replace(/[;:]/g,encode)});matches=styleRegExp.exec(css);){if(name=matches[1].replace(trimRightRegExp,"").toLowerCase(),value=matches[2].replace(trimRightRegExp,""),value=value.replace(/\\[0-9a-f]+/g,function(e){return String.fromCharCode(parseInt(e.substr(1),16))}),name&&value.length>0){if(!settings.allow_script_urls&&("behavior"==name||/expression\s*\(|\/\*|\*\//.test(value)))continue;"font-weight"===name&&"700"===value?value="bold":"color"!==name&&"background-color"!==name||(value=value.toLowerCase()),value=value.replace(rgbRegExp,toHex),value=value.replace(urlOrStrRegExp,processUrl),styles[name]=isEncoded?decode(value,!0):value}styleRegExp.lastIndex=matches.index+matches[0].length}compress("border","",!0),compress("border","-width"),compress("border","-color"),compress("border","-style"),compress("padding",""),compress("margin",""),compress2("border","border-width","border-style","border-color"),"medium none"===styles.border&&delete styles.border,"none"===styles["border-image"]&&delete styles["border-image"]}return styles},serialize:function(styles,elementName){function serializeStyles(name){var styleList,i,l,value;if(styleList=validStyles[name])for(i=0,l=styleList.length;i0&&(css+=(css.length>0?" ":"")+name+": "+value+";")}function isValid(name,elementName){var styleMap;return styleMap=invalidStyles["*"],!(styleMap&&styleMap[name]||(styleMap=invalidStyles[elementName],styleMap&&styleMap[name]))}var name,value,css="";if(elementName&&validStyles)serializeStyles("*"),serializeStyles(elementName);else for(name in styles)value=styles[name],value!==undef&&value.length>0&&(invalidStyles&&!isValid(name,elementName)||(css+=(css.length>0?" ":"")+name+": "+value+";"));return css}}},function(tinymce){function split(items,delim){return items?items.split(delim||" "):[]}function compileSchema(type){function add(name,attributes,children){function arrayToMap(array,obj){var i,l,map={};for(i=0,l=array.length;i