/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{a as h}from"./6S75SIVV.js";import"./5IZMQFRP.js";import"./FOQPGXXA.js";import{b as c}from"./ABSRNM72.js";import{H as n,J as r,L as a,h as l,i,r as o}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";var u=l`/** @license
 * Copyright 2025 Esri
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

.header-button-padding {
  padding-top: .5rem;
  padding-bottom: .5rem;
  padding-inline-end: 1rem;
}

.width-full {
  width: 100%;
}

.filter-layout-flex-row {
  display: flex;
  flex-direction: row;
  flex: 1;
  background-color: var(--calcite-color-foreground-2);
}

.filter-layout-flex-column {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.top-bottom-padding {
  padding-top: .5rem;
  padding-bottom: .5rem;
}

calcite-panel {
  --calcite-panel-background-color: var(--calcite-color-foreground-1);
}

.border-color {
  --calcite-block-border-color: #00000000;
  /*transparent*/
}`,s=class extends n{constructor(){super(),this.isAllSolutions=!1,this.isMobile=!1,this.isOrgAdmin=!1,this._activeFilterSettings={categories:[],isOwnerMySolutions:!0,searchTerm:""},this._translations=h({name:"solutions-deployed-filter-panel",blocking:!0}),this.applyFilter=o(),this._handleFilterRemoved=t=>{let e=t.detail;Array.isArray(e)?this._activeFilterSettings={...this._activeFilterSettings,categories:[...e]}:typeof e=="string"&&e.toLowerCase()==="My organization's solutions".toLowerCase()&&this.changeOwnerFilter(!0,!0)},this._resetToMySolutions=()=>{this.changeOwnerFilter(!0,!0)},this._handleTabChanged=t=>{console.log("tab changed event received in filter panel:"),console.log(t),console.log(this._activeFilterSettings),this.changeSearchFilter("",!0)},this.listenOn(window,"filterRemoved",this._handleFilterRemoved),this.listenOn(window,"deployProgressEnd",this._resetToMySolutions),this.listenOn(window,"tabChanged",this._handleTabChanged)}static{this.properties={isAllSolutions:[5,{},{type:Boolean}],isMobile:[5,{},{type:Boolean}],isOrgAdmin:[5,{},{type:Boolean}],_activeFilterSettings:[16,{},{state:!0}],_translations:[16,{},{state:!0}]}}static{this.styles=u}changeOwnerFilter(t,e){this.isAllSolutions=!t,this._activeFilterSettings={...this._activeFilterSettings,isOwnerMySolutions:t};let d={displayValue:this._activeFilterSettings.isOwnerMySolutions?this._translations.mySolutions:this._translations.myOrgSolutions,type:"owner",value:this._activeFilterSettings.isOwnerMySolutions?"My solutions":"My organization's solutions"};e&&this.applyFilter.emit(d)}changeSearchFilter(t,e){this._activeFilterSettings={...this._activeFilterSettings,searchTerm:t},e&&this.applyFilter.emit({searchTerm:t}),console.log("changeSearchFilter called with searchTerm:",t),console.log("Current active filter settings:",this._activeFilterSettings)}clearFilters(){this.changeSearchFilter(""),this.applyFilter.emit(null),setTimeout(()=>{this.changeOwnerFilter(!0,!0)},500)}render(){return console.log("--------------------------------------sdfp-----------------------------------------------"),i`<div class=${r(this.isMobile?"filter-layout-flex-column":"filter-layout-flex-row")}>${this.isOrgAdmin&&this.renderOwnerBlock()||""}<calcite-input-text class="width-full top-bottom-padding" clearable icon=search @keyup=${t=>{let e=t.target;t.key==="Enter"?this.changeSearchFilter(e.value,!0):this.changeSearchFilter(e.value,e.value.length>=3||e.value.length===0)}} @blur=${t=>{let e=t.target;this.changeSearchFilter(e.value,!0)}} .placeholder=${this._translations.search.solutions} slot=content-top .value=${this._activeFilterSettings.searchTerm}></calcite-input-text></div>`}renderOwnerBlock(){return i`<calcite-dropdown width=m overlay-positioning=fixed><calcite-button appearance=outline-fill class="header-button-padding" .iconStart=${this.isAllSolutions?"organization":"user"} kind=neutral slot=trigger>${this.isAllSolutions?this._translations.myOrgSolutions:this._translations.mySolutions}</calcite-button><calcite-dropdown-group group-title=${this._translations.owner??a}><calcite-dropdown-item icon-start=user @click=${()=>{this.changeOwnerFilter(!0,!0)}} .selected=${!this.isAllSolutions}>${this._translations.mySolutions}</calcite-dropdown-item><calcite-dropdown-item icon-start=organization @click=${()=>{this.changeOwnerFilter(!1,!0)}} .selected=${this.isAllSolutions}>${this._translations.myOrgSolutions}</calcite-dropdown-item></calcite-dropdown-group></calcite-dropdown>`}};c("solutions-deployed-filter-panel",s);export{s as SolutionsDeployedFilterPanel};
