(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("jQuery")); else if(typeof define === 'function' && define.amd) define(["jQuery"], factory); else if(typeof exports === 'object') exports["app"] = factory(require("jQuery")); else root["app"] = factory(root["jQuery"]); })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__) { return webpackJsonpapp([4],[ /* 0 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_0__; /***/ }), /* 1 */, /* 2 */, /* 3 */, /* 4 */, /* 5 */, /* 6 */, /* 7 */, /* 8 */, /* 9 */, /* 10 */, /* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.userModule = exports.utilsModule = exports.commonModule = exports.dialogModule = undefined; var _common = __webpack_require__(90); var _common2 = _interopRequireDefault(_common); var _dialog = __webpack_require__(1); var _dialog2 = _interopRequireDefault(_dialog); var _user = __webpack_require__(45); var _user2 = _interopRequireDefault(_user); var _utils = __webpack_require__(56); var _utils2 = _interopRequireDefault(_utils); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.dialogModule = _dialog2.default; exports.commonModule = _common2.default; exports.utilsModule = _utils2.default; exports.userModule = _user2.default; /***/ }), /* 12 */, /* 13 */, /* 14 */, /* 15 */, /* 16 */, /* 17 */, /* 18 */, /* 19 */, /* 20 */, /* 21 */, /* 22 */, /* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _jquery = __webpack_require__(0); var _jquery2 = _interopRequireDefault(_jquery); var _rx = __webpack_require__(7); var Rx = _interopRequireWildcard(_rx); var _phraseanetCommon = __webpack_require__(11); var appCommons = _interopRequireWildcard(_phraseanetCommon); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Selectable = function Selectable(services, $container, options) { var configService = services.configService, localeService = services.localeService, appEvents = services.appEvents; var defaults = { allow_multiple: false, selector: '', callbackSelection: null, selectStart: null, selectStop: null, limit: null, localeService: localeService }; options = (typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object' ? options : {}; var $this = this; if ($container.data('selectionnable')) { /* this container is already selectionnable */ if (window.console) { console.error('Trying to apply new selection to existing one'); } return $container.data('selectionnable'); } this.stream = new Rx.Subject(); this.$container = $container; this.options = _jquery2.default.extend(defaults, options); this.datas = []; this.$container.data('selectionnable', this); this.$container.addClass('selectionnable'); this.$container.on('click', this.options.selector, function (event) { event.preventDefault(); if (typeof $this.options.selectStart === 'function') { $this.options.selectStart(_jquery2.default.extend(_jquery2.default.Event('selectStart'), event), $this); } var $that = (0, _jquery2.default)(this); var k = get_value($that, $this); if (appCommons.utilsModule.is_shift_key(event) && (0, _jquery2.default)('.last_selected', this.$container).filter($this.options.selector).length !== 0) { var lst = (0, _jquery2.default)($this.options.selector, this.$container); var index1 = _jquery2.default.inArray((0, _jquery2.default)('.last_selected', this.$container).filter($this.options.selector)[0], lst); var index2 = _jquery2.default.inArray($that[0], lst); if (index2 < index1) { var tmp = index1; index1 = index2 - 1 < 0 ? index2 : index2 - 1; index2 = tmp; } var stopped = false; if (index2 !== -1 && index1 !== -1) { var exp = $this.options.selector + ':gt(' + index1 + '):lt(' + (index2 - index1) + ')'; _jquery2.default.each((0, _jquery2.default)(exp, this.$container), function (i, n) { if (!(0, _jquery2.default)(n).hasClass('selected') && stopped === false) { if (!$this.hasReachLimit()) { var contain = get_value((0, _jquery2.default)(n), $this); $this.push(contain); (0, _jquery2.default)(n).addClass('selected'); } else { alert(localeService.t('max_record_selected')); stopped = true; } } }); } if ($this.has(k) === false && stopped === false) { if (!$this.hasReachLimit()) { $this.push(k); $that.addClass('selected'); } else { alert(localeService.t('max_record_selected')); } } } else { if (!appCommons.utilsModule.is_ctrl_key(event)) { $this.empty().push(k); (0, _jquery2.default)('.selected', this.$container).filter($this.options.selector).removeClass('selected'); $that.addClass('selected'); } else { if ($this.has(k) === true) { $this.remove(k); $that.removeClass('selected'); } else { if (!$this.hasReachLimit()) { $this.push(k); $that.addClass('selected'); } else { alert(localeService.t('max_record_selected')); } } } } (0, _jquery2.default)('.last_selected', this.$container).removeClass('last_selected'); $that.addClass('last_selected'); $this.stream.onNext({ asArray: $this.datas, serialized: $this.serialize() }); if (typeof $this.options.selectStop === 'function') { $this.options.selectStop(_jquery2.default.extend(_jquery2.default.Event('selectStop'), event), $this); } }); return this; }; function get_value(element, Selectable) { if (typeof Selectable.options.callbackSelection === 'function') { return Selectable.options.callbackSelection((0, _jquery2.default)(element)); } else { return (0, _jquery2.default)('input[name="id"]', (0, _jquery2.default)(element)).val(); } } Selectable.prototype = { push: function push(element) { if (this.options.allow_multiple === true || !this.has(element)) { this.datas.push(element); } return this; }, hasReachLimit: function hasReachLimit() { if (this.options.limit !== null && this.options.limit <= this.datas.length) { return true; } return false; }, remove: function remove(element) { this.datas = _jquery2.default.grep(this.datas, function (n) { return n !== element; }); return this; }, has: function has(element) { return _jquery2.default.inArray(element, this.datas) >= 0; }, get: function get() { return this.datas; }, empty: function empty() { var $this = this; this.datas = []; (0, _jquery2.default)(this.options.selector, this.$container).filter('.selected:visible').removeClass('selected'); if (typeof $this.options.selectStop === 'function') { $this.options.selectStop(_jquery2.default.Event('selectStop'), $this); } return this; }, length: function length() { return this.datas.length; }, size: function size() { return this.datas.length; }, serialize: function serialize(separator) { separator = separator || ';'; return this.datas.join(separator); }, selectAll: function selectAll() { this.select('*'); return this; }, select: function select(selector) { var $this = this; var stopped = false; (0, _jquery2.default)(this.options.selector, this.$container).filter(selector).not('.selected').filter(':visible').each(function () { if (!$this.hasReachLimit()) { $this.push(get_value(this, $this)); (0, _jquery2.default)(this).addClass('selected'); } else { if (stopped === false) { alert($this.options.localeService.t('max_record_selected')); } stopped = true; } }); $this.stream.onNext({ asArray: $this.datas, serialized: $this.serialize() }); if (typeof $this.options.selectStop === 'function') { $this.options.selectStop(_jquery2.default.Event('selectStop'), $this); } return this; } }; exports.default = Selectable; /***/ }), /* 24 */, /* 25 */, /* 26 */, /* 27 */, /* 28 */, /* 29 */, /* 30 */, /* 31 */, /* 32 */, /* 33 */, /* 34 */, /* 35 */, /* 36 */, /* 37 */, /* 38 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(jQuery) {/*** IMPORTS FROM imports-loader ***/ (function() { (function(window, $) { 'use strict'; // Builds a 4 characters unique id var uniqId = function(prefix) { prefix = prefix || ''; return prefix + ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).substr(-4); }; // Builds query parameters from a geoname object var RequestDataBuilder = function(geo, datas) { this.datas = datas || {}; if (!geo instanceof GeotoCompleter) { throw 'You must provide an instance of GeotoCompleter'; } if (geo.getOption('sort')) { this.datas.sort = geo.getOption('sort'); } if (geo.getOption('client-ip')) { this.datas.sortParams = geo.getOption('sortParams'); } if (geo.getOption('country')) { this.datas.country = geo.getOption('country'); } if (geo.getOption('name')) { this.datas.name = geo.getOption('name'); } if (geo.getOption('limit')) { this.datas.limit = geo.getOption('limit'); } }; RequestDataBuilder.prototype.getRequestDatas = function() { return this.datas; }; // Handles request to the remote Geonames Server var RequestManager = function(server) { var _request = false; var _endpoint = server; this.search = function(resource, datas, errorCallback, parseresults) { _request = $.ajax({ type: "GET", dataType: "jsonp", jsonpCallback: "parseresults", url: _endpoint + resource, beforeSend: function() { if (_request && typeof _request.abort === 'function') { _request.abort(); } }, error: errorCallback, data: datas }) .done(parseresults) .always(function() { _request = false; }); }; }; var GeotoCompleter = function(el, serverEndpoint, options) { if (typeof $.ui === 'undefined') { throw 'jQuery UI must be loaded'; } if($(el).data('geocompleter')) { return $(el).data('geocompleter'); } var _serverEndpoint = serverEndpoint.substr(serverEndpoint.length - 1) === '/' ? serverEndpoint : serverEndpoint + '/'; this._requestManager = new RequestManager(_serverEndpoint); this.$el = $(el); this._opts = $.extend({ "name": null, "sort": null, "client-ip": null, "country": null, "limit": null, "init-input": true }, options); this.$input = null; this.$el.data('geocompleter', this); }; GeotoCompleter.prototype.getOption = function(name) { if (!(name in this._opts)) { return null; } return this._opts[name]; }; GeotoCompleter.prototype.setOption = function(name, value) { if (!(name in this._opts)) { return this; } this._opts[name] = value; return this; }; GeotoCompleter.prototype.getAutocompleter = function() { return this.$input; }; GeotoCompleter.prototype.destroy = function() { if (this.$input) { this.$input.remove(); this.$el.show(); this.$el.val(''); this.$el.data('geocompleter', null); } }; GeotoCompleter.prototype.init = function() { if (null !== this.$input) { return; } var self = this; var updateGeonameField = function(value) { self.$el.val(value); }; var updateCityField = function(value) { self.$input.val(value); }; var resetGeonameField = function() { self.$el.val(''); }; var resetCityField = function() { self.$input.val(''); }; var isGeonameFieldSetted = function() { return self.$el.val() !== ''; }; var highlight = function (s, t) { var matcher = new RegExp("("+$.ui.autocomplete.escapeRegex(t)+")", "ig" ); return s.replace(matcher, "$1"); }; // Creates city input this.$input = $('') .attr('name', uniqId(this.$el.attr('name'))) .attr('id', uniqId(this.$el.attr('id'))) .attr('type', 'text') .attr('class', this.$el.attr('class')) .addClass("geocompleter-input"); // Prevents form submission when pressing ENTER this.$input.keypress(function(event) { var code = (event.keyCode ? event.keyCode : event.which); if(code === $.ui.keyCode.ENTER ) { event.preventDefault(); return false; } }); // On any keyup except (esc, up, down, enter) fields are desynchronised, reset geonames field this.$input.keyup(function(event) { var code = (event.keyCode ? event.keyCode : event.which); var unBindKeys = [ $.ui.keyCode.ESCAPE, $.ui.keyCode.UP, $.ui.keyCode.DOWN, $.ui.keyCode.LEFT, $.ui.keyCode.RIGHT, $.ui.keyCode.ENTER ]; if (-1 === $.inArray(code, unBindKeys)){ resetGeonameField(); } }); this.$el.hide(); this.$el.after(this.$input); // Overrides prototype to render values without autoescape, useful to highlight values $.ui.autocomplete.prototype._renderItem = function( ul, item) { return $( "
" ) .data( "item.autocomplete", item ) .append( $( "" ).html( item.label ) ) .appendTo( ul ); }; // Saves response content var responseContent; // Builds a jquery autocompleter this.$input.autocomplete({ create: function(event) { if(self.$el.val() !== "" && self.getOption("init-input")) { self._requestManager.search( "city/" + parseInt(self.$el.val(), 10), {}, function(jqXhr, status, error) { return; }, function (data) { var country = data.country.name || ""; self.$input.val(data.name + ("" !== country ? "," + country : "")); } ); } }, source: function(request, response) { var name, country, terms = ''; terms = request.term.split(','); if (terms.length === 2) { country = terms.pop(); } name = terms.pop(); self.setOption('name', $.trim(name)); self.setOption('country', $.trim(country)); var requestDataBuilder = new RequestDataBuilder(self); self._requestManager.search( "city", requestDataBuilder.getRequestDatas(), function(jqXhr, status, error) { if (jqXhr.status !== 0 && jqXhr.statusText !== 'abort') { response([]); self.$input.trigger('geotocompleter.request.error', [jqXhr, status, error]); } }, function(data) { response($.map(data || [], function(item) { var country = country ? country : name; var labelName = highlight(item.name, name); var labelCountry = highlight((item.country ? item.country.name || '' : ''), country); var labelRegion = highlight((item.region ? item.region.name || '' : ''), name); return { label: labelName + ("" !== labelCountry ? ", " + labelCountry : "") + ("" !== labelRegion ? " " + labelRegion + "" : ""), value: item.name + (item.country ? ", " + item.country.name : ''), geonameid: item.geonameid }; })); } ); }, messages: { noResults: '', results: function() {} }, response: function (event, ui) { responseContent = []; if (ui.content) { responseContent = ui.content; // Sets geoname id if values are re synchronized if (ui.content.length > 0) { var items = $.grep(ui.content, function(item) { return item.value === self.$input.val() ? item : null; }); if (items.length > 0) { updateGeonameField(items[0].geonameid); } } } }, select: function(event, ui) { if (ui.item) { updateGeonameField(ui.item.geonameid); } }, focus: function (event, ui) { var code = (event.keyCode ? event.keyCode : event.which); // Updates geoname ID only if key up and key down are pressed if (ui.item && -1 !== $.inArray(code, [$.ui.keyCode.DOWN, $.ui.keyCode.UP])) { updateGeonameField(ui.item.geonameid); } }, close : function (event, ui) { var ev = event.originalEvent; if ("undefined" === typeof ev) { return false; } var code = (ev.keyCode ? ev.keyCode : ev.which); // If esc key is pressed or user leaves the input if ((ev.type === "keydown" && code === $.ui.keyCode.ESCAPE) || ev.type === "blur") { if (isGeonameFieldSetted() && responseContent.length > 0) { var geonameId = self.$el.val(); // Update city input according to the setted geonameId var responseValues = $.grep(responseContent, function(item) { return item.geonameid === geonameId ? item : null; }); if (responseValues.length > 0) { self.$input.val(responseValues[0].value); } return false; } // Resets both field as nothing is no more sychronized resetGeonameField(); resetCityField(); } } }).autocomplete("widget").addClass("geocompleter-menu"); var onInit = self.getOption('onInit'); // On Initialization callback if (onInit !== null && typeof onInit === 'function') { onInit(this.$el, this.$input); } }; var methods = { init: function(options) { var settings = $.extend({ server: '' }, options); if ('' === settings.server) { throw '"server" must be set'; } return this.each(function() { var geocompleter = new GeotoCompleter(this, settings.server, settings); geocompleter.init(); }); }, destroy: function() { return this.each(function() { var geocompleter = $(this).data('geocompleter'); if (geocompleter) { geocompleter.destroy(); } }); }, autocompleter: function() { var args = arguments; return this.each(function() { var geocompleter = $(this).data('geocompleter'); if (args[0] === "on" && typeof args[1] === "string" && typeof args[2] === "function") { // Bind addition events geocompleter.getAutocompleter().on(args[1], args[2]); } else { $.fn.autocomplete.apply(geocompleter.getAutocompleter(),args); } }); } }; $.fn.geocompleter = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.geocompleter'); } }; })(window, jQuery); }.call(window)); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), /* 39 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateRandStr = exports.cleanTags = exports.escapeHtml = undefined; var _phraseanetCommon = __webpack_require__(11); var AppCommons = _interopRequireWildcard(_phraseanetCommon); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } var entityMap = { '&': '&', '<': '<', '>': '>', '"': '"', '\'': ''', '/': '/' }; var escapeHtml = function escapeHtml(string) { return String(string).replace(/[&<>"'\/]/g, function (s) { return entityMap[s]; }); }; // @TODO - check legacy code var cleanTags = function cleanTags(string) { var chars2replace = [{ f: '&', t: '&' }, { f: '<', t: '<' }, { f: '>', t: '>' }]; for (var c in chars2replace) { string = string.replace(RegExp(chars2replace[c].f, 'g'), chars2replace[c].t); } return string; }; var generateRandStr = function generateRandStr() { var sLength = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 5; var s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; return Array(sLength).join().split(',').map(function () { return s.charAt(Math.floor(Math.random() * s.length)); }).join(''); }; exports.escapeHtml = escapeHtml; exports.cleanTags = cleanTags; exports.generateRandStr = generateRandStr; /***/ }), /* 40 */ /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function(useSourceMap) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item, useSourceMap); if(item[2]) { return "@media " + item[2] + "{" + content + "}"; } else { return content; } }).join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if(typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for(var i = 0; i < this.length; i++) { var id = this[i][0]; if(typeof id === "number") alreadyImportedModules[id] = true; } for(i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if(mediaQuery && !item[2]) { item[2] = mediaQuery; } else if(mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; function cssWithMappingToString(item, useSourceMap) { var content = item[1] || ''; var cssMapping = item[3]; if (!cssMapping) { return content; } if (useSourceMap && typeof btoa === 'function') { var sourceMapping = toComment(cssMapping); var sourceURLs = cssMapping.sources.map(function (source) { return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' }); return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); } return [content].join('\n'); } // Adapted from convert-source-map (MIT) function toComment(sourceMap) { // eslint-disable-next-line no-undef var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; return '/*# ' + data + ' */'; } /***/ }), /* 41 */ /***/ (function(module, exports, __webpack_require__) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var stylesInDom = {}; var memoize = function (fn) { var memo; return function () { if (typeof memo === "undefined") memo = fn.apply(this, arguments); return memo; }; }; var isOldIE = memoize(function () { // Test for IE <= 9 as proposed by Browserhacks // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 // Tests for existence of standard globals is to allow style-loader // to operate correctly into non-standard environments // @see https://github.com/webpack-contrib/style-loader/issues/177 return window && document && document.all && !window.atob; }); var getElement = (function (fn) { var memo = {}; return function(selector) { if (typeof memo[selector] === "undefined") { memo[selector] = fn.call(this, selector); } return memo[selector] }; })(function (target) { return document.querySelector(target) }); var singleton = null; var singletonCounter = 0; var stylesInsertedAtTop = []; var fixUrls = __webpack_require__(153); module.exports = function(list, options) { if (typeof DEBUG !== "undefined" && DEBUG) { if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); } options = options || {}; options.attrs = typeof options.attrs === "object" ? options.attrs : {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of