"use strict";

exports.__esModule = true;
exports.default = undefined;

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; }; }();

var _akutils = require("akutils");

var _es6Symbol = require("es6-symbol");

var _es6Symbol2 = _interopRequireDefault(_es6Symbol);

var _Shadow2 = require("./Shadow");

var _Shadow3 = _interopRequireDefault(_Shadow2);

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"); } }

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; }

/**
	Default shadow api for the `MapProperty`. Exposes the {@link Map} interface.

	@see {@link MapProperty}
*/

var MapShadow = function (_Shadow) {
	_inherits(MapShadow, _Shadow);

	function MapShadow(impl) {
		_classCallCheck(this, MapShadow);

		return _possibleConstructorReturn(this, Object.getPrototypeOf(MapShadow).call(this, impl));
	}

	//------------------------------------------------------------------------------------------------------
	// Select Map methods (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
	//------------------------------------------------------------------------------------------------------

	_createClass(MapShadow, [{
		key: "clear",
		value: function clear() {
			this.__().clear();
		}
	}, {
		key: "delete",
		value: function _delete(key) {
			return this.__().delete(key);
		}
	}, {
		key: "entries",
		value: function entries() {
			var _this2 = this;

			return (0, _akutils.iterateOver)(this.__().keys(), function (key) {
				return [key, _this2.get(key)];
			});
		}
	}, {
		key: "get",
		value: function get(key) {
			var childImpl = this.__().get(key);

			return childImpl && childImpl.shadow();
		}
	}, {
		key: "has",
		value: function has(key) {
			return this.__().has(key);
		}
	}, {
		key: "keys",
		value: function keys() {
			return (0, _akutils.iteratorFor)(this.__().keys());
		}
	}, {
		key: "keysArray",
		value: function keysArray() {
			return this.__().keys();
		}
	}, {
		key: "set",
		value: function set(key, value) {
			return this.__().set(key, value);
		}
	}, {
		key: "values",
		value: function values() {
			var _this3 = this;

			return (0, _akutils.iterateOver)(this.__().keys(), function (key) {
				return _this3.get(key);
			});
		}
	}, {
		key: "valuesArray",
		value: function valuesArray() {
			return this.__().values().map(function (v) {
				return v.shadow();
			});
		}
	}, {
		key: _es6Symbol2.default.iterator,
		value: function value() {
			return this.entries();
		}
	}, {
		key: "size",
		get: function get() {
			return this.__().size();
		}
	}]);

	return MapShadow;
}(_Shadow3.default);

exports.default = MapShadow;