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

.display-flex {
  display: flex;
}

.border-override {
  border-top-width: var(--calcite-border-width-none);
  border-bottom-width: var(--calcite-border-width-none);
}

.header-override {
  --calcite-panel-header-content-space: 0px;
  --calcite-panel-header-background-color: var(--calcite-color-foreground-2);
}

.panel-override {
  --calcite-panel-background-color: var(--calcite-color-foreground-2);
  --calcite-panel-border-color: none;
}

.label-override {
  --calcite-label-margin-bottom: 0px;
  padding-inline-start: var(--calcite-spacing-md);
  font-weight: var(--calcite-font-weight-medium);
}

.header-button-padding {
  padding-top: var(--calcite-spacing-sm);
  padding-bottom: var(--calcite-spacing-sm);
  padding-inline-start: var(--calcite-spacing-lg);
  padding-inline-end: var(--calcite-spacing-lg);
}

.padding-start {
  padding-inline-start: var(--calcite-spacing-lg);
}

.align-items-center {
  align-items: center;
}

.justify-content-end {
  justify-content: end;
}

.filter-width-350 {
  --calcite-shell-panel-width: 350px;
}

.z-index-1 {
  z-index: 1;
}

.z-index-2 {
  z-index: 2;
}

h1 {
  font-weight: unset;
  margin: 0;
  padding: 0;
}

/* This is tied to a supporting media query in the components code.
If you update this you will need to update or at least consider that code.
 */
@media (max-width: 800px) {
  .filter {
    display: none;
  }
}

.mock-fab {
  --calcite-fab-shadow-internal: 0 6px 20px -4px rgba(0, 0, 0, .1), 0 4px 12px -2px rgba(0, 0, 0, .08);
  box-shadow: var(--calcite-fab-shadow, var(--calcite-fab-shadow-internal));
  --calcite-button-background-color: var(--calcite-fab-background-color);
  --calcite-button-border-color: var(--calcite-fab-border-color);
  --calcite-button-text-color: var(--calcite-fab-text-color);
  --calcite-button-loader-color: var(--calcite-fab-loader-color);
}

.background-override {
  --calcite-shell-panel-background-color: var(--calcite-color-foreground-3);
  --calcite-panel-background-color: var(--calcite-color-foreground-3);
}

.position-relative {
  position: relative;
}

.height-100 {
  height: 100%;
}

.border-none {
  border: none;
}

.height-50 {
  height: 50px;
}

.padding-top-3 {
  padding-top: 3px;
}`,u=class extends g{constructor(){super(),this.solutionsCount=0,this._isLoading=!0,this._filterOpen=!0,this._filters={categories:[],searchTerm:""},this._isMobile=!1,this._translations=m({name:"solutions-all-shell",blocking:!0}),this._allSolutionsPanelRef=n(),this._solutionsFilterPanelRef=n(),this._configContextConsumer=o({context:y,subscribe:!0}),this._isMobileContextConsumer=o({context:b,subscribe:!0,callback:e=>this._isMobile=e}),this.filterRemoved=f(),this.listenOn(window,"searchChanged",e=>{e.detail&&e.detail.scope==="all-solutions"&&this._filterApplied(e.detail.option,e.detail.logSearchTelemetry)}),this.listenOn(window,"toggleFilter",this._toggleFilter),this.listenOn(window,"cardsFetched",()=>{this._isLoading=!1})}static{this.properties={solutionsCount:[9,{},{type:Number}],_isLoading:[16,{},{state:!0}],_filterOpen:[16,{},{state:!0}],_filters:[16,{},{state:!0}],_isMobile:[16,{},{state:!0}],_translations:[16,{},{state:!0}]}}static{this.styles=S}willUpdate(e){e.has("_isMobile")&&(this._filterOpen=!this._isMobile)}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}async searchSolutions(e){if(this._allSolutionsPanelRef.value.setSearchOptions(e),"industry"in e||"domain"in e){e.displayValue=e.domain||e.industry;let t=e.industry?Object.entries(c).find(([,l])=>l===e.industry)?.[0]:void 0,i=e.domain?Object.entries(d).find(([,l])=>l===e.domain)?.[0]:void 0;e.industry=t||"",e.domain=i||"",e.value=i||t||"",this._solutionsFilterPanelRef.value.changeIndustryFilter(e.industry,e.domain,e.displayValue,!0)}else("searchTerm"in e||"sortType"in e)&&("searchTerm"in e&&(this._filters.searchTerm=e.searchTerm),this._allSolutionsPanelRef.value?.searchSolutions(e))}async load(){this._isMobileContextConsumer.value&&(this._isMobile=this._isMobileContextConsumer.value)}render(){let e=this._isMobile?"justify-content-end":"",t=this._isLoading?"display-none":"";return s`<calcite-shell class=${`position-relative ${t}`}>${this._isMobile?"":this._getFilterPanel()}<h1 class="height-100"><calcite-panel class="border-override header-override panel-override z-index-1"><div class=${`display-flex align-items-center height-50 ${e}`} slot=header-content><calcite-label class="label-override padding-top-3">${this._translations.numberOfSolutions.replace("{{count}}",this.solutionsCount.toString())}</calcite-label>${this._renderChips()}${this._filters.categories&&this._filters.categories?.length>0&&s`<calcite-button appearance=transparent icon-start=reset kind=neutral @click=${()=>{this._filters={...this._filters,categories:[]},this._allSolutionsPanelRef.value?.searchSolutions(this._filters.categories),this.filterRemoved.emit([])}} .label=${this._translations.clearIndustryFilter}>${this._translations.clearIndustryFilter}</calcite-button>`||""}</div>${this._isMobile&&this._getFilterPanel()||""}${this._getSolutionsAllPanel()}</calcite-panel></h1></calcite-shell>`}_getFilterPanel(){let e=this._filterOpen?{display:"flex"}:"";return this._isMobile?s`<calcite-panel class=${`border-none ${this._filterOpen?"background-override":"filter background-override"}`} id=solutions-all-shell-panel-start style=${r(e)}><solutions-filter-panel class="height-100" @applyFilter=${t=>{this._filterApplied(t.detail)}} ${a(this._solutionsFilterPanelRef)}></solutions-filter-panel></calcite-panel>`:s`<calcite-shell-panel class="filter background-override filter-width-350" id=solutions-all-shell-panel-start slot=panel-start style=${r(e)}><calcite-panel class="border-none"><solutions-filter-panel class="height-100" @applyFilter=${t=>{this._filterApplied(t.detail)}} ${a(this._solutionsFilterPanelRef)}></solutions-filter-panel></calcite-panel></calcite-shell-panel>`}_getSolutionsAllPanel(){let e=this._isMobile&&this._filterOpen?{display:"none"}:"";return s`<solutions-all-panel @cardsFetched=${this._updateSolutionCount} style=${r(e)} ${a(this._allSolutionsPanelRef)}></solutions-all-panel>`}_renderChips(){if(!this._filters.categories)return;let e=this._filters.categories.filter(t=>t.type==="industry"||t.type==="domain");return e.length>0?v(e,t=>`${t.type}:${t.value}`,t=>s`<calcite-chip appearance=outline-fill class="padding-start" closable kind=neutral .label=${t.displayValue} @calciteChipClose=${()=>this._chipClosed(t.displayValue,t.type)} .value=${t.displayValue}>${t.displayValue}</calcite-chip>`):void 0}_updateSolutionCount(e){this.solutionsCount=e.detail}_chipClosed(e,t){if(this._filters.categories){if(t==="industry")this._filters.categories=[];else{let i=this._filters.categories.filter(l=>l.displayValue!==e&&l.type!==t);this._filters.categories=i}this._filters.categories.length>0?this._allSolutionsPanelRef.value?.searchSolutions(this._filters.categories):this._filters.searchTerm!==""?(this._allSolutionsPanelRef.value?.searchSolutions(this._filters.categories),this._allSolutionsPanelRef.value?.searchSolutions({searchTerm:this._filters.searchTerm})):this._allSolutionsPanelRef.value?.searchSolutions(),this.filterRemoved.emit(this._filters.categories)}}_toggleFilter(){this._filterOpen=!this._filterOpen}_logFilterTelemetry(e){if((e.type==="industry"||e.type==="domain")&&e.industry){let i=[c[e.industry]];if(e.domain){let l=d[e.domain];i.push(l)}this._telemetry?.logEvent({category:h.ALL_SOLUTIONS,action:"Filter",dimensions:i})}}_filterApplied(e,t){if(this._filters.categories)if(e){let i=e;if("displayValue"in e)this._filters.categories.push(e),this._logFilterTelemetry(e);else if(Array.isArray(e)&&e.length>0){e.length>=2&&(i=[e[e.length-1]]),this._filters={categories:e,searchTerm:this._filters.searchTerm};let l=e[e.length-1];l&&this._logFilterTelemetry(l)}if("searchTerm"in i&&(this._filters.searchTerm=i.searchTerm,t&&i.searchTerm)){this._telemetry?.logEvent({category:h.ALL_SOLUTIONS,action:"Search",dimensions:[i.searchTerm]});return}this._allSolutionsPanelRef.value?.searchSolutions(i)}else this._filters.categories=[],this._allSolutionsPanelRef.value?.searchSolutions()}};_("solutions-all-shell",u);return u},c)