System.register(["./p-fa844f8f.system.js"],function(t){"use strict";var e,i,n,l;return{setters:[function(t){e=t.r;i=t.c;n=t.h;l=t.g}],execute:function(){var o=function(){function t(t){e(this,t);this.value=[];this.change=i(this,"change",7)}t.prototype.componentWillLoad=function(){if(!this.value)this.value=[];this.computeMultiList()};t.prototype.componentWillUpdate=function(){if(!this.value)this.value=[];this.computeMultiList()};t.prototype.computeMultiList=function(){var t=this.maxElementsColumn?this.options.size/this.maxElementsColumn+this.options.size%this.maxElementsColumn:0;if(t>0){this.multiList=new Map;var e=Array.from(this.options.keys());for(var i=0;i<t;i++){var n=i*this.maxElementsColumn;var l=(i+1)*this.maxElementsColumn;this.multiList.set(i,e.slice(n,l<this.options.size?l:this.options.size))}}else{this.multiList=(new Map).set(0,Array.from(this.options.keys()))}};t.prototype.componentDidLoad=function(){this.displayValue()};t.prototype.componentDidUpdate=function(){this.displayValue()};t.prototype.openMultiSelectDialog=function(t){t.stopPropagation();t.preventDefault();this.multiSelectDialog.dialogTitle=this.dialogTitle;this.multiSelectDialog.toggle()};t.prototype.fillMultiSelectInput=function(){this.displayValue();this.change.emit()};t.prototype.displayValue=function(){var t=this;if(this.value){var e=this.value.map(function(e){return t.options.get(e)}).join(", ");this.multiSelectInput.componentOnReady().then(function(){t.multiSelectInput.value=e;t.multiSelectInput.title=e})}};t.prototype.toggleOption=function(t,e){t.stopPropagation();t.preventDefault();if(t.detail){this.value.push(e)}else{this.value.splice(this.value.indexOf(e),1)}};t.prototype.render=function(){var t=this;return[n("materials-text-field",{focused:!!this.value&&this.value.length>0,readonly:true,label:this.label,overflow:true,"trailing-icon":this.trailingIcon,dense:this.dense,ref:function(e){return t.multiSelectInput=e},onClick:function(e){return t.openMultiSelectDialog(e)}}),n("materials-dialog",{acceptButton:"Sélectionner",cancelButton:"Annuler","close-button":true,onAccept:function(){return t.fillMultiSelectInput()},ref:function(e){return t.multiSelectDialog=e}},n("div",{slot:"body",class:"body-list"},this.multiList&&Array.from(this.multiList.keys()).map(function(e){return n("materials-list",null,t.multiList.get(e).map(function(e){return n("materials-list-item-checkbox",{onChange:function(i){return t.toggleOption(i,e)},checked:t.value&&t.value.length>0&&!!t.value.find(function(t){return e===t}),label:t.options.get(e),value:e})}))})))]};Object.defineProperty(t.prototype,"host",{get:function(){return l(this)},enumerable:true,configurable:true});Object.defineProperty(t,"style",{get:function(){return":host{display:block;font-size:1rem}:host materials-text-field{text-overflow:ellipsis}:host .body-list{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}"},enumerable:true,configurable:true});return t}();t("materials_multiple_select",o)}}});