/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{d as u}from"./VKY6CRVQ.js";import{b as n}from"./ABSRNM72.js";import{F as c,G as d,H as o,J as a,h as l,i}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";var p=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.
 */

:host {
  display: block;
  --calcite-label-margin-bottom: 0;
}

.label-display {
  display: block;
  padding-bottom: 1rem;
}

.display-flex {
  display: flex;
}

.display-grid {
  display: grid;
}

.display-none {
  display: none;
}

.padding-top-1 {
  padding-top: 1rem;
}

.main-input {
  width: 300px;
  padding-inline-end: 1rem;
}

.float-end {
  float: inline-end;
}

.position-relative {
  position: relative;
}

.position-right {
  position: absolute;
  right: 0px;
}`,s=class extends o{constructor(){super(...arguments),this.showAddDeduct=!1,this._deductValuesElement=c()}static{this.properties={showAddDeduct:[16,{},{state:!0}]}}static{this.styles=p}render(){let t=this.showAddDeduct?"display-none":"display-grid",e=this.showAddDeduct?"position-relative":"display-none";return i`<div class=${a(t)}><div class="label-display"><calcite-label class="label-display">\r\n              Enter comma delimited deduct values${this._getDeductValuesInput()}</calcite-label></div><div>${this._getCalculateButton()}</div></div><div class=${a(e)}><div class="position-right"><calcite-action appearance=transparent class="float-end" icon=x @click=${()=>this._toggleShowAddDeduct()} scale=s text></calcite-action></div><deduct-calculator class="display-grid padding-top-1" @deductValueComplete=${this._addDeductValue}></deduct-calculator></div>`}_getDeductValuesInput(){return i`<div class="display-flex"><calcite-input class="main-input" ${d(this._deductValuesElement)}></calcite-input><calcite-action appearance=transparent icon=plus-circle @click=${()=>this._toggleShowAddDeduct()} scale=s text></calcite-action></div>`}_getCalculateButton(){return this._deductValuesElement.value?i`<calcite-button @click=${()=>this._calculatePCI(this._deductValuesElement?.value?.value||"")}>\r\n        Calculate PCI</calcite-button>`:void 0}_toggleShowAddDeduct(){this.showAddDeduct=!this.showAddDeduct}_addDeductValue(t){this._toggleShowAddDeduct(),this._deductValuesElement.value&&(this._deductValuesElement.value.value+=Math.abs(Number.parseFloat(this._deductValuesElement.value.value))>0?`,${t.detail}`:t.detail)}_calculatePCI(t){let e=u(t,!0),r=e<=10?"Failed":e<=25?"Serious":e<=40?"Very Poor":e<=55?"Poor":e<=70?"Fair":e<=85?"Satisfactory":"Good";console.log(`PCI: ${e}`),console.log(`Rating: ${r}`),alert("See debug console for results")}};n("pci-calculator",s);export{s as PciCalculator};
