Debian Codegraph @

resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js

raw symbols SCIP
1 /*!
2 * MediaWiki Widgets – DateInputWidget class.
3 *
4 * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
5 * @license The MIT License (MIT); see LICENSE.txt
6 */
7 /* global moment */
8 ( function () {
9
10 /**
11 * @classdesc Date input widget.
12 *
13 * @example
14 * // Date input widget showcase
15 * let fieldset = new OO.ui.FieldsetLayout( {
16 * items: [
17 * new OO.ui.FieldLayout(
18 * new mw.widgets.DateInputWidget(),
19 * {
20 * align: 'top',
21 * label: 'Select date'
22 * }
23 * ),
24 * new OO.ui.FieldLayout(
25 * new mw.widgets.DateInputWidget( { precision: 'month' } ),
26 * {
27 * align: 'top',
28 * label: 'Select month'
29 * }
30 * ),
31 * new OO.ui.FieldLayout(
32 * new mw.widgets.DateInputWidget( {
33 * inputFormat: 'DD.MM.YYYY',
34 * displayFormat: 'Do [of] MMMM [anno Domini] YYYY'
35 * } ),
36 * {
37 * align: 'top',
38 * label: 'Select date (custom formats)'
39 * }
40 * )
41 * ]
42 * } );
43 * $( document.body ).append( fieldset.$element );
44 *
45 * // The value is stored in 'YYYY-MM-DD' or 'YYYY-MM' format
46 *
47 * @example
48 * // Accessing values in a date input widget
49 * let dateInput = new mw.widgets.DateInputWidget();
50 * let $label = $( '<p>' );
51 * $( document.body ).append( $label, dateInput.$element );
52 * dateInput.on( 'change', function () {
53 * // The value will always be a valid date or empty string, malformed input is ignored
54 * let date = dateInput.getValue();
55 * $label.text( 'Selected date: ' + ( date || '(none)' ) );
56 * } );
57 *
58 * @class
59 * @extends OO.ui.TextInputWidget
60 * @mixes OO.ui.mixin.IndicatorElement
61 *
62 * @constructor
63 * @description Create an mw.widgets.DateInputWidget object.
64 * @param {Object} [config] Configuration options
65 * @param {string} [config.precision='day'] Date precision to use, 'day' or 'month'
66 * @param {string} [config.value] Day or month date (depending on `precision`), in the format 'YYYY-MM-DD'
67 * or 'YYYY-MM'. If not given or empty string, no date is selected.
68 * @param {string} [config.inputFormat] Date format string to use for the textual input field. Displayed
69 * while the widget is active, and the user can type in a date in this format. Should be short
70 * and easy to type. When not given, defaults to 'YYYY-MM-DD' or 'YYYY-MM', depending on
71 * `precision`.
72 * @param {string} [config.displayFormat] Date format string to use for the clickable label. Displayed
73 * while the widget is inactive. Should be as unambiguous as possible (for example, prefer to
74 * spell out the month, rather than rely on the order), even if that makes it longer. When not
75 * given, the default is language-specific.
76 * @param {boolean} [config.longDisplayFormat=false] If a custom displayFormat is not specified, use
77 * unabbreviated day of the week and month names in the default language-specific displayFormat.
78 * @param {string} [config.placeholderLabel=No date selected] Placeholder text shown when the widget is not
79 * selected. Default text taken from message `mw-widgets-dateinput-no-date`.
80 * @param {string} [config.placeholderDateFormat] User-visible date format string displayed in the textual input
81 * field when it's empty. Should be the same as `inputFormat`, but translated to the user's
82 * language. When not given, defaults to a translated version of 'YYYY-MM-DD' or 'YYYY-MM',
83 * depending on `precision`.
84 * @param {boolean} [config.required=false] Mark the field as required. Implies `indicator: 'required'`.
85 * @param {string} [config.mustBeAfter] Validates the date to be after this. In the 'YYYY-MM-DD' format.
86 * @param {string} [config.mustBeBefore] Validates the date to be before this. In the 'YYYY-MM-DD' format.
87 * @param {jQuery} [config.$overlay] Render the calendar into a separate layer. This configuration is
88 * useful in cases where the expanded calendar is larger than its container. The specified
89 * overlay layer is usually on top of the container and has a larger area. By default, the
90 * calendar uses relative positioning.
91 * @param {Object} [config.calendar] Configuration options for the this input's
92 * {@link mw.widgets.CalendarWidget CalendarWidget}.
93 */
94 mw.widgets.DateInputWidget = function MWWDateInputWidget( config ) {
95 // Config initialization
96 config = Object.assign( {
97 precision: 'day',
98 longDisplayFormat: false,
99 required: false,
100 placeholderLabel: mw.msg( 'mw-widgets-dateinput-no-date' )
101 }, config );
102 if ( config.required ) {
103 if ( config.indicator === undefined ) {
104 config.indicator = 'required';
105 }
106 }
107
108 let placeholderDateFormat;
109 if ( config.placeholderDateFormat ) {
110 placeholderDateFormat = config.placeholderDateFormat;
111 } else if ( config.inputFormat ) {
112 // We have no way to display a translated placeholder for custom formats
113 placeholderDateFormat = '';
114 } else {
115 // The following messages are used here:
116 // * mw-widgets-dateinput-placeholder-day
117 // * mw-widgets-dateinput-placeholder-month
118 placeholderDateFormat = mw.msg( 'mw-widgets-dateinput-placeholder-' + config.precision );
119 }
120
121 // Properties (must be set before parent constructor, which calls #setValue)
122 this.$handle = $( '<div>' );
123 this.innerLabel = new OO.ui.LabelWidget();
124 this.textInput = new OO.ui.TextInputWidget( {
125 required: config.required,
126 placeholder: placeholderDateFormat,
127 validate: this.validateDate.bind( this )
128 } );
129 this.calendar = new mw.widgets.CalendarWidget( Object.assign( {
130 lazyInitOnToggle: true,
131 // Can't pass `$floatableContainer: this.$element` here, the latter is not set yet.
132 // Instead we call setFloatableContainer() below.
133 precision: config.precision
134 }, config.calendar ) );
135 this.inCalendar = 0;
136 this.inTextInput = 0;
137 this.closing = false;
138 this.inputFormat = config.inputFormat;
139 this.displayFormat = config.displayFormat;
140 this.longDisplayFormat = config.longDisplayFormat;
141 this.required = config.required;
142 this.placeholderLabel = config.placeholderLabel;
143 // Validate and set min and max dates as properties
144
145 if ( config.mustBeAfter !== undefined ) {
146 const mustBeAfter = moment( config.mustBeAfter, 'YYYY-MM-DD' );
147 if ( mustBeAfter.isValid() ) {
148 this.mustBeAfter = mustBeAfter;
149 }
150 }
151 if ( config.mustBeBefore !== undefined ) {
152 const mustBeBefore = moment( config.mustBeBefore, 'YYYY-MM-DD' );
153 if ( mustBeBefore.isValid() ) {
154 this.mustBeBefore = mustBeBefore;
155 }
156 }
157 // Parent constructor
158 mw.widgets.DateInputWidget.super.call( this, config );
159
160 // Mixin constructors
161 OO.ui.mixin.IndicatorElement.call( this, config );
162
163 // Events
164 this.calendar.connect( this, {
165 change: 'onCalendarChange'
166 } );
167 this.textInput.connect( this, {
168 enter: 'onEnter',
169 change: 'onTextInputChange'
170 } );
171 this.$element.on( {
172 focusout: this.onBlur.bind( this )
173 } );
174 this.calendar.$element.on( {
175 focusout: this.onBlur.bind( this ),
176 click: this.onCalendarClick.bind( this ),
177 keypress: this.onCalendarKeyPress.bind( this )
178 } );
179 this.$handle.on( {
180 click: this.onClick.bind( this ),
181 keypress: this.onKeyPress.bind( this ),
182 focus: this.onFocus.bind( this )
183 } );
184
185 // Initialization
186 // Move 'tabindex' from this.$input (which is invisible) to the visible handle
187 if ( !this.isDisabled() ) {
188 this.setTabIndexedElement( this.$handle );
189 }
190 this.$handle
191 .append( this.innerLabel.$element, this.$indicator )
192 .addClass( 'mw-widget-dateInputWidget-handle' );
193 this.calendar.$element
194 .addClass( 'mw-widget-dateInputWidget-calendar' );
195 this.$element
196 .addClass( 'mw-widget-dateInputWidget' )
197 .append( this.$handle, this.textInput.$element, this.calendar.$element );
198
199 const $overlay = config.$overlay === true ? OO.ui.getDefaultOverlay() : config.$overlay;
200
201 if ( $overlay ) {
202 this.calendar.setFloatableContainer( this.$element );
203 $overlay.append( this.calendar.$element );
204
205 // The text input and calendar are not in DOM order, so fix up focus transitions.
206 this.textInput.$input.on( 'keydown', ( e ) => {
207 if ( e.which === OO.ui.Keys.TAB ) {
208 if ( e.shiftKey ) {
209 // Tabbing backward from text input: normal browser behavior
210 } else {
211 // Tabbing forward from text input: just focus the calendar
212 this.calendar.$element.trigger( 'focus' );
213 return false;
214 }
215 }
216 } );
217 this.calendar.$element.on( 'keydown', ( e ) => {
218 if ( e.which === OO.ui.Keys.TAB ) {
219 if ( e.shiftKey ) {
220 // Tabbing backward from calendar: just focus the text input
221 this.textInput.$input.trigger( 'focus' );
222 return false;
223 } else {
224 // Tabbing forward from calendar: focus the text input, then allow normal browser
225 // behavior to move focus to next focusable after it
226 this.textInput.$input.trigger( 'focus' );
227 }
228 }
229 } );
230 }
231
232 // Set handle label and hide stuff
233 this.updateUI();
234 this.textInput.toggle( false );
235 this.calendar.toggle( false );
236
237 // Hide unused <input> from PHP after infusion is done
238 // See InputWidget#reusePreInfuseDOM about config.$input
239 if ( config.$input ) {
240 config.$input.addClass( 'oo-ui-element-hidden' );
241 }
242 };
243
244 /* Inheritance */
245
246 OO.inheritClass( mw.widgets.DateInputWidget, OO.ui.TextInputWidget );
247 OO.mixinClass( mw.widgets.DateInputWidget, OO.ui.mixin.IndicatorElement );
248
249 /* Events */
250
251 /**
252 * Fired when the widget is deactivated (when the calendar is closed). This can happen because
253 * the user selected a value, or because the user blurred the widget.
254 *
255 * @event mw.widgets.DateInputWidget.deactivate
256 * @param {boolean} userSelected Whether the deactivation happened because the user selected a value
257 */
258
259 /* Methods */
260
261 /**
262 * @inheritdoc
263 * @protected
264 */
265 mw.widgets.DateInputWidget.prototype.getInputElement = function () {
266 return $( '<input>' ).attr( 'type', 'hidden' );
267 };
268
269 /**
270 * Respond to calendar date change events.
271 *
272 * @private
273 */
274 mw.widgets.DateInputWidget.prototype.onCalendarChange = function () {
275 this.inCalendar++;
276 if ( !this.inTextInput ) {
277 // If this is caused by user typing in the input field, do not set anything.
278 // The value may be invalid (see #onTextInputChange), but displayable on the calendar.
279 this.setValue( this.calendar.getDate() );
280 }
281 this.inCalendar--;
282 };
283
284 /**
285 * Respond to text input value change events.
286 *
287 * @private
288 */
289 mw.widgets.DateInputWidget.prototype.onTextInputChange = function () {
290 const
291 widget = this,
292 value = this.textInput.getValue(),
293 mom = moment( value, this.getInputFormat() ),
294 valid = this.isValidDate( value );
295 this.inTextInput++;
296
297 if ( value === '' ) {
298 // No date selected
299 widget.setValue( '' );
300 } else if ( valid ) {
301 // Well-formed date value, parse and set it
302 // Use English locale to avoid number formatting
303 widget.setValue( mom.locale( 'en' ).format( widget.getInternalFormat() ) );
304 } else {
305 // Not well-formed, but possibly partial? Try updating the calendar, but do not set the
306 // internal value. Generally this only makes sense when 'inputFormat' is little-endian (e.g.
307 // 'YYYY-MM-DD'), but that's hard to check for, and might be difficult to handle the parsing
308 // right for weird formats. So limit this trick to only when we're using the default
309 // 'inputFormat', which is the same as the internal format, 'YYYY-MM-DD'.
310 if ( widget.getInputFormat() === widget.getInternalFormat() ) {
311 widget.calendar.setMoment( mom );
312 }
313 }
314 widget.inTextInput--;
315
316 };
317
318 /**
319 * @inheritdoc
320 */
321 mw.widgets.DateInputWidget.prototype.setValue = function ( value ) {
322 const oldValue = this.value;
323
324 if ( !moment( value, this.getInternalFormat() ).isValid() ) {
325 value = '';
326 }
327
328 mw.widgets.DateInputWidget.super.prototype.setValue.call( this, value );
329
330 if ( this.value !== oldValue ) {
331 this.updateUI();
332 this.setValidityFlag();
333 }
334
335 return this;
336 };
337
338 /**
339 * Handle text input and calendar blur events.
340 *
341 * @private
342 */
343 mw.widgets.DateInputWidget.prototype.onBlur = function () {
344 setTimeout( () => {
345 const $focussed = $( ':focus' );
346 // Deactivate unless the focus moved to something else inside this widget
347 if (
348 !OO.ui.contains( this.$element[ 0 ], $focussed[ 0 ], true ) &&
349 // Calendar might be in an $overlay
350 !OO.ui.contains( this.calendar.$element[ 0 ], $focussed[ 0 ], true )
351 ) {
352 this.deactivate();
353 }
354 }, 0 );
355 };
356
357 /**
358 * @inheritdoc
359 */
360 mw.widgets.DateInputWidget.prototype.focus = function () {
361 this.activate();
362 return this;
363 };
364
365 /**
366 * @inheritdoc
367 */
368 mw.widgets.DateInputWidget.prototype.blur = function () {
369 this.deactivate();
370 return this;
371 };
372
373 /**
374 * Update the contents of the label, text input and status of calendar to reflect selected value.
375 *
376 * @private
377 */
378 mw.widgets.DateInputWidget.prototype.updateUI = function () {
379 if ( this.getValue() === '' ) {
380 this.textInput.setValue( '' );
381 this.calendar.setDate( null );
382 this.innerLabel.setLabel( this.placeholderLabel );
383 this.$element.addClass( 'mw-widget-dateInputWidget-empty' );
384 } else {
385 const moment = this.getMoment();
386 if ( !this.inTextInput ) {
387 this.textInput.setValue( moment.format( this.getInputFormat() ) );
388 }
389 if ( !this.inCalendar ) {
390 this.calendar.setDate( this.getValue() );
391 }
392 this.innerLabel.setLabel( moment.format( this.getDisplayFormat() ) );
393 this.$element.removeClass( 'mw-widget-dateInputWidget-empty' );
394 }
395 };
396
397 /**
398 * Deactivate this input field for data entry. Closes the calendar and hides the text field.
399 *
400 * @private
401 * @param {boolean} [userSelected] Whether we are deactivating because the user selected a value
402 */
403 mw.widgets.DateInputWidget.prototype.deactivate = function ( userSelected ) {
404 this.$element.removeClass( 'mw-widget-dateInputWidget-active' );
405 this.$handle.show();
406 this.textInput.toggle( false );
407 this.calendar.toggle( false );
408 this.setValidityFlag();
409
410 if ( userSelected ) {
411 // Prevent focusing the handle from reopening the calendar
412 this.closing = true;
413 this.$handle.trigger( 'focus' );
414 this.closing = false;
415 }
416
417 this.emit( 'deactivate', !!userSelected );
418 };
419
420 /**
421 * Activate this input field for data entry. Opens the calendar and shows the text field.
422 *
423 * @private
424 */
425 mw.widgets.DateInputWidget.prototype.activate = function () {
426 this.calendar.resetUI();
427 this.$element.addClass( 'mw-widget-dateInputWidget-active' );
428 this.$handle.hide();
429 this.textInput.toggle( true );
430 this.calendar.toggle( true );
431
432 this.textInput.$input.trigger( 'focus' );
433 };
434
435 /**
436 * Get the date format to be used for handle label when the input is inactive.
437 *
438 * @private
439 * @return {string} Format string
440 */
441 mw.widgets.DateInputWidget.prototype.getDisplayFormat = function () {
442 if ( this.displayFormat !== undefined ) {
443 return this.displayFormat;
444 }
445
446 if ( this.calendar.getPrecision() === 'month' ) {
447 return 'MMMM YYYY';
448 } else {
449 // The formats Moment.js provides:
450 // * ll: Month name, day of month, year
451 // * lll: Month name, day of month, year, time
452 // * llll: Month name, day of month, day of week, year, time
453 //
454 // The format we want:
455 // * ????: Month name, day of month, day of week, year
456 //
457 // We try to construct it as 'llll - (lll - ll)' and hope for the best.
458 // This seems to work well for many languages (maybe even all?).
459
460 const localeData = moment.localeData( moment.locale() );
461 const llll = localeData.longDateFormat( 'llll' );
462 const lll = localeData.longDateFormat( 'lll' );
463 const ll = localeData.longDateFormat( 'll' );
464 let format = llll.replace( lll.replace( ll, '' ), '' );
465
466 if ( this.longDisplayFormat ) {
467 // Replace MMM to MMMM and ddd to dddd but don't change MMMM and dddd
468 format = format.replace( /MMMM?/, 'MMMM' ).replace( /dddd?/, 'dddd' );
469 }
470
471 return format;
472 }
473 };
474
475 /**
476 * Get the date format to be used for the text field when the input is active.
477 *
478 * @private
479 * @return {string} Format string
480 */
481 mw.widgets.DateInputWidget.prototype.getInputFormat = function () {
482 if ( this.inputFormat !== undefined ) {
483 return this.inputFormat;
484 }
485
486 return {
487 day: 'YYYY-MM-DD',
488 month: 'YYYY-MM'
489 }[ this.calendar.getPrecision() ];
490 };
491
492 /**
493 * Get the date format to be used internally for the value. This is not configurable in any way,
494 * and always either 'YYYY-MM-DD' or 'YYYY-MM'.
495 *
496 * @private
497 * @return {string} Format string
498 */
499 mw.widgets.DateInputWidget.prototype.getInternalFormat = function () {
500 return {
501 day: 'YYYY-MM-DD',
502 month: 'YYYY-MM'
503 }[ this.calendar.getPrecision() ];
504 };
505
506 /**
507 * Get the Moment object for current value.
508 *
509 * @return {Object} Moment object
510 */
511 mw.widgets.DateInputWidget.prototype.getMoment = function () {
512 return moment( this.getValue(), this.getInternalFormat() );
513 };
514
515 /**
516 * Handle mouse click events.
517 *
518 * @private
519 * @param {jQuery.Event} e Mouse click event
520 * @return {boolean} False to cancel the default event
521 */
522 mw.widgets.DateInputWidget.prototype.onClick = function ( e ) {
523 if ( !this.isDisabled() && !this.isReadOnly() && e.which === 1 ) {
524 this.activate();
525 }
526 return false;
527 };
528
529 /**
530 * Handle key press events.
531 *
532 * @private
533 * @param {jQuery.Event} e Key press event
534 * @return {boolean|undefined} False to cancel the default event
535 */
536 mw.widgets.DateInputWidget.prototype.onKeyPress = function ( e ) {
537 if ( !this.isDisabled() && !this.isReadOnly() &&
538 ( e.which === OO.ui.Keys.SPACE || e.which === OO.ui.Keys.ENTER )
539 ) {
540 this.activate();
541 return false;
542 }
543 };
544
545 /**
546 * Handle focus events.
547 *
548 * @private
549 */
550 mw.widgets.DateInputWidget.prototype.onFocus = function () {
551 if ( !this.isDisabled() && !this.isReadOnly() && !this.closing ) {
552 this.activate();
553 }
554 };
555
556 /**
557 * Handle calendar key press events.
558 *
559 * @private
560 * @param {jQuery.Event} e Key press event
561 * @return {boolean|undefined} False to cancel the default event
562 */
563 mw.widgets.DateInputWidget.prototype.onCalendarKeyPress = function ( e ) {
564 if ( !this.isDisabled() && e.which === OO.ui.Keys.ENTER ) {
565 this.deactivate( true );
566 return false;
567 }
568 };
569
570 /**
571 * Handle calendar click events.
572 *
573 * @private
574 * @param {jQuery.Event} e Mouse click event
575 * @return {boolean|undefined} False to cancel the default event
576 */
577 mw.widgets.DateInputWidget.prototype.onCalendarClick = function ( e ) {
578 const targetClass = this.calendar.getPrecision() === 'month' ?
579 'mw-widget-calendarWidget-month' :
580 'mw-widget-calendarWidget-day';
581 if (
582 !this.isDisabled() &&
583 e.which === 1 &&
584 // eslint-disable-next-line no-jquery/no-class-state
585 $( e.target ).hasClass( targetClass )
586 ) {
587 this.deactivate( true );
588 return false;
589 }
590 };
591
592 /**
593 * Handle text input enter events.
594 *
595 * @private
596 */
597 mw.widgets.DateInputWidget.prototype.onEnter = function () {
598 this.deactivate( true );
599 };
600
601 /**
602 * @private
603 * @param {string} date Date string, to be valid, must be in 'YYYY-MM-DD' or 'YYYY-MM' format or
604 * (unless the field is required) empty
605 * @return {boolean}
606 */
607 mw.widgets.DateInputWidget.prototype.validateDate = function ( date ) {
608 let isValid;
609 if ( date === '' ) {
610 isValid = !this.required;
611 } else {
612 isValid = this.isValidDate( date ) && this.isInRange( date );
613 }
614 return isValid;
615 };
616
617 /**
618 * @private
619 * @param {string} date Date string, to be valid, must be in 'YYYY-MM-DD' or 'YYYY-MM' format
620 * @return {boolean}
621 */
622 mw.widgets.DateInputWidget.prototype.isValidDate = function ( date ) {
623 // "Half-strict mode": for example, for the format 'YYYY-MM-DD', 2015-1-3 instead of 2015-01-03
624 // is okay, but 2015-01 isn't, and neither is 2015-01-foo. Use Moment's "fuzzy" mode and check
625 // parsing flags for the details (stolen from implementation of moment#isValid).
626 const
627 mom = moment( date, this.getInputFormat() ),
628 flags = mom.parsingFlags();
629
630 return mom.isValid() && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0;
631 };
632
633 /**
634 * Validates if the date is within the range configured with {@link #cfg-mustBeAfter}
635 * and {@link #cfg-mustBeBefore}.
636 *
637 * @private
638 * @param {string} date Date string, to be valid, must be empty (no date selected) or in
639 * 'YYYY-MM-DD' or 'YYYY-MM' format to be valid
640 * @return {boolean}
641 */
642 mw.widgets.DateInputWidget.prototype.isInRange = function ( date ) {
643 if ( this.mustBeAfter === undefined && this.mustBeBefore === undefined ) {
644 return true;
645 }
646 const momentDate = moment( date, 'YYYY-MM-DD' );
647 const isAfter = ( this.mustBeAfter === undefined || momentDate.isAfter( this.mustBeAfter ) );
648 const isBefore = ( this.mustBeBefore === undefined || momentDate.isBefore( this.mustBeBefore ) );
649 return isAfter && isBefore;
650 };
651
652 /**
653 * Get the validity of current value.
654 *
655 * This method returns a promise that resolves if the value is valid and rejects if
656 * it isn't. Uses {@link #validateDate}.
657 *
658 * @return {jQuery.Promise} A promise that resolves if the value is valid, rejects if not.
659 */
660 mw.widgets.DateInputWidget.prototype.getValidity = function () {
661 const isValid = this.validateDate( this.getValue() );
662
663 if ( isValid ) {
664 return $.Deferred().resolve().promise();
665 } else {
666 return $.Deferred().reject().promise();
667 }
668 };
669
670 /**
671 * Sets the 'invalid' flag appropriately.
672 *
673 * @param {boolean} [isValid] Optionally override validation result
674 */
675 mw.widgets.DateInputWidget.prototype.setValidityFlag = function ( isValid ) {
676 const widget = this,
677 setFlag = function ( valid ) {
678 if ( !valid ) {
679 widget.$input.attr( 'aria-invalid', 'true' );
680 } else {
681 widget.$input.removeAttr( 'aria-invalid' );
682 }
683 widget.setFlags( { invalid: !valid } );
684 };
685
686 if ( isValid !== undefined ) {
687 setFlag( isValid );
688 } else {
689 this.getValidity().then( () => {
690 setFlag( true );
691 }, () => {
692 setFlag( false );
693 } );
694 }
695 };
696
697 }() );