/*! All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
See https://js.geoscene.cn/4.33/geoscene/copyright.txt for details.
v4.33.18 */
import{a as d,c as m}from"./L4V3TKBM.js";import j from"./RLWRTT5R.js";import i from"./W7663NDV.js";import"./OY5IWAZW.js";import e from"./E5V5AKTV.js";import{a as $}from"./VK24LKXI.js";import{a as p}from"./LL7T22QC.js";import c from"./Y4DAIYBP.js";import a from"./DTE4O2DP.js";import{e as M}from"./LYMDZ73M.js";import"./MG6XDMQJ.js";import"./HITJFSBP.js";import{B as g,E as w,P as f,Q as v,S as b,U as O,j as h,k as y}from"./3VKC6PRK.js";export default $geoscene.t(([L,{getDefaultUnitForView:S},{property:o,subclass:V},{watch:_},{hasValidAreaResult:C},,,U,,A])=>{var E=h`@layer{geoscene-area-measurement-3d{display:block}.geoscene-area-measurement-3d{position:relative;padding:var(--geoscene-widget-padding);overflow-y:auto}}`,P=Object.defineProperty,R=Object.getOwnPropertyDescriptor,n=(e,t,s,r)=>{for(var a=r>1?void 0:r?R(t,s):t,l=e.length-1,u;l>=0;l--)(u=e[l])&&(a=(r?u(t,s,a):u(a))||a);return r&&a&&P(t,s,a),a},i=class extends A{constructor(){super(...arguments),this.supportedViewType="3d",this.unsupportedErrorMessage="The Area Measurement 3D component is only supported in 3D views."}initialize(){this.addHandles(_(()=>({analysis:this.analysis,unit:this.unit}),({analysis:e,unit:t})=>{e!=null&&(e.unit=t)},{sync:!0,initial:!0}))}get state(){return this.disabled||!this.ready?"disabled":this.operationState==="inactive"?this.analysis.valid?"measured":"ready":"measuring"}get displayState(){if(!this.supported)return"unsupported";switch(this.state){case"disabled":case"ready":return"ready";case"measuring":return this.analysis.geometry==null?"measuring":"measured";case"measured":return"measured"}}get measurement(){let{analysisView:e}=this,t=e?.result,s=t?.mode??"euclidean",r=e!=null&&C(e);return{mode:s,area:m(t?.area,r),perimeter:m(t?.perimeter,r)}}get unitOptions(){let e=this._userUnitOptions?.filter(t=>d.includes(t));return e&&e.length>0?e:d.slice()}set unitOptions(e){this._userUnitOptions=e}get unit(){let e=this._userUnit,t=this.unitOptions;if(e&&t.includes(e))return e;let s=this.defaultUnit;return s&&t.includes(s)?s:t[0]}set unit(e){this._userUnit=e}get defaultUnit(){return this.view?S(this.view):void 0}async place(e){await this.analysisView?.place(e)}clearAnalysis(){this.analysis.geometry=null}constructAnalysis(){return new L}};n([o({readOnly:!0})],i.prototype,"state",1);n([o({readOnly:!0})],i.prototype,"displayState",1);n([o({readOnly:!0})],i.prototype,"measurement",1);n([o()],i.prototype,"unitOptions",1);n([o()],i.prototype,"_userUnitOptions",2);n([o()],i.prototype,"unit",1);n([o()],i.prototype,"_userUnit",2);n([o({readOnly:!0})],i.prototype,"defaultUnit",1);i=n([V("components.area-measurement-3d.AreaMeasurement3dViewModel")],i);var x="geoscene-area-measurement-3d",k={base:x},T=U(i),c=class extends f{constructor(){super(...arguments),this.viewModel=T(this),this.messages=$({blocking:!0}),this.analysis=this.viewModel.analysis,this.autoDestroyDisabled=!1,this.icon="measure-area",this.position="bottom-left",this.state=this.viewModel.state,this.unit=this.viewModel.unit,this.unitOptions=this.viewModel.unitOptions,this.geoscenePropertyChange=M()("analysis","state"),this.geosceneReady=g()}static{this.properties={analysis:0,autoDestroyDisabled:5,icon:3,label:1,position:1,referenceElement:1,state:35,unit:1,unitOptions:0}}static{this.shadowRootOptions=w}static{this.styles=E}async clear(){this.viewModel.clear()}async destroy(){await this.manager.destroy()}async start(){this.viewModel.start()}render(){let{messages:t,unit:s,unitOptions:r,viewModel:a}=this,{measurement:l,state:u}=a;return y`<div aria-label=${t.componentLabel??b} class=${v({[k.base]:!0,[p.widget]:!0,[p.panel]:!0})} role=presentation><geoscene-measurement-content .state=${a.displayState} .hintLabel=${t.hint} .unsupportedLabel=${t.unsupported} .items=${[{title:t.area,measurement:l.area},{title:t.perimeterLength,measurement:l.perimeter}]}><geoscene-unit-select slot=settings .options=${r} .selectLabel=${t.unit} .value=${s} @geosceneUnitSelectChange=${D=>{this.unit=D.detail}}></geoscene-unit-select><calcite-button slot=actions .disabled=${u==="disabled"} @click=${()=>{this.viewModel.clear(),this.viewModel.start()}}>${t.newMeasurement}</calcite-button></geoscene-measurement-content></div>`}};O("geoscene-area-measurement-3d",c);return c},"analysis/AreaMeasurementAnalysis","applications/Components/getDefaultUnits","core/accessorSupport/decorators","core/reactiveUtils","applications/Components/analysisUtils",a,c,e,i,j)