import{a as g}from"./chunk-SMJODJEO.js";import{a as q}from"./chunk-4OMUF5HF.js";import{t as D}from"./chunk-S332DHRQ.js";import{Ma as _}from"./chunk-QHAVDXDG.js";import{H as Q,ca as z,f as E,h as L,k as $,qa as R,s as B}from"./chunk-27KSTDMK.js";import{Ac as v,Bc as F,Ib as d,Ma as N,Xc as P,ac as I,cc as V,fc as x,gc as A,hc as r,ic as l,jc as s,od as c,rc as b,rd as m,sb as w,sd as h,tc as a,vc as p,ya as f,za as y,zc as k}from"./chunk-ISMRT7VU.js";var K=["dropdown"],Z=()=>[];function j(n,C){if(n&1){let e=b();l(0,"wk-dropdown",4,0),a("changed",function(t){f(e);let o=p();return y(o.changedSelection(t))}),s()}if(n&2){let e=p();r("value",e.dropdownValue())("multiple",e.isMultiple())("dataSource",e.item().dataSource)("displayFieldName",e.item().displayExpr??"name")("enableSearch",!0)("highlightSelectedItems",!1)("showClearButton",!1)("placeholder",e.item().label)("emptyMessage",e.emptyMessage)("label","")}}function J(n,C){if(n&1){let e=b();l(0,"wk-dropdown",5,0),a("changed",function(t){f(e);let o=p();return y(o.changedSelection(t))}),s()}if(n&2){let e=p();r("value",e.dropdownValue())("multiple",e.isMultiple())("options",e.item().options??P(10,Z))("displayFieldName",e.displayFieldName)("enableSearch",!0)("highlightSelectedItems",!1)("showClearButton",!1)("placeholder",e.item().label)("emptyMessage",e.emptyMessage)("label","")}}var O=(()=>{class n{constructor(){this.item=h.required(),this.selectionChanged=m(),this.displayFieldName="label",this.emptyMessage="\u041D\u0435\u0442 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u043E\u0432",this.icons=_,this.isDataSourceMode=c(()=>!!this.item().dataSource),this.isMultiple=c(()=>this.item().multiple??!0),this.isActive=c(()=>this.item().selectedIds.length>0),this.dropdownValue=c(()=>{let{selectedIds:e}=this.item();return this.isMultiple()?e:e[0]??null}),this.chipLabel=c(()=>{let{label:e,selectedIds:i,options:t,selectedLabels:o,dataSource:u}=this.item();if(!i.length)return e;if(u)return o?.[0]??e;let T=t?.find(G=>G.id===i[0])?.label??e;return i.length===1?T:`${e} +${i.length}`})}openDropdown(){this._dropdown?.open()}clearSelection(){this._dropdown?.close(),this.selectionChanged.emit({key:this.item().key,ids:[]})}changedSelection(e){let i=Array.isArray(e)?e.map(String):e?[String(e)]:[],t;if(this.isDataSourceMode()&&i.length&&this._dropdown){let o=this.item().displayExpr??"name";t=this._dropdown.selectedOptions().map(S=>String(S[o]??"")).filter(Boolean)}this.selectionChanged.emit({key:this.item().key,ids:i,labels:t})}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=d({type:n,selectors:[["bs-select-filter-chip"]],viewQuery:function(i,t){if(i&1&&k(K,5),i&2){let o;v(o=F())&&(t._dropdown=o.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(i,t){i&1&&(l(0,"tis-chips",1),a("clicked",function(){return t.openDropdown()})("arrowClicked",function(){return t.openDropdown()})("rightIconClicked",function(){return t.clearSelection()}),s(),I(1,j,2,10,"wk-dropdown",2)(2,J,2,11,"wk-dropdown",3)),i&2&&(r("label",t.chipLabel())("arrow",!0)("rightIcon",t.isActive()?t.icons.Cross:null),w(),V(t.isDataSourceMode()?1:2))},dependencies:[z,g],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})}}return n})();var W=["datePicker"],U=(()=>{class n{constructor(){this.item=h.required(),this.selectionChanged=m(),this.icons=_,this.isActive=c(()=>!!this.item().dateFrom||!!this.item().dateTo),this.isSingle=c(()=>this.item().pickerType==="default"),this.datePickerValue=c(()=>this.isSingle()?this.item().dateFrom??this.item().dateTo:[this.item().dateFrom,this.item().dateTo]),this.chipLabel=c(()=>{let{label:e,dateFrom:i,dateTo:t,format:o}=this.item();if(!i&&!t)return e;let u=o==="time"?"HH:mm":"dd.MM.yyyy",S=i?D(i,u):null,T=t?D(t,u):null;return this.isSingle()?`${e}: ${S??T}`:S&&T?`${S} - ${T}`:`${e}: ${S??T}`})}openDatePicker(){this._datePicker.openPicker()}clearSelection(){this.selectionChanged.emit({key:this.item().key,dateFrom:null,dateTo:null})}changedDate(e){if(this.isSingle()){let i=Array.isArray(e)?e[0]??null:e??null;this.selectionChanged.emit({key:this.item().key,dateFrom:i,dateTo:null});return}Array.isArray(e)&&this.selectionChanged.emit({key:this.item().key,dateFrom:e[0]??null,dateTo:e[1]??null})}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=d({type:n,selectors:[["bs-date-filter-chip"]],viewQuery:function(i,t){if(i&1&&k(W,5),i&2){let o;v(o=F())&&(t._datePicker=o.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(i,t){i&1&&(l(0,"tis-chips",1),a("clicked",function(){return t.openDatePicker()})("arrowClicked",function(){return t.openDatePicker()})("rightIconClicked",function(){return t.clearSelection()}),s(),l(1,"wk-date-picker",2,0),a("changed",function(u){return t.changedDate(u)}),s()),i&2&&(r("label",t.chipLabel())("arrow",!0)("rightIcon",t.isActive()?t.icons.Cross:null),w(),r("type",t.isSingle()?"default":"range")("value",t.datePickerValue())("format",t.item().format??"date")("minDate",t.item().minDate??void 0)("maxDate",t.item().maxDate??void 0)("label",""))},dependencies:[Q,g],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})}}return n})();var ee=["treeInput"],H=(()=>{class n{constructor(){this.item=h.required(),this.selectionChanged=m(),this.icons=_,this.isActive=c(()=>this.item().selectedIds.length>0),this.chipLabel=c(()=>{let{label:e,selectedIds:i,options:t}=this.item();return i.length?i.length===1?this._findInTree(t,i[0])?.name??e:`${e} +${i.length}`:e})}openTree(){this._treeInput.open()}clearSelection(){this.selectionChanged.emit({key:this.item().key,ids:[]})}changedSelection(e){let i=Array.isArray(e)?e:e!=null?[e]:[];this.selectionChanged.emit({key:this.item().key,ids:i})}_findInTree(e,i){for(let t of e){if(t.id===i)return t;if(t.children?.length){let o=this._findInTree(t.children,i);if(o)return o}}return null}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=d({type:n,selectors:[["bs-tree-filter-chip"]],viewQuery:function(i,t){if(i&1&&k(ee,5),i&2){let o;v(o=F())&&(t._treeInput=o.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(i,t){i&1&&(l(0,"tis-chips",1),a("clicked",function(){return t.openTree()})("arrowClicked",function(){return t.openTree()})("rightIconClicked",function(){return t.clearSelection()}),s(),l(1,"wk-tree-input",2,0),a("changed",function(u){return t.changedSelection(u)}),s()),i&2&&(r("label",t.chipLabel())("arrow",!0)("rightIcon",t.isActive()?t.icons.Cross:null),w(),r("options",t.item().options)("value",t.item().selectedIds)("openSelectedTree",!0)("label","")("multiple",!0)("searchInput",!0)("showClearButton",!1))},dependencies:[R,g],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})}}return n})();var X=(()=>{class n{constructor(){this.item=h.required(),this.selectionChanged=m(),this.icons=_}clear(){this.selectionChanged.emit({key:this.item().key,value:!1})}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=d({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(i,t){i&1&&(l(0,"tis-chips",0),a("rightIconClicked",function(){return t.clear()}),s()),i&2&&r("label",t.item().label)("rightIcon",t.icons.Cross)},dependencies:[g],encapsulation:2,changeDetection:0})}}return n})();var te=["timePicker"],Y=(()=>{class n{constructor(){this.item=h.required(),this.selectionChanged=m(),this.icons=_,this.timeControl=new L(null),this.isActive=c(()=>!!this.item().value),this.chipLabel=c(()=>{let{label:e,value:i}=this.item();return i?`${e}: ${D(i,"HH:mm")}`:e}),N(()=>{this.timeControl.setValue(this.item().value,{emitEvent:!1})})}openTimePicker(){this._timePicker.openPicker()}clearSelection(){this.selectionChanged.emit({key:this.item().key,value:null})}changedTime(e){this.selectionChanged.emit({key:this.item().key,value:e})}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=d({type:n,selectors:[["bs-time-filter-chip"]],viewQuery:function(i,t){if(i&1&&k(te,5),i&2){let o;v(o=F())&&(t._timePicker=o.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(i,t){i&1&&(l(0,"tis-chips",1),a("clicked",function(){return t.openTimePicker()})("arrowClicked",function(){return t.openTimePicker()})("rightIconClicked",function(){return t.clearSelection()}),s(),l(1,"bs-time-picker",2,0),a("changed",function(u){return t.changedTime(u)}),s()),i&2&&(r("label",t.chipLabel())("arrow",!0)("rightIcon",t.isActive()?t.icons.Cross:null),w(),r("formControl",t.timeControl)("showClearButton",!1)("label",""))},dependencies:[q,g,B,E,$],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})}}return n})();var ie=(n,C)=>C.key;function ne(n,C){if(n&1){let e=b();l(0,"bs-select-filter-chip",1),a("selectionChanged",function(t){f(e);let o=p(2);return y(o.handleSelectChanged(t))}),s()}if(n&2){let e=p().$implicit;r("item",e)}}function oe(n,C){if(n&1){let e=b();l(0,"bs-date-filter-chip",1),a("selectionChanged",function(t){f(e);let o=p(2);return y(o.handleDateChanged(t))}),s()}if(n&2){let e=p().$implicit;r("item",e)}}function re(n,C){if(n&1){let e=b();l(0,"bs-tree-filter-chip",1),a("selectionChanged",function(t){f(e);let o=p(2);return y(o.handleTreeChanged(t))}),s()}if(n&2){let e=p().$implicit;r("item",e)}}function le(n,C){if(n&1){let e=b();l(0,"bs-boolean-filter-chip",1),a("selectionChanged",function(t){f(e);let o=p(2);return y(o.handleBooleanChanged(t))}),s()}if(n&2){let e=p().$implicit;r("item",e)}}function se(n,C){if(n&1){let e=b();l(0,"bs-time-filter-chip",1),a("selectionChanged",function(t){f(e);let o=p(2);return y(o.handleTimeChanged(t))}),s()}if(n&2){let e=p().$implicit;r("item",e)}}function ae(n,C){if(n&1&&I(0,ne,1,1,"bs-select-filter-chip",0)(1,oe,1,1,"bs-date-filter-chip",0)(2,re,1,1,"bs-tree-filter-chip",0)(3,le,1,1,"bs-boolean-filter-chip",0)(4,se,1,1,"bs-time-filter-chip",0),n&2){let e=C.$implicit;V(e.type==="select"?0:e.type==="date"?1:e.type==="tree"?2:e.type==="boolean"?3:e.type==="time"?4:-1)}}var ct=(()=>{class n{constructor(){this.items=h([]),this.selectChanged=m(),this.dateChanged=m(),this.treeChanged=m(),this.booleanChanged=m(),this.timeChanged=m(),this.visibleItems=c(()=>this.items().filter(e=>{switch(e.type){case"date":return!!e.dateFrom||!!e.dateTo;case"select":return e.selectedIds.length>0;case"tree":return e.selectedIds.length>0;case"boolean":return e.value;case"time":return!!e.value;default:return!1}}))}handleSelectChanged(e){this.selectChanged.emit(e)}handleDateChanged(e){this.dateChanged.emit(e)}handleTreeChanged(e){this.treeChanged.emit(e)}handleBooleanChanged(e){this.booleanChanged.emit(e)}handleTimeChanged(e){this.timeChanged.emit(e)}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=d({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(i,t){i&1&&x(0,ae,5,1,null,null,ie),i&2&&A(t.visibleItems())},dependencies:[O,U,H,X,Y],styles:[`[_nghost-%COMP%]{display:flex;flex-wrap:wrap;gap:var(--space-horizontal-8);width:100%}
/*# sourceMappingURL=filter-chips-container.component-YYCOCSPP.css.map */`],changeDetection:0})}}return n})();export{ct as a};
//# sourceMappingURL=chunk-PNF6SRHM.js.map
