trix 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 35359c35603cfe83ea2889e563a7d22ded765718
4
+ data.tar.gz: 3c81055f6a2c6dcf9a31e199739602c3b682fdfc
5
+ SHA512:
6
+ metadata.gz: ef8c1394fe70ceb70567a8373b2e4aec929e04fff594c4adac88a95ab6084aa73b8d0242888cc26ce32b743fbf14f40e8d82ad9609127f360efa60ea7860b138
7
+ data.tar.gz: 6e29b42e2e55c58f350d67effc7470196a488361766c5890d0a41f971526adca215cddc2d625f886fe45e88619296d6540b9f012400a88b01b1fb22e35ad6a59
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,2 @@
1
+ inherit_from:
2
+ - .rubocop_todo.yml
@@ -0,0 +1,6 @@
1
+ Metrics/AbcSize:
2
+ Enabled: false
3
+ Metrics/LineLength:
4
+ Max: 110
5
+ Style/Documentation:
6
+ Enabled: false
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in trix.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Jon Moss
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,61 @@
1
+ # Trix
2
+
3
+ [![Build Status](https://travis-ci.org/maclover7/trix.svg)](https://travis-ci.org/maclover7/trix)
4
+
5
+ Want to include Basecamp's awesome [Trix WYSIWYG
6
+ editor](http://trix-editor.org) in your Ruby on Rails application?
7
+ You've come to the right place!
8
+
9
+ Please see the appropriate guide for your environment of choice:
10
+
11
+ * [Ruby on Rails](#a-ruby-on-rails).
12
+
13
+ ### a. Ruby on Rails
14
+
15
+ `trix` is easy to drop into Rails with the asset pipeline.
16
+
17
+ In your Gemfile you need to add the `trix` gem.
18
+
19
+ ```ruby
20
+ gem 'trix'
21
+ ```
22
+
23
+ `bundle install` and restart your server to make the files available through the pipeline.
24
+
25
+ Import Trix styles in `app/assets/stylesheets/application.css`:
26
+
27
+ ```css
28
+ *= require trix
29
+ ```
30
+
31
+ Require Trix Javascript magic in `app/assets/javascripts/application.js`:
32
+
33
+ ```js
34
+ //= require trix
35
+ ```
36
+
37
+ Finally, any place where you would like to use the Trix editor in your
38
+ forms, just use the `trix_editor` helper:
39
+
40
+ ```ruby
41
+ f.trix_editor :body
42
+ ```
43
+
44
+ ## Trix
45
+
46
+ For the official Trix Github repository, go
47
+ [here](https://github.com/basecamp/trix).
48
+
49
+ ## Contributing
50
+
51
+ Bug reports and pull requests are welcome on GitHub at https://github.com/maclover7/trix.
52
+
53
+ ## Upgrading Trix
54
+ 1. Update `vendor/assets/stylesheets/trix.css` and
55
+ `vendor/assets/javascripts/trix.js`.
56
+ 2. Push a new version up to Rubygems.org, make sure the version number
57
+ matches that of Trix itself!
58
+
59
+ ## License
60
+
61
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ require 'rubocop/rake_task'
7
+ RuboCop::RakeTask.new
8
+
9
+ task default: [:rubocop, :spec]
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'trix'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,6 @@
1
+ require 'rails'
2
+ require 'trix/engine'
3
+ require 'trix/version'
4
+
5
+ module Trix
6
+ end
@@ -0,0 +1,9 @@
1
+ module Trix
2
+ class Engine < ::Rails::Engine
3
+ initializer 'trix.view_helpers' do
4
+ ActiveSupport.on_load(:action_view) do
5
+ require 'trix/form'
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,51 @@
1
+ module TrixEditorHelper
2
+ cattr_accessor(:id, instance_accessor: false) { 0 }
3
+
4
+ def trix_editor_tag(name, value = nil, options = {})
5
+ options.symbolize_keys!
6
+
7
+ attributes = { class: "formatted_content #{options[:class]}".squish }
8
+
9
+ attributes[:autofocus] = true if options[:autofocus]
10
+ attributes[:placeholder] = options[:placeholder] if options[:placeholder]
11
+ attributes[:input] = options[:input] || "trix_input_#{TrixEditorHelper.id += 1}"
12
+ attributes[:toolbar] = options[:toolbar] if options[:toolbar]
13
+
14
+ editor_tag = content_tag('trix-editor', '', attributes)
15
+ input_tag = hidden_field_tag(name, value, id: attributes[:input])
16
+
17
+ editor_tag + input_tag
18
+ end
19
+ end
20
+
21
+ module ActionView
22
+ module Helpers
23
+ include TrixEditorHelper
24
+
25
+ module Tags
26
+ class TrixEditor < Base
27
+ include TrixEditorHelper
28
+ delegate :dom_id, to: ActionView::RecordIdentifier
29
+
30
+ def render
31
+ options = @options.stringify_keys
32
+ add_default_name_and_id(options)
33
+ options['input'] ||= dom_id(object, [options['id'], :trix_input].compact.join('_'))
34
+ trix_editor_tag(options.delete('name'), value_before_type_cast(object), options)
35
+ end
36
+ end
37
+ end
38
+
39
+ module FormHelper
40
+ def trix_editor(object_name, method, options = {})
41
+ Tags::TrixEditor.new(object_name, method, self, options).render
42
+ end
43
+ end
44
+
45
+ class FormBuilder
46
+ def trix_editor(method, options = {})
47
+ @template.trix_editor(@object_name, method, objectify_options(options))
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,3 @@
1
+ module Trix
2
+ VERSION = '0.9.0'
3
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'trix/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'trix'
8
+ spec.version = Trix::VERSION
9
+ spec.authors = 'Jon Moss'
10
+ spec.email = 'me@jonathanmoss.me'
11
+
12
+ spec.summary = 'A rich text editor for everyday writing'
13
+ spec.description = 'A rich text editor for everyday writing'
14
+ spec.homepage = 'https://github.com/maclover7/trix'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_runtime_dependency 'rails'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.10'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rspec'
27
+ spec.add_development_dependency 'rubocop'
28
+ end
@@ -0,0 +1,25 @@
1
+ /*
2
+ Trix 0.9.0
3
+ Copyright © 2015 Basecamp, LLC
4
+ http://trix-editor.org/
5
+ */
6
+ (function(){}).call(this),function(){var t;null==window.Set&&(window.Set=t=function(){function t(){this.clear()}return t.prototype.clear=function(){return this.values=[]},t.prototype.has=function(t){return-1!==this.values.indexOf(t)},t.prototype.add=function(t){return this.has(t)||this.values.push(t),this},t.prototype["delete"]=function(t){var e;return-1===(e=this.values.indexOf(t))?!1:(this.values.splice(e,1),!0)},t.prototype.forEach=function(){var t;return(t=this.values).forEach.apply(t,arguments)},t}())}.call(this),/*
7
+ https://github.com/taylorhakes/promise-polyfill
8
+ Copyright (c) 2014 Taylor Hakes
9
+ Copyright (c) 2014 Forbes Lindesay
10
+ */
11
+ function(t){function e(t,e){return function(){t.apply(e,arguments)}}function n(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],u(t,e(i,this),e(r,this))}function o(t){var e=this;return null===this._state?void this._deferreds.push(t):void c(function(){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return void(e._state?t.resolve:t.reject)(e._value);var o;try{o=n(e._value)}catch(i){return void t.reject(i)}t.resolve(o)})}function i(t){try{if(t===this)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void u(e(n,t),e(i,this),e(r,this))}this._state=!0,this._value=t,s.call(this)}catch(o){r.call(this,o)}}function r(t){this._state=!1,this._value=t,s.call(this)}function s(){for(var t=0,e=this._deferreds.length;e>t;t++)o.call(this,this._deferreds[t]);this._deferreds=null}function a(t,e,n,o){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=n,this.reject=o}function u(t,e,n){var o=!1;try{t(function(t){o||(o=!0,e(t))},function(t){o||(o=!0,n(t))})}catch(i){if(o)return;o=!0,n(i)}}var c="function"==typeof setImmediate&&setImmediate||function(t){setTimeout(t,1)},l=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};n.prototype["catch"]=function(t){return this.then(null,t)},n.prototype.then=function(t,e){var i=this;return new n(function(n,r){o.call(i,new a(t,e,n,r))})},n.all=function(){var t=Array.prototype.slice.call(1===arguments.length&&l(arguments[0])?arguments[0]:arguments);return new n(function(e,n){function o(r,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var a=s.then;if("function"==typeof a)return void a.call(s,function(t){o(r,t)},n)}t[r]=s,0===--i&&e(t)}catch(u){n(u)}}if(0===t.length)return e([]);for(var i=t.length,r=0;r<t.length;r++)o(r,t[r])})},n.resolve=function(t){return t&&"object"==typeof t&&t.constructor===n?t:new n(function(e){e(t)})},n.reject=function(t){return new n(function(e,n){n(t)})},n.race=function(t){return new n(function(e,n){for(var o=0,i=t.length;i>o;o++)t[o].then(e,n)})},n._setImmediateFn=function(t){c=t},"undefined"!=typeof module&&module.exports?module.exports=n:t.Promise||(t.Promise=n)}(this),/**
12
+ * @license
13
+ * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
14
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
15
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
16
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
17
+ * Code distributed by Google as part of the polymer project is also
18
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
19
+ */
20
+ "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 o=e[this.name];return o&&o[0]===e?o[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):!1},has:function(t){var e=t[this.name];return e?e[0]===t:!1}},window.WeakMap=n}(),function(t){function e(t){A.push(t),b||(b=!0,g(o))}function n(t){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(t)||t}function o(){b=!1;var t=A;A=[],t.sort(function(t,e){return t.uid_-e.uid_});var e=!1;t.forEach(function(t){var n=t.takeRecords();i(t),n.length&&(t.callback_(n,t),e=!0)}),e&&o()}function i(t){t.nodes_.forEach(function(e){var n=m.get(e);n&&n.forEach(function(e){e.observer===t&&e.removeTransientObservers()})})}function r(t,e){for(var n=t;n;n=n.parentNode){var o=m.get(n);if(o)for(var i=0;i<o.length;i++){var r=o[i],s=r.options;if(n===t||s.subtree){var a=e(s);a&&r.enqueue(a)}}}}function s(t){this.callback_=t,this.nodes_=[],this.records_=[],this.uid_=++x}function a(t,e){this.type=t,this.target=e,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function u(t){var e=new a(t.type,t.target);return e.addedNodes=t.addedNodes.slice(),e.removedNodes=t.removedNodes.slice(),e.previousSibling=t.previousSibling,e.nextSibling=t.nextSibling,e.attributeName=t.attributeName,e.attributeNamespace=t.attributeNamespace,e.oldValue=t.oldValue,e}function c(t,e){return T=new a(t,e)}function l(t){return C?C:(C=u(T),C.oldValue=t,C)}function h(){T=C=void 0}function p(t){return t===C||t===T}function d(t,e){return t===e?t:C&&p(t)?C:null}function f(t,e,n){this.observer=t,this.target=e,this.options=n,this.transientObservedNodes=[]}var g,m=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))g=setTimeout;else if(window.setImmediate)g=window.setImmediate;else{var y=[],v=String(Math.random());window.addEventListener("message",function(t){if(t.data===v){var e=y;y=[],e.forEach(function(t){t()})}}),g=function(t){y.push(t),window.postMessage(v,"*")}}var b=!1,A=[],x=0;s.prototype={observe:function(t,e){if(t=n(t),!e.childList&&!e.attributes&&!e.characterData||e.attributeOldValue&&!e.attributes||e.attributeFilter&&e.attributeFilter.length&&!e.attributes||e.characterDataOldValue&&!e.characterData)throw new SyntaxError;var o=m.get(t);o||m.set(t,o=[]);for(var i,r=0;r<o.length;r++)if(o[r].observer===this){i=o[r],i.removeListeners(),i.options=e;break}i||(i=new f(this,t,e),o.push(i),this.nodes_.push(t)),i.addListeners()},disconnect:function(){this.nodes_.forEach(function(t){for(var e=m.get(t),n=0;n<e.length;n++){var o=e[n];if(o.observer===this){o.removeListeners(),e.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var t=this.records_;return this.records_=[],t}};var T,C;f.prototype={enqueue:function(t){var n=this.observer.records_,o=n.length;if(n.length>0){var i=n[o-1],r=d(i,t);if(r)return void(n[o-1]=r)}else e(this.observer);n[o]=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=m.get(t);e||m.set(t,e=[]),e.push(this)}},removeTransientObservers:function(){var t=this.transientObservedNodes;this.transientObservedNodes=[],t.forEach(function(t){this.removeListeners_(t);for(var e=m.get(t),n=0;n<e.length;n++)if(e[n]===this){e.splice(n,1);break}},this)},handleEvent:function(t){switch(t.stopImmediatePropagation(),t.type){case"DOMAttrModified":var e=t.attrName,n=t.relatedNode.namespaceURI,o=t.target,i=new c("attributes",o);i.attributeName=e,i.attributeNamespace=n;var s=t.attrChange===MutationEvent.ADDITION?null:t.prevValue;r(o,function(t){return!t.attributes||t.attributeFilter&&t.attributeFilter.length&&-1===t.attributeFilter.indexOf(e)&&-1===t.attributeFilter.indexOf(n)?void 0:t.attributeOldValue?l(s):i});break;case"DOMCharacterDataModified":var o=t.target,i=c("characterData",o),s=t.prevValue;r(o,function(t){return t.characterData?t.characterDataOldValue?l(s):i:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(t.target);case"DOMNodeInserted":var a,u,p=t.target;"DOMNodeInserted"===t.type?(a=[p],u=[]):(a=[],u=[p]);var d=p.previousSibling,f=p.nextSibling,i=c("childList",t.target.parentNode);i.addedNodes=a,i.removedNodes=u,i.previousSibling=d,i.nextSibling=f,r(t.relatedNode,function(t){return t.childList?i:void 0})}h()}},t.JsMutationObserver=s,t.MutationObserver||(t.MutationObserver=s)}(self),window.CustomElements=window.CustomElements||{flags:{}},function(t){var e=t.flags,n=[],o=function(t){n.push(t)},i=function(){n.forEach(function(e){e(t)})};t.addModule=o,t.initializeModules=i,t.hasNative=Boolean(document.registerElement),t.isIE=/Trident/.test(navigator.userAgent),t.useNative=!e.register&&t.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||window.HTMLImports.useNative)}(window.CustomElements),window.CustomElements.addModule(function(t){function e(t,e){n(t,function(t){return e(t)?!0:void o(t,e)}),o(t,e)}function n(t,e,o){var i=t.firstElementChild;if(!i)for(i=t.firstChild;i&&i.nodeType!==Node.ELEMENT_NODE;)i=i.nextSibling;for(;i;)e(i,o)!==!0&&n(i,e,o),i=i.nextElementSibling;return null}function o(t,n){for(var o=t.shadowRoot;o;)e(o,n),o=o.olderShadowRoot}function i(t,e){r(t,e,[])}function r(t,e,n){if(t=window.wrap(t),!(n.indexOf(t)>=0)){n.push(t);for(var o,i=t.querySelectorAll("link[rel="+s+"]"),a=0,u=i.length;u>a&&(o=i[a]);a++)o.import&&r(o.import,e,n);e(t)}}var s=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";t.forDocumentTree=i,t.forSubtree=e}),window.CustomElements.addModule(function(t){function e(t,e){return n(t,e)||o(t,e)}function n(e,n){return t.upgrade(e,n)?!0:void(n&&s(e))}function o(t,e){b(t,function(t){return n(t,e)?!0:void 0})}function i(t){C.push(t),T||(T=!0,setTimeout(r))}function r(){T=!1;for(var t,e=C,n=0,o=e.length;o>n&&(t=e[n]);n++)t();C=[]}function s(t){x?i(function(){a(t)}):a(t)}function a(t){t.__upgraded__&&!t.__attached&&(t.__attached=!0,t.attachedCallback&&t.attachedCallback())}function u(t){c(t),b(t,function(t){c(t)})}function c(t){x?i(function(){l(t)}):l(t)}function l(t){t.__upgraded__&&t.__attached&&(t.__attached=!1,t.detachedCallback&&t.detachedCallback())}function h(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}}function p(t){if(t.shadowRoot&&!t.shadowRoot.__watched){v.dom&&console.log("watching shadow-root for: ",t.localName);for(var e=t.shadowRoot;e;)g(e),e=e.olderShadowRoot}}function d(t,n){if(v.dom){var o=n[0];if(o&&"childList"===o.type&&o.addedNodes&&o.addedNodes){for(var i=o.addedNodes[0];i&&i!==document&&!i.host;)i=i.parentNode;var r=i&&(i.URL||i._URL||i.host&&i.host.localName)||"";r=r.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",n.length,r||"")}var s=h(t);n.forEach(function(t){"childList"===t.type&&(w(t.addedNodes,function(t){t.localName&&e(t,s)}),w(t.removedNodes,function(t){t.localName&&u(t)}))}),v.dom&&console.groupEnd()}function f(t){for(t=window.wrap(t),t||(t=window.wrap(document));t.parentNode;)t=t.parentNode;var e=t.__observer;e&&(d(t,e.takeRecords()),r())}function g(t){if(!t.__observer){var e=new MutationObserver(d.bind(this,t));e.observe(t,{childList:!0,subtree:!0}),t.__observer=e}}function m(t){t=window.wrap(t),v.dom&&console.group("upgradeDocument: ",t.baseURI.split("/").pop());var n=t===window.wrap(document);e(t,n),g(t),v.dom&&console.groupEnd()}function y(t){A(t,m)}var v=t.flags,b=t.forSubtree,A=t.forDocumentTree,x=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;t.hasPolyfillMutations=x;var T=!1,C=[],w=Array.prototype.forEach.call.bind(Array.prototype.forEach),E=Element.prototype.createShadowRoot;E&&(Element.prototype.createShadowRoot=function(){var t=E.call(this);return window.CustomElements.watchShadow(this),t}),t.watchShadow=p,t.upgradeDocumentTree=y,t.upgradeDocument=m,t.upgradeSubtree=o,t.upgradeAll=e,t.attached=s,t.takeRecords=f}),window.CustomElements.addModule(function(t){function e(e,o){if(!e.__upgraded__&&e.nodeType===Node.ELEMENT_NODE){var i=e.getAttribute("is"),r=t.getRegisteredDefinition(e.localName)||t.getRegisteredDefinition(i);if(r&&(i&&r.tag==e.localName||!i&&!r.extends))return n(e,r,o)}}function n(e,n,i){return s.upgrade&&console.group("upgrade:",e.localName),n.is&&e.setAttribute("is",n.is),o(e,n),e.__upgraded__=!0,r(e),i&&t.attached(e),t.upgradeSubtree(e,i),s.upgrade&&console.groupEnd(),e}function o(t,e){Object.__proto__?t.__proto__=e.prototype:(i(t,e.prototype,e.native),t.__proto__=e.prototype)}function i(t,e,n){for(var o={},i=e;i!==n&&i!==HTMLElement.prototype;){for(var r,s=Object.getOwnPropertyNames(i),a=0;r=s[a];a++)o[r]||(Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r)),o[r]=1);i=Object.getPrototypeOf(i)}}function r(t){t.createdCallback&&t.createdCallback()}var s=t.flags;t.upgrade=e,t.upgradeWithDefinition=n,t.implementPrototype=o}),window.CustomElements.addModule(function(t){function e(e,o){var u=o||{};if(!e)throw new Error("document.registerElement: first argument `name` must not be empty");if(e.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(e)+"'.");if(i(e))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(e)+"'. The type name is invalid.");if(c(e))throw new Error("DuplicateDefinitionError: a type with name '"+String(e)+"' is already registered");return u.prototype||(u.prototype=Object.create(HTMLElement.prototype)),u.__name=e.toLowerCase(),u.lifecycle=u.lifecycle||{},u.ancestry=r(u.extends),s(u),a(u),n(u.prototype),l(u.__name,u),u.ctor=h(u),u.ctor.prototype=u.prototype,u.prototype.constructor=u.ctor,t.ready&&y(document),u.ctor}function n(t){if(!t.setAttribute._polyfilled){var e=t.setAttribute;t.setAttribute=function(t,n){o.call(this,t,n,e)};var n=t.removeAttribute;t.removeAttribute=function(t){o.call(this,t,null,n)},t.setAttribute._polyfilled=!0}}function o(t,e,n){t=t.toLowerCase();var o=this.getAttribute(t);n.apply(this,arguments);var i=this.getAttribute(t);this.attributeChangedCallback&&i!==o&&this.attributeChangedCallback(t,o,i)}function i(t){for(var e=0;e<T.length;e++)if(t===T[e])return!0}function r(t){var e=c(t);return e?r(e.extends).concat([e]):[]}function s(t){for(var e,n=t.extends,o=0;e=t.ancestry[o];o++)n=e.is&&e.tag;t.tag=n||t.__name,n&&(t.is=t.__name)}function a(t){if(!Object.__proto__){var e=HTMLElement.prototype;if(t.is){var n=document.createElement(t.tag);e=Object.getPrototypeOf(n)}for(var o,i=t.prototype,r=!1;i;)i==e&&(r=!0),o=Object.getPrototypeOf(i),o&&(i.__proto__=o),i=o;r||console.warn(t.tag+" prototype not found in prototype chain for "+t.is),t.native=e}}function u(t){return b(E(t.tag),t)}function c(t){return t?C[t.toLowerCase()]:void 0}function l(t,e){C[t]=e}function h(t){return function(){return u(t)}}function p(t,e,n){return t===w?d(e,n):S(t,e)}function d(t,e){t&&(t=t.toLowerCase()),e&&(e=e.toLowerCase());var n=c(e||t);if(n){if(t==n.tag&&e==n.is)return new n.ctor;if(!e&&!n.is)return new n.ctor}var o;return e?(o=d(t),o.setAttribute("is",e),o):(o=E(t),t.indexOf("-")>=0&&A(o,HTMLElement),o)}function f(t,e){var n=t[e];t[e]=function(){var t=n.apply(this,arguments);return v(t),t}}var g,m=t.isIE,y=t.upgradeDocumentTree,v=t.upgradeAll,b=t.upgradeWithDefinition,A=t.implementPrototype,x=t.useNative,T=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],C={},w="http://www.w3.org/1999/xhtml",E=document.createElement.bind(document),S=document.createElementNS.bind(document);g=Object.__proto__||x?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},f(Node.prototype,"cloneNode"),f(document,"importNode"),m&&!function(){var t=document.importNode;document.importNode=function(){var e=t.apply(document,arguments);if(e.nodeType==e.DOCUMENT_FRAGMENT_NODE){var n=document.createDocumentFragment();return n.appendChild(e),n}return e}}(),document.registerElement=e,document.createElement=d,document.createElementNS=p,t.registry=C,t.instanceof=g,t.reservedTagList=T,t.getRegisteredDefinition=c,document.register=document.registerElement}),function(t){function e(){s(window.wrap(document)),window.CustomElements.ready=!0;var t=window.requestAnimationFrame||function(t){setTimeout(t,16)};t(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})}var n=t.useNative,o=t.initializeModules,i=t.isIE;if(n){var r=function(){};t.watchShadow=r,t.upgrade=r,t.upgradeAll=r,t.upgradeDocumentTree=r,t.upgradeSubtree=r,t.takeRecords=r,t.instanceof=function(t,e){return t instanceof e}}else o();var s=t.upgradeDocumentTree,a=t.upgradeDocument;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(t){return t}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(t){t.import&&a(wrap(t.import))}),(!window.CustomEvent||i&&"function"!=typeof window.CustomEvent)&&(window.CustomEvent=function(t,e){e=e||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,Boolean(e.bubbles),Boolean(e.cancelable),e.detail),n.preventDefault=function(){Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})},n},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||t.flags.eager)e();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var u=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(u,e)}else e()}(window.CustomElements),function(){}.call(this),function(){this.Trix={VERSION:"0.9.0",ZERO_WIDTH_SPACE:"\ufeff",NON_BREAKING_SPACE:"\xa0",OBJECT_REPLACEMENT_CHARACTER:"\ufffc",config:{}}}.call(this),function(){Trix.BasicObject=function(){function t(){}var e,n,o;return t.proxyMethod=function(t){var o,i,r,s,a;return r=n(t),o=r.name,s=r.toMethod,a=r.toProperty,i=r.optional,this.prototype[o]=function(){var t,n;return t=null!=s?i?"function"==typeof this[s]?this[s]():void 0:this[s]():null!=a?this[a]:void 0,i?(n=null!=t?t[o]:void 0,null!=n?e.call(n,t,arguments):void 0):(n=t[o],e.call(n,t,arguments))}},n=function(t){var e,n;if(!(n=t.match(o)))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,o=/^(.+?)(\(\))?(\?)?\.(.+?)$/,t}()}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.Object=function(e){function n(){this.id=++o}var o;return t(n,e),o=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,o,i;o=null!=(t=this.contentsForInspection())?t:{},i=[];for(e in o)n=o[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 Trix.UTF16String.box(this)},n.prototype.getCacheKey=function(){return this.id.toString()},n}(Trix.BasicObject)}.call(this),function(){Trix.extend=function(t){var e,n;for(e in t)n=t[e],this[e]=n;return this}}.call(this),function(){var t,e,n=[].slice;Trix.extend({defer:function(t){return setTimeout(t,1)},memoize:function(t){var n;return n=e++,function(){var e;return null==this.memos&&(this.memos={}),null!=(e=this.memos)[n]?e[n]:e[n]=t.apply(this,arguments)}},trace:function(e,o){return function(){var i,r,s,a;return a=o.apply(this,arguments),r=function(){var e,n,o;for(o=[],e=0,n=arguments.length;n>e;e++)i=arguments[e],o.push(t(i));return o}.apply(this,arguments),(s=Trix.Logger).log.apply(s,["methodTraces",e,"("].concat(n.call(r),[") ="],[a])),a}},benchmark:function(t,e){return function(){var n,o;return n=Trix.Logger.get("benchmarks"),n.time(t),o=e.apply(this,arguments),n.timeEnd(t),o}}}),e=0,t=function(t){var e,n;return null!=(e=null!=(n=null!=t&&"function"==typeof t.inspect?t.inspect():void 0)?n:function(){try{return JSON.stringify(t)}catch(e){}}())?e:t}}.call(this),function(){var t,e;Trix.extend({normalizeSpaces:function(t){return t.replace(RegExp(""+Trix.ZERO_WIDTH_SPACE,"g"),"").replace(RegExp(""+Trix.NON_BREAKING_SPACE,"g")," ")},summarizeStringChange:function(t,n){var o,i,r,s;return t=Trix.UTF16String.box(t),n=Trix.UTF16String.box(n),n.length<t.length?(i=e(t,n),s=i[0],o=i[1]):(r=e(n,t),o=r[0],s=r[1]),{added:o,removed:s}}}),e=function(e,n){var o,i,r,s,a;return e.isEqualTo(n)?["",""]:(i=t(e,n),s=i.utf16String.length,r=s?(a=i.offset,i,o=e.codepoints.slice(0,a).concat(e.codepoints.slice(a+s)),t(n,Trix.UTF16String.fromCodepoints(o))):t(n,e),[i.utf16String.toString(),r.utf16String.toString()])},t=function(t,e){var n,o,i;for(n=0,o=t.length,i=e.length;o>n&&t.charAt(n).isEqualTo(e.charAt(n));)n++;for(;o>n+1&&t.charAt(o-1).isEqualTo(e.charAt(i-1));)o--,i--;return{utf16String:t.slice(n,o),offset:n}}}.call(this),function(){Trix.extend({arraysAreEqual:function(t,e){var n,o,i,r;if(null==t&&(t=[]),null==e&&(e=[]),t.length!==e.length)return!1;for(o=n=0,i=t.length;i>n;o=++n)if(r=t[o],r!==e[o])return!1;return!0},objectsAreEqual:function(t,e){var n,o;if(null==t&&(t={}),null==e&&(e={}),Object.keys(t).length!==Object.keys(e).length)return!1;for(n in t)if(o=t[n],o!==e[n])return!1;return!0},summarizeArrayChange:function(t,e){var n,o,i,r,s,a,u,c,l,h,p;for(null==t&&(t=[]),null==e&&(e=[]),n=[],h=[],i=new Set,r=0,u=t.length;u>r;r++)p=t[r],i.add(p);for(o=new Set,s=0,c=e.length;c>s;s++)p=e[s],o.add(p),i.has(p)||n.push(p);for(a=0,l=t.length;l>a;a++)p=t[a],o.has(p)||h.push(p);return{added:n,removed:h}}})}.call(this),function(){var t,e,n,o,i;t=document.documentElement,e=null!=(n=null!=(o=null!=(i=t.matchesSelector)?i:t.webkitMatchesSelector)?o:t.msMatchesSelector)?n:t.mozMatchesSelector,Trix.extend({handleEvent:function(e,n){var o,i,r,s,a,u,c,l,h,p,d,f;return l=null!=n?n:{},u=l.onElement,a=l.matchingSelector,f=l.withCallback,s=l.inPhase,c=l.preventDefault,p=l.times,i=null!=u?u:t,h=a,o=f,d="capturing"===s,r=function(t){var e;return null!=p&&0===--p&&r.destroy(),e=Trix.findClosestElementFromNode(t.target,{matchingSelector:h}),null!=e&&null!=f&&f.call(e,t,e),c?t.preventDefault():void 0},r.destroy=function(){return i.removeEventListener(e,r,d)},i.addEventListener(e,r,d),r},handleEventOnce:function(t,e){return null==e&&(e={}),e.times=1,Trix.handleEvent(t,e)},triggerEvent:function(e,n){var o,i,r,s,a,u,c;return c=null!=n?n:{},u=c.onElement,i=c.bubbles,r=c.cancelable,o=c.attributes,s=null!=u?u:t,i=i!==!1,r=r!==!1,a=document.createEvent("Events"),a.initEvent(e,i,r),null!=o&&Trix.extend.call(a,o),s.dispatchEvent(a)},elementMatchesSelector:function(t,n){return 1===(null!=t?t.nodeType:void 0)?e.call(t,n):void 0},findClosestElementFromNode:function(t,e){var n;for(n=(null!=e?e:{}).matchingSelector;null!=t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.parentNode;if(null==n)return t;for(;t;){if(Trix.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&&Trix.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=Trix.findNodeFromContainerAndOffset(t,e),Trix.findClosestElementFromNode(n)},findChildIndexOfNode:function(t){var e;if(null!=t?t.parentNode:void 0){for(e=0;t=t.previousSibling;)e++;return e}},measureElement:function(t){return{width:t.offsetWidth,height:t.offsetHeight}},walkTree:function(t,e){var n,o,i,r,s;return i=null!=e?e:{},o=i.onlyNodesOfType,r=i.usingFilter,n=i.expandEntityReferences,s=function(){switch(o){case"element":return NodeFilter.SHOW_ELEMENT;case"text":return NodeFilter.SHOW_TEXT;case"comment":return NodeFilter.SHOW_COMMENT;default:return NodeFilter.SHOW_ALL}}(),document.createTreeWalker(t,s,null!=r?r:null,n===!0)},tagName:function(t){var e;return null!=t&&null!=(e=t.tagName)?e.toLowerCase():void 0},makeElement:function(t,e){var n,o,i,r,s,a,u,c,l,h;if(null==e&&(e={}),"object"==typeof t?(e=t,t=e.tagName):e={attributes:e},o=document.createElement(t),null!=e.editable&&(null==e.attributes&&(e.attributes={}),e.attributes.contenteditable=e.editable),e.attributes){a=e.attributes;for(r in a)h=a[r],o.setAttribute(r,h)}if(e.style){u=e.style;for(r in u)h=u[r],o.style[r]=h}if(e.data){c=e.data;for(r in c)h=c[r],o.dataset[r]=h}if(e.className)for(l=e.className.split(" "),i=0,s=l.length;s>i;i++)n=l[i],o.classList.add(n);return e.textContent&&(o.textContent=e.textContent),o},cloneFragment:function(t){var e,n,o,i,r;for(e=document.createDocumentFragment(),r=t.childNodes,n=0,o=r.length;o>n;n++)i=r[n],e.appendChild(i.cloneNode(!0));return e},makeFragment:function(t){var e,n,o;for(null==t&&(t=""),e=document.createElement("div"),e.innerHTML=t,n=document.createDocumentFragment();o=e.firstChild;)n.appendChild(o);return n},nodeIsBlockContainer:function(t){return Trix.nodeIsBlockStartComment(null!=t?t.firstChild:void 0)},nodeIsBlockStartComment:function(t){return Trix.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){return t?Trix.nodeIsTextNode(t)?t.data===Trix.ZERO_WIDTH_SPACE:Trix.nodeIsCursorTarget(t.firstChild):void 0},nodeIsAttachmentElement:function(t){return Trix.elementMatchesSelector(t,Trix.AttachmentView.attachmentSelector)},nodeIsEmptyTextNode:function(t){return Trix.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;Trix.extend({normalizeRange:e=function(e){var n;if(null!=e)return Array.isArray(e)||(e=[e,e]),[t(e[0]),t(null!=(n=e[1])?n:e[0])]},rangeIsCollapsed:function(t){var o,i,r;if(null!=t)return i=e(t),r=i[0],o=i[1],n(r,o)},rangesAreEqual:function(t,o){var i,r,s,a,u,c;if(null!=t&&null!=o)return s=e(t),r=s[0],i=s[1],a=e(o),c=a[0],u=a[1],n(r,c)&&n(i,u)}}),t=function(t){var e,n;return"number"==typeof t?t:(e=t.index,n=t.offset,{index:e,offset:n})},n=function(t,e){return"number"==typeof t?t===e:t.index===e.index&&t.offset===e.offset}}.call(this),function(){var t,e,n,o;t={extendsTagName:"div",css:"%t { display: block; }"},Trix.registerElement=function(e,i){var r,s,a,u,c,l,h;return null==i&&(i={}),e=e.toLowerCase(),c=o(i),u=null!=(h=c.extendsTagName)?h:t.extendsTagName,delete c.extendsTagName,s=c.defaultCSS,delete c.defaultCSS,null!=s&&u===t.extendsTagName?s+="\n"+t.css:s=t.css,n(s,e),a=Object.getPrototypeOf(document.createElement(u)),a.__super__=a,l=Object.create(a,c),r=document.registerElement(e,{prototype:l}),Object.defineProperty(l,"constructor",{value:r}),r},n=function(t,n){var o;return o=e(n),o.textContent=t.replace(/%t/g,n)},e=function(t){var e;return e=document.createElement("style"),e.setAttribute("type","text/css"),e.setAttribute("data-tag-name",t.toLowerCase()),document.head.insertBefore(e,document.head.firstChild),e},o=function(t){var e,n,o;n={};for(e in t)o=t[e],n[e]="function"==typeof o?{value:o}:o;return n}}.call(this),function(){}.call(this),function(){var t,e=function(t,e){function o(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=Trix.arraysAreEqual,Trix.Hash=function(n){function o(t){null==t&&(t={}),this.values=r(t),o.__super__.constructor.apply(this,arguments)}var i,r,s,a,u;return e(o,n),o.fromCommonAttributesOfObjects=function(t){var e,n,o,r,s,a;if(null==t&&(t=[]),!t.length)return new this;for(e=i(t[0]),o=e.getKeys(),a=t.slice(1),n=0,r=a.length;r>n;n++)s=a[n],o=e.getKeysCommonToHash(i(s)),e=e.slice(o);return e},o.box=function(t){return i(t)},o.prototype.add=function(t,e){return this.merge(a(t,e))},o.prototype.remove=function(t){return new Trix.Hash(r(this.values,t))},o.prototype.get=function(t){return this.values[t]},o.prototype.has=function(t){return t in this.values},o.prototype.merge=function(t){return new Trix.Hash(s(this.values,u(t)))},o.prototype.slice=function(t){var e,n,o,i;for(i={},e=0,o=t.length;o>e;e++)n=t[e],this.has(n)&&(i[n]=this.values[n]);return new Trix.Hash(i)},o.prototype.getKeys=function(){return Object.keys(this.values)},o.prototype.getKeysCommonToHash=function(t){var e,n,o,r,s;for(t=i(t),r=this.getKeys(),s=[],e=0,o=r.length;o>e;e++)n=r[e],this.values[n]===t.values[n]&&s.push(n);return s},o.prototype.isEqualTo=function(e){return t(this.toArray(),i(e).toArray())},o.prototype.isEmpty=function(){return 0===this.getKeys().length},o.prototype.toArray=function(){var t,e,n;return(null!=this.array?this.array:this.array=function(){var o;e=[],o=this.values;for(t in o)n=o[t],e.push(t,n);return e}.call(this)).slice(0)},o.prototype.toObject=function(){return r(this.values)},o.prototype.toJSON=function(){return this.toObject()},o.prototype.contentsForInspection=function(){return{values:JSON.stringify(this.values)}},a=function(t,e){var n;return n={},n[t]=e,n},s=function(t,e){var n,o,i;o=r(t);for(n in e)i=e[n],o[n]=i;return o},r=function(t,e){var n,o,i,r,s;for(r={},s=Object.keys(t).sort(),n=0,i=s.length;i>n;n++)o=s[n],o!==e&&(r[o]=t[o]);return r},i=function(t){return t instanceof Trix.Hash?t:new Trix.Hash(t)},u=function(t){return t instanceof Trix.Hash?t.values:t},o}(Trix.Object)}.call(this),function(){Trix.ObjectGroup=function(){function t(t,e){var n,o;this.objects=null!=t?t:[],o=e.depth,n=e.asTree,n&&(this.depth=o,this.objects=this.constructor.groupObjects(this.objects,{asTree:n,depth:this.depth+1}))}return t.groupObjects=function(t,e){var n,o,i,r,s,a,u,c,l;for(null==t&&(t=[]),l=null!=e?e:{},i=l.depth,n=l.asTree,n&&null==i&&(i=0),c=[],s=0,a=t.length;a>s;s++){if(u=t[s],r){if(("function"==typeof u.canBeGrouped?u.canBeGrouped(i):void 0)&&("function"==typeof(o=r[r.length-1]).canBeGroupedWith?o.canBeGroupedWith(u,i):void 0)){r.push(u);continue}c.push(new this(r,{depth:i,asTree:n})),r=null}("function"==typeof u.canBeGrouped?u.canBeGrouped(i):void 0)?r=[u]:c.push(u)}return r&&c.push(new this(r,{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,o,i;for(e=["objectGroup"],i=this.getObjects(),t=0,n=i.length;n>t;t++)o=i[t],e.push(o.getCacheKey());return e.join("/")},t}()}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.ObjectMap=function(e){function n(t){var e,n,o,i,r;for(null==t&&(t=[]),this.objects={},o=0,i=t.length;i>o;o++)r=t[o],n=JSON.stringify(r),null==(e=this.objects)[n]&&(e[n]=r)}return t(n,e),n.prototype.find=function(t){var e;return e=JSON.stringify(t),this.objects[e]},n}(Trix.BasicObject)}.call(this),function(){Trix.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,o;return n=e(t),(o=this.elements[n])?(delete this.elements[n],o):void 0},t.prototype.reset=function(t){var e,n,o;for(null==t&&(t=[]),this.elements={},n=0,o=t.length;o>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 o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty,n=[].slice;Trix.Logger=function(e){function o(t,e,n){this.name=t,this.console=e,null==n&&(n=s(this.name)),n||this.disable()}var i,r,s,a;return t(o,e),r={},o.getLoggers=function(){var t,e,n;n=[];for(e in r)t=r[e],n.push(t);return n},o.get=function(t){return null!=r[t]?r[t]:r[t]=new Trix.Logger(t,console)},o.log=function(){var t,e,o;return e=arguments[0],t=2<=arguments.length?n.call(arguments,1):[],(o=this.get(e)).log.apply(o,t)},o.prototype.enable=function(){return null==this.disabledConsole||this.isEnabled()?void 0:(this.console=this.disabledConsole,this.disabledConsole=null,a(this.name,!0))},o.prototype.disable=function(){return this.isEnabled()?(this.disabledConsole=this.console,this.console=null,a(this.name,!1)):void 0},o.prototype.isEnabled=function(){return null!=this.console},s=function(t){var e,n;return e=i(t),"true"===(null!=(n=window.sessionStorage)?n[e]:void 0)},a=function(t,e){var n,o,r;return n=i(t),e?null!=(o=window.sessionStorage)?o[n]="true":void 0:null!=(r=window.sessionStorage)?delete r[n]:void 0},i=function(t){return"trix/loggers/"+t+"/enabled"},o.proxyMethod("console?.log"),o.proxyMethod("console?.warn"),o.proxyMethod("console?.error"),o.proxyMethod("console?.group"),o.proxyMethod("console?.groupEnd"),o.proxyMethod("console?.groupCollapsed"),o.proxyMethod("console?.trace"),o.proxyMethod("console?.time"),o.proxyMethod("console?.timeEnd"),o}(Trix.BasicObject)}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.Operation=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n.prototype.isPerforming=function(){return this.performing===!0},n.prototype.hasPerformed=function(){return this.performed===!0},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(o,i){return t.succeeded=o,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}(Trix.BasicObject)}.call(this),function(){var t,e,n,o,i,r=function(t,e){function n(){this.constructor=t}for(var o in e)s.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;Trix.UTF16String=function(t){function e(t,e){this.ucs2String=t,this.codepoints=e,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}return r(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,o(t))},e.fromCodepoints=function(t){return new this(i(t),t)},e.prototype.offsetToUCS2Offset=function(t){return i(this.codepoints.slice(0,Math.max(0,t))).length},e.prototype.offsetFromUCS2Offset=function(t){return o(this.ucs2String.slice(0,Math.max(0,t))).length
21
+ },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}(Trix.BasicObject),t=1===("function"==typeof Array.from?Array.from("\ud83d\udc7c").length:void 0),e=null!=("function"==typeof" ".codePointAt?" ".codePointAt(0):void 0),n=" \ud83d\udc7c"===("function"==typeof String.fromCodePoint?String.fromCodePoint(32,128124):void 0),o=t&&e?function(t){return Array.from(t).map(function(t){return t.codePointAt(0)})}:function(t){var e,n,o,i,r;for(i=[],e=0,o=t.length;o>e;)r=t.charCodeAt(e++),r>=55296&&56319>=r&&o>e&&(n=t.charCodeAt(e++),56320===(64512&n)?r=((1023&r)<<10)+(1023&n)+65536:e--),i.push(r);return i},i=n?function(t){return String.fromCodePoint.apply(String,t)}:function(t){var e,n,o;return e=function(){var e,i,r;for(r=[],e=0,i=t.length;i>e;e++)o=t[e],n="",o>65535&&(o-=65536,n+=String.fromCharCode(o>>>10&1023|55296),o=56320|1023&o),r.push(n+String.fromCharCode(o));return r}(),e.join("")}}.call(this),function(){}.call(this),function(){}.call(this),function(){Trix.config.lang={bold:"Bold",bullets:"Bullets","byte":"Byte",bytes:"Bytes",captionPlaceholder:"Type a caption here\u2026",code:"Code",editCaption:"Edit caption",indent:"Increase Level",italic:"Italic",link:"Link",numbers:"Numbers",outdent:"Decrease Level",quote:"Quote",redo:"Redo",remove:"Remove",strike:"Strikethrough",undo:"Undo",unlink:"Unlink",urlPlaceholder:"Enter a URL\u2026",GB:"GB",KB:"KB",MB:"MB",PB:"PB",TB:"TB"}}.call(this),function(){Trix.config.css={classNames:{attachment:{container:"attachment",typePrefix:"attachment-",caption:"caption",captionEdited:"caption-edited",captionEditor:"caption-editor",editingCaption:"caption-editing",progressBar:"progress",removeButton:"remove",size:"size"}}}}.call(this),function(){var t;Trix.config.blockAttributes=t={"default":{tagName:"div",parse:!1},quote:{tagName:"blockquote",nestable:!0},code:{tagName:"pre",text:{plaintext:!0}},bulletList:{tagName:"ul",parse:!1},bullet:{tagName:"li",listAttribute:"bulletList",test:function(e){return Trix.tagName(e.parentNode)===t[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",test:function(e){return Trix.tagName(e.parentNode)===t[this.listAttribute].tagName}}}}.call(this),function(){var t,e;t=Trix.config.lang,e=[t.bytes,t.KB,t.MB,t.GB,t.TB,t.PB],Trix.config.fileSize={prefix:"IEC",precision:2,formatter:function(n){var o,i,r,s,a;switch(n){case 0:return"0 "+t.bytes;case 1:return"1 "+t.byte;default:return o=function(){switch(this.prefix){case"SI":return 1e3;case"IEC":return 1024}}.call(this),i=Math.floor(Math.log(n)/Math.log(o)),r=n/Math.pow(o,i),s=r.toFixed(this.precision),a=s.replace(/0*$/,"").replace(/\.$/,""),a+" "+e[i]}}}}.call(this),function(){Trix.config.textAttributes={bold:{tagName:"strong",inheritable:!0,parser:function(t){var e;return e=window.getComputedStyle(t),"bold"===e.fontWeight||e.fontWeight>=700}},italic:{tagName:"em",inheritable:!0,parser:function(t){var e;return e=window.getComputedStyle(t),"italic"===e.fontStyle}},href:{groupTagName:"a",parser:function(t){var e,n,o;return e=Trix.AttachmentView.attachmentSelector,o="a:not("+e+")",(n=Trix.findClosestElementFromNode(t,{matchingSelector:o}))?n.getAttribute("href"):void 0}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}}}.call(this),function(){var t,e,n,o,i;i="[data-trix-serialize=false]",o=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable"],e="data-trix-serialized-attributes",n="["+e+"]",t=new RegExp("<!--block-->","g"),Trix.extend({serializers:{"application/json":function(t){var e;if(t instanceof Trix.Document)e=t;else{if(!(t instanceof HTMLElement))throw new Error("unserializable object");e=Trix.Document.fromHTML(t.innerHTML)}return e.toSerializableDocument().toJSONString()},"text/html":function(r){var s,a,u,c,l,h,p,d,f,g,m,y,v,b,A,x,T;if(r instanceof Trix.Document)c=Trix.DocumentView.render(r);else{if(!(r instanceof HTMLElement))throw new Error("unserializable object");c=r.cloneNode(!0)}for(b=c.querySelectorAll(i),l=0,f=b.length;f>l;l++)u=b[l],u.parentNode.removeChild(u);for(h=0,g=o.length;g>h;h++)for(s=o[h],A=c.querySelectorAll("["+s+"]"),p=0,m=A.length;m>p;p++)u=A[p],u.removeAttribute(s);for(x=c.querySelectorAll(n),d=0,y=x.length;y>d;d++){u=x[d];try{a=JSON.parse(u.getAttribute(e)),u.removeAttribute(e);for(v in a)T=a[v],u.setAttribute(v,T)}catch(C){}}return c.innerHTML.replace(t,"")}},deserializers:{"application/json":function(t){return Trix.Document.fromJSONString(t)},"text/html":function(t){return Trix.Document.fromHTML(t)}},serializeToContentType:function(t,e){var n;if(n=Trix.serializers[e])return n(t);throw new Error("unknown content type: "+e)},deserializeFromContentType:function(t,e){var n;if(n=Trix.deserializers[e])return n(t);throw new Error("unknown content type: "+e)}})}.call(this),function(){var t,e;e=Trix.makeFragment,t=Trix.config.lang,Trix.config.toolbar={content:e('<div class="button_groups">\n <span class="button_group text_tools">\n <button type="button" class="bold" data-attribute="bold" data-key="b" title="'+t.bold+'">'+t.bold+'</button>\n <button type="button" class="italic" data-attribute="italic" data-key="i" title="'+t.italic+'">'+t.italic+'</button>\n <button type="button" class="strike" data-attribute="strike" title="'+t.strike+'">'+t.strike+'</button>\n <button type="button" class="link" data-attribute="href" data-action="link" data-key="k" title="'+t.link+'">'+t.link+'</button>\n </span>\n\n <span class="button_group block_tools">\n <button type="button" class="quote" data-attribute="quote" title="'+t.quote+'">'+t.quote+'</button>\n <button type="button" class="code" data-attribute="code" title="'+t.code+'">'+t.code+'</button>\n <button type="button" class="list bullets" data-attribute="bullet" title="'+t.bullets+'">'+t.bullets+'</button>\n <button type="button" class="list numbers" data-attribute="number" title="'+t.numbers+'">'+t.numbers+'</button>\n <button type="button" class="block-level decrease" data-action="decreaseBlockLevel" title="'+t.outdent+'">'+t.outdent+'</button>\n <button type="button" class="block-level increase" data-action="increaseBlockLevel" title="'+t.indent+'">'+t.indent+'</button>\n </span>\n\n <span class="button_group history_tools">\n <button type="button" class="undo" data-action="undo" data-key="z" title="'+t.undo+'">'+t.undo+'</button>\n <button type="button" class="redo" data-action="redo" data-key="shift+z" title="'+t.redo+'">'+t.redo+'</button>\n </span>\n</div>\n\n<div class="dialogs">\n <div class="dialog link_dialog" data-attribute="href" data-dialog="href">\n <div class="link_url_fields">\n <input type="url" required name="href" placeholder="'+t.urlPlaceholder+'">\n <div class="button_group">\n <input type="button" value="'+t.link+'" data-method="setAttribute">\n <input type="button" value="'+t.unlink+'" data-method="removeAttribute">\n </div>\n </div>\n </div>\n</div>')}}.call(this),function(){Trix.config.undoInterval=5e3}.call(this),function(){}.call(this),function(){var t;t=Trix.cloneFragment,Trix.registerElement("trix-toolbar",{defaultCSS:"%t {\n white-space: collapse;\n}\n\n%t .dialog {\n display: none;\n}\n\n%t .dialog.active {\n display: block;\n}\n\n%t .dialog input.validate:invalid {\n background-color: #ffdddd;\n}\n\n%t[native] {\n display: none;\n}",createdCallback:function(){return""===this.innerHTML?this.appendChild(t(Trix.config.toolbar.content)):void 0}})}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,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};Trix.ObjectView=function(e){function o(t,e){this.object=t,this.options=null!=e?e:{},this.childViews=[],this.rootView=this}return t(o,e),o.prototype.getNodes=function(){var t,e,n,o,i;for(null==this.nodes&&(this.nodes=this.createNodes()),o=this.nodes,i=[],t=0,e=o.length;e>t;t++)n=o[t],i.push(n.cloneNode(!0));return i},o.prototype.invalidate=function(){var t;return this.nodes=null,null!=(t=this.parentView)?t.invalidate():void 0},o.prototype.invalidateViewForObject=function(t){var e;return null!=(e=this.findViewForObject(t))?e.invalidate():void 0},o.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},o.prototype.createChildView=function(t,e,n){var o;return null==n&&(n={}),e instanceof Trix.ObjectGroup&&(n.viewClass=t,t=Trix.ObjectGroupView),o=new t(e,n),this.recordChildView(o)},o.prototype.recordChildView=function(t){return t.parentView=this,t.rootView=this.rootView,this.childViews.push(t),t},o.prototype.getAllChildViews=function(){var t,e,n,o,i;for(i=[],o=this.childViews,e=0,n=o.length;n>e;e++)t=o[e],i.push(t),i=i.concat(t.getAllChildViews());return i},o.prototype.findElement=function(){return this.findElementForObject(this.object)},o.prototype.findElementForObject=function(t){var e;return(e=null!=t?t.id:void 0)?this.rootView.element.querySelector("[data-trix-id='"+e+"']"):void 0},o.prototype.findViewForObject=function(t){var e,n,o,i;for(o=this.getAllChildViews(),e=0,n=o.length;n>e;e++)if(i=o[e],i.object===t)return i},o.prototype.getViewCache=function(){return this.rootView!==this?this.rootView.getViewCache():this.isViewCachingEnabled()?null!=this.viewCache?this.viewCache:this.viewCache={}:void 0},o.prototype.isViewCachingEnabled=function(){return this.shouldCacheViews!==!1},o.prototype.enableViewCaching=function(){return this.shouldCacheViews=!0},o.prototype.disableViewCaching=function(){return this.shouldCacheViews=!1},o.prototype.getCachedViewForObject=function(t){var e;return null!=(e=this.getViewCache())?e[t.getCacheKey()]:void 0},o.prototype.cacheViewForObject=function(t,e){var n;return null!=(n=this.getViewCache())?n[e.getCacheKey()]=t:void 0},o.prototype.garbageCollectCachedViews=function(){var t,e,o,i,r,s;if(t=this.getViewCache()){s=this.getAllChildViews().concat(this),o=function(){var t,e,n;for(n=[],t=0,e=s.length;e>t;t++)r=s[t],n.push(r.object.getCacheKey());return n}(),i=[];for(e in t)n.call(o,e)<0&&i.push(delete t[e]);return i}},o}(Trix.BasicObject)}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.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,o;if(!this.childViews.length)for(o=this.objectGroup.getObjects(),t=0,e=o.length;e>t;t++)n=o[t],this.findOrCreateCachedChildView(this.viewClass,n,this.options);return this.childViews},n.prototype.createNodes=function(){var t,e,n,o,i,r,s,a,u;for(t=this.createContainerElement(),s=this.getChildViews(),e=0,o=s.length;o>e;e++)for(u=s[e],a=u.getNodes(),n=0,i=a.length;i>n;n++)r=a[n],t.appendChild(r);return[t]},n.prototype.createContainerElement=function(t){return null==t&&(t=this.objectGroup.getDepth()),this.getChildViews()[0].createContainerElement(t)},n}(Trix.ObjectView)}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.Controller=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return t(n,e),n}(Trix.BasicObject)}.call(this),function(){var t,e,n,o,i,r=function(t,e){return function(){return t.apply(e,arguments)}},s=function(t,e){function n(){this.constructor=t}for(var o in e)a.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty,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=Trix.defer,e=Trix.findClosestElementFromNode,n=Trix.nodeIsEmptyTextNode,o=Trix.normalizeSpaces,i=Trix.summarizeStringChange,Trix.MutationObserver=function(t){function a(t){this.element=t,this.didMutate=r(this.didMutate,this),this.observer=new window.MutationObserver(this.didMutate),this.start()}var c,l;return s(a,t),c="[data-trix-mutable]",l={attributes:!0,childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0},a.prototype.start=function(){return this.reset(),this.observer.observe(this.element,l)},a.prototype.stop=function(){return this.observer.disconnect()},a.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},a.prototype.reset=function(){return this.mutations=[]},a.prototype.findSignificantMutations=function(t){var e,n,o,i;for(i=[],e=0,n=t.length;n>e;e++)o=t[e],this.mutationIsSignificant(o)&&i.push(o);return i},a.prototype.mutationIsSignificant=function(t){var e,n,o,i;for(i=this.nodesModifiedByMutation(t),e=0,n=i.length;n>e;e++)if(o=i[e],this.nodeIsSignificant(o))return!0;return!1},a.prototype.nodeIsSignificant=function(t){return t!==this.element&&!this.nodeIsMutable(t)&&!n(t)},a.prototype.nodeIsMutable=function(t){return e(t,{matchingSelector:c})},a.prototype.nodesModifiedByMutation=function(t){var e;switch(e=[],t.type){case"attributes":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},a.prototype.getMutationSummary=function(){return this.getTextMutationSummary()},a.prototype.getTextMutationSummary=function(){var t,e,n,o,i,r,s,a,c,l,h;for(a=this.getTextChangesFromCharacterData(),n=a.additions,i=a.deletions,h=this.getTextChangesFromTextNodes(),c=h.additions,r=0,s=c.length;s>r;r++)e=c[r],u.call(n,e)<0&&n.push(e);return i.push.apply(i,h.deletions),l={},(t=n.join(""))&&(l.textAdded=t),(o=i.join(""))&&(l.textDeleted=o),l},a.prototype.getMutationsByType=function(t){var e,n,o,i,r;for(i=this.mutations,r=[],e=0,n=i.length;n>e;e++)o=i[e],o.type===t&&r.push(o);return r},a.prototype.getTextChangesFromTextNodes=function(){var t,e,n,o,i,r,s,a,u,c,l,h,p,d;for(c=[],l=[],h=this.getMutationsByType("childList"),t=0,i=h.length;i>t;t++){for(a=h[t],p=a.removedNodes,n=0,r=p.length;r>n;n++)u=p[n],u.nodeType===Node.TEXT_NODE&&l.push(u);for(d=a.addedNodes,o=0,s=d.length;s>o;o++)u=d[o],u.nodeType===Node.TEXT_NODE&&c.push(u)}return{additions:function(){var t,n,o,i;for(i=[],e=t=0,n=c.length;n>t;e=++t)u=c[e],u.data!==(null!=(o=l[e])?o.data:void 0)&&i.push(u.data);return i}(),deletions:function(){var t,n,o,i;for(i=[],e=t=0,n=l.length;n>t;e=++t)u=l[e],u.data!==(null!=(o=c[e])?o.data:void 0)&&i.push(u.data);return i}()}},a.prototype.getTextChangesFromCharacterData=function(){var t,e,n,r,s,a,u,c;return e=this.getMutationsByType("characterData"),e.length&&(c=e[0],n=e[e.length-1],s=o(c.oldValue),r=o(n.target.data),a=i(s,r),t=a.added,u=a.removed),{additions:t?[t]:[],deletions:u?[u]:[]}},a}(Trix.BasicObject)}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.FileVerificationOperation=function(e){function n(t){this.file=t}return t(n,e),n.prototype.perform=function(t){var e;return e=new FileReader,e.onerror=function(){return t(!1)},e.onload=function(n){return function(){e.onerror=null;try{e.abort()}catch(o){}return t(!0,n.file)}}(this),e.readAsArrayBuffer(this.file)},n}(Trix.Operation)}.call(this),function(){var t,e,n,o,i,r,s,a,u,c,l,h,p,d,f,g=function(t,e){function n(){this.constructor=t}for(var o in e)m.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},m={}.hasOwnProperty,y=[].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=Trix.handleEvent,o=Trix.findClosestElementFromNode,i=Trix.findElementFromContainerAndOffset,e=Trix.defer,h=Trix.makeElement,s=Trix.innerElementIsActive,d=Trix.summarizeStringChange,a=Trix.Logger.get("input"),Trix.InputController=function(e){function o(t){var e;this.element=t,this.resetInputSummary(),this.mutationObserver=new Trix.MutationObserver(this.element),this.mutationObserver.delegate=this;for(e in this.events)r(e,{onElement:this.element,withCallback:this.handlerFor(e),inPhase:"capturing"})}var i;return g(o,e),i=0,o.keyNames={8:"backspace",9:"tab",13:"return",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},o.prototype.handlerFor=function(t){return function(e){return function(n){return e.handleInput(function(){return s(this.element)?void 0:(this.eventName=t,a.group(t),this.events[t].call(this,n),a.groupEnd())})}}(this)},o.prototype.setInputSummary=function(t){var e,n;null==t&&(t={}),this.inputSummary.eventName=this.eventName;for(e in t)n=t[e],this.inputSummary[e]=n;return this.inputSummary},o.prototype.resetInputSummary=function(){return this.inputSummary={}},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.elementDidMutate=function(t){return this.handleInput(function(){var e;return a.group("Mutation"),a.log("mutationSummary =",JSON.stringify(t)),a.log("inputSummary =",JSON.stringify(this.inputSummary)),this.mutationIsExpected(t)||(a.log("mutation is unexpected, replacing HTML"),null!=(e=this.responder)&&e.replaceHTML(this.element.innerHTML)),this.resetInputSummary(),this.requestRender(),Trix.selectionChangeObserver.reset(),a.groupEnd()})},o.prototype.mutationIsExpected=function(t){var e,n;return this.inputSummary?null!=this.inputSummary.preferDocument?this.inputSummary.preferDocument:(e=t.textAdded!==this.inputSummary.textAdded,n=null!=t.textDeleted&&!this.inputSummary.didDelete,!(e||n)):void 0},o.prototype.attachFiles=function(t){var e,n;return n=function(){var n,o,i;for(i=[],n=0,o=t.length;o>n;n++)e=t[n],i.push(new Trix.FileVerificationOperation(e));return i}(),Promise.all(n).then(function(t){return function(n){return t.handleInput(function(){var t,o,i,r;for(null!=(i=this.delegate)&&i.inputControllerWillAttachFiles(),t=0,o=n.length;o>t;t++)e=n[t],null!=(r=this.responder)&&r.insertFile(e);return this.requestRender()})}}(this))},o.prototype.events={keydown:function(t){var e,n,o,i,r,s,a,c,l,h;if(this.inputSummary.composing||this.resetInputSummary(),r=this.constructor.keyNames[t.keyCode]){for(n=this.keys,l=["ctrl","alt","shift","meta"],o=0,a=l.length;a>o;o++)if(c=l[o],t[c+"Key"]&&("ctrl"===c&&(c="control"),n=this.keys[c],n[r])){i=c;break}null!=n[r]&&(this.setInputSummary({keyName:r,keyModifier:i}),Trix.selectionChangeObserver.reset(),n[r].call(this,t))}return u(t)&&(e=String.fromCharCode(t.keyCode).toLowerCase())&&(s=function(){var e,n,o,i;for(o=["alt","shift"],i=[],e=0,n=o.length;n>e;e++)c=o[e],t[c+"Key"]&&i.push(c);return i}(),s.push(e),null!=(h=this.delegate)?h.inputControllerDidReceiveKeyboardCommand(s):void 0)?t.preventDefault():void 0},keypress:function(t){var e,n,o;if(null==this.inputSummary.eventName&&(!t.metaKey&&!t.ctrlKey||t.altKey)&&!l(t)&&!c(t))return null===t.which?e=String.fromCharCode(t.keyCode):0!==t.which&&0!==t.charCode&&(e=String.fromCharCode(t.charCode)),null!=e?(null!=(n=this.delegate)&&n.inputControllerWillPerformTyping(),null!=(o=this.responder)&&o.insertString(e),this.setInputSummary({textAdded:e,didDelete:this.selectionIsExpanded()})):void 0},dragenter:function(t){return t.preventDefault()},dragstart:function(t){var e,n,o;return o=t.target,this.serializeSelectionToDataTransfer(t.dataTransfer),this.draggedRange=null!=(e=this.responder)?e.getSelectedRange():void 0,null!=(n=this.delegate)&&"function"==typeof n.inputControllerDidStartDrag?n.inputControllerDidStartDrag():void 0},dragover:function(t){var e,n,o;return(this.draggedRange||this.canAcceptDataTransfer(t.dataTransfer))&&(t.preventDefault(),e=[t.clientX,t.clientY],e.toString()!==(null!=(n=this.draggingPoint)?n.toString():void 0))?(this.draggingPoint=e,null!=(o=this.delegate)&&"function"==typeof o.inputControllerDidReceiveDragOverPoint?o.inputControllerDidReceiveDragOverPoint(this.draggingPoint):void 0):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,o,i,r,s,a,u,c;return t.preventDefault(),i=[t.clientX,t.clientY],null!=(r=this.responder)&&r.setLocationRangeFromPoint(i),(o=null!=(s=t.dataTransfer)?s.files:void 0)?this.attachFiles(o):this.draggedRange?(null!=(a=this.delegate)&&a.inputControllerWillMoveText(),null!=(u=this.responder)&&u.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()):(n=t.dataTransfer.getData("application/x-trix-document"))&&(e=Trix.Document.fromJSONString(n),null!=(c=this.responder)&&c.insertDocument(e),this.requestRender()),this.draggedRange=null,this.draggingPoint=null},cut:function(t){var e;return this.serializeSelectionToDataTransfer(t.clipboardData)&&t.preventDefault(),null!=(e=this.delegate)&&e.inputControllerWillCutText(),this.deleteInDirection("backward"),t.defaultPrevented?this.requestRender():void 0},copy:function(t){return this.serializeSelectionToDataTransfer(t.clipboardData)?t.preventDefault():void 0},paste:function(t){var e,o,r,s,a,u,c,l,h,d,f,g,m,v,b,A,x,T;return s=null!=(u=t.clipboardData)?u:t.testClipboardData,null!=s?(a={paste:s},p(t)?void this.getPastedHTMLUsingHiddenElement(function(t){return function(e){var n,o,i;return a.html=e,null!=(n=t.delegate)&&n.inputControllerWillPasteText(a),null!=(o=t.responder)&&o.insertHTML(e),t.requestRender(),null!=(i=t.delegate)?i.inputControllerDidPaste(a):void 0}}(this)):((r=s.getData("text/html"))?(a.html=r,null!=(c=this.delegate)&&c.inputControllerWillPasteText(a),null!=(d=this.responder)&&d.insertHTML(r),this.requestRender(),null!=(f=this.delegate)&&f.inputControllerDidPaste(a)):(T=s.getData("text/plain"))?(a.string=T,this.setInputSummary({textAdded:T,didDelete:this.selectionIsExpanded()}),null!=(g=this.delegate)&&g.inputControllerWillPasteText(a),null!=(m=this.responder)&&m.insertString(T),this.requestRender(),null!=(v=this.delegate)&&v.inputControllerDidPaste(a)):y.call(s.types,"Files")>=0&&(o=null!=(b=s.items)&&null!=(A=b[0])&&"function"==typeof A.getAsFile?A.getAsFile():void 0)&&(!o.name&&(e=n(o))&&(o.name="pasted-file-"+ ++i+"."+e),a.file=o,null!=(x=this.delegate)&&x.inputControllerWillAttachFiles(),null!=(l=this.responder)&&l.insertFile(o),this.requestRender(),null!=(h=this.delegate)&&h.inputControllerDidPaste(a)),t.preventDefault())):void 0},compositionstart:function(t){return this.mutationObserver.stop(),this.setInputSummary({composing:!0,compositionStart:t.data})},compositionupdate:function(t){return this.setInputSummary({composing:!0,compositionUpdate:t.data})},compositionend:function(t){var e,n,o,i,r,s;return this.mutationObserver.start(),n=t.data,this.setInputSummary({composing:!0,compositionEnd:n}),null!=n&&n!==this.inputSummary.compositionStart?(null!=(o=this.delegate)&&o.inputControllerWillPerformTyping(),null!=(i=this.responder)&&i.insertString(n),r=d(this.inputSummary.compositionStart,n),e=r.added,s=r.removed,this.setInputSummary({textAdded:e,didDelete:Boolean(s)})):void 0},input:function(t){return t.stopPropagation()}},o.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.canIncreaseBlockAttributeLevel():void 0)?(null!=(n=this.responder)&&n.increaseBlockAttributeLevel(),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(){var t,e;return null!=(t=this.delegate)&&t.inputControllerWillPerformTyping(),null!=(e=this.responder)?e.insertString("\n"):void 0},tab:function(t){var e,n;return(null!=(e=this.responder)?e.canDecreaseBlockAttributeLevel():void 0)?(null!=(n=this.responder)&&n.decreaseBlockAttributeLevel(),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}}},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.prototype.deleteInDirection=function(t,e){var n;return(null!=(n=this.responder)?n.deleteInDirection(t):void 0)===!1?null!=e?e.preventDefault():void 0:this.setInputSummary({didDelete:!0})},o.prototype.serializeSelectionToDataTransfer=function(e){var n,o;if(t(e))return n=null!=(o=this.responder)?o.getSelectedDocument().toSerializableDocument():void 0,e.setData("application/x-trix-document",JSON.stringify(n)),e.setData("text/html",Trix.DocumentView.render(n).innerHTML),e.setData("text/plain",n.toString().replace(/\n$/,"")),!0},o.prototype.canAcceptDataTransfer=function(t){var e,n,o,i,r,s;for(s={},i=null!=(o=null!=t?t.types:void 0)?o:[],e=0,n=i.length;n>e;e++)r=i[e],s[r]=!0;return s.Files||s["application/x-trix-document"]||s["text/html"]||s["text/plain"]},o.prototype.getPastedHTMLUsingHiddenElement=function(t){var e,n,o,i;return o=null!=(n=this.responder)?n.getSelectedRange():void 0,i={position:"absolute",left:window.pageXOffset+"px",top:window.pageYOffset+"px",opacity:0},e=h({style:i,tagName:"div",editable:!0}),document.body.appendChild(e),e.focus(),requestAnimationFrame(function(n){return function(){var i,r;return i=e.innerHTML,document.body.removeChild(e),null!=(r=n.responder)&&r.setSelectedRange(o),t(i)}}(this))},o.proxyMethod("responder?.expandSelectionInDirection"),o.proxyMethod("responder?.selectionIsInCursorTarget"),o.proxyMethod("responder?.selectionIsExpanded"),o}(Trix.BasicObject),n=function(t){var e,n;return null!=(e=t.type)&&null!=(n=e.match(/\/(\w+)$/))?n[1]:void 0},l=function(t){return t.metaKey&&t.altKey&&!t.shiftKey&&94===t.keyCode},c=function(t){return t.metaKey&&t.altKey&&t.shiftKey&&9674===t.keyCode},u=function(t){return/Mac|^iP/.test(navigator.platform)?t.metaKey:t.ctrlKey},p=function(t){var e,n;return(n=null!=(e=t.clipboardData)?e.types:void 0)?y.call(n,"text/html")<0&&(y.call(n,"com.apple.webarchive")>=0||y.call(n,"com.apple.flat-rtfd")>=0):void 0},f={"application/x-trix-feature-detection":"test"},t=function(t){var e,n;if(null!=(null!=t?t.setData:void 0)){for(e in f)if(n=f[e],t.setData(e,n),t.getData(e)!==n)return;return!0}}}.call(this),function(){var t,e,n,o,i,r,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function n(){this.constructor=t}for(var o in e)u.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;e=Trix.handleEvent,i=Trix.makeElement,r=Trix.tagName,n=Trix.InputController.keyNames,o=Trix.config.lang,t=Trix.config.css.classNames,Trix.AttachmentEditorController=function(u){function c(t,e,n){this.attachmentPiece=t,this.element=e,this.container=n,this.uninstall=s(this.uninstall,this),this.didKeyDownCaption=s(this.didKeyDownCaption,this),this.didChangeCaption=s(this.didChangeCaption,this),this.didClickCaption=s(this.didClickCaption,this),this.didClickRemoveButton=s(this.didClickRemoveButton,this),this.attachment=this.attachmentPiece.attachment,"a"===r(this.element)&&(this.element=this.element.firstChild),this.install()}var l;return a(c,u),l=function(t){return function(){var e;return e=t.apply(this,arguments),e["do"](),null==this.undos&&(this.undos=[]),this.undos.push(e.undo)}},c.prototype.install=function(){return this.makeElementMutable(),this.attachment.isPreviewable()&&this.makeCaptionEditable(),this.addRemoveButton()},c.prototype.makeElementMutable=l(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)}}),c.prototype.makeCaptionEditable=l(function(){var t,n;return t=this.element.querySelector("figcaption"),n=null,{"do":function(o){return function(){return n=e("click",{onElement:t,withCallback:o.didClickCaption,inPhase:"capturing"})}}(this),undo:function(){return function(){return n.destroy()}}(this)}}),c.prototype.addRemoveButton=l(function(){var n;return n=i({tagName:"a",textContent:o.remove,className:t.attachment.removeButton,attributes:{href:"#",title:o.remove}}),e("click",{onElement:n,withCallback:this.didClickRemoveButton}),{"do":function(t){return function(){return t.element.appendChild(n)}}(this),undo:function(t){return function(){return t.element.removeChild(n)}}(this)}}),c.prototype.editCaption=l(function(){var n,r,s,a,u;return a=i({tagName:"textarea",className:t.attachment.captionEditor,attributes:{placeholder:o.captionPlaceholder}}),a.value=this.attachmentPiece.getCaption(),u=a.cloneNode(),u.classList.add("trix-autoresize-clone"),n=function(){return u.value=a.value,a.style.height=u.scrollHeight+"px"},e("input",{onElement:a,withCallback:n}),e("keydown",{onElement:a,withCallback:this.didKeyDownCaption}),e("change",{onElement:a,withCallback:this.didChangeCaption}),e("blur",{onElement:a,withCallback:this.uninstall}),s=this.element.querySelector("figcaption"),r=s.cloneNode(),{"do":function(){return s.style.display="none",r.appendChild(a),r.appendChild(u),r.classList.add(t.attachment.editingCaption),s.parentElement.insertBefore(r,s),n(),a.focus()},undo:function(){return r.parentNode.removeChild(r),s.style.display=null}}}),c.prototype.didClickRemoveButton=function(t){var e;return t.preventDefault(),t.stopPropagation(),null!=(e=this.delegate)?e.attachmentEditorDidRequestRemovalOfAttachment(this.attachment):void 0},c.prototype.didClickCaption=function(t){return t.preventDefault(),this.editCaption()},c.prototype.didChangeCaption=function(t){var e,n,o;return e=t.target.value.replace(/\s/g," ").trim(),e?null!=(n=this.delegate)&&"function"==typeof n.attachmentEditorDidRequestUpdatingAttributesForAttachment?n.attachmentEditorDidRequestUpdatingAttributesForAttachment({caption:e},this.attachment):void 0:null!=(o=this.delegate)&&"function"==typeof o.attachmentEditorDidRequestRemovingAttributeForAttachment?o.attachmentEditorDidRequestRemovingAttributeForAttachment("caption",this.attachment):void 0},c.prototype.didKeyDownCaption=function(t){var e;return"return"===n[t.keyCode]?(t.preventDefault(),this.didChangeCaption(t),null!=(e=this.delegate)&&"function"==typeof e.attachmentEditorDidRequestDeselectingAttachment?e.attachmentEditorDidRequestDeselectingAttachment(this.attachment):void 0):void 0
22
+ },c.prototype.uninstall=function(){for(var t,e;e=this.undos.pop();)e();return null!=(t=this.delegate)?t.didUninstallAttachmentEditor(this):void 0},c}(Trix.BasicObject)}.call(this),function(){var t,e,n,o=function(t,e){function n(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;n=Trix.makeElement,t=Trix.config.css.classNames,Trix.AttachmentView=function(i){function r(){r.__super__.constructor.apply(this,arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}return o(r,i),r.attachmentSelector="[data-trix-attachment]",r.prototype.createContentNodes=function(){return[]},r.prototype.createNodes=function(){var e,o,i,r,s,a,u,c,l,h,p;if(r=n({tagName:"figure",className:this.getClassName()}),this.attachment.hasContent())r.innerHTML=this.attachment.getContent();else for(h=this.createContentNodes(),a=0,c=h.length;c>a;a++)l=h[a],r.appendChild(l);r.appendChild(this.createCaptionElement()),o={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:this.attachment.id},e=this.attachmentPiece.getAttributesForAttachment(),e.isEmpty()||(o.trixAttributes=JSON.stringify(e)),this.attachment.isPending()&&(this.progressElement=n({tagName:"progress",attributes:{"class":t.attachment.progressBar,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:this.attachment.getCacheKey("progressElement")}}),r.appendChild(this.progressElement),o.trixSerialize=!1),(s=this.getHref())?(i=n("a",{href:s}),i.appendChild(r)):i=r;for(u in o)p=o[u],i.dataset[u]=p;return i.setAttribute("contenteditable",!1),[this.createCursorTarget(),i,this.createCursorTarget()]},r.prototype.createCaptionElement=function(){var e,o,i,r,s;return o=n({tagName:"figcaption",className:t.attachment.caption}),(e=this.attachmentPiece.getCaption())?(o.classList.add(t.attachment.captionEdited),o.textContent=e):(i=this.attachment.getFilename())&&(o.textContent=i,(r=this.attachment.getFormattedFilesize())&&(o.appendChild(document.createTextNode(" ")),s=n({tagName:"span",className:t.attachment.size,textContent:r}),o.appendChild(s))),o},r.prototype.getClassName=function(){var e,n;return n=[t.attachment.container,""+t.attachment.typePrefix+this.attachment.getType()],(e=this.attachment.getExtension())&&n.push(e),n.join(" ")},r.prototype.getHref=function(){return e(this.attachment.getContent(),"a")?void 0:this.attachment.getHref()},r.prototype.createCursorTarget=function(){return n({tagName:"span",textContent:Trix.ZERO_WIDTH_SPACE,data:{trixCursorTarget:!0,trixSerialize:!1}})},r.prototype.findProgressElement=function(){var t;return null!=(t=this.findElement())?t.querySelector("progress"):void 0},r.prototype.attachmentDidChangeUploadProgress=function(){var t,e;return e=this.attachment.getUploadProgress(),null!=(t=this.findProgressElement())?t.value=e:void 0},r}(Trix.ObjectView),e=function(t,e){var o;return o=n("div"),o.innerHTML=null!=t?t:"",o.querySelector(e)}}.call(this),function(){var t,e,n,o=function(t,e){function n(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t=Trix.defer,e=Trix.makeElement,n=Trix.measureElement,Trix.PreviewableAttachmentView=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.attachment.previewDelegate=this}return o(n,t),n.prototype.createContentNodes=function(){return this.image=e({tagName:"img",attributes:{src:""},data:{trixMutable:!0,trixStoreKey:this.attachment.getCacheKey("imageElement")}}),this.refresh(this.image),[this.image]},n.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},n.prototype.updateAttributesForImage=function(t){var e,n,o,i,r;return i=this.attachment.getURL(),n=this.attachment.getPreloadedURL(),t.src=n||i,n===i?t.removeAttribute("data-trix-serialized-attributes"):(o=JSON.stringify({src:i}),t.setAttribute("data-trix-serialized-attributes",o)),r=this.attachment.getWidth(),e=this.attachment.getHeight(),null!=r&&(t.width=r),null!=e?t.height=e:void 0},n.prototype.attachmentDidPreload=function(){return this.refresh(this.image),this.refresh()},n}(Trix.AttachmentView)}.call(this),function(){var t,e,n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;e=Trix.makeElement,t=Trix.findInnerElement,Trix.PieceView=function(o){function i(){i.__super__.constructor.apply(this,arguments),this.piece=this.object,this.attributes=this.piece.getAttributes(),this.textConfig=this.options.textConfig,this.piece.attachment?this.attachment=this.piece.attachment:this.string=this.piece.toString()}var r;return n(i,o),i.prototype.createNodes=function(){var e,n,o,i,r,s;if(s=this.attachment?this.createAttachmentNodes():this.createStringNodes(),e=this.createElement()){for(o=t(e),n=0,i=s.length;i>n;n++)r=s[n],o.appendChild(r);s=[e]}return s},i.prototype.createAttachmentNodes=function(){var t,e;return t=this.attachment.isPreviewable()?Trix.PreviewableAttachmentView:Trix.AttachmentView,e=this.createChildView(t,this.piece.attachment,{piece:this.piece}),e.getNodes()},i.prototype.createStringNodes=function(){var t,n,o,i,s,a,u,c,l,h;if(null!=(c=this.textConfig)?c.plaintext:void 0)return[document.createTextNode(this.string)];for(u=[],l=this.string.split("\n"),o=n=0,i=l.length;i>n;o=++n)h=l[o],o>0&&(t=e("br"),u.push(t)),(s=h.length)&&(a=document.createTextNode(r(h)),u.push(a));return u},i.prototype.createElement=function(){var t,n,o,i,r,s,a,u;for(i in this.attributes)if((t=Trix.config.textAttributes[i])&&(t.tagName&&(r=e(t.tagName),o?(o.appendChild(r),o=r):n=o=r),t.style))if(a){s=t.style;for(i in s)u=s[i],a[i]=u}else a=t.style;if(a){null==n&&(n=e("span"));for(i in a)u=a[i],n.style[i]=u}return n},i.prototype.createContainerElement=function(){var t,n,o,i,r;i=this.attributes;for(o in i)if(r=i[o],(n=Trix.config.textAttributes[o])&&n.groupTagName)return t={},t[o]=r,e(n.groupTagName,t)},r=function(t){var e;return e=Trix.NON_BREAKING_SPACE,t.replace(/\ $/,e).replace(/(\S)\ {3}(\S)/g,"$1 "+e+" $2").replace(/\ {2}/g,e+" ").replace(/\ {2}/g," "+e).replace(/^\ /,e)},i}(Trix.ObjectView)}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.TextView=function(e){function n(){n.__super__.constructor.apply(this,arguments),this.text=this.object,this.textConfig=this.options.textConfig}return t(n,e),n.prototype.createNodes=function(){var t,e,n,o,i,r,s,a;for(n=[],s=function(){var t,e,n,o;for(n=this.text.getPieces(),o=[],t=0,e=n.length;e>t;t++)r=n[t],r.hasAttribute("blockBreak")||o.push(r);return o}.call(this),i=Trix.ObjectGroup.groupObjects(s),t=0,e=i.length;e>t;t++)o=i[t],a=this.findOrCreateCachedChildView(Trix.PieceView,o,{textConfig:this.textConfig}),n.push.apply(n,a.getNodes());return n},n}(Trix.ObjectView)}.call(this),function(){var t,e=function(t,e){function o(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=Trix.makeElement,Trix.BlockView=function(n){function o(){o.__super__.constructor.apply(this,arguments),this.block=this.object,this.attributes=this.block.getAttributes()}return e(o,n),o.prototype.createNodes=function(){var e,n,o,i,r,s,a,u,c;if(e=document.createComment("block"),s=[e],this.block.isEmpty()?s.push(t("br")):(u=null!=(a=Trix.config.blockAttributes[this.block.getLastAttribute()])?a.text:void 0,c=this.findOrCreateCachedChildView(Trix.TextView,this.block.text,{textConfig:u}),s.push.apply(s,c.getNodes()),this.shouldAddExtraNewlineElement()&&s.push(t("br"))),this.attributes.length)return s;for(n=t(Trix.config.blockAttributes["default"].tagName),o=0,i=s.length;i>o;o++)r=s[o],n.appendChild(r);return[n]},o.prototype.createContainerElement=function(e){var n,o;return n=this.attributes[e],o=Trix.config.blockAttributes[n],t(o.tagName)},o.prototype.shouldAddExtraNewlineElement=function(){return/\n\n$/.test(this.block.toString())},o}(Trix.ObjectView)}.call(this),function(){var t,e,n=function(t,e){function n(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;t=Trix.defer,e=Trix.makeElement,Trix.DocumentView=function(o){function i(){i.__super__.constructor.apply(this,arguments),this.element=this.options.element,this.elementStore=new Trix.ElementStore,this.setDocument(this.object)}var r,s,a;return n(i,o),i.render=function(t){var n,o;return n=e("div"),o=new this(t,{element:n}),o.render(),o.sync(),n},i.prototype.setDocument=function(t){return t.isEqualTo(this.document)?void 0:this.document=this.object=t},i.prototype.render=function(){var t,n,o,i,r,s,a;if(this.childViews=[],this.shadowElement=e("div"),!this.document.isEmpty()){for(r=Trix.ObjectGroup.groupObjects(this.document.getBlocks(),{asTree:!0}),s=[],t=0,n=r.length;n>t;t++)i=r[t],a=this.findOrCreateCachedChildView(Trix.BlockView,i),s.push(function(){var t,e,n,i;for(n=a.getNodes(),i=[],t=0,e=n.length;e>t;t++)o=n[t],i.push(this.shadowElement.appendChild(o));return i}.call(this));return s}},i.prototype.isSynced=function(){return r(this.shadowElement,this.element)},i.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()},i.prototype.didSync=function(){return this.elementStore.reset(s(this.element)),t(function(t){return function(){return t.garbageCollectCachedViews()}}(this))},i.prototype.createDocumentFragmentForSync=function(){var t,e,n,o,i,r,a,u,c,l;for(e=document.createDocumentFragment(),u=this.shadowElement.childNodes,n=0,i=u.length;i>n;n++)a=u[n],e.appendChild(a.cloneNode(!0));for(c=s(e),o=0,r=c.length;r>o;o++)t=c[o],(l=this.elementStore.remove(t))&&t.parentNode.replaceChild(l,t);return e},s=function(t){return t.querySelectorAll("[data-trix-store-key]")},r=function(t,e){return a(t.innerHTML)===a(e.innerHTML)},a=function(t){return t.replace(/&nbsp;/g," ")},i}(Trix.ObjectView)}.call(this),function(){var t,e,n,o,i,r,s,a=function(t,e){return function(){return t.apply(e,arguments)}},u=function(t,e){function n(){this.constructor=t}for(var o in e)c.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;i=Trix.handleEvent,s=Trix.tagName,e=Trix.benchmark,o=Trix.findClosestElementFromNode,r=Trix.innerElementIsActive,n=Trix.defer,t=Trix.AttachmentView.attachmentSelector,Trix.CompositionController=function(o){function s(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 Trix.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 u(s,o),s.prototype.didFocus=function(){var t;return this.focused?void 0:(this.focused=!0,null!=(t=this.delegate)&&"function"==typeof t.compositionControllerDidFocus?t.compositionControllerDidFocus():void 0)},s.prototype.didBlur=function(){return n(function(t){return function(){var e;return r(t.element)?void 0:(t.focused=null,null!=(e=t.delegate)&&"function"==typeof e.compositionControllerDidBlur?e.compositionControllerDidBlur():void 0)}}(this))},s.prototype.didClickAttachment=function(t,e){var n,o;return n=this.findAttachmentForElement(e),null!=(o=this.delegate)&&"function"==typeof o.compositionControllerDidSelectAttachment?o.compositionControllerDidSelectAttachment(n):void 0},s.prototype.render=e("CompositionController#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.documentView.isSynced()||(null!=(t=this.delegate)&&"function"==typeof t.compositionControllerWillSyncDocumentView&&t.compositionControllerWillSyncDocumentView(),this.documentView.sync(),this.reinstallAttachmentEditor(),null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidSyncDocumentView&&e.compositionControllerDidSyncDocumentView()),null!=(n=this.delegate)&&"function"==typeof n.compositionControllerDidRender?n.compositionControllerDidRender():void 0}),s.prototype.rerenderViewForObject=function(t){return this.documentView.invalidateViewForObject(t),this.render()},s.prototype.isViewCachingEnabled=function(){return this.documentView.isViewCachingEnabled()},s.prototype.enableViewCaching=function(){return this.documentView.enableViewCaching()},s.prototype.disableViewCaching=function(){return this.documentView.disableViewCaching()},s.prototype.refreshViewCache=function(){return this.documentView.garbageCollectCachedViews()},s.prototype.installAttachmentEditorForAttachment=function(t){var e,n,o;if((null!=(o=this.attachmentEditor)?o.attachment:void 0)!==t&&(n=this.documentView.findElementForObject(t)))return this.uninstallAttachmentEditor(),e=this.composition.document.getAttachmentPieceForAttachment(t),this.attachmentEditor=new Trix.AttachmentEditorController(e,n,this.element),this.attachmentEditor.delegate=this},s.prototype.uninstallAttachmentEditor=function(){var t;return null!=(t=this.attachmentEditor)?t.uninstall():void 0},s.prototype.reinstallAttachmentEditor=function(){var t;return this.attachmentEditor?(t=this.attachmentEditor.attachment,this.uninstallAttachmentEditor(),this.installAttachmentEditorForAttachment(t)):void 0},s.prototype.editAttachmentCaption=function(){var t;return null!=(t=this.attachmentEditor)?t.editCaption():void 0},s.prototype.didUninstallAttachmentEditor=function(){return this.attachmentEditor=null,this.render()},s.prototype.attachmentEditorDidRequestUpdatingAttributesForAttachment=function(t,e){var n;return null!=(n=this.delegate)&&"function"==typeof n.compositionControllerWillUpdateAttachment&&n.compositionControllerWillUpdateAttachment(e),this.composition.updateAttributesForAttachment(t,e)},s.prototype.attachmentEditorDidRequestRemovingAttributeForAttachment=function(t,e){var n;return null!=(n=this.delegate)&&"function"==typeof n.compositionControllerWillUpdateAttachment&&n.compositionControllerWillUpdateAttachment(e),this.composition.removeAttributeForAttachment(t,e)},s.prototype.attachmentEditorDidRequestRemovalOfAttachment=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidRequestRemovalOfAttachment?e.compositionControllerDidRequestRemovalOfAttachment(t):void 0},s.prototype.attachmentEditorDidRequestDeselectingAttachment=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidRequestDeselectingAttachment?e.compositionControllerDidRequestDeselectingAttachment(t):void 0},s.prototype.findAttachmentForElement=function(t){return this.composition.document.getAttachmentById(parseInt(t.dataset.trixId,10))},s}(Trix.BasicObject)}.call(this),function(){var t,e,n,o=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e=Trix.handleEvent,n=Trix.triggerEvent,t=Trix.findClosestElementFromNode,Trix.ToolbarController=function(r){function s(t){this.element=t,this.didKeyDownDialogInput=o(this.didKeyDownDialogInput,this),this.didClickDialogButton=o(this.didClickDialogButton,this),this.didClickAttributeButton=o(this.didClickAttributeButton,this),this.didClickActionButton=o(this.didClickActionButton,this),this.attributes={},this.actions={},this.resetDialogInputs(),e("mousedown",{onElement:this.element,matchingSelector:a,withCallback:this.didClickActionButton}),e("mousedown",{onElement:this.element,matchingSelector:c,withCallback:this.didClickAttributeButton}),e("click",{onElement:this.element,matchingSelector:y,preventDefault:!0}),e("click",{onElement:this.element,matchingSelector:l,withCallback:this.didClickDialogButton}),e("keydown",{onElement:this.element,matchingSelector:h,withCallback:this.didKeyDownDialogInput})}var a,u,c,l,h,p,d,f,g,m,y;return i(s,r),a="button[data-action]",c="button[data-attribute]",y=[a,c].join(", "),p=".dialog[data-dialog]",u=p+".active",l=p+" input[data-method]",h=p+" input[type=text], "+p+" input[type=url]",s.prototype.didClickActionButton=function(t,e){var n,o,i;return null!=(o=this.delegate)&&o.toolbarDidClickButton(),t.preventDefault(),n=d(e),this.getDialog(n)?this.toggleDialog(n):null!=(i=this.delegate)?i.toolbarDidInvokeAction(n):void 0},s.prototype.didClickAttributeButton=function(t,e){var n,o,i;return null!=(o=this.delegate)&&o.toolbarDidClickButton(),t.preventDefault(),n=f(e),this.getDialog(n)?this.toggleDialog(n):null!=(i=this.delegate)&&i.toolbarDidToggleAttribute(n),this.refreshAttributeButtons()},s.prototype.didClickDialogButton=function(e,n){var o,i;return o=t(n,{matchingSelector:p}),i=n.getAttribute("data-method"),this[i].call(this,o)},s.prototype.didKeyDownDialogInput=function(t,e){var n,o;return 13===t.keyCode&&(t.preventDefault(),n=e.getAttribute("name"),o=this.getDialog(n),this.setAttribute(o)),27===t.keyCode?(t.preventDefault(),this.hideDialog()):void 0},s.prototype.updateActions=function(t){return this.actions=t,this.refreshActionButtons()},s.prototype.refreshActionButtons=function(){return this.eachActionButton(function(t){return function(e,n){return e.disabled=t.actions[n]===!1}}(this))},s.prototype.eachActionButton=function(t){var e,n,o,i,r;for(i=this.element.querySelectorAll(a),r=[],n=0,o=i.length;o>n;n++)e=i[n],r.push(t(e,d(e)));return r},s.prototype.updateAttributes=function(t){return this.attributes=t,this.refreshAttributeButtons()},s.prototype.refreshAttributeButtons=function(){return this.eachAttributeButton(function(t){return function(e,n){return t.attributes[n]||t.dialogIsVisible(n)?e.classList.add("active"):e.classList.remove("active")}}(this))},s.prototype.eachAttributeButton=function(t){var e,n,o,i,r;for(i=this.element.querySelectorAll(c),r=[],n=0,o=i.length;o>n;n++)e=i[n],r.push(t(e,f(e)));return r},s.prototype.applyKeyboardCommand=function(t){var e,o,i,r,s,a,u;for(s=JSON.stringify(t.sort()),u=this.element.querySelectorAll("[data-key]"),r=0,a=u.length;a>r;r++)if(e=u[r],i=e.getAttribute("data-key").split("+"),o=JSON.stringify(i.sort()),o===s)return n("mousedown",{onElement:e}),!0;return!1},s.prototype.dialogIsVisible=function(t){var e;return(e=this.getDialog(t))?e.classList.contains("active"):void 0},s.prototype.toggleDialog=function(t){return this.dialogIsVisible(t)?this.hideDialog():this.showDialog(t)},s.prototype.showDialog=function(t){var e,n,o,i,r,s;return this.hideDialog(),null!=(i=this.delegate)&&i.toolbarWillShowDialog(),n=this.getDialog(t),n.classList.add("active"),(e=f(n))&&(o=m(n,t))&&(o.removeAttribute("disabled"),o.value=null!=(r=this.attributes[e])?r:"",o.select()),null!=(s=this.delegate)?s.toolbarDidShowDialog(t):void 0},s.prototype.setAttribute=function(t){var e,n,o;return e=f(t),n=m(t,e),n.willValidate&&!n.checkValidity()?(n.classList.add("validate"),n.focus()):(null!=(o=this.delegate)&&o.toolbarDidUpdateAttribute(e,n.value),this.hideDialog())},s.prototype.removeAttribute=function(t){var e,n;return e=f(t),null!=(n=this.delegate)&&n.toolbarDidRemoveAttribute(e),this.hideDialog()},s.prototype.hideDialog=function(){var t,e;return(t=this.element.querySelector(u))?(t.classList.remove("active"),this.resetDialogInputs(),null!=(e=this.delegate)?e.toolbarDidHideDialog(g(t)):void 0):void 0},s.prototype.resetDialogInputs=function(){var t,e,n,o,i;for(o=this.element.querySelectorAll(h),i=[],t=0,n=o.length;n>t;t++)e=o[t],e.setAttribute("disabled","disabled"),i.push(e.classList.remove("validate"));return i},s.prototype.getDialog=function(t){return this.element.querySelector(".dialog[data-dialog="+t+"]")},m=function(t,e){return null==e&&(e=f(t)),t.querySelector("input[name='"+e+"']")},d=function(t){return t.getAttribute("data-action")},f=function(t){return t.getAttribute("data-attribute")},g=function(t){return t.getAttribute("data-dialog")},s}(Trix.BasicObject)}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.ImagePreloadOperation=function(e){function n(t){this.url=t}return t(n,e),n.prototype.perform=function(t){var e;return e=new Image,e.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}(Trix.Operation)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function o(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t},n={}.hasOwnProperty;Trix.Attachment=function(n){function o(e){null==e&&(e={}),this.releaseFile=t(this.releaseFile,this),o.__super__.constructor.apply(this,arguments),this.attributes=Trix.Hash.box(e),this.didChangeAttributes()}return e(o,n),o.previewablePattern=/^image(\/(gif|png|jpe?g)|$)/,o.attachmentForFile=function(t){var e,n;return n=this.attributesForFile(t),e=new this(n),e.setFile(t),e},o.attributesForFile=function(t){return new Trix.Hash({filename:t.name,filesize:t.size,contentType:t.type})},o.fromJSON=function(t){return new this(t)},o.prototype.getAttribute=function(t){return this.attributes.get(t)},o.prototype.hasAttribute=function(t){return this.attributes.has(t)},o.prototype.getAttributes=function(){return this.attributes.toObject()},o.prototype.setAttributes=function(t){var e,n;return null==t&&(t={}),e=this.attributes.merge(t),this.attributes.isEqualTo(e)?void 0:(this.attributes=e,this.didChangeAttributes(),null!=(n=this.delegate)&&"function"==typeof n.attachmentDidChangeAttributes?n.attachmentDidChangeAttributes(this):void 0)},o.prototype.didChangeAttributes=function(){return this.isPreviewable()?this.preloadURL():void 0},o.prototype.isPending=function(){return null!=this.file&&!(this.getURL()||this.getHref())},o.prototype.isPreviewable=function(){return this.attributes.has("previewable")?this.attributes.get("previewable"):this.constructor.previewablePattern.test(this.getContentType())},o.prototype.getType=function(){return this.hasContent()?"content":this.isPreviewable()?"preview":"file"},o.prototype.getURL=function(){return this.attributes.get("url")},o.prototype.getHref=function(){return this.attributes.get("href")},o.prototype.getFilename=function(){var t;return null!=(t=this.attributes.get("filename"))?t:""},o.prototype.getFilesize=function(){return this.attributes.get("filesize")},o.prototype.getFormattedFilesize=function(){var t;return t=this.attributes.get("filesize"),"number"==typeof t?Trix.config.fileSize.formatter(t):""},o.prototype.getExtension=function(){var t;return null!=(t=this.getFilename().match(/\.(\w+)$/))?t[1].toLowerCase():void 0},o.prototype.getContentType=function(){return this.attributes.get("contentType")},o.prototype.hasContent=function(){return this.attributes.has("content")},o.prototype.getContent=function(){return this.attributes.get("content")},o.prototype.getWidth=function(){return this.attributes.get("width")},o.prototype.getHeight=function(){return this.attributes.get("height")},o.prototype.getFile=function(){return this.file},o.prototype.setFile=function(t){return this.file=t,this.isPreviewable()?this.preloadFile():void 0},o.prototype.releaseFile=function(){return this.releasePreloadedFile(),this.file=null},o.prototype.getUploadProgress=function(){var t;return null!=(t=this.uploadProgress)?t:0},o.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},o.prototype.toJSON=function(){return this.getAttributes()},o.prototype.getCacheKey=function(t){var e;return e=[o.__super__.getCacheKey.apply(this,arguments),this.attributes.getCacheKey(),this.getPreloadedURL()],t&&e.unshift(t),e.join("/")},o.prototype.getPreloadedURL=function(){return this.preloadedURL},o.prototype.preloadURL=function(){return this.preload(this.getURL(),this.releaseFile)},o.prototype.preloadFile=function(){return this.file?(this.fileObjectURL=URL.createObjectURL(this.file),this.preload(this.fileObjectURL)):void 0},o.prototype.releasePreloadedFile=function(){return this.fileObjectURL?(URL.revokeObjectURL(this.fileObjectURL),this.fileObjectURL=null):void 0},o.prototype.preload=function(t,e){var n;return t&&t!==this.preloadedURL?(null==this.preloadedURL&&(this.preloadedURL=t),n=new Trix.ImagePreloadOperation(t),n.then(function(n){return function(o){var i,r,s;return s=o.width,i=o.height,n.preloadedURL=t,n.setAttributes({width:s,height:i}),null!=(r=n.previewDelegate)&&"function"==typeof r.attachmentDidPreload&&r.attachmentDidPreload(),"function"==typeof e?e():void 0}}(this))):void 0},o}(Trix.Object)}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.Piece=function(e){function n(t,e){null==e&&(e={}),n.__super__.constructor.apply(this,arguments),this.attributes=Trix.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}(Trix.Object)}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.Piece.registerType("attachment",Trix.AttachmentPiece=function(e){function n(t){this.attachment=t,n.__super__.constructor.apply(this,arguments),this.length=1,this.ensureAttachmentExclusivelyHasAttribute("href")}return t(n,e),n.fromJSON=function(t){return new this(Trix.Attachment.fromJSON(t.attachment),t.attributes)},n.prototype.ensureAttachmentExclusivelyHasAttribute=function(t){return this.hasAttribute(t)&&this.attachment.hasAttribute(t)?this.attributes=this.attributes.remove(t):void 0},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.getAttributesForAttachment=function(){return this.attributes.slice(["caption"])},n.prototype.canBeGrouped=function(){return n.__super__.canBeGrouped.apply(this,arguments)&&!this.attachment.hasAttribute("href")},n.prototype.toString=function(){return Trix.OBJECT_REPLACEMENT_CHARACTER},n.prototype.toJSON=function(){var t;return t=n.__super__.toJSON.apply(this,arguments),t.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}(Trix.Piece))}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.Piece.registerType("string",Trix.StringPiece=function(e){function n(t){n.__super__.constructor.apply(this,arguments),this.string=t,this.length=this.string.length}return t(n,e),n.fromJSON=function(t){return new this(t.string,t.attributes)},n.prototype.getValue=function(){return this.string},n.prototype.toString=function(){return this.string.toString()},n.prototype.isBlockBreak=function(){return"\n"===this.toString()&&this.getAttribute("blockBreak")===!0},n.prototype.toJSON=function(){var t;return t=n.__super__.toJSON.apply(this,arguments),t.string=this.string,t},n.prototype.canBeConsolidatedWith=function(t){return null!=t&&this.hasSameConstructorAs(t)&&this.hasSameAttributesAsPiece(t)},n.prototype.consolidateWith=function(t){return new this.constructor(this.toString()+t.toString(),this.attributes)},n.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]},n.prototype.toConsole=function(){var t;return t=this.string,t.length>15&&(t=t.slice(0,14)+"\u2026"),JSON.stringify(t.toString())},n}(Trix.Piece))}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty,n=[].slice;Trix.SplittableList=function(e){function o(t){null==t&&(t=[]),o.__super__.constructor.apply(this,arguments),this.objects=t.slice(0),this.length=this.objects.length}var i,r,s;return t(o,e),o.box=function(t){return t instanceof this?t:new this(t)},o.prototype.eachObject=function(t){var e,n,o,i,r,s;for(r=this.objects,s=[],n=e=0,o=r.length;o>e;n=++e)i=r[n],s.push(t(i,n));return s},o.prototype.insertObjectAtIndex=function(t,e){var n;return n=this.objects.slice(0),n.splice(e,0,t),new this.constructor(n)},o.prototype.insertSplittableListAtIndex=function(t,e){var o;return o=this.objects.slice(0),o.splice.apply(o,[e,0].concat(n.call(t.objects))),new this.constructor(o)},o.prototype.insertSplittableListAtPosition=function(t,e){var n,o,i;return i=this.splitObjectAtPosition(e),o=i[0],n=i[1],new this.constructor(o).insertSplittableListAtIndex(t,n)},o.prototype.editObjectAtIndex=function(t,e){return this.replaceObjectAtIndex(e(this.objects[t]),t)},o.prototype.replaceObjectAtIndex=function(t,e){var n;return n=this.objects.slice(0),n.splice(e,1,t),new this.constructor(n)},o.prototype.removeObjectAtIndex=function(t){var e;return e=this.objects.slice(0),e.splice(t,1),new this.constructor(e)},o.prototype.getObjectAtIndex=function(t){return this.objects[t]},o.prototype.getSplittableListInRange=function(t){var e,n,o,i;
23
+ return o=this.splitObjectsAtRange(t),n=o[0],e=o[1],i=o[2],new this.constructor(n.slice(e,i+1))},o.prototype.selectSplittableList=function(t){var e,n;return n=function(){var n,o,i,r;for(i=this.objects,r=[],n=0,o=i.length;o>n;n++)e=i[n],t(e)&&r.push(e);return r}.call(this),new this.constructor(n)},o.prototype.removeObjectsInRange=function(t){var e,n,o,i;return o=this.splitObjectsAtRange(t),n=o[0],e=o[1],i=o[2],n.splice(e,i-e+1),new this.constructor(n)},o.prototype.transformObjectsInRange=function(t,e){var n,o,i,r,s,a,u;return s=this.splitObjectsAtRange(t),r=s[0],o=s[1],a=s[2],u=function(){var t,s,u;for(u=[],n=t=0,s=r.length;s>t;n=++t)i=r[n],u.push(n>=o&&a>=n?e(i):i);return u}(),new this.constructor(u)},o.prototype.splitObjectsAtRange=function(t){var e,n,o,r,a,u;return r=this.splitObjectAtPosition(s(t)),n=r[0],e=r[1],o=r[2],a=new this.constructor(n).splitObjectAtPosition(i(t)+o),n=a[0],u=a[1],[n,e,u-1]},o.prototype.getObjectAtPosition=function(t){var e,n,o;return o=this.findIndexAndOffsetAtPosition(t),e=o.index,n=o.offset,this.objects[e]},o.prototype.splitObjectAtPosition=function(t){var e,n,o,i,r,s,a,u,c,l;return s=this.findIndexAndOffsetAtPosition(t),e=s.index,r=s.offset,i=this.objects.slice(0),null!=e?0===r?(c=e,l=0):(o=this.getObjectAtIndex(e),a=o.splitAtOffset(r),n=a[0],u=a[1],i.splice(e,1,n,u),c=e+1,l=n.getLength()-r):(c=i.length,l=0),[i,c,l]},o.prototype.consolidate=function(){var t,e,n,o,i,r;for(o=[],i=this.objects[0],r=this.objects.slice(1),t=0,e=r.length;e>t;t++)n=r[t],("function"==typeof i.canBeConsolidatedWith?i.canBeConsolidatedWith(n):void 0)?i=i.consolidateWith(n):(o.push(i),i=n);return null!=i&&o.push(i),new this.constructor(o)},o.prototype.consolidateFromIndexToIndex=function(t,e){var o,i,r;return i=this.objects.slice(0),r=i.slice(t,e+1),o=new this.constructor(r).consolidate().toArray(),i.splice.apply(i,[t,r.length].concat(n.call(o))),new this.constructor(i)},o.prototype.findIndexAndOffsetAtPosition=function(t){var e,n,o,i,r,s,a;for(e=0,a=this.objects,o=n=0,i=a.length;i>n;o=++n){if(s=a[o],r=e+s.getLength(),t>=e&&r>t)return{index:o,offset:t-e};e=r}return{index:null,offset:null}},o.prototype.findPositionAtIndexAndOffset=function(t,e){var n,o,i,r,s,a;for(s=0,a=this.objects,n=o=0,i=a.length;i>o;n=++o)if(r=a[n],t>n)s+=r.getLength();else if(n===t){s+=e;break}return s},o.prototype.getEndPosition=function(){var t,e;return null!=this.endPosition?this.endPosition:this.endPosition=function(){var n,o,i;for(e=0,i=this.objects,n=0,o=i.length;o>n;n++)t=i[n],e+=t.getLength();return e}.call(this)},o.prototype.toString=function(){return this.objects.join("")},o.prototype.toArray=function(){return this.objects.slice(0)},o.prototype.toJSON=function(){return this.toArray()},o.prototype.isEqualTo=function(t){return o.__super__.isEqualTo.apply(this,arguments)||r(this.objects,null!=t?t.objects:void 0)},r=function(t,e){var n,o,i,r,s;if(null==e&&(e=[]),t.length!==e.length)return!1;for(s=!0,o=n=0,i=t.length;i>n;o=++n)r=t[o],s&&!r.isEqualTo(e[o])&&(s=!1);return s},o.prototype.contentsForInspection=function(){var t;return{objects:"["+function(){var e,n,o,i;for(o=this.objects,i=[],e=0,n=o.length;n>e;e++)t=o[e],i.push(t.inspect());return i}.call(this).join(", ")+"]"}},s=function(t){return t[0]},i=function(t){return t[1]},o}(Trix.Object)}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.Text=function(e){function n(t){var e;null==t&&(t=[]),n.__super__.constructor.apply(this,arguments),this.pieceList=new Trix.SplittableList(function(){var n,o,i;for(i=[],n=0,o=t.length;o>n;n++)e=t[n],e.isEmpty()||i.push(e);return i}())}return t(n,e),n.textForAttachmentWithAttributes=function(t,e){var n;return n=new Trix.AttachmentPiece(t,e),new this([n])},n.textForStringWithAttributes=function(t,e){var n;return n=new Trix.StringPiece(t,e),new this([n])},n.fromJSON=function(t){var e,n;return n=function(){var n,o,i;for(i=[],n=0,o=t.length;o>n;n++)e=t[n],i.push(Trix.Piece.fromJSON(e));return i}(),new this(n)},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,o,i,r,s;for(i=this.getPieces(),s=[],n=0,o=i.length;o>n;n++)e=i[n],s.push(null!=(r=t.find(e))?r:e);return s}.call(this),new this.constructor(n)},n.prototype.appendText=function(t){return this.insertTextAtPosition(t,this.getLength())},n.prototype.insertTextAtPosition=function(t,e){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(t.pieceList,e))},n.prototype.removeTextAtRange=function(t){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(t))},n.prototype.replaceTextAtRange=function(t,e){return this.removeTextAtRange(e).insertTextAtPosition(t,e[0])},n.prototype.moveTextFromRangeToPosition=function(t,e){var n,o;if(!(t[0]<=e&&e<=t[1]))return o=this.getTextAtRange(t),n=o.getLength(),t[0]<e&&(e-=n),this.removeTextAtRange(t).insertTextAtPosition(o,e)},n.prototype.addAttributeAtRange=function(t,e,n){var o;return o={},o[t]=e,this.addAttributesAtRange(o,n)},n.prototype.addAttributesAtRange=function(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,function(e){return e.copyWithAdditionalAttributes(t)}))},n.prototype.removeAttributeAtRange=function(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,function(e){return e.copyWithoutAttribute(t)}))},n.prototype.setAttributesAtRange=function(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,function(e){return e.copyWithAttributes(t)}))},n.prototype.getAttributesAtPosition=function(t){var e,n;return null!=(e=null!=(n=this.pieceList.getObjectAtPosition(t))?n.getAttributes():void 0)?e:{}},n.prototype.getCommonAttributes=function(){var t,e;return t=function(){var t,n,o,i;for(o=this.pieceList.toArray(),i=[],t=0,n=o.length;n>t;t++)e=o[t],i.push(e.getAttributes());return i}.call(this),Trix.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,o,i;for(n=i=e,o=this.getLength();n>0&&this.getCommonAttributesAtRange([n-1,i])[t];)n--;for(;o>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.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,o,i;for(o=this.pieceList.toArray(),i=[],t=0,e=o.length;e>t;t++)n=o[t],null!=n.attachment&&i.push(n);return i},n.prototype.getAttachments=function(){var t,e,n,o,i;for(o=this.getAttachmentPieces(),i=[],t=0,e=o.length;e>t;t++)n=o[t],i.push(n.attachment);return i},n.prototype.getAttachmentAndPositionById=function(t){var e,n,o,i,r,s;for(i=0,r=this.pieceList.toArray(),e=0,n=r.length;n>e;e++){if(o=r[e],(null!=(s=o.attachment)?s.id:void 0)===t)return{attachment:o.attachment,position:i};i+=o.length}return{attachment:null,position:null}},n.prototype.getAttachmentById=function(t){var e,n,o;return o=this.getAttachmentAndPositionById(t),e=o.attachment,n=o.position,e},n.prototype.getRangeOfAttachment=function(t){var e,n;return n=this.getAttachmentAndPositionById(t.id),t=n.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,o,i;for(o=this.pieceList.toArray(),i=[],e=0,n=o.length;n>e;e++)t=o[e],i.push(JSON.parse(t.toConsole()));return i}.call(this))},n}(Trix.Object)}.call(this),function(){var t,e=function(t,e){function o(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t},n={}.hasOwnProperty,o=[].slice;t=Trix.arraysAreEqual,Trix.Block=function(n){function i(t,e){null==t&&(t=new Trix.Text),null==e&&(e=[]),i.__super__.constructor.apply(this,arguments),this.text=s(t),this.attributes=e}var r,s,a,u,c,l,h,p;return e(i,n),i.fromJSON=function(t){var e;return e=Trix.Text.fromJSON(t.text),new this(e,t.attributes)},i.prototype.isEmpty=function(){return this.text.isBlockBreak()},i.prototype.isEqualTo=function(e){return i.__super__.isEqualTo.apply(this,arguments)||this.text.isEqualTo(null!=e?e.text:void 0)&&t(this.attributes,null!=e?e.attributes:void 0)},i.prototype.copyWithText=function(t){return new this.constructor(t,this.attributes)},i.prototype.copyWithoutText=function(){return this.copyWithText(null)},i.prototype.copyWithAttributes=function(t){return new this.constructor(this.text,t)},i.prototype.copyUsingObjectMap=function(t){var e;return this.copyWithText((e=t.find(this.text))?e:this.text.copyUsingObjectMap(t))},i.prototype.addAttribute=function(t){var e,n;return n=Trix.config.blockAttributes[t].listAttribute,e=this.attributes.concat(n?[n,t]:[t]),this.copyWithAttributes(e)},i.prototype.removeAttribute=function(t){var e,n;return n=Trix.config.blockAttributes[t].listAttribute,e=c(this.attributes,t),null!=n&&(e=c(e,n)),this.copyWithAttributes(e)},i.prototype.removeLastAttribute=function(){return this.removeAttribute(this.getLastAttribute())},i.prototype.getLastAttribute=function(){return u(this.attributes)},i.prototype.getAttributes=function(){return this.attributes.slice(0)},i.prototype.getAttributeLevel=function(){return this.attributes.length},i.prototype.getAttributeAtLevel=function(t){return this.attributes[t-1]},i.prototype.hasAttributes=function(){return this.getAttributeLevel()>0},i.prototype.getConfig=function(t){var e,n;if((e=this.getLastAttribute())&&(n=Trix.config.blockAttributes[e]))return t?n[t]:n},i.prototype.isListItem=function(){return null!=this.getConfig("listAttribute")},i.prototype.findLineBreakInDirectionFromPosition=function(t,e){var n,o;return o=this.toString(),n=function(){switch(t){case"forward":return o.indexOf("\n",e);case"backward":return o.slice(0,e).lastIndexOf("\n")}}(),-1!==n?n:void 0},i.prototype.contentsForInspection=function(){return{text:this.text.inspect(),attributes:this.attributes}},i.prototype.toString=function(){return this.text.toString()},i.prototype.toJSON=function(){return{text:this.text,attributes:this.attributes}},i.prototype.getLength=function(){return this.text.getLength()},i.prototype.canBeConsolidatedWith=function(t){return!this.hasAttributes()&&!t.hasAttributes()},i.prototype.consolidateWith=function(t){var e,n;return e=Trix.Text.textForStringWithAttributes("\n"),n=this.getTextWithoutBlockBreak().appendText(e),this.copyWithText(n.appendText(t.text))},i.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]},i.prototype.toString=function(){return this.text.toString()},i.prototype.getBlockBreakPosition=function(){return this.text.getLength()-1},i.prototype.getTextWithoutBlockBreak=function(){return l(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()},i.prototype.canBeGrouped=function(t){return this.attributes[t]},i.prototype.canBeGroupedWith=function(t,e){var n,o,i,r;return n=this.attributes,o=t.getAttributes(),n[e]===o[e]?"bullet"!==(i=n[e])&&"number"!==i||"bulletList"===(r=o[e+1])||"numberList"===r?!0:!1:void 0},s=function(t){return t=p(t),t=r(t)},p=function(t){var e,n,i,r,s,a;return r=!1,a=t.getPieces(),n=2<=a.length?o.call(a,0,e=a.length-1):(e=0,[]),i=a[e++],null==i?t:(n=function(){var t,e,o;for(o=[],t=0,e=n.length;e>t;t++)s=n[t],s.isBlockBreak()?(r=!0,o.push(h(s))):o.push(s);return o}(),r?new Trix.Text(o.call(n).concat([i])):t)},a=Trix.Text.textForStringWithAttributes("\n",{blockBreak:!0}),r=function(t){return l(t)?t:t.appendText(a)},l=function(t){var e,n;return n=t.getLength(),0===n?!1:(e=t.getTextAtRange([n-1,n]),e.isBlockBreak())},h=function(t){return t.copyWithoutAttribute("blockBreak")},c=function(t,e){return u(t)===e?t.slice(0,-1):t},u=function(t){return t.slice(-1)[0]},i}(Trix.Object)}.call(this),function(){var t,e,n,o,i,r,s,a,u,c=function(t,e){function n(){this.constructor=t}for(var o in e)l.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty,h=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},p=[].slice;t=Trix.arraysAreEqual,e=Trix.benchmark,s=Trix.normalizeSpaces,i=Trix.makeElement,a=Trix.tagName,u=Trix.walkTree,o=Trix.findClosestElementFromNode,n=Trix.elementContainsNode,r=Trix.nodeIsAttachmentElement,Trix.HTMLParser=function(l){function d(t){this.html=t,this.blocks=[],this.blockElements=[],this.processedElements=[]}var f,g,m,y,v,b,A,x,T,C,w,E;return c(d,l),f="style href src width height class".split(" "),d.parse=function(t,e){var n;return n=new this(t,e),n.parse(),n},d.prototype.getDocument=function(){return Trix.Document.fromJSON(this.blocks)},d.prototype.parse=e("HTMLParser#parse",function(){var t,e;try{for(this.createHiddenContainer(),t=E(this.html),this.container.innerHTML=t,e=u(this.container,{usingFilter:x});e.nextNode();)this.processNode(e.currentNode);return this.translateBlockElementMarginsToNewlines()}finally{this.removeHiddenContainer()}}),x=function(t){return"style"===a(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},d.prototype.createHiddenContainer=function(){return this.container=i({tagName:"div",style:{display:"none"}}),document.body.appendChild(this.container)},d.prototype.removeHiddenContainer=function(){return document.body.removeChild(this.container)},d.prototype.processNode=function(t){switch(t.nodeType){case Node.TEXT_NODE:return this.processTextNode(t);case Node.ELEMENT_NODE:return this.appendBlockForElement(t),this.processElement(t)}},d.prototype.appendBlockForElement=function(e){var o;if(this.isBlockElement(e)&&!this.isBlockElement(e.firstChild)){if(o=y(e),!n(this.currentBlockElement,e)||!t(o,this.currentBlock.attributes))return this.currentBlock=this.appendBlockForAttributesWithElement(o,e),this.currentBlockElement=e}else if(this.currentBlockElement&&!n(this.currentBlockElement,e)&&!this.isBlockElement(e))return this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null},d.prototype.isExtraBR=function(t){return"br"===a(t)&&this.isBlockElement(t.parentNode)&&t.parentNode.lastChild===t},d.prototype.isBlockElement=function(t){var e;if((null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE&&!o(t,{matchingSelector:"td"}))return e=a(t),h.call(this.getBlockTagNames(),e)>=0||"block"===window.getComputedStyle(t).display},d.prototype.getBlockTagNames=function(){var t,e;return null!=this.blockTagNames?this.blockTagNames:this.blockTagNames=function(){var n,o;n=Trix.config.blockAttributes,o=[];for(t in n)e=n[t],o.push(e.tagName);return o}()},d.prototype.processTextNode=function(t){var e;return(e=s(t.data))?this.appendStringWithAttributes(e,A(t.parentNode)):void 0},d.prototype.processElement=function(t){var e,n,o,i,s;if(r(t))return e=m(t),Object.keys(e).length&&(i=A(t),this.appendAttachmentWithAttributes(e,i),t.innerHTML=""),this.processedElements.push(t);switch(a(t)){case"br":return this.isExtraBR(t)||this.appendStringWithAttributes("\n",A(t)),this.processedElements.push(t);case"img":e={url:t.src,contentType:"image"},o=b(t);for(n in o)s=o[n],e[n]=s;return this.appendAttachmentWithAttributes(e,A(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(" | ")}},d.prototype.appendBlockForAttributesWithElement=function(t,e){var n;return this.blockElements.push(e),n=g(t),this.blocks.push(n),n},d.prototype.appendEmptyBlock=function(){return this.appendBlockForAttributesWithElement([],null)},d.prototype.appendStringWithAttributes=function(t,e){return this.appendPiece(C(t,e))},d.prototype.appendAttachmentWithAttributes=function(t,e){return this.appendPiece(T(t,e))},d.prototype.appendPiece=function(t){return 0===this.blocks.length&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(t)},d.prototype.appendStringToTextAtIndex=function(t,e){var n,o;return o=this.blocks[e].text,n=o[o.length-1],"string"===(null!=n?n.type:void 0)?n.string+=t:o.push(C(t))},d.prototype.prependStringToTextAtIndex=function(t,e){var n,o;return o=this.blocks[e].text,n=o[0],"string"===(null!=n?n.type:void 0)?n.string=t+n.string:o.unshift(C(t))},d.prototype.getMarginOfBlockElementAtIndex=function(t){var e,n;return!(e=this.blockElements[t])||(n=a(e),h.call(this.getBlockTagNames(),n)>=0||h.call(this.processedElements,e)>=0)?void 0:v(e)},d.prototype.getMarginOfDefaultBlockElement=function(){var t;return t=i(Trix.config.blockAttributes["default"].tagName),this.container.appendChild(t),v(t)},d.prototype.translateBlockElementMarginsToNewlines=function(){var t,e,n,o,i,r,s,a;for(e=this.getMarginOfDefaultBlockElement(),s=this.blocks,a=[],o=n=0,i=s.length;i>n;o=++n)t=s[o],(r=this.getMarginOfBlockElementAtIndex(o))&&(r.top>2*e.top&&this.prependStringToTextAtIndex("\n",o),a.push(r.bottom>2*e.bottom?this.appendStringToTextAtIndex("\n",o):void 0));return a},C=function(t,e){var n;return null==e&&(e={}),n="string",{string:t,attributes:e,type:n}},T=function(t,e){var n;return null==e&&(e={}),n="attachment",{attachment:t,attributes:e,type:n}},g=function(t){var e;return null==t&&(t={}),e=[],{text:e,attributes:t}},A=function(t){var e,n,o,i,s,u,c,l;n={},u=Trix.config.textAttributes;for(e in u)o=u[e],o.parser?(l=o.parser(t))&&(n[e]=l):o.tagName&&a(t)===o.tagName&&(n[e]=!0);if(r(t)&&(i=t.dataset.trixAttributes)){c=JSON.parse(i);for(s in c)l=c[s],n[s]=l}return n},y=function(t){var e,n,o,i;for(n=[];t;){i=Trix.config.blockAttributes;for(e in i)o=i[e],o.parse!==!1&&a(t)===o.tagName&&(("function"==typeof o.test?o.test(t):void 0)||!o.test)&&(n.push(e),o.listAttribute&&n.push(o.listAttribute));t=t.parentNode}return n.reverse()},m=function(t){return JSON.parse(t.dataset.trixAttachment)},E=function(t){var e,n,o,i,r,s,a,c,l,d,g,m,y,v,b,A,x;for(t=w(t),n=document.implementation.createHTMLDocument(""),n.documentElement.innerHTML=t,e=n.body,i=n.head,v=i.querySelectorAll("style"),r=0,c=v.length;c>r;r++)A=v[r],e.appendChild(A);for(y=[],x=u(e);x.nextNode();)switch(m=x.currentNode,m.nodeType){case Node.ELEMENT_NODE:for(o=m,b=p.call(o.attributes),s=0,l=b.length;l>s;s++)g=b[s].name,h.call(f,g)>=0||0===g.indexOf("data-trix")||o.removeAttribute(g);break;case Node.COMMENT_NODE:y.push(m);break;case Node.TEXT_NODE:m.data.match(/^\s*$/)&&m.parentNode===e&&y.push(m)}for(a=0,d=y.length;d>a;a++)m=y[a],m.parentNode.removeChild(m);return e.innerHTML},w=function(t){return t.replace(/>\n+</g,"><").replace(/>\ +</g,"> <")},v=function(t){var e;return e=window.getComputedStyle(t),"block"===e.display?{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}:void 0},b=function(t){var e,n,o;return o=t.getAttribute("width"),n=t.getAttribute("height"),e={},o&&(e.width=parseInt(o,10)),n&&(e.height=parseInt(n,10)),e},d}(Trix.BasicObject)}.call(this),function(){var t,e,n,o=function(t,e){function n(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty,r=[].slice,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=Trix.arraysAreEqual,e=Trix.normalizeRange,n=Trix.rangeIsCollapsed,Trix.Document=function(i){function a(t){null==t&&(t=[]),a.__super__.constructor.apply(this,arguments),0===t.length&&(t=[new Trix.Block]),this.blockList=Trix.SplittableList.box(t)}var u;return o(a,i),a.fromJSON=function(t){var e,n;return n=function(){var n,o,i;for(i=[],n=0,o=t.length;o>n;n++)e=t[n],i.push(Trix.Block.fromJSON(e));return i}(),new this(n)},a.fromHTML=function(t){return Trix.HTMLParser.parse(t).getDocument()},a.fromString=function(t,e){var n;return n=Trix.Text.textForStringWithAttributes(t,e),new this([new Trix.Block(n)])},a.prototype.isEmpty=function(){var t;return 1===this.blockList.length&&(t=this.getBlockAtIndex(0),t.isEmpty()&&!t.hasAttributes())},a.prototype.copy=function(t){var e;return null==t&&(t={}),e=t.consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray(),new this.constructor(e)},a.prototype.copyUsingObjectsFromDocument=function(t){var e;return e=new Trix.ObjectMap(t.getObjects()),this.copyUsingObjectMap(e)},a.prototype.copyUsingObjectMap=function(t){var e,n,o;return n=function(){var n,i,r,s;for(r=this.getBlocks(),s=[],n=0,i=r.length;i>n;n++)e=r[n],s.push((o=t.find(e))?o:e.copyUsingObjectMap(t));return s}.call(this),new this.constructor(n)},a.prototype.copyWithBaseBlockAttributes=function(t){var e,n,o;return null==t&&(t=[]),o=function(){var o,i,r,s;for(r=this.getBlocks(),s=[],o=0,i=r.length;i>o;o++)n=r[o],e=t.concat(n.getAttributes()),s.push(n.copyWithAttributes(e));return s}.call(this),new this.constructor(o)},a.prototype.insertDocumentAtRange=function(t,o){var i,r,s,a,u,c,l;return r=t.blockList,u=(o=e(o))[0],c=this.locationFromPosition(u),s=c.index,a=c.offset,l=this,i=this.getBlockAtPosition(u),n(o)&&i.isEmpty()&&!i.hasAttributes()?l=new this.constructor(l.blockList.removeObjectAtIndex(s)):i.getBlockBreakPosition()===a&&u++,l=l.removeTextAtRange(o),new this.constructor(l.blockList.insertSplittableListAtPosition(r,u))},a.prototype.mergeDocumentAtRange=function(n,o){var i,r,s,a,u,c,l,h,p,d,f,g;return f=(o=e(o))[0],d=this.locationFromPosition(f),r=this.getBlockAtIndex(d.index).getAttributes(),i=n.getBaseBlockAttributes(),g=r.slice(-i.length),t(i,g)?(l=r.slice(0,-i.length),c=n.copyWithBaseBlockAttributes(l)):c=n.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(r),s=c.getBlockCount(),a=c.getBlockAtIndex(0),t(r,a.getAttributes())?(u=a.getTextWithoutBlockBreak(),p=this.insertTextAtRange(u,o),s>1&&(c=new this.constructor(c.getBlocks().slice(1)),h=f+u.getLength(),p=p.insertDocumentAtRange(c,h))):p=this.insertDocumentAtRange(c,o),p},a.prototype.insertTextAtRange=function(t,n){var o,i,r,s,a;return a=(n=e(n))[0],s=this.locationFromPosition(a),i=s.index,r=s.offset,o=this.removeTextAtRange(n),new this.constructor(o.blockList.editObjectAtIndex(i,function(e){return e.copyWithText(e.text.insertTextAtPosition(t,r))}))},a.prototype.removeTextAtRange=function(t){var o,i,r,s,a,u,c,l,h,p,d,f,g,m,y,v,b;return h=t=e(t),y=h[0],s=h[1],n(t)?this:(c=this.locationFromPosition(y),u=c.index,a=this.getBlockAtIndex(u),l=a.text.getTextAtRange([0,c.offset]),g=this.locationFromPosition(s),f=g.index,d=this.getBlockAtIndex(f),m=d.text.getTextAtRange([g.offset,d.getLength()]),v=l.appendText(m),p=u!==f&&0===c.offset,b=p&&a.getAttributeLevel()>=d.getAttributeLevel(),i=b?d.copyWithText(v):a.copyWithText(v),r=this.blockList.toArray(),o=f+1-u,r.splice(u,o,i),new this.constructor(r))},a.prototype.moveTextFromRangeToPosition=function(t,n){var o,i,s,a,u,c,l,h,p,d;if(c=t=e(t),p=c[0],s=c[1],n>=p&&s>=n)return this;if(i=this.getDocumentAtRange(t),h=this.removeTextAtRange(t),u=n>p,u&&(n-=i.getLength()),!h.firstBlockInRangeIsEntirelySelected(t)){if(l=i.getBlocks(),a=l[0],o=2<=l.length?r.call(l,1):[],0===o.length?(d=a.getTextWithoutBlockBreak(),u&&(n+=1)):d=a.text,h=h.insertTextAtRange(d,n),0===o.length)return h;i=new this.constructor(o),n+=d.getLength()}return h.insertDocumentAtRange(i,n)},a.prototype.addAttributeAtRange=function(t,e,n){var o;return o=this.blockList,this.eachBlockAtRange(n,function(n,i,r){return o=o.editObjectAtIndex(r,function(){return Trix.config.blockAttributes[t]?n.addAttribute(t,e):i[0]===i[1]?n:n.copyWithText(n.text.addAttributeAtRange(t,e,i))})}),new this.constructor(o)},a.prototype.addAttribute=function(t,e){var n;return n=this.blockList,this.eachBlock(function(o,i){return n=n.editObjectAtIndex(i,function(){return o.addAttribute(t,e)})}),new this.constructor(n)},a.prototype.removeAttributeAtRange=function(t,e){var n;return n=this.blockList,this.eachBlockAtRange(e,function(e,o,i){return Trix.config.blockAttributes[t]?n=n.editObjectAtIndex(i,function(){return e.removeAttribute(t)}):o[0]!==o[1]?n=n.editObjectAtIndex(i,function(){return e.copyWithText(e.text.removeAttributeAtRange(t,o))}):void 0}),new this.constructor(n)},a.prototype.updateAttributesForAttachment=function(t,e){var n,o,i,r;return i=(o=this.getRangeOfAttachment(e))[0],n=this.locationFromPosition(i).index,r=this.getTextAtIndex(n),new this.constructor(this.blockList.editObjectAtIndex(n,function(n){return n.copyWithText(r.updateAttributesForAttachment(t,e))}))},a.prototype.removeAttributeForAttachment=function(t,e){var n;return n=this.getRangeOfAttachment(e),this.removeAttributeAtRange(t,n)},a.prototype.insertBlockBreakAtRange=function(t){var n,o,i,r;return r=(t=e(t))[0],i=this.locationFromPosition(r).offset,o=this.removeTextAtRange(t),0===i&&(n=[new Trix.Block]),new this.constructor(o.blockList.insertSplittableListAtPosition(new Trix.SplittableList(n),r))},a.prototype.applyBlockAttributeAtRange=function(t,e,n){var o,i,r;return i=this.expandRangeToLineBreaksAndSplitBlocks(n),o=i.document,n=i.range,Trix.config.blockAttributes[t].listAttribute?(o=o.removeLastListAttributeAtRange(n,{exceptAttributeName:t}),r=o.convertLineBreaksToBlockBreaksInRange(n),o=r.document,n=r.range):o=o.consolidateBlocksAtRange(n),o.addAttributeAtRange(t,e,n)},a.prototype.removeLastListAttributeAtRange=function(t,e){var n;return null==e&&(e={}),n=this.blockList,this.eachBlockAtRange(t,function(t,o,i){var r;if((r=t.getLastAttribute())&&Trix.config.blockAttributes[r].listAttribute&&r!==e.exceptAttributeName)return n=n.editObjectAtIndex(i,function(){return t.removeAttribute(r)})}),new this.constructor(n)},a.prototype.firstBlockInRangeIsEntirelySelected=function(t){var n,o,i,r,s,a;return r=t=e(t),a=r[0],n=r[1],o=this.locationFromPosition(a),s=this.locationFromPosition(n),0===o.offset&&o.index<s.index?!0:o.index===s.index?(i=this.getBlockAtIndex(o.index).getLength(),0===o.offset&&s.offset===i):!1},a.prototype.expandRangeToLineBreaksAndSplitBlocks=function(t){var n,o,i,r,s,a,u,c,l;return a=t=e(t),l=a[0],r=a[1],c=this.locationFromPosition(l),i=this.locationFromPosition(r),n=this,u=n.getBlockAtIndex(c.index),null!=(c.offset=u.findLineBreakInDirectionFromPosition("backward",c.offset))&&(s=n.positionFromLocation(c),n=n.insertBlockBreakAtRange([s,s+1]),i.index+=1,i.offset-=n.getBlockAtIndex(c.index).getLength(),c.index+=1),c.offset=0,0===i.offset&&i.index>c.index?(i.index-=1,i.offset=n.getBlockAtIndex(i.index).getBlockBreakPosition()):(o=n.getBlockAtIndex(i.index),"\n"===o.text.getStringAtRange([i.offset-1,i.offset])?i.offset-=1:i.offset=o.findLineBreakInDirectionFromPosition("forward",i.offset),i.offset!==o.getBlockBreakPosition()&&(s=n.positionFromLocation(i),n=n.insertBlockBreakAtRange([s,s+1]))),l=n.positionFromLocation(c),r=n.positionFromLocation(i),t=e([l,r]),{document:n,range:t}},a.prototype.convertLineBreaksToBlockBreaksInRange=function(t){var n,o,i;return o=(t=e(t))[0],i=this.getStringAtRange(t).slice(0,-1),n=this,i.replace(/.*?\n/g,function(t){return o+=t.length,n=n.insertBlockBreakAtRange([o-1,o])}),{document:n,range:t}},a.prototype.consolidateBlocksAtRange=function(t){var n,o,i,r,s;return i=t=e(t),s=i[0],o=i[1],r=this.locationFromPosition(s).index,n=this.locationFromPosition(o).index,new this.constructor(this.blockList.consolidateFromIndexToIndex(r,n))},a.prototype.getDocumentAtRange=function(t){var n;return t=e(t),n=this.blockList.getSplittableListInRange(t).toArray(),new this.constructor(n)},a.prototype.getStringAtRange=function(t){return this.getDocumentAtRange(t).toString()},a.prototype.getBlockAtIndex=function(t){return this.blockList.getObjectAtIndex(t)},a.prototype.getBlockAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getBlockAtIndex(e)},a.prototype.getTextAtIndex=function(t){var e;return null!=(e=this.getBlockAtIndex(t))?e.text:void 0},a.prototype.getTextAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getTextAtIndex(e)},a.prototype.getPieceAtPosition=function(t){var e,n,o;return o=this.locationFromPosition(t),e=o.index,n=o.offset,this.getTextAtIndex(e).getPieceAtPosition(t)},a.prototype.getCharacterAtPosition=function(t){var e,n,o;return o=this.locationFromPosition(t),e=o.index,n=o.offset,this.getTextAtIndex(e).getStringAtRange([n,n+1])},a.prototype.getLength=function(){return this.blockList.getEndPosition()},a.prototype.getBlocks=function(){return this.blockList.toArray()},a.prototype.getBlockCount=function(){return this.blockList.length},a.prototype.getEditCount=function(){return this.editCount},a.prototype.eachBlock=function(t){return this.blockList.eachObject(t)},a.prototype.eachBlockAtRange=function(t,n){var o,i,r,s,a,u,c,l,h,p,d,f;if(u=t=e(t),d=u[0],r=u[1],p=this.locationFromPosition(d),i=this.locationFromPosition(r),p.index===i.index)return o=this.getBlockAtIndex(p.index),f=[p.offset,i.offset],n(o,f,p.index);for(h=[],a=s=c=p.index,l=i.index;l>=c?l>=s:s>=l;a=l>=c?++s:--s)(o=this.getBlockAtIndex(a))?(f=function(){switch(a){case p.index:return[p.offset,o.text.getLength()];case i.index:return[0,i.offset];default:return[0,o.text.getLength()]}}(),h.push(n(o,f,a))):h.push(void 0);return h},a.prototype.getCommonAttributesAtRange=function(t){var o,i,r;return i=(t=e(t))[0],n(t)?this.getCommonAttributesAtPosition(i):(r=[],o=[],this.eachBlockAtRange(t,function(t,e){return e[0]!==e[1]?(r.push(t.text.getCommonAttributesAtRange(e)),o.push(u(t))):void 0}),Trix.Hash.fromCommonAttributesOfObjects(r).merge(Trix.Hash.fromCommonAttributesOfObjects(o)).toObject())},a.prototype.getCommonAttributesAtPosition=function(t){var e,n,o,i,r,a,c,l,h,p;if(h=this.locationFromPosition(t),r=h.index,l=h.offset,o=this.getBlockAtIndex(r),!o)return{};i=u(o),e=o.text.getAttributesAtPosition(l),n=o.text.getAttributesAtPosition(l-1),a=function(){var t,e;t=Trix.config.textAttributes,e=[];for(c in t)p=t[c],p.inheritable&&e.push(c);return e}();for(c in n)p=n[c],(p===e[c]||s.call(a,c)>=0)&&(i[c]=p);return i},a.prototype.getRangeOfCommonAttributeAtPosition=function(t,n){var o,i,r,s,a,u,c,l,h;return a=this.locationFromPosition(n),r=a.index,s=a.offset,h=this.getTextAtIndex(r),u=h.getExpandedRangeForAttributeAtOffset(t,s),l=u[0],i=u[1],c=this.positionFromLocation({index:r,offset:l}),o=this.positionFromLocation({index:r,offset:i}),e([c,o])},a.prototype.getBaseBlockAttributes=function(){var t,e,n,o,i,r,s;for(t=this.getBlockAtIndex(0).getAttributes(),n=o=1,s=this.getBlockCount();s>=1?s>o:o>s;n=s>=1?++o:--o)e=this.getBlockAtIndex(n).getAttributes(),r=Math.min(t.length,e.length),t=function(){var n,o,s;for(s=[],i=n=0,o=r;(o>=0?o>n:n>o)&&e[i]===t[i];i=o>=0?++n:--n)s.push(e[i]);return s}();return t},u=function(t){var e,n;return n={},(e=t.getLastAttribute())&&(n[e]=!0),n},a.prototype.getAttachmentById=function(t){var e,n,o,i;for(i=this.getAttachments(),n=0,o=i.length;o>n;n++)if(e=i[n],e.id===t)return e},a.prototype.getAttachmentPieces=function(){var t;return t=[],this.blockList.eachObject(function(e){var n;return n=e.text,t=t.concat(n.getAttachmentPieces())}),t},a.prototype.getAttachments=function(){var t,e,n,o,i;for(o=this.getAttachmentPieces(),i=[],t=0,e=o.length;e>t;t++)n=o[t],i.push(n.attachment);return i},a.prototype.getRangeOfAttachment=function(t){var n,o,i,r,s,a,u;
24
+ for(r=0,s=this.blockList.toArray(),o=n=0,i=s.length;i>n;o=++n){if(a=s[o].text,u=a.getRangeOfAttachment(t))return e([r+u[0],r+u[1]]);r+=a.getLength()}},a.prototype.getAttachmentPieceForAttachment=function(t){var e,n,o,i;for(i=this.getAttachmentPieces(),e=0,n=i.length;n>e;e++)if(o=i[e],o.attachment===t)return o},a.prototype.rangeFromLocationRange=function(t){var o,i;return t=e(t),o=this.positionFromLocation(t[0]),n(t)||(i=this.positionFromLocation(t[1])),[o,null!=i?i:o]},a.prototype.locationFromPosition=function(t){var e,n;return n=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,t)),null!=n.index?n:(e=this.getBlocks(),{index:e.length-1,offset:e[e.length-1].getLength()})},a.prototype.positionFromLocation=function(t){return this.blockList.findPositionAtIndexAndOffset(t.index,t.offset)},a.prototype.locationRangeFromPosition=function(t){return e(this.locationFromPosition(t))},a.prototype.locationRangeFromRange=function(t){var n,o,i,r;if(t=e(t))return r=t[0],o=t[1],i=this.locationFromPosition(r),n=this.locationFromPosition(o),e([i,n])},a.prototype.rangeFromLocationRange=function(t){var o,i;return t=e(t),o=this.positionFromLocation(t[0]),n(t)||(i=this.positionFromLocation(t[1])),e([o,i])},a.prototype.isEqualTo=function(t){return this.blockList.isEqualTo(null!=t?t.blockList:void 0)},a.prototype.getTexts=function(){var t,e,n,o,i;for(o=this.getBlocks(),i=[],e=0,n=o.length;n>e;e++)t=o[e],i.push(t.text);return i},a.prototype.getPieces=function(){var t,e,n,o,i;for(n=[],o=this.getTexts(),t=0,e=o.length;e>t;t++)i=o[t],n.push.apply(n,i.getPieces());return n},a.prototype.getObjects=function(){return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())},a.prototype.toSerializableDocument=function(){var t;return t=[],this.blockList.eachObject(function(e){return t.push(e.copyWithText(e.text.toSerializableText()))}),new this.constructor(t)},a.prototype.toString=function(){return this.blockList.toString()},a.prototype.toJSON=function(){return this.blockList.toJSON()},a.prototype.toConsole=function(){var t;return JSON.stringify(function(){var e,n,o,i;for(o=this.blockList.toArray(),i=[],e=0,n=o.length;n>e;e++)t=o[e],i.push(JSON.parse(t.text.toConsole()));return i}.call(this))},a}(Trix.Object)}.call(this),function(){var t,e,n,o,i,r=function(t,e){function n(){this.constructor=t}for(var o in e)s.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;e=Trix.normalizeRange,o=Trix.rangesAreEqual,n=Trix.objectsAreEqual,i=Trix.summarizeArrayChange,t=Trix.extend,Trix.Composition=function(s){function a(){this.document=new Trix.Document,this.attachments=[],this.currentAttributes={},this.revision=0}return r(a,s),a.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)},a.prototype.getSnapshot=function(){return{document:this.document,selectedRange:this.getSelectedRange()}},a.prototype.loadSnapshot=function(t){var e,n,o,i;return e=t.document,i=t.selectedRange,null!=(n=this.delegate)&&"function"==typeof n.compositionWillLoadSnapshot&&n.compositionWillLoadSnapshot(),this.setDocument(null!=e?e:new Trix.Document),this.setSelection(null!=i?i:[0,0]),null!=(o=this.delegate)&&"function"==typeof o.compositionDidLoadSnapshot?o.compositionDidLoadSnapshot():void 0},a.prototype.insertText=function(t,e){var n,o,i,r;return r=(null!=e?e:{updatePosition:!0}).updatePosition,o=this.getSelectedRange(),this.setDocument(this.document.insertTextAtRange(t,o)),i=o[0],n=i+t.getLength(),r&&this.setSelection(n),this.notifyDelegateOfInsertionAtRange([i,n])},a.prototype.insertBlock=function(t){var e;return null==t&&(t=new Trix.Block),e=new Trix.Document([t]),this.insertDocument(e)},a.prototype.insertDocument=function(t){var e,n,o;return null==t&&(t=new Trix.Document),n=this.getSelectedRange(),this.setDocument(this.document.insertDocumentAtRange(t,n)),o=n[0],e=o+t.getLength(),this.setSelection(e),this.notifyDelegateOfInsertionAtRange([o,e])},a.prototype.insertString=function(t,e){var n,o;return n=this.getCurrentTextAttributes(),o=Trix.Text.textForStringWithAttributes(t,n),this.insertText(o,e)},a.prototype.insertBlockBreak=function(){var t,e,n;return e=this.getSelectedRange(),this.setDocument(this.document.insertBlockBreakAtRange(e)),n=e[0],t=n+1,this.setSelection(t),this.notifyDelegateOfInsertionAtRange([n,t])},a.prototype.breakFormattedBlock=function(){var t,e,n,o,i,r,s,a;return r=this.getPosition(),s=[r-1,r],e=this.document,a=e.locationFromPosition(r),n=a.index,i=a.offset,t=e.getBlockAtIndex(n),t.getBlockBreakPosition()===i?(e=e.removeTextAtRange(s),s=[r,r]):"\n"===t.text.getStringAtRange([i,i+1])?s=[r-1,r+1]:r+=1,o=new Trix.Document([t.removeLastAttribute().copyWithoutText()]),this.setDocument(e.insertDocumentAtRange(o,s)),this.setSelection(r)},a.prototype.insertLineBreak=function(){var t,e,n,o,i,r,s;return i=this.getSelectedRange(),s=i[0],o=i[1],r=this.document.locationFromPosition(s),n=this.document.locationFromPosition(o),t=this.document.getBlockAtIndex(n.index),t.hasAttributes()?t.isListItem()?t.isEmpty()?(this.decreaseListLevel(),this.setSelection(s)):0===r.offset?(e=new Trix.Document([t.copyWithoutText()]),this.insertDocument(e)):this.insertBlockBreak():t.isEmpty()?this.removeLastBlockAttribute():"\n"===t.text.getStringAtRange([n.offset-1,n.offset])?this.breakFormattedBlock():this.insertString("\n"):this.insertString("\n")},a.prototype.insertHTML=function(t){var e,n,o,i,r;return r=this.getPosition(),i=this.document.getLength(),e=Trix.Document.fromHTML(t),this.setDocument(this.document.mergeDocumentAtRange(e,this.getSelectedRange())),n=this.document.getLength(),o=r+(n-i),this.setSelection(o),this.notifyDelegateOfInsertionAtRange([o,o])},a.prototype.replaceHTML=function(t){var e;return e=Trix.Document.fromHTML(t).copyUsingObjectsFromDocument(this.document),this.preserveSelection(function(t){return function(){return t.setDocument(e)}}(this))},a.prototype.insertFile=function(t){var e,n;return(null!=(n=this.delegate)?n.compositionShouldAcceptFile(t):void 0)?(e=Trix.Attachment.attachmentForFile(t),this.insertAttachment(e)):void 0},a.prototype.insertAttachment=function(t){var e;return e=Trix.Text.textForAttachmentWithAttributes(t,this.currentAttributes),this.insertText(e)},a.prototype.deleteInDirection=function(t){var e,n,o,i,r,s,a;if(r=this.getSelectedRange(),a=r[0],o=r[1],i=r,n=this.getBlock(),a===o){if(s=this.document.locationFromPosition(a),"backward"===t&&0===s.offset&&n.isEmpty()&&this.canDecreaseBlockAttributeLevel())return n.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),void this.setSelection(a);i=this.getExpandedRangeInDirection(t),"backward"===t&&(e=this.getAttachmentAtRange(i))}return e?(this.editAttachment(e),!1):(this.setDocument(this.document.removeTextAtRange(i)),this.setSelection(i[0]))},a.prototype.moveTextFromRange=function(t){var e;return e=this.getSelectedRange()[0],this.setDocument(this.document.moveTextFromRangeToPosition(t,e)),this.setSelection(e)},a.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},a.prototype.removeLastBlockAttribute=function(){var t,e,n,o;return n=this.getSelectedRange(),o=n[0],e=n[1],t=this.document.getBlockAtPosition(e),this.removeCurrentAttribute(t.getLastAttribute()),this.setSelection(o)},a.prototype.hasCurrentAttribute=function(t){return null!=this.currentAttributes[t]},a.prototype.toggleCurrentAttribute=function(t){var e;return(e=!this.currentAttributes[t])?this.setCurrentAttribute(t,e):this.removeCurrentAttribute(t)},a.prototype.canSetCurrentAttribute=function(t){switch(t){case"href":return!this.selectionContainsAttachmentWithAttribute(t);default:return!0}},a.prototype.setCurrentAttribute=function(t,e){return Trix.config.blockAttributes[t]?this.setBlockAttribute(t,e):(this.setTextAttribute(t,e),this.currentAttributes[t]=e,this.notifyDelegateOfCurrentAttributesChange())},a.prototype.setTextAttribute=function(t,e){var n,o,i,r;if(o=this.getSelectedRange())return i=o[0],n=o[1],i!==n?this.setDocument(this.document.addAttributeAtRange(t,e,o)):"href"===t?(r=Trix.Text.textForStringWithAttributes(e,{href:e}),this.insertText(r)):void 0},a.prototype.setBlockAttribute=function(t,e){var n;if(n=this.getSelectedRange())return this.setDocument(this.document.applyBlockAttributeAtRange(t,e,n)),this.setSelection(n)},a.prototype.removeCurrentAttribute=function(t){return Trix.config.blockAttributes[t]?(this.removeBlockAttribute(t),this.updateCurrentAttributes()):(this.removeTextAttribute(t),delete this.currentAttributes[t],this.notifyDelegateOfCurrentAttributesChange())},a.prototype.removeTextAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},a.prototype.removeBlockAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},a.prototype.increaseBlockAttributeLevel=function(){var t,e;return(t=null!=(e=this.getBlock())?e.getLastAttribute():void 0)?this.setCurrentAttribute(t):void 0},a.prototype.decreaseBlockAttributeLevel=function(){var t,e;return(t=null!=(e=this.getBlock())?e.getLastAttribute():void 0)?this.removeCurrentAttribute(t):void 0},a.prototype.decreaseListLevel=function(){var t,e,n,o,i,r;for(r=this.getSelectedRange()[0],i=this.document.locationFromPosition(r).index,n=i,t=this.getBlock().getAttributeLevel();(e=this.document.getBlockAtIndex(n+1))&&e.isListItem()&&e.getAttributeLevel()>t;)n++;return r=this.document.positionFromLocation({index:i,offset:0}),o=this.document.positionFromLocation({index:n,offset:0}),this.setDocument(this.document.removeLastListAttributeAtRange([r,o]))},a.prototype.canIncreaseBlockAttributeLevel=function(){var t,e,n,o;if(t=this.getBlock())return n=t.getConfig("nestable"),null!=n?n:t.isListItem()&&(o=this.getPreviousBlock())?(e=t.getAttributeLevel(),o.getAttributeAtLevel(e)===t.getAttributeAtLevel(e)):void 0},a.prototype.canDecreaseBlockAttributeLevel=function(){var t;return(null!=(t=this.getBlock())?t.getAttributeLevel():void 0)>0},a.prototype.updateCurrentAttributes=function(){var t,e;return(e=this.getSelectedRange({ignoreLock:!0}))&&(t=this.document.getCommonAttributesAtRange(e),!n(t,this.currentAttributes))?(this.currentAttributes=t,this.notifyDelegateOfCurrentAttributesChange()):void 0},a.prototype.getCurrentAttributes=function(){return t.call({},this.currentAttributes)},a.prototype.getCurrentTextAttributes=function(){var t,e,n,o;t={},n=this.currentAttributes;for(e in n)o=n[e],Trix.config.textAttributes[e]&&(t[e]=o);return t},a.prototype.freezeSelection=function(){return this.setCurrentAttribute("frozen",!0)},a.prototype.thawSelection=function(){return this.removeCurrentAttribute("frozen")},a.prototype.hasFrozenSelection=function(){return this.hasCurrentAttribute("frozen")},a.proxyMethod("getSelectionManager().setLocationRangeFromPoint"),a.proxyMethod("getSelectionManager().preserveSelection"),a.proxyMethod("getSelectionManager().locationIsCursorTarget"),a.proxyMethod("getSelectionManager().selectionIsExpanded"),a.proxyMethod("delegate?.getSelectionManager"),a.prototype.setSelection=function(t){var e,n;return e=this.document.locationRangeFromRange(t),null!=(n=this.delegate)&&"function"==typeof n.compositionDidRequestChangingSelectionToLocationRange?n.compositionDidRequestChangingSelectionToLocationRange(e):void 0},a.prototype.getSelectedRange=function(){var t;return(t=this.getLocationRange())?this.document.rangeFromLocationRange(t):void 0},a.prototype.setSelectedRange=function(t){var e;return e=this.document.locationRangeFromRange(t),this.getSelectionManager().setLocationRange(e)},a.prototype.getPosition=function(){var t;return(t=this.getLocationRange())?this.document.positionFromLocation(t[0]):void 0},a.prototype.getLocationRange=function(){var t;return null!=(t=this.getSelectionManager().getLocationRange())?t:e({index:0,offset:0})},a.prototype.getExpandedRangeInDirection=function(t){var n,o,i;return o=this.getSelectedRange(),i=o[0],n=o[1],"backward"===t?i=this.translateUTF16PositionFromOffset(i,-1):n=this.translateUTF16PositionFromOffset(n,1),e([i,n])},a.prototype.moveCursorInDirection=function(t){var e,n,i,r;return this.editingAttachment?i=this.document.getRangeOfAttachment(this.editingAttachment):(r=this.getSelectedRange(),i=this.getExpandedRangeInDirection(t),n=!o(r,i)),this.setSelectedRange("backward"===t?i[0]:i[1]),n&&(e=this.getAttachmentAtRange(i))?this.editAttachment(e):void 0},a.prototype.expandSelectionInDirection=function(t){var e;return e=this.getExpandedRangeInDirection(t),this.setSelectedRange(e)},a.prototype.expandSelectionForEditing=function(){return this.hasCurrentAttribute("href")?this.expandSelectionAroundCommonAttribute("href"):void 0},a.prototype.expandSelectionAroundCommonAttribute=function(t){var e,n;return e=this.getPosition(),n=this.document.getRangeOfCommonAttributeAtPosition(t,e),this.setSelectedRange(n)},a.prototype.selectionContainsAttachmentWithAttribute=function(t){var e,n,o,i,r;if(r=this.getSelectedRange()){for(i=this.document.getDocumentAtRange(r).getAttachments(),n=0,o=i.length;o>n;n++)if(e=i[n],e.hasAttribute(t))return!0;return!1}},a.prototype.selectionIsInCursorTarget=function(){return this.editingAttachment||this.positionIsCursorTarget(this.getPosition())},a.prototype.positionIsCursorTarget=function(t){var e;return(e=this.document.locationFromPosition(t))?this.locationIsCursorTarget(e):void 0},a.prototype.getSelectedDocument=function(){var t;return(t=this.getSelectedRange())?this.document.getDocumentAtRange(t):void 0},a.prototype.getAttachments=function(){return this.attachments.slice(0)},a.prototype.refreshAttachments=function(){var t,e,n,o,r,s,a,u,c,l,h;for(n=this.document.getAttachments(),u=i(this.attachments,n),t=u.added,h=u.removed,o=0,s=h.length;s>o;o++)e=h[o],e.delegate=null,null!=(c=this.delegate)&&"function"==typeof c.compositionDidRemoveAttachment&&c.compositionDidRemoveAttachment(e);for(r=0,a=t.length;a>r;r++)e=t[r],e.delegate=this,null!=(l=this.delegate)&&"function"==typeof l.compositionDidAddAttachment&&l.compositionDidAddAttachment(e);return this.attachments=n},a.prototype.attachmentDidChangeAttributes=function(t){var e;return this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidEditAttachment?e.compositionDidEditAttachment(t):void 0},a.prototype.editAttachment=function(t){var e;if(t!==this.editingAttachment)return this.stopEditingAttachment(),this.editingAttachment=t,null!=(e=this.delegate)&&"function"==typeof e.compositionDidStartEditingAttachment?e.compositionDidStartEditingAttachment(this.editingAttachment):void 0},a.prototype.stopEditingAttachment=function(){var t;if(this.editingAttachment)return null!=(t=this.delegate)&&"function"==typeof t.compositionDidStopEditingAttachment&&t.compositionDidStopEditingAttachment(this.editingAttachment),this.editingAttachment=null},a.prototype.canEditAttachmentCaption=function(){var t;return null!=(t=this.editingAttachment)?t.isPreviewable():void 0},a.prototype.updateAttributesForAttachment=function(t,e){return this.setDocument(this.document.updateAttributesForAttachment(t,e))},a.prototype.removeAttributeForAttachment=function(t,e){return this.setDocument(this.document.removeAttributeForAttachment(t,e))},a.prototype.getPreviousBlock=function(){var t,e;return(e=this.getLocationRange())&&(t=e[0].index,t>0)?this.document.getBlockAtIndex(t-1):void 0},a.prototype.getBlock=function(){var t;return(t=this.getLocationRange())?this.document.getBlockAtIndex(t[0].index):void 0},a.prototype.getAttachmentAtRange=function(t){var e;return e=this.document.getDocumentAtRange(t),e.toString()===Trix.OBJECT_REPLACEMENT_CHARACTER+"\n"?e.getAttachments()[0]:void 0},a.prototype.notifyDelegateOfCurrentAttributesChange=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.compositionDidChangeCurrentAttributes?t.compositionDidChangeCurrentAttributes(this.currentAttributes):void 0},a.prototype.notifyDelegateOfInsertionAtRange=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionDidPerformInsertionAtRange?e.compositionDidPerformInsertionAtRange(t):void 0},a.prototype.translateUTF16PositionFromOffset=function(t,e){var n,o;return o=this.document.toUTF16String(),n=o.offsetFromUCS2Offset(t),o.offsetToUCS2Offset(n+e)},a}(Trix.BasicObject)}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.UndoManager=function(e){function n(t){this.composition=t,this.undoEntries=[],this.redoEntries=[]}var o;return t(n,e),n.prototype.recordUndoEntry=function(t,e){var n,i,r,s,a;return s=null!=e?e:{},i=s.context,n=s.consolidatable,r=this.undoEntries.slice(-1)[0],n&&o(r,t,i)?void 0:(a=this.createEntry({description:t,context:i}),this.undoEntries.push(a),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,o;return o=null!=t?t:{},n=o.description,e=o.context,{description:null!=n?n.toString():void 0,context:JSON.stringify(e),snapshot:this.composition.getSnapshot()}},o=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}(Trix.BasicObject)}.call(this),function(){Trix.Editor=function(){function t(t,e){this.composition=t,this.selectionManager=e,this.undoManager=new Trix.UndoManager(this.composition)}return t.prototype.loadDocument=function(t){return this.loadSnapshot({document:t,selectedRange:[0,0]})},t.prototype.loadHTML=function(t){return null==t&&(t=""),this.loadDocument(Trix.Document.fromHTML(t))},t.prototype.loadJSON=function(t){var e,n;return e=t.document,n=t.selectedRange,e=Trix.Document.fromJSON(e),this.loadSnapshot({document:e,selectedRange:n})},t.prototype.loadSnapshot=function(t){return this.undoManager=new Trix.UndoManager(this.composition),this.composition.loadSnapshot(t)},t.prototype.getDocument=function(){return this.composition.document},t.prototype.getSelectedDocument=function(){return this.composition.getSelectedDocument()},t.prototype.getSnapshot=function(){return this.composition.getSnapshot()},t.prototype.toJSON=function(){return this.getSnapshot()},t.prototype.deleteInDirection=function(t){return this.composition.deleteInDirection(t)},t.prototype.insertAttachment=function(t){return this.composition.insertAttachment(t)},t.prototype.insertDocument=function(t){return this.composition.insertDocument(t)},t.prototype.insertFile=function(t){return this.composition.insertFile(t)},t.prototype.insertHTML=function(t){return this.composition.insertHTML(t)},t.prototype.insertString=function(t){return this.composition.insertString(t)},t.prototype.insertText=function(t){return this.composition.insertText(t)},t.prototype.getSelectedRange=function(){return this.composition.getSelectedRange()},t.prototype.getPosition=function(){return this.composition.getPosition()},t.prototype.getClientRectAtPosition=function(t){var e;return e=this.getDocument().locationRangeFromRange([t,t+1]),this.selectionManager.getClientRectAtLocationRange(e)},t.prototype.expandSelectionInDirection=function(t){return this.composition.expandSelectionInDirection(t)},t.prototype.moveCursorInDirection=function(t){return this.composition.moveCursorInDirection(t)},t.prototype.setSelectedRange=function(t){return this.composition.setSelectedRange(t)},t.prototype.activateAttribute=function(t,e){return null==e&&(e=!0),this.composition.setCurrentAttribute(t,e)},t.prototype.attributeIsActive=function(t){return this.composition.hasCurrentAttribute(t)},t.prototype.canActivateAttribute=function(t){return this.composition.canSetCurrentAttribute(t)},t.prototype.deactivateAttribute=function(t){return this.composition.removeCurrentAttribute(t)},t.prototype.canDecreaseIndentationLevel=function(){return this.composition.canDecreaseBlockAttributeLevel()},t.prototype.canIncreaseIndentationLevel=function(){return this.composition.canIncreaseBlockAttributeLevel()},t.prototype.decreaseIndentationLevel=function(){return this.canDecreaseIndentationLevel()?this.composition.decreaseBlockAttributeLevel():void 0},t.prototype.increaseIndentationLevel=function(){return this.canIncreaseIndentationLevel()?this.composition.increaseBlockAttributeLevel():void 0},t.prototype.canRedo=function(){return this.undoManager.canRedo()},t.prototype.canUndo=function(){return this.undoManager.canUndo()},t.prototype.recordUndoEntry=function(t,e){var n,o,i;return i=null!=e?e:{},o=i.context,n=i.consolidatable,this.undoManager.recordUndoEntry(t,{context:o,consolidatable:n})},t.prototype.redo=function(){return this.canRedo()?this.undoManager.redo():void 0},t.prototype.undo=function(){return this.canUndo()?this.undoManager.undo():void 0},t}()}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.ManagedAttachment=function(e){function n(t,e){var n;this.attachmentManager=t,this.attachment=e,n=this.attachment,this.id=n.id,this.file=n.file}return t(n,e),n.prototype.remove=function(){return this.attachmentManager.requestRemovalOfAttachment(this.attachment)},n.proxyMethod("attachment.getAttribute"),n.proxyMethod("attachment.hasAttribute"),n.proxyMethod("attachment.setAttribute"),n.proxyMethod("attachment.getAttributes"),n.proxyMethod("attachment.setAttributes"),n.proxyMethod("attachment.isPending"),n.proxyMethod("attachment.isPreviewable"),n.proxyMethod("attachment.getURL"),n.proxyMethod("attachment.getHref"),n.proxyMethod("attachment.getFilename"),n.proxyMethod("attachment.getFilesize"),n.proxyMethod("attachment.getFormattedFilesize"),n.proxyMethod("attachment.getExtension"),n.proxyMethod("attachment.getContentType"),n.proxyMethod("attachment.getFile"),n.proxyMethod("attachment.setFile"),n.proxyMethod("attachment.releaseFile"),n.proxyMethod("attachment.getUploadProgress"),n.proxyMethod("attachment.setUploadProgress"),n}(Trix.BasicObject)}.call(this),function(){var t=function(t,n){function o(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return o.prototype=n.prototype,t.prototype=new o,t.__super__=n.prototype,t},e={}.hasOwnProperty;Trix.AttachmentManager=function(e){function n(t){var e,n,o;for(null==t&&(t=[]),this.managedAttachments={},n=0,o=t.length;o>n;n++)e=t[n],this.manageAttachment(e)}return t(n,e),n.prototype.getAttachments=function(){var t,e,n,o;n=this.managedAttachments,o=[];for(e in n)t=n[e],o.push(t);return o},n.prototype.manageAttachment=function(t){var e,n;return null!=(e=this.managedAttachments)[n=t.id]?e[n]:e[n]=new Trix.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}(Trix.BasicObject)}.call(this),function(){var t,e,n,o,i,r,s,a,u,c,l,h;t=Trix.elementContainsNode,e=Trix.findChildIndexOfNode,n=Trix.findClosestElementFromNode,o=Trix.findNodeFromContainerAndOffset,s=Trix.nodeIsBlockStartComment,r=Trix.nodeIsBlockContainer,a=Trix.nodeIsCursorTarget,u=Trix.nodeIsEmptyTextNode,c=Trix.nodeIsTextNode,i=Trix.nodeIsAttachmentElement,l=Trix.tagName,h=Trix.walkTree,Trix.LocationMapper=function(){function n(t){this.element=t}var o,p,d,f;return n.prototype.findLocationFromContainerAndOffset=function(n,o){var i,r,u,l,f,g;for(r=0,u=!1,l={index:0,offset:0},(i=this.findAttachmentElementParentForNode(n))&&(n=i.parentNode,o=e(i)),g=h(this.element,{usingFilter:d});g.nextNode();){if(f=g.currentNode,f===n&&c(n)){a(f)||(l.offset+=o);break}if(f.parentNode===n){if(r++===o)break}else if(!t(n,f)&&r>0)break;s(f)?(u&&l.index++,l.offset=0,u=!0):l.offset+=p(f)}return l},n.prototype.findContainerAndOffsetFromLocation=function(t){var n,o,i,s,a,u;if(0===t.index&&0===t.offset){for(n=this.element,s=0;n.firstChild;)if(n=n.firstChild,r(n)){s=1;break}return[n,s]}if(a=this.findNodeAndOffsetFromLocation(t),o=a[0],i=a[1],o){if(c(o))n=o,u=o.textContent,s=t.offset-i;else{if(n=o.parentNode,!r(n))for(;o===n.lastChild&&(o=n,n=n.parentNode,!r(n)););s=e(o),0!==t.offset&&s++}return[n,s]}},n.prototype.findNodeAndOffsetFromLocation=function(t){var e,n,o,i,r,s,u,l;for(u=0,l=this.getSignificantNodesForIndex(t.index),n=0,o=l.length;o>n;n++){if(e=l[n],i=p(e),t.offset<=u+i)if(c(e)){if(r=e,s=u,t.offset===s&&a(r))break}else r||(r=e,s=u);if(u+=i,u>t.offset)break}return[r,s]},n.prototype.findAttachmentElementParentForNode=function(t){for(;t&&t!==this.element;){if(i(t))return t;t=t.parentNode}},n.prototype.getSignificantNodesForIndex=function(t){var e,n,i,r,a;for(i=[],a=h(this.element,{usingFilter:o}),r=!1;a.nextNode();)if(n=a.currentNode,s(n)){if("undefined"!=typeof e&&null!==e?e++:e=0,e===t)r=!0;else if(r)break}else r&&i.push(n);return i},p=function(t){var e;return t.nodeType===Node.TEXT_NODE?a(t)?0:(e=t.textContent,e.length):"br"===l(t)||i(t)?1:0},o=function(t){return f(t)===NodeFilter.FILTER_ACCEPT?d(t):NodeFilter.FILTER_REJECT},f=function(t){return u(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},d=function(t){return i(t.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},n}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e=function(t,e){function o(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t},n={}.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};Trix.SelectionChangeObserver=function(n){function i(){this.run=t(this.run,this),this.update=t(this.update,this),this.selectionManagers=[]}var r,s;return e(i,n),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,o,i,r;for(i=this.selectionManagers,r=[],n=0,o=i.length;o>n;n++)e=i[n],e!==t&&r.push(e);return r}.call(this),0===this.selectionManagers.length?this.stop():void 0},i.prototype.notifySelectionManagersOfSelectionChange=function(){var t,e,n,o,i;for(n=this.selectionManagers,o=[],t=0,e=n.length;e>t;t++)i=n[t],o.push(i.selectionDidChange());return o},i.prototype.update=function(){var t;return t=s(),r(t,this.domRange)?void 0:(this.domRange=t,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},s=function(){var t;return t=window.getSelection(),t.rangeCount>0?t.getRangeAt(0):void 0},r=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}(Trix.BasicObject),null==Trix.selectionChangeObserver&&(Trix.selectionChangeObserver=new Trix.SelectionChangeObserver)}.call(this),function(){var t,e,n,o,i,r,s,a,u,c,l=function(t,e){return function(){return t.apply(e,arguments)}},h=function(t,e){function n(){this.constructor=t}for(var o in e)p.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty,d=[].slice;e=Trix.defer,t=Trix.benchmark,n=Trix.elementContainsNode,s=Trix.nodeIsCursorTarget,r=Trix.innerElementIsActive,o=Trix.handleEvent,i=Trix.handleEventOnce,a=Trix.normalizeRange,u=Trix.rangeIsCollapsed,c=Trix.rangesAreEqual,Trix.SelectionManager=function(t){function e(t){this.element=t,this.selectionDidChange=l(this.selectionDidChange,this),this.didMouseDown=l(this.didMouseDown,this),this.locationMapper=new Trix.LocationMapper(this.element),this.lockCount=0,o("mousedown",{onElement:this.element,withCallback:this.didMouseDown})}var i,p,f,g;return h(e,t),e.prototype.getLocationRange=function(t){var e,n;return null==t&&(t={}),e=t.ignoreLock?this.currentLocationRange:null!=(n=this.lockedLocationRange)?n:this.currentLocationRange},e.prototype.setLocationRange=function(t){var e;if(!this.lockedLocationRange)return t=a(t),(e=this.createDOMRangeFromLocationRange(t))?(g(e),this.updateCurrentLocationRange(t)):void 0},e.prototype.setLocationRangeFromPoint=function(t){var e;return(e=this.getLocationRangeAtPoint(t))?this.setLocationRange(e):void 0},e.prototype.getClientRectAtLocationRange=function(t){var e,n;return(e=this.createDOMRangeFromLocationRange(t))?(n=d.call(e.getClientRects()),n.slice(-1)[0]):void 0},e.prototype.locationIsCursorTarget=function(t){var e,n,o;return o=this.findNodeAndOffsetFromLocation(t),e=o[0],n=o[1],s(e)},e.prototype.lock=function(){return 0===this.lockCount++?(this.updateCurrentLocationRange(),this.lockedLocationRange=this.getLocationRange()):void 0},e.prototype.unlock=function(){var t;return 0===--this.lockCount&&(t=this.lockedLocationRange,this.lockedLocationRange=null,null!=t)?this.setLocationRange(t):void 0},e.prototype.preserveSelection=function(t){var e,n,o,i;return n=this.getSelectionEndPoints(),o=this.getLocationRange(),t(),n&&(i=this.getLocationRangeAtPoint(n[0]),e=this.getLocationRangeAtPoint(n[1]),null!=i&&null==e?e=i:null!=e&&null==i&&(i=e),null!=i&&null!=e&&(o=a([i,e]))),o?this.setLocationRange(o):void 0},e.prototype.clearSelection=function(){var t;return null!=(t=f())?t.removeAllRanges():void 0},e.prototype.selectionIsCollapsed=function(){var t;return(null!=(t=p())?t.collapsed:void 0)===!0},e.prototype.selectionIsExpanded=function(){return!this.selectionIsCollapsed()},e.proxyMethod("locationMapper.findLocationFromContainerAndOffset"),e.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"),e.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"),e.prototype.didMouseDown=function(){return this.pauseTemporarily()},e.prototype.pauseTemporarily=function(){var t,e,i,r;return this.paused=!0,e=function(t){return function(){var e,o,s;for(t.paused=!1,clearTimeout(r),o=0,s=i.length;s>o;o++)e=i[o],e.destroy();return n(document,t.element)?t.selectionDidChange():void 0}}(this),r=setTimeout(e,200),i=function(){var n,i,r,s;for(r=["mousemove","keydown"],s=[],n=0,i=r.length;i>n;n++)t=r[n],s.push(o(t,{onElement:document,withCallback:e}));return s}()},e.prototype.selectionDidChange=function(){return this.paused||r(this.element)?void 0:this.updateCurrentLocationRange()},e.prototype.updateCurrentLocationRange=function(t){var e,n;return null==t&&(t=this.createLocationRangeFromDOMRange(p())),c(t,this.currentLocationRange)?void 0:(this.currentLocationRange=t,null!=(e=this.delegate)&&"function"==typeof e.locationRangeDidChange?e.locationRangeDidChange(null!=(n=this.currentLocationRange)?n.slice(0):void 0):void 0)},e.prototype.createDOMRangeFromLocationRange=function(t){var e,n,o,i;return o=this.findContainerAndOffsetFromLocation(t[0]),n=u(t)?o:null!=(i=this.findContainerAndOffsetFromLocation(t[1]))?i:o,null!=o&&null!=n?(e=document.createRange(),e.setStart.apply(e,o),e.setEnd.apply(e,n),e):void 0},e.prototype.createLocationRangeFromDOMRange=function(t){var e,n;if(null!=t&&this.domRangeWithinElement(t)&&(n=this.findLocationFromContainerAndOffset(t.startContainer,t.startOffset)))return t.collapsed||(e=this.findLocationFromContainerAndOffset(t.endContainer,t.endOffset)),a([n,e])},e.prototype.domRangeWithinElement=function(t){return t.collapsed?n(this.element,t.startContainer):n(this.element,t.startContainer)&&n(this.element,t.endContainer)
25
+ },e.prototype.getLocationRangeAtPoint=function(t){var e,n,o,i,r,s;if(e=t[0],n=t[1],document.caretPositionFromPoint)s=document.caretPositionFromPoint(e,n),r=s.offsetNode,i=s.offset,o=document.createRange(),o.setStart(r,i);else if(document.caretRangeFromPoint)o=document.caretRangeFromPoint(e,n);else if(document.body.createTextRange)try{o=document.body.createTextRange(),o.moveToPoint(e,n),o.select()}catch(a){}return this.createLocationRangeFromDOMRange(null!=o?o:p())},e.prototype.getSelectionEndPoints=function(){var t,e,n,o,i,r;if(t=p())return o=t.getClientRects(),o.length>0?(n=o[0],r=o[o.length-1],e=[n.left,n.top+n.height/2],i=[r.right,r.top+r.height/2],[e,i]):void 0},f=function(){var t;return t=window.getSelection(),t.rangeCount>0?t:void 0},p=function(){var t;return null!=(t=f())?t.getRangeAt(0):void 0},g=function(t){var e;return e=window.getSelection(),e.removeAllRanges(),e.addRange(t),Trix.selectionChangeObserver.update()},i=function(){var t,e;return t=null!=(e=p())?e.getClientRects():void 0,(null!=t?t.length:void 0)?t:void 0},e}(Trix.BasicObject)}.call(this),function(){var t,e,n,o=function(t,e){function n(){this.constructor=t}for(var o in e)i.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty,r=[].slice;e=Trix.rangeIsCollapsed,n=Trix.rangesAreEqual,t=Trix.objectsAreEqual,Trix.EditorController=function(i){function s(t){var e,n;this.editorElement=t.editorElement,e=t.document,n=t.html,this.selectionManager=new Trix.SelectionManager(this.editorElement),this.selectionManager.delegate=this,this.composition=new Trix.Composition,this.composition.delegate=this,this.attachmentManager=new Trix.AttachmentManager(this.composition.getAttachments()),this.attachmentManager.delegate=this,this.inputController=new Trix.InputController(this.editorElement),this.inputController.delegate=this,this.inputController.responder=this.composition,this.compositionController=new Trix.CompositionController(this.editorElement,this.composition),this.compositionController.delegate=this,this.toolbarController=new Trix.ToolbarController(this.editorElement.toolbarElement),this.toolbarController.delegate=this,this.editor=new Trix.Editor(this.composition,this.selectionManager),null!=e?this.editor.loadDocument(e):this.editor.loadHTML(n)}return o(s,i),s.prototype.registerSelectionManager=function(){return Trix.selectionChangeObserver.registerSelectionManager(this.selectionManager)},s.prototype.unregisterSelectionManager=function(){return Trix.selectionChangeObserver.unregisterSelectionManager(this.selectionManager)},s.prototype.compositionDidChangeDocument=function(){return this.editorElement.notify("document-change"),this.handlingInput?void 0:this.render()},s.prototype.compositionDidChangeCurrentAttributes=function(t){return this.currentAttributes=t,this.toolbarController.updateAttributes(this.currentAttributes),this.updateCurrentActions(),this.editorElement.notify("attributes-change",{attributes:this.currentAttributes})},s.prototype.compositionDidPerformInsertionAtRange=function(t){return this.pasting?this.pastedRange=t:void 0},s.prototype.compositionShouldAcceptFile=function(t){return this.editorElement.notify("file-accept",{file:t})},s.prototype.compositionDidAddAttachment=function(t){var e;return e=this.attachmentManager.manageAttachment(t),this.editorElement.notify("attachment-add",{attachment:e})},s.prototype.compositionDidEditAttachment=function(t){var e;return this.compositionController.rerenderViewForObject(t),e=this.attachmentManager.manageAttachment(t),this.editorElement.notify("attachment-edit",{attachment:e})},s.prototype.compositionDidRemoveAttachment=function(t){var e;return e=this.attachmentManager.unmanageAttachment(t),this.editorElement.notify("attachment-remove",{attachment:e})},s.prototype.compositionDidStartEditingAttachment=function(t){var e,n;return n=this.composition.document,e=n.getRangeOfAttachment(t),this.attachmentLocationRange=n.locationRangeFromRange(e),this.compositionController.installAttachmentEditorForAttachment(t),this.selectionManager.setLocationRange(this.attachmentLocationRange)},s.prototype.compositionDidStopEditingAttachment=function(){return this.compositionController.uninstallAttachmentEditor(),this.attachmentLocationRange=null},s.prototype.compositionDidRequestChangingSelectionToLocationRange=function(t){return!this.loadingSnapshot||this.isFocused()?(this.requestedLocationRange=t,this.documentWhenLocationRangeRequested=this.composition.document,this.handlingInput?void 0:this.render()):void 0},s.prototype.compositionWillLoadSnapshot=function(){return this.loadingSnapshot=!0},s.prototype.compositionDidLoadSnapshot=function(){return this.compositionController.refreshViewCache(),this.render(),this.loadingSnapshot=!1},s.prototype.getSelectionManager=function(){return this.selectionManager},s.proxyMethod("getSelectionManager().setLocationRange"),s.proxyMethod("getSelectionManager().getLocationRange"),s.prototype.attachmentManagerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},s.prototype.compositionControllerWillSyncDocumentView=function(){return this.inputController.editorWillSyncDocumentView(),this.selectionManager.lock(),this.selectionManager.clearSelection()},s.prototype.compositionControllerDidSyncDocumentView=function(){return this.inputController.editorDidSyncDocumentView(),this.selectionManager.unlock(),this.updateCurrentActions(),this.editorElement.notify("sync")},s.prototype.compositionControllerDidRender=function(){return null!=this.requestedLocationRange&&(this.documentWhenLocationRangeRequested.isEqualTo(this.composition.document)&&this.selectionManager.setLocationRange(this.requestedLocationRange),this.composition.updateCurrentAttributes(),this.requestedLocationRange=null,this.documentWhenLocationRangeRequested=null),this.editorElement.notify("render")},s.prototype.compositionControllerDidFocus=function(){return this.toolbarController.hideDialog(),this.editorElement.notify("focus")},s.prototype.compositionControllerDidBlur=function(){return this.editorElement.notify("blur")},s.prototype.compositionControllerDidSelectAttachment=function(t){return this.composition.editAttachment(t)},s.prototype.compositionControllerDidRequestDeselectingAttachment=function(){return this.attachmentLocationRange?this.selectionManager.setLocationRange(this.attachmentLocationRange[1]):void 0},s.prototype.compositionControllerWillUpdateAttachment=function(t){return this.editor.recordUndoEntry("Edit Attachment",{context:t.id,consolidatable:!0})},s.prototype.compositionControllerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},s.prototype.inputControllerWillHandleInput=function(){return this.handlingInput=!0,this.requestedRender=!1},s.prototype.inputControllerDidRequestRender=function(){return this.requestedRender=!0},s.prototype.inputControllerDidHandleInput=function(){return this.handlingInput=!1,this.requestedRender?(this.requestedRender=!1,this.render()):void 0},s.prototype.inputControllerWillPerformTyping=function(){return this.recordTypingUndoEntry()},s.prototype.inputControllerWillCutText=function(){return this.editor.recordUndoEntry("Cut")},s.prototype.inputControllerWillPasteText=function(){return this.editor.recordUndoEntry("Paste"),this.pasting=!0},s.prototype.inputControllerDidPaste=function(t){var e;return e=this.pastedRange,this.pastedRange=null,this.pasting=null,this.editorElement.notify("paste",{pasteData:t,range:e}),this.render()},s.prototype.inputControllerWillMoveText=function(){return this.editor.recordUndoEntry("Move")},s.prototype.inputControllerWillAttachFiles=function(){return this.editor.recordUndoEntry("Drop Files")},s.prototype.inputControllerDidReceiveKeyboardCommand=function(t){return this.toolbarController.applyKeyboardCommand(t)},s.prototype.inputControllerDidStartDrag=function(){return this.locationRangeBeforeDrag=this.selectionManager.getLocationRange()},s.prototype.inputControllerDidReceiveDragOverPoint=function(t){return this.selectionManager.setLocationRangeFromPoint(t)},s.prototype.inputControllerDidCancelDrag=function(){return this.selectionManager.setLocationRange(this.locationRangeBeforeDrag),this.locationRangeBeforeDrag=null},s.prototype.locationRangeDidChange=function(t){return this.composition.updateCurrentAttributes(),this.updateCurrentActions(),this.attachmentLocationRange&&!n(this.attachmentLocationRange,t)&&this.composition.stopEditingAttachment(),this.editorElement.notify("selection-change")},s.prototype.toolbarDidClickButton=function(){return this.getLocationRange()?void 0:this.setLocationRange({index:0,offset:0})},s.prototype.toolbarDidInvokeAction=function(t){return this.invokeAction(t)},s.prototype.toolbarDidToggleAttribute=function(t){return this.recordFormattingUndoEntry(),this.composition.toggleCurrentAttribute(t),this.render(),this.editorElement.focus()},s.prototype.toolbarDidUpdateAttribute=function(t,e){return this.recordFormattingUndoEntry(),this.composition.setCurrentAttribute(t,e),this.render(),this.editorElement.focus()},s.prototype.toolbarDidRemoveAttribute=function(t){return this.recordFormattingUndoEntry(),this.composition.removeCurrentAttribute(t),this.render(),this.editorElement.focus()},s.prototype.toolbarWillShowDialog=function(){return this.composition.expandSelectionForEditing(),this.freezeSelection()},s.prototype.toolbarDidShowDialog=function(t){return this.editorElement.notify("toolbar-dialog-show",{dialogName:t})},s.prototype.toolbarDidHideDialog=function(t){return this.editorElement.focus(),this.thawSelection(),this.editorElement.notify("toolbar-dialog-hide",{dialogName:t})},s.prototype.freezeSelection=function(){return this.selectionFrozen?void 0:(this.selectionManager.lock(),this.composition.freezeSelection(),this.selectionFrozen=!0,this.render())},s.prototype.thawSelection=function(){return this.selectionFrozen?(this.composition.thawSelection(),this.selectionManager.unlock(),this.selectionFrozen=!1,this.render()):void 0},s.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")}},increaseBlockLevel:{test:function(){return this.editor.canIncreaseIndentationLevel()},perform:function(){return this.editor.increaseIndentationLevel()&&this.render()}},decreaseBlockLevel:{test:function(){return this.editor.canDecreaseIndentationLevel()},perform:function(){return this.editor.decreaseIndentationLevel()&&this.render()}}},s.prototype.canInvokeAction=function(t){var e,n;return this.actionIsExternal(t)?!0:!!(null!=(e=this.actions[t])&&null!=(n=e.test)?n.call(this):void 0)},s.prototype.invokeAction=function(t){var e,n;return this.actionIsExternal(t)?this.editorElement.notify("action-invoke",{actionName:t}):null!=(e=this.actions[t])&&null!=(n=e.perform)?n.call(this):void 0},s.prototype.actionIsExternal=function(t){return/^x-./.test(t)},s.prototype.getCurrentActions=function(){var t,e;e={};for(t in this.actions)e[t]=this.canInvokeAction(t);return e},s.prototype.updateCurrentActions=function(){var e;return e=this.getCurrentActions(),t(e,this.currentActions)?void 0:(this.currentActions=e,this.toolbarController.updateActions(this.currentActions),this.editorElement.notify("actions-change",{actions:this.currentActions}))},s.prototype.reparse=function(){return this.composition.replaceHTML(this.editorElement.innerHTML)},s.prototype.render=function(){return this.compositionController.render()},s.prototype.removeAttachment=function(t){return this.editor.recordUndoEntry("Delete Attachment"),this.composition.removeAttachment(t),this.render()},s.prototype.recordFormattingUndoEntry=function(){var t;return t=this.selectionManager.getLocationRange(),e(t)?void 0:this.editor.recordUndoEntry("Formatting",{context:this.getUndoContext(),consolidatable:!0})},s.prototype.recordTypingUndoEntry=function(){return this.editor.recordUndoEntry("Typing",{context:this.getUndoContext(this.currentAttributes),consolidatable:!0})},s.prototype.getUndoContext=function(){var t;return t=1<=arguments.length?r.call(arguments,0):[],[this.getLocationContext(),this.getTimeContext()].concat(r.call(t))},s.prototype.getLocationContext=function(){var t;return t=this.selectionManager.getLocationRange(),e(t)?t[0].index:t},s.prototype.getTimeContext=function(){return Trix.config.undoInterval>0?Math.floor((new Date).getTime()/Trix.config.undoInterval):0},s.prototype.isFocused=function(){var t;return this.editorElement===(null!=(t=this.editorElement.ownerDocument)?t.activeElement:void 0)},s}(Trix.Controller)}.call(this),function(){var t,e,n,o,i,r;i=Trix.makeElement,r=Trix.triggerEvent,n=Trix.handleEvent,o=Trix.handleEventOnce,e=Trix.defer,t=Trix.AttachmentView.attachmentSelector,Trix.registerElement("trix-editor",function(){var e,s,a,u,c,l;return u=0,e=function(t){return!document.querySelector(":focus")&&t.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===t?t.focus():void 0},c=function(t){return t.hasAttribute("contenteditable")?void 0:(t.setAttribute("contenteditable",""),o("focus",{onElement:t,withCallback:function(){return s(t)}}))},s=function(t){return a(t),l(t)},a=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},l=function(){var t;return("function"==typeof document.queryCommandSupported?document.queryCommandSupported("DefaultParagraphSeparator"):void 0)&&(t=Trix.config.blockAttributes["default"].tagName,"div"===t||"p"===t)?document.execCommand("DefaultParagraphSeparator",!1,t):void 0},{defaultCSS:"%t:empty:not(:focus)::before {\n content: attr(placeholder);\n color: graytext;\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}",trixId:{get:function(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++u),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.parentElement?(n="trix-toolbar-"+this.trixId,this.setAttribute("toolbar",n),t=i("trix-toolbar",{id:n}),this.parentElement.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.parentElement?(e="trix-input-"+this.trixId,this.setAttribute("input",e),t=i("input",{type:"hidden",id:e}),this.parentElement.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){var n;switch(t){case"document-change":this.documentChangedSinceLastRender=!0;break;case"render":this.documentChangedSinceLastRender&&(this.documentChangedSinceLastRender=!1,this.notify("change"));break;case"change":case"attachment-add":case"attachment-edit":case"attachment-remove":null!=(n=this.inputElement)&&(n.value=Trix.serializeToContentType(this,"text/html"))}return this.editorController?r("trix-"+t,{onElement:this,attributes:e}):void 0},createdCallback:function(){return c(this)},attachedCallback:function(){return e(this),null==this.editorController&&(this.editorController=new Trix.EditorController({editorElement:this,html:this.defaultValue=this.value})),this.editorController.registerSelectionManager(),this.registerResetListener(),requestAnimationFrame(function(t){return function(){return t.notify("initialize")}}(this))},detachedCallback: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);
@@ -0,0 +1,203 @@
1
+ @charset "UTF-8";
2
+ /*
3
+ Trix 0.9.0
4
+ Copyright © 2015 Basecamp, LLC
5
+ http://trix-editor.org/
6
+ */
7
+ trix-editor {
8
+ color: #111;
9
+ border: 1px solid #bbb;
10
+ border-radius: 3px;
11
+ margin: 0;
12
+ padding: 4px 8px;
13
+ min-height: 54px;
14
+ outline: none; }
15
+ trix-toolbar {
16
+ display: inline-block; }
17
+ trix-toolbar * {
18
+ box-sizing: border-box; }
19
+ trix-toolbar .button_groups {
20
+ height: 36px; }
21
+ trix-toolbar .button_group {
22
+ display: inline-block;
23
+ font-size: 0;
24
+ margin: 0 8px 0 0;
25
+ border: 1px solid #bbb;
26
+ border-top-color: #ccc;
27
+ border-bottom-color: #888;
28
+ border-radius: 5px;
29
+ overflow: hidden; }
30
+ trix-toolbar .button_group:last-of-type {
31
+ margin-right: 0; }
32
+ trix-toolbar .button_group button, trix-toolbar .button_group input[type=button] {
33
+ position: relative;
34
+ font-size: 0;
35
+ margin: 0;
36
+ height: 28px;
37
+ width: 40px;
38
+ background: #fff;
39
+ border: none;
40
+ border-bottom: 1px solid #ddd; }
41
+ trix-toolbar .button_group button::before, trix-toolbar .button_group input[type=button]::before {
42
+ display: inline-block;
43
+ position: absolute;
44
+ top: 0;
45
+ right: 0;
46
+ bottom: 0;
47
+ left: 0;
48
+ background-position: center;
49
+ background-repeat: no-repeat;
50
+ opacity: .6;
51
+ content: ""; }
52
+ trix-toolbar .button_group button.active, trix-toolbar .button_group input[type=button].active {
53
+ background: #cbeefa; }
54
+ trix-toolbar .button_group button.active::before, trix-toolbar .button_group input[type=button].active::before {
55
+ opacity: 1; }
56
+ trix-toolbar .button_group button:disabled::before, trix-toolbar .button_group input[type=button]:disabled::before {
57
+ opacity: .125; }
58
+ trix-toolbar .button_group button:not(:first-child), trix-toolbar .button_group input[type=button]:not(:first-child) {
59
+ border-left: 1px solid #ccc; }
60
+ trix-toolbar .dialogs {
61
+ position: relative; }
62
+ trix-toolbar .dialogs .dialog {
63
+ position: absolute;
64
+ top: 0;
65
+ left: 0;
66
+ right: 0;
67
+ padding: 12px 8px;
68
+ background: #fff;
69
+ box-shadow: 0 0.3rem 1rem #ccc;
70
+ border-top: 2px solid #888;
71
+ border-radius: 5px;
72
+ z-index: 5; }
73
+ trix-toolbar .dialogs .dialog input[type=button] {
74
+ font-size: 12px;
75
+ height: 24px;
76
+ padding: 1px 8px 0 8px;
77
+ width: auto;
78
+ opacity: .6; }
79
+ trix-toolbar .dialogs .dialog input[type=url], trix-toolbar .dialogs .dialog input[type=text] {
80
+ display: inline-block;
81
+ height: 26px;
82
+ font-size: 12px;
83
+ padding: 0 8px;
84
+ margin: 0 8px 0 0;
85
+ border-radius: 5px;
86
+ border: 1px solid #bbb;
87
+ background-color: #fff;
88
+ outline: none;
89
+ -webkit-appearance: none;
90
+ -moz-appearance: none; }
91
+ trix-toolbar .dialogs .dialog.link_dialog .button_group {
92
+ max-width: 25%; }
93
+ trix-toolbar .dialogs .dialog.link_dialog input[type=url] {
94
+ float: left;
95
+ width: 75%; }
96
+ trix-toolbar .button_group button.bold::before {
97
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgd2lkdGg9IjI0cHgiIHZlcnNpb249IjEuMSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BCiA8cGF0aCBpZD0iU2hhcGUiIGZpbGw9IiMwMDAiIGQ9Im0xNS42IDExLjc5YzAuOTY1LTAuNjc1IDEuNjUtMS43NjUgMS42NS0yLjc5IDAtMi4yNTUtMS43NDUtNC00LTRoLTYuMjV2MTRoNy4wNGMyLjA5NSAwIDMuNzEtMS43IDMuNzEtMy43OSAwLTEuNTItMC44NjUtMi44MTUtMi4xNS0zLjQyem0tNS42LTQuMjloM2MwLjgzIDAgMS41IDAuNjcgMS41IDEuNXMtMC42NyAxLjUtMS41IDEuNWgtM3YtM3ptMy41IDloLTMuNXYtM2gzLjVjMC44MyAwIDEuNSAwLjY3IDEuNSAxLjVzLTAuNjcgMS41LTEuNSAxLjV6Ii8%2BCjwvc3ZnPgo%3D); }
98
+ trix-toolbar .button_group button.italic::before {
99
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgd2lkdGg9IjI0cHgiIHZlcnNpb249IjEuMSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BCiA8cGF0aCBpZD0iU2hhcGUiIGZpbGw9IiMwMDAiIGQ9Im0xMCA1djNoMi4yMTVsLTMuNDMgOGgtMi43ODV2M2g4di0zaC0yLjIxNWwzLjQzLThoMi43ODV2LTNoLTh6Ii8%2BCjwvc3ZnPgo%3D); }
100
+ trix-toolbar .button_group button.link::before {
101
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8%2BCjxzdmcgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogIDxwYXRoIGQ9Ik05Ljg3OTIzNDM3LDEzLjY5NjUgQzguMjA2OTIxODgsMTIuMDI0MTg3NSA4LjIwNjkyMTg4LDkuMzAzMzc1IDkuODc5MjM0MzcsNy42MzEwNjI1IEwxMy4yNTQyMzQ0LDQuMjU2MDYyNSBDMTQuMDY0MjM0NCwzLjQ0NjA2MjUgMTUuMTQxNDIxOSwzIDE2LjI4NzIzNDQsMyBDMTcuNDMzMDQ2OSwzIDE4LjUwOTY3MTksMy40NDYwNjI1IDE5LjMyMDIzNDQsNC4yNTYwNjI1IEMyMC45OTI1NDY5LDUuOTI4Mzc1IDIwLjk5MjU0NjksOC42NDkxODc1IDE5LjMyMDIzNDQsMTAuMzIxNSBMMTcuMzU4MDU0NywxMi4wMzY1NjY3IEMxNy4wMDA4NjcyLDEyLjM5Mzc1NDIgMTYuNDIyNjE3MiwxMi4zOTM3NTQyIDE2LjA2NTQyOTcsMTIuMDM2NTY2NyBDMTUuNzA4MjQyMiwxMS42NzkzNzkyIDE1LjcwODI0MjIsMTEuMTAxMTI5MiAxNi4wNjU0Mjk3LDEwLjc0Mzk0MTcgTDE4LjAyNzYwOTQsOS4wMjg4NzUgQzE4Ljk4NzIzNDQsOC4wNjkyNSAxOC45ODcyMzQ0LDYuNTA4MzEyNSAxOC4wMjc2MDk0LDUuNTQ4Njg3NSBDMTcuNTYyOTg0NCw1LjA4NDA2MjUgMTYuOTQ0Nzk2OSw0LjgyODEyNSAxNi4yODcyMzQ0LDQuODI4MTI1IEMxNS42Mjk2NzE5LDQuODI4MTI1IDE1LjAxMjA0NjksNS4wODQwNjI1IDE0LjU0Njg1OTQsNS41NDg2ODc1IEwxMS4xNzE4NTk0LDguOTIzNjg3NSBDMTAuMjEyMjM0NCw5Ljg4MzMxMjUgMTAuMjEyMjM0NCwxMS40NDQyNSAxMS4xNzE4NTk0LDEyLjQwMzg3NSBDMTEuNTI5MDQ2OSwxMi43NjEwNjI1IDExLjUyOTA0NjksMTMuMzM5MzEyNSAxMS4xNzE4NTk0LDEzLjY5NjUgQzEwLjk5MzU0NjksMTMuODc0ODEyNSAxMC43NTk1NDY5LDEzLjk2NDI1IDEwLjUyNTU0NjksMTMuOTY0MjUgQzEwLjI5MTU0NjksMTMuOTY0MjUgMTAuMDU3NTQ2OSwxMy44NzQ4MTI1IDkuODc5MjM0MzcsMTMuNjk2NSBaIiBpZD0iU2hhcGUiIGZpbGw9IiMwMDAiPjwvcGF0aD4KICA8cGF0aCBkPSJNNC4yNTQyMzQzNywxOS40NTgzMjgxIEMyLjU4MTkyMTg3LDE3Ljc4NjAxNTYgMi41ODE5MjE4NywxNS4wNjUyMDMxIDQuMjU0MjM0MzcsMTMuMzkyODkwNiBMNi4xNzg3MjkwMSwxMS40OTAyMzQ0IEM2LjUzNTkxNjUxLDExLjEzMzA0NjkgNy4xMTQ3MjkwMSwxMS4xMzMwNDY5IDcuNDcxMzU0MDEsMTEuNDkwMjM0NCBDNy44Mjc5NzkwMSwxMS44NDc0MjE5IDcuODI4NTQxNTEsMTIuNDI1NjcxOSA3LjQ3MTM1NDAxLDEyLjc4Mjg1OTQgTDUuNTQ2ODU5MzcsMTQuNjg1NTE1NiBDNC41ODcyMzQzNywxNS42NDUxNDA2IDQuNTg3MjM0MzcsMTcuMjA2MDc4MSA1LjU0Njg1OTM3LDE4LjE2NTcwMzEgQzYuMDExNDg0MzcsMTguNjMwMzI4MSA2LjYyOTY3MTg3LDE4Ljg4NjI2NTYgNy4yODcyMzQzNywxOC44ODYyNjU2IEM3Ljk0NDc5Njg3LDE4Ljg4NjI2NTYgOC41NjI0MjE4NywxOC42MzAzMjgxIDkuMDI3NjA5MzcsMTguMTY1NzAzMSBMMTIuNDAyNjA5NCwxNC43OTA3MDMxIEMxMy4zNjIyMzQ0LDEzLjgzMTA3ODEgMTMuMzYyMjM0NCwxMi4yNzAxNDA2IDEyLjQwMjYwOTQsMTEuMzEwNTE1NiBDMTIuMDQ1NDIxOSwxMC45NTMzMjgxIDEyLjA0NTQyMTksMTAuMzc1MDc4MSAxMi40MDI2MDk0LDEwLjAxNzg5MDYgQzEyLjc1OTc5NjksOS42NjA3MDMxMiAxMy4zMzgwNDY5LDkuNjYwNzAzMTIgMTMuNjk1MjM0NCwxMC4wMTc4OTA2IEMxNS4zNjc1NDY5LDExLjY5MDIwMzEgMTUuMzY3NTQ2OSwxNC40MTEwMTU2IDEzLjY5NTIzNDQsMTYuMDgzMzI4MSBMMTAuMzIwMjM0NCwxOS40NTgzMjgxIEM5LjUxMDIzNDM3LDIwLjI2ODMyODEgOC40MzMwNDY4NywyMC43MTQzOTA2IDcuMjg3MjM0MzcsMjAuNzE0MzkwNiBDNi4xNDE0MjE4NywyMC43MTQzOTA2IDUuMDY0MjM0MzcsMjAuMjY4MzI4MSA0LjI1NDIzNDM3LDE5LjQ1ODMyODEgWiIgaWQ9IlNoYXBlIiBmaWxsPSIjMDAwIj48L3BhdGg%2BCjwvc3ZnPgo%3D); }
102
+ trix-toolbar .button_group button.strike::before {
103
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgd2lkdGg9IjI0cHgiIHZlcnNpb249IjEuMSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BCiA8cGF0aCBpZD0iUyIgZmlsbD0iIzAwMCIgZD0ibTEyLjcyOCAxNGMwLjEyMiAwLjA1NyAwLjIxNiAwLjEwNCAwLjI4MiAwLjE0MSAwLjI2MiAwLjE0NyAwLjQ1MSAwLjI5MyAwLjU3IDAuNDM2IDAuMTE4IDAuMTQ0IDAuMTc3IDAuMzEyIDAuMTc3IDAuNTAzIDAgMC4zMDctMC4xNDcgMC41NTgtMC40NDEgMC43NTItMC4yOTMgMC4xOTUtMC43NTUgMC4yOTMtMS4zODUgMC4yOTMtMC43MzEgMC0xLjUzMy0wLjEwNC0yLjQwNjYtMC4zMTItMC44NzM3LTAuMjA3LTEuNzE1Mi0wLjQ5Ni0yLjUyNDQtMC44Njd2My4zNzNjMC43NjYzIDAuMzI1IDEuNTAzOSAwLjU1NCAyLjIxMjkgMC42ODVzMS41ODYxIDAuMTk2IDIuNjMyMSAwLjE5NmMxLjI1MyAwIDIuMzQ1LTAuMTg3IDMuMjc2LTAuNTYgMC45MzEtMC4zNzQgMS42NDQtMC44OTggMi4xMzgtMS41NzJzMC43NDEtMS40NDUgMC43NDEtMi4zMTRjMC0wLjI2NC0wLjAyMS0wLjUxNS0wLjA2Mi0wLjc1NGgtNS4yMXptLTUuNDk3Ny00Yy0wLjA4MTktMC4zMzU4LTAuMTIyOS0wLjcwMjItMC4xMjI5LTEuMDk5NCAwLTEuMjkwMiAwLjUyNjQtMi4yOTYyIDEuNTc5MS0zLjAxOCAxLjA1MjgtMC43MjE3IDIuNDk5NS0xLjA4MjYgNC4zMzk1LTEuMDgyNiAxLjYyNiAwIDMuMjg0IDAuMzM1MyA0Ljk3NCAxLjAwNmwtMS4zIDIuOTIyMWMtMS40NjgtMC42MDA0LTIuNzM1LTAuOTAwNi0zLjgwMy0wLjkwMDYtMC41NTEgMC0wLjk1MiAwLjA4NjMtMS4yMDMgMC4yNTg3LTAuMjUgMC4xNzI1LTAuMzc2IDAuMzg2NS0wLjM3NiAwLjY0MTkgMCAwLjI3NDcgMC4xNiAwLjUyMDYgMC40NzggMC43Mzc4IDAuMTc5IDAuMTIxOCAwLjUzIDAuMjk5OCAxLjA1MiAwLjUzNDFoLTUuNjE3N3oiLz4KIDxwYXRoIGlkPSJQYXRoLTIiIGZpbGw9IiMwMDAiIGQ9Im0zIDEzaDE4di0yaC0xOHYyeiIvPgo8L3N2Zz4K); }
104
+ trix-toolbar .button_group button.quote::before {
105
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0ZWQgYnkgSWNvTW9vbi5pbyAtLT4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KPHBhdGggZD0iTTYgMTdoM2wyLTR2LTZoLTZ2Nmgzek0xNCAxN2gzbDItNHYtNmgtNnY2aDN6IiBmaWxsPSIjMDAwIj48L3BhdGg%2BCjwvc3ZnPgo%3D); }
106
+ trix-toolbar .button_group button.code::before {
107
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0ZWQgYnkgSWNvTW9vbi5pbyAtLT4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KPHBhdGggZD0iTTE4LjE3IDEybC0zLjE3IDMuMTcgMS40MTUgMS40MTUgNC41ODUtNC41ODUtNC41ODUtNC41ODUtMS40MTUgMS40MTUgMy4xNyAzLjE3ek01LjgzIDEybDMuMTctMy4xNy0xLjQxNS0xLjQxNS00LjU4NSA0LjU4NSA0LjU4NSA0LjU4NSAxLjQxNS0xLjQxNS0zLjE3LTMuMTd6IiBmaWxsPSIjMDAwIj48L3BhdGg%2BCjwvc3ZnPgo%3D); }
108
+ trix-toolbar .button_group button.bullets::before {
109
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgd2lkdGg9IjI0cHgiIHZlcnNpb249IjEuMSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BCiAgPHBhdGggaWQ9IlNoYXBlIiBmaWxsPSIjMDAwIiBkPSJtNCA0Yy0xLjEwNjcgMC0yIDAuODkzMy0yIDJzMC44OTMzIDIgMiAyIDItMC44OTMzIDItMi0wLjg5MzMtMi0yLTJ6bTAgNmMtMS4xMDY3IDAtMiAwLjg5My0yIDJzMC44OTMzIDIgMiAyIDItMC44OTMgMi0yLTAuODkzMy0yLTItMnptMCA2Yy0xLjEwNjcgMC0yIDAuODkzLTIgMnMwLjg5MzMgMiAyIDIgMi0wLjg5MyAyLTItMC44OTMzLTItMi0yem00IDNoMTR2LTJoLTE0djJ6bTAtNmgxNHYtMmgtMTR2MnptMC04djJoMTR2LTJoLTE0eiIvPgo8L3N2Zz4K); }
110
+ trix-toolbar .button_group button.numbers::before {
111
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0ZWQgYnkgSWNvTW9vbi5pbyAtLT4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KPHBhdGggZD0iTTIgMTdoMnYwLjVoLTF2MWgxdjAuNWgtMnYxaDN2LTRoLTN2MXpNMyA4aDF2LTRoLTJ2MWgxdjN6TTIgMTFoMS44bC0xLjggMi4xdjAuOWgzdi0xaC0xLjhsMS44LTIuMXYtMC45aC0zdjF6TTcgNXYyaDE0di0yaC0xNHpNNyAxOWgxNHYtMmgtMTR2MnpNNyAxM2gxNHYtMmgtMTR2MnoiIGZpbGw9IiMwMDAiPjwvcGF0aD4KPC9zdmc%2BCg%3D%3D); }
112
+ trix-toolbar .button_group button.block-level.decrease::before {
113
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8%2BCjxzdmcgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogIDxwYXRoIGQ9Ik0zLDE5IEwyMiwxOSBMMjIsMTcgTDMsMTcgTDMsMTkgTDMsMTkgWiBNMTAsMTMgTDIyLDEzIEwyMiwxMSBMMTAsMTEgTDEwLDEzIEwxMCwxMyBaIE0xLjcwNzEwNjc4LDEyLjc0MjY0MDcgTDQuNTM1NTMzOTEsMTUuNTcxMDY3OCBMNS45NDk3NDc0NywxNC4xNTY4NTQyIEwzLjgyODQyNzEyLDEyLjAzNTUzMzkgTDUuOTQ5NzQ3NDcsOS45MTQyMTM1NiBMNC41MzU1MzM5MSw4LjUgTDEsMTIuMDM1NTMzOSBMMS43MDcxMDY3OCwxMi43NDI2NDA3IFogTTMsNSBMMyw3IEwyMiw3IEwyMiw1IEwzLDUgWiIgaWQ9IlNoYXBlIiBmaWxsPSIjMDAwIj48L3BhdGg%2BCjwvc3ZnPgo%3D); }
114
+ trix-toolbar .button_group button.block-level.increase::before {
115
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8%2BCjxzdmcgd2lkdGg9IjI0cHgiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogIDxwYXRoIGQ9Ik0zLDE5IEwyMiwxOSBMMjIsMTcgTDMsMTcgTDMsMTkgTDMsMTkgWiBNMTAsMTMgTDIyLDEzIEwyMiwxMSBMMTAsMTEgTDEwLDEzIEwxMCwxMyBaIE0zLjEyMTMyMDM0LDEyLjAzNTUzMzkgTDEsMTQuMTU2ODU0MiBMMi40MTQyMTM1NiwxNS41NzEwNjc4IEw1Ljk0OTc0NzQ3LDEyLjAzNTUzMzkgTDUuMjQyNjQwNjksMTEuMzI4NDI3MSBMMi40MTQyMTM1Niw4LjUgTDEsOS45MTQyMTM1NiBMMy4xMjEzMjAzNCwxMi4wMzU1MzM5IFogTTMsNSBMMyw3IEwyMiw3IEwyMiw1IEwzLDUgWiIgaWQ9IlNoYXBlLUNvcHkiIGZpbGw9IiMwMDAiPjwvcGF0aD4KPC9zdmc%2BCg%3D%3D); }
116
+ trix-toolbar .button_group button.undo::before {
117
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0ZWQgYnkgSWNvTW9vbi5pbyAtLT4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KPHBhdGggZD0iTTEyLjUgOGMtMi42NDUgMC01LjA1NSAwLjk4NS02LjkgMi42bC0zLjYtMy42djloOWwtMy42MTUtMy42MTVjMS4zODUtMS4xNjUgMy4xNi0xLjg4NSA1LjExNS0xLjg4NSAzLjU0NSAwIDYuNTQ1IDIuMzA1IDcuNTk1IDUuNWwyLjM2NS0wLjc4Yy0xLjM3NS00LjE5LTUuMzEtNy4yMi05Ljk2LTcuMjJ6IiBmaWxsPSIjMDAwIj48L3BhdGg%2BCjwvc3ZnPgo%3D); }
118
+ trix-toolbar .button_group button.redo::before {
119
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0ZWQgYnkgSWNvTW9vbi5pbyAtLT4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KPHBhdGggZD0iTTE4LjM5NSAxMC42Yy0xLjg0LTEuNjE1LTQuMjUtMi42LTYuODk1LTIuNi00LjY1IDAtOC41ODUgMy4wMzAtOS45NiA3LjIybDIuMzY1IDAuNzhjMS4wNTAtMy4xOTUgNC4wNTAtNS41IDcuNTk1LTUuNSAxLjk1NSAwIDMuNzMgMC43MiA1LjExNSAxLjg4NWwtMy42MTUgMy42MTVoOXYtOWwtMy42MDUgMy42eiIgZmlsbD0iIzAwMCI%2BPC9wYXRoPgo8L3N2Zz4K); }
120
+ @charset "UTF-8";
121
+ trix-editor a[data-trix-attachment] {
122
+ color: inherit;
123
+ text-decoration: none; }
124
+ trix-editor a[data-trix-attachment]:hover, trix-editor a[data-trix-attachment]:visited:hover {
125
+ color: inherit; }
126
+ trix-editor [data-trix-mutable=true] {
127
+ -webkit-user-select: none;
128
+ -moz-user-select: none;
129
+ -ms-user-select: none;
130
+ user-select: none; }
131
+ trix-editor [data-trix-mutable=true] img {
132
+ box-shadow: 0 0 0 2px highlight; }
133
+ trix-editor .attachment {
134
+ position: relative;
135
+ display: inline-block;
136
+ max-width: 100%;
137
+ margin: 0;
138
+ padding: 0;
139
+ color: #666;
140
+ font-size: 13px; }
141
+ trix-editor .attachment .remove {
142
+ display: block;
143
+ position: absolute;
144
+ top: -12px;
145
+ right: -12px;
146
+ width: 24px;
147
+ height: 24px;
148
+ border-radius: 24px;
149
+ line-height: 22px;
150
+ font-size: 0;
151
+ color: black;
152
+ text-align: center;
153
+ text-decoration: none;
154
+ background-color: #fff;
155
+ border: 1px solid #bbb;
156
+ box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.1); }
157
+ trix-editor .attachment .remove:after {
158
+ content: '×';
159
+ font-size: 18px;
160
+ font-weight: bold;
161
+ opacity: 0.6; }
162
+ trix-editor .attachment .remove:hover:after {
163
+ opacity: 1; }
164
+ trix-editor .attachment .caption {
165
+ display: block;
166
+ margin: 4px auto 0 auto;
167
+ padding: 0;
168
+ text-align: center; }
169
+ trix-editor .attachment .caption .size:before {
170
+ content: ' · '; }
171
+ trix-editor .attachment .caption.caption-editing textarea {
172
+ width: 100%;
173
+ margin: 0;
174
+ padding: 0;
175
+ font-size: 13px;
176
+ line-height: 13px;
177
+ text-align: center;
178
+ border: none;
179
+ outline: none;
180
+ -webkit-appearance: none;
181
+ -moz-appearance: none; }
182
+ trix-editor .attachment.attachment-file {
183
+ color: #333;
184
+ line-height: 30px;
185
+ padding: 0 16px;
186
+ border: 1px solid #bbb;
187
+ border-radius: 5px; }
188
+ .trix-content blockquote {
189
+ margin: 0 0 0 5px;
190
+ padding: 0 0 0 10px;
191
+ border-left: 5px solid #ccc; }
192
+ .trix-content pre {
193
+ font-family: monospace;
194
+ font-size: 12px;
195
+ margin: 0;
196
+ padding: 10px;
197
+ white-space: pre-wrap;
198
+ background-color: #eee; }
199
+ .trix-content ul, .trix-content ol, .trix-content li {
200
+ margin: 0;
201
+ padding: 0; }
202
+ .trix-content ul li, .trix-content ol li, .trix-content li li {
203
+ margin-left: 20px; }
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: trix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Jon Moss
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: A rich text editor for everyday writing
84
+ email: me@jonathanmoss.me
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - ".gitignore"
90
+ - ".rspec"
91
+ - ".rubocop.yml"
92
+ - ".rubocop_todo.yml"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - bin/console
99
+ - bin/setup
100
+ - lib/trix.rb
101
+ - lib/trix/engine.rb
102
+ - lib/trix/form.rb
103
+ - lib/trix/version.rb
104
+ - trix.gemspec
105
+ - vendor/assets/javascripts/trix.js
106
+ - vendor/assets/stylesheets/trix.css
107
+ homepage: https://github.com/maclover7/trix
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.4.8
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: A rich text editor for everyday writing
131
+ test_files: []
132
+ has_rdoc: