(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
	value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var _yoast$analysis = yoast.analysis,
    Paper = _yoast$analysis.Paper,
    Researcher = _yoast$analysis.Researcher,
    AssessmentResult = _yoast$analysis.AssessmentResult,
    Assessment = _yoast$analysis.Assessment;

var LocalStoreLocatorContentAssessment = function (_Assessment) {
	_inherits(LocalStoreLocatorContentAssessment, _Assessment);

	function LocalStoreLocatorContentAssessment(settings) {
		_classCallCheck(this, LocalStoreLocatorContentAssessment);

		var _this = _possibleConstructorReturn(this, (LocalStoreLocatorContentAssessment.__proto__ || Object.getPrototypeOf(LocalStoreLocatorContentAssessment)).call(this));

		_this.settings = settings;
		return _this;
	}

	/**
  * Runs an assessment for scoring the presence of a store locator in the content.
  *
  * @param {Paper} paper The paper to run this assessment on.
  * @param {Researcher} researcher The researcher used for the assessment.
  * @param {Object} i18n The i18n-object used for parsing translations.
  *
  * @returns {object} an assessment result with the score and formatted text.
  */


	_createClass(LocalStoreLocatorContentAssessment, [{
		key: 'getResult',
		value: function getResult(paper, researcher, i18n) {
			var assessmentResult = new AssessmentResult();

			var storeLocator = new RegExp('<form action=["\']#wpseo-storelocator-form["\'] method=["\']post["\'] id=["\']wpseo-storelocator-form["\']>((.|[\n|\r|\r\n])*?)<div id=["\']wpseo-storelocator-results["\']>', 'ig');
			var contains = storeLocator.test(paper.getText());
			storeLocator.lastIndex = 0;
			var content = paper.getText().replace(storeLocator, '');
			var result = this.score(content, contains);

			assessmentResult.setScore(result.score);
			assessmentResult.setText(result.text);

			return assessmentResult;
		}

		/**
   * Scores the url based on the matches of the store locator.
   *
   * @param {string} content  The content outside of the store locator.
   * @param {bool}   contains Whether or not the content contains a store locator.
   *
   * @returns {{score: number, text: *}} An object containing the score and text
   */

	}, {
		key: 'score',
		value: function score(content, contains) {
			if (contains && content.length <= 200) {
				return {
					score: 6,
					text: this.settings.storelocator_content
				};
			}

			return {
				score: 9,
				text: ''
			};
		}
	}]);

	return LocalStoreLocatorContentAssessment;
}(Assessment);

exports.default = LocalStoreLocatorContentAssessment;

},{}],2:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global analysisWorker */


var _localStoreLocatorContentAssessment = require('./assessments/local-store-locator-content-assessment');

var _localStoreLocatorContentAssessment2 = _interopRequireDefault(_localStoreLocatorContentAssessment);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var LocalPagesWorker = function () {
	function LocalPagesWorker() {
		_classCallCheck(this, LocalPagesWorker);
	}

	_createClass(LocalPagesWorker, [{
		key: 'register',
		value: function register() {
			analysisWorker.registerMessageHandler('initializePages', this.initialize.bind(this), 'YoastLocalSEO');
		}
	}, {
		key: 'initialize',
		value: function initialize(settings) {
			this.storeLocatorContentAssessment = new _localStoreLocatorContentAssessment2.default(settings);

			analysisWorker.registerAssessment('localStorelocatorContent', this.storeLocatorContentAssessment, 'YoastLocalSEO');
		}
	}]);

	return LocalPagesWorker;
}();

var localPagesWorker = new LocalPagesWorker();

localPagesWorker.register();

},{"./assessments/local-store-locator-content-assessment":1}]},{},[2])
//# sourceMappingURL=data:application/json;charset=utf-8;base64, 
