import{parseFragment as t,registerTemplate as e,freezeTemplate as s,registerDecorators as i,registerComponent as r}from"@kdcloudjs/kwc";import{s as a}from"../kddsUtilsTruncation-BkfKIyC_.js";import{l as o}from"../i18n-B98kiI7M.js";import n from"./shadowBaseClassPrivate.js";import"../observable-tloG64m6.js";import{b as l,n as d}from"../normalize-C0Pp7GJL.js";import{a as c}from"../AddressFormat-BR_EkOwP.js";import"../intlFormat-DNT_1eg4.js";import"./configProvider.js";import"./utilsPrivate.js";import"../client-Ddi3i8XR.js";import"../ssr-C2pjZzfv.js";import"./iso8601Utils.js";import"../colorValid-qIPgkqGp.js";import"../empty_html-CjXB8rB4.js";import"./i18nCldrOptions.js";import"./i18nService.js";import"./features.js";import"../classSet-DY6Qvt6E.js";import"../labelUtils-DAuN2uUV.js";import"../label-CY8Q8HAO.js";var u=[[a]];const p=t`<div${"c0"}${2}>${"t1"}</div>`,h=t`<div${"c0"}${2}>${"t1"}</div>`,m=[];function g(t,e,s,i){const{ncls:r,k:a,d:o,sp:n,st:l,i:d,f:c,ti:u,h:g}=t;return c([e.showPlainText?c([d(e.addressLines,function(t){return l(p,a(1,t),[n(0,{className:r(e.computedAddressLineClass)},null),n(1,null,o(t))])})]):m,e.showMapLink?g("a",{attrs:{"aria-label":e.computedAriaLabel,href:e.mapUrl,tabindex:u(e.internalTabIndex),target:"_blank",rel:"noopener"},key:2},c([d(e.addressLines,function(t){return l(h,a(4,t),[n(0,{className:r(e.computedAddressLineClass)},null),n(1,null,o(t))])})])):null])}var f=e(g);g.stylesheets=[],g.stylesheetToken="kwc-4fumc8oc7m0",g.legacyStylesheetToken="D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\formattedAddress-undefined_formattedAddress",u&&g.stylesheets.push.apply(g.stylesheets,u),s(g);const k="truncate";class y extends n{constructor(...t){super(...t),this.state={street:"",city:"",province:"",country:"",postalCode:"",latitude:"",longitude:"",disabled:!1},this.href=void 0,this.locale=o,this._showStaticMap=void 0}get street(){return this.state.street}set street(t){this.state.street=t}get city(){return this.state.city}set city(t){this.state.city=t}get province(){return this.state.province}set province(t){this.state.province=t}get country(){return this.state.country}set country(t){this.state.country=t}get postalCode(){return this.state.postalCode}set postalCode(t){this.state.postalCode=t}get latitude(){return this.state.latitude}set latitude(t){this.state.latitude=t}get longitude(){return this.state.longitude}set longitude(t){this.state.longitude=t}get disabled(){return this.state.disabled}set disabled(t){this.state.disabled=l(t)}get variant(){return this._variant||k}set variant(t){this._variant=d(t,{fallbackValue:k,validValues:[k,"plain"]})}get showStaticMap(){return this._showStaticMap||!1}set showStaticMap(t){this._showStaticMap=l(t)}click(){this.addressLink&&this.addressLink.click()}get showPlainText(){return this.hasValue&&this.isPlainText}get showMapLink(){return this.hasValue&&this.isMapLink}get isPlainText(){return this.disabled}get isMapLink(){return!this.disabled}get hasValue(){return!!(this.street||this.city||this.province||this.country||this.postalCode)}get address(){const[t,e]=this.locale.split("-");return c.formatAddressAllFields(t,e,{address:this.street,city:this.city,state:this.province,country:this.country,zipCode:this.postalCode})||""}get addressLines(){return this.address.split("\n")}get mapQuery(){const{address:t,latitude:e,longitude:s}=this;return e&&s?`${e},${s}`:t}get computedAriaLabel(){return this.address}get internalTabIndex(){return this.getAttribute("tabindex")}get mapUrl(){return encodeURI("https://www.google.com/maps?q=")+encodeURIComponent(this.mapQuery)}get addressLink(){return this.template.querySelector("a")}get computedAddressLineClass(){return this.variant===k?"kdds-truncate":null}}i(y,{publicProps:{locale:{config:0},street:{config:3},city:{config:3},province:{config:3},country:{config:3},postalCode:{config:3},latitude:{config:3},longitude:{config:3},disabled:{config:3},variant:{config:3},showStaticMap:{config:3}},publicMethods:["click"],track:{state:1,href:1,_showStaticMap:1}});const v=r(y,{tmpl:f,sel:"D:\\new_workspace\\workspace\\kingdee-base-components\\src\\modules\\kd\\formattedAddress-",apiVersion:63});export{v as default};
