System.register(["./index-c820db66.system.js","./index-dc84aac6.system.js","./index-2d937df8.system.js","./index-9ceb7f8c.system.js","./_commonjsHelpers-c8881874.system.js","./index-b0fe4e4c.system.js"],(function(e){"use strict";var t,i,s,r,n,a,d;return{setters:[function(e){t=e.r;i=e.j;s=e.h;r=e.g},function(e){n=e.A;a=e.d},function(e){d=e.d},function(){},function(){},function(){}],execute:function(){var o={Add:"Lägg till"};function l(e){return d.create({sv:o},e)}var u=".sc-ig-addresses-h{display:block}smoothly-trigger.sc-ig-addresses{display:inline-block;margin:5px}smoothly-icon.sc-ig-addresses{cursor:pointer;float:right;margin-top:-1.5em;padding-bottom:.5em;visibility:hidden}ig-address.sc-ig-addresses{clear:both}.sc-ig-addresses-h:hover smoothly-icon.sc-ig-addresses{visibility:visible}";var c=e("ig_addresses",function(){function e(e){t(this,e);this.changed=i(this,"changed",7);this.allowed=[];this.editing=undefined;this.adding=false}Object.defineProperty(e.prototype,"allowedArray",{get:function(){if(!this.allowedArrayValue)this.allowedArrayValue=Array.isArray(this.allowed)?this.allowed:this.allowed.split(" ");return this.allowedArrayValue},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"address",{get:function(){if(typeof this.value=="string")this.value=JSON.parse(this.value);return this.value},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"addresses",{get:function(){return n.is(this.address)?{primary:this.address}:Object.assign({},this.address)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"types",{get:function(){var e=this;return a.types.filter((function(t){return a.is(e.value)?!e.value[t]:n.is(e.value)?t!="primary":t}))},enumerable:false,configurable:true});e.prototype.componentWillLoad=function(){this.t=l(this.element)};e.prototype.onChange=function(e){if(n.is(e.detail)){var t=e.detail.type;var i=Object.assign({},e.detail);delete i.type;var s=void 0;if(t=="primary"&&n.is(this.address))s=i;else{s=Object.assign({},this.addresses);s[t]=i}this.changed.emit(this.value=s)}};e.prototype.onCreate=function(e){var t=e.detail.type;var i=e.detail.value;var s=this.addresses;s[t]=i;this.changed.emit(this.value=s);this.adding=false};e.prototype.onTrigger=function(e){if(e.detail.name=="add"&&typeof this.value!="string"){var t=this.addresses;var i=n.create("SE");var s=e.detail.value;t[s]=i;this.value=t}};e.prototype.onDelete=function(e){var t=e.detail;var i=Object.assign({},this.addresses);delete i[t];this.changed.emit(this.value=i)};e.prototype.render=function(){var e=this;var t=this.allowedArray.filter((function(t){return a.is(e.address)?e.address[t]==undefined:t!="primary"}));return[this.adding?s("ig-address-input",{onClose:function(){return e.adding=false},mode:"add",types:this.types,onCreate:function(t){return e.onCreate(t)}}):[],this.types.length>0?s("smoothly-icon",{name:"add-circle",toolTip:this.t("Add"),fill:"clear",size:"medium",color:"success",style:this.adding?{display:"none"}:{},onClick:function(){return e.adding=true}}):[],this.address?n.is(this.address)?s("ig-address",{mode:this.editing?"edit":"display",value:this.address,onEdit:function(t){return e.onChange(t)},onDelete:function(t){return e.onDelete(t)}}):a.map(this.address,(function(t,i){return s("ig-address",{mode:e.editing?"edit":"display",type:t,value:i,onEdit:function(t){return e.onChange(t)},onDelete:function(t){return e.onDelete(t)}})})):[],t.map((function(e){return s("smoothly-trigger",{color:"primary",fill:"clear",name:"add",value:e},"+",e)}))]};Object.defineProperty(e.prototype,"element",{get:function(){return r(this)},enumerable:false,configurable:true});return e}());c.style=u}}}));