WP Table Builder – WordPress Table Plugin - Version 1.3.4

Version Description

  • NEW: Global PHP function to inline render any table inside theme files (wptb_render_table).
  • NEW: What-is-new component that will be shown after every update to point out key improvements and new additions to plugin.
  • NEW: Extra styles control to override styles affecting your table.
  • IMPROVE: Text element placeholder text is replaced with a more appropriate one.
  • IMPROVE: Button html element support for custom html table element.
  • IMPROVE: More frequently used table settings are moved to a higher priority position.
  • IMPROVE: Better manage cells menu layout to keep top and bottom row tools always visible.
  • FIX: Fixed an issue where newly created table text elements share same identification number.
  • FIX: Fixed an issue affecting row colors of static top row enabled responsive tables.
  • FIX: Fixed an issue affecting text element where at certain situations align options are not working.
  • FIX: Fixed an issue affecting table layouts where they are hidden at page load through tabs or any other CSS visibility rules.
  • FIX: Fixed an issue where deleting a text element also deletes its container.
  • FIX: Fixed an issue affecting one row tables where top row as header or static top row options don't render the table correctly.
  • IMPROVE: New background logic and menu.
  • PRO: IMPROVE: Version sync capability to keep both base and pro versions of plugin in sync with each other at update and downgrade operations.
Download this release

Release Info

Developer imtiazrayhan
Plugin Icon 128x128 WP Table Builder – WordPress Table Plugin
Version 1.3.4
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.4

assets/images/what-is-new/background_menu.png ADDED
Binary file
assets/images/what-is-new/extra_styles.png ADDED
Binary file
assets/images/what-is-new/general_styles_menu.png ADDED
Binary file
assets/images/what-is-new/generate_data_table.png ADDED
Binary file
assets/images/what-is-new/new_color_picker.png ADDED
Binary file
assets/images/what-is-new/pro_data_table_options.png ADDED
Binary file
assets/images/what-is-new/theme_inline_render_function.png ADDED
Binary file
assets/images/what-is-new/version_sync.png ADDED
Binary file
assets/images/what-is-new/wptb-logo-new.png ADDED
Binary file
inc/admin/WPTB_BuilderControls.css ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* BASICS */
2
+
3
+ .CodeMirror {
4
+ /* Set height, width, borders, and global font properties here */
5
+ font-family: monospace;
6
+ height: 300px;
7
+ color: black;
8
+ direction: ltr;
9
+ }
10
+
11
+ /* PADDING */
12
+
13
+ .CodeMirror-lines {
14
+ padding: 4px 0; /* Vertical padding around content */
15
+ }
16
+ .CodeMirror pre.CodeMirror-line,
17
+ .CodeMirror pre.CodeMirror-line-like {
18
+ padding: 0 4px; /* Horizontal padding of content */
19
+ }
20
+
21
+ .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
22
+ background-color: transparent; /* The little square between H and V scrollbars */
23
+ }
24
+
25
+ /* GUTTER */
26
+
27
+ .CodeMirror-gutters {
28
+ border-right: 1px solid #ddd;
29
+ background-color: #f7f7f7;
30
+ white-space: nowrap;
31
+ }
32
+ .CodeMirror-linenumbers {}
33
+ .CodeMirror-linenumber {
34
+ padding: 0 3px 0 5px;
35
+ min-width: 20px;
36
+ text-align: right;
37
+ color: #999;
38
+ white-space: nowrap;
39
+ }
40
+
41
+ .CodeMirror-guttermarker { color: black; }
42
+ .CodeMirror-guttermarker-subtle { color: #999; }
43
+
44
+ /* CURSOR */
45
+
46
+ .CodeMirror-cursor {
47
+ border-left: 1px solid black;
48
+ border-right: none;
49
+ width: 0;
50
+ }
51
+ /* Shown when moving in bi-directional text */
52
+ .CodeMirror div.CodeMirror-secondarycursor {
53
+ border-left: 1px solid silver;
54
+ }
55
+ .cm-fat-cursor .CodeMirror-cursor {
56
+ width: auto;
57
+ border: 0 !important;
58
+ background: #7e7;
59
+ }
60
+ .cm-fat-cursor div.CodeMirror-cursors {
61
+ z-index: 1;
62
+ }
63
+ .cm-fat-cursor-mark {
64
+ background-color: rgba(20, 255, 20, 0.5);
65
+ -webkit-animation: blink 1.06s steps(1) infinite;
66
+ -moz-animation: blink 1.06s steps(1) infinite;
67
+ animation: blink 1.06s steps(1) infinite;
68
+ }
69
+ .cm-animate-fat-cursor {
70
+ width: auto;
71
+ border: 0;
72
+ -webkit-animation: blink 1.06s steps(1) infinite;
73
+ -moz-animation: blink 1.06s steps(1) infinite;
74
+ animation: blink 1.06s steps(1) infinite;
75
+ background-color: #7e7;
76
+ }
77
+ @-moz-keyframes blink {
78
+ 0% {}
79
+ 50% { background-color: transparent; }
80
+ 100% {}
81
+ }
82
+ @-webkit-keyframes blink {
83
+ 0% {}
84
+ 50% { background-color: transparent; }
85
+ 100% {}
86
+ }
87
+ @keyframes blink {
88
+ 0% {}
89
+ 50% { background-color: transparent; }
90
+ 100% {}
91
+ }
92
+
93
+ /* Can style cursor different in overwrite (non-insert) mode */
94
+ .CodeMirror-overwrite .CodeMirror-cursor {}
95
+
96
+ .cm-tab { display: inline-block; text-decoration: inherit; }
97
+
98
+ .CodeMirror-rulers {
99
+ position: absolute;
100
+ left: 0; right: 0; top: -50px; bottom: 0;
101
+ overflow: hidden;
102
+ }
103
+ .CodeMirror-ruler {
104
+ border-left: 1px solid #ccc;
105
+ top: 0; bottom: 0;
106
+ position: absolute;
107
+ }
108
+
109
+ /* DEFAULT THEME */
110
+
111
+ .cm-s-default .cm-header {color: blue;}
112
+ .cm-s-default .cm-quote {color: #090;}
113
+ .cm-negative {color: #d44;}
114
+ .cm-positive {color: #292;}
115
+ .cm-header, .cm-strong {font-weight: bold;}
116
+ .cm-em {font-style: italic;}
117
+ .cm-link {text-decoration: underline;}
118
+ .cm-strikethrough {text-decoration: line-through;}
119
+
120
+ .cm-s-default .cm-keyword {color: #708;}
121
+ .cm-s-default .cm-atom {color: #219;}
122
+ .cm-s-default .cm-number {color: #164;}
123
+ .cm-s-default .cm-def {color: #00f;}
124
+ .cm-s-default .cm-variable,
125
+ .cm-s-default .cm-punctuation,
126
+ .cm-s-default .cm-property,
127
+ .cm-s-default .cm-operator {}
128
+ .cm-s-default .cm-variable-2 {color: #05a;}
129
+ .cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
130
+ .cm-s-default .cm-comment {color: #a50;}
131
+ .cm-s-default .cm-string {color: #a11;}
132
+ .cm-s-default .cm-string-2 {color: #f50;}
133
+ .cm-s-default .cm-meta {color: #555;}
134
+ .cm-s-default .cm-qualifier {color: #555;}
135
+ .cm-s-default .cm-builtin {color: #30a;}
136
+ .cm-s-default .cm-bracket {color: #997;}
137
+ .cm-s-default .cm-tag {color: #170;}
138
+ .cm-s-default .cm-attribute {color: #00c;}
139
+ .cm-s-default .cm-hr {color: #999;}
140
+ .cm-s-default .cm-link {color: #00c;}
141
+
142
+ .cm-s-default .cm-error {color: #f00;}
143
+ .cm-invalidchar {color: #f00;}
144
+
145
+ .CodeMirror-composing { border-bottom: 2px solid; }
146
+
147
+ /* Default styles for common addons */
148
+
149
+ div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
150
+ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
151
+ .CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
152
+ .CodeMirror-activeline-background {background: #e8f2ff;}
153
+
154
+ /* STOP */
155
+
156
+ /* The rest of this file contains styles related to the mechanics of
157
+ the editor. You probably shouldn't touch them. */
158
+
159
+ .CodeMirror {
160
+ position: relative;
161
+ overflow: hidden;
162
+ background: white;
163
+ }
164
+
165
+ .CodeMirror-scroll {
166
+ overflow: scroll !important; /* Things will break if this is overridden */
167
+ /* 50px is the magic margin used to hide the element's real scrollbars */
168
+ /* See overflow: hidden in .CodeMirror */
169
+ margin-bottom: -50px; margin-right: -50px;
170
+ padding-bottom: 50px;
171
+ height: 100%;
172
+ outline: none; /* Prevent dragging from highlighting the element */
173
+ position: relative;
174
+ }
175
+ .CodeMirror-sizer {
176
+ position: relative;
177
+ border-right: 50px solid transparent;
178
+ }
179
+
180
+ /* The fake, visible scrollbars. Used to force redraw during scrolling
181
+ before actual scrolling happens, thus preventing shaking and
182
+ flickering artifacts. */
183
+ .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
184
+ position: absolute;
185
+ z-index: 6;
186
+ display: none;
187
+ outline: none;
188
+ }
189
+ .CodeMirror-vscrollbar {
190
+ right: 0; top: 0;
191
+ overflow-x: hidden;
192
+ overflow-y: scroll;
193
+ }
194
+ .CodeMirror-hscrollbar {
195
+ bottom: 0; left: 0;
196
+ overflow-y: hidden;
197
+ overflow-x: scroll;
198
+ }
199
+ .CodeMirror-scrollbar-filler {
200
+ right: 0; bottom: 0;
201
+ }
202
+ .CodeMirror-gutter-filler {
203
+ left: 0; bottom: 0;
204
+ }
205
+
206
+ .CodeMirror-gutters {
207
+ position: absolute; left: 0; top: 0;
208
+ min-height: 100%;
209
+ z-index: 3;
210
+ }
211
+ .CodeMirror-gutter {
212
+ white-space: normal;
213
+ height: 100%;
214
+ display: inline-block;
215
+ vertical-align: top;
216
+ margin-bottom: -50px;
217
+ }
218
+ .CodeMirror-gutter-wrapper {
219
+ position: absolute;
220
+ z-index: 4;
221
+ background: none !important;
222
+ border: none !important;
223
+ }
224
+ .CodeMirror-gutter-background {
225
+ position: absolute;
226
+ top: 0; bottom: 0;
227
+ z-index: 4;
228
+ }
229
+ .CodeMirror-gutter-elt {
230
+ position: absolute;
231
+ cursor: default;
232
+ z-index: 4;
233
+ }
234
+ .CodeMirror-gutter-wrapper ::selection { background-color: transparent }
235
+ .CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
236
+
237
+ .CodeMirror-lines {
238
+ cursor: text;
239
+ min-height: 1px; /* prevents collapsing before first draw */
240
+ }
241
+ .CodeMirror pre.CodeMirror-line,
242
+ .CodeMirror pre.CodeMirror-line-like {
243
+ /* Reset some styles that the rest of the page might have set */
244
+ -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
245
+ border-width: 0;
246
+ background: transparent;
247
+ font-family: inherit;
248
+ font-size: inherit;
249
+ margin: 0;
250
+ white-space: pre;
251
+ word-wrap: normal;
252
+ line-height: inherit;
253
+ color: inherit;
254
+ z-index: 2;
255
+ position: relative;
256
+ overflow: visible;
257
+ -webkit-tap-highlight-color: transparent;
258
+ -webkit-font-variant-ligatures: contextual;
259
+ font-variant-ligatures: contextual;
260
+ }
261
+ .CodeMirror-wrap pre.CodeMirror-line,
262
+ .CodeMirror-wrap pre.CodeMirror-line-like {
263
+ word-wrap: break-word;
264
+ white-space: pre-wrap;
265
+ word-break: normal;
266
+ }
267
+
268
+ .CodeMirror-linebackground {
269
+ position: absolute;
270
+ left: 0; right: 0; top: 0; bottom: 0;
271
+ z-index: 0;
272
+ }
273
+
274
+ .CodeMirror-linewidget {
275
+ position: relative;
276
+ z-index: 2;
277
+ padding: 0.1px; /* Force widget margins to stay inside of the container */
278
+ }
279
+
280
+ .CodeMirror-widget {}
281
+
282
+ .CodeMirror-rtl pre { direction: rtl; }
283
+
284
+ .CodeMirror-code {
285
+ outline: none;
286
+ }
287
+
288
+ /* Force content-box sizing for the elements where we expect it */
289
+ .CodeMirror-scroll,
290
+ .CodeMirror-sizer,
291
+ .CodeMirror-gutter,
292
+ .CodeMirror-gutters,
293
+ .CodeMirror-linenumber {
294
+ -moz-box-sizing: content-box;
295
+ box-sizing: content-box;
296
+ }
297
+
298
+ .CodeMirror-measure {
299
+ position: absolute;
300
+ width: 100%;
301
+ height: 0;
302
+ overflow: hidden;
303
+ visibility: hidden;
304
+ }
305
+
306
+ .CodeMirror-cursor {
307
+ position: absolute;
308
+ pointer-events: none;
309
+ }
310
+ .CodeMirror-measure pre { position: static; }
311
+
312
+ div.CodeMirror-cursors {
313
+ visibility: hidden;
314
+ position: relative;
315
+ z-index: 3;
316
+ }
317
+ div.CodeMirror-dragcursors {
318
+ visibility: visible;
319
+ }
320
+
321
+ .CodeMirror-focused div.CodeMirror-cursors {
322
+ visibility: visible;
323
+ }
324
+
325
+ .CodeMirror-selected { background: #d9d9d9; }
326
+ .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
327
+ .CodeMirror-crosshair { cursor: crosshair; }
328
+ .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
329
+ .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
330
+
331
+ .cm-searching {
332
+ background-color: #ffa;
333
+ background-color: rgba(255, 255, 0, .4);
334
+ }
335
+
336
+ /* Used to force a border model for a node */
337
+ .cm-force-border { padding-right: .1px; }
338
+
339
+ @media print {
340
+ /* Hide the cursor when printing */
341
+ .CodeMirror div.CodeMirror-cursors {
342
+ visibility: hidden;
343
+ }
344
+ }
345
+
346
+ /* See issue #2901 */
347
+ .cm-tab-wrap-hack:after { content: ''; }
348
+
349
+ /* Help users use markselection to safely style text background */
350
+ span.CodeMirror-selectedtext { background: none; }
351
+
352
+
353
+ /*# sourceMappingURL=/WPTB_BuilderControls.css.map */
inc/admin/WPTB_BuilderControls.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["../../../../../node_modules/codemirror/lib/codemirror.css"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"WPTB_BuilderControls.css","sourceRoot":"js/core/rollup-source","sourcesContent":["/* BASICS */\n\n.CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-family: monospace;\n height: 300px;\n color: black;\n direction: ltr;\n}\n\n/* PADDING */\n\n.CodeMirror-lines {\n padding: 4px 0; /* Vertical padding around content */\n}\n.CodeMirror pre.CodeMirror-line,\n.CodeMirror pre.CodeMirror-line-like {\n padding: 0 4px; /* Horizontal padding of content */\n}\n\n.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n background-color: transparent; /* The little square between H and V scrollbars */\n}\n\n/* GUTTER */\n\n.CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n}\n.CodeMirror-linenumbers {}\n.CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n}\n\n.CodeMirror-guttermarker { color: black; }\n.CodeMirror-guttermarker-subtle { color: #999; }\n\n/* CURSOR */\n\n.CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n}\n/* Shown when moving in bi-directional text */\n.CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n}\n.cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0 !important;\n background: #7e7;\n}\n.cm-fat-cursor div.CodeMirror-cursors {\n z-index: 1;\n}\n.cm-fat-cursor-mark {\n background-color: rgba(20, 255, 20, 0.5);\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n}\n.cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n}\n@-moz-keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n@-webkit-keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n@keyframes blink {\n 0% {}\n 50% { background-color: transparent; }\n 100% {}\n}\n\n/* Can style cursor different in overwrite (non-insert) mode */\n.CodeMirror-overwrite .CodeMirror-cursor {}\n\n.cm-tab { display: inline-block; text-decoration: inherit; }\n\n.CodeMirror-rulers {\n position: absolute;\n left: 0; right: 0; top: -50px; bottom: 0;\n overflow: hidden;\n}\n.CodeMirror-ruler {\n border-left: 1px solid #ccc;\n top: 0; bottom: 0;\n position: absolute;\n}\n\n/* DEFAULT THEME */\n\n.cm-s-default .cm-header {color: blue;}\n.cm-s-default .cm-quote {color: #090;}\n.cm-negative {color: #d44;}\n.cm-positive {color: #292;}\n.cm-header, .cm-strong {font-weight: bold;}\n.cm-em {font-style: italic;}\n.cm-link {text-decoration: underline;}\n.cm-strikethrough {text-decoration: line-through;}\n\n.cm-s-default .cm-keyword {color: #708;}\n.cm-s-default .cm-atom {color: #219;}\n.cm-s-default .cm-number {color: #164;}\n.cm-s-default .cm-def {color: #00f;}\n.cm-s-default .cm-variable,\n.cm-s-default .cm-punctuation,\n.cm-s-default .cm-property,\n.cm-s-default .cm-operator {}\n.cm-s-default .cm-variable-2 {color: #05a;}\n.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}\n.cm-s-default .cm-comment {color: #a50;}\n.cm-s-default .cm-string {color: #a11;}\n.cm-s-default .cm-string-2 {color: #f50;}\n.cm-s-default .cm-meta {color: #555;}\n.cm-s-default .cm-qualifier {color: #555;}\n.cm-s-default .cm-builtin {color: #30a;}\n.cm-s-default .cm-bracket {color: #997;}\n.cm-s-default .cm-tag {color: #170;}\n.cm-s-default .cm-attribute {color: #00c;}\n.cm-s-default .cm-hr {color: #999;}\n.cm-s-default .cm-link {color: #00c;}\n\n.cm-s-default .cm-error {color: #f00;}\n.cm-invalidchar {color: #f00;}\n\n.CodeMirror-composing { border-bottom: 2px solid; }\n\n/* Default styles for common addons */\n\ndiv.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}\ndiv.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}\n.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }\n.CodeMirror-activeline-background {background: #e8f2ff;}\n\n/* STOP */\n\n/* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n.CodeMirror {\n position: relative;\n overflow: hidden;\n background: white;\n}\n\n.CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 50px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -50px; margin-right: -50px;\n padding-bottom: 50px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n}\n.CodeMirror-sizer {\n position: relative;\n border-right: 50px solid transparent;\n}\n\n/* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 6;\n display: none;\n outline: none;\n}\n.CodeMirror-vscrollbar {\n right: 0; top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n}\n.CodeMirror-hscrollbar {\n bottom: 0; left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n}\n.CodeMirror-scrollbar-filler {\n right: 0; bottom: 0;\n}\n.CodeMirror-gutter-filler {\n left: 0; bottom: 0;\n}\n\n.CodeMirror-gutters {\n position: absolute; left: 0; top: 0;\n min-height: 100%;\n z-index: 3;\n}\n.CodeMirror-gutter {\n white-space: normal;\n height: 100%;\n display: inline-block;\n vertical-align: top;\n margin-bottom: -50px;\n}\n.CodeMirror-gutter-wrapper {\n position: absolute;\n z-index: 4;\n background: none !important;\n border: none !important;\n}\n.CodeMirror-gutter-background {\n position: absolute;\n top: 0; bottom: 0;\n z-index: 4;\n}\n.CodeMirror-gutter-elt {\n position: absolute;\n cursor: default;\n z-index: 4;\n}\n.CodeMirror-gutter-wrapper ::selection { background-color: transparent }\n.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }\n\n.CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n}\n.CodeMirror pre.CodeMirror-line,\n.CodeMirror pre.CodeMirror-line-like {\n /* Reset some styles that the rest of the page might have set */\n -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: inherit;\n color: inherit;\n z-index: 2;\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n}\n.CodeMirror-wrap pre.CodeMirror-line,\n.CodeMirror-wrap pre.CodeMirror-line-like {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: normal;\n}\n\n.CodeMirror-linebackground {\n position: absolute;\n left: 0; right: 0; top: 0; bottom: 0;\n z-index: 0;\n}\n\n.CodeMirror-linewidget {\n position: relative;\n z-index: 2;\n padding: 0.1px; /* Force widget margins to stay inside of the container */\n}\n\n.CodeMirror-widget {}\n\n.CodeMirror-rtl pre { direction: rtl; }\n\n.CodeMirror-code {\n outline: none;\n}\n\n/* Force content-box sizing for the elements where we expect it */\n.CodeMirror-scroll,\n.CodeMirror-sizer,\n.CodeMirror-gutter,\n.CodeMirror-gutters,\n.CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n}\n\n.CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n}\n\n.CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n}\n.CodeMirror-measure pre { position: static; }\n\ndiv.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n z-index: 3;\n}\ndiv.CodeMirror-dragcursors {\n visibility: visible;\n}\n\n.CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n}\n\n.CodeMirror-selected { background: #d9d9d9; }\n.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }\n.CodeMirror-crosshair { cursor: crosshair; }\n.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }\n.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }\n\n.cm-searching {\n background-color: #ffa;\n background-color: rgba(255, 255, 0, .4);\n}\n\n/* Used to force a border model for a node */\n.cm-force-border { padding-right: .1px; }\n\n@media print {\n /* Hide the cursor when printing */\n .CodeMirror div.CodeMirror-cursors {\n visibility: hidden;\n }\n}\n\n/* See issue #2901 */\n.cm-tab-wrap-hack:after { content: ''; }\n\n/* Help users use markselection to safely style text background */\nspan.CodeMirror-selectedtext { background: none; }\n"]}
inc/admin/WPTB_BuilderControls.js ADDED
@@ -0,0 +1,36895 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // modules are defined as an array
2
+ // [ module function, map of requires ]
3
+ //
4
+ // map of requires is short require name -> numeric require
5
+ //
6
+ // anything defined in a previous bundle is accessed via the
7
+ // orig method which is the require for previous bundles
8
+ parcelRequire = (function (modules, cache, entry, globalName) {
9
+ // Save the require from previous bundle to this closure if any
10
+ var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
11
+ var nodeRequire = typeof require === 'function' && require;
12
+
13
+ function newRequire(name, jumped) {
14
+ if (!cache[name]) {
15
+ if (!modules[name]) {
16
+ // if we cannot find the module within our internal map or
17
+ // cache jump to the current global require ie. the last bundle
18
+ // that was added to the page.
19
+ var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
20
+ if (!jumped && currentRequire) {
21
+ return currentRequire(name, true);
22
+ }
23
+
24
+ // If there are other bundles on this page the require from the
25
+ // previous one is saved to 'previousRequire'. Repeat this as
26
+ // many times as there are bundles until the module is found or
27
+ // we exhaust the require chain.
28
+ if (previousRequire) {
29
+ return previousRequire(name, true);
30
+ }
31
+
32
+ // Try the node require function if it exists.
33
+ if (nodeRequire && typeof name === 'string') {
34
+ return nodeRequire(name);
35
+ }
36
+
37
+ var err = new Error('Cannot find module \'' + name + '\'');
38
+ err.code = 'MODULE_NOT_FOUND';
39
+ throw err;
40
+ }
41
+
42
+ localRequire.resolve = resolve;
43
+ localRequire.cache = {};
44
+
45
+ var module = cache[name] = new newRequire.Module(name);
46
+
47
+ modules[name][0].call(module.exports, localRequire, module, module.exports, this);
48
+ }
49
+
50
+ return cache[name].exports;
51
+
52
+ function localRequire(x){
53
+ return newRequire(localRequire.resolve(x));
54
+ }
55
+
56
+ function resolve(x){
57
+ return modules[name][1][x] || x;
58
+ }
59
+ }
60
+
61
+ function Module(moduleName) {
62
+ this.id = moduleName;
63
+ this.bundle = newRequire;
64
+ this.exports = {};
65
+ }
66
+
67
+ newRequire.isParcelRequire = true;
68
+ newRequire.Module = Module;
69
+ newRequire.modules = modules;
70
+ newRequire.cache = cache;
71
+ newRequire.parent = previousRequire;
72
+ newRequire.register = function (id, exports) {
73
+ modules[id] = [function (require, module) {
74
+ module.exports = exports;
75
+ }, {}];
76
+ };
77
+
78
+ var error;
79
+ for (var i = 0; i < entry.length; i++) {
80
+ try {
81
+ newRequire(entry[i]);
82
+ } catch (e) {
83
+ // Save first error but execute all entries
84
+ if (!error) {
85
+ error = e;
86
+ }
87
+ }
88
+ }
89
+
90
+ if (entry.length) {
91
+ // Expose entry point to Node, AMD or browser globals
92
+ // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
93
+ var mainExports = newRequire(entry[entry.length - 1]);
94
+
95
+ // CommonJS
96
+ if (typeof exports === "object" && typeof module !== "undefined") {
97
+ module.exports = mainExports;
98
+
99
+ // RequireJS
100
+ } else if (typeof define === "function" && define.amd) {
101
+ define(function () {
102
+ return mainExports;
103
+ });
104
+
105
+ // <script>
106
+ } else if (globalName) {
107
+ this[globalName] = mainExports;
108
+ }
109
+ }
110
+
111
+ // Override the current require with this new one
112
+ parcelRequire = newRequire;
113
+
114
+ if (error) {
115
+ // throw error from earlier, _after updating parcelRequire_
116
+ throw error;
117
+ }
118
+
119
+ return newRequire;
120
+ })({"../../../../../node_modules/vue/dist/vue.esm.js":[function(require,module,exports) {
121
+ var global = arguments[3];
122
+ "use strict";
123
+
124
+ Object.defineProperty(exports, "__esModule", {
125
+ value: true
126
+ });
127
+ exports.default = void 0;
128
+
129
+ /*!
130
+ * Vue.js v2.6.11
131
+ * (c) 2014-2019 Evan You
132
+ * Released under the MIT License.
133
+ */
134
+
135
+ /* */
136
+ var emptyObject = Object.freeze({}); // These helpers produce better VM code in JS engines due to their
137
+ // explicitness and function inlining.
138
+
139
+ function isUndef(v) {
140
+ return v === undefined || v === null;
141
+ }
142
+
143
+ function isDef(v) {
144
+ return v !== undefined && v !== null;
145
+ }
146
+
147
+ function isTrue(v) {
148
+ return v === true;
149
+ }
150
+
151
+ function isFalse(v) {
152
+ return v === false;
153
+ }
154
+ /**
155
+ * Check if value is primitive.
156
+ */
157
+
158
+
159
+ function isPrimitive(value) {
160
+ return typeof value === 'string' || typeof value === 'number' || // $flow-disable-line
161
+ typeof value === 'symbol' || typeof value === 'boolean';
162
+ }
163
+ /**
164
+ * Quick object check - this is primarily used to tell
165
+ * Objects from primitive values when we know the value
166
+ * is a JSON-compliant type.
167
+ */
168
+
169
+
170
+ function isObject(obj) {
171
+ return obj !== null && typeof obj === 'object';
172
+ }
173
+ /**
174
+ * Get the raw type string of a value, e.g., [object Object].
175
+ */
176
+
177
+
178
+ var _toString = Object.prototype.toString;
179
+
180
+ function toRawType(value) {
181
+ return _toString.call(value).slice(8, -1);
182
+ }
183
+ /**
184
+ * Strict object type check. Only returns true
185
+ * for plain JavaScript objects.
186
+ */
187
+
188
+
189
+ function isPlainObject(obj) {
190
+ return _toString.call(obj) === '[object Object]';
191
+ }
192
+
193
+ function isRegExp(v) {
194
+ return _toString.call(v) === '[object RegExp]';
195
+ }
196
+ /**
197
+ * Check if val is a valid array index.
198
+ */
199
+
200
+
201
+ function isValidArrayIndex(val) {
202
+ var n = parseFloat(String(val));
203
+ return n >= 0 && Math.floor(n) === n && isFinite(val);
204
+ }
205
+
206
+ function isPromise(val) {
207
+ return isDef(val) && typeof val.then === 'function' && typeof val.catch === 'function';
208
+ }
209
+ /**
210
+ * Convert a value to a string that is actually rendered.
211
+ */
212
+
213
+
214
+ function toString(val) {
215
+ return val == null ? '' : Array.isArray(val) || isPlainObject(val) && val.toString === _toString ? JSON.stringify(val, null, 2) : String(val);
216
+ }
217
+ /**
218
+ * Convert an input value to a number for persistence.
219
+ * If the conversion fails, return original string.
220
+ */
221
+
222
+
223
+ function toNumber(val) {
224
+ var n = parseFloat(val);
225
+ return isNaN(n) ? val : n;
226
+ }
227
+ /**
228
+ * Make a map and return a function for checking if a key
229
+ * is in that map.
230
+ */
231
+
232
+
233
+ function makeMap(str, expectsLowerCase) {
234
+ var map = Object.create(null);
235
+ var list = str.split(',');
236
+
237
+ for (var i = 0; i < list.length; i++) {
238
+ map[list[i]] = true;
239
+ }
240
+
241
+ return expectsLowerCase ? function (val) {
242
+ return map[val.toLowerCase()];
243
+ } : function (val) {
244
+ return map[val];
245
+ };
246
+ }
247
+ /**
248
+ * Check if a tag is a built-in tag.
249
+ */
250
+
251
+
252
+ var isBuiltInTag = makeMap('slot,component', true);
253
+ /**
254
+ * Check if an attribute is a reserved attribute.
255
+ */
256
+
257
+ var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
258
+ /**
259
+ * Remove an item from an array.
260
+ */
261
+
262
+ function remove(arr, item) {
263
+ if (arr.length) {
264
+ var index = arr.indexOf(item);
265
+
266
+ if (index > -1) {
267
+ return arr.splice(index, 1);
268
+ }
269
+ }
270
+ }
271
+ /**
272
+ * Check whether an object has the property.
273
+ */
274
+
275
+
276
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
277
+
278
+ function hasOwn(obj, key) {
279
+ return hasOwnProperty.call(obj, key);
280
+ }
281
+ /**
282
+ * Create a cached version of a pure function.
283
+ */
284
+
285
+
286
+ function cached(fn) {
287
+ var cache = Object.create(null);
288
+ return function cachedFn(str) {
289
+ var hit = cache[str];
290
+ return hit || (cache[str] = fn(str));
291
+ };
292
+ }
293
+ /**
294
+ * Camelize a hyphen-delimited string.
295
+ */
296
+
297
+
298
+ var camelizeRE = /-(\w)/g;
299
+ var camelize = cached(function (str) {
300
+ return str.replace(camelizeRE, function (_, c) {
301
+ return c ? c.toUpperCase() : '';
302
+ });
303
+ });
304
+ /**
305
+ * Capitalize a string.
306
+ */
307
+
308
+ var capitalize = cached(function (str) {
309
+ return str.charAt(0).toUpperCase() + str.slice(1);
310
+ });
311
+ /**
312
+ * Hyphenate a camelCase string.
313
+ */
314
+
315
+ var hyphenateRE = /\B([A-Z])/g;
316
+ var hyphenate = cached(function (str) {
317
+ return str.replace(hyphenateRE, '-$1').toLowerCase();
318
+ });
319
+ /**
320
+ * Simple bind polyfill for environments that do not support it,
321
+ * e.g., PhantomJS 1.x. Technically, we don't need this anymore
322
+ * since native bind is now performant enough in most browsers.
323
+ * But removing it would mean breaking code that was able to run in
324
+ * PhantomJS 1.x, so this must be kept for backward compatibility.
325
+ */
326
+
327
+ /* istanbul ignore next */
328
+
329
+ function polyfillBind(fn, ctx) {
330
+ function boundFn(a) {
331
+ var l = arguments.length;
332
+ return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);
333
+ }
334
+
335
+ boundFn._length = fn.length;
336
+ return boundFn;
337
+ }
338
+
339
+ function nativeBind(fn, ctx) {
340
+ return fn.bind(ctx);
341
+ }
342
+
343
+ var bind = Function.prototype.bind ? nativeBind : polyfillBind;
344
+ /**
345
+ * Convert an Array-like object to a real Array.
346
+ */
347
+
348
+ function toArray(list, start) {
349
+ start = start || 0;
350
+ var i = list.length - start;
351
+ var ret = new Array(i);
352
+
353
+ while (i--) {
354
+ ret[i] = list[i + start];
355
+ }
356
+
357
+ return ret;
358
+ }
359
+ /**
360
+ * Mix properties into target object.
361
+ */
362
+
363
+
364
+ function extend(to, _from) {
365
+ for (var key in _from) {
366
+ to[key] = _from[key];
367
+ }
368
+
369
+ return to;
370
+ }
371
+ /**
372
+ * Merge an Array of Objects into a single Object.
373
+ */
374
+
375
+
376
+ function toObject(arr) {
377
+ var res = {};
378
+
379
+ for (var i = 0; i < arr.length; i++) {
380
+ if (arr[i]) {
381
+ extend(res, arr[i]);
382
+ }
383
+ }
384
+
385
+ return res;
386
+ }
387
+ /* eslint-disable no-unused-vars */
388
+
389
+ /**
390
+ * Perform no operation.
391
+ * Stubbing args to make Flow happy without leaving useless transpiled code
392
+ * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
393
+ */
394
+
395
+
396
+ function noop(a, b, c) {}
397
+ /**
398
+ * Always return false.
399
+ */
400
+
401
+
402
+ var no = function (a, b, c) {
403
+ return false;
404
+ };
405
+ /* eslint-enable no-unused-vars */
406
+
407
+ /**
408
+ * Return the same value.
409
+ */
410
+
411
+
412
+ var identity = function (_) {
413
+ return _;
414
+ };
415
+ /**
416
+ * Generate a string containing static keys from compiler modules.
417
+ */
418
+
419
+
420
+ function genStaticKeys(modules) {
421
+ return modules.reduce(function (keys, m) {
422
+ return keys.concat(m.staticKeys || []);
423
+ }, []).join(',');
424
+ }
425
+ /**
426
+ * Check if two values are loosely equal - that is,
427
+ * if they are plain objects, do they have the same shape?
428
+ */
429
+
430
+
431
+ function looseEqual(a, b) {
432
+ if (a === b) {
433
+ return true;
434
+ }
435
+
436
+ var isObjectA = isObject(a);
437
+ var isObjectB = isObject(b);
438
+
439
+ if (isObjectA && isObjectB) {
440
+ try {
441
+ var isArrayA = Array.isArray(a);
442
+ var isArrayB = Array.isArray(b);
443
+
444
+ if (isArrayA && isArrayB) {
445
+ return a.length === b.length && a.every(function (e, i) {
446
+ return looseEqual(e, b[i]);
447
+ });
448
+ } else if (a instanceof Date && b instanceof Date) {
449
+ return a.getTime() === b.getTime();
450
+ } else if (!isArrayA && !isArrayB) {
451
+ var keysA = Object.keys(a);
452
+ var keysB = Object.keys(b);
453
+ return keysA.length === keysB.length && keysA.every(function (key) {
454
+ return looseEqual(a[key], b[key]);
455
+ });
456
+ } else {
457
+ /* istanbul ignore next */
458
+ return false;
459
+ }
460
+ } catch (e) {
461
+ /* istanbul ignore next */
462
+ return false;
463
+ }
464
+ } else if (!isObjectA && !isObjectB) {
465
+ return String(a) === String(b);
466
+ } else {
467
+ return false;
468
+ }
469
+ }
470
+ /**
471
+ * Return the first index at which a loosely equal value can be
472
+ * found in the array (if value is a plain object, the array must
473
+ * contain an object of the same shape), or -1 if it is not present.
474
+ */
475
+
476
+
477
+ function looseIndexOf(arr, val) {
478
+ for (var i = 0; i < arr.length; i++) {
479
+ if (looseEqual(arr[i], val)) {
480
+ return i;
481
+ }
482
+ }
483
+
484
+ return -1;
485
+ }
486
+ /**
487
+ * Ensure a function is called only once.
488
+ */
489
+
490
+
491
+ function once(fn) {
492
+ var called = false;
493
+ return function () {
494
+ if (!called) {
495
+ called = true;
496
+ fn.apply(this, arguments);
497
+ }
498
+ };
499
+ }
500
+
501
+ var SSR_ATTR = 'data-server-rendered';
502
+ var ASSET_TYPES = ['component', 'directive', 'filter'];
503
+ var LIFECYCLE_HOOKS = ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'activated', 'deactivated', 'errorCaptured', 'serverPrefetch'];
504
+ /* */
505
+
506
+ var config = {
507
+ /**
508
+ * Option merge strategies (used in core/util/options)
509
+ */
510
+ // $flow-disable-line
511
+ optionMergeStrategies: Object.create(null),
512
+
513
+ /**
514
+ * Whether to suppress warnings.
515
+ */
516
+ silent: false,
517
+
518
+ /**
519
+ * Show production mode tip message on boot?
520
+ */
521
+ productionTip: "development" !== 'production',
522
+
523
+ /**
524
+ * Whether to enable devtools
525
+ */
526
+ devtools: "development" !== 'production',
527
+
528
+ /**
529
+ * Whether to record perf
530
+ */
531
+ performance: false,
532
+
533
+ /**
534
+ * Error handler for watcher errors
535
+ */
536
+ errorHandler: null,
537
+
538
+ /**
539
+ * Warn handler for watcher warns
540
+ */
541
+ warnHandler: null,
542
+
543
+ /**
544
+ * Ignore certain custom elements
545
+ */
546
+ ignoredElements: [],
547
+
548
+ /**
549
+ * Custom user key aliases for v-on
550
+ */
551
+ // $flow-disable-line
552
+ keyCodes: Object.create(null),
553
+
554
+ /**
555
+ * Check if a tag is reserved so that it cannot be registered as a
556
+ * component. This is platform-dependent and may be overwritten.
557
+ */
558
+ isReservedTag: no,
559
+
560
+ /**
561
+ * Check if an attribute is reserved so that it cannot be used as a component
562
+ * prop. This is platform-dependent and may be overwritten.
563
+ */
564
+ isReservedAttr: no,
565
+
566
+ /**
567
+ * Check if a tag is an unknown element.
568
+ * Platform-dependent.
569
+ */
570
+ isUnknownElement: no,
571
+
572
+ /**
573
+ * Get the namespace of an element
574
+ */
575
+ getTagNamespace: noop,
576
+
577
+ /**
578
+ * Parse the real tag name for the specific platform.
579
+ */
580
+ parsePlatformTagName: identity,
581
+
582
+ /**
583
+ * Check if an attribute must be bound using property, e.g. value
584
+ * Platform-dependent.
585
+ */
586
+ mustUseProp: no,
587
+
588
+ /**
589
+ * Perform updates asynchronously. Intended to be used by Vue Test Utils
590
+ * This will significantly reduce performance if set to false.
591
+ */
592
+ async: true,
593
+
594
+ /**
595
+ * Exposed for legacy reasons
596
+ */
597
+ _lifecycleHooks: LIFECYCLE_HOOKS
598
+ };
599
+ /* */
600
+
601
+ /**
602
+ * unicode letters used for parsing html tags, component names and property paths.
603
+ * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
604
+ * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
605
+ */
606
+
607
+ var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
608
+ /**
609
+ * Check if a string starts with $ or _
610
+ */
611
+
612
+ function isReserved(str) {
613
+ var c = (str + '').charCodeAt(0);
614
+ return c === 0x24 || c === 0x5F;
615
+ }
616
+ /**
617
+ * Define a property.
618
+ */
619
+
620
+
621
+ function def(obj, key, val, enumerable) {
622
+ Object.defineProperty(obj, key, {
623
+ value: val,
624
+ enumerable: !!enumerable,
625
+ writable: true,
626
+ configurable: true
627
+ });
628
+ }
629
+ /**
630
+ * Parse simple path.
631
+ */
632
+
633
+
634
+ var bailRE = new RegExp("[^" + unicodeRegExp.source + ".$_\\d]");
635
+
636
+ function parsePath(path) {
637
+ if (bailRE.test(path)) {
638
+ return;
639
+ }
640
+
641
+ var segments = path.split('.');
642
+ return function (obj) {
643
+ for (var i = 0; i < segments.length; i++) {
644
+ if (!obj) {
645
+ return;
646
+ }
647
+
648
+ obj = obj[segments[i]];
649
+ }
650
+
651
+ return obj;
652
+ };
653
+ }
654
+ /* */
655
+ // can we use __proto__?
656
+
657
+
658
+ var hasProto = ('__proto__' in {}); // Browser environment sniffing
659
+
660
+ var inBrowser = typeof window !== 'undefined';
661
+ var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
662
+ var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
663
+ var UA = inBrowser && window.navigator.userAgent.toLowerCase();
664
+ var isIE = UA && /msie|trident/.test(UA);
665
+ var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
666
+ var isEdge = UA && UA.indexOf('edge/') > 0;
667
+ var isAndroid = UA && UA.indexOf('android') > 0 || weexPlatform === 'android';
668
+ var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA) || weexPlatform === 'ios';
669
+ var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
670
+ var isPhantomJS = UA && /phantomjs/.test(UA);
671
+ var isFF = UA && UA.match(/firefox\/(\d+)/); // Firefox has a "watch" function on Object.prototype...
672
+
673
+ var nativeWatch = {}.watch;
674
+ var supportsPassive = false;
675
+
676
+ if (inBrowser) {
677
+ try {
678
+ var opts = {};
679
+ Object.defineProperty(opts, 'passive', {
680
+ get: function get() {
681
+ /* istanbul ignore next */
682
+ supportsPassive = true;
683
+ }
684
+ }); // https://github.com/facebook/flow/issues/285
685
+
686
+ window.addEventListener('test-passive', null, opts);
687
+ } catch (e) {}
688
+ } // this needs to be lazy-evaled because vue may be required before
689
+ // vue-server-renderer can set VUE_ENV
690
+
691
+
692
+ var _isServer;
693
+
694
+ var isServerRendering = function () {
695
+ if (_isServer === undefined) {
696
+ /* istanbul ignore if */
697
+ if (!inBrowser && !inWeex && typeof global !== 'undefined') {
698
+ // detect presence of vue-server-renderer and avoid
699
+ // Webpack shimming the process
700
+ _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
701
+ } else {
702
+ _isServer = false;
703
+ }
704
+ }
705
+
706
+ return _isServer;
707
+ }; // detect devtools
708
+
709
+
710
+ var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
711
+ /* istanbul ignore next */
712
+
713
+ function isNative(Ctor) {
714
+ return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
715
+ }
716
+
717
+ var hasSymbol = typeof Symbol !== 'undefined' && isNative(Symbol) && typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
718
+
719
+ var _Set;
720
+ /* istanbul ignore if */
721
+ // $flow-disable-line
722
+
723
+
724
+ if (typeof Set !== 'undefined' && isNative(Set)) {
725
+ // use native Set when available.
726
+ _Set = Set;
727
+ } else {
728
+ // a non-standard Set polyfill that only works with primitive keys.
729
+ _Set = /*@__PURE__*/function () {
730
+ function Set() {
731
+ this.set = Object.create(null);
732
+ }
733
+
734
+ Set.prototype.has = function has(key) {
735
+ return this.set[key] === true;
736
+ };
737
+
738
+ Set.prototype.add = function add(key) {
739
+ this.set[key] = true;
740
+ };
741
+
742
+ Set.prototype.clear = function clear() {
743
+ this.set = Object.create(null);
744
+ };
745
+
746
+ return Set;
747
+ }();
748
+ }
749
+ /* */
750
+
751
+
752
+ var warn = noop;
753
+ var tip = noop;
754
+ var generateComponentTrace = noop; // work around flow check
755
+
756
+ var formatComponentName = noop;
757
+
758
+ if ("development" !== 'production') {
759
+ var hasConsole = typeof console !== 'undefined';
760
+ var classifyRE = /(?:^|[-_])(\w)/g;
761
+
762
+ var classify = function (str) {
763
+ return str.replace(classifyRE, function (c) {
764
+ return c.toUpperCase();
765
+ }).replace(/[-_]/g, '');
766
+ };
767
+
768
+ warn = function (msg, vm) {
769
+ var trace = vm ? generateComponentTrace(vm) : '';
770
+
771
+ if (config.warnHandler) {
772
+ config.warnHandler.call(null, msg, vm, trace);
773
+ } else if (hasConsole && !config.silent) {
774
+ console.error("[Vue warn]: " + msg + trace);
775
+ }
776
+ };
777
+
778
+ tip = function (msg, vm) {
779
+ if (hasConsole && !config.silent) {
780
+ console.warn("[Vue tip]: " + msg + (vm ? generateComponentTrace(vm) : ''));
781
+ }
782
+ };
783
+
784
+ formatComponentName = function (vm, includeFile) {
785
+ if (vm.$root === vm) {
786
+ return '<Root>';
787
+ }
788
+
789
+ var options = typeof vm === 'function' && vm.cid != null ? vm.options : vm._isVue ? vm.$options || vm.constructor.options : vm;
790
+ var name = options.name || options._componentTag;
791
+ var file = options.__file;
792
+
793
+ if (!name && file) {
794
+ var match = file.match(/([^/\\]+)\.vue$/);
795
+ name = match && match[1];
796
+ }
797
+
798
+ return (name ? "<" + classify(name) + ">" : "<Anonymous>") + (file && includeFile !== false ? " at " + file : '');
799
+ };
800
+
801
+ var repeat = function (str, n) {
802
+ var res = '';
803
+
804
+ while (n) {
805
+ if (n % 2 === 1) {
806
+ res += str;
807
+ }
808
+
809
+ if (n > 1) {
810
+ str += str;
811
+ }
812
+
813
+ n >>= 1;
814
+ }
815
+
816
+ return res;
817
+ };
818
+
819
+ generateComponentTrace = function (vm) {
820
+ if (vm._isVue && vm.$parent) {
821
+ var tree = [];
822
+ var currentRecursiveSequence = 0;
823
+
824
+ while (vm) {
825
+ if (tree.length > 0) {
826
+ var last = tree[tree.length - 1];
827
+
828
+ if (last.constructor === vm.constructor) {
829
+ currentRecursiveSequence++;
830
+ vm = vm.$parent;
831
+ continue;
832
+ } else if (currentRecursiveSequence > 0) {
833
+ tree[tree.length - 1] = [last, currentRecursiveSequence];
834
+ currentRecursiveSequence = 0;
835
+ }
836
+ }
837
+
838
+ tree.push(vm);
839
+ vm = vm.$parent;
840
+ }
841
+
842
+ return '\n\nfound in\n\n' + tree.map(function (vm, i) {
843
+ return "" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm) ? formatComponentName(vm[0]) + "... (" + vm[1] + " recursive calls)" : formatComponentName(vm));
844
+ }).join('\n');
845
+ } else {
846
+ return "\n\n(found in " + formatComponentName(vm) + ")";
847
+ }
848
+ };
849
+ }
850
+ /* */
851
+
852
+
853
+ var uid = 0;
854
+ /**
855
+ * A dep is an observable that can have multiple
856
+ * directives subscribing to it.
857
+ */
858
+
859
+ var Dep = function Dep() {
860
+ this.id = uid++;
861
+ this.subs = [];
862
+ };
863
+
864
+ Dep.prototype.addSub = function addSub(sub) {
865
+ this.subs.push(sub);
866
+ };
867
+
868
+ Dep.prototype.removeSub = function removeSub(sub) {
869
+ remove(this.subs, sub);
870
+ };
871
+
872
+ Dep.prototype.depend = function depend() {
873
+ if (Dep.target) {
874
+ Dep.target.addDep(this);
875
+ }
876
+ };
877
+
878
+ Dep.prototype.notify = function notify() {
879
+ // stabilize the subscriber list first
880
+ var subs = this.subs.slice();
881
+
882
+ if ("development" !== 'production' && !config.async) {
883
+ // subs aren't sorted in scheduler if not running async
884
+ // we need to sort them now to make sure they fire in correct
885
+ // order
886
+ subs.sort(function (a, b) {
887
+ return a.id - b.id;
888
+ });
889
+ }
890
+
891
+ for (var i = 0, l = subs.length; i < l; i++) {
892
+ subs[i].update();
893
+ }
894
+ }; // The current target watcher being evaluated.
895
+ // This is globally unique because only one watcher
896
+ // can be evaluated at a time.
897
+
898
+
899
+ Dep.target = null;
900
+ var targetStack = [];
901
+
902
+ function pushTarget(target) {
903
+ targetStack.push(target);
904
+ Dep.target = target;
905
+ }
906
+
907
+ function popTarget() {
908
+ targetStack.pop();
909
+ Dep.target = targetStack[targetStack.length - 1];
910
+ }
911
+ /* */
912
+
913
+
914
+ var VNode = function VNode(tag, data, children, text, elm, context, componentOptions, asyncFactory) {
915
+ this.tag = tag;
916
+ this.data = data;
917
+ this.children = children;
918
+ this.text = text;
919
+ this.elm = elm;
920
+ this.ns = undefined;
921
+ this.context = context;
922
+ this.fnContext = undefined;
923
+ this.fnOptions = undefined;
924
+ this.fnScopeId = undefined;
925
+ this.key = data && data.key;
926
+ this.componentOptions = componentOptions;
927
+ this.componentInstance = undefined;
928
+ this.parent = undefined;
929
+ this.raw = false;
930
+ this.isStatic = false;
931
+ this.isRootInsert = true;
932
+ this.isComment = false;
933
+ this.isCloned = false;
934
+ this.isOnce = false;
935
+ this.asyncFactory = asyncFactory;
936
+ this.asyncMeta = undefined;
937
+ this.isAsyncPlaceholder = false;
938
+ };
939
+
940
+ var prototypeAccessors = {
941
+ child: {
942
+ configurable: true
943
+ }
944
+ }; // DEPRECATED: alias for componentInstance for backwards compat.
945
+
946
+ /* istanbul ignore next */
947
+
948
+ prototypeAccessors.child.get = function () {
949
+ return this.componentInstance;
950
+ };
951
+
952
+ Object.defineProperties(VNode.prototype, prototypeAccessors);
953
+
954
+ var createEmptyVNode = function (text) {
955
+ if (text === void 0) text = '';
956
+ var node = new VNode();
957
+ node.text = text;
958
+ node.isComment = true;
959
+ return node;
960
+ };
961
+
962
+ function createTextVNode(val) {
963
+ return new VNode(undefined, undefined, undefined, String(val));
964
+ } // optimized shallow clone
965
+ // used for static nodes and slot nodes because they may be reused across
966
+ // multiple renders, cloning them avoids errors when DOM manipulations rely
967
+ // on their elm reference.
968
+
969
+
970
+ function cloneVNode(vnode) {
971
+ var cloned = new VNode(vnode.tag, vnode.data, // #7975
972
+ // clone children array to avoid mutating original in case of cloning
973
+ // a child.
974
+ vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);
975
+ cloned.ns = vnode.ns;
976
+ cloned.isStatic = vnode.isStatic;
977
+ cloned.key = vnode.key;
978
+ cloned.isComment = vnode.isComment;
979
+ cloned.fnContext = vnode.fnContext;
980
+ cloned.fnOptions = vnode.fnOptions;
981
+ cloned.fnScopeId = vnode.fnScopeId;
982
+ cloned.asyncMeta = vnode.asyncMeta;
983
+ cloned.isCloned = true;
984
+ return cloned;
985
+ }
986
+ /*
987
+ * not type checking this file because flow doesn't play well with
988
+ * dynamically accessing methods on Array prototype
989
+ */
990
+
991
+
992
+ var arrayProto = Array.prototype;
993
+ var arrayMethods = Object.create(arrayProto);
994
+ var methodsToPatch = ['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'];
995
+ /**
996
+ * Intercept mutating methods and emit events
997
+ */
998
+
999
+ methodsToPatch.forEach(function (method) {
1000
+ // cache original method
1001
+ var original = arrayProto[method];
1002
+ def(arrayMethods, method, function mutator() {
1003
+ var args = [],
1004
+ len = arguments.length;
1005
+
1006
+ while (len--) args[len] = arguments[len];
1007
+
1008
+ var result = original.apply(this, args);
1009
+ var ob = this.__ob__;
1010
+ var inserted;
1011
+
1012
+ switch (method) {
1013
+ case 'push':
1014
+ case 'unshift':
1015
+ inserted = args;
1016
+ break;
1017
+
1018
+ case 'splice':
1019
+ inserted = args.slice(2);
1020
+ break;
1021
+ }
1022
+
1023
+ if (inserted) {
1024
+ ob.observeArray(inserted);
1025
+ } // notify change
1026
+
1027
+
1028
+ ob.dep.notify();
1029
+ return result;
1030
+ });
1031
+ });
1032
+ /* */
1033
+
1034
+ var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
1035
+ /**
1036
+ * In some cases we may want to disable observation inside a component's
1037
+ * update computation.
1038
+ */
1039
+
1040
+ var shouldObserve = true;
1041
+
1042
+ function toggleObserving(value) {
1043
+ shouldObserve = value;
1044
+ }
1045
+ /**
1046
+ * Observer class that is attached to each observed
1047
+ * object. Once attached, the observer converts the target
1048
+ * object's property keys into getter/setters that
1049
+ * collect dependencies and dispatch updates.
1050
+ */
1051
+
1052
+
1053
+ var Observer = function Observer(value) {
1054
+ this.value = value;
1055
+ this.dep = new Dep();
1056
+ this.vmCount = 0;
1057
+ def(value, '__ob__', this);
1058
+
1059
+ if (Array.isArray(value)) {
1060
+ if (hasProto) {
1061
+ protoAugment(value, arrayMethods);
1062
+ } else {
1063
+ copyAugment(value, arrayMethods, arrayKeys);
1064
+ }
1065
+
1066
+ this.observeArray(value);
1067
+ } else {
1068
+ this.walk(value);
1069
+ }
1070
+ };
1071
+ /**
1072
+ * Walk through all properties and convert them into
1073
+ * getter/setters. This method should only be called when
1074
+ * value type is Object.
1075
+ */
1076
+
1077
+
1078
+ Observer.prototype.walk = function walk(obj) {
1079
+ var keys = Object.keys(obj);
1080
+
1081
+ for (var i = 0; i < keys.length; i++) {
1082
+ defineReactive$$1(obj, keys[i]);
1083
+ }
1084
+ };
1085
+ /**
1086
+ * Observe a list of Array items.
1087
+ */
1088
+
1089
+
1090
+ Observer.prototype.observeArray = function observeArray(items) {
1091
+ for (var i = 0, l = items.length; i < l; i++) {
1092
+ observe(items[i]);
1093
+ }
1094
+ }; // helpers
1095
+
1096
+ /**
1097
+ * Augment a target Object or Array by intercepting
1098
+ * the prototype chain using __proto__
1099
+ */
1100
+
1101
+
1102
+ function protoAugment(target, src) {
1103
+ /* eslint-disable no-proto */
1104
+ target.__proto__ = src;
1105
+ /* eslint-enable no-proto */
1106
+ }
1107
+ /**
1108
+ * Augment a target Object or Array by defining
1109
+ * hidden properties.
1110
+ */
1111
+
1112
+ /* istanbul ignore next */
1113
+
1114
+
1115
+ function copyAugment(target, src, keys) {
1116
+ for (var i = 0, l = keys.length; i < l; i++) {
1117
+ var key = keys[i];
1118
+ def(target, key, src[key]);
1119
+ }
1120
+ }
1121
+ /**
1122
+ * Attempt to create an observer instance for a value,
1123
+ * returns the new observer if successfully observed,
1124
+ * or the existing observer if the value already has one.
1125
+ */
1126
+
1127
+
1128
+ function observe(value, asRootData) {
1129
+ if (!isObject(value) || value instanceof VNode) {
1130
+ return;
1131
+ }
1132
+
1133
+ var ob;
1134
+
1135
+ if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
1136
+ ob = value.__ob__;
1137
+ } else if (shouldObserve && !isServerRendering() && (Array.isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {
1138
+ ob = new Observer(value);
1139
+ }
1140
+
1141
+ if (asRootData && ob) {
1142
+ ob.vmCount++;
1143
+ }
1144
+
1145
+ return ob;
1146
+ }
1147
+ /**
1148
+ * Define a reactive property on an Object.
1149
+ */
1150
+
1151
+
1152
+ function defineReactive$$1(obj, key, val, customSetter, shallow) {
1153
+ var dep = new Dep();
1154
+ var property = Object.getOwnPropertyDescriptor(obj, key);
1155
+
1156
+ if (property && property.configurable === false) {
1157
+ return;
1158
+ } // cater for pre-defined getter/setters
1159
+
1160
+
1161
+ var getter = property && property.get;
1162
+ var setter = property && property.set;
1163
+
1164
+ if ((!getter || setter) && arguments.length === 2) {
1165
+ val = obj[key];
1166
+ }
1167
+
1168
+ var childOb = !shallow && observe(val);
1169
+ Object.defineProperty(obj, key, {
1170
+ enumerable: true,
1171
+ configurable: true,
1172
+ get: function reactiveGetter() {
1173
+ var value = getter ? getter.call(obj) : val;
1174
+
1175
+ if (Dep.target) {
1176
+ dep.depend();
1177
+
1178
+ if (childOb) {
1179
+ childOb.dep.depend();
1180
+
1181
+ if (Array.isArray(value)) {
1182
+ dependArray(value);
1183
+ }
1184
+ }
1185
+ }
1186
+
1187
+ return value;
1188
+ },
1189
+ set: function reactiveSetter(newVal) {
1190
+ var value = getter ? getter.call(obj) : val;
1191
+ /* eslint-disable no-self-compare */
1192
+
1193
+ if (newVal === value || newVal !== newVal && value !== value) {
1194
+ return;
1195
+ }
1196
+ /* eslint-enable no-self-compare */
1197
+
1198
+
1199
+ if ("development" !== 'production' && customSetter) {
1200
+ customSetter();
1201
+ } // #7981: for accessor properties without setter
1202
+
1203
+
1204
+ if (getter && !setter) {
1205
+ return;
1206
+ }
1207
+
1208
+ if (setter) {
1209
+ setter.call(obj, newVal);
1210
+ } else {
1211
+ val = newVal;
1212
+ }
1213
+
1214
+ childOb = !shallow && observe(newVal);
1215
+ dep.notify();
1216
+ }
1217
+ });
1218
+ }
1219
+ /**
1220
+ * Set a property on an object. Adds the new property and
1221
+ * triggers change notification if the property doesn't
1222
+ * already exist.
1223
+ */
1224
+
1225
+
1226
+ function set(target, key, val) {
1227
+ if ("development" !== 'production' && (isUndef(target) || isPrimitive(target))) {
1228
+ warn("Cannot set reactive property on undefined, null, or primitive value: " + target);
1229
+ }
1230
+
1231
+ if (Array.isArray(target) && isValidArrayIndex(key)) {
1232
+ target.length = Math.max(target.length, key);
1233
+ target.splice(key, 1, val);
1234
+ return val;
1235
+ }
1236
+
1237
+ if (key in target && !(key in Object.prototype)) {
1238
+ target[key] = val;
1239
+ return val;
1240
+ }
1241
+
1242
+ var ob = target.__ob__;
1243
+
1244
+ if (target._isVue || ob && ob.vmCount) {
1245
+ "development" !== 'production' && warn('Avoid adding reactive properties to a Vue instance or its root $data ' + 'at runtime - declare it upfront in the data option.');
1246
+ return val;
1247
+ }
1248
+
1249
+ if (!ob) {
1250
+ target[key] = val;
1251
+ return val;
1252
+ }
1253
+
1254
+ defineReactive$$1(ob.value, key, val);
1255
+ ob.dep.notify();
1256
+ return val;
1257
+ }
1258
+ /**
1259
+ * Delete a property and trigger change if necessary.
1260
+ */
1261
+
1262
+
1263
+ function del(target, key) {
1264
+ if ("development" !== 'production' && (isUndef(target) || isPrimitive(target))) {
1265
+ warn("Cannot delete reactive property on undefined, null, or primitive value: " + target);
1266
+ }
1267
+
1268
+ if (Array.isArray(target) && isValidArrayIndex(key)) {
1269
+ target.splice(key, 1);
1270
+ return;
1271
+ }
1272
+
1273
+ var ob = target.__ob__;
1274
+
1275
+ if (target._isVue || ob && ob.vmCount) {
1276
+ "development" !== 'production' && warn('Avoid deleting properties on a Vue instance or its root $data ' + '- just set it to null.');
1277
+ return;
1278
+ }
1279
+
1280
+ if (!hasOwn(target, key)) {
1281
+ return;
1282
+ }
1283
+
1284
+ delete target[key];
1285
+
1286
+ if (!ob) {
1287
+ return;
1288
+ }
1289
+
1290
+ ob.dep.notify();
1291
+ }
1292
+ /**
1293
+ * Collect dependencies on array elements when the array is touched, since
1294
+ * we cannot intercept array element access like property getters.
1295
+ */
1296
+
1297
+
1298
+ function dependArray(value) {
1299
+ for (var e = void 0, i = 0, l = value.length; i < l; i++) {
1300
+ e = value[i];
1301
+ e && e.__ob__ && e.__ob__.dep.depend();
1302
+
1303
+ if (Array.isArray(e)) {
1304
+ dependArray(e);
1305
+ }
1306
+ }
1307
+ }
1308
+ /* */
1309
+
1310
+ /**
1311
+ * Option overwriting strategies are functions that handle
1312
+ * how to merge a parent option value and a child option
1313
+ * value into the final value.
1314
+ */
1315
+
1316
+
1317
+ var strats = config.optionMergeStrategies;
1318
+ /**
1319
+ * Options with restrictions
1320
+ */
1321
+
1322
+ if ("development" !== 'production') {
1323
+ strats.el = strats.propsData = function (parent, child, vm, key) {
1324
+ if (!vm) {
1325
+ warn("option \"" + key + "\" can only be used during instance " + 'creation with the `new` keyword.');
1326
+ }
1327
+
1328
+ return defaultStrat(parent, child);
1329
+ };
1330
+ }
1331
+ /**
1332
+ * Helper that recursively merges two data objects together.
1333
+ */
1334
+
1335
+
1336
+ function mergeData(to, from) {
1337
+ if (!from) {
1338
+ return to;
1339
+ }
1340
+
1341
+ var key, toVal, fromVal;
1342
+ var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);
1343
+
1344
+ for (var i = 0; i < keys.length; i++) {
1345
+ key = keys[i]; // in case the object is already observed...
1346
+
1347
+ if (key === '__ob__') {
1348
+ continue;
1349
+ }
1350
+
1351
+ toVal = to[key];
1352
+ fromVal = from[key];
1353
+
1354
+ if (!hasOwn(to, key)) {
1355
+ set(to, key, fromVal);
1356
+ } else if (toVal !== fromVal && isPlainObject(toVal) && isPlainObject(fromVal)) {
1357
+ mergeData(toVal, fromVal);
1358
+ }
1359
+ }
1360
+
1361
+ return to;
1362
+ }
1363
+ /**
1364
+ * Data
1365
+ */
1366
+
1367
+
1368
+ function mergeDataOrFn(parentVal, childVal, vm) {
1369
+ if (!vm) {
1370
+ // in a Vue.extend merge, both should be functions
1371
+ if (!childVal) {
1372
+ return parentVal;
1373
+ }
1374
+
1375
+ if (!parentVal) {
1376
+ return childVal;
1377
+ } // when parentVal & childVal are both present,
1378
+ // we need to return a function that returns the
1379
+ // merged result of both functions... no need to
1380
+ // check if parentVal is a function here because
1381
+ // it has to be a function to pass previous merges.
1382
+
1383
+
1384
+ return function mergedDataFn() {
1385
+ return mergeData(typeof childVal === 'function' ? childVal.call(this, this) : childVal, typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal);
1386
+ };
1387
+ } else {
1388
+ return function mergedInstanceDataFn() {
1389
+ // instance merge
1390
+ var instanceData = typeof childVal === 'function' ? childVal.call(vm, vm) : childVal;
1391
+ var defaultData = typeof parentVal === 'function' ? parentVal.call(vm, vm) : parentVal;
1392
+
1393
+ if (instanceData) {
1394
+ return mergeData(instanceData, defaultData);
1395
+ } else {
1396
+ return defaultData;
1397
+ }
1398
+ };
1399
+ }
1400
+ }
1401
+
1402
+ strats.data = function (parentVal, childVal, vm) {
1403
+ if (!vm) {
1404
+ if (childVal && typeof childVal !== 'function') {
1405
+ "development" !== 'production' && warn('The "data" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.', vm);
1406
+ return parentVal;
1407
+ }
1408
+
1409
+ return mergeDataOrFn(parentVal, childVal);
1410
+ }
1411
+
1412
+ return mergeDataOrFn(parentVal, childVal, vm);
1413
+ };
1414
+ /**
1415
+ * Hooks and props are merged as arrays.
1416
+ */
1417
+
1418
+
1419
+ function mergeHook(parentVal, childVal) {
1420
+ var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
1421
+ return res ? dedupeHooks(res) : res;
1422
+ }
1423
+
1424
+ function dedupeHooks(hooks) {
1425
+ var res = [];
1426
+
1427
+ for (var i = 0; i < hooks.length; i++) {
1428
+ if (res.indexOf(hooks[i]) === -1) {
1429
+ res.push(hooks[i]);
1430
+ }
1431
+ }
1432
+
1433
+ return res;
1434
+ }
1435
+
1436
+ LIFECYCLE_HOOKS.forEach(function (hook) {
1437
+ strats[hook] = mergeHook;
1438
+ });
1439
+ /**
1440
+ * Assets
1441
+ *
1442
+ * When a vm is present (instance creation), we need to do
1443
+ * a three-way merge between constructor options, instance
1444
+ * options and parent options.
1445
+ */
1446
+
1447
+ function mergeAssets(parentVal, childVal, vm, key) {
1448
+ var res = Object.create(parentVal || null);
1449
+
1450
+ if (childVal) {
1451
+ "development" !== 'production' && assertObjectType(key, childVal, vm);
1452
+ return extend(res, childVal);
1453
+ } else {
1454
+ return res;
1455
+ }
1456
+ }
1457
+
1458
+ ASSET_TYPES.forEach(function (type) {
1459
+ strats[type + 's'] = mergeAssets;
1460
+ });
1461
+ /**
1462
+ * Watchers.
1463
+ *
1464
+ * Watchers hashes should not overwrite one
1465
+ * another, so we merge them as arrays.
1466
+ */
1467
+
1468
+ strats.watch = function (parentVal, childVal, vm, key) {
1469
+ // work around Firefox's Object.prototype.watch...
1470
+ if (parentVal === nativeWatch) {
1471
+ parentVal = undefined;
1472
+ }
1473
+
1474
+ if (childVal === nativeWatch) {
1475
+ childVal = undefined;
1476
+ }
1477
+ /* istanbul ignore if */
1478
+
1479
+
1480
+ if (!childVal) {
1481
+ return Object.create(parentVal || null);
1482
+ }
1483
+
1484
+ if ("development" !== 'production') {
1485
+ assertObjectType(key, childVal, vm);
1486
+ }
1487
+
1488
+ if (!parentVal) {
1489
+ return childVal;
1490
+ }
1491
+
1492
+ var ret = {};
1493
+ extend(ret, parentVal);
1494
+
1495
+ for (var key$1 in childVal) {
1496
+ var parent = ret[key$1];
1497
+ var child = childVal[key$1];
1498
+
1499
+ if (parent && !Array.isArray(parent)) {
1500
+ parent = [parent];
1501
+ }
1502
+
1503
+ ret[key$1] = parent ? parent.concat(child) : Array.isArray(child) ? child : [child];
1504
+ }
1505
+
1506
+ return ret;
1507
+ };
1508
+ /**
1509
+ * Other object hashes.
1510
+ */
1511
+
1512
+
1513
+ strats.props = strats.methods = strats.inject = strats.computed = function (parentVal, childVal, vm, key) {
1514
+ if (childVal && "development" !== 'production') {
1515
+ assertObjectType(key, childVal, vm);
1516
+ }
1517
+
1518
+ if (!parentVal) {
1519
+ return childVal;
1520
+ }
1521
+
1522
+ var ret = Object.create(null);
1523
+ extend(ret, parentVal);
1524
+
1525
+ if (childVal) {
1526
+ extend(ret, childVal);
1527
+ }
1528
+
1529
+ return ret;
1530
+ };
1531
+
1532
+ strats.provide = mergeDataOrFn;
1533
+ /**
1534
+ * Default strategy.
1535
+ */
1536
+
1537
+ var defaultStrat = function (parentVal, childVal) {
1538
+ return childVal === undefined ? parentVal : childVal;
1539
+ };
1540
+ /**
1541
+ * Validate component names
1542
+ */
1543
+
1544
+
1545
+ function checkComponents(options) {
1546
+ for (var key in options.components) {
1547
+ validateComponentName(key);
1548
+ }
1549
+ }
1550
+
1551
+ function validateComponentName(name) {
1552
+ if (!new RegExp("^[a-zA-Z][\\-\\.0-9_" + unicodeRegExp.source + "]*$").test(name)) {
1553
+ warn('Invalid component name: "' + name + '". Component names ' + 'should conform to valid custom element name in html5 specification.');
1554
+ }
1555
+
1556
+ if (isBuiltInTag(name) || config.isReservedTag(name)) {
1557
+ warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + name);
1558
+ }
1559
+ }
1560
+ /**
1561
+ * Ensure all props option syntax are normalized into the
1562
+ * Object-based format.
1563
+ */
1564
+
1565
+
1566
+ function normalizeProps(options, vm) {
1567
+ var props = options.props;
1568
+
1569
+ if (!props) {
1570
+ return;
1571
+ }
1572
+
1573
+ var res = {};
1574
+ var i, val, name;
1575
+
1576
+ if (Array.isArray(props)) {
1577
+ i = props.length;
1578
+
1579
+ while (i--) {
1580
+ val = props[i];
1581
+
1582
+ if (typeof val === 'string') {
1583
+ name = camelize(val);
1584
+ res[name] = {
1585
+ type: null
1586
+ };
1587
+ } else if ("development" !== 'production') {
1588
+ warn('props must be strings when using array syntax.');
1589
+ }
1590
+ }
1591
+ } else if (isPlainObject(props)) {
1592
+ for (var key in props) {
1593
+ val = props[key];
1594
+ name = camelize(key);
1595
+ res[name] = isPlainObject(val) ? val : {
1596
+ type: val
1597
+ };
1598
+ }
1599
+ } else if ("development" !== 'production') {
1600
+ warn("Invalid value for option \"props\": expected an Array or an Object, " + "but got " + toRawType(props) + ".", vm);
1601
+ }
1602
+
1603
+ options.props = res;
1604
+ }
1605
+ /**
1606
+ * Normalize all injections into Object-based format
1607
+ */
1608
+
1609
+
1610
+ function normalizeInject(options, vm) {
1611
+ var inject = options.inject;
1612
+
1613
+ if (!inject) {
1614
+ return;
1615
+ }
1616
+
1617
+ var normalized = options.inject = {};
1618
+
1619
+ if (Array.isArray(inject)) {
1620
+ for (var i = 0; i < inject.length; i++) {
1621
+ normalized[inject[i]] = {
1622
+ from: inject[i]
1623
+ };
1624
+ }
1625
+ } else if (isPlainObject(inject)) {
1626
+ for (var key in inject) {
1627
+ var val = inject[key];
1628
+ normalized[key] = isPlainObject(val) ? extend({
1629
+ from: key
1630
+ }, val) : {
1631
+ from: val
1632
+ };
1633
+ }
1634
+ } else if ("development" !== 'production') {
1635
+ warn("Invalid value for option \"inject\": expected an Array or an Object, " + "but got " + toRawType(inject) + ".", vm);
1636
+ }
1637
+ }
1638
+ /**
1639
+ * Normalize raw function directives into object format.
1640
+ */
1641
+
1642
+
1643
+ function normalizeDirectives(options) {
1644
+ var dirs = options.directives;
1645
+
1646
+ if (dirs) {
1647
+ for (var key in dirs) {
1648
+ var def$$1 = dirs[key];
1649
+
1650
+ if (typeof def$$1 === 'function') {
1651
+ dirs[key] = {
1652
+ bind: def$$1,
1653
+ update: def$$1
1654
+ };
1655
+ }
1656
+ }
1657
+ }
1658
+ }
1659
+
1660
+ function assertObjectType(name, value, vm) {
1661
+ if (!isPlainObject(value)) {
1662
+ warn("Invalid value for option \"" + name + "\": expected an Object, " + "but got " + toRawType(value) + ".", vm);
1663
+ }
1664
+ }
1665
+ /**
1666
+ * Merge two option objects into a new one.
1667
+ * Core utility used in both instantiation and inheritance.
1668
+ */
1669
+
1670
+
1671
+ function mergeOptions(parent, child, vm) {
1672
+ if ("development" !== 'production') {
1673
+ checkComponents(child);
1674
+ }
1675
+
1676
+ if (typeof child === 'function') {
1677
+ child = child.options;
1678
+ }
1679
+
1680
+ normalizeProps(child, vm);
1681
+ normalizeInject(child, vm);
1682
+ normalizeDirectives(child); // Apply extends and mixins on the child options,
1683
+ // but only if it is a raw options object that isn't
1684
+ // the result of another mergeOptions call.
1685
+ // Only merged options has the _base property.
1686
+
1687
+ if (!child._base) {
1688
+ if (child.extends) {
1689
+ parent = mergeOptions(parent, child.extends, vm);
1690
+ }
1691
+
1692
+ if (child.mixins) {
1693
+ for (var i = 0, l = child.mixins.length; i < l; i++) {
1694
+ parent = mergeOptions(parent, child.mixins[i], vm);
1695
+ }
1696
+ }
1697
+ }
1698
+
1699
+ var options = {};
1700
+ var key;
1701
+
1702
+ for (key in parent) {
1703
+ mergeField(key);
1704
+ }
1705
+
1706
+ for (key in child) {
1707
+ if (!hasOwn(parent, key)) {
1708
+ mergeField(key);
1709
+ }
1710
+ }
1711
+
1712
+ function mergeField(key) {
1713
+ var strat = strats[key] || defaultStrat;
1714
+ options[key] = strat(parent[key], child[key], vm, key);
1715
+ }
1716
+
1717
+ return options;
1718
+ }
1719
+ /**
1720
+ * Resolve an asset.
1721
+ * This function is used because child instances need access
1722
+ * to assets defined in its ancestor chain.
1723
+ */
1724
+
1725
+
1726
+ function resolveAsset(options, type, id, warnMissing) {
1727
+ /* istanbul ignore if */
1728
+ if (typeof id !== 'string') {
1729
+ return;
1730
+ }
1731
+
1732
+ var assets = options[type]; // check local registration variations first
1733
+
1734
+ if (hasOwn(assets, id)) {
1735
+ return assets[id];
1736
+ }
1737
+
1738
+ var camelizedId = camelize(id);
1739
+
1740
+ if (hasOwn(assets, camelizedId)) {
1741
+ return assets[camelizedId];
1742
+ }
1743
+
1744
+ var PascalCaseId = capitalize(camelizedId);
1745
+
1746
+ if (hasOwn(assets, PascalCaseId)) {
1747
+ return assets[PascalCaseId];
1748
+ } // fallback to prototype chain
1749
+
1750
+
1751
+ var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
1752
+
1753
+ if ("development" !== 'production' && warnMissing && !res) {
1754
+ warn('Failed to resolve ' + type.slice(0, -1) + ': ' + id, options);
1755
+ }
1756
+
1757
+ return res;
1758
+ }
1759
+ /* */
1760
+
1761
+
1762
+ function validateProp(key, propOptions, propsData, vm) {
1763
+ var prop = propOptions[key];
1764
+ var absent = !hasOwn(propsData, key);
1765
+ var value = propsData[key]; // boolean casting
1766
+
1767
+ var booleanIndex = getTypeIndex(Boolean, prop.type);
1768
+
1769
+ if (booleanIndex > -1) {
1770
+ if (absent && !hasOwn(prop, 'default')) {
1771
+ value = false;
1772
+ } else if (value === '' || value === hyphenate(key)) {
1773
+ // only cast empty string / same name to boolean if
1774
+ // boolean has higher priority
1775
+ var stringIndex = getTypeIndex(String, prop.type);
1776
+
1777
+ if (stringIndex < 0 || booleanIndex < stringIndex) {
1778
+ value = true;
1779
+ }
1780
+ }
1781
+ } // check default value
1782
+
1783
+
1784
+ if (value === undefined) {
1785
+ value = getPropDefaultValue(vm, prop, key); // since the default value is a fresh copy,
1786
+ // make sure to observe it.
1787
+
1788
+ var prevShouldObserve = shouldObserve;
1789
+ toggleObserving(true);
1790
+ observe(value);
1791
+ toggleObserving(prevShouldObserve);
1792
+ }
1793
+
1794
+ if ("development" !== 'production' && // skip validation for weex recycle-list child component props
1795
+ !false) {
1796
+ assertProp(prop, key, value, vm, absent);
1797
+ }
1798
+
1799
+ return value;
1800
+ }
1801
+ /**
1802
+ * Get the default value of a prop.
1803
+ */
1804
+
1805
+
1806
+ function getPropDefaultValue(vm, prop, key) {
1807
+ // no default, return undefined
1808
+ if (!hasOwn(prop, 'default')) {
1809
+ return undefined;
1810
+ }
1811
+
1812
+ var def = prop.default; // warn against non-factory defaults for Object & Array
1813
+
1814
+ if ("development" !== 'production' && isObject(def)) {
1815
+ warn('Invalid default value for prop "' + key + '": ' + 'Props with type Object/Array must use a factory function ' + 'to return the default value.', vm);
1816
+ } // the raw prop value was also undefined from previous render,
1817
+ // return previous default value to avoid unnecessary watcher trigger
1818
+
1819
+
1820
+ if (vm && vm.$options.propsData && vm.$options.propsData[key] === undefined && vm._props[key] !== undefined) {
1821
+ return vm._props[key];
1822
+ } // call factory function for non-Function types
1823
+ // a value is Function if its prototype is function even across different execution context
1824
+
1825
+
1826
+ return typeof def === 'function' && getType(prop.type) !== 'Function' ? def.call(vm) : def;
1827
+ }
1828
+ /**
1829
+ * Assert whether a prop is valid.
1830
+ */
1831
+
1832
+
1833
+ function assertProp(prop, name, value, vm, absent) {
1834
+ if (prop.required && absent) {
1835
+ warn('Missing required prop: "' + name + '"', vm);
1836
+ return;
1837
+ }
1838
+
1839
+ if (value == null && !prop.required) {
1840
+ return;
1841
+ }
1842
+
1843
+ var type = prop.type;
1844
+ var valid = !type || type === true;
1845
+ var expectedTypes = [];
1846
+
1847
+ if (type) {
1848
+ if (!Array.isArray(type)) {
1849
+ type = [type];
1850
+ }
1851
+
1852
+ for (var i = 0; i < type.length && !valid; i++) {
1853
+ var assertedType = assertType(value, type[i]);
1854
+ expectedTypes.push(assertedType.expectedType || '');
1855
+ valid = assertedType.valid;
1856
+ }
1857
+ }
1858
+
1859
+ if (!valid) {
1860
+ warn(getInvalidTypeMessage(name, value, expectedTypes), vm);
1861
+ return;
1862
+ }
1863
+
1864
+ var validator = prop.validator;
1865
+
1866
+ if (validator) {
1867
+ if (!validator(value)) {
1868
+ warn('Invalid prop: custom validator check failed for prop "' + name + '".', vm);
1869
+ }
1870
+ }
1871
+ }
1872
+
1873
+ var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
1874
+
1875
+ function assertType(value, type) {
1876
+ var valid;
1877
+ var expectedType = getType(type);
1878
+
1879
+ if (simpleCheckRE.test(expectedType)) {
1880
+ var t = typeof value;
1881
+ valid = t === expectedType.toLowerCase(); // for primitive wrapper objects
1882
+
1883
+ if (!valid && t === 'object') {
1884
+ valid = value instanceof type;
1885
+ }
1886
+ } else if (expectedType === 'Object') {
1887
+ valid = isPlainObject(value);
1888
+ } else if (expectedType === 'Array') {
1889
+ valid = Array.isArray(value);
1890
+ } else {
1891
+ valid = value instanceof type;
1892
+ }
1893
+
1894
+ return {
1895
+ valid: valid,
1896
+ expectedType: expectedType
1897
+ };
1898
+ }
1899
+ /**
1900
+ * Use function string name to check built-in types,
1901
+ * because a simple equality check will fail when running
1902
+ * across different vms / iframes.
1903
+ */
1904
+
1905
+
1906
+ function getType(fn) {
1907
+ var match = fn && fn.toString().match(/^\s*function (\w+)/);
1908
+ return match ? match[1] : '';
1909
+ }
1910
+
1911
+ function isSameType(a, b) {
1912
+ return getType(a) === getType(b);
1913
+ }
1914
+
1915
+ function getTypeIndex(type, expectedTypes) {
1916
+ if (!Array.isArray(expectedTypes)) {
1917
+ return isSameType(expectedTypes, type) ? 0 : -1;
1918
+ }
1919
+
1920
+ for (var i = 0, len = expectedTypes.length; i < len; i++) {
1921
+ if (isSameType(expectedTypes[i], type)) {
1922
+ return i;
1923
+ }
1924
+ }
1925
+
1926
+ return -1;
1927
+ }
1928
+
1929
+ function getInvalidTypeMessage(name, value, expectedTypes) {
1930
+ var message = "Invalid prop: type check failed for prop \"" + name + "\"." + " Expected " + expectedTypes.map(capitalize).join(', ');
1931
+ var expectedType = expectedTypes[0];
1932
+ var receivedType = toRawType(value);
1933
+ var expectedValue = styleValue(value, expectedType);
1934
+ var receivedValue = styleValue(value, receivedType); // check if we need to specify expected value
1935
+
1936
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
1937
+ message += " with value " + expectedValue;
1938
+ }
1939
+
1940
+ message += ", got " + receivedType + " "; // check if we need to specify received value
1941
+
1942
+ if (isExplicable(receivedType)) {
1943
+ message += "with value " + receivedValue + ".";
1944
+ }
1945
+
1946
+ return message;
1947
+ }
1948
+
1949
+ function styleValue(value, type) {
1950
+ if (type === 'String') {
1951
+ return "\"" + value + "\"";
1952
+ } else if (type === 'Number') {
1953
+ return "" + Number(value);
1954
+ } else {
1955
+ return "" + value;
1956
+ }
1957
+ }
1958
+
1959
+ function isExplicable(value) {
1960
+ var explicitTypes = ['string', 'number', 'boolean'];
1961
+ return explicitTypes.some(function (elem) {
1962
+ return value.toLowerCase() === elem;
1963
+ });
1964
+ }
1965
+
1966
+ function isBoolean() {
1967
+ var args = [],
1968
+ len = arguments.length;
1969
+
1970
+ while (len--) args[len] = arguments[len];
1971
+
1972
+ return args.some(function (elem) {
1973
+ return elem.toLowerCase() === 'boolean';
1974
+ });
1975
+ }
1976
+ /* */
1977
+
1978
+
1979
+ function handleError(err, vm, info) {
1980
+ // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
1981
+ // See: https://github.com/vuejs/vuex/issues/1505
1982
+ pushTarget();
1983
+
1984
+ try {
1985
+ if (vm) {
1986
+ var cur = vm;
1987
+
1988
+ while (cur = cur.$parent) {
1989
+ var hooks = cur.$options.errorCaptured;
1990
+
1991
+ if (hooks) {
1992
+ for (var i = 0; i < hooks.length; i++) {
1993
+ try {
1994
+ var capture = hooks[i].call(cur, err, vm, info) === false;
1995
+
1996
+ if (capture) {
1997
+ return;
1998
+ }
1999
+ } catch (e) {
2000
+ globalHandleError(e, cur, 'errorCaptured hook');
2001
+ }
2002
+ }
2003
+ }
2004
+ }
2005
+ }
2006
+
2007
+ globalHandleError(err, vm, info);
2008
+ } finally {
2009
+ popTarget();
2010
+ }
2011
+ }
2012
+
2013
+ function invokeWithErrorHandling(handler, context, args, vm, info) {
2014
+ var res;
2015
+
2016
+ try {
2017
+ res = args ? handler.apply(context, args) : handler.call(context);
2018
+
2019
+ if (res && !res._isVue && isPromise(res) && !res._handled) {
2020
+ res.catch(function (e) {
2021
+ return handleError(e, vm, info + " (Promise/async)");
2022
+ }); // issue #9511
2023
+ // avoid catch triggering multiple times when nested calls
2024
+
2025
+ res._handled = true;
2026
+ }
2027
+ } catch (e) {
2028
+ handleError(e, vm, info);
2029
+ }
2030
+
2031
+ return res;
2032
+ }
2033
+
2034
+ function globalHandleError(err, vm, info) {
2035
+ if (config.errorHandler) {
2036
+ try {
2037
+ return config.errorHandler.call(null, err, vm, info);
2038
+ } catch (e) {
2039
+ // if the user intentionally throws the original error in the handler,
2040
+ // do not log it twice
2041
+ if (e !== err) {
2042
+ logError(e, null, 'config.errorHandler');
2043
+ }
2044
+ }
2045
+ }
2046
+
2047
+ logError(err, vm, info);
2048
+ }
2049
+
2050
+ function logError(err, vm, info) {
2051
+ if ("development" !== 'production') {
2052
+ warn("Error in " + info + ": \"" + err.toString() + "\"", vm);
2053
+ }
2054
+ /* istanbul ignore else */
2055
+
2056
+
2057
+ if ((inBrowser || inWeex) && typeof console !== 'undefined') {
2058
+ console.error(err);
2059
+ } else {
2060
+ throw err;
2061
+ }
2062
+ }
2063
+ /* */
2064
+
2065
+
2066
+ var isUsingMicroTask = false;
2067
+ var callbacks = [];
2068
+ var pending = false;
2069
+
2070
+ function flushCallbacks() {
2071
+ pending = false;
2072
+ var copies = callbacks.slice(0);
2073
+ callbacks.length = 0;
2074
+
2075
+ for (var i = 0; i < copies.length; i++) {
2076
+ copies[i]();
2077
+ }
2078
+ } // Here we have async deferring wrappers using microtasks.
2079
+ // In 2.5 we used (macro) tasks (in combination with microtasks).
2080
+ // However, it has subtle problems when state is changed right before repaint
2081
+ // (e.g. #6813, out-in transitions).
2082
+ // Also, using (macro) tasks in event handler would cause some weird behaviors
2083
+ // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
2084
+ // So we now use microtasks everywhere, again.
2085
+ // A major drawback of this tradeoff is that there are some scenarios
2086
+ // where microtasks have too high a priority and fire in between supposedly
2087
+ // sequential events (e.g. #4521, #6690, which have workarounds)
2088
+ // or even between bubbling of the same event (#6566).
2089
+
2090
+
2091
+ var timerFunc; // The nextTick behavior leverages the microtask queue, which can be accessed
2092
+ // via either native Promise.then or MutationObserver.
2093
+ // MutationObserver has wider support, however it is seriously bugged in
2094
+ // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
2095
+ // completely stops working after triggering a few times... so, if native
2096
+ // Promise is available, we will use it:
2097
+
2098
+ /* istanbul ignore next, $flow-disable-line */
2099
+
2100
+ if (typeof Promise !== 'undefined' && isNative(Promise)) {
2101
+ var p = Promise.resolve();
2102
+
2103
+ timerFunc = function () {
2104
+ p.then(flushCallbacks); // In problematic UIWebViews, Promise.then doesn't completely break, but
2105
+ // it can get stuck in a weird state where callbacks are pushed into the
2106
+ // microtask queue but the queue isn't being flushed, until the browser
2107
+ // needs to do some other work, e.g. handle a timer. Therefore we can
2108
+ // "force" the microtask queue to be flushed by adding an empty timer.
2109
+
2110
+ if (isIOS) {
2111
+ setTimeout(noop);
2112
+ }
2113
+ };
2114
+
2115
+ isUsingMicroTask = true;
2116
+ } else if (!isIE && typeof MutationObserver !== 'undefined' && (isNative(MutationObserver) || // PhantomJS and iOS 7.x
2117
+ MutationObserver.toString() === '[object MutationObserverConstructor]')) {
2118
+ // Use MutationObserver where native Promise is not available,
2119
+ // e.g. PhantomJS, iOS7, Android 4.4
2120
+ // (#6466 MutationObserver is unreliable in IE11)
2121
+ var counter = 1;
2122
+ var observer = new MutationObserver(flushCallbacks);
2123
+ var textNode = document.createTextNode(String(counter));
2124
+ observer.observe(textNode, {
2125
+ characterData: true
2126
+ });
2127
+
2128
+ timerFunc = function () {
2129
+ counter = (counter + 1) % 2;
2130
+ textNode.data = String(counter);
2131
+ };
2132
+
2133
+ isUsingMicroTask = true;
2134
+ } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
2135
+ // Fallback to setImmediate.
2136
+ // Technically it leverages the (macro) task queue,
2137
+ // but it is still a better choice than setTimeout.
2138
+ timerFunc = function () {
2139
+ setImmediate(flushCallbacks);
2140
+ };
2141
+ } else {
2142
+ // Fallback to setTimeout.
2143
+ timerFunc = function () {
2144
+ setTimeout(flushCallbacks, 0);
2145
+ };
2146
+ }
2147
+
2148
+ function nextTick(cb, ctx) {
2149
+ var _resolve;
2150
+
2151
+ callbacks.push(function () {
2152
+ if (cb) {
2153
+ try {
2154
+ cb.call(ctx);
2155
+ } catch (e) {
2156
+ handleError(e, ctx, 'nextTick');
2157
+ }
2158
+ } else if (_resolve) {
2159
+ _resolve(ctx);
2160
+ }
2161
+ });
2162
+
2163
+ if (!pending) {
2164
+ pending = true;
2165
+ timerFunc();
2166
+ } // $flow-disable-line
2167
+
2168
+
2169
+ if (!cb && typeof Promise !== 'undefined') {
2170
+ return new Promise(function (resolve) {
2171
+ _resolve = resolve;
2172
+ });
2173
+ }
2174
+ }
2175
+ /* */
2176
+
2177
+
2178
+ var mark;
2179
+ var measure;
2180
+
2181
+ if ("development" !== 'production') {
2182
+ var perf = inBrowser && window.performance;
2183
+ /* istanbul ignore if */
2184
+
2185
+ if (perf && perf.mark && perf.measure && perf.clearMarks && perf.clearMeasures) {
2186
+ mark = function (tag) {
2187
+ return perf.mark(tag);
2188
+ };
2189
+
2190
+ measure = function (name, startTag, endTag) {
2191
+ perf.measure(name, startTag, endTag);
2192
+ perf.clearMarks(startTag);
2193
+ perf.clearMarks(endTag); // perf.clearMeasures(name)
2194
+ };
2195
+ }
2196
+ }
2197
+ /* not type checking this file because flow doesn't play well with Proxy */
2198
+
2199
+
2200
+ var initProxy;
2201
+
2202
+ if ("development" !== 'production') {
2203
+ var allowedGlobals = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' + 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + 'require' // for Webpack/Browserify
2204
+ );
2205
+
2206
+ var warnNonPresent = function (target, key) {
2207
+ warn("Property or method \"" + key + "\" is not defined on the instance but " + 'referenced during render. Make sure that this property is reactive, ' + 'either in the data option, or for class-based components, by ' + 'initializing the property. ' + 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
2208
+ };
2209
+
2210
+ var warnReservedPrefix = function (target, key) {
2211
+ warn("Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " + 'properties starting with "$" or "_" are not proxied in the Vue instance to ' + 'prevent conflicts with Vue internals. ' + 'See: https://vuejs.org/v2/api/#data', target);
2212
+ };
2213
+
2214
+ var hasProxy = typeof Proxy !== 'undefined' && isNative(Proxy);
2215
+
2216
+ if (hasProxy) {
2217
+ var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
2218
+ config.keyCodes = new Proxy(config.keyCodes, {
2219
+ set: function set(target, key, value) {
2220
+ if (isBuiltInModifier(key)) {
2221
+ warn("Avoid overwriting built-in modifier in config.keyCodes: ." + key);
2222
+ return false;
2223
+ } else {
2224
+ target[key] = value;
2225
+ return true;
2226
+ }
2227
+ }
2228
+ });
2229
+ }
2230
+
2231
+ var hasHandler = {
2232
+ has: function has(target, key) {
2233
+ var has = (key in target);
2234
+ var isAllowed = allowedGlobals(key) || typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data);
2235
+
2236
+ if (!has && !isAllowed) {
2237
+ if (key in target.$data) {
2238
+ warnReservedPrefix(target, key);
2239
+ } else {
2240
+ warnNonPresent(target, key);
2241
+ }
2242
+ }
2243
+
2244
+ return has || !isAllowed;
2245
+ }
2246
+ };
2247
+ var getHandler = {
2248
+ get: function get(target, key) {
2249
+ if (typeof key === 'string' && !(key in target)) {
2250
+ if (key in target.$data) {
2251
+ warnReservedPrefix(target, key);
2252
+ } else {
2253
+ warnNonPresent(target, key);
2254
+ }
2255
+ }
2256
+
2257
+ return target[key];
2258
+ }
2259
+ };
2260
+
2261
+ initProxy = function initProxy(vm) {
2262
+ if (hasProxy) {
2263
+ // determine which proxy handler to use
2264
+ var options = vm.$options;
2265
+ var handlers = options.render && options.render._withStripped ? getHandler : hasHandler;
2266
+ vm._renderProxy = new Proxy(vm, handlers);
2267
+ } else {
2268
+ vm._renderProxy = vm;
2269
+ }
2270
+ };
2271
+ }
2272
+ /* */
2273
+
2274
+
2275
+ var seenObjects = new _Set();
2276
+ /**
2277
+ * Recursively traverse an object to evoke all converted
2278
+ * getters, so that every nested property inside the object
2279
+ * is collected as a "deep" dependency.
2280
+ */
2281
+
2282
+ function traverse(val) {
2283
+ _traverse(val, seenObjects);
2284
+
2285
+ seenObjects.clear();
2286
+ }
2287
+
2288
+ function _traverse(val, seen) {
2289
+ var i, keys;
2290
+ var isA = Array.isArray(val);
2291
+
2292
+ if (!isA && !isObject(val) || Object.isFrozen(val) || val instanceof VNode) {
2293
+ return;
2294
+ }
2295
+
2296
+ if (val.__ob__) {
2297
+ var depId = val.__ob__.dep.id;
2298
+
2299
+ if (seen.has(depId)) {
2300
+ return;
2301
+ }
2302
+
2303
+ seen.add(depId);
2304
+ }
2305
+
2306
+ if (isA) {
2307
+ i = val.length;
2308
+
2309
+ while (i--) {
2310
+ _traverse(val[i], seen);
2311
+ }
2312
+ } else {
2313
+ keys = Object.keys(val);
2314
+ i = keys.length;
2315
+
2316
+ while (i--) {
2317
+ _traverse(val[keys[i]], seen);
2318
+ }
2319
+ }
2320
+ }
2321
+ /* */
2322
+
2323
+
2324
+ var normalizeEvent = cached(function (name) {
2325
+ var passive = name.charAt(0) === '&';
2326
+ name = passive ? name.slice(1) : name;
2327
+ var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
2328
+
2329
+ name = once$$1 ? name.slice(1) : name;
2330
+ var capture = name.charAt(0) === '!';
2331
+ name = capture ? name.slice(1) : name;
2332
+ return {
2333
+ name: name,
2334
+ once: once$$1,
2335
+ capture: capture,
2336
+ passive: passive
2337
+ };
2338
+ });
2339
+
2340
+ function createFnInvoker(fns, vm) {
2341
+ function invoker() {
2342
+ var arguments$1 = arguments;
2343
+ var fns = invoker.fns;
2344
+
2345
+ if (Array.isArray(fns)) {
2346
+ var cloned = fns.slice();
2347
+
2348
+ for (var i = 0; i < cloned.length; i++) {
2349
+ invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
2350
+ }
2351
+ } else {
2352
+ // return handler return value for single handlers
2353
+ return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler");
2354
+ }
2355
+ }
2356
+
2357
+ invoker.fns = fns;
2358
+ return invoker;
2359
+ }
2360
+
2361
+ function updateListeners(on, oldOn, add, remove$$1, createOnceHandler, vm) {
2362
+ var name, def$$1, cur, old, event;
2363
+
2364
+ for (name in on) {
2365
+ def$$1 = cur = on[name];
2366
+ old = oldOn[name];
2367
+ event = normalizeEvent(name);
2368
+
2369
+ if (isUndef(cur)) {
2370
+ "development" !== 'production' && warn("Invalid handler for event \"" + event.name + "\": got " + String(cur), vm);
2371
+ } else if (isUndef(old)) {
2372
+ if (isUndef(cur.fns)) {
2373
+ cur = on[name] = createFnInvoker(cur, vm);
2374
+ }
2375
+
2376
+ if (isTrue(event.once)) {
2377
+ cur = on[name] = createOnceHandler(event.name, cur, event.capture);
2378
+ }
2379
+
2380
+ add(event.name, cur, event.capture, event.passive, event.params);
2381
+ } else if (cur !== old) {
2382
+ old.fns = cur;
2383
+ on[name] = old;
2384
+ }
2385
+ }
2386
+
2387
+ for (name in oldOn) {
2388
+ if (isUndef(on[name])) {
2389
+ event = normalizeEvent(name);
2390
+ remove$$1(event.name, oldOn[name], event.capture);
2391
+ }
2392
+ }
2393
+ }
2394
+ /* */
2395
+
2396
+
2397
+ function mergeVNodeHook(def, hookKey, hook) {
2398
+ if (def instanceof VNode) {
2399
+ def = def.data.hook || (def.data.hook = {});
2400
+ }
2401
+
2402
+ var invoker;
2403
+ var oldHook = def[hookKey];
2404
+
2405
+ function wrappedHook() {
2406
+ hook.apply(this, arguments); // important: remove merged hook to ensure it's called only once
2407
+ // and prevent memory leak
2408
+
2409
+ remove(invoker.fns, wrappedHook);
2410
+ }
2411
+
2412
+ if (isUndef(oldHook)) {
2413
+ // no existing hook
2414
+ invoker = createFnInvoker([wrappedHook]);
2415
+ } else {
2416
+ /* istanbul ignore if */
2417
+ if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
2418
+ // already a merged invoker
2419
+ invoker = oldHook;
2420
+ invoker.fns.push(wrappedHook);
2421
+ } else {
2422
+ // existing plain hook
2423
+ invoker = createFnInvoker([oldHook, wrappedHook]);
2424
+ }
2425
+ }
2426
+
2427
+ invoker.merged = true;
2428
+ def[hookKey] = invoker;
2429
+ }
2430
+ /* */
2431
+
2432
+
2433
+ function extractPropsFromVNodeData(data, Ctor, tag) {
2434
+ // we are only extracting raw values here.
2435
+ // validation and default values are handled in the child
2436
+ // component itself.
2437
+ var propOptions = Ctor.options.props;
2438
+
2439
+ if (isUndef(propOptions)) {
2440
+ return;
2441
+ }
2442
+
2443
+ var res = {};
2444
+ var attrs = data.attrs;
2445
+ var props = data.props;
2446
+
2447
+ if (isDef(attrs) || isDef(props)) {
2448
+ for (var key in propOptions) {
2449
+ var altKey = hyphenate(key);
2450
+
2451
+ if ("development" !== 'production') {
2452
+ var keyInLowerCase = key.toLowerCase();
2453
+
2454
+ if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {
2455
+ tip("Prop \"" + keyInLowerCase + "\" is passed to component " + formatComponentName(tag || Ctor) + ", but the declared prop name is" + " \"" + key + "\". " + "Note that HTML attributes are case-insensitive and camelCased " + "props need to use their kebab-case equivalents when using in-DOM " + "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\".");
2456
+ }
2457
+ }
2458
+
2459
+ checkProp(res, props, key, altKey, true) || checkProp(res, attrs, key, altKey, false);
2460
+ }
2461
+ }
2462
+
2463
+ return res;
2464
+ }
2465
+
2466
+ function checkProp(res, hash, key, altKey, preserve) {
2467
+ if (isDef(hash)) {
2468
+ if (hasOwn(hash, key)) {
2469
+ res[key] = hash[key];
2470
+
2471
+ if (!preserve) {
2472
+ delete hash[key];
2473
+ }
2474
+
2475
+ return true;
2476
+ } else if (hasOwn(hash, altKey)) {
2477
+ res[key] = hash[altKey];
2478
+
2479
+ if (!preserve) {
2480
+ delete hash[altKey];
2481
+ }
2482
+
2483
+ return true;
2484
+ }
2485
+ }
2486
+
2487
+ return false;
2488
+ }
2489
+ /* */
2490
+ // The template compiler attempts to minimize the need for normalization by
2491
+ // statically analyzing the template at compile time.
2492
+ //
2493
+ // For plain HTML markup, normalization can be completely skipped because the
2494
+ // generated render function is guaranteed to return Array<VNode>. There are
2495
+ // two cases where extra normalization is needed:
2496
+ // 1. When the children contains components - because a functional component
2497
+ // may return an Array instead of a single root. In this case, just a simple
2498
+ // normalization is needed - if any child is an Array, we flatten the whole
2499
+ // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
2500
+ // because functional components already normalize their own children.
2501
+
2502
+
2503
+ function simpleNormalizeChildren(children) {
2504
+ for (var i = 0; i < children.length; i++) {
2505
+ if (Array.isArray(children[i])) {
2506
+ return Array.prototype.concat.apply([], children);
2507
+ }
2508
+ }
2509
+
2510
+ return children;
2511
+ } // 2. When the children contains constructs that always generated nested Arrays,
2512
+ // e.g. <template>, <slot>, v-for, or when the children is provided by user
2513
+ // with hand-written render functions / JSX. In such cases a full normalization
2514
+ // is needed to cater to all possible types of children values.
2515
+
2516
+
2517
+ function normalizeChildren(children) {
2518
+ return isPrimitive(children) ? [createTextVNode(children)] : Array.isArray(children) ? normalizeArrayChildren(children) : undefined;
2519
+ }
2520
+
2521
+ function isTextNode(node) {
2522
+ return isDef(node) && isDef(node.text) && isFalse(node.isComment);
2523
+ }
2524
+
2525
+ function normalizeArrayChildren(children, nestedIndex) {
2526
+ var res = [];
2527
+ var i, c, lastIndex, last;
2528
+
2529
+ for (i = 0; i < children.length; i++) {
2530
+ c = children[i];
2531
+
2532
+ if (isUndef(c) || typeof c === 'boolean') {
2533
+ continue;
2534
+ }
2535
+
2536
+ lastIndex = res.length - 1;
2537
+ last = res[lastIndex]; // nested
2538
+
2539
+ if (Array.isArray(c)) {
2540
+ if (c.length > 0) {
2541
+ c = normalizeArrayChildren(c, (nestedIndex || '') + "_" + i); // merge adjacent text nodes
2542
+
2543
+ if (isTextNode(c[0]) && isTextNode(last)) {
2544
+ res[lastIndex] = createTextVNode(last.text + c[0].text);
2545
+ c.shift();
2546
+ }
2547
+
2548
+ res.push.apply(res, c);
2549
+ }
2550
+ } else if (isPrimitive(c)) {
2551
+ if (isTextNode(last)) {
2552
+ // merge adjacent text nodes
2553
+ // this is necessary for SSR hydration because text nodes are
2554
+ // essentially merged when rendered to HTML strings
2555
+ res[lastIndex] = createTextVNode(last.text + c);
2556
+ } else if (c !== '') {
2557
+ // convert primitive to vnode
2558
+ res.push(createTextVNode(c));
2559
+ }
2560
+ } else {
2561
+ if (isTextNode(c) && isTextNode(last)) {
2562
+ // merge adjacent text nodes
2563
+ res[lastIndex] = createTextVNode(last.text + c.text);
2564
+ } else {
2565
+ // default key for nested array children (likely generated by v-for)
2566
+ if (isTrue(children._isVList) && isDef(c.tag) && isUndef(c.key) && isDef(nestedIndex)) {
2567
+ c.key = "__vlist" + nestedIndex + "_" + i + "__";
2568
+ }
2569
+
2570
+ res.push(c);
2571
+ }
2572
+ }
2573
+ }
2574
+
2575
+ return res;
2576
+ }
2577
+ /* */
2578
+
2579
+
2580
+ function initProvide(vm) {
2581
+ var provide = vm.$options.provide;
2582
+
2583
+ if (provide) {
2584
+ vm._provided = typeof provide === 'function' ? provide.call(vm) : provide;
2585
+ }
2586
+ }
2587
+
2588
+ function initInjections(vm) {
2589
+ var result = resolveInject(vm.$options.inject, vm);
2590
+
2591
+ if (result) {
2592
+ toggleObserving(false);
2593
+ Object.keys(result).forEach(function (key) {
2594
+ /* istanbul ignore else */
2595
+ if ("development" !== 'production') {
2596
+ defineReactive$$1(vm, key, result[key], function () {
2597
+ warn("Avoid mutating an injected value directly since the changes will be " + "overwritten whenever the provided component re-renders. " + "injection being mutated: \"" + key + "\"", vm);
2598
+ });
2599
+ } else {
2600
+ defineReactive$$1(vm, key, result[key]);
2601
+ }
2602
+ });
2603
+ toggleObserving(true);
2604
+ }
2605
+ }
2606
+
2607
+ function resolveInject(inject, vm) {
2608
+ if (inject) {
2609
+ // inject is :any because flow is not smart enough to figure out cached
2610
+ var result = Object.create(null);
2611
+ var keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
2612
+
2613
+ for (var i = 0; i < keys.length; i++) {
2614
+ var key = keys[i]; // #6574 in case the inject object is observed...
2615
+
2616
+ if (key === '__ob__') {
2617
+ continue;
2618
+ }
2619
+
2620
+ var provideKey = inject[key].from;
2621
+ var source = vm;
2622
+
2623
+ while (source) {
2624
+ if (source._provided && hasOwn(source._provided, provideKey)) {
2625
+ result[key] = source._provided[provideKey];
2626
+ break;
2627
+ }
2628
+
2629
+ source = source.$parent;
2630
+ }
2631
+
2632
+ if (!source) {
2633
+ if ('default' in inject[key]) {
2634
+ var provideDefault = inject[key].default;
2635
+ result[key] = typeof provideDefault === 'function' ? provideDefault.call(vm) : provideDefault;
2636
+ } else if ("development" !== 'production') {
2637
+ warn("Injection \"" + key + "\" not found", vm);
2638
+ }
2639
+ }
2640
+ }
2641
+
2642
+ return result;
2643
+ }
2644
+ }
2645
+ /* */
2646
+
2647
+ /**
2648
+ * Runtime helper for resolving raw children VNodes into a slot object.
2649
+ */
2650
+
2651
+
2652
+ function resolveSlots(children, context) {
2653
+ if (!children || !children.length) {
2654
+ return {};
2655
+ }
2656
+
2657
+ var slots = {};
2658
+
2659
+ for (var i = 0, l = children.length; i < l; i++) {
2660
+ var child = children[i];
2661
+ var data = child.data; // remove slot attribute if the node is resolved as a Vue slot node
2662
+
2663
+ if (data && data.attrs && data.attrs.slot) {
2664
+ delete data.attrs.slot;
2665
+ } // named slots should only be respected if the vnode was rendered in the
2666
+ // same context.
2667
+
2668
+
2669
+ if ((child.context === context || child.fnContext === context) && data && data.slot != null) {
2670
+ var name = data.slot;
2671
+ var slot = slots[name] || (slots[name] = []);
2672
+
2673
+ if (child.tag === 'template') {
2674
+ slot.push.apply(slot, child.children || []);
2675
+ } else {
2676
+ slot.push(child);
2677
+ }
2678
+ } else {
2679
+ (slots.default || (slots.default = [])).push(child);
2680
+ }
2681
+ } // ignore slots that contains only whitespace
2682
+
2683
+
2684
+ for (var name$1 in slots) {
2685
+ if (slots[name$1].every(isWhitespace)) {
2686
+ delete slots[name$1];
2687
+ }
2688
+ }
2689
+
2690
+ return slots;
2691
+ }
2692
+
2693
+ function isWhitespace(node) {
2694
+ return node.isComment && !node.asyncFactory || node.text === ' ';
2695
+ }
2696
+ /* */
2697
+
2698
+
2699
+ function normalizeScopedSlots(slots, normalSlots, prevSlots) {
2700
+ var res;
2701
+ var hasNormalSlots = Object.keys(normalSlots).length > 0;
2702
+ var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2703
+ var key = slots && slots.$key;
2704
+
2705
+ if (!slots) {
2706
+ res = {};
2707
+ } else if (slots._normalized) {
2708
+ // fast path 1: child component re-render only, parent did not change
2709
+ return slots._normalized;
2710
+ } else if (isStable && prevSlots && prevSlots !== emptyObject && key === prevSlots.$key && !hasNormalSlots && !prevSlots.$hasNormal) {
2711
+ // fast path 2: stable scoped slots w/ no normal slots to proxy,
2712
+ // only need to normalize once
2713
+ return prevSlots;
2714
+ } else {
2715
+ res = {};
2716
+
2717
+ for (var key$1 in slots) {
2718
+ if (slots[key$1] && key$1[0] !== '$') {
2719
+ res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
2720
+ }
2721
+ }
2722
+ } // expose normal slots on scopedSlots
2723
+
2724
+
2725
+ for (var key$2 in normalSlots) {
2726
+ if (!(key$2 in res)) {
2727
+ res[key$2] = proxyNormalSlot(normalSlots, key$2);
2728
+ }
2729
+ } // avoriaz seems to mock a non-extensible $scopedSlots object
2730
+ // and when that is passed down this would cause an error
2731
+
2732
+
2733
+ if (slots && Object.isExtensible(slots)) {
2734
+ slots._normalized = res;
2735
+ }
2736
+
2737
+ def(res, '$stable', isStable);
2738
+ def(res, '$key', key);
2739
+ def(res, '$hasNormal', hasNormalSlots);
2740
+ return res;
2741
+ }
2742
+
2743
+ function normalizeScopedSlot(normalSlots, key, fn) {
2744
+ var normalized = function () {
2745
+ var res = arguments.length ? fn.apply(null, arguments) : fn({});
2746
+ res = res && typeof res === 'object' && !Array.isArray(res) ? [res] // single vnode
2747
+ : normalizeChildren(res);
2748
+ return res && (res.length === 0 || res.length === 1 && res[0].isComment // #9658
2749
+ ) ? undefined : res;
2750
+ }; // this is a slot using the new v-slot syntax without scope. although it is
2751
+ // compiled as a scoped slot, render fn users would expect it to be present
2752
+ // on this.$slots because the usage is semantically a normal slot.
2753
+
2754
+
2755
+ if (fn.proxy) {
2756
+ Object.defineProperty(normalSlots, key, {
2757
+ get: normalized,
2758
+ enumerable: true,
2759
+ configurable: true
2760
+ });
2761
+ }
2762
+
2763
+ return normalized;
2764
+ }
2765
+
2766
+ function proxyNormalSlot(slots, key) {
2767
+ return function () {
2768
+ return slots[key];
2769
+ };
2770
+ }
2771
+ /* */
2772
+
2773
+ /**
2774
+ * Runtime helper for rendering v-for lists.
2775
+ */
2776
+
2777
+
2778
+ function renderList(val, render) {
2779
+ var ret, i, l, keys, key;
2780
+
2781
+ if (Array.isArray(val) || typeof val === 'string') {
2782
+ ret = new Array(val.length);
2783
+
2784
+ for (i = 0, l = val.length; i < l; i++) {
2785
+ ret[i] = render(val[i], i);
2786
+ }
2787
+ } else if (typeof val === 'number') {
2788
+ ret = new Array(val);
2789
+
2790
+ for (i = 0; i < val; i++) {
2791
+ ret[i] = render(i + 1, i);
2792
+ }
2793
+ } else if (isObject(val)) {
2794
+ if (hasSymbol && val[Symbol.iterator]) {
2795
+ ret = [];
2796
+ var iterator = val[Symbol.iterator]();
2797
+ var result = iterator.next();
2798
+
2799
+ while (!result.done) {
2800
+ ret.push(render(result.value, ret.length));
2801
+ result = iterator.next();
2802
+ }
2803
+ } else {
2804
+ keys = Object.keys(val);
2805
+ ret = new Array(keys.length);
2806
+
2807
+ for (i = 0, l = keys.length; i < l; i++) {
2808
+ key = keys[i];
2809
+ ret[i] = render(val[key], key, i);
2810
+ }
2811
+ }
2812
+ }
2813
+
2814
+ if (!isDef(ret)) {
2815
+ ret = [];
2816
+ }
2817
+
2818
+ ret._isVList = true;
2819
+ return ret;
2820
+ }
2821
+ /* */
2822
+
2823
+ /**
2824
+ * Runtime helper for rendering <slot>
2825
+ */
2826
+
2827
+
2828
+ function renderSlot(name, fallback, props, bindObject) {
2829
+ var scopedSlotFn = this.$scopedSlots[name];
2830
+ var nodes;
2831
+
2832
+ if (scopedSlotFn) {
2833
+ // scoped slot
2834
+ props = props || {};
2835
+
2836
+ if (bindObject) {
2837
+ if ("development" !== 'production' && !isObject(bindObject)) {
2838
+ warn('slot v-bind without argument expects an Object', this);
2839
+ }
2840
+
2841
+ props = extend(extend({}, bindObject), props);
2842
+ }
2843
+
2844
+ nodes = scopedSlotFn(props) || fallback;
2845
+ } else {
2846
+ nodes = this.$slots[name] || fallback;
2847
+ }
2848
+
2849
+ var target = props && props.slot;
2850
+
2851
+ if (target) {
2852
+ return this.$createElement('template', {
2853
+ slot: target
2854
+ }, nodes);
2855
+ } else {
2856
+ return nodes;
2857
+ }
2858
+ }
2859
+ /* */
2860
+
2861
+ /**
2862
+ * Runtime helper for resolving filters
2863
+ */
2864
+
2865
+
2866
+ function resolveFilter(id) {
2867
+ return resolveAsset(this.$options, 'filters', id, true) || identity;
2868
+ }
2869
+ /* */
2870
+
2871
+
2872
+ function isKeyNotMatch(expect, actual) {
2873
+ if (Array.isArray(expect)) {
2874
+ return expect.indexOf(actual) === -1;
2875
+ } else {
2876
+ return expect !== actual;
2877
+ }
2878
+ }
2879
+ /**
2880
+ * Runtime helper for checking keyCodes from config.
2881
+ * exposed as Vue.prototype._k
2882
+ * passing in eventKeyName as last argument separately for backwards compat
2883
+ */
2884
+
2885
+
2886
+ function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {
2887
+ var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
2888
+
2889
+ if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
2890
+ return isKeyNotMatch(builtInKeyName, eventKeyName);
2891
+ } else if (mappedKeyCode) {
2892
+ return isKeyNotMatch(mappedKeyCode, eventKeyCode);
2893
+ } else if (eventKeyName) {
2894
+ return hyphenate(eventKeyName) !== key;
2895
+ }
2896
+ }
2897
+ /* */
2898
+
2899
+ /**
2900
+ * Runtime helper for merging v-bind="object" into a VNode's data.
2901
+ */
2902
+
2903
+
2904
+ function bindObjectProps(data, tag, value, asProp, isSync) {
2905
+ if (value) {
2906
+ if (!isObject(value)) {
2907
+ "development" !== 'production' && warn('v-bind without argument expects an Object or Array value', this);
2908
+ } else {
2909
+ if (Array.isArray(value)) {
2910
+ value = toObject(value);
2911
+ }
2912
+
2913
+ var hash;
2914
+
2915
+ var loop = function (key) {
2916
+ if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
2917
+ hash = data;
2918
+ } else {
2919
+ var type = data.attrs && data.attrs.type;
2920
+ hash = asProp || config.mustUseProp(tag, type, key) ? data.domProps || (data.domProps = {}) : data.attrs || (data.attrs = {});
2921
+ }
2922
+
2923
+ var camelizedKey = camelize(key);
2924
+ var hyphenatedKey = hyphenate(key);
2925
+
2926
+ if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2927
+ hash[key] = value[key];
2928
+
2929
+ if (isSync) {
2930
+ var on = data.on || (data.on = {});
2931
+
2932
+ on["update:" + key] = function ($event) {
2933
+ value[key] = $event;
2934
+ };
2935
+ }
2936
+ }
2937
+ };
2938
+
2939
+ for (var key in value) loop(key);
2940
+ }
2941
+ }
2942
+
2943
+ return data;
2944
+ }
2945
+ /* */
2946
+
2947
+ /**
2948
+ * Runtime helper for rendering static trees.
2949
+ */
2950
+
2951
+
2952
+ function renderStatic(index, isInFor) {
2953
+ var cached = this._staticTrees || (this._staticTrees = []);
2954
+ var tree = cached[index]; // if has already-rendered static tree and not inside v-for,
2955
+ // we can reuse the same tree.
2956
+
2957
+ if (tree && !isInFor) {
2958
+ return tree;
2959
+ } // otherwise, render a fresh tree.
2960
+
2961
+
2962
+ tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, null, this // for render fns generated for functional component templates
2963
+ );
2964
+ markStatic(tree, "__static__" + index, false);
2965
+ return tree;
2966
+ }
2967
+ /**
2968
+ * Runtime helper for v-once.
2969
+ * Effectively it means marking the node as static with a unique key.
2970
+ */
2971
+
2972
+
2973
+ function markOnce(tree, index, key) {
2974
+ markStatic(tree, "__once__" + index + (key ? "_" + key : ""), true);
2975
+ return tree;
2976
+ }
2977
+
2978
+ function markStatic(tree, key, isOnce) {
2979
+ if (Array.isArray(tree)) {
2980
+ for (var i = 0; i < tree.length; i++) {
2981
+ if (tree[i] && typeof tree[i] !== 'string') {
2982
+ markStaticNode(tree[i], key + "_" + i, isOnce);
2983
+ }
2984
+ }
2985
+ } else {
2986
+ markStaticNode(tree, key, isOnce);
2987
+ }
2988
+ }
2989
+
2990
+ function markStaticNode(node, key, isOnce) {
2991
+ node.isStatic = true;
2992
+ node.key = key;
2993
+ node.isOnce = isOnce;
2994
+ }
2995
+ /* */
2996
+
2997
+
2998
+ function bindObjectListeners(data, value) {
2999
+ if (value) {
3000
+ if (!isPlainObject(value)) {
3001
+ "development" !== 'production' && warn('v-on without argument expects an Object value', this);
3002
+ } else {
3003
+ var on = data.on = data.on ? extend({}, data.on) : {};
3004
+
3005
+ for (var key in value) {
3006
+ var existing = on[key];
3007
+ var ours = value[key];
3008
+ on[key] = existing ? [].concat(existing, ours) : ours;
3009
+ }
3010
+ }
3011
+ }
3012
+
3013
+ return data;
3014
+ }
3015
+ /* */
3016
+
3017
+
3018
+ function resolveScopedSlots(fns, // see flow/vnode
3019
+ res, // the following are added in 2.6
3020
+ hasDynamicKeys, contentHashKey) {
3021
+ res = res || {
3022
+ $stable: !hasDynamicKeys
3023
+ };
3024
+
3025
+ for (var i = 0; i < fns.length; i++) {
3026
+ var slot = fns[i];
3027
+
3028
+ if (Array.isArray(slot)) {
3029
+ resolveScopedSlots(slot, res, hasDynamicKeys);
3030
+ } else if (slot) {
3031
+ // marker for reverse proxying v-slot without scope on this.$slots
3032
+ if (slot.proxy) {
3033
+ slot.fn.proxy = true;
3034
+ }
3035
+
3036
+ res[slot.key] = slot.fn;
3037
+ }
3038
+ }
3039
+
3040
+ if (contentHashKey) {
3041
+ res.$key = contentHashKey;
3042
+ }
3043
+
3044
+ return res;
3045
+ }
3046
+ /* */
3047
+
3048
+
3049
+ function bindDynamicKeys(baseObj, values) {
3050
+ for (var i = 0; i < values.length; i += 2) {
3051
+ var key = values[i];
3052
+
3053
+ if (typeof key === 'string' && key) {
3054
+ baseObj[values[i]] = values[i + 1];
3055
+ } else if ("development" !== 'production' && key !== '' && key !== null) {
3056
+ // null is a special value for explicitly removing a binding
3057
+ warn("Invalid value for dynamic directive argument (expected string or null): " + key, this);
3058
+ }
3059
+ }
3060
+
3061
+ return baseObj;
3062
+ } // helper to dynamically append modifier runtime markers to event names.
3063
+ // ensure only append when value is already string, otherwise it will be cast
3064
+ // to string and cause the type check to miss.
3065
+
3066
+
3067
+ function prependModifier(value, symbol) {
3068
+ return typeof value === 'string' ? symbol + value : value;
3069
+ }
3070
+ /* */
3071
+
3072
+
3073
+ function installRenderHelpers(target) {
3074
+ target._o = markOnce;
3075
+ target._n = toNumber;
3076
+ target._s = toString;
3077
+ target._l = renderList;
3078
+ target._t = renderSlot;
3079
+ target._q = looseEqual;
3080
+ target._i = looseIndexOf;
3081
+ target._m = renderStatic;
3082
+ target._f = resolveFilter;
3083
+ target._k = checkKeyCodes;
3084
+ target._b = bindObjectProps;
3085
+ target._v = createTextVNode;
3086
+ target._e = createEmptyVNode;
3087
+ target._u = resolveScopedSlots;
3088
+ target._g = bindObjectListeners;
3089
+ target._d = bindDynamicKeys;
3090
+ target._p = prependModifier;
3091
+ }
3092
+ /* */
3093
+
3094
+
3095
+ function FunctionalRenderContext(data, props, children, parent, Ctor) {
3096
+ var this$1 = this;
3097
+ var options = Ctor.options; // ensure the createElement function in functional components
3098
+ // gets a unique context - this is necessary for correct named slot check
3099
+
3100
+ var contextVm;
3101
+
3102
+ if (hasOwn(parent, '_uid')) {
3103
+ contextVm = Object.create(parent); // $flow-disable-line
3104
+
3105
+ contextVm._original = parent;
3106
+ } else {
3107
+ // the context vm passed in is a functional context as well.
3108
+ // in this case we want to make sure we are able to get a hold to the
3109
+ // real context instance.
3110
+ contextVm = parent; // $flow-disable-line
3111
+
3112
+ parent = parent._original;
3113
+ }
3114
+
3115
+ var isCompiled = isTrue(options._compiled);
3116
+ var needNormalization = !isCompiled;
3117
+ this.data = data;
3118
+ this.props = props;
3119
+ this.children = children;
3120
+ this.parent = parent;
3121
+ this.listeners = data.on || emptyObject;
3122
+ this.injections = resolveInject(options.inject, parent);
3123
+
3124
+ this.slots = function () {
3125
+ if (!this$1.$slots) {
3126
+ normalizeScopedSlots(data.scopedSlots, this$1.$slots = resolveSlots(children, parent));
3127
+ }
3128
+
3129
+ return this$1.$slots;
3130
+ };
3131
+
3132
+ Object.defineProperty(this, 'scopedSlots', {
3133
+ enumerable: true,
3134
+ get: function get() {
3135
+ return normalizeScopedSlots(data.scopedSlots, this.slots());
3136
+ }
3137
+ }); // support for compiled functional template
3138
+
3139
+ if (isCompiled) {
3140
+ // exposing $options for renderStatic()
3141
+ this.$options = options; // pre-resolve slots for renderSlot()
3142
+
3143
+ this.$slots = this.slots();
3144
+ this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
3145
+ }
3146
+
3147
+ if (options._scopeId) {
3148
+ this._c = function (a, b, c, d) {
3149
+ var vnode = createElement(contextVm, a, b, c, d, needNormalization);
3150
+
3151
+ if (vnode && !Array.isArray(vnode)) {
3152
+ vnode.fnScopeId = options._scopeId;
3153
+ vnode.fnContext = parent;
3154
+ }
3155
+
3156
+ return vnode;
3157
+ };
3158
+ } else {
3159
+ this._c = function (a, b, c, d) {
3160
+ return createElement(contextVm, a, b, c, d, needNormalization);
3161
+ };
3162
+ }
3163
+ }
3164
+
3165
+ installRenderHelpers(FunctionalRenderContext.prototype);
3166
+
3167
+ function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
3168
+ var options = Ctor.options;
3169
+ var props = {};
3170
+ var propOptions = options.props;
3171
+
3172
+ if (isDef(propOptions)) {
3173
+ for (var key in propOptions) {
3174
+ props[key] = validateProp(key, propOptions, propsData || emptyObject);
3175
+ }
3176
+ } else {
3177
+ if (isDef(data.attrs)) {
3178
+ mergeProps(props, data.attrs);
3179
+ }
3180
+
3181
+ if (isDef(data.props)) {
3182
+ mergeProps(props, data.props);
3183
+ }
3184
+ }
3185
+
3186
+ var renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
3187
+ var vnode = options.render.call(null, renderContext._c, renderContext);
3188
+
3189
+ if (vnode instanceof VNode) {
3190
+ return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
3191
+ } else if (Array.isArray(vnode)) {
3192
+ var vnodes = normalizeChildren(vnode) || [];
3193
+ var res = new Array(vnodes.length);
3194
+
3195
+ for (var i = 0; i < vnodes.length; i++) {
3196
+ res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
3197
+ }
3198
+
3199
+ return res;
3200
+ }
3201
+ }
3202
+
3203
+ function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
3204
+ // #7817 clone node before setting fnContext, otherwise if the node is reused
3205
+ // (e.g. it was from a cached normal slot) the fnContext causes named slots
3206
+ // that should not be matched to match.
3207
+ var clone = cloneVNode(vnode);
3208
+ clone.fnContext = contextVm;
3209
+ clone.fnOptions = options;
3210
+
3211
+ if ("development" !== 'production') {
3212
+ (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
3213
+ }
3214
+
3215
+ if (data.slot) {
3216
+ (clone.data || (clone.data = {})).slot = data.slot;
3217
+ }
3218
+
3219
+ return clone;
3220
+ }
3221
+
3222
+ function mergeProps(to, from) {
3223
+ for (var key in from) {
3224
+ to[camelize(key)] = from[key];
3225
+ }
3226
+ }
3227
+ /* */
3228
+
3229
+ /* */
3230
+
3231
+ /* */
3232
+
3233
+ /* */
3234
+ // inline hooks to be invoked on component VNodes during patch
3235
+
3236
+
3237
+ var componentVNodeHooks = {
3238
+ init: function init(vnode, hydrating) {
3239
+ if (vnode.componentInstance && !vnode.componentInstance._isDestroyed && vnode.data.keepAlive) {
3240
+ // kept-alive components, treat as a patch
3241
+ var mountedNode = vnode; // work around flow
3242
+
3243
+ componentVNodeHooks.prepatch(mountedNode, mountedNode);
3244
+ } else {
3245
+ var child = vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance);
3246
+ child.$mount(hydrating ? vnode.elm : undefined, hydrating);
3247
+ }
3248
+ },
3249
+ prepatch: function prepatch(oldVnode, vnode) {
3250
+ var options = vnode.componentOptions;
3251
+ var child = vnode.componentInstance = oldVnode.componentInstance;
3252
+ updateChildComponent(child, options.propsData, // updated props
3253
+ options.listeners, // updated listeners
3254
+ vnode, // new parent vnode
3255
+ options.children // new children
3256
+ );
3257
+ },
3258
+ insert: function insert(vnode) {
3259
+ var context = vnode.context;
3260
+ var componentInstance = vnode.componentInstance;
3261
+
3262
+ if (!componentInstance._isMounted) {
3263
+ componentInstance._isMounted = true;
3264
+ callHook(componentInstance, 'mounted');
3265
+ }
3266
+
3267
+ if (vnode.data.keepAlive) {
3268
+ if (context._isMounted) {
3269
+ // vue-router#1212
3270
+ // During updates, a kept-alive component's child components may
3271
+ // change, so directly walking the tree here may call activated hooks
3272
+ // on incorrect children. Instead we push them into a queue which will
3273
+ // be processed after the whole patch process ended.
3274
+ queueActivatedComponent(componentInstance);
3275
+ } else {
3276
+ activateChildComponent(componentInstance, true
3277
+ /* direct */
3278
+ );
3279
+ }
3280
+ }
3281
+ },
3282
+ destroy: function destroy(vnode) {
3283
+ var componentInstance = vnode.componentInstance;
3284
+
3285
+ if (!componentInstance._isDestroyed) {
3286
+ if (!vnode.data.keepAlive) {
3287
+ componentInstance.$destroy();
3288
+ } else {
3289
+ deactivateChildComponent(componentInstance, true
3290
+ /* direct */
3291
+ );
3292
+ }
3293
+ }
3294
+ }
3295
+ };
3296
+ var hooksToMerge = Object.keys(componentVNodeHooks);
3297
+
3298
+ function createComponent(Ctor, data, context, children, tag) {
3299
+ if (isUndef(Ctor)) {
3300
+ return;
3301
+ }
3302
+
3303
+ var baseCtor = context.$options._base; // plain options object: turn it into a constructor
3304
+
3305
+ if (isObject(Ctor)) {
3306
+ Ctor = baseCtor.extend(Ctor);
3307
+ } // if at this stage it's not a constructor or an async component factory,
3308
+ // reject.
3309
+
3310
+
3311
+ if (typeof Ctor !== 'function') {
3312
+ if ("development" !== 'production') {
3313
+ warn("Invalid Component definition: " + String(Ctor), context);
3314
+ }
3315
+
3316
+ return;
3317
+ } // async component
3318
+
3319
+
3320
+ var asyncFactory;
3321
+
3322
+ if (isUndef(Ctor.cid)) {
3323
+ asyncFactory = Ctor;
3324
+ Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
3325
+
3326
+ if (Ctor === undefined) {
3327
+ // return a placeholder node for async component, which is rendered
3328
+ // as a comment node but preserves all the raw information for the node.
3329
+ // the information will be used for async server-rendering and hydration.
3330
+ return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
3331
+ }
3332
+ }
3333
+
3334
+ data = data || {}; // resolve constructor options in case global mixins are applied after
3335
+ // component constructor creation
3336
+
3337
+ resolveConstructorOptions(Ctor); // transform component v-model data into props & events
3338
+
3339
+ if (isDef(data.model)) {
3340
+ transformModel(Ctor.options, data);
3341
+ } // extract props
3342
+
3343
+
3344
+ var propsData = extractPropsFromVNodeData(data, Ctor, tag); // functional component
3345
+
3346
+ if (isTrue(Ctor.options.functional)) {
3347
+ return createFunctionalComponent(Ctor, propsData, data, context, children);
3348
+ } // extract listeners, since these needs to be treated as
3349
+ // child component listeners instead of DOM listeners
3350
+
3351
+
3352
+ var listeners = data.on; // replace with listeners with .native modifier
3353
+ // so it gets processed during parent component patch.
3354
+
3355
+ data.on = data.nativeOn;
3356
+
3357
+ if (isTrue(Ctor.options.abstract)) {
3358
+ // abstract components do not keep anything
3359
+ // other than props & listeners & slot
3360
+ // work around flow
3361
+ var slot = data.slot;
3362
+ data = {};
3363
+
3364
+ if (slot) {
3365
+ data.slot = slot;
3366
+ }
3367
+ } // install component management hooks onto the placeholder node
3368
+
3369
+
3370
+ installComponentHooks(data); // return a placeholder vnode
3371
+
3372
+ var name = Ctor.options.name || tag;
3373
+ var vnode = new VNode("vue-component-" + Ctor.cid + (name ? "-" + name : ''), data, undefined, undefined, undefined, context, {
3374
+ Ctor: Ctor,
3375
+ propsData: propsData,
3376
+ listeners: listeners,
3377
+ tag: tag,
3378
+ children: children
3379
+ }, asyncFactory);
3380
+ return vnode;
3381
+ }
3382
+
3383
+ function createComponentInstanceForVnode(vnode, // we know it's MountedComponentVNode but flow doesn't
3384
+ parent // activeInstance in lifecycle state
3385
+ ) {
3386
+ var options = {
3387
+ _isComponent: true,
3388
+ _parentVnode: vnode,
3389
+ parent: parent
3390
+ }; // check inline-template render functions
3391
+
3392
+ var inlineTemplate = vnode.data.inlineTemplate;
3393
+
3394
+ if (isDef(inlineTemplate)) {
3395
+ options.render = inlineTemplate.render;
3396
+ options.staticRenderFns = inlineTemplate.staticRenderFns;
3397
+ }
3398
+
3399
+ return new vnode.componentOptions.Ctor(options);
3400
+ }
3401
+
3402
+ function installComponentHooks(data) {
3403
+ var hooks = data.hook || (data.hook = {});
3404
+
3405
+ for (var i = 0; i < hooksToMerge.length; i++) {
3406
+ var key = hooksToMerge[i];
3407
+ var existing = hooks[key];
3408
+ var toMerge = componentVNodeHooks[key];
3409
+
3410
+ if (existing !== toMerge && !(existing && existing._merged)) {
3411
+ hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
3412
+ }
3413
+ }
3414
+ }
3415
+
3416
+ function mergeHook$1(f1, f2) {
3417
+ var merged = function (a, b) {
3418
+ // flow complains about extra args which is why we use any
3419
+ f1(a, b);
3420
+ f2(a, b);
3421
+ };
3422
+
3423
+ merged._merged = true;
3424
+ return merged;
3425
+ } // transform component v-model info (value and callback) into
3426
+ // prop and event handler respectively.
3427
+
3428
+
3429
+ function transformModel(options, data) {
3430
+ var prop = options.model && options.model.prop || 'value';
3431
+ var event = options.model && options.model.event || 'input';
3432
+ (data.attrs || (data.attrs = {}))[prop] = data.model.value;
3433
+ var on = data.on || (data.on = {});
3434
+ var existing = on[event];
3435
+ var callback = data.model.callback;
3436
+
3437
+ if (isDef(existing)) {
3438
+ if (Array.isArray(existing) ? existing.indexOf(callback) === -1 : existing !== callback) {
3439
+ on[event] = [callback].concat(existing);
3440
+ }
3441
+ } else {
3442
+ on[event] = callback;
3443
+ }
3444
+ }
3445
+ /* */
3446
+
3447
+
3448
+ var SIMPLE_NORMALIZE = 1;
3449
+ var ALWAYS_NORMALIZE = 2; // wrapper function for providing a more flexible interface
3450
+ // without getting yelled at by flow
3451
+
3452
+ function createElement(context, tag, data, children, normalizationType, alwaysNormalize) {
3453
+ if (Array.isArray(data) || isPrimitive(data)) {
3454
+ normalizationType = children;
3455
+ children = data;
3456
+ data = undefined;
3457
+ }
3458
+
3459
+ if (isTrue(alwaysNormalize)) {
3460
+ normalizationType = ALWAYS_NORMALIZE;
3461
+ }
3462
+
3463
+ return _createElement(context, tag, data, children, normalizationType);
3464
+ }
3465
+
3466
+ function _createElement(context, tag, data, children, normalizationType) {
3467
+ if (isDef(data) && isDef(data.__ob__)) {
3468
+ "development" !== 'production' && warn("Avoid using observed data object as vnode data: " + JSON.stringify(data) + "\n" + 'Always create fresh vnode data objects in each render!', context);
3469
+ return createEmptyVNode();
3470
+ } // object syntax in v-bind
3471
+
3472
+
3473
+ if (isDef(data) && isDef(data.is)) {
3474
+ tag = data.is;
3475
+ }
3476
+
3477
+ if (!tag) {
3478
+ // in case of component :is set to falsy value
3479
+ return createEmptyVNode();
3480
+ } // warn against non-primitive key
3481
+
3482
+
3483
+ if ("development" !== 'production' && isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
3484
+ {
3485
+ warn('Avoid using non-primitive value as key, ' + 'use string/number value instead.', context);
3486
+ }
3487
+ } // support single function children as default scoped slot
3488
+
3489
+
3490
+ if (Array.isArray(children) && typeof children[0] === 'function') {
3491
+ data = data || {};
3492
+ data.scopedSlots = {
3493
+ default: children[0]
3494
+ };
3495
+ children.length = 0;
3496
+ }
3497
+
3498
+ if (normalizationType === ALWAYS_NORMALIZE) {
3499
+ children = normalizeChildren(children);
3500
+ } else if (normalizationType === SIMPLE_NORMALIZE) {
3501
+ children = simpleNormalizeChildren(children);
3502
+ }
3503
+
3504
+ var vnode, ns;
3505
+
3506
+ if (typeof tag === 'string') {
3507
+ var Ctor;
3508
+ ns = context.$vnode && context.$vnode.ns || config.getTagNamespace(tag);
3509
+
3510
+ if (config.isReservedTag(tag)) {
3511
+ // platform built-in elements
3512
+ if ("development" !== 'production' && isDef(data) && isDef(data.nativeOn)) {
3513
+ warn("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">.", context);
3514
+ }
3515
+
3516
+ vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context);
3517
+ } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
3518
+ // component
3519
+ vnode = createComponent(Ctor, data, context, children, tag);
3520
+ } else {
3521
+ // unknown or unlisted namespaced elements
3522
+ // check at runtime because it may get assigned a namespace when its
3523
+ // parent normalizes children
3524
+ vnode = new VNode(tag, data, children, undefined, undefined, context);
3525
+ }
3526
+ } else {
3527
+ // direct component options / constructor
3528
+ vnode = createComponent(tag, data, context, children);
3529
+ }
3530
+
3531
+ if (Array.isArray(vnode)) {
3532
+ return vnode;
3533
+ } else if (isDef(vnode)) {
3534
+ if (isDef(ns)) {
3535
+ applyNS(vnode, ns);
3536
+ }
3537
+
3538
+ if (isDef(data)) {
3539
+ registerDeepBindings(data);
3540
+ }
3541
+
3542
+ return vnode;
3543
+ } else {
3544
+ return createEmptyVNode();
3545
+ }
3546
+ }
3547
+
3548
+ function applyNS(vnode, ns, force) {
3549
+ vnode.ns = ns;
3550
+
3551
+ if (vnode.tag === 'foreignObject') {
3552
+ // use default namespace inside foreignObject
3553
+ ns = undefined;
3554
+ force = true;
3555
+ }
3556
+
3557
+ if (isDef(vnode.children)) {
3558
+ for (var i = 0, l = vnode.children.length; i < l; i++) {
3559
+ var child = vnode.children[i];
3560
+
3561
+ if (isDef(child.tag) && (isUndef(child.ns) || isTrue(force) && child.tag !== 'svg')) {
3562
+ applyNS(child, ns, force);
3563
+ }
3564
+ }
3565
+ }
3566
+ } // ref #5318
3567
+ // necessary to ensure parent re-render when deep bindings like :style and
3568
+ // :class are used on slot nodes
3569
+
3570
+
3571
+ function registerDeepBindings(data) {
3572
+ if (isObject(data.style)) {
3573
+ traverse(data.style);
3574
+ }
3575
+
3576
+ if (isObject(data.class)) {
3577
+ traverse(data.class);
3578
+ }
3579
+ }
3580
+ /* */
3581
+
3582
+
3583
+ function initRender(vm) {
3584
+ vm._vnode = null; // the root of the child tree
3585
+
3586
+ vm._staticTrees = null; // v-once cached trees
3587
+
3588
+ var options = vm.$options;
3589
+ var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
3590
+
3591
+ var renderContext = parentVnode && parentVnode.context;
3592
+ vm.$slots = resolveSlots(options._renderChildren, renderContext);
3593
+ vm.$scopedSlots = emptyObject; // bind the createElement fn to this instance
3594
+ // so that we get proper render context inside it.
3595
+ // args order: tag, data, children, normalizationType, alwaysNormalize
3596
+ // internal version is used by render functions compiled from templates
3597
+
3598
+ vm._c = function (a, b, c, d) {
3599
+ return createElement(vm, a, b, c, d, false);
3600
+ }; // normalization is always applied for the public version, used in
3601
+ // user-written render functions.
3602
+
3603
+
3604
+ vm.$createElement = function (a, b, c, d) {
3605
+ return createElement(vm, a, b, c, d, true);
3606
+ }; // $attrs & $listeners are exposed for easier HOC creation.
3607
+ // they need to be reactive so that HOCs using them are always updated
3608
+
3609
+
3610
+ var parentData = parentVnode && parentVnode.data;
3611
+ /* istanbul ignore else */
3612
+
3613
+ if ("development" !== 'production') {
3614
+ defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
3615
+ !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
3616
+ }, true);
3617
+ defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
3618
+ !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
3619
+ }, true);
3620
+ } else {
3621
+ defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
3622
+ defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
3623
+ }
3624
+ }
3625
+
3626
+ var currentRenderingInstance = null;
3627
+
3628
+ function renderMixin(Vue) {
3629
+ // install runtime convenience helpers
3630
+ installRenderHelpers(Vue.prototype);
3631
+
3632
+ Vue.prototype.$nextTick = function (fn) {
3633
+ return nextTick(fn, this);
3634
+ };
3635
+
3636
+ Vue.prototype._render = function () {
3637
+ var vm = this;
3638
+ var ref = vm.$options;
3639
+ var render = ref.render;
3640
+ var _parentVnode = ref._parentVnode;
3641
+
3642
+ if (_parentVnode) {
3643
+ vm.$scopedSlots = normalizeScopedSlots(_parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
3644
+ } // set parent vnode. this allows render functions to have access
3645
+ // to the data on the placeholder node.
3646
+
3647
+
3648
+ vm.$vnode = _parentVnode; // render self
3649
+
3650
+ var vnode;
3651
+
3652
+ try {
3653
+ // There's no need to maintain a stack because all render fns are called
3654
+ // separately from one another. Nested component's render fns are called
3655
+ // when parent component is patched.
3656
+ currentRenderingInstance = vm;
3657
+ vnode = render.call(vm._renderProxy, vm.$createElement);
3658
+ } catch (e) {
3659
+ handleError(e, vm, "render"); // return error render result,
3660
+ // or previous vnode to prevent render error causing blank component
3661
+
3662
+ /* istanbul ignore else */
3663
+
3664
+ if ("development" !== 'production' && vm.$options.renderError) {
3665
+ try {
3666
+ vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
3667
+ } catch (e) {
3668
+ handleError(e, vm, "renderError");
3669
+ vnode = vm._vnode;
3670
+ }
3671
+ } else {
3672
+ vnode = vm._vnode;
3673
+ }
3674
+ } finally {
3675
+ currentRenderingInstance = null;
3676
+ } // if the returned array contains only a single node, allow it
3677
+
3678
+
3679
+ if (Array.isArray(vnode) && vnode.length === 1) {
3680
+ vnode = vnode[0];
3681
+ } // return empty vnode in case the render function errored out
3682
+
3683
+
3684
+ if (!(vnode instanceof VNode)) {
3685
+ if ("development" !== 'production' && Array.isArray(vnode)) {
3686
+ warn('Multiple root nodes returned from render function. Render function ' + 'should return a single root node.', vm);
3687
+ }
3688
+
3689
+ vnode = createEmptyVNode();
3690
+ } // set parent
3691
+
3692
+
3693
+ vnode.parent = _parentVnode;
3694
+ return vnode;
3695
+ };
3696
+ }
3697
+ /* */
3698
+
3699
+
3700
+ function ensureCtor(comp, base) {
3701
+ if (comp.__esModule || hasSymbol && comp[Symbol.toStringTag] === 'Module') {
3702
+ comp = comp.default;
3703
+ }
3704
+
3705
+ return isObject(comp) ? base.extend(comp) : comp;
3706
+ }
3707
+
3708
+ function createAsyncPlaceholder(factory, data, context, children, tag) {
3709
+ var node = createEmptyVNode();
3710
+ node.asyncFactory = factory;
3711
+ node.asyncMeta = {
3712
+ data: data,
3713
+ context: context,
3714
+ children: children,
3715
+ tag: tag
3716
+ };
3717
+ return node;
3718
+ }
3719
+
3720
+ function resolveAsyncComponent(factory, baseCtor) {
3721
+ if (isTrue(factory.error) && isDef(factory.errorComp)) {
3722
+ return factory.errorComp;
3723
+ }
3724
+
3725
+ if (isDef(factory.resolved)) {
3726
+ return factory.resolved;
3727
+ }
3728
+
3729
+ var owner = currentRenderingInstance;
3730
+
3731
+ if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3732
+ // already pending
3733
+ factory.owners.push(owner);
3734
+ }
3735
+
3736
+ if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3737
+ return factory.loadingComp;
3738
+ }
3739
+
3740
+ if (owner && !isDef(factory.owners)) {
3741
+ var owners = factory.owners = [owner];
3742
+ var sync = true;
3743
+ var timerLoading = null;
3744
+ var timerTimeout = null;
3745
+ owner.$on('hook:destroyed', function () {
3746
+ return remove(owners, owner);
3747
+ });
3748
+
3749
+ var forceRender = function (renderCompleted) {
3750
+ for (var i = 0, l = owners.length; i < l; i++) {
3751
+ owners[i].$forceUpdate();
3752
+ }
3753
+
3754
+ if (renderCompleted) {
3755
+ owners.length = 0;
3756
+
3757
+ if (timerLoading !== null) {
3758
+ clearTimeout(timerLoading);
3759
+ timerLoading = null;
3760
+ }
3761
+
3762
+ if (timerTimeout !== null) {
3763
+ clearTimeout(timerTimeout);
3764
+ timerTimeout = null;
3765
+ }
3766
+ }
3767
+ };
3768
+
3769
+ var resolve = once(function (res) {
3770
+ // cache resolved
3771
+ factory.resolved = ensureCtor(res, baseCtor); // invoke callbacks only if this is not a synchronous resolve
3772
+ // (async resolves are shimmed as synchronous during SSR)
3773
+
3774
+ if (!sync) {
3775
+ forceRender(true);
3776
+ } else {
3777
+ owners.length = 0;
3778
+ }
3779
+ });
3780
+ var reject = once(function (reason) {
3781
+ "development" !== 'production' && warn("Failed to resolve async component: " + String(factory) + (reason ? "\nReason: " + reason : ''));
3782
+
3783
+ if (isDef(factory.errorComp)) {
3784
+ factory.error = true;
3785
+ forceRender(true);
3786
+ }
3787
+ });
3788
+ var res = factory(resolve, reject);
3789
+
3790
+ if (isObject(res)) {
3791
+ if (isPromise(res)) {
3792
+ // () => Promise
3793
+ if (isUndef(factory.resolved)) {
3794
+ res.then(resolve, reject);
3795
+ }
3796
+ } else if (isPromise(res.component)) {
3797
+ res.component.then(resolve, reject);
3798
+
3799
+ if (isDef(res.error)) {
3800
+ factory.errorComp = ensureCtor(res.error, baseCtor);
3801
+ }
3802
+
3803
+ if (isDef(res.loading)) {
3804
+ factory.loadingComp = ensureCtor(res.loading, baseCtor);
3805
+
3806
+ if (res.delay === 0) {
3807
+ factory.loading = true;
3808
+ } else {
3809
+ timerLoading = setTimeout(function () {
3810
+ timerLoading = null;
3811
+
3812
+ if (isUndef(factory.resolved) && isUndef(factory.error)) {
3813
+ factory.loading = true;
3814
+ forceRender(false);
3815
+ }
3816
+ }, res.delay || 200);
3817
+ }
3818
+ }
3819
+
3820
+ if (isDef(res.timeout)) {
3821
+ timerTimeout = setTimeout(function () {
3822
+ timerTimeout = null;
3823
+
3824
+ if (isUndef(factory.resolved)) {
3825
+ reject("development" !== 'production' ? "timeout (" + res.timeout + "ms)" : null);
3826
+ }
3827
+ }, res.timeout);
3828
+ }
3829
+ }
3830
+ }
3831
+
3832
+ sync = false; // return in case resolved synchronously
3833
+
3834
+ return factory.loading ? factory.loadingComp : factory.resolved;
3835
+ }
3836
+ }
3837
+ /* */
3838
+
3839
+
3840
+ function isAsyncPlaceholder(node) {
3841
+ return node.isComment && node.asyncFactory;
3842
+ }
3843
+ /* */
3844
+
3845
+
3846
+ function getFirstComponentChild(children) {
3847
+ if (Array.isArray(children)) {
3848
+ for (var i = 0; i < children.length; i++) {
3849
+ var c = children[i];
3850
+
3851
+ if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
3852
+ return c;
3853
+ }
3854
+ }
3855
+ }
3856
+ }
3857
+ /* */
3858
+
3859
+ /* */
3860
+
3861
+
3862
+ function initEvents(vm) {
3863
+ vm._events = Object.create(null);
3864
+ vm._hasHookEvent = false; // init parent attached events
3865
+
3866
+ var listeners = vm.$options._parentListeners;
3867
+
3868
+ if (listeners) {
3869
+ updateComponentListeners(vm, listeners);
3870
+ }
3871
+ }
3872
+
3873
+ var target;
3874
+
3875
+ function add(event, fn) {
3876
+ target.$on(event, fn);
3877
+ }
3878
+
3879
+ function remove$1(event, fn) {
3880
+ target.$off(event, fn);
3881
+ }
3882
+
3883
+ function createOnceHandler(event, fn) {
3884
+ var _target = target;
3885
+ return function onceHandler() {
3886
+ var res = fn.apply(null, arguments);
3887
+
3888
+ if (res !== null) {
3889
+ _target.$off(event, onceHandler);
3890
+ }
3891
+ };
3892
+ }
3893
+
3894
+ function updateComponentListeners(vm, listeners, oldListeners) {
3895
+ target = vm;
3896
+ updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
3897
+ target = undefined;
3898
+ }
3899
+
3900
+ function eventsMixin(Vue) {
3901
+ var hookRE = /^hook:/;
3902
+
3903
+ Vue.prototype.$on = function (event, fn) {
3904
+ var vm = this;
3905
+
3906
+ if (Array.isArray(event)) {
3907
+ for (var i = 0, l = event.length; i < l; i++) {
3908
+ vm.$on(event[i], fn);
3909
+ }
3910
+ } else {
3911
+ (vm._events[event] || (vm._events[event] = [])).push(fn); // optimize hook:event cost by using a boolean flag marked at registration
3912
+ // instead of a hash lookup
3913
+
3914
+ if (hookRE.test(event)) {
3915
+ vm._hasHookEvent = true;
3916
+ }
3917
+ }
3918
+
3919
+ return vm;
3920
+ };
3921
+
3922
+ Vue.prototype.$once = function (event, fn) {
3923
+ var vm = this;
3924
+
3925
+ function on() {
3926
+ vm.$off(event, on);
3927
+ fn.apply(vm, arguments);
3928
+ }
3929
+
3930
+ on.fn = fn;
3931
+ vm.$on(event, on);
3932
+ return vm;
3933
+ };
3934
+
3935
+ Vue.prototype.$off = function (event, fn) {
3936
+ var vm = this; // all
3937
+
3938
+ if (!arguments.length) {
3939
+ vm._events = Object.create(null);
3940
+ return vm;
3941
+ } // array of events
3942
+
3943
+
3944
+ if (Array.isArray(event)) {
3945
+ for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
3946
+ vm.$off(event[i$1], fn);
3947
+ }
3948
+
3949
+ return vm;
3950
+ } // specific event
3951
+
3952
+
3953
+ var cbs = vm._events[event];
3954
+
3955
+ if (!cbs) {
3956
+ return vm;
3957
+ }
3958
+
3959
+ if (!fn) {
3960
+ vm._events[event] = null;
3961
+ return vm;
3962
+ } // specific handler
3963
+
3964
+
3965
+ var cb;
3966
+ var i = cbs.length;
3967
+
3968
+ while (i--) {
3969
+ cb = cbs[i];
3970
+
3971
+ if (cb === fn || cb.fn === fn) {
3972
+ cbs.splice(i, 1);
3973
+ break;
3974
+ }
3975
+ }
3976
+
3977
+ return vm;
3978
+ };
3979
+
3980
+ Vue.prototype.$emit = function (event) {
3981
+ var vm = this;
3982
+
3983
+ if ("development" !== 'production') {
3984
+ var lowerCaseEvent = event.toLowerCase();
3985
+
3986
+ if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
3987
+ tip("Event \"" + lowerCaseEvent + "\" is emitted in component " + formatComponentName(vm) + " but the handler is registered for \"" + event + "\". " + "Note that HTML attributes are case-insensitive and you cannot use " + "v-on to listen to camelCase events when using in-DOM templates. " + "You should probably use \"" + hyphenate(event) + "\" instead of \"" + event + "\".");
3988
+ }
3989
+ }
3990
+
3991
+ var cbs = vm._events[event];
3992
+
3993
+ if (cbs) {
3994
+ cbs = cbs.length > 1 ? toArray(cbs) : cbs;
3995
+ var args = toArray(arguments, 1);
3996
+ var info = "event handler for \"" + event + "\"";
3997
+
3998
+ for (var i = 0, l = cbs.length; i < l; i++) {
3999
+ invokeWithErrorHandling(cbs[i], vm, args, vm, info);
4000
+ }
4001
+ }
4002
+
4003
+ return vm;
4004
+ };
4005
+ }
4006
+ /* */
4007
+
4008
+
4009
+ var activeInstance = null;
4010
+ var isUpdatingChildComponent = false;
4011
+
4012
+ function setActiveInstance(vm) {
4013
+ var prevActiveInstance = activeInstance;
4014
+ activeInstance = vm;
4015
+ return function () {
4016
+ activeInstance = prevActiveInstance;
4017
+ };
4018
+ }
4019
+
4020
+ function initLifecycle(vm) {
4021
+ var options = vm.$options; // locate first non-abstract parent
4022
+
4023
+ var parent = options.parent;
4024
+
4025
+ if (parent && !options.abstract) {
4026
+ while (parent.$options.abstract && parent.$parent) {
4027
+ parent = parent.$parent;
4028
+ }
4029
+
4030
+ parent.$children.push(vm);
4031
+ }
4032
+
4033
+ vm.$parent = parent;
4034
+ vm.$root = parent ? parent.$root : vm;
4035
+ vm.$children = [];
4036
+ vm.$refs = {};
4037
+ vm._watcher = null;
4038
+ vm._inactive = null;
4039
+ vm._directInactive = false;
4040
+ vm._isMounted = false;
4041
+ vm._isDestroyed = false;
4042
+ vm._isBeingDestroyed = false;
4043
+ }
4044
+
4045
+ function lifecycleMixin(Vue) {
4046
+ Vue.prototype._update = function (vnode, hydrating) {
4047
+ var vm = this;
4048
+ var prevEl = vm.$el;
4049
+ var prevVnode = vm._vnode;
4050
+ var restoreActiveInstance = setActiveInstance(vm);
4051
+ vm._vnode = vnode; // Vue.prototype.__patch__ is injected in entry points
4052
+ // based on the rendering backend used.
4053
+
4054
+ if (!prevVnode) {
4055
+ // initial render
4056
+ vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false
4057
+ /* removeOnly */
4058
+ );
4059
+ } else {
4060
+ // updates
4061
+ vm.$el = vm.__patch__(prevVnode, vnode);
4062
+ }
4063
+
4064
+ restoreActiveInstance(); // update __vue__ reference
4065
+
4066
+ if (prevEl) {
4067
+ prevEl.__vue__ = null;
4068
+ }
4069
+
4070
+ if (vm.$el) {
4071
+ vm.$el.__vue__ = vm;
4072
+ } // if parent is an HOC, update its $el as well
4073
+
4074
+
4075
+ if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
4076
+ vm.$parent.$el = vm.$el;
4077
+ } // updated hook is called by the scheduler to ensure that children are
4078
+ // updated in a parent's updated hook.
4079
+
4080
+ };
4081
+
4082
+ Vue.prototype.$forceUpdate = function () {
4083
+ var vm = this;
4084
+
4085
+ if (vm._watcher) {
4086
+ vm._watcher.update();
4087
+ }
4088
+ };
4089
+
4090
+ Vue.prototype.$destroy = function () {
4091
+ var vm = this;
4092
+
4093
+ if (vm._isBeingDestroyed) {
4094
+ return;
4095
+ }
4096
+
4097
+ callHook(vm, 'beforeDestroy');
4098
+ vm._isBeingDestroyed = true; // remove self from parent
4099
+
4100
+ var parent = vm.$parent;
4101
+
4102
+ if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
4103
+ remove(parent.$children, vm);
4104
+ } // teardown watchers
4105
+
4106
+
4107
+ if (vm._watcher) {
4108
+ vm._watcher.teardown();
4109
+ }
4110
+
4111
+ var i = vm._watchers.length;
4112
+
4113
+ while (i--) {
4114
+ vm._watchers[i].teardown();
4115
+ } // remove reference from data ob
4116
+ // frozen object may not have observer.
4117
+
4118
+
4119
+ if (vm._data.__ob__) {
4120
+ vm._data.__ob__.vmCount--;
4121
+ } // call the last hook...
4122
+
4123
+
4124
+ vm._isDestroyed = true; // invoke destroy hooks on current rendered tree
4125
+
4126
+ vm.__patch__(vm._vnode, null); // fire destroyed hook
4127
+
4128
+
4129
+ callHook(vm, 'destroyed'); // turn off all instance listeners.
4130
+
4131
+ vm.$off(); // remove __vue__ reference
4132
+
4133
+ if (vm.$el) {
4134
+ vm.$el.__vue__ = null;
4135
+ } // release circular reference (#6759)
4136
+
4137
+
4138
+ if (vm.$vnode) {
4139
+ vm.$vnode.parent = null;
4140
+ }
4141
+ };
4142
+ }
4143
+
4144
+ function mountComponent(vm, el, hydrating) {
4145
+ vm.$el = el;
4146
+
4147
+ if (!vm.$options.render) {
4148
+ vm.$options.render = createEmptyVNode;
4149
+
4150
+ if ("development" !== 'production') {
4151
+ /* istanbul ignore if */
4152
+ if (vm.$options.template && vm.$options.template.charAt(0) !== '#' || vm.$options.el || el) {
4153
+ warn('You are using the runtime-only build of Vue where the template ' + 'compiler is not available. Either pre-compile the templates into ' + 'render functions, or use the compiler-included build.', vm);
4154
+ } else {
4155
+ warn('Failed to mount component: template or render function not defined.', vm);
4156
+ }
4157
+ }
4158
+ }
4159
+
4160
+ callHook(vm, 'beforeMount');
4161
+ var updateComponent;
4162
+ /* istanbul ignore if */
4163
+
4164
+ if ("development" !== 'production' && config.performance && mark) {
4165
+ updateComponent = function () {
4166
+ var name = vm._name;
4167
+ var id = vm._uid;
4168
+ var startTag = "vue-perf-start:" + id;
4169
+ var endTag = "vue-perf-end:" + id;
4170
+ mark(startTag);
4171
+
4172
+ var vnode = vm._render();
4173
+
4174
+ mark(endTag);
4175
+ measure("vue " + name + " render", startTag, endTag);
4176
+ mark(startTag);
4177
+
4178
+ vm._update(vnode, hydrating);
4179
+
4180
+ mark(endTag);
4181
+ measure("vue " + name + " patch", startTag, endTag);
4182
+ };
4183
+ } else {
4184
+ updateComponent = function () {
4185
+ vm._update(vm._render(), hydrating);
4186
+ };
4187
+ } // we set this to vm._watcher inside the watcher's constructor
4188
+ // since the watcher's initial patch may call $forceUpdate (e.g. inside child
4189
+ // component's mounted hook), which relies on vm._watcher being already defined
4190
+
4191
+
4192
+ new Watcher(vm, updateComponent, noop, {
4193
+ before: function before() {
4194
+ if (vm._isMounted && !vm._isDestroyed) {
4195
+ callHook(vm, 'beforeUpdate');
4196
+ }
4197
+ }
4198
+ }, true
4199
+ /* isRenderWatcher */
4200
+ );
4201
+ hydrating = false; // manually mounted instance, call mounted on self
4202
+ // mounted is called for render-created child components in its inserted hook
4203
+
4204
+ if (vm.$vnode == null) {
4205
+ vm._isMounted = true;
4206
+ callHook(vm, 'mounted');
4207
+ }
4208
+
4209
+ return vm;
4210
+ }
4211
+
4212
+ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
4213
+ if ("development" !== 'production') {
4214
+ isUpdatingChildComponent = true;
4215
+ } // determine whether component has slot children
4216
+ // we need to do this before overwriting $options._renderChildren.
4217
+ // check if there are dynamic scopedSlots (hand-written or compiled but with
4218
+ // dynamic slot names). Static scoped slots compiled from template has the
4219
+ // "$stable" marker.
4220
+
4221
+
4222
+ var newScopedSlots = parentVnode.data.scopedSlots;
4223
+ var oldScopedSlots = vm.$scopedSlots;
4224
+ var hasDynamicScopedSlot = !!(newScopedSlots && !newScopedSlots.$stable || oldScopedSlots !== emptyObject && !oldScopedSlots.$stable || newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key); // Any static slot children from the parent may have changed during parent's
4225
+ // update. Dynamic scoped slots may also have changed. In such cases, a forced
4226
+ // update is necessary to ensure correctness.
4227
+
4228
+ var needsForceUpdate = !!(renderChildren || // has new static slots
4229
+ vm.$options._renderChildren || // has old static slots
4230
+ hasDynamicScopedSlot);
4231
+ vm.$options._parentVnode = parentVnode;
4232
+ vm.$vnode = parentVnode; // update vm's placeholder node without re-render
4233
+
4234
+ if (vm._vnode) {
4235
+ // update child tree's parent
4236
+ vm._vnode.parent = parentVnode;
4237
+ }
4238
+
4239
+ vm.$options._renderChildren = renderChildren; // update $attrs and $listeners hash
4240
+ // these are also reactive so they may trigger child update if the child
4241
+ // used them during render
4242
+
4243
+ vm.$attrs = parentVnode.data.attrs || emptyObject;
4244
+ vm.$listeners = listeners || emptyObject; // update props
4245
+
4246
+ if (propsData && vm.$options.props) {
4247
+ toggleObserving(false);
4248
+ var props = vm._props;
4249
+ var propKeys = vm.$options._propKeys || [];
4250
+
4251
+ for (var i = 0; i < propKeys.length; i++) {
4252
+ var key = propKeys[i];
4253
+ var propOptions = vm.$options.props; // wtf flow?
4254
+
4255
+ props[key] = validateProp(key, propOptions, propsData, vm);
4256
+ }
4257
+
4258
+ toggleObserving(true); // keep a copy of raw propsData
4259
+
4260
+ vm.$options.propsData = propsData;
4261
+ } // update listeners
4262
+
4263
+
4264
+ listeners = listeners || emptyObject;
4265
+ var oldListeners = vm.$options._parentListeners;
4266
+ vm.$options._parentListeners = listeners;
4267
+ updateComponentListeners(vm, listeners, oldListeners); // resolve slots + force update if has children
4268
+
4269
+ if (needsForceUpdate) {
4270
+ vm.$slots = resolveSlots(renderChildren, parentVnode.context);
4271
+ vm.$forceUpdate();
4272
+ }
4273
+
4274
+ if ("development" !== 'production') {
4275
+ isUpdatingChildComponent = false;
4276
+ }
4277
+ }
4278
+
4279
+ function isInInactiveTree(vm) {
4280
+ while (vm && (vm = vm.$parent)) {
4281
+ if (vm._inactive) {
4282
+ return true;
4283
+ }
4284
+ }
4285
+
4286
+ return false;
4287
+ }
4288
+
4289
+ function activateChildComponent(vm, direct) {
4290
+ if (direct) {
4291
+ vm._directInactive = false;
4292
+
4293
+ if (isInInactiveTree(vm)) {
4294
+ return;
4295
+ }
4296
+ } else if (vm._directInactive) {
4297
+ return;
4298
+ }
4299
+
4300
+ if (vm._inactive || vm._inactive === null) {
4301
+ vm._inactive = false;
4302
+
4303
+ for (var i = 0; i < vm.$children.length; i++) {
4304
+ activateChildComponent(vm.$children[i]);
4305
+ }
4306
+
4307
+ callHook(vm, 'activated');
4308
+ }
4309
+ }
4310
+
4311
+ function deactivateChildComponent(vm, direct) {
4312
+ if (direct) {
4313
+ vm._directInactive = true;
4314
+
4315
+ if (isInInactiveTree(vm)) {
4316
+ return;
4317
+ }
4318
+ }
4319
+
4320
+ if (!vm._inactive) {
4321
+ vm._inactive = true;
4322
+
4323
+ for (var i = 0; i < vm.$children.length; i++) {
4324
+ deactivateChildComponent(vm.$children[i]);
4325
+ }
4326
+
4327
+ callHook(vm, 'deactivated');
4328
+ }
4329
+ }
4330
+
4331
+ function callHook(vm, hook) {
4332
+ // #7573 disable dep collection when invoking lifecycle hooks
4333
+ pushTarget();
4334
+ var handlers = vm.$options[hook];
4335
+ var info = hook + " hook";
4336
+
4337
+ if (handlers) {
4338
+ for (var i = 0, j = handlers.length; i < j; i++) {
4339
+ invokeWithErrorHandling(handlers[i], vm, null, vm, info);
4340
+ }
4341
+ }
4342
+
4343
+ if (vm._hasHookEvent) {
4344
+ vm.$emit('hook:' + hook);
4345
+ }
4346
+
4347
+ popTarget();
4348
+ }
4349
+ /* */
4350
+
4351
+
4352
+ var MAX_UPDATE_COUNT = 100;
4353
+ var queue = [];
4354
+ var activatedChildren = [];
4355
+ var has = {};
4356
+ var circular = {};
4357
+ var waiting = false;
4358
+ var flushing = false;
4359
+ var index = 0;
4360
+ /**
4361
+ * Reset the scheduler's state.
4362
+ */
4363
+
4364
+ function resetSchedulerState() {
4365
+ index = queue.length = activatedChildren.length = 0;
4366
+ has = {};
4367
+
4368
+ if ("development" !== 'production') {
4369
+ circular = {};
4370
+ }
4371
+
4372
+ waiting = flushing = false;
4373
+ } // Async edge case #6566 requires saving the timestamp when event listeners are
4374
+ // attached. However, calling performance.now() has a perf overhead especially
4375
+ // if the page has thousands of event listeners. Instead, we take a timestamp
4376
+ // every time the scheduler flushes and use that for all event listeners
4377
+ // attached during that flush.
4378
+
4379
+
4380
+ var currentFlushTimestamp = 0; // Async edge case fix requires storing an event listener's attach timestamp.
4381
+
4382
+ var getNow = Date.now; // Determine what event timestamp the browser is using. Annoyingly, the
4383
+ // timestamp can either be hi-res (relative to page load) or low-res
4384
+ // (relative to UNIX epoch), so in order to compare time we have to use the
4385
+ // same timestamp type when saving the flush timestamp.
4386
+ // All IE versions use low-res event timestamps, and have problematic clock
4387
+ // implementations (#9632)
4388
+
4389
+ if (inBrowser && !isIE) {
4390
+ var performance = window.performance;
4391
+
4392
+ if (performance && typeof performance.now === 'function' && getNow() > document.createEvent('Event').timeStamp) {
4393
+ // if the event timestamp, although evaluated AFTER the Date.now(), is
4394
+ // smaller than it, it means the event is using a hi-res timestamp,
4395
+ // and we need to use the hi-res version for event listener timestamps as
4396
+ // well.
4397
+ getNow = function () {
4398
+ return performance.now();
4399
+ };
4400
+ }
4401
+ }
4402
+ /**
4403
+ * Flush both queues and run the watchers.
4404
+ */
4405
+
4406
+
4407
+ function flushSchedulerQueue() {
4408
+ currentFlushTimestamp = getNow();
4409
+ flushing = true;
4410
+ var watcher, id; // Sort queue before flush.
4411
+ // This ensures that:
4412
+ // 1. Components are updated from parent to child. (because parent is always
4413
+ // created before the child)
4414
+ // 2. A component's user watchers are run before its render watcher (because
4415
+ // user watchers are created before the render watcher)
4416
+ // 3. If a component is destroyed during a parent component's watcher run,
4417
+ // its watchers can be skipped.
4418
+
4419
+ queue.sort(function (a, b) {
4420
+ return a.id - b.id;
4421
+ }); // do not cache length because more watchers might be pushed
4422
+ // as we run existing watchers
4423
+
4424
+ for (index = 0; index < queue.length; index++) {
4425
+ watcher = queue[index];
4426
+
4427
+ if (watcher.before) {
4428
+ watcher.before();
4429
+ }
4430
+
4431
+ id = watcher.id;
4432
+ has[id] = null;
4433
+ watcher.run(); // in dev build, check and stop circular updates.
4434
+
4435
+ if ("development" !== 'production' && has[id] != null) {
4436
+ circular[id] = (circular[id] || 0) + 1;
4437
+
4438
+ if (circular[id] > MAX_UPDATE_COUNT) {
4439
+ warn('You may have an infinite update loop ' + (watcher.user ? "in watcher with expression \"" + watcher.expression + "\"" : "in a component render function."), watcher.vm);
4440
+ break;
4441
+ }
4442
+ }
4443
+ } // keep copies of post queues before resetting state
4444
+
4445
+
4446
+ var activatedQueue = activatedChildren.slice();
4447
+ var updatedQueue = queue.slice();
4448
+ resetSchedulerState(); // call component updated and activated hooks
4449
+
4450
+ callActivatedHooks(activatedQueue);
4451
+ callUpdatedHooks(updatedQueue); // devtool hook
4452
+
4453
+ /* istanbul ignore if */
4454
+
4455
+ if (devtools && config.devtools) {
4456
+ devtools.emit('flush');
4457
+ }
4458
+ }
4459
+
4460
+ function callUpdatedHooks(queue) {
4461
+ var i = queue.length;
4462
+
4463
+ while (i--) {
4464
+ var watcher = queue[i];
4465
+ var vm = watcher.vm;
4466
+
4467
+ if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
4468
+ callHook(vm, 'updated');
4469
+ }
4470
+ }
4471
+ }
4472
+ /**
4473
+ * Queue a kept-alive component that was activated during patch.
4474
+ * The queue will be processed after the entire tree has been patched.
4475
+ */
4476
+
4477
+
4478
+ function queueActivatedComponent(vm) {
4479
+ // setting _inactive to false here so that a render function can
4480
+ // rely on checking whether it's in an inactive tree (e.g. router-view)
4481
+ vm._inactive = false;
4482
+ activatedChildren.push(vm);
4483
+ }
4484
+
4485
+ function callActivatedHooks(queue) {
4486
+ for (var i = 0; i < queue.length; i++) {
4487
+ queue[i]._inactive = true;
4488
+ activateChildComponent(queue[i], true
4489
+ /* true */
4490
+ );
4491
+ }
4492
+ }
4493
+ /**
4494
+ * Push a watcher into the watcher queue.
4495
+ * Jobs with duplicate IDs will be skipped unless it's
4496
+ * pushed when the queue is being flushed.
4497
+ */
4498
+
4499
+
4500
+ function queueWatcher(watcher) {
4501
+ var id = watcher.id;
4502
+
4503
+ if (has[id] == null) {
4504
+ has[id] = true;
4505
+
4506
+ if (!flushing) {
4507
+ queue.push(watcher);
4508
+ } else {
4509
+ // if already flushing, splice the watcher based on its id
4510
+ // if already past its id, it will be run next immediately.
4511
+ var i = queue.length - 1;
4512
+
4513
+ while (i > index && queue[i].id > watcher.id) {
4514
+ i--;
4515
+ }
4516
+
4517
+ queue.splice(i + 1, 0, watcher);
4518
+ } // queue the flush
4519
+
4520
+
4521
+ if (!waiting) {
4522
+ waiting = true;
4523
+
4524
+ if ("development" !== 'production' && !config.async) {
4525
+ flushSchedulerQueue();
4526
+ return;
4527
+ }
4528
+
4529
+ nextTick(flushSchedulerQueue);
4530
+ }
4531
+ }
4532
+ }
4533
+ /* */
4534
+
4535
+
4536
+ var uid$2 = 0;
4537
+ /**
4538
+ * A watcher parses an expression, collects dependencies,
4539
+ * and fires callback when the expression value changes.
4540
+ * This is used for both the $watch() api and directives.
4541
+ */
4542
+
4543
+ var Watcher = function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {
4544
+ this.vm = vm;
4545
+
4546
+ if (isRenderWatcher) {
4547
+ vm._watcher = this;
4548
+ }
4549
+
4550
+ vm._watchers.push(this); // options
4551
+
4552
+
4553
+ if (options) {
4554
+ this.deep = !!options.deep;
4555
+ this.user = !!options.user;
4556
+ this.lazy = !!options.lazy;
4557
+ this.sync = !!options.sync;
4558
+ this.before = options.before;
4559
+ } else {
4560
+ this.deep = this.user = this.lazy = this.sync = false;
4561
+ }
4562
+
4563
+ this.cb = cb;
4564
+ this.id = ++uid$2; // uid for batching
4565
+
4566
+ this.active = true;
4567
+ this.dirty = this.lazy; // for lazy watchers
4568
+
4569
+ this.deps = [];
4570
+ this.newDeps = [];
4571
+ this.depIds = new _Set();
4572
+ this.newDepIds = new _Set();
4573
+ this.expression = "development" !== 'production' ? expOrFn.toString() : ''; // parse expression for getter
4574
+
4575
+ if (typeof expOrFn === 'function') {
4576
+ this.getter = expOrFn;
4577
+ } else {
4578
+ this.getter = parsePath(expOrFn);
4579
+
4580
+ if (!this.getter) {
4581
+ this.getter = noop;
4582
+ "development" !== 'production' && warn("Failed watching path: \"" + expOrFn + "\" " + 'Watcher only accepts simple dot-delimited paths. ' + 'For full control, use a function instead.', vm);
4583
+ }
4584
+ }
4585
+
4586
+ this.value = this.lazy ? undefined : this.get();
4587
+ };
4588
+ /**
4589
+ * Evaluate the getter, and re-collect dependencies.
4590
+ */
4591
+
4592
+
4593
+ Watcher.prototype.get = function get() {
4594
+ pushTarget(this);
4595
+ var value;
4596
+ var vm = this.vm;
4597
+
4598
+ try {
4599
+ value = this.getter.call(vm, vm);
4600
+ } catch (e) {
4601
+ if (this.user) {
4602
+ handleError(e, vm, "getter for watcher \"" + this.expression + "\"");
4603
+ } else {
4604
+ throw e;
4605
+ }
4606
+ } finally {
4607
+ // "touch" every property so they are all tracked as
4608
+ // dependencies for deep watching
4609
+ if (this.deep) {
4610
+ traverse(value);
4611
+ }
4612
+
4613
+ popTarget();
4614
+ this.cleanupDeps();
4615
+ }
4616
+
4617
+ return value;
4618
+ };
4619
+ /**
4620
+ * Add a dependency to this directive.
4621
+ */
4622
+
4623
+
4624
+ Watcher.prototype.addDep = function addDep(dep) {
4625
+ var id = dep.id;
4626
+
4627
+ if (!this.newDepIds.has(id)) {
4628
+ this.newDepIds.add(id);
4629
+ this.newDeps.push(dep);
4630
+
4631
+ if (!this.depIds.has(id)) {
4632
+ dep.addSub(this);
4633
+ }
4634
+ }
4635
+ };
4636
+ /**
4637
+ * Clean up for dependency collection.
4638
+ */
4639
+
4640
+
4641
+ Watcher.prototype.cleanupDeps = function cleanupDeps() {
4642
+ var i = this.deps.length;
4643
+
4644
+ while (i--) {
4645
+ var dep = this.deps[i];
4646
+
4647
+ if (!this.newDepIds.has(dep.id)) {
4648
+ dep.removeSub(this);
4649
+ }
4650
+ }
4651
+
4652
+ var tmp = this.depIds;
4653
+ this.depIds = this.newDepIds;
4654
+ this.newDepIds = tmp;
4655
+ this.newDepIds.clear();
4656
+ tmp = this.deps;
4657
+ this.deps = this.newDeps;
4658
+ this.newDeps = tmp;
4659
+ this.newDeps.length = 0;
4660
+ };
4661
+ /**
4662
+ * Subscriber interface.
4663
+ * Will be called when a dependency changes.
4664
+ */
4665
+
4666
+
4667
+ Watcher.prototype.update = function update() {
4668
+ /* istanbul ignore else */
4669
+ if (this.lazy) {
4670
+ this.dirty = true;
4671
+ } else if (this.sync) {
4672
+ this.run();
4673
+ } else {
4674
+ queueWatcher(this);
4675
+ }
4676
+ };
4677
+ /**
4678
+ * Scheduler job interface.
4679
+ * Will be called by the scheduler.
4680
+ */
4681
+
4682
+
4683
+ Watcher.prototype.run = function run() {
4684
+ if (this.active) {
4685
+ var value = this.get();
4686
+
4687
+ if (value !== this.value || // Deep watchers and watchers on Object/Arrays should fire even
4688
+ // when the value is the same, because the value may
4689
+ // have mutated.
4690
+ isObject(value) || this.deep) {
4691
+ // set new value
4692
+ var oldValue = this.value;
4693
+ this.value = value;
4694
+
4695
+ if (this.user) {
4696
+ try {
4697
+ this.cb.call(this.vm, value, oldValue);
4698
+ } catch (e) {
4699
+ handleError(e, this.vm, "callback for watcher \"" + this.expression + "\"");
4700
+ }
4701
+ } else {
4702
+ this.cb.call(this.vm, value, oldValue);
4703
+ }
4704
+ }
4705
+ }
4706
+ };
4707
+ /**
4708
+ * Evaluate the value of the watcher.
4709
+ * This only gets called for lazy watchers.
4710
+ */
4711
+
4712
+
4713
+ Watcher.prototype.evaluate = function evaluate() {
4714
+ this.value = this.get();
4715
+ this.dirty = false;
4716
+ };
4717
+ /**
4718
+ * Depend on all deps collected by this watcher.
4719
+ */
4720
+
4721
+
4722
+ Watcher.prototype.depend = function depend() {
4723
+ var i = this.deps.length;
4724
+
4725
+ while (i--) {
4726
+ this.deps[i].depend();
4727
+ }
4728
+ };
4729
+ /**
4730
+ * Remove self from all dependencies' subscriber list.
4731
+ */
4732
+
4733
+
4734
+ Watcher.prototype.teardown = function teardown() {
4735
+ if (this.active) {
4736
+ // remove self from vm's watcher list
4737
+ // this is a somewhat expensive operation so we skip it
4738
+ // if the vm is being destroyed.
4739
+ if (!this.vm._isBeingDestroyed) {
4740
+ remove(this.vm._watchers, this);
4741
+ }
4742
+
4743
+ var i = this.deps.length;
4744
+
4745
+ while (i--) {
4746
+ this.deps[i].removeSub(this);
4747
+ }
4748
+
4749
+ this.active = false;
4750
+ }
4751
+ };
4752
+ /* */
4753
+
4754
+
4755
+ var sharedPropertyDefinition = {
4756
+ enumerable: true,
4757
+ configurable: true,
4758
+ get: noop,
4759
+ set: noop
4760
+ };
4761
+
4762
+ function proxy(target, sourceKey, key) {
4763
+ sharedPropertyDefinition.get = function proxyGetter() {
4764
+ return this[sourceKey][key];
4765
+ };
4766
+
4767
+ sharedPropertyDefinition.set = function proxySetter(val) {
4768
+ this[sourceKey][key] = val;
4769
+ };
4770
+
4771
+ Object.defineProperty(target, key, sharedPropertyDefinition);
4772
+ }
4773
+
4774
+ function initState(vm) {
4775
+ vm._watchers = [];
4776
+ var opts = vm.$options;
4777
+
4778
+ if (opts.props) {
4779
+ initProps(vm, opts.props);
4780
+ }
4781
+
4782
+ if (opts.methods) {
4783
+ initMethods(vm, opts.methods);
4784
+ }
4785
+
4786
+ if (opts.data) {
4787
+ initData(vm);
4788
+ } else {
4789
+ observe(vm._data = {}, true
4790
+ /* asRootData */
4791
+ );
4792
+ }
4793
+
4794
+ if (opts.computed) {
4795
+ initComputed(vm, opts.computed);
4796
+ }
4797
+
4798
+ if (opts.watch && opts.watch !== nativeWatch) {
4799
+ initWatch(vm, opts.watch);
4800
+ }
4801
+ }
4802
+
4803
+ function initProps(vm, propsOptions) {
4804
+ var propsData = vm.$options.propsData || {};
4805
+ var props = vm._props = {}; // cache prop keys so that future props updates can iterate using Array
4806
+ // instead of dynamic object key enumeration.
4807
+
4808
+ var keys = vm.$options._propKeys = [];
4809
+ var isRoot = !vm.$parent; // root instance props should be converted
4810
+
4811
+ if (!isRoot) {
4812
+ toggleObserving(false);
4813
+ }
4814
+
4815
+ var loop = function (key) {
4816
+ keys.push(key);
4817
+ var value = validateProp(key, propsOptions, propsData, vm);
4818
+ /* istanbul ignore else */
4819
+
4820
+ if ("development" !== 'production') {
4821
+ var hyphenatedKey = hyphenate(key);
4822
+
4823
+ if (isReservedAttribute(hyphenatedKey) || config.isReservedAttr(hyphenatedKey)) {
4824
+ warn("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop.", vm);
4825
+ }
4826
+
4827
+ defineReactive$$1(props, key, value, function () {
4828
+ if (!isRoot && !isUpdatingChildComponent) {
4829
+ warn("Avoid mutating a prop directly since the value will be " + "overwritten whenever the parent component re-renders. " + "Instead, use a data or computed property based on the prop's " + "value. Prop being mutated: \"" + key + "\"", vm);
4830
+ }
4831
+ });
4832
+ } else {
4833
+ defineReactive$$1(props, key, value);
4834
+ } // static props are already proxied on the component's prototype
4835
+ // during Vue.extend(). We only need to proxy props defined at
4836
+ // instantiation here.
4837
+
4838
+
4839
+ if (!(key in vm)) {
4840
+ proxy(vm, "_props", key);
4841
+ }
4842
+ };
4843
+
4844
+ for (var key in propsOptions) loop(key);
4845
+
4846
+ toggleObserving(true);
4847
+ }
4848
+
4849
+ function initData(vm) {
4850
+ var data = vm.$options.data;
4851
+ data = vm._data = typeof data === 'function' ? getData(data, vm) : data || {};
4852
+
4853
+ if (!isPlainObject(data)) {
4854
+ data = {};
4855
+ "development" !== 'production' && warn('data functions should return an object:\n' + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
4856
+ } // proxy data on instance
4857
+
4858
+
4859
+ var keys = Object.keys(data);
4860
+ var props = vm.$options.props;
4861
+ var methods = vm.$options.methods;
4862
+ var i = keys.length;
4863
+
4864
+ while (i--) {
4865
+ var key = keys[i];
4866
+
4867
+ if ("development" !== 'production') {
4868
+ if (methods && hasOwn(methods, key)) {
4869
+ warn("Method \"" + key + "\" has already been defined as a data property.", vm);
4870
+ }
4871
+ }
4872
+
4873
+ if (props && hasOwn(props, key)) {
4874
+ "development" !== 'production' && warn("The data property \"" + key + "\" is already declared as a prop. " + "Use prop default value instead.", vm);
4875
+ } else if (!isReserved(key)) {
4876
+ proxy(vm, "_data", key);
4877
+ }
4878
+ } // observe data
4879
+
4880
+
4881
+ observe(data, true
4882
+ /* asRootData */
4883
+ );
4884
+ }
4885
+
4886
+ function getData(data, vm) {
4887
+ // #7573 disable dep collection when invoking data getters
4888
+ pushTarget();
4889
+
4890
+ try {
4891
+ return data.call(vm, vm);
4892
+ } catch (e) {
4893
+ handleError(e, vm, "data()");
4894
+ return {};
4895
+ } finally {
4896
+ popTarget();
4897
+ }
4898
+ }
4899
+
4900
+ var computedWatcherOptions = {
4901
+ lazy: true
4902
+ };
4903
+
4904
+ function initComputed(vm, computed) {
4905
+ // $flow-disable-line
4906
+ var watchers = vm._computedWatchers = Object.create(null); // computed properties are just getters during SSR
4907
+
4908
+ var isSSR = isServerRendering();
4909
+
4910
+ for (var key in computed) {
4911
+ var userDef = computed[key];
4912
+ var getter = typeof userDef === 'function' ? userDef : userDef.get;
4913
+
4914
+ if ("development" !== 'production' && getter == null) {
4915
+ warn("Getter is missing for computed property \"" + key + "\".", vm);
4916
+ }
4917
+
4918
+ if (!isSSR) {
4919
+ // create internal watcher for the computed property.
4920
+ watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
4921
+ } // component-defined computed properties are already defined on the
4922
+ // component prototype. We only need to define computed properties defined
4923
+ // at instantiation here.
4924
+
4925
+
4926
+ if (!(key in vm)) {
4927
+ defineComputed(vm, key, userDef);
4928
+ } else if ("development" !== 'production') {
4929
+ if (key in vm.$data) {
4930
+ warn("The computed property \"" + key + "\" is already defined in data.", vm);
4931
+ } else if (vm.$options.props && key in vm.$options.props) {
4932
+ warn("The computed property \"" + key + "\" is already defined as a prop.", vm);
4933
+ }
4934
+ }
4935
+ }
4936
+ }
4937
+
4938
+ function defineComputed(target, key, userDef) {
4939
+ var shouldCache = !isServerRendering();
4940
+
4941
+ if (typeof userDef === 'function') {
4942
+ sharedPropertyDefinition.get = shouldCache ? createComputedGetter(key) : createGetterInvoker(userDef);
4943
+ sharedPropertyDefinition.set = noop;
4944
+ } else {
4945
+ sharedPropertyDefinition.get = userDef.get ? shouldCache && userDef.cache !== false ? createComputedGetter(key) : createGetterInvoker(userDef.get) : noop;
4946
+ sharedPropertyDefinition.set = userDef.set || noop;
4947
+ }
4948
+
4949
+ if ("development" !== 'production' && sharedPropertyDefinition.set === noop) {
4950
+ sharedPropertyDefinition.set = function () {
4951
+ warn("Computed property \"" + key + "\" was assigned to but it has no setter.", this);
4952
+ };
4953
+ }
4954
+
4955
+ Object.defineProperty(target, key, sharedPropertyDefinition);
4956
+ }
4957
+
4958
+ function createComputedGetter(key) {
4959
+ return function computedGetter() {
4960
+ var watcher = this._computedWatchers && this._computedWatchers[key];
4961
+
4962
+ if (watcher) {
4963
+ if (watcher.dirty) {
4964
+ watcher.evaluate();
4965
+ }
4966
+
4967
+ if (Dep.target) {
4968
+ watcher.depend();
4969
+ }
4970
+
4971
+ return watcher.value;
4972
+ }
4973
+ };
4974
+ }
4975
+
4976
+ function createGetterInvoker(fn) {
4977
+ return function computedGetter() {
4978
+ return fn.call(this, this);
4979
+ };
4980
+ }
4981
+
4982
+ function initMethods(vm, methods) {
4983
+ var props = vm.$options.props;
4984
+
4985
+ for (var key in methods) {
4986
+ if ("development" !== 'production') {
4987
+ if (typeof methods[key] !== 'function') {
4988
+ warn("Method \"" + key + "\" has type \"" + typeof methods[key] + "\" in the component definition. " + "Did you reference the function correctly?", vm);
4989
+ }
4990
+
4991
+ if (props && hasOwn(props, key)) {
4992
+ warn("Method \"" + key + "\" has already been defined as a prop.", vm);
4993
+ }
4994
+
4995
+ if (key in vm && isReserved(key)) {
4996
+ warn("Method \"" + key + "\" conflicts with an existing Vue instance method. " + "Avoid defining component methods that start with _ or $.");
4997
+ }
4998
+ }
4999
+
5000
+ vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
5001
+ }
5002
+ }
5003
+
5004
+ function initWatch(vm, watch) {
5005
+ for (var key in watch) {
5006
+ var handler = watch[key];
5007
+
5008
+ if (Array.isArray(handler)) {
5009
+ for (var i = 0; i < handler.length; i++) {
5010
+ createWatcher(vm, key, handler[i]);
5011
+ }
5012
+ } else {
5013
+ createWatcher(vm, key, handler);
5014
+ }
5015
+ }
5016
+ }
5017
+
5018
+ function createWatcher(vm, expOrFn, handler, options) {
5019
+ if (isPlainObject(handler)) {
5020
+ options = handler;
5021
+ handler = handler.handler;
5022
+ }
5023
+
5024
+ if (typeof handler === 'string') {
5025
+ handler = vm[handler];
5026
+ }
5027
+
5028
+ return vm.$watch(expOrFn, handler, options);
5029
+ }
5030
+
5031
+ function stateMixin(Vue) {
5032
+ // flow somehow has problems with directly declared definition object
5033
+ // when using Object.defineProperty, so we have to procedurally build up
5034
+ // the object here.
5035
+ var dataDef = {};
5036
+
5037
+ dataDef.get = function () {
5038
+ return this._data;
5039
+ };
5040
+
5041
+ var propsDef = {};
5042
+
5043
+ propsDef.get = function () {
5044
+ return this._props;
5045
+ };
5046
+
5047
+ if ("development" !== 'production') {
5048
+ dataDef.set = function () {
5049
+ warn('Avoid replacing instance root $data. ' + 'Use nested data properties instead.', this);
5050
+ };
5051
+
5052
+ propsDef.set = function () {
5053
+ warn("$props is readonly.", this);
5054
+ };
5055
+ }
5056
+
5057
+ Object.defineProperty(Vue.prototype, '$data', dataDef);
5058
+ Object.defineProperty(Vue.prototype, '$props', propsDef);
5059
+ Vue.prototype.$set = set;
5060
+ Vue.prototype.$delete = del;
5061
+
5062
+ Vue.prototype.$watch = function (expOrFn, cb, options) {
5063
+ var vm = this;
5064
+
5065
+ if (isPlainObject(cb)) {
5066
+ return createWatcher(vm, expOrFn, cb, options);
5067
+ }
5068
+
5069
+ options = options || {};
5070
+ options.user = true;
5071
+ var watcher = new Watcher(vm, expOrFn, cb, options);
5072
+
5073
+ if (options.immediate) {
5074
+ try {
5075
+ cb.call(vm, watcher.value);
5076
+ } catch (error) {
5077
+ handleError(error, vm, "callback for immediate watcher \"" + watcher.expression + "\"");
5078
+ }
5079
+ }
5080
+
5081
+ return function unwatchFn() {
5082
+ watcher.teardown();
5083
+ };
5084
+ };
5085
+ }
5086
+ /* */
5087
+
5088
+
5089
+ var uid$3 = 0;
5090
+
5091
+ function initMixin(Vue) {
5092
+ Vue.prototype._init = function (options) {
5093
+ var vm = this; // a uid
5094
+
5095
+ vm._uid = uid$3++;
5096
+ var startTag, endTag;
5097
+ /* istanbul ignore if */
5098
+
5099
+ if ("development" !== 'production' && config.performance && mark) {
5100
+ startTag = "vue-perf-start:" + vm._uid;
5101
+ endTag = "vue-perf-end:" + vm._uid;
5102
+ mark(startTag);
5103
+ } // a flag to avoid this being observed
5104
+
5105
+
5106
+ vm._isVue = true; // merge options
5107
+
5108
+ if (options && options._isComponent) {
5109
+ // optimize internal component instantiation
5110
+ // since dynamic options merging is pretty slow, and none of the
5111
+ // internal component options needs special treatment.
5112
+ initInternalComponent(vm, options);
5113
+ } else {
5114
+ vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm);
5115
+ }
5116
+ /* istanbul ignore else */
5117
+
5118
+
5119
+ if ("development" !== 'production') {
5120
+ initProxy(vm);
5121
+ } else {
5122
+ vm._renderProxy = vm;
5123
+ } // expose real self
5124
+
5125
+
5126
+ vm._self = vm;
5127
+ initLifecycle(vm);
5128
+ initEvents(vm);
5129
+ initRender(vm);
5130
+ callHook(vm, 'beforeCreate');
5131
+ initInjections(vm); // resolve injections before data/props
5132
+
5133
+ initState(vm);
5134
+ initProvide(vm); // resolve provide after data/props
5135
+
5136
+ callHook(vm, 'created');
5137
+ /* istanbul ignore if */
5138
+
5139
+ if ("development" !== 'production' && config.performance && mark) {
5140
+ vm._name = formatComponentName(vm, false);
5141
+ mark(endTag);
5142
+ measure("vue " + vm._name + " init", startTag, endTag);
5143
+ }
5144
+
5145
+ if (vm.$options.el) {
5146
+ vm.$mount(vm.$options.el);
5147
+ }
5148
+ };
5149
+ }
5150
+
5151
+ function initInternalComponent(vm, options) {
5152
+ var opts = vm.$options = Object.create(vm.constructor.options); // doing this because it's faster than dynamic enumeration.
5153
+
5154
+ var parentVnode = options._parentVnode;
5155
+ opts.parent = options.parent;
5156
+ opts._parentVnode = parentVnode;
5157
+ var vnodeComponentOptions = parentVnode.componentOptions;
5158
+ opts.propsData = vnodeComponentOptions.propsData;
5159
+ opts._parentListeners = vnodeComponentOptions.listeners;
5160
+ opts._renderChildren = vnodeComponentOptions.children;
5161
+ opts._componentTag = vnodeComponentOptions.tag;
5162
+
5163
+ if (options.render) {
5164
+ opts.render = options.render;
5165
+ opts.staticRenderFns = options.staticRenderFns;
5166
+ }
5167
+ }
5168
+
5169
+ function resolveConstructorOptions(Ctor) {
5170
+ var options = Ctor.options;
5171
+
5172
+ if (Ctor.super) {
5173
+ var superOptions = resolveConstructorOptions(Ctor.super);
5174
+ var cachedSuperOptions = Ctor.superOptions;
5175
+
5176
+ if (superOptions !== cachedSuperOptions) {
5177
+ // super option changed,
5178
+ // need to resolve new options.
5179
+ Ctor.superOptions = superOptions; // check if there are any late-modified/attached options (#4976)
5180
+
5181
+ var modifiedOptions = resolveModifiedOptions(Ctor); // update base extend options
5182
+
5183
+ if (modifiedOptions) {
5184
+ extend(Ctor.extendOptions, modifiedOptions);
5185
+ }
5186
+
5187
+ options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
5188
+
5189
+ if (options.name) {
5190
+ options.components[options.name] = Ctor;
5191
+ }
5192
+ }
5193
+ }
5194
+
5195
+ return options;
5196
+ }
5197
+
5198
+ function resolveModifiedOptions(Ctor) {
5199
+ var modified;
5200
+ var latest = Ctor.options;
5201
+ var sealed = Ctor.sealedOptions;
5202
+
5203
+ for (var key in latest) {
5204
+ if (latest[key] !== sealed[key]) {
5205
+ if (!modified) {
5206
+ modified = {};
5207
+ }
5208
+
5209
+ modified[key] = latest[key];
5210
+ }
5211
+ }
5212
+
5213
+ return modified;
5214
+ }
5215
+
5216
+ function Vue(options) {
5217
+ if ("development" !== 'production' && !(this instanceof Vue)) {
5218
+ warn('Vue is a constructor and should be called with the `new` keyword');
5219
+ }
5220
+
5221
+ this._init(options);
5222
+ }
5223
+
5224
+ initMixin(Vue);
5225
+ stateMixin(Vue);
5226
+ eventsMixin(Vue);
5227
+ lifecycleMixin(Vue);
5228
+ renderMixin(Vue);
5229
+ /* */
5230
+
5231
+ function initUse(Vue) {
5232
+ Vue.use = function (plugin) {
5233
+ var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
5234
+
5235
+ if (installedPlugins.indexOf(plugin) > -1) {
5236
+ return this;
5237
+ } // additional parameters
5238
+
5239
+
5240
+ var args = toArray(arguments, 1);
5241
+ args.unshift(this);
5242
+
5243
+ if (typeof plugin.install === 'function') {
5244
+ plugin.install.apply(plugin, args);
5245
+ } else if (typeof plugin === 'function') {
5246
+ plugin.apply(null, args);
5247
+ }
5248
+
5249
+ installedPlugins.push(plugin);
5250
+ return this;
5251
+ };
5252
+ }
5253
+ /* */
5254
+
5255
+
5256
+ function initMixin$1(Vue) {
5257
+ Vue.mixin = function (mixin) {
5258
+ this.options = mergeOptions(this.options, mixin);
5259
+ return this;
5260
+ };
5261
+ }
5262
+ /* */
5263
+
5264
+
5265
+ function initExtend(Vue) {
5266
+ /**
5267
+ * Each instance constructor, including Vue, has a unique
5268
+ * cid. This enables us to create wrapped "child
5269
+ * constructors" for prototypal inheritance and cache them.
5270
+ */
5271
+ Vue.cid = 0;
5272
+ var cid = 1;
5273
+ /**
5274
+ * Class inheritance
5275
+ */
5276
+
5277
+ Vue.extend = function (extendOptions) {
5278
+ extendOptions = extendOptions || {};
5279
+ var Super = this;
5280
+ var SuperId = Super.cid;
5281
+ var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
5282
+
5283
+ if (cachedCtors[SuperId]) {
5284
+ return cachedCtors[SuperId];
5285
+ }
5286
+
5287
+ var name = extendOptions.name || Super.options.name;
5288
+
5289
+ if ("development" !== 'production' && name) {
5290
+ validateComponentName(name);
5291
+ }
5292
+
5293
+ var Sub = function VueComponent(options) {
5294
+ this._init(options);
5295
+ };
5296
+
5297
+ Sub.prototype = Object.create(Super.prototype);
5298
+ Sub.prototype.constructor = Sub;
5299
+ Sub.cid = cid++;
5300
+ Sub.options = mergeOptions(Super.options, extendOptions);
5301
+ Sub['super'] = Super; // For props and computed properties, we define the proxy getters on
5302
+ // the Vue instances at extension time, on the extended prototype. This
5303
+ // avoids Object.defineProperty calls for each instance created.
5304
+
5305
+ if (Sub.options.props) {
5306
+ initProps$1(Sub);
5307
+ }
5308
+
5309
+ if (Sub.options.computed) {
5310
+ initComputed$1(Sub);
5311
+ } // allow further extension/mixin/plugin usage
5312
+
5313
+
5314
+ Sub.extend = Super.extend;
5315
+ Sub.mixin = Super.mixin;
5316
+ Sub.use = Super.use; // create asset registers, so extended classes
5317
+ // can have their private assets too.
5318
+
5319
+ ASSET_TYPES.forEach(function (type) {
5320
+ Sub[type] = Super[type];
5321
+ }); // enable recursive self-lookup
5322
+
5323
+ if (name) {
5324
+ Sub.options.components[name] = Sub;
5325
+ } // keep a reference to the super options at extension time.
5326
+ // later at instantiation we can check if Super's options have
5327
+ // been updated.
5328
+
5329
+
5330
+ Sub.superOptions = Super.options;
5331
+ Sub.extendOptions = extendOptions;
5332
+ Sub.sealedOptions = extend({}, Sub.options); // cache constructor
5333
+
5334
+ cachedCtors[SuperId] = Sub;
5335
+ return Sub;
5336
+ };
5337
+ }
5338
+
5339
+ function initProps$1(Comp) {
5340
+ var props = Comp.options.props;
5341
+
5342
+ for (var key in props) {
5343
+ proxy(Comp.prototype, "_props", key);
5344
+ }
5345
+ }
5346
+
5347
+ function initComputed$1(Comp) {
5348
+ var computed = Comp.options.computed;
5349
+
5350
+ for (var key in computed) {
5351
+ defineComputed(Comp.prototype, key, computed[key]);
5352
+ }
5353
+ }
5354
+ /* */
5355
+
5356
+
5357
+ function initAssetRegisters(Vue) {
5358
+ /**
5359
+ * Create asset registration methods.
5360
+ */
5361
+ ASSET_TYPES.forEach(function (type) {
5362
+ Vue[type] = function (id, definition) {
5363
+ if (!definition) {
5364
+ return this.options[type + 's'][id];
5365
+ } else {
5366
+ /* istanbul ignore if */
5367
+ if ("development" !== 'production' && type === 'component') {
5368
+ validateComponentName(id);
5369
+ }
5370
+
5371
+ if (type === 'component' && isPlainObject(definition)) {
5372
+ definition.name = definition.name || id;
5373
+ definition = this.options._base.extend(definition);
5374
+ }
5375
+
5376
+ if (type === 'directive' && typeof definition === 'function') {
5377
+ definition = {
5378
+ bind: definition,
5379
+ update: definition
5380
+ };
5381
+ }
5382
+
5383
+ this.options[type + 's'][id] = definition;
5384
+ return definition;
5385
+ }
5386
+ };
5387
+ });
5388
+ }
5389
+ /* */
5390
+
5391
+
5392
+ function getComponentName(opts) {
5393
+ return opts && (opts.Ctor.options.name || opts.tag);
5394
+ }
5395
+
5396
+ function matches(pattern, name) {
5397
+ if (Array.isArray(pattern)) {
5398
+ return pattern.indexOf(name) > -1;
5399
+ } else if (typeof pattern === 'string') {
5400
+ return pattern.split(',').indexOf(name) > -1;
5401
+ } else if (isRegExp(pattern)) {
5402
+ return pattern.test(name);
5403
+ }
5404
+ /* istanbul ignore next */
5405
+
5406
+
5407
+ return false;
5408
+ }
5409
+
5410
+ function pruneCache(keepAliveInstance, filter) {
5411
+ var cache = keepAliveInstance.cache;
5412
+ var keys = keepAliveInstance.keys;
5413
+ var _vnode = keepAliveInstance._vnode;
5414
+
5415
+ for (var key in cache) {
5416
+ var cachedNode = cache[key];
5417
+
5418
+ if (cachedNode) {
5419
+ var name = getComponentName(cachedNode.componentOptions);
5420
+
5421
+ if (name && !filter(name)) {
5422
+ pruneCacheEntry(cache, key, keys, _vnode);
5423
+ }
5424
+ }
5425
+ }
5426
+ }
5427
+
5428
+ function pruneCacheEntry(cache, key, keys, current) {
5429
+ var cached$$1 = cache[key];
5430
+
5431
+ if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
5432
+ cached$$1.componentInstance.$destroy();
5433
+ }
5434
+
5435
+ cache[key] = null;
5436
+ remove(keys, key);
5437
+ }
5438
+
5439
+ var patternTypes = [String, RegExp, Array];
5440
+ var KeepAlive = {
5441
+ name: 'keep-alive',
5442
+ abstract: true,
5443
+ props: {
5444
+ include: patternTypes,
5445
+ exclude: patternTypes,
5446
+ max: [String, Number]
5447
+ },
5448
+ created: function created() {
5449
+ this.cache = Object.create(null);
5450
+ this.keys = [];
5451
+ },
5452
+ destroyed: function destroyed() {
5453
+ for (var key in this.cache) {
5454
+ pruneCacheEntry(this.cache, key, this.keys);
5455
+ }
5456
+ },
5457
+ mounted: function mounted() {
5458
+ var this$1 = this;
5459
+ this.$watch('include', function (val) {
5460
+ pruneCache(this$1, function (name) {
5461
+ return matches(val, name);
5462
+ });
5463
+ });
5464
+ this.$watch('exclude', function (val) {
5465
+ pruneCache(this$1, function (name) {
5466
+ return !matches(val, name);
5467
+ });
5468
+ });
5469
+ },
5470
+ render: function render() {
5471
+ var slot = this.$slots.default;
5472
+ var vnode = getFirstComponentChild(slot);
5473
+ var componentOptions = vnode && vnode.componentOptions;
5474
+
5475
+ if (componentOptions) {
5476
+ // check pattern
5477
+ var name = getComponentName(componentOptions);
5478
+ var ref = this;
5479
+ var include = ref.include;
5480
+ var exclude = ref.exclude;
5481
+
5482
+ if ( // not included
5483
+ include && (!name || !matches(include, name)) || // excluded
5484
+ exclude && name && matches(exclude, name)) {
5485
+ return vnode;
5486
+ }
5487
+
5488
+ var ref$1 = this;
5489
+ var cache = ref$1.cache;
5490
+ var keys = ref$1.keys;
5491
+ var key = vnode.key == null // same constructor may get registered as different local components
5492
+ // so cid alone is not enough (#3269)
5493
+ ? componentOptions.Ctor.cid + (componentOptions.tag ? "::" + componentOptions.tag : '') : vnode.key;
5494
+
5495
+ if (cache[key]) {
5496
+ vnode.componentInstance = cache[key].componentInstance; // make current key freshest
5497
+
5498
+ remove(keys, key);
5499
+ keys.push(key);
5500
+ } else {
5501
+ cache[key] = vnode;
5502
+ keys.push(key); // prune oldest entry
5503
+
5504
+ if (this.max && keys.length > parseInt(this.max)) {
5505
+ pruneCacheEntry(cache, keys[0], keys, this._vnode);
5506
+ }
5507
+ }
5508
+
5509
+ vnode.data.keepAlive = true;
5510
+ }
5511
+
5512
+ return vnode || slot && slot[0];
5513
+ }
5514
+ };
5515
+ var builtInComponents = {
5516
+ KeepAlive: KeepAlive
5517
+ };
5518
+ /* */
5519
+
5520
+ function initGlobalAPI(Vue) {
5521
+ // config
5522
+ var configDef = {};
5523
+
5524
+ configDef.get = function () {
5525
+ return config;
5526
+ };
5527
+
5528
+ if ("development" !== 'production') {
5529
+ configDef.set = function () {
5530
+ warn('Do not replace the Vue.config object, set individual fields instead.');
5531
+ };
5532
+ }
5533
+
5534
+ Object.defineProperty(Vue, 'config', configDef); // exposed util methods.
5535
+ // NOTE: these are not considered part of the public API - avoid relying on
5536
+ // them unless you are aware of the risk.
5537
+
5538
+ Vue.util = {
5539
+ warn: warn,
5540
+ extend: extend,
5541
+ mergeOptions: mergeOptions,
5542
+ defineReactive: defineReactive$$1
5543
+ };
5544
+ Vue.set = set;
5545
+ Vue.delete = del;
5546
+ Vue.nextTick = nextTick; // 2.6 explicit observable API
5547
+
5548
+ Vue.observable = function (obj) {
5549
+ observe(obj);
5550
+ return obj;
5551
+ };
5552
+
5553
+ Vue.options = Object.create(null);
5554
+ ASSET_TYPES.forEach(function (type) {
5555
+ Vue.options[type + 's'] = Object.create(null);
5556
+ }); // this is used to identify the "base" constructor to extend all plain-object
5557
+ // components with in Weex's multi-instance scenarios.
5558
+
5559
+ Vue.options._base = Vue;
5560
+ extend(Vue.options.components, builtInComponents);
5561
+ initUse(Vue);
5562
+ initMixin$1(Vue);
5563
+ initExtend(Vue);
5564
+ initAssetRegisters(Vue);
5565
+ }
5566
+
5567
+ initGlobalAPI(Vue);
5568
+ Object.defineProperty(Vue.prototype, '$isServer', {
5569
+ get: isServerRendering
5570
+ });
5571
+ Object.defineProperty(Vue.prototype, '$ssrContext', {
5572
+ get: function get() {
5573
+ /* istanbul ignore next */
5574
+ return this.$vnode && this.$vnode.ssrContext;
5575
+ }
5576
+ }); // expose FunctionalRenderContext for ssr runtime helper installation
5577
+
5578
+ Object.defineProperty(Vue, 'FunctionalRenderContext', {
5579
+ value: FunctionalRenderContext
5580
+ });
5581
+ Vue.version = '2.6.11';
5582
+ /* */
5583
+ // these are reserved for web because they are directly compiled away
5584
+ // during template compilation
5585
+
5586
+ var isReservedAttr = makeMap('style,class'); // attributes that should be using props for binding
5587
+
5588
+ var acceptValue = makeMap('input,textarea,option,select,progress');
5589
+
5590
+ var mustUseProp = function (tag, type, attr) {
5591
+ return attr === 'value' && acceptValue(tag) && type !== 'button' || attr === 'selected' && tag === 'option' || attr === 'checked' && tag === 'input' || attr === 'muted' && tag === 'video';
5592
+ };
5593
+
5594
+ var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
5595
+ var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
5596
+
5597
+ var convertEnumeratedValue = function (key, value) {
5598
+ return isFalsyAttrValue(value) || value === 'false' ? 'false' // allow arbitrary string value for contenteditable
5599
+ : key === 'contenteditable' && isValidContentEditableValue(value) ? value : 'true';
5600
+ };
5601
+
5602
+ var isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' + 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' + 'required,reversed,scoped,seamless,selected,sortable,translate,' + 'truespeed,typemustmatch,visible');
5603
+ var xlinkNS = 'http://www.w3.org/1999/xlink';
5604
+
5605
+ var isXlink = function (name) {
5606
+ return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink';
5607
+ };
5608
+
5609
+ var getXlinkProp = function (name) {
5610
+ return isXlink(name) ? name.slice(6, name.length) : '';
5611
+ };
5612
+
5613
+ var isFalsyAttrValue = function (val) {
5614
+ return val == null || val === false;
5615
+ };
5616
+ /* */
5617
+
5618
+
5619
+ function genClassForVnode(vnode) {
5620
+ var data = vnode.data;
5621
+ var parentNode = vnode;
5622
+ var childNode = vnode;
5623
+
5624
+ while (isDef(childNode.componentInstance)) {
5625
+ childNode = childNode.componentInstance._vnode;
5626
+
5627
+ if (childNode && childNode.data) {
5628
+ data = mergeClassData(childNode.data, data);
5629
+ }
5630
+ }
5631
+
5632
+ while (isDef(parentNode = parentNode.parent)) {
5633
+ if (parentNode && parentNode.data) {
5634
+ data = mergeClassData(data, parentNode.data);
5635
+ }
5636
+ }
5637
+
5638
+ return renderClass(data.staticClass, data.class);
5639
+ }
5640
+
5641
+ function mergeClassData(child, parent) {
5642
+ return {
5643
+ staticClass: concat(child.staticClass, parent.staticClass),
5644
+ class: isDef(child.class) ? [child.class, parent.class] : parent.class
5645
+ };
5646
+ }
5647
+
5648
+ function renderClass(staticClass, dynamicClass) {
5649
+ if (isDef(staticClass) || isDef(dynamicClass)) {
5650
+ return concat(staticClass, stringifyClass(dynamicClass));
5651
+ }
5652
+ /* istanbul ignore next */
5653
+
5654
+
5655
+ return '';
5656
+ }
5657
+
5658
+ function concat(a, b) {
5659
+ return a ? b ? a + ' ' + b : a : b || '';
5660
+ }
5661
+
5662
+ function stringifyClass(value) {
5663
+ if (Array.isArray(value)) {
5664
+ return stringifyArray(value);
5665
+ }
5666
+
5667
+ if (isObject(value)) {
5668
+ return stringifyObject(value);
5669
+ }
5670
+
5671
+ if (typeof value === 'string') {
5672
+ return value;
5673
+ }
5674
+ /* istanbul ignore next */
5675
+
5676
+
5677
+ return '';
5678
+ }
5679
+
5680
+ function stringifyArray(value) {
5681
+ var res = '';
5682
+ var stringified;
5683
+
5684
+ for (var i = 0, l = value.length; i < l; i++) {
5685
+ if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
5686
+ if (res) {
5687
+ res += ' ';
5688
+ }
5689
+
5690
+ res += stringified;
5691
+ }
5692
+ }
5693
+
5694
+ return res;
5695
+ }
5696
+
5697
+ function stringifyObject(value) {
5698
+ var res = '';
5699
+
5700
+ for (var key in value) {
5701
+ if (value[key]) {
5702
+ if (res) {
5703
+ res += ' ';
5704
+ }
5705
+
5706
+ res += key;
5707
+ }
5708
+ }
5709
+
5710
+ return res;
5711
+ }
5712
+ /* */
5713
+
5714
+
5715
+ var namespaceMap = {
5716
+ svg: 'http://www.w3.org/2000/svg',
5717
+ math: 'http://www.w3.org/1998/Math/MathML'
5718
+ };
5719
+ var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' + 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' + 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' + 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' + 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' + 'embed,object,param,source,canvas,script,noscript,del,ins,' + 'caption,col,colgroup,table,thead,tbody,td,th,tr,' + 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' + 'output,progress,select,textarea,' + 'details,dialog,menu,menuitem,summary,' + 'content,element,shadow,template,blockquote,iframe,tfoot'); // this map is intentionally selective, only covering SVG elements that may
5720
+ // contain child elements.
5721
+
5722
+ var isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);
5723
+
5724
+ var isPreTag = function (tag) {
5725
+ return tag === 'pre';
5726
+ };
5727
+
5728
+ var isReservedTag = function (tag) {
5729
+ return isHTMLTag(tag) || isSVG(tag);
5730
+ };
5731
+
5732
+ function getTagNamespace(tag) {
5733
+ if (isSVG(tag)) {
5734
+ return 'svg';
5735
+ } // basic support for MathML
5736
+ // note it doesn't support other MathML elements being component roots
5737
+
5738
+
5739
+ if (tag === 'math') {
5740
+ return 'math';
5741
+ }
5742
+ }
5743
+
5744
+ var unknownElementCache = Object.create(null);
5745
+
5746
+ function isUnknownElement(tag) {
5747
+ /* istanbul ignore if */
5748
+ if (!inBrowser) {
5749
+ return true;
5750
+ }
5751
+
5752
+ if (isReservedTag(tag)) {
5753
+ return false;
5754
+ }
5755
+
5756
+ tag = tag.toLowerCase();
5757
+ /* istanbul ignore if */
5758
+
5759
+ if (unknownElementCache[tag] != null) {
5760
+ return unknownElementCache[tag];
5761
+ }
5762
+
5763
+ var el = document.createElement(tag);
5764
+
5765
+ if (tag.indexOf('-') > -1) {
5766
+ // http://stackoverflow.com/a/28210364/1070244
5767
+ return unknownElementCache[tag] = el.constructor === window.HTMLUnknownElement || el.constructor === window.HTMLElement;
5768
+ } else {
5769
+ return unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString());
5770
+ }
5771
+ }
5772
+
5773
+ var isTextInputType = makeMap('text,number,password,search,email,tel,url');
5774
+ /* */
5775
+
5776
+ /**
5777
+ * Query an element selector if it's not an element already.
5778
+ */
5779
+
5780
+ function query(el) {
5781
+ if (typeof el === 'string') {
5782
+ var selected = document.querySelector(el);
5783
+
5784
+ if (!selected) {
5785
+ "development" !== 'production' && warn('Cannot find element: ' + el);
5786
+ return document.createElement('div');
5787
+ }
5788
+
5789
+ return selected;
5790
+ } else {
5791
+ return el;
5792
+ }
5793
+ }
5794
+ /* */
5795
+
5796
+
5797
+ function createElement$1(tagName, vnode) {
5798
+ var elm = document.createElement(tagName);
5799
+
5800
+ if (tagName !== 'select') {
5801
+ return elm;
5802
+ } // false or null will remove the attribute but undefined will not
5803
+
5804
+
5805
+ if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
5806
+ elm.setAttribute('multiple', 'multiple');
5807
+ }
5808
+
5809
+ return elm;
5810
+ }
5811
+
5812
+ function createElementNS(namespace, tagName) {
5813
+ return document.createElementNS(namespaceMap[namespace], tagName);
5814
+ }
5815
+
5816
+ function createTextNode(text) {
5817
+ return document.createTextNode(text);
5818
+ }
5819
+
5820
+ function createComment(text) {
5821
+ return document.createComment(text);
5822
+ }
5823
+
5824
+ function insertBefore(parentNode, newNode, referenceNode) {
5825
+ parentNode.insertBefore(newNode, referenceNode);
5826
+ }
5827
+
5828
+ function removeChild(node, child) {
5829
+ node.removeChild(child);
5830
+ }
5831
+
5832
+ function appendChild(node, child) {
5833
+ node.appendChild(child);
5834
+ }
5835
+
5836
+ function parentNode(node) {
5837
+ return node.parentNode;
5838
+ }
5839
+
5840
+ function nextSibling(node) {
5841
+ return node.nextSibling;
5842
+ }
5843
+
5844
+ function tagName(node) {
5845
+ return node.tagName;
5846
+ }
5847
+
5848
+ function setTextContent(node, text) {
5849
+ node.textContent = text;
5850
+ }
5851
+
5852
+ function setStyleScope(node, scopeId) {
5853
+ node.setAttribute(scopeId, '');
5854
+ }
5855
+
5856
+ var nodeOps = /*#__PURE__*/Object.freeze({
5857
+ createElement: createElement$1,
5858
+ createElementNS: createElementNS,
5859
+ createTextNode: createTextNode,
5860
+ createComment: createComment,
5861
+ insertBefore: insertBefore,
5862
+ removeChild: removeChild,
5863
+ appendChild: appendChild,
5864
+ parentNode: parentNode,
5865
+ nextSibling: nextSibling,
5866
+ tagName: tagName,
5867
+ setTextContent: setTextContent,
5868
+ setStyleScope: setStyleScope
5869
+ });
5870
+ /* */
5871
+
5872
+ var ref = {
5873
+ create: function create(_, vnode) {
5874
+ registerRef(vnode);
5875
+ },
5876
+ update: function update(oldVnode, vnode) {
5877
+ if (oldVnode.data.ref !== vnode.data.ref) {
5878
+ registerRef(oldVnode, true);
5879
+ registerRef(vnode);
5880
+ }
5881
+ },
5882
+ destroy: function destroy(vnode) {
5883
+ registerRef(vnode, true);
5884
+ }
5885
+ };
5886
+
5887
+ function registerRef(vnode, isRemoval) {
5888
+ var key = vnode.data.ref;
5889
+
5890
+ if (!isDef(key)) {
5891
+ return;
5892
+ }
5893
+
5894
+ var vm = vnode.context;
5895
+ var ref = vnode.componentInstance || vnode.elm;
5896
+ var refs = vm.$refs;
5897
+
5898
+ if (isRemoval) {
5899
+ if (Array.isArray(refs[key])) {
5900
+ remove(refs[key], ref);
5901
+ } else if (refs[key] === ref) {
5902
+ refs[key] = undefined;
5903
+ }
5904
+ } else {
5905
+ if (vnode.data.refInFor) {
5906
+ if (!Array.isArray(refs[key])) {
5907
+ refs[key] = [ref];
5908
+ } else if (refs[key].indexOf(ref) < 0) {
5909
+ // $flow-disable-line
5910
+ refs[key].push(ref);
5911
+ }
5912
+ } else {
5913
+ refs[key] = ref;
5914
+ }
5915
+ }
5916
+ }
5917
+ /**
5918
+ * Virtual DOM patching algorithm based on Snabbdom by
5919
+ * Simon Friis Vindum (@paldepind)
5920
+ * Licensed under the MIT License
5921
+ * https://github.com/paldepind/snabbdom/blob/master/LICENSE
5922
+ *
5923
+ * modified by Evan You (@yyx990803)
5924
+ *
5925
+ * Not type-checking this because this file is perf-critical and the cost
5926
+ * of making flow understand it is not worth it.
5927
+ */
5928
+
5929
+
5930
+ var emptyNode = new VNode('', {}, []);
5931
+ var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
5932
+
5933
+ function sameVnode(a, b) {
5934
+ return a.key === b.key && (a.tag === b.tag && a.isComment === b.isComment && isDef(a.data) === isDef(b.data) && sameInputType(a, b) || isTrue(a.isAsyncPlaceholder) && a.asyncFactory === b.asyncFactory && isUndef(b.asyncFactory.error));
5935
+ }
5936
+
5937
+ function sameInputType(a, b) {
5938
+ if (a.tag !== 'input') {
5939
+ return true;
5940
+ }
5941
+
5942
+ var i;
5943
+ var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
5944
+ var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
5945
+ return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB);
5946
+ }
5947
+
5948
+ function createKeyToOldIdx(children, beginIdx, endIdx) {
5949
+ var i, key;
5950
+ var map = {};
5951
+
5952
+ for (i = beginIdx; i <= endIdx; ++i) {
5953
+ key = children[i].key;
5954
+
5955
+ if (isDef(key)) {
5956
+ map[key] = i;
5957
+ }
5958
+ }
5959
+
5960
+ return map;
5961
+ }
5962
+
5963
+ function createPatchFunction(backend) {
5964
+ var i, j;
5965
+ var cbs = {};
5966
+ var modules = backend.modules;
5967
+ var nodeOps = backend.nodeOps;
5968
+
5969
+ for (i = 0; i < hooks.length; ++i) {
5970
+ cbs[hooks[i]] = [];
5971
+
5972
+ for (j = 0; j < modules.length; ++j) {
5973
+ if (isDef(modules[j][hooks[i]])) {
5974
+ cbs[hooks[i]].push(modules[j][hooks[i]]);
5975
+ }
5976
+ }
5977
+ }
5978
+
5979
+ function emptyNodeAt(elm) {
5980
+ return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm);
5981
+ }
5982
+
5983
+ function createRmCb(childElm, listeners) {
5984
+ function remove$$1() {
5985
+ if (--remove$$1.listeners === 0) {
5986
+ removeNode(childElm);
5987
+ }
5988
+ }
5989
+
5990
+ remove$$1.listeners = listeners;
5991
+ return remove$$1;
5992
+ }
5993
+
5994
+ function removeNode(el) {
5995
+ var parent = nodeOps.parentNode(el); // element may have already been removed due to v-html / v-text
5996
+
5997
+ if (isDef(parent)) {
5998
+ nodeOps.removeChild(parent, el);
5999
+ }
6000
+ }
6001
+
6002
+ function isUnknownElement$$1(vnode, inVPre) {
6003
+ return !inVPre && !vnode.ns && !(config.ignoredElements.length && config.ignoredElements.some(function (ignore) {
6004
+ return isRegExp(ignore) ? ignore.test(vnode.tag) : ignore === vnode.tag;
6005
+ })) && config.isUnknownElement(vnode.tag);
6006
+ }
6007
+
6008
+ var creatingElmInVPre = 0;
6009
+
6010
+ function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) {
6011
+ if (isDef(vnode.elm) && isDef(ownerArray)) {
6012
+ // This vnode was used in a previous render!
6013
+ // now it's used as a new node, overwriting its elm would cause
6014
+ // potential patch errors down the road when it's used as an insertion
6015
+ // reference node. Instead, we clone the node on-demand before creating
6016
+ // associated DOM element for it.
6017
+ vnode = ownerArray[index] = cloneVNode(vnode);
6018
+ }
6019
+
6020
+ vnode.isRootInsert = !nested; // for transition enter check
6021
+
6022
+ if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
6023
+ return;
6024
+ }
6025
+
6026
+ var data = vnode.data;
6027
+ var children = vnode.children;
6028
+ var tag = vnode.tag;
6029
+
6030
+ if (isDef(tag)) {
6031
+ if ("development" !== 'production') {
6032
+ if (data && data.pre) {
6033
+ creatingElmInVPre++;
6034
+ }
6035
+
6036
+ if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
6037
+ warn('Unknown custom element: <' + tag + '> - did you ' + 'register the component correctly? For recursive components, ' + 'make sure to provide the "name" option.', vnode.context);
6038
+ }
6039
+ }
6040
+
6041
+ vnode.elm = vnode.ns ? nodeOps.createElementNS(vnode.ns, tag) : nodeOps.createElement(tag, vnode);
6042
+ setScope(vnode);
6043
+ /* istanbul ignore if */
6044
+
6045
+ {
6046
+ createChildren(vnode, children, insertedVnodeQueue);
6047
+
6048
+ if (isDef(data)) {
6049
+ invokeCreateHooks(vnode, insertedVnodeQueue);
6050
+ }
6051
+
6052
+ insert(parentElm, vnode.elm, refElm);
6053
+ }
6054
+
6055
+ if ("development" !== 'production' && data && data.pre) {
6056
+ creatingElmInVPre--;
6057
+ }
6058
+ } else if (isTrue(vnode.isComment)) {
6059
+ vnode.elm = nodeOps.createComment(vnode.text);
6060
+ insert(parentElm, vnode.elm, refElm);
6061
+ } else {
6062
+ vnode.elm = nodeOps.createTextNode(vnode.text);
6063
+ insert(parentElm, vnode.elm, refElm);
6064
+ }
6065
+ }
6066
+
6067
+ function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
6068
+ var i = vnode.data;
6069
+
6070
+ if (isDef(i)) {
6071
+ var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
6072
+
6073
+ if (isDef(i = i.hook) && isDef(i = i.init)) {
6074
+ i(vnode, false
6075
+ /* hydrating */
6076
+ );
6077
+ } // after calling the init hook, if the vnode is a child component
6078
+ // it should've created a child instance and mounted it. the child
6079
+ // component also has set the placeholder vnode's elm.
6080
+ // in that case we can just return the element and be done.
6081
+
6082
+
6083
+ if (isDef(vnode.componentInstance)) {
6084
+ initComponent(vnode, insertedVnodeQueue);
6085
+ insert(parentElm, vnode.elm, refElm);
6086
+
6087
+ if (isTrue(isReactivated)) {
6088
+ reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
6089
+ }
6090
+
6091
+ return true;
6092
+ }
6093
+ }
6094
+ }
6095
+
6096
+ function initComponent(vnode, insertedVnodeQueue) {
6097
+ if (isDef(vnode.data.pendingInsert)) {
6098
+ insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
6099
+ vnode.data.pendingInsert = null;
6100
+ }
6101
+
6102
+ vnode.elm = vnode.componentInstance.$el;
6103
+
6104
+ if (isPatchable(vnode)) {
6105
+ invokeCreateHooks(vnode, insertedVnodeQueue);
6106
+ setScope(vnode);
6107
+ } else {
6108
+ // empty component root.
6109
+ // skip all element-related modules except for ref (#3455)
6110
+ registerRef(vnode); // make sure to invoke the insert hook
6111
+
6112
+ insertedVnodeQueue.push(vnode);
6113
+ }
6114
+ }
6115
+
6116
+ function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
6117
+ var i; // hack for #4339: a reactivated component with inner transition
6118
+ // does not trigger because the inner node's created hooks are not called
6119
+ // again. It's not ideal to involve module-specific logic in here but
6120
+ // there doesn't seem to be a better way to do it.
6121
+
6122
+ var innerNode = vnode;
6123
+
6124
+ while (innerNode.componentInstance) {
6125
+ innerNode = innerNode.componentInstance._vnode;
6126
+
6127
+ if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
6128
+ for (i = 0; i < cbs.activate.length; ++i) {
6129
+ cbs.activate[i](emptyNode, innerNode);
6130
+ }
6131
+
6132
+ insertedVnodeQueue.push(innerNode);
6133
+ break;
6134
+ }
6135
+ } // unlike a newly created component,
6136
+ // a reactivated keep-alive component doesn't insert itself
6137
+
6138
+
6139
+ insert(parentElm, vnode.elm, refElm);
6140
+ }
6141
+
6142
+ function insert(parent, elm, ref$$1) {
6143
+ if (isDef(parent)) {
6144
+ if (isDef(ref$$1)) {
6145
+ if (nodeOps.parentNode(ref$$1) === parent) {
6146
+ nodeOps.insertBefore(parent, elm, ref$$1);
6147
+ }
6148
+ } else {
6149
+ nodeOps.appendChild(parent, elm);
6150
+ }
6151
+ }
6152
+ }
6153
+
6154
+ function createChildren(vnode, children, insertedVnodeQueue) {
6155
+ if (Array.isArray(children)) {
6156
+ if ("development" !== 'production') {
6157
+ checkDuplicateKeys(children);
6158
+ }
6159
+
6160
+ for (var i = 0; i < children.length; ++i) {
6161
+ createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
6162
+ }
6163
+ } else if (isPrimitive(vnode.text)) {
6164
+ nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
6165
+ }
6166
+ }
6167
+
6168
+ function isPatchable(vnode) {
6169
+ while (vnode.componentInstance) {
6170
+ vnode = vnode.componentInstance._vnode;
6171
+ }
6172
+
6173
+ return isDef(vnode.tag);
6174
+ }
6175
+
6176
+ function invokeCreateHooks(vnode, insertedVnodeQueue) {
6177
+ for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6178
+ cbs.create[i$1](emptyNode, vnode);
6179
+ }
6180
+
6181
+ i = vnode.data.hook; // Reuse variable
6182
+
6183
+ if (isDef(i)) {
6184
+ if (isDef(i.create)) {
6185
+ i.create(emptyNode, vnode);
6186
+ }
6187
+
6188
+ if (isDef(i.insert)) {
6189
+ insertedVnodeQueue.push(vnode);
6190
+ }
6191
+ }
6192
+ } // set scope id attribute for scoped CSS.
6193
+ // this is implemented as a special case to avoid the overhead
6194
+ // of going through the normal attribute patching process.
6195
+
6196
+
6197
+ function setScope(vnode) {
6198
+ var i;
6199
+
6200
+ if (isDef(i = vnode.fnScopeId)) {
6201
+ nodeOps.setStyleScope(vnode.elm, i);
6202
+ } else {
6203
+ var ancestor = vnode;
6204
+
6205
+ while (ancestor) {
6206
+ if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
6207
+ nodeOps.setStyleScope(vnode.elm, i);
6208
+ }
6209
+
6210
+ ancestor = ancestor.parent;
6211
+ }
6212
+ } // for slot content they should also get the scopeId from the host instance.
6213
+
6214
+
6215
+ if (isDef(i = activeInstance) && i !== vnode.context && i !== vnode.fnContext && isDef(i = i.$options._scopeId)) {
6216
+ nodeOps.setStyleScope(vnode.elm, i);
6217
+ }
6218
+ }
6219
+
6220
+ function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
6221
+ for (; startIdx <= endIdx; ++startIdx) {
6222
+ createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
6223
+ }
6224
+ }
6225
+
6226
+ function invokeDestroyHook(vnode) {
6227
+ var i, j;
6228
+ var data = vnode.data;
6229
+
6230
+ if (isDef(data)) {
6231
+ if (isDef(i = data.hook) && isDef(i = i.destroy)) {
6232
+ i(vnode);
6233
+ }
6234
+
6235
+ for (i = 0; i < cbs.destroy.length; ++i) {
6236
+ cbs.destroy[i](vnode);
6237
+ }
6238
+ }
6239
+
6240
+ if (isDef(i = vnode.children)) {
6241
+ for (j = 0; j < vnode.children.length; ++j) {
6242
+ invokeDestroyHook(vnode.children[j]);
6243
+ }
6244
+ }
6245
+ }
6246
+
6247
+ function removeVnodes(vnodes, startIdx, endIdx) {
6248
+ for (; startIdx <= endIdx; ++startIdx) {
6249
+ var ch = vnodes[startIdx];
6250
+
6251
+ if (isDef(ch)) {
6252
+ if (isDef(ch.tag)) {
6253
+ removeAndInvokeRemoveHook(ch);
6254
+ invokeDestroyHook(ch);
6255
+ } else {
6256
+ // Text node
6257
+ removeNode(ch.elm);
6258
+ }
6259
+ }
6260
+ }
6261
+ }
6262
+
6263
+ function removeAndInvokeRemoveHook(vnode, rm) {
6264
+ if (isDef(rm) || isDef(vnode.data)) {
6265
+ var i;
6266
+ var listeners = cbs.remove.length + 1;
6267
+
6268
+ if (isDef(rm)) {
6269
+ // we have a recursively passed down rm callback
6270
+ // increase the listeners count
6271
+ rm.listeners += listeners;
6272
+ } else {
6273
+ // directly removing
6274
+ rm = createRmCb(vnode.elm, listeners);
6275
+ } // recursively invoke hooks on child component root node
6276
+
6277
+
6278
+ if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
6279
+ removeAndInvokeRemoveHook(i, rm);
6280
+ }
6281
+
6282
+ for (i = 0; i < cbs.remove.length; ++i) {
6283
+ cbs.remove[i](vnode, rm);
6284
+ }
6285
+
6286
+ if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
6287
+ i(vnode, rm);
6288
+ } else {
6289
+ rm();
6290
+ }
6291
+ } else {
6292
+ removeNode(vnode.elm);
6293
+ }
6294
+ }
6295
+
6296
+ function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
6297
+ var oldStartIdx = 0;
6298
+ var newStartIdx = 0;
6299
+ var oldEndIdx = oldCh.length - 1;
6300
+ var oldStartVnode = oldCh[0];
6301
+ var oldEndVnode = oldCh[oldEndIdx];
6302
+ var newEndIdx = newCh.length - 1;
6303
+ var newStartVnode = newCh[0];
6304
+ var newEndVnode = newCh[newEndIdx];
6305
+ var oldKeyToIdx, idxInOld, vnodeToMove, refElm; // removeOnly is a special flag used only by <transition-group>
6306
+ // to ensure removed elements stay in correct relative positions
6307
+ // during leaving transitions
6308
+
6309
+ var canMove = !removeOnly;
6310
+
6311
+ if ("development" !== 'production') {
6312
+ checkDuplicateKeys(newCh);
6313
+ }
6314
+
6315
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
6316
+ if (isUndef(oldStartVnode)) {
6317
+ oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
6318
+ } else if (isUndef(oldEndVnode)) {
6319
+ oldEndVnode = oldCh[--oldEndIdx];
6320
+ } else if (sameVnode(oldStartVnode, newStartVnode)) {
6321
+ patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6322
+ oldStartVnode = oldCh[++oldStartIdx];
6323
+ newStartVnode = newCh[++newStartIdx];
6324
+ } else if (sameVnode(oldEndVnode, newEndVnode)) {
6325
+ patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6326
+ oldEndVnode = oldCh[--oldEndIdx];
6327
+ newEndVnode = newCh[--newEndIdx];
6328
+ } else if (sameVnode(oldStartVnode, newEndVnode)) {
6329
+ // Vnode moved right
6330
+ patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
6331
+ canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
6332
+ oldStartVnode = oldCh[++oldStartIdx];
6333
+ newEndVnode = newCh[--newEndIdx];
6334
+ } else if (sameVnode(oldEndVnode, newStartVnode)) {
6335
+ // Vnode moved left
6336
+ patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6337
+ canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
6338
+ oldEndVnode = oldCh[--oldEndIdx];
6339
+ newStartVnode = newCh[++newStartIdx];
6340
+ } else {
6341
+ if (isUndef(oldKeyToIdx)) {
6342
+ oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
6343
+ }
6344
+
6345
+ idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
6346
+
6347
+ if (isUndef(idxInOld)) {
6348
+ // New element
6349
+ createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6350
+ } else {
6351
+ vnodeToMove = oldCh[idxInOld];
6352
+
6353
+ if (sameVnode(vnodeToMove, newStartVnode)) {
6354
+ patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
6355
+ oldCh[idxInOld] = undefined;
6356
+ canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
6357
+ } else {
6358
+ // same key but different element. treat as new element
6359
+ createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
6360
+ }
6361
+ }
6362
+
6363
+ newStartVnode = newCh[++newStartIdx];
6364
+ }
6365
+ }
6366
+
6367
+ if (oldStartIdx > oldEndIdx) {
6368
+ refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6369
+ addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6370
+ } else if (newStartIdx > newEndIdx) {
6371
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
6372
+ }
6373
+ }
6374
+
6375
+ function checkDuplicateKeys(children) {
6376
+ var seenKeys = {};
6377
+
6378
+ for (var i = 0; i < children.length; i++) {
6379
+ var vnode = children[i];
6380
+ var key = vnode.key;
6381
+
6382
+ if (isDef(key)) {
6383
+ if (seenKeys[key]) {
6384
+ warn("Duplicate keys detected: '" + key + "'. This may cause an update error.", vnode.context);
6385
+ } else {
6386
+ seenKeys[key] = true;
6387
+ }
6388
+ }
6389
+ }
6390
+ }
6391
+
6392
+ function findIdxInOld(node, oldCh, start, end) {
6393
+ for (var i = start; i < end; i++) {
6394
+ var c = oldCh[i];
6395
+
6396
+ if (isDef(c) && sameVnode(node, c)) {
6397
+ return i;
6398
+ }
6399
+ }
6400
+ }
6401
+
6402
+ function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) {
6403
+ if (oldVnode === vnode) {
6404
+ return;
6405
+ }
6406
+
6407
+ if (isDef(vnode.elm) && isDef(ownerArray)) {
6408
+ // clone reused vnode
6409
+ vnode = ownerArray[index] = cloneVNode(vnode);
6410
+ }
6411
+
6412
+ var elm = vnode.elm = oldVnode.elm;
6413
+
6414
+ if (isTrue(oldVnode.isAsyncPlaceholder)) {
6415
+ if (isDef(vnode.asyncFactory.resolved)) {
6416
+ hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
6417
+ } else {
6418
+ vnode.isAsyncPlaceholder = true;
6419
+ }
6420
+
6421
+ return;
6422
+ } // reuse element for static trees.
6423
+ // note we only do this if the vnode is cloned -
6424
+ // if the new node is not cloned it means the render functions have been
6425
+ // reset by the hot-reload-api and we need to do a proper re-render.
6426
+
6427
+
6428
+ if (isTrue(vnode.isStatic) && isTrue(oldVnode.isStatic) && vnode.key === oldVnode.key && (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
6429
+ vnode.componentInstance = oldVnode.componentInstance;
6430
+ return;
6431
+ }
6432
+
6433
+ var i;
6434
+ var data = vnode.data;
6435
+
6436
+ if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
6437
+ i(oldVnode, vnode);
6438
+ }
6439
+
6440
+ var oldCh = oldVnode.children;
6441
+ var ch = vnode.children;
6442
+
6443
+ if (isDef(data) && isPatchable(vnode)) {
6444
+ for (i = 0; i < cbs.update.length; ++i) {
6445
+ cbs.update[i](oldVnode, vnode);
6446
+ }
6447
+
6448
+ if (isDef(i = data.hook) && isDef(i = i.update)) {
6449
+ i(oldVnode, vnode);
6450
+ }
6451
+ }
6452
+
6453
+ if (isUndef(vnode.text)) {
6454
+ if (isDef(oldCh) && isDef(ch)) {
6455
+ if (oldCh !== ch) {
6456
+ updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);
6457
+ }
6458
+ } else if (isDef(ch)) {
6459
+ if ("development" !== 'production') {
6460
+ checkDuplicateKeys(ch);
6461
+ }
6462
+
6463
+ if (isDef(oldVnode.text)) {
6464
+ nodeOps.setTextContent(elm, '');
6465
+ }
6466
+
6467
+ addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6468
+ } else if (isDef(oldCh)) {
6469
+ removeVnodes(oldCh, 0, oldCh.length - 1);
6470
+ } else if (isDef(oldVnode.text)) {
6471
+ nodeOps.setTextContent(elm, '');
6472
+ }
6473
+ } else if (oldVnode.text !== vnode.text) {
6474
+ nodeOps.setTextContent(elm, vnode.text);
6475
+ }
6476
+
6477
+ if (isDef(data)) {
6478
+ if (isDef(i = data.hook) && isDef(i = i.postpatch)) {
6479
+ i(oldVnode, vnode);
6480
+ }
6481
+ }
6482
+ }
6483
+
6484
+ function invokeInsertHook(vnode, queue, initial) {
6485
+ // delay insert hooks for component root nodes, invoke them after the
6486
+ // element is really inserted
6487
+ if (isTrue(initial) && isDef(vnode.parent)) {
6488
+ vnode.parent.data.pendingInsert = queue;
6489
+ } else {
6490
+ for (var i = 0; i < queue.length; ++i) {
6491
+ queue[i].data.hook.insert(queue[i]);
6492
+ }
6493
+ }
6494
+ }
6495
+
6496
+ var hydrationBailed = false; // list of modules that can skip create hook during hydration because they
6497
+ // are already rendered on the client or has no need for initialization
6498
+ // Note: style is excluded because it relies on initial clone for future
6499
+ // deep updates (#7063).
6500
+
6501
+ var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key'); // Note: this is a browser-only function so we can assume elms are DOM nodes.
6502
+
6503
+ function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {
6504
+ var i;
6505
+ var tag = vnode.tag;
6506
+ var data = vnode.data;
6507
+ var children = vnode.children;
6508
+ inVPre = inVPre || data && data.pre;
6509
+ vnode.elm = elm;
6510
+
6511
+ if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
6512
+ vnode.isAsyncPlaceholder = true;
6513
+ return true;
6514
+ } // assert node match
6515
+
6516
+
6517
+ if ("development" !== 'production') {
6518
+ if (!assertNodeMatch(elm, vnode, inVPre)) {
6519
+ return false;
6520
+ }
6521
+ }
6522
+
6523
+ if (isDef(data)) {
6524
+ if (isDef(i = data.hook) && isDef(i = i.init)) {
6525
+ i(vnode, true
6526
+ /* hydrating */
6527
+ );
6528
+ }
6529
+
6530
+ if (isDef(i = vnode.componentInstance)) {
6531
+ // child component. it should have hydrated its own tree.
6532
+ initComponent(vnode, insertedVnodeQueue);
6533
+ return true;
6534
+ }
6535
+ }
6536
+
6537
+ if (isDef(tag)) {
6538
+ if (isDef(children)) {
6539
+ // empty element, allow client to pick up and populate children
6540
+ if (!elm.hasChildNodes()) {
6541
+ createChildren(vnode, children, insertedVnodeQueue);
6542
+ } else {
6543
+ // v-html and domProps: innerHTML
6544
+ if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
6545
+ if (i !== elm.innerHTML) {
6546
+ /* istanbul ignore if */
6547
+ if ("development" !== 'production' && typeof console !== 'undefined' && !hydrationBailed) {
6548
+ hydrationBailed = true;
6549
+ console.warn('Parent: ', elm);
6550
+ console.warn('server innerHTML: ', i);
6551
+ console.warn('client innerHTML: ', elm.innerHTML);
6552
+ }
6553
+
6554
+ return false;
6555
+ }
6556
+ } else {
6557
+ // iterate and compare children lists
6558
+ var childrenMatch = true;
6559
+ var childNode = elm.firstChild;
6560
+
6561
+ for (var i$1 = 0; i$1 < children.length; i$1++) {
6562
+ if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
6563
+ childrenMatch = false;
6564
+ break;
6565
+ }
6566
+
6567
+ childNode = childNode.nextSibling;
6568
+ } // if childNode is not null, it means the actual childNodes list is
6569
+ // longer than the virtual children list.
6570
+
6571
+
6572
+ if (!childrenMatch || childNode) {
6573
+ /* istanbul ignore if */
6574
+ if ("development" !== 'production' && typeof console !== 'undefined' && !hydrationBailed) {
6575
+ hydrationBailed = true;
6576
+ console.warn('Parent: ', elm);
6577
+ console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
6578
+ }
6579
+
6580
+ return false;
6581
+ }
6582
+ }
6583
+ }
6584
+ }
6585
+
6586
+ if (isDef(data)) {
6587
+ var fullInvoke = false;
6588
+
6589
+ for (var key in data) {
6590
+ if (!isRenderedModule(key)) {
6591
+ fullInvoke = true;
6592
+ invokeCreateHooks(vnode, insertedVnodeQueue);
6593
+ break;
6594
+ }
6595
+ }
6596
+
6597
+ if (!fullInvoke && data['class']) {
6598
+ // ensure collecting deps for deep class bindings for future updates
6599
+ traverse(data['class']);
6600
+ }
6601
+ }
6602
+ } else if (elm.data !== vnode.text) {
6603
+ elm.data = vnode.text;
6604
+ }
6605
+
6606
+ return true;
6607
+ }
6608
+
6609
+ function assertNodeMatch(node, vnode, inVPre) {
6610
+ if (isDef(vnode.tag)) {
6611
+ return vnode.tag.indexOf('vue-component') === 0 || !isUnknownElement$$1(vnode, inVPre) && vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase());
6612
+ } else {
6613
+ return node.nodeType === (vnode.isComment ? 8 : 3);
6614
+ }
6615
+ }
6616
+
6617
+ return function patch(oldVnode, vnode, hydrating, removeOnly) {
6618
+ if (isUndef(vnode)) {
6619
+ if (isDef(oldVnode)) {
6620
+ invokeDestroyHook(oldVnode);
6621
+ }
6622
+
6623
+ return;
6624
+ }
6625
+
6626
+ var isInitialPatch = false;
6627
+ var insertedVnodeQueue = [];
6628
+
6629
+ if (isUndef(oldVnode)) {
6630
+ // empty mount (likely as component), create new root element
6631
+ isInitialPatch = true;
6632
+ createElm(vnode, insertedVnodeQueue);
6633
+ } else {
6634
+ var isRealElement = isDef(oldVnode.nodeType);
6635
+
6636
+ if (!isRealElement && sameVnode(oldVnode, vnode)) {
6637
+ // patch existing root node
6638
+ patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
6639
+ } else {
6640
+ if (isRealElement) {
6641
+ // mounting to a real element
6642
+ // check if this is server-rendered content and if we can perform
6643
+ // a successful hydration.
6644
+ if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
6645
+ oldVnode.removeAttribute(SSR_ATTR);
6646
+ hydrating = true;
6647
+ }
6648
+
6649
+ if (isTrue(hydrating)) {
6650
+ if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
6651
+ invokeInsertHook(vnode, insertedVnodeQueue, true);
6652
+ return oldVnode;
6653
+ } else if ("development" !== 'production') {
6654
+ warn('The client-side rendered virtual DOM tree is not matching ' + 'server-rendered content. This is likely caused by incorrect ' + 'HTML markup, for example nesting block-level elements inside ' + '<p>, or missing <tbody>. Bailing hydration and performing ' + 'full client-side render.');
6655
+ }
6656
+ } // either not server-rendered, or hydration failed.
6657
+ // create an empty node and replace it
6658
+
6659
+
6660
+ oldVnode = emptyNodeAt(oldVnode);
6661
+ } // replacing existing element
6662
+
6663
+
6664
+ var oldElm = oldVnode.elm;
6665
+ var parentElm = nodeOps.parentNode(oldElm); // create new node
6666
+
6667
+ createElm(vnode, insertedVnodeQueue, // extremely rare edge case: do not insert if old element is in a
6668
+ // leaving transition. Only happens when combining transition +
6669
+ // keep-alive + HOCs. (#4590)
6670
+ oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm)); // update parent placeholder node element, recursively
6671
+
6672
+ if (isDef(vnode.parent)) {
6673
+ var ancestor = vnode.parent;
6674
+ var patchable = isPatchable(vnode);
6675
+
6676
+ while (ancestor) {
6677
+ for (var i = 0; i < cbs.destroy.length; ++i) {
6678
+ cbs.destroy[i](ancestor);
6679
+ }
6680
+
6681
+ ancestor.elm = vnode.elm;
6682
+
6683
+ if (patchable) {
6684
+ for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
6685
+ cbs.create[i$1](emptyNode, ancestor);
6686
+ } // #6513
6687
+ // invoke insert hooks that may have been merged by create hooks.
6688
+ // e.g. for directives that uses the "inserted" hook.
6689
+
6690
+
6691
+ var insert = ancestor.data.hook.insert;
6692
+
6693
+ if (insert.merged) {
6694
+ // start at index 1 to avoid re-invoking component mounted hook
6695
+ for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
6696
+ insert.fns[i$2]();
6697
+ }
6698
+ }
6699
+ } else {
6700
+ registerRef(ancestor);
6701
+ }
6702
+
6703
+ ancestor = ancestor.parent;
6704
+ }
6705
+ } // destroy old node
6706
+
6707
+
6708
+ if (isDef(parentElm)) {
6709
+ removeVnodes([oldVnode], 0, 0);
6710
+ } else if (isDef(oldVnode.tag)) {
6711
+ invokeDestroyHook(oldVnode);
6712
+ }
6713
+ }
6714
+ }
6715
+
6716
+ invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
6717
+ return vnode.elm;
6718
+ };
6719
+ }
6720
+ /* */
6721
+
6722
+
6723
+ var directives = {
6724
+ create: updateDirectives,
6725
+ update: updateDirectives,
6726
+ destroy: function unbindDirectives(vnode) {
6727
+ updateDirectives(vnode, emptyNode);
6728
+ }
6729
+ };
6730
+
6731
+ function updateDirectives(oldVnode, vnode) {
6732
+ if (oldVnode.data.directives || vnode.data.directives) {
6733
+ _update(oldVnode, vnode);
6734
+ }
6735
+ }
6736
+
6737
+ function _update(oldVnode, vnode) {
6738
+ var isCreate = oldVnode === emptyNode;
6739
+ var isDestroy = vnode === emptyNode;
6740
+ var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
6741
+ var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
6742
+ var dirsWithInsert = [];
6743
+ var dirsWithPostpatch = [];
6744
+ var key, oldDir, dir;
6745
+
6746
+ for (key in newDirs) {
6747
+ oldDir = oldDirs[key];
6748
+ dir = newDirs[key];
6749
+
6750
+ if (!oldDir) {
6751
+ // new directive, bind
6752
+ callHook$1(dir, 'bind', vnode, oldVnode);
6753
+
6754
+ if (dir.def && dir.def.inserted) {
6755
+ dirsWithInsert.push(dir);
6756
+ }
6757
+ } else {
6758
+ // existing directive, update
6759
+ dir.oldValue = oldDir.value;
6760
+ dir.oldArg = oldDir.arg;
6761
+ callHook$1(dir, 'update', vnode, oldVnode);
6762
+
6763
+ if (dir.def && dir.def.componentUpdated) {
6764
+ dirsWithPostpatch.push(dir);
6765
+ }
6766
+ }
6767
+ }
6768
+
6769
+ if (dirsWithInsert.length) {
6770
+ var callInsert = function () {
6771
+ for (var i = 0; i < dirsWithInsert.length; i++) {
6772
+ callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
6773
+ }
6774
+ };
6775
+
6776
+ if (isCreate) {
6777
+ mergeVNodeHook(vnode, 'insert', callInsert);
6778
+ } else {
6779
+ callInsert();
6780
+ }
6781
+ }
6782
+
6783
+ if (dirsWithPostpatch.length) {
6784
+ mergeVNodeHook(vnode, 'postpatch', function () {
6785
+ for (var i = 0; i < dirsWithPostpatch.length; i++) {
6786
+ callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
6787
+ }
6788
+ });
6789
+ }
6790
+
6791
+ if (!isCreate) {
6792
+ for (key in oldDirs) {
6793
+ if (!newDirs[key]) {
6794
+ // no longer present, unbind
6795
+ callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
6796
+ }
6797
+ }
6798
+ }
6799
+ }
6800
+
6801
+ var emptyModifiers = Object.create(null);
6802
+
6803
+ function normalizeDirectives$1(dirs, vm) {
6804
+ var res = Object.create(null);
6805
+
6806
+ if (!dirs) {
6807
+ // $flow-disable-line
6808
+ return res;
6809
+ }
6810
+
6811
+ var i, dir;
6812
+
6813
+ for (i = 0; i < dirs.length; i++) {
6814
+ dir = dirs[i];
6815
+
6816
+ if (!dir.modifiers) {
6817
+ // $flow-disable-line
6818
+ dir.modifiers = emptyModifiers;
6819
+ }
6820
+
6821
+ res[getRawDirName(dir)] = dir;
6822
+ dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
6823
+ } // $flow-disable-line
6824
+
6825
+
6826
+ return res;
6827
+ }
6828
+
6829
+ function getRawDirName(dir) {
6830
+ return dir.rawName || dir.name + "." + Object.keys(dir.modifiers || {}).join('.');
6831
+ }
6832
+
6833
+ function callHook$1(dir, hook, vnode, oldVnode, isDestroy) {
6834
+ var fn = dir.def && dir.def[hook];
6835
+
6836
+ if (fn) {
6837
+ try {
6838
+ fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
6839
+ } catch (e) {
6840
+ handleError(e, vnode.context, "directive " + dir.name + " " + hook + " hook");
6841
+ }
6842
+ }
6843
+ }
6844
+
6845
+ var baseModules = [ref, directives];
6846
+ /* */
6847
+
6848
+ function updateAttrs(oldVnode, vnode) {
6849
+ var opts = vnode.componentOptions;
6850
+
6851
+ if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
6852
+ return;
6853
+ }
6854
+
6855
+ if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
6856
+ return;
6857
+ }
6858
+
6859
+ var key, cur, old;
6860
+ var elm = vnode.elm;
6861
+ var oldAttrs = oldVnode.data.attrs || {};
6862
+ var attrs = vnode.data.attrs || {}; // clone observed objects, as the user probably wants to mutate it
6863
+
6864
+ if (isDef(attrs.__ob__)) {
6865
+ attrs = vnode.data.attrs = extend({}, attrs);
6866
+ }
6867
+
6868
+ for (key in attrs) {
6869
+ cur = attrs[key];
6870
+ old = oldAttrs[key];
6871
+
6872
+ if (old !== cur) {
6873
+ setAttr(elm, key, cur);
6874
+ }
6875
+ } // #4391: in IE9, setting type can reset value for input[type=radio]
6876
+ // #6666: IE/Edge forces progress value down to 1 before setting a max
6877
+
6878
+ /* istanbul ignore if */
6879
+
6880
+
6881
+ if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
6882
+ setAttr(elm, 'value', attrs.value);
6883
+ }
6884
+
6885
+ for (key in oldAttrs) {
6886
+ if (isUndef(attrs[key])) {
6887
+ if (isXlink(key)) {
6888
+ elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
6889
+ } else if (!isEnumeratedAttr(key)) {
6890
+ elm.removeAttribute(key);
6891
+ }
6892
+ }
6893
+ }
6894
+ }
6895
+
6896
+ function setAttr(el, key, value) {
6897
+ if (el.tagName.indexOf('-') > -1) {
6898
+ baseSetAttr(el, key, value);
6899
+ } else if (isBooleanAttr(key)) {
6900
+ // set attribute for blank value
6901
+ // e.g. <option disabled>Select one</option>
6902
+ if (isFalsyAttrValue(value)) {
6903
+ el.removeAttribute(key);
6904
+ } else {
6905
+ // technically allowfullscreen is a boolean attribute for <iframe>,
6906
+ // but Flash expects a value of "true" when used on <embed> tag
6907
+ value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key;
6908
+ el.setAttribute(key, value);
6909
+ }
6910
+ } else if (isEnumeratedAttr(key)) {
6911
+ el.setAttribute(key, convertEnumeratedValue(key, value));
6912
+ } else if (isXlink(key)) {
6913
+ if (isFalsyAttrValue(value)) {
6914
+ el.removeAttributeNS(xlinkNS, getXlinkProp(key));
6915
+ } else {
6916
+ el.setAttributeNS(xlinkNS, key, value);
6917
+ }
6918
+ } else {
6919
+ baseSetAttr(el, key, value);
6920
+ }
6921
+ }
6922
+
6923
+ function baseSetAttr(el, key, value) {
6924
+ if (isFalsyAttrValue(value)) {
6925
+ el.removeAttribute(key);
6926
+ } else {
6927
+ // #7138: IE10 & 11 fires input event when setting placeholder on
6928
+ // <textarea>... block the first input event and remove the blocker
6929
+ // immediately.
6930
+
6931
+ /* istanbul ignore if */
6932
+ if (isIE && !isIE9 && el.tagName === 'TEXTAREA' && key === 'placeholder' && value !== '' && !el.__ieph) {
6933
+ var blocker = function (e) {
6934
+ e.stopImmediatePropagation();
6935
+ el.removeEventListener('input', blocker);
6936
+ };
6937
+
6938
+ el.addEventListener('input', blocker); // $flow-disable-line
6939
+
6940
+ el.__ieph = true;
6941
+ /* IE placeholder patched */
6942
+ }
6943
+
6944
+ el.setAttribute(key, value);
6945
+ }
6946
+ }
6947
+
6948
+ var attrs = {
6949
+ create: updateAttrs,
6950
+ update: updateAttrs
6951
+ };
6952
+ /* */
6953
+
6954
+ function updateClass(oldVnode, vnode) {
6955
+ var el = vnode.elm;
6956
+ var data = vnode.data;
6957
+ var oldData = oldVnode.data;
6958
+
6959
+ if (isUndef(data.staticClass) && isUndef(data.class) && (isUndef(oldData) || isUndef(oldData.staticClass) && isUndef(oldData.class))) {
6960
+ return;
6961
+ }
6962
+
6963
+ var cls = genClassForVnode(vnode); // handle transition classes
6964
+
6965
+ var transitionClass = el._transitionClasses;
6966
+
6967
+ if (isDef(transitionClass)) {
6968
+ cls = concat(cls, stringifyClass(transitionClass));
6969
+ } // set the class
6970
+
6971
+
6972
+ if (cls !== el._prevClass) {
6973
+ el.setAttribute('class', cls);
6974
+ el._prevClass = cls;
6975
+ }
6976
+ }
6977
+
6978
+ var klass = {
6979
+ create: updateClass,
6980
+ update: updateClass
6981
+ };
6982
+ /* */
6983
+
6984
+ var validDivisionCharRE = /[\w).+\-_$\]]/;
6985
+
6986
+ function parseFilters(exp) {
6987
+ var inSingle = false;
6988
+ var inDouble = false;
6989
+ var inTemplateString = false;
6990
+ var inRegex = false;
6991
+ var curly = 0;
6992
+ var square = 0;
6993
+ var paren = 0;
6994
+ var lastFilterIndex = 0;
6995
+ var c, prev, i, expression, filters;
6996
+
6997
+ for (i = 0; i < exp.length; i++) {
6998
+ prev = c;
6999
+ c = exp.charCodeAt(i);
7000
+
7001
+ if (inSingle) {
7002
+ if (c === 0x27 && prev !== 0x5C) {
7003
+ inSingle = false;
7004
+ }
7005
+ } else if (inDouble) {
7006
+ if (c === 0x22 && prev !== 0x5C) {
7007
+ inDouble = false;
7008
+ }
7009
+ } else if (inTemplateString) {
7010
+ if (c === 0x60 && prev !== 0x5C) {
7011
+ inTemplateString = false;
7012
+ }
7013
+ } else if (inRegex) {
7014
+ if (c === 0x2f && prev !== 0x5C) {
7015
+ inRegex = false;
7016
+ }
7017
+ } else if (c === 0x7C && // pipe
7018
+ exp.charCodeAt(i + 1) !== 0x7C && exp.charCodeAt(i - 1) !== 0x7C && !curly && !square && !paren) {
7019
+ if (expression === undefined) {
7020
+ // first filter, end of expression
7021
+ lastFilterIndex = i + 1;
7022
+ expression = exp.slice(0, i).trim();
7023
+ } else {
7024
+ pushFilter();
7025
+ }
7026
+ } else {
7027
+ switch (c) {
7028
+ case 0x22:
7029
+ inDouble = true;
7030
+ break;
7031
+ // "
7032
+
7033
+ case 0x27:
7034
+ inSingle = true;
7035
+ break;
7036
+ // '
7037
+
7038
+ case 0x60:
7039
+ inTemplateString = true;
7040
+ break;
7041
+ // `
7042
+
7043
+ case 0x28:
7044
+ paren++;
7045
+ break;
7046
+ // (
7047
+
7048
+ case 0x29:
7049
+ paren--;
7050
+ break;
7051
+ // )
7052
+
7053
+ case 0x5B:
7054
+ square++;
7055
+ break;
7056
+ // [
7057
+
7058
+ case 0x5D:
7059
+ square--;
7060
+ break;
7061
+ // ]
7062
+
7063
+ case 0x7B:
7064
+ curly++;
7065
+ break;
7066
+ // {
7067
+
7068
+ case 0x7D:
7069
+ curly--;
7070
+ break;
7071
+ // }
7072
+ }
7073
+
7074
+ if (c === 0x2f) {
7075
+ // /
7076
+ var j = i - 1;
7077
+ var p = void 0; // find first non-whitespace prev char
7078
+
7079
+ for (; j >= 0; j--) {
7080
+ p = exp.charAt(j);
7081
+
7082
+ if (p !== ' ') {
7083
+ break;
7084
+ }
7085
+ }
7086
+
7087
+ if (!p || !validDivisionCharRE.test(p)) {
7088
+ inRegex = true;
7089
+ }
7090
+ }
7091
+ }
7092
+ }
7093
+
7094
+ if (expression === undefined) {
7095
+ expression = exp.slice(0, i).trim();
7096
+ } else if (lastFilterIndex !== 0) {
7097
+ pushFilter();
7098
+ }
7099
+
7100
+ function pushFilter() {
7101
+ (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
7102
+ lastFilterIndex = i + 1;
7103
+ }
7104
+
7105
+ if (filters) {
7106
+ for (i = 0; i < filters.length; i++) {
7107
+ expression = wrapFilter(expression, filters[i]);
7108
+ }
7109
+ }
7110
+
7111
+ return expression;
7112
+ }
7113
+
7114
+ function wrapFilter(exp, filter) {
7115
+ var i = filter.indexOf('(');
7116
+
7117
+ if (i < 0) {
7118
+ // _f: resolveFilter
7119
+ return "_f(\"" + filter + "\")(" + exp + ")";
7120
+ } else {
7121
+ var name = filter.slice(0, i);
7122
+ var args = filter.slice(i + 1);
7123
+ return "_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args);
7124
+ }
7125
+ }
7126
+ /* */
7127
+
7128
+ /* eslint-disable no-unused-vars */
7129
+
7130
+
7131
+ function baseWarn(msg, range) {
7132
+ console.error("[Vue compiler]: " + msg);
7133
+ }
7134
+ /* eslint-enable no-unused-vars */
7135
+
7136
+
7137
+ function pluckModuleFunction(modules, key) {
7138
+ return modules ? modules.map(function (m) {
7139
+ return m[key];
7140
+ }).filter(function (_) {
7141
+ return _;
7142
+ }) : [];
7143
+ }
7144
+
7145
+ function addProp(el, name, value, range, dynamic) {
7146
+ (el.props || (el.props = [])).push(rangeSetItem({
7147
+ name: name,
7148
+ value: value,
7149
+ dynamic: dynamic
7150
+ }, range));
7151
+ el.plain = false;
7152
+ }
7153
+
7154
+ function addAttr(el, name, value, range, dynamic) {
7155
+ var attrs = dynamic ? el.dynamicAttrs || (el.dynamicAttrs = []) : el.attrs || (el.attrs = []);
7156
+ attrs.push(rangeSetItem({
7157
+ name: name,
7158
+ value: value,
7159
+ dynamic: dynamic
7160
+ }, range));
7161
+ el.plain = false;
7162
+ } // add a raw attr (use this in preTransforms)
7163
+
7164
+
7165
+ function addRawAttr(el, name, value, range) {
7166
+ el.attrsMap[name] = value;
7167
+ el.attrsList.push(rangeSetItem({
7168
+ name: name,
7169
+ value: value
7170
+ }, range));
7171
+ }
7172
+
7173
+ function addDirective(el, name, rawName, value, arg, isDynamicArg, modifiers, range) {
7174
+ (el.directives || (el.directives = [])).push(rangeSetItem({
7175
+ name: name,
7176
+ rawName: rawName,
7177
+ value: value,
7178
+ arg: arg,
7179
+ isDynamicArg: isDynamicArg,
7180
+ modifiers: modifiers
7181
+ }, range));
7182
+ el.plain = false;
7183
+ }
7184
+
7185
+ function prependModifierMarker(symbol, name, dynamic) {
7186
+ return dynamic ? "_p(" + name + ",\"" + symbol + "\")" : symbol + name; // mark the event as captured
7187
+ }
7188
+
7189
+ function addHandler(el, name, value, modifiers, important, warn, range, dynamic) {
7190
+ modifiers = modifiers || emptyObject; // warn prevent and passive modifier
7191
+
7192
+ /* istanbul ignore if */
7193
+
7194
+ if ("development" !== 'production' && warn && modifiers.prevent && modifiers.passive) {
7195
+ warn('passive and prevent can\'t be used together. ' + 'Passive handler can\'t prevent default event.', range);
7196
+ } // normalize click.right and click.middle since they don't actually fire
7197
+ // this is technically browser-specific, but at least for now browsers are
7198
+ // the only target envs that have right/middle clicks.
7199
+
7200
+
7201
+ if (modifiers.right) {
7202
+ if (dynamic) {
7203
+ name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
7204
+ } else if (name === 'click') {
7205
+ name = 'contextmenu';
7206
+ delete modifiers.right;
7207
+ }
7208
+ } else if (modifiers.middle) {
7209
+ if (dynamic) {
7210
+ name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
7211
+ } else if (name === 'click') {
7212
+ name = 'mouseup';
7213
+ }
7214
+ } // check capture modifier
7215
+
7216
+
7217
+ if (modifiers.capture) {
7218
+ delete modifiers.capture;
7219
+ name = prependModifierMarker('!', name, dynamic);
7220
+ }
7221
+
7222
+ if (modifiers.once) {
7223
+ delete modifiers.once;
7224
+ name = prependModifierMarker('~', name, dynamic);
7225
+ }
7226
+ /* istanbul ignore if */
7227
+
7228
+
7229
+ if (modifiers.passive) {
7230
+ delete modifiers.passive;
7231
+ name = prependModifierMarker('&', name, dynamic);
7232
+ }
7233
+
7234
+ var events;
7235
+
7236
+ if (modifiers.native) {
7237
+ delete modifiers.native;
7238
+ events = el.nativeEvents || (el.nativeEvents = {});
7239
+ } else {
7240
+ events = el.events || (el.events = {});
7241
+ }
7242
+
7243
+ var newHandler = rangeSetItem({
7244
+ value: value.trim(),
7245
+ dynamic: dynamic
7246
+ }, range);
7247
+
7248
+ if (modifiers !== emptyObject) {
7249
+ newHandler.modifiers = modifiers;
7250
+ }
7251
+
7252
+ var handlers = events[name];
7253
+ /* istanbul ignore if */
7254
+
7255
+ if (Array.isArray(handlers)) {
7256
+ important ? handlers.unshift(newHandler) : handlers.push(newHandler);
7257
+ } else if (handlers) {
7258
+ events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
7259
+ } else {
7260
+ events[name] = newHandler;
7261
+ }
7262
+
7263
+ el.plain = false;
7264
+ }
7265
+
7266
+ function getRawBindingAttr(el, name) {
7267
+ return el.rawAttrsMap[':' + name] || el.rawAttrsMap['v-bind:' + name] || el.rawAttrsMap[name];
7268
+ }
7269
+
7270
+ function getBindingAttr(el, name, getStatic) {
7271
+ var dynamicValue = getAndRemoveAttr(el, ':' + name) || getAndRemoveAttr(el, 'v-bind:' + name);
7272
+
7273
+ if (dynamicValue != null) {
7274
+ return parseFilters(dynamicValue);
7275
+ } else if (getStatic !== false) {
7276
+ var staticValue = getAndRemoveAttr(el, name);
7277
+
7278
+ if (staticValue != null) {
7279
+ return JSON.stringify(staticValue);
7280
+ }
7281
+ }
7282
+ } // note: this only removes the attr from the Array (attrsList) so that it
7283
+ // doesn't get processed by processAttrs.
7284
+ // By default it does NOT remove it from the map (attrsMap) because the map is
7285
+ // needed during codegen.
7286
+
7287
+
7288
+ function getAndRemoveAttr(el, name, removeFromMap) {
7289
+ var val;
7290
+
7291
+ if ((val = el.attrsMap[name]) != null) {
7292
+ var list = el.attrsList;
7293
+
7294
+ for (var i = 0, l = list.length; i < l; i++) {
7295
+ if (list[i].name === name) {
7296
+ list.splice(i, 1);
7297
+ break;
7298
+ }
7299
+ }
7300
+ }
7301
+
7302
+ if (removeFromMap) {
7303
+ delete el.attrsMap[name];
7304
+ }
7305
+
7306
+ return val;
7307
+ }
7308
+
7309
+ function getAndRemoveAttrByRegex(el, name) {
7310
+ var list = el.attrsList;
7311
+
7312
+ for (var i = 0, l = list.length; i < l; i++) {
7313
+ var attr = list[i];
7314
+
7315
+ if (name.test(attr.name)) {
7316
+ list.splice(i, 1);
7317
+ return attr;
7318
+ }
7319
+ }
7320
+ }
7321
+
7322
+ function rangeSetItem(item, range) {
7323
+ if (range) {
7324
+ if (range.start != null) {
7325
+ item.start = range.start;
7326
+ }
7327
+
7328
+ if (range.end != null) {
7329
+ item.end = range.end;
7330
+ }
7331
+ }
7332
+
7333
+ return item;
7334
+ }
7335
+ /* */
7336
+
7337
+ /**
7338
+ * Cross-platform code generation for component v-model
7339
+ */
7340
+
7341
+
7342
+ function genComponentModel(el, value, modifiers) {
7343
+ var ref = modifiers || {};
7344
+ var number = ref.number;
7345
+ var trim = ref.trim;
7346
+ var baseValueExpression = '$$v';
7347
+ var valueExpression = baseValueExpression;
7348
+
7349
+ if (trim) {
7350
+ valueExpression = "(typeof " + baseValueExpression + " === 'string'" + "? " + baseValueExpression + ".trim()" + ": " + baseValueExpression + ")";
7351
+ }
7352
+
7353
+ if (number) {
7354
+ valueExpression = "_n(" + valueExpression + ")";
7355
+ }
7356
+
7357
+ var assignment = genAssignmentCode(value, valueExpression);
7358
+ el.model = {
7359
+ value: "(" + value + ")",
7360
+ expression: JSON.stringify(value),
7361
+ callback: "function (" + baseValueExpression + ") {" + assignment + "}"
7362
+ };
7363
+ }
7364
+ /**
7365
+ * Cross-platform codegen helper for generating v-model value assignment code.
7366
+ */
7367
+
7368
+
7369
+ function genAssignmentCode(value, assignment) {
7370
+ var res = parseModel(value);
7371
+
7372
+ if (res.key === null) {
7373
+ return value + "=" + assignment;
7374
+ } else {
7375
+ return "$set(" + res.exp + ", " + res.key + ", " + assignment + ")";
7376
+ }
7377
+ }
7378
+ /**
7379
+ * Parse a v-model expression into a base path and a final key segment.
7380
+ * Handles both dot-path and possible square brackets.
7381
+ *
7382
+ * Possible cases:
7383
+ *
7384
+ * - test
7385
+ * - test[key]
7386
+ * - test[test1[key]]
7387
+ * - test["a"][key]
7388
+ * - xxx.test[a[a].test1[key]]
7389
+ * - test.xxx.a["asa"][test1[key]]
7390
+ *
7391
+ */
7392
+
7393
+
7394
+ var len, str, chr, index$1, expressionPos, expressionEndPos;
7395
+
7396
+ function parseModel(val) {
7397
+ // Fix https://github.com/vuejs/vue/pull/7730
7398
+ // allow v-model="obj.val " (trailing whitespace)
7399
+ val = val.trim();
7400
+ len = val.length;
7401
+
7402
+ if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
7403
+ index$1 = val.lastIndexOf('.');
7404
+
7405
+ if (index$1 > -1) {
7406
+ return {
7407
+ exp: val.slice(0, index$1),
7408
+ key: '"' + val.slice(index$1 + 1) + '"'
7409
+ };
7410
+ } else {
7411
+ return {
7412
+ exp: val,
7413
+ key: null
7414
+ };
7415
+ }
7416
+ }
7417
+
7418
+ str = val;
7419
+ index$1 = expressionPos = expressionEndPos = 0;
7420
+
7421
+ while (!eof()) {
7422
+ chr = next();
7423
+ /* istanbul ignore if */
7424
+
7425
+ if (isStringStart(chr)) {
7426
+ parseString(chr);
7427
+ } else if (chr === 0x5B) {
7428
+ parseBracket(chr);
7429
+ }
7430
+ }
7431
+
7432
+ return {
7433
+ exp: val.slice(0, expressionPos),
7434
+ key: val.slice(expressionPos + 1, expressionEndPos)
7435
+ };
7436
+ }
7437
+
7438
+ function next() {
7439
+ return str.charCodeAt(++index$1);
7440
+ }
7441
+
7442
+ function eof() {
7443
+ return index$1 >= len;
7444
+ }
7445
+
7446
+ function isStringStart(chr) {
7447
+ return chr === 0x22 || chr === 0x27;
7448
+ }
7449
+
7450
+ function parseBracket(chr) {
7451
+ var inBracket = 1;
7452
+ expressionPos = index$1;
7453
+
7454
+ while (!eof()) {
7455
+ chr = next();
7456
+
7457
+ if (isStringStart(chr)) {
7458
+ parseString(chr);
7459
+ continue;
7460
+ }
7461
+
7462
+ if (chr === 0x5B) {
7463
+ inBracket++;
7464
+ }
7465
+
7466
+ if (chr === 0x5D) {
7467
+ inBracket--;
7468
+ }
7469
+
7470
+ if (inBracket === 0) {
7471
+ expressionEndPos = index$1;
7472
+ break;
7473
+ }
7474
+ }
7475
+ }
7476
+
7477
+ function parseString(chr) {
7478
+ var stringQuote = chr;
7479
+
7480
+ while (!eof()) {
7481
+ chr = next();
7482
+
7483
+ if (chr === stringQuote) {
7484
+ break;
7485
+ }
7486
+ }
7487
+ }
7488
+ /* */
7489
+
7490
+
7491
+ var warn$1; // in some cases, the event used has to be determined at runtime
7492
+ // so we used some reserved tokens during compile.
7493
+
7494
+ var RANGE_TOKEN = '__r';
7495
+ var CHECKBOX_RADIO_TOKEN = '__c';
7496
+
7497
+ function model(el, dir, _warn) {
7498
+ warn$1 = _warn;
7499
+ var value = dir.value;
7500
+ var modifiers = dir.modifiers;
7501
+ var tag = el.tag;
7502
+ var type = el.attrsMap.type;
7503
+
7504
+ if ("development" !== 'production') {
7505
+ // inputs with type="file" are read only and setting the input's
7506
+ // value will throw an error.
7507
+ if (tag === 'input' && type === 'file') {
7508
+ warn$1("<" + el.tag + " v-model=\"" + value + "\" type=\"file\">:\n" + "File inputs are read only. Use a v-on:change listener instead.", el.rawAttrsMap['v-model']);
7509
+ }
7510
+ }
7511
+
7512
+ if (el.component) {
7513
+ genComponentModel(el, value, modifiers); // component v-model doesn't need extra runtime
7514
+
7515
+ return false;
7516
+ } else if (tag === 'select') {
7517
+ genSelect(el, value, modifiers);
7518
+ } else if (tag === 'input' && type === 'checkbox') {
7519
+ genCheckboxModel(el, value, modifiers);
7520
+ } else if (tag === 'input' && type === 'radio') {
7521
+ genRadioModel(el, value, modifiers);
7522
+ } else if (tag === 'input' || tag === 'textarea') {
7523
+ genDefaultModel(el, value, modifiers);
7524
+ } else if (!config.isReservedTag(tag)) {
7525
+ genComponentModel(el, value, modifiers); // component v-model doesn't need extra runtime
7526
+
7527
+ return false;
7528
+ } else if ("development" !== 'production') {
7529
+ warn$1("<" + el.tag + " v-model=\"" + value + "\">: " + "v-model is not supported on this element type. " + 'If you are working with contenteditable, it\'s recommended to ' + 'wrap a library dedicated for that purpose inside a custom component.', el.rawAttrsMap['v-model']);
7530
+ } // ensure runtime directive metadata
7531
+
7532
+
7533
+ return true;
7534
+ }
7535
+
7536
+ function genCheckboxModel(el, value, modifiers) {
7537
+ var number = modifiers && modifiers.number;
7538
+ var valueBinding = getBindingAttr(el, 'value') || 'null';
7539
+ var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
7540
+ var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
7541
+ addProp(el, 'checked', "Array.isArray(" + value + ")" + "?_i(" + value + "," + valueBinding + ")>-1" + (trueValueBinding === 'true' ? ":(" + value + ")" : ":_q(" + value + "," + trueValueBinding + ")"));
7542
+ addHandler(el, 'change', "var $$a=" + value + "," + '$$el=$event.target,' + "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" + 'if(Array.isArray($$a)){' + "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," + '$$i=_i($$a,$$v);' + "if($$el.checked){$$i<0&&(" + genAssignmentCode(value, '$$a.concat([$$v])') + ")}" + "else{$$i>-1&&(" + genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))') + ")}" + "}else{" + genAssignmentCode(value, '$$c') + "}", null, true);
7543
+ }
7544
+
7545
+ function genRadioModel(el, value, modifiers) {
7546
+ var number = modifiers && modifiers.number;
7547
+ var valueBinding = getBindingAttr(el, 'value') || 'null';
7548
+ valueBinding = number ? "_n(" + valueBinding + ")" : valueBinding;
7549
+ addProp(el, 'checked', "_q(" + value + "," + valueBinding + ")");
7550
+ addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
7551
+ }
7552
+
7553
+ function genSelect(el, value, modifiers) {
7554
+ var number = modifiers && modifiers.number;
7555
+ var selectedVal = "Array.prototype.filter" + ".call($event.target.options,function(o){return o.selected})" + ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" + "return " + (number ? '_n(val)' : 'val') + "})";
7556
+ var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
7557
+ var code = "var $$selectedVal = " + selectedVal + ";";
7558
+ code = code + " " + genAssignmentCode(value, assignment);
7559
+ addHandler(el, 'change', code, null, true);
7560
+ }
7561
+
7562
+ function genDefaultModel(el, value, modifiers) {
7563
+ var type = el.attrsMap.type; // warn if v-bind:value conflicts with v-model
7564
+ // except for inputs with v-bind:type
7565
+
7566
+ if ("development" !== 'production') {
7567
+ var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
7568
+ var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
7569
+
7570
+ if (value$1 && !typeBinding) {
7571
+ var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
7572
+ warn$1(binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " + 'because the latter already expands to a value binding internally', el.rawAttrsMap[binding]);
7573
+ }
7574
+ }
7575
+
7576
+ var ref = modifiers || {};
7577
+ var lazy = ref.lazy;
7578
+ var number = ref.number;
7579
+ var trim = ref.trim;
7580
+ var needCompositionGuard = !lazy && type !== 'range';
7581
+ var event = lazy ? 'change' : type === 'range' ? RANGE_TOKEN : 'input';
7582
+ var valueExpression = '$event.target.value';
7583
+
7584
+ if (trim) {
7585
+ valueExpression = "$event.target.value.trim()";
7586
+ }
7587
+
7588
+ if (number) {
7589
+ valueExpression = "_n(" + valueExpression + ")";
7590
+ }
7591
+
7592
+ var code = genAssignmentCode(value, valueExpression);
7593
+
7594
+ if (needCompositionGuard) {
7595
+ code = "if($event.target.composing)return;" + code;
7596
+ }
7597
+
7598
+ addProp(el, 'value', "(" + value + ")");
7599
+ addHandler(el, event, code, null, true);
7600
+
7601
+ if (trim || number) {
7602
+ addHandler(el, 'blur', '$forceUpdate()');
7603
+ }
7604
+ }
7605
+ /* */
7606
+ // normalize v-model event tokens that can only be determined at runtime.
7607
+ // it's important to place the event as the first in the array because
7608
+ // the whole point is ensuring the v-model callback gets called before
7609
+ // user-attached handlers.
7610
+
7611
+
7612
+ function normalizeEvents(on) {
7613
+ /* istanbul ignore if */
7614
+ if (isDef(on[RANGE_TOKEN])) {
7615
+ // IE input[type=range] only supports `change` event
7616
+ var event = isIE ? 'change' : 'input';
7617
+ on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
7618
+ delete on[RANGE_TOKEN];
7619
+ } // This was originally intended to fix #4521 but no longer necessary
7620
+ // after 2.5. Keeping it for backwards compat with generated code from < 2.4
7621
+
7622
+ /* istanbul ignore if */
7623
+
7624
+
7625
+ if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
7626
+ on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
7627
+ delete on[CHECKBOX_RADIO_TOKEN];
7628
+ }
7629
+ }
7630
+
7631
+ var target$1;
7632
+
7633
+ function createOnceHandler$1(event, handler, capture) {
7634
+ var _target = target$1; // save current target element in closure
7635
+
7636
+ return function onceHandler() {
7637
+ var res = handler.apply(null, arguments);
7638
+
7639
+ if (res !== null) {
7640
+ remove$2(event, onceHandler, capture, _target);
7641
+ }
7642
+ };
7643
+ } // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
7644
+ // implementation and does not fire microtasks in between event propagation, so
7645
+ // safe to exclude.
7646
+
7647
+
7648
+ var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
7649
+
7650
+ function add$1(name, handler, capture, passive) {
7651
+ // async edge case #6566: inner click event triggers patch, event handler
7652
+ // attached to outer element during patch, and triggered again. This
7653
+ // happens because browsers fire microtask ticks between event propagation.
7654
+ // the solution is simple: we save the timestamp when a handler is attached,
7655
+ // and the handler would only fire if the event passed to it was fired
7656
+ // AFTER it was attached.
7657
+ if (useMicrotaskFix) {
7658
+ var attachedTimestamp = currentFlushTimestamp;
7659
+ var original = handler;
7660
+
7661
+ handler = original._wrapper = function (e) {
7662
+ if ( // no bubbling, should always fire.
7663
+ // this is just a safety net in case event.timeStamp is unreliable in
7664
+ // certain weird environments...
7665
+ e.target === e.currentTarget || // event is fired after handler attachment
7666
+ e.timeStamp >= attachedTimestamp || // bail for environments that have buggy event.timeStamp implementations
7667
+ // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
7668
+ // #9681 QtWebEngine event.timeStamp is negative value
7669
+ e.timeStamp <= 0 || // #9448 bail if event is fired in another document in a multi-page
7670
+ // electron/nw.js app, since event.timeStamp will be using a different
7671
+ // starting reference
7672
+ e.target.ownerDocument !== document) {
7673
+ return original.apply(this, arguments);
7674
+ }
7675
+ };
7676
+ }
7677
+
7678
+ target$1.addEventListener(name, handler, supportsPassive ? {
7679
+ capture: capture,
7680
+ passive: passive
7681
+ } : capture);
7682
+ }
7683
+
7684
+ function remove$2(name, handler, capture, _target) {
7685
+ (_target || target$1).removeEventListener(name, handler._wrapper || handler, capture);
7686
+ }
7687
+
7688
+ function updateDOMListeners(oldVnode, vnode) {
7689
+ if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
7690
+ return;
7691
+ }
7692
+
7693
+ var on = vnode.data.on || {};
7694
+ var oldOn = oldVnode.data.on || {};
7695
+ target$1 = vnode.elm;
7696
+ normalizeEvents(on);
7697
+ updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
7698
+ target$1 = undefined;
7699
+ }
7700
+
7701
+ var events = {
7702
+ create: updateDOMListeners,
7703
+ update: updateDOMListeners
7704
+ };
7705
+ /* */
7706
+
7707
+ var svgContainer;
7708
+
7709
+ function updateDOMProps(oldVnode, vnode) {
7710
+ if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
7711
+ return;
7712
+ }
7713
+
7714
+ var key, cur;
7715
+ var elm = vnode.elm;
7716
+ var oldProps = oldVnode.data.domProps || {};
7717
+ var props = vnode.data.domProps || {}; // clone observed objects, as the user probably wants to mutate it
7718
+
7719
+ if (isDef(props.__ob__)) {
7720
+ props = vnode.data.domProps = extend({}, props);
7721
+ }
7722
+
7723
+ for (key in oldProps) {
7724
+ if (!(key in props)) {
7725
+ elm[key] = '';
7726
+ }
7727
+ }
7728
+
7729
+ for (key in props) {
7730
+ cur = props[key]; // ignore children if the node has textContent or innerHTML,
7731
+ // as these will throw away existing DOM nodes and cause removal errors
7732
+ // on subsequent patches (#3360)
7733
+
7734
+ if (key === 'textContent' || key === 'innerHTML') {
7735
+ if (vnode.children) {
7736
+ vnode.children.length = 0;
7737
+ }
7738
+
7739
+ if (cur === oldProps[key]) {
7740
+ continue;
7741
+ } // #6601 work around Chrome version <= 55 bug where single textNode
7742
+ // replaced by innerHTML/textContent retains its parentNode property
7743
+
7744
+
7745
+ if (elm.childNodes.length === 1) {
7746
+ elm.removeChild(elm.childNodes[0]);
7747
+ }
7748
+ }
7749
+
7750
+ if (key === 'value' && elm.tagName !== 'PROGRESS') {
7751
+ // store value as _value as well since
7752
+ // non-string values will be stringified
7753
+ elm._value = cur; // avoid resetting cursor position when value is the same
7754
+
7755
+ var strCur = isUndef(cur) ? '' : String(cur);
7756
+
7757
+ if (shouldUpdateValue(elm, strCur)) {
7758
+ elm.value = strCur;
7759
+ }
7760
+ } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
7761
+ // IE doesn't support innerHTML for SVG elements
7762
+ svgContainer = svgContainer || document.createElement('div');
7763
+ svgContainer.innerHTML = "<svg>" + cur + "</svg>";
7764
+ var svg = svgContainer.firstChild;
7765
+
7766
+ while (elm.firstChild) {
7767
+ elm.removeChild(elm.firstChild);
7768
+ }
7769
+
7770
+ while (svg.firstChild) {
7771
+ elm.appendChild(svg.firstChild);
7772
+ }
7773
+ } else if ( // skip the update if old and new VDOM state is the same.
7774
+ // `value` is handled separately because the DOM value may be temporarily
7775
+ // out of sync with VDOM state due to focus, composition and modifiers.
7776
+ // This #4521 by skipping the unnecesarry `checked` update.
7777
+ cur !== oldProps[key]) {
7778
+ // some property updates can throw
7779
+ // e.g. `value` on <progress> w/ non-finite value
7780
+ try {
7781
+ elm[key] = cur;
7782
+ } catch (e) {}
7783
+ }
7784
+ }
7785
+ } // check platforms/web/util/attrs.js acceptValue
7786
+
7787
+
7788
+ function shouldUpdateValue(elm, checkVal) {
7789
+ return !elm.composing && (elm.tagName === 'OPTION' || isNotInFocusAndDirty(elm, checkVal) || isDirtyWithModifiers(elm, checkVal));
7790
+ }
7791
+
7792
+ function isNotInFocusAndDirty(elm, checkVal) {
7793
+ // return true when textbox (.number and .trim) loses focus and its value is
7794
+ // not equal to the updated value
7795
+ var notInFocus = true; // #6157
7796
+ // work around IE bug when accessing document.activeElement in an iframe
7797
+
7798
+ try {
7799
+ notInFocus = document.activeElement !== elm;
7800
+ } catch (e) {}
7801
+
7802
+ return notInFocus && elm.value !== checkVal;
7803
+ }
7804
+
7805
+ function isDirtyWithModifiers(elm, newVal) {
7806
+ var value = elm.value;
7807
+ var modifiers = elm._vModifiers; // injected by v-model runtime
7808
+
7809
+ if (isDef(modifiers)) {
7810
+ if (modifiers.number) {
7811
+ return toNumber(value) !== toNumber(newVal);
7812
+ }
7813
+
7814
+ if (modifiers.trim) {
7815
+ return value.trim() !== newVal.trim();
7816
+ }
7817
+ }
7818
+
7819
+ return value !== newVal;
7820
+ }
7821
+
7822
+ var domProps = {
7823
+ create: updateDOMProps,
7824
+ update: updateDOMProps
7825
+ };
7826
+ /* */
7827
+
7828
+ var parseStyleText = cached(function (cssText) {
7829
+ var res = {};
7830
+ var listDelimiter = /;(?![^(]*\))/g;
7831
+ var propertyDelimiter = /:(.+)/;
7832
+ cssText.split(listDelimiter).forEach(function (item) {
7833
+ if (item) {
7834
+ var tmp = item.split(propertyDelimiter);
7835
+ tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
7836
+ }
7837
+ });
7838
+ return res;
7839
+ }); // merge static and dynamic style data on the same vnode
7840
+
7841
+ function normalizeStyleData(data) {
7842
+ var style = normalizeStyleBinding(data.style); // static style is pre-processed into an object during compilation
7843
+ // and is always a fresh object, so it's safe to merge into it
7844
+
7845
+ return data.staticStyle ? extend(data.staticStyle, style) : style;
7846
+ } // normalize possible array / string values into Object
7847
+
7848
+
7849
+ function normalizeStyleBinding(bindingStyle) {
7850
+ if (Array.isArray(bindingStyle)) {
7851
+ return toObject(bindingStyle);
7852
+ }
7853
+
7854
+ if (typeof bindingStyle === 'string') {
7855
+ return parseStyleText(bindingStyle);
7856
+ }
7857
+
7858
+ return bindingStyle;
7859
+ }
7860
+ /**
7861
+ * parent component style should be after child's
7862
+ * so that parent component's style could override it
7863
+ */
7864
+
7865
+
7866
+ function getStyle(vnode, checkChild) {
7867
+ var res = {};
7868
+ var styleData;
7869
+
7870
+ if (checkChild) {
7871
+ var childNode = vnode;
7872
+
7873
+ while (childNode.componentInstance) {
7874
+ childNode = childNode.componentInstance._vnode;
7875
+
7876
+ if (childNode && childNode.data && (styleData = normalizeStyleData(childNode.data))) {
7877
+ extend(res, styleData);
7878
+ }
7879
+ }
7880
+ }
7881
+
7882
+ if (styleData = normalizeStyleData(vnode.data)) {
7883
+ extend(res, styleData);
7884
+ }
7885
+
7886
+ var parentNode = vnode;
7887
+
7888
+ while (parentNode = parentNode.parent) {
7889
+ if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
7890
+ extend(res, styleData);
7891
+ }
7892
+ }
7893
+
7894
+ return res;
7895
+ }
7896
+ /* */
7897
+
7898
+
7899
+ var cssVarRE = /^--/;
7900
+ var importantRE = /\s*!important$/;
7901
+
7902
+ var setProp = function (el, name, val) {
7903
+ /* istanbul ignore if */
7904
+ if (cssVarRE.test(name)) {
7905
+ el.style.setProperty(name, val);
7906
+ } else if (importantRE.test(val)) {
7907
+ el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
7908
+ } else {
7909
+ var normalizedName = normalize(name);
7910
+
7911
+ if (Array.isArray(val)) {
7912
+ // Support values array created by autoprefixer, e.g.
7913
+ // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
7914
+ // Set them one by one, and the browser will only set those it can recognize
7915
+ for (var i = 0, len = val.length; i < len; i++) {
7916
+ el.style[normalizedName] = val[i];
7917
+ }
7918
+ } else {
7919
+ el.style[normalizedName] = val;
7920
+ }
7921
+ }
7922
+ };
7923
+
7924
+ var vendorNames = ['Webkit', 'Moz', 'ms'];
7925
+ var emptyStyle;
7926
+ var normalize = cached(function (prop) {
7927
+ emptyStyle = emptyStyle || document.createElement('div').style;
7928
+ prop = camelize(prop);
7929
+
7930
+ if (prop !== 'filter' && prop in emptyStyle) {
7931
+ return prop;
7932
+ }
7933
+
7934
+ var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
7935
+
7936
+ for (var i = 0; i < vendorNames.length; i++) {
7937
+ var name = vendorNames[i] + capName;
7938
+
7939
+ if (name in emptyStyle) {
7940
+ return name;
7941
+ }
7942
+ }
7943
+ });
7944
+
7945
+ function updateStyle(oldVnode, vnode) {
7946
+ var data = vnode.data;
7947
+ var oldData = oldVnode.data;
7948
+
7949
+ if (isUndef(data.staticStyle) && isUndef(data.style) && isUndef(oldData.staticStyle) && isUndef(oldData.style)) {
7950
+ return;
7951
+ }
7952
+
7953
+ var cur, name;
7954
+ var el = vnode.elm;
7955
+ var oldStaticStyle = oldData.staticStyle;
7956
+ var oldStyleBinding = oldData.normalizedStyle || oldData.style || {}; // if static style exists, stylebinding already merged into it when doing normalizeStyleData
7957
+
7958
+ var oldStyle = oldStaticStyle || oldStyleBinding;
7959
+ var style = normalizeStyleBinding(vnode.data.style) || {}; // store normalized style under a different key for next diff
7960
+ // make sure to clone it if it's reactive, since the user likely wants
7961
+ // to mutate it.
7962
+
7963
+ vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style;
7964
+ var newStyle = getStyle(vnode, true);
7965
+
7966
+ for (name in oldStyle) {
7967
+ if (isUndef(newStyle[name])) {
7968
+ setProp(el, name, '');
7969
+ }
7970
+ }
7971
+
7972
+ for (name in newStyle) {
7973
+ cur = newStyle[name];
7974
+
7975
+ if (cur !== oldStyle[name]) {
7976
+ // ie9 setting to null has no effect, must use empty string
7977
+ setProp(el, name, cur == null ? '' : cur);
7978
+ }
7979
+ }
7980
+ }
7981
+
7982
+ var style = {
7983
+ create: updateStyle,
7984
+ update: updateStyle
7985
+ };
7986
+ /* */
7987
+
7988
+ var whitespaceRE = /\s+/;
7989
+ /**
7990
+ * Add class with compatibility for SVG since classList is not supported on
7991
+ * SVG elements in IE
7992
+ */
7993
+
7994
+ function addClass(el, cls) {
7995
+ /* istanbul ignore if */
7996
+ if (!cls || !(cls = cls.trim())) {
7997
+ return;
7998
+ }
7999
+ /* istanbul ignore else */
8000
+
8001
+
8002
+ if (el.classList) {
8003
+ if (cls.indexOf(' ') > -1) {
8004
+ cls.split(whitespaceRE).forEach(function (c) {
8005
+ return el.classList.add(c);
8006
+ });
8007
+ } else {
8008
+ el.classList.add(cls);
8009
+ }
8010
+ } else {
8011
+ var cur = " " + (el.getAttribute('class') || '') + " ";
8012
+
8013
+ if (cur.indexOf(' ' + cls + ' ') < 0) {
8014
+ el.setAttribute('class', (cur + cls).trim());
8015
+ }
8016
+ }
8017
+ }
8018
+ /**
8019
+ * Remove class with compatibility for SVG since classList is not supported on
8020
+ * SVG elements in IE
8021
+ */
8022
+
8023
+
8024
+ function removeClass(el, cls) {
8025
+ /* istanbul ignore if */
8026
+ if (!cls || !(cls = cls.trim())) {
8027
+ return;
8028
+ }
8029
+ /* istanbul ignore else */
8030
+
8031
+
8032
+ if (el.classList) {
8033
+ if (cls.indexOf(' ') > -1) {
8034
+ cls.split(whitespaceRE).forEach(function (c) {
8035
+ return el.classList.remove(c);
8036
+ });
8037
+ } else {
8038
+ el.classList.remove(cls);
8039
+ }
8040
+
8041
+ if (!el.classList.length) {
8042
+ el.removeAttribute('class');
8043
+ }
8044
+ } else {
8045
+ var cur = " " + (el.getAttribute('class') || '') + " ";
8046
+ var tar = ' ' + cls + ' ';
8047
+
8048
+ while (cur.indexOf(tar) >= 0) {
8049
+ cur = cur.replace(tar, ' ');
8050
+ }
8051
+
8052
+ cur = cur.trim();
8053
+
8054
+ if (cur) {
8055
+ el.setAttribute('class', cur);
8056
+ } else {
8057
+ el.removeAttribute('class');
8058
+ }
8059
+ }
8060
+ }
8061
+ /* */
8062
+
8063
+
8064
+ function resolveTransition(def$$1) {
8065
+ if (!def$$1) {
8066
+ return;
8067
+ }
8068
+ /* istanbul ignore else */
8069
+
8070
+
8071
+ if (typeof def$$1 === 'object') {
8072
+ var res = {};
8073
+
8074
+ if (def$$1.css !== false) {
8075
+ extend(res, autoCssTransition(def$$1.name || 'v'));
8076
+ }
8077
+
8078
+ extend(res, def$$1);
8079
+ return res;
8080
+ } else if (typeof def$$1 === 'string') {
8081
+ return autoCssTransition(def$$1);
8082
+ }
8083
+ }
8084
+
8085
+ var autoCssTransition = cached(function (name) {
8086
+ return {
8087
+ enterClass: name + "-enter",
8088
+ enterToClass: name + "-enter-to",
8089
+ enterActiveClass: name + "-enter-active",
8090
+ leaveClass: name + "-leave",
8091
+ leaveToClass: name + "-leave-to",
8092
+ leaveActiveClass: name + "-leave-active"
8093
+ };
8094
+ });
8095
+ var hasTransition = inBrowser && !isIE9;
8096
+ var TRANSITION = 'transition';
8097
+ var ANIMATION = 'animation'; // Transition property/event sniffing
8098
+
8099
+ var transitionProp = 'transition';
8100
+ var transitionEndEvent = 'transitionend';
8101
+ var animationProp = 'animation';
8102
+ var animationEndEvent = 'animationend';
8103
+
8104
+ if (hasTransition) {
8105
+ /* istanbul ignore if */
8106
+ if (window.ontransitionend === undefined && window.onwebkittransitionend !== undefined) {
8107
+ transitionProp = 'WebkitTransition';
8108
+ transitionEndEvent = 'webkitTransitionEnd';
8109
+ }
8110
+
8111
+ if (window.onanimationend === undefined && window.onwebkitanimationend !== undefined) {
8112
+ animationProp = 'WebkitAnimation';
8113
+ animationEndEvent = 'webkitAnimationEnd';
8114
+ }
8115
+ } // binding to window is necessary to make hot reload work in IE in strict mode
8116
+
8117
+
8118
+ var raf = inBrowser ? window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : setTimeout :
8119
+ /* istanbul ignore next */
8120
+ function (fn) {
8121
+ return fn();
8122
+ };
8123
+
8124
+ function nextFrame(fn) {
8125
+ raf(function () {
8126
+ raf(fn);
8127
+ });
8128
+ }
8129
+
8130
+ function addTransitionClass(el, cls) {
8131
+ var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
8132
+
8133
+ if (transitionClasses.indexOf(cls) < 0) {
8134
+ transitionClasses.push(cls);
8135
+ addClass(el, cls);
8136
+ }
8137
+ }
8138
+
8139
+ function removeTransitionClass(el, cls) {
8140
+ if (el._transitionClasses) {
8141
+ remove(el._transitionClasses, cls);
8142
+ }
8143
+
8144
+ removeClass(el, cls);
8145
+ }
8146
+
8147
+ function whenTransitionEnds(el, expectedType, cb) {
8148
+ var ref = getTransitionInfo(el, expectedType);
8149
+ var type = ref.type;
8150
+ var timeout = ref.timeout;
8151
+ var propCount = ref.propCount;
8152
+
8153
+ if (!type) {
8154
+ return cb();
8155
+ }
8156
+
8157
+ var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
8158
+ var ended = 0;
8159
+
8160
+ var end = function () {
8161
+ el.removeEventListener(event, onEnd);
8162
+ cb();
8163
+ };
8164
+
8165
+ var onEnd = function (e) {
8166
+ if (e.target === el) {
8167
+ if (++ended >= propCount) {
8168
+ end();
8169
+ }
8170
+ }
8171
+ };
8172
+
8173
+ setTimeout(function () {
8174
+ if (ended < propCount) {
8175
+ end();
8176
+ }
8177
+ }, timeout + 1);
8178
+ el.addEventListener(event, onEnd);
8179
+ }
8180
+
8181
+ var transformRE = /\b(transform|all)(,|$)/;
8182
+
8183
+ function getTransitionInfo(el, expectedType) {
8184
+ var styles = window.getComputedStyle(el); // JSDOM may return undefined for transition properties
8185
+
8186
+ var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
8187
+ var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
8188
+ var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
8189
+ var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
8190
+ var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
8191
+ var animationTimeout = getTimeout(animationDelays, animationDurations);
8192
+ var type;
8193
+ var timeout = 0;
8194
+ var propCount = 0;
8195
+ /* istanbul ignore if */
8196
+
8197
+ if (expectedType === TRANSITION) {
8198
+ if (transitionTimeout > 0) {
8199
+ type = TRANSITION;
8200
+ timeout = transitionTimeout;
8201
+ propCount = transitionDurations.length;
8202
+ }
8203
+ } else if (expectedType === ANIMATION) {
8204
+ if (animationTimeout > 0) {
8205
+ type = ANIMATION;
8206
+ timeout = animationTimeout;
8207
+ propCount = animationDurations.length;
8208
+ }
8209
+ } else {
8210
+ timeout = Math.max(transitionTimeout, animationTimeout);
8211
+ type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
8212
+ propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
8213
+ }
8214
+
8215
+ var hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
8216
+ return {
8217
+ type: type,
8218
+ timeout: timeout,
8219
+ propCount: propCount,
8220
+ hasTransform: hasTransform
8221
+ };
8222
+ }
8223
+
8224
+ function getTimeout(delays, durations) {
8225
+ /* istanbul ignore next */
8226
+ while (delays.length < durations.length) {
8227
+ delays = delays.concat(delays);
8228
+ }
8229
+
8230
+ return Math.max.apply(null, durations.map(function (d, i) {
8231
+ return toMs(d) + toMs(delays[i]);
8232
+ }));
8233
+ } // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
8234
+ // in a locale-dependent way, using a comma instead of a dot.
8235
+ // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
8236
+ // as a floor function) causing unexpected behaviors
8237
+
8238
+
8239
+ function toMs(s) {
8240
+ return Number(s.slice(0, -1).replace(',', '.')) * 1000;
8241
+ }
8242
+ /* */
8243
+
8244
+
8245
+ function enter(vnode, toggleDisplay) {
8246
+ var el = vnode.elm; // call leave callback now
8247
+
8248
+ if (isDef(el._leaveCb)) {
8249
+ el._leaveCb.cancelled = true;
8250
+
8251
+ el._leaveCb();
8252
+ }
8253
+
8254
+ var data = resolveTransition(vnode.data.transition);
8255
+
8256
+ if (isUndef(data)) {
8257
+ return;
8258
+ }
8259
+ /* istanbul ignore if */
8260
+
8261
+
8262
+ if (isDef(el._enterCb) || el.nodeType !== 1) {
8263
+ return;
8264
+ }
8265
+
8266
+ var css = data.css;
8267
+ var type = data.type;
8268
+ var enterClass = data.enterClass;
8269
+ var enterToClass = data.enterToClass;
8270
+ var enterActiveClass = data.enterActiveClass;
8271
+ var appearClass = data.appearClass;
8272
+ var appearToClass = data.appearToClass;
8273
+ var appearActiveClass = data.appearActiveClass;
8274
+ var beforeEnter = data.beforeEnter;
8275
+ var enter = data.enter;
8276
+ var afterEnter = data.afterEnter;
8277
+ var enterCancelled = data.enterCancelled;
8278
+ var beforeAppear = data.beforeAppear;
8279
+ var appear = data.appear;
8280
+ var afterAppear = data.afterAppear;
8281
+ var appearCancelled = data.appearCancelled;
8282
+ var duration = data.duration; // activeInstance will always be the <transition> component managing this
8283
+ // transition. One edge case to check is when the <transition> is placed
8284
+ // as the root node of a child component. In that case we need to check
8285
+ // <transition>'s parent for appear check.
8286
+
8287
+ var context = activeInstance;
8288
+ var transitionNode = activeInstance.$vnode;
8289
+
8290
+ while (transitionNode && transitionNode.parent) {
8291
+ context = transitionNode.context;
8292
+ transitionNode = transitionNode.parent;
8293
+ }
8294
+
8295
+ var isAppear = !context._isMounted || !vnode.isRootInsert;
8296
+
8297
+ if (isAppear && !appear && appear !== '') {
8298
+ return;
8299
+ }
8300
+
8301
+ var startClass = isAppear && appearClass ? appearClass : enterClass;
8302
+ var activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass;
8303
+ var toClass = isAppear && appearToClass ? appearToClass : enterToClass;
8304
+ var beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter;
8305
+ var enterHook = isAppear ? typeof appear === 'function' ? appear : enter : enter;
8306
+ var afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter;
8307
+ var enterCancelledHook = isAppear ? appearCancelled || enterCancelled : enterCancelled;
8308
+ var explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration);
8309
+
8310
+ if ("development" !== 'production' && explicitEnterDuration != null) {
8311
+ checkDuration(explicitEnterDuration, 'enter', vnode);
8312
+ }
8313
+
8314
+ var expectsCSS = css !== false && !isIE9;
8315
+ var userWantsControl = getHookArgumentsLength(enterHook);
8316
+ var cb = el._enterCb = once(function () {
8317
+ if (expectsCSS) {
8318
+ removeTransitionClass(el, toClass);
8319
+ removeTransitionClass(el, activeClass);
8320
+ }
8321
+
8322
+ if (cb.cancelled) {
8323
+ if (expectsCSS) {
8324
+ removeTransitionClass(el, startClass);
8325
+ }
8326
+
8327
+ enterCancelledHook && enterCancelledHook(el);
8328
+ } else {
8329
+ afterEnterHook && afterEnterHook(el);
8330
+ }
8331
+
8332
+ el._enterCb = null;
8333
+ });
8334
+
8335
+ if (!vnode.data.show) {
8336
+ // remove pending leave element on enter by injecting an insert hook
8337
+ mergeVNodeHook(vnode, 'insert', function () {
8338
+ var parent = el.parentNode;
8339
+ var pendingNode = parent && parent._pending && parent._pending[vnode.key];
8340
+
8341
+ if (pendingNode && pendingNode.tag === vnode.tag && pendingNode.elm._leaveCb) {
8342
+ pendingNode.elm._leaveCb();
8343
+ }
8344
+
8345
+ enterHook && enterHook(el, cb);
8346
+ });
8347
+ } // start enter transition
8348
+
8349
+
8350
+ beforeEnterHook && beforeEnterHook(el);
8351
+
8352
+ if (expectsCSS) {
8353
+ addTransitionClass(el, startClass);
8354
+ addTransitionClass(el, activeClass);
8355
+ nextFrame(function () {
8356
+ removeTransitionClass(el, startClass);
8357
+
8358
+ if (!cb.cancelled) {
8359
+ addTransitionClass(el, toClass);
8360
+
8361
+ if (!userWantsControl) {
8362
+ if (isValidDuration(explicitEnterDuration)) {
8363
+ setTimeout(cb, explicitEnterDuration);
8364
+ } else {
8365
+ whenTransitionEnds(el, type, cb);
8366
+ }
8367
+ }
8368
+ }
8369
+ });
8370
+ }
8371
+
8372
+ if (vnode.data.show) {
8373
+ toggleDisplay && toggleDisplay();
8374
+ enterHook && enterHook(el, cb);
8375
+ }
8376
+
8377
+ if (!expectsCSS && !userWantsControl) {
8378
+ cb();
8379
+ }
8380
+ }
8381
+
8382
+ function leave(vnode, rm) {
8383
+ var el = vnode.elm; // call enter callback now
8384
+
8385
+ if (isDef(el._enterCb)) {
8386
+ el._enterCb.cancelled = true;
8387
+
8388
+ el._enterCb();
8389
+ }
8390
+
8391
+ var data = resolveTransition(vnode.data.transition);
8392
+
8393
+ if (isUndef(data) || el.nodeType !== 1) {
8394
+ return rm();
8395
+ }
8396
+ /* istanbul ignore if */
8397
+
8398
+
8399
+ if (isDef(el._leaveCb)) {
8400
+ return;
8401
+ }
8402
+
8403
+ var css = data.css;
8404
+ var type = data.type;
8405
+ var leaveClass = data.leaveClass;
8406
+ var leaveToClass = data.leaveToClass;
8407
+ var leaveActiveClass = data.leaveActiveClass;
8408
+ var beforeLeave = data.beforeLeave;
8409
+ var leave = data.leave;
8410
+ var afterLeave = data.afterLeave;
8411
+ var leaveCancelled = data.leaveCancelled;
8412
+ var delayLeave = data.delayLeave;
8413
+ var duration = data.duration;
8414
+ var expectsCSS = css !== false && !isIE9;
8415
+ var userWantsControl = getHookArgumentsLength(leave);
8416
+ var explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration);
8417
+
8418
+ if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
8419
+ checkDuration(explicitLeaveDuration, 'leave', vnode);
8420
+ }
8421
+
8422
+ var cb = el._leaveCb = once(function () {
8423
+ if (el.parentNode && el.parentNode._pending) {
8424
+ el.parentNode._pending[vnode.key] = null;
8425
+ }
8426
+
8427
+ if (expectsCSS) {
8428
+ removeTransitionClass(el, leaveToClass);
8429
+ removeTransitionClass(el, leaveActiveClass);
8430
+ }
8431
+
8432
+ if (cb.cancelled) {
8433
+ if (expectsCSS) {
8434
+ removeTransitionClass(el, leaveClass);
8435
+ }
8436
+
8437
+ leaveCancelled && leaveCancelled(el);
8438
+ } else {
8439
+ rm();
8440
+ afterLeave && afterLeave(el);
8441
+ }
8442
+
8443
+ el._leaveCb = null;
8444
+ });
8445
+
8446
+ if (delayLeave) {
8447
+ delayLeave(performLeave);
8448
+ } else {
8449
+ performLeave();
8450
+ }
8451
+
8452
+ function performLeave() {
8453
+ // the delayed leave may have already been cancelled
8454
+ if (cb.cancelled) {
8455
+ return;
8456
+ } // record leaving element
8457
+
8458
+
8459
+ if (!vnode.data.show && el.parentNode) {
8460
+ (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
8461
+ }
8462
+
8463
+ beforeLeave && beforeLeave(el);
8464
+
8465
+ if (expectsCSS) {
8466
+ addTransitionClass(el, leaveClass);
8467
+ addTransitionClass(el, leaveActiveClass);
8468
+ nextFrame(function () {
8469
+ removeTransitionClass(el, leaveClass);
8470
+
8471
+ if (!cb.cancelled) {
8472
+ addTransitionClass(el, leaveToClass);
8473
+
8474
+ if (!userWantsControl) {
8475
+ if (isValidDuration(explicitLeaveDuration)) {
8476
+ setTimeout(cb, explicitLeaveDuration);
8477
+ } else {
8478
+ whenTransitionEnds(el, type, cb);
8479
+ }
8480
+ }
8481
+ }
8482
+ });
8483
+ }
8484
+
8485
+ leave && leave(el, cb);
8486
+
8487
+ if (!expectsCSS && !userWantsControl) {
8488
+ cb();
8489
+ }
8490
+ }
8491
+ } // only used in dev mode
8492
+
8493
+
8494
+ function checkDuration(val, name, vnode) {
8495
+ if (typeof val !== 'number') {
8496
+ warn("<transition> explicit " + name + " duration is not a valid number - " + "got " + JSON.stringify(val) + ".", vnode.context);
8497
+ } else if (isNaN(val)) {
8498
+ warn("<transition> explicit " + name + " duration is NaN - " + 'the duration expression might be incorrect.', vnode.context);
8499
+ }
8500
+ }
8501
+
8502
+ function isValidDuration(val) {
8503
+ return typeof val === 'number' && !isNaN(val);
8504
+ }
8505
+ /**
8506
+ * Normalize a transition hook's argument length. The hook may be:
8507
+ * - a merged hook (invoker) with the original in .fns
8508
+ * - a wrapped component method (check ._length)
8509
+ * - a plain function (.length)
8510
+ */
8511
+
8512
+
8513
+ function getHookArgumentsLength(fn) {
8514
+ if (isUndef(fn)) {
8515
+ return false;
8516
+ }
8517
+
8518
+ var invokerFns = fn.fns;
8519
+
8520
+ if (isDef(invokerFns)) {
8521
+ // invoker
8522
+ return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns);
8523
+ } else {
8524
+ return (fn._length || fn.length) > 1;
8525
+ }
8526
+ }
8527
+
8528
+ function _enter(_, vnode) {
8529
+ if (vnode.data.show !== true) {
8530
+ enter(vnode);
8531
+ }
8532
+ }
8533
+
8534
+ var transition = inBrowser ? {
8535
+ create: _enter,
8536
+ activate: _enter,
8537
+ remove: function remove$$1(vnode, rm) {
8538
+ /* istanbul ignore else */
8539
+ if (vnode.data.show !== true) {
8540
+ leave(vnode, rm);
8541
+ } else {
8542
+ rm();
8543
+ }
8544
+ }
8545
+ } : {};
8546
+ var platformModules = [attrs, klass, events, domProps, style, transition];
8547
+ /* */
8548
+ // the directive module should be applied last, after all
8549
+ // built-in modules have been applied.
8550
+
8551
+ var modules = platformModules.concat(baseModules);
8552
+ var patch = createPatchFunction({
8553
+ nodeOps: nodeOps,
8554
+ modules: modules
8555
+ });
8556
+ /**
8557
+ * Not type checking this file because flow doesn't like attaching
8558
+ * properties to Elements.
8559
+ */
8560
+
8561
+ /* istanbul ignore if */
8562
+
8563
+ if (isIE9) {
8564
+ // http://www.matts411.com/post/internet-explorer-9-oninput/
8565
+ document.addEventListener('selectionchange', function () {
8566
+ var el = document.activeElement;
8567
+
8568
+ if (el && el.vmodel) {
8569
+ trigger(el, 'input');
8570
+ }
8571
+ });
8572
+ }
8573
+
8574
+ var directive = {
8575
+ inserted: function inserted(el, binding, vnode, oldVnode) {
8576
+ if (vnode.tag === 'select') {
8577
+ // #6903
8578
+ if (oldVnode.elm && !oldVnode.elm._vOptions) {
8579
+ mergeVNodeHook(vnode, 'postpatch', function () {
8580
+ directive.componentUpdated(el, binding, vnode);
8581
+ });
8582
+ } else {
8583
+ setSelected(el, binding, vnode.context);
8584
+ }
8585
+
8586
+ el._vOptions = [].map.call(el.options, getValue);
8587
+ } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
8588
+ el._vModifiers = binding.modifiers;
8589
+
8590
+ if (!binding.modifiers.lazy) {
8591
+ el.addEventListener('compositionstart', onCompositionStart);
8592
+ el.addEventListener('compositionend', onCompositionEnd); // Safari < 10.2 & UIWebView doesn't fire compositionend when
8593
+ // switching focus before confirming composition choice
8594
+ // this also fixes the issue where some browsers e.g. iOS Chrome
8595
+ // fires "change" instead of "input" on autocomplete.
8596
+
8597
+ el.addEventListener('change', onCompositionEnd);
8598
+ /* istanbul ignore if */
8599
+
8600
+ if (isIE9) {
8601
+ el.vmodel = true;
8602
+ }
8603
+ }
8604
+ }
8605
+ },
8606
+ componentUpdated: function componentUpdated(el, binding, vnode) {
8607
+ if (vnode.tag === 'select') {
8608
+ setSelected(el, binding, vnode.context); // in case the options rendered by v-for have changed,
8609
+ // it's possible that the value is out-of-sync with the rendered options.
8610
+ // detect such cases and filter out values that no longer has a matching
8611
+ // option in the DOM.
8612
+
8613
+ var prevOptions = el._vOptions;
8614
+ var curOptions = el._vOptions = [].map.call(el.options, getValue);
8615
+
8616
+ if (curOptions.some(function (o, i) {
8617
+ return !looseEqual(o, prevOptions[i]);
8618
+ })) {
8619
+ // trigger change event if
8620
+ // no matching option found for at least one value
8621
+ var needReset = el.multiple ? binding.value.some(function (v) {
8622
+ return hasNoMatchingOption(v, curOptions);
8623
+ }) : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
8624
+
8625
+ if (needReset) {
8626
+ trigger(el, 'change');
8627
+ }
8628
+ }
8629
+ }
8630
+ }
8631
+ };
8632
+
8633
+ function setSelected(el, binding, vm) {
8634
+ actuallySetSelected(el, binding, vm);
8635
+ /* istanbul ignore if */
8636
+
8637
+ if (isIE || isEdge) {
8638
+ setTimeout(function () {
8639
+ actuallySetSelected(el, binding, vm);
8640
+ }, 0);
8641
+ }
8642
+ }
8643
+
8644
+ function actuallySetSelected(el, binding, vm) {
8645
+ var value = binding.value;
8646
+ var isMultiple = el.multiple;
8647
+
8648
+ if (isMultiple && !Array.isArray(value)) {
8649
+ "development" !== 'production' && warn("<select multiple v-model=\"" + binding.expression + "\"> " + "expects an Array value for its binding, but got " + Object.prototype.toString.call(value).slice(8, -1), vm);
8650
+ return;
8651
+ }
8652
+
8653
+ var selected, option;
8654
+
8655
+ for (var i = 0, l = el.options.length; i < l; i++) {
8656
+ option = el.options[i];
8657
+
8658
+ if (isMultiple) {
8659
+ selected = looseIndexOf(value, getValue(option)) > -1;
8660
+
8661
+ if (option.selected !== selected) {
8662
+ option.selected = selected;
8663
+ }
8664
+ } else {
8665
+ if (looseEqual(getValue(option), value)) {
8666
+ if (el.selectedIndex !== i) {
8667
+ el.selectedIndex = i;
8668
+ }
8669
+
8670
+ return;
8671
+ }
8672
+ }
8673
+ }
8674
+
8675
+ if (!isMultiple) {
8676
+ el.selectedIndex = -1;
8677
+ }
8678
+ }
8679
+
8680
+ function hasNoMatchingOption(value, options) {
8681
+ return options.every(function (o) {
8682
+ return !looseEqual(o, value);
8683
+ });
8684
+ }
8685
+
8686
+ function getValue(option) {
8687
+ return '_value' in option ? option._value : option.value;
8688
+ }
8689
+
8690
+ function onCompositionStart(e) {
8691
+ e.target.composing = true;
8692
+ }
8693
+
8694
+ function onCompositionEnd(e) {
8695
+ // prevent triggering an input event for no reason
8696
+ if (!e.target.composing) {
8697
+ return;
8698
+ }
8699
+
8700
+ e.target.composing = false;
8701
+ trigger(e.target, 'input');
8702
+ }
8703
+
8704
+ function trigger(el, type) {
8705
+ var e = document.createEvent('HTMLEvents');
8706
+ e.initEvent(type, true, true);
8707
+ el.dispatchEvent(e);
8708
+ }
8709
+ /* */
8710
+ // recursively search for possible transition defined inside the component root
8711
+
8712
+
8713
+ function locateNode(vnode) {
8714
+ return vnode.componentInstance && (!vnode.data || !vnode.data.transition) ? locateNode(vnode.componentInstance._vnode) : vnode;
8715
+ }
8716
+
8717
+ var show = {
8718
+ bind: function bind(el, ref, vnode) {
8719
+ var value = ref.value;
8720
+ vnode = locateNode(vnode);
8721
+ var transition$$1 = vnode.data && vnode.data.transition;
8722
+ var originalDisplay = el.__vOriginalDisplay = el.style.display === 'none' ? '' : el.style.display;
8723
+
8724
+ if (value && transition$$1) {
8725
+ vnode.data.show = true;
8726
+ enter(vnode, function () {
8727
+ el.style.display = originalDisplay;
8728
+ });
8729
+ } else {
8730
+ el.style.display = value ? originalDisplay : 'none';
8731
+ }
8732
+ },
8733
+ update: function update(el, ref, vnode) {
8734
+ var value = ref.value;
8735
+ var oldValue = ref.oldValue;
8736
+ /* istanbul ignore if */
8737
+
8738
+ if (!value === !oldValue) {
8739
+ return;
8740
+ }
8741
+
8742
+ vnode = locateNode(vnode);
8743
+ var transition$$1 = vnode.data && vnode.data.transition;
8744
+
8745
+ if (transition$$1) {
8746
+ vnode.data.show = true;
8747
+
8748
+ if (value) {
8749
+ enter(vnode, function () {
8750
+ el.style.display = el.__vOriginalDisplay;
8751
+ });
8752
+ } else {
8753
+ leave(vnode, function () {
8754
+ el.style.display = 'none';
8755
+ });
8756
+ }
8757
+ } else {
8758
+ el.style.display = value ? el.__vOriginalDisplay : 'none';
8759
+ }
8760
+ },
8761
+ unbind: function unbind(el, binding, vnode, oldVnode, isDestroy) {
8762
+ if (!isDestroy) {
8763
+ el.style.display = el.__vOriginalDisplay;
8764
+ }
8765
+ }
8766
+ };
8767
+ var platformDirectives = {
8768
+ model: directive,
8769
+ show: show
8770
+ };
8771
+ /* */
8772
+
8773
+ var transitionProps = {
8774
+ name: String,
8775
+ appear: Boolean,
8776
+ css: Boolean,
8777
+ mode: String,
8778
+ type: String,
8779
+ enterClass: String,
8780
+ leaveClass: String,
8781
+ enterToClass: String,
8782
+ leaveToClass: String,
8783
+ enterActiveClass: String,
8784
+ leaveActiveClass: String,
8785
+ appearClass: String,
8786
+ appearActiveClass: String,
8787
+ appearToClass: String,
8788
+ duration: [Number, String, Object]
8789
+ }; // in case the child is also an abstract component, e.g. <keep-alive>
8790
+ // we want to recursively retrieve the real component to be rendered
8791
+
8792
+ function getRealChild(vnode) {
8793
+ var compOptions = vnode && vnode.componentOptions;
8794
+
8795
+ if (compOptions && compOptions.Ctor.options.abstract) {
8796
+ return getRealChild(getFirstComponentChild(compOptions.children));
8797
+ } else {
8798
+ return vnode;
8799
+ }
8800
+ }
8801
+
8802
+ function extractTransitionData(comp) {
8803
+ var data = {};
8804
+ var options = comp.$options; // props
8805
+
8806
+ for (var key in options.propsData) {
8807
+ data[key] = comp[key];
8808
+ } // events.
8809
+ // extract listeners and pass them directly to the transition methods
8810
+
8811
+
8812
+ var listeners = options._parentListeners;
8813
+
8814
+ for (var key$1 in listeners) {
8815
+ data[camelize(key$1)] = listeners[key$1];
8816
+ }
8817
+
8818
+ return data;
8819
+ }
8820
+
8821
+ function placeholder(h, rawChild) {
8822
+ if (/\d-keep-alive$/.test(rawChild.tag)) {
8823
+ return h('keep-alive', {
8824
+ props: rawChild.componentOptions.propsData
8825
+ });
8826
+ }
8827
+ }
8828
+
8829
+ function hasParentTransition(vnode) {
8830
+ while (vnode = vnode.parent) {
8831
+ if (vnode.data.transition) {
8832
+ return true;
8833
+ }
8834
+ }
8835
+ }
8836
+
8837
+ function isSameChild(child, oldChild) {
8838
+ return oldChild.key === child.key && oldChild.tag === child.tag;
8839
+ }
8840
+
8841
+ var isNotTextNode = function (c) {
8842
+ return c.tag || isAsyncPlaceholder(c);
8843
+ };
8844
+
8845
+ var isVShowDirective = function (d) {
8846
+ return d.name === 'show';
8847
+ };
8848
+
8849
+ var Transition = {
8850
+ name: 'transition',
8851
+ props: transitionProps,
8852
+ abstract: true,
8853
+ render: function render(h) {
8854
+ var this$1 = this;
8855
+ var children = this.$slots.default;
8856
+
8857
+ if (!children) {
8858
+ return;
8859
+ } // filter out text nodes (possible whitespaces)
8860
+
8861
+
8862
+ children = children.filter(isNotTextNode);
8863
+ /* istanbul ignore if */
8864
+
8865
+ if (!children.length) {
8866
+ return;
8867
+ } // warn multiple elements
8868
+
8869
+
8870
+ if ("development" !== 'production' && children.length > 1) {
8871
+ warn('<transition> can only be used on a single element. Use ' + '<transition-group> for lists.', this.$parent);
8872
+ }
8873
+
8874
+ var mode = this.mode; // warn invalid mode
8875
+
8876
+ if ("development" !== 'production' && mode && mode !== 'in-out' && mode !== 'out-in') {
8877
+ warn('invalid <transition> mode: ' + mode, this.$parent);
8878
+ }
8879
+
8880
+ var rawChild = children[0]; // if this is a component root node and the component's
8881
+ // parent container node also has transition, skip.
8882
+
8883
+ if (hasParentTransition(this.$vnode)) {
8884
+ return rawChild;
8885
+ } // apply transition data to child
8886
+ // use getRealChild() to ignore abstract components e.g. keep-alive
8887
+
8888
+
8889
+ var child = getRealChild(rawChild);
8890
+ /* istanbul ignore if */
8891
+
8892
+ if (!child) {
8893
+ return rawChild;
8894
+ }
8895
+
8896
+ if (this._leaving) {
8897
+ return placeholder(h, rawChild);
8898
+ } // ensure a key that is unique to the vnode type and to this transition
8899
+ // component instance. This key will be used to remove pending leaving nodes
8900
+ // during entering.
8901
+
8902
+
8903
+ var id = "__transition-" + this._uid + "-";
8904
+ child.key = child.key == null ? child.isComment ? id + 'comment' : id + child.tag : isPrimitive(child.key) ? String(child.key).indexOf(id) === 0 ? child.key : id + child.key : child.key;
8905
+ var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
8906
+ var oldRawChild = this._vnode;
8907
+ var oldChild = getRealChild(oldRawChild); // mark v-show
8908
+ // so that the transition module can hand over the control to the directive
8909
+
8910
+ if (child.data.directives && child.data.directives.some(isVShowDirective)) {
8911
+ child.data.show = true;
8912
+ }
8913
+
8914
+ if (oldChild && oldChild.data && !isSameChild(child, oldChild) && !isAsyncPlaceholder(oldChild) && // #6687 component root is a comment node
8915
+ !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)) {
8916
+ // replace old child transition data with fresh one
8917
+ // important for dynamic transitions!
8918
+ var oldData = oldChild.data.transition = extend({}, data); // handle transition mode
8919
+
8920
+ if (mode === 'out-in') {
8921
+ // return placeholder node and queue update when leave finishes
8922
+ this._leaving = true;
8923
+ mergeVNodeHook(oldData, 'afterLeave', function () {
8924
+ this$1._leaving = false;
8925
+ this$1.$forceUpdate();
8926
+ });
8927
+ return placeholder(h, rawChild);
8928
+ } else if (mode === 'in-out') {
8929
+ if (isAsyncPlaceholder(child)) {
8930
+ return oldRawChild;
8931
+ }
8932
+
8933
+ var delayedLeave;
8934
+
8935
+ var performLeave = function () {
8936
+ delayedLeave();
8937
+ };
8938
+
8939
+ mergeVNodeHook(data, 'afterEnter', performLeave);
8940
+ mergeVNodeHook(data, 'enterCancelled', performLeave);
8941
+ mergeVNodeHook(oldData, 'delayLeave', function (leave) {
8942
+ delayedLeave = leave;
8943
+ });
8944
+ }
8945
+ }
8946
+
8947
+ return rawChild;
8948
+ }
8949
+ };
8950
+ /* */
8951
+
8952
+ var props = extend({
8953
+ tag: String,
8954
+ moveClass: String
8955
+ }, transitionProps);
8956
+ delete props.mode;
8957
+ var TransitionGroup = {
8958
+ props: props,
8959
+ beforeMount: function beforeMount() {
8960
+ var this$1 = this;
8961
+ var update = this._update;
8962
+
8963
+ this._update = function (vnode, hydrating) {
8964
+ var restoreActiveInstance = setActiveInstance(this$1); // force removing pass
8965
+
8966
+ this$1.__patch__(this$1._vnode, this$1.kept, false, // hydrating
8967
+ true // removeOnly (!important, avoids unnecessary moves)
8968
+ );
8969
+
8970
+ this$1._vnode = this$1.kept;
8971
+ restoreActiveInstance();
8972
+ update.call(this$1, vnode, hydrating);
8973
+ };
8974
+ },
8975
+ render: function render(h) {
8976
+ var tag = this.tag || this.$vnode.data.tag || 'span';
8977
+ var map = Object.create(null);
8978
+ var prevChildren = this.prevChildren = this.children;
8979
+ var rawChildren = this.$slots.default || [];
8980
+ var children = this.children = [];
8981
+ var transitionData = extractTransitionData(this);
8982
+
8983
+ for (var i = 0; i < rawChildren.length; i++) {
8984
+ var c = rawChildren[i];
8985
+
8986
+ if (c.tag) {
8987
+ if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
8988
+ children.push(c);
8989
+ map[c.key] = c;
8990
+ (c.data || (c.data = {})).transition = transitionData;
8991
+ } else if ("development" !== 'production') {
8992
+ var opts = c.componentOptions;
8993
+ var name = opts ? opts.Ctor.options.name || opts.tag || '' : c.tag;
8994
+ warn("<transition-group> children must be keyed: <" + name + ">");
8995
+ }
8996
+ }
8997
+ }
8998
+
8999
+ if (prevChildren) {
9000
+ var kept = [];
9001
+ var removed = [];
9002
+
9003
+ for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
9004
+ var c$1 = prevChildren[i$1];
9005
+ c$1.data.transition = transitionData;
9006
+ c$1.data.pos = c$1.elm.getBoundingClientRect();
9007
+
9008
+ if (map[c$1.key]) {
9009
+ kept.push(c$1);
9010
+ } else {
9011
+ removed.push(c$1);
9012
+ }
9013
+ }
9014
+
9015
+ this.kept = h(tag, null, kept);
9016
+ this.removed = removed;
9017
+ }
9018
+
9019
+ return h(tag, null, children);
9020
+ },
9021
+ updated: function updated() {
9022
+ var children = this.prevChildren;
9023
+ var moveClass = this.moveClass || (this.name || 'v') + '-move';
9024
+
9025
+ if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
9026
+ return;
9027
+ } // we divide the work into three loops to avoid mixing DOM reads and writes
9028
+ // in each iteration - which helps prevent layout thrashing.
9029
+
9030
+
9031
+ children.forEach(callPendingCbs);
9032
+ children.forEach(recordPosition);
9033
+ children.forEach(applyTranslation); // force reflow to put everything in position
9034
+ // assign to this to avoid being removed in tree-shaking
9035
+ // $flow-disable-line
9036
+
9037
+ this._reflow = document.body.offsetHeight;
9038
+ children.forEach(function (c) {
9039
+ if (c.data.moved) {
9040
+ var el = c.elm;
9041
+ var s = el.style;
9042
+ addTransitionClass(el, moveClass);
9043
+ s.transform = s.WebkitTransform = s.transitionDuration = '';
9044
+ el.addEventListener(transitionEndEvent, el._moveCb = function cb(e) {
9045
+ if (e && e.target !== el) {
9046
+ return;
9047
+ }
9048
+
9049
+ if (!e || /transform$/.test(e.propertyName)) {
9050
+ el.removeEventListener(transitionEndEvent, cb);
9051
+ el._moveCb = null;
9052
+ removeTransitionClass(el, moveClass);
9053
+ }
9054
+ });
9055
+ }
9056
+ });
9057
+ },
9058
+ methods: {
9059
+ hasMove: function hasMove(el, moveClass) {
9060
+ /* istanbul ignore if */
9061
+ if (!hasTransition) {
9062
+ return false;
9063
+ }
9064
+ /* istanbul ignore if */
9065
+
9066
+
9067
+ if (this._hasMove) {
9068
+ return this._hasMove;
9069
+ } // Detect whether an element with the move class applied has
9070
+ // CSS transitions. Since the element may be inside an entering
9071
+ // transition at this very moment, we make a clone of it and remove
9072
+ // all other transition classes applied to ensure only the move class
9073
+ // is applied.
9074
+
9075
+
9076
+ var clone = el.cloneNode();
9077
+
9078
+ if (el._transitionClasses) {
9079
+ el._transitionClasses.forEach(function (cls) {
9080
+ removeClass(clone, cls);
9081
+ });
9082
+ }
9083
+
9084
+ addClass(clone, moveClass);
9085
+ clone.style.display = 'none';
9086
+ this.$el.appendChild(clone);
9087
+ var info = getTransitionInfo(clone);
9088
+ this.$el.removeChild(clone);
9089
+ return this._hasMove = info.hasTransform;
9090
+ }
9091
+ }
9092
+ };
9093
+
9094
+ function callPendingCbs(c) {
9095
+ /* istanbul ignore if */
9096
+ if (c.elm._moveCb) {
9097
+ c.elm._moveCb();
9098
+ }
9099
+ /* istanbul ignore if */
9100
+
9101
+
9102
+ if (c.elm._enterCb) {
9103
+ c.elm._enterCb();
9104
+ }
9105
+ }
9106
+
9107
+ function recordPosition(c) {
9108
+ c.data.newPos = c.elm.getBoundingClientRect();
9109
+ }
9110
+
9111
+ function applyTranslation(c) {
9112
+ var oldPos = c.data.pos;
9113
+ var newPos = c.data.newPos;
9114
+ var dx = oldPos.left - newPos.left;
9115
+ var dy = oldPos.top - newPos.top;
9116
+
9117
+ if (dx || dy) {
9118
+ c.data.moved = true;
9119
+ var s = c.elm.style;
9120
+ s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
9121
+ s.transitionDuration = '0s';
9122
+ }
9123
+ }
9124
+
9125
+ var platformComponents = {
9126
+ Transition: Transition,
9127
+ TransitionGroup: TransitionGroup
9128
+ };
9129
+ /* */
9130
+ // install platform specific utils
9131
+
9132
+ Vue.config.mustUseProp = mustUseProp;
9133
+ Vue.config.isReservedTag = isReservedTag;
9134
+ Vue.config.isReservedAttr = isReservedAttr;
9135
+ Vue.config.getTagNamespace = getTagNamespace;
9136
+ Vue.config.isUnknownElement = isUnknownElement; // install platform runtime directives & components
9137
+
9138
+ extend(Vue.options.directives, platformDirectives);
9139
+ extend(Vue.options.components, platformComponents); // install platform patch function
9140
+
9141
+ Vue.prototype.__patch__ = inBrowser ? patch : noop; // public mount method
9142
+
9143
+ Vue.prototype.$mount = function (el, hydrating) {
9144
+ el = el && inBrowser ? query(el) : undefined;
9145
+ return mountComponent(this, el, hydrating);
9146
+ }; // devtools global hook
9147
+
9148
+ /* istanbul ignore next */
9149
+
9150
+
9151
+ if (inBrowser) {
9152
+ setTimeout(function () {
9153
+ if (config.devtools) {
9154
+ if (devtools) {
9155
+ devtools.emit('init', Vue);
9156
+ } else if ("development" !== 'production' && "development" !== 'test') {
9157
+ console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' + 'https://github.com/vuejs/vue-devtools');
9158
+ }
9159
+ }
9160
+
9161
+ if ("development" !== 'production' && "development" !== 'test' && config.productionTip !== false && typeof console !== 'undefined') {
9162
+ console[console.info ? 'info' : 'log']("You are running Vue in development mode.\n" + "Make sure to turn on production mode when deploying for production.\n" + "See more tips at https://vuejs.org/guide/deployment.html");
9163
+ }
9164
+ }, 0);
9165
+ }
9166
+ /* */
9167
+
9168
+
9169
+ var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
9170
+ var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
9171
+ var buildRegex = cached(function (delimiters) {
9172
+ var open = delimiters[0].replace(regexEscapeRE, '\\$&');
9173
+ var close = delimiters[1].replace(regexEscapeRE, '\\$&');
9174
+ return new RegExp(open + '((?:.|\\n)+?)' + close, 'g');
9175
+ });
9176
+
9177
+ function parseText(text, delimiters) {
9178
+ var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
9179
+
9180
+ if (!tagRE.test(text)) {
9181
+ return;
9182
+ }
9183
+
9184
+ var tokens = [];
9185
+ var rawTokens = [];
9186
+ var lastIndex = tagRE.lastIndex = 0;
9187
+ var match, index, tokenValue;
9188
+
9189
+ while (match = tagRE.exec(text)) {
9190
+ index = match.index; // push text token
9191
+
9192
+ if (index > lastIndex) {
9193
+ rawTokens.push(tokenValue = text.slice(lastIndex, index));
9194
+ tokens.push(JSON.stringify(tokenValue));
9195
+ } // tag token
9196
+
9197
+
9198
+ var exp = parseFilters(match[1].trim());
9199
+ tokens.push("_s(" + exp + ")");
9200
+ rawTokens.push({
9201
+ '@binding': exp
9202
+ });
9203
+ lastIndex = index + match[0].length;
9204
+ }
9205
+
9206
+ if (lastIndex < text.length) {
9207
+ rawTokens.push(tokenValue = text.slice(lastIndex));
9208
+ tokens.push(JSON.stringify(tokenValue));
9209
+ }
9210
+
9211
+ return {
9212
+ expression: tokens.join('+'),
9213
+ tokens: rawTokens
9214
+ };
9215
+ }
9216
+ /* */
9217
+
9218
+
9219
+ function transformNode(el, options) {
9220
+ var warn = options.warn || baseWarn;
9221
+ var staticClass = getAndRemoveAttr(el, 'class');
9222
+
9223
+ if ("development" !== 'production' && staticClass) {
9224
+ var res = parseText(staticClass, options.delimiters);
9225
+
9226
+ if (res) {
9227
+ warn("class=\"" + staticClass + "\": " + 'Interpolation inside attributes has been removed. ' + 'Use v-bind or the colon shorthand instead. For example, ' + 'instead of <div class="{{ val }}">, use <div :class="val">.', el.rawAttrsMap['class']);
9228
+ }
9229
+ }
9230
+
9231
+ if (staticClass) {
9232
+ el.staticClass = JSON.stringify(staticClass);
9233
+ }
9234
+
9235
+ var classBinding = getBindingAttr(el, 'class', false
9236
+ /* getStatic */
9237
+ );
9238
+
9239
+ if (classBinding) {
9240
+ el.classBinding = classBinding;
9241
+ }
9242
+ }
9243
+
9244
+ function genData(el) {
9245
+ var data = '';
9246
+
9247
+ if (el.staticClass) {
9248
+ data += "staticClass:" + el.staticClass + ",";
9249
+ }
9250
+
9251
+ if (el.classBinding) {
9252
+ data += "class:" + el.classBinding + ",";
9253
+ }
9254
+
9255
+ return data;
9256
+ }
9257
+
9258
+ var klass$1 = {
9259
+ staticKeys: ['staticClass'],
9260
+ transformNode: transformNode,
9261
+ genData: genData
9262
+ };
9263
+ /* */
9264
+
9265
+ function transformNode$1(el, options) {
9266
+ var warn = options.warn || baseWarn;
9267
+ var staticStyle = getAndRemoveAttr(el, 'style');
9268
+
9269
+ if (staticStyle) {
9270
+ /* istanbul ignore if */
9271
+ if ("development" !== 'production') {
9272
+ var res = parseText(staticStyle, options.delimiters);
9273
+
9274
+ if (res) {
9275
+ warn("style=\"" + staticStyle + "\": " + 'Interpolation inside attributes has been removed. ' + 'Use v-bind or the colon shorthand instead. For example, ' + 'instead of <div style="{{ val }}">, use <div :style="val">.', el.rawAttrsMap['style']);
9276
+ }
9277
+ }
9278
+
9279
+ el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
9280
+ }
9281
+
9282
+ var styleBinding = getBindingAttr(el, 'style', false
9283
+ /* getStatic */
9284
+ );
9285
+
9286
+ if (styleBinding) {
9287
+ el.styleBinding = styleBinding;
9288
+ }
9289
+ }
9290
+
9291
+ function genData$1(el) {
9292
+ var data = '';
9293
+
9294
+ if (el.staticStyle) {
9295
+ data += "staticStyle:" + el.staticStyle + ",";
9296
+ }
9297
+
9298
+ if (el.styleBinding) {
9299
+ data += "style:(" + el.styleBinding + "),";
9300
+ }
9301
+
9302
+ return data;
9303
+ }
9304
+
9305
+ var style$1 = {
9306
+ staticKeys: ['staticStyle'],
9307
+ transformNode: transformNode$1,
9308
+ genData: genData$1
9309
+ };
9310
+ /* */
9311
+
9312
+ var decoder;
9313
+ var he = {
9314
+ decode: function decode(html) {
9315
+ decoder = decoder || document.createElement('div');
9316
+ decoder.innerHTML = html;
9317
+ return decoder.textContent;
9318
+ }
9319
+ };
9320
+ /* */
9321
+
9322
+ var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' + 'link,meta,param,source,track,wbr'); // Elements that you can, intentionally, leave open
9323
+ // (and which close themselves)
9324
+
9325
+ var canBeLeftOpenTag = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'); // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
9326
+ // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
9327
+
9328
+ var isNonPhrasingTag = makeMap('address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' + 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' + 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' + 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' + 'title,tr,track');
9329
+ /**
9330
+ * Not type-checking this file because it's mostly vendor code.
9331
+ */
9332
+ // Regular Expressions for parsing tags and attributes
9333
+
9334
+ var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9335
+ var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9336
+ var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + unicodeRegExp.source + "]*";
9337
+ var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
9338
+ var startTagOpen = new RegExp("^<" + qnameCapture);
9339
+ var startTagClose = /^\s*(\/?)>/;
9340
+ var endTag = new RegExp("^<\\/" + qnameCapture + "[^>]*>");
9341
+ var doctype = /^<!DOCTYPE [^>]+>/i; // #7298: escape - to avoid being passed as HTML comment when inlined in page
9342
+
9343
+ var comment = /^<!\--/;
9344
+ var conditionalComment = /^<!\[/; // Special Elements (can contain anything)
9345
+
9346
+ var isPlainTextElement = makeMap('script,style,textarea', true);
9347
+ var reCache = {};
9348
+ var decodingMap = {
9349
+ '&lt;': '<',
9350
+ '&gt;': '>',
9351
+ '&quot;': '"',
9352
+ '&amp;': '&',
9353
+ '&#10;': '\n',
9354
+ '&#9;': '\t',
9355
+ '&#39;': "'"
9356
+ };
9357
+ var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
9358
+ var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g; // #5992
9359
+
9360
+ var isIgnoreNewlineTag = makeMap('pre,textarea', true);
9361
+
9362
+ var shouldIgnoreFirstNewline = function (tag, html) {
9363
+ return tag && isIgnoreNewlineTag(tag) && html[0] === '\n';
9364
+ };
9365
+
9366
+ function decodeAttr(value, shouldDecodeNewlines) {
9367
+ var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
9368
+ return value.replace(re, function (match) {
9369
+ return decodingMap[match];
9370
+ });
9371
+ }
9372
+
9373
+ function parseHTML(html, options) {
9374
+ var stack = [];
9375
+ var expectHTML = options.expectHTML;
9376
+ var isUnaryTag$$1 = options.isUnaryTag || no;
9377
+ var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
9378
+ var index = 0;
9379
+ var last, lastTag;
9380
+
9381
+ while (html) {
9382
+ last = html; // Make sure we're not in a plaintext content element like script/style
9383
+
9384
+ if (!lastTag || !isPlainTextElement(lastTag)) {
9385
+ var textEnd = html.indexOf('<');
9386
+
9387
+ if (textEnd === 0) {
9388
+ // Comment:
9389
+ if (comment.test(html)) {
9390
+ var commentEnd = html.indexOf('-->');
9391
+
9392
+ if (commentEnd >= 0) {
9393
+ if (options.shouldKeepComment) {
9394
+ options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
9395
+ }
9396
+
9397
+ advance(commentEnd + 3);
9398
+ continue;
9399
+ }
9400
+ } // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
9401
+
9402
+
9403
+ if (conditionalComment.test(html)) {
9404
+ var conditionalEnd = html.indexOf(']>');
9405
+
9406
+ if (conditionalEnd >= 0) {
9407
+ advance(conditionalEnd + 2);
9408
+ continue;
9409
+ }
9410
+ } // Doctype:
9411
+
9412
+
9413
+ var doctypeMatch = html.match(doctype);
9414
+
9415
+ if (doctypeMatch) {
9416
+ advance(doctypeMatch[0].length);
9417
+ continue;
9418
+ } // End tag:
9419
+
9420
+
9421
+ var endTagMatch = html.match(endTag);
9422
+
9423
+ if (endTagMatch) {
9424
+ var curIndex = index;
9425
+ advance(endTagMatch[0].length);
9426
+ parseEndTag(endTagMatch[1], curIndex, index);
9427
+ continue;
9428
+ } // Start tag:
9429
+
9430
+
9431
+ var startTagMatch = parseStartTag();
9432
+
9433
+ if (startTagMatch) {
9434
+ handleStartTag(startTagMatch);
9435
+
9436
+ if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
9437
+ advance(1);
9438
+ }
9439
+
9440
+ continue;
9441
+ }
9442
+ }
9443
+
9444
+ var text = void 0,
9445
+ rest = void 0,
9446
+ next = void 0;
9447
+
9448
+ if (textEnd >= 0) {
9449
+ rest = html.slice(textEnd);
9450
+
9451
+ while (!endTag.test(rest) && !startTagOpen.test(rest) && !comment.test(rest) && !conditionalComment.test(rest)) {
9452
+ // < in plain text, be forgiving and treat it as text
9453
+ next = rest.indexOf('<', 1);
9454
+
9455
+ if (next < 0) {
9456
+ break;
9457
+ }
9458
+
9459
+ textEnd += next;
9460
+ rest = html.slice(textEnd);
9461
+ }
9462
+
9463
+ text = html.substring(0, textEnd);
9464
+ }
9465
+
9466
+ if (textEnd < 0) {
9467
+ text = html;
9468
+ }
9469
+
9470
+ if (text) {
9471
+ advance(text.length);
9472
+ }
9473
+
9474
+ if (options.chars && text) {
9475
+ options.chars(text, index - text.length, index);
9476
+ }
9477
+ } else {
9478
+ var endTagLength = 0;
9479
+ var stackedTag = lastTag.toLowerCase();
9480
+ var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
9481
+ var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
9482
+ endTagLength = endTag.length;
9483
+
9484
+ if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
9485
+ text = text.replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
9486
+ .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
9487
+ }
9488
+
9489
+ if (shouldIgnoreFirstNewline(stackedTag, text)) {
9490
+ text = text.slice(1);
9491
+ }
9492
+
9493
+ if (options.chars) {
9494
+ options.chars(text);
9495
+ }
9496
+
9497
+ return '';
9498
+ });
9499
+ index += html.length - rest$1.length;
9500
+ html = rest$1;
9501
+ parseEndTag(stackedTag, index - endTagLength, index);
9502
+ }
9503
+
9504
+ if (html === last) {
9505
+ options.chars && options.chars(html);
9506
+
9507
+ if ("development" !== 'production' && !stack.length && options.warn) {
9508
+ options.warn("Mal-formatted tag at end of template: \"" + html + "\"", {
9509
+ start: index + html.length
9510
+ });
9511
+ }
9512
+
9513
+ break;
9514
+ }
9515
+ } // Clean up any remaining tags
9516
+
9517
+
9518
+ parseEndTag();
9519
+
9520
+ function advance(n) {
9521
+ index += n;
9522
+ html = html.substring(n);
9523
+ }
9524
+
9525
+ function parseStartTag() {
9526
+ var start = html.match(startTagOpen);
9527
+
9528
+ if (start) {
9529
+ var match = {
9530
+ tagName: start[1],
9531
+ attrs: [],
9532
+ start: index
9533
+ };
9534
+ advance(start[0].length);
9535
+ var end, attr;
9536
+
9537
+ while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
9538
+ attr.start = index;
9539
+ advance(attr[0].length);
9540
+ attr.end = index;
9541
+ match.attrs.push(attr);
9542
+ }
9543
+
9544
+ if (end) {
9545
+ match.unarySlash = end[1];
9546
+ advance(end[0].length);
9547
+ match.end = index;
9548
+ return match;
9549
+ }
9550
+ }
9551
+ }
9552
+
9553
+ function handleStartTag(match) {
9554
+ var tagName = match.tagName;
9555
+ var unarySlash = match.unarySlash;
9556
+
9557
+ if (expectHTML) {
9558
+ if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
9559
+ parseEndTag(lastTag);
9560
+ }
9561
+
9562
+ if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
9563
+ parseEndTag(tagName);
9564
+ }
9565
+ }
9566
+
9567
+ var unary = isUnaryTag$$1(tagName) || !!unarySlash;
9568
+ var l = match.attrs.length;
9569
+ var attrs = new Array(l);
9570
+
9571
+ for (var i = 0; i < l; i++) {
9572
+ var args = match.attrs[i];
9573
+ var value = args[3] || args[4] || args[5] || '';
9574
+ var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href' ? options.shouldDecodeNewlinesForHref : options.shouldDecodeNewlines;
9575
+ attrs[i] = {
9576
+ name: args[1],
9577
+ value: decodeAttr(value, shouldDecodeNewlines)
9578
+ };
9579
+
9580
+ if ("development" !== 'production' && options.outputSourceRange) {
9581
+ attrs[i].start = args.start + args[0].match(/^\s*/).length;
9582
+ attrs[i].end = args.end;
9583
+ }
9584
+ }
9585
+
9586
+ if (!unary) {
9587
+ stack.push({
9588
+ tag: tagName,
9589
+ lowerCasedTag: tagName.toLowerCase(),
9590
+ attrs: attrs,
9591
+ start: match.start,
9592
+ end: match.end
9593
+ });
9594
+ lastTag = tagName;
9595
+ }
9596
+
9597
+ if (options.start) {
9598
+ options.start(tagName, attrs, unary, match.start, match.end);
9599
+ }
9600
+ }
9601
+
9602
+ function parseEndTag(tagName, start, end) {
9603
+ var pos, lowerCasedTagName;
9604
+
9605
+ if (start == null) {
9606
+ start = index;
9607
+ }
9608
+
9609
+ if (end == null) {
9610
+ end = index;
9611
+ } // Find the closest opened tag of the same type
9612
+
9613
+
9614
+ if (tagName) {
9615
+ lowerCasedTagName = tagName.toLowerCase();
9616
+
9617
+ for (pos = stack.length - 1; pos >= 0; pos--) {
9618
+ if (stack[pos].lowerCasedTag === lowerCasedTagName) {
9619
+ break;
9620
+ }
9621
+ }
9622
+ } else {
9623
+ // If no tag name is provided, clean shop
9624
+ pos = 0;
9625
+ }
9626
+
9627
+ if (pos >= 0) {
9628
+ // Close all the open elements, up the stack
9629
+ for (var i = stack.length - 1; i >= pos; i--) {
9630
+ if ("development" !== 'production' && (i > pos || !tagName) && options.warn) {
9631
+ options.warn("tag <" + stack[i].tag + "> has no matching end tag.", {
9632
+ start: stack[i].start,
9633
+ end: stack[i].end
9634
+ });
9635
+ }
9636
+
9637
+ if (options.end) {
9638
+ options.end(stack[i].tag, start, end);
9639
+ }
9640
+ } // Remove the open elements from the stack
9641
+
9642
+
9643
+ stack.length = pos;
9644
+ lastTag = pos && stack[pos - 1].tag;
9645
+ } else if (lowerCasedTagName === 'br') {
9646
+ if (options.start) {
9647
+ options.start(tagName, [], true, start, end);
9648
+ }
9649
+ } else if (lowerCasedTagName === 'p') {
9650
+ if (options.start) {
9651
+ options.start(tagName, [], false, start, end);
9652
+ }
9653
+
9654
+ if (options.end) {
9655
+ options.end(tagName, start, end);
9656
+ }
9657
+ }
9658
+ }
9659
+ }
9660
+ /* */
9661
+
9662
+
9663
+ var onRE = /^@|^v-on:/;
9664
+ var dirRE = /^v-|^@|^:|^#/;
9665
+ var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
9666
+ var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
9667
+ var stripParensRE = /^\(|\)$/g;
9668
+ var dynamicArgRE = /^\[.*\]$/;
9669
+ var argRE = /:(.*)$/;
9670
+ var bindRE = /^:|^\.|^v-bind:/;
9671
+ var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
9672
+ var slotRE = /^v-slot(:|$)|^#/;
9673
+ var lineBreakRE = /[\r\n]/;
9674
+ var whitespaceRE$1 = /\s+/g;
9675
+ var invalidAttributeRE = /[\s"'<>\/=]/;
9676
+ var decodeHTMLCached = cached(he.decode);
9677
+ var emptySlotScopeToken = "_empty_"; // configurable state
9678
+
9679
+ var warn$2;
9680
+ var delimiters;
9681
+ var transforms;
9682
+ var preTransforms;
9683
+ var postTransforms;
9684
+ var platformIsPreTag;
9685
+ var platformMustUseProp;
9686
+ var platformGetTagNamespace;
9687
+ var maybeComponent;
9688
+
9689
+ function createASTElement(tag, attrs, parent) {
9690
+ return {
9691
+ type: 1,
9692
+ tag: tag,
9693
+ attrsList: attrs,
9694
+ attrsMap: makeAttrsMap(attrs),
9695
+ rawAttrsMap: {},
9696
+ parent: parent,
9697
+ children: []
9698
+ };
9699
+ }
9700
+ /**
9701
+ * Convert HTML string to AST.
9702
+ */
9703
+
9704
+
9705
+ function parse(template, options) {
9706
+ warn$2 = options.warn || baseWarn;
9707
+ platformIsPreTag = options.isPreTag || no;
9708
+ platformMustUseProp = options.mustUseProp || no;
9709
+ platformGetTagNamespace = options.getTagNamespace || no;
9710
+ var isReservedTag = options.isReservedTag || no;
9711
+
9712
+ maybeComponent = function (el) {
9713
+ return !!el.component || !isReservedTag(el.tag);
9714
+ };
9715
+
9716
+ transforms = pluckModuleFunction(options.modules, 'transformNode');
9717
+ preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
9718
+ postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
9719
+ delimiters = options.delimiters;
9720
+ var stack = [];
9721
+ var preserveWhitespace = options.preserveWhitespace !== false;
9722
+ var whitespaceOption = options.whitespace;
9723
+ var root;
9724
+ var currentParent;
9725
+ var inVPre = false;
9726
+ var inPre = false;
9727
+ var warned = false;
9728
+
9729
+ function warnOnce(msg, range) {
9730
+ if (!warned) {
9731
+ warned = true;
9732
+ warn$2(msg, range);
9733
+ }
9734
+ }
9735
+
9736
+ function closeElement(element) {
9737
+ trimEndingWhitespace(element);
9738
+
9739
+ if (!inVPre && !element.processed) {
9740
+ element = processElement(element, options);
9741
+ } // tree management
9742
+
9743
+
9744
+ if (!stack.length && element !== root) {
9745
+ // allow root elements with v-if, v-else-if and v-else
9746
+ if (root.if && (element.elseif || element.else)) {
9747
+ if ("development" !== 'production') {
9748
+ checkRootConstraints(element);
9749
+ }
9750
+
9751
+ addIfCondition(root, {
9752
+ exp: element.elseif,
9753
+ block: element
9754
+ });
9755
+ } else if ("development" !== 'production') {
9756
+ warnOnce("Component template should contain exactly one root element. " + "If you are using v-if on multiple elements, " + "use v-else-if to chain them instead.", {
9757
+ start: element.start
9758
+ });
9759
+ }
9760
+ }
9761
+
9762
+ if (currentParent && !element.forbidden) {
9763
+ if (element.elseif || element.else) {
9764
+ processIfConditions(element, currentParent);
9765
+ } else {
9766
+ if (element.slotScope) {
9767
+ // scoped slot
9768
+ // keep it in the children list so that v-else(-if) conditions can
9769
+ // find it as the prev node.
9770
+ var name = element.slotTarget || '"default"';
9771
+ (currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
9772
+ }
9773
+
9774
+ currentParent.children.push(element);
9775
+ element.parent = currentParent;
9776
+ }
9777
+ } // final children cleanup
9778
+ // filter out scoped slots
9779
+
9780
+
9781
+ element.children = element.children.filter(function (c) {
9782
+ return !c.slotScope;
9783
+ }); // remove trailing whitespace node again
9784
+
9785
+ trimEndingWhitespace(element); // check pre state
9786
+
9787
+ if (element.pre) {
9788
+ inVPre = false;
9789
+ }
9790
+
9791
+ if (platformIsPreTag(element.tag)) {
9792
+ inPre = false;
9793
+ } // apply post-transforms
9794
+
9795
+
9796
+ for (var i = 0; i < postTransforms.length; i++) {
9797
+ postTransforms[i](element, options);
9798
+ }
9799
+ }
9800
+
9801
+ function trimEndingWhitespace(el) {
9802
+ // remove trailing whitespace node
9803
+ if (!inPre) {
9804
+ var lastNode;
9805
+
9806
+ while ((lastNode = el.children[el.children.length - 1]) && lastNode.type === 3 && lastNode.text === ' ') {
9807
+ el.children.pop();
9808
+ }
9809
+ }
9810
+ }
9811
+
9812
+ function checkRootConstraints(el) {
9813
+ if (el.tag === 'slot' || el.tag === 'template') {
9814
+ warnOnce("Cannot use <" + el.tag + "> as component root element because it may " + 'contain multiple nodes.', {
9815
+ start: el.start
9816
+ });
9817
+ }
9818
+
9819
+ if (el.attrsMap.hasOwnProperty('v-for')) {
9820
+ warnOnce('Cannot use v-for on stateful component root element because ' + 'it renders multiple elements.', el.rawAttrsMap['v-for']);
9821
+ }
9822
+ }
9823
+
9824
+ parseHTML(template, {
9825
+ warn: warn$2,
9826
+ expectHTML: options.expectHTML,
9827
+ isUnaryTag: options.isUnaryTag,
9828
+ canBeLeftOpenTag: options.canBeLeftOpenTag,
9829
+ shouldDecodeNewlines: options.shouldDecodeNewlines,
9830
+ shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
9831
+ shouldKeepComment: options.comments,
9832
+ outputSourceRange: options.outputSourceRange,
9833
+ start: function start(tag, attrs, unary, start$1, end) {
9834
+ // check namespace.
9835
+ // inherit parent ns if there is one
9836
+ var ns = currentParent && currentParent.ns || platformGetTagNamespace(tag); // handle IE svg bug
9837
+
9838
+ /* istanbul ignore if */
9839
+
9840
+ if (isIE && ns === 'svg') {
9841
+ attrs = guardIESVGBug(attrs);
9842
+ }
9843
+
9844
+ var element = createASTElement(tag, attrs, currentParent);
9845
+
9846
+ if (ns) {
9847
+ element.ns = ns;
9848
+ }
9849
+
9850
+ if ("development" !== 'production') {
9851
+ if (options.outputSourceRange) {
9852
+ element.start = start$1;
9853
+ element.end = end;
9854
+ element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
9855
+ cumulated[attr.name] = attr;
9856
+ return cumulated;
9857
+ }, {});
9858
+ }
9859
+
9860
+ attrs.forEach(function (attr) {
9861
+ if (invalidAttributeRE.test(attr.name)) {
9862
+ warn$2("Invalid dynamic argument expression: attribute names cannot contain " + "spaces, quotes, <, >, / or =.", {
9863
+ start: attr.start + attr.name.indexOf("["),
9864
+ end: attr.start + attr.name.length
9865
+ });
9866
+ }
9867
+ });
9868
+ }
9869
+
9870
+ if (isForbiddenTag(element) && !isServerRendering()) {
9871
+ element.forbidden = true;
9872
+ "development" !== 'production' && warn$2('Templates should only be responsible for mapping the state to the ' + 'UI. Avoid placing tags with side-effects in your templates, such as ' + "<" + tag + ">" + ', as they will not be parsed.', {
9873
+ start: element.start
9874
+ });
9875
+ } // apply pre-transforms
9876
+
9877
+
9878
+ for (var i = 0; i < preTransforms.length; i++) {
9879
+ element = preTransforms[i](element, options) || element;
9880
+ }
9881
+
9882
+ if (!inVPre) {
9883
+ processPre(element);
9884
+
9885
+ if (element.pre) {
9886
+ inVPre = true;
9887
+ }
9888
+ }
9889
+
9890
+ if (platformIsPreTag(element.tag)) {
9891
+ inPre = true;
9892
+ }
9893
+
9894
+ if (inVPre) {
9895
+ processRawAttrs(element);
9896
+ } else if (!element.processed) {
9897
+ // structural directives
9898
+ processFor(element);
9899
+ processIf(element);
9900
+ processOnce(element);
9901
+ }
9902
+
9903
+ if (!root) {
9904
+ root = element;
9905
+
9906
+ if ("development" !== 'production') {
9907
+ checkRootConstraints(root);
9908
+ }
9909
+ }
9910
+
9911
+ if (!unary) {
9912
+ currentParent = element;
9913
+ stack.push(element);
9914
+ } else {
9915
+ closeElement(element);
9916
+ }
9917
+ },
9918
+ end: function end(tag, start, end$1) {
9919
+ var element = stack[stack.length - 1]; // pop stack
9920
+
9921
+ stack.length -= 1;
9922
+ currentParent = stack[stack.length - 1];
9923
+
9924
+ if ("development" !== 'production' && options.outputSourceRange) {
9925
+ element.end = end$1;
9926
+ }
9927
+
9928
+ closeElement(element);
9929
+ },
9930
+ chars: function chars(text, start, end) {
9931
+ if (!currentParent) {
9932
+ if ("development" !== 'production') {
9933
+ if (text === template) {
9934
+ warnOnce('Component template requires a root element, rather than just text.', {
9935
+ start: start
9936
+ });
9937
+ } else if (text = text.trim()) {
9938
+ warnOnce("text \"" + text + "\" outside root element will be ignored.", {
9939
+ start: start
9940
+ });
9941
+ }
9942
+ }
9943
+
9944
+ return;
9945
+ } // IE textarea placeholder bug
9946
+
9947
+ /* istanbul ignore if */
9948
+
9949
+
9950
+ if (isIE && currentParent.tag === 'textarea' && currentParent.attrsMap.placeholder === text) {
9951
+ return;
9952
+ }
9953
+
9954
+ var children = currentParent.children;
9955
+
9956
+ if (inPre || text.trim()) {
9957
+ text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
9958
+ } else if (!children.length) {
9959
+ // remove the whitespace-only node right after an opening tag
9960
+ text = '';
9961
+ } else if (whitespaceOption) {
9962
+ if (whitespaceOption === 'condense') {
9963
+ // in condense mode, remove the whitespace node if it contains
9964
+ // line break, otherwise condense to a single space
9965
+ text = lineBreakRE.test(text) ? '' : ' ';
9966
+ } else {
9967
+ text = ' ';
9968
+ }
9969
+ } else {
9970
+ text = preserveWhitespace ? ' ' : '';
9971
+ }
9972
+
9973
+ if (text) {
9974
+ if (!inPre && whitespaceOption === 'condense') {
9975
+ // condense consecutive whitespaces into single space
9976
+ text = text.replace(whitespaceRE$1, ' ');
9977
+ }
9978
+
9979
+ var res;
9980
+ var child;
9981
+
9982
+ if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
9983
+ child = {
9984
+ type: 2,
9985
+ expression: res.expression,
9986
+ tokens: res.tokens,
9987
+ text: text
9988
+ };
9989
+ } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
9990
+ child = {
9991
+ type: 3,
9992
+ text: text
9993
+ };
9994
+ }
9995
+
9996
+ if (child) {
9997
+ if ("development" !== 'production' && options.outputSourceRange) {
9998
+ child.start = start;
9999
+ child.end = end;
10000
+ }
10001
+
10002
+ children.push(child);
10003
+ }
10004
+ }
10005
+ },
10006
+ comment: function comment(text, start, end) {
10007
+ // adding anyting as a sibling to the root node is forbidden
10008
+ // comments should still be allowed, but ignored
10009
+ if (currentParent) {
10010
+ var child = {
10011
+ type: 3,
10012
+ text: text,
10013
+ isComment: true
10014
+ };
10015
+
10016
+ if ("development" !== 'production' && options.outputSourceRange) {
10017
+ child.start = start;
10018
+ child.end = end;
10019
+ }
10020
+
10021
+ currentParent.children.push(child);
10022
+ }
10023
+ }
10024
+ });
10025
+ return root;
10026
+ }
10027
+
10028
+ function processPre(el) {
10029
+ if (getAndRemoveAttr(el, 'v-pre') != null) {
10030
+ el.pre = true;
10031
+ }
10032
+ }
10033
+
10034
+ function processRawAttrs(el) {
10035
+ var list = el.attrsList;
10036
+ var len = list.length;
10037
+
10038
+ if (len) {
10039
+ var attrs = el.attrs = new Array(len);
10040
+
10041
+ for (var i = 0; i < len; i++) {
10042
+ attrs[i] = {
10043
+ name: list[i].name,
10044
+ value: JSON.stringify(list[i].value)
10045
+ };
10046
+
10047
+ if (list[i].start != null) {
10048
+ attrs[i].start = list[i].start;
10049
+ attrs[i].end = list[i].end;
10050
+ }
10051
+ }
10052
+ } else if (!el.pre) {
10053
+ // non root node in pre blocks with no attributes
10054
+ el.plain = true;
10055
+ }
10056
+ }
10057
+
10058
+ function processElement(element, options) {
10059
+ processKey(element); // determine whether this is a plain element after
10060
+ // removing structural attributes
10061
+
10062
+ element.plain = !element.key && !element.scopedSlots && !element.attrsList.length;
10063
+ processRef(element);
10064
+ processSlotContent(element);
10065
+ processSlotOutlet(element);
10066
+ processComponent(element);
10067
+
10068
+ for (var i = 0; i < transforms.length; i++) {
10069
+ element = transforms[i](element, options) || element;
10070
+ }
10071
+
10072
+ processAttrs(element);
10073
+ return element;
10074
+ }
10075
+
10076
+ function processKey(el) {
10077
+ var exp = getBindingAttr(el, 'key');
10078
+
10079
+ if (exp) {
10080
+ if ("development" !== 'production') {
10081
+ if (el.tag === 'template') {
10082
+ warn$2("<template> cannot be keyed. Place the key on real elements instead.", getRawBindingAttr(el, 'key'));
10083
+ }
10084
+
10085
+ if (el.for) {
10086
+ var iterator = el.iterator2 || el.iterator1;
10087
+ var parent = el.parent;
10088
+
10089
+ if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
10090
+ warn$2("Do not use v-for index as key on <transition-group> children, " + "this is the same as not using keys.", getRawBindingAttr(el, 'key'), true
10091
+ /* tip */
10092
+ );
10093
+ }
10094
+ }
10095
+ }
10096
+
10097
+ el.key = exp;
10098
+ }
10099
+ }
10100
+
10101
+ function processRef(el) {
10102
+ var ref = getBindingAttr(el, 'ref');
10103
+
10104
+ if (ref) {
10105
+ el.ref = ref;
10106
+ el.refInFor = checkInFor(el);
10107
+ }
10108
+ }
10109
+
10110
+ function processFor(el) {
10111
+ var exp;
10112
+
10113
+ if (exp = getAndRemoveAttr(el, 'v-for')) {
10114
+ var res = parseFor(exp);
10115
+
10116
+ if (res) {
10117
+ extend(el, res);
10118
+ } else if ("development" !== 'production') {
10119
+ warn$2("Invalid v-for expression: " + exp, el.rawAttrsMap['v-for']);
10120
+ }
10121
+ }
10122
+ }
10123
+
10124
+ function parseFor(exp) {
10125
+ var inMatch = exp.match(forAliasRE);
10126
+
10127
+ if (!inMatch) {
10128
+ return;
10129
+ }
10130
+
10131
+ var res = {};
10132
+ res.for = inMatch[2].trim();
10133
+ var alias = inMatch[1].trim().replace(stripParensRE, '');
10134
+ var iteratorMatch = alias.match(forIteratorRE);
10135
+
10136
+ if (iteratorMatch) {
10137
+ res.alias = alias.replace(forIteratorRE, '').trim();
10138
+ res.iterator1 = iteratorMatch[1].trim();
10139
+
10140
+ if (iteratorMatch[2]) {
10141
+ res.iterator2 = iteratorMatch[2].trim();
10142
+ }
10143
+ } else {
10144
+ res.alias = alias;
10145
+ }
10146
+
10147
+ return res;
10148
+ }
10149
+
10150
+ function processIf(el) {
10151
+ var exp = getAndRemoveAttr(el, 'v-if');
10152
+
10153
+ if (exp) {
10154
+ el.if = exp;
10155
+ addIfCondition(el, {
10156
+ exp: exp,
10157
+ block: el
10158
+ });
10159
+ } else {
10160
+ if (getAndRemoveAttr(el, 'v-else') != null) {
10161
+ el.else = true;
10162
+ }
10163
+
10164
+ var elseif = getAndRemoveAttr(el, 'v-else-if');
10165
+
10166
+ if (elseif) {
10167
+ el.elseif = elseif;
10168
+ }
10169
+ }
10170
+ }
10171
+
10172
+ function processIfConditions(el, parent) {
10173
+ var prev = findPrevElement(parent.children);
10174
+
10175
+ if (prev && prev.if) {
10176
+ addIfCondition(prev, {
10177
+ exp: el.elseif,
10178
+ block: el
10179
+ });
10180
+ } else if ("development" !== 'production') {
10181
+ warn$2("v-" + (el.elseif ? 'else-if="' + el.elseif + '"' : 'else') + " " + "used on element <" + el.tag + "> without corresponding v-if.", el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']);
10182
+ }
10183
+ }
10184
+
10185
+ function findPrevElement(children) {
10186
+ var i = children.length;
10187
+
10188
+ while (i--) {
10189
+ if (children[i].type === 1) {
10190
+ return children[i];
10191
+ } else {
10192
+ if ("development" !== 'production' && children[i].text !== ' ') {
10193
+ warn$2("text \"" + children[i].text.trim() + "\" between v-if and v-else(-if) " + "will be ignored.", children[i]);
10194
+ }
10195
+
10196
+ children.pop();
10197
+ }
10198
+ }
10199
+ }
10200
+
10201
+ function addIfCondition(el, condition) {
10202
+ if (!el.ifConditions) {
10203
+ el.ifConditions = [];
10204
+ }
10205
+
10206
+ el.ifConditions.push(condition);
10207
+ }
10208
+
10209
+ function processOnce(el) {
10210
+ var once$$1 = getAndRemoveAttr(el, 'v-once');
10211
+
10212
+ if (once$$1 != null) {
10213
+ el.once = true;
10214
+ }
10215
+ } // handle content being passed to a component as slot,
10216
+ // e.g. <template slot="xxx">, <div slot-scope="xxx">
10217
+
10218
+
10219
+ function processSlotContent(el) {
10220
+ var slotScope;
10221
+
10222
+ if (el.tag === 'template') {
10223
+ slotScope = getAndRemoveAttr(el, 'scope');
10224
+ /* istanbul ignore if */
10225
+
10226
+ if ("development" !== 'production' && slotScope) {
10227
+ warn$2("the \"scope\" attribute for scoped slots have been deprecated and " + "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " + "can also be used on plain elements in addition to <template> to " + "denote scoped slots.", el.rawAttrsMap['scope'], true);
10228
+ }
10229
+
10230
+ el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
10231
+ } else if (slotScope = getAndRemoveAttr(el, 'slot-scope')) {
10232
+ /* istanbul ignore if */
10233
+ if ("development" !== 'production' && el.attrsMap['v-for']) {
10234
+ warn$2("Ambiguous combined usage of slot-scope and v-for on <" + el.tag + "> " + "(v-for takes higher priority). Use a wrapper <template> for the " + "scoped slot to make it clearer.", el.rawAttrsMap['slot-scope'], true);
10235
+ }
10236
+
10237
+ el.slotScope = slotScope;
10238
+ } // slot="xxx"
10239
+
10240
+
10241
+ var slotTarget = getBindingAttr(el, 'slot');
10242
+
10243
+ if (slotTarget) {
10244
+ el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
10245
+ el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']); // preserve slot as an attribute for native shadow DOM compat
10246
+ // only for non-scoped slots.
10247
+
10248
+ if (el.tag !== 'template' && !el.slotScope) {
10249
+ addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
10250
+ }
10251
+ } // 2.6 v-slot syntax
10252
+
10253
+
10254
+ {
10255
+ if (el.tag === 'template') {
10256
+ // v-slot on <template>
10257
+ var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
10258
+
10259
+ if (slotBinding) {
10260
+ if ("development" !== 'production') {
10261
+ if (el.slotTarget || el.slotScope) {
10262
+ warn$2("Unexpected mixed usage of different slot syntaxes.", el);
10263
+ }
10264
+
10265
+ if (el.parent && !maybeComponent(el.parent)) {
10266
+ warn$2("<template v-slot> can only appear at the root level inside " + "the receiving component", el);
10267
+ }
10268
+ }
10269
+
10270
+ var ref = getSlotName(slotBinding);
10271
+ var name = ref.name;
10272
+ var dynamic = ref.dynamic;
10273
+ el.slotTarget = name;
10274
+ el.slotTargetDynamic = dynamic;
10275
+ el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
10276
+ }
10277
+ } else {
10278
+ // v-slot on component, denotes default slot
10279
+ var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
10280
+
10281
+ if (slotBinding$1) {
10282
+ if ("development" !== 'production') {
10283
+ if (!maybeComponent(el)) {
10284
+ warn$2("v-slot can only be used on components or <template>.", slotBinding$1);
10285
+ }
10286
+
10287
+ if (el.slotScope || el.slotTarget) {
10288
+ warn$2("Unexpected mixed usage of different slot syntaxes.", el);
10289
+ }
10290
+
10291
+ if (el.scopedSlots) {
10292
+ warn$2("To avoid scope ambiguity, the default slot should also use " + "<template> syntax when there are other named slots.", slotBinding$1);
10293
+ }
10294
+ } // add the component's children to its default slot
10295
+
10296
+
10297
+ var slots = el.scopedSlots || (el.scopedSlots = {});
10298
+ var ref$1 = getSlotName(slotBinding$1);
10299
+ var name$1 = ref$1.name;
10300
+ var dynamic$1 = ref$1.dynamic;
10301
+ var slotContainer = slots[name$1] = createASTElement('template', [], el);
10302
+ slotContainer.slotTarget = name$1;
10303
+ slotContainer.slotTargetDynamic = dynamic$1;
10304
+ slotContainer.children = el.children.filter(function (c) {
10305
+ if (!c.slotScope) {
10306
+ c.parent = slotContainer;
10307
+ return true;
10308
+ }
10309
+ });
10310
+ slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken; // remove children as they are returned from scopedSlots now
10311
+
10312
+ el.children = []; // mark el non-plain so data gets generated
10313
+
10314
+ el.plain = false;
10315
+ }
10316
+ }
10317
+ }
10318
+ }
10319
+
10320
+ function getSlotName(binding) {
10321
+ var name = binding.name.replace(slotRE, '');
10322
+
10323
+ if (!name) {
10324
+ if (binding.name[0] !== '#') {
10325
+ name = 'default';
10326
+ } else if ("development" !== 'production') {
10327
+ warn$2("v-slot shorthand syntax requires a slot name.", binding);
10328
+ }
10329
+ }
10330
+
10331
+ return dynamicArgRE.test(name) // dynamic [name]
10332
+ ? {
10333
+ name: name.slice(1, -1),
10334
+ dynamic: true
10335
+ } // static name
10336
+ : {
10337
+ name: "\"" + name + "\"",
10338
+ dynamic: false
10339
+ };
10340
+ } // handle <slot/> outlets
10341
+
10342
+
10343
+ function processSlotOutlet(el) {
10344
+ if (el.tag === 'slot') {
10345
+ el.slotName = getBindingAttr(el, 'name');
10346
+
10347
+ if ("development" !== 'production' && el.key) {
10348
+ warn$2("`key` does not work on <slot> because slots are abstract outlets " + "and can possibly expand into multiple elements. " + "Use the key on a wrapping element instead.", getRawBindingAttr(el, 'key'));
10349
+ }
10350
+ }
10351
+ }
10352
+
10353
+ function processComponent(el) {
10354
+ var binding;
10355
+
10356
+ if (binding = getBindingAttr(el, 'is')) {
10357
+ el.component = binding;
10358
+ }
10359
+
10360
+ if (getAndRemoveAttr(el, 'inline-template') != null) {
10361
+ el.inlineTemplate = true;
10362
+ }
10363
+ }
10364
+
10365
+ function processAttrs(el) {
10366
+ var list = el.attrsList;
10367
+ var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
10368
+
10369
+ for (i = 0, l = list.length; i < l; i++) {
10370
+ name = rawName = list[i].name;
10371
+ value = list[i].value;
10372
+
10373
+ if (dirRE.test(name)) {
10374
+ // mark element as dynamic
10375
+ el.hasBindings = true; // modifiers
10376
+
10377
+ modifiers = parseModifiers(name.replace(dirRE, '')); // support .foo shorthand syntax for the .prop modifier
10378
+
10379
+ if (modifiers) {
10380
+ name = name.replace(modifierRE, '');
10381
+ }
10382
+
10383
+ if (bindRE.test(name)) {
10384
+ // v-bind
10385
+ name = name.replace(bindRE, '');
10386
+ value = parseFilters(value);
10387
+ isDynamic = dynamicArgRE.test(name);
10388
+
10389
+ if (isDynamic) {
10390
+ name = name.slice(1, -1);
10391
+ }
10392
+
10393
+ if ("development" !== 'production' && value.trim().length === 0) {
10394
+ warn$2("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"");
10395
+ }
10396
+
10397
+ if (modifiers) {
10398
+ if (modifiers.prop && !isDynamic) {
10399
+ name = camelize(name);
10400
+
10401
+ if (name === 'innerHtml') {
10402
+ name = 'innerHTML';
10403
+ }
10404
+ }
10405
+
10406
+ if (modifiers.camel && !isDynamic) {
10407
+ name = camelize(name);
10408
+ }
10409
+
10410
+ if (modifiers.sync) {
10411
+ syncGen = genAssignmentCode(value, "$event");
10412
+
10413
+ if (!isDynamic) {
10414
+ addHandler(el, "update:" + camelize(name), syncGen, null, false, warn$2, list[i]);
10415
+
10416
+ if (hyphenate(name) !== camelize(name)) {
10417
+ addHandler(el, "update:" + hyphenate(name), syncGen, null, false, warn$2, list[i]);
10418
+ }
10419
+ } else {
10420
+ // handler w/ dynamic event name
10421
+ addHandler(el, "\"update:\"+(" + name + ")", syncGen, null, false, warn$2, list[i], true // dynamic
10422
+ );
10423
+ }
10424
+ }
10425
+ }
10426
+
10427
+ if (modifiers && modifiers.prop || !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)) {
10428
+ addProp(el, name, value, list[i], isDynamic);
10429
+ } else {
10430
+ addAttr(el, name, value, list[i], isDynamic);
10431
+ }
10432
+ } else if (onRE.test(name)) {
10433
+ // v-on
10434
+ name = name.replace(onRE, '');
10435
+ isDynamic = dynamicArgRE.test(name);
10436
+
10437
+ if (isDynamic) {
10438
+ name = name.slice(1, -1);
10439
+ }
10440
+
10441
+ addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
10442
+ } else {
10443
+ // normal directives
10444
+ name = name.replace(dirRE, ''); // parse arg
10445
+
10446
+ var argMatch = name.match(argRE);
10447
+ var arg = argMatch && argMatch[1];
10448
+ isDynamic = false;
10449
+
10450
+ if (arg) {
10451
+ name = name.slice(0, -(arg.length + 1));
10452
+
10453
+ if (dynamicArgRE.test(arg)) {
10454
+ arg = arg.slice(1, -1);
10455
+ isDynamic = true;
10456
+ }
10457
+ }
10458
+
10459
+ addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
10460
+
10461
+ if ("development" !== 'production' && name === 'model') {
10462
+ checkForAliasModel(el, value);
10463
+ }
10464
+ }
10465
+ } else {
10466
+ // literal attribute
10467
+ if ("development" !== 'production') {
10468
+ var res = parseText(value, delimiters);
10469
+
10470
+ if (res) {
10471
+ warn$2(name + "=\"" + value + "\": " + 'Interpolation inside attributes has been removed. ' + 'Use v-bind or the colon shorthand instead. For example, ' + 'instead of <div id="{{ val }}">, use <div :id="val">.', list[i]);
10472
+ }
10473
+ }
10474
+
10475
+ addAttr(el, name, JSON.stringify(value), list[i]); // #6887 firefox doesn't update muted state if set via attribute
10476
+ // even immediately after element creation
10477
+
10478
+ if (!el.component && name === 'muted' && platformMustUseProp(el.tag, el.attrsMap.type, name)) {
10479
+ addProp(el, name, 'true', list[i]);
10480
+ }
10481
+ }
10482
+ }
10483
+ }
10484
+
10485
+ function checkInFor(el) {
10486
+ var parent = el;
10487
+
10488
+ while (parent) {
10489
+ if (parent.for !== undefined) {
10490
+ return true;
10491
+ }
10492
+
10493
+ parent = parent.parent;
10494
+ }
10495
+
10496
+ return false;
10497
+ }
10498
+
10499
+ function parseModifiers(name) {
10500
+ var match = name.match(modifierRE);
10501
+
10502
+ if (match) {
10503
+ var ret = {};
10504
+ match.forEach(function (m) {
10505
+ ret[m.slice(1)] = true;
10506
+ });
10507
+ return ret;
10508
+ }
10509
+ }
10510
+
10511
+ function makeAttrsMap(attrs) {
10512
+ var map = {};
10513
+
10514
+ for (var i = 0, l = attrs.length; i < l; i++) {
10515
+ if ("development" !== 'production' && map[attrs[i].name] && !isIE && !isEdge) {
10516
+ warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
10517
+ }
10518
+
10519
+ map[attrs[i].name] = attrs[i].value;
10520
+ }
10521
+
10522
+ return map;
10523
+ } // for script (e.g. type="x/template") or style, do not decode content
10524
+
10525
+
10526
+ function isTextTag(el) {
10527
+ return el.tag === 'script' || el.tag === 'style';
10528
+ }
10529
+
10530
+ function isForbiddenTag(el) {
10531
+ return el.tag === 'style' || el.tag === 'script' && (!el.attrsMap.type || el.attrsMap.type === 'text/javascript');
10532
+ }
10533
+
10534
+ var ieNSBug = /^xmlns:NS\d+/;
10535
+ var ieNSPrefix = /^NS\d+:/;
10536
+ /* istanbul ignore next */
10537
+
10538
+ function guardIESVGBug(attrs) {
10539
+ var res = [];
10540
+
10541
+ for (var i = 0; i < attrs.length; i++) {
10542
+ var attr = attrs[i];
10543
+
10544
+ if (!ieNSBug.test(attr.name)) {
10545
+ attr.name = attr.name.replace(ieNSPrefix, '');
10546
+ res.push(attr);
10547
+ }
10548
+ }
10549
+
10550
+ return res;
10551
+ }
10552
+
10553
+ function checkForAliasModel(el, value) {
10554
+ var _el = el;
10555
+
10556
+ while (_el) {
10557
+ if (_el.for && _el.alias === value) {
10558
+ warn$2("<" + el.tag + " v-model=\"" + value + "\">: " + "You are binding v-model directly to a v-for iteration alias. " + "This will not be able to modify the v-for source array because " + "writing to the alias is like modifying a function local variable. " + "Consider using an array of objects and use v-model on an object property instead.", el.rawAttrsMap['v-model']);
10559
+ }
10560
+
10561
+ _el = _el.parent;
10562
+ }
10563
+ }
10564
+ /* */
10565
+
10566
+
10567
+ function preTransformNode(el, options) {
10568
+ if (el.tag === 'input') {
10569
+ var map = el.attrsMap;
10570
+
10571
+ if (!map['v-model']) {
10572
+ return;
10573
+ }
10574
+
10575
+ var typeBinding;
10576
+
10577
+ if (map[':type'] || map['v-bind:type']) {
10578
+ typeBinding = getBindingAttr(el, 'type');
10579
+ }
10580
+
10581
+ if (!map.type && !typeBinding && map['v-bind']) {
10582
+ typeBinding = "(" + map['v-bind'] + ").type";
10583
+ }
10584
+
10585
+ if (typeBinding) {
10586
+ var ifCondition = getAndRemoveAttr(el, 'v-if', true);
10587
+ var ifConditionExtra = ifCondition ? "&&(" + ifCondition + ")" : "";
10588
+ var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
10589
+ var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true); // 1. checkbox
10590
+
10591
+ var branch0 = cloneASTElement(el); // process for on the main node
10592
+
10593
+ processFor(branch0);
10594
+ addRawAttr(branch0, 'type', 'checkbox');
10595
+ processElement(branch0, options);
10596
+ branch0.processed = true; // prevent it from double-processed
10597
+
10598
+ branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
10599
+ addIfCondition(branch0, {
10600
+ exp: branch0.if,
10601
+ block: branch0
10602
+ }); // 2. add radio else-if condition
10603
+
10604
+ var branch1 = cloneASTElement(el);
10605
+ getAndRemoveAttr(branch1, 'v-for', true);
10606
+ addRawAttr(branch1, 'type', 'radio');
10607
+ processElement(branch1, options);
10608
+ addIfCondition(branch0, {
10609
+ exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
10610
+ block: branch1
10611
+ }); // 3. other
10612
+
10613
+ var branch2 = cloneASTElement(el);
10614
+ getAndRemoveAttr(branch2, 'v-for', true);
10615
+ addRawAttr(branch2, ':type', typeBinding);
10616
+ processElement(branch2, options);
10617
+ addIfCondition(branch0, {
10618
+ exp: ifCondition,
10619
+ block: branch2
10620
+ });
10621
+
10622
+ if (hasElse) {
10623
+ branch0.else = true;
10624
+ } else if (elseIfCondition) {
10625
+ branch0.elseif = elseIfCondition;
10626
+ }
10627
+
10628
+ return branch0;
10629
+ }
10630
+ }
10631
+ }
10632
+
10633
+ function cloneASTElement(el) {
10634
+ return createASTElement(el.tag, el.attrsList.slice(), el.parent);
10635
+ }
10636
+
10637
+ var model$1 = {
10638
+ preTransformNode: preTransformNode
10639
+ };
10640
+ var modules$1 = [klass$1, style$1, model$1];
10641
+ /* */
10642
+
10643
+ function text(el, dir) {
10644
+ if (dir.value) {
10645
+ addProp(el, 'textContent', "_s(" + dir.value + ")", dir);
10646
+ }
10647
+ }
10648
+ /* */
10649
+
10650
+
10651
+ function html(el, dir) {
10652
+ if (dir.value) {
10653
+ addProp(el, 'innerHTML', "_s(" + dir.value + ")", dir);
10654
+ }
10655
+ }
10656
+
10657
+ var directives$1 = {
10658
+ model: model,
10659
+ text: text,
10660
+ html: html
10661
+ };
10662
+ /* */
10663
+
10664
+ var baseOptions = {
10665
+ expectHTML: true,
10666
+ modules: modules$1,
10667
+ directives: directives$1,
10668
+ isPreTag: isPreTag,
10669
+ isUnaryTag: isUnaryTag,
10670
+ mustUseProp: mustUseProp,
10671
+ canBeLeftOpenTag: canBeLeftOpenTag,
10672
+ isReservedTag: isReservedTag,
10673
+ getTagNamespace: getTagNamespace,
10674
+ staticKeys: genStaticKeys(modules$1)
10675
+ };
10676
+ /* */
10677
+
10678
+ var isStaticKey;
10679
+ var isPlatformReservedTag;
10680
+ var genStaticKeysCached = cached(genStaticKeys$1);
10681
+ /**
10682
+ * Goal of the optimizer: walk the generated template AST tree
10683
+ * and detect sub-trees that are purely static, i.e. parts of
10684
+ * the DOM that never needs to change.
10685
+ *
10686
+ * Once we detect these sub-trees, we can:
10687
+ *
10688
+ * 1. Hoist them into constants, so that we no longer need to
10689
+ * create fresh nodes for them on each re-render;
10690
+ * 2. Completely skip them in the patching process.
10691
+ */
10692
+
10693
+ function optimize(root, options) {
10694
+ if (!root) {
10695
+ return;
10696
+ }
10697
+
10698
+ isStaticKey = genStaticKeysCached(options.staticKeys || '');
10699
+ isPlatformReservedTag = options.isReservedTag || no; // first pass: mark all non-static nodes.
10700
+
10701
+ markStatic$1(root); // second pass: mark static roots.
10702
+
10703
+ markStaticRoots(root, false);
10704
+ }
10705
+
10706
+ function genStaticKeys$1(keys) {
10707
+ return makeMap('type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' + (keys ? ',' + keys : ''));
10708
+ }
10709
+
10710
+ function markStatic$1(node) {
10711
+ node.static = isStatic(node);
10712
+
10713
+ if (node.type === 1) {
10714
+ // do not make component slot content static. this avoids
10715
+ // 1. components not able to mutate slot nodes
10716
+ // 2. static slot content fails for hot-reloading
10717
+ if (!isPlatformReservedTag(node.tag) && node.tag !== 'slot' && node.attrsMap['inline-template'] == null) {
10718
+ return;
10719
+ }
10720
+
10721
+ for (var i = 0, l = node.children.length; i < l; i++) {
10722
+ var child = node.children[i];
10723
+ markStatic$1(child);
10724
+
10725
+ if (!child.static) {
10726
+ node.static = false;
10727
+ }
10728
+ }
10729
+
10730
+ if (node.ifConditions) {
10731
+ for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
10732
+ var block = node.ifConditions[i$1].block;
10733
+ markStatic$1(block);
10734
+
10735
+ if (!block.static) {
10736
+ node.static = false;
10737
+ }
10738
+ }
10739
+ }
10740
+ }
10741
+ }
10742
+
10743
+ function markStaticRoots(node, isInFor) {
10744
+ if (node.type === 1) {
10745
+ if (node.static || node.once) {
10746
+ node.staticInFor = isInFor;
10747
+ } // For a node to qualify as a static root, it should have children that
10748
+ // are not just static text. Otherwise the cost of hoisting out will
10749
+ // outweigh the benefits and it's better off to just always render it fresh.
10750
+
10751
+
10752
+ if (node.static && node.children.length && !(node.children.length === 1 && node.children[0].type === 3)) {
10753
+ node.staticRoot = true;
10754
+ return;
10755
+ } else {
10756
+ node.staticRoot = false;
10757
+ }
10758
+
10759
+ if (node.children) {
10760
+ for (var i = 0, l = node.children.length; i < l; i++) {
10761
+ markStaticRoots(node.children[i], isInFor || !!node.for);
10762
+ }
10763
+ }
10764
+
10765
+ if (node.ifConditions) {
10766
+ for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
10767
+ markStaticRoots(node.ifConditions[i$1].block, isInFor);
10768
+ }
10769
+ }
10770
+ }
10771
+ }
10772
+
10773
+ function isStatic(node) {
10774
+ if (node.type === 2) {
10775
+ // expression
10776
+ return false;
10777
+ }
10778
+
10779
+ if (node.type === 3) {
10780
+ // text
10781
+ return true;
10782
+ }
10783
+
10784
+ return !!(node.pre || !node.hasBindings && // no dynamic bindings
10785
+ !node.if && !node.for && // not v-if or v-for or v-else
10786
+ !isBuiltInTag(node.tag) && // not a built-in
10787
+ isPlatformReservedTag(node.tag) && // not a component
10788
+ !isDirectChildOfTemplateFor(node) && Object.keys(node).every(isStaticKey));
10789
+ }
10790
+
10791
+ function isDirectChildOfTemplateFor(node) {
10792
+ while (node.parent) {
10793
+ node = node.parent;
10794
+
10795
+ if (node.tag !== 'template') {
10796
+ return false;
10797
+ }
10798
+
10799
+ if (node.for) {
10800
+ return true;
10801
+ }
10802
+ }
10803
+
10804
+ return false;
10805
+ }
10806
+ /* */
10807
+
10808
+
10809
+ var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
10810
+ var fnInvokeRE = /\([^)]*?\);*$/;
10811
+ var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/; // KeyboardEvent.keyCode aliases
10812
+
10813
+ var keyCodes = {
10814
+ esc: 27,
10815
+ tab: 9,
10816
+ enter: 13,
10817
+ space: 32,
10818
+ up: 38,
10819
+ left: 37,
10820
+ right: 39,
10821
+ down: 40,
10822
+ 'delete': [8, 46]
10823
+ }; // KeyboardEvent.key aliases
10824
+
10825
+ var keyNames = {
10826
+ // #7880: IE11 and Edge use `Esc` for Escape key name.
10827
+ esc: ['Esc', 'Escape'],
10828
+ tab: 'Tab',
10829
+ enter: 'Enter',
10830
+ // #9112: IE11 uses `Spacebar` for Space key name.
10831
+ space: [' ', 'Spacebar'],
10832
+ // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
10833
+ up: ['Up', 'ArrowUp'],
10834
+ left: ['Left', 'ArrowLeft'],
10835
+ right: ['Right', 'ArrowRight'],
10836
+ down: ['Down', 'ArrowDown'],
10837
+ // #9112: IE11 uses `Del` for Delete key name.
10838
+ 'delete': ['Backspace', 'Delete', 'Del']
10839
+ }; // #4868: modifiers that prevent the execution of the listener
10840
+ // need to explicitly return null so that we can determine whether to remove
10841
+ // the listener for .once
10842
+
10843
+ var genGuard = function (condition) {
10844
+ return "if(" + condition + ")return null;";
10845
+ };
10846
+
10847
+ var modifierCode = {
10848
+ stop: '$event.stopPropagation();',
10849
+ prevent: '$event.preventDefault();',
10850
+ self: genGuard("$event.target !== $event.currentTarget"),
10851
+ ctrl: genGuard("!$event.ctrlKey"),
10852
+ shift: genGuard("!$event.shiftKey"),
10853
+ alt: genGuard("!$event.altKey"),
10854
+ meta: genGuard("!$event.metaKey"),
10855
+ left: genGuard("'button' in $event && $event.button !== 0"),
10856
+ middle: genGuard("'button' in $event && $event.button !== 1"),
10857
+ right: genGuard("'button' in $event && $event.button !== 2")
10858
+ };
10859
+
10860
+ function genHandlers(events, isNative) {
10861
+ var prefix = isNative ? 'nativeOn:' : 'on:';
10862
+ var staticHandlers = "";
10863
+ var dynamicHandlers = "";
10864
+
10865
+ for (var name in events) {
10866
+ var handlerCode = genHandler(events[name]);
10867
+
10868
+ if (events[name] && events[name].dynamic) {
10869
+ dynamicHandlers += name + "," + handlerCode + ",";
10870
+ } else {
10871
+ staticHandlers += "\"" + name + "\":" + handlerCode + ",";
10872
+ }
10873
+ }
10874
+
10875
+ staticHandlers = "{" + staticHandlers.slice(0, -1) + "}";
10876
+
10877
+ if (dynamicHandlers) {
10878
+ return prefix + "_d(" + staticHandlers + ",[" + dynamicHandlers.slice(0, -1) + "])";
10879
+ } else {
10880
+ return prefix + staticHandlers;
10881
+ }
10882
+ }
10883
+
10884
+ function genHandler(handler) {
10885
+ if (!handler) {
10886
+ return 'function(){}';
10887
+ }
10888
+
10889
+ if (Array.isArray(handler)) {
10890
+ return "[" + handler.map(function (handler) {
10891
+ return genHandler(handler);
10892
+ }).join(',') + "]";
10893
+ }
10894
+
10895
+ var isMethodPath = simplePathRE.test(handler.value);
10896
+ var isFunctionExpression = fnExpRE.test(handler.value);
10897
+ var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
10898
+
10899
+ if (!handler.modifiers) {
10900
+ if (isMethodPath || isFunctionExpression) {
10901
+ return handler.value;
10902
+ }
10903
+
10904
+ return "function($event){" + (isFunctionInvocation ? "return " + handler.value : handler.value) + "}"; // inline statement
10905
+ } else {
10906
+ var code = '';
10907
+ var genModifierCode = '';
10908
+ var keys = [];
10909
+
10910
+ for (var key in handler.modifiers) {
10911
+ if (modifierCode[key]) {
10912
+ genModifierCode += modifierCode[key]; // left/right
10913
+
10914
+ if (keyCodes[key]) {
10915
+ keys.push(key);
10916
+ }
10917
+ } else if (key === 'exact') {
10918
+ var modifiers = handler.modifiers;
10919
+ genModifierCode += genGuard(['ctrl', 'shift', 'alt', 'meta'].filter(function (keyModifier) {
10920
+ return !modifiers[keyModifier];
10921
+ }).map(function (keyModifier) {
10922
+ return "$event." + keyModifier + "Key";
10923
+ }).join('||'));
10924
+ } else {
10925
+ keys.push(key);
10926
+ }
10927
+ }
10928
+
10929
+ if (keys.length) {
10930
+ code += genKeyFilter(keys);
10931
+ } // Make sure modifiers like prevent and stop get executed after key filtering
10932
+
10933
+
10934
+ if (genModifierCode) {
10935
+ code += genModifierCode;
10936
+ }
10937
+
10938
+ var handlerCode = isMethodPath ? "return " + handler.value + "($event)" : isFunctionExpression ? "return (" + handler.value + ")($event)" : isFunctionInvocation ? "return " + handler.value : handler.value;
10939
+ return "function($event){" + code + handlerCode + "}";
10940
+ }
10941
+ }
10942
+
10943
+ function genKeyFilter(keys) {
10944
+ return (// make sure the key filters only apply to KeyboardEvents
10945
+ // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
10946
+ // key events that do not have keyCode property...
10947
+ "if(!$event.type.indexOf('key')&&" + keys.map(genFilterCode).join('&&') + ")return null;"
10948
+ );
10949
+ }
10950
+
10951
+ function genFilterCode(key) {
10952
+ var keyVal = parseInt(key, 10);
10953
+
10954
+ if (keyVal) {
10955
+ return "$event.keyCode!==" + keyVal;
10956
+ }
10957
+
10958
+ var keyCode = keyCodes[key];
10959
+ var keyName = keyNames[key];
10960
+ return "_k($event.keyCode," + JSON.stringify(key) + "," + JSON.stringify(keyCode) + "," + "$event.key," + "" + JSON.stringify(keyName) + ")";
10961
+ }
10962
+ /* */
10963
+
10964
+
10965
+ function on(el, dir) {
10966
+ if ("development" !== 'production' && dir.modifiers) {
10967
+ warn("v-on without argument does not support modifiers.");
10968
+ }
10969
+
10970
+ el.wrapListeners = function (code) {
10971
+ return "_g(" + code + "," + dir.value + ")";
10972
+ };
10973
+ }
10974
+ /* */
10975
+
10976
+
10977
+ function bind$1(el, dir) {
10978
+ el.wrapData = function (code) {
10979
+ return "_b(" + code + ",'" + el.tag + "'," + dir.value + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")";
10980
+ };
10981
+ }
10982
+ /* */
10983
+
10984
+
10985
+ var baseDirectives = {
10986
+ on: on,
10987
+ bind: bind$1,
10988
+ cloak: noop
10989
+ };
10990
+ /* */
10991
+
10992
+ var CodegenState = function CodegenState(options) {
10993
+ this.options = options;
10994
+ this.warn = options.warn || baseWarn;
10995
+ this.transforms = pluckModuleFunction(options.modules, 'transformCode');
10996
+ this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
10997
+ this.directives = extend(extend({}, baseDirectives), options.directives);
10998
+ var isReservedTag = options.isReservedTag || no;
10999
+
11000
+ this.maybeComponent = function (el) {
11001
+ return !!el.component || !isReservedTag(el.tag);
11002
+ };
11003
+
11004
+ this.onceId = 0;
11005
+ this.staticRenderFns = [];
11006
+ this.pre = false;
11007
+ };
11008
+
11009
+ function generate(ast, options) {
11010
+ var state = new CodegenState(options);
11011
+ var code = ast ? genElement(ast, state) : '_c("div")';
11012
+ return {
11013
+ render: "with(this){return " + code + "}",
11014
+ staticRenderFns: state.staticRenderFns
11015
+ };
11016
+ }
11017
+
11018
+ function genElement(el, state) {
11019
+ if (el.parent) {
11020
+ el.pre = el.pre || el.parent.pre;
11021
+ }
11022
+
11023
+ if (el.staticRoot && !el.staticProcessed) {
11024
+ return genStatic(el, state);
11025
+ } else if (el.once && !el.onceProcessed) {
11026
+ return genOnce(el, state);
11027
+ } else if (el.for && !el.forProcessed) {
11028
+ return genFor(el, state);
11029
+ } else if (el.if && !el.ifProcessed) {
11030
+ return genIf(el, state);
11031
+ } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
11032
+ return genChildren(el, state) || 'void 0';
11033
+ } else if (el.tag === 'slot') {
11034
+ return genSlot(el, state);
11035
+ } else {
11036
+ // component or element
11037
+ var code;
11038
+
11039
+ if (el.component) {
11040
+ code = genComponent(el.component, el, state);
11041
+ } else {
11042
+ var data;
11043
+
11044
+ if (!el.plain || el.pre && state.maybeComponent(el)) {
11045
+ data = genData$2(el, state);
11046
+ }
11047
+
11048
+ var children = el.inlineTemplate ? null : genChildren(el, state, true);
11049
+ code = "_c('" + el.tag + "'" + (data ? "," + data : '') + (children ? "," + children : '') + ")";
11050
+ } // module transforms
11051
+
11052
+
11053
+ for (var i = 0; i < state.transforms.length; i++) {
11054
+ code = state.transforms[i](el, code);
11055
+ }
11056
+
11057
+ return code;
11058
+ }
11059
+ } // hoist static sub-trees out
11060
+
11061
+
11062
+ function genStatic(el, state) {
11063
+ el.staticProcessed = true; // Some elements (templates) need to behave differently inside of a v-pre
11064
+ // node. All pre nodes are static roots, so we can use this as a location to
11065
+ // wrap a state change and reset it upon exiting the pre node.
11066
+
11067
+ var originalPreState = state.pre;
11068
+
11069
+ if (el.pre) {
11070
+ state.pre = el.pre;
11071
+ }
11072
+
11073
+ state.staticRenderFns.push("with(this){return " + genElement(el, state) + "}");
11074
+ state.pre = originalPreState;
11075
+ return "_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")";
11076
+ } // v-once
11077
+
11078
+
11079
+ function genOnce(el, state) {
11080
+ el.onceProcessed = true;
11081
+
11082
+ if (el.if && !el.ifProcessed) {
11083
+ return genIf(el, state);
11084
+ } else if (el.staticInFor) {
11085
+ var key = '';
11086
+ var parent = el.parent;
11087
+
11088
+ while (parent) {
11089
+ if (parent.for) {
11090
+ key = parent.key;
11091
+ break;
11092
+ }
11093
+
11094
+ parent = parent.parent;
11095
+ }
11096
+
11097
+ if (!key) {
11098
+ "development" !== 'production' && state.warn("v-once can only be used inside v-for that is keyed. ", el.rawAttrsMap['v-once']);
11099
+ return genElement(el, state);
11100
+ }
11101
+
11102
+ return "_o(" + genElement(el, state) + "," + state.onceId++ + "," + key + ")";
11103
+ } else {
11104
+ return genStatic(el, state);
11105
+ }
11106
+ }
11107
+
11108
+ function genIf(el, state, altGen, altEmpty) {
11109
+ el.ifProcessed = true; // avoid recursion
11110
+
11111
+ return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty);
11112
+ }
11113
+
11114
+ function genIfConditions(conditions, state, altGen, altEmpty) {
11115
+ if (!conditions.length) {
11116
+ return altEmpty || '_e()';
11117
+ }
11118
+
11119
+ var condition = conditions.shift();
11120
+
11121
+ if (condition.exp) {
11122
+ return "(" + condition.exp + ")?" + genTernaryExp(condition.block) + ":" + genIfConditions(conditions, state, altGen, altEmpty);
11123
+ } else {
11124
+ return "" + genTernaryExp(condition.block);
11125
+ } // v-if with v-once should generate code like (a)?_m(0):_m(1)
11126
+
11127
+
11128
+ function genTernaryExp(el) {
11129
+ return altGen ? altGen(el, state) : el.once ? genOnce(el, state) : genElement(el, state);
11130
+ }
11131
+ }
11132
+
11133
+ function genFor(el, state, altGen, altHelper) {
11134
+ var exp = el.for;
11135
+ var alias = el.alias;
11136
+ var iterator1 = el.iterator1 ? "," + el.iterator1 : '';
11137
+ var iterator2 = el.iterator2 ? "," + el.iterator2 : '';
11138
+
11139
+ if ("development" !== 'production' && state.maybeComponent(el) && el.tag !== 'slot' && el.tag !== 'template' && !el.key) {
11140
+ state.warn("<" + el.tag + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " + "v-for should have explicit keys. " + "See https://vuejs.org/guide/list.html#key for more info.", el.rawAttrsMap['v-for'], true
11141
+ /* tip */
11142
+ );
11143
+ }
11144
+
11145
+ el.forProcessed = true; // avoid recursion
11146
+
11147
+ return (altHelper || '_l') + "((" + exp + ")," + "function(" + alias + iterator1 + iterator2 + "){" + "return " + (altGen || genElement)(el, state) + '})';
11148
+ }
11149
+
11150
+ function genData$2(el, state) {
11151
+ var data = '{'; // directives first.
11152
+ // directives may mutate the el's other properties before they are generated.
11153
+
11154
+ var dirs = genDirectives(el, state);
11155
+
11156
+ if (dirs) {
11157
+ data += dirs + ',';
11158
+ } // key
11159
+
11160
+
11161
+ if (el.key) {
11162
+ data += "key:" + el.key + ",";
11163
+ } // ref
11164
+
11165
+
11166
+ if (el.ref) {
11167
+ data += "ref:" + el.ref + ",";
11168
+ }
11169
+
11170
+ if (el.refInFor) {
11171
+ data += "refInFor:true,";
11172
+ } // pre
11173
+
11174
+
11175
+ if (el.pre) {
11176
+ data += "pre:true,";
11177
+ } // record original tag name for components using "is" attribute
11178
+
11179
+
11180
+ if (el.component) {
11181
+ data += "tag:\"" + el.tag + "\",";
11182
+ } // module data generation functions
11183
+
11184
+
11185
+ for (var i = 0; i < state.dataGenFns.length; i++) {
11186
+ data += state.dataGenFns[i](el);
11187
+ } // attributes
11188
+
11189
+
11190
+ if (el.attrs) {
11191
+ data += "attrs:" + genProps(el.attrs) + ",";
11192
+ } // DOM props
11193
+
11194
+
11195
+ if (el.props) {
11196
+ data += "domProps:" + genProps(el.props) + ",";
11197
+ } // event handlers
11198
+
11199
+
11200
+ if (el.events) {
11201
+ data += genHandlers(el.events, false) + ",";
11202
+ }
11203
+
11204
+ if (el.nativeEvents) {
11205
+ data += genHandlers(el.nativeEvents, true) + ",";
11206
+ } // slot target
11207
+ // only for non-scoped slots
11208
+
11209
+
11210
+ if (el.slotTarget && !el.slotScope) {
11211
+ data += "slot:" + el.slotTarget + ",";
11212
+ } // scoped slots
11213
+
11214
+
11215
+ if (el.scopedSlots) {
11216
+ data += genScopedSlots(el, el.scopedSlots, state) + ",";
11217
+ } // component v-model
11218
+
11219
+
11220
+ if (el.model) {
11221
+ data += "model:{value:" + el.model.value + ",callback:" + el.model.callback + ",expression:" + el.model.expression + "},";
11222
+ } // inline-template
11223
+
11224
+
11225
+ if (el.inlineTemplate) {
11226
+ var inlineTemplate = genInlineTemplate(el, state);
11227
+
11228
+ if (inlineTemplate) {
11229
+ data += inlineTemplate + ",";
11230
+ }
11231
+ }
11232
+
11233
+ data = data.replace(/,$/, '') + '}'; // v-bind dynamic argument wrap
11234
+ // v-bind with dynamic arguments must be applied using the same v-bind object
11235
+ // merge helper so that class/style/mustUseProp attrs are handled correctly.
11236
+
11237
+ if (el.dynamicAttrs) {
11238
+ data = "_b(" + data + ",\"" + el.tag + "\"," + genProps(el.dynamicAttrs) + ")";
11239
+ } // v-bind data wrap
11240
+
11241
+
11242
+ if (el.wrapData) {
11243
+ data = el.wrapData(data);
11244
+ } // v-on data wrap
11245
+
11246
+
11247
+ if (el.wrapListeners) {
11248
+ data = el.wrapListeners(data);
11249
+ }
11250
+
11251
+ return data;
11252
+ }
11253
+
11254
+ function genDirectives(el, state) {
11255
+ var dirs = el.directives;
11256
+
11257
+ if (!dirs) {
11258
+ return;
11259
+ }
11260
+
11261
+ var res = 'directives:[';
11262
+ var hasRuntime = false;
11263
+ var i, l, dir, needRuntime;
11264
+
11265
+ for (i = 0, l = dirs.length; i < l; i++) {
11266
+ dir = dirs[i];
11267
+ needRuntime = true;
11268
+ var gen = state.directives[dir.name];
11269
+
11270
+ if (gen) {
11271
+ // compile-time directive that manipulates AST.
11272
+ // returns true if it also needs a runtime counterpart.
11273
+ needRuntime = !!gen(el, dir, state.warn);
11274
+ }
11275
+
11276
+ if (needRuntime) {
11277
+ hasRuntime = true;
11278
+ res += "{name:\"" + dir.name + "\",rawName:\"" + dir.rawName + "\"" + (dir.value ? ",value:(" + dir.value + "),expression:" + JSON.stringify(dir.value) : '') + (dir.arg ? ",arg:" + (dir.isDynamicArg ? dir.arg : "\"" + dir.arg + "\"") : '') + (dir.modifiers ? ",modifiers:" + JSON.stringify(dir.modifiers) : '') + "},";
11279
+ }
11280
+ }
11281
+
11282
+ if (hasRuntime) {
11283
+ return res.slice(0, -1) + ']';
11284
+ }
11285
+ }
11286
+
11287
+ function genInlineTemplate(el, state) {
11288
+ var ast = el.children[0];
11289
+
11290
+ if ("development" !== 'production' && (el.children.length !== 1 || ast.type !== 1)) {
11291
+ state.warn('Inline-template components must have exactly one child element.', {
11292
+ start: el.start
11293
+ });
11294
+ }
11295
+
11296
+ if (ast && ast.type === 1) {
11297
+ var inlineRenderFns = generate(ast, state.options);
11298
+ return "inlineTemplate:{render:function(){" + inlineRenderFns.render + "},staticRenderFns:[" + inlineRenderFns.staticRenderFns.map(function (code) {
11299
+ return "function(){" + code + "}";
11300
+ }).join(',') + "]}";
11301
+ }
11302
+ }
11303
+
11304
+ function genScopedSlots(el, slots, state) {
11305
+ // by default scoped slots are considered "stable", this allows child
11306
+ // components with only scoped slots to skip forced updates from parent.
11307
+ // but in some cases we have to bail-out of this optimization
11308
+ // for example if the slot contains dynamic names, has v-if or v-for on them...
11309
+ var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
11310
+ var slot = slots[key];
11311
+ return slot.slotTargetDynamic || slot.if || slot.for || containsSlotChild(slot) // is passing down slot from parent which may be dynamic
11312
+ ;
11313
+ }); // #9534: if a component with scoped slots is inside a conditional branch,
11314
+ // it's possible for the same component to be reused but with different
11315
+ // compiled slot content. To avoid that, we generate a unique key based on
11316
+ // the generated code of all the slot contents.
11317
+
11318
+ var needsKey = !!el.if; // OR when it is inside another scoped slot or v-for (the reactivity may be
11319
+ // disconnected due to the intermediate scope variable)
11320
+ // #9438, #9506
11321
+ // TODO: this can be further optimized by properly analyzing in-scope bindings
11322
+ // and skip force updating ones that do not actually use scope variables.
11323
+
11324
+ if (!needsForceUpdate) {
11325
+ var parent = el.parent;
11326
+
11327
+ while (parent) {
11328
+ if (parent.slotScope && parent.slotScope !== emptySlotScopeToken || parent.for) {
11329
+ needsForceUpdate = true;
11330
+ break;
11331
+ }
11332
+
11333
+ if (parent.if) {
11334
+ needsKey = true;
11335
+ }
11336
+
11337
+ parent = parent.parent;
11338
+ }
11339
+ }
11340
+
11341
+ var generatedSlots = Object.keys(slots).map(function (key) {
11342
+ return genScopedSlot(slots[key], state);
11343
+ }).join(',');
11344
+ return "scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? ",null,false," + hash(generatedSlots) : "") + ")";
11345
+ }
11346
+
11347
+ function hash(str) {
11348
+ var hash = 5381;
11349
+ var i = str.length;
11350
+
11351
+ while (i) {
11352
+ hash = hash * 33 ^ str.charCodeAt(--i);
11353
+ }
11354
+
11355
+ return hash >>> 0;
11356
+ }
11357
+
11358
+ function containsSlotChild(el) {
11359
+ if (el.type === 1) {
11360
+ if (el.tag === 'slot') {
11361
+ return true;
11362
+ }
11363
+
11364
+ return el.children.some(containsSlotChild);
11365
+ }
11366
+
11367
+ return false;
11368
+ }
11369
+
11370
+ function genScopedSlot(el, state) {
11371
+ var isLegacySyntax = el.attrsMap['slot-scope'];
11372
+
11373
+ if (el.if && !el.ifProcessed && !isLegacySyntax) {
11374
+ return genIf(el, state, genScopedSlot, "null");
11375
+ }
11376
+
11377
+ if (el.for && !el.forProcessed) {
11378
+ return genFor(el, state, genScopedSlot);
11379
+ }
11380
+
11381
+ var slotScope = el.slotScope === emptySlotScopeToken ? "" : String(el.slotScope);
11382
+ var fn = "function(" + slotScope + "){" + "return " + (el.tag === 'template' ? el.if && isLegacySyntax ? "(" + el.if + ")?" + (genChildren(el, state) || 'undefined') + ":undefined" : genChildren(el, state) || 'undefined' : genElement(el, state)) + "}"; // reverse proxy v-slot without scope on this.$slots
11383
+
11384
+ var reverseProxy = slotScope ? "" : ",proxy:true";
11385
+ return "{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}";
11386
+ }
11387
+
11388
+ function genChildren(el, state, checkSkip, altGenElement, altGenNode) {
11389
+ var children = el.children;
11390
+
11391
+ if (children.length) {
11392
+ var el$1 = children[0]; // optimize single v-for
11393
+
11394
+ if (children.length === 1 && el$1.for && el$1.tag !== 'template' && el$1.tag !== 'slot') {
11395
+ var normalizationType = checkSkip ? state.maybeComponent(el$1) ? ",1" : ",0" : "";
11396
+ return "" + (altGenElement || genElement)(el$1, state) + normalizationType;
11397
+ }
11398
+
11399
+ var normalizationType$1 = checkSkip ? getNormalizationType(children, state.maybeComponent) : 0;
11400
+ var gen = altGenNode || genNode;
11401
+ return "[" + children.map(function (c) {
11402
+ return gen(c, state);
11403
+ }).join(',') + "]" + (normalizationType$1 ? "," + normalizationType$1 : '');
11404
+ }
11405
+ } // determine the normalization needed for the children array.
11406
+ // 0: no normalization needed
11407
+ // 1: simple normalization needed (possible 1-level deep nested array)
11408
+ // 2: full normalization needed
11409
+
11410
+
11411
+ function getNormalizationType(children, maybeComponent) {
11412
+ var res = 0;
11413
+
11414
+ for (var i = 0; i < children.length; i++) {
11415
+ var el = children[i];
11416
+
11417
+ if (el.type !== 1) {
11418
+ continue;
11419
+ }
11420
+
11421
+ if (needsNormalization(el) || el.ifConditions && el.ifConditions.some(function (c) {
11422
+ return needsNormalization(c.block);
11423
+ })) {
11424
+ res = 2;
11425
+ break;
11426
+ }
11427
+
11428
+ if (maybeComponent(el) || el.ifConditions && el.ifConditions.some(function (c) {
11429
+ return maybeComponent(c.block);
11430
+ })) {
11431
+ res = 1;
11432
+ }
11433
+ }
11434
+
11435
+ return res;
11436
+ }
11437
+
11438
+ function needsNormalization(el) {
11439
+ return el.for !== undefined || el.tag === 'template' || el.tag === 'slot';
11440
+ }
11441
+
11442
+ function genNode(node, state) {
11443
+ if (node.type === 1) {
11444
+ return genElement(node, state);
11445
+ } else if (node.type === 3 && node.isComment) {
11446
+ return genComment(node);
11447
+ } else {
11448
+ return genText(node);
11449
+ }
11450
+ }
11451
+
11452
+ function genText(text) {
11453
+ return "_v(" + (text.type === 2 ? text.expression // no need for () because already wrapped in _s()
11454
+ : transformSpecialNewlines(JSON.stringify(text.text))) + ")";
11455
+ }
11456
+
11457
+ function genComment(comment) {
11458
+ return "_e(" + JSON.stringify(comment.text) + ")";
11459
+ }
11460
+
11461
+ function genSlot(el, state) {
11462
+ var slotName = el.slotName || '"default"';
11463
+ var children = genChildren(el, state);
11464
+ var res = "_t(" + slotName + (children ? "," + children : '');
11465
+ var attrs = el.attrs || el.dynamicAttrs ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) {
11466
+ return {
11467
+ // slot props are camelized
11468
+ name: camelize(attr.name),
11469
+ value: attr.value,
11470
+ dynamic: attr.dynamic
11471
+ };
11472
+ })) : null;
11473
+ var bind$$1 = el.attrsMap['v-bind'];
11474
+
11475
+ if ((attrs || bind$$1) && !children) {
11476
+ res += ",null";
11477
+ }
11478
+
11479
+ if (attrs) {
11480
+ res += "," + attrs;
11481
+ }
11482
+
11483
+ if (bind$$1) {
11484
+ res += (attrs ? '' : ',null') + "," + bind$$1;
11485
+ }
11486
+
11487
+ return res + ')';
11488
+ } // componentName is el.component, take it as argument to shun flow's pessimistic refinement
11489
+
11490
+
11491
+ function genComponent(componentName, el, state) {
11492
+ var children = el.inlineTemplate ? null : genChildren(el, state, true);
11493
+ return "_c(" + componentName + "," + genData$2(el, state) + (children ? "," + children : '') + ")";
11494
+ }
11495
+
11496
+ function genProps(props) {
11497
+ var staticProps = "";
11498
+ var dynamicProps = "";
11499
+
11500
+ for (var i = 0; i < props.length; i++) {
11501
+ var prop = props[i];
11502
+ var value = transformSpecialNewlines(prop.value);
11503
+
11504
+ if (prop.dynamic) {
11505
+ dynamicProps += prop.name + "," + value + ",";
11506
+ } else {
11507
+ staticProps += "\"" + prop.name + "\":" + value + ",";
11508
+ }
11509
+ }
11510
+
11511
+ staticProps = "{" + staticProps.slice(0, -1) + "}";
11512
+
11513
+ if (dynamicProps) {
11514
+ return "_d(" + staticProps + ",[" + dynamicProps.slice(0, -1) + "])";
11515
+ } else {
11516
+ return staticProps;
11517
+ }
11518
+ } // #3895, #4268
11519
+
11520
+
11521
+ function transformSpecialNewlines(text) {
11522
+ return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
11523
+ }
11524
+ /* */
11525
+ // these keywords should not appear inside expressions, but operators like
11526
+ // typeof, instanceof and in are allowed
11527
+
11528
+
11529
+ var prohibitedKeywordRE = new RegExp('\\b' + ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' + 'super,throw,while,yield,delete,export,import,return,switch,default,' + 'extends,finally,continue,debugger,function,arguments').split(',').join('\\b|\\b') + '\\b'); // these unary operators should not be used as property/method names
11530
+
11531
+ var unaryOperatorsRE = new RegExp('\\b' + 'delete,typeof,void'.split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)'); // strip strings in expressions
11532
+
11533
+ var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; // detect problematic expressions in a template
11534
+
11535
+ function detectErrors(ast, warn) {
11536
+ if (ast) {
11537
+ checkNode(ast, warn);
11538
+ }
11539
+ }
11540
+
11541
+ function checkNode(node, warn) {
11542
+ if (node.type === 1) {
11543
+ for (var name in node.attrsMap) {
11544
+ if (dirRE.test(name)) {
11545
+ var value = node.attrsMap[name];
11546
+
11547
+ if (value) {
11548
+ var range = node.rawAttrsMap[name];
11549
+
11550
+ if (name === 'v-for') {
11551
+ checkFor(node, "v-for=\"" + value + "\"", warn, range);
11552
+ } else if (name === 'v-slot' || name[0] === '#') {
11553
+ checkFunctionParameterExpression(value, name + "=\"" + value + "\"", warn, range);
11554
+ } else if (onRE.test(name)) {
11555
+ checkEvent(value, name + "=\"" + value + "\"", warn, range);
11556
+ } else {
11557
+ checkExpression(value, name + "=\"" + value + "\"", warn, range);
11558
+ }
11559
+ }
11560
+ }
11561
+ }
11562
+
11563
+ if (node.children) {
11564
+ for (var i = 0; i < node.children.length; i++) {
11565
+ checkNode(node.children[i], warn);
11566
+ }
11567
+ }
11568
+ } else if (node.type === 2) {
11569
+ checkExpression(node.expression, node.text, warn, node);
11570
+ }
11571
+ }
11572
+
11573
+ function checkEvent(exp, text, warn, range) {
11574
+ var stripped = exp.replace(stripStringRE, '');
11575
+ var keywordMatch = stripped.match(unaryOperatorsRE);
11576
+
11577
+ if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
11578
+ warn("avoid using JavaScript unary operator as property name: " + "\"" + keywordMatch[0] + "\" in expression " + text.trim(), range);
11579
+ }
11580
+
11581
+ checkExpression(exp, text, warn, range);
11582
+ }
11583
+
11584
+ function checkFor(node, text, warn, range) {
11585
+ checkExpression(node.for || '', text, warn, range);
11586
+ checkIdentifier(node.alias, 'v-for alias', text, warn, range);
11587
+ checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
11588
+ checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
11589
+ }
11590
+
11591
+ function checkIdentifier(ident, type, text, warn, range) {
11592
+ if (typeof ident === 'string') {
11593
+ try {
11594
+ new Function("var " + ident + "=_");
11595
+ } catch (e) {
11596
+ warn("invalid " + type + " \"" + ident + "\" in expression: " + text.trim(), range);
11597
+ }
11598
+ }
11599
+ }
11600
+
11601
+ function checkExpression(exp, text, warn, range) {
11602
+ try {
11603
+ new Function("return " + exp);
11604
+ } catch (e) {
11605
+ var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
11606
+
11607
+ if (keywordMatch) {
11608
+ warn("avoid using JavaScript keyword as property name: " + "\"" + keywordMatch[0] + "\"\n Raw expression: " + text.trim(), range);
11609
+ } else {
11610
+ warn("invalid expression: " + e.message + " in\n\n" + " " + exp + "\n\n" + " Raw expression: " + text.trim() + "\n", range);
11611
+ }
11612
+ }
11613
+ }
11614
+
11615
+ function checkFunctionParameterExpression(exp, text, warn, range) {
11616
+ try {
11617
+ new Function(exp, '');
11618
+ } catch (e) {
11619
+ warn("invalid function parameter expression: " + e.message + " in\n\n" + " " + exp + "\n\n" + " Raw expression: " + text.trim() + "\n", range);
11620
+ }
11621
+ }
11622
+ /* */
11623
+
11624
+
11625
+ var range = 2;
11626
+
11627
+ function generateCodeFrame(source, start, end) {
11628
+ if (start === void 0) start = 0;
11629
+ if (end === void 0) end = source.length;
11630
+ var lines = source.split(/\r?\n/);
11631
+ var count = 0;
11632
+ var res = [];
11633
+
11634
+ for (var i = 0; i < lines.length; i++) {
11635
+ count += lines[i].length + 1;
11636
+
11637
+ if (count >= start) {
11638
+ for (var j = i - range; j <= i + range || end > count; j++) {
11639
+ if (j < 0 || j >= lines.length) {
11640
+ continue;
11641
+ }
11642
+
11643
+ res.push("" + (j + 1) + repeat$1(" ", 3 - String(j + 1).length) + "| " + lines[j]);
11644
+ var lineLength = lines[j].length;
11645
+
11646
+ if (j === i) {
11647
+ // push underline
11648
+ var pad = start - (count - lineLength) + 1;
11649
+ var length = end > count ? lineLength - pad : end - start;
11650
+ res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
11651
+ } else if (j > i) {
11652
+ if (end > count) {
11653
+ var length$1 = Math.min(end - count, lineLength);
11654
+ res.push(" | " + repeat$1("^", length$1));
11655
+ }
11656
+
11657
+ count += lineLength + 1;
11658
+ }
11659
+ }
11660
+
11661
+ break;
11662
+ }
11663
+ }
11664
+
11665
+ return res.join('\n');
11666
+ }
11667
+
11668
+ function repeat$1(str, n) {
11669
+ var result = '';
11670
+
11671
+ if (n > 0) {
11672
+ while (true) {
11673
+ // eslint-disable-line
11674
+ if (n & 1) {
11675
+ result += str;
11676
+ }
11677
+
11678
+ n >>>= 1;
11679
+
11680
+ if (n <= 0) {
11681
+ break;
11682
+ }
11683
+
11684
+ str += str;
11685
+ }
11686
+ }
11687
+
11688
+ return result;
11689
+ }
11690
+ /* */
11691
+
11692
+
11693
+ function createFunction(code, errors) {
11694
+ try {
11695
+ return new Function(code);
11696
+ } catch (err) {
11697
+ errors.push({
11698
+ err: err,
11699
+ code: code
11700
+ });
11701
+ return noop;
11702
+ }
11703
+ }
11704
+
11705
+ function createCompileToFunctionFn(compile) {
11706
+ var cache = Object.create(null);
11707
+ return function compileToFunctions(template, options, vm) {
11708
+ options = extend({}, options);
11709
+ var warn$$1 = options.warn || warn;
11710
+ delete options.warn;
11711
+ /* istanbul ignore if */
11712
+
11713
+ if ("development" !== 'production') {
11714
+ // detect possible CSP restriction
11715
+ try {
11716
+ new Function('return 1');
11717
+ } catch (e) {
11718
+ if (e.toString().match(/unsafe-eval|CSP/)) {
11719
+ warn$$1('It seems you are using the standalone build of Vue.js in an ' + 'environment with Content Security Policy that prohibits unsafe-eval. ' + 'The template compiler cannot work in this environment. Consider ' + 'relaxing the policy to allow unsafe-eval or pre-compiling your ' + 'templates into render functions.');
11720
+ }
11721
+ }
11722
+ } // check cache
11723
+
11724
+
11725
+ var key = options.delimiters ? String(options.delimiters) + template : template;
11726
+
11727
+ if (cache[key]) {
11728
+ return cache[key];
11729
+ } // compile
11730
+
11731
+
11732
+ var compiled = compile(template, options); // check compilation errors/tips
11733
+
11734
+ if ("development" !== 'production') {
11735
+ if (compiled.errors && compiled.errors.length) {
11736
+ if (options.outputSourceRange) {
11737
+ compiled.errors.forEach(function (e) {
11738
+ warn$$1("Error compiling template:\n\n" + e.msg + "\n\n" + generateCodeFrame(template, e.start, e.end), vm);
11739
+ });
11740
+ } else {
11741
+ warn$$1("Error compiling template:\n\n" + template + "\n\n" + compiled.errors.map(function (e) {
11742
+ return "- " + e;
11743
+ }).join('\n') + '\n', vm);
11744
+ }
11745
+ }
11746
+
11747
+ if (compiled.tips && compiled.tips.length) {
11748
+ if (options.outputSourceRange) {
11749
+ compiled.tips.forEach(function (e) {
11750
+ return tip(e.msg, vm);
11751
+ });
11752
+ } else {
11753
+ compiled.tips.forEach(function (msg) {
11754
+ return tip(msg, vm);
11755
+ });
11756
+ }
11757
+ }
11758
+ } // turn code into functions
11759
+
11760
+
11761
+ var res = {};
11762
+ var fnGenErrors = [];
11763
+ res.render = createFunction(compiled.render, fnGenErrors);
11764
+ res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
11765
+ return createFunction(code, fnGenErrors);
11766
+ }); // check function generation errors.
11767
+ // this should only happen if there is a bug in the compiler itself.
11768
+ // mostly for codegen development use
11769
+
11770
+ /* istanbul ignore if */
11771
+
11772
+ if ("development" !== 'production') {
11773
+ if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
11774
+ warn$$1("Failed to generate render function:\n\n" + fnGenErrors.map(function (ref) {
11775
+ var err = ref.err;
11776
+ var code = ref.code;
11777
+ return err.toString() + " in\n\n" + code + "\n";
11778
+ }).join('\n'), vm);
11779
+ }
11780
+ }
11781
+
11782
+ return cache[key] = res;
11783
+ };
11784
+ }
11785
+ /* */
11786
+
11787
+
11788
+ function createCompilerCreator(baseCompile) {
11789
+ return function createCompiler(baseOptions) {
11790
+ function compile(template, options) {
11791
+ var finalOptions = Object.create(baseOptions);
11792
+ var errors = [];
11793
+ var tips = [];
11794
+
11795
+ var warn = function (msg, range, tip) {
11796
+ (tip ? tips : errors).push(msg);
11797
+ };
11798
+
11799
+ if (options) {
11800
+ if ("development" !== 'production' && options.outputSourceRange) {
11801
+ // $flow-disable-line
11802
+ var leadingSpaceLength = template.match(/^\s*/)[0].length;
11803
+
11804
+ warn = function (msg, range, tip) {
11805
+ var data = {
11806
+ msg: msg
11807
+ };
11808
+
11809
+ if (range) {
11810
+ if (range.start != null) {
11811
+ data.start = range.start + leadingSpaceLength;
11812
+ }
11813
+
11814
+ if (range.end != null) {
11815
+ data.end = range.end + leadingSpaceLength;
11816
+ }
11817
+ }
11818
+
11819
+ (tip ? tips : errors).push(data);
11820
+ };
11821
+ } // merge custom modules
11822
+
11823
+
11824
+ if (options.modules) {
11825
+ finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
11826
+ } // merge custom directives
11827
+
11828
+
11829
+ if (options.directives) {
11830
+ finalOptions.directives = extend(Object.create(baseOptions.directives || null), options.directives);
11831
+ } // copy other options
11832
+
11833
+
11834
+ for (var key in options) {
11835
+ if (key !== 'modules' && key !== 'directives') {
11836
+ finalOptions[key] = options[key];
11837
+ }
11838
+ }
11839
+ }
11840
+
11841
+ finalOptions.warn = warn;
11842
+ var compiled = baseCompile(template.trim(), finalOptions);
11843
+
11844
+ if ("development" !== 'production') {
11845
+ detectErrors(compiled.ast, warn);
11846
+ }
11847
+
11848
+ compiled.errors = errors;
11849
+ compiled.tips = tips;
11850
+ return compiled;
11851
+ }
11852
+
11853
+ return {
11854
+ compile: compile,
11855
+ compileToFunctions: createCompileToFunctionFn(compile)
11856
+ };
11857
+ };
11858
+ }
11859
+ /* */
11860
+ // `createCompilerCreator` allows creating compilers that use alternative
11861
+ // parser/optimizer/codegen, e.g the SSR optimizing compiler.
11862
+ // Here we just export a default compiler using the default parts.
11863
+
11864
+
11865
+ var createCompiler = createCompilerCreator(function baseCompile(template, options) {
11866
+ var ast = parse(template.trim(), options);
11867
+
11868
+ if (options.optimize !== false) {
11869
+ optimize(ast, options);
11870
+ }
11871
+
11872
+ var code = generate(ast, options);
11873
+ return {
11874
+ ast: ast,
11875
+ render: code.render,
11876
+ staticRenderFns: code.staticRenderFns
11877
+ };
11878
+ });
11879
+ /* */
11880
+
11881
+ var ref$1 = createCompiler(baseOptions);
11882
+ var compile = ref$1.compile;
11883
+ var compileToFunctions = ref$1.compileToFunctions;
11884
+ /* */
11885
+ // check whether current browser encodes a char inside attribute values
11886
+
11887
+ var div;
11888
+
11889
+ function getShouldDecode(href) {
11890
+ div = div || document.createElement('div');
11891
+ div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
11892
+ return div.innerHTML.indexOf('&#10;') > 0;
11893
+ } // #3663: IE encodes newlines inside attribute values while other browsers don't
11894
+
11895
+
11896
+ var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false; // #6828: chrome encodes content in a[href]
11897
+
11898
+ var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
11899
+ /* */
11900
+
11901
+ var idToTemplate = cached(function (id) {
11902
+ var el = query(id);
11903
+ return el && el.innerHTML;
11904
+ });
11905
+ var mount = Vue.prototype.$mount;
11906
+
11907
+ Vue.prototype.$mount = function (el, hydrating) {
11908
+ el = el && query(el);
11909
+ /* istanbul ignore if */
11910
+
11911
+ if (el === document.body || el === document.documentElement) {
11912
+ "development" !== 'production' && warn("Do not mount Vue to <html> or <body> - mount to normal elements instead.");
11913
+ return this;
11914
+ }
11915
+
11916
+ var options = this.$options; // resolve template/el and convert to render function
11917
+
11918
+ if (!options.render) {
11919
+ var template = options.template;
11920
+
11921
+ if (template) {
11922
+ if (typeof template === 'string') {
11923
+ if (template.charAt(0) === '#') {
11924
+ template = idToTemplate(template);
11925
+ /* istanbul ignore if */
11926
+
11927
+ if ("development" !== 'production' && !template) {
11928
+ warn("Template element not found or is empty: " + options.template, this);
11929
+ }
11930
+ }
11931
+ } else if (template.nodeType) {
11932
+ template = template.innerHTML;
11933
+ } else {
11934
+ if ("development" !== 'production') {
11935
+ warn('invalid template option:' + template, this);
11936
+ }
11937
+
11938
+ return this;
11939
+ }
11940
+ } else if (el) {
11941
+ template = getOuterHTML(el);
11942
+ }
11943
+
11944
+ if (template) {
11945
+ /* istanbul ignore if */
11946
+ if ("development" !== 'production' && config.performance && mark) {
11947
+ mark('compile');
11948
+ }
11949
+
11950
+ var ref = compileToFunctions(template, {
11951
+ outputSourceRange: "development" !== 'production',
11952
+ shouldDecodeNewlines: shouldDecodeNewlines,
11953
+ shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
11954
+ delimiters: options.delimiters,
11955
+ comments: options.comments
11956
+ }, this);
11957
+ var render = ref.render;
11958
+ var staticRenderFns = ref.staticRenderFns;
11959
+ options.render = render;
11960
+ options.staticRenderFns = staticRenderFns;
11961
+ /* istanbul ignore if */
11962
+
11963
+ if ("development" !== 'production' && config.performance && mark) {
11964
+ mark('compile end');
11965
+ measure("vue " + this._name + " compile", 'compile', 'compile end');
11966
+ }
11967
+ }
11968
+ }
11969
+
11970
+ return mount.call(this, el, hydrating);
11971
+ };
11972
+ /**
11973
+ * Get outerHTML of elements, taking care
11974
+ * of SVG elements in IE as well.
11975
+ */
11976
+
11977
+
11978
+ function getOuterHTML(el) {
11979
+ if (el.outerHTML) {
11980
+ return el.outerHTML;
11981
+ } else {
11982
+ var container = document.createElement('div');
11983
+ container.appendChild(el.cloneNode(true));
11984
+ return container.innerHTML;
11985
+ }
11986
+ }
11987
+
11988
+ Vue.compile = compileToFunctions;
11989
+ var _default = Vue;
11990
+ exports.default = _default;
11991
+ },{}],"functions/WPTB_ControlsManager.js":[function(require,module,exports) {
11992
+ "use strict";
11993
+
11994
+ Object.defineProperty(exports, "__esModule", {
11995
+ value: true
11996
+ });
11997
+ exports.default = void 0;
11998
+
11999
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
12000
+
12001
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
12002
+
12003
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12004
+
12005
+ /**
12006
+ * Controls manager for builder element's control options
12007
+ *
12008
+ * It is a singleton class that will always be sending the referenced object to all callers.
12009
+ *
12010
+ * @return {{setControlData: setControlData, getControlData: (function(*): *), addControlScript: addControlScript, callControlScript: callControlScript}}
12011
+ * @class
12012
+ */
12013
+ function ControlsManager() {
12014
+ var controlScripts = {};
12015
+ var controlData = {};
12016
+ var tableSettings = {
12017
+ settings: {}
12018
+ };
12019
+ var subscribers = {};
12020
+ /**
12021
+ * Get current table settings.
12022
+ *
12023
+ * @return {Object} current table settings
12024
+ */
12025
+
12026
+ function getTableSettings() {
12027
+ return tableSettings.settings;
12028
+ }
12029
+ /**
12030
+ * Subscribe to table settings changes
12031
+ *
12032
+ * @param {string} id unique id for subscription
12033
+ * @param {Function} callback callback when an update happens
12034
+ */
12035
+
12036
+
12037
+ function subscribe(id, callback) {
12038
+ subscribers[id] = callback;
12039
+
12040
+ if (typeof callback === 'function') {
12041
+ callback(getTableSettings());
12042
+ }
12043
+ }
12044
+ /**
12045
+ * Call subscribers on update.
12046
+ */
12047
+
12048
+
12049
+ function callSubscribers() {
12050
+ // eslint-disable-next-line array-callback-return
12051
+ Object.keys(subscribers).map(function (s) {
12052
+ if (Object.prototype.hasOwnProperty.call(subscribers, s)) {
12053
+ var callback = subscribers[s];
12054
+
12055
+ if (typeof callback === 'function') {
12056
+ callback(getTableSettings());
12057
+ }
12058
+ }
12059
+ });
12060
+ }
12061
+ /**
12062
+ * Settings changed callback.
12063
+ *
12064
+ * @param {Object} input
12065
+ */
12066
+
12067
+
12068
+ function updateTableSettings(input) {
12069
+ if (input) {
12070
+ tableSettings.settings = _objectSpread(_objectSpread({}, tableSettings.settings), input);
12071
+ callSubscribers();
12072
+ }
12073
+ }
12074
+ /**
12075
+ * Attach to table settings changes.
12076
+ */
12077
+
12078
+
12079
+ function attachToSettingChanges() {
12080
+ document.addEventListener('wptb:table:generated', function () {
12081
+ var table = document.querySelector('.wptb-management_table_container .wptb-table-setup table');
12082
+ WPTB_Helper.controlsInclude(table, function (input) {
12083
+ return updateTableSettings(input);
12084
+ });
12085
+ }, true);
12086
+ }
12087
+ /**
12088
+ * Controls manager init.
12089
+ */
12090
+
12091
+
12092
+ function init() {
12093
+ attachToSettingChanges();
12094
+ }
12095
+ /**
12096
+ * Add a control element script to ControlsManager
12097
+ *
12098
+ * This is the register function for control items. Without registering the control items, you can not mount them from their inline underscore.js template. Keep the underscore.js template as clean as possible since all the work should be handled by the view element and not the business logic of the backend.
12099
+ *
12100
+ * @param {string} key control type key
12101
+ * @param {Function} script function to mount the control to view
12102
+ */
12103
+
12104
+
12105
+ function addControlScript(key, script) {
12106
+ controlScripts[key] = script;
12107
+ }
12108
+ /**
12109
+ * Call a control element and mount it to view
12110
+ *
12111
+ * This is the place where items are mounted on to the view. In the background already defined control logic will be called and mounted to the unique id html element.
12112
+ *
12113
+ * @param {string} key control type key that was registered with addControlScript
12114
+ * @param {any} args arguments to call the script with
12115
+ */
12116
+
12117
+
12118
+ function callControlScript(key, args) {
12119
+ if (!controlScripts[key]) {
12120
+ throw new Error("Called control element not found: [".concat(key, "]"));
12121
+ }
12122
+
12123
+ controlScripts[key](args);
12124
+ }
12125
+ /**
12126
+ * Register data for a control item
12127
+ *
12128
+ * Currently, when control items are defined in background, a data object with a needed data items are mounted with this function.
12129
+ *
12130
+ * @param {string} id control item unique id
12131
+ * @param {Object} data control item data
12132
+ */
12133
+
12134
+
12135
+ function setControlData(id, data) {
12136
+ controlData[id] = data;
12137
+ }
12138
+ /**
12139
+ * Retrieve data for a control item
12140
+ *
12141
+ * Data objects that are registered for specific control items can be fetched with the correct id. With this way, components can reach their data with the correct unique keys.
12142
+ *
12143
+ * @param {string} id control item unique key
12144
+ * @param {boolean} suppress suppress error message upon not founding data
12145
+ * @return {Object} data associated with control item
12146
+ */
12147
+
12148
+
12149
+ function getControlData(id) {
12150
+ var suppress = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12151
+
12152
+ if (!controlData[id] && !suppress) {
12153
+ throw new Error("Control data for [".concat(id, "] not found."));
12154
+ }
12155
+
12156
+ return controlData[id];
12157
+ }
12158
+
12159
+ return {
12160
+ getTableSettings: getTableSettings,
12161
+ init: init,
12162
+ addControlScript: addControlScript,
12163
+ callControlScript: callControlScript,
12164
+ setControlData: setControlData,
12165
+ getControlData: getControlData,
12166
+ subscribe: subscribe
12167
+ };
12168
+ }
12169
+ /**
12170
+ * @module ControlsManager module
12171
+ */
12172
+
12173
+
12174
+ var _default = ControlsManager();
12175
+
12176
+ exports.default = _default;
12177
+ },{}],"components/IntersectionObserver.vue":[function(require,module,exports) {
12178
+ "use strict";
12179
+
12180
+ Object.defineProperty(exports, "__esModule", {
12181
+ value: true
12182
+ });
12183
+ exports.default = void 0;
12184
+ //
12185
+ //
12186
+ //
12187
+ //
12188
+ //
12189
+ var _default = {
12190
+ props: ['relativeElement', 'forceHide'],
12191
+ data: function data() {
12192
+ return {
12193
+ listening: false
12194
+ };
12195
+ },
12196
+ watch: {
12197
+ relativeElement: function relativeElement() {
12198
+ if (this.relativeElement && !this.listening) {
12199
+ this.relativeElement.addEventListener('scroll', this.handleScroll);
12200
+ this.handleScroll();
12201
+ this.listening = true;
12202
+ }
12203
+ }
12204
+ },
12205
+ methods: {
12206
+ handleScroll: function handleScroll() {
12207
+ if (this.forceHide) {
12208
+ return;
12209
+ }
12210
+
12211
+ var scrollAmount = this.relativeElement.scrollTop;
12212
+ var posY = this.$refs.observerElement.offsetTop;
12213
+ var relativeHeight = this.relativeElement.clientHeight;
12214
+
12215
+ if (scrollAmount + relativeHeight >= posY) {
12216
+ this.$emit('visible');
12217
+ }
12218
+ }
12219
+ }
12220
+ };
12221
+ exports.default = _default;
12222
+ var $7aa961 = exports.default || module.exports;
12223
+
12224
+ if (typeof $7aa961 === 'function') {
12225
+ $7aa961 = $7aa961.options;
12226
+ }
12227
+
12228
+ /* template */
12229
+ Object.assign($7aa961, (function () {
12230
+ var render = function() {
12231
+ var _vm = this
12232
+ var _h = _vm.$createElement
12233
+ var _c = _vm._self._c || _h
12234
+ return _c("div", { ref: "observerElement" }, [_vm._t("default")], 2)
12235
+ }
12236
+ var staticRenderFns = []
12237
+ render._withStripped = true
12238
+
12239
+ return {
12240
+ render: render,
12241
+ staticRenderFns: staticRenderFns,
12242
+ _compiled: true,
12243
+ _scopeId: null,
12244
+ functional: undefined
12245
+ };
12246
+ })());
12247
+
12248
+ },{}],"functions/selector.js":[function(require,module,exports) {
12249
+ "use strict";
12250
+
12251
+ Object.defineProperty(exports, "__esModule", {
12252
+ value: true
12253
+ });
12254
+ exports.default = void 0;
12255
+
12256
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12257
+
12258
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12259
+
12260
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12261
+
12262
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12263
+
12264
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
12265
+
12266
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
12267
+
12268
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12269
+
12270
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12271
+
12272
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
12273
+
12274
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12275
+
12276
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12277
+
12278
+ /**
12279
+ * Selector helper functions for element data retrieval.
12280
+ *
12281
+ * One of the advanced functionality of selector module is, it can get/set values with a defined format so only raw values will be get and formatted values can be set. Format replace string is {$}. This operator will be replaced with the raw value of the control element. For example; a format of '{$}px' will be translated to '15px' in a control with a value of 15. When getting that value, 15 will be returned. While setting it, this value will be formatted into '15px'.
12282
+ *
12283
+ * Supported operation types:
12284
+ * dataset
12285
+ * class
12286
+ * style
12287
+ * attribute
12288
+ */
12289
+
12290
+ /**
12291
+ * Select element operation to get/set certain element attributes/properties.
12292
+ *
12293
+ * @param {HTMLElement} element html element
12294
+ * @param {string} type element attribute/property type
12295
+ * @returns {DOMStringMap|(function(): *)| string} suitable operation for supplied arguments
12296
+ */
12297
+ function operationSelect(element, type) {
12298
+ var operation = null;
12299
+
12300
+ switch (type) {
12301
+ case 'dataset':
12302
+ operation = element.dataset;
12303
+ break;
12304
+
12305
+ case 'style':
12306
+ operation = element.style;
12307
+ break;
12308
+
12309
+ case 'class':
12310
+ operation = 'class';
12311
+ break;
12312
+
12313
+ case 'attribute':
12314
+ operation = 'attribute';
12315
+ break;
12316
+
12317
+ default:
12318
+ operation = element.dataset;
12319
+ break;
12320
+ }
12321
+
12322
+ return operation;
12323
+ }
12324
+ /**
12325
+ * Get value of HTMLElement.
12326
+ *
12327
+ * Supported value types: dataset, style, classList
12328
+ *
12329
+ * @param {string} selector query string for element search
12330
+ * @returns {{value: *, elements: *[]}} returns an object of elements and its queried value
12331
+ */
12332
+
12333
+
12334
+ function getTargetValue(selector) {
12335
+ var query = selector.query,
12336
+ type = selector.type,
12337
+ key = selector.key,
12338
+ format = selector.format;
12339
+
12340
+ var elements = _toConsumableArray(document.querySelectorAll(query));
12341
+
12342
+ if (elements.length > 0) {
12343
+ var operation = operationSelect(elements[0], type);
12344
+
12345
+ if (operation) {
12346
+ var value;
12347
+
12348
+ if (operation === 'class') {
12349
+ value = elements[0].getAttribute('class');
12350
+ } else if (operation === 'attribute') {
12351
+ value = elements[0].getAttribute(key);
12352
+ } else {
12353
+ value = operation[key];
12354
+ }
12355
+
12356
+ if (format) {
12357
+ var regExpFormat = format.replace('{$}', '(.+)');
12358
+ var testResult;
12359
+ var regExp = new RegExp("^".concat(regExpFormat, "$"), 'g');
12360
+
12361
+ if (operation === 'class') {
12362
+ value.split(' ').some(function (s) {
12363
+ var result = regExp.exec(s);
12364
+
12365
+ if (result === null) {
12366
+ return false;
12367
+ }
12368
+
12369
+ testResult = result;
12370
+ return true;
12371
+ });
12372
+ } else {
12373
+ testResult = regExp.exec(value);
12374
+ }
12375
+
12376
+ if (testResult) {
12377
+ // eslint-disable-next-line prefer-destructuring
12378
+ value = testResult[1];
12379
+ } else {
12380
+ value = null;
12381
+ }
12382
+ }
12383
+
12384
+ return {
12385
+ elements: elements,
12386
+ value: value,
12387
+ type: type,
12388
+ key: key,
12389
+ format: format
12390
+ };
12391
+ }
12392
+ }
12393
+
12394
+ throw new Error("no related operation found with a type of [".concat(type, "]"));
12395
+ }
12396
+ /**
12397
+ * Set value for an individual selector object.
12398
+ *
12399
+ * @param {object} selector selector object
12400
+ * @param {any} value value to be assigned to selector element
12401
+ */
12402
+
12403
+
12404
+ function setTargetValue(selector, value) {
12405
+ var elements = selector.elements,
12406
+ type = selector.type,
12407
+ key = selector.key,
12408
+ format = selector.format;
12409
+
12410
+ if (Array.isArray(elements) && elements.length > 0) {
12411
+ // eslint-disable-next-line array-callback-return
12412
+ elements.map(function (s) {
12413
+ var operation = operationSelect(s, type); // class type specific operations
12414
+
12415
+ if (operation === 'class') {
12416
+ var currentClass = null;
12417
+ var val; // find if another class with the same format is present
12418
+ // if it is, it will signal us that this class should be removed before our formatted class can be added. this way class toggle operation will be provided with different class names with the same format
12419
+ // eslint-disable-next-line no-restricted-syntax
12420
+
12421
+ var _iterator = _createForOfIteratorHelper(s.classList.entries()),
12422
+ _step;
12423
+
12424
+ try {
12425
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
12426
+ var _step$value = _slicedToArray(_step.value, 2);
12427
+
12428
+ val = _step$value[1];
12429
+ var regExpFormat = format.replace('{$}', '(.+)');
12430
+ var match = val.match("^".concat(regExpFormat, "$"));
12431
+
12432
+ if (match) {
12433
+ var _match = _slicedToArray(match, 2);
12434
+
12435
+ currentClass = _match[1];
12436
+ }
12437
+ }
12438
+ } catch (err) {
12439
+ _iterator.e(err);
12440
+ } finally {
12441
+ _iterator.f();
12442
+ }
12443
+
12444
+ if (currentClass) {
12445
+ var toggleClass = format.replace('{$}', currentClass); // remove any class with the same format for toggle operation
12446
+
12447
+ s.classList.remove(toggleClass);
12448
+ }
12449
+
12450
+ var addClass = format.replace('{$}', value);
12451
+ s.classList.add(addClass);
12452
+ } else {
12453
+ var tempVal = value;
12454
+
12455
+ if (format) {
12456
+ tempVal = format.replace('{$}', value);
12457
+ tempVal = tempVal.replace(new RegExp(/\\/g), '');
12458
+ }
12459
+
12460
+ if (operation === 'attribute') {
12461
+ s.setAttribute(key, tempVal);
12462
+ } else {
12463
+ operation[key] = tempVal;
12464
+ }
12465
+ }
12466
+ });
12467
+ }
12468
+ }
12469
+ /**
12470
+ * Set values of target selectors.
12471
+ *
12472
+ * @param {array} selectors an array of selector objects
12473
+ * @param {any} value value to be assigned to selector elements
12474
+ */
12475
+
12476
+
12477
+ function setAllValues(selectors, value) {
12478
+ // eslint-disable-next-line array-callback-return
12479
+ selectors.map(function (s) {
12480
+ setTargetValue(s, value);
12481
+ });
12482
+ }
12483
+ /**
12484
+ * Get all values from an array of selectors.
12485
+ *
12486
+ * @param {array} selectors an array of selector objects
12487
+ * @returns {{startupValue: null, elements: []}} object with selector values
12488
+ */
12489
+
12490
+
12491
+ function getAllValues(selectors) {
12492
+ var allObj = {
12493
+ elements: [],
12494
+ startupValue: null
12495
+ }; // eslint-disable-next-line array-callback-return
12496
+
12497
+ selectors.map(function (s) {
12498
+ var elementValue = getTargetValue(s);
12499
+ allObj.elements.push(getTargetValue(s));
12500
+
12501
+ if (s.useAsStartup) {
12502
+ allObj.startupValue = elementValue;
12503
+ }
12504
+ }); // if no startup value is defined, use the value of the first element
12505
+
12506
+ if (!allObj.startupValue) {
12507
+ allObj.startupValue = allObj.elements[0].value;
12508
+ }
12509
+
12510
+ return allObj;
12511
+ }
12512
+ /**
12513
+ * @module selector module
12514
+ */
12515
+
12516
+
12517
+ var _default = {
12518
+ getTargetValue: getTargetValue,
12519
+ getAllValues: getAllValues,
12520
+ setTargetValue: setTargetValue,
12521
+ setAllValues: setAllValues
12522
+ };
12523
+ exports.default = _default;
12524
+ },{}],"mixins/ControlBase.js":[function(require,module,exports) {
12525
+ "use strict";
12526
+
12527
+ Object.defineProperty(exports, "__esModule", {
12528
+ value: true
12529
+ });
12530
+ exports.default = void 0;
12531
+
12532
+ var _selector = _interopRequireDefault(require("../functions/selector"));
12533
+
12534
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12535
+
12536
+ /**
12537
+ * Base mixin for control items
12538
+ */
12539
+ var ControlBase = {
12540
+ props: {
12541
+ label: String,
12542
+ selectors: {
12543
+ type: Array,
12544
+ required: false,
12545
+ default: function _default() {
12546
+ return [];
12547
+ }
12548
+ },
12549
+ defaultValue: null,
12550
+ uniqueId: {
12551
+ type: String,
12552
+ required: false,
12553
+ default: ''
12554
+ },
12555
+ elemContainer: {
12556
+ type: String,
12557
+ required: false,
12558
+ default: ''
12559
+ },
12560
+ appearDependOnControl: {
12561
+ type: Object,
12562
+ required: false,
12563
+ default: function _default() {
12564
+ return {};
12565
+ }
12566
+ }
12567
+ },
12568
+ data: function data() {
12569
+ return {
12570
+ startupValue: null,
12571
+ targetElements: [],
12572
+ elementMainValue: '',
12573
+ mountedDataUpdate: false,
12574
+ tableSettings: {
12575
+ settings: {}
12576
+ },
12577
+ componentVisibility: true,
12578
+ cachedDependedValues: {},
12579
+ // change this value to true on expanded component to automatically assign default values at component mounted state
12580
+ assignDefaultValueAtMount: false
12581
+ };
12582
+ },
12583
+ watch: {
12584
+ 'tableSettings.settings': {
12585
+ handler: function handler() {
12586
+ this.updateComponentVisibility();
12587
+ },
12588
+ deep: true
12589
+ },
12590
+ cachedDependedValues: {
12591
+ handler: function handler() {
12592
+ this.calculateComponentVisibility();
12593
+ },
12594
+ deep: true
12595
+ }
12596
+ },
12597
+ mounted: function mounted() {
12598
+ var _this = this;
12599
+
12600
+ // find and retrieve selector elements
12601
+ if (this.selectors.length > 0) {
12602
+ // const operationObj = selectorOperations.getAllValues(this.selectors);
12603
+ // this.targetElements = operationObj.elements;
12604
+ var operationObj = this.getTargetElements();
12605
+ this.startupValue = operationObj.startupValue;
12606
+ }
12607
+
12608
+ this.$nextTick(function () {
12609
+ _this.tableSettings = WPTB_ControlsManager.getTableSettings();
12610
+
12611
+ _this.getInputLoadedValues();
12612
+
12613
+ if (_this.assignDefaultValueAtMount) {
12614
+ _this.assignDefaultValue();
12615
+ }
12616
+ });
12617
+ },
12618
+ methods: {
12619
+ calculateComponentVisibility: function calculateComponentVisibility() {
12620
+ var _this2 = this;
12621
+
12622
+ this.componentVisibility = Object.keys(this.appearDependOnControl).every(function (controlName) {
12623
+ if (Object.prototype.hasOwnProperty.call(_this2.appearDependOnControl, controlName)) {
12624
+ if (Object.keys(_this2.cachedDependedValues).includes(controlName)) {
12625
+ return _this2.cachedDependedValues[controlName] === _this2.appearDependOnControl[controlName];
12626
+ }
12627
+
12628
+ return false;
12629
+ }
12630
+ });
12631
+ },
12632
+ getInputLoadedValues: function getInputLoadedValues() {
12633
+ var _this3 = this;
12634
+
12635
+ var leftPanel = document.querySelector('.wptb-panel-left');
12636
+ var allInputs = Array.from(leftPanel.querySelectorAll('input')); // eslint-disable-next-line array-callback-return
12637
+
12638
+ allInputs.map(function (input) {
12639
+ var classList = input.getAttribute('class'); // eslint-disable-next-line array-callback-return
12640
+
12641
+ Object.keys(_this3.appearDependOnControl).map(function (d) {
12642
+ if (classList) {
12643
+ if (classList.includes(d)) {
12644
+ var val = input.value;
12645
+
12646
+ if (input.type === 'checkbox') {
12647
+ val = input.checked ? 'checked' : 'unchecked';
12648
+ }
12649
+
12650
+ _this3.$set(_this3.cachedDependedValues, d, val);
12651
+ }
12652
+ }
12653
+ });
12654
+ });
12655
+ },
12656
+ updateComponentVisibility: function updateComponentVisibility() {
12657
+ var _this4 = this;
12658
+
12659
+ if (this.tableSettings.settings) {
12660
+ // eslint-disable-next-line array-callback-return
12661
+ Object.keys(this.tableSettings.settings).map(function (s) {
12662
+ if (Object.prototype.hasOwnProperty.call(_this4.tableSettings.settings, s)) {
12663
+ if (Object.keys(_this4.appearDependOnControl).includes(s)) {
12664
+ _this4.$set(_this4.cachedDependedValues, s, _this4.tableSettings.settings[s]);
12665
+ }
12666
+ }
12667
+ });
12668
+ }
12669
+ },
12670
+
12671
+ /**
12672
+ * Get target elements of the selector.
12673
+ *
12674
+ * @return {null|Object}} null if no selector is defined or operation object
12675
+ */
12676
+ getTargetElements: function getTargetElements() {
12677
+ if (this.selectors.length > 0) {
12678
+ var operationObj = _selector.default.getAllValues(this.selectors);
12679
+
12680
+ this.targetElements = operationObj.elements;
12681
+ return operationObj;
12682
+ }
12683
+
12684
+ return null;
12685
+ },
12686
+
12687
+ /**
12688
+ * Generate a control value changed event.
12689
+ *
12690
+ * @param {any} value value to be emitted
12691
+ */
12692
+ generateChangeEvent: function generateChangeEvent(value) {
12693
+ var _this5 = this;
12694
+
12695
+ // eslint-disable-next-line array-callback-return
12696
+ this.targetElements.map(function (t) {
12697
+ // eslint-disable-next-line array-callback-return
12698
+ t.elements.map(function (el) {
12699
+ WPTB_Helper.wptbDocumentEventGenerate("wptb-control:".concat(_this5.uniqueId), el, {
12700
+ value: value
12701
+ });
12702
+ });
12703
+ });
12704
+ },
12705
+
12706
+ /**
12707
+ * Assign startup value of default selector to the main element value.
12708
+ *
12709
+ * This startup value will be fetched from the DOM element according to the default selector objects properties. If no startup value is found, then defaultValue prop will be used
12710
+ */
12711
+ assignDefaultValue: function assignDefaultValue() {
12712
+ if (this.startupValue !== undefined && this.startupValue !== '' && this.startupValue !== null) {
12713
+ this.mountedDataUpdate = true;
12714
+ this.elementMainValue = this.startupValue;
12715
+ } else if (this.defaultValue !== null) {
12716
+ this.mountedDataUpdate = true;
12717
+ this.elementMainValue = this.defaultValue;
12718
+ }
12719
+ },
12720
+
12721
+ /**
12722
+ * Sets the value of the selector object.
12723
+ *
12724
+ * @param {Object} selectorObj selector object
12725
+ * @param {any} value value to be set
12726
+ */
12727
+ setTargetValue: function setTargetValue(selectorObj, value) {
12728
+ _selector.default.setTargetValue(selectorObj, value);
12729
+ },
12730
+
12731
+ /**
12732
+ * Set the value to all selector objects.
12733
+ *
12734
+ * @param {any} value value to be assigned to all selector objects
12735
+ */
12736
+ setAllValues: function setAllValues(value) {
12737
+ _selector.default.setAllValues(this.targetElements, value);
12738
+ },
12739
+
12740
+ /**
12741
+ * Sets the current table as modified.
12742
+ *
12743
+ * @param {boolean} checkMountedState whether to check if value is updated at mounted hook. This check can be done to make sure assigning default value or saved value that has been fetched from the target selector element will not set the table as dirty at mount.
12744
+ */
12745
+ setTableDirty: function setTableDirty() {
12746
+ var checkMountedState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
12747
+
12748
+ if (checkMountedState) {
12749
+ if (!this.mountedDataUpdate) {
12750
+ new WPTB_TableStateSaveManager().tableStateSet();
12751
+ }
12752
+ } else {
12753
+ new WPTB_TableStateSaveManager().tableStateSet();
12754
+ }
12755
+
12756
+ this.mountedDataUpdate = false;
12757
+ },
12758
+
12759
+ /**
12760
+ * Reset mounted state of component.
12761
+ */
12762
+ resetMountedState: function resetMountedState() {
12763
+ this.mountedDataUpdate = true;
12764
+ },
12765
+
12766
+ /**
12767
+ * Basic value update that will handle setting selector values, generating change event and setting table dirty.
12768
+ *
12769
+ * @param {*} val value
12770
+ * @param {boolean} checkMountedState check for mounted state of component
12771
+ */
12772
+ basicValueUpdate: function basicValueUpdate(val) {
12773
+ var checkMountedState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12774
+ this.setAllValues(val);
12775
+ this.generateChangeEvent(val);
12776
+ this.setTableDirty(checkMountedState);
12777
+ }
12778
+ }
12779
+ };
12780
+ /**
12781
+ * @module ControlBase module
12782
+ */
12783
+
12784
+ var _default = ControlBase;
12785
+ exports.default = _default;
12786
+ },{"../functions/selector":"functions/selector.js"}],"containers/IconSelectControl.vue":[function(require,module,exports) {
12787
+ "use strict";
12788
+
12789
+ Object.defineProperty(exports, "__esModule", {
12790
+ value: true
12791
+ });
12792
+ exports.default = void 0;
12793
+
12794
+ var _IntersectionObserver = _interopRequireDefault(require("../components/IntersectionObserver"));
12795
+
12796
+ var _ControlBase = _interopRequireDefault(require("../mixins/ControlBase"));
12797
+
12798
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12799
+
12800
+ //
12801
+ //
12802
+ //
12803
+ //
12804
+ //
12805
+ //
12806
+ //
12807
+ //
12808
+ //
12809
+ //
12810
+ //
12811
+ //
12812
+ //
12813
+ //
12814
+ //
12815
+ //
12816
+ //
12817
+ //
12818
+ //
12819
+ //
12820
+ //
12821
+ //
12822
+ //
12823
+ //
12824
+ //
12825
+ //
12826
+ //
12827
+ //
12828
+ //
12829
+ //
12830
+ //
12831
+ //
12832
+ //
12833
+ //
12834
+ //
12835
+ //
12836
+ //
12837
+ //
12838
+ //
12839
+ //
12840
+ //
12841
+ var _default = {
12842
+ props: {
12843
+ label: String,
12844
+ icons: Object,
12845
+ perPage: {
12846
+ type: Number,
12847
+ default: 20
12848
+ }
12849
+ },
12850
+ mixins: [_ControlBase.default],
12851
+ components: {
12852
+ IntersectionObserver: _IntersectionObserver.default
12853
+ },
12854
+ data: function data() {
12855
+ return {
12856
+ selectedIcon: {
12857
+ url: null,
12858
+ name: null
12859
+ },
12860
+ openDrawer: false,
12861
+ innerDrawerRef: null,
12862
+ paginationIndex: 1,
12863
+ observerHide: false,
12864
+ debunkedFilterText: '',
12865
+ debunkId: -1,
12866
+ filterText: '',
12867
+ drawerPosition: {
12868
+ left: 0
12869
+ }
12870
+ };
12871
+ },
12872
+ mounted: function mounted() {
12873
+ var _this = this;
12874
+
12875
+ document.addEventListener('keyup', function (e) {
12876
+ if (e.code === 'Escape' && _this.openDrawer) {
12877
+ _this.setDrawerState(false);
12878
+ }
12879
+ });
12880
+ this.assignDefaultValue();
12881
+ var selectedIcon = this.elementMainValue;
12882
+ this.selectedIcon.name = selectedIcon === '' ? null : selectedIcon;
12883
+ this.selectedIcon.url = selectedIcon === '' ? null : this.icons[selectedIcon];
12884
+ },
12885
+ watch: {
12886
+ debunkedFilterText: function debunkedFilterText(n) {
12887
+ var _this2 = this;
12888
+
12889
+ clearTimeout(this.debunkId);
12890
+ this.debunkId = setTimeout(function () {
12891
+ _this2.filterText = n;
12892
+ }, 500);
12893
+ },
12894
+ selectedIcon: {
12895
+ handler: function handler() {
12896
+ var _this3 = this;
12897
+
12898
+ // refresh list of targetElements
12899
+ this.getTargetElements();
12900
+ var targetObjs = this.targetElements[0].elements;
12901
+
12902
+ if (targetObjs && Array.isArray(targetObjs)) {
12903
+ if (this.selectedIcon.url) {
12904
+ fetch(this.selectedIcon.url).then(function (r) {
12905
+ return r.text();
12906
+ }).then(function (resp) {
12907
+ _this3.setTargetValue(_this3.targetElements[0], _this3.selectedIcon.name);
12908
+
12909
+ var range = document.createRange(); // eslint-disable-next-line array-callback-return
12910
+
12911
+ targetObjs.map(function (s) {
12912
+ // eslint-disable-next-line no-param-reassign
12913
+ s.innerHTML = '';
12914
+ range.setStart(s, 0);
12915
+ var newSvgElement = range.createContextualFragment(resp);
12916
+ s.appendChild(newSvgElement);
12917
+ });
12918
+ });
12919
+ } else {
12920
+ this.setTargetValue(this.targetElements[0], ''); // eslint-disable-next-line array-callback-return
12921
+
12922
+ targetObjs.map(function (s) {
12923
+ // eslint-disable-next-line no-param-reassign
12924
+ s.innerHTML = '';
12925
+ });
12926
+ }
12927
+ }
12928
+ },
12929
+ deep: true
12930
+ }
12931
+ },
12932
+ methods: {
12933
+ setDrawerState: function setDrawerState(state) {
12934
+ this.openDrawer = state;
12935
+ },
12936
+ fullIconList: function fullIconList() {
12937
+ var _this4 = this;
12938
+
12939
+ return Object.keys(this.icons).filter(function (k) {
12940
+ return k.includes(_this4.filterText);
12941
+ }).slice(0, this.paginationIndex * this.perPage).reduce(function (result, key) {
12942
+ // eslint-disable-next-line no-param-reassign
12943
+ result[key] = _this4.icons[key];
12944
+ return result;
12945
+ }, {});
12946
+ },
12947
+ toggleIconDrawer: function toggleIconDrawer() {
12948
+ this.calculateDrawerPosition();
12949
+ this.openDrawer = !this.openDrawer;
12950
+ this.innerDrawerRef = this.$refs.drawerRefElement;
12951
+ },
12952
+ setIcon: function setIcon(iconName, iconUrl) {
12953
+ this.selectedIcon.url = iconUrl;
12954
+ this.selectedIcon.name = iconName;
12955
+ this.toggleIconDrawer();
12956
+ this.setTableDirty();
12957
+ },
12958
+ observerVisible: function observerVisible() {
12959
+ this.paginationIndex += 1;
12960
+ },
12961
+ calculateDrawerPosition: function calculateDrawerPosition() {
12962
+ var xPadding = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
12963
+ var buttonElement = this.$refs.iconSelectButton;
12964
+ var posObject = buttonElement.getBoundingClientRect();
12965
+ var drawerLeft = posObject.x + posObject.width + xPadding;
12966
+ var drawerTop = posObject.y;
12967
+ this.drawerPosition.top = this.toPx(drawerTop);
12968
+ this.drawerPosition.left = this.toPx(drawerLeft);
12969
+ },
12970
+ toPx: function toPx(val) {
12971
+ return "".concat(val, "px");
12972
+ }
12973
+ }
12974
+ };
12975
+ exports.default = _default;
12976
+ var $4a7874 = exports.default || module.exports;
12977
+
12978
+ if (typeof $4a7874 === 'function') {
12979
+ $4a7874 = $4a7874.options;
12980
+ }
12981
+
12982
+ /* template */
12983
+ Object.assign($4a7874, (function () {
12984
+ var render = function() {
12985
+ var _vm = this
12986
+ var _h = _vm.$createElement
12987
+ var _c = _vm._self._c || _h
12988
+ return _c(
12989
+ "div",
12990
+ { staticClass: "wptb-settings-row wptb-settings-middle-xs" },
12991
+ [
12992
+ _c("div", { staticClass: "wptb-settings-space-between" }, [
12993
+ _c("p", { staticClass: "wptb-settings-item-title" }, [
12994
+ _vm._v(_vm._s(_vm.label))
12995
+ ]),
12996
+ _vm._v(" "),
12997
+ _c("div", { staticClass: "wptb-icon-select-wrapper" }, [
12998
+ _c("div", { staticClass: "wptb-icon-select-display" }, [
12999
+ _c(
13000
+ "div",
13001
+ {
13002
+ ref: "iconSelectButton",
13003
+ staticClass: "wptb-icon-select-preview",
13004
+ on: { click: _vm.toggleIconDrawer }
13005
+ },
13006
+ [_c("img", { attrs: { src: _vm.selectedIcon.url } })]
13007
+ ),
13008
+ _vm._v(" "),
13009
+ _c(
13010
+ "div",
13011
+ {
13012
+ directives: [
13013
+ {
13014
+ name: "show",
13015
+ rawName: "v-show",
13016
+ value: _vm.openDrawer,
13017
+ expression: "openDrawer"
13018
+ }
13019
+ ],
13020
+ staticClass:
13021
+ "wptb-icon-select-drawer wptb-plugin-box-shadow-md",
13022
+ style: _vm.drawerPosition
13023
+ },
13024
+ [
13025
+ _c("div", { staticClass: "wptb-icon-search-wrapper" }, [
13026
+ _c("input", {
13027
+ directives: [
13028
+ {
13029
+ name: "model",
13030
+ rawName: "v-model.trim",
13031
+ value: _vm.debunkedFilterText,
13032
+ expression: "debunkedFilterText",
13033
+ modifiers: { trim: true }
13034
+ }
13035
+ ],
13036
+ attrs: { type: "text", placeholder: "Search for icons..." },
13037
+ domProps: { value: _vm.debunkedFilterText },
13038
+ on: {
13039
+ input: function($event) {
13040
+ if ($event.target.composing) {
13041
+ return
13042
+ }
13043
+ _vm.debunkedFilterText = $event.target.value.trim()
13044
+ },
13045
+ blur: function($event) {
13046
+ return _vm.$forceUpdate()
13047
+ }
13048
+ }
13049
+ })
13050
+ ]),
13051
+ _vm._v(" "),
13052
+ _c(
13053
+ "div",
13054
+ {
13055
+ ref: "drawerRefElement",
13056
+ staticClass: "wptb-icon-previews"
13057
+ },
13058
+ [
13059
+ _c("div", {
13060
+ staticClass:
13061
+ "wptb-icon-select-drawer-preview wptb-icon-reset",
13062
+ on: {
13063
+ click: function($event) {
13064
+ return _vm.setIcon("", "")
13065
+ }
13066
+ }
13067
+ }),
13068
+ _vm._v(" "),
13069
+ _vm._l(_vm.fullIconList(), function(iconUrl, name) {
13070
+ return _c(
13071
+ "div",
13072
+ {
13073
+ key: name,
13074
+ staticClass: "wptb-icon-select-drawer-preview",
13075
+ class: {
13076
+ "wptb-icon-preview-active":
13077
+ _vm.selectedIcon.name === name
13078
+ }
13079
+ },
13080
+ [
13081
+ _c("img", {
13082
+ attrs: {
13083
+ src: iconUrl,
13084
+ title: name,
13085
+ draggable: false
13086
+ },
13087
+ on: {
13088
+ click: function($event) {
13089
+ return _vm.setIcon(name, iconUrl)
13090
+ }
13091
+ }
13092
+ })
13093
+ ]
13094
+ )
13095
+ }),
13096
+ _vm._v(" "),
13097
+ _c(
13098
+ "intersection-observer",
13099
+ {
13100
+ attrs: {
13101
+ "relative-element": _vm.innerDrawerRef,
13102
+ "force-hide": _vm.observerHide
13103
+ },
13104
+ on: { visible: _vm.observerVisible }
13105
+ },
13106
+ [
13107
+ _c("div", {
13108
+ staticClass: "wptb-icon-select-drawer-end"
13109
+ })
13110
+ ]
13111
+ )
13112
+ ],
13113
+ 2
13114
+ )
13115
+ ]
13116
+ )
13117
+ ])
13118
+ ])
13119
+ ])
13120
+ ]
13121
+ )
13122
+ }
13123
+ var staticRenderFns = []
13124
+ render._withStripped = true
13125
+
13126
+ return {
13127
+ render: render,
13128
+ staticRenderFns: staticRenderFns,
13129
+ _compiled: true,
13130
+ _scopeId: null,
13131
+ functional: undefined
13132
+ };
13133
+ })());
13134
+
13135
+ },{"../components/IntersectionObserver":"components/IntersectionObserver.vue","../mixins/ControlBase":"mixins/ControlBase.js"}],"mountPoints/WPTB_IconSelectControl.js":[function(require,module,exports) {
13136
+ "use strict";
13137
+
13138
+ Object.defineProperty(exports, "__esModule", {
13139
+ value: true
13140
+ });
13141
+ exports.default = void 0;
13142
+
13143
+ var _vue = _interopRequireDefault(require("vue"));
13144
+
13145
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
13146
+
13147
+ var _IconSelectControl = _interopRequireDefault(require("../containers/IconSelectControl"));
13148
+
13149
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13150
+
13151
+ /**
13152
+ * Icon Selection Control
13153
+ */
13154
+ // eslint-disable-next-line camelcase
13155
+ var _default = {
13156
+ name: 'ControlIconSelect',
13157
+
13158
+ /**
13159
+ * Icon control script implementation.
13160
+ *
13161
+ * @param {string} uniqueId unique id for control element
13162
+ */
13163
+ handler: function iconControlSelectJS(uniqueId) {
13164
+ var data = _WPTB_ControlsManager.default.getControlData(uniqueId);
13165
+
13166
+ if (data.defaultValue === undefined) {
13167
+ data.defaultValue = null;
13168
+ }
13169
+
13170
+ new _vue.default({
13171
+ data: data,
13172
+ components: {
13173
+ IconSelectControl: _IconSelectControl.default
13174
+ }
13175
+ }).$mount("#".concat(uniqueId));
13176
+ }
13177
+ };
13178
+ exports.default = _default;
13179
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js","../containers/IconSelectControl":"containers/IconSelectControl.vue"}],"components/NumberPostfixInput.vue":[function(require,module,exports) {
13180
+ "use strict";
13181
+
13182
+ Object.defineProperty(exports, "__esModule", {
13183
+ value: true
13184
+ });
13185
+ exports.default = void 0;
13186
+ //
13187
+ //
13188
+ //
13189
+ //
13190
+ //
13191
+ //
13192
+ //
13193
+ //
13194
+ //
13195
+ //
13196
+ //
13197
+ //
13198
+ //
13199
+ //
13200
+ //
13201
+ //
13202
+ //
13203
+ //
13204
+ //
13205
+ //
13206
+ //
13207
+ var _default = {
13208
+ inheritAttrs: false,
13209
+ props: {
13210
+ postFix: {
13211
+ type: String,
13212
+ default: ''
13213
+ },
13214
+ value: {
13215
+ type: null,
13216
+ default: 0
13217
+ },
13218
+ // with this prop is enabled, width of the component will be calculated according to its contents
13219
+ enableDynamicWidth: {
13220
+ type: Boolean,
13221
+ default: false
13222
+ },
13223
+ // extra padding value that will be applied to input element
13224
+ dynamicWidthPadding: {
13225
+ type: Number,
13226
+ default: 3
13227
+ },
13228
+ // only enable data update with enter key down
13229
+ onlyEnter: {
13230
+ type: Boolean,
13231
+ default: false
13232
+ },
13233
+ min: {
13234
+ type: Number,
13235
+ default: 0
13236
+ },
13237
+ max: {
13238
+ type: Number,
13239
+ default: 1000
13240
+ },
13241
+ step: {
13242
+ type: Number,
13243
+ default: 1
13244
+ },
13245
+ enableLimit: {
13246
+ type: Boolean,
13247
+ default: false
13248
+ }
13249
+ },
13250
+ model: {
13251
+ prop: 'value',
13252
+ event: 'valueChanged'
13253
+ },
13254
+ watch: {
13255
+ value: function value(n) {
13256
+ this.innerValue = n;
13257
+ }
13258
+ },
13259
+ data: function data() {
13260
+ return {
13261
+ innerValue: 0
13262
+ };
13263
+ },
13264
+ mounted: function mounted() {
13265
+ this.innerValue = this.value;
13266
+ },
13267
+ computed: {
13268
+ /**
13269
+ * Add a post fix to the value.
13270
+ *
13271
+ * Value will be chosen from the component prop.
13272
+ */
13273
+ postFixIt: function postFixIt() {
13274
+ return "".concat(this.innerValue).concat(this.postFix);
13275
+ },
13276
+
13277
+ /**
13278
+ * Calculate width of input element according to its contents.
13279
+ */
13280
+ dynamicWidth: function dynamicWidth() {
13281
+ if (this.enableDynamicWidth) {
13282
+ return {
13283
+ width: "calc(".concat(this.innerValue.toString().length + this.postFix.length + this.dynamicWidthPadding, "ch) !important")
13284
+ };
13285
+ }
13286
+
13287
+ return {};
13288
+ }
13289
+ },
13290
+ methods: {
13291
+ /**
13292
+ * Retrieve integer from a string in the base of 10 and limit it between min/max values of the component.
13293
+ *
13294
+ * @param {number|string} val value
13295
+ * @return {number} retrieved integer
13296
+ */
13297
+ getValue: function getValue(val) {
13298
+ var parsedValue = Number.parseFloat(val); // get rid of unnecessary decimal points by fixing the number based on step value
13299
+
13300
+ var regex = new RegExp(/^([0-9]+)\.([0-9]+)/, 'g');
13301
+ var match = regex.exec(this.step.toString());
13302
+
13303
+ if (match) {
13304
+ var decimalPoint = match[2].length;
13305
+ parsedValue = Number.parseFloat(parsedValue.toFixed(decimalPoint));
13306
+ } // eslint-disable-next-line no-restricted-globals
13307
+
13308
+
13309
+ parsedValue = isNaN(parsedValue) ? 0 : parsedValue;
13310
+ return this.enableLimit ? this.limitValue(parsedValue) : parsedValue;
13311
+ },
13312
+
13313
+ /**
13314
+ * Limit given value between min/max properties of the component.
13315
+ *
13316
+ * @param {number} val value to be limited
13317
+ */
13318
+ limitValue: function limitValue(val) {
13319
+ if (val < this.min) {
13320
+ return this.min;
13321
+ }
13322
+
13323
+ if (val > this.max) {
13324
+ return this.max;
13325
+ }
13326
+
13327
+ return val;
13328
+ },
13329
+
13330
+ /**
13331
+ * Handle input value change.
13332
+ *
13333
+ * @param {Event} e input event
13334
+ */
13335
+ handleOnInput: function handleOnInput(e) {
13336
+ // don't update prop data if only enter key update is enabled
13337
+ if (!this.onlyEnter) {
13338
+ this.$emit('valueChanged', this.getValue(e.target.value));
13339
+ }
13340
+ },
13341
+
13342
+ /**
13343
+ * Handle enter value change.
13344
+ *
13345
+ * @param {Event} e input event
13346
+ */
13347
+ handleEnterInput: function handleEnterInput(e) {
13348
+ // only update prop data if enter key update is enabled
13349
+ if (this.onlyEnter) {
13350
+ this.$emit('valueChanged', this.getValue(e.target.value));
13351
+ }
13352
+ },
13353
+
13354
+ /**
13355
+ * Handle key press event for input
13356
+ *
13357
+ * This callback will give up/down arrow key press incrementation to input.
13358
+ *
13359
+ * @param {string} type type of key
13360
+ */
13361
+ handleKeyPress: function handleKeyPress() {
13362
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'up';
13363
+ var value = this.getValue(this.innerValue);
13364
+
13365
+ switch (type) {
13366
+ case 'up':
13367
+ value += this.step;
13368
+ break;
13369
+
13370
+ case 'down':
13371
+ value -= this.step;
13372
+ break;
13373
+
13374
+ default:
13375
+ value += this.step;
13376
+ break;
13377
+ }
13378
+
13379
+ value = this.getValue(value);
13380
+ this.$emit('valueChanged', value);
13381
+ }
13382
+ }
13383
+ };
13384
+ exports.default = _default;
13385
+ var $ea3a7f = exports.default || module.exports;
13386
+
13387
+ if (typeof $ea3a7f === 'function') {
13388
+ $ea3a7f = $ea3a7f.options;
13389
+ }
13390
+
13391
+ /* template */
13392
+ Object.assign($ea3a7f, (function () {
13393
+ var render = function() {
13394
+ var _vm = this
13395
+ var _h = _vm.$createElement
13396
+ var _c = _vm._self._c || _h
13397
+ return _c("input", {
13398
+ style: _vm.dynamicWidth,
13399
+ attrs: { type: "text", disabled: _vm.$attrs.disabled },
13400
+ domProps: { value: _vm.postFixIt },
13401
+ on: {
13402
+ input: _vm.handleOnInput,
13403
+ keydown: [
13404
+ function($event) {
13405
+ if (
13406
+ !$event.type.indexOf("key") &&
13407
+ _vm._k($event.keyCode, "up", 38, $event.key, ["Up", "ArrowUp"])
13408
+ ) {
13409
+ return null
13410
+ }
13411
+ $event.preventDefault()
13412
+ return _vm.handleKeyPress("up")
13413
+ },
13414
+ function($event) {
13415
+ if (
13416
+ !$event.type.indexOf("key") &&
13417
+ _vm._k($event.keyCode, "down", 40, $event.key, [
13418
+ "Down",
13419
+ "ArrowDown"
13420
+ ])
13421
+ ) {
13422
+ return null
13423
+ }
13424
+ $event.preventDefault()
13425
+ return _vm.handleKeyPress("down")
13426
+ },
13427
+ function($event) {
13428
+ if (
13429
+ !$event.type.indexOf("key") &&
13430
+ _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
13431
+ ) {
13432
+ return null
13433
+ }
13434
+ $event.preventDefault()
13435
+ return _vm.handleEnterInput($event)
13436
+ }
13437
+ ]
13438
+ }
13439
+ })
13440
+ }
13441
+ var staticRenderFns = []
13442
+ render._withStripped = true
13443
+
13444
+ return {
13445
+ render: render,
13446
+ staticRenderFns: staticRenderFns,
13447
+ _compiled: true,
13448
+ _scopeId: null,
13449
+ functional: undefined
13450
+ };
13451
+ })());
13452
+
13453
+ },{}],"components/RangeInput.vue":[function(require,module,exports) {
13454
+ "use strict";
13455
+
13456
+ Object.defineProperty(exports, "__esModule", {
13457
+ value: true
13458
+ });
13459
+ exports.default = void 0;
13460
+
13461
+ var _NumberPostfixInput = _interopRequireDefault(require("./NumberPostfixInput"));
13462
+
13463
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13464
+
13465
+ //
13466
+ //
13467
+ //
13468
+ //
13469
+ //
13470
+ //
13471
+ //
13472
+ //
13473
+ //
13474
+ //
13475
+ //
13476
+ //
13477
+ //
13478
+ //
13479
+ //
13480
+ //
13481
+ //
13482
+ //
13483
+ //
13484
+ //
13485
+ //
13486
+ //
13487
+ //
13488
+ //
13489
+ //
13490
+ //
13491
+ //
13492
+ //
13493
+ //
13494
+ //
13495
+ //
13496
+ //
13497
+ //
13498
+ //
13499
+ //
13500
+ //
13501
+ //
13502
+ //
13503
+ //
13504
+ //
13505
+ //
13506
+ //
13507
+ var _default = {
13508
+ components: {
13509
+ NumberPostfixInput: _NumberPostfixInput.default
13510
+ },
13511
+ props: {
13512
+ label: {
13513
+ type: String,
13514
+ default: ''
13515
+ },
13516
+ uniqueId: {
13517
+ type: String,
13518
+ default: ''
13519
+ },
13520
+ elemContainer: {
13521
+ type: String,
13522
+ default: ''
13523
+ },
13524
+ min: {
13525
+ type: Number,
13526
+ default: 1,
13527
+ required: false
13528
+ },
13529
+ max: {
13530
+ type: Number,
13531
+ default: 10,
13532
+ required: false
13533
+ },
13534
+ step: {
13535
+ type: Number,
13536
+ default: 1,
13537
+ required: false
13538
+ },
13539
+ elementMainValue: {
13540
+ type: null
13541
+ },
13542
+ postFix: {
13543
+ type: String,
13544
+ default: ''
13545
+ },
13546
+ clamp: {
13547
+ type: Boolean,
13548
+ default: false
13549
+ },
13550
+ disabled: {
13551
+ type: Boolean,
13552
+ default: false
13553
+ }
13554
+ },
13555
+ model: {
13556
+ prop: 'elementMainValue',
13557
+ event: 'valueChanged'
13558
+ },
13559
+ data: function data() {
13560
+ return {
13561
+ innerElementMainValue: 0
13562
+ };
13563
+ },
13564
+ mounted: function mounted() {
13565
+ var _this = this;
13566
+
13567
+ this.$nextTick(function () {
13568
+ _this.innerElementMainValue = _this.elementMainValue;
13569
+ });
13570
+ },
13571
+ watch: {
13572
+ elementMainValue: function elementMainValue() {
13573
+ this.innerElementMainValue = this.elementMainValue;
13574
+ },
13575
+ innerElementMainValue: function innerElementMainValue(n) {
13576
+ this.$emit('valueChanged', this.clamp ? this.clampValue(n) : n);
13577
+ }
13578
+ },
13579
+ methods: {
13580
+ /**
13581
+ * Clamp the value between min/max range.
13582
+ *
13583
+ * @param {number} val value
13584
+ * @return {number} clamped value
13585
+ */
13586
+ clampValue: function clampValue(val) {
13587
+ if (val < this.min) {
13588
+ return this.min;
13589
+ }
13590
+
13591
+ if (val > this.max) {
13592
+ return this.max;
13593
+ }
13594
+
13595
+ return val;
13596
+ }
13597
+ }
13598
+ };
13599
+ exports.default = _default;
13600
+ var $515a53 = exports.default || module.exports;
13601
+
13602
+ if (typeof $515a53 === 'function') {
13603
+ $515a53 = $515a53.options;
13604
+ }
13605
+
13606
+ /* template */
13607
+ Object.assign($515a53, (function () {
13608
+ var render = function() {
13609
+ var _vm = this
13610
+ var _h = _vm.$createElement
13611
+ var _c = _vm._self._c || _h
13612
+ return _c("div", { staticClass: "wptb-range-input-wrapper" }, [
13613
+ _c(
13614
+ "div",
13615
+ {
13616
+ staticClass: "wptb-settings-item-header wptb-text-transform-cap",
13617
+ attrs: { "data-wptb-text-disabled": _vm.disabled }
13618
+ },
13619
+ [_vm._v("\n\t\t" + _vm._s(_vm.label) + "\n\t")]
13620
+ ),
13621
+ _vm._v(" "),
13622
+ _c("div", { staticClass: "wptb-settings-row wptb-settings-middle-xs" }, [
13623
+ _c("div", { staticClass: "wptb-settings-col-xs-8" }, [
13624
+ _c("input", {
13625
+ directives: [
13626
+ {
13627
+ name: "model",
13628
+ rawName: "v-model",
13629
+ value: _vm.innerElementMainValue,
13630
+ expression: "innerElementMainValue"
13631
+ }
13632
+ ],
13633
+ staticClass: "wptb-element-property wptb-size-slider",
13634
+ class: _vm.uniqueId,
13635
+ attrs: {
13636
+ type: "range",
13637
+ "data-element": _vm.elemContainer,
13638
+ "data-type": "range",
13639
+ min: _vm.min,
13640
+ max: _vm.max,
13641
+ step: _vm.step,
13642
+ disabled: _vm.disabled
13643
+ },
13644
+ domProps: { value: _vm.innerElementMainValue },
13645
+ on: {
13646
+ __r: function($event) {
13647
+ _vm.innerElementMainValue = $event.target.value
13648
+ }
13649
+ }
13650
+ })
13651
+ ]),
13652
+ _vm._v(" "),
13653
+ _c(
13654
+ "div",
13655
+ { staticClass: "wptb-settings-col-xs-4" },
13656
+ [
13657
+ _c("number-postfix-input", {
13658
+ staticClass:
13659
+ "wptb-size-number wptb-number-input wptb-element-property",
13660
+ class: _vm.uniqueId,
13661
+ staticStyle: { "text-align": "center" },
13662
+ attrs: {
13663
+ disabled: _vm.disabled,
13664
+ "post-fix": _vm.postFix,
13665
+ "only-enter": true,
13666
+ min: _vm.min,
13667
+ max: _vm.max,
13668
+ "data-element": _vm.elemContainer,
13669
+ step: _vm.step,
13670
+ "enable-limit": _vm.clamp,
13671
+ "data-type": "range"
13672
+ },
13673
+ model: {
13674
+ value: _vm.innerElementMainValue,
13675
+ callback: function($$v) {
13676
+ _vm.innerElementMainValue = $$v
13677
+ },
13678
+ expression: "innerElementMainValue"
13679
+ }
13680
+ })
13681
+ ],
13682
+ 1
13683
+ )
13684
+ ])
13685
+ ])
13686
+ }
13687
+ var staticRenderFns = []
13688
+ render._withStripped = true
13689
+
13690
+ return {
13691
+ render: render,
13692
+ staticRenderFns: staticRenderFns,
13693
+ _compiled: true,
13694
+ _scopeId: null,
13695
+ functional: undefined
13696
+ };
13697
+ })());
13698
+
13699
+ },{"./NumberPostfixInput":"components/NumberPostfixInput.vue"}],"containers/RangeControl.vue":[function(require,module,exports) {
13700
+ "use strict";
13701
+
13702
+ Object.defineProperty(exports, "__esModule", {
13703
+ value: true
13704
+ });
13705
+ exports.default = void 0;
13706
+
13707
+ var _ControlBase = _interopRequireDefault(require("../mixins/ControlBase"));
13708
+
13709
+ var _RangeInput = _interopRequireDefault(require("../components/RangeInput"));
13710
+
13711
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13712
+
13713
+ //
13714
+ //
13715
+ //
13716
+ //
13717
+ //
13718
+ //
13719
+ //
13720
+ //
13721
+ //
13722
+ //
13723
+ //
13724
+ //
13725
+ //
13726
+ var _default = {
13727
+ props: {
13728
+ min: {
13729
+ type: Number,
13730
+ default: 1,
13731
+ required: false
13732
+ },
13733
+ max: {
13734
+ type: Number,
13735
+ default: 10,
13736
+ required: false
13737
+ },
13738
+ step: {
13739
+ type: Number,
13740
+ default: 1,
13741
+ required: false
13742
+ },
13743
+ defaultValue: {
13744
+ type: Number,
13745
+ default: 1,
13746
+ required: false
13747
+ },
13748
+ postFix: {
13749
+ type: String,
13750
+ default: ''
13751
+ }
13752
+ },
13753
+ mixins: [_ControlBase.default],
13754
+ components: {
13755
+ RangeInput: _RangeInput.default
13756
+ },
13757
+ mounted: function mounted() {
13758
+ this.assignDefaultValue();
13759
+ },
13760
+ watch: {
13761
+ elementMainValue: function elementMainValue(n) {
13762
+ var clampedValue = n;
13763
+ this.setAllValues(clampedValue); // check to see if this update occurs from startup data retrieval, if it is, don't mark table as dirty
13764
+
13765
+ this.generateChangeEvent(clampedValue);
13766
+ this.setTableDirty(true);
13767
+ }
13768
+ }
13769
+ };
13770
+ exports.default = _default;
13771
+ var $eeeedf = exports.default || module.exports;
13772
+
13773
+ if (typeof $eeeedf === 'function') {
13774
+ $eeeedf = $eeeedf.options;
13775
+ }
13776
+
13777
+ /* template */
13778
+ Object.assign($eeeedf, (function () {
13779
+ var render = function() {
13780
+ var _vm = this
13781
+ var _h = _vm.$createElement
13782
+ var _c = _vm._self._c || _h
13783
+ return _c("range-input", {
13784
+ attrs: {
13785
+ label: _vm.label,
13786
+ "unique-id": _vm.uniqueId,
13787
+ "elem-container": _vm.elemContainer,
13788
+ min: _vm.min,
13789
+ max: _vm.max,
13790
+ step: _vm.step,
13791
+ "post-fix": _vm.postFix,
13792
+ clamp: true
13793
+ },
13794
+ model: {
13795
+ value: _vm.elementMainValue,
13796
+ callback: function($$v) {
13797
+ _vm.elementMainValue = $$v
13798
+ },
13799
+ expression: "elementMainValue"
13800
+ }
13801
+ })
13802
+ }
13803
+ var staticRenderFns = []
13804
+ render._withStripped = true
13805
+
13806
+ return {
13807
+ render: render,
13808
+ staticRenderFns: staticRenderFns,
13809
+ _compiled: true,
13810
+ _scopeId: null,
13811
+ functional: undefined
13812
+ };
13813
+ })());
13814
+
13815
+ },{"../mixins/ControlBase":"mixins/ControlBase.js","../components/RangeInput":"components/RangeInput.vue"}],"mountPoints/WPTB_RangeControl.js":[function(require,module,exports) {
13816
+ "use strict";
13817
+
13818
+ Object.defineProperty(exports, "__esModule", {
13819
+ value: true
13820
+ });
13821
+ exports.default = void 0;
13822
+
13823
+ var _vue = _interopRequireDefault(require("vue"));
13824
+
13825
+ var _RangeControl = _interopRequireDefault(require("../containers/RangeControl"));
13826
+
13827
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
13828
+
13829
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13830
+
13831
+ /**
13832
+ * Range slider control.
13833
+ */
13834
+
13835
+ /* eslint-disable camelcase */
13836
+ var _default = {
13837
+ name: 'ControlRange',
13838
+ handler: function rangeControlJS(uniqueId) {
13839
+ var data = _WPTB_ControlsManager.default.getControlData(uniqueId);
13840
+
13841
+ new _vue.default({
13842
+ data: data,
13843
+ components: {
13844
+ RangeControl: _RangeControl.default
13845
+ }
13846
+ }).$mount("#".concat(uniqueId));
13847
+ }
13848
+ };
13849
+ exports.default = _default;
13850
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../containers/RangeControl":"containers/RangeControl.vue","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js"}],"containers/Select2Control.vue":[function(require,module,exports) {
13851
+ "use strict";
13852
+
13853
+ Object.defineProperty(exports, "__esModule", {
13854
+ value: true
13855
+ });
13856
+ exports.default = void 0;
13857
+
13858
+ var _ControlBase = _interopRequireDefault(require("../mixins/ControlBase"));
13859
+
13860
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13861
+
13862
+ //
13863
+ //
13864
+ //
13865
+ //
13866
+ //
13867
+ //
13868
+ //
13869
+ //
13870
+ //
13871
+ //
13872
+ //
13873
+ //
13874
+ //
13875
+ //
13876
+ //
13877
+ //
13878
+ //
13879
+ //
13880
+ //
13881
+ var _default = {
13882
+ props: {
13883
+ options: Object
13884
+ },
13885
+ mixins: [_ControlBase.default],
13886
+ mounted: function mounted() {
13887
+ this.assignDefaultValue();
13888
+ },
13889
+ watch: {
13890
+ elementMainValue: function elementMainValue(n) {
13891
+ this.generateChangeEvent(n);
13892
+ this.setAllValues(n);
13893
+ this.setTableDirty(true);
13894
+ }
13895
+ }
13896
+ };
13897
+ exports.default = _default;
13898
+ var $72f762 = exports.default || module.exports;
13899
+
13900
+ if (typeof $72f762 === 'function') {
13901
+ $72f762 = $72f762.options;
13902
+ }
13903
+
13904
+ /* template */
13905
+ Object.assign($72f762, (function () {
13906
+ var render = function() {
13907
+ var _vm = this
13908
+ var _h = _vm.$createElement
13909
+ var _c = _vm._self._c || _h
13910
+ return _c(
13911
+ "div",
13912
+ { staticClass: "wptb-settings-row wptb-settings-middle-xs" },
13913
+ [
13914
+ _c("div", { staticClass: "wptb-settings-space-between" }, [
13915
+ _c("p", { staticClass: "wptb-settings-item-title" }, [
13916
+ _vm._v(_vm._s(_vm.label))
13917
+ ]),
13918
+ _vm._v(" "),
13919
+ _c("div", [
13920
+ _c(
13921
+ "select",
13922
+ {
13923
+ directives: [
13924
+ {
13925
+ name: "model",
13926
+ rawName: "v-model",
13927
+ value: _vm.elementMainValue,
13928
+ expression: "elementMainValue"
13929
+ }
13930
+ ],
13931
+ ref: "selectElement",
13932
+ staticClass: "wptb-element-property",
13933
+ class: _vm.uniqueId,
13934
+ attrs: {
13935
+ "data-element": _vm.elemContainer,
13936
+ "data-type": "select2"
13937
+ },
13938
+ on: {
13939
+ change: function($event) {
13940
+ var $$selectedVal = Array.prototype.filter
13941
+ .call($event.target.options, function(o) {
13942
+ return o.selected
13943
+ })
13944
+ .map(function(o) {
13945
+ var val = "_value" in o ? o._value : o.value
13946
+ return val
13947
+ })
13948
+ _vm.elementMainValue = $event.target.multiple
13949
+ ? $$selectedVal
13950
+ : $$selectedVal[0]
13951
+ }
13952
+ }
13953
+ },
13954
+ _vm._l(_vm.options, function(value, key) {
13955
+ return _c("option", { key: key, domProps: { value: key } }, [
13956
+ _vm._v(_vm._s(value))
13957
+ ])
13958
+ }),
13959
+ 0
13960
+ )
13961
+ ])
13962
+ ])
13963
+ ]
13964
+ )
13965
+ }
13966
+ var staticRenderFns = []
13967
+ render._withStripped = true
13968
+
13969
+ return {
13970
+ render: render,
13971
+ staticRenderFns: staticRenderFns,
13972
+ _compiled: true,
13973
+ _scopeId: null,
13974
+ functional: undefined
13975
+ };
13976
+ })());
13977
+
13978
+ },{"../mixins/ControlBase":"mixins/ControlBase.js"}],"mountPoints/WPTB_Select2Control.js":[function(require,module,exports) {
13979
+ "use strict";
13980
+
13981
+ Object.defineProperty(exports, "__esModule", {
13982
+ value: true
13983
+ });
13984
+ exports.default = void 0;
13985
+
13986
+ var _vue = _interopRequireDefault(require("vue"));
13987
+
13988
+ var _Select2Control = _interopRequireDefault(require("../containers/Select2Control"));
13989
+
13990
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
13991
+
13992
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13993
+
13994
+ /**
13995
+ * Select2 control
13996
+ */
13997
+ // eslint-disable-next-line camelcase
13998
+ var _default = {
13999
+ name: 'Select2',
14000
+ handler: function select2ControlJS(uniqueId) {
14001
+ var data = _WPTB_ControlsManager.default.getControlData(uniqueId);
14002
+
14003
+ new _vue.default({
14004
+ data: data,
14005
+ components: {
14006
+ Select2Control: _Select2Control.default
14007
+ }
14008
+ }).$mount("#".concat(uniqueId));
14009
+ }
14010
+ };
14011
+ exports.default = _default;
14012
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../containers/Select2Control":"containers/Select2Control.vue","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js"}],"containers/MediaSelectControl.vue":[function(require,module,exports) {
14013
+ "use strict";
14014
+
14015
+ Object.defineProperty(exports, "__esModule", {
14016
+ value: true
14017
+ });
14018
+ exports.default = void 0;
14019
+
14020
+ var _ControlBase = _interopRequireDefault(require("../mixins/ControlBase"));
14021
+
14022
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14023
+
14024
+ //
14025
+ //
14026
+ //
14027
+ //
14028
+ //
14029
+ //
14030
+ //
14031
+ //
14032
+ //
14033
+ //
14034
+ //
14035
+ //
14036
+ //
14037
+ //
14038
+ //
14039
+ //
14040
+ //
14041
+ var _default = {
14042
+ mixins: [_ControlBase.default],
14043
+ props: {
14044
+ mediaAttr: {
14045
+ type: Object,
14046
+ required: false,
14047
+ default: function _default() {
14048
+ return {
14049
+ title: 'Media Select',
14050
+ button: {
14051
+ text: 'Select'
14052
+ },
14053
+ multiple: false
14054
+ };
14055
+ }
14056
+ }
14057
+ },
14058
+ data: function data() {
14059
+ return {
14060
+ frame: null
14061
+ };
14062
+ },
14063
+ mounted: function mounted() {
14064
+ this.assignDefaultValue();
14065
+ },
14066
+ watch: {
14067
+ elementMainValue: function elementMainValue(n) {
14068
+ this.setAllValues(n);
14069
+ this.setTableDirty(true);
14070
+ }
14071
+ },
14072
+ computed: {
14073
+ previewImageUrl: function previewImageUrl() {
14074
+ return "url(\"".concat(this.elementMainValue, "\")");
14075
+ }
14076
+ },
14077
+ methods: {
14078
+ open: function open() {
14079
+ var _this = this;
14080
+
14081
+ if (this.frame) {
14082
+ this.frame.open();
14083
+ } else {
14084
+ this.frame = wp.media(this.mediaAttr);
14085
+ this.frame.on('select', function () {
14086
+ var _this$frame$state$get = _this.frame.state().get('selection').first().toJSON(),
14087
+ url = _this$frame$state$get.url;
14088
+
14089
+ _this.elementMainValue = url;
14090
+ });
14091
+ this.frame.open();
14092
+ }
14093
+ },
14094
+ resetImg: function resetImg() {
14095
+ this.elementMainValue = '';
14096
+ }
14097
+ }
14098
+ };
14099
+ exports.default = _default;
14100
+ var $d9cab9 = exports.default || module.exports;
14101
+
14102
+ if (typeof $d9cab9 === 'function') {
14103
+ $d9cab9 = $d9cab9.options;
14104
+ }
14105
+
14106
+ /* template */
14107
+ Object.assign($d9cab9, (function () {
14108
+ var render = function() {
14109
+ var _vm = this
14110
+ var _h = _vm.$createElement
14111
+ var _c = _vm._self._c || _h
14112
+ return _c(
14113
+ "div",
14114
+ { staticClass: "wptb-settings-row wptb-settings-middle-xs" },
14115
+ [
14116
+ _c("div", { staticClass: "wptb-settings-space-between" }, [
14117
+ _c("p", { staticClass: "wptb-settings-item-title" }, [
14118
+ _vm._v(_vm._s(_vm.label))
14119
+ ]),
14120
+ _vm._v(" "),
14121
+ _c("div", { staticClass: "wptb-control-media-button-wrapper" }, [
14122
+ _c("div", {
14123
+ staticClass: "wptb-control-media-select-button",
14124
+ style: { backgroundImage: _vm.previewImageUrl },
14125
+ on: { click: _vm.open }
14126
+ }),
14127
+ _vm._v(" "),
14128
+ _c(
14129
+ "div",
14130
+ {
14131
+ staticClass: "wptb-control-media-clear-button",
14132
+ on: {
14133
+ "!click": function($event) {
14134
+ return _vm.resetImg($event)
14135
+ }
14136
+ }
14137
+ },
14138
+ [_c("span", { staticClass: "dashicons dashicons-dismiss" })]
14139
+ )
14140
+ ])
14141
+ ])
14142
+ ]
14143
+ )
14144
+ }
14145
+ var staticRenderFns = []
14146
+ render._withStripped = true
14147
+
14148
+ return {
14149
+ render: render,
14150
+ staticRenderFns: staticRenderFns,
14151
+ _compiled: true,
14152
+ _scopeId: null,
14153
+ functional: undefined
14154
+ };
14155
+ })());
14156
+
14157
+ },{"../mixins/ControlBase":"mixins/ControlBase.js"}],"mountPoints/WPTB_MediaSelectControl.js":[function(require,module,exports) {
14158
+ "use strict";
14159
+
14160
+ Object.defineProperty(exports, "__esModule", {
14161
+ value: true
14162
+ });
14163
+ exports.default = void 0;
14164
+
14165
+ var _vue = _interopRequireDefault(require("vue"));
14166
+
14167
+ var _MediaSelectControl = _interopRequireDefault(require("../containers/MediaSelectControl"));
14168
+
14169
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
14170
+
14171
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14172
+
14173
+ /**
14174
+ * Media select control
14175
+ */
14176
+
14177
+ /* eslint-disable camelcase */
14178
+ var _default = {
14179
+ name: 'ControlMediaSelect',
14180
+ handler: function rangeControlJS(uniqueId) {
14181
+ var data = _WPTB_ControlsManager.default.getControlData(uniqueId);
14182
+
14183
+ new _vue.default({
14184
+ data: data,
14185
+ components: {
14186
+ MediaSelectControl: _MediaSelectControl.default
14187
+ }
14188
+ }).$mount("#".concat(uniqueId));
14189
+ }
14190
+ };
14191
+ exports.default = _default;
14192
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../containers/MediaSelectControl":"containers/MediaSelectControl.vue","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js"}],"functions/DeBouncer.js":[function(require,module,exports) {
14193
+ "use strict";
14194
+
14195
+ Object.defineProperty(exports, "__esModule", {
14196
+ value: true
14197
+ });
14198
+ exports.default = void 0;
14199
+
14200
+ /**
14201
+ * ⛹️‍️Debounce class.
14202
+ *
14203
+ * Add a timeout to supplied function to delay its execution on certain situations, mostly in order to increase performance on repeating functions.
14204
+ *
14205
+ * @return {function} main debounce function
14206
+ * @constructor
14207
+ */
14208
+ function DeBouncer() {
14209
+ var actionIds = {};
14210
+ /**
14211
+ * Main debounce function.
14212
+ *
14213
+ * @param {number} id unique id for action
14214
+ * @param {function} callable function to be called
14215
+ * @param {number} timeout timeout duration in milliseconds
14216
+ */
14217
+
14218
+ function deBounce(id, callable) {
14219
+ var timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2000;
14220
+
14221
+ if (Object.keys(actionIds).includes(id)) {
14222
+ clearTimeout(actionIds[id]);
14223
+ }
14224
+
14225
+ actionIds[id] = setTimeout(callable, timeout);
14226
+ }
14227
+
14228
+ return deBounce;
14229
+ }
14230
+ /**
14231
+ * @module DeBouncer module
14232
+ */
14233
+
14234
+
14235
+ var _default = DeBouncer();
14236
+
14237
+ exports.default = _default;
14238
+ },{}],"components/TableClone.vue":[function(require,module,exports) {
14239
+ "use strict";
14240
+
14241
+ Object.defineProperty(exports, "__esModule", {
14242
+ value: true
14243
+ });
14244
+ exports.default = void 0;
14245
+
14246
+ var _DeBouncer = _interopRequireDefault(require("../functions/DeBouncer"));
14247
+
14248
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14249
+
14250
+ //
14251
+ //
14252
+ //
14253
+ //
14254
+ //
14255
+ //
14256
+ //
14257
+ var _default = {
14258
+ props: {
14259
+ clone: {
14260
+ type: Boolean,
14261
+ default: false,
14262
+ required: false
14263
+ },
14264
+ cloneQuery: {
14265
+ type: String,
14266
+ required: true
14267
+ },
14268
+ tableDirectives: {
14269
+ type: String,
14270
+ default: ''
14271
+ },
14272
+ tableStyle: {
14273
+ type: Object,
14274
+ default: function _default() {
14275
+ // eslint-disable-next-line no-empty,no-lone-blocks
14276
+ {}
14277
+ }
14278
+ }
14279
+ },
14280
+ inheritAttrs: false,
14281
+ data: function data() {
14282
+ return {
14283
+ // in order to not mutate the prop sent from the parent component, will be modifying the data prop instead
14284
+ cloneInner: false,
14285
+ clonedTable: null,
14286
+ mainTable: null,
14287
+ tableDirectiveDatasetId: 'wptbResponsiveDirectives',
14288
+ tableHaveDirectives: false
14289
+ };
14290
+ },
14291
+ mounted: function mounted() {
14292
+ this.cloneInner = this.clone;
14293
+ },
14294
+ watch: {
14295
+ /**
14296
+ * Watch clone prop.
14297
+ *
14298
+ * In order to prevent the mutation of the prop sent by parent element, will be directing any value change coming from parent to data property.
14299
+ *
14300
+ * @param {boolean} n new value
14301
+ */
14302
+ clone: function clone(n) {
14303
+ this.cloneInner = n;
14304
+ },
14305
+ // switch to decide whether to clone the main table into responsive area or not
14306
+ cloneInner: function cloneInner(n) {
14307
+ if (n) {
14308
+ this.startClone();
14309
+ this.cloneInner = false;
14310
+ }
14311
+ },
14312
+ tableDirectives: function tableDirectives(n) {
14313
+ if (n) {
14314
+ this.addDirectivesToTable(n);
14315
+ }
14316
+ },
14317
+ 'appOptions.identifyCells': {
14318
+ handler: function handler(n) {
14319
+ if (n) {
14320
+ this.showCellIdentification();
14321
+ this.appOptions.identifyCells = false;
14322
+ }
14323
+ }
14324
+ },
14325
+ 'directives.responsiveEnabled': {
14326
+ handler: function handler(n) {
14327
+ if (n) {
14328
+ this.mainTable.dataset.wptbAdaptiveTable = 0;
14329
+ }
14330
+ }
14331
+ }
14332
+ },
14333
+ methods: {
14334
+ /**
14335
+ * Start clone operation.
14336
+ *
14337
+ * Basic logic of this clone operation is to clone the main table from table builder and mount it to referenced element at template. This way, we will have the exact same copy of the element from table builder, and will only focus on responsive functionality of it.
14338
+ */
14339
+ startClone: function startClone() {
14340
+ this.mainTable = document.querySelector(this.cloneQuery);
14341
+
14342
+ if (!this.mainTable) {
14343
+ throw new Error("no clone target is found with a query value of ".concat(this.cloneQuery));
14344
+ } // check for legacy responsive functionality on main table
14345
+
14346
+
14347
+ this.appOptions.hasLegacyResponsive = this.mainTable.dataset.wptbAdaptiveTable === '1';
14348
+ this.clonedTable = this.mainTable.cloneNode(true);
14349
+ this.clonedTable.classList.add('wptb-plugin-box-shadow-xl');
14350
+ this.$refs.tableClone.appendChild(this.clonedTable); // directives that are already present in the main table
14351
+ // this directives may be saved from on another session of table builder or added there in the current session, what matters is, always use the main table directives as the base of source and update the other directives currently available according to them
14352
+
14353
+ var mainTableDirectives = this.mainTable.dataset[this.tableDirectiveDatasetId]; // since this component will be re-cloning the table at every visibility change of responsive menu, we should add necessary table directives to cloned table without waiting for them to be automatically added on change
14354
+
14355
+ if (this.tableDirectives) {
14356
+ this.addDirectivesToTable(this.tableDirectives);
14357
+ } // switch for determining if we will merge already present directives at main table
14358
+
14359
+
14360
+ this.tableHaveDirectives = mainTableDirectives !== undefined;
14361
+ this.setupCellIdentification(this.clonedTable); // emit an event signalling cloning main table is completed
14362
+
14363
+ this.$emit('tableCloned', mainTableDirectives, this.mainTable, this.clonedTable);
14364
+ },
14365
+
14366
+ /**
14367
+ * Add directives to dataset of cloned table and main table.
14368
+ *
14369
+ * @param {string} n new directives
14370
+ */
14371
+ addDirectivesToTable: function addDirectivesToTable(n) {
14372
+ if (this.clonedTable && this.mainTable) {
14373
+ // add directives to clone
14374
+ this.clonedTable.dataset[this.tableDirectiveDatasetId] = n; // add directives to main table
14375
+
14376
+ this.mainTable.dataset[this.tableDirectiveDatasetId] = n; // emit an event signalling end of directive copy operation
14377
+
14378
+ this.$emit('directivesCopied', this.tableHaveDirectives);
14379
+ this.tableHaveDirectives = false;
14380
+ }
14381
+ },
14382
+
14383
+ /**
14384
+ * Setup cell identification elements.
14385
+ *
14386
+ * @param {HTMLElement} tableElement parent table element
14387
+ */
14388
+ setupCellIdentification: function setupCellIdentification(tableElement) {
14389
+ var cells = Array.from(tableElement.querySelectorAll('td')); // eslint-disable-next-line array-callback-return
14390
+
14391
+ cells.map(function (c, i) {
14392
+ if (getComputedStyle(c).position !== 'relative') {
14393
+ // eslint-disable-next-line no-param-reassign
14394
+ c.style.position = 'relative';
14395
+ }
14396
+
14397
+ var range = document.createRange();
14398
+ range.setStart(c, 0);
14399
+ var lightnessPercent = i % 2 === 0 ? 70 : 90;
14400
+ var style = "background-color: hsla(211, 25%, ".concat(lightnessPercent, "%, 80%)");
14401
+ var identifierStringRepresentation = "<div class=\"wptb-responsive-cell-identifier\" style=\"".concat(style, "\">").concat(i + 1, "</div>");
14402
+ var cellIdentifier = range.createContextualFragment(identifierStringRepresentation);
14403
+ c.appendChild(cellIdentifier.childNodes[0]);
14404
+ });
14405
+ },
14406
+
14407
+ /**
14408
+ * Show cell identifications for table cells
14409
+ */
14410
+ showCellIdentification: function showCellIdentification() {
14411
+ var _this = this;
14412
+
14413
+ var visibilityClass = 'wptb-responsive-show-cell-identifier';
14414
+ this.clonedTable.classList.add(visibilityClass);
14415
+ (0, _DeBouncer.default)('cellIdentification', function () {
14416
+ _this.clonedTable.classList.remove(visibilityClass);
14417
+ }, 2000);
14418
+ }
14419
+ }
14420
+ };
14421
+ exports.default = _default;
14422
+ var $e62505 = exports.default || module.exports;
14423
+
14424
+ if (typeof $e62505 === 'function') {
14425
+ $e62505 = $e62505.options;
14426
+ }
14427
+
14428
+ /* template */
14429
+ Object.assign($e62505, (function () {
14430
+ var render = function() {
14431
+ var _vm = this
14432
+ var _h = _vm.$createElement
14433
+ var _c = _vm._self._c || _h
14434
+ return _c("div", { staticClass: "wptb-responsive-clone-wrapper" }, [
14435
+ _c("div", { staticClass: "wptb-responsive-clone-inner-wrapper" }, [
14436
+ _c("div", { ref: "tableClone", style: _vm.tableStyle })
14437
+ ])
14438
+ ])
14439
+ }
14440
+ var staticRenderFns = []
14441
+ render._withStripped = true
14442
+
14443
+ return {
14444
+ render: render,
14445
+ staticRenderFns: staticRenderFns,
14446
+ _compiled: true,
14447
+ _scopeId: null,
14448
+ functional: undefined
14449
+ };
14450
+ })());
14451
+
14452
+ },{"../functions/DeBouncer":"functions/DeBouncer.js"}],"components/SliderStop.vue":[function(require,module,exports) {
14453
+ "use strict";
14454
+
14455
+ Object.defineProperty(exports, "__esModule", {
14456
+ value: true
14457
+ });
14458
+ exports.default = void 0;
14459
+
14460
+ var _NumberPostfixInput = _interopRequireDefault(require("./NumberPostfixInput"));
14461
+
14462
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14463
+
14464
+ //
14465
+ //
14466
+ //
14467
+ //
14468
+ //
14469
+ //
14470
+ //
14471
+ //
14472
+ //
14473
+ //
14474
+ //
14475
+ //
14476
+ //
14477
+ //
14478
+ //
14479
+ //
14480
+ //
14481
+ //
14482
+ //
14483
+ //
14484
+ //
14485
+ //
14486
+ var _default = {
14487
+ props: {
14488
+ value: {
14489
+ type: Number,
14490
+ default: 0
14491
+ },
14492
+ rawValue: {
14493
+ type: Number,
14494
+ default: 0
14495
+ },
14496
+ active: {
14497
+ type: Boolean,
14498
+ default: false
14499
+ },
14500
+ stopId: String,
14501
+ enableBreakpointCustomization: {
14502
+ type: Boolean,
14503
+ default: false
14504
+ }
14505
+ },
14506
+ components: {
14507
+ NumberPostfixInput: _NumberPostfixInput.default
14508
+ },
14509
+ data: function data() {
14510
+ return {
14511
+ wrapperStyle: {
14512
+ left: 0,
14513
+ top: 0
14514
+ },
14515
+ innerRawValue: this.rawValue
14516
+ };
14517
+ },
14518
+ watch: {
14519
+ rawValue: function rawValue(n) {
14520
+ this.innerRawValue = n;
14521
+ },
14522
+ value: function value() {
14523
+ this.calculateStyle();
14524
+ },
14525
+ innerRawValue: function innerRawValue(n) {
14526
+ this.$emit('breakpointChange', n, this.stopId);
14527
+ }
14528
+ },
14529
+ mounted: function mounted() {
14530
+ var _this = this;
14531
+
14532
+ this.$nextTick(function () {
14533
+ _this.calculateStyle();
14534
+ });
14535
+ },
14536
+ methods: {
14537
+ clickEvent: function clickEvent() {
14538
+ this.$emit('click', this.rawValue);
14539
+ },
14540
+ calculateStyle: function calculateStyle() {
14541
+ var wrapperElement = this.$refs.wrapper;
14542
+ var knobElement = this.$refs.knob;
14543
+
14544
+ if (wrapperElement) {
14545
+ var _wrapperElement$getBo = wrapperElement.getBoundingClientRect(),
14546
+ width = _wrapperElement$getBo.width;
14547
+
14548
+ this.wrapperStyle.left = "calc(".concat(this.value, "% - ").concat(width / 2, "px)");
14549
+ }
14550
+
14551
+ if (knobElement) {
14552
+ var _knobElement$getBound = knobElement.getBoundingClientRect(),
14553
+ height = _knobElement$getBound.height;
14554
+
14555
+ this.wrapperStyle.top = "-".concat(height / 2, "px");
14556
+ }
14557
+ }
14558
+ }
14559
+ };
14560
+ exports.default = _default;
14561
+ var $3c0812 = exports.default || module.exports;
14562
+
14563
+ if (typeof $3c0812 === 'function') {
14564
+ $3c0812 = $3c0812.options;
14565
+ }
14566
+
14567
+ /* template */
14568
+ Object.assign($3c0812, (function () {
14569
+ var render = function() {
14570
+ var _vm = this
14571
+ var _h = _vm.$createElement
14572
+ var _c = _vm._self._c || _h
14573
+ return _c(
14574
+ "div",
14575
+ {
14576
+ ref: "wrapper",
14577
+ staticClass: "wptb-slider-stop",
14578
+ class: { "wptb-slider-stop-active": _vm.active },
14579
+ style: _vm.wrapperStyle,
14580
+ on: {
14581
+ "!click": function($event) {
14582
+ $event.preventDefault()
14583
+ return _vm.clickEvent($event)
14584
+ }
14585
+ }
14586
+ },
14587
+ [
14588
+ _c("div", { ref: "knob", staticClass: "wptb-slider-stop-knob" }),
14589
+ _vm._v(" "),
14590
+ _c(
14591
+ "div",
14592
+ { staticClass: "wptb-slider-stop-label" },
14593
+ [_vm._t("default")],
14594
+ 2
14595
+ ),
14596
+ _vm._v(" "),
14597
+ _c(
14598
+ "div",
14599
+ {
14600
+ directives: [
14601
+ {
14602
+ name: "show",
14603
+ rawName: "v-show",
14604
+ value: _vm.enableBreakpointCustomization,
14605
+ expression: "enableBreakpointCustomization"
14606
+ }
14607
+ ]
14608
+ },
14609
+ [
14610
+ _c("number-postfix-input", {
14611
+ staticClass: "wptb-size-input",
14612
+ staticStyle: { "font-size": "90%" },
14613
+ attrs: {
14614
+ "enable-dynamic-width": true,
14615
+ "only-enter": true,
14616
+ "post-fix": "px"
14617
+ },
14618
+ model: {
14619
+ value: _vm.innerRawValue,
14620
+ callback: function($$v) {
14621
+ _vm.innerRawValue = $$v
14622
+ },
14623
+ expression: "innerRawValue"
14624
+ }
14625
+ })
14626
+ ],
14627
+ 1
14628
+ )
14629
+ ]
14630
+ )
14631
+ }
14632
+ var staticRenderFns = []
14633
+ render._withStripped = true
14634
+
14635
+ return {
14636
+ render: render,
14637
+ staticRenderFns: staticRenderFns,
14638
+ _compiled: true,
14639
+ _scopeId: null,
14640
+ functional: undefined
14641
+ };
14642
+ })());
14643
+
14644
+ },{"./NumberPostfixInput":"components/NumberPostfixInput.vue"}],"components/SliderFill.vue":[function(require,module,exports) {
14645
+ "use strict";
14646
+
14647
+ Object.defineProperty(exports, "__esModule", {
14648
+ value: true
14649
+ });
14650
+ exports.default = void 0;
14651
+ //
14652
+ //
14653
+ //
14654
+ var _default = {
14655
+ props: {
14656
+ amount: {
14657
+ type: Number,
14658
+ default: 0
14659
+ }
14660
+ },
14661
+ computed: {
14662
+ calculateStyle: function calculateStyle() {
14663
+ return {
14664
+ width: "".concat(this.amount, "%")
14665
+ };
14666
+ }
14667
+ }
14668
+ };
14669
+ exports.default = _default;
14670
+ var $1f3acb = exports.default || module.exports;
14671
+
14672
+ if (typeof $1f3acb === 'function') {
14673
+ $1f3acb = $1f3acb.options;
14674
+ }
14675
+
14676
+ /* template */
14677
+ Object.assign($1f3acb, (function () {
14678
+ var render = function() {
14679
+ var _vm = this
14680
+ var _h = _vm.$createElement
14681
+ var _c = _vm._self._c || _h
14682
+ return _c("div", {
14683
+ staticClass: "wptb-screen-size-slider-fill",
14684
+ style: _vm.calculateStyle
14685
+ })
14686
+ }
14687
+ var staticRenderFns = []
14688
+ render._withStripped = true
14689
+
14690
+ return {
14691
+ render: render,
14692
+ staticRenderFns: staticRenderFns,
14693
+ _compiled: true,
14694
+ _scopeId: null,
14695
+ functional: undefined
14696
+ };
14697
+ })());
14698
+
14699
+ },{}],"components/SliderArrow.vue":[function(require,module,exports) {
14700
+ "use strict";
14701
+
14702
+ Object.defineProperty(exports, "__esModule", {
14703
+ value: true
14704
+ });
14705
+ exports.default = void 0;
14706
+ //
14707
+ //
14708
+ //
14709
+ //
14710
+ //
14711
+ //
14712
+ //
14713
+ //
14714
+ //
14715
+ //
14716
+ //
14717
+ //
14718
+ //
14719
+ //
14720
+ //
14721
+ //
14722
+ //
14723
+ //
14724
+ var _default = {
14725
+ props: {
14726
+ positionPercentage: {
14727
+ type: Number,
14728
+ default: 0
14729
+ }
14730
+ },
14731
+ data: function data() {
14732
+ return {
14733
+ style: {
14734
+ left: 0
14735
+ }
14736
+ };
14737
+ },
14738
+ watch: {
14739
+ positionPercentage: {
14740
+ handler: function handler() {
14741
+ this.calculateStyle();
14742
+ },
14743
+ deep: true
14744
+ }
14745
+ },
14746
+ mounted: function mounted() {
14747
+ this.calculateStyle();
14748
+ },
14749
+ methods: {
14750
+ calculateStyle: function calculateStyle() {
14751
+ var arrowWrapperElement = this.$refs.arrowWrapper;
14752
+
14753
+ var _arrowWrapperElement$ = arrowWrapperElement.getBoundingClientRect(),
14754
+ width = _arrowWrapperElement$.width;
14755
+
14756
+ this.style.left = "calc(".concat(this.positionPercentage, "% - ").concat(width / 2, "px)");
14757
+ },
14758
+ handleDrag: function handleDrag(e) {
14759
+ var screenX = e.screenX,
14760
+ screenY = e.screenY; // drag is interrupted/canceled prematurely
14761
+
14762
+ if (screenX === 0 && screenY === 0) {
14763
+ return;
14764
+ }
14765
+
14766
+ this.$emit('arrowDrag', e);
14767
+ }
14768
+ }
14769
+ };
14770
+ exports.default = _default;
14771
+ var $221e87 = exports.default || module.exports;
14772
+
14773
+ if (typeof $221e87 === 'function') {
14774
+ $221e87 = $221e87.options;
14775
+ }
14776
+
14777
+ /* template */
14778
+ Object.assign($221e87, (function () {
14779
+ var render = function() {
14780
+ var _vm = this
14781
+ var _h = _vm.$createElement
14782
+ var _c = _vm._self._c || _h
14783
+ return _c(
14784
+ "div",
14785
+ {
14786
+ ref: "arrowWrapper",
14787
+ staticClass: "wptb-screen-size-slider-arrow",
14788
+ style: _vm.style,
14789
+ attrs: { draggable: "true" },
14790
+ on: {
14791
+ drag: function($event) {
14792
+ $event.preventDefault()
14793
+ return _vm.handleDrag($event)
14794
+ },
14795
+ dragover: function($event) {
14796
+ $event.preventDefault()
14797
+ },
14798
+ dragend: function($event) {
14799
+ $event.preventDefault()
14800
+ return _vm.$emit("arrowDragEnd")
14801
+ },
14802
+ drop: function($event) {
14803
+ $event.preventDefault()
14804
+ },
14805
+ dragexit: function($event) {
14806
+ $event.preventDefault()
14807
+ },
14808
+ dragleave: function($event) {
14809
+ $event.preventDefault()
14810
+ }
14811
+ }
14812
+ },
14813
+ [
14814
+ _c(
14815
+ "svg",
14816
+ {
14817
+ attrs: {
14818
+ width: "17",
14819
+ height: "16",
14820
+ viewBox: "0 0 17 16",
14821
+ fill: "none",
14822
+ xmlns: "http://www.w3.org/2000/svg"
14823
+ }
14824
+ },
14825
+ [
14826
+ _c("path", {
14827
+ attrs: {
14828
+ d: "M8.5 16L0 0H17L8.5 16Z",
14829
+ fill: "var(--wptb-plugin-logo-color)"
14830
+ }
14831
+ })
14832
+ ]
14833
+ )
14834
+ ]
14835
+ )
14836
+ }
14837
+ var staticRenderFns = []
14838
+ render._withStripped = true
14839
+
14840
+ return {
14841
+ render: render,
14842
+ staticRenderFns: staticRenderFns,
14843
+ _compiled: true,
14844
+ _scopeId: null,
14845
+ functional: undefined
14846
+ };
14847
+ })());
14848
+
14849
+ },{}],"components/ScreenSizeSlider.vue":[function(require,module,exports) {
14850
+ "use strict";
14851
+
14852
+ Object.defineProperty(exports, "__esModule", {
14853
+ value: true
14854
+ });
14855
+ exports.default = void 0;
14856
+
14857
+ var _SliderStop = _interopRequireDefault(require("./SliderStop"));
14858
+
14859
+ var _SliderFill = _interopRequireDefault(require("./SliderFill"));
14860
+
14861
+ var _SliderArrow = _interopRequireDefault(require("./SliderArrow"));
14862
+
14863
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14864
+
14865
+ //
14866
+ //
14867
+ //
14868
+ //
14869
+ //
14870
+ //
14871
+ //
14872
+ //
14873
+ //
14874
+ //
14875
+ //
14876
+ //
14877
+ //
14878
+ //
14879
+ //
14880
+ //
14881
+ //
14882
+ //
14883
+ //
14884
+ //
14885
+ //
14886
+ //
14887
+ //
14888
+ //
14889
+ //
14890
+ //
14891
+ //
14892
+ //
14893
+ //
14894
+ var _default = {
14895
+ props: {
14896
+ stops: Object,
14897
+ // with endPadding, slider will ignore min/max values and calculate those with the supplied stops by adding/subtracting this endPadding prop
14898
+ endPadding: {
14899
+ type: Number,
14900
+ default: 0
14901
+ },
14902
+ modelVal: {
14903
+ type: Number,
14904
+ default: 0
14905
+ },
14906
+ enableBreakpointCustomization: {
14907
+ type: Boolean,
14908
+ default: false
14909
+ }
14910
+ },
14911
+ components: {
14912
+ SliderStop: _SliderStop.default,
14913
+ SliderFill: _SliderFill.default,
14914
+ SliderArrow: _SliderArrow.default
14915
+ },
14916
+ data: function data() {
14917
+ return {
14918
+ min: 0,
14919
+ max: 100,
14920
+ currentVal: 0,
14921
+ isDragging: false,
14922
+ // minimum size between breakpoints to avoid them overlap or share the same breakpoint size
14923
+ minSizeBetweenBreakpoints: 100,
14924
+ repaintId: 0
14925
+ };
14926
+ },
14927
+ beforeMount: function beforeMount() {
14928
+ this.calculateMinMax();
14929
+ },
14930
+ watch: {
14931
+ currentVal: function currentVal() {
14932
+ this.$emit('slide', this.currentVal);
14933
+ },
14934
+ modelVal: function modelVal(n) {
14935
+ this.currentVal = Math.floor(n);
14936
+ },
14937
+ 'directives.relativeWidth': {
14938
+ handler: function handler() {
14939
+ this.repaintId += 1;
14940
+ },
14941
+ deep: true
14942
+ }
14943
+ },
14944
+ methods: {
14945
+ handleBreakpointChange: function handleBreakpointChange(newSize, breakpointId) {
14946
+ var breakpointObj = this.directives.breakpoints;
14947
+
14948
+ if (breakpointObj[breakpointId]) {
14949
+ var sortedIds = Object.keys(breakpointObj).sort(function (a, b) {
14950
+ return breakpointObj[a].width - breakpointObj[b].width;
14951
+ }); // limit assigning a higher or lower value then the changed breakpoints logical place
14952
+
14953
+ var currentIndex = sortedIds.indexOf(breakpointId);
14954
+ var minSibling = sortedIds[currentIndex - 1];
14955
+ var maxSibling = sortedIds[currentIndex + 1];
14956
+
14957
+ if (minSibling) {
14958
+ if (breakpointObj[minSibling].width >= newSize) {
14959
+ // eslint-disable-next-line no-param-reassign
14960
+ newSize = breakpointObj[minSibling].width + this.minSizeBetweenBreakpoints;
14961
+ }
14962
+ }
14963
+
14964
+ if (maxSibling) {
14965
+ if (breakpointObj[maxSibling].width <= newSize) {
14966
+ // eslint-disable-next-line no-param-reassign
14967
+ newSize = breakpointObj[maxSibling].width - this.minSizeBetweenBreakpoints;
14968
+ }
14969
+ }
14970
+
14971
+ breakpointObj[breakpointId].width = newSize;
14972
+ this.calculateMinMax();
14973
+ this.repaintId += 1;
14974
+ } else {
14975
+ throw new Error("no breakpoint found with the given ID: [".concat(breakpointId, "]"));
14976
+ }
14977
+ },
14978
+
14979
+ /**
14980
+ * Calculate min/max values for the current slider.
14981
+ */
14982
+ calculateMinMax: function calculateMinMax() {
14983
+ var sortedValues = Object.values(this.stops).sort(function (a, b) {
14984
+ return (b.width - a.width) * -1;
14985
+ });
14986
+ this.min = sortedValues[0].width - this.endPadding;
14987
+ this.max = sortedValues[sortedValues.length - 1].width + this.endPadding;
14988
+ this.currentVal = sortedValues[sortedValues.length - 1].width;
14989
+ },
14990
+
14991
+ /**
14992
+ * Translate the supplied value into percentage within the context of min/max values of slider.
14993
+ *
14994
+ * @param {Number} val value
14995
+ * @returns {number} percent
14996
+ */
14997
+ translateIntoPercent: function translateIntoPercent(val) {
14998
+ var range = this.max - this.min;
14999
+ return (val - this.min) * 100 / range;
15000
+ },
15001
+ slide: function slide(val) {
15002
+ this.currentVal = val;
15003
+ },
15004
+ handleArrowDrag: function handleArrowDrag(e) {
15005
+ this.isDragging = true;
15006
+ var sliderWrapper = this.$refs.sliderWrapper;
15007
+
15008
+ var _sliderWrapper$getBou = sliderWrapper.getBoundingClientRect(),
15009
+ left = _sliderWrapper$getBou.left,
15010
+ width = _sliderWrapper$getBou.width; // relative position of arrow to the slider
15011
+
15012
+
15013
+ var relativePosition = e.clientX - left;
15014
+ var range = this.max - this.min; // value limited to range of min-max values
15015
+
15016
+ var offsetVal = relativePosition * range / width; // floor the value to nearest integer
15017
+
15018
+ this.currentVal = this.limitToRange(this.min + offsetVal);
15019
+ },
15020
+
15021
+ /**
15022
+ * Limit given value to min/max values.
15023
+ *
15024
+ * @param {number} val value
15025
+ * @param {boolean} floor floor the value to nearest integer
15026
+ * @returns {number} limited value
15027
+ */
15028
+ limitToRange: function limitToRange(val) {
15029
+ var floor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
15030
+ var tempVal = val;
15031
+
15032
+ if (val < this.min) {
15033
+ tempVal = this.min;
15034
+ }
15035
+
15036
+ if (val > this.max) {
15037
+ tempVal = this.max;
15038
+ }
15039
+
15040
+ if (floor) {
15041
+ tempVal = Math.floor(tempVal);
15042
+ }
15043
+
15044
+ return tempVal;
15045
+ },
15046
+
15047
+ /**
15048
+ * Calculate if given value represents the active section of the responsive range.
15049
+ *
15050
+ * @param {number} val value
15051
+ * @returns {boolean} is active
15052
+ */
15053
+ isStopActive: function isStopActive(val) {
15054
+ var _this = this;
15055
+
15056
+ if (this.currentVal >= val) {
15057
+ var smallerVals = Object.values(this.stops).filter(function (s) {
15058
+ return s <= _this.currentVal;
15059
+ });
15060
+ return smallerVals.every(function (s) {
15061
+ return s <= val;
15062
+ });
15063
+ }
15064
+
15065
+ return false;
15066
+ }
15067
+ }
15068
+ };
15069
+ exports.default = _default;
15070
+ var $a9eb9a = exports.default || module.exports;
15071
+
15072
+ if (typeof $a9eb9a === 'function') {
15073
+ $a9eb9a = $a9eb9a.options;
15074
+ }
15075
+
15076
+ /* template */
15077
+ Object.assign($a9eb9a, (function () {
15078
+ var render = function() {
15079
+ var _vm = this
15080
+ var _h = _vm.$createElement
15081
+ var _c = _vm._self._c || _h
15082
+ return _c(
15083
+ "div",
15084
+ {
15085
+ key: _vm.repaintId,
15086
+ ref: "sliderWrapper",
15087
+ staticClass: "wptb-screen-size-slider-wrapper",
15088
+ class: { "wptb-drag-active": _vm.isDragging }
15089
+ },
15090
+ [
15091
+ _c(
15092
+ "div",
15093
+ { staticClass: "wptb-screen-size-slider-empty" },
15094
+ [
15095
+ _c("slider-arrow", {
15096
+ attrs: {
15097
+ "position-percentage": _vm.translateIntoPercent(
15098
+ _vm.limitToRange(_vm.currentVal)
15099
+ )
15100
+ },
15101
+ on: {
15102
+ arrowDrag: _vm.handleArrowDrag,
15103
+ arrowDragEnd: function($event) {
15104
+ _vm.isDragging = false
15105
+ }
15106
+ }
15107
+ }),
15108
+ _vm._v(" "),
15109
+ _c("slider-fill", {
15110
+ attrs: {
15111
+ amount: _vm.translateIntoPercent(_vm.limitToRange(_vm.currentVal))
15112
+ }
15113
+ }),
15114
+ _vm._v(" "),
15115
+ _vm._l(_vm.stops, function(ref, key) {
15116
+ var name = ref.name
15117
+ var width = ref.width
15118
+ return _c(
15119
+ "slider-stop",
15120
+ {
15121
+ key: key,
15122
+ attrs: {
15123
+ active: _vm.isStopActive(width),
15124
+ value: _vm.translateIntoPercent(width),
15125
+ "raw-value": width,
15126
+ "stop-id": key,
15127
+ enableBreakpointCustomization:
15128
+ _vm.enableBreakpointCustomization
15129
+ },
15130
+ on: {
15131
+ click: _vm.slide,
15132
+ breakpointChange: _vm.handleBreakpointChange
15133
+ }
15134
+ },
15135
+ [
15136
+ _vm._v(
15137
+ _vm._s(
15138
+ _vm.directives.relativeWidth === "window"
15139
+ ? name
15140
+ : width + "px"
15141
+ ) + "\n\t\t"
15142
+ )
15143
+ ]
15144
+ )
15145
+ })
15146
+ ],
15147
+ 2
15148
+ )
15149
+ ]
15150
+ )
15151
+ }
15152
+ var staticRenderFns = []
15153
+ render._withStripped = true
15154
+
15155
+ return {
15156
+ render: render,
15157
+ staticRenderFns: staticRenderFns,
15158
+ _compiled: true,
15159
+ _scopeId: null,
15160
+ functional: undefined
15161
+ };
15162
+ })());
15163
+
15164
+ },{"./SliderStop":"components/SliderStop.vue","./SliderFill":"components/SliderFill.vue","./SliderArrow":"components/SliderArrow.vue"}],"../../../../../node_modules/process/browser.js":[function(require,module,exports) {
15165
+
15166
+ // shim for using process in browser
15167
+ var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
15168
+ // don't break things. But we need to wrap it in a try catch in case it is
15169
+ // wrapped in strict mode code which doesn't define any globals. It's inside a
15170
+ // function because try/catches deoptimize in certain engines.
15171
+
15172
+ var cachedSetTimeout;
15173
+ var cachedClearTimeout;
15174
+
15175
+ function defaultSetTimout() {
15176
+ throw new Error('setTimeout has not been defined');
15177
+ }
15178
+
15179
+ function defaultClearTimeout() {
15180
+ throw new Error('clearTimeout has not been defined');
15181
+ }
15182
+
15183
+ (function () {
15184
+ try {
15185
+ if (typeof setTimeout === 'function') {
15186
+ cachedSetTimeout = setTimeout;
15187
+ } else {
15188
+ cachedSetTimeout = defaultSetTimout;
15189
+ }
15190
+ } catch (e) {
15191
+ cachedSetTimeout = defaultSetTimout;
15192
+ }
15193
+
15194
+ try {
15195
+ if (typeof clearTimeout === 'function') {
15196
+ cachedClearTimeout = clearTimeout;
15197
+ } else {
15198
+ cachedClearTimeout = defaultClearTimeout;
15199
+ }
15200
+ } catch (e) {
15201
+ cachedClearTimeout = defaultClearTimeout;
15202
+ }
15203
+ })();
15204
+
15205
+ function runTimeout(fun) {
15206
+ if (cachedSetTimeout === setTimeout) {
15207
+ //normal enviroments in sane situations
15208
+ return setTimeout(fun, 0);
15209
+ } // if setTimeout wasn't available but was latter defined
15210
+
15211
+
15212
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
15213
+ cachedSetTimeout = setTimeout;
15214
+ return setTimeout(fun, 0);
15215
+ }
15216
+
15217
+ try {
15218
+ // when when somebody has screwed with setTimeout but no I.E. maddness
15219
+ return cachedSetTimeout(fun, 0);
15220
+ } catch (e) {
15221
+ try {
15222
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
15223
+ return cachedSetTimeout.call(null, fun, 0);
15224
+ } catch (e) {
15225
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
15226
+ return cachedSetTimeout.call(this, fun, 0);
15227
+ }
15228
+ }
15229
+ }
15230
+
15231
+ function runClearTimeout(marker) {
15232
+ if (cachedClearTimeout === clearTimeout) {
15233
+ //normal enviroments in sane situations
15234
+ return clearTimeout(marker);
15235
+ } // if clearTimeout wasn't available but was latter defined
15236
+
15237
+
15238
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
15239
+ cachedClearTimeout = clearTimeout;
15240
+ return clearTimeout(marker);
15241
+ }
15242
+
15243
+ try {
15244
+ // when when somebody has screwed with setTimeout but no I.E. maddness
15245
+ return cachedClearTimeout(marker);
15246
+ } catch (e) {
15247
+ try {
15248
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
15249
+ return cachedClearTimeout.call(null, marker);
15250
+ } catch (e) {
15251
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
15252
+ // Some versions of I.E. have different rules for clearTimeout vs setTimeout
15253
+ return cachedClearTimeout.call(this, marker);
15254
+ }
15255
+ }
15256
+ }
15257
+
15258
+ var queue = [];
15259
+ var draining = false;
15260
+ var currentQueue;
15261
+ var queueIndex = -1;
15262
+
15263
+ function cleanUpNextTick() {
15264
+ if (!draining || !currentQueue) {
15265
+ return;
15266
+ }
15267
+
15268
+ draining = false;
15269
+
15270
+ if (currentQueue.length) {
15271
+ queue = currentQueue.concat(queue);
15272
+ } else {
15273
+ queueIndex = -1;
15274
+ }
15275
+
15276
+ if (queue.length) {
15277
+ drainQueue();
15278
+ }
15279
+ }
15280
+
15281
+ function drainQueue() {
15282
+ if (draining) {
15283
+ return;
15284
+ }
15285
+
15286
+ var timeout = runTimeout(cleanUpNextTick);
15287
+ draining = true;
15288
+ var len = queue.length;
15289
+
15290
+ while (len) {
15291
+ currentQueue = queue;
15292
+ queue = [];
15293
+
15294
+ while (++queueIndex < len) {
15295
+ if (currentQueue) {
15296
+ currentQueue[queueIndex].run();
15297
+ }
15298
+ }
15299
+
15300
+ queueIndex = -1;
15301
+ len = queue.length;
15302
+ }
15303
+
15304
+ currentQueue = null;
15305
+ draining = false;
15306
+ runClearTimeout(timeout);
15307
+ }
15308
+
15309
+ process.nextTick = function (fun) {
15310
+ var args = new Array(arguments.length - 1);
15311
+
15312
+ if (arguments.length > 1) {
15313
+ for (var i = 1; i < arguments.length; i++) {
15314
+ args[i - 1] = arguments[i];
15315
+ }
15316
+ }
15317
+
15318
+ queue.push(new Item(fun, args));
15319
+
15320
+ if (queue.length === 1 && !draining) {
15321
+ runTimeout(drainQueue);
15322
+ }
15323
+ }; // v8 likes predictible objects
15324
+
15325
+
15326
+ function Item(fun, array) {
15327
+ this.fun = fun;
15328
+ this.array = array;
15329
+ }
15330
+
15331
+ Item.prototype.run = function () {
15332
+ this.fun.apply(null, this.array);
15333
+ };
15334
+
15335
+ process.title = 'browser';
15336
+ process.env = {};
15337
+ process.argv = [];
15338
+ process.version = ''; // empty string to avoid regexp issues
15339
+
15340
+ process.versions = {};
15341
+
15342
+ function noop() {}
15343
+
15344
+ process.on = noop;
15345
+ process.addListener = noop;
15346
+ process.once = noop;
15347
+ process.off = noop;
15348
+ process.removeListener = noop;
15349
+ process.removeAllListeners = noop;
15350
+ process.emit = noop;
15351
+ process.prependListener = noop;
15352
+ process.prependOnceListener = noop;
15353
+
15354
+ process.listeners = function (name) {
15355
+ return [];
15356
+ };
15357
+
15358
+ process.binding = function (name) {
15359
+ throw new Error('process.binding is not supported');
15360
+ };
15361
+
15362
+ process.cwd = function () {
15363
+ return '/';
15364
+ };
15365
+
15366
+ process.chdir = function (dir) {
15367
+ throw new Error('process.chdir is not supported');
15368
+ };
15369
+
15370
+ process.umask = function () {
15371
+ return 0;
15372
+ };
15373
+ },{}],"../../WPTB_ResponsiveFrontend.js":[function(require,module,exports) {
15374
+ var global = arguments[3];
15375
+ var process = require("process");
15376
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
15377
+
15378
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
15379
+
15380
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15381
+
15382
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
15383
+
15384
+ /**
15385
+ * Responsive class assignment for frontend operations.
15386
+ *
15387
+ * This file can be used as an UMD.
15388
+ */
15389
+ (function assignToGlobal(key, context, factory) {
15390
+ if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined') {
15391
+ module.exports = factory();
15392
+ } else {
15393
+ // eslint-disable-next-line no-param-reassign
15394
+ context[key] = factory();
15395
+ } // eslint-disable-next-line no-restricted-globals
15396
+
15397
+ })('WPTB_ResponsiveFrontend', self || global, function () {
15398
+ /**
15399
+ * Log a message to console.
15400
+ *
15401
+ * @param {string} message message to be logged
15402
+ * @param {string} type console log type (e.g info, warn, error)
15403
+ * @throws An error will be given for invalid type value
15404
+ */
15405
+ function logToConsole(message) {
15406
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'log';
15407
+
15408
+ if (typeof process !== 'undefined' && "development" === 'development') {
15409
+ // eslint-disable-next-line no-console
15410
+ if (console[type]) {
15411
+ // eslint-disable-next-line no-console
15412
+ console[type]("[WPTB]: ".concat(message));
15413
+ } else {
15414
+ throw new Error("no logging type found with given type value of [".concat(type, "]"));
15415
+ }
15416
+ }
15417
+ }
15418
+ /**
15419
+ * Object implementation for cell element operations.
15420
+ * If an empty cellElement parameter is given, a fresh cell element will be created.
15421
+ *
15422
+ * @param {HTMLElement | null} cellElement cell element
15423
+ * @param {null | CellObject} reference main cell object if the current cell is a reference to that cell in cases like merged cells
15424
+ * @class
15425
+ */
15426
+
15427
+
15428
+ function CellObject(cellElement) {
15429
+ var _this = this;
15430
+
15431
+ var reference = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
15432
+ // cell element
15433
+ this.element = cellElement;
15434
+ this.referenceObject = reference; // variable for deciding part of merged cells to be visible or not
15435
+
15436
+ this.mergedRenderStatus = true; // connected merged cell references
15437
+
15438
+ this.mergedCells = {
15439
+ row: [],
15440
+ column: []
15441
+ };
15442
+ /**
15443
+ * Get merged render status.
15444
+ *
15445
+ * @return {boolean} render status
15446
+ */
15447
+
15448
+ this.getMergedRenderStatus = function () {
15449
+ return _this.mergedRenderStatus;
15450
+ };
15451
+ /**
15452
+ * Set merged render status.
15453
+ *
15454
+ * @param {boolean} status render status
15455
+ */
15456
+
15457
+
15458
+ this.setMergedRenderStatus = function (status) {
15459
+ _this.mergedRenderStatus = status;
15460
+ };
15461
+ /**
15462
+ * Add merged cells.
15463
+ *
15464
+ * @param {string} mergeType merge type
15465
+ * @param {CellObject} cellObj cell object instance
15466
+ */
15467
+
15468
+
15469
+ this.addToMergedCells = function (mergeType, cellObj) {
15470
+ _this.mergedCells[mergeType].push(cellObj);
15471
+ };
15472
+ /**
15473
+ * Determine if current cell is a reference to a main cell.
15474
+ *
15475
+ * @return {boolean} a reference or not
15476
+ */
15477
+
15478
+
15479
+ this.isReference = function () {
15480
+ return _this.referenceObject !== null;
15481
+ };
15482
+
15483
+ if (this.isReference()) {
15484
+ this.element = cellElement.cloneNode(true);
15485
+ } // modifications object
15486
+ // this object will keep track of the modifications that has done to the cell to make sure we can roll them back to their original values
15487
+
15488
+
15489
+ this.modifications = {}; // spans object for cell's original merge values
15490
+
15491
+ this.spans = {
15492
+ row: 1,
15493
+ col: 1
15494
+ };
15495
+ this.remainingSpans = {
15496
+ row: 0,
15497
+ col: 0
15498
+ };
15499
+ /**
15500
+ * Cache cell element's original span values.
15501
+ *
15502
+ * @private
15503
+ */
15504
+
15505
+ this.cacheSpanValues = function () {
15506
+ // eslint-disable-next-line array-callback-return
15507
+ Object.keys(_this.spans).map(function (k) {
15508
+ if (Object.prototype.hasOwnProperty.call(_this.spans, k)) {
15509
+ var defaultVal = _this.spans[k];
15510
+ _this.spans[k] = _this.element.getAttribute("".concat(k, "Span")) || defaultVal;
15511
+ }
15512
+ });
15513
+ };
15514
+
15515
+ this.cacheSpanValues();
15516
+ /**
15517
+ * Get original span value of cell object.
15518
+ *
15519
+ * @param {string} spanType span type, available values are row-column
15520
+ * @param {boolean} fromElement instead of original value, get the assigned span value from HTMLElement itself
15521
+ * @throws An error will be given for invalid span type
15522
+ */
15523
+
15524
+ this.getSpan = function (spanType) {
15525
+ var fromElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
15526
+ var spanVal = fromElement ? _this.getElement().getAttribute("".concat(spanType, "Span")) : _this.spans[spanType];
15527
+
15528
+ if (spanVal) {
15529
+ return spanVal;
15530
+ }
15531
+
15532
+ throw new Error("no span value found with the given type of [".concat(spanType, "]"));
15533
+ };
15534
+
15535
+ this.getRemainingSpans = function (spanType) {
15536
+ return _this.remainingSpans[spanType];
15537
+ };
15538
+
15539
+ this.setRemainingSpans = function (spanType, value) {
15540
+ _this.remainingSpans[spanType] = value;
15541
+ };
15542
+ /**
15543
+ * Get cell element.
15544
+ *
15545
+ * @return {HTMLElement} cell element
15546
+ */
15547
+
15548
+
15549
+ this.getElement = function () {
15550
+ return _this.element;
15551
+ };
15552
+ /**
15553
+ * Create a cell element.
15554
+ *
15555
+ * @private
15556
+ * @return {HTMLTableDataCellElement}
15557
+ */
15558
+
15559
+
15560
+ this.createCellElement = function () {
15561
+ return document.createElement('td');
15562
+ }; // create a new cell element if no cellElement argument is given with constructor function
15563
+
15564
+
15565
+ if (!cellElement) {
15566
+ this.element = this.createCellElement();
15567
+ }
15568
+ /**
15569
+ * Add attribute to cell element.
15570
+ *
15571
+ * This function have the ability to add/remove attributes from cell element.
15572
+ * All attributes modified with this function will be cached with their before value for an easy reset on demand.
15573
+ *
15574
+ * @param {string} attributeKey attribute name in camelCase format, for sub-keys, use dot object notation
15575
+ * @param {any} attributeValue attribute value
15576
+ * @param {boolean} [append=false] append the value or replace it
15577
+ * @param {string} [glue=,] glue to join attribute value if append option is enabled
15578
+ */
15579
+
15580
+
15581
+ this.setAttribute = function (attributeKey, attributeValue) {
15582
+ var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
15583
+ var glue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ',';
15584
+
15585
+ var defaultVal = _this.getElement()[attributeKey]; // if attribute value is a function or an object, it means we pulled a whole declaration instead of only inline attribute values, in that case, use getAttribute to get only inline values related to that attribute
15586
+
15587
+
15588
+ if (typeof defaultVal === 'function' || _typeof(defaultVal) === 'object') {
15589
+ defaultVal = _this.getElement().getAttribute(attributeKey);
15590
+ } // if there is already a default value defined, use that instead
15591
+
15592
+
15593
+ if (_this.modifications[attributeKey]) {
15594
+ defaultVal = _this.modifications[attributeKey].default;
15595
+ }
15596
+
15597
+ var currentVal = defaultVal; // join attributes
15598
+
15599
+ if (append) {
15600
+ currentVal += "".concat(currentVal).concat(glue).concat(attributeValue);
15601
+ } else {
15602
+ currentVal = attributeValue;
15603
+ }
15604
+
15605
+ _this.modifications[attributeKey] = {
15606
+ value: currentVal,
15607
+ default: defaultVal
15608
+ };
15609
+ _this.getElement()[attributeKey] = currentVal;
15610
+ };
15611
+ /**
15612
+ * Set row/colspan for cell.
15613
+ *
15614
+ * @param {string} spanType span type
15615
+ * @param {number} value value to assign to span
15616
+ * @return {boolean} if any space left to render the element
15617
+ */
15618
+
15619
+
15620
+ this.setSpan = function (spanType, value) {
15621
+ // working on main cell
15622
+ if (!_this.isReference()) {
15623
+ var _valueToApply = _this.getSpan(spanType) - value < 0 ? _this.getSpan(spanType) : value;
15624
+
15625
+ _this.setAttribute("".concat(spanType, "Span"), _valueToApply); // calculate remaining cells amount to merge in this span type
15626
+
15627
+
15628
+ _this.setRemainingSpans(spanType, _this.getSpan(spanType) - _valueToApply); // set visibility of connected merge group cells to false to not render them since we added necessary span values to main cell which will leak into their position
15629
+
15630
+
15631
+ for (var mc = 0; mc < _valueToApply - 1; mc += 1) {
15632
+ if (_this.mergedCells[spanType] && _this.mergedCells[spanType][mc]) {
15633
+ _this.mergedCells[spanType][mc].setMergedRenderStatus(false);
15634
+ }
15635
+ }
15636
+
15637
+ return true;
15638
+ } // working on reference
15639
+
15640
+
15641
+ if (!_this.getMergedRenderStatus()) {
15642
+ return false;
15643
+ }
15644
+
15645
+ var remainingVal = _this.referenceObject.getRemainingSpans(spanType); // no space left to put cell
15646
+
15647
+
15648
+ if (remainingVal === 0) {
15649
+ return false;
15650
+ }
15651
+
15652
+ var valueToApply = remainingVal - value < 0 ? remainingVal : value;
15653
+ var remainingParentSpans = remainingVal - valueToApply;
15654
+
15655
+ _this.referenceObject.setRemainingSpans(spanType, remainingParentSpans);
15656
+
15657
+ _this.setAttribute("".concat(spanType, "Span"), valueToApply); // change render status of remaining connected merge cells
15658
+
15659
+
15660
+ if (remainingParentSpans !== 0) {
15661
+ var totalConnectedCells = _this.referenceObject.mergedCells[spanType].length;
15662
+ var startIndex = totalConnectedCells - remainingVal + 1;
15663
+ var endIndex = startIndex + valueToApply - 1;
15664
+
15665
+ for (var _mc = startIndex; _mc < endIndex; _mc += 1) {
15666
+ _this.mergedCells[spanType][_mc].setMergedRenderStatus(false);
15667
+ }
15668
+ }
15669
+
15670
+ return true;
15671
+ };
15672
+ /**
15673
+ * Reset a modified attribute to its default value
15674
+ *
15675
+ * @param {string} attributeKey attribute name
15676
+ */
15677
+
15678
+
15679
+ this.resetAttribute = function (attributeKey) {
15680
+ if (_this.modifications[attributeKey]) {
15681
+ _this.getElement()[attributeKey] = _this.modifications[attributeKey].default;
15682
+ _this.modifications[attributeKey] = undefined;
15683
+ }
15684
+ };
15685
+ /**
15686
+ * Reset all modified attributes of cell element to their default values.
15687
+ */
15688
+
15689
+
15690
+ this.resetAllAttributes = function () {
15691
+ // eslint-disable-next-line array-callback-return
15692
+ Object.keys(_this.modifications).map(function (k) {
15693
+ if (Object.prototype.hasOwnProperty.call(_this.modifications, k)) {
15694
+ _this.resetAttribute(k);
15695
+ }
15696
+ });
15697
+ };
15698
+
15699
+ return {
15700
+ getElement: this.getElement,
15701
+ el: this.element,
15702
+ setAttribute: this.setAttribute,
15703
+ resetAllAttributes: this.resetAllAttributes,
15704
+ getSpan: this.getSpan,
15705
+ setSpan: this.setSpan,
15706
+ getRemainingSpans: this.getRemainingSpans,
15707
+ setRemainingSpans: this.setRemainingSpans,
15708
+ isReference: this.isReference,
15709
+ addToMergedCells: this.addToMergedCells,
15710
+ mergedCells: this.mergedCells,
15711
+ setMergedRenderStatus: this.setMergedRenderStatus,
15712
+ getMergedRenderStatus: this.getMergedRenderStatus
15713
+ };
15714
+ }
15715
+
15716
+ CellObject.spanTypes = {
15717
+ row: 'row',
15718
+ column: 'col'
15719
+ };
15720
+ /**
15721
+ * Object implementation for table element operations.
15722
+ *
15723
+ * @param {HTMLElement} tableEl table element
15724
+ * @return {Object} instance
15725
+ * @class
15726
+ */
15727
+
15728
+ function TableObject(tableEl) {
15729
+ var _this2 = this;
15730
+
15731
+ /**
15732
+ * Table element.
15733
+ *
15734
+ * @private
15735
+ * @type {HTMLElement}
15736
+ */
15737
+ this.tableElement = tableEl;
15738
+ /**
15739
+ * Parsed table object.
15740
+ *
15741
+ * @private
15742
+ * @type {Array}
15743
+ */
15744
+
15745
+ this.parsedTable = [];
15746
+ /**
15747
+ * An array of created table rows elements that are id'd according to their index in array.
15748
+ *
15749
+ * @type {Array}
15750
+ */
15751
+
15752
+ this.rowCache = [];
15753
+ /**
15754
+ * Original table elements minus the cells.
15755
+ *
15756
+ * @type {Object}
15757
+ * @private
15758
+ */
15759
+
15760
+ this.originals = {
15761
+ rows: []
15762
+ };
15763
+ /**
15764
+ * Row colors of original table.
15765
+ *
15766
+ * @type {{even: string, header: string, odd: string}}
15767
+ */
15768
+
15769
+ this.rowColors = {
15770
+ header: null,
15771
+ even: null,
15772
+ odd: null
15773
+ };
15774
+ /**
15775
+ * Add cell to parsed array.
15776
+ *
15777
+ * @private
15778
+ * @param {number} r row id
15779
+ * @param {number} c column id
15780
+ * @param {CellObject} cellObject cell object to add to parsed array
15781
+ */
15782
+
15783
+ this.addToParsed = function (r, c, cellObject) {
15784
+ if (!_this2.parsedTable[r]) {
15785
+ _this2.parsedTable[r] = [];
15786
+ }
15787
+
15788
+ _this2.parsedTable[r][c] = cellObject;
15789
+ };
15790
+ /**
15791
+ * Assign table cells into row and column numbers.
15792
+ *
15793
+ * @private
15794
+ */
15795
+
15796
+
15797
+ this.parseTable = function () {
15798
+ var rows = Array.from(_this2.tableElement.querySelectorAll('tr')); // eslint-disable-next-line array-callback-return
15799
+
15800
+ rows.map(function (r, ri) {
15801
+ // cache original rows for future use
15802
+ _this2.originals.rows.push(r);
15803
+
15804
+ var cells = Array.from(r.querySelectorAll('td'));
15805
+ var currentIndex = 0; // eslint-disable-next-line array-callback-return
15806
+
15807
+ cells.map(function (c, ci) {
15808
+ var currentCellObject = new CellObject(c);
15809
+
15810
+ _this2.addToParsed(ri, currentIndex, currentCellObject);
15811
+
15812
+ currentIndex += 1;
15813
+ var spanRow = currentCellObject.getSpan(CellObject.spanTypes.row);
15814
+ var spanCol = currentCellObject.getSpan(CellObject.spanTypes.column);
15815
+
15816
+ if (spanRow > 1) {
15817
+ for (var sr = 1; sr < spanRow; sr += 1) {
15818
+ var referenceCell = new CellObject(c, currentCellObject);
15819
+ currentCellObject.addToMergedCells('row', referenceCell);
15820
+
15821
+ _this2.addToParsed(ri + sr, ci, referenceCell);
15822
+ }
15823
+ }
15824
+
15825
+ if (spanCol > 1) {
15826
+ for (var sc = 1; sc < spanCol; sc += 1) {
15827
+ var _referenceCell = new CellObject(c, currentCellObject);
15828
+
15829
+ currentCellObject.addToMergedCells('column', _referenceCell);
15830
+
15831
+ _this2.addToParsed(ri, currentIndex, _referenceCell);
15832
+
15833
+ currentIndex += 1;
15834
+ }
15835
+ }
15836
+ });
15837
+ });
15838
+
15839
+ _this2.parseRowColors(rows);
15840
+ };
15841
+ /**
15842
+ * Parse row colors of original table for futures uses.
15843
+ *
15844
+ * @param {[HTMLElement]} rows html row elements
15845
+ * @private
15846
+ */
15847
+
15848
+
15849
+ this.parseRowColors = function (rows) {
15850
+ if (!rows || rows.length <= 0) {
15851
+ logToConsole('no rows are found to parse their colors', 'error');
15852
+ } // get row colors if they are defined as datasets on table element
15853
+
15854
+
15855
+ var headerDatasetColor = _this2.tableElement.dataset.wptbHeaderBackgroundColor;
15856
+ var evenRowDatasetColor = _this2.tableElement.dataset.wptbEvenRowBackgroundColor;
15857
+ var oddRowDatasetColor = _this2.tableElement.dataset.wptbOddRowBackgroundColor; // header row color
15858
+
15859
+ _this2.rowColors.header = // eslint-disable-next-line no-nested-ternary
15860
+ headerDatasetColor !== undefined ? headerDatasetColor : rows[0].style.backgroundColor === '' ? null : rows[0].style.backgroundColor; // calculate needed number of rows to get even and odd row background colors
15861
+ // eslint-disable-next-line no-nested-ternary
15862
+
15863
+ var rowsNeeded = rows.length / 3 >= 1 ? 0 : rows.length === 1 ? 2 : (rows.length - 1) % 2; // create additional rows and add them to table to get their row background colors since table row count may be lower to get even/odd rows
15864
+
15865
+ for (var rn = 0; rn < rowsNeeded; rn += 1) {
15866
+ var tempRow = document.createElement('tr');
15867
+
15868
+ _this2.tableElement.querySelector('tbody').appendChild(tempRow);
15869
+
15870
+ rows.push(tempRow);
15871
+ } // even & odd row colors
15872
+ // dataset colors have priority over colors gathered from computed row styles
15873
+
15874
+
15875
+ _this2.rowColors.even = evenRowDatasetColor || getComputedStyle(rows[1]).backgroundColor;
15876
+ _this2.rowColors.odd = evenRowDatasetColor ? oddRowDatasetColor : getComputedStyle(rows[2]).backgroundColor; // remove created rows from DOM
15877
+
15878
+ for (var r = 0; r < rowsNeeded; r += 1) {
15879
+ rows[rows.length - (r + 1)].remove();
15880
+ }
15881
+ };
15882
+ /**
15883
+ * Add a row to the table.
15884
+ *
15885
+ * @param {Array} classList an array of class names to be added to row
15886
+ * @param {boolean} fromOriginals use rows from original table instead of creating a new one
15887
+ * @param {number} originalIndex original row index
15888
+ */
15889
+
15890
+
15891
+ this.addRow = function (classList) {
15892
+ var fromOriginals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
15893
+ var originalIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
15894
+
15895
+ if (!Array.isArray(classList)) {
15896
+ // eslint-disable-next-line no-param-reassign
15897
+ classList = [classList];
15898
+ }
15899
+
15900
+ var tableBody = _this2.tableElement.querySelector('tbody');
15901
+
15902
+ var tempRow;
15903
+
15904
+ if (!fromOriginals) {
15905
+ var range = document.createRange();
15906
+ range.setStart(tableBody, 0); // eslint-disable-next-line prefer-destructuring
15907
+
15908
+ tempRow = range.createContextualFragment("<tr class=\"".concat(classList.join(' '), "\"></tr>")).childNodes[0];
15909
+ } else {
15910
+ tempRow = _this2.originals.rows[originalIndex];
15911
+ } // add row to table body
15912
+
15913
+
15914
+ tableBody.appendChild(tempRow); // cache row for future use
15915
+
15916
+ _this2.rowCache.push(tempRow);
15917
+
15918
+ return {
15919
+ el: tempRow,
15920
+ id: _this2.rowCache.length - 1
15921
+ };
15922
+ };
15923
+ /**
15924
+ * Clear the contents of table element.
15925
+ */
15926
+
15927
+
15928
+ this.clearTable = function () {
15929
+ // clear row cache
15930
+ _this2.rowCache = []; // clear children of `tbody` element
15931
+
15932
+ _this2.tableElement.querySelector('tbody').innerHTML = '';
15933
+ };
15934
+ /**
15935
+ * Get row element from cache.
15936
+ *
15937
+ * @param {number} id row id
15938
+ * @return {null|HTMLElement} row element if present or null if not
15939
+ */
15940
+
15941
+
15942
+ this.getRow = function (id) {
15943
+ if (_this2.rowCache[id]) {
15944
+ return _this2.rowCache[id];
15945
+ } // eslint-disable-next-line no-console
15946
+
15947
+
15948
+ logToConsole("no row with id [".concat(id, "] found in the cache."), 'warn');
15949
+ return null;
15950
+ };
15951
+ /**
15952
+ * Get maximum number of rows available at table.
15953
+ *
15954
+ * @return {number} maximum amount of rows
15955
+ */
15956
+
15957
+
15958
+ this.maxRows = function () {
15959
+ return _this2.parsedTable.length;
15960
+ };
15961
+ /**
15962
+ * Get the number of maximum available column count in the table.
15963
+ *
15964
+ * @param mergedHeader
15965
+ * @return {number} maximum available column count
15966
+ */
15967
+
15968
+
15969
+ this.maxColumns = function (mergedHeader) {
15970
+ if (mergedHeader) {
15971
+ return _this2.parsedTable[0].length;
15972
+ }
15973
+
15974
+ return _this2.parsedTable.reduce(function (p, c) {
15975
+ if (c.length > p) {
15976
+ // eslint-disable-next-line no-param-reassign
15977
+ p = c.length;
15978
+ }
15979
+
15980
+ return p;
15981
+ }, 0);
15982
+ };
15983
+ /**
15984
+ * Get the table cell at specified row-column location.
15985
+ *
15986
+ * As in arrays, row and column numbering starts from number 0.
15987
+ *
15988
+ * @param {number} r row number
15989
+ * @param {number} c column number
15990
+ * @param {boolean} returnObject return object instead of HTMLElement
15991
+ * @return {HTMLElement | null | CellObject} element if address is possible, null if not
15992
+ */
15993
+
15994
+
15995
+ this.getCell = function (r, c) {
15996
+ var returnObject = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
15997
+
15998
+ try {
15999
+ if (_this2.parsedTable[r][c]) {
16000
+ if (returnObject) {
16001
+ return _this2.parsedTable[r][c];
16002
+ }
16003
+
16004
+ return _this2.parsedTable[r][c].el;
16005
+ }
16006
+ } catch (e) {
16007
+ // eslint-disable-next-line no-console
16008
+ logToConsole("no cell found at the given address of [".concat(r, "-").concat(c, "]"), 'warn');
16009
+ return null;
16010
+ } // eslint-disable-next-line no-console
16011
+
16012
+
16013
+ logToConsole("no cell found at the given address of [".concat(r, "-").concat(c, "]"), 'warn');
16014
+ return null;
16015
+ };
16016
+ /**
16017
+ * Get cells at a given row.
16018
+ *
16019
+ * @param {number} rowId row id
16020
+ * @param {boolean} returnObj return an array of CellObject instead
16021
+ * @return {Array} cells in row
16022
+ */
16023
+
16024
+
16025
+ this.getCellsAtRow = function (rowId) {
16026
+ var returnObj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
16027
+ var cells = [];
16028
+
16029
+ for (var c = 0; c < _this2.maxColumns(); c += 1) {
16030
+ var tempCell = _this2.getCell(rowId, c, returnObj);
16031
+
16032
+ if (tempCell) {
16033
+ cells.push(tempCell);
16034
+ }
16035
+ }
16036
+
16037
+ return cells;
16038
+ };
16039
+ /**
16040
+ * Append the cell with given ids to a cached row
16041
+ *
16042
+ * @param {number} cellRowId cell row id
16043
+ * @param {number} cellColumnId cell column id
16044
+ * @param {number} rowId id of row in row cache
16045
+ */
16046
+
16047
+
16048
+ this.appendToRow = function (cellRowId, cellColumnId, rowId) {
16049
+ var cachedRow = _this2.getRow(rowId);
16050
+
16051
+ var cell = _this2.getCell(cellRowId, cellColumnId, true);
16052
+
16053
+ if (cell && cachedRow) {
16054
+ cachedRow.appendChild(cell.getElement());
16055
+ }
16056
+
16057
+ return cell;
16058
+ };
16059
+ /**
16060
+ * Append html element to a cached row.
16061
+ *
16062
+ * @param {HTMLElement} el element
16063
+ * @param {number} rowId if of row in row cache
16064
+ */
16065
+
16066
+
16067
+ this.appendElementToRow = function (el, rowId) {
16068
+ var cachedRow = _this2.getRow(rowId);
16069
+
16070
+ if (el && cachedRow) {
16071
+ cachedRow.appendChild(el);
16072
+ }
16073
+ };
16074
+ /**
16075
+ * Add cell object to a cached row.
16076
+ *
16077
+ * @param {CellObject} cellObj cell object
16078
+ * @param {number} rowId row id
16079
+ */
16080
+
16081
+
16082
+ this.appendObjectToRow = function (cellObj, rowId) {
16083
+ var cachedRow = _this2.getRow(rowId);
16084
+
16085
+ if (cellObj && cachedRow) {
16086
+ cachedRow.appendChild(cellObj.getElement());
16087
+ }
16088
+ };
16089
+
16090
+ this.getParsedTable = function () {
16091
+ return _this2.parsedTable;
16092
+ };
16093
+
16094
+ this.parseTable();
16095
+ return {
16096
+ maxRows: this.maxRows,
16097
+ maxColumns: this.maxColumns,
16098
+ addRow: this.addRow,
16099
+ clearTable: this.clearTable,
16100
+ getCell: this.getCell,
16101
+ appendToRow: this.appendToRow,
16102
+ appendElementToRow: this.appendElementToRow,
16103
+ appendObjectToRow: this.appendObjectToRow,
16104
+ getCellsAtRow: this.getCellsAtRow,
16105
+ el: this.tableElement,
16106
+ rowColors: this.rowColors,
16107
+ getParsedTable: this.getParsedTable
16108
+ };
16109
+ } // default options for responsive class
16110
+
16111
+
16112
+ var responsiveClassDefaultOptions = {
16113
+ query: '.wptb-preview-table',
16114
+ defaultClasses: ['wptb-plugin-responsive-base'],
16115
+ bindToResize: false
16116
+ };
16117
+ /**
16118
+ * Class for handling operations related to responsive functionalities of tables.
16119
+ *
16120
+ * @class
16121
+ * @param {Object} options options object
16122
+ */
16123
+
16124
+ function ResponsiveFront() {
16125
+ var _this3 = this;
16126
+
16127
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16128
+ // merge default options with user sent options
16129
+ // this.options = { ...responsiveClassDefaultOptions, ...options };
16130
+ this.options = _objectSpread(_objectSpread({}, responsiveClassDefaultOptions), options);
16131
+ this.elements = Array.from(document.querySelectorAll(this.options.query));
16132
+ this.elementObjects = this.elements.map(function (e) {
16133
+ return {
16134
+ el: e,
16135
+ tableObject: new TableObject(e)
16136
+ };
16137
+ });
16138
+ /**
16139
+ * Bind rebuilding of tables to window resize event.
16140
+ */
16141
+
16142
+ this.bindRebuildToResize = function () {
16143
+ window.addEventListener('resize', function () {
16144
+ _this3.rebuildTables();
16145
+ });
16146
+ };
16147
+ /**
16148
+ * Get responsive directives of table element.
16149
+ *
16150
+ * @private
16151
+ * @param {HTMLElement} el table element
16152
+ * @return {Object | null} JSON representation of the directive element, if not available, null will be returned
16153
+ */
16154
+
16155
+
16156
+ this.getDirective = function (el) {
16157
+ var directiveString = el.dataset.wptbResponsiveDirectives;
16158
+
16159
+ if (!directiveString) {
16160
+ return null;
16161
+ }
16162
+
16163
+ return JSON.parse(atob(directiveString));
16164
+ };
16165
+ /**
16166
+ * Add default classes to rebuilt tables.
16167
+ *
16168
+ * This classes are added to lay out a base style for the responsive table.
16169
+ *
16170
+ * @param {HTMLElement} el table element
16171
+ */
16172
+
16173
+
16174
+ this.addDefaultClasses = function (el) {
16175
+ el.classList.add(_this3.options.defaultClasses);
16176
+ };
16177
+ /**
16178
+ * Remove default classes from target table.
16179
+ *
16180
+ * @param {HTMLElement} el table element
16181
+ */
16182
+
16183
+
16184
+ this.removeDefaultClasses = function (el) {
16185
+ el.classList.remove(_this3.options.defaultClasses);
16186
+ };
16187
+ /**
16188
+ * Rebuild table in auto mode.
16189
+ *
16190
+ * Main characteristic of auto mode is table is rebuilt by stacking rows/columns on top of each other, leaving minimal effort from user to create a responsive table at breakpoints.
16191
+ *
16192
+ * @param {HTMLElement} tableEl table element
16193
+ * @param {string} sizeRange range id for current screen size
16194
+ * @param {Object} autoOption mode options
16195
+ * @param {TableObject} tableObj table object
16196
+ */
16197
+
16198
+
16199
+ this.autoBuild = function (tableEl, sizeRange, autoOption, tableObj) {
16200
+ // base options
16201
+ var direction = autoOption.cellStackDirection[sizeRange]; // eslint-disable-next-line prefer-destructuring
16202
+
16203
+ var topRowAsHeader = autoOption.topRowAsHeader[sizeRange];
16204
+ var cellsPerRow = autoOption.cellsPerRow[sizeRange]; // new options
16205
+
16206
+ var staticTopRow = autoOption.staticTopRow ? autoOption.staticTopRow[sizeRange] : false;
16207
+ var repeatMergedHeader = // check for undefined for backward compatibility of older tables
16208
+
16209
+ /* eslint-disable no-nested-ternary */
16210
+ autoOption.repeatMergedHeader === undefined || autoOption.repeatMergedHeader[sizeRange] === true ? topRowAsHeader ? autoOption.repeatMergedHeader ? autoOption.repeatMergedHeader[sizeRange] : true : false : false;
16211
+ /* eslint-enable no-nested-ternary */
16212
+
16213
+ tableObj.clearTable();
16214
+
16215
+ if (sizeRange === 'desktop') {
16216
+ _this3.buildDefault(tableObj);
16217
+
16218
+ _this3.removeDefaultClasses(tableEl);
16219
+ } else {
16220
+ _this3.autoDirectionBuild(tableObj, direction, topRowAsHeader, staticTopRow, cellsPerRow, repeatMergedHeader);
16221
+
16222
+ _this3.addDefaultClasses(tableEl);
16223
+ }
16224
+ };
16225
+ /**
16226
+ * Rebuild table with a direction to read cells.
16227
+ *
16228
+ * Direction in question in here is either by row or column:
16229
+ * * row: cells will be read row by row, in each row starting from the first column
16230
+ * * column: cells will be read column by column, in each column starting from the first row of the table
16231
+ *
16232
+ * @param {TableObject} tableObj table object
16233
+ * @param {string} direction direction to read cells, possible options [row, column]
16234
+ * @param {boolean} topRowAsHeader use top row as header
16235
+ * @param {boolean} staticTopRow use top row as static
16236
+ * @param {number} cellsPerRow cells per row
16237
+ * @param {boolean} repeatMergedHeader repeat merged top header if top row as header option is enabled
16238
+ */
16239
+
16240
+
16241
+ this.autoDirectionBuild = function (tableObj, direction) {
16242
+ var topRowAsHeader = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
16243
+ var staticTopRow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
16244
+ var cellsPerRow = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
16245
+ var repeatMergedHeader = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
16246
+ var rows = tableObj.maxRows();
16247
+ var columns = tableObj.maxColumns();
16248
+ var isRowStacked = direction === 'row'; // build table with top row as header
16249
+
16250
+ if (topRowAsHeader) {
16251
+ _this3.headerBuild(tableObj, direction, cellsPerRow, repeatMergedHeader);
16252
+ } else {
16253
+ // cell stack direction is selected as row
16254
+ // for future new functionality additions, keep different cell stack direction logic separate instead of generalizing the inner logic
16255
+ // eslint-disable-next-line no-lonely-if
16256
+ if (isRowStacked) {
16257
+ (function () {
16258
+ var allCellsByRow = [];
16259
+ var rowStartIndex = 0; // static top row option is enabled
16260
+
16261
+ if (staticTopRow) {
16262
+ var topCells = tableObj.getCellsAtRow(0, true);
16263
+ var baseCells = topCells.filter(function (c) {
16264
+ return !c.isReference();
16265
+ }); // eslint-disable-next-line array-callback-return
16266
+
16267
+ baseCells.map(function (b) {
16268
+ rowStartIndex += 1;
16269
+ var rowObj = tableObj.addRow('wptb-row');
16270
+ tableObj.appendObjectToRow(b, rowObj.id);
16271
+
16272
+ if (!b.el.style.backgroundColor) {
16273
+ var bgColor = tableObj.rowColors.header ? tableObj.rowColors.header : getComputedStyle(rowObj.el).backgroundColor;
16274
+ b.setAttribute('style', "background-color: ".concat(bgColor), true, ';');
16275
+ }
16276
+
16277
+ rowObj.el.style.backgroundColor = '#ffffff00';
16278
+ b.setAttribute('colSpan', cellsPerRow);
16279
+ });
16280
+ } // get cells by reading row by row
16281
+
16282
+
16283
+ for (var r = rowStartIndex; r < rows; r += 1) {
16284
+ // eslint-disable-next-line no-loop-func
16285
+ tableObj.getCellsAtRow(r, true).forEach(function (c) {
16286
+ // only use non reference cells to avoid duplication for non top row as header tables
16287
+ if (!c.isReference()) {
16288
+ allCellsByRow.push(c);
16289
+ }
16290
+ });
16291
+ }
16292
+
16293
+ var cellCount = allCellsByRow.length;
16294
+
16295
+ for (var c = 0, _r = 0; c < cellCount; c += cellsPerRow, _r += 1) {
16296
+ // const rowId = tableObj.addRow('wptb-row').id;
16297
+ var rowObj = tableObj.addRow('wptb-row'); // place cells by 'cells by row' option value
16298
+
16299
+ for (var pR = 0; pR < cellsPerRow; pR += 1) {
16300
+ var tempCell = allCellsByRow[c + pR];
16301
+
16302
+ if (tempCell) {
16303
+ tableObj.appendElementToRow(tempCell.getElement(), rowObj.id);
16304
+ tempCell.resetAllAttributes();
16305
+ tempCell.setAttribute('style', 'width: 100% !important', true, ';');
16306
+ tempCell.setAttribute('colSpan', 1);
16307
+ tempCell.setAttribute('rowSpan', 1);
16308
+
16309
+ if (!tempCell.el.style.backgroundColor) {
16310
+ // @deprecated
16311
+ // const bgColor =
16312
+ // r === 0
16313
+ // ? tableObj.rowColors.header
16314
+ // ? tableObj.rowColors.header
16315
+ // : getComputedStyle(rowObj.el).backgroundColor
16316
+ // : tableObj.rowColors[r % 2 === 0 ? 'odd' : 'even'];
16317
+ var currentTableColor = tableObj.rowColors[(rowStartIndex + _r) % 2 === 0 ? 'odd' : 'even'];
16318
+ tempCell.el.style.backgroundColor = currentTableColor || getComputedStyle(rowObj.el).backgroundColor;
16319
+ }
16320
+ }
16321
+ } // preserve original row colors for even and odd rows
16322
+
16323
+
16324
+ rowObj.el.style.backgroundColor = '#ffffff00';
16325
+ }
16326
+ })();
16327
+ } // cell stack direction is selected as column
16328
+ else {
16329
+ var allCellsByCol = [];
16330
+ var rowStartIndex = 0; // static top row option is enabled
16331
+
16332
+ if (staticTopRow) {
16333
+ var topCells = tableObj.getCellsAtRow(0, true);
16334
+ var baseCells = topCells.filter(function (t) {
16335
+ return !t.isReference();
16336
+ }); // eslint-disable-next-line array-callback-return
16337
+
16338
+ baseCells.map(function (b) {
16339
+ rowStartIndex += 1;
16340
+ var rowObj = tableObj.addRow('wptb-row');
16341
+ tableObj.appendObjectToRow(b, rowObj.id);
16342
+
16343
+ if (!b.el.style.backgroundColor) {
16344
+ var bgColor = tableObj.rowColors.header ? tableObj.rowColors.header : getComputedStyle(rowObj.el).backgroundColor; // eslint-disable-next-line no-param-reassign
16345
+
16346
+ b.el.style.backgroundColor = bgColor;
16347
+ }
16348
+
16349
+ rowObj.el.style.backgroundColor = '#ffffff00';
16350
+ b.setAttribute('colSpan', cellsPerRow);
16351
+ });
16352
+ } // read all cells column by column
16353
+
16354
+
16355
+ for (var c = 0; c < columns; c += 1) {
16356
+ for (var r = rowStartIndex; r < rows; r += 1) {
16357
+ var tCell = tableObj.getCell(r, c, true); // only use non reference cells to avoid duplication for non top row as header tables
16358
+
16359
+ if (tCell && !tCell.isReference()) {
16360
+ allCellsByCol.push(tCell);
16361
+ }
16362
+ }
16363
+ }
16364
+
16365
+ var cellCount = allCellsByCol.length;
16366
+
16367
+ for (var _c = 0, _r2 = 0; _c < cellCount; _c += cellsPerRow, _r2 += 1) {
16368
+ var rowObj = tableObj.addRow('wptb-row');
16369
+
16370
+ for (var cR = 0; cR < cellsPerRow; cR += 1) {
16371
+ var tempCell = allCellsByCol[_c + cR];
16372
+
16373
+ if (tempCell) {
16374
+ tableObj.appendElementToRow(tempCell.getElement(), rowObj.id);
16375
+ tempCell.resetAllAttributes();
16376
+ tempCell.setAttribute('style', 'width: 100% !important', true, ';');
16377
+ tempCell.setAttribute('colSpan', 1);
16378
+ tempCell.setAttribute('rowSpan', 1);
16379
+
16380
+ if (!tempCell.el.style.backgroundColor) {
16381
+ var bgColor = _r2 === 0 ? tableObj.rowColors.header ? tableObj.rowColors.header : getComputedStyle(rowObj.el).backgroundColor : tableObj.rowColors[_r2 % 2 === 0 ? 'odd' : 'even'];
16382
+ tempCell.el.style.backgroundColor = bgColor;
16383
+ }
16384
+ }
16385
+ } // preserve original row colors for even and odd rows
16386
+
16387
+
16388
+ rowObj.el.style.backgroundColor = '#ffffff00';
16389
+ }
16390
+ }
16391
+ }
16392
+ };
16393
+ /**
16394
+ * Build table with top row assigned as header.
16395
+ *
16396
+ * @param {TableObject} tableObj table object
16397
+ * @param {string} direction cell stack direction, possible options are [row, column]
16398
+ * @param {number} itemsPerHeader items bound to each header element
16399
+ * @param {boolean} repeatMergedHeader repeat merged header
16400
+ */
16401
+
16402
+
16403
+ this.headerBuild = function (tableObj, direction) {
16404
+ var itemsPerHeader = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
16405
+ var repeatMergedHeader = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
16406
+ // cells at header
16407
+ // applying header row color to cells
16408
+ var headerCells = tableObj.getCellsAtRow(0, true).map(function (h) {
16409
+ h.resetAllAttributes();
16410
+
16411
+ if (!h.el.style.backgroundColor) {
16412
+ h.setAttribute('style', "background-color: ".concat(tableObj.rowColors.header), true, ';');
16413
+ }
16414
+
16415
+ return h;
16416
+ });
16417
+ var stackedAsColumn = direction === 'column'; // row count
16418
+
16419
+ var rows = tableObj.maxRows(); // column count
16420
+
16421
+ var columns = tableObj.maxColumns();
16422
+ var rowBorderStyle = '3px solid gray'; // stack direction is column
16423
+
16424
+ if (stackedAsColumn) {
16425
+ /**
16426
+ * Add header cells as new row to table.
16427
+ *
16428
+ * @param {boolean} addBorder add top border to header row
16429
+ */
16430
+ // eslint-disable-next-line no-inner-declarations
16431
+ function addHeaderCells() {
16432
+ var addBorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
16433
+ var rowObj = tableObj.addRow('wptb-row');
16434
+
16435
+ if (addBorder) {
16436
+ rowObj.el.style.borderTop = rowBorderStyle;
16437
+ } // eslint-disable-next-line array-callback-return
16438
+
16439
+
16440
+ headerCells.map(function (h) {
16441
+ // clone header cell to reuse it for multiple rows
16442
+ var cellClone = h.el.cloneNode(true);
16443
+ tableObj.appendElementToRow(cellClone, rowObj.id);
16444
+
16445
+ if (!cellClone.style.backgroundColor) {
16446
+ cellClone.style.backgroundColor = "".concat(getComputedStyle(rowObj.el).backgroundColor);
16447
+ if (cellClone.style.backgroundColor) cellClone.style.backgroundColor += ' !important';
16448
+ }
16449
+ });
16450
+ rowObj.el.style.backgroundColor = '#ffffff00';
16451
+ } // count of header rows that will be created
16452
+
16453
+
16454
+ var headerCount = Math.ceil((rows - 1) / itemsPerHeader); // row index on original table
16455
+
16456
+ var currentOriginalRow = 1;
16457
+
16458
+ for (var r = 0; r < headerCount; r += 1) {
16459
+ // create header row and add to table
16460
+ addHeaderCells(r > 0);
16461
+
16462
+ for (var c = 0; c < itemsPerHeader; c += 1) {
16463
+ // break iteration when current row surpasses original row amount
16464
+ if (currentOriginalRow >= rows) {
16465
+ break;
16466
+ }
16467
+
16468
+ var rowObj = tableObj.addRow('wptb-row'); // apply row color relative to current header row
16469
+
16470
+ rowObj.el.style.backgroundColor = '#ffffff00';
16471
+
16472
+ for (var cc = 0; cc < columns; cc += 1) {
16473
+ var currentCell = tableObj.getCell(currentOriginalRow, cc, true);
16474
+
16475
+ if (currentCell) {
16476
+ currentCell.resetAllAttributes(); // status to decide whether render cell or not
16477
+
16478
+ var cellAddStatus = true;
16479
+ var rowSpan = currentCell.getSpan(CellObject.spanTypes.row);
16480
+ var colSpan = currentCell.getSpan(CellObject.spanTypes.column);
16481
+
16482
+ if (rowSpan > 1) {
16483
+ // items remaining in current header
16484
+ var remainingItems = itemsPerHeader - c; // calculate whether to apply full rowspan value or remaining item value depending on the current position of the cell
16485
+
16486
+ var currentRowSpan = Math.min(rowSpan, remainingItems);
16487
+ cellAddStatus = currentCell.setSpan(CellObject.spanTypes.row, currentRowSpan); // reset render status of cell to visible for future use
16488
+
16489
+ currentCell.setMergedRenderStatus(true);
16490
+ }
16491
+
16492
+ if (cellAddStatus) {
16493
+ if (!currentCell.el.style.backgroundColor) {
16494
+ currentCell.setAttribute('style', "background-color: ".concat(tableObj.rowColors[c % 2 === 0 ? 'even' : 'odd']), true, ';');
16495
+ }
16496
+
16497
+ tableObj.appendObjectToRow(currentCell, rowObj.id);
16498
+ }
16499
+ }
16500
+ }
16501
+
16502
+ currentOriginalRow += 1;
16503
+ }
16504
+ }
16505
+ } else {
16506
+ // stack direction is row
16507
+ // number of headers that will be created
16508
+ var _headerCount = Math.ceil((rows - 1) / itemsPerHeader);
16509
+
16510
+ var _currentOriginalRow = 1;
16511
+
16512
+ for (var hc = 0; hc < _headerCount; hc += 1) {
16513
+ for (var _c2 = 0; _c2 < columns; _c2 += 1) {
16514
+ var _rowObj = tableObj.addRow('wptb-row');
16515
+
16516
+ if (hc > 0 && _c2 === 0) {
16517
+ _rowObj.el.style.borderTop = rowBorderStyle;
16518
+ }
16519
+
16520
+ if (repeatMergedHeader || hc === 0) {
16521
+ var headerCellObject = tableObj.getCell(0, _c2, true); // const clonedHeaderCell = headerCells[c]?.el.cloneNode(true);
16522
+
16523
+ if (!headerCellObject.isReference()) {
16524
+ var clonedHeaderCell = headerCellObject.el.cloneNode(true); // apply header row color to header cell
16525
+
16526
+ clonedHeaderCell.style.backgroundColor = "".concat(tableObj.rowColors.header, " !important");
16527
+ tableObj.appendElementToRow(clonedHeaderCell, _rowObj.id);
16528
+
16529
+ if (!clonedHeaderCell.style.backgroundColor) {
16530
+ clonedHeaderCell.style.backgroundColor = "".concat(getComputedStyle(_rowObj.el).backgroundColor);
16531
+ if (clonedHeaderCell.style.backgroundColor) clonedHeaderCell.style.backgroundColor += ' !important';
16532
+ }
16533
+
16534
+ if (!repeatMergedHeader) {
16535
+ clonedHeaderCell.setAttribute('rowSpan', columns * _headerCount);
16536
+ } else {
16537
+ clonedHeaderCell.setAttribute('rowSpan', clonedHeaderCell.getAttribute('colSpan'));
16538
+ }
16539
+
16540
+ clonedHeaderCell.setAttribute('colSpan', 1);
16541
+ }
16542
+ } // clear out row color to override row color with cell colors
16543
+
16544
+
16545
+ _rowObj.el.style.backgroundColor = '#ffffff00';
16546
+
16547
+ for (var _r3 = 0; _r3 < itemsPerHeader; _r3 += 1) {
16548
+ if (_currentOriginalRow + _r3 >= rows) {
16549
+ break;
16550
+ } // const currentCell = tableObj.appendToRow(currentOriginalRow + r, c, rowObj.id);
16551
+
16552
+
16553
+ var _currentCell = tableObj.getCell(_currentOriginalRow + _r3, _c2, true);
16554
+
16555
+ if (_currentCell) {
16556
+ _currentCell.resetAllAttributes();
16557
+
16558
+ var _cellAddStatus = true;
16559
+
16560
+ var _rowSpan = _currentCell.getSpan(CellObject.spanTypes.row);
16561
+
16562
+ var _colSpan = _currentCell.getSpan(CellObject.spanTypes.column);
16563
+
16564
+ if (_rowSpan > 1) {
16565
+ var _remainingItems = itemsPerHeader - _r3;
16566
+
16567
+ var _currentRowSpan = Math.min(_rowSpan, _remainingItems);
16568
+
16569
+ _cellAddStatus = _currentCell.setSpan(CellObject.spanTypes.row, _currentRowSpan);
16570
+
16571
+ var rS = _currentCell.el.getAttribute('rowSpan');
16572
+
16573
+ var cS = _currentCell.el.getAttribute('colSpan'); // switch span values
16574
+
16575
+
16576
+ _currentCell.setAttribute('rowSpan', cS);
16577
+
16578
+ _currentCell.setAttribute('colSpan', rS);
16579
+
16580
+ _currentCell.setMergedRenderStatus(true);
16581
+ }
16582
+
16583
+ if (_cellAddStatus) {
16584
+ // color index for the cell, this will be used to reflect table row colors to cells. currently, grouping up the same items with the same color code
16585
+ var colorIndex = (_currentOriginalRow + _r3 + hc) % 2 === 0 ? 'even' : 'odd'; // for better visuals and distinction for tables with 1 item per header, using this calculation for color index
16586
+
16587
+ if (itemsPerHeader === 1) {
16588
+ colorIndex = _currentOriginalRow % 2 === 0 ? 'even' : 'odd';
16589
+ }
16590
+
16591
+ if (!_currentCell.el.style.backgroundColor) {
16592
+ _currentCell.setAttribute('style', "background-color: ".concat(tableObj.rowColors[colorIndex]), true, ';');
16593
+ }
16594
+
16595
+ tableObj.appendObjectToRow(_currentCell, _rowObj.id);
16596
+ }
16597
+ }
16598
+ }
16599
+ }
16600
+
16601
+ _currentOriginalRow += itemsPerHeader;
16602
+ }
16603
+ }
16604
+ };
16605
+ /**
16606
+ * Build table in its default form.
16607
+ *
16608
+ * Default form of table is the layout it has in desktop breakpoint.
16609
+ *
16610
+ * @param {TableObject} tableObj table object
16611
+ */
16612
+
16613
+
16614
+ this.buildDefault = function (tableObj) {
16615
+ var rows = tableObj.maxRows();
16616
+ var columns = tableObj.maxColumns();
16617
+
16618
+ for (var r = 0; r < rows; r += 1) {
16619
+ var rowId = tableObj.addRow('', true, r).id;
16620
+
16621
+ for (var c = 0; c < columns; c += 1) {
16622
+ var tempCell = tableObj.getCell(r, c, true); // only render cell if a valid cell is found and it is not a reference
16623
+
16624
+ if (tempCell && !tempCell.isReference()) {
16625
+ // reset all modified attributes of cell to their default values
16626
+ tempCell.resetAllAttributes();
16627
+ tableObj.appendElementToRow(tempCell.getElement(), rowId);
16628
+ }
16629
+ }
16630
+ }
16631
+ };
16632
+ /**
16633
+ * Calculate range id for given size value.
16634
+ *
16635
+ * @param {number} val value
16636
+ * @param {Object} stops an object containing stop ids as keys and respective sizes as values
16637
+ * @return {string} range id
16638
+ */
16639
+
16640
+
16641
+ this.calculateRangeId = function (val, stops) {
16642
+ // eslint-disable-next-line prefer-destructuring
16643
+ var sortedStops = Object.keys(stops).sort(function (a, b) {
16644
+ return stops[a].width - stops[b].width;
16645
+ });
16646
+ var rangeId = sortedStops[0]; // eslint-disable-next-line array-callback-return
16647
+
16648
+ sortedStops.map(function (s) {
16649
+ if (val >= stops[s].width) {
16650
+ rangeId = s;
16651
+ }
16652
+ });
16653
+ return rangeId;
16654
+ };
16655
+ /**
16656
+ * Rebuild table according to its responsive directives.
16657
+ *
16658
+ * @private
16659
+ * @param {HTMLElement} el table element
16660
+ * @param {number} size size in pixels
16661
+ * @param {TableObject} tableObj table object instance
16662
+ * @throws An error will be given for invalid mode name
16663
+ */
16664
+
16665
+
16666
+ this.rebuildTable = function (el, size, tableObj) {
16667
+ var directive = _this3.getDirective(el);
16668
+
16669
+ if (directive) {
16670
+ if (!directive.responsiveEnabled) {
16671
+ // this.buildDefault(tableObj);
16672
+ return;
16673
+ }
16674
+
16675
+ var mode = directive.responsiveMode; // main build logic for different responsive modes should be named in the format of `{modeName}Build` to automatically call the associated function from here
16676
+
16677
+ var buildCallable = _this3["".concat(mode, "Build")];
16678
+
16679
+ if (!size) {
16680
+ // eslint-disable-next-line no-param-reassign
16681
+ size = el.getBoundingClientRect().width;
16682
+ }
16683
+
16684
+ var sizeRangeId = _this3.calculateRangeId(size, directive.breakpoints);
16685
+
16686
+ if (buildCallable) {
16687
+ var modeOptions = directive.modeOptions[mode];
16688
+ buildCallable.call(_this3, el, sizeRangeId, modeOptions, tableObj); // eslint-disable-next-line no-undef
16689
+
16690
+ WPTB_RecalculateIndexes(el);
16691
+ var tabEvent = new CustomEvent('table:rebuilt', {
16692
+ detail: {
16693
+ sizeRangeId: sizeRangeId,
16694
+ topRowAsHeader: directive.modeOptions[mode].topRowAsHeader
16695
+ }
16696
+ });
16697
+ el.dispatchEvent(tabEvent);
16698
+ } else {
16699
+ throw new Error("No build mode named as [".concat(mode, "] found."));
16700
+ }
16701
+ }
16702
+ };
16703
+ /**
16704
+ * Rebuild tables with the given screen size.
16705
+ *
16706
+ * @param {number} size screen size
16707
+ */
16708
+
16709
+
16710
+ this.rebuildTables = function (size) {
16711
+ // eslint-disable-next-line array-callback-return
16712
+ _this3.elementObjects.map(function (o) {
16713
+ var innerSize = size;
16714
+
16715
+ if (!size) {
16716
+ // eslint-disable-next-line no-param-reassign
16717
+ innerSize = window.innerWidth;
16718
+
16719
+ var directives = _this3.getDirective(o.el); // calculate size according to relative width directive
16720
+
16721
+
16722
+ if (directives && directives.relativeWidth) {
16723
+ switch (directives.relativeWidth) {
16724
+ case 'window':
16725
+ // eslint-disable-next-line no-param-reassign
16726
+ innerSize = window.innerWidth;
16727
+ break;
16728
+
16729
+ case 'container':
16730
+ // get the size of the container table is in
16731
+ // eslint-disable-next-line no-param-reassign
16732
+ innerSize = o.el.parentNode.parentNode.parentNode.clientWidth;
16733
+ break;
16734
+
16735
+ default:
16736
+ // eslint-disable-next-line no-param-reassign
16737
+ innerSize = window.innerWidth;
16738
+ break;
16739
+ }
16740
+ }
16741
+ }
16742
+
16743
+ _this3.rebuildTable(o.el, innerSize, o.tableObject);
16744
+ });
16745
+ };
16746
+
16747
+ if (this.options.bindToResize) {
16748
+ this.bindRebuildToResize();
16749
+ }
16750
+
16751
+ return {
16752
+ rebuildTables: this.rebuildTables,
16753
+ getDirective: this.getDirective,
16754
+ calculateRangeId: this.calculateRangeId
16755
+ };
16756
+ }
16757
+
16758
+ return ResponsiveFront;
16759
+ });
16760
+ },{"process":"../../../../../node_modules/process/browser.js"}],"../WPTB_SortableTable.js":[function(require,module,exports) {
16761
+ var global = arguments[3];
16762
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
16763
+
16764
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16765
+
16766
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16767
+
16768
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
16769
+
16770
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
16771
+
16772
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16773
+
16774
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
16775
+
16776
+ /**
16777
+ * Responsive class assignment for frontend operations.
16778
+ *
16779
+ * This file can be used as an UMD.
16780
+ */
16781
+ (function assignToGlobal(key, context, factory) {
16782
+ if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined') {
16783
+ module.exports = factory();
16784
+ } else {
16785
+ // eslint-disable-next-line no-param-reassign
16786
+ context[key] = factory();
16787
+ } // eslint-disable-next-line no-restricted-globals
16788
+
16789
+ })('WPTB_SortableTable', self || global, function () {
16790
+ function WPTB_SortTable() {
16791
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16792
+ var table = this.table = options.table;
16793
+ WPTB_RecalculateIndexes(table);
16794
+ var thisObject = this;
16795
+ this.itemsPerHeader = 0;
16796
+ this.tableMaxCols = table.maxCols;
16797
+ this.cellsStylesScheme = {};
16798
+ this.rowsStylesScheme = {};
16799
+ /**
16800
+ * sets the table to sort mode
16801
+ *
16802
+ * @param {string} type
16803
+ * @param {boolean} active
16804
+ * @param {number} number
16805
+ */
16806
+
16807
+ this.sortModeSwitcher = function (type, active) {
16808
+ if (active) {
16809
+ this.sortModeSwitcher('horizontal', false);
16810
+ this.sortModeSwitcher('vertical', false);
16811
+ }
16812
+
16813
+ if (type === 'vertical') {
16814
+ this.table.removeEventListener('click', this.sortableTableVerticalStart, false);
16815
+
16816
+ if (active) {
16817
+ this.sortingCellMouseMoveSwitcher('vertical', true);
16818
+ this.table.addEventListener('click', this.sortableTableVerticalStart, false);
16819
+ this.table.dataset.wptbSortableTableVertical = '1';
16820
+ this.createTableElementsStylesScheme('td');
16821
+ this.createTableElementsStylesScheme('tr');
16822
+ } else {
16823
+ this.sortingCellMouseMoveSwitcher('vertical', false);
16824
+ delete this.table.dataset.wptbSortableTableVertical;
16825
+ }
16826
+ } else if (type === 'horizontal') {
16827
+ this.table.removeEventListener('click', this.sortableTableHorizontalStart, false);
16828
+
16829
+ if (active) {
16830
+ this.sortingCellMouseMoveSwitcher('horizontal', true);
16831
+ this.table.addEventListener('click', this.sortableTableHorizontalStart, false);
16832
+ this.table.dataset.wptbSortableTableHorizontal = '1';
16833
+ this.createTableElementsStylesScheme('td');
16834
+ this.createTableElementsStylesScheme('tr');
16835
+ } else {
16836
+ this.sortingCellMouseMoveSwitcher('horizontal', false);
16837
+ delete this.table.dataset.wptbSortableTableHorizontal;
16838
+ }
16839
+ }
16840
+ };
16841
+ /**
16842
+ * changes table object for old reconstruction table type
16843
+ *
16844
+ * @param {boolean}start
16845
+ * @returns {*}
16846
+ */
16847
+
16848
+
16849
+ this.tableObjectChange = function () {
16850
+ var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
16851
+
16852
+ if (this.table.classList.contains('wptb-mobile-view-active') && start) {
16853
+ this.table = table.parentNode.parentNode.querySelector('.wptb-preview-table-mobile');
16854
+ } else if (this.table.classList.contains('wptb-preview-table-mobile') && !start) {
16855
+ this.table = table.parentNode.querySelector('.wptb-preview-table');
16856
+ }
16857
+
16858
+ return this.table;
16859
+ };
16860
+ /**
16861
+ * fills the object with data about cell styles for all locations (create scheme)
16862
+ *
16863
+ * @param elemSelector
16864
+ */
16865
+
16866
+
16867
+ this.createTableElementsStylesScheme = function (elemSelector) {
16868
+ this.tableObjectChange();
16869
+ var elements = this.table.querySelectorAll(elemSelector);
16870
+
16871
+ if (elements.length) {
16872
+ for (var i = 0; i < elements.length; i++) {
16873
+ var elem = elements[i];
16874
+ var cellFullStyleObj = window.getComputedStyle(elem, null);
16875
+ var backgroundColor = cellFullStyleObj.getPropertyValue('background-color');
16876
+ var objectKey = '';
16877
+
16878
+ if (elemSelector === 'td') {
16879
+ objectKey = elem.dataset.xIndex + '-' + elem.dataset.yIndex;
16880
+ this.cellsStylesScheme[objectKey] = {
16881
+ backgroundColor: backgroundColor
16882
+ };
16883
+ } else if (elemSelector === 'tr') {
16884
+ objectKey = String(i);
16885
+ this.rowsStylesScheme[objectKey] = {
16886
+ backgroundColor: backgroundColor
16887
+ };
16888
+ }
16889
+ }
16890
+ }
16891
+
16892
+ this.tableObjectChange(false);
16893
+ };
16894
+ /**
16895
+ * applies saved cell styles data to all cells
16896
+ *
16897
+ * @param elemSelector
16898
+ */
16899
+
16900
+
16901
+ this.reassignElementsStyles = function (elemSelector) {
16902
+ this.tableObjectChange();
16903
+ var elements = this.table.querySelectorAll(elemSelector);
16904
+ var elementsStylesScheme;
16905
+
16906
+ if (elemSelector === 'td') {
16907
+ elementsStylesScheme = this.cellsStylesScheme;
16908
+ } else if (elemSelector === 'tr') {
16909
+ elementsStylesScheme = this.rowsStylesScheme;
16910
+ }
16911
+
16912
+ if (elements.length) {
16913
+ for (var i = 0; i < elements.length; i++) {
16914
+ var elem = elements[i];
16915
+ var objectKey = '';
16916
+
16917
+ if (elemSelector === 'td') {
16918
+ objectKey = elem.dataset.xIndex + '-' + elem.dataset.yIndex;
16919
+ } else if (elemSelector === 'tr') {
16920
+ objectKey = i;
16921
+ }
16922
+
16923
+ if (elementsStylesScheme.hasOwnProperty(objectKey)) {
16924
+ var elemStyles = elementsStylesScheme[objectKey];
16925
+
16926
+ for (var key in elemStyles) {
16927
+ elem.style[key] = elemStyles[key];
16928
+ }
16929
+ }
16930
+ }
16931
+ }
16932
+
16933
+ this.tableObjectChange(false);
16934
+ };
16935
+ /**
16936
+ * checks whether the table should be in the sort state
16937
+ * and connects the necessary handlers
16938
+ *
16939
+ * @param {object} responsiveFront
16940
+ */
16941
+
16942
+
16943
+ this.sortableTableInitialization = function (responsiveFront) {
16944
+ var typeFirst;
16945
+ var typeSecond;
16946
+
16947
+ if (this.table.dataset.wptbSortableTableVertical && this.table.dataset.wptbSortableTableVertical === '1') {
16948
+ typeFirst = 'vertical';
16949
+ typeSecond = 'horizontal';
16950
+ } else if (this.table.dataset.wptbSortableTableHorizontal && this.table.dataset.wptbSortableTableHorizontal === '1') {
16951
+ typeFirst = 'horizontal';
16952
+ typeSecond = 'vertical';
16953
+ }
16954
+
16955
+ if (!typeFirst || typeof typeFirst !== 'string' || !typeSecond || typeof typeSecond !== 'string') return;
16956
+ var switchMode = WPTB_GetDirectionAfterReconstruction(this.table, typeFirst, typeSecond, 'vertical', responsiveFront);
16957
+
16958
+ if (_typeof(switchMode) === 'object' && switchMode.hasOwnProperty('switch')) {
16959
+ function sortModeSwitcherRun(e) {
16960
+ var switchModeObj = switchMode.switch(e);
16961
+
16962
+ if (_typeof(switchModeObj) === 'object') {
16963
+ this.itemsPerHeader = switchModeObj.itemsPerHeader;
16964
+
16965
+ if (switchModeObj.hasOwnProperty('newTable')) {
16966
+ var tableOld = this.table;
16967
+ this.table = switchModeObj.newTable;
16968
+ this.sortModeSwitcher(switchModeObj.type[0], true);
16969
+ this.table = tableOld;
16970
+ } else {
16971
+ this.sortModeSwitcher(switchModeObj.type[0], true);
16972
+ }
16973
+ }
16974
+ }
16975
+
16976
+ sortModeSwitcherRun.call(thisObject);
16977
+ this.table.addEventListener('table:rebuilt', function (e) {
16978
+ sortModeSwitcherRun.call(thisObject, e);
16979
+ }, false);
16980
+ }
16981
+ };
16982
+ /**
16983
+ * adds and deletes mousemove and mouseleave events handlers when happens switch sorting mode
16984
+ * and also can add necessary attributes
16985
+ *
16986
+ * @param {string} type
16987
+ * @param {boolean} active
16988
+ */
16989
+
16990
+
16991
+ this.sortingCellMouseMoveSwitcher = function (type, active) {
16992
+ var _this = this;
16993
+
16994
+ /**
16995
+ * removes and adds mousemove and mouseleave events handlers
16996
+ *
16997
+ * @param {HTMLElement} td
16998
+ * @param {func} sCMM
16999
+ * @param {boolean} active
17000
+ */
17001
+ function s(td, sCMM, active) {
17002
+ td.removeEventListener('mousemove', sCMM, false);
17003
+ td.removeEventListener('mouseleave', tdMouseLeave, false);
17004
+
17005
+ if (active) {
17006
+ td.addEventListener('mousemove', sCMM, false);
17007
+ td.addEventListener('mouseleave', tdMouseLeave, false);
17008
+ }
17009
+ }
17010
+ /**
17011
+ * removes and adds data sorted attributes
17012
+ *
17013
+ * @param {HTMLElement} td
17014
+ * @param {string} dataAttr
17015
+ * @param {boolean} active
17016
+ */
17017
+
17018
+
17019
+ function dataAttrSortChange(td, dataAttr, active) {
17020
+ if (active) {
17021
+ if (!td.dataset[dataAttr] || td.dataset[dataAttr] !== 'desk-disabled') {
17022
+ td.dataset[dataAttr] = 'ask';
17023
+ } else {
17024
+ td.dataset[dataAttr] = 'desk';
17025
+ }
17026
+ } else if (td.dataset[dataAttr] === 'ask') {
17027
+ td.dataset[dataAttr] = 'ask-disabled';
17028
+ } else if (td.dataset[dataAttr] === 'desk') {
17029
+ td.dataset[dataAttr] = 'desk-disabled';
17030
+ }
17031
+ } // removes all mousemove and mouseleave events handlers
17032
+ // and also removes all data sorted attributes from all cells
17033
+
17034
+
17035
+ var tds = this.table.querySelectorAll('td');
17036
+
17037
+ if (tds.length) {
17038
+ tds = _toConsumableArray(tds);
17039
+ tds.map(function (td) {
17040
+ s(td, sortingCellMouseMoveVertical, false);
17041
+ dataAttrSortChange(td, 'sortedVertical', false);
17042
+ s(td, sortingCellMouseMoveHorizontal, false);
17043
+ dataAttrSortChange(td, 'sortedHorizontal', false);
17044
+ });
17045
+ } // if active === true sets sorted events handlers
17046
+ // and data sorted attributes for all cells
17047
+
17048
+
17049
+ if (active) {
17050
+ if (type === 'vertical') {
17051
+ var rowsLength = this.table.rows.length;
17052
+ var dataYIndexStart = 0;
17053
+
17054
+ while (rowsLength > 0) {
17055
+ var _tds = this.table.querySelectorAll("[data-y-index=\"".concat(dataYIndexStart, "\"]"));
17056
+
17057
+ _tds = _toConsumableArray(_tds);
17058
+
17059
+ _tds.map(function (td) {
17060
+ s(td, sortingCellMouseMoveVertical, active);
17061
+ dataAttrSortChange(td, 'sortedVertical', active);
17062
+ });
17063
+
17064
+ if (this.itemsPerHeader) {
17065
+ rowsLength -= this.itemsPerHeader + 1;
17066
+ dataYIndexStart += this.itemsPerHeader + 1;
17067
+ } else {
17068
+ rowsLength = 0;
17069
+ }
17070
+ }
17071
+ } else if (type === 'horizontal') {
17072
+ var _tds2 = this.table.querySelectorAll('[data-x-index="0"]');
17073
+
17074
+ _tds2 = _toConsumableArray(_tds2);
17075
+
17076
+ _tds2.map(function (td) {
17077
+ var tdsPerAfter = _this.table.querySelectorAll("[data-y-index=\"".concat(td.dataset.yIndex, "\"]"));
17078
+
17079
+ if (tdsPerAfter.length > 2) {
17080
+ s(td, sortingCellMouseMoveHorizontal, active);
17081
+ dataAttrSortChange(td, 'sortedHorizontal', active);
17082
+ }
17083
+ });
17084
+ }
17085
+ }
17086
+ };
17087
+ /**
17088
+ * adds a sortable-hover class for a cell when the cursor is over the sort icon (arrow)
17089
+ *
17090
+ * @param {event} e
17091
+ * @param {string} type
17092
+ * @param {HTMLElement} element td
17093
+ */
17094
+
17095
+
17096
+ function sortingCellMouseMov(e, type, element) {
17097
+ if (e.target.tagName === 'TD') {
17098
+ var x = e.offsetX == undefined ? e.layerX : e.offsetX;
17099
+ var y = e.offsetY == undefined ? e.layerY : e.offsetY;
17100
+ var xMatch = false;
17101
+
17102
+ if (type === 'vertical' && e.target.clientWidth - x <= 35 || type === 'horizontal' && x <= 35) {
17103
+ xMatch = true;
17104
+ }
17105
+
17106
+ if (xMatch && (e.target.clientHeight - 35) / 2 < y && (e.target.clientHeight + 35) / 2 > y) {
17107
+ element.classList.add('sortable-hover');
17108
+ } else {
17109
+ element.classList.remove('sortable-hover');
17110
+ }
17111
+ } else {
17112
+ element.classList.remove('sortable-hover');
17113
+ }
17114
+ }
17115
+ /**
17116
+ * calls sortingCellMouseMov with the type parameter set to vertical
17117
+ *
17118
+ * @param {event} e
17119
+ */
17120
+
17121
+
17122
+ function sortingCellMouseMoveVertical(e) {
17123
+ sortingCellMouseMov(e, 'vertical', this);
17124
+ }
17125
+ /**
17126
+ * calls sortingCellMouseMov with the type parameter set to horizontal
17127
+ *
17128
+ * @param {event} e
17129
+ */
17130
+
17131
+
17132
+ function sortingCellMouseMoveHorizontal(e) {
17133
+ sortingCellMouseMov(e, 'horizontal', this);
17134
+ }
17135
+ /**
17136
+ * remove sortable-hover class from cell when cursor leave cell
17137
+ */
17138
+
17139
+
17140
+ function tdMouseLeave() {
17141
+ this.classList.remove('sortable-hover');
17142
+ }
17143
+ /**
17144
+ * function for sorting the table vertically by the numeric content of cells
17145
+ *
17146
+ * @param {event} e
17147
+ * @param {HTMLElement} table
17148
+ * @param {string} type
17149
+ */
17150
+
17151
+
17152
+ function sortableTable(e, type) {
17153
+ if (e.target && e.target.tagName === 'TD' && !table.parentNode.classList.contains('wptb-preview-table-manage-cells')) {
17154
+ var _table = e.currentTarget;
17155
+ var tableWasSorted = false;
17156
+
17157
+ if (type === 'vertical' && e.target.dataset.hasOwnProperty('sortedVertical')) {
17158
+ /**
17159
+ * if table have enabled param topRowAsHeader and sellsStackDirection is column
17160
+ * the top and bottom rows that will not be sorted are temporarily removed from the table
17161
+ */
17162
+ var tableRowsBefore = [];
17163
+ var tableRowsAfter = [];
17164
+
17165
+ if (this.itemsPerHeader && this.itemsPerHeader < _table.rows.length) {
17166
+ WPTB_RecalculateIndexes(_table);
17167
+
17168
+ var tableRowsArr = _toConsumableArray(_table.rows);
17169
+
17170
+ var tableLastCont = _table.querySelector('tbody') ? _table.querySelector('tbody') : _table;
17171
+
17172
+ for (var i = 0; i < tableRowsArr.length; i++) {
17173
+ if (i < e.target.dataset.yIndex) {
17174
+ tableRowsBefore.push(tableRowsArr[i]);
17175
+ tableLastCont.removeChild(tableRowsArr[i]);
17176
+ } else if (i > parseInt(e.target.dataset.yIndex, 10) + this.itemsPerHeader) {
17177
+ tableRowsAfter.push(tableRowsArr[i]);
17178
+ tableLastCont.removeChild(tableRowsArr[i]);
17179
+ }
17180
+ }
17181
+
17182
+ WPTB_RecalculateIndexes(_table);
17183
+ }
17184
+
17185
+ var tds = _table.querySelectorAll("[data-x-index=\"".concat(e.target.dataset.xIndex, "\"]"));
17186
+
17187
+ tds = _toConsumableArray(tds);
17188
+ /**
17189
+ * preparing table for sorting
17190
+ */
17191
+
17192
+ var rowspan;
17193
+ var rowNum;
17194
+ tds.map(function (td) {
17195
+ if (!(rowspan = parseInt(td.rowSpan, 10))) {
17196
+ rowspan = 1;
17197
+ }
17198
+
17199
+ rowNum = td.dataset.yIndex;
17200
+ WPTB_CutGlueTable.cutTableHorizontally(rowNum, _table);
17201
+ rowNum += rowspan;
17202
+ WPTB_CutGlueTable.cutTableHorizontally(rowNum, _table);
17203
+ });
17204
+ var rowsValuesArr = [];
17205
+ var rowsTdFirst;
17206
+ var tdYCoordsRowSpanPrevious = 0;
17207
+ var tableRowsPushed = [];
17208
+
17209
+ for (var _i = 0; _i < tds.length; _i++) {
17210
+ var tdsChanged = changeSortingTdsCollection(e, _table, tds, _i, tdYCoordsRowSpanPrevious, 'vertical');
17211
+
17212
+ if (tdsChanged && tdsChanged.hasOwnProperty('i')) {
17213
+ tds = tdsChanged.tds;
17214
+ _i = tdsChanged.i;
17215
+ continue;
17216
+ } else if (tdsChanged) {
17217
+ tds = tdsChanged.tds;
17218
+ }
17219
+
17220
+ var td = tds[_i];
17221
+ var tdRowspan = parseInt(td.rowSpan, 10);
17222
+ if (!tdRowspan) tdRowspan = 1;
17223
+ tdYCoordsRowSpanPrevious = parseInt(td.dataset.yIndex, 10) + tdRowspan;
17224
+ var textElementsValues = textElementsValuesGet(td);
17225
+ var rowsTd = [];
17226
+
17227
+ for (var j = 0; j < tdRowspan; j++) {
17228
+ rowsTd.push(_table.rows[parseInt(td.dataset.yIndex, 10) + j]);
17229
+ tableRowsPushed.push(parseInt(td.dataset.yIndex, 10) + j);
17230
+ }
17231
+
17232
+ if (td.dataset.yIndex > 0) {
17233
+ rowsValuesArr.push({
17234
+ rowsTd: rowsTd,
17235
+ value: textElementsValues
17236
+ });
17237
+ } else {
17238
+ rowsTdFirst = rowsTd;
17239
+ }
17240
+ }
17241
+
17242
+ var orderBy = setSortedAscDataAttr(e, 'sortedVertical');
17243
+ if (!orderBy) return;
17244
+ if (rowsValuesArr.length) rowsValuesArr.sort(function (prev, next) {
17245
+ return sortOrder(orderBy, prev, next);
17246
+ });
17247
+ rowsValuesArr.unshift({
17248
+ rowsTd: rowsTdFirst
17249
+ });
17250
+
17251
+ if (rowsValuesArr.length < _table.rows.length) {
17252
+ for (var _i2 = 0; _i2 < _table.rows.length; _i2++) {
17253
+ if (tableRowsPushed.indexOf(_i2) > -1) continue;
17254
+ var _rowsTd = [];
17255
+
17256
+ _rowsTd.push(_table.rows[_i2]);
17257
+
17258
+ rowsValuesArr.push({
17259
+ rowsTd: _rowsTd
17260
+ });
17261
+ }
17262
+ }
17263
+
17264
+ var tBody = _table.querySelector('tbody');
17265
+
17266
+ tBody.innerHTML = '';
17267
+ rowsValuesArr.map(function (rowsValObj) {
17268
+ rowsValObj.rowsTd.map(function (row) {
17269
+ tBody.appendChild(row);
17270
+ });
17271
+ });
17272
+ /**
17273
+ * returning previously deleted rows
17274
+ */
17275
+
17276
+ if (tableRowsBefore.length) {
17277
+ var _tableLastCont = _table.querySelector('tbody') ? _table.querySelector('tbody') : _table;
17278
+
17279
+ if (_tableLastCont) {
17280
+ var trRef = _tableLastCont.querySelector('tr');
17281
+
17282
+ tableRowsBefore.map(function (tr) {
17283
+ _tableLastCont.insertBefore(tr, trRef);
17284
+ });
17285
+ }
17286
+ }
17287
+
17288
+ if (tableRowsAfter.length) {
17289
+ var _tableLastCont2 = _table.querySelector('tbody') ? _table.querySelector('tbody') : _table;
17290
+
17291
+ if (tBody) {
17292
+ tableRowsAfter.map(function (tr) {
17293
+ _tableLastCont2.appendChild(tr);
17294
+ });
17295
+ }
17296
+ }
17297
+
17298
+ WPTB_RecalculateIndexes(_table);
17299
+ WPTB_CutGlueTable.glueTableHorizontally(_table);
17300
+ tableWasSorted = true;
17301
+ } else if (type === 'horizontal' && e.target.dataset.xIndex === '0') {
17302
+ var _tds3 = _table.querySelectorAll("[data-y-index=\"".concat(e.target.dataset.yIndex, "\"]"));
17303
+
17304
+ _tds3 = _toConsumableArray(_tds3); // preparing table for sorting
17305
+
17306
+ var colspan;
17307
+ var colNum;
17308
+
17309
+ _tds3.map(function (td) {
17310
+ if (!(colspan = parseInt(td.colSpan, 10))) {
17311
+ colspan = 1;
17312
+ }
17313
+
17314
+ colNum = td.dataset.xIndex;
17315
+ WPTB_CutGlueTable.cutTableVertically(colNum, _table);
17316
+ colNum += colspan;
17317
+ WPTB_CutGlueTable.cutTableVertically(colNum, _table);
17318
+ });
17319
+
17320
+ var columnsValuesArr = [];
17321
+ var columnsTdFirst;
17322
+ var tdXCoordsColSpanPrevious = 0;
17323
+
17324
+ for (var _i3 = 0; _i3 < _tds3.length; _i3++) {
17325
+ var _tdsChanged = changeSortingTdsCollection(e, _table, _tds3, _i3, tdXCoordsColSpanPrevious, 'horizontal');
17326
+
17327
+ if (_tdsChanged && _tdsChanged.hasOwnProperty('i')) {
17328
+ _tds3 = _tdsChanged.tds;
17329
+ _i3 = _tdsChanged.i;
17330
+ continue;
17331
+ } else if (_tdsChanged) {
17332
+ _tds3 = _tdsChanged.tds;
17333
+ }
17334
+
17335
+ var _td = _tds3[_i3];
17336
+ var tdColspan = parseInt(_td.colSpan, 10);
17337
+ if (!tdColspan) tdColspan = 1;
17338
+ tdXCoordsColSpanPrevious = parseInt(_td.dataset.xIndex, 10) + tdColspan;
17339
+
17340
+ var _textElementsValues = textElementsValuesGet(_td);
17341
+
17342
+ var columnsTd = [];
17343
+
17344
+ for (var _j = 0; _j < tdColspan; _j++) {
17345
+ var tdsColumn = _toConsumableArray(_table.querySelectorAll("[data-x-index=\"".concat(parseInt(_td.dataset.xIndex, 10) + _j, "\"]")));
17346
+
17347
+ columnsTd.push(tdsColumn);
17348
+ }
17349
+
17350
+ if (_td.dataset.xIndex > 0) {
17351
+ columnsValuesArr.push({
17352
+ columnsTd: columnsTd,
17353
+ value: _textElementsValues
17354
+ });
17355
+ } else {
17356
+ columnsTdFirst = columnsTd;
17357
+ }
17358
+ }
17359
+
17360
+ var _orderBy = setSortedAscDataAttr(e, 'sortedHorizontal');
17361
+
17362
+ if (!_orderBy) return;
17363
+ if (columnsValuesArr.length) columnsValuesArr.sort(function (prev, next) {
17364
+ return sortOrder(_orderBy, prev, next);
17365
+ });
17366
+ columnsValuesArr.unshift({
17367
+ columnsTd: columnsTdFirst
17368
+ });
17369
+
17370
+ if (columnsValuesArr.length < _table.maxCols) {
17371
+ var difference = _table.maxCols - columnsValuesArr.length;
17372
+
17373
+ for (var _i4 = 0; _i4 < difference; _i4++) {
17374
+ var _tdsColumn = _toConsumableArray(_table.querySelectorAll("[data-x-index=\"".concat(parseInt(_table.maxCols, 10) - parseInt(difference, 10) + _i4, "\"]")));
17375
+
17376
+ columnsValuesArr.push({
17377
+ columnsTd: [_tdsColumn]
17378
+ });
17379
+ }
17380
+ }
17381
+
17382
+ for (var _i5 = 0; _i5 < _table.rows.length; _i5++) {
17383
+ _table.rows[_i5].innerHTML = '';
17384
+ }
17385
+
17386
+ columnsValuesArr.map(function (columnsValObj) {
17387
+ columnsValObj.columnsTd.map(function (tdsColumn) {
17388
+ tdsColumn.map(function (td) {
17389
+ _table.rows[td.dataset.yIndex].appendChild(td);
17390
+ });
17391
+ });
17392
+ });
17393
+ WPTB_RecalculateIndexes(_table);
17394
+ WPTB_CutGlueTable.glueTableVertically(_table);
17395
+ tableWasSorted = true;
17396
+ }
17397
+
17398
+ if (tableWasSorted) {
17399
+ removeCellsAttrAfterDivision(_table);
17400
+
17401
+ if (_table.hasOwnProperty('tableSM')) {
17402
+ var tableSM = _table.tableSM();
17403
+
17404
+ new tableSM().tableStateSet();
17405
+ }
17406
+
17407
+ this.reassignElementsStyles('td');
17408
+ this.reassignElementsStyles('tr');
17409
+ }
17410
+ }
17411
+ }
17412
+ /**
17413
+ * Function that sets the data-attribute with the number of the row or column
17414
+ * that the table was sorted by. Returns the number of a row or column
17415
+ *
17416
+ * @param {event} e
17417
+ * @param {string} dataAttr
17418
+ * @returns {null|boolean}
17419
+ */
17420
+
17421
+
17422
+ function setSortedAscDataAttr(e, dataAttr) {
17423
+ if (e.currentTarget && (e.currentTarget.classList.contains('wptb-preview-table') || e.currentTarget.classList.contains('wptb-preview-table-mobile'))) {
17424
+ if (!e.target.dataset[dataAttr] || e.target.dataset[dataAttr] === 'ask') {
17425
+ e.target.dataset[dataAttr] = 'desk';
17426
+ } else {
17427
+ e.target.dataset[dataAttr] = 'ask';
17428
+ }
17429
+
17430
+ return e.target.dataset[dataAttr];
17431
+ }
17432
+
17433
+ return false;
17434
+ }
17435
+ /**
17436
+ * defines the sorting order
17437
+ *
17438
+ * @param {string} orderBy
17439
+ * @param prev
17440
+ * @param next
17441
+ * @returns {number}
17442
+ */
17443
+
17444
+
17445
+ function sortOrder() {
17446
+ var orderBy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'ask';
17447
+ var prev = arguments.length > 1 ? arguments[1] : undefined;
17448
+ var next = arguments.length > 2 ? arguments[2] : undefined;
17449
+ var prevValue = prev.value;
17450
+ var nextValue = next.value;
17451
+
17452
+ if (parseInt(prevValue) && parseInt(nextValue)) {
17453
+ prevValue = parseInt(prevValue);
17454
+ nextValue = parseInt(nextValue);
17455
+ }
17456
+
17457
+ if (orderBy === 'ask') {
17458
+ if (prevValue < nextValue) {
17459
+ return -1;
17460
+ }
17461
+
17462
+ if (prevValue === nextValue) {
17463
+ return 0;
17464
+ }
17465
+
17466
+ return 1;
17467
+ }
17468
+
17469
+ if (prevValue < nextValue) {
17470
+ return 1;
17471
+ }
17472
+
17473
+ if (prevValue === nextValue) {
17474
+ return 0;
17475
+ }
17476
+
17477
+ return -1;
17478
+ }
17479
+ /**
17480
+ * return cell text elements values
17481
+ *
17482
+ * @param cell {HTMLElement}
17483
+ * @returns {string}
17484
+ */
17485
+
17486
+
17487
+ function textElementsValuesGet(cell) {
17488
+ var textElements = cell.querySelectorAll('.wptb-text-container');
17489
+ textElements = _toConsumableArray(textElements);
17490
+ var value = '';
17491
+
17492
+ for (var j = 0; j < textElements.length; j++) {
17493
+ var p = textElements[j].querySelector('p');
17494
+ value += p.innerText;
17495
+ if (j !== textElements.length - 1) value += ' ';
17496
+ }
17497
+
17498
+ return value;
17499
+ }
17500
+ /**
17501
+ * adds cells to the collection of cells in the row or column that the table is sorted by.
17502
+ * These added cells are not originally were added in the collection,
17503
+ * because they are combined with cells from higher rows or left-side columns
17504
+ *
17505
+ * @param {event} e
17506
+ * @param {HTMLElement} table
17507
+ * @param {array} tds
17508
+ * @param {number} i
17509
+ * @param {number} tdIndexSpanPrev
17510
+ * @param {string} type
17511
+ * @returns {{tds: *}|boolean|{tds: *, i: *}}
17512
+ */
17513
+
17514
+
17515
+ function changeSortingTdsCollection(e, table, tds, i, tdIndexSpanPrev, type) {
17516
+ var td = tds[i];
17517
+ var tdsCollectionChanged = false;
17518
+ var collectionTds;
17519
+ var collectionTdsJSpan;
17520
+ var collectionTdsJSpanProperty;
17521
+ var indexName;
17522
+ var indexNameCamelCase;
17523
+ var indexNamePerpendicularCamelCase;
17524
+ var tdSpanProperty; // max rows or columns column
17525
+
17526
+ var tableGroupCount;
17527
+
17528
+ if (type === 'vertical') {
17529
+ collectionTdsJSpanProperty = 'colSpan';
17530
+ indexName = 'data-y-index';
17531
+ indexNameCamelCase = 'yIndex';
17532
+ indexNamePerpendicularCamelCase = 'xIndex';
17533
+ tdSpanProperty = 'rowSpan';
17534
+ tableGroupCount = table.rows.length;
17535
+ } else if (type === 'horizontal') {
17536
+ collectionTdsJSpanProperty = 'rowSpan';
17537
+ indexName = 'data-x-index';
17538
+ indexNameCamelCase = 'xIndex';
17539
+ indexNamePerpendicularCamelCase = 'yIndex';
17540
+ tdSpanProperty = 'colSpan';
17541
+ tableGroupCount = table.maxCols;
17542
+ }
17543
+
17544
+ if (td.dataset[indexNameCamelCase] - tdIndexSpanPrev > 0) {
17545
+ collectionTds = table.querySelectorAll("[".concat(indexName, "=\"").concat(tdIndexSpanPrev, "\"]"));
17546
+
17547
+ for (var j = 0; j < collectionTds.length; j++) {
17548
+ collectionTdsJSpan = collectionTds[j][collectionTdsJSpanProperty];
17549
+ if (!collectionTdsJSpan) collectionTdsJSpan = 1;
17550
+
17551
+ if (collectionTds[j].dataset[indexNamePerpendicularCamelCase] < e.target.dataset[indexNamePerpendicularCamelCase] && parseInt(collectionTds[j].dataset[indexNamePerpendicularCamelCase], 10) + parseInt(collectionTdsJSpan, 10) > e.target.dataset[indexNamePerpendicularCamelCase]) {
17552
+ tds.splice(i, 0, collectionTds[j]);
17553
+ tdsCollectionChanged = true;
17554
+ i--;
17555
+ break;
17556
+ }
17557
+ }
17558
+ }
17559
+
17560
+ if (tdsCollectionChanged) return {
17561
+ tds: tds,
17562
+ i: i
17563
+ };
17564
+ var tdSpan = parseInt(td[tdSpanProperty], 10);
17565
+ if (!tdSpan) tdSpan = 1;
17566
+
17567
+ if (i == tds.length - 1 && parseInt(td.dataset[indexNameCamelCase], 10) + tdSpan < tableGroupCount) {
17568
+ collectionTds = table.querySelectorAll("[".concat(indexName, "=\"").concat(parseInt(td.dataset[indexNameCamelCase], 10) + tdSpan, "\"]"));
17569
+
17570
+ for (var _j2 = 0; _j2 < collectionTds.length; _j2++) {
17571
+ collectionTdsJSpan = collectionTds[_j2][collectionTdsJSpanProperty];
17572
+ if (!collectionTdsJSpan) collectionTdsJSpan = 1;
17573
+
17574
+ if (collectionTds[_j2].dataset[indexNamePerpendicularCamelCase] < e.target.dataset[indexNamePerpendicularCamelCase] && parseInt(collectionTds[_j2].dataset[indexNamePerpendicularCamelCase], 10) + parseInt(collectionTdsJSpan, 10) > e.target.dataset[indexNamePerpendicularCamelCase]) {
17575
+ tds.push(collectionTds[_j2]);
17576
+ tdsCollectionChanged = true;
17577
+ break;
17578
+ }
17579
+ }
17580
+ }
17581
+
17582
+ if (tdsCollectionChanged) return {
17583
+ tds: tds
17584
+ };
17585
+ return false;
17586
+ }
17587
+ /**
17588
+ * remove cells attributes which were used for division table
17589
+ *
17590
+ * @param {HTMLElement} table
17591
+ */
17592
+
17593
+
17594
+ function removeCellsAttrAfterDivision(table) {
17595
+ var tdsAll = _toConsumableArray(table.getElementsByTagName('td'));
17596
+
17597
+ for (var i = 0; i < tdsAll.length; i++) {
17598
+ if (tdsAll[i].hasAttribute('data-same-cell-before-division')) {
17599
+ tdsAll[i].removeAttribute('data-same-cell-before-division');
17600
+ }
17601
+ }
17602
+ }
17603
+ /**
17604
+ * function for run sorting table vertically
17605
+ *
17606
+ * @param {event} e
17607
+ */
17608
+
17609
+
17610
+ this.sortableTableVerticalStart = function (e) {
17611
+ sortableTable.call(thisObject, e, 'vertical');
17612
+ };
17613
+ /**
17614
+ * function for run sorting table horizontally
17615
+ *
17616
+ * @param {event} e
17617
+ */
17618
+
17619
+
17620
+ this.sortableTableHorizontalStart = function (e) {
17621
+ sortableTable.call(thisObject, e, 'horizontal');
17622
+ };
17623
+
17624
+ return this;
17625
+ }
17626
+
17627
+ return WPTB_SortTable;
17628
+ });
17629
+ },{}],"components/MaterialButton.vue":[function(require,module,exports) {
17630
+ "use strict";
17631
+
17632
+ Object.defineProperty(exports, "__esModule", {
17633
+ value: true
17634
+ });
17635
+ exports.default = void 0;
17636
+ //
17637
+ //
17638
+ //
17639
+ var _default = {
17640
+ props: {
17641
+ click: {
17642
+ type: Function,
17643
+ default: function _default() {
17644
+ // eslint-disable-next-line no-console
17645
+ console.log('Material button clicked');
17646
+ }
17647
+ },
17648
+ size: {
17649
+ type: String,
17650
+ default: 'fit-content'
17651
+ }
17652
+ },
17653
+ computed: {
17654
+ buttonClass: function buttonClass() {
17655
+ return ["wptb-plugin-button-material-".concat(this.size)];
17656
+ }
17657
+ }
17658
+ };
17659
+ exports.default = _default;
17660
+ var $48fd91 = exports.default || module.exports;
17661
+
17662
+ if (typeof $48fd91 === 'function') {
17663
+ $48fd91 = $48fd91.options;
17664
+ }
17665
+
17666
+ /* template */
17667
+ Object.assign($48fd91, (function () {
17668
+ var render = function() {
17669
+ var _vm = this
17670
+ var _h = _vm.$createElement
17671
+ var _c = _vm._self._c || _h
17672
+ return _c(
17673
+ "div",
17674
+ {
17675
+ staticClass: "wptb-plugin-button-material",
17676
+ class: _vm.buttonClass,
17677
+ on: {
17678
+ click: function($event) {
17679
+ $event.preventDefault()
17680
+ return _vm.click($event)
17681
+ }
17682
+ }
17683
+ },
17684
+ [_vm._t("default")],
17685
+ 2
17686
+ )
17687
+ }
17688
+ var staticRenderFns = []
17689
+ render._withStripped = true
17690
+
17691
+ return {
17692
+ render: render,
17693
+ staticRenderFns: staticRenderFns,
17694
+ _compiled: true,
17695
+ _scopeId: null,
17696
+ functional: undefined
17697
+ };
17698
+ })());
17699
+
17700
+ },{}],"components/ModalWindow.vue":[function(require,module,exports) {
17701
+ "use strict";
17702
+
17703
+ Object.defineProperty(exports, "__esModule", {
17704
+ value: true
17705
+ });
17706
+ exports.default = void 0;
17707
+
17708
+ var _MaterialButton = _interopRequireDefault(require("./MaterialButton"));
17709
+
17710
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17711
+
17712
+ //
17713
+ //
17714
+ //
17715
+ //
17716
+ //
17717
+ //
17718
+ //
17719
+ //
17720
+ //
17721
+ //
17722
+ //
17723
+ var _default = {
17724
+ props: {
17725
+ message: {
17726
+ type: String,
17727
+ default: 'This is a default message for modal window.'
17728
+ },
17729
+ visible: {
17730
+ type: Boolean,
17731
+ default: false
17732
+ },
17733
+ relativeRef: {
17734
+ type: HTMLElement,
17735
+ required: true
17736
+ },
17737
+ callback: {
17738
+ type: Function,
17739
+ default: function _default() {
17740
+ // eslint-disable-next-line no-console
17741
+ console.log('modal button clicked');
17742
+ }
17743
+ }
17744
+ },
17745
+ components: {
17746
+ MaterialButton: _MaterialButton.default
17747
+ },
17748
+ mounted: function mounted() {
17749
+ this.relativeRef.appendChild(this.$refs.mainWrapper);
17750
+ },
17751
+ beforeDestroy: function beforeDestroy() {
17752
+ this.$refs.mainWrapper.remove();
17753
+ }
17754
+ };
17755
+ exports.default = _default;
17756
+ var $6a3b9d = exports.default || module.exports;
17757
+
17758
+ if (typeof $6a3b9d === 'function') {
17759
+ $6a3b9d = $6a3b9d.options;
17760
+ }
17761
+
17762
+ /* template */
17763
+ Object.assign($6a3b9d, (function () {
17764
+ var render = function() {
17765
+ var _vm = this
17766
+ var _h = _vm.$createElement
17767
+ var _c = _vm._self._c || _h
17768
+ return _c(
17769
+ "div",
17770
+ {
17771
+ directives: [
17772
+ {
17773
+ name: "show",
17774
+ rawName: "v-show",
17775
+ value: _vm.visible,
17776
+ expression: "visible"
17777
+ }
17778
+ ],
17779
+ ref: "mainWrapper",
17780
+ staticClass: "wptb-plugin-modal-window"
17781
+ },
17782
+ [
17783
+ _c("div", { staticClass: "wptb-plugin-modal-inner-window" }, [
17784
+ _vm._m(0),
17785
+ _vm._v(" "),
17786
+ _c("div", { staticClass: "wptb-plugin-modal-message" }, [
17787
+ _vm._v(_vm._s(_vm.message))
17788
+ ]),
17789
+ _vm._v(" "),
17790
+ _c(
17791
+ "div",
17792
+ { staticClass: "wptb-plugin-modal-button-container" },
17793
+ [
17794
+ _c(
17795
+ "material-button",
17796
+ { attrs: { size: "full-size", click: _vm.callback } },
17797
+ [_vm._v(_vm._s(_vm.strings.okay))]
17798
+ )
17799
+ ],
17800
+ 1
17801
+ )
17802
+ ])
17803
+ ]
17804
+ )
17805
+ }
17806
+ var staticRenderFns = [
17807
+ function() {
17808
+ var _vm = this
17809
+ var _h = _vm.$createElement
17810
+ var _c = _vm._self._c || _h
17811
+ return _c("div", { staticClass: "wptb-plugin-modal-icon" }, [
17812
+ _c("span", { staticClass: "dashicons dashicons-warning" })
17813
+ ])
17814
+ }
17815
+ ]
17816
+ render._withStripped = true
17817
+
17818
+ return {
17819
+ render: render,
17820
+ staticRenderFns: staticRenderFns,
17821
+ _compiled: true,
17822
+ _scopeId: null,
17823
+ functional: undefined
17824
+ };
17825
+ })());
17826
+
17827
+ },{"./MaterialButton":"components/MaterialButton.vue"}],"components/NumberPostfixButtons.vue":[function(require,module,exports) {
17828
+ "use strict";
17829
+
17830
+ Object.defineProperty(exports, "__esModule", {
17831
+ value: true
17832
+ });
17833
+ exports.default = void 0;
17834
+
17835
+ var _NumberPostfixInput = _interopRequireDefault(require("./NumberPostfixInput"));
17836
+
17837
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17838
+
17839
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
17840
+
17841
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17842
+
17843
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
17844
+
17845
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
17846
+
17847
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
17848
+
17849
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
17850
+
17851
+ var _default = {
17852
+ props: {
17853
+ value: {
17854
+ type: Number,
17855
+ default: 0
17856
+ },
17857
+ buttonStep: {
17858
+ type: Number,
17859
+ default: 10
17860
+ },
17861
+ min: {
17862
+ type: Number,
17863
+ default: 0
17864
+ },
17865
+ max: {
17866
+ type: Number,
17867
+ default: 100
17868
+ }
17869
+ },
17870
+ model: {
17871
+ prop: 'value',
17872
+ event: 'modelChanged'
17873
+ },
17874
+ inheritAttrs: false,
17875
+ components: {
17876
+ NumberPostfixInput: _NumberPostfixInput.default
17877
+ },
17878
+ mounted: function mounted() {
17879
+ var _this = this;
17880
+
17881
+ this.$nextTick(function () {
17882
+ _this.innerValue = _this.value;
17883
+ });
17884
+ },
17885
+ data: function data() {
17886
+ return {
17887
+ innerValue: 0
17888
+ };
17889
+ },
17890
+ watch: {
17891
+ value: function value(n) {
17892
+ this.innerValue = this.limitValue(n, this.min, this.max);
17893
+ },
17894
+ innerValue: function innerValue(n) {
17895
+ this.innerValue = this.limitValue(n, this.min, this.max);
17896
+ this.$emit('modelChanged', this.innerValue);
17897
+ }
17898
+ },
17899
+ methods: {
17900
+ affectValue: function affectValue(e) {
17901
+ var _this2 = this;
17902
+
17903
+ var operation = e.target.dataset.type === 'increment' ? 1 : -1;
17904
+
17905
+ var rangeValues = _toConsumableArray(new Array(Math.floor(this.max / this.buttonStep))).map(function (_, i) {
17906
+ return (i + 1) * _this2.buttonStep;
17907
+ });
17908
+
17909
+ rangeValues.push(this.innerValue);
17910
+ rangeValues.sort(function (a, b) {
17911
+ return a - b;
17912
+ });
17913
+ rangeValues = Array.from(new Set(rangeValues));
17914
+ var indexOfValue = rangeValues.indexOf(this.innerValue);
17915
+ this.innerValue = rangeValues[this.limitValue(indexOfValue + operation, 0, rangeValues.length - 1)];
17916
+ },
17917
+ limitValue: function limitValue(val, min, max) {
17918
+ if (val < min) {
17919
+ return min;
17920
+ }
17921
+
17922
+ if (val > max) {
17923
+ return max;
17924
+ }
17925
+
17926
+ return val;
17927
+ }
17928
+ }
17929
+ };
17930
+ exports.default = _default;
17931
+ var $420dbf = exports.default || module.exports;
17932
+
17933
+ if (typeof $420dbf === 'function') {
17934
+ $420dbf = $420dbf.options;
17935
+ }
17936
+
17937
+ /* template */
17938
+ Object.assign($420dbf, (function () {
17939
+ var render = function() {
17940
+ var _vm = this
17941
+ var _h = _vm.$createElement
17942
+ var _c = _vm._self._c || _h
17943
+ return _c(
17944
+ "div",
17945
+ { staticClass: "wptb-number-postfix-buttons-wrapper" },
17946
+ [
17947
+ _c(
17948
+ "div",
17949
+ {
17950
+ staticClass:
17951
+ "wptb-number-postfix-button wptb-plugin-box-shadow-xl wptb-unselectable",
17952
+ attrs: { "data-type": "decrement" },
17953
+ on: {
17954
+ click: function($event) {
17955
+ $event.preventDefault()
17956
+ return _vm.affectValue($event)
17957
+ }
17958
+ }
17959
+ },
17960
+ [_vm._v("\n\t\t-\n\t")]
17961
+ ),
17962
+ _vm._v(" "),
17963
+ _c(
17964
+ "number-postfix-input",
17965
+ _vm._b(
17966
+ {
17967
+ class: _vm.$attrs["input-class"],
17968
+ attrs: { min: _vm.min, max: _vm.max },
17969
+ model: {
17970
+ value: _vm.innerValue,
17971
+ callback: function($$v) {
17972
+ _vm.innerValue = $$v
17973
+ },
17974
+ expression: "innerValue"
17975
+ }
17976
+ },
17977
+ "number-postfix-input",
17978
+ _vm.$attrs,
17979
+ false
17980
+ )
17981
+ ),
17982
+ _vm._v(" "),
17983
+ _c(
17984
+ "div",
17985
+ {
17986
+ staticClass:
17987
+ "wptb-number-postfix-button wptb-plugin-box-shadow-xl wptb-unselectable",
17988
+ attrs: { "data-type": "increment" },
17989
+ on: {
17990
+ click: function($event) {
17991
+ $event.preventDefault()
17992
+ return _vm.affectValue($event)
17993
+ }
17994
+ }
17995
+ },
17996
+ [_vm._v("\n\t\t+\n\t")]
17997
+ )
17998
+ ],
17999
+ 1
18000
+ )
18001
+ }
18002
+ var staticRenderFns = []
18003
+ render._withStripped = true
18004
+
18005
+ return {
18006
+ render: render,
18007
+ staticRenderFns: staticRenderFns,
18008
+ _compiled: true,
18009
+ _scopeId: null,
18010
+ functional: undefined
18011
+ };
18012
+ })());
18013
+
18014
+ },{"./NumberPostfixInput":"components/NumberPostfixInput.vue"}],"containers/ResponsiveApp.vue":[function(require,module,exports) {
18015
+ "use strict";
18016
+
18017
+ Object.defineProperty(exports, "__esModule", {
18018
+ value: true
18019
+ });
18020
+ exports.default = void 0;
18021
+
18022
+ var _TableClone = _interopRequireDefault(require("../components/TableClone"));
18023
+
18024
+ var _ScreenSizeSlider = _interopRequireDefault(require("../components/ScreenSizeSlider"));
18025
+
18026
+ var _WPTB_ResponsiveFrontend = _interopRequireDefault(require("../../../WPTB_ResponsiveFrontend"));
18027
+
18028
+ var _WPTB_SortableTable = _interopRequireDefault(require("../../WPTB_SortableTable"));
18029
+
18030
+ var _DeBouncer = _interopRequireDefault(require("../functions/DeBouncer"));
18031
+
18032
+ var _ModalWindow = _interopRequireDefault(require("../components/ModalWindow"));
18033
+
18034
+ var _MaterialButton = _interopRequireDefault(require("../components/MaterialButton"));
18035
+
18036
+ var _NumberPostfixInput = _interopRequireDefault(require("../components/NumberPostfixInput"));
18037
+
18038
+ var _NumberPostfixButtons = _interopRequireDefault(require("../components/NumberPostfixButtons"));
18039
+
18040
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18041
+
18042
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
18043
+
18044
+ var _default = {
18045
+ props: {
18046
+ cloneQuery: {
18047
+ type: String,
18048
+ required: true
18049
+ },
18050
+ screenSizes: Object,
18051
+ compareSizes: Object
18052
+ },
18053
+ components: {
18054
+ NumberPostfixButtons: _NumberPostfixButtons.default,
18055
+ TableClone: _TableClone.default,
18056
+ ScreenSizeSlider: _ScreenSizeSlider.default,
18057
+ ModalWindow: _ModalWindow.default,
18058
+ MaterialButton: _MaterialButton.default,
18059
+ NumberPostfixInput: _NumberPostfixInput.default
18060
+ },
18061
+ data: function data() {
18062
+ return {
18063
+ isVisible: true,
18064
+ currentSize: 0,
18065
+ currentDirectives: null,
18066
+ currentSizeRangeName: 'desktop',
18067
+ sliderPadding: 20,
18068
+ sizeStops: {},
18069
+ responsiveFrontend: null,
18070
+ rebuilding: false,
18071
+ debounceTime: 1000,
18072
+ sizeLimitMin: 100,
18073
+ sizeLimitMax: 0,
18074
+ resizePercent: 100,
18075
+ firstMountStyle: true
18076
+ };
18077
+ },
18078
+ watch: {
18079
+ currentSizeRangeName: function currentSizeRangeName(n) {
18080
+ this.appOptions.currentBreakpoint = n;
18081
+ },
18082
+ directives: {
18083
+ handler: function handler() {
18084
+ this.currentDirectives = this.encodeResponsiveDirectives();
18085
+ },
18086
+ deep: true
18087
+ },
18088
+ 'appOptions.currentSize': {
18089
+ handler: function handler(n) {
18090
+ var _this = this;
18091
+
18092
+ var previousRangeName = this.currentSizeRangeName;
18093
+ this.currentSizeRangeName = this.calculateSizeRangeName(n);
18094
+
18095
+ if (previousRangeName !== this.currentSizeRangeName && this.directives.responsiveEnabled) {
18096
+ this.rebuilding = true;
18097
+ (0, _DeBouncer.default)('currentSize', function () {
18098
+ // rebuilt table according to its responsive directives
18099
+ _this.responsiveFrontend.rebuildTables(_this.appOptions.currentSize);
18100
+
18101
+ _this.rebuilding = false;
18102
+ }, this.debounceTime);
18103
+ }
18104
+ }
18105
+ }
18106
+ },
18107
+ beforeMount: function beforeMount() {// calculate slider size stops before mounting the component
18108
+ // this.sizeStops = this.sliderSizeStops();
18109
+ },
18110
+ mounted: function mounted() {
18111
+ var _this2 = this;
18112
+
18113
+ // add a listener to section change event to hide/show component
18114
+ document.addEventListener('wptbSectionChanged', function (e) {
18115
+ _this2.isVisible = e.detail === 'table_responsive_menu';
18116
+ }); // @deprecated
18117
+ // const maxWidth = Number.parseInt(
18118
+ // document.querySelector(this.cloneQuery).dataset.wptbTableContainerMaxWidth,
18119
+ // 10
18120
+ // );
18121
+ // const builderWidth = this.$refs.builderResponsive.getBoundingClientRect().width;
18122
+ //
18123
+ // // take maximum width of table to consideration while calculating size limit max
18124
+ // this.sizeLimitMax = Math.min(maxWidth, builderWidth);
18125
+
18126
+ this.calculateSizeLimitMax();
18127
+ },
18128
+ computed: {
18129
+ /**
18130
+ * Calculate certain properties of responsive table element's style
18131
+ */
18132
+ tableStyle: function tableStyle() {
18133
+ // @deprecated
18134
+ // if (!this.directives.responsiveEnabled) {
18135
+ // return {};
18136
+ // }
18137
+ // don't make any style changes to table in desktop breakpoint to reflect the table builder styles intact since currently the breakpoint users are creating their table, by default, is desktop
18138
+ // if (this.currentSizeRangeName === 'desktop') {
18139
+ // return {};
18140
+ // }
18141
+ var width = this.limitToRange(this.appOptions.currentSize, Math.min(this.sizeLimitMin, this.sizeLimitMax), Math.max(this.sizeLimitMin, this.sizeLimitMax));
18142
+ return {
18143
+ width: "".concat(width, "px"),
18144
+ transform: "scale(".concat(this.resizePercent / 100, ")"),
18145
+ transformOrigin: 'center top',
18146
+ transition: 'all 0.2s ease-out'
18147
+ };
18148
+ },
18149
+ modalRelative: function modalRelative() {
18150
+ return document.querySelector('.wptb-builder-panel');
18151
+ }
18152
+ },
18153
+ methods: {
18154
+ headerFullyMerged: function headerFullyMerged(table) {
18155
+ var isHeaderFullyMerged = Array.from(Array.from(table.querySelectorAll('tr'))[0].querySelectorAll('td')).length === 1;
18156
+ this.appOptions.headerFullyMerged = isHeaderFullyMerged;
18157
+ },
18158
+
18159
+ /**
18160
+ * Limit a number between a min/max range.
18161
+ *
18162
+ * @param {number} val value to be limited
18163
+ * @param {number} min minimum value of range
18164
+ * @param {number} max maximum value of range
18165
+ * @return {number} limited value
18166
+ */
18167
+ limitToRange: function limitToRange(val, min, max) {
18168
+ if (val > max) {
18169
+ return max;
18170
+ }
18171
+
18172
+ if (val < min) {
18173
+ return min;
18174
+ }
18175
+
18176
+ return val;
18177
+ },
18178
+ // handler for `tableCloned` event of `TableClone` component. Mainly will be used to set up `WPTB_ResponsiveFrontend` class and update directives with the ones found on main table
18179
+ tableCloned: function tableCloned(mainDirectives, mainTable, clonedTable) {
18180
+ // calculate new max size limit at every table clone to reflect changes if there is any
18181
+ this.calculateSizeLimitMax();
18182
+ this.headerFullyMerged(clonedTable);
18183
+ this.responsiveFrontend = new _WPTB_ResponsiveFrontend.default({
18184
+ query: '.wptb-builder-responsive table'
18185
+ });
18186
+ var sortableTable = new _WPTB_SortableTable.default({
18187
+ table: clonedTable
18188
+ });
18189
+ sortableTable.sortableTableInitialization(this.responsiveFrontend); // there is already a directive at main table, decode and assign it to current ones
18190
+
18191
+ if (mainDirectives) {
18192
+ var decodedMainDirectives = this.decodeResponsiveDirectives(mainDirectives);
18193
+
18194
+ try {
18195
+ var mainDirectiveObj = JSON.parse(decodedMainDirectives);
18196
+ this.deepMergeObject(this.directives, mainDirectiveObj);
18197
+ } catch (e) {
18198
+ // eslint-disable-next-line no-console
18199
+ console.warn('[WPTB]: invalid directive found at main table');
18200
+ }
18201
+ }
18202
+
18203
+ var tabEvent = new CustomEvent('table:cloned', {
18204
+ detail: {
18205
+ WPTB_ResponsiveFrontend: _WPTB_ResponsiveFrontend.default,
18206
+ mainTable: mainTable,
18207
+ clonedTable: clonedTable
18208
+ }
18209
+ });
18210
+ mainTable.dispatchEvent(tabEvent);
18211
+ },
18212
+
18213
+ /**
18214
+ * Deep merge two objects.
18215
+ *
18216
+ * In order to not break the object reference between store patterned objects, this function will be used to add every key of target object to base object, so instead of equalizing the store object to a new value, key values of the store will be updated, this way, object reference link will not be broken and reactive abilities of the store will continue to function.
18217
+ *
18218
+ * @param {Object} baseObj base object
18219
+ * @param {Object} targetObj target object
18220
+ */
18221
+ deepMergeObject: function deepMergeObject(baseObj, targetObj) {
18222
+ var _this3 = this;
18223
+
18224
+ // eslint-disable-next-line array-callback-return
18225
+ Object.keys(targetObj).map(function (key) {
18226
+ if (Object.prototype.hasOwnProperty.call(targetObj, key)) {
18227
+ if (baseObj[key] !== undefined) {
18228
+ if (_typeof(baseObj[key]) === 'object') {
18229
+ // eslint-disable-next-line no-param-reassign
18230
+ _this3.deepMergeObject(baseObj[key], targetObj[key]);
18231
+ } else {
18232
+ // eslint-disable-next-line no-param-reassign
18233
+ baseObj[key] = targetObj[key];
18234
+ }
18235
+ }
18236
+ }
18237
+ });
18238
+ },
18239
+ // handler for event that signals end of directive copy operation to table on DOM
18240
+ directivesCopied: function directivesCopied(mainTableHaveDirectives) {
18241
+ // rebuilt table according to its responsive directives
18242
+ this.responsiveFrontend.rebuildTables(this.appOptions.currentSize); // if main table have directives, it means that we are using them, so it is unnecessary to fire up save event for the table
18243
+
18244
+ if (!mainTableHaveDirectives) {
18245
+ new WPTB_TableStateSaveManager().tableStateSet();
18246
+ }
18247
+
18248
+ this.rebuilding = false;
18249
+ },
18250
+
18251
+ /**
18252
+ * @deprecated
18253
+ * Recreate an object compatible with screen-size-slider component.
18254
+ *
18255
+ * This function will reduce the screen sizes object sent from backend to be compatible with screen-size-slider component.
18256
+ *
18257
+ * @return {Object} reformatted slider size object
18258
+ */
18259
+ sliderSizeStops: function sliderSizeStops() {
18260
+ var _this4 = this;
18261
+
18262
+ var normalizedStops = Object.keys(this.screenSizes).reduce(function (p, c) {
18263
+ if (Object.prototype.hasOwnProperty.call(_this4.screenSizes, c)) {
18264
+ // eslint-disable-next-line no-param-reassign
18265
+ p[_this4.screenSizes[c].name] = _this4.screenSizes[c].width;
18266
+ }
18267
+
18268
+ return p;
18269
+ }, {}); // add stops to directives
18270
+ // eslint-disable-next-line vue/no-side-effects-in-computed-properties
18271
+
18272
+ this.directives.stops = normalizedStops;
18273
+ return normalizedStops;
18274
+ },
18275
+
18276
+ /**
18277
+ * Find out the range key name for the size value.
18278
+ *
18279
+ * @param {number} val size value
18280
+ * @return {string} range key name
18281
+ */
18282
+ calculateSizeRangeName: function calculateSizeRangeName(val) {
18283
+ var mainObject = this.directives.breakpoints;
18284
+ var ranges = Object.keys(mainObject).filter(function (s) {
18285
+ if (Object.prototype.hasOwnProperty.call(mainObject, s)) {
18286
+ return mainObject[s].width <= val;
18287
+ }
18288
+
18289
+ return false;
18290
+ }).sort(function (a, b) {
18291
+ return mainObject[a].width - mainObject[b].width;
18292
+ });
18293
+
18294
+ if (ranges.length === 0) {
18295
+ return 'mobile';
18296
+ }
18297
+
18298
+ return ranges[ranges.length - 1];
18299
+ },
18300
+ handleSizeSlideChange: function handleSizeSlideChange(e) {
18301
+ this.appOptions.currentSize = e;
18302
+ },
18303
+
18304
+ /**
18305
+ * Encode responsive directives.
18306
+ *
18307
+ * @return {string} base64 string representation of directives
18308
+ */
18309
+ encodeResponsiveDirectives: function encodeResponsiveDirectives() {
18310
+ var stringifiedDirectives = JSON.stringify(this.directives);
18311
+ return btoa(stringifiedDirectives);
18312
+ },
18313
+
18314
+ /**
18315
+ * Decode responsive directives.
18316
+ *
18317
+ * @param {string} val
18318
+ * @return {string} decoded value
18319
+ */
18320
+ decodeResponsiveDirectives: function decodeResponsiveDirectives(val) {
18321
+ return atob(val);
18322
+ },
18323
+ showCellIdentifications: function showCellIdentifications() {
18324
+ this.appOptions.identifyCells = true;
18325
+ },
18326
+ calculateSizeLimitMax: function calculateSizeLimitMax() {
18327
+ var maxWidth = Number.parseInt(document.querySelector(this.cloneQuery).dataset.wptbTableContainerMaxWidth, 10);
18328
+ var builderWidth = this.$refs.builderResponsive.getBoundingClientRect().width; // take maximum width of table to consideration while calculating size limit max
18329
+
18330
+ this.sizeLimitMax = Math.min(maxWidth, builderWidth);
18331
+ }
18332
+ }
18333
+ };
18334
+ exports.default = _default;
18335
+ var $26cd08 = exports.default || module.exports;
18336
+
18337
+ if (typeof $26cd08 === 'function') {
18338
+ $26cd08 = $26cd08.options;
18339
+ }
18340
+
18341
+ /* template */
18342
+ Object.assign($26cd08, (function () {
18343
+ var render = function() {
18344
+ var _vm = this
18345
+ var _h = _vm.$createElement
18346
+ var _c = _vm._self._c || _h
18347
+ return _c("transition", { attrs: { name: "wptb-fade" } }, [
18348
+ _vm.isVisible
18349
+ ? _c(
18350
+ "div",
18351
+ { ref: "builderResponsive", staticClass: "wptb-builder-responsive" },
18352
+ [
18353
+ _c(
18354
+ "div",
18355
+ { staticClass: "wptb-responsive-menu-tools" },
18356
+ [
18357
+ _c("screen-size-slider", {
18358
+ attrs: {
18359
+ "end-padding": _vm.sliderPadding,
18360
+ stops: _vm.directives.breakpoints,
18361
+ "model-val": _vm.appOptions.currentSize,
18362
+ "enable-breakpoint-customization": false
18363
+ },
18364
+ on: { slide: _vm.handleSizeSlideChange }
18365
+ })
18366
+ ],
18367
+ 1
18368
+ ),
18369
+ _vm._v(" "),
18370
+ _c(
18371
+ "div",
18372
+ {
18373
+ staticClass:
18374
+ "wptb-responsive-builder-main wptb-checkerboard-pattern wptb-plugin-inset-shadow-md"
18375
+ },
18376
+ [
18377
+ _c(
18378
+ "div",
18379
+ { staticClass: "wptb-responsive-builder-toolbox-float" },
18380
+ [
18381
+ _c(
18382
+ "div",
18383
+ {
18384
+ staticClass:
18385
+ "wptb-responsive-builder-toolbox-left-float"
18386
+ },
18387
+ [
18388
+ _c("number-postfix-input", {
18389
+ staticClass:
18390
+ "wptb-size-input wptb-plugin-box-shadow-xl",
18391
+ attrs: { "post-fix": "px", "only-enter": true },
18392
+ model: {
18393
+ value: _vm.appOptions.currentSize,
18394
+ callback: function($$v) {
18395
+ _vm.$set(_vm.appOptions, "currentSize", $$v)
18396
+ },
18397
+ expression: "appOptions.currentSize"
18398
+ }
18399
+ }),
18400
+ _vm._v(" "),
18401
+ _c("number-postfix-buttons", {
18402
+ attrs: {
18403
+ "input-class": [
18404
+ "wptb-size-input",
18405
+ "wptb-plugin-box-shadow-xl"
18406
+ ],
18407
+ "post-fix": "%",
18408
+ "only-enter": true,
18409
+ min: 10,
18410
+ max: 100,
18411
+ enableLimit: true
18412
+ },
18413
+ model: {
18414
+ value: _vm.resizePercent,
18415
+ callback: function($$v) {
18416
+ _vm.resizePercent = $$v
18417
+ },
18418
+ expression: "resizePercent"
18419
+ }
18420
+ })
18421
+ ],
18422
+ 1
18423
+ ),
18424
+ _vm._v(" "),
18425
+ _c(
18426
+ "material-button",
18427
+ {
18428
+ staticClass: "wptb-plugin-box-shadow-xl",
18429
+ attrs: {
18430
+ size: "fit-content",
18431
+ click: _vm.showCellIdentifications
18432
+ }
18433
+ },
18434
+ [
18435
+ _vm._v(
18436
+ _vm._s(_vm._f("cap")(_vm.strings.identifyCells)) +
18437
+ "\n\t\t\t\t"
18438
+ )
18439
+ ]
18440
+ )
18441
+ ],
18442
+ 1
18443
+ ),
18444
+ _vm._v(" "),
18445
+ _c("table-clone", {
18446
+ ref: "tableClone",
18447
+ attrs: {
18448
+ clone: _vm.isVisible,
18449
+ "clone-query": _vm.cloneQuery,
18450
+ "table-directives": _vm.currentDirectives,
18451
+ "table-style": _vm.tableStyle
18452
+ },
18453
+ on: {
18454
+ tableCloned: _vm.tableCloned,
18455
+ directivesCopied: _vm.directivesCopied
18456
+ }
18457
+ }),
18458
+ _vm._v(" "),
18459
+ _c("transition", { attrs: { name: "wptb-fade" } }, [
18460
+ !_vm.directives.responsiveEnabled
18461
+ ? _c("div", {
18462
+ staticClass: "wptb-responsive-disabled-table-overlay"
18463
+ })
18464
+ : _vm._e()
18465
+ ]),
18466
+ _vm._v(" "),
18467
+ _c("transition", { attrs: { name: "wptb-fade" } }, [
18468
+ _c(
18469
+ "div",
18470
+ {
18471
+ directives: [
18472
+ {
18473
+ name: "show",
18474
+ rawName: "v-show",
18475
+ value: _vm.rebuilding,
18476
+ expression: "rebuilding"
18477
+ }
18478
+ ],
18479
+ staticClass: "wptb-responsive-wait-overlay"
18480
+ },
18481
+ [_vm._v(_vm._s(_vm.strings.rebuilding))]
18482
+ )
18483
+ ]),
18484
+ _vm._v(" "),
18485
+ _c("modal-window", {
18486
+ attrs: {
18487
+ visible: _vm.appOptions.hasLegacyResponsive,
18488
+ message: _vm.strings.legacyResponsiveWarning,
18489
+ "relative-ref": _vm.modalRelative,
18490
+ callback: function() {
18491
+ _vm.appOptions.hasLegacyResponsive = false
18492
+ }
18493
+ }
18494
+ })
18495
+ ],
18496
+ 1
18497
+ )
18498
+ ]
18499
+ )
18500
+ : _vm._e()
18501
+ ])
18502
+ }
18503
+ var staticRenderFns = []
18504
+ render._withStripped = true
18505
+
18506
+ return {
18507
+ render: render,
18508
+ staticRenderFns: staticRenderFns,
18509
+ _compiled: true,
18510
+ _scopeId: null,
18511
+ functional: undefined
18512
+ };
18513
+ })());
18514
+
18515
+ },{"../components/TableClone":"components/TableClone.vue","../components/ScreenSizeSlider":"components/ScreenSizeSlider.vue","../../../WPTB_ResponsiveFrontend":"../../WPTB_ResponsiveFrontend.js","../../WPTB_SortableTable":"../WPTB_SortableTable.js","../functions/DeBouncer":"functions/DeBouncer.js","../components/ModalWindow":"components/ModalWindow.vue","../components/MaterialButton":"components/MaterialButton.vue","../components/NumberPostfixInput":"components/NumberPostfixInput.vue","../components/NumberPostfixButtons":"components/NumberPostfixButtons.vue"}],"components/ResponsiveControlsRow.vue":[function(require,module,exports) {
18516
+
18517
+ var $d55f26 = exports.default || module.exports;
18518
+
18519
+ if (typeof $d55f26 === 'function') {
18520
+ $d55f26 = $d55f26.options;
18521
+ }
18522
+
18523
+ /* template */
18524
+ Object.assign($d55f26, (function () {
18525
+ var render = function() {
18526
+ var _vm = this
18527
+ var _h = _vm.$createElement
18528
+ var _c = _vm._self._c || _h
18529
+ return _c(
18530
+ "div",
18531
+ { staticClass: "wptb-controls-flex-row" },
18532
+ [_vm._t("default")],
18533
+ 2
18534
+ )
18535
+ }
18536
+ var staticRenderFns = []
18537
+ render._withStripped = true
18538
+
18539
+ return {
18540
+ render: render,
18541
+ staticRenderFns: staticRenderFns,
18542
+ _compiled: true,
18543
+ _scopeId: null,
18544
+ functional: undefined
18545
+ };
18546
+ })());
18547
+
18548
+ },{}],"plugins/filters.js":[function(require,module,exports) {
18549
+ "use strict";
18550
+
18551
+ Object.defineProperty(exports, "__esModule", {
18552
+ value: true
18553
+ });
18554
+ exports.default = void 0;
18555
+
18556
+ /**
18557
+ * Plugin for reusable.
18558
+ *
18559
+ * @param {object} Vue Vue instance
18560
+ * @param {object} options filter options
18561
+ */
18562
+ // eslint-disable-next-line no-unused-vars
18563
+ function install(Vue, options) {
18564
+ // capitalize filter
18565
+ Vue.filter('cap', function (val) {
18566
+ return val.split(' ').map(function (v) {
18567
+ return v[0].toUpperCase() + v.slice(1);
18568
+ }).join(' ');
18569
+ });
18570
+ }
18571
+
18572
+ var _default = {
18573
+ install: install
18574
+ };
18575
+ exports.default = _default;
18576
+ },{}],"plugins/strings.js":[function(require,module,exports) {
18577
+ "use strict";
18578
+
18579
+ Object.defineProperty(exports, "__esModule", {
18580
+ value: true
18581
+ });
18582
+ exports.default = void 0;
18583
+
18584
+ /**
18585
+ * plugin install method
18586
+ *
18587
+ * plugin for adding strings data field to all components to use
18588
+ *
18589
+ * @param {object} Vue Vue object
18590
+ * @param {object} options options to be used at plugin
18591
+ * @returns {{strings: boolean}}
18592
+ */
18593
+ function install(Vue, options) {
18594
+ Vue.mixin({
18595
+ data: function data() {
18596
+ return {
18597
+ strings: options.strings
18598
+ };
18599
+ }
18600
+ });
18601
+ }
18602
+ /**
18603
+ * @module strings plugin
18604
+ */
18605
+
18606
+
18607
+ var _default = {
18608
+ install: install
18609
+ };
18610
+ exports.default = _default;
18611
+ },{}],"../../../../../node_modules/vue-fragment/dist/vue-fragment.esm.js":[function(require,module,exports) {
18612
+ "use strict";
18613
+
18614
+ Object.defineProperty(exports, "__esModule", {
18615
+ value: true
18616
+ });
18617
+ exports.Plugin = exports.SSR = exports.Fragment = exports.default = void 0;
18618
+
18619
+ function _defineProperty(e, n, t) {
18620
+ return n in e ? Object.defineProperty(e, n, {
18621
+ value: t,
18622
+ enumerable: !0,
18623
+ configurable: !0,
18624
+ writable: !0
18625
+ }) : e[n] = t, e;
18626
+ }
18627
+
18628
+ function _objectSpread(e) {
18629
+ for (var n = 1; n < arguments.length; n++) {
18630
+ var t = null != arguments[n] ? arguments[n] : {},
18631
+ r = Object.keys(t);
18632
+ "function" == typeof Object.getOwnPropertySymbols && (r = r.concat(Object.getOwnPropertySymbols(t).filter(function (e) {
18633
+ return Object.getOwnPropertyDescriptor(t, e).enumerable;
18634
+ }))), r.forEach(function (n) {
18635
+ _defineProperty(e, n, t[n]);
18636
+ });
18637
+ }
18638
+
18639
+ return e;
18640
+ }
18641
+
18642
+ var freeze = function (e, n, t) {
18643
+ Object.defineProperty(e, n, {
18644
+ configurable: !0,
18645
+ get: function () {
18646
+ return t;
18647
+ },
18648
+ set: function (e) {
18649
+ console.warn("tried to set frozen property ".concat(n, " with ").concat(e));
18650
+ }
18651
+ });
18652
+ },
18653
+ unfreeze = function (e, n) {
18654
+ var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
18655
+ Object.defineProperty(e, n, {
18656
+ configurable: !0,
18657
+ writable: !0,
18658
+ value: t
18659
+ });
18660
+ },
18661
+ component = {
18662
+ abstract: !0,
18663
+ name: "Fragment",
18664
+ props: {
18665
+ name: {
18666
+ type: String,
18667
+ default: function () {
18668
+ return Math.floor(Date.now() * Math.random()).toString(16);
18669
+ }
18670
+ }
18671
+ },
18672
+ mounted: function () {
18673
+ var e = this.$el,
18674
+ n = e.parentNode,
18675
+ t = document.createComment("fragment#".concat(this.name, "#head")),
18676
+ r = document.createComment("fragment#".concat(this.name, "#tail"));
18677
+ n.insertBefore(t, e), n.insertBefore(r, e), e.appendChild = function (t) {
18678
+ n.insertBefore(t, r), freeze(t, "parentNode", e);
18679
+ }, e.insertBefore = function (t, r) {
18680
+ n.insertBefore(t, r), freeze(t, "parentNode", e);
18681
+ }, e.removeChild = function (e) {
18682
+ n.removeChild(e), unfreeze(e, "parentNode");
18683
+ }, Array.from(e.childNodes).forEach(function (n) {
18684
+ return e.appendChild(n);
18685
+ }), n.removeChild(e), freeze(e, "parentNode", n), freeze(e, "nextSibling", r.nextSibling);
18686
+ var o = n.insertBefore;
18687
+
18688
+ n.insertBefore = function (r, i) {
18689
+ o.call(n, r, i !== e ? i : t);
18690
+ };
18691
+
18692
+ var i = n.removeChild;
18693
+
18694
+ n.removeChild = function (a) {
18695
+ if (a === e) {
18696
+ for (; t.nextSibling !== r;) e.removeChild(t.nextSibling);
18697
+
18698
+ n.removeChild(t), n.removeChild(r), unfreeze(e, "parentNode"), n.insertBefore = o, n.removeChild = i;
18699
+ } else i.call(n, a);
18700
+ };
18701
+ },
18702
+ render: function (e) {
18703
+ var n = this,
18704
+ t = this.$slots.default;
18705
+ return t && t.length && t.forEach(function (e) {
18706
+ return e.data = _objectSpread({}, e.data, {
18707
+ attrs: _objectSpread({
18708
+ fragment: n.name
18709
+ }, (e.data || {}).attrs)
18710
+ });
18711
+ }), e("div", {
18712
+ attrs: {
18713
+ fragment: this.name
18714
+ }
18715
+ }, t);
18716
+ }
18717
+ };
18718
+
18719
+ function ssr(e, n) {
18720
+ "production" !== "development" && console.warn("v-fragment SSR is not implemented yet.");
18721
+ }
18722
+
18723
+ var Fragment = component,
18724
+ SSR = ssr,
18725
+ Plugin = {
18726
+ install: function (e) {
18727
+ e.component("fragment", component);
18728
+ }
18729
+ },
18730
+ index = {
18731
+ Fragment: component,
18732
+ Plugin: Plugin,
18733
+ SSR: ssr
18734
+ };
18735
+ exports.Plugin = Plugin;
18736
+ exports.SSR = SSR;
18737
+ exports.Fragment = Fragment;
18738
+ var _default = index;
18739
+ exports.default = _default;
18740
+ },{}],"mixins/PanelControlBase.js":[function(require,module,exports) {
18741
+ "use strict";
18742
+
18743
+ Object.defineProperty(exports, "__esModule", {
18744
+ value: true
18745
+ });
18746
+ exports.default = void 0;
18747
+
18748
+ /**
18749
+ * Base for left panel controls that will be hooked directly to Vue instances.
18750
+ */
18751
+ var PanelControlBase = {
18752
+ props: {
18753
+ label: String,
18754
+ value: {
18755
+ type: null
18756
+ },
18757
+ disabled: {
18758
+ type: Boolean,
18759
+ default: false
18760
+ },
18761
+ dependsValue: {
18762
+ type: null,
18763
+ default: null
18764
+ },
18765
+ dependsCallback: {
18766
+ type: Function,
18767
+ default: function _default(d, c) {
18768
+ return c;
18769
+ }
18770
+ }
18771
+ },
18772
+ data: function data() {
18773
+ return {
18774
+ innerValue: ''
18775
+ };
18776
+ },
18777
+ model: {
18778
+ prop: 'value',
18779
+ event: 'valueChanged'
18780
+ },
18781
+ watch: {
18782
+ value: function value(n) {
18783
+ this.innerValue = n;
18784
+ },
18785
+ innerValue: function innerValue(n) {
18786
+ this.$emit('valueChanged', n);
18787
+ },
18788
+ dependsValue: function dependsValue(n) {
18789
+ if (n === null) {
18790
+ return;
18791
+ }
18792
+
18793
+ this.innerValue = this.dependsCallback.call(this, n, this.innerValue);
18794
+ }
18795
+ },
18796
+ mounted: function mounted() {
18797
+ this.innerValue = this.value;
18798
+ }
18799
+ };
18800
+ var _default = PanelControlBase;
18801
+ exports.default = _default;
18802
+ },{}],"components/PanelToggleControl.vue":[function(require,module,exports) {
18803
+ "use strict";
18804
+
18805
+ Object.defineProperty(exports, "__esModule", {
18806
+ value: true
18807
+ });
18808
+ exports.default = void 0;
18809
+
18810
+ var _PanelControlBase = _interopRequireDefault(require("../mixins/PanelControlBase"));
18811
+
18812
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18813
+
18814
+ //
18815
+ //
18816
+ //
18817
+ //
18818
+ //
18819
+ //
18820
+ //
18821
+ //
18822
+ //
18823
+ //
18824
+ //
18825
+ //
18826
+ //
18827
+ var _default = {
18828
+ mixins: [_PanelControlBase.default]
18829
+ };
18830
+ exports.default = _default;
18831
+ var $f6974b = exports.default || module.exports;
18832
+
18833
+ if (typeof $f6974b === 'function') {
18834
+ $f6974b = $f6974b.options;
18835
+ }
18836
+
18837
+ /* template */
18838
+ Object.assign($f6974b, (function () {
18839
+ var render = function() {
18840
+ var _vm = this
18841
+ var _h = _vm.$createElement
18842
+ var _c = _vm._self._c || _h
18843
+ return _c(
18844
+ "div",
18845
+ {
18846
+ staticClass:
18847
+ "wptb-element-option wptb-settings-items wptb-plugin-width-full"
18848
+ },
18849
+ [
18850
+ _c("div", { staticClass: "wptb-settings-row wptb-settings-middle-xs" }, [
18851
+ _c("label", { staticClass: "wptb-toggle" }, [
18852
+ _c("span", { staticStyle: { "font-size": "16px" } }, [
18853
+ _vm._v("\n\t\t\t\t" + _vm._s(_vm.label) + "\n\t\t\t")
18854
+ ]),
18855
+ _vm._v(" "),
18856
+ _c("input", {
18857
+ directives: [
18858
+ {
18859
+ name: "model",
18860
+ rawName: "v-model",
18861
+ value: _vm.innerValue,
18862
+ expression: "innerValue"
18863
+ }
18864
+ ],
18865
+ staticClass: "wptb-element-property",
18866
+ attrs: { type: "checkbox", disabled: _vm.disabled },
18867
+ domProps: {
18868
+ checked: Array.isArray(_vm.innerValue)
18869
+ ? _vm._i(_vm.innerValue, null) > -1
18870
+ : _vm.innerValue
18871
+ },
18872
+ on: {
18873
+ change: function($event) {
18874
+ var $$a = _vm.innerValue,
18875
+ $$el = $event.target,
18876
+ $$c = $$el.checked ? true : false
18877
+ if (Array.isArray($$a)) {
18878
+ var $$v = null,
18879
+ $$i = _vm._i($$a, $$v)
18880
+ if ($$el.checked) {
18881
+ $$i < 0 && (_vm.innerValue = $$a.concat([$$v]))
18882
+ } else {
18883
+ $$i > -1 &&
18884
+ (_vm.innerValue = $$a
18885
+ .slice(0, $$i)
18886
+ .concat($$a.slice($$i + 1)))
18887
+ }
18888
+ } else {
18889
+ _vm.innerValue = $$c
18890
+ }
18891
+ }
18892
+ }
18893
+ }),
18894
+ _vm._v(" "),
18895
+ _c("i")
18896
+ ])
18897
+ ])
18898
+ ]
18899
+ )
18900
+ }
18901
+ var staticRenderFns = []
18902
+ render._withStripped = true
18903
+
18904
+ return {
18905
+ render: render,
18906
+ staticRenderFns: staticRenderFns,
18907
+ _compiled: true,
18908
+ _scopeId: null,
18909
+ functional: undefined
18910
+ };
18911
+ })());
18912
+
18913
+ },{"../mixins/PanelControlBase":"mixins/PanelControlBase.js"}],"components/PanelDropdownControl.vue":[function(require,module,exports) {
18914
+ "use strict";
18915
+
18916
+ Object.defineProperty(exports, "__esModule", {
18917
+ value: true
18918
+ });
18919
+ exports.default = void 0;
18920
+
18921
+ var _PanelControlBase = _interopRequireDefault(require("../mixins/PanelControlBase"));
18922
+
18923
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18924
+
18925
+ //
18926
+ //
18927
+ //
18928
+ //
18929
+ //
18930
+ //
18931
+ //
18932
+ //
18933
+ //
18934
+ //
18935
+ //
18936
+ //
18937
+ //
18938
+ //
18939
+ //
18940
+ //
18941
+ var _default = {
18942
+ props: {
18943
+ options: {
18944
+ type: Object,
18945
+ default: function _default() {}
18946
+ }
18947
+ },
18948
+ mixins: [_PanelControlBase.default]
18949
+ };
18950
+ exports.default = _default;
18951
+ var $5b3d68 = exports.default || module.exports;
18952
+
18953
+ if (typeof $5b3d68 === 'function') {
18954
+ $5b3d68 = $5b3d68.options;
18955
+ }
18956
+
18957
+ /* template */
18958
+ Object.assign($5b3d68, (function () {
18959
+ var render = function() {
18960
+ var _vm = this
18961
+ var _h = _vm.$createElement
18962
+ var _c = _vm._self._c || _h
18963
+ return _c(
18964
+ "div",
18965
+ {
18966
+ staticClass:
18967
+ "wptb-element-option wptb-settings-items wptb-plugin-width-full"
18968
+ },
18969
+ [
18970
+ _c("div", { staticClass: "wptb-settings-row wptb-settings-middle-xs" }, [
18971
+ _c(
18972
+ "label",
18973
+ {
18974
+ staticClass:
18975
+ "wptb-control-row wptb-flex wptb-flex-row wptb-flex-align-center wptb-flex-justify-space-between"
18976
+ },
18977
+ [
18978
+ _c("span", { staticStyle: { "font-size": "16px" } }, [
18979
+ _vm._v("\n\t\t\t\t" + _vm._s(_vm.label) + "\n\t\t\t")
18980
+ ]),
18981
+ _vm._v(" "),
18982
+ _c(
18983
+ "select",
18984
+ {
18985
+ directives: [
18986
+ {
18987
+ name: "model",
18988
+ rawName: "v-model",
18989
+ value: _vm.innerValue,
18990
+ expression: "innerValue"
18991
+ }
18992
+ ],
18993
+ attrs: { disabled: _vm.disabled },
18994
+ on: {
18995
+ change: function($event) {
18996
+ var $$selectedVal = Array.prototype.filter
18997
+ .call($event.target.options, function(o) {
18998
+ return o.selected
18999
+ })
19000
+ .map(function(o) {
19001
+ var val = "_value" in o ? o._value : o.value
19002
+ return val
19003
+ })
19004
+ _vm.innerValue = $event.target.multiple
19005
+ ? $$selectedVal
19006
+ : $$selectedVal[0]
19007
+ }
19008
+ }
19009
+ },
19010
+ _vm._l(_vm.options, function(name, key) {
19011
+ return _c("option", { key: key, domProps: { value: key } }, [
19012
+ _vm._v(_vm._s(_vm._f("cap")(name)))
19013
+ ])
19014
+ }),
19015
+ 0
19016
+ )
19017
+ ]
19018
+ )
19019
+ ])
19020
+ ]
19021
+ )
19022
+ }
19023
+ var staticRenderFns = []
19024
+ render._withStripped = true
19025
+
19026
+ return {
19027
+ render: render,
19028
+ staticRenderFns: staticRenderFns,
19029
+ _compiled: true,
19030
+ _scopeId: null,
19031
+ functional: undefined
19032
+ };
19033
+ })());
19034
+
19035
+ },{"../mixins/PanelControlBase":"mixins/PanelControlBase.js"}],"components/ResponsivePanelGeneralControls.vue":[function(require,module,exports) {
19036
+ "use strict";
19037
+
19038
+ Object.defineProperty(exports, "__esModule", {
19039
+ value: true
19040
+ });
19041
+ exports.default = void 0;
19042
+
19043
+ var _vueFragment = require("vue-fragment");
19044
+
19045
+ var _PanelToggleControl = _interopRequireDefault(require("./PanelToggleControl"));
19046
+
19047
+ var _PanelDropdownControl = _interopRequireDefault(require("./PanelDropdownControl"));
19048
+
19049
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19050
+
19051
+ //
19052
+ //
19053
+ //
19054
+ //
19055
+ //
19056
+ //
19057
+ //
19058
+ //
19059
+ //
19060
+ //
19061
+ //
19062
+ //
19063
+ //
19064
+ //
19065
+ //
19066
+ //
19067
+ //
19068
+ //
19069
+ //
19070
+ //
19071
+ //
19072
+ var _default = {
19073
+ components: {
19074
+ PanelToggleControl: _PanelToggleControl.default,
19075
+ PanelDropdownControl: _PanelDropdownControl.default,
19076
+ Fragment: _vueFragment.Fragment
19077
+ }
19078
+ };
19079
+ exports.default = _default;
19080
+ var $1e9780 = exports.default || module.exports;
19081
+
19082
+ if (typeof $1e9780 === 'function') {
19083
+ $1e9780 = $1e9780.options;
19084
+ }
19085
+
19086
+ /* template */
19087
+ Object.assign($1e9780, (function () {
19088
+ var render = function() {
19089
+ var _vm = this
19090
+ var _h = _vm.$createElement
19091
+ var _c = _vm._self._c || _h
19092
+ return _c(
19093
+ "fragment",
19094
+ [
19095
+ _c("panel-toggle-control", {
19096
+ attrs: { label: _vm._f("cap")(_vm.strings.enableResponsive) },
19097
+ model: {
19098
+ value: _vm.directives.responsiveEnabled,
19099
+ callback: function($$v) {
19100
+ _vm.$set(_vm.directives, "responsiveEnabled", $$v)
19101
+ },
19102
+ expression: "directives.responsiveEnabled"
19103
+ }
19104
+ }),
19105
+ _vm._v(" "),
19106
+ _c("panel-dropdown-control", {
19107
+ attrs: {
19108
+ label: _vm._f("cap")(_vm.strings.relative),
19109
+ options: {
19110
+ window: _vm.strings.window,
19111
+ container: _vm.strings.container
19112
+ },
19113
+ disabled: !_vm.directives.responsiveEnabled
19114
+ },
19115
+ model: {
19116
+ value: _vm.directives.relativeWidth,
19117
+ callback: function($$v) {
19118
+ _vm.$set(_vm.directives, "relativeWidth", $$v)
19119
+ },
19120
+ expression: "directives.relativeWidth"
19121
+ }
19122
+ }),
19123
+ _vm._v(" "),
19124
+ _c("panel-dropdown-control", {
19125
+ attrs: {
19126
+ label: _vm._f("cap")(_vm.strings.mode),
19127
+ options: { auto: "auto" },
19128
+ disabled: !_vm.directives.responsiveEnabled
19129
+ },
19130
+ model: {
19131
+ value: _vm.directives.responsiveMode,
19132
+ callback: function($$v) {
19133
+ _vm.$set(_vm.directives, "responsiveMode", $$v)
19134
+ },
19135
+ expression: "directives.responsiveMode"
19136
+ }
19137
+ })
19138
+ ],
19139
+ 1
19140
+ )
19141
+ }
19142
+ var staticRenderFns = []
19143
+ render._withStripped = true
19144
+
19145
+ return {
19146
+ render: render,
19147
+ staticRenderFns: staticRenderFns,
19148
+ _compiled: true,
19149
+ _scopeId: null,
19150
+ functional: undefined
19151
+ };
19152
+ })());
19153
+
19154
+ },{"vue-fragment":"../../../../../node_modules/vue-fragment/dist/vue-fragment.esm.js","./PanelToggleControl":"components/PanelToggleControl.vue","./PanelDropdownControl":"components/PanelDropdownControl.vue"}],"components/PanelSectionGroupTabbed.vue":[function(require,module,exports) {
19155
+ "use strict";
19156
+
19157
+ Object.defineProperty(exports, "__esModule", {
19158
+ value: true
19159
+ });
19160
+ exports.default = void 0;
19161
+ //
19162
+ //
19163
+ //
19164
+ //
19165
+ //
19166
+ //
19167
+ //
19168
+ //
19169
+ //
19170
+ //
19171
+ //
19172
+ //
19173
+ //
19174
+ //
19175
+ //
19176
+ //
19177
+ //
19178
+ //
19179
+ //
19180
+ //
19181
+ //
19182
+ //
19183
+ //
19184
+ //
19185
+ //
19186
+ //
19187
+ //
19188
+ //
19189
+ var _default = {
19190
+ props: {
19191
+ header: {
19192
+ type: String,
19193
+ default: 'Tab Header'
19194
+ },
19195
+ // tabs object, keys for tab ids, values for translated tab names
19196
+ tabs: {
19197
+ type: Object,
19198
+ default: function _default() {
19199
+ return {
19200
+ default: 'Default'
19201
+ };
19202
+ }
19203
+ },
19204
+ // id of currentTab
19205
+ currentTab: {
19206
+ type: String,
19207
+ default: 'default'
19208
+ }
19209
+ },
19210
+ methods: {
19211
+ // decide if the tab is active based on current active tab property
19212
+ isActiveTab: function isActiveTab(tabId) {
19213
+ return this.currentTab === tabId;
19214
+ },
19215
+ handleTabClick: function handleTabClick(tabId) {
19216
+ this.$emit('tabClicked', tabId);
19217
+ }
19218
+ }
19219
+ };
19220
+ exports.default = _default;
19221
+ var $3d2461 = exports.default || module.exports;
19222
+
19223
+ if (typeof $3d2461 === 'function') {
19224
+ $3d2461 = $3d2461.options;
19225
+ }
19226
+
19227
+ /* template */
19228
+ Object.assign($3d2461, (function () {
19229
+ var render = function() {
19230
+ var _vm = this
19231
+ var _h = _vm.$createElement
19232
+ var _c = _vm._self._c || _h
19233
+ return _c(
19234
+ "div",
19235
+ {
19236
+ staticClass:
19237
+ "wptb-section-group-tabbed wptb-plugin-box-shadow-md wptb-plugin-width-full"
19238
+ },
19239
+ [
19240
+ _c(
19241
+ "div",
19242
+ { staticClass: "wptb-panel-toggle wptb-section-group-tabbed-header" },
19243
+ [_c("div", { staticClass: "header" }, [_vm._v(_vm._s(_vm.header))])]
19244
+ ),
19245
+ _vm._v(" "),
19246
+ _c(
19247
+ "div",
19248
+ { staticClass: "wptb-section-group-tabbed-tabs-buttons" },
19249
+ _vm._l(_vm.tabs, function(name, id) {
19250
+ return _c(
19251
+ "div",
19252
+ {
19253
+ key: id,
19254
+ staticClass: "wptb-settings-section-item static-active",
19255
+ class: {
19256
+ active: _vm.isActiveTab(id),
19257
+ disabled: !_vm.isActiveTab(id)
19258
+ },
19259
+ on: {
19260
+ "!click": function($event) {
19261
+ $event.preventDefault()
19262
+ return _vm.handleTabClick(id)
19263
+ }
19264
+ }
19265
+ },
19266
+ [_vm._v("\n\t\t\t" + _vm._s(name) + "\n\t\t")]
19267
+ )
19268
+ }),
19269
+ 0
19270
+ ),
19271
+ _vm._v(" "),
19272
+ _c(
19273
+ "div",
19274
+ { staticClass: "wptb-section-group-tab-content" },
19275
+ [_vm._t("default")],
19276
+ 2
19277
+ )
19278
+ ]
19279
+ )
19280
+ }
19281
+ var staticRenderFns = []
19282
+ render._withStripped = true
19283
+
19284
+ return {
19285
+ render: render,
19286
+ staticRenderFns: staticRenderFns,
19287
+ _compiled: true,
19288
+ _scopeId: null,
19289
+ functional: undefined
19290
+ };
19291
+ })());
19292
+
19293
+ },{}],"components/PanelInputControl.vue":[function(require,module,exports) {
19294
+ "use strict";
19295
+
19296
+ Object.defineProperty(exports, "__esModule", {
19297
+ value: true
19298
+ });
19299
+ exports.default = void 0;
19300
+
19301
+ var _PanelControlBase = _interopRequireDefault(require("../mixins/PanelControlBase"));
19302
+
19303
+ var _NumberPostfixInput = _interopRequireDefault(require("./NumberPostfixInput"));
19304
+
19305
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19306
+
19307
+ //
19308
+ //
19309
+ //
19310
+ //
19311
+ //
19312
+ //
19313
+ //
19314
+ //
19315
+ //
19316
+ //
19317
+ //
19318
+ //
19319
+ //
19320
+ //
19321
+ //
19322
+ //
19323
+ //
19324
+ //
19325
+ //
19326
+ //
19327
+ //
19328
+ //
19329
+ var _default = {
19330
+ components: {
19331
+ NumberPostfixInput: _NumberPostfixInput.default
19332
+ },
19333
+ mixins: [_PanelControlBase.default]
19334
+ };
19335
+ exports.default = _default;
19336
+ var $089a84 = exports.default || module.exports;
19337
+
19338
+ if (typeof $089a84 === 'function') {
19339
+ $089a84 = $089a84.options;
19340
+ }
19341
+
19342
+ /* template */
19343
+ Object.assign($089a84, (function () {
19344
+ var render = function() {
19345
+ var _vm = this
19346
+ var _h = _vm.$createElement
19347
+ var _c = _vm._self._c || _h
19348
+ return _c(
19349
+ "div",
19350
+ {
19351
+ staticClass:
19352
+ "wptb-element-option wptb-settings-items wptb-plugin-width-full"
19353
+ },
19354
+ [
19355
+ _c("div", { staticClass: "wptb-settings-row wptb-settings-middle-xs" }, [
19356
+ _c(
19357
+ "label",
19358
+ {
19359
+ staticClass:
19360
+ "wptb-control-row wptb-flex wptb-flex-row wptb-flex-align-center wptb-flex-justify-space-between"
19361
+ },
19362
+ [
19363
+ _c("span", { staticStyle: { "font-size": "16px" } }, [
19364
+ _vm._v("\n\t\t\t\t" + _vm._s(_vm.label) + "\n\t\t\t")
19365
+ ]),
19366
+ _vm._v(" "),
19367
+ _c("number-postfix-input", {
19368
+ staticClass: "wptb-size-input",
19369
+ attrs: {
19370
+ "enable-dynamic-width": true,
19371
+ min: 1,
19372
+ max: 100,
19373
+ "enable-limit": true,
19374
+ disabled: _vm.disabled
19375
+ },
19376
+ model: {
19377
+ value: _vm.innerValue,
19378
+ callback: function($$v) {
19379
+ _vm.innerValue = $$v
19380
+ },
19381
+ expression: "innerValue"
19382
+ }
19383
+ })
19384
+ ],
19385
+ 1
19386
+ )
19387
+ ])
19388
+ ]
19389
+ )
19390
+ }
19391
+ var staticRenderFns = []
19392
+ render._withStripped = true
19393
+
19394
+ return {
19395
+ render: render,
19396
+ staticRenderFns: staticRenderFns,
19397
+ _compiled: true,
19398
+ _scopeId: null,
19399
+ functional: undefined
19400
+ };
19401
+ })());
19402
+
19403
+ },{"../mixins/PanelControlBase":"mixins/PanelControlBase.js","./NumberPostfixInput":"components/NumberPostfixInput.vue"}],"components/AutoModePanelControls.vue":[function(require,module,exports) {
19404
+ "use strict";
19405
+
19406
+ Object.defineProperty(exports, "__esModule", {
19407
+ value: true
19408
+ });
19409
+ exports.default = void 0;
19410
+
19411
+ var _vueFragment = require("vue-fragment");
19412
+
19413
+ var _PanelToggleControl = _interopRequireDefault(require("./PanelToggleControl"));
19414
+
19415
+ var _PanelDropdownControl = _interopRequireDefault(require("./PanelDropdownControl"));
19416
+
19417
+ var _PanelInputControl = _interopRequireDefault(require("./PanelInputControl"));
19418
+
19419
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19420
+
19421
+ //
19422
+ //
19423
+ //
19424
+ //
19425
+ //
19426
+ //
19427
+ //
19428
+ //
19429
+ //
19430
+ //
19431
+ //
19432
+ //
19433
+ //
19434
+ //
19435
+ //
19436
+ //
19437
+ //
19438
+ //
19439
+ //
19440
+ //
19441
+ //
19442
+ //
19443
+ //
19444
+ //
19445
+ //
19446
+ //
19447
+ //
19448
+ //
19449
+ //
19450
+ //
19451
+ //
19452
+ //
19453
+ //
19454
+ //
19455
+ //
19456
+ //
19457
+ //
19458
+ //
19459
+ //
19460
+ //
19461
+ //
19462
+ //
19463
+ //
19464
+ //
19465
+ //
19466
+ //
19467
+ //
19468
+ //
19469
+ //
19470
+ //
19471
+ //
19472
+ //
19473
+ //
19474
+ //
19475
+ //
19476
+ //
19477
+ //
19478
+ //
19479
+ var _default = {
19480
+ components: {
19481
+ Fragment: _vueFragment.Fragment,
19482
+ PanelToggleControl: _PanelToggleControl.default,
19483
+ PanelDropdownControl: _PanelDropdownControl.default,
19484
+ PanelInputControl: _PanelInputControl.default
19485
+ },
19486
+ methods: {
19487
+ isDisabled: function isDisabled() {
19488
+ return this.appOptions.currentBreakpoint === 'desktop' || !this.directives.responsiveEnabled;
19489
+ }
19490
+ },
19491
+ computed: {
19492
+ perLabelString: function perLabelString() {
19493
+ return this.directives.modeOptions.auto.topRowAsHeader[this.appOptions.currentBreakpoint] ? this.strings.itemsPerHeader : this.strings.cellsPerRow;
19494
+ }
19495
+ }
19496
+ };
19497
+ exports.default = _default;
19498
+ var $085e64 = exports.default || module.exports;
19499
+
19500
+ if (typeof $085e64 === 'function') {
19501
+ $085e64 = $085e64.options;
19502
+ }
19503
+
19504
+ /* template */
19505
+ Object.assign($085e64, (function () {
19506
+ var render = function() {
19507
+ var _vm = this
19508
+ var _h = _vm.$createElement
19509
+ var _c = _vm._self._c || _h
19510
+ return _c(
19511
+ "fragment",
19512
+ [
19513
+ _c("panel-toggle-control", {
19514
+ attrs: {
19515
+ label: _vm._f("cap")(_vm.strings.topRowHeader),
19516
+ disabled: _vm.isDisabled(),
19517
+ "depends-value":
19518
+ _vm.directives.modeOptions.auto.staticTopRow[
19519
+ _vm.appOptions.currentBreakpoint
19520
+ ],
19521
+ "depends-callback": function(d, c) {
19522
+ if (d === true) {
19523
+ return false
19524
+ }
19525
+ return c
19526
+ }
19527
+ },
19528
+ model: {
19529
+ value:
19530
+ _vm.directives.modeOptions.auto.topRowAsHeader[
19531
+ _vm.appOptions.currentBreakpoint
19532
+ ],
19533
+ callback: function($$v) {
19534
+ _vm.$set(
19535
+ _vm.directives.modeOptions.auto.topRowAsHeader,
19536
+ _vm.appOptions.currentBreakpoint,
19537
+ $$v
19538
+ )
19539
+ },
19540
+ expression:
19541
+ "directives.modeOptions.auto.topRowAsHeader[appOptions.currentBreakpoint]"
19542
+ }
19543
+ }),
19544
+ _vm._v(" "),
19545
+ _c(
19546
+ "transition",
19547
+ { attrs: { name: "wptb-fade" } },
19548
+ [
19549
+ _c("panel-toggle-control", {
19550
+ directives: [
19551
+ {
19552
+ name: "show",
19553
+ rawName: "v-show",
19554
+ value:
19555
+ _vm.directives.modeOptions.auto.topRowAsHeader[
19556
+ _vm.appOptions.currentBreakpoint
19557
+ ] &&
19558
+ _vm.directives.modeOptions.auto.cellStackDirection[
19559
+ _vm.appOptions.currentBreakpoint
19560
+ ] === "row" &&
19561
+ _vm.appOptions.headerFullyMerged,
19562
+ expression:
19563
+ "\n\t\t\t\tdirectives.modeOptions.auto.topRowAsHeader[appOptions.currentBreakpoint] &&\n\t\t\t\tdirectives.modeOptions.auto.cellStackDirection[appOptions.currentBreakpoint] === 'row' &&\n\t\t\t\tappOptions.headerFullyMerged\n\t\t\t"
19564
+ }
19565
+ ],
19566
+ attrs: {
19567
+ label: _vm._f("cap")(_vm.strings.repeatMergedHeader),
19568
+ disabled: _vm.isDisabled()
19569
+ },
19570
+ model: {
19571
+ value:
19572
+ _vm.directives.modeOptions.auto.repeatMergedHeader[
19573
+ _vm.appOptions.currentBreakpoint
19574
+ ],
19575
+ callback: function($$v) {
19576
+ _vm.$set(
19577
+ _vm.directives.modeOptions.auto.repeatMergedHeader,
19578
+ _vm.appOptions.currentBreakpoint,
19579
+ $$v
19580
+ )
19581
+ },
19582
+ expression:
19583
+ "directives.modeOptions.auto.repeatMergedHeader[appOptions.currentBreakpoint]"
19584
+ }
19585
+ })
19586
+ ],
19587
+ 1
19588
+ ),
19589
+ _vm._v(" "),
19590
+ _c("panel-toggle-control", {
19591
+ attrs: {
19592
+ label: _vm._f("cap")(_vm.strings.staticTopRow),
19593
+ disabled: _vm.isDisabled(),
19594
+ "depends-value":
19595
+ _vm.directives.modeOptions.auto.topRowAsHeader[
19596
+ _vm.appOptions.currentBreakpoint
19597
+ ],
19598
+ "depends-callback": function(d, c) {
19599
+ if (d === true) {
19600
+ return false
19601
+ }
19602
+ return c
19603
+ }
19604
+ },
19605
+ model: {
19606
+ value:
19607
+ _vm.directives.modeOptions.auto.staticTopRow[
19608
+ _vm.appOptions.currentBreakpoint
19609
+ ],
19610
+ callback: function($$v) {
19611
+ _vm.$set(
19612
+ _vm.directives.modeOptions.auto.staticTopRow,
19613
+ _vm.appOptions.currentBreakpoint,
19614
+ $$v
19615
+ )
19616
+ },
19617
+ expression:
19618
+ "directives.modeOptions.auto.staticTopRow[appOptions.currentBreakpoint]"
19619
+ }
19620
+ }),
19621
+ _vm._v(" "),
19622
+ _c("panel-dropdown-control", {
19623
+ attrs: {
19624
+ label: _vm._f("cap")(_vm.strings.stackDirection),
19625
+ options: { row: _vm.strings.row, column: _vm.strings.column },
19626
+ disabled: _vm.isDisabled()
19627
+ },
19628
+ model: {
19629
+ value:
19630
+ _vm.directives.modeOptions.auto.cellStackDirection[
19631
+ _vm.appOptions.currentBreakpoint
19632
+ ],
19633
+ callback: function($$v) {
19634
+ _vm.$set(
19635
+ _vm.directives.modeOptions.auto.cellStackDirection,
19636
+ _vm.appOptions.currentBreakpoint,
19637
+ $$v
19638
+ )
19639
+ },
19640
+ expression:
19641
+ "directives.modeOptions.auto.cellStackDirection[appOptions.currentBreakpoint]"
19642
+ }
19643
+ }),
19644
+ _vm._v(" "),
19645
+ _c("panel-input-control", {
19646
+ attrs: {
19647
+ label: _vm._f("cap")(_vm.perLabelString),
19648
+ disabled: _vm.isDisabled()
19649
+ },
19650
+ model: {
19651
+ value:
19652
+ _vm.directives.modeOptions.auto.cellsPerRow[
19653
+ _vm.appOptions.currentBreakpoint
19654
+ ],
19655
+ callback: function($$v) {
19656
+ _vm.$set(
19657
+ _vm.directives.modeOptions.auto.cellsPerRow,
19658
+ _vm.appOptions.currentBreakpoint,
19659
+ $$v
19660
+ )
19661
+ },
19662
+ expression:
19663
+ "directives.modeOptions.auto.cellsPerRow[appOptions.currentBreakpoint]"
19664
+ }
19665
+ })
19666
+ ],
19667
+ 1
19668
+ )
19669
+ }
19670
+ var staticRenderFns = []
19671
+ render._withStripped = true
19672
+
19673
+ return {
19674
+ render: render,
19675
+ staticRenderFns: staticRenderFns,
19676
+ _compiled: true,
19677
+ _scopeId: null,
19678
+ functional: undefined
19679
+ };
19680
+ })());
19681
+
19682
+ },{"vue-fragment":"../../../../../node_modules/vue-fragment/dist/vue-fragment.esm.js","./PanelToggleControl":"components/PanelToggleControl.vue","./PanelDropdownControl":"components/PanelDropdownControl.vue","./PanelInputControl":"components/PanelInputControl.vue"}],"components/ResponsivePanelModeControls.vue":[function(require,module,exports) {
19683
+ "use strict";
19684
+
19685
+ Object.defineProperty(exports, "__esModule", {
19686
+ value: true
19687
+ });
19688
+ exports.default = void 0;
19689
+
19690
+ var _PanelSectionGroupTabbed = _interopRequireDefault(require("./PanelSectionGroupTabbed"));
19691
+
19692
+ var _AutoModePanelControls = _interopRequireDefault(require("./AutoModePanelControls"));
19693
+
19694
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19695
+
19696
+ //
19697
+ //
19698
+ //
19699
+ //
19700
+ //
19701
+ //
19702
+ //
19703
+ //
19704
+ //
19705
+ //
19706
+ //
19707
+ //
19708
+ //
19709
+ //
19710
+ var _default = {
19711
+ components: {
19712
+ PanelSectionGroupTabbed: _PanelSectionGroupTabbed.default,
19713
+ AutoModePanelControls: _AutoModePanelControls.default
19714
+ },
19715
+ mounted: function mounted() {
19716
+ var _this = this;
19717
+
19718
+ this.$nextTick(function () {
19719
+ // start responsive builder with provided default breakpoint
19720
+ _this.handleTabChange(_this.appOptions.currentBreakpoint);
19721
+ });
19722
+ },
19723
+ computed: {
19724
+ breakpointsObject: function breakpointsObject() {
19725
+ var _this2 = this;
19726
+
19727
+ return Object.keys(this.directives.breakpoints).sort(function (a, b) {
19728
+ // sort breakpoints by their width ascending
19729
+ return _this2.directives.breakpoints[a].width - _this2.directives.breakpoints[b].width;
19730
+ }).reduce(function (c, k) {
19731
+ if (Object.prototype.hasOwnProperty.call(_this2.directives.breakpoints, k)) {
19732
+ // eslint-disable-next-line no-param-reassign
19733
+ c[k] = _this2.directives.breakpoints[k].name;
19734
+ }
19735
+
19736
+ return c;
19737
+ }, {});
19738
+ },
19739
+ currentPanelControls: function currentPanelControls() {
19740
+ return "".concat(this.directives.responsiveMode[0].toUpperCase() + this.directives.responsiveMode.slice(1), "ModePanelControls");
19741
+ }
19742
+ },
19743
+ methods: {
19744
+ /**
19745
+ * Handle tab change
19746
+ *
19747
+ * @param {string} tabId breakpoint id
19748
+ */
19749
+ handleTabChange: function handleTabChange(tabId) {
19750
+ // assign tabId to breakpoint id property of global store
19751
+ this.appOptions.currentBreakpoint = tabId; // get breakpoint size and assign to size property of global store to force a rebuilding process
19752
+
19753
+ this.appOptions.currentSize = this.directives.breakpoints[tabId].width;
19754
+ }
19755
+ }
19756
+ };
19757
+ exports.default = _default;
19758
+ var $b7cc79 = exports.default || module.exports;
19759
+
19760
+ if (typeof $b7cc79 === 'function') {
19761
+ $b7cc79 = $b7cc79.options;
19762
+ }
19763
+
19764
+ /* template */
19765
+ Object.assign($b7cc79, (function () {
19766
+ var render = function() {
19767
+ var _vm = this
19768
+ var _h = _vm.$createElement
19769
+ var _c = _vm._self._c || _h
19770
+ return _c(
19771
+ "panel-section-group-tabbed",
19772
+ {
19773
+ attrs: {
19774
+ "current-tab": _vm.appOptions.currentBreakpoint,
19775
+ tabs: _vm.breakpointsObject,
19776
+ header: _vm.strings[_vm.directives.responsiveMode]
19777
+ },
19778
+ on: { tabClicked: _vm.handleTabChange }
19779
+ },
19780
+ [_c(_vm.currentPanelControls, { tag: "component" })],
19781
+ 1
19782
+ )
19783
+ }
19784
+ var staticRenderFns = []
19785
+ render._withStripped = true
19786
+
19787
+ return {
19788
+ render: render,
19789
+ staticRenderFns: staticRenderFns,
19790
+ _compiled: true,
19791
+ _scopeId: null,
19792
+ functional: undefined
19793
+ };
19794
+ })());
19795
+
19796
+ },{"./PanelSectionGroupTabbed":"components/PanelSectionGroupTabbed.vue","./AutoModePanelControls":"components/AutoModePanelControls.vue"}],"mountPoints/WPTB_ResponsiveTable.js":[function(require,module,exports) {
19797
+ "use strict";
19798
+
19799
+ Object.defineProperty(exports, "__esModule", {
19800
+ value: true
19801
+ });
19802
+ exports.default = void 0;
19803
+
19804
+ var _vue = _interopRequireDefault(require("vue"));
19805
+
19806
+ var _ResponsiveApp = _interopRequireDefault(require("../containers/ResponsiveApp"));
19807
+
19808
+ var _ResponsiveControlsRow = _interopRequireDefault(require("../components/ResponsiveControlsRow"));
19809
+
19810
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
19811
+
19812
+ var _filters = _interopRequireDefault(require("../plugins/filters"));
19813
+
19814
+ var _strings = _interopRequireDefault(require("../plugins/strings"));
19815
+
19816
+ var _ResponsivePanelGeneralControls = _interopRequireDefault(require("../components/ResponsivePanelGeneralControls"));
19817
+
19818
+ var _ResponsivePanelModeControls = _interopRequireDefault(require("../components/ResponsivePanelModeControls"));
19819
+
19820
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19821
+
19822
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
19823
+
19824
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19825
+
19826
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19827
+
19828
+ var _default = {
19829
+ name: 'ResponsiveTable',
19830
+ handler: function responsiveTableJS(uniqueId) {
19831
+ var data = _WPTB_ControlsManager.default.getControlData('responsiveMenuData');
19832
+
19833
+ var mainTableQuery = '.wptb-preview-table';
19834
+ /**
19835
+ * Various options that will be used all around the app
19836
+ *
19837
+ * * identifyCells -> show visual unique identification for table cell elements
19838
+ * * hasLegacyResponsive -> indicates current table has legacy responsive functionality enabled
19839
+ * * currentBreakpoint -> id of the current breakpoint
19840
+ * * currentSize -> current screen size value that is being used in responsive builder. this is not the actual screen size value of the current window but a mock up value to provide a display of table's layout at different sizes
19841
+ *
19842
+ */
19843
+
19844
+ var appOptions = {
19845
+ identifyCells: false,
19846
+ hasLegacyResponsive: false,
19847
+ currentBreakpoint: 'tablet',
19848
+ currentSize: 0
19849
+ }; // directives for responsive features
19850
+ // add default options value at here instead of assigning them at app dynamically. this way, default options can be used for error checking and will prevent bugs/security concerns beforehand
19851
+
19852
+ var directives = {
19853
+ responsiveEnabled: false,
19854
+ responsiveMode: 'auto',
19855
+ preserveRowColor: false,
19856
+ relativeWidth: 'window',
19857
+ headerFullyMerged: false,
19858
+ modeOptions: {
19859
+ auto: {
19860
+ topRowAsHeader: {
19861
+ desktop: false,
19862
+ tablet: true,
19863
+ mobile: true
19864
+ },
19865
+ repeatMergedHeader: {
19866
+ desktop: true,
19867
+ tablet: true,
19868
+ mobile: true
19869
+ },
19870
+ staticTopRow: {
19871
+ desktop: false,
19872
+ tablet: false,
19873
+ mobile: false
19874
+ },
19875
+ cellStackDirection: {
19876
+ desktop: 'row',
19877
+ tablet: 'row',
19878
+ mobile: 'row'
19879
+ },
19880
+ cellsPerRow: {
19881
+ desktop: 1,
19882
+ tablet: 1,
19883
+ mobile: 1
19884
+ }
19885
+ }
19886
+ },
19887
+ breakpoints: data.screenSizes
19888
+ }; // singleton store object
19889
+ // this object implementation will give us the ability to persist the state of certain data properties across all app
19890
+
19891
+ var optionsStore = {
19892
+ // eslint-disable-next-line no-shadow
19893
+ install: function install(Vue, options) {
19894
+ Vue.mixin({
19895
+ data: function data() {
19896
+ return options.data;
19897
+ }
19898
+ });
19899
+ }
19900
+ }; // app wide components that will be available for every component
19901
+
19902
+ var appWideComponents = {
19903
+ // eslint-disable-next-line no-shadow
19904
+ install: function install(Vue, _ref) {
19905
+ var components = _ref.components;
19906
+ Vue.mixin({
19907
+ components: components
19908
+ });
19909
+ }
19910
+ }; // app wide components setup
19911
+
19912
+ _vue.default.use(appWideComponents, {
19913
+ components: {
19914
+ ResponsiveControlsRow: _ResponsiveControlsRow.default
19915
+ }
19916
+ }); // options store setup
19917
+
19918
+
19919
+ _vue.default.use(optionsStore, {
19920
+ data: {
19921
+ appOptions: appOptions,
19922
+ directives: directives
19923
+ }
19924
+ }); // filters setup
19925
+
19926
+
19927
+ _vue.default.use(_filters.default); // translation strings setup
19928
+
19929
+
19930
+ _vue.default.use(_strings.default, data); // vue builder instance
19931
+
19932
+
19933
+ new _vue.default({
19934
+ components: {
19935
+ ResponsiveApp: _ResponsiveApp.default
19936
+ },
19937
+ data: _objectSpread({
19938
+ mainTableQuery: mainTableQuery
19939
+ }, data),
19940
+ template: '<responsive-app :clone-query="mainTableQuery" :screen-sizes="screenSizes" :compare-sizes="compareSizes"></responsive-app>'
19941
+ }).$mount("#".concat(uniqueId)); // left panel general controls instance
19942
+
19943
+ new _vue.default({
19944
+ components: {
19945
+ ResponsivePanelGeneralControls: _ResponsivePanelGeneralControls.default
19946
+ },
19947
+ template: '<responsive-panel-general-controls></responsive-panel-general-controls>'
19948
+ }).$mount('#responsiveBuilderLeftPanelGeneralControls'); // left panel mode controls
19949
+
19950
+ new _vue.default({
19951
+ components: {
19952
+ ResponsivePanelModeControls: _ResponsivePanelModeControls.default
19953
+ },
19954
+ data: _objectSpread({}, data),
19955
+ template: '<responsive-panel-mode-controls></responsive-panel-mode-controls>'
19956
+ }).$mount('#responsiveBuilderLeftPanelModeOptions');
19957
+ }
19958
+ };
19959
+ exports.default = _default;
19960
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../containers/ResponsiveApp":"containers/ResponsiveApp.vue","../components/ResponsiveControlsRow":"components/ResponsiveControlsRow.vue","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js","../plugins/filters":"plugins/filters.js","../plugins/strings":"plugins/strings.js","../components/ResponsivePanelGeneralControls":"components/ResponsivePanelGeneralControls.vue","../components/ResponsivePanelModeControls":"components/ResponsivePanelModeControls.vue"}],"components/SideInput.vue":[function(require,module,exports) {
19961
+ "use strict";
19962
+
19963
+ Object.defineProperty(exports, "__esModule", {
19964
+ value: true
19965
+ });
19966
+ exports.default = void 0;
19967
+ //
19968
+ //
19969
+ //
19970
+ //
19971
+ //
19972
+ //
19973
+ //
19974
+ //
19975
+ //
19976
+ //
19977
+ //
19978
+ //
19979
+ //
19980
+ //
19981
+ //
19982
+ //
19983
+ var _default = {
19984
+ props: {
19985
+ label: {
19986
+ type: String,
19987
+ default: 'top'
19988
+ },
19989
+ value: {
19990
+ type: Number,
19991
+ default: 0
19992
+ },
19993
+ disabled: {
19994
+ type: Boolean,
19995
+ default: false
19996
+ }
19997
+ },
19998
+ model: {
19999
+ prop: 'value',
20000
+ event: 'valueChanged'
20001
+ },
20002
+ mounted: function mounted() {
20003
+ this.innerValue = this.value;
20004
+ },
20005
+ data: function data() {
20006
+ return {
20007
+ innerValue: 0
20008
+ };
20009
+ },
20010
+ watch: {
20011
+ value: function value(n) {
20012
+ this.innerValue = n;
20013
+ },
20014
+ innerValue: function innerValue(n) {
20015
+ this.$emit('valueChanged', Number.parseInt(n, 10));
20016
+ }
20017
+ },
20018
+ methods: {
20019
+ inputChange: function inputChange(e) {
20020
+ this.$emit('changedFromFront', this.$vnode.key, e.target.value);
20021
+ this.innerValue = e.target.value;
20022
+ }
20023
+ }
20024
+ };
20025
+ exports.default = _default;
20026
+ var $d91df7 = exports.default || module.exports;
20027
+
20028
+ if (typeof $d91df7 === 'function') {
20029
+ $d91df7 = $d91df7.options;
20030
+ }
20031
+
20032
+ /* template */
20033
+ Object.assign($d91df7, (function () {
20034
+ var render = function() {
20035
+ var _vm = this
20036
+ var _h = _vm.$createElement
20037
+ var _c = _vm._self._c || _h
20038
+ return _c(
20039
+ "div",
20040
+ {
20041
+ staticClass:
20042
+ "wptb-side-control-input-wrapper wptb-side-control-number-input"
20043
+ },
20044
+ [
20045
+ _c("div", { staticClass: "wptb-side-control-header" }, [
20046
+ _vm._v("\n\t\t" + _vm._s(_vm._f("cap")(_vm.label)) + "\n\t")
20047
+ ]),
20048
+ _vm._v(" "),
20049
+ _c("div", [
20050
+ _c("input", {
20051
+ staticClass: "wptb-side-control-main-input",
20052
+ attrs: { type: "number", disabled: _vm.disabled },
20053
+ domProps: { value: _vm.innerValue },
20054
+ on: { input: _vm.inputChange }
20055
+ })
20056
+ ])
20057
+ ]
20058
+ )
20059
+ }
20060
+ var staticRenderFns = []
20061
+ render._withStripped = true
20062
+
20063
+ return {
20064
+ render: render,
20065
+ staticRenderFns: staticRenderFns,
20066
+ _compiled: true,
20067
+ _scopeId: null,
20068
+ functional: undefined
20069
+ };
20070
+ })());
20071
+
20072
+ },{}],"components/SideDropdown.vue":[function(require,module,exports) {
20073
+ "use strict";
20074
+
20075
+ Object.defineProperty(exports, "__esModule", {
20076
+ value: true
20077
+ });
20078
+ exports.default = void 0;
20079
+ //
20080
+ //
20081
+ //
20082
+ //
20083
+ //
20084
+ //
20085
+ //
20086
+ //
20087
+ //
20088
+ var _default = {
20089
+ props: {
20090
+ value: {
20091
+ type: String,
20092
+ default: 'px'
20093
+ }
20094
+ },
20095
+ model: {
20096
+ prop: 'value',
20097
+ event: 'valueChanged'
20098
+ },
20099
+ data: function data() {
20100
+ return {
20101
+ options: ['px', '%'],
20102
+ innerValue: ''
20103
+ };
20104
+ },
20105
+ mounted: function mounted() {
20106
+ this.innerValue = this.value;
20107
+ },
20108
+ watch: {
20109
+ value: function value(n) {
20110
+ this.innerValue = n;
20111
+ },
20112
+ innerValue: function innerValue(n) {
20113
+ this.$emit('valueChanged', n);
20114
+ }
20115
+ },
20116
+ methods: {
20117
+ isSelected: function isSelected(k) {
20118
+ return this.innerValue === k;
20119
+ }
20120
+ }
20121
+ };
20122
+ exports.default = _default;
20123
+ var $d95020 = exports.default || module.exports;
20124
+
20125
+ if (typeof $d95020 === 'function') {
20126
+ $d95020 = $d95020.options;
20127
+ }
20128
+
20129
+ /* template */
20130
+ Object.assign($d95020, (function () {
20131
+ var render = function() {
20132
+ var _vm = this
20133
+ var _h = _vm.$createElement
20134
+ var _c = _vm._self._c || _h
20135
+ return _c(
20136
+ "div",
20137
+ {
20138
+ staticClass:
20139
+ "wptb-side-control-input-wrapper wptb-side-control-dropdown-wrapper"
20140
+ },
20141
+ [
20142
+ _c(
20143
+ "select",
20144
+ {
20145
+ directives: [
20146
+ {
20147
+ name: "model",
20148
+ rawName: "v-model",
20149
+ value: _vm.innerValue,
20150
+ expression: "innerValue"
20151
+ }
20152
+ ],
20153
+ staticClass:
20154
+ "wptb-side-control-main-input wptb-side-control-dropdown",
20155
+ on: {
20156
+ change: function($event) {
20157
+ var $$selectedVal = Array.prototype.filter
20158
+ .call($event.target.options, function(o) {
20159
+ return o.selected
20160
+ })
20161
+ .map(function(o) {
20162
+ var val = "_value" in o ? o._value : o.value
20163
+ return val
20164
+ })
20165
+ _vm.innerValue = $event.target.multiple
20166
+ ? $$selectedVal
20167
+ : $$selectedVal[0]
20168
+ }
20169
+ }
20170
+ },
20171
+ _vm._l(_vm.options, function(option) {
20172
+ return _c(
20173
+ "option",
20174
+ {
20175
+ key: option,
20176
+ domProps: { value: option, selected: _vm.isSelected(option) }
20177
+ },
20178
+ [_vm._v(_vm._s(option))]
20179
+ )
20180
+ }),
20181
+ 0
20182
+ )
20183
+ ]
20184
+ )
20185
+ }
20186
+ var staticRenderFns = []
20187
+ render._withStripped = true
20188
+
20189
+ return {
20190
+ render: render,
20191
+ staticRenderFns: staticRenderFns,
20192
+ _compiled: true,
20193
+ _scopeId: null,
20194
+ functional: undefined
20195
+ };
20196
+ })());
20197
+
20198
+ },{}],"containers/SidesControl.vue":[function(require,module,exports) {
20199
+ "use strict";
20200
+
20201
+ Object.defineProperty(exports, "__esModule", {
20202
+ value: true
20203
+ });
20204
+ exports.default = void 0;
20205
+
20206
+ var _ControlBase = _interopRequireDefault(require("../mixins/ControlBase"));
20207
+
20208
+ var _SideInput = _interopRequireDefault(require("../components/SideInput"));
20209
+
20210
+ var _SideDropdown = _interopRequireDefault(require("../components/SideDropdown"));
20211
+
20212
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20213
+
20214
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
20215
+
20216
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20217
+
20218
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
20219
+
20220
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
20221
+
20222
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20223
+
20224
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20225
+
20226
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20227
+
20228
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
20229
+
20230
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
20231
+
20232
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20233
+
20234
+ var _default = {
20235
+ props: {
20236
+ linkIcon: {
20237
+ type: String,
20238
+ default: null
20239
+ },
20240
+ unlinkIcon: {
20241
+ type: String,
20242
+ default: null
20243
+ },
20244
+ strings: {
20245
+ type: Object,
20246
+ required: true
20247
+ },
20248
+ defaultValue: {
20249
+ type: String,
20250
+ default: '0 0 0 0'
20251
+ },
20252
+ allowNegative: {
20253
+ type: Boolean,
20254
+ default: true
20255
+ }
20256
+ },
20257
+ mixins: [_ControlBase.default],
20258
+ components: {
20259
+ SideInput: _SideInput.default,
20260
+ SideDropdown: _SideDropdown.default
20261
+ },
20262
+ data: function data() {
20263
+ return {
20264
+ linkValues: false,
20265
+ sideValues: {
20266
+ top: 0,
20267
+ right: 0,
20268
+ bottom: 0,
20269
+ left: 0
20270
+ },
20271
+ lastEdited: 'top',
20272
+ type: 'px',
20273
+ suppressDirty: true,
20274
+ forceUpdate: 1
20275
+ };
20276
+ },
20277
+ mounted: function mounted() {
20278
+ this.assignDefaultValue();
20279
+ this.parseElementValue();
20280
+ },
20281
+ updated: function updated() {
20282
+ this.suppressDirty = false;
20283
+ },
20284
+ watch: {
20285
+ sideValues: {
20286
+ handler: function handler() {
20287
+ this.forceUpdate += 1;
20288
+ this.calculateElementValue();
20289
+ },
20290
+ deep: true
20291
+ },
20292
+ elementMainValue: {
20293
+ handler: function handler(n) {
20294
+ this.setAllValues(n);
20295
+ this.generateChangeEvent(n);
20296
+
20297
+ if (this.suppressDirty) {
20298
+ this.resetMountedState();
20299
+ }
20300
+
20301
+ this.setTableDirty(true);
20302
+ },
20303
+ immediate: true
20304
+ },
20305
+ linkValues: function linkValues() {
20306
+ this.calculateElementValue();
20307
+ },
20308
+ type: function type() {
20309
+ this.calculateElementValue();
20310
+ }
20311
+ },
20312
+ methods: {
20313
+ inputChanged: function inputChanged(key) {
20314
+ this.lastEdited = key;
20315
+ },
20316
+ calculateElementValue: function calculateElementValue() {
20317
+ var _this = this;
20318
+
20319
+ this.assignLinkedValues();
20320
+ this.elementMainValue = Object.keys(this.sideValues) // eslint-disable-next-line array-callback-return,consistent-return
20321
+ .map(function (k) {
20322
+ if (Object.prototype.hasOwnProperty.call(_this.sideValues, k)) {
20323
+ return _this.sideValues[k] + _this.type;
20324
+ }
20325
+ }).join(' ');
20326
+ },
20327
+ assignLinkedValues: function assignLinkedValues() {
20328
+ var _this2 = this;
20329
+
20330
+ if (this.linkValues) {
20331
+ Object.keys(this.sideValues) // eslint-disable-next-line array-callback-return
20332
+ .map(function (k) {
20333
+ if (Object.prototype.hasOwnProperty.call(_this2.sideValues, k)) {
20334
+ var val = _this2.sideValues[_this2.lastEdited];
20335
+
20336
+ if (!_this2.allowNegative) {
20337
+ // eslint-disable-next-line operator-assignment
20338
+ val = Math.sign(val) * val;
20339
+ }
20340
+
20341
+ _this2.$set(_this2.sideValues, k, val); // this.sideValues[k] = val;
20342
+
20343
+ }
20344
+ });
20345
+ }
20346
+ },
20347
+ parseElementValue: function parseElementValue() {
20348
+ var parsedType = 'px'; // find out value type from element main value or use the default type
20349
+ // eslint-disable-next-line array-callback-return
20350
+
20351
+ this.elementMainValue.split(' ').map(function (s) {
20352
+ var match = s.match(/([a-z%?]+)/);
20353
+
20354
+ if (match && match[1]) {
20355
+ var _match = _slicedToArray(match, 2);
20356
+
20357
+ parsedType = _match[1];
20358
+ }
20359
+ }); // assign startup value type
20360
+
20361
+ this.type = parsedType; // fetch style syntaxed values and split them into array elements
20362
+
20363
+ var values = _toConsumableArray(this.elementMainValue.matchAll(/[-?\d]+/g)).flatMap(function (s) {
20364
+ return Number.parseInt(s[0], 10);
20365
+ });
20366
+
20367
+ if (values) {
20368
+ // assign values to their respective properties
20369
+ if (values.length === 1) {
20370
+ var _values = _slicedToArray(values, 1);
20371
+
20372
+ this.sideValues.top = _values[0];
20373
+
20374
+ var _values2 = _slicedToArray(values, 1);
20375
+
20376
+ this.sideValues.bottom = _values2[0];
20377
+
20378
+ var _values3 = _slicedToArray(values, 1);
20379
+
20380
+ this.sideValues.left = _values3[0];
20381
+
20382
+ var _values4 = _slicedToArray(values, 1);
20383
+
20384
+ this.sideValues.right = _values4[0];
20385
+ // link values if all of the parsed values are the same
20386
+ this.linkValues = true;
20387
+ } else if (values.length === 2) {
20388
+ var _values5 = _slicedToArray(values, 2);
20389
+
20390
+ this.sideValues.bottom = _values5[0];
20391
+ this.sideValues.left = _values5[1];
20392
+
20393
+ var _values6 = _slicedToArray(values, 2);
20394
+
20395
+ this.sideValues.top = _values6[0];
20396
+ this.sideValues.right = _values6[1];
20397
+ } else if (values.length === 3) {
20398
+ var _values7 = _slicedToArray(values, 3);
20399
+
20400
+ this.sideValues.top = _values7[0];
20401
+ this.sideValues.right = _values7[1];
20402
+ this.sideValues.bottom = _values7[2];
20403
+ this.sideValues.left = 0;
20404
+ } else {
20405
+ var _values8 = _slicedToArray(values, 4);
20406
+
20407
+ this.sideValues.top = _values8[0];
20408
+ this.sideValues.right = _values8[1];
20409
+ this.sideValues.bottom = _values8[2];
20410
+ this.sideValues.left = _values8[3];
20411
+ }
20412
+ }
20413
+ }
20414
+ }
20415
+ };
20416
+ exports.default = _default;
20417
+ var $3b6a1a = exports.default || module.exports;
20418
+
20419
+ if (typeof $3b6a1a === 'function') {
20420
+ $3b6a1a = $3b6a1a.options;
20421
+ }
20422
+
20423
+ /* template */
20424
+ Object.assign($3b6a1a, (function () {
20425
+ var render = function() {
20426
+ var _vm = this
20427
+ var _h = _vm.$createElement
20428
+ var _c = _vm._self._c || _h
20429
+ return _c("div", [
20430
+ _c("div", { staticClass: "wptb-settings-item-header-include-right" }, [
20431
+ _c("div", { staticClass: "wptb-settings-space-between" }, [
20432
+ _c("div", [_vm._v(_vm._s(_vm._f("cap")(_vm.label)))]),
20433
+ _vm._v(" "),
20434
+ _c(
20435
+ "div",
20436
+ {
20437
+ on: {
20438
+ click: function($event) {
20439
+ $event.preventDefault()
20440
+ _vm.linkValues = !_vm.linkValues
20441
+ }
20442
+ }
20443
+ },
20444
+ [
20445
+ !_vm.linkValues
20446
+ ? _c("div", { staticClass: "wptb-sides-link-icon-wrapper" }, [
20447
+ _c("img", {
20448
+ attrs: { src: _vm.linkIcon, title: _vm.strings.link }
20449
+ })
20450
+ ])
20451
+ : _c("div", { staticClass: "wptb-sides-link-icon-wrapper" }, [
20452
+ _c("img", {
20453
+ attrs: { src: _vm.unlinkIcon, title: _vm.strings.unlink }
20454
+ })
20455
+ ])
20456
+ ]
20457
+ )
20458
+ ])
20459
+ ]),
20460
+ _vm._v(" "),
20461
+ _c(
20462
+ "div",
20463
+ {
20464
+ staticClass:
20465
+ "wptb-settings-row wptb-settings-middle-xs wptb-sides-controls-wrapper",
20466
+ class: { "wptb-side-values-linked": _vm.linkValues }
20467
+ },
20468
+ [
20469
+ _vm._l(_vm.sideValues, function(v, k) {
20470
+ return _c("side-input", {
20471
+ key: k,
20472
+ attrs: { label: _vm.strings[k] },
20473
+ on: { changedFromFront: _vm.inputChanged },
20474
+ model: {
20475
+ value: _vm.sideValues[k],
20476
+ callback: function($$v) {
20477
+ _vm.$set(_vm.sideValues, k, $$v)
20478
+ },
20479
+ expression: "sideValues[k]"
20480
+ }
20481
+ })
20482
+ }),
20483
+ _vm._v(" "),
20484
+ _c("side-dropdown", {
20485
+ model: {
20486
+ value: _vm.type,
20487
+ callback: function($$v) {
20488
+ _vm.type = $$v
20489
+ },
20490
+ expression: "type"
20491
+ }
20492
+ })
20493
+ ],
20494
+ 2
20495
+ )
20496
+ ])
20497
+ }
20498
+ var staticRenderFns = []
20499
+ render._withStripped = true
20500
+
20501
+ return {
20502
+ render: render,
20503
+ staticRenderFns: staticRenderFns,
20504
+ _compiled: true,
20505
+ _scopeId: null,
20506
+ functional: undefined
20507
+ };
20508
+ })());
20509
+
20510
+ },{"../mixins/ControlBase":"mixins/ControlBase.js","../components/SideInput":"components/SideInput.vue","../components/SideDropdown":"components/SideDropdown.vue"}],"mountPoints/WPTB_SidesControl.js":[function(require,module,exports) {
20511
+ "use strict";
20512
+
20513
+ Object.defineProperty(exports, "__esModule", {
20514
+ value: true
20515
+ });
20516
+ exports.default = void 0;
20517
+
20518
+ var _vue = _interopRequireDefault(require("vue"));
20519
+
20520
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
20521
+
20522
+ var _SidesControl = _interopRequireDefault(require("../containers/SidesControl"));
20523
+
20524
+ var _filters = _interopRequireDefault(require("../plugins/filters"));
20525
+
20526
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20527
+
20528
+ /**
20529
+ * Sides control
20530
+ */
20531
+ // eslint-disable-next-line camelcase
20532
+ var _default = {
20533
+ name: 'ControlSides',
20534
+ handler: function sidesControlJS(uniqueId) {
20535
+ var data = _WPTB_ControlsManager.default.getControlData(uniqueId); // add filters for vue instance
20536
+
20537
+
20538
+ _vue.default.use(_filters.default);
20539
+
20540
+ new _vue.default({
20541
+ data: data,
20542
+ components: {
20543
+ SidesControl: _SidesControl.default
20544
+ }
20545
+ }).$mount("#".concat(uniqueId));
20546
+ }
20547
+ };
20548
+ exports.default = _default;
20549
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js","../containers/SidesControl":"containers/SidesControl.vue","../plugins/filters":"plugins/filters.js"}],"components/NamedToggleItem.vue":[function(require,module,exports) {
20550
+ "use strict";
20551
+
20552
+ Object.defineProperty(exports, "__esModule", {
20553
+ value: true
20554
+ });
20555
+ exports.default = void 0;
20556
+ //
20557
+ //
20558
+ //
20559
+ //
20560
+ //
20561
+ //
20562
+ //
20563
+ //
20564
+ //
20565
+ //
20566
+ var _default = {
20567
+ props: {
20568
+ title: {
20569
+ type: String,
20570
+ default: 'item'
20571
+ },
20572
+ id: {
20573
+ type: String,
20574
+ required: true
20575
+ },
20576
+ active: {
20577
+ type: Boolean,
20578
+ default: false
20579
+ }
20580
+ },
20581
+ watch: {
20582
+ active: function active(n) {
20583
+ if (n === true) {
20584
+ this.$emit('activateItem', this.id, this.$refs.itemWrapper);
20585
+ }
20586
+ }
20587
+ },
20588
+ methods: {
20589
+ activateItem: function activateItem(e) {
20590
+ this.$emit('activateItem', this.id, e.target);
20591
+ }
20592
+ }
20593
+ };
20594
+ exports.default = _default;
20595
+ var $40eb3b = exports.default || module.exports;
20596
+
20597
+ if (typeof $40eb3b === 'function') {
20598
+ $40eb3b = $40eb3b.options;
20599
+ }
20600
+
20601
+ /* template */
20602
+ Object.assign($40eb3b, (function () {
20603
+ var render = function() {
20604
+ var _vm = this
20605
+ var _h = _vm.$createElement
20606
+ var _c = _vm._self._c || _h
20607
+ return _c(
20608
+ "div",
20609
+ {
20610
+ ref: "itemWrapper",
20611
+ staticClass: "wptb-named-toggle-item",
20612
+ attrs: { "data-wptb-named-toggle-active": _vm.active },
20613
+ on: {
20614
+ "!click": function($event) {
20615
+ $event.preventDefault()
20616
+ return _vm.activateItem($event)
20617
+ }
20618
+ }
20619
+ },
20620
+ [_vm._v("\n\t" + _vm._s(_vm.title) + "\n")]
20621
+ )
20622
+ }
20623
+ var staticRenderFns = []
20624
+ render._withStripped = true
20625
+
20626
+ return {
20627
+ render: render,
20628
+ staticRenderFns: staticRenderFns,
20629
+ _compiled: true,
20630
+ _scopeId: null,
20631
+ functional: undefined
20632
+ };
20633
+ })());
20634
+
20635
+ },{}],"components/NamedToggleActiveIndicator.vue":[function(require,module,exports) {
20636
+ "use strict";
20637
+
20638
+ Object.defineProperty(exports, "__esModule", {
20639
+ value: true
20640
+ });
20641
+ exports.default = void 0;
20642
+ //
20643
+ //
20644
+ //
20645
+ var _default = {
20646
+ props: {
20647
+ refElement: {
20648
+ type: HTMLElement,
20649
+ default: null
20650
+ }
20651
+ },
20652
+ data: function data() {
20653
+ return {
20654
+ style: {
20655
+ left: 0,
20656
+ top: 0,
20657
+ width: 0
20658
+ }
20659
+ };
20660
+ },
20661
+ watch: {
20662
+ refElement: function refElement(n) {
20663
+ if (n === null || n === undefined) {
20664
+ return;
20665
+ }
20666
+
20667
+ this.calculatePosition();
20668
+ }
20669
+ },
20670
+ methods: {
20671
+ calculatePosition: function calculatePosition() {
20672
+ var mainWrapperPosObj = this.$refs.main.parentNode.getBoundingClientRect();
20673
+ var targetPosObj = this.refElement.getBoundingClientRect();
20674
+ var relativeX = targetPosObj.x - mainWrapperPosObj.x;
20675
+ this.style.left = "".concat(Math.floor(relativeX - 1), "px");
20676
+ this.style.width = "".concat(targetPosObj.width + 1, "px");
20677
+ }
20678
+ }
20679
+ };
20680
+ exports.default = _default;
20681
+ var $01554d = exports.default || module.exports;
20682
+
20683
+ if (typeof $01554d === 'function') {
20684
+ $01554d = $01554d.options;
20685
+ }
20686
+
20687
+ /* template */
20688
+ Object.assign($01554d, (function () {
20689
+ var render = function() {
20690
+ var _vm = this
20691
+ var _h = _vm.$createElement
20692
+ var _c = _vm._self._c || _h
20693
+ return _c("div", {
20694
+ ref: "main",
20695
+ staticClass: "wptb-named-toggle-active-indicator",
20696
+ style: _vm.style
20697
+ })
20698
+ }
20699
+ var staticRenderFns = []
20700
+ render._withStripped = true
20701
+
20702
+ return {
20703
+ render: render,
20704
+ staticRenderFns: staticRenderFns,
20705
+ _compiled: true,
20706
+ _scopeId: null,
20707
+ functional: undefined
20708
+ };
20709
+ })());
20710
+
20711
+ },{}],"containers/NamedToggleControl.vue":[function(require,module,exports) {
20712
+ "use strict";
20713
+
20714
+ Object.defineProperty(exports, "__esModule", {
20715
+ value: true
20716
+ });
20717
+ exports.default = void 0;
20718
+
20719
+ var _ControlBase = _interopRequireDefault(require("../mixins/ControlBase"));
20720
+
20721
+ var _NamedToggleItem = _interopRequireDefault(require("../components/NamedToggleItem"));
20722
+
20723
+ var _NamedToggleActiveIndicator = _interopRequireDefault(require("../components/NamedToggleActiveIndicator"));
20724
+
20725
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20726
+
20727
+ //
20728
+ //
20729
+ //
20730
+ //
20731
+ //
20732
+ //
20733
+ //
20734
+ //
20735
+ //
20736
+ //
20737
+ //
20738
+ //
20739
+ //
20740
+ //
20741
+ //
20742
+ //
20743
+ //
20744
+ //
20745
+ //
20746
+ //
20747
+ //
20748
+ //
20749
+ var _default = {
20750
+ components: {
20751
+ NamedToggleActiveIndicator: _NamedToggleActiveIndicator.default,
20752
+ NamedToggleItem: _NamedToggleItem.default
20753
+ },
20754
+ props: {
20755
+ items: {
20756
+ type: Object,
20757
+ default: function _default() {
20758
+ return {
20759
+ item: 'item'
20760
+ };
20761
+ }
20762
+ }
20763
+ },
20764
+ mixins: [_ControlBase.default],
20765
+ data: function data() {
20766
+ return {
20767
+ activeElement: null
20768
+ };
20769
+ },
20770
+ mounted: function mounted() {
20771
+ this.assignDefaultValue();
20772
+ },
20773
+ watch: {
20774
+ elementMainValue: function elementMainValue(n) {
20775
+ this.basicValueUpdate(n);
20776
+ }
20777
+ },
20778
+ methods: {
20779
+ isItemActive: function isItemActive(id) {
20780
+ return this.elementMainValue === id;
20781
+ },
20782
+ activateItem: function activateItem(id, refElement) {
20783
+ this.elementMainValue = id;
20784
+ this.activeElement = refElement;
20785
+ }
20786
+ }
20787
+ };
20788
+ exports.default = _default;
20789
+ var $8f11fa = exports.default || module.exports;
20790
+
20791
+ if (typeof $8f11fa === 'function') {
20792
+ $8f11fa = $8f11fa.options;
20793
+ }
20794
+
20795
+ /* template */
20796
+ Object.assign($8f11fa, (function () {
20797
+ var render = function() {
20798
+ var _vm = this
20799
+ var _h = _vm.$createElement
20800
+ var _c = _vm._self._c || _h
20801
+ return _c(
20802
+ "div",
20803
+ {
20804
+ staticClass:
20805
+ "wptb-settings-row wptb-settings-middle-xs wptb-element-property",
20806
+ class: _vm.uniqueId,
20807
+ attrs: { "data-element": _vm.elemContainer }
20808
+ },
20809
+ [
20810
+ _c("div", { staticClass: "wptb-settings-space-between" }, [
20811
+ _c("p", { staticClass: "wptb-settings-item-title" }, [
20812
+ _vm._v(_vm._s(_vm.label))
20813
+ ]),
20814
+ _vm._v(" "),
20815
+ _c(
20816
+ "div",
20817
+ { staticClass: "wptb-named-toggle-control-wrapper" },
20818
+ [
20819
+ _c("named-toggle-active-indicator", {
20820
+ attrs: { "ref-element": _vm.activeElement }
20821
+ }),
20822
+ _vm._v(" "),
20823
+ _vm._l(_vm.items, function(v, k) {
20824
+ return _c("named-toggle-item", {
20825
+ key: k,
20826
+ attrs: { title: v, id: k, active: _vm.isItemActive(k) },
20827
+ on: { activateItem: _vm.activateItem }
20828
+ })
20829
+ })
20830
+ ],
20831
+ 2
20832
+ )
20833
+ ])
20834
+ ]
20835
+ )
20836
+ }
20837
+ var staticRenderFns = []
20838
+ render._withStripped = true
20839
+
20840
+ return {
20841
+ render: render,
20842
+ staticRenderFns: staticRenderFns,
20843
+ _compiled: true,
20844
+ _scopeId: null,
20845
+ functional: undefined
20846
+ };
20847
+ })());
20848
+
20849
+ },{"../mixins/ControlBase":"mixins/ControlBase.js","../components/NamedToggleItem":"components/NamedToggleItem.vue","../components/NamedToggleActiveIndicator":"components/NamedToggleActiveIndicator.vue"}],"mountPoints/WPTB_NamedToggleControl.js":[function(require,module,exports) {
20850
+ "use strict";
20851
+
20852
+ Object.defineProperty(exports, "__esModule", {
20853
+ value: true
20854
+ });
20855
+ exports.default = void 0;
20856
+
20857
+ var _vue = _interopRequireDefault(require("vue"));
20858
+
20859
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
20860
+
20861
+ var _NamedToggleControl = _interopRequireDefault(require("../containers/NamedToggleControl"));
20862
+
20863
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20864
+
20865
+ /**
20866
+ * Named toggle control.
20867
+ */
20868
+ // eslint-disable-next-line camelcase
20869
+ var _default = {
20870
+ name: 'ControlNamedToggle',
20871
+ handler: function namedToggleControlJS(uniqueId) {
20872
+ var data = _WPTB_ControlsManager.default.getControlData(uniqueId);
20873
+
20874
+ new _vue.default({
20875
+ data: data,
20876
+ components: {
20877
+ NamedToggleControl: _NamedToggleControl.default
20878
+ }
20879
+ }).$mount("#".concat(uniqueId));
20880
+ }
20881
+ };
20882
+ exports.default = _default;
20883
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js","../containers/NamedToggleControl":"containers/NamedToggleControl.vue"}],"mixins/withTranslation.js":[function(require,module,exports) {
20884
+ "use strict";
20885
+
20886
+ Object.defineProperty(exports, "__esModule", {
20887
+ value: true
20888
+ });
20889
+ exports.default = void 0;
20890
+
20891
+ /**
20892
+ * Mixin for adding easy translated strings sent from WordPress.
20893
+ * @type {{methods: {translation(*): (withTranslation.methods.strings.key|undefined)}, props: {strings: {default: (function(): []), type: ArrayConstructor}}}}
20894
+ */
20895
+ var withTranslation = {
20896
+ props: {
20897
+ strings: {
20898
+ type: Object,
20899
+ default: function _default() {
20900
+ return {};
20901
+ }
20902
+ }
20903
+ },
20904
+ methods: {
20905
+ translation: function translation(key) {
20906
+ if (this.strings[key]) {
20907
+ return this.strings[key];
20908
+ }
20909
+
20910
+ throw new Error("no translation found with the given key of [".concat(key, "]"));
20911
+ }
20912
+ }
20913
+ };
20914
+ /* @module withTranslation mixin */
20915
+
20916
+ var _default = withTranslation;
20917
+ exports.default = _default;
20918
+ },{}],"components/TagRibbon.vue":[function(require,module,exports) {
20919
+ "use strict";
20920
+
20921
+ Object.defineProperty(exports, "__esModule", {
20922
+ value: true
20923
+ });
20924
+ exports.default = void 0;
20925
+ //
20926
+ //
20927
+ //
20928
+ //
20929
+ //
20930
+ //
20931
+ //
20932
+ //
20933
+ //
20934
+ //
20935
+ //
20936
+ //
20937
+ var _default = {
20938
+ props: {
20939
+ name: {
20940
+ type: String,
20941
+ default: 'tag name'
20942
+ },
20943
+ slug: {
20944
+ type: String,
20945
+ default: 'tagSlug'
20946
+ },
20947
+ description: {
20948
+ type: String,
20949
+ default: ''
20950
+ },
20951
+ addIcon: {
20952
+ type: String,
20953
+ default: '+'
20954
+ },
20955
+ removeIcon: {
20956
+ type: String,
20957
+ default: '-'
20958
+ },
20959
+ buttonOperationType: {
20960
+ type: String,
20961
+ default: 'add'
20962
+ },
20963
+ searchTerm: {
20964
+ type: String,
20965
+ default: ''
20966
+ }
20967
+ },
20968
+ computed: {
20969
+ buttonIcon: function buttonIcon() {
20970
+ return this.buttonOperationType === 'add' ? this.addIcon : this.removeIcon;
20971
+ },
20972
+ buttonClass: function buttonClass() {
20973
+ return {
20974
+ 'wptb-tag-operation-add-button': this.buttonOperationType === 'add',
20975
+ 'wptb-tag-operation-remove-button': this.buttonOperationType !== 'add'
20976
+ };
20977
+ },
20978
+ searchIndicatedName: function searchIndicatedName() {
20979
+ var regex = new RegExp("".concat(this.searchTerm), 'gi');
20980
+ return this.name.replaceAll(regex, '<span class="wptb-tag-control-search-indicator">$&</span>');
20981
+ }
20982
+ },
20983
+ methods: {
20984
+ handleClick: function handleClick() {
20985
+ this.$emit('click', this.slug);
20986
+ }
20987
+ }
20988
+ };
20989
+ exports.default = _default;
20990
+ var $5454bf = exports.default || module.exports;
20991
+
20992
+ if (typeof $5454bf === 'function') {
20993
+ $5454bf = $5454bf.options;
20994
+ }
20995
+
20996
+ /* template */
20997
+ Object.assign($5454bf, (function () {
20998
+ var render = function() {
20999
+ var _vm = this
21000
+ var _h = _vm.$createElement
21001
+ var _c = _vm._self._c || _h
21002
+ return _c(
21003
+ "div",
21004
+ {
21005
+ staticClass: "wptb-tag-ribbon-wrapper",
21006
+ attrs: { title: _vm.description }
21007
+ },
21008
+ [
21009
+ _c("div", {
21010
+ staticClass: "wptb-tag-ribbon-name",
21011
+ domProps: { innerHTML: _vm._s(_vm.searchIndicatedName) }
21012
+ }),
21013
+ _vm._v(" "),
21014
+ _c("div", {
21015
+ staticClass: "wptb-tag-operation-button",
21016
+ class: _vm.buttonClass,
21017
+ domProps: { innerHTML: _vm._s(_vm.buttonIcon) },
21018
+ on: {
21019
+ click: function($event) {
21020
+ $event.preventDefault()
21021
+ return _vm.handleClick($event)
21022
+ }
21023
+ }
21024
+ })
21025
+ ]
21026
+ )
21027
+ }
21028
+ var staticRenderFns = []
21029
+ render._withStripped = true
21030
+
21031
+ return {
21032
+ render: render,
21033
+ staticRenderFns: staticRenderFns,
21034
+ _compiled: true,
21035
+ _scopeId: null,
21036
+ functional: undefined
21037
+ };
21038
+ })());
21039
+
21040
+ },{}],"components/TagCloud.vue":[function(require,module,exports) {
21041
+ "use strict";
21042
+
21043
+ Object.defineProperty(exports, "__esModule", {
21044
+ value: true
21045
+ });
21046
+ exports.default = void 0;
21047
+
21048
+ var _TagRibbon = _interopRequireDefault(require("./TagRibbon"));
21049
+
21050
+ var _withTranslation = _interopRequireDefault(require("../mixins/withTranslation"));
21051
+
21052
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21053
+
21054
+ //
21055
+ //
21056
+ //
21057
+ //
21058
+ //
21059
+ //
21060
+ //
21061
+ //
21062
+ //
21063
+ //
21064
+ //
21065
+ //
21066
+ //
21067
+ //
21068
+ //
21069
+ //
21070
+ //
21071
+ //
21072
+ //
21073
+ //
21074
+ //
21075
+ var _default = {
21076
+ props: {
21077
+ label: {
21078
+ type: String,
21079
+ default: 'Tag Cloud Label'
21080
+ },
21081
+ ribbonOperationType: {
21082
+ type: String,
21083
+ default: 'add'
21084
+ },
21085
+ tags: {
21086
+ type: Array,
21087
+ default: function _default() {
21088
+ return [];
21089
+ }
21090
+ },
21091
+ emptyDisplay: {
21092
+ type: String,
21093
+ default: 'empty'
21094
+ },
21095
+ searchTerm: {
21096
+ type: String,
21097
+ default: ''
21098
+ }
21099
+ },
21100
+ components: {
21101
+ TagRibbon: _TagRibbon.default
21102
+ },
21103
+ mixins: [_withTranslation.default],
21104
+ methods: {
21105
+ handleTagRibbonClick: function handleTagRibbonClick(termSlug) {
21106
+ this.$emit('ribbonClick', termSlug);
21107
+ }
21108
+ }
21109
+ };
21110
+ exports.default = _default;
21111
+ var $e2de97 = exports.default || module.exports;
21112
+
21113
+ if (typeof $e2de97 === 'function') {
21114
+ $e2de97 = $e2de97.options;
21115
+ }
21116
+
21117
+ /* template */
21118
+ Object.assign($e2de97, (function () {
21119
+ var render = function() {
21120
+ var _vm = this
21121
+ var _h = _vm.$createElement
21122
+ var _c = _vm._self._c || _h
21123
+ return _c("div", { staticClass: "wptb-tag-control-cloud-wrapper" }, [
21124
+ _c("p", { staticClass: "wptb-settings-item-title" }, [
21125
+ _vm._v(_vm._s(_vm.label))
21126
+ ]),
21127
+ _vm._v(" "),
21128
+ _c(
21129
+ "div",
21130
+ { staticClass: "wptb-tag-control-cloud" },
21131
+ [
21132
+ _vm._l(_vm.tags, function(tag) {
21133
+ return _c("tag-ribbon", {
21134
+ key: tag.slug,
21135
+ attrs: {
21136
+ name: tag.name,
21137
+ slug: tag.slug,
21138
+ description: tag.description,
21139
+ "button-operation-type": _vm.ribbonOperationType,
21140
+ "search-term": _vm.searchTerm
21141
+ },
21142
+ on: { click: _vm.handleTagRibbonClick }
21143
+ })
21144
+ }),
21145
+ _vm._v(" "),
21146
+ _vm.tags.length === 0
21147
+ ? _c("div", { staticClass: "wptb-tag-control-cloud-empty" }, [
21148
+ _vm._v("\n\t\t\t" + _vm._s(_vm.emptyDisplay) + "\n\t\t")
21149
+ ])
21150
+ : _vm._e()
21151
+ ],
21152
+ 2
21153
+ )
21154
+ ])
21155
+ }
21156
+ var staticRenderFns = []
21157
+ render._withStripped = true
21158
+
21159
+ return {
21160
+ render: render,
21161
+ staticRenderFns: staticRenderFns,
21162
+ _compiled: true,
21163
+ _scopeId: null,
21164
+ functional: undefined
21165
+ };
21166
+ })());
21167
+
21168
+ },{"./TagRibbon":"components/TagRibbon.vue","../mixins/withTranslation":"mixins/withTranslation.js"}],"components/TagSearch.vue":[function(require,module,exports) {
21169
+ "use strict";
21170
+
21171
+ Object.defineProperty(exports, "__esModule", {
21172
+ value: true
21173
+ });
21174
+ exports.default = void 0;
21175
+ //
21176
+ //
21177
+ //
21178
+ //
21179
+ //
21180
+ //
21181
+ //
21182
+ //
21183
+ //
21184
+ //
21185
+ //
21186
+ //
21187
+ //
21188
+ //
21189
+ //
21190
+ //
21191
+ var _default = {
21192
+ props: {
21193
+ searchTerm: {
21194
+ type: String,
21195
+ default: ''
21196
+ },
21197
+ placeholder: {
21198
+ type: String,
21199
+ default: ''
21200
+ }
21201
+ },
21202
+ model: {
21203
+ prop: '',
21204
+ event: 'termUpdate'
21205
+ },
21206
+ data: function data() {
21207
+ return {
21208
+ innerSearchTerm: ''
21209
+ };
21210
+ },
21211
+ watch: {
21212
+ searchTerm: function searchTerm() {
21213
+ this.innerSearchTerm = this.searchTerm;
21214
+ },
21215
+ innerSearchTerm: function innerSearchTerm() {
21216
+ this.$emit('termUpdate', this.innerSearchTerm);
21217
+ this.$emit('termUpdate', this.innerSearchTerm);
21218
+ }
21219
+ },
21220
+ methods: {
21221
+ clearSearch: function clearSearch() {
21222
+ this.innerSearchTerm = '';
21223
+ }
21224
+ }
21225
+ };
21226
+ exports.default = _default;
21227
+ var $7a0752 = exports.default || module.exports;
21228
+
21229
+ if (typeof $7a0752 === 'function') {
21230
+ $7a0752 = $7a0752.options;
21231
+ }
21232
+
21233
+ /* template */
21234
+ Object.assign($7a0752, (function () {
21235
+ var render = function() {
21236
+ var _vm = this
21237
+ var _h = _vm.$createElement
21238
+ var _c = _vm._self._c || _h
21239
+ return _c("div", { staticClass: "wptb-tag-control-search-wrapper" }, [
21240
+ _c("div", { staticClass: "wptb-tag-control-search-input" }, [
21241
+ _c("input", {
21242
+ directives: [
21243
+ {
21244
+ name: "model",
21245
+ rawName: "v-model.trim",
21246
+ value: _vm.innerSearchTerm,
21247
+ expression: "innerSearchTerm",
21248
+ modifiers: { trim: true }
21249
+ }
21250
+ ],
21251
+ staticClass: "wptb-tag-control-search",
21252
+ attrs: { type: "text", placeholder: _vm.placeholder },
21253
+ domProps: { value: _vm.innerSearchTerm },
21254
+ on: {
21255
+ input: function($event) {
21256
+ if ($event.target.composing) {
21257
+ return
21258
+ }
21259
+ _vm.innerSearchTerm = $event.target.value.trim()
21260
+ },
21261
+ blur: function($event) {
21262
+ return _vm.$forceUpdate()
21263
+ }
21264
+ }
21265
+ }),
21266
+ _vm._v(" "),
21267
+ _vm.innerSearchTerm !== ""
21268
+ ? _c(
21269
+ "div",
21270
+ {
21271
+ staticClass: "wptb-tag-control-search-clear",
21272
+ on: {
21273
+ click: function($event) {
21274
+ $event.preventDefault()
21275
+ return _vm.clearSearch($event)
21276
+ }
21277
+ }
21278
+ },
21279
+ [_vm._v("\n\t\t\tx\n\t\t")]
21280
+ )
21281
+ : _vm._e()
21282
+ ])
21283
+ ])
21284
+ }
21285
+ var staticRenderFns = []
21286
+ render._withStripped = true
21287
+
21288
+ return {
21289
+ render: render,
21290
+ staticRenderFns: staticRenderFns,
21291
+ _compiled: true,
21292
+ _scopeId: null,
21293
+ functional: undefined
21294
+ };
21295
+ })());
21296
+
21297
+ },{}],"components/TagCreate.vue":[function(require,module,exports) {
21298
+ "use strict";
21299
+
21300
+ Object.defineProperty(exports, "__esModule", {
21301
+ value: true
21302
+ });
21303
+ exports.default = void 0;
21304
+ //
21305
+ //
21306
+ //
21307
+ //
21308
+ //
21309
+ //
21310
+ //
21311
+ //
21312
+ //
21313
+ //
21314
+ //
21315
+ //
21316
+ //
21317
+ //
21318
+ //
21319
+ //
21320
+ //
21321
+ //
21322
+ //
21323
+ //
21324
+ //
21325
+ //
21326
+ //
21327
+ //
21328
+ //
21329
+ var _default = {
21330
+ props: {
21331
+ label: {
21332
+ type: String,
21333
+ default: 'Create new tag'
21334
+ },
21335
+ nameString: {
21336
+ type: String,
21337
+ default: 'name'
21338
+ },
21339
+ slugString: {
21340
+ type: String,
21341
+ default: 'slug'
21342
+ },
21343
+ descString: {
21344
+ type: String,
21345
+ default: 'description'
21346
+ },
21347
+ createString: {
21348
+ type: String,
21349
+ default: 'create'
21350
+ },
21351
+ allTagNames: {
21352
+ type: Array,
21353
+ default: function _default() {
21354
+ return [];
21355
+ }
21356
+ }
21357
+ },
21358
+ data: function data() {
21359
+ return {
21360
+ formData: {
21361
+ name: '',
21362
+ slug: '',
21363
+ description: ''
21364
+ },
21365
+ disabled: true,
21366
+ busy: false,
21367
+ status: null
21368
+ };
21369
+ },
21370
+ watch: {
21371
+ 'formData.name': {
21372
+ handler: function handler() {
21373
+ this.handleButtonDisable();
21374
+ }
21375
+ },
21376
+ status: function status() {
21377
+ var _this = this;
21378
+
21379
+ setTimeout(function () {
21380
+ _this.$set(_this, 'status', null);
21381
+ }, 3000);
21382
+ }
21383
+ },
21384
+ mounted: function mounted() {
21385
+ this.handleButtonDisable();
21386
+ },
21387
+ methods: {
21388
+ handleButtonDisable: function handleButtonDisable() {
21389
+ var name = this.formData.name;
21390
+
21391
+ if (name === '') {
21392
+ this.disabled = true;
21393
+ } else {
21394
+ this.disabled = this.allTagNames.includes(name);
21395
+ }
21396
+ },
21397
+ updateCompState: function updateCompState(busyVal) {
21398
+ var resultVal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
21399
+ this.$set(this, 'disabled', busyVal);
21400
+ this.$set(this, 'busy', busyVal);
21401
+ this.$set(this, 'status', resultVal);
21402
+ },
21403
+ clearFormData: function clearFormData() {
21404
+ var _this2 = this;
21405
+
21406
+ // eslint-disable-next-line array-callback-return
21407
+ Object.keys(this.formData).map(function (k) {
21408
+ if (Object.prototype.hasOwnProperty.call(_this2.formData, k)) {
21409
+ _this2.$set(_this2.formData, k, '');
21410
+ }
21411
+ });
21412
+ },
21413
+ handleCreate: function handleCreate() {
21414
+ var bindedClear = this.clearFormData.bind(this);
21415
+ var bindedBusy = this.updateCompState.bind(this);
21416
+ this.$emit('createTerm', this.formData, bindedClear, bindedBusy);
21417
+ }
21418
+ }
21419
+ };
21420
+ exports.default = _default;
21421
+ var $43e382 = exports.default || module.exports;
21422
+
21423
+ if (typeof $43e382 === 'function') {
21424
+ $43e382 = $43e382.options;
21425
+ }
21426
+
21427
+ /* template */
21428
+ Object.assign($43e382, (function () {
21429
+ var render = function() {
21430
+ var _vm = this
21431
+ var _h = _vm.$createElement
21432
+ var _c = _vm._self._c || _h
21433
+ return _c(
21434
+ "div",
21435
+ {
21436
+ staticClass:
21437
+ "wptb-tag-control-cloud-wrapper wptb-tag-control-create-wrapper"
21438
+ },
21439
+ [
21440
+ _c("p", { staticClass: "wptb-settings-item-title" }, [
21441
+ _vm._v(_vm._s(_vm.label))
21442
+ ]),
21443
+ _vm._v(" "),
21444
+ _c("div", { staticClass: "wptb-tag-control-create-controls-wrapper" }, [
21445
+ _c(
21446
+ "label",
21447
+ {
21448
+ staticClass: "wptb-tag-control-create-control-label",
21449
+ attrs: { for: "new_tag_name" }
21450
+ },
21451
+ [_vm._v(_vm._s(_vm.nameString))]
21452
+ ),
21453
+ _vm._v(" "),
21454
+ _c("input", {
21455
+ directives: [
21456
+ {
21457
+ name: "model",
21458
+ rawName: "v-model.trim",
21459
+ value: _vm.formData.name,
21460
+ expression: "formData.name",
21461
+ modifiers: { trim: true }
21462
+ }
21463
+ ],
21464
+ staticClass: "wptb-tag-control-search",
21465
+ attrs: { id: "new_tag_name", type: "text" },
21466
+ domProps: { value: _vm.formData.name },
21467
+ on: {
21468
+ input: function($event) {
21469
+ if ($event.target.composing) {
21470
+ return
21471
+ }
21472
+ _vm.$set(_vm.formData, "name", $event.target.value.trim())
21473
+ },
21474
+ blur: function($event) {
21475
+ return _vm.$forceUpdate()
21476
+ }
21477
+ }
21478
+ }),
21479
+ _vm._v(" "),
21480
+ _vm.busy
21481
+ ? _c("div", {
21482
+ staticClass:
21483
+ "wptb-tag-control-busy dashicons dashicons-update-alt"
21484
+ })
21485
+ : _vm._e(),
21486
+ _vm._v(" "),
21487
+ _vm.status
21488
+ ? _c("div", {
21489
+ staticClass: "wptb-tag-control-status dashicons dashicons-yes",
21490
+ attrs: { "data-status": "positive" }
21491
+ })
21492
+ : _vm._e(),
21493
+ _vm._v(" "),
21494
+ _vm.status === false
21495
+ ? _c("div", {
21496
+ staticClass:
21497
+ "wptb-tag-control-status dashicons dashicons-warning",
21498
+ attrs: { "data-status": "negative" }
21499
+ })
21500
+ : _vm._e(),
21501
+ _vm._v(" "),
21502
+ _c(
21503
+ "div",
21504
+ {
21505
+ staticClass: "wptb-tag-control-create-button",
21506
+ attrs: { "data-disabled": _vm.disabled },
21507
+ on: {
21508
+ click: function($event) {
21509
+ $event.preventDefault()
21510
+ return _vm.handleCreate($event)
21511
+ }
21512
+ }
21513
+ },
21514
+ [_vm._v("\n\t\t\t" + _vm._s(_vm.createString) + "\n\t\t")]
21515
+ )
21516
+ ])
21517
+ ]
21518
+ )
21519
+ }
21520
+ var staticRenderFns = []
21521
+ render._withStripped = true
21522
+
21523
+ return {
21524
+ render: render,
21525
+ staticRenderFns: staticRenderFns,
21526
+ _compiled: true,
21527
+ _scopeId: null,
21528
+ functional: undefined
21529
+ };
21530
+ })());
21531
+
21532
+ },{}],"containers/TagControl.vue":[function(require,module,exports) {
21533
+ "use strict";
21534
+
21535
+ Object.defineProperty(exports, "__esModule", {
21536
+ value: true
21537
+ });
21538
+ exports.default = void 0;
21539
+
21540
+ var _ControlBase = _interopRequireDefault(require("../mixins/ControlBase"));
21541
+
21542
+ var _withTranslation = _interopRequireDefault(require("../mixins/withTranslation"));
21543
+
21544
+ var _TagCloud = _interopRequireDefault(require("../components/TagCloud"));
21545
+
21546
+ var _TagSearch = _interopRequireDefault(require("../components/TagSearch"));
21547
+
21548
+ var _TagCreate = _interopRequireDefault(require("../components/TagCreate"));
21549
+
21550
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21551
+
21552
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
21553
+
21554
+ var _default = {
21555
+ components: {
21556
+ TagCreate: _TagCreate.default,
21557
+ TagSearch: _TagSearch.default,
21558
+ TagCloud: _TagCloud.default
21559
+ },
21560
+ props: {
21561
+ availableTags: {
21562
+ type: Array,
21563
+ default: function _default() {
21564
+ return [];
21565
+ }
21566
+ },
21567
+ security: {
21568
+ type: Object,
21569
+ default: function _default() {
21570
+ return {};
21571
+ }
21572
+ }
21573
+ },
21574
+ mixins: [_ControlBase.default, _withTranslation.default],
21575
+ data: function data() {
21576
+ return {
21577
+ selectedTags: [],
21578
+ mountedAssign: false,
21579
+ searchTerm: '',
21580
+ innerTags: []
21581
+ };
21582
+ },
21583
+ mounted: function mounted() {
21584
+ var _this = this;
21585
+
21586
+ document.addEventListener('wptb:save:before', this.beforeSave);
21587
+ this.$nextTick(function () {
21588
+ _this.selectedTags = WPTB_ControlsManager.getControlData('ControlTag');
21589
+ });
21590
+ this.innerTags = Array.from(this.availableTags);
21591
+ },
21592
+ watch: {
21593
+ selectedTags: {
21594
+ handler: function handler() {
21595
+ if (!this.mountedAssign) {
21596
+ this.mountedAssign = true;
21597
+ } else {
21598
+ WPTB_ControlsManager.setControlData('ControlTag', this.selectedTags);
21599
+ new WPTB_TableStateSaveManager().tableStateSet();
21600
+ }
21601
+ },
21602
+ deep: true
21603
+ }
21604
+ },
21605
+ computed: {
21606
+ filteredTagsLeft: function filteredTagsLeft() {
21607
+ var _this2 = this;
21608
+
21609
+ return this.tagsLeft().filter(function (t) {
21610
+ return t.name.toLowerCase().includes(_this2.searchTerm);
21611
+ });
21612
+ },
21613
+ justTheNames: function justTheNames() {
21614
+ return this.innerTags.reduce(function (carry, tag) {
21615
+ carry.push(tag.name);
21616
+ return carry;
21617
+ }, []);
21618
+ }
21619
+ },
21620
+ methods: {
21621
+ tagsLeft: function tagsLeft() {
21622
+ var _this3 = this;
21623
+
21624
+ return this.innerTags.filter(function (t) {
21625
+ return !_this3.selectedTags.some(function (s) {
21626
+ return s.slug === t.slug;
21627
+ });
21628
+ });
21629
+ },
21630
+ handleAdd: function handleAdd(slug) {
21631
+ this.selectedTags.push(this.innerTags.filter(function (t) {
21632
+ return t.slug === slug;
21633
+ })[0]);
21634
+ },
21635
+ handleRemove: function handleRemove(slug) {
21636
+ this.selectedTags = this.selectedTags.filter(function (t) {
21637
+ return t.slug !== slug;
21638
+ });
21639
+ },
21640
+ beforeSave: function beforeSave(_ref) {
21641
+ var detail = _ref.detail;
21642
+
21643
+ if (_typeof(detail) === 'object') {
21644
+ // eslint-disable-next-line no-param-reassign
21645
+ detail.tags = JSON.stringify(this.selectedTags.map(function (t) {
21646
+ return t.term_id;
21647
+ }));
21648
+ }
21649
+ },
21650
+ createTerm: function createTerm(termData, clearFormSignal, updateBusy) {
21651
+ var _this4 = this;
21652
+
21653
+ var _this$security$create = this.security.create,
21654
+ nonce = _this$security$create.nonce,
21655
+ action = _this$security$create.action,
21656
+ ajaxUrl = _this$security$create.ajaxUrl;
21657
+ var formData = new FormData();
21658
+ formData.append('nonce', nonce);
21659
+ formData.append('action', action);
21660
+ formData.append('termData', JSON.stringify(termData)); // set busy status to true for create component
21661
+
21662
+ updateBusy(true);
21663
+ fetch(ajaxUrl, {
21664
+ method: 'POST',
21665
+ body: formData
21666
+ }).then(function (r) {
21667
+ if (r.ok) {
21668
+ return r.json();
21669
+ }
21670
+
21671
+ throw new Error('an error occurred creating table term, refresh and try again');
21672
+ }).then(function (resp) {
21673
+ if (resp.error) {
21674
+ throw new Error(resp.error);
21675
+ }
21676
+
21677
+ _this4.$set(_this4, 'innerTags', resp.data.tags);
21678
+
21679
+ clearFormSignal();
21680
+ updateBusy(false, true);
21681
+ }).catch(function (err) {
21682
+ // eslint-disable-next-line no-console
21683
+ console.error(err);
21684
+ updateBusy(false, false);
21685
+ });
21686
+ }
21687
+ }
21688
+ };
21689
+ exports.default = _default;
21690
+ var $d303c1 = exports.default || module.exports;
21691
+
21692
+ if (typeof $d303c1 === 'function') {
21693
+ $d303c1 = $d303c1.options;
21694
+ }
21695
+
21696
+ /* template */
21697
+ Object.assign($d303c1, (function () {
21698
+ var render = function() {
21699
+ var _vm = this
21700
+ var _h = _vm.$createElement
21701
+ var _c = _vm._self._c || _h
21702
+ return _c(
21703
+ "div",
21704
+ {
21705
+ staticClass:
21706
+ "wptb-settings-row wptb-settings-middle-xs wptb-element-property",
21707
+ class: _vm.uniqueId,
21708
+ attrs: { "data-element": _vm.elemContainer }
21709
+ },
21710
+ [
21711
+ _c("tag-cloud", {
21712
+ attrs: {
21713
+ label: _vm.translation("currentTags"),
21714
+ "ribbon-operation-type": "remove",
21715
+ tags: _vm.selectedTags,
21716
+ "search-term": _vm.searchTerm
21717
+ },
21718
+ on: { ribbonClick: _vm.handleRemove }
21719
+ }),
21720
+ _vm._v(" "),
21721
+ _c("tag-cloud", {
21722
+ attrs: {
21723
+ label: _vm.translation("availableTags"),
21724
+ "ribbon-operation-type": "add",
21725
+ tags: _vm.filteredTagsLeft,
21726
+ "search-term": _vm.searchTerm
21727
+ },
21728
+ on: { ribbonClick: _vm.handleAdd }
21729
+ }),
21730
+ _vm._v(" "),
21731
+ _c("tag-search", {
21732
+ attrs: { placeholder: _vm.translation("searchTags") },
21733
+ model: {
21734
+ value: _vm.searchTerm,
21735
+ callback: function($$v) {
21736
+ _vm.searchTerm = $$v
21737
+ },
21738
+ expression: "searchTerm"
21739
+ }
21740
+ }),
21741
+ _vm._v(" "),
21742
+ _c("tag-create", {
21743
+ attrs: {
21744
+ label: _vm.translation("createNewTag"),
21745
+ "name-string": _vm.translation("tagName"),
21746
+ "desc-string": _vm.translation("tagDesc"),
21747
+ "slug-string": _vm.translation("tagSlug"),
21748
+ "all-tag-names": _vm.justTheNames
21749
+ },
21750
+ on: { createTerm: _vm.createTerm }
21751
+ })
21752
+ ],
21753
+ 1
21754
+ )
21755
+ }
21756
+ var staticRenderFns = []
21757
+ render._withStripped = true
21758
+
21759
+ return {
21760
+ render: render,
21761
+ staticRenderFns: staticRenderFns,
21762
+ _compiled: true,
21763
+ _scopeId: null,
21764
+ functional: undefined
21765
+ };
21766
+ })());
21767
+
21768
+ },{"../mixins/ControlBase":"mixins/ControlBase.js","../mixins/withTranslation":"mixins/withTranslation.js","../components/TagCloud":"components/TagCloud.vue","../components/TagSearch":"components/TagSearch.vue","../components/TagCreate":"components/TagCreate.vue"}],"mountPoints/WPTB_TagControl.js":[function(require,module,exports) {
21769
+ "use strict";
21770
+
21771
+ Object.defineProperty(exports, "__esModule", {
21772
+ value: true
21773
+ });
21774
+ exports.default = void 0;
21775
+
21776
+ var _vue = _interopRequireDefault(require("vue"));
21777
+
21778
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
21779
+
21780
+ var _TagControl = _interopRequireDefault(require("../containers/TagControl"));
21781
+
21782
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21783
+
21784
+ /**
21785
+ * Tag control.
21786
+ */
21787
+ // eslint-disable-next-line camelcase
21788
+ var _default = {
21789
+ name: 'ControlTag',
21790
+ handler: function tagControlJS(uniqueId) {
21791
+ var data = _WPTB_ControlsManager.default.getControlData(uniqueId);
21792
+
21793
+ new _vue.default({
21794
+ data: data,
21795
+ components: {
21796
+ TagControl: _TagControl.default
21797
+ }
21798
+ }).$mount("#".concat(uniqueId));
21799
+ }
21800
+ };
21801
+ exports.default = _default;
21802
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js","../containers/TagControl":"containers/TagControl.vue"}],"components/TableCell.vue":[function(require,module,exports) {
21803
+ "use strict";
21804
+
21805
+ Object.defineProperty(exports, "__esModule", {
21806
+ value: true
21807
+ });
21808
+ exports.default = void 0;
21809
+ //
21810
+ //
21811
+ //
21812
+ //
21813
+ //
21814
+ //
21815
+ //
21816
+ //
21817
+ //
21818
+ //
21819
+ //
21820
+ var _default = {
21821
+ props: {
21822
+ cell: {
21823
+ type: HTMLElement
21824
+ },
21825
+ selected: {
21826
+ type: Boolean,
21827
+ default: false
21828
+ }
21829
+ },
21830
+ computed: {
21831
+ cellStyle: function cellStyle() {
21832
+ return {
21833
+ gridColumn: "span ".concat(this.cell.getAttribute('colspan') || 1)
21834
+ };
21835
+ }
21836
+ },
21837
+ methods: {
21838
+ handleHover: function handleHover() {
21839
+ this.$emit('cellHover', this.cell);
21840
+ },
21841
+ handleExit: function handleExit() {
21842
+ this.$emit('cellHover', null);
21843
+ },
21844
+ handleClick: function handleClick() {
21845
+ this.$emit('cellClick', this.cell);
21846
+ }
21847
+ }
21848
+ };
21849
+ exports.default = _default;
21850
+ var $07112c = exports.default || module.exports;
21851
+
21852
+ if (typeof $07112c === 'function') {
21853
+ $07112c = $07112c.options;
21854
+ }
21855
+
21856
+ /* template */
21857
+ Object.assign($07112c, (function () {
21858
+ var render = function() {
21859
+ var _vm = this
21860
+ var _h = _vm.$createElement
21861
+ var _c = _vm._self._c || _h
21862
+ return _c("div", {
21863
+ staticClass: "wptb-table-cell-select-cell",
21864
+ style: _vm.cellStyle,
21865
+ attrs: { "data-cell-selected": _vm.selected },
21866
+ on: {
21867
+ click: _vm.handleClick,
21868
+ mouseenter: _vm.handleHover,
21869
+ mouseleave: _vm.handleExit
21870
+ }
21871
+ })
21872
+ }
21873
+ var staticRenderFns = []
21874
+ render._withStripped = true
21875
+
21876
+ return {
21877
+ render: render,
21878
+ staticRenderFns: staticRenderFns,
21879
+ _compiled: true,
21880
+ _scopeId: null,
21881
+ functional: undefined
21882
+ };
21883
+ })());
21884
+
21885
+ },{}],"components/TableCellSelect.vue":[function(require,module,exports) {
21886
+ "use strict";
21887
+
21888
+ Object.defineProperty(exports, "__esModule", {
21889
+ value: true
21890
+ });
21891
+ exports.default = void 0;
21892
+
21893
+ var _TableCell = _interopRequireDefault(require("./TableCell"));
21894
+
21895
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21896
+
21897
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21898
+
21899
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21900
+
21901
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21902
+
21903
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
21904
+
21905
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
21906
+
21907
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
21908
+
21909
+ var _default = {
21910
+ props: {
21911
+ table: {
21912
+ type: HTMLTableElement,
21913
+ default: null
21914
+ },
21915
+ hoveredCell: {
21916
+ type: HTMLElement,
21917
+ default: null
21918
+ },
21919
+ selectedCell: {
21920
+ type: HTMLElement,
21921
+ default: null
21922
+ },
21923
+ cellExtraStyling: {
21924
+ type: Function,
21925
+ default: function _default() {}
21926
+ },
21927
+ repaint: {
21928
+ type: Number,
21929
+ default: 0
21930
+ }
21931
+ },
21932
+ components: {
21933
+ TableCell: _TableCell.default
21934
+ },
21935
+ model: {
21936
+ prop: 'selectedCell',
21937
+ event: 'cellSelect'
21938
+ },
21939
+ data: function data() {
21940
+ return {
21941
+ cells: [],
21942
+ rows: 1,
21943
+ columns: 1,
21944
+ innerHoveredCell: null,
21945
+ innerSelectedCell: null
21946
+ };
21947
+ },
21948
+ watch: {
21949
+ selectedCell: function selectedCell() {
21950
+ this.innerSelectedCell = this.selectedCell;
21951
+ },
21952
+ innerSelectedCell: function innerSelectedCell(n) {
21953
+ this.$emit('cellSelect', n);
21954
+ },
21955
+ hoveredCell: function hoveredCell() {
21956
+ this.innerHoveredCell = this.hoveredCell;
21957
+ },
21958
+ innerHoveredCell: function innerHoveredCell() {
21959
+ this.$emit('cellHover', this.innerHoveredCell);
21960
+ },
21961
+ table: function table() {
21962
+ if (this.table) {
21963
+ this.cells = Array.from(this.table.querySelectorAll('td'));
21964
+ var rows = Array.from(this.table.querySelectorAll('tr'));
21965
+ this.rows = rows.length;
21966
+ this.columns = rows.reduce(function (carry, row) {
21967
+ var currentCellCount = Array.from(row.querySelectorAll('td')).length;
21968
+ return currentCellCount > carry ? currentCellCount : carry;
21969
+ }, 0);
21970
+ }
21971
+ }
21972
+ },
21973
+ computed: {
21974
+ gridStyle: function gridStyle() {
21975
+ return {
21976
+ gridTemplateColumns: "repeat(".concat(this.columns, ", 1fr)")
21977
+ };
21978
+ }
21979
+ },
21980
+ methods: {
21981
+ handleCellHover: function handleCellHover(cell) {
21982
+ this.innerHoveredCell = cell;
21983
+ },
21984
+ handleCellClick: function handleCellClick(cell) {
21985
+ this.innerSelectedCell = cell;
21986
+ },
21987
+ generateKey: function generateKey(length) {
21988
+ var letters = 'abcdef'.split('');
21989
+ var numbers = new Array(10).fill(1).map(function (_, i) {
21990
+ return i;
21991
+ });
21992
+ var all = [].concat(_toConsumableArray(letters), _toConsumableArray(numbers)); // eslint-disable-next-line no-unused-vars
21993
+
21994
+ return new Array(length).fill(1).reduce(function (carry, _) {
21995
+ // eslint-disable-next-line no-param-reassign
21996
+ carry += all[Math.floor(Math.random() * all.length)];
21997
+ return carry;
21998
+ }, '');
21999
+ }
22000
+ }
22001
+ };
22002
+ exports.default = _default;
22003
+ var $019087 = exports.default || module.exports;
22004
+
22005
+ if (typeof $019087 === 'function') {
22006
+ $019087 = $019087.options;
22007
+ }
22008
+
22009
+ /* template */
22010
+ Object.assign($019087, (function () {
22011
+ var render = function() {
22012
+ var _vm = this
22013
+ var _h = _vm.$createElement
22014
+ var _c = _vm._self._c || _h
22015
+ return _c(
22016
+ "div",
22017
+ {
22018
+ key: _vm.repaint,
22019
+ staticClass: "wptb-table-cell-select-wrapper",
22020
+ style: _vm.gridStyle
22021
+ },
22022
+ _vm._l(_vm.cells, function(cell) {
22023
+ return _c("table-cell", {
22024
+ key: _vm.generateKey(5),
22025
+ style: _vm.cellExtraStyling(cell),
22026
+ attrs: { cell: cell, selected: _vm.innerSelectedCell === cell },
22027
+ on: { cellHover: _vm.handleCellHover, cellClick: _vm.handleCellClick }
22028
+ })
22029
+ }),
22030
+ 1
22031
+ )
22032
+ }
22033
+ var staticRenderFns = []
22034
+ render._withStripped = true
22035
+
22036
+ return {
22037
+ render: render,
22038
+ staticRenderFns: staticRenderFns,
22039
+ _compiled: true,
22040
+ _scopeId: null,
22041
+ functional: undefined
22042
+ };
22043
+ })());
22044
+
22045
+ },{"./TableCell":"components/TableCell.vue"}],"components/CellIndicator.vue":[function(require,module,exports) {
22046
+ "use strict";
22047
+
22048
+ Object.defineProperty(exports, "__esModule", {
22049
+ value: true
22050
+ });
22051
+ exports.default = void 0;
22052
+ //
22053
+ //
22054
+ //
22055
+ //
22056
+ var _default = {
22057
+ props: {
22058
+ cell: {
22059
+ type: HTMLElement,
22060
+ default: null
22061
+ },
22062
+ repaint: {
22063
+ type: Number,
22064
+ default: 0
22065
+ }
22066
+ },
22067
+ data: function data() {
22068
+ return {
22069
+ styles: {
22070
+ top: 0,
22071
+ left: 0,
22072
+ width: 0,
22073
+ height: 0
22074
+ }
22075
+ };
22076
+ },
22077
+ watch: {
22078
+ cell: function cell() {
22079
+ this.calculatePos();
22080
+ },
22081
+ repaint: function repaint() {
22082
+ this.calculatePos();
22083
+ }
22084
+ },
22085
+ methods: {
22086
+ calculatePos: function calculatePos() {
22087
+ if (this.cell) {
22088
+ var _this$cell$getBoundin = this.cell.getBoundingClientRect(),
22089
+ x = _this$cell$getBoundin.x,
22090
+ y = _this$cell$getBoundin.y,
22091
+ width = _this$cell$getBoundin.width,
22092
+ height = _this$cell$getBoundin.height;
22093
+
22094
+ this.styles.top = "".concat(y, "px");
22095
+ this.styles.left = "".concat(x, "px");
22096
+ this.styles.width = "".concat(width, "px");
22097
+ this.styles.height = "".concat(height, "px");
22098
+ }
22099
+ }
22100
+ }
22101
+ };
22102
+ exports.default = _default;
22103
+ var $6cbad5 = exports.default || module.exports;
22104
+
22105
+ if (typeof $6cbad5 === 'function') {
22106
+ $6cbad5 = $6cbad5.options;
22107
+ }
22108
+
22109
+ /* template */
22110
+ Object.assign($6cbad5, (function () {
22111
+ var render = function() {
22112
+ var _vm = this
22113
+ var _h = _vm.$createElement
22114
+ var _c = _vm._self._c || _h
22115
+ return _vm.cell !== null
22116
+ ? _c("div", {
22117
+ staticClass: "wptb-table-cell-indicator wptb-repeating-linear-gradient",
22118
+ style: _vm.styles
22119
+ })
22120
+ : _vm._e()
22121
+ }
22122
+ var staticRenderFns = []
22123
+ render._withStripped = true
22124
+
22125
+ return {
22126
+ render: render,
22127
+ staticRenderFns: staticRenderFns,
22128
+ _compiled: true,
22129
+ _scopeId: null,
22130
+ functional: undefined
22131
+ };
22132
+ })());
22133
+
22134
+ },{}],"components/ColorPicker.vue":[function(require,module,exports) {
22135
+ "use strict";
22136
+
22137
+ Object.defineProperty(exports, "__esModule", {
22138
+ value: true
22139
+ });
22140
+ exports.default = void 0;
22141
+ //
22142
+ //
22143
+ //
22144
+ //
22145
+ //
22146
+ //
22147
+ //
22148
+ //
22149
+ //
22150
+ //
22151
+ //
22152
+ //
22153
+ //
22154
+ var _default = {
22155
+ props: {
22156
+ label: {
22157
+ type: String,
22158
+ default: 'label'
22159
+ },
22160
+ color: {
22161
+ type: String,
22162
+ default: '#000000'
22163
+ },
22164
+ disabled: {
22165
+ type: Boolean,
22166
+ default: false
22167
+ }
22168
+ },
22169
+ model: {
22170
+ prop: 'color',
22171
+ event: 'colorChanged'
22172
+ },
22173
+ data: function data() {
22174
+ return {
22175
+ innerColor: null
22176
+ };
22177
+ },
22178
+ watch: {
22179
+ color: function color(n) {
22180
+ this.innerColor = n === '' ? '#000000' : n;
22181
+ },
22182
+ innerColor: function innerColor(n) {
22183
+ this.$emit('colorChanged', n);
22184
+ }
22185
+ },
22186
+ mounted: function mounted() {
22187
+ var _this = this;
22188
+
22189
+ this.$nextTick(function () {
22190
+ _this.innerColor = _this.color;
22191
+ });
22192
+ }
22193
+ };
22194
+ exports.default = _default;
22195
+ var $91dcc2 = exports.default || module.exports;
22196
+
22197
+ if (typeof $91dcc2 === 'function') {
22198
+ $91dcc2 = $91dcc2.options;
22199
+ }
22200
+
22201
+ /* template */
22202
+ Object.assign($91dcc2, (function () {
22203
+ var render = function() {
22204
+ var _vm = this
22205
+ var _h = _vm.$createElement
22206
+ var _c = _vm._self._c || _h
22207
+ return _c(
22208
+ "div",
22209
+ {
22210
+ staticClass:
22211
+ "wptb-color-picker-wrapper wptb-settings-row wptb-settings-middle-xs wptb-element-property"
22212
+ },
22213
+ [
22214
+ _c("div", { staticClass: "wptb-settings-space-between" }, [
22215
+ _c(
22216
+ "p",
22217
+ {
22218
+ staticClass: "wptb-settings-item-title wptb-text-transform-cap",
22219
+ attrs: { "data-wptb-text-disabled": _vm.disabled }
22220
+ },
22221
+ [_vm._v("\n\t\t\t" + _vm._s(_vm.label) + "\n\t\t")]
22222
+ ),
22223
+ _vm._v(" "),
22224
+ _c("div", { staticClass: "wptb-color-picker-input-wrapper" }, [
22225
+ _c("input", {
22226
+ directives: [
22227
+ {
22228
+ name: "model",
22229
+ rawName: "v-model",
22230
+ value: _vm.innerColor,
22231
+ expression: "innerColor"
22232
+ }
22233
+ ],
22234
+ staticClass: "wptb-color-picker-input",
22235
+ attrs: { type: "color", disabled: _vm.disabled },
22236
+ domProps: { value: _vm.innerColor },
22237
+ on: {
22238
+ input: function($event) {
22239
+ if ($event.target.composing) {
22240
+ return
22241
+ }
22242
+ _vm.innerColor = $event.target.value
22243
+ }
22244
+ }
22245
+ })
22246
+ ])
22247
+ ])
22248
+ ]
22249
+ )
22250
+ }
22251
+ var staticRenderFns = []
22252
+ render._withStripped = true
22253
+
22254
+ return {
22255
+ render: render,
22256
+ staticRenderFns: staticRenderFns,
22257
+ _compiled: true,
22258
+ _scopeId: null,
22259
+ functional: undefined
22260
+ };
22261
+ })());
22262
+
22263
+ },{}],"containers/DifferentBorderControl.vue":[function(require,module,exports) {
22264
+ "use strict";
22265
+
22266
+ Object.defineProperty(exports, "__esModule", {
22267
+ value: true
22268
+ });
22269
+ exports.default = void 0;
22270
+
22271
+ var _ControlBase = _interopRequireDefault(require("../mixins/ControlBase"));
22272
+
22273
+ var _TableCellSelect = _interopRequireDefault(require("../components/TableCellSelect"));
22274
+
22275
+ var _CellIndicator = _interopRequireDefault(require("../components/CellIndicator"));
22276
+
22277
+ var _RangeInput = _interopRequireDefault(require("../components/RangeInput"));
22278
+
22279
+ var _withTranslation = _interopRequireDefault(require("../mixins/withTranslation"));
22280
+
22281
+ var _ColorPicker = _interopRequireDefault(require("../components/ColorPicker"));
22282
+
22283
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22284
+
22285
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
22286
+
22287
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22288
+
22289
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22290
+
22291
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
22292
+
22293
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
22294
+
22295
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22296
+
22297
+ var _default = {
22298
+ mixins: [_ControlBase.default, _withTranslation.default],
22299
+ components: {
22300
+ TableCellSelect: _TableCellSelect.default,
22301
+ CellIndicator: _CellIndicator.default,
22302
+ RangeInput: _RangeInput.default,
22303
+ ColorPicker: _ColorPicker.default
22304
+ },
22305
+ data: function data() {
22306
+ return {
22307
+ table: null,
22308
+ hoveredCell: null,
22309
+ selectedCell: null,
22310
+ borderProps: {
22311
+ currentBorderSize: 0,
22312
+ currentBorderColor: '#000000'
22313
+ },
22314
+ repaintId: 0,
22315
+ min: 0,
22316
+ max: 50,
22317
+ controlsActive: false
22318
+ };
22319
+ },
22320
+ watch: {
22321
+ borderProps: {
22322
+ handler: function handler(n) {
22323
+ if (this.selectedCell) {
22324
+ var _this$selectedCell$st = this.selectedCell.style,
22325
+ borderWidth = _this$selectedCell$st.borderWidth,
22326
+ borderColor = _this$selectedCell$st.borderColor;
22327
+
22328
+ if (Number.parseInt(borderWidth, 10) !== n.currentBorderSize || borderColor !== n.currentBorderColor) {
22329
+ this.selectedCell.style.borderWidth = "".concat(n.currentBorderSize, "px");
22330
+ this.selectedCell.style.borderColor = "".concat(n.currentBorderColor);
22331
+ this.repaintId += 1;
22332
+ this.setTableDirty(false);
22333
+ }
22334
+ }
22335
+ },
22336
+ deep: true
22337
+ },
22338
+ selectedCell: {
22339
+ handler: function handler(n) {
22340
+ if (n) {
22341
+ var _n$style = n.style,
22342
+ borderWidth = _n$style.borderWidth,
22343
+ borderColor = _n$style.borderColor;
22344
+ this.$set(this.borderProps, 'currentBorderSize', Number.parseInt(borderWidth, 10));
22345
+ this.$set(this.borderProps, 'currentBorderColor', this.toHex(borderColor));
22346
+ }
22347
+
22348
+ this.controlsActive = n !== null;
22349
+ },
22350
+ deep: true
22351
+ }
22352
+ },
22353
+ mounted: function mounted() {
22354
+ this.table = document.querySelector('.wptb-management_table_container .wptb-table-setup table');
22355
+ },
22356
+ methods: {
22357
+ toHex: function toHex(rgbVal) {
22358
+ if (!rgbVal.startsWith('#') && rgbVal !== '') {
22359
+ var regExp = new RegExp(/rgb\(\s?(\d{1,3}),\s?(\d{1,3}),\s?(\d{1,3})\)/);
22360
+
22361
+ if (regExp) {
22362
+ var _regExp$exec = regExp.exec(rgbVal),
22363
+ _regExp$exec2 = _slicedToArray(_regExp$exec, 4),
22364
+ red = _regExp$exec2[1],
22365
+ green = _regExp$exec2[2],
22366
+ blue = _regExp$exec2[3];
22367
+ /**
22368
+ * Transform a decimal into its hexadecimal equal.
22369
+ *
22370
+ * @param {string} val value
22371
+ * @return {string} changed hex value
22372
+ */
22373
+
22374
+
22375
+ function hexConvertor(val) {
22376
+ var hex = Number.parseInt(val, 10).toString(16);
22377
+ return hex.length === 1 ? "0".concat(hex) : hex;
22378
+ }
22379
+
22380
+ return "#".concat(hexConvertor(red)).concat(hexConvertor(green)).concat(hexConvertor(blue));
22381
+ }
22382
+ }
22383
+
22384
+ return rgbVal;
22385
+ },
22386
+ cellStyling: function cellStyling(cell) {
22387
+ var _cell$style = cell.style,
22388
+ borderWidth = _cell$style.borderWidth,
22389
+ borderStyle = _cell$style.borderStyle,
22390
+ borderColor = _cell$style.borderColor;
22391
+ return {
22392
+ borderWidth: borderWidth,
22393
+ borderStyle: borderStyle,
22394
+ borderColor: borderColor
22395
+ };
22396
+ }
22397
+ }
22398
+ };
22399
+ exports.default = _default;
22400
+ var $b2736f = exports.default || module.exports;
22401
+
22402
+ if (typeof $b2736f === 'function') {
22403
+ $b2736f = $b2736f.options;
22404
+ }
22405
+
22406
+ /* template */
22407
+ Object.assign($b2736f, (function () {
22408
+ var render = function() {
22409
+ var _vm = this
22410
+ var _h = _vm.$createElement
22411
+ var _c = _vm._self._c || _h
22412
+ return _c("transition", { attrs: { name: "wptb-fade" } }, [
22413
+ _c(
22414
+ "div",
22415
+ {
22416
+ directives: [
22417
+ {
22418
+ name: "show",
22419
+ rawName: "v-show",
22420
+ value: _vm.componentVisibility,
22421
+ expression: "componentVisibility"
22422
+ }
22423
+ ],
22424
+ staticClass:
22425
+ "wptb-settings-row wptb-settings-middle-xs wptb-different-border-control-wrapper"
22426
+ },
22427
+ [
22428
+ _c("table-cell-select", {
22429
+ attrs: {
22430
+ table: _vm.table,
22431
+ "cell-extra-styling": _vm.cellStyling,
22432
+ repaint: _vm.repaintId
22433
+ },
22434
+ model: {
22435
+ value: _vm.selectedCell,
22436
+ callback: function($$v) {
22437
+ _vm.selectedCell = $$v
22438
+ },
22439
+ expression: "selectedCell"
22440
+ }
22441
+ }),
22442
+ _vm._v(" "),
22443
+ _c("range-input", {
22444
+ staticClass: "wptb-different-border-range-input",
22445
+ attrs: {
22446
+ "post-fix": "px",
22447
+ label: _vm.translation("borderWidth"),
22448
+ min: _vm.min,
22449
+ max: _vm.max,
22450
+ disabled: !_vm.controlsActive
22451
+ },
22452
+ model: {
22453
+ value: _vm.borderProps.currentBorderSize,
22454
+ callback: function($$v) {
22455
+ _vm.$set(_vm.borderProps, "currentBorderSize", $$v)
22456
+ },
22457
+ expression: "borderProps.currentBorderSize"
22458
+ }
22459
+ }),
22460
+ _vm._v(" "),
22461
+ _c("cell-indicator", {
22462
+ attrs: { repaint: _vm.repaintId, cell: _vm.selectedCell }
22463
+ }),
22464
+ _vm._v(" "),
22465
+ _c("color-picker", {
22466
+ attrs: {
22467
+ label: _vm.translation("borderColor"),
22468
+ disabled: !_vm.controlsActive
22469
+ },
22470
+ model: {
22471
+ value: _vm.borderProps.currentBorderColor,
22472
+ callback: function($$v) {
22473
+ _vm.$set(_vm.borderProps, "currentBorderColor", $$v)
22474
+ },
22475
+ expression: "borderProps.currentBorderColor"
22476
+ }
22477
+ })
22478
+ ],
22479
+ 1
22480
+ )
22481
+ ])
22482
+ }
22483
+ var staticRenderFns = []
22484
+ render._withStripped = true
22485
+
22486
+ return {
22487
+ render: render,
22488
+ staticRenderFns: staticRenderFns,
22489
+ _compiled: true,
22490
+ _scopeId: null,
22491
+ functional: undefined
22492
+ };
22493
+ })());
22494
+
22495
+ },{"../mixins/ControlBase":"mixins/ControlBase.js","../components/TableCellSelect":"components/TableCellSelect.vue","../components/CellIndicator":"components/CellIndicator.vue","../components/RangeInput":"components/RangeInput.vue","../mixins/withTranslation":"mixins/withTranslation.js","../components/ColorPicker":"components/ColorPicker.vue"}],"mountPoints/WPTB_DifferentBorderControl.js":[function(require,module,exports) {
22496
+ "use strict";
22497
+
22498
+ Object.defineProperty(exports, "__esModule", {
22499
+ value: true
22500
+ });
22501
+ exports.default = void 0;
22502
+
22503
+ var _vue = _interopRequireDefault(require("vue"));
22504
+
22505
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
22506
+
22507
+ var _DifferentBorderControl = _interopRequireDefault(require("../containers/DifferentBorderControl"));
22508
+
22509
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22510
+
22511
+ /**
22512
+ * Different border control.
22513
+ */
22514
+ // eslint-disable-next-line camelcase
22515
+ var _default = {
22516
+ name: 'ControlDifferentBorder',
22517
+ handler: function differentBorderControlJS(uniqueId) {
22518
+ var data = _WPTB_ControlsManager.default.getControlData(uniqueId);
22519
+
22520
+ new _vue.default({
22521
+ data: data,
22522
+ components: {
22523
+ DifferentBorderControl: _DifferentBorderControl.default
22524
+ }
22525
+ }).$mount("#".concat(uniqueId));
22526
+ }
22527
+ };
22528
+ exports.default = _default;
22529
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js","../containers/DifferentBorderControl":"containers/DifferentBorderControl.vue"}],"components/MenuButton.vue":[function(require,module,exports) {
22530
+ "use strict";
22531
+
22532
+ Object.defineProperty(exports, "__esModule", {
22533
+ value: true
22534
+ });
22535
+ exports.default = void 0;
22536
+ //
22537
+ //
22538
+ //
22539
+ //
22540
+ //
22541
+ //
22542
+ var _default = {
22543
+ props: {
22544
+ disabled: Boolean,
22545
+ type: {
22546
+ type: String,
22547
+ default: 'primary'
22548
+ },
22549
+ size: {
22550
+ type: String,
22551
+ default: 'normal'
22552
+ }
22553
+ },
22554
+ methods: {
22555
+ /**
22556
+ * Click event callback
22557
+ */
22558
+ handleClick: function handleClick() {
22559
+ if (!this.disabled) {
22560
+ this.$emit('click');
22561
+ }
22562
+ }
22563
+ }
22564
+ };
22565
+ exports.default = _default;
22566
+ var $358d10 = exports.default || module.exports;
22567
+
22568
+ if (typeof $358d10 === 'function') {
22569
+ $358d10 = $358d10.options;
22570
+ }
22571
+
22572
+ /* template */
22573
+ Object.assign($358d10, (function () {
22574
+ var render = function() {
22575
+ var _vm = this
22576
+ var _h = _vm.$createElement
22577
+ var _c = _vm._self._c || _h
22578
+ return _c(
22579
+ "div",
22580
+ {
22581
+ staticClass: "wptb-settings-button",
22582
+ class: [{ disabled: _vm.disabled }, _vm.type, _vm.size],
22583
+ on: { click: _vm.handleClick }
22584
+ },
22585
+ [_vm._t("default")],
22586
+ 2
22587
+ )
22588
+ }
22589
+ var staticRenderFns = []
22590
+ render._withStripped = true
22591
+
22592
+ return {
22593
+ render: render,
22594
+ staticRenderFns: staticRenderFns,
22595
+ _compiled: true,
22596
+ _scopeId: null,
22597
+ functional: undefined
22598
+ };
22599
+ })());
22600
+
22601
+ },{}],"components/LocalImageCard.vue":[function(require,module,exports) {
22602
+ "use strict";
22603
+
22604
+ Object.defineProperty(exports, "__esModule", {
22605
+ value: true
22606
+ });
22607
+ exports.default = void 0;
22608
+ //
22609
+ //
22610
+ //
22611
+ //
22612
+ //
22613
+ //
22614
+ //
22615
+ //
22616
+ //
22617
+ //
22618
+ //
22619
+ var _default = {
22620
+ props: {
22621
+ name: {
22622
+ type: String,
22623
+ default: 'image name'
22624
+ },
22625
+ url: {
22626
+ type: String,
22627
+ default: ''
22628
+ },
22629
+ activeCard: {
22630
+ type: String,
22631
+ default: null
22632
+ }
22633
+ },
22634
+ computed: {
22635
+ isSelectedCard: function isSelectedCard() {
22636
+ return this.name === this.activeCard;
22637
+ }
22638
+ },
22639
+ methods: {
22640
+ handleCardClick: function handleCardClick() {
22641
+ this.$emit('cardSelected', this.name, this.url);
22642
+ }
22643
+ }
22644
+ };
22645
+ exports.default = _default;
22646
+ var $1e0810 = exports.default || module.exports;
22647
+
22648
+ if (typeof $1e0810 === 'function') {
22649
+ $1e0810 = $1e0810.options;
22650
+ }
22651
+
22652
+ /* template */
22653
+ Object.assign($1e0810, (function () {
22654
+ var render = function() {
22655
+ var _vm = this
22656
+ var _h = _vm.$createElement
22657
+ var _c = _vm._self._c || _h
22658
+ return _c(
22659
+ "div",
22660
+ {
22661
+ staticClass: "wptb-local-dev-image-card",
22662
+ attrs: { "data-active": _vm.isSelectedCard },
22663
+ on: {
22664
+ "!click": function($event) {
22665
+ $event.preventDefault()
22666
+ $event.stopPropagation()
22667
+ return _vm.handleCardClick($event)
22668
+ }
22669
+ }
22670
+ },
22671
+ [
22672
+ _c("div", { staticClass: "wptb-local-dev-image-holder" }, [
22673
+ _c("img", { attrs: { src: _vm.url } })
22674
+ ]),
22675
+ _vm._v(" "),
22676
+ _c("div", { staticClass: "wptb-local-dev-image-name" }, [
22677
+ _vm._v("\n\t\t" + _vm._s(_vm.name) + "\n\t")
22678
+ ])
22679
+ ]
22680
+ )
22681
+ }
22682
+ var staticRenderFns = []
22683
+ render._withStripped = true
22684
+
22685
+ return {
22686
+ render: render,
22687
+ staticRenderFns: staticRenderFns,
22688
+ _compiled: true,
22689
+ _scopeId: null,
22690
+ functional: undefined
22691
+ };
22692
+ })());
22693
+
22694
+ },{}],"components/EmptyCover.vue":[function(require,module,exports) {
22695
+
22696
+ var $9b2461 = exports.default || module.exports;
22697
+
22698
+ if (typeof $9b2461 === 'function') {
22699
+ $9b2461 = $9b2461.options;
22700
+ }
22701
+
22702
+ /* template */
22703
+ Object.assign($9b2461, (function () {
22704
+ var render = function() {
22705
+ var _vm = this
22706
+ var _h = _vm.$createElement
22707
+ var _c = _vm._self._c || _h
22708
+ return _c(
22709
+ "div",
22710
+ { staticClass: "wptb-menu-empty-cover" },
22711
+ [_vm._t("default")],
22712
+ 2
22713
+ )
22714
+ }
22715
+ var staticRenderFns = []
22716
+ render._withStripped = true
22717
+
22718
+ return {
22719
+ render: render,
22720
+ staticRenderFns: staticRenderFns,
22721
+ _compiled: true,
22722
+ _scopeId: null,
22723
+ functional: undefined
22724
+ };
22725
+ })());
22726
+
22727
+ },{}],"containers/LocalDevFileControl.vue":[function(require,module,exports) {
22728
+ "use strict";
22729
+
22730
+ Object.defineProperty(exports, "__esModule", {
22731
+ value: true
22732
+ });
22733
+ exports.default = void 0;
22734
+
22735
+ var _ControlBase = _interopRequireDefault(require("../mixins/ControlBase"));
22736
+
22737
+ var _MenuButton = _interopRequireDefault(require("../components/MenuButton"));
22738
+
22739
+ var _LocalImageCard = _interopRequireDefault(require("../components/LocalImageCard"));
22740
+
22741
+ var _EmptyCover = _interopRequireDefault(require("../components/EmptyCover"));
22742
+
22743
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22744
+
22745
+ //
22746
+ //
22747
+ //
22748
+ //
22749
+ //
22750
+ //
22751
+ //
22752
+ //
22753
+ //
22754
+ //
22755
+ //
22756
+ //
22757
+ //
22758
+ //
22759
+ //
22760
+ //
22761
+ //
22762
+ //
22763
+ //
22764
+ //
22765
+ //
22766
+ //
22767
+ //
22768
+ //
22769
+ //
22770
+ //
22771
+ //
22772
+ //
22773
+ //
22774
+ //
22775
+ //
22776
+ //
22777
+ //
22778
+ //
22779
+ //
22780
+ //
22781
+ //
22782
+ //
22783
+ //
22784
+ //
22785
+ //
22786
+ //
22787
+ //
22788
+ //
22789
+ var _default = {
22790
+ components: {
22791
+ EmptyCover: _EmptyCover.default,
22792
+ LocalImageCard: _LocalImageCard.default,
22793
+ MenuButton: _MenuButton.default
22794
+ },
22795
+ mixins: [_ControlBase.default],
22796
+ props: {
22797
+ images: {
22798
+ type: null,
22799
+ default: function _default() {
22800
+ return {};
22801
+ }
22802
+ },
22803
+ security: {
22804
+ type: Object,
22805
+ default: function _default() {
22806
+ return {};
22807
+ }
22808
+ }
22809
+ },
22810
+ data: function data() {
22811
+ return {
22812
+ frameOpenStatus: false,
22813
+ innerImages: [],
22814
+ selectedCard: {
22815
+ name: null,
22816
+ url: null
22817
+ },
22818
+ cardLimbo: {
22819
+ name: null,
22820
+ url: null
22821
+ },
22822
+ assignDefaultValueAtMount: true,
22823
+ mutationObserver: null,
22824
+ fetching: false
22825
+ };
22826
+ },
22827
+ watch: {
22828
+ elementMainValue: function elementMainValue(n) {
22829
+ this.basicValueUpdate(n, true);
22830
+ this.selectedCard.name = n;
22831
+ this.selectedCard.url = this.getImageUrl(n);
22832
+ },
22833
+ selectedCard: {
22834
+ handler: function handler(n) {
22835
+ this.elementMainValue = n.name;
22836
+ this.cardLimbo.name = n.name;
22837
+ this.cardLimbo.url = this.getImageUrl(n.name);
22838
+ this.selectedCard.url = this.getImageUrl(n.name);
22839
+ this.setTargetImage(this.selectedCard.url);
22840
+ },
22841
+ deep: true
22842
+ },
22843
+ frameOpenStatus: function frameOpenStatus(n) {
22844
+ var _this = this;
22845
+
22846
+ if (n) {
22847
+ document.addEventListener('keydown', function (e) {
22848
+ if (e.code === 'Escape') {
22849
+ _this.setFrameOpenStatus(false);
22850
+ }
22851
+ });
22852
+ }
22853
+ }
22854
+ },
22855
+ mounted: function mounted() {
22856
+ var _this2 = this;
22857
+
22858
+ this.$nextTick(function () {
22859
+ _this2.innerImages = _this2.images;
22860
+ var imageElement = document.querySelector(".".concat(_this2.elemContainer)); // observe image element src changes since button control don't fire necessary global events to track with WPTB_Helper.controlsInclude
22861
+
22862
+ _this2.mutationObserver = new MutationObserver(_this2.mutationCallback);
22863
+
22864
+ _this2.mutationObserver.observe(imageElement, {
22865
+ attributes: true,
22866
+ childList: true,
22867
+ subtree: true
22868
+ });
22869
+ });
22870
+ },
22871
+ beforeDestroy: function beforeDestroy() {
22872
+ if (this.mutationObserver) {
22873
+ this.mutationObserver.disconnect();
22874
+ }
22875
+ },
22876
+ computed: {
22877
+ isImagesEmpty: function isImagesEmpty() {
22878
+ var _this3 = this;
22879
+
22880
+ return !Object.keys(this.innerImages).filter(function (e) {
22881
+ return Object.prototype.hasOwnProperty.call(_this3.innerImages, e);
22882
+ }).length > 0;
22883
+ }
22884
+ },
22885
+ methods: {
22886
+ getLocalImages: function getLocalImages() {
22887
+ var _this4 = this;
22888
+
22889
+ var ajaxUrl = new URL(this.security.ajaxUrl);
22890
+ ajaxUrl.searchParams.append('nonce', this.security.nonce);
22891
+ ajaxUrl.searchParams.append('action', this.security.action);
22892
+ this.fetching = true;
22893
+ fetch(ajaxUrl.toString()) // eslint-disable-next-line consistent-return
22894
+ .then(function (r) {
22895
+ if (r.ok) {
22896
+ return r.json();
22897
+ }
22898
+
22899
+ throw new Error('an error occured');
22900
+ }).then(function (resp) {
22901
+ if (resp.error) {
22902
+ throw new Error(resp.error);
22903
+ }
22904
+
22905
+ _this4.innerImages = resp.data.images;
22906
+ }).catch(function (err) {
22907
+ console.error(err);
22908
+ }).finally(function () {
22909
+ _this4.fetching = false;
22910
+ });
22911
+ },
22912
+ mutationCallback: function mutationCallback(mutations) {
22913
+ var _this5 = this;
22914
+
22915
+ // eslint-disable-next-line array-callback-return
22916
+ Array.from(mutations).map(function (m) {
22917
+ if (m.target && m.target.nodeName === 'IMG' && m.attributeName === 'src') {
22918
+ if (m.target.getAttribute('src') !== _this5.selectedCard.url) {
22919
+ _this5.resetSelectedLocalFile();
22920
+ }
22921
+ }
22922
+ });
22923
+ },
22924
+ resetSelectedLocalFile: function resetSelectedLocalFile() {
22925
+ this.selectedCard.name = '';
22926
+ this.selectedCard.url = '';
22927
+ },
22928
+ setFrameOpenStatus: function setFrameOpenStatus(val) {
22929
+ this.frameOpenStatus = val;
22930
+ },
22931
+ handleCardSelect: function handleCardSelect(name, url) {
22932
+ this.cardLimbo.name = name;
22933
+ this.cardLimbo.url = url;
22934
+ },
22935
+ handleSelectButton: function handleSelectButton() {
22936
+ this.selectedCard.name = this.cardLimbo.name;
22937
+ this.selectedCard.url = this.cardLimbo.url;
22938
+ this.setFrameOpenStatus(false);
22939
+ },
22940
+ getImageUrl: function getImageUrl(name) {
22941
+ var url = null;
22942
+
22943
+ if (this.innerImages[name]) {
22944
+ url = this.innerImages[name];
22945
+ }
22946
+
22947
+ return url;
22948
+ },
22949
+ setTargetImage: function setTargetImage(url) {
22950
+ if (url !== null && url !== '') {
22951
+ // eslint-disable-next-line array-callback-return
22952
+ this.targetElements.map(function (elObject) {
22953
+ // eslint-disable-next-line array-callback-return
22954
+ elObject.elements.map(function (el) {
22955
+ // remove placeholder class else img will not be visible at frontend
22956
+ el.classList.remove('wptb-elem-placeholder');
22957
+ var img = el.querySelector('img');
22958
+
22959
+ if (!img) {
22960
+ img = document.createElement('img');
22961
+ var imageWrapper = el.querySelector('.wptb-image-wrapper a');
22962
+ imageWrapper.innerHTML = '';
22963
+ imageWrapper.appendChild(img);
22964
+ }
22965
+
22966
+ img.setAttribute('src', url);
22967
+ img.setAttribute('width', 'auto');
22968
+ img.setAttribute('height', 'auto');
22969
+ });
22970
+ });
22971
+ }
22972
+ }
22973
+ }
22974
+ };
22975
+ exports.default = _default;
22976
+ var $2d8a80 = exports.default || module.exports;
22977
+
22978
+ if (typeof $2d8a80 === 'function') {
22979
+ $2d8a80 = $2d8a80.options;
22980
+ }
22981
+
22982
+ /* template */
22983
+ Object.assign($2d8a80, (function () {
22984
+ var render = function() {
22985
+ var _vm = this
22986
+ var _h = _vm.$createElement
22987
+ var _c = _vm._self._c || _h
22988
+ return _c(
22989
+ "div",
22990
+ {
22991
+ staticClass:
22992
+ "wptb-settings-row wptb-settings-middle-xs wptb-plugin-width-full wptb-flex wptb-justify-content-center"
22993
+ },
22994
+ [
22995
+ _c(
22996
+ "menu-button",
22997
+ {
22998
+ on: {
22999
+ click: function($event) {
23000
+ return _vm.setFrameOpenStatus(true)
23001
+ }
23002
+ }
23003
+ },
23004
+ [_vm._v("\n\t\tPlugin Local Images\n\t")]
23005
+ ),
23006
+ _vm._v(" "),
23007
+ _c("transition", { attrs: { name: "wptb-fade" } }, [
23008
+ _vm.frameOpenStatus
23009
+ ? _c("div", { staticClass: "wptb-local-dev-file-chooser" }, [
23010
+ _c("div", { staticClass: "wptb-local-dev-modal" }, [
23011
+ _c("div", { staticClass: "wptb-local-dev-modal-header" }, [
23012
+ _c("div", { staticClass: "wptb-local-dev-modal-title" }, [
23013
+ _vm._v("\n\t\t\t\t\t\tPlugin Images\n\t\t\t\t\t")
23014
+ ]),
23015
+ _vm._v(" "),
23016
+ _c(
23017
+ "div",
23018
+ {
23019
+ staticClass: "wptb-local-dev-modal-close",
23020
+ on: {
23021
+ click: function($event) {
23022
+ $event.preventDefault()
23023
+ return _vm.setFrameOpenStatus(false)
23024
+ }
23025
+ }
23026
+ },
23027
+ [_vm._v("\n\t\t\t\t\t\tX\n\t\t\t\t\t")]
23028
+ )
23029
+ ]),
23030
+ _vm._v(" "),
23031
+ _c(
23032
+ "div",
23033
+ { staticClass: "wptb-local-dev-modal-files" },
23034
+ [
23035
+ _vm._l(_vm.innerImages, function(url, name) {
23036
+ return _c("local-image-card", {
23037
+ key: url,
23038
+ attrs: {
23039
+ name: name,
23040
+ url: url,
23041
+ "active-card": _vm.cardLimbo.name
23042
+ },
23043
+ on: { cardSelected: _vm.handleCardSelect }
23044
+ })
23045
+ }),
23046
+ _vm._v(" "),
23047
+ _vm.isImagesEmpty
23048
+ ? _c("empty-cover", [
23049
+ _vm._v(
23050
+ "\n\t\t\t\t\t\tno plugin images found...\n\t\t\t\t\t"
23051
+ )
23052
+ ])
23053
+ : _vm._e(),
23054
+ _vm._v(" "),
23055
+ _vm.fetching
23056
+ ? _c(
23057
+ "empty-cover",
23058
+ {
23059
+ staticStyle: {
23060
+ color: "red",
23061
+ "background-color": "rgba(0, 0, 0, 0.4)"
23062
+ }
23063
+ },
23064
+ [
23065
+ _vm._v(
23066
+ "\n\t\t\t\t\t\tfetching images...\n\t\t\t\t\t"
23067
+ )
23068
+ ]
23069
+ )
23070
+ : _vm._e()
23071
+ ],
23072
+ 2
23073
+ ),
23074
+ _vm._v(" "),
23075
+ _c(
23076
+ "div",
23077
+ { staticClass: "wptb-local-dev-modal-footer" },
23078
+ [
23079
+ _c(
23080
+ "menu-button",
23081
+ {
23082
+ attrs: { disabled: _vm.fetching },
23083
+ on: { click: _vm.getLocalImages }
23084
+ },
23085
+ [_vm._v("refresh")]
23086
+ ),
23087
+ _vm._v(" "),
23088
+ _c(
23089
+ "menu-button",
23090
+ {
23091
+ attrs: { disabled: _vm.fetching },
23092
+ on: { click: _vm.handleSelectButton }
23093
+ },
23094
+ [_vm._v("select")]
23095
+ )
23096
+ ],
23097
+ 1
23098
+ )
23099
+ ])
23100
+ ])
23101
+ : _vm._e()
23102
+ ])
23103
+ ],
23104
+ 1
23105
+ )
23106
+ }
23107
+ var staticRenderFns = []
23108
+ render._withStripped = true
23109
+
23110
+ return {
23111
+ render: render,
23112
+ staticRenderFns: staticRenderFns,
23113
+ _compiled: true,
23114
+ _scopeId: null,
23115
+ functional: undefined
23116
+ };
23117
+ })());
23118
+
23119
+ },{"../mixins/ControlBase":"mixins/ControlBase.js","../components/MenuButton":"components/MenuButton.vue","../components/LocalImageCard":"components/LocalImageCard.vue","../components/EmptyCover":"components/EmptyCover.vue"}],"mountPoints/WPTB_LocalDevFileControl.js":[function(require,module,exports) {
23120
+ "use strict";
23121
+
23122
+ Object.defineProperty(exports, "__esModule", {
23123
+ value: true
23124
+ });
23125
+ exports.default = void 0;
23126
+
23127
+ var _vue = _interopRequireDefault(require("vue"));
23128
+
23129
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
23130
+
23131
+ var _LocalDevFileControl = _interopRequireDefault(require("../containers/LocalDevFileControl"));
23132
+
23133
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23134
+
23135
+ /**
23136
+ * Local files for development
23137
+ */
23138
+ // eslint-disable-next-line camelcase
23139
+ var _default = {
23140
+ name: 'ControlLocalDevFile',
23141
+ handler: function localDevFileControlJS(uniqueId) {
23142
+ var data = _WPTB_ControlsManager.default.getControlData(uniqueId);
23143
+
23144
+ new _vue.default({
23145
+ data: data,
23146
+ components: {
23147
+ LocalDevFileControl: _LocalDevFileControl.default
23148
+ }
23149
+ }).$mount("#".concat(uniqueId));
23150
+ }
23151
+ };
23152
+ exports.default = _default;
23153
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js","../containers/LocalDevFileControl":"containers/LocalDevFileControl.vue"}],"../../../../../node_modules/vuex/dist/vuex.esm.js":[function(require,module,exports) {
23154
+ var global = arguments[3];
23155
+ "use strict";
23156
+
23157
+ Object.defineProperty(exports, "__esModule", {
23158
+ value: true
23159
+ });
23160
+ exports.createLogger = createLogger;
23161
+ exports.install = install;
23162
+ exports.mapState = exports.mapMutations = exports.mapGetters = exports.mapActions = exports.createNamespacedHelpers = exports.Store = exports.default = void 0;
23163
+
23164
+ /*!
23165
+ * vuex v3.5.1
23166
+ * (c) 2020 Evan You
23167
+ * @license MIT
23168
+ */
23169
+ function applyMixin(Vue) {
23170
+ var version = Number(Vue.version.split('.')[0]);
23171
+
23172
+ if (version >= 2) {
23173
+ Vue.mixin({
23174
+ beforeCreate: vuexInit
23175
+ });
23176
+ } else {
23177
+ // override init and inject vuex init procedure
23178
+ // for 1.x backwards compatibility.
23179
+ var _init = Vue.prototype._init;
23180
+
23181
+ Vue.prototype._init = function (options) {
23182
+ if (options === void 0) options = {};
23183
+ options.init = options.init ? [vuexInit].concat(options.init) : vuexInit;
23184
+
23185
+ _init.call(this, options);
23186
+ };
23187
+ }
23188
+ /**
23189
+ * Vuex init hook, injected into each instances init hooks list.
23190
+ */
23191
+
23192
+
23193
+ function vuexInit() {
23194
+ var options = this.$options; // store injection
23195
+
23196
+ if (options.store) {
23197
+ this.$store = typeof options.store === 'function' ? options.store() : options.store;
23198
+ } else if (options.parent && options.parent.$store) {
23199
+ this.$store = options.parent.$store;
23200
+ }
23201
+ }
23202
+ }
23203
+
23204
+ var target = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
23205
+ var devtoolHook = target.__VUE_DEVTOOLS_GLOBAL_HOOK__;
23206
+
23207
+ function devtoolPlugin(store) {
23208
+ if (!devtoolHook) {
23209
+ return;
23210
+ }
23211
+
23212
+ store._devtoolHook = devtoolHook;
23213
+ devtoolHook.emit('vuex:init', store);
23214
+ devtoolHook.on('vuex:travel-to-state', function (targetState) {
23215
+ store.replaceState(targetState);
23216
+ });
23217
+ store.subscribe(function (mutation, state) {
23218
+ devtoolHook.emit('vuex:mutation', mutation, state);
23219
+ }, {
23220
+ prepend: true
23221
+ });
23222
+ store.subscribeAction(function (action, state) {
23223
+ devtoolHook.emit('vuex:action', action, state);
23224
+ }, {
23225
+ prepend: true
23226
+ });
23227
+ }
23228
+ /**
23229
+ * Get the first item that pass the test
23230
+ * by second argument function
23231
+ *
23232
+ * @param {Array} list
23233
+ * @param {Function} f
23234
+ * @return {*}
23235
+ */
23236
+
23237
+
23238
+ function find(list, f) {
23239
+ return list.filter(f)[0];
23240
+ }
23241
+ /**
23242
+ * Deep copy the given object considering circular structure.
23243
+ * This function caches all nested objects and its copies.
23244
+ * If it detects circular structure, use cached copy to avoid infinite loop.
23245
+ *
23246
+ * @param {*} obj
23247
+ * @param {Array<Object>} cache
23248
+ * @return {*}
23249
+ */
23250
+
23251
+
23252
+ function deepCopy(obj, cache) {
23253
+ if (cache === void 0) cache = []; // just return if obj is immutable value
23254
+
23255
+ if (obj === null || typeof obj !== 'object') {
23256
+ return obj;
23257
+ } // if obj is hit, it is in circular structure
23258
+
23259
+
23260
+ var hit = find(cache, function (c) {
23261
+ return c.original === obj;
23262
+ });
23263
+
23264
+ if (hit) {
23265
+ return hit.copy;
23266
+ }
23267
+
23268
+ var copy = Array.isArray(obj) ? [] : {}; // put the copy into cache at first
23269
+ // because we want to refer it in recursive deepCopy
23270
+
23271
+ cache.push({
23272
+ original: obj,
23273
+ copy: copy
23274
+ });
23275
+ Object.keys(obj).forEach(function (key) {
23276
+ copy[key] = deepCopy(obj[key], cache);
23277
+ });
23278
+ return copy;
23279
+ }
23280
+ /**
23281
+ * forEach for object
23282
+ */
23283
+
23284
+
23285
+ function forEachValue(obj, fn) {
23286
+ Object.keys(obj).forEach(function (key) {
23287
+ return fn(obj[key], key);
23288
+ });
23289
+ }
23290
+
23291
+ function isObject(obj) {
23292
+ return obj !== null && typeof obj === 'object';
23293
+ }
23294
+
23295
+ function isPromise(val) {
23296
+ return val && typeof val.then === 'function';
23297
+ }
23298
+
23299
+ function assert(condition, msg) {
23300
+ if (!condition) {
23301
+ throw new Error("[vuex] " + msg);
23302
+ }
23303
+ }
23304
+
23305
+ function partial(fn, arg) {
23306
+ return function () {
23307
+ return fn(arg);
23308
+ };
23309
+ } // Base data struct for store's module, package with some attribute and method
23310
+
23311
+
23312
+ var Module = function Module(rawModule, runtime) {
23313
+ this.runtime = runtime; // Store some children item
23314
+
23315
+ this._children = Object.create(null); // Store the origin module object which passed by programmer
23316
+
23317
+ this._rawModule = rawModule;
23318
+ var rawState = rawModule.state; // Store the origin module's state
23319
+
23320
+ this.state = (typeof rawState === 'function' ? rawState() : rawState) || {};
23321
+ };
23322
+
23323
+ var prototypeAccessors = {
23324
+ namespaced: {
23325
+ configurable: true
23326
+ }
23327
+ };
23328
+
23329
+ prototypeAccessors.namespaced.get = function () {
23330
+ return !!this._rawModule.namespaced;
23331
+ };
23332
+
23333
+ Module.prototype.addChild = function addChild(key, module) {
23334
+ this._children[key] = module;
23335
+ };
23336
+
23337
+ Module.prototype.removeChild = function removeChild(key) {
23338
+ delete this._children[key];
23339
+ };
23340
+
23341
+ Module.prototype.getChild = function getChild(key) {
23342
+ return this._children[key];
23343
+ };
23344
+
23345
+ Module.prototype.hasChild = function hasChild(key) {
23346
+ return key in this._children;
23347
+ };
23348
+
23349
+ Module.prototype.update = function update(rawModule) {
23350
+ this._rawModule.namespaced = rawModule.namespaced;
23351
+
23352
+ if (rawModule.actions) {
23353
+ this._rawModule.actions = rawModule.actions;
23354
+ }
23355
+
23356
+ if (rawModule.mutations) {
23357
+ this._rawModule.mutations = rawModule.mutations;
23358
+ }
23359
+
23360
+ if (rawModule.getters) {
23361
+ this._rawModule.getters = rawModule.getters;
23362
+ }
23363
+ };
23364
+
23365
+ Module.prototype.forEachChild = function forEachChild(fn) {
23366
+ forEachValue(this._children, fn);
23367
+ };
23368
+
23369
+ Module.prototype.forEachGetter = function forEachGetter(fn) {
23370
+ if (this._rawModule.getters) {
23371
+ forEachValue(this._rawModule.getters, fn);
23372
+ }
23373
+ };
23374
+
23375
+ Module.prototype.forEachAction = function forEachAction(fn) {
23376
+ if (this._rawModule.actions) {
23377
+ forEachValue(this._rawModule.actions, fn);
23378
+ }
23379
+ };
23380
+
23381
+ Module.prototype.forEachMutation = function forEachMutation(fn) {
23382
+ if (this._rawModule.mutations) {
23383
+ forEachValue(this._rawModule.mutations, fn);
23384
+ }
23385
+ };
23386
+
23387
+ Object.defineProperties(Module.prototype, prototypeAccessors);
23388
+
23389
+ var ModuleCollection = function ModuleCollection(rawRootModule) {
23390
+ // register root module (Vuex.Store options)
23391
+ this.register([], rawRootModule, false);
23392
+ };
23393
+
23394
+ ModuleCollection.prototype.get = function get(path) {
23395
+ return path.reduce(function (module, key) {
23396
+ return module.getChild(key);
23397
+ }, this.root);
23398
+ };
23399
+
23400
+ ModuleCollection.prototype.getNamespace = function getNamespace(path) {
23401
+ var module = this.root;
23402
+ return path.reduce(function (namespace, key) {
23403
+ module = module.getChild(key);
23404
+ return namespace + (module.namespaced ? key + '/' : '');
23405
+ }, '');
23406
+ };
23407
+
23408
+ ModuleCollection.prototype.update = function update$1(rawRootModule) {
23409
+ update([], this.root, rawRootModule);
23410
+ };
23411
+
23412
+ ModuleCollection.prototype.register = function register(path, rawModule, runtime) {
23413
+ var this$1 = this;
23414
+ if (runtime === void 0) runtime = true;
23415
+
23416
+ if ("development" !== 'production') {
23417
+ assertRawModule(path, rawModule);
23418
+ }
23419
+
23420
+ var newModule = new Module(rawModule, runtime);
23421
+
23422
+ if (path.length === 0) {
23423
+ this.root = newModule;
23424
+ } else {
23425
+ var parent = this.get(path.slice(0, -1));
23426
+ parent.addChild(path[path.length - 1], newModule);
23427
+ } // register nested modules
23428
+
23429
+
23430
+ if (rawModule.modules) {
23431
+ forEachValue(rawModule.modules, function (rawChildModule, key) {
23432
+ this$1.register(path.concat(key), rawChildModule, runtime);
23433
+ });
23434
+ }
23435
+ };
23436
+
23437
+ ModuleCollection.prototype.unregister = function unregister(path) {
23438
+ var parent = this.get(path.slice(0, -1));
23439
+ var key = path[path.length - 1];
23440
+ var child = parent.getChild(key);
23441
+
23442
+ if (!child) {
23443
+ if ("development" !== 'production') {
23444
+ console.warn("[vuex] trying to unregister module '" + key + "', which is " + "not registered");
23445
+ }
23446
+
23447
+ return;
23448
+ }
23449
+
23450
+ if (!child.runtime) {
23451
+ return;
23452
+ }
23453
+
23454
+ parent.removeChild(key);
23455
+ };
23456
+
23457
+ ModuleCollection.prototype.isRegistered = function isRegistered(path) {
23458
+ var parent = this.get(path.slice(0, -1));
23459
+ var key = path[path.length - 1];
23460
+ return parent.hasChild(key);
23461
+ };
23462
+
23463
+ function update(path, targetModule, newModule) {
23464
+ if ("development" !== 'production') {
23465
+ assertRawModule(path, newModule);
23466
+ } // update target module
23467
+
23468
+
23469
+ targetModule.update(newModule); // update nested modules
23470
+
23471
+ if (newModule.modules) {
23472
+ for (var key in newModule.modules) {
23473
+ if (!targetModule.getChild(key)) {
23474
+ if ("development" !== 'production') {
23475
+ console.warn("[vuex] trying to add a new module '" + key + "' on hot reloading, " + 'manual reload is needed');
23476
+ }
23477
+
23478
+ return;
23479
+ }
23480
+
23481
+ update(path.concat(key), targetModule.getChild(key), newModule.modules[key]);
23482
+ }
23483
+ }
23484
+ }
23485
+
23486
+ var functionAssert = {
23487
+ assert: function (value) {
23488
+ return typeof value === 'function';
23489
+ },
23490
+ expected: 'function'
23491
+ };
23492
+ var objectAssert = {
23493
+ assert: function (value) {
23494
+ return typeof value === 'function' || typeof value === 'object' && typeof value.handler === 'function';
23495
+ },
23496
+ expected: 'function or object with "handler" function'
23497
+ };
23498
+ var assertTypes = {
23499
+ getters: functionAssert,
23500
+ mutations: functionAssert,
23501
+ actions: objectAssert
23502
+ };
23503
+
23504
+ function assertRawModule(path, rawModule) {
23505
+ Object.keys(assertTypes).forEach(function (key) {
23506
+ if (!rawModule[key]) {
23507
+ return;
23508
+ }
23509
+
23510
+ var assertOptions = assertTypes[key];
23511
+ forEachValue(rawModule[key], function (value, type) {
23512
+ assert(assertOptions.assert(value), makeAssertionMessage(path, key, type, value, assertOptions.expected));
23513
+ });
23514
+ });
23515
+ }
23516
+
23517
+ function makeAssertionMessage(path, key, type, value, expected) {
23518
+ var buf = key + " should be " + expected + " but \"" + key + "." + type + "\"";
23519
+
23520
+ if (path.length > 0) {
23521
+ buf += " in module \"" + path.join('.') + "\"";
23522
+ }
23523
+
23524
+ buf += " is " + JSON.stringify(value) + ".";
23525
+ return buf;
23526
+ }
23527
+
23528
+ var Vue; // bind on install
23529
+
23530
+ var Store = function Store(options) {
23531
+ var this$1 = this;
23532
+ if (options === void 0) options = {}; // Auto install if it is not done yet and `window` has `Vue`.
23533
+ // To allow users to avoid auto-installation in some cases,
23534
+ // this code should be placed here. See #731
23535
+
23536
+ if (!Vue && typeof window !== 'undefined' && window.Vue) {
23537
+ install(window.Vue);
23538
+ }
23539
+
23540
+ if ("development" !== 'production') {
23541
+ assert(Vue, "must call Vue.use(Vuex) before creating a store instance.");
23542
+ assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.");
23543
+ assert(this instanceof Store, "store must be called with the new operator.");
23544
+ }
23545
+
23546
+ var plugins = options.plugins;
23547
+ if (plugins === void 0) plugins = [];
23548
+ var strict = options.strict;
23549
+ if (strict === void 0) strict = false; // store internal state
23550
+
23551
+ this._committing = false;
23552
+ this._actions = Object.create(null);
23553
+ this._actionSubscribers = [];
23554
+ this._mutations = Object.create(null);
23555
+ this._wrappedGetters = Object.create(null);
23556
+ this._modules = new ModuleCollection(options);
23557
+ this._modulesNamespaceMap = Object.create(null);
23558
+ this._subscribers = [];
23559
+ this._watcherVM = new Vue();
23560
+ this._makeLocalGettersCache = Object.create(null); // bind commit and dispatch to self
23561
+
23562
+ var store = this;
23563
+ var ref = this;
23564
+ var dispatch = ref.dispatch;
23565
+ var commit = ref.commit;
23566
+
23567
+ this.dispatch = function boundDispatch(type, payload) {
23568
+ return dispatch.call(store, type, payload);
23569
+ };
23570
+
23571
+ this.commit = function boundCommit(type, payload, options) {
23572
+ return commit.call(store, type, payload, options);
23573
+ }; // strict mode
23574
+
23575
+
23576
+ this.strict = strict;
23577
+ var state = this._modules.root.state; // init root module.
23578
+ // this also recursively registers all sub-modules
23579
+ // and collects all module getters inside this._wrappedGetters
23580
+
23581
+ installModule(this, state, [], this._modules.root); // initialize the store vm, which is responsible for the reactivity
23582
+ // (also registers _wrappedGetters as computed properties)
23583
+
23584
+ resetStoreVM(this, state); // apply plugins
23585
+
23586
+ plugins.forEach(function (plugin) {
23587
+ return plugin(this$1);
23588
+ });
23589
+ var useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools;
23590
+
23591
+ if (useDevtools) {
23592
+ devtoolPlugin(this);
23593
+ }
23594
+ };
23595
+
23596
+ exports.Store = Store;
23597
+ var prototypeAccessors$1 = {
23598
+ state: {
23599
+ configurable: true
23600
+ }
23601
+ };
23602
+
23603
+ prototypeAccessors$1.state.get = function () {
23604
+ return this._vm._data.$$state;
23605
+ };
23606
+
23607
+ prototypeAccessors$1.state.set = function (v) {
23608
+ if ("development" !== 'production') {
23609
+ assert(false, "use store.replaceState() to explicit replace store state.");
23610
+ }
23611
+ };
23612
+
23613
+ Store.prototype.commit = function commit(_type, _payload, _options) {
23614
+ var this$1 = this; // check object-style commit
23615
+
23616
+ var ref = unifyObjectStyle(_type, _payload, _options);
23617
+ var type = ref.type;
23618
+ var payload = ref.payload;
23619
+ var options = ref.options;
23620
+ var mutation = {
23621
+ type: type,
23622
+ payload: payload
23623
+ };
23624
+ var entry = this._mutations[type];
23625
+
23626
+ if (!entry) {
23627
+ if ("development" !== 'production') {
23628
+ console.error("[vuex] unknown mutation type: " + type);
23629
+ }
23630
+
23631
+ return;
23632
+ }
23633
+
23634
+ this._withCommit(function () {
23635
+ entry.forEach(function commitIterator(handler) {
23636
+ handler(payload);
23637
+ });
23638
+ });
23639
+
23640
+ this._subscribers.slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
23641
+ .forEach(function (sub) {
23642
+ return sub(mutation, this$1.state);
23643
+ });
23644
+
23645
+ if ("development" !== 'production' && options && options.silent) {
23646
+ console.warn("[vuex] mutation type: " + type + ". Silent option has been removed. " + 'Use the filter functionality in the vue-devtools');
23647
+ }
23648
+ };
23649
+
23650
+ Store.prototype.dispatch = function dispatch(_type, _payload) {
23651
+ var this$1 = this; // check object-style dispatch
23652
+
23653
+ var ref = unifyObjectStyle(_type, _payload);
23654
+ var type = ref.type;
23655
+ var payload = ref.payload;
23656
+ var action = {
23657
+ type: type,
23658
+ payload: payload
23659
+ };
23660
+ var entry = this._actions[type];
23661
+
23662
+ if (!entry) {
23663
+ if ("development" !== 'production') {
23664
+ console.error("[vuex] unknown action type: " + type);
23665
+ }
23666
+
23667
+ return;
23668
+ }
23669
+
23670
+ try {
23671
+ this._actionSubscribers.slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
23672
+ .filter(function (sub) {
23673
+ return sub.before;
23674
+ }).forEach(function (sub) {
23675
+ return sub.before(action, this$1.state);
23676
+ });
23677
+ } catch (e) {
23678
+ if ("development" !== 'production') {
23679
+ console.warn("[vuex] error in before action subscribers: ");
23680
+ console.error(e);
23681
+ }
23682
+ }
23683
+
23684
+ var result = entry.length > 1 ? Promise.all(entry.map(function (handler) {
23685
+ return handler(payload);
23686
+ })) : entry[0](payload);
23687
+ return new Promise(function (resolve, reject) {
23688
+ result.then(function (res) {
23689
+ try {
23690
+ this$1._actionSubscribers.filter(function (sub) {
23691
+ return sub.after;
23692
+ }).forEach(function (sub) {
23693
+ return sub.after(action, this$1.state);
23694
+ });
23695
+ } catch (e) {
23696
+ if ("development" !== 'production') {
23697
+ console.warn("[vuex] error in after action subscribers: ");
23698
+ console.error(e);
23699
+ }
23700
+ }
23701
+
23702
+ resolve(res);
23703
+ }, function (error) {
23704
+ try {
23705
+ this$1._actionSubscribers.filter(function (sub) {
23706
+ return sub.error;
23707
+ }).forEach(function (sub) {
23708
+ return sub.error(action, this$1.state, error);
23709
+ });
23710
+ } catch (e) {
23711
+ if ("development" !== 'production') {
23712
+ console.warn("[vuex] error in error action subscribers: ");
23713
+ console.error(e);
23714
+ }
23715
+ }
23716
+
23717
+ reject(error);
23718
+ });
23719
+ });
23720
+ };
23721
+
23722
+ Store.prototype.subscribe = function subscribe(fn, options) {
23723
+ return genericSubscribe(fn, this._subscribers, options);
23724
+ };
23725
+
23726
+ Store.prototype.subscribeAction = function subscribeAction(fn, options) {
23727
+ var subs = typeof fn === 'function' ? {
23728
+ before: fn
23729
+ } : fn;
23730
+ return genericSubscribe(subs, this._actionSubscribers, options);
23731
+ };
23732
+
23733
+ Store.prototype.watch = function watch(getter, cb, options) {
23734
+ var this$1 = this;
23735
+
23736
+ if ("development" !== 'production') {
23737
+ assert(typeof getter === 'function', "store.watch only accepts a function.");
23738
+ }
23739
+
23740
+ return this._watcherVM.$watch(function () {
23741
+ return getter(this$1.state, this$1.getters);
23742
+ }, cb, options);
23743
+ };
23744
+
23745
+ Store.prototype.replaceState = function replaceState(state) {
23746
+ var this$1 = this;
23747
+
23748
+ this._withCommit(function () {
23749
+ this$1._vm._data.$$state = state;
23750
+ });
23751
+ };
23752
+
23753
+ Store.prototype.registerModule = function registerModule(path, rawModule, options) {
23754
+ if (options === void 0) options = {};
23755
+
23756
+ if (typeof path === 'string') {
23757
+ path = [path];
23758
+ }
23759
+
23760
+ if ("development" !== 'production') {
23761
+ assert(Array.isArray(path), "module path must be a string or an Array.");
23762
+ assert(path.length > 0, 'cannot register the root module by using registerModule.');
23763
+ }
23764
+
23765
+ this._modules.register(path, rawModule);
23766
+
23767
+ installModule(this, this.state, path, this._modules.get(path), options.preserveState); // reset store to update getters...
23768
+
23769
+ resetStoreVM(this, this.state);
23770
+ };
23771
+
23772
+ Store.prototype.unregisterModule = function unregisterModule(path) {
23773
+ var this$1 = this;
23774
+
23775
+ if (typeof path === 'string') {
23776
+ path = [path];
23777
+ }
23778
+
23779
+ if ("development" !== 'production') {
23780
+ assert(Array.isArray(path), "module path must be a string or an Array.");
23781
+ }
23782
+
23783
+ this._modules.unregister(path);
23784
+
23785
+ this._withCommit(function () {
23786
+ var parentState = getNestedState(this$1.state, path.slice(0, -1));
23787
+ Vue.delete(parentState, path[path.length - 1]);
23788
+ });
23789
+
23790
+ resetStore(this);
23791
+ };
23792
+
23793
+ Store.prototype.hasModule = function hasModule(path) {
23794
+ if (typeof path === 'string') {
23795
+ path = [path];
23796
+ }
23797
+
23798
+ if ("development" !== 'production') {
23799
+ assert(Array.isArray(path), "module path must be a string or an Array.");
23800
+ }
23801
+
23802
+ return this._modules.isRegistered(path);
23803
+ };
23804
+
23805
+ Store.prototype.hotUpdate = function hotUpdate(newOptions) {
23806
+ this._modules.update(newOptions);
23807
+
23808
+ resetStore(this, true);
23809
+ };
23810
+
23811
+ Store.prototype._withCommit = function _withCommit(fn) {
23812
+ var committing = this._committing;
23813
+ this._committing = true;
23814
+ fn();
23815
+ this._committing = committing;
23816
+ };
23817
+
23818
+ Object.defineProperties(Store.prototype, prototypeAccessors$1);
23819
+
23820
+ function genericSubscribe(fn, subs, options) {
23821
+ if (subs.indexOf(fn) < 0) {
23822
+ options && options.prepend ? subs.unshift(fn) : subs.push(fn);
23823
+ }
23824
+
23825
+ return function () {
23826
+ var i = subs.indexOf(fn);
23827
+
23828
+ if (i > -1) {
23829
+ subs.splice(i, 1);
23830
+ }
23831
+ };
23832
+ }
23833
+
23834
+ function resetStore(store, hot) {
23835
+ store._actions = Object.create(null);
23836
+ store._mutations = Object.create(null);
23837
+ store._wrappedGetters = Object.create(null);
23838
+ store._modulesNamespaceMap = Object.create(null);
23839
+ var state = store.state; // init all modules
23840
+
23841
+ installModule(store, state, [], store._modules.root, true); // reset vm
23842
+
23843
+ resetStoreVM(store, state, hot);
23844
+ }
23845
+
23846
+ function resetStoreVM(store, state, hot) {
23847
+ var oldVm = store._vm; // bind store public getters
23848
+
23849
+ store.getters = {}; // reset local getters cache
23850
+
23851
+ store._makeLocalGettersCache = Object.create(null);
23852
+ var wrappedGetters = store._wrappedGetters;
23853
+ var computed = {};
23854
+ forEachValue(wrappedGetters, function (fn, key) {
23855
+ // use computed to leverage its lazy-caching mechanism
23856
+ // direct inline function use will lead to closure preserving oldVm.
23857
+ // using partial to return function with only arguments preserved in closure environment.
23858
+ computed[key] = partial(fn, store);
23859
+ Object.defineProperty(store.getters, key, {
23860
+ get: function () {
23861
+ return store._vm[key];
23862
+ },
23863
+ enumerable: true // for local getters
23864
+
23865
+ });
23866
+ }); // use a Vue instance to store the state tree
23867
+ // suppress warnings just in case the user has added
23868
+ // some funky global mixins
23869
+
23870
+ var silent = Vue.config.silent;
23871
+ Vue.config.silent = true;
23872
+ store._vm = new Vue({
23873
+ data: {
23874
+ $$state: state
23875
+ },
23876
+ computed: computed
23877
+ });
23878
+ Vue.config.silent = silent; // enable strict mode for new vm
23879
+
23880
+ if (store.strict) {
23881
+ enableStrictMode(store);
23882
+ }
23883
+
23884
+ if (oldVm) {
23885
+ if (hot) {
23886
+ // dispatch changes in all subscribed watchers
23887
+ // to force getter re-evaluation for hot reloading.
23888
+ store._withCommit(function () {
23889
+ oldVm._data.$$state = null;
23890
+ });
23891
+ }
23892
+
23893
+ Vue.nextTick(function () {
23894
+ return oldVm.$destroy();
23895
+ });
23896
+ }
23897
+ }
23898
+
23899
+ function installModule(store, rootState, path, module, hot) {
23900
+ var isRoot = !path.length;
23901
+
23902
+ var namespace = store._modules.getNamespace(path); // register in namespace map
23903
+
23904
+
23905
+ if (module.namespaced) {
23906
+ if (store._modulesNamespaceMap[namespace] && "development" !== 'production') {
23907
+ console.error("[vuex] duplicate namespace " + namespace + " for the namespaced module " + path.join('/'));
23908
+ }
23909
+
23910
+ store._modulesNamespaceMap[namespace] = module;
23911
+ } // set state
23912
+
23913
+
23914
+ if (!isRoot && !hot) {
23915
+ var parentState = getNestedState(rootState, path.slice(0, -1));
23916
+ var moduleName = path[path.length - 1];
23917
+
23918
+ store._withCommit(function () {
23919
+ if ("development" !== 'production') {
23920
+ if (moduleName in parentState) {
23921
+ console.warn("[vuex] state field \"" + moduleName + "\" was overridden by a module with the same name at \"" + path.join('.') + "\"");
23922
+ }
23923
+ }
23924
+
23925
+ Vue.set(parentState, moduleName, module.state);
23926
+ });
23927
+ }
23928
+
23929
+ var local = module.context = makeLocalContext(store, namespace, path);
23930
+ module.forEachMutation(function (mutation, key) {
23931
+ var namespacedType = namespace + key;
23932
+ registerMutation(store, namespacedType, mutation, local);
23933
+ });
23934
+ module.forEachAction(function (action, key) {
23935
+ var type = action.root ? key : namespace + key;
23936
+ var handler = action.handler || action;
23937
+ registerAction(store, type, handler, local);
23938
+ });
23939
+ module.forEachGetter(function (getter, key) {
23940
+ var namespacedType = namespace + key;
23941
+ registerGetter(store, namespacedType, getter, local);
23942
+ });
23943
+ module.forEachChild(function (child, key) {
23944
+ installModule(store, rootState, path.concat(key), child, hot);
23945
+ });
23946
+ }
23947
+ /**
23948
+ * make localized dispatch, commit, getters and state
23949
+ * if there is no namespace, just use root ones
23950
+ */
23951
+
23952
+
23953
+ function makeLocalContext(store, namespace, path) {
23954
+ var noNamespace = namespace === '';
23955
+ var local = {
23956
+ dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {
23957
+ var args = unifyObjectStyle(_type, _payload, _options);
23958
+ var payload = args.payload;
23959
+ var options = args.options;
23960
+ var type = args.type;
23961
+
23962
+ if (!options || !options.root) {
23963
+ type = namespace + type;
23964
+
23965
+ if ("development" !== 'production' && !store._actions[type]) {
23966
+ console.error("[vuex] unknown local action type: " + args.type + ", global type: " + type);
23967
+ return;
23968
+ }
23969
+ }
23970
+
23971
+ return store.dispatch(type, payload);
23972
+ },
23973
+ commit: noNamespace ? store.commit : function (_type, _payload, _options) {
23974
+ var args = unifyObjectStyle(_type, _payload, _options);
23975
+ var payload = args.payload;
23976
+ var options = args.options;
23977
+ var type = args.type;
23978
+
23979
+ if (!options || !options.root) {
23980
+ type = namespace + type;
23981
+
23982
+ if ("development" !== 'production' && !store._mutations[type]) {
23983
+ console.error("[vuex] unknown local mutation type: " + args.type + ", global type: " + type);
23984
+ return;
23985
+ }
23986
+ }
23987
+
23988
+ store.commit(type, payload, options);
23989
+ }
23990
+ }; // getters and state object must be gotten lazily
23991
+ // because they will be changed by vm update
23992
+
23993
+ Object.defineProperties(local, {
23994
+ getters: {
23995
+ get: noNamespace ? function () {
23996
+ return store.getters;
23997
+ } : function () {
23998
+ return makeLocalGetters(store, namespace);
23999
+ }
24000
+ },
24001
+ state: {
24002
+ get: function () {
24003
+ return getNestedState(store.state, path);
24004
+ }
24005
+ }
24006
+ });
24007
+ return local;
24008
+ }
24009
+
24010
+ function makeLocalGetters(store, namespace) {
24011
+ if (!store._makeLocalGettersCache[namespace]) {
24012
+ var gettersProxy = {};
24013
+ var splitPos = namespace.length;
24014
+ Object.keys(store.getters).forEach(function (type) {
24015
+ // skip if the target getter is not match this namespace
24016
+ if (type.slice(0, splitPos) !== namespace) {
24017
+ return;
24018
+ } // extract local getter type
24019
+
24020
+
24021
+ var localType = type.slice(splitPos); // Add a port to the getters proxy.
24022
+ // Define as getter property because
24023
+ // we do not want to evaluate the getters in this time.
24024
+
24025
+ Object.defineProperty(gettersProxy, localType, {
24026
+ get: function () {
24027
+ return store.getters[type];
24028
+ },
24029
+ enumerable: true
24030
+ });
24031
+ });
24032
+ store._makeLocalGettersCache[namespace] = gettersProxy;
24033
+ }
24034
+
24035
+ return store._makeLocalGettersCache[namespace];
24036
+ }
24037
+
24038
+ function registerMutation(store, type, handler, local) {
24039
+ var entry = store._mutations[type] || (store._mutations[type] = []);
24040
+ entry.push(function wrappedMutationHandler(payload) {
24041
+ handler.call(store, local.state, payload);
24042
+ });
24043
+ }
24044
+
24045
+ function registerAction(store, type, handler, local) {
24046
+ var entry = store._actions[type] || (store._actions[type] = []);
24047
+ entry.push(function wrappedActionHandler(payload) {
24048
+ var res = handler.call(store, {
24049
+ dispatch: local.dispatch,
24050
+ commit: local.commit,
24051
+ getters: local.getters,
24052
+ state: local.state,
24053
+ rootGetters: store.getters,
24054
+ rootState: store.state
24055
+ }, payload);
24056
+
24057
+ if (!isPromise(res)) {
24058
+ res = Promise.resolve(res);
24059
+ }
24060
+
24061
+ if (store._devtoolHook) {
24062
+ return res.catch(function (err) {
24063
+ store._devtoolHook.emit('vuex:error', err);
24064
+
24065
+ throw err;
24066
+ });
24067
+ } else {
24068
+ return res;
24069
+ }
24070
+ });
24071
+ }
24072
+
24073
+ function registerGetter(store, type, rawGetter, local) {
24074
+ if (store._wrappedGetters[type]) {
24075
+ if ("development" !== 'production') {
24076
+ console.error("[vuex] duplicate getter key: " + type);
24077
+ }
24078
+
24079
+ return;
24080
+ }
24081
+
24082
+ store._wrappedGetters[type] = function wrappedGetter(store) {
24083
+ return rawGetter(local.state, // local state
24084
+ local.getters, // local getters
24085
+ store.state, // root state
24086
+ store.getters // root getters
24087
+ );
24088
+ };
24089
+ }
24090
+
24091
+ function enableStrictMode(store) {
24092
+ store._vm.$watch(function () {
24093
+ return this._data.$$state;
24094
+ }, function () {
24095
+ if ("development" !== 'production') {
24096
+ assert(store._committing, "do not mutate vuex store state outside mutation handlers.");
24097
+ }
24098
+ }, {
24099
+ deep: true,
24100
+ sync: true
24101
+ });
24102
+ }
24103
+
24104
+ function getNestedState(state, path) {
24105
+ return path.reduce(function (state, key) {
24106
+ return state[key];
24107
+ }, state);
24108
+ }
24109
+
24110
+ function unifyObjectStyle(type, payload, options) {
24111
+ if (isObject(type) && type.type) {
24112
+ options = payload;
24113
+ payload = type;
24114
+ type = type.type;
24115
+ }
24116
+
24117
+ if ("development" !== 'production') {
24118
+ assert(typeof type === 'string', "expects string as the type, but found " + typeof type + ".");
24119
+ }
24120
+
24121
+ return {
24122
+ type: type,
24123
+ payload: payload,
24124
+ options: options
24125
+ };
24126
+ }
24127
+
24128
+ function install(_Vue) {
24129
+ if (Vue && _Vue === Vue) {
24130
+ if ("development" !== 'production') {
24131
+ console.error('[vuex] already installed. Vue.use(Vuex) should be called only once.');
24132
+ }
24133
+
24134
+ return;
24135
+ }
24136
+
24137
+ Vue = _Vue;
24138
+ applyMixin(Vue);
24139
+ }
24140
+ /**
24141
+ * Reduce the code which written in Vue.js for getting the state.
24142
+ * @param {String} [namespace] - Module's namespace
24143
+ * @param {Object|Array} states # Object's item can be a function which accept state and getters for param, you can do something for state and getters in it.
24144
+ * @param {Object}
24145
+ */
24146
+
24147
+
24148
+ var mapState = normalizeNamespace(function (namespace, states) {
24149
+ var res = {};
24150
+
24151
+ if ("development" !== 'production' && !isValidMap(states)) {
24152
+ console.error('[vuex] mapState: mapper parameter must be either an Array or an Object');
24153
+ }
24154
+
24155
+ normalizeMap(states).forEach(function (ref) {
24156
+ var key = ref.key;
24157
+ var val = ref.val;
24158
+
24159
+ res[key] = function mappedState() {
24160
+ var state = this.$store.state;
24161
+ var getters = this.$store.getters;
24162
+
24163
+ if (namespace) {
24164
+ var module = getModuleByNamespace(this.$store, 'mapState', namespace);
24165
+
24166
+ if (!module) {
24167
+ return;
24168
+ }
24169
+
24170
+ state = module.context.state;
24171
+ getters = module.context.getters;
24172
+ }
24173
+
24174
+ return typeof val === 'function' ? val.call(this, state, getters) : state[val];
24175
+ }; // mark vuex getter for devtools
24176
+
24177
+
24178
+ res[key].vuex = true;
24179
+ });
24180
+ return res;
24181
+ });
24182
+ /**
24183
+ * Reduce the code which written in Vue.js for committing the mutation
24184
+ * @param {String} [namespace] - Module's namespace
24185
+ * @param {Object|Array} mutations # Object's item can be a function which accept `commit` function as the first param, it can accept anthor params. You can commit mutation and do any other things in this function. specially, You need to pass anthor params from the mapped function.
24186
+ * @return {Object}
24187
+ */
24188
+
24189
+ exports.mapState = mapState;
24190
+ var mapMutations = normalizeNamespace(function (namespace, mutations) {
24191
+ var res = {};
24192
+
24193
+ if ("development" !== 'production' && !isValidMap(mutations)) {
24194
+ console.error('[vuex] mapMutations: mapper parameter must be either an Array or an Object');
24195
+ }
24196
+
24197
+ normalizeMap(mutations).forEach(function (ref) {
24198
+ var key = ref.key;
24199
+ var val = ref.val;
24200
+
24201
+ res[key] = function mappedMutation() {
24202
+ var args = [],
24203
+ len = arguments.length;
24204
+
24205
+ while (len--) args[len] = arguments[len]; // Get the commit method from store
24206
+
24207
+
24208
+ var commit = this.$store.commit;
24209
+
24210
+ if (namespace) {
24211
+ var module = getModuleByNamespace(this.$store, 'mapMutations', namespace);
24212
+
24213
+ if (!module) {
24214
+ return;
24215
+ }
24216
+
24217
+ commit = module.context.commit;
24218
+ }
24219
+
24220
+ return typeof val === 'function' ? val.apply(this, [commit].concat(args)) : commit.apply(this.$store, [val].concat(args));
24221
+ };
24222
+ });
24223
+ return res;
24224
+ });
24225
+ /**
24226
+ * Reduce the code which written in Vue.js for getting the getters
24227
+ * @param {String} [namespace] - Module's namespace
24228
+ * @param {Object|Array} getters
24229
+ * @return {Object}
24230
+ */
24231
+
24232
+ exports.mapMutations = mapMutations;
24233
+ var mapGetters = normalizeNamespace(function (namespace, getters) {
24234
+ var res = {};
24235
+
24236
+ if ("development" !== 'production' && !isValidMap(getters)) {
24237
+ console.error('[vuex] mapGetters: mapper parameter must be either an Array or an Object');
24238
+ }
24239
+
24240
+ normalizeMap(getters).forEach(function (ref) {
24241
+ var key = ref.key;
24242
+ var val = ref.val; // The namespace has been mutated by normalizeNamespace
24243
+
24244
+ val = namespace + val;
24245
+
24246
+ res[key] = function mappedGetter() {
24247
+ if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) {
24248
+ return;
24249
+ }
24250
+
24251
+ if ("development" !== 'production' && !(val in this.$store.getters)) {
24252
+ console.error("[vuex] unknown getter: " + val);
24253
+ return;
24254
+ }
24255
+
24256
+ return this.$store.getters[val];
24257
+ }; // mark vuex getter for devtools
24258
+
24259
+
24260
+ res[key].vuex = true;
24261
+ });
24262
+ return res;
24263
+ });
24264
+ /**
24265
+ * Reduce the code which written in Vue.js for dispatch the action
24266
+ * @param {String} [namespace] - Module's namespace
24267
+ * @param {Object|Array} actions # Object's item can be a function which accept `dispatch` function as the first param, it can accept anthor params. You can dispatch action and do any other things in this function. specially, You need to pass anthor params from the mapped function.
24268
+ * @return {Object}
24269
+ */
24270
+
24271
+ exports.mapGetters = mapGetters;
24272
+ var mapActions = normalizeNamespace(function (namespace, actions) {
24273
+ var res = {};
24274
+
24275
+ if ("development" !== 'production' && !isValidMap(actions)) {
24276
+ console.error('[vuex] mapActions: mapper parameter must be either an Array or an Object');
24277
+ }
24278
+
24279
+ normalizeMap(actions).forEach(function (ref) {
24280
+ var key = ref.key;
24281
+ var val = ref.val;
24282
+
24283
+ res[key] = function mappedAction() {
24284
+ var args = [],
24285
+ len = arguments.length;
24286
+
24287
+ while (len--) args[len] = arguments[len]; // get dispatch function from store
24288
+
24289
+
24290
+ var dispatch = this.$store.dispatch;
24291
+
24292
+ if (namespace) {
24293
+ var module = getModuleByNamespace(this.$store, 'mapActions', namespace);
24294
+
24295
+ if (!module) {
24296
+ return;
24297
+ }
24298
+
24299
+ dispatch = module.context.dispatch;
24300
+ }
24301
+
24302
+ return typeof val === 'function' ? val.apply(this, [dispatch].concat(args)) : dispatch.apply(this.$store, [val].concat(args));
24303
+ };
24304
+ });
24305
+ return res;
24306
+ });
24307
+ /**
24308
+ * Rebinding namespace param for mapXXX function in special scoped, and return them by simple object
24309
+ * @param {String} namespace
24310
+ * @return {Object}
24311
+ */
24312
+
24313
+ exports.mapActions = mapActions;
24314
+
24315
+ var createNamespacedHelpers = function (namespace) {
24316
+ return {
24317
+ mapState: mapState.bind(null, namespace),
24318
+ mapGetters: mapGetters.bind(null, namespace),
24319
+ mapMutations: mapMutations.bind(null, namespace),
24320
+ mapActions: mapActions.bind(null, namespace)
24321
+ };
24322
+ };
24323
+ /**
24324
+ * Normalize the map
24325
+ * normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]
24326
+ * normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ]
24327
+ * @param {Array|Object} map
24328
+ * @return {Object}
24329
+ */
24330
+
24331
+
24332
+ exports.createNamespacedHelpers = createNamespacedHelpers;
24333
+
24334
+ function normalizeMap(map) {
24335
+ if (!isValidMap(map)) {
24336
+ return [];
24337
+ }
24338
+
24339
+ return Array.isArray(map) ? map.map(function (key) {
24340
+ return {
24341
+ key: key,
24342
+ val: key
24343
+ };
24344
+ }) : Object.keys(map).map(function (key) {
24345
+ return {
24346
+ key: key,
24347
+ val: map[key]
24348
+ };
24349
+ });
24350
+ }
24351
+ /**
24352
+ * Validate whether given map is valid or not
24353
+ * @param {*} map
24354
+ * @return {Boolean}
24355
+ */
24356
+
24357
+
24358
+ function isValidMap(map) {
24359
+ return Array.isArray(map) || isObject(map);
24360
+ }
24361
+ /**
24362
+ * Return a function expect two param contains namespace and map. it will normalize the namespace and then the param's function will handle the new namespace and the map.
24363
+ * @param {Function} fn
24364
+ * @return {Function}
24365
+ */
24366
+
24367
+
24368
+ function normalizeNamespace(fn) {
24369
+ return function (namespace, map) {
24370
+ if (typeof namespace !== 'string') {
24371
+ map = namespace;
24372
+ namespace = '';
24373
+ } else if (namespace.charAt(namespace.length - 1) !== '/') {
24374
+ namespace += '/';
24375
+ }
24376
+
24377
+ return fn(namespace, map);
24378
+ };
24379
+ }
24380
+ /**
24381
+ * Search a special module from store by namespace. if module not exist, print error message.
24382
+ * @param {Object} store
24383
+ * @param {String} helper
24384
+ * @param {String} namespace
24385
+ * @return {Object}
24386
+ */
24387
+
24388
+
24389
+ function getModuleByNamespace(store, helper, namespace) {
24390
+ var module = store._modulesNamespaceMap[namespace];
24391
+
24392
+ if ("development" !== 'production' && !module) {
24393
+ console.error("[vuex] module namespace not found in " + helper + "(): " + namespace);
24394
+ }
24395
+
24396
+ return module;
24397
+ } // Credits: borrowed code from fcomb/redux-logger
24398
+
24399
+
24400
+ function createLogger(ref) {
24401
+ if (ref === void 0) ref = {};
24402
+ var collapsed = ref.collapsed;
24403
+ if (collapsed === void 0) collapsed = true;
24404
+ var filter = ref.filter;
24405
+ if (filter === void 0) filter = function (mutation, stateBefore, stateAfter) {
24406
+ return true;
24407
+ };
24408
+ var transformer = ref.transformer;
24409
+ if (transformer === void 0) transformer = function (state) {
24410
+ return state;
24411
+ };
24412
+ var mutationTransformer = ref.mutationTransformer;
24413
+ if (mutationTransformer === void 0) mutationTransformer = function (mut) {
24414
+ return mut;
24415
+ };
24416
+ var actionFilter = ref.actionFilter;
24417
+ if (actionFilter === void 0) actionFilter = function (action, state) {
24418
+ return true;
24419
+ };
24420
+ var actionTransformer = ref.actionTransformer;
24421
+ if (actionTransformer === void 0) actionTransformer = function (act) {
24422
+ return act;
24423
+ };
24424
+ var logMutations = ref.logMutations;
24425
+ if (logMutations === void 0) logMutations = true;
24426
+ var logActions = ref.logActions;
24427
+ if (logActions === void 0) logActions = true;
24428
+ var logger = ref.logger;
24429
+ if (logger === void 0) logger = console;
24430
+ return function (store) {
24431
+ var prevState = deepCopy(store.state);
24432
+
24433
+ if (typeof logger === 'undefined') {
24434
+ return;
24435
+ }
24436
+
24437
+ if (logMutations) {
24438
+ store.subscribe(function (mutation, state) {
24439
+ var nextState = deepCopy(state);
24440
+
24441
+ if (filter(mutation, prevState, nextState)) {
24442
+ var formattedTime = getFormattedTime();
24443
+ var formattedMutation = mutationTransformer(mutation);
24444
+ var message = "mutation " + mutation.type + formattedTime;
24445
+ startMessage(logger, message, collapsed);
24446
+ logger.log('%c prev state', 'color: #9E9E9E; font-weight: bold', transformer(prevState));
24447
+ logger.log('%c mutation', 'color: #03A9F4; font-weight: bold', formattedMutation);
24448
+ logger.log('%c next state', 'color: #4CAF50; font-weight: bold', transformer(nextState));
24449
+ endMessage(logger);
24450
+ }
24451
+
24452
+ prevState = nextState;
24453
+ });
24454
+ }
24455
+
24456
+ if (logActions) {
24457
+ store.subscribeAction(function (action, state) {
24458
+ if (actionFilter(action, state)) {
24459
+ var formattedTime = getFormattedTime();
24460
+ var formattedAction = actionTransformer(action);
24461
+ var message = "action " + action.type + formattedTime;
24462
+ startMessage(logger, message, collapsed);
24463
+ logger.log('%c action', 'color: #03A9F4; font-weight: bold', formattedAction);
24464
+ endMessage(logger);
24465
+ }
24466
+ });
24467
+ }
24468
+ };
24469
+ }
24470
+
24471
+ function startMessage(logger, message, collapsed) {
24472
+ var startMessage = collapsed ? logger.groupCollapsed : logger.group; // render
24473
+
24474
+ try {
24475
+ startMessage.call(logger, message);
24476
+ } catch (e) {
24477
+ logger.log(message);
24478
+ }
24479
+ }
24480
+
24481
+ function endMessage(logger) {
24482
+ try {
24483
+ logger.groupEnd();
24484
+ } catch (e) {
24485
+ logger.log('—— log end ——');
24486
+ }
24487
+ }
24488
+
24489
+ function getFormattedTime() {
24490
+ var time = new Date();
24491
+ return " @ " + pad(time.getHours(), 2) + ":" + pad(time.getMinutes(), 2) + ":" + pad(time.getSeconds(), 2) + "." + pad(time.getMilliseconds(), 3);
24492
+ }
24493
+
24494
+ function repeat(str, times) {
24495
+ return new Array(times + 1).join(str);
24496
+ }
24497
+
24498
+ function pad(num, maxLength) {
24499
+ return repeat('0', maxLength - num.toString().length) + num;
24500
+ }
24501
+
24502
+ var index = {
24503
+ Store: Store,
24504
+ install: install,
24505
+ version: '3.5.1',
24506
+ mapState: mapState,
24507
+ mapMutations: mapMutations,
24508
+ mapGetters: mapGetters,
24509
+ mapActions: mapActions,
24510
+ createNamespacedHelpers: createNamespacedHelpers,
24511
+ createLogger: createLogger
24512
+ };
24513
+ var _default = index;
24514
+ exports.default = _default;
24515
+ },{}],"components/Notification.vue":[function(require,module,exports) {
24516
+ "use strict";
24517
+
24518
+ Object.defineProperty(exports, "__esModule", {
24519
+ value: true
24520
+ });
24521
+ exports.default = void 0;
24522
+
24523
+ var _vuex = require("vuex");
24524
+
24525
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
24526
+
24527
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
24528
+
24529
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24530
+
24531
+ var _default = {
24532
+ props: {
24533
+ id: {
24534
+ type: Number,
24535
+ default: 0
24536
+ },
24537
+ message: {
24538
+ type: String,
24539
+ default: 'Default notification message'
24540
+ },
24541
+ type: {
24542
+ type: String,
24543
+ default: 'normal'
24544
+ },
24545
+ queue: {
24546
+ type: String,
24547
+ default: 'wait'
24548
+ },
24549
+ reveal: {
24550
+ type: String,
24551
+ default: 'full'
24552
+ },
24553
+ dismiss: {
24554
+ type: String,
24555
+ default: 'timed'
24556
+ }
24557
+ },
24558
+ data: function data() {
24559
+ return {
24560
+ colors: {
24561
+ ok: getComputedStyle(document.documentElement).getPropertyValue('--wptb-plugin-green-500'),
24562
+ info: getComputedStyle(document.documentElement).getPropertyValue('--wptb-plugin-yellow-500'),
24563
+ error: getComputedStyle(document.documentElement).getPropertyValue('--wptb-plugin-red-600'),
24564
+ pro: getComputedStyle(document.documentElement).getPropertyValue('--wptb-plugin-logo-color')
24565
+ },
24566
+ fullyRevealed: false,
24567
+ lengthRepaint: 0,
24568
+ timeoutId: null
24569
+ };
24570
+ },
24571
+ watch: {
24572
+ fullyRevealed: function fullyRevealed(n) {
24573
+ var _this = this;
24574
+
24575
+ if (n && this.dismiss === 'timed') {
24576
+ setTimeout(function () {
24577
+ _this.slideBack();
24578
+ }, this.autoDismissTime);
24579
+ }
24580
+ },
24581
+ queueLength: function queueLength() {
24582
+ this.lengthRepaint += 1;
24583
+ }
24584
+ },
24585
+ mounted: function mounted() {
24586
+ var _this2 = this;
24587
+
24588
+ this.$nextTick(function () {
24589
+ // eslint-disable-next-line no-unused-expressions
24590
+ _this2.reveal === 'full' ? _this2.slideFull(true) : _this2.slideIcon(true);
24591
+ });
24592
+ },
24593
+ computed: _objectSpread(_objectSpread({
24594
+ style: function style() {
24595
+ var colorToUse = this.colors[this.type] || this.colors.ok;
24596
+ return {
24597
+ filler: {
24598
+ borderColor: colorToUse
24599
+ },
24600
+ icon: {
24601
+ backgroundColor: colorToUse,
24602
+ color: '#FFFFFF'
24603
+ },
24604
+ message: {
24605
+ borderColor: colorToUse
24606
+ },
24607
+ length: {
24608
+ backgroundColor: colorToUse
24609
+ }
24610
+ };
24611
+ },
24612
+ queueLengthVisibility: function queueLengthVisibility() {
24613
+ return this.queue === 'wait' && this.queueLength > 0;
24614
+ }
24615
+ }, (0, _vuex.mapState)(['icons', 'autoDismissTime'])), (0, _vuex.mapGetters)(['queueLength'])),
24616
+ methods: _objectSpread(_objectSpread({}, (0, _vuex.mapActions)(['removeNotification'])), {}, {
24617
+ slideBase: function slideBase(amount) {
24618
+ var _this3 = this;
24619
+
24620
+ var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
24621
+ return new Promise(function (resolve) {
24622
+ _this3.timeoutId = setTimeout(function () {
24623
+ if (_this3.$refs.wrapper) {
24624
+ _this3.$refs.wrapper.style.transition = 'all 0.3s ease-out';
24625
+ _this3.$refs.wrapper.style.transform = "translateX(calc( ".concat(direction ? -1 : 1, " * ").concat(amount, " ))");
24626
+
24627
+ _this3.$refs.wrapper.addEventListener('transitionend', function (_ref) {
24628
+ var propertyName = _ref.propertyName;
24629
+
24630
+ if (propertyName === 'transform') {
24631
+ _this3.$refs.wrapper.style.transition = 'unset';
24632
+ resolve();
24633
+ }
24634
+ });
24635
+ }
24636
+ }, 100);
24637
+ });
24638
+ },
24639
+ slideBack: function slideBack() {
24640
+ var _this4 = this;
24641
+
24642
+ this.slideBase('0px', 1).then(function () {
24643
+ // remove notification from store after hidden
24644
+ _this4.removeNotification(_this4.id);
24645
+ });
24646
+ },
24647
+ slideFull: function slideFull() {
24648
+ var _this5 = this;
24649
+
24650
+ this.slideBase('100%').then(function () {
24651
+ _this5.fullyRevealed = true;
24652
+ });
24653
+ },
24654
+ slideIcon: function slideIcon() {
24655
+ var iconWrapper = this.$refs.icon;
24656
+ var messageWrapper = this.$refs.message;
24657
+ var filler = this.$refs.filler;
24658
+
24659
+ var _iconWrapper$getBound = iconWrapper.getBoundingClientRect(),
24660
+ width = _iconWrapper$getBound.width;
24661
+
24662
+ var _getComputedStyle = getComputedStyle(messageWrapper),
24663
+ borderLeftWidth = _getComputedStyle.borderLeftWidth;
24664
+
24665
+ var _filler$getBoundingCl = filler.getBoundingClientRect(),
24666
+ fillerWidth = _filler$getBoundingCl.width;
24667
+
24668
+ this.slideBase("".concat(width + Number.parseInt(fillerWidth, 10) + Number.parseInt(borderLeftWidth, 10), "px"));
24669
+ },
24670
+ handleNotificationClick: function handleNotificationClick() {
24671
+ if (this.fullyRevealed) {
24672
+ this.slideBack();
24673
+ } else if (this.reveal === 'icon') {
24674
+ this.slideFull();
24675
+ }
24676
+ }
24677
+ })
24678
+ };
24679
+ exports.default = _default;
24680
+ var $474c2d = exports.default || module.exports;
24681
+
24682
+ if (typeof $474c2d === 'function') {
24683
+ $474c2d = $474c2d.options;
24684
+ }
24685
+
24686
+ /* template */
24687
+ Object.assign($474c2d, (function () {
24688
+ var render = function() {
24689
+ var _vm = this
24690
+ var _h = _vm.$createElement
24691
+ var _c = _vm._self._c || _h
24692
+ return _c(
24693
+ "div",
24694
+ {
24695
+ ref: "wrapper",
24696
+ staticClass: "wptb-notification-wrapper",
24697
+ style: _vm.style.wrapper,
24698
+ attrs: { id: "notification#" + _vm.id },
24699
+ on: { click: _vm.handleNotificationClick }
24700
+ },
24701
+ [
24702
+ _c(
24703
+ "div",
24704
+ {
24705
+ ref: "icon",
24706
+ staticClass: "wptb-notification-icon",
24707
+ style: _vm.style.icon
24708
+ },
24709
+ [
24710
+ _vm.queueLengthVisibility
24711
+ ? _c(
24712
+ "div",
24713
+ {
24714
+ key: _vm.lengthRepaint,
24715
+ staticClass: "wptb-notification-queue-length",
24716
+ style: _vm.style.length
24717
+ },
24718
+ [_vm._v("\n\t\t\t" + _vm._s(_vm.queueLength) + "\n\t\t")]
24719
+ )
24720
+ : _vm._e(),
24721
+ _vm._v(" "),
24722
+ _vm.type !== "pro"
24723
+ ? _c("div", {
24724
+ staticClass: "wptb-notification-svg-wrapper",
24725
+ domProps: { innerHTML: _vm._s(_vm.icons[_vm.type]) }
24726
+ })
24727
+ : _c("img", {
24728
+ staticClass: "wptb-notification-svg-wrapper",
24729
+ attrs: { src: _vm.icons.pro }
24730
+ })
24731
+ ]
24732
+ ),
24733
+ _vm._v(" "),
24734
+ _c("div", {
24735
+ ref: "filler",
24736
+ staticClass: "wptb-notification-filler",
24737
+ style: _vm.style.filler
24738
+ }),
24739
+ _vm._v(" "),
24740
+ _c("div", {
24741
+ ref: "message",
24742
+ staticClass: "wptb-notification-message",
24743
+ style: _vm.style.message,
24744
+ domProps: { innerHTML: _vm._s(_vm.message) }
24745
+ })
24746
+ ]
24747
+ )
24748
+ }
24749
+ var staticRenderFns = []
24750
+ render._withStripped = true
24751
+
24752
+ return {
24753
+ render: render,
24754
+ staticRenderFns: staticRenderFns,
24755
+ _compiled: true,
24756
+ _scopeId: null,
24757
+ functional: undefined
24758
+ };
24759
+ })());
24760
+
24761
+ },{"vuex":"../../../../../node_modules/vuex/dist/vuex.esm.js"}],"containers/NotificationManagerApp.vue":[function(require,module,exports) {
24762
+ "use strict";
24763
+
24764
+ Object.defineProperty(exports, "__esModule", {
24765
+ value: true
24766
+ });
24767
+ exports.default = void 0;
24768
+
24769
+ var _vuex = require("vuex");
24770
+
24771
+ var _Notification = _interopRequireDefault(require("../components/Notification"));
24772
+
24773
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24774
+
24775
+ //
24776
+ //
24777
+ //
24778
+ //
24779
+ //
24780
+ //
24781
+ //
24782
+ //
24783
+ //
24784
+ //
24785
+ //
24786
+ //
24787
+ //
24788
+ //
24789
+ //
24790
+ //
24791
+ var _default = {
24792
+ props: {
24793
+ soundEnabled: {
24794
+ type: Boolean,
24795
+ default: true
24796
+ }
24797
+ },
24798
+ components: {
24799
+ Notification: _Notification.default
24800
+ },
24801
+ watch: {
24802
+ notificationsOnDisplay: {
24803
+ handler: function handler() {
24804
+ this.calculatePosition();
24805
+ },
24806
+ deep: true
24807
+ }
24808
+ },
24809
+ computed: (0, _vuex.mapState)(['notificationsOnDisplay', 'sounds']),
24810
+ mounted: function mounted() {
24811
+ var _this = this;
24812
+
24813
+ this.$store.subscribeAction(function (action) {
24814
+ if (action.type === 'addNotification') {
24815
+ setTimeout(function () {
24816
+ if (_this.soundEnabled) {
24817
+ _this.$refs.audio.play();
24818
+ }
24819
+ }, 100);
24820
+ }
24821
+ });
24822
+ },
24823
+ methods: {
24824
+ calculatePosition: function calculatePosition() {
24825
+ var mainWrapper = this.$refs.mainWrapper;
24826
+
24827
+ var _mainWrapper$getBound = mainWrapper.getBoundingClientRect(),
24828
+ height = _mainWrapper$getBound.height;
24829
+
24830
+ mainWrapper.style.top = "calc( 50% - ".concat(height / 2, "px )");
24831
+ }
24832
+ }
24833
+ };
24834
+ exports.default = _default;
24835
+ var $336d23 = exports.default || module.exports;
24836
+
24837
+ if (typeof $336d23 === 'function') {
24838
+ $336d23 = $336d23.options;
24839
+ }
24840
+
24841
+ /* template */
24842
+ Object.assign($336d23, (function () {
24843
+ var render = function() {
24844
+ var _vm = this
24845
+ var _h = _vm.$createElement
24846
+ var _c = _vm._self._c || _h
24847
+ return _c(
24848
+ "div",
24849
+ { ref: "mainWrapper", staticClass: "wptb-notification-manager" },
24850
+ [
24851
+ _vm._l(_vm.notificationsOnDisplay, function(ref) {
24852
+ var id = ref.id
24853
+ var message = ref.message
24854
+ var type = ref.type
24855
+ var queue = ref.queue
24856
+ var reveal = ref.reveal
24857
+ var dismiss = ref.dismiss
24858
+ return _c("notification", {
24859
+ key: id,
24860
+ attrs: {
24861
+ id: id,
24862
+ message: message,
24863
+ type: type,
24864
+ queue: queue,
24865
+ reveal: reveal,
24866
+ dismiss: dismiss
24867
+ }
24868
+ })
24869
+ }),
24870
+ _vm._v(" "),
24871
+ _c("audio", { ref: "audio", attrs: { src: _vm.sounds.ding } })
24872
+ ],
24873
+ 2
24874
+ )
24875
+ }
24876
+ var staticRenderFns = []
24877
+ render._withStripped = true
24878
+
24879
+ return {
24880
+ render: render,
24881
+ staticRenderFns: staticRenderFns,
24882
+ _compiled: true,
24883
+ _scopeId: null,
24884
+ functional: undefined
24885
+ };
24886
+ })());
24887
+
24888
+ },{"vuex":"../../../../../node_modules/vuex/dist/vuex.esm.js","../components/Notification":"components/Notification.vue"}],"stores/notificationManager/state.js":[function(require,module,exports) {
24889
+ "use strict";
24890
+
24891
+ Object.defineProperty(exports, "__esModule", {
24892
+ value: true
24893
+ });
24894
+ exports.default = void 0;
24895
+
24896
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
24897
+
24898
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
24899
+
24900
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24901
+
24902
+ /**
24903
+ *Default state for notification manager.
24904
+ *
24905
+ * @type {Object} default state
24906
+ */
24907
+ var defaultState = {
24908
+ notificationQueue: [],
24909
+ notificationsOnDisplay: [],
24910
+ notificationTypes: {
24911
+ normal: 'ok',
24912
+ info: 'info',
24913
+ error: 'error',
24914
+ pro: 'pro'
24915
+ },
24916
+ queueTypes: {
24917
+ wait: 'wait',
24918
+ instant: 'instant'
24919
+ },
24920
+ revealTypes: {
24921
+ icon: 'icon',
24922
+ full: 'full'
24923
+ },
24924
+ dismissTypes: {
24925
+ timed: 'timed',
24926
+ click: 'click'
24927
+ },
24928
+ autoDismissTime: 3000,
24929
+ currentId: 0,
24930
+ defaults: {
24931
+ type: 'ok',
24932
+ queue: 'wait',
24933
+ reveal: 'full',
24934
+ dismiss: 'timed',
24935
+ message: 'default message'
24936
+ }
24937
+ };
24938
+ /**
24939
+ * Merge default state with extra ones and create new one.
24940
+ *
24941
+ * @param {Object} extraState extra state values to add
24942
+ */
24943
+
24944
+ var createState = function createState(extraState) {
24945
+ return _objectSpread(_objectSpread({}, defaultState), extraState);
24946
+ };
24947
+
24948
+ var _default = createState;
24949
+ exports.default = _default;
24950
+ },{}],"stores/notificationManager/actions.js":[function(require,module,exports) {
24951
+ "use strict";
24952
+
24953
+ Object.defineProperty(exports, "__esModule", {
24954
+ value: true
24955
+ });
24956
+ exports.default = void 0;
24957
+
24958
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
24959
+
24960
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
24961
+
24962
+ /* eslint-disable jsdoc/check-param-names */
24963
+
24964
+ /**
24965
+ * Actions for notification manager store.
24966
+ *
24967
+ * @type {Object}
24968
+ */
24969
+ var actions = {
24970
+ /**
24971
+ * Add a notification to manager .
24972
+ *
24973
+ * @param {Function} commit store commit function
24974
+ * @param {Object} getters store getters
24975
+ * @param {Function} dispatch store dispatch function
24976
+ * @param {Object} notificationObj notification object to be added
24977
+ * @return {Promise<void>}
24978
+ */
24979
+ addNotification: function addNotification(_ref, notificationObj) {
24980
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
24981
+ var commit, getters, dispatch, queue;
24982
+ return regeneratorRuntime.wrap(function _callee$(_context) {
24983
+ while (1) {
24984
+ switch (_context.prev = _context.next) {
24985
+ case 0:
24986
+ commit = _ref.commit, getters = _ref.getters, dispatch = _ref.dispatch;
24987
+ queue = notificationObj.queue; // add an id to notification object
24988
+ // eslint-disable-next-line no-param-reassign
24989
+
24990
+ _context.next = 4;
24991
+ return dispatch('generateId');
24992
+
24993
+ case 4:
24994
+ notificationObj.id = _context.sent;
24995
+
24996
+ // check for wait type of object
24997
+ // if it is set to wait add it to queue
24998
+ if (queue === 'wait') {
24999
+ commit('addNotificationToQueue', notificationObj); // if there is no notification with wait queue type is active on current display
25000
+
25001
+ if (!getters.isAnyQueuedNotificationOnDisplay) {
25002
+ dispatch('moveQueToDisplay');
25003
+ } // else add it to display immediately
25004
+
25005
+ } else {
25006
+ commit('addNotificationToDisplay', notificationObj);
25007
+ }
25008
+
25009
+ case 6:
25010
+ case "end":
25011
+ return _context.stop();
25012
+ }
25013
+ }
25014
+ }, _callee);
25015
+ }))();
25016
+ },
25017
+
25018
+ /**
25019
+ * Move first notification waiting on queue to display.
25020
+ *
25021
+ * @param {Function} commit store commit function
25022
+ * @param {Object} state store state
25023
+ */
25024
+ moveQueToDisplay: function moveQueToDisplay(_ref2) {
25025
+ var commit = _ref2.commit,
25026
+ getters = _ref2.getters;
25027
+ // remove and get first notification waiting at queue
25028
+ var notification = getters.firstInQueue;
25029
+
25030
+ if (notification) {
25031
+ commit('shiftQueue');
25032
+ commit('addToQueuedDisplay', notification);
25033
+ }
25034
+ },
25035
+
25036
+ /**
25037
+ * Generate a unique id.
25038
+ *
25039
+ * @param {Function} commit store commit function
25040
+ * @param {Object} getters store getters
25041
+ * @return {string} generated id
25042
+ */
25043
+ generateId: function generateId(_ref3) {
25044
+ var commit = _ref3.commit,
25045
+ getters = _ref3.getters;
25046
+ commit('incrementId');
25047
+ return getters.getId;
25048
+ },
25049
+
25050
+ /**
25051
+ * Remove notification from displayed notifications.
25052
+ *
25053
+ * @param {Function} commit store commit function
25054
+ * @param {Object} getters store getters
25055
+ * @param {Function} dispatch store dispatch function
25056
+ * @param {number} id notification id
25057
+ */
25058
+ removeNotification: function removeNotification(_ref4, id) {
25059
+ var commit = _ref4.commit,
25060
+ getters = _ref4.getters,
25061
+ dispatch = _ref4.dispatch;
25062
+ var notificationToBeRemoved = getters.getNotificationOnDisplayById(id);
25063
+ commit('removeNotification', id);
25064
+
25065
+ if (notificationToBeRemoved && notificationToBeRemoved.queue === 'wait') {
25066
+ dispatch('moveQueToDisplay');
25067
+ }
25068
+ }
25069
+ };
25070
+ var _default = actions;
25071
+ exports.default = _default;
25072
+ },{}],"stores/notificationManager/mutations.js":[function(require,module,exports) {
25073
+ "use strict";
25074
+
25075
+ Object.defineProperty(exports, "__esModule", {
25076
+ value: true
25077
+ });
25078
+ exports.default = void 0;
25079
+
25080
+ /**
25081
+ * Mutations for notification manager store.
25082
+ *
25083
+ * @type {Object}
25084
+ */
25085
+ var mutations = {
25086
+ shiftQueue: function shiftQueue(state) {
25087
+ state.notificationQueue.shift();
25088
+ },
25089
+ addNotificationToQueue: function addNotificationToQueue(state, notificationObj) {
25090
+ state.notificationQueue.push(notificationObj);
25091
+ },
25092
+ addToQueuedDisplay: function addToQueuedDisplay(state, notification) {
25093
+ state.notificationsOnDisplay.unshift(notification);
25094
+ },
25095
+ addNotificationToDisplay: function addNotificationToDisplay(state, notificationObj) {
25096
+ state.notificationsOnDisplay.push(notificationObj);
25097
+ },
25098
+ incrementId: function incrementId(state) {
25099
+ // eslint-disable-next-line no-param-reassign
25100
+ state.currentId += 1;
25101
+ },
25102
+ removeNotification: function removeNotification(state, id) {
25103
+ var foundIndex = null;
25104
+ state.notificationsOnDisplay.find(function (val, index) {
25105
+ if (val.id === id) {
25106
+ foundIndex = index;
25107
+ }
25108
+ });
25109
+
25110
+ if (foundIndex !== null && foundIndex !== undefined) {
25111
+ // state.notificationsOnDisplay = state.notificationsOnDisplay.slice(foundIndex, 1);
25112
+ state.notificationsOnDisplay.splice(foundIndex, 1);
25113
+ }
25114
+ }
25115
+ };
25116
+ var _default = mutations;
25117
+ exports.default = _default;
25118
+ },{}],"stores/notificationManager/getters.js":[function(require,module,exports) {
25119
+ "use strict";
25120
+
25121
+ Object.defineProperty(exports, "__esModule", {
25122
+ value: true
25123
+ });
25124
+ exports.default = void 0;
25125
+
25126
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
25127
+
25128
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25129
+
25130
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25131
+
25132
+ /**
25133
+ * Getters for notification manager store
25134
+ *
25135
+ * @type {Object}
25136
+ */
25137
+ var getters = {
25138
+ notificationTypes: function notificationTypes(state) {
25139
+ return _objectSpread({}, state.notificationTypes);
25140
+ },
25141
+ queueTypes: function queueTypes(state) {
25142
+ return _objectSpread({}, state.queueTypes);
25143
+ },
25144
+ revealTypes: function revealTypes(state) {
25145
+ return _objectSpread({}, state.revealTypes);
25146
+ },
25147
+ dismissTypes: function dismissTypes(state) {
25148
+ return _objectSpread({}, state.dismissTypes);
25149
+ },
25150
+ queueLength: function queueLength(state) {
25151
+ return state.notificationQueue.length;
25152
+ },
25153
+ getId: function getId(state) {
25154
+ return state.currentId;
25155
+ },
25156
+ defaults: function defaults(state) {
25157
+ return state.defaults;
25158
+ },
25159
+ autoDismissTime: function autoDismissTime(state) {
25160
+ return state.autoDismissTime;
25161
+ },
25162
+ firstInQueue: function firstInQueue(state) {
25163
+ return state.notificationQueue[0];
25164
+ },
25165
+ isAnyQueuedNotificationOnDisplay: function isAnyQueuedNotificationOnDisplay(state) {
25166
+ return state.notificationsOnDisplay.some(function (n) {
25167
+ return n.queue === 'wait';
25168
+ });
25169
+ },
25170
+ getNotificationOnDisplayById: function getNotificationOnDisplayById(state) {
25171
+ return function (id) {
25172
+ if (state.notificationsOnDisplay.length > 0) {
25173
+ return state.notificationsOnDisplay.find(function (n) {
25174
+ return n.id === id;
25175
+ });
25176
+ }
25177
+
25178
+ return null;
25179
+ };
25180
+ }
25181
+ };
25182
+ var _default = getters;
25183
+ exports.default = _default;
25184
+ },{}],"stores/notificationManager/index.js":[function(require,module,exports) {
25185
+ "use strict";
25186
+
25187
+ Object.defineProperty(exports, "__esModule", {
25188
+ value: true
25189
+ });
25190
+ exports.default = void 0;
25191
+
25192
+ var _vue = _interopRequireDefault(require("vue"));
25193
+
25194
+ var _vuex = _interopRequireDefault(require("vuex"));
25195
+
25196
+ var _state = _interopRequireDefault(require("./state"));
25197
+
25198
+ var _actions = _interopRequireDefault(require("./actions"));
25199
+
25200
+ var _mutations = _interopRequireDefault(require("./mutations"));
25201
+
25202
+ var _getters = _interopRequireDefault(require("./getters"));
25203
+
25204
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25205
+
25206
+ _vue.default.use(_vuex.default);
25207
+ /**
25208
+ * Create new Vuex store for notification manager.
25209
+ *
25210
+ * @param {Object} root0 store object
25211
+ * @param {Object} root0.state store state
25212
+ */
25213
+ // eslint-disable-next-line no-empty-pattern
25214
+
25215
+
25216
+ var createStore = function createStore(_ref) {
25217
+ var state = _ref.state;
25218
+ return new _vuex.default.Store({
25219
+ state: (0, _state.default)(state || {}),
25220
+ actions: _actions.default,
25221
+ mutations: _mutations.default,
25222
+ getters: _getters.default,
25223
+ strict: true
25224
+ });
25225
+ };
25226
+
25227
+ var _default = createStore;
25228
+ exports.default = _default;
25229
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","vuex":"../../../../../node_modules/vuex/dist/vuex.esm.js","./state":"stores/notificationManager/state.js","./actions":"stores/notificationManager/actions.js","./mutations":"stores/notificationManager/mutations.js","./getters":"stores/notificationManager/getters.js"}],"mountPoints/WPTB_NotificationManagerView.js":[function(require,module,exports) {
25230
+ "use strict";
25231
+
25232
+ Object.defineProperty(exports, "__esModule", {
25233
+ value: true
25234
+ });
25235
+ exports.default = void 0;
25236
+
25237
+ var _vue = _interopRequireDefault(require("vue"));
25238
+
25239
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
25240
+
25241
+ var _NotificationManagerApp = _interopRequireDefault(require("../containers/NotificationManagerApp"));
25242
+
25243
+ var _notificationManager = _interopRequireDefault(require("../stores/notificationManager"));
25244
+
25245
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25246
+
25247
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
25248
+
25249
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25250
+
25251
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25252
+
25253
+ var _default = {
25254
+ name: 'NotificationManager',
25255
+ handler: function notificationManagerJS(uniqueId) {
25256
+ // server send data for notification manager
25257
+ var data = _WPTB_ControlsManager.default.getControlData(uniqueId);
25258
+
25259
+ var store = (0, _notificationManager.default)({
25260
+ state: _objectSpread({}, data)
25261
+ });
25262
+ WPTB_NotificationManager.store = store;
25263
+ new _vue.default({
25264
+ data: data,
25265
+ store: store,
25266
+ components: {
25267
+ NotificationManagerApp: _NotificationManagerApp.default
25268
+ },
25269
+ template: '<notification-manager-app :sound-enabled="options.soundEnabled"></notification-manager-app>'
25270
+ }).$mount("#".concat(data.id));
25271
+ }
25272
+ };
25273
+ exports.default = _default;
25274
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js","../containers/NotificationManagerApp":"containers/NotificationManagerApp.vue","../stores/notificationManager":"stores/notificationManager/index.js"}],"components/NotificationManagerDevSelect.vue":[function(require,module,exports) {
25275
+ "use strict";
25276
+
25277
+ Object.defineProperty(exports, "__esModule", {
25278
+ value: true
25279
+ });
25280
+ exports.default = void 0;
25281
+ //
25282
+ //
25283
+ //
25284
+ //
25285
+ //
25286
+ //
25287
+ //
25288
+ //
25289
+ //
25290
+ var _default = {
25291
+ props: {
25292
+ label: {
25293
+ type: String,
25294
+ default: 'label'
25295
+ },
25296
+ value: {
25297
+ type: String,
25298
+ default: 'value'
25299
+ },
25300
+ options: {
25301
+ type: Object,
25302
+ default: function _default() {
25303
+ return {};
25304
+ }
25305
+ }
25306
+ },
25307
+ model: {
25308
+ prop: 'value',
25309
+ event: 'valueChanged'
25310
+ },
25311
+ data: function data() {
25312
+ return {
25313
+ innerValue: ''
25314
+ };
25315
+ },
25316
+ mounted: function mounted() {
25317
+ var _this = this;
25318
+
25319
+ this.$nextTick(function () {
25320
+ _this.innerValue = _this.value;
25321
+ });
25322
+ },
25323
+ watch: {
25324
+ value: function value(n) {
25325
+ this.innerValue = n;
25326
+ },
25327
+ innerValue: function innerValue(n) {
25328
+ this.$emit('valueChanged', n);
25329
+ }
25330
+ }
25331
+ };
25332
+ exports.default = _default;
25333
+ var $f8ee72 = exports.default || module.exports;
25334
+
25335
+ if (typeof $f8ee72 === 'function') {
25336
+ $f8ee72 = $f8ee72.options;
25337
+ }
25338
+
25339
+ /* template */
25340
+ Object.assign($f8ee72, (function () {
25341
+ var render = function() {
25342
+ var _vm = this
25343
+ var _h = _vm.$createElement
25344
+ var _c = _vm._self._c || _h
25345
+ return _c("div", { staticClass: "wptb-nm-devtool-input" }, [
25346
+ _c("div", [_vm._v(_vm._s(_vm.label))]),
25347
+ _vm._v(" "),
25348
+ _c(
25349
+ "select",
25350
+ {
25351
+ directives: [
25352
+ {
25353
+ name: "model",
25354
+ rawName: "v-model",
25355
+ value: _vm.innerValue,
25356
+ expression: "innerValue"
25357
+ }
25358
+ ],
25359
+ on: {
25360
+ change: function($event) {
25361
+ var $$selectedVal = Array.prototype.filter
25362
+ .call($event.target.options, function(o) {
25363
+ return o.selected
25364
+ })
25365
+ .map(function(o) {
25366
+ var val = "_value" in o ? o._value : o.value
25367
+ return val
25368
+ })
25369
+ _vm.innerValue = $event.target.multiple
25370
+ ? $$selectedVal
25371
+ : $$selectedVal[0]
25372
+ }
25373
+ }
25374
+ },
25375
+ _vm._l(_vm.options, function(v, k) {
25376
+ return _c("option", { key: k, domProps: { value: v } }, [
25377
+ _vm._v(_vm._s(v))
25378
+ ])
25379
+ }),
25380
+ 0
25381
+ )
25382
+ ])
25383
+ }
25384
+ var staticRenderFns = []
25385
+ render._withStripped = true
25386
+
25387
+ return {
25388
+ render: render,
25389
+ staticRenderFns: staticRenderFns,
25390
+ _compiled: true,
25391
+ _scopeId: null,
25392
+ functional: undefined
25393
+ };
25394
+ })());
25395
+
25396
+ },{}],"containers/NotificationManagerDevTool.vue":[function(require,module,exports) {
25397
+ "use strict";
25398
+
25399
+ Object.defineProperty(exports, "__esModule", {
25400
+ value: true
25401
+ });
25402
+ exports.default = void 0;
25403
+
25404
+ var _MenuButton = _interopRequireDefault(require("../components/MenuButton"));
25405
+
25406
+ var _NotificationManagerDevSelect = _interopRequireDefault(require("../components/NotificationManagerDevSelect"));
25407
+
25408
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25409
+
25410
+ //
25411
+ //
25412
+ //
25413
+ //
25414
+ //
25415
+ //
25416
+ //
25417
+ //
25418
+ //
25419
+ //
25420
+ //
25421
+ //
25422
+ //
25423
+ //
25424
+ //
25425
+ //
25426
+ //
25427
+ //
25428
+ //
25429
+ //
25430
+ //
25431
+ //
25432
+ //
25433
+ //
25434
+ //
25435
+ //
25436
+ //
25437
+ //
25438
+ //
25439
+ //
25440
+ //
25441
+ //
25442
+ //
25443
+ //
25444
+ //
25445
+ //
25446
+ var _default = {
25447
+ components: {
25448
+ NotificationManagerDevSelect: _NotificationManagerDevSelect.default,
25449
+ MenuButton: _MenuButton.default
25450
+ },
25451
+ props: {
25452
+ queue: Object,
25453
+ types: Object,
25454
+ reveal: Object,
25455
+ dismiss: Object,
25456
+ sendNotification: Function
25457
+ },
25458
+ data: function data() {
25459
+ return {
25460
+ notificationObject: {
25461
+ type: 'pro',
25462
+ queue: 'wait',
25463
+ message: 'sample message',
25464
+ reveal: 'full',
25465
+ dismiss: 'click'
25466
+ }
25467
+ };
25468
+ },
25469
+ mounted: function mounted() {
25470
+ var _this = this;
25471
+
25472
+ this.$nextTick(function () {
25473
+ var wrapper = _this.$refs.mainWrapper;
25474
+
25475
+ var _wrapper$getBoundingC = wrapper.getBoundingClientRect(),
25476
+ height = _wrapper$getBoundingC.height;
25477
+
25478
+ wrapper.style.top = "calc( 50% - ".concat(height / 2, "px)");
25479
+ });
25480
+ },
25481
+ methods: {
25482
+ notify: function notify() {
25483
+ this.sendNotification(this.notificationObject);
25484
+ }
25485
+ }
25486
+ };
25487
+ exports.default = _default;
25488
+ var $99e19e = exports.default || module.exports;
25489
+
25490
+ if (typeof $99e19e === 'function') {
25491
+ $99e19e = $99e19e.options;
25492
+ }
25493
+
25494
+ /* template */
25495
+ Object.assign($99e19e, (function () {
25496
+ var render = function() {
25497
+ var _vm = this
25498
+ var _h = _vm.$createElement
25499
+ var _c = _vm._self._c || _h
25500
+ return _c(
25501
+ "div",
25502
+ {
25503
+ ref: "mainWrapper",
25504
+ staticClass: "wptb-notification-manager-dev-tool-wrapper"
25505
+ },
25506
+ [
25507
+ _c("div", { staticClass: "wptb-nm-devtool-header" }, [
25508
+ _vm._v("\n\t\tNotification Manager Dev Tool\n\t")
25509
+ ]),
25510
+ _vm._v(" "),
25511
+ _c(
25512
+ "div",
25513
+ { staticClass: "wptb-nm-devtool-selection" },
25514
+ [
25515
+ _c("notification-manager-dev-select", {
25516
+ attrs: { label: "Type", options: _vm.types },
25517
+ model: {
25518
+ value: _vm.notificationObject.type,
25519
+ callback: function($$v) {
25520
+ _vm.$set(_vm.notificationObject, "type", $$v)
25521
+ },
25522
+ expression: "notificationObject.type"
25523
+ }
25524
+ }),
25525
+ _vm._v(" "),
25526
+ _c("notification-manager-dev-select", {
25527
+ attrs: { label: "Queue", options: _vm.queue },
25528
+ model: {
25529
+ value: _vm.notificationObject.queue,
25530
+ callback: function($$v) {
25531
+ _vm.$set(_vm.notificationObject, "queue", $$v)
25532
+ },
25533
+ expression: "notificationObject.queue"
25534
+ }
25535
+ }),
25536
+ _vm._v(" "),
25537
+ _c("notification-manager-dev-select", {
25538
+ attrs: { label: "Reveal", options: _vm.reveal },
25539
+ model: {
25540
+ value: _vm.notificationObject.reveal,
25541
+ callback: function($$v) {
25542
+ _vm.$set(_vm.notificationObject, "reveal", $$v)
25543
+ },
25544
+ expression: "notificationObject.reveal"
25545
+ }
25546
+ }),
25547
+ _vm._v(" "),
25548
+ _c("notification-manager-dev-select", {
25549
+ attrs: { label: "Dismiss", options: _vm.dismiss },
25550
+ model: {
25551
+ value: _vm.notificationObject.dismiss,
25552
+ callback: function($$v) {
25553
+ _vm.$set(_vm.notificationObject, "dismiss", $$v)
25554
+ },
25555
+ expression: "notificationObject.dismiss"
25556
+ }
25557
+ })
25558
+ ],
25559
+ 1
25560
+ ),
25561
+ _vm._v(" "),
25562
+ _c("div", { staticClass: "wptb-nm-devtool-message" }, [
25563
+ _c("input", {
25564
+ directives: [
25565
+ {
25566
+ name: "model",
25567
+ rawName: "v-model",
25568
+ value: _vm.notificationObject.message,
25569
+ expression: "notificationObject.message"
25570
+ }
25571
+ ],
25572
+ attrs: { type: "text", placeholder: "notification message" },
25573
+ domProps: { value: _vm.notificationObject.message },
25574
+ on: {
25575
+ input: function($event) {
25576
+ if ($event.target.composing) {
25577
+ return
25578
+ }
25579
+ _vm.$set(_vm.notificationObject, "message", $event.target.value)
25580
+ }
25581
+ }
25582
+ })
25583
+ ]),
25584
+ _vm._v(" "),
25585
+ _c(
25586
+ "div",
25587
+ { staticClass: "wptb-nm-devtool-submit" },
25588
+ [
25589
+ _c(
25590
+ "menu-button",
25591
+ { attrs: { size: "small" }, on: { click: _vm.notify } },
25592
+ [_vm._v("Notify")]
25593
+ )
25594
+ ],
25595
+ 1
25596
+ )
25597
+ ]
25598
+ )
25599
+ }
25600
+ var staticRenderFns = []
25601
+ render._withStripped = true
25602
+
25603
+ return {
25604
+ render: render,
25605
+ staticRenderFns: staticRenderFns,
25606
+ _compiled: true,
25607
+ _scopeId: "data-v-99e19e",
25608
+ functional: undefined
25609
+ };
25610
+ })());
25611
+
25612
+ },{"../components/MenuButton":"components/MenuButton.vue","../components/NotificationManagerDevSelect":"components/NotificationManagerDevSelect.vue"}],"mountPoints/WPTB_NotificationManagerDevTool.js":[function(require,module,exports) {
25613
+ "use strict";
25614
+
25615
+ Object.defineProperty(exports, "__esModule", {
25616
+ value: true
25617
+ });
25618
+ exports.default = void 0;
25619
+
25620
+ var _vue = _interopRequireDefault(require("vue"));
25621
+
25622
+ var _WPTB_ControlsManager = _interopRequireDefault(require("../functions/WPTB_ControlsManager"));
25623
+
25624
+ var _NotificationManagerDevTool = _interopRequireDefault(require("../containers/NotificationManagerDevTool"));
25625
+
25626
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25627
+
25628
+ /**
25629
+ * Notification manager dev tools.
25630
+ */
25631
+ // eslint-disable-next-line camelcase
25632
+ var _default = {
25633
+ name: 'NotificationManagerDevTool',
25634
+ handler: function notificationManagerJS(uniqueId) {
25635
+ var data = _WPTB_ControlsManager.default.getControlData(uniqueId);
25636
+
25637
+ new _vue.default({
25638
+ data: data,
25639
+ components: {
25640
+ NotificationManagerDevTool: _NotificationManagerDevTool.default
25641
+ },
25642
+ template: '<notification-manager-dev-tool :reveal="reveal" :queue="queue" :types="types" :send-notification="sendNotification" :dismiss="dismiss"></notification-manager-dev-tool>'
25643
+ }).$mount("#".concat(data.mountId));
25644
+ }
25645
+ };
25646
+ exports.default = _default;
25647
+ },{"vue":"../../../../../node_modules/vue/dist/vue.esm.js","../functions/WPTB_ControlsManager":"functions/WPTB_ControlsManager.js","../containers/NotificationManagerDevTool":"containers/NotificationManagerDevTool.vue"}],"../../../../../node_modules/codemirror/lib/codemirror.js":[function(require,module,exports) {
25648
+ var define;
25649
+ var global = arguments[3];
25650
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
25651
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
25652
+
25653
+ // This is CodeMirror (https://codemirror.net), a code editor
25654
+ // implemented in JavaScript on top of the browser's DOM.
25655
+ //
25656
+ // You can find some technical background for some of the code below
25657
+ // at http://marijnhaverbeke.nl/blog/#cm-internals .
25658
+
25659
+ (function (global, factory) {
25660
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
25661
+ typeof define === 'function' && define.amd ? define(factory) :
25662
+ (global = global || self, global.CodeMirror = factory());
25663
+ }(this, (function () { 'use strict';
25664
+
25665
+ // Kludges for bugs and behavior differences that can't be feature
25666
+ // detected are enabled based on userAgent etc sniffing.
25667
+ var userAgent = navigator.userAgent;
25668
+ var platform = navigator.platform;
25669
+
25670
+ var gecko = /gecko\/\d/i.test(userAgent);
25671
+ var ie_upto10 = /MSIE \d/.test(userAgent);
25672
+ var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
25673
+ var edge = /Edge\/(\d+)/.exec(userAgent);
25674
+ var ie = ie_upto10 || ie_11up || edge;
25675
+ var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
25676
+ var webkit = !edge && /WebKit\//.test(userAgent);
25677
+ var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
25678
+ var chrome = !edge && /Chrome\//.test(userAgent);
25679
+ var presto = /Opera\//.test(userAgent);
25680
+ var safari = /Apple Computer/.test(navigator.vendor);
25681
+ var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
25682
+ var phantom = /PhantomJS/.test(userAgent);
25683
+
25684
+ var ios = safari && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2);
25685
+ var android = /Android/.test(userAgent);
25686
+ // This is woefully incomplete. Suggestions for alternative methods welcome.
25687
+ var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
25688
+ var mac = ios || /Mac/.test(platform);
25689
+ var chromeOS = /\bCrOS\b/.test(userAgent);
25690
+ var windows = /win/i.test(platform);
25691
+
25692
+ var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
25693
+ if (presto_version) { presto_version = Number(presto_version[1]); }
25694
+ if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
25695
+ // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
25696
+ var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
25697
+ var captureRightClick = gecko || (ie && ie_version >= 9);
25698
+
25699
+ function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
25700
+
25701
+ var rmClass = function(node, cls) {
25702
+ var current = node.className;
25703
+ var match = classTest(cls).exec(current);
25704
+ if (match) {
25705
+ var after = current.slice(match.index + match[0].length);
25706
+ node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
25707
+ }
25708
+ };
25709
+
25710
+ function removeChildren(e) {
25711
+ for (var count = e.childNodes.length; count > 0; --count)
25712
+ { e.removeChild(e.firstChild); }
25713
+ return e
25714
+ }
25715
+
25716
+ function removeChildrenAndAdd(parent, e) {
25717
+ return removeChildren(parent).appendChild(e)
25718
+ }
25719
+
25720
+ function elt(tag, content, className, style) {
25721
+ var e = document.createElement(tag);
25722
+ if (className) { e.className = className; }
25723
+ if (style) { e.style.cssText = style; }
25724
+ if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
25725
+ else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
25726
+ return e
25727
+ }
25728
+ // wrapper for elt, which removes the elt from the accessibility tree
25729
+ function eltP(tag, content, className, style) {
25730
+ var e = elt(tag, content, className, style);
25731
+ e.setAttribute("role", "presentation");
25732
+ return e
25733
+ }
25734
+
25735
+ var range;
25736
+ if (document.createRange) { range = function(node, start, end, endNode) {
25737
+ var r = document.createRange();
25738
+ r.setEnd(endNode || node, end);
25739
+ r.setStart(node, start);
25740
+ return r
25741
+ }; }
25742
+ else { range = function(node, start, end) {
25743
+ var r = document.body.createTextRange();
25744
+ try { r.moveToElementText(node.parentNode); }
25745
+ catch(e) { return r }
25746
+ r.collapse(true);
25747
+ r.moveEnd("character", end);
25748
+ r.moveStart("character", start);
25749
+ return r
25750
+ }; }
25751
+
25752
+ function contains(parent, child) {
25753
+ if (child.nodeType == 3) // Android browser always returns false when child is a textnode
25754
+ { child = child.parentNode; }
25755
+ if (parent.contains)
25756
+ { return parent.contains(child) }
25757
+ do {
25758
+ if (child.nodeType == 11) { child = child.host; }
25759
+ if (child == parent) { return true }
25760
+ } while (child = child.parentNode)
25761
+ }
25762
+
25763
+ function activeElt() {
25764
+ // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
25765
+ // IE < 10 will throw when accessed while the page is loading or in an iframe.
25766
+ // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
25767
+ var activeElement;
25768
+ try {
25769
+ activeElement = document.activeElement;
25770
+ } catch(e) {
25771
+ activeElement = document.body || null;
25772
+ }
25773
+ while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
25774
+ { activeElement = activeElement.shadowRoot.activeElement; }
25775
+ return activeElement
25776
+ }
25777
+
25778
+ function addClass(node, cls) {
25779
+ var current = node.className;
25780
+ if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
25781
+ }
25782
+ function joinClasses(a, b) {
25783
+ var as = a.split(" ");
25784
+ for (var i = 0; i < as.length; i++)
25785
+ { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
25786
+ return b
25787
+ }
25788
+
25789
+ var selectInput = function(node) { node.select(); };
25790
+ if (ios) // Mobile Safari apparently has a bug where select() is broken.
25791
+ { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
25792
+ else if (ie) // Suppress mysterious IE10 errors
25793
+ { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
25794
+
25795
+ function bind(f) {
25796
+ var args = Array.prototype.slice.call(arguments, 1);
25797
+ return function(){return f.apply(null, args)}
25798
+ }
25799
+
25800
+ function copyObj(obj, target, overwrite) {
25801
+ if (!target) { target = {}; }
25802
+ for (var prop in obj)
25803
+ { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
25804
+ { target[prop] = obj[prop]; } }
25805
+ return target
25806
+ }
25807
+
25808
+ // Counts the column offset in a string, taking tabs into account.
25809
+ // Used mostly to find indentation.
25810
+ function countColumn(string, end, tabSize, startIndex, startValue) {
25811
+ if (end == null) {
25812
+ end = string.search(/[^\s\u00a0]/);
25813
+ if (end == -1) { end = string.length; }
25814
+ }
25815
+ for (var i = startIndex || 0, n = startValue || 0;;) {
25816
+ var nextTab = string.indexOf("\t", i);
25817
+ if (nextTab < 0 || nextTab >= end)
25818
+ { return n + (end - i) }
25819
+ n += nextTab - i;
25820
+ n += tabSize - (n % tabSize);
25821
+ i = nextTab + 1;
25822
+ }
25823
+ }
25824
+
25825
+ var Delayed = function() {
25826
+ this.id = null;
25827
+ this.f = null;
25828
+ this.time = 0;
25829
+ this.handler = bind(this.onTimeout, this);
25830
+ };
25831
+ Delayed.prototype.onTimeout = function (self) {
25832
+ self.id = 0;
25833
+ if (self.time <= +new Date) {
25834
+ self.f();
25835
+ } else {
25836
+ setTimeout(self.handler, self.time - +new Date);
25837
+ }
25838
+ };
25839
+ Delayed.prototype.set = function (ms, f) {
25840
+ this.f = f;
25841
+ var time = +new Date + ms;
25842
+ if (!this.id || time < this.time) {
25843
+ clearTimeout(this.id);
25844
+ this.id = setTimeout(this.handler, ms);
25845
+ this.time = time;
25846
+ }
25847
+ };
25848
+
25849
+ function indexOf(array, elt) {
25850
+ for (var i = 0; i < array.length; ++i)
25851
+ { if (array[i] == elt) { return i } }
25852
+ return -1
25853
+ }
25854
+
25855
+ // Number of pixels added to scroller and sizer to hide scrollbar
25856
+ var scrollerGap = 50;
25857
+
25858
+ // Returned or thrown by various protocols to signal 'I'm not
25859
+ // handling this'.
25860
+ var Pass = {toString: function(){return "CodeMirror.Pass"}};
25861
+
25862
+ // Reused option objects for setSelection & friends
25863
+ var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"};
25864
+
25865
+ // The inverse of countColumn -- find the offset that corresponds to
25866
+ // a particular column.
25867
+ function findColumn(string, goal, tabSize) {
25868
+ for (var pos = 0, col = 0;;) {
25869
+ var nextTab = string.indexOf("\t", pos);
25870
+ if (nextTab == -1) { nextTab = string.length; }
25871
+ var skipped = nextTab - pos;
25872
+ if (nextTab == string.length || col + skipped >= goal)
25873
+ { return pos + Math.min(skipped, goal - col) }
25874
+ col += nextTab - pos;
25875
+ col += tabSize - (col % tabSize);
25876
+ pos = nextTab + 1;
25877
+ if (col >= goal) { return pos }
25878
+ }
25879
+ }
25880
+
25881
+ var spaceStrs = [""];
25882
+ function spaceStr(n) {
25883
+ while (spaceStrs.length <= n)
25884
+ { spaceStrs.push(lst(spaceStrs) + " "); }
25885
+ return spaceStrs[n]
25886
+ }
25887
+
25888
+ function lst(arr) { return arr[arr.length-1] }
25889
+
25890
+ function map(array, f) {
25891
+ var out = [];
25892
+ for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
25893
+ return out
25894
+ }
25895
+
25896
+ function insertSorted(array, value, score) {
25897
+ var pos = 0, priority = score(value);
25898
+ while (pos < array.length && score(array[pos]) <= priority) { pos++; }
25899
+ array.splice(pos, 0, value);
25900
+ }
25901
+
25902
+ function nothing() {}
25903
+
25904
+ function createObj(base, props) {
25905
+ var inst;
25906
+ if (Object.create) {
25907
+ inst = Object.create(base);
25908
+ } else {
25909
+ nothing.prototype = base;
25910
+ inst = new nothing();
25911
+ }
25912
+ if (props) { copyObj(props, inst); }
25913
+ return inst
25914
+ }
25915
+
25916
+ var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
25917
+ function isWordCharBasic(ch) {
25918
+ return /\w/.test(ch) || ch > "\x80" &&
25919
+ (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
25920
+ }
25921
+ function isWordChar(ch, helper) {
25922
+ if (!helper) { return isWordCharBasic(ch) }
25923
+ if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
25924
+ return helper.test(ch)
25925
+ }
25926
+
25927
+ function isEmpty(obj) {
25928
+ for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
25929
+ return true
25930
+ }
25931
+
25932
+ // Extending unicode characters. A series of a non-extending char +
25933
+ // any number of extending chars is treated as a single unit as far
25934
+ // as editing and measuring is concerned. This is not fully correct,
25935
+ // since some scripts/fonts/browsers also treat other configurations
25936
+ // of code points as a group.
25937
+ var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
25938
+ function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
25939
+
25940
+ // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
25941
+ function skipExtendingChars(str, pos, dir) {
25942
+ while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
25943
+ return pos
25944
+ }
25945
+
25946
+ // Returns the value from the range [`from`; `to`] that satisfies
25947
+ // `pred` and is closest to `from`. Assumes that at least `to`
25948
+ // satisfies `pred`. Supports `from` being greater than `to`.
25949
+ function findFirst(pred, from, to) {
25950
+ // At any point we are certain `to` satisfies `pred`, don't know
25951
+ // whether `from` does.
25952
+ var dir = from > to ? -1 : 1;
25953
+ for (;;) {
25954
+ if (from == to) { return from }
25955
+ var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);
25956
+ if (mid == from) { return pred(mid) ? from : to }
25957
+ if (pred(mid)) { to = mid; }
25958
+ else { from = mid + dir; }
25959
+ }
25960
+ }
25961
+
25962
+ // BIDI HELPERS
25963
+
25964
+ function iterateBidiSections(order, from, to, f) {
25965
+ if (!order) { return f(from, to, "ltr", 0) }
25966
+ var found = false;
25967
+ for (var i = 0; i < order.length; ++i) {
25968
+ var part = order[i];
25969
+ if (part.from < to && part.to > from || from == to && part.to == from) {
25970
+ f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i);
25971
+ found = true;
25972
+ }
25973
+ }
25974
+ if (!found) { f(from, to, "ltr"); }
25975
+ }
25976
+
25977
+ var bidiOther = null;
25978
+ function getBidiPartAt(order, ch, sticky) {
25979
+ var found;
25980
+ bidiOther = null;
25981
+ for (var i = 0; i < order.length; ++i) {
25982
+ var cur = order[i];
25983
+ if (cur.from < ch && cur.to > ch) { return i }
25984
+ if (cur.to == ch) {
25985
+ if (cur.from != cur.to && sticky == "before") { found = i; }
25986
+ else { bidiOther = i; }
25987
+ }
25988
+ if (cur.from == ch) {
25989
+ if (cur.from != cur.to && sticky != "before") { found = i; }
25990
+ else { bidiOther = i; }
25991
+ }
25992
+ }
25993
+ return found != null ? found : bidiOther
25994
+ }
25995
+
25996
+ // Bidirectional ordering algorithm
25997
+ // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
25998
+ // that this (partially) implements.
25999
+
26000
+ // One-char codes used for character types:
26001
+ // L (L): Left-to-Right
26002
+ // R (R): Right-to-Left
26003
+ // r (AL): Right-to-Left Arabic
26004
+ // 1 (EN): European Number
26005
+ // + (ES): European Number Separator
26006
+ // % (ET): European Number Terminator
26007
+ // n (AN): Arabic Number
26008
+ // , (CS): Common Number Separator
26009
+ // m (NSM): Non-Spacing Mark
26010
+ // b (BN): Boundary Neutral
26011
+ // s (B): Paragraph Separator
26012
+ // t (S): Segment Separator
26013
+ // w (WS): Whitespace
26014
+ // N (ON): Other Neutrals
26015
+
26016
+ // Returns null if characters are ordered as they appear
26017
+ // (left-to-right), or an array of sections ({from, to, level}
26018
+ // objects) in the order in which they occur visually.
26019
+ var bidiOrdering = (function() {
26020
+ // Character types for codepoints 0 to 0xff
26021
+ var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
26022
+ // Character types for codepoints 0x600 to 0x6f9
26023
+ var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
26024
+ function charType(code) {
26025
+ if (code <= 0xf7) { return lowTypes.charAt(code) }
26026
+ else if (0x590 <= code && code <= 0x5f4) { return "R" }
26027
+ else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
26028
+ else if (0x6ee <= code && code <= 0x8ac) { return "r" }
26029
+ else if (0x2000 <= code && code <= 0x200b) { return "w" }
26030
+ else if (code == 0x200c) { return "b" }
26031
+ else { return "L" }
26032
+ }
26033
+
26034
+ var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
26035
+ var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
26036
+
26037
+ function BidiSpan(level, from, to) {
26038
+ this.level = level;
26039
+ this.from = from; this.to = to;
26040
+ }
26041
+
26042
+ return function(str, direction) {
26043
+ var outerType = direction == "ltr" ? "L" : "R";
26044
+
26045
+ if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
26046
+ var len = str.length, types = [];
26047
+ for (var i = 0; i < len; ++i)
26048
+ { types.push(charType(str.charCodeAt(i))); }
26049
+
26050
+ // W1. Examine each non-spacing mark (NSM) in the level run, and
26051
+ // change the type of the NSM to the type of the previous
26052
+ // character. If the NSM is at the start of the level run, it will
26053
+ // get the type of sor.
26054
+ for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
26055
+ var type = types[i$1];
26056
+ if (type == "m") { types[i$1] = prev; }
26057
+ else { prev = type; }
26058
+ }
26059
+
26060
+ // W2. Search backwards from each instance of a European number
26061
+ // until the first strong type (R, L, AL, or sor) is found. If an
26062
+ // AL is found, change the type of the European number to Arabic
26063
+ // number.
26064
+ // W3. Change all ALs to R.
26065
+ for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
26066
+ var type$1 = types[i$2];
26067
+ if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
26068
+ else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
26069
+ }
26070
+
26071
+ // W4. A single European separator between two European numbers
26072
+ // changes to a European number. A single common separator between
26073
+ // two numbers of the same type changes to that type.
26074
+ for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
26075
+ var type$2 = types[i$3];
26076
+ if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
26077
+ else if (type$2 == "," && prev$1 == types[i$3+1] &&
26078
+ (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
26079
+ prev$1 = type$2;
26080
+ }
26081
+
26082
+ // W5. A sequence of European terminators adjacent to European
26083
+ // numbers changes to all European numbers.
26084
+ // W6. Otherwise, separators and terminators change to Other
26085
+ // Neutral.
26086
+ for (var i$4 = 0; i$4 < len; ++i$4) {
26087
+ var type$3 = types[i$4];
26088
+ if (type$3 == ",") { types[i$4] = "N"; }
26089
+ else if (type$3 == "%") {
26090
+ var end = (void 0);
26091
+ for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
26092
+ var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
26093
+ for (var j = i$4; j < end; ++j) { types[j] = replace; }
26094
+ i$4 = end - 1;
26095
+ }
26096
+ }
26097
+
26098
+ // W7. Search backwards from each instance of a European number
26099
+ // until the first strong type (R, L, or sor) is found. If an L is
26100
+ // found, then change the type of the European number to L.
26101
+ for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
26102
+ var type$4 = types[i$5];
26103
+ if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
26104
+ else if (isStrong.test(type$4)) { cur$1 = type$4; }
26105
+ }
26106
+
26107
+ // N1. A sequence of neutrals takes the direction of the
26108
+ // surrounding strong text if the text on both sides has the same
26109
+ // direction. European and Arabic numbers act as if they were R in
26110
+ // terms of their influence on neutrals. Start-of-level-run (sor)
26111
+ // and end-of-level-run (eor) are used at level run boundaries.
26112
+ // N2. Any remaining neutrals take the embedding direction.
26113
+ for (var i$6 = 0; i$6 < len; ++i$6) {
26114
+ if (isNeutral.test(types[i$6])) {
26115
+ var end$1 = (void 0);
26116
+ for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
26117
+ var before = (i$6 ? types[i$6-1] : outerType) == "L";
26118
+ var after = (end$1 < len ? types[end$1] : outerType) == "L";
26119
+ var replace$1 = before == after ? (before ? "L" : "R") : outerType;
26120
+ for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
26121
+ i$6 = end$1 - 1;
26122
+ }
26123
+ }
26124
+
26125
+ // Here we depart from the documented algorithm, in order to avoid
26126
+ // building up an actual levels array. Since there are only three
26127
+ // levels (0, 1, 2) in an implementation that doesn't take
26128
+ // explicit embedding into account, we can build up the order on
26129
+ // the fly, without following the level-based algorithm.
26130
+ var order = [], m;
26131
+ for (var i$7 = 0; i$7 < len;) {
26132
+ if (countsAsLeft.test(types[i$7])) {
26133
+ var start = i$7;
26134
+ for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
26135
+ order.push(new BidiSpan(0, start, i$7));
26136
+ } else {
26137
+ var pos = i$7, at = order.length, isRTL = direction == "rtl" ? 1 : 0;
26138
+ for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
26139
+ for (var j$2 = pos; j$2 < i$7;) {
26140
+ if (countsAsNum.test(types[j$2])) {
26141
+ if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); at += isRTL; }
26142
+ var nstart = j$2;
26143
+ for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
26144
+ order.splice(at, 0, new BidiSpan(2, nstart, j$2));
26145
+ at += isRTL;
26146
+ pos = j$2;
26147
+ } else { ++j$2; }
26148
+ }
26149
+ if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
26150
+ }
26151
+ }
26152
+ if (direction == "ltr") {
26153
+ if (order[0].level == 1 && (m = str.match(/^\s+/))) {
26154
+ order[0].from = m[0].length;
26155
+ order.unshift(new BidiSpan(0, 0, m[0].length));
26156
+ }
26157
+ if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
26158
+ lst(order).to -= m[0].length;
26159
+ order.push(new BidiSpan(0, len - m[0].length, len));
26160
+ }
26161
+ }
26162
+
26163
+ return direction == "rtl" ? order.reverse() : order
26164
+ }
26165
+ })();
26166
+
26167
+ // Get the bidi ordering for the given line (and cache it). Returns
26168
+ // false for lines that are fully left-to-right, and an array of
26169
+ // BidiSpan objects otherwise.
26170
+ function getOrder(line, direction) {
26171
+ var order = line.order;
26172
+ if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
26173
+ return order
26174
+ }
26175
+
26176
+ // EVENT HANDLING
26177
+
26178
+ // Lightweight event framework. on/off also work on DOM nodes,
26179
+ // registering native DOM handlers.
26180
+
26181
+ var noHandlers = [];
26182
+
26183
+ var on = function(emitter, type, f) {
26184
+ if (emitter.addEventListener) {
26185
+ emitter.addEventListener(type, f, false);
26186
+ } else if (emitter.attachEvent) {
26187
+ emitter.attachEvent("on" + type, f);
26188
+ } else {
26189
+ var map = emitter._handlers || (emitter._handlers = {});
26190
+ map[type] = (map[type] || noHandlers).concat(f);
26191
+ }
26192
+ };
26193
+
26194
+ function getHandlers(emitter, type) {
26195
+ return emitter._handlers && emitter._handlers[type] || noHandlers
26196
+ }
26197
+
26198
+ function off(emitter, type, f) {
26199
+ if (emitter.removeEventListener) {
26200
+ emitter.removeEventListener(type, f, false);
26201
+ } else if (emitter.detachEvent) {
26202
+ emitter.detachEvent("on" + type, f);
26203
+ } else {
26204
+ var map = emitter._handlers, arr = map && map[type];
26205
+ if (arr) {
26206
+ var index = indexOf(arr, f);
26207
+ if (index > -1)
26208
+ { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
26209
+ }
26210
+ }
26211
+ }
26212
+
26213
+ function signal(emitter, type /*, values...*/) {
26214
+ var handlers = getHandlers(emitter, type);
26215
+ if (!handlers.length) { return }
26216
+ var args = Array.prototype.slice.call(arguments, 2);
26217
+ for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
26218
+ }
26219
+
26220
+ // The DOM events that CodeMirror handles can be overridden by
26221
+ // registering a (non-DOM) handler on the editor for the event name,
26222
+ // and preventDefault-ing the event in that handler.
26223
+ function signalDOMEvent(cm, e, override) {
26224
+ if (typeof e == "string")
26225
+ { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
26226
+ signal(cm, override || e.type, cm, e);
26227
+ return e_defaultPrevented(e) || e.codemirrorIgnore
26228
+ }
26229
+
26230
+ function signalCursorActivity(cm) {
26231
+ var arr = cm._handlers && cm._handlers.cursorActivity;
26232
+ if (!arr) { return }
26233
+ var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
26234
+ for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
26235
+ { set.push(arr[i]); } }
26236
+ }
26237
+
26238
+ function hasHandler(emitter, type) {
26239
+ return getHandlers(emitter, type).length > 0
26240
+ }
26241
+
26242
+ // Add on and off methods to a constructor's prototype, to make
26243
+ // registering events on such objects more convenient.
26244
+ function eventMixin(ctor) {
26245
+ ctor.prototype.on = function(type, f) {on(this, type, f);};
26246
+ ctor.prototype.off = function(type, f) {off(this, type, f);};
26247
+ }
26248
+
26249
+ // Due to the fact that we still support jurassic IE versions, some
26250
+ // compatibility wrappers are needed.
26251
+
26252
+ function e_preventDefault(e) {
26253
+ if (e.preventDefault) { e.preventDefault(); }
26254
+ else { e.returnValue = false; }
26255
+ }
26256
+ function e_stopPropagation(e) {
26257
+ if (e.stopPropagation) { e.stopPropagation(); }
26258
+ else { e.cancelBubble = true; }
26259
+ }
26260
+ function e_defaultPrevented(e) {
26261
+ return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
26262
+ }
26263
+ function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
26264
+
26265
+ function e_target(e) {return e.target || e.srcElement}
26266
+ function e_button(e) {
26267
+ var b = e.which;
26268
+ if (b == null) {
26269
+ if (e.button & 1) { b = 1; }
26270
+ else if (e.button & 2) { b = 3; }
26271
+ else if (e.button & 4) { b = 2; }
26272
+ }
26273
+ if (mac && e.ctrlKey && b == 1) { b = 3; }
26274
+ return b
26275
+ }
26276
+
26277
+ // Detect drag-and-drop
26278
+ var dragAndDrop = function() {
26279
+ // There is *some* kind of drag-and-drop support in IE6-8, but I
26280
+ // couldn't get it to work yet.
26281
+ if (ie && ie_version < 9) { return false }
26282
+ var div = elt('div');
26283
+ return "draggable" in div || "dragDrop" in div
26284
+ }();
26285
+
26286
+ var zwspSupported;
26287
+ function zeroWidthElement(measure) {
26288
+ if (zwspSupported == null) {
26289
+ var test = elt("span", "\u200b");
26290
+ removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
26291
+ if (measure.firstChild.offsetHeight != 0)
26292
+ { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
26293
+ }
26294
+ var node = zwspSupported ? elt("span", "\u200b") :
26295
+ elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
26296
+ node.setAttribute("cm-text", "");
26297
+ return node
26298
+ }
26299
+
26300
+ // Feature-detect IE's crummy client rect reporting for bidi text
26301
+ var badBidiRects;
26302
+ function hasBadBidiRects(measure) {
26303
+ if (badBidiRects != null) { return badBidiRects }
26304
+ var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
26305
+ var r0 = range(txt, 0, 1).getBoundingClientRect();
26306
+ var r1 = range(txt, 1, 2).getBoundingClientRect();
26307
+ removeChildren(measure);
26308
+ if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
26309
+ return badBidiRects = (r1.right - r0.right < 3)
26310
+ }
26311
+
26312
+ // See if "".split is the broken IE version, if so, provide an
26313
+ // alternative way to split lines.
26314
+ var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
26315
+ var pos = 0, result = [], l = string.length;
26316
+ while (pos <= l) {
26317
+ var nl = string.indexOf("\n", pos);
26318
+ if (nl == -1) { nl = string.length; }
26319
+ var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
26320
+ var rt = line.indexOf("\r");
26321
+ if (rt != -1) {
26322
+ result.push(line.slice(0, rt));
26323
+ pos += rt + 1;
26324
+ } else {
26325
+ result.push(line);
26326
+ pos = nl + 1;
26327
+ }
26328
+ }
26329
+ return result
26330
+ } : function (string) { return string.split(/\r\n?|\n/); };
26331
+
26332
+ var hasSelection = window.getSelection ? function (te) {
26333
+ try { return te.selectionStart != te.selectionEnd }
26334
+ catch(e) { return false }
26335
+ } : function (te) {
26336
+ var range;
26337
+ try {range = te.ownerDocument.selection.createRange();}
26338
+ catch(e) {}
26339
+ if (!range || range.parentElement() != te) { return false }
26340
+ return range.compareEndPoints("StartToEnd", range) != 0
26341
+ };
26342
+
26343
+ var hasCopyEvent = (function () {
26344
+ var e = elt("div");
26345
+ if ("oncopy" in e) { return true }
26346
+ e.setAttribute("oncopy", "return;");
26347
+ return typeof e.oncopy == "function"
26348
+ })();
26349
+
26350
+ var badZoomedRects = null;
26351
+ function hasBadZoomedRects(measure) {
26352
+ if (badZoomedRects != null) { return badZoomedRects }
26353
+ var node = removeChildrenAndAdd(measure, elt("span", "x"));
26354
+ var normal = node.getBoundingClientRect();
26355
+ var fromRange = range(node, 0, 1).getBoundingClientRect();
26356
+ return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
26357
+ }
26358
+
26359
+ // Known modes, by name and by MIME
26360
+ var modes = {}, mimeModes = {};
26361
+
26362
+ // Extra arguments are stored as the mode's dependencies, which is
26363
+ // used by (legacy) mechanisms like loadmode.js to automatically
26364
+ // load a mode. (Preferred mechanism is the require/define calls.)
26365
+ function defineMode(name, mode) {
26366
+ if (arguments.length > 2)
26367
+ { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
26368
+ modes[name] = mode;
26369
+ }
26370
+
26371
+ function defineMIME(mime, spec) {
26372
+ mimeModes[mime] = spec;
26373
+ }
26374
+
26375
+ // Given a MIME type, a {name, ...options} config object, or a name
26376
+ // string, return a mode config object.
26377
+ function resolveMode(spec) {
26378
+ if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
26379
+ spec = mimeModes[spec];
26380
+ } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
26381
+ var found = mimeModes[spec.name];
26382
+ if (typeof found == "string") { found = {name: found}; }
26383
+ spec = createObj(found, spec);
26384
+ spec.name = found.name;
26385
+ } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
26386
+ return resolveMode("application/xml")
26387
+ } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
26388
+ return resolveMode("application/json")
26389
+ }
26390
+ if (typeof spec == "string") { return {name: spec} }
26391
+ else { return spec || {name: "null"} }
26392
+ }
26393
+
26394
+ // Given a mode spec (anything that resolveMode accepts), find and
26395
+ // initialize an actual mode object.
26396
+ function getMode(options, spec) {
26397
+ spec = resolveMode(spec);
26398
+ var mfactory = modes[spec.name];
26399
+ if (!mfactory) { return getMode(options, "text/plain") }
26400
+ var modeObj = mfactory(options, spec);
26401
+ if (modeExtensions.hasOwnProperty(spec.name)) {
26402
+ var exts = modeExtensions[spec.name];
26403
+ for (var prop in exts) {
26404
+ if (!exts.hasOwnProperty(prop)) { continue }
26405
+ if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
26406
+ modeObj[prop] = exts[prop];
26407
+ }
26408
+ }
26409
+ modeObj.name = spec.name;
26410
+ if (spec.helperType) { modeObj.helperType = spec.helperType; }
26411
+ if (spec.modeProps) { for (var prop$1 in spec.modeProps)
26412
+ { modeObj[prop$1] = spec.modeProps[prop$1]; } }
26413
+
26414
+ return modeObj
26415
+ }
26416
+
26417
+ // This can be used to attach properties to mode objects from
26418
+ // outside the actual mode definition.
26419
+ var modeExtensions = {};
26420
+ function extendMode(mode, properties) {
26421
+ var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
26422
+ copyObj(properties, exts);
26423
+ }
26424
+
26425
+ function copyState(mode, state) {
26426
+ if (state === true) { return state }
26427
+ if (mode.copyState) { return mode.copyState(state) }
26428
+ var nstate = {};
26429
+ for (var n in state) {
26430
+ var val = state[n];
26431
+ if (val instanceof Array) { val = val.concat([]); }
26432
+ nstate[n] = val;
26433
+ }
26434
+ return nstate
26435
+ }
26436
+
26437
+ // Given a mode and a state (for that mode), find the inner mode and
26438
+ // state at the position that the state refers to.
26439
+ function innerMode(mode, state) {
26440
+ var info;
26441
+ while (mode.innerMode) {
26442
+ info = mode.innerMode(state);
26443
+ if (!info || info.mode == mode) { break }
26444
+ state = info.state;
26445
+ mode = info.mode;
26446
+ }
26447
+ return info || {mode: mode, state: state}
26448
+ }
26449
+
26450
+ function startState(mode, a1, a2) {
26451
+ return mode.startState ? mode.startState(a1, a2) : true
26452
+ }
26453
+
26454
+ // STRING STREAM
26455
+
26456
+ // Fed to the mode parsers, provides helper functions to make
26457
+ // parsers more succinct.
26458
+
26459
+ var StringStream = function(string, tabSize, lineOracle) {
26460
+ this.pos = this.start = 0;
26461
+ this.string = string;
26462
+ this.tabSize = tabSize || 8;
26463
+ this.lastColumnPos = this.lastColumnValue = 0;
26464
+ this.lineStart = 0;
26465
+ this.lineOracle = lineOracle;
26466
+ };
26467
+
26468
+ StringStream.prototype.eol = function () {return this.pos >= this.string.length};
26469
+ StringStream.prototype.sol = function () {return this.pos == this.lineStart};
26470
+ StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
26471
+ StringStream.prototype.next = function () {
26472
+ if (this.pos < this.string.length)
26473
+ { return this.string.charAt(this.pos++) }
26474
+ };
26475
+ StringStream.prototype.eat = function (match) {
26476
+ var ch = this.string.charAt(this.pos);
26477
+ var ok;
26478
+ if (typeof match == "string") { ok = ch == match; }
26479
+ else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
26480
+ if (ok) {++this.pos; return ch}
26481
+ };
26482
+ StringStream.prototype.eatWhile = function (match) {
26483
+ var start = this.pos;
26484
+ while (this.eat(match)){}
26485
+ return this.pos > start
26486
+ };
26487
+ StringStream.prototype.eatSpace = function () {
26488
+ var start = this.pos;
26489
+ while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }
26490
+ return this.pos > start
26491
+ };
26492
+ StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
26493
+ StringStream.prototype.skipTo = function (ch) {
26494
+ var found = this.string.indexOf(ch, this.pos);
26495
+ if (found > -1) {this.pos = found; return true}
26496
+ };
26497
+ StringStream.prototype.backUp = function (n) {this.pos -= n;};
26498
+ StringStream.prototype.column = function () {
26499
+ if (this.lastColumnPos < this.start) {
26500
+ this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
26501
+ this.lastColumnPos = this.start;
26502
+ }
26503
+ return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
26504
+ };
26505
+ StringStream.prototype.indentation = function () {
26506
+ return countColumn(this.string, null, this.tabSize) -
26507
+ (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
26508
+ };
26509
+ StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
26510
+ if (typeof pattern == "string") {
26511
+ var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
26512
+ var substr = this.string.substr(this.pos, pattern.length);
26513
+ if (cased(substr) == cased(pattern)) {
26514
+ if (consume !== false) { this.pos += pattern.length; }
26515
+ return true
26516
+ }
26517
+ } else {
26518
+ var match = this.string.slice(this.pos).match(pattern);
26519
+ if (match && match.index > 0) { return null }
26520
+ if (match && consume !== false) { this.pos += match[0].length; }
26521
+ return match
26522
+ }
26523
+ };
26524
+ StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
26525
+ StringStream.prototype.hideFirstChars = function (n, inner) {
26526
+ this.lineStart += n;
26527
+ try { return inner() }
26528
+ finally { this.lineStart -= n; }
26529
+ };
26530
+ StringStream.prototype.lookAhead = function (n) {
26531
+ var oracle = this.lineOracle;
26532
+ return oracle && oracle.lookAhead(n)
26533
+ };
26534
+ StringStream.prototype.baseToken = function () {
26535
+ var oracle = this.lineOracle;
26536
+ return oracle && oracle.baseToken(this.pos)
26537
+ };
26538
+
26539
+ // Find the line object corresponding to the given line number.
26540
+ function getLine(doc, n) {
26541
+ n -= doc.first;
26542
+ if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
26543
+ var chunk = doc;
26544
+ while (!chunk.lines) {
26545
+ for (var i = 0;; ++i) {
26546
+ var child = chunk.children[i], sz = child.chunkSize();
26547
+ if (n < sz) { chunk = child; break }
26548
+ n -= sz;
26549
+ }
26550
+ }
26551
+ return chunk.lines[n]
26552
+ }
26553
+
26554
+ // Get the part of a document between two positions, as an array of
26555
+ // strings.
26556
+ function getBetween(doc, start, end) {
26557
+ var out = [], n = start.line;
26558
+ doc.iter(start.line, end.line + 1, function (line) {
26559
+ var text = line.text;
26560
+ if (n == end.line) { text = text.slice(0, end.ch); }
26561
+ if (n == start.line) { text = text.slice(start.ch); }
26562
+ out.push(text);
26563
+ ++n;
26564
+ });
26565
+ return out
26566
+ }
26567
+ // Get the lines between from and to, as array of strings.
26568
+ function getLines(doc, from, to) {
26569
+ var out = [];
26570
+ doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
26571
+ return out
26572
+ }
26573
+
26574
+ // Update the height of a line, propagating the height change
26575
+ // upwards to parent nodes.
26576
+ function updateLineHeight(line, height) {
26577
+ var diff = height - line.height;
26578
+ if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
26579
+ }
26580
+
26581
+ // Given a line object, find its line number by walking up through
26582
+ // its parent links.
26583
+ function lineNo(line) {
26584
+ if (line.parent == null) { return null }
26585
+ var cur = line.parent, no = indexOf(cur.lines, line);
26586
+ for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
26587
+ for (var i = 0;; ++i) {
26588
+ if (chunk.children[i] == cur) { break }
26589
+ no += chunk.children[i].chunkSize();
26590
+ }
26591
+ }
26592
+ return no + cur.first
26593
+ }
26594
+
26595
+ // Find the line at the given vertical position, using the height
26596
+ // information in the document tree.
26597
+ function lineAtHeight(chunk, h) {
26598
+ var n = chunk.first;
26599
+ outer: do {
26600
+ for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
26601
+ var child = chunk.children[i$1], ch = child.height;
26602
+ if (h < ch) { chunk = child; continue outer }
26603
+ h -= ch;
26604
+ n += child.chunkSize();
26605
+ }
26606
+ return n
26607
+ } while (!chunk.lines)
26608
+ var i = 0;
26609
+ for (; i < chunk.lines.length; ++i) {
26610
+ var line = chunk.lines[i], lh = line.height;
26611
+ if (h < lh) { break }
26612
+ h -= lh;
26613
+ }
26614
+ return n + i
26615
+ }
26616
+
26617
+ function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
26618
+
26619
+ function lineNumberFor(options, i) {
26620
+ return String(options.lineNumberFormatter(i + options.firstLineNumber))
26621
+ }
26622
+
26623
+ // A Pos instance represents a position within the text.
26624
+ function Pos(line, ch, sticky) {
26625
+ if ( sticky === void 0 ) sticky = null;
26626
+
26627
+ if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
26628
+ this.line = line;
26629
+ this.ch = ch;
26630
+ this.sticky = sticky;
26631
+ }
26632
+
26633
+ // Compare two positions, return 0 if they are the same, a negative
26634
+ // number when a is less, and a positive number otherwise.
26635
+ function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
26636
+
26637
+ function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
26638
+
26639
+ function copyPos(x) {return Pos(x.line, x.ch)}
26640
+ function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
26641
+ function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
26642
+
26643
+ // Most of the external API clips given positions to make sure they
26644
+ // actually exist within the document.
26645
+ function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
26646
+ function clipPos(doc, pos) {
26647
+ if (pos.line < doc.first) { return Pos(doc.first, 0) }
26648
+ var last = doc.first + doc.size - 1;
26649
+ if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
26650
+ return clipToLen(pos, getLine(doc, pos.line).text.length)
26651
+ }
26652
+ function clipToLen(pos, linelen) {
26653
+ var ch = pos.ch;
26654
+ if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
26655
+ else if (ch < 0) { return Pos(pos.line, 0) }
26656
+ else { return pos }
26657
+ }
26658
+ function clipPosArray(doc, array) {
26659
+ var out = [];
26660
+ for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
26661
+ return out
26662
+ }
26663
+
26664
+ var SavedContext = function(state, lookAhead) {
26665
+ this.state = state;
26666
+ this.lookAhead = lookAhead;
26667
+ };
26668
+
26669
+ var Context = function(doc, state, line, lookAhead) {
26670
+ this.state = state;
26671
+ this.doc = doc;
26672
+ this.line = line;
26673
+ this.maxLookAhead = lookAhead || 0;
26674
+ this.baseTokens = null;
26675
+ this.baseTokenPos = 1;
26676
+ };
26677
+
26678
+ Context.prototype.lookAhead = function (n) {
26679
+ var line = this.doc.getLine(this.line + n);
26680
+ if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }
26681
+ return line
26682
+ };
26683
+
26684
+ Context.prototype.baseToken = function (n) {
26685
+ if (!this.baseTokens) { return null }
26686
+ while (this.baseTokens[this.baseTokenPos] <= n)
26687
+ { this.baseTokenPos += 2; }
26688
+ var type = this.baseTokens[this.baseTokenPos + 1];
26689
+ return {type: type && type.replace(/( |^)overlay .*/, ""),
26690
+ size: this.baseTokens[this.baseTokenPos] - n}
26691
+ };
26692
+
26693
+ Context.prototype.nextLine = function () {
26694
+ this.line++;
26695
+ if (this.maxLookAhead > 0) { this.maxLookAhead--; }
26696
+ };
26697
+
26698
+ Context.fromSaved = function (doc, saved, line) {
26699
+ if (saved instanceof SavedContext)
26700
+ { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }
26701
+ else
26702
+ { return new Context(doc, copyState(doc.mode, saved), line) }
26703
+ };
26704
+
26705
+ Context.prototype.save = function (copy) {
26706
+ var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;
26707
+ return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state
26708
+ };
26709
+
26710
+
26711
+ // Compute a style array (an array starting with a mode generation
26712
+ // -- for invalidation -- followed by pairs of end positions and
26713
+ // style strings), which is used to highlight the tokens on the
26714
+ // line.
26715
+ function highlightLine(cm, line, context, forceToEnd) {
26716
+ // A styles array always starts with a number identifying the
26717
+ // mode/overlays that it is based on (for easy invalidation).
26718
+ var st = [cm.state.modeGen], lineClasses = {};
26719
+ // Compute the base array of styles
26720
+ runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },
26721
+ lineClasses, forceToEnd);
26722
+ var state = context.state;
26723
+
26724
+ // Run overlays, adjust style array.
26725
+ var loop = function ( o ) {
26726
+ context.baseTokens = st;
26727
+ var overlay = cm.state.overlays[o], i = 1, at = 0;
26728
+ context.state = true;
26729
+ runMode(cm, line.text, overlay.mode, context, function (end, style) {
26730
+ var start = i;
26731
+ // Ensure there's a token end at the current position, and that i points at it
26732
+ while (at < end) {
26733
+ var i_end = st[i];
26734
+ if (i_end > end)
26735
+ { st.splice(i, 1, end, st[i+1], i_end); }
26736
+ i += 2;
26737
+ at = Math.min(end, i_end);
26738
+ }
26739
+ if (!style) { return }
26740
+ if (overlay.opaque) {
26741
+ st.splice(start, i - start, end, "overlay " + style);
26742
+ i = start + 2;
26743
+ } else {
26744
+ for (; start < i; start += 2) {
26745
+ var cur = st[start+1];
26746
+ st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
26747
+ }
26748
+ }
26749
+ }, lineClasses);
26750
+ context.state = state;
26751
+ context.baseTokens = null;
26752
+ context.baseTokenPos = 1;
26753
+ };
26754
+
26755
+ for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
26756
+
26757
+ return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
26758
+ }
26759
+
26760
+ function getLineStyles(cm, line, updateFrontier) {
26761
+ if (!line.styles || line.styles[0] != cm.state.modeGen) {
26762
+ var context = getContextBefore(cm, lineNo(line));
26763
+ var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);
26764
+ var result = highlightLine(cm, line, context);
26765
+ if (resetState) { context.state = resetState; }
26766
+ line.stateAfter = context.save(!resetState);
26767
+ line.styles = result.styles;
26768
+ if (result.classes) { line.styleClasses = result.classes; }
26769
+ else if (line.styleClasses) { line.styleClasses = null; }
26770
+ if (updateFrontier === cm.doc.highlightFrontier)
26771
+ { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }
26772
+ }
26773
+ return line.styles
26774
+ }
26775
+
26776
+ function getContextBefore(cm, n, precise) {
26777
+ var doc = cm.doc, display = cm.display;
26778
+ if (!doc.mode.startState) { return new Context(doc, true, n) }
26779
+ var start = findStartLine(cm, n, precise);
26780
+ var saved = start > doc.first && getLine(doc, start - 1).stateAfter;
26781
+ var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);
26782
+
26783
+ doc.iter(start, n, function (line) {
26784
+ processLine(cm, line.text, context);
26785
+ var pos = context.line;
26786
+ line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;
26787
+ context.nextLine();
26788
+ });
26789
+ if (precise) { doc.modeFrontier = context.line; }
26790
+ return context
26791
+ }
26792
+
26793
+ // Lightweight form of highlight -- proceed over this line and
26794
+ // update state, but don't save a style array. Used for lines that
26795
+ // aren't currently visible.
26796
+ function processLine(cm, text, context, startAt) {
26797
+ var mode = cm.doc.mode;
26798
+ var stream = new StringStream(text, cm.options.tabSize, context);
26799
+ stream.start = stream.pos = startAt || 0;
26800
+ if (text == "") { callBlankLine(mode, context.state); }
26801
+ while (!stream.eol()) {
26802
+ readToken(mode, stream, context.state);
26803
+ stream.start = stream.pos;
26804
+ }
26805
+ }
26806
+
26807
+ function callBlankLine(mode, state) {
26808
+ if (mode.blankLine) { return mode.blankLine(state) }
26809
+ if (!mode.innerMode) { return }
26810
+ var inner = innerMode(mode, state);
26811
+ if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
26812
+ }
26813
+
26814
+ function readToken(mode, stream, state, inner) {
26815
+ for (var i = 0; i < 10; i++) {
26816
+ if (inner) { inner[0] = innerMode(mode, state).mode; }
26817
+ var style = mode.token(stream, state);
26818
+ if (stream.pos > stream.start) { return style }
26819
+ }
26820
+ throw new Error("Mode " + mode.name + " failed to advance stream.")
26821
+ }
26822
+
26823
+ var Token = function(stream, type, state) {
26824
+ this.start = stream.start; this.end = stream.pos;
26825
+ this.string = stream.current();
26826
+ this.type = type || null;
26827
+ this.state = state;
26828
+ };
26829
+
26830
+ // Utility for getTokenAt and getLineTokens
26831
+ function takeToken(cm, pos, precise, asArray) {
26832
+ var doc = cm.doc, mode = doc.mode, style;
26833
+ pos = clipPos(doc, pos);
26834
+ var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);
26835
+ var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;
26836
+ if (asArray) { tokens = []; }
26837
+ while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
26838
+ stream.start = stream.pos;
26839
+ style = readToken(mode, stream, context.state);
26840
+ if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }
26841
+ }
26842
+ return asArray ? tokens : new Token(stream, style, context.state)
26843
+ }
26844
+
26845
+ function extractLineClasses(type, output) {
26846
+ if (type) { for (;;) {
26847
+ var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
26848
+ if (!lineClass) { break }
26849
+ type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
26850
+ var prop = lineClass[1] ? "bgClass" : "textClass";
26851
+ if (output[prop] == null)
26852
+ { output[prop] = lineClass[2]; }
26853
+ else if (!(new RegExp("(?:^|\\s)" + lineClass[2] + "(?:$|\\s)")).test(output[prop]))
26854
+ { output[prop] += " " + lineClass[2]; }
26855
+ } }
26856
+ return type
26857
+ }
26858
+
26859
+ // Run the given mode's parser over a line, calling f for each token.
26860
+ function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
26861
+ var flattenSpans = mode.flattenSpans;
26862
+ if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
26863
+ var curStart = 0, curStyle = null;
26864
+ var stream = new StringStream(text, cm.options.tabSize, context), style;
26865
+ var inner = cm.options.addModeClass && [null];
26866
+ if (text == "") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }
26867
+ while (!stream.eol()) {
26868
+ if (stream.pos > cm.options.maxHighlightLength) {
26869
+ flattenSpans = false;
26870
+ if (forceToEnd) { processLine(cm, text, context, stream.pos); }
26871
+ stream.pos = text.length;
26872
+ style = null;
26873
+ } else {
26874
+ style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);
26875
+ }
26876
+ if (inner) {
26877
+ var mName = inner[0].name;
26878
+ if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
26879
+ }
26880
+ if (!flattenSpans || curStyle != style) {
26881
+ while (curStart < stream.start) {
26882
+ curStart = Math.min(stream.start, curStart + 5000);
26883
+ f(curStart, curStyle);
26884
+ }
26885
+ curStyle = style;
26886
+ }
26887
+ stream.start = stream.pos;
26888
+ }
26889
+ while (curStart < stream.pos) {
26890
+ // Webkit seems to refuse to render text nodes longer than 57444
26891
+ // characters, and returns inaccurate measurements in nodes
26892
+ // starting around 5000 chars.
26893
+ var pos = Math.min(stream.pos, curStart + 5000);
26894
+ f(pos, curStyle);
26895
+ curStart = pos;
26896
+ }
26897
+ }
26898
+
26899
+ // Finds the line to start with when starting a parse. Tries to
26900
+ // find a line with a stateAfter, so that it can start with a
26901
+ // valid state. If that fails, it returns the line with the
26902
+ // smallest indentation, which tends to need the least context to
26903
+ // parse correctly.
26904
+ function findStartLine(cm, n, precise) {
26905
+ var minindent, minline, doc = cm.doc;
26906
+ var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
26907
+ for (var search = n; search > lim; --search) {
26908
+ if (search <= doc.first) { return doc.first }
26909
+ var line = getLine(doc, search - 1), after = line.stateAfter;
26910
+ if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))
26911
+ { return search }
26912
+ var indented = countColumn(line.text, null, cm.options.tabSize);
26913
+ if (minline == null || minindent > indented) {
26914
+ minline = search - 1;
26915
+ minindent = indented;
26916
+ }
26917
+ }
26918
+ return minline
26919
+ }
26920
+
26921
+ function retreatFrontier(doc, n) {
26922
+ doc.modeFrontier = Math.min(doc.modeFrontier, n);
26923
+ if (doc.highlightFrontier < n - 10) { return }
26924
+ var start = doc.first;
26925
+ for (var line = n - 1; line > start; line--) {
26926
+ var saved = getLine(doc, line).stateAfter;
26927
+ // change is on 3
26928
+ // state on line 1 looked ahead 2 -- so saw 3
26929
+ // test 1 + 2 < 3 should cover this
26930
+ if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {
26931
+ start = line + 1;
26932
+ break
26933
+ }
26934
+ }
26935
+ doc.highlightFrontier = Math.min(doc.highlightFrontier, start);
26936
+ }
26937
+
26938
+ // Optimize some code when these features are not used.
26939
+ var sawReadOnlySpans = false, sawCollapsedSpans = false;
26940
+
26941
+ function seeReadOnlySpans() {
26942
+ sawReadOnlySpans = true;
26943
+ }
26944
+
26945
+ function seeCollapsedSpans() {
26946
+ sawCollapsedSpans = true;
26947
+ }
26948
+
26949
+ // TEXTMARKER SPANS
26950
+
26951
+ function MarkedSpan(marker, from, to) {
26952
+ this.marker = marker;
26953
+ this.from = from; this.to = to;
26954
+ }
26955
+
26956
+ // Search an array of spans for a span matching the given marker.
26957
+ function getMarkedSpanFor(spans, marker) {
26958
+ if (spans) { for (var i = 0; i < spans.length; ++i) {
26959
+ var span = spans[i];
26960
+ if (span.marker == marker) { return span }
26961
+ } }
26962
+ }
26963
+ // Remove a span from an array, returning undefined if no spans are
26964
+ // left (we don't store arrays for lines without spans).
26965
+ function removeMarkedSpan(spans, span) {
26966
+ var r;
26967
+ for (var i = 0; i < spans.length; ++i)
26968
+ { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
26969
+ return r
26970
+ }
26971
+ // Add a span to a line.
26972
+ function addMarkedSpan(line, span) {
26973
+ line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
26974
+ span.marker.attachLine(line);
26975
+ }
26976
+
26977
+ // Used for the algorithm that adjusts markers for a change in the
26978
+ // document. These functions cut an array of spans at a given
26979
+ // character position, returning an array of remaining chunks (or
26980
+ // undefined if nothing remains).
26981
+ function markedSpansBefore(old, startCh, isInsert) {
26982
+ var nw;
26983
+ if (old) { for (var i = 0; i < old.length; ++i) {
26984
+ var span = old[i], marker = span.marker;
26985
+ var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
26986
+ if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
26987
+ var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
26988
+ ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
26989
+ }
26990
+ } }
26991
+ return nw
26992
+ }
26993
+ function markedSpansAfter(old, endCh, isInsert) {
26994
+ var nw;
26995
+ if (old) { for (var i = 0; i < old.length; ++i) {
26996
+ var span = old[i], marker = span.marker;
26997
+ var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
26998
+ if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
26999
+ var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
27000
+ ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
27001
+ span.to == null ? null : span.to - endCh));
27002
+ }
27003
+ } }
27004
+ return nw
27005
+ }
27006
+
27007
+ // Given a change object, compute the new set of marker spans that
27008
+ // cover the line in which the change took place. Removes spans
27009
+ // entirely within the change, reconnects spans belonging to the
27010
+ // same marker that appear on both sides of the change, and cuts off
27011
+ // spans partially within the change. Returns an array of span
27012
+ // arrays with one element for each line in (after) the change.
27013
+ function stretchSpansOverChange(doc, change) {
27014
+ if (change.full) { return null }
27015
+ var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
27016
+ var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
27017
+ if (!oldFirst && !oldLast) { return null }
27018
+
27019
+ var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
27020
+ // Get the spans that 'stick out' on both sides
27021
+ var first = markedSpansBefore(oldFirst, startCh, isInsert);
27022
+ var last = markedSpansAfter(oldLast, endCh, isInsert);
27023
+
27024
+ // Next, merge those two ends
27025
+ var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
27026
+ if (first) {
27027
+ // Fix up .to properties of first
27028
+ for (var i = 0; i < first.length; ++i) {
27029
+ var span = first[i];
27030
+ if (span.to == null) {
27031
+ var found = getMarkedSpanFor(last, span.marker);
27032
+ if (!found) { span.to = startCh; }
27033
+ else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
27034
+ }
27035
+ }
27036
+ }
27037
+ if (last) {
27038
+ // Fix up .from in last (or move them into first in case of sameLine)
27039
+ for (var i$1 = 0; i$1 < last.length; ++i$1) {
27040
+ var span$1 = last[i$1];
27041
+ if (span$1.to != null) { span$1.to += offset; }
27042
+ if (span$1.from == null) {
27043
+ var found$1 = getMarkedSpanFor(first, span$1.marker);
27044
+ if (!found$1) {
27045
+ span$1.from = offset;
27046
+ if (sameLine) { (first || (first = [])).push(span$1); }
27047
+ }
27048
+ } else {
27049
+ span$1.from += offset;
27050
+ if (sameLine) { (first || (first = [])).push(span$1); }
27051
+ }
27052
+ }
27053
+ }
27054
+ // Make sure we didn't create any zero-length spans
27055
+ if (first) { first = clearEmptySpans(first); }
27056
+ if (last && last != first) { last = clearEmptySpans(last); }
27057
+
27058
+ var newMarkers = [first];
27059
+ if (!sameLine) {
27060
+ // Fill gap with whole-line-spans
27061
+ var gap = change.text.length - 2, gapMarkers;
27062
+ if (gap > 0 && first)
27063
+ { for (var i$2 = 0; i$2 < first.length; ++i$2)
27064
+ { if (first[i$2].to == null)
27065
+ { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
27066
+ for (var i$3 = 0; i$3 < gap; ++i$3)
27067
+ { newMarkers.push(gapMarkers); }
27068
+ newMarkers.push(last);
27069
+ }
27070
+ return newMarkers
27071
+ }
27072
+
27073
+ // Remove spans that are empty and don't have a clearWhenEmpty
27074
+ // option of false.
27075
+ function clearEmptySpans(spans) {
27076
+ for (var i = 0; i < spans.length; ++i) {
27077
+ var span = spans[i];
27078
+ if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
27079
+ { spans.splice(i--, 1); }
27080
+ }
27081
+ if (!spans.length) { return null }
27082
+ return spans
27083
+ }
27084
+
27085
+ // Used to 'clip' out readOnly ranges when making a change.
27086
+ function removeReadOnlyRanges(doc, from, to) {
27087
+ var markers = null;
27088
+ doc.iter(from.line, to.line + 1, function (line) {
27089
+ if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
27090
+ var mark = line.markedSpans[i].marker;
27091
+ if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
27092
+ { (markers || (markers = [])).push(mark); }
27093
+ } }
27094
+ });
27095
+ if (!markers) { return null }
27096
+ var parts = [{from: from, to: to}];
27097
+ for (var i = 0; i < markers.length; ++i) {
27098
+ var mk = markers[i], m = mk.find(0);
27099
+ for (var j = 0; j < parts.length; ++j) {
27100
+ var p = parts[j];
27101
+ if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
27102
+ var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
27103
+ if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
27104
+ { newParts.push({from: p.from, to: m.from}); }
27105
+ if (dto > 0 || !mk.inclusiveRight && !dto)
27106
+ { newParts.push({from: m.to, to: p.to}); }
27107
+ parts.splice.apply(parts, newParts);
27108
+ j += newParts.length - 3;
27109
+ }
27110
+ }
27111
+ return parts
27112
+ }
27113
+
27114
+ // Connect or disconnect spans from a line.
27115
+ function detachMarkedSpans(line) {
27116
+ var spans = line.markedSpans;
27117
+ if (!spans) { return }
27118
+ for (var i = 0; i < spans.length; ++i)
27119
+ { spans[i].marker.detachLine(line); }
27120
+ line.markedSpans = null;
27121
+ }
27122
+ function attachMarkedSpans(line, spans) {
27123
+ if (!spans) { return }
27124
+ for (var i = 0; i < spans.length; ++i)
27125
+ { spans[i].marker.attachLine(line); }
27126
+ line.markedSpans = spans;
27127
+ }
27128
+
27129
+ // Helpers used when computing which overlapping collapsed span
27130
+ // counts as the larger one.
27131
+ function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
27132
+ function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
27133
+
27134
+ // Returns a number indicating which of two overlapping collapsed
27135
+ // spans is larger (and thus includes the other). Falls back to
27136
+ // comparing ids when the spans cover exactly the same range.
27137
+ function compareCollapsedMarkers(a, b) {
27138
+ var lenDiff = a.lines.length - b.lines.length;
27139
+ if (lenDiff != 0) { return lenDiff }
27140
+ var aPos = a.find(), bPos = b.find();
27141
+ var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
27142
+ if (fromCmp) { return -fromCmp }
27143
+ var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
27144
+ if (toCmp) { return toCmp }
27145
+ return b.id - a.id
27146
+ }
27147
+
27148
+ // Find out whether a line ends or starts in a collapsed span. If
27149
+ // so, return the marker for that span.
27150
+ function collapsedSpanAtSide(line, start) {
27151
+ var sps = sawCollapsedSpans && line.markedSpans, found;
27152
+ if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
27153
+ sp = sps[i];
27154
+ if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
27155
+ (!found || compareCollapsedMarkers(found, sp.marker) < 0))
27156
+ { found = sp.marker; }
27157
+ } }
27158
+ return found
27159
+ }
27160
+ function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
27161
+ function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
27162
+
27163
+ function collapsedSpanAround(line, ch) {
27164
+ var sps = sawCollapsedSpans && line.markedSpans, found;
27165
+ if (sps) { for (var i = 0; i < sps.length; ++i) {
27166
+ var sp = sps[i];
27167
+ if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&
27168
+ (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }
27169
+ } }
27170
+ return found
27171
+ }
27172
+
27173
+ // Test whether there exists a collapsed span that partially
27174
+ // overlaps (covers the start or end, but not both) of a new span.
27175
+ // Such overlap is not allowed.
27176
+ function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
27177
+ var line = getLine(doc, lineNo);
27178
+ var sps = sawCollapsedSpans && line.markedSpans;
27179
+ if (sps) { for (var i = 0; i < sps.length; ++i) {
27180
+ var sp = sps[i];
27181
+ if (!sp.marker.collapsed) { continue }
27182
+ var found = sp.marker.find(0);
27183
+ var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
27184
+ var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
27185
+ if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
27186
+ if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
27187
+ fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
27188
+ { return true }
27189
+ } }
27190
+ }
27191
+
27192
+ // A visual line is a line as drawn on the screen. Folding, for
27193
+ // example, can cause multiple logical lines to appear on the same
27194
+ // visual line. This finds the start of the visual line that the
27195
+ // given line is part of (usually that is the line itself).
27196
+ function visualLine(line) {
27197
+ var merged;
27198
+ while (merged = collapsedSpanAtStart(line))
27199
+ { line = merged.find(-1, true).line; }
27200
+ return line
27201
+ }
27202
+
27203
+ function visualLineEnd(line) {
27204
+ var merged;
27205
+ while (merged = collapsedSpanAtEnd(line))
27206
+ { line = merged.find(1, true).line; }
27207
+ return line
27208
+ }
27209
+
27210
+ // Returns an array of logical lines that continue the visual line
27211
+ // started by the argument, or undefined if there are no such lines.
27212
+ function visualLineContinued(line) {
27213
+ var merged, lines;
27214
+ while (merged = collapsedSpanAtEnd(line)) {
27215
+ line = merged.find(1, true).line
27216
+ ;(lines || (lines = [])).push(line);
27217
+ }
27218
+ return lines
27219
+ }
27220
+
27221
+ // Get the line number of the start of the visual line that the
27222
+ // given line number is part of.
27223
+ function visualLineNo(doc, lineN) {
27224
+ var line = getLine(doc, lineN), vis = visualLine(line);
27225
+ if (line == vis) { return lineN }
27226
+ return lineNo(vis)
27227
+ }
27228
+
27229
+ // Get the line number of the start of the next visual line after
27230
+ // the given line.
27231
+ function visualLineEndNo(doc, lineN) {
27232
+ if (lineN > doc.lastLine()) { return lineN }
27233
+ var line = getLine(doc, lineN), merged;
27234
+ if (!lineIsHidden(doc, line)) { return lineN }
27235
+ while (merged = collapsedSpanAtEnd(line))
27236
+ { line = merged.find(1, true).line; }
27237
+ return lineNo(line) + 1
27238
+ }
27239
+
27240
+ // Compute whether a line is hidden. Lines count as hidden when they
27241
+ // are part of a visual line that starts with another line, or when
27242
+ // they are entirely covered by collapsed, non-widget span.
27243
+ function lineIsHidden(doc, line) {
27244
+ var sps = sawCollapsedSpans && line.markedSpans;
27245
+ if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
27246
+ sp = sps[i];
27247
+ if (!sp.marker.collapsed) { continue }
27248
+ if (sp.from == null) { return true }
27249
+ if (sp.marker.widgetNode) { continue }
27250
+ if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
27251
+ { return true }
27252
+ } }
27253
+ }
27254
+ function lineIsHiddenInner(doc, line, span) {
27255
+ if (span.to == null) {
27256
+ var end = span.marker.find(1, true);
27257
+ return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
27258
+ }
27259
+ if (span.marker.inclusiveRight && span.to == line.text.length)
27260
+ { return true }
27261
+ for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
27262
+ sp = line.markedSpans[i];
27263
+ if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
27264
+ (sp.to == null || sp.to != span.from) &&
27265
+ (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
27266
+ lineIsHiddenInner(doc, line, sp)) { return true }
27267
+ }
27268
+ }
27269
+
27270
+ // Find the height above the given line.
27271
+ function heightAtLine(lineObj) {
27272
+ lineObj = visualLine(lineObj);
27273
+
27274
+ var h = 0, chunk = lineObj.parent;
27275
+ for (var i = 0; i < chunk.lines.length; ++i) {
27276
+ var line = chunk.lines[i];
27277
+ if (line == lineObj) { break }
27278
+ else { h += line.height; }
27279
+ }
27280
+ for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
27281
+ for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
27282
+ var cur = p.children[i$1];
27283
+ if (cur == chunk) { break }
27284
+ else { h += cur.height; }
27285
+ }
27286
+ }
27287
+ return h
27288
+ }
27289
+
27290
+ // Compute the character length of a line, taking into account
27291
+ // collapsed ranges (see markText) that might hide parts, and join
27292
+ // other lines onto it.
27293
+ function lineLength(line) {
27294
+ if (line.height == 0) { return 0 }
27295
+ var len = line.text.length, merged, cur = line;
27296
+ while (merged = collapsedSpanAtStart(cur)) {
27297
+ var found = merged.find(0, true);
27298
+ cur = found.from.line;
27299
+ len += found.from.ch - found.to.ch;
27300
+ }
27301
+ cur = line;
27302
+ while (merged = collapsedSpanAtEnd(cur)) {
27303
+ var found$1 = merged.find(0, true);
27304
+ len -= cur.text.length - found$1.from.ch;
27305
+ cur = found$1.to.line;
27306
+ len += cur.text.length - found$1.to.ch;
27307
+ }
27308
+ return len
27309
+ }
27310
+
27311
+ // Find the longest line in the document.
27312
+ function findMaxLine(cm) {
27313
+ var d = cm.display, doc = cm.doc;
27314
+ d.maxLine = getLine(doc, doc.first);
27315
+ d.maxLineLength = lineLength(d.maxLine);
27316
+ d.maxLineChanged = true;
27317
+ doc.iter(function (line) {
27318
+ var len = lineLength(line);
27319
+ if (len > d.maxLineLength) {
27320
+ d.maxLineLength = len;
27321
+ d.maxLine = line;
27322
+ }
27323
+ });
27324
+ }
27325
+
27326
+ // LINE DATA STRUCTURE
27327
+
27328
+ // Line objects. These hold state related to a line, including
27329
+ // highlighting info (the styles array).
27330
+ var Line = function(text, markedSpans, estimateHeight) {
27331
+ this.text = text;
27332
+ attachMarkedSpans(this, markedSpans);
27333
+ this.height = estimateHeight ? estimateHeight(this) : 1;
27334
+ };
27335
+
27336
+ Line.prototype.lineNo = function () { return lineNo(this) };
27337
+ eventMixin(Line);
27338
+
27339
+ // Change the content (text, markers) of a line. Automatically
27340
+ // invalidates cached information and tries to re-estimate the
27341
+ // line's height.
27342
+ function updateLine(line, text, markedSpans, estimateHeight) {
27343
+ line.text = text;
27344
+ if (line.stateAfter) { line.stateAfter = null; }
27345
+ if (line.styles) { line.styles = null; }
27346
+ if (line.order != null) { line.order = null; }
27347
+ detachMarkedSpans(line);
27348
+ attachMarkedSpans(line, markedSpans);
27349
+ var estHeight = estimateHeight ? estimateHeight(line) : 1;
27350
+ if (estHeight != line.height) { updateLineHeight(line, estHeight); }
27351
+ }
27352
+
27353
+ // Detach a line from the document tree and its markers.
27354
+ function cleanUpLine(line) {
27355
+ line.parent = null;
27356
+ detachMarkedSpans(line);
27357
+ }
27358
+
27359
+ // Convert a style as returned by a mode (either null, or a string
27360
+ // containing one or more styles) to a CSS style. This is cached,
27361
+ // and also looks for line-wide styles.
27362
+ var styleToClassCache = {}, styleToClassCacheWithMode = {};
27363
+ function interpretTokenStyle(style, options) {
27364
+ if (!style || /^\s*$/.test(style)) { return null }
27365
+ var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
27366
+ return cache[style] ||
27367
+ (cache[style] = style.replace(/\S+/g, "cm-$&"))
27368
+ }
27369
+
27370
+ // Render the DOM representation of the text of a line. Also builds
27371
+ // up a 'line map', which points at the DOM nodes that represent
27372
+ // specific stretches of text, and is used by the measuring code.
27373
+ // The returned object contains the DOM node, this map, and
27374
+ // information about line-wide styles that were set by the mode.
27375
+ function buildLineContent(cm, lineView) {
27376
+ // The padding-right forces the element to have a 'border', which
27377
+ // is needed on Webkit to be able to get line-level bounding
27378
+ // rectangles for it (in measureChar).
27379
+ var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
27380
+ var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
27381
+ col: 0, pos: 0, cm: cm,
27382
+ trailingSpace: false,
27383
+ splitSpaces: cm.getOption("lineWrapping")};
27384
+ lineView.measure = {};
27385
+
27386
+ // Iterate over the logical lines that make up this visual line.
27387
+ for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
27388
+ var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
27389
+ builder.pos = 0;
27390
+ builder.addToken = buildToken;
27391
+ // Optionally wire in some hacks into the token-rendering
27392
+ // algorithm, to deal with browser quirks.
27393
+ if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
27394
+ { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
27395
+ builder.map = [];
27396
+ var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
27397
+ insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
27398
+ if (line.styleClasses) {
27399
+ if (line.styleClasses.bgClass)
27400
+ { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
27401
+ if (line.styleClasses.textClass)
27402
+ { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
27403
+ }
27404
+
27405
+ // Ensure at least a single node is present, for measuring.
27406
+ if (builder.map.length == 0)
27407
+ { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
27408
+
27409
+ // Store the map and a cache object for the current logical line
27410
+ if (i == 0) {
27411
+ lineView.measure.map = builder.map;
27412
+ lineView.measure.cache = {};
27413
+ } else {
27414
+ (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
27415
+ ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
27416
+ }
27417
+ }
27418
+
27419
+ // See issue #2901
27420
+ if (webkit) {
27421
+ var last = builder.content.lastChild;
27422
+ if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
27423
+ { builder.content.className = "cm-tab-wrap-hack"; }
27424
+ }
27425
+
27426
+ signal(cm, "renderLine", cm, lineView.line, builder.pre);
27427
+ if (builder.pre.className)
27428
+ { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
27429
+
27430
+ return builder
27431
+ }
27432
+
27433
+ function defaultSpecialCharPlaceholder(ch) {
27434
+ var token = elt("span", "\u2022", "cm-invalidchar");
27435
+ token.title = "\\u" + ch.charCodeAt(0).toString(16);
27436
+ token.setAttribute("aria-label", token.title);
27437
+ return token
27438
+ }
27439
+
27440
+ // Build up the DOM representation for a single token, and add it to
27441
+ // the line map. Takes care to render special characters separately.
27442
+ function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {
27443
+ if (!text) { return }
27444
+ var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
27445
+ var special = builder.cm.state.specialChars, mustWrap = false;
27446
+ var content;
27447
+ if (!special.test(text)) {
27448
+ builder.col += text.length;
27449
+ content = document.createTextNode(displayText);
27450
+ builder.map.push(builder.pos, builder.pos + text.length, content);
27451
+ if (ie && ie_version < 9) { mustWrap = true; }
27452
+ builder.pos += text.length;
27453
+ } else {
27454
+ content = document.createDocumentFragment();
27455
+ var pos = 0;
27456
+ while (true) {
27457
+ special.lastIndex = pos;
27458
+ var m = special.exec(text);
27459
+ var skipped = m ? m.index - pos : text.length - pos;
27460
+ if (skipped) {
27461
+ var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
27462
+ if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
27463
+ else { content.appendChild(txt); }
27464
+ builder.map.push(builder.pos, builder.pos + skipped, txt);
27465
+ builder.col += skipped;
27466
+ builder.pos += skipped;
27467
+ }
27468
+ if (!m) { break }
27469
+ pos += skipped + 1;
27470
+ var txt$1 = (void 0);
27471
+ if (m[0] == "\t") {
27472
+ var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
27473
+ txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
27474
+ txt$1.setAttribute("role", "presentation");
27475
+ txt$1.setAttribute("cm-text", "\t");
27476
+ builder.col += tabWidth;
27477
+ } else if (m[0] == "\r" || m[0] == "\n") {
27478
+ txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
27479
+ txt$1.setAttribute("cm-text", m[0]);
27480
+ builder.col += 1;
27481
+ } else {
27482
+ txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
27483
+ txt$1.setAttribute("cm-text", m[0]);
27484
+ if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
27485
+ else { content.appendChild(txt$1); }
27486
+ builder.col += 1;
27487
+ }
27488
+ builder.map.push(builder.pos, builder.pos + 1, txt$1);
27489
+ builder.pos++;
27490
+ }
27491
+ }
27492
+ builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
27493
+ if (style || startStyle || endStyle || mustWrap || css || attributes) {
27494
+ var fullStyle = style || "";
27495
+ if (startStyle) { fullStyle += startStyle; }
27496
+ if (endStyle) { fullStyle += endStyle; }
27497
+ var token = elt("span", [content], fullStyle, css);
27498
+ if (attributes) {
27499
+ for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != "style" && attr != "class")
27500
+ { token.setAttribute(attr, attributes[attr]); } }
27501
+ }
27502
+ return builder.content.appendChild(token)
27503
+ }
27504
+ builder.content.appendChild(content);
27505
+ }
27506
+
27507
+ // Change some spaces to NBSP to prevent the browser from collapsing
27508
+ // trailing spaces at the end of a line when rendering text (issue #1362).
27509
+ function splitSpaces(text, trailingBefore) {
27510
+ if (text.length > 1 && !/ /.test(text)) { return text }
27511
+ var spaceBefore = trailingBefore, result = "";
27512
+ for (var i = 0; i < text.length; i++) {
27513
+ var ch = text.charAt(i);
27514
+ if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
27515
+ { ch = "\u00a0"; }
27516
+ result += ch;
27517
+ spaceBefore = ch == " ";
27518
+ }
27519
+ return result
27520
+ }
27521
+
27522
+ // Work around nonsense dimensions being reported for stretches of
27523
+ // right-to-left text.
27524
+ function buildTokenBadBidi(inner, order) {
27525
+ return function (builder, text, style, startStyle, endStyle, css, attributes) {
27526
+ style = style ? style + " cm-force-border" : "cm-force-border";
27527
+ var start = builder.pos, end = start + text.length;
27528
+ for (;;) {
27529
+ // Find the part that overlaps with the start of this text
27530
+ var part = (void 0);
27531
+ for (var i = 0; i < order.length; i++) {
27532
+ part = order[i];
27533
+ if (part.to > start && part.from <= start) { break }
27534
+ }
27535
+ if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) }
27536
+ inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);
27537
+ startStyle = null;
27538
+ text = text.slice(part.to - start);
27539
+ start = part.to;
27540
+ }
27541
+ }
27542
+ }
27543
+
27544
+ function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
27545
+ var widget = !ignoreWidget && marker.widgetNode;
27546
+ if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
27547
+ if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
27548
+ if (!widget)
27549
+ { widget = builder.content.appendChild(document.createElement("span")); }
27550
+ widget.setAttribute("cm-marker", marker.id);
27551
+ }
27552
+ if (widget) {
27553
+ builder.cm.display.input.setUneditable(widget);
27554
+ builder.content.appendChild(widget);
27555
+ }
27556
+ builder.pos += size;
27557
+ builder.trailingSpace = false;
27558
+ }
27559
+
27560
+ // Outputs a number of spans to make up a line, taking highlighting
27561
+ // and marked text into account.
27562
+ function insertLineContent(line, builder, styles) {
27563
+ var spans = line.markedSpans, allText = line.text, at = 0;
27564
+ if (!spans) {
27565
+ for (var i$1 = 1; i$1 < styles.length; i$1+=2)
27566
+ { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
27567
+ return
27568
+ }
27569
+
27570
+ var len = allText.length, pos = 0, i = 1, text = "", style, css;
27571
+ var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;
27572
+ for (;;) {
27573
+ if (nextChange == pos) { // Update current marker set
27574
+ spanStyle = spanEndStyle = spanStartStyle = css = "";
27575
+ attributes = null;
27576
+ collapsed = null; nextChange = Infinity;
27577
+ var foundBookmarks = [], endStyles = (void 0);
27578
+ for (var j = 0; j < spans.length; ++j) {
27579
+ var sp = spans[j], m = sp.marker;
27580
+ if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
27581
+ foundBookmarks.push(m);
27582
+ } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
27583
+ if (sp.to != null && sp.to != pos && nextChange > sp.to) {
27584
+ nextChange = sp.to;
27585
+ spanEndStyle = "";
27586
+ }
27587
+ if (m.className) { spanStyle += " " + m.className; }
27588
+ if (m.css) { css = (css ? css + ";" : "") + m.css; }
27589
+ if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
27590
+ if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
27591
+ // support for the old title property
27592
+ // https://github.com/codemirror/CodeMirror/pull/5673
27593
+ if (m.title) { (attributes || (attributes = {})).title = m.title; }
27594
+ if (m.attributes) {
27595
+ for (var attr in m.attributes)
27596
+ { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }
27597
+ }
27598
+ if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
27599
+ { collapsed = sp; }
27600
+ } else if (sp.from > pos && nextChange > sp.from) {
27601
+ nextChange = sp.from;
27602
+ }
27603
+ }
27604
+ if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
27605
+ { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
27606
+
27607
+ if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
27608
+ { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
27609
+ if (collapsed && (collapsed.from || 0) == pos) {
27610
+ buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
27611
+ collapsed.marker, collapsed.from == null);
27612
+ if (collapsed.to == null) { return }
27613
+ if (collapsed.to == pos) { collapsed = false; }
27614
+ }
27615
+ }
27616
+ if (pos >= len) { break }
27617
+
27618
+ var upto = Math.min(len, nextChange);
27619
+ while (true) {
27620
+ if (text) {
27621
+ var end = pos + text.length;
27622
+ if (!collapsed) {
27623
+ var tokenText = end > upto ? text.slice(0, upto - pos) : text;
27624
+ builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
27625
+ spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", css, attributes);
27626
+ }
27627
+ if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
27628
+ pos = end;
27629
+ spanStartStyle = "";
27630
+ }
27631
+ text = allText.slice(at, at = styles[i++]);
27632
+ style = interpretTokenStyle(styles[i++], builder.cm.options);
27633
+ }
27634
+ }
27635
+ }
27636
+
27637
+
27638
+ // These objects are used to represent the visible (currently drawn)
27639
+ // part of the document. A LineView may correspond to multiple
27640
+ // logical lines, if those are connected by collapsed ranges.
27641
+ function LineView(doc, line, lineN) {
27642
+ // The starting line
27643
+ this.line = line;
27644
+ // Continuing lines, if any
27645
+ this.rest = visualLineContinued(line);
27646
+ // Number of logical lines in this visual line
27647
+ this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
27648
+ this.node = this.text = null;
27649
+ this.hidden = lineIsHidden(doc, line);
27650
+ }
27651
+
27652
+ // Create a range of LineView objects for the given lines.
27653
+ function buildViewArray(cm, from, to) {
27654
+ var array = [], nextPos;
27655
+ for (var pos = from; pos < to; pos = nextPos) {
27656
+ var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
27657
+ nextPos = pos + view.size;
27658
+ array.push(view);
27659
+ }
27660
+ return array
27661
+ }
27662
+
27663
+ var operationGroup = null;
27664
+
27665
+ function pushOperation(op) {
27666
+ if (operationGroup) {
27667
+ operationGroup.ops.push(op);
27668
+ } else {
27669
+ op.ownsGroup = operationGroup = {
27670
+ ops: [op],
27671
+ delayedCallbacks: []
27672
+ };
27673
+ }
27674
+ }
27675
+
27676
+ function fireCallbacksForOps(group) {
27677
+ // Calls delayed callbacks and cursorActivity handlers until no
27678
+ // new ones appear
27679
+ var callbacks = group.delayedCallbacks, i = 0;
27680
+ do {
27681
+ for (; i < callbacks.length; i++)
27682
+ { callbacks[i].call(null); }
27683
+ for (var j = 0; j < group.ops.length; j++) {
27684
+ var op = group.ops[j];
27685
+ if (op.cursorActivityHandlers)
27686
+ { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
27687
+ { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
27688
+ }
27689
+ } while (i < callbacks.length)
27690
+ }
27691
+
27692
+ function finishOperation(op, endCb) {
27693
+ var group = op.ownsGroup;
27694
+ if (!group) { return }
27695
+
27696
+ try { fireCallbacksForOps(group); }
27697
+ finally {
27698
+ operationGroup = null;
27699
+ endCb(group);
27700
+ }
27701
+ }
27702
+
27703
+ var orphanDelayedCallbacks = null;
27704
+
27705
+ // Often, we want to signal events at a point where we are in the
27706
+ // middle of some work, but don't want the handler to start calling
27707
+ // other methods on the editor, which might be in an inconsistent
27708
+ // state or simply not expect any other events to happen.
27709
+ // signalLater looks whether there are any handlers, and schedules
27710
+ // them to be executed when the last operation ends, or, if no
27711
+ // operation is active, when a timeout fires.
27712
+ function signalLater(emitter, type /*, values...*/) {
27713
+ var arr = getHandlers(emitter, type);
27714
+ if (!arr.length) { return }
27715
+ var args = Array.prototype.slice.call(arguments, 2), list;
27716
+ if (operationGroup) {
27717
+ list = operationGroup.delayedCallbacks;
27718
+ } else if (orphanDelayedCallbacks) {
27719
+ list = orphanDelayedCallbacks;
27720
+ } else {
27721
+ list = orphanDelayedCallbacks = [];
27722
+ setTimeout(fireOrphanDelayed, 0);
27723
+ }
27724
+ var loop = function ( i ) {
27725
+ list.push(function () { return arr[i].apply(null, args); });
27726
+ };
27727
+
27728
+ for (var i = 0; i < arr.length; ++i)
27729
+ loop( i );
27730
+ }
27731
+
27732
+ function fireOrphanDelayed() {
27733
+ var delayed = orphanDelayedCallbacks;
27734
+ orphanDelayedCallbacks = null;
27735
+ for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
27736
+ }
27737
+
27738
+ // When an aspect of a line changes, a string is added to
27739
+ // lineView.changes. This updates the relevant part of the line's
27740
+ // DOM structure.
27741
+ function updateLineForChanges(cm, lineView, lineN, dims) {
27742
+ for (var j = 0; j < lineView.changes.length; j++) {
27743
+ var type = lineView.changes[j];
27744
+ if (type == "text") { updateLineText(cm, lineView); }
27745
+ else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
27746
+ else if (type == "class") { updateLineClasses(cm, lineView); }
27747
+ else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
27748
+ }
27749
+ lineView.changes = null;
27750
+ }
27751
+
27752
+ // Lines with gutter elements, widgets or a background class need to
27753
+ // be wrapped, and have the extra elements added to the wrapper div
27754
+ function ensureLineWrapped(lineView) {
27755
+ if (lineView.node == lineView.text) {
27756
+ lineView.node = elt("div", null, null, "position: relative");
27757
+ if (lineView.text.parentNode)
27758
+ { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
27759
+ lineView.node.appendChild(lineView.text);
27760
+ if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
27761
+ }
27762
+ return lineView.node
27763
+ }
27764
+
27765
+ function updateLineBackground(cm, lineView) {
27766
+ var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
27767
+ if (cls) { cls += " CodeMirror-linebackground"; }
27768
+ if (lineView.background) {
27769
+ if (cls) { lineView.background.className = cls; }
27770
+ else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
27771
+ } else if (cls) {
27772
+ var wrap = ensureLineWrapped(lineView);
27773
+ lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
27774
+ cm.display.input.setUneditable(lineView.background);
27775
+ }
27776
+ }
27777
+
27778
+ // Wrapper around buildLineContent which will reuse the structure
27779
+ // in display.externalMeasured when possible.
27780
+ function getLineContent(cm, lineView) {
27781
+ var ext = cm.display.externalMeasured;
27782
+ if (ext && ext.line == lineView.line) {
27783
+ cm.display.externalMeasured = null;
27784
+ lineView.measure = ext.measure;
27785
+ return ext.built
27786
+ }
27787
+ return buildLineContent(cm, lineView)
27788
+ }
27789
+
27790
+ // Redraw the line's text. Interacts with the background and text
27791
+ // classes because the mode may output tokens that influence these
27792
+ // classes.
27793
+ function updateLineText(cm, lineView) {
27794
+ var cls = lineView.text.className;
27795
+ var built = getLineContent(cm, lineView);
27796
+ if (lineView.text == lineView.node) { lineView.node = built.pre; }
27797
+ lineView.text.parentNode.replaceChild(built.pre, lineView.text);
27798
+ lineView.text = built.pre;
27799
+ if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
27800
+ lineView.bgClass = built.bgClass;
27801
+ lineView.textClass = built.textClass;
27802
+ updateLineClasses(cm, lineView);
27803
+ } else if (cls) {
27804
+ lineView.text.className = cls;
27805
+ }
27806
+ }
27807
+
27808
+ function updateLineClasses(cm, lineView) {
27809
+ updateLineBackground(cm, lineView);
27810
+ if (lineView.line.wrapClass)
27811
+ { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
27812
+ else if (lineView.node != lineView.text)
27813
+ { lineView.node.className = ""; }
27814
+ var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
27815
+ lineView.text.className = textClass || "";
27816
+ }
27817
+
27818
+ function updateLineGutter(cm, lineView, lineN, dims) {
27819
+ if (lineView.gutter) {
27820
+ lineView.node.removeChild(lineView.gutter);
27821
+ lineView.gutter = null;
27822
+ }
27823
+ if (lineView.gutterBackground) {
27824
+ lineView.node.removeChild(lineView.gutterBackground);
27825
+ lineView.gutterBackground = null;
27826
+ }
27827
+ if (lineView.line.gutterClass) {
27828
+ var wrap = ensureLineWrapped(lineView);
27829
+ lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
27830
+ ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
27831
+ cm.display.input.setUneditable(lineView.gutterBackground);
27832
+ wrap.insertBefore(lineView.gutterBackground, lineView.text);
27833
+ }
27834
+ var markers = lineView.line.gutterMarkers;
27835
+ if (cm.options.lineNumbers || markers) {
27836
+ var wrap$1 = ensureLineWrapped(lineView);
27837
+ var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
27838
+ cm.display.input.setUneditable(gutterWrap);
27839
+ wrap$1.insertBefore(gutterWrap, lineView.text);
27840
+ if (lineView.line.gutterClass)
27841
+ { gutterWrap.className += " " + lineView.line.gutterClass; }
27842
+ if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
27843
+ { lineView.lineNumber = gutterWrap.appendChild(
27844
+ elt("div", lineNumberFor(cm.options, lineN),
27845
+ "CodeMirror-linenumber CodeMirror-gutter-elt",
27846
+ ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
27847
+ if (markers) { for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {
27848
+ var id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id];
27849
+ if (found)
27850
+ { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
27851
+ ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
27852
+ } }
27853
+ }
27854
+ }
27855
+
27856
+ function updateLineWidgets(cm, lineView, dims) {
27857
+ if (lineView.alignable) { lineView.alignable = null; }
27858
+ var isWidget = classTest("CodeMirror-linewidget");
27859
+ for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
27860
+ next = node.nextSibling;
27861
+ if (isWidget.test(node.className)) { lineView.node.removeChild(node); }
27862
+ }
27863
+ insertLineWidgets(cm, lineView, dims);
27864
+ }
27865
+
27866
+ // Build a line's DOM representation from scratch
27867
+ function buildLineElement(cm, lineView, lineN, dims) {
27868
+ var built = getLineContent(cm, lineView);
27869
+ lineView.text = lineView.node = built.pre;
27870
+ if (built.bgClass) { lineView.bgClass = built.bgClass; }
27871
+ if (built.textClass) { lineView.textClass = built.textClass; }
27872
+
27873
+ updateLineClasses(cm, lineView);
27874
+ updateLineGutter(cm, lineView, lineN, dims);
27875
+ insertLineWidgets(cm, lineView, dims);
27876
+ return lineView.node
27877
+ }
27878
+
27879
+ // A lineView may contain multiple logical lines (when merged by
27880
+ // collapsed spans). The widgets for all of them need to be drawn.
27881
+ function insertLineWidgets(cm, lineView, dims) {
27882
+ insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
27883
+ if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
27884
+ { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
27885
+ }
27886
+
27887
+ function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
27888
+ if (!line.widgets) { return }
27889
+ var wrap = ensureLineWrapped(lineView);
27890
+ for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
27891
+ var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget" + (widget.className ? " " + widget.className : ""));
27892
+ if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
27893
+ positionLineWidget(widget, node, lineView, dims);
27894
+ cm.display.input.setUneditable(node);
27895
+ if (allowAbove && widget.above)
27896
+ { wrap.insertBefore(node, lineView.gutter || lineView.text); }
27897
+ else
27898
+ { wrap.appendChild(node); }
27899
+ signalLater(widget, "redraw");
27900
+ }
27901
+ }
27902
+
27903
+ function positionLineWidget(widget, node, lineView, dims) {
27904
+ if (widget.noHScroll) {
27905
+ (lineView.alignable || (lineView.alignable = [])).push(node);
27906
+ var width = dims.wrapperWidth;
27907
+ node.style.left = dims.fixedPos + "px";
27908
+ if (!widget.coverGutter) {
27909
+ width -= dims.gutterTotalWidth;
27910
+ node.style.paddingLeft = dims.gutterTotalWidth + "px";
27911
+ }
27912
+ node.style.width = width + "px";
27913
+ }
27914
+ if (widget.coverGutter) {
27915
+ node.style.zIndex = 5;
27916
+ node.style.position = "relative";
27917
+ if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
27918
+ }
27919
+ }
27920
+
27921
+ function widgetHeight(widget) {
27922
+ if (widget.height != null) { return widget.height }
27923
+ var cm = widget.doc.cm;
27924
+ if (!cm) { return 0 }
27925
+ if (!contains(document.body, widget.node)) {
27926
+ var parentStyle = "position: relative;";
27927
+ if (widget.coverGutter)
27928
+ { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
27929
+ if (widget.noHScroll)
27930
+ { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
27931
+ removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
27932
+ }
27933
+ return widget.height = widget.node.parentNode.offsetHeight
27934
+ }
27935
+
27936
+ // Return true when the given mouse event happened in a widget
27937
+ function eventInWidget(display, e) {
27938
+ for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
27939
+ if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
27940
+ (n.parentNode == display.sizer && n != display.mover))
27941
+ { return true }
27942
+ }
27943
+ }
27944
+
27945
+ // POSITION MEASUREMENT
27946
+
27947
+ function paddingTop(display) {return display.lineSpace.offsetTop}
27948
+ function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
27949
+ function paddingH(display) {
27950
+ if (display.cachedPaddingH) { return display.cachedPaddingH }
27951
+ var e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-line-like"));
27952
+ var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
27953
+ var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
27954
+ if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
27955
+ return data
27956
+ }
27957
+
27958
+ function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
27959
+ function displayWidth(cm) {
27960
+ return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
27961
+ }
27962
+ function displayHeight(cm) {
27963
+ return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
27964
+ }
27965
+
27966
+ // Ensure the lineView.wrapping.heights array is populated. This is
27967
+ // an array of bottom offsets for the lines that make up a drawn
27968
+ // line. When lineWrapping is on, there might be more than one
27969
+ // height.
27970
+ function ensureLineHeights(cm, lineView, rect) {
27971
+ var wrapping = cm.options.lineWrapping;
27972
+ var curWidth = wrapping && displayWidth(cm);
27973
+ if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
27974
+ var heights = lineView.measure.heights = [];
27975
+ if (wrapping) {
27976
+ lineView.measure.width = curWidth;
27977
+ var rects = lineView.text.firstChild.getClientRects();
27978
+ for (var i = 0; i < rects.length - 1; i++) {
27979
+ var cur = rects[i], next = rects[i + 1];
27980
+ if (Math.abs(cur.bottom - next.bottom) > 2)
27981
+ { heights.push((cur.bottom + next.top) / 2 - rect.top); }
27982
+ }
27983
+ }
27984
+ heights.push(rect.bottom - rect.top);
27985
+ }
27986
+ }
27987
+
27988
+ // Find a line map (mapping character offsets to text nodes) and a
27989
+ // measurement cache for the given line number. (A line view might
27990
+ // contain multiple lines when collapsed ranges are present.)
27991
+ function mapFromLineView(lineView, line, lineN) {
27992
+ if (lineView.line == line)
27993
+ { return {map: lineView.measure.map, cache: lineView.measure.cache} }
27994
+ for (var i = 0; i < lineView.rest.length; i++)
27995
+ { if (lineView.rest[i] == line)
27996
+ { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
27997
+ for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
27998
+ { if (lineNo(lineView.rest[i$1]) > lineN)
27999
+ { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
28000
+ }
28001
+
28002
+ // Render a line into the hidden node display.externalMeasured. Used
28003
+ // when measurement is needed for a line that's not in the viewport.
28004
+ function updateExternalMeasurement(cm, line) {
28005
+ line = visualLine(line);
28006
+ var lineN = lineNo(line);
28007
+ var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
28008
+ view.lineN = lineN;
28009
+ var built = view.built = buildLineContent(cm, view);
28010
+ view.text = built.pre;
28011
+ removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
28012
+ return view
28013
+ }
28014
+
28015
+ // Get a {top, bottom, left, right} box (in line-local coordinates)
28016
+ // for a given character.
28017
+ function measureChar(cm, line, ch, bias) {
28018
+ return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
28019
+ }
28020
+
28021
+ // Find a line view that corresponds to the given line number.
28022
+ function findViewForLine(cm, lineN) {
28023
+ if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
28024
+ { return cm.display.view[findViewIndex(cm, lineN)] }
28025
+ var ext = cm.display.externalMeasured;
28026
+ if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
28027
+ { return ext }
28028
+ }
28029
+
28030
+ // Measurement can be split in two steps, the set-up work that
28031
+ // applies to the whole line, and the measurement of the actual
28032
+ // character. Functions like coordsChar, that need to do a lot of
28033
+ // measurements in a row, can thus ensure that the set-up work is
28034
+ // only done once.
28035
+ function prepareMeasureForLine(cm, line) {
28036
+ var lineN = lineNo(line);
28037
+ var view = findViewForLine(cm, lineN);
28038
+ if (view && !view.text) {
28039
+ view = null;
28040
+ } else if (view && view.changes) {
28041
+ updateLineForChanges(cm, view, lineN, getDimensions(cm));
28042
+ cm.curOp.forceUpdate = true;
28043
+ }
28044
+ if (!view)
28045
+ { view = updateExternalMeasurement(cm, line); }
28046
+
28047
+ var info = mapFromLineView(view, line, lineN);
28048
+ return {
28049
+ line: line, view: view, rect: null,
28050
+ map: info.map, cache: info.cache, before: info.before,
28051
+ hasHeights: false
28052
+ }
28053
+ }
28054
+
28055
+ // Given a prepared measurement object, measures the position of an
28056
+ // actual character (or fetches it from the cache).
28057
+ function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
28058
+ if (prepared.before) { ch = -1; }
28059
+ var key = ch + (bias || ""), found;
28060
+ if (prepared.cache.hasOwnProperty(key)) {
28061
+ found = prepared.cache[key];
28062
+ } else {
28063
+ if (!prepared.rect)
28064
+ { prepared.rect = prepared.view.text.getBoundingClientRect(); }
28065
+ if (!prepared.hasHeights) {
28066
+ ensureLineHeights(cm, prepared.view, prepared.rect);
28067
+ prepared.hasHeights = true;
28068
+ }
28069
+ found = measureCharInner(cm, prepared, ch, bias);
28070
+ if (!found.bogus) { prepared.cache[key] = found; }
28071
+ }
28072
+ return {left: found.left, right: found.right,
28073
+ top: varHeight ? found.rtop : found.top,
28074
+ bottom: varHeight ? found.rbottom : found.bottom}
28075
+ }
28076
+
28077
+ var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
28078
+
28079
+ function nodeAndOffsetInLineMap(map, ch, bias) {
28080
+ var node, start, end, collapse, mStart, mEnd;
28081
+ // First, search the line map for the text node corresponding to,
28082
+ // or closest to, the target character.
28083
+ for (var i = 0; i < map.length; i += 3) {
28084
+ mStart = map[i];
28085
+ mEnd = map[i + 1];
28086
+ if (ch < mStart) {
28087
+ start = 0; end = 1;
28088
+ collapse = "left";
28089
+ } else if (ch < mEnd) {
28090
+ start = ch - mStart;
28091
+ end = start + 1;
28092
+ } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
28093
+ end = mEnd - mStart;
28094
+ start = end - 1;
28095
+ if (ch >= mEnd) { collapse = "right"; }
28096
+ }
28097
+ if (start != null) {
28098
+ node = map[i + 2];
28099
+ if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
28100
+ { collapse = bias; }
28101
+ if (bias == "left" && start == 0)
28102
+ { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
28103
+ node = map[(i -= 3) + 2];
28104
+ collapse = "left";
28105
+ } }
28106
+ if (bias == "right" && start == mEnd - mStart)
28107
+ { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
28108
+ node = map[(i += 3) + 2];
28109
+ collapse = "right";
28110
+ } }
28111
+ break
28112
+ }
28113
+ }
28114
+ return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
28115
+ }
28116
+
28117
+ function getUsefulRect(rects, bias) {
28118
+ var rect = nullRect;
28119
+ if (bias == "left") { for (var i = 0; i < rects.length; i++) {
28120
+ if ((rect = rects[i]).left != rect.right) { break }
28121
+ } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
28122
+ if ((rect = rects[i$1]).left != rect.right) { break }
28123
+ } }
28124
+ return rect
28125
+ }
28126
+
28127
+ function measureCharInner(cm, prepared, ch, bias) {
28128
+ var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
28129
+ var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
28130
+
28131
+ var rect;
28132
+ if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
28133
+ for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
28134
+ while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
28135
+ while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
28136
+ if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
28137
+ { rect = node.parentNode.getBoundingClientRect(); }
28138
+ else
28139
+ { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
28140
+ if (rect.left || rect.right || start == 0) { break }
28141
+ end = start;
28142
+ start = start - 1;
28143
+ collapse = "right";
28144
+ }
28145
+ if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
28146
+ } else { // If it is a widget, simply get the box for the whole widget.
28147
+ if (start > 0) { collapse = bias = "right"; }
28148
+ var rects;
28149
+ if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
28150
+ { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
28151
+ else
28152
+ { rect = node.getBoundingClientRect(); }
28153
+ }
28154
+ if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
28155
+ var rSpan = node.parentNode.getClientRects()[0];
28156
+ if (rSpan)
28157
+ { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
28158
+ else
28159
+ { rect = nullRect; }
28160
+ }
28161
+
28162
+ var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
28163
+ var mid = (rtop + rbot) / 2;
28164
+ var heights = prepared.view.measure.heights;
28165
+ var i = 0;
28166
+ for (; i < heights.length - 1; i++)
28167
+ { if (mid < heights[i]) { break } }
28168
+ var top = i ? heights[i - 1] : 0, bot = heights[i];
28169
+ var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
28170
+ right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
28171
+ top: top, bottom: bot};
28172
+ if (!rect.left && !rect.right) { result.bogus = true; }
28173
+ if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
28174
+
28175
+ return result
28176
+ }
28177
+
28178
+ // Work around problem with bounding client rects on ranges being
28179
+ // returned incorrectly when zoomed on IE10 and below.
28180
+ function maybeUpdateRectForZooming(measure, rect) {
28181
+ if (!window.screen || screen.logicalXDPI == null ||
28182
+ screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
28183
+ { return rect }
28184
+ var scaleX = screen.logicalXDPI / screen.deviceXDPI;
28185
+ var scaleY = screen.logicalYDPI / screen.deviceYDPI;
28186
+ return {left: rect.left * scaleX, right: rect.right * scaleX,
28187
+ top: rect.top * scaleY, bottom: rect.bottom * scaleY}
28188
+ }
28189
+
28190
+ function clearLineMeasurementCacheFor(lineView) {
28191
+ if (lineView.measure) {
28192
+ lineView.measure.cache = {};
28193
+ lineView.measure.heights = null;
28194
+ if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
28195
+ { lineView.measure.caches[i] = {}; } }
28196
+ }
28197
+ }
28198
+
28199
+ function clearLineMeasurementCache(cm) {
28200
+ cm.display.externalMeasure = null;
28201
+ removeChildren(cm.display.lineMeasure);
28202
+ for (var i = 0; i < cm.display.view.length; i++)
28203
+ { clearLineMeasurementCacheFor(cm.display.view[i]); }
28204
+ }
28205
+
28206
+ function clearCaches(cm) {
28207
+ clearLineMeasurementCache(cm);
28208
+ cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
28209
+ if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
28210
+ cm.display.lineNumChars = null;
28211
+ }
28212
+
28213
+ function pageScrollX() {
28214
+ // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
28215
+ // which causes page_Offset and bounding client rects to use
28216
+ // different reference viewports and invalidate our calculations.
28217
+ if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
28218
+ return window.pageXOffset || (document.documentElement || document.body).scrollLeft
28219
+ }
28220
+ function pageScrollY() {
28221
+ if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
28222
+ return window.pageYOffset || (document.documentElement || document.body).scrollTop
28223
+ }
28224
+
28225
+ function widgetTopHeight(lineObj) {
28226
+ var height = 0;
28227
+ if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)
28228
+ { height += widgetHeight(lineObj.widgets[i]); } } }
28229
+ return height
28230
+ }
28231
+
28232
+ // Converts a {top, bottom, left, right} box from line-local
28233
+ // coordinates into another coordinate system. Context may be one of
28234
+ // "line", "div" (display.lineDiv), "local"./null (editor), "window",
28235
+ // or "page".
28236
+ function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
28237
+ if (!includeWidgets) {
28238
+ var height = widgetTopHeight(lineObj);
28239
+ rect.top += height; rect.bottom += height;
28240
+ }
28241
+ if (context == "line") { return rect }
28242
+ if (!context) { context = "local"; }
28243
+ var yOff = heightAtLine(lineObj);
28244
+ if (context == "local") { yOff += paddingTop(cm.display); }
28245
+ else { yOff -= cm.display.viewOffset; }
28246
+ if (context == "page" || context == "window") {
28247
+ var lOff = cm.display.lineSpace.getBoundingClientRect();
28248
+ yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
28249
+ var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
28250
+ rect.left += xOff; rect.right += xOff;
28251
+ }
28252
+ rect.top += yOff; rect.bottom += yOff;
28253
+ return rect
28254
+ }
28255
+
28256
+ // Coverts a box from "div" coords to another coordinate system.
28257
+ // Context may be "window", "page", "div", or "local"./null.
28258
+ function fromCoordSystem(cm, coords, context) {
28259
+ if (context == "div") { return coords }
28260
+ var left = coords.left, top = coords.top;
28261
+ // First move into "page" coordinate system
28262
+ if (context == "page") {
28263
+ left -= pageScrollX();
28264
+ top -= pageScrollY();
28265
+ } else if (context == "local" || !context) {
28266
+ var localBox = cm.display.sizer.getBoundingClientRect();
28267
+ left += localBox.left;
28268
+ top += localBox.top;
28269
+ }
28270
+
28271
+ var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
28272
+ return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
28273
+ }
28274
+
28275
+ function charCoords(cm, pos, context, lineObj, bias) {
28276
+ if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
28277
+ return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
28278
+ }
28279
+
28280
+ // Returns a box for a given cursor position, which may have an
28281
+ // 'other' property containing the position of the secondary cursor
28282
+ // on a bidi boundary.
28283
+ // A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
28284
+ // and after `char - 1` in writing order of `char - 1`
28285
+ // A cursor Pos(line, char, "after") is on the same visual line as `char`
28286
+ // and before `char` in writing order of `char`
28287
+ // Examples (upper-case letters are RTL, lower-case are LTR):
28288
+ // Pos(0, 1, ...)
28289
+ // before after
28290
+ // ab a|b a|b
28291
+ // aB a|B aB|
28292
+ // Ab |Ab A|b
28293
+ // AB B|A B|A
28294
+ // Every position after the last character on a line is considered to stick
28295
+ // to the last character on the line.
28296
+ function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
28297
+ lineObj = lineObj || getLine(cm.doc, pos.line);
28298
+ if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
28299
+ function get(ch, right) {
28300
+ var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
28301
+ if (right) { m.left = m.right; } else { m.right = m.left; }
28302
+ return intoCoordSystem(cm, lineObj, m, context)
28303
+ }
28304
+ var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
28305
+ if (ch >= lineObj.text.length) {
28306
+ ch = lineObj.text.length;
28307
+ sticky = "before";
28308
+ } else if (ch <= 0) {
28309
+ ch = 0;
28310
+ sticky = "after";
28311
+ }
28312
+ if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
28313
+
28314
+ function getBidi(ch, partPos, invert) {
28315
+ var part = order[partPos], right = part.level == 1;
28316
+ return get(invert ? ch - 1 : ch, right != invert)
28317
+ }
28318
+ var partPos = getBidiPartAt(order, ch, sticky);
28319
+ var other = bidiOther;
28320
+ var val = getBidi(ch, partPos, sticky == "before");
28321
+ if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
28322
+ return val
28323
+ }
28324
+
28325
+ // Used to cheaply estimate the coordinates for a position. Used for
28326
+ // intermediate scroll updates.
28327
+ function estimateCoords(cm, pos) {
28328
+ var left = 0;
28329
+ pos = clipPos(cm.doc, pos);
28330
+ if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
28331
+ var lineObj = getLine(cm.doc, pos.line);
28332
+ var top = heightAtLine(lineObj) + paddingTop(cm.display);
28333
+ return {left: left, right: left, top: top, bottom: top + lineObj.height}
28334
+ }
28335
+
28336
+ // Positions returned by coordsChar contain some extra information.
28337
+ // xRel is the relative x position of the input coordinates compared
28338
+ // to the found position (so xRel > 0 means the coordinates are to
28339
+ // the right of the character position, for example). When outside
28340
+ // is true, that means the coordinates lie outside the line's
28341
+ // vertical range.
28342
+ function PosWithInfo(line, ch, sticky, outside, xRel) {
28343
+ var pos = Pos(line, ch, sticky);
28344
+ pos.xRel = xRel;
28345
+ if (outside) { pos.outside = outside; }
28346
+ return pos
28347
+ }
28348
+
28349
+ // Compute the character position closest to the given coordinates.
28350
+ // Input must be lineSpace-local ("div" coordinate system).
28351
+ function coordsChar(cm, x, y) {
28352
+ var doc = cm.doc;
28353
+ y += cm.display.viewOffset;
28354
+ if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }
28355
+ var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
28356
+ if (lineN > last)
28357
+ { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }
28358
+ if (x < 0) { x = 0; }
28359
+
28360
+ var lineObj = getLine(doc, lineN);
28361
+ for (;;) {
28362
+ var found = coordsCharInner(cm, lineObj, lineN, x, y);
28363
+ var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));
28364
+ if (!collapsed) { return found }
28365
+ var rangeEnd = collapsed.find(1);
28366
+ if (rangeEnd.line == lineN) { return rangeEnd }
28367
+ lineObj = getLine(doc, lineN = rangeEnd.line);
28368
+ }
28369
+ }
28370
+
28371
+ function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
28372
+ y -= widgetTopHeight(lineObj);
28373
+ var end = lineObj.text.length;
28374
+ var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);
28375
+ end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);
28376
+ return {begin: begin, end: end}
28377
+ }
28378
+
28379
+ function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
28380
+ if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
28381
+ var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
28382
+ return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
28383
+ }
28384
+
28385
+ // Returns true if the given side of a box is after the given
28386
+ // coordinates, in top-to-bottom, left-to-right order.
28387
+ function boxIsAfter(box, x, y, left) {
28388
+ return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
28389
+ }
28390
+
28391
+ function coordsCharInner(cm, lineObj, lineNo, x, y) {
28392
+ // Move y into line-local coordinate space
28393
+ y -= heightAtLine(lineObj);
28394
+ var preparedMeasure = prepareMeasureForLine(cm, lineObj);
28395
+ // When directly calling `measureCharPrepared`, we have to adjust
28396
+ // for the widgets at this line.
28397
+ var widgetHeight = widgetTopHeight(lineObj);
28398
+ var begin = 0, end = lineObj.text.length, ltr = true;
28399
+
28400
+ var order = getOrder(lineObj, cm.doc.direction);
28401
+ // If the line isn't plain left-to-right text, first figure out
28402
+ // which bidi section the coordinates fall into.
28403
+ if (order) {
28404
+ var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
28405
+ (cm, lineObj, lineNo, preparedMeasure, order, x, y);
28406
+ ltr = part.level != 1;
28407
+ // The awkward -1 offsets are needed because findFirst (called
28408
+ // on these below) will treat its first bound as inclusive,
28409
+ // second as exclusive, but we want to actually address the
28410
+ // characters in the part's range
28411
+ begin = ltr ? part.from : part.to - 1;
28412
+ end = ltr ? part.to : part.from - 1;
28413
+ }
28414
+
28415
+ // A binary search to find the first character whose bounding box
28416
+ // starts after the coordinates. If we run across any whose box wrap
28417
+ // the coordinates, store that.
28418
+ var chAround = null, boxAround = null;
28419
+ var ch = findFirst(function (ch) {
28420
+ var box = measureCharPrepared(cm, preparedMeasure, ch);
28421
+ box.top += widgetHeight; box.bottom += widgetHeight;
28422
+ if (!boxIsAfter(box, x, y, false)) { return false }
28423
+ if (box.top <= y && box.left <= x) {
28424
+ chAround = ch;
28425
+ boxAround = box;
28426
+ }
28427
+ return true
28428
+ }, begin, end);
28429
+
28430
+ var baseX, sticky, outside = false;
28431
+ // If a box around the coordinates was found, use that
28432
+ if (boxAround) {
28433
+ // Distinguish coordinates nearer to the left or right side of the box
28434
+ var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;
28435
+ ch = chAround + (atStart ? 0 : 1);
28436
+ sticky = atStart ? "after" : "before";
28437
+ baseX = atLeft ? boxAround.left : boxAround.right;
28438
+ } else {
28439
+ // (Adjust for extended bound, if necessary.)
28440
+ if (!ltr && (ch == end || ch == begin)) { ch++; }
28441
+ // To determine which side to associate with, get the box to the
28442
+ // left of the character and compare it's vertical position to the
28443
+ // coordinates
28444
+ sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
28445
+ (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?
28446
+ "after" : "before";
28447
+ // Now get accurate coordinates for this place, in order to get a
28448
+ // base X position
28449
+ var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), "line", lineObj, preparedMeasure);
28450
+ baseX = coords.left;
28451
+ outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;
28452
+ }
28453
+
28454
+ ch = skipExtendingChars(lineObj.text, ch, 1);
28455
+ return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)
28456
+ }
28457
+
28458
+ function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {
28459
+ // Bidi parts are sorted left-to-right, and in a non-line-wrapping
28460
+ // situation, we can take this ordering to correspond to the visual
28461
+ // ordering. This finds the first part whose end is after the given
28462
+ // coordinates.
28463
+ var index = findFirst(function (i) {
28464
+ var part = order[i], ltr = part.level != 1;
28465
+ return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? "before" : "after"),
28466
+ "line", lineObj, preparedMeasure), x, y, true)
28467
+ }, 0, order.length - 1);
28468
+ var part = order[index];
28469
+ // If this isn't the first part, the part's start is also after
28470
+ // the coordinates, and the coordinates aren't on the same line as
28471
+ // that start, move one part back.
28472
+ if (index > 0) {
28473
+ var ltr = part.level != 1;
28474
+ var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? "after" : "before"),
28475
+ "line", lineObj, preparedMeasure);
28476
+ if (boxIsAfter(start, x, y, true) && start.top > y)
28477
+ { part = order[index - 1]; }
28478
+ }
28479
+ return part
28480
+ }
28481
+
28482
+ function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
28483
+ // In a wrapped line, rtl text on wrapping boundaries can do things
28484
+ // that don't correspond to the ordering in our `order` array at
28485
+ // all, so a binary search doesn't work, and we want to return a
28486
+ // part that only spans one line so that the binary search in
28487
+ // coordsCharInner is safe. As such, we first find the extent of the
28488
+ // wrapped line, and then do a flat search in which we discard any
28489
+ // spans that aren't on the line.
28490
+ var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);
28491
+ var begin = ref.begin;
28492
+ var end = ref.end;
28493
+ if (/\s/.test(lineObj.text.charAt(end - 1))) { end--; }
28494
+ var part = null, closestDist = null;
28495
+ for (var i = 0; i < order.length; i++) {
28496
+ var p = order[i];
28497
+ if (p.from >= end || p.to <= begin) { continue }
28498
+ var ltr = p.level != 1;
28499
+ var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;
28500
+ // Weigh against spans ending before this, so that they are only
28501
+ // picked if nothing ends after
28502
+ var dist = endX < x ? x - endX + 1e9 : endX - x;
28503
+ if (!part || closestDist > dist) {
28504
+ part = p;
28505
+ closestDist = dist;
28506
+ }
28507
+ }
28508
+ if (!part) { part = order[order.length - 1]; }
28509
+ // Clip the part to the wrapped line.
28510
+ if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }
28511
+ if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }
28512
+ return part
28513
+ }
28514
+
28515
+ var measureText;
28516
+ // Compute the default text height.
28517
+ function textHeight(display) {
28518
+ if (display.cachedTextHeight != null) { return display.cachedTextHeight }
28519
+ if (measureText == null) {
28520
+ measureText = elt("pre", null, "CodeMirror-line-like");
28521
+ // Measure a bunch of lines, for browsers that compute
28522
+ // fractional heights.
28523
+ for (var i = 0; i < 49; ++i) {
28524
+ measureText.appendChild(document.createTextNode("x"));
28525
+ measureText.appendChild(elt("br"));
28526
+ }
28527
+ measureText.appendChild(document.createTextNode("x"));
28528
+ }
28529
+ removeChildrenAndAdd(display.measure, measureText);
28530
+ var height = measureText.offsetHeight / 50;
28531
+ if (height > 3) { display.cachedTextHeight = height; }
28532
+ removeChildren(display.measure);
28533
+ return height || 1
28534
+ }
28535
+
28536
+ // Compute the default character width.
28537
+ function charWidth(display) {
28538
+ if (display.cachedCharWidth != null) { return display.cachedCharWidth }
28539
+ var anchor = elt("span", "xxxxxxxxxx");
28540
+ var pre = elt("pre", [anchor], "CodeMirror-line-like");
28541
+ removeChildrenAndAdd(display.measure, pre);
28542
+ var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
28543
+ if (width > 2) { display.cachedCharWidth = width; }
28544
+ return width || 10
28545
+ }
28546
+
28547
+ // Do a bulk-read of the DOM positions and sizes needed to draw the
28548
+ // view, so that we don't interleave reading and writing to the DOM.
28549
+ function getDimensions(cm) {
28550
+ var d = cm.display, left = {}, width = {};
28551
+ var gutterLeft = d.gutters.clientLeft;
28552
+ for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
28553
+ var id = cm.display.gutterSpecs[i].className;
28554
+ left[id] = n.offsetLeft + n.clientLeft + gutterLeft;
28555
+ width[id] = n.clientWidth;
28556
+ }
28557
+ return {fixedPos: compensateForHScroll(d),
28558
+ gutterTotalWidth: d.gutters.offsetWidth,
28559
+ gutterLeft: left,
28560
+ gutterWidth: width,
28561
+ wrapperWidth: d.wrapper.clientWidth}
28562
+ }
28563
+
28564
+ // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
28565
+ // but using getBoundingClientRect to get a sub-pixel-accurate
28566
+ // result.
28567
+ function compensateForHScroll(display) {
28568
+ return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
28569
+ }
28570
+
28571
+ // Returns a function that estimates the height of a line, to use as
28572
+ // first approximation until the line becomes visible (and is thus
28573
+ // properly measurable).
28574
+ function estimateHeight(cm) {
28575
+ var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
28576
+ var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
28577
+ return function (line) {
28578
+ if (lineIsHidden(cm.doc, line)) { return 0 }
28579
+
28580
+ var widgetsHeight = 0;
28581
+ if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
28582
+ if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
28583
+ } }
28584
+
28585
+ if (wrapping)
28586
+ { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
28587
+ else
28588
+ { return widgetsHeight + th }
28589
+ }
28590
+ }
28591
+
28592
+ function estimateLineHeights(cm) {
28593
+ var doc = cm.doc, est = estimateHeight(cm);
28594
+ doc.iter(function (line) {
28595
+ var estHeight = est(line);
28596
+ if (estHeight != line.height) { updateLineHeight(line, estHeight); }
28597
+ });
28598
+ }
28599
+
28600
+ // Given a mouse event, find the corresponding position. If liberal
28601
+ // is false, it checks whether a gutter or scrollbar was clicked,
28602
+ // and returns null if it was. forRect is used by rectangular
28603
+ // selections, and tries to estimate a character position even for
28604
+ // coordinates beyond the right of the text.
28605
+ function posFromMouse(cm, e, liberal, forRect) {
28606
+ var display = cm.display;
28607
+ if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
28608
+
28609
+ var x, y, space = display.lineSpace.getBoundingClientRect();
28610
+ // Fails unpredictably on IE[67] when mouse is dragged around quickly.
28611
+ try { x = e.clientX - space.left; y = e.clientY - space.top; }
28612
+ catch (e$1) { return null }
28613
+ var coords = coordsChar(cm, x, y), line;
28614
+ if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
28615
+ var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
28616
+ coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
28617
+ }
28618
+ return coords
28619
+ }
28620
+
28621
+ // Find the view element corresponding to a given line. Return null
28622
+ // when the line isn't visible.
28623
+ function findViewIndex(cm, n) {
28624
+ if (n >= cm.display.viewTo) { return null }
28625
+ n -= cm.display.viewFrom;
28626
+ if (n < 0) { return null }
28627
+ var view = cm.display.view;
28628
+ for (var i = 0; i < view.length; i++) {
28629
+ n -= view[i].size;
28630
+ if (n < 0) { return i }
28631
+ }
28632
+ }
28633
+
28634
+ // Updates the display.view data structure for a given change to the
28635
+ // document. From and to are in pre-change coordinates. Lendiff is
28636
+ // the amount of lines added or subtracted by the change. This is
28637
+ // used for changes that span multiple lines, or change the way
28638
+ // lines are divided into visual lines. regLineChange (below)
28639
+ // registers single-line changes.
28640
+ function regChange(cm, from, to, lendiff) {
28641
+ if (from == null) { from = cm.doc.first; }
28642
+ if (to == null) { to = cm.doc.first + cm.doc.size; }
28643
+ if (!lendiff) { lendiff = 0; }
28644
+
28645
+ var display = cm.display;
28646
+ if (lendiff && to < display.viewTo &&
28647
+ (display.updateLineNumbers == null || display.updateLineNumbers > from))
28648
+ { display.updateLineNumbers = from; }
28649
+
28650
+ cm.curOp.viewChanged = true;
28651
+
28652
+ if (from >= display.viewTo) { // Change after
28653
+ if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
28654
+ { resetView(cm); }
28655
+ } else if (to <= display.viewFrom) { // Change before
28656
+ if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
28657
+ resetView(cm);
28658
+ } else {
28659
+ display.viewFrom += lendiff;
28660
+ display.viewTo += lendiff;
28661
+ }
28662
+ } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
28663
+ resetView(cm);
28664
+ } else if (from <= display.viewFrom) { // Top overlap
28665
+ var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
28666
+ if (cut) {
28667
+ display.view = display.view.slice(cut.index);
28668
+ display.viewFrom = cut.lineN;
28669
+ display.viewTo += lendiff;
28670
+ } else {
28671
+ resetView(cm);
28672
+ }
28673
+ } else if (to >= display.viewTo) { // Bottom overlap
28674
+ var cut$1 = viewCuttingPoint(cm, from, from, -1);
28675
+ if (cut$1) {
28676
+ display.view = display.view.slice(0, cut$1.index);
28677
+ display.viewTo = cut$1.lineN;
28678
+ } else {
28679
+ resetView(cm);
28680
+ }
28681
+ } else { // Gap in the middle
28682
+ var cutTop = viewCuttingPoint(cm, from, from, -1);
28683
+ var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
28684
+ if (cutTop && cutBot) {
28685
+ display.view = display.view.slice(0, cutTop.index)
28686
+ .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
28687
+ .concat(display.view.slice(cutBot.index));
28688
+ display.viewTo += lendiff;
28689
+ } else {
28690
+ resetView(cm);
28691
+ }
28692
+ }
28693
+
28694
+ var ext = display.externalMeasured;
28695
+ if (ext) {
28696
+ if (to < ext.lineN)
28697
+ { ext.lineN += lendiff; }
28698
+ else if (from < ext.lineN + ext.size)
28699
+ { display.externalMeasured = null; }
28700
+ }
28701
+ }
28702
+
28703
+ // Register a change to a single line. Type must be one of "text",
28704
+ // "gutter", "class", "widget"
28705
+ function regLineChange(cm, line, type) {
28706
+ cm.curOp.viewChanged = true;
28707
+ var display = cm.display, ext = cm.display.externalMeasured;
28708
+ if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
28709
+ { display.externalMeasured = null; }
28710
+
28711
+ if (line < display.viewFrom || line >= display.viewTo) { return }
28712
+ var lineView = display.view[findViewIndex(cm, line)];
28713
+ if (lineView.node == null) { return }
28714
+ var arr = lineView.changes || (lineView.changes = []);
28715
+ if (indexOf(arr, type) == -1) { arr.push(type); }
28716
+ }
28717
+
28718
+ // Clear the view.
28719
+ function resetView(cm) {
28720
+ cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
28721
+ cm.display.view = [];
28722
+ cm.display.viewOffset = 0;
28723
+ }
28724
+
28725
+ function viewCuttingPoint(cm, oldN, newN, dir) {
28726
+ var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
28727
+ if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
28728
+ { return {index: index, lineN: newN} }
28729
+ var n = cm.display.viewFrom;
28730
+ for (var i = 0; i < index; i++)
28731
+ { n += view[i].size; }
28732
+ if (n != oldN) {
28733
+ if (dir > 0) {
28734
+ if (index == view.length - 1) { return null }
28735
+ diff = (n + view[index].size) - oldN;
28736
+ index++;
28737
+ } else {
28738
+ diff = n - oldN;
28739
+ }
28740
+ oldN += diff; newN += diff;
28741
+ }
28742
+ while (visualLineNo(cm.doc, newN) != newN) {
28743
+ if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
28744
+ newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
28745
+ index += dir;
28746
+ }
28747
+ return {index: index, lineN: newN}
28748
+ }
28749
+
28750
+ // Force the view to cover a given range, adding empty view element
28751
+ // or clipping off existing ones as needed.
28752
+ function adjustView(cm, from, to) {
28753
+ var display = cm.display, view = display.view;
28754
+ if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
28755
+ display.view = buildViewArray(cm, from, to);
28756
+ display.viewFrom = from;
28757
+ } else {
28758
+ if (display.viewFrom > from)
28759
+ { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
28760
+ else if (display.viewFrom < from)
28761
+ { display.view = display.view.slice(findViewIndex(cm, from)); }
28762
+ display.viewFrom = from;
28763
+ if (display.viewTo < to)
28764
+ { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
28765
+ else if (display.viewTo > to)
28766
+ { display.view = display.view.slice(0, findViewIndex(cm, to)); }
28767
+ }
28768
+ display.viewTo = to;
28769
+ }
28770
+
28771
+ // Count the number of lines in the view whose DOM representation is
28772
+ // out of date (or nonexistent).
28773
+ function countDirtyView(cm) {
28774
+ var view = cm.display.view, dirty = 0;
28775
+ for (var i = 0; i < view.length; i++) {
28776
+ var lineView = view[i];
28777
+ if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
28778
+ }
28779
+ return dirty
28780
+ }
28781
+
28782
+ function updateSelection(cm) {
28783
+ cm.display.input.showSelection(cm.display.input.prepareSelection());
28784
+ }
28785
+
28786
+ function prepareSelection(cm, primary) {
28787
+ if ( primary === void 0 ) primary = true;
28788
+
28789
+ var doc = cm.doc, result = {};
28790
+ var curFragment = result.cursors = document.createDocumentFragment();
28791
+ var selFragment = result.selection = document.createDocumentFragment();
28792
+
28793
+ for (var i = 0; i < doc.sel.ranges.length; i++) {
28794
+ if (!primary && i == doc.sel.primIndex) { continue }
28795
+ var range = doc.sel.ranges[i];
28796
+ if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
28797
+ var collapsed = range.empty();
28798
+ if (collapsed || cm.options.showCursorWhenSelecting)
28799
+ { drawSelectionCursor(cm, range.head, curFragment); }
28800
+ if (!collapsed)
28801
+ { drawSelectionRange(cm, range, selFragment); }
28802
+ }
28803
+ return result
28804
+ }
28805
+
28806
+ // Draws a cursor for the given range
28807
+ function drawSelectionCursor(cm, head, output) {
28808
+ var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
28809
+
28810
+ var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
28811
+ cursor.style.left = pos.left + "px";
28812
+ cursor.style.top = pos.top + "px";
28813
+ cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
28814
+
28815
+ if (pos.other) {
28816
+ // Secondary cursor, shown when on a 'jump' in bi-directional text
28817
+ var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
28818
+ otherCursor.style.display = "";
28819
+ otherCursor.style.left = pos.other.left + "px";
28820
+ otherCursor.style.top = pos.other.top + "px";
28821
+ otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
28822
+ }
28823
+ }
28824
+
28825
+ function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }
28826
+
28827
+ // Draws the given range as a highlighted selection
28828
+ function drawSelectionRange(cm, range, output) {
28829
+ var display = cm.display, doc = cm.doc;
28830
+ var fragment = document.createDocumentFragment();
28831
+ var padding = paddingH(cm.display), leftSide = padding.left;
28832
+ var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
28833
+ var docLTR = doc.direction == "ltr";
28834
+
28835
+ function add(left, top, width, bottom) {
28836
+ if (top < 0) { top = 0; }
28837
+ top = Math.round(top);
28838
+ bottom = Math.round(bottom);
28839
+ fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px")));
28840
+ }
28841
+
28842
+ function drawForLine(line, fromArg, toArg) {
28843
+ var lineObj = getLine(doc, line);
28844
+ var lineLen = lineObj.text.length;
28845
+ var start, end;
28846
+ function coords(ch, bias) {
28847
+ return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
28848
+ }
28849
+
28850
+ function wrapX(pos, dir, side) {
28851
+ var extent = wrappedLineExtentChar(cm, lineObj, null, pos);
28852
+ var prop = (dir == "ltr") == (side == "after") ? "left" : "right";
28853
+ var ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);
28854
+ return coords(ch, prop)[prop]
28855
+ }
28856
+
28857
+ var order = getOrder(lineObj, doc.direction);
28858
+ iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {
28859
+ var ltr = dir == "ltr";
28860
+ var fromPos = coords(from, ltr ? "left" : "right");
28861
+ var toPos = coords(to - 1, ltr ? "right" : "left");
28862
+
28863
+ var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;
28864
+ var first = i == 0, last = !order || i == order.length - 1;
28865
+ if (toPos.top - fromPos.top <= 3) { // Single line
28866
+ var openLeft = (docLTR ? openStart : openEnd) && first;
28867
+ var openRight = (docLTR ? openEnd : openStart) && last;
28868
+ var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;
28869
+ var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;
28870
+ add(left, fromPos.top, right - left, fromPos.bottom);
28871
+ } else { // Multiple lines
28872
+ var topLeft, topRight, botLeft, botRight;
28873
+ if (ltr) {
28874
+ topLeft = docLTR && openStart && first ? leftSide : fromPos.left;
28875
+ topRight = docLTR ? rightSide : wrapX(from, dir, "before");
28876
+ botLeft = docLTR ? leftSide : wrapX(to, dir, "after");
28877
+ botRight = docLTR && openEnd && last ? rightSide : toPos.right;
28878
+ } else {
28879
+ topLeft = !docLTR ? leftSide : wrapX(from, dir, "before");
28880
+ topRight = !docLTR && openStart && first ? rightSide : fromPos.right;
28881
+ botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;
28882
+ botRight = !docLTR ? rightSide : wrapX(to, dir, "after");
28883
+ }
28884
+ add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);
28885
+ if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }
28886
+ add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);
28887
+ }
28888
+
28889
+ if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }
28890
+ if (cmpCoords(toPos, start) < 0) { start = toPos; }
28891
+ if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }
28892
+ if (cmpCoords(toPos, end) < 0) { end = toPos; }
28893
+ });
28894
+ return {start: start, end: end}
28895
+ }
28896
+
28897
+ var sFrom = range.from(), sTo = range.to();
28898
+ if (sFrom.line == sTo.line) {
28899
+ drawForLine(sFrom.line, sFrom.ch, sTo.ch);
28900
+ } else {
28901
+ var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
28902
+ var singleVLine = visualLine(fromLine) == visualLine(toLine);
28903
+ var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
28904
+ var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
28905
+ if (singleVLine) {
28906
+ if (leftEnd.top < rightStart.top - 2) {
28907
+ add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
28908
+ add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
28909
+ } else {
28910
+ add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
28911
+ }
28912
+ }
28913
+ if (leftEnd.bottom < rightStart.top)
28914
+ { add(leftSide, leftEnd.bottom, null, rightStart.top); }
28915
+ }
28916
+
28917
+ output.appendChild(fragment);
28918
+ }
28919
+
28920
+ // Cursor-blinking
28921
+ function restartBlink(cm) {
28922
+ if (!cm.state.focused) { return }
28923
+ var display = cm.display;
28924
+ clearInterval(display.blinker);
28925
+ var on = true;
28926
+ display.cursorDiv.style.visibility = "";
28927
+ if (cm.options.cursorBlinkRate > 0)
28928
+ { display.blinker = setInterval(function () {
28929
+ if (!cm.hasFocus()) { onBlur(cm); }
28930
+ display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden";
28931
+ }, cm.options.cursorBlinkRate); }
28932
+ else if (cm.options.cursorBlinkRate < 0)
28933
+ { display.cursorDiv.style.visibility = "hidden"; }
28934
+ }
28935
+
28936
+ function ensureFocus(cm) {
28937
+ if (!cm.hasFocus()) {
28938
+ cm.display.input.focus();
28939
+ if (!cm.state.focused) { onFocus(cm); }
28940
+ }
28941
+ }
28942
+
28943
+ function delayBlurEvent(cm) {
28944
+ cm.state.delayingBlurEvent = true;
28945
+ setTimeout(function () { if (cm.state.delayingBlurEvent) {
28946
+ cm.state.delayingBlurEvent = false;
28947
+ if (cm.state.focused) { onBlur(cm); }
28948
+ } }, 100);
28949
+ }
28950
+
28951
+ function onFocus(cm, e) {
28952
+ if (cm.state.delayingBlurEvent && !cm.state.draggingText) { cm.state.delayingBlurEvent = false; }
28953
+
28954
+ if (cm.options.readOnly == "nocursor") { return }
28955
+ if (!cm.state.focused) {
28956
+ signal(cm, "focus", cm, e);
28957
+ cm.state.focused = true;
28958
+ addClass(cm.display.wrapper, "CodeMirror-focused");
28959
+ // This test prevents this from firing when a context
28960
+ // menu is closed (since the input reset would kill the
28961
+ // select-all detection hack)
28962
+ if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
28963
+ cm.display.input.reset();
28964
+ if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
28965
+ }
28966
+ cm.display.input.receivedFocus();
28967
+ }
28968
+ restartBlink(cm);
28969
+ }
28970
+ function onBlur(cm, e) {
28971
+ if (cm.state.delayingBlurEvent) { return }
28972
+
28973
+ if (cm.state.focused) {
28974
+ signal(cm, "blur", cm, e);
28975
+ cm.state.focused = false;
28976
+ rmClass(cm.display.wrapper, "CodeMirror-focused");
28977
+ }
28978
+ clearInterval(cm.display.blinker);
28979
+ setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
28980
+ }
28981
+
28982
+ // Read the actual heights of the rendered lines, and update their
28983
+ // stored heights to match.
28984
+ function updateHeightsInViewport(cm) {
28985
+ var display = cm.display;
28986
+ var prevBottom = display.lineDiv.offsetTop;
28987
+ for (var i = 0; i < display.view.length; i++) {
28988
+ var cur = display.view[i], wrapping = cm.options.lineWrapping;
28989
+ var height = (void 0), width = 0;
28990
+ if (cur.hidden) { continue }
28991
+ if (ie && ie_version < 8) {
28992
+ var bot = cur.node.offsetTop + cur.node.offsetHeight;
28993
+ height = bot - prevBottom;
28994
+ prevBottom = bot;
28995
+ } else {
28996
+ var box = cur.node.getBoundingClientRect();
28997
+ height = box.bottom - box.top;
28998
+ // Check that lines don't extend past the right of the current
28999
+ // editor width
29000
+ if (!wrapping && cur.text.firstChild)
29001
+ { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }
29002
+ }
29003
+ var diff = cur.line.height - height;
29004
+ if (diff > .005 || diff < -.005) {
29005
+ updateLineHeight(cur.line, height);
29006
+ updateWidgetHeight(cur.line);
29007
+ if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
29008
+ { updateWidgetHeight(cur.rest[j]); } }
29009
+ }
29010
+ if (width > cm.display.sizerWidth) {
29011
+ var chWidth = Math.ceil(width / charWidth(cm.display));
29012
+ if (chWidth > cm.display.maxLineLength) {
29013
+ cm.display.maxLineLength = chWidth;
29014
+ cm.display.maxLine = cur.line;
29015
+ cm.display.maxLineChanged = true;
29016
+ }
29017
+ }
29018
+ }
29019
+ }
29020
+
29021
+ // Read and store the height of line widgets associated with the
29022
+ // given line.
29023
+ function updateWidgetHeight(line) {
29024
+ if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {
29025
+ var w = line.widgets[i], parent = w.node.parentNode;
29026
+ if (parent) { w.height = parent.offsetHeight; }
29027
+ } }
29028
+ }
29029
+
29030
+ // Compute the lines that are visible in a given viewport (defaults
29031
+ // the the current scroll position). viewport may contain top,
29032
+ // height, and ensure (see op.scrollToPos) properties.
29033
+ function visibleLines(display, doc, viewport) {
29034
+ var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
29035
+ top = Math.floor(top - paddingTop(display));
29036
+ var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
29037
+
29038
+ var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
29039
+ // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
29040
+ // forces those lines into the viewport (if possible).
29041
+ if (viewport && viewport.ensure) {
29042
+ var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
29043
+ if (ensureFrom < from) {
29044
+ from = ensureFrom;
29045
+ to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
29046
+ } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
29047
+ from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
29048
+ to = ensureTo;
29049
+ }
29050
+ }
29051
+ return {from: from, to: Math.max(to, from + 1)}
29052
+ }
29053
+
29054
+ // SCROLLING THINGS INTO VIEW
29055
+
29056
+ // If an editor sits on the top or bottom of the window, partially
29057
+ // scrolled out of view, this ensures that the cursor is visible.
29058
+ function maybeScrollWindow(cm, rect) {
29059
+ if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
29060
+
29061
+ var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
29062
+ if (rect.top + box.top < 0) { doScroll = true; }
29063
+ else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
29064
+ if (doScroll != null && !phantom) {
29065
+ var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
29066
+ cm.display.lineSpace.appendChild(scrollNode);
29067
+ scrollNode.scrollIntoView(doScroll);
29068
+ cm.display.lineSpace.removeChild(scrollNode);
29069
+ }
29070
+ }
29071
+
29072
+ // Scroll a given position into view (immediately), verifying that
29073
+ // it actually became visible (as line heights are accurately
29074
+ // measured, the position of something may 'drift' during drawing).
29075
+ function scrollPosIntoView(cm, pos, end, margin) {
29076
+ if (margin == null) { margin = 0; }
29077
+ var rect;
29078
+ if (!cm.options.lineWrapping && pos == end) {
29079
+ // Set pos and end to the cursor positions around the character pos sticks to
29080
+ // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch
29081
+ // If pos == Pos(_, 0, "before"), pos and end are unchanged
29082
+ pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos;
29083
+ end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos;
29084
+ }
29085
+ for (var limit = 0; limit < 5; limit++) {
29086
+ var changed = false;
29087
+ var coords = cursorCoords(cm, pos);
29088
+ var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
29089
+ rect = {left: Math.min(coords.left, endCoords.left),
29090
+ top: Math.min(coords.top, endCoords.top) - margin,
29091
+ right: Math.max(coords.left, endCoords.left),
29092
+ bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
29093
+ var scrollPos = calculateScrollPos(cm, rect);
29094
+ var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
29095
+ if (scrollPos.scrollTop != null) {
29096
+ updateScrollTop(cm, scrollPos.scrollTop);
29097
+ if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
29098
+ }
29099
+ if (scrollPos.scrollLeft != null) {
29100
+ setScrollLeft(cm, scrollPos.scrollLeft);
29101
+ if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
29102
+ }
29103
+ if (!changed) { break }
29104
+ }
29105
+ return rect
29106
+ }
29107
+
29108
+ // Scroll a given set of coordinates into view (immediately).
29109
+ function scrollIntoView(cm, rect) {
29110
+ var scrollPos = calculateScrollPos(cm, rect);
29111
+ if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }
29112
+ if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
29113
+ }
29114
+
29115
+ // Calculate a new scroll position needed to scroll the given
29116
+ // rectangle into view. Returns an object with scrollTop and
29117
+ // scrollLeft properties. When these are undefined, the
29118
+ // vertical/horizontal position does not need to be adjusted.
29119
+ function calculateScrollPos(cm, rect) {
29120
+ var display = cm.display, snapMargin = textHeight(cm.display);
29121
+ if (rect.top < 0) { rect.top = 0; }
29122
+ var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
29123
+ var screen = displayHeight(cm), result = {};
29124
+ if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
29125
+ var docBottom = cm.doc.height + paddingVert(display);
29126
+ var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
29127
+ if (rect.top < screentop) {
29128
+ result.scrollTop = atTop ? 0 : rect.top;
29129
+ } else if (rect.bottom > screentop + screen) {
29130
+ var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
29131
+ if (newTop != screentop) { result.scrollTop = newTop; }
29132
+ }
29133
+
29134
+ var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;
29135
+ var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;
29136
+ var screenw = displayWidth(cm) - display.gutters.offsetWidth;
29137
+ var tooWide = rect.right - rect.left > screenw;
29138
+ if (tooWide) { rect.right = rect.left + screenw; }
29139
+ if (rect.left < 10)
29140
+ { result.scrollLeft = 0; }
29141
+ else if (rect.left < screenleft)
29142
+ { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }
29143
+ else if (rect.right > screenw + screenleft - 3)
29144
+ { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
29145
+ return result
29146
+ }
29147
+
29148
+ // Store a relative adjustment to the scroll position in the current
29149
+ // operation (to be applied when the operation finishes).
29150
+ function addToScrollTop(cm, top) {
29151
+ if (top == null) { return }
29152
+ resolveScrollToPos(cm);
29153
+ cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;
29154
+ }
29155
+
29156
+ // Make sure that at the end of the operation the current cursor is
29157
+ // shown.
29158
+ function ensureCursorVisible(cm) {
29159
+ resolveScrollToPos(cm);
29160
+ var cur = cm.getCursor();
29161
+ cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};
29162
+ }
29163
+
29164
+ function scrollToCoords(cm, x, y) {
29165
+ if (x != null || y != null) { resolveScrollToPos(cm); }
29166
+ if (x != null) { cm.curOp.scrollLeft = x; }
29167
+ if (y != null) { cm.curOp.scrollTop = y; }
29168
+ }
29169
+
29170
+ function scrollToRange(cm, range) {
29171
+ resolveScrollToPos(cm);
29172
+ cm.curOp.scrollToPos = range;
29173
+ }
29174
+
29175
+ // When an operation has its scrollToPos property set, and another
29176
+ // scroll action is applied before the end of the operation, this
29177
+ // 'simulates' scrolling that position into view in a cheap way, so
29178
+ // that the effect of intermediate scroll commands is not ignored.
29179
+ function resolveScrollToPos(cm) {
29180
+ var range = cm.curOp.scrollToPos;
29181
+ if (range) {
29182
+ cm.curOp.scrollToPos = null;
29183
+ var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
29184
+ scrollToCoordsRange(cm, from, to, range.margin);
29185
+ }
29186
+ }
29187
+
29188
+ function scrollToCoordsRange(cm, from, to, margin) {
29189
+ var sPos = calculateScrollPos(cm, {
29190
+ left: Math.min(from.left, to.left),
29191
+ top: Math.min(from.top, to.top) - margin,
29192
+ right: Math.max(from.right, to.right),
29193
+ bottom: Math.max(from.bottom, to.bottom) + margin
29194
+ });
29195
+ scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);
29196
+ }
29197
+
29198
+ // Sync the scrollable area and scrollbars, ensure the viewport
29199
+ // covers the visible area.
29200
+ function updateScrollTop(cm, val) {
29201
+ if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
29202
+ if (!gecko) { updateDisplaySimple(cm, {top: val}); }
29203
+ setScrollTop(cm, val, true);
29204
+ if (gecko) { updateDisplaySimple(cm); }
29205
+ startWorker(cm, 100);
29206
+ }
29207
+
29208
+ function setScrollTop(cm, val, forceScroll) {
29209
+ val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val));
29210
+ if (cm.display.scroller.scrollTop == val && !forceScroll) { return }
29211
+ cm.doc.scrollTop = val;
29212
+ cm.display.scrollbars.setScrollTop(val);
29213
+ if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
29214
+ }
29215
+
29216
+ // Sync scroller and scrollbar, ensure the gutter elements are
29217
+ // aligned.
29218
+ function setScrollLeft(cm, val, isScroller, forceScroll) {
29219
+ val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth));
29220
+ if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }
29221
+ cm.doc.scrollLeft = val;
29222
+ alignHorizontally(cm);
29223
+ if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
29224
+ cm.display.scrollbars.setScrollLeft(val);
29225
+ }
29226
+
29227
+ // SCROLLBARS
29228
+
29229
+ // Prepare DOM reads needed to update the scrollbars. Done in one
29230
+ // shot to minimize update/measure roundtrips.
29231
+ function measureForScrollbars(cm) {
29232
+ var d = cm.display, gutterW = d.gutters.offsetWidth;
29233
+ var docH = Math.round(cm.doc.height + paddingVert(cm.display));
29234
+ return {
29235
+ clientHeight: d.scroller.clientHeight,
29236
+ viewHeight: d.wrapper.clientHeight,
29237
+ scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
29238
+ viewWidth: d.wrapper.clientWidth,
29239
+ barLeft: cm.options.fixedGutter ? gutterW : 0,
29240
+ docHeight: docH,
29241
+ scrollHeight: docH + scrollGap(cm) + d.barHeight,
29242
+ nativeBarWidth: d.nativeBarWidth,
29243
+ gutterWidth: gutterW
29244
+ }
29245
+ }
29246
+
29247
+ var NativeScrollbars = function(place, scroll, cm) {
29248
+ this.cm = cm;
29249
+ var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
29250
+ var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
29251
+ vert.tabIndex = horiz.tabIndex = -1;
29252
+ place(vert); place(horiz);
29253
+
29254
+ on(vert, "scroll", function () {
29255
+ if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
29256
+ });
29257
+ on(horiz, "scroll", function () {
29258
+ if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
29259
+ });
29260
+
29261
+ this.checkedZeroWidth = false;
29262
+ // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
29263
+ if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
29264
+ };
29265
+
29266
+ NativeScrollbars.prototype.update = function (measure) {
29267
+ var needsH = measure.scrollWidth > measure.clientWidth + 1;
29268
+ var needsV = measure.scrollHeight > measure.clientHeight + 1;
29269
+ var sWidth = measure.nativeBarWidth;
29270
+
29271
+ if (needsV) {
29272
+ this.vert.style.display = "block";
29273
+ this.vert.style.bottom = needsH ? sWidth + "px" : "0";
29274
+ var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
29275
+ // A bug in IE8 can cause this value to be negative, so guard it.
29276
+ this.vert.firstChild.style.height =
29277
+ Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
29278
+ } else {
29279
+ this.vert.style.display = "";
29280
+ this.vert.firstChild.style.height = "0";
29281
+ }
29282
+
29283
+ if (needsH) {
29284
+ this.horiz.style.display = "block";
29285
+ this.horiz.style.right = needsV ? sWidth + "px" : "0";
29286
+ this.horiz.style.left = measure.barLeft + "px";
29287
+ var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
29288
+ this.horiz.firstChild.style.width =
29289
+ Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
29290
+ } else {
29291
+ this.horiz.style.display = "";
29292
+ this.horiz.firstChild.style.width = "0";
29293
+ }
29294
+
29295
+ if (!this.checkedZeroWidth && measure.clientHeight > 0) {
29296
+ if (sWidth == 0) { this.zeroWidthHack(); }
29297
+ this.checkedZeroWidth = true;
29298
+ }
29299
+
29300
+ return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
29301
+ };
29302
+
29303
+ NativeScrollbars.prototype.setScrollLeft = function (pos) {
29304
+ if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
29305
+ if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz"); }
29306
+ };
29307
+
29308
+ NativeScrollbars.prototype.setScrollTop = function (pos) {
29309
+ if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
29310
+ if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert"); }
29311
+ };
29312
+
29313
+ NativeScrollbars.prototype.zeroWidthHack = function () {
29314
+ var w = mac && !mac_geMountainLion ? "12px" : "18px";
29315
+ this.horiz.style.height = this.vert.style.width = w;
29316
+ this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
29317
+ this.disableHoriz = new Delayed;
29318
+ this.disableVert = new Delayed;
29319
+ };
29320
+
29321
+ NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
29322
+ bar.style.pointerEvents = "auto";
29323
+ function maybeDisable() {
29324
+ // To find out whether the scrollbar is still visible, we
29325
+ // check whether the element under the pixel in the bottom
29326
+ // right corner of the scrollbar box is the scrollbar box
29327
+ // itself (when the bar is still visible) or its filler child
29328
+ // (when the bar is hidden). If it is still visible, we keep
29329
+ // it enabled, if it's hidden, we disable pointer events.
29330
+ var box = bar.getBoundingClientRect();
29331
+ var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
29332
+ : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
29333
+ if (elt != bar) { bar.style.pointerEvents = "none"; }
29334
+ else { delay.set(1000, maybeDisable); }
29335
+ }
29336
+ delay.set(1000, maybeDisable);
29337
+ };
29338
+
29339
+ NativeScrollbars.prototype.clear = function () {
29340
+ var parent = this.horiz.parentNode;
29341
+ parent.removeChild(this.horiz);
29342
+ parent.removeChild(this.vert);
29343
+ };
29344
+
29345
+ var NullScrollbars = function () {};
29346
+
29347
+ NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
29348
+ NullScrollbars.prototype.setScrollLeft = function () {};
29349
+ NullScrollbars.prototype.setScrollTop = function () {};
29350
+ NullScrollbars.prototype.clear = function () {};
29351
+
29352
+ function updateScrollbars(cm, measure) {
29353
+ if (!measure) { measure = measureForScrollbars(cm); }
29354
+ var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
29355
+ updateScrollbarsInner(cm, measure);
29356
+ for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
29357
+ if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
29358
+ { updateHeightsInViewport(cm); }
29359
+ updateScrollbarsInner(cm, measureForScrollbars(cm));
29360
+ startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
29361
+ }
29362
+ }
29363
+
29364
+ // Re-synchronize the fake scrollbars with the actual size of the
29365
+ // content.
29366
+ function updateScrollbarsInner(cm, measure) {
29367
+ var d = cm.display;
29368
+ var sizes = d.scrollbars.update(measure);
29369
+
29370
+ d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
29371
+ d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
29372
+ d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
29373
+
29374
+ if (sizes.right && sizes.bottom) {
29375
+ d.scrollbarFiller.style.display = "block";
29376
+ d.scrollbarFiller.style.height = sizes.bottom + "px";
29377
+ d.scrollbarFiller.style.width = sizes.right + "px";
29378
+ } else { d.scrollbarFiller.style.display = ""; }
29379
+ if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
29380
+ d.gutterFiller.style.display = "block";
29381
+ d.gutterFiller.style.height = sizes.bottom + "px";
29382
+ d.gutterFiller.style.width = measure.gutterWidth + "px";
29383
+ } else { d.gutterFiller.style.display = ""; }
29384
+ }
29385
+
29386
+ var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
29387
+
29388
+ function initScrollbars(cm) {
29389
+ if (cm.display.scrollbars) {
29390
+ cm.display.scrollbars.clear();
29391
+ if (cm.display.scrollbars.addClass)
29392
+ { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
29393
+ }
29394
+
29395
+ cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
29396
+ cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
29397
+ // Prevent clicks in the scrollbars from killing focus
29398
+ on(node, "mousedown", function () {
29399
+ if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
29400
+ });
29401
+ node.setAttribute("cm-not-content", "true");
29402
+ }, function (pos, axis) {
29403
+ if (axis == "horizontal") { setScrollLeft(cm, pos); }
29404
+ else { updateScrollTop(cm, pos); }
29405
+ }, cm);
29406
+ if (cm.display.scrollbars.addClass)
29407
+ { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
29408
+ }
29409
+
29410
+ // Operations are used to wrap a series of changes to the editor
29411
+ // state in such a way that each change won't have to update the
29412
+ // cursor and display (which would be awkward, slow, and
29413
+ // error-prone). Instead, display updates are batched and then all
29414
+ // combined and executed at once.
29415
+
29416
+ var nextOpId = 0;
29417
+ // Start a new operation.
29418
+ function startOperation(cm) {
29419
+ cm.curOp = {
29420
+ cm: cm,
29421
+ viewChanged: false, // Flag that indicates that lines might need to be redrawn
29422
+ startHeight: cm.doc.height, // Used to detect need to update scrollbar
29423
+ forceUpdate: false, // Used to force a redraw
29424
+ updateInput: 0, // Whether to reset the input textarea
29425
+ typing: false, // Whether this reset should be careful to leave existing text (for compositing)
29426
+ changeObjs: null, // Accumulated changes, for firing change events
29427
+ cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
29428
+ cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
29429
+ selectionChanged: false, // Whether the selection needs to be redrawn
29430
+ updateMaxLine: false, // Set when the widest line needs to be determined anew
29431
+ scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
29432
+ scrollToPos: null, // Used to scroll to a specific position
29433
+ focus: false,
29434
+ id: ++nextOpId // Unique ID
29435
+ };
29436
+ pushOperation(cm.curOp);
29437
+ }
29438
+
29439
+ // Finish an operation, updating the display and signalling delayed events
29440
+ function endOperation(cm) {
29441
+ var op = cm.curOp;
29442
+ if (op) { finishOperation(op, function (group) {
29443
+ for (var i = 0; i < group.ops.length; i++)
29444
+ { group.ops[i].cm.curOp = null; }
29445
+ endOperations(group);
29446
+ }); }
29447
+ }
29448
+
29449
+ // The DOM updates done when an operation finishes are batched so
29450
+ // that the minimum number of relayouts are required.
29451
+ function endOperations(group) {
29452
+ var ops = group.ops;
29453
+ for (var i = 0; i < ops.length; i++) // Read DOM
29454
+ { endOperation_R1(ops[i]); }
29455
+ for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
29456
+ { endOperation_W1(ops[i$1]); }
29457
+ for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
29458
+ { endOperation_R2(ops[i$2]); }
29459
+ for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
29460
+ { endOperation_W2(ops[i$3]); }
29461
+ for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
29462
+ { endOperation_finish(ops[i$4]); }
29463
+ }
29464
+
29465
+ function endOperation_R1(op) {
29466
+ var cm = op.cm, display = cm.display;
29467
+ maybeClipScrollbars(cm);
29468
+ if (op.updateMaxLine) { findMaxLine(cm); }
29469
+
29470
+ op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
29471
+ op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
29472
+ op.scrollToPos.to.line >= display.viewTo) ||
29473
+ display.maxLineChanged && cm.options.lineWrapping;
29474
+ op.update = op.mustUpdate &&
29475
+ new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
29476
+ }
29477
+
29478
+ function endOperation_W1(op) {
29479
+ op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
29480
+ }
29481
+
29482
+ function endOperation_R2(op) {
29483
+ var cm = op.cm, display = cm.display;
29484
+ if (op.updatedDisplay) { updateHeightsInViewport(cm); }
29485
+
29486
+ op.barMeasure = measureForScrollbars(cm);
29487
+
29488
+ // If the max line changed since it was last measured, measure it,
29489
+ // and ensure the document's width matches it.
29490
+ // updateDisplay_W2 will use these properties to do the actual resizing
29491
+ if (display.maxLineChanged && !cm.options.lineWrapping) {
29492
+ op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
29493
+ cm.display.sizerWidth = op.adjustWidthTo;
29494
+ op.barMeasure.scrollWidth =
29495
+ Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
29496
+ op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
29497
+ }
29498
+
29499
+ if (op.updatedDisplay || op.selectionChanged)
29500
+ { op.preparedSelection = display.input.prepareSelection(); }
29501
+ }
29502
+
29503
+ function endOperation_W2(op) {
29504
+ var cm = op.cm;
29505
+
29506
+ if (op.adjustWidthTo != null) {
29507
+ cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
29508
+ if (op.maxScrollLeft < cm.doc.scrollLeft)
29509
+ { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
29510
+ cm.display.maxLineChanged = false;
29511
+ }
29512
+
29513
+ var takeFocus = op.focus && op.focus == activeElt();
29514
+ if (op.preparedSelection)
29515
+ { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
29516
+ if (op.updatedDisplay || op.startHeight != cm.doc.height)
29517
+ { updateScrollbars(cm, op.barMeasure); }
29518
+ if (op.updatedDisplay)
29519
+ { setDocumentHeight(cm, op.barMeasure); }
29520
+
29521
+ if (op.selectionChanged) { restartBlink(cm); }
29522
+
29523
+ if (cm.state.focused && op.updateInput)
29524
+ { cm.display.input.reset(op.typing); }
29525
+ if (takeFocus) { ensureFocus(op.cm); }
29526
+ }
29527
+
29528
+ function endOperation_finish(op) {
29529
+ var cm = op.cm, display = cm.display, doc = cm.doc;
29530
+
29531
+ if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
29532
+
29533
+ // Abort mouse wheel delta measurement, when scrolling explicitly
29534
+ if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
29535
+ { display.wheelStartX = display.wheelStartY = null; }
29536
+
29537
+ // Propagate the scroll position to the actual DOM scroller
29538
+ if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }
29539
+
29540
+ if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }
29541
+ // If we need to scroll a specific position into view, do so.
29542
+ if (op.scrollToPos) {
29543
+ var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
29544
+ clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
29545
+ maybeScrollWindow(cm, rect);
29546
+ }
29547
+
29548
+ // Fire events for markers that are hidden/unidden by editing or
29549
+ // undoing
29550
+ var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
29551
+ if (hidden) { for (var i = 0; i < hidden.length; ++i)
29552
+ { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
29553
+ if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
29554
+ { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
29555
+
29556
+ if (display.wrapper.offsetHeight)
29557
+ { doc.scrollTop = cm.display.scroller.scrollTop; }
29558
+
29559
+ // Fire change events, and delayed event handlers
29560
+ if (op.changeObjs)
29561
+ { signal(cm, "changes", cm, op.changeObjs); }
29562
+ if (op.update)
29563
+ { op.update.finish(); }
29564
+ }
29565
+
29566
+ // Run the given function in an operation
29567
+ function runInOp(cm, f) {
29568
+ if (cm.curOp) { return f() }
29569
+ startOperation(cm);
29570
+ try { return f() }
29571
+ finally { endOperation(cm); }
29572
+ }
29573
+ // Wraps a function in an operation. Returns the wrapped function.
29574
+ function operation(cm, f) {
29575
+ return function() {
29576
+ if (cm.curOp) { return f.apply(cm, arguments) }
29577
+ startOperation(cm);
29578
+ try { return f.apply(cm, arguments) }
29579
+ finally { endOperation(cm); }
29580
+ }
29581
+ }
29582
+ // Used to add methods to editor and doc instances, wrapping them in
29583
+ // operations.
29584
+ function methodOp(f) {
29585
+ return function() {
29586
+ if (this.curOp) { return f.apply(this, arguments) }
29587
+ startOperation(this);
29588
+ try { return f.apply(this, arguments) }
29589
+ finally { endOperation(this); }
29590
+ }
29591
+ }
29592
+ function docMethodOp(f) {
29593
+ return function() {
29594
+ var cm = this.cm;
29595
+ if (!cm || cm.curOp) { return f.apply(this, arguments) }
29596
+ startOperation(cm);
29597
+ try { return f.apply(this, arguments) }
29598
+ finally { endOperation(cm); }
29599
+ }
29600
+ }
29601
+
29602
+ // HIGHLIGHT WORKER
29603
+
29604
+ function startWorker(cm, time) {
29605
+ if (cm.doc.highlightFrontier < cm.display.viewTo)
29606
+ { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
29607
+ }
29608
+
29609
+ function highlightWorker(cm) {
29610
+ var doc = cm.doc;
29611
+ if (doc.highlightFrontier >= cm.display.viewTo) { return }
29612
+ var end = +new Date + cm.options.workTime;
29613
+ var context = getContextBefore(cm, doc.highlightFrontier);
29614
+ var changedLines = [];
29615
+
29616
+ doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
29617
+ if (context.line >= cm.display.viewFrom) { // Visible
29618
+ var oldStyles = line.styles;
29619
+ var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;
29620
+ var highlighted = highlightLine(cm, line, context, true);
29621
+ if (resetState) { context.state = resetState; }
29622
+ line.styles = highlighted.styles;
29623
+ var oldCls = line.styleClasses, newCls = highlighted.classes;
29624
+ if (newCls) { line.styleClasses = newCls; }
29625
+ else if (oldCls) { line.styleClasses = null; }
29626
+ var ischange = !oldStyles || oldStyles.length != line.styles.length ||
29627
+ oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
29628
+ for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
29629
+ if (ischange) { changedLines.push(context.line); }
29630
+ line.stateAfter = context.save();
29631
+ context.nextLine();
29632
+ } else {
29633
+ if (line.text.length <= cm.options.maxHighlightLength)
29634
+ { processLine(cm, line.text, context); }
29635
+ line.stateAfter = context.line % 5 == 0 ? context.save() : null;
29636
+ context.nextLine();
29637
+ }
29638
+ if (+new Date > end) {
29639
+ startWorker(cm, cm.options.workDelay);
29640
+ return true
29641
+ }
29642
+ });
29643
+ doc.highlightFrontier = context.line;
29644
+ doc.modeFrontier = Math.max(doc.modeFrontier, context.line);
29645
+ if (changedLines.length) { runInOp(cm, function () {
29646
+ for (var i = 0; i < changedLines.length; i++)
29647
+ { regLineChange(cm, changedLines[i], "text"); }
29648
+ }); }
29649
+ }
29650
+
29651
+ // DISPLAY DRAWING
29652
+
29653
+ var DisplayUpdate = function(cm, viewport, force) {
29654
+ var display = cm.display;
29655
+
29656
+ this.viewport = viewport;
29657
+ // Store some values that we'll need later (but don't want to force a relayout for)
29658
+ this.visible = visibleLines(display, cm.doc, viewport);
29659
+ this.editorIsHidden = !display.wrapper.offsetWidth;
29660
+ this.wrapperHeight = display.wrapper.clientHeight;
29661
+ this.wrapperWidth = display.wrapper.clientWidth;
29662
+ this.oldDisplayWidth = displayWidth(cm);
29663
+ this.force = force;
29664
+ this.dims = getDimensions(cm);
29665
+ this.events = [];
29666
+ };
29667
+
29668
+ DisplayUpdate.prototype.signal = function (emitter, type) {
29669
+ if (hasHandler(emitter, type))
29670
+ { this.events.push(arguments); }
29671
+ };
29672
+ DisplayUpdate.prototype.finish = function () {
29673
+ for (var i = 0; i < this.events.length; i++)
29674
+ { signal.apply(null, this.events[i]); }
29675
+ };
29676
+
29677
+ function maybeClipScrollbars(cm) {
29678
+ var display = cm.display;
29679
+ if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
29680
+ display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
29681
+ display.heightForcer.style.height = scrollGap(cm) + "px";
29682
+ display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
29683
+ display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
29684
+ display.scrollbarsClipped = true;
29685
+ }
29686
+ }
29687
+
29688
+ function selectionSnapshot(cm) {
29689
+ if (cm.hasFocus()) { return null }
29690
+ var active = activeElt();
29691
+ if (!active || !contains(cm.display.lineDiv, active)) { return null }
29692
+ var result = {activeElt: active};
29693
+ if (window.getSelection) {
29694
+ var sel = window.getSelection();
29695
+ if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
29696
+ result.anchorNode = sel.anchorNode;
29697
+ result.anchorOffset = sel.anchorOffset;
29698
+ result.focusNode = sel.focusNode;
29699
+ result.focusOffset = sel.focusOffset;
29700
+ }
29701
+ }
29702
+ return result
29703
+ }
29704
+
29705
+ function restoreSelection(snapshot) {
29706
+ if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
29707
+ snapshot.activeElt.focus();
29708
+ if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
29709
+ snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
29710
+ var sel = window.getSelection(), range = document.createRange();
29711
+ range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
29712
+ range.collapse(false);
29713
+ sel.removeAllRanges();
29714
+ sel.addRange(range);
29715
+ sel.extend(snapshot.focusNode, snapshot.focusOffset);
29716
+ }
29717
+ }
29718
+
29719
+ // Does the actual updating of the line display. Bails out
29720
+ // (returning false) when there is nothing to be done and forced is
29721
+ // false.
29722
+ function updateDisplayIfNeeded(cm, update) {
29723
+ var display = cm.display, doc = cm.doc;
29724
+
29725
+ if (update.editorIsHidden) {
29726
+ resetView(cm);
29727
+ return false
29728
+ }
29729
+
29730
+ // Bail out if the visible area is already rendered and nothing changed.
29731
+ if (!update.force &&
29732
+ update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
29733
+ (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
29734
+ display.renderedView == display.view && countDirtyView(cm) == 0)
29735
+ { return false }
29736
+
29737
+ if (maybeUpdateLineNumberWidth(cm)) {
29738
+ resetView(cm);
29739
+ update.dims = getDimensions(cm);
29740
+ }
29741
+
29742
+ // Compute a suitable new viewport (from & to)
29743
+ var end = doc.first + doc.size;
29744
+ var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
29745
+ var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
29746
+ if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
29747
+ if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
29748
+ if (sawCollapsedSpans) {
29749
+ from = visualLineNo(cm.doc, from);
29750
+ to = visualLineEndNo(cm.doc, to);
29751
+ }
29752
+
29753
+ var different = from != display.viewFrom || to != display.viewTo ||
29754
+ display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
29755
+ adjustView(cm, from, to);
29756
+
29757
+ display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
29758
+ // Position the mover div to align with the current scroll position
29759
+ cm.display.mover.style.top = display.viewOffset + "px";
29760
+
29761
+ var toUpdate = countDirtyView(cm);
29762
+ if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
29763
+ (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
29764
+ { return false }
29765
+
29766
+ // For big changes, we hide the enclosing element during the
29767
+ // update, since that speeds up the operations on most browsers.
29768
+ var selSnapshot = selectionSnapshot(cm);
29769
+ if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
29770
+ patchDisplay(cm, display.updateLineNumbers, update.dims);
29771
+ if (toUpdate > 4) { display.lineDiv.style.display = ""; }
29772
+ display.renderedView = display.view;
29773
+ // There might have been a widget with a focused element that got
29774
+ // hidden or updated, if so re-focus it.
29775
+ restoreSelection(selSnapshot);
29776
+
29777
+ // Prevent selection and cursors from interfering with the scroll
29778
+ // width and height.
29779
+ removeChildren(display.cursorDiv);
29780
+ removeChildren(display.selectionDiv);
29781
+ display.gutters.style.height = display.sizer.style.minHeight = 0;
29782
+
29783
+ if (different) {
29784
+ display.lastWrapHeight = update.wrapperHeight;
29785
+ display.lastWrapWidth = update.wrapperWidth;
29786
+ startWorker(cm, 400);
29787
+ }
29788
+
29789
+ display.updateLineNumbers = null;
29790
+
29791
+ return true
29792
+ }
29793
+
29794
+ function postUpdateDisplay(cm, update) {
29795
+ var viewport = update.viewport;
29796
+
29797
+ for (var first = true;; first = false) {
29798
+ if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
29799
+ // Clip forced viewport to actual scrollable area.
29800
+ if (viewport && viewport.top != null)
29801
+ { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
29802
+ // Updated line heights might result in the drawn area not
29803
+ // actually covering the viewport. Keep looping until it does.
29804
+ update.visible = visibleLines(cm.display, cm.doc, viewport);
29805
+ if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
29806
+ { break }
29807
+ } else if (first) {
29808
+ update.visible = visibleLines(cm.display, cm.doc, viewport);
29809
+ }
29810
+ if (!updateDisplayIfNeeded(cm, update)) { break }
29811
+ updateHeightsInViewport(cm);
29812
+ var barMeasure = measureForScrollbars(cm);
29813
+ updateSelection(cm);
29814
+ updateScrollbars(cm, barMeasure);
29815
+ setDocumentHeight(cm, barMeasure);
29816
+ update.force = false;
29817
+ }
29818
+
29819
+ update.signal(cm, "update", cm);
29820
+ if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
29821
+ update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
29822
+ cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
29823
+ }
29824
+ }
29825
+
29826
+ function updateDisplaySimple(cm, viewport) {
29827
+ var update = new DisplayUpdate(cm, viewport);
29828
+ if (updateDisplayIfNeeded(cm, update)) {
29829
+ updateHeightsInViewport(cm);
29830
+ postUpdateDisplay(cm, update);
29831
+ var barMeasure = measureForScrollbars(cm);
29832
+ updateSelection(cm);
29833
+ updateScrollbars(cm, barMeasure);
29834
+ setDocumentHeight(cm, barMeasure);
29835
+ update.finish();
29836
+ }
29837
+ }
29838
+
29839
+ // Sync the actual display DOM structure with display.view, removing
29840
+ // nodes for lines that are no longer in view, and creating the ones
29841
+ // that are not there yet, and updating the ones that are out of
29842
+ // date.
29843
+ function patchDisplay(cm, updateNumbersFrom, dims) {
29844
+ var display = cm.display, lineNumbers = cm.options.lineNumbers;
29845
+ var container = display.lineDiv, cur = container.firstChild;
29846
+
29847
+ function rm(node) {
29848
+ var next = node.nextSibling;
29849
+ // Works around a throw-scroll bug in OS X Webkit
29850
+ if (webkit && mac && cm.display.currentWheelTarget == node)
29851
+ { node.style.display = "none"; }
29852
+ else
29853
+ { node.parentNode.removeChild(node); }
29854
+ return next
29855
+ }
29856
+
29857
+ var view = display.view, lineN = display.viewFrom;
29858
+ // Loop over the elements in the view, syncing cur (the DOM nodes
29859
+ // in display.lineDiv) with the view as we go.
29860
+ for (var i = 0; i < view.length; i++) {
29861
+ var lineView = view[i];
29862
+ if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
29863
+ var node = buildLineElement(cm, lineView, lineN, dims);
29864
+ container.insertBefore(node, cur);
29865
+ } else { // Already drawn
29866
+ while (cur != lineView.node) { cur = rm(cur); }
29867
+ var updateNumber = lineNumbers && updateNumbersFrom != null &&
29868
+ updateNumbersFrom <= lineN && lineView.lineNumber;
29869
+ if (lineView.changes) {
29870
+ if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
29871
+ updateLineForChanges(cm, lineView, lineN, dims);
29872
+ }
29873
+ if (updateNumber) {
29874
+ removeChildren(lineView.lineNumber);
29875
+ lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
29876
+ }
29877
+ cur = lineView.node.nextSibling;
29878
+ }
29879
+ lineN += lineView.size;
29880
+ }
29881
+ while (cur) { cur = rm(cur); }
29882
+ }
29883
+
29884
+ function updateGutterSpace(display) {
29885
+ var width = display.gutters.offsetWidth;
29886
+ display.sizer.style.marginLeft = width + "px";
29887
+ }
29888
+
29889
+ function setDocumentHeight(cm, measure) {
29890
+ cm.display.sizer.style.minHeight = measure.docHeight + "px";
29891
+ cm.display.heightForcer.style.top = measure.docHeight + "px";
29892
+ cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
29893
+ }
29894
+
29895
+ // Re-align line numbers and gutter marks to compensate for
29896
+ // horizontal scrolling.
29897
+ function alignHorizontally(cm) {
29898
+ var display = cm.display, view = display.view;
29899
+ if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
29900
+ var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
29901
+ var gutterW = display.gutters.offsetWidth, left = comp + "px";
29902
+ for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
29903
+ if (cm.options.fixedGutter) {
29904
+ if (view[i].gutter)
29905
+ { view[i].gutter.style.left = left; }
29906
+ if (view[i].gutterBackground)
29907
+ { view[i].gutterBackground.style.left = left; }
29908
+ }
29909
+ var align = view[i].alignable;
29910
+ if (align) { for (var j = 0; j < align.length; j++)
29911
+ { align[j].style.left = left; } }
29912
+ } }
29913
+ if (cm.options.fixedGutter)
29914
+ { display.gutters.style.left = (comp + gutterW) + "px"; }
29915
+ }
29916
+
29917
+ // Used to ensure that the line number gutter is still the right
29918
+ // size for the current document size. Returns true when an update
29919
+ // is needed.
29920
+ function maybeUpdateLineNumberWidth(cm) {
29921
+ if (!cm.options.lineNumbers) { return false }
29922
+ var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
29923
+ if (last.length != display.lineNumChars) {
29924
+ var test = display.measure.appendChild(elt("div", [elt("div", last)],
29925
+ "CodeMirror-linenumber CodeMirror-gutter-elt"));
29926
+ var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
29927
+ display.lineGutter.style.width = "";
29928
+ display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
29929
+ display.lineNumWidth = display.lineNumInnerWidth + padding;
29930
+ display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
29931
+ display.lineGutter.style.width = display.lineNumWidth + "px";
29932
+ updateGutterSpace(cm.display);
29933
+ return true
29934
+ }
29935
+ return false
29936
+ }
29937
+
29938
+ function getGutters(gutters, lineNumbers) {
29939
+ var result = [], sawLineNumbers = false;
29940
+ for (var i = 0; i < gutters.length; i++) {
29941
+ var name = gutters[i], style = null;
29942
+ if (typeof name != "string") { style = name.style; name = name.className; }
29943
+ if (name == "CodeMirror-linenumbers") {
29944
+ if (!lineNumbers) { continue }
29945
+ else { sawLineNumbers = true; }
29946
+ }
29947
+ result.push({className: name, style: style});
29948
+ }
29949
+ if (lineNumbers && !sawLineNumbers) { result.push({className: "CodeMirror-linenumbers", style: null}); }
29950
+ return result
29951
+ }
29952
+
29953
+ // Rebuild the gutter elements, ensure the margin to the left of the
29954
+ // code matches their width.
29955
+ function renderGutters(display) {
29956
+ var gutters = display.gutters, specs = display.gutterSpecs;
29957
+ removeChildren(gutters);
29958
+ display.lineGutter = null;
29959
+ for (var i = 0; i < specs.length; ++i) {
29960
+ var ref = specs[i];
29961
+ var className = ref.className;
29962
+ var style = ref.style;
29963
+ var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + className));
29964
+ if (style) { gElt.style.cssText = style; }
29965
+ if (className == "CodeMirror-linenumbers") {
29966
+ display.lineGutter = gElt;
29967
+ gElt.style.width = (display.lineNumWidth || 1) + "px";
29968
+ }
29969
+ }
29970
+ gutters.style.display = specs.length ? "" : "none";
29971
+ updateGutterSpace(display);
29972
+ }
29973
+
29974
+ function updateGutters(cm) {
29975
+ renderGutters(cm.display);
29976
+ regChange(cm);
29977
+ alignHorizontally(cm);
29978
+ }
29979
+
29980
+ // The display handles the DOM integration, both for input reading
29981
+ // and content drawing. It holds references to DOM nodes and
29982
+ // display-related state.
29983
+
29984
+ function Display(place, doc, input, options) {
29985
+ var d = this;
29986
+ this.input = input;
29987
+
29988
+ // Covers bottom-right square when both scrollbars are present.
29989
+ d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
29990
+ d.scrollbarFiller.setAttribute("cm-not-content", "true");
29991
+ // Covers bottom of gutter when coverGutterNextToScrollbar is on
29992
+ // and h scrollbar is present.
29993
+ d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
29994
+ d.gutterFiller.setAttribute("cm-not-content", "true");
29995
+ // Will contain the actual code, positioned to cover the viewport.
29996
+ d.lineDiv = eltP("div", null, "CodeMirror-code");
29997
+ // Elements are added to these to represent selection and cursors.
29998
+ d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
29999
+ d.cursorDiv = elt("div", null, "CodeMirror-cursors");
30000
+ // A visibility: hidden element used to find the size of things.
30001
+ d.measure = elt("div", null, "CodeMirror-measure");
30002
+ // When lines outside of the viewport are measured, they are drawn in this.
30003
+ d.lineMeasure = elt("div", null, "CodeMirror-measure");
30004
+ // Wraps everything that needs to exist inside the vertically-padded coordinate system
30005
+ d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
30006
+ null, "position: relative; outline: none");
30007
+ var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
30008
+ // Moved around its parent to cover visible view.
30009
+ d.mover = elt("div", [lines], null, "position: relative");
30010
+ // Set to the height of the document, allowing scrolling.
30011
+ d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
30012
+ d.sizerWidth = null;
30013
+ // Behavior of elts with overflow: auto and padding is
30014
+ // inconsistent across browsers. This is used to ensure the
30015
+ // scrollable area is big enough.
30016
+ d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
30017
+ // Will contain the gutters, if any.
30018
+ d.gutters = elt("div", null, "CodeMirror-gutters");
30019
+ d.lineGutter = null;
30020
+ // Actual scrollable element.
30021
+ d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
30022
+ d.scroller.setAttribute("tabIndex", "-1");
30023
+ // The element in which the editor lives.
30024
+ d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
30025
+
30026
+ // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
30027
+ if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
30028
+ if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
30029
+
30030
+ if (place) {
30031
+ if (place.appendChild) { place.appendChild(d.wrapper); }
30032
+ else { place(d.wrapper); }
30033
+ }
30034
+
30035
+ // Current rendered range (may be bigger than the view window).
30036
+ d.viewFrom = d.viewTo = doc.first;
30037
+ d.reportedViewFrom = d.reportedViewTo = doc.first;
30038
+ // Information about the rendered lines.
30039
+ d.view = [];
30040
+ d.renderedView = null;
30041
+ // Holds info about a single rendered line when it was rendered
30042
+ // for measurement, while not in view.
30043
+ d.externalMeasured = null;
30044
+ // Empty space (in pixels) above the view
30045
+ d.viewOffset = 0;
30046
+ d.lastWrapHeight = d.lastWrapWidth = 0;
30047
+ d.updateLineNumbers = null;
30048
+
30049
+ d.nativeBarWidth = d.barHeight = d.barWidth = 0;
30050
+ d.scrollbarsClipped = false;
30051
+
30052
+ // Used to only resize the line number gutter when necessary (when
30053
+ // the amount of lines crosses a boundary that makes its width change)
30054
+ d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
30055
+ // Set to true when a non-horizontal-scrolling line widget is
30056
+ // added. As an optimization, line widget aligning is skipped when
30057
+ // this is false.
30058
+ d.alignWidgets = false;
30059
+
30060
+ d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
30061
+
30062
+ // Tracks the maximum line length so that the horizontal scrollbar
30063
+ // can be kept static when scrolling.
30064
+ d.maxLine = null;
30065
+ d.maxLineLength = 0;
30066
+ d.maxLineChanged = false;
30067
+
30068
+ // Used for measuring wheel scrolling granularity
30069
+ d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
30070
+
30071
+ // True when shift is held down.
30072
+ d.shift = false;
30073
+
30074
+ // Used to track whether anything happened since the context menu
30075
+ // was opened.
30076
+ d.selForContextMenu = null;
30077
+
30078
+ d.activeTouch = null;
30079
+
30080
+ d.gutterSpecs = getGutters(options.gutters, options.lineNumbers);
30081
+ renderGutters(d);
30082
+
30083
+ input.init(d);
30084
+ }
30085
+
30086
+ // Since the delta values reported on mouse wheel events are
30087
+ // unstandardized between browsers and even browser versions, and
30088
+ // generally horribly unpredictable, this code starts by measuring
30089
+ // the scroll effect that the first few mouse wheel events have,
30090
+ // and, from that, detects the way it can convert deltas to pixel
30091
+ // offsets afterwards.
30092
+ //
30093
+ // The reason we want to know the amount a wheel event will scroll
30094
+ // is that it gives us a chance to update the display before the
30095
+ // actual scrolling happens, reducing flickering.
30096
+
30097
+ var wheelSamples = 0, wheelPixelsPerUnit = null;
30098
+ // Fill in a browser-detected starting value on browsers where we
30099
+ // know one. These don't have to be accurate -- the result of them
30100
+ // being wrong would just be a slight flicker on the first wheel
30101
+ // scroll (if it is large enough).
30102
+ if (ie) { wheelPixelsPerUnit = -.53; }
30103
+ else if (gecko) { wheelPixelsPerUnit = 15; }
30104
+ else if (chrome) { wheelPixelsPerUnit = -.7; }
30105
+ else if (safari) { wheelPixelsPerUnit = -1/3; }
30106
+
30107
+ function wheelEventDelta(e) {
30108
+ var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
30109
+ if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
30110
+ if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
30111
+ else if (dy == null) { dy = e.wheelDelta; }
30112
+ return {x: dx, y: dy}
30113
+ }
30114
+ function wheelEventPixels(e) {
30115
+ var delta = wheelEventDelta(e);
30116
+ delta.x *= wheelPixelsPerUnit;
30117
+ delta.y *= wheelPixelsPerUnit;
30118
+ return delta
30119
+ }
30120
+
30121
+ function onScrollWheel(cm, e) {
30122
+ var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
30123
+
30124
+ var display = cm.display, scroll = display.scroller;
30125
+ // Quit if there's nothing to scroll here
30126
+ var canScrollX = scroll.scrollWidth > scroll.clientWidth;
30127
+ var canScrollY = scroll.scrollHeight > scroll.clientHeight;
30128
+ if (!(dx && canScrollX || dy && canScrollY)) { return }
30129
+
30130
+ // Webkit browsers on OS X abort momentum scrolls when the target
30131
+ // of the scroll event is removed from the scrollable element.
30132
+ // This hack (see related code in patchDisplay) makes sure the
30133
+ // element is kept around.
30134
+ if (dy && mac && webkit) {
30135
+ outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
30136
+ for (var i = 0; i < view.length; i++) {
30137
+ if (view[i].node == cur) {
30138
+ cm.display.currentWheelTarget = cur;
30139
+ break outer
30140
+ }
30141
+ }
30142
+ }
30143
+ }
30144
+
30145
+ // On some browsers, horizontal scrolling will cause redraws to
30146
+ // happen before the gutter has been realigned, causing it to
30147
+ // wriggle around in a most unseemly way. When we have an
30148
+ // estimated pixels/delta value, we just handle horizontal
30149
+ // scrolling entirely here. It'll be slightly off from native, but
30150
+ // better than glitching out.
30151
+ if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
30152
+ if (dy && canScrollY)
30153
+ { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }
30154
+ setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));
30155
+ // Only prevent default scrolling if vertical scrolling is
30156
+ // actually possible. Otherwise, it causes vertical scroll
30157
+ // jitter on OSX trackpads when deltaX is small and deltaY
30158
+ // is large (issue #3579)
30159
+ if (!dy || (dy && canScrollY))
30160
+ { e_preventDefault(e); }
30161
+ display.wheelStartX = null; // Abort measurement, if in progress
30162
+ return
30163
+ }
30164
+
30165
+ // 'Project' the visible viewport to cover the area that is being
30166
+ // scrolled into view (if we know enough to estimate it).
30167
+ if (dy && wheelPixelsPerUnit != null) {
30168
+ var pixels = dy * wheelPixelsPerUnit;
30169
+ var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
30170
+ if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
30171
+ else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
30172
+ updateDisplaySimple(cm, {top: top, bottom: bot});
30173
+ }
30174
+
30175
+ if (wheelSamples < 20) {
30176
+ if (display.wheelStartX == null) {
30177
+ display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
30178
+ display.wheelDX = dx; display.wheelDY = dy;
30179
+ setTimeout(function () {
30180
+ if (display.wheelStartX == null) { return }
30181
+ var movedX = scroll.scrollLeft - display.wheelStartX;
30182
+ var movedY = scroll.scrollTop - display.wheelStartY;
30183
+ var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
30184
+ (movedX && display.wheelDX && movedX / display.wheelDX);
30185
+ display.wheelStartX = display.wheelStartY = null;
30186
+ if (!sample) { return }
30187
+ wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
30188
+ ++wheelSamples;
30189
+ }, 200);
30190
+ } else {
30191
+ display.wheelDX += dx; display.wheelDY += dy;
30192
+ }
30193
+ }
30194
+ }
30195
+
30196
+ // Selection objects are immutable. A new one is created every time
30197
+ // the selection changes. A selection is one or more non-overlapping
30198
+ // (and non-touching) ranges, sorted, and an integer that indicates
30199
+ // which one is the primary selection (the one that's scrolled into
30200
+ // view, that getCursor returns, etc).
30201
+ var Selection = function(ranges, primIndex) {
30202
+ this.ranges = ranges;
30203
+ this.primIndex = primIndex;
30204
+ };
30205
+
30206
+ Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
30207
+
30208
+ Selection.prototype.equals = function (other) {
30209
+ if (other == this) { return true }
30210
+ if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
30211
+ for (var i = 0; i < this.ranges.length; i++) {
30212
+ var here = this.ranges[i], there = other.ranges[i];
30213
+ if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
30214
+ }
30215
+ return true
30216
+ };
30217
+
30218
+ Selection.prototype.deepCopy = function () {
30219
+ var out = [];
30220
+ for (var i = 0; i < this.ranges.length; i++)
30221
+ { out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); }
30222
+ return new Selection(out, this.primIndex)
30223
+ };
30224
+
30225
+ Selection.prototype.somethingSelected = function () {
30226
+ for (var i = 0; i < this.ranges.length; i++)
30227
+ { if (!this.ranges[i].empty()) { return true } }
30228
+ return false
30229
+ };
30230
+
30231
+ Selection.prototype.contains = function (pos, end) {
30232
+ if (!end) { end = pos; }
30233
+ for (var i = 0; i < this.ranges.length; i++) {
30234
+ var range = this.ranges[i];
30235
+ if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
30236
+ { return i }
30237
+ }
30238
+ return -1
30239
+ };
30240
+
30241
+ var Range = function(anchor, head) {
30242
+ this.anchor = anchor; this.head = head;
30243
+ };
30244
+
30245
+ Range.prototype.from = function () { return minPos(this.anchor, this.head) };
30246
+ Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
30247
+ Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
30248
+
30249
+ // Take an unsorted, potentially overlapping set of ranges, and
30250
+ // build a selection out of it. 'Consumes' ranges array (modifying
30251
+ // it).
30252
+ function normalizeSelection(cm, ranges, primIndex) {
30253
+ var mayTouch = cm && cm.options.selectionsMayTouch;
30254
+ var prim = ranges[primIndex];
30255
+ ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
30256
+ primIndex = indexOf(ranges, prim);
30257
+ for (var i = 1; i < ranges.length; i++) {
30258
+ var cur = ranges[i], prev = ranges[i - 1];
30259
+ var diff = cmp(prev.to(), cur.from());
30260
+ if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {
30261
+ var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
30262
+ var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
30263
+ if (i <= primIndex) { --primIndex; }
30264
+ ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
30265
+ }
30266
+ }
30267
+ return new Selection(ranges, primIndex)
30268
+ }
30269
+
30270
+ function simpleSelection(anchor, head) {
30271
+ return new Selection([new Range(anchor, head || anchor)], 0)
30272
+ }
30273
+
30274
+ // Compute the position of the end of a change (its 'to' property
30275
+ // refers to the pre-change end).
30276
+ function changeEnd(change) {
30277
+ if (!change.text) { return change.to }
30278
+ return Pos(change.from.line + change.text.length - 1,
30279
+ lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
30280
+ }
30281
+
30282
+ // Adjust a position to refer to the post-change position of the
30283
+ // same text, or the end of the change if the change covers it.
30284
+ function adjustForChange(pos, change) {
30285
+ if (cmp(pos, change.from) < 0) { return pos }
30286
+ if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
30287
+
30288
+ var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
30289
+ if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
30290
+ return Pos(line, ch)
30291
+ }
30292
+
30293
+ function computeSelAfterChange(doc, change) {
30294
+ var out = [];
30295
+ for (var i = 0; i < doc.sel.ranges.length; i++) {
30296
+ var range = doc.sel.ranges[i];
30297
+ out.push(new Range(adjustForChange(range.anchor, change),
30298
+ adjustForChange(range.head, change)));
30299
+ }
30300
+ return normalizeSelection(doc.cm, out, doc.sel.primIndex)
30301
+ }
30302
+
30303
+ function offsetPos(pos, old, nw) {
30304
+ if (pos.line == old.line)
30305
+ { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
30306
+ else
30307
+ { return Pos(nw.line + (pos.line - old.line), pos.ch) }
30308
+ }
30309
+
30310
+ // Used by replaceSelections to allow moving the selection to the
30311
+ // start or around the replaced test. Hint may be "start" or "around".
30312
+ function computeReplacedSel(doc, changes, hint) {
30313
+ var out = [];
30314
+ var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
30315
+ for (var i = 0; i < changes.length; i++) {
30316
+ var change = changes[i];
30317
+ var from = offsetPos(change.from, oldPrev, newPrev);
30318
+ var to = offsetPos(changeEnd(change), oldPrev, newPrev);
30319
+ oldPrev = change.to;
30320
+ newPrev = to;
30321
+ if (hint == "around") {
30322
+ var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
30323
+ out[i] = new Range(inv ? to : from, inv ? from : to);
30324
+ } else {
30325
+ out[i] = new Range(from, from);
30326
+ }
30327
+ }
30328
+ return new Selection(out, doc.sel.primIndex)
30329
+ }
30330
+
30331
+ // Used to get the editor into a consistent state again when options change.
30332
+
30333
+ function loadMode(cm) {
30334
+ cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
30335
+ resetModeState(cm);
30336
+ }
30337
+
30338
+ function resetModeState(cm) {
30339
+ cm.doc.iter(function (line) {
30340
+ if (line.stateAfter) { line.stateAfter = null; }
30341
+ if (line.styles) { line.styles = null; }
30342
+ });
30343
+ cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;
30344
+ startWorker(cm, 100);
30345
+ cm.state.modeGen++;
30346
+ if (cm.curOp) { regChange(cm); }
30347
+ }
30348
+
30349
+ // DOCUMENT DATA STRUCTURE
30350
+
30351
+ // By default, updates that start and end at the beginning of a line
30352
+ // are treated specially, in order to make the association of line
30353
+ // widgets and marker elements with the text behave more intuitive.
30354
+ function isWholeLineUpdate(doc, change) {
30355
+ return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
30356
+ (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
30357
+ }
30358
+
30359
+ // Perform a change on the document data structure.
30360
+ function updateDoc(doc, change, markedSpans, estimateHeight) {
30361
+ function spansFor(n) {return markedSpans ? markedSpans[n] : null}
30362
+ function update(line, text, spans) {
30363
+ updateLine(line, text, spans, estimateHeight);
30364
+ signalLater(line, "change", line, change);
30365
+ }
30366
+ function linesFor(start, end) {
30367
+ var result = [];
30368
+ for (var i = start; i < end; ++i)
30369
+ { result.push(new Line(text[i], spansFor(i), estimateHeight)); }
30370
+ return result
30371
+ }
30372
+
30373
+ var from = change.from, to = change.to, text = change.text;
30374
+ var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
30375
+ var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
30376
+
30377
+ // Adjust the line structure
30378
+ if (change.full) {
30379
+ doc.insert(0, linesFor(0, text.length));
30380
+ doc.remove(text.length, doc.size - text.length);
30381
+ } else if (isWholeLineUpdate(doc, change)) {
30382
+ // This is a whole-line replace. Treated specially to make
30383
+ // sure line objects move the way they are supposed to.
30384
+ var added = linesFor(0, text.length - 1);
30385
+ update(lastLine, lastLine.text, lastSpans);
30386
+ if (nlines) { doc.remove(from.line, nlines); }
30387
+ if (added.length) { doc.insert(from.line, added); }
30388
+ } else if (firstLine == lastLine) {
30389
+ if (text.length == 1) {
30390
+ update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
30391
+ } else {
30392
+ var added$1 = linesFor(1, text.length - 1);
30393
+ added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));
30394
+ update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
30395
+ doc.insert(from.line + 1, added$1);
30396
+ }
30397
+ } else if (text.length == 1) {
30398
+ update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
30399
+ doc.remove(from.line + 1, nlines);
30400
+ } else {
30401
+ update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
30402
+ update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
30403
+ var added$2 = linesFor(1, text.length - 1);
30404
+ if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
30405
+ doc.insert(from.line + 1, added$2);
30406
+ }
30407
+
30408
+ signalLater(doc, "change", doc, change);
30409
+ }
30410
+
30411
+ // Call f for all linked documents.
30412
+ function linkedDocs(doc, f, sharedHistOnly) {
30413
+ function propagate(doc, skip, sharedHist) {
30414
+ if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
30415
+ var rel = doc.linked[i];
30416
+ if (rel.doc == skip) { continue }
30417
+ var shared = sharedHist && rel.sharedHist;
30418
+ if (sharedHistOnly && !shared) { continue }
30419
+ f(rel.doc, shared);
30420
+ propagate(rel.doc, doc, shared);
30421
+ } }
30422
+ }
30423
+ propagate(doc, null, true);
30424
+ }
30425
+
30426
+ // Attach a document to an editor.
30427
+ function attachDoc(cm, doc) {
30428
+ if (doc.cm) { throw new Error("This document is already in use.") }
30429
+ cm.doc = doc;
30430
+ doc.cm = cm;
30431
+ estimateLineHeights(cm);
30432
+ loadMode(cm);
30433
+ setDirectionClass(cm);
30434
+ if (!cm.options.lineWrapping) { findMaxLine(cm); }
30435
+ cm.options.mode = doc.modeOption;
30436
+ regChange(cm);
30437
+ }
30438
+
30439
+ function setDirectionClass(cm) {
30440
+ (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
30441
+ }
30442
+
30443
+ function directionChanged(cm) {
30444
+ runInOp(cm, function () {
30445
+ setDirectionClass(cm);
30446
+ regChange(cm);
30447
+ });
30448
+ }
30449
+
30450
+ function History(startGen) {
30451
+ // Arrays of change events and selections. Doing something adds an
30452
+ // event to done and clears undo. Undoing moves events from done
30453
+ // to undone, redoing moves them in the other direction.
30454
+ this.done = []; this.undone = [];
30455
+ this.undoDepth = Infinity;
30456
+ // Used to track when changes can be merged into a single undo
30457
+ // event
30458
+ this.lastModTime = this.lastSelTime = 0;
30459
+ this.lastOp = this.lastSelOp = null;
30460
+ this.lastOrigin = this.lastSelOrigin = null;
30461
+ // Used by the isClean() method
30462
+ this.generation = this.maxGeneration = startGen || 1;
30463
+ }
30464
+
30465
+ // Create a history change event from an updateDoc-style change
30466
+ // object.
30467
+ function historyChangeFromChange(doc, change) {
30468
+ var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
30469
+ attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
30470
+ linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
30471
+ return histChange
30472
+ }
30473
+
30474
+ // Pop all selection events off the end of a history array. Stop at
30475
+ // a change event.
30476
+ function clearSelectionEvents(array) {
30477
+ while (array.length) {
30478
+ var last = lst(array);
30479
+ if (last.ranges) { array.pop(); }
30480
+ else { break }
30481
+ }
30482
+ }
30483
+
30484
+ // Find the top change event in the history. Pop off selection
30485
+ // events that are in the way.
30486
+ function lastChangeEvent(hist, force) {
30487
+ if (force) {
30488
+ clearSelectionEvents(hist.done);
30489
+ return lst(hist.done)
30490
+ } else if (hist.done.length && !lst(hist.done).ranges) {
30491
+ return lst(hist.done)
30492
+ } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
30493
+ hist.done.pop();
30494
+ return lst(hist.done)
30495
+ }
30496
+ }
30497
+
30498
+ // Register a change in the history. Merges changes that are within
30499
+ // a single operation, or are close together with an origin that
30500
+ // allows merging (starting with "+") into a single event.
30501
+ function addChangeToHistory(doc, change, selAfter, opId) {
30502
+ var hist = doc.history;
30503
+ hist.undone.length = 0;
30504
+ var time = +new Date, cur;
30505
+ var last;
30506
+
30507
+ if ((hist.lastOp == opId ||
30508
+ hist.lastOrigin == change.origin && change.origin &&
30509
+ ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
30510
+ change.origin.charAt(0) == "*")) &&
30511
+ (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
30512
+ // Merge this change into the last event
30513
+ last = lst(cur.changes);
30514
+ if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
30515
+ // Optimized case for simple insertion -- don't want to add
30516
+ // new changesets for every character typed
30517
+ last.to = changeEnd(change);
30518
+ } else {
30519
+ // Add new sub-event
30520
+ cur.changes.push(historyChangeFromChange(doc, change));
30521
+ }
30522
+ } else {
30523
+ // Can not be merged, start a new event.
30524
+ var before = lst(hist.done);
30525
+ if (!before || !before.ranges)
30526
+ { pushSelectionToHistory(doc.sel, hist.done); }
30527
+ cur = {changes: [historyChangeFromChange(doc, change)],
30528
+ generation: hist.generation};
30529
+ hist.done.push(cur);
30530
+ while (hist.done.length > hist.undoDepth) {
30531
+ hist.done.shift();
30532
+ if (!hist.done[0].ranges) { hist.done.shift(); }
30533
+ }
30534
+ }
30535
+ hist.done.push(selAfter);
30536
+ hist.generation = ++hist.maxGeneration;
30537
+ hist.lastModTime = hist.lastSelTime = time;
30538
+ hist.lastOp = hist.lastSelOp = opId;
30539
+ hist.lastOrigin = hist.lastSelOrigin = change.origin;
30540
+
30541
+ if (!last) { signal(doc, "historyAdded"); }
30542
+ }
30543
+
30544
+ function selectionEventCanBeMerged(doc, origin, prev, sel) {
30545
+ var ch = origin.charAt(0);
30546
+ return ch == "*" ||
30547
+ ch == "+" &&
30548
+ prev.ranges.length == sel.ranges.length &&
30549
+ prev.somethingSelected() == sel.somethingSelected() &&
30550
+ new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
30551
+ }
30552
+
30553
+ // Called whenever the selection changes, sets the new selection as
30554
+ // the pending selection in the history, and pushes the old pending
30555
+ // selection into the 'done' array when it was significantly
30556
+ // different (in number of selected ranges, emptiness, or time).
30557
+ function addSelectionToHistory(doc, sel, opId, options) {
30558
+ var hist = doc.history, origin = options && options.origin;
30559
+
30560
+ // A new event is started when the previous origin does not match
30561
+ // the current, or the origins don't allow matching. Origins
30562
+ // starting with * are always merged, those starting with + are
30563
+ // merged when similar and close together in time.
30564
+ if (opId == hist.lastSelOp ||
30565
+ (origin && hist.lastSelOrigin == origin &&
30566
+ (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
30567
+ selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
30568
+ { hist.done[hist.done.length - 1] = sel; }
30569
+ else
30570
+ { pushSelectionToHistory(sel, hist.done); }
30571
+
30572
+ hist.lastSelTime = +new Date;
30573
+ hist.lastSelOrigin = origin;
30574
+ hist.lastSelOp = opId;
30575
+ if (options && options.clearRedo !== false)
30576
+ { clearSelectionEvents(hist.undone); }
30577
+ }
30578
+
30579
+ function pushSelectionToHistory(sel, dest) {
30580
+ var top = lst(dest);
30581
+ if (!(top && top.ranges && top.equals(sel)))
30582
+ { dest.push(sel); }
30583
+ }
30584
+
30585
+ // Used to store marked span information in the history.
30586
+ function attachLocalSpans(doc, change, from, to) {
30587
+ var existing = change["spans_" + doc.id], n = 0;
30588
+ doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
30589
+ if (line.markedSpans)
30590
+ { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
30591
+ ++n;
30592
+ });
30593
+ }
30594
+
30595
+ // When un/re-doing restores text containing marked spans, those
30596
+ // that have been explicitly cleared should not be restored.
30597
+ function removeClearedSpans(spans) {
30598
+ if (!spans) { return null }
30599
+ var out;
30600
+ for (var i = 0; i < spans.length; ++i) {
30601
+ if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
30602
+ else if (out) { out.push(spans[i]); }
30603
+ }
30604
+ return !out ? spans : out.length ? out : null
30605
+ }
30606
+
30607
+ // Retrieve and filter the old marked spans stored in a change event.
30608
+ function getOldSpans(doc, change) {
30609
+ var found = change["spans_" + doc.id];
30610
+ if (!found) { return null }
30611
+ var nw = [];
30612
+ for (var i = 0; i < change.text.length; ++i)
30613
+ { nw.push(removeClearedSpans(found[i])); }
30614
+ return nw
30615
+ }
30616
+
30617
+ // Used for un/re-doing changes from the history. Combines the
30618
+ // result of computing the existing spans with the set of spans that
30619
+ // existed in the history (so that deleting around a span and then
30620
+ // undoing brings back the span).
30621
+ function mergeOldSpans(doc, change) {
30622
+ var old = getOldSpans(doc, change);
30623
+ var stretched = stretchSpansOverChange(doc, change);
30624
+ if (!old) { return stretched }
30625
+ if (!stretched) { return old }
30626
+
30627
+ for (var i = 0; i < old.length; ++i) {
30628
+ var oldCur = old[i], stretchCur = stretched[i];
30629
+ if (oldCur && stretchCur) {
30630
+ spans: for (var j = 0; j < stretchCur.length; ++j) {
30631
+ var span = stretchCur[j];
30632
+ for (var k = 0; k < oldCur.length; ++k)
30633
+ { if (oldCur[k].marker == span.marker) { continue spans } }
30634
+ oldCur.push(span);
30635
+ }
30636
+ } else if (stretchCur) {
30637
+ old[i] = stretchCur;
30638
+ }
30639
+ }
30640
+ return old
30641
+ }
30642
+
30643
+ // Used both to provide a JSON-safe object in .getHistory, and, when
30644
+ // detaching a document, to split the history in two
30645
+ function copyHistoryArray(events, newGroup, instantiateSel) {
30646
+ var copy = [];
30647
+ for (var i = 0; i < events.length; ++i) {
30648
+ var event = events[i];
30649
+ if (event.ranges) {
30650
+ copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
30651
+ continue
30652
+ }
30653
+ var changes = event.changes, newChanges = [];
30654
+ copy.push({changes: newChanges});
30655
+ for (var j = 0; j < changes.length; ++j) {
30656
+ var change = changes[j], m = (void 0);
30657
+ newChanges.push({from: change.from, to: change.to, text: change.text});
30658
+ if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
30659
+ if (indexOf(newGroup, Number(m[1])) > -1) {
30660
+ lst(newChanges)[prop] = change[prop];
30661
+ delete change[prop];
30662
+ }
30663
+ } } }
30664
+ }
30665
+ }
30666
+ return copy
30667
+ }
30668
+
30669
+ // The 'scroll' parameter given to many of these indicated whether
30670
+ // the new cursor position should be scrolled into view after
30671
+ // modifying the selection.
30672
+
30673
+ // If shift is held or the extend flag is set, extends a range to
30674
+ // include a given position (and optionally a second position).
30675
+ // Otherwise, simply returns the range between the given positions.
30676
+ // Used for cursor motion and such.
30677
+ function extendRange(range, head, other, extend) {
30678
+ if (extend) {
30679
+ var anchor = range.anchor;
30680
+ if (other) {
30681
+ var posBefore = cmp(head, anchor) < 0;
30682
+ if (posBefore != (cmp(other, anchor) < 0)) {
30683
+ anchor = head;
30684
+ head = other;
30685
+ } else if (posBefore != (cmp(head, other) < 0)) {
30686
+ head = other;
30687
+ }
30688
+ }
30689
+ return new Range(anchor, head)
30690
+ } else {
30691
+ return new Range(other || head, head)
30692
+ }
30693
+ }
30694
+
30695
+ // Extend the primary selection range, discard the rest.
30696
+ function extendSelection(doc, head, other, options, extend) {
30697
+ if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }
30698
+ setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);
30699
+ }
30700
+
30701
+ // Extend all selections (pos is an array of selections with length
30702
+ // equal the number of selections)
30703
+ function extendSelections(doc, heads, options) {
30704
+ var out = [];
30705
+ var extend = doc.cm && (doc.cm.display.shift || doc.extend);
30706
+ for (var i = 0; i < doc.sel.ranges.length; i++)
30707
+ { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }
30708
+ var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);
30709
+ setSelection(doc, newSel, options);
30710
+ }
30711
+
30712
+ // Updates a single range in the selection.
30713
+ function replaceOneSelection(doc, i, range, options) {
30714
+ var ranges = doc.sel.ranges.slice(0);
30715
+ ranges[i] = range;
30716
+ setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);
30717
+ }
30718
+
30719
+ // Reset the selection to a single range.
30720
+ function setSimpleSelection(doc, anchor, head, options) {
30721
+ setSelection(doc, simpleSelection(anchor, head), options);
30722
+ }
30723
+
30724
+ // Give beforeSelectionChange handlers a change to influence a
30725
+ // selection update.
30726
+ function filterSelectionChange(doc, sel, options) {
30727
+ var obj = {
30728
+ ranges: sel.ranges,
30729
+ update: function(ranges) {
30730
+ this.ranges = [];
30731
+ for (var i = 0; i < ranges.length; i++)
30732
+ { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
30733
+ clipPos(doc, ranges[i].head)); }
30734
+ },
30735
+ origin: options && options.origin
30736
+ };
30737
+ signal(doc, "beforeSelectionChange", doc, obj);
30738
+ if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
30739
+ if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }
30740
+ else { return sel }
30741
+ }
30742
+
30743
+ function setSelectionReplaceHistory(doc, sel, options) {
30744
+ var done = doc.history.done, last = lst(done);
30745
+ if (last && last.ranges) {
30746
+ done[done.length - 1] = sel;
30747
+ setSelectionNoUndo(doc, sel, options);
30748
+ } else {
30749
+ setSelection(doc, sel, options);
30750
+ }
30751
+ }
30752
+
30753
+ // Set a new selection.
30754
+ function setSelection(doc, sel, options) {
30755
+ setSelectionNoUndo(doc, sel, options);
30756
+ addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
30757
+ }
30758
+
30759
+ function setSelectionNoUndo(doc, sel, options) {
30760
+ if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
30761
+ { sel = filterSelectionChange(doc, sel, options); }
30762
+
30763
+ var bias = options && options.bias ||
30764
+ (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
30765
+ setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
30766
+
30767
+ if (!(options && options.scroll === false) && doc.cm && doc.cm.getOption("readOnly") != "nocursor")
30768
+ { ensureCursorVisible(doc.cm); }
30769
+ }
30770
+
30771
+ function setSelectionInner(doc, sel) {
30772
+ if (sel.equals(doc.sel)) { return }
30773
+
30774
+ doc.sel = sel;
30775
+
30776
+ if (doc.cm) {
30777
+ doc.cm.curOp.updateInput = 1;
30778
+ doc.cm.curOp.selectionChanged = true;
30779
+ signalCursorActivity(doc.cm);
30780
+ }
30781
+ signalLater(doc, "cursorActivity", doc);
30782
+ }
30783
+
30784
+ // Verify that the selection does not partially select any atomic
30785
+ // marked ranges.
30786
+ function reCheckSelection(doc) {
30787
+ setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));
30788
+ }
30789
+
30790
+ // Return a selection that does not partially select any atomic
30791
+ // ranges.
30792
+ function skipAtomicInSelection(doc, sel, bias, mayClear) {
30793
+ var out;
30794
+ for (var i = 0; i < sel.ranges.length; i++) {
30795
+ var range = sel.ranges[i];
30796
+ var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
30797
+ var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
30798
+ var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
30799
+ if (out || newAnchor != range.anchor || newHead != range.head) {
30800
+ if (!out) { out = sel.ranges.slice(0, i); }
30801
+ out[i] = new Range(newAnchor, newHead);
30802
+ }
30803
+ }
30804
+ return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
30805
+ }
30806
+
30807
+ function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
30808
+ var line = getLine(doc, pos.line);
30809
+ if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
30810
+ var sp = line.markedSpans[i], m = sp.marker;
30811
+
30812
+ // Determine if we should prevent the cursor being placed to the left/right of an atomic marker
30813
+ // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it
30814
+ // is with selectLeft/Right
30815
+ var preventCursorLeft = ("selectLeft" in m) ? !m.selectLeft : m.inclusiveLeft;
30816
+ var preventCursorRight = ("selectRight" in m) ? !m.selectRight : m.inclusiveRight;
30817
+
30818
+ if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
30819
+ (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
30820
+ if (mayClear) {
30821
+ signal(m, "beforeCursorEnter");
30822
+ if (m.explicitlyCleared) {
30823
+ if (!line.markedSpans) { break }
30824
+ else {--i; continue}
30825
+ }
30826
+ }
30827
+ if (!m.atomic) { continue }
30828
+
30829
+ if (oldPos) {
30830
+ var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
30831
+ if (dir < 0 ? preventCursorRight : preventCursorLeft)
30832
+ { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
30833
+ if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
30834
+ { return skipAtomicInner(doc, near, pos, dir, mayClear) }
30835
+ }
30836
+
30837
+ var far = m.find(dir < 0 ? -1 : 1);
30838
+ if (dir < 0 ? preventCursorLeft : preventCursorRight)
30839
+ { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
30840
+ return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
30841
+ }
30842
+ } }
30843
+ return pos
30844
+ }
30845
+
30846
+ // Ensure a given position is not inside an atomic range.
30847
+ function skipAtomic(doc, pos, oldPos, bias, mayClear) {
30848
+ var dir = bias || 1;
30849
+ var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
30850
+ (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
30851
+ skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
30852
+ (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
30853
+ if (!found) {
30854
+ doc.cantEdit = true;
30855
+ return Pos(doc.first, 0)
30856
+ }
30857
+ return found
30858
+ }
30859
+
30860
+ function movePos(doc, pos, dir, line) {
30861
+ if (dir < 0 && pos.ch == 0) {
30862
+ if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
30863
+ else { return null }
30864
+ } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
30865
+ if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
30866
+ else { return null }
30867
+ } else {
30868
+ return new Pos(pos.line, pos.ch + dir)
30869
+ }
30870
+ }
30871
+
30872
+ function selectAll(cm) {
30873
+ cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
30874
+ }
30875
+
30876
+ // UPDATING
30877
+
30878
+ // Allow "beforeChange" event handlers to influence a change
30879
+ function filterChange(doc, change, update) {
30880
+ var obj = {
30881
+ canceled: false,
30882
+ from: change.from,
30883
+ to: change.to,
30884
+ text: change.text,
30885
+ origin: change.origin,
30886
+ cancel: function () { return obj.canceled = true; }
30887
+ };
30888
+ if (update) { obj.update = function (from, to, text, origin) {
30889
+ if (from) { obj.from = clipPos(doc, from); }
30890
+ if (to) { obj.to = clipPos(doc, to); }
30891
+ if (text) { obj.text = text; }
30892
+ if (origin !== undefined) { obj.origin = origin; }
30893
+ }; }
30894
+ signal(doc, "beforeChange", doc, obj);
30895
+ if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
30896
+
30897
+ if (obj.canceled) {
30898
+ if (doc.cm) { doc.cm.curOp.updateInput = 2; }
30899
+ return null
30900
+ }
30901
+ return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
30902
+ }
30903
+
30904
+ // Apply a change to a document, and add it to the document's
30905
+ // history, and propagating it to all linked documents.
30906
+ function makeChange(doc, change, ignoreReadOnly) {
30907
+ if (doc.cm) {
30908
+ if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
30909
+ if (doc.cm.state.suppressEdits) { return }
30910
+ }
30911
+
30912
+ if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
30913
+ change = filterChange(doc, change, true);
30914
+ if (!change) { return }
30915
+ }
30916
+
30917
+ // Possibly split or suppress the update based on the presence
30918
+ // of read-only spans in its range.
30919
+ var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
30920
+ if (split) {
30921
+ for (var i = split.length - 1; i >= 0; --i)
30922
+ { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}); }
30923
+ } else {
30924
+ makeChangeInner(doc, change);
30925
+ }
30926
+ }
30927
+
30928
+ function makeChangeInner(doc, change) {
30929
+ if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
30930
+ var selAfter = computeSelAfterChange(doc, change);
30931
+ addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
30932
+
30933
+ makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
30934
+ var rebased = [];
30935
+
30936
+ linkedDocs(doc, function (doc, sharedHist) {
30937
+ if (!sharedHist && indexOf(rebased, doc.history) == -1) {
30938
+ rebaseHist(doc.history, change);
30939
+ rebased.push(doc.history);
30940
+ }
30941
+ makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
30942
+ });
30943
+ }
30944
+
30945
+ // Revert a change stored in a document's history.
30946
+ function makeChangeFromHistory(doc, type, allowSelectionOnly) {
30947
+ var suppress = doc.cm && doc.cm.state.suppressEdits;
30948
+ if (suppress && !allowSelectionOnly) { return }
30949
+
30950
+ var hist = doc.history, event, selAfter = doc.sel;
30951
+ var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
30952
+
30953
+ // Verify that there is a useable event (so that ctrl-z won't
30954
+ // needlessly clear selection events)
30955
+ var i = 0;
30956
+ for (; i < source.length; i++) {
30957
+ event = source[i];
30958
+ if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
30959
+ { break }
30960
+ }
30961
+ if (i == source.length) { return }
30962
+ hist.lastOrigin = hist.lastSelOrigin = null;
30963
+
30964
+ for (;;) {
30965
+ event = source.pop();
30966
+ if (event.ranges) {
30967
+ pushSelectionToHistory(event, dest);
30968
+ if (allowSelectionOnly && !event.equals(doc.sel)) {
30969
+ setSelection(doc, event, {clearRedo: false});
30970
+ return
30971
+ }
30972
+ selAfter = event;
30973
+ } else if (suppress) {
30974
+ source.push(event);
30975
+ return
30976
+ } else { break }
30977
+ }
30978
+
30979
+ // Build up a reverse change object to add to the opposite history
30980
+ // stack (redo when undoing, and vice versa).
30981
+ var antiChanges = [];
30982
+ pushSelectionToHistory(selAfter, dest);
30983
+ dest.push({changes: antiChanges, generation: hist.generation});
30984
+ hist.generation = event.generation || ++hist.maxGeneration;
30985
+
30986
+ var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
30987
+
30988
+ var loop = function ( i ) {
30989
+ var change = event.changes[i];
30990
+ change.origin = type;
30991
+ if (filter && !filterChange(doc, change, false)) {
30992
+ source.length = 0;
30993
+ return {}
30994
+ }
30995
+
30996
+ antiChanges.push(historyChangeFromChange(doc, change));
30997
+
30998
+ var after = i ? computeSelAfterChange(doc, change) : lst(source);
30999
+ makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
31000
+ if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
31001
+ var rebased = [];
31002
+
31003
+ // Propagate to the linked documents
31004
+ linkedDocs(doc, function (doc, sharedHist) {
31005
+ if (!sharedHist && indexOf(rebased, doc.history) == -1) {
31006
+ rebaseHist(doc.history, change);
31007
+ rebased.push(doc.history);
31008
+ }
31009
+ makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
31010
+ });
31011
+ };
31012
+
31013
+ for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
31014
+ var returned = loop( i$1 );
31015
+
31016
+ if ( returned ) return returned.v;
31017
+ }
31018
+ }
31019
+
31020
+ // Sub-views need their line numbers shifted when text is added
31021
+ // above or below them in the parent document.
31022
+ function shiftDoc(doc, distance) {
31023
+ if (distance == 0) { return }
31024
+ doc.first += distance;
31025
+ doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
31026
+ Pos(range.anchor.line + distance, range.anchor.ch),
31027
+ Pos(range.head.line + distance, range.head.ch)
31028
+ ); }), doc.sel.primIndex);
31029
+ if (doc.cm) {
31030
+ regChange(doc.cm, doc.first, doc.first - distance, distance);
31031
+ for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
31032
+ { regLineChange(doc.cm, l, "gutter"); }
31033
+ }
31034
+ }
31035
+
31036
+ // More lower-level change function, handling only a single document
31037
+ // (not linked ones).
31038
+ function makeChangeSingleDoc(doc, change, selAfter, spans) {
31039
+ if (doc.cm && !doc.cm.curOp)
31040
+ { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
31041
+
31042
+ if (change.to.line < doc.first) {
31043
+ shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
31044
+ return
31045
+ }
31046
+ if (change.from.line > doc.lastLine()) { return }
31047
+
31048
+ // Clip the change to the size of this doc
31049
+ if (change.from.line < doc.first) {
31050
+ var shift = change.text.length - 1 - (doc.first - change.from.line);
31051
+ shiftDoc(doc, shift);
31052
+ change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
31053
+ text: [lst(change.text)], origin: change.origin};
31054
+ }
31055
+ var last = doc.lastLine();
31056
+ if (change.to.line > last) {
31057
+ change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
31058
+ text: [change.text[0]], origin: change.origin};
31059
+ }
31060
+
31061
+ change.removed = getBetween(doc, change.from, change.to);
31062
+
31063
+ if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
31064
+ if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
31065
+ else { updateDoc(doc, change, spans); }
31066
+ setSelectionNoUndo(doc, selAfter, sel_dontScroll);
31067
+
31068
+ if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))
31069
+ { doc.cantEdit = false; }
31070
+ }
31071
+
31072
+ // Handle the interaction of a change to a document with the editor
31073
+ // that this document is part of.
31074
+ function makeChangeSingleDocInEditor(cm, change, spans) {
31075
+ var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
31076
+
31077
+ var recomputeMaxLength = false, checkWidthStart = from.line;
31078
+ if (!cm.options.lineWrapping) {
31079
+ checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
31080
+ doc.iter(checkWidthStart, to.line + 1, function (line) {
31081
+ if (line == display.maxLine) {
31082
+ recomputeMaxLength = true;
31083
+ return true
31084
+ }
31085
+ });
31086
+ }
31087
+
31088
+ if (doc.sel.contains(change.from, change.to) > -1)
31089
+ { signalCursorActivity(cm); }
31090
+
31091
+ updateDoc(doc, change, spans, estimateHeight(cm));
31092
+
31093
+ if (!cm.options.lineWrapping) {
31094
+ doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
31095
+ var len = lineLength(line);
31096
+ if (len > display.maxLineLength) {
31097
+ display.maxLine = line;
31098
+ display.maxLineLength = len;
31099
+ display.maxLineChanged = true;
31100
+ recomputeMaxLength = false;
31101
+ }
31102
+ });
31103
+ if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
31104
+ }
31105
+
31106
+ retreatFrontier(doc, from.line);
31107
+ startWorker(cm, 400);
31108
+
31109
+ var lendiff = change.text.length - (to.line - from.line) - 1;
31110
+ // Remember that these lines changed, for updating the display
31111
+ if (change.full)
31112
+ { regChange(cm); }
31113
+ else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
31114
+ { regLineChange(cm, from.line, "text"); }
31115
+ else
31116
+ { regChange(cm, from.line, to.line + 1, lendiff); }
31117
+
31118
+ var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
31119
+ if (changeHandler || changesHandler) {
31120
+ var obj = {
31121
+ from: from, to: to,
31122
+ text: change.text,
31123
+ removed: change.removed,
31124
+ origin: change.origin
31125
+ };
31126
+ if (changeHandler) { signalLater(cm, "change", cm, obj); }
31127
+ if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
31128
+ }
31129
+ cm.display.selForContextMenu = null;
31130
+ }
31131
+
31132
+ function replaceRange(doc, code, from, to, origin) {
31133
+ var assign;
31134
+
31135
+ if (!to) { to = from; }
31136
+ if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }
31137
+ if (typeof code == "string") { code = doc.splitLines(code); }
31138
+ makeChange(doc, {from: from, to: to, text: code, origin: origin});
31139
+ }
31140
+
31141
+ // Rebasing/resetting history to deal with externally-sourced changes
31142
+
31143
+ function rebaseHistSelSingle(pos, from, to, diff) {
31144
+ if (to < pos.line) {
31145
+ pos.line += diff;
31146
+ } else if (from < pos.line) {
31147
+ pos.line = from;
31148
+ pos.ch = 0;
31149
+ }
31150
+ }
31151
+
31152
+ // Tries to rebase an array of history events given a change in the
31153
+ // document. If the change touches the same lines as the event, the
31154
+ // event, and everything 'behind' it, is discarded. If the change is
31155
+ // before the event, the event's positions are updated. Uses a
31156
+ // copy-on-write scheme for the positions, to avoid having to
31157
+ // reallocate them all on every rebase, but also avoid problems with
31158
+ // shared position objects being unsafely updated.
31159
+ function rebaseHistArray(array, from, to, diff) {
31160
+ for (var i = 0; i < array.length; ++i) {
31161
+ var sub = array[i], ok = true;
31162
+ if (sub.ranges) {
31163
+ if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
31164
+ for (var j = 0; j < sub.ranges.length; j++) {
31165
+ rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
31166
+ rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
31167
+ }
31168
+ continue
31169
+ }
31170
+ for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
31171
+ var cur = sub.changes[j$1];
31172
+ if (to < cur.from.line) {
31173
+ cur.from = Pos(cur.from.line + diff, cur.from.ch);
31174
+ cur.to = Pos(cur.to.line + diff, cur.to.ch);
31175
+ } else if (from <= cur.to.line) {
31176
+ ok = false;
31177
+ break
31178
+ }
31179
+ }
31180
+ if (!ok) {
31181
+ array.splice(0, i + 1);
31182
+ i = 0;
31183
+ }
31184
+ }
31185
+ }
31186
+
31187
+ function rebaseHist(hist, change) {
31188
+ var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
31189
+ rebaseHistArray(hist.done, from, to, diff);
31190
+ rebaseHistArray(hist.undone, from, to, diff);
31191
+ }
31192
+
31193
+ // Utility for applying a change to a line by handle or number,
31194
+ // returning the number and optionally registering the line as
31195
+ // changed.
31196
+ function changeLine(doc, handle, changeType, op) {
31197
+ var no = handle, line = handle;
31198
+ if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
31199
+ else { no = lineNo(handle); }
31200
+ if (no == null) { return null }
31201
+ if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
31202
+ return line
31203
+ }
31204
+
31205
+ // The document is represented as a BTree consisting of leaves, with
31206
+ // chunk of lines in them, and branches, with up to ten leaves or
31207
+ // other branch nodes below them. The top node is always a branch
31208
+ // node, and is the document object itself (meaning it has
31209
+ // additional methods and properties).
31210
+ //
31211
+ // All nodes have parent links. The tree is used both to go from
31212
+ // line numbers to line objects, and to go from objects to numbers.
31213
+ // It also indexes by height, and is used to convert between height
31214
+ // and line object, and to find the total height of the document.
31215
+ //
31216
+ // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
31217
+
31218
+ function LeafChunk(lines) {
31219
+ this.lines = lines;
31220
+ this.parent = null;
31221
+ var height = 0;
31222
+ for (var i = 0; i < lines.length; ++i) {
31223
+ lines[i].parent = this;
31224
+ height += lines[i].height;
31225
+ }
31226
+ this.height = height;
31227
+ }
31228
+
31229
+ LeafChunk.prototype = {
31230
+ chunkSize: function() { return this.lines.length },
31231
+
31232
+ // Remove the n lines at offset 'at'.
31233
+ removeInner: function(at, n) {
31234
+ for (var i = at, e = at + n; i < e; ++i) {
31235
+ var line = this.lines[i];
31236
+ this.height -= line.height;
31237
+ cleanUpLine(line);
31238
+ signalLater(line, "delete");
31239
+ }
31240
+ this.lines.splice(at, n);
31241
+ },
31242
+
31243
+ // Helper used to collapse a small branch into a single leaf.
31244
+ collapse: function(lines) {
31245
+ lines.push.apply(lines, this.lines);
31246
+ },
31247
+
31248
+ // Insert the given array of lines at offset 'at', count them as
31249
+ // having the given height.
31250
+ insertInner: function(at, lines, height) {
31251
+ this.height += height;
31252
+ this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
31253
+ for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; }
31254
+ },
31255
+
31256
+ // Used to iterate over a part of the tree.
31257
+ iterN: function(at, n, op) {
31258
+ for (var e = at + n; at < e; ++at)
31259
+ { if (op(this.lines[at])) { return true } }
31260
+ }
31261
+ };
31262
+
31263
+ function BranchChunk(children) {
31264
+ this.children = children;
31265
+ var size = 0, height = 0;
31266
+ for (var i = 0; i < children.length; ++i) {
31267
+ var ch = children[i];
31268
+ size += ch.chunkSize(); height += ch.height;
31269
+ ch.parent = this;
31270
+ }
31271
+ this.size = size;
31272
+ this.height = height;
31273
+ this.parent = null;
31274
+ }
31275
+
31276
+ BranchChunk.prototype = {
31277
+ chunkSize: function() { return this.size },
31278
+
31279
+ removeInner: function(at, n) {
31280
+ this.size -= n;
31281
+ for (var i = 0; i < this.children.length; ++i) {
31282
+ var child = this.children[i], sz = child.chunkSize();
31283
+ if (at < sz) {
31284
+ var rm = Math.min(n, sz - at), oldHeight = child.height;
31285
+ child.removeInner(at, rm);
31286
+ this.height -= oldHeight - child.height;
31287
+ if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
31288
+ if ((n -= rm) == 0) { break }
31289
+ at = 0;
31290
+ } else { at -= sz; }
31291
+ }
31292
+ // If the result is smaller than 25 lines, ensure that it is a
31293
+ // single leaf node.
31294
+ if (this.size - n < 25 &&
31295
+ (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
31296
+ var lines = [];
31297
+ this.collapse(lines);
31298
+ this.children = [new LeafChunk(lines)];
31299
+ this.children[0].parent = this;
31300
+ }
31301
+ },
31302
+
31303
+ collapse: function(lines) {
31304
+ for (var i = 0; i < this.children.length; ++i) { this.children[i].collapse(lines); }
31305
+ },
31306
+
31307
+ insertInner: function(at, lines, height) {
31308
+ this.size += lines.length;
31309
+ this.height += height;
31310
+ for (var i = 0; i < this.children.length; ++i) {
31311
+ var child = this.children[i], sz = child.chunkSize();
31312
+ if (at <= sz) {
31313
+ child.insertInner(at, lines, height);
31314
+ if (child.lines && child.lines.length > 50) {
31315
+ // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
31316
+ // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
31317
+ var remaining = child.lines.length % 25 + 25;
31318
+ for (var pos = remaining; pos < child.lines.length;) {
31319
+ var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
31320
+ child.height -= leaf.height;
31321
+ this.children.splice(++i, 0, leaf);
31322
+ leaf.parent = this;
31323
+ }
31324
+ child.lines = child.lines.slice(0, remaining);
31325
+ this.maybeSpill();
31326
+ }
31327
+ break
31328
+ }
31329
+ at -= sz;
31330
+ }
31331
+ },
31332
+
31333
+ // When a node has grown, check whether it should be split.
31334
+ maybeSpill: function() {
31335
+ if (this.children.length <= 10) { return }
31336
+ var me = this;
31337
+ do {
31338
+ var spilled = me.children.splice(me.children.length - 5, 5);
31339
+ var sibling = new BranchChunk(spilled);
31340
+ if (!me.parent) { // Become the parent node
31341
+ var copy = new BranchChunk(me.children);
31342
+ copy.parent = me;
31343
+ me.children = [copy, sibling];
31344
+ me = copy;
31345
+ } else {
31346
+ me.size -= sibling.size;
31347
+ me.height -= sibling.height;
31348
+ var myIndex = indexOf(me.parent.children, me);
31349
+ me.parent.children.splice(myIndex + 1, 0, sibling);
31350
+ }
31351
+ sibling.parent = me.parent;
31352
+ } while (me.children.length > 10)
31353
+ me.parent.maybeSpill();
31354
+ },
31355
+
31356
+ iterN: function(at, n, op) {
31357
+ for (var i = 0; i < this.children.length; ++i) {
31358
+ var child = this.children[i], sz = child.chunkSize();
31359
+ if (at < sz) {
31360
+ var used = Math.min(n, sz - at);
31361
+ if (child.iterN(at, used, op)) { return true }
31362
+ if ((n -= used) == 0) { break }
31363
+ at = 0;
31364
+ } else { at -= sz; }
31365
+ }
31366
+ }
31367
+ };
31368
+
31369
+ // Line widgets are block elements displayed above or below a line.
31370
+
31371
+ var LineWidget = function(doc, node, options) {
31372
+ if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
31373
+ { this[opt] = options[opt]; } } }
31374
+ this.doc = doc;
31375
+ this.node = node;
31376
+ };
31377
+
31378
+ LineWidget.prototype.clear = function () {
31379
+ var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
31380
+ if (no == null || !ws) { return }
31381
+ for (var i = 0; i < ws.length; ++i) { if (ws[i] == this) { ws.splice(i--, 1); } }
31382
+ if (!ws.length) { line.widgets = null; }
31383
+ var height = widgetHeight(this);
31384
+ updateLineHeight(line, Math.max(0, line.height - height));
31385
+ if (cm) {
31386
+ runInOp(cm, function () {
31387
+ adjustScrollWhenAboveVisible(cm, line, -height);
31388
+ regLineChange(cm, no, "widget");
31389
+ });
31390
+ signalLater(cm, "lineWidgetCleared", cm, this, no);
31391
+ }
31392
+ };
31393
+
31394
+ LineWidget.prototype.changed = function () {
31395
+ var this$1 = this;
31396
+
31397
+ var oldH = this.height, cm = this.doc.cm, line = this.line;
31398
+ this.height = null;
31399
+ var diff = widgetHeight(this) - oldH;
31400
+ if (!diff) { return }
31401
+ if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }
31402
+ if (cm) {
31403
+ runInOp(cm, function () {
31404
+ cm.curOp.forceUpdate = true;
31405
+ adjustScrollWhenAboveVisible(cm, line, diff);
31406
+ signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
31407
+ });
31408
+ }
31409
+ };
31410
+ eventMixin(LineWidget);
31411
+
31412
+ function adjustScrollWhenAboveVisible(cm, line, diff) {
31413
+ if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
31414
+ { addToScrollTop(cm, diff); }
31415
+ }
31416
+
31417
+ function addLineWidget(doc, handle, node, options) {
31418
+ var widget = new LineWidget(doc, node, options);
31419
+ var cm = doc.cm;
31420
+ if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
31421
+ changeLine(doc, handle, "widget", function (line) {
31422
+ var widgets = line.widgets || (line.widgets = []);
31423
+ if (widget.insertAt == null) { widgets.push(widget); }
31424
+ else { widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget); }
31425
+ widget.line = line;
31426
+ if (cm && !lineIsHidden(doc, line)) {
31427
+ var aboveVisible = heightAtLine(line) < doc.scrollTop;
31428
+ updateLineHeight(line, line.height + widgetHeight(widget));
31429
+ if (aboveVisible) { addToScrollTop(cm, widget.height); }
31430
+ cm.curOp.forceUpdate = true;
31431
+ }
31432
+ return true
31433
+ });
31434
+ if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); }
31435
+ return widget
31436
+ }
31437
+
31438
+ // TEXTMARKERS
31439
+
31440
+ // Created with markText and setBookmark methods. A TextMarker is a
31441
+ // handle that can be used to clear or find a marked position in the
31442
+ // document. Line objects hold arrays (markedSpans) containing
31443
+ // {from, to, marker} object pointing to such marker objects, and
31444
+ // indicating that such a marker is present on that line. Multiple
31445
+ // lines may point to the same marker when it spans across lines.
31446
+ // The spans will have null for their from/to properties when the
31447
+ // marker continues beyond the start/end of the line. Markers have
31448
+ // links back to the lines they currently touch.
31449
+
31450
+ // Collapsed markers have unique ids, in order to be able to order
31451
+ // them, which is needed for uniquely determining an outer marker
31452
+ // when they overlap (they may nest, but not partially overlap).
31453
+ var nextMarkerId = 0;
31454
+
31455
+ var TextMarker = function(doc, type) {
31456
+ this.lines = [];
31457
+ this.type = type;
31458
+ this.doc = doc;
31459
+ this.id = ++nextMarkerId;
31460
+ };
31461
+
31462
+ // Clear the marker.
31463
+ TextMarker.prototype.clear = function () {
31464
+ if (this.explicitlyCleared) { return }
31465
+ var cm = this.doc.cm, withOp = cm && !cm.curOp;
31466
+ if (withOp) { startOperation(cm); }
31467
+ if (hasHandler(this, "clear")) {
31468
+ var found = this.find();
31469
+ if (found) { signalLater(this, "clear", found.from, found.to); }
31470
+ }
31471
+ var min = null, max = null;
31472
+ for (var i = 0; i < this.lines.length; ++i) {
31473
+ var line = this.lines[i];
31474
+ var span = getMarkedSpanFor(line.markedSpans, this);
31475
+ if (cm && !this.collapsed) { regLineChange(cm, lineNo(line), "text"); }
31476
+ else if (cm) {
31477
+ if (span.to != null) { max = lineNo(line); }
31478
+ if (span.from != null) { min = lineNo(line); }
31479
+ }
31480
+ line.markedSpans = removeMarkedSpan(line.markedSpans, span);
31481
+ if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)
31482
+ { updateLineHeight(line, textHeight(cm.display)); }
31483
+ }
31484
+ if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
31485
+ var visual = visualLine(this.lines[i$1]), len = lineLength(visual);
31486
+ if (len > cm.display.maxLineLength) {
31487
+ cm.display.maxLine = visual;
31488
+ cm.display.maxLineLength = len;
31489
+ cm.display.maxLineChanged = true;
31490
+ }
31491
+ } }
31492
+
31493
+ if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
31494
+ this.lines.length = 0;
31495
+ this.explicitlyCleared = true;
31496
+ if (this.atomic && this.doc.cantEdit) {
31497
+ this.doc.cantEdit = false;
31498
+ if (cm) { reCheckSelection(cm.doc); }
31499
+ }
31500
+ if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
31501
+ if (withOp) { endOperation(cm); }
31502
+ if (this.parent) { this.parent.clear(); }
31503
+ };
31504
+
31505
+ // Find the position of the marker in the document. Returns a {from,
31506
+ // to} object by default. Side can be passed to get a specific side
31507
+ // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
31508
+ // Pos objects returned contain a line object, rather than a line
31509
+ // number (used to prevent looking up the same line twice).
31510
+ TextMarker.prototype.find = function (side, lineObj) {
31511
+ if (side == null && this.type == "bookmark") { side = 1; }
31512
+ var from, to;
31513
+ for (var i = 0; i < this.lines.length; ++i) {
31514
+ var line = this.lines[i];
31515
+ var span = getMarkedSpanFor(line.markedSpans, this);
31516
+ if (span.from != null) {
31517
+ from = Pos(lineObj ? line : lineNo(line), span.from);
31518
+ if (side == -1) { return from }
31519
+ }
31520
+ if (span.to != null) {
31521
+ to = Pos(lineObj ? line : lineNo(line), span.to);
31522
+ if (side == 1) { return to }
31523
+ }
31524
+ }
31525
+ return from && {from: from, to: to}
31526
+ };
31527
+
31528
+ // Signals that the marker's widget changed, and surrounding layout
31529
+ // should be recomputed.
31530
+ TextMarker.prototype.changed = function () {
31531
+ var this$1 = this;
31532
+
31533
+ var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
31534
+ if (!pos || !cm) { return }
31535
+ runInOp(cm, function () {
31536
+ var line = pos.line, lineN = lineNo(pos.line);
31537
+ var view = findViewForLine(cm, lineN);
31538
+ if (view) {
31539
+ clearLineMeasurementCacheFor(view);
31540
+ cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
31541
+ }
31542
+ cm.curOp.updateMaxLine = true;
31543
+ if (!lineIsHidden(widget.doc, line) && widget.height != null) {
31544
+ var oldHeight = widget.height;
31545
+ widget.height = null;
31546
+ var dHeight = widgetHeight(widget) - oldHeight;
31547
+ if (dHeight)
31548
+ { updateLineHeight(line, line.height + dHeight); }
31549
+ }
31550
+ signalLater(cm, "markerChanged", cm, this$1);
31551
+ });
31552
+ };
31553
+
31554
+ TextMarker.prototype.attachLine = function (line) {
31555
+ if (!this.lines.length && this.doc.cm) {
31556
+ var op = this.doc.cm.curOp;
31557
+ if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
31558
+ { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
31559
+ }
31560
+ this.lines.push(line);
31561
+ };
31562
+
31563
+ TextMarker.prototype.detachLine = function (line) {
31564
+ this.lines.splice(indexOf(this.lines, line), 1);
31565
+ if (!this.lines.length && this.doc.cm) {
31566
+ var op = this.doc.cm.curOp
31567
+ ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
31568
+ }
31569
+ };
31570
+ eventMixin(TextMarker);
31571
+
31572
+ // Create a marker, wire it up to the right lines, and
31573
+ function markText(doc, from, to, options, type) {
31574
+ // Shared markers (across linked documents) are handled separately
31575
+ // (markTextShared will call out to this again, once per
31576
+ // document).
31577
+ if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
31578
+ // Ensure we are in an operation.
31579
+ if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
31580
+
31581
+ var marker = new TextMarker(doc, type), diff = cmp(from, to);
31582
+ if (options) { copyObj(options, marker, false); }
31583
+ // Don't connect empty markers unless clearWhenEmpty is false
31584
+ if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
31585
+ { return marker }
31586
+ if (marker.replacedWith) {
31587
+ // Showing up as a widget implies collapsed (widget replaces text)
31588
+ marker.collapsed = true;
31589
+ marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
31590
+ if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
31591
+ if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
31592
+ }
31593
+ if (marker.collapsed) {
31594
+ if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
31595
+ from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
31596
+ { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
31597
+ seeCollapsedSpans();
31598
+ }
31599
+
31600
+ if (marker.addToHistory)
31601
+ { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
31602
+
31603
+ var curLine = from.line, cm = doc.cm, updateMaxLine;
31604
+ doc.iter(curLine, to.line + 1, function (line) {
31605
+ if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
31606
+ { updateMaxLine = true; }
31607
+ if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
31608
+ addMarkedSpan(line, new MarkedSpan(marker,
31609
+ curLine == from.line ? from.ch : null,
31610
+ curLine == to.line ? to.ch : null));
31611
+ ++curLine;
31612
+ });
31613
+ // lineIsHidden depends on the presence of the spans, so needs a second pass
31614
+ if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
31615
+ if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
31616
+ }); }
31617
+
31618
+ if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
31619
+
31620
+ if (marker.readOnly) {
31621
+ seeReadOnlySpans();
31622
+ if (doc.history.done.length || doc.history.undone.length)
31623
+ { doc.clearHistory(); }
31624
+ }
31625
+ if (marker.collapsed) {
31626
+ marker.id = ++nextMarkerId;
31627
+ marker.atomic = true;
31628
+ }
31629
+ if (cm) {
31630
+ // Sync editor state
31631
+ if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
31632
+ if (marker.collapsed)
31633
+ { regChange(cm, from.line, to.line + 1); }
31634
+ else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||
31635
+ marker.attributes || marker.title)
31636
+ { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
31637
+ if (marker.atomic) { reCheckSelection(cm.doc); }
31638
+ signalLater(cm, "markerAdded", cm, marker);
31639
+ }
31640
+ return marker
31641
+ }
31642
+
31643
+ // SHARED TEXTMARKERS
31644
+
31645
+ // A shared marker spans multiple linked documents. It is
31646
+ // implemented as a meta-marker-object controlling multiple normal
31647
+ // markers.
31648
+ var SharedTextMarker = function(markers, primary) {
31649
+ this.markers = markers;
31650
+ this.primary = primary;
31651
+ for (var i = 0; i < markers.length; ++i)
31652
+ { markers[i].parent = this; }
31653
+ };
31654
+
31655
+ SharedTextMarker.prototype.clear = function () {
31656
+ if (this.explicitlyCleared) { return }
31657
+ this.explicitlyCleared = true;
31658
+ for (var i = 0; i < this.markers.length; ++i)
31659
+ { this.markers[i].clear(); }
31660
+ signalLater(this, "clear");
31661
+ };
31662
+
31663
+ SharedTextMarker.prototype.find = function (side, lineObj) {
31664
+ return this.primary.find(side, lineObj)
31665
+ };
31666
+ eventMixin(SharedTextMarker);
31667
+
31668
+ function markTextShared(doc, from, to, options, type) {
31669
+ options = copyObj(options);
31670
+ options.shared = false;
31671
+ var markers = [markText(doc, from, to, options, type)], primary = markers[0];
31672
+ var widget = options.widgetNode;
31673
+ linkedDocs(doc, function (doc) {
31674
+ if (widget) { options.widgetNode = widget.cloneNode(true); }
31675
+ markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
31676
+ for (var i = 0; i < doc.linked.length; ++i)
31677
+ { if (doc.linked[i].isParent) { return } }
31678
+ primary = lst(markers);
31679
+ });
31680
+ return new SharedTextMarker(markers, primary)
31681
+ }
31682
+
31683
+ function findSharedMarkers(doc) {
31684
+ return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
31685
+ }
31686
+
31687
+ function copySharedMarkers(doc, markers) {
31688
+ for (var i = 0; i < markers.length; i++) {
31689
+ var marker = markers[i], pos = marker.find();
31690
+ var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
31691
+ if (cmp(mFrom, mTo)) {
31692
+ var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
31693
+ marker.markers.push(subMark);
31694
+ subMark.parent = marker;
31695
+ }
31696
+ }
31697
+ }
31698
+
31699
+ function detachSharedMarkers(markers) {
31700
+ var loop = function ( i ) {
31701
+ var marker = markers[i], linked = [marker.primary.doc];
31702
+ linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
31703
+ for (var j = 0; j < marker.markers.length; j++) {
31704
+ var subMarker = marker.markers[j];
31705
+ if (indexOf(linked, subMarker.doc) == -1) {
31706
+ subMarker.parent = null;
31707
+ marker.markers.splice(j--, 1);
31708
+ }
31709
+ }
31710
+ };
31711
+
31712
+ for (var i = 0; i < markers.length; i++) loop( i );
31713
+ }
31714
+
31715
+ var nextDocId = 0;
31716
+ var Doc = function(text, mode, firstLine, lineSep, direction) {
31717
+ if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
31718
+ if (firstLine == null) { firstLine = 0; }
31719
+
31720
+ BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
31721
+ this.first = firstLine;
31722
+ this.scrollTop = this.scrollLeft = 0;
31723
+ this.cantEdit = false;
31724
+ this.cleanGeneration = 1;
31725
+ this.modeFrontier = this.highlightFrontier = firstLine;
31726
+ var start = Pos(firstLine, 0);
31727
+ this.sel = simpleSelection(start);
31728
+ this.history = new History(null);
31729
+ this.id = ++nextDocId;
31730
+ this.modeOption = mode;
31731
+ this.lineSep = lineSep;
31732
+ this.direction = (direction == "rtl") ? "rtl" : "ltr";
31733
+ this.extend = false;
31734
+
31735
+ if (typeof text == "string") { text = this.splitLines(text); }
31736
+ updateDoc(this, {from: start, to: start, text: text});
31737
+ setSelection(this, simpleSelection(start), sel_dontScroll);
31738
+ };
31739
+
31740
+ Doc.prototype = createObj(BranchChunk.prototype, {
31741
+ constructor: Doc,
31742
+ // Iterate over the document. Supports two forms -- with only one
31743
+ // argument, it calls that for each line in the document. With
31744
+ // three, it iterates over the range given by the first two (with
31745
+ // the second being non-inclusive).
31746
+ iter: function(from, to, op) {
31747
+ if (op) { this.iterN(from - this.first, to - from, op); }
31748
+ else { this.iterN(this.first, this.first + this.size, from); }
31749
+ },
31750
+
31751
+ // Non-public interface for adding and removing lines.
31752
+ insert: function(at, lines) {
31753
+ var height = 0;
31754
+ for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
31755
+ this.insertInner(at - this.first, lines, height);
31756
+ },
31757
+ remove: function(at, n) { this.removeInner(at - this.first, n); },
31758
+
31759
+ // From here, the methods are part of the public interface. Most
31760
+ // are also available from CodeMirror (editor) instances.
31761
+
31762
+ getValue: function(lineSep) {
31763
+ var lines = getLines(this, this.first, this.first + this.size);
31764
+ if (lineSep === false) { return lines }
31765
+ return lines.join(lineSep || this.lineSeparator())
31766
+ },
31767
+ setValue: docMethodOp(function(code) {
31768
+ var top = Pos(this.first, 0), last = this.first + this.size - 1;
31769
+ makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
31770
+ text: this.splitLines(code), origin: "setValue", full: true}, true);
31771
+ if (this.cm) { scrollToCoords(this.cm, 0, 0); }
31772
+ setSelection(this, simpleSelection(top), sel_dontScroll);
31773
+ }),
31774
+ replaceRange: function(code, from, to, origin) {
31775
+ from = clipPos(this, from);
31776
+ to = to ? clipPos(this, to) : from;
31777
+ replaceRange(this, code, from, to, origin);
31778
+ },
31779
+ getRange: function(from, to, lineSep) {
31780
+ var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
31781
+ if (lineSep === false) { return lines }
31782
+ return lines.join(lineSep || this.lineSeparator())
31783
+ },
31784
+
31785
+ getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
31786
+
31787
+ getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
31788
+ getLineNumber: function(line) {return lineNo(line)},
31789
+
31790
+ getLineHandleVisualStart: function(line) {
31791
+ if (typeof line == "number") { line = getLine(this, line); }
31792
+ return visualLine(line)
31793
+ },
31794
+
31795
+ lineCount: function() {return this.size},
31796
+ firstLine: function() {return this.first},
31797
+ lastLine: function() {return this.first + this.size - 1},
31798
+
31799
+ clipPos: function(pos) {return clipPos(this, pos)},
31800
+
31801
+ getCursor: function(start) {
31802
+ var range = this.sel.primary(), pos;
31803
+ if (start == null || start == "head") { pos = range.head; }
31804
+ else if (start == "anchor") { pos = range.anchor; }
31805
+ else if (start == "end" || start == "to" || start === false) { pos = range.to(); }
31806
+ else { pos = range.from(); }
31807
+ return pos
31808
+ },
31809
+ listSelections: function() { return this.sel.ranges },
31810
+ somethingSelected: function() {return this.sel.somethingSelected()},
31811
+
31812
+ setCursor: docMethodOp(function(line, ch, options) {
31813
+ setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
31814
+ }),
31815
+ setSelection: docMethodOp(function(anchor, head, options) {
31816
+ setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
31817
+ }),
31818
+ extendSelection: docMethodOp(function(head, other, options) {
31819
+ extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
31820
+ }),
31821
+ extendSelections: docMethodOp(function(heads, options) {
31822
+ extendSelections(this, clipPosArray(this, heads), options);
31823
+ }),
31824
+ extendSelectionsBy: docMethodOp(function(f, options) {
31825
+ var heads = map(this.sel.ranges, f);
31826
+ extendSelections(this, clipPosArray(this, heads), options);
31827
+ }),
31828
+ setSelections: docMethodOp(function(ranges, primary, options) {
31829
+ if (!ranges.length) { return }
31830
+ var out = [];
31831
+ for (var i = 0; i < ranges.length; i++)
31832
+ { out[i] = new Range(clipPos(this, ranges[i].anchor),
31833
+ clipPos(this, ranges[i].head)); }
31834
+ if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
31835
+ setSelection(this, normalizeSelection(this.cm, out, primary), options);
31836
+ }),
31837
+ addSelection: docMethodOp(function(anchor, head, options) {
31838
+ var ranges = this.sel.ranges.slice(0);
31839
+ ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
31840
+ setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);
31841
+ }),
31842
+
31843
+ getSelection: function(lineSep) {
31844
+ var ranges = this.sel.ranges, lines;
31845
+ for (var i = 0; i < ranges.length; i++) {
31846
+ var sel = getBetween(this, ranges[i].from(), ranges[i].to());
31847
+ lines = lines ? lines.concat(sel) : sel;
31848
+ }
31849
+ if (lineSep === false) { return lines }
31850
+ else { return lines.join(lineSep || this.lineSeparator()) }
31851
+ },
31852
+ getSelections: function(lineSep) {
31853
+ var parts = [], ranges = this.sel.ranges;
31854
+ for (var i = 0; i < ranges.length; i++) {
31855
+ var sel = getBetween(this, ranges[i].from(), ranges[i].to());
31856
+ if (lineSep !== false) { sel = sel.join(lineSep || this.lineSeparator()); }
31857
+ parts[i] = sel;
31858
+ }
31859
+ return parts
31860
+ },
31861
+ replaceSelection: function(code, collapse, origin) {
31862
+ var dup = [];
31863
+ for (var i = 0; i < this.sel.ranges.length; i++)
31864
+ { dup[i] = code; }
31865
+ this.replaceSelections(dup, collapse, origin || "+input");
31866
+ },
31867
+ replaceSelections: docMethodOp(function(code, collapse, origin) {
31868
+ var changes = [], sel = this.sel;
31869
+ for (var i = 0; i < sel.ranges.length; i++) {
31870
+ var range = sel.ranges[i];
31871
+ changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};
31872
+ }
31873
+ var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
31874
+ for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
31875
+ { makeChange(this, changes[i$1]); }
31876
+ if (newSel) { setSelectionReplaceHistory(this, newSel); }
31877
+ else if (this.cm) { ensureCursorVisible(this.cm); }
31878
+ }),
31879
+ undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
31880
+ redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
31881
+ undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
31882
+ redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
31883
+
31884
+ setExtending: function(val) {this.extend = val;},
31885
+ getExtending: function() {return this.extend},
31886
+
31887
+ historySize: function() {
31888
+ var hist = this.history, done = 0, undone = 0;
31889
+ for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
31890
+ for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
31891
+ return {undo: done, redo: undone}
31892
+ },
31893
+ clearHistory: function() {
31894
+ var this$1 = this;
31895
+
31896
+ this.history = new History(this.history.maxGeneration);
31897
+ linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true);
31898
+ },
31899
+
31900
+ markClean: function() {
31901
+ this.cleanGeneration = this.changeGeneration(true);
31902
+ },
31903
+ changeGeneration: function(forceSplit) {
31904
+ if (forceSplit)
31905
+ { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
31906
+ return this.history.generation
31907
+ },
31908
+ isClean: function (gen) {
31909
+ return this.history.generation == (gen || this.cleanGeneration)
31910
+ },
31911
+
31912
+ getHistory: function() {
31913
+ return {done: copyHistoryArray(this.history.done),
31914
+ undone: copyHistoryArray(this.history.undone)}
31915
+ },
31916
+ setHistory: function(histData) {
31917
+ var hist = this.history = new History(this.history.maxGeneration);
31918
+ hist.done = copyHistoryArray(histData.done.slice(0), null, true);
31919
+ hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
31920
+ },
31921
+
31922
+ setGutterMarker: docMethodOp(function(line, gutterID, value) {
31923
+ return changeLine(this, line, "gutter", function (line) {
31924
+ var markers = line.gutterMarkers || (line.gutterMarkers = {});
31925
+ markers[gutterID] = value;
31926
+ if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
31927
+ return true
31928
+ })
31929
+ }),
31930
+
31931
+ clearGutter: docMethodOp(function(gutterID) {
31932
+ var this$1 = this;
31933
+
31934
+ this.iter(function (line) {
31935
+ if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
31936
+ changeLine(this$1, line, "gutter", function () {
31937
+ line.gutterMarkers[gutterID] = null;
31938
+ if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
31939
+ return true
31940
+ });
31941
+ }
31942
+ });
31943
+ }),
31944
+
31945
+ lineInfo: function(line) {
31946
+ var n;
31947
+ if (typeof line == "number") {
31948
+ if (!isLine(this, line)) { return null }
31949
+ n = line;
31950
+ line = getLine(this, line);
31951
+ if (!line) { return null }
31952
+ } else {
31953
+ n = lineNo(line);
31954
+ if (n == null) { return null }
31955
+ }
31956
+ return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
31957
+ textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
31958
+ widgets: line.widgets}
31959
+ },
31960
+
31961
+ addLineClass: docMethodOp(function(handle, where, cls) {
31962
+ return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
31963
+ var prop = where == "text" ? "textClass"
31964
+ : where == "background" ? "bgClass"
31965
+ : where == "gutter" ? "gutterClass" : "wrapClass";
31966
+ if (!line[prop]) { line[prop] = cls; }
31967
+ else if (classTest(cls).test(line[prop])) { return false }
31968
+ else { line[prop] += " " + cls; }
31969
+ return true
31970
+ })
31971
+ }),
31972
+ removeLineClass: docMethodOp(function(handle, where, cls) {
31973
+ return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
31974
+ var prop = where == "text" ? "textClass"
31975
+ : where == "background" ? "bgClass"
31976
+ : where == "gutter" ? "gutterClass" : "wrapClass";
31977
+ var cur = line[prop];
31978
+ if (!cur) { return false }
31979
+ else if (cls == null) { line[prop] = null; }
31980
+ else {
31981
+ var found = cur.match(classTest(cls));
31982
+ if (!found) { return false }
31983
+ var end = found.index + found[0].length;
31984
+ line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
31985
+ }
31986
+ return true
31987
+ })
31988
+ }),
31989
+
31990
+ addLineWidget: docMethodOp(function(handle, node, options) {
31991
+ return addLineWidget(this, handle, node, options)
31992
+ }),
31993
+ removeLineWidget: function(widget) { widget.clear(); },
31994
+
31995
+ markText: function(from, to, options) {
31996
+ return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
31997
+ },
31998
+ setBookmark: function(pos, options) {
31999
+ var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
32000
+ insertLeft: options && options.insertLeft,
32001
+ clearWhenEmpty: false, shared: options && options.shared,
32002
+ handleMouseEvents: options && options.handleMouseEvents};
32003
+ pos = clipPos(this, pos);
32004
+ return markText(this, pos, pos, realOpts, "bookmark")
32005
+ },
32006
+ findMarksAt: function(pos) {
32007
+ pos = clipPos(this, pos);
32008
+ var markers = [], spans = getLine(this, pos.line).markedSpans;
32009
+ if (spans) { for (var i = 0; i < spans.length; ++i) {
32010
+ var span = spans[i];
32011
+ if ((span.from == null || span.from <= pos.ch) &&
32012
+ (span.to == null || span.to >= pos.ch))
32013
+ { markers.push(span.marker.parent || span.marker); }
32014
+ } }
32015
+ return markers
32016
+ },
32017
+ findMarks: function(from, to, filter) {
32018
+ from = clipPos(this, from); to = clipPos(this, to);
32019
+ var found = [], lineNo = from.line;
32020
+ this.iter(from.line, to.line + 1, function (line) {
32021
+ var spans = line.markedSpans;
32022
+ if (spans) { for (var i = 0; i < spans.length; i++) {
32023
+ var span = spans[i];
32024
+ if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||
32025
+ span.from == null && lineNo != from.line ||
32026
+ span.from != null && lineNo == to.line && span.from >= to.ch) &&
32027
+ (!filter || filter(span.marker)))
32028
+ { found.push(span.marker.parent || span.marker); }
32029
+ } }
32030
+ ++lineNo;
32031
+ });
32032
+ return found
32033
+ },
32034
+ getAllMarks: function() {
32035
+ var markers = [];
32036
+ this.iter(function (line) {
32037
+ var sps = line.markedSpans;
32038
+ if (sps) { for (var i = 0; i < sps.length; ++i)
32039
+ { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
32040
+ });
32041
+ return markers
32042
+ },
32043
+
32044
+ posFromIndex: function(off) {
32045
+ var ch, lineNo = this.first, sepSize = this.lineSeparator().length;
32046
+ this.iter(function (line) {
32047
+ var sz = line.text.length + sepSize;
32048
+ if (sz > off) { ch = off; return true }
32049
+ off -= sz;
32050
+ ++lineNo;
32051
+ });
32052
+ return clipPos(this, Pos(lineNo, ch))
32053
+ },
32054
+ indexFromPos: function (coords) {
32055
+ coords = clipPos(this, coords);
32056
+ var index = coords.ch;
32057
+ if (coords.line < this.first || coords.ch < 0) { return 0 }
32058
+ var sepSize = this.lineSeparator().length;
32059
+ this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
32060
+ index += line.text.length + sepSize;
32061
+ });
32062
+ return index
32063
+ },
32064
+
32065
+ copy: function(copyHistory) {
32066
+ var doc = new Doc(getLines(this, this.first, this.first + this.size),
32067
+ this.modeOption, this.first, this.lineSep, this.direction);
32068
+ doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
32069
+ doc.sel = this.sel;
32070
+ doc.extend = false;
32071
+ if (copyHistory) {
32072
+ doc.history.undoDepth = this.history.undoDepth;
32073
+ doc.setHistory(this.getHistory());
32074
+ }
32075
+ return doc
32076
+ },
32077
+
32078
+ linkedDoc: function(options) {
32079
+ if (!options) { options = {}; }
32080
+ var from = this.first, to = this.first + this.size;
32081
+ if (options.from != null && options.from > from) { from = options.from; }
32082
+ if (options.to != null && options.to < to) { to = options.to; }
32083
+ var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
32084
+ if (options.sharedHist) { copy.history = this.history
32085
+ ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
32086
+ copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
32087
+ copySharedMarkers(copy, findSharedMarkers(this));
32088
+ return copy
32089
+ },
32090
+ unlinkDoc: function(other) {
32091
+ if (other instanceof CodeMirror) { other = other.doc; }
32092
+ if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
32093
+ var link = this.linked[i];
32094
+ if (link.doc != other) { continue }
32095
+ this.linked.splice(i, 1);
32096
+ other.unlinkDoc(this);
32097
+ detachSharedMarkers(findSharedMarkers(this));
32098
+ break
32099
+ } }
32100
+ // If the histories were shared, split them again
32101
+ if (other.history == this.history) {
32102
+ var splitIds = [other.id];
32103
+ linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
32104
+ other.history = new History(null);
32105
+ other.history.done = copyHistoryArray(this.history.done, splitIds);
32106
+ other.history.undone = copyHistoryArray(this.history.undone, splitIds);
32107
+ }
32108
+ },
32109
+ iterLinkedDocs: function(f) {linkedDocs(this, f);},
32110
+
32111
+ getMode: function() {return this.mode},
32112
+ getEditor: function() {return this.cm},
32113
+
32114
+ splitLines: function(str) {
32115
+ if (this.lineSep) { return str.split(this.lineSep) }
32116
+ return splitLinesAuto(str)
32117
+ },
32118
+ lineSeparator: function() { return this.lineSep || "\n" },
32119
+
32120
+ setDirection: docMethodOp(function (dir) {
32121
+ if (dir != "rtl") { dir = "ltr"; }
32122
+ if (dir == this.direction) { return }
32123
+ this.direction = dir;
32124
+ this.iter(function (line) { return line.order = null; });
32125
+ if (this.cm) { directionChanged(this.cm); }
32126
+ })
32127
+ });
32128
+
32129
+ // Public alias.
32130
+ Doc.prototype.eachLine = Doc.prototype.iter;
32131
+
32132
+ // Kludge to work around strange IE behavior where it'll sometimes
32133
+ // re-fire a series of drag-related events right after the drop (#1551)
32134
+ var lastDrop = 0;
32135
+
32136
+ function onDrop(e) {
32137
+ var cm = this;
32138
+ clearDragCursor(cm);
32139
+ if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
32140
+ { return }
32141
+ e_preventDefault(e);
32142
+ if (ie) { lastDrop = +new Date; }
32143
+ var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
32144
+ if (!pos || cm.isReadOnly()) { return }
32145
+ // Might be a file drop, in which case we simply extract the text
32146
+ // and insert it.
32147
+ if (files && files.length && window.FileReader && window.File) {
32148
+ var n = files.length, text = Array(n), read = 0;
32149
+ var markAsReadAndPasteIfAllFilesAreRead = function () {
32150
+ if (++read == n) {
32151
+ operation(cm, function () {
32152
+ pos = clipPos(cm.doc, pos);
32153
+ var change = {from: pos, to: pos,
32154
+ text: cm.doc.splitLines(
32155
+ text.filter(function (t) { return t != null; }).join(cm.doc.lineSeparator())),
32156
+ origin: "paste"};
32157
+ makeChange(cm.doc, change);
32158
+ setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))));
32159
+ })();
32160
+ }
32161
+ };
32162
+ var readTextFromFile = function (file, i) {
32163
+ if (cm.options.allowDropFileTypes &&
32164
+ indexOf(cm.options.allowDropFileTypes, file.type) == -1) {
32165
+ markAsReadAndPasteIfAllFilesAreRead();
32166
+ return
32167
+ }
32168
+ var reader = new FileReader;
32169
+ reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); };
32170
+ reader.onload = function () {
32171
+ var content = reader.result;
32172
+ if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) {
32173
+ markAsReadAndPasteIfAllFilesAreRead();
32174
+ return
32175
+ }
32176
+ text[i] = content;
32177
+ markAsReadAndPasteIfAllFilesAreRead();
32178
+ };
32179
+ reader.readAsText(file);
32180
+ };
32181
+ for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); }
32182
+ } else { // Normal drop
32183
+ // Don't do a replace if the drop happened inside of the selected text.
32184
+ if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
32185
+ cm.state.draggingText(e);
32186
+ // Ensure the editor is re-focused
32187
+ setTimeout(function () { return cm.display.input.focus(); }, 20);
32188
+ return
32189
+ }
32190
+ try {
32191
+ var text$1 = e.dataTransfer.getData("Text");
32192
+ if (text$1) {
32193
+ var selected;
32194
+ if (cm.state.draggingText && !cm.state.draggingText.copy)
32195
+ { selected = cm.listSelections(); }
32196
+ setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
32197
+ if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
32198
+ { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
32199
+ cm.replaceSelection(text$1, "around", "paste");
32200
+ cm.display.input.focus();
32201
+ }
32202
+ }
32203
+ catch(e$1){}
32204
+ }
32205
+ }
32206
+
32207
+ function onDragStart(cm, e) {
32208
+ if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
32209
+ if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
32210
+
32211
+ e.dataTransfer.setData("Text", cm.getSelection());
32212
+ e.dataTransfer.effectAllowed = "copyMove";
32213
+
32214
+ // Use dummy image instead of default browsers image.
32215
+ // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
32216
+ if (e.dataTransfer.setDragImage && !safari) {
32217
+ var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
32218
+ img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
32219
+ if (presto) {
32220
+ img.width = img.height = 1;
32221
+ cm.display.wrapper.appendChild(img);
32222
+ // Force a relayout, or Opera won't use our image for some obscure reason
32223
+ img._top = img.offsetTop;
32224
+ }
32225
+ e.dataTransfer.setDragImage(img, 0, 0);
32226
+ if (presto) { img.parentNode.removeChild(img); }
32227
+ }
32228
+ }
32229
+
32230
+ function onDragOver(cm, e) {
32231
+ var pos = posFromMouse(cm, e);
32232
+ if (!pos) { return }
32233
+ var frag = document.createDocumentFragment();
32234
+ drawSelectionCursor(cm, pos, frag);
32235
+ if (!cm.display.dragCursor) {
32236
+ cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
32237
+ cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
32238
+ }
32239
+ removeChildrenAndAdd(cm.display.dragCursor, frag);
32240
+ }
32241
+
32242
+ function clearDragCursor(cm) {
32243
+ if (cm.display.dragCursor) {
32244
+ cm.display.lineSpace.removeChild(cm.display.dragCursor);
32245
+ cm.display.dragCursor = null;
32246
+ }
32247
+ }
32248
+
32249
+ // These must be handled carefully, because naively registering a
32250
+ // handler for each editor will cause the editors to never be
32251
+ // garbage collected.
32252
+
32253
+ function forEachCodeMirror(f) {
32254
+ if (!document.getElementsByClassName) { return }
32255
+ var byClass = document.getElementsByClassName("CodeMirror"), editors = [];
32256
+ for (var i = 0; i < byClass.length; i++) {
32257
+ var cm = byClass[i].CodeMirror;
32258
+ if (cm) { editors.push(cm); }
32259
+ }
32260
+ if (editors.length) { editors[0].operation(function () {
32261
+ for (var i = 0; i < editors.length; i++) { f(editors[i]); }
32262
+ }); }
32263
+ }
32264
+
32265
+ var globalsRegistered = false;
32266
+ function ensureGlobalHandlers() {
32267
+ if (globalsRegistered) { return }
32268
+ registerGlobalHandlers();
32269
+ globalsRegistered = true;
32270
+ }
32271
+ function registerGlobalHandlers() {
32272
+ // When the window resizes, we need to refresh active editors.
32273
+ var resizeTimer;
32274
+ on(window, "resize", function () {
32275
+ if (resizeTimer == null) { resizeTimer = setTimeout(function () {
32276
+ resizeTimer = null;
32277
+ forEachCodeMirror(onResize);
32278
+ }, 100); }
32279
+ });
32280
+ // When the window loses focus, we want to show the editor as blurred
32281
+ on(window, "blur", function () { return forEachCodeMirror(onBlur); });
32282
+ }
32283
+ // Called when the window resizes
32284
+ function onResize(cm) {
32285
+ var d = cm.display;
32286
+ // Might be a text scaling operation, clear size caches.
32287
+ d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
32288
+ d.scrollbarsClipped = false;
32289
+ cm.setSize();
32290
+ }
32291
+
32292
+ var keyNames = {
32293
+ 3: "Pause", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
32294
+ 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
32295
+ 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
32296
+ 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
32297
+ 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 145: "ScrollLock",
32298
+ 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
32299
+ 221: "]", 222: "'", 224: "Mod", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
32300
+ 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
32301
+ };
32302
+
32303
+ // Number keys
32304
+ for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
32305
+ // Alphabetic keys
32306
+ for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
32307
+ // Function keys
32308
+ for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
32309
+
32310
+ var keyMap = {};
32311
+
32312
+ keyMap.basic = {
32313
+ "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
32314
+ "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
32315
+ "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
32316
+ "Tab": "defaultTab", "Shift-Tab": "indentAuto",
32317
+ "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
32318
+ "Esc": "singleSelection"
32319
+ };
32320
+ // Note that the save and find-related commands aren't defined by
32321
+ // default. User code or addons can define them. Unknown commands
32322
+ // are simply ignored.
32323
+ keyMap.pcDefault = {
32324
+ "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
32325
+ "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
32326
+ "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
32327
+ "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
32328
+ "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
32329
+ "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
32330
+ "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
32331
+ "fallthrough": "basic"
32332
+ };
32333
+ // Very basic readline/emacs-style bindings, which are standard on Mac.
32334
+ keyMap.emacsy = {
32335
+ "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
32336
+ "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
32337
+ "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
32338
+ "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
32339
+ "Ctrl-O": "openLine"
32340
+ };
32341
+ keyMap.macDefault = {
32342
+ "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
32343
+ "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
32344
+ "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
32345
+ "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
32346
+ "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
32347
+ "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
32348
+ "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
32349
+ "fallthrough": ["basic", "emacsy"]
32350
+ };
32351
+ keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
32352
+
32353
+ // KEYMAP DISPATCH
32354
+
32355
+ function normalizeKeyName(name) {
32356
+ var parts = name.split(/-(?!$)/);
32357
+ name = parts[parts.length - 1];
32358
+ var alt, ctrl, shift, cmd;
32359
+ for (var i = 0; i < parts.length - 1; i++) {
32360
+ var mod = parts[i];
32361
+ if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
32362
+ else if (/^a(lt)?$/i.test(mod)) { alt = true; }
32363
+ else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
32364
+ else if (/^s(hift)?$/i.test(mod)) { shift = true; }
32365
+ else { throw new Error("Unrecognized modifier name: " + mod) }
32366
+ }
32367
+ if (alt) { name = "Alt-" + name; }
32368
+ if (ctrl) { name = "Ctrl-" + name; }
32369
+ if (cmd) { name = "Cmd-" + name; }
32370
+ if (shift) { name = "Shift-" + name; }
32371
+ return name
32372
+ }
32373
+
32374
+ // This is a kludge to keep keymaps mostly working as raw objects
32375
+ // (backwards compatibility) while at the same time support features
32376
+ // like normalization and multi-stroke key bindings. It compiles a
32377
+ // new normalized keymap, and then updates the old object to reflect
32378
+ // this.
32379
+ function normalizeKeyMap(keymap) {
32380
+ var copy = {};
32381
+ for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
32382
+ var value = keymap[keyname];
32383
+ if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
32384
+ if (value == "...") { delete keymap[keyname]; continue }
32385
+
32386
+ var keys = map(keyname.split(" "), normalizeKeyName);
32387
+ for (var i = 0; i < keys.length; i++) {
32388
+ var val = (void 0), name = (void 0);
32389
+ if (i == keys.length - 1) {
32390
+ name = keys.join(" ");
32391
+ val = value;
32392
+ } else {
32393
+ name = keys.slice(0, i + 1).join(" ");
32394
+ val = "...";
32395
+ }
32396
+ var prev = copy[name];
32397
+ if (!prev) { copy[name] = val; }
32398
+ else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
32399
+ }
32400
+ delete keymap[keyname];
32401
+ } }
32402
+ for (var prop in copy) { keymap[prop] = copy[prop]; }
32403
+ return keymap
32404
+ }
32405
+
32406
+ function lookupKey(key, map, handle, context) {
32407
+ map = getKeyMap(map);
32408
+ var found = map.call ? map.call(key, context) : map[key];
32409
+ if (found === false) { return "nothing" }
32410
+ if (found === "...") { return "multi" }
32411
+ if (found != null && handle(found)) { return "handled" }
32412
+
32413
+ if (map.fallthrough) {
32414
+ if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
32415
+ { return lookupKey(key, map.fallthrough, handle, context) }
32416
+ for (var i = 0; i < map.fallthrough.length; i++) {
32417
+ var result = lookupKey(key, map.fallthrough[i], handle, context);
32418
+ if (result) { return result }
32419
+ }
32420
+ }
32421
+ }
32422
+
32423
+ // Modifier key presses don't count as 'real' key presses for the
32424
+ // purpose of keymap fallthrough.
32425
+ function isModifierKey(value) {
32426
+ var name = typeof value == "string" ? value : keyNames[value.keyCode];
32427
+ return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
32428
+ }
32429
+
32430
+ function addModifierNames(name, event, noShift) {
32431
+ var base = name;
32432
+ if (event.altKey && base != "Alt") { name = "Alt-" + name; }
32433
+ if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
32434
+ if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Mod") { name = "Cmd-" + name; }
32435
+ if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
32436
+ return name
32437
+ }
32438
+
32439
+ // Look up the name of a key as indicated by an event object.
32440
+ function keyName(event, noShift) {
32441
+ if (presto && event.keyCode == 34 && event["char"]) { return false }
32442
+ var name = keyNames[event.keyCode];
32443
+ if (name == null || event.altGraphKey) { return false }
32444
+ // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,
32445
+ // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)
32446
+ if (event.keyCode == 3 && event.code) { name = event.code; }
32447
+ return addModifierNames(name, event, noShift)
32448
+ }
32449
+
32450
+ function getKeyMap(val) {
32451
+ return typeof val == "string" ? keyMap[val] : val
32452
+ }
32453
+
32454
+ // Helper for deleting text near the selection(s), used to implement
32455
+ // backspace, delete, and similar functionality.
32456
+ function deleteNearSelection(cm, compute) {
32457
+ var ranges = cm.doc.sel.ranges, kill = [];
32458
+ // Build up a set of ranges to kill first, merging overlapping
32459
+ // ranges.
32460
+ for (var i = 0; i < ranges.length; i++) {
32461
+ var toKill = compute(ranges[i]);
32462
+ while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
32463
+ var replaced = kill.pop();
32464
+ if (cmp(replaced.from, toKill.from) < 0) {
32465
+ toKill.from = replaced.from;
32466
+ break
32467
+ }
32468
+ }
32469
+ kill.push(toKill);
32470
+ }
32471
+ // Next, remove those actual ranges.
32472
+ runInOp(cm, function () {
32473
+ for (var i = kill.length - 1; i >= 0; i--)
32474
+ { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
32475
+ ensureCursorVisible(cm);
32476
+ });
32477
+ }
32478
+
32479
+ function moveCharLogically(line, ch, dir) {
32480
+ var target = skipExtendingChars(line.text, ch + dir, dir);
32481
+ return target < 0 || target > line.text.length ? null : target
32482
+ }
32483
+
32484
+ function moveLogically(line, start, dir) {
32485
+ var ch = moveCharLogically(line, start.ch, dir);
32486
+ return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
32487
+ }
32488
+
32489
+ function endOfLine(visually, cm, lineObj, lineNo, dir) {
32490
+ if (visually) {
32491
+ if (cm.doc.direction == "rtl") { dir = -dir; }
32492
+ var order = getOrder(lineObj, cm.doc.direction);
32493
+ if (order) {
32494
+ var part = dir < 0 ? lst(order) : order[0];
32495
+ var moveInStorageOrder = (dir < 0) == (part.level == 1);
32496
+ var sticky = moveInStorageOrder ? "after" : "before";
32497
+ var ch;
32498
+ // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
32499
+ // it could be that the last bidi part is not on the last visual line,
32500
+ // since visual lines contain content order-consecutive chunks.
32501
+ // Thus, in rtl, we are looking for the first (content-order) character
32502
+ // in the rtl chunk that is on the last line (that is, the same line
32503
+ // as the last (content-order) character).
32504
+ if (part.level > 0 || cm.doc.direction == "rtl") {
32505
+ var prep = prepareMeasureForLine(cm, lineObj);
32506
+ ch = dir < 0 ? lineObj.text.length - 1 : 0;
32507
+ var targetTop = measureCharPrepared(cm, prep, ch).top;
32508
+ ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
32509
+ if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1); }
32510
+ } else { ch = dir < 0 ? part.to :