n&&t.charAt(n).isEqualTo(e.charAt(n));)n++;for(;i>n+1&&t.charAt(i-1).isEqualTo(e.charAt(r-1));)i--,r--;return{utf16String:t.slice(n,i),offset:n}}}.call(this),function(){o.extend({copyObject:function(t){var e,n,i;for(e in null==t&&(t={}),n={},t)i=t[e],n[e]=i;return n},objectsAreEqual:function(t,e){var n;if(null==t&&(t={}),null==e&&(e={}),Object.keys(t).length!==Object.keys(e).length)return!1;for(n in t)if(t[n]!==e[n])return!1;return!0}})}.call(this),function(){var t=[].slice;o.extend({arraysAreEqual:function(t,e){var n,i,r;if(null==t&&(t=[]),null==e&&(e=[]),t.length!==e.length)return!1;for(i=n=0,r=t.length;r>n;i=++n)if(t[i]!==e[i])return!1;return!0},arrayStartsWith:function(t,e){return null==t&&(t=[]),null==e&&(e=[]),o.arraysAreEqual(t.slice(0,e.length),e)},spliceArray:function(){var e,n,i;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],(i=n.slice(0)).splice.apply(i,e),i},summarizeArrayChange:function(t,e){var n,i,r,o,s,a,u,c,l,h,p;for(null==t&&(t=[]),null==e&&(e=[]),n=[],h=[],r=new Set,o=0,u=t.length;u>o;o++)p=t[o],r.add(p);for(i=new Set,s=0,c=e.length;c>s;s++)p=e[s],i.add(p),r.has(p)||n.push(p);for(a=0,l=t.length;l>a;a++)p=t[a],i.has(p)||h.push(p);return{added:n,removed:h}}})}.call(this),function(){var t,e,n,i;t=null,e=null,i=null,n=null,o.extend({getAllAttributeNames:function(){return null!=t?t:t=o.getTextAttributeNames().concat(o.getBlockAttributeNames())},getBlockConfig:function(t){return o.config.blockAttributes[t]},getBlockAttributeNames:function(){return null!=e?e:e=Object.keys(o.config.blockAttributes)},getTextConfig:function(t){return o.config.textAttributes[t]},getTextAttributeNames:function(){return null!=i?i:i=Object.keys(o.config.textAttributes)},getListAttributeNames:function(){var t,e;return null!=n?n:n=function(){var n,i;for(t in i=[],n=o.config.blockAttributes)null!=(e=n[t].listAttribute)&&i.push(e);return i}()}})}.call(this),function(){var t,e,n,i,r,s=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};t=document.documentElement,e=null!=(n=null!=(i=null!=(r=t.matchesSelector)?r:t.webkitMatchesSelector)?i:t.msMatchesSelector)?n:t.mozMatchesSelector,o.extend({handleEvent:function(e,n){var i,r,s,a,u,c,l,h,p,d,f;return u=(l=null!=n?n:{}).onElement,a=l.matchingSelector,f=l.withCallback,s=l.inPhase,c=l.preventDefault,p=l.times,i=null!=u?u:t,h=a,f,d="capturing"===s,r=function(t){var e;return null!=p&&0==--p&&r.destroy(),null!=(e=o.findClosestElementFromNode(t.target,{matchingSelector:h}))&&(null!=f&&f.call(e,t,e),c)?t.preventDefault():void 0},r.destroy=function(){return i.removeEventListener(e,r,d)},i.addEventListener(e,r,d),r},handleEventOnce:function(t,e){return null==e&&(e={}),e.times=1,o.handleEvent(t,e)},triggerEvent:function(e,n){var i,r,s,a,u,c,l;return c=(l=null!=n?n:{}).onElement,r=l.bubbles,s=l.cancelable,i=l.attributes,a=null!=c?c:t,r=!1!==r,s=!1!==s,(u=document.createEvent("Events")).initEvent(e,r,s),null!=i&&o.extend.call(u,i),a.dispatchEvent(u)},elementMatchesSelector:function(t,n){return 1===(null!=t?t.nodeType:void 0)?e.call(t,n):void 0},findClosestElementFromNode:function(t,e){var n,i,r;for(n=(i=null!=e?e:{}).matchingSelector,r=i.untilNode;null!=t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.parentNode;if(null!=t){if(null==n)return t;if(t.closest&&null==r)return t.closest(n);for(;t&&t!==r;){if(o.elementMatchesSelector(t,n))return t;t=t.parentNode}}},findInnerElement:function(t){for(;null!=t?t.firstElementChild:void 0;)t=t.firstElementChild;return t},innerElementIsActive:function(t){return document.activeElement!==t&&o.elementContainsNode(t,document.activeElement)},elementContainsNode:function(t,e){if(t&&e)for(;e;){if(e===t)return!0;e=e.parentNode}},findNodeFromContainerAndOffset:function(t,e){var n;if(t)return t.nodeType===Node.TEXT_NODE?t:0===e?null!=(n=t.firstChild)?n:t:t.childNodes.item(e-1)},findElementFromContainerAndOffset:function(t,e){var n;return n=o.findNodeFromContainerAndOffset(t,e),o.findClosestElementFromNode(n)},findChildIndexOfNode:function(t){var e;if(null!=t?t.parentNode:void 0){for(e=0;t=t.previousSibling;)e++;return e}},removeNode:function(t){var e;return null!=t&&null!=(e=t.parentNode)?e.removeChild(t):void 0},walkTree:function(t,e){var n,i,r,o,s;return i=(r=null!=e?e:{}).onlyNodesOfType,o=r.usingFilter,n=r.expandEntityReferences,s=function(){switch(i){case"element":return NodeFilter.SHOW_ELEMENT;case"text":return NodeFilter.SHOW_TEXT;case"comment":return NodeFilter.SHOW_COMMENT;default:return NodeFilter.SHOW_ALL}}(),document.createTreeWalker(t,s,null!=o?o:null,!0===n)},tagName:function(t){var e;return null!=t&&null!=(e=t.tagName)?e.toLowerCase():void 0},makeElement:function(t,e){var n,i,r,o,s,a,u,c,l,h,p,d,f,g;if(null==e&&(e={}),"object"==typeof t?t=(e=t).tagName:e={attributes:e},r=document.createElement(t),null!=e.editable&&(null==e.attributes&&(e.attributes={}),e.attributes.contenteditable=e.editable),e.attributes)for(a in l=e.attributes)g=l[a],r.setAttribute(a,g);if(e.style)for(a in h=e.style)g=h[a],r.style[a]=g;if(e.data)for(a in p=e.data)g=p[a],r.dataset[a]=g;if(e.className)for(o=0,u=(d=e.className.split(" ")).length;u>o;o++)i=d[o],r.classList.add(i);if(e.textContent&&(r.textContent=e.textContent),e.childNodes)for(s=0,c=(f=[].concat(e.childNodes)).length;c>s;s++)n=f[s],r.appendChild(n);return r},getBlockTagNames:function(){var t,e;return null!=o.blockTagNames?o.blockTagNames:o.blockTagNames=function(){var n,i;for(t in i=[],n=o.config.blockAttributes)(e=n[t].tagName)&&i.push(e);return i}()},nodeIsBlockContainer:function(t){return o.nodeIsBlockStartComment(null!=t?t.firstChild:void 0)},nodeProbablyIsBlockContainer:function(t){var e,n;return e=o.tagName(t),s.call(o.getBlockTagNames(),e)>=0&&(n=o.tagName(t.firstChild),s.call(o.getBlockTagNames(),n)<0)},nodeIsBlockStart:function(t,e){return(null!=e?e:{strict:!0}).strict?o.nodeIsBlockStartComment(t):o.nodeIsBlockStartComment(t)||!o.nodeIsBlockStartComment(t.firstChild)&&o.nodeProbablyIsBlockContainer(t)},nodeIsBlockStartComment:function(t){return o.nodeIsCommentNode(t)&&"block"===(null!=t?t.data:void 0)},nodeIsCommentNode:function(t){return(null!=t?t.nodeType:void 0)===Node.COMMENT_NODE},nodeIsCursorTarget:function(t,e){var n;return n=(null!=e?e:{}).name,t?o.nodeIsTextNode(t)?t.data===o.ZERO_WIDTH_SPACE?!n||t.parentNode.dataset.trixCursorTarget===n:void 0:o.nodeIsCursorTarget(t.firstChild):void 0},nodeIsAttachmentElement:function(t){return o.elementMatchesSelector(t,o.AttachmentView.attachmentSelector)},nodeIsEmptyTextNode:function(t){return o.nodeIsTextNode(t)&&""===(null!=t?t.data:void 0)},nodeIsTextNode:function(t){return(null!=t?t.nodeType:void 0)===Node.TEXT_NODE}})}.call(this),function(){var t,e,n,i,r;t=o.copyObject,i=o.objectsAreEqual,o.extend({normalizeRange:n=function(t){var n;if(null!=t)return Array.isArray(t)||(t=[t,t]),[e(t[0]),e(null!=(n=t[1])?n:t[0])]},rangeIsCollapsed:function(t){var e,i,o;if(null!=t)return o=(i=n(t))[0],e=i[1],r(o,e)},rangesAreEqual:function(t,e){var i,o,s,a,u,c;if(null!=t&&null!=e)return o=(s=n(t))[0],i=s[1],c=(a=n(e))[0],u=a[1],r(o,c)&&r(i,u)}}),e=function(e){return"number"==typeof e?e:t(e)},r=function(t,e){return"number"==typeof t?t===e:i(t,e)}}.call(this),function(){var t,e,n,i,r,s,a;o.registerElement=function(t,e){var n,o;return null==e&&(e={}),t=t.toLowerCase(),e=a(e),(n=(o=s(e)).defaultCSS)&&(delete o.defaultCSS,i(n,t)),r(t,o)},i=function(t,e){return n(e).textContent=t.replace(/%t/g,e)},n=function(e){var n,i;return(n=document.createElement("style")).setAttribute("type","text/css"),n.setAttribute("data-tag-name",e.toLowerCase()),(i=t())&&n.setAttribute("nonce",i),document.head.insertBefore(n,document.head.firstChild),n},t=function(){var t;return(t=e("trix-csp-nonce")||e("csp-nonce"))?t.getAttribute("content"):void 0},e=function(t){return document.head.querySelector("meta[name="+t+"]")},s=function(t){var e,n,i;for(e in n={},t)i=t[e],n[e]="function"==typeof i?{value:i}:i;return n},a=function(){var t;return t=function(t){var e,n,i,r,o;for(e={},n=0,r=(o=["initialize","connect","disconnect"]).length;r>n;n++)e[i=o[n]]=t[i],delete t[i];return e},window.customElements?function(e){var n,i,r,o,s;return s=t(e),r=s.initialize,n=s.connect,i=s.disconnect,r&&(o=n,n=function(){return this.initialized||(this.initialized=!0,r.call(this)),null!=o?o.call(this):void 0}),n&&(e.connectedCallback=n),i&&(e.disconnectedCallback=i),e}:function(e){var n,i,r,o;return r=(o=t(e)).initialize,n=o.connect,i=o.disconnect,r&&(e.createdCallback=r),n&&(e.attachedCallback=n),i&&(e.detachedCallback=i),e}}(),r=window.customElements?function(t,e){var n;return n=function(){return"object"==typeof Reflect?Reflect.construct(HTMLElement,[],n):HTMLElement.apply(this)},Object.setPrototypeOf(n.prototype,HTMLElement.prototype),Object.setPrototypeOf(n,HTMLElement),Object.defineProperties(n.prototype,e),window.customElements.define(t,n),n}:function(t,e){var n,i;return i=Object.create(HTMLElement.prototype,e),n=document.registerElement(t,{prototype:i}),Object.defineProperty(i,"constructor",{value:n}),n}}.call(this),function(){var t,e;o.extend({getDOMSelection:function(){var t;return(t=window.getSelection()).rangeCount>0?t:void 0},getDOMRange:function(){var e,n;return(e=null!=(n=o.getDOMSelection())?n.getRangeAt(0):void 0)&&!t(e)?e:void 0},setDOMRange:function(t){var e;return(e=window.getSelection()).removeAllRanges(),e.addRange(t),o.selectionChangeObserver.update()}}),t=function(t){return e(t.startContainer)||e(t.endContainer)},e=function(t){return!Object.getPrototypeOf(t)}}.call(this),function(){var t;t={"application/x-trix-feature-detection":"test"},o.extend({dataTransferIsPlainText:function(t){var e,n,i;return i=t.getData("text/plain"),n=t.getData("text/html"),i&&n?(e=(new DOMParser).parseFromString(n,"text/html").body).textContent===i?!e.querySelector("*"):void 0:null!=i?i.length:void 0},dataTransferIsWritable:function(e){var n,i;if(null!=(null!=e?e.setData:void 0)){for(n in t)if(i=t[n],!function(){try{return e.setData(n,i),e.getData(n)===i}catch(t){}}())return;return!0}},keyEventIsKeyboardCommand:/Mac|^iP/.test(navigator.platform)?function(t){return t.metaKey}:function(t){return t.ctrlKey}})}.call(this),function(){o.extend({RTL_PATTERN:/[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/,getDirection:function(){var t,e,n,i;return e=o.makeElement("input",{dir:"auto",name:"x",dirName:"x.dir"}),(t=o.makeElement("form")).appendChild(e),n=function(){try{return new FormData(t).has(e.dirName)}catch(t){}}(),i=function(){try{return e.matches(":dir(ltr),:dir(rtl)")}catch(t){}}(),n?function(n){return e.value=n,new FormData(t).get(e.dirName)}:i?function(t){return e.value=t,e.matches(":dir(rtl)")?"rtl":"ltr"}:function(t){var e;return e=t.trim().charAt(0),o.RTL_PATTERN.test(e)?"rtl":"ltr"}}()})}.call(this),function(){}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=o.arraysAreEqual,o.Hash=function(n){function i(t){null==t&&(t={}),this.values=s(t),i.__super__.constructor.apply(this,arguments)}var r,s,a,u,c;return e(i,n),i.fromCommonAttributesOfObjects=function(t){var e,n,i,o,s,a;if(null==t&&(t=[]),!t.length)return new this;for(i=(e=r(t[0])).getKeys(),n=0,o=(a=t.slice(1)).length;o>n;n++)s=a[n],i=e.getKeysCommonToHash(r(s)),e=e.slice(i);return e},i.box=function(t){return r(t)},i.prototype.add=function(t,e){return this.merge(u(t,e))},i.prototype.remove=function(t){return new o.Hash(s(this.values,t))},i.prototype.get=function(t){return this.values[t]},i.prototype.has=function(t){return t in this.values},i.prototype.merge=function(t){return new o.Hash(a(this.values,c(t)))},i.prototype.slice=function(t){var e,n,i,r;for(r={},e=0,i=t.length;i>e;e++)n=t[e],this.has(n)&&(r[n]=this.values[n]);return new o.Hash(r)},i.prototype.getKeys=function(){return Object.keys(this.values)},i.prototype.getKeysCommonToHash=function(t){var e,n,i,o,s;for(t=r(t),s=[],e=0,i=(o=this.getKeys()).length;i>e;e++)n=o[e],this.values[n]===t.values[n]&&s.push(n);return s},i.prototype.isEqualTo=function(e){return t(this.toArray(),r(e).toArray())},i.prototype.isEmpty=function(){return 0===this.getKeys().length},i.prototype.toArray=function(){var t,e,n;return(null!=this.array?this.array:this.array=function(){var i;for(t in e=[],i=this.values)n=i[t],e.push(t,n);return e}.call(this)).slice(0)},i.prototype.toObject=function(){return s(this.values)},i.prototype.toJSON=function(){return this.toObject()},i.prototype.contentsForInspection=function(){return{values:JSON.stringify(this.values)}},u=function(t,e){var n;return(n={})[t]=e,n},a=function(t,e){var n,i,r;for(n in i=s(t),e)r=e[n],i[n]=r;return i},s=function(t,e){var n,i,r,o,s;for(o={},n=0,r=(s=Object.keys(t).sort()).length;r>n;n++)(i=s[n])!==e&&(o[i]=t[i]);return o},r=function(t){return t instanceof o.Hash?t:new o.Hash(t)},c=function(t){return t instanceof o.Hash?t.values:t},i}(o.Object)}.call(this),function(){o.ObjectGroup=function(){function t(t,e){var n,i;this.objects=null!=t?t:[],i=e.depth,(n=e.asTree)&&(this.depth=i,this.objects=this.constructor.groupObjects(this.objects,{asTree:n,depth:this.depth+1}))}return t.groupObjects=function(t,e){var n,i,r,o,s,a,u,c,l;for(null==t&&(t=[]),r=(l=null!=e?e:{}).depth,(n=l.asTree)&&null==r&&(r=0),c=[],s=0,a=t.length;a>s;s++){if(u=t[s],o){if(("function"==typeof u.canBeGrouped?u.canBeGrouped(r):void 0)&&("function"==typeof(i=o[o.length-1]).canBeGroupedWith?i.canBeGroupedWith(u,r):void 0)){o.push(u);continue}c.push(new this(o,{depth:r,asTree:n})),o=null}("function"==typeof u.canBeGrouped?u.canBeGrouped(r):void 0)?o=[u]:c.push(u)}return o&&c.push(new this(o,{depth:r,asTree:n})),c},t.prototype.getObjects=function(){return this.objects},t.prototype.getDepth=function(){return this.depth},t.prototype.getCacheKey=function(){var t,e,n,i,r;for(e=["objectGroup"],t=0,n=(r=this.getObjects()).length;n>t;t++)i=r[t],e.push(i.getCacheKey());return e.join("/")},t}()}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;o.ObjectMap=function(e){function n(t){var e,n,i,r,o;for(null==t&&(t=[]),this.objects={},i=0,r=t.length;r>i;i++)o=t[i],n=JSON.stringify(o),null==(e=this.objects)[n]&&(e[n]=o)}return t(n,e),n.prototype.find=function(t){var e;return e=JSON.stringify(t),this.objects[e]},n}(o.BasicObject)}.call(this),function(){o.ElementStore=function(){function t(t){this.reset(t)}var e;return t.prototype.add=function(t){var n;return n=e(t),this.elements[n]=t},t.prototype.remove=function(t){var n,i;return n=e(t),(i=this.elements[n])?(delete this.elements[n],i):void 0},t.prototype.reset=function(t){var e,n,i;for(null==t&&(t=[]),this.elements={},n=0,i=t.length;i>n;n++)e=t[n],this.add(e);return t},e=function(t){return t.dataset.trixStoreKey},t}()}.call(this),function(){}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;o.Operation=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.isPerforming=function(){return!0===this.performing},n.prototype.hasPerformed=function(){return!0===this.performed},n.prototype.hasSucceeded=function(){return this.performed&&this.succeeded},n.prototype.hasFailed=function(){return this.performed&&!this.succeeded},n.prototype.getPromise=function(){return null!=this.promise?this.promise:this.promise=new Promise(function(t){return function(e,n){return t.performing=!0,t.perform((function(i,r){return t.succeeded=i,t.performing=!1,t.performed=!0,t.succeeded?e(r):n(r)}))}}(this))},n.prototype.perform=function(t){return t(!1)},n.prototype.release=function(){var t;return null!=(t=this.promise)&&"function"==typeof t.cancel&&t.cancel(),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null},n.proxyMethod("getPromise().then"),n.proxyMethod("getPromise().catch"),n}(o.BasicObject)}.call(this),function(){var t,e,n,i,r,s={}.hasOwnProperty;o.UTF16String=function(t){function e(t,e){this.ucs2String=t,this.codepoints=e,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}return function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype}(e,t),e.box=function(t){return null==t&&(t=""),t instanceof this?t:this.fromUCS2String(null!=t?t.toString():void 0)},e.fromUCS2String=function(t){return new this(t,i(t))},e.fromCodepoints=function(t){return new this(r(t),t)},e.prototype.offsetToUCS2Offset=function(t){return r(this.codepoints.slice(0,Math.max(0,t))).length},e.prototype.offsetFromUCS2Offset=function(t){return i(this.ucs2String.slice(0,Math.max(0,t))).length},e.prototype.slice=function(){var t;return this.constructor.fromCodepoints((t=this.codepoints).slice.apply(t,arguments))},e.prototype.charAt=function(t){return this.slice(t,t+1)},e.prototype.isEqualTo=function(t){return this.constructor.box(t).ucs2String===this.ucs2String},e.prototype.toJSON=function(){return this.ucs2String},e.prototype.getCacheKey=function(){return this.ucs2String},e.prototype.toString=function(){return this.ucs2String},e}(o.BasicObject),t=1===("function"==typeof Array.from?Array.from("👼").length:void 0),e=null!=("function"==typeof" ".codePointAt?" ".codePointAt(0):void 0),n=" 👼"===("function"==typeof String.fromCodePoint?String.fromCodePoint(32,128124):void 0),i=t&&e?function(t){return Array.from(t).map((function(t){return t.codePointAt(0)}))}:function(t){var e,n,i,r,o;for(r=[],e=0,i=t.length;i>e;)(o=t.charCodeAt(e++))>=55296&&56319>=o&&i>e&&(56320==(64512&(n=t.charCodeAt(e++)))?o=((1023&o)<<10)+(1023&n)+65536:e--),r.push(o);return r},r=n?function(t){return String.fromCodePoint.apply(String,t)}:function(t){var e,n,i;return e=function(){var e,r,o;for(o=[],e=0,r=t.length;r>e;e++)i=t[e],n="",i>65535&&(i-=65536,n+=String.fromCharCode(i>>>10&1023|55296),i=56320|1023&i),o.push(n+String.fromCharCode(i));return o}(),e.join("")}}.call(this),function(){}.call(this),function(){}.call(this),function(){o.config.lang={attachFiles:"Attach Files",bold:"Bold",bullets:"Bullets",byte:"Byte",bytes:"Bytes",captionPlaceholder:"Add a caption…",code:"Code",heading1:"Heading",indent:"Increase Level",italic:"Italic",link:"Link",numbers:"Numbers",outdent:"Decrease Level",quote:"Quote",redo:"Redo",remove:"Remove",strike:"Strikethrough",undo:"Undo",unlink:"Unlink",url:"URL",urlPlaceholder:"Enter a URL…",GB:"GB",KB:"KB",MB:"MB",PB:"PB",TB:"TB"}}.call(this),function(){o.config.css={attachment:"attachment",attachmentCaption:"attachment__caption",attachmentCaptionEditor:"attachment__caption-editor",attachmentMetadata:"attachment__metadata",attachmentMetadataContainer:"attachment__metadata-container",attachmentName:"attachment__name",attachmentProgress:"attachment__progress",attachmentSize:"attachment__size",attachmentToolbar:"attachment__toolbar",attachmentGallery:"attachment-gallery"}}.call(this),function(){var t;o.config.blockAttributes=t={default:{tagName:"div",parse:!1},quote:{tagName:"blockquote",nestable:!0},heading1:{tagName:"h1",terminal:!0,breakOnReturn:!0,group:!1},code:{tagName:"pre",terminal:!0,text:{plaintext:!0}},bulletList:{tagName:"ul",parse:!1},bullet:{tagName:"li",listAttribute:"bulletList",group:!1,nestable:!0,test:function(e){return o.tagName(e.parentNode)===t[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",group:!1,nestable:!0,test:function(e){return o.tagName(e.parentNode)===t[this.listAttribute].tagName}},attachmentGallery:{tagName:"div",exclusive:!0,terminal:!0,parse:!1,group:!1}}}.call(this),function(){var t,e;t=o.config.lang,e=[t.bytes,t.KB,t.MB,t.GB,t.TB,t.PB],o.config.fileSize={prefix:"IEC",precision:2,formatter:function(n){var i,r;switch(n){case 0:return"0 "+t.bytes;case 1:return"1 "+t.byte;default:return i=function(){switch(this.prefix){case"SI":return 1e3;case"IEC":return 1024}}.call(this),r=Math.floor(Math.log(n)/Math.log(i)),(n/Math.pow(i,r)).toFixed(this.precision).replace(/0*$/,"").replace(/\.$/,"")+" "+e[r]}}}}.call(this),function(){o.config.textAttributes={bold:{tagName:"strong",inheritable:!0,parser:function(t){var e;return"bold"===(e=window.getComputedStyle(t)).fontWeight||e.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:function(t){return"italic"===window.getComputedStyle(t).fontStyle}},href:{groupTagName:"a",parser:function(t){var e,n;return n="a:not("+o.AttachmentView.attachmentSelector+")",(e=o.findClosestElementFromNode(t,{matchingSelector:n}))?e.getAttribute("href"):void 0}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}}}.call(this),function(){var t,e,n;n=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],e="data-trix-serialized-attributes",t=new RegExp("\x3c!--block--\x3e","g"),o.extend({serializers:{"application/json":function(t){var e;if(t instanceof o.Document)e=t;else{if(!(t instanceof HTMLElement))throw new Error("unserializable object");e=o.Document.fromHTML(t.innerHTML)}return e.toSerializableDocument().toJSONString()},"text/html":function(i){var r,s,a,u,c,l,h,p,d,f,g,m,y,v,b,A,C;if(i instanceof o.Document)u=o.DocumentView.render(i);else{if(!(i instanceof HTMLElement))throw new Error("unserializable object");u=i.cloneNode(!0)}for(c=0,d=(v=u.querySelectorAll("[data-trix-serialize=false]")).length;d>c;c++)a=v[c],o.removeNode(a);for(l=0,f=n.length;f>l;l++)for(r=n[l],h=0,g=(b=u.querySelectorAll("["+r+"]")).length;g>h;h++)(a=b[h]).removeAttribute(r);for(p=0,m=(A=u.querySelectorAll("[data-trix-serialized-attributes]")).length;m>p;p++){a=A[p];try{for(y in s=JSON.parse(a.getAttribute(e)),a.removeAttribute(e),s)C=s[y],a.setAttribute(y,C)}catch(t){}}return u.innerHTML.replace(t,"")}},deserializers:{"application/json":function(t){return o.Document.fromJSONString(t)},"text/html":function(t){return o.Document.fromHTML(t)}},serializeToContentType:function(t,e){var n;if(n=o.serializers[e])return n(t);throw new Error("unknown content type: "+e)},deserializeFromContentType:function(t,e){var n;if(n=o.deserializers[e])return n(t);throw new Error("unknown content type: "+e)}})}.call(this),function(){var t;t=o.config.lang,o.config.toolbar={getDefaultHTML:function(){return'\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n\n \n \n \n\n \n\n \n \n \n \n
\n\n'}}}.call(this),function(){o.config.undoInterval=5e3}.call(this),function(){o.config.attachments={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}}}.call(this),function(){o.config.keyNames={8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"}}.call(this),function(){o.config.input={level2Enabled:!0,getLevel:function(){return this.level2Enabled&&o.browser.supportsInputEvents?2:0},pickFiles:function(t){var e;return(e=o.makeElement("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId})).addEventListener("change",(function(){return t(e.files),o.removeNode(e)})),o.removeNode(document.getElementById(this.fileInputId)),document.body.appendChild(e),e.click()},fileInputId:"trix-file-input-"+Date.now().toString(16)}}.call(this),function(){}.call(this),function(){o.registerElement("trix-toolbar",{defaultCSS:"%t {\n display: block;\n}\n\n%t {\n white-space: nowrap;\n}\n\n%t [data-trix-dialog] {\n display: none;\n}\n\n%t [data-trix-dialog][data-trix-active] {\n display: block;\n}\n\n%t [data-trix-dialog] [data-trix-validate]:invalid {\n background-color: #ffdddd;\n}",initialize:function(){return""===this.innerHTML?this.innerHTML=o.config.toolbar.getDefaultHTML():void 0}})}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty,n=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};o.ObjectView=function(e){function i(t,e){this.object=t,this.options=null!=e?e:{},this.childViews=[],this.rootView=this}return t(i,e),i.prototype.getNodes=function(){var t,e,n,i,r;for(null==this.nodes&&(this.nodes=this.createNodes()),r=[],t=0,e=(i=this.nodes).length;e>t;t++)n=i[t],r.push(n.cloneNode(!0));return r},i.prototype.invalidate=function(){var t;return this.nodes=null,this.childViews=[],null!=(t=this.parentView)?t.invalidate():void 0},i.prototype.invalidateViewForObject=function(t){var e;return null!=(e=this.findViewForObject(t))?e.invalidate():void 0},i.prototype.findOrCreateCachedChildView=function(t,e){var n;return(n=this.getCachedViewForObject(e))?this.recordChildView(n):(n=this.createChildView.apply(this,arguments),this.cacheViewForObject(n,e)),n},i.prototype.createChildView=function(t,e,n){var i;return null==n&&(n={}),e instanceof o.ObjectGroup&&(n.viewClass=t,t=o.ObjectGroupView),i=new t(e,n),this.recordChildView(i)},i.prototype.recordChildView=function(t){return t.parentView=this,t.rootView=this.rootView,this.childViews.push(t),t},i.prototype.getAllChildViews=function(){var t,e,n,i,r;for(r=[],e=0,n=(i=this.childViews).length;n>e;e++)t=i[e],r.push(t),r=r.concat(t.getAllChildViews());return r},i.prototype.findElement=function(){return this.findElementForObject(this.object)},i.prototype.findElementForObject=function(t){var e;return(e=null!=t?t.id:void 0)?this.rootView.element.querySelector("[data-trix-id='"+e+"']"):void 0},i.prototype.findViewForObject=function(t){var e,n,i,r;for(e=0,n=(i=this.getAllChildViews()).length;n>e;e++)if((r=i[e]).object===t)return r},i.prototype.getViewCache=function(){return this.rootView!==this?this.rootView.getViewCache():this.isViewCachingEnabled()?null!=this.viewCache?this.viewCache:this.viewCache={}:void 0},i.prototype.isViewCachingEnabled=function(){return!1!==this.shouldCacheViews},i.prototype.enableViewCaching=function(){return this.shouldCacheViews=!0},i.prototype.disableViewCaching=function(){return this.shouldCacheViews=!1},i.prototype.getCachedViewForObject=function(t){var e;return null!=(e=this.getViewCache())?e[t.getCacheKey()]:void 0},i.prototype.cacheViewForObject=function(t,e){var n;return null!=(n=this.getViewCache())?n[e.getCacheKey()]=t:void 0},i.prototype.garbageCollectCachedViews=function(){var t,e,i,r,o,s;if(t=this.getViewCache()){for(e in s=this.getAllChildViews().concat(this),i=function(){var t,e,n;for(n=[],t=0,e=s.length;e>t;t++)o=s[t],n.push(o.object.getCacheKey());return n}(),r=[],t)n.call(i,e)<0&&r.push(delete t[e]);return r}},i}(o.BasicObject)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;o.ObjectGroupView=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.objectGroup=this.object,this.viewClass=this.options.viewClass,delete this.options.viewClass}return t(n,e),n.prototype.getChildViews=function(){var t,e,n,i;if(!this.childViews.length)for(t=0,e=(i=this.objectGroup.getObjects()).length;e>t;t++)n=i[t],this.findOrCreateCachedChildView(this.viewClass,n,this.options);return this.childViews},n.prototype.createNodes=function(){var t,e,n,i,r,o,s,a;for(t=this.createContainerElement(),e=0,i=(s=this.getChildViews()).length;i>e;e++)for(n=0,r=(a=s[e].getNodes()).length;r>n;n++)o=a[n],t.appendChild(o);return[t]},n.prototype.createContainerElement=function(t){return null==t&&(t=this.objectGroup.getDepth()),this.getChildViews()[0].createContainerElement(t)},n}(o.ObjectView)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;o.Controller=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n}(o.BasicObject)}.call(this),function(){var t,e,n,i,r,s,a=function(t,e){function n(){this.constructor=t}for(var i in e)u.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty,c=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};t=o.findClosestElementFromNode,n=o.nodeIsEmptyTextNode,e=o.nodeIsBlockStartComment,i=o.normalizeSpaces,r=o.summarizeStringChange,s=o.tagName,o.MutationObserver=function(o){function u(t){this.element=t,this.didMutate=function(t,e){return function(){return t.apply(e,arguments)}}(this.didMutate,this),this.observer=new window.MutationObserver(this.didMutate),this.start()}var l,h,p;return a(u,o),"["+(h="data-trix-mutable")+"]",p={attributes:!0,childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0},u.prototype.start=function(){return this.reset(),this.observer.observe(this.element,p)},u.prototype.stop=function(){return this.observer.disconnect()},u.prototype.didMutate=function(t){var e,n;return(e=this.mutations).push.apply(e,this.findSignificantMutations(t)),this.mutations.length?(null!=(n=this.delegate)&&"function"==typeof n.elementDidMutate&&n.elementDidMutate(this.getMutationSummary()),this.reset()):void 0},u.prototype.reset=function(){return this.mutations=[]},u.prototype.findSignificantMutations=function(t){var e,n,i,r;for(r=[],e=0,n=t.length;n>e;e++)i=t[e],this.mutationIsSignificant(i)&&r.push(i);return r},u.prototype.mutationIsSignificant=function(t){var e,n,i,r;if(this.nodeIsMutable(t.target))return!1;for(e=0,n=(r=this.nodesModifiedByMutation(t)).length;n>e;e++)if(i=r[e],this.nodeIsSignificant(i))return!0;return!1},u.prototype.nodeIsSignificant=function(t){return t!==this.element&&!this.nodeIsMutable(t)&&!n(t)},u.prototype.nodeIsMutable=function(e){return t(e,{matchingSelector:"[data-trix-mutable]"})},u.prototype.nodesModifiedByMutation=function(t){var e;switch(e=[],t.type){case"attributes":t.attributeName!==h&&e.push(t.target);break;case"characterData":e.push(t.target.parentNode),e.push(t.target);break;case"childList":e.push.apply(e,t.addedNodes),e.push.apply(e,t.removedNodes)}return e},u.prototype.getMutationSummary=function(){return this.getTextMutationSummary()},u.prototype.getTextMutationSummary=function(){var t,e,n,i,r,o,s,a,u,l,h;for(n=(a=this.getTextChangesFromCharacterData()).additions,r=a.deletions,o=0,s=(u=(h=this.getTextChangesFromChildList()).additions).length;s>o;o++)e=u[o],c.call(n,e)<0&&n.push(e);return r.push.apply(r,h.deletions),l={},(t=n.join(""))&&(l.textAdded=t),(i=r.join(""))&&(l.textDeleted=i),l},u.prototype.getMutationsByType=function(t){var e,n,i,r,o;for(o=[],e=0,n=(r=this.mutations).length;n>e;e++)(i=r[e]).type===t&&o.push(i);return o},u.prototype.getTextChangesFromChildList=function(){var t,n,r,o,s,a,u,c,h,p;for(t=[],u=[],n=0,o=(a=this.getMutationsByType("childList")).length;o>n;n++)s=a[n],t.push.apply(t,s.addedNodes),u.push.apply(u,s.removedNodes);return 0===t.length&&1===u.length&&e(u[0])?(h=[],p=["\n"]):(h=l(t),p=l(u)),{additions:function(){var t,e,n;for(n=[],r=t=0,e=h.length;e>t;r=++t)(c=h[r])!==p[r]&&n.push(i(c));return n}(),deletions:function(){var t,e,n;for(n=[],r=t=0,e=p.length;e>t;r=++t)(c=p[r])!==h[r]&&n.push(i(c));return n}()}},u.prototype.getTextChangesFromCharacterData=function(){var t,e,n,o,s,a,u,c;return(e=this.getMutationsByType("characterData")).length&&(c=e[0],n=e[e.length-1],s=i(c.oldValue),o=i(n.target.data),t=(a=r(s,o)).added,u=a.removed),{additions:t?[t]:[],deletions:u?[u]:[]}},l=function(t){var e,n,i,r;for(null==t&&(t=[]),r=[],e=0,n=t.length;n>e;e++)switch(i=t[e],i.nodeType){case Node.TEXT_NODE:r.push(i.data);break;case Node.ELEMENT_NODE:"br"===s(i)?r.push("\n"):r.push.apply(r,l(i.childNodes))}return r},u}(o.BasicObject)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;o.FileVerificationOperation=function(e){function n(t){this.file=t}return t(n,e),n.prototype.perform=function(t){var e;return(e=new FileReader).onerror=function(){return t(!1)},e.onload=function(n){return function(){e.onerror=null;try{e.abort()}catch(t){}return t(!0,n.file)}}(this),e.readAsArrayBuffer(this.file)},n}(o.Operation)}.call(this),function(){var t,e,n=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=o.handleEvent,e=o.innerElementIsActive,o.InputController=function(i){function r(e){var n;for(n in this.element=e,this.mutationObserver=new o.MutationObserver(this.element),this.mutationObserver.delegate=this,this.events)t(n,{onElement:this.element,withCallback:this.handlerFor(n)})}return n(r,i),r.prototype.events={},r.prototype.elementDidMutate=function(){},r.prototype.editorWillSyncDocumentView=function(){return this.mutationObserver.stop()},r.prototype.editorDidSyncDocumentView=function(){return this.mutationObserver.start()},r.prototype.requestRender=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidRequestRender?t.inputControllerDidRequestRender():void 0},r.prototype.requestReparse=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidRequestReparse&&t.inputControllerDidRequestReparse(),this.requestRender()},r.prototype.attachFiles=function(t){var e,n;return n=function(){var n,i,r;for(r=[],n=0,i=t.length;i>n;n++)e=t[n],r.push(new o.FileVerificationOperation(e));return r}(),Promise.all(n).then(function(t){return function(e){return t.handleInput((function(){var t,n;return null!=(t=this.delegate)&&t.inputControllerWillAttachFiles(),null!=(n=this.responder)&&n.insertFiles(e),this.requestRender()}))}}(this))},r.prototype.handlerFor=function(t){return function(n){return function(i){return i.defaultPrevented?void 0:n.handleInput((function(){return e(this.element)?void 0:(this.eventName=t,this.events[t].call(this,i))}))}}(this)},r.prototype.handleInput=function(t){var e,n;try{return null!=(e=this.delegate)&&e.inputControllerWillHandleInput(),t.call(this)}finally{null!=(n=this.delegate)&&n.inputControllerDidHandleInput()}},r.prototype.createLinkHTML=function(t,e){var n;return(n=document.createElement("a")).href=t,n.textContent=null!=e?e:t,n.outerHTML},r}(o.BasicObject)}.call(this),function(){var t,e,n,i,r,s,a,u,c,l,h,p,d=function(t,e){function n(){this.constructor=t}for(var i in e)f.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},f={}.hasOwnProperty,g=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};c=o.makeElement,l=o.objectsAreEqual,o.tagName,e=o.browser,a=o.keyEventIsKeyboardCommand,i=o.dataTransferIsWritable,n=o.dataTransferIsPlainText,u=o.config.keyNames,o.Level0InputController=function(e){function s(){s.__super__.constructor.apply(this,arguments),this.resetInputSummary()}var f;return d(s,e),f=0,s.prototype.setInputSummary=function(t){var e,n;for(e in null==t&&(t={}),this.inputSummary.eventName=this.eventName,t)n=t[e],this.inputSummary[e]=n;return this.inputSummary},s.prototype.resetInputSummary=function(){return this.inputSummary={}},s.prototype.reset=function(){return this.resetInputSummary(),o.selectionChangeObserver.reset()},s.prototype.elementDidMutate=function(t){var e;return this.isComposing()?null!=(e=this.delegate)&&"function"==typeof e.inputControllerDidAllowUnhandledInput?e.inputControllerDidAllowUnhandledInput():void 0:this.handleInput((function(){return this.mutationIsSignificant(t)&&(this.mutationIsExpected(t)?this.requestRender():this.requestReparse()),this.reset()}))},s.prototype.mutationIsExpected=function(t){var e,n,i,r,o,s,a,u,c;return s=t.textAdded,a=t.textDeleted,!!this.inputSummary.preferDocument||(e=null!=s?s===this.inputSummary.textAdded:!this.inputSummary.textAdded,n=null!=a?this.inputSummary.didDelete:!this.inputSummary.didDelete,c="\n"===a&&!n,!!(((u=("\n"===s||" \n"===s)&&!e)&&!c||c&&!u)&&(r=this.getSelectedRange())&&(i=u?s.replace(/\n$/,"").length||-1:(null!=s?s.length:void 0)||1,null!=(o=this.responder)?o.positionIsBlockBreak(r[1]+i):void 0))||e&&n)},s.prototype.mutationIsSignificant=function(t){var e,n,i;return i=Object.keys(t).length>0,e=""===(null!=(n=this.compositionInput)?n.getEndData():void 0),i||!e},s.prototype.events={keydown:function(t){var e,n,i,r,s,c,l,h,p;if(this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0,r=u[t.keyCode]){for(n=this.keys,i=0,c=(h=["ctrl","alt","shift","meta"]).length;c>i;i++)t[(l=h[i])+"Key"]&&("ctrl"===l&&(l="control"),n=null!=n?n[l]:void 0);null!=(null!=n?n[r]:void 0)&&(this.setInputSummary({keyName:r}),o.selectionChangeObserver.reset(),n[r].call(this,t))}return a(t)&&(e=String.fromCharCode(t.keyCode).toLowerCase())&&(s=function(){var e,n,i,r;for(r=[],e=0,n=(i=["alt","shift"]).length;n>e;e++)t[(l=i[e])+"Key"]&&r.push(l);return r}(),s.push(e),null!=(p=this.delegate)?p.inputControllerDidReceiveKeyboardCommand(s):void 0)?t.preventDefault():void 0},keypress:function(t){var e,n,i;if(null==this.inputSummary.eventName&&!t.metaKey&&(!t.ctrlKey||t.altKey))return(i=p(t))?(null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString(i),this.setInputSummary({textAdded:i,didDelete:this.selectionIsExpanded()})):void 0},textInput:function(t){var e,n,i,r;return e=t.data,(r=this.inputSummary.textAdded)&&r!==e&&r.toUpperCase()===e?(n=this.getSelectedRange(),this.setSelectedRange([n[0],n[1]+r.length]),null!=(i=this.responder)&&i.insertString(e),this.setInputSummary({textAdded:e}),this.setSelectedRange(n)):void 0},dragenter:function(t){return t.preventDefault()},dragstart:function(t){var e;return t.target,this.serializeSelectionToDataTransfer(t.dataTransfer),this.draggedRange=this.getSelectedRange(),null!=(e=this.delegate)&&"function"==typeof e.inputControllerDidStartDrag?e.inputControllerDidStartDrag():void 0},dragover:function(t){var e,n;return!this.draggedRange&&!this.canAcceptDataTransfer(t.dataTransfer)||(t.preventDefault(),e={x:t.clientX,y:t.clientY},l(e,this.draggingPoint))?void 0:(this.draggingPoint=e,null!=(n=this.delegate)&&"function"==typeof n.inputControllerDidReceiveDragOverPoint?n.inputControllerDidReceiveDragOverPoint(this.draggingPoint):void 0)},dragend:function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidCancelDrag&&t.inputControllerDidCancelDrag(),this.draggedRange=null,this.draggingPoint=null},drop:function(t){var e,n,i,r,s,a,u,c,l;return t.preventDefault(),i=null!=(s=t.dataTransfer)?s.files:void 0,r={x:t.clientX,y:t.clientY},null!=(a=this.responder)&&a.setLocationRangeFromPointRange(r),(null!=i?i.length:void 0)?this.attachFiles(i):this.draggedRange?(null!=(u=this.delegate)&&u.inputControllerWillMoveText(),null!=(c=this.responder)&&c.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()):(n=t.dataTransfer.getData("application/x-trix-document"))&&(e=o.Document.fromJSONString(n),null!=(l=this.responder)&&l.insertDocument(e),this.requestRender()),this.draggedRange=null,this.draggingPoint=null},cut:function(t){var e,n;return(null!=(e=this.responder)?e.selectionIsExpanded():void 0)&&(this.serializeSelectionToDataTransfer(t.clipboardData)&&t.preventDefault(),null!=(n=this.delegate)&&n.inputControllerWillCutText(),this.deleteInDirection("backward"),t.defaultPrevented)?this.requestRender():void 0},copy:function(t){var e;return(null!=(e=this.responder)?e.selectionIsExpanded():void 0)&&this.serializeSelectionToDataTransfer(t.clipboardData)?t.preventDefault():void 0},paste:function(t){var e,i,s,a,u,c,l,p,d,m,y,v,b,A,C,x,w,E,S,k,R,D,L;return e=null!=(p=t.clipboardData)?p:t.testClipboardData,l={clipboard:e},null==e||h(t)?void this.getPastedHTMLUsingHiddenElement(function(t){return function(e){var n,i,r;return l.type="text/html",l.html=e,null!=(n=t.delegate)&&n.inputControllerWillPaste(l),null!=(i=t.responder)&&i.insertHTML(l.html),t.requestRender(),null!=(r=t.delegate)?r.inputControllerDidPaste(l):void 0}}(this)):((a=e.getData("URL"))?(l.type="text/html",L=(c=e.getData("public.url-name"))?o.squishBreakableWhitespace(c).trim():a,l.html=this.createLinkHTML(a,L),null!=(d=this.delegate)&&d.inputControllerWillPaste(l),this.setInputSummary({textAdded:L,didDelete:this.selectionIsExpanded()}),null!=(C=this.responder)&&C.insertHTML(l.html),this.requestRender(),null!=(x=this.delegate)&&x.inputControllerDidPaste(l)):n(e)?(l.type="text/plain",l.string=e.getData("text/plain"),null!=(w=this.delegate)&&w.inputControllerWillPaste(l),this.setInputSummary({textAdded:l.string,didDelete:this.selectionIsExpanded()}),null!=(E=this.responder)&&E.insertString(l.string),this.requestRender(),null!=(S=this.delegate)&&S.inputControllerDidPaste(l)):(u=e.getData("text/html"))?(l.type="text/html",l.html=u,null!=(k=this.delegate)&&k.inputControllerWillPaste(l),null!=(R=this.responder)&&R.insertHTML(l.html),this.requestRender(),null!=(D=this.delegate)&&D.inputControllerDidPaste(l)):g.call(e.types,"Files")>=0&&(s=null!=(m=e.items)&&null!=(y=m[0])&&"function"==typeof y.getAsFile?y.getAsFile():void 0)&&(!s.name&&(i=r(s))&&(s.name="pasted-file-"+ ++f+"."+i),l.type="File",l.file=s,null!=(v=this.delegate)&&v.inputControllerWillAttachFiles(),null!=(b=this.responder)&&b.insertFile(l.file),this.requestRender(),null!=(A=this.delegate)&&A.inputControllerDidPaste(l)),t.preventDefault())},compositionstart:function(t){return this.getCompositionInput().start(t.data)},compositionupdate:function(t){return this.getCompositionInput().update(t.data)},compositionend:function(t){return this.getCompositionInput().end(t.data)},beforeinput:function(){return this.inputSummary.didInput=!0},input:function(t){return this.inputSummary.didInput=!0,t.stopPropagation()}},s.prototype.keys={backspace:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",t)},delete:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",t)},return:function(){var t,e;return this.setInputSummary({preferDocument:!0}),null!=(t=this.delegate)&&t.inputControllerWillPerformTyping(),null!=(e=this.responder)?e.insertLineBreak():void 0},tab:function(t){var e,n;return(null!=(e=this.responder)?e.canIncreaseNestingLevel():void 0)?(null!=(n=this.responder)&&n.increaseNestingLevel(),this.requestRender(),t.preventDefault()):void 0},left:function(t){var e;return this.selectionIsInCursorTarget()?(t.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("backward"):void 0):void 0},right:function(t){var e;return this.selectionIsInCursorTarget()?(t.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("forward"):void 0):void 0},control:{d:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",t)},h:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",t)},o:function(t){var e,n;return t.preventDefault(),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString("\n",{updatePosition:!1}),this.requestRender()}},shift:{return:function(t){var e,n;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString("\n"),this.requestRender(),t.preventDefault()},tab:function(t){var e,n;return(null!=(e=this.responder)?e.canDecreaseNestingLevel():void 0)?(null!=(n=this.responder)&&n.decreaseNestingLevel(),this.requestRender(),t.preventDefault()):void 0},left:function(t){return this.selectionIsInCursorTarget()?(t.preventDefault(),this.expandSelectionInDirection("backward")):void 0},right:function(t){return this.selectionIsInCursorTarget()?(t.preventDefault(),this.expandSelectionInDirection("forward")):void 0}},alt:{backspace:function(){var t;return this.setInputSummary({preferDocument:!1}),null!=(t=this.delegate)?t.inputControllerWillPerformTyping():void 0}},meta:{backspace:function(){var t;return this.setInputSummary({preferDocument:!1}),null!=(t=this.delegate)?t.inputControllerWillPerformTyping():void 0}}},s.prototype.getCompositionInput=function(){return this.isComposing()?this.compositionInput:this.compositionInput=new t(this)},s.prototype.isComposing=function(){return null!=this.compositionInput&&!this.compositionInput.isEnded()},s.prototype.deleteInDirection=function(t,e){var n;return!1!==(null!=(n=this.responder)?n.deleteInDirection(t):void 0)?this.setInputSummary({didDelete:!0}):e?(e.preventDefault(),this.requestRender()):void 0},s.prototype.serializeSelectionToDataTransfer=function(t){var e,n;if(i(t))return e=null!=(n=this.responder)?n.getSelectedDocument().toSerializableDocument():void 0,t.setData("application/x-trix-document",JSON.stringify(e)),t.setData("text/html",o.DocumentView.render(e).innerHTML),t.setData("text/plain",e.toString().replace(/\n$/,"")),!0},s.prototype.canAcceptDataTransfer=function(t){var e,n,i,r,o;for(o={},e=0,n=(r=null!=(i=null!=t?t.types:void 0)?i:[]).length;n>e;e++)o[r[e]]=!0;return o.Files||o["application/x-trix-document"]||o["text/html"]||o["text/plain"]},s.prototype.getPastedHTMLUsingHiddenElement=function(t){var e,n,i;return n=this.getSelectedRange(),i={position:"absolute",left:window.pageXOffset+"px",top:window.pageYOffset+"px",opacity:0},e=c({style:i,tagName:"div",editable:!0}),document.body.appendChild(e),e.focus(),requestAnimationFrame(function(i){return function(){var r;return r=e.innerHTML,o.removeNode(e),i.setSelectedRange(n),t(r)}}(this))},s.proxyMethod("responder?.getSelectedRange"),s.proxyMethod("responder?.setSelectedRange"),s.proxyMethod("responder?.expandSelectionInDirection"),s.proxyMethod("responder?.selectionIsInCursorTarget"),s.proxyMethod("responder?.selectionIsExpanded"),s}(o.InputController),r=function(t){var e,n;return null!=(e=t.type)&&null!=(n=e.match(/\/(\w+)$/))?n[1]:void 0},s=null!=("function"==typeof" ".codePointAt?" ".codePointAt(0):void 0),p=function(t){var e;return t.key&&s&&t.key.codePointAt(0)===t.keyCode?t.key:(null===t.which?e=t.keyCode:0!==t.which&&0!==t.charCode&&(e=t.charCode),null!=e&&"escape"!==u[e]?o.UTF16String.fromCodepoints([e]).toString():void 0)},h=function(t){var e,n,i,r,o,s,a,u,c;if(a=t.clipboardData){if(g.call(a.types,"text/html")>=0){for(i=0,s=(u=a.types).length;s>i;i++)if(c=u[i],e=/^CorePasteboardFlavorType/.test(c),n=/^dyn\./.test(c)&&a.getData(c),e||n)return!0;return!1}return r=g.call(a.types,"com.apple.webarchive")>=0,o=g.call(a.types,"com.apple.flat-rtfd")>=0,r||o}},t=function(t){function n(t){var e;this.inputController=t,e=this.inputController,this.responder=e.responder,this.delegate=e.delegate,this.inputSummary=e.inputSummary,this.data={}}return d(n,t),n.prototype.start=function(t){var e,n;return this.data.start=t,this.isSignificant()?("keypress"===this.inputSummary.eventName&&this.inputSummary.textAdded&&null!=(e=this.responder)&&e.deleteInDirection("left"),this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=null!=(n=this.responder)?n.getSelectedRange():void 0):void 0},n.prototype.update=function(t){var e;return this.data.update=t,this.isSignificant()&&(e=this.selectPlaceholder())?(this.forgetPlaceholder(),this.range=e):void 0},n.prototype.end=function(t){var e,n,i,r;return this.data.end=t,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.setSelectedRange(this.range),null!=(i=this.responder)&&i.insertString(this.data.end),null!=(r=this.responder)?r.setSelectedRange(this.range[0]+this.data.end.length):void 0):null!=this.data.start||null!=this.data.update?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset()},n.prototype.getEndData=function(){return this.data.end},n.prototype.isEnded=function(){return null!=this.getEndData()},n.prototype.isSignificant=function(){return!e.composesExistingText||this.inputSummary.didInput},n.prototype.canApplyToDocument=function(){var t,e;return 0===(null!=(t=this.data.start)?t.length:void 0)&&(null!=(e=this.data.end)?e.length:void 0)>0&&null!=this.range},n.proxyMethod("inputController.setInputSummary"),n.proxyMethod("inputController.requestRender"),n.proxyMethod("inputController.requestReparse"),n.proxyMethod("responder?.selectionIsExpanded"),n.proxyMethod("responder?.insertPlaceholder"),n.proxyMethod("responder?.selectPlaceholder"),n.proxyMethod("responder?.forgetPlaceholder"),n}(o.BasicObject)}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};t=o.dataTransferIsPlainText,e=o.keyEventIsKeyboardCommand,n=o.objectsAreEqual,o.Level2InputController=function(s){function u(){return this.render=i(this.render,this),u.__super__.constructor.apply(this,arguments)}var c,l,h,p,d,f;return r(u,s),u.prototype.elementDidMutate=function(){var t;return this.scheduledRender?this.composing&&null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidAllowUnhandledInput?t.inputControllerDidAllowUnhandledInput():void 0:this.reparse()},u.prototype.scheduleRender=function(){return null!=this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)},u.prototype.render=function(){var t;return cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing||null!=(t=this.delegate)&&t.render(),"function"==typeof this.afterRender&&this.afterRender(),this.afterRender=null},u.prototype.reparse=function(){var t;return null!=(t=this.delegate)?t.reparse():void 0},u.prototype.events={keydown:function(t){var n,i,r,o;if(e(t)){if(n=l(t),null!=(o=this.delegate)?o.inputControllerDidReceiveKeyboardCommand(n):void 0)return t.preventDefault()}else if(r=t.key,t.altKey&&(r+="+Alt"),t.shiftKey&&(r+="+Shift"),i=this.keys[r])return this.withEvent(t,i)},paste:function(t){var e,n,i,r,o,s,a,u,c;return h(t)?(t.preventDefault(),this.attachFiles(t.clipboardData.files)):p(t)?(t.preventDefault(),n={type:"text/plain",string:t.clipboardData.getData("text/plain")},null!=(i=this.delegate)&&i.inputControllerWillPaste(n),null!=(r=this.responder)&&r.insertString(n.string),this.render(),null!=(o=this.delegate)?o.inputControllerDidPaste(n):void 0):(e=null!=(s=t.clipboardData)?s.getData("URL"):void 0)?(t.preventDefault(),n={type:"text/html",html:this.createLinkHTML(e)},null!=(a=this.delegate)&&a.inputControllerWillPaste(n),null!=(u=this.responder)&&u.insertHTML(n.html),this.render(),null!=(c=this.delegate)?c.inputControllerDidPaste(n):void 0):void 0},beforeinput:function(t){var e;return(e=this.inputTypes[t.inputType])?(this.withEvent(t,e),this.scheduleRender()):void 0},input:function(){return o.selectionChangeObserver.reset()},dragstart:function(t){var e,n;return(null!=(e=this.responder)?e.selectionContainsAttachments():void 0)?(t.dataTransfer.setData("application/x-trix-dragging",!0),this.dragging={range:null!=(n=this.responder)?n.getSelectedRange():void 0,point:d(t)}):void 0},dragenter:function(t){return c(t)?t.preventDefault():void 0},dragover:function(t){var e,i;if(this.dragging){if(t.preventDefault(),e=d(t),!n(e,this.dragging.point))return this.dragging.point=e,null!=(i=this.responder)?i.setLocationRangeFromPointRange(e):void 0}else if(c(t))return t.preventDefault()},drop:function(t){var e,n,i,r;return this.dragging?(t.preventDefault(),null!=(n=this.delegate)&&n.inputControllerWillMoveText(),null!=(i=this.responder)&&i.moveTextFromRange(this.dragging.range),this.dragging=null,this.scheduleRender()):c(t)?(t.preventDefault(),e=d(t),null!=(r=this.responder)&&r.setLocationRangeFromPointRange(e),this.attachFiles(t.dataTransfer.files)):void 0},dragend:function(){var t;return this.dragging?(null!=(t=this.responder)&&t.setSelectedRange(this.dragging.range),this.dragging=null):void 0},compositionend:function(){return this.composing?(this.composing=!1,this.scheduleRender()):void 0}},u.prototype.keys={ArrowLeft:function(){var t,e;return(null!=(t=this.responder)?t.shouldManageMovingCursorInDirection("backward"):void 0)?(this.event.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("backward"):void 0):void 0},ArrowRight:function(){var t,e;return(null!=(t=this.responder)?t.shouldManageMovingCursorInDirection("forward"):void 0)?(this.event.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("forward"):void 0):void 0},Backspace:function(){var t,e,n;return(null!=(t=this.responder)?t.shouldManageDeletingInDirection("backward"):void 0)?(this.event.preventDefault(),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.deleteInDirection("backward"),this.render()):void 0},Tab:function(){var t,e;return(null!=(t=this.responder)?t.canIncreaseNestingLevel():void 0)?(this.event.preventDefault(),null!=(e=this.responder)&&e.increaseNestingLevel(),this.render()):void 0},"Tab+Shift":function(){var t,e;return(null!=(t=this.responder)?t.canDecreaseNestingLevel():void 0)?(this.event.preventDefault(),null!=(e=this.responder)&&e.decreaseNestingLevel(),this.render()):void 0}},u.prototype.inputTypes={deleteByComposition:function(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteByCut:function(){return this.deleteInDirection("backward")},deleteByDrag:function(){return this.event.preventDefault(),this.withTargetDOMRange((function(){var t;return this.deleteByDragRange=null!=(t=this.responder)?t.getSelectedRange():void 0}))},deleteCompositionText:function(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteContent:function(){return this.deleteInDirection("backward")},deleteContentBackward:function(){return this.deleteInDirection("backward")},deleteContentForward:function(){return this.deleteInDirection("forward")},deleteEntireSoftLine:function(){return this.deleteInDirection("forward")},deleteHardLineBackward:function(){return this.deleteInDirection("backward")},deleteHardLineForward:function(){return this.deleteInDirection("forward")},deleteSoftLineBackward:function(){return this.deleteInDirection("backward")},deleteSoftLineForward:function(){return this.deleteInDirection("forward")},deleteWordBackward:function(){return this.deleteInDirection("backward")},deleteWordForward:function(){return this.deleteInDirection("forward")},formatBackColor:function(){return this.activateAttributeIfSupported("backgroundColor",this.event.data)},formatBold:function(){return this.toggleAttributeIfSupported("bold")},formatFontColor:function(){return this.activateAttributeIfSupported("color",this.event.data)},formatFontName:function(){return this.activateAttributeIfSupported("font",this.event.data)},formatIndent:function(){var t;return(null!=(t=this.responder)?t.canIncreaseNestingLevel():void 0)?this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.increaseNestingLevel():void 0})):void 0},formatItalic:function(){return this.toggleAttributeIfSupported("italic")},formatJustifyCenter:function(){return this.toggleAttributeIfSupported("justifyCenter")},formatJustifyFull:function(){return this.toggleAttributeIfSupported("justifyFull")},formatJustifyLeft:function(){return this.toggleAttributeIfSupported("justifyLeft")},formatJustifyRight:function(){return this.toggleAttributeIfSupported("justifyRight")},formatOutdent:function(){var t;return(null!=(t=this.responder)?t.canDecreaseNestingLevel():void 0)?this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.decreaseNestingLevel():void 0})):void 0},formatRemove:function(){return this.withTargetDOMRange((function(){var t,e,n,i;for(t in i=[],null!=(e=this.responder)?e.getCurrentAttributes():void 0)i.push(null!=(n=this.responder)?n.removeCurrentAttribute(t):void 0);return i}))},formatSetBlockTextDirection:function(){return this.activateAttributeIfSupported("blockDir",this.event.data)},formatSetInlineTextDirection:function(){return this.activateAttributeIfSupported("textDir",this.event.data)},formatStrikeThrough:function(){return this.toggleAttributeIfSupported("strike")},formatSubscript:function(){return this.toggleAttributeIfSupported("sub")},formatSuperscript:function(){return this.toggleAttributeIfSupported("sup")},formatUnderline:function(){return this.toggleAttributeIfSupported("underline")},historyRedo:function(){var t;return null!=(t=this.delegate)?t.inputControllerWillPerformRedo():void 0},historyUndo:function(){var t;return null!=(t=this.delegate)?t.inputControllerWillPerformUndo():void 0},insertCompositionText:function(){return this.composing=!0,this.insertString(this.event.data)},insertFromComposition:function(){return this.composing=!1,this.insertString(this.event.data)},insertFromDrop:function(){var t,e;return(t=this.deleteByDragRange)?(this.deleteByDragRange=null,null!=(e=this.delegate)&&e.inputControllerWillMoveText(),this.withTargetDOMRange((function(){var e;return null!=(e=this.responder)?e.moveTextFromRange(t):void 0}))):void 0},insertFromPaste:function(){var e,n,i,r,s,a,u,c,l,h,p;return e=this.event.dataTransfer,s={dataTransfer:e},(n=e.getData("URL"))?(this.event.preventDefault(),s.type="text/html",p=(r=e.getData("public.url-name"))?o.squishBreakableWhitespace(r).trim():n,s.html=this.createLinkHTML(n,p),null!=(a=this.delegate)&&a.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertHTML(s.html):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):t(e)?(s.type="text/plain",s.string=e.getData("text/plain"),null!=(u=this.delegate)&&u.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertString(s.string):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):(i=e.getData("text/html"))?(this.event.preventDefault(),s.type="text/html",s.html=i,null!=(c=this.delegate)&&c.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertHTML(s.html):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):(null!=(l=e.files)?l.length:void 0)?(s.type="File",s.file=e.files[0],null!=(h=this.delegate)&&h.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertFile(s.file):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):void 0},insertFromYank:function(){return this.insertString(this.event.data)},insertLineBreak:function(){return this.insertString("\n")},insertLink:function(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList:function(){return this.toggleAttributeIfSupported("number")},insertParagraph:function(){var t;return null!=(t=this.delegate)&&t.inputControllerWillPerformTyping(),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertLineBreak():void 0}))},insertReplacementText:function(){return this.insertString(this.event.dataTransfer.getData("text/plain"),{updatePosition:!1})},insertText:function(){var t,e;return this.insertString(null!=(t=this.event.data)?t:null!=(e=this.event.dataTransfer)?e.getData("text/plain"):void 0)},insertTranspose:function(){return this.insertString(this.event.data)},insertUnorderedList:function(){return this.toggleAttributeIfSupported("bullet")}},u.prototype.insertString=function(t,e){var n;return null==t&&(t=""),null!=(n=this.delegate)&&n.inputControllerWillPerformTyping(),this.withTargetDOMRange((function(){var n;return null!=(n=this.responder)?n.insertString(t,e):void 0}))},u.prototype.toggleAttributeIfSupported=function(t){var e;return a.call(o.getAllAttributeNames(),t)>=0?(null!=(e=this.delegate)&&e.inputControllerWillPerformFormatting(t),this.withTargetDOMRange((function(){var e;return null!=(e=this.responder)?e.toggleCurrentAttribute(t):void 0}))):void 0},u.prototype.activateAttributeIfSupported=function(t,e){var n;return a.call(o.getAllAttributeNames(),t)>=0?(null!=(n=this.delegate)&&n.inputControllerWillPerformFormatting(t),this.withTargetDOMRange((function(){var n;return null!=(n=this.responder)?n.setCurrentAttribute(t,e):void 0}))):void 0},u.prototype.deleteInDirection=function(t,e){var n,i,r;return(null!=e?e:{recordUndoEntry:!0}).recordUndoEntry&&null!=(r=this.delegate)&&r.inputControllerWillPerformTyping(),i=function(e){return function(){var n;return null!=(n=e.responder)?n.deleteInDirection(t):void 0}}(this),(n=this.getTargetDOMRange({minLength:2}))?this.withTargetDOMRange(n,i):i()},u.prototype.withTargetDOMRange=function(t,e){var n;return"function"==typeof t&&(e=t,t=this.getTargetDOMRange()),t?null!=(n=this.responder)?n.withTargetDOMRange(t,e.bind(this)):void 0:(o.selectionChangeObserver.reset(),e.call(this))},u.prototype.getTargetDOMRange=function(t){var e,n,i,r;return i=(null!=t?t:{minLength:0}).minLength,(r="function"==typeof(e=this.event).getTargetRanges?e.getTargetRanges():void 0)&&r.length&&(n=f(r[0]),0===i||n.toString().length>=i)?n:void 0},f=function(t){var e;return(e=document.createRange()).setStart(t.startContainer,t.startOffset),e.setEnd(t.endContainer,t.endOffset),e},u.prototype.withEvent=function(t,e){var n;this.event=t;try{n=e.call(this)}finally{this.event=null}return n},c=function(t){var e,n;return a.call(null!=(e=null!=(n=t.dataTransfer)?n.types:void 0)?e:[],"Files")>=0},h=function(t){var e;return(e=t.clipboardData)?a.call(e.types,"Files")>=0&&1===e.types.length&&e.files.length>=1:void 0},p=function(t){var e;return(e=t.clipboardData)?a.call(e.types,"text/plain")>=0&&1===e.types.length:void 0},l=function(t){var e;return e=[],t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),e.push(t.key),e},d=function(t){return{x:t.clientX,y:t.clientY}},u}(o.InputController)}.call(this),function(){var t,e,n,i,r,s,a,u,c=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function n(){this.constructor=t}for(var i in e)h.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;e=o.defer,n=o.handleEvent,s=o.makeElement,u=o.tagName,a=o.config,r=a.lang,t=a.css,i=a.keyNames,o.AttachmentEditorController=function(a){function h(t,e,n,i){this.attachmentPiece=t,this.element=e,this.container=n,this.options=null!=i?i:{},this.didBlurCaption=c(this.didBlurCaption,this),this.didChangeCaption=c(this.didChangeCaption,this),this.didInputCaption=c(this.didInputCaption,this),this.didKeyDownCaption=c(this.didKeyDownCaption,this),this.didClickActionButton=c(this.didClickActionButton,this),this.didClickToolbar=c(this.didClickToolbar,this),this.attachment=this.attachmentPiece.attachment,"a"===u(this.element)&&(this.element=this.element.firstChild),this.install()}var p;return l(h,a),p=function(t){return function(){var e;return(e=t.apply(this,arguments)).do(),null==this.undos&&(this.undos=[]),this.undos.push(e.undo)}},h.prototype.install=function(){return this.makeElementMutable(),this.addToolbar(),this.attachment.isPreviewable()?this.installCaptionEditor():void 0},h.prototype.uninstall=function(){var t,e;for(this.savePendingCaption();e=this.undos.pop();)e();return null!=(t=this.delegate)?t.didUninstallAttachmentEditor(this):void 0},h.prototype.savePendingCaption=function(){var t,e,n;return null!=this.pendingCaption?(t=this.pendingCaption,this.pendingCaption=null,t?null!=(e=this.delegate)&&"function"==typeof e.attachmentEditorDidRequestUpdatingAttributesForAttachment?e.attachmentEditorDidRequestUpdatingAttributesForAttachment({caption:t},this.attachment):void 0:null!=(n=this.delegate)&&"function"==typeof n.attachmentEditorDidRequestRemovingAttributeForAttachment?n.attachmentEditorDidRequestRemovingAttributeForAttachment("caption",this.attachment):void 0):void 0},h.prototype.makeElementMutable=p((function(){return{do:function(t){return function(){return t.element.dataset.trixMutable=!0}}(this),undo:function(t){return function(){return delete t.element.dataset.trixMutable}}(this)}})),h.prototype.addToolbar=p((function(){var e;return e=s({tagName:"div",className:t.attachmentToolbar,data:{trixMutable:!0},childNodes:s({tagName:"div",className:"trix-button-row",childNodes:s({tagName:"span",className:"trix-button-group trix-button-group--actions",childNodes:s({tagName:"button",className:"trix-button trix-button--remove",textContent:r.remove,attributes:{title:r.remove},data:{trixAction:"remove"}})})})}),this.attachment.isPreviewable()&&e.appendChild(s({tagName:"div",className:t.attachmentMetadataContainer,childNodes:s({tagName:"span",className:t.attachmentMetadata,childNodes:[s({tagName:"span",className:t.attachmentName,textContent:this.attachment.getFilename(),attributes:{title:this.attachment.getFilename()}}),s({tagName:"span",className:t.attachmentSize,textContent:this.attachment.getFormattedFilesize()})]})})),n("click",{onElement:e,withCallback:this.didClickToolbar}),n("click",{onElement:e,matchingSelector:"[data-trix-action]",withCallback:this.didClickActionButton}),{do:function(t){return function(){return t.element.appendChild(e)}}(this),undo:function(){return o.removeNode(e)}}})),h.prototype.installCaptionEditor=p((function(){var i,a,u,c,l;return(c=s({tagName:"textarea",className:t.attachmentCaptionEditor,attributes:{placeholder:r.captionPlaceholder},data:{trixMutable:!0}})).value=this.attachmentPiece.getCaption(),(l=c.cloneNode()).classList.add("trix-autoresize-clone"),l.tabIndex=-1,i=function(){return l.value=c.value,c.style.height=l.scrollHeight+"px"},n("input",{onElement:c,withCallback:i}),n("input",{onElement:c,withCallback:this.didInputCaption}),n("keydown",{onElement:c,withCallback:this.didKeyDownCaption}),n("change",{onElement:c,withCallback:this.didChangeCaption}),n("blur",{onElement:c,withCallback:this.didBlurCaption}),u=this.element.querySelector("figcaption"),a=u.cloneNode(),{do:function(n){return function(){return u.style.display="none",a.appendChild(c),a.appendChild(l),a.classList.add(t.attachmentCaption+"--editing"),u.parentElement.insertBefore(a,u),i(),n.options.editCaption?e((function(){return c.focus()})):void 0}}(this),undo:function(){return o.removeNode(a),u.style.display=null}}})),h.prototype.didClickToolbar=function(t){return t.preventDefault(),t.stopPropagation()},h.prototype.didClickActionButton=function(t){var e;if("remove"===t.target.getAttribute("data-trix-action"))return null!=(e=this.delegate)?e.attachmentEditorDidRequestRemovalOfAttachment(this.attachment):void 0},h.prototype.didKeyDownCaption=function(t){var e;return"return"===i[t.keyCode]?(t.preventDefault(),this.savePendingCaption(),null!=(e=this.delegate)&&"function"==typeof e.attachmentEditorDidRequestDeselectingAttachment?e.attachmentEditorDidRequestDeselectingAttachment(this.attachment):void 0):void 0},h.prototype.didInputCaption=function(t){return this.pendingCaption=t.target.value.replace(/\s/g," ").trim()},h.prototype.didChangeCaption=function(){return this.savePendingCaption()},h.prototype.didBlurCaption=function(){return this.savePendingCaption()},h}(o.BasicObject)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;n=o.makeElement,t=o.config.css,o.AttachmentView=function(r){function s(){s.__super__.constructor.apply(this,arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}var a;return i(s,r),s.attachmentSelector="[data-trix-attachment]",s.prototype.createContentNodes=function(){return[]},s.prototype.createNodes=function(){var e,i,r,o,s,u,c;if(e=o=n({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),(i=this.getHref())&&(o=n({tagName:"a",editable:!1,attributes:{href:i,tabindex:-1}}),e.appendChild(o)),this.attachment.hasContent())o.innerHTML=this.attachment.getContent();else for(r=0,s=(c=this.createContentNodes()).length;s>r;r++)u=c[r],o.appendChild(u);return o.appendChild(this.createCaptionElement()),this.attachment.isPending()&&(this.progressElement=n({tagName:"progress",attributes:{class:t.attachmentProgress,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:["progressElement",this.attachment.id].join("/")}}),e.appendChild(this.progressElement)),[a("left"),e,a("right")]},s.prototype.createCaptionElement=function(){var e,i,r,o,s,a,u;return r=n({tagName:"figcaption",className:t.attachmentCaption}),(e=this.attachmentPiece.getCaption())?(r.classList.add(t.attachmentCaption+"--edited"),r.textContent=e):((i=this.getCaptionConfig()).name&&(o=this.attachment.getFilename()),i.size&&(a=this.attachment.getFormattedFilesize()),o&&(s=n({tagName:"span",className:t.attachmentName,textContent:o}),r.appendChild(s)),a&&(o&&r.appendChild(document.createTextNode(" ")),u=n({tagName:"span",className:t.attachmentSize,textContent:a}),r.appendChild(u))),r},s.prototype.getClassName=function(){var e,n;return n=[t.attachment,t.attachment+"--"+this.attachment.getType()],(e=this.attachment.getExtension())&&n.push(t.attachment+"--"+e),n.join(" ")},s.prototype.getData=function(){var t,e;return e={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:this.attachment.id},(t=this.attachmentPiece.attributes).isEmpty()||(e.trixAttributes=JSON.stringify(t)),this.attachment.isPending()&&(e.trixSerialize=!1),e},s.prototype.getHref=function(){return e(this.attachment.getContent(),"a")?void 0:this.attachment.getHref()},s.prototype.getCaptionConfig=function(){var t,e,n;return n=this.attachment.getType(),t=o.copyObject(null!=(e=o.config.attachments[n])?e.caption:void 0),"file"===n&&(t.name=!0),t},s.prototype.findProgressElement=function(){var t;return null!=(t=this.findElement())?t.querySelector("progress"):void 0},a=function(t){return n({tagName:"span",textContent:o.ZERO_WIDTH_SPACE,data:{trixCursorTarget:t,trixSerialize:!1}})},s.prototype.attachmentDidChangeUploadProgress=function(){var t,e;return e=this.attachment.getUploadProgress(),null!=(t=this.findProgressElement())?t.value=e:void 0},s}(o.ObjectView),e=function(t,e){var i;return(i=n("div")).innerHTML=null!=t?t:"",i.querySelector(e)}}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=o.makeElement,o.PreviewableAttachmentView=function(n){function i(){i.__super__.constructor.apply(this,arguments),this.attachment.previewDelegate=this}return e(i,n),i.prototype.createContentNodes=function(){return this.image=t({tagName:"img",attributes:{src:""},data:{trixMutable:!0}}),this.refresh(this.image),[this.image]},i.prototype.createCaptionElement=function(){var t;return(t=i.__super__.createCaptionElement.apply(this,arguments)).textContent||t.setAttribute("data-trix-placeholder",o.config.lang.captionPlaceholder),t},i.prototype.refresh=function(t){var e;return null==t&&(t=null!=(e=this.findElement())?e.querySelector("img"):void 0),t?this.updateAttributesForImage(t):void 0},i.prototype.updateAttributesForImage=function(t){var e,n,i,r,o,s;return o=this.attachment.getURL(),n=this.attachment.getPreviewURL(),t.src=n||o,n===o?t.removeAttribute("data-trix-serialized-attributes"):(i=JSON.stringify({src:o}),t.setAttribute("data-trix-serialized-attributes",i)),s=this.attachment.getWidth(),e=this.attachment.getHeight(),null!=s&&(t.width=s),null!=e&&(t.height=e),r=["imageElement",this.attachment.id,t.src,t.width,t.height].join("/"),t.dataset.trixStoreKey=r},i.prototype.attachmentDidChangeAttributes=function(){return this.refresh(this.image),this.refresh()},i}(o.AttachmentView)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;n=o.makeElement,t=o.findInnerElement,e=o.getTextConfig,o.PieceView=function(r){function s(){var t;s.__super__.constructor.apply(this,arguments),this.piece=this.object,this.attributes=this.piece.getAttributes(),t=this.options,this.textConfig=t.textConfig,this.context=t.context,this.piece.attachment?this.attachment=this.piece.attachment:this.string=this.piece.toString()}var a;return i(s,r),s.prototype.createNodes=function(){var e,n,i,r,o,s;if(s=this.attachment?this.createAttachmentNodes():this.createStringNodes(),e=this.createElement()){for(i=t(e),n=0,r=s.length;r>n;n++)o=s[n],i.appendChild(o);s=[e]}return s},s.prototype.createAttachmentNodes=function(){var t;return t=this.attachment.isPreviewable()?o.PreviewableAttachmentView:o.AttachmentView,this.createChildView(t,this.piece.attachment,{piece:this.piece}).getNodes()},s.prototype.createStringNodes=function(){var t,e,i,r,o,s,a,u,c;if(null!=(a=this.textConfig)?a.plaintext:void 0)return[document.createTextNode(this.string)];for(s=[],i=e=0,r=(u=this.string.split("\n")).length;r>e;i=++e)c=u[i],i>0&&(t=n("br"),s.push(t)),c.length&&(o=document.createTextNode(this.preserveSpaces(c)),s.push(o));return s},s.prototype.createElement=function(){var t,i,r,o,s,a,u,c,l;for(o in c={},a=this.attributes)if(l=a[o],(t=e(o))&&(t.tagName&&(s=n(t.tagName),r?(r.appendChild(s),r=s):i=r=s),t.styleProperty&&(c[t.styleProperty]=l),t.style))for(o in u=t.style)l=u[o],c[o]=l;if(Object.keys(c).length)for(o in null==i&&(i=n("span")),c)l=c[o],i.style[o]=l;return i},s.prototype.createContainerElement=function(){var t,i,r,o,s;for(r in o=this.attributes)if(s=o[r],(i=e(r))&&i.groupTagName)return(t={})[r]=s,n(i.groupTagName,t)},a=o.NON_BREAKING_SPACE,s.prototype.preserveSpaces=function(t){return this.context.isLast&&(t=t.replace(/\ $/,a)),t=t.replace(/(\S)\ {3}(\S)/g,"$1 "+a+" $2").replace(/\ {2}/g,a+" ").replace(/\ {2}/g," "+a),(this.context.isFirst||this.context.followsWhitespace)&&(t=t.replace(/^\ /,a)),t},s}(o.ObjectView)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;o.TextView=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.text=this.object,this.textConfig=this.options.textConfig}var i;return t(n,e),n.prototype.createNodes=function(){var t,e,n,r,s,a,u,c,l,h;for(a=[],r=(c=o.ObjectGroup.groupObjects(this.getPieces())).length-1,n=e=0,s=c.length;s>e;n=++e)u=c[n],t={},0===n&&(t.isFirst=!0),n===r&&(t.isLast=!0),i(l)&&(t.followsWhitespace=!0),h=this.findOrCreateCachedChildView(o.PieceView,u,{textConfig:this.textConfig,context:t}),a.push.apply(a,h.getNodes()),l=u;return a},n.prototype.getPieces=function(){var t,e,n,i,r;for(r=[],t=0,e=(i=this.text.getPieces()).length;e>t;t++)(n=i[t]).hasAttribute("blockBreak")||r.push(n);return r},i=function(t){return/\s$/.test(null!=t?t.toString():void 0)},n}(o.ObjectView)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;n=o.makeElement,e=o.getBlockConfig,t=o.config.css,o.BlockView=function(r){function s(){s.__super__.constructor.apply(this,arguments),this.block=this.object,this.attributes=this.block.getAttributes()}return i(s,r),s.prototype.createNodes=function(){var t,i,r,s,a,u,c,l,h,p;if(u=[document.createComment("block")],this.block.isEmpty()?u.push(n("br")):(h=null!=(c=e(this.block.getLastAttribute()))?c.text:void 0,p=this.findOrCreateCachedChildView(o.TextView,this.block.text,{textConfig:h}),u.push.apply(u,p.getNodes()),this.shouldAddExtraNewlineElement()&&u.push(n("br"))),this.attributes.length)return u;for(l=o.config.blockAttributes.default.tagName,this.block.isRTL()&&(t={dir:"rtl"}),i=n({tagName:l,attributes:t}),r=0,s=u.length;s>r;r++)a=u[r],i.appendChild(a);return[i]},s.prototype.createContainerElement=function(i){var r,o,s,a,u;return r=this.attributes[i],u=e(r).tagName,0===i&&this.block.isRTL()&&(o={dir:"rtl"}),"attachmentGallery"===r&&(a=this.block.getBlockBreakPosition(),s=t.attachmentGallery+" "+t.attachmentGallery+"--"+a),n({tagName:u,className:s,attributes:o})},s.prototype.shouldAddExtraNewlineElement=function(){return/\n\n$/.test(this.block.toString())},s}(o.ObjectView)}.call(this),function(){var t,e,n=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=o.defer,e=o.makeElement,o.DocumentView=function(i){function r(){r.__super__.constructor.apply(this,arguments),this.element=this.options.element,this.elementStore=new o.ElementStore,this.setDocument(this.object)}var s,a,u;return n(r,i),r.render=function(t){var n,i;return(i=new this(t,{element:n=e("div")})).render(),i.sync(),n},r.prototype.setDocument=function(t){return t.isEqualTo(this.document)?void 0:this.document=this.object=t},r.prototype.render=function(){var t,n,i,r,s,a,u;if(this.childViews=[],this.shadowElement=e("div"),!this.document.isEmpty()){for(a=[],t=0,n=(s=o.ObjectGroup.groupObjects(this.document.getBlocks(),{asTree:!0})).length;n>t;t++)r=s[t],u=this.findOrCreateCachedChildView(o.BlockView,r),a.push(function(){var t,e,n,r;for(r=[],t=0,e=(n=u.getNodes()).length;e>t;t++)i=n[t],r.push(this.shadowElement.appendChild(i));return r}.call(this));return a}},r.prototype.isSynced=function(){return s(this.shadowElement,this.element)},r.prototype.sync=function(){var t;for(t=this.createDocumentFragmentForSync();this.element.lastChild;)this.element.removeChild(this.element.lastChild);return this.element.appendChild(t),this.didSync()},r.prototype.didSync=function(){return this.elementStore.reset(a(this.element)),t(function(t){return function(){return t.garbageCollectCachedViews()}}(this))},r.prototype.createDocumentFragmentForSync=function(){var t,e,n,i,r,o,s,u,c,l;for(e=document.createDocumentFragment(),n=0,r=(u=this.shadowElement.childNodes).length;r>n;n++)s=u[n],e.appendChild(s.cloneNode(!0));for(i=0,o=(c=a(e)).length;o>i;i++)t=c[i],(l=this.elementStore.remove(t))&&t.parentNode.replaceChild(l,t);return e},a=function(t){return t.querySelectorAll("[data-trix-store-key]")},s=function(t,e){return u(t.innerHTML)===u(e.innerHTML)},u=function(t){return t.replace(/ /g," ")},r}(o.ObjectView)}.call(this),function(){var t,e,n,i,r,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function n(){this.constructor=t}for(var i in e)u.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;n=o.findClosestElementFromNode,i=o.handleEvent,r=o.innerElementIsActive,e=o.defer,t=o.AttachmentView.attachmentSelector,o.CompositionController=function(u){function c(e,n){this.element=e,this.composition=n,this.didClickAttachment=s(this.didClickAttachment,this),this.didBlur=s(this.didBlur,this),this.didFocus=s(this.didFocus,this),this.documentView=new o.DocumentView(this.composition.document,{element:this.element}),i("focus",{onElement:this.element,withCallback:this.didFocus}),i("blur",{onElement:this.element,withCallback:this.didBlur}),i("click",{onElement:this.element,matchingSelector:"a[contenteditable=false]",preventDefault:!0}),i("mousedown",{onElement:this.element,matchingSelector:t,withCallback:this.didClickAttachment}),i("click",{onElement:this.element,matchingSelector:"a"+t,preventDefault:!0})}return a(c,u),c.prototype.didFocus=function(){var t,e,n;return t=function(t){return function(){var e;return t.focused?void 0:(t.focused=!0,null!=(e=t.delegate)&&"function"==typeof e.compositionControllerDidFocus?e.compositionControllerDidFocus():void 0)}}(this),null!=(e=null!=(n=this.blurPromise)?n.then(t):void 0)?e:t()},c.prototype.didBlur=function(){return this.blurPromise=new Promise(function(t){return function(n){return e((function(){var e;return r(t.element)||(t.focused=null,null!=(e=t.delegate)&&"function"==typeof e.compositionControllerDidBlur&&e.compositionControllerDidBlur()),t.blurPromise=null,n()}))}}(this))},c.prototype.didClickAttachment=function(t,e){var i,r,o;return i=this.findAttachmentForElement(e),r=null!=n(t.target,{matchingSelector:"figcaption"}),null!=(o=this.delegate)&&"function"==typeof o.compositionControllerDidSelectAttachment?o.compositionControllerDidSelectAttachment(i,{editCaption:r}):void 0},c.prototype.getSerializableElement=function(){return this.isEditingAttachment()?this.documentView.shadowElement:this.element},c.prototype.render=function(){var t,e,n;return this.revision!==this.composition.revision&&(this.documentView.setDocument(this.composition.document),this.documentView.render(),this.revision=this.composition.revision),this.canSyncDocumentView()&&!this.documentView.isSynced()&&(null!=(t=this.delegate)&&"function"==typeof t.compositionControllerWillSyncDocumentView&&t.compositionControllerWillSyncDocumentView(),this.documentView.sync(),null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidSyncDocumentView&&e.compositionControllerDidSyncDocumentView()),null!=(n=this.delegate)&&"function"==typeof n.compositionControllerDidRender?n.compositionControllerDidRender():void 0},c.prototype.rerenderViewForObject=function(t){return this.invalidateViewForObject(t),this.render()},c.prototype.invalidateViewForObject=function(t){return this.documentView.invalidateViewForObject(t)},c.prototype.isViewCachingEnabled=function(){return this.documentView.isViewCachingEnabled()},c.prototype.enableViewCaching=function(){return this.documentView.enableViewCaching()},c.prototype.disableViewCaching=function(){return this.documentView.disableViewCaching()},c.prototype.refreshViewCache=function(){return this.documentView.garbageCollectCachedViews()},c.prototype.isEditingAttachment=function(){return null!=this.attachmentEditor},c.prototype.installAttachmentEditorForAttachment=function(t,e){var n,i,r;if((null!=(r=this.attachmentEditor)?r.attachment:void 0)!==t&&(i=this.documentView.findElementForObject(t)))return this.uninstallAttachmentEditor(),n=this.composition.document.getAttachmentPieceForAttachment(t),this.attachmentEditor=new o.AttachmentEditorController(n,i,this.element,e),this.attachmentEditor.delegate=this},c.prototype.uninstallAttachmentEditor=function(){var t;return null!=(t=this.attachmentEditor)?t.uninstall():void 0},c.prototype.didUninstallAttachmentEditor=function(){return this.attachmentEditor=null,this.render()},c.prototype.attachmentEditorDidRequestUpdatingAttributesForAttachment=function(t,e){var n;return null!=(n=this.delegate)&&"function"==typeof n.compositionControllerWillUpdateAttachment&&n.compositionControllerWillUpdateAttachment(e),this.composition.updateAttributesForAttachment(t,e)},c.prototype.attachmentEditorDidRequestRemovingAttributeForAttachment=function(t,e){var n;return null!=(n=this.delegate)&&"function"==typeof n.compositionControllerWillUpdateAttachment&&n.compositionControllerWillUpdateAttachment(e),this.composition.removeAttributeForAttachment(t,e)},c.prototype.attachmentEditorDidRequestRemovalOfAttachment=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidRequestRemovalOfAttachment?e.compositionControllerDidRequestRemovalOfAttachment(t):void 0},c.prototype.attachmentEditorDidRequestDeselectingAttachment=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidRequestDeselectingAttachment?e.compositionControllerDidRequestDeselectingAttachment(t):void 0},c.prototype.canSyncDocumentView=function(){return!this.isEditingAttachment()},c.prototype.findAttachmentForElement=function(t){return this.composition.document.getAttachmentById(parseInt(t.dataset.trixId,10))},c}(o.BasicObject)}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;e=o.handleEvent,n=o.triggerEvent,t=o.findClosestElementFromNode,o.ToolbarController=function(o){function s(t){this.element=t,this.didKeyDownDialogInput=i(this.didKeyDownDialogInput,this),this.didClickDialogButton=i(this.didClickDialogButton,this),this.didClickAttributeButton=i(this.didClickAttributeButton,this),this.didClickActionButton=i(this.didClickActionButton,this),this.attributes={},this.actions={},this.resetDialogInputs(),e("mousedown",{onElement:this.element,matchingSelector:a,withCallback:this.didClickActionButton}),e("mousedown",{onElement:this.element,matchingSelector:u,withCallback:this.didClickAttributeButton}),e("click",{onElement:this.element,matchingSelector:m,preventDefault:!0}),e("click",{onElement:this.element,matchingSelector:c,withCallback:this.didClickDialogButton}),e("keydown",{onElement:this.element,matchingSelector:l,withCallback:this.didKeyDownDialogInput})}var a,u,c,l,h,p,d,f,g,m;return r(s,o),m=(u="[data-trix-attribute]")+", "+(a="[data-trix-action]"),(h="[data-trix-dialog]")+"[data-trix-active]",c=h+" [data-trix-method]",l=h+" [data-trix-input]",s.prototype.didClickActionButton=function(t,e){var n,i,r;return null!=(i=this.delegate)&&i.toolbarDidClickButton(),t.preventDefault(),n=p(e),this.getDialog(n)?this.toggleDialog(n):null!=(r=this.delegate)?r.toolbarDidInvokeAction(n):void 0},s.prototype.didClickAttributeButton=function(t,e){var n,i,r;return null!=(i=this.delegate)&&i.toolbarDidClickButton(),t.preventDefault(),n=d(e),this.getDialog(n)?this.toggleDialog(n):null!=(r=this.delegate)&&r.toolbarDidToggleAttribute(n),this.refreshAttributeButtons()},s.prototype.didClickDialogButton=function(e,n){var i;return i=t(n,{matchingSelector:h}),this[n.getAttribute("data-trix-method")].call(this,i)},s.prototype.didKeyDownDialogInput=function(t,e){var n,i;return 13===t.keyCode&&(t.preventDefault(),n=e.getAttribute("name"),i=this.getDialog(n),this.setAttribute(i)),27===t.keyCode?(t.preventDefault(),this.hideDialog()):void 0},s.prototype.updateActions=function(t){return this.actions=t,this.refreshActionButtons()},s.prototype.refreshActionButtons=function(){return this.eachActionButton(function(t){return function(e,n){return e.disabled=!1===t.actions[n]}}(this))},s.prototype.eachActionButton=function(t){var e,n,i,r,o;for(o=[],n=0,i=(r=this.element.querySelectorAll(a)).length;i>n;n++)e=r[n],o.push(t(e,p(e)));return o},s.prototype.updateAttributes=function(t){return this.attributes=t,this.refreshAttributeButtons()},s.prototype.refreshAttributeButtons=function(){return this.eachAttributeButton(function(t){return function(e,n){return e.disabled=!1===t.attributes[n],t.attributes[n]||t.dialogIsVisible(n)?(e.setAttribute("data-trix-active",""),e.classList.add("trix-active")):(e.removeAttribute("data-trix-active"),e.classList.remove("trix-active"))}}(this))},s.prototype.eachAttributeButton=function(t){var e,n,i,r,o;for(o=[],n=0,i=(r=this.element.querySelectorAll(u)).length;i>n;n++)e=r[n],o.push(t(e,d(e)));return o},s.prototype.applyKeyboardCommand=function(t){var e,i,r,o,s,a;for(o=JSON.stringify(t.sort()),r=0,s=(a=this.element.querySelectorAll("[data-trix-key]")).length;s>r;r++)if(i=(e=a[r]).getAttribute("data-trix-key").split("+"),JSON.stringify(i.sort())===o)return n("mousedown",{onElement:e}),!0;return!1},s.prototype.dialogIsVisible=function(t){var e;return(e=this.getDialog(t))?e.hasAttribute("data-trix-active"):void 0},s.prototype.toggleDialog=function(t){return this.dialogIsVisible(t)?this.hideDialog():this.showDialog(t)},s.prototype.showDialog=function(t){var e,n,i,r,o,s,a,u,c;for(this.hideDialog(),null!=(s=this.delegate)&&s.toolbarWillShowDialog(),(n=this.getDialog(t)).setAttribute("data-trix-active",""),n.classList.add("trix-active"),i=0,o=(a=n.querySelectorAll("input[disabled]")).length;o>i;i++)a[i].removeAttribute("disabled");return(e=d(n))&&(r=g(n,t))&&(r.value=null!=(u=this.attributes[e])?u:"",r.select()),null!=(c=this.delegate)?c.toolbarDidShowDialog(t):void 0},s.prototype.setAttribute=function(t){var e,n,i;return e=d(t),(n=g(t,e)).willValidate&&!n.checkValidity()?(n.setAttribute("data-trix-validate",""),n.classList.add("trix-validate"),n.focus()):(null!=(i=this.delegate)&&i.toolbarDidUpdateAttribute(e,n.value),this.hideDialog())},s.prototype.removeAttribute=function(t){var e,n;return e=d(t),null!=(n=this.delegate)&&n.toolbarDidRemoveAttribute(e),this.hideDialog()},s.prototype.hideDialog=function(){var t,e;return(t=this.element.querySelector("[data-trix-dialog][data-trix-active]"))?(t.removeAttribute("data-trix-active"),t.classList.remove("trix-active"),this.resetDialogInputs(),null!=(e=this.delegate)?e.toolbarDidHideDialog(f(t)):void 0):void 0},s.prototype.resetDialogInputs=function(){var t,e,n,i,r;for(r=[],t=0,n=(i=this.element.querySelectorAll(l)).length;n>t;t++)(e=i[t]).setAttribute("disabled","disabled"),e.removeAttribute("data-trix-validate"),r.push(e.classList.remove("trix-validate"));return r},s.prototype.getDialog=function(t){return this.element.querySelector("[data-trix-dialog="+t+"]")},g=function(t,e){return null==e&&(e=d(t)),t.querySelector("[data-trix-input][name='"+e+"']")},p=function(t){return t.getAttribute("data-trix-action")},d=function(t){var e;return null!=(e=t.getAttribute("data-trix-attribute"))?e:t.getAttribute("data-trix-dialog-attribute")},f=function(t){return t.getAttribute("data-trix-dialog")},s}(o.BasicObject)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;o.ImagePreloadOperation=function(e){function n(t){this.url=t}return t(n,e),n.prototype.perform=function(t){var e;return(e=new Image).onload=function(n){return function(){return e.width=n.width=e.naturalWidth,e.height=n.height=e.naturalHeight,t(!0,e)}}(this),e.onerror=function(){return t(!1)},e.src=this.url},n}(o.Operation)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;o.Attachment=function(n){function i(e){null==e&&(e={}),this.releaseFile=t(this.releaseFile,this),i.__super__.constructor.apply(this,arguments),this.attributes=o.Hash.box(e),this.didChangeAttributes()}return e(i,n),i.previewablePattern=/^image(\/(gif|png|jpe?g)|$)/,i.attachmentForFile=function(t){var e;return(e=new this(this.attributesForFile(t))).setFile(t),e},i.attributesForFile=function(t){return new o.Hash({filename:t.name,filesize:t.size,contentType:t.type})},i.fromJSON=function(t){return new this(t)},i.prototype.getAttribute=function(t){return this.attributes.get(t)},i.prototype.hasAttribute=function(t){return this.attributes.has(t)},i.prototype.getAttributes=function(){return this.attributes.toObject()},i.prototype.setAttributes=function(t){var e,n,i;return null==t&&(t={}),e=this.attributes.merge(t),this.attributes.isEqualTo(e)?void 0:(this.attributes=e,this.didChangeAttributes(),null!=(n=this.previewDelegate)&&"function"==typeof n.attachmentDidChangeAttributes&&n.attachmentDidChangeAttributes(this),null!=(i=this.delegate)&&"function"==typeof i.attachmentDidChangeAttributes?i.attachmentDidChangeAttributes(this):void 0)},i.prototype.didChangeAttributes=function(){return this.isPreviewable()?this.preloadURL():void 0},i.prototype.isPending=function(){return null!=this.file&&!(this.getURL()||this.getHref())},i.prototype.isPreviewable=function(){return this.attributes.has("previewable")?this.attributes.get("previewable"):this.constructor.previewablePattern.test(this.getContentType())},i.prototype.getType=function(){return this.hasContent()?"content":this.isPreviewable()?"preview":"file"},i.prototype.getURL=function(){return this.attributes.get("url")},i.prototype.getHref=function(){return this.attributes.get("href")},i.prototype.getFilename=function(){var t;return null!=(t=this.attributes.get("filename"))?t:""},i.prototype.getFilesize=function(){return this.attributes.get("filesize")},i.prototype.getFormattedFilesize=function(){var t;return"number"==typeof(t=this.attributes.get("filesize"))?o.config.fileSize.formatter(t):""},i.prototype.getExtension=function(){var t;return null!=(t=this.getFilename().match(/\.(\w+)$/))?t[1].toLowerCase():void 0},i.prototype.getContentType=function(){return this.attributes.get("contentType")},i.prototype.hasContent=function(){return this.attributes.has("content")},i.prototype.getContent=function(){return this.attributes.get("content")},i.prototype.getWidth=function(){return this.attributes.get("width")},i.prototype.getHeight=function(){return this.attributes.get("height")},i.prototype.getFile=function(){return this.file},i.prototype.setFile=function(t){return this.file=t,this.isPreviewable()?this.preloadFile():void 0},i.prototype.releaseFile=function(){return this.releasePreloadedFile(),this.file=null},i.prototype.getUploadProgress=function(){var t;return null!=(t=this.uploadProgress)?t:0},i.prototype.setUploadProgress=function(t){var e;return this.uploadProgress!==t?(this.uploadProgress=t,null!=(e=this.uploadProgressDelegate)&&"function"==typeof e.attachmentDidChangeUploadProgress?e.attachmentDidChangeUploadProgress(this):void 0):void 0},i.prototype.toJSON=function(){return this.getAttributes()},i.prototype.getCacheKey=function(){return[i.__super__.getCacheKey.apply(this,arguments),this.attributes.getCacheKey(),this.getPreviewURL()].join("/")},i.prototype.getPreviewURL=function(){return this.previewURL||this.preloadingURL},i.prototype.setPreviewURL=function(t){var e,n;return t!==this.getPreviewURL()?(this.previewURL=t,null!=(e=this.previewDelegate)&&"function"==typeof e.attachmentDidChangeAttributes&&e.attachmentDidChangeAttributes(this),null!=(n=this.delegate)&&"function"==typeof n.attachmentDidChangePreviewURL?n.attachmentDidChangePreviewURL(this):void 0):void 0},i.prototype.preloadURL=function(){return this.preload(this.getURL(),this.releaseFile)},i.prototype.preloadFile=function(){return this.file?(this.fileObjectURL=URL.createObjectURL(this.file),this.preload(this.fileObjectURL)):void 0},i.prototype.releasePreloadedFile=function(){return this.fileObjectURL?(URL.revokeObjectURL(this.fileObjectURL),this.fileObjectURL=null):void 0},i.prototype.preload=function(t,e){return t&&t!==this.getPreviewURL()?(this.preloadingURL=t,new o.ImagePreloadOperation(t).then(function(n){return function(i){var r,o;return o=i.width,r=i.height,n.getWidth()&&n.getHeight()||n.setAttributes({width:o,height:r}),n.preloadingURL=null,n.setPreviewURL(t),"function"==typeof e?e():void 0}}(this)).catch(function(t){return function(){return t.preloadingURL=null,"function"==typeof e?e():void 0}}(this))):void 0},i}(o.Object)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;o.Piece=function(e){function n(t,e){null==e&&(e={}),n.__super__.constructor.apply(this,arguments),this.attributes=o.Hash.box(e)}return t(n,e),n.types={},n.registerType=function(t,e){return e.type=t,this.types[t]=e},n.fromJSON=function(t){var e;return(e=this.types[t.type])?e.fromJSON(t):void 0},n.prototype.copyWithAttributes=function(t){return new this.constructor(this.getValue(),t)},n.prototype.copyWithAdditionalAttributes=function(t){return this.copyWithAttributes(this.attributes.merge(t))},n.prototype.copyWithoutAttribute=function(t){return this.copyWithAttributes(this.attributes.remove(t))},n.prototype.copy=function(){return this.copyWithAttributes(this.attributes)},n.prototype.getAttribute=function(t){return this.attributes.get(t)},n.prototype.getAttributesHash=function(){return this.attributes},n.prototype.getAttributes=function(){return this.attributes.toObject()},n.prototype.getCommonAttributes=function(){var t,e,n;return(n=pieceList.getPieceAtIndex(0))?(t=n.attributes,e=t.getKeys(),pieceList.eachPiece((function(n){return e=t.getKeysCommonToHash(n.attributes),t=t.slice(e)})),t.toObject()):{}},n.prototype.hasAttribute=function(t){return this.attributes.has(t)},n.prototype.hasSameStringValueAsPiece=function(t){return null!=t&&this.toString()===t.toString()},n.prototype.hasSameAttributesAsPiece=function(t){return null!=t&&(this.attributes===t.attributes||this.attributes.isEqualTo(t.attributes))},n.prototype.isBlockBreak=function(){return!1},n.prototype.isEqualTo=function(t){return n.__super__.isEqualTo.apply(this,arguments)||this.hasSameConstructorAs(t)&&this.hasSameStringValueAsPiece(t)&&this.hasSameAttributesAsPiece(t)},n.prototype.isEmpty=function(){return 0===this.length},n.prototype.isSerializable=function(){return!0},n.prototype.toJSON=function(){return{type:this.constructor.type,attributes:this.getAttributes()}},n.prototype.contentsForInspection=function(){return{type:this.constructor.type,attributes:this.attributes.inspect()}},n.prototype.canBeGrouped=function(){return this.hasAttribute("href")},n.prototype.canBeGroupedWith=function(t){return this.getAttribute("href")===t.getAttribute("href")},n.prototype.getLength=function(){return this.length},n.prototype.canBeConsolidatedWith=function(){return!1},n}(o.Object)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;o.Piece.registerType("attachment",o.AttachmentPiece=function(e){function n(t){this.attachment=t,n.__super__.constructor.apply(this,arguments),this.length=1,this.ensureAttachmentExclusivelyHasAttribute("href"),this.attachment.hasContent()||this.removeProhibitedAttributes()}return t(n,e),n.fromJSON=function(t){return new this(o.Attachment.fromJSON(t.attachment),t.attributes)},n.permittedAttributes=["caption","presentation"],n.prototype.ensureAttachmentExclusivelyHasAttribute=function(t){return this.hasAttribute(t)?(this.attachment.hasAttribute(t)||this.attachment.setAttributes(this.attributes.slice(t)),this.attributes=this.attributes.remove(t)):void 0},n.prototype.removeProhibitedAttributes=function(){var t;return(t=this.attributes.slice(this.constructor.permittedAttributes)).isEqualTo(this.attributes)?void 0:this.attributes=t},n.prototype.getValue=function(){return this.attachment},n.prototype.isSerializable=function(){return!this.attachment.isPending()},n.prototype.getCaption=function(){var t;return null!=(t=this.attributes.get("caption"))?t:""},n.prototype.isEqualTo=function(t){var e;return n.__super__.isEqualTo.apply(this,arguments)&&this.attachment.id===(null!=t&&null!=(e=t.attachment)?e.id:void 0)},n.prototype.toString=function(){return o.OBJECT_REPLACEMENT_CHARACTER},n.prototype.toJSON=function(){var t;return(t=n.__super__.toJSON.apply(this,arguments)).attachment=this.attachment,t},n.prototype.getCacheKey=function(){return[n.__super__.getCacheKey.apply(this,arguments),this.attachment.getCacheKey()].join("/")},n.prototype.toConsole=function(){return JSON.stringify(this.toString())},n}(o.Piece))}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=o.normalizeNewlines,o.Piece.registerType("string",o.StringPiece=function(n){function i(e){i.__super__.constructor.apply(this,arguments),this.string=t(e),this.length=this.string.length}return e(i,n),i.fromJSON=function(t){return new this(t.string,t.attributes)},i.prototype.getValue=function(){return this.string},i.prototype.toString=function(){return this.string.toString()},i.prototype.isBlockBreak=function(){return"\n"===this.toString()&&!0===this.getAttribute("blockBreak")},i.prototype.toJSON=function(){var t;return(t=i.__super__.toJSON.apply(this,arguments)).string=this.string,t},i.prototype.canBeConsolidatedWith=function(t){return null!=t&&this.hasSameConstructorAs(t)&&this.hasSameAttributesAsPiece(t)},i.prototype.consolidateWith=function(t){return new this.constructor(this.toString()+t.toString(),this.attributes)},i.prototype.splitAtOffset=function(t){var e,n;return 0===t?(e=null,n=this):t===this.length?(e=this,n=null):(e=new this.constructor(this.string.slice(0,t),this.attributes),n=new this.constructor(this.string.slice(t),this.attributes)),[e,n]},i.prototype.toConsole=function(){var t;return(t=this.string).length>15&&(t=t.slice(0,14)+"…"),JSON.stringify(t.toString())},i}(o.Piece))}.call(this),function(){var t,e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty,i=[].slice;t=o.spliceArray,o.SplittableList=function(n){function r(t){null==t&&(t=[]),r.__super__.constructor.apply(this,arguments),this.objects=t.slice(0),this.length=this.objects.length}var o,s,a;return e(r,n),r.box=function(t){return t instanceof this?t:new this(t)},r.prototype.indexOf=function(t){return this.objects.indexOf(t)},r.prototype.splice=function(){var e;return e=1<=arguments.length?i.call(arguments,0):[],new this.constructor(t.apply(null,[this.objects].concat(i.call(e))))},r.prototype.eachObject=function(t){var e,n,i,r,o,s;for(s=[],n=e=0,i=(o=this.objects).length;i>e;n=++e)r=o[n],s.push(t(r,n));return s},r.prototype.insertObjectAtIndex=function(t,e){return this.splice(e,0,t)},r.prototype.insertSplittableListAtIndex=function(t,e){return this.splice.apply(this,[e,0].concat(i.call(t.objects)))},r.prototype.insertSplittableListAtPosition=function(t,e){var n,i,r;return i=(r=this.splitObjectAtPosition(e))[0],n=r[1],new this.constructor(i).insertSplittableListAtIndex(t,n)},r.prototype.editObjectAtIndex=function(t,e){return this.replaceObjectAtIndex(e(this.objects[t]),t)},r.prototype.replaceObjectAtIndex=function(t,e){return this.splice(e,1,t)},r.prototype.removeObjectAtIndex=function(t){return this.splice(t,1)},r.prototype.getObjectAtIndex=function(t){return this.objects[t]},r.prototype.getSplittableListInRange=function(t){var e,n,i,r;return n=(i=this.splitObjectsAtRange(t))[0],e=i[1],r=i[2],new this.constructor(n.slice(e,r+1))},r.prototype.selectSplittableList=function(t){var e,n;return n=function(){var n,i,r,o;for(o=[],n=0,i=(r=this.objects).length;i>n;n++)e=r[n],t(e)&&o.push(e);return o}.call(this),new this.constructor(n)},r.prototype.removeObjectsInRange=function(t){var e,n,i,r;return n=(i=this.splitObjectsAtRange(t))[0],e=i[1],r=i[2],new this.constructor(n).splice(e,r-e+1)},r.prototype.transformObjectsInRange=function(t,e){var n,i,r,o,s,a,u;return s=this.splitObjectsAtRange(t),o=s[0],i=s[1],a=s[2],u=function(){var t,s,u;for(u=[],n=t=0,s=o.length;s>t;n=++t)r=o[n],u.push(n>=i&&a>=n?e(r):r);return u}(),new this.constructor(u)},r.prototype.splitObjectsAtRange=function(t){var e,n,i,r,s;return n=(r=this.splitObjectAtPosition(a(t)))[0],e=r[1],i=r[2],[n=(s=new this.constructor(n).splitObjectAtPosition(o(t)+i))[0],e,s[1]-1]},r.prototype.getObjectAtPosition=function(t){var e,n;return e=(n=this.findIndexAndOffsetAtPosition(t)).index,n.offset,this.objects[e]},r.prototype.splitObjectAtPosition=function(t){var e,n,i,r,o,s,a,u,c;return e=(o=this.findIndexAndOffsetAtPosition(t)).index,r=o.offset,i=this.objects.slice(0),null!=e?0===r?(u=e,c=0):(n=(s=this.getObjectAtIndex(e).splitAtOffset(r))[0],a=s[1],i.splice(e,1,n,a),u=e+1,c=n.getLength()-r):(u=i.length,c=0),[i,u,c]},r.prototype.consolidate=function(){var t,e,n,i,r,o;for(i=[],r=this.objects[0],t=0,e=(o=this.objects.slice(1)).length;e>t;t++)n=o[t],("function"==typeof r.canBeConsolidatedWith?r.canBeConsolidatedWith(n):void 0)?r=r.consolidateWith(n):(i.push(r),r=n);return null!=r&&i.push(r),new this.constructor(i)},r.prototype.consolidateFromIndexToIndex=function(t,e){var n,r;return r=this.objects.slice(0).slice(t,e+1),n=new this.constructor(r).consolidate().toArray(),this.splice.apply(this,[t,r.length].concat(i.call(n)))},r.prototype.findIndexAndOffsetAtPosition=function(t){var e,n,i,r,o,s;for(e=0,i=n=0,r=(s=this.objects).length;r>n;i=++n){if(o=e+s[i].getLength(),t>=e&&o>t)return{index:i,offset:t-e};e=o}return{index:null,offset:null}},r.prototype.findPositionAtIndexAndOffset=function(t,e){var n,i,r,o,s,a;for(s=0,n=i=0,r=(a=this.objects).length;r>i;n=++i)if(o=a[n],t>n)s+=o.getLength();else if(n===t){s+=e;break}return s},r.prototype.getEndPosition=function(){var t,e;return null!=this.endPosition?this.endPosition:this.endPosition=function(){var n,i,r;for(e=0,n=0,i=(r=this.objects).length;i>n;n++)t=r[n],e+=t.getLength();return e}.call(this)},r.prototype.toString=function(){return this.objects.join("")},r.prototype.toArray=function(){return this.objects.slice(0)},r.prototype.toJSON=function(){return this.toArray()},r.prototype.isEqualTo=function(t){return r.__super__.isEqualTo.apply(this,arguments)||s(this.objects,null!=t?t.objects:void 0)},s=function(t,e){var n,i,r,o,s;if(null==e&&(e=[]),t.length!==e.length)return!1;for(s=!0,i=n=0,r=t.length;r>n;i=++n)o=t[i],s&&!o.isEqualTo(e[i])&&(s=!1);return s},r.prototype.contentsForInspection=function(){var t;return{objects:"["+function(){var e,n,i,r;for(r=[],e=0,n=(i=this.objects).length;n>e;e++)t=i[e],r.push(t.inspect());return r}.call(this).join(", ")+"]"}},a=function(t){return t[0]},o=function(t){return t[1]},r}(o.Object)}.call(this),function(){var t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},e={}.hasOwnProperty;o.Text=function(e){function n(t){var e;null==t&&(t=[]),n.__super__.constructor.apply(this,arguments),this.pieceList=new o.SplittableList(function(){var n,i,r;for(r=[],n=0,i=t.length;i>n;n++)(e=t[n]).isEmpty()||r.push(e);return r}())}return t(n,e),n.textForAttachmentWithAttributes=function(t,e){return new this([new o.AttachmentPiece(t,e)])},n.textForStringWithAttributes=function(t,e){return new this([new o.StringPiece(t,e)])},n.fromJSON=function(t){var e;return new this(function(){var n,i,r;for(r=[],n=0,i=t.length;i>n;n++)e=t[n],r.push(o.Piece.fromJSON(e));return r}())},n.prototype.copy=function(){return this.copyWithPieceList(this.pieceList)},n.prototype.copyWithPieceList=function(t){return new this.constructor(t.consolidate().toArray())},n.prototype.copyUsingObjectMap=function(t){var e,n;return n=function(){var n,i,r,o,s;for(s=[],n=0,i=(r=this.getPieces()).length;i>n;n++)e=r[n],s.push(null!=(o=t.find(e))?o:e);return s}.call(this),new this.constructor(n)},n.prototype.appendText=function(t){return this.insertTextAtPosition(t,this.getLength())},n.prototype.insertTextAtPosition=function(t,e){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(t.pieceList,e))},n.prototype.removeTextAtRange=function(t){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(t))},n.prototype.replaceTextAtRange=function(t,e){return this.removeTextAtRange(e).insertTextAtPosition(t,e[0])},n.prototype.moveTextFromRangeToPosition=function(t,e){var n,i;if(!(t[0]<=e&&e<=t[1]))return n=(i=this.getTextAtRange(t)).getLength(),t[0]t;t++)e=i[t],r.push(e.getAttributes());return r}.call(this),o.Hash.fromCommonAttributesOfObjects(t).toObject()},n.prototype.getCommonAttributesAtRange=function(t){var e;return null!=(e=this.getTextAtRange(t).getCommonAttributes())?e:{}},n.prototype.getExpandedRangeForAttributeAtOffset=function(t,e){var n,i,r;for(n=r=e,i=this.getLength();n>0&&this.getCommonAttributesAtRange([n-1,r])[t];)n--;for(;i>r&&this.getCommonAttributesAtRange([e,r+1])[t];)r++;return[n,r]},n.prototype.getTextAtRange=function(t){return this.copyWithPieceList(this.pieceList.getSplittableListInRange(t))},n.prototype.getStringAtRange=function(t){return this.pieceList.getSplittableListInRange(t).toString()},n.prototype.getStringAtPosition=function(t){return this.getStringAtRange([t,t+1])},n.prototype.startsWithString=function(t){return this.getStringAtRange([0,t.length])===t},n.prototype.endsWithString=function(t){var e;return e=this.getLength(),this.getStringAtRange([e-t.length,e])===t},n.prototype.getAttachmentPieces=function(){var t,e,n,i,r;for(r=[],t=0,e=(i=this.pieceList.toArray()).length;e>t;t++)null!=(n=i[t]).attachment&&r.push(n);return r},n.prototype.getAttachments=function(){var t,e,n,i,r;for(r=[],t=0,e=(i=this.getAttachmentPieces()).length;e>t;t++)n=i[t],r.push(n.attachment);return r},n.prototype.getAttachmentAndPositionById=function(t){var e,n,i,r,o,s;for(r=0,e=0,n=(o=this.pieceList.toArray()).length;n>e;e++){if((null!=(s=(i=o[e]).attachment)?s.id:void 0)===t)return{attachment:i.attachment,position:r};r+=i.length}return{attachment:null,position:null}},n.prototype.getAttachmentById=function(t){var e,n;return e=(n=this.getAttachmentAndPositionById(t)).attachment,n.position,e},n.prototype.getRangeOfAttachment=function(t){var e,n;return t=(n=this.getAttachmentAndPositionById(t.id)).attachment,e=n.position,null!=t?[e,e+1]:void 0},n.prototype.updateAttributesForAttachment=function(t,e){var n;return(n=this.getRangeOfAttachment(e))?this.addAttributesAtRange(t,n):this},n.prototype.getLength=function(){return this.pieceList.getEndPosition()},n.prototype.isEmpty=function(){return 0===this.getLength()},n.prototype.isEqualTo=function(t){var e;return n.__super__.isEqualTo.apply(this,arguments)||(null!=t&&null!=(e=t.pieceList)?e.isEqualTo(this.pieceList):void 0)},n.prototype.isBlockBreak=function(){return 1===this.getLength()&&this.pieceList.getObjectAtIndex(0).isBlockBreak()},n.prototype.eachPiece=function(t){return this.pieceList.eachObject(t)},n.prototype.getPieces=function(){return this.pieceList.toArray()},n.prototype.getPieceAtPosition=function(t){return this.pieceList.getObjectAtPosition(t)},n.prototype.contentsForInspection=function(){return{pieceList:this.pieceList.inspect()}},n.prototype.toSerializableText=function(){var t;return t=this.pieceList.selectSplittableList((function(t){return t.isSerializable()})),this.copyWithPieceList(t)},n.prototype.toString=function(){return this.pieceList.toString()},n.prototype.toJSON=function(){return this.pieceList.toJSON()},n.prototype.toConsole=function(){var t;return JSON.stringify(function(){var e,n,i,r;for(r=[],e=0,n=(i=this.pieceList.toArray()).length;n>e;e++)t=i[e],r.push(JSON.parse(t.toConsole()));return r}.call(this))},n.prototype.getDirection=function(){return o.getDirection(this.toString())},n.prototype.isRTL=function(){return"rtl"===this.getDirection()},n}(o.Object)}.call(this),function(){var t,e,n,i,r=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},u=[].slice;t=o.arraysAreEqual,i=o.spliceArray,e=o.getBlockConfig,o.getBlockAttributeNames,n=o.getListAttributeNames,o.Block=function(s){function c(t,e){null==t&&(t=new o.Text),null==e&&(e=[]),c.__super__.constructor.apply(this,arguments),this.text=h(t),this.attributes=e}var l,h,p,d,f,g,m,y,v;return r(c,s),c.fromJSON=function(t){return new this(o.Text.fromJSON(t.text),t.attributes)},c.prototype.isEmpty=function(){return this.text.isBlockBreak()},c.prototype.isEqualTo=function(e){return c.__super__.isEqualTo.apply(this,arguments)||this.text.isEqualTo(null!=e?e.text:void 0)&&t(this.attributes,null!=e?e.attributes:void 0)},c.prototype.copyWithText=function(t){return new this.constructor(t,this.attributes)},c.prototype.copyWithoutText=function(){return this.copyWithText(null)},c.prototype.copyWithAttributes=function(t){return new this.constructor(this.text,t)},c.prototype.copyWithoutAttributes=function(){return this.copyWithAttributes(null)},c.prototype.copyUsingObjectMap=function(t){var e;return this.copyWithText((e=t.find(this.text))?e:this.text.copyUsingObjectMap(t))},c.prototype.addAttribute=function(t){var e;return e=this.attributes.concat(d(t)),this.copyWithAttributes(e)},c.prototype.removeAttribute=function(t){var n,i;return i=e(t).listAttribute,n=g(g(this.attributes,t),i),this.copyWithAttributes(n)},c.prototype.removeLastAttribute=function(){return this.removeAttribute(this.getLastAttribute())},c.prototype.getLastAttribute=function(){return f(this.attributes)},c.prototype.getAttributes=function(){return this.attributes.slice(0)},c.prototype.getAttributeLevel=function(){return this.attributes.length},c.prototype.getAttributeAtLevel=function(t){return this.attributes[t-1]},c.prototype.hasAttribute=function(t){return a.call(this.attributes,t)>=0},c.prototype.hasAttributes=function(){return this.getAttributeLevel()>0},c.prototype.getLastNestableAttribute=function(){return f(this.getNestableAttributes())},c.prototype.getNestableAttributes=function(){var t,n,i,r,o;for(o=[],n=0,i=(r=this.attributes).length;i>n;n++)t=r[n],e(t).nestable&&o.push(t);return o},c.prototype.getNestingLevel=function(){return this.getNestableAttributes().length},c.prototype.decreaseNestingLevel=function(){var t;return(t=this.getLastNestableAttribute())?this.removeAttribute(t):this},c.prototype.increaseNestingLevel=function(){var t,e,n;return(t=this.getLastNestableAttribute())?(n=this.attributes.lastIndexOf(t),e=i.apply(null,[this.attributes,n+1,0].concat(u.call(d(t)))),this.copyWithAttributes(e)):this},c.prototype.getListItemAttributes=function(){var t,n,i,r,o;for(o=[],n=0,i=(r=this.attributes).length;i>n;n++)t=r[n],e(t).listAttribute&&o.push(t);return o},c.prototype.isListItem=function(){var t;return null!=(t=e(this.getLastAttribute()))?t.listAttribute:void 0},c.prototype.isTerminalBlock=function(){var t;return null!=(t=e(this.getLastAttribute()))?t.terminal:void 0},c.prototype.breaksOnReturn=function(){var t;return null!=(t=e(this.getLastAttribute()))?t.breakOnReturn:void 0},c.prototype.findLineBreakInDirectionFromPosition=function(t,e){var n,i;return i=this.toString(),-1!==(n=function(){switch(t){case"forward":return i.indexOf("\n",e);case"backward":return i.slice(0,e).lastIndexOf("\n")}}())?n:void 0},c.prototype.contentsForInspection=function(){return{text:this.text.inspect(),attributes:this.attributes}},c.prototype.toString=function(){return this.text.toString()},c.prototype.toJSON=function(){return{text:this.text,attributes:this.attributes}},c.prototype.getDirection=function(){return this.text.getDirection()},c.prototype.isRTL=function(){return this.text.isRTL()},c.prototype.getLength=function(){return this.text.getLength()},c.prototype.canBeConsolidatedWith=function(t){return!this.hasAttributes()&&!t.hasAttributes()&&this.getDirection()===t.getDirection()},c.prototype.consolidateWith=function(t){var e,n;return e=o.Text.textForStringWithAttributes("\n"),n=this.getTextWithoutBlockBreak().appendText(e),this.copyWithText(n.appendText(t.text))},c.prototype.splitAtOffset=function(t){var e,n;return 0===t?(e=null,n=this):t===this.getLength()?(e=this,n=null):(e=this.copyWithText(this.text.getTextAtRange([0,t])),n=this.copyWithText(this.text.getTextAtRange([t,this.getLength()]))),[e,n]},c.prototype.getBlockBreakPosition=function(){return this.text.getLength()-1},c.prototype.getTextWithoutBlockBreak=function(){return m(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()},c.prototype.canBeGrouped=function(t){return this.attributes[t]},c.prototype.canBeGroupedWith=function(t,i){var r,o,s,u;return o=(s=t.getAttributes())[i],!((r=this.attributes[i])!==o||!1===e(r).group&&(u=s[i+1],a.call(n(),u)<0)||this.getDirection()!==t.getDirection()&&!t.isEmpty())},h=function(t){return t=v(t),l(t)},v=function(t){var e,n,i,r,s,a;return r=!1,a=t.getPieces(),n=2<=a.length?u.call(a,0,e=a.length-1):(e=0,[]),null==(i=a[e++])?t:(n=function(){var t,e,i;for(i=[],t=0,e=n.length;e>t;t++)(s=n[t]).isBlockBreak()?(r=!0,i.push(y(s))):i.push(s);return i}(),r?new o.Text(u.call(n).concat([i])):t)},p=o.Text.textForStringWithAttributes("\n",{blockBreak:!0}),l=function(t){return m(t)?t:t.appendText(p)},m=function(t){var e;return 0!==(e=t.getLength())&&t.getTextAtRange([e-1,e]).isBlockBreak()},y=function(t){return t.copyWithoutAttribute("blockBreak")},d=function(t){var n;return null!=(n=e(t).listAttribute)?[n,t]:[t]},f=function(t){return t.slice(-1)[0]},g=function(t,e){var n;return-1===(n=t.lastIndexOf(e))?t:i(t,n,1)},c}(o.Object)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty,s=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},a=[].slice;e=o.tagName,n=o.walkTree,t=o.nodeIsAttachmentElement,o.HTMLSanitizer=function(r){function u(t,e){var n;n=null!=e?e:{},this.allowedAttributes=n.allowedAttributes,this.forbiddenProtocols=n.forbiddenProtocols,this.forbiddenElements=n.forbiddenElements,null==this.allowedAttributes&&(this.allowedAttributes=c),null==this.forbiddenProtocols&&(this.forbiddenProtocols=h),null==this.forbiddenElements&&(this.forbiddenElements=l),this.body=p(t)}var c,l,h,p;return i(u,r),c="style href src width height class".split(" "),h="javascript:".split(" "),l="script iframe".split(" "),u.sanitize=function(t,e){var n;return(n=new this(t,e)).sanitize(),n},u.prototype.sanitize=function(){return this.sanitizeElements(),this.normalizeListElementNesting()},u.prototype.getHTML=function(){return this.body.innerHTML},u.prototype.getBody=function(){return this.body},u.prototype.sanitizeElements=function(){var t,e,i,r,s;for(s=n(this.body),r=[];s.nextNode();)switch(i=s.currentNode,i.nodeType){case Node.ELEMENT_NODE:this.elementIsRemovable(i)?r.push(i):this.sanitizeElement(i);break;case Node.COMMENT_NODE:r.push(i)}for(t=0,e=r.length;e>t;t++)i=r[t],o.removeNode(i);return this.body},u.prototype.sanitizeElement=function(t){var e,n,i,r,o;for(t.hasAttribute("href")&&(r=t.protocol,s.call(this.forbiddenProtocols,r)>=0&&t.removeAttribute("href")),e=0,n=(o=a.call(t.attributes)).length;n>e;e++)i=o[e].name,s.call(this.allowedAttributes,i)>=0||0===i.indexOf("data-trix")||t.removeAttribute(i);return t},u.prototype.normalizeListElementNesting=function(){var t,n,i,r,o;for(t=0,n=(o=a.call(this.body.querySelectorAll("ul,ol"))).length;n>t;t++)(r=(i=o[t]).previousElementSibling)&&"li"===e(r)&&r.appendChild(i);return this.body},u.prototype.elementIsRemovable=function(t){return(null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE?this.elementIsForbidden(t)||this.elementIsntSerializable(t):void 0},u.prototype.elementIsForbidden=function(t){var n;return n=e(t),s.call(this.forbiddenElements,n)>=0},u.prototype.elementIsntSerializable=function(e){return"false"===e.getAttribute("data-trix-serialize")&&!t(e)},p=function(t){var e,n,i,r,o;for(null==t&&(t=""),t=t.replace(/<\/html[^>]*>[^]*$/i,"