+ * Truncate the input string and removes all HTML tags
+ * @param {String} str The input string.
+ * @param {Number} limit The number of characters to limit the string.
+ * @param {String} append The string to append if charaters are omitted.
+ * @return {String} The truncated string.
+ */
+ Handlebars.registerHelper('ellipsis', function (str, limit, append) {
+ if (append === undefined) {
+ append = '';
+ }
+ var sanitized = str.replace(/(<([^>]+)>)/g, '');
+ if (sanitized.length > limit) {
+ return sanitized.substr(0, limit - append.length) + append;
+ } else {
+ return sanitized;
+ }
+ });
+
+ Handlebars.registerHelper('getNumber', function (string) {
+ return parseInt(string, 10);
+ });
});
diff --git a/assets/js/mailpoet.js b/assets/js/mailpoet.js
new file mode 100644
index 0000000000..5b88379272
--- /dev/null
+++ b/assets/js/mailpoet.js
@@ -0,0 +1,9 @@
+define('mailpoet', [], function() {
+ // A placeholder for MailPoet object
+ var MailPoet = {};
+
+ // Expose MailPoet globally
+ window.MailPoet = MailPoet;
+
+ return MailPoet;
+});
diff --git a/assets/js/modal.js b/assets/js/modal.js
index e6c1de8ffb..3aa7f94a6e 100644
--- a/assets/js/modal.js
+++ b/assets/js/modal.js
@@ -1,639 +1,639 @@
-/*==================================================================================================
+define('modal', ['./mailpoet', 'jquery'], function(MailPoet, jQuery) {
+ "use strict";
+ /*==================================================================================================
- MailPoet Modal:
+ MailPoet Modal:
- version: 0.8
- author: Jonathan Labreuille
- company: Wysija
- dependencies: jQuery
+ version: 0.8
+ author: Jonathan Labreuille
+ company: Wysija
+ dependencies: jQuery
- Options:
+ Options:
- Mandatory:
- // Modal window's title
- (string) title: 'Modal title'
+ Mandatory:
+ // Modal window's title
+ (string) title: 'Modal title'
- // template
- (string) template: jQuery('#handlebars_template').html() or
- literal html
+ // template
+ (string) template: jQuery('#handlebars_template').html() or
+ literal html
- Optional:
- // jQuery cached element object node to be displayed,
- // instead of creating a new one
- (object) element: jQuery(selector)
+ Optional:
+ // jQuery cached element object node to be displayed,
+ // instead of creating a new one
+ (object) element: jQuery(selector)
- // - data object that will be passed to the template when rendering
- (object) data: {},
+ // - data object that will be passed to the template when rendering
+ (object) data: {},
- // - data will be loaded via this url and passed to the template
- // when rendering
- // - if a "data" option was specified, it will be merged with the
- // ajax's response data
- (string) url: '/url.json'
+ // - data will be loaded via this url and passed to the template
+ // when rendering
+ // - if a "data" option was specified, it will be merged with the
+ // ajax's response data
+ (string) url: '/url.json'
- // ajax method
- (string) method: 'post' (default: 'get')
+ // ajax method
+ (string) method: 'post' (default: 'get')
- // ajax post params
- (object) params: {}
-
- // - integers are expressed in pixels
- (mixed) width: '50%' | 100 | '100px'
-
- // - integers are expressed in pixels
- // - will be ignored when in "panel" mode
- (mixed) height: '50%' | 100 | '100px'
-
- // - only used for "panel" mode
- // - will be ignored in "popup" mode
- (string) position: 'left' | 'right'
-
- // display overlay or not
- (boolean) overlay: true | false
-
- // element(s) to be highlighted when the overlay is "on"
- (object) highlight: jQuery element
-
- // callbacks
- (function) onInit: called when the modal is displayed
- (function) onSuccess: called by calling MailPoet_Guide.success()
- (function) onCancel: called when closing the popup
- or by calling MailPoet_Guide.cancel()
-
- Usage:
-
- // popup mode
- MailPoet.Modal.popup(options);
-
- // panel mode
- MailPoet.Modal.panel(options);
-
- // loading states
- MailPoet.Modal.loading(true); // displays loading indicator
- MailPoet.Modal.loading(false); // hides loading indicator
-
-==================================================================================================*/
-(function() {
- "use strict";
-
- MailPoet.Modal = {
- version: 0.8,
-
- // flags
- initialized: false,
- opened: false,
- locked: false,
-
- // sub panels
- subpanels: [],
-
- // default values
- defaults: {
- // title
- title: null,
-
- // type
- type: null,
-
- // positionning
- position: 'right',
-
- // data sources
- data: {},
- url: null,
- method: 'get',
- params: {},
-
- // template
- template: null,
- body_template: null,
-
- // dimensions
- width: 'auto',
- height: 'auto',
-
- // display overlay
- overlay: false,
-
- // highlighted elements
- highlight: null,
-
- // callbacks
- onInit: null,
- onSuccess: null,
- onCancel: null
- },
- renderer: 'html',
- options: {},
- templates: {
- overlay: '',
- popup: '',
- loading: '',
- panel: '',
- subpanel: ''
- },
- setRenderer: function() {
- this.renderer = (typeof(Handlebars) === "undefined") ? 'html' : 'handlebars';
- },
- compileTemplate: function(template) {
- if(this.renderer === 'html') {
- return function() { return template; };
- } else {
- return Handlebars.compile(template);
- }
- },
- init: function(options) {
- if(this.initialized === true) {
- this.close();
- }
-
- // merge options
- this.options = jQuery.extend({}, this.defaults, options);
-
- // set renderer
- this.setRenderer();
-
- // init overlay
- this.initOverlay();
-
- // toggle overlay
- this.toggleOverlay(this.options.overlay);
-
- if(this.options.type !== null) {
- // insert modal depending on its type
- if(this.options.type === 'popup') {
- var modal = this.compileTemplate(this.templates[this.options.type]);
- // create modal
- jQuery('#mailpoet_modal_overlay').append(modal(this.options));
- // set title
- jQuery('#mailpoet_popup_title h2').html(this.options.title);
- } else if(this.options.type === 'panel') {
- // create panel
- jQuery('#mailpoet_modal_overlay').after(this.templates[this.options.type]);
- }
-
- // add proper overlay class
- jQuery('#mailpoet_modal_overlay')
- .removeClass('mailpoet_popup_overlay mailpoet_panel_overlay')
- .addClass('mailpoet_'+this.options.type+'_overlay');
- }
-
- // render template if specified
- if(this.options.template !== null) {
- // set "success" callback if specified
- if(options.onSuccess !== undefined) {
- this.options.onSuccess = options.onSuccess;
- }
-
- // set "cancel" callback if specified
- if(options.onCancel !== undefined) {
- this.options.onCancel = options.onCancel;
- }
-
- // compile template
- this.options.body_template = this.compileTemplate(this.options.template);
-
- // setup events
- this.setupEvents();
- }
-
- // set popup as initialized
- this.initialized = true;
-
- return this;
- },
- initOverlay: function(toggle) {
- if(jQuery('#mailpoet_modal_overlay').length === 0) {
- // insert overlay into the DOM
- jQuery('body').append(this.templates.overlay);
- // insert loading indicator into overlay
- jQuery('#mailpoet_modal_overlay').append(this.templates.loading);
- }
- return this;
- },
- toggleOverlay: function(toggle) {
- if(toggle === true) {
- jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_hidden');
- } else {
- jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_hidden');
- }
-
- return this;
- },
- setupEvents: function() {
- // close popup when user clicks on close button
- jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this));
-
- // close popup when user clicks on overlay
- jQuery('#mailpoet_modal_overlay').on('click', function(e) {
- // we need to make sure that we are actually clicking on the overlay
- // because when clicking on the popup content, it will trigger the click
- // event on the overlay
- if(e.target.id === 'mailpoet_modal_overlay') { this.cancel(); }
- }.bind(this));
-
- // close popup when user presses ESC key
- jQuery(document).on('keyup.mailpoet_modal', function(e) {
- if(this.opened === false) { return false; }
- if(e.keyCode === 27) { this.cancel(); }
- }.bind(this));
-
- // make sure the popup is repositioned when the window is resized
- jQuery(window).on('resize.mailpoet_modal', function() {
- this.setPosition();
- }.bind(this));
-
- return this;
- },
- removeEvents: function() {
- jQuery(document).unbind('keyup.mailpoet_modal');
- jQuery(window).unbind('resize.mailpoet_modal');
- jQuery('#mailpoet_modal_close').off('click');
- if(this.options.overlay === true) {
- jQuery('#mailpoet_modal_overlay').off('click');
- }
-
- return this;
- },
- lock: function() {
- this.locked = true;
-
- return this;
- },
- unlock: function() {
- this.locked = false;
-
- return this;
- },
- isLocked: function() {
- return this.locked;
- },
- loadTemplate: function() {
- if(this.subpanels.length > 0) {
- // hide panel
- jQuery('.mailpoet_'+this.options.type+'_wrapper').hide();
-
- // add sub panel wrapper
- jQuery('#mailpoet_'+this.options.type).append(this.templates['subpanel']);
-
- // add sub panel content
- jQuery('.mailpoet_'+this.options.type+'_body').last().html(this.subpanels[(this.subpanels.length - 1)].element);
- } else if (this.options.element) {
- jQuery('.mailpoet_'+this.options.type+'_body').empty();
- jQuery('.mailpoet_'+this.options.type+'_body').append(this.options.element);
- } else {
- jQuery('.mailpoet_'+this.options.type+'_body').html(
- this.options.body_template(
- this.options.data
- )
- );
- }
-
- return this;
- },
- loadUrl: function() {
- if(this.options.method === 'get') {
- // make ajax request
- jQuery.getJSON(this.options.url, function(data) {
- // merge returned data with existing data passed when calling the "open" method
- this.options.data = jQuery.extend({}, this.options.data, data);
- // load template using fetched data
- this.loadTemplate();
- // show modal window
- this.showModal();
- }.bind(this));
- } else if(this.options.method === 'post') {
- // make ajax request
- jQuery.post(this.options.url, JSON.stringify(this.options.params), function(data) {
- // merge returned data with existing data passed when calling the "open" method
- this.options.data = jQuery.extend({}, this.options.data, data);
- // load template using fetched data
- this.loadTemplate();
- // show modal window
- this.showModal();
- }.bind(this), 'json');
- }
-
- return this;
- },
- setDimensions: function() {
- switch(this.options.type) {
- case 'popup':
- // set popup dimensions
- jQuery('#mailpoet_popup').css({
- width: this.options.width,
- minHeight: this.options.height
- });
- // set popup wrapper height
- jQuery('#mailpoet_popup_wrapper').css({ height: this.options.height});
- break;
- case 'panel':
- // set dimensions
- if(this.options.position === 'right') {
- jQuery('#mailpoet_panel').css({
- width: this.options.width,
- right: 0,
- marginRight: '-' + this.options.width,
- left: 'auto'
- });
- } else if(this.options.position === 'left') {
- jQuery('#mailpoet_panel').css({
- width: this.options.width,
- left: 0,
- marginLeft: '-' + this.options.width,
- right: 'auto'
- });
- }
- jQuery('#mailpoet_panel').css({ minHeight: 'auto' });
- break;
- }
-
- return this;
- },
- setPosition: function() {
- switch(this.options.type) {
- case 'popup':
- var screenWidth = jQuery(window).width(),
- screenHeight = jQuery(window).height(),
- modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(),
- modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height();
-
- var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))),
- left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2)));
-
- // set position of popup depending on screen dimensions.
- jQuery('#mailpoet_popup').css({
- top: top,
- left: left
- });
- break;
- case 'panel':
- setTimeout(function() {
- // set position of popup depending on screen dimensions.
- if(this.options.position === 'right') {
- jQuery('#mailpoet_panel').css(
- { marginRight: 0 }
- );
- } else if(this.options.position === 'left') {
- jQuery('#mailpoet_panel').css(
- { marginLeft: 0 }
- );
- }
- }.bind(this), 0);
- break;
- }
-
- return this;
- },
- showModal: function() {
- // set modal dimensions
- this.setDimensions();
-
- // add a flag on the body so that we can prevent scrolling (setting overflow hidden)
- jQuery('body').addClass('mailpoet_modal_opened');
-
- // show popup
- jQuery('#mailpoet_'+this.options.type).show();
-
- // display overlay
- this.showOverlay();
-
- // set modal position
- this.setPosition();
-
- // add class on highlighted elements
- if(this.options.highlight !== null) {
- if(this.options.highlight.length > 0) {
- this.highlightOn(this.options.highlight);
- }
- }
-
- // set popup as opened
- this.opened = true;
-
- // trigger init event if specified
- if(this.options.onInit !== null) {
- this.options.onInit();
- }
-
- return this;
- },
- highlightOn: function(element) {
- jQuery(element).addClass('mailpoet_modal_highlight');
- return this;
- },
- highlightOff: function() {
- jQuery('.mailpoet_modal_highlight').removeClass('mailpoet_modal_highlight');
- return this;
- },
- hideModal: function(callback) {
- // set modal as closed
- this.opened = false;
-
- // hide modal
- jQuery('#mailpoet_'+this.options.type).hide();
-
- // remove class on highlighted elements
- this.highlightOff();
-
- // remove class from body to let it be scrollable
- jQuery('body').removeClass('mailpoet_modal_opened');
-
- return this;
- },
- showOverlay: function(force) {
- jQuery('#mailpoet_modal_overlay').show();
- return this;
- },
- hideOverlay: function() {
- jQuery('#mailpoet_modal_overlay').hide();
- return this;
- },
- popup: function(options) {
- // get options
- options = options || {};
- // set modal type
- options.type = 'popup';
- // set overlay state
- options.overlay = options.overlay || true;
- // initialize modal
- this.init(options);
- // open modal
- this.open();
-
- return this;
- },
- panel: function(options) {
- // get options
- options = options || {};
- // reset subpanels
- this.subpanels = [];
- // set modal type
- options.type = 'panel';
- // set overlay state
- options.overlay = options.overlay || false;
- // set highlighted element
- options.highlight = options.highlight || null;
- // set modal dimensions
- options.width = options.width || '40%';
- options.height = options.height || 'auto';
- // initialize modal
- this.init(options);
- // open modal
- this.open();
-
- return this;
- },
- subpanel: function(options) {
- if(this.opened === false) {
- // if no panel is already opened, let's create one instead
- this.panel(options);
- } else {
- // if a panel is already opened, add a sub panel to it
- this.subpanels.push(options);
- this.loadTemplate();
- }
-
- return this;
- },
- loading: function(toggle) {
- // make sure the overlay is initialized and that it's visible
- this.initOverlay(true);
-
- if(toggle === true) {
- this.showLoading();
- } else {
- this.hideLoading();
- }
-
- return this;
- },
- showLoading: function() {
- jQuery('#mailpoet_loading').show();
-
- // add loading class to overlay
- jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_loading');
-
- return this;
- },
- hideLoading: function() {
- jQuery('#mailpoet_loading').hide();
-
- // remove loading class from overlay
- jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_loading');
-
- return this;
- },
- open: function() {
- // load template if specified
- if(this.options.template !== null) {
- // check if a url was specified to get extra data
- if(this.options.url !== null) {
- this.loadUrl();
- } else {
- // load template
- this.loadTemplate();
-
- // show modal window
- this.showModal();
- }
- } else {
- this.cancel();
- }
-
- return this;
- },
- success: function() {
- if(this.subpanels.length > 0) {
- if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) {
- this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data);
- }
- } else {
- if(this.options.onSuccess !== null) {
- this.options.onSuccess(this.options.data);
- }
- }
- this.close();
-
- return this;
- },
- cancel: function() {
- if(this.subpanels.length > 0) {
- if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) {
- this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data);
- }
- } else {
- if(this.options.onCancel !== null) {
- this.options.onCancel(this.options.data);
- }
- }
- this.close();
-
- return this;
- },
- destroy: function() {
- this.hideOverlay();
-
- // remove extra modal
- if(jQuery('#mailpoet_'+this.options.type).length > 0) {
- jQuery('#mailpoet_'+this.options.type).remove();
- }
-
- this.initialized = false;
-
- return this;
- },
- close: function() {
- if(this.isLocked() === true) return this;
-
- if(this.subpanels.length > 0) {
-
- // close subpanel
- jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove();
-
- // show previous panel
- jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show();
-
- // remove last subpanels
- this.subpanels.pop();
-
- return this;
- }
-
- // remove event handlers
- this.removeEvents();
-
- // hide modal window
- this.hideModal();
-
- // destroy modal element
- this.destroy();
-
- // reset options
- this.options = {
- onSuccess: null,
- onCancel: null
- };
-
- return this;
- }
- };
-})(window.MailPoet = window.MailPoet || {}, jQuery);
+ // ajax post params
+ (object) params: {}
+
+ // - integers are expressed in pixels
+ (mixed) width: '50%' | 100 | '100px'
+
+ // - integers are expressed in pixels
+ // - will be ignored when in "panel" mode
+ (mixed) height: '50%' | 100 | '100px'
+
+ // - only used for "panel" mode
+ // - will be ignored in "popup" mode
+ (string) position: 'left' | 'right'
+
+ // display overlay or not
+ (boolean) overlay: true | false
+
+ // element(s) to be highlighted when the overlay is "on"
+ (object) highlight: jQuery element
+
+ // callbacks
+ (function) onInit: called when the modal is displayed
+ (function) onSuccess: called by calling MailPoet_Guide.success()
+ (function) onCancel: called when closing the popup
+ or by calling MailPoet_Guide.cancel()
+
+ Usage:
+
+ // popup mode
+ MailPoet.Modal.popup(options);
+
+ // panel mode
+ MailPoet.Modal.panel(options);
+
+ // loading states
+ MailPoet.Modal.loading(true); // displays loading indicator
+ MailPoet.Modal.loading(false); // hides loading indicator
+
+ ==================================================================================================*/
+
+ MailPoet.Modal = {
+ version: 0.8,
+
+ // flags
+ initialized: false,
+ opened: false,
+ locked: false,
+
+ // sub panels
+ subpanels: [],
+
+ // default values
+ defaults: {
+ // title
+ title: null,
+
+ // type
+ type: null,
+
+ // positionning
+ position: 'right',
+
+ // data sources
+ data: {},
+ url: null,
+ method: 'get',
+ params: {},
+
+ // template
+ template: null,
+ body_template: null,
+
+ // dimensions
+ width: 'auto',
+ height: 'auto',
+
+ // display overlay
+ overlay: false,
+
+ // highlighted elements
+ highlight: null,
+
+ // callbacks
+ onInit: null,
+ onSuccess: null,
+ onCancel: null
+ },
+ renderer: 'html',
+ options: {},
+ templates: {
+ overlay: '',
+ popup: '',
+ loading: '',
+ panel: '',
+ subpanel: ''
+ },
+ setRenderer: function() {
+ this.renderer = (typeof(Handlebars) === "undefined") ? 'html' : 'handlebars';
+ },
+ compileTemplate: function(template) {
+ if(this.renderer === 'html') {
+ return function() { return template; };
+ } else {
+ return Handlebars.compile(template);
+ }
+ },
+ init: function(options) {
+ if(this.initialized === true) {
+ this.close();
+ }
+
+ // merge options
+ this.options = jQuery.extend({}, this.defaults, options);
+
+ // set renderer
+ this.setRenderer();
+
+ // init overlay
+ this.initOverlay();
+
+ // toggle overlay
+ this.toggleOverlay(this.options.overlay);
+
+ if(this.options.type !== null) {
+ // insert modal depending on its type
+ if(this.options.type === 'popup') {
+ var modal = this.compileTemplate(this.templates[this.options.type]);
+ // create modal
+ jQuery('#mailpoet_modal_overlay').append(modal(this.options));
+ // set title
+ jQuery('#mailpoet_popup_title h2').html(this.options.title);
+ } else if(this.options.type === 'panel') {
+ // create panel
+ jQuery('#mailpoet_modal_overlay').after(this.templates[this.options.type]);
+ }
+
+ // add proper overlay class
+ jQuery('#mailpoet_modal_overlay')
+ .removeClass('mailpoet_popup_overlay mailpoet_panel_overlay')
+ .addClass('mailpoet_'+this.options.type+'_overlay');
+ }
+
+ // render template if specified
+ if(this.options.template !== null) {
+ // set "success" callback if specified
+ if(options.onSuccess !== undefined) {
+ this.options.onSuccess = options.onSuccess;
+ }
+
+ // set "cancel" callback if specified
+ if(options.onCancel !== undefined) {
+ this.options.onCancel = options.onCancel;
+ }
+
+ // compile template
+ this.options.body_template = this.compileTemplate(this.options.template);
+
+ // setup events
+ this.setupEvents();
+ }
+
+ // set popup as initialized
+ this.initialized = true;
+
+ return this;
+ },
+ initOverlay: function(toggle) {
+ if(jQuery('#mailpoet_modal_overlay').length === 0) {
+ // insert overlay into the DOM
+ jQuery('body').append(this.templates.overlay);
+ // insert loading indicator into overlay
+ jQuery('#mailpoet_modal_overlay').append(this.templates.loading);
+ }
+ return this;
+ },
+ toggleOverlay: function(toggle) {
+ if(toggle === true) {
+ jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_hidden');
+ } else {
+ jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_hidden');
+ }
+
+ return this;
+ },
+ setupEvents: function() {
+ // close popup when user clicks on close button
+ jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this));
+
+ // close popup when user clicks on overlay
+ jQuery('#mailpoet_modal_overlay').on('click', function(e) {
+ // we need to make sure that we are actually clicking on the overlay
+ // because when clicking on the popup content, it will trigger the click
+ // event on the overlay
+ if(e.target.id === 'mailpoet_modal_overlay') { this.cancel(); }
+ }.bind(this));
+
+ // close popup when user presses ESC key
+ jQuery(document).on('keyup.mailpoet_modal', function(e) {
+ if(this.opened === false) { return false; }
+ if(e.keyCode === 27) { this.cancel(); }
+ }.bind(this));
+
+ // make sure the popup is repositioned when the window is resized
+ jQuery(window).on('resize.mailpoet_modal', function() {
+ this.setPosition();
+ }.bind(this));
+
+ return this;
+ },
+ removeEvents: function() {
+ jQuery(document).unbind('keyup.mailpoet_modal');
+ jQuery(window).unbind('resize.mailpoet_modal');
+ jQuery('#mailpoet_modal_close').off('click');
+ if(this.options.overlay === true) {
+ jQuery('#mailpoet_modal_overlay').off('click');
+ }
+
+ return this;
+ },
+ lock: function() {
+ this.locked = true;
+
+ return this;
+ },
+ unlock: function() {
+ this.locked = false;
+
+ return this;
+ },
+ isLocked: function() {
+ return this.locked;
+ },
+ loadTemplate: function() {
+ if(this.subpanels.length > 0) {
+ // hide panel
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').hide();
+
+ // add sub panel wrapper
+ jQuery('#mailpoet_'+this.options.type).append(this.templates['subpanel']);
+
+ // add sub panel content
+ jQuery('.mailpoet_'+this.options.type+'_body').last().html(this.subpanels[(this.subpanels.length - 1)].element);
+ } else if (this.options.element) {
+ jQuery('.mailpoet_'+this.options.type+'_body').empty();
+ jQuery('.mailpoet_'+this.options.type+'_body').append(this.options.element);
+ } else {
+ jQuery('.mailpoet_'+this.options.type+'_body').html(
+ this.options.body_template(
+ this.options.data
+ )
+ );
+ }
+
+ return this;
+ },
+ loadUrl: function() {
+ if(this.options.method === 'get') {
+ // make ajax request
+ jQuery.getJSON(this.options.url, function(data) {
+ // merge returned data with existing data passed when calling the "open" method
+ this.options.data = jQuery.extend({}, this.options.data, data);
+ // load template using fetched data
+ this.loadTemplate();
+ // show modal window
+ this.showModal();
+ }.bind(this));
+ } else if(this.options.method === 'post') {
+ // make ajax request
+ jQuery.post(this.options.url, JSON.stringify(this.options.params), function(data) {
+ // merge returned data with existing data passed when calling the "open" method
+ this.options.data = jQuery.extend({}, this.options.data, data);
+ // load template using fetched data
+ this.loadTemplate();
+ // show modal window
+ this.showModal();
+ }.bind(this), 'json');
+ }
+
+ return this;
+ },
+ setDimensions: function() {
+ switch(this.options.type) {
+ case 'popup':
+ // set popup dimensions
+ jQuery('#mailpoet_popup').css({
+ width: this.options.width,
+ minHeight: this.options.height
+ });
+ // set popup wrapper height
+ jQuery('#mailpoet_popup_wrapper').css({ height: this.options.height});
+ break;
+ case 'panel':
+ // set dimensions
+ if(this.options.position === 'right') {
+ jQuery('#mailpoet_panel').css({
+ width: this.options.width,
+ right: 0,
+ marginRight: '-' + this.options.width,
+ left: 'auto'
+ });
+ } else if(this.options.position === 'left') {
+ jQuery('#mailpoet_panel').css({
+ width: this.options.width,
+ left: 0,
+ marginLeft: '-' + this.options.width,
+ right: 'auto'
+ });
+ }
+ jQuery('#mailpoet_panel').css({ minHeight: 'auto' });
+ break;
+ }
+
+ return this;
+ },
+ setPosition: function() {
+ switch(this.options.type) {
+ case 'popup':
+ var screenWidth = jQuery(window).width(),
+ screenHeight = jQuery(window).height(),
+ modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(),
+ modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height();
+
+ var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))),
+ left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2)));
+
+ // set position of popup depending on screen dimensions.
+ jQuery('#mailpoet_popup').css({
+ top: top,
+ left: left
+ });
+ break;
+ case 'panel':
+ setTimeout(function() {
+ // set position of popup depending on screen dimensions.
+ if(this.options.position === 'right') {
+ jQuery('#mailpoet_panel').css(
+ { marginRight: 0 }
+ );
+ } else if(this.options.position === 'left') {
+ jQuery('#mailpoet_panel').css(
+ { marginLeft: 0 }
+ );
+ }
+ }.bind(this), 0);
+ break;
+ }
+
+ return this;
+ },
+ showModal: function() {
+ // set modal dimensions
+ this.setDimensions();
+
+ // add a flag on the body so that we can prevent scrolling (setting overflow hidden)
+ jQuery('body').addClass('mailpoet_modal_opened');
+
+ // show popup
+ jQuery('#mailpoet_'+this.options.type).show();
+
+ // display overlay
+ this.showOverlay();
+
+ // set modal position
+ this.setPosition();
+
+ // add class on highlighted elements
+ if(this.options.highlight !== null) {
+ if(this.options.highlight.length > 0) {
+ this.highlightOn(this.options.highlight);
+ }
+ }
+
+ // set popup as opened
+ this.opened = true;
+
+ // trigger init event if specified
+ if(this.options.onInit !== null) {
+ this.options.onInit();
+ }
+
+ return this;
+ },
+ highlightOn: function(element) {
+ jQuery(element).addClass('mailpoet_modal_highlight');
+ return this;
+ },
+ highlightOff: function() {
+ jQuery('.mailpoet_modal_highlight').removeClass('mailpoet_modal_highlight');
+ return this;
+ },
+ hideModal: function(callback) {
+ // set modal as closed
+ this.opened = false;
+
+ // hide modal
+ jQuery('#mailpoet_'+this.options.type).hide();
+
+ // remove class on highlighted elements
+ this.highlightOff();
+
+ // remove class from body to let it be scrollable
+ jQuery('body').removeClass('mailpoet_modal_opened');
+
+ return this;
+ },
+ showOverlay: function(force) {
+ jQuery('#mailpoet_modal_overlay').show();
+ return this;
+ },
+ hideOverlay: function() {
+ jQuery('#mailpoet_modal_overlay').hide();
+ return this;
+ },
+ popup: function(options) {
+ // get options
+ options = options || {};
+ // set modal type
+ options.type = 'popup';
+ // set overlay state
+ options.overlay = options.overlay || true;
+ // initialize modal
+ this.init(options);
+ // open modal
+ this.open();
+
+ return this;
+ },
+ panel: function(options) {
+ // get options
+ options = options || {};
+ // reset subpanels
+ this.subpanels = [];
+ // set modal type
+ options.type = 'panel';
+ // set overlay state
+ options.overlay = options.overlay || false;
+ // set highlighted element
+ options.highlight = options.highlight || null;
+ // set modal dimensions
+ options.width = options.width || '40%';
+ options.height = options.height || 'auto';
+ // initialize modal
+ this.init(options);
+ // open modal
+ this.open();
+
+ return this;
+ },
+ subpanel: function(options) {
+ if(this.opened === false) {
+ // if no panel is already opened, let's create one instead
+ this.panel(options);
+ } else {
+ // if a panel is already opened, add a sub panel to it
+ this.subpanels.push(options);
+ this.loadTemplate();
+ }
+
+ return this;
+ },
+ loading: function(toggle) {
+ // make sure the overlay is initialized and that it's visible
+ this.initOverlay(true);
+
+ if(toggle === true) {
+ this.showLoading();
+ } else {
+ this.hideLoading();
+ }
+
+ return this;
+ },
+ showLoading: function() {
+ jQuery('#mailpoet_loading').show();
+
+ // add loading class to overlay
+ jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_loading');
+
+ return this;
+ },
+ hideLoading: function() {
+ jQuery('#mailpoet_loading').hide();
+
+ // remove loading class from overlay
+ jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_loading');
+
+ return this;
+ },
+ open: function() {
+ // load template if specified
+ if(this.options.template !== null) {
+ // check if a url was specified to get extra data
+ if(this.options.url !== null) {
+ this.loadUrl();
+ } else {
+ // load template
+ this.loadTemplate();
+
+ // show modal window
+ this.showModal();
+ }
+ } else {
+ this.cancel();
+ }
+
+ return this;
+ },
+ success: function() {
+ if(this.subpanels.length > 0) {
+ if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) {
+ this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data);
+ }
+ } else {
+ if(this.options.onSuccess !== null) {
+ this.options.onSuccess(this.options.data);
+ }
+ }
+ this.close();
+
+ return this;
+ },
+ cancel: function() {
+ if(this.subpanels.length > 0) {
+ if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) {
+ this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data);
+ }
+ } else {
+ if(this.options.onCancel !== null) {
+ this.options.onCancel(this.options.data);
+ }
+ }
+ this.close();
+
+ return this;
+ },
+ destroy: function() {
+ this.hideOverlay();
+
+ // remove extra modal
+ if(jQuery('#mailpoet_'+this.options.type).length > 0) {
+ jQuery('#mailpoet_'+this.options.type).remove();
+ }
+
+ this.initialized = false;
+
+ return this;
+ },
+ close: function() {
+ if(this.isLocked() === true) return this;
+
+ if(this.subpanels.length > 0) {
+
+ // close subpanel
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove();
+
+ // show previous panel
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show();
+
+ // remove last subpanels
+ this.subpanels.pop();
+
+ return this;
+ }
+
+ // remove event handlers
+ this.removeEvents();
+
+ // hide modal window
+ this.hideModal();
+
+ // destroy modal element
+ this.destroy();
+
+ // reset options
+ this.options = {
+ onSuccess: null,
+ onCancel: null
+ };
+
+ return this;
+ }
+ };
+});
diff --git a/assets/js/notice.js b/assets/js/notice.js
index 709920d13e..9deced99a8 100644
--- a/assets/js/notice.js
+++ b/assets/js/notice.js
@@ -1,175 +1,175 @@
-/*==================================================================================================
-
- MailPoet Notice:
-
- description: Handles notices
- version: 0.2
- author: Jonathan Labreuille
- company: Wysija
- dependencies: jQuery
-
- Usage:
-
- // success message (static: false)
- MailPoet.Notice.success('Yatta!');
-
- // error message (static: false)
- MailPoet.Notice.error('Boo!');
-
- // system message (static: true)
- MailPoet.Notice.system('You need to updated ASAP!');
-
- Examples:
-
- MailPoet.Notice.success('- success #1 -');
- setTimeout(function() {
- MailPoet.Notice.success('- success #2 -');
- setTimeout(function() {
- MailPoet.Notice.error('- error -');
- setTimeout(function() {
- MailPoet.Notice.system('- system -');
-
- setTimeout(function() {
- MailPoet.Notice.hide();
- }, 2500);
- }, 300);
- }, 400);
- }, 500);
-
-==================================================================================================*/
-(function(){
+define('notice', ['./mailpoet', 'jquery'], function(MailPoet, jQuery) {
"use strict";
+ /*==================================================================================================
- MailPoet.Notice = {
- version: 0.2,
- // default options
- defaults: {
- type: 'success',
- message: '',
- static: false,
- scroll: false,
- timeout: 2000,
- onOpen: null,
- onClose: null
- },
- options: {},
- init: function(options) {
- // set options
- this.options = jQuery.extend({}, this.defaults, options);
+ MailPoet Notice:
- // clone element
- this.element = jQuery('#mailpoet_notice_'+this.options.type).clone();
+ description: Handles notices
+ version: 0.2
+ author: Jonathan Labreuille
+ company: Wysija
+ dependencies: jQuery
- // remove id from clone
- this.element.removeAttr('id');
+ Usage:
- // insert notice after its parent
- jQuery('#mailpoet_notice_'+this.options.type).after(this.element);
+ // success message (static: false)
+ MailPoet.Notice.success('Yatta!');
- // setup onClose callback
- var onClose = null;
- if(this.options.onClose !== null) {
- onClose = this.options.onClose;
- }
+ // error message (static: false)
+ MailPoet.Notice.error('Boo!');
- // listen to remove event
- var element = this.element;
- jQuery(this.element).on('close', function() {
- jQuery(this).fadeOut(200, function() {
- // on close callback
- if(onClose !== null) {
- onClose();
- }
- // remove notice
- jQuery(this).remove();
- });
- }.bind(this.element));
+ // system message (static: true)
+ MailPoet.Notice.system('You need to updated ASAP!');
- // listen to message event
- jQuery(this.element).on('message', function(e, message) {
- MailPoet.Notice.setMessage(message);
- }.bind(this.element));
+ Examples:
- return this;
- },
- isHTML: function(str) {
- var a = document.createElement('div');
- a.innerHTML = str;
- for(var c = a.childNodes, i = c.length; i--;) {
- if(c[i].nodeType == 1) return true;
- }
- return false;
- },
- setMessage: function(message) {
- // if it's not an html message, let's sugar coat the message with a fancy
- if(this.isHTML(message) === false) {
- message = '
'+message+'
';
- }
- // set message
- return this.element.html(message);
- },
- show: function(options) {
- // initialize
- this.init(options);
+ MailPoet.Notice.success('- success #1 -');
+ setTimeout(function() {
+ MailPoet.Notice.success('- success #2 -');
+ setTimeout(function() {
+ MailPoet.Notice.error('- error -');
+ setTimeout(function() {
+ MailPoet.Notice.system('- system -');
- // show notice
- this.showNotice();
+ setTimeout(function() {
+ MailPoet.Notice.hide();
+ }, 2500);
+ }, 300);
+ }, 400);
+ }, 500);
- // return this;
- },
- showNotice: function() {
- // set message
- this.setMessage(this.options.message);
+ ==================================================================================================*/
- // make the notice appear
- this.element.fadeIn(200);
+ MailPoet.Notice = {
+ version: 0.2,
+ // default options
+ defaults: {
+ type: 'success',
+ message: '',
+ static: false,
+ scroll: false,
+ timeout: 2000,
+ onOpen: null,
+ onClose: null
+ },
+ options: {},
+ init: function(options) {
+ // set options
+ this.options = jQuery.extend({}, this.defaults, options);
- // if scroll option is enabled, scroll to the notice
- if(this.options.scroll === true) {
- this.element.get(0).scrollIntoView(false);
- }
+ // clone element
+ this.element = jQuery('#mailpoet_notice_'+this.options.type).clone();
- // if the notice is not static, it has to disappear after a timeout
- if(this.options.static === false) {
- this.element.delay(this.options.timeout).trigger('close');
- } else {
- this.element.append('');
- this.element.find('.mailpoet_notice_close').on('click', function() {
- jQuery(this).trigger('close');
- });
- }
+ // remove id from clone
+ this.element.removeAttr('id');
- // call onOpen callback
- if(this.options.onOpen !== null) {
- this.options.onOpen(this.element);
- }
- },
- hide: function(all) {
- if(all !== undefined && all === true) {
- jQuery('.mailpoet_notice:not([id])').trigger('close');
- } else {
- jQuery('.mailpoet_notice.updated:not([id]), .mailpoet_notice.error:not([id])')
- .trigger('close');
- }
- },
- error: function(message, options) {
- this.show(jQuery.extend({}, {
- type: 'error',
- message: ''+message+'
'
- }, options));
- },
- success: function(message, options) {
- this.show(jQuery.extend({}, {
- type: 'success',
- message: ''+message+'
'
- }, options));
- },
- system: function(message, options) {
- this.show(jQuery.extend({}, {
- type: 'system',
- static: true,
- message: message
- }, options));
- }
- };
-})(window.MailPoet = window.MailPoet || {}, jQuery);
\ No newline at end of file
+ // insert notice after its parent
+ jQuery('#mailpoet_notice_'+this.options.type).after(this.element);
+
+ // setup onClose callback
+ var onClose = null;
+ if(this.options.onClose !== null) {
+ onClose = this.options.onClose;
+ }
+
+ // listen to remove event
+ var element = this.element;
+ jQuery(this.element).on('close', function() {
+ jQuery(this).fadeOut(200, function() {
+ // on close callback
+ if(onClose !== null) {
+ onClose();
+ }
+ // remove notice
+ jQuery(this).remove();
+ });
+ }.bind(this.element));
+
+ // listen to message event
+ jQuery(this.element).on('message', function(e, message) {
+ MailPoet.Notice.setMessage(message);
+ }.bind(this.element));
+
+ return this;
+ },
+ isHTML: function(str) {
+ var a = document.createElement('div');
+ a.innerHTML = str;
+ for(var c = a.childNodes, i = c.length; i--;) {
+ if(c[i].nodeType == 1) return true;
+ }
+ return false;
+ },
+ setMessage: function(message) {
+ // if it's not an html message, let's sugar coat the message with a fancy
+ if(this.isHTML(message) === false) {
+ message = '
'+message+'
';
+ }
+ // set message
+ return this.element.html(message);
+ },
+ show: function(options) {
+ // initialize
+ this.init(options);
+
+ // show notice
+ this.showNotice();
+
+ // return this;
+ },
+ showNotice: function() {
+ // set message
+ this.setMessage(this.options.message);
+
+ // make the notice appear
+ this.element.fadeIn(200);
+
+ // if scroll option is enabled, scroll to the notice
+ if(this.options.scroll === true) {
+ this.element.get(0).scrollIntoView(false);
+ }
+
+ // if the notice is not static, it has to disappear after a timeout
+ if(this.options.static === false) {
+ this.element.delay(this.options.timeout).trigger('close');
+ } else {
+ this.element.append('');
+ this.element.find('.mailpoet_notice_close').on('click', function() {
+ jQuery(this).trigger('close');
+ });
+ }
+
+ // call onOpen callback
+ if(this.options.onOpen !== null) {
+ this.options.onOpen(this.element);
+ }
+ },
+ hide: function(all) {
+ if(all !== undefined && all === true) {
+ jQuery('.mailpoet_notice:not([id])').trigger('close');
+ } else {
+ jQuery('.mailpoet_notice.updated:not([id]), .mailpoet_notice.error:not([id])')
+ .trigger('close');
+ }
+ },
+ error: function(message, options) {
+ this.show(jQuery.extend({}, {
+ type: 'error',
+ message: ''+message+'
'
+ }, options));
+ },
+ success: function(message, options) {
+ this.show(jQuery.extend({}, {
+ type: 'success',
+ message: ''+message+'
'
+ }, options));
+ },
+ system: function(message, options) {
+ this.show(jQuery.extend({}, {
+ type: 'system',
+ static: true,
+ message: message
+ }, options));
+ }
+ };
+});
diff --git a/assets/js/src/admin.js b/assets/js/src/admin.js
new file mode 100644
index 0000000000..7a4daa81d3
--- /dev/null
+++ b/assets/js/src/admin.js
@@ -0,0 +1,1166 @@
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
+ __webpack_require__(1),
+ __webpack_require__(4),
+ __webpack_require__(5),
+ __webpack_require__(6),
+ __webpack_require__(7)
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
+ jQuery(function($) {
+ // dom ready
+ $(function() {
+
+ });
+ });
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+
+
+/***/ },
+/* 1 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) {
+ "use strict";
+ /**
+ * MailPoet Ajax
+ **/
+
+ MailPoet.Ajax = {
+ version: 0.1,
+ options: {},
+ defaults: {
+ url: null,
+ controller: 'dummy',
+ action: 'test',
+ data: {},
+ onSuccess: function(data, textStatus, xhr) {},
+ onError: function(xhr, textStatus, errorThrown) {}
+ },
+ get: function(options) {
+ this.request('get', options);
+ },
+ post: function(options) {
+ this.request('post', options);
+ },
+ delete: function(options) {
+ this.request('delete', options);
+ },
+ init: function(options) {
+ // merge options
+ this.options = jQuery.extend({}, this.defaults, options);
+
+ if(this.options.url === null) {
+ this.options.url = ajaxurl+'?action=mailpoet_ajax';
+ }
+
+ // routing
+ this.options.url += '&mailpoet_controller='+this.options.controller;
+ this.options.url += '&mailpoet_action='+this.options.action;
+ },
+ request: function(method, options) {
+ // set options
+ this.init(options);
+
+ // make ajax request depending on method
+ if(method === 'get') {
+ jQuery.get(
+ this.options.url,
+ this.options.data,
+ this.options.onSuccess,
+ 'json'
+ );
+ } else {
+ jQuery.ajax(
+ this.options.url,
+ {
+ data: JSON.stringify(this.options.data),
+ processData: false,
+ contentType: "application/json; charset=utf-8",
+ type : method,
+ dataType: 'json',
+ success : this.options.onSuccess,
+ error : this.options.onError
+ }
+ );
+ }
+ }
+ };
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+
+
+/***/ },
+/* 2 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
+ // A placeholder for MailPoet object
+ var MailPoet = {};
+
+ // Expose MailPoet globally
+ window.MailPoet = MailPoet;
+
+ return MailPoet;
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+
+
+/***/ },
+/* 3 */
+/***/ function(module, exports) {
+
+ module.exports = jQuery;
+
+/***/ },
+/* 4 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) {
+ "use strict";
+ /*==================================================================================================
+
+ MailPoet Notice:
+
+ description: Handles notices
+ version: 0.2
+ author: Jonathan Labreuille
+ company: Wysija
+ dependencies: jQuery
+
+ Usage:
+
+ // success message (static: false)
+ MailPoet.Notice.success('Yatta!');
+
+ // error message (static: false)
+ MailPoet.Notice.error('Boo!');
+
+ // system message (static: true)
+ MailPoet.Notice.system('You need to updated ASAP!');
+
+ Examples:
+
+ MailPoet.Notice.success('- success #1 -');
+ setTimeout(function() {
+ MailPoet.Notice.success('- success #2 -');
+ setTimeout(function() {
+ MailPoet.Notice.error('- error -');
+ setTimeout(function() {
+ MailPoet.Notice.system('- system -');
+
+ setTimeout(function() {
+ MailPoet.Notice.hide();
+ }, 2500);
+ }, 300);
+ }, 400);
+ }, 500);
+
+ ==================================================================================================*/
+
+ MailPoet.Notice = {
+ version: 0.2,
+ // default options
+ defaults: {
+ type: 'success',
+ message: '',
+ static: false,
+ scroll: false,
+ timeout: 2000,
+ onOpen: null,
+ onClose: null
+ },
+ options: {},
+ init: function(options) {
+ // set options
+ this.options = jQuery.extend({}, this.defaults, options);
+
+ // clone element
+ this.element = jQuery('#mailpoet_notice_'+this.options.type).clone();
+
+ // remove id from clone
+ this.element.removeAttr('id');
+
+ // insert notice after its parent
+ jQuery('#mailpoet_notice_'+this.options.type).after(this.element);
+
+ // setup onClose callback
+ var onClose = null;
+ if(this.options.onClose !== null) {
+ onClose = this.options.onClose;
+ }
+
+ // listen to remove event
+ var element = this.element;
+ jQuery(this.element).on('close', function() {
+ jQuery(this).fadeOut(200, function() {
+ // on close callback
+ if(onClose !== null) {
+ onClose();
+ }
+ // remove notice
+ jQuery(this).remove();
+ });
+ }.bind(this.element));
+
+ // listen to message event
+ jQuery(this.element).on('message', function(e, message) {
+ MailPoet.Notice.setMessage(message);
+ }.bind(this.element));
+
+ return this;
+ },
+ isHTML: function(str) {
+ var a = document.createElement('div');
+ a.innerHTML = str;
+ for(var c = a.childNodes, i = c.length; i--;) {
+ if(c[i].nodeType == 1) return true;
+ }
+ return false;
+ },
+ setMessage: function(message) {
+ // if it's not an html message, let's sugar coat the message with a fancy
+ if(this.isHTML(message) === false) {
+ message = '
'+message+'
';
+ }
+ // set message
+ return this.element.html(message);
+ },
+ show: function(options) {
+ // initialize
+ this.init(options);
+
+ // show notice
+ this.showNotice();
+
+ // return this;
+ },
+ showNotice: function() {
+ // set message
+ this.setMessage(this.options.message);
+
+ // make the notice appear
+ this.element.fadeIn(200);
+
+ // if scroll option is enabled, scroll to the notice
+ if(this.options.scroll === true) {
+ this.element.get(0).scrollIntoView(false);
+ }
+
+ // if the notice is not static, it has to disappear after a timeout
+ if(this.options.static === false) {
+ this.element.delay(this.options.timeout).trigger('close');
+ } else {
+ this.element.append('');
+ this.element.find('.mailpoet_notice_close').on('click', function() {
+ jQuery(this).trigger('close');
+ });
+ }
+
+ // call onOpen callback
+ if(this.options.onOpen !== null) {
+ this.options.onOpen(this.element);
+ }
+ },
+ hide: function(all) {
+ if(all !== undefined && all === true) {
+ jQuery('.mailpoet_notice:not([id])').trigger('close');
+ } else {
+ jQuery('.mailpoet_notice.updated:not([id]), .mailpoet_notice.error:not([id])')
+ .trigger('close');
+ }
+ },
+ error: function(message, options) {
+ this.show(jQuery.extend({}, {
+ type: 'error',
+ message: ''+message+'
'
+ }, options));
+ },
+ success: function(message, options) {
+ this.show(jQuery.extend({}, {
+ type: 'success',
+ message: ''+message+'
'
+ }, options));
+ },
+ system: function(message, options) {
+ this.show(jQuery.extend({}, {
+ type: 'system',
+ static: true,
+ message: message
+ }, options));
+ }
+ };
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+
+
+/***/ },
+/* 5 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(2), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) {
+ "use strict";
+ /*==================================================================================================
+
+ MailPoet Modal:
+
+ version: 0.8
+ author: Jonathan Labreuille
+ company: Wysija
+ dependencies: jQuery
+
+
+ Options:
+
+ Mandatory:
+ // Modal window's title
+ (string) title: 'Modal title'
+
+ // template
+ (string) template: jQuery('#handlebars_template').html() or
+ literal html
+
+ Optional:
+ // jQuery cached element object node to be displayed,
+ // instead of creating a new one
+ (object) element: jQuery(selector)
+
+ // - data object that will be passed to the template when rendering
+ (object) data: {},
+
+ // - data will be loaded via this url and passed to the template
+ // when rendering
+ // - if a "data" option was specified, it will be merged with the
+ // ajax's response data
+ (string) url: '/url.json'
+
+ // ajax method
+ (string) method: 'post' (default: 'get')
+
+ // ajax post params
+ (object) params: {}
+
+ // - integers are expressed in pixels
+ (mixed) width: '50%' | 100 | '100px'
+
+ // - integers are expressed in pixels
+ // - will be ignored when in "panel" mode
+ (mixed) height: '50%' | 100 | '100px'
+
+ // - only used for "panel" mode
+ // - will be ignored in "popup" mode
+ (string) position: 'left' | 'right'
+
+ // display overlay or not
+ (boolean) overlay: true | false
+
+ // element(s) to be highlighted when the overlay is "on"
+ (object) highlight: jQuery element
+
+ // callbacks
+ (function) onInit: called when the modal is displayed
+ (function) onSuccess: called by calling MailPoet_Guide.success()
+ (function) onCancel: called when closing the popup
+ or by calling MailPoet_Guide.cancel()
+
+ Usage:
+
+ // popup mode
+ MailPoet.Modal.popup(options);
+
+ // panel mode
+ MailPoet.Modal.panel(options);
+
+ // loading states
+ MailPoet.Modal.loading(true); // displays loading indicator
+ MailPoet.Modal.loading(false); // hides loading indicator
+
+ ==================================================================================================*/
+
+ MailPoet.Modal = {
+ version: 0.8,
+
+ // flags
+ initialized: false,
+ opened: false,
+ locked: false,
+
+ // sub panels
+ subpanels: [],
+
+ // default values
+ defaults: {
+ // title
+ title: null,
+
+ // type
+ type: null,
+
+ // positionning
+ position: 'right',
+
+ // data sources
+ data: {},
+ url: null,
+ method: 'get',
+ params: {},
+
+ // template
+ template: null,
+ body_template: null,
+
+ // dimensions
+ width: 'auto',
+ height: 'auto',
+
+ // display overlay
+ overlay: false,
+
+ // highlighted elements
+ highlight: null,
+
+ // callbacks
+ onInit: null,
+ onSuccess: null,
+ onCancel: null
+ },
+ renderer: 'html',
+ options: {},
+ templates: {
+ overlay: '',
+ popup: '',
+ loading: '',
+ panel: '',
+ subpanel: ''
+ },
+ setRenderer: function() {
+ this.renderer = (typeof(Handlebars) === "undefined") ? 'html' : 'handlebars';
+ },
+ compileTemplate: function(template) {
+ if(this.renderer === 'html') {
+ return function() { return template; };
+ } else {
+ return Handlebars.compile(template);
+ }
+ },
+ init: function(options) {
+ if(this.initialized === true) {
+ this.close();
+ }
+
+ // merge options
+ this.options = jQuery.extend({}, this.defaults, options);
+
+ // set renderer
+ this.setRenderer();
+
+ // init overlay
+ this.initOverlay();
+
+ // toggle overlay
+ this.toggleOverlay(this.options.overlay);
+
+ if(this.options.type !== null) {
+ // insert modal depending on its type
+ if(this.options.type === 'popup') {
+ var modal = this.compileTemplate(this.templates[this.options.type]);
+ // create modal
+ jQuery('#mailpoet_modal_overlay').append(modal(this.options));
+ // set title
+ jQuery('#mailpoet_popup_title h2').html(this.options.title);
+ } else if(this.options.type === 'panel') {
+ // create panel
+ jQuery('#mailpoet_modal_overlay').after(this.templates[this.options.type]);
+ }
+
+ // add proper overlay class
+ jQuery('#mailpoet_modal_overlay')
+ .removeClass('mailpoet_popup_overlay mailpoet_panel_overlay')
+ .addClass('mailpoet_'+this.options.type+'_overlay');
+ }
+
+ // render template if specified
+ if(this.options.template !== null) {
+ // set "success" callback if specified
+ if(options.onSuccess !== undefined) {
+ this.options.onSuccess = options.onSuccess;
+ }
+
+ // set "cancel" callback if specified
+ if(options.onCancel !== undefined) {
+ this.options.onCancel = options.onCancel;
+ }
+
+ // compile template
+ this.options.body_template = this.compileTemplate(this.options.template);
+
+ // setup events
+ this.setupEvents();
+ }
+
+ // set popup as initialized
+ this.initialized = true;
+
+ return this;
+ },
+ initOverlay: function(toggle) {
+ if(jQuery('#mailpoet_modal_overlay').length === 0) {
+ // insert overlay into the DOM
+ jQuery('body').append(this.templates.overlay);
+ // insert loading indicator into overlay
+ jQuery('#mailpoet_modal_overlay').append(this.templates.loading);
+ }
+ return this;
+ },
+ toggleOverlay: function(toggle) {
+ if(toggle === true) {
+ jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_hidden');
+ } else {
+ jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_hidden');
+ }
+
+ return this;
+ },
+ setupEvents: function() {
+ // close popup when user clicks on close button
+ jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this));
+
+ // close popup when user clicks on overlay
+ jQuery('#mailpoet_modal_overlay').on('click', function(e) {
+ // we need to make sure that we are actually clicking on the overlay
+ // because when clicking on the popup content, it will trigger the click
+ // event on the overlay
+ if(e.target.id === 'mailpoet_modal_overlay') { this.cancel(); }
+ }.bind(this));
+
+ // close popup when user presses ESC key
+ jQuery(document).on('keyup.mailpoet_modal', function(e) {
+ if(this.opened === false) { return false; }
+ if(e.keyCode === 27) { this.cancel(); }
+ }.bind(this));
+
+ // make sure the popup is repositioned when the window is resized
+ jQuery(window).on('resize.mailpoet_modal', function() {
+ this.setPosition();
+ }.bind(this));
+
+ return this;
+ },
+ removeEvents: function() {
+ jQuery(document).unbind('keyup.mailpoet_modal');
+ jQuery(window).unbind('resize.mailpoet_modal');
+ jQuery('#mailpoet_modal_close').off('click');
+ if(this.options.overlay === true) {
+ jQuery('#mailpoet_modal_overlay').off('click');
+ }
+
+ return this;
+ },
+ lock: function() {
+ this.locked = true;
+
+ return this;
+ },
+ unlock: function() {
+ this.locked = false;
+
+ return this;
+ },
+ isLocked: function() {
+ return this.locked;
+ },
+ loadTemplate: function() {
+ if(this.subpanels.length > 0) {
+ // hide panel
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').hide();
+
+ // add sub panel wrapper
+ jQuery('#mailpoet_'+this.options.type).append(this.templates['subpanel']);
+
+ // add sub panel content
+ jQuery('.mailpoet_'+this.options.type+'_body').last().html(this.subpanels[(this.subpanels.length - 1)].element);
+ } else if (this.options.element) {
+ jQuery('.mailpoet_'+this.options.type+'_body').empty();
+ jQuery('.mailpoet_'+this.options.type+'_body').append(this.options.element);
+ } else {
+ jQuery('.mailpoet_'+this.options.type+'_body').html(
+ this.options.body_template(
+ this.options.data
+ )
+ );
+ }
+
+ return this;
+ },
+ loadUrl: function() {
+ if(this.options.method === 'get') {
+ // make ajax request
+ jQuery.getJSON(this.options.url, function(data) {
+ // merge returned data with existing data passed when calling the "open" method
+ this.options.data = jQuery.extend({}, this.options.data, data);
+ // load template using fetched data
+ this.loadTemplate();
+ // show modal window
+ this.showModal();
+ }.bind(this));
+ } else if(this.options.method === 'post') {
+ // make ajax request
+ jQuery.post(this.options.url, JSON.stringify(this.options.params), function(data) {
+ // merge returned data with existing data passed when calling the "open" method
+ this.options.data = jQuery.extend({}, this.options.data, data);
+ // load template using fetched data
+ this.loadTemplate();
+ // show modal window
+ this.showModal();
+ }.bind(this), 'json');
+ }
+
+ return this;
+ },
+ setDimensions: function() {
+ switch(this.options.type) {
+ case 'popup':
+ // set popup dimensions
+ jQuery('#mailpoet_popup').css({
+ width: this.options.width,
+ minHeight: this.options.height
+ });
+ // set popup wrapper height
+ jQuery('#mailpoet_popup_wrapper').css({ height: this.options.height});
+ break;
+ case 'panel':
+ // set dimensions
+ if(this.options.position === 'right') {
+ jQuery('#mailpoet_panel').css({
+ width: this.options.width,
+ right: 0,
+ marginRight: '-' + this.options.width,
+ left: 'auto'
+ });
+ } else if(this.options.position === 'left') {
+ jQuery('#mailpoet_panel').css({
+ width: this.options.width,
+ left: 0,
+ marginLeft: '-' + this.options.width,
+ right: 'auto'
+ });
+ }
+ jQuery('#mailpoet_panel').css({ minHeight: 'auto' });
+ break;
+ }
+
+ return this;
+ },
+ setPosition: function() {
+ switch(this.options.type) {
+ case 'popup':
+ var screenWidth = jQuery(window).width(),
+ screenHeight = jQuery(window).height(),
+ modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(),
+ modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height();
+
+ var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))),
+ left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2)));
+
+ // set position of popup depending on screen dimensions.
+ jQuery('#mailpoet_popup').css({
+ top: top,
+ left: left
+ });
+ break;
+ case 'panel':
+ setTimeout(function() {
+ // set position of popup depending on screen dimensions.
+ if(this.options.position === 'right') {
+ jQuery('#mailpoet_panel').css(
+ { marginRight: 0 }
+ );
+ } else if(this.options.position === 'left') {
+ jQuery('#mailpoet_panel').css(
+ { marginLeft: 0 }
+ );
+ }
+ }.bind(this), 0);
+ break;
+ }
+
+ return this;
+ },
+ showModal: function() {
+ // set modal dimensions
+ this.setDimensions();
+
+ // add a flag on the body so that we can prevent scrolling (setting overflow hidden)
+ jQuery('body').addClass('mailpoet_modal_opened');
+
+ // show popup
+ jQuery('#mailpoet_'+this.options.type).show();
+
+ // display overlay
+ this.showOverlay();
+
+ // set modal position
+ this.setPosition();
+
+ // add class on highlighted elements
+ if(this.options.highlight !== null) {
+ if(this.options.highlight.length > 0) {
+ this.highlightOn(this.options.highlight);
+ }
+ }
+
+ // set popup as opened
+ this.opened = true;
+
+ // trigger init event if specified
+ if(this.options.onInit !== null) {
+ this.options.onInit();
+ }
+
+ return this;
+ },
+ highlightOn: function(element) {
+ jQuery(element).addClass('mailpoet_modal_highlight');
+ return this;
+ },
+ highlightOff: function() {
+ jQuery('.mailpoet_modal_highlight').removeClass('mailpoet_modal_highlight');
+ return this;
+ },
+ hideModal: function(callback) {
+ // set modal as closed
+ this.opened = false;
+
+ // hide modal
+ jQuery('#mailpoet_'+this.options.type).hide();
+
+ // remove class on highlighted elements
+ this.highlightOff();
+
+ // remove class from body to let it be scrollable
+ jQuery('body').removeClass('mailpoet_modal_opened');
+
+ return this;
+ },
+ showOverlay: function(force) {
+ jQuery('#mailpoet_modal_overlay').show();
+ return this;
+ },
+ hideOverlay: function() {
+ jQuery('#mailpoet_modal_overlay').hide();
+ return this;
+ },
+ popup: function(options) {
+ // get options
+ options = options || {};
+ // set modal type
+ options.type = 'popup';
+ // set overlay state
+ options.overlay = options.overlay || true;
+ // initialize modal
+ this.init(options);
+ // open modal
+ this.open();
+
+ return this;
+ },
+ panel: function(options) {
+ // get options
+ options = options || {};
+ // reset subpanels
+ this.subpanels = [];
+ // set modal type
+ options.type = 'panel';
+ // set overlay state
+ options.overlay = options.overlay || false;
+ // set highlighted element
+ options.highlight = options.highlight || null;
+ // set modal dimensions
+ options.width = options.width || '40%';
+ options.height = options.height || 'auto';
+ // initialize modal
+ this.init(options);
+ // open modal
+ this.open();
+
+ return this;
+ },
+ subpanel: function(options) {
+ if(this.opened === false) {
+ // if no panel is already opened, let's create one instead
+ this.panel(options);
+ } else {
+ // if a panel is already opened, add a sub panel to it
+ this.subpanels.push(options);
+ this.loadTemplate();
+ }
+
+ return this;
+ },
+ loading: function(toggle) {
+ // make sure the overlay is initialized and that it's visible
+ this.initOverlay(true);
+
+ if(toggle === true) {
+ this.showLoading();
+ } else {
+ this.hideLoading();
+ }
+
+ return this;
+ },
+ showLoading: function() {
+ jQuery('#mailpoet_loading').show();
+
+ // add loading class to overlay
+ jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_loading');
+
+ return this;
+ },
+ hideLoading: function() {
+ jQuery('#mailpoet_loading').hide();
+
+ // remove loading class from overlay
+ jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_loading');
+
+ return this;
+ },
+ open: function() {
+ // load template if specified
+ if(this.options.template !== null) {
+ // check if a url was specified to get extra data
+ if(this.options.url !== null) {
+ this.loadUrl();
+ } else {
+ // load template
+ this.loadTemplate();
+
+ // show modal window
+ this.showModal();
+ }
+ } else {
+ this.cancel();
+ }
+
+ return this;
+ },
+ success: function() {
+ if(this.subpanels.length > 0) {
+ if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) {
+ this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data);
+ }
+ } else {
+ if(this.options.onSuccess !== null) {
+ this.options.onSuccess(this.options.data);
+ }
+ }
+ this.close();
+
+ return this;
+ },
+ cancel: function() {
+ if(this.subpanels.length > 0) {
+ if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) {
+ this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data);
+ }
+ } else {
+ if(this.options.onCancel !== null) {
+ this.options.onCancel(this.options.data);
+ }
+ }
+ this.close();
+
+ return this;
+ },
+ destroy: function() {
+ this.hideOverlay();
+
+ // remove extra modal
+ if(jQuery('#mailpoet_'+this.options.type).length > 0) {
+ jQuery('#mailpoet_'+this.options.type).remove();
+ }
+
+ this.initialized = false;
+
+ return this;
+ },
+ close: function() {
+ if(this.isLocked() === true) return this;
+
+ if(this.subpanels.length > 0) {
+
+ // close subpanel
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove();
+
+ // show previous panel
+ jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show();
+
+ // remove last subpanels
+ this.subpanels.pop();
+
+ return this;
+ }
+
+ // remove event handlers
+ this.removeEvents();
+
+ // hide modal window
+ this.hideModal();
+
+ // destroy modal element
+ this.destroy();
+
+ // reset options
+ this.options = {
+ onSuccess: null,
+ onCancel: null
+ };
+
+ return this;
+ }
+ };
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+
+
+/***/ },
+/* 6 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /*!
+
+ handlebars v3.0.3
+
+ Copyright (C) 2011-2014 by Yehuda Katz
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+
+ @license
+ */
+ !function(a,b){ true?module.exports=b():"function"==typeof define&&define.amd?define(b):"object"==typeof exports?exports.Handlebars=b():a.Handlebars=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){"use strict";function d(){var a=r();return a.compile=function(b,c){return k.compile(b,c,a)},a.precompile=function(b,c){return k.precompile(b,c,a)},a.AST=i["default"],a.Compiler=k.Compiler,a.JavaScriptCompiler=m["default"],a.Parser=j.parser,a.parse=j.parse,a}var e=c(8)["default"];b.__esModule=!0;var f=c(1),g=e(f),h=c(2),i=e(h),j=c(3),k=c(4),l=c(5),m=e(l),n=c(6),o=e(n),p=c(7),q=e(p),r=g["default"].create,s=d();s.create=d,q["default"](s),s.Visitor=o["default"],s["default"]=s,b["default"]=s,a.exports=b["default"]},function(a,b,c){"use strict";function d(){var a=new g.HandlebarsEnvironment;return m.extend(a,g),a.SafeString=i["default"],a.Exception=k["default"],a.Utils=m,a.escapeExpression=m.escapeExpression,a.VM=o,a.template=function(b){return o.template(b,a)},a}var e=c(8)["default"];b.__esModule=!0;var f=c(9),g=e(f),h=c(10),i=e(h),j=c(11),k=e(j),l=c(12),m=e(l),n=c(13),o=e(n),p=c(7),q=e(p),r=d();r.create=d,q["default"](r),r["default"]=r,b["default"]=r,a.exports=b["default"]},function(a,b){"use strict";b.__esModule=!0;var c={Program:function(a,b,c,d){this.loc=d,this.type="Program",this.body=a,this.blockParams=b,this.strip=c},MustacheStatement:function(a,b,c,d,e,f){this.loc=f,this.type="MustacheStatement",this.path=a,this.params=b||[],this.hash=c,this.escaped=d,this.strip=e},BlockStatement:function(a,b,c,d,e,f,g,h,i){this.loc=i,this.type="BlockStatement",this.path=a,this.params=b||[],this.hash=c,this.program=d,this.inverse=e,this.openStrip=f,this.inverseStrip=g,this.closeStrip=h},PartialStatement:function(a,b,c,d,e){this.loc=e,this.type="PartialStatement",this.name=a,this.params=b||[],this.hash=c,this.indent="",this.strip=d},ContentStatement:function(a,b){this.loc=b,this.type="ContentStatement",this.original=this.value=a},CommentStatement:function(a,b,c){this.loc=c,this.type="CommentStatement",this.value=a,this.strip=b},SubExpression:function(a,b,c,d){this.loc=d,this.type="SubExpression",this.path=a,this.params=b||[],this.hash=c},PathExpression:function(a,b,c,d,e){this.loc=e,this.type="PathExpression",this.data=a,this.original=d,this.parts=c,this.depth=b},StringLiteral:function(a,b){this.loc=b,this.type="StringLiteral",this.original=this.value=a},NumberLiteral:function(a,b){this.loc=b,this.type="NumberLiteral",this.original=this.value=Number(a)},BooleanLiteral:function(a,b){this.loc=b,this.type="BooleanLiteral",this.original=this.value="true"===a},UndefinedLiteral:function(a){this.loc=a,this.type="UndefinedLiteral",this.original=this.value=void 0},NullLiteral:function(a){this.loc=a,this.type="NullLiteral",this.original=this.value=null},Hash:function(a,b){this.loc=b,this.type="Hash",this.pairs=a},HashPair:function(a,b,c){this.loc=c,this.type="HashPair",this.key=a,this.value=b},helpers:{helperExpression:function(a){return!("SubExpression"!==a.type&&!a.params.length&&!a.hash)},scopedId:function(a){return/^\.|this\b/.test(a.original)},simpleId:function(a){return 1===a.parts.length&&!c.helpers.scopedId(a)&&!a.depth}}};b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";function d(a,b){if("Program"===a.type)return a;g["default"].yy=o,o.locInfo=function(a){return new o.SourceLocation(b&&b.srcName,a)};var c=new k["default"];return c.accept(g["default"].parse(a))}var e=c(8)["default"];b.__esModule=!0,b.parse=d;var f=c(14),g=e(f),h=c(2),i=e(h),j=c(15),k=e(j),l=c(16),m=e(l),n=c(12);b.parser=g["default"];var o={};n.extend(o,m,i["default"])},function(a,b,c){"use strict";function d(){}function e(a,b,c){if(null==a||"string"!=typeof a&&"Program"!==a.type)throw new k["default"]("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var d=c.parse(a,b),e=(new c.Compiler).compile(d,b);return(new c.JavaScriptCompiler).compile(e,b)}function f(a,b,c){function d(){var b=c.parse(a,f),d=(new c.Compiler).compile(b,f),e=(new c.JavaScriptCompiler).compile(d,f,void 0,!0);return c.template(e)}function e(a,b){return g||(g=d()),g.call(this,a,b)}var f=void 0===arguments[1]?{}:arguments[1];if(null==a||"string"!=typeof a&&"Program"!==a.type)throw new k["default"]("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);"data"in f||(f.data=!0),f.compat&&(f.useDepths=!0);var g=void 0;return e._setup=function(a){return g||(g=d()),g._setup(a)},e._child=function(a,b,c,e){return g||(g=d()),g._child(a,b,c,e)},e}function g(a,b){if(a===b)return!0;if(l.isArray(a)&&l.isArray(b)&&a.length===b.length){for(var c=0;cc;c++){var d=this.opcodes[c],e=a.opcodes[c];if(d.opcode!==e.opcode||!g(d.args,e.args))return!1}b=this.children.length;for(var c=0;b>c;c++)if(!this.children[c].equals(a.children[c]))return!1;return!0},guid:0,compile:function(a,b){this.sourceNode=[],this.opcodes=[],this.children=[],this.options=b,this.stringParams=b.stringParams,this.trackIds=b.trackIds,b.blockParams=b.blockParams||[];var c=b.knownHelpers;if(b.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0,lookup:!0},c)for(var d in c)d in c&&(b.knownHelpers[d]=c[d]);return this.accept(a)},compileProgram:function(a){var b=new this.compiler,c=b.compile(a,this.options),d=this.guid++;return this.usePartial=this.usePartial||c.usePartial,this.children[d]=c,this.useDepths=this.useDepths||c.useDepths,d},accept:function(a){this.sourceNode.unshift(a);var b=this[a.type](a);return this.sourceNode.shift(),b},Program:function(a){this.options.blockParams.unshift(a.blockParams);for(var b=a.body,c=b.length,d=0;c>d;d++)this.accept(b[d]);return this.options.blockParams.shift(),this.isSimple=1===c,this.blockParams=a.blockParams?a.blockParams.length:0,this},BlockStatement:function(a){h(a);var b=a.program,c=a.inverse;b=b&&this.compileProgram(b),c=c&&this.compileProgram(c);var d=this.classifySexpr(a);"helper"===d?this.helperSexpr(a,b,c):"simple"===d?(this.simpleSexpr(a),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.opcode("emptyHash"),this.opcode("blockValue",a.path.original)):(this.ambiguousSexpr(a,b,c),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},PartialStatement:function(a){this.usePartial=!0;var b=a.params;if(b.length>1)throw new k["default"]("Unsupported number of partial arguments: "+b.length,a);b.length||b.push({type:"PathExpression",parts:[],depth:0});var c=a.name.original,d="SubExpression"===a.name.type;d&&this.accept(a.name),this.setupFullMustacheParams(a,void 0,void 0,!0);var e=a.indent||"";this.options.preventIndent&&e&&(this.opcode("appendContent",e),e=""),this.opcode("invokePartial",d,c,e),this.opcode("append")},MustacheStatement:function(a){this.SubExpression(a),this.opcode(a.escaped&&!this.options.noEscape?"appendEscaped":"append")},ContentStatement:function(a){a.value&&this.opcode("appendContent",a.value)},CommentStatement:function(){},SubExpression:function(a){h(a);var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ambiguousSexpr:function(a,b,c){var d=a.path,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.accept(d),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){this.accept(a.path),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var d=this.setupFullMustacheParams(a,b,c),e=a.path,f=e.parts[0];if(this.options.knownHelpers[f])this.opcode("invokeKnownHelper",d.length,f);else{if(this.options.knownHelpersOnly)throw new k["default"]("You specified knownHelpersOnly, but used the unknown helper "+f,a);e.falsy=!0,this.accept(e),this.opcode("invokeHelper",d.length,e.original,n["default"].helpers.simpleId(e))}},PathExpression:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0],c=n["default"].helpers.scopedId(a),d=!a.depth&&!c&&this.blockParamIndex(b);d?this.opcode("lookupBlockParam",d,a.parts):b?a.data?(this.options.data=!0,this.opcode("lookupData",a.depth,a.parts)):this.opcode("lookupOnContext",a.parts,a.falsy,c):this.opcode("pushContext")},StringLiteral:function(a){this.opcode("pushString",a.value)},NumberLiteral:function(a){this.opcode("pushLiteral",a.value)},BooleanLiteral:function(a){this.opcode("pushLiteral",a.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(a){var b=a.pairs,c=0,d=b.length;for(this.opcode("pushHash");d>c;c++)this.pushParam(b[c].value);for(;c--;)this.opcode("assignToHash",b[c].key);this.opcode("popHash")},opcode:function(a){this.opcodes.push({opcode:a,args:o.call(arguments,1),loc:this.sourceNode[0].loc})},addDepth:function(a){a&&(this.useDepths=!0)},classifySexpr:function(a){var b=n["default"].helpers.simpleId(a.path),c=b&&!!this.blockParamIndex(a.path.parts[0]),d=!c&&n["default"].helpers.helperExpression(a),e=!c&&(d||b);if(e&&!d){var f=a.path.parts[0],g=this.options;g.knownHelpers[f]?d=!0:g.knownHelpersOnly&&(e=!1)}return d?"helper":e?"ambiguous":"simple"},pushParams:function(a){for(var b=0,c=a.length;c>b;b++)this.pushParam(a[b])},pushParam:function(a){var b=null!=a.value?a.value:a.original||"";if(this.stringParams)b.replace&&(b=b.replace(/^(\.?\.\/)*/g,"").replace(/\//g,".")),a.depth&&this.addDepth(a.depth),this.opcode("getContext",a.depth||0),this.opcode("pushStringParam",b,a.type),"SubExpression"===a.type&&this.accept(a);else{if(this.trackIds){var c=void 0;if(!a.parts||n["default"].helpers.scopedId(a)||a.depth||(c=this.blockParamIndex(a.parts[0])),c){var d=a.parts.slice(1).join(".");this.opcode("pushId","BlockParam",c,d)}else b=a.original||b,b.replace&&(b=b.replace(/^\.\//g,"").replace(/^\.$/g,"")),this.opcode("pushId",a.type,b)}this.accept(a)}},setupFullMustacheParams:function(a,b,c,d){var e=a.params;return this.pushParams(e),this.opcode("pushProgram",b),this.opcode("pushProgram",c),a.hash?this.accept(a.hash):this.opcode("emptyHash",d),e},blockParamIndex:function(a){for(var b=0,c=this.options.blockParams.length;c>b;b++){var d=this.options.blockParams[b],e=d&&l.indexOf(d,a);if(d&&e>=0)return[b,e]}}}},function(a,b,c){"use strict";function d(a){this.value=a}function e(){}function f(a,b,c,d){var e=b.popStack(),f=0,g=c.length;for(a&&g--;g>f;f++)e=b.nameLookup(e,c[f],d);return a?[b.aliasable("this.strict"),"(",e,", ",b.quotedString(c[f]),")"]:e}var g=c(8)["default"];b.__esModule=!0;var h=c(9),i=c(11),j=g(i),k=c(12),l=c(17),m=g(l);e.prototype={nameLookup:function(a,b){return e.isValidJavaScriptVariableName(b)?[a,".",b]:[a,"['",b,"']"]},depthedLookup:function(a){return[this.aliasable("this.lookup"),'(depths, "',a,'")']},compilerInfo:function(){var a=h.COMPILER_REVISION,b=h.REVISION_CHANGES[a];return[a,b]},appendToBuffer:function(a,b,c){return k.isArray(a)||(a=[a]),a=this.source.wrap(a,b),this.environment.isSimple?["return ",a,";"]:c?["buffer += ",a,";"]:(a.appendToBuffer=!0,a)},initializeBuffer:function(){return this.quotedString("")},compile:function(a,b,c,d){this.environment=a,this.options=b,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!d,this.name=this.environment.name,this.isChild=!!c,this.context=c||{programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(a,b),this.useDepths=this.useDepths||a.useDepths||this.options.compat,this.useBlockParams=this.useBlockParams||a.useBlockParams;var e=a.opcodes,f=void 0,g=void 0,h=void 0,i=void 0;for(h=0,i=e.length;i>h;h++)f=e[h],this.source.currentLocation=f.loc,g=g||f.loc,this[f.opcode].apply(this,f.args);if(this.source.currentLocation=g,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new j["default"]("Compile completed with content left on stack");var k=this.createFunctionContext(d);if(this.isChild)return k;var l={compiler:this.compilerInfo(),main:k},m=this.context.programs;for(h=0,i=m.length;i>h;h++)m[h]&&(l[h]=m[h]);return this.environment.usePartial&&(l.usePartial=!0),this.options.data&&(l.useData=!0),this.useDepths&&(l.useDepths=!0),this.useBlockParams&&(l.useBlockParams=!0),this.options.compat&&(l.compat=!0),d?l.compilerOptions=this.options:(l.compiler=JSON.stringify(l.compiler),this.source.currentLocation={start:{line:1,column:0}},l=this.objectLiteral(l),b.srcName?(l=l.toStringWithSourceMap({file:b.destName}),l.map=l.map&&l.map.toString()):l=l.toString()),l},preamble:function(){this.lastContext=0,this.source=new m["default"](this.options.srcName)},createFunctionContext:function(a){var b="",c=this.stackVars.concat(this.registers.list);c.length>0&&(b+=", "+c.join(", "));var d=0;for(var e in this.aliases){var f=this.aliases[e];this.aliases.hasOwnProperty(e)&&f.children&&f.referenceCount>1&&(b+=", alias"+ ++d+"="+e,f.children[0]="alias"+d)}var g=["depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&g.push("blockParams"),this.useDepths&&g.push("depths");var h=this.mergeSource(b);return a?(g.push(h),Function.apply(this,g)):this.source.wrap(["function(",g.join(","),") {\n ",h,"}"])},mergeSource:function(a){var b=this.environment.isSimple,c=!this.forceBuffer,d=void 0,e=void 0,f=void 0,g=void 0;return this.source.each(function(a){a.appendToBuffer?(f?a.prepend(" + "):f=a,g=a):(f&&(e?f.prepend("buffer += "):d=!0,g.add(";"),f=g=void 0),e=!0,b||(c=!1))}),c?f?(f.prepend("return "),g.add(";")):e||this.source.push('return "";'):(a+=", buffer = "+(d?"":this.initializeBuffer()),f?(f.prepend("return buffer + "),g.add(";")):this.source.push("return buffer;")),a&&this.source.prepend("var "+a.substring(2)+(d?"":";\n")),this.source.merge()},blockValue:function(a){var b=this.aliasable("helpers.blockHelperMissing"),c=[this.contextName(0)];this.setupHelperArgs(a,0,c);var d=this.popStack();c.splice(1,0,d),this.push(this.source.functionCall(b,"call",c))},ambiguousBlockValue:function(){var a=this.aliasable("helpers.blockHelperMissing"),b=[this.contextName(0)];this.setupHelperArgs("",0,b,!0),this.flushInline();var c=this.topStack();b.splice(1,0,c),this.pushSource(["if (!",this.lastHelper,") { ",c," = ",this.source.functionCall(a,"call",b),"}"])},appendContent:function(a){this.pendingContent?a=this.pendingContent+a:this.pendingLocation=this.source.currentLocation,this.pendingContent=a},append:function(){if(this.isInline())this.replaceStack(function(a){return[" != null ? ",a,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var a=this.popStack();this.pushSource(["if (",a," != null) { ",this.appendToBuffer(a,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("this.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(a){this.lastContext=a},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(a,b,c){var d=0;c||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(a[d++])),this.resolvePath("context",a,d,b)},lookupBlockParam:function(a,b){this.useBlockParams=!0,this.push(["blockParams[",a[0],"][",a[1],"]"]),this.resolvePath("context",b,1)},lookupData:function(a,b){this.pushStackLiteral(a?"this.data(data, "+a+")":"data"),this.resolvePath("data",b,0,!0)},resolvePath:function(a,b,c,d){var e=this;if(this.options.strict||this.options.assumeObjects)return void this.push(f(this.options.strict,this,b,a));for(var g=b.length;g>c;c++)this.replaceStack(function(f){var g=e.nameLookup(f,b[c],a);return d?[" && ",g]:[" != null ? ",g," : ",f]})},resolvePossibleLambda:function(){this.push([this.aliasable("this.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(a,b){this.pushContext(),this.pushString(b),"SubExpression"!==b&&("string"==typeof a?this.pushString(a):this.pushStackLiteral(a))},emptyHash:function(a){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(a?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[],ids:[]}},popHash:function(){var a=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(a.ids)),this.stringParams&&(this.push(this.objectLiteral(a.contexts)),this.push(this.objectLiteral(a.types))),this.push(this.objectLiteral(a.values))},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){this.pushStackLiteral(null!=a?this.programExpression(a):null)},invokeHelper:function(a,b,c){var d=this.popStack(),e=this.setupHelper(a,b),f=c?[e.name," || "]:"",g=["("].concat(f,d);this.options.strict||g.push(" || ",this.aliasable("helpers.helperMissing")),g.push(")"),this.push(this.source.functionCall(g,"call",e.callParams))},invokeKnownHelper:function(a,b){var c=this.setupHelper(a,b);this.push(this.source.functionCall(c.name,"call",c.callParams))},invokeAmbiguous:function(a,b){this.useRegister("helper");var c=this.popStack();this.emptyHash();var d=this.setupHelper(0,a,b),e=this.lastHelper=this.nameLookup("helpers",a,"helper"),f=["(","(helper = ",e," || ",c,")"];this.options.strict||(f[0]="(helper = ",f.push(" != null ? helper : ",this.aliasable("helpers.helperMissing"))),this.push(["(",f,d.paramsInit?["),(",d.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",d.callParams)," : helper))"])},invokePartial:function(a,b,c){var d=[],e=this.setupParams(b,1,d,!1);a&&(b=this.popStack(),delete e.name),c&&(e.indent=JSON.stringify(c)),e.helpers="helpers",e.partials="partials",d.unshift(a?b:this.nameLookup("partials",b,"partial")),this.options.compat&&(e.depths="depths"),e=this.objectLiteral(e),d.push(e),this.push(this.source.functionCall("this.invokePartial","",d))},assignToHash:function(a){var b=this.popStack(),c=void 0,d=void 0,e=void 0;this.trackIds&&(e=this.popStack()),this.stringParams&&(d=this.popStack(),c=this.popStack());var f=this.hash;c&&(f.contexts[a]=c),d&&(f.types[a]=d),e&&(f.ids[a]=e),f.values[a]=b},pushId:function(a,b,c){"BlockParam"===a?this.pushStackLiteral("blockParams["+b[0]+"].path["+b[1]+"]"+(c?" + "+JSON.stringify("."+c):"")):"PathExpression"===a?this.pushString(b):this.pushStackLiteral("SubExpression"===a?"true":"null")},compiler:e,compileChildren:function(a,b){for(var c=a.children,d=void 0,e=void 0,f=0,g=c.length;g>f;f++){d=c[f],e=new this.compiler;var h=this.matchExistingProgram(d);null==h?(this.context.programs.push(""),h=this.context.programs.length,d.index=h,d.name="program"+h,this.context.programs[h]=e.compile(d,b,this.context,!this.precompile),this.context.environments[h]=d,this.useDepths=this.useDepths||e.useDepths,this.useBlockParams=this.useBlockParams||e.useBlockParams):(d.index=h,d.name="program"+h,this.useDepths=this.useDepths||d.useDepths,this.useBlockParams=this.useBlockParams||d.useBlockParams)}},matchExistingProgram:function(a){for(var b=0,c=this.context.environments.length;c>b;b++){var d=this.context.environments[b];if(d&&d.equals(a))return b}},programExpression:function(a){var b=this.environment.children[a],c=[b.index,"data",b.blockParams];return(this.useBlockParams||this.useDepths)&&c.push("blockParams"),this.useDepths&&c.push("depths"),"this.program("+c.join(", ")+")"},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},push:function(a){return a instanceof d||(a=this.source.wrap(a)),this.inlineStack.push(a),a},pushStackLiteral:function(a){this.push(new d(a))},pushSource:function(a){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),a&&this.source.push(a)},replaceStack:function(a){var b=["("],c=void 0,e=void 0,f=void 0;if(!this.isInline())throw new j["default"]("replaceStack on non-inline");var g=this.popStack(!0);if(g instanceof d)c=[g.value],b=["(",c],f=!0;else{e=!0;var h=this.incrStack();b=["((",this.push(h)," = ",g,")"],c=this.topStack()}var i=a.call(this,c);f||this.popStack(),e&&this.stackSlot--,this.push(b.concat(i,")"))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;this.inlineStack=[];for(var b=0,c=a.length;c>b;b++){var e=a[b];if(e instanceof d)this.compileStack.push(e);else{var f=this.incrStack();this.pushSource([f," = ",e,";"]),this.compileStack.push(f)}}},isInline:function(){return this.inlineStack.length},popStack:function(a){var b=this.isInline(),c=(b?this.inlineStack:this.compileStack).pop();if(!a&&c instanceof d)return c.value;if(!b){if(!this.stackSlot)throw new j["default"]("Invalid stack pop");this.stackSlot--}return c},topStack:function(){var a=this.isInline()?this.inlineStack:this.compileStack,b=a[a.length-1];return b instanceof d?b.value:b},contextName:function(a){return this.useDepths&&a?"depths["+a+"]":"depth"+a},quotedString:function(a){return this.source.quotedString(a)},objectLiteral:function(a){return this.source.objectLiteral(a)},aliasable:function(a){var b=this.aliases[a];return b?(b.referenceCount++,b):(b=this.aliases[a]=this.source.wrap(a),b.aliasable=!0,b.referenceCount=1,b)},setupHelper:function(a,b,c){var d=[],e=this.setupHelperArgs(b,a,d,c),f=this.nameLookup("helpers",b,"helper");return{params:d,paramsInit:e,name:f,callParams:[this.contextName(0)].concat(d)}},setupParams:function(a,b,c){var d={},e=[],f=[],g=[],h=void 0;d.name=this.quotedString(a),d.hash=this.popStack(),this.trackIds&&(d.hashIds=this.popStack()),this.stringParams&&(d.hashTypes=this.popStack(),d.hashContexts=this.popStack());var i=this.popStack(),j=this.popStack();(j||i)&&(d.fn=j||"this.noop",d.inverse=i||"this.noop");for(var k=b;k--;)h=this.popStack(),c[k]=h,this.trackIds&&(g[k]=this.popStack()),this.stringParams&&(f[k]=this.popStack(),e[k]=this.popStack());return this.trackIds&&(d.ids=this.source.generateArray(g)),this.stringParams&&(d.types=this.source.generateArray(f),d.contexts=this.source.generateArray(e)),this.options.data&&(d.data="data"),this.useBlockParams&&(d.blockParams="blockParams"),d},setupHelperArgs:function(a,b,c,d){var e=this.setupParams(a,b,c,!0);return e=this.objectLiteral(e),d?(this.useRegister("options"),c.push("options"),["options=",e]):(c.push(e),"")}},function(){for(var a="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),b=e.RESERVED_WORDS={},c=0,d=a.length;d>c;c++)b[a[c]]=!0}(),e.isValidJavaScriptVariableName=function(a){return!e.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(a)},b["default"]=e,a.exports=b["default"]},function(a,b,c){"use strict";function d(){this.parents=[]}var e=c(8)["default"];b.__esModule=!0;var f=c(11),g=e(f),h=c(2),i=e(h);d.prototype={constructor:d,mutating:!1,acceptKey:function(a,b){var c=this.accept(a[b]);if(this.mutating){if(c&&(!c.type||!i["default"][c.type]))throw new g["default"]('Unexpected node type "'+c.type+'" found when accepting '+b+" on "+a.type);a[b]=c}},acceptRequired:function(a,b){if(this.acceptKey(a,b),!a[b])throw new g["default"](a.type+" requires "+b)},acceptArray:function(a){for(var b=0,c=a.length;c>b;b++)this.acceptKey(a,b),a[b]||(a.splice(b,1),b--,c--)},accept:function(a){if(a){this.current&&this.parents.unshift(this.current),this.current=a;var b=this[a.type](a);return this.current=this.parents.shift(),!this.mutating||b?b:b!==!1?a:void 0}},Program:function(a){this.acceptArray(a.body)},MustacheStatement:function(a){this.acceptRequired(a,"path"),this.acceptArray(a.params),this.acceptKey(a,"hash")},BlockStatement:function(a){this.acceptRequired(a,"path"),this.acceptArray(a.params),this.acceptKey(a,"hash"),this.acceptKey(a,"program"),this.acceptKey(a,"inverse")},PartialStatement:function(a){this.acceptRequired(a,"name"),this.acceptArray(a.params),this.acceptKey(a,"hash")},ContentStatement:function(){},CommentStatement:function(){},SubExpression:function(a){this.acceptRequired(a,"path"),this.acceptArray(a.params),this.acceptKey(a,"hash")},PathExpression:function(){},StringLiteral:function(){},NumberLiteral:function(){},BooleanLiteral:function(){},UndefinedLiteral:function(){},NullLiteral:function(){},Hash:function(a){this.acceptArray(a.pairs)},HashPair:function(a){this.acceptRequired(a,"value")}},b["default"]=d,a.exports=b["default"]},function(a,b){(function(c){"use strict";b.__esModule=!0,b["default"]=function(a){var b="undefined"!=typeof c?c:window,d=b.Handlebars;a.noConflict=function(){b.Handlebars===a&&(b.Handlebars=d)}},a.exports=b["default"]}).call(b,function(){return this}())},function(a,b){"use strict";b["default"]=function(a){return a&&a.__esModule?a:{"default":a}},b.__esModule=!0},function(a,b,c){"use strict";function d(a,b){this.helpers=a||{},this.partials=b||{},e(this)}function e(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new k["default"]('Missing helper: "'+arguments[arguments.length-1].name+'"')}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse,e=c.fn;if(b===!0)return e(this);if(b===!1||null==b)return d(this);if(o(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):d(this);if(c.data&&c.ids){var g=f(c.data);g.contextPath=i.appendContextPath(c.data.contextPath,c.name),c={data:g}}return e(b,c)}),a.registerHelper("each",function(a,b){function c(b,c,e){j&&(j.key=b,j.index=c,j.first=0===c,j.last=!!e,l&&(j.contextPath=l+b)),h+=d(a[b],{data:j,blockParams:i.blockParams([a[b],b],[l+b,null])})}if(!b)throw new k["default"]("Must pass iterator to #each");var d=b.fn,e=b.inverse,g=0,h="",j=void 0,l=void 0;if(b.data&&b.ids&&(l=i.appendContextPath(b.data.contextPath,b.ids[0])+"."),p(a)&&(a=a.call(this)),b.data&&(j=f(b.data)),a&&"object"==typeof a)if(o(a))for(var m=a.length;m>g;g++)c(g,g,g===a.length-1);else{var n=void 0;for(var q in a)a.hasOwnProperty(q)&&(n&&c(n,g-1),n=q,g++);n&&c(n,g-1,!0)}return 0===g&&(h=e(this)),h}),a.registerHelper("if",function(a,b){return p(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||i.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){p(a)&&(a=a.call(this));var c=b.fn;if(i.isEmpty(a))return b.inverse(this);if(b.data&&b.ids){var d=f(b.data);d.contextPath=i.appendContextPath(b.data.contextPath,b.ids[0]),b={data:d}}return c(a,b)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}function f(a){var b=i.extend({},a);return b._parent=a,b}var g=c(8)["default"];b.__esModule=!0,b.HandlebarsEnvironment=d,b.createFrame=f;var h=c(12),i=g(h),j=c(11),k=g(j),l="3.0.1";b.VERSION=l;var m=6;b.COMPILER_REVISION=m;var n={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};b.REVISION_CHANGES=n;var o=i.isArray,p=i.isFunction,q=i.toString,r="[object Object]";d.prototype={constructor:d,logger:s,log:t,registerHelper:function(a,b){if(q.call(a)===r){if(b)throw new k["default"]("Arg not supported with multiple helpers");i.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){if(q.call(a)===r)i.extend(this.partials,a);else{if("undefined"==typeof b)throw new k["default"]("Attempting to register a partial as undefined");this.partials[a]=b}},unregisterPartial:function(a){delete this.partials[a]}};var s={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:1,log:function(a,b){if("undefined"!=typeof console&&s.level<=a){var c=s.methodMap[a];(console[c]||console.log).call(console,b)}}};b.logger=s;var t=s.log;b.log=t},function(a,b){"use strict";function c(a){this.string=a}b.__esModule=!0,c.prototype.toString=c.prototype.toHTML=function(){return""+this.string},b["default"]=c,a.exports=b["default"]},function(a,b){"use strict";function c(a,b){var e=b&&b.loc,f=void 0,g=void 0;e&&(f=e.start.line,g=e.start.column,a+=" - "+f+":"+g);for(var h=Error.prototype.constructor.call(this,a),i=0;ic;c++)if(a[c]===b)return c;return-1}function f(a){if("string"!=typeof a){if(a&&a.toHTML)return a.toHTML();if(null==a)return"";if(!a)return a+"";a=""+a}return l.test(a)?a.replace(k,c):a}function g(a){return a||0===a?o(a)&&0===a.length?!0:!1:!0}function h(a,b){return a.path=b,a}function i(a,b){return(a?a+".":"")+b}b.__esModule=!0,b.extend=d,b.indexOf=e,b.escapeExpression=f,b.isEmpty=g,b.blockParams=h,b.appendContextPath=i;var j={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},k=/[&<>"'`]/g,l=/[&<>"'`]/,m=Object.prototype.toString;b.toString=m;var n=function(a){return"function"==typeof a};n(/x/)&&(b.isFunction=n=function(a){return"function"==typeof a&&"[object Function]"===m.call(a)});var n;b.isFunction=n;var o=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===m.call(a):!1};b.isArray=o},function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=p.COMPILER_REVISION;if(b!==c){if(c>b){var d=p.REVISION_CHANGES[c],e=p.REVISION_CHANGES[b];throw new o["default"]("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new o["default"]("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){function c(c,d,e){e.hash&&(d=m.extend({},d,e.hash)),c=b.VM.resolvePartial.call(this,c,d,e);var f=b.VM.invokePartial.call(this,c,d,e);if(null==f&&b.compile&&(e.partials[e.name]=b.compile(c,a.compilerOptions,b),f=e.partials[e.name](d,e)),null!=f){if(e.indent){for(var g=f.split("\n"),h=0,i=g.length;i>h&&(g[h]||h+1!==i);h++)g[h]=e.indent+g[h];f=g.join("\n")}return f}throw new o["default"]("The partial "+e.name+" could not be compiled when running in runtime-only mode")}function d(b){var c=void 0===arguments[1]?{}:arguments[1],f=c.data;
+ d._setup(c),!c.partial&&a.useData&&(f=j(b,f));var g=void 0,h=a.useBlockParams?[]:void 0;return a.useDepths&&(g=c.depths?[b].concat(c.depths):[b]),a.main.call(e,b,e.helpers,e.partials,f,h,g)}if(!b)throw new o["default"]("No environment passed to template");if(!a||!a.main)throw new o["default"]("Unknown template object: "+typeof a);b.VM.checkRevision(a.compiler);var e={strict:function(a,b){if(!(b in a))throw new o["default"]('"'+b+'" not defined in '+a);return a[b]},lookup:function(a,b){for(var c=a.length,d=0;c>d;d++)if(a[d]&&null!=a[d][b])return a[d][b]},lambda:function(a,b){return"function"==typeof a?a.call(b):a},escapeExpression:m.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b,c,d,e){var g=this.programs[a],h=this.fn(a);return b||e||d||c?g=f(this,a,h,b,c,d,e):g||(g=this.programs[a]=f(this,a,h)),g},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=m.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler};return d.isTop=!0,d._setup=function(c){c.partial?(e.helpers=c.helpers,e.partials=c.partials):(e.helpers=e.merge(c.helpers,b.helpers),a.usePartial&&(e.partials=e.merge(c.partials,b.partials)))},d._child=function(b,c,d,g){if(a.useBlockParams&&!d)throw new o["default"]("must pass block params");if(a.useDepths&&!g)throw new o["default"]("must pass parent depths");return f(e,b,a[b],c,0,d,g)},d}function f(a,b,c,d,e,f,g){function h(b){var e=void 0===arguments[1]?{}:arguments[1];return c.call(a,b,a.helpers,a.partials,e.data||d,f&&[e.blockParams].concat(f),g&&[b].concat(g))}return h.program=b,h.depth=g?g.length:0,h.blockParams=e||0,h}function g(a,b,c){return a?a.call||c.name||(c.name=a,a=c.partials[a]):a=c.partials[c.name],a}function h(a,b,c){if(c.partial=!0,void 0===a)throw new o["default"]("The partial "+c.name+" could not be found");return a instanceof Function?a(b,c):void 0}function i(){return""}function j(a,b){return b&&"root"in b||(b=b?p.createFrame(b):{},b.root=a),b}var k=c(8)["default"];b.__esModule=!0,b.checkRevision=d,b.template=e,b.wrapProgram=f,b.resolvePartial=g,b.invokePartial=h,b.noop=i;var l=c(12),m=k(l),n=c(11),o=k(n),p=c(9)},function(a,b){"use strict";b.__esModule=!0;var c=function(){function a(){this.yy={}}var b={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,content:12,COMMENT:13,CONTENT:14,openRawBlock:15,END_RAW_BLOCK:16,OPEN_RAW_BLOCK:17,helperName:18,openRawBlock_repetition0:19,openRawBlock_option0:20,CLOSE_RAW_BLOCK:21,openBlock:22,block_option0:23,closeBlock:24,openInverse:25,block_option1:26,OPEN_BLOCK:27,openBlock_repetition0:28,openBlock_option0:29,openBlock_option1:30,CLOSE:31,OPEN_INVERSE:32,openInverse_repetition0:33,openInverse_option0:34,openInverse_option1:35,openInverseChain:36,OPEN_INVERSE_CHAIN:37,openInverseChain_repetition0:38,openInverseChain_option0:39,openInverseChain_option1:40,inverseAndProgram:41,INVERSE:42,inverseChain:43,inverseChain_option0:44,OPEN_ENDBLOCK:45,OPEN:46,mustache_repetition0:47,mustache_option0:48,OPEN_UNESCAPED:49,mustache_repetition1:50,mustache_option1:51,CLOSE_UNESCAPED:52,OPEN_PARTIAL:53,partialName:54,partial_repetition0:55,partial_option0:56,param:57,sexpr:58,OPEN_SEXPR:59,sexpr_repetition0:60,sexpr_option0:61,CLOSE_SEXPR:62,hash:63,hash_repetition_plus0:64,hashSegment:65,ID:66,EQUALS:67,blockParams:68,OPEN_BLOCK_PARAMS:69,blockParams_repetition_plus0:70,CLOSE_BLOCK_PARAMS:71,path:72,dataName:73,STRING:74,NUMBER:75,BOOLEAN:76,UNDEFINED:77,NULL:78,DATA:79,pathSegments:80,SEP:81,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",13:"COMMENT",14:"CONTENT",16:"END_RAW_BLOCK",17:"OPEN_RAW_BLOCK",21:"CLOSE_RAW_BLOCK",27:"OPEN_BLOCK",31:"CLOSE",32:"OPEN_INVERSE",37:"OPEN_INVERSE_CHAIN",42:"INVERSE",45:"OPEN_ENDBLOCK",46:"OPEN",49:"OPEN_UNESCAPED",52:"CLOSE_UNESCAPED",53:"OPEN_PARTIAL",59:"OPEN_SEXPR",62:"CLOSE_SEXPR",66:"ID",67:"EQUALS",69:"OPEN_BLOCK_PARAMS",71:"CLOSE_BLOCK_PARAMS",74:"STRING",75:"NUMBER",76:"BOOLEAN",77:"UNDEFINED",78:"NULL",79:"DATA",81:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[12,1],[10,3],[15,5],[9,4],[9,4],[22,6],[25,6],[36,6],[41,2],[43,3],[43,1],[24,3],[8,5],[8,5],[11,5],[57,1],[57,1],[58,5],[63,1],[65,3],[68,3],[18,1],[18,1],[18,1],[18,1],[18,1],[18,1],[18,1],[54,1],[54,1],[73,2],[72,1],[80,3],[80,1],[6,0],[6,2],[19,0],[19,2],[20,0],[20,1],[23,0],[23,1],[26,0],[26,1],[28,0],[28,2],[29,0],[29,1],[30,0],[30,1],[33,0],[33,2],[34,0],[34,1],[35,0],[35,1],[38,0],[38,2],[39,0],[39,1],[40,0],[40,1],[44,0],[44,1],[47,0],[47,2],[48,0],[48,1],[50,0],[50,2],[51,0],[51,1],[55,0],[55,2],[56,0],[56,1],[60,0],[60,2],[61,0],[61,1],[64,1],[64,2],[70,1],[70,2]],performAction:function(a,b,c,d,e,f){var g=f.length-1;switch(e){case 1:return f[g-1];case 2:this.$=new d.Program(f[g],null,{},d.locInfo(this._$));break;case 3:this.$=f[g];break;case 4:this.$=f[g];break;case 5:this.$=f[g];break;case 6:this.$=f[g];break;case 7:this.$=f[g];break;case 8:this.$=new d.CommentStatement(d.stripComment(f[g]),d.stripFlags(f[g],f[g]),d.locInfo(this._$));break;case 9:this.$=new d.ContentStatement(f[g],d.locInfo(this._$));break;case 10:this.$=d.prepareRawBlock(f[g-2],f[g-1],f[g],this._$);break;case 11:this.$={path:f[g-3],params:f[g-2],hash:f[g-1]};break;case 12:this.$=d.prepareBlock(f[g-3],f[g-2],f[g-1],f[g],!1,this._$);break;case 13:this.$=d.prepareBlock(f[g-3],f[g-2],f[g-1],f[g],!0,this._$);break;case 14:this.$={path:f[g-4],params:f[g-3],hash:f[g-2],blockParams:f[g-1],strip:d.stripFlags(f[g-5],f[g])};break;case 15:this.$={path:f[g-4],params:f[g-3],hash:f[g-2],blockParams:f[g-1],strip:d.stripFlags(f[g-5],f[g])};break;case 16:this.$={path:f[g-4],params:f[g-3],hash:f[g-2],blockParams:f[g-1],strip:d.stripFlags(f[g-5],f[g])};break;case 17:this.$={strip:d.stripFlags(f[g-1],f[g-1]),program:f[g]};break;case 18:var h=d.prepareBlock(f[g-2],f[g-1],f[g],f[g],!1,this._$),i=new d.Program([h],null,{},d.locInfo(this._$));i.chained=!0,this.$={strip:f[g-2].strip,program:i,chain:!0};break;case 19:this.$=f[g];break;case 20:this.$={path:f[g-1],strip:d.stripFlags(f[g-2],f[g])};break;case 21:this.$=d.prepareMustache(f[g-3],f[g-2],f[g-1],f[g-4],d.stripFlags(f[g-4],f[g]),this._$);break;case 22:this.$=d.prepareMustache(f[g-3],f[g-2],f[g-1],f[g-4],d.stripFlags(f[g-4],f[g]),this._$);break;case 23:this.$=new d.PartialStatement(f[g-3],f[g-2],f[g-1],d.stripFlags(f[g-4],f[g]),d.locInfo(this._$));break;case 24:this.$=f[g];break;case 25:this.$=f[g];break;case 26:this.$=new d.SubExpression(f[g-3],f[g-2],f[g-1],d.locInfo(this._$));break;case 27:this.$=new d.Hash(f[g],d.locInfo(this._$));break;case 28:this.$=new d.HashPair(d.id(f[g-2]),f[g],d.locInfo(this._$));break;case 29:this.$=d.id(f[g-1]);break;case 30:this.$=f[g];break;case 31:this.$=f[g];break;case 32:this.$=new d.StringLiteral(f[g],d.locInfo(this._$));break;case 33:this.$=new d.NumberLiteral(f[g],d.locInfo(this._$));break;case 34:this.$=new d.BooleanLiteral(f[g],d.locInfo(this._$));break;case 35:this.$=new d.UndefinedLiteral(d.locInfo(this._$));break;case 36:this.$=new d.NullLiteral(d.locInfo(this._$));break;case 37:this.$=f[g];break;case 38:this.$=f[g];break;case 39:this.$=d.preparePath(!0,f[g],this._$);break;case 40:this.$=d.preparePath(!1,f[g],this._$);break;case 41:f[g-2].push({part:d.id(f[g]),original:f[g],separator:f[g-1]}),this.$=f[g-2];break;case 42:this.$=[{part:d.id(f[g]),original:f[g]}];break;case 43:this.$=[];break;case 44:f[g-1].push(f[g]);break;case 45:this.$=[];break;case 46:f[g-1].push(f[g]);break;case 53:this.$=[];break;case 54:f[g-1].push(f[g]);break;case 59:this.$=[];break;case 60:f[g-1].push(f[g]);break;case 65:this.$=[];break;case 66:f[g-1].push(f[g]);break;case 73:this.$=[];break;case 74:f[g-1].push(f[g]);break;case 77:this.$=[];break;case 78:f[g-1].push(f[g]);break;case 81:this.$=[];break;case 82:f[g-1].push(f[g]);break;case 85:this.$=[];break;case 86:f[g-1].push(f[g]);break;case 89:this.$=[f[g]];break;case 90:f[g-1].push(f[g]);break;case 91:this.$=[f[g]];break;case 92:f[g-1].push(f[g])}},table:[{3:1,4:2,5:[2,43],6:3,13:[2,43],14:[2,43],17:[2,43],27:[2,43],32:[2,43],46:[2,43],49:[2,43],53:[2,43]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:[1,11],14:[1,18],15:16,17:[1,21],22:14,25:15,27:[1,19],32:[1,20],37:[2,2],42:[2,2],45:[2,2],46:[1,12],49:[1,13],53:[1,17]},{1:[2,1]},{5:[2,44],13:[2,44],14:[2,44],17:[2,44],27:[2,44],32:[2,44],37:[2,44],42:[2,44],45:[2,44],46:[2,44],49:[2,44],53:[2,44]},{5:[2,3],13:[2,3],14:[2,3],17:[2,3],27:[2,3],32:[2,3],37:[2,3],42:[2,3],45:[2,3],46:[2,3],49:[2,3],53:[2,3]},{5:[2,4],13:[2,4],14:[2,4],17:[2,4],27:[2,4],32:[2,4],37:[2,4],42:[2,4],45:[2,4],46:[2,4],49:[2,4],53:[2,4]},{5:[2,5],13:[2,5],14:[2,5],17:[2,5],27:[2,5],32:[2,5],37:[2,5],42:[2,5],45:[2,5],46:[2,5],49:[2,5],53:[2,5]},{5:[2,6],13:[2,6],14:[2,6],17:[2,6],27:[2,6],32:[2,6],37:[2,6],42:[2,6],45:[2,6],46:[2,6],49:[2,6],53:[2,6]},{5:[2,7],13:[2,7],14:[2,7],17:[2,7],27:[2,7],32:[2,7],37:[2,7],42:[2,7],45:[2,7],46:[2,7],49:[2,7],53:[2,7]},{5:[2,8],13:[2,8],14:[2,8],17:[2,8],27:[2,8],32:[2,8],37:[2,8],42:[2,8],45:[2,8],46:[2,8],49:[2,8],53:[2,8]},{18:22,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{18:33,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{4:34,6:3,13:[2,43],14:[2,43],17:[2,43],27:[2,43],32:[2,43],37:[2,43],42:[2,43],45:[2,43],46:[2,43],49:[2,43],53:[2,43]},{4:35,6:3,13:[2,43],14:[2,43],17:[2,43],27:[2,43],32:[2,43],42:[2,43],45:[2,43],46:[2,43],49:[2,43],53:[2,43]},{12:36,14:[1,18]},{18:38,54:37,58:39,59:[1,40],66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{5:[2,9],13:[2,9],14:[2,9],16:[2,9],17:[2,9],27:[2,9],32:[2,9],37:[2,9],42:[2,9],45:[2,9],46:[2,9],49:[2,9],53:[2,9]},{18:41,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{18:42,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{18:43,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{31:[2,73],47:44,59:[2,73],66:[2,73],74:[2,73],75:[2,73],76:[2,73],77:[2,73],78:[2,73],79:[2,73]},{21:[2,30],31:[2,30],52:[2,30],59:[2,30],62:[2,30],66:[2,30],69:[2,30],74:[2,30],75:[2,30],76:[2,30],77:[2,30],78:[2,30],79:[2,30]},{21:[2,31],31:[2,31],52:[2,31],59:[2,31],62:[2,31],66:[2,31],69:[2,31],74:[2,31],75:[2,31],76:[2,31],77:[2,31],78:[2,31],79:[2,31]},{21:[2,32],31:[2,32],52:[2,32],59:[2,32],62:[2,32],66:[2,32],69:[2,32],74:[2,32],75:[2,32],76:[2,32],77:[2,32],78:[2,32],79:[2,32]},{21:[2,33],31:[2,33],52:[2,33],59:[2,33],62:[2,33],66:[2,33],69:[2,33],74:[2,33],75:[2,33],76:[2,33],77:[2,33],78:[2,33],79:[2,33]},{21:[2,34],31:[2,34],52:[2,34],59:[2,34],62:[2,34],66:[2,34],69:[2,34],74:[2,34],75:[2,34],76:[2,34],77:[2,34],78:[2,34],79:[2,34]},{21:[2,35],31:[2,35],52:[2,35],59:[2,35],62:[2,35],66:[2,35],69:[2,35],74:[2,35],75:[2,35],76:[2,35],77:[2,35],78:[2,35],79:[2,35]},{21:[2,36],31:[2,36],52:[2,36],59:[2,36],62:[2,36],66:[2,36],69:[2,36],74:[2,36],75:[2,36],76:[2,36],77:[2,36],78:[2,36],79:[2,36]},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],78:[2,40],79:[2,40],81:[1,45]},{66:[1,32],80:46},{21:[2,42],31:[2,42],52:[2,42],59:[2,42],62:[2,42],66:[2,42],69:[2,42],74:[2,42],75:[2,42],76:[2,42],77:[2,42],78:[2,42],79:[2,42],81:[2,42]},{50:47,52:[2,77],59:[2,77],66:[2,77],74:[2,77],75:[2,77],76:[2,77],77:[2,77],78:[2,77],79:[2,77]},{23:48,36:50,37:[1,52],41:51,42:[1,53],43:49,45:[2,49]},{26:54,41:55,42:[1,53],45:[2,51]},{16:[1,56]},{31:[2,81],55:57,59:[2,81],66:[2,81],74:[2,81],75:[2,81],76:[2,81],77:[2,81],78:[2,81],79:[2,81]},{31:[2,37],59:[2,37],66:[2,37],74:[2,37],75:[2,37],76:[2,37],77:[2,37],78:[2,37],79:[2,37]},{31:[2,38],59:[2,38],66:[2,38],74:[2,38],75:[2,38],76:[2,38],77:[2,38],78:[2,38],79:[2,38]},{18:58,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{28:59,31:[2,53],59:[2,53],66:[2,53],69:[2,53],74:[2,53],75:[2,53],76:[2,53],77:[2,53],78:[2,53],79:[2,53]},{31:[2,59],33:60,59:[2,59],66:[2,59],69:[2,59],74:[2,59],75:[2,59],76:[2,59],77:[2,59],78:[2,59],79:[2,59]},{19:61,21:[2,45],59:[2,45],66:[2,45],74:[2,45],75:[2,45],76:[2,45],77:[2,45],78:[2,45],79:[2,45]},{18:65,31:[2,75],48:62,57:63,58:66,59:[1,40],63:64,64:67,65:68,66:[1,69],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{66:[1,70]},{21:[2,39],31:[2,39],52:[2,39],59:[2,39],62:[2,39],66:[2,39],69:[2,39],74:[2,39],75:[2,39],76:[2,39],77:[2,39],78:[2,39],79:[2,39],81:[1,45]},{18:65,51:71,52:[2,79],57:72,58:66,59:[1,40],63:73,64:67,65:68,66:[1,69],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{24:74,45:[1,75]},{45:[2,50]},{4:76,6:3,13:[2,43],14:[2,43],17:[2,43],27:[2,43],32:[2,43],37:[2,43],42:[2,43],45:[2,43],46:[2,43],49:[2,43],53:[2,43]},{45:[2,19]},{18:77,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{4:78,6:3,13:[2,43],14:[2,43],17:[2,43],27:[2,43],32:[2,43],45:[2,43],46:[2,43],49:[2,43],53:[2,43]},{24:79,45:[1,75]},{45:[2,52]},{5:[2,10],13:[2,10],14:[2,10],17:[2,10],27:[2,10],32:[2,10],37:[2,10],42:[2,10],45:[2,10],46:[2,10],49:[2,10],53:[2,10]},{18:65,31:[2,83],56:80,57:81,58:66,59:[1,40],63:82,64:67,65:68,66:[1,69],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{59:[2,85],60:83,62:[2,85],66:[2,85],74:[2,85],75:[2,85],76:[2,85],77:[2,85],78:[2,85],79:[2,85]},{18:65,29:84,31:[2,55],57:85,58:66,59:[1,40],63:86,64:67,65:68,66:[1,69],69:[2,55],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{18:65,31:[2,61],34:87,57:88,58:66,59:[1,40],63:89,64:67,65:68,66:[1,69],69:[2,61],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{18:65,20:90,21:[2,47],57:91,58:66,59:[1,40],63:92,64:67,65:68,66:[1,69],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{31:[1,93]},{31:[2,74],59:[2,74],66:[2,74],74:[2,74],75:[2,74],76:[2,74],77:[2,74],78:[2,74],79:[2,74]},{31:[2,76]},{21:[2,24],31:[2,24],52:[2,24],59:[2,24],62:[2,24],66:[2,24],69:[2,24],74:[2,24],75:[2,24],76:[2,24],77:[2,24],78:[2,24],79:[2,24]},{21:[2,25],31:[2,25],52:[2,25],59:[2,25],62:[2,25],66:[2,25],69:[2,25],74:[2,25],75:[2,25],76:[2,25],77:[2,25],78:[2,25],79:[2,25]},{21:[2,27],31:[2,27],52:[2,27],62:[2,27],65:94,66:[1,95],69:[2,27]},{21:[2,89],31:[2,89],52:[2,89],62:[2,89],66:[2,89],69:[2,89]},{21:[2,42],31:[2,42],52:[2,42],59:[2,42],62:[2,42],66:[2,42],67:[1,96],69:[2,42],74:[2,42],75:[2,42],76:[2,42],77:[2,42],78:[2,42],79:[2,42],81:[2,42]},{21:[2,41],31:[2,41],52:[2,41],59:[2,41],62:[2,41],66:[2,41],69:[2,41],74:[2,41],75:[2,41],76:[2,41],77:[2,41],78:[2,41],79:[2,41],81:[2,41]},{52:[1,97]},{52:[2,78],59:[2,78],66:[2,78],74:[2,78],75:[2,78],76:[2,78],77:[2,78],78:[2,78],79:[2,78]},{52:[2,80]},{5:[2,12],13:[2,12],14:[2,12],17:[2,12],27:[2,12],32:[2,12],37:[2,12],42:[2,12],45:[2,12],46:[2,12],49:[2,12],53:[2,12]},{18:98,66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{36:50,37:[1,52],41:51,42:[1,53],43:100,44:99,45:[2,71]},{31:[2,65],38:101,59:[2,65],66:[2,65],69:[2,65],74:[2,65],75:[2,65],76:[2,65],77:[2,65],78:[2,65],79:[2,65]},{45:[2,17]},{5:[2,13],13:[2,13],14:[2,13],17:[2,13],27:[2,13],32:[2,13],37:[2,13],42:[2,13],45:[2,13],46:[2,13],49:[2,13],53:[2,13]},{31:[1,102]},{31:[2,82],59:[2,82],66:[2,82],74:[2,82],75:[2,82],76:[2,82],77:[2,82],78:[2,82],79:[2,82]},{31:[2,84]},{18:65,57:104,58:66,59:[1,40],61:103,62:[2,87],63:105,64:67,65:68,66:[1,69],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{30:106,31:[2,57],68:107,69:[1,108]},{31:[2,54],59:[2,54],66:[2,54],69:[2,54],74:[2,54],75:[2,54],76:[2,54],77:[2,54],78:[2,54],79:[2,54]},{31:[2,56],69:[2,56]},{31:[2,63],35:109,68:110,69:[1,108]},{31:[2,60],59:[2,60],66:[2,60],69:[2,60],74:[2,60],75:[2,60],76:[2,60],77:[2,60],78:[2,60],79:[2,60]},{31:[2,62],69:[2,62]},{21:[1,111]},{21:[2,46],59:[2,46],66:[2,46],74:[2,46],75:[2,46],76:[2,46],77:[2,46],78:[2,46],79:[2,46]},{21:[2,48]},{5:[2,21],13:[2,21],14:[2,21],17:[2,21],27:[2,21],32:[2,21],37:[2,21],42:[2,21],45:[2,21],46:[2,21],49:[2,21],53:[2,21]},{21:[2,90],31:[2,90],52:[2,90],62:[2,90],66:[2,90],69:[2,90]},{67:[1,96]},{18:65,57:112,58:66,59:[1,40],66:[1,32],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{5:[2,22],13:[2,22],14:[2,22],17:[2,22],27:[2,22],32:[2,22],37:[2,22],42:[2,22],45:[2,22],46:[2,22],49:[2,22],53:[2,22]},{31:[1,113]},{45:[2,18]},{45:[2,72]},{18:65,31:[2,67],39:114,57:115,58:66,59:[1,40],63:116,64:67,65:68,66:[1,69],69:[2,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,28],78:[1,29],79:[1,31],80:30},{5:[2,23],13:[2,23],14:[2,23],17:[2,23],27:[2,23],32:[2,23],37:[2,23],42:[2,23],45:[2,23],46:[2,23],49:[2,23],53:[2,23]},{62:[1,117]},{59:[2,86],62:[2,86],66:[2,86],74:[2,86],75:[2,86],76:[2,86],77:[2,86],78:[2,86],79:[2,86]},{62:[2,88]},{31:[1,118]},{31:[2,58]},{66:[1,120],70:119},{31:[1,121]},{31:[2,64]},{14:[2,11]},{21:[2,28],31:[2,28],52:[2,28],62:[2,28],66:[2,28],69:[2,28]},{5:[2,20],13:[2,20],14:[2,20],17:[2,20],27:[2,20],32:[2,20],37:[2,20],42:[2,20],45:[2,20],46:[2,20],49:[2,20],53:[2,20]},{31:[2,69],40:122,68:123,69:[1,108]},{31:[2,66],59:[2,66],66:[2,66],69:[2,66],74:[2,66],75:[2,66],76:[2,66],77:[2,66],78:[2,66],79:[2,66]},{31:[2,68],69:[2,68]},{21:[2,26],31:[2,26],52:[2,26],59:[2,26],62:[2,26],66:[2,26],69:[2,26],74:[2,26],75:[2,26],76:[2,26],77:[2,26],78:[2,26],79:[2,26]},{13:[2,14],14:[2,14],17:[2,14],27:[2,14],32:[2,14],37:[2,14],42:[2,14],45:[2,14],46:[2,14],49:[2,14],53:[2,14]},{66:[1,125],71:[1,124]},{66:[2,91],71:[2,91]},{13:[2,15],14:[2,15],17:[2,15],27:[2,15],32:[2,15],42:[2,15],45:[2,15],46:[2,15],49:[2,15],53:[2,15]},{31:[1,126]},{31:[2,70]},{31:[2,29]},{66:[2,92],71:[2,92]},{13:[2,16],14:[2,16],17:[2,16],27:[2,16],32:[2,16],37:[2,16],42:[2,16],45:[2,16],46:[2,16],49:[2,16],53:[2,16]}],defaultActions:{4:[2,1],49:[2,50],51:[2,19],55:[2,52],64:[2,76],73:[2,80],78:[2,17],82:[2,84],92:[2,48],99:[2,18],100:[2,72],105:[2,88],107:[2,58],110:[2,64],111:[2,11],123:[2,70],124:[2,29]},parseError:function(a){throw new Error(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||1,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;f.push(l);var m=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var n,o,p,q,r,s,t,u,v,w={};;){if(p=d[d.length-1],this.defaultActions[p]?q=this.defaultActions[p]:((null===n||"undefined"==typeof n)&&(n=b()),q=g[p]&&g[p][n]),"undefined"==typeof q||!q.length||!q[0]){var x="";if(!k){v=[];for(s in g[p])this.terminals_[s]&&s>2&&v.push("'"+this.terminals_[s]+"'");x=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(i+1)+": Unexpected "+(1==n?"end of input":"'"+(this.terminals_[n]||n)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:l,expected:v})}}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+n);switch(q[0]){case 1:d.push(n),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(q[1]),n=null,o?(n=o,o=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,l=this.lexer.yylloc,k>0&&k--);break;case 2:if(t=this.productions_[q[1]][1],w.$=e[e.length-t],w._$={first_line:f[f.length-(t||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(t||1)].first_column,last_column:f[f.length-1].last_column},m&&(w._$.range=[f[f.length-(t||1)].range[0],f[f.length-1].range[1]]),r=this.performAction.call(w,h,j,i,this.yy,q[1],e,f),"undefined"!=typeof r)return r;t&&(d=d.slice(0,-1*t*2),e=e.slice(0,-1*t),f=f.slice(0,-1*t)),d.push(this.productions_[q[1]][0]),e.push(w.$),f.push(w._$),u=g[d[d.length-2]][d[d.length-1]],d.push(u);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),g=0;gb[0].length)||(b=c,d=g,this.options.flex));g++);return b?(e=b[0].match(/(?:\r\n?|\n).*/g),e&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,f[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substr(a,b.yyleng-c)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 14;break;case 1:return 14;case 2:return this.popState(),14;case 3:return b.yytext=b.yytext.substr(5,b.yyleng-9),this.popState(),16;case 4:return 14;case 5:return this.popState(),13;case 6:return 59;case 7:return 62;case 8:return 17;case 9:return this.popState(),this.begin("raw"),21;case 10:return 53;case 11:return 27;case 12:return 45;case 13:return this.popState(),42;case 14:return this.popState(),42;case 15:return 32;case 16:return 37;case 17:return 49;case 18:return 46;case 19:this.unput(b.yytext),this.popState(),this.begin("com");break;case 20:return this.popState(),13;case 21:return 46;case 22:return 67;case 23:return 66;case 24:return 66;case 25:return 81;case 26:break;case 27:return this.popState(),52;case 28:return this.popState(),31;case 29:return b.yytext=e(1,2).replace(/\\"/g,'"'),74;case 30:return b.yytext=e(1,2).replace(/\\'/g,"'"),74;case 31:return 79;case 32:return 76;case 33:return 76;case 34:return 77;case 35:return 78;case 36:return 75;case 37:return 69;case 38:return 71;case 39:return 66;case 40:return 66;case 41:return"INVALID";case 42:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[5],inclusive:!1},raw:{rules:[3,4],inclusive:!1},INITIAL:{rules:[0,1,42],inclusive:!0}},a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";function d(){}function e(a,b,c){void 0===b&&(b=a.length);var d=a[b-1],e=a[b-2];return d?"ContentStatement"===d.type?(e||!c?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(d.original):void 0:c}function f(a,b,c){void 0===b&&(b=-1);var d=a[b+1],e=a[b+2];return d?"ContentStatement"===d.type?(e||!c?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(d.original):void 0:c}function g(a,b,c){var d=a[null==b?0:b+1];if(d&&"ContentStatement"===d.type&&(c||!d.rightStripped)){var e=d.value;d.value=d.value.replace(c?/^\s+/:/^[ \t]*\r?\n?/,""),d.rightStripped=d.value!==e}}function h(a,b,c){var d=a[null==b?a.length-1:b-1];if(d&&"ContentStatement"===d.type&&(c||!d.leftStripped)){var e=d.value;return d.value=d.value.replace(c?/\s+$/:/[ \t]+$/,""),d.leftStripped=d.value!==e,d.leftStripped}}var i=c(8)["default"];b.__esModule=!0;var j=c(6),k=i(j);d.prototype=new k["default"],d.prototype.Program=function(a){var b=!this.isRootSeen;this.isRootSeen=!0;for(var c=a.body,d=0,i=c.length;i>d;d++){var j=c[d],k=this.accept(j);if(k){var l=e(c,d,b),m=f(c,d,b),n=k.openStandalone&&l,o=k.closeStandalone&&m,p=k.inlineStandalone&&l&&m;k.close&&g(c,d,!0),k.open&&h(c,d,!0),p&&(g(c,d),h(c,d)&&"PartialStatement"===j.type&&(j.indent=/([ \t]+$)/.exec(c[d-1].original)[1])),n&&(g((j.program||j.inverse).body),h(c,d)),o&&(g(c,d),h((j.inverse||j.program).body))}}return a},d.prototype.BlockStatement=function(a){this.accept(a.program),this.accept(a.inverse);var b=a.program||a.inverse,c=a.program&&a.inverse,d=c,i=c;if(c&&c.chained)for(d=c.body[0].program;i.chained;)i=i.body[i.body.length-1].program;var j={open:a.openStrip.open,close:a.closeStrip.close,openStandalone:f(b.body),closeStandalone:e((d||b).body)};if(a.openStrip.close&&g(b.body,null,!0),c){var k=a.inverseStrip;k.open&&h(b.body,null,!0),k.close&&g(d.body,null,!0),a.closeStrip.open&&h(i.body,null,!0),e(b.body)&&f(d.body)&&(h(b.body),g(d.body))}else a.closeStrip.open&&h(b.body,null,!0);return j},d.prototype.MustacheStatement=function(a){return a.strip},d.prototype.PartialStatement=d.prototype.CommentStatement=function(a){var b=a.strip||{};return{inlineStandalone:!0,open:b.open,close:b.close}},b["default"]=d,a.exports=b["default"]},function(a,b,c){"use strict";function d(a,b){this.source=a,this.start={line:b.first_line,column:b.first_column},this.end={line:b.last_line,column:b.last_column}}function e(a){return/^\[.*\]$/.test(a)?a.substr(1,a.length-2):a}function f(a,b){return{open:"~"===a.charAt(2),close:"~"===b.charAt(b.length-3)}}function g(a){return a.replace(/^\{\{~?\!-?-?/,"").replace(/-?-?~?\}\}$/,"")}function h(a,b,c){c=this.locInfo(c);for(var d=a?"@":"",e=[],f=0,g="",h=0,i=b.length;i>h;h++){var j=b[h].part,k=b[h].original!==j;if(d+=(b[h].separator||"")+j,k||".."!==j&&"."!==j&&"this"!==j)e.push(j);else{if(e.length>0)throw new n["default"]("Invalid path: "+d,{loc:c});".."===j&&(f++,g+="../")}}return new this.PathExpression(a,f,e,d,c)}function i(a,b,c,d,e,f){var g=d.charAt(3)||d.charAt(2),h="{"!==g&&"&"!==g;return new this.MustacheStatement(a,b,c,h,e,this.locInfo(f))}function j(a,b,c,d){if(a.path.original!==c){var e={loc:a.path.loc};throw new n["default"](a.path.original+" doesn't match "+c,e)}d=this.locInfo(d);var f=new this.Program([b],null,{},d);return new this.BlockStatement(a.path,a.params,a.hash,f,void 0,{},{},{},d)}function k(a,b,c,d,e,f){if(d&&d.path&&a.path.original!==d.path.original){var g={loc:a.path.loc};throw new n["default"](a.path.original+" doesn't match "+d.path.original,g)}b.blockParams=a.blockParams;var h=void 0,i=void 0;return c&&(c.chain&&(c.program.body[0].closeStrip=d.strip),i=c.strip,h=c.program),e&&(e=h,h=b,b=e),new this.BlockStatement(a.path,a.params,a.hash,b,h,a.strip,i,d&&d.strip,this.locInfo(f))}var l=c(8)["default"];b.__esModule=!0,b.SourceLocation=d,b.id=e,b.stripFlags=f,b.stripComment=g,b.preparePath=h,b.prepareMustache=i,b.prepareRawBlock=j,b.prepareBlock=k;var m=c(11),n=l(m)},function(a,b,c){"use strict";function d(a,b,c){if(f.isArray(a)){for(var d=[],e=0,g=a.length;g>e;e++)d.push(b.wrap(a[e],c));return d}return"boolean"==typeof a||"number"==typeof a?a+"":a}function e(a){this.srcFile=a,this.source=[]}b.__esModule=!0;var f=c(12),g=void 0;try{}catch(h){}g||(g=function(a,b,c,d){this.src="",d&&this.add(d)},g.prototype={add:function(a){f.isArray(a)&&(a=a.join("")),this.src+=a},prepend:function(a){f.isArray(a)&&(a=a.join("")),this.src=a+this.src},toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}}),e.prototype={prepend:function(a,b){this.source.unshift(this.wrap(a,b))},push:function(a,b){this.source.push(this.wrap(a,b))},merge:function(){var a=this.empty();return this.each(function(b){a.add([" ",b,"\n"])}),a},each:function(a){for(var b=0,c=this.source.length;c>b;b++)a(this.source[b])},empty:function(){var a=void 0===arguments[0]?this.currentLocation||{start:{}}:arguments[0];return new g(a.start.line,a.start.column,this.srcFile)},wrap:function(a){var b=void 0===arguments[1]?this.currentLocation||{start:{}}:arguments[1];return a instanceof g?a:(a=d(a,this,b),new g(b.start.line,b.start.column,this.srcFile,a))},functionCall:function(a,b,c){return c=this.generateList(c),this.wrap([a,b?"."+b+"(":"(",c,")"])},quotedString:function(a){return'"'+(a+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(a){var b=[];for(var c in a)if(a.hasOwnProperty(c)){var e=d(a[c],this);"undefined"!==e&&b.push([this.quotedString(c),":",e])
+ }var f=this.generateList(b);return f.prepend("{"),f.add("}"),f},generateList:function(a,b){for(var c=this.empty(b),e=0,f=a.length;f>e;e++)e&&c.add(","),c.add(d(a[e],this,b));return c},generateArray:function(a,b){var c=this.generateList(a,b);return c.prepend("["),c.add("]"),c}},b["default"]=e,a.exports=b["default"]}])});
+
+/***/ },
+/* 7 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(6)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Handlebars) {
+ // Handlebars helpers
+ Handlebars.registerHelper('concat', function() {
+ var size = (arguments.length - 1),
+ output = '';
+ for(var i = 0; i < size; i++) {
+ output += arguments[i];
+ };
+ return output;
+ });
+
+ Handlebars.registerHelper('number_format', function(value, block) {
+ return Number(value).toLocaleString();
+ });
+ Handlebars.registerHelper('date_format', function(timestamp, block) {
+ if(window.moment) {
+ if(timestamp === undefined || isNaN(timestamp) || timestamp <= 0) {
+ return;
+ }
+
+ // set date format
+ var f = block.hash.format || "MMM Do, YYYY";
+ // check if we passed a timestamp
+ if(parseInt(timestamp, 10) == timestamp) {
+ return moment.unix(timestamp).format(f);
+ } else {
+ return moment.utc(timestamp).format(f);
+ }
+ } else {
+ return timestamp;
+ };
+ });
+
+ Handlebars.registerHelper('cycle', function(value, block) {
+ var values = value.split(' ');
+ return values[block.data.index % (values.length + 1)];
+ });
+
+ Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
+ switch (operator) {
+ case '==':
+ return (v1 == v2) ? options.fn(this) : options.inverse(this);
+ case '===':
+ return (v1 === v2) ? options.fn(this) : options.inverse(this);
+ case '!=':
+ return (v1 != v2) ? options.fn(this) : options.inverse(this);
+ case '!==':
+ return (v1 !== v2) ? options.fn(this) : options.inverse(this);
+ case '<':
+ return (v1 < v2) ? options.fn(this) : options.inverse(this);
+ case '<=':
+ return (v1 <= v2) ? options.fn(this) : options.inverse(this);
+ case '>':
+ return (v1 > v2) ? options.fn(this) : options.inverse(this);
+ case '>=':
+ return (v1 >= v2) ? options.fn(this) : options.inverse(this);
+ case '&&':
+ return (v1 && v2) ? options.fn(this) : options.inverse(this);
+ case '||':
+ return (v1 || v2) ? options.fn(this) : options.inverse(this);
+ case 'in':
+ var values = v2.split(',');
+ return (v2.indexOf(v1) !== -1) ? options.fn(this) : options.inverse(this);
+ default:
+ return options.inverse(this);
+ }
+ });
+
+ Handlebars.registerHelper('nl2br', function(value, block) {
+ return value.gsub("\n", "
");
+ });
+
+ Handlebars.registerHelper('json_encode', function(value, block) {
+ return JSON.stringify(value);
+ });
+
+ Handlebars.registerHelper('json_decode', function(value, block) {
+ return JSON.parse(value);
+ });
+ Handlebars.registerHelper('url', function(value, block) {
+ var url = window.location.protocol + "//" + window.location.host + window.location.pathname;
+
+ return url + value;
+ });
+ Handlebars.registerHelper('emailFromMailto', function(value) {
+ var mailtoMatchingRegex = /^mailto\:/i;
+ if (typeof value === 'string' && value.match(mailtoMatchingRegex)) {
+ return value.replace(mailtoMatchingRegex, '');
+ } else {
+ return value;
+ }
+ });
+ Handlebars.registerHelper('lookup', function(obj, field, options) {
+ return obj && obj[field];
+ });
+
+
+ Handlebars.registerHelper('rsa_key', function(value, block) {
+ // extract all lines into an array
+ if(value === undefined) return '';
+
+ var lines = value.trim().split("\n");
+
+ // remove header & footer
+ lines.shift();
+ lines.pop();
+
+ // return concatenated lines
+ return lines.join('');
+ });
+
+ Handlebars.registerHelper('trim', function(value, block) {
+ if(value === null || value === undefined) return '';
+ return value.trim();
+ });
+
+ /**
+ * {{ellipsis}}
+ * From: https://github.com/assemble/handlebars-helpers
+ * @author: Jon Schlinkert
+ * Truncate the input string and removes all HTML tags
+ * @param {String} str The input string.
+ * @param {Number} limit The number of characters to limit the string.
+ * @param {String} append The string to append if charaters are omitted.
+ * @return {String} The truncated string.
+ */
+ Handlebars.registerHelper('ellipsis', function (str, limit, append) {
+ if (append === undefined) {
+ append = '';
+ }
+ var sanitized = str.replace(/(<([^>]+)>)/g, '');
+ if (sanitized.length > limit) {
+ return sanitized.substr(0, limit - append.length) + append;
+ } else {
+ return sanitized;
+ }
+ });
+
+ Handlebars.registerHelper('getNumber', function (string) {
+ return parseInt(string, 10);
+ });
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+
+
+/***/ }
+/******/ ]);
\ No newline at end of file
diff --git a/views/layout.html b/views/layout.html
index 9b9696ef49..7f1f062309 100644
--- a/views/layout.html
+++ b/views/layout.html
@@ -23,11 +23,7 @@
<%= javascript(
- 'ajax.js',
- 'notice.js',
- 'modal.js',
- 'lib/handlebars.min.js',
- 'handlebars_helpers.js'
+ 'src/admin.js'
)%>
diff --git a/webpack.config.js b/webpack.config.js
index 5e0113db9a..da9484949a 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -5,7 +5,7 @@ var path = require('path'),
module.exports = {
context: __dirname ,
entry: {
- mailpoet: './assets/js/mailpoet',
+ admin: './assets/js/admin.js',
},
output: {
path: './assets/js/src',
@@ -41,5 +41,8 @@ module.exports = {
alias: {
'hbs': 'handlebars-loader'
}
+ },
+ externals: {
+ 'jquery': 'jQuery',
}
};