From 80a8f3c33ed8302390a953678bcc24a9654a6b4a Mon Sep 17 00:00:00 2001 From: Abhay Nikam Date: Wed, 29 Jul 2020 13:55:08 +0530 Subject: [PATCH] Release V1.0.5 --- CHANGELOG.md | 2 ++ dist/index.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11d97dc6..aeb4462f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master (unreleased) +## 1.0.5 (29-July-2020) + * Add ability to allow Rails direct uploading via Trix Editor. ([@abhaynikam][]) * Add options to configure placeholder and autofocus for Trix Editor. ([@abhaynikam][]) diff --git a/dist/index.js b/dist/index.js index 29cab3bc..5e359b99 100644 --- a/dist/index.js +++ b/dist/index.js @@ -8,4 +8,4 @@ * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ -"undefined"==typeof WeakMap&&function(){var t=Object.defineProperty,e=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+e+++"__"};n.prototype={set:function(e,n){var r=e[this.name];return r&&r[0]===e?r[1]=n:t(e,this.name,{value:[e,n],writable:!0}),this},get:function(t){var e;return(e=t[this.name])&&e[0]===t?e[1]:void 0},delete:function(t){var e=t[this.name];return!(!e||e[0]!==t)&&(e[0]=e[1]=void 0,!0)},has:function(t){var e=t[this.name];return!!e&&e[0]===t}},window.WeakMap=n}(),function(t){function e(t){v.push(t),m||(m=!0,l(n))}function n(){m=!1;var t=v;v=[],t.sort((function(t,e){return t.uid_-e.uid_}));var e=!1;t.forEach((function(t){var n=t.takeRecords();(function(t){t.nodes_.forEach((function(e){var n=h.get(e);n&&n.forEach((function(e){e.observer===t&&e.removeTransientObservers()}))}))})(t),n.length&&(t.callback_(n,t),e=!0)})),e&&n()}function r(t,e){for(var n=t;n;n=n.parentNode){var r=h.get(n);if(r)for(var i=0;i0){var i=u(n[r-1],t);if(i)return void(n[r-1]=i)}else e(this.observer);n[r]=t},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(t){var e=this.options;e.attributes&&t.addEventListener("DOMAttrModified",this,!0),e.characterData&&t.addEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.addEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(t){var e=this.options;e.attributes&&t.removeEventListener("DOMAttrModified",this,!0),e.characterData&&t.removeEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.removeEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(t){if(t!==this.target){this.addListeners_(t),this.transientObservedNodes.push(t);var e=h.get(t);e||h.set(t,e=[]),e.push(this)}},removeTransientObservers:function(){var t=this.transientObservedNodes;this.transientObservedNodes=[],t.forEach((function(t){this.removeListeners_(t);for(var e=h.get(t),n=0;n=0)){i.push(e);for(var o,a=e.querySelectorAll("link[rel="+r+"]"),s=0,u=a.length;u>s&&(o=a[s]);s++)o.import&&t(o.import,n,i);n(e)}}(t,e,[])},t.forSubtree=e})),window.CustomElements.addModule((function(t){function e(t,e){return n(t,e)||r(t,e)}function n(e,n){return!!t.upgrade(e,n)||void(n&&a(e))}function r(t,e){f(t,(function(t){return!!n(t,e)||void 0}))}function i(t){y.push(t),v||(v=!0,setTimeout(o))}function o(){v=!1;for(var t,e=y,n=0,r=e.length;r>n&&(t=e[n]);n++)t();y=[]}function a(t){m?i((function(){s(t)})):s(t)}function s(t){t.__upgraded__&&!t.__attached&&(t.__attached=!0,t.attachedCallback&&t.attachedCallback())}function u(t){m?i((function(){c(t)})):c(t)}function c(t){t.__upgraded__&&t.__attached&&(t.__attached=!1,t.detachedCallback&&t.detachedCallback())}function l(t,n){if(d.dom){var r=n[0];if(r&&"childList"===r.type&&r.addedNodes&&r.addedNodes){for(var i=r.addedNodes[0];i&&i!==document&&!i.host;)i=i.parentNode;var o=i&&(i.URL||i._URL||i.host&&i.host.localName)||"";o=o.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",n.length,o||"")}var a=function(t){for(var e=t,n=window.wrap(document);e;){if(e==n)return!0;e=e.parentNode||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host}}(t);n.forEach((function(t){"childList"===t.type&&(b(t.addedNodes,(function(t){t.localName&&e(t,a)})),b(t.removedNodes,(function(t){t.localName&&function(t){u(t),f(t,(function(t){u(t)}))}(t)})))})),d.dom&&console.groupEnd()}function h(t){if(!t.__observer){var e=new MutationObserver(l.bind(this,t));e.observe(t,{childList:!0,subtree:!0}),t.__observer=e}}function p(t){t=window.wrap(t),d.dom&&console.group("upgradeDocument: ",t.baseURI.split("/").pop()),e(t,t===window.wrap(document)),h(t),d.dom&&console.groupEnd()}var d=t.flags,f=t.forSubtree,g=t.forDocumentTree,m=window.MutationObserver._isPolyfilled&&d["throttle-attached"];t.hasPolyfillMutations=m,t.hasThrottledAttached=m;var v=!1,y=[],b=Array.prototype.forEach.call.bind(Array.prototype.forEach),x=Element.prototype.createShadowRoot;x&&(Element.prototype.createShadowRoot=function(){var t=x.call(this);return window.CustomElements.watchShadow(this),t}),t.watchShadow=function(t){if(t.shadowRoot&&!t.shadowRoot.__watched){d.dom&&console.log("watching shadow-root for: ",t.localName);for(var e=t.shadowRoot;e;)h(e),e=e.olderShadowRoot}},t.upgradeDocumentTree=function(t){g(t,p)},t.upgradeDocument=p,t.upgradeSubtree=r,t.upgradeAll=e,t.attached=a,t.takeRecords=function(t){for((t=window.wrap(t))||(t=window.wrap(document));t.parentNode;)t=t.parentNode;var e=t.__observer;e&&(l(t,e.takeRecords()),o())}})),window.CustomElements.addModule((function(t){function e(e,i,o){return r.upgrade&&console.group("upgrade:",e.localName),i.is&&e.setAttribute("is",i.is),n(e,i),e.__upgraded__=!0,function(t){t.createdCallback&&t.createdCallback()}(e),o&&t.attached(e),t.upgradeSubtree(e,o),r.upgrade&&console.groupEnd(),e}function n(t,e){Object.__proto__||function(t,e,n){for(var r={},i=e;i!==n&&i!==HTMLElement.prototype;){for(var o,a=Object.getOwnPropertyNames(i),s=0;o=a[s];s++)r[o]||(Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(i,o)),r[o]=1);i=Object.getPrototypeOf(i)}}(t,e.prototype,e.native),t.__proto__=e.prototype}var r=t.flags;t.upgrade=function(n,r){if("template"===n.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(n),!n.__upgraded__&&n.nodeType===Node.ELEMENT_NODE){var i=n.getAttribute("is"),o=t.getRegisteredDefinition(n.localName)||t.getRegisteredDefinition(i);if(o&&(i&&o.tag==n.localName||!i&&!o.extends))return e(n,o,r)}},t.upgradeWithDefinition=e,t.implementPrototype=n})),window.CustomElements.addModule((function(t){function e(t){if(!t.setAttribute._polyfilled){var e=t.setAttribute;t.setAttribute=function(t,r){n.call(this,t,r,e)};var r=t.removeAttribute;t.removeAttribute=function(t){n.call(this,t,null,r)},t.setAttribute._polyfilled=!0}}function n(t,e,n){t=t.toLowerCase();var r=this.getAttribute(t);n.apply(this,arguments);var i=this.getAttribute(t);this.attributeChangedCallback&&i!==r&&this.attributeChangedCallback(t,r,i)}function r(t){return t?f[t.toLowerCase()]:void 0}function i(t){return function(){return function(t){return l(m(t.tag),t)}(t)}}function o(t,e){t&&(t=t.toLowerCase()),e&&(e=e.toLowerCase());var n,i=r(e||t);if(i){if(t==i.tag&&e==i.is)return new i.ctor;if(!e&&!i.is)return new i.ctor}return e?((n=o(t)).setAttribute("is",e),n):(n=m(t),t.indexOf("-")>=0&&h(n,HTMLElement),n)}function a(t,e){var n=t[e];t[e]=function(){var t=n.apply(this,arguments);return c(t),t}}var s,u=(t.isIE,t.upgradeDocumentTree),c=t.upgradeAll,l=t.upgradeWithDefinition,h=t.implementPrototype,p=t.useNative,d=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],f={},g="http://www.w3.org/1999/xhtml",m=document.createElement.bind(document),v=document.createElementNS.bind(document);s=Object.__proto__||p?function(t,e){return t instanceof e}:function(t,e){if(t instanceof e)return!0;for(var n=t;n;){if(n===e.prototype)return!0;n=n.__proto__}return!1},a(Node.prototype,"cloneNode"),a(document,"importNode"),document.registerElement=function(n,o){var a=o||{};if(!n)throw new Error("document.registerElement: first argument `name` must not be empty");if(n.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(n)+"'.");if(function(t){for(var e=0;et;t++)if(!(n[t]in InputEvent.prototype))return!1;return!0}()},config:{}}}).call(this)}).call(this);var r=this.Trix;(function(){(function(){r.BasicObject=function(){function t(){}var e,n,r;return t.proxyMethod=function(t){var r,i,o,a,s;return o=n(t),r=o.name,a=o.toMethod,s=o.toProperty,i=o.optional,this.prototype[r]=function(){var t,n;return t=null!=a?i?"function"==typeof this[a]?this[a]():void 0:this[a]():null!=s?this[s]:void 0,i?null!=(n=null!=t?t[r]:void 0)?e.call(n,t,arguments):void 0:(n=t[r],e.call(n,t,arguments))}},n=function(t){var e,n;if(!(n=t.match(r)))throw new Error("can't parse @proxyMethod expression: "+t);return e={name:n[4]},null!=n[2]?e.toMethod=n[1]:e.toProperty=n[1],null!=n[3]&&(e.optional=!0),e},e=Function.prototype.apply,r=/^(.+?)(\(\))?(\?)?\.(.+?)$/,t}()}).call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.Object=function(e){function n(){this.id=++i}var i;return t(n,e),i=0,n.fromJSONString=function(t){return this.fromJSON(JSON.parse(t))},n.prototype.hasSameConstructorAs=function(t){return this.constructor===(null!=t?t.constructor:void 0)},n.prototype.isEqualTo=function(t){return this===t},n.prototype.inspect=function(){var t,e,n;return t=function(){var t,r,i;for(e in i=[],r=null!=(t=this.contentsForInspection())?t:{})n=r[e],i.push(e+"="+n);return i}.call(this),"#<"+this.constructor.name+":"+this.id+(t.length?" "+t.join(", "):"")+">"},n.prototype.contentsForInspection=function(){},n.prototype.toJSONString=function(){return JSON.stringify(this)},n.prototype.toUTF16String=function(){return r.UTF16String.box(this)},n.prototype.getCacheKey=function(){return this.id.toString()},n}(r.BasicObject)}.call(this),function(){r.extend=function(t){var e,n;for(e in t)n=t[e],this[e]=n;return this}}.call(this),function(){r.extend({defer:function(t){return setTimeout(t,1)}})}.call(this),function(){var t,e;r.extend({normalizeSpaces:function(t){return t.replace(RegExp(""+r.ZERO_WIDTH_SPACE,"g"),"").replace(RegExp(""+r.NON_BREAKING_SPACE,"g")," ")},normalizeNewlines:function(t){return t.replace(/\r\n/g,"\n")},breakableWhitespacePattern:RegExp("[^\\S"+r.NON_BREAKING_SPACE+"]"),squishBreakableWhitespace:function(t){return t.replace(RegExp(""+r.breakableWhitespacePattern.source,"g")," ").replace(/\ {2,}/g," ")},escapeHTML:function(t){var e;return(e=document.createElement("div")).textContent=t,e.innerHTML},summarizeStringChange:function(t,n){var i,o,a,s;return t=r.UTF16String.box(t),(n=r.UTF16String.box(n)).lengthn&&t.charAt(n).isEqualTo(e.charAt(n));)n++;for(;r>n+1&&t.charAt(r-1).isEqualTo(e.charAt(i-1));)r--,i--;return{utf16String:t.slice(n,r),offset:n}}}.call(this),function(){r.extend({copyObject:function(t){var e,n,r;for(e in null==t&&(t={}),n={},t)r=t[e],n[e]=r;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;r.extend({arraysAreEqual:function(t,e){var n,r,i;if(null==t&&(t=[]),null==e&&(e=[]),t.length!==e.length)return!1;for(r=n=0,i=t.length;i>n;r=++n)if(t[r]!==e[r])return!1;return!0},arrayStartsWith:function(t,e){return null==t&&(t=[]),null==e&&(e=[]),r.arraysAreEqual(t.slice(0,e.length),e)},spliceArray:function(){var e,n,r;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],(r=n.slice(0)).splice.apply(r,e),r},summarizeArrayChange:function(t,e){var n,r,i,o,a,s,u,c,l,h,p;for(null==t&&(t=[]),null==e&&(e=[]),n=[],h=[],i=new Set,o=0,u=t.length;u>o;o++)p=t[o],i.add(p);for(r=new Set,a=0,c=e.length;c>a;a++)p=e[a],r.add(p),i.has(p)||n.push(p);for(s=0,l=t.length;l>s;s++)p=t[s],r.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,r.extend({getAllAttributeNames:function(){return null!=t?t:t=r.getTextAttributeNames().concat(r.getBlockAttributeNames())},getBlockConfig:function(t){return r.config.blockAttributes[t]},getBlockAttributeNames:function(){return null!=e?e:e=Object.keys(r.config.blockAttributes)},getTextConfig:function(t){return r.config.textAttributes[t]},getTextAttributeNames:function(){return null!=i?i:i=Object.keys(r.config.textAttributes)},getListAttributeNames:function(){var t,e;return null!=n?n:n=function(){var n,i;for(t in i=[],n=r.config.blockAttributes)null!=(e=n[t].listAttribute)&&i.push(e);return i}()}})}.call(this),function(){var t,e,n,i,o,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=document.documentElement,e=null!=(n=null!=(i=null!=(o=t.matchesSelector)?o:t.webkitMatchesSelector)?i:t.msMatchesSelector)?n:t.mozMatchesSelector,r.extend({handleEvent:function(e,n){var i,o,a,s,u,c,l,h,p,d,f;return u=(l=null!=n?n:{}).onElement,s=l.matchingSelector,f=l.withCallback,a=l.inPhase,c=l.preventDefault,p=l.times,i=null!=u?u:t,h=s,f,d="capturing"===a,(o=function(t){var e;return null!=p&&0==--p&&o.destroy(),null!=(e=r.findClosestElementFromNode(t.target,{matchingSelector:h}))&&(null!=f&&f.call(e,t,e),c)?t.preventDefault():void 0}).destroy=function(){return i.removeEventListener(e,o,d)},i.addEventListener(e,o,d),o},handleEventOnce:function(t,e){return null==e&&(e={}),e.times=1,r.handleEvent(t,e)},triggerEvent:function(e,n){var i,o,a,s,u,c,l;return c=(l=null!=n?n:{}).onElement,o=l.bubbles,a=l.cancelable,i=l.attributes,s=null!=c?c:t,o=!1!==o,a=!1!==a,(u=document.createEvent("Events")).initEvent(e,o,a),null!=i&&r.extend.call(u,i),s.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,o;for(n=(i=null!=e?e:{}).matchingSelector,o=i.untilNode;null!=t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.parentNode;if(null!=t){if(null==n)return t;if(t.closest&&null==o)return t.closest(n);for(;t&&t!==o;){if(r.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&&r.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=r.findNodeFromContainerAndOffset(t,e),r.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,r,i,o,a;return r=(i=null!=e?e:{}).onlyNodesOfType,o=i.usingFilter,n=i.expandEntityReferences,a=function(){switch(r){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,a,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,r,i,o,a,s,u,c,l,h;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(o in s=e.attributes)h=s[o],r.setAttribute(o,h);if(e.style)for(o in u=e.style)h=u[o],r.style[o]=h;if(e.data)for(o in c=e.data)h=c[o],r.dataset[o]=h;if(e.className)for(i=0,a=(l=e.className.split(" ")).length;a>i;i++)n=l[i],r.classList.add(n);return e.textContent&&(r.textContent=e.textContent),r},getBlockTagNames:function(){var t,e;return null!=r.blockTagNames?r.blockTagNames:r.blockTagNames=function(){var n,i;for(t in i=[],n=r.config.blockAttributes)(e=n[t].tagName)&&i.push(e);return i}()},nodeIsBlockContainer:function(t){return r.nodeIsBlockStartComment(null!=t?t.firstChild:void 0)},nodeProbablyIsBlockContainer:function(t){var e,n;return e=r.tagName(t),a.call(r.getBlockTagNames(),e)>=0&&(n=r.tagName(t.firstChild),a.call(r.getBlockTagNames(),n)<0)},nodeIsBlockStart:function(t,e){return(null!=e?e:{strict:!0}).strict?r.nodeIsBlockStartComment(t):r.nodeIsBlockStartComment(t)||!r.nodeIsBlockStartComment(t.firstChild)&&r.nodeProbablyIsBlockContainer(t)},nodeIsBlockStartComment:function(t){return r.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?r.nodeIsTextNode(t)?t.data===r.ZERO_WIDTH_SPACE?!n||t.parentNode.dataset.trixCursorTarget===n:void 0:r.nodeIsCursorTarget(t.firstChild):void 0},nodeIsAttachmentElement:function(t){return r.elementMatchesSelector(t,r.AttachmentView.attachmentSelector)},nodeIsEmptyTextNode:function(t){return r.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,o;t=r.copyObject,i=r.objectsAreEqual,r.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,r,i;if(null!=t)return i=(r=n(t))[0],e=r[1],o(i,e)},rangesAreEqual:function(t,e){var r,i,a,s,u,c;if(null!=t&&null!=e)return i=(a=n(t))[0],r=a[1],c=(s=n(e))[0],u=s[1],o(i,c)&&o(r,u)}}),e=function(e){return"number"==typeof e?e:t(e)},o=function(t,e){return"number"==typeof t?t===e:i(t,e)}}.call(this),function(){var t,e,n,i,o,a,s;r.registerElement=function(t,e){var n,r;return null==e&&(e={}),t=t.toLowerCase(),e=s(e),(n=(r=a(e)).defaultCSS)&&(delete r.defaultCSS,i(n,t)),o(t,r)},i=function(t,e){return n(e).textContent=t.replace(/%t/g,e)},n=function(e){var n,r;return(n=document.createElement("style")).setAttribute("type","text/css"),n.setAttribute("data-tag-name",e.toLowerCase()),(r=t())&&n.setAttribute("nonce",r),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+"]")},a=function(t){var e,n,r;for(e in n={},t)r=t[e],n[e]="function"==typeof r?{value:r}:r;return n},s=function(){var t;return t=function(t){var e,n,r,i,o;for(e={},n=0,i=(o=["initialize","connect","disconnect"]).length;i>n;n++)e[r=o[n]]=t[r],delete t[r];return e},window.customElements?function(e){var n,r,i,o,a;return a=t(e),i=a.initialize,n=a.connect,r=a.disconnect,i&&(o=n,n=function(){return this.initialized||(this.initialized=!0,i.call(this)),null!=o?o.call(this):void 0}),n&&(e.connectedCallback=n),r&&(e.disconnectedCallback=r),e}:function(e){var n,r,i,o;return i=(o=t(e)).initialize,n=o.connect,r=o.disconnect,i&&(e.createdCallback=i),n&&(e.attachedCallback=n),r&&(e.detachedCallback=r),e}}(),o=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,r;return r=Object.create(HTMLElement.prototype,e),n=document.registerElement(t,{prototype:r}),Object.defineProperty(r,"constructor",{value:n}),n}}.call(this),function(){var t,e;r.extend({getDOMSelection:function(){var t;return(t=window.getSelection()).rangeCount>0?t:void 0},getDOMRange:function(){var e,n;return(e=null!=(n=r.getDOMSelection())?n.getRangeAt(0):void 0)&&!t(e)?e:void 0},setDOMRange:function(t){var e;return(e=window.getSelection()).removeAllRanges(),e.addRange(t),r.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"},r.extend({dataTransferIsPlainText:function(t){var e,n,r;return r=t.getData("text/plain"),n=t.getData("text/html"),r&&n?(e=(new DOMParser).parseFromString(n,"text/html").body).textContent===r?!e.querySelector("*"):void 0:null!=r?r.length:void 0},dataTransferIsWritable:function(e){var n,r;if(null!=(null!=e?e.setData:void 0)){for(n in t)if(r=t[n],!function(){try{return e.setData(n,r),e.getData(n)===r}catch(t){}}())return;return!0}},keyEventIsKeyboardCommand:/Mac|^iP/.test(navigator.platform)?function(t){return t.metaKey}:function(t){return t.ctrlKey}})}.call(this),function(){}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=r.arraysAreEqual,r.Hash=function(n){function i(t){null==t&&(t={}),this.values=a(t),i.__super__.constructor.apply(this,arguments)}var o,a,s,u,c;return e(i,n),i.fromCommonAttributesOfObjects=function(t){var e,n,r,i,a,s;if(null==t&&(t=[]),!t.length)return new this;for(r=(e=o(t[0])).getKeys(),n=0,i=(s=t.slice(1)).length;i>n;n++)a=s[n],r=e.getKeysCommonToHash(o(a)),e=e.slice(r);return e},i.box=function(t){return o(t)},i.prototype.add=function(t,e){return this.merge(u(t,e))},i.prototype.remove=function(t){return new r.Hash(a(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 r.Hash(s(this.values,c(t)))},i.prototype.slice=function(t){var e,n,i,o;for(o={},e=0,i=t.length;i>e;e++)n=t[e],this.has(n)&&(o[n]=this.values[n]);return new r.Hash(o)},i.prototype.getKeys=function(){return Object.keys(this.values)},i.prototype.getKeysCommonToHash=function(t){var e,n,r,i,a;for(t=o(t),a=[],e=0,r=(i=this.getKeys()).length;r>e;e++)n=i[e],this.values[n]===t.values[n]&&a.push(n);return a},i.prototype.isEqualTo=function(e){return t(this.toArray(),o(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 r;for(t in e=[],r=this.values)n=r[t],e.push(t,n);return e}.call(this)).slice(0)},i.prototype.toObject=function(){return a(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},s=function(t,e){var n,r,i;for(n in r=a(t),e)i=e[n],r[n]=i;return r},a=function(t,e){var n,r,i,o,a;for(o={},n=0,i=(a=Object.keys(t).sort()).length;i>n;n++)(r=a[n])!==e&&(o[r]=t[r]);return o},o=function(t){return t instanceof r.Hash?t:new r.Hash(t)},c=function(t){return t instanceof r.Hash?t.values:t},i}(r.Object)}.call(this),function(){r.ObjectGroup=function(){function t(t,e){var n,r;this.objects=null!=t?t:[],r=e.depth,(n=e.asTree)&&(this.depth=r,this.objects=this.constructor.groupObjects(this.objects,{asTree:n,depth:this.depth+1}))}return t.groupObjects=function(t,e){var n,r,i,o,a,s,u,c,l;for(null==t&&(t=[]),i=(l=null!=e?e:{}).depth,(n=l.asTree)&&null==i&&(i=0),c=[],a=0,s=t.length;s>a;a++){if(u=t[a],o){if(("function"==typeof u.canBeGrouped?u.canBeGrouped(i):void 0)&&("function"==typeof(r=o[o.length-1]).canBeGroupedWith?r.canBeGroupedWith(u,i):void 0)){o.push(u);continue}c.push(new this(o,{depth:i,asTree:n})),o=null}("function"==typeof u.canBeGrouped?u.canBeGrouped(i):void 0)?o=[u]:c.push(u)}return o&&c.push(new this(o,{depth:i,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,r,i;for(e=["objectGroup"],t=0,n=(i=this.getObjects()).length;n>t;t++)r=i[t],e.push(r.getCacheKey());return e.join("/")},t}()}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.ObjectMap=function(e){function n(t){var e,n,r,i,o;for(null==t&&(t=[]),this.objects={},r=0,i=t.length;i>r;r++)o=t[r],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}(r.BasicObject)}.call(this),function(){r.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,r;return n=e(t),(r=this.elements[n])?(delete this.elements[n],r):void 0},t.prototype.reset=function(t){var e,n,r;for(null==t&&(t=[]),this.elements={},n=0,r=t.length;r>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 r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.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(r,i){return t.succeeded=r,t.performing=!1,t.performed=!0,t.succeeded?e(i):n(i)}))}}(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}(r.BasicObject)}.call(this),function(){var t,e,n,i,o,a={}.hasOwnProperty;r.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 r in e)a.call(e,r)&&(t[r]=e[r]);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(o(t),t)},e.prototype.offsetToUCS2Offset=function(t){return o(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}(r.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,r,i,o;for(i=[],e=0,r=t.length;r>e;)(o=t.charCodeAt(e++))>=55296&&56319>=o&&r>e&&(56320==(64512&(n=t.charCodeAt(e++)))?o=((1023&o)<<10)+(1023&n)+65536:e--),i.push(o);return i},o=n?function(t){return String.fromCodePoint.apply(String,t)}:function(t){var e,n;return function(){var r,i,o;for(o=[],r=0,i=t.length;i>r;r++)n=t[r],e="",n>65535&&(n-=65536,e+=String.fromCharCode(n>>>10&1023|55296),n=56320|1023&n),o.push(e+String.fromCharCode(n));return o}().join("")}}.call(this),function(){}.call(this),function(){}.call(this),function(){r.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(){r.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;r.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 r.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 r.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=r.config.lang,e=[t.bytes,t.KB,t.MB,t.GB,t.TB,t.PB],r.config.fileSize={prefix:"IEC",precision:2,formatter:function(n){var r,i;switch(n){case 0:return"0 "+t.bytes;case 1:return"1 "+t.byte;default:return r=function(){switch(this.prefix){case"SI":return 1e3;case"IEC":return 1024}}.call(this),i=Math.floor(Math.log(n)/Math.log(r)),(n/Math.pow(r,i)).toFixed(this.precision).replace(/0*$/,"").replace(/\.$/,"")+" "+e[i]}}}}.call(this),function(){r.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("+r.AttachmentView.attachmentSelector+")",(e=r.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"),r.extend({serializers:{"application/json":function(t){var e;if(t instanceof r.Document)e=t;else{if(!(t instanceof HTMLElement))throw new Error("unserializable object");e=r.Document.fromHTML(t.innerHTML)}return e.toSerializableDocument().toJSONString()},"text/html":function(i){var o,a,s,u,c,l,h,p,d,f,g,m,v,y,b,x,A;if(i instanceof r.Document)u=r.DocumentView.render(i);else{if(!(i instanceof HTMLElement))throw new Error("unserializable object");u=i.cloneNode(!0)}for(c=0,d=(y=u.querySelectorAll("[data-trix-serialize=false]")).length;d>c;c++)s=y[c],r.removeNode(s);for(l=0,f=n.length;f>l;l++)for(o=n[l],h=0,g=(b=u.querySelectorAll("["+o+"]")).length;g>h;h++)(s=b[h]).removeAttribute(o);for(p=0,m=(x=u.querySelectorAll("[data-trix-serialized-attributes]")).length;m>p;p++){s=x[p];try{for(v in a=JSON.parse(s.getAttribute(e)),s.removeAttribute(e),a)A=a[v],s.setAttribute(v,A)}catch(t){}}return u.innerHTML.replace(t,"")}},deserializers:{"application/json":function(t){return r.Document.fromJSONString(t)},"text/html":function(t){return r.Document.fromHTML(t)}},serializeToContentType:function(t,e){var n;if(n=r.serializers[e])return n(t);throw new Error("unknown content type: "+e)},deserializeFromContentType:function(t,e){var n;if(n=r.deserializers[e])return n(t);throw new Error("unknown content type: "+e)}})}.call(this),function(){var t;t=r.config.lang,r.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
\n \n
'}}}.call(this),function(){r.config.undoInterval=5e3}.call(this),function(){r.config.attachments={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}}}.call(this),function(){r.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(){r.config.input={level2Enabled:!0,getLevel:function(){return this.level2Enabled&&r.browser.supportsInputEvents?2:0},pickFiles:function(t){var e;return(e=r.makeElement("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId})).addEventListener("change",(function(){return t(e.files),r.removeNode(e)})),r.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(){r.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=r.config.toolbar.getDefaultHTML():void 0}})}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,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};r.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,r,i;for(null==this.nodes&&(this.nodes=this.createNodes()),i=[],t=0,e=(r=this.nodes).length;e>t;t++)n=r[t],i.push(n.cloneNode(!0));return i},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 r.ObjectGroup&&(n.viewClass=t,t=r.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,r,i;for(i=[],e=0,n=(r=this.childViews).length;n>e;e++)t=r[e],i.push(t),i=i.concat(t.getAllChildViews());return i},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,r,i;for(e=0,n=(r=this.getAllChildViews()).length;n>e;e++)if((i=r[e]).object===t)return i},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,r,i,o,a;if(t=this.getViewCache()){for(e in a=this.getAllChildViews().concat(this),r=function(){var t,e,n;for(n=[],t=0,e=a.length;e>t;t++)o=a[t],n.push(o.object.getCacheKey());return n}(),i=[],t)n.call(r,e)<0&&i.push(delete t[e]);return i}},i}(r.BasicObject)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.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,r;if(!this.childViews.length)for(t=0,e=(r=this.objectGroup.getObjects()).length;e>t;t++)n=r[t],this.findOrCreateCachedChildView(this.viewClass,n,this.options);return this.childViews},n.prototype.createNodes=function(){var t,e,n,r,i,o,a,s;for(t=this.createContainerElement(),e=0,r=(a=this.getChildViews()).length;r>e;e++)for(n=0,i=(s=a[e].getNodes()).length;i>n;n++)o=s[n],t.appendChild(o);return[t]},n.prototype.createContainerElement=function(t){return null==t&&(t=this.objectGroup.getDepth()),this.getChildViews()[0].createContainerElement(t)},n}(r.ObjectView)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.Controller=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n}(r.BasicObject)}.call(this),function(){var t,e,n,i,o,a,s=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);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=r.findClosestElementFromNode,n=r.nodeIsEmptyTextNode,e=r.nodeIsBlockStartComment,i=r.normalizeSpaces,o=r.summarizeStringChange,a=r.tagName,r.MutationObserver=function(r){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 s(u,r),"["+(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,r,i;for(i=[],e=0,n=t.length;n>e;e++)r=t[e],this.mutationIsSignificant(r)&&i.push(r);return i},u.prototype.mutationIsSignificant=function(t){var e,n,r,i;if(this.nodeIsMutable(t.target))return!1;for(e=0,n=(i=this.nodesModifiedByMutation(t)).length;n>e;e++)if(r=i[e],this.nodeIsSignificant(r))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,r,i,o,a,s,u,l,h;for(n=(s=this.getTextChangesFromCharacterData()).additions,i=s.deletions,o=0,a=(u=(h=this.getTextChangesFromChildList()).additions).length;a>o;o++)e=u[o],c.call(n,e)<0&&n.push(e);return i.push.apply(i,h.deletions),l={},(t=n.join(""))&&(l.textAdded=t),(r=i.join(""))&&(l.textDeleted=r),l},u.prototype.getMutationsByType=function(t){var e,n,r,i,o;for(o=[],e=0,n=(i=this.mutations).length;n>e;e++)(r=i[e]).type===t&&o.push(r);return o},u.prototype.getTextChangesFromChildList=function(){var t,n,r,o,a,s,u,c,h,p;for(t=[],u=[],n=0,o=(s=this.getMutationsByType("childList")).length;o>n;n++)a=s[n],t.push.apply(t,a.addedNodes),u.push.apply(u,a.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,r,a,s,u,c;return(e=this.getMutationsByType("characterData")).length&&(c=e[0],n=e[e.length-1],a=i(c.oldValue),r=i(n.target.data),t=(s=o(a,r)).added,u=s.removed),{additions:t?[t]:[],deletions:u?[u]:[]}},l=function(t){var e,n,r,i;for(null==t&&(t=[]),i=[],e=0,n=t.length;n>e;e++)switch(r=t[e],r.nodeType){case Node.TEXT_NODE:i.push(r.data);break;case Node.ELEMENT_NODE:"br"===a(r)?i.push("\n"):i.push.apply(i,l(r.childNodes))}return i},u}(r.BasicObject)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.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}(r.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=r.handleEvent,e=r.innerElementIsActive,r.InputController=function(i){function o(e){var n;for(n in this.element=e,this.mutationObserver=new r.MutationObserver(this.element),this.mutationObserver.delegate=this,this.events)t(n,{onElement:this.element,withCallback:this.handlerFor(n)})}return n(o,i),o.prototype.events={},o.prototype.elementDidMutate=function(){},o.prototype.editorWillSyncDocumentView=function(){return this.mutationObserver.stop()},o.prototype.editorDidSyncDocumentView=function(){return this.mutationObserver.start()},o.prototype.requestRender=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidRequestRender?t.inputControllerDidRequestRender():void 0},o.prototype.requestReparse=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidRequestReparse&&t.inputControllerDidRequestReparse(),this.requestRender()},o.prototype.attachFiles=function(t){var e,n;return n=function(){var n,i,o;for(o=[],n=0,i=t.length;i>n;n++)e=t[n],o.push(new r.FileVerificationOperation(e));return o}(),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))},o.prototype.handlerFor=function(t){return function(n){return function(r){return r.defaultPrevented?void 0:n.handleInput((function(){return e(this.element)?void 0:(this.eventName=t,this.events[t].call(this,r))}))}}(this)},o.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()}},o}(r.BasicObject)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h,p,d=function(t,e){function n(){this.constructor=t}for(var r in e)f.call(e,r)&&(t[r]=e[r]);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=r.makeElement,l=r.objectsAreEqual,r.tagName,e=r.browser,s=r.keyEventIsKeyboardCommand,i=r.dataTransferIsWritable,n=r.dataTransferIsPlainText,u=r.config.keyNames,r.Level0InputController=function(e){function a(){a.__super__.constructor.apply(this,arguments),this.resetInputSummary()}var f;return d(a,e),f=0,a.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},a.prototype.resetInputSummary=function(){return this.inputSummary={}},a.prototype.reset=function(){return this.resetInputSummary(),r.selectionChangeObserver.reset()},a.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()}))},a.prototype.mutationIsExpected=function(t){var e,n,r,i,o,a,s,u,c;return a=t.textAdded,s=t.textDeleted,!!this.inputSummary.preferDocument||(e=null!=a?a===this.inputSummary.textAdded:!this.inputSummary.textAdded,n=null!=s?this.inputSummary.didDelete:!this.inputSummary.didDelete,c="\n"===s&&!n,!!(((u=("\n"===a||" \n"===a)&&!e)&&!c||c&&!u)&&(i=this.getSelectedRange())&&(r=u?a.replace(/\n$/,"").length||-1:(null!=a?a.length:void 0)||1,null!=(o=this.responder)?o.positionIsBlockBreak(i[1]+r):void 0))||e&&n)},a.prototype.mutationIsSignificant=function(t){var e,n,r;return r=Object.keys(t).length>0,e=""===(null!=(n=this.compositionInput)?n.getEndData():void 0),r||!e},a.prototype.events={keydown:function(t){var e,n,i,o,a,c,l,h,p;if(this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0,o=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[o]:void 0)&&(this.setInputSummary({keyName:o}),r.selectionChangeObserver.reset(),n[o].call(this,t))}return s(t)&&(e=String.fromCharCode(t.keyCode).toLowerCase())&&((a=function(){var e,n,r,i;for(i=[],e=0,n=(r=["alt","shift"]).length;n>e;e++)t[(l=r[e])+"Key"]&&i.push(l);return i}()).push(e),null!=(p=this.delegate)?p.inputControllerDidReceiveKeyboardCommand(a):void 0)?t.preventDefault():void 0},keypress:function(t){var e,n,r;if(null==this.inputSummary.eventName&&!t.metaKey&&(!t.ctrlKey||t.altKey))return(r=p(t))?(null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString(r),this.setInputSummary({textAdded:r,didDelete:this.selectionIsExpanded()})):void 0},textInput:function(t){var e,n,r,i;return e=t.data,(i=this.inputSummary.textAdded)&&i!==e&&i.toUpperCase()===e?(n=this.getSelectedRange(),this.setSelectedRange([n[0],n[1]+i.length]),null!=(r=this.responder)&&r.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,o,a,s,u,c,l;return t.preventDefault(),i=null!=(a=t.dataTransfer)?a.files:void 0,o={x:t.clientX,y:t.clientY},null!=(s=this.responder)&&s.setLocationRangeFromPointRange(o),(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=r.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,a,s,u,c,l,p,d,m,v,y,b,x,A,w,C,E,k,S,D,R;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,r,i;return l.type="text/html",l.html=e,null!=(n=t.delegate)&&n.inputControllerWillPaste(l),null!=(r=t.responder)&&r.insertHTML(l.html),t.requestRender(),null!=(i=t.delegate)?i.inputControllerDidPaste(l):void 0}}(this)):((s=e.getData("URL"))?(l.type="URL",l.href=s,l.string=(c=e.getData("public.url-name"))?r.squishBreakableWhitespace(c).trim():s,null!=(d=this.delegate)&&d.inputControllerWillPaste(l),this.setInputSummary({textAdded:l.string,didDelete:this.selectionIsExpanded()}),null!=(A=this.responder)&&A.insertText(r.Text.textForStringWithAttributes(l.string,{href:l.href})),this.requestRender(),null!=(w=this.delegate)&&w.inputControllerDidPaste(l)):n(e)?(l.type="text/plain",l.string=e.getData("text/plain"),null!=(C=this.delegate)&&C.inputControllerWillPaste(l),this.setInputSummary({textAdded:l.string,didDelete:this.selectionIsExpanded()}),null!=(E=this.responder)&&E.insertString(l.string),this.requestRender(),null!=(k=this.delegate)&&k.inputControllerDidPaste(l)):(u=e.getData("text/html"))?(l.type="text/html",l.html=u,null!=(S=this.delegate)&&S.inputControllerWillPaste(l),null!=(D=this.responder)&&D.insertHTML(l.html),this.requestRender(),null!=(R=this.delegate)&&R.inputControllerDidPaste(l)):g.call(e.types,"Files")>=0&&(a=null!=(m=e.items)&&null!=(v=m[0])&&"function"==typeof v.getAsFile?v.getAsFile():void 0)&&(!a.name&&(i=o(a))&&(a.name="pasted-file-"+ ++f+"."+i),l.type="File",l.file=a,null!=(y=this.delegate)&&y.inputControllerWillAttachFiles(),null!=(b=this.responder)&&b.insertFile(l.file),this.requestRender(),null!=(x=this.delegate)&&x.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()}},a.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}}},a.prototype.getCompositionInput=function(){return this.isComposing()?this.compositionInput:this.compositionInput=new t(this)},a.prototype.isComposing=function(){return null!=this.compositionInput&&!this.compositionInput.isEnded()},a.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},a.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",r.DocumentView.render(e).innerHTML),t.setData("text/plain",e.toString().replace(/\n$/,"")),!0},a.prototype.canAcceptDataTransfer=function(t){var e,n,r,i,o;for(o={},e=0,n=(i=null!=(r=null!=t?t.types:void 0)?r:[]).length;n>e;e++)o[i[e]]=!0;return o.Files||o["application/x-trix-document"]||o["text/html"]||o["text/plain"]},a.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 o;return o=e.innerHTML,r.removeNode(e),i.setSelectedRange(n),t(o)}}(this))},a.proxyMethod("responder?.getSelectedRange"),a.proxyMethod("responder?.setSelectedRange"),a.proxyMethod("responder?.expandSelectionInDirection"),a.proxyMethod("responder?.selectionIsInCursorTarget"),a.proxyMethod("responder?.selectionIsExpanded"),a}(r.InputController),o=function(t){var e,n;return null!=(e=t.type)&&null!=(n=e.match(/\/(\w+)$/))?n[1]:void 0},a=null!=("function"==typeof" ".codePointAt?" ".codePointAt(0):void 0),p=function(t){var e;return t.key&&a&&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]?r.UTF16String.fromCodepoints([e]).toString():void 0)},h=function(t){var e,n,r,i,o,a,s,u,c;if(s=t.clipboardData){if(g.call(s.types,"text/html")>=0){for(r=0,a=(u=s.types).length;a>r;r++)if(c=u[r],e=/^CorePasteboardFlavorType/.test(c),n=/^dyn\./.test(c)&&s.getData(c),e||n)return!0;return!1}return i=g.call(s.types,"com.apple.webarchive")>=0,o=g.call(s.types,"com.apple.flat-rtfd")>=0,i||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,r,i;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!=(r=this.responder)&&r.insertString(this.data.end),null!=(i=this.responder)?i.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}(r.BasicObject)}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},o=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.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};t=r.dataTransferIsPlainText,e=r.keyEventIsKeyboardCommand,n=r.objectsAreEqual,r.Level2InputController=function(a){function u(){return this.render=i(this.render,this),u.__super__.constructor.apply(this,arguments)}var c,l,h,p,d,f;return o(u,a),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,r,i,o;if(e(t)){if(n=l(t),null!=(o=this.delegate)?o.inputControllerDidReceiveKeyboardCommand(n):void 0)return t.preventDefault()}else if(i=t.key,t.altKey&&(i+="+Alt"),t.shiftKey&&(i+="+Shift"),r=this.keys[i])return this.withEvent(t,r)},paste:function(t){var e,n,i,o,a,s,u,c,l;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!=(o=this.responder)&&o.insertString(n.string),this.render(),null!=(a=this.delegate)?a.inputControllerDidPaste(n):void 0):(e=null!=(s=t.clipboardData)?s.getData("URL"):void 0)?(t.preventDefault(),n={type:"URL",href:e,string:e},null!=(u=this.delegate)&&u.inputControllerWillPaste(n),null!=(c=this.responder)&&c.insertText(r.Text.textForStringWithAttributes(n.string,{href:n.href})),this.render(),null!=(l=this.delegate)?l.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 r.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,r;return this.dragging&&(t.preventDefault(),e=d(t),!n(e,this.dragging.point))?(this.dragging.point=e,null!=(r=this.responder)?r.setLocationRangeFromPointRange(e):void 0):void 0},drop:function(t){var e,n,r,i;return this.dragging?(t.preventDefault(),null!=(n=this.delegate)&&n.inputControllerWillMoveText(),null!=(r=this.responder)&&r.moveTextFromRange(this.dragging.range),this.dragging=null,this.scheduleRender()):c(t)?(t.preventDefault(),e=d(t),null!=(i=this.responder)&&i.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,r;for(t in r=[],null!=(e=this.responder)?e.getCurrentAttributes():void 0)r.push(null!=(n=this.responder)?n.removeCurrentAttribute(t):void 0);return r}))},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,o,a,s,u,c,l,h;return e=this.event.dataTransfer,a={dataTransfer:e},(n=e.getData("URL"))?(a.type="URL",a.href=n,a.string=(o=e.getData("public.url-name"))?r.squishBreakableWhitespace(o).trim():n,null!=(s=this.delegate)&&s.inputControllerWillPaste(a),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertText(r.Text.textForStringWithAttributes(a.string,{href:a.href})):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(a):void 0}}(this)):t(e)?(a.type="text/plain",a.string=e.getData("text/plain"),null!=(u=this.delegate)&&u.inputControllerWillPaste(a),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertString(a.string):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(a):void 0}}(this)):(i=e.getData("text/html"))?(a.type="text/html",a.html=i,null!=(c=this.delegate)&&c.inputControllerWillPaste(a),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertHTML(a.html):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(a):void 0}}(this)):(null!=(l=e.files)?l.length:void 0)?(a.type="File",a.file=e.files[0],null!=(h=this.delegate)&&h.inputControllerWillPaste(a),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertFile(a.file):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(a):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 s.call(r.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 s.call(r.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,r,i;return(null!=e?e:{recordUndoEntry:!0}).recordUndoEntry&&null!=(i=this.delegate)&&i.inputControllerWillPerformTyping(),r=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,r):r()},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:(r.selectionChangeObserver.reset(),e.call(this))},u.prototype.getTargetDOMRange=function(t){var e,n,r,i;return r=(null!=t?t:{minLength:0}).minLength,(i="function"==typeof(e=this.event).getTargetRanges?e.getTargetRanges():void 0)&&i.length&&(n=f(i[0]),0===r||n.toString().length>=r)?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 s.call(null!=(e=null!=(n=t.dataTransfer)?n.types:void 0)?e:[],"Files")>=0},h=function(t){var e;return(e=t.clipboardData)?s.call(e.types,"Files")>=0&&1===e.types.length&&e.files.length>=1:void 0},p=function(t){var e;return(e=t.clipboardData)?s.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}(r.InputController)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l=function(t,e){return function(){return t.apply(e,arguments)}},h=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;e=r.defer,n=r.escapeHTML,i=r.handleEvent,s=r.makeElement,c=r.tagName,u=r.config,a=u.lang,t=u.css,o=u.keyNames,r.AttachmentEditorController=function(u){function p(t,e,n,r){this.attachmentPiece=t,this.element=e,this.container=n,this.options=null!=r?r:{},this.didBlurCaption=l(this.didBlurCaption,this),this.didChangeCaption=l(this.didChangeCaption,this),this.didInputCaption=l(this.didInputCaption,this),this.didKeyDownCaption=l(this.didKeyDownCaption,this),this.didClickActionButton=l(this.didClickActionButton,this),this.didClickToolbar=l(this.didClickToolbar,this),this.attachment=this.attachmentPiece.attachment,"a"===c(this.element)&&(this.element=this.element.firstChild),this.install()}var d;return h(p,u),d=function(t){return function(){var e;return(e=t.apply(this,arguments)).do(),null==this.undos&&(this.undos=[]),this.undos.push(e.undo)}},p.prototype.install=function(){return this.makeElementMutable(),this.addToolbar(),this.attachment.isPreviewable()?this.installCaptionEditor():void 0},p.prototype.uninstall=function(){var t,e;for(this.savePendingCaption();e=this.undos.pop();)e();return null!=(t=this.delegate)?t.didUninstallAttachmentEditor(this):void 0},p.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},p.prototype.makeElementMutable=d((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)}})),p.prototype.addToolbar=d((function(){var e,o,u;return(e=s({tagName:"div",className:t.attachmentToolbar,data:{trixMutable:!0}})).innerHTML='
\n \n \n \n
",this.attachment.isPreviewable()&&(o=n(this.attachment.getFilename()),u=n(this.attachment.getFormattedFilesize()),e.innerHTML+='
\n \n '+o+'\n '+u+"\n \n
"),i("click",{onElement:e,withCallback:this.didClickToolbar}),i("click",{onElement:e,matchingSelector:"[data-trix-action]",withCallback:this.didClickActionButton}),{do:function(t){return function(){return t.element.appendChild(e)}}(this),undo:function(){return r.removeNode(e)}}})),p.prototype.installCaptionEditor=d((function(){var n,o,u,c,l;return(c=s({tagName:"textarea",className:t.attachmentCaptionEditor,attributes:{placeholder:a.captionPlaceholder},data:{trixMutable:!0}})).value=this.attachmentPiece.getCaption(),(l=c.cloneNode()).classList.add("trix-autoresize-clone"),l.tabIndex=-1,n=function(){return l.value=c.value,c.style.height=l.scrollHeight+"px"},i("input",{onElement:c,withCallback:n}),i("input",{onElement:c,withCallback:this.didInputCaption}),i("keydown",{onElement:c,withCallback:this.didKeyDownCaption}),i("change",{onElement:c,withCallback:this.didChangeCaption}),i("blur",{onElement:c,withCallback:this.didBlurCaption}),u=this.element.querySelector("figcaption"),o=u.cloneNode(),{do:function(r){return function(){return u.style.display="none",o.appendChild(c),o.appendChild(l),o.classList.add(t.attachmentCaption+"--editing"),u.parentElement.insertBefore(o,u),n(),r.options.editCaption?e((function(){return c.focus()})):void 0}}(this),undo:function(){return r.removeNode(o),u.style.display=null}}})),p.prototype.didClickToolbar=function(t){return t.preventDefault(),t.stopPropagation()},p.prototype.didClickActionButton=function(t){var e;switch(t.target.getAttribute("data-trix-action")){case"remove":return null!=(e=this.delegate)?e.attachmentEditorDidRequestRemovalOfAttachment(this.attachment):void 0}},p.prototype.didKeyDownCaption=function(t){var e;return"return"===o[t.keyCode]?(t.preventDefault(),this.savePendingCaption(),null!=(e=this.delegate)&&"function"==typeof e.attachmentEditorDidRequestDeselectingAttachment?e.attachmentEditorDidRequestDeselectingAttachment(this.attachment):void 0):void 0},p.prototype.didInputCaption=function(t){return this.pendingCaption=t.target.value.replace(/\s/g," ").trim()},p.prototype.didChangeCaption=function(){return this.savePendingCaption()},p.prototype.didBlurCaption=function(){return this.savePendingCaption()},p}(r.BasicObject)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=r.makeElement,t=r.config.css,r.AttachmentView=function(o){function a(){a.__super__.constructor.apply(this,arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}var s;return i(a,o),a.attachmentSelector="[data-trix-attachment]",a.prototype.createContentNodes=function(){return[]},a.prototype.createNodes=function(){var e,r,i,o,a,u,c;if(e=o=n({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),(r=this.getHref())&&(o=n({tagName:"a",editable:!1,attributes:{href:r,tabindex:-1}}),e.appendChild(o)),this.attachment.hasContent())o.innerHTML=this.attachment.getContent();else for(i=0,a=(c=this.createContentNodes()).length;a>i;i++)u=c[i],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)),[s("left"),e,s("right")]},a.prototype.createCaptionElement=function(){var e,r,i,o,a,s,u;return i=n({tagName:"figcaption",className:t.attachmentCaption}),(e=this.attachmentPiece.getCaption())?(i.classList.add(t.attachmentCaption+"--edited"),i.textContent=e):((r=this.getCaptionConfig()).name&&(o=this.attachment.getFilename()),r.size&&(s=this.attachment.getFormattedFilesize()),o&&(a=n({tagName:"span",className:t.attachmentName,textContent:o}),i.appendChild(a)),s&&(o&&i.appendChild(document.createTextNode(" ")),u=n({tagName:"span",className:t.attachmentSize,textContent:s}),i.appendChild(u))),i},a.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(" ")},a.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},a.prototype.getHref=function(){return e(this.attachment.getContent(),"a")?void 0:this.attachment.getHref()},a.prototype.getCaptionConfig=function(){var t,e,n;return n=this.attachment.getType(),t=r.copyObject(null!=(e=r.config.attachments[n])?e.caption:void 0),"file"===n&&(t.name=!0),t},a.prototype.findProgressElement=function(){var t;return null!=(t=this.findElement())?t.querySelector("progress"):void 0},s=function(t){return n({tagName:"span",textContent:r.ZERO_WIDTH_SPACE,data:{trixCursorTarget:t,trixSerialize:!1}})},a.prototype.attachmentDidChangeUploadProgress=function(){var t,e;return e=this.attachment.getUploadProgress(),null!=(t=this.findProgressElement())?t.value=e:void 0},a}(r.ObjectView),e=function(t,e){var r;return(r=n("div")).innerHTML=null!=t?t:"",r.querySelector(e)}}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=r.makeElement,r.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",r.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,r,i,o,a;return o=this.attachment.getURL(),n=this.attachment.getPreviewURL(),t.src=n||o,n===o?t.removeAttribute("data-trix-serialized-attributes"):(r=JSON.stringify({src:o}),t.setAttribute("data-trix-serialized-attributes",r)),a=this.attachment.getWidth(),e=this.attachment.getHeight(),null!=a&&(t.width=a),null!=e&&(t.height=e),i=["imageElement",this.attachment.id,t.src,t.width,t.height].join("/"),t.dataset.trixStoreKey=i},i.prototype.attachmentDidChangeAttributes=function(){return this.refresh(this.image),this.refresh()},i}(r.AttachmentView)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=r.makeElement,t=r.findInnerElement,e=r.getTextConfig,r.PieceView=function(o){function a(){var t;a.__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 s;return i(a,o),a.prototype.createNodes=function(){var e,n,r,i,o,a;if(a=this.attachment?this.createAttachmentNodes():this.createStringNodes(),e=this.createElement()){for(r=t(e),n=0,i=a.length;i>n;n++)o=a[n],r.appendChild(o);a=[e]}return a},a.prototype.createAttachmentNodes=function(){var t;return t=this.attachment.isPreviewable()?r.PreviewableAttachmentView:r.AttachmentView,this.createChildView(t,this.piece.attachment,{piece:this.piece}).getNodes()},a.prototype.createStringNodes=function(){var t,e,r,i,o,a,s,u,c;if(null!=(s=this.textConfig)?s.plaintext:void 0)return[document.createTextNode(this.string)];for(a=[],r=e=0,i=(u=this.string.split("\n")).length;i>e;r=++e)c=u[r],r>0&&(t=n("br"),a.push(t)),c.length&&(o=document.createTextNode(this.preserveSpaces(c)),a.push(o));return a},a.prototype.createElement=function(){var t,r,i,o,a,s,u,c,l;for(o in c={},s=this.attributes)if(l=s[o],(t=e(o))&&(t.tagName&&(a=n(t.tagName),i?(i.appendChild(a),i=a):r=i=a),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==r&&(r=n("span")),c)l=c[o],r.style[o]=l;return r},a.prototype.createContainerElement=function(){var t,r,i,o,a;for(i in o=this.attributes)if(a=o[i],(r=e(i))&&r.groupTagName)return(t={})[i]=a,n(r.groupTagName,t)},s=r.NON_BREAKING_SPACE,a.prototype.preserveSpaces=function(t){return this.context.isLast&&(t=t.replace(/\ $/,s)),t=t.replace(/(\S)\ {3}(\S)/g,"$1 "+s+" $2").replace(/\ {2}/g,s+" ").replace(/\ {2}/g," "+s),(this.context.isFirst||this.context.followsWhitespace)&&(t=t.replace(/^\ /,s)),t},a}(r.ObjectView)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.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,o,a,s,u,c,l,h;for(s=[],o=(c=r.ObjectGroup.groupObjects(this.getPieces())).length-1,n=e=0,a=c.length;a>e;n=++e)u=c[n],t={},0===n&&(t.isFirst=!0),n===o&&(t.isLast=!0),i(l)&&(t.followsWhitespace=!0),h=this.findOrCreateCachedChildView(r.PieceView,u,{textConfig:this.textConfig,context:t}),s.push.apply(s,h.getNodes()),l=u;return s},n.prototype.getPieces=function(){var t,e,n,r,i;for(i=[],t=0,e=(r=this.text.getPieces()).length;e>t;t++)(n=r[t]).hasAttribute("blockBreak")||i.push(n);return i},i=function(t){return/\s$/.test(null!=t?t.toString():void 0)},n}(r.ObjectView)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=r.makeElement,e=r.getBlockConfig,t=r.config.css,r.BlockView=function(o){function a(){a.__super__.constructor.apply(this,arguments),this.block=this.object,this.attributes=this.block.getAttributes()}return i(a,o),a.prototype.createNodes=function(){var t,i,o,a,s,u,c,l;if(s=[document.createComment("block")],this.block.isEmpty()?s.push(n("br")):(c=null!=(u=e(this.block.getLastAttribute()))?u.text:void 0,l=this.findOrCreateCachedChildView(r.TextView,this.block.text,{textConfig:c}),s.push.apply(s,l.getNodes()),this.shouldAddExtraNewlineElement()&&s.push(n("br"))),this.attributes.length)return s;for(t=n(r.config.blockAttributes.default.tagName),i=0,o=s.length;o>i;i++)a=s[i],t.appendChild(a);return[t]},a.prototype.createContainerElement=function(r){var i,o,a;return i=this.attributes[r],o={tagName:e(i).tagName},"attachmentGallery"===i&&(a=this.block.getBlockBreakPosition(),o.className=t.attachmentGallery+" "+t.attachmentGallery+"--"+a),n(o)},a.prototype.shouldAddExtraNewlineElement=function(){return/\n\n$/.test(this.block.toString())},a}(r.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=r.defer,e=r.makeElement,r.DocumentView=function(i){function o(){o.__super__.constructor.apply(this,arguments),this.element=this.options.element,this.elementStore=new r.ElementStore,this.setDocument(this.object)}var a,s,u;return n(o,i),o.render=function(t){var n,r;return(r=new this(t,{element:n=e("div")})).render(),r.sync(),n},o.prototype.setDocument=function(t){return t.isEqualTo(this.document)?void 0:this.document=this.object=t},o.prototype.render=function(){var t,n,i,o,a,s,u;if(this.childViews=[],this.shadowElement=e("div"),!this.document.isEmpty()){for(s=[],t=0,n=(a=r.ObjectGroup.groupObjects(this.document.getBlocks(),{asTree:!0})).length;n>t;t++)o=a[t],u=this.findOrCreateCachedChildView(r.BlockView,o),s.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 s}},o.prototype.isSynced=function(){return a(this.shadowElement,this.element)},o.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()},o.prototype.didSync=function(){return this.elementStore.reset(s(this.element)),t(function(t){return function(){return t.garbageCollectCachedViews()}}(this))},o.prototype.createDocumentFragmentForSync=function(){var t,e,n,r,i,o,a,u,c,l;for(e=document.createDocumentFragment(),n=0,i=(u=this.shadowElement.childNodes).length;i>n;n++)a=u[n],e.appendChild(a.cloneNode(!0));for(r=0,o=(c=s(e)).length;o>r;r++)t=c[r],(l=this.elementStore.remove(t))&&t.parentNode.replaceChild(l,t);return e},s=function(t){return t.querySelectorAll("[data-trix-store-key]")},a=function(t,e){return u(t.innerHTML)===u(e.innerHTML)},u=function(t){return t.replace(/ /g," ")},o}(r.ObjectView)}.call(this),function(){var t,e,n,i,o,a=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;n=r.findClosestElementFromNode,i=r.handleEvent,o=r.innerElementIsActive,e=r.defer,t=r.AttachmentView.attachmentSelector,r.CompositionController=function(u){function c(e,n){this.element=e,this.composition=n,this.didClickAttachment=a(this.didClickAttachment,this),this.didBlur=a(this.didBlur,this),this.didFocus=a(this.didFocus,this),this.documentView=new r.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 s(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 o(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 r,i,o;return r=this.findAttachmentForElement(e),i=null!=n(t.target,{matchingSelector:"figcaption"}),null!=(o=this.delegate)&&"function"==typeof o.compositionControllerDidSelectAttachment?o.compositionControllerDidSelectAttachment(r,{editCaption:i}):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,o;if((null!=(o=this.attachmentEditor)?o.attachment:void 0)!==t&&(i=this.documentView.findElementForObject(t)))return this.uninstallAttachmentEditor(),n=this.composition.document.getAttachmentPieceForAttachment(t),this.attachmentEditor=new r.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}(r.BasicObject)}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},o=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;e=r.handleEvent,n=r.triggerEvent,t=r.findClosestElementFromNode,r.ToolbarController=function(r){function a(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:s,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 s,u,c,l,h,p,d,f,g,m;return o(a,r),m=(u="[data-trix-attribute]")+", "+(s="[data-trix-action]"),(h="[data-trix-dialog]")+"[data-trix-active]",c=h+" [data-trix-method]",l=h+" [data-trix-input]",a.prototype.didClickActionButton=function(t,e){var n,r,i;return null!=(r=this.delegate)&&r.toolbarDidClickButton(),t.preventDefault(),n=p(e),this.getDialog(n)?this.toggleDialog(n):null!=(i=this.delegate)?i.toolbarDidInvokeAction(n):void 0},a.prototype.didClickAttributeButton=function(t,e){var n,r,i;return null!=(r=this.delegate)&&r.toolbarDidClickButton(),t.preventDefault(),n=d(e),this.getDialog(n)?this.toggleDialog(n):null!=(i=this.delegate)&&i.toolbarDidToggleAttribute(n),this.refreshAttributeButtons()},a.prototype.didClickDialogButton=function(e,n){var r;return r=t(n,{matchingSelector:h}),this[n.getAttribute("data-trix-method")].call(this,r)},a.prototype.didKeyDownDialogInput=function(t,e){var n,r;return 13===t.keyCode&&(t.preventDefault(),n=e.getAttribute("name"),r=this.getDialog(n),this.setAttribute(r)),27===t.keyCode?(t.preventDefault(),this.hideDialog()):void 0},a.prototype.updateActions=function(t){return this.actions=t,this.refreshActionButtons()},a.prototype.refreshActionButtons=function(){return this.eachActionButton(function(t){return function(e,n){return e.disabled=!1===t.actions[n]}}(this))},a.prototype.eachActionButton=function(t){var e,n,r,i,o;for(o=[],n=0,r=(i=this.element.querySelectorAll(s)).length;r>n;n++)e=i[n],o.push(t(e,p(e)));return o},a.prototype.updateAttributes=function(t){return this.attributes=t,this.refreshAttributeButtons()},a.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))},a.prototype.eachAttributeButton=function(t){var e,n,r,i,o;for(o=[],n=0,r=(i=this.element.querySelectorAll(u)).length;r>n;n++)e=i[n],o.push(t(e,d(e)));return o},a.prototype.applyKeyboardCommand=function(t){var e,r,i,o,a,s;for(o=JSON.stringify(t.sort()),i=0,a=(s=this.element.querySelectorAll("[data-trix-key]")).length;a>i;i++)if(r=(e=s[i]).getAttribute("data-trix-key").split("+"),JSON.stringify(r.sort())===o)return n("mousedown",{onElement:e}),!0;return!1},a.prototype.dialogIsVisible=function(t){var e;return(e=this.getDialog(t))?e.hasAttribute("data-trix-active"):void 0},a.prototype.toggleDialog=function(t){return this.dialogIsVisible(t)?this.hideDialog():this.showDialog(t)},a.prototype.showDialog=function(t){var e,n,r,i,o,a,s,u,c;for(this.hideDialog(),null!=(a=this.delegate)&&a.toolbarWillShowDialog(),(n=this.getDialog(t)).setAttribute("data-trix-active",""),n.classList.add("trix-active"),r=0,o=(s=n.querySelectorAll("input[disabled]")).length;o>r;r++)s[r].removeAttribute("disabled");return(e=d(n))&&(i=g(n,t))&&(i.value=null!=(u=this.attributes[e])?u:"",i.select()),null!=(c=this.delegate)?c.toolbarDidShowDialog(t):void 0},a.prototype.setAttribute=function(t){var e,n,r;return e=d(t),(n=g(t,e)).willValidate&&!n.checkValidity()?(n.setAttribute("data-trix-validate",""),n.classList.add("trix-validate"),n.focus()):(null!=(r=this.delegate)&&r.toolbarDidUpdateAttribute(e,n.value),this.hideDialog())},a.prototype.removeAttribute=function(t){var e,n;return e=d(t),null!=(n=this.delegate)&&n.toolbarDidRemoveAttribute(e),this.hideDialog()},a.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},a.prototype.resetDialogInputs=function(){var t,e,n,r,i;for(i=[],t=0,n=(r=this.element.querySelectorAll(l)).length;n>t;t++)(e=r[t]).setAttribute("disabled","disabled"),e.removeAttribute("data-trix-validate"),i.push(e.classList.remove("trix-validate"));return i},a.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")},a}(r.BasicObject)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.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}(r.Operation)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;r.Attachment=function(n){function i(e){null==e&&(e={}),this.releaseFile=t(this.releaseFile,this),i.__super__.constructor.apply(this,arguments),this.attributes=r.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 r.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,r;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!=(r=this.delegate)&&"function"==typeof r.attachmentDidChangeAttributes?r.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"))?r.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 r.ImagePreloadOperation(t).then(function(n){return function(r){var i,o;return o=r.width,i=r.height,n.getWidth()&&n.getHeight()||n.setAttributes({width:o,height:i}),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}(r.Object)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.Piece=function(e){function n(t,e){null==e&&(e={}),n.__super__.constructor.apply(this,arguments),this.attributes=r.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}(r.Object)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.Piece.registerType("attachment",r.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(r.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 r.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}(r.Piece))}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=r.normalizeNewlines,r.Piece.registerType("string",r.StringPiece=function(n){function r(e){r.__super__.constructor.apply(this,arguments),this.string=t(e),this.length=this.string.length}return e(r,n),r.fromJSON=function(t){return new this(t.string,t.attributes)},r.prototype.getValue=function(){return this.string},r.prototype.toString=function(){return this.string.toString()},r.prototype.isBlockBreak=function(){return"\n"===this.toString()&&!0===this.getAttribute("blockBreak")},r.prototype.toJSON=function(){var t;return(t=r.__super__.toJSON.apply(this,arguments)).string=this.string,t},r.prototype.canBeConsolidatedWith=function(t){return null!=t&&this.hasSameConstructorAs(t)&&this.hasSameAttributesAsPiece(t)},r.prototype.consolidateWith=function(t){return new this.constructor(this.toString()+t.toString(),this.attributes)},r.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]},r.prototype.toConsole=function(){var t;return(t=this.string).length>15&&(t=t.slice(0,14)+"…"),JSON.stringify(t.toString())},r}(r.Piece))}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty,i=[].slice;t=r.spliceArray,r.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,a,s;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,r,i,o,a;for(a=[],n=e=0,r=(o=this.objects).length;r>e;n=++e)i=o[n],a.push(t(i,n));return a},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,r,i;return r=(i=this.splitObjectAtPosition(e))[0],n=i[1],new this.constructor(r).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,r,i;return n=(r=this.splitObjectsAtRange(t))[0],e=r[1],i=r[2],new this.constructor(n.slice(e,i+1))},r.prototype.selectSplittableList=function(t){var e,n;return n=function(){var n,r,i,o;for(o=[],n=0,r=(i=this.objects).length;r>n;n++)e=i[n],t(e)&&o.push(e);return o}.call(this),new this.constructor(n)},r.prototype.removeObjectsInRange=function(t){var e,n,r,i;return n=(r=this.splitObjectsAtRange(t))[0],e=r[1],i=r[2],new this.constructor(n).splice(e,i-e+1)},r.prototype.transformObjectsInRange=function(t,e){var n,r,i,o,a,s,u;return a=this.splitObjectsAtRange(t),o=a[0],r=a[1],s=a[2],u=function(){var t,a,u;for(u=[],n=t=0,a=o.length;a>t;n=++t)i=o[n],u.push(n>=r&&s>=n?e(i):i);return u}(),new this.constructor(u)},r.prototype.splitObjectsAtRange=function(t){var e,n,r,i,a;return n=(i=this.splitObjectAtPosition(s(t)))[0],e=i[1],r=i[2],[n=(a=new this.constructor(n).splitObjectAtPosition(o(t)+r))[0],e,a[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,r,i,o,a,s,u,c;return e=(o=this.findIndexAndOffsetAtPosition(t)).index,i=o.offset,r=this.objects.slice(0),null!=e?0===i?(u=e,c=0):(n=(a=this.getObjectAtIndex(e).splitAtOffset(i))[0],s=a[1],r.splice(e,1,n,s),u=e+1,c=n.getLength()-i):(u=r.length,c=0),[r,u,c]},r.prototype.consolidate=function(){var t,e,n,r,i,o;for(r=[],i=this.objects[0],t=0,e=(o=this.objects.slice(1)).length;e>t;t++)n=o[t],("function"==typeof i.canBeConsolidatedWith?i.canBeConsolidatedWith(n):void 0)?i=i.consolidateWith(n):(r.push(i),i=n);return null!=i&&r.push(i),new this.constructor(r)},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,r,i,o,a;for(e=0,r=n=0,i=(a=this.objects).length;i>n;r=++n){if(o=e+a[r].getLength(),t>=e&&o>t)return{index:r,offset:t-e};e=o}return{index:null,offset:null}},r.prototype.findPositionAtIndexAndOffset=function(t,e){var n,r,i,o,a,s;for(a=0,n=r=0,i=(s=this.objects).length;i>r;n=++r)if(o=s[n],t>n)a+=o.getLength();else if(n===t){a+=e;break}return a},r.prototype.getEndPosition=function(){var t,e;return null!=this.endPosition?this.endPosition:this.endPosition=function(){var n,r,i;for(e=0,n=0,r=(i=this.objects).length;r>n;n++)t=i[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)||a(this.objects,null!=t?t.objects:void 0)},a=function(t,e){var n,r,i,o,a;if(null==e&&(e=[]),t.length!==e.length)return!1;for(a=!0,r=n=0,i=t.length;i>n;r=++n)o=t[r],a&&!o.isEqualTo(e[r])&&(a=!1);return a},r.prototype.contentsForInspection=function(){var t;return{objects:"["+function(){var e,n,r,i;for(i=[],e=0,n=(r=this.objects).length;n>e;e++)t=r[e],i.push(t.inspect());return i}.call(this).join(", ")+"]"}},s=function(t){return t[0]},o=function(t){return t[1]},r}(r.Object)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.Text=function(e){function n(t){var e;null==t&&(t=[]),n.__super__.constructor.apply(this,arguments),this.pieceList=new r.SplittableList(function(){var n,r,i;for(i=[],n=0,r=t.length;r>n;n++)(e=t[n]).isEmpty()||i.push(e);return i}())}return t(n,e),n.textForAttachmentWithAttributes=function(t,e){return new this([new r.AttachmentPiece(t,e)])},n.textForStringWithAttributes=function(t,e){return new this([new r.StringPiece(t,e)])},n.fromJSON=function(t){var e;return new this(function(){var n,i,o;for(o=[],n=0,i=t.length;i>n;n++)e=t[n],o.push(r.Piece.fromJSON(e));return o}())},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,r,i,o,a;for(a=[],n=0,r=(i=this.getPieces()).length;r>n;n++)e=i[n],a.push(null!=(o=t.find(e))?o:e);return a}.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,r;if(!(t[0]<=e&&e<=t[1]))return n=(r=this.getTextAtRange(t)).getLength(),t[0]t;t++)e=r[t],i.push(e.getAttributes());return i}.call(this),r.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,r,i;for(n=i=e,r=this.getLength();n>0&&this.getCommonAttributesAtRange([n-1,i])[t];)n--;for(;r>i&&this.getCommonAttributesAtRange([e,i+1])[t];)i++;return[n,i]},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,r,i;for(i=[],t=0,e=(r=this.pieceList.toArray()).length;e>t;t++)null!=(n=r[t]).attachment&&i.push(n);return i},n.prototype.getAttachments=function(){var t,e,n,r,i;for(i=[],t=0,e=(r=this.getAttachmentPieces()).length;e>t;t++)n=r[t],i.push(n.attachment);return i},n.prototype.getAttachmentAndPositionById=function(t){var e,n,r,i,o,a;for(i=0,e=0,n=(o=this.pieceList.toArray()).length;n>e;e++){if((null!=(a=(r=o[e]).attachment)?a.id:void 0)===t)return{attachment:r.attachment,position:i};i+=r.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,r,i;for(i=[],e=0,n=(r=this.pieceList.toArray()).length;n>e;e++)t=r[e],i.push(JSON.parse(t.toConsole()));return i}.call(this))},n}(r.Object)}.call(this),function(){var t,e,n,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.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},u=[].slice;t=r.arraysAreEqual,i=r.spliceArray,e=r.getBlockConfig,r.getBlockAttributeNames,n=r.getListAttributeNames,r.Block=function(a){function c(t,e){null==t&&(t=new r.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,v,y;return o(c,a),c.fromJSON=function(t){return new this(r.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,r;return r=e(t).listAttribute,n=g(g(this.attributes,t),r),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 s.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,r,i,o;for(o=[],n=0,r=(i=this.attributes).length;r>n;n++)t=i[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,r,i,o;for(o=[],n=0,r=(i=this.attributes).length;r>n;n++)t=i[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,r;return r=this.toString(),-1!==(n=function(){switch(t){case"forward":return r.indexOf("\n",e);case"backward":return r.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.getLength=function(){return this.text.getLength()},c.prototype.canBeConsolidatedWith=function(t){return!this.hasAttributes()&&!t.hasAttributes()},c.prototype.consolidateWith=function(t){var e,n;return e=r.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,r){var i,o,a,u;return o=(a=t.getAttributes())[r],(i=this.attributes[r])===o&&!(!1===e(i).group&&(u=a[r+1],s.call(n(),u)<0))},h=function(t){return t=y(t),l(t)},y=function(t){var e,n,i,o,a,s;return o=!1,s=t.getPieces(),n=2<=s.length?u.call(s,0,e=s.length-1):(e=0,[]),null==(i=s[e++])?t:(n=function(){var t,e,r;for(r=[],t=0,e=n.length;e>t;t++)(a=n[t]).isBlockBreak()?(o=!0,r.push(v(a))):r.push(a);return r}(),o?new r.Text(u.call(n).concat([i])):t)},p=r.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()},v=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}(r.Object)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.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},s=[].slice;e=r.tagName,n=r.walkTree,t=r.nodeIsAttachmentElement,r.HTMLSanitizer=function(o){function u(t,e){var n;n=null!=e?e:{},this.allowedAttributes=n.allowedAttributes,this.forbiddenProtocols=n.forbiddenProtocols,null==this.allowedAttributes&&(this.allowedAttributes=c),null==this.forbiddenProtocols&&(this.forbiddenProtocols=l),this.body=h(t)}var c,l,h,p;return i(u,o),c="style href src width height class".split(" "),l="javascript:".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,o,a;for(a=n(this.body),o=[];a.nextNode();)switch(i=a.currentNode,i.nodeType){case Node.ELEMENT_NODE:p(i)?o.push(i):this.sanitizeElement(i);break;case Node.COMMENT_NODE:o.push(i)}for(t=0,e=o.length;e>t;t++)i=o[t],r.removeNode(i);return this.body},u.prototype.sanitizeElement=function(t){var e,n,r,i,o;for(t.hasAttribute("href")&&(i=t.protocol,a.call(this.forbiddenProtocols,i)>=0&&t.removeAttribute("href")),e=0,n=(o=s.call(t.attributes)).length;n>e;e++)r=o[e].name,a.call(this.allowedAttributes,r)>=0||0===r.indexOf("data-trix")||t.removeAttribute(r);return t},u.prototype.normalizeListElementNesting=function(){var t,n,r,i,o;for(t=0,n=(o=s.call(this.body.querySelectorAll("ul,ol"))).length;n>t;t++)(i=(r=o[t]).previousElementSibling)&&"li"===e(i)&&i.appendChild(r);return this.body},p=function(n){return(null!=n?n.nodeType:void 0)!==Node.ELEMENT_NODE||t(n)?void 0:"script"===e(n)||"false"===n.getAttribute("data-trix-serialize")},h=function(t){var e,n,r,i,o;for(null==t&&(t=""),t=t.replace(/<\/html[^>]*>[^]*$/i,""),(e=document.implementation.createHTMLDocument("")).documentElement.innerHTML=t,r=0,i=(o=e.head.querySelectorAll("style")).length;i>r;r++)n=o[r],e.body.appendChild(n);return e.body},u}(r.BasicObject)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h,p=function(t,e){function n(){this.constructor=t}for(var r in e)d.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},d={}.hasOwnProperty,f=[].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=r.arraysAreEqual,a=r.makeElement,l=r.tagName,o=r.getBlockTagNames,h=r.walkTree,i=r.findClosestElementFromNode,n=r.elementContainsNode,s=r.nodeIsAttachmentElement,u=r.normalizeSpaces,e=r.breakableWhitespacePattern,c=r.squishBreakableWhitespace,r.HTMLParser=function(d){function g(t,e){this.html=t,this.referenceElement=(null!=e?e:{}).referenceElement,this.blocks=[],this.blockElements=[],this.processedElements=[]}var m,v,y,b,x,A,w,C,E,k,S,D;return p(g,d),g.parse=function(t,e){var n;return(n=new this(t,e)).parse(),n},g.prototype.getDocument=function(){return r.Document.fromJSON(this.blocks)},g.prototype.parse=function(){var t,e;try{for(this.createHiddenContainer(),t=r.HTMLSanitizer.sanitize(this.html).getHTML(),this.containerElement.innerHTML=t,e=h(this.containerElement,{usingFilter:C});e.nextNode();)this.processNode(e.currentNode);return this.translateBlockElementMarginsToNewlines()}finally{this.removeHiddenContainer()}},g.prototype.createHiddenContainer=function(){return this.referenceElement?(this.containerElement=this.referenceElement.cloneNode(!1),this.containerElement.removeAttribute("id"),this.containerElement.setAttribute("data-trix-internal",""),this.containerElement.style.display="none",this.referenceElement.parentNode.insertBefore(this.containerElement,this.referenceElement.nextSibling)):(this.containerElement=a({tagName:"div",style:{display:"none"}}),document.body.appendChild(this.containerElement))},g.prototype.removeHiddenContainer=function(){return r.removeNode(this.containerElement)},C=function(t){return"style"===l(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},g.prototype.processNode=function(t){switch(t.nodeType){case Node.TEXT_NODE:if(!this.isInsignificantTextNode(t))return this.appendBlockForTextNode(t),this.processTextNode(t);break;case Node.ELEMENT_NODE:return this.appendBlockForElement(t),this.processElement(t)}},g.prototype.appendBlockForTextNode=function(e){var n,r,i;return(r=e.parentNode)===this.currentBlockElement||r!==this.containerElement&&!this.isBlockElement(r)?void 0:(n=this.getBlockAttributes(r),t(n,null!=(i=this.currentBlock)?i.attributes:void 0)?void 0:(this.currentBlock=this.appendBlockForAttributesWithElement(n,r),this.currentBlockElement=r))},g.prototype.appendBlockForElement=function(e){var r,i,o,a;if(o=this.isBlockElement(e),i=n(this.currentBlockElement,e),o&&!this.isBlockElement(e.firstChild)){if(!(this.isInsignificantTextNode(e.firstChild)&&this.isBlockElement(e.firstElementChild)||(r=this.getBlockAttributes(e),i&&t(r,this.currentBlock.attributes))))return this.currentBlock=this.appendBlockForAttributesWithElement(r,e),this.currentBlockElement=e}else if(this.currentBlockElement&&!i&&!o)return(a=this.findParentBlockElement(e))?this.appendBlockForElement(a):(this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null)},g.prototype.findParentBlockElement=function(t){var e;for(e=t.parentElement;e&&e!==this.containerElement;){if(this.isBlockElement(e)&&f.call(this.blockElements,e)>=0)return e;e=e.parentElement}return null},g.prototype.processTextNode=function(t){var e,n;return n=t.data,v(t.parentNode)||(n=c(n),S(null!=(e=t.previousSibling)?e.textContent:void 0)&&(n=A(n))),this.appendStringWithAttributes(n,this.getTextAttributes(t.parentNode))},g.prototype.processElement=function(t){var e,n,r,i,o;if(s(t))return e=y(t),Object.keys(e).length&&(i=this.getTextAttributes(t),this.appendAttachmentWithAttributes(e,i),t.innerHTML=""),this.processedElements.push(t);switch(l(t)){case"br":return this.isExtraBR(t)||this.isBlockElement(t.nextSibling)||this.appendStringWithAttributes("\n",this.getTextAttributes(t)),this.processedElements.push(t);case"img":for(n in e={url:t.getAttribute("src"),contentType:"image"},r=x(t))o=r[n],e[n]=o;return this.appendAttachmentWithAttributes(e,this.getTextAttributes(t)),this.processedElements.push(t);case"tr":if(t.parentNode.firstChild!==t)return this.appendStringWithAttributes("\n");break;case"td":if(t.parentNode.firstChild!==t)return this.appendStringWithAttributes(" | ")}},g.prototype.appendBlockForAttributesWithElement=function(t,e){var n;return this.blockElements.push(e),n=m(t),this.blocks.push(n),n},g.prototype.appendEmptyBlock=function(){return this.appendBlockForAttributesWithElement([],null)},g.prototype.appendStringWithAttributes=function(t,e){return this.appendPiece(k(t,e))},g.prototype.appendAttachmentWithAttributes=function(t,e){return this.appendPiece(E(t,e))},g.prototype.appendPiece=function(t){return 0===this.blocks.length&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(t)},g.prototype.appendStringToTextAtIndex=function(t,e){var n,r;return"string"===(null!=(n=(r=this.blocks[e].text)[r.length-1])?n.type:void 0)?n.string+=t:r.push(k(t))},g.prototype.prependStringToTextAtIndex=function(t,e){var n,r;return"string"===(null!=(n=(r=this.blocks[e].text)[0])?n.type:void 0)?n.string=t+n.string:r.unshift(k(t))},k=function(t,e){return null==e&&(e={}),"string",{string:t=u(t),attributes:e,type:"string"}},E=function(t,e){return null==e&&(e={}),"attachment",{attachment:t,attributes:e,type:"attachment"}},m=function(t){return null==t&&(t={}),{text:[],attributes:t}},g.prototype.getTextAttributes=function(t){var e,n,o,a,u,c,l,h,p,d,f,g,m;for(e in o={},d=r.config.textAttributes)if((u=d[e]).tagName&&i(t,{matchingSelector:u.tagName,untilNode:this.containerElement}))o[e]=!0;else if(u.parser){if(m=u.parser(t)){for(n=!1,c=0,p=(f=this.findBlockElementAncestors(t)).length;p>c;c++)if(a=f[c],u.parser(a)===m){n=!0;break}n||(o[e]=m)}}else u.styleProperty&&(m=t.style[u.styleProperty])&&(o[e]=m);if(s(t)&&(l=t.getAttribute("data-trix-attributes")))for(h in g=JSON.parse(l))m=g[h],o[h]=m;return o},g.prototype.getBlockAttributes=function(t){var e,n,i,o;for(n=[];t&&t!==this.containerElement;){for(e in o=r.config.blockAttributes)!1!==(i=o[e]).parse&&l(t)===i.tagName&&(("function"==typeof i.test?i.test(t):void 0)||!i.test)&&(n.push(e),i.listAttribute&&n.push(i.listAttribute));t=t.parentNode}return n.reverse()},g.prototype.findBlockElementAncestors=function(t){var e,n;for(e=[];t&&t!==this.containerElement;)n=l(t),f.call(o(),n)>=0&&e.push(t),t=t.parentNode;return e},y=function(t){return JSON.parse(t.getAttribute("data-trix-attachment"))},x=function(t){var e,n,r;return r=t.getAttribute("width"),n=t.getAttribute("height"),e={},r&&(e.width=parseInt(r,10)),n&&(e.height=parseInt(n,10)),e},g.prototype.isBlockElement=function(t){var e;if((null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE&&!s(t)&&!i(t,{matchingSelector:"td",untilNode:this.containerElement}))return e=l(t),f.call(o(),e)>=0||"block"===window.getComputedStyle(t).display},g.prototype.isInsignificantTextNode=function(t){var e,n,r;if((null!=t?t.nodeType:void 0)===Node.TEXT_NODE&&D(t.data)&&(n=t.parentNode,r=t.previousSibling,e=t.nextSibling,(!w(n.previousSibling)||this.isBlockElement(n.previousSibling))&&!v(n)))return!r||this.isBlockElement(r)||!e||this.isBlockElement(e)},g.prototype.isExtraBR=function(t){return"br"===l(t)&&this.isBlockElement(t.parentNode)&&t.parentNode.lastChild===t},v=function(t){var e;return"pre"===(e=window.getComputedStyle(t).whiteSpace)||"pre-wrap"===e||"pre-line"===e},w=function(t){return t&&!S(t.textContent)},g.prototype.translateBlockElementMarginsToNewlines=function(){var t,e,n,r,i,o,a;for(t=this.getMarginOfDefaultBlockElement(),a=[],n=e=0,r=(o=this.blocks).length;r>e;n=++e)o[n],(i=this.getMarginOfBlockElementAtIndex(n))&&(i.top>2*t.top&&this.prependStringToTextAtIndex("\n",n),a.push(i.bottom>2*t.bottom?this.appendStringToTextAtIndex("\n",n):void 0));return a},g.prototype.getMarginOfBlockElementAtIndex=function(t){var e,n;return!(e=this.blockElements[t])||!e.textContent||(n=l(e),f.call(o(),n)>=0||f.call(this.processedElements,e)>=0)?void 0:b(e)},g.prototype.getMarginOfDefaultBlockElement=function(){var t;return t=a(r.config.blockAttributes.default.tagName),this.containerElement.appendChild(t),b(t)},b=function(t){var e;return"block"===(e=window.getComputedStyle(t)).display?{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}:void 0},A=function(t){return t.replace(RegExp("^"+e.source+"+"),"")},D=function(t){return RegExp("^"+e.source+"*$").test(t)},S=function(t){return/\s$/.test(t)},g}(r.BasicObject)}.call(this),function(){var t,e,n,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty,s=[].slice,u=[].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=r.arraysAreEqual,n=r.normalizeRange,i=r.rangeIsCollapsed,e=r.getBlockConfig,r.Document=function(a){function c(t){null==t&&(t=[]),c.__super__.constructor.apply(this,arguments),0===t.length&&(t=[new r.Block]),this.blockList=r.SplittableList.box(t)}var l;return o(c,a),c.fromJSON=function(t){var e;return new this(function(){var n,i,o;for(o=[],n=0,i=t.length;i>n;n++)e=t[n],o.push(r.Block.fromJSON(e));return o}())},c.fromHTML=function(t,e){return r.HTMLParser.parse(t,e).getDocument()},c.fromString=function(t,e){var n;return n=r.Text.textForStringWithAttributes(t,e),new this([new r.Block(n)])},c.prototype.isEmpty=function(){var t;return 1===this.blockList.length&&((t=this.getBlockAtIndex(0)).isEmpty()&&!t.hasAttributes())},c.prototype.copy=function(t){var e;return null==t&&(t={}),e=t.consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray(),new this.constructor(e)},c.prototype.copyUsingObjectsFromDocument=function(t){var e;return e=new r.ObjectMap(t.getObjects()),this.copyUsingObjectMap(e)},c.prototype.copyUsingObjectMap=function(t){var e,n,r;return n=function(){var n,i,o,a;for(a=[],n=0,i=(o=this.getBlocks()).length;i>n;n++)e=o[n],a.push((r=t.find(e))?r:e.copyUsingObjectMap(t));return a}.call(this),new this.constructor(n)},c.prototype.copyWithBaseBlockAttributes=function(t){var e,n,r;return null==t&&(t=[]),r=function(){var r,i,o,a;for(a=[],r=0,i=(o=this.getBlocks()).length;i>r;r++)n=o[r],e=t.concat(n.getAttributes()),a.push(n.copyWithAttributes(e));return a}.call(this),new this.constructor(r)},c.prototype.replaceBlock=function(t,e){var n;return-1===(n=this.blockList.indexOf(t))?this:new this.constructor(this.blockList.replaceObjectAtIndex(e,n))},c.prototype.insertDocumentAtRange=function(t,e){var r,o,a,s,u,c,l;return o=t.blockList,u=(e=n(e))[0],a=(c=this.locationFromPosition(u)).index,s=c.offset,l=this,r=this.getBlockAtPosition(u),i(e)&&r.isEmpty()&&!r.hasAttributes()?l=new this.constructor(l.blockList.removeObjectAtIndex(a)):r.getBlockBreakPosition()===s&&u++,l=l.removeTextAtRange(e),new this.constructor(l.blockList.insertSplittableListAtPosition(o,u))},c.prototype.mergeDocumentAtRange=function(e,r){var i,o,a,s,u,c,l,h,p,d,f,g;return f=(r=n(r))[0],d=this.locationFromPosition(f),o=this.getBlockAtIndex(d.index).getAttributes(),i=e.getBaseBlockAttributes(),g=o.slice(-i.length),t(i,g)?(l=o.slice(0,-i.length),c=e.copyWithBaseBlockAttributes(l)):c=e.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(o),a=c.getBlockCount(),s=c.getBlockAtIndex(0),t(o,s.getAttributes())?(u=s.getTextWithoutBlockBreak(),p=this.insertTextAtRange(u,r),a>1&&(c=new this.constructor(c.getBlocks().slice(1)),h=f+u.getLength(),p=p.insertDocumentAtRange(c,h))):p=this.insertDocumentAtRange(c,r),p},c.prototype.insertTextAtRange=function(t,e){var r,i,o,a,s;return s=(e=n(e))[0],i=(a=this.locationFromPosition(s)).index,o=a.offset,r=this.removeTextAtRange(e),new this.constructor(r.blockList.editObjectAtIndex(i,(function(e){return e.copyWithText(e.text.insertTextAtPosition(t,o))})))},c.prototype.removeTextAtRange=function(t){var e,r,o,a,s,u,c,l,h,p,d,f,g,m,v,y,b,x;return l=(p=t=n(t))[0],y=p[1],i(t)?this:(u=(d=this.locationRangeFromRange(t))[0],m=d[1],s=u.index,c=u.offset,a=this.getBlockAtIndex(s),g=m.index,v=m.offset,f=this.getBlockAtIndex(g),y-l==1&&a.getBlockBreakPosition()===c&&f.getBlockBreakPosition()!==v&&"\n"===f.text.getStringAtPosition(v)?o=this.blockList.editObjectAtIndex(g,(function(t){return t.copyWithText(t.text.removeTextAtRange([v,v+1]))})):(h=a.text.getTextAtRange([0,c]),b=f.text.getTextAtRange([v,f.getLength()]),x=h.appendText(b),r=s!==g&&0===c&&a.getAttributeLevel()>=f.getAttributeLevel()?f.copyWithText(x):a.copyWithText(x),e=g+1-s,o=this.blockList.splice(s,e,r)),new this.constructor(o))},c.prototype.moveTextFromRangeToPosition=function(t,e){var r,i,o,a,u,c,l,h,p,d;return p=(c=t=n(t))[0],o=c[1],e>=p&&o>=e?this:(i=this.getDocumentAtRange(t),h=this.removeTextAtRange(t),(u=e>p)&&(e-=i.getLength()),a=(l=i.getBlocks())[0],0===(r=2<=l.length?s.call(l,1):[]).length?(d=a.getTextWithoutBlockBreak(),u&&(e+=1)):d=a.text,h=h.insertTextAtRange(d,e),0===r.length?h:(i=new this.constructor(r),e+=d.getLength(),h.insertDocumentAtRange(i,e)))},c.prototype.addAttributeAtRange=function(t,n,r){var i;return i=this.blockList,this.eachBlockAtRange(r,(function(r,o,a){return i=i.editObjectAtIndex(a,(function(){return e(t)?r.addAttribute(t,n):o[0]===o[1]?r:r.copyWithText(r.text.addAttributeAtRange(t,n,o))}))})),new this.constructor(i)},c.prototype.addAttribute=function(t,e){var n;return n=this.blockList,this.eachBlock((function(r,i){return n=n.editObjectAtIndex(i,(function(){return r.addAttribute(t,e)}))})),new this.constructor(n)},c.prototype.removeAttributeAtRange=function(t,n){var r;return r=this.blockList,this.eachBlockAtRange(n,(function(n,i,o){return e(t)?r=r.editObjectAtIndex(o,(function(){return n.removeAttribute(t)})):i[0]!==i[1]?r=r.editObjectAtIndex(o,(function(){return n.copyWithText(n.text.removeAttributeAtRange(t,i))})):void 0})),new this.constructor(r)},c.prototype.updateAttributesForAttachment=function(t,e){var n,r,i;return r=this.getRangeOfAttachment(e)[0],n=this.locationFromPosition(r).index,i=this.getTextAtIndex(n),new this.constructor(this.blockList.editObjectAtIndex(n,(function(n){return n.copyWithText(i.updateAttributesForAttachment(t,e))})))},c.prototype.removeAttributeForAttachment=function(t,e){var n;return n=this.getRangeOfAttachment(e),this.removeAttributeAtRange(t,n)},c.prototype.insertBlockBreakAtRange=function(t){var e,i,o,a;return a=(t=n(t))[0],o=this.locationFromPosition(a).offset,i=this.removeTextAtRange(t),0===o&&(e=[new r.Block]),new this.constructor(i.blockList.insertSplittableListAtPosition(new r.SplittableList(e),a))},c.prototype.applyBlockAttributeAtRange=function(t,n,r){var i,o,a,s;return o=(a=this.expandRangeToLineBreaksAndSplitBlocks(r)).document,r=a.range,(i=e(t)).listAttribute?(s=(o=o.removeLastListAttributeAtRange(r,{exceptAttributeName:t})).convertLineBreaksToBlockBreaksInRange(r),o=s.document,r=s.range):o=i.exclusive?o.removeBlockAttributesAtRange(r):i.terminal?o.removeLastTerminalAttributeAtRange(r):o.consolidateBlocksAtRange(r),o.addAttributeAtRange(t,n,r)},c.prototype.removeLastListAttributeAtRange=function(t,n){var r;return null==n&&(n={}),r=this.blockList,this.eachBlockAtRange(t,(function(t,i,o){var a;if((a=t.getLastAttribute())&&e(a).listAttribute&&a!==n.exceptAttributeName)return r=r.editObjectAtIndex(o,(function(){return t.removeAttribute(a)}))})),new this.constructor(r)},c.prototype.removeLastTerminalAttributeAtRange=function(t){var n;return n=this.blockList,this.eachBlockAtRange(t,(function(t,r,i){var o;if((o=t.getLastAttribute())&&e(o).terminal)return n=n.editObjectAtIndex(i,(function(){return t.removeAttribute(o)}))})),new this.constructor(n)},c.prototype.removeBlockAttributesAtRange=function(t){var e;return e=this.blockList,this.eachBlockAtRange(t,(function(t,n,r){return t.hasAttributes()?e=e.editObjectAtIndex(r,(function(){return t.copyWithoutAttributes()})):void 0})),new this.constructor(e)},c.prototype.expandRangeToLineBreaksAndSplitBlocks=function(t){var e,r,i,o,a,s,u,c,l;return l=(s=t=n(t))[0],o=s[1],c=this.locationFromPosition(l),i=this.locationFromPosition(o),u=(e=this).getBlockAtIndex(c.index),null!=(c.offset=u.findLineBreakInDirectionFromPosition("backward",c.offset))&&(a=e.positionFromLocation(c),e=e.insertBlockBreakAtRange([a,a+1]),i.index+=1,i.offset-=e.getBlockAtIndex(c.index).getLength(),c.index+=1),c.offset=0,0===i.offset&&i.index>c.index?(i.index-=1,i.offset=e.getBlockAtIndex(i.index).getBlockBreakPosition()):("\n"===(r=e.getBlockAtIndex(i.index)).text.getStringAtRange([i.offset-1,i.offset])?i.offset-=1:i.offset=r.findLineBreakInDirectionFromPosition("forward",i.offset),i.offset!==r.getBlockBreakPosition()&&(a=e.positionFromLocation(i),e=e.insertBlockBreakAtRange([a,a+1]))),l=e.positionFromLocation(c),o=e.positionFromLocation(i),{document:e,range:t=n([l,o])}},c.prototype.convertLineBreaksToBlockBreaksInRange=function(t){var e,r,i;return r=(t=n(t))[0],i=this.getStringAtRange(t).slice(0,-1),e=this,i.replace(/.*?\n/g,(function(t){return r+=t.length,e=e.insertBlockBreakAtRange([r-1,r])})),{document:e,range:t}},c.prototype.consolidateBlocksAtRange=function(t){var e,r,i,o,a;return a=(i=t=n(t))[0],r=i[1],o=this.locationFromPosition(a).index,e=this.locationFromPosition(r).index,new this.constructor(this.blockList.consolidateFromIndexToIndex(o,e))},c.prototype.getDocumentAtRange=function(t){var e;return t=n(t),e=this.blockList.getSplittableListInRange(t).toArray(),new this.constructor(e)},c.prototype.getStringAtRange=function(t){var e,r;return(r=t=n(t))[r.length-1]!==this.getLength()&&(e=-1),this.getDocumentAtRange(t).toString().slice(0,e)},c.prototype.getBlockAtIndex=function(t){return this.blockList.getObjectAtIndex(t)},c.prototype.getBlockAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getBlockAtIndex(e)},c.prototype.getTextAtIndex=function(t){var e;return null!=(e=this.getBlockAtIndex(t))?e.text:void 0},c.prototype.getTextAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getTextAtIndex(e)},c.prototype.getPieceAtPosition=function(t){var e,n,r;return e=(r=this.locationFromPosition(t)).index,n=r.offset,this.getTextAtIndex(e).getPieceAtPosition(n)},c.prototype.getCharacterAtPosition=function(t){var e,n,r;return e=(r=this.locationFromPosition(t)).index,n=r.offset,this.getTextAtIndex(e).getStringAtRange([n,n+1])},c.prototype.getLength=function(){return this.blockList.getEndPosition()},c.prototype.getBlocks=function(){return this.blockList.toArray()},c.prototype.getBlockCount=function(){return this.blockList.length},c.prototype.getEditCount=function(){return this.editCount},c.prototype.eachBlock=function(t){return this.blockList.eachObject(t)},c.prototype.eachBlockAtRange=function(t,e){var r,i,o,a,s,u,c,l,h,p,d,f;if(d=(u=t=n(t))[0],o=u[1],p=this.locationFromPosition(d),i=this.locationFromPosition(o),p.index===i.index)return r=this.getBlockAtIndex(p.index),f=[p.offset,i.offset],e(r,f,p.index);for(h=[],s=a=c=p.index,l=i.index;l>=c?l>=a:a>=l;s=l>=c?++a:--a)(r=this.getBlockAtIndex(s))?(f=function(){switch(s){case p.index:return[p.offset,r.text.getLength()];case i.index:return[0,i.offset];default:return[0,r.text.getLength()]}}(),h.push(e(r,f,s))):h.push(void 0);return h},c.prototype.getCommonAttributesAtRange=function(t){var e,o,a;return o=(t=n(t))[0],i(t)?this.getCommonAttributesAtPosition(o):(a=[],e=[],this.eachBlockAtRange(t,(function(t,n){return n[0]!==n[1]?(a.push(t.text.getCommonAttributesAtRange(n)),e.push(l(t))):void 0})),r.Hash.fromCommonAttributesOfObjects(a).merge(r.Hash.fromCommonAttributesOfObjects(e)).toObject())},c.prototype.getCommonAttributesAtPosition=function(t){var e,n,i,o,a,s,c,h,p,d;if(a=(p=this.locationFromPosition(t)).index,h=p.offset,!(i=this.getBlockAtIndex(a)))return{};for(c in o=l(i),e=i.text.getAttributesAtPosition(h),n=i.text.getAttributesAtPosition(h-1),s=function(){var t,e;for(c in e=[],t=r.config.textAttributes)(d=t[c]).inheritable&&e.push(c);return e}(),n)((d=n[c])===e[c]||u.call(s,c)>=0)&&(o[c]=d);return o},c.prototype.getRangeOfCommonAttributeAtPosition=function(t,e){var r,i,o,a,s,u,c,l;return o=(s=this.locationFromPosition(e)).index,a=s.offset,l=(u=this.getTextAtIndex(o).getExpandedRangeForAttributeAtOffset(t,a))[0],i=u[1],c=this.positionFromLocation({index:o,offset:l}),r=this.positionFromLocation({index:o,offset:i}),n([c,r])},c.prototype.getBaseBlockAttributes=function(){var t,e,n,r,i,o,a;for(t=this.getBlockAtIndex(0).getAttributes(),n=r=1,a=this.getBlockCount();a>=1?a>r:r>a;n=a>=1?++r:--r)e=this.getBlockAtIndex(n).getAttributes(),o=Math.min(t.length,e.length),t=function(){var n,r,a;for(a=[],i=n=0,r=o;(r>=0?r>n:n>r)&&e[i]===t[i];i=r>=0?++n:--n)a.push(e[i]);return a}();return t},l=function(t){var e,n;return n={},(e=t.getLastAttribute())&&(n[e]=!0),n},c.prototype.getAttachmentById=function(t){var e,n,r,i;for(n=0,r=(i=this.getAttachments()).length;r>n;n++)if((e=i[n]).id===t)return e},c.prototype.getAttachmentPieces=function(){var t;return t=[],this.blockList.eachObject((function(e){var n;return n=e.text,t=t.concat(n.getAttachmentPieces())})),t},c.prototype.getAttachments=function(){var t,e,n,r,i;for(i=[],t=0,e=(r=this.getAttachmentPieces()).length;e>t;t++)n=r[t],i.push(n.attachment);return i},c.prototype.getRangeOfAttachment=function(t){var e,r,i,o,a,s,u;for(o=0,r=e=0,i=(a=this.blockList.toArray()).length;i>e;r=++e){if(u=(s=a[r].text).getRangeOfAttachment(t))return n([o+u[0],o+u[1]]);o+=s.getLength()}},c.prototype.getLocationRangeOfAttachment=function(t){var e;return e=this.getRangeOfAttachment(t),this.locationRangeFromRange(e)},c.prototype.getAttachmentPieceForAttachment=function(t){var e,n,r,i;for(e=0,n=(i=this.getAttachmentPieces()).length;n>e;e++)if((r=i[e]).attachment===t)return r},c.prototype.findRangesForBlockAttribute=function(t){var e,n,r,i,o,a,s;for(o=0,a=[],n=0,r=(s=this.getBlocks()).length;r>n;n++)i=(e=s[n]).getLength(),e.hasAttribute(t)&&a.push([o,o+i]),o+=i;return a},c.prototype.findRangesForTextAttribute=function(t,e){var n,r,i,o,a,s,u,c,l,h;for(h=(null!=e?e:{}).withValue,s=0,u=[],c=[],o=function(e){return null!=h?e.getAttribute(t)===h:e.hasAttribute(t)},n=0,r=(l=this.getPieces()).length;r>n;n++)i=(a=l[n]).getLength(),o(a)&&(u[1]===s?u[1]=s+i:c.push(u=[s,s+i])),s+=i;return c},c.prototype.locationFromPosition=function(t){var e,n;return null!=(n=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,t))).index?n:{index:(e=this.getBlocks()).length-1,offset:e[e.length-1].getLength()}},c.prototype.positionFromLocation=function(t){return this.blockList.findPositionAtIndexAndOffset(t.index,t.offset)},c.prototype.locationRangeFromPosition=function(t){return n(this.locationFromPosition(t))},c.prototype.locationRangeFromRange=function(t){var e,r,i,o;if(t=n(t))return o=t[0],r=t[1],i=this.locationFromPosition(o),e=this.locationFromPosition(r),n([i,e])},c.prototype.rangeFromLocationRange=function(t){var e,r;return t=n(t),e=this.positionFromLocation(t[0]),i(t)||(r=this.positionFromLocation(t[1])),n([e,r])},c.prototype.isEqualTo=function(t){return this.blockList.isEqualTo(null!=t?t.blockList:void 0)},c.prototype.getTexts=function(){var t,e,n,r,i;for(i=[],e=0,n=(r=this.getBlocks()).length;n>e;e++)t=r[e],i.push(t.text);return i},c.prototype.getPieces=function(){var t,e,n,r,i;for(n=[],t=0,e=(r=this.getTexts()).length;e>t;t++)i=r[t],n.push.apply(n,i.getPieces());return n},c.prototype.getObjects=function(){return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())},c.prototype.toSerializableDocument=function(){var t;return t=[],this.blockList.eachObject((function(e){return t.push(e.copyWithText(e.text.toSerializableText()))})),new this.constructor(t)},c.prototype.toString=function(){return this.blockList.toString()},c.prototype.toJSON=function(){return this.blockList.toJSON()},c.prototype.toConsole=function(){var t;return JSON.stringify(function(){var e,n,r,i;for(i=[],e=0,n=(r=this.blockList.toArray()).length;n>e;e++)t=r[e],i.push(JSON.parse(t.text.toConsole()));return i}.call(this))},c}(r.Object)}.call(this),function(){r.LineBreakInsertion=function(){function t(t){var e;this.composition=t,this.document=this.composition.document,e=this.composition.getSelectedRange(),this.startPosition=e[0],this.endPosition=e[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.endPosition),this.block=this.document.getBlockAtIndex(this.endLocation.index),this.breaksOnReturn=this.block.breaksOnReturn(),this.previousCharacter=this.block.text.getStringAtPosition(this.endLocation.offset-1),this.nextCharacter=this.block.text.getStringAtPosition(this.endLocation.offset)}return t.prototype.shouldInsertBlockBreak=function(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?0!==this.startLocation.offset:this.breaksOnReturn&&"\n"!==this.nextCharacter},t.prototype.shouldBreakFormattedBlock=function(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&"\n"===this.nextCharacter||"\n"===this.previousCharacter)},t.prototype.shouldDecreaseListLevel=function(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()},t.prototype.shouldPrependListItem=function(){return this.block.isListItem()&&0===this.startLocation.offset&&!this.block.isEmpty()},t.prototype.shouldRemoveLastBlockAttribute=function(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()},t}()}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;a=r.normalizeRange,c=r.rangesAreEqual,u=r.rangeIsCollapsed,s=r.objectsAreEqual,t=r.arrayStartsWith,l=r.summarizeArrayChange,n=r.getAllAttributeNames,i=r.getBlockConfig,o=r.getTextConfig,e=r.extend,r.Composition=function(p){function d(){this.document=new r.Document,this.attachments=[],this.currentAttributes={},this.revision=0}return h(d,p),d.prototype.setDocument=function(t){var e;return t.isEqualTo(this.document)?void 0:(this.document=t,this.refreshAttachments(),this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidChangeDocument?e.compositionDidChangeDocument(t):void 0)},d.prototype.getSnapshot=function(){return{document:this.document,selectedRange:this.getSelectedRange()}},d.prototype.loadSnapshot=function(t){var e,n,i,o;return e=t.document,o=t.selectedRange,null!=(n=this.delegate)&&"function"==typeof n.compositionWillLoadSnapshot&&n.compositionWillLoadSnapshot(),this.setDocument(null!=e?e:new r.Document),this.setSelection(null!=o?o:[0,0]),null!=(i=this.delegate)&&"function"==typeof i.compositionDidLoadSnapshot?i.compositionDidLoadSnapshot():void 0},d.prototype.insertText=function(t,e){var n,r,i,o;return o=(null!=e?e:{updatePosition:!0}).updatePosition,r=this.getSelectedRange(),this.setDocument(this.document.insertTextAtRange(t,r)),n=(i=r[0])+t.getLength(),o&&this.setSelection(n),this.notifyDelegateOfInsertionAtRange([i,n])},d.prototype.insertBlock=function(t){var e;return null==t&&(t=new r.Block),e=new r.Document([t]),this.insertDocument(e)},d.prototype.insertDocument=function(t){var e,n,i;return null==t&&(t=new r.Document),n=this.getSelectedRange(),this.setDocument(this.document.insertDocumentAtRange(t,n)),e=(i=n[0])+t.getLength(),this.setSelection(e),this.notifyDelegateOfInsertionAtRange([i,e])},d.prototype.insertString=function(t,e){var n,i;return n=this.getCurrentTextAttributes(),i=r.Text.textForStringWithAttributes(t,n),this.insertText(i,e)},d.prototype.insertBlockBreak=function(){var t,e,n;return e=this.getSelectedRange(),this.setDocument(this.document.insertBlockBreakAtRange(e)),t=(n=e[0])+1,this.setSelection(t),this.notifyDelegateOfInsertionAtRange([n,t])},d.prototype.insertLineBreak=function(){var t,e;return(e=new r.LineBreakInsertion(this)).shouldDecreaseListLevel()?(this.decreaseListLevel(),this.setSelection(e.startPosition)):e.shouldPrependListItem()?(t=new r.Document([e.block.copyWithoutText()]),this.insertDocument(t)):e.shouldInsertBlockBreak()?this.insertBlockBreak():e.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():e.shouldBreakFormattedBlock()?this.breakFormattedBlock(e):this.insertString("\n")},d.prototype.insertHTML=function(t){var e,n,i,o;return e=r.Document.fromHTML(t),i=this.getSelectedRange(),this.setDocument(this.document.mergeDocumentAtRange(e,i)),n=(o=i[0])+e.getLength()-1,this.setSelection(n),this.notifyDelegateOfInsertionAtRange([o,n])},d.prototype.replaceHTML=function(t){var e,n,i;return e=r.Document.fromHTML(t).copyUsingObjectsFromDocument(this.document),n=this.getLocationRange({strict:!1}),i=this.document.rangeFromLocationRange(n),this.setDocument(e),this.setSelection(i)},d.prototype.insertFile=function(t){return this.insertFiles([t])},d.prototype.insertFiles=function(t){var e,n,i,o,a,s;for(n=[],o=0,a=t.length;a>o;o++)i=t[o],(null!=(s=this.delegate)?s.compositionShouldAcceptFile(i):void 0)&&(e=r.Attachment.attachmentForFile(i),n.push(e));return this.insertAttachments(n)},d.prototype.insertAttachment=function(t){return this.insertAttachments([t])},d.prototype.insertAttachments=function(t){var e,n,i,o,a,s,u,c,l;for(c=new r.Text,o=0,a=t.length;a>o;o++)l=(e=t[o]).getType(),s=null!=(u=r.config.attachments[l])?u.presentation:void 0,i=this.getCurrentTextAttributes(),s&&(i.presentation=s),n=r.Text.textForAttachmentWithAttributes(e,i),c=c.appendText(n);return this.insertText(c)},d.prototype.shouldManageDeletingInDirection=function(t){var e;if(e=this.getLocationRange(),u(e)){if("backward"===t&&0===e[0].offset)return!0;if(this.shouldManageMovingCursorInDirection(t))return!0}else if(e[0].index!==e[1].index)return!0;return!1},d.prototype.deleteInDirection=function(t,e){var n,r,i,o,a,s,c,l;return o=(null!=e?e:{}).length,a=this.getLocationRange(),s=this.getSelectedRange(),(c=u(s))?i="backward"===t&&0===a[0].offset:l=a[0].index!==a[1].index,!(i&&this.canDecreaseBlockAttributeLevel()&&(r=this.getBlock(),r.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(s[0]),r.isEmpty()))&&(c&&(s=this.getExpandedRangeInDirection(t,{length:o}),"backward"===t&&(n=this.getAttachmentAtRange(s))),n?(this.editAttachment(n),!1):(this.setDocument(this.document.removeTextAtRange(s)),this.setSelection(s[0]),!i&&!l&&void 0))},d.prototype.moveTextFromRange=function(t){var e;return e=this.getSelectedRange()[0],this.setDocument(this.document.moveTextFromRangeToPosition(t,e)),this.setSelection(e)},d.prototype.removeAttachment=function(t){var e;return(e=this.document.getRangeOfAttachment(t))?(this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(e)),this.setSelection(e[0])):void 0},d.prototype.removeLastBlockAttribute=function(){var t,e,n,r;return r=(n=this.getSelectedRange())[0],e=n[1],t=this.document.getBlockAtPosition(e),this.removeCurrentAttribute(t.getLastAttribute()),this.setSelection(r)}," ",d.prototype.insertPlaceholder=function(){return this.placeholderPosition=this.getPosition(),this.insertString(" ")},d.prototype.selectPlaceholder=function(){return null!=this.placeholderPosition?(this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+" ".length]),this.getSelectedRange()):void 0},d.prototype.forgetPlaceholder=function(){return this.placeholderPosition=null},d.prototype.hasCurrentAttribute=function(t){var e;return null!=(e=this.currentAttributes[t])&&!1!==e},d.prototype.toggleCurrentAttribute=function(t){var e;return(e=!this.currentAttributes[t])?this.setCurrentAttribute(t,e):this.removeCurrentAttribute(t)},d.prototype.canSetCurrentAttribute=function(t){return i(t)?this.canSetCurrentBlockAttribute(t):this.canSetCurrentTextAttribute(t)},d.prototype.canSetCurrentTextAttribute=function(){var t,e,n,r;if(t=this.getSelectedDocument()){for(e=0,n=(r=t.getAttachments()).length;n>e;e++)if(!r[e].hasContent())return!1;return!0}},d.prototype.canSetCurrentBlockAttribute=function(){var t;if(t=this.getBlock())return!t.isTerminalBlock()},d.prototype.setCurrentAttribute=function(t,e){return i(t)?this.setBlockAttribute(t,e):(this.setTextAttribute(t,e),this.currentAttributes[t]=e,this.notifyDelegateOfCurrentAttributesChange())},d.prototype.setTextAttribute=function(t,e){var n,i;if(n=this.getSelectedRange())return n[0]!==n[1]?this.setDocument(this.document.addAttributeAtRange(t,e,n)):"href"===t?(i=r.Text.textForStringWithAttributes(e,{href:e}),this.insertText(i)):void 0},d.prototype.setBlockAttribute=function(t,e){var n;if(n=this.getSelectedRange())return this.canSetCurrentAttribute(t)?(this.getBlock(),this.setDocument(this.document.applyBlockAttributeAtRange(t,e,n)),this.setSelection(n)):void 0},d.prototype.removeCurrentAttribute=function(t){return i(t)?(this.removeBlockAttribute(t),this.updateCurrentAttributes()):(this.removeTextAttribute(t),delete this.currentAttributes[t],this.notifyDelegateOfCurrentAttributesChange())},d.prototype.removeTextAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},d.prototype.removeBlockAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},d.prototype.canDecreaseNestingLevel=function(){var t;return(null!=(t=this.getBlock())?t.getNestingLevel():void 0)>0},d.prototype.canIncreaseNestingLevel=function(){var e,n,r;if(e=this.getBlock())return null!=(r=i(e.getLastNestableAttribute()))&&r.listAttribute?(n=this.getPreviousBlock())?t(n.getListItemAttributes(),e.getListItemAttributes()):void 0:e.getNestingLevel()>0},d.prototype.decreaseNestingLevel=function(){var t;if(t=this.getBlock())return this.setDocument(this.document.replaceBlock(t,t.decreaseNestingLevel()))},d.prototype.increaseNestingLevel=function(){var t;if(t=this.getBlock())return this.setDocument(this.document.replaceBlock(t,t.increaseNestingLevel()))},d.prototype.canDecreaseBlockAttributeLevel=function(){var t;return(null!=(t=this.getBlock())?t.getAttributeLevel():void 0)>0},d.prototype.decreaseBlockAttributeLevel=function(){var t,e;return(t=null!=(e=this.getBlock())?e.getLastAttribute():void 0)?this.removeCurrentAttribute(t):void 0},d.prototype.decreaseListLevel=function(){var t,e,n,r,i,o;for(o=this.getSelectedRange()[0],n=i=this.document.locationFromPosition(o).index,t=this.getBlock().getAttributeLevel();(e=this.document.getBlockAtIndex(n+1))&&e.isListItem()&&e.getAttributeLevel()>t;)n++;return o=this.document.positionFromLocation({index:i,offset:0}),r=this.document.positionFromLocation({index:n,offset:0}),this.setDocument(this.document.removeLastListAttributeAtRange([o,r]))},d.prototype.updateCurrentAttributes=function(){var t,e,r,i,o,a;if(a=this.getSelectedRange({ignoreLock:!0})){for(e=this.document.getCommonAttributesAtRange(a),r=0,i=(o=n()).length;i>r;r++)e[t=o[r]]||this.canSetCurrentAttribute(t)||(e[t]=!1);if(!s(e,this.currentAttributes))return this.currentAttributes=e,this.notifyDelegateOfCurrentAttributesChange()}},d.prototype.getCurrentAttributes=function(){return e.call({},this.currentAttributes)},d.prototype.getCurrentTextAttributes=function(){var t,e,n,r;for(e in t={},n=this.currentAttributes)!1!==(r=n[e])&&o(e)&&(t[e]=r);return t},d.prototype.freezeSelection=function(){return this.setCurrentAttribute("frozen",!0)},d.prototype.thawSelection=function(){return this.removeCurrentAttribute("frozen")},d.prototype.hasFrozenSelection=function(){return this.hasCurrentAttribute("frozen")},d.proxyMethod("getSelectionManager().getPointRange"),d.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),d.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),d.proxyMethod("getSelectionManager().locationIsCursorTarget"),d.proxyMethod("getSelectionManager().selectionIsExpanded"),d.proxyMethod("delegate?.getSelectionManager"),d.prototype.setSelection=function(t){var e,n;return e=this.document.locationRangeFromRange(t),null!=(n=this.delegate)?n.compositionDidRequestChangingSelectionToLocationRange(e):void 0},d.prototype.getSelectedRange=function(){var t;return(t=this.getLocationRange())?this.document.rangeFromLocationRange(t):void 0},d.prototype.setSelectedRange=function(t){var e;return e=this.document.locationRangeFromRange(t),this.getSelectionManager().setLocationRange(e)},d.prototype.getPosition=function(){var t;return(t=this.getLocationRange())?this.document.positionFromLocation(t[0]):void 0},d.prototype.getLocationRange=function(t){var e,n;return null!=(e=null!=(n=this.targetLocationRange)?n:this.getSelectionManager().getLocationRange(t))?e:a({index:0,offset:0})},d.prototype.withTargetLocationRange=function(t,e){var n;this.targetLocationRange=t;try{n=e()}finally{this.targetLocationRange=null}return n},d.prototype.withTargetRange=function(t,e){var n;return n=this.document.locationRangeFromRange(t),this.withTargetLocationRange(n,e)},d.prototype.withTargetDOMRange=function(t,e){var n;return n=this.createLocationRangeFromDOMRange(t,{strict:!1}),this.withTargetLocationRange(n,e)},d.prototype.getExpandedRangeInDirection=function(t,e){var n,r,i,o;return r=(null!=e?e:{}).length,o=(i=this.getSelectedRange())[0],n=i[1],"backward"===t?r?o-=r:o=this.translateUTF16PositionFromOffset(o,-1):r?n+=r:n=this.translateUTF16PositionFromOffset(n,1),a([o,n])},d.prototype.shouldManageMovingCursorInDirection=function(t){var e;return!!this.editingAttachment||(e=this.getExpandedRangeInDirection(t),null!=this.getAttachmentAtRange(e))},d.prototype.moveCursorInDirection=function(t){var e,n,r,i;return this.editingAttachment?r=this.document.getRangeOfAttachment(this.editingAttachment):(i=this.getSelectedRange(),r=this.getExpandedRangeInDirection(t),n=!c(i,r)),this.setSelectedRange("backward"===t?r[0]:r[1]),n&&(e=this.getAttachmentAtRange(r))?this.editAttachment(e):void 0},d.prototype.expandSelectionInDirection=function(t,e){var n,r;return n=(null!=e?e:{}).length,r=this.getExpandedRangeInDirection(t,{length:n}),this.setSelectedRange(r)},d.prototype.expandSelectionForEditing=function(){return this.hasCurrentAttribute("href")?this.expandSelectionAroundCommonAttribute("href"):void 0},d.prototype.expandSelectionAroundCommonAttribute=function(t){var e,n;return e=this.getPosition(),n=this.document.getRangeOfCommonAttributeAtPosition(t,e),this.setSelectedRange(n)},d.prototype.selectionContainsAttachments=function(){var t;return(null!=(t=this.getSelectedAttachments())?t.length:void 0)>0},d.prototype.selectionIsInCursorTarget=function(){return this.editingAttachment||this.positionIsCursorTarget(this.getPosition())},d.prototype.positionIsCursorTarget=function(t){var e;return(e=this.document.locationFromPosition(t))?this.locationIsCursorTarget(e):void 0},d.prototype.positionIsBlockBreak=function(t){var e;return null!=(e=this.document.getPieceAtPosition(t))?e.isBlockBreak():void 0},d.prototype.getSelectedDocument=function(){var t;return(t=this.getSelectedRange())?this.document.getDocumentAtRange(t):void 0},d.prototype.getSelectedAttachments=function(){var t;return null!=(t=this.getSelectedDocument())?t.getAttachments():void 0},d.prototype.getAttachments=function(){return this.attachments.slice(0)},d.prototype.refreshAttachments=function(){var t,e,n,r,i,o,a,s,u,c,h,p;for(n=this.document.getAttachments(),t=(s=l(this.attachments,n)).added,h=s.removed,this.attachments=n,r=0,o=h.length;o>r;r++)(e=h[r]).delegate=null,null!=(u=this.delegate)&&"function"==typeof u.compositionDidRemoveAttachment&&u.compositionDidRemoveAttachment(e);for(p=[],i=0,a=t.length;a>i;i++)(e=t[i]).delegate=this,p.push(null!=(c=this.delegate)&&"function"==typeof c.compositionDidAddAttachment?c.compositionDidAddAttachment(e):void 0);return p},d.prototype.attachmentDidChangeAttributes=function(t){var e;return this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidEditAttachment?e.compositionDidEditAttachment(t):void 0},d.prototype.attachmentDidChangePreviewURL=function(t){var e;return this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidChangeAttachmentPreviewURL?e.compositionDidChangeAttachmentPreviewURL(t):void 0},d.prototype.editAttachment=function(t,e){var n;if(t!==this.editingAttachment)return this.stopEditingAttachment(),this.editingAttachment=t,null!=(n=this.delegate)&&"function"==typeof n.compositionDidStartEditingAttachment?n.compositionDidStartEditingAttachment(this.editingAttachment,e):void 0},d.prototype.stopEditingAttachment=function(){var t;if(this.editingAttachment)return null!=(t=this.delegate)&&"function"==typeof t.compositionDidStopEditingAttachment&&t.compositionDidStopEditingAttachment(this.editingAttachment),this.editingAttachment=null},d.prototype.updateAttributesForAttachment=function(t,e){return this.setDocument(this.document.updateAttributesForAttachment(t,e))},d.prototype.removeAttributeForAttachment=function(t,e){return this.setDocument(this.document.removeAttributeForAttachment(t,e))},d.prototype.breakFormattedBlock=function(t){var e,n,i,o,a;return n=t.document,e=t.block,a=[(o=t.startPosition)-1,o],e.getBlockBreakPosition()===t.startLocation.offset?(e.breaksOnReturn()&&"\n"===t.nextCharacter?o+=1:n=n.removeTextAtRange(a),a=[o,o]):"\n"===t.nextCharacter?"\n"===t.previousCharacter?a=[o-1,o+1]:(a=[o,o+1],o+=1):t.startLocation.offset-1!=0&&(o+=1),i=new r.Document([e.removeLastAttribute().copyWithoutText()]),this.setDocument(n.insertDocumentAtRange(i,a)),this.setSelection(o)},d.prototype.getPreviousBlock=function(){var t,e;return(e=this.getLocationRange())&&(t=e[0].index)>0?this.document.getBlockAtIndex(t-1):void 0},d.prototype.getBlock=function(){var t;return(t=this.getLocationRange())?this.document.getBlockAtIndex(t[0].index):void 0},d.prototype.getAttachmentAtRange=function(t){var e;return(e=this.document.getDocumentAtRange(t)).toString()===r.OBJECT_REPLACEMENT_CHARACTER+"\n"?e.getAttachments()[0]:void 0},d.prototype.notifyDelegateOfCurrentAttributesChange=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.compositionDidChangeCurrentAttributes?t.compositionDidChangeCurrentAttributes(this.currentAttributes):void 0},d.prototype.notifyDelegateOfInsertionAtRange=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionDidPerformInsertionAtRange?e.compositionDidPerformInsertionAtRange(t):void 0},d.prototype.translateUTF16PositionFromOffset=function(t,e){var n,r;return n=(r=this.document.toUTF16String()).offsetFromUCS2Offset(t),r.offsetToUCS2Offset(n+e)},d}(r.BasicObject)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.UndoManager=function(e){function n(t){this.composition=t,this.undoEntries=[],this.redoEntries=[]}var r;return t(n,e),n.prototype.recordUndoEntry=function(t,e){var n,i,o,a,s;return i=(a=null!=e?e:{}).context,n=a.consolidatable,o=this.undoEntries.slice(-1)[0],n&&r(o,t,i)?void 0:(s=this.createEntry({description:t,context:i}),this.undoEntries.push(s),this.redoEntries=[])},n.prototype.undo=function(){var t,e;return(e=this.undoEntries.pop())?(t=this.createEntry(e),this.redoEntries.push(t),this.composition.loadSnapshot(e.snapshot)):void 0},n.prototype.redo=function(){var t,e;return(t=this.redoEntries.pop())?(e=this.createEntry(t),this.undoEntries.push(e),this.composition.loadSnapshot(t.snapshot)):void 0},n.prototype.canUndo=function(){return this.undoEntries.length>0},n.prototype.canRedo=function(){return this.redoEntries.length>0},n.prototype.createEntry=function(t){var e,n,r;return n=(r=null!=t?t:{}).description,e=r.context,{description:null!=n?n.toString():void 0,context:JSON.stringify(e),snapshot:this.composition.getSnapshot()}},r=function(t,e,n){return(null!=t?t.description:void 0)===(null!=e?e.toString():void 0)&&(null!=t?t.context:void 0)===JSON.stringify(n)},n}(r.BasicObject)}.call(this),function(){var t;r.attachmentGalleryFilter=function(e){var n;return(n=new t(e)).perform(),n.getSnapshot()},t=function(){function t(t){this.document=t.document,this.selectedRange=t.selectedRange}var e;return e="attachmentGallery","presentation","gallery",t.prototype.perform=function(){return this.removeBlockAttribute(),this.applyBlockAttribute()},t.prototype.getSnapshot=function(){return{document:this.document,selectedRange:this.selectedRange}},t.prototype.removeBlockAttribute=function(){var t,n,r,i,o;for(o=[],t=0,n=(i=this.findRangesOfBlocks()).length;n>t;t++)r=i[t],o.push(this.document=this.document.removeAttributeAtRange(e,r));return o},t.prototype.applyBlockAttribute=function(){var t,n,r,i,o,a;for(r=0,a=[],t=0,n=(o=this.findRangesOfPieces()).length;n>t;t++)(i=o[t])[1]-i[0]>1&&(i[0]+=r,i[1]+=r,"\n"!==this.document.getCharacterAtPosition(i[1])&&(this.document=this.document.insertBlockBreakAtRange(i[1]),i[1]n;n++)e=t[n],this.manageAttachment(e)}return t(n,e),n.prototype.getAttachments=function(){var t,e,n,r;for(e in r=[],n=this.managedAttachments)t=n[e],r.push(t);return r},n.prototype.manageAttachment=function(t){var e,n;return null!=(e=this.managedAttachments)[n=t.id]?e[n]:e[n]=new r.ManagedAttachment(this,t)},n.prototype.attachmentIsManaged=function(t){return t.id in this.managedAttachments},n.prototype.requestRemovalOfAttachment=function(t){var e;return this.attachmentIsManaged(t)&&null!=(e=this.delegate)&&"function"==typeof e.attachmentManagerDidRequestRemovalOfAttachment?e.attachmentManagerDidRequestRemovalOfAttachment(t):void 0},n.prototype.unmanageAttachment=function(t){var e;return e=this.managedAttachments[t.id],delete this.managedAttachments[t.id],e},n}(r.BasicObject)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h;t=r.elementContainsNode,e=r.findChildIndexOfNode,o=r.nodeIsBlockStart,a=r.nodeIsBlockStartComment,i=r.nodeIsBlockContainer,s=r.nodeIsCursorTarget,u=r.nodeIsEmptyTextNode,c=r.nodeIsTextNode,n=r.nodeIsAttachmentElement,l=r.tagName,h=r.walkTree,r.LocationMapper=function(){function r(t){this.element=t}var p,d,f,g;return r.prototype.findLocationFromContainerAndOffset=function(n,r,i){var a,u,l,p,g,m,v;for(m=(null!=i?i:{strict:!0}).strict,u=0,l=!1,p={index:0,offset:0},(a=this.findAttachmentElementParentForNode(n))&&(n=a.parentNode,r=e(a)),v=h(this.element,{usingFilter:f});v.nextNode();){if((g=v.currentNode)===n&&c(n)){s(g)||(p.offset+=r);break}if(g.parentNode===n){if(u++===r)break}else if(!t(n,g)&&u>0)break;o(g,{strict:m})?(l&&p.index++,p.offset=0,l=!0):p.offset+=d(g)}return p},r.prototype.findContainerAndOffsetFromLocation=function(t){var n,r,a,u,l;if(0===t.index&&0===t.offset){for(n=this.element,u=0;n.firstChild;)if(n=n.firstChild,i(n)){u=1;break}return[n,u]}if(r=(l=this.findNodeAndOffsetFromLocation(t))[0],a=l[1],r){if(c(r))0===d(r)?(n=r.parentNode.parentNode,u=e(r.parentNode),s(r,{name:"right"})&&u++):(n=r,u=t.offset-a);else{if(n=r.parentNode,!o(r.previousSibling)&&!i(n))for(;r===n.lastChild&&(r=n,n=n.parentNode,!i(n)););u=e(r),0!==t.offset&&u++}return[n,u]}},r.prototype.findNodeAndOffsetFromLocation=function(t){var e,n,r,i,o,a,u,l;for(u=0,n=0,r=(l=this.getSignificantNodesForIndex(t.index)).length;r>n;n++){if(e=l[n],i=d(e),t.offset<=u+i)if(c(e)){if(o=e,a=u,t.offset===a&&s(o))break}else o||(o=e,a=u);if((u+=i)>t.offset)break}return[o,a]},r.prototype.findAttachmentElementParentForNode=function(t){for(;t&&t!==this.element;){if(n(t))return t;t=t.parentNode}},r.prototype.getSignificantNodesForIndex=function(t){var e,n,r,i,o;for(r=[],o=h(this.element,{usingFilter:p}),i=!1;o.nextNode();)if(n=o.currentNode,a(n)){if(null!=e?e++:e=0,e===t)i=!0;else if(i)break}else i&&r.push(n);return r},d=function(t){return t.nodeType===Node.TEXT_NODE?s(t)?0:t.textContent.length:"br"===l(t)||n(t)?1:0},p=function(t){return g(t)===NodeFilter.FILTER_ACCEPT?f(t):NodeFilter.FILTER_REJECT},g=function(t){return u(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},f=function(t){return n(t.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},r}()}.call(this),function(){var t,e,n=[].slice;t=r.getDOMRange,e=r.setDOMRange,r.PointMapper=function(){function r(){}return r.prototype.createDOMRangeFromPoint=function(n){var r,i,o,a,s,u,c,l;if(c=n.x,l=n.y,document.caretPositionFromPoint)return o=(s=document.caretPositionFromPoint(c,l)).offsetNode,i=s.offset,(r=document.createRange()).setStart(o,i),r;if(document.caretRangeFromPoint)return document.caretRangeFromPoint(c,l);if(document.body.createTextRange){a=t();try{(u=document.body.createTextRange()).moveToPoint(c,l),u.select()}catch(t){}return r=t(),e(a),r}},r.prototype.getClientRectsForDOMRange=function(t){var e;return[(e=n.call(t.getClientRects()))[0],e[e.length-1]]},r}()}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},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,o=[].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=r.getDOMRange,r.SelectionChangeObserver=function(r){function i(){this.run=e(this.run,this),this.update=e(this.update,this),this.selectionManagers=[]}var a;return n(i,r),i.prototype.start=function(){return this.started?void 0:(this.started=!0,"onselectionchange"in document?document.addEventListener("selectionchange",this.update,!0):this.run())},i.prototype.stop=function(){return this.started?(this.started=!1,document.removeEventListener("selectionchange",this.update,!0)):void 0},i.prototype.registerSelectionManager=function(t){return o.call(this.selectionManagers,t)<0?(this.selectionManagers.push(t),this.start()):void 0},i.prototype.unregisterSelectionManager=function(t){var e;return this.selectionManagers=function(){var n,r,i,o;for(o=[],n=0,r=(i=this.selectionManagers).length;r>n;n++)(e=i[n])!==t&&o.push(e);return o}.call(this),0===this.selectionManagers.length?this.stop():void 0},i.prototype.notifySelectionManagersOfSelectionChange=function(){var t,e,n,r,i;for(r=[],t=0,e=(n=this.selectionManagers).length;e>t;t++)i=n[t],r.push(i.selectionDidChange());return r},i.prototype.update=function(){var e;return e=t(),a(e,this.domRange)?void 0:(this.domRange=e,this.notifySelectionManagersOfSelectionChange())},i.prototype.reset=function(){return this.domRange=null,this.update()},i.prototype.run=function(){return this.started?(this.update(),requestAnimationFrame(this.run)):void 0},a=function(t,e){return(null!=t?t.startContainer:void 0)===(null!=e?e.startContainer:void 0)&&(null!=t?t.startOffset:void 0)===(null!=e?e.startOffset:void 0)&&(null!=t?t.endContainer:void 0)===(null!=e?e.endContainer:void 0)&&(null!=t?t.endOffset:void 0)===(null!=e?e.endOffset:void 0)},i}(r.BasicObject),null==r.selectionChangeObserver&&(r.selectionChangeObserver=new r.SelectionChangeObserver)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function n(){this.constructor=t}for(var r in e)d.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},d={}.hasOwnProperty;n=r.getDOMSelection,e=r.getDOMRange,l=r.setDOMRange,t=r.elementContainsNode,a=r.nodeIsCursorTarget,o=r.innerElementIsActive,i=r.handleEvent,s=r.normalizeRange,u=r.rangeIsCollapsed,c=r.rangesAreEqual,r.SelectionManager=function(d){function f(t){this.element=t,this.selectionDidChange=h(this.selectionDidChange,this),this.didMouseDown=h(this.didMouseDown,this),this.locationMapper=new r.LocationMapper(this.element),this.pointMapper=new r.PointMapper,this.lockCount=0,i("mousedown",{onElement:this.element,withCallback:this.didMouseDown})}return p(f,d),f.prototype.getLocationRange=function(t){var n;return null==t&&(t={}),!1===t.strict?this.createLocationRangeFromDOMRange(e(),{strict:!1}):t.ignoreLock?this.currentLocationRange:null!=(n=this.lockedLocationRange)?n:this.currentLocationRange},f.prototype.setLocationRange=function(t){var e;if(!this.lockedLocationRange)return t=s(t),(e=this.createDOMRangeFromLocationRange(t))?(l(e),this.updateCurrentLocationRange(t)):void 0},f.prototype.setLocationRangeFromPointRange=function(t){var e,n;return t=s(t),n=this.getLocationAtPoint(t[0]),e=this.getLocationAtPoint(t[1]),this.setLocationRange([n,e])},f.prototype.getClientRectAtLocationRange=function(t){var e;return(e=this.createDOMRangeFromLocationRange(t))?this.getClientRectsForDOMRange(e)[1]:void 0},f.prototype.locationIsCursorTarget=function(t){var e,n;return e=(n=this.findNodeAndOffsetFromLocation(t))[0],n[1],a(e)},f.prototype.lock=function(){return 0==this.lockCount++?(this.updateCurrentLocationRange(),this.lockedLocationRange=this.getLocationRange()):void 0},f.prototype.unlock=function(){var t;return 0==--this.lockCount&&(t=this.lockedLocationRange,this.lockedLocationRange=null,null!=t)?this.setLocationRange(t):void 0},f.prototype.clearSelection=function(){var t;return null!=(t=n())?t.removeAllRanges():void 0},f.prototype.selectionIsCollapsed=function(){var t;return!0===(null!=(t=e())?t.collapsed:void 0)},f.prototype.selectionIsExpanded=function(){return!this.selectionIsCollapsed()},f.prototype.createLocationRangeFromDOMRange=function(t,e){var n,r;if(null!=t&&this.domRangeWithinElement(t)&&(r=this.findLocationFromContainerAndOffset(t.startContainer,t.startOffset,e)))return t.collapsed||(n=this.findLocationFromContainerAndOffset(t.endContainer,t.endOffset,e)),s([r,n])},f.proxyMethod("locationMapper.findLocationFromContainerAndOffset"),f.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"),f.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"),f.proxyMethod("pointMapper.createDOMRangeFromPoint"),f.proxyMethod("pointMapper.getClientRectsForDOMRange"),f.prototype.didMouseDown=function(){return this.pauseTemporarily()},f.prototype.pauseTemporarily=function(){var e,n,r,o;return this.paused=!0,n=function(e){return function(){var n,i;for(e.paused=!1,clearTimeout(o),n=0,i=r.length;i>n;n++)r[n].destroy();return t(document,e.element)?e.selectionDidChange():void 0}}(this),o=setTimeout(n,200),r=function(){var t,r,o,a;for(a=[],t=0,r=(o=["mousemove","keydown"]).length;r>t;t++)e=o[t],a.push(i(e,{onElement:document,withCallback:n}));return a}()},f.prototype.selectionDidChange=function(){return this.paused||o(this.element)?void 0:this.updateCurrentLocationRange()},f.prototype.updateCurrentLocationRange=function(t){var n;return(null!=t?t:t=this.createLocationRangeFromDOMRange(e()))&&!c(t,this.currentLocationRange)?(this.currentLocationRange=t,null!=(n=this.delegate)&&"function"==typeof n.locationRangeDidChange?n.locationRangeDidChange(this.currentLocationRange.slice(0)):void 0):void 0},f.prototype.createDOMRangeFromLocationRange=function(t){var e,n,r,i;return r=this.findContainerAndOffsetFromLocation(t[0]),n=u(t)?r:null!=(i=this.findContainerAndOffsetFromLocation(t[1]))?i:r,null!=r&&null!=n?((e=document.createRange()).setStart.apply(e,r),e.setEnd.apply(e,n),e):void 0},f.prototype.getLocationAtPoint=function(t){var e,n;return(e=this.createDOMRangeFromPoint(t))&&null!=(n=this.createLocationRangeFromDOMRange(e))?n[0]:void 0},f.prototype.domRangeWithinElement=function(e){return e.collapsed?t(this.element,e.startContainer):t(this.element,e.startContainer)&&t(this.element,e.endContainer)},f}(r.BasicObject)}.call(this),function(){var t,e,n,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty,s=[].slice;n=r.rangeIsCollapsed,i=r.rangesAreEqual,e=r.objectsAreEqual,t=r.getBlockConfig,r.EditorController=function(a){function u(t){var e,n;this.editorElement=t.editorElement,e=t.document,n=t.html,this.selectionManager=new r.SelectionManager(this.editorElement),this.selectionManager.delegate=this,this.composition=new r.Composition,this.composition.delegate=this,this.attachmentManager=new r.AttachmentManager(this.composition.getAttachments()),this.attachmentManager.delegate=this,this.inputController=new(r["Level"+r.config.input.getLevel()+"InputController"])(this.editorElement),this.inputController.delegate=this,this.inputController.responder=this.composition,this.compositionController=new r.CompositionController(this.editorElement,this.composition),this.compositionController.delegate=this,this.toolbarController=new r.ToolbarController(this.editorElement.toolbarElement),this.toolbarController.delegate=this,this.editor=new r.Editor(this.composition,this.selectionManager,this.editorElement),null!=e?this.editor.loadDocument(e):this.editor.loadHTML(n)}var c;return o(u,a),u.prototype.registerSelectionManager=function(){return r.selectionChangeObserver.registerSelectionManager(this.selectionManager)},u.prototype.unregisterSelectionManager=function(){return r.selectionChangeObserver.unregisterSelectionManager(this.selectionManager)},u.prototype.render=function(){return this.compositionController.render()},u.prototype.reparse=function(){return this.composition.replaceHTML(this.editorElement.innerHTML)},u.prototype.compositionDidChangeDocument=function(){return this.notifyEditorElement("document-change"),this.handlingInput?void 0:this.render()},u.prototype.compositionDidChangeCurrentAttributes=function(t){return this.currentAttributes=t,this.toolbarController.updateAttributes(this.currentAttributes),this.updateCurrentActions(),this.notifyEditorElement("attributes-change",{attributes:this.currentAttributes})},u.prototype.compositionDidPerformInsertionAtRange=function(t){return this.pasting?this.pastedRange=t:void 0},u.prototype.compositionShouldAcceptFile=function(t){return this.notifyEditorElement("file-accept",{file:t})},u.prototype.compositionDidAddAttachment=function(t){var e;return e=this.attachmentManager.manageAttachment(t),this.notifyEditorElement("attachment-add",{attachment:e})},u.prototype.compositionDidEditAttachment=function(t){var e;return this.compositionController.rerenderViewForObject(t),e=this.attachmentManager.manageAttachment(t),this.notifyEditorElement("attachment-edit",{attachment:e}),this.notifyEditorElement("change")},u.prototype.compositionDidChangeAttachmentPreviewURL=function(t){return this.compositionController.invalidateViewForObject(t),this.notifyEditorElement("change")},u.prototype.compositionDidRemoveAttachment=function(t){var e;return e=this.attachmentManager.unmanageAttachment(t),this.notifyEditorElement("attachment-remove",{attachment:e})},u.prototype.compositionDidStartEditingAttachment=function(t,e){return this.attachmentLocationRange=this.composition.document.getLocationRangeOfAttachment(t),this.compositionController.installAttachmentEditorForAttachment(t,e),this.selectionManager.setLocationRange(this.attachmentLocationRange)},u.prototype.compositionDidStopEditingAttachment=function(){return this.compositionController.uninstallAttachmentEditor(),this.attachmentLocationRange=null},u.prototype.compositionDidRequestChangingSelectionToLocationRange=function(t){return!this.loadingSnapshot||this.isFocused()?(this.requestedLocationRange=t,this.compositionRevisionWhenLocationRangeRequested=this.composition.revision,this.handlingInput?void 0:this.render()):void 0},u.prototype.compositionWillLoadSnapshot=function(){return this.loadingSnapshot=!0},u.prototype.compositionDidLoadSnapshot=function(){return this.compositionController.refreshViewCache(),this.render(),this.loadingSnapshot=!1},u.prototype.getSelectionManager=function(){return this.selectionManager},u.proxyMethod("getSelectionManager().setLocationRange"),u.proxyMethod("getSelectionManager().getLocationRange"),u.prototype.attachmentManagerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},u.prototype.compositionControllerWillSyncDocumentView=function(){return this.inputController.editorWillSyncDocumentView(),this.selectionManager.lock(),this.selectionManager.clearSelection()},u.prototype.compositionControllerDidSyncDocumentView=function(){return this.inputController.editorDidSyncDocumentView(),this.selectionManager.unlock(),this.updateCurrentActions(),this.notifyEditorElement("sync")},u.prototype.compositionControllerDidRender=function(){return null!=this.requestedLocationRange&&(this.compositionRevisionWhenLocationRangeRequested===this.composition.revision&&this.selectionManager.setLocationRange(this.requestedLocationRange),this.requestedLocationRange=null,this.compositionRevisionWhenLocationRangeRequested=null),this.renderedCompositionRevision!==this.composition.revision&&(this.runEditorFilters(),this.composition.updateCurrentAttributes(),this.notifyEditorElement("render")),this.renderedCompositionRevision=this.composition.revision},u.prototype.compositionControllerDidFocus=function(){return this.toolbarController.hideDialog(),this.notifyEditorElement("focus")},u.prototype.compositionControllerDidBlur=function(){return this.notifyEditorElement("blur")},u.prototype.compositionControllerDidSelectAttachment=function(t,e){return this.toolbarController.hideDialog(),this.composition.editAttachment(t,e)},u.prototype.compositionControllerDidRequestDeselectingAttachment=function(t){var e,n;return e=null!=(n=this.attachmentLocationRange)?n:this.composition.document.getLocationRangeOfAttachment(t),this.selectionManager.setLocationRange(e[1])},u.prototype.compositionControllerWillUpdateAttachment=function(t){return this.editor.recordUndoEntry("Edit Attachment",{context:t.id,consolidatable:!0})},u.prototype.compositionControllerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},u.prototype.inputControllerWillHandleInput=function(){return this.handlingInput=!0,this.requestedRender=!1},u.prototype.inputControllerDidRequestRender=function(){return this.requestedRender=!0},u.prototype.inputControllerDidHandleInput=function(){return this.handlingInput=!1,this.requestedRender?(this.requestedRender=!1,this.render()):void 0},u.prototype.inputControllerDidAllowUnhandledInput=function(){return this.notifyEditorElement("change")},u.prototype.inputControllerDidRequestReparse=function(){return this.reparse()},u.prototype.inputControllerWillPerformTyping=function(){return this.recordTypingUndoEntry()},u.prototype.inputControllerWillPerformFormatting=function(t){return this.recordFormattingUndoEntry(t)},u.prototype.inputControllerWillCutText=function(){return this.editor.recordUndoEntry("Cut")},u.prototype.inputControllerWillPaste=function(t){return this.editor.recordUndoEntry("Paste"),this.pasting=!0,this.notifyEditorElement("before-paste",{paste:t})},u.prototype.inputControllerDidPaste=function(t){return t.range=this.pastedRange,this.pastedRange=null,this.pasting=null,this.notifyEditorElement("paste",{paste:t})},u.prototype.inputControllerWillMoveText=function(){return this.editor.recordUndoEntry("Move")},u.prototype.inputControllerWillAttachFiles=function(){return this.editor.recordUndoEntry("Drop Files")},u.prototype.inputControllerWillPerformUndo=function(){return this.editor.undo()},u.prototype.inputControllerWillPerformRedo=function(){return this.editor.redo()},u.prototype.inputControllerDidReceiveKeyboardCommand=function(t){return this.toolbarController.applyKeyboardCommand(t)},u.prototype.inputControllerDidStartDrag=function(){return this.locationRangeBeforeDrag=this.selectionManager.getLocationRange()},u.prototype.inputControllerDidReceiveDragOverPoint=function(t){return this.selectionManager.setLocationRangeFromPointRange(t)},u.prototype.inputControllerDidCancelDrag=function(){return this.selectionManager.setLocationRange(this.locationRangeBeforeDrag),this.locationRangeBeforeDrag=null},u.prototype.locationRangeDidChange=function(t){return this.composition.updateCurrentAttributes(),this.updateCurrentActions(),this.attachmentLocationRange&&!i(this.attachmentLocationRange,t)&&this.composition.stopEditingAttachment(),this.notifyEditorElement("selection-change")},u.prototype.toolbarDidClickButton=function(){return this.getLocationRange()?void 0:this.setLocationRange({index:0,offset:0})},u.prototype.toolbarDidInvokeAction=function(t){return this.invokeAction(t)},u.prototype.toolbarDidToggleAttribute=function(t){return this.recordFormattingUndoEntry(t),this.composition.toggleCurrentAttribute(t),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarDidUpdateAttribute=function(t,e){return this.recordFormattingUndoEntry(t),this.composition.setCurrentAttribute(t,e),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarDidRemoveAttribute=function(t){return this.recordFormattingUndoEntry(t),this.composition.removeCurrentAttribute(t),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarWillShowDialog=function(){return this.composition.expandSelectionForEditing(),this.freezeSelection()},u.prototype.toolbarDidShowDialog=function(t){return this.notifyEditorElement("toolbar-dialog-show",{dialogName:t})},u.prototype.toolbarDidHideDialog=function(t){return this.thawSelection(),this.editorElement.focus(),this.notifyEditorElement("toolbar-dialog-hide",{dialogName:t})},u.prototype.freezeSelection=function(){return this.selectionFrozen?void 0:(this.selectionManager.lock(),this.composition.freezeSelection(),this.selectionFrozen=!0,this.render())},u.prototype.thawSelection=function(){return this.selectionFrozen?(this.composition.thawSelection(),this.selectionManager.unlock(),this.selectionFrozen=!1,this.render()):void 0},u.prototype.actions={undo:{test:function(){return this.editor.canUndo()},perform:function(){return this.editor.undo()}},redo:{test:function(){return this.editor.canRedo()},perform:function(){return this.editor.redo()}},link:{test:function(){return this.editor.canActivateAttribute("href")}},increaseNestingLevel:{test:function(){return this.editor.canIncreaseNestingLevel()},perform:function(){return this.editor.increaseNestingLevel()&&this.render()}},decreaseNestingLevel:{test:function(){return this.editor.canDecreaseNestingLevel()},perform:function(){return this.editor.decreaseNestingLevel()&&this.render()}},attachFiles:{test:function(){return!0},perform:function(){return r.config.input.pickFiles(this.editor.insertFiles)}}},u.prototype.canInvokeAction=function(t){var e,n;return!!this.actionIsExternal(t)||!!(null!=(e=this.actions[t])&&null!=(n=e.test)?n.call(this):void 0)},u.prototype.invokeAction=function(t){var e,n;return this.actionIsExternal(t)?this.notifyEditorElement("action-invoke",{actionName:t}):null!=(e=this.actions[t])&&null!=(n=e.perform)?n.call(this):void 0},u.prototype.actionIsExternal=function(t){return/^x-./.test(t)},u.prototype.getCurrentActions=function(){var t,e;for(t in e={},this.actions)e[t]=this.canInvokeAction(t);return e},u.prototype.updateCurrentActions=function(){var t;return t=this.getCurrentActions(),e(t,this.currentActions)?void 0:(this.currentActions=t,this.toolbarController.updateActions(this.currentActions),this.notifyEditorElement("actions-change",{actions:this.currentActions}))},u.prototype.runEditorFilters=function(){var t,e,n,r,i,o,a,s;for(s=this.composition.getSnapshot(),n=0,r=(i=this.editor.filters).length;r>n;n++)e=i[n],t=s.document,a=s.selectedRange,null==(s=null!=(o=e.call(this.editor,s))?o:{}).document&&(s.document=t),null==s.selectedRange&&(s.selectedRange=a);return c(s,this.composition.getSnapshot())?void 0:this.composition.loadSnapshot(s)},c=function(t,e){return i(t.selectedRange,e.selectedRange)&&t.document.isEqualTo(e.document)},u.prototype.updateInputElement=function(){var t,e;return t=this.compositionController.getSerializableElement(),e=r.serializeToContentType(t,"text/html"),this.editorElement.setInputElementValue(e)},u.prototype.notifyEditorElement=function(t,e){switch(t){case"document-change":this.documentChangedSinceLastRender=!0;break;case"render":this.documentChangedSinceLastRender&&(this.documentChangedSinceLastRender=!1,this.notifyEditorElement("change"));break;case"change":case"attachment-add":case"attachment-edit":case"attachment-remove":this.updateInputElement()}return this.editorElement.notify(t,e)},u.prototype.removeAttachment=function(t){return this.editor.recordUndoEntry("Delete Attachment"),this.composition.removeAttachment(t),this.render()},u.prototype.recordFormattingUndoEntry=function(e){var r,i;return r=t(e),i=this.selectionManager.getLocationRange(),r||!n(i)?this.editor.recordUndoEntry("Formatting",{context:this.getUndoContext(),consolidatable:!0}):void 0},u.prototype.recordTypingUndoEntry=function(){return this.editor.recordUndoEntry("Typing",{context:this.getUndoContext(this.currentAttributes),consolidatable:!0})},u.prototype.getUndoContext=function(){var t;return t=1<=arguments.length?s.call(arguments,0):[],[this.getLocationContext(),this.getTimeContext()].concat(s.call(t))},u.prototype.getLocationContext=function(){var t;return t=this.selectionManager.getLocationRange(),n(t)?t[0].index:t},u.prototype.getTimeContext=function(){return r.config.undoInterval>0?Math.floor((new Date).getTime()/r.config.undoInterval):0},u.prototype.isFocused=function(){var t;return this.editorElement===(null!=(t=this.editorElement.ownerDocument)?t.activeElement:void 0)},u}(r.Controller)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h,p,d,f;e=r.browser,o=r.makeElement,a=r.triggerEvent,n=r.handleEvent,i=r.handleEventOnce,t=r.AttachmentView.attachmentSelector,r.registerElement("trix-editor",(p=0,u=function(t){return!document.querySelector(":focus")&&t.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===t?t.focus():void 0},d=function(t){return t.hasAttribute("contenteditable")?void 0:(t.setAttribute("contenteditable",""),i("focus",{onElement:t,withCallback:function(){return c(t)}}))},s=function(t){return t.hasAttribute("role")?void 0:t.setAttribute("role","textbox")},c=function(t){return h(t),f(t)},h=function(t){return("function"==typeof document.queryCommandSupported?document.queryCommandSupported("enableObjectResizing"):void 0)?(document.execCommand("enableObjectResizing",!1,!1),n("mscontrolselect",{onElement:t,preventDefault:!0})):void 0},f=function(){var t;return!("function"==typeof document.queryCommandSupported?document.queryCommandSupported("DefaultParagraphSeparator"):void 0)||"div"!==(t=r.config.blockAttributes.default.tagName)&&"p"!==t?void 0:document.execCommand("DefaultParagraphSeparator",!1,t)},l=e.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"},{defaultCSS:"%t {\n display: block;\n}\n\n%t:empty:not(:focus)::before {\n content: attr(placeholder);\n color: graytext;\n cursor: text;\n}\n\n%t a[contenteditable=false] {\n cursor: text;\n}\n\n%t img {\n max-width: 100%;\n height: auto;\n}\n\n%t "+t+" figcaption textarea {\n resize: none;\n}\n\n%t "+t+" figcaption textarea.trix-autoresize-clone {\n position: absolute;\n left: -9999px;\n max-height: 0px;\n}\n\n%t "+t+" figcaption[data-trix-placeholder]:empty::before {\n content: attr(data-trix-placeholder);\n color: graytext;\n}\n\n%t [data-trix-cursor-target] {\n display: "+l.display+" !important;\n width: "+l.width+" !important;\n padding: 0 !important;\n margin: 0 !important;\n border: none !important;\n}\n\n%t [data-trix-cursor-target=left] {\n vertical-align: top !important;\n margin-left: -1px !important;\n}\n\n%t [data-trix-cursor-target=right] {\n vertical-align: bottom !important;\n margin-right: -1px !important;\n}",trixId:{get:function(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++p),this.trixId)}},toolbarElement:{get:function(){var t,e,n;return this.hasAttribute("toolbar")?null!=(e=this.ownerDocument)?e.getElementById(this.getAttribute("toolbar")):void 0:this.parentNode?(n="trix-toolbar-"+this.trixId,this.setAttribute("toolbar",n),t=o("trix-toolbar",{id:n}),this.parentNode.insertBefore(t,this),t):void 0}},inputElement:{get:function(){var t,e,n;return this.hasAttribute("input")?null!=(n=this.ownerDocument)?n.getElementById(this.getAttribute("input")):void 0:this.parentNode?(e="trix-input-"+this.trixId,this.setAttribute("input",e),t=o("input",{type:"hidden",id:e}),this.parentNode.insertBefore(t,this.nextElementSibling),t):void 0}},editor:{get:function(){var t;return null!=(t=this.editorController)?t.editor:void 0}},name:{get:function(){var t;return null!=(t=this.inputElement)?t.name:void 0}},value:{get:function(){var t;return null!=(t=this.inputElement)?t.value:void 0},set:function(t){var e;return this.defaultValue=t,null!=(e=this.editor)?e.loadHTML(this.defaultValue):void 0}},notify:function(t,e){return this.editorController?a("trix-"+t,{onElement:this,attributes:e}):void 0},setInputElementValue:function(t){var e;return null!=(e=this.inputElement)?e.value=t:void 0},initialize:function(){return d(this),s(this)},connect:function(){return this.hasAttribute("data-trix-internal")?void 0:(this.editorController||(a("trix-before-initialize",{onElement:this}),this.editorController=new r.EditorController({editorElement:this,html:this.defaultValue=this.value}),requestAnimationFrame(function(t){return function(){return a("trix-initialize",{onElement:t})}}(this))),this.editorController.registerSelectionManager(),this.registerResetListener(),u(this))},disconnect:function(){var t;return null!=(t=this.editorController)&&t.unregisterSelectionManager(),this.unregisterResetListener()},registerResetListener:function(){return this.resetListener=this.resetBubbled.bind(this),window.addEventListener("reset",this.resetListener,!1)},unregisterResetListener:function(){return window.removeEventListener("reset",this.resetListener,!1)},resetBubbled:function(t){var e;return t.target!==(null!=(e=this.inputElement)?e.form:void 0)||t.defaultPrevented?void 0:this.reset()},reset:function(){return this.value=this.defaultValue}}))}.call(this),function(){}.call(this)}).call(this),t.exports?t.exports=r:void 0===(o="function"==typeof(i=r)?i.call(e,n,e,t):i)||(t.exports=o)}.call(this)}).call(this,n(5).setImmediate)},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(6),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(2))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,a,s,u=1,c={},l=!1,h=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){f(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},r=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(t){var e=h.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(f,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&f(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),r=function(e){t.postMessage(a+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n=0&&h.splice(e,1)}function v(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var r=function(){0;return n.nc}();r&&(t.attrs.nonce=r)}return y(e,t.attrs),g(t,e),e}function y(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function b(t,e){var n,r,i,o;if(e.transform&&t.css){if(!(o="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=o}if(e.singleton){var a=l++;n=c||(c=v(e)),r=w.bind(null,n,a,!1),i=w.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",y(e,t.attrs),g(t,e),e}(e),r=E.bind(null,n,e),i=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),r=C.bind(null,n),i=function(){m(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return d(n,e),function(t){for(var r=[],i=0;it.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0&&"[object Array]"===Object.prototype.toString.call(t)};function b(t){return"[object String]"===Object.prototype.toString.call(t)}var x=d((function(t){return null!=t&&"function"==typeof t["fantasy-land/empty"]?t["fantasy-land/empty"]():null!=t&&null!=t.constructor&&"function"==typeof t.constructor["fantasy-land/empty"]?t.constructor["fantasy-land/empty"]():null!=t&&"function"==typeof t.empty?t.empty():null!=t&&null!=t.constructor&&"function"==typeof t.constructor.empty?t.constructor.empty():y(t)?[]:b(t)?"":function(t){return"[object Object]"===Object.prototype.toString.call(t)}(t)?{}:v(t)?function(){return arguments}():void 0}));function A(t){return function e(n,r){switch(arguments.length){case 0:return e;case 1:return p(n)?e:d((function(e){return t(n,e)}));default:return p(n)&&p(r)?e:p(n)?d((function(e){return t(e,r)})):p(r)?d((function(e){return t(n,e)})):t(n,r)}}}function w(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}function C(t,e,n){for(var r=0,i=n.length;r=0;)g(e=S[n],t)&&!R(r,e)&&(r[r.length]=e),n-=1;return r})):d((function(t){return Object(t)!==t?[]:Object.keys(t)})),T=d((function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}));function O(t,e,n,r){var i=w(t);function o(t,e){return _(t,e,n.slice(),r.slice())}return!C((function(t,e){return!C(o,e,t)}),w(e),i)}function _(t,e,n,r){if(E(t,e))return!0;var i,o,a=T(t);if(a!==T(e))return!1;if(null==t||null==e)return!1;if("function"==typeof t["fantasy-land/equals"]||"function"==typeof e["fantasy-land/equals"])return"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e)&&"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t);if("function"==typeof t.equals||"function"==typeof e.equals)return"function"==typeof t.equals&&t.equals(e)&&"function"==typeof e.equals&&e.equals(t);switch(a){case"Arguments":case"Array":case"Object":if("function"==typeof t.constructor&&"Promise"===(i=t.constructor,null==(o=String(i).match(/^function (\w*)/))?"":o[1]))return t===e;break;case"Boolean":case"Number":case"String":if(typeof t!=typeof e||!E(t.valueOf(),e.valueOf()))return!1;break;case"Date":if(!E(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(t.source!==e.source||t.global!==e.global||t.ignoreCase!==e.ignoreCase||t.multiline!==e.multiline||t.sticky!==e.sticky||t.unicode!==e.unicode)return!1}for(var s=n.length-1;s>=0;){if(n[s]===t)return r[s]===e;s-=1}switch(a){case"Map":return t.size===e.size&&O(t.entries(),e.entries(),n.concat([t]),r.concat([e]));case"Set":return t.size===e.size&&O(t.values(),e.values(),n.concat([t]),r.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var u=L(t);if(u.length!==L(e).length)return!1;var c=n.concat([t]),l=r.concat([e]);for(s=u.length-1;s>=0;){var h=u[s];if(!g(h,e)||!_(e[h],t[h],c,l))return!1;s-=1}return!0}var I=A((function(t,e){return _(t,e,[],[])})),N=d((function(t){return null!=t&&I(t,x(t))})),P=A((function(t,e){for(var n={},r=0;r0&&(t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1)))))})),B=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,e){return this.f(t,e)},t}();function M(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(t){return e.apply(this,arguments)};case 2:return function(t,n){return e.apply(this,arguments)};case 3:return function(t,n,r){return e.apply(this,arguments)};case 4:return function(t,n,r,i){return e.apply(this,arguments)};case 5:return function(t,n,r,i,o){return e.apply(this,arguments)};case 6:return function(t,n,r,i,o,a){return e.apply(this,arguments)};case 7:return function(t,n,r,i,o,a,s){return e.apply(this,arguments)};case 8:return function(t,n,r,i,o,a,s,u){return e.apply(this,arguments)};case 9:return function(t,n,r,i,o,a,s,u,c){return e.apply(this,arguments)};case 10:return function(t,n,r,i,o,a,s,u,c,l){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}var j=A((function(t,e){return M(t.length,(function(){return t.apply(e,arguments)}))}));function z(t,e,n){for(var r=n.next();!r.done;){if((e=t["@@transducer/step"](e,r.value))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}r=n.next()}return t["@@transducer/result"](e)}function W(t,e,n,r){return t["@@transducer/result"](n[r](j(t["@@transducer/step"],t),e))}var q="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function U(t,e,n){if("function"==typeof t&&(t=function(t){return new B(t)}(t)),F(n))return function(t,e,n){for(var r=0,i=n.length;r=0}var K=A(H),J={bold:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-bold",languageKey:"bold",tabIndex:"-1",trixButtonGroup:"text-tools",data:{trixAttribute:"bold",trixKey:"b"}},italic:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-italic",languageKey:"italic",tabIndex:"-1",trixButtonGroup:"text-tools",data:{trixAttribute:"italic",trixKey:"i"}},strike:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-strike",languageKey:"strike",tabIndex:"-1",trixButtonGroup:"text-tools",data:{trixAttribute:"strike"}},link:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-link",languageKey:"link",tabIndex:"-1",trixButtonGroup:"text-tools",data:{trixAttribute:"href",trixKey:"k",trixAction:"link"}},heading1:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-heading-1",languageKey:"heading1",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAttribute:"heading1"}},quote:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-quote",languageKey:"quote",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAttribute:"quote"}},code:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-code",languageKey:"code",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAttribute:"code"}},bullet:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-bullet-list",languageKey:"bullets",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAttribute:"bullet"}},number:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-number-list",languageKey:"numbers",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAttribute:"number"}},outdent:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-decrease-nesting-level",languageKey:"outdent",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAction:"decreaseNestingLevel"}},indent:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-increase-nesting-level",languageKey:"indent",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAction:"increaseNestingLevel"}},attachFiles:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-attach",languageKey:"attachFiles",tabIndex:"-1",trixButtonGroup:"file-tools",data:{trixAction:"attachFiles"}},undo:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-undo",languageKey:"undo",tabIndex:"-1",trixButtonGroup:"history-tools",data:{trixAction:"undo",trixKey:"z"}},redo:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-redo",languageKey:"redo",tabIndex:"-1",trixButtonGroup:"history-tools",data:{trixAction:"redo",trixKey:"shift+z"}}},G={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"},$={"text-tools":"trix-button-group trix-button-group--text-tools","block-tools":"trix-button-group trix-button-group--block-tools","file-tools":"trix-button-group trix-button-group--file-tools","history-tools":"trix-button-group trix-button-group--history-tools"};function X(){return(X=Object.assign||function(t){for(var e=1;e=arguments.length)?u=n[s]:(u=arguments[o],o+=1),i[s]=u,p(u)||(a-=1),s+=1}return a<=0?r.apply(this,i):M(a,t(e,i,r))}}(t,[],e))})),rt=d((function(t){return nt(t.length,(function(){var e=0,n=arguments[0],r=arguments[arguments.length-1],i=Array.prototype.slice.call(arguments,0);return i[0]=function(){var t=n.apply(this,et(arguments,[e,r]));return e+=1,t},t.apply(this,i)}))}));function it(t){return null!=t&&"function"==typeof t["@@transducer/step"]}function ot(t,e,n){return function(){if(0===arguments.length)return n();var r=Array.prototype.slice.call(arguments,0),i=r.pop();if(!y(i)){for(var o=0;o>>0)+e+++"__"};n.prototype={set:function(e,n){var r=e[this.name];return r&&r[0]===e?r[1]=n:t(e,this.name,{value:[e,n],writable:!0}),this},get:function(t){var e;return(e=t[this.name])&&e[0]===t?e[1]:void 0},delete:function(t){var e=t[this.name];return!(!e||e[0]!==t)&&(e[0]=e[1]=void 0,!0)},has:function(t){var e=t[this.name];return!!e&&e[0]===t}},window.WeakMap=n}(),function(t){function e(t){v.push(t),m||(m=!0,l(n))}function n(){m=!1;var t=v;v=[],t.sort((function(t,e){return t.uid_-e.uid_}));var e=!1;t.forEach((function(t){var n=t.takeRecords();(function(t){t.nodes_.forEach((function(e){var n=h.get(e);n&&n.forEach((function(e){e.observer===t&&e.removeTransientObservers()}))}))})(t),n.length&&(t.callback_(n,t),e=!0)})),e&&n()}function r(t,e){for(var n=t;n;n=n.parentNode){var r=h.get(n);if(r)for(var i=0;i0){var i=u(n[r-1],t);if(i)return void(n[r-1]=i)}else e(this.observer);n[r]=t},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(t){var e=this.options;e.attributes&&t.addEventListener("DOMAttrModified",this,!0),e.characterData&&t.addEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.addEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(t){var e=this.options;e.attributes&&t.removeEventListener("DOMAttrModified",this,!0),e.characterData&&t.removeEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.removeEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(t){if(t!==this.target){this.addListeners_(t),this.transientObservedNodes.push(t);var e=h.get(t);e||h.set(t,e=[]),e.push(this)}},removeTransientObservers:function(){var t=this.transientObservedNodes;this.transientObservedNodes=[],t.forEach((function(t){this.removeListeners_(t);for(var e=h.get(t),n=0;n=0)){i.push(e);for(var o,a=e.querySelectorAll("link[rel="+r+"]"),s=0,u=a.length;u>s&&(o=a[s]);s++)o.import&&t(o.import,n,i);n(e)}}(t,e,[])},t.forSubtree=e})),window.CustomElements.addModule((function(t){function e(t,e){return n(t,e)||r(t,e)}function n(e,n){return!!t.upgrade(e,n)||void(n&&a(e))}function r(t,e){f(t,(function(t){return!!n(t,e)||void 0}))}function i(t){y.push(t),v||(v=!0,setTimeout(o))}function o(){v=!1;for(var t,e=y,n=0,r=e.length;r>n&&(t=e[n]);n++)t();y=[]}function a(t){m?i((function(){s(t)})):s(t)}function s(t){t.__upgraded__&&!t.__attached&&(t.__attached=!0,t.attachedCallback&&t.attachedCallback())}function u(t){m?i((function(){c(t)})):c(t)}function c(t){t.__upgraded__&&t.__attached&&(t.__attached=!1,t.detachedCallback&&t.detachedCallback())}function l(t,n){if(d.dom){var r=n[0];if(r&&"childList"===r.type&&r.addedNodes&&r.addedNodes){for(var i=r.addedNodes[0];i&&i!==document&&!i.host;)i=i.parentNode;var o=i&&(i.URL||i._URL||i.host&&i.host.localName)||"";o=o.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",n.length,o||"")}var a=function(t){for(var e=t,n=window.wrap(document);e;){if(e==n)return!0;e=e.parentNode||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host}}(t);n.forEach((function(t){"childList"===t.type&&(b(t.addedNodes,(function(t){t.localName&&e(t,a)})),b(t.removedNodes,(function(t){t.localName&&function(t){u(t),f(t,(function(t){u(t)}))}(t)})))})),d.dom&&console.groupEnd()}function h(t){if(!t.__observer){var e=new MutationObserver(l.bind(this,t));e.observe(t,{childList:!0,subtree:!0}),t.__observer=e}}function p(t){t=window.wrap(t),d.dom&&console.group("upgradeDocument: ",t.baseURI.split("/").pop()),e(t,t===window.wrap(document)),h(t),d.dom&&console.groupEnd()}var d=t.flags,f=t.forSubtree,g=t.forDocumentTree,m=window.MutationObserver._isPolyfilled&&d["throttle-attached"];t.hasPolyfillMutations=m,t.hasThrottledAttached=m;var v=!1,y=[],b=Array.prototype.forEach.call.bind(Array.prototype.forEach),x=Element.prototype.createShadowRoot;x&&(Element.prototype.createShadowRoot=function(){var t=x.call(this);return window.CustomElements.watchShadow(this),t}),t.watchShadow=function(t){if(t.shadowRoot&&!t.shadowRoot.__watched){d.dom&&console.log("watching shadow-root for: ",t.localName);for(var e=t.shadowRoot;e;)h(e),e=e.olderShadowRoot}},t.upgradeDocumentTree=function(t){g(t,p)},t.upgradeDocument=p,t.upgradeSubtree=r,t.upgradeAll=e,t.attached=a,t.takeRecords=function(t){for((t=window.wrap(t))||(t=window.wrap(document));t.parentNode;)t=t.parentNode;var e=t.__observer;e&&(l(t,e.takeRecords()),o())}})),window.CustomElements.addModule((function(t){function e(e,i,o){return r.upgrade&&console.group("upgrade:",e.localName),i.is&&e.setAttribute("is",i.is),n(e,i),e.__upgraded__=!0,function(t){t.createdCallback&&t.createdCallback()}(e),o&&t.attached(e),t.upgradeSubtree(e,o),r.upgrade&&console.groupEnd(),e}function n(t,e){Object.__proto__||function(t,e,n){for(var r={},i=e;i!==n&&i!==HTMLElement.prototype;){for(var o,a=Object.getOwnPropertyNames(i),s=0;o=a[s];s++)r[o]||(Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(i,o)),r[o]=1);i=Object.getPrototypeOf(i)}}(t,e.prototype,e.native),t.__proto__=e.prototype}var r=t.flags;t.upgrade=function(n,r){if("template"===n.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(n),!n.__upgraded__&&n.nodeType===Node.ELEMENT_NODE){var i=n.getAttribute("is"),o=t.getRegisteredDefinition(n.localName)||t.getRegisteredDefinition(i);if(o&&(i&&o.tag==n.localName||!i&&!o.extends))return e(n,o,r)}},t.upgradeWithDefinition=e,t.implementPrototype=n})),window.CustomElements.addModule((function(t){function e(t){if(!t.setAttribute._polyfilled){var e=t.setAttribute;t.setAttribute=function(t,r){n.call(this,t,r,e)};var r=t.removeAttribute;t.removeAttribute=function(t){n.call(this,t,null,r)},t.setAttribute._polyfilled=!0}}function n(t,e,n){t=t.toLowerCase();var r=this.getAttribute(t);n.apply(this,arguments);var i=this.getAttribute(t);this.attributeChangedCallback&&i!==r&&this.attributeChangedCallback(t,r,i)}function r(t){return t?f[t.toLowerCase()]:void 0}function i(t){return function(){return function(t){return l(m(t.tag),t)}(t)}}function o(t,e){t&&(t=t.toLowerCase()),e&&(e=e.toLowerCase());var n,i=r(e||t);if(i){if(t==i.tag&&e==i.is)return new i.ctor;if(!e&&!i.is)return new i.ctor}return e?((n=o(t)).setAttribute("is",e),n):(n=m(t),t.indexOf("-")>=0&&h(n,HTMLElement),n)}function a(t,e){var n=t[e];t[e]=function(){var t=n.apply(this,arguments);return c(t),t}}var s,u=(t.isIE,t.upgradeDocumentTree),c=t.upgradeAll,l=t.upgradeWithDefinition,h=t.implementPrototype,p=t.useNative,d=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],f={},g="http://www.w3.org/1999/xhtml",m=document.createElement.bind(document),v=document.createElementNS.bind(document);s=Object.__proto__||p?function(t,e){return t instanceof e}:function(t,e){if(t instanceof e)return!0;for(var n=t;n;){if(n===e.prototype)return!0;n=n.__proto__}return!1},a(Node.prototype,"cloneNode"),a(document,"importNode"),document.registerElement=function(n,o){var a=o||{};if(!n)throw new Error("document.registerElement: first argument `name` must not be empty");if(n.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(n)+"'.");if(function(t){for(var e=0;et;t++)if(!(n[t]in InputEvent.prototype))return!1;return!0}()},config:{}}}).call(this)}).call(this);var r=this.Trix;(function(){(function(){r.BasicObject=function(){function t(){}var e,n,r;return t.proxyMethod=function(t){var r,i,o,a,s;return o=n(t),r=o.name,a=o.toMethod,s=o.toProperty,i=o.optional,this.prototype[r]=function(){var t,n;return t=null!=a?i?"function"==typeof this[a]?this[a]():void 0:this[a]():null!=s?this[s]:void 0,i?null!=(n=null!=t?t[r]:void 0)?e.call(n,t,arguments):void 0:(n=t[r],e.call(n,t,arguments))}},n=function(t){var e,n;if(!(n=t.match(r)))throw new Error("can't parse @proxyMethod expression: "+t);return e={name:n[4]},null!=n[2]?e.toMethod=n[1]:e.toProperty=n[1],null!=n[3]&&(e.optional=!0),e},e=Function.prototype.apply,r=/^(.+?)(\(\))?(\?)?\.(.+?)$/,t}()}).call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.Object=function(e){function n(){this.id=++i}var i;return t(n,e),i=0,n.fromJSONString=function(t){return this.fromJSON(JSON.parse(t))},n.prototype.hasSameConstructorAs=function(t){return this.constructor===(null!=t?t.constructor:void 0)},n.prototype.isEqualTo=function(t){return this===t},n.prototype.inspect=function(){var t,e,n;return t=function(){var t,r,i;for(e in i=[],r=null!=(t=this.contentsForInspection())?t:{})n=r[e],i.push(e+"="+n);return i}.call(this),"#<"+this.constructor.name+":"+this.id+(t.length?" "+t.join(", "):"")+">"},n.prototype.contentsForInspection=function(){},n.prototype.toJSONString=function(){return JSON.stringify(this)},n.prototype.toUTF16String=function(){return r.UTF16String.box(this)},n.prototype.getCacheKey=function(){return this.id.toString()},n}(r.BasicObject)}.call(this),function(){r.extend=function(t){var e,n;for(e in t)n=t[e],this[e]=n;return this}}.call(this),function(){r.extend({defer:function(t){return setTimeout(t,1)}})}.call(this),function(){var t,e;r.extend({normalizeSpaces:function(t){return t.replace(RegExp(""+r.ZERO_WIDTH_SPACE,"g"),"").replace(RegExp(""+r.NON_BREAKING_SPACE,"g")," ")},normalizeNewlines:function(t){return t.replace(/\r\n/g,"\n")},breakableWhitespacePattern:RegExp("[^\\S"+r.NON_BREAKING_SPACE+"]"),squishBreakableWhitespace:function(t){return t.replace(RegExp(""+r.breakableWhitespacePattern.source,"g")," ").replace(/\ {2,}/g," ")},escapeHTML:function(t){var e;return(e=document.createElement("div")).textContent=t,e.innerHTML},summarizeStringChange:function(t,n){var i,o,a,s;return t=r.UTF16String.box(t),(n=r.UTF16String.box(n)).lengthn&&t.charAt(n).isEqualTo(e.charAt(n));)n++;for(;r>n+1&&t.charAt(r-1).isEqualTo(e.charAt(i-1));)r--,i--;return{utf16String:t.slice(n,r),offset:n}}}.call(this),function(){r.extend({copyObject:function(t){var e,n,r;for(e in null==t&&(t={}),n={},t)r=t[e],n[e]=r;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;r.extend({arraysAreEqual:function(t,e){var n,r,i;if(null==t&&(t=[]),null==e&&(e=[]),t.length!==e.length)return!1;for(r=n=0,i=t.length;i>n;r=++n)if(t[r]!==e[r])return!1;return!0},arrayStartsWith:function(t,e){return null==t&&(t=[]),null==e&&(e=[]),r.arraysAreEqual(t.slice(0,e.length),e)},spliceArray:function(){var e,n,r;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],(r=n.slice(0)).splice.apply(r,e),r},summarizeArrayChange:function(t,e){var n,r,i,o,a,s,u,c,l,h,p;for(null==t&&(t=[]),null==e&&(e=[]),n=[],h=[],i=new Set,o=0,u=t.length;u>o;o++)p=t[o],i.add(p);for(r=new Set,a=0,c=e.length;c>a;a++)p=e[a],r.add(p),i.has(p)||n.push(p);for(s=0,l=t.length;l>s;s++)p=t[s],r.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,r.extend({getAllAttributeNames:function(){return null!=t?t:t=r.getTextAttributeNames().concat(r.getBlockAttributeNames())},getBlockConfig:function(t){return r.config.blockAttributes[t]},getBlockAttributeNames:function(){return null!=e?e:e=Object.keys(r.config.blockAttributes)},getTextConfig:function(t){return r.config.textAttributes[t]},getTextAttributeNames:function(){return null!=i?i:i=Object.keys(r.config.textAttributes)},getListAttributeNames:function(){var t,e;return null!=n?n:n=function(){var n,i;for(t in i=[],n=r.config.blockAttributes)null!=(e=n[t].listAttribute)&&i.push(e);return i}()}})}.call(this),function(){var t,e,n,i,o,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=document.documentElement,e=null!=(n=null!=(i=null!=(o=t.matchesSelector)?o:t.webkitMatchesSelector)?i:t.msMatchesSelector)?n:t.mozMatchesSelector,r.extend({handleEvent:function(e,n){var i,o,a,s,u,c,l,h,p,d,f;return u=(l=null!=n?n:{}).onElement,s=l.matchingSelector,f=l.withCallback,a=l.inPhase,c=l.preventDefault,p=l.times,i=null!=u?u:t,h=s,f,d="capturing"===a,(o=function(t){var e;return null!=p&&0==--p&&o.destroy(),null!=(e=r.findClosestElementFromNode(t.target,{matchingSelector:h}))&&(null!=f&&f.call(e,t,e),c)?t.preventDefault():void 0}).destroy=function(){return i.removeEventListener(e,o,d)},i.addEventListener(e,o,d),o},handleEventOnce:function(t,e){return null==e&&(e={}),e.times=1,r.handleEvent(t,e)},triggerEvent:function(e,n){var i,o,a,s,u,c,l;return c=(l=null!=n?n:{}).onElement,o=l.bubbles,a=l.cancelable,i=l.attributes,s=null!=c?c:t,o=!1!==o,a=!1!==a,(u=document.createEvent("Events")).initEvent(e,o,a),null!=i&&r.extend.call(u,i),s.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,o;for(n=(i=null!=e?e:{}).matchingSelector,o=i.untilNode;null!=t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.parentNode;if(null!=t){if(null==n)return t;if(t.closest&&null==o)return t.closest(n);for(;t&&t!==o;){if(r.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&&r.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=r.findNodeFromContainerAndOffset(t,e),r.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,r,i,o,a;return r=(i=null!=e?e:{}).onlyNodesOfType,o=i.usingFilter,n=i.expandEntityReferences,a=function(){switch(r){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,a,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,r,i,o,a,s,u,c,l,h;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(o in s=e.attributes)h=s[o],r.setAttribute(o,h);if(e.style)for(o in u=e.style)h=u[o],r.style[o]=h;if(e.data)for(o in c=e.data)h=c[o],r.dataset[o]=h;if(e.className)for(i=0,a=(l=e.className.split(" ")).length;a>i;i++)n=l[i],r.classList.add(n);return e.textContent&&(r.textContent=e.textContent),r},getBlockTagNames:function(){var t,e;return null!=r.blockTagNames?r.blockTagNames:r.blockTagNames=function(){var n,i;for(t in i=[],n=r.config.blockAttributes)(e=n[t].tagName)&&i.push(e);return i}()},nodeIsBlockContainer:function(t){return r.nodeIsBlockStartComment(null!=t?t.firstChild:void 0)},nodeProbablyIsBlockContainer:function(t){var e,n;return e=r.tagName(t),a.call(r.getBlockTagNames(),e)>=0&&(n=r.tagName(t.firstChild),a.call(r.getBlockTagNames(),n)<0)},nodeIsBlockStart:function(t,e){return(null!=e?e:{strict:!0}).strict?r.nodeIsBlockStartComment(t):r.nodeIsBlockStartComment(t)||!r.nodeIsBlockStartComment(t.firstChild)&&r.nodeProbablyIsBlockContainer(t)},nodeIsBlockStartComment:function(t){return r.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?r.nodeIsTextNode(t)?t.data===r.ZERO_WIDTH_SPACE?!n||t.parentNode.dataset.trixCursorTarget===n:void 0:r.nodeIsCursorTarget(t.firstChild):void 0},nodeIsAttachmentElement:function(t){return r.elementMatchesSelector(t,r.AttachmentView.attachmentSelector)},nodeIsEmptyTextNode:function(t){return r.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,o;t=r.copyObject,i=r.objectsAreEqual,r.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,r,i;if(null!=t)return i=(r=n(t))[0],e=r[1],o(i,e)},rangesAreEqual:function(t,e){var r,i,a,s,u,c;if(null!=t&&null!=e)return i=(a=n(t))[0],r=a[1],c=(s=n(e))[0],u=s[1],o(i,c)&&o(r,u)}}),e=function(e){return"number"==typeof e?e:t(e)},o=function(t,e){return"number"==typeof t?t===e:i(t,e)}}.call(this),function(){var t,e,n,i,o,a,s;r.registerElement=function(t,e){var n,r;return null==e&&(e={}),t=t.toLowerCase(),e=s(e),(n=(r=a(e)).defaultCSS)&&(delete r.defaultCSS,i(n,t)),o(t,r)},i=function(t,e){return n(e).textContent=t.replace(/%t/g,e)},n=function(e){var n,r;return(n=document.createElement("style")).setAttribute("type","text/css"),n.setAttribute("data-tag-name",e.toLowerCase()),(r=t())&&n.setAttribute("nonce",r),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+"]")},a=function(t){var e,n,r;for(e in n={},t)r=t[e],n[e]="function"==typeof r?{value:r}:r;return n},s=function(){var t;return t=function(t){var e,n,r,i,o;for(e={},n=0,i=(o=["initialize","connect","disconnect"]).length;i>n;n++)e[r=o[n]]=t[r],delete t[r];return e},window.customElements?function(e){var n,r,i,o,a;return a=t(e),i=a.initialize,n=a.connect,r=a.disconnect,i&&(o=n,n=function(){return this.initialized||(this.initialized=!0,i.call(this)),null!=o?o.call(this):void 0}),n&&(e.connectedCallback=n),r&&(e.disconnectedCallback=r),e}:function(e){var n,r,i,o;return i=(o=t(e)).initialize,n=o.connect,r=o.disconnect,i&&(e.createdCallback=i),n&&(e.attachedCallback=n),r&&(e.detachedCallback=r),e}}(),o=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,r;return r=Object.create(HTMLElement.prototype,e),n=document.registerElement(t,{prototype:r}),Object.defineProperty(r,"constructor",{value:n}),n}}.call(this),function(){var t,e;r.extend({getDOMSelection:function(){var t;return(t=window.getSelection()).rangeCount>0?t:void 0},getDOMRange:function(){var e,n;return(e=null!=(n=r.getDOMSelection())?n.getRangeAt(0):void 0)&&!t(e)?e:void 0},setDOMRange:function(t){var e;return(e=window.getSelection()).removeAllRanges(),e.addRange(t),r.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"},r.extend({dataTransferIsPlainText:function(t){var e,n,r;return r=t.getData("text/plain"),n=t.getData("text/html"),r&&n?(e=(new DOMParser).parseFromString(n,"text/html").body).textContent===r?!e.querySelector("*"):void 0:null!=r?r.length:void 0},dataTransferIsWritable:function(e){var n,r;if(null!=(null!=e?e.setData:void 0)){for(n in t)if(r=t[n],!function(){try{return e.setData(n,r),e.getData(n)===r}catch(t){}}())return;return!0}},keyEventIsKeyboardCommand:/Mac|^iP/.test(navigator.platform)?function(t){return t.metaKey}:function(t){return t.ctrlKey}})}.call(this),function(){}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=r.arraysAreEqual,r.Hash=function(n){function i(t){null==t&&(t={}),this.values=a(t),i.__super__.constructor.apply(this,arguments)}var o,a,s,u,c;return e(i,n),i.fromCommonAttributesOfObjects=function(t){var e,n,r,i,a,s;if(null==t&&(t=[]),!t.length)return new this;for(r=(e=o(t[0])).getKeys(),n=0,i=(s=t.slice(1)).length;i>n;n++)a=s[n],r=e.getKeysCommonToHash(o(a)),e=e.slice(r);return e},i.box=function(t){return o(t)},i.prototype.add=function(t,e){return this.merge(u(t,e))},i.prototype.remove=function(t){return new r.Hash(a(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 r.Hash(s(this.values,c(t)))},i.prototype.slice=function(t){var e,n,i,o;for(o={},e=0,i=t.length;i>e;e++)n=t[e],this.has(n)&&(o[n]=this.values[n]);return new r.Hash(o)},i.prototype.getKeys=function(){return Object.keys(this.values)},i.prototype.getKeysCommonToHash=function(t){var e,n,r,i,a;for(t=o(t),a=[],e=0,r=(i=this.getKeys()).length;r>e;e++)n=i[e],this.values[n]===t.values[n]&&a.push(n);return a},i.prototype.isEqualTo=function(e){return t(this.toArray(),o(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 r;for(t in e=[],r=this.values)n=r[t],e.push(t,n);return e}.call(this)).slice(0)},i.prototype.toObject=function(){return a(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},s=function(t,e){var n,r,i;for(n in r=a(t),e)i=e[n],r[n]=i;return r},a=function(t,e){var n,r,i,o,a;for(o={},n=0,i=(a=Object.keys(t).sort()).length;i>n;n++)(r=a[n])!==e&&(o[r]=t[r]);return o},o=function(t){return t instanceof r.Hash?t:new r.Hash(t)},c=function(t){return t instanceof r.Hash?t.values:t},i}(r.Object)}.call(this),function(){r.ObjectGroup=function(){function t(t,e){var n,r;this.objects=null!=t?t:[],r=e.depth,(n=e.asTree)&&(this.depth=r,this.objects=this.constructor.groupObjects(this.objects,{asTree:n,depth:this.depth+1}))}return t.groupObjects=function(t,e){var n,r,i,o,a,s,u,c,l;for(null==t&&(t=[]),i=(l=null!=e?e:{}).depth,(n=l.asTree)&&null==i&&(i=0),c=[],a=0,s=t.length;s>a;a++){if(u=t[a],o){if(("function"==typeof u.canBeGrouped?u.canBeGrouped(i):void 0)&&("function"==typeof(r=o[o.length-1]).canBeGroupedWith?r.canBeGroupedWith(u,i):void 0)){o.push(u);continue}c.push(new this(o,{depth:i,asTree:n})),o=null}("function"==typeof u.canBeGrouped?u.canBeGrouped(i):void 0)?o=[u]:c.push(u)}return o&&c.push(new this(o,{depth:i,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,r,i;for(e=["objectGroup"],t=0,n=(i=this.getObjects()).length;n>t;t++)r=i[t],e.push(r.getCacheKey());return e.join("/")},t}()}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.ObjectMap=function(e){function n(t){var e,n,r,i,o;for(null==t&&(t=[]),this.objects={},r=0,i=t.length;i>r;r++)o=t[r],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}(r.BasicObject)}.call(this),function(){r.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,r;return n=e(t),(r=this.elements[n])?(delete this.elements[n],r):void 0},t.prototype.reset=function(t){var e,n,r;for(null==t&&(t=[]),this.elements={},n=0,r=t.length;r>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 r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.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(r,i){return t.succeeded=r,t.performing=!1,t.performed=!0,t.succeeded?e(i):n(i)}))}}(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}(r.BasicObject)}.call(this),function(){var t,e,n,i,o,a={}.hasOwnProperty;r.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 r in e)a.call(e,r)&&(t[r]=e[r]);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(o(t),t)},e.prototype.offsetToUCS2Offset=function(t){return o(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}(r.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,r,i,o;for(i=[],e=0,r=t.length;r>e;)(o=t.charCodeAt(e++))>=55296&&56319>=o&&r>e&&(56320==(64512&(n=t.charCodeAt(e++)))?o=((1023&o)<<10)+(1023&n)+65536:e--),i.push(o);return i},o=n?function(t){return String.fromCodePoint.apply(String,t)}:function(t){var e,n;return function(){var r,i,o;for(o=[],r=0,i=t.length;i>r;r++)n=t[r],e="",n>65535&&(n-=65536,e+=String.fromCharCode(n>>>10&1023|55296),n=56320|1023&n),o.push(e+String.fromCharCode(n));return o}().join("")}}.call(this),function(){}.call(this),function(){}.call(this),function(){r.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(){r.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;r.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 r.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 r.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=r.config.lang,e=[t.bytes,t.KB,t.MB,t.GB,t.TB,t.PB],r.config.fileSize={prefix:"IEC",precision:2,formatter:function(n){var r,i;switch(n){case 0:return"0 "+t.bytes;case 1:return"1 "+t.byte;default:return r=function(){switch(this.prefix){case"SI":return 1e3;case"IEC":return 1024}}.call(this),i=Math.floor(Math.log(n)/Math.log(r)),(n/Math.pow(r,i)).toFixed(this.precision).replace(/0*$/,"").replace(/\.$/,"")+" "+e[i]}}}}.call(this),function(){r.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("+r.AttachmentView.attachmentSelector+")",(e=r.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"),r.extend({serializers:{"application/json":function(t){var e;if(t instanceof r.Document)e=t;else{if(!(t instanceof HTMLElement))throw new Error("unserializable object");e=r.Document.fromHTML(t.innerHTML)}return e.toSerializableDocument().toJSONString()},"text/html":function(i){var o,a,s,u,c,l,h,p,d,f,g,m,v,y,b,x,A;if(i instanceof r.Document)u=r.DocumentView.render(i);else{if(!(i instanceof HTMLElement))throw new Error("unserializable object");u=i.cloneNode(!0)}for(c=0,d=(y=u.querySelectorAll("[data-trix-serialize=false]")).length;d>c;c++)s=y[c],r.removeNode(s);for(l=0,f=n.length;f>l;l++)for(o=n[l],h=0,g=(b=u.querySelectorAll("["+o+"]")).length;g>h;h++)(s=b[h]).removeAttribute(o);for(p=0,m=(x=u.querySelectorAll("[data-trix-serialized-attributes]")).length;m>p;p++){s=x[p];try{for(v in a=JSON.parse(s.getAttribute(e)),s.removeAttribute(e),a)A=a[v],s.setAttribute(v,A)}catch(t){}}return u.innerHTML.replace(t,"")}},deserializers:{"application/json":function(t){return r.Document.fromJSONString(t)},"text/html":function(t){return r.Document.fromHTML(t)}},serializeToContentType:function(t,e){var n;if(n=r.serializers[e])return n(t);throw new Error("unknown content type: "+e)},deserializeFromContentType:function(t,e){var n;if(n=r.deserializers[e])return n(t);throw new Error("unknown content type: "+e)}})}.call(this),function(){var t;t=r.config.lang,r.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
\n \n
'}}}.call(this),function(){r.config.undoInterval=5e3}.call(this),function(){r.config.attachments={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}}}.call(this),function(){r.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(){r.config.input={level2Enabled:!0,getLevel:function(){return this.level2Enabled&&r.browser.supportsInputEvents?2:0},pickFiles:function(t){var e;return(e=r.makeElement("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId})).addEventListener("change",(function(){return t(e.files),r.removeNode(e)})),r.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(){r.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=r.config.toolbar.getDefaultHTML():void 0}})}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,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};r.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,r,i;for(null==this.nodes&&(this.nodes=this.createNodes()),i=[],t=0,e=(r=this.nodes).length;e>t;t++)n=r[t],i.push(n.cloneNode(!0));return i},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 r.ObjectGroup&&(n.viewClass=t,t=r.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,r,i;for(i=[],e=0,n=(r=this.childViews).length;n>e;e++)t=r[e],i.push(t),i=i.concat(t.getAllChildViews());return i},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,r,i;for(e=0,n=(r=this.getAllChildViews()).length;n>e;e++)if((i=r[e]).object===t)return i},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,r,i,o,a;if(t=this.getViewCache()){for(e in a=this.getAllChildViews().concat(this),r=function(){var t,e,n;for(n=[],t=0,e=a.length;e>t;t++)o=a[t],n.push(o.object.getCacheKey());return n}(),i=[],t)n.call(r,e)<0&&i.push(delete t[e]);return i}},i}(r.BasicObject)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.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,r;if(!this.childViews.length)for(t=0,e=(r=this.objectGroup.getObjects()).length;e>t;t++)n=r[t],this.findOrCreateCachedChildView(this.viewClass,n,this.options);return this.childViews},n.prototype.createNodes=function(){var t,e,n,r,i,o,a,s;for(t=this.createContainerElement(),e=0,r=(a=this.getChildViews()).length;r>e;e++)for(n=0,i=(s=a[e].getNodes()).length;i>n;n++)o=s[n],t.appendChild(o);return[t]},n.prototype.createContainerElement=function(t){return null==t&&(t=this.objectGroup.getDepth()),this.getChildViews()[0].createContainerElement(t)},n}(r.ObjectView)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.Controller=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n}(r.BasicObject)}.call(this),function(){var t,e,n,i,o,a,s=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);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=r.findClosestElementFromNode,n=r.nodeIsEmptyTextNode,e=r.nodeIsBlockStartComment,i=r.normalizeSpaces,o=r.summarizeStringChange,a=r.tagName,r.MutationObserver=function(r){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 s(u,r),"["+(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,r,i;for(i=[],e=0,n=t.length;n>e;e++)r=t[e],this.mutationIsSignificant(r)&&i.push(r);return i},u.prototype.mutationIsSignificant=function(t){var e,n,r,i;if(this.nodeIsMutable(t.target))return!1;for(e=0,n=(i=this.nodesModifiedByMutation(t)).length;n>e;e++)if(r=i[e],this.nodeIsSignificant(r))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,r,i,o,a,s,u,l,h;for(n=(s=this.getTextChangesFromCharacterData()).additions,i=s.deletions,o=0,a=(u=(h=this.getTextChangesFromChildList()).additions).length;a>o;o++)e=u[o],c.call(n,e)<0&&n.push(e);return i.push.apply(i,h.deletions),l={},(t=n.join(""))&&(l.textAdded=t),(r=i.join(""))&&(l.textDeleted=r),l},u.prototype.getMutationsByType=function(t){var e,n,r,i,o;for(o=[],e=0,n=(i=this.mutations).length;n>e;e++)(r=i[e]).type===t&&o.push(r);return o},u.prototype.getTextChangesFromChildList=function(){var t,n,r,o,a,s,u,c,h,p;for(t=[],u=[],n=0,o=(s=this.getMutationsByType("childList")).length;o>n;n++)a=s[n],t.push.apply(t,a.addedNodes),u.push.apply(u,a.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,r,a,s,u,c;return(e=this.getMutationsByType("characterData")).length&&(c=e[0],n=e[e.length-1],a=i(c.oldValue),r=i(n.target.data),t=(s=o(a,r)).added,u=s.removed),{additions:t?[t]:[],deletions:u?[u]:[]}},l=function(t){var e,n,r,i;for(null==t&&(t=[]),i=[],e=0,n=t.length;n>e;e++)switch(r=t[e],r.nodeType){case Node.TEXT_NODE:i.push(r.data);break;case Node.ELEMENT_NODE:"br"===a(r)?i.push("\n"):i.push.apply(i,l(r.childNodes))}return i},u}(r.BasicObject)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.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}(r.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=r.handleEvent,e=r.innerElementIsActive,r.InputController=function(i){function o(e){var n;for(n in this.element=e,this.mutationObserver=new r.MutationObserver(this.element),this.mutationObserver.delegate=this,this.events)t(n,{onElement:this.element,withCallback:this.handlerFor(n)})}return n(o,i),o.prototype.events={},o.prototype.elementDidMutate=function(){},o.prototype.editorWillSyncDocumentView=function(){return this.mutationObserver.stop()},o.prototype.editorDidSyncDocumentView=function(){return this.mutationObserver.start()},o.prototype.requestRender=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidRequestRender?t.inputControllerDidRequestRender():void 0},o.prototype.requestReparse=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidRequestReparse&&t.inputControllerDidRequestReparse(),this.requestRender()},o.prototype.attachFiles=function(t){var e,n;return n=function(){var n,i,o;for(o=[],n=0,i=t.length;i>n;n++)e=t[n],o.push(new r.FileVerificationOperation(e));return o}(),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))},o.prototype.handlerFor=function(t){return function(n){return function(r){return r.defaultPrevented?void 0:n.handleInput((function(){return e(this.element)?void 0:(this.eventName=t,this.events[t].call(this,r))}))}}(this)},o.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()}},o}(r.BasicObject)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h,p,d=function(t,e){function n(){this.constructor=t}for(var r in e)f.call(e,r)&&(t[r]=e[r]);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=r.makeElement,l=r.objectsAreEqual,r.tagName,e=r.browser,s=r.keyEventIsKeyboardCommand,i=r.dataTransferIsWritable,n=r.dataTransferIsPlainText,u=r.config.keyNames,r.Level0InputController=function(e){function a(){a.__super__.constructor.apply(this,arguments),this.resetInputSummary()}var f;return d(a,e),f=0,a.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},a.prototype.resetInputSummary=function(){return this.inputSummary={}},a.prototype.reset=function(){return this.resetInputSummary(),r.selectionChangeObserver.reset()},a.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()}))},a.prototype.mutationIsExpected=function(t){var e,n,r,i,o,a,s,u,c;return a=t.textAdded,s=t.textDeleted,!!this.inputSummary.preferDocument||(e=null!=a?a===this.inputSummary.textAdded:!this.inputSummary.textAdded,n=null!=s?this.inputSummary.didDelete:!this.inputSummary.didDelete,c="\n"===s&&!n,!!(((u=("\n"===a||" \n"===a)&&!e)&&!c||c&&!u)&&(i=this.getSelectedRange())&&(r=u?a.replace(/\n$/,"").length||-1:(null!=a?a.length:void 0)||1,null!=(o=this.responder)?o.positionIsBlockBreak(i[1]+r):void 0))||e&&n)},a.prototype.mutationIsSignificant=function(t){var e,n,r;return r=Object.keys(t).length>0,e=""===(null!=(n=this.compositionInput)?n.getEndData():void 0),r||!e},a.prototype.events={keydown:function(t){var e,n,i,o,a,c,l,h,p;if(this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0,o=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[o]:void 0)&&(this.setInputSummary({keyName:o}),r.selectionChangeObserver.reset(),n[o].call(this,t))}return s(t)&&(e=String.fromCharCode(t.keyCode).toLowerCase())&&((a=function(){var e,n,r,i;for(i=[],e=0,n=(r=["alt","shift"]).length;n>e;e++)t[(l=r[e])+"Key"]&&i.push(l);return i}()).push(e),null!=(p=this.delegate)?p.inputControllerDidReceiveKeyboardCommand(a):void 0)?t.preventDefault():void 0},keypress:function(t){var e,n,r;if(null==this.inputSummary.eventName&&!t.metaKey&&(!t.ctrlKey||t.altKey))return(r=p(t))?(null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString(r),this.setInputSummary({textAdded:r,didDelete:this.selectionIsExpanded()})):void 0},textInput:function(t){var e,n,r,i;return e=t.data,(i=this.inputSummary.textAdded)&&i!==e&&i.toUpperCase()===e?(n=this.getSelectedRange(),this.setSelectedRange([n[0],n[1]+i.length]),null!=(r=this.responder)&&r.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,o,a,s,u,c,l;return t.preventDefault(),i=null!=(a=t.dataTransfer)?a.files:void 0,o={x:t.clientX,y:t.clientY},null!=(s=this.responder)&&s.setLocationRangeFromPointRange(o),(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=r.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,a,s,u,c,l,p,d,m,v,y,b,x,A,w,C,E,k,S,D,R;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,r,i;return l.type="text/html",l.html=e,null!=(n=t.delegate)&&n.inputControllerWillPaste(l),null!=(r=t.responder)&&r.insertHTML(l.html),t.requestRender(),null!=(i=t.delegate)?i.inputControllerDidPaste(l):void 0}}(this)):((s=e.getData("URL"))?(l.type="URL",l.href=s,l.string=(c=e.getData("public.url-name"))?r.squishBreakableWhitespace(c).trim():s,null!=(d=this.delegate)&&d.inputControllerWillPaste(l),this.setInputSummary({textAdded:l.string,didDelete:this.selectionIsExpanded()}),null!=(A=this.responder)&&A.insertText(r.Text.textForStringWithAttributes(l.string,{href:l.href})),this.requestRender(),null!=(w=this.delegate)&&w.inputControllerDidPaste(l)):n(e)?(l.type="text/plain",l.string=e.getData("text/plain"),null!=(C=this.delegate)&&C.inputControllerWillPaste(l),this.setInputSummary({textAdded:l.string,didDelete:this.selectionIsExpanded()}),null!=(E=this.responder)&&E.insertString(l.string),this.requestRender(),null!=(k=this.delegate)&&k.inputControllerDidPaste(l)):(u=e.getData("text/html"))?(l.type="text/html",l.html=u,null!=(S=this.delegate)&&S.inputControllerWillPaste(l),null!=(D=this.responder)&&D.insertHTML(l.html),this.requestRender(),null!=(R=this.delegate)&&R.inputControllerDidPaste(l)):g.call(e.types,"Files")>=0&&(a=null!=(m=e.items)&&null!=(v=m[0])&&"function"==typeof v.getAsFile?v.getAsFile():void 0)&&(!a.name&&(i=o(a))&&(a.name="pasted-file-"+ ++f+"."+i),l.type="File",l.file=a,null!=(y=this.delegate)&&y.inputControllerWillAttachFiles(),null!=(b=this.responder)&&b.insertFile(l.file),this.requestRender(),null!=(x=this.delegate)&&x.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()}},a.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}}},a.prototype.getCompositionInput=function(){return this.isComposing()?this.compositionInput:this.compositionInput=new t(this)},a.prototype.isComposing=function(){return null!=this.compositionInput&&!this.compositionInput.isEnded()},a.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},a.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",r.DocumentView.render(e).innerHTML),t.setData("text/plain",e.toString().replace(/\n$/,"")),!0},a.prototype.canAcceptDataTransfer=function(t){var e,n,r,i,o;for(o={},e=0,n=(i=null!=(r=null!=t?t.types:void 0)?r:[]).length;n>e;e++)o[i[e]]=!0;return o.Files||o["application/x-trix-document"]||o["text/html"]||o["text/plain"]},a.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 o;return o=e.innerHTML,r.removeNode(e),i.setSelectedRange(n),t(o)}}(this))},a.proxyMethod("responder?.getSelectedRange"),a.proxyMethod("responder?.setSelectedRange"),a.proxyMethod("responder?.expandSelectionInDirection"),a.proxyMethod("responder?.selectionIsInCursorTarget"),a.proxyMethod("responder?.selectionIsExpanded"),a}(r.InputController),o=function(t){var e,n;return null!=(e=t.type)&&null!=(n=e.match(/\/(\w+)$/))?n[1]:void 0},a=null!=("function"==typeof" ".codePointAt?" ".codePointAt(0):void 0),p=function(t){var e;return t.key&&a&&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]?r.UTF16String.fromCodepoints([e]).toString():void 0)},h=function(t){var e,n,r,i,o,a,s,u,c;if(s=t.clipboardData){if(g.call(s.types,"text/html")>=0){for(r=0,a=(u=s.types).length;a>r;r++)if(c=u[r],e=/^CorePasteboardFlavorType/.test(c),n=/^dyn\./.test(c)&&s.getData(c),e||n)return!0;return!1}return i=g.call(s.types,"com.apple.webarchive")>=0,o=g.call(s.types,"com.apple.flat-rtfd")>=0,i||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,r,i;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!=(r=this.responder)&&r.insertString(this.data.end),null!=(i=this.responder)?i.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}(r.BasicObject)}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},o=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.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};t=r.dataTransferIsPlainText,e=r.keyEventIsKeyboardCommand,n=r.objectsAreEqual,r.Level2InputController=function(a){function u(){return this.render=i(this.render,this),u.__super__.constructor.apply(this,arguments)}var c,l,h,p,d,f;return o(u,a),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,r,i,o;if(e(t)){if(n=l(t),null!=(o=this.delegate)?o.inputControllerDidReceiveKeyboardCommand(n):void 0)return t.preventDefault()}else if(i=t.key,t.altKey&&(i+="+Alt"),t.shiftKey&&(i+="+Shift"),r=this.keys[i])return this.withEvent(t,r)},paste:function(t){var e,n,i,o,a,s,u,c,l;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!=(o=this.responder)&&o.insertString(n.string),this.render(),null!=(a=this.delegate)?a.inputControllerDidPaste(n):void 0):(e=null!=(s=t.clipboardData)?s.getData("URL"):void 0)?(t.preventDefault(),n={type:"URL",href:e,string:e},null!=(u=this.delegate)&&u.inputControllerWillPaste(n),null!=(c=this.responder)&&c.insertText(r.Text.textForStringWithAttributes(n.string,{href:n.href})),this.render(),null!=(l=this.delegate)?l.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 r.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,r;return this.dragging&&(t.preventDefault(),e=d(t),!n(e,this.dragging.point))?(this.dragging.point=e,null!=(r=this.responder)?r.setLocationRangeFromPointRange(e):void 0):void 0},drop:function(t){var e,n,r,i;return this.dragging?(t.preventDefault(),null!=(n=this.delegate)&&n.inputControllerWillMoveText(),null!=(r=this.responder)&&r.moveTextFromRange(this.dragging.range),this.dragging=null,this.scheduleRender()):c(t)?(t.preventDefault(),e=d(t),null!=(i=this.responder)&&i.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,r;for(t in r=[],null!=(e=this.responder)?e.getCurrentAttributes():void 0)r.push(null!=(n=this.responder)?n.removeCurrentAttribute(t):void 0);return r}))},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,o,a,s,u,c,l,h;return e=this.event.dataTransfer,a={dataTransfer:e},(n=e.getData("URL"))?(a.type="URL",a.href=n,a.string=(o=e.getData("public.url-name"))?r.squishBreakableWhitespace(o).trim():n,null!=(s=this.delegate)&&s.inputControllerWillPaste(a),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertText(r.Text.textForStringWithAttributes(a.string,{href:a.href})):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(a):void 0}}(this)):t(e)?(a.type="text/plain",a.string=e.getData("text/plain"),null!=(u=this.delegate)&&u.inputControllerWillPaste(a),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertString(a.string):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(a):void 0}}(this)):(i=e.getData("text/html"))?(a.type="text/html",a.html=i,null!=(c=this.delegate)&&c.inputControllerWillPaste(a),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertHTML(a.html):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(a):void 0}}(this)):(null!=(l=e.files)?l.length:void 0)?(a.type="File",a.file=e.files[0],null!=(h=this.delegate)&&h.inputControllerWillPaste(a),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertFile(a.file):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(a):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 s.call(r.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 s.call(r.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,r,i;return(null!=e?e:{recordUndoEntry:!0}).recordUndoEntry&&null!=(i=this.delegate)&&i.inputControllerWillPerformTyping(),r=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,r):r()},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:(r.selectionChangeObserver.reset(),e.call(this))},u.prototype.getTargetDOMRange=function(t){var e,n,r,i;return r=(null!=t?t:{minLength:0}).minLength,(i="function"==typeof(e=this.event).getTargetRanges?e.getTargetRanges():void 0)&&i.length&&(n=f(i[0]),0===r||n.toString().length>=r)?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 s.call(null!=(e=null!=(n=t.dataTransfer)?n.types:void 0)?e:[],"Files")>=0},h=function(t){var e;return(e=t.clipboardData)?s.call(e.types,"Files")>=0&&1===e.types.length&&e.files.length>=1:void 0},p=function(t){var e;return(e=t.clipboardData)?s.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}(r.InputController)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l=function(t,e){return function(){return t.apply(e,arguments)}},h=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;e=r.defer,n=r.escapeHTML,i=r.handleEvent,s=r.makeElement,c=r.tagName,u=r.config,a=u.lang,t=u.css,o=u.keyNames,r.AttachmentEditorController=function(u){function p(t,e,n,r){this.attachmentPiece=t,this.element=e,this.container=n,this.options=null!=r?r:{},this.didBlurCaption=l(this.didBlurCaption,this),this.didChangeCaption=l(this.didChangeCaption,this),this.didInputCaption=l(this.didInputCaption,this),this.didKeyDownCaption=l(this.didKeyDownCaption,this),this.didClickActionButton=l(this.didClickActionButton,this),this.didClickToolbar=l(this.didClickToolbar,this),this.attachment=this.attachmentPiece.attachment,"a"===c(this.element)&&(this.element=this.element.firstChild),this.install()}var d;return h(p,u),d=function(t){return function(){var e;return(e=t.apply(this,arguments)).do(),null==this.undos&&(this.undos=[]),this.undos.push(e.undo)}},p.prototype.install=function(){return this.makeElementMutable(),this.addToolbar(),this.attachment.isPreviewable()?this.installCaptionEditor():void 0},p.prototype.uninstall=function(){var t,e;for(this.savePendingCaption();e=this.undos.pop();)e();return null!=(t=this.delegate)?t.didUninstallAttachmentEditor(this):void 0},p.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},p.prototype.makeElementMutable=d((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)}})),p.prototype.addToolbar=d((function(){var e,o,u;return(e=s({tagName:"div",className:t.attachmentToolbar,data:{trixMutable:!0}})).innerHTML='
\n \n \n \n
",this.attachment.isPreviewable()&&(o=n(this.attachment.getFilename()),u=n(this.attachment.getFormattedFilesize()),e.innerHTML+='
\n \n '+o+'\n '+u+"\n \n
"),i("click",{onElement:e,withCallback:this.didClickToolbar}),i("click",{onElement:e,matchingSelector:"[data-trix-action]",withCallback:this.didClickActionButton}),{do:function(t){return function(){return t.element.appendChild(e)}}(this),undo:function(){return r.removeNode(e)}}})),p.prototype.installCaptionEditor=d((function(){var n,o,u,c,l;return(c=s({tagName:"textarea",className:t.attachmentCaptionEditor,attributes:{placeholder:a.captionPlaceholder},data:{trixMutable:!0}})).value=this.attachmentPiece.getCaption(),(l=c.cloneNode()).classList.add("trix-autoresize-clone"),l.tabIndex=-1,n=function(){return l.value=c.value,c.style.height=l.scrollHeight+"px"},i("input",{onElement:c,withCallback:n}),i("input",{onElement:c,withCallback:this.didInputCaption}),i("keydown",{onElement:c,withCallback:this.didKeyDownCaption}),i("change",{onElement:c,withCallback:this.didChangeCaption}),i("blur",{onElement:c,withCallback:this.didBlurCaption}),u=this.element.querySelector("figcaption"),o=u.cloneNode(),{do:function(r){return function(){return u.style.display="none",o.appendChild(c),o.appendChild(l),o.classList.add(t.attachmentCaption+"--editing"),u.parentElement.insertBefore(o,u),n(),r.options.editCaption?e((function(){return c.focus()})):void 0}}(this),undo:function(){return r.removeNode(o),u.style.display=null}}})),p.prototype.didClickToolbar=function(t){return t.preventDefault(),t.stopPropagation()},p.prototype.didClickActionButton=function(t){var e;switch(t.target.getAttribute("data-trix-action")){case"remove":return null!=(e=this.delegate)?e.attachmentEditorDidRequestRemovalOfAttachment(this.attachment):void 0}},p.prototype.didKeyDownCaption=function(t){var e;return"return"===o[t.keyCode]?(t.preventDefault(),this.savePendingCaption(),null!=(e=this.delegate)&&"function"==typeof e.attachmentEditorDidRequestDeselectingAttachment?e.attachmentEditorDidRequestDeselectingAttachment(this.attachment):void 0):void 0},p.prototype.didInputCaption=function(t){return this.pendingCaption=t.target.value.replace(/\s/g," ").trim()},p.prototype.didChangeCaption=function(){return this.savePendingCaption()},p.prototype.didBlurCaption=function(){return this.savePendingCaption()},p}(r.BasicObject)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=r.makeElement,t=r.config.css,r.AttachmentView=function(o){function a(){a.__super__.constructor.apply(this,arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}var s;return i(a,o),a.attachmentSelector="[data-trix-attachment]",a.prototype.createContentNodes=function(){return[]},a.prototype.createNodes=function(){var e,r,i,o,a,u,c;if(e=o=n({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),(r=this.getHref())&&(o=n({tagName:"a",editable:!1,attributes:{href:r,tabindex:-1}}),e.appendChild(o)),this.attachment.hasContent())o.innerHTML=this.attachment.getContent();else for(i=0,a=(c=this.createContentNodes()).length;a>i;i++)u=c[i],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)),[s("left"),e,s("right")]},a.prototype.createCaptionElement=function(){var e,r,i,o,a,s,u;return i=n({tagName:"figcaption",className:t.attachmentCaption}),(e=this.attachmentPiece.getCaption())?(i.classList.add(t.attachmentCaption+"--edited"),i.textContent=e):((r=this.getCaptionConfig()).name&&(o=this.attachment.getFilename()),r.size&&(s=this.attachment.getFormattedFilesize()),o&&(a=n({tagName:"span",className:t.attachmentName,textContent:o}),i.appendChild(a)),s&&(o&&i.appendChild(document.createTextNode(" ")),u=n({tagName:"span",className:t.attachmentSize,textContent:s}),i.appendChild(u))),i},a.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(" ")},a.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},a.prototype.getHref=function(){return e(this.attachment.getContent(),"a")?void 0:this.attachment.getHref()},a.prototype.getCaptionConfig=function(){var t,e,n;return n=this.attachment.getType(),t=r.copyObject(null!=(e=r.config.attachments[n])?e.caption:void 0),"file"===n&&(t.name=!0),t},a.prototype.findProgressElement=function(){var t;return null!=(t=this.findElement())?t.querySelector("progress"):void 0},s=function(t){return n({tagName:"span",textContent:r.ZERO_WIDTH_SPACE,data:{trixCursorTarget:t,trixSerialize:!1}})},a.prototype.attachmentDidChangeUploadProgress=function(){var t,e;return e=this.attachment.getUploadProgress(),null!=(t=this.findProgressElement())?t.value=e:void 0},a}(r.ObjectView),e=function(t,e){var r;return(r=n("div")).innerHTML=null!=t?t:"",r.querySelector(e)}}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=r.makeElement,r.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",r.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,r,i,o,a;return o=this.attachment.getURL(),n=this.attachment.getPreviewURL(),t.src=n||o,n===o?t.removeAttribute("data-trix-serialized-attributes"):(r=JSON.stringify({src:o}),t.setAttribute("data-trix-serialized-attributes",r)),a=this.attachment.getWidth(),e=this.attachment.getHeight(),null!=a&&(t.width=a),null!=e&&(t.height=e),i=["imageElement",this.attachment.id,t.src,t.width,t.height].join("/"),t.dataset.trixStoreKey=i},i.prototype.attachmentDidChangeAttributes=function(){return this.refresh(this.image),this.refresh()},i}(r.AttachmentView)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=r.makeElement,t=r.findInnerElement,e=r.getTextConfig,r.PieceView=function(o){function a(){var t;a.__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 s;return i(a,o),a.prototype.createNodes=function(){var e,n,r,i,o,a;if(a=this.attachment?this.createAttachmentNodes():this.createStringNodes(),e=this.createElement()){for(r=t(e),n=0,i=a.length;i>n;n++)o=a[n],r.appendChild(o);a=[e]}return a},a.prototype.createAttachmentNodes=function(){var t;return t=this.attachment.isPreviewable()?r.PreviewableAttachmentView:r.AttachmentView,this.createChildView(t,this.piece.attachment,{piece:this.piece}).getNodes()},a.prototype.createStringNodes=function(){var t,e,r,i,o,a,s,u,c;if(null!=(s=this.textConfig)?s.plaintext:void 0)return[document.createTextNode(this.string)];for(a=[],r=e=0,i=(u=this.string.split("\n")).length;i>e;r=++e)c=u[r],r>0&&(t=n("br"),a.push(t)),c.length&&(o=document.createTextNode(this.preserveSpaces(c)),a.push(o));return a},a.prototype.createElement=function(){var t,r,i,o,a,s,u,c,l;for(o in c={},s=this.attributes)if(l=s[o],(t=e(o))&&(t.tagName&&(a=n(t.tagName),i?(i.appendChild(a),i=a):r=i=a),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==r&&(r=n("span")),c)l=c[o],r.style[o]=l;return r},a.prototype.createContainerElement=function(){var t,r,i,o,a;for(i in o=this.attributes)if(a=o[i],(r=e(i))&&r.groupTagName)return(t={})[i]=a,n(r.groupTagName,t)},s=r.NON_BREAKING_SPACE,a.prototype.preserveSpaces=function(t){return this.context.isLast&&(t=t.replace(/\ $/,s)),t=t.replace(/(\S)\ {3}(\S)/g,"$1 "+s+" $2").replace(/\ {2}/g,s+" ").replace(/\ {2}/g," "+s),(this.context.isFirst||this.context.followsWhitespace)&&(t=t.replace(/^\ /,s)),t},a}(r.ObjectView)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.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,o,a,s,u,c,l,h;for(s=[],o=(c=r.ObjectGroup.groupObjects(this.getPieces())).length-1,n=e=0,a=c.length;a>e;n=++e)u=c[n],t={},0===n&&(t.isFirst=!0),n===o&&(t.isLast=!0),i(l)&&(t.followsWhitespace=!0),h=this.findOrCreateCachedChildView(r.PieceView,u,{textConfig:this.textConfig,context:t}),s.push.apply(s,h.getNodes()),l=u;return s},n.prototype.getPieces=function(){var t,e,n,r,i;for(i=[],t=0,e=(r=this.text.getPieces()).length;e>t;t++)(n=r[t]).hasAttribute("blockBreak")||i.push(n);return i},i=function(t){return/\s$/.test(null!=t?t.toString():void 0)},n}(r.ObjectView)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=r.makeElement,e=r.getBlockConfig,t=r.config.css,r.BlockView=function(o){function a(){a.__super__.constructor.apply(this,arguments),this.block=this.object,this.attributes=this.block.getAttributes()}return i(a,o),a.prototype.createNodes=function(){var t,i,o,a,s,u,c,l;if(s=[document.createComment("block")],this.block.isEmpty()?s.push(n("br")):(c=null!=(u=e(this.block.getLastAttribute()))?u.text:void 0,l=this.findOrCreateCachedChildView(r.TextView,this.block.text,{textConfig:c}),s.push.apply(s,l.getNodes()),this.shouldAddExtraNewlineElement()&&s.push(n("br"))),this.attributes.length)return s;for(t=n(r.config.blockAttributes.default.tagName),i=0,o=s.length;o>i;i++)a=s[i],t.appendChild(a);return[t]},a.prototype.createContainerElement=function(r){var i,o,a;return i=this.attributes[r],o={tagName:e(i).tagName},"attachmentGallery"===i&&(a=this.block.getBlockBreakPosition(),o.className=t.attachmentGallery+" "+t.attachmentGallery+"--"+a),n(o)},a.prototype.shouldAddExtraNewlineElement=function(){return/\n\n$/.test(this.block.toString())},a}(r.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=r.defer,e=r.makeElement,r.DocumentView=function(i){function o(){o.__super__.constructor.apply(this,arguments),this.element=this.options.element,this.elementStore=new r.ElementStore,this.setDocument(this.object)}var a,s,u;return n(o,i),o.render=function(t){var n,r;return(r=new this(t,{element:n=e("div")})).render(),r.sync(),n},o.prototype.setDocument=function(t){return t.isEqualTo(this.document)?void 0:this.document=this.object=t},o.prototype.render=function(){var t,n,i,o,a,s,u;if(this.childViews=[],this.shadowElement=e("div"),!this.document.isEmpty()){for(s=[],t=0,n=(a=r.ObjectGroup.groupObjects(this.document.getBlocks(),{asTree:!0})).length;n>t;t++)o=a[t],u=this.findOrCreateCachedChildView(r.BlockView,o),s.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 s}},o.prototype.isSynced=function(){return a(this.shadowElement,this.element)},o.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()},o.prototype.didSync=function(){return this.elementStore.reset(s(this.element)),t(function(t){return function(){return t.garbageCollectCachedViews()}}(this))},o.prototype.createDocumentFragmentForSync=function(){var t,e,n,r,i,o,a,u,c,l;for(e=document.createDocumentFragment(),n=0,i=(u=this.shadowElement.childNodes).length;i>n;n++)a=u[n],e.appendChild(a.cloneNode(!0));for(r=0,o=(c=s(e)).length;o>r;r++)t=c[r],(l=this.elementStore.remove(t))&&t.parentNode.replaceChild(l,t);return e},s=function(t){return t.querySelectorAll("[data-trix-store-key]")},a=function(t,e){return u(t.innerHTML)===u(e.innerHTML)},u=function(t){return t.replace(/ /g," ")},o}(r.ObjectView)}.call(this),function(){var t,e,n,i,o,a=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;n=r.findClosestElementFromNode,i=r.handleEvent,o=r.innerElementIsActive,e=r.defer,t=r.AttachmentView.attachmentSelector,r.CompositionController=function(u){function c(e,n){this.element=e,this.composition=n,this.didClickAttachment=a(this.didClickAttachment,this),this.didBlur=a(this.didBlur,this),this.didFocus=a(this.didFocus,this),this.documentView=new r.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 s(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 o(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 r,i,o;return r=this.findAttachmentForElement(e),i=null!=n(t.target,{matchingSelector:"figcaption"}),null!=(o=this.delegate)&&"function"==typeof o.compositionControllerDidSelectAttachment?o.compositionControllerDidSelectAttachment(r,{editCaption:i}):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,o;if((null!=(o=this.attachmentEditor)?o.attachment:void 0)!==t&&(i=this.documentView.findElementForObject(t)))return this.uninstallAttachmentEditor(),n=this.composition.document.getAttachmentPieceForAttachment(t),this.attachmentEditor=new r.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}(r.BasicObject)}.call(this),function(){var t,e,n,i=function(t,e){return function(){return t.apply(e,arguments)}},o=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;e=r.handleEvent,n=r.triggerEvent,t=r.findClosestElementFromNode,r.ToolbarController=function(r){function a(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:s,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 s,u,c,l,h,p,d,f,g,m;return o(a,r),m=(u="[data-trix-attribute]")+", "+(s="[data-trix-action]"),(h="[data-trix-dialog]")+"[data-trix-active]",c=h+" [data-trix-method]",l=h+" [data-trix-input]",a.prototype.didClickActionButton=function(t,e){var n,r,i;return null!=(r=this.delegate)&&r.toolbarDidClickButton(),t.preventDefault(),n=p(e),this.getDialog(n)?this.toggleDialog(n):null!=(i=this.delegate)?i.toolbarDidInvokeAction(n):void 0},a.prototype.didClickAttributeButton=function(t,e){var n,r,i;return null!=(r=this.delegate)&&r.toolbarDidClickButton(),t.preventDefault(),n=d(e),this.getDialog(n)?this.toggleDialog(n):null!=(i=this.delegate)&&i.toolbarDidToggleAttribute(n),this.refreshAttributeButtons()},a.prototype.didClickDialogButton=function(e,n){var r;return r=t(n,{matchingSelector:h}),this[n.getAttribute("data-trix-method")].call(this,r)},a.prototype.didKeyDownDialogInput=function(t,e){var n,r;return 13===t.keyCode&&(t.preventDefault(),n=e.getAttribute("name"),r=this.getDialog(n),this.setAttribute(r)),27===t.keyCode?(t.preventDefault(),this.hideDialog()):void 0},a.prototype.updateActions=function(t){return this.actions=t,this.refreshActionButtons()},a.prototype.refreshActionButtons=function(){return this.eachActionButton(function(t){return function(e,n){return e.disabled=!1===t.actions[n]}}(this))},a.prototype.eachActionButton=function(t){var e,n,r,i,o;for(o=[],n=0,r=(i=this.element.querySelectorAll(s)).length;r>n;n++)e=i[n],o.push(t(e,p(e)));return o},a.prototype.updateAttributes=function(t){return this.attributes=t,this.refreshAttributeButtons()},a.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))},a.prototype.eachAttributeButton=function(t){var e,n,r,i,o;for(o=[],n=0,r=(i=this.element.querySelectorAll(u)).length;r>n;n++)e=i[n],o.push(t(e,d(e)));return o},a.prototype.applyKeyboardCommand=function(t){var e,r,i,o,a,s;for(o=JSON.stringify(t.sort()),i=0,a=(s=this.element.querySelectorAll("[data-trix-key]")).length;a>i;i++)if(r=(e=s[i]).getAttribute("data-trix-key").split("+"),JSON.stringify(r.sort())===o)return n("mousedown",{onElement:e}),!0;return!1},a.prototype.dialogIsVisible=function(t){var e;return(e=this.getDialog(t))?e.hasAttribute("data-trix-active"):void 0},a.prototype.toggleDialog=function(t){return this.dialogIsVisible(t)?this.hideDialog():this.showDialog(t)},a.prototype.showDialog=function(t){var e,n,r,i,o,a,s,u,c;for(this.hideDialog(),null!=(a=this.delegate)&&a.toolbarWillShowDialog(),(n=this.getDialog(t)).setAttribute("data-trix-active",""),n.classList.add("trix-active"),r=0,o=(s=n.querySelectorAll("input[disabled]")).length;o>r;r++)s[r].removeAttribute("disabled");return(e=d(n))&&(i=g(n,t))&&(i.value=null!=(u=this.attributes[e])?u:"",i.select()),null!=(c=this.delegate)?c.toolbarDidShowDialog(t):void 0},a.prototype.setAttribute=function(t){var e,n,r;return e=d(t),(n=g(t,e)).willValidate&&!n.checkValidity()?(n.setAttribute("data-trix-validate",""),n.classList.add("trix-validate"),n.focus()):(null!=(r=this.delegate)&&r.toolbarDidUpdateAttribute(e,n.value),this.hideDialog())},a.prototype.removeAttribute=function(t){var e,n;return e=d(t),null!=(n=this.delegate)&&n.toolbarDidRemoveAttribute(e),this.hideDialog()},a.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},a.prototype.resetDialogInputs=function(){var t,e,n,r,i;for(i=[],t=0,n=(r=this.element.querySelectorAll(l)).length;n>t;t++)(e=r[t]).setAttribute("disabled","disabled"),e.removeAttribute("data-trix-validate"),i.push(e.classList.remove("trix-validate"));return i},a.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")},a}(r.BasicObject)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.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}(r.Operation)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;r.Attachment=function(n){function i(e){null==e&&(e={}),this.releaseFile=t(this.releaseFile,this),i.__super__.constructor.apply(this,arguments),this.attributes=r.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 r.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,r;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!=(r=this.delegate)&&"function"==typeof r.attachmentDidChangeAttributes?r.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"))?r.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 r.ImagePreloadOperation(t).then(function(n){return function(r){var i,o;return o=r.width,i=r.height,n.getWidth()&&n.getHeight()||n.setAttributes({width:o,height:i}),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}(r.Object)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.Piece=function(e){function n(t,e){null==e&&(e={}),n.__super__.constructor.apply(this,arguments),this.attributes=r.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}(r.Object)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.Piece.registerType("attachment",r.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(r.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 r.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}(r.Piece))}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=r.normalizeNewlines,r.Piece.registerType("string",r.StringPiece=function(n){function r(e){r.__super__.constructor.apply(this,arguments),this.string=t(e),this.length=this.string.length}return e(r,n),r.fromJSON=function(t){return new this(t.string,t.attributes)},r.prototype.getValue=function(){return this.string},r.prototype.toString=function(){return this.string.toString()},r.prototype.isBlockBreak=function(){return"\n"===this.toString()&&!0===this.getAttribute("blockBreak")},r.prototype.toJSON=function(){var t;return(t=r.__super__.toJSON.apply(this,arguments)).string=this.string,t},r.prototype.canBeConsolidatedWith=function(t){return null!=t&&this.hasSameConstructorAs(t)&&this.hasSameAttributesAsPiece(t)},r.prototype.consolidateWith=function(t){return new this.constructor(this.toString()+t.toString(),this.attributes)},r.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]},r.prototype.toConsole=function(){var t;return(t=this.string).length>15&&(t=t.slice(0,14)+"…"),JSON.stringify(t.toString())},r}(r.Piece))}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty,i=[].slice;t=r.spliceArray,r.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,a,s;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,r,i,o,a;for(a=[],n=e=0,r=(o=this.objects).length;r>e;n=++e)i=o[n],a.push(t(i,n));return a},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,r,i;return r=(i=this.splitObjectAtPosition(e))[0],n=i[1],new this.constructor(r).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,r,i;return n=(r=this.splitObjectsAtRange(t))[0],e=r[1],i=r[2],new this.constructor(n.slice(e,i+1))},r.prototype.selectSplittableList=function(t){var e,n;return n=function(){var n,r,i,o;for(o=[],n=0,r=(i=this.objects).length;r>n;n++)e=i[n],t(e)&&o.push(e);return o}.call(this),new this.constructor(n)},r.prototype.removeObjectsInRange=function(t){var e,n,r,i;return n=(r=this.splitObjectsAtRange(t))[0],e=r[1],i=r[2],new this.constructor(n).splice(e,i-e+1)},r.prototype.transformObjectsInRange=function(t,e){var n,r,i,o,a,s,u;return a=this.splitObjectsAtRange(t),o=a[0],r=a[1],s=a[2],u=function(){var t,a,u;for(u=[],n=t=0,a=o.length;a>t;n=++t)i=o[n],u.push(n>=r&&s>=n?e(i):i);return u}(),new this.constructor(u)},r.prototype.splitObjectsAtRange=function(t){var e,n,r,i,a;return n=(i=this.splitObjectAtPosition(s(t)))[0],e=i[1],r=i[2],[n=(a=new this.constructor(n).splitObjectAtPosition(o(t)+r))[0],e,a[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,r,i,o,a,s,u,c;return e=(o=this.findIndexAndOffsetAtPosition(t)).index,i=o.offset,r=this.objects.slice(0),null!=e?0===i?(u=e,c=0):(n=(a=this.getObjectAtIndex(e).splitAtOffset(i))[0],s=a[1],r.splice(e,1,n,s),u=e+1,c=n.getLength()-i):(u=r.length,c=0),[r,u,c]},r.prototype.consolidate=function(){var t,e,n,r,i,o;for(r=[],i=this.objects[0],t=0,e=(o=this.objects.slice(1)).length;e>t;t++)n=o[t],("function"==typeof i.canBeConsolidatedWith?i.canBeConsolidatedWith(n):void 0)?i=i.consolidateWith(n):(r.push(i),i=n);return null!=i&&r.push(i),new this.constructor(r)},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,r,i,o,a;for(e=0,r=n=0,i=(a=this.objects).length;i>n;r=++n){if(o=e+a[r].getLength(),t>=e&&o>t)return{index:r,offset:t-e};e=o}return{index:null,offset:null}},r.prototype.findPositionAtIndexAndOffset=function(t,e){var n,r,i,o,a,s;for(a=0,n=r=0,i=(s=this.objects).length;i>r;n=++r)if(o=s[n],t>n)a+=o.getLength();else if(n===t){a+=e;break}return a},r.prototype.getEndPosition=function(){var t,e;return null!=this.endPosition?this.endPosition:this.endPosition=function(){var n,r,i;for(e=0,n=0,r=(i=this.objects).length;r>n;n++)t=i[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)||a(this.objects,null!=t?t.objects:void 0)},a=function(t,e){var n,r,i,o,a;if(null==e&&(e=[]),t.length!==e.length)return!1;for(a=!0,r=n=0,i=t.length;i>n;r=++n)o=t[r],a&&!o.isEqualTo(e[r])&&(a=!1);return a},r.prototype.contentsForInspection=function(){var t;return{objects:"["+function(){var e,n,r,i;for(i=[],e=0,n=(r=this.objects).length;n>e;e++)t=r[e],i.push(t.inspect());return i}.call(this).join(", ")+"]"}},s=function(t){return t[0]},o=function(t){return t[1]},r}(r.Object)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.Text=function(e){function n(t){var e;null==t&&(t=[]),n.__super__.constructor.apply(this,arguments),this.pieceList=new r.SplittableList(function(){var n,r,i;for(i=[],n=0,r=t.length;r>n;n++)(e=t[n]).isEmpty()||i.push(e);return i}())}return t(n,e),n.textForAttachmentWithAttributes=function(t,e){return new this([new r.AttachmentPiece(t,e)])},n.textForStringWithAttributes=function(t,e){return new this([new r.StringPiece(t,e)])},n.fromJSON=function(t){var e;return new this(function(){var n,i,o;for(o=[],n=0,i=t.length;i>n;n++)e=t[n],o.push(r.Piece.fromJSON(e));return o}())},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,r,i,o,a;for(a=[],n=0,r=(i=this.getPieces()).length;r>n;n++)e=i[n],a.push(null!=(o=t.find(e))?o:e);return a}.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,r;if(!(t[0]<=e&&e<=t[1]))return n=(r=this.getTextAtRange(t)).getLength(),t[0]t;t++)e=r[t],i.push(e.getAttributes());return i}.call(this),r.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,r,i;for(n=i=e,r=this.getLength();n>0&&this.getCommonAttributesAtRange([n-1,i])[t];)n--;for(;r>i&&this.getCommonAttributesAtRange([e,i+1])[t];)i++;return[n,i]},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,r,i;for(i=[],t=0,e=(r=this.pieceList.toArray()).length;e>t;t++)null!=(n=r[t]).attachment&&i.push(n);return i},n.prototype.getAttachments=function(){var t,e,n,r,i;for(i=[],t=0,e=(r=this.getAttachmentPieces()).length;e>t;t++)n=r[t],i.push(n.attachment);return i},n.prototype.getAttachmentAndPositionById=function(t){var e,n,r,i,o,a;for(i=0,e=0,n=(o=this.pieceList.toArray()).length;n>e;e++){if((null!=(a=(r=o[e]).attachment)?a.id:void 0)===t)return{attachment:r.attachment,position:i};i+=r.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,r,i;for(i=[],e=0,n=(r=this.pieceList.toArray()).length;n>e;e++)t=r[e],i.push(JSON.parse(t.toConsole()));return i}.call(this))},n}(r.Object)}.call(this),function(){var t,e,n,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.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},u=[].slice;t=r.arraysAreEqual,i=r.spliceArray,e=r.getBlockConfig,r.getBlockAttributeNames,n=r.getListAttributeNames,r.Block=function(a){function c(t,e){null==t&&(t=new r.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,v,y;return o(c,a),c.fromJSON=function(t){return new this(r.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,r;return r=e(t).listAttribute,n=g(g(this.attributes,t),r),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 s.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,r,i,o;for(o=[],n=0,r=(i=this.attributes).length;r>n;n++)t=i[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,r,i,o;for(o=[],n=0,r=(i=this.attributes).length;r>n;n++)t=i[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,r;return r=this.toString(),-1!==(n=function(){switch(t){case"forward":return r.indexOf("\n",e);case"backward":return r.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.getLength=function(){return this.text.getLength()},c.prototype.canBeConsolidatedWith=function(t){return!this.hasAttributes()&&!t.hasAttributes()},c.prototype.consolidateWith=function(t){var e,n;return e=r.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,r){var i,o,a,u;return o=(a=t.getAttributes())[r],(i=this.attributes[r])===o&&!(!1===e(i).group&&(u=a[r+1],s.call(n(),u)<0))},h=function(t){return t=y(t),l(t)},y=function(t){var e,n,i,o,a,s;return o=!1,s=t.getPieces(),n=2<=s.length?u.call(s,0,e=s.length-1):(e=0,[]),null==(i=s[e++])?t:(n=function(){var t,e,r;for(r=[],t=0,e=n.length;e>t;t++)(a=n[t]).isBlockBreak()?(o=!0,r.push(v(a))):r.push(a);return r}(),o?new r.Text(u.call(n).concat([i])):t)},p=r.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()},v=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}(r.Object)}.call(this),function(){var t,e,n,i=function(t,e){function n(){this.constructor=t}for(var r in e)o.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.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},s=[].slice;e=r.tagName,n=r.walkTree,t=r.nodeIsAttachmentElement,r.HTMLSanitizer=function(o){function u(t,e){var n;n=null!=e?e:{},this.allowedAttributes=n.allowedAttributes,this.forbiddenProtocols=n.forbiddenProtocols,null==this.allowedAttributes&&(this.allowedAttributes=c),null==this.forbiddenProtocols&&(this.forbiddenProtocols=l),this.body=h(t)}var c,l,h,p;return i(u,o),c="style href src width height class".split(" "),l="javascript:".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,o,a;for(a=n(this.body),o=[];a.nextNode();)switch(i=a.currentNode,i.nodeType){case Node.ELEMENT_NODE:p(i)?o.push(i):this.sanitizeElement(i);break;case Node.COMMENT_NODE:o.push(i)}for(t=0,e=o.length;e>t;t++)i=o[t],r.removeNode(i);return this.body},u.prototype.sanitizeElement=function(t){var e,n,r,i,o;for(t.hasAttribute("href")&&(i=t.protocol,a.call(this.forbiddenProtocols,i)>=0&&t.removeAttribute("href")),e=0,n=(o=s.call(t.attributes)).length;n>e;e++)r=o[e].name,a.call(this.allowedAttributes,r)>=0||0===r.indexOf("data-trix")||t.removeAttribute(r);return t},u.prototype.normalizeListElementNesting=function(){var t,n,r,i,o;for(t=0,n=(o=s.call(this.body.querySelectorAll("ul,ol"))).length;n>t;t++)(i=(r=o[t]).previousElementSibling)&&"li"===e(i)&&i.appendChild(r);return this.body},p=function(n){return(null!=n?n.nodeType:void 0)!==Node.ELEMENT_NODE||t(n)?void 0:"script"===e(n)||"false"===n.getAttribute("data-trix-serialize")},h=function(t){var e,n,r,i,o;for(null==t&&(t=""),t=t.replace(/<\/html[^>]*>[^]*$/i,""),(e=document.implementation.createHTMLDocument("")).documentElement.innerHTML=t,r=0,i=(o=e.head.querySelectorAll("style")).length;i>r;r++)n=o[r],e.body.appendChild(n);return e.body},u}(r.BasicObject)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h,p=function(t,e){function n(){this.constructor=t}for(var r in e)d.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},d={}.hasOwnProperty,f=[].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=r.arraysAreEqual,a=r.makeElement,l=r.tagName,o=r.getBlockTagNames,h=r.walkTree,i=r.findClosestElementFromNode,n=r.elementContainsNode,s=r.nodeIsAttachmentElement,u=r.normalizeSpaces,e=r.breakableWhitespacePattern,c=r.squishBreakableWhitespace,r.HTMLParser=function(d){function g(t,e){this.html=t,this.referenceElement=(null!=e?e:{}).referenceElement,this.blocks=[],this.blockElements=[],this.processedElements=[]}var m,v,y,b,x,A,w,C,E,k,S,D;return p(g,d),g.parse=function(t,e){var n;return(n=new this(t,e)).parse(),n},g.prototype.getDocument=function(){return r.Document.fromJSON(this.blocks)},g.prototype.parse=function(){var t,e;try{for(this.createHiddenContainer(),t=r.HTMLSanitizer.sanitize(this.html).getHTML(),this.containerElement.innerHTML=t,e=h(this.containerElement,{usingFilter:C});e.nextNode();)this.processNode(e.currentNode);return this.translateBlockElementMarginsToNewlines()}finally{this.removeHiddenContainer()}},g.prototype.createHiddenContainer=function(){return this.referenceElement?(this.containerElement=this.referenceElement.cloneNode(!1),this.containerElement.removeAttribute("id"),this.containerElement.setAttribute("data-trix-internal",""),this.containerElement.style.display="none",this.referenceElement.parentNode.insertBefore(this.containerElement,this.referenceElement.nextSibling)):(this.containerElement=a({tagName:"div",style:{display:"none"}}),document.body.appendChild(this.containerElement))},g.prototype.removeHiddenContainer=function(){return r.removeNode(this.containerElement)},C=function(t){return"style"===l(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},g.prototype.processNode=function(t){switch(t.nodeType){case Node.TEXT_NODE:if(!this.isInsignificantTextNode(t))return this.appendBlockForTextNode(t),this.processTextNode(t);break;case Node.ELEMENT_NODE:return this.appendBlockForElement(t),this.processElement(t)}},g.prototype.appendBlockForTextNode=function(e){var n,r,i;return(r=e.parentNode)===this.currentBlockElement||r!==this.containerElement&&!this.isBlockElement(r)?void 0:(n=this.getBlockAttributes(r),t(n,null!=(i=this.currentBlock)?i.attributes:void 0)?void 0:(this.currentBlock=this.appendBlockForAttributesWithElement(n,r),this.currentBlockElement=r))},g.prototype.appendBlockForElement=function(e){var r,i,o,a;if(o=this.isBlockElement(e),i=n(this.currentBlockElement,e),o&&!this.isBlockElement(e.firstChild)){if(!(this.isInsignificantTextNode(e.firstChild)&&this.isBlockElement(e.firstElementChild)||(r=this.getBlockAttributes(e),i&&t(r,this.currentBlock.attributes))))return this.currentBlock=this.appendBlockForAttributesWithElement(r,e),this.currentBlockElement=e}else if(this.currentBlockElement&&!i&&!o)return(a=this.findParentBlockElement(e))?this.appendBlockForElement(a):(this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null)},g.prototype.findParentBlockElement=function(t){var e;for(e=t.parentElement;e&&e!==this.containerElement;){if(this.isBlockElement(e)&&f.call(this.blockElements,e)>=0)return e;e=e.parentElement}return null},g.prototype.processTextNode=function(t){var e,n;return n=t.data,v(t.parentNode)||(n=c(n),S(null!=(e=t.previousSibling)?e.textContent:void 0)&&(n=A(n))),this.appendStringWithAttributes(n,this.getTextAttributes(t.parentNode))},g.prototype.processElement=function(t){var e,n,r,i,o;if(s(t))return e=y(t),Object.keys(e).length&&(i=this.getTextAttributes(t),this.appendAttachmentWithAttributes(e,i),t.innerHTML=""),this.processedElements.push(t);switch(l(t)){case"br":return this.isExtraBR(t)||this.isBlockElement(t.nextSibling)||this.appendStringWithAttributes("\n",this.getTextAttributes(t)),this.processedElements.push(t);case"img":for(n in e={url:t.getAttribute("src"),contentType:"image"},r=x(t))o=r[n],e[n]=o;return this.appendAttachmentWithAttributes(e,this.getTextAttributes(t)),this.processedElements.push(t);case"tr":if(t.parentNode.firstChild!==t)return this.appendStringWithAttributes("\n");break;case"td":if(t.parentNode.firstChild!==t)return this.appendStringWithAttributes(" | ")}},g.prototype.appendBlockForAttributesWithElement=function(t,e){var n;return this.blockElements.push(e),n=m(t),this.blocks.push(n),n},g.prototype.appendEmptyBlock=function(){return this.appendBlockForAttributesWithElement([],null)},g.prototype.appendStringWithAttributes=function(t,e){return this.appendPiece(k(t,e))},g.prototype.appendAttachmentWithAttributes=function(t,e){return this.appendPiece(E(t,e))},g.prototype.appendPiece=function(t){return 0===this.blocks.length&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(t)},g.prototype.appendStringToTextAtIndex=function(t,e){var n,r;return"string"===(null!=(n=(r=this.blocks[e].text)[r.length-1])?n.type:void 0)?n.string+=t:r.push(k(t))},g.prototype.prependStringToTextAtIndex=function(t,e){var n,r;return"string"===(null!=(n=(r=this.blocks[e].text)[0])?n.type:void 0)?n.string=t+n.string:r.unshift(k(t))},k=function(t,e){return null==e&&(e={}),"string",{string:t=u(t),attributes:e,type:"string"}},E=function(t,e){return null==e&&(e={}),"attachment",{attachment:t,attributes:e,type:"attachment"}},m=function(t){return null==t&&(t={}),{text:[],attributes:t}},g.prototype.getTextAttributes=function(t){var e,n,o,a,u,c,l,h,p,d,f,g,m;for(e in o={},d=r.config.textAttributes)if((u=d[e]).tagName&&i(t,{matchingSelector:u.tagName,untilNode:this.containerElement}))o[e]=!0;else if(u.parser){if(m=u.parser(t)){for(n=!1,c=0,p=(f=this.findBlockElementAncestors(t)).length;p>c;c++)if(a=f[c],u.parser(a)===m){n=!0;break}n||(o[e]=m)}}else u.styleProperty&&(m=t.style[u.styleProperty])&&(o[e]=m);if(s(t)&&(l=t.getAttribute("data-trix-attributes")))for(h in g=JSON.parse(l))m=g[h],o[h]=m;return o},g.prototype.getBlockAttributes=function(t){var e,n,i,o;for(n=[];t&&t!==this.containerElement;){for(e in o=r.config.blockAttributes)!1!==(i=o[e]).parse&&l(t)===i.tagName&&(("function"==typeof i.test?i.test(t):void 0)||!i.test)&&(n.push(e),i.listAttribute&&n.push(i.listAttribute));t=t.parentNode}return n.reverse()},g.prototype.findBlockElementAncestors=function(t){var e,n;for(e=[];t&&t!==this.containerElement;)n=l(t),f.call(o(),n)>=0&&e.push(t),t=t.parentNode;return e},y=function(t){return JSON.parse(t.getAttribute("data-trix-attachment"))},x=function(t){var e,n,r;return r=t.getAttribute("width"),n=t.getAttribute("height"),e={},r&&(e.width=parseInt(r,10)),n&&(e.height=parseInt(n,10)),e},g.prototype.isBlockElement=function(t){var e;if((null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE&&!s(t)&&!i(t,{matchingSelector:"td",untilNode:this.containerElement}))return e=l(t),f.call(o(),e)>=0||"block"===window.getComputedStyle(t).display},g.prototype.isInsignificantTextNode=function(t){var e,n,r;if((null!=t?t.nodeType:void 0)===Node.TEXT_NODE&&D(t.data)&&(n=t.parentNode,r=t.previousSibling,e=t.nextSibling,(!w(n.previousSibling)||this.isBlockElement(n.previousSibling))&&!v(n)))return!r||this.isBlockElement(r)||!e||this.isBlockElement(e)},g.prototype.isExtraBR=function(t){return"br"===l(t)&&this.isBlockElement(t.parentNode)&&t.parentNode.lastChild===t},v=function(t){var e;return"pre"===(e=window.getComputedStyle(t).whiteSpace)||"pre-wrap"===e||"pre-line"===e},w=function(t){return t&&!S(t.textContent)},g.prototype.translateBlockElementMarginsToNewlines=function(){var t,e,n,r,i,o,a;for(t=this.getMarginOfDefaultBlockElement(),a=[],n=e=0,r=(o=this.blocks).length;r>e;n=++e)o[n],(i=this.getMarginOfBlockElementAtIndex(n))&&(i.top>2*t.top&&this.prependStringToTextAtIndex("\n",n),a.push(i.bottom>2*t.bottom?this.appendStringToTextAtIndex("\n",n):void 0));return a},g.prototype.getMarginOfBlockElementAtIndex=function(t){var e,n;return!(e=this.blockElements[t])||!e.textContent||(n=l(e),f.call(o(),n)>=0||f.call(this.processedElements,e)>=0)?void 0:b(e)},g.prototype.getMarginOfDefaultBlockElement=function(){var t;return t=a(r.config.blockAttributes.default.tagName),this.containerElement.appendChild(t),b(t)},b=function(t){var e;return"block"===(e=window.getComputedStyle(t)).display?{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}:void 0},A=function(t){return t.replace(RegExp("^"+e.source+"+"),"")},D=function(t){return RegExp("^"+e.source+"*$").test(t)},S=function(t){return/\s$/.test(t)},g}(r.BasicObject)}.call(this),function(){var t,e,n,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty,s=[].slice,u=[].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=r.arraysAreEqual,n=r.normalizeRange,i=r.rangeIsCollapsed,e=r.getBlockConfig,r.Document=function(a){function c(t){null==t&&(t=[]),c.__super__.constructor.apply(this,arguments),0===t.length&&(t=[new r.Block]),this.blockList=r.SplittableList.box(t)}var l;return o(c,a),c.fromJSON=function(t){var e;return new this(function(){var n,i,o;for(o=[],n=0,i=t.length;i>n;n++)e=t[n],o.push(r.Block.fromJSON(e));return o}())},c.fromHTML=function(t,e){return r.HTMLParser.parse(t,e).getDocument()},c.fromString=function(t,e){var n;return n=r.Text.textForStringWithAttributes(t,e),new this([new r.Block(n)])},c.prototype.isEmpty=function(){var t;return 1===this.blockList.length&&((t=this.getBlockAtIndex(0)).isEmpty()&&!t.hasAttributes())},c.prototype.copy=function(t){var e;return null==t&&(t={}),e=t.consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray(),new this.constructor(e)},c.prototype.copyUsingObjectsFromDocument=function(t){var e;return e=new r.ObjectMap(t.getObjects()),this.copyUsingObjectMap(e)},c.prototype.copyUsingObjectMap=function(t){var e,n,r;return n=function(){var n,i,o,a;for(a=[],n=0,i=(o=this.getBlocks()).length;i>n;n++)e=o[n],a.push((r=t.find(e))?r:e.copyUsingObjectMap(t));return a}.call(this),new this.constructor(n)},c.prototype.copyWithBaseBlockAttributes=function(t){var e,n,r;return null==t&&(t=[]),r=function(){var r,i,o,a;for(a=[],r=0,i=(o=this.getBlocks()).length;i>r;r++)n=o[r],e=t.concat(n.getAttributes()),a.push(n.copyWithAttributes(e));return a}.call(this),new this.constructor(r)},c.prototype.replaceBlock=function(t,e){var n;return-1===(n=this.blockList.indexOf(t))?this:new this.constructor(this.blockList.replaceObjectAtIndex(e,n))},c.prototype.insertDocumentAtRange=function(t,e){var r,o,a,s,u,c,l;return o=t.blockList,u=(e=n(e))[0],a=(c=this.locationFromPosition(u)).index,s=c.offset,l=this,r=this.getBlockAtPosition(u),i(e)&&r.isEmpty()&&!r.hasAttributes()?l=new this.constructor(l.blockList.removeObjectAtIndex(a)):r.getBlockBreakPosition()===s&&u++,l=l.removeTextAtRange(e),new this.constructor(l.blockList.insertSplittableListAtPosition(o,u))},c.prototype.mergeDocumentAtRange=function(e,r){var i,o,a,s,u,c,l,h,p,d,f,g;return f=(r=n(r))[0],d=this.locationFromPosition(f),o=this.getBlockAtIndex(d.index).getAttributes(),i=e.getBaseBlockAttributes(),g=o.slice(-i.length),t(i,g)?(l=o.slice(0,-i.length),c=e.copyWithBaseBlockAttributes(l)):c=e.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(o),a=c.getBlockCount(),s=c.getBlockAtIndex(0),t(o,s.getAttributes())?(u=s.getTextWithoutBlockBreak(),p=this.insertTextAtRange(u,r),a>1&&(c=new this.constructor(c.getBlocks().slice(1)),h=f+u.getLength(),p=p.insertDocumentAtRange(c,h))):p=this.insertDocumentAtRange(c,r),p},c.prototype.insertTextAtRange=function(t,e){var r,i,o,a,s;return s=(e=n(e))[0],i=(a=this.locationFromPosition(s)).index,o=a.offset,r=this.removeTextAtRange(e),new this.constructor(r.blockList.editObjectAtIndex(i,(function(e){return e.copyWithText(e.text.insertTextAtPosition(t,o))})))},c.prototype.removeTextAtRange=function(t){var e,r,o,a,s,u,c,l,h,p,d,f,g,m,v,y,b,x;return l=(p=t=n(t))[0],y=p[1],i(t)?this:(u=(d=this.locationRangeFromRange(t))[0],m=d[1],s=u.index,c=u.offset,a=this.getBlockAtIndex(s),g=m.index,v=m.offset,f=this.getBlockAtIndex(g),y-l==1&&a.getBlockBreakPosition()===c&&f.getBlockBreakPosition()!==v&&"\n"===f.text.getStringAtPosition(v)?o=this.blockList.editObjectAtIndex(g,(function(t){return t.copyWithText(t.text.removeTextAtRange([v,v+1]))})):(h=a.text.getTextAtRange([0,c]),b=f.text.getTextAtRange([v,f.getLength()]),x=h.appendText(b),r=s!==g&&0===c&&a.getAttributeLevel()>=f.getAttributeLevel()?f.copyWithText(x):a.copyWithText(x),e=g+1-s,o=this.blockList.splice(s,e,r)),new this.constructor(o))},c.prototype.moveTextFromRangeToPosition=function(t,e){var r,i,o,a,u,c,l,h,p,d;return p=(c=t=n(t))[0],o=c[1],e>=p&&o>=e?this:(i=this.getDocumentAtRange(t),h=this.removeTextAtRange(t),(u=e>p)&&(e-=i.getLength()),a=(l=i.getBlocks())[0],0===(r=2<=l.length?s.call(l,1):[]).length?(d=a.getTextWithoutBlockBreak(),u&&(e+=1)):d=a.text,h=h.insertTextAtRange(d,e),0===r.length?h:(i=new this.constructor(r),e+=d.getLength(),h.insertDocumentAtRange(i,e)))},c.prototype.addAttributeAtRange=function(t,n,r){var i;return i=this.blockList,this.eachBlockAtRange(r,(function(r,o,a){return i=i.editObjectAtIndex(a,(function(){return e(t)?r.addAttribute(t,n):o[0]===o[1]?r:r.copyWithText(r.text.addAttributeAtRange(t,n,o))}))})),new this.constructor(i)},c.prototype.addAttribute=function(t,e){var n;return n=this.blockList,this.eachBlock((function(r,i){return n=n.editObjectAtIndex(i,(function(){return r.addAttribute(t,e)}))})),new this.constructor(n)},c.prototype.removeAttributeAtRange=function(t,n){var r;return r=this.blockList,this.eachBlockAtRange(n,(function(n,i,o){return e(t)?r=r.editObjectAtIndex(o,(function(){return n.removeAttribute(t)})):i[0]!==i[1]?r=r.editObjectAtIndex(o,(function(){return n.copyWithText(n.text.removeAttributeAtRange(t,i))})):void 0})),new this.constructor(r)},c.prototype.updateAttributesForAttachment=function(t,e){var n,r,i;return r=this.getRangeOfAttachment(e)[0],n=this.locationFromPosition(r).index,i=this.getTextAtIndex(n),new this.constructor(this.blockList.editObjectAtIndex(n,(function(n){return n.copyWithText(i.updateAttributesForAttachment(t,e))})))},c.prototype.removeAttributeForAttachment=function(t,e){var n;return n=this.getRangeOfAttachment(e),this.removeAttributeAtRange(t,n)},c.prototype.insertBlockBreakAtRange=function(t){var e,i,o,a;return a=(t=n(t))[0],o=this.locationFromPosition(a).offset,i=this.removeTextAtRange(t),0===o&&(e=[new r.Block]),new this.constructor(i.blockList.insertSplittableListAtPosition(new r.SplittableList(e),a))},c.prototype.applyBlockAttributeAtRange=function(t,n,r){var i,o,a,s;return o=(a=this.expandRangeToLineBreaksAndSplitBlocks(r)).document,r=a.range,(i=e(t)).listAttribute?(s=(o=o.removeLastListAttributeAtRange(r,{exceptAttributeName:t})).convertLineBreaksToBlockBreaksInRange(r),o=s.document,r=s.range):o=i.exclusive?o.removeBlockAttributesAtRange(r):i.terminal?o.removeLastTerminalAttributeAtRange(r):o.consolidateBlocksAtRange(r),o.addAttributeAtRange(t,n,r)},c.prototype.removeLastListAttributeAtRange=function(t,n){var r;return null==n&&(n={}),r=this.blockList,this.eachBlockAtRange(t,(function(t,i,o){var a;if((a=t.getLastAttribute())&&e(a).listAttribute&&a!==n.exceptAttributeName)return r=r.editObjectAtIndex(o,(function(){return t.removeAttribute(a)}))})),new this.constructor(r)},c.prototype.removeLastTerminalAttributeAtRange=function(t){var n;return n=this.blockList,this.eachBlockAtRange(t,(function(t,r,i){var o;if((o=t.getLastAttribute())&&e(o).terminal)return n=n.editObjectAtIndex(i,(function(){return t.removeAttribute(o)}))})),new this.constructor(n)},c.prototype.removeBlockAttributesAtRange=function(t){var e;return e=this.blockList,this.eachBlockAtRange(t,(function(t,n,r){return t.hasAttributes()?e=e.editObjectAtIndex(r,(function(){return t.copyWithoutAttributes()})):void 0})),new this.constructor(e)},c.prototype.expandRangeToLineBreaksAndSplitBlocks=function(t){var e,r,i,o,a,s,u,c,l;return l=(s=t=n(t))[0],o=s[1],c=this.locationFromPosition(l),i=this.locationFromPosition(o),u=(e=this).getBlockAtIndex(c.index),null!=(c.offset=u.findLineBreakInDirectionFromPosition("backward",c.offset))&&(a=e.positionFromLocation(c),e=e.insertBlockBreakAtRange([a,a+1]),i.index+=1,i.offset-=e.getBlockAtIndex(c.index).getLength(),c.index+=1),c.offset=0,0===i.offset&&i.index>c.index?(i.index-=1,i.offset=e.getBlockAtIndex(i.index).getBlockBreakPosition()):("\n"===(r=e.getBlockAtIndex(i.index)).text.getStringAtRange([i.offset-1,i.offset])?i.offset-=1:i.offset=r.findLineBreakInDirectionFromPosition("forward",i.offset),i.offset!==r.getBlockBreakPosition()&&(a=e.positionFromLocation(i),e=e.insertBlockBreakAtRange([a,a+1]))),l=e.positionFromLocation(c),o=e.positionFromLocation(i),{document:e,range:t=n([l,o])}},c.prototype.convertLineBreaksToBlockBreaksInRange=function(t){var e,r,i;return r=(t=n(t))[0],i=this.getStringAtRange(t).slice(0,-1),e=this,i.replace(/.*?\n/g,(function(t){return r+=t.length,e=e.insertBlockBreakAtRange([r-1,r])})),{document:e,range:t}},c.prototype.consolidateBlocksAtRange=function(t){var e,r,i,o,a;return a=(i=t=n(t))[0],r=i[1],o=this.locationFromPosition(a).index,e=this.locationFromPosition(r).index,new this.constructor(this.blockList.consolidateFromIndexToIndex(o,e))},c.prototype.getDocumentAtRange=function(t){var e;return t=n(t),e=this.blockList.getSplittableListInRange(t).toArray(),new this.constructor(e)},c.prototype.getStringAtRange=function(t){var e,r;return(r=t=n(t))[r.length-1]!==this.getLength()&&(e=-1),this.getDocumentAtRange(t).toString().slice(0,e)},c.prototype.getBlockAtIndex=function(t){return this.blockList.getObjectAtIndex(t)},c.prototype.getBlockAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getBlockAtIndex(e)},c.prototype.getTextAtIndex=function(t){var e;return null!=(e=this.getBlockAtIndex(t))?e.text:void 0},c.prototype.getTextAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getTextAtIndex(e)},c.prototype.getPieceAtPosition=function(t){var e,n,r;return e=(r=this.locationFromPosition(t)).index,n=r.offset,this.getTextAtIndex(e).getPieceAtPosition(n)},c.prototype.getCharacterAtPosition=function(t){var e,n,r;return e=(r=this.locationFromPosition(t)).index,n=r.offset,this.getTextAtIndex(e).getStringAtRange([n,n+1])},c.prototype.getLength=function(){return this.blockList.getEndPosition()},c.prototype.getBlocks=function(){return this.blockList.toArray()},c.prototype.getBlockCount=function(){return this.blockList.length},c.prototype.getEditCount=function(){return this.editCount},c.prototype.eachBlock=function(t){return this.blockList.eachObject(t)},c.prototype.eachBlockAtRange=function(t,e){var r,i,o,a,s,u,c,l,h,p,d,f;if(d=(u=t=n(t))[0],o=u[1],p=this.locationFromPosition(d),i=this.locationFromPosition(o),p.index===i.index)return r=this.getBlockAtIndex(p.index),f=[p.offset,i.offset],e(r,f,p.index);for(h=[],s=a=c=p.index,l=i.index;l>=c?l>=a:a>=l;s=l>=c?++a:--a)(r=this.getBlockAtIndex(s))?(f=function(){switch(s){case p.index:return[p.offset,r.text.getLength()];case i.index:return[0,i.offset];default:return[0,r.text.getLength()]}}(),h.push(e(r,f,s))):h.push(void 0);return h},c.prototype.getCommonAttributesAtRange=function(t){var e,o,a;return o=(t=n(t))[0],i(t)?this.getCommonAttributesAtPosition(o):(a=[],e=[],this.eachBlockAtRange(t,(function(t,n){return n[0]!==n[1]?(a.push(t.text.getCommonAttributesAtRange(n)),e.push(l(t))):void 0})),r.Hash.fromCommonAttributesOfObjects(a).merge(r.Hash.fromCommonAttributesOfObjects(e)).toObject())},c.prototype.getCommonAttributesAtPosition=function(t){var e,n,i,o,a,s,c,h,p,d;if(a=(p=this.locationFromPosition(t)).index,h=p.offset,!(i=this.getBlockAtIndex(a)))return{};for(c in o=l(i),e=i.text.getAttributesAtPosition(h),n=i.text.getAttributesAtPosition(h-1),s=function(){var t,e;for(c in e=[],t=r.config.textAttributes)(d=t[c]).inheritable&&e.push(c);return e}(),n)((d=n[c])===e[c]||u.call(s,c)>=0)&&(o[c]=d);return o},c.prototype.getRangeOfCommonAttributeAtPosition=function(t,e){var r,i,o,a,s,u,c,l;return o=(s=this.locationFromPosition(e)).index,a=s.offset,l=(u=this.getTextAtIndex(o).getExpandedRangeForAttributeAtOffset(t,a))[0],i=u[1],c=this.positionFromLocation({index:o,offset:l}),r=this.positionFromLocation({index:o,offset:i}),n([c,r])},c.prototype.getBaseBlockAttributes=function(){var t,e,n,r,i,o,a;for(t=this.getBlockAtIndex(0).getAttributes(),n=r=1,a=this.getBlockCount();a>=1?a>r:r>a;n=a>=1?++r:--r)e=this.getBlockAtIndex(n).getAttributes(),o=Math.min(t.length,e.length),t=function(){var n,r,a;for(a=[],i=n=0,r=o;(r>=0?r>n:n>r)&&e[i]===t[i];i=r>=0?++n:--n)a.push(e[i]);return a}();return t},l=function(t){var e,n;return n={},(e=t.getLastAttribute())&&(n[e]=!0),n},c.prototype.getAttachmentById=function(t){var e,n,r,i;for(n=0,r=(i=this.getAttachments()).length;r>n;n++)if((e=i[n]).id===t)return e},c.prototype.getAttachmentPieces=function(){var t;return t=[],this.blockList.eachObject((function(e){var n;return n=e.text,t=t.concat(n.getAttachmentPieces())})),t},c.prototype.getAttachments=function(){var t,e,n,r,i;for(i=[],t=0,e=(r=this.getAttachmentPieces()).length;e>t;t++)n=r[t],i.push(n.attachment);return i},c.prototype.getRangeOfAttachment=function(t){var e,r,i,o,a,s,u;for(o=0,r=e=0,i=(a=this.blockList.toArray()).length;i>e;r=++e){if(u=(s=a[r].text).getRangeOfAttachment(t))return n([o+u[0],o+u[1]]);o+=s.getLength()}},c.prototype.getLocationRangeOfAttachment=function(t){var e;return e=this.getRangeOfAttachment(t),this.locationRangeFromRange(e)},c.prototype.getAttachmentPieceForAttachment=function(t){var e,n,r,i;for(e=0,n=(i=this.getAttachmentPieces()).length;n>e;e++)if((r=i[e]).attachment===t)return r},c.prototype.findRangesForBlockAttribute=function(t){var e,n,r,i,o,a,s;for(o=0,a=[],n=0,r=(s=this.getBlocks()).length;r>n;n++)i=(e=s[n]).getLength(),e.hasAttribute(t)&&a.push([o,o+i]),o+=i;return a},c.prototype.findRangesForTextAttribute=function(t,e){var n,r,i,o,a,s,u,c,l,h;for(h=(null!=e?e:{}).withValue,s=0,u=[],c=[],o=function(e){return null!=h?e.getAttribute(t)===h:e.hasAttribute(t)},n=0,r=(l=this.getPieces()).length;r>n;n++)i=(a=l[n]).getLength(),o(a)&&(u[1]===s?u[1]=s+i:c.push(u=[s,s+i])),s+=i;return c},c.prototype.locationFromPosition=function(t){var e,n;return null!=(n=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,t))).index?n:{index:(e=this.getBlocks()).length-1,offset:e[e.length-1].getLength()}},c.prototype.positionFromLocation=function(t){return this.blockList.findPositionAtIndexAndOffset(t.index,t.offset)},c.prototype.locationRangeFromPosition=function(t){return n(this.locationFromPosition(t))},c.prototype.locationRangeFromRange=function(t){var e,r,i,o;if(t=n(t))return o=t[0],r=t[1],i=this.locationFromPosition(o),e=this.locationFromPosition(r),n([i,e])},c.prototype.rangeFromLocationRange=function(t){var e,r;return t=n(t),e=this.positionFromLocation(t[0]),i(t)||(r=this.positionFromLocation(t[1])),n([e,r])},c.prototype.isEqualTo=function(t){return this.blockList.isEqualTo(null!=t?t.blockList:void 0)},c.prototype.getTexts=function(){var t,e,n,r,i;for(i=[],e=0,n=(r=this.getBlocks()).length;n>e;e++)t=r[e],i.push(t.text);return i},c.prototype.getPieces=function(){var t,e,n,r,i;for(n=[],t=0,e=(r=this.getTexts()).length;e>t;t++)i=r[t],n.push.apply(n,i.getPieces());return n},c.prototype.getObjects=function(){return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())},c.prototype.toSerializableDocument=function(){var t;return t=[],this.blockList.eachObject((function(e){return t.push(e.copyWithText(e.text.toSerializableText()))})),new this.constructor(t)},c.prototype.toString=function(){return this.blockList.toString()},c.prototype.toJSON=function(){return this.blockList.toJSON()},c.prototype.toConsole=function(){var t;return JSON.stringify(function(){var e,n,r,i;for(i=[],e=0,n=(r=this.blockList.toArray()).length;n>e;e++)t=r[e],i.push(JSON.parse(t.text.toConsole()));return i}.call(this))},c}(r.Object)}.call(this),function(){r.LineBreakInsertion=function(){function t(t){var e;this.composition=t,this.document=this.composition.document,e=this.composition.getSelectedRange(),this.startPosition=e[0],this.endPosition=e[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.endPosition),this.block=this.document.getBlockAtIndex(this.endLocation.index),this.breaksOnReturn=this.block.breaksOnReturn(),this.previousCharacter=this.block.text.getStringAtPosition(this.endLocation.offset-1),this.nextCharacter=this.block.text.getStringAtPosition(this.endLocation.offset)}return t.prototype.shouldInsertBlockBreak=function(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?0!==this.startLocation.offset:this.breaksOnReturn&&"\n"!==this.nextCharacter},t.prototype.shouldBreakFormattedBlock=function(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&"\n"===this.nextCharacter||"\n"===this.previousCharacter)},t.prototype.shouldDecreaseListLevel=function(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()},t.prototype.shouldPrependListItem=function(){return this.block.isListItem()&&0===this.startLocation.offset&&!this.block.isEmpty()},t.prototype.shouldRemoveLastBlockAttribute=function(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()},t}()}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;a=r.normalizeRange,c=r.rangesAreEqual,u=r.rangeIsCollapsed,s=r.objectsAreEqual,t=r.arrayStartsWith,l=r.summarizeArrayChange,n=r.getAllAttributeNames,i=r.getBlockConfig,o=r.getTextConfig,e=r.extend,r.Composition=function(p){function d(){this.document=new r.Document,this.attachments=[],this.currentAttributes={},this.revision=0}return h(d,p),d.prototype.setDocument=function(t){var e;return t.isEqualTo(this.document)?void 0:(this.document=t,this.refreshAttachments(),this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidChangeDocument?e.compositionDidChangeDocument(t):void 0)},d.prototype.getSnapshot=function(){return{document:this.document,selectedRange:this.getSelectedRange()}},d.prototype.loadSnapshot=function(t){var e,n,i,o;return e=t.document,o=t.selectedRange,null!=(n=this.delegate)&&"function"==typeof n.compositionWillLoadSnapshot&&n.compositionWillLoadSnapshot(),this.setDocument(null!=e?e:new r.Document),this.setSelection(null!=o?o:[0,0]),null!=(i=this.delegate)&&"function"==typeof i.compositionDidLoadSnapshot?i.compositionDidLoadSnapshot():void 0},d.prototype.insertText=function(t,e){var n,r,i,o;return o=(null!=e?e:{updatePosition:!0}).updatePosition,r=this.getSelectedRange(),this.setDocument(this.document.insertTextAtRange(t,r)),n=(i=r[0])+t.getLength(),o&&this.setSelection(n),this.notifyDelegateOfInsertionAtRange([i,n])},d.prototype.insertBlock=function(t){var e;return null==t&&(t=new r.Block),e=new r.Document([t]),this.insertDocument(e)},d.prototype.insertDocument=function(t){var e,n,i;return null==t&&(t=new r.Document),n=this.getSelectedRange(),this.setDocument(this.document.insertDocumentAtRange(t,n)),e=(i=n[0])+t.getLength(),this.setSelection(e),this.notifyDelegateOfInsertionAtRange([i,e])},d.prototype.insertString=function(t,e){var n,i;return n=this.getCurrentTextAttributes(),i=r.Text.textForStringWithAttributes(t,n),this.insertText(i,e)},d.prototype.insertBlockBreak=function(){var t,e,n;return e=this.getSelectedRange(),this.setDocument(this.document.insertBlockBreakAtRange(e)),t=(n=e[0])+1,this.setSelection(t),this.notifyDelegateOfInsertionAtRange([n,t])},d.prototype.insertLineBreak=function(){var t,e;return(e=new r.LineBreakInsertion(this)).shouldDecreaseListLevel()?(this.decreaseListLevel(),this.setSelection(e.startPosition)):e.shouldPrependListItem()?(t=new r.Document([e.block.copyWithoutText()]),this.insertDocument(t)):e.shouldInsertBlockBreak()?this.insertBlockBreak():e.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():e.shouldBreakFormattedBlock()?this.breakFormattedBlock(e):this.insertString("\n")},d.prototype.insertHTML=function(t){var e,n,i,o;return e=r.Document.fromHTML(t),i=this.getSelectedRange(),this.setDocument(this.document.mergeDocumentAtRange(e,i)),n=(o=i[0])+e.getLength()-1,this.setSelection(n),this.notifyDelegateOfInsertionAtRange([o,n])},d.prototype.replaceHTML=function(t){var e,n,i;return e=r.Document.fromHTML(t).copyUsingObjectsFromDocument(this.document),n=this.getLocationRange({strict:!1}),i=this.document.rangeFromLocationRange(n),this.setDocument(e),this.setSelection(i)},d.prototype.insertFile=function(t){return this.insertFiles([t])},d.prototype.insertFiles=function(t){var e,n,i,o,a,s;for(n=[],o=0,a=t.length;a>o;o++)i=t[o],(null!=(s=this.delegate)?s.compositionShouldAcceptFile(i):void 0)&&(e=r.Attachment.attachmentForFile(i),n.push(e));return this.insertAttachments(n)},d.prototype.insertAttachment=function(t){return this.insertAttachments([t])},d.prototype.insertAttachments=function(t){var e,n,i,o,a,s,u,c,l;for(c=new r.Text,o=0,a=t.length;a>o;o++)l=(e=t[o]).getType(),s=null!=(u=r.config.attachments[l])?u.presentation:void 0,i=this.getCurrentTextAttributes(),s&&(i.presentation=s),n=r.Text.textForAttachmentWithAttributes(e,i),c=c.appendText(n);return this.insertText(c)},d.prototype.shouldManageDeletingInDirection=function(t){var e;if(e=this.getLocationRange(),u(e)){if("backward"===t&&0===e[0].offset)return!0;if(this.shouldManageMovingCursorInDirection(t))return!0}else if(e[0].index!==e[1].index)return!0;return!1},d.prototype.deleteInDirection=function(t,e){var n,r,i,o,a,s,c,l;return o=(null!=e?e:{}).length,a=this.getLocationRange(),s=this.getSelectedRange(),(c=u(s))?i="backward"===t&&0===a[0].offset:l=a[0].index!==a[1].index,!(i&&this.canDecreaseBlockAttributeLevel()&&(r=this.getBlock(),r.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(s[0]),r.isEmpty()))&&(c&&(s=this.getExpandedRangeInDirection(t,{length:o}),"backward"===t&&(n=this.getAttachmentAtRange(s))),n?(this.editAttachment(n),!1):(this.setDocument(this.document.removeTextAtRange(s)),this.setSelection(s[0]),!i&&!l&&void 0))},d.prototype.moveTextFromRange=function(t){var e;return e=this.getSelectedRange()[0],this.setDocument(this.document.moveTextFromRangeToPosition(t,e)),this.setSelection(e)},d.prototype.removeAttachment=function(t){var e;return(e=this.document.getRangeOfAttachment(t))?(this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(e)),this.setSelection(e[0])):void 0},d.prototype.removeLastBlockAttribute=function(){var t,e,n,r;return r=(n=this.getSelectedRange())[0],e=n[1],t=this.document.getBlockAtPosition(e),this.removeCurrentAttribute(t.getLastAttribute()),this.setSelection(r)}," ",d.prototype.insertPlaceholder=function(){return this.placeholderPosition=this.getPosition(),this.insertString(" ")},d.prototype.selectPlaceholder=function(){return null!=this.placeholderPosition?(this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+" ".length]),this.getSelectedRange()):void 0},d.prototype.forgetPlaceholder=function(){return this.placeholderPosition=null},d.prototype.hasCurrentAttribute=function(t){var e;return null!=(e=this.currentAttributes[t])&&!1!==e},d.prototype.toggleCurrentAttribute=function(t){var e;return(e=!this.currentAttributes[t])?this.setCurrentAttribute(t,e):this.removeCurrentAttribute(t)},d.prototype.canSetCurrentAttribute=function(t){return i(t)?this.canSetCurrentBlockAttribute(t):this.canSetCurrentTextAttribute(t)},d.prototype.canSetCurrentTextAttribute=function(){var t,e,n,r;if(t=this.getSelectedDocument()){for(e=0,n=(r=t.getAttachments()).length;n>e;e++)if(!r[e].hasContent())return!1;return!0}},d.prototype.canSetCurrentBlockAttribute=function(){var t;if(t=this.getBlock())return!t.isTerminalBlock()},d.prototype.setCurrentAttribute=function(t,e){return i(t)?this.setBlockAttribute(t,e):(this.setTextAttribute(t,e),this.currentAttributes[t]=e,this.notifyDelegateOfCurrentAttributesChange())},d.prototype.setTextAttribute=function(t,e){var n,i;if(n=this.getSelectedRange())return n[0]!==n[1]?this.setDocument(this.document.addAttributeAtRange(t,e,n)):"href"===t?(i=r.Text.textForStringWithAttributes(e,{href:e}),this.insertText(i)):void 0},d.prototype.setBlockAttribute=function(t,e){var n;if(n=this.getSelectedRange())return this.canSetCurrentAttribute(t)?(this.getBlock(),this.setDocument(this.document.applyBlockAttributeAtRange(t,e,n)),this.setSelection(n)):void 0},d.prototype.removeCurrentAttribute=function(t){return i(t)?(this.removeBlockAttribute(t),this.updateCurrentAttributes()):(this.removeTextAttribute(t),delete this.currentAttributes[t],this.notifyDelegateOfCurrentAttributesChange())},d.prototype.removeTextAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},d.prototype.removeBlockAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},d.prototype.canDecreaseNestingLevel=function(){var t;return(null!=(t=this.getBlock())?t.getNestingLevel():void 0)>0},d.prototype.canIncreaseNestingLevel=function(){var e,n,r;if(e=this.getBlock())return null!=(r=i(e.getLastNestableAttribute()))&&r.listAttribute?(n=this.getPreviousBlock())?t(n.getListItemAttributes(),e.getListItemAttributes()):void 0:e.getNestingLevel()>0},d.prototype.decreaseNestingLevel=function(){var t;if(t=this.getBlock())return this.setDocument(this.document.replaceBlock(t,t.decreaseNestingLevel()))},d.prototype.increaseNestingLevel=function(){var t;if(t=this.getBlock())return this.setDocument(this.document.replaceBlock(t,t.increaseNestingLevel()))},d.prototype.canDecreaseBlockAttributeLevel=function(){var t;return(null!=(t=this.getBlock())?t.getAttributeLevel():void 0)>0},d.prototype.decreaseBlockAttributeLevel=function(){var t,e;return(t=null!=(e=this.getBlock())?e.getLastAttribute():void 0)?this.removeCurrentAttribute(t):void 0},d.prototype.decreaseListLevel=function(){var t,e,n,r,i,o;for(o=this.getSelectedRange()[0],n=i=this.document.locationFromPosition(o).index,t=this.getBlock().getAttributeLevel();(e=this.document.getBlockAtIndex(n+1))&&e.isListItem()&&e.getAttributeLevel()>t;)n++;return o=this.document.positionFromLocation({index:i,offset:0}),r=this.document.positionFromLocation({index:n,offset:0}),this.setDocument(this.document.removeLastListAttributeAtRange([o,r]))},d.prototype.updateCurrentAttributes=function(){var t,e,r,i,o,a;if(a=this.getSelectedRange({ignoreLock:!0})){for(e=this.document.getCommonAttributesAtRange(a),r=0,i=(o=n()).length;i>r;r++)e[t=o[r]]||this.canSetCurrentAttribute(t)||(e[t]=!1);if(!s(e,this.currentAttributes))return this.currentAttributes=e,this.notifyDelegateOfCurrentAttributesChange()}},d.prototype.getCurrentAttributes=function(){return e.call({},this.currentAttributes)},d.prototype.getCurrentTextAttributes=function(){var t,e,n,r;for(e in t={},n=this.currentAttributes)!1!==(r=n[e])&&o(e)&&(t[e]=r);return t},d.prototype.freezeSelection=function(){return this.setCurrentAttribute("frozen",!0)},d.prototype.thawSelection=function(){return this.removeCurrentAttribute("frozen")},d.prototype.hasFrozenSelection=function(){return this.hasCurrentAttribute("frozen")},d.proxyMethod("getSelectionManager().getPointRange"),d.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),d.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),d.proxyMethod("getSelectionManager().locationIsCursorTarget"),d.proxyMethod("getSelectionManager().selectionIsExpanded"),d.proxyMethod("delegate?.getSelectionManager"),d.prototype.setSelection=function(t){var e,n;return e=this.document.locationRangeFromRange(t),null!=(n=this.delegate)?n.compositionDidRequestChangingSelectionToLocationRange(e):void 0},d.prototype.getSelectedRange=function(){var t;return(t=this.getLocationRange())?this.document.rangeFromLocationRange(t):void 0},d.prototype.setSelectedRange=function(t){var e;return e=this.document.locationRangeFromRange(t),this.getSelectionManager().setLocationRange(e)},d.prototype.getPosition=function(){var t;return(t=this.getLocationRange())?this.document.positionFromLocation(t[0]):void 0},d.prototype.getLocationRange=function(t){var e,n;return null!=(e=null!=(n=this.targetLocationRange)?n:this.getSelectionManager().getLocationRange(t))?e:a({index:0,offset:0})},d.prototype.withTargetLocationRange=function(t,e){var n;this.targetLocationRange=t;try{n=e()}finally{this.targetLocationRange=null}return n},d.prototype.withTargetRange=function(t,e){var n;return n=this.document.locationRangeFromRange(t),this.withTargetLocationRange(n,e)},d.prototype.withTargetDOMRange=function(t,e){var n;return n=this.createLocationRangeFromDOMRange(t,{strict:!1}),this.withTargetLocationRange(n,e)},d.prototype.getExpandedRangeInDirection=function(t,e){var n,r,i,o;return r=(null!=e?e:{}).length,o=(i=this.getSelectedRange())[0],n=i[1],"backward"===t?r?o-=r:o=this.translateUTF16PositionFromOffset(o,-1):r?n+=r:n=this.translateUTF16PositionFromOffset(n,1),a([o,n])},d.prototype.shouldManageMovingCursorInDirection=function(t){var e;return!!this.editingAttachment||(e=this.getExpandedRangeInDirection(t),null!=this.getAttachmentAtRange(e))},d.prototype.moveCursorInDirection=function(t){var e,n,r,i;return this.editingAttachment?r=this.document.getRangeOfAttachment(this.editingAttachment):(i=this.getSelectedRange(),r=this.getExpandedRangeInDirection(t),n=!c(i,r)),this.setSelectedRange("backward"===t?r[0]:r[1]),n&&(e=this.getAttachmentAtRange(r))?this.editAttachment(e):void 0},d.prototype.expandSelectionInDirection=function(t,e){var n,r;return n=(null!=e?e:{}).length,r=this.getExpandedRangeInDirection(t,{length:n}),this.setSelectedRange(r)},d.prototype.expandSelectionForEditing=function(){return this.hasCurrentAttribute("href")?this.expandSelectionAroundCommonAttribute("href"):void 0},d.prototype.expandSelectionAroundCommonAttribute=function(t){var e,n;return e=this.getPosition(),n=this.document.getRangeOfCommonAttributeAtPosition(t,e),this.setSelectedRange(n)},d.prototype.selectionContainsAttachments=function(){var t;return(null!=(t=this.getSelectedAttachments())?t.length:void 0)>0},d.prototype.selectionIsInCursorTarget=function(){return this.editingAttachment||this.positionIsCursorTarget(this.getPosition())},d.prototype.positionIsCursorTarget=function(t){var e;return(e=this.document.locationFromPosition(t))?this.locationIsCursorTarget(e):void 0},d.prototype.positionIsBlockBreak=function(t){var e;return null!=(e=this.document.getPieceAtPosition(t))?e.isBlockBreak():void 0},d.prototype.getSelectedDocument=function(){var t;return(t=this.getSelectedRange())?this.document.getDocumentAtRange(t):void 0},d.prototype.getSelectedAttachments=function(){var t;return null!=(t=this.getSelectedDocument())?t.getAttachments():void 0},d.prototype.getAttachments=function(){return this.attachments.slice(0)},d.prototype.refreshAttachments=function(){var t,e,n,r,i,o,a,s,u,c,h,p;for(n=this.document.getAttachments(),t=(s=l(this.attachments,n)).added,h=s.removed,this.attachments=n,r=0,o=h.length;o>r;r++)(e=h[r]).delegate=null,null!=(u=this.delegate)&&"function"==typeof u.compositionDidRemoveAttachment&&u.compositionDidRemoveAttachment(e);for(p=[],i=0,a=t.length;a>i;i++)(e=t[i]).delegate=this,p.push(null!=(c=this.delegate)&&"function"==typeof c.compositionDidAddAttachment?c.compositionDidAddAttachment(e):void 0);return p},d.prototype.attachmentDidChangeAttributes=function(t){var e;return this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidEditAttachment?e.compositionDidEditAttachment(t):void 0},d.prototype.attachmentDidChangePreviewURL=function(t){var e;return this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidChangeAttachmentPreviewURL?e.compositionDidChangeAttachmentPreviewURL(t):void 0},d.prototype.editAttachment=function(t,e){var n;if(t!==this.editingAttachment)return this.stopEditingAttachment(),this.editingAttachment=t,null!=(n=this.delegate)&&"function"==typeof n.compositionDidStartEditingAttachment?n.compositionDidStartEditingAttachment(this.editingAttachment,e):void 0},d.prototype.stopEditingAttachment=function(){var t;if(this.editingAttachment)return null!=(t=this.delegate)&&"function"==typeof t.compositionDidStopEditingAttachment&&t.compositionDidStopEditingAttachment(this.editingAttachment),this.editingAttachment=null},d.prototype.updateAttributesForAttachment=function(t,e){return this.setDocument(this.document.updateAttributesForAttachment(t,e))},d.prototype.removeAttributeForAttachment=function(t,e){return this.setDocument(this.document.removeAttributeForAttachment(t,e))},d.prototype.breakFormattedBlock=function(t){var e,n,i,o,a;return n=t.document,e=t.block,a=[(o=t.startPosition)-1,o],e.getBlockBreakPosition()===t.startLocation.offset?(e.breaksOnReturn()&&"\n"===t.nextCharacter?o+=1:n=n.removeTextAtRange(a),a=[o,o]):"\n"===t.nextCharacter?"\n"===t.previousCharacter?a=[o-1,o+1]:(a=[o,o+1],o+=1):t.startLocation.offset-1!=0&&(o+=1),i=new r.Document([e.removeLastAttribute().copyWithoutText()]),this.setDocument(n.insertDocumentAtRange(i,a)),this.setSelection(o)},d.prototype.getPreviousBlock=function(){var t,e;return(e=this.getLocationRange())&&(t=e[0].index)>0?this.document.getBlockAtIndex(t-1):void 0},d.prototype.getBlock=function(){var t;return(t=this.getLocationRange())?this.document.getBlockAtIndex(t[0].index):void 0},d.prototype.getAttachmentAtRange=function(t){var e;return(e=this.document.getDocumentAtRange(t)).toString()===r.OBJECT_REPLACEMENT_CHARACTER+"\n"?e.getAttachments()[0]:void 0},d.prototype.notifyDelegateOfCurrentAttributesChange=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.compositionDidChangeCurrentAttributes?t.compositionDidChangeCurrentAttributes(this.currentAttributes):void 0},d.prototype.notifyDelegateOfInsertionAtRange=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionDidPerformInsertionAtRange?e.compositionDidPerformInsertionAtRange(t):void 0},d.prototype.translateUTF16PositionFromOffset=function(t,e){var n,r;return n=(r=this.document.toUTF16String()).offsetFromUCS2Offset(t),r.offsetToUCS2Offset(n+e)},d}(r.BasicObject)}.call(this),function(){var t=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},e={}.hasOwnProperty;r.UndoManager=function(e){function n(t){this.composition=t,this.undoEntries=[],this.redoEntries=[]}var r;return t(n,e),n.prototype.recordUndoEntry=function(t,e){var n,i,o,a,s;return i=(a=null!=e?e:{}).context,n=a.consolidatable,o=this.undoEntries.slice(-1)[0],n&&r(o,t,i)?void 0:(s=this.createEntry({description:t,context:i}),this.undoEntries.push(s),this.redoEntries=[])},n.prototype.undo=function(){var t,e;return(e=this.undoEntries.pop())?(t=this.createEntry(e),this.redoEntries.push(t),this.composition.loadSnapshot(e.snapshot)):void 0},n.prototype.redo=function(){var t,e;return(t=this.redoEntries.pop())?(e=this.createEntry(t),this.undoEntries.push(e),this.composition.loadSnapshot(t.snapshot)):void 0},n.prototype.canUndo=function(){return this.undoEntries.length>0},n.prototype.canRedo=function(){return this.redoEntries.length>0},n.prototype.createEntry=function(t){var e,n,r;return n=(r=null!=t?t:{}).description,e=r.context,{description:null!=n?n.toString():void 0,context:JSON.stringify(e),snapshot:this.composition.getSnapshot()}},r=function(t,e,n){return(null!=t?t.description:void 0)===(null!=e?e.toString():void 0)&&(null!=t?t.context:void 0)===JSON.stringify(n)},n}(r.BasicObject)}.call(this),function(){var t;r.attachmentGalleryFilter=function(e){var n;return(n=new t(e)).perform(),n.getSnapshot()},t=function(){function t(t){this.document=t.document,this.selectedRange=t.selectedRange}var e;return e="attachmentGallery","presentation","gallery",t.prototype.perform=function(){return this.removeBlockAttribute(),this.applyBlockAttribute()},t.prototype.getSnapshot=function(){return{document:this.document,selectedRange:this.selectedRange}},t.prototype.removeBlockAttribute=function(){var t,n,r,i,o;for(o=[],t=0,n=(i=this.findRangesOfBlocks()).length;n>t;t++)r=i[t],o.push(this.document=this.document.removeAttributeAtRange(e,r));return o},t.prototype.applyBlockAttribute=function(){var t,n,r,i,o,a;for(r=0,a=[],t=0,n=(o=this.findRangesOfPieces()).length;n>t;t++)(i=o[t])[1]-i[0]>1&&(i[0]+=r,i[1]+=r,"\n"!==this.document.getCharacterAtPosition(i[1])&&(this.document=this.document.insertBlockBreakAtRange(i[1]),i[1]n;n++)e=t[n],this.manageAttachment(e)}return t(n,e),n.prototype.getAttachments=function(){var t,e,n,r;for(e in r=[],n=this.managedAttachments)t=n[e],r.push(t);return r},n.prototype.manageAttachment=function(t){var e,n;return null!=(e=this.managedAttachments)[n=t.id]?e[n]:e[n]=new r.ManagedAttachment(this,t)},n.prototype.attachmentIsManaged=function(t){return t.id in this.managedAttachments},n.prototype.requestRemovalOfAttachment=function(t){var e;return this.attachmentIsManaged(t)&&null!=(e=this.delegate)&&"function"==typeof e.attachmentManagerDidRequestRemovalOfAttachment?e.attachmentManagerDidRequestRemovalOfAttachment(t):void 0},n.prototype.unmanageAttachment=function(t){var e;return e=this.managedAttachments[t.id],delete this.managedAttachments[t.id],e},n}(r.BasicObject)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h;t=r.elementContainsNode,e=r.findChildIndexOfNode,o=r.nodeIsBlockStart,a=r.nodeIsBlockStartComment,i=r.nodeIsBlockContainer,s=r.nodeIsCursorTarget,u=r.nodeIsEmptyTextNode,c=r.nodeIsTextNode,n=r.nodeIsAttachmentElement,l=r.tagName,h=r.walkTree,r.LocationMapper=function(){function r(t){this.element=t}var p,d,f,g;return r.prototype.findLocationFromContainerAndOffset=function(n,r,i){var a,u,l,p,g,m,v;for(m=(null!=i?i:{strict:!0}).strict,u=0,l=!1,p={index:0,offset:0},(a=this.findAttachmentElementParentForNode(n))&&(n=a.parentNode,r=e(a)),v=h(this.element,{usingFilter:f});v.nextNode();){if((g=v.currentNode)===n&&c(n)){s(g)||(p.offset+=r);break}if(g.parentNode===n){if(u++===r)break}else if(!t(n,g)&&u>0)break;o(g,{strict:m})?(l&&p.index++,p.offset=0,l=!0):p.offset+=d(g)}return p},r.prototype.findContainerAndOffsetFromLocation=function(t){var n,r,a,u,l;if(0===t.index&&0===t.offset){for(n=this.element,u=0;n.firstChild;)if(n=n.firstChild,i(n)){u=1;break}return[n,u]}if(r=(l=this.findNodeAndOffsetFromLocation(t))[0],a=l[1],r){if(c(r))0===d(r)?(n=r.parentNode.parentNode,u=e(r.parentNode),s(r,{name:"right"})&&u++):(n=r,u=t.offset-a);else{if(n=r.parentNode,!o(r.previousSibling)&&!i(n))for(;r===n.lastChild&&(r=n,n=n.parentNode,!i(n)););u=e(r),0!==t.offset&&u++}return[n,u]}},r.prototype.findNodeAndOffsetFromLocation=function(t){var e,n,r,i,o,a,u,l;for(u=0,n=0,r=(l=this.getSignificantNodesForIndex(t.index)).length;r>n;n++){if(e=l[n],i=d(e),t.offset<=u+i)if(c(e)){if(o=e,a=u,t.offset===a&&s(o))break}else o||(o=e,a=u);if((u+=i)>t.offset)break}return[o,a]},r.prototype.findAttachmentElementParentForNode=function(t){for(;t&&t!==this.element;){if(n(t))return t;t=t.parentNode}},r.prototype.getSignificantNodesForIndex=function(t){var e,n,r,i,o;for(r=[],o=h(this.element,{usingFilter:p}),i=!1;o.nextNode();)if(n=o.currentNode,a(n)){if(null!=e?e++:e=0,e===t)i=!0;else if(i)break}else i&&r.push(n);return r},d=function(t){return t.nodeType===Node.TEXT_NODE?s(t)?0:t.textContent.length:"br"===l(t)||n(t)?1:0},p=function(t){return g(t)===NodeFilter.FILTER_ACCEPT?f(t):NodeFilter.FILTER_REJECT},g=function(t){return u(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},f=function(t){return n(t.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},r}()}.call(this),function(){var t,e,n=[].slice;t=r.getDOMRange,e=r.setDOMRange,r.PointMapper=function(){function r(){}return r.prototype.createDOMRangeFromPoint=function(n){var r,i,o,a,s,u,c,l;if(c=n.x,l=n.y,document.caretPositionFromPoint)return o=(s=document.caretPositionFromPoint(c,l)).offsetNode,i=s.offset,(r=document.createRange()).setStart(o,i),r;if(document.caretRangeFromPoint)return document.caretRangeFromPoint(c,l);if(document.body.createTextRange){a=t();try{(u=document.body.createTextRange()).moveToPoint(c,l),u.select()}catch(t){}return r=t(),e(a),r}},r.prototype.getClientRectsForDOMRange=function(t){var e;return[(e=n.call(t.getClientRects()))[0],e[e.length-1]]},r}()}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},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,o=[].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=r.getDOMRange,r.SelectionChangeObserver=function(r){function i(){this.run=e(this.run,this),this.update=e(this.update,this),this.selectionManagers=[]}var a;return n(i,r),i.prototype.start=function(){return this.started?void 0:(this.started=!0,"onselectionchange"in document?document.addEventListener("selectionchange",this.update,!0):this.run())},i.prototype.stop=function(){return this.started?(this.started=!1,document.removeEventListener("selectionchange",this.update,!0)):void 0},i.prototype.registerSelectionManager=function(t){return o.call(this.selectionManagers,t)<0?(this.selectionManagers.push(t),this.start()):void 0},i.prototype.unregisterSelectionManager=function(t){var e;return this.selectionManagers=function(){var n,r,i,o;for(o=[],n=0,r=(i=this.selectionManagers).length;r>n;n++)(e=i[n])!==t&&o.push(e);return o}.call(this),0===this.selectionManagers.length?this.stop():void 0},i.prototype.notifySelectionManagersOfSelectionChange=function(){var t,e,n,r,i;for(r=[],t=0,e=(n=this.selectionManagers).length;e>t;t++)i=n[t],r.push(i.selectionDidChange());return r},i.prototype.update=function(){var e;return e=t(),a(e,this.domRange)?void 0:(this.domRange=e,this.notifySelectionManagersOfSelectionChange())},i.prototype.reset=function(){return this.domRange=null,this.update()},i.prototype.run=function(){return this.started?(this.update(),requestAnimationFrame(this.run)):void 0},a=function(t,e){return(null!=t?t.startContainer:void 0)===(null!=e?e.startContainer:void 0)&&(null!=t?t.startOffset:void 0)===(null!=e?e.startOffset:void 0)&&(null!=t?t.endContainer:void 0)===(null!=e?e.endContainer:void 0)&&(null!=t?t.endOffset:void 0)===(null!=e?e.endOffset:void 0)},i}(r.BasicObject),null==r.selectionChangeObserver&&(r.selectionChangeObserver=new r.SelectionChangeObserver)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function n(){this.constructor=t}for(var r in e)d.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},d={}.hasOwnProperty;n=r.getDOMSelection,e=r.getDOMRange,l=r.setDOMRange,t=r.elementContainsNode,a=r.nodeIsCursorTarget,o=r.innerElementIsActive,i=r.handleEvent,s=r.normalizeRange,u=r.rangeIsCollapsed,c=r.rangesAreEqual,r.SelectionManager=function(d){function f(t){this.element=t,this.selectionDidChange=h(this.selectionDidChange,this),this.didMouseDown=h(this.didMouseDown,this),this.locationMapper=new r.LocationMapper(this.element),this.pointMapper=new r.PointMapper,this.lockCount=0,i("mousedown",{onElement:this.element,withCallback:this.didMouseDown})}return p(f,d),f.prototype.getLocationRange=function(t){var n;return null==t&&(t={}),!1===t.strict?this.createLocationRangeFromDOMRange(e(),{strict:!1}):t.ignoreLock?this.currentLocationRange:null!=(n=this.lockedLocationRange)?n:this.currentLocationRange},f.prototype.setLocationRange=function(t){var e;if(!this.lockedLocationRange)return t=s(t),(e=this.createDOMRangeFromLocationRange(t))?(l(e),this.updateCurrentLocationRange(t)):void 0},f.prototype.setLocationRangeFromPointRange=function(t){var e,n;return t=s(t),n=this.getLocationAtPoint(t[0]),e=this.getLocationAtPoint(t[1]),this.setLocationRange([n,e])},f.prototype.getClientRectAtLocationRange=function(t){var e;return(e=this.createDOMRangeFromLocationRange(t))?this.getClientRectsForDOMRange(e)[1]:void 0},f.prototype.locationIsCursorTarget=function(t){var e,n;return e=(n=this.findNodeAndOffsetFromLocation(t))[0],n[1],a(e)},f.prototype.lock=function(){return 0==this.lockCount++?(this.updateCurrentLocationRange(),this.lockedLocationRange=this.getLocationRange()):void 0},f.prototype.unlock=function(){var t;return 0==--this.lockCount&&(t=this.lockedLocationRange,this.lockedLocationRange=null,null!=t)?this.setLocationRange(t):void 0},f.prototype.clearSelection=function(){var t;return null!=(t=n())?t.removeAllRanges():void 0},f.prototype.selectionIsCollapsed=function(){var t;return!0===(null!=(t=e())?t.collapsed:void 0)},f.prototype.selectionIsExpanded=function(){return!this.selectionIsCollapsed()},f.prototype.createLocationRangeFromDOMRange=function(t,e){var n,r;if(null!=t&&this.domRangeWithinElement(t)&&(r=this.findLocationFromContainerAndOffset(t.startContainer,t.startOffset,e)))return t.collapsed||(n=this.findLocationFromContainerAndOffset(t.endContainer,t.endOffset,e)),s([r,n])},f.proxyMethod("locationMapper.findLocationFromContainerAndOffset"),f.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"),f.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"),f.proxyMethod("pointMapper.createDOMRangeFromPoint"),f.proxyMethod("pointMapper.getClientRectsForDOMRange"),f.prototype.didMouseDown=function(){return this.pauseTemporarily()},f.prototype.pauseTemporarily=function(){var e,n,r,o;return this.paused=!0,n=function(e){return function(){var n,i;for(e.paused=!1,clearTimeout(o),n=0,i=r.length;i>n;n++)r[n].destroy();return t(document,e.element)?e.selectionDidChange():void 0}}(this),o=setTimeout(n,200),r=function(){var t,r,o,a;for(a=[],t=0,r=(o=["mousemove","keydown"]).length;r>t;t++)e=o[t],a.push(i(e,{onElement:document,withCallback:n}));return a}()},f.prototype.selectionDidChange=function(){return this.paused||o(this.element)?void 0:this.updateCurrentLocationRange()},f.prototype.updateCurrentLocationRange=function(t){var n;return(null!=t?t:t=this.createLocationRangeFromDOMRange(e()))&&!c(t,this.currentLocationRange)?(this.currentLocationRange=t,null!=(n=this.delegate)&&"function"==typeof n.locationRangeDidChange?n.locationRangeDidChange(this.currentLocationRange.slice(0)):void 0):void 0},f.prototype.createDOMRangeFromLocationRange=function(t){var e,n,r,i;return r=this.findContainerAndOffsetFromLocation(t[0]),n=u(t)?r:null!=(i=this.findContainerAndOffsetFromLocation(t[1]))?i:r,null!=r&&null!=n?((e=document.createRange()).setStart.apply(e,r),e.setEnd.apply(e,n),e):void 0},f.prototype.getLocationAtPoint=function(t){var e,n;return(e=this.createDOMRangeFromPoint(t))&&null!=(n=this.createLocationRangeFromDOMRange(e))?n[0]:void 0},f.prototype.domRangeWithinElement=function(e){return e.collapsed?t(this.element,e.startContainer):t(this.element,e.startContainer)&&t(this.element,e.endContainer)},f}(r.BasicObject)}.call(this),function(){var t,e,n,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty,s=[].slice;n=r.rangeIsCollapsed,i=r.rangesAreEqual,e=r.objectsAreEqual,t=r.getBlockConfig,r.EditorController=function(a){function u(t){var e,n;this.editorElement=t.editorElement,e=t.document,n=t.html,this.selectionManager=new r.SelectionManager(this.editorElement),this.selectionManager.delegate=this,this.composition=new r.Composition,this.composition.delegate=this,this.attachmentManager=new r.AttachmentManager(this.composition.getAttachments()),this.attachmentManager.delegate=this,this.inputController=new(r["Level"+r.config.input.getLevel()+"InputController"])(this.editorElement),this.inputController.delegate=this,this.inputController.responder=this.composition,this.compositionController=new r.CompositionController(this.editorElement,this.composition),this.compositionController.delegate=this,this.toolbarController=new r.ToolbarController(this.editorElement.toolbarElement),this.toolbarController.delegate=this,this.editor=new r.Editor(this.composition,this.selectionManager,this.editorElement),null!=e?this.editor.loadDocument(e):this.editor.loadHTML(n)}var c;return o(u,a),u.prototype.registerSelectionManager=function(){return r.selectionChangeObserver.registerSelectionManager(this.selectionManager)},u.prototype.unregisterSelectionManager=function(){return r.selectionChangeObserver.unregisterSelectionManager(this.selectionManager)},u.prototype.render=function(){return this.compositionController.render()},u.prototype.reparse=function(){return this.composition.replaceHTML(this.editorElement.innerHTML)},u.prototype.compositionDidChangeDocument=function(){return this.notifyEditorElement("document-change"),this.handlingInput?void 0:this.render()},u.prototype.compositionDidChangeCurrentAttributes=function(t){return this.currentAttributes=t,this.toolbarController.updateAttributes(this.currentAttributes),this.updateCurrentActions(),this.notifyEditorElement("attributes-change",{attributes:this.currentAttributes})},u.prototype.compositionDidPerformInsertionAtRange=function(t){return this.pasting?this.pastedRange=t:void 0},u.prototype.compositionShouldAcceptFile=function(t){return this.notifyEditorElement("file-accept",{file:t})},u.prototype.compositionDidAddAttachment=function(t){var e;return e=this.attachmentManager.manageAttachment(t),this.notifyEditorElement("attachment-add",{attachment:e})},u.prototype.compositionDidEditAttachment=function(t){var e;return this.compositionController.rerenderViewForObject(t),e=this.attachmentManager.manageAttachment(t),this.notifyEditorElement("attachment-edit",{attachment:e}),this.notifyEditorElement("change")},u.prototype.compositionDidChangeAttachmentPreviewURL=function(t){return this.compositionController.invalidateViewForObject(t),this.notifyEditorElement("change")},u.prototype.compositionDidRemoveAttachment=function(t){var e;return e=this.attachmentManager.unmanageAttachment(t),this.notifyEditorElement("attachment-remove",{attachment:e})},u.prototype.compositionDidStartEditingAttachment=function(t,e){return this.attachmentLocationRange=this.composition.document.getLocationRangeOfAttachment(t),this.compositionController.installAttachmentEditorForAttachment(t,e),this.selectionManager.setLocationRange(this.attachmentLocationRange)},u.prototype.compositionDidStopEditingAttachment=function(){return this.compositionController.uninstallAttachmentEditor(),this.attachmentLocationRange=null},u.prototype.compositionDidRequestChangingSelectionToLocationRange=function(t){return!this.loadingSnapshot||this.isFocused()?(this.requestedLocationRange=t,this.compositionRevisionWhenLocationRangeRequested=this.composition.revision,this.handlingInput?void 0:this.render()):void 0},u.prototype.compositionWillLoadSnapshot=function(){return this.loadingSnapshot=!0},u.prototype.compositionDidLoadSnapshot=function(){return this.compositionController.refreshViewCache(),this.render(),this.loadingSnapshot=!1},u.prototype.getSelectionManager=function(){return this.selectionManager},u.proxyMethod("getSelectionManager().setLocationRange"),u.proxyMethod("getSelectionManager().getLocationRange"),u.prototype.attachmentManagerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},u.prototype.compositionControllerWillSyncDocumentView=function(){return this.inputController.editorWillSyncDocumentView(),this.selectionManager.lock(),this.selectionManager.clearSelection()},u.prototype.compositionControllerDidSyncDocumentView=function(){return this.inputController.editorDidSyncDocumentView(),this.selectionManager.unlock(),this.updateCurrentActions(),this.notifyEditorElement("sync")},u.prototype.compositionControllerDidRender=function(){return null!=this.requestedLocationRange&&(this.compositionRevisionWhenLocationRangeRequested===this.composition.revision&&this.selectionManager.setLocationRange(this.requestedLocationRange),this.requestedLocationRange=null,this.compositionRevisionWhenLocationRangeRequested=null),this.renderedCompositionRevision!==this.composition.revision&&(this.runEditorFilters(),this.composition.updateCurrentAttributes(),this.notifyEditorElement("render")),this.renderedCompositionRevision=this.composition.revision},u.prototype.compositionControllerDidFocus=function(){return this.toolbarController.hideDialog(),this.notifyEditorElement("focus")},u.prototype.compositionControllerDidBlur=function(){return this.notifyEditorElement("blur")},u.prototype.compositionControllerDidSelectAttachment=function(t,e){return this.toolbarController.hideDialog(),this.composition.editAttachment(t,e)},u.prototype.compositionControllerDidRequestDeselectingAttachment=function(t){var e,n;return e=null!=(n=this.attachmentLocationRange)?n:this.composition.document.getLocationRangeOfAttachment(t),this.selectionManager.setLocationRange(e[1])},u.prototype.compositionControllerWillUpdateAttachment=function(t){return this.editor.recordUndoEntry("Edit Attachment",{context:t.id,consolidatable:!0})},u.prototype.compositionControllerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},u.prototype.inputControllerWillHandleInput=function(){return this.handlingInput=!0,this.requestedRender=!1},u.prototype.inputControllerDidRequestRender=function(){return this.requestedRender=!0},u.prototype.inputControllerDidHandleInput=function(){return this.handlingInput=!1,this.requestedRender?(this.requestedRender=!1,this.render()):void 0},u.prototype.inputControllerDidAllowUnhandledInput=function(){return this.notifyEditorElement("change")},u.prototype.inputControllerDidRequestReparse=function(){return this.reparse()},u.prototype.inputControllerWillPerformTyping=function(){return this.recordTypingUndoEntry()},u.prototype.inputControllerWillPerformFormatting=function(t){return this.recordFormattingUndoEntry(t)},u.prototype.inputControllerWillCutText=function(){return this.editor.recordUndoEntry("Cut")},u.prototype.inputControllerWillPaste=function(t){return this.editor.recordUndoEntry("Paste"),this.pasting=!0,this.notifyEditorElement("before-paste",{paste:t})},u.prototype.inputControllerDidPaste=function(t){return t.range=this.pastedRange,this.pastedRange=null,this.pasting=null,this.notifyEditorElement("paste",{paste:t})},u.prototype.inputControllerWillMoveText=function(){return this.editor.recordUndoEntry("Move")},u.prototype.inputControllerWillAttachFiles=function(){return this.editor.recordUndoEntry("Drop Files")},u.prototype.inputControllerWillPerformUndo=function(){return this.editor.undo()},u.prototype.inputControllerWillPerformRedo=function(){return this.editor.redo()},u.prototype.inputControllerDidReceiveKeyboardCommand=function(t){return this.toolbarController.applyKeyboardCommand(t)},u.prototype.inputControllerDidStartDrag=function(){return this.locationRangeBeforeDrag=this.selectionManager.getLocationRange()},u.prototype.inputControllerDidReceiveDragOverPoint=function(t){return this.selectionManager.setLocationRangeFromPointRange(t)},u.prototype.inputControllerDidCancelDrag=function(){return this.selectionManager.setLocationRange(this.locationRangeBeforeDrag),this.locationRangeBeforeDrag=null},u.prototype.locationRangeDidChange=function(t){return this.composition.updateCurrentAttributes(),this.updateCurrentActions(),this.attachmentLocationRange&&!i(this.attachmentLocationRange,t)&&this.composition.stopEditingAttachment(),this.notifyEditorElement("selection-change")},u.prototype.toolbarDidClickButton=function(){return this.getLocationRange()?void 0:this.setLocationRange({index:0,offset:0})},u.prototype.toolbarDidInvokeAction=function(t){return this.invokeAction(t)},u.prototype.toolbarDidToggleAttribute=function(t){return this.recordFormattingUndoEntry(t),this.composition.toggleCurrentAttribute(t),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarDidUpdateAttribute=function(t,e){return this.recordFormattingUndoEntry(t),this.composition.setCurrentAttribute(t,e),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarDidRemoveAttribute=function(t){return this.recordFormattingUndoEntry(t),this.composition.removeCurrentAttribute(t),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarWillShowDialog=function(){return this.composition.expandSelectionForEditing(),this.freezeSelection()},u.prototype.toolbarDidShowDialog=function(t){return this.notifyEditorElement("toolbar-dialog-show",{dialogName:t})},u.prototype.toolbarDidHideDialog=function(t){return this.thawSelection(),this.editorElement.focus(),this.notifyEditorElement("toolbar-dialog-hide",{dialogName:t})},u.prototype.freezeSelection=function(){return this.selectionFrozen?void 0:(this.selectionManager.lock(),this.composition.freezeSelection(),this.selectionFrozen=!0,this.render())},u.prototype.thawSelection=function(){return this.selectionFrozen?(this.composition.thawSelection(),this.selectionManager.unlock(),this.selectionFrozen=!1,this.render()):void 0},u.prototype.actions={undo:{test:function(){return this.editor.canUndo()},perform:function(){return this.editor.undo()}},redo:{test:function(){return this.editor.canRedo()},perform:function(){return this.editor.redo()}},link:{test:function(){return this.editor.canActivateAttribute("href")}},increaseNestingLevel:{test:function(){return this.editor.canIncreaseNestingLevel()},perform:function(){return this.editor.increaseNestingLevel()&&this.render()}},decreaseNestingLevel:{test:function(){return this.editor.canDecreaseNestingLevel()},perform:function(){return this.editor.decreaseNestingLevel()&&this.render()}},attachFiles:{test:function(){return!0},perform:function(){return r.config.input.pickFiles(this.editor.insertFiles)}}},u.prototype.canInvokeAction=function(t){var e,n;return!!this.actionIsExternal(t)||!!(null!=(e=this.actions[t])&&null!=(n=e.test)?n.call(this):void 0)},u.prototype.invokeAction=function(t){var e,n;return this.actionIsExternal(t)?this.notifyEditorElement("action-invoke",{actionName:t}):null!=(e=this.actions[t])&&null!=(n=e.perform)?n.call(this):void 0},u.prototype.actionIsExternal=function(t){return/^x-./.test(t)},u.prototype.getCurrentActions=function(){var t,e;for(t in e={},this.actions)e[t]=this.canInvokeAction(t);return e},u.prototype.updateCurrentActions=function(){var t;return t=this.getCurrentActions(),e(t,this.currentActions)?void 0:(this.currentActions=t,this.toolbarController.updateActions(this.currentActions),this.notifyEditorElement("actions-change",{actions:this.currentActions}))},u.prototype.runEditorFilters=function(){var t,e,n,r,i,o,a,s;for(s=this.composition.getSnapshot(),n=0,r=(i=this.editor.filters).length;r>n;n++)e=i[n],t=s.document,a=s.selectedRange,null==(s=null!=(o=e.call(this.editor,s))?o:{}).document&&(s.document=t),null==s.selectedRange&&(s.selectedRange=a);return c(s,this.composition.getSnapshot())?void 0:this.composition.loadSnapshot(s)},c=function(t,e){return i(t.selectedRange,e.selectedRange)&&t.document.isEqualTo(e.document)},u.prototype.updateInputElement=function(){var t,e;return t=this.compositionController.getSerializableElement(),e=r.serializeToContentType(t,"text/html"),this.editorElement.setInputElementValue(e)},u.prototype.notifyEditorElement=function(t,e){switch(t){case"document-change":this.documentChangedSinceLastRender=!0;break;case"render":this.documentChangedSinceLastRender&&(this.documentChangedSinceLastRender=!1,this.notifyEditorElement("change"));break;case"change":case"attachment-add":case"attachment-edit":case"attachment-remove":this.updateInputElement()}return this.editorElement.notify(t,e)},u.prototype.removeAttachment=function(t){return this.editor.recordUndoEntry("Delete Attachment"),this.composition.removeAttachment(t),this.render()},u.prototype.recordFormattingUndoEntry=function(e){var r,i;return r=t(e),i=this.selectionManager.getLocationRange(),r||!n(i)?this.editor.recordUndoEntry("Formatting",{context:this.getUndoContext(),consolidatable:!0}):void 0},u.prototype.recordTypingUndoEntry=function(){return this.editor.recordUndoEntry("Typing",{context:this.getUndoContext(this.currentAttributes),consolidatable:!0})},u.prototype.getUndoContext=function(){var t;return t=1<=arguments.length?s.call(arguments,0):[],[this.getLocationContext(),this.getTimeContext()].concat(s.call(t))},u.prototype.getLocationContext=function(){var t;return t=this.selectionManager.getLocationRange(),n(t)?t[0].index:t},u.prototype.getTimeContext=function(){return r.config.undoInterval>0?Math.floor((new Date).getTime()/r.config.undoInterval):0},u.prototype.isFocused=function(){var t;return this.editorElement===(null!=(t=this.editorElement.ownerDocument)?t.activeElement:void 0)},u}(r.Controller)}.call(this),function(){var t,e,n,i,o,a,s,u,c,l,h,p,d,f;e=r.browser,o=r.makeElement,a=r.triggerEvent,n=r.handleEvent,i=r.handleEventOnce,t=r.AttachmentView.attachmentSelector,r.registerElement("trix-editor",(p=0,u=function(t){return!document.querySelector(":focus")&&t.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===t?t.focus():void 0},d=function(t){return t.hasAttribute("contenteditable")?void 0:(t.setAttribute("contenteditable",""),i("focus",{onElement:t,withCallback:function(){return c(t)}}))},s=function(t){return t.hasAttribute("role")?void 0:t.setAttribute("role","textbox")},c=function(t){return h(t),f(t)},h=function(t){return("function"==typeof document.queryCommandSupported?document.queryCommandSupported("enableObjectResizing"):void 0)?(document.execCommand("enableObjectResizing",!1,!1),n("mscontrolselect",{onElement:t,preventDefault:!0})):void 0},f=function(){var t;return!("function"==typeof document.queryCommandSupported?document.queryCommandSupported("DefaultParagraphSeparator"):void 0)||"div"!==(t=r.config.blockAttributes.default.tagName)&&"p"!==t?void 0:document.execCommand("DefaultParagraphSeparator",!1,t)},l=e.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"},{defaultCSS:"%t {\n display: block;\n}\n\n%t:empty:not(:focus)::before {\n content: attr(placeholder);\n color: graytext;\n cursor: text;\n}\n\n%t a[contenteditable=false] {\n cursor: text;\n}\n\n%t img {\n max-width: 100%;\n height: auto;\n}\n\n%t "+t+" figcaption textarea {\n resize: none;\n}\n\n%t "+t+" figcaption textarea.trix-autoresize-clone {\n position: absolute;\n left: -9999px;\n max-height: 0px;\n}\n\n%t "+t+" figcaption[data-trix-placeholder]:empty::before {\n content: attr(data-trix-placeholder);\n color: graytext;\n}\n\n%t [data-trix-cursor-target] {\n display: "+l.display+" !important;\n width: "+l.width+" !important;\n padding: 0 !important;\n margin: 0 !important;\n border: none !important;\n}\n\n%t [data-trix-cursor-target=left] {\n vertical-align: top !important;\n margin-left: -1px !important;\n}\n\n%t [data-trix-cursor-target=right] {\n vertical-align: bottom !important;\n margin-right: -1px !important;\n}",trixId:{get:function(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++p),this.trixId)}},toolbarElement:{get:function(){var t,e,n;return this.hasAttribute("toolbar")?null!=(e=this.ownerDocument)?e.getElementById(this.getAttribute("toolbar")):void 0:this.parentNode?(n="trix-toolbar-"+this.trixId,this.setAttribute("toolbar",n),t=o("trix-toolbar",{id:n}),this.parentNode.insertBefore(t,this),t):void 0}},inputElement:{get:function(){var t,e,n;return this.hasAttribute("input")?null!=(n=this.ownerDocument)?n.getElementById(this.getAttribute("input")):void 0:this.parentNode?(e="trix-input-"+this.trixId,this.setAttribute("input",e),t=o("input",{type:"hidden",id:e}),this.parentNode.insertBefore(t,this.nextElementSibling),t):void 0}},editor:{get:function(){var t;return null!=(t=this.editorController)?t.editor:void 0}},name:{get:function(){var t;return null!=(t=this.inputElement)?t.name:void 0}},value:{get:function(){var t;return null!=(t=this.inputElement)?t.value:void 0},set:function(t){var e;return this.defaultValue=t,null!=(e=this.editor)?e.loadHTML(this.defaultValue):void 0}},notify:function(t,e){return this.editorController?a("trix-"+t,{onElement:this,attributes:e}):void 0},setInputElementValue:function(t){var e;return null!=(e=this.inputElement)?e.value=t:void 0},initialize:function(){return d(this),s(this)},connect:function(){return this.hasAttribute("data-trix-internal")?void 0:(this.editorController||(a("trix-before-initialize",{onElement:this}),this.editorController=new r.EditorController({editorElement:this,html:this.defaultValue=this.value}),requestAnimationFrame(function(t){return function(){return a("trix-initialize",{onElement:t})}}(this))),this.editorController.registerSelectionManager(),this.registerResetListener(),u(this))},disconnect:function(){var t;return null!=(t=this.editorController)&&t.unregisterSelectionManager(),this.unregisterResetListener()},registerResetListener:function(){return this.resetListener=this.resetBubbled.bind(this),window.addEventListener("reset",this.resetListener,!1)},unregisterResetListener:function(){return window.removeEventListener("reset",this.resetListener,!1)},resetBubbled:function(t){var e;return t.target!==(null!=(e=this.inputElement)?e.form:void 0)||t.defaultPrevented?void 0:this.reset()},reset:function(){return this.value=this.defaultValue}}))}.call(this),function(){}.call(this)}).call(this),t.exports?t.exports=r:void 0===(o="function"==typeof(i=r)?i.call(e,n,e,t):i)||(t.exports=o)}.call(this)}).call(this,n(5).setImmediate)},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(6),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(2))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,a,s,u=1,c={},l=!1,h=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){f(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},r=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(t){var e=h.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(f,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&f(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),r=function(e){t.postMessage(a+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n=0&&h.splice(e,1)}function v(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var r=function(){0;return n.nc}();r&&(t.attrs.nonce=r)}return y(e,t.attrs),g(t,e),e}function y(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function b(t,e){var n,r,i,o;if(e.transform&&t.css){if(!(o="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=o}if(e.singleton){var a=l++;n=c||(c=v(e)),r=w.bind(null,n,a,!1),i=w.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",y(e,t.attrs),g(t,e),e}(e),r=E.bind(null,n,e),i=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),r=C.bind(null,n),i=function(){m(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return d(n,e),function(t){for(var r=[],i=0;it.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0&&"[object Array]"===Object.prototype.toString.call(t)};function b(t){return"[object String]"===Object.prototype.toString.call(t)}var x=d((function(t){return null!=t&&"function"==typeof t["fantasy-land/empty"]?t["fantasy-land/empty"]():null!=t&&null!=t.constructor&&"function"==typeof t.constructor["fantasy-land/empty"]?t.constructor["fantasy-land/empty"]():null!=t&&"function"==typeof t.empty?t.empty():null!=t&&null!=t.constructor&&"function"==typeof t.constructor.empty?t.constructor.empty():y(t)?[]:b(t)?"":function(t){return"[object Object]"===Object.prototype.toString.call(t)}(t)?{}:v(t)?function(){return arguments}():void 0}));function A(t){return function e(n,r){switch(arguments.length){case 0:return e;case 1:return p(n)?e:d((function(e){return t(n,e)}));default:return p(n)&&p(r)?e:p(n)?d((function(e){return t(e,r)})):p(r)?d((function(e){return t(n,e)})):t(n,r)}}}function w(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}function C(t,e,n){for(var r=0,i=n.length;r=0;)g(e=S[n],t)&&!R(r,e)&&(r[r.length]=e),n-=1;return r})):d((function(t){return Object(t)!==t?[]:Object.keys(t)})),T=d((function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}));function O(t,e,n,r){var i=w(t);function o(t,e){return _(t,e,n.slice(),r.slice())}return!C((function(t,e){return!C(o,e,t)}),w(e),i)}function _(t,e,n,r){if(E(t,e))return!0;var i,o,a=T(t);if(a!==T(e))return!1;if(null==t||null==e)return!1;if("function"==typeof t["fantasy-land/equals"]||"function"==typeof e["fantasy-land/equals"])return"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e)&&"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t);if("function"==typeof t.equals||"function"==typeof e.equals)return"function"==typeof t.equals&&t.equals(e)&&"function"==typeof e.equals&&e.equals(t);switch(a){case"Arguments":case"Array":case"Object":if("function"==typeof t.constructor&&"Promise"===(i=t.constructor,null==(o=String(i).match(/^function (\w*)/))?"":o[1]))return t===e;break;case"Boolean":case"Number":case"String":if(typeof t!=typeof e||!E(t.valueOf(),e.valueOf()))return!1;break;case"Date":if(!E(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(t.source!==e.source||t.global!==e.global||t.ignoreCase!==e.ignoreCase||t.multiline!==e.multiline||t.sticky!==e.sticky||t.unicode!==e.unicode)return!1}for(var s=n.length-1;s>=0;){if(n[s]===t)return r[s]===e;s-=1}switch(a){case"Map":return t.size===e.size&&O(t.entries(),e.entries(),n.concat([t]),r.concat([e]));case"Set":return t.size===e.size&&O(t.values(),e.values(),n.concat([t]),r.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var u=L(t);if(u.length!==L(e).length)return!1;var c=n.concat([t]),l=r.concat([e]);for(s=u.length-1;s>=0;){var h=u[s];if(!g(h,e)||!_(e[h],t[h],c,l))return!1;s-=1}return!0}var I=A((function(t,e){return _(t,e,[],[])})),N=d((function(t){return null!=t&&I(t,x(t))})),P=A((function(t,e){for(var n={},r=0;r0&&(t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1)))))})),B=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,e){return this.f(t,e)},t}();function M(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(t){return e.apply(this,arguments)};case 2:return function(t,n){return e.apply(this,arguments)};case 3:return function(t,n,r){return e.apply(this,arguments)};case 4:return function(t,n,r,i){return e.apply(this,arguments)};case 5:return function(t,n,r,i,o){return e.apply(this,arguments)};case 6:return function(t,n,r,i,o,a){return e.apply(this,arguments)};case 7:return function(t,n,r,i,o,a,s){return e.apply(this,arguments)};case 8:return function(t,n,r,i,o,a,s,u){return e.apply(this,arguments)};case 9:return function(t,n,r,i,o,a,s,u,c){return e.apply(this,arguments)};case 10:return function(t,n,r,i,o,a,s,u,c,l){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}var j=A((function(t,e){return M(t.length,(function(){return t.apply(e,arguments)}))}));function z(t,e,n){for(var r=n.next();!r.done;){if((e=t["@@transducer/step"](e,r.value))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}r=n.next()}return t["@@transducer/result"](e)}function W(t,e,n,r){return t["@@transducer/result"](n[r](j(t["@@transducer/step"],t),e))}var q="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function U(t,e,n){if("function"==typeof t&&(t=function(t){return new B(t)}(t)),F(n))return function(t,e,n){for(var r=0,i=n.length;r=0}var K=A(H),J={bold:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-bold",languageKey:"bold",tabIndex:"-1",trixButtonGroup:"text-tools",data:{trixAttribute:"bold",trixKey:"b"}},italic:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-italic",languageKey:"italic",tabIndex:"-1",trixButtonGroup:"text-tools",data:{trixAttribute:"italic",trixKey:"i"}},strike:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-strike",languageKey:"strike",tabIndex:"-1",trixButtonGroup:"text-tools",data:{trixAttribute:"strike"}},link:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-link",languageKey:"link",tabIndex:"-1",trixButtonGroup:"text-tools",data:{trixAttribute:"href",trixKey:"k",trixAction:"link"}},heading1:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-heading-1",languageKey:"heading1",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAttribute:"heading1"}},quote:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-quote",languageKey:"quote",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAttribute:"quote"}},code:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-code",languageKey:"code",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAttribute:"code"}},bullet:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-bullet-list",languageKey:"bullets",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAttribute:"bullet"}},number:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-number-list",languageKey:"numbers",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAttribute:"number"}},outdent:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-decrease-nesting-level",languageKey:"outdent",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAction:"decreaseNestingLevel"}},indent:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-increase-nesting-level",languageKey:"indent",tabIndex:"-1",trixButtonGroup:"block-tools",data:{trixAction:"increaseNestingLevel"}},attachFiles:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-attach",languageKey:"attachFiles",tabIndex:"-1",trixButtonGroup:"file-tools",data:{trixAction:"attachFiles"}},undo:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-undo",languageKey:"undo",tabIndex:"-1",trixButtonGroup:"history-tools",data:{trixAction:"undo",trixKey:"z"}},redo:{type:"button",classNames:"trix-button trix-button--icon trix-button--icon-redo",languageKey:"redo",tabIndex:"-1",trixButtonGroup:"history-tools",data:{trixAction:"redo",trixKey:"shift+z"}}},G={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"},$={"text-tools":"trix-button-group trix-button-group--text-tools","block-tools":"trix-button-group trix-button-group--block-tools","file-tools":"trix-button-group trix-button-group--file-tools","history-tools":"trix-button-group trix-button-group--history-tools"};function X(){return(X=Object.assign||function(t){for(var e=1;e=arguments.length)?u=n[s]:(u=arguments[o],o+=1),i[s]=u,p(u)||(a-=1),s+=1}return a<=0?r.apply(this,i):M(a,t(e,i,r))}}(t,[],e))})),rt=d((function(t){return nt(t.length,(function(){var e=0,n=arguments[0],r=arguments[arguments.length-1],i=Array.prototype.slice.call(arguments,0);return i[0]=function(){var t=n.apply(this,et(arguments,[e,r]));return e+=1,t},t.apply(this,i)}))}));function it(t){return null!=t&&"function"==typeof t["@@transducer/step"]}function ot(t,e,n){return function(){if(0===arguments.length)return n();var r=Array.prototype.slice.call(arguments,0),i=r.pop();if(!y(i)){for(var o=0;o