/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{a as d}from"./2UHME7O6.js";import a from"./HBC3TKGZ.js";import{b as F}from"./W4YXXJAS.js";import{b as A}from"./S7VQX4XX.js";import{a as f}from"./XN2LWKJE.js";import{b as I}from"./ODCCVHGI.js";import{H as S,h as E,i as n,r as N}from"./42WFQ3AX.js";export default $arcgis.t(([{g:m,n:_}])=>{var b=E`/** @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.
 */

.width-full {
  width: 100%
}

calcite-panel {
 --calcite-panel-background-color: var(--calcite-color-foreground-1);
 --calcite-panel-footer-space: var(--calcite-spacing-sm);
}

.border-color {
  --calcite-block-border-color: transparent;
}

calcite-block {
  margin: 0;
  --calcite-block-content-space: 0;
}

.tree-padding {
  padding: 0 0.2rem;
}
`,O={PUBLICSAFETY:["EMERGENCYMANAGEMENT","FIRESERVICE","LAWENFORCEMENT"],STATEANDLOCALGOVERNMENT:["AGRICULTURE","AIRPORT","ASSESSMENTANDTAXATION","ELECTIONS","EMERGENCYMANAGEMENT","FIRESERVICE","FISHANDWILDLIFE","HEALTHANDHUMANSERVICES","LAWENFORCEMENT","NATURALRESOURCES","PARKS","PLANNINGANDDEVELOPMENT","PUBLICWORKS","TRANSPORTATION"],UTILITIES:["DISTRICTENERGY","ELECTRIC","GAS","SEWER","STORMWATER","WATER"]},T=Object.keys(m).reduce((u,e)=>{let t=e;return u[t]=O[t]??[],u},{}),g=class extends S{constructor(){super(),this.hideIndustryFilter=!1,this.isAIDialogOpen=!1,this.showReset=!1,this._activeFilterSettings={categories:[]},this._translations=f({name:"solutions-filter-panel",blocking:!0}),this._userFirstName="",this._configContextConsumer=A({context:F,subscribe:!0,callback:e=>{e?.userSession&&!this._userFirstName&&this._loadUserFirstName()}}),this.applyFilter=N(),this._handleFilterRemoved=e=>{let t=e.detail;Array.isArray(t)&&(this._activeFilterSettings={...this._activeFilterSettings,categories:[...t]})},this._industryMatchName=e=>{let t=Object.keys(this._translations.industries).find(o=>o.toUpperCase()===e.replaceAll(" ","").toUpperCase());return t&&t in this._translations.industries?this._translations.industries[t]:e},this.listenOn(window,"filterRemoved",this._handleFilterRemoved),this.listenOn(window,"closeAssistant",()=>{this.isAIDialogOpen=!1}),this.listenOn(window,"openAssistant",()=>{this.isAIDialogOpen=!0})}static{this.properties={hideIndustryFilter:[5,{},{type:Boolean}],isAIDialogOpen:[5,{},{type:Boolean}],showReset:[5,{},{type:Boolean}],_activeFilterSettings:[16,{},{state:!0}],_translations:[16,{},{state:!0}],_userFirstName:[16,{},{state:!0}]}}static{this.styles=b}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}changeIndustryFilter(e,t,o,h){if(e!==""||t!==""){let c=[];if(t!==""){let i=m[e];c=[{displayValue:this._industryMatchName(i),type:"industry",value:e,industry:e,domain:""},{displayValue:o,type:"domain",value:t,industry:e,domain:t}]}else c=[{displayValue:o,type:t!==""?"domain":"industry",value:t!==""?t:e,industry:e,domain:t}];this._activeFilterSettings={...this._activeFilterSettings,categories:[...c]},h&&this.applyFilter.emit(c)}else{let c={displayValue:o,type:"industry",value:e,industry:e,domain:t};this._activeFilterSettings={...this._activeFilterSettings,categories:[c]},h&&this.applyFilter.emit(c)}}clearFilters(){this.changeIndustryFilter("","",""),this.applyFilter.emit(null)}async load(){await this._loadUserFirstName()}render(){return n`<calcite-panel description heading>${this.showReset&&n`<calcite-action appearance=solid icon=reset @click=${()=>{this.clearFilters()}} slot=header-actions-end .text=${this._translations.resetFilters} text-enabled></calcite-action>`||""}<calcite-block-group .label=${this._translations.filters} scale=l>${!this.hideIndustryFilter&&this.renderIndustryBlock()||""}</calcite-block-group><calcite-button id=solutions-assistant-button icon-start=speech-bubbles label="Solutions Assistant" @click=${()=>{this._telemetry?.logEvent({category:_.ASSISTANT,action:"Open"}),this.isAIDialogOpen=!0}} round scale=l slot=footer-start></calcite-button><calcite-tooltip reference-element=solutions-assistant-button placement=right slot=footer-start offset-distance=10 open><span>${this._translations.assistant.welcomeTip}</span></calcite-tooltip><arcgis-solutions-assistant .open=${this.isAIDialogOpen} .token=${this._configContextConsumer.value?.userSession?.token} .userFirstName=${this._userFirstName}></arcgis-solutions-assistant></calcite-panel>`}renderIndustryBlock(){let e=(i,r)=>!this._activeFilterSettings||!this._activeFilterSettings.categories?!1:this._activeFilterSettings.categories.some(s=>s.industry===i&&(s.domain??"")===r),t=i=>!this._activeFilterSettings||!this._activeFilterSettings.categories?!1:this._activeFilterSettings.categories.some(r=>r.industry===i&&(r.domain??"")===""),o=(i,r)=>r.length>0&&(t(i)||this._activeFilterSettings.categories?.some(s=>s.industry===i&&!!s.domain&&r.includes(s.domain))===!0),h=(i,r)=>r.map(s=>{let a=Object.keys(this._translations.industriesDomain).find(y=>y.toUpperCase()===s.toUpperCase()),l=a&&a in this._translations.industriesDomain?this._translations.industriesDomain[a]:s;return e(i,s)?d(s,n`<calcite-tree-item .label=${l} @click=${()=>this.changeIndustryFilter(i,s,l,!0)} selected>${l}</calcite-tree-item>`):d(s,n`<calcite-tree-item .label=${l} @click=${()=>this.changeIndustryFilter(i,s,l,!0)}>${l}</calcite-tree-item>`)}),c=Object.entries(T).map(([i,r])=>{let s=this._industryMatchName(i),a=r,l=t(i),p=o(i,a);return l?d(i,n`<calcite-tree-item .label=${s} @click=${()=>this.changeIndustryFilter(i,"",s,!0)} selected .expanded=${p?!0:void 0}>${s}${a.length>0&&n`<calcite-tree slot=children selection-mode=multiple>${h(i,a)}</calcite-tree>`||""}</calcite-tree-item>`):d(i,n`<calcite-tree-item .label=${s} @click=${()=>this.changeIndustryFilter(i,"",s,!0)} .expanded=${p?!0:void 0}>${s}${a.length>0&&n`<calcite-tree slot=children selection-mode=multiple>${h(i,a)}</calcite-tree>`||""}</calcite-tree-item>`)});return n`<calcite-block description expanded class="border-color" .heading=${this._translations.industriesHeader} .label=${this._translations.industriesHeader}><calcite-tree selection-mode=single-persist class="tree-padding">${c}</calcite-tree></calcite-block>`}async _loadUserFirstName(){try{let e=await this._configContextConsumer.value?.userSession?.getUser();if(e?.fullName){let t=e.fullName.split(" ")[0];this._userFirstName=t}}catch{}}};I("solutions-filter-panel",g);return g},a)