var __awaiter=this&&this.__awaiter||function(t,e,i,r){function n(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,l){function o(t){try{a(r.next(t))}catch(t){l(t)}}function s(t){try{a(r["throw"](t))}catch(t){l(t)}}function a(t){t.done?i(t.value):n(t.value).then(o,s)}a((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},r,n,l,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(t){return function(e){return a([t,e])}}function a(o){if(r)throw new TypeError("Generator is already executing.");while(i)try{if(r=1,n&&(l=o[0]&2?n["return"]:o[0]?n["throw"]||((l=n["return"])&&l.call(n),0):n.next)&&!(l=l.call(n,o[1])).done)return l;if(n=0,l)o=[o[0]&2,l.value];switch(o[0]){case 0:case 1:l=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;n=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(l=i.trys,l=l.length>0&&l[l.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!l||o[1]>l[0]&&o[1]<l[3])){i.label=o[1];break}if(o[0]===6&&i.label<l[1]){i.label=l[1];l=o;break}if(l&&i.label<l[2]){i.label=l[2];i.ops.push(o);break}if(l[2])i.ops.pop();i.trys.pop();continue}o=e.call(t,i)}catch(t){o=[6,t];n=0}finally{r=l=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};System.register(["./index-c820db66.system.js","./index-9ceb7f8c.system.js","./index-2d937df8.system.js","./_commonjsHelpers-c8881874.system.js"],(function(t){"use strict";var e,i,r,n,l,o;return{setters:[function(t){e=t.r;i=t.j;r=t.h;n=t.g},function(t){l=t.d},function(t){o=t.d},function(){}],execute:function(){var s={Filter:"Filtrera","Remove filter":"Ta bort filter","Apply filter":"Tillämpa filter"};function a(t){return o.create({sv:s},t)}var c=".sc-ig-filter-h{display:block;width:100%;max-width:90em;margin:auto}[hidden].sc-ig-filter-h{display:none}.sc-ig-filter-h>form.sc-ig-filter{border:1px solid rgb(var(--smoothly-medium-color));margin:0.2em 0 0.5em 0;clear:both}.sc-ig-filter-h>form.sc-ig-filter>ig-autocomplete-input.sc-ig-filter{width:calc(100% - 80px);display:inline-block}.sc-ig-filter-h>form.sc-ig-filter>smoothly-input.sc-ig-filter{width:calc(100% - 80px);display:inline-block}.sc-ig-filter-h>form.sc-ig-filter>smoothly-submit.sc-ig-filter{display:inline-block}";var u=t("ig_filter",function(){function t(t){e(this,t);this.filterChanged=i(this,"filterChanged",7);this.textEntered=false;this.criteriaString=""}t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.t=a(this.element);return[2]}))}))};t.prototype.checkTextEntered=function(){var t=this.inputElement;if(f(t))this.textEntered=t.value!=""};t.prototype.onFilter=function(t){this.criteriaString=t.detail.filter;this.applyFilter();this.checkTextEntered()};t.prototype.criteriaStringChanged=function(){var t=this.inputElement;if(f(t))t.value=this.criteriaString;this.textEntered=true;this.applyFilter()};t.prototype.applyFilter=function(t){this.filter=t||l.and(l.parse(this.criteriaString)).generalize();this.filterChanged.emit(this.value?l.filter(this.filter,this.value):this.filter)};t.prototype.reset=function(){this.criteriaString="";this.applyFilter();var t=this.inputElement;if(f(t))t.value="";this.textEntered=false};t.prototype.render=function(){var t=this;return r("form",null,r("ig-autocomplete-input",{template:this.template,ref:function(e){return t.inputElement=e},name:"filter",onKeyDown:this.checkTextEntered.bind(this)},this.t("Filter")),r("smoothly-submit",{fill:"clear",prevent:true,onSubmit:function(e){return t.onFilter(e)},style:{visibility:this.textEntered?"visible":"hidden"}},r("smoothly-icon",{toolTip:this.t("Apply filter"),name:"search",size:"small"})),r("smoothly-submit",{fill:"clear",prevent:true,onSubmit:function(){return t.reset()}},r("smoothly-icon",{toolTip:this.t("Remove filter"),size:"small",name:"backspace"})))};Object.defineProperty(t.prototype,"element",{get:function(){return n(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{criteriaString:["criteriaStringChanged"]}},enumerable:false,configurable:true});return t}());function f(t){return t.value==undefined||typeof t.value==="string"}u.style=c}}}));