/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{d as u}from"./CKD45FGQ.js";import{b as n}from"./VU3OQQKP.js";import{F as d,G as c,H as o,J as l,h as s,i as a}from"./46DQNAMV.js";import"./OR4HXHSY.js";var p=s`: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:0}`,i=class extends o{constructor(){super(...arguments),this.showAddDeduct=!1,this._deductValuesElement=d()}static{this.properties={showAddDeduct:16}}static{this.styles=p}render(){let e=this.showAddDeduct?"display-none":"display-grid",t=this.showAddDeduct?"position-relative":"display-none";return a`<div class=${l(e)}><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=${l(t)}><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 a`<div class="display-flex"><calcite-input class="main-input" ${c(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?a`<calcite-button @click=${()=>this._calculatePCI(this._deductValuesElement?.value?.value||"")}>\r\n        Calculate PCI</calcite-button>`:void 0}_toggleShowAddDeduct(){this.showAddDeduct=!this.showAddDeduct}_addDeductValue(e){this._toggleShowAddDeduct(),this._deductValuesElement.value&&(this._deductValuesElement.value.value+=Math.abs(Number.parseFloat(this._deductValuesElement.value.value))>0?`,${e.detail}`:e.detail)}_calculatePCI(e){let t=u(e,!0),r=t<=10?"Failed":t<=25?"Serious":t<=40?"Very Poor":t<=55?"Poor":t<=70?"Fair":t<=85?"Satisfactory":"Good";console.log(`PCI: ${t}`),console.log(`Rating: ${r}`),alert("See debug console for results")}};n("pci-calculator",i);export{i as PciCalculator};
