import{a as k}from"./chunk-VAGFBMPT.js";import{a as O}from"./chunk-GNDNM624.js";import{a as q}from"./chunk-FZWXCAEE.js";import{t as V}from"./chunk-E65EA4Y7.js";import{f as b}from"./chunk-Y5ITWXM5.js";import{D as B,La as R,_a as z,q as L,s as $,v as Q}from"./chunk-NNMVEAHQ.js";import{$b as x,Cb as w,Rc as E,Wb as I,Yb as N,ac as A,bc as c,cc as p,dc as d,id as h,jd as P,kb as v,lc as g,md as _,nc as m,nd as y,pc as C,ta as s,tc as S,ua as a,uc as F,vc as T}from"./chunk-PVUKHE45.js";var Y=["dropdown"],j=()=>[];function J(o,n){if(o&1){let r=g();p(0,"wk-dropdown",4,0),m("changed",function(t){s(r);let e=C();return a(e.changedSelection(t))}),d()}if(o&2){let r=C();c("value",r.dropdownValue())("multiple",r.isMultiple())("dataSource",r.item().dataSource)("displayFieldName",r.item().displayExpr??"name")("enableSearch",!0)("highlightSelectedItems",!1)("showClearButton",!1)("placeholder",r.item().label)("emptyMessage",r.emptyMessage)("label","")}}function W(o,n){if(o&1){let r=g();p(0,"wk-dropdown",5,0),m("changed",function(t){s(r);let e=C();return a(e.changedSelection(t))}),d()}if(o&2){let r=C();c("value",r.dropdownValue())("multiple",r.isMultiple())("options",r.item().options??E(10,j))("displayFieldName",r.displayFieldName)("enableSearch",!0)("highlightSelectedItems",!1)("showClearButton",!1)("placeholder",r.item().label)("emptyMessage",r.emptyMessage)("label","")}}var U=(()=>{let n=class n{constructor(){this.item=y.required(),this.selectionChanged=_(),this.displayFieldName="label",this.emptyMessage="\u041D\u0435\u0442 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u043E\u0432",this.icons=b,this.isDataSourceMode=h(()=>!!this.item().dataSource),this.isMultiple=h(()=>this.item().multiple??!0),this.isActive=h(()=>this.item().selectedIds.length>0),this.dropdownValue=h(()=>{let{selectedIds:i}=this.item();return this.isMultiple()?i:i[0]??null}),this.chipLabel=h(()=>{let{label:i,selectedIds:t,options:e,selectedLabels:l,dataSource:u}=this.item();if(!t.length)return i;if(u)return l?.[0]??i;let D=e?.find(K=>K.id===t[0])?.label??i;return t.length===1?D:`${i} +${t.length}`})}openDropdown(){this._dropdown?.open()}clearSelection(){this._dropdown?.close(),this.selectionChanged.emit({key:this.item().key,ids:[]})}changedSelection(i){let t=Array.isArray(i)?i.map(String):i?[String(i)]:[],e;if(this.isDataSourceMode()&&t.length&&this._dropdown){let l=this.item().displayExpr??"name";e=this._dropdown.selectedOptions().map(f=>String(f[l]??"")).filter(Boolean)}this.selectionChanged.emit({key:this.item().key,ids:t,labels:e})}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=w({type:n,selectors:[["bs-select-filter-chip"]],viewQuery:function(t,e){if(t&1&&S(Y,5),t&2){let l;F(l=T())&&(e._dropdown=l.first)}},hostAttrs:[1,"bs-select-filter-chip"],inputs:{item:[1,"item"]},outputs:{selectionChanged:"selectionChanged"},decls:3,vars:4,consts:[["dropdown",""],["variant","tertiary","size","small",3,"clicked","arrowClicked","rightIconClicked","label","arrow","rightIcon"],["size","small",3,"value","multiple","dataSource","displayFieldName","enableSearch","highlightSelectedItems","showClearButton","placeholder","emptyMessage","label"],["size","small",3,"value","multiple","options","displayFieldName","enableSearch","highlightSelectedItems","showClearButton","placeholder","emptyMessage","label"],["size","small",3,"changed","value","multiple","dataSource","displayFieldName","enableSearch","highlightSelectedItems","showClearButton","placeholder","emptyMessage","label"],["size","small",3,"changed","value","multiple","options","displayFieldName","enableSearch","highlightSelectedItems","showClearButton","placeholder","emptyMessage","label"]],template:function(t,e){t&1&&(p(0,"tis-chips",1),m("clicked",function(){return e.openDropdown()})("arrowClicked",function(){return e.openDropdown()})("rightIconClicked",function(){return e.clearSelection()}),d(),I(1,J,2,10,"wk-dropdown",2)(2,W,2,11,"wk-dropdown",3)),t&2&&(c("label",e.chipLabel())("arrow",!0)("rightIcon",e.isActive()?e.icons.Cross:null),v(),N(e.isDataSourceMode()?1:2))},dependencies:[R,k],styles:[`.bs-select-filter-chip{position:relative;display:inline-flex}.bs-select-filter-chip wk-dropdown{position:absolute;bottom:0;left:0;visibility:hidden;pointer-events:none;margin-bottom:0}.wk-popover__content wk-list-item{width:100%!important}
/*# sourceMappingURL=select-filter-chip.component-QXSGFMVI.css.map */
`],encapsulation:2,changeDetection:0});let o=n;return o})();var ee=["datePicker"],H=(()=>{let n=class n{constructor(){this.item=y.required(),this.selectionChanged=_(),this.icons=b,this.isActive=h(()=>!!this.item().dateFrom||!!this.item().dateTo),this.isSingle=h(()=>this.item().pickerType==="default"),this.datePickerValue=h(()=>this.isSingle()?this.item().dateFrom??this.item().dateTo:[this.item().dateFrom,this.item().dateTo]),this.chipLabel=h(()=>{let{label:i,dateFrom:t,dateTo:e,format:l}=this.item();if(!t&&!e)return i;let u=l==="time"?"HH:mm":"dd.MM.yyyy",f=t?V(t,u):null,D=e?V(e,u):null;return this.isSingle()?`${i}: ${f??D}`:f&&D?`${f} - ${D}`:`${i}: ${f??D}`})}openDatePicker(){this._datePicker.openPicker()}clearSelection(){this.selectionChanged.emit({key:this.item().key,dateFrom:null,dateTo:null})}changedDate(i){if(this.isSingle()){let t=Array.isArray(i)?i[0]??null:i??null;this.selectionChanged.emit({key:this.item().key,dateFrom:t,dateTo:null});return}Array.isArray(i)&&this.selectionChanged.emit({key:this.item().key,dateFrom:i[0]??null,dateTo:i[1]??null})}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=w({type:n,selectors:[["bs-date-filter-chip"]],viewQuery:function(t,e){if(t&1&&S(ee,5),t&2){let l;F(l=T())&&(e._datePicker=l.first)}},hostAttrs:[1,"bs-date-filter-chip"],inputs:{item:[1,"item"]},outputs:{selectionChanged:"selectionChanged"},decls:3,vars:9,consts:[["datePicker",""],["variant","tertiary","size","small",3,"clicked","arrowClicked","rightIconClicked","label","arrow","rightIcon"],["applyValueModeInput","instantly",3,"changed","type","value","format","minDate","maxDate","label"]],template:function(t,e){if(t&1){let l=g();p(0,"tis-chips",1),m("clicked",function(){return s(l),a(e.openDatePicker())})("arrowClicked",function(){return s(l),a(e.openDatePicker())})("rightIconClicked",function(){return s(l),a(e.clearSelection())}),d(),p(1,"wk-date-picker",2,0),m("changed",function(f){return s(l),a(e.changedDate(f))}),d()}t&2&&(c("label",e.chipLabel())("arrow",!0)("rightIcon",e.isActive()?e.icons.Cross:null),v(),c("type",e.isSingle()?"default":"range")("value",e.datePickerValue())("format",e.item().format??"date")("minDate",e.item().minDate??void 0)("maxDate",e.item().maxDate??void 0)("label",""))},dependencies:[q,k],styles:[`.bs-date-filter-chip{position:relative;display:inline-flex}.bs-date-filter-chip wk-date-picker{position:absolute;bottom:0;left:0;visibility:hidden;pointer-events:none;margin-bottom:0}
/*# sourceMappingURL=date-filter-chip.component-BSCMEQO4.css.map */
`],encapsulation:2,changeDetection:0});let o=n;return o})();var te=["treeInput"],Z=(()=>{let n=class n{constructor(){this.item=y.required(),this.selectionChanged=_(),this.icons=b,this.isActive=h(()=>this.item().selectedIds.length>0),this.chipLabel=h(()=>{let{label:i,selectedIds:t,options:e}=this.item();return t.length?t.length===1?this._findInTree(e,t[0])?.name??i:`${i} +${t.length}`:i})}openTree(){this._treeInput.open()}clearSelection(){this.selectionChanged.emit({key:this.item().key,ids:[]})}changedSelection(i){let t=Array.isArray(i)?i:i!=null?[i]:[];this.selectionChanged.emit({key:this.item().key,ids:t})}_findInTree(i,t){for(let e of i){if(e.id===t)return e;if(e.children?.length){let l=this._findInTree(e.children,t);if(l)return l}}return null}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=w({type:n,selectors:[["bs-tree-filter-chip"]],viewQuery:function(t,e){if(t&1&&S(te,5),t&2){let l;F(l=T())&&(e._treeInput=l.first)}},hostAttrs:[1,"bs-tree-filter-chip"],inputs:{item:[1,"item"]},outputs:{selectionChanged:"selectionChanged"},decls:3,vars:10,consts:[["treeInput",""],["variant","tertiary","size","small",3,"clicked","arrowClicked","rightIconClicked","label","arrow","rightIcon"],[3,"changed","options","value","openSelectedTree","label","multiple","searchInput","showClearButton"]],template:function(t,e){if(t&1){let l=g();p(0,"tis-chips",1),m("clicked",function(){return s(l),a(e.openTree())})("arrowClicked",function(){return s(l),a(e.openTree())})("rightIconClicked",function(){return s(l),a(e.clearSelection())}),d(),p(1,"wk-tree-input",2,0),m("changed",function(f){return s(l),a(e.changedSelection(f))}),d()}t&2&&(c("label",e.chipLabel())("arrow",!0)("rightIcon",e.isActive()?e.icons.Cross:null),v(),c("options",e.item().options)("value",e.item().selectedIds)("openSelectedTree",!0)("label","")("multiple",!0)("searchInput",!0)("showClearButton",!1))},dependencies:[z,k],styles:[`.bs-tree-filter-chip{position:relative;display:inline-flex}.bs-tree-filter-chip wk-tree-input{position:absolute;bottom:0;left:0;visibility:hidden;pointer-events:none;margin-bottom:0}
/*# sourceMappingURL=tree-filter-chip.component-TSLSNZLO.css.map */
`],encapsulation:2,changeDetection:0});let o=n;return o})();var X=(()=>{let n=class n{constructor(){this.item=y.required(),this.selectionChanged=_(),this.icons=b}clear(){this.selectionChanged.emit({key:this.item().key,value:!1})}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=w({type:n,selectors:[["bs-boolean-filter-chip"]],inputs:{item:[1,"item"]},outputs:{selectionChanged:"selectionChanged"},decls:1,vars:2,consts:[["variant","tertiary","size","small",3,"rightIconClicked","label","rightIcon"]],template:function(t,e){t&1&&(p(0,"tis-chips",0),m("rightIconClicked",function(){return e.clear()}),d()),t&2&&c("label",e.item().label)("rightIcon",e.icons.Cross)},dependencies:[k],encapsulation:2,changeDetection:0});let o=n;return o})();var ie=["timePicker"],G=(()=>{let n=class n{constructor(){this.item=y.required(),this.selectionChanged=_(),this.icons=b,this.timeControl=new $(null),this.isActive=h(()=>!!this.item().value),this.chipLabel=h(()=>{let{label:i,value:t}=this.item();return t?`${i}: ${V(t,"HH:mm")}`:i}),P(()=>{this.timeControl.setValue(this.item().value,{emitEvent:!1})})}openTimePicker(){this._timePicker.openPicker()}clearSelection(){this.selectionChanged.emit({key:this.item().key,value:null})}changedTime(i){this.selectionChanged.emit({key:this.item().key,value:i})}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=w({type:n,selectors:[["bs-time-filter-chip"]],viewQuery:function(t,e){if(t&1&&S(ie,5),t&2){let l;F(l=T())&&(e._timePicker=l.first)}},hostAttrs:[1,"bs-time-filter-chip"],inputs:{item:[1,"item"]},outputs:{selectionChanged:"selectionChanged"},decls:3,vars:6,consts:[["timePicker",""],["variant","tertiary","size","small",3,"clicked","arrowClicked","rightIconClicked","label","arrow","rightIcon"],[3,"changed","formControl","showClearButton","label"]],template:function(t,e){if(t&1){let l=g();p(0,"tis-chips",1),m("clicked",function(){return s(l),a(e.openTimePicker())})("arrowClicked",function(){return s(l),a(e.openTimePicker())})("rightIconClicked",function(){return s(l),a(e.clearSelection())}),d(),p(1,"bs-time-picker",2,0),m("changed",function(f){return s(l),a(e.changedTime(f))}),d()}t&2&&(c("label",e.chipLabel())("arrow",!0)("rightIcon",e.isActive()?e.icons.Cross:null),v(),c("formControl",e.timeControl)("showClearButton",!1)("label",""))},dependencies:[O,k,B,L,Q],styles:[`.bs-time-filter-chip{position:relative;display:inline-flex}.bs-time-filter-chip bs-time-picker{position:absolute;bottom:0;left:0;visibility:hidden;pointer-events:none;margin-bottom:0}
/*# sourceMappingURL=time-filter-chip.component-DAKXHPU6.css.map */
`],encapsulation:2,changeDetection:0});let o=n;return o})();var ne=(o,n)=>n.key;function oe(o,n){if(o&1){let r=g();p(0,"bs-select-filter-chip",1),m("selectionChanged",function(t){s(r);let e=C(2);return a(e.handleSelectChanged(t))}),d()}if(o&2){let r=C().$implicit;c("item",r)}}function re(o,n){if(o&1){let r=g();p(0,"bs-date-filter-chip",1),m("selectionChanged",function(t){s(r);let e=C(2);return a(e.handleDateChanged(t))}),d()}if(o&2){let r=C().$implicit;c("item",r)}}function le(o,n){if(o&1){let r=g();p(0,"bs-tree-filter-chip",1),m("selectionChanged",function(t){s(r);let e=C(2);return a(e.handleTreeChanged(t))}),d()}if(o&2){let r=C().$implicit;c("item",r)}}function se(o,n){if(o&1){let r=g();p(0,"bs-boolean-filter-chip",1),m("selectionChanged",function(t){s(r);let e=C(2);return a(e.handleBooleanChanged(t))}),d()}if(o&2){let r=C().$implicit;c("item",r)}}function ae(o,n){if(o&1){let r=g();p(0,"bs-time-filter-chip",1),m("selectionChanged",function(t){s(r);let e=C(2);return a(e.handleTimeChanged(t))}),d()}if(o&2){let r=C().$implicit;c("item",r)}}function ce(o,n){if(o&1&&I(0,oe,1,1,"bs-select-filter-chip",0)(1,re,1,1,"bs-date-filter-chip",0)(2,le,1,1,"bs-tree-filter-chip",0)(3,se,1,1,"bs-boolean-filter-chip",0)(4,ae,1,1,"bs-time-filter-chip",0),o&2){let r=n.$implicit;N(r.type==="select"?0:r.type==="date"?1:r.type==="tree"?2:r.type==="boolean"?3:r.type==="time"?4:-1)}}var pt=(()=>{let n=class n{constructor(){this.items=y([]),this.selectChanged=_(),this.dateChanged=_(),this.treeChanged=_(),this.booleanChanged=_(),this.timeChanged=_(),this.visibleItems=h(()=>this.items().filter(i=>{switch(i.type){case"date":return!!i.dateFrom||!!i.dateTo;case"select":return i.selectedIds.length>0;case"tree":return i.selectedIds.length>0;case"boolean":return i.value;case"time":return!!i.value;default:return!1}}))}handleSelectChanged(i){this.selectChanged.emit(i)}handleDateChanged(i){this.dateChanged.emit(i)}handleTreeChanged(i){this.treeChanged.emit(i)}handleBooleanChanged(i){this.booleanChanged.emit(i)}handleTimeChanged(i){this.timeChanged.emit(i)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=w({type:n,selectors:[["bs-filter-chips-container"]],inputs:{items:[1,"items"]},outputs:{selectChanged:"selectChanged",dateChanged:"dateChanged",treeChanged:"treeChanged",booleanChanged:"booleanChanged",timeChanged:"timeChanged"},decls:2,vars:0,consts:[[3,"item"],[3,"selectionChanged","item"]],template:function(t,e){t&1&&x(0,ce,5,1,null,null,ne),t&2&&A(e.visibleItems())},dependencies:[U,H,Z,X,G],styles:[`[_nghost-%COMP%]{display:flex;flex-wrap:wrap;gap:var(--space-horizontal-s);width:100%}
/*# sourceMappingURL=filter-chips-container.component-ZCYRZES7.css.map */`],changeDetection:0});let o=n;return o})();export{pt as a};
//# sourceMappingURL=chunk-JLKTTJAR.js.map
