/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{a as A}from"./ISFTCFSJ.js";import{a as L,b as N,c as x,m,p as w,r as k}from"./FFF5HUPM.js";var S=(r,n)=>{let e=r;for(;e;){if(e===n)return!0;if(!e.parentNode)return!1;e.parentNode instanceof ShadowRoot?e=e.parentNode.host:e=e.parentNode}return!1},p=(r,n,e)=>{let t=_(n).subscribe;return t(o=>{o.some(s=>S(r,s.target))&&e()})},g={},_=r=>{let n=r.join(","),e=g[n];if(e!==void 0)return e;let t=new Set,o=new MutationObserver(s=>t.forEach(a=>a(s)));globalThis.document&&o.observe(document.documentElement,{attributes:!0,attributeFilter:r,subtree:!0});let i={subscribe:s=>(t.add(s),()=>{t.delete(s),t.size===0&&(o.disconnect(),g[n]=void 0)})};return g[n]=i,i},D=(r,n)=>{let e=r;for(;e;){let t=e.closest?.(n);if(t)return t;let o=e.getRootNode?.();if(o===globalThis.document)return;e=o?.host}};var f=(r,n,e)=>D(r,`[${n}]`)?.getAttribute(n)??e;var M="ar,bg,bs,ca,cs,da,de,el,en,es,et,fi,fr,he,hr,hu,id,it,ja,ko,lt,lv,nl,nb,no,pl,pt-BR,pt-PT,ro,ru,sk,sl,sr,sv,th,tr,uk,vi,zh-CN,zh-HK,zh-TW".split(","),F=new Set(M),h="en",R={pt:"pt-BR",nb:"no",nn:"no",zh:"zh-CN"},z=async(r,n,e="")=>{let t=`${n}/${e}`,o=`${t}${r}.json`;return v[o]??(v[o]=O(r,t)),await v[o]},v={},O=async(r,n)=>{let e=`${n}${r}.json`;try{let t=await fetch(e);if(t.ok)return await t.json()}catch(t){return m("error","intl",`An unknown error occurred while fetching localization strings at ${e}`,{detail:{error:t}}),{}}return r===h?{}:await O(h,n)},b=r=>{let n=f(r,"lang",globalThis.navigator?.language||h);return{lang:n,t9nLocale:P(n)}},P=r=>{let[n,e]=r.split("-"),t=n.toLowerCase(),o=t;return e&&(o=`${t}-${e.toUpperCase()}`),o=R[o]??o,F.has(o)?o:e?P(t):h},T=(r,n,e,t)=>{let o,i=()=>V(r,n(),t).then(s=>{(o?.lang!==s.lang||o.t9nLocale!==s.t9nLocale||o.t9nStrings!==s.t9nStrings)&&e(s),o=s}).catch(s=>{m("error","intl","Error updating component locale state",{detail:{error:s}})});return queueMicrotask(i),p(r,["lang"],i)},V=async(r,n,e=r.localName.split("-").slice(1).join("-"))=>{let{lang:t,t9nLocale:o}=b(r),i=`${n}/${e}/t9n`,a=e===null?{}:await z(o,i,"messages.");return{lang:t,t9nLocale:o,t9nStrings:a}};var y=r=>q(void 0,r);var E=class extends k{constructor(n,e){super(n);let t=this.exports;try{N(this.component);let o=e(this.component,this),i=this.exports!==t;if(L(o)){i||this.setProvisionalExports(o);let s=o.then(a=>{this.exports=a,super.catchUpLifecycle()}).catch(a=>{this.P.reject(a)});this.onLoad(async()=>await s)}else(!i||o!==void 0)&&(this.exports=o),queueMicrotask(()=>super.catchUpLifecycle())}catch(o){this.P.reject(o)}}catchUpLifecycle(){}},q=A(E);var de=r=>y((n,e)=>{let t=globalThis.matchMedia(r),o=()=>{e.exports=t.matches};o(),e.onLifecycle(()=>(t.addEventListener("change",o),()=>t.removeEventListener("change",o)))}),$="ltr",pe=()=>y((r,n)=>{n.exports=$,n.onLifecycle(()=>{let e=()=>{let t=f(r.el,"dir",$);n.exports=t==="rtl"?"rtl":"ltr"};return e(),p(r.el,["dir"],e)})}),fe=r=>(n={})=>y((e,t)=>{let o=b(e.el),i={_lang:o.lang,_t9nLocale:o.t9nLocale,_loading:!0},s=e;t.onLifecycle(()=>T(e.el,()=>r("./assets"),({t9nLocale:c,t9nStrings:l,lang:u})=>{let d={...l,_lang:u,_t9nLocale:c,_loading:!1};t.exports=d;let C=l.componentLabel;typeof C=="string"&&"label"in e&&e.label==null&&(e.label??=C),a(s.messageOverrides)},n.name));let a=c=>{let l=t.exports,u=l._original??l,d=j(u,c);c&&(d._original=u),t.exports=d};return"messageOverrides"in s&&t.onUpdate(c=>{c.has("messageOverrides")&&a(s.messageOverrides)}),n.blocking?(t.setProvisionalExports(i,!1),t.ready):i}),j=(r,n)=>{if(!n)return r;let e={...r};return Object.entries(n).forEach(([t,o])=>{r[t]!==void 0&&(typeof o=="object"?e[t]=j(r[t],o):e[t]=o??r[t])}),e},he=r=>U,G="arcgisPropertyChange",U=(...r)=>{let n=x(),e=w(G,void 0,n),t=!0;return n.manager.onUpdated(o=>{if(t||!n.el.isConnected){t=!1;return}for(let i of r)o.has(i)&&e.emit({name:i})}),e};export{de as a,pe as b,fe as c,he as d};
