bhf 1.0.0.beta7 → 1.0.0.beta8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df5bab3a565da8fcc0aabda1f9fa3864b490c5954b02e9819fc66a3f9cf9c2cd
4
- data.tar.gz: e723266e7a852d91bc30f807b0510579714f154a736510f086ce26a2919e7899
3
+ metadata.gz: b6bbdd47203f4b0d959b3b0dd1c24917fc45b34bfe6c429bb176c0682911c94c
4
+ data.tar.gz: 72ebea6353ddd3423ef0689f00fc4966d9e5da32b8d120e514f44b5b6ee09cb6
5
5
  SHA512:
6
- metadata.gz: 6e30e770e65e1a100b77e0026f1389ecf602a16121d3e2802a3949ce9a4392a8c4ae851dd23b9c449a549edba981cda2c9cace7876acd4a4d918b8175ed6e5d8
7
- data.tar.gz: 1d2341c255980df2cc3283664118b1c33c48bcb9fbc60eebf7060d54fec0df4fd9ebb68b5bf4ea48a8b86bd52c68dfaa952fc7cfd4764a973b926587d44ae066
6
+ metadata.gz: a1e1bf5fb0b3ead3f068a33d1dfcc3dc6401f7d284f1bbb0a84e6c25c63ca024fbada27d4dc56ed726d45c70dcccc75925382574eeb59c742ef72cfef7cf576b
7
+ data.tar.gz: 33fdef156345cfaadd726c7558015cb1f8d23353743ad391fb531fdcdecaa04193ecec87870ca6b2c4b687845956c9aefb6b0342e290c549aa69da9479c6b257
data/Gemfile CHANGED
@@ -1,10 +1,10 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', '>= 4.2'
3
+ gem 'rails', '>= 5.2.2.1'
4
+ gem 'sass-rails', '>= 6'
4
5
  gem 'turbolinks', '>= 2'
5
6
  gem 'kaminari', '>= 0'
6
7
  gem 'haml-rails', '>= 0'
7
- gem 'sass-rails', '>= 5'
8
8
 
9
9
 
10
10
  group :development do
data/Gemfile.lock CHANGED
@@ -1,61 +1,74 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- actioncable (5.2.0)
5
- actionpack (= 5.2.0)
4
+ actioncable (6.0.2.1)
5
+ actionpack (= 6.0.2.1)
6
6
  nio4r (~> 2.0)
7
7
  websocket-driver (>= 0.6.1)
8
- actionmailer (5.2.0)
9
- actionpack (= 5.2.0)
10
- actionview (= 5.2.0)
11
- activejob (= 5.2.0)
8
+ actionmailbox (6.0.2.1)
9
+ actionpack (= 6.0.2.1)
10
+ activejob (= 6.0.2.1)
11
+ activerecord (= 6.0.2.1)
12
+ activestorage (= 6.0.2.1)
13
+ activesupport (= 6.0.2.1)
14
+ mail (>= 2.7.1)
15
+ actionmailer (6.0.2.1)
16
+ actionpack (= 6.0.2.1)
17
+ actionview (= 6.0.2.1)
18
+ activejob (= 6.0.2.1)
12
19
  mail (~> 2.5, >= 2.5.4)
13
20
  rails-dom-testing (~> 2.0)
14
- actionpack (5.2.0)
15
- actionview (= 5.2.0)
16
- activesupport (= 5.2.0)
17
- rack (~> 2.0)
21
+ actionpack (6.0.2.1)
22
+ actionview (= 6.0.2.1)
23
+ activesupport (= 6.0.2.1)
24
+ rack (~> 2.0, >= 2.0.8)
18
25
  rack-test (>= 0.6.3)
19
26
  rails-dom-testing (~> 2.0)
20
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
21
- actionview (5.2.0)
22
- activesupport (= 5.2.0)
27
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
28
+ actiontext (6.0.2.1)
29
+ actionpack (= 6.0.2.1)
30
+ activerecord (= 6.0.2.1)
31
+ activestorage (= 6.0.2.1)
32
+ activesupport (= 6.0.2.1)
33
+ nokogiri (>= 1.8.5)
34
+ actionview (6.0.2.1)
35
+ activesupport (= 6.0.2.1)
23
36
  builder (~> 3.1)
24
37
  erubi (~> 1.4)
25
38
  rails-dom-testing (~> 2.0)
26
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
27
- activejob (5.2.0)
28
- activesupport (= 5.2.0)
39
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
40
+ activejob (6.0.2.1)
41
+ activesupport (= 6.0.2.1)
29
42
  globalid (>= 0.3.6)
30
- activemodel (5.2.0)
31
- activesupport (= 5.2.0)
32
- activerecord (5.2.0)
33
- activemodel (= 5.2.0)
34
- activesupport (= 5.2.0)
35
- arel (>= 9.0)
36
- activestorage (5.2.0)
37
- actionpack (= 5.2.0)
38
- activerecord (= 5.2.0)
43
+ activemodel (6.0.2.1)
44
+ activesupport (= 6.0.2.1)
45
+ activerecord (6.0.2.1)
46
+ activemodel (= 6.0.2.1)
47
+ activesupport (= 6.0.2.1)
48
+ activestorage (6.0.2.1)
49
+ actionpack (= 6.0.2.1)
50
+ activejob (= 6.0.2.1)
51
+ activerecord (= 6.0.2.1)
39
52
  marcel (~> 0.3.1)
40
- activesupport (5.2.0)
53
+ activesupport (6.0.2.1)
41
54
  concurrent-ruby (~> 1.0, >= 1.0.2)
42
55
  i18n (>= 0.7, < 2)
43
56
  minitest (~> 5.1)
44
57
  tzinfo (~> 1.1)
58
+ zeitwerk (~> 2.2)
45
59
  addressable (2.4.0)
46
- arel (9.0.0)
47
- builder (3.2.3)
48
- concurrent-ruby (1.0.5)
49
- crass (1.0.4)
60
+ builder (3.2.4)
61
+ concurrent-ruby (1.1.5)
62
+ crass (1.0.5)
50
63
  descendants_tracker (0.0.4)
51
64
  thread_safe (~> 0.3, >= 0.3.1)
52
- docile (1.3.0)
53
- erubi (1.7.1)
65
+ docile (1.3.2)
66
+ erubi (1.9.0)
54
67
  erubis (2.7.0)
55
68
  faraday (0.9.2)
56
69
  multipart-post (>= 1.2, < 3)
57
- ffi (1.9.23)
58
- git (1.3.0)
70
+ ffi (1.11.3)
71
+ git (1.5.0)
59
72
  github_api (0.16.0)
60
73
  addressable (~> 2.4.0)
61
74
  descendants_tracker (~> 0.0.4)
@@ -63,25 +76,25 @@ GEM
63
76
  hashie (>= 3.4)
64
77
  mime-types (>= 1.16, < 3.0)
65
78
  oauth2 (~> 1.0)
66
- globalid (0.4.1)
79
+ globalid (0.4.2)
67
80
  activesupport (>= 4.2.0)
68
- haml (5.0.4)
81
+ haml (5.1.2)
69
82
  temple (>= 0.8.0)
70
83
  tilt
71
- haml-rails (1.0.0)
72
- actionpack (>= 4.0.1)
73
- activesupport (>= 4.0.1)
84
+ haml-rails (2.0.1)
85
+ actionpack (>= 5.1)
86
+ activesupport (>= 5.1)
74
87
  haml (>= 4.0.6, < 6.0)
75
88
  html2haml (>= 1.0.1)
76
- railties (>= 4.0.1)
77
- hashie (3.5.7)
78
- highline (1.7.10)
89
+ railties (>= 5.1)
90
+ hashie (4.0.0)
91
+ highline (2.0.3)
79
92
  html2haml (2.2.0)
80
93
  erubis (~> 2.7.0)
81
94
  haml (>= 4.0, < 6)
82
95
  nokogiri (>= 1.6.0)
83
96
  ruby_parser (~> 3.5)
84
- i18n (1.0.1)
97
+ i18n (1.7.0)
85
98
  concurrent-ruby (~> 1.0)
86
99
  jeweler (2.3.9)
87
100
  builder
@@ -94,8 +107,8 @@ GEM
94
107
  rake
95
108
  rdoc
96
109
  semver2
97
- json (2.1.0)
98
- jwt (1.5.6)
110
+ json (2.3.0)
111
+ jwt (2.2.1)
99
112
  kaminari (1.1.1)
100
113
  activesupport (>= 4.1.0)
101
114
  kaminari-actionview (= 1.1.1)
@@ -108,109 +121,108 @@ GEM
108
121
  activerecord
109
122
  kaminari-core (= 1.1.1)
110
123
  kaminari-core (1.1.1)
111
- loofah (2.2.2)
124
+ loofah (2.4.0)
112
125
  crass (~> 1.0.2)
113
126
  nokogiri (>= 1.5.9)
114
- mail (2.7.0)
127
+ mail (2.7.1)
115
128
  mini_mime (>= 0.1.1)
116
- marcel (0.3.2)
129
+ marcel (0.3.3)
117
130
  mimemagic (~> 0.3.2)
118
- method_source (0.9.0)
131
+ method_source (0.9.2)
119
132
  mime-types (2.99.3)
120
- mimemagic (0.3.2)
121
- mini_mime (1.0.0)
122
- mini_portile2 (2.3.0)
123
- minitest (5.11.3)
124
- multi_json (1.13.1)
133
+ mimemagic (0.3.3)
134
+ mini_mime (1.0.2)
135
+ mini_portile2 (2.4.0)
136
+ minitest (5.13.0)
137
+ multi_json (1.14.1)
125
138
  multi_xml (0.6.0)
126
- multipart-post (2.0.0)
127
- nio4r (2.3.1)
128
- nokogiri (1.8.2)
129
- mini_portile2 (~> 2.3.0)
130
- oauth2 (1.4.0)
131
- faraday (>= 0.8, < 0.13)
132
- jwt (~> 1.0)
139
+ multipart-post (2.1.1)
140
+ nio4r (2.5.2)
141
+ nokogiri (1.10.7)
142
+ mini_portile2 (~> 2.4.0)
143
+ oauth2 (1.4.2)
144
+ faraday (>= 0.8, < 2.0)
145
+ jwt (>= 1.0, < 3.0)
133
146
  multi_json (~> 1.3)
134
147
  multi_xml (~> 0.5)
135
148
  rack (>= 1.2, < 3)
136
- psych (3.0.2)
137
- rack (2.0.5)
138
- rack-test (1.0.0)
149
+ psych (3.1.0)
150
+ rack (2.0.8)
151
+ rack-test (1.1.0)
139
152
  rack (>= 1.0, < 3)
140
- rails (5.2.0)
141
- actioncable (= 5.2.0)
142
- actionmailer (= 5.2.0)
143
- actionpack (= 5.2.0)
144
- actionview (= 5.2.0)
145
- activejob (= 5.2.0)
146
- activemodel (= 5.2.0)
147
- activerecord (= 5.2.0)
148
- activestorage (= 5.2.0)
149
- activesupport (= 5.2.0)
153
+ rails (6.0.2.1)
154
+ actioncable (= 6.0.2.1)
155
+ actionmailbox (= 6.0.2.1)
156
+ actionmailer (= 6.0.2.1)
157
+ actionpack (= 6.0.2.1)
158
+ actiontext (= 6.0.2.1)
159
+ actionview (= 6.0.2.1)
160
+ activejob (= 6.0.2.1)
161
+ activemodel (= 6.0.2.1)
162
+ activerecord (= 6.0.2.1)
163
+ activestorage (= 6.0.2.1)
164
+ activesupport (= 6.0.2.1)
150
165
  bundler (>= 1.3.0)
151
- railties (= 5.2.0)
166
+ railties (= 6.0.2.1)
152
167
  sprockets-rails (>= 2.0.0)
153
168
  rails-dom-testing (2.0.3)
154
169
  activesupport (>= 4.2.0)
155
170
  nokogiri (>= 1.6)
156
- rails-html-sanitizer (1.0.4)
157
- loofah (~> 2.2, >= 2.2.2)
158
- railties (5.2.0)
159
- actionpack (= 5.2.0)
160
- activesupport (= 5.2.0)
171
+ rails-html-sanitizer (1.3.0)
172
+ loofah (~> 2.3)
173
+ railties (6.0.2.1)
174
+ actionpack (= 6.0.2.1)
175
+ activesupport (= 6.0.2.1)
161
176
  method_source
162
177
  rake (>= 0.8.7)
163
- thor (>= 0.18.1, < 2.0)
164
- rake (12.3.1)
165
- rb-fsevent (0.10.3)
166
- rb-inotify (0.9.10)
167
- ffi (>= 0.5.0, < 2)
168
- rdoc (6.0.4)
169
- ruby_parser (3.11.0)
178
+ thor (>= 0.20.3, < 2.0)
179
+ rake (13.0.1)
180
+ rdoc (6.2.1)
181
+ ruby_parser (3.14.1)
170
182
  sexp_processor (~> 4.9)
171
- sass (3.5.6)
172
- sass-listen (~> 4.0.0)
173
- sass-listen (4.0.0)
174
- rb-fsevent (~> 0.9, >= 0.9.4)
175
- rb-inotify (~> 0.9, >= 0.9.7)
176
- sass-rails (5.0.7)
177
- railties (>= 4.0.0, < 6)
178
- sass (~> 3.1)
179
- sprockets (>= 2.8, < 4.0)
180
- sprockets-rails (>= 2.0, < 4.0)
181
- tilt (>= 1.1, < 3)
183
+ sass-rails (6.0.0)
184
+ sassc-rails (~> 2.1, >= 2.1.1)
185
+ sassc (2.2.1)
186
+ ffi (~> 1.9)
187
+ sassc-rails (2.1.2)
188
+ railties (>= 4.0.0)
189
+ sassc (>= 2.0)
190
+ sprockets (> 3.0)
191
+ sprockets-rails
192
+ tilt
182
193
  semver2 (3.4.2)
183
- sexp_processor (4.11.0)
184
- shoulda (3.5.0)
194
+ sexp_processor (4.13.0)
195
+ shoulda (3.6.0)
185
196
  shoulda-context (~> 1.0, >= 1.0.1)
186
- shoulda-matchers (>= 1.4.1, < 3.0)
197
+ shoulda-matchers (~> 3.0)
187
198
  shoulda-context (1.2.2)
188
- shoulda-matchers (2.8.0)
189
- activesupport (>= 3.0.0)
190
- simplecov (0.16.1)
199
+ shoulda-matchers (3.1.3)
200
+ activesupport (>= 4.0.0)
201
+ simplecov (0.17.1)
191
202
  docile (~> 1.1)
192
203
  json (>= 1.8, < 3)
193
204
  simplecov-html (~> 0.10.0)
194
205
  simplecov-html (0.10.2)
195
- sprockets (3.7.1)
206
+ sprockets (4.0.0)
196
207
  concurrent-ruby (~> 1.0)
197
208
  rack (> 1, < 3)
198
209
  sprockets-rails (3.2.1)
199
210
  actionpack (>= 4.0)
200
211
  activesupport (>= 4.0)
201
212
  sprockets (>= 3.0.0)
202
- temple (0.8.0)
203
- thor (0.20.0)
213
+ temple (0.8.2)
214
+ thor (1.0.1)
204
215
  thread_safe (0.3.6)
205
- tilt (2.0.8)
206
- turbolinks (5.1.1)
207
- turbolinks-source (~> 5.1)
208
- turbolinks-source (5.1.0)
209
- tzinfo (1.2.5)
216
+ tilt (2.0.10)
217
+ turbolinks (5.2.1)
218
+ turbolinks-source (~> 5.2)
219
+ turbolinks-source (5.2.0)
220
+ tzinfo (1.2.6)
210
221
  thread_safe (~> 0.1)
211
- websocket-driver (0.7.0)
222
+ websocket-driver (0.7.1)
212
223
  websocket-extensions (>= 0.1.0)
213
- websocket-extensions (0.1.3)
224
+ websocket-extensions (0.1.4)
225
+ zeitwerk (2.2.2)
214
226
 
215
227
  PLATFORMS
216
228
  ruby
@@ -220,12 +232,12 @@ DEPENDENCIES
220
232
  haml-rails
221
233
  jeweler (>= 2)
222
234
  kaminari
223
- rails (>= 4.2)
235
+ rails (>= 5.2.2.1)
224
236
  rdoc (>= 3)
225
- sass-rails (>= 5)
237
+ sass-rails (>= 6)
226
238
  shoulda (>= 3)
227
239
  simplecov
228
240
  turbolinks (>= 2)
229
241
 
230
242
  BUNDLED WITH
231
- 1.16.0
243
+ 1.17.3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.beta7
1
+ 1.0.0.beta8
@@ -3,6 +3,7 @@
3
3
  //= require ./mootools-core-1.5.0-full-compat.js
4
4
  //= require ./mootools-more-1.5.0.js
5
5
  //= require ./mootools_ujs
6
+ //= require ./trix
6
7
  //= require_tree ./locales/
7
8
  //= require_tree ./classes/
8
9
 
@@ -0,0 +1 @@
1
+ !function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/bhf-packs/",n(n.s=2)}([function(t,e){function n(t){return(n="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(r){"object"===("undefined"===typeof window?"undefined":n(window))&&(i=window)}t.exports=i},function(t,e,n){var i,r,o,s;function a(t){return(a="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}s=function(t){"use strict";var e=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){t.exports=function(t){var e=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(t,e){var n=t[0],i=t[1],r=t[2],o=t[3];i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&r|~i&o)+e[0]-680876936|0)<<7|n>>>25)+i|0)&i|~n&r)+e[1]-389564586|0)<<12|o>>>20)+n|0)&n|~o&i)+e[2]+606105819|0)<<17|r>>>15)+o|0)&o|~r&n)+e[3]-1044525330|0)<<22|i>>>10)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&r|~i&o)+e[4]-176418897|0)<<7|n>>>25)+i|0)&i|~n&r)+e[5]+1200080426|0)<<12|o>>>20)+n|0)&n|~o&i)+e[6]-1473231341|0)<<17|r>>>15)+o|0)&o|~r&n)+e[7]-45705983|0)<<22|i>>>10)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&r|~i&o)+e[8]+1770035416|0)<<7|n>>>25)+i|0)&i|~n&r)+e[9]-1958414417|0)<<12|o>>>20)+n|0)&n|~o&i)+e[10]-42063|0)<<17|r>>>15)+o|0)&o|~r&n)+e[11]-1990404162|0)<<22|i>>>10)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&r|~i&o)+e[12]+1804603682|0)<<7|n>>>25)+i|0)&i|~n&r)+e[13]-40341101|0)<<12|o>>>20)+n|0)&n|~o&i)+e[14]-1502002290|0)<<17|r>>>15)+o|0)&o|~r&n)+e[15]+1236535329|0)<<22|i>>>10)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&o|r&~o)+e[1]-165796510|0)<<5|n>>>27)+i|0)&r|i&~r)+e[6]-1069501632|0)<<9|o>>>23)+n|0)&i|n&~i)+e[11]+643717713|0)<<14|r>>>18)+o|0)&n|o&~n)+e[0]-373897302|0)<<20|i>>>12)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&o|r&~o)+e[5]-701558691|0)<<5|n>>>27)+i|0)&r|i&~r)+e[10]+38016083|0)<<9|o>>>23)+n|0)&i|n&~i)+e[15]-660478335|0)<<14|r>>>18)+o|0)&n|o&~n)+e[4]-405537848|0)<<20|i>>>12)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&o|r&~o)+e[9]+568446438|0)<<5|n>>>27)+i|0)&r|i&~r)+e[14]-1019803690|0)<<9|o>>>23)+n|0)&i|n&~i)+e[3]-187363961|0)<<14|r>>>18)+o|0)&n|o&~n)+e[8]+1163531501|0)<<20|i>>>12)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&o|r&~o)+e[13]-1444681467|0)<<5|n>>>27)+i|0)&r|i&~r)+e[2]-51403784|0)<<9|o>>>23)+n|0)&i|n&~i)+e[7]+1735328473|0)<<14|r>>>18)+o|0)&n|o&~n)+e[12]-1926607734|0)<<20|i>>>12)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i^r^o)+e[5]-378558|0)<<4|n>>>28)+i|0)^i^r)+e[8]-2022574463|0)<<11|o>>>21)+n|0)^n^i)+e[11]+1839030562|0)<<16|r>>>16)+o|0)^o^n)+e[14]-35309556|0)<<23|i>>>9)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i^r^o)+e[1]-1530992060|0)<<4|n>>>28)+i|0)^i^r)+e[4]+1272893353|0)<<11|o>>>21)+n|0)^n^i)+e[7]-155497632|0)<<16|r>>>16)+o|0)^o^n)+e[10]-1094730640|0)<<23|i>>>9)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i^r^o)+e[13]+681279174|0)<<4|n>>>28)+i|0)^i^r)+e[0]-358537222|0)<<11|o>>>21)+n|0)^n^i)+e[3]-722521979|0)<<16|r>>>16)+o|0)^o^n)+e[6]+76029189|0)<<23|i>>>9)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i^r^o)+e[9]-640364487|0)<<4|n>>>28)+i|0)^i^r)+e[12]-421815835|0)<<11|o>>>21)+n|0)^n^i)+e[15]+530742520|0)<<16|r>>>16)+o|0)^o^n)+e[2]-995338651|0)<<23|i>>>9)+r|0,i=((i+=((o=((o+=(i^((n=((n+=(r^(i|~o))+e[0]-198630844|0)<<6|n>>>26)+i|0)|~r))+e[7]+1126891415|0)<<10|o>>>22)+n|0)^((r=((r+=(n^(o|~i))+e[14]-1416354905|0)<<15|r>>>17)+o|0)|~n))+e[5]-57434055|0)<<21|i>>>11)+r|0,i=((i+=((o=((o+=(i^((n=((n+=(r^(i|~o))+e[12]+1700485571|0)<<6|n>>>26)+i|0)|~r))+e[3]-1894986606|0)<<10|o>>>22)+n|0)^((r=((r+=(n^(o|~i))+e[10]-1051523|0)<<15|r>>>17)+o|0)|~n))+e[1]-2054922799|0)<<21|i>>>11)+r|0,i=((i+=((o=((o+=(i^((n=((n+=(r^(i|~o))+e[8]+1873313359|0)<<6|n>>>26)+i|0)|~r))+e[15]-30611744|0)<<10|o>>>22)+n|0)^((r=((r+=(n^(o|~i))+e[6]-1560198380|0)<<15|r>>>17)+o|0)|~n))+e[13]+1309151649|0)<<21|i>>>11)+r|0,i=((i+=((o=((o+=(i^((n=((n+=(r^(i|~o))+e[4]-145523070|0)<<6|n>>>26)+i|0)|~r))+e[11]-1120210379|0)<<10|o>>>22)+n|0)^((r=((r+=(n^(o|~i))+e[2]+718787259|0)<<15|r>>>17)+o|0)|~n))+e[9]-343485551|0)<<21|i>>>11)+r|0,t[0]=n+t[0]|0,t[1]=i+t[1]|0,t[2]=r+t[2]|0,t[3]=o+t[3]|0}function i(t){var e,n=[];for(e=0;e<64;e+=4)n[e>>2]=t.charCodeAt(e)+(t.charCodeAt(e+1)<<8)+(t.charCodeAt(e+2)<<16)+(t.charCodeAt(e+3)<<24);return n}function r(t){var e,n=[];for(e=0;e<64;e+=4)n[e>>2]=t[e]+(t[e+1]<<8)+(t[e+2]<<16)+(t[e+3]<<24);return n}function o(t){var e,r,o,s,a,u,c=t.length,l=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=c;e+=64)n(l,i(t.substring(e-64,e)));for(r=(t=t.substring(e-64)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e=0;e<r;e+=1)o[e>>2]|=t.charCodeAt(e)<<(e%4<<3);if(o[e>>2]|=128<<(e%4<<3),e>55)for(n(l,o),e=0;e<16;e+=1)o[e]=0;return s=(s=8*c).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(s[2],16),u=parseInt(s[1],16)||0,o[14]=a,o[15]=u,n(l,o),l}function s(t){var n,i="";for(n=0;n<4;n+=1)i+=e[t>>8*n+4&15]+e[t>>8*n&15];return i}function a(t){var e;for(e=0;e<t.length;e+=1)t[e]=s(t[e]);return t.join("")}function u(t){return/[\u0080-\uFFFF]/.test(t)&&(t=unescape(encodeURIComponent(t))),t}function c(t){var e,n=[],i=t.length;for(e=0;e<i-1;e+=2)n.push(parseInt(t.substr(e,2),16));return String.fromCharCode.apply(String,n)}function l(){this.reset()}return a(o("hello")),"undefined"===typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function e(t,e){return(t=0|t||0)<0?Math.max(t+e,0):Math.min(t,e)}ArrayBuffer.prototype.slice=function(n,i){var r,o,s,a,u=this.byteLength,c=e(n,u),l=u;return i!==t&&(l=e(i,u)),c>l?new ArrayBuffer(0):(r=l-c,o=new ArrayBuffer(r),s=new Uint8Array(o),a=new Uint8Array(this,c,r),s.set(a),o)}}(),l.prototype.append=function(t){return this.appendBinary(u(t)),this},l.prototype.appendBinary=function(t){this._buff+=t,this._length+=t.length;var e,r=this._buff.length;for(e=64;e<=r;e+=64)n(this._hash,i(this._buff.substring(e-64,e)));return this._buff=this._buff.substring(e-64),this},l.prototype.end=function(t){var e,n,i=this._buff,r=i.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e<r;e+=1)o[e>>2]|=i.charCodeAt(e)<<(e%4<<3);return this._finish(o,r),n=a(this._hash),t&&(n=c(n)),this.reset(),n},l.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},l.prototype.setState=function(t){return this._buff=t.buff,this._length=t.length,this._hash=t.hash,this},l.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},l.prototype._finish=function(t,e){var i,r,o,s=e;if(t[s>>2]|=128<<(s%4<<3),s>55)for(n(this._hash,t),s=0;s<16;s+=1)t[s]=0;i=(i=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),r=parseInt(i[2],16),o=parseInt(i[1],16)||0,t[14]=r,t[15]=o,n(this._hash,t)},l.hash=function(t,e){return l.hashBinary(u(t),e)},l.hashBinary=function(t,e){var n=a(o(t));return e?c(n):n},l.ArrayBuffer=function(){this.reset()},l.ArrayBuffer.prototype.append=function(t){var e,i,o,s,a,u=(i=this._buff.buffer,o=t,s=!0,(a=new Uint8Array(i.byteLength+o.byteLength)).set(new Uint8Array(i)),a.set(new Uint8Array(o),i.byteLength),s?a:a.buffer),c=u.length;for(this._length+=t.byteLength,e=64;e<=c;e+=64)n(this._hash,r(u.subarray(e-64,e)));return this._buff=e-64<c?new Uint8Array(u.buffer.slice(e-64)):new Uint8Array(0),this},l.ArrayBuffer.prototype.end=function(t){var e,n,i=this._buff,r=i.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e<r;e+=1)o[e>>2]|=i[e]<<(e%4<<3);return this._finish(o,r),n=a(this._hash),t&&(n=c(n)),this.reset(),n},l.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l.ArrayBuffer.prototype.getState=function(){var t,e=l.prototype.getState.call(this);return e.buff=(t=e.buff,String.fromCharCode.apply(null,new Uint8Array(t))),e},l.ArrayBuffer.prototype.setState=function(t){return t.buff=function(t,e){var n,i=t.length,r=new ArrayBuffer(i),o=new Uint8Array(r);for(n=0;n<i;n+=1)o[n]=t.charCodeAt(n);return e?o:r}(t.buff,!0),l.prototype.setState.call(this,t)},l.ArrayBuffer.prototype.destroy=l.prototype.destroy,l.ArrayBuffer.prototype._finish=l.prototype._finish,l.ArrayBuffer.hash=function(t,e){var i=a(function(t){var e,i,o,s,a,u,c=t.length,l=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=c;e+=64)n(l,r(t.subarray(e-64,e)));for(t=e-64<c?t.subarray(e-64):new Uint8Array(0),i=t.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e=0;e<i;e+=1)o[e>>2]|=t[e]<<(e%4<<3);if(o[e>>2]|=128<<(e%4<<3),e>55)for(n(l,o),e=0;e<16;e+=1)o[e]=0;return s=(s=8*c).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(s[2],16),u=parseInt(s[1],16)||0,o[14]=a,o[15]=u,n(l,o),l}(new Uint8Array(t)));return e?c(i):i},l}()})),n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice,o=function(){function t(e){n(this,t),this.file=e,this.chunkSize=2097152,this.chunkCount=Math.ceil(this.file.size/this.chunkSize),this.chunkIndex=0}return i(t,null,[{key:"create",value:function(e,n){new t(e).create(n)}}]),i(t,[{key:"create",value:function(t){var n=this;this.callback=t,this.md5Buffer=new e.ArrayBuffer,this.fileReader=new FileReader,this.fileReader.addEventListener("load",(function(t){return n.fileReaderDidLoad(t)})),this.fileReader.addEventListener("error",(function(t){return n.fileReaderDidError(t)})),this.readNextChunk()}},{key:"fileReaderDidLoad",value:function(t){if(this.md5Buffer.append(t.target.result),!this.readNextChunk()){var e=this.md5Buffer.end(!0),n=btoa(e);this.callback(null,n)}}},{key:"fileReaderDidError",value:function(t){this.callback("Error reading "+this.file.name)}},{key:"readNextChunk",value:function(){if(this.chunkIndex<this.chunkCount||0==this.chunkIndex&&0==this.chunkCount){var t=this.chunkIndex*this.chunkSize,e=Math.min(t+this.chunkSize,this.file.size),n=r.call(this.file,t,e);return this.fileReader.readAsArrayBuffer(n),this.chunkIndex++,!0}return!1}}]),t}();function s(t,e){return"string"==typeof t&&(e=t,t=document),t.querySelector(e)}function a(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.disabled,r=n.bubbles,o=n.cancelable,s=n.detail,a=document.createEvent("Event");a.initEvent(e,r||!0,o||!0),a.detail=s||{};try{t.disabled=!1,t.dispatchEvent(a)}finally{t.disabled=i}return a}function u(t){return Array.isArray(t)?t:Array.from?Array.from(t):[].slice.call(t)}var c=function(){function t(e,i,r){var o=this;n(this,t),this.file=e,this.attributes={filename:e.name,content_type:e.type,byte_size:e.size,checksum:i},this.xhr=new XMLHttpRequest,this.xhr.open("POST",r,!0),this.xhr.responseType="json",this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.setRequestHeader("Accept","application/json"),this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");var a=function(t){var e=s(document.head,'meta[name="'+t+'"]');if(e)return e.getAttribute("content")}("csrf-token");void 0!=a&&this.xhr.setRequestHeader("X-CSRF-Token",a),this.xhr.addEventListener("load",(function(t){return o.requestDidLoad(t)})),this.xhr.addEventListener("error",(function(t){return o.requestDidError(t)}))}return i(t,[{key:"create",value:function(t){this.callback=t,this.xhr.send(JSON.stringify({blob:this.attributes}))}},{key:"requestDidLoad",value:function(t){if(this.status>=200&&this.status<300){var e=this.response,n=e.direct_upload;delete e.direct_upload,this.attributes=e,this.directUploadData=n,this.callback(null,this.toJSON())}else this.requestDidError(t)}},{key:"requestDidError",value:function(t){this.callback('Error creating Blob for "'+this.file.name+'". Status: '+this.status)}},{key:"toJSON",value:function(){var t={};for(var e in this.attributes)t[e]=this.attributes[e];return t}},{key:"status",get:function(){return this.xhr.status}},{key:"response",get:function(){var t=this.xhr,e=t.responseType,n=t.response;return"json"==e?n:JSON.parse(n)}}]),t}(),l=function(){function t(e){var i=this;n(this,t),this.blob=e,this.file=e.file;var r=e.directUploadData,o=r.url,s=r.headers;for(var a in this.xhr=new XMLHttpRequest,this.xhr.open("PUT",o,!0),this.xhr.responseType="text",s)this.xhr.setRequestHeader(a,s[a]);this.xhr.addEventListener("load",(function(t){return i.requestDidLoad(t)})),this.xhr.addEventListener("error",(function(t){return i.requestDidError(t)}))}return i(t,[{key:"create",value:function(t){this.callback=t,this.xhr.send(this.file.slice())}},{key:"requestDidLoad",value:function(t){var e=this.xhr,n=e.status,i=e.response;n>=200&&n<300?this.callback(null,i):this.requestDidError(t)}},{key:"requestDidError",value:function(t){this.callback('Error storing "'+this.file.name+'". Status: '+this.xhr.status)}}]),t}(),h=0,p=function(){function t(e,i,r){n(this,t),this.id=++h,this.file=e,this.url=i,this.delegate=r}return i(t,[{key:"create",value:function(t){var e=this;o.create(this.file,(function(n,i){if(n)t(n);else{var r=new c(e.file,i,e.url);d(e.delegate,"directUploadWillCreateBlobWithXHR",r.xhr),r.create((function(n){if(n)t(n);else{var i=new l(r);d(e.delegate,"directUploadWillStoreFileWithXHR",i.xhr),i.create((function(e){e?t(e):t(null,r.toJSON())}))}}))}}))}}]),t}();function d(t,e){if(t&&"function"==typeof t[e]){for(var n=arguments.length,i=Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return t[e].apply(t,i)}}var f=function(){function t(e,i){n(this,t),this.input=e,this.file=i,this.directUpload=new p(this.file,this.url,this),this.dispatch("initialize")}return i(t,[{key:"start",value:function(t){var e=this,n=document.createElement("input");n.type="hidden",n.name=this.input.name,this.input.insertAdjacentElement("beforebegin",n),this.dispatch("start"),this.directUpload.create((function(i,r){i?(n.parentNode.removeChild(n),e.dispatchError(i)):n.value=r.signed_id,e.dispatch("end"),t(i)}))}},{key:"uploadRequestDidProgress",value:function(t){var e=t.loaded/t.total*100;e&&this.dispatch("progress",{progress:e})}},{key:"dispatch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.file=this.file,e.id=this.directUpload.id,a(this.input,"direct-upload:"+t,{detail:e})}},{key:"dispatchError",value:function(t){this.dispatch("error",{error:t}).defaultPrevented||alert(t)}},{key:"directUploadWillCreateBlobWithXHR",value:function(t){this.dispatch("before-blob-request",{xhr:t})}},{key:"directUploadWillStoreFileWithXHR",value:function(t){var e=this;this.dispatch("before-storage-request",{xhr:t}),t.upload.addEventListener("progress",(function(t){return e.uploadRequestDidProgress(t)}))}},{key:"url",get:function(){return this.input.getAttribute("data-direct-upload-url")}}]),t}(),g="input[type=file][data-direct-upload-url]:not([disabled])",m=function(){function t(e){var i,r;n(this,t),this.form=e,this.inputs=(i=e,r=g,"string"==typeof i&&(r=i,i=document),u(i.querySelectorAll(r))).filter((function(t){return t.files.length}))}return i(t,[{key:"start",value:function(t){var e=this,n=this.createDirectUploadControllers();this.dispatch("start"),function i(){var r=n.shift();r?r.start((function(n){n?(t(n),e.dispatch("end")):i()})):(t(),e.dispatch("end"))}()}},{key:"createDirectUploadControllers",value:function(){var t=[];return this.inputs.forEach((function(e){u(e.files).forEach((function(n){var i=new f(e,n);t.push(i)}))})),t}},{key:"dispatch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(this.form,"direct-uploads:"+t,{detail:e})}}]),t}(),y="data-direct-uploads-processing",v=new WeakMap,b=!1;function A(){b||(b=!0,document.addEventListener("click",x,!0),document.addEventListener("submit",C),document.addEventListener("ajax:before",w))}function x(t){var e=t.target;"INPUT"!=e.tagName&&"BUTTON"!=e.tagName||"submit"!=e.type||!e.form||v.set(e.form,e)}function C(t){E(t)}function w(t){"FORM"==t.target.tagName&&E(t)}function E(t){var e=t.target;if(e.hasAttribute(y))t.preventDefault();else{var n=new m(e),i=n.inputs;i.length&&(t.preventDefault(),e.setAttribute(y,""),i.forEach(S),n.start((function(t){e.removeAttribute(y),t?i.forEach(k):function(t){var e=v.get(t)||s(t,"input[type=submit], button[type=submit]");if(e){var n=e.disabled;e.disabled=!1,e.focus(),e.click(),e.disabled=n}else(e=document.createElement("input")).type="submit",e.style.display="none",t.appendChild(e),e.click(),t.removeChild(e);v.delete(t)}(e)})))}}function S(t){t.disabled=!0}function k(t){t.disabled=!1}setTimeout((function(){window.ActiveStorage&&A()}),1),t.start=A,t.DirectUpload=p,Object.defineProperty(t,"__esModule",{value:!0})},"object"===a(e)&&"undefined"!==typeof t?s(e):(r=[e],void 0===(o="function"===typeof(i=s)?i.apply(e,r):i)||(t.exports=o))},function(t,e,n){n(3),n(8)},function(t,e,n){(function(t,i){var r,o;function s(t){return(s="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}(function(){}).call(this),function(){null==window.Set&&(window.Set=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))&&(this.values.splice(e,1),!0)},t.prototype.forEach=function(){var t;return(t=this.values).forEach.apply(t,arguments)},t}())}.call(this),function(e){function n(){}function r(t){if("object"!=s(this))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(t,this)}function o(t,e){for(;3===t._state;)t=t._value;return 0===t._state?void t._deferreds.push(e):(t._handled=!0,void d((function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var i;try{i=n(t._value)}catch(o){return void u(e.promise,o)}a(e.promise,i)}else(1===t._state?a:u)(e.promise,t._value)})))}function a(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==s(e)||"function"==typeof e)){var n=e.then;if(e instanceof r)return t._state=3,t._value=e,void c(t);if("function"==typeof n)return void h(function(t,e){return function(){t.apply(e,arguments)}}(n,e),t)}t._state=1,t._value=e,c(t)}catch(a){u(t,a)}}function u(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&setTimeout((function(){t._handled||f(t._value)}),1);for(var e=0,n=t._deferreds.length;n>e;e++)o(t,t._deferreds[e]);t._deferreds=null}function l(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function h(t,e){var n=!1;try{t((function(t){n||(n=!0,a(e,t))}),(function(t){n||(n=!0,u(e,t))}))}catch(r){if(n)return;n=!0,u(e,r)}}var p=setTimeout,d="function"==typeof t&&t||function(t){p(t,1)},f=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};r.prototype.catch=function(t){return this.then(null,t)},r.prototype.then=function(t,e){var i=new r(n);return o(this,new l(t,e,i)),i},r.all=function(t){var e=Array.prototype.slice.call(t);return new r((function(t,n){function i(o,a){try{if(a&&("object"==s(a)||"function"==typeof a)){var u=a.then;if("function"==typeof u)return void u.call(a,(function(t){i(o,t)}),n)}e[o]=a,0===--r&&t(e)}catch(l){n(l)}}if(0===e.length)return t([]);for(var r=e.length,o=0;o<e.length;o++)i(o,e[o])}))},r.resolve=function(t){return t&&"object"==s(t)&&t.constructor===r?t:new r((function(e){e(t)}))},r.reject=function(t){return new r((function(e,n){n(t)}))},r.race=function(t){return new r((function(e,n){for(var i=0,r=t.length;r>i;i++)t[i].then(e,n)}))},r._setImmediateFn=function(t){d=t},r._setUnhandledRejectionFn=function(t){f=t},i.exports?i.exports=r:e.Promise||(e.Promise=r)}(this),function(){var t="object"==s(window.customElements),e="function"==typeof document.registerElement;t||e||("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 i=e[this.name];return i&&i[0]===e?i[1]=n:t(e,this.name,{value:[e,n],writable:!0}),this},get:function(t){var e;return(e=t[this.name])&&e[0]===t?e[1]:void 0},delete:function(t){var e=t[this.name];return!(!e||e[0]!==t)&&(e[0]=e[1]=void 0,!0)},has:function(t){var e=t[this.name];return!!e&&e[0]===t}},window.WeakMap=n}(),function(t){function e(t){y.push(t),m||(m=!0,l(n))}function n(){m=!1;var t=y;y=[],t.sort((function(t,e){return t.uid_-e.uid_}));var e=!1;t.forEach((function(t){var n=t.takeRecords();(function(t){t.nodes_.forEach((function(e){var n=h.get(e);n&&n.forEach((function(e){e.observer===t&&e.removeTransientObservers()}))}))})(t),n.length&&(t.callback_(n,t),e=!0)})),e&&n()}function i(t,e){for(var n=t;n;n=n.parentNode){var i=h.get(n);if(i)for(var r=0;r<i.length;r++){var o=i[r],s=o.options;if(n===t||s.subtree){var a=e(s);a&&o.enqueue(a)}}}}function r(t){this.callback_=t,this.nodes_=[],this.records_=[],this.uid_=++v}function o(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 s(t,e){return f=new o(t,e)}function a(t){return g||((g=function(t){var e=new o(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}(f)).oldValue=t,g)}function u(t,e){return t===e?t:g&&function(t){return t===g||t===f}(t)?g:null}function c(t,e,n){this.observer=t,this.target=e,this.options=n,this.transientObservedNodes=[]}if(!t.JsMutationObserver){var l,h=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))l=setTimeout;else if(window.setImmediate)l=window.setImmediate;else{var p=[],d=String(Math.random());window.addEventListener("message",(function(t){if(t.data===d){var e=p;p=[],e.forEach((function(t){t()}))}})),l=function(t){p.push(t),window.postMessage(d,"*")}}var f,g,m=!1,y=[],v=0;r.prototype={observe:function(t,e){if(t=function(t){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(t)||t}(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 n=h.get(t);n||h.set(t,n=[]);for(var i,r=0;r<n.length;r++)if(n[r].observer===this){(i=n[r]).removeListeners(),i.options=e;break}i||(i=new c(this,t,e),n.push(i),this.nodes_.push(t)),i.addListeners()},disconnect:function(){this.nodes_.forEach((function(t){for(var e=h.get(t),n=0;n<e.length;n++){var i=e[n];if(i.observer===this){i.removeListeners(),e.splice(n,1);break}}}),this),this.records_=[]},takeRecords:function(){var t=this.records_;return this.records_=[],t}},c.prototype={enqueue:function(t){var n=this.observer.records_,i=n.length;if(n.length>0){var r=u(n[i-1],t);if(r)return void(n[i-1]=r)}else e(this.observer);n[i]=t},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(t){var e=this.options;e.attributes&&t.addEventListener("DOMAttrModified",this,!0),e.characterData&&t.addEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.addEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(t){var e=this.options;e.attributes&&t.removeEventListener("DOMAttrModified",this,!0),e.characterData&&t.removeEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.removeEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(t){if(t!==this.target){this.addListeners_(t),this.transientObservedNodes.push(t);var e=h.get(t);e||h.set(t,e=[]),e.push(this)}},removeTransientObservers:function(){var t=this.transientObservedNodes;this.transientObservedNodes=[],t.forEach((function(t){this.removeListeners_(t);for(var e=h.get(t),n=0;n<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,r=t.target;(u=new s("attributes",r)).attributeName=e,u.attributeNamespace=n;var o=t.attrChange===MutationEvent.ADDITION?null:t.prevValue;i(r,(function(t){return!t.attributes||t.attributeFilter&&t.attributeFilter.length&&-1===t.attributeFilter.indexOf(e)&&-1===t.attributeFilter.indexOf(n)?void 0:t.attributeOldValue?a(o):u}));break;case"DOMCharacterDataModified":var u=s("characterData",r=t.target);o=t.prevValue;i(r,(function(t){return t.characterData?t.characterDataOldValue?a(o):u:void 0}));break;case"DOMNodeRemoved":this.addTransientObserver(t.target);case"DOMNodeInserted":var c,l,h=t.target;"DOMNodeInserted"===t.type?(c=[h],l=[]):(c=[],l=[h]);var p=h.previousSibling,d=h.nextSibling;(u=s("childList",t.target.parentNode)).addedNodes=c,u.removedNodes=l,u.previousSibling=p,u.nextSibling=d,i(t.relatedNode,(function(t){return t.childList?u:void 0}))}f=g=void 0}},t.JsMutationObserver=r,t.MutationObserver||(t.MutationObserver=r,r._isPolyfilled=!0)}}(self),function(){"use strict";if(!window.performance||!window.performance.now){var t=Date.now();window.performance={now:function(){return Date.now()-t}}}if(window.requestAnimationFrame||(window.requestAnimationFrame=function(){var t=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame;return t?function(e){return t((function(){e(performance.now())}))}:function(t){return window.setTimeout(t,1e3/60)}}()),window.cancelAnimationFrame||(window.cancelAnimationFrame=window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(t){clearTimeout(t)}),!function(){var t=document.createEvent("Event");return t.initEvent("foo",!0,!0),t.preventDefault(),t.defaultPrevented}()){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){this.cancelable&&(e.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))}}var n=/Trident/.test(navigator.userAgent);if((!window.CustomEvent||n&&"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},window.CustomEvent.prototype=window.Event.prototype),!window.Event||n&&"function"!=typeof window.Event){var i=window.Event;window.Event=function(t,e){e=e||{};var n=document.createEvent("Event");return n.initEvent(t,Boolean(e.bubbles),Boolean(e.cancelable)),n},window.Event.prototype=i.prototype}}(window.WebComponents),window.CustomElements=window.CustomElements||{flags:{}},function(t){var e=t.flags,n=[];t.addModule=function(t){n.push(t)},t.initializeModules=function(){n.forEach((function(e){e(t)}))},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){(function t(e,n,i){var r=e.firstElementChild;if(!r)for(r=e.firstChild;r&&r.nodeType!==Node.ELEMENT_NODE;)r=r.nextSibling;for(;r;)!0!==n(r,i)&&t(r,n,i),r=r.nextElementSibling;return null})(t,(function(t){return!!e(t)||void n(t,e)})),n(t,e)}function n(t,n){for(var i=t.shadowRoot;i;)e(i,n),i=i.olderShadowRoot}var i=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";t.forDocumentTree=function(t,e){!function t(e,n,r){if(e=window.wrap(e),!(r.indexOf(e)>=0)){r.push(e);for(var o,s=e.querySelectorAll("link[rel="+i+"]"),a=0,u=s.length;u>a&&(o=s[a]);a++)o.import&&t(o.import,n,r);n(e)}}(t,e,[])},t.forSubtree=e})),window.CustomElements.addModule((function(t){function e(t,e){return n(t,e)||i(t,e)}function n(e,n){return!!t.upgrade(e,n)||void(n&&s(e))}function i(t,e){f(t,(function(t){return!!n(t,e)||void 0}))}function r(t){v.push(t),y||(y=!0,setTimeout(o))}function o(){y=!1;for(var t,e=v,n=0,i=e.length;i>n&&(t=e[n]);n++)t();v=[]}function s(t){m?r((function(){a(t)})):a(t)}function a(t){t.__upgraded__&&!t.__attached&&(t.__attached=!0,t.attachedCallback&&t.attachedCallback())}function u(t){m?r((function(){c(t)})):c(t)}function c(t){t.__upgraded__&&t.__attached&&(t.__attached=!1,t.detachedCallback&&t.detachedCallback())}function l(t,n){if(d.dom){var i=n[0];if(i&&"childList"===i.type&&i.addedNodes&&i.addedNodes){for(var r=i.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var o=r&&(r.URL||r._URL||r.host&&r.host.localName)||"";o=o.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",n.length,o||"")}var s=function(t){for(var e=t,n=window.wrap(document);e;){if(e==n)return!0;e=e.parentNode||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host}}(t);n.forEach((function(t){"childList"===t.type&&(b(t.addedNodes,(function(t){t.localName&&e(t,s)})),b(t.removedNodes,(function(t){t.localName&&function(t){u(t),f(t,(function(t){u(t)}))}(t)})))})),d.dom&&console.groupEnd()}function h(t){if(!t.__observer){var e=new MutationObserver(l.bind(this,t));e.observe(t,{childList:!0,subtree:!0}),t.__observer=e}}function p(t){t=window.wrap(t),d.dom&&console.group("upgradeDocument: ",t.baseURI.split("/").pop()),e(t,t===window.wrap(document)),h(t),d.dom&&console.groupEnd()}var d=t.flags,f=t.forSubtree,g=t.forDocumentTree,m=window.MutationObserver._isPolyfilled&&d["throttle-attached"];t.hasPolyfillMutations=m,t.hasThrottledAttached=m;var y=!1,v=[],b=Array.prototype.forEach.call.bind(Array.prototype.forEach),A=Element.prototype.createShadowRoot;A&&(Element.prototype.createShadowRoot=function(){var t=A.call(this);return window.CustomElements.watchShadow(this),t}),t.watchShadow=function(t){if(t.shadowRoot&&!t.shadowRoot.__watched){d.dom&&console.log("watching shadow-root for: ",t.localName);for(var e=t.shadowRoot;e;)h(e),e=e.olderShadowRoot}},t.upgradeDocumentTree=function(t){g(t,p)},t.upgradeDocument=p,t.upgradeSubtree=i,t.upgradeAll=e,t.attached=s,t.takeRecords=function(t){for((t=window.wrap(t))||(t=window.wrap(document));t.parentNode;)t=t.parentNode;var e=t.__observer;e&&(l(t,e.takeRecords()),o())}})),window.CustomElements.addModule((function(t){function e(e,r,o){return i.upgrade&&console.group("upgrade:",e.localName),r.is&&e.setAttribute("is",r.is),n(e,r),e.__upgraded__=!0,function(t){t.createdCallback&&t.createdCallback()}(e),o&&t.attached(e),t.upgradeSubtree(e,o),i.upgrade&&console.groupEnd(),e}function n(t,e){Object.__proto__?t.__proto__=e.prototype:(function(t,e,n){for(var i={},r=e;r!==n&&r!==HTMLElement.prototype;){for(var o,s=Object.getOwnPropertyNames(r),a=0;o=s[a];a++)i[o]||(Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o)),i[o]=1);r=Object.getPrototypeOf(r)}}(t,e.prototype,e.native),t.__proto__=e.prototype)}var i=t.flags;t.upgrade=function(n,i){if("template"===n.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(n),!n.__upgraded__&&n.nodeType===Node.ELEMENT_NODE){var r=n.getAttribute("is"),o=t.getRegisteredDefinition(n.localName)||t.getRegisteredDefinition(r);if(o&&(r&&o.tag==n.localName||!r&&!o.extends))return e(n,o,i)}},t.upgradeWithDefinition=e,t.implementPrototype=n})),window.CustomElements.addModule((function(t){function e(t){if(!t.setAttribute._polyfilled){var e=t.setAttribute;t.setAttribute=function(t,i){n.call(this,t,i,e)};var i=t.removeAttribute;t.removeAttribute=function(t){n.call(this,t,null,i)},t.setAttribute._polyfilled=!0}}function n(t,e,n){t=t.toLowerCase();var i=this.getAttribute(t);n.apply(this,arguments);var r=this.getAttribute(t);this.attributeChangedCallback&&r!==i&&this.attributeChangedCallback(t,i,r)}function i(t){return t?f[t.toLowerCase()]:void 0}function r(t){return function(){return function(t){return l(m(t.tag),t)}(t)}}function o(t,e){t&&(t=t.toLowerCase()),e&&(e=e.toLowerCase());var n,r=i(e||t);if(r){if(t==r.tag&&e==r.is)return new r.ctor;if(!e&&!r.is)return new r.ctor}return e?((n=o(t)).setAttribute("is",e),n):(n=m(t),t.indexOf("-")>=0&&h(n,HTMLElement),n)}function s(t,e){var n=t[e];t[e]=function(){var t=n.apply(this,arguments);return c(t),t}}var a,u=(t.isIE,t.upgradeDocumentTree),c=t.upgradeAll,l=t.upgradeWithDefinition,h=t.implementPrototype,p=t.useNative,d=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],f={},g="http://www.w3.org/1999/xhtml",m=document.createElement.bind(document),y=document.createElementNS.bind(document);a=Object.__proto__||p?function(t,e){return t instanceof e}:function(t,e){if(t instanceof e)return!0;for(var n=t;n;){if(n===e.prototype)return!0;n=n.__proto__}return!1},s(Node.prototype,"cloneNode"),s(document,"importNode"),document.registerElement=function(n,o){var s=o||{};if(!n)throw new Error("document.registerElement: first argument `name` must not be empty");if(n.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(n)+"'.");if(function(t){for(var e=0;e<d.length;e++)if(t===d[e])return!0}(n))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(n)+"'. The type name is invalid.");if(i(n))throw new Error("DuplicateDefinitionError: a type with name '"+String(n)+"' is already registered");return s.prototype||(s.prototype=Object.create(HTMLElement.prototype)),s.__name=n.toLowerCase(),s.extends&&(s.extends=s.extends.toLowerCase()),s.lifecycle=s.lifecycle||{},s.ancestry=function t(e){var n=i(e);return n?t(n.extends).concat([n]):[]}(s.extends),function(t){for(var e,n=t.extends,i=0;e=t.ancestry[i];i++)n=e.is&&e.tag;t.tag=n||t.__name,n&&(t.is=t.__name)}(s),function(t){if(!Object.__proto__){var e=HTMLElement.prototype;if(t.is){var n=document.createElement(t.tag);e=Object.getPrototypeOf(n)}for(var i,r=t.prototype,o=!1;r;)r==e&&(o=!0),(i=Object.getPrototypeOf(r))&&(r.__proto__=i),r=i;o||console.warn(t.tag+" prototype not found in prototype chain for "+t.is),t.native=e}}(s),e(s.prototype),function(t,e){f[t]=e}(s.__name,s),s.ctor=r(s),s.ctor.prototype=s.prototype,s.prototype.constructor=s.ctor,t.ready&&u(document),s.ctor},document.createElement=o,document.createElementNS=function(t,e,n){return t===g?o(e,n):y(t,e)},t.registry=f,t.instanceof=a,t.reservedTagList=d,t.getRegisteredDefinition=i,document.register=document.registerElement})),function(t){function e(){o(window.wrap(document)),window.CustomElements.ready=!0,(window.requestAnimationFrame||function(t){setTimeout(t,16)})((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,i=t.initializeModules;if(t.isIE,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 i();var o=t.upgradeDocumentTree,s=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&&s(wrap(t.import))}),"complete"===document.readyState||t.flags.eager)e();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var a=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(a,e)}else e()}(window.CustomElements))}.call(this),function(){}.call(this),function(){(function(){(function(){this.Trix={VERSION:"1.2.2",ZERO_WIDTH_SPACE:"\ufeff",NON_BREAKING_SPACE:"\xa0",OBJECT_REPLACEMENT_CHARACTER:"\ufffc",browser:{composesExistingText:/Android.*Chrome/.test(navigator.userAgent),forcesObjectResizing:/Trident.*rv:11/.test(navigator.userAgent),supportsInputEvents:function(){var t,e,n;if("undefined"==typeof InputEvent)return!1;for(t=0,e=(n=["data","getTargetRanges","inputType"]).length;e>t;t++)if(!(n[t]in InputEvent.prototype))return!1;return!0}()},config:{}}}).call(this)}).call(this);var t=this.Trix;(function(){(function(){t.BasicObject=function(){function t(){}var e,n,i;return t.proxyMethod=function(t){var i,r,o,s,a;return o=n(t),i=o.name,s=o.toMethod,a=o.toProperty,r=o.optional,this.prototype[i]=function(){var t,n;return t=null!=s?r?"function"==typeof this[s]?this[s]():void 0:this[s]():null!=a?this[a]:void 0,r?null!=(n=null!=t?t[i]:void 0)?e.call(n,t,arguments):void 0:(n=t[i],e.call(n,t,arguments))}},n=function(t){var e,n;if(!(n=t.match(i)))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,i=/^(.+?)(\(\))?(\?)?\.(.+?)$/,t}()}).call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.Object=function(n){function i(){this.id=++r}var r;return e(i,n),r=0,i.fromJSONString=function(t){return this.fromJSON(JSON.parse(t))},i.prototype.hasSameConstructorAs=function(t){return this.constructor===(null!=t?t.constructor:void 0)},i.prototype.isEqualTo=function(t){return this===t},i.prototype.inspect=function(){var t,e,n;return t=function(){var t,i,r;for(e in r=[],i=null!=(t=this.contentsForInspection())?t:{})n=i[e],r.push(e+"="+n);return r}.call(this),"#<"+this.constructor.name+":"+this.id+(t.length?" "+t.join(", "):"")+">"},i.prototype.contentsForInspection=function(){},i.prototype.toJSONString=function(){return JSON.stringify(this)},i.prototype.toUTF16String=function(){return t.UTF16String.box(this)},i.prototype.getCacheKey=function(){return this.id.toString()},i}(t.BasicObject)}.call(this),function(){t.extend=function(t){var e,n;for(e in t)n=t[e],this[e]=n;return this}}.call(this),function(){t.extend({defer:function(t){return setTimeout(t,1)}})}.call(this),function(){var e,n;t.extend({normalizeSpaces:function(e){return e.replace(RegExp(""+t.ZERO_WIDTH_SPACE,"g"),"").replace(RegExp(""+t.NON_BREAKING_SPACE,"g")," ")},normalizeNewlines:function(t){return t.replace(/\r\n/g,"\n")},breakableWhitespacePattern:RegExp("[^\\S"+t.NON_BREAKING_SPACE+"]"),squishBreakableWhitespace:function(e){return e.replace(RegExp(""+t.breakableWhitespacePattern.source,"g")," ").replace(/\ {2,}/g," ")},escapeHTML:function(t){var e;return(e=document.createElement("div")).textContent=t,e.innerHTML},summarizeStringChange:function(e,i){var r,o,s,a;return e=t.UTF16String.box(e),(i=t.UTF16String.box(i)).length<e.length?(a=(o=n(e,i))[0],r=o[1]):(r=(s=n(i,e))[0],a=s[1]),{added:r,removed:a}}}),n=function(n,i){var r,o,s,a,u;return n.isEqualTo(i)?["",""]:(s=(a=(o=e(n,i)).utf16String.length)?(u=o.offset,r=n.codepoints.slice(0,u).concat(n.codepoints.slice(u+a)),e(i,t.UTF16String.fromCodepoints(r))):e(i,n),[o.utf16String.toString(),s.utf16String.toString()])},e=function(t,e){var n,i,r;for(n=0,i=t.length,r=e.length;i>n&&t.charAt(n).isEqualTo(e.charAt(n));)n++;for(;i>n+1&&t.charAt(i-1).isEqualTo(e.charAt(r-1));)i--,r--;return{utf16String:t.slice(n,i),offset:n}}}.call(this),function(){t.extend({copyObject:function(t){var e,n,i;for(e in null==t&&(t={}),n={},t)i=t[e],n[e]=i;return n},objectsAreEqual:function(t,e){var n;if(null==t&&(t={}),null==e&&(e={}),Object.keys(t).length!==Object.keys(e).length)return!1;for(n in t)if(t[n]!==e[n])return!1;return!0}})}.call(this),function(){var e=[].slice;t.extend({arraysAreEqual:function(t,e){var n,i,r;if(null==t&&(t=[]),null==e&&(e=[]),t.length!==e.length)return!1;for(i=n=0,r=t.length;r>n;i=++n)if(t[i]!==e[i])return!1;return!0},arrayStartsWith:function(e,n){return null==e&&(e=[]),null==n&&(n=[]),t.arraysAreEqual(e.slice(0,n.length),n)},spliceArray:function(){var t,n,i;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],(i=n.slice(0)).splice.apply(i,t),i},summarizeArrayChange:function(t,e){var n,i,r,o,s,a,u,c,l,h,p;for(null==t&&(t=[]),null==e&&(e=[]),n=[],h=[],r=new Set,o=0,u=t.length;u>o;o++)p=t[o],r.add(p);for(i=new Set,s=0,c=e.length;c>s;s++)p=e[s],i.add(p),r.has(p)||n.push(p);for(a=0,l=t.length;l>a;a++)p=t[a],i.has(p)||h.push(p);return{added:n,removed:h}}})}.call(this),function(){var e,n,i,r;e=null,n=null,r=null,i=null,t.extend({getAllAttributeNames:function(){return null!=e?e:e=t.getTextAttributeNames().concat(t.getBlockAttributeNames())},getBlockConfig:function(e){return t.config.blockAttributes[e]},getBlockAttributeNames:function(){return null!=n?n:n=Object.keys(t.config.blockAttributes)},getTextConfig:function(e){return t.config.textAttributes[e]},getTextAttributeNames:function(){return null!=r?r:r=Object.keys(t.config.textAttributes)},getListAttributeNames:function(){var e,n;return null!=i?i:i=function(){var i,r;for(e in r=[],i=t.config.blockAttributes)null!=(n=i[e].listAttribute)&&r.push(n);return r}()}})}.call(this),function(){var e,n,i,r,o,a=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};e=document.documentElement,n=null!=(i=null!=(r=null!=(o=e.matchesSelector)?o:e.webkitMatchesSelector)?r:e.msMatchesSelector)?i:e.mozMatchesSelector,t.extend({handleEvent:function(n,i){var r,o,s,a,u,c,l,h,p,d,f;return u=(l=null!=i?i:{}).onElement,a=l.matchingSelector,f=l.withCallback,s=l.inPhase,c=l.preventDefault,p=l.times,r=null!=u?u:e,h=a,f,d="capturing"===s,(o=function(e){var n;return null!=p&&0===--p&&o.destroy(),null!=(n=t.findClosestElementFromNode(e.target,{matchingSelector:h}))&&(null!=f&&f.call(n,e,n),c)?e.preventDefault():void 0}).destroy=function(){return r.removeEventListener(n,o,d)},r.addEventListener(n,o,d),o},handleEventOnce:function(e,n){return null==n&&(n={}),n.times=1,t.handleEvent(e,n)},triggerEvent:function(n,i){var r,o,s,a,u,c,l;return c=(l=null!=i?i:{}).onElement,o=l.bubbles,s=l.cancelable,r=l.attributes,a=null!=c?c:e,o=!1!==o,s=!1!==s,(u=document.createEvent("Events")).initEvent(n,o,s),null!=r&&t.extend.call(u,r),a.dispatchEvent(u)},elementMatchesSelector:function(t,e){return 1===(null!=t?t.nodeType:void 0)?n.call(t,e):void 0},findClosestElementFromNode:function(e,n){var i,r,o;for(i=(r=null!=n?n:{}).matchingSelector,o=r.untilNode;null!=e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.parentNode;if(null!=e){if(null==i)return e;if(e.closest&&null==o)return e.closest(i);for(;e&&e!==o;){if(t.elementMatchesSelector(e,i))return e;e=e.parentNode}}},findInnerElement:function(t){for(;null!=t?t.firstElementChild:void 0;)t=t.firstElementChild;return t},innerElementIsActive:function(e){return document.activeElement!==e&&t.elementContainsNode(e,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(e,n){var i;return i=t.findNodeFromContainerAndOffset(e,n),t.findClosestElementFromNode(i)},findChildIndexOfNode:function(t){var e;if(null!=t?t.parentNode:void 0){for(e=0;t=t.previousSibling;)e++;return e}},removeNode:function(t){var e;return null!=t&&null!=(e=t.parentNode)?e.removeChild(t):void 0},walkTree:function(t,e){var n,i,r,o,s;return i=(r=null!=e?e:{}).onlyNodesOfType,o=r.usingFilter,n=r.expandEntityReferences,s=function(){switch(i){case"element":return NodeFilter.SHOW_ELEMENT;case"text":return NodeFilter.SHOW_TEXT;case"comment":return NodeFilter.SHOW_COMMENT;default:return NodeFilter.SHOW_ALL}}(),document.createTreeWalker(t,s,null!=o?o:null,!0===n)},tagName:function(t){var e;return null!=t&&null!=(e=t.tagName)?e.toLowerCase():void 0},makeElement:function(t,e){var n,i,r,o,a,u,c,l,h,p;if(null==e&&(e={}),"object"==s(t)?t=(e=t).tagName:e={attributes:e},i=document.createElement(t),null!=e.editable&&(null==e.attributes&&(e.attributes={}),e.attributes.contenteditable=e.editable),e.attributes)for(o in u=e.attributes)p=u[o],i.setAttribute(o,p);if(e.style)for(o in c=e.style)p=c[o],i.style[o]=p;if(e.data)for(o in l=e.data)p=l[o],i.dataset[o]=p;if(e.className)for(r=0,a=(h=e.className.split(" ")).length;a>r;r++)n=h[r],i.classList.add(n);return e.textContent&&(i.textContent=e.textContent),i},getBlockTagNames:function(){var e,n;return null!=t.blockTagNames?t.blockTagNames:t.blockTagNames=function(){var i,r;for(e in r=[],i=t.config.blockAttributes)(n=i[e].tagName)&&r.push(n);return r}()},nodeIsBlockContainer:function(e){return t.nodeIsBlockStartComment(null!=e?e.firstChild:void 0)},nodeProbablyIsBlockContainer:function(e){var n,i;return n=t.tagName(e),a.call(t.getBlockTagNames(),n)>=0&&(i=t.tagName(e.firstChild),a.call(t.getBlockTagNames(),i)<0)},nodeIsBlockStart:function(e,n){return(null!=n?n:{strict:!0}).strict?t.nodeIsBlockStartComment(e):t.nodeIsBlockStartComment(e)||!t.nodeIsBlockStartComment(e.firstChild)&&t.nodeProbablyIsBlockContainer(e)},nodeIsBlockStartComment:function(e){return t.nodeIsCommentNode(e)&&"block"===(null!=e?e.data:void 0)},nodeIsCommentNode:function(t){return(null!=t?t.nodeType:void 0)===Node.COMMENT_NODE},nodeIsCursorTarget:function(e,n){var i;return i=(null!=n?n:{}).name,e?t.nodeIsTextNode(e)?e.data===t.ZERO_WIDTH_SPACE?!i||e.parentNode.dataset.trixCursorTarget===i:void 0:t.nodeIsCursorTarget(e.firstChild):void 0},nodeIsAttachmentElement:function(e){return t.elementMatchesSelector(e,t.AttachmentView.attachmentSelector)},nodeIsEmptyTextNode:function(e){return t.nodeIsTextNode(e)&&""===(null!=e?e.data:void 0)},nodeIsTextNode:function(t){return(null!=t?t.nodeType:void 0)===Node.TEXT_NODE}})}.call(this),function(){var e,n,i,r,o;e=t.copyObject,r=t.objectsAreEqual,t.extend({normalizeRange:i=function(t){var e;if(null!=t)return Array.isArray(t)||(t=[t,t]),[n(t[0]),n(null!=(e=t[1])?e:t[0])]},rangeIsCollapsed:function(t){var e,n,r;if(null!=t)return r=(n=i(t))[0],e=n[1],o(r,e)},rangesAreEqual:function(t,e){var n,r,s,a,u,c;if(null!=t&&null!=e)return r=(s=i(t))[0],n=s[1],c=(a=i(e))[0],u=a[1],o(r,c)&&o(n,u)}}),n=function(t){return"number"==typeof t?t:e(t)},o=function(t,e){return"number"==typeof t?t===e:r(t,e)}}.call(this),function(){var e,n,i,r,o,a,u;t.registerElement=function(t,e){var n,i;return null==e&&(e={}),t=t.toLowerCase(),e=u(e),(n=(i=a(e)).defaultCSS)&&(delete i.defaultCSS,r(n,t)),o(t,i)},r=function(t,e){return i(e).textContent=t.replace(/%t/g,e)},i=function(t){var n,i;return(n=document.createElement("style")).setAttribute("type","text/css"),n.setAttribute("data-tag-name",t.toLowerCase()),(i=e())&&n.setAttribute("nonce",i),document.head.insertBefore(n,document.head.firstChild),n},e=function(){var t;return(t=n("trix-csp-nonce")||n("csp-nonce"))?t.getAttribute("content"):void 0},n=function(t){return document.head.querySelector("meta[name="+t+"]")},a=function(t){var e,n,i;for(e in n={},t)i=t[e],n[e]="function"==typeof i?{value:i}:i;return n},u=function(){var t;return t=function(t){var e,n,i,r,o;for(e={},n=0,r=(o=["initialize","connect","disconnect"]).length;r>n;n++)e[i=o[n]]=t[i],delete t[i];return e},window.customElements?function(e){var n,i,r,o,s;return s=t(e),r=s.initialize,n=s.connect,i=s.disconnect,r&&(o=n,n=function(){return this.initialized||(this.initialized=!0,r.call(this)),null!=o?o.call(this):void 0}),n&&(e.connectedCallback=n),i&&(e.disconnectedCallback=i),e}:function(e){var n,i,r,o;return r=(o=t(e)).initialize,n=o.connect,i=o.disconnect,r&&(e.createdCallback=r),n&&(e.attachedCallback=n),i&&(e.detachedCallback=i),e}}(),o=window.customElements?function(t,e){var n;return n=function(){return"object"==("undefined"===typeof Reflect?"undefined":s(Reflect))?Reflect.construct(HTMLElement,[],n):HTMLElement.apply(this)},Object.setPrototypeOf(n.prototype,HTMLElement.prototype),Object.setPrototypeOf(n,HTMLElement),Object.defineProperties(n.prototype,e),window.customElements.define(t,n),n}:function(t,e){var n,i;return i=Object.create(HTMLElement.prototype,e),n=document.registerElement(t,{prototype:i}),Object.defineProperty(i,"constructor",{value:n}),n}}.call(this),function(){var e,n;t.extend({getDOMSelection:function(){var t;return(t=window.getSelection()).rangeCount>0?t:void 0},getDOMRange:function(){var n,i;return(n=null!=(i=t.getDOMSelection())?i.getRangeAt(0):void 0)&&!e(n)?n:void 0},setDOMRange:function(e){var n;return(n=window.getSelection()).removeAllRanges(),n.addRange(e),t.selectionChangeObserver.update()}}),e=function(t){return n(t.startContainer)||n(t.endContainer)},n=function(t){return!Object.getPrototypeOf(t)}}.call(this),function(){var e;e={"application/x-trix-feature-detection":"test"},t.extend({dataTransferIsPlainText:function(t){var e,n,i;return i=t.getData("text/plain"),n=t.getData("text/html"),i&&n?(e=(new DOMParser).parseFromString(n,"text/html").body).textContent===i?!e.querySelector("*"):void 0:null!=i?i.length:void 0},dataTransferIsWritable:function(t){var n,i;if(null!=(null!=t?t.setData:void 0)){for(n in e)if(i=e[n],!function(){try{return t.setData(n,i),t.getData(n)===i}catch(e){}}())return;return!0}},keyEventIsKeyboardCommand:/Mac|^iP/.test(navigator.platform)?function(t){return t.metaKey}:function(t){return t.ctrlKey}})}.call(this),function(){}.call(this),function(){var e,n=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;e=t.arraysAreEqual,t.Hash=function(i){function r(t){null==t&&(t={}),this.values=s(t),r.__super__.constructor.apply(this,arguments)}var o,s,a,u,c;return n(r,i),r.fromCommonAttributesOfObjects=function(t){var e,n,i,r,s,a;if(null==t&&(t=[]),!t.length)return new this;for(i=(e=o(t[0])).getKeys(),n=0,r=(a=t.slice(1)).length;r>n;n++)s=a[n],i=e.getKeysCommonToHash(o(s)),e=e.slice(i);return e},r.box=function(t){return o(t)},r.prototype.add=function(t,e){return this.merge(u(t,e))},r.prototype.remove=function(e){return new t.Hash(s(this.values,e))},r.prototype.get=function(t){return this.values[t]},r.prototype.has=function(t){return t in this.values},r.prototype.merge=function(e){return new t.Hash(a(this.values,c(e)))},r.prototype.slice=function(e){var n,i,r,o;for(o={},n=0,r=e.length;r>n;n++)i=e[n],this.has(i)&&(o[i]=this.values[i]);return new t.Hash(o)},r.prototype.getKeys=function(){return Object.keys(this.values)},r.prototype.getKeysCommonToHash=function(t){var e,n,i,r,s;for(t=o(t),s=[],e=0,i=(r=this.getKeys()).length;i>e;e++)n=r[e],this.values[n]===t.values[n]&&s.push(n);return s},r.prototype.isEqualTo=function(t){return e(this.toArray(),o(t).toArray())},r.prototype.isEmpty=function(){return 0===this.getKeys().length},r.prototype.toArray=function(){var t,e,n;return(null!=this.array?this.array:this.array=function(){var i;for(t in e=[],i=this.values)n=i[t],e.push(t,n);return e}.call(this)).slice(0)},r.prototype.toObject=function(){return s(this.values)},r.prototype.toJSON=function(){return this.toObject()},r.prototype.contentsForInspection=function(){return{values:JSON.stringify(this.values)}},u=function(t,e){var n;return(n={})[t]=e,n},a=function(t,e){var n,i,r;for(n in i=s(t),e)r=e[n],i[n]=r;return i},s=function(t,e){var n,i,r,o,s;for(o={},s=Object.keys(t).sort(),n=0,r=s.length;r>n;n++)(i=s[n])!==e&&(o[i]=t[i]);return o},o=function(e){return e instanceof t.Hash?e:new t.Hash(e)},c=function(e){return e instanceof t.Hash?e.values:e},r}(t.Object)}.call(this),function(){t.ObjectGroup=function(){function t(t,e){var n,i;this.objects=null!=t?t:[],i=e.depth,(n=e.asTree)&&(this.depth=i,this.objects=this.constructor.groupObjects(this.objects,{asTree:n,depth:this.depth+1}))}return t.groupObjects=function(t,e){var n,i,r,o,s,a,u,c,l;for(null==t&&(t=[]),r=(l=null!=e?e:{}).depth,(n=l.asTree)&&null==r&&(r=0),c=[],s=0,a=t.length;a>s;s++){if(u=t[s],o){if(("function"==typeof u.canBeGrouped?u.canBeGrouped(r):void 0)&&("function"==typeof(i=o[o.length-1]).canBeGroupedWith?i.canBeGroupedWith(u,r):void 0)){o.push(u);continue}c.push(new this(o,{depth:r,asTree:n})),o=null}("function"==typeof u.canBeGrouped?u.canBeGrouped(r):void 0)?o=[u]:c.push(u)}return o&&c.push(new this(o,{depth:r,asTree:n})),c},t.prototype.getObjects=function(){return this.objects},t.prototype.getDepth=function(){return this.depth},t.prototype.getCacheKey=function(){var t,e,n,i,r;for(e=["objectGroup"],t=0,n=(r=this.getObjects()).length;n>t;t++)i=r[t],e.push(i.getCacheKey());return e.join("/")},t}()}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.ObjectMap=function(t){function n(t){var e,n,i,r,o;for(null==t&&(t=[]),this.objects={},i=0,r=t.length;r>i;i++)o=t[i],n=JSON.stringify(o),null==(e=this.objects)[n]&&(e[n]=o)}return e(n,t),n.prototype.find=function(t){var e;return e=JSON.stringify(t),this.objects[e]},n}(t.BasicObject)}.call(this),function(){t.ElementStore=function(){function t(t){this.reset(t)}var e;return t.prototype.add=function(t){var n;return n=e(t),this.elements[n]=t},t.prototype.remove=function(t){var n,i;return n=e(t),(i=this.elements[n])?(delete this.elements[n],i):void 0},t.prototype.reset=function(t){var e,n,i;for(null==t&&(t=[]),this.elements={},n=0,i=t.length;i>n;n++)e=t[n],this.add(e);return t},e=function(t){return t.dataset.trixStoreKey},t}()}.call(this),function(){}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.Operation=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n.prototype.isPerforming=function(){return!0===this.performing},n.prototype.hasPerformed=function(){return!0===this.performed},n.prototype.hasSucceeded=function(){return this.performed&&this.succeeded},n.prototype.hasFailed=function(){return this.performed&&!this.succeeded},n.prototype.getPromise=function(){return null!=this.promise?this.promise:this.promise=new Promise(function(t){return function(e,n){return t.performing=!0,t.perform((function(i,r){return t.succeeded=i,t.performing=!1,t.performed=!0,t.succeeded?e(r):n(r)}))}}(this))},n.prototype.perform=function(t){return t(!1)},n.prototype.release=function(){var t;return null!=(t=this.promise)&&"function"==typeof t.cancel&&t.cancel(),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null},n.proxyMethod("getPromise().then"),n.proxyMethod("getPromise().catch"),n}(t.BasicObject)}.call(this),function(){var e,n,i,r,o,s={}.hasOwnProperty;t.UTF16String=function(t){function e(t,e){this.ucs2String=t,this.codepoints=e,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}return function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype}(e,t),e.box=function(t){return null==t&&(t=""),t instanceof this?t:this.fromUCS2String(null!=t?t.toString():void 0)},e.fromUCS2String=function(t){return new this(t,r(t))},e.fromCodepoints=function(t){return new this(o(t),t)},e.prototype.offsetToUCS2Offset=function(t){return o(this.codepoints.slice(0,Math.max(0,t))).length},e.prototype.offsetFromUCS2Offset=function(t){return r(this.ucs2String.slice(0,Math.max(0,t))).length},e.prototype.slice=function(){var t;return this.constructor.fromCodepoints((t=this.codepoints).slice.apply(t,arguments))},e.prototype.charAt=function(t){return this.slice(t,t+1)},e.prototype.isEqualTo=function(t){return this.constructor.box(t).ucs2String===this.ucs2String},e.prototype.toJSON=function(){return this.ucs2String},e.prototype.getCacheKey=function(){return this.ucs2String},e.prototype.toString=function(){return this.ucs2String},e}(t.BasicObject),e=1===("function"==typeof Array.from?Array.from("\ud83d\udc7c").length:void 0),n=null!=("function"==typeof" ".codePointAt?" ".codePointAt(0):void 0),i=" \ud83d\udc7c"===("function"==typeof String.fromCodePoint?String.fromCodePoint(32,128124):void 0),r=e&&n?function(t){return Array.from(t).map((function(t){return t.codePointAt(0)}))}:function(t){var e,n,i,r,o;for(r=[],e=0,i=t.length;i>e;)(o=t.charCodeAt(e++))>=55296&&56319>=o&&i>e&&(56320===(64512&(n=t.charCodeAt(e++)))?o=((1023&o)<<10)+(1023&n)+65536:e--),r.push(o);return r},o=i?function(t){return String.fromCodePoint.apply(String,t)}:function(t){var e,n;return function(){var i,r,o;for(o=[],i=0,r=t.length;r>i;i++)n=t[i],e="",n>65535&&(n-=65536,e+=String.fromCharCode(n>>>10&1023|55296),n=56320|1023&n),o.push(e+String.fromCharCode(n));return o}().join("")}}.call(this),function(){}.call(this),function(){}.call(this),function(){t.config.lang={attachFiles:"Attach Files",bold:"Bold",bullets:"Bullets",byte:"Byte",bytes:"Bytes",captionPlaceholder:"Add a caption\u2026",code:"Code",heading1:"Heading",indent:"Increase Level",italic:"Italic",link:"Link",numbers:"Numbers",outdent:"Decrease Level",quote:"Quote",redo:"Redo",remove:"Remove",strike:"Strikethrough",undo:"Undo",unlink:"Unlink",url:"URL",urlPlaceholder:"Enter a URL\u2026",GB:"GB",KB:"KB",MB:"MB",PB:"PB",TB:"TB"}}.call(this),function(){t.config.css={attachment:"attachment",attachmentCaption:"attachment__caption",attachmentCaptionEditor:"attachment__caption-editor",attachmentMetadata:"attachment__metadata",attachmentMetadataContainer:"attachment__metadata-container",attachmentName:"attachment__name",attachmentProgress:"attachment__progress",attachmentSize:"attachment__size",attachmentToolbar:"attachment__toolbar",attachmentGallery:"attachment-gallery"}}.call(this),function(){var e;t.config.blockAttributes=e={default:{tagName:"div",parse:!1},quote:{tagName:"blockquote",nestable:!0},heading1:{tagName:"h1",terminal:!0,breakOnReturn:!0,group:!1},code:{tagName:"pre",terminal:!0,text:{plaintext:!0}},bulletList:{tagName:"ul",parse:!1},bullet:{tagName:"li",listAttribute:"bulletList",group:!1,nestable:!0,test:function(n){return t.tagName(n.parentNode)===e[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",group:!1,nestable:!0,test:function(n){return t.tagName(n.parentNode)===e[this.listAttribute].tagName}},attachmentGallery:{tagName:"div",exclusive:!0,terminal:!0,parse:!1,group:!1}}}.call(this),function(){var e,n;e=t.config.lang,n=[e.bytes,e.KB,e.MB,e.GB,e.TB,e.PB],t.config.fileSize={prefix:"IEC",precision:2,formatter:function(t){var i,r;switch(t){case 0:return"0 "+e.bytes;case 1:return"1 "+e.byte;default:return i=function(){switch(this.prefix){case"SI":return 1e3;case"IEC":return 1024}}.call(this),r=Math.floor(Math.log(t)/Math.log(i)),(t/Math.pow(i,r)).toFixed(this.precision).replace(/0*$/,"").replace(/\.$/,"")+" "+n[r]}}}}.call(this),function(){t.config.textAttributes={bold:{tagName:"strong",inheritable:!0,parser:function(t){var e;return"bold"===(e=window.getComputedStyle(t)).fontWeight||e.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:function(t){return"italic"===window.getComputedStyle(t).fontStyle}},href:{groupTagName:"a",parser:function(e){var n,i;return i="a:not("+t.AttachmentView.attachmentSelector+")",(n=t.findClosestElementFromNode(e,{matchingSelector:i}))?n.getAttribute("href"):void 0}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}}}.call(this),function(){var e,n,i;i=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],n="data-trix-serialized-attributes",e=new RegExp("\x3c!--block--\x3e","g"),t.extend({serializers:{"application/json":function(e){var n;if(e instanceof t.Document)n=e;else{if(!(e instanceof HTMLElement))throw new Error("unserializable object");n=t.Document.fromHTML(e.innerHTML)}return n.toSerializableDocument().toJSONString()},"text/html":function(r){var o,s,a,u,c,l,h,p,d,f,g,m,y,v,b,A,x;if(r instanceof t.Document)u=t.DocumentView.render(r);else{if(!(r instanceof HTMLElement))throw new Error("unserializable object");u=r.cloneNode(!0)}for(c=0,d=(v=u.querySelectorAll("[data-trix-serialize=false]")).length;d>c;c++)a=v[c],t.removeNode(a);for(l=0,f=i.length;f>l;l++)for(o=i[l],h=0,g=(b=u.querySelectorAll("["+o+"]")).length;g>h;h++)(a=b[h]).removeAttribute(o);for(p=0,m=(A=u.querySelectorAll("[data-trix-serialized-attributes]")).length;m>p;p++){a=A[p];try{for(y in s=JSON.parse(a.getAttribute(n)),a.removeAttribute(n),s)x=s[y],a.setAttribute(y,x)}catch(C){}}return u.innerHTML.replace(e,"")}},deserializers:{"application/json":function(e){return t.Document.fromJSONString(e)},"text/html":function(e){return t.Document.fromHTML(e)}},serializeToContentType:function(e,n){var i;if(i=t.serializers[n])return i(e);throw new Error("unknown content type: "+n)},deserializeFromContentType:function(e,n){var i;if(i=t.deserializers[n])return i(e);throw new Error("unknown content type: "+n)}})}.call(this),function(){var e;e=t.config.lang,t.config.toolbar={getDefaultHTML:function(){return'<div class="trix-button-row">\n <span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="'+e.bold+'" tabindex="-1">'+e.bold+'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="'+e.italic+'" tabindex="-1">'+e.italic+'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="'+e.strike+'" tabindex="-1">'+e.strike+'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="'+e.link+'" tabindex="-1">'+e.link+'</button>\n </span>\n\n <span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-heading-1" data-trix-attribute="heading1" title="'+e.heading1+'" tabindex="-1">'+e.heading1+'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="'+e.quote+'" tabindex="-1">'+e.quote+'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="'+e.code+'" tabindex="-1">'+e.code+'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="'+e.bullets+'" tabindex="-1">'+e.bullets+'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="'+e.numbers+'" tabindex="-1">'+e.numbers+'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="'+e.outdent+'" tabindex="-1">'+e.outdent+'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="'+e.indent+'" tabindex="-1">'+e.indent+'</button>\n </span>\n\n <span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="'+e.attachFiles+'" tabindex="-1">'+e.attachFiles+'</button>\n </span>\n\n <span class="trix-button-group-spacer"></span>\n\n <span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="'+e.undo+'" tabindex="-1">'+e.undo+'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="'+e.redo+'" tabindex="-1">'+e.redo+'</button>\n </span>\n</div>\n\n<div class="trix-dialogs" data-trix-dialogs>\n <div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">\n <div class="trix-dialog__link-fields">\n <input type="url" name="href" class="trix-input trix-input--dialog" placeholder="'+e.urlPlaceholder+'" aria-label="'+e.url+'" required data-trix-input>\n <div class="trix-button-group">\n <input type="button" class="trix-button trix-button--dialog" value="'+e.link+'" data-trix-method="setAttribute">\n <input type="button" class="trix-button trix-button--dialog" value="'+e.unlink+'" data-trix-method="removeAttribute">\n </div>\n </div>\n </div>\n</div>'}}}.call(this),function(){t.config.undoInterval=5e3}.call(this),function(){t.config.attachments={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}}}.call(this),function(){t.config.keyNames={8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"}}.call(this),function(){t.config.input={level2Enabled:!0,getLevel:function(){return this.level2Enabled&&t.browser.supportsInputEvents?2:0},pickFiles:function(e){var n;return(n=t.makeElement("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId})).addEventListener("change",(function(){return e(n.files),t.removeNode(n)})),t.removeNode(document.getElementById(this.fileInputId)),document.body.appendChild(n),n.click()},fileInputId:"trix-file-input-"+Date.now().toString(16)}}.call(this),function(){}.call(this),function(){t.registerElement("trix-toolbar",{defaultCSS:"%t {\n display: block;\n}\n\n%t {\n white-space: nowrap;\n}\n\n%t [data-trix-dialog] {\n display: none;\n}\n\n%t [data-trix-dialog][data-trix-active] {\n display: block;\n}\n\n%t [data-trix-dialog] [data-trix-validate]:invalid {\n background-color: #ffdddd;\n}",initialize:function(){return""===this.innerHTML?this.innerHTML=t.config.toolbar.getDefaultHTML():void 0}})}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty,i=[].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.ObjectView=function(n){function r(t,e){this.object=t,this.options=null!=e?e:{},this.childViews=[],this.rootView=this}return e(r,n),r.prototype.getNodes=function(){var t,e,n,i,r;for(null==this.nodes&&(this.nodes=this.createNodes()),r=[],t=0,e=(i=this.nodes).length;e>t;t++)n=i[t],r.push(n.cloneNode(!0));return r},r.prototype.invalidate=function(){var t;return this.nodes=null,this.childViews=[],null!=(t=this.parentView)?t.invalidate():void 0},r.prototype.invalidateViewForObject=function(t){var e;return null!=(e=this.findViewForObject(t))?e.invalidate():void 0},r.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},r.prototype.createChildView=function(e,n,i){var r;return null==i&&(i={}),n instanceof t.ObjectGroup&&(i.viewClass=e,e=t.ObjectGroupView),r=new e(n,i),this.recordChildView(r)},r.prototype.recordChildView=function(t){return t.parentView=this,t.rootView=this.rootView,this.childViews.push(t),t},r.prototype.getAllChildViews=function(){var t,e,n,i,r;for(r=[],e=0,n=(i=this.childViews).length;n>e;e++)t=i[e],r.push(t),r=r.concat(t.getAllChildViews());return r},r.prototype.findElement=function(){return this.findElementForObject(this.object)},r.prototype.findElementForObject=function(t){var e;return(e=null!=t?t.id:void 0)?this.rootView.element.querySelector("[data-trix-id='"+e+"']"):void 0},r.prototype.findViewForObject=function(t){var e,n,i,r;for(e=0,n=(i=this.getAllChildViews()).length;n>e;e++)if((r=i[e]).object===t)return r},r.prototype.getViewCache=function(){return this.rootView!==this?this.rootView.getViewCache():this.isViewCachingEnabled()?null!=this.viewCache?this.viewCache:this.viewCache={}:void 0},r.prototype.isViewCachingEnabled=function(){return!1!==this.shouldCacheViews},r.prototype.enableViewCaching=function(){return this.shouldCacheViews=!0},r.prototype.disableViewCaching=function(){return this.shouldCacheViews=!1},r.prototype.getCachedViewForObject=function(t){var e;return null!=(e=this.getViewCache())?e[t.getCacheKey()]:void 0},r.prototype.cacheViewForObject=function(t,e){var n;return null!=(n=this.getViewCache())?n[e.getCacheKey()]=t:void 0},r.prototype.garbageCollectCachedViews=function(){var t,e,n,r,o,s;if(t=this.getViewCache()){for(e in s=this.getAllChildViews().concat(this),n=function(){var t,e,n;for(n=[],t=0,e=s.length;e>t;t++)o=s[t],n.push(o.object.getCacheKey());return n}(),r=[],t)i.call(n,e)<0&&r.push(delete t[e]);return r}},r}(t.BasicObject)}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.ObjectGroupView=function(t){function n(){n.__super__.constructor.apply(this,arguments),this.objectGroup=this.object,this.viewClass=this.options.viewClass,delete this.options.viewClass}return e(n,t),n.prototype.getChildViews=function(){var t,e,n,i;if(!this.childViews.length)for(t=0,e=(i=this.objectGroup.getObjects()).length;e>t;t++)n=i[t],this.findOrCreateCachedChildView(this.viewClass,n,this.options);return this.childViews},n.prototype.createNodes=function(){var t,e,n,i,r,o,s,a;for(t=this.createContainerElement(),e=0,i=(s=this.getChildViews()).length;i>e;e++)for(n=0,r=(a=s[e].getNodes()).length;r>n;n++)o=a[n],t.appendChild(o);return[t]},n.prototype.createContainerElement=function(t){return null==t&&(t=this.objectGroup.getDepth()),this.getChildViews()[0].createContainerElement(t)},n}(t.ObjectView)}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.Controller=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return e(n,t),n}(t.BasicObject)}.call(this),function(){var e,n,i,r,o,s,a=function(t,e){return function(){return t.apply(e,arguments)}},u=function(t,e){function n(){this.constructor=t}for(var i in e)c.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty,l=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};e=t.findClosestElementFromNode,i=t.nodeIsEmptyTextNode,n=t.nodeIsBlockStartComment,r=t.normalizeSpaces,o=t.summarizeStringChange,s=t.tagName,t.MutationObserver=function(t){function c(t){this.element=t,this.didMutate=a(this.didMutate,this),this.observer=new window.MutationObserver(this.didMutate),this.start()}var h,p,d;return u(c,t),"["+(p="data-trix-mutable")+"]",d={attributes:!0,childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0},c.prototype.start=function(){return this.reset(),this.observer.observe(this.element,d)},c.prototype.stop=function(){return this.observer.disconnect()},c.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},c.prototype.reset=function(){return this.mutations=[]},c.prototype.findSignificantMutations=function(t){var e,n,i,r;for(r=[],e=0,n=t.length;n>e;e++)i=t[e],this.mutationIsSignificant(i)&&r.push(i);return r},c.prototype.mutationIsSignificant=function(t){var e,n,i,r;if(this.nodeIsMutable(t.target))return!1;for(e=0,n=(r=this.nodesModifiedByMutation(t)).length;n>e;e++)if(i=r[e],this.nodeIsSignificant(i))return!0;return!1},c.prototype.nodeIsSignificant=function(t){return t!==this.element&&!this.nodeIsMutable(t)&&!i(t)},c.prototype.nodeIsMutable=function(t){return e(t,{matchingSelector:"[data-trix-mutable]"})},c.prototype.nodesModifiedByMutation=function(t){var e;switch(e=[],t.type){case"attributes":t.attributeName!==p&&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},c.prototype.getMutationSummary=function(){return this.getTextMutationSummary()},c.prototype.getTextMutationSummary=function(){var t,e,n,i,r,o,s,a,u,c,h;for(n=(a=this.getTextChangesFromCharacterData()).additions,r=a.deletions,o=0,s=(u=(h=this.getTextChangesFromChildList()).additions).length;s>o;o++)e=u[o],l.call(n,e)<0&&n.push(e);return r.push.apply(r,h.deletions),c={},(t=n.join(""))&&(c.textAdded=t),(i=r.join(""))&&(c.textDeleted=i),c},c.prototype.getMutationsByType=function(t){var e,n,i,r,o;for(o=[],e=0,n=(r=this.mutations).length;n>e;e++)(i=r[e]).type===t&&o.push(i);return o},c.prototype.getTextChangesFromChildList=function(){var t,e,i,o,s,a,u,c,l,p;for(t=[],u=[],e=0,o=(a=this.getMutationsByType("childList")).length;o>e;e++)s=a[e],t.push.apply(t,s.addedNodes),u.push.apply(u,s.removedNodes);return 0===t.length&&1===u.length&&n(u[0])?(l=[],p=["\n"]):(l=h(t),p=h(u)),{additions:function(){var t,e,n;for(n=[],i=t=0,e=l.length;e>t;i=++t)(c=l[i])!==p[i]&&n.push(r(c));return n}(),deletions:function(){var t,e,n;for(n=[],i=t=0,e=p.length;e>t;i=++t)(c=p[i])!==l[i]&&n.push(r(c));return n}()}},c.prototype.getTextChangesFromCharacterData=function(){var t,e,n,i,s,a,u,c;return(e=this.getMutationsByType("characterData")).length&&(c=e[0],n=e[e.length-1],s=r(c.oldValue),i=r(n.target.data),t=(a=o(s,i)).added,u=a.removed),{additions:t?[t]:[],deletions:u?[u]:[]}},h=function(t){var e,n,i,r;for(null==t&&(t=[]),r=[],e=0,n=t.length;n>e;e++)switch((i=t[e]).nodeType){case Node.TEXT_NODE:r.push(i.data);break;case Node.ELEMENT_NODE:"br"===s(i)?r.push("\n"):r.push.apply(r,h(i.childNodes))}return r},c}(t.BasicObject)}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.FileVerificationOperation=function(t){function n(t){this.file=t}return e(n,t),n.prototype.perform=function(t){var e;return(e=new FileReader).onerror=function(){return t(!1)},e.onload=function(n){return function(){e.onerror=null;try{e.abort()}catch(i){}return t(!0,n.file)}}(this),e.readAsArrayBuffer(this.file)},n}(t.Operation)}.call(this),function(){var e,n,i=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e=t.handleEvent,n=t.innerElementIsActive,t.InputController=function(r){function o(n){var i;for(i in this.element=n,this.mutationObserver=new t.MutationObserver(this.element),this.mutationObserver.delegate=this,this.events)e(i,{onElement:this.element,withCallback:this.handlerFor(i)})}return i(o,r),o.prototype.events={},o.prototype.elementDidMutate=function(){},o.prototype.editorWillSyncDocumentView=function(){return this.mutationObserver.stop()},o.prototype.editorDidSyncDocumentView=function(){return this.mutationObserver.start()},o.prototype.requestRender=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidRequestRender?t.inputControllerDidRequestRender():void 0},o.prototype.requestReparse=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidRequestReparse&&t.inputControllerDidRequestReparse(),this.requestRender()},o.prototype.attachFiles=function(e){var n,i;return i=function(){var i,r,o;for(o=[],i=0,r=e.length;r>i;i++)n=e[i],o.push(new t.FileVerificationOperation(n));return o}(),Promise.all(i).then(function(t){return function(e){return t.handleInput((function(){var t,n;return null!=(t=this.delegate)&&t.inputControllerWillAttachFiles(),null!=(n=this.responder)&&n.insertFiles(e),this.requestRender()}))}}(this))},o.prototype.handlerFor=function(t){return function(e){return function(i){return i.defaultPrevented?void 0:e.handleInput((function(){return n(this.element)?void 0:(this.eventName=t,this.events[t].call(this,i))}))}}(this)},o.prototype.handleInput=function(t){var e,n;try{return null!=(e=this.delegate)&&e.inputControllerWillHandleInput(),t.call(this)}finally{null!=(n=this.delegate)&&n.inputControllerDidHandleInput()}},o}(t.BasicObject)}.call(this),function(){var e,n,i,r,o,s,a,u,c,l,h,p,d=function(t,e){function n(){this.constructor=t}for(var i in e)f.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},f={}.hasOwnProperty,g=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};c=t.makeElement,l=t.objectsAreEqual,t.tagName,n=t.browser,a=t.keyEventIsKeyboardCommand,r=t.dataTransferIsWritable,i=t.dataTransferIsPlainText,u=t.config.keyNames,t.Level0InputController=function(n){function s(){s.__super__.constructor.apply(this,arguments),this.resetInputSummary()}var f;return d(s,n),f=0,s.prototype.setInputSummary=function(t){var e,n;for(e in null==t&&(t={}),this.inputSummary.eventName=this.eventName,t)n=t[e],this.inputSummary[e]=n;return this.inputSummary},s.prototype.resetInputSummary=function(){return this.inputSummary={}},s.prototype.reset=function(){return this.resetInputSummary(),t.selectionChangeObserver.reset()},s.prototype.elementDidMutate=function(t){var e;return this.isComposing()?null!=(e=this.delegate)&&"function"==typeof e.inputControllerDidAllowUnhandledInput?e.inputControllerDidAllowUnhandledInput():void 0:this.handleInput((function(){return this.mutationIsSignificant(t)&&(this.mutationIsExpected(t)?this.requestRender():this.requestReparse()),this.reset()}))},s.prototype.mutationIsExpected=function(t){var e,n,i,r,o,s,a,u,c;return s=t.textAdded,a=t.textDeleted,!!this.inputSummary.preferDocument||(e=null!=s?s===this.inputSummary.textAdded:!this.inputSummary.textAdded,n=null!=a?this.inputSummary.didDelete:!this.inputSummary.didDelete,c="\n"===a&&!n,!!(((u=("\n"===s||" \n"===s)&&!e)&&!c||c&&!u)&&(r=this.getSelectedRange())&&(i=u?s.replace(/\n$/,"").length||-1:(null!=s?s.length:void 0)||1,null!=(o=this.responder)?o.positionIsBlockBreak(r[1]+i):void 0))||e&&n)},s.prototype.mutationIsSignificant=function(t){var e,n,i;return i=Object.keys(t).length>0,e=""===(null!=(n=this.compositionInput)?n.getEndData():void 0),i||!e},s.prototype.events={keydown:function(e){var n,i,r,o,s,c,l,h,p;if(this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0,o=u[e.keyCode]){for(i=this.keys,r=0,c=(h=["ctrl","alt","shift","meta"]).length;c>r;r++)e[(l=h[r])+"Key"]&&("ctrl"===l&&(l="control"),i=null!=i?i[l]:void 0);null!=(null!=i?i[o]:void 0)&&(this.setInputSummary({keyName:o}),t.selectionChangeObserver.reset(),i[o].call(this,e))}return a(e)&&(n=String.fromCharCode(e.keyCode).toLowerCase())&&((s=function(){var t,n,i,r;for(r=[],t=0,n=(i=["alt","shift"]).length;n>t;t++)e[(l=i[t])+"Key"]&&r.push(l);return r}()).push(n),null!=(p=this.delegate)?p.inputControllerDidReceiveKeyboardCommand(s):void 0)?e.preventDefault():void 0},keypress:function(t){var e,n,i;if(null==this.inputSummary.eventName&&!t.metaKey&&(!t.ctrlKey||t.altKey))return(i=p(t))?(null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString(i),this.setInputSummary({textAdded:i,didDelete:this.selectionIsExpanded()})):void 0},textInput:function(t){var e,n,i,r;return e=t.data,(r=this.inputSummary.textAdded)&&r!==e&&r.toUpperCase()===e?(n=this.getSelectedRange(),this.setSelectedRange([n[0],n[1]+r.length]),null!=(i=this.responder)&&i.insertString(e),this.setInputSummary({textAdded:e}),this.setSelectedRange(n)):void 0},dragenter:function(t){return t.preventDefault()},dragstart:function(t){var e;return t.target,this.serializeSelectionToDataTransfer(t.dataTransfer),this.draggedRange=this.getSelectedRange(),null!=(e=this.delegate)&&"function"==typeof e.inputControllerDidStartDrag?e.inputControllerDidStartDrag():void 0},dragover:function(t){var e,n;return!this.draggedRange&&!this.canAcceptDataTransfer(t.dataTransfer)||(t.preventDefault(),e={x:t.clientX,y:t.clientY},l(e,this.draggingPoint))?void 0:(this.draggingPoint=e,null!=(n=this.delegate)&&"function"==typeof n.inputControllerDidReceiveDragOverPoint?n.inputControllerDidReceiveDragOverPoint(this.draggingPoint):void 0)},dragend:function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidCancelDrag&&t.inputControllerDidCancelDrag(),this.draggedRange=null,this.draggingPoint=null},drop:function(e){var n,i,r,o,s,a,u,c,l;return e.preventDefault(),r=null!=(s=e.dataTransfer)?s.files:void 0,o={x:e.clientX,y:e.clientY},null!=(a=this.responder)&&a.setLocationRangeFromPointRange(o),(null!=r?r.length:void 0)?this.attachFiles(r):this.draggedRange?(null!=(u=this.delegate)&&u.inputControllerWillMoveText(),null!=(c=this.responder)&&c.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()):(i=e.dataTransfer.getData("application/x-trix-document"))&&(n=t.Document.fromJSONString(i),null!=(l=this.responder)&&l.insertDocument(n),this.requestRender()),this.draggedRange=null,this.draggingPoint=null},cut:function(t){var e,n;return(null!=(e=this.responder)?e.selectionIsExpanded():void 0)&&(this.serializeSelectionToDataTransfer(t.clipboardData)&&t.preventDefault(),null!=(n=this.delegate)&&n.inputControllerWillCutText(),this.deleteInDirection("backward"),t.defaultPrevented)?this.requestRender():void 0},copy:function(t){var e;return(null!=(e=this.responder)?e.selectionIsExpanded():void 0)&&this.serializeSelectionToDataTransfer(t.clipboardData)?t.preventDefault():void 0},paste:function(e){var n,r,s,a,u,c,l,p,d,m,y,v,b,A,x,C,w,E,S,k,R,D;return n=null!=(p=e.clipboardData)?p:e.testClipboardData,l={clipboard:n},null==n||h(e)?void this.getPastedHTMLUsingHiddenElement(function(t){return function(e){var n,i,r;return l.type="text/html",l.html=e,null!=(n=t.delegate)&&n.inputControllerWillPaste(l),null!=(i=t.responder)&&i.insertHTML(l.html),t.requestRender(),null!=(r=t.delegate)?r.inputControllerDidPaste(l):void 0}}(this)):((a=n.getData("URL"))?(l.type="URL",l.href=a,l.string=(c=n.getData("public.url-name"))?t.squishBreakableWhitespace(c).trim():a,null!=(d=this.delegate)&&d.inputControllerWillPaste(l),this.setInputSummary({textAdded:l.string,didDelete:this.selectionIsExpanded()}),null!=(x=this.responder)&&x.insertText(t.Text.textForStringWithAttributes(l.string,{href:l.href})),this.requestRender(),null!=(C=this.delegate)&&C.inputControllerDidPaste(l)):i(n)?(l.type="text/plain",l.string=n.getData("text/plain"),null!=(w=this.delegate)&&w.inputControllerWillPaste(l),this.setInputSummary({textAdded:l.string,didDelete:this.selectionIsExpanded()}),null!=(E=this.responder)&&E.insertString(l.string),this.requestRender(),null!=(S=this.delegate)&&S.inputControllerDidPaste(l)):(u=n.getData("text/html"))?(l.type="text/html",l.html=u,null!=(k=this.delegate)&&k.inputControllerWillPaste(l),null!=(R=this.responder)&&R.insertHTML(l.html),this.requestRender(),null!=(D=this.delegate)&&D.inputControllerDidPaste(l)):g.call(n.types,"Files")>=0&&(s=null!=(m=n.items)&&null!=(y=m[0])&&"function"==typeof y.getAsFile?y.getAsFile():void 0)&&(!s.name&&(r=o(s))&&(s.name="pasted-file-"+ ++f+"."+r),l.type="File",l.file=s,null!=(v=this.delegate)&&v.inputControllerWillAttachFiles(),null!=(b=this.responder)&&b.insertFile(l.file),this.requestRender(),null!=(A=this.delegate)&&A.inputControllerDidPaste(l)),e.preventDefault())},compositionstart:function(t){return this.getCompositionInput().start(t.data)},compositionupdate:function(t){return this.getCompositionInput().update(t.data)},compositionend:function(t){return this.getCompositionInput().end(t.data)},beforeinput:function(){return this.inputSummary.didInput=!0},input:function(t){return this.inputSummary.didInput=!0,t.stopPropagation()}},s.prototype.keys={backspace:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",t)},delete:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",t)},return:function(){var t,e;return this.setInputSummary({preferDocument:!0}),null!=(t=this.delegate)&&t.inputControllerWillPerformTyping(),null!=(e=this.responder)?e.insertLineBreak():void 0},tab:function(t){var e,n;return(null!=(e=this.responder)?e.canIncreaseNestingLevel():void 0)?(null!=(n=this.responder)&&n.increaseNestingLevel(),this.requestRender(),t.preventDefault()):void 0},left:function(t){var e;return this.selectionIsInCursorTarget()?(t.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("backward"):void 0):void 0},right:function(t){var e;return this.selectionIsInCursorTarget()?(t.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("forward"):void 0):void 0},control:{d:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",t)},h:function(t){var e;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",t)},o:function(t){var e,n;return t.preventDefault(),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString("\n",{updatePosition:!1}),this.requestRender()}},shift:{return:function(t){var e,n;return null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.insertString("\n"),this.requestRender(),t.preventDefault()},tab:function(t){var e,n;return(null!=(e=this.responder)?e.canDecreaseNestingLevel():void 0)?(null!=(n=this.responder)&&n.decreaseNestingLevel(),this.requestRender(),t.preventDefault()):void 0},left:function(t){return this.selectionIsInCursorTarget()?(t.preventDefault(),this.expandSelectionInDirection("backward")):void 0},right:function(t){return this.selectionIsInCursorTarget()?(t.preventDefault(),this.expandSelectionInDirection("forward")):void 0}},alt:{backspace:function(){var t;return this.setInputSummary({preferDocument:!1}),null!=(t=this.delegate)?t.inputControllerWillPerformTyping():void 0}},meta:{backspace:function(){var t;return this.setInputSummary({preferDocument:!1}),null!=(t=this.delegate)?t.inputControllerWillPerformTyping():void 0}}},s.prototype.getCompositionInput=function(){return this.isComposing()?this.compositionInput:this.compositionInput=new e(this)},s.prototype.isComposing=function(){return null!=this.compositionInput&&!this.compositionInput.isEnded()},s.prototype.deleteInDirection=function(t,e){var n;return!1!==(null!=(n=this.responder)?n.deleteInDirection(t):void 0)?this.setInputSummary({didDelete:!0}):e?(e.preventDefault(),this.requestRender()):void 0},s.prototype.serializeSelectionToDataTransfer=function(e){var n,i;if(r(e))return n=null!=(i=this.responder)?i.getSelectedDocument().toSerializableDocument():void 0,e.setData("application/x-trix-document",JSON.stringify(n)),e.setData("text/html",t.DocumentView.render(n).innerHTML),e.setData("text/plain",n.toString().replace(/\n$/,"")),!0},s.prototype.canAcceptDataTransfer=function(t){var e,n,i,r,o;for(o={},e=0,n=(r=null!=(i=null!=t?t.types:void 0)?i:[]).length;n>e;e++)o[r[e]]=!0;return o.Files||o["application/x-trix-document"]||o["text/html"]||o["text/plain"]},s.prototype.getPastedHTMLUsingHiddenElement=function(e){var n,i,r;return i=this.getSelectedRange(),r={position:"absolute",left:window.pageXOffset+"px",top:window.pageYOffset+"px",opacity:0},n=c({style:r,tagName:"div",editable:!0}),document.body.appendChild(n),n.focus(),requestAnimationFrame(function(r){return function(){var o;return o=n.innerHTML,t.removeNode(n),r.setSelectedRange(i),e(o)}}(this))},s.proxyMethod("responder?.getSelectedRange"),s.proxyMethod("responder?.setSelectedRange"),s.proxyMethod("responder?.expandSelectionInDirection"),s.proxyMethod("responder?.selectionIsInCursorTarget"),s.proxyMethod("responder?.selectionIsExpanded"),s}(t.InputController),o=function(t){var e,n;return null!=(e=t.type)&&null!=(n=e.match(/\/(\w+)$/))?n[1]:void 0},s=null!=("function"==typeof" ".codePointAt?" ".codePointAt(0):void 0),p=function(e){var n;return e.key&&s&&e.key.codePointAt(0)===e.keyCode?e.key:(null===e.which?n=e.keyCode:0!==e.which&&0!==e.charCode&&(n=e.charCode),null!=n&&"escape"!==u[n]?t.UTF16String.fromCodepoints([n]).toString():void 0)},h=function(t){var e,n,i,r,o,s,a,u,c;if(a=t.clipboardData){if(g.call(a.types,"text/html")>=0){for(i=0,s=(u=a.types).length;s>i;i++)if(c=u[i],e=/^CorePasteboardFlavorType/.test(c),n=/^dyn\./.test(c)&&a.getData(c),e||n)return!0;return!1}return r=g.call(a.types,"com.apple.webarchive")>=0,o=g.call(a.types,"com.apple.flat-rtfd")>=0,r||o}},e=function(t){function e(t){var e;this.inputController=t,e=this.inputController,this.responder=e.responder,this.delegate=e.delegate,this.inputSummary=e.inputSummary,this.data={}}return d(e,t),e.prototype.start=function(t){var e,n;return this.data.start=t,this.isSignificant()?("keypress"===this.inputSummary.eventName&&this.inputSummary.textAdded&&null!=(e=this.responder)&&e.deleteInDirection("left"),this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=null!=(n=this.responder)?n.getSelectedRange():void 0):void 0},e.prototype.update=function(t){var e;return this.data.update=t,this.isSignificant()&&(e=this.selectPlaceholder())?(this.forgetPlaceholder(),this.range=e):void 0},e.prototype.end=function(t){var e,n,i,r;return this.data.end=t,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.setSelectedRange(this.range),null!=(i=this.responder)&&i.insertString(this.data.end),null!=(r=this.responder)?r.setSelectedRange(this.range[0]+this.data.end.length):void 0):null!=this.data.start||null!=this.data.update?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset()},e.prototype.getEndData=function(){return this.data.end},e.prototype.isEnded=function(){return null!=this.getEndData()},e.prototype.isSignificant=function(){return!n.composesExistingText||this.inputSummary.didInput},e.prototype.canApplyToDocument=function(){var t,e;return 0===(null!=(t=this.data.start)?t.length:void 0)&&(null!=(e=this.data.end)?e.length:void 0)>0&&null!=this.range},e.proxyMethod("inputController.setInputSummary"),e.proxyMethod("inputController.requestRender"),e.proxyMethod("inputController.requestReparse"),e.proxyMethod("responder?.selectionIsExpanded"),e.proxyMethod("responder?.insertPlaceholder"),e.proxyMethod("responder?.selectPlaceholder"),e.proxyMethod("responder?.forgetPlaceholder"),e}(t.BasicObject)}.call(this),function(){var e,n,i,r=function(t,e){return function(){return t.apply(e,arguments)}},o=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};e=t.dataTransferIsPlainText,n=t.keyEventIsKeyboardCommand,i=t.objectsAreEqual,t.Level2InputController=function(s){function u(){return this.render=r(this.render,this),u.__super__.constructor.apply(this,arguments)}var c,l,h,p,d,f;return o(u,s),u.prototype.elementDidMutate=function(){var t;return this.scheduledRender?this.composing&&null!=(t=this.delegate)&&"function"==typeof t.inputControllerDidAllowUnhandledInput?t.inputControllerDidAllowUnhandledInput():void 0:this.reparse()},u.prototype.scheduleRender=function(){return null!=this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)},u.prototype.render=function(){var t;return cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing||null!=(t=this.delegate)&&t.render(),"function"==typeof this.afterRender&&this.afterRender(),this.afterRender=null},u.prototype.reparse=function(){var t;return null!=(t=this.delegate)?t.reparse():void 0},u.prototype.events={keydown:function(t){var e,i,r,o;if(n(t)){if(e=l(t),null!=(o=this.delegate)?o.inputControllerDidReceiveKeyboardCommand(e):void 0)return t.preventDefault()}else if(r=t.key,t.altKey&&(r+="+Alt"),t.shiftKey&&(r+="+Shift"),i=this.keys[r])return this.withEvent(t,i)},paste:function(e){var n,i,r,o,s,a,u,c,l;return h(e)?(e.preventDefault(),this.attachFiles(e.clipboardData.files)):p(e)?(e.preventDefault(),i={type:"text/plain",string:e.clipboardData.getData("text/plain")},null!=(r=this.delegate)&&r.inputControllerWillPaste(i),null!=(o=this.responder)&&o.insertString(i.string),this.render(),null!=(s=this.delegate)?s.inputControllerDidPaste(i):void 0):(n=null!=(a=e.clipboardData)?a.getData("URL"):void 0)?(e.preventDefault(),i={type:"URL",href:n,string:n},null!=(u=this.delegate)&&u.inputControllerWillPaste(i),null!=(c=this.responder)&&c.insertText(t.Text.textForStringWithAttributes(i.string,{href:i.href})),this.render(),null!=(l=this.delegate)?l.inputControllerDidPaste(i):void 0):void 0},beforeinput:function(t){var e;return(e=this.inputTypes[t.inputType])?(this.withEvent(t,e),this.scheduleRender()):void 0},input:function(){return t.selectionChangeObserver.reset()},dragstart:function(t){var e,n;return(null!=(e=this.responder)?e.selectionContainsAttachments():void 0)?(t.dataTransfer.setData("application/x-trix-dragging",!0),this.dragging={range:null!=(n=this.responder)?n.getSelectedRange():void 0,point:d(t)}):void 0},dragenter:function(t){return c(t)?t.preventDefault():void 0},dragover:function(t){var e,n;return this.dragging&&(t.preventDefault(),e=d(t),!i(e,this.dragging.point))?(this.dragging.point=e,null!=(n=this.responder)?n.setLocationRangeFromPointRange(e):void 0):void 0},drop:function(t){var e,n,i,r;return this.dragging?(t.preventDefault(),null!=(n=this.delegate)&&n.inputControllerWillMoveText(),null!=(i=this.responder)&&i.moveTextFromRange(this.dragging.range),this.dragging=null,this.scheduleRender()):c(t)?(t.preventDefault(),e=d(t),null!=(r=this.responder)&&r.setLocationRangeFromPointRange(e),this.attachFiles(t.dataTransfer.files)):void 0},dragend:function(){var t;return this.dragging?(null!=(t=this.responder)&&t.setSelectedRange(this.dragging.range),this.dragging=null):void 0},compositionend:function(){return this.composing?(this.composing=!1,this.scheduleRender()):void 0}},u.prototype.keys={ArrowLeft:function(){var t,e;return(null!=(t=this.responder)?t.shouldManageMovingCursorInDirection("backward"):void 0)?(this.event.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("backward"):void 0):void 0},ArrowRight:function(){var t,e;return(null!=(t=this.responder)?t.shouldManageMovingCursorInDirection("forward"):void 0)?(this.event.preventDefault(),null!=(e=this.responder)?e.moveCursorInDirection("forward"):void 0):void 0},Backspace:function(){var t,e,n;return(null!=(t=this.responder)?t.shouldManageDeletingInDirection("backward"):void 0)?(this.event.preventDefault(),null!=(e=this.delegate)&&e.inputControllerWillPerformTyping(),null!=(n=this.responder)&&n.deleteInDirection("backward"),this.render()):void 0},Tab:function(){var t,e;return(null!=(t=this.responder)?t.canIncreaseNestingLevel():void 0)?(this.event.preventDefault(),null!=(e=this.responder)&&e.increaseNestingLevel(),this.render()):void 0},"Tab+Shift":function(){var t,e;return(null!=(t=this.responder)?t.canDecreaseNestingLevel():void 0)?(this.event.preventDefault(),null!=(e=this.responder)&&e.decreaseNestingLevel(),this.render()):void 0}},u.prototype.inputTypes={deleteByComposition:function(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteByCut:function(){return this.deleteInDirection("backward")},deleteByDrag:function(){return this.event.preventDefault(),this.withTargetDOMRange((function(){var t;return this.deleteByDragRange=null!=(t=this.responder)?t.getSelectedRange():void 0}))},deleteCompositionText:function(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteContent:function(){return this.deleteInDirection("backward")},deleteContentBackward:function(){return this.deleteInDirection("backward")},deleteContentForward:function(){return this.deleteInDirection("forward")},deleteEntireSoftLine:function(){return this.deleteInDirection("forward")},deleteHardLineBackward:function(){return this.deleteInDirection("backward")},deleteHardLineForward:function(){return this.deleteInDirection("forward")},deleteSoftLineBackward:function(){return this.deleteInDirection("backward")},deleteSoftLineForward:function(){return this.deleteInDirection("forward")},deleteWordBackward:function(){return this.deleteInDirection("backward")},deleteWordForward:function(){return this.deleteInDirection("forward")},formatBackColor:function(){return this.activateAttributeIfSupported("backgroundColor",this.event.data)},formatBold:function(){return this.toggleAttributeIfSupported("bold")},formatFontColor:function(){return this.activateAttributeIfSupported("color",this.event.data)},formatFontName:function(){return this.activateAttributeIfSupported("font",this.event.data)},formatIndent:function(){var t;return(null!=(t=this.responder)?t.canIncreaseNestingLevel():void 0)?this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.increaseNestingLevel():void 0})):void 0},formatItalic:function(){return this.toggleAttributeIfSupported("italic")},formatJustifyCenter:function(){return this.toggleAttributeIfSupported("justifyCenter")},formatJustifyFull:function(){return this.toggleAttributeIfSupported("justifyFull")},formatJustifyLeft:function(){return this.toggleAttributeIfSupported("justifyLeft")},formatJustifyRight:function(){return this.toggleAttributeIfSupported("justifyRight")},formatOutdent:function(){var t;return(null!=(t=this.responder)?t.canDecreaseNestingLevel():void 0)?this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.decreaseNestingLevel():void 0})):void 0},formatRemove:function(){return this.withTargetDOMRange((function(){var t,e,n,i;for(t in i=[],null!=(e=this.responder)?e.getCurrentAttributes():void 0)i.push(null!=(n=this.responder)?n.removeCurrentAttribute(t):void 0);return i}))},formatSetBlockTextDirection:function(){return this.activateAttributeIfSupported("blockDir",this.event.data)},formatSetInlineTextDirection:function(){return this.activateAttributeIfSupported("textDir",this.event.data)},formatStrikeThrough:function(){return this.toggleAttributeIfSupported("strike")},formatSubscript:function(){return this.toggleAttributeIfSupported("sub")},formatSuperscript:function(){return this.toggleAttributeIfSupported("sup")},formatUnderline:function(){return this.toggleAttributeIfSupported("underline")},historyRedo:function(){var t;return null!=(t=this.delegate)?t.inputControllerWillPerformRedo():void 0},historyUndo:function(){var t;return null!=(t=this.delegate)?t.inputControllerWillPerformUndo():void 0},insertCompositionText:function(){return this.composing=!0,this.insertString(this.event.data)},insertFromComposition:function(){return this.composing=!1,this.insertString(this.event.data)},insertFromDrop:function(){var t,e;return(t=this.deleteByDragRange)?(this.deleteByDragRange=null,null!=(e=this.delegate)&&e.inputControllerWillMoveText(),this.withTargetDOMRange((function(){var e;return null!=(e=this.responder)?e.moveTextFromRange(t):void 0}))):void 0},insertFromPaste:function(){var n,i,r,o,s,a,u,c,l,h;return n=this.event.dataTransfer,s={dataTransfer:n},(i=n.getData("URL"))?(s.type="URL",s.href=i,s.string=(o=n.getData("public.url-name"))?t.squishBreakableWhitespace(o).trim():i,null!=(a=this.delegate)&&a.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var e;return null!=(e=this.responder)?e.insertText(t.Text.textForStringWithAttributes(s.string,{href:s.href})):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):e(n)?(s.type="text/plain",s.string=n.getData("text/plain"),null!=(u=this.delegate)&&u.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertString(s.string):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):(r=n.getData("text/html"))?(s.type="text/html",s.html=r,null!=(c=this.delegate)&&c.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertHTML(s.html):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):(null!=(l=n.files)?l.length:void 0)?(s.type="File",s.file=n.files[0],null!=(h=this.delegate)&&h.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertFile(s.file):void 0})),this.afterRender=function(t){return function(){var e;return null!=(e=t.delegate)?e.inputControllerDidPaste(s):void 0}}(this)):void 0},insertFromYank:function(){return this.insertString(this.event.data)},insertLineBreak:function(){return this.insertString("\n")},insertLink:function(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList:function(){return this.toggleAttributeIfSupported("number")},insertParagraph:function(){var t;return null!=(t=this.delegate)&&t.inputControllerWillPerformTyping(),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.insertLineBreak():void 0}))},insertReplacementText:function(){return this.insertString(this.event.dataTransfer.getData("text/plain"),{updatePosition:!1})},insertText:function(){var t,e;return this.insertString(null!=(t=this.event.data)?t:null!=(e=this.event.dataTransfer)?e.getData("text/plain"):void 0)},insertTranspose:function(){return this.insertString(this.event.data)},insertUnorderedList:function(){return this.toggleAttributeIfSupported("bullet")}},u.prototype.insertString=function(t,e){var n;return null==t&&(t=""),null!=(n=this.delegate)&&n.inputControllerWillPerformTyping(),this.withTargetDOMRange((function(){var n;return null!=(n=this.responder)?n.insertString(t,e):void 0}))},u.prototype.toggleAttributeIfSupported=function(e){var n;return a.call(t.getAllAttributeNames(),e)>=0?(null!=(n=this.delegate)&&n.inputControllerWillPerformFormatting(e),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.toggleCurrentAttribute(e):void 0}))):void 0},u.prototype.activateAttributeIfSupported=function(e,n){var i;return a.call(t.getAllAttributeNames(),e)>=0?(null!=(i=this.delegate)&&i.inputControllerWillPerformFormatting(e),this.withTargetDOMRange((function(){var t;return null!=(t=this.responder)?t.setCurrentAttribute(e,n):void 0}))):void 0},u.prototype.deleteInDirection=function(t,e){var n,i,r;return(null!=e?e:{recordUndoEntry:!0}).recordUndoEntry&&null!=(r=this.delegate)&&r.inputControllerWillPerformTyping(),i=function(e){return function(){var n;return null!=(n=e.responder)?n.deleteInDirection(t):void 0}}(this),(n=this.getTargetDOMRange({minLength:2}))?this.withTargetDOMRange(n,i):i()},u.prototype.withTargetDOMRange=function(e,n){var i;return"function"==typeof e&&(n=e,e=this.getTargetDOMRange()),e?null!=(i=this.responder)?i.withTargetDOMRange(e,n.bind(this)):void 0:(t.selectionChangeObserver.reset(),n.call(this))},u.prototype.getTargetDOMRange=function(t){var e,n,i,r;return i=(null!=t?t:{minLength:0}).minLength,(r="function"==typeof(e=this.event).getTargetRanges?e.getTargetRanges():void 0)&&r.length&&(n=f(r[0]),0===i||n.toString().length>=i)?n:void 0},f=function(t){var e;return(e=document.createRange()).setStart(t.startContainer,t.startOffset),e.setEnd(t.endContainer,t.endOffset),e},u.prototype.withEvent=function(t,e){var n;this.event=t;try{n=e.call(this)}finally{this.event=null}return n},c=function(t){var e,n;return a.call(null!=(e=null!=(n=t.dataTransfer)?n.types:void 0)?e:[],"Files")>=0},h=function(t){var e;return(e=t.clipboardData)?a.call(e.types,"Files")>=0&&1===e.types.length&&e.files.length>=1:void 0},p=function(t){var e;return(e=t.clipboardData)?a.call(e.types,"text/plain")>=0&&1===e.types.length:void 0},l=function(t){var e;return e=[],t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),e.push(t.key),e},d=function(t){return{x:t.clientX,y:t.clientY}},u}(t.InputController)}.call(this),function(){var e,n,i,r,o,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 i in e)p.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;n=t.defer,i=t.escapeHTML,r=t.handleEvent,a=t.makeElement,c=t.tagName,u=t.config,s=u.lang,e=u.css,o=u.keyNames,t.AttachmentEditorController=function(u){function p(t,e,n,i){this.attachmentPiece=t,this.element=e,this.container=n,this.options=null!=i?i:{},this.didBlurCaption=l(this.didBlurCaption,this),this.didChangeCaption=l(this.didChangeCaption,this),this.didInputCaption=l(this.didInputCaption,this),this.didKeyDownCaption=l(this.didKeyDownCaption,this),this.didClickActionButton=l(this.didClickActionButton,this),this.didClickToolbar=l(this.didClickToolbar,this),this.attachment=this.attachmentPiece.attachment,"a"===c(this.element)&&(this.element=this.element.firstChild),this.install()}var d;return h(p,u),d=function(t){return function(){var e;return(e=t.apply(this,arguments)).do(),null==this.undos&&(this.undos=[]),this.undos.push(e.undo)}},p.prototype.install=function(){return this.makeElementMutable(),this.addToolbar(),this.attachment.isPreviewable()?this.installCaptionEditor():void 0},p.prototype.uninstall=function(){var t,e;for(this.savePendingCaption();e=this.undos.pop();)e();return null!=(t=this.delegate)?t.didUninstallAttachmentEditor(this):void 0},p.prototype.savePendingCaption=function(){var t,e,n;return null!=this.pendingCaption?(t=this.pendingCaption,this.pendingCaption=null,t?null!=(e=this.delegate)&&"function"==typeof e.attachmentEditorDidRequestUpdatingAttributesForAttachment?e.attachmentEditorDidRequestUpdatingAttributesForAttachment({caption:t},this.attachment):void 0:null!=(n=this.delegate)&&"function"==typeof n.attachmentEditorDidRequestRemovingAttributeForAttachment?n.attachmentEditorDidRequestRemovingAttributeForAttachment("caption",this.attachment):void 0):void 0},p.prototype.makeElementMutable=d((function(){return{do:function(t){return function(){return t.element.dataset.trixMutable=!0}}(this),undo:function(t){return function(){return delete t.element.dataset.trixMutable}}(this)}})),p.prototype.addToolbar=d((function(){var n,o,u;return(n=a({tagName:"div",className:e.attachmentToolbar,data:{trixMutable:!0}})).innerHTML='<div class="trix-button-row">\n <span class="trix-button-group trix-button-group--actions">\n <button type="button" data-trix-action="remove" class="trix-button trix-button--remove" title="'+s.remove+'">'+s.remove+"</button>\n </span>\n</div>",this.attachment.isPreviewable()&&(o=i(this.attachment.getFilename()),u=i(this.attachment.getFormattedFilesize()),n.innerHTML+='<div class="'+e.attachmentMetadataContainer+'">\n <span class="'+e.attachmentMetadata+'">\n <span class="'+e.attachmentName+'" title="'+o+'">'+o+'</span>\n <span class="'+e.attachmentSize+'">'+u+"</span>\n </span>\n</div>"),r("click",{onElement:n,withCallback:this.didClickToolbar}),r("click",{onElement:n,matchingSelector:"[data-trix-action]",withCallback:this.didClickActionButton}),{do:function(t){return function(){return t.element.appendChild(n)}}(this),undo:function(){return t.removeNode(n)}}})),p.prototype.installCaptionEditor=d((function(){var i,o,u,c,l;return(c=a({tagName:"textarea",className:e.attachmentCaptionEditor,attributes:{placeholder:s.captionPlaceholder},data:{trixMutable:!0}})).value=this.attachmentPiece.getCaption(),(l=c.cloneNode()).classList.add("trix-autoresize-clone"),l.tabIndex=-1,i=function(){return l.value=c.value,c.style.height=l.scrollHeight+"px"},r("input",{onElement:c,withCallback:i}),r("input",{onElement:c,withCallback:this.didInputCaption}),r("keydown",{onElement:c,withCallback:this.didKeyDownCaption}),r("change",{onElement:c,withCallback:this.didChangeCaption}),r("blur",{onElement:c,withCallback:this.didBlurCaption}),u=this.element.querySelector("figcaption"),o=u.cloneNode(),{do:function(t){return function(){return u.style.display="none",o.appendChild(c),o.appendChild(l),o.classList.add(e.attachmentCaption+"--editing"),u.parentElement.insertBefore(o,u),i(),t.options.editCaption?n((function(){return c.focus()})):void 0}}(this),undo:function(){return t.removeNode(o),u.style.display=null}}})),p.prototype.didClickToolbar=function(t){return t.preventDefault(),t.stopPropagation()},p.prototype.didClickActionButton=function(t){var e;switch(t.target.getAttribute("data-trix-action")){case"remove":return null!=(e=this.delegate)?e.attachmentEditorDidRequestRemovalOfAttachment(this.attachment):void 0}},p.prototype.didKeyDownCaption=function(t){var e;return"return"===o[t.keyCode]?(t.preventDefault(),this.savePendingCaption(),null!=(e=this.delegate)&&"function"==typeof e.attachmentEditorDidRequestDeselectingAttachment?e.attachmentEditorDidRequestDeselectingAttachment(this.attachment):void 0):void 0},p.prototype.didInputCaption=function(t){return this.pendingCaption=t.target.value.replace(/\s/g," ").trim()},p.prototype.didChangeCaption=function(){return this.savePendingCaption()},p.prototype.didBlurCaption=function(){return this.savePendingCaption()},p}(t.BasicObject)}.call(this),function(){var e,n,i,r=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;i=t.makeElement,e=t.config.css,t.AttachmentView=function(o){function s(){s.__super__.constructor.apply(this,arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}var a;return r(s,o),s.attachmentSelector="[data-trix-attachment]",s.prototype.createContentNodes=function(){return[]},s.prototype.createNodes=function(){var t,n,r,o,s,u,c;if(t=o=i({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),(n=this.getHref())&&(o=i({tagName:"a",editable:!1,attributes:{href:n,tabindex:-1}}),t.appendChild(o)),this.attachment.hasContent())o.innerHTML=this.attachment.getContent();else for(r=0,s=(c=this.createContentNodes()).length;s>r;r++)u=c[r],o.appendChild(u);return o.appendChild(this.createCaptionElement()),this.attachment.isPending()&&(this.progressElement=i({tagName:"progress",attributes:{class:e.attachmentProgress,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:["progressElement",this.attachment.id].join("/")}}),t.appendChild(this.progressElement)),[a("left"),t,a("right")]},s.prototype.createCaptionElement=function(){var t,n,r,o,s,a,u;return r=i({tagName:"figcaption",className:e.attachmentCaption}),(t=this.attachmentPiece.getCaption())?(r.classList.add(e.attachmentCaption+"--edited"),r.textContent=t):((n=this.getCaptionConfig()).name&&(o=this.attachment.getFilename()),n.size&&(a=this.attachment.getFormattedFilesize()),o&&(s=i({tagName:"span",className:e.attachmentName,textContent:o}),r.appendChild(s)),a&&(o&&r.appendChild(document.createTextNode(" ")),u=i({tagName:"span",className:e.attachmentSize,textContent:a}),r.appendChild(u))),r},s.prototype.getClassName=function(){var t,n;return n=[e.attachment,e.attachment+"--"+this.attachment.getType()],(t=this.attachment.getExtension())&&n.push(e.attachment+"--"+t),n.join(" ")},s.prototype.getData=function(){var t,e;return e={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:this.attachment.id},(t=this.attachmentPiece.attributes).isEmpty()||(e.trixAttributes=JSON.stringify(t)),this.attachment.isPending()&&(e.trixSerialize=!1),e},s.prototype.getHref=function(){return n(this.attachment.getContent(),"a")?void 0:this.attachment.getHref()},s.prototype.getCaptionConfig=function(){var e,n,i;return i=this.attachment.getType(),e=t.copyObject(null!=(n=t.config.attachments[i])?n.caption:void 0),"file"===i&&(e.name=!0),e},s.prototype.findProgressElement=function(){var t;return null!=(t=this.findElement())?t.querySelector("progress"):void 0},a=function(e){return i({tagName:"span",textContent:t.ZERO_WIDTH_SPACE,data:{trixCursorTarget:e,trixSerialize:!1}})},s.prototype.attachmentDidChangeUploadProgress=function(){var t,e;return e=this.attachment.getUploadProgress(),null!=(t=this.findProgressElement())?t.value=e:void 0},s}(t.ObjectView),n=function(t,e){var n;return n=i("div"),n.innerHTML=null!=t?t:"",n.querySelector(e)}}.call(this),function(){var e,n=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;e=t.makeElement,t.PreviewableAttachmentView=function(i){function r(){r.__super__.constructor.apply(this,arguments),this.attachment.previewDelegate=this}return n(r,i),r.prototype.createContentNodes=function(){return this.image=e({tagName:"img",attributes:{src:""},data:{trixMutable:!0}}),this.refresh(this.image),[this.image]},r.prototype.createCaptionElement=function(){var e;return(e=r.__super__.createCaptionElement.apply(this,arguments)).textContent||e.setAttribute("data-trix-placeholder",t.config.lang.captionPlaceholder),e},r.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},r.prototype.updateAttributesForImage=function(t){var e,n,i,r,o,s;return o=this.attachment.getURL(),n=this.attachment.getPreviewURL(),t.src=n||o,n===o?t.removeAttribute("data-trix-serialized-attributes"):(i=JSON.stringify({src:o}),t.setAttribute("data-trix-serialized-attributes",i)),s=this.attachment.getWidth(),e=this.attachment.getHeight(),null!=s&&(t.width=s),null!=e&&(t.height=e),r=["imageElement",this.attachment.id,t.src,t.width,t.height].join("/"),t.dataset.trixStoreKey=r},r.prototype.attachmentDidChangeAttributes=function(){return this.refresh(this.image),this.refresh()},r}(t.AttachmentView)}.call(this),function(){var e,n,i,r=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;i=t.makeElement,e=t.findInnerElement,n=t.getTextConfig,t.PieceView=function(o){function s(){var t;s.__super__.constructor.apply(this,arguments),this.piece=this.object,this.attributes=this.piece.getAttributes(),t=this.options,this.textConfig=t.textConfig,this.context=t.context,this.piece.attachment?this.attachment=this.piece.attachment:this.string=this.piece.toString()}var a;return r(s,o),s.prototype.createNodes=function(){var t,n,i,r,o,s;if(s=this.attachment?this.createAttachmentNodes():this.createStringNodes(),t=this.createElement()){for(i=e(t),n=0,r=s.length;r>n;n++)o=s[n],i.appendChild(o);s=[t]}return s},s.prototype.createAttachmentNodes=function(){var e;return e=this.attachment.isPreviewable()?t.PreviewableAttachmentView:t.AttachmentView,this.createChildView(e,this.piece.attachment,{piece:this.piece}).getNodes()},s.prototype.createStringNodes=function(){var t,e,n,r,o,s,a,u,c;if(null!=(a=this.textConfig)?a.plaintext:void 0)return[document.createTextNode(this.string)];for(s=[],n=e=0,r=(u=this.string.split("\n")).length;r>e;n=++e)c=u[n],n>0&&(t=i("br"),s.push(t)),c.length&&(o=document.createTextNode(this.preserveSpaces(c)),s.push(o));return s},s.prototype.createElement=function(){var t,e,r,o,s,a,u,c,l;for(o in c={},a=this.attributes)if(l=a[o],(t=n(o))&&(t.tagName&&(s=i(t.tagName),r?(r.appendChild(s),r=s):e=r=s),t.styleProperty&&(c[t.styleProperty]=l),t.style))for(o in u=t.style)l=u[o],c[o]=l;if(Object.keys(c).length)for(o in null==e&&(e=i("span")),c)l=c[o],e.style[o]=l;return e},s.prototype.createContainerElement=function(){var t,e,r,o,s;for(r in o=this.attributes)if(s=o[r],(e=n(r))&&e.groupTagName)return(t={})[r]=s,i(e.groupTagName,t)},a=t.NON_BREAKING_SPACE,s.prototype.preserveSpaces=function(t){return this.context.isLast&&(t=t.replace(/\ $/,a)),t=t.replace(/(\S)\ {3}(\S)/g,"$1 "+a+" $2").replace(/\ {2}/g,a+" ").replace(/\ {2}/g," "+a),(this.context.isFirst||this.context.followsWhitespace)&&(t=t.replace(/^\ /,a)),t},s}(t.ObjectView)}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.TextView=function(n){function i(){i.__super__.constructor.apply(this,arguments),this.text=this.object,this.textConfig=this.options.textConfig}var r;return e(i,n),i.prototype.createNodes=function(){var e,n,i,o,s,a,u,c,l,h;for(a=[],o=(c=t.ObjectGroup.groupObjects(this.getPieces())).length-1,i=n=0,s=c.length;s>n;i=++n)u=c[i],e={},0===i&&(e.isFirst=!0),i===o&&(e.isLast=!0),r(l)&&(e.followsWhitespace=!0),h=this.findOrCreateCachedChildView(t.PieceView,u,{textConfig:this.textConfig,context:e}),a.push.apply(a,h.getNodes()),l=u;return a},i.prototype.getPieces=function(){var t,e,n,i,r;for(r=[],t=0,e=(i=this.text.getPieces()).length;e>t;t++)(n=i[t]).hasAttribute("blockBreak")||r.push(n);return r},r=function(t){return/\s$/.test(null!=t?t.toString():void 0)},i}(t.ObjectView)}.call(this),function(){var e,n,i,r=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;i=t.makeElement,n=t.getBlockConfig,e=t.config.css,t.BlockView=function(o){function s(){s.__super__.constructor.apply(this,arguments),this.block=this.object,this.attributes=this.block.getAttributes()}return r(s,o),s.prototype.createNodes=function(){var e,r,o,s,a,u,c,l;if(a=[document.createComment("block")],this.block.isEmpty()?a.push(i("br")):(c=null!=(u=n(this.block.getLastAttribute()))?u.text:void 0,l=this.findOrCreateCachedChildView(t.TextView,this.block.text,{textConfig:c}),a.push.apply(a,l.getNodes()),this.shouldAddExtraNewlineElement()&&a.push(i("br"))),this.attributes.length)return a;for(e=i(t.config.blockAttributes.default.tagName),r=0,o=a.length;o>r;r++)s=a[r],e.appendChild(s);return[e]},s.prototype.createContainerElement=function(t){var r,o,s;return r=this.attributes[t],o={tagName:n(r).tagName},"attachmentGallery"===r&&(s=this.block.getBlockBreakPosition(),o.className=e.attachmentGallery+" "+e.attachmentGallery+"--"+s),i(o)},s.prototype.shouldAddExtraNewlineElement=function(){return/\n\n$/.test(this.block.toString())},s}(t.ObjectView)}.call(this),function(){var e,n,i=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e=t.defer,n=t.makeElement,t.DocumentView=function(r){function o(){o.__super__.constructor.apply(this,arguments),this.element=this.options.element,this.elementStore=new t.ElementStore,this.setDocument(this.object)}var s,a,u;return i(o,r),o.render=function(t){var e,i;return(i=new this(t,{element:e=n("div")})).render(),i.sync(),e},o.prototype.setDocument=function(t){return t.isEqualTo(this.document)?void 0:this.document=this.object=t},o.prototype.render=function(){var e,i,r,o,s,a,u;if(this.childViews=[],this.shadowElement=n("div"),!this.document.isEmpty()){for(a=[],e=0,i=(s=t.ObjectGroup.groupObjects(this.document.getBlocks(),{asTree:!0})).length;i>e;e++)o=s[e],u=this.findOrCreateCachedChildView(t.BlockView,o),a.push(function(){var t,e,n,i;for(i=[],t=0,e=(n=u.getNodes()).length;e>t;t++)r=n[t],i.push(this.shadowElement.appendChild(r));return i}.call(this));return a}},o.prototype.isSynced=function(){return s(this.shadowElement,this.element)},o.prototype.sync=function(){var t;for(t=this.createDocumentFragmentForSync();this.element.lastChild;)this.element.removeChild(this.element.lastChild);return this.element.appendChild(t),this.didSync()},o.prototype.didSync=function(){return this.elementStore.reset(a(this.element)),e(function(t){return function(){return t.garbageCollectCachedViews()}}(this))},o.prototype.createDocumentFragmentForSync=function(){var t,e,n,i,r,o,s,u,c,l;for(e=document.createDocumentFragment(),n=0,r=(u=this.shadowElement.childNodes).length;r>n;n++)s=u[n],e.appendChild(s.cloneNode(!0));for(i=0,o=(c=a(e)).length;o>i;i++)t=c[i],(l=this.elementStore.remove(t))&&t.parentNode.replaceChild(l,t);return e},a=function(t){return t.querySelectorAll("[data-trix-store-key]")},s=function(t,e){return u(t.innerHTML)===u(e.innerHTML)},u=function(t){return t.replace(/&nbsp;/g," ")},o}(t.ObjectView)}.call(this),function(){var e,n,i,r,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function n(){this.constructor=t}for(var i in e)u.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t.findClosestElementFromNode,r=t.handleEvent,o=t.innerElementIsActive,n=t.defer,e=t.AttachmentView.attachmentSelector,t.CompositionController=function(u){function c(n,i){this.element=n,this.composition=i,this.didClickAttachment=s(this.didClickAttachment,this),this.didBlur=s(this.didBlur,this),this.didFocus=s(this.didFocus,this),this.documentView=new t.DocumentView(this.composition.document,{element:this.element}),r("focus",{onElement:this.element,withCallback:this.didFocus}),r("blur",{onElement:this.element,withCallback:this.didBlur}),r("click",{onElement:this.element,matchingSelector:"a[contenteditable=false]",preventDefault:!0}),r("mousedown",{onElement:this.element,matchingSelector:e,withCallback:this.didClickAttachment}),r("click",{onElement:this.element,matchingSelector:"a"+e,preventDefault:!0})}return a(c,u),c.prototype.didFocus=function(){var t,e,n;return t=function(t){return function(){var e;return t.focused?void 0:(t.focused=!0,null!=(e=t.delegate)&&"function"==typeof e.compositionControllerDidFocus?e.compositionControllerDidFocus():void 0)}}(this),null!=(e=null!=(n=this.blurPromise)?n.then(t):void 0)?e:t()},c.prototype.didBlur=function(){return this.blurPromise=new Promise(function(t){return function(e){return n((function(){var n;return o(t.element)||(t.focused=null,null!=(n=t.delegate)&&"function"==typeof n.compositionControllerDidBlur&&n.compositionControllerDidBlur()),t.blurPromise=null,e()}))}}(this))},c.prototype.didClickAttachment=function(t,e){var n,r,o;return n=this.findAttachmentForElement(e),r=null!=i(t.target,{matchingSelector:"figcaption"}),null!=(o=this.delegate)&&"function"==typeof o.compositionControllerDidSelectAttachment?o.compositionControllerDidSelectAttachment(n,{editCaption:r}):void 0},c.prototype.getSerializableElement=function(){return this.isEditingAttachment()?this.documentView.shadowElement:this.element},c.prototype.render=function(){var t,e,n;return this.revision!==this.composition.revision&&(this.documentView.setDocument(this.composition.document),this.documentView.render(),this.revision=this.composition.revision),this.canSyncDocumentView()&&!this.documentView.isSynced()&&(null!=(t=this.delegate)&&"function"==typeof t.compositionControllerWillSyncDocumentView&&t.compositionControllerWillSyncDocumentView(),this.documentView.sync(),null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidSyncDocumentView&&e.compositionControllerDidSyncDocumentView()),null!=(n=this.delegate)&&"function"==typeof n.compositionControllerDidRender?n.compositionControllerDidRender():void 0},c.prototype.rerenderViewForObject=function(t){return this.invalidateViewForObject(t),this.render()},c.prototype.invalidateViewForObject=function(t){return this.documentView.invalidateViewForObject(t)},c.prototype.isViewCachingEnabled=function(){return this.documentView.isViewCachingEnabled()},c.prototype.enableViewCaching=function(){return this.documentView.enableViewCaching()},c.prototype.disableViewCaching=function(){return this.documentView.disableViewCaching()},c.prototype.refreshViewCache=function(){return this.documentView.garbageCollectCachedViews()},c.prototype.isEditingAttachment=function(){return null!=this.attachmentEditor},c.prototype.installAttachmentEditorForAttachment=function(e,n){var i,r,o;if((null!=(o=this.attachmentEditor)?o.attachment:void 0)!==e&&(r=this.documentView.findElementForObject(e)))return this.uninstallAttachmentEditor(),i=this.composition.document.getAttachmentPieceForAttachment(e),this.attachmentEditor=new t.AttachmentEditorController(i,r,this.element,n),this.attachmentEditor.delegate=this},c.prototype.uninstallAttachmentEditor=function(){var t;return null!=(t=this.attachmentEditor)?t.uninstall():void 0},c.prototype.didUninstallAttachmentEditor=function(){return this.attachmentEditor=null,this.render()},c.prototype.attachmentEditorDidRequestUpdatingAttributesForAttachment=function(t,e){var n;return null!=(n=this.delegate)&&"function"==typeof n.compositionControllerWillUpdateAttachment&&n.compositionControllerWillUpdateAttachment(e),this.composition.updateAttributesForAttachment(t,e)},c.prototype.attachmentEditorDidRequestRemovingAttributeForAttachment=function(t,e){var n;return null!=(n=this.delegate)&&"function"==typeof n.compositionControllerWillUpdateAttachment&&n.compositionControllerWillUpdateAttachment(e),this.composition.removeAttributeForAttachment(t,e)},c.prototype.attachmentEditorDidRequestRemovalOfAttachment=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidRequestRemovalOfAttachment?e.compositionControllerDidRequestRemovalOfAttachment(t):void 0},c.prototype.attachmentEditorDidRequestDeselectingAttachment=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionControllerDidRequestDeselectingAttachment?e.compositionControllerDidRequestDeselectingAttachment(t):void 0},c.prototype.canSyncDocumentView=function(){return!this.isEditingAttachment()},c.prototype.findAttachmentForElement=function(t){return this.composition.document.getAttachmentById(parseInt(t.dataset.trixId,10))},c}(t.BasicObject)}.call(this),function(){var e,n,i,r=function(t,e){return function(){return t.apply(e,arguments)}},o=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t.handleEvent,i=t.triggerEvent,e=t.findClosestElementFromNode,t.ToolbarController=function(t){function s(t){this.element=t,this.didKeyDownDialogInput=r(this.didKeyDownDialogInput,this),this.didClickDialogButton=r(this.didClickDialogButton,this),this.didClickAttributeButton=r(this.didClickAttributeButton,this),this.didClickActionButton=r(this.didClickActionButton,this),this.attributes={},this.actions={},this.resetDialogInputs(),n("mousedown",{onElement:this.element,matchingSelector:a,withCallback:this.didClickActionButton}),n("mousedown",{onElement:this.element,matchingSelector:u,withCallback:this.didClickAttributeButton}),n("click",{onElement:this.element,matchingSelector:m,preventDefault:!0}),n("click",{onElement:this.element,matchingSelector:c,withCallback:this.didClickDialogButton}),n("keydown",{onElement:this.element,matchingSelector:l,withCallback:this.didKeyDownDialogInput})}var a,u,c,l,h,p,d,f,g,m;return o(s,t),m=(u="[data-trix-attribute]")+", "+(a="[data-trix-action]"),(h="[data-trix-dialog]")+"[data-trix-active]",c=h+" [data-trix-method]",l=h+" [data-trix-input]",s.prototype.didClickActionButton=function(t,e){var n,i,r;return null!=(i=this.delegate)&&i.toolbarDidClickButton(),t.preventDefault(),n=p(e),this.getDialog(n)?this.toggleDialog(n):null!=(r=this.delegate)?r.toolbarDidInvokeAction(n):void 0},s.prototype.didClickAttributeButton=function(t,e){var n,i,r;return null!=(i=this.delegate)&&i.toolbarDidClickButton(),t.preventDefault(),n=d(e),this.getDialog(n)?this.toggleDialog(n):null!=(r=this.delegate)&&r.toolbarDidToggleAttribute(n),this.refreshAttributeButtons()},s.prototype.didClickDialogButton=function(t,n){var i;return i=e(n,{matchingSelector:h}),this[n.getAttribute("data-trix-method")].call(this,i)},s.prototype.didKeyDownDialogInput=function(t,e){var n,i;return 13===t.keyCode&&(t.preventDefault(),n=e.getAttribute("name"),i=this.getDialog(n),this.setAttribute(i)),27===t.keyCode?(t.preventDefault(),this.hideDialog()):void 0},s.prototype.updateActions=function(t){return this.actions=t,this.refreshActionButtons()},s.prototype.refreshActionButtons=function(){return this.eachActionButton(function(t){return function(e,n){return e.disabled=!1===t.actions[n]}}(this))},s.prototype.eachActionButton=function(t){var e,n,i,r,o;for(o=[],n=0,i=(r=this.element.querySelectorAll(a)).length;i>n;n++)e=r[n],o.push(t(e,p(e)));return o},s.prototype.updateAttributes=function(t){return this.attributes=t,this.refreshAttributeButtons()},s.prototype.refreshAttributeButtons=function(){return this.eachAttributeButton(function(t){return function(e,n){return e.disabled=!1===t.attributes[n],t.attributes[n]||t.dialogIsVisible(n)?(e.setAttribute("data-trix-active",""),e.classList.add("trix-active")):(e.removeAttribute("data-trix-active"),e.classList.remove("trix-active"))}}(this))},s.prototype.eachAttributeButton=function(t){var e,n,i,r,o;for(o=[],n=0,i=(r=this.element.querySelectorAll(u)).length;i>n;n++)e=r[n],o.push(t(e,d(e)));return o},s.prototype.applyKeyboardCommand=function(t){var e,n,r,o,s,a;for(o=JSON.stringify(t.sort()),r=0,s=(a=this.element.querySelectorAll("[data-trix-key]")).length;s>r;r++)if(n=(e=a[r]).getAttribute("data-trix-key").split("+"),JSON.stringify(n.sort())===o)return i("mousedown",{onElement:e}),!0;return!1},s.prototype.dialogIsVisible=function(t){var e;return(e=this.getDialog(t))?e.hasAttribute("data-trix-active"):void 0},s.prototype.toggleDialog=function(t){return this.dialogIsVisible(t)?this.hideDialog():this.showDialog(t)},s.prototype.showDialog=function(t){var e,n,i,r,o,s,a,u,c;for(this.hideDialog(),null!=(s=this.delegate)&&s.toolbarWillShowDialog(),(n=this.getDialog(t)).setAttribute("data-trix-active",""),n.classList.add("trix-active"),i=0,o=(a=n.querySelectorAll("input[disabled]")).length;o>i;i++)a[i].removeAttribute("disabled");return(e=d(n))&&(r=g(n,t))&&(r.value=null!=(u=this.attributes[e])?u:"",r.select()),null!=(c=this.delegate)?c.toolbarDidShowDialog(t):void 0},s.prototype.setAttribute=function(t){var e,n,i;return e=d(t),(n=g(t,e)).willValidate&&!n.checkValidity()?(n.setAttribute("data-trix-validate",""),n.classList.add("trix-validate"),n.focus()):(null!=(i=this.delegate)&&i.toolbarDidUpdateAttribute(e,n.value),this.hideDialog())},s.prototype.removeAttribute=function(t){var e,n;return e=d(t),null!=(n=this.delegate)&&n.toolbarDidRemoveAttribute(e),this.hideDialog()},s.prototype.hideDialog=function(){var t,e;return(t=this.element.querySelector("[data-trix-dialog][data-trix-active]"))?(t.removeAttribute("data-trix-active"),t.classList.remove("trix-active"),this.resetDialogInputs(),null!=(e=this.delegate)?e.toolbarDidHideDialog(f(t)):void 0):void 0},s.prototype.resetDialogInputs=function(){var t,e,n,i,r;for(r=[],t=0,n=(i=this.element.querySelectorAll(l)).length;n>t;t++)(e=i[t]).setAttribute("disabled","disabled"),e.removeAttribute("data-trix-validate"),r.push(e.classList.remove("trix-validate"));return r},s.prototype.getDialog=function(t){return this.element.querySelector("[data-trix-dialog="+t+"]")},g=function(t,e){return null==e&&(e=d(t)),t.querySelector("[data-trix-input][name='"+e+"']")},p=function(t){return t.getAttribute("data-trix-action")},d=function(t){var e;return null!=(e=t.getAttribute("data-trix-attribute"))?e:t.getAttribute("data-trix-dialog-attribute")},f=function(t){return t.getAttribute("data-trix-dialog")},s}(t.BasicObject)}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.ImagePreloadOperation=function(t){function n(t){this.url=t}return e(n,t),n.prototype.perform=function(t){var e;return(e=new Image).onload=function(n){return function(){return e.width=n.width=e.naturalWidth,e.height=n.height=e.naturalHeight,t(!0,e)}}(this),e.onerror=function(){return t(!1)},e.src=this.url},n}(t.Operation)}.call(this),function(){var e=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;t.Attachment=function(i){function r(n){null==n&&(n={}),this.releaseFile=e(this.releaseFile,this),r.__super__.constructor.apply(this,arguments),this.attributes=t.Hash.box(n),this.didChangeAttributes()}return n(r,i),r.previewablePattern=/^image(\/(gif|png|jpe?g)|$)/,r.attachmentForFile=function(t){var e;return(e=new this(this.attributesForFile(t))).setFile(t),e},r.attributesForFile=function(e){return new t.Hash({filename:e.name,filesize:e.size,contentType:e.type})},r.fromJSON=function(t){return new this(t)},r.prototype.getAttribute=function(t){return this.attributes.get(t)},r.prototype.hasAttribute=function(t){return this.attributes.has(t)},r.prototype.getAttributes=function(){return this.attributes.toObject()},r.prototype.setAttributes=function(t){var e,n,i;return null==t&&(t={}),e=this.attributes.merge(t),this.attributes.isEqualTo(e)?void 0:(this.attributes=e,this.didChangeAttributes(),null!=(n=this.previewDelegate)&&"function"==typeof n.attachmentDidChangeAttributes&&n.attachmentDidChangeAttributes(this),null!=(i=this.delegate)&&"function"==typeof i.attachmentDidChangeAttributes?i.attachmentDidChangeAttributes(this):void 0)},r.prototype.didChangeAttributes=function(){return this.isPreviewable()?this.preloadURL():void 0},r.prototype.isPending=function(){return null!=this.file&&!(this.getURL()||this.getHref())},r.prototype.isPreviewable=function(){return this.attributes.has("previewable")?this.attributes.get("previewable"):this.constructor.previewablePattern.test(this.getContentType())},r.prototype.getType=function(){return this.hasContent()?"content":this.isPreviewable()?"preview":"file"},r.prototype.getURL=function(){return this.attributes.get("url")},r.prototype.getHref=function(){return this.attributes.get("href")},r.prototype.getFilename=function(){var t;return null!=(t=this.attributes.get("filename"))?t:""},r.prototype.getFilesize=function(){return this.attributes.get("filesize")},r.prototype.getFormattedFilesize=function(){var e;return"number"==typeof(e=this.attributes.get("filesize"))?t.config.fileSize.formatter(e):""},r.prototype.getExtension=function(){var t;return null!=(t=this.getFilename().match(/\.(\w+)$/))?t[1].toLowerCase():void 0},r.prototype.getContentType=function(){return this.attributes.get("contentType")},r.prototype.hasContent=function(){return this.attributes.has("content")},r.prototype.getContent=function(){return this.attributes.get("content")},r.prototype.getWidth=function(){return this.attributes.get("width")},r.prototype.getHeight=function(){return this.attributes.get("height")},r.prototype.getFile=function(){return this.file},r.prototype.setFile=function(t){return this.file=t,this.isPreviewable()?this.preloadFile():void 0},r.prototype.releaseFile=function(){return this.releasePreloadedFile(),this.file=null},r.prototype.getUploadProgress=function(){var t;return null!=(t=this.uploadProgress)?t:0},r.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},r.prototype.toJSON=function(){return this.getAttributes()},r.prototype.getCacheKey=function(){return[r.__super__.getCacheKey.apply(this,arguments),this.attributes.getCacheKey(),this.getPreviewURL()].join("/")},r.prototype.getPreviewURL=function(){return this.previewURL||this.preloadingURL},r.prototype.setPreviewURL=function(t){var e,n;return t!==this.getPreviewURL()?(this.previewURL=t,null!=(e=this.previewDelegate)&&"function"==typeof e.attachmentDidChangeAttributes&&e.attachmentDidChangeAttributes(this),null!=(n=this.delegate)&&"function"==typeof n.attachmentDidChangePreviewURL?n.attachmentDidChangePreviewURL(this):void 0):void 0},r.prototype.preloadURL=function(){return this.preload(this.getURL(),this.releaseFile)},r.prototype.preloadFile=function(){return this.file?(this.fileObjectURL=URL.createObjectURL(this.file),this.preload(this.fileObjectURL)):void 0},r.prototype.releasePreloadedFile=function(){return this.fileObjectURL?(URL.revokeObjectURL(this.fileObjectURL),this.fileObjectURL=null):void 0},r.prototype.preload=function(e,n){return e&&e!==this.getPreviewURL()?(this.preloadingURL=e,new t.ImagePreloadOperation(e).then(function(t){return function(i){var r,o;return o=i.width,r=i.height,t.getWidth()&&t.getHeight()||t.setAttributes({width:o,height:r}),t.preloadingURL=null,t.setPreviewURL(e),"function"==typeof n?n():void 0}}(this)).catch(function(t){return function(){return t.preloadingURL=null,"function"==typeof n?n():void 0}}(this))):void 0},r}(t.Object)}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.Piece=function(n){function i(e,n){null==n&&(n={}),i.__super__.constructor.apply(this,arguments),this.attributes=t.Hash.box(n)}return e(i,n),i.types={},i.registerType=function(t,e){return e.type=t,this.types[t]=e},i.fromJSON=function(t){var e;return(e=this.types[t.type])?e.fromJSON(t):void 0},i.prototype.copyWithAttributes=function(t){return new this.constructor(this.getValue(),t)},i.prototype.copyWithAdditionalAttributes=function(t){return this.copyWithAttributes(this.attributes.merge(t))},i.prototype.copyWithoutAttribute=function(t){return this.copyWithAttributes(this.attributes.remove(t))},i.prototype.copy=function(){return this.copyWithAttributes(this.attributes)},i.prototype.getAttribute=function(t){return this.attributes.get(t)},i.prototype.getAttributesHash=function(){return this.attributes},i.prototype.getAttributes=function(){return this.attributes.toObject()},i.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()):{}},i.prototype.hasAttribute=function(t){return this.attributes.has(t)},i.prototype.hasSameStringValueAsPiece=function(t){return null!=t&&this.toString()===t.toString()},i.prototype.hasSameAttributesAsPiece=function(t){return null!=t&&(this.attributes===t.attributes||this.attributes.isEqualTo(t.attributes))},i.prototype.isBlockBreak=function(){return!1},i.prototype.isEqualTo=function(t){return i.__super__.isEqualTo.apply(this,arguments)||this.hasSameConstructorAs(t)&&this.hasSameStringValueAsPiece(t)&&this.hasSameAttributesAsPiece(t)},i.prototype.isEmpty=function(){return 0===this.length},i.prototype.isSerializable=function(){return!0},i.prototype.toJSON=function(){return{type:this.constructor.type,attributes:this.getAttributes()}},i.prototype.contentsForInspection=function(){return{type:this.constructor.type,attributes:this.attributes.inspect()}},i.prototype.canBeGrouped=function(){return this.hasAttribute("href")},i.prototype.canBeGroupedWith=function(t){return this.getAttribute("href")===t.getAttribute("href")},i.prototype.getLength=function(){return this.length},i.prototype.canBeConsolidatedWith=function(){return!1},i}(t.Object)}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.Piece.registerType("attachment",t.AttachmentPiece=function(n){function i(t){this.attachment=t,i.__super__.constructor.apply(this,arguments),this.length=1,this.ensureAttachmentExclusivelyHasAttribute("href"),this.attachment.hasContent()||this.removeProhibitedAttributes()}return e(i,n),i.fromJSON=function(e){return new this(t.Attachment.fromJSON(e.attachment),e.attributes)},i.permittedAttributes=["caption","presentation"],i.prototype.ensureAttachmentExclusivelyHasAttribute=function(t){return this.hasAttribute(t)?(this.attachment.hasAttribute(t)||this.attachment.setAttributes(this.attributes.slice(t)),this.attributes=this.attributes.remove(t)):void 0},i.prototype.removeProhibitedAttributes=function(){var t;return(t=this.attributes.slice(this.constructor.permittedAttributes)).isEqualTo(this.attributes)?void 0:this.attributes=t},i.prototype.getValue=function(){return this.attachment},i.prototype.isSerializable=function(){return!this.attachment.isPending()},i.prototype.getCaption=function(){var t;return null!=(t=this.attributes.get("caption"))?t:""},i.prototype.isEqualTo=function(t){var e;return i.__super__.isEqualTo.apply(this,arguments)&&this.attachment.id===(null!=t&&null!=(e=t.attachment)?e.id:void 0)},i.prototype.toString=function(){return t.OBJECT_REPLACEMENT_CHARACTER},i.prototype.toJSON=function(){var t;return(t=i.__super__.toJSON.apply(this,arguments)).attachment=this.attachment,t},i.prototype.getCacheKey=function(){return[i.__super__.getCacheKey.apply(this,arguments),this.attachment.getCacheKey()].join("/")},i.prototype.toConsole=function(){return JSON.stringify(this.toString())},i}(t.Piece))}.call(this),function(){var e,n=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;e=t.normalizeNewlines,t.Piece.registerType("string",t.StringPiece=function(t){function i(t){i.__super__.constructor.apply(this,arguments),this.string=e(t),this.length=this.string.length}return n(i,t),i.fromJSON=function(t){return new this(t.string,t.attributes)},i.prototype.getValue=function(){return this.string},i.prototype.toString=function(){return this.string.toString()},i.prototype.isBlockBreak=function(){return"\n"===this.toString()&&!0===this.getAttribute("blockBreak")},i.prototype.toJSON=function(){var t;return(t=i.__super__.toJSON.apply(this,arguments)).string=this.string,t},i.prototype.canBeConsolidatedWith=function(t){return null!=t&&this.hasSameConstructorAs(t)&&this.hasSameAttributesAsPiece(t)},i.prototype.consolidateWith=function(t){return new this.constructor(this.toString()+t.toString(),this.attributes)},i.prototype.splitAtOffset=function(t){var e,n;return 0===t?(e=null,n=this):t===this.length?(e=this,n=null):(e=new this.constructor(this.string.slice(0,t),this.attributes),n=new this.constructor(this.string.slice(t),this.attributes)),[e,n]},i.prototype.toConsole=function(){var t;return(t=this.string).length>15&&(t=t.slice(0,14)+"\u2026"),JSON.stringify(t.toString())},i}(t.Piece))}.call(this),function(){var e,n=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty,r=[].slice;e=t.spliceArray,t.SplittableList=function(t){function i(t){null==t&&(t=[]),i.__super__.constructor.apply(this,arguments),this.objects=t.slice(0),this.length=this.objects.length}var o,s,a;return n(i,t),i.box=function(t){return t instanceof this?t:new this(t)},i.prototype.indexOf=function(t){return this.objects.indexOf(t)},i.prototype.splice=function(){var t;return t=1<=arguments.length?r.call(arguments,0):[],new this.constructor(e.apply(null,[this.objects].concat(r.call(t))))},i.prototype.eachObject=function(t){var e,n,i,r,o,s;for(s=[],n=e=0,i=(o=this.objects).length;i>e;n=++e)r=o[n],s.push(t(r,n));return s},i.prototype.insertObjectAtIndex=function(t,e){return this.splice(e,0,t)},i.prototype.insertSplittableListAtIndex=function(t,e){return this.splice.apply(this,[e,0].concat(r.call(t.objects)))},i.prototype.insertSplittableListAtPosition=function(t,e){var n,i,r;return i=(r=this.splitObjectAtPosition(e))[0],n=r[1],new this.constructor(i).insertSplittableListAtIndex(t,n)},i.prototype.editObjectAtIndex=function(t,e){return this.replaceObjectAtIndex(e(this.objects[t]),t)},i.prototype.replaceObjectAtIndex=function(t,e){return this.splice(e,1,t)},i.prototype.removeObjectAtIndex=function(t){return this.splice(t,1)},i.prototype.getObjectAtIndex=function(t){return this.objects[t]},i.prototype.getSplittableListInRange=function(t){var e,n,i,r;return n=(i=this.splitObjectsAtRange(t))[0],e=i[1],r=i[2],new this.constructor(n.slice(e,r+1))},i.prototype.selectSplittableList=function(t){var e,n;return n=function(){var n,i,r,o;for(o=[],n=0,i=(r=this.objects).length;i>n;n++)e=r[n],t(e)&&o.push(e);return o}.call(this),new this.constructor(n)},i.prototype.removeObjectsInRange=function(t){var e,n,i,r;return n=(i=this.splitObjectsAtRange(t))[0],e=i[1],r=i[2],new this.constructor(n).splice(e,r-e+1)},i.prototype.transformObjectsInRange=function(t,e){var n,i,r,o,s,a,u;return s=this.splitObjectsAtRange(t),o=s[0],i=s[1],a=s[2],u=function(){var t,s,u;for(u=[],n=t=0,s=o.length;s>t;n=++t)r=o[n],u.push(n>=i&&a>=n?e(r):r);return u}(),new this.constructor(u)},i.prototype.splitObjectsAtRange=function(t){var e,n,i,r,s;return n=(r=this.splitObjectAtPosition(a(t)))[0],e=r[1],i=r[2],[n=(s=new this.constructor(n).splitObjectAtPosition(o(t)+i))[0],e,s[1]-1]},i.prototype.getObjectAtPosition=function(t){var e,n;return e=(n=this.findIndexAndOffsetAtPosition(t)).index,n.offset,this.objects[e]},i.prototype.splitObjectAtPosition=function(t){var e,n,i,r,o,s,a,u,c;return e=(o=this.findIndexAndOffsetAtPosition(t)).index,r=o.offset,i=this.objects.slice(0),null!=e?0===r?(u=e,c=0):(n=(s=this.getObjectAtIndex(e).splitAtOffset(r))[0],a=s[1],i.splice(e,1,n,a),u=e+1,c=n.getLength()-r):(u=i.length,c=0),[i,u,c]},i.prototype.consolidate=function(){var t,e,n,i,r,o;for(i=[],r=this.objects[0],t=0,e=(o=this.objects.slice(1)).length;e>t;t++)n=o[t],("function"==typeof r.canBeConsolidatedWith?r.canBeConsolidatedWith(n):void 0)?r=r.consolidateWith(n):(i.push(r),r=n);return null!=r&&i.push(r),new this.constructor(i)},i.prototype.consolidateFromIndexToIndex=function(t,e){var n,i;return i=this.objects.slice(0).slice(t,e+1),n=new this.constructor(i).consolidate().toArray(),this.splice.apply(this,[t,i.length].concat(r.call(n)))},i.prototype.findIndexAndOffsetAtPosition=function(t){var e,n,i,r,o,s;for(e=0,i=n=0,r=(s=this.objects).length;r>n;i=++n){if(o=e+s[i].getLength(),t>=e&&o>t)return{index:i,offset:t-e};e=o}return{index:null,offset:null}},i.prototype.findPositionAtIndexAndOffset=function(t,e){var n,i,r,o,s,a;for(s=0,n=i=0,r=(a=this.objects).length;r>i;n=++i)if(o=a[n],t>n)s+=o.getLength();else if(n===t){s+=e;break}return s},i.prototype.getEndPosition=function(){var t,e;return null!=this.endPosition?this.endPosition:this.endPosition=function(){var n,i,r;for(e=0,n=0,i=(r=this.objects).length;i>n;n++)t=r[n],e+=t.getLength();return e}.call(this)},i.prototype.toString=function(){return this.objects.join("")},i.prototype.toArray=function(){return this.objects.slice(0)},i.prototype.toJSON=function(){return this.toArray()},i.prototype.isEqualTo=function(t){return i.__super__.isEqualTo.apply(this,arguments)||s(this.objects,null!=t?t.objects:void 0)},s=function(t,e){var n,i,r,o,s;if(null==e&&(e=[]),t.length!==e.length)return!1;for(s=!0,i=n=0,r=t.length;r>n;i=++n)o=t[i],s&&!o.isEqualTo(e[i])&&(s=!1);return s},i.prototype.contentsForInspection=function(){var t;return{objects:"["+function(){var e,n,i,r;for(r=[],e=0,n=(i=this.objects).length;n>e;e++)t=i[e],r.push(t.inspect());return r}.call(this).join(", ")+"]"}},a=function(t){return t[0]},o=function(t){return t[1]},i}(t.Object)}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.Text=function(n){function i(e){var n;null==e&&(e=[]),i.__super__.constructor.apply(this,arguments),this.pieceList=new t.SplittableList(function(){var t,i,r;for(r=[],t=0,i=e.length;i>t;t++)(n=e[t]).isEmpty()||r.push(n);return r}())}return e(i,n),i.textForAttachmentWithAttributes=function(e,n){return new this([new t.AttachmentPiece(e,n)])},i.textForStringWithAttributes=function(e,n){return new this([new t.StringPiece(e,n)])},i.fromJSON=function(e){var n;return new this(function(){var i,r,o;for(o=[],i=0,r=e.length;r>i;i++)n=e[i],o.push(t.Piece.fromJSON(n));return o}())},i.prototype.copy=function(){return this.copyWithPieceList(this.pieceList)},i.prototype.copyWithPieceList=function(t){return new this.constructor(t.consolidate().toArray())},i.prototype.copyUsingObjectMap=function(t){var e,n;return n=function(){var n,i,r,o,s;for(s=[],n=0,i=(r=this.getPieces()).length;i>n;n++)e=r[n],s.push(null!=(o=t.find(e))?o:e);return s}.call(this),new this.constructor(n)},i.prototype.appendText=function(t){return this.insertTextAtPosition(t,this.getLength())},i.prototype.insertTextAtPosition=function(t,e){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(t.pieceList,e))},i.prototype.removeTextAtRange=function(t){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(t))},i.prototype.replaceTextAtRange=function(t,e){return this.removeTextAtRange(e).insertTextAtPosition(t,e[0])},i.prototype.moveTextFromRangeToPosition=function(t,e){var n,i;if(!(t[0]<=e&&e<=t[1]))return n=(i=this.getTextAtRange(t)).getLength(),t[0]<e&&(e-=n),this.removeTextAtRange(t).insertTextAtPosition(i,e)},i.prototype.addAttributeAtRange=function(t,e,n){var i;return(i={})[t]=e,this.addAttributesAtRange(i,n)},i.prototype.addAttributesAtRange=function(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,(function(e){return e.copyWithAdditionalAttributes(t)})))},i.prototype.removeAttributeAtRange=function(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,(function(e){return e.copyWithoutAttribute(t)})))},i.prototype.setAttributesAtRange=function(t,e){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e,(function(e){return e.copyWithAttributes(t)})))},i.prototype.getAttributesAtPosition=function(t){var e,n;return null!=(e=null!=(n=this.pieceList.getObjectAtPosition(t))?n.getAttributes():void 0)?e:{}},i.prototype.getCommonAttributes=function(){var e,n;return e=function(){var t,e,i,r;for(r=[],t=0,e=(i=this.pieceList.toArray()).length;e>t;t++)n=i[t],r.push(n.getAttributes());return r}.call(this),t.Hash.fromCommonAttributesOfObjects(e).toObject()},i.prototype.getCommonAttributesAtRange=function(t){var e;return null!=(e=this.getTextAtRange(t).getCommonAttributes())?e:{}},i.prototype.getExpandedRangeForAttributeAtOffset=function(t,e){var n,i,r;for(n=r=e,i=this.getLength();n>0&&this.getCommonAttributesAtRange([n-1,r])[t];)n--;for(;i>r&&this.getCommonAttributesAtRange([e,r+1])[t];)r++;return[n,r]},i.prototype.getTextAtRange=function(t){return this.copyWithPieceList(this.pieceList.getSplittableListInRange(t))},i.prototype.getStringAtRange=function(t){return this.pieceList.getSplittableListInRange(t).toString()},i.prototype.getStringAtPosition=function(t){return this.getStringAtRange([t,t+1])},i.prototype.startsWithString=function(t){return this.getStringAtRange([0,t.length])===t},i.prototype.endsWithString=function(t){var e;return e=this.getLength(),this.getStringAtRange([e-t.length,e])===t},i.prototype.getAttachmentPieces=function(){var t,e,n,i,r;for(r=[],t=0,e=(i=this.pieceList.toArray()).length;e>t;t++)null!=(n=i[t]).attachment&&r.push(n);return r},i.prototype.getAttachments=function(){var t,e,n,i,r;for(r=[],t=0,e=(i=this.getAttachmentPieces()).length;e>t;t++)n=i[t],r.push(n.attachment);return r},i.prototype.getAttachmentAndPositionById=function(t){var e,n,i,r,o,s;for(r=0,e=0,n=(o=this.pieceList.toArray()).length;n>e;e++){if((null!=(s=(i=o[e]).attachment)?s.id:void 0)===t)return{attachment:i.attachment,position:r};r+=i.length}return{attachment:null,position:null}},i.prototype.getAttachmentById=function(t){var e,n;return e=(n=this.getAttachmentAndPositionById(t)).attachment,n.position,e},i.prototype.getRangeOfAttachment=function(t){var e,n;return t=(n=this.getAttachmentAndPositionById(t.id)).attachment,e=n.position,null!=t?[e,e+1]:void 0},i.prototype.updateAttributesForAttachment=function(t,e){var n;return(n=this.getRangeOfAttachment(e))?this.addAttributesAtRange(t,n):this},i.prototype.getLength=function(){return this.pieceList.getEndPosition()},i.prototype.isEmpty=function(){return 0===this.getLength()},i.prototype.isEqualTo=function(t){var e;return i.__super__.isEqualTo.apply(this,arguments)||(null!=t&&null!=(e=t.pieceList)?e.isEqualTo(this.pieceList):void 0)},i.prototype.isBlockBreak=function(){return 1===this.getLength()&&this.pieceList.getObjectAtIndex(0).isBlockBreak()},i.prototype.eachPiece=function(t){return this.pieceList.eachObject(t)},i.prototype.getPieces=function(){return this.pieceList.toArray()},i.prototype.getPieceAtPosition=function(t){return this.pieceList.getObjectAtPosition(t)},i.prototype.contentsForInspection=function(){return{pieceList:this.pieceList.inspect()}},i.prototype.toSerializableText=function(){var t;return t=this.pieceList.selectSplittableList((function(t){return t.isSerializable()})),this.copyWithPieceList(t)},i.prototype.toString=function(){return this.pieceList.toString()},i.prototype.toJSON=function(){return this.pieceList.toJSON()},i.prototype.toConsole=function(){var t;return JSON.stringify(function(){var e,n,i,r;for(r=[],e=0,n=(i=this.pieceList.toArray()).length;n>e;e++)t=i[e],r.push(JSON.parse(t.toConsole()));return r}.call(this))},i}(t.Object)}.call(this),function(){var e,n,i,r,o=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},u=[].slice;e=t.arraysAreEqual,r=t.spliceArray,n=t.getBlockConfig,t.getBlockAttributeNames,i=t.getListAttributeNames,t.Block=function(s){function c(e,n){null==e&&(e=new t.Text),null==n&&(n=[]),c.__super__.constructor.apply(this,arguments),this.text=h(e),this.attributes=n}var l,h,p,d,f,g,m,y,v;return o(c,s),c.fromJSON=function(e){return new this(t.Text.fromJSON(e.text),e.attributes)},c.prototype.isEmpty=function(){return this.text.isBlockBreak()},c.prototype.isEqualTo=function(t){return c.__super__.isEqualTo.apply(this,arguments)||this.text.isEqualTo(null!=t?t.text:void 0)&&e(this.attributes,null!=t?t.attributes:void 0)},c.prototype.copyWithText=function(t){return new this.constructor(t,this.attributes)},c.prototype.copyWithoutText=function(){return this.copyWithText(null)},c.prototype.copyWithAttributes=function(t){return new this.constructor(this.text,t)},c.prototype.copyWithoutAttributes=function(){return this.copyWithAttributes(null)},c.prototype.copyUsingObjectMap=function(t){var e;return this.copyWithText((e=t.find(this.text))?e:this.text.copyUsingObjectMap(t))},c.prototype.addAttribute=function(t){var e;return e=this.attributes.concat(d(t)),this.copyWithAttributes(e)},c.prototype.removeAttribute=function(t){var e,i;return i=n(t).listAttribute,e=g(g(this.attributes,t),i),this.copyWithAttributes(e)},c.prototype.removeLastAttribute=function(){return this.removeAttribute(this.getLastAttribute())},c.prototype.getLastAttribute=function(){return f(this.attributes)},c.prototype.getAttributes=function(){return this.attributes.slice(0)},c.prototype.getAttributeLevel=function(){return this.attributes.length},c.prototype.getAttributeAtLevel=function(t){return this.attributes[t-1]},c.prototype.hasAttribute=function(t){return a.call(this.attributes,t)>=0},c.prototype.hasAttributes=function(){return this.getAttributeLevel()>0},c.prototype.getLastNestableAttribute=function(){return f(this.getNestableAttributes())},c.prototype.getNestableAttributes=function(){var t,e,i,r,o;for(o=[],e=0,i=(r=this.attributes).length;i>e;e++)t=r[e],n(t).nestable&&o.push(t);return o},c.prototype.getNestingLevel=function(){return this.getNestableAttributes().length},c.prototype.decreaseNestingLevel=function(){var t;return(t=this.getLastNestableAttribute())?this.removeAttribute(t):this},c.prototype.increaseNestingLevel=function(){var t,e,n;return(t=this.getLastNestableAttribute())?(n=this.attributes.lastIndexOf(t),e=r.apply(null,[this.attributes,n+1,0].concat(u.call(d(t)))),this.copyWithAttributes(e)):this},c.prototype.getListItemAttributes=function(){var t,e,i,r,o;for(o=[],e=0,i=(r=this.attributes).length;i>e;e++)t=r[e],n(t).listAttribute&&o.push(t);return o},c.prototype.isListItem=function(){var t;return null!=(t=n(this.getLastAttribute()))?t.listAttribute:void 0},c.prototype.isTerminalBlock=function(){var t;return null!=(t=n(this.getLastAttribute()))?t.terminal:void 0},c.prototype.breaksOnReturn=function(){var t;return null!=(t=n(this.getLastAttribute()))?t.breakOnReturn:void 0},c.prototype.findLineBreakInDirectionFromPosition=function(t,e){var n,i;return i=this.toString(),-1!==(n=function(){switch(t){case"forward":return i.indexOf("\n",e);case"backward":return i.slice(0,e).lastIndexOf("\n")}}())?n:void 0},c.prototype.contentsForInspection=function(){return{text:this.text.inspect(),attributes:this.attributes}},c.prototype.toString=function(){return this.text.toString()},c.prototype.toJSON=function(){return{text:this.text,attributes:this.attributes}},c.prototype.getLength=function(){return this.text.getLength()},c.prototype.canBeConsolidatedWith=function(t){return!this.hasAttributes()&&!t.hasAttributes()},c.prototype.consolidateWith=function(e){var n,i;return n=t.Text.textForStringWithAttributes("\n"),i=this.getTextWithoutBlockBreak().appendText(n),this.copyWithText(i.appendText(e.text))},c.prototype.splitAtOffset=function(t){var e,n;return 0===t?(e=null,n=this):t===this.getLength()?(e=this,n=null):(e=this.copyWithText(this.text.getTextAtRange([0,t])),n=this.copyWithText(this.text.getTextAtRange([t,this.getLength()]))),[e,n]},c.prototype.getBlockBreakPosition=function(){return this.text.getLength()-1},c.prototype.getTextWithoutBlockBreak=function(){return m(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()},c.prototype.canBeGrouped=function(t){return this.attributes[t]},c.prototype.canBeGroupedWith=function(t,e){var r,o,s,u;return o=(s=t.getAttributes())[e],(r=this.attributes[e])===o&&!(!1===n(r).group&&(u=s[e+1],a.call(i(),u)<0))},h=function(t){return t=v(t),l(t)},v=function(e){var n,i,r,o,s,a;return o=!1,a=e.getPieces(),i=2<=a.length?u.call(a,0,n=a.length-1):(n=0,[]),null==(r=a[n++])?e:(i=function(){var t,e,n;for(n=[],t=0,e=i.length;e>t;t++)(s=i[t]).isBlockBreak()?(o=!0,n.push(y(s))):n.push(s);return n}(),o?new t.Text(u.call(i).concat([r])):e)},p=t.Text.textForStringWithAttributes("\n",{blockBreak:!0}),l=function(t){return m(t)?t:t.appendText(p)},m=function(t){var e;return 0!==(e=t.getLength())&&t.getTextAtRange([e-1,e]).isBlockBreak()},y=function(t){return t.copyWithoutAttribute("blockBreak")},d=function(t){var e;return null!=(e=n(t).listAttribute)?[e,t]:[t]},f=function(t){return t.slice(-1)[0]},g=function(t,e){var n;return-1===(n=t.lastIndexOf(e))?t:r(t,n,1)},c}(t.Object)}.call(this),function(){var e,n,i,r=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,s=[].slice,a=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};n=t.tagName,i=t.walkTree,e=t.nodeIsAttachmentElement,t.HTMLSanitizer=function(o){function u(t,e){this.allowedAttributes=(null!=e?e:{}).allowedAttributes,null==this.allowedAttributes&&(this.allowedAttributes=c),this.body=l(t)}var c,l,h;return r(u,o),c="style href src width height class".split(" "),u.sanitize=function(t,e){var n;return(n=new this(t,e)).sanitize(),n},u.prototype.sanitize=function(){return this.sanitizeElements(),this.normalizeListElementNesting()},u.prototype.getHTML=function(){return this.body.innerHTML},u.prototype.getBody=function(){return this.body},u.prototype.sanitizeElements=function(){var e,n,r,o,s;for(s=i(this.body),o=[];s.nextNode();)switch((r=s.currentNode).nodeType){case Node.ELEMENT_NODE:h(r)?o.push(r):this.sanitizeElement(r);break;case Node.COMMENT_NODE:o.push(r)}for(e=0,n=o.length;n>e;e++)r=o[e],t.removeNode(r);return this.body},u.prototype.sanitizeElement=function(t){var e,n,i,r;for(e=0,n=(r=s.call(t.attributes)).length;n>e;e++)i=r[e].name,a.call(this.allowedAttributes,i)>=0||0===i.indexOf("data-trix")||t.removeAttribute(i);return t},u.prototype.normalizeListElementNesting=function(){var t,e,i,r,o;for(t=0,e=(o=s.call(this.body.querySelectorAll("ul,ol"))).length;e>t;t++)(r=(i=o[t]).previousElementSibling)&&"li"===n(r)&&r.appendChild(i);return this.body},h=function(t){return(null!=t?t.nodeType:void 0)!==Node.ELEMENT_NODE||e(t)?void 0:"script"===n(t)||"false"===t.getAttribute("data-trix-serialize")},l=function(t){var e,n,i,r,o;for(null==t&&(t=""),t=t.replace(/<\/html[^>]*>[^]*$/i,"</html>"),(e=document.implementation.createHTMLDocument("")).documentElement.innerHTML=t,i=0,r=(o=e.head.querySelectorAll("style")).length;r>i;i++)n=o[i],e.body.appendChild(n);return e.body},u}(t.BasicObject)}.call(this),function(){var e,n,i,r,o,s,a,u,c,l,h,p=function(t,e){function n(){this.constructor=t}for(var i in e)d.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},d={}.hasOwnProperty,f=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};e=t.arraysAreEqual,s=t.makeElement,l=t.tagName,o=t.getBlockTagNames,h=t.walkTree,r=t.findClosestElementFromNode,i=t.elementContainsNode,a=t.nodeIsAttachmentElement,u=t.normalizeSpaces,n=t.breakableWhitespacePattern,c=t.squishBreakableWhitespace,t.HTMLParser=function(d){function g(t,e){this.html=t,this.referenceElement=(null!=e?e:{}).referenceElement,this.blocks=[],this.blockElements=[],this.processedElements=[]}var m,y,v,b,A,x,C,w,E,S,k,R;return p(g,d),g.parse=function(t,e){var n;return(n=new this(t,e)).parse(),n},g.prototype.getDocument=function(){return t.Document.fromJSON(this.blocks)},g.prototype.parse=function(){var e,n;try{for(this.createHiddenContainer(),e=t.HTMLSanitizer.sanitize(this.html).getHTML(),this.containerElement.innerHTML=e,n=h(this.containerElement,{usingFilter:w});n.nextNode();)this.processNode(n.currentNode);return this.translateBlockElementMarginsToNewlines()}finally{this.removeHiddenContainer()}},g.prototype.createHiddenContainer=function(){return this.referenceElement?(this.containerElement=this.referenceElement.cloneNode(!1),this.containerElement.removeAttribute("id"),this.containerElement.setAttribute("data-trix-internal",""),this.containerElement.style.display="none",this.referenceElement.parentNode.insertBefore(this.containerElement,this.referenceElement.nextSibling)):(this.containerElement=s({tagName:"div",style:{display:"none"}}),document.body.appendChild(this.containerElement))},g.prototype.removeHiddenContainer=function(){return t.removeNode(this.containerElement)},w=function(t){return"style"===l(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},g.prototype.processNode=function(t){switch(t.nodeType){case Node.TEXT_NODE:if(!this.isInsignificantTextNode(t))return this.appendBlockForTextNode(t),this.processTextNode(t);break;case Node.ELEMENT_NODE:return this.appendBlockForElement(t),this.processElement(t)}},g.prototype.appendBlockForTextNode=function(t){var n,i,r;return(i=t.parentNode)!==this.currentBlockElement&&this.isBlockElement(i)?(n=this.getBlockAttributes(i),e(n,null!=(r=this.currentBlock)?r.attributes:void 0)?void 0:(this.currentBlock=this.appendBlockForAttributesWithElement(n,i),this.currentBlockElement=i)):void 0},g.prototype.appendBlockForElement=function(t){var n,r,o,s;if(o=this.isBlockElement(t),r=i(this.currentBlockElement,t),o&&!this.isBlockElement(t.firstChild)){if(!(this.isInsignificantTextNode(t.firstChild)&&this.isBlockElement(t.firstElementChild)||(n=this.getBlockAttributes(t),r&&e(n,this.currentBlock.attributes))))return this.currentBlock=this.appendBlockForAttributesWithElement(n,t),this.currentBlockElement=t}else if(this.currentBlockElement&&!r&&!o)return(s=this.findParentBlockElement(t))?this.appendBlockForElement(s):(this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null)},g.prototype.findParentBlockElement=function(t){var e;for(e=t.parentElement;e&&e!==this.containerElement;){if(this.isBlockElement(e)&&f.call(this.blockElements,e)>=0)return e;e=e.parentElement}return null},g.prototype.processTextNode=function(t){var e,n;return n=t.data,y(t.parentNode)||(n=c(n),k(null!=(e=t.previousSibling)?e.textContent:void 0)&&(n=x(n))),this.appendStringWithAttributes(n,this.getTextAttributes(t.parentNode))},g.prototype.processElement=function(t){var e,n,i,r,o;if(a(t))return e=v(t),Object.keys(e).length&&(r=this.getTextAttributes(t),this.appendAttachmentWithAttributes(e,r),t.innerHTML=""),this.processedElements.push(t);switch(l(t)){case"br":return this.isExtraBR(t)||this.isBlockElement(t.nextSibling)||this.appendStringWithAttributes("\n",this.getTextAttributes(t)),this.processedElements.push(t);case"img":for(n in e={url:t.getAttribute("src"),contentType:"image"},i=A(t))o=i[n],e[n]=o;return this.appendAttachmentWithAttributes(e,this.getTextAttributes(t)),this.processedElements.push(t);case"tr":if(t.parentNode.firstChild!==t)return this.appendStringWithAttributes("\n");break;case"td":if(t.parentNode.firstChild!==t)return this.appendStringWithAttributes(" | ")}},g.prototype.appendBlockForAttributesWithElement=function(t,e){var n;return this.blockElements.push(e),n=m(t),this.blocks.push(n),n},g.prototype.appendEmptyBlock=function(){return this.appendBlockForAttributesWithElement([],null)},g.prototype.appendStringWithAttributes=function(t,e){return this.appendPiece(S(t,e))},g.prototype.appendAttachmentWithAttributes=function(t,e){return this.appendPiece(E(t,e))},g.prototype.appendPiece=function(t){return 0===this.blocks.length&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(t)},g.prototype.appendStringToTextAtIndex=function(t,e){var n,i;return"string"===(null!=(n=(i=this.blocks[e].text)[i.length-1])?n.type:void 0)?n.string+=t:i.push(S(t))},g.prototype.prependStringToTextAtIndex=function(t,e){var n,i;return"string"===(null!=(n=(i=this.blocks[e].text)[0])?n.type:void 0)?n.string=t+n.string:i.unshift(S(t))},S=function(t,e){return null==e&&(e={}),"string",{string:t=u(t),attributes:e,type:"string"}},E=function(t,e){return null==e&&(e={}),"attachment",{attachment:t,attributes:e,type:"attachment"}},m=function(t){return null==t&&(t={}),{text:[],attributes:t}},g.prototype.getTextAttributes=function(e){var n,i,o,s,u,c,l,h,p,d,f,g,m;for(n in o={},d=t.config.textAttributes)if((u=d[n]).tagName&&r(e,{matchingSelector:u.tagName,untilNode:this.containerElement}))o[n]=!0;else if(u.parser){if(m=u.parser(e)){for(i=!1,c=0,p=(f=this.findBlockElementAncestors(e)).length;p>c;c++)if(s=f[c],u.parser(s)===m){i=!0;break}i||(o[n]=m)}}else u.styleProperty&&(m=e.style[u.styleProperty])&&(o[n]=m);if(a(e)&&(l=e.getAttribute("data-trix-attributes")))for(h in g=JSON.parse(l))m=g[h],o[h]=m;return o},g.prototype.getBlockAttributes=function(e){var n,i,r,o;for(i=[];e&&e!==this.containerElement;){for(n in o=t.config.blockAttributes)!1!==(r=o[n]).parse&&l(e)===r.tagName&&(("function"==typeof r.test?r.test(e):void 0)||!r.test)&&(i.push(n),r.listAttribute&&i.push(r.listAttribute));e=e.parentNode}return i.reverse()},g.prototype.findBlockElementAncestors=function(t){var e,n;for(e=[];t&&t!==this.containerElement;)n=l(t),f.call(o(),n)>=0&&e.push(t),t=t.parentNode;return e},v=function(t){return JSON.parse(t.getAttribute("data-trix-attachment"))},A=function(t){var e,n,i;return i=t.getAttribute("width"),n=t.getAttribute("height"),e={},i&&(e.width=parseInt(i,10)),n&&(e.height=parseInt(n,10)),e},g.prototype.isBlockElement=function(t){var e;if((null!=t?t.nodeType:void 0)===Node.ELEMENT_NODE&&!a(t)&&!r(t,{matchingSelector:"td",untilNode:this.containerElement}))return e=l(t),f.call(o(),e)>=0||"block"===window.getComputedStyle(t).display},g.prototype.isInsignificantTextNode=function(t){var e,n,i;if((null!=t?t.nodeType:void 0)===Node.TEXT_NODE&&R(t.data)&&(n=t.parentNode,i=t.previousSibling,e=t.nextSibling,(!C(n.previousSibling)||this.isBlockElement(n.previousSibling))&&!y(n)))return!i||this.isBlockElement(i)||!e||this.isBlockElement(e)},g.prototype.isExtraBR=function(t){return"br"===l(t)&&this.isBlockElement(t.parentNode)&&t.parentNode.lastChild===t},y=function(t){var e;return"pre"===(e=window.getComputedStyle(t).whiteSpace)||"pre-wrap"===e||"pre-line"===e},C=function(t){return t&&!k(t.textContent)},g.prototype.translateBlockElementMarginsToNewlines=function(){var t,e,n,i,r,o,s;for(t=this.getMarginOfDefaultBlockElement(),s=[],n=e=0,i=(o=this.blocks).length;i>e;n=++e)o[n],(r=this.getMarginOfBlockElementAtIndex(n))&&(r.top>2*t.top&&this.prependStringToTextAtIndex("\n",n),s.push(r.bottom>2*t.bottom?this.appendStringToTextAtIndex("\n",n):void 0));return s},g.prototype.getMarginOfBlockElementAtIndex=function(t){var e,n;return!(e=this.blockElements[t])||!e.textContent||(n=l(e),f.call(o(),n)>=0||f.call(this.processedElements,e)>=0)?void 0:b(e)},g.prototype.getMarginOfDefaultBlockElement=function(){var e;return e=s(t.config.blockAttributes.default.tagName),this.containerElement.appendChild(e),b(e)},b=function(t){var e;return"block"===(e=window.getComputedStyle(t)).display?{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}:void 0},x=function(t){return t.replace(RegExp("^"+n.source+"+"),"")},R=function(t){return RegExp("^"+n.source+"*$").test(t)},k=function(t){return/\s$/.test(t)},g}(t.BasicObject)}.call(this),function(){var e,n,i,r,o=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=[].slice,u=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};e=t.arraysAreEqual,i=t.normalizeRange,r=t.rangeIsCollapsed,n=t.getBlockConfig,t.Document=function(s){function c(e){null==e&&(e=[]),c.__super__.constructor.apply(this,arguments),0===e.length&&(e=[new t.Block]),this.blockList=t.SplittableList.box(e)}var l;return o(c,s),c.fromJSON=function(e){var n;return new this(function(){var i,r,o;for(o=[],i=0,r=e.length;r>i;i++)n=e[i],o.push(t.Block.fromJSON(n));return o}())},c.fromHTML=function(e,n){return t.HTMLParser.parse(e,n).getDocument()},c.fromString=function(e,n){var i;return i=t.Text.textForStringWithAttributes(e,n),new this([new t.Block(i)])},c.prototype.isEmpty=function(){var t;return 1===this.blockList.length&&((t=this.getBlockAtIndex(0)).isEmpty()&&!t.hasAttributes())},c.prototype.copy=function(t){var e;return null==t&&(t={}),e=t.consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray(),new this.constructor(e)},c.prototype.copyUsingObjectsFromDocument=function(e){var n;return n=new t.ObjectMap(e.getObjects()),this.copyUsingObjectMap(n)},c.prototype.copyUsingObjectMap=function(t){var e,n,i;return n=function(){var n,r,o,s;for(s=[],n=0,r=(o=this.getBlocks()).length;r>n;n++)e=o[n],s.push((i=t.find(e))?i:e.copyUsingObjectMap(t));return s}.call(this),new this.constructor(n)},c.prototype.copyWithBaseBlockAttributes=function(t){var e,n,i;return null==t&&(t=[]),i=function(){var i,r,o,s;for(s=[],i=0,r=(o=this.getBlocks()).length;r>i;i++)n=o[i],e=t.concat(n.getAttributes()),s.push(n.copyWithAttributes(e));return s}.call(this),new this.constructor(i)},c.prototype.replaceBlock=function(t,e){var n;return-1===(n=this.blockList.indexOf(t))?this:new this.constructor(this.blockList.replaceObjectAtIndex(e,n))},c.prototype.insertDocumentAtRange=function(t,e){var n,o,s,a,u,c,l;return o=t.blockList,u=(e=i(e))[0],s=(c=this.locationFromPosition(u)).index,a=c.offset,l=this,n=this.getBlockAtPosition(u),r(e)&&n.isEmpty()&&!n.hasAttributes()?l=new this.constructor(l.blockList.removeObjectAtIndex(s)):n.getBlockBreakPosition()===a&&u++,l=l.removeTextAtRange(e),new this.constructor(l.blockList.insertSplittableListAtPosition(o,u))},c.prototype.mergeDocumentAtRange=function(t,n){var r,o,s,a,u,c,l,h,p,d,f,g;return f=(n=i(n))[0],d=this.locationFromPosition(f),o=this.getBlockAtIndex(d.index).getAttributes(),r=t.getBaseBlockAttributes(),g=o.slice(-r.length),e(r,g)?(l=o.slice(0,-r.length),c=t.copyWithBaseBlockAttributes(l)):c=t.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(o),s=c.getBlockCount(),a=c.getBlockAtIndex(0),e(o,a.getAttributes())?(u=a.getTextWithoutBlockBreak(),p=this.insertTextAtRange(u,n),s>1&&(c=new this.constructor(c.getBlocks().slice(1)),h=f+u.getLength(),p=p.insertDocumentAtRange(c,h))):p=this.insertDocumentAtRange(c,n),p},c.prototype.insertTextAtRange=function(t,e){var n,r,o,s,a;return a=(e=i(e))[0],r=(s=this.locationFromPosition(a)).index,o=s.offset,n=this.removeTextAtRange(e),new this.constructor(n.blockList.editObjectAtIndex(r,(function(e){return e.copyWithText(e.text.insertTextAtPosition(t,o))})))},c.prototype.removeTextAtRange=function(t){var e,n,o,s,a,u,c,l,h,p,d,f,g,m,y,v,b,A;return l=(p=t=i(t))[0],v=p[1],r(t)?this:(u=(d=this.locationRangeFromRange(t))[0],m=d[1],a=u.index,c=u.offset,s=this.getBlockAtIndex(a),g=m.index,y=m.offset,f=this.getBlockAtIndex(g),v-l===1&&s.getBlockBreakPosition()===c&&f.getBlockBreakPosition()!==y&&"\n"===f.text.getStringAtPosition(y)?o=this.blockList.editObjectAtIndex(g,(function(t){return t.copyWithText(t.text.removeTextAtRange([y,y+1]))})):(h=s.text.getTextAtRange([0,c]),b=f.text.getTextAtRange([y,f.getLength()]),A=h.appendText(b),n=a!==g&&0===c&&s.getAttributeLevel()>=f.getAttributeLevel()?f.copyWithText(A):s.copyWithText(A),e=g+1-a,o=this.blockList.splice(a,e,n)),new this.constructor(o))},c.prototype.moveTextFromRangeToPosition=function(t,e){var n,r,o,s,u,c,l,h,p,d;return p=(c=t=i(t))[0],o=c[1],e>=p&&o>=e?this:(r=this.getDocumentAtRange(t),h=this.removeTextAtRange(t),(u=e>p)&&(e-=r.getLength()),s=(l=r.getBlocks())[0],0===(n=2<=l.length?a.call(l,1):[]).length?(d=s.getTextWithoutBlockBreak(),u&&(e+=1)):d=s.text,h=h.insertTextAtRange(d,e),0===n.length?h:(r=new this.constructor(n),e+=d.getLength(),h.insertDocumentAtRange(r,e)))},c.prototype.addAttributeAtRange=function(t,e,i){var r;return r=this.blockList,this.eachBlockAtRange(i,(function(i,o,s){return r=r.editObjectAtIndex(s,(function(){return n(t)?i.addAttribute(t,e):o[0]===o[1]?i:i.copyWithText(i.text.addAttributeAtRange(t,e,o))}))})),new this.constructor(r)},c.prototype.addAttribute=function(t,e){var n;return n=this.blockList,this.eachBlock((function(i,r){return n=n.editObjectAtIndex(r,(function(){return i.addAttribute(t,e)}))})),new this.constructor(n)},c.prototype.removeAttributeAtRange=function(t,e){var i;return i=this.blockList,this.eachBlockAtRange(e,(function(e,r,o){return n(t)?i=i.editObjectAtIndex(o,(function(){return e.removeAttribute(t)})):r[0]!==r[1]?i=i.editObjectAtIndex(o,(function(){return e.copyWithText(e.text.removeAttributeAtRange(t,r))})):void 0})),new this.constructor(i)},c.prototype.updateAttributesForAttachment=function(t,e){var n,i,r;return i=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))})))},c.prototype.removeAttributeForAttachment=function(t,e){var n;return n=this.getRangeOfAttachment(e),this.removeAttributeAtRange(t,n)},c.prototype.insertBlockBreakAtRange=function(e){var n,r,o,s;return s=(e=i(e))[0],o=this.locationFromPosition(s).offset,r=this.removeTextAtRange(e),0===o&&(n=[new t.Block]),new this.constructor(r.blockList.insertSplittableListAtPosition(new t.SplittableList(n),s))},c.prototype.applyBlockAttributeAtRange=function(t,e,i){var r,o,s,a;return o=(s=this.expandRangeToLineBreaksAndSplitBlocks(i)).document,i=s.range,(r=n(t)).listAttribute?(a=(o=o.removeLastListAttributeAtRange(i,{exceptAttributeName:t})).convertLineBreaksToBlockBreaksInRange(i),o=a.document,i=a.range):o=r.exclusive?o.removeBlockAttributesAtRange(i):r.terminal?o.removeLastTerminalAttributeAtRange(i):o.consolidateBlocksAtRange(i),o.addAttributeAtRange(t,e,i)},c.prototype.removeLastListAttributeAtRange=function(t,e){var i;return null==e&&(e={}),i=this.blockList,this.eachBlockAtRange(t,(function(t,r,o){var s;if((s=t.getLastAttribute())&&n(s).listAttribute&&s!==e.exceptAttributeName)return i=i.editObjectAtIndex(o,(function(){return t.removeAttribute(s)}))})),new this.constructor(i)},c.prototype.removeLastTerminalAttributeAtRange=function(t){var e;return e=this.blockList,this.eachBlockAtRange(t,(function(t,i,r){var o;if((o=t.getLastAttribute())&&n(o).terminal)return e=e.editObjectAtIndex(r,(function(){return t.removeAttribute(o)}))})),new this.constructor(e)},c.prototype.removeBlockAttributesAtRange=function(t){var e;return e=this.blockList,this.eachBlockAtRange(t,(function(t,n,i){return t.hasAttributes()?e=e.editObjectAtIndex(i,(function(){return t.copyWithoutAttributes()})):void 0})),new this.constructor(e)},c.prototype.expandRangeToLineBreaksAndSplitBlocks=function(t){var e,n,r,o,s,a,u,c,l;return l=(a=t=i(t))[0],o=a[1],c=this.locationFromPosition(l),r=this.locationFromPosition(o),u=(e=this).getBlockAtIndex(c.index),null!=(c.offset=u.findLineBreakInDirectionFromPosition("backward",c.offset))&&(s=e.positionFromLocation(c),e=e.insertBlockBreakAtRange([s,s+1]),r.index+=1,r.offset-=e.getBlockAtIndex(c.index).getLength(),c.index+=1),c.offset=0,0===r.offset&&r.index>c.index?(r.index-=1,r.offset=e.getBlockAtIndex(r.index).getBlockBreakPosition()):("\n"===(n=e.getBlockAtIndex(r.index)).text.getStringAtRange([r.offset-1,r.offset])?r.offset-=1:r.offset=n.findLineBreakInDirectionFromPosition("forward",r.offset),r.offset!==n.getBlockBreakPosition()&&(s=e.positionFromLocation(r),e=e.insertBlockBreakAtRange([s,s+1]))),l=e.positionFromLocation(c),o=e.positionFromLocation(r),{document:e,range:t=i([l,o])}},c.prototype.convertLineBreaksToBlockBreaksInRange=function(t){var e,n,r;return n=(t=i(t))[0],r=this.getStringAtRange(t).slice(0,-1),e=this,r.replace(/.*?\n/g,(function(t){return n+=t.length,e=e.insertBlockBreakAtRange([n-1,n])})),{document:e,range:t}},c.prototype.consolidateBlocksAtRange=function(t){var e,n,r,o,s;return s=(r=t=i(t))[0],n=r[1],o=this.locationFromPosition(s).index,e=this.locationFromPosition(n).index,new this.constructor(this.blockList.consolidateFromIndexToIndex(o,e))},c.prototype.getDocumentAtRange=function(t){var e;return t=i(t),e=this.blockList.getSplittableListInRange(t).toArray(),new this.constructor(e)},c.prototype.getStringAtRange=function(t){var e,n;return(n=t=i(t))[n.length-1]!==this.getLength()&&(e=-1),this.getDocumentAtRange(t).toString().slice(0,e)},c.prototype.getBlockAtIndex=function(t){return this.blockList.getObjectAtIndex(t)},c.prototype.getBlockAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getBlockAtIndex(e)},c.prototype.getTextAtIndex=function(t){var e;return null!=(e=this.getBlockAtIndex(t))?e.text:void 0},c.prototype.getTextAtPosition=function(t){var e;return e=this.locationFromPosition(t).index,this.getTextAtIndex(e)},c.prototype.getPieceAtPosition=function(t){var e,n,i;return e=(i=this.locationFromPosition(t)).index,n=i.offset,this.getTextAtIndex(e).getPieceAtPosition(n)},c.prototype.getCharacterAtPosition=function(t){var e,n,i;return e=(i=this.locationFromPosition(t)).index,n=i.offset,this.getTextAtIndex(e).getStringAtRange([n,n+1])},c.prototype.getLength=function(){return this.blockList.getEndPosition()},c.prototype.getBlocks=function(){return this.blockList.toArray()},c.prototype.getBlockCount=function(){return this.blockList.length},c.prototype.getEditCount=function(){return this.editCount},c.prototype.eachBlock=function(t){return this.blockList.eachObject(t)},c.prototype.eachBlockAtRange=function(t,e){var n,r,o,s,a,u,c,l,h,p,d,f;if(d=(u=t=i(t))[0],o=u[1],p=this.locationFromPosition(d),r=this.locationFromPosition(o),p.index===r.index)return n=this.getBlockAtIndex(p.index),f=[p.offset,r.offset],e(n,f,p.index);for(h=[],a=s=c=p.index,l=r.index;l>=c?l>=s:s>=l;a=l>=c?++s:--s)(n=this.getBlockAtIndex(a))?(f=function(){switch(a){case p.index:return[p.offset,n.text.getLength()];case r.index:return[0,r.offset];default:return[0,n.text.getLength()]}}(),h.push(e(n,f,a))):h.push(void 0);return h},c.prototype.getCommonAttributesAtRange=function(e){var n,o,s;return o=(e=i(e))[0],r(e)?this.getCommonAttributesAtPosition(o):(s=[],n=[],this.eachBlockAtRange(e,(function(t,e){return e[0]!==e[1]?(s.push(t.text.getCommonAttributesAtRange(e)),n.push(l(t))):void 0})),t.Hash.fromCommonAttributesOfObjects(s).merge(t.Hash.fromCommonAttributesOfObjects(n)).toObject())},c.prototype.getCommonAttributesAtPosition=function(e){var n,i,r,o,s,a,c,h,p,d;if(s=(p=this.locationFromPosition(e)).index,h=p.offset,!(r=this.getBlockAtIndex(s)))return{};for(c in o=l(r),n=r.text.getAttributesAtPosition(h),i=r.text.getAttributesAtPosition(h-1),a=function(){var e,n;for(c in n=[],e=t.config.textAttributes)(d=e[c]).inheritable&&n.push(c);return n}(),i)((d=i[c])===n[c]||u.call(a,c)>=0)&&(o[c]=d);return o},c.prototype.getRangeOfCommonAttributeAtPosition=function(t,e){var n,r,o,s,a,u,c,l;return o=(a=this.locationFromPosition(e)).index,s=a.offset,l=(u=this.getTextAtIndex(o).getExpandedRangeForAttributeAtOffset(t,s))[0],r=u[1],c=this.positionFromLocation({index:o,offset:l}),n=this.positionFromLocation({index:o,offset:r}),i([c,n])},c.prototype.getBaseBlockAttributes=function(){var t,e,n,i,r,o,s;for(t=this.getBlockAtIndex(0).getAttributes(),n=i=1,s=this.getBlockCount();s>=1?s>i:i>s;n=s>=1?++i:--i)e=this.getBlockAtIndex(n).getAttributes(),o=Math.min(t.length,e.length),t=function(){var n,i,s;for(s=[],r=n=0,i=o;(i>=0?i>n:n>i)&&e[r]===t[r];r=i>=0?++n:--n)s.push(e[r]);return s}();return t},l=function(t){var e,n;return n={},(e=t.getLastAttribute())&&(n[e]=!0),n},c.prototype.getAttachmentById=function(t){var e,n,i,r;for(n=0,i=(r=this.getAttachments()).length;i>n;n++)if((e=r[n]).id===t)return e},c.prototype.getAttachmentPieces=function(){var t;return t=[],this.blockList.eachObject((function(e){var n;return n=e.text,t=t.concat(n.getAttachmentPieces())})),t},c.prototype.getAttachments=function(){var t,e,n,i,r;for(r=[],t=0,e=(i=this.getAttachmentPieces()).length;e>t;t++)n=i[t],r.push(n.attachment);return r},c.prototype.getRangeOfAttachment=function(t){var e,n,r,o,s,a,u;for(o=0,n=e=0,r=(s=this.blockList.toArray()).length;r>e;n=++e){if(u=(a=s[n].text).getRangeOfAttachment(t))return i([o+u[0],o+u[1]]);o+=a.getLength()}},c.prototype.getLocationRangeOfAttachment=function(t){var e;return e=this.getRangeOfAttachment(t),this.locationRangeFromRange(e)},c.prototype.getAttachmentPieceForAttachment=function(t){var e,n,i,r;for(e=0,n=(r=this.getAttachmentPieces()).length;n>e;e++)if((i=r[e]).attachment===t)return i},c.prototype.findRangesForBlockAttribute=function(t){var e,n,i,r,o,s,a;for(o=0,s=[],n=0,i=(a=this.getBlocks()).length;i>n;n++)r=(e=a[n]).getLength(),e.hasAttribute(t)&&s.push([o,o+r]),o+=r;return s},c.prototype.findRangesForTextAttribute=function(t,e){var n,i,r,o,s,a,u,c,l,h;for(h=(null!=e?e:{}).withValue,a=0,u=[],c=[],o=function(e){return null!=h?e.getAttribute(t)===h:e.hasAttribute(t)},n=0,i=(l=this.getPieces()).length;i>n;n++)r=(s=l[n]).getLength(),o(s)&&(u[1]===a?u[1]=a+r:c.push(u=[a,a+r])),a+=r;return c},c.prototype.locationFromPosition=function(t){var e,n;return null!=(n=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,t))).index?n:{index:(e=this.getBlocks()).length-1,offset:e[e.length-1].getLength()}},c.prototype.positionFromLocation=function(t){return this.blockList.findPositionAtIndexAndOffset(t.index,t.offset)},c.prototype.locationRangeFromPosition=function(t){return i(this.locationFromPosition(t))},c.prototype.locationRangeFromRange=function(t){var e,n,r,o;if(t=i(t))return o=t[0],n=t[1],r=this.locationFromPosition(o),e=this.locationFromPosition(n),i([r,e])},c.prototype.rangeFromLocationRange=function(t){var e,n;return t=i(t),e=this.positionFromLocation(t[0]),r(t)||(n=this.positionFromLocation(t[1])),i([e,n])},c.prototype.isEqualTo=function(t){return this.blockList.isEqualTo(null!=t?t.blockList:void 0)},c.prototype.getTexts=function(){var t,e,n,i,r;for(r=[],e=0,n=(i=this.getBlocks()).length;n>e;e++)t=i[e],r.push(t.text);return r},c.prototype.getPieces=function(){var t,e,n,i,r;for(n=[],t=0,e=(i=this.getTexts()).length;e>t;t++)r=i[t],n.push.apply(n,r.getPieces());return n},c.prototype.getObjects=function(){return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())},c.prototype.toSerializableDocument=function(){var t;return t=[],this.blockList.eachObject((function(e){return t.push(e.copyWithText(e.text.toSerializableText()))})),new this.constructor(t)},c.prototype.toString=function(){return this.blockList.toString()},c.prototype.toJSON=function(){return this.blockList.toJSON()},c.prototype.toConsole=function(){var t;return JSON.stringify(function(){var e,n,i,r;for(r=[],e=0,n=(i=this.blockList.toArray()).length;n>e;e++)t=i[e],r.push(JSON.parse(t.text.toConsole()));return r}.call(this))},c}(t.Object)}.call(this),function(){t.LineBreakInsertion=function(){function t(t){var e;this.composition=t,this.document=this.composition.document,e=this.composition.getSelectedRange(),this.startPosition=e[0],this.endPosition=e[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.endPosition),this.block=this.document.getBlockAtIndex(this.endLocation.index),this.breaksOnReturn=this.block.breaksOnReturn(),this.previousCharacter=this.block.text.getStringAtPosition(this.endLocation.offset-1),this.nextCharacter=this.block.text.getStringAtPosition(this.endLocation.offset)}return t.prototype.shouldInsertBlockBreak=function(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?0!==this.startLocation.offset:this.breaksOnReturn&&"\n"!==this.nextCharacter},t.prototype.shouldBreakFormattedBlock=function(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&"\n"===this.nextCharacter||"\n"===this.previousCharacter)},t.prototype.shouldDecreaseListLevel=function(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()},t.prototype.shouldPrependListItem=function(){return this.block.isListItem()&&0===this.startLocation.offset&&!this.block.isEmpty()},t.prototype.shouldRemoveLastBlockAttribute=function(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()},t}()}.call(this),function(){var e,n,i,r,o,s,a,u,c,l,h=function(t,e){function n(){this.constructor=t}for(var i in e)p.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;s=t.normalizeRange,c=t.rangesAreEqual,u=t.rangeIsCollapsed,a=t.objectsAreEqual,e=t.arrayStartsWith,l=t.summarizeArrayChange,i=t.getAllAttributeNames,r=t.getBlockConfig,o=t.getTextConfig,n=t.extend,t.Composition=function(p){function d(){this.document=new t.Document,this.attachments=[],this.currentAttributes={},this.revision=0}return h(d,p),d.prototype.setDocument=function(t){var e;return t.isEqualTo(this.document)?void 0:(this.document=t,this.refreshAttachments(),this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidChangeDocument?e.compositionDidChangeDocument(t):void 0)},d.prototype.getSnapshot=function(){return{document:this.document,selectedRange:this.getSelectedRange()}},d.prototype.loadSnapshot=function(e){var n,i,r,o;return n=e.document,o=e.selectedRange,null!=(i=this.delegate)&&"function"==typeof i.compositionWillLoadSnapshot&&i.compositionWillLoadSnapshot(),this.setDocument(null!=n?n:new t.Document),this.setSelection(null!=o?o:[0,0]),null!=(r=this.delegate)&&"function"==typeof r.compositionDidLoadSnapshot?r.compositionDidLoadSnapshot():void 0},d.prototype.insertText=function(t,e){var n,i,r,o;return o=(null!=e?e:{updatePosition:!0}).updatePosition,i=this.getSelectedRange(),this.setDocument(this.document.insertTextAtRange(t,i)),n=(r=i[0])+t.getLength(),o&&this.setSelection(n),this.notifyDelegateOfInsertionAtRange([r,n])},d.prototype.insertBlock=function(e){var n;return null==e&&(e=new t.Block),n=new t.Document([e]),this.insertDocument(n)},d.prototype.insertDocument=function(e){var n,i,r;return null==e&&(e=new t.Document),i=this.getSelectedRange(),this.setDocument(this.document.insertDocumentAtRange(e,i)),n=(r=i[0])+e.getLength(),this.setSelection(n),this.notifyDelegateOfInsertionAtRange([r,n])},d.prototype.insertString=function(e,n){var i,r;return i=this.getCurrentTextAttributes(),r=t.Text.textForStringWithAttributes(e,i),this.insertText(r,n)},d.prototype.insertBlockBreak=function(){var t,e,n;return e=this.getSelectedRange(),this.setDocument(this.document.insertBlockBreakAtRange(e)),t=(n=e[0])+1,this.setSelection(t),this.notifyDelegateOfInsertionAtRange([n,t])},d.prototype.insertLineBreak=function(){var e,n;return(n=new t.LineBreakInsertion(this)).shouldDecreaseListLevel()?(this.decreaseListLevel(),this.setSelection(n.startPosition)):n.shouldPrependListItem()?(e=new t.Document([n.block.copyWithoutText()]),this.insertDocument(e)):n.shouldInsertBlockBreak()?this.insertBlockBreak():n.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():n.shouldBreakFormattedBlock()?this.breakFormattedBlock(n):this.insertString("\n")},d.prototype.insertHTML=function(e){var n,i,r,o;return n=t.Document.fromHTML(e),r=this.getSelectedRange(),this.setDocument(this.document.mergeDocumentAtRange(n,r)),i=(o=r[0])+n.getLength()-1,this.setSelection(i),this.notifyDelegateOfInsertionAtRange([o,i])},d.prototype.replaceHTML=function(e){var n,i,r;return n=t.Document.fromHTML(e).copyUsingObjectsFromDocument(this.document),i=this.getLocationRange({strict:!1}),r=this.document.rangeFromLocationRange(i),this.setDocument(n),this.setSelection(r)},d.prototype.insertFile=function(t){return this.insertFiles([t])},d.prototype.insertFiles=function(e){var n,i,r,o,s,a;for(i=[],o=0,s=e.length;s>o;o++)r=e[o],(null!=(a=this.delegate)?a.compositionShouldAcceptFile(r):void 0)&&(n=t.Attachment.attachmentForFile(r),i.push(n));return this.insertAttachments(i)},d.prototype.insertAttachment=function(t){return this.insertAttachments([t])},d.prototype.insertAttachments=function(e){var n,i,r,o,s,a,u,c,l;for(c=new t.Text,o=0,s=e.length;s>o;o++)l=(n=e[o]).getType(),a=null!=(u=t.config.attachments[l])?u.presentation:void 0,r=this.getCurrentTextAttributes(),a&&(r.presentation=a),i=t.Text.textForAttachmentWithAttributes(n,r),c=c.appendText(i);return this.insertText(c)},d.prototype.shouldManageDeletingInDirection=function(t){var e;if(e=this.getLocationRange(),u(e)){if("backward"===t&&0===e[0].offset)return!0;if(this.shouldManageMovingCursorInDirection(t))return!0}else if(e[0].index!==e[1].index)return!0;return!1},d.prototype.deleteInDirection=function(t,e){var n,i,r,o,s,a,c,l;return o=(null!=e?e:{}).length,s=this.getLocationRange(),a=this.getSelectedRange(),(c=u(a))?r="backward"===t&&0===s[0].offset:l=s[0].index!==s[1].index,!(r&&this.canDecreaseBlockAttributeLevel()&&(i=this.getBlock(),i.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(a[0]),i.isEmpty()))&&(c&&(a=this.getExpandedRangeInDirection(t,{length:o}),"backward"===t&&(n=this.getAttachmentAtRange(a))),n?(this.editAttachment(n),!1):(this.setDocument(this.document.removeTextAtRange(a)),this.setSelection(a[0]),!r&&!l&&void 0))},d.prototype.moveTextFromRange=function(t){var e;return e=this.getSelectedRange()[0],this.setDocument(this.document.moveTextFromRangeToPosition(t,e)),this.setSelection(e)},d.prototype.removeAttachment=function(t){var e;return(e=this.document.getRangeOfAttachment(t))?(this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(e)),this.setSelection(e[0])):void 0},d.prototype.removeLastBlockAttribute=function(){var t,e,n,i;return i=(n=this.getSelectedRange())[0],e=n[1],t=this.document.getBlockAtPosition(e),this.removeCurrentAttribute(t.getLastAttribute()),this.setSelection(i)}," ",d.prototype.insertPlaceholder=function(){return this.placeholderPosition=this.getPosition(),this.insertString(" ")},d.prototype.selectPlaceholder=function(){return null!=this.placeholderPosition?(this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+" ".length]),this.getSelectedRange()):void 0},d.prototype.forgetPlaceholder=function(){return this.placeholderPosition=null},d.prototype.hasCurrentAttribute=function(t){var e;return null!=(e=this.currentAttributes[t])&&!1!==e},d.prototype.toggleCurrentAttribute=function(t){var e;return(e=!this.currentAttributes[t])?this.setCurrentAttribute(t,e):this.removeCurrentAttribute(t)},d.prototype.canSetCurrentAttribute=function(t){return r(t)?this.canSetCurrentBlockAttribute(t):this.canSetCurrentTextAttribute(t)},d.prototype.canSetCurrentTextAttribute=function(){var t,e,n,i;if(t=this.getSelectedDocument()){for(e=0,n=(i=t.getAttachments()).length;n>e;e++)if(!i[e].hasContent())return!1;return!0}},d.prototype.canSetCurrentBlockAttribute=function(){var t;if(t=this.getBlock())return!t.isTerminalBlock()},d.prototype.setCurrentAttribute=function(t,e){return r(t)?this.setBlockAttribute(t,e):(this.setTextAttribute(t,e),this.currentAttributes[t]=e,this.notifyDelegateOfCurrentAttributesChange())},d.prototype.setTextAttribute=function(e,n){var i,r;if(i=this.getSelectedRange())return i[0]!==i[1]?this.setDocument(this.document.addAttributeAtRange(e,n,i)):"href"===e?(r=t.Text.textForStringWithAttributes(n,{href:n}),this.insertText(r)):void 0},d.prototype.setBlockAttribute=function(t,e){var n;if(n=this.getSelectedRange())return this.canSetCurrentAttribute(t)?(this.getBlock(),this.setDocument(this.document.applyBlockAttributeAtRange(t,e,n)),this.setSelection(n)):void 0},d.prototype.removeCurrentAttribute=function(t){return r(t)?(this.removeBlockAttribute(t),this.updateCurrentAttributes()):(this.removeTextAttribute(t),delete this.currentAttributes[t],this.notifyDelegateOfCurrentAttributesChange())},d.prototype.removeTextAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},d.prototype.removeBlockAttribute=function(t){var e;if(e=this.getSelectedRange())return this.setDocument(this.document.removeAttributeAtRange(t,e))},d.prototype.canDecreaseNestingLevel=function(){var t;return(null!=(t=this.getBlock())?t.getNestingLevel():void 0)>0},d.prototype.canIncreaseNestingLevel=function(){var t,n,i;if(t=this.getBlock())return null!=(i=r(t.getLastNestableAttribute()))&&i.listAttribute?(n=this.getPreviousBlock())?e(n.getListItemAttributes(),t.getListItemAttributes()):void 0:t.getNestingLevel()>0},d.prototype.decreaseNestingLevel=function(){var t;if(t=this.getBlock())return this.setDocument(this.document.replaceBlock(t,t.decreaseNestingLevel()))},d.prototype.increaseNestingLevel=function(){var t;if(t=this.getBlock())return this.setDocument(this.document.replaceBlock(t,t.increaseNestingLevel()))},d.prototype.canDecreaseBlockAttributeLevel=function(){var t;return(null!=(t=this.getBlock())?t.getAttributeLevel():void 0)>0},d.prototype.decreaseBlockAttributeLevel=function(){var t,e;return(t=null!=(e=this.getBlock())?e.getLastAttribute():void 0)?this.removeCurrentAttribute(t):void 0},d.prototype.decreaseListLevel=function(){var t,e,n,i,r,o;for(o=this.getSelectedRange()[0],n=r=this.document.locationFromPosition(o).index,t=this.getBlock().getAttributeLevel();(e=this.document.getBlockAtIndex(n+1))&&e.isListItem()&&e.getAttributeLevel()>t;)n++;return o=this.document.positionFromLocation({index:r,offset:0}),i=this.document.positionFromLocation({index:n,offset:0}),this.setDocument(this.document.removeLastListAttributeAtRange([o,i]))},d.prototype.updateCurrentAttributes=function(){var t,e,n,r,o,s;if(s=this.getSelectedRange({ignoreLock:!0})){for(e=this.document.getCommonAttributesAtRange(s),n=0,r=(o=i()).length;r>n;n++)e[t=o[n]]||this.canSetCurrentAttribute(t)||(e[t]=!1);if(!a(e,this.currentAttributes))return this.currentAttributes=e,this.notifyDelegateOfCurrentAttributesChange()}},d.prototype.getCurrentAttributes=function(){return n.call({},this.currentAttributes)},d.prototype.getCurrentTextAttributes=function(){var t,e,n,i;for(e in t={},n=this.currentAttributes)!1!==(i=n[e])&&o(e)&&(t[e]=i);return t},d.prototype.freezeSelection=function(){return this.setCurrentAttribute("frozen",!0)},d.prototype.thawSelection=function(){return this.removeCurrentAttribute("frozen")},d.prototype.hasFrozenSelection=function(){return this.hasCurrentAttribute("frozen")},d.proxyMethod("getSelectionManager().getPointRange"),d.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),d.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),d.proxyMethod("getSelectionManager().locationIsCursorTarget"),d.proxyMethod("getSelectionManager().selectionIsExpanded"),d.proxyMethod("delegate?.getSelectionManager"),d.prototype.setSelection=function(t){var e,n;return e=this.document.locationRangeFromRange(t),null!=(n=this.delegate)?n.compositionDidRequestChangingSelectionToLocationRange(e):void 0},d.prototype.getSelectedRange=function(){var t;return(t=this.getLocationRange())?this.document.rangeFromLocationRange(t):void 0},d.prototype.setSelectedRange=function(t){var e;return e=this.document.locationRangeFromRange(t),this.getSelectionManager().setLocationRange(e)},d.prototype.getPosition=function(){var t;return(t=this.getLocationRange())?this.document.positionFromLocation(t[0]):void 0},d.prototype.getLocationRange=function(t){var e,n;return null!=(e=null!=(n=this.targetLocationRange)?n:this.getSelectionManager().getLocationRange(t))?e:s({index:0,offset:0})},d.prototype.withTargetLocationRange=function(t,e){var n;this.targetLocationRange=t;try{n=e()}finally{this.targetLocationRange=null}return n},d.prototype.withTargetRange=function(t,e){var n;return n=this.document.locationRangeFromRange(t),this.withTargetLocationRange(n,e)},d.prototype.withTargetDOMRange=function(t,e){var n;return n=this.createLocationRangeFromDOMRange(t,{strict:!1}),this.withTargetLocationRange(n,e)},d.prototype.getExpandedRangeInDirection=function(t,e){var n,i,r,o;return i=(null!=e?e:{}).length,o=(r=this.getSelectedRange())[0],n=r[1],"backward"===t?i?o-=i:o=this.translateUTF16PositionFromOffset(o,-1):i?n+=i:n=this.translateUTF16PositionFromOffset(n,1),s([o,n])},d.prototype.shouldManageMovingCursorInDirection=function(t){var e;return!!this.editingAttachment||(e=this.getExpandedRangeInDirection(t),null!=this.getAttachmentAtRange(e))},d.prototype.moveCursorInDirection=function(t){var e,n,i,r;return this.editingAttachment?i=this.document.getRangeOfAttachment(this.editingAttachment):(r=this.getSelectedRange(),i=this.getExpandedRangeInDirection(t),n=!c(r,i)),this.setSelectedRange("backward"===t?i[0]:i[1]),n&&(e=this.getAttachmentAtRange(i))?this.editAttachment(e):void 0},d.prototype.expandSelectionInDirection=function(t,e){var n,i;return n=(null!=e?e:{}).length,i=this.getExpandedRangeInDirection(t,{length:n}),this.setSelectedRange(i)},d.prototype.expandSelectionForEditing=function(){return this.hasCurrentAttribute("href")?this.expandSelectionAroundCommonAttribute("href"):void 0},d.prototype.expandSelectionAroundCommonAttribute=function(t){var e,n;return e=this.getPosition(),n=this.document.getRangeOfCommonAttributeAtPosition(t,e),this.setSelectedRange(n)},d.prototype.selectionContainsAttachments=function(){var t;return(null!=(t=this.getSelectedAttachments())?t.length:void 0)>0},d.prototype.selectionIsInCursorTarget=function(){return this.editingAttachment||this.positionIsCursorTarget(this.getPosition())},d.prototype.positionIsCursorTarget=function(t){var e;return(e=this.document.locationFromPosition(t))?this.locationIsCursorTarget(e):void 0},d.prototype.positionIsBlockBreak=function(t){var e;return null!=(e=this.document.getPieceAtPosition(t))?e.isBlockBreak():void 0},d.prototype.getSelectedDocument=function(){var t;return(t=this.getSelectedRange())?this.document.getDocumentAtRange(t):void 0},d.prototype.getSelectedAttachments=function(){var t;return null!=(t=this.getSelectedDocument())?t.getAttachments():void 0},d.prototype.getAttachments=function(){return this.attachments.slice(0)},d.prototype.refreshAttachments=function(){var t,e,n,i,r,o,s,a,u,c,h,p;for(n=this.document.getAttachments(),t=(a=l(this.attachments,n)).added,h=a.removed,this.attachments=n,i=0,o=h.length;o>i;i++)(e=h[i]).delegate=null,null!=(u=this.delegate)&&"function"==typeof u.compositionDidRemoveAttachment&&u.compositionDidRemoveAttachment(e);for(p=[],r=0,s=t.length;s>r;r++)(e=t[r]).delegate=this,p.push(null!=(c=this.delegate)&&"function"==typeof c.compositionDidAddAttachment?c.compositionDidAddAttachment(e):void 0);return p},d.prototype.attachmentDidChangeAttributes=function(t){var e;return this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidEditAttachment?e.compositionDidEditAttachment(t):void 0},d.prototype.attachmentDidChangePreviewURL=function(t){var e;return this.revision++,null!=(e=this.delegate)&&"function"==typeof e.compositionDidChangeAttachmentPreviewURL?e.compositionDidChangeAttachmentPreviewURL(t):void 0},d.prototype.editAttachment=function(t,e){var n;if(t!==this.editingAttachment)return this.stopEditingAttachment(),this.editingAttachment=t,null!=(n=this.delegate)&&"function"==typeof n.compositionDidStartEditingAttachment?n.compositionDidStartEditingAttachment(this.editingAttachment,e):void 0},d.prototype.stopEditingAttachment=function(){var t;if(this.editingAttachment)return null!=(t=this.delegate)&&"function"==typeof t.compositionDidStopEditingAttachment&&t.compositionDidStopEditingAttachment(this.editingAttachment),this.editingAttachment=null},d.prototype.updateAttributesForAttachment=function(t,e){return this.setDocument(this.document.updateAttributesForAttachment(t,e))},d.prototype.removeAttributeForAttachment=function(t,e){return this.setDocument(this.document.removeAttributeForAttachment(t,e))},d.prototype.breakFormattedBlock=function(e){var n,i,r,o,s;return i=e.document,n=e.block,s=[(o=e.startPosition)-1,o],n.getBlockBreakPosition()===e.startLocation.offset?(n.breaksOnReturn()&&"\n"===e.nextCharacter?o+=1:i=i.removeTextAtRange(s),s=[o,o]):"\n"===e.nextCharacter?"\n"===e.previousCharacter?s=[o-1,o+1]:(s=[o,o+1],o+=1):e.startLocation.offset-1!==0&&(o+=1),r=new t.Document([n.removeLastAttribute().copyWithoutText()]),this.setDocument(i.insertDocumentAtRange(r,s)),this.setSelection(o)},d.prototype.getPreviousBlock=function(){var t,e;return(e=this.getLocationRange())&&(t=e[0].index)>0?this.document.getBlockAtIndex(t-1):void 0},d.prototype.getBlock=function(){var t;return(t=this.getLocationRange())?this.document.getBlockAtIndex(t[0].index):void 0},d.prototype.getAttachmentAtRange=function(e){var n;return(n=this.document.getDocumentAtRange(e)).toString()===t.OBJECT_REPLACEMENT_CHARACTER+"\n"?n.getAttachments()[0]:void 0},d.prototype.notifyDelegateOfCurrentAttributesChange=function(){var t;return null!=(t=this.delegate)&&"function"==typeof t.compositionDidChangeCurrentAttributes?t.compositionDidChangeCurrentAttributes(this.currentAttributes):void 0},d.prototype.notifyDelegateOfInsertionAtRange=function(t){var e;return null!=(e=this.delegate)&&"function"==typeof e.compositionDidPerformInsertionAtRange?e.compositionDidPerformInsertionAtRange(t):void 0},d.prototype.translateUTF16PositionFromOffset=function(t,e){var n,i;return n=(i=this.document.toUTF16String()).offsetFromUCS2Offset(t),i.offsetToUCS2Offset(n+e)},d}(t.BasicObject)}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.UndoManager=function(t){function n(t){this.composition=t,this.undoEntries=[],this.redoEntries=[]}var i;return e(n,t),n.prototype.recordUndoEntry=function(t,e){var n,r,o,s,a;return r=(s=null!=e?e:{}).context,n=s.consolidatable,o=this.undoEntries.slice(-1)[0],n&&i(o,t,r)?void 0:(a=this.createEntry({description:t,context:r}),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,i;return n=(i=null!=t?t:{}).description,e=i.context,{description:null!=n?n.toString():void 0,context:JSON.stringify(e),snapshot:this.composition.getSnapshot()}},i=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}(t.BasicObject)}.call(this),function(){var e;t.attachmentGalleryFilter=function(t){var n;return(n=new e(t)).perform(),n.getSnapshot()},e=function(){function t(t){this.document=t.document,this.selectedRange=t.selectedRange}var e;return e="attachmentGallery","presentation","gallery",t.prototype.perform=function(){return this.removeBlockAttribute(),this.applyBlockAttribute()},t.prototype.getSnapshot=function(){return{document:this.document,selectedRange:this.selectedRange}},t.prototype.removeBlockAttribute=function(){var t,n,i,r,o;for(o=[],t=0,n=(r=this.findRangesOfBlocks()).length;n>t;t++)i=r[t],o.push(this.document=this.document.removeAttributeAtRange(e,i));return o},t.prototype.applyBlockAttribute=function(){var t,n,i,r,o,s;for(i=0,s=[],t=0,n=(o=this.findRangesOfPieces()).length;n>t;t++)(r=o[t])[1]-r[0]>1&&(r[0]+=i,r[1]+=i,"\n"!==this.document.getCharacterAtPosition(r[1])&&(this.document=this.document.insertBlockBreakAtRange(r[1]),r[1]<this.selectedRange[1]&&this.moveSelectedRangeForward(),r[1]++,i++),0!==r[0]&&"\n"!==this.document.getCharacterAtPosition(r[0]-1)&&(this.document=this.document.insertBlockBreakAtRange(r[0]),r[0]<this.selectedRange[0]&&this.moveSelectedRangeForward(),r[0]++,i++),s.push(this.document=this.document.applyBlockAttributeAtRange(e,!0,r)));return s},t.prototype.findRangesOfBlocks=function(){return this.document.findRangesForBlockAttribute(e)},t.prototype.findRangesOfPieces=function(){return this.document.findRangesForTextAttribute("presentation",{withValue:"gallery"})},t.prototype.moveSelectedRangeForward=function(){return this.selectedRange[0]+=1,this.selectedRange[1]+=1},t}()}.call(this),function(){var e=function(t,e){return function(){return t.apply(e,arguments)}};t.Editor=function(){function n(n,r,o){this.composition=n,this.selectionManager=r,this.element=o,this.insertFiles=e(this.insertFiles,this),this.undoManager=new t.UndoManager(this.composition),this.filters=i.slice(0)}var i;return i=[t.attachmentGalleryFilter],n.prototype.loadDocument=function(t){return this.loadSnapshot({document:t,selectedRange:[0,0]})},n.prototype.loadHTML=function(e){return null==e&&(e=""),this.loadDocument(t.Document.fromHTML(e,{referenceElement:this.element}))},n.prototype.loadJSON=function(e){var n,i;return n=e.document,i=e.selectedRange,n=t.Document.fromJSON(n),this.loadSnapshot({document:n,selectedRange:i})},n.prototype.loadSnapshot=function(e){return this.undoManager=new t.UndoManager(this.composition),this.composition.loadSnapshot(e)},n.prototype.getDocument=function(){return this.composition.document},n.prototype.getSelectedDocument=function(){return this.composition.getSelectedDocument()},n.prototype.getSnapshot=function(){return this.composition.getSnapshot()},n.prototype.toJSON=function(){return this.getSnapshot()},n.prototype.deleteInDirection=function(t){return this.composition.deleteInDirection(t)},n.prototype.insertAttachment=function(t){return this.composition.insertAttachment(t)},n.prototype.insertAttachments=function(t){return this.composition.insertAttachments(t)},n.prototype.insertDocument=function(t){return this.composition.insertDocument(t)},n.prototype.insertFile=function(t){return this.composition.insertFile(t)},n.prototype.insertFiles=function(t){return this.composition.insertFiles(t)},n.prototype.insertHTML=function(t){return this.composition.insertHTML(t)},n.prototype.insertString=function(t){return this.composition.insertString(t)},n.prototype.insertText=function(t){return this.composition.insertText(t)},n.prototype.insertLineBreak=function(){return this.composition.insertLineBreak()},n.prototype.getSelectedRange=function(){return this.composition.getSelectedRange()},n.prototype.getPosition=function(){return this.composition.getPosition()},n.prototype.getClientRectAtPosition=function(t){var e;return e=this.getDocument().locationRangeFromRange([t,t+1]),this.selectionManager.getClientRectAtLocationRange(e)},n.prototype.expandSelectionInDirection=function(t){return this.composition.expandSelectionInDirection(t)},n.prototype.moveCursorInDirection=function(t){return this.composition.moveCursorInDirection(t)},n.prototype.setSelectedRange=function(t){return this.composition.setSelectedRange(t)},n.prototype.activateAttribute=function(t,e){return null==e&&(e=!0),this.composition.setCurrentAttribute(t,e)},n.prototype.attributeIsActive=function(t){return this.composition.hasCurrentAttribute(t)},n.prototype.canActivateAttribute=function(t){return this.composition.canSetCurrentAttribute(t)},n.prototype.deactivateAttribute=function(t){return this.composition.removeCurrentAttribute(t)},n.prototype.canDecreaseNestingLevel=function(){return this.composition.canDecreaseNestingLevel()},n.prototype.canIncreaseNestingLevel=function(){return this.composition.canIncreaseNestingLevel()},n.prototype.decreaseNestingLevel=function(){return this.canDecreaseNestingLevel()?this.composition.decreaseNestingLevel():void 0},n.prototype.increaseNestingLevel=function(){return this.canIncreaseNestingLevel()?this.composition.increaseNestingLevel():void 0},n.prototype.canRedo=function(){return this.undoManager.canRedo()},n.prototype.canUndo=function(){return this.undoManager.canUndo()},n.prototype.recordUndoEntry=function(t,e){var n,i,r;return i=(r=null!=e?e:{}).context,n=r.consolidatable,this.undoManager.recordUndoEntry(t,{context:i,consolidatable:n})},n.prototype.redo=function(){return this.canRedo()?this.undoManager.redo():void 0},n.prototype.undo=function(){return this.canUndo()?this.undoManager.undo():void 0},n}()}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.ManagedAttachment=function(t){function n(t,e){var n;this.attachmentManager=t,this.attachment=e,n=this.attachment,this.id=n.id,this.file=n.file}return e(n,t),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}(t.BasicObject)}.call(this),function(){var e=function(t,e){function i(){this.constructor=t}for(var r in e)n.call(e,r)&&(t[r]=e[r]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t},n={}.hasOwnProperty;t.AttachmentManager=function(n){function i(t){var e,n,i;for(null==t&&(t=[]),this.managedAttachments={},n=0,i=t.length;i>n;n++)e=t[n],this.manageAttachment(e)}return e(i,n),i.prototype.getAttachments=function(){var t,e,n,i;for(e in i=[],n=this.managedAttachments)t=n[e],i.push(t);return i},i.prototype.manageAttachment=function(e){var n,i;return null!=(n=this.managedAttachments)[i=e.id]?n[i]:n[i]=new t.ManagedAttachment(this,e)},i.prototype.attachmentIsManaged=function(t){return t.id in this.managedAttachments},i.prototype.requestRemovalOfAttachment=function(t){var e;return this.attachmentIsManaged(t)&&null!=(e=this.delegate)&&"function"==typeof e.attachmentManagerDidRequestRemovalOfAttachment?e.attachmentManagerDidRequestRemovalOfAttachment(t):void 0},i.prototype.unmanageAttachment=function(t){var e;return e=this.managedAttachments[t.id],delete this.managedAttachments[t.id],e},i}(t.BasicObject)}.call(this),function(){var e,n,i,r,o,s,a,u,c,l,h;e=t.elementContainsNode,n=t.findChildIndexOfNode,o=t.nodeIsBlockStart,s=t.nodeIsBlockStartComment,r=t.nodeIsBlockContainer,a=t.nodeIsCursorTarget,u=t.nodeIsEmptyTextNode,c=t.nodeIsTextNode,i=t.nodeIsAttachmentElement,l=t.tagName,h=t.walkTree,t.LocationMapper=function(){function t(t){this.element=t}var p,d,f,g;return t.prototype.findLocationFromContainerAndOffset=function(t,i,r){var s,u,l,p,g,m,y;for(m=(null!=r?r:{strict:!0}).strict,u=0,l=!1,p={index:0,offset:0},(s=this.findAttachmentElementParentForNode(t))&&(t=s.parentNode,i=n(s)),y=h(this.element,{usingFilter:f});y.nextNode();){if((g=y.currentNode)===t&&c(t)){a(g)||(p.offset+=i);break}if(g.parentNode===t){if(u++===i)break}else if(!e(t,g)&&u>0)break;o(g,{strict:m})?(l&&p.index++,p.offset=0,l=!0):p.offset+=d(g)}return p},t.prototype.findContainerAndOffsetFromLocation=function(t){var e,i,s,u,l;if(0===t.index&&0===t.offset){for(e=this.element,u=0;e.firstChild;)if(e=e.firstChild,r(e)){u=1;break}return[e,u]}if(i=(l=this.findNodeAndOffsetFromLocation(t))[0],s=l[1],i){if(c(i))0===d(i)?(e=i.parentNode.parentNode,u=n(i.parentNode),a(i,{name:"right"})&&u++):(e=i,u=t.offset-s);else{if(e=i.parentNode,!o(i.previousSibling)&&!r(e))for(;i===e.lastChild&&(i=e,e=e.parentNode,!r(e)););u=n(i),0!==t.offset&&u++}return[e,u]}},t.prototype.findNodeAndOffsetFromLocation=function(t){var e,n,i,r,o,s,u,l;for(u=0,n=0,i=(l=this.getSignificantNodesForIndex(t.index)).length;i>n;n++){if(e=l[n],r=d(e),t.offset<=u+r)if(c(e)){if(o=e,s=u,t.offset===s&&a(o))break}else o||(o=e,s=u);if((u+=r)>t.offset)break}return[o,s]},t.prototype.findAttachmentElementParentForNode=function(t){for(;t&&t!==this.element;){if(i(t))return t;t=t.parentNode}},t.prototype.getSignificantNodesForIndex=function(t){var e,n,i,r,o;for(i=[],o=h(this.element,{usingFilter:p}),r=!1;o.nextNode();)if(n=o.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},d=function(t){return t.nodeType===Node.TEXT_NODE?a(t)?0:t.textContent.length:"br"===l(t)||i(t)?1:0},p=function(t){return g(t)===NodeFilter.FILTER_ACCEPT?f(t):NodeFilter.FILTER_REJECT},g=function(t){return u(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},f=function(t){return i(t.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},t}()}.call(this),function(){var e,n,i=[].slice;e=t.getDOMRange,n=t.setDOMRange,t.PointMapper=function(){function t(){}return t.prototype.createDOMRangeFromPoint=function(t){var i,r,o,s,a,u,c,l;if(c=t.x,l=t.y,document.caretPositionFromPoint)return o=(a=document.caretPositionFromPoint(c,l)).offsetNode,r=a.offset,(i=document.createRange()).setStart(o,r),i;if(document.caretRangeFromPoint)return document.caretRangeFromPoint(c,l);if(document.body.createTextRange){s=e();try{(u=document.body.createTextRange()).moveToPoint(c,l),u.select()}catch(h){}return i=e(),n(s),i}},t.prototype.getClientRectsForDOMRange=function(t){var e;return[(e=i.call(t.getClientRects()))[0],e[e.length-1]]},t}()}.call(this),function(){var e,n=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty,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};e=t.getDOMRange,t.SelectionChangeObserver=function(t){function r(){this.run=n(this.run,this),this.update=n(this.update,this),this.selectionManagers=[]}var s;return i(r,t),r.prototype.start=function(){return this.started?void 0:(this.started=!0,"onselectionchange"in document?document.addEventListener("selectionchange",this.update,!0):this.run())},r.prototype.stop=function(){return this.started?(this.started=!1,document.removeEventListener("selectionchange",this.update,!0)):void 0},r.prototype.registerSelectionManager=function(t){return o.call(this.selectionManagers,t)<0?(this.selectionManagers.push(t),this.start()):void 0},r.prototype.unregisterSelectionManager=function(t){var e;return this.selectionManagers=function(){var n,i,r,o;for(o=[],n=0,i=(r=this.selectionManagers).length;i>n;n++)(e=r[n])!==t&&o.push(e);return o}.call(this),0===this.selectionManagers.length?this.stop():void 0},r.prototype.notifySelectionManagersOfSelectionChange=function(){var t,e,n,i,r;for(i=[],t=0,e=(n=this.selectionManagers).length;e>t;t++)r=n[t],i.push(r.selectionDidChange());return i},r.prototype.update=function(){var t;return t=e(),s(t,this.domRange)?void 0:(this.domRange=t,this.notifySelectionManagersOfSelectionChange())},r.prototype.reset=function(){return this.domRange=null,this.update()},r.prototype.run=function(){return this.started?(this.update(),requestAnimationFrame(this.run)):void 0},s=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)},r}(t.BasicObject),null==t.selectionChangeObserver&&(t.selectionChangeObserver=new t.SelectionChangeObserver)}.call(this),function(){var e,n,i,r,o,s,a,u,c,l,h=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function n(){this.constructor=t}for(var i in e)d.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},d={}.hasOwnProperty;i=t.getDOMSelection,n=t.getDOMRange,l=t.setDOMRange,e=t.elementContainsNode,s=t.nodeIsCursorTarget,o=t.innerElementIsActive,r=t.handleEvent,a=t.normalizeRange,u=t.rangeIsCollapsed,c=t.rangesAreEqual,t.SelectionManager=function(d){function f(e){this.element=e,this.selectionDidChange=h(this.selectionDidChange,this),this.didMouseDown=h(this.didMouseDown,this),this.locationMapper=new t.LocationMapper(this.element),this.pointMapper=new t.PointMapper,this.lockCount=0,r("mousedown",{onElement:this.element,withCallback:this.didMouseDown})}return p(f,d),f.prototype.getLocationRange=function(t){var e;return null==t&&(t={}),!1===t.strict?this.createLocationRangeFromDOMRange(n(),{strict:!1}):t.ignoreLock?this.currentLocationRange:null!=(e=this.lockedLocationRange)?e:this.currentLocationRange},f.prototype.setLocationRange=function(t){var e;if(!this.lockedLocationRange)return t=a(t),(e=this.createDOMRangeFromLocationRange(t))?(l(e),this.updateCurrentLocationRange(t)):void 0},f.prototype.setLocationRangeFromPointRange=function(t){var e,n;return t=a(t),n=this.getLocationAtPoint(t[0]),e=this.getLocationAtPoint(t[1]),this.setLocationRange([n,e])},f.prototype.getClientRectAtLocationRange=function(t){var e;return(e=this.createDOMRangeFromLocationRange(t))?this.getClientRectsForDOMRange(e)[1]:void 0},f.prototype.locationIsCursorTarget=function(t){var e,n;return e=(n=this.findNodeAndOffsetFromLocation(t))[0],n[1],s(e)},f.prototype.lock=function(){return 0===this.lockCount++?(this.updateCurrentLocationRange(),this.lockedLocationRange=this.getLocationRange()):void 0},f.prototype.unlock=function(){var t;return 0===--this.lockCount&&(t=this.lockedLocationRange,this.lockedLocationRange=null,null!=t)?this.setLocationRange(t):void 0},f.prototype.clearSelection=function(){var t;return null!=(t=i())?t.removeAllRanges():void 0},f.prototype.selectionIsCollapsed=function(){var t;return!0===(null!=(t=n())?t.collapsed:void 0)},f.prototype.selectionIsExpanded=function(){return!this.selectionIsCollapsed()},f.prototype.createLocationRangeFromDOMRange=function(t,e){var n,i;if(null!=t&&this.domRangeWithinElement(t)&&(i=this.findLocationFromContainerAndOffset(t.startContainer,t.startOffset,e)))return t.collapsed||(n=this.findLocationFromContainerAndOffset(t.endContainer,t.endOffset,e)),a([i,n])},f.proxyMethod("locationMapper.findLocationFromContainerAndOffset"),f.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"),f.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"),f.proxyMethod("pointMapper.createDOMRangeFromPoint"),f.proxyMethod("pointMapper.getClientRectsForDOMRange"),f.prototype.didMouseDown=function(){return this.pauseTemporarily()},f.prototype.pauseTemporarily=function(){var t,n,i,o;return this.paused=!0,n=function(t){return function(){var n,r;for(t.paused=!1,clearTimeout(o),n=0,r=i.length;r>n;n++)i[n].destroy();return e(document,t.element)?t.selectionDidChange():void 0}}(this),o=setTimeout(n,200),i=function(){var e,i,o,s;for(s=[],e=0,i=(o=["mousemove","keydown"]).length;i>e;e++)t=o[e],s.push(r(t,{onElement:document,withCallback:n}));return s}()},f.prototype.selectionDidChange=function(){return this.paused||o(this.element)?void 0:this.updateCurrentLocationRange()},f.prototype.updateCurrentLocationRange=function(t){var e;return(null!=t?t:t=this.createLocationRangeFromDOMRange(n()))&&!c(t,this.currentLocationRange)?(this.currentLocationRange=t,null!=(e=this.delegate)&&"function"==typeof e.locationRangeDidChange?e.locationRangeDidChange(this.currentLocationRange.slice(0)):void 0):void 0},f.prototype.createDOMRangeFromLocationRange=function(t){var e,n,i,r;return i=this.findContainerAndOffsetFromLocation(t[0]),n=u(t)?i:null!=(r=this.findContainerAndOffsetFromLocation(t[1]))?r:i,null!=i&&null!=n?((e=document.createRange()).setStart.apply(e,i),e.setEnd.apply(e,n),e):void 0},f.prototype.getLocationAtPoint=function(t){var e,n;return(e=this.createDOMRangeFromPoint(t))&&null!=(n=this.createLocationRangeFromDOMRange(e))?n[0]:void 0},f.prototype.domRangeWithinElement=function(t){return t.collapsed?e(this.element,t.startContainer):e(this.element,t.startContainer)&&e(this.element,t.endContainer)},f}(t.BasicObject)}.call(this),function(){var e,n,i,r,o=function(t,e){function n(){this.constructor=t}for(var i in e)s.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=[].slice;i=t.rangeIsCollapsed,r=t.rangesAreEqual,n=t.objectsAreEqual,e=t.getBlockConfig,t.EditorController=function(s){function u(e){var n,i;this.editorElement=e.editorElement,n=e.document,i=e.html,this.selectionManager=new t.SelectionManager(this.editorElement),this.selectionManager.delegate=this,this.composition=new t.Composition,this.composition.delegate=this,this.attachmentManager=new t.AttachmentManager(this.composition.getAttachments()),this.attachmentManager.delegate=this,this.inputController=new(t["Level"+t.config.input.getLevel()+"InputController"])(this.editorElement),this.inputController.delegate=this,this.inputController.responder=this.composition,this.compositionController=new t.CompositionController(this.editorElement,this.composition),this.compositionController.delegate=this,this.toolbarController=new t.ToolbarController(this.editorElement.toolbarElement),this.toolbarController.delegate=this,this.editor=new t.Editor(this.composition,this.selectionManager,this.editorElement),null!=n?this.editor.loadDocument(n):this.editor.loadHTML(i)}var c;return o(u,s),u.prototype.registerSelectionManager=function(){return t.selectionChangeObserver.registerSelectionManager(this.selectionManager)},u.prototype.unregisterSelectionManager=function(){return t.selectionChangeObserver.unregisterSelectionManager(this.selectionManager)},u.prototype.render=function(){return this.compositionController.render()},u.prototype.reparse=function(){return this.composition.replaceHTML(this.editorElement.innerHTML)},u.prototype.compositionDidChangeDocument=function(){return this.notifyEditorElement("document-change"),this.handlingInput?void 0:this.render()},u.prototype.compositionDidChangeCurrentAttributes=function(t){return this.currentAttributes=t,this.toolbarController.updateAttributes(this.currentAttributes),this.updateCurrentActions(),this.notifyEditorElement("attributes-change",{attributes:this.currentAttributes})},u.prototype.compositionDidPerformInsertionAtRange=function(t){return this.pasting?this.pastedRange=t:void 0},u.prototype.compositionShouldAcceptFile=function(t){return this.notifyEditorElement("file-accept",{file:t})},u.prototype.compositionDidAddAttachment=function(t){var e;return e=this.attachmentManager.manageAttachment(t),this.notifyEditorElement("attachment-add",{attachment:e})},u.prototype.compositionDidEditAttachment=function(t){var e;return this.compositionController.rerenderViewForObject(t),e=this.attachmentManager.manageAttachment(t),this.notifyEditorElement("attachment-edit",{attachment:e}),this.notifyEditorElement("change")},u.prototype.compositionDidChangeAttachmentPreviewURL=function(t){return this.compositionController.invalidateViewForObject(t),this.notifyEditorElement("change")},u.prototype.compositionDidRemoveAttachment=function(t){var e;return e=this.attachmentManager.unmanageAttachment(t),this.notifyEditorElement("attachment-remove",{attachment:e})},u.prototype.compositionDidStartEditingAttachment=function(t,e){return this.attachmentLocationRange=this.composition.document.getLocationRangeOfAttachment(t),this.compositionController.installAttachmentEditorForAttachment(t,e),this.selectionManager.setLocationRange(this.attachmentLocationRange)},u.prototype.compositionDidStopEditingAttachment=function(){return this.compositionController.uninstallAttachmentEditor(),this.attachmentLocationRange=null},u.prototype.compositionDidRequestChangingSelectionToLocationRange=function(t){return!this.loadingSnapshot||this.isFocused()?(this.requestedLocationRange=t,this.compositionRevisionWhenLocationRangeRequested=this.composition.revision,this.handlingInput?void 0:this.render()):void 0},u.prototype.compositionWillLoadSnapshot=function(){return this.loadingSnapshot=!0},u.prototype.compositionDidLoadSnapshot=function(){return this.compositionController.refreshViewCache(),this.render(),this.loadingSnapshot=!1},u.prototype.getSelectionManager=function(){return this.selectionManager},u.proxyMethod("getSelectionManager().setLocationRange"),u.proxyMethod("getSelectionManager().getLocationRange"),u.prototype.attachmentManagerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},u.prototype.compositionControllerWillSyncDocumentView=function(){return this.inputController.editorWillSyncDocumentView(),this.selectionManager.lock(),this.selectionManager.clearSelection()},u.prototype.compositionControllerDidSyncDocumentView=function(){return this.inputController.editorDidSyncDocumentView(),this.selectionManager.unlock(),this.updateCurrentActions(),this.notifyEditorElement("sync")},u.prototype.compositionControllerDidRender=function(){return null!=this.requestedLocationRange&&(this.compositionRevisionWhenLocationRangeRequested===this.composition.revision&&this.selectionManager.setLocationRange(this.requestedLocationRange),this.requestedLocationRange=null,this.compositionRevisionWhenLocationRangeRequested=null),this.renderedCompositionRevision!==this.composition.revision&&(this.runEditorFilters(),this.composition.updateCurrentAttributes(),this.notifyEditorElement("render")),this.renderedCompositionRevision=this.composition.revision},u.prototype.compositionControllerDidFocus=function(){return this.toolbarController.hideDialog(),this.notifyEditorElement("focus")},u.prototype.compositionControllerDidBlur=function(){return this.notifyEditorElement("blur")},u.prototype.compositionControllerDidSelectAttachment=function(t,e){return this.composition.editAttachment(t,e)},u.prototype.compositionControllerDidRequestDeselectingAttachment=function(t){var e,n;return e=null!=(n=this.attachmentLocationRange)?n:this.composition.document.getLocationRangeOfAttachment(t),this.selectionManager.setLocationRange(e[1])},u.prototype.compositionControllerWillUpdateAttachment=function(t){return this.editor.recordUndoEntry("Edit Attachment",{context:t.id,consolidatable:!0})},u.prototype.compositionControllerDidRequestRemovalOfAttachment=function(t){return this.removeAttachment(t)},u.prototype.inputControllerWillHandleInput=function(){return this.handlingInput=!0,this.requestedRender=!1},u.prototype.inputControllerDidRequestRender=function(){return this.requestedRender=!0},u.prototype.inputControllerDidHandleInput=function(){return this.handlingInput=!1,this.requestedRender?(this.requestedRender=!1,this.render()):void 0},u.prototype.inputControllerDidAllowUnhandledInput=function(){return this.notifyEditorElement("change")},u.prototype.inputControllerDidRequestReparse=function(){return this.reparse()},u.prototype.inputControllerWillPerformTyping=function(){return this.recordTypingUndoEntry()},u.prototype.inputControllerWillPerformFormatting=function(t){return this.recordFormattingUndoEntry(t)},u.prototype.inputControllerWillCutText=function(){return this.editor.recordUndoEntry("Cut")},u.prototype.inputControllerWillPaste=function(t){return this.editor.recordUndoEntry("Paste"),this.pasting=!0,this.notifyEditorElement("before-paste",{paste:t})},u.prototype.inputControllerDidPaste=function(t){return t.range=this.pastedRange,this.pastedRange=null,this.pasting=null,this.notifyEditorElement("paste",{paste:t})},u.prototype.inputControllerWillMoveText=function(){return this.editor.recordUndoEntry("Move")},u.prototype.inputControllerWillAttachFiles=function(){return this.editor.recordUndoEntry("Drop Files")},u.prototype.inputControllerWillPerformUndo=function(){return this.editor.undo()},u.prototype.inputControllerWillPerformRedo=function(){return this.editor.redo()},u.prototype.inputControllerDidReceiveKeyboardCommand=function(t){return this.toolbarController.applyKeyboardCommand(t)},u.prototype.inputControllerDidStartDrag=function(){return this.locationRangeBeforeDrag=this.selectionManager.getLocationRange()},u.prototype.inputControllerDidReceiveDragOverPoint=function(t){return this.selectionManager.setLocationRangeFromPointRange(t)},u.prototype.inputControllerDidCancelDrag=function(){return this.selectionManager.setLocationRange(this.locationRangeBeforeDrag),this.locationRangeBeforeDrag=null},u.prototype.locationRangeDidChange=function(t){return this.composition.updateCurrentAttributes(),this.updateCurrentActions(),this.attachmentLocationRange&&!r(this.attachmentLocationRange,t)&&this.composition.stopEditingAttachment(),this.notifyEditorElement("selection-change")},u.prototype.toolbarDidClickButton=function(){return this.getLocationRange()?void 0:this.setLocationRange({index:0,offset:0})},u.prototype.toolbarDidInvokeAction=function(t){return this.invokeAction(t)},u.prototype.toolbarDidToggleAttribute=function(t){return this.recordFormattingUndoEntry(t),this.composition.toggleCurrentAttribute(t),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarDidUpdateAttribute=function(t,e){return this.recordFormattingUndoEntry(t),this.composition.setCurrentAttribute(t,e),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarDidRemoveAttribute=function(t){return this.recordFormattingUndoEntry(t),this.composition.removeCurrentAttribute(t),this.render(),this.selectionFrozen?void 0:this.editorElement.focus()},u.prototype.toolbarWillShowDialog=function(){return this.composition.expandSelectionForEditing(),this.freezeSelection()},u.prototype.toolbarDidShowDialog=function(t){return this.notifyEditorElement("toolbar-dialog-show",{dialogName:t})},u.prototype.toolbarDidHideDialog=function(t){return this.thawSelection(),this.editorElement.focus(),this.notifyEditorElement("toolbar-dialog-hide",{dialogName:t})},u.prototype.freezeSelection=function(){return this.selectionFrozen?void 0:(this.selectionManager.lock(),this.composition.freezeSelection(),this.selectionFrozen=!0,this.render())},u.prototype.thawSelection=function(){return this.selectionFrozen?(this.composition.thawSelection(),this.selectionManager.unlock(),this.selectionFrozen=!1,this.render()):void 0},u.prototype.actions={undo:{test:function(){return this.editor.canUndo()},perform:function(){return this.editor.undo()}},redo:{test:function(){return this.editor.canRedo()},perform:function(){return this.editor.redo()}},link:{test:function(){return this.editor.canActivateAttribute("href")}},increaseNestingLevel:{test:function(){return this.editor.canIncreaseNestingLevel()},perform:function(){return this.editor.increaseNestingLevel()&&this.render()}},decreaseNestingLevel:{test:function(){return this.editor.canDecreaseNestingLevel()},perform:function(){return this.editor.decreaseNestingLevel()&&this.render()}},attachFiles:{test:function(){return!0},perform:function(){return t.config.input.pickFiles(this.editor.insertFiles)}}},u.prototype.canInvokeAction=function(t){var e,n;return!!this.actionIsExternal(t)||!!(null!=(e=this.actions[t])&&null!=(n=e.test)?n.call(this):void 0)},u.prototype.invokeAction=function(t){var e,n;return this.actionIsExternal(t)?this.notifyEditorElement("action-invoke",{actionName:t}):null!=(e=this.actions[t])&&null!=(n=e.perform)?n.call(this):void 0},u.prototype.actionIsExternal=function(t){return/^x-./.test(t)},u.prototype.getCurrentActions=function(){var t,e;for(t in e={},this.actions)e[t]=this.canInvokeAction(t);return e},u.prototype.updateCurrentActions=function(){var t;return t=this.getCurrentActions(),n(t,this.currentActions)?void 0:(this.currentActions=t,this.toolbarController.updateActions(this.currentActions),this.notifyEditorElement("actions-change",{actions:this.currentActions}))},u.prototype.runEditorFilters=function(){var t,e,n,i,r,o,s,a;for(a=this.composition.getSnapshot(),n=0,i=(r=this.editor.filters).length;i>n;n++)e=r[n],t=a.document,s=a.selectedRange,null==(a=null!=(o=e.call(this.editor,a))?o:{}).document&&(a.document=t),null==a.selectedRange&&(a.selectedRange=s);return c(a,this.composition.getSnapshot())?void 0:this.composition.loadSnapshot(a)},c=function(t,e){return r(t.selectedRange,e.selectedRange)&&t.document.isEqualTo(e.document)},u.prototype.updateInputElement=function(){var e,n;return e=this.compositionController.getSerializableElement(),n=t.serializeToContentType(e,"text/html"),this.editorElement.setInputElementValue(n)},u.prototype.notifyEditorElement=function(t,e){switch(t){case"document-change":this.documentChangedSinceLastRender=!0;break;case"render":this.documentChangedSinceLastRender&&(this.documentChangedSinceLastRender=!1,this.notifyEditorElement("change"));break;case"change":case"attachment-add":case"attachment-edit":case"attachment-remove":this.updateInputElement()}return this.editorElement.notify(t,e)},u.prototype.removeAttachment=function(t){return this.editor.recordUndoEntry("Delete Attachment"),this.composition.removeAttachment(t),this.render()},u.prototype.recordFormattingUndoEntry=function(t){var n,r;return n=e(t),r=this.selectionManager.getLocationRange(),n||!i(r)?this.editor.recordUndoEntry("Formatting",{context:this.getUndoContext(),consolidatable:!0}):void 0},u.prototype.recordTypingUndoEntry=function(){return this.editor.recordUndoEntry("Typing",{context:this.getUndoContext(this.currentAttributes),consolidatable:!0})},u.prototype.getUndoContext=function(){var t;return t=1<=arguments.length?a.call(arguments,0):[],[this.getLocationContext(),this.getTimeContext()].concat(a.call(t))},u.prototype.getLocationContext=function(){var t;return t=this.selectionManager.getLocationRange(),i(t)?t[0].index:t},u.prototype.getTimeContext=function(){return t.config.undoInterval>0?Math.floor((new Date).getTime()/t.config.undoInterval):0},u.prototype.isFocused=function(){var t;return this.editorElement===(null!=(t=this.editorElement.ownerDocument)?t.activeElement:void 0)},u}(t.Controller)}.call(this),function(){var e,n,i,r,o,s,a,u,c,l,h,p,d,f;n=t.browser,o=t.makeElement,s=t.triggerEvent,i=t.handleEvent,r=t.handleEventOnce,e=t.AttachmentView.attachmentSelector,t.registerElement("trix-editor",(p=0,u=function(t){return!document.querySelector(":focus")&&t.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===t?t.focus():void 0},d=function(t){return t.hasAttribute("contenteditable")?void 0:(t.setAttribute("contenteditable",""),r("focus",{onElement:t,withCallback:function(){return c(t)}}))},a=function(t){return t.hasAttribute("role")?void 0:t.setAttribute("role","textbox")},c=function(t){return h(t),f(t)},h=function(t){return("function"==typeof document.queryCommandSupported?document.queryCommandSupported("enableObjectResizing"):void 0)?(document.execCommand("enableObjectResizing",!1,!1),i("mscontrolselect",{onElement:t,preventDefault:!0})):void 0},f=function(){var e;return("function"==typeof document.queryCommandSupported?document.queryCommandSupported("DefaultParagraphSeparator"):void 0)&&("div"===(e=t.config.blockAttributes.default.tagName)||"p"===e)?document.execCommand("DefaultParagraphSeparator",!1,e):void 0},l=n.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"},{defaultCSS:"%t {\n display: block;\n}\n\n%t:empty:not(:focus)::before {\n content: attr(placeholder);\n color: graytext;\n cursor: text;\n}\n\n%t a[contenteditable=false] {\n cursor: text;\n}\n\n%t img {\n max-width: 100%;\n height: auto;\n}\n\n%t "+e+" figcaption textarea {\n resize: none;\n}\n\n%t "+e+" figcaption textarea.trix-autoresize-clone {\n position: absolute;\n left: -9999px;\n max-height: 0px;\n}\n\n%t "+e+" figcaption[data-trix-placeholder]:empty::before {\n content: attr(data-trix-placeholder);\n color: graytext;\n}\n\n%t [data-trix-cursor-target] {\n display: "+l.display+" !important;\n width: "+l.width+" !important;\n padding: 0 !important;\n margin: 0 !important;\n border: none !important;\n}\n\n%t [data-trix-cursor-target=left] {\n vertical-align: top !important;\n margin-left: -1px !important;\n}\n\n%t [data-trix-cursor-target=right] {\n vertical-align: bottom !important;\n margin-right: -1px !important;\n}",trixId:{get:function(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++p),this.trixId)}},toolbarElement:{get:function(){var t,e,n;return this.hasAttribute("toolbar")?null!=(e=this.ownerDocument)?e.getElementById(this.getAttribute("toolbar")):void 0:this.parentNode?(n="trix-toolbar-"+this.trixId,this.setAttribute("toolbar",n),t=o("trix-toolbar",{id:n}),this.parentNode.insertBefore(t,this),t):void 0}},inputElement:{get:function(){var t,e,n;return this.hasAttribute("input")?null!=(n=this.ownerDocument)?n.getElementById(this.getAttribute("input")):void 0:this.parentNode?(e="trix-input-"+this.trixId,this.setAttribute("input",e),t=o("input",{type:"hidden",id:e}),this.parentNode.insertBefore(t,this.nextElementSibling),t):void 0}},editor:{get:function(){var t;return null!=(t=this.editorController)?t.editor:void 0}},name:{get:function(){var t;return null!=(t=this.inputElement)?t.name:void 0}},value:{get:function(){var t;return null!=(t=this.inputElement)?t.value:void 0},set:function(t){var e;return this.defaultValue=t,null!=(e=this.editor)?e.loadHTML(this.defaultValue):void 0}},notify:function(t,e){return this.editorController?s("trix-"+t,{onElement:this,attributes:e}):void 0},setInputElementValue:function(t){var e;return null!=(e=this.inputElement)?e.value=t:void 0},initialize:function(){return d(this),a(this)},connect:function(){return this.hasAttribute("data-trix-internal")?void 0:(this.editorController||(s("trix-before-initialize",{onElement:this}),this.editorController=new t.EditorController({editorElement:this,html:this.defaultValue=this.value}),requestAnimationFrame(function(t){return function(){return s("trix-initialize",{onElement:t})}}(this))),this.editorController.registerSelectionManager(),this.registerResetListener(),u(this))},disconnect:function(){var t;return null!=(t=this.editorController)&&t.unregisterSelectionManager(),this.unregisterResetListener()},registerResetListener:function(){return this.resetListener=this.resetBubbled.bind(this),window.addEventListener("reset",this.resetListener,!1)},unregisterResetListener:function(){return window.removeEventListener("reset",this.resetListener,!1)},resetBubbled:function(t){var e;return t.target!==(null!=(e=this.inputElement)?e.form:void 0)||t.defaultPrevented?void 0:this.reset()},reset:function(){return this.value=this.defaultValue}}))}.call(this),function(){}.call(this)}).call(this),"object"==s(i)&&i.exports?i.exports=t:void 0===(o="function"===typeof(r=t)?r.call(e,n,e,i):r)||(i.exports=o)}.call(this)}).call(this,n(4).setImmediate,n(7)(t))},function(t,e,n){(function(t){var i="undefined"!==typeof t&&t||"undefined"!==typeof self&&self||window,r=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(r.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new o(r.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(5),e.setImmediate="undefined"!==typeof self&&self.setImmediate||"undefined"!==typeof t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!==typeof self&&self.clearImmediate||"undefined"!==typeof t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var i,r,o,s,a,u=1,c={},l=!1,h=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?i=function(t){e.nextTick((function(){f(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},i=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(r=h.documentElement,i=function(t){var e=h.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):i=function(t){setTimeout(f,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"===typeof e.data&&0===e.data.indexOf(s)&&f(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),i=function(e){t.postMessage(s+e,"*")}),p.setImmediate=function(t){"function"!==typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return c[u]=r,i(u),u++},p.clearImmediate=d}function d(t){delete c[t]}function f(t){if(l)setTimeout(f,0,t);else{var e=c[t];if(e){l=!0;try{!function(t){var e=t.callback,i=t.args;switch(i.length){case 0:e();break;case 1:e(i[0]);break;case 2:e(i[0],i[1]);break;case 3:e(i[0],i[1],i[2]);break;default:e.apply(n,i)}}(e)}finally{d(t),l=!1}}}}}("undefined"===typeof self?"undefined"===typeof t?this:t:self)}).call(this,n(0),n(6))},function(t,e){var n,i,r=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"===typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"===typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var u,c=[],l=!1,h=-1;function p(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&d())}function d(){if(!l){var t=a(p);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function g(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new f(t,e)),1!==c.length||l||a(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=g,r.addListener=g,r.once=g,r.off=g,r.removeListener=g,r.removeAllListeners=g,r.emit=g,r.prependListener=g,r.prependOnceListener=g,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";n.r(e);var i=n(1);function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var o=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.attachment=e,this.element=n,this.directUpload=new i.DirectUpload(e.file,this.directUploadUrl,this)}var e,n,o;return e=t,(n=[{key:"start",value:function(){this.directUpload.create(this.directUploadDidComplete.bind(this))}},{key:"directUploadWillStoreFileWithXHR",value:function(t){var e=this;t.upload.addEventListener("progress",(function(t){var n=t.loaded/t.total*100;e.attachment.setUploadProgress(n)}))}},{key:"directUploadDidComplete",value:function(t,e){if(t)throw new Error("Direct upload failed: ".concat(t));this.attachment.setAttributes({sgid:e.attachable_sgid,url:this.createBlobUrl(e.signed_id,e.filename)})}},{key:"createBlobUrl",value:function(t,e){return this.blobUrlTemplate.replace(":signed_id",t).replace(":filename",encodeURIComponent(e))}},{key:"directUploadUrl",get:function(){return this.element.dataset.directUploadUrl}},{key:"blobUrlTemplate",get:function(){return this.element.dataset.blobUrlTemplate}}])&&r(e.prototype,n),o&&r(e,o),t}();addEventListener("trix-attachment-add",(function(t){var e=t.attachment,n=t.target;e.file&&new o(e,n).start()}))}]);
@@ -1,3 +1,5 @@
1
+ @import "trix/dist/trix"
2
+
1
3
  @import "./reset.sass"
2
4
  @import "./typo.scss"
3
5
  @import "./functions.sass"
@@ -1277,3 +1279,39 @@ input[type="submit"].alt_button,
1277
1279
 
1278
1280
  input[type=file][data-direct-upload-url][disabled]
1279
1281
  display: none
1282
+
1283
+ trix-toolbar .trix-button
1284
+ background: white
1285
+
1286
+ trix-editor.default_input
1287
+ width: auto
1288
+ min-width: 600px
1289
+ a
1290
+ color: $b1
1291
+ text-decoration: underline
1292
+
1293
+ form .input .attachment--content figcaption
1294
+ text-align: center
1295
+ textarea
1296
+ width: 100%
1297
+
1298
+
1299
+ .trix-content
1300
+ .attachment-gallery
1301
+ > action-text-attachment,
1302
+ > .attachment
1303
+ flex: 1 0 33%
1304
+ padding: 0 0.5em
1305
+ max-width: 33%
1306
+
1307
+ &.attachment-gallery--2
1308
+ &.attachment-gallery--4
1309
+ > action-text-attachment
1310
+ > .attachment
1311
+ flex-basis: 50%
1312
+ max-width: 50%
1313
+
1314
+ action-text-attachment
1315
+ .attachment
1316
+ padding: 0 !important
1317
+ max-width: 100% !important
@@ -168,7 +168,7 @@ class Bhf::EntriesController < Bhf::ApplicationController
168
168
  def manage_many_to_many
169
169
  return unless params[:has_and_belongs_to_many]
170
170
  params[:has_and_belongs_to_many].each_pair do |relation, ids|
171
- next unless ids.any?
171
+ next unless ids.empty?
172
172
  reflection = @model.reflections[relation]
173
173
  relation_array = @object.send(relation)
174
174
  reflection.klass.unscoped.find(ids.keys).each do |relation_obj|
@@ -208,7 +208,7 @@ class Bhf::EntriesController < Bhf::ApplicationController
208
208
  return unless params[:has_many]
209
209
  object_id = @object.send(@model.bhf_primary_key)
210
210
  params[:has_many].each_pair do |relation, ids|
211
- next unless ids.any?
211
+ next unless ids.empty?
212
212
  reflection = @model.reflections[relation]
213
213
  preset_ids = @object.send(relation).collect do |object|
214
214
  object.send(object.class.bhf_primary_key).to_s