Files
ADHA_mobile_project/assets/Popup-2bade392.js
T
2024-02-28 17:06:42 +05:00

3 lines
180 KiB
JavaScript

import{m1 as St,em as $e,fZ as Ne,au as Ri,z as X,aN as ws,aP as Yt,bZ as bs,kH as Ms,aO as Is,f1 as Fs,f2 as Pi,m2 as Kt,m3 as st,V as Se,A as a,B as l,ea as Ve,K as De,C as P,bk as pe,D as _,P as W,s as L,hf as Jt,eQ as As,jh as Y,ji as te,T as Ee,m4 as Be,_ as $,jj as h,m5 as I,jl as ei,m6 as ti,m7 as xe,m8 as ne,m9 as Cs,jg as $s,ma as Oi,ey as Ni,mb as Es,mc as Vt,gF as xs,eY as Ts,aD as Te,k9 as ks,aV as mt,cG as Ls,ar as Rs,gu as Lt,L as dt,md as Ps,jk as le,me as Os,mf as Si,dZ as Ns,mg as Ss,mh as Vs,mi as Vi,mj as Ds,mk as ii,bS as Bs,dm as Di,ky as ft,eM as gt,J as qs,gU as Bi,v as zs,ia as Xe,ml as N,fR as Ws,gx as nt,mm as Hs,mn as js,mo as _e,Y as qi,mp as Us,mq as Zs,mr as Qe,ms as zi,eP as Qs,mt as Gs,dz as Xs,et as Ys,jG as Ks,bq as si,aH as Js,kU as ni,w as en}from"./index-b5c8f851.js";import{e as rt}from"./throttle-7bf02de9.js";import{E as ri}from"./ByteSizeUnit-d4757d40.js";import{l as tn}from"./AttachmentInfo-36750a43.js";import{Z as sn,N as Dt}from"./utils-b84c61ef.js";import{e as Wi,t as nn}from"./widget-88f2c959.js";import{h as Le,N as rn,k as _t,R as on,D as an}from"./utils-6d77327b.js";import{s as yt}from"./executeQueryJSON-b554ead2.js";import"./featureConversionUtils-6aca8295.js";import"./pbf-eb90fa42.js";import"./colorUtils-23771bca.js";import"./utils-ebbcf3da.js";import"./query-cd419ad0.js";import"./pbfQueryUtils-e46c5add.js";import"./OptimizedGeometry-d94e541f.js";import"./OptimizedFeatureSet-1d1ac4b9.js";function Hi(i){return e=>{e.hasOwnProperty("_delegatedEventNames")||(e._delegatedEventNames=e._delegatedEventNames?e._delegatedEventNames.slice():[]);const t=e._delegatedEventNames,s=Array.isArray(i)?i:ln(i);t.push(...s)}}function ln(i){return i.split(",").map(e=>e.trim())}function dn(i,e){return{type:St(e),value:i,unit:e}}function cn(i,e){return{type:St(e),value:i,unit:e}}function ji(i,e,t="arithmetic"){return{type:St(e),value:i,unit:e,rotationType:t}}dn(0,"meters");cn(0,"square-meters");ji(0,"radians");ji(0,"degrees");const oi=["B","kB","MB","GB","TB"];function un(i,e){let t=(e=Math.round(e))===0?0:Math.floor(Math.log(e)/Math.log(ri.KILOBYTES));t=Ri(t,0,oi.length-1);const s=$e(e/ri.KILOBYTES**t,{maximumFractionDigits:2});return Ne(i.units.bytes[oi[t]],{fileSize:s})}const hn="esri.widgets.Feature.support.featureUtils",ai=X.getLogger(hn),pn=/href=(""|'')/gi,mn=/(\{([^\{\r\n]+)\})/g,fn=/\'/g,Ui=/^\s*expression\//i,gn=/(\n)/gi,_n=/[\u00A0-\u9999<>\&]/gim,yn=/href\s*=\s*(?:\"([^\"]+)\"|\'([^\']+)\')/gi,vn=/^(?:mailto:|tel:)/,Zi="relationships/",li=Is("short-date-short-time");function Qi(i){if(i!=null)return(i.sourceLayer||i.layer)??void 0}async function ot(i,e){return typeof i=="function"?i(e):i}function Gi(i=""){if(i)return!vn.test(i.trim().toLowerCase())}function Bt(i){return!!i&&Ui.test(i)}function wn(i,e){if(!Bt(e)||!i)return null;const t=e.replace(Ui,"").toLowerCase();let s=null;return i.some(n=>n.name.toLowerCase()===t&&(s=n,!0)),s}function Xi(i,e){const t=wn(e,i==null?void 0:i.fieldName);return t?t.title||null:i?i.label||i.fieldName:null}function bn(i,e){const t=e.get(i.toLowerCase());return`{${(t==null?void 0:t.fieldName)||i}}`}function Mn(i){return i.replaceAll(pn,"")}function Ze(i,e){const t=qt(e,i);return t?t.name:i}function In(i,e){return i&&i.map(t=>Ze(t,e))}function qt(i,e){return i&&typeof i.getField=="function"&&e?i.getField(e)??null:null}function Yi(i){return`${i}`.trim()}function Ie({attributes:i,globalAttributes:e,layer:t,text:s,expressionAttributes:n,fieldInfoMap:r}){return s?Rt({formattedAttributes:e,template:$n(s,{...e,...n,...i},t),fieldInfoMap:r}):""}function Rt({formattedAttributes:i,template:e,fieldInfoMap:t}){return Yi(Mn(Ne(Ne(e,s=>bn(s,t)),i)))}function Fn(i,e,t=!1){const s=e[i];if(typeof s=="string"){const n="%27",r=(t?encodeURIComponent(s):s).replaceAll(fn,n);e[i]=r}}function An(i,e=!1){const t={...i};return Object.keys(t).forEach(s=>Fn(s,t,e)),t}function Cn(i,e,t){const s=(e=Yi(e))&&e[0]!=="{";return Ne(i,An(t,s||!1))}function Pt(i,e){return i.replaceAll(mn,(t,s,n)=>{const r=qt(e,n);return r?`{${r.name}}`:s})}function $n(i,e,t){const s=Pt(i,t);return s&&s.replaceAll(yn,(n,r,o)=>Cn(n,r||o,e))}function En(i,e){if(typeof i=="string"&&e&&e.dateFormat==null&&(e.places!=null||e.digitSeparator!=null)){const t=Number(i);if(!isNaN(t))return t}return i}function xn(i){return i!=null&&typeof i=="object"&&"fieldsIndex"in i&&"geometryType"in i&&"getField"in i&&"load"in i&&"loaded"in i&&"objectIdField"in i&&"spatialReference"in i&&"type"in i&&(i.type==="feature"||i.type==="scene")&&"when"in i}function Tn(i){return i!=null&&typeof i=="object"&&"createQuery"in i&&"queryFeatureCount"in i&&"queryObjectIds"in i&&"queryRelatedFeatures"in i&&"queryRelatedFeaturesCount"in i&&"relationships"in i}function Ki(i){return xn(i)&&Tn(i)}function kn(i,e){var p;const{fieldInfos:t,fieldName:s,preventPlacesFormatting:n,layer:r,timeZone:o}=e,d=Ji(t,s),c=qt(r,s);if(d&&!Kt(s)){const m=c==null?void 0:c.type,f=(p=d.format)==null?void 0:p.dateFormat;if(m==="date"||m==="date-only"||m==="time-only"||m==="timestamp-offset"||f)return Dt(i,{format:f,fieldType:m,timeZoneOptions:{layerTimeZone:r&&"preferredTimeZone"in r?r.preferredTimeZone:null,viewTimeZone:o,datesInUnknownTimezone:!(!r||!("datesInUnknownTimezone"in r))&&!!r.datesInUnknownTimezone}})}const u=d==null?void 0:d.format;return typeof i=="string"&&Kt(s)&&u?Ln(i,u):typeof(i=En(i,u))=="string"||i==null||u==null?Ge(i):$e(i,n?{...st(u),minimumFractionDigits:0,maximumFractionDigits:20}:st(u))}function Ln(i,e){return i=i.trim(),/\d{2}-\d{2}/.test(i)?i:i.includes(",")?vt(i,",",", ",e):i.includes(";")?vt(i,";","; ",e):i.includes(" ")?vt(i," "," ",e):$e(Number(i),st(e))}function vt(i,e,t,s){return i.trim().split(e).map(n=>$e(Number(n),st(s))).join(t)}function Ji(i,e){if(i!=null&&i.length&&e)return i.find(t=>{var s;return((s=t.fieldName)==null?void 0:s.toLowerCase())===e.toLowerCase()})}function Rn({fieldName:i,graphic:e,layer:t}){if(he(i)||!t||typeof t.getFeatureType!="function")return null;const{typeIdField:s}=t;if(!s||i!==s)return null;const n=t.getFeatureType(e);return n?n.name:null}function Pn({fieldName:i,value:e,graphic:t,layer:s}){if(he(i)||!s||typeof s.getFieldDomain!="function")return null;const n=t&&s.getFieldDomain(i,{feature:t});return n&&n.type==="coded-value"?n.getName(e):null}function On(i,e,t,s){const{creatorField:n,creationDateField:r,editorField:o,editDateField:d}=i;if(!e)return;const c=ws(s&&"preferredTimeZone"in s?s.preferredTimeZone:null,!(!s||!("datesInUnknownTimezone"in s))&&!!s.datesInUnknownTimezone,t,li,"date"),u={...li,...c},p=e[d];if(typeof p=="number"){const f=e[o];return{type:"edit",date:Yt(p,u),user:f}}const m=e[r];if(typeof m=="number"){const f=e[n];return{type:"create",date:Yt(m,u),user:f}}return null}function Nn(i,e){const t=new Map;return i&&i.forEach(s=>{const n=Ze(s.fieldName,e);s.fieldName=n,t.set(n.toLowerCase(),s)}),t}function di(i){const e=[];if(!i)return e;const{fieldInfos:t,content:s}=i;return t&&e.push(...t),s&&Array.isArray(s)&&s.forEach(n=>{if(n.type==="fields"){const r=n==null?void 0:n.fieldInfos;r&&e.push(...r)}}),e}function zt(i){return i.replaceAll(_n,e=>`&#${e.charCodeAt(0)};`)}function Ge(i){return typeof i=="string"?i.replaceAll(gn,'<br class="esri-text-new-line" />'):i}function es(i){var m;const{value:e,fieldName:t,fieldInfos:s,fieldInfoMap:n,layer:r,graphic:o,timeZone:d}=i;if(e==null)return"";const c=Pn({fieldName:t,value:e,graphic:o,layer:r});if(c)return c;const u=Rn({fieldName:t,graphic:o,layer:r});if(u)return u;if(n.get(t.toLowerCase()))return kn(e,{fieldInfos:s||Array.from(n.values()),fieldName:t,layer:r,timeZone:d});const p=(m=r==null?void 0:r.fieldsIndex)==null?void 0:m.get(t);return p&&(sn(p)||Fs(p))?Dt(e,{fieldType:p.type,timeZoneOptions:{layerTimeZone:r&&"preferredTimeZone"in r?r.preferredTimeZone:null,viewTimeZone:d,datesInUnknownTimezone:!(!r||!("datesInUnknownTimezone"in r))&&!!r.datesInUnknownTimezone}}):Ge(e)}function wt({fieldInfos:i,attributes:e,layer:t,graphic:s,fieldInfoMap:n,relatedInfos:r,timeZone:o}){const d={};return r==null||r.forEach(c=>Bn({attributes:d,relatedInfo:c,fieldInfoMap:n,fieldInfos:i,layer:t,timeZone:o})),e&&Object.keys(e).forEach(c=>{const u=e[c];d[c]=es({fieldName:c,fieldInfos:i,fieldInfoMap:n,layer:t,value:u,graphic:s,timeZone:o})}),d}async function ts(i,e){var p,m;const{layer:t,graphic:s,outFields:n,objectIds:r,returnGeometry:o,spatialReference:d}=i,c=r[0];if(typeof c!="number"&&typeof c!="string"){const f="Could not query required fields for the specified feature. The feature's ID is invalid.",g={layer:t,graphic:s,objectId:c,requiredFields:n};return ai.warn(f,g),null}if(!((m=(p=bs(t))==null?void 0:p.operations)!=null&&m.supportsQuery)){const f="The specified layer cannot be queried. The following fields will not be available.",g={layer:t,graphic:s,requiredFields:n,returnGeometry:o};return ai.warn(f,g),null}const u=t.createQuery();return u.objectIds=r,u.outFields=n!=null&&n.length?n:[t.objectIdField],u.returnGeometry=!!o,u.returnZ=!!o,u.returnM=!!o,u.outSpatialReference=d,(await t.queryFeatures(u,e)).features[0]}async function Sn(i){var s;if(!((s=i.expressionInfos)!=null&&s.length))return!1;const e=await Pi(),{arcadeUtils:{hasGeometryFunctions:t}}=e;return t(i)}async function Vn({graphic:i,popupTemplate:e,layer:t,spatialReference:s},n){if(!t||!e||(typeof t.load=="function"&&await t.load(n),!i.attributes))return;const r=i.attributes[t.objectIdField];if(r==null)return;const o=[r],d=await e.getRequiredFields(t.fieldsIndex),c=Ms(d,i),u=c?[]:d,p=e.returnGeometry||await Sn(e);if(c&&!p)return;const m=await ts({layer:t,graphic:i,outFields:u,objectIds:o,returnGeometry:p,spatialReference:s},n);m&&(m.geometry&&(i.geometry=m.geometry),m.attributes&&(i.attributes={...i.attributes,...m.attributes}))}function he(i=""){return!!i&&i.includes(Zi)}function Dn(i){return i?`${Zi}${i.layerId}/${i.fieldName}`:""}function ci({attributes:i,graphic:e,relatedInfo:t,fieldInfos:s,fieldInfoMap:n,layer:r,timeZone:o}){i&&e&&t&&Object.keys(e.attributes).forEach(d=>{const c=Dn({layerId:t.relation.id.toString(),fieldName:d}),u=e.attributes[d];i[c]=es({fieldName:c,fieldInfos:s,fieldInfoMap:n,layer:r,value:u,graphic:e,timeZone:o})})}function Bn({attributes:i,relatedInfo:e,fieldInfoMap:t,fieldInfos:s,layer:n,timeZone:r}){var o,d;i&&e&&((o=e.relatedFeatures)==null||o.forEach(c=>ci({attributes:i,graphic:c,relatedInfo:e,fieldInfoMap:t,fieldInfos:s,layer:n,timeZone:r})),(d=e.relatedStatsFeatures)==null||d.forEach(c=>ci({attributes:i,graphic:c,relatedInfo:e,fieldInfoMap:t,fieldInfos:s,layer:n,timeZone:r})))}const ui=i=>{if(!i)return!1;const e=i.toUpperCase();return e.includes("CURRENT_TIMESTAMP")||e.includes("CURRENT_DATE")||e.includes("CURRENT_TIME")},is=({layer:i,method:e,query:t,definitionExpression:s})=>{var o,d;if(!((d=(o=i.capabilities)==null?void 0:o.query)!=null&&d.supportsCacheHint)||e==="attachments")return;const n=t.where!=null?t.where:null,r=t.geometry!=null?t.geometry:null;ui(s)||ui(n)||(r==null?void 0:r.type)==="extent"||t.resultType==="tile"||(t.cacheHint=!0)},qn=({query:i,layer:e,method:t})=>{is({layer:e,method:t,query:i,definitionExpression:`${e.definitionExpression} ${e.serviceDefinitionExpression}`})},zn=({queryPayload:i,layer:e,method:t})=>{is({layer:e,method:t,query:i,definitionExpression:`${e.definitionExpression} ${e.serviceDefinitionExpression}`})};function Wn(i,e,t){return i&&e&&t?hi(i.allLayers,e,t)||hi(i.allTables,e,t):null}function hi(i,e,t){const s=e.type==="scene"&&e.associatedLayer?e.associatedLayer.url:e.url;return i.filter(Ki).find(n=>n!==e&&n.url===s&&n.layerId===t.relatedTableId)}const pi={editing:!1,operations:{add:!0,update:!0,delete:!0}},ss=Se.ofType(tn);let G=class extends pe{constructor(e){super(e),this._getAttachmentsPromise=null,this._attachmentLayer=null,this.capabilities={...pi},this.activeAttachmentInfo=null,this.activeFileInfo=null,this.attachmentInfos=new ss,this.fileInfos=new Se,this.graphic=null,this.mode="view",this.filesEnabled=!1,this.addHandles(_(()=>this.graphic,()=>this._graphicChanged(),W))}destroy(){this._attachmentLayer=null,this.graphic=null}castCapabilities(e){return{...pi,...e}}get state(){return this._getAttachmentsPromise?"loading":this.graphic?"ready":"disabled"}get supportsResizeAttachments(){const{graphic:e}=this;if(!e)return!1;const t=e.layer||e.sourceLayer;return(t==null?void 0:t.loaded)&&"capabilities"in t&&t.capabilities&&"operations"in t.capabilities&&"supportsResizeAttachments"in t.capabilities.operations&&t.capabilities.operations.supportsResizeAttachments||!1}async getAttachments(){const{_attachmentLayer:e,attachmentInfos:t}=this;if(!e||typeof e.queryAttachments!="function")throw new L("invalid-layer","getAttachments(): A valid layer is required.");const s=this._getObjectId(),n=new Jt({objectIds:[s],returnMetadata:!0}),r=[],o=e.queryAttachments(n).then(c=>c[s]||r).catch(()=>r);this._getAttachmentsPromise=o,this.notifyChange("state");const d=await o;return t.removeAll(),d.length&&t.addMany(d),this._getAttachmentsPromise=null,this.notifyChange("state"),d}async addAttachment(e,t=this.graphic){var c;const{_attachmentLayer:s,attachmentInfos:n,capabilities:r}=this;if(!t)throw new L("invalid-graphic","addAttachment(): A valid graphic is required.",{graphic:t});if(!e)throw new L("invalid-attachment","addAttachment(): An attachment is required.",{attachment:e});if(!((c=r.operations)!=null&&c.add))throw new L("invalid-capabilities","addAttachment(): add capabilities are required.");if(!s||typeof s.addAttachment!="function")throw new L("invalid-layer","addAttachment(): A valid layer is required.");const o=s.addAttachment(t,e).then(u=>this._queryAttachment(u.objectId,t)),d=await o;return n.add(d),d}async deleteAttachment(e){var c;const{_attachmentLayer:t,attachmentInfos:s,graphic:n,capabilities:r}=this;if(!e)throw new L("invalid-attachment-info","deleteAttachment(): An attachmentInfo is required.",{attachmentInfo:e});if(!((c=r.operations)!=null&&c.delete))throw new L("invalid-capabilities","deleteAttachment(): delete capabilities are required.");if(!t||typeof t.deleteAttachments!="function")throw new L("invalid-layer","deleteAttachment(): A valid layer is required.");if(!n)throw new L("invalid-graphic","deleteAttachment(): A graphic is required.");const o=t.deleteAttachments(n,[e.id]).then(()=>e),d=await o;return s.remove(d),d}async updateAttachment(e,t=this.activeAttachmentInfo){var p;const{_attachmentLayer:s,attachmentInfos:n,graphic:r,capabilities:o}=this;if(!e)throw new L("invalid-attachment","updateAttachment(): An attachment is required.",{attachment:e});if(!t)throw new L("invalid-attachment-info","updateAttachment(): An attachmentInfo is required.",{attachmentInfo:t});if(!((p=o.operations)!=null&&p.update))throw new L("invalid-capabilities","updateAttachment(): Update capabilities are required.");const d=n.indexOf(t);if(!s||typeof s.updateAttachment!="function")throw new L("invalid-layer","updateAttachment(): A valid layer is required.");if(!r)throw new L("invalid-graphic","updateAttachment(): A graphic is required.");const c=s.updateAttachment(r,t.id,e).then(m=>this._queryAttachment(m.objectId)),u=await c;return n.splice(d,1,u),u}async commitFiles(){return await Promise.all(this.fileInfos.items.map(e=>this.addAttachment(e.form))),this.fileInfos.removeAll(),this.getAttachments()}addFile(e,t){if(!e||!t)return null;const s={file:e,form:t};return this.fileInfos.add(s),s}updateFile(e,t,s=this.activeFileInfo){if(!e||!t||!s)return null;const n=this.fileInfos.indexOf(s);return n>-1&&this.fileInfos.splice(n,1,{file:e,form:t}),this.fileInfos.items[n]}deleteFile(e){const t=this.fileInfos.find(s=>s.file===e);return t?(this.fileInfos.remove(t),t):null}async _queryAttachment(e,t){const{_attachmentLayer:s}=this;if(!e||!(s!=null&&s.queryAttachments))throw new L("invalid-attachment-id","Could not query attachment.");const n=this._getObjectId(t),r=new Jt({objectIds:[n],attachmentsWhere:`AttachmentId=${e}`,returnMetadata:!0});return s.queryAttachments(r).then(o=>o[n][0])}_getObjectId(e=this.graphic){return(e==null?void 0:e.getObjectId())??null}_graphicChanged(){this.graphic&&(this._setAttachmentLayer(),this.getAttachments().catch(()=>{}))}_setAttachmentLayer(){const{graphic:e}=this,t=Qi(e);this._attachmentLayer=t?t.type==="scene"&&t.associatedLayer!=null?t.associatedLayer:t:null}};a([l()],G.prototype,"capabilities",void 0),a([Ve("capabilities")],G.prototype,"castCapabilities",null),a([l()],G.prototype,"activeAttachmentInfo",void 0),a([l()],G.prototype,"activeFileInfo",void 0),a([l({readOnly:!0,type:ss})],G.prototype,"attachmentInfos",void 0),a([l()],G.prototype,"fileInfos",void 0),a([l({type:De})],G.prototype,"graphic",void 0),a([l()],G.prototype,"mode",void 0),a([l({readOnly:!0})],G.prototype,"state",null),a([l()],G.prototype,"filesEnabled",void 0),a([l({readOnly:!0})],G.prototype,"supportsResizeAttachments",null),G=a([P("esri.widgets.Attachments.AttachmentsViewModel")],G);const Wt=G;function mi(i){const e=i.toLowerCase();return e==="image/bmp"||e==="image/emf"||e==="image/exif"||e==="image/gif"||e==="image/x-icon"||e==="image/jpeg"||e==="image/png"||e==="image/tiff"||e==="image/x-wmf"}function Hn(i){const e=As("esri/themes/base/images/files/");return i?i==="text/plain"?`${e}text-32.svg`:i==="application/pdf"?`${e}pdf-32.svg`:i==="text/csv"?`${e}csv-32.svg`:i==="application/gpx+xml"?`${e}gpx-32.svg`:i==="application/x-dwf"?`${e}cad-32.svg`:i==="application/postscript"||i==="application/json"||i==="text/xml"||i==="model/vrml"?`${e}code-32.svg`:i==="application/x-zip-compressed"||i==="application/x-7z-compressed"||i==="application/x-gzip"||i==="application/x-tar"||i==="application/x-gtar"||i==="application/x-bzip2"||i==="application/gzip"||i==="application/x-compress"||i==="application/x-apple-diskimage"||i==="application/x-rar-compressed"||i==="application/zip"?`${e}zip-32.svg`:i.includes("image/")?`${e}image-32.svg`:i.includes("audio/")?`${e}sound-32.svg`:i.includes("video/")?`${e}video-32.svg`:i.includes("msexcel")||i.includes("ms-excel")||i.includes("spreadsheetml")?`${e}excel-32.svg`:i.includes("msword")||i.includes("ms-word")||i.includes("wordprocessingml")?`${e}word-32.svg`:i.includes("powerpoint")||i.includes("presentationml")?`${e}report-32.svg`:`${e}generic-32.svg`:`${e}generic-32.svg`}const fi={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},x="esri-attachments",w={base:x,loaderContainer:`${x}__loader-container`,loader:`${x}__loader`,fadeIn:`${x}--fade-in`,container:`${x}__container`,containerList:`${x}__container--list`,containerPreview:`${x}__container--preview`,actions:`${x}__actions`,deleteButton:`${x}__delete-button`,addAttachmentButton:`${x}__add-attachment-button`,errorMessage:`${x}__error-message`,items:`${x}__items`,item:`${x}__item`,itemButton:`${x}__item-button`,itemMask:`${x}__item-mask`,itemMaskIcon:`${x}__item-mask--icon`,itemImage:`${x}__image`,itemImageResizable:`${x}__image--resizable`,itemLabel:`${x}__label`,itemFilename:`${x}__filename`,itemChevronIcon:`${x}__item-chevron-icon`,itemLink:`${x}__item-link`,itemLinkOverlay:`${x}__item-link-overlay`,itemLinkOverlayIcon:`${x}__item-link-overlay-icon`,itemEditIcon:`${x}__item-edit-icon`,itemAddIcon:`${x}__item-add-icon`,itemAddButton:`${x}__item-add-button`,formNode:`${x}__form-node`,fileFieldset:`${x}__file-fieldset`,fileLabel:`${x}__file-label`,fileName:`${x}__file-name`,fileInput:`${x}__file-input`,metadata:`${x}__metadata`,metadataFieldset:`${x}__metadata-fieldset`,progressBar:`${x}__progress-bar`},bt=window.CSS;let j=class extends te{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...fi},this._supportsImageOrientation=bt&&bt.supports&&bt.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}normalizeCtorArgs(e){return e!=null&&e.viewModel||(e={viewModel:new Wt,...e}),e}initialize(){this.addHandles([Ee(()=>{var e;return(e=this.viewModel)==null?void 0:e.attachmentInfos},"change",()=>this.scheduleRender()),Ee(()=>{var e;return(e=this.viewModel)==null?void 0:e.fileInfos},"change",()=>this.scheduleRender()),_(()=>{var e;return(e=this.viewModel)==null?void 0:e.mode},()=>this._modeChanged(),W)])}loadDependencies(){return Be({icon:()=>$(()=>import("./calcite-icon-5a112ca1.js"),["assets/calcite-icon-5a112ca1.js","assets/icon-8ad9147a.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/observers-c5d3b3aa.js"])})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&e!=="auto"?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...fi,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:t}=this;return this._set("submitting",!0),this._set("error",null),t.addAttachment(e).then(s=>(this._set("submitting",!1),this._set("error",null),t.mode="view",s)).catch(s=>{throw this._set("submitting",!1),this._set("error",new L("attachments:add-attachment",this.messages.addErrorMessage,s)),s})}deleteAttachment(e){const{viewModel:t}=this;return this._set("submitting",!0),this._set("error",null),t.deleteAttachment(e).then(s=>(this._set("submitting",!1),this._set("error",null),t.mode="view",s)).catch(s=>{throw this._set("submitting",!1),this._set("error",new L("attachments:delete-attachment",this.messages.deleteErrorMessage,s)),s})}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:t}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(t).then(s=>(this._set("submitting",!1),this._set("error",null),e.mode="view",s)).catch(s=>{throw this._set("submitting",!1),this._set("error",new L("attachments:update-attachment",this.messages.updateErrorMessage,s)),s})}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){var s;const t=this.viewModel.deleteFile(e||((s=this.viewModel.activeFileInfo)==null?void 0:s.file));return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return h("div",{class:this.classes(w.base,I.widget)},e?this._renderProgressBar():null,s==="loading"?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?h("div",{class:w.errorMessage,key:"error-message"},e.message):null}_renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return t==="add"?this._renderAddForm():t==="edit"?this._renderDetailsForm(s||e):this._renderAttachmentContainer()}_renderLoading(){return h("div",{class:w.loaderContainer,key:"loader"},h("div",{class:w.loader}))}_renderProgressBar(){return this.visibleElements.progressBar?h("div",{class:w.progressBar,key:"progress-bar"}):null}_renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,n=this.visibleElements.cancelAddButton?h("button",{bind:this,class:this.classes(I.button,I.buttonTertiary,I.buttonSmall,I.buttonHalf,e&&I.buttonDisabled),disabled:e,onclick:this._cancelForm,type:"button"},this.messages.cancel):null,r=this.visibleElements.addSubmitButton?h("button",{class:this.classes(I.button,I.buttonSecondary,I.buttonSmall,I.buttonHalf,{[I.buttonDisabled]:s}),disabled:s,type:"submit"},this.messages.add):null,o=t?h("span",{class:w.fileName,key:"file-name"},t.name):null,d=h("form",{afterCreate:ei,afterRemoved:ti,bind:this,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},h("fieldset",{class:w.fileFieldset},o,h("label",{class:this.classes(w.fileLabel,I.button,I.buttonSecondary)},t?this.messages.changeFile:this.messages.selectFile,h("input",{bind:this,class:w.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))),r,n);return h("div",{class:w.formNode,key:"add-form-container"},d)}_renderDetailsForm(e){var M,re,K;const{visibleElements:t,viewModel:s,selectedFile:n,submitting:r}=this,{capabilities:o}=s,d=r||!n;let c,u,p,m;n?(c=n.type,u=n.name,p=n.size):e&&"file"in e?(c=e.file.type,u=e.file.name,p=e.file.size):e&&"contentType"in e&&(c=e.contentType,u=e.name,p=e.size,m=e.url);const f=o.editing&&((M=o.operations)!=null&&M.delete)&&t.deleteButton?h("button",{bind:this,class:this.classes(I.button,I.buttonSmall,I.buttonTertiary,w.deleteButton,{[I.buttonDisabled]:r}),disabled:r,key:"delete-button",onclick:ie=>this._submitDeleteAttachment(ie,e),type:"button"},this.messages.delete):void 0,g=o.editing&&((re=o.operations)!=null&&re.update)&&t.updateButton?h("button",{class:this.classes(I.button,I.buttonSmall,I.buttonThird,{[I.buttonDisabled]:d}),disabled:d,key:"update-button",type:"submit"},this.messages.update):void 0,y=this.visibleElements.cancelUpdateButton?h("button",{bind:this,class:this.classes(I.button,I.buttonSmall,I.buttonTertiary,I.buttonThird,{[I.buttonDisabled]:r}),disabled:r,key:"cancel-button",onclick:this._cancelForm,type:"button"},this.messages.cancel):void 0,v=o.editing&&((K=o.operations)!=null&&K.update)?h("fieldset",{class:w.fileFieldset,key:"file"},h("span",{class:w.fileName,key:"file-name"},u),h("label",{class:this.classes(w.fileLabel,I.button,I.buttonSecondary)},this.messages.changeFile,h("input",{bind:this,class:w.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))):void 0,A=h("fieldset",{class:w.metadataFieldset,key:"size"},h("label",null,un(this.messagesUnits,p??0))),b=h("fieldset",{class:w.metadataFieldset,key:"content-type"},h("label",null,c)),E=m!=null?h("a",{class:w.itemLink,href:m,rel:"noreferrer",target:"_blank"},this._renderImageMask(e,400),h("div",{class:w.itemLinkOverlay},h("span",{class:w.itemLinkOverlayIcon},h("calcite-icon",{icon:"launch"})))):this._renderImageMask(e,400),R=h("form",{afterCreate:ei,afterRemoved:ti,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:ie=>this._submitUpdateAttachment(ie,e)},h("div",{class:w.metadata},A,b),v,h("div",{class:w.actions},f,y,g));return h("div",{class:w.formNode,key:"edit-form-container"},E,R)}_renderImageMask(e,t){return e?"file"in e?this._renderGenericImageMask(e.file.name,e.file.type):this._renderImageMaskForAttachment(e,t):null}_renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,n=Hn(t),r={[w.itemImageResizable]:s};return h("div",{class:this.classes(w.itemMaskIcon,w.itemMask),key:n},h("img",{alt:e,class:this.classes(r,w.itemImage),src:n,title:e}))}_renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:n,name:r,url:o}=e;if(!s||!mi(n))return this._renderGenericImageMask(r,n);const d=this._getCSSTransform(e),c=d?{transform:d,"image-orientation":"none"}:{},u=`${o}${o!=null&&o.includes("?")?"&":"?"}w=${t}`,p={[w.itemImageResizable]:s};return h("div",{class:this.classes(w.itemMask),key:u},h("img",{alt:r,class:this.classes(p,w.itemImage),src:u,styles:c,title:r}))}_renderFile(e){const{file:t}=e;return h("li",{class:w.item,key:t},h("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:w.itemButton,key:"details-button",onclick:()=>this._startEditFile(e),title:this.messages.attachmentDetails,type:"button"},this._renderImageMask(e),h("label",{class:w.itemLabel},h("span",{class:w.itemFilename},t.name||this.messages.noTitle),h("span",{"aria-hidden":"true",class:this.classes(w.itemChevronIcon,xe(this.container)?ne.left:ne.right)}))))}_renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:n}=this,{capabilities:r,supportsResizeAttachments:o}=s,{contentType:d,name:c,url:u}=e,p=this._renderImageMask(e,t==="list"?48:400),m=r.editing?h("span",{"aria-hidden":"true",class:this.classes(w.itemChevronIcon,xe(this.container)?ne.left:ne.right)}):null,f=[p,n==="preview"&&o&&mi(d)?null:h("label",{class:w.itemLabel},h("span",{class:w.itemFilename},c||this.messages.noTitle),m)],g=r.editing?h("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:w.itemButton,"data-attachment-info-id":e.id,key:"details-button",onclick:()=>this._startEditAttachment(e),title:this.messages.attachmentDetails,type:"button"},f):h("a",{class:w.itemButton,href:u??void 0,key:"details-link",target:"_blank"},f);return h("li",{class:w.item,key:e},g)}_renderAttachmentContainer(){var y;const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:n,capabilities:r,fileInfos:o}=t,d=!!(n!=null&&n.length),c=!!(o!=null&&o.length),u={[w.containerList]:e!=="preview",[w.containerPreview]:e==="preview"},p=r.editing&&((y=r.operations)!=null&&y.add)&&s.addButton?h("button",{bind:this,class:this.classes(I.button,I.buttonTertiary,w.addAttachmentButton),onclick:()=>this._startAddAttachment(),type:"button"},h("span",{"aria-hidden":"true",class:this.classes(w.itemAddIcon,ne.plus)}),this.messages.add):void 0,m=d?h("ul",{class:w.items,key:"attachments-list"},n.toArray().map(v=>this._renderAttachmentInfo({attachmentInfo:v,displayType:e}))):void 0,f=c?h("ul",{class:w.items,key:"file-list"},o.toArray().map(v=>this._renderFile(v))):void 0,g=c||d?void 0:h("div",{class:I.empty},this.messages.noAttachments);return h("div",{class:this.classes(w.container,u),key:"attachments-container"},m,f,g,p)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){var n;const t=e.target,s=(n=t.files)==null?void 0:n.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};a([l()],j.prototype,"capabilities",null),a([l()],j.prototype,"displayType",void 0),a([l({readOnly:!0})],j.prototype,"effectiveDisplayType",null),a([l()],j.prototype,"graphic",null),a([l()],j.prototype,"label",null),a([l(),Y("esri/widgets/Attachments/t9n/Attachments")],j.prototype,"messages",void 0),a([l(),Y("esri/core/t9n/Units")],j.prototype,"messagesUnits",void 0),a([l({readOnly:!0})],j.prototype,"selectedFile",void 0),a([l({readOnly:!0})],j.prototype,"submitting",void 0),a([l({readOnly:!0})],j.prototype,"error",void 0),a([l({type:Wt})],j.prototype,"viewModel",void 0),a([l()],j.prototype,"visibleElements",void 0),a([Ve("visibleElements")],j.prototype,"castVisibleElements",null),j=a([P("esri.widgets.Attachments")],j);const jn=j;let We=class extends Wt{constructor(e){super(e),this.description=null,this.title=null}};a([l()],We.prototype,"description",void 0),a([l()],We.prototype,"title",void 0),We=a([P("esri.widgets.Feature.FeatureAttachments.FeatureAttachmentsViewModel")],We);const Ht=We;function jt({level:i,class:e,...t},s){const n=Un(i);return h(`h${n}`,{...t,"aria-level":String(n),class:Cs(I.heading,e),role:"heading"},s)}function Un(i){return Ri(Math.ceil(i),1,6)}const Mt="esri-feature-element-info",It={base:Mt,title:`${Mt}__title`,description:`${Mt}__description`};let Re=class extends te{constructor(e,t){super(e,t),this.description=null,this.headingLevel=2,this.title=null}render(){return h("div",{class:It.base},this._renderTitle(),this._renderDescription())}_renderTitle(){const{title:e}=this;return e?h(jt,{class:It.title,level:this.headingLevel},e):null}_renderDescription(){const{description:e}=this;return e?h("div",{class:It.description,key:"description"},e):null}};a([l()],Re.prototype,"description",void 0),a([l()],Re.prototype,"headingLevel",void 0),a([l()],Re.prototype,"title",void 0),Re=a([P("esri.widgets.Feature.support.FeatureElementInfo")],Re);const ct=Re,Zn={base:"esri-feature-attachments"};let ae=class extends te{constructor(e,t){super(e,t),this._featureElementInfo=null,this.attachmentsWidget=new jn,this.headingLevel=2,this.viewModel=new Ht}initialize(){this._featureElementInfo=new ct,this.addHandles([_(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.description,(t=this.viewModel)==null?void 0:t.title,this.headingLevel]},()=>this._setupFeatureElementInfo(),W),_(()=>this.viewModel,e=>this.attachmentsWidget.viewModel=e,W)])}destroy(){var e;this.attachmentsWidget.viewModel=null,this.attachmentsWidget.destroy(),(e=this._featureElementInfo)==null||e.destroy()}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get displayType(){return this.attachmentsWidget.displayType}set displayType(e){this.attachmentsWidget.displayType=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){var t;const{attachmentsWidget:e}=this;return h("div",{class:Zn.base},(t=this._featureElementInfo)==null?void 0:t.render(),e==null?void 0:e.render())}_setupFeatureElementInfo(){var n;const{description:e,title:t,headingLevel:s}=this;(n=this._featureElementInfo)==null||n.set({description:e,title:t,headingLevel:s})}};a([l({readOnly:!0})],ae.prototype,"attachmentsWidget",void 0),a([l()],ae.prototype,"description",null),a([l()],ae.prototype,"displayType",null),a([l()],ae.prototype,"graphic",null),a([l()],ae.prototype,"headingLevel",void 0),a([l()],ae.prototype,"title",null),a([l({type:Ht})],ae.prototype,"viewModel",void 0),ae=a([P("esri.widgets.Feature.FeatureAttachments")],ae);const Qn=ae;let fe=class extends pe{constructor(e){super(e),this._loadingPromise=null,this.created=null,this.creator=null,this.destroyer=null,this.graphic=null,this.addHandles(_(()=>this.creator,t=>{this._destroyContent(),this._createContent(t)},W))}destroy(){this._destroyContent()}get state(){return this._loadingPromise?"loading":"ready"}_destroyContent(){const{created:e,graphic:t,destroyer:s}=this;e&&t&&(ot(s,{graphic:t}).catch(()=>null),this._set("created",null))}async _createContent(e){const t=this.graphic;if(!t||!e)return;const s=ot(e,{graphic:t}).catch(()=>null);this._loadingPromise=s,this.notifyChange("state");const n=await s;s===this._loadingPromise&&(this._loadingPromise=null,this.notifyChange("state"),this._set("created",n))}};a([l({readOnly:!0})],fe.prototype,"created",void 0),a([l()],fe.prototype,"creator",void 0),a([l()],fe.prototype,"destroyer",void 0),a([l({type:De})],fe.prototype,"graphic",void 0),a([l({readOnly:!0})],fe.prototype,"state",null),fe=a([P("esri.widgets.Feature.FeatureContent.FeatureContentViewModel")],fe);const at=fe,Ft="esri-feature-content",At={base:Ft,loaderContainer:`${Ft}__loader-container`,loader:`${Ft}__loader`};let Pe=class extends te{constructor(e,t){super(e,t),this.viewModel=null,this._addTargetToAnchors=s=>{Array.from(s.querySelectorAll("a")).forEach(n=>{Gi(n.href)&&!n.hasAttribute("target")&&n.setAttribute("target","_blank")})}}get creator(){var e;return(e=this.viewModel)==null?void 0:e.creator}set creator(e){this.viewModel&&(this.viewModel.creator=e)}get graphic(){var e;return(e=this.viewModel)==null?void 0:e.graphic}set graphic(e){this.viewModel&&(this.viewModel.graphic=e)}render(){var t;const e=(t=this.viewModel)==null?void 0:t.state;return h("div",{class:At.base},e==="loading"?this._renderLoading():this._renderCreated())}_renderLoading(){return h("div",{class:At.loaderContainer,key:"loader"},h("div",{class:At.loader}))}_renderCreated(){var t;const e=(t=this.viewModel)==null?void 0:t.created;return e?e instanceof HTMLElement?h("div",{afterCreate:this._attachToNode,bind:e,key:e}):Wi(e)?h("div",{key:e},!e.destroyed&&e.render()):h("div",{afterCreate:this._addTargetToAnchors,innerHTML:e,key:e}):null}_attachToNode(e){const t=this;e.appendChild(t)}};a([l()],Pe.prototype,"creator",null),a([l()],Pe.prototype,"graphic",null),a([l({type:at})],Pe.prototype,"viewModel",void 0),Pe=a([P("esri.widgets.Feature.FeatureContent")],Pe);const Je=Pe;let ce=class extends pe{constructor(e){super(e),this.attributes=null,this.expressionInfos=null,this.description=null,this.fieldInfos=null,this.title=null}get formattedFieldInfos(){const{expressionInfos:e,fieldInfos:t}=this,s=[];return t==null||t.forEach(n=>{if(!(!n.hasOwnProperty("visible")||n.visible))return;const r=n.clone();r.label=Xi(r,e),s.push(r)}),s}};a([l()],ce.prototype,"attributes",void 0),a([l({type:[$s]})],ce.prototype,"expressionInfos",void 0),a([l()],ce.prototype,"description",void 0),a([l({type:[Oi]})],ce.prototype,"fieldInfos",void 0),a([l({readOnly:!0})],ce.prototype,"formattedFieldInfos",null),a([l()],ce.prototype,"title",void 0),ce=a([P("esri.widgets.Feature.FeatureFields.FeatureFieldsViewModel")],ce);const ut=ce,Gn=[{pattern:/^\s*(https?:\/\/([^\s]+))\s*$/i,target:"_blank",label:"{messages.view}"},{pattern:/^\s*(tel:([^\s]+))\s*$/i,label:"{hierPart}"},{pattern:/^\s*(mailto:([^\s]+))\s*$/i,label:"{hierPart}"},{pattern:/^\s*(arcgis-appstudio-player:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"App Studio Player"},{pattern:/^\s*(arcgis-collector:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Collector"},{pattern:/^\s*(arcgis-explorer:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Explorer"},{pattern:/^\s*(arcgis-navigator:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Navigator"},{pattern:/^\s*(arcgis-survey123:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Survey123"},{pattern:/^\s*(arcgis-trek2there:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Trek2There"},{pattern:/^\s*(arcgis-workforce:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Workforce"},{pattern:/^\s*(iform:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"iForm"},{pattern:/^\s*(flow:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"FlowFinity"},{pattern:/^\s*(lfmobile:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Laserfische"},{pattern:/^\s*(mspbi:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Microsoft Power Bi"}];function Xn(i){let e=null;return Gn.some(t=>(t.pattern.test(i)&&(e=t),!!e)),e}function Yn(i,e){if(typeof e!="string"||!e)return e;const t=Xn(e);if(!t)return e;const s=e.match(t.pattern),n=s&&s[2],r=Ne(Ne(t.label,{messages:i,hierPart:n}),{appName:t.appName}),o=t.target?` target="${t.target}"`:"",d=t.target==="_blank"?' rel="noreferrer"':"";return e.replace(t.pattern,`<a${o} href="$1"${d}>${r}</a>`)}const Ye="esri-feature-fields",Ke={base:Ye,fieldHeader:`${Ye}__field-header`,fieldData:`${Ye}__field-data`,fieldDataDate:`${Ye}__field-data--date`};let oe=class extends te{constructor(e,t){super(e,t),this._featureElementInfo=null,this.viewModel=new ut,this.messages=null,this.messagesURIUtils=null}initialize(){this._featureElementInfo=new ct,this.addHandles(_(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.description,(t=this.viewModel)==null?void 0:t.title]},()=>this._setupFeatureElementInfo(),W))}destroy(){var e;(e=this._featureElementInfo)==null||e.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get expressionInfos(){return this.viewModel.expressionInfos}set expressionInfos(e){this.viewModel.expressionInfos=e}get fieldInfos(){return this.viewModel.fieldInfos}set fieldInfos(e){this.viewModel.fieldInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){var e;return h("div",{class:Ke.base},(e=this._featureElementInfo)==null?void 0:e.render(),this._renderFields())}_renderFieldInfo(e,t){const{attributes:s}=this.viewModel,n=e.fieldName,r=e.label||n,o=s?s[n]==null?"":s[n]:"",d=!(!e.format||!e.format.dateFormat),c=typeof o=="number"&&!d?this._forceLTR(o):Yn(this.messagesURIUtils,o),u={[Ke.fieldDataDate]:d};return h("tr",{key:`fields-element-info-row-${n}-${t}`},h("th",{class:Ke.fieldHeader,innerHTML:r,key:`fields-element-info-row-header-${n}-${t}`}),h("td",{class:this.classes(Ke.fieldData,u),innerHTML:c,key:`fields-element-info-row-data-${n}-${t}`}))}_renderFields(){const{formattedFieldInfos:e}=this.viewModel;return e!=null&&e.length?h("table",{class:I.table,summary:this.messages.fieldsSummary},h("tbody",null,e.map((t,s)=>this._renderFieldInfo(t,s)))):null}_setupFeatureElementInfo(){var s;const{description:e,title:t}=this;(s=this._featureElementInfo)==null||s.set({description:e,title:t})}_forceLTR(e){return`&lrm;${e}`}};a([l()],oe.prototype,"attributes",null),a([l()],oe.prototype,"description",null),a([l()],oe.prototype,"expressionInfos",null),a([l()],oe.prototype,"fieldInfos",null),a([l()],oe.prototype,"title",null),a([l({type:ut,nonNullable:!0})],oe.prototype,"viewModel",void 0),a([l(),Y("esri/widgets/Feature/t9n/Feature")],oe.prototype,"messages",void 0),a([l(),Y("esri/widgets/support/t9n/uriUtils")],oe.prototype,"messagesURIUtils",void 0),oe=a([P("esri.widgets.Feature.FeatureFields")],oe);const ns=oe,Kn=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,Jn={maximumFractionDigits:20};function er(i){return $e(i,Jn)}const tr="<",ir=">";function sr(i,e,t,s){let n="";return e===0?n=`${tr} `:e===t&&(n=`${ir} `),n+(s?Dt(i,s):er(i))}const nr=new Ni([64,64,64]);function rr(i,e){const t=[],s=i.length-1;return i.length===5?t.push(0,2,4):t.push(0,s),i.map((n,r)=>t.includes(r)?sr(n,r,s,e):null)}async function or(i,e,t){let s=!1,n=[],r=[];if(i.stops){const u=i.stops;n=u.map(p=>p.value),s=u.some(p=>!!p.label),s&&(r=u.map(p=>p.label))}const o=n[0],d=n[n.length-1];if(o==null&&d==null)return null;const c=s?null:rr(n,t);return(await Promise.all(n.map(async(u,p)=>({value:u,color:i.type==="opacity"?await ar(u,i,e):(await $(()=>import("./index-b5c8f851.js").then(m=>m.mI),["assets/index-b5c8f851.js","assets/index-86716609.css"])).getColor(i,u),label:s?r[p]:(c==null?void 0:c[p])??""})))).reverse()}async function ar(i,e,t){const s=new Ni(t??nr),n=(await $(()=>import("./index-b5c8f851.js").then(r=>r.mI),["assets/index-b5c8f851.js","assets/index-86716609.css"])).getOpacity(e,i);return n!=null&&(s.a=n),s}function lr(i){if(!i.colorStops)return[];const e=[...i.colorStops].filter(s=>{var n;return((n=s.color)==null?void 0:n.a)>0});let t=e.length-1;if(e&&e[0]){const s=e[t];s&&s.ratio!==1&&(e.push(new Es({ratio:1,color:s.color})),t++)}return e.map((s,n)=>{var o,d;let r="";return n===0?r=((o=i.legendOptions)==null?void 0:o.minLabel)||"low":n===t&&(r=((d=i.legendOptions)==null?void 0:d.maxLabel)||"high"),{color:s.color,label:r,ratio:s.ratio}}).reverse()}X.getLogger("esri.renderers.support.utils");async function J(i,e,t){xs(i,e,()=>[]).push(...t)}async function dr(i){var t,s;const e=new Map;if(!i)return e;if("visualVariables"in i&&i.visualVariables){const n=i.visualVariables.filter(r=>r.type==="color");for(const r of n){const o=(await or(r)??[]).map(d=>d.color);await J(e,r.field||r.valueExpression,o)}}if(i.type==="heatmap"){const n=lr(i).map(r=>r.color);await J(e,i.field||i.valueExpression,n)}else if(i.type==="pie-chart"){for(const n of i.attributes)await J(e,n.field||n.valueExpression,[n.color]);await J(e,"default",[(t=i==null?void 0:i.othersCategory)==null?void 0:t.color,Le(i.backgroundFillSymbol,null)])}else if(i.type==="dot-density"){for(const n of i.attributes)await J(e,n.field||n.valueExpression,[n.color]);await J(e,"default",[i.backgroundColor])}else if(i.type==="unique-value")if(((s=i.authoringInfo)==null?void 0:s.type)==="predominance")for(const n of i.uniqueValueInfos??[])await J(e,n.value.toString(),[Le(n.symbol,null)]);else{const n=(i.uniqueValueInfos??[]).map(u=>Le(u.symbol,null)),{field:r,field2:o,field3:d,valueExpression:c}=i;(r||c)&&await J(e,r||c,n),o&&await J(e,o,n),d&&await J(e,d,n)}else if(i.type==="class-breaks"){const n=i.classBreakInfos.map(d=>Le(d.symbol,null)),{field:r,valueExpression:o}=i;await J(e,r??o,n)}else i.type==="simple"&&await J(e,"default",[Le(i.symbol,null)]);return"defaultSymbol"in i&&i.defaultSymbol&&await J(e,"default",[Le(i.defaultSymbol,null)]),e.forEach((n,r)=>{const o=Vt(n.filter(Boolean),(d,c)=>JSON.stringify(d)===JSON.stringify(c));e.set(r,o)}),e}const cr="esri.widgets.Feature.support.relatedFeatureUtils",gi=X.getLogger(cr),_i=new Map;function et(i){if(!he(i))return null;const[e,t]=i.split("/").slice(1);return{layerId:e,fieldName:t}}function ur(i,e){if(!e.relationships)return null;let t=null;const{relationships:s}=e;return s.some(n=>n.id===parseInt(i,10)&&(t=n,!0)),t}function hr({originRelationship:i,relationships:e,layerId:t}){let s=null;return e&&e.some(n=>(`${n.relatedTableId}`===t&&n.id===(i==null?void 0:i.id)&&(s=n),!!s)),s}function pr(i,e){const t=e.toLowerCase();for(const s in i)if(s.toLowerCase()===t)return i[s];return null}function mr(i,e){const t=ur(i,e);if(t)return{url:`${e.url}/${t.relatedTableId}`,sourceSpatialReference:e.spatialReference,relation:t,relatedFields:[],outStatistics:[]}}function fr(i,e){if(!e||!i)return;const{features:t,statsFeatures:s}=i,n=t==null?void 0:t.value;e.relatedFeatures=n?n.features:[];const r=s==null?void 0:s.value;e.relatedStatsFeatures=r?r.features:[]}function gr(i,e,t,s){var r;const n=new Lt;return n.outFields=["*"],n.relationshipId=typeof e.id=="number"?e.id:parseInt(e.id,10),n.objectIds=[i.attributes[t.objectIdField]],((r=t.queryRelatedFeatures)==null?void 0:r.call(t,n,s))??Promise.resolve({})}function _r(i,e,t){let s=0;const n=[];for(;s<e.length;)n.push(`${i} IN (${e.slice(s,t+s)})`),s+=t;return n.join(" OR ")}function yr(i){return i?Vt(i):void 0}function vr(i){return i?Vt(i,(e,t)=>JSON.stringify(e.toJSON())===JSON.stringify(t.toJSON())):void 0}async function wr(i,e,t,s){const n=t.layerId.toString(),{layerInfo:r,relation:o,relatedFields:d,outStatistics:c,url:u,sourceSpatialReference:p}=e,m=yr(d),f=vr(c);if(!r||!o)return null;const g=hr({originRelationship:o,relationships:r.relationships,layerId:n});if(g!=null&&g.relationshipTableId&&g.keyFieldInRelationshipTable){const v=(await gr(i,g,t,s))[i.attributes[t.objectIdField]];if(!v)return null;const A=v.features.map(b=>b.attributes[r.objectIdField]);if(f!=null&&f.length&&r.supportsStatistics){const b=new mt;b.where=_r(r.objectIdField,A,1e3),b.outFields=m,b.outStatistics=f,b.sourceSpatialReference=p;const E={features:Promise.resolve(v),statsFeatures:yt(u,b)};return Te(E)}}const y=g==null?void 0:g.keyField;if(y){const v=Ls(Ar(r.fields,y)),A=pr(i.attributes,o.keyField),b=v?`${y}=${A}`:`${y}='${A}'`,E=yt(u,new mt({where:b,outFields:m,sourceSpatialReference:p}),s),R=f!=null&&f.length&&r.supportsStatistics?yt(u,new mt({where:b,outFields:m,outStatistics:f,sourceSpatialReference:p}),s):null,M={features:E};return R&&(M.statsFeatures=R),Te(M)}return null}function br(i,e){return Rs(i,{query:{f:"json"},signal:e==null?void 0:e.signal})}function Mr({relatedInfos:i,layer:e},t){const s={};return i.forEach((n,r)=>{const{relation:o}=n;if(!o){const m=new L("relation-required","A relation is required on a layer to retrieve related records.");throw gi.error(m),m}const{relatedTableId:d}=o;if(typeof d!="number"){const m=new L("A related table ID is required on a layer to retrieve related records.");throw gi.error(m),m}const c=`${e.url}/${d}`,u=_i.get(c),p=u??br(c);u||_i.set(c,p),s[r]=p}),Ts(Te(s),t)}function Ir({graphic:i,relatedInfos:e,layer:t},s){const n={};return e.forEach((r,o)=>{r.layerInfo&&(n[o]=wr(i,r,t,s))}),Te(n)}function Fr({relatedInfo:i,fieldName:e,fieldInfo:t}){var s,n;if((s=i.relatedFields)==null||s.push(e),t.statisticType){const r=new ks({statisticType:t.statisticType,onStatisticField:e,outStatisticFieldName:e});(n=i.outStatistics)==null||n.push(r)}}function Ar(i,e){if(i!=null){e=e.toLowerCase();for(const t of i)if(t&&t.name.toLowerCase()===e)return t}return null}const yi={chartAnimation:!0};let D=class extends pe{constructor(e){super(e),this.abilities={...yi},this.activeMediaInfoIndex=0,this.attributes=null,this.description=null,this.fieldInfoMap=null,this.formattedAttributes=null,this.expressionAttributes=null,this.isAggregate=!1,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null}castAbilities(e){return{...yi,...e}}get activeMediaInfo(){return this.formattedMediaInfos[this.activeMediaInfoIndex]||null}get formattedMediaInfos(){return this._formatMediaInfos()||[]}get formattedMediaInfoCount(){return this.formattedMediaInfos.length}setActiveMedia(e){this._setContentElementMedia(e)}next(){this._pageContentElementMedia(1)}previous(){this._pageContentElementMedia(-1)}_setContentElementMedia(e){const{formattedMediaInfoCount:t}=this,s=(e+t)%t;this.activeMediaInfoIndex=s}_pageContentElementMedia(e){const{activeMediaInfoIndex:t}=this,s=t+e;this._setContentElementMedia(s)}_formatMediaInfos(){const{mediaInfos:e,layer:t}=this,s=this.attributes??{},n=this.formattedAttributes??{},r=this.expressionAttributes??{},o=this.fieldInfoMap??new Map;return(e==null?void 0:e.map(d=>{const c=d==null?void 0:d.clone();if(!c)return null;if(c.title=Ie({attributes:s,fieldInfoMap:o,globalAttributes:n,expressionAttributes:r,layer:t,text:c.title}),c.caption=Ie({attributes:s,fieldInfoMap:o,globalAttributes:n,expressionAttributes:r,layer:t,text:c.caption}),c.altText=Ie({attributes:s,fieldInfoMap:o,globalAttributes:n,expressionAttributes:r,layer:t,text:c.altText}),c.type==="image"){const{value:u}=c;return this._setImageValue({value:u,formattedAttributes:n,layer:t}),c.value.sourceURL?c:void 0}if(c.type==="pie-chart"||c.type==="line-chart"||c.type==="column-chart"||c.type==="bar-chart"){const{value:u}=c;return this._setChartValue({value:u,chartType:c.type,attributes:s,formattedAttributes:n,layer:t,expressionAttributes:r}),c}return null}).filter(dt))??[]}_setImageValue(e){const t=this.fieldInfoMap??new Map,{value:s,formattedAttributes:n,layer:r}=e,{linkURL:o,sourceURL:d}=s;if(d){const c=Pt(d,r);s.sourceURL=Rt({formattedAttributes:n,template:c,fieldInfoMap:t})}if(o){const c=Pt(o,r);s.linkURL=Rt({formattedAttributes:n,template:c,fieldInfoMap:t})}}_setChartValue(e){const{value:t,attributes:s,formattedAttributes:n,chartType:r,layer:o,expressionAttributes:d}=e,{popupTemplate:c,relatedInfos:u}=this,{fields:p,normalizeField:m}=t,f=o;if(t.fields=In(p,f),m&&(t.normalizeField=Ze(m,f)),!p.some(y=>!!(n[y]!=null||he(y)&&(u!=null&&u.size))))return;const g=(c==null?void 0:c.fieldInfos)??[];p.forEach((y,v)=>{var E;const A=(E=t.colors)==null?void 0:E[v];if(he(y))return void(t.series=[...t.series,...this._getRelatedChartInfos({fieldInfos:g,fieldName:y,formattedAttributes:n,chartType:r,value:t,color:A})]);const b=this._getChartOption({value:t,attributes:s,chartType:r,formattedAttributes:n,expressionAttributes:d,fieldName:y,fieldInfos:g,color:A});t.series.push(b)})}_getRelatedChartInfos(e){var y;const{fieldInfos:t,fieldName:s,formattedAttributes:n,chartType:r,value:o,color:d}=e,c=[],u=et(s),p=u&&((y=this.relatedInfos)==null?void 0:y.get(u.layerId.toString()));if(!p)return c;const{relatedFeatures:m,relation:f}=p;if(!f||!m)return c;const{cardinality:g}=f;return m.forEach(v=>{const{attributes:A}=v;A&&Object.keys(A).forEach(b=>{b===u.fieldName&&c.push(this._getChartOption({value:o,attributes:A,formattedAttributes:n,fieldName:s,chartType:r,relatedFieldName:b,hasMultipleRelatedFeatures:(m==null?void 0:m.length)>1,fieldInfos:t,color:d}))})}),g==="one-to-many"||g==="many-to-many"?c:[c[0]]}_getTooltip({label:e,value:t,chartType:s}){return s==="pie-chart"?`${e}`:`${e}: ${t}`}_getChartOption(e){var ie;const{value:t,attributes:s,formattedAttributes:n,expressionAttributes:r,fieldName:o,relatedFieldName:d,fieldInfos:c,chartType:u,hasMultipleRelatedFeatures:p,color:m}=e,f=this.layer,g=this.fieldInfoMap??new Map,{normalizeField:y,tooltipField:v}=t,A=y?he(y)?s[et(y).fieldName]:s[y]:null,b=Bt(o)&&r&&r[o]!==void 0?r[o]:d&&s[d]!==void 0?s[d]:s[o]!==void 0?s[o]:n[o],E=new Ps({fieldName:o,color:m,value:b===void 0?null:b&&A?b/A:b});if(he(o)){const z=g.get(o.toLowerCase()),ht=v&&g.get(v.toLowerCase()),_s=(z==null?void 0:z.fieldName)??o,pt=p&&v?et(v).fieldName:(ht==null?void 0:ht.fieldName)??v,ys=p&&pt?s[pt]:n[pt]??(z==null?void 0:z.label)??(z==null?void 0:z.fieldName)??d,vs=p&&d?s[d]:n[_s];return E.tooltip=this._getTooltip({label:ys,value:vs,chartType:u}),E}const R=Ji(c,o),M=Ze(o,f),re=v&&n[v]!==void 0?n[v]:Xi(R||new Oi({fieldName:M}),(ie=this.popupTemplate)==null?void 0:ie.expressionInfos),K=n[M];return E.tooltip=this._getTooltip({label:re,value:K,chartType:u}),E}};a([l()],D.prototype,"abilities",void 0),a([Ve("abilities")],D.prototype,"castAbilities",null),a([l()],D.prototype,"activeMediaInfoIndex",void 0),a([l({readOnly:!0})],D.prototype,"activeMediaInfo",null),a([l()],D.prototype,"attributes",void 0),a([l()],D.prototype,"description",void 0),a([l()],D.prototype,"fieldInfoMap",void 0),a([l()],D.prototype,"formattedAttributes",void 0),a([l()],D.prototype,"expressionAttributes",void 0),a([l({readOnly:!0})],D.prototype,"formattedMediaInfos",null),a([l()],D.prototype,"isAggregate",void 0),a([l()],D.prototype,"layer",void 0),a([l({readOnly:!0})],D.prototype,"formattedMediaInfoCount",null),a([l()],D.prototype,"mediaInfos",void 0),a([l()],D.prototype,"popupTemplate",void 0),a([l()],D.prototype,"relatedInfos",void 0),a([l()],D.prototype,"title",void 0),D=a([P("esri.widgets.Feature.FeatureMedia.FeatureMediaViewModel")],D);const Fe=D,S="esri-feature-media",U={base:S,mediaContainer:`${S}__container`,mediaItemContainer:`${S}__item-container`,mediaItem:`${S}__item`,mediaItemText:`${S}__item-text`,mediaItemTitle:`${S}__item-title`,mediaItemCaption:`${S}__item-caption`,mediaNavigation:`${S}__item-navigation`,mediaPagination:`${S}__pagination`,mediaPaginationText:`${S}__pagination-text`,mediaPrevious:`${S}__previous`,mediaPreviousIconLTR:`${S}__previous-icon`,mediaPreviousIconRTL:`${S}__previous-icon--rtl`,mediaNext:`${S}__next`,mediaNextIconLTR:`${S}__next-icon`,mediaNextIconRTL:`${S}__next-icon--rtl`,mediaChart:`${S}__chart`,mediaPaginationButton:`${S}__pagination-button`,mediaPaginationIcon:`${S}__pagination-icon`,mediaChartRendered:`${S}__chart--rendered`},Ct=15,me="category",qe="value",Cr="rgba(50, 50, 50, 1)",$r=250,Er=500,xr=200;let Z=class extends te{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this._chartRootMap=new WeakMap,this.viewModel=new Fe,this.messages=null,this._disposeChart=s=>{var n;(n=this._chartRootMap.get(s))==null||n.dispose(),this._chartRootMap.delete(s)},this._createChart=async s=>{const{destroyed:n,viewModel:r}=this;if(n||!r||!s)return;const{createRoot:o}=await $(()=>import("./chartUtilsAm5-e2fc11e4.js"),["assets/chartUtilsAm5-e2fc11e4.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/Theme-f4ff95b9.js","assets/Tooltip-e2b1a7fb.js","assets/DefaultTheme-4ab4ae6c.js"]),d=await o(s);this._chartRootMap.set(s,d),this._renderChart({mediaInfo:r.activeMediaInfo,root:d})}}initialize(){this._featureElementInfo=new ct,this.addHandles([_(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.activeMediaInfo,(t=this.viewModel)==null?void 0:t.activeMediaInfoIndex]},()=>this._setupMediaRefreshTimer(),W),_(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.description,(t=this.viewModel)==null?void 0:t.title]},()=>this._setupFeatureElementInfo(),W)])}loadDependencies(){return Be({icon:()=>$(()=>import("./calcite-icon-5a112ca1.js"),["assets/calcite-icon-5a112ca1.js","assets/icon-8ad9147a.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/observers-c5d3b3aa.js"])})}destroy(){var e;this._clearMediaRefreshTimer(),(e=this._featureElementInfo)==null||e.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get activeMediaInfoIndex(){return this.viewModel.activeMediaInfoIndex}set activeMediaInfoIndex(e){this.viewModel.activeMediaInfoIndex=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get fieldInfoMap(){return this.viewModel.fieldInfoMap}set fieldInfoMap(e){this.viewModel.fieldInfoMap=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get mediaInfos(){return this.viewModel.mediaInfos}set mediaInfos(e){this.viewModel.mediaInfos=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get relatedInfos(){return this.viewModel.relatedInfos}set relatedInfos(e){this.viewModel.relatedInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){var e;return h("div",{bind:this,class:U.base,onkeyup:this._handleMediaKeyup},(e=this._featureElementInfo)==null?void 0:e.render(),this._renderMedia())}_renderMedia(){const{formattedMediaInfoCount:e,activeMediaInfoIndex:t}=this.viewModel,s=this._renderMediaText();return e?h("div",{class:U.mediaContainer,key:"media-element-container"},this._renderMediaInfo(),h("div",{class:U.mediaNavigation},s,e>1?h("div",{class:U.mediaPagination},this._renderMediaPageButton("previous"),h("span",{class:U.mediaPaginationText},le(this.messages.pageText,{index:t+1,total:e})),this._renderMediaPageButton("next")):null)):null}_renderMediaText(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e&&e.title?h("div",{class:U.mediaItemTitle,innerHTML:e.title,key:"media-title"}):null,s=e&&e.caption?h("div",{class:U.mediaItemCaption,innerHTML:e.caption,key:"media-caption"}):null;return t||s?h("div",{class:U.mediaItemText,key:"media-text"},t,s):null}_renderImageMediaInfo(e){const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:s,formattedMediaInfoCount:n}=this.viewModel,{value:r,refreshInterval:o,altText:d,title:c,type:u}=e,{sourceURL:p,linkURL:m}=r,f=Gi(m??void 0)?"_blank":"_self",g=f==="_blank"?"noreferrer":"",y=o?t:null,v=y?y.timestamp:0,A=y?y.sourceURL:p,b=h("img",{alt:d||c,key:`media-${u}-${s}-${n}-${v}`,src:A??void 0});return(m?h("a",{href:m,rel:g,target:f,title:c},b):null)??b}_renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:s}=this.viewModel;return h("div",{afterCreate:this._createChart,afterRemoved:this._disposeChart,bind:this,class:U.mediaChart,key:`media-${e.type}-${t}-${s}`})}_renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?e.type==="image"?this._renderImageMediaInfo(e):e.type.includes("chart")?this._renderChartMediaInfo(e):null:null}_renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;return e?h("div",{class:U.mediaItemContainer,key:"media-container"},h("div",{class:U.mediaItem,key:"media-item-container"},this._renderMediaInfoType())):null}_renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t=e==="previous",s=t?this.messages.previous:this.messages.next,n=t?"chevron-left":"chevron-right",r=t?"media-previous":"media-next",o=t?this._previous:this._next;return h("button",{"aria-label":s,bind:this,class:U.mediaPaginationButton,key:r,onclick:o,tabIndex:0,title:s,type:"button"},h("calcite-icon",{class:U.mediaPaginationIcon,icon:n,scale:"s"}))}_setupFeatureElementInfo(){var s;const{description:e,title:t}=this;(s=this._featureElementInfo)==null||s.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_getRenderer(){if(!this.viewModel)return;const{isAggregate:e,layer:t}=this.viewModel;return e&&(t!=null&&t.featureReduction)&&"renderer"in t.featureReduction?t.featureReduction.renderer:t==null?void 0:t.renderer}async _getSeriesColors(e){const{colorAm5:t}=await $(()=>import("./chartCommon-94f19211.js"),["assets/chartCommon-94f19211.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/Button-036bc211.js","assets/Tooltip-e2b1a7fb.js","assets/ColorSet-5a1c78ed.js"]),s=new Map;return e.forEach(n=>{n.color&&s.set(n,t(n.color.toCss(!0)))}),s}async _getRendererColors(){const{colorAm5:e}=await $(()=>import("./chartCommon-94f19211.js"),["assets/chartCommon-94f19211.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/Button-036bc211.js","assets/Tooltip-e2b1a7fb.js","assets/ColorSet-5a1c78ed.js"]),t=new Map,s=this._getRenderer(),n="default";if(!s)return t;const r=await dr(s);return r.delete(n),Array.from(r.values()).every(o=>(o==null?void 0:o.length)===1)&&Array.from(r.keys()).forEach(o=>{var c,u;const d=(u=(c=r.get(o))==null?void 0:c[0])==null?void 0:u.toCss(!0);d&&t.set(o,e(d))}),t}_handleMediaKeyup(e){const t=Si(e);t==="ArrowLeft"&&(e.stopPropagation(),this.viewModel.previous()),t==="ArrowRight"&&(e.stopPropagation(),this.viewModel.next())}_canAnimateChart(){return!!this.viewModel&&!!this.viewModel.abilities.chartAnimation&&!Kn()}_getChartAnimationMS(){return this._canAnimateChart()?$r:0}_getChartSeriesAnimationMS(){return this._canAnimateChart()?Er:0}async _renderChart(e){const{root:t,mediaInfo:s}=e,{value:n,type:r}=s,{ResponsiveThemeAm5:o,DarkThemeAm5:d,AnimatedThemeAm5:c,ColorSetAm5:u,ThemeAm5:p,esriChartColorSet:m}=await $(()=>import("./chartCommon-94f19211.js"),["assets/chartCommon-94f19211.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/Button-036bc211.js","assets/Tooltip-e2b1a7fb.js","assets/ColorSet-5a1c78ed.js"]),f=p.new(t);f.rule("ColorSet").set("colors",m),f.rule("ColorSet").set("reuse",!0);const g=[o.new(t),f];Os()&&g.push(d.new(t)),this._canAnimateChart()&&g.push(c.new(t)),t.setThemes(g);const y=await this._getRendererColors(),v=await this._getSeriesColors(n.series),A=u.new(t,{}),b=v.get(n.series[0]),E=b?{lineSettings:{stroke:b}}:void 0,R=n.series.map((M,re)=>{const K=v.get(M)||y.get(M.fieldName)||A.getIndex(re);return{[me]:M.tooltip,[qe]:M.value,columnSettings:{fill:K,stroke:K},...E}}).filter(M=>r!=="pie-chart"||M.value!=null&&M.value>0);r==="pie-chart"?this._createPieChart(e,R):this._createXYChart(e,R)}_getDirection(){return xe(this.container)?"rtl":"ltr"}_isInversed(){return!!xe(this.container)}async _customizeChartTooltip(e,t="horizontal"){var n;const{colorAm5:s}=await $(()=>import("./chartCommon-94f19211.js"),["assets/chartCommon-94f19211.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/Button-036bc211.js","assets/Tooltip-e2b1a7fb.js","assets/ColorSet-5a1c78ed.js"]);e.setAll({pointerOrientation:t}),(n=e.get("background"))==null||n.setAll({stroke:s(Cr)}),e.label.setAll({direction:this._getDirection(),oversizedBehavior:"wrap",maxWidth:xr})}async _createPieChart(e,t){const{TooltipAm5:s}=await $(()=>import("./chartCommon-94f19211.js"),["assets/chartCommon-94f19211.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/Button-036bc211.js","assets/Tooltip-e2b1a7fb.js","assets/ColorSet-5a1c78ed.js"]),{PieChartAm5:n,PieSeriesAm5:r}=await $(()=>import("./pieChart-052126f8.js"),["assets/pieChart-052126f8.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/Tick-575a0288.js","assets/Theme-f4ff95b9.js","assets/ColorSet-5a1c78ed.js","assets/DefaultTheme-4ab4ae6c.js"]),{mediaInfo:o,root:d}=e,{title:c}=o,u=5,p=(o==null?void 0:o.altText)||(o==null?void 0:o.title)||"",m=d.container.children.push(n.new(d,{ariaLabel:p,focusable:!0,paddingBottom:u,paddingTop:u,paddingLeft:u,paddingRight:u})),f=`{category}: {valuePercentTotal.formatNumber('0.00')}%
({value})`,g=s.new(d,{labelText:f}),y=m.series.push(r.new(d,{name:c,valueField:qe,categoryField:me,tooltip:g}));y.ticks.template.set("forceHidden",!0),y.labels.template.set("forceHidden",!0),y.slices.template.states.create("active",{shiftRadius:u}),this._customizeChartTooltip(g),y.slices.template.setAll({ariaLabel:f,focusable:!0,templateField:"columnSettings"}),y.data.setAll(t),y.appear(this._getChartSeriesAnimationMS()),m.appear(this._getChartAnimationMS()),m.root.dom.classList.toggle(U.mediaChartRendered,!0)}_getMinSeriesValue(e){let t=0;return e.forEach(s=>t=Math.min(s.value,t)),t}async _createColumnChart(e,t,s){const{TooltipAm5:n,ScrollbarAm5:r}=await $(()=>import("./chartCommon-94f19211.js"),["assets/chartCommon-94f19211.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/Button-036bc211.js","assets/Tooltip-e2b1a7fb.js","assets/ColorSet-5a1c78ed.js"]),{CategoryAxisAm5:o,AxisRendererXAm5:d,ValueAxisAm5:c,AxisRendererYAm5:u,ColumnSeriesAm5:p}=await $(()=>import("./xyChart-e9410438.js"),["assets/xyChart-e9410438.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/ColorSet-5a1c78ed.js","assets/DefaultTheme-4ab4ae6c.js","assets/Tick-575a0288.js","assets/Button-036bc211.js"]),{mediaInfo:m,root:f}=t,{value:g,title:y}=m;e.setAll({wheelX:"panX",wheelY:"zoomX"});const v=e.xAxes.push(o.new(f,{renderer:d.new(f,{inversed:this._isInversed()}),categoryField:me}));v.get("renderer").labels.template.setAll({forceHidden:!0});const A=e.yAxes.push(c.new(f,{renderer:u.new(f,{inside:!1}),min:this._getMinSeriesValue(g.series)}));A.get("renderer").labels.template.setAll({direction:this._getDirection()});const b="{categoryX}",E=n.new(f,{labelText:b}),R=e.series.push(p.new(f,{name:y,xAxis:v,yAxis:A,valueYField:qe,categoryXField:me,tooltip:E}));this._customizeChartTooltip(E),R.columns.template.setAll({ariaLabel:b,focusable:!0,templateField:"columnSettings"}),g.series.length>Ct&&e.set("scrollbarX",r.new(f,{orientation:"horizontal"})),v.data.setAll(s),R.data.setAll(s),R.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createBarChart(e,t,s){const{TooltipAm5:n,ScrollbarAm5:r}=await $(()=>import("./chartCommon-94f19211.js"),["assets/chartCommon-94f19211.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/Button-036bc211.js","assets/Tooltip-e2b1a7fb.js","assets/ColorSet-5a1c78ed.js"]),{CategoryAxisAm5:o,AxisRendererXAm5:d,ValueAxisAm5:c,AxisRendererYAm5:u,ColumnSeriesAm5:p}=await $(()=>import("./xyChart-e9410438.js"),["assets/xyChart-e9410438.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/ColorSet-5a1c78ed.js","assets/DefaultTheme-4ab4ae6c.js","assets/Tick-575a0288.js","assets/Button-036bc211.js"]),{mediaInfo:m,root:f}=t,{value:g,title:y}=m;e.setAll({wheelX:"panY",wheelY:"zoomY"});const v=e.yAxes.push(o.new(f,{renderer:u.new(f,{inversed:!0}),categoryField:me}));v.get("renderer").labels.template.setAll({forceHidden:!0});const A=e.xAxes.push(c.new(f,{renderer:d.new(f,{inside:!1,inversed:this._isInversed()}),min:this._getMinSeriesValue(g.series)}));A.get("renderer").labels.template.setAll({direction:this._getDirection()});const b="{categoryY}",E=n.new(f,{labelText:b}),R=e.series.push(p.new(f,{name:y,xAxis:A,yAxis:v,valueXField:qe,categoryYField:me,tooltip:E}));this._customizeChartTooltip(E,"vertical"),R.columns.template.setAll({ariaLabel:b,focusable:!0,templateField:"columnSettings"}),g.series.length>Ct&&e.set("scrollbarY",r.new(f,{orientation:"vertical"})),v.data.setAll(s),R.data.setAll(s),R.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createLineChart(e,t,s){var re,K,ie;const{TooltipAm5:n,ScrollbarAm5:r}=await $(()=>import("./chartCommon-94f19211.js"),["assets/chartCommon-94f19211.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/Button-036bc211.js","assets/Tooltip-e2b1a7fb.js","assets/ColorSet-5a1c78ed.js"]),{CategoryAxisAm5:o,AxisRendererXAm5:d,ValueAxisAm5:c,AxisRendererYAm5:u,LineSeriesAm5:p}=await $(()=>import("./xyChart-e9410438.js"),["assets/xyChart-e9410438.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/ColorSet-5a1c78ed.js","assets/DefaultTheme-4ab4ae6c.js","assets/Tick-575a0288.js","assets/Button-036bc211.js"]),{root:m,mediaInfo:f}=t,{value:g,title:y}=f;e.setAll({wheelX:"panX",wheelY:"zoomX"});const v=e.xAxes.push(o.new(m,{renderer:d.new(m,{inversed:this._isInversed()}),categoryField:me}));v.get("renderer").labels.template.setAll({forceHidden:!0});const A=e.yAxes.push(c.new(m,{renderer:u.new(m,{inside:!1}),min:this._getMinSeriesValue(g.series)}));A.get("renderer").labels.template.setAll({direction:this._getDirection()});const b="{categoryX}",E=(K=(re=s[0])==null?void 0:re.lineSettings)==null?void 0:K.stroke,R=n.new(m,{getFillFromSprite:!E,labelText:b});E&&((ie=R.get("background"))==null||ie.setAll({fill:E}));const M=e.series.push(p.new(m,{name:y,xAxis:v,yAxis:A,valueYField:qe,categoryXField:me,tooltip:R}));M.strokes.template.setAll({templateField:"lineSettings"}),this._customizeChartTooltip(R,"vertical"),g.series.length>Ct&&e.set("scrollbarX",r.new(m,{orientation:"horizontal"})),v.data.setAll(s),M.data.setAll(s),M.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createXYChart(e,t){const{XYChartAm5:s,XYCursorAm5:n}=await $(()=>import("./xyChart-e9410438.js"),["assets/xyChart-e9410438.js","assets/Theme-f4ff95b9.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/ColorSet-5a1c78ed.js","assets/DefaultTheme-4ab4ae6c.js","assets/Tick-575a0288.js","assets/Button-036bc211.js"]),{root:r,mediaInfo:o}=e,{type:d}=o,c=(o==null?void 0:o.altText)||(o==null?void 0:o.title)||"",u=r.container.children.push(s.new(r,{ariaLabel:c,focusable:!0,panX:!0,panY:!0}));u.set("cursor",n.new(r,{})),d==="column-chart"&&await this._createColumnChart(u,e,t),d==="bar-chart"&&await this._createBarChart(u,e,t),d==="line-chart"&&await this._createLineChart(u,e,t),u.root.dom.classList.toggle(U.mediaChartRendered,!0)}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:e&&this._getImageSource(e,t)}}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;e&&e.type==="image"&&e.refreshInterval&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:s}=e;if(!t)return;const n=6e4*t;this._updateMediaInfoTimestamp(s.sourceURL);const r=setInterval(()=>{this._updateMediaInfoTimestamp(s.sourceURL)},n);this._refreshTimer=r}_getImageSource(e,t){const s=e.includes("?")?"&":"?",[n,r=""]=e.split("#");return`${n}${s}timestamp=${t}${r?"#":""}${r}`}};a([l()],Z.prototype,"_refreshIntervalInfo",void 0),a([l()],Z.prototype,"attributes",null),a([l()],Z.prototype,"activeMediaInfoIndex",null),a([l()],Z.prototype,"description",null),a([l()],Z.prototype,"fieldInfoMap",null),a([l()],Z.prototype,"layer",null),a([l()],Z.prototype,"mediaInfos",null),a([l()],Z.prototype,"popupTemplate",null),a([l()],Z.prototype,"relatedInfos",null),a([l()],Z.prototype,"title",null),a([l({type:Fe})],Z.prototype,"viewModel",void 0),a([l(),Y("esri/widgets/Feature/t9n/Feature")],Z.prototype,"messages",void 0),Z=a([P("esri.widgets.Feature.FeatureMedia")],Z);const rs=Z,Tr=["$datastore","$map","$layer","$aggregatedfeatures"],kr="esri.widgets.Feature.support.arcadeFeatureUtils",Lr=X.getLogger(kr);function Rr(i){return typeof i=="string"?Ge(zt(i)):Array.isArray(i)?Pr(i):(i==null?void 0:i.declaredClass)==="esri.arcade.Dictionary"?Or(i):i}function Pr(i){return`<ul class="esri-widget__list">${i.map(e=>`<li>${typeof e=="string"?Ge(zt(e)):e}</li>`).join("")}</ul>`}function Or(i){return`<table class="esri-widget__table">${i.keys().map(e=>{const t=i.field(e);return`<tr><th>${e}</th><td>${typeof t=="string"?Ge(zt(t)):t}</td></tr>`}).join("")}</table>`}function Nr({aggregatedFeatures:i,arcadeUtils:e,featureSetVars:t,context:s,viewInfo:n,map:r,graphic:o,interceptor:d}){t.forEach(c=>{const u=c.toLowerCase(),p=n.sr,m={map:r,spatialReference:p,interceptor:d};if(u==="$map"&&(s.vars[u]=e.convertMapToFeatureSetCollection(m)),u==="$layer"&&(s.vars[u]=e.convertFeatureLayerToFeatureSet({layer:o.sourceLayer,spatialReference:p,interceptor:d})),u==="$datastore"&&(s.vars[u]=e.convertServiceUrlToWorkspace({url:o.sourceLayer.url,spatialReference:p,interceptor:d})),u==="$aggregatedfeatures"){const f=o.layer,{fields:g,objectIdField:y,geometryType:v,spatialReference:A,displayField:b}=f,E=new Ns({fields:g,objectIdField:y,geometryType:v,spatialReference:A,displayField:b,...f.type==="feature"?{templates:f.templates,typeIdField:f.typeIdField,types:f.types}:null,source:i});s.vars[u]=e.convertFeatureLayerToFeatureSet({layer:E,spatialReference:A,interceptor:d})}})}function os(){return $(()=>import("./arcadeUtils-ed8f0788.js").then(i=>i.aD),["assets/arcadeUtils-ed8f0788.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/TimeOnly-99f1af45.js","assets/number-108bb6d7.js","assets/featureConversionUtils-6aca8295.js","assets/OptimizedGeometry-d94e541f.js","assets/OptimizedFeatureSet-1d1ac4b9.js"])}function Sr(i){return"createQuery"in i&&"queryFeatures"in i}async function Vr({graphic:i,view:e}){const{isAggregate:t,layer:s}=i;if(!t||!s||(e==null?void 0:e.type)!=="2d")return[];const n=await e.whenLayerView(s);if(!Sr(n))return[];const r=n.createQuery(),o=i.getObjectId();r.aggregateIds=o!=null?[o]:[];const{features:d}=await n.queryFeatures(r);return d}async function as({expressionInfo:i,arcadeUtils:e,interceptor:t,spatialReference:s,map:n,graphic:r,view:o}){if(!(i!=null&&i.expression))return null;const d=e.createSyntaxTree(i.expression),c=Tr.filter(g=>e.hasVariable(d,g)),[u]=await Promise.all([Vr({graphic:r,view:o}),e.loadScriptDependencies(d,!0,c)]),p=e.getViewInfo({spatialReference:s}),m=e.createExecContext(r,p,o==null?void 0:o.timeZone);m.interceptor=t,m.useAsync=!0,Nr({aggregatedFeatures:u,arcadeUtils:e,featureSetVars:c,context:m,viewInfo:p,map:n,graphic:r,interceptor:t});const f=e.createFunction(d,m);return e.executeAsyncFunction(f,m).catch(g=>Lr.error("arcade-execution-error",{error:g,graphic:r,expressionInfo:i}))}async function Dr({expressionInfos:i,spatialReference:e,graphic:t,interceptor:s,map:n,view:r}){if(!(i!=null&&i.length))return{};const o=await os(),d={};for(const p of i)d[`expression/${p.name}`]=as({expressionInfo:p,arcadeUtils:o,interceptor:s,spatialReference:e,map:n,graphic:t,view:r});const c=await Te(d),u={};for(const p in c)u[p]=Rr(c[p].value);return u}const Br=1;let ee=class extends pe{constructor(e){super(e),this._abortController=null,this.expressionInfo=null,this.graphic=null,this.contentElement=null,this.contentElementViewModel=null,this.interceptor=null,this.view=null,this._cancelQuery=()=>{const{_abortController:t}=this;t&&t.abort(),this._abortController=null},this._createVM=()=>{var n,r;const t=(n=this.contentElement)==null?void 0:n.type;(r=this.contentElementViewModel)==null||r.destroy();const s=t==="fields"?new ut:t==="media"?new Fe:t==="text"?new at:null;this._set("contentElementViewModel",s)},this._compile=async()=>{this._cancelQuery();const t=new AbortController;this._abortController=t,await this._compileExpression(),this._abortController===t&&(this._abortController=null)},this._compileThrottled=rt(this._compile,Br,this),this._compileExpression=async()=>{const{expressionInfo:t,graphic:s,interceptor:n,spatialReference:r,map:o,view:d,_abortController:c}=this;if(!(t&&s&&r&&o))return void this._set("contentElement",null);const u=await os();if(c!==this._abortController)return;const p=await as({arcadeUtils:u,expressionInfo:t,graphic:s,interceptor:n,map:o,spatialReference:r,view:d});if(!p||p.declaredClass!=="esri.arcade.Dictionary")return void this._set("contentElement",null);const m=await p.castAsJsonAsync(c==null?void 0:c.signal),f=m==null?void 0:m.type,g=f==="media"?Vs.fromJSON(m):f==="text"?Vi.fromJSON(m):f==="fields"?Ds.fromJSON(m):null;this._set("contentElement",g)},this.addHandles([_(()=>[this.expressionInfo,this.graphic,this.map,this.spatialReference,this.view],()=>this._compileThrottled(),W),_(()=>[this.contentElement],()=>this._createVM(),W)])}initialize(){this.addHandles(this._compileThrottled)}destroy(){var e;this._cancelQuery(),(e=this.contentElementViewModel)==null||e.destroy(),this._set("contentElementViewModel",null),this._set("contentElement",null)}get spatialReference(){var e;return((e=this.view)==null?void 0:e.spatialReference)??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{_abortController:e,contentElement:t,contentElementViewModel:s}=this;return e?"loading":t||s?"ready":"disabled"}get map(){var e;return((e=this.view)==null?void 0:e.map)??null}set map(e){this._override("map",e)}};a([l()],ee.prototype,"_abortController",void 0),a([l({type:Ss})],ee.prototype,"expressionInfo",void 0),a([l({type:De})],ee.prototype,"graphic",void 0),a([l({readOnly:!0})],ee.prototype,"contentElement",void 0),a([l({readOnly:!0})],ee.prototype,"contentElementViewModel",void 0),a([l()],ee.prototype,"interceptor",void 0),a([l()],ee.prototype,"spatialReference",null),a([l({readOnly:!0})],ee.prototype,"state",null),a([l()],ee.prototype,"map",null),a([l()],ee.prototype,"view",void 0),ee=a([P("esri.widgets.Feature.FeatureExpression.FeatureExpressionViewModel")],ee);const Ut=ee,$t="esri-feature",Et={base:`${$t}-expression`,loadingSpinnerContainer:`${$t}__loading-container`,spinner:`${$t}__loading-spinner`};let tt=class extends te{constructor(e,t){super(e,t),this._contentWidget=null,this.viewModel=new Ut}initialize(){this.addHandles(_(()=>{var e;return(e=this.viewModel)==null?void 0:e.contentElementViewModel},()=>this._setupExpressionWidget(),W))}destroy(){this._destroyContentWidget()}render(){var t;const{state:e}=this.viewModel;return h("div",{class:Et.base},e==="loading"?this._renderLoading():e==="disabled"?null:(t=this._contentWidget)==null?void 0:t.render())}_renderLoading(){return h("div",{class:Et.loadingSpinnerContainer,key:"loading-container"},h("span",{class:this.classes(ne.loadingIndicator,I.rotating,Et.spinner)}))}_destroyContentWidget(){const{_contentWidget:e}=this;e&&(e.viewModel=null,e.destroy()),this._contentWidget=null}_setupExpressionWidget(){const{contentElementViewModel:e,contentElement:t}=this.viewModel,s=t==null?void 0:t.type;this._destroyContentWidget();const n=e?s==="fields"?new ns({viewModel:e}):s==="media"?new rs({viewModel:e}):s==="text"?new Je({viewModel:e}):null:null;this._contentWidget=n,this.scheduleRender()}};a([l({type:Ut})],tt.prototype,"viewModel",void 0),tt=a([P("esri.widgets.Feature.FeatureExpression")],tt);const qr=tt;var vi;(function(i){i.TOO_SHORT="length-validation-error::too-short"})(vi||(vi={}));const zr=i=>{var t;const e=[];if(i.formTemplate){const{description:s,title:n}=i.formTemplate;(t=i.fields)==null||t.forEach(r=>{const o=n&&ii(n,r.name),d=s&&ii(s,r.name);(o||d)&&e.push(r.name)})}return e},xt=100;let T=class extends Bs(Di(pe)){constructor(e){super(e),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{const{_queryAbortController:t}=this;t&&t.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:t}=this;t&&t.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:t}=this;t&&t.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const t=new AbortController;this._queryAbortController=t,await ft(this._query()),this._queryAbortController===t&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();const t=new AbortController;this._queryFeatureCountAbortController=t,await ft(this._queryFeatureCount()),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryPageController=async()=>{const t=new AbortController;this._queryPageAbortController=t,await ft(this._queryPage()),this._queryPageAbortController===t&&(this._queryPageAbortController=null)},this._queryDebounced=gt(this._queryController,xt),this._queryFeatureCountDebounced=gt(this._queryFeatureCountController,xt),this._queryPageDebounced=gt(this._queryPageController,xt),this._query=async()=>{const{_queryAbortController:t,relatedFeatures:s}=this;this.featureCount&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,s.removeAll(),this.destroyed||s.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:t==null?void 0:t.signal}))))},this.addHandles([_(()=>{var t;return[this.displayCount,this.graphic,this.layer,(t=this.layer)==null?void 0:t.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount]},()=>this._queryDebounced(),W),_(()=>[this.featurePage,this.showAllEnabled],()=>this._queryPageDebounced()),_(()=>[this.layer,this.relationshipId,this.objectId,this.canQuery],()=>this._queryFeatureCountDebounced())])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.removeAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:s}=this,n=1,r=Math.ceil(s/t)||1;this._set("featurePage",Math.min(Math.max(e,n),r))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&(t!=null&&t.loaded)?e.map(s=>{const n=s.clone();return n.field=Ze(s.field,t),n}):e??[]}get supportsCacheHint(){var e,t,s;return!!((s=(t=(e=this.layer)==null?void 0:e.capabilities)==null?void 0:t.queryRelated)!=null&&s.supportsCacheHint)}get canLoad(){return!!this.map&&typeof this.relationshipId=="number"&&typeof this.objectId=="number"}get canQuery(){var t,s;const e=(s=(t=this.layer)==null?void 0:t.capabilities)==null?void 0:s.queryRelated;return!!(this.relatedLayer&&this.relationship&&typeof this.relationshipId=="number"&&typeof this.objectId=="number"&&(e!=null&&e.supportsCount)&&(e!=null&&e.supportsPagination))}get itemDescriptionFieldName(){var e;return((e=this.orderByFieldsFixedCasing[0])==null?void 0:e.field)||null}set displayCount(e){this._set("displayCount",Math.min(Math.max(e,0),10))}get displayCount(){return this._get("displayCount")}get objectId(){var e,t;return(this.objectIdField&&((t=(e=this.graphic)==null?void 0:e.attributes)==null?void 0:t[this.objectIdField]))??null}get objectIdField(){var e;return((e=this.layer)==null?void 0:e.objectIdField)||null}get relatedFeatures(){return this._get("relatedFeatures")||new Se}get relatedLayer(){const{layer:e,map:t,relationship:s}=this;return e!=null&&e.loaded&&t&&s?Wn(t,e,s)??null:null}get relationship(){var s;const{relationshipId:e,layer:t}=this;return typeof e=="number"?((s=t==null?void 0:t.relationships)==null?void 0:s.find(({id:n})=>n===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new Se}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:s,canQuery:n,_loaded:r,canLoad:o}=this;return t||o&&!r?"loading":e||s?"querying":n?"ready":"disabled"}getRelatedFeatureByObjectId(e){return this.relatedFeatures.find(t=>t.getObjectId()===e)}_destroyRelatedFeatureViewModels(){var e;(e=this.relatedFeatureViewModels)==null||e.forEach(t=>!t.destroyed&&t.destroy()),this.relatedFeatureViewModels.removeAll()}async _queryFeatureCount(){const{layer:e,relatedLayer:t,relationshipId:s,objectId:n,_queryFeatureCountAbortController:r,canQuery:o,supportsCacheHint:d}=this;if(await(e==null?void 0:e.load()),await(t==null?void 0:t.load()),!o||!e||!t)return void this._set("featureCount",0);const c=t.createQuery(),u=new Lt({cacheHint:d,relationshipId:s,returnGeometry:!1,objectIds:[n],where:c.where??void 0}),p=await e.queryRelatedFeaturesCount(u,{signal:r==null?void 0:r.signal});this._set("featureCount",p[n]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:s}=this;return t?e:s?e.slice(0,s):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:s,_queryPageAbortController:n,featureCount:r}=this;!s||t<2||!r||e.addMany(await this._queryRelatedFeatures({signal:n==null?void 0:n.signal}))}async _queryRelatedFeatures(e){var ie;const{orderByFieldsFixedCasing:t,showAllEnabled:s,featuresPerPage:n,displayCount:r,layer:o,relationshipId:d,featurePage:c,featureCount:u,relatedLayer:p,supportsCacheHint:m}=this,{canQuery:f,objectId:g}=this;if(!f||!o||!p)return[];const y=s?((c-1)*n+u)%u:0,v=s?n:r,A=p.objectIdField,b=[...t.map(z=>z.field),...zr(p),A].filter(dt),E=t.map(z=>`${z.field} ${z.order}`),R=p.createQuery(),M=new Lt({orderByFields:E,start:y,num:v,outFields:b,cacheHint:m,relationshipId:d,returnGeometry:!1,objectIds:[g],where:R.where??void 0}),re=await o.queryRelatedFeatures(M,{signal:e==null?void 0:e.signal}),K=((ie=re[g])==null?void 0:ie.features)||[];return K.forEach(z=>{z.sourceLayer=p,z.layer=p}),K}};a([l()],T.prototype,"_loaded",void 0),a([l()],T.prototype,"_queryAbortController",void 0),a([l()],T.prototype,"_queryPageAbortController",void 0),a([l()],T.prototype,"_queryFeatureCountAbortController",void 0),a([l({value:1})],T.prototype,"featurePage",null),a([l()],T.prototype,"featuresPerPage",void 0),a([l({readOnly:!0})],T.prototype,"orderByFieldsFixedCasing",null),a([l({readOnly:!0})],T.prototype,"supportsCacheHint",null),a([l({readOnly:!0})],T.prototype,"canLoad",null),a([l({readOnly:!0})],T.prototype,"canQuery",null),a([l()],T.prototype,"description",void 0),a([l({readOnly:!0})],T.prototype,"itemDescriptionFieldName",null),a([l({value:3})],T.prototype,"displayCount",null),a([l({type:De})],T.prototype,"graphic",void 0),a([l()],T.prototype,"layer",void 0),a([l()],T.prototype,"map",void 0),a([l({readOnly:!0})],T.prototype,"objectId",null),a([l({readOnly:!0})],T.prototype,"objectIdField",null),a([l()],T.prototype,"orderByFields",void 0),a([l({readOnly:!0})],T.prototype,"relatedFeatures",null),a([l({readOnly:!0})],T.prototype,"relatedLayer",null),a([l({readOnly:!0})],T.prototype,"relationship",null),a([l()],T.prototype,"featureCount",void 0),a([l({readOnly:!0})],T.prototype,"relatedFeatureViewModels",null),a([l()],T.prototype,"relationshipId",void 0),a([l()],T.prototype,"showAllEnabled",void 0),a([l()],T.prototype,"state",null),a([l()],T.prototype,"title",void 0),a([l()],T.prototype,"getRelatedFeatureByObjectId",null),T=a([P("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],T);const Zt=T,He="esri-feature",ze=`${He}-relationship`,de={base:ze,listContainer:`${ze}__list`,listItem:`${ze}__list-item`,listItemHidden:`${ze}__list-item--hidden`,listContainerQuerying:`${ze}__list--querying`,featureObserver:`${He}__feature-observer`,stickySpinnerContainer:`${He}__sticky-loading-container`,loadingSpinnerContainer:`${He}__loading-container`,spinner:`${He}__loading-spinner`},wi={title:!0,description:!0};let Q=class extends te{constructor(e,t){super(e,t),this._featureElementInfo=null,this._relatedFeatureIntersectionObserverNode=null,this._relatedFeatureIntersectionObserver=new IntersectionObserver(([s])=>{s!=null&&s.isIntersecting&&this._increaseFeaturePage()},{root:window.document}),this.headingLevel=2,this.viewModel=new Zt,this.messages=null,this.messagesCommon=null,this.visibleElements={...wi},this._increaseFeaturePage=()=>{const{state:s,showAllEnabled:n,relatedFeatures:r,featuresPerPage:o,featurePage:d}=this.viewModel;s==="ready"&&n&&r.length>=o*d&&this.viewModel.featurePage++}}initialize(){this._featureElementInfo=new ct,this.addHandles([_(()=>[this.viewModel.description,this.viewModel.title,this.headingLevel],()=>this._setupFeatureElementInfo(),W),_(()=>[this.viewModel.state,this.viewModel.showAllEnabled,this._relatedFeatureIntersectionObserverNode],()=>this._handleRelatedFeatureObserverChange()),Ee(()=>this.viewModel.relatedFeatureViewModels,"change",()=>this._setupRelatedFeatureViewModels())])}loadDependencies(){return Be({icon:()=>$(()=>import("./calcite-icon-5a112ca1.js"),["assets/calcite-icon-5a112ca1.js","assets/icon-8ad9147a.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/observers-c5d3b3aa.js"]),list:()=>$(()=>import("./calcite-list-eca0cd56.js"),["assets/calcite-list-eca0cd56.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/interactive-3caa9409.js","assets/observers-c5d3b3aa.js","assets/utils3-7b57e505.js","assets/loadable-3ebcbea1.js","assets/debounce-49101817.js","assets/t9n-0922c59a.js","assets/icon-8ad9147a.js","assets/label2-60192bf8.js","assets/loader-f61cd56d.js","assets/scrim-f377044b.js"]),"list-item":()=>$(()=>import("./calcite-list-item-98e2d895.js"),["assets/calcite-list-item-98e2d895.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/interactive-3caa9409.js","assets/utils3-7b57e505.js","assets/t9n-0922c59a.js","assets/observers-c5d3b3aa.js","assets/loadable-3ebcbea1.js","assets/action-a6ed46b3.js","assets/loader-f61cd56d.js","assets/icon-8ad9147a.js"]),notice:()=>$(()=>import("./calcite-notice-b51133c1.js"),["assets/calcite-notice-b51133c1.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/conditionalSlot-1b98233e.js","assets/observers-c5d3b3aa.js","assets/loadable-3ebcbea1.js","assets/t9n-0922c59a.js","assets/openCloseComponent-cdeb3156.js","assets/icon-8ad9147a.js"])})}destroy(){this._unobserveRelatedFeatureObserver(),this._featureElementInfo=qs(this._featureElementInfo)}get displayShowAllButton(){const{showAllEnabled:e,featureCount:t,displayCount:s,state:n}=this.viewModel;return!e&&!!t&&n==="ready"&&(t>s||s===0)}get displayListItems(){return this.displayShowAllButton||this.viewModel.relatedFeatureViewModels.length>0}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get featureCountDescription(){const{messages:e}=this,{featureCount:t}=this.viewModel;return le(e==null?void 0:e.numberRecords,{number:t})}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}castVisibleElements(e){return{...wi,...e}}render(){var t;const{state:e}=this.viewModel;return h("div",{class:this.classes(de.base,I.widget)},(t=this._featureElementInfo)==null?void 0:t.render(),e==="loading"?this._renderLoading():e==="disabled"?this._renderRelationshipNotFound():this._renderRelatedFeatures())}_renderStickyLoading(){return this.viewModel.state==="querying"?h("div",{class:de.stickySpinnerContainer,key:"sticky-loader"},this._renderLoadingIcon()):null}_renderLoadingIcon(){return h("span",{class:this.classes(ne.loadingIndicator,I.rotating,de.spinner)})}_renderLoading(){return h("div",{class:de.loadingSpinnerContainer,key:"loading-container"},this._renderLoadingIcon())}_renderShowAllIconNode(){return h("calcite-icon",{icon:"list",scale:"s",slot:"content-end"})}_renderChevronIconNode(){const e=xe(this.container)?"chevron-left":"chevron-right";return h("calcite-icon",{icon:e,scale:"s",slot:"content-end"})}_renderRelatedFeature(e){var r;const{itemDescriptionFieldName:t}=this.viewModel,s=e.title;e.description=t&&((r=e.formattedAttributes)==null?void 0:r.global[t]);const n=e.state==="loading";return h("calcite-list-item",{class:this.classes(de.listItem,{[de.listItemHidden]:n}),description:e.description??"",key:e.uid,label:s,onCalciteListItemSelect:()=>this.emit("select-record",{featureViewModel:e})},this._renderChevronIconNode())}_renderShowAllListItem(){var e;return this.displayShowAllButton?h("calcite-list-item",{description:this.featureCountDescription,key:"show-all-item",label:(e=this.messages)==null?void 0:e.showAll,onCalciteListItemSelect:()=>this.emit("show-all-records")},this._renderShowAllIconNode()):null}_renderNoRelatedFeaturesMessage(){var e;return h("calcite-notice",{icon:"information",key:"no-related-features-message",kind:"brand",open:!0,scale:"s",width:"full"},h("div",{slot:"message"},(e=this.messages)==null?void 0:e.noRelatedFeatures))}_renderFeatureObserver(){return h("div",{afterCreate:this._relatedFeatureIntersectionObserverCreated,bind:this,class:de.featureObserver,key:"feature-observer"})}_renderList(){const{relatedFeatureViewModels:e}=this.viewModel;return h("calcite-list",null,e.toArray().map(t=>this._renderRelatedFeature(t)),this._renderShowAllListItem())}_renderRelatedFeatures(){const{displayListItems:e}=this,{state:t}=this.viewModel;return h("div",{class:this.classes(de.listContainer,{[de.listContainerQuerying]:t==="querying"}),key:"list-container"},e?this._renderList():t==="ready"?this._renderNoRelatedFeaturesMessage():null,this._renderStickyLoading(),this._renderFeatureObserver())}_renderRelationshipNotFound(){var e;return h("calcite-notice",{icon:"exclamation-mark-triangle",key:"relationship-not-found",kind:"danger",open:!0,scale:"s",width:"full"},h("div",{slot:"message"},(e=this.messages)==null?void 0:e.relationshipNotFound))}_setupRelatedFeatureViewModels(){const{relatedFeatureViewModels:e}=this.viewModel,t="related-feature-viewmodels";this.removeHandles(t),e==null||e.forEach(s=>{this.addHandles(_(()=>[s.title,s.state],()=>this.scheduleRender(),W),t)}),this.scheduleRender()}_setupFeatureElementInfo(){var r;const{headingLevel:e,visibleElements:t}=this,s=t.description&&this.description,n=t.title&&this.title;(r=this._featureElementInfo)==null||r.set({description:s,title:n,headingLevel:e})}async _handleRelatedFeatureObserverChange(){this._unobserveRelatedFeatureObserver();const{state:e,showAllEnabled:t}=this.viewModel;await Bi(0),this._relatedFeatureIntersectionObserverNode&&e==="ready"&&t&&this._relatedFeatureIntersectionObserver.observe(this._relatedFeatureIntersectionObserverNode)}_relatedFeatureIntersectionObserverCreated(e){this._relatedFeatureIntersectionObserverNode=e}_unobserveRelatedFeatureObserver(){this._relatedFeatureIntersectionObserverNode&&this._relatedFeatureIntersectionObserver.unobserve(this._relatedFeatureIntersectionObserverNode)}};a([l()],Q.prototype,"_relatedFeatureIntersectionObserverNode",void 0),a([l({readOnly:!0})],Q.prototype,"displayShowAllButton",null),a([l({readOnly:!0})],Q.prototype,"displayListItems",null),a([l()],Q.prototype,"description",null),a([l({readOnly:!0})],Q.prototype,"featureCountDescription",null),a([l()],Q.prototype,"headingLevel",void 0),a([l()],Q.prototype,"title",null),a([l({type:Zt})],Q.prototype,"viewModel",void 0),a([l(),Y("esri/widgets/Feature/t9n/Feature")],Q.prototype,"messages",void 0),a([l(),Y("esri/t9n/common")],Q.prototype,"messagesCommon",void 0),a([l()],Q.prototype,"visibleElements",void 0),a([Ve("visibleElements")],Q.prototype,"castVisibleElements",null),Q=a([P("esri.widgets.Feature.FeatureRelationship")],Q);const bi=Q;let Wr=class{constructor(e,t){this.preLayerQueryCallback=e,this.preRequestCallback=t,this.preLayerQueryCallback||(this.preLayerQueryCallback=s=>{}),this.preRequestCallback||(this.preLayerQueryCallback=s=>{})}};var je;const Hr=1,Mi="content-view-models",Ii="relationship-view-models",Fi={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0};let O=je=class extends Di(pe){constructor(i){super(i),this._error=null,this._featureAbortController=null,this._graphicChangedThrottled=rt(this._graphicChanged,Hr,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...Fi},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return e.type==="attachments"&&!!t.attachmentsContent||e.type==="custom"&&!!t.customContent||e.type==="fields"&&!!t.fieldsContent||e.type==="media"&&!!t.mediaContent||e.type==="text"&&!!t.textContent||e.type==="expression"&&!!t.expressionContent||e.type==="relationship"&&!!t.relationshipContent},this.addHandles(_(()=>[this.graphic,this._effectivePopupTemplate,this.abilities],()=>this._graphicChangedThrottled(),W))}initialize(){this.addHandles(this._graphicChangedThrottled)}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return this.graphic!=null?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return Nn(di(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return Qi(this.graphic)}castAbilities(i){return{...Fi,...i}}get isTable(){var i;return((i=this._sourceLayer)==null?void 0:i.isTable)||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(i){this._set("graphic",i?i.clone():null)}get spatialReference(){var i;return((i=this.view)==null?void 0:i.spatialReference)??null}set spatialReference(i){this._override("spatialReference",i)}get map(){var i;return((i=this.view)==null?void 0:i.map)||null}set map(i){this._override("map",i)}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(i,e){const t=this.contentViewModels[i];t instanceof Fe&&t.setActiveMedia(e)}nextMedia(i){const e=this.contentViewModels[i];e instanceof Fe&&e.next()}previousMedia(i){const e=this.contentViewModels[i];e instanceof Fe&&e.previous()}async updateGeometry(){var o;const{graphic:i,spatialReference:e,_sourceLayer:t}=this;await(t==null?void 0:t.load());const s=t==null?void 0:t.objectIdField;if(!s||!i||!t)return;const n=(o=i==null?void 0:i.attributes)==null?void 0:o[s];if(n==null)return;const r=[n];if(!i.geometry){const d=await ts({layer:t,graphic:i,outFields:[],objectIds:r,returnGeometry:!0,spatialReference:e}),c=d==null?void 0:d.geometry;c&&(i.geometry=c)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:i}=this;if(!i)return;const e=new AbortController;this._featureAbortController=e;try{await this._queryFeature({signal:e.signal})}catch(t){zs(t)||(this._error=t,X.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:t,graphic:i,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===e&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:i}=this;i&&i.abort(),this._featureAbortController=null}_compileContentElement(i,e){return i.type==="attachments"?this._compileAttachments(i,e):i.type==="custom"?this._compileCustom(i,e):i.type==="fields"?this._compileFields(i,e):i.type==="media"?this._compileMedia(i,e):i.type==="text"?this._compileText(i,e):i.type==="expression"?this._compileExpression(i,e):i.type==="relationship"?this._compileRelationship(i,e):void 0}_compileContent(i){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(i)?i.filter(this._isAllowedContentType).map((e,t)=>this._compileContentElement(e,t)).filter(dt):typeof i=="string"?this._compileText(new Vi({text:i}),0).text:i}_destroyContentViewModels(){this.removeHandles(Ii),this.removeHandles(Mi),this.contentViewModels.forEach(i=>i&&!i.destroyed&&i.destroy()),this._set("contentViewModels",[])}_matchesFeature(i,e){var n;const t=(n=i==null?void 0:i.graphic)==null?void 0:n.getObjectId(),s=e==null?void 0:e.getObjectId();return t!=null&&s!=null&&t===s}_setRelatedFeaturesViewModels({relatedFeatureViewModels:i,relatedFeatures:e,map:t}){const{view:s,spatialReference:n}=this;e==null||e.filter(Boolean).forEach(r=>{i.find(o=>this._matchesFeature(o,r))||i.add(new je({abilities:{relationshipContent:!1},map:t,view:s,spatialReference:n,graphic:r}))}),i.forEach(r=>{(e==null?void 0:e.find(d=>this._matchesFeature(r,d)))||i.remove(r)})}_setExpressionContentVM(i,e){const t=this.formattedAttributes,{contentElement:s,contentElementViewModel:n}=i,r=s==null?void 0:s.type;n&&r&&(r==="fields"&&(this._createFieldsFormattedAttributes({contentElement:s,contentElementIndex:e,formattedAttributes:t}),n.set(this._createFieldsVMParams(s,e))),r==="media"&&(this._createMediaFormattedAttributes({contentElement:s,contentElementIndex:e,formattedAttributes:t}),n.set(this._createMediaVMParams(s,e))),r==="text"&&n.set(this._createTextVMParams(s)))}_compileRelationship(i,e){const{displayCount:t,orderByFields:s,relationshipId:n,title:r,description:o}=i,{_sourceLayer:d,graphic:c,map:u}=this;if(!Ki(d))return;const p=new Zt({displayCount:t,graphic:c,orderByFields:s,relationshipId:n,layer:d,map:u,...this._compileTitleAndDesc({title:r,description:o})});return this.contentViewModels[e]=p,this.addHandles(Ee(()=>p.relatedFeatures,"change",()=>this._setRelatedFeaturesViewModels(p)),Ii),i}_compileExpression(i,e){const{expressionInfo:t}=i,{graphic:s,map:n,spatialReference:r,view:o}=this,d=new Ut({expressionInfo:t,graphic:s,interceptor:je.interceptor,map:n,spatialReference:r,view:o});return this.contentViewModels[e]=d,this.addHandles(_(()=>d.contentElementViewModel,()=>this._setExpressionContentVM(d,e),W),Mi),i}_compileAttachments(i,e){const{graphic:t}=this,{description:s,title:n}=i;return this.contentViewModels[e]=new Ht({graphic:t,...this._compileTitleAndDesc({title:n,description:s})}),i}_compileCustom(i,e){const{graphic:t}=this,{creator:s,destroyer:n}=i;return this.contentViewModels[e]=new at({graphic:t,creator:s,destroyer:n}),i}_compileTitleAndDesc({title:i,description:e}){const{_fieldInfoMap:t,_sourceLayer:s,graphic:n,formattedAttributes:r}=this,o=n==null?void 0:n.attributes,d=this._expressionAttributes,c=r.global;return{title:Ie({attributes:o,fieldInfoMap:t,globalAttributes:c,expressionAttributes:d,layer:s,text:i}),description:Ie({attributes:o,fieldInfoMap:t,globalAttributes:c,expressionAttributes:d,layer:s,text:e})}}_createFieldsVMParams(i,e){const t=this._effectivePopupTemplate,s=this.formattedAttributes,n={...s==null?void 0:s.global,...s==null?void 0:s.content[e]},r=(i==null?void 0:i.fieldInfos)||(t==null?void 0:t.fieldInfos),o=r==null?void 0:r.filter(({fieldName:p})=>Bt(p)||he(p)||n.hasOwnProperty(p)),d=t==null?void 0:t.expressionInfos,{description:c,title:u}=i;return{attributes:n,expressionInfos:d,fieldInfos:o,...this._compileTitleAndDesc({title:u,description:c})}}_compileFields(i,e){const t=i.clone(),s=new ut(this._createFieldsVMParams(i,e));return this.contentViewModels[e]=s,t.fieldInfos=s.formattedFieldInfos.slice(0),t}_createMediaVMParams(i,e){const{abilities:t,graphic:s,_fieldInfoMap:n,_effectivePopupTemplate:r,relatedInfos:o,_sourceLayer:d,_expressionAttributes:c}=this,u=this.formattedAttributes,p=(s==null?void 0:s.attributes)??{},{description:m,mediaInfos:f,title:g}=i;return{abilities:{chartAnimation:t.chartAnimation},activeMediaInfoIndex:i.activeMediaInfoIndex||0,attributes:p,isAggregate:s==null?void 0:s.isAggregate,layer:d,fieldInfoMap:n,formattedAttributes:{...u==null?void 0:u.global,...u==null?void 0:u.content[e]},expressionAttributes:c,mediaInfos:f,popupTemplate:r,relatedInfos:o,...this._compileTitleAndDesc({title:g,description:m})}}_compileMedia(i,e){const t=i.clone(),s=new Fe(this._createMediaVMParams(i,e));return t.mediaInfos=s.formattedMediaInfos.slice(0),this.contentViewModels[e]=s,t}_createTextVMParams(i){var r;const{graphic:e,_fieldInfoMap:t,_sourceLayer:s,_expressionAttributes:n}=this;if(i&&i.text){const o=(e==null?void 0:e.attributes)??{},d=((r=this.formattedAttributes)==null?void 0:r.global)??{};i.text=Ie({attributes:o,fieldInfoMap:t,globalAttributes:d,expressionAttributes:n,layer:s,text:i.text})}return{graphic:e,creator:i.text}}_compileText(i,e){const t=i.clone();return this.contentViewModels[e]=new at(this._createTextVMParams(t)),t}_compileLastEditInfo(){const{_effectivePopupTemplate:i,_sourceLayer:e,graphic:t,view:s}=this;if(!i)return;const{lastEditInfoEnabled:n}=i,r=e==null?void 0:e.editFieldsInfo;return n&&r?On(r,t==null?void 0:t.attributes,(s==null?void 0:s.timeZone)??Xe,e):void 0}_compileTitle(i){var d;const{_fieldInfoMap:e,_sourceLayer:t,graphic:s,_expressionAttributes:n}=this,r=(s==null?void 0:s.attributes)??{},o=((d=this.formattedAttributes)==null?void 0:d.global)??{};return Ie({attributes:r,fieldInfoMap:e,globalAttributes:o,expressionAttributes:n,layer:t,text:i})}async _getTitle(){const{_effectivePopupTemplate:i,graphic:e}=this;if(!e)return null;const t=i==null?void 0:i.title;return ot(t,{graphic:e})}async _getContent(){const{_effectivePopupTemplate:i,graphic:e}=this;if(!e)return null;const t=i==null?void 0:i.content;return ot(t,{graphic:e})}async _queryFeature(i){const{_featureAbortController:e,_sourceLayer:t,graphic:s,_effectivePopupTemplate:n}=this,r=this.map,o=this.view,d=this.spatialReference;if(e!==this._featureAbortController||!s)return;await Vn({graphic:s,popupTemplate:n,layer:t,spatialReference:d},i);const{content:{value:c},title:{value:u}}=await Te({content:this._getContent(),title:this._getTitle()}),{expressionAttributes:{value:p}}=await Te({checkForRelatedFeatures:this._checkForRelatedFeatures(i),expressionAttributes:Dr({expressionInfos:n==null?void 0:n.expressionInfos,spatialReference:d,graphic:s,map:r,interceptor:je.interceptor,view:o})});e===this._featureAbortController&&s&&(this._expressionAttributes=p,this._graphicExpressionAttributes={...s.attributes,...p},this._set("formattedAttributes",this._createFormattedAttributes(c)),this._set("title",this._compileTitle(u)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(c)||null))}_createMediaFormattedAttributes({contentElement:i,contentElementIndex:e,formattedAttributes:t}){var u;const{_effectivePopupTemplate:s,graphic:n,relatedInfos:r,_sourceLayer:o,_fieldInfoMap:d,_graphicExpressionAttributes:c}=this;t.content[e]=wt({fieldInfos:s==null?void 0:s.fieldInfos,graphic:n,attributes:{...c,...i.attributes},layer:o,fieldInfoMap:d,relatedInfos:r,timeZone:((u=this.view)==null?void 0:u.timeZone)??Xe})}_createFieldsFormattedAttributes({contentElement:i,contentElementIndex:e,formattedAttributes:t}){var s;if(i.fieldInfos){const{graphic:n,relatedInfos:r,_sourceLayer:o,_fieldInfoMap:d,_graphicExpressionAttributes:c}=this;t.content[e]=wt({fieldInfos:i.fieldInfos,graphic:n,attributes:{...c,...i.attributes},layer:o,fieldInfoMap:d,relatedInfos:r,timeZone:((s=this.view)==null?void 0:s.timeZone)??Xe})}}_createFormattedAttributes(i){var u;const{_effectivePopupTemplate:e,graphic:t,relatedInfos:s,_sourceLayer:n,_fieldInfoMap:r,_graphicExpressionAttributes:o}=this,d=e==null?void 0:e.fieldInfos,c={global:wt({fieldInfos:d,graphic:t,attributes:o,layer:n,fieldInfoMap:r,relatedInfos:s,timeZone:((u=this.view)==null?void 0:u.timeZone)??Xe}),content:[]};return Array.isArray(i)&&i.forEach((p,m)=>{p.type==="fields"&&this._createFieldsFormattedAttributes({contentElement:p,contentElementIndex:m,formattedAttributes:c}),p.type==="media"&&this._createMediaFormattedAttributes({contentElement:p,contentElementIndex:m,formattedAttributes:c})}),c}_checkForRelatedFeatures(i){const{graphic:e,_effectivePopupTemplate:t}=this;return this._queryRelatedInfos(e,di(t),i)}async _queryRelatedInfos(i,e,t){const{relatedInfos:s,_sourceLayer:n}=this;s.clear();const r=(n==null?void 0:n.associatedLayer)!=null?await(n==null?void 0:n.associatedLayer.load(t)):n;if(!r||!i)return;const o=e.filter(u=>u&&he(u.fieldName));if(!(o!=null&&o.length))return;e.forEach(u=>this._configureRelatedInfo(u,r));const d=await Mr({relatedInfos:s,layer:r},t);Object.keys(d).forEach(u=>{var f;const p=s.get(u.toString()),m=(f=d[u])==null?void 0:f.value;p&&m&&(p.layerInfo=m.data)});const c=await Ir({graphic:i,relatedInfos:s,layer:r},t);Object.keys(c).forEach(u=>{var p;fr((p=c[u])==null?void 0:p.value,s.get(u.toString()))})}_configureRelatedInfo(i,e){const{relatedInfos:t}=this,s=et(i.fieldName);if(!s)return;const{layerId:n,fieldName:r}=s;if(!n)return;const o=t.get(n.toString())||mr(n,e);o&&(Fr({relatedInfo:o,fieldName:r,fieldInfo:i}),this.relatedInfos.set(n,o))}};O.interceptor=new Wr(qn,zn),a([l()],O.prototype,"_error",void 0),a([l()],O.prototype,"_featureAbortController",void 0),a([l({readOnly:!0})],O.prototype,"_effectivePopupTemplate",null),a([l({readOnly:!0})],O.prototype,"_fieldInfoMap",null),a([l({readOnly:!0})],O.prototype,"_sourceLayer",null),a([l()],O.prototype,"abilities",void 0),a([Ve("abilities")],O.prototype,"castAbilities",null),a([l({readOnly:!0})],O.prototype,"content",void 0),a([l({readOnly:!0})],O.prototype,"contentViewModels",void 0),a([l()],O.prototype,"description",void 0),a([l({type:Boolean})],O.prototype,"defaultPopupTemplateEnabled",void 0),a([l({readOnly:!0})],O.prototype,"isTable",null),a([l({readOnly:!0})],O.prototype,"state",null),a([l({readOnly:!0})],O.prototype,"formattedAttributes",void 0),a([l({type:De,value:null})],O.prototype,"graphic",null),a([l({readOnly:!0})],O.prototype,"lastEditInfo",void 0),a([l({readOnly:!0})],O.prototype,"relatedInfos",void 0),a([l()],O.prototype,"spatialReference",null),a([l({readOnly:!0})],O.prototype,"title",void 0),a([l()],O.prototype,"map",null),a([l({readOnly:!0})],O.prototype,"waitingForContent",null),a([l()],O.prototype,"view",void 0),O=je=a([P("esri.widgets.FeatureViewModel")],O);const Qt=O,ls=i=>{let e=class extends i{constructor(){super(...arguments),this.renderNodeContent=t=>Wi(t)&&!t.destroyed?h("div",{class:N.contentNode,key:t},t.render()):t instanceof HTMLElement?h("div",{afterCreate:this._attachToNode,bind:t,class:N.contentNode,key:t}):nn(t)?h("div",{afterCreate:this._attachToNode,bind:t.domNode,class:N.contentNode,key:t}):null}_attachToNode(t){const s=this;t.appendChild(s)}};return e=a([P("esri.widgets.Feature.ContentMixin")],e),e};var Ot;const Ai={title:!0,content:!0,lastEditedInfo:!0},Ci="relationship-handles";let B=Ot=class extends ls(te){constructor(i,e){super(i,e),this._contentWidgets=[],this.flowItems=null,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.visibleElements={...Ai},this.viewModel=new Qt}initialize(){this.addHandles(_(()=>{var i;return(i=this.viewModel)==null?void 0:i.contentViewModels},()=>this._setupContentWidgets(),W))}loadDependencies(){return Be({notice:()=>$(()=>import("./calcite-notice-b51133c1.js"),["assets/calcite-notice-b51133c1.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/conditionalSlot-1b98233e.js","assets/observers-c5d3b3aa.js","assets/loadable-3ebcbea1.js","assets/t9n-0922c59a.js","assets/openCloseComponent-cdeb3156.js","assets/icon-8ad9147a.js"])})}destroy(){this._destroyContentWidgets()}get graphic(){return this.viewModel.graphic}set graphic(i){this.viewModel.graphic=i}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(i){this.viewModel.defaultPopupTemplateEnabled=i}get isTable(){return this.viewModel.isTable}get label(){var i;return((i=this.messages)==null?void 0:i.widgetLabel)??""}set label(i){this._overrideIfSome("label",i)}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(i){this.viewModel.spatialReference=i}get title(){return this.viewModel.title}castVisibleElements(i){return{...Ai,...i}}get map(){return this.viewModel.map}set map(i){this.viewModel.map=i}get view(){return this.viewModel.view}set view(i){this.viewModel.view=i}setActiveMedia(i,e){return this.viewModel.setActiveMedia(i,e)}nextMedia(i){return this.viewModel.nextMedia(i)}previousMedia(i){return this.viewModel.previousMedia(i)}render(){const{state:i}=this.viewModel,e=h("div",{class:N.container,key:"container"},this._renderTitle(),i==="error"?this._renderError():i==="loading"?this._renderLoading():this._renderContentContainer());return h("div",{class:this.classes(N.base,I.widget)},e)}_renderError(){const{messagesCommon:i,messages:e,visibleElements:t}=this;return h("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0,scale:"s"},t.title?h("div",{key:"error-title",slot:"title"},i.errorMessage):null,h("div",{key:"error-message",slot:"message"},e.loadingError))}_renderLoading(){return h("div",{class:N.loadingSpinnerContainer,key:"loading-container"},h("span",{class:this.classes(ne.loadingIndicator,I.rotating,N.spinner)}))}_renderContentContainer(){const{visibleElements:i}=this;return i.content?h("div",{class:N.main},[this._renderContent(),this._renderLastEditInfo()]):null}_renderTitle(){const{visibleElements:i,title:e}=this;return i.title?h(jt,{class:N.title,innerHTML:e,level:this.headingLevel}):null}_renderContent(){const i=this.viewModel.content,e="content";if(!i)return null;if(Array.isArray(i))return i.length?h("div",{class:N.contentNode,key:`${e}-content-elements`},i.map(this._renderContentElement,this)):null;if(typeof i=="string"){const t=this._contentWidgets[0];return!t||t.destroyed?null:h("div",{class:this.classes(N.contentNode,N.contentNodeText),key:`${e}-content`},t.render())}return this.renderNodeContent(i)}_renderContentElement(i,e){var s;const{visibleElements:t}=this;if(typeof t.content!="boolean"&&!((s=t.content)!=null&&s[i.type]))return null;switch(i.type){case"attachments":return this._renderAttachments(e);case"custom":return this._renderCustom(i,e);case"fields":return this._renderFields(e);case"media":return this._renderMedia(e);case"text":return this._renderText(i,e);case"expression":return this._renderExpression(e);case"relationship":return this._renderRelationship(e);default:return null}}_renderAttachments(i){const e=this._contentWidgets[i];if(!e||e.destroyed)return null;const{state:t,attachmentInfos:s}=e.viewModel;return t==="loading"||s.length>0?h("div",{class:this.classes(N.contentElement),key:this._buildKey("attachments-element",i)},e.render()):null}_renderRelationship(i){const e=this._contentWidgets[i];return e&&!e.destroyed&&this.flowItems?h("div",{class:N.contentElement,key:this._buildKey("relationship-element",i)},e.render()):null}_renderExpression(i){const e=this._contentWidgets[i];return!e||e.destroyed?null:h("div",{class:N.contentElement,key:this._buildKey("expression-element",i)},e.render())}_renderCustom(i,e){const{creator:t}=i,s=this._contentWidgets[e];return!s||s.destroyed?null:t?h("div",{class:N.contentElement,key:this._buildKey("custom-element",e)},s.render()):null}_renderFields(i){const e=this._contentWidgets[i];return!e||e.destroyed?null:h("div",{class:N.contentElement,key:this._buildKey("fields-element",i)},e.render())}_renderMedia(i){const e=this._contentWidgets[i];return!e||e.destroyed?null:h("div",{class:N.contentElement,key:this._buildKey("media-element",i)},e.render())}_renderLastEditInfo(){const{visibleElements:i,messages:e}=this,{lastEditInfo:t}=this.viewModel;if(!t||!i.lastEditedInfo)return null;const{date:s,user:n}=t,r=t.type==="edit"?n?e.lastEditedByUser:e.lastEdited:n?e.lastCreatedByUser:e.lastCreated,o=le(r,{date:s,user:n});return h("div",{class:this.classes(N.lastEditedInfo,N.contentElement),key:"edit-info-element"},o)}_renderText(i,e){const t=i.text,s=this._contentWidgets[e];return!s||s.destroyed?null:t?h("div",{class:this.classes(N.contentElement,N.text),key:this._buildKey("text-element",e)},s.render()):null}_buildKey(i,...e){var t,s;return`${i}__${((s=(t=this.viewModel)==null?void 0:t.graphic)==null?void 0:s.uid)||"0"}-${e.join("-")}`}_destroyContentWidget(i){i&&(i.viewModel=null,!i.destroyed&&i.destroy())}_destroyContentWidgets(){this.removeHandles(Ci),this._contentWidgets.forEach(i=>this._destroyContentWidget(i)),this._contentWidgets=[]}_addFeatureRelationshipHandles(i){const{flowItems:e,visibleElements:t}=this;this.addHandles([Ee(()=>i,"select-record",({featureViewModel:s})=>{e&&(s.abilities={relationshipContent:!0},e.push(new Ot({flowItems:e,viewModel:s,visibleElements:t})))}),Ee(()=>i,"show-all-records",()=>{if(!e)return;const{viewModel:s}=i;s.showAllEnabled=!0;const n=new bi({visibleElements:{title:!1,description:!1},viewModel:s});this._addFeatureRelationshipHandles(n),e.push(n)})],Ci)}_setupContentWidgets(){var n;this._destroyContentWidgets();const{headingLevel:i,visibleElements:e}=this,t=(n=this.viewModel)==null?void 0:n.content,{contentViewModels:s}=this.viewModel;if(Array.isArray(t))t.forEach((r,o)=>{if(r.type==="attachments"&&(this._contentWidgets[o]=new Qn({displayType:r.displayType,headingLevel:e.title?i+1:i,viewModel:s[o]})),r.type==="fields"&&(this._contentWidgets[o]=new ns({viewModel:s[o]})),r.type==="media"&&(this._contentWidgets[o]=new rs({viewModel:s[o]})),r.type==="text"&&(this._contentWidgets[o]=new Je({viewModel:s[o]})),r.type==="custom"&&(this._contentWidgets[o]=new Je({viewModel:s[o]})),r.type==="expression"&&(this._contentWidgets[o]=new qr({viewModel:s[o]})),r.type==="relationship"){const d=new bi({viewModel:s[o]});this._addFeatureRelationshipHandles(d),this._contentWidgets[o]=d}},this);else{const r=s[0];r&&!r.destroyed&&(this._contentWidgets[0]=new Je({viewModel:r}))}this.scheduleRender()}};a([l()],B.prototype,"graphic",null),a([l()],B.prototype,"defaultPopupTemplateEnabled",null),a([l()],B.prototype,"flowItems",void 0),a([l()],B.prototype,"headingLevel",void 0),a([l({readOnly:!0})],B.prototype,"isTable",null),a([l()],B.prototype,"label",null),a([l(),Y("esri/widgets/Feature/t9n/Feature")],B.prototype,"messages",void 0),a([l(),Y("esri/t9n/common")],B.prototype,"messagesCommon",void 0),a([l(),Y("esri/widgets/support/t9n/uriUtils")],B.prototype,"messagesURIUtils",void 0),a([l()],B.prototype,"spatialReference",null),a([l({readOnly:!0})],B.prototype,"title",null),a([l()],B.prototype,"visibleElements",void 0),a([Ve("visibleElements")],B.prototype,"castVisibleElements",null),a([l()],B.prototype,"map",null),a([l()],B.prototype,"view",null),a([l({type:Qt})],B.prototype,"viewModel",void 0),B=Ot=a([P("esri.widgets.Feature")],B);const jr=B;let ve=class extends Ws.EventedAccessor{constructor(e){super(e),this.location=null,this.screenLocationEnabled=!1,this.view=null,this.addHandles([nt(()=>{const t=this.screenLocationEnabled?this.view:null;return t?[t.size,t.type==="3d"?t.camera:t.viewpoint]:null},()=>this.notifyChange("screenLocation")),_(()=>this.screenLocation,(t,s)=>{t!=null&&s!=null&&this.emit("view-change")})])}destroy(){this.view=null}get screenLocation(){const{location:e,view:t,screenLocationEnabled:s}=this;return s&&e!=null&&t!=null&&t.ready?t.toScreen(e):null}};a([l()],ve.prototype,"location",void 0),a([l()],ve.prototype,"screenLocation",null),a([l()],ve.prototype,"screenLocationEnabled",void 0),a([l()],ve.prototype,"view",void 0),ve=a([P("esri.widgets.support.AnchorElementViewModel")],ve);const ds=ve,Ur="esri.widgets.CompassViewModel";let it=class extends ds{constructor(e){super(e),this.visible=!1}};a([l()],it.prototype,"visible",void 0),it=a([P(Ur)],it);const cs=it,Tt="esri-spinner",kt={base:Tt,spinnerStart:`${Tt}--start`,spinnerFinish:`${Tt}--finish`};let we=class extends te{constructor(e,t){super(e,t),this._animationDelay=500,this._animationPromise=null,this.viewModel=new cs}initialize(){this.addHandles(_(()=>this.visible,e=>this._visibleChange(e)))}destroy(){this._animationPromise=null}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}show(e){const{location:t,promise:s}=e??{};t&&(this.viewModel.location=t),this.visible=!0;const n=()=>this.hide();s&&s.catch(()=>{}).then(n)}hide(){this.visible=!1}render(){const{visible:e}=this,{screenLocation:t}=this.viewModel,s=!!t,n=e&&s,r=!e&&s,o={[kt.spinnerStart]:n,[kt.spinnerFinish]:r},d=this._getPositionStyles();return h("div",{class:this.classes(kt.base,o),styles:d})}_visibleChange(e){if(e)return void(this.viewModel.screenLocationEnabled=!0);const t=Bi(this._animationDelay);this._animationPromise=t,t.catch(()=>{}).then(()=>{this._animationPromise===t&&(this.viewModel.screenLocationEnabled=!1,this._animationPromise=null)})}_getPositionStyles(){const{screenLocation:e,view:t}=this.viewModel;if(t==null||e==null)return{};const{padding:s}=t;return{left:e.x-s.left+"px",top:e.y-s.top+"px"}}};a([l()],we.prototype,"location",null),a([l()],we.prototype,"view",null),a([l({type:cs})],we.prototype,"viewModel",void 0),a([l()],we.prototype,"visible",null),we=a([P("esri.widgets.Spinner")],we);const Zr=we,H="esri-features",q={icon:`${H}__icon`,actionImage:`${H}__action-image`,base:H,container:`${H}__container`,contentContainer:`${H}__content-container`,contentFeature:`${H}__content-feature`,flowItemCollapsed:`${H}__flow-item--collapsed`,header:`${H}__header`,footer:`${H}__footer`,featureMenuObserver:`${H}__feature-menu-observer`,actionExit:`${H}__action--exit`,loader:`${H}__loader`,featuresHeading:`${H}__heading`,paginationActionBar:`${H}__pagination-action-bar`,paginationPrevious:`${H}__pagination-previous`,paginationNext:`${H}__pagination-next`};let be=class extends te{constructor(e,t){super(e,t),this.messages=null,this.closed=!1,this.closable=!0,this._handleOpenRelatedFeature=s=>{this.emit("open-related-feature",{feature:s})}}loadDependencies(){return Be({action:()=>$(()=>import("./calcite-action-45454cb2.js"),["assets/calcite-action-45454cb2.js","assets/action-a6ed46b3.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/loader-f61cd56d.js","assets/interactive-3caa9409.js","assets/loadable-3ebcbea1.js","assets/t9n-0922c59a.js","assets/observers-c5d3b3aa.js","assets/icon-8ad9147a.js"]),"flow-item":()=>$(()=>import("./calcite-flow-item-227e2828.js"),["assets/calcite-flow-item-227e2828.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/interactive-3caa9409.js","assets/loadable-3ebcbea1.js","assets/t9n-0922c59a.js","assets/observers-c5d3b3aa.js","assets/action-menu-a578494d.js","assets/loader-f61cd56d.js","assets/action-a6ed46b3.js","assets/icon-8ad9147a.js","assets/debounce-49101817.js","assets/openCloseComponent-cdeb3156.js","assets/scrim-f377044b.js"])})}render(){const{flowItems:e}=this,t=e==null?void 0:e.toArray();return h(Hs,null,t==null?void 0:t.map(s=>this._renderRelatedRecordsFlowItem(s)))}_handleCloseClick(){this.emit("close")}_handleExitClick(){this.emit("exit")}_handleRelatedRecordsBackClick(){var t;const e=(t=this.flowItems)==null?void 0:t.pop();e&&("showAllEnabled"in e.viewModel&&(e.viewModel.showAllEnabled=!1),e&&(e.viewModel=null,e.destroy()))}_renderRelatedRecordsFlowItem(e){const{messages:t,closable:s,closed:n}=this,r="graphic"in e&&!e.isTable;return h("calcite-flow-item",{bind:this,closable:s,closed:n,description:this._getRelatedRecordsFlowItemDescription(e),heading:e.title??"",key:`flow-item-${e.viewModel.uid}`,onCalciteFlowItemBack:this._handleRelatedRecordsBackClick,onCalciteFlowItemClose:this._handleCloseClick},h("calcite-action",{appearance:"transparent",bind:this,class:q.actionExit,icon:"move-up",key:"exit-related-records-action",label:t.exitRelatedRecords,onclick:this._handleExitClick,scale:"m",slot:"header-actions-start",text:t.exitRelatedRecords,title:t.exitRelatedRecords}),r?h("calcite-action",{appearance:"transparent",bind:this,icon:"zoom-to-object",key:"open-related-feature-action",label:t.selectFeature,onclick:()=>this._handleOpenRelatedFeature(e),scale:"m",slot:"header-actions-end",text:t.selectFeature,title:t.selectFeature}):null,h("div",{class:q.container},e.render()))}_getRelatedRecordsFlowItemDescription(e){return"featureCountDescription"in e?e.featureCountDescription:e.viewModel.description??""}};a([l()],be.prototype,"flowItems",void 0),a([l(),Y("esri/widgets/Features/t9n/Features")],be.prototype,"messages",void 0),a([l()],be.prototype,"closed",void 0),a([l()],be.prototype,"closable",void 0),be=a([P("esri.widgets.Features.FeaturesRelatedRecords")],be);const Qr=be;let Gr=class{constructor(){this._set=new Set,this._observable=new js}get size(){return _e(this._observable),this._set.size}add(e){const t=this._set.size;return this._set.add(e),this._set.size!==t&&this._observable.notify(),this}clear(){this._set.size>0&&(this._set.clear(),this._observable.notify())}delete(e){const t=this._set.delete(e);return t&&this._observable.notify(),t}entries(){return _e(this._observable),this._set.entries()}forEach(e,t){_e(this._observable),this._set.forEach((s,n)=>e.call(t,s,n,this),t)}has(e){return _e(this._observable),this._set.has(e)}keys(){return _e(this._observable),this._set.keys()}values(){return _e(this._observable),this._set.values()}[Symbol.iterator](){return _e(this._observable),this._set[Symbol.iterator]()}get[Symbol.toStringTag](){return this._set[Symbol.toStringTag]}};const Xr="OBJECTID";var ke;(function(i){i[i.size=22]="size",i[i.lineWidth=50]="lineWidth",i[i.maxSize=120]="maxSize",i[i.maxOutlineSize=80]="maxOutlineSize",i[i.tallSymbolWidth=20]="tallSymbolWidth"})(ke||(ke={}));const $i=qi("android");qi("chrome")||$i&&$i>=4;Us();ke.size;ke.maxSize;ke.maxOutlineSize;ke.lineWidth;ke.tallSymbolWidth;function us(i){return i&&"opacity"in i?i.opacity*us(i.parent):1}async function Yr(i,e){var R;if(!i)return;const t=i.sourceLayer,s=(e!=null&&e.useSourceLayer?t:i.layer)??t,n=us(s);if(i.symbol!=null&&(e==null||e.ignoreGraphicSymbol!==!0)){const M=i.symbol.type==="web-style"?await rn(i.symbol,{...e,cache:e!=null?e.webStyleCache:null}):i.symbol.clone();return _t(M,null,n),M}const r=(e!=null?e.renderer:null)??(s&&"renderer"in s?s.renderer:null);let o=r&&"getSymbolAsync"in r?await r.getSymbolAsync(i,e):null;if(!o)return;if(o=o.type==="web-style"?await o.fetchSymbol({...e,cache:e!=null?e.webStyleCache:null}):o.clone(),!r||!("visualVariables"in r)||!((R=r.visualVariables)!=null&&R.length))return _t(o,null,n),o;if("arcadeRequiredForVisualVariables"in r&&r.arcadeRequiredForVisualVariables&&(e==null?void 0:e.arcade)==null){const M={...e};M.arcade=await Pi(),e=M}const{getColor:d,getOpacity:c,getAllSizes:u,getRotationAngle:p}=await $(()=>import("./index-b5c8f851.js").then(M=>M.mI),["assets/index-b5c8f851.js","assets/index-86716609.css"]),m=[],f=[],g=[],y=[];for(const M of r.visualVariables)switch(M.type){case"color":m.push(M);break;case"opacity":f.push(M);break;case"rotation":y.push(M);break;case"size":M.target||g.push(M)}const v=!!m.length&&m[m.length-1],A=v?d(v,i,e):null,b=!!f.length&&f[f.length-1];let E=b?c(b,i,e):null;if(n!=null&&(E=E!=null?E*n:n),_t(o,A,E),g.length){const M=u(g,i,e);await on(o,M)}for(const M of y)an(o,p(M,i,e),M.axis);return o}function Ei(i){return i&&typeof i.highlight=="function"}const Ce=Se.ofType({key:"type",defaultKeyValue:"button",base:Zs,typeMap:{button:Qe,toggle:zi}}),Ae=new Qe({icon:"magnifying-glass-plus",id:"zoom-to-feature",title:"{messages.zoom}",className:ne.zoomInMagnifyingGlass}),xi=new Qe({icon:"trash",id:"remove-selected-feature",title:"{messages.remove}",className:ne.trash}),Oe=new Qe({icon:"magnifying-glass-plus",id:"zoom-to-clustered-features",title:"{messages.zoom}",className:ne.zoomInMagnifyingGlass}),ge=new zi({icon:"table",id:"browse-clustered-features",title:"{messages.browseClusteredFeatures}",className:ne.table,value:!1}),Kr="esri.widgets.Popup.PopupViewModel",lt=X.getLogger(Kr),Jr=i=>{const{event:e,view:t,viewModel:s}=i,{action:n}=e;if(!n)return Promise.reject(new L("trigger-action:missing-arguments","Event has no action"));const{disabled:r,id:o}=n;if(!o)return Promise.reject(new L("trigger-action:invalid-action","action.id is missing"));if(r)return Promise.reject(new L("trigger-action:invalid-action","Action is disabled"));if(o===Ae.id)return to(s).catch(Qs);if(o===Oe.id)return io(s);if(o===ge.id)return s.browseClusterEnabled=!s.browseClusterEnabled,s.featureMenuOpen=s.browseClusterEnabled,Promise.resolve();if(o===xi.id){s.visible=!1;const{selectedFeature:d}=s;if(!d)return Promise.reject(new L(`trigger-action:${xi.id}`,"selectedFeature is required",{selectedFeature:d}));const{sourceLayer:c}=d;return c?c.remove(d):t==null||t.graphics.remove(d),Promise.resolve()}return Promise.resolve()};function hs(i){const{selectedFeature:e,location:t,view:s}=i;return s?e??t??null:null}function Me(i){var e,t;return!!i&&i.isAggregate&&((t=(e=i.sourceLayer)==null?void 0:e.featureReduction)==null?void 0:t.type)==="cluster"}async function eo(i,e){if((e==null?void 0:e.type)!=="3d"||!i||i.declaredClass!=="esri.Graphic")return!0;const t=e.getViewForGraphic(i);if(t&&"whenGraphicBounds"in t){let s=null;try{s=await t.whenGraphicBounds(i,{useViewElevation:!0})}catch{}return!s||!s.boundingBox||s.boundingBox[0]===s.boundingBox[3]&&s.boundingBox[1]===s.boundingBox[4]&&s.boundingBox[2]===s.boundingBox[5]}return!0}async function to(i){var p;const{location:e,selectedFeature:t,view:s,zoomFactor:n}=i,r=hs(i);if(!s||!r){const m=new L("zoom-to:invalid-target-or-view","Cannot zoom to location without a target and view.",{target:r,view:s});throw lt.error(m),m}const o=s.scale/n,d=(p=i.selectedFeature)==null?void 0:p.geometry,c=d??e,u=c!=null&&c.type==="point"&&await eo(t,s);Ae.active=!0,Ae.disabled=!0;try{await i.zoomTo({target:{target:r,scale:u?o:void 0}})}catch{const f=new L("zoom-to:invalid-graphic","Could not zoom to the location of the graphic.",{graphic:t});lt.error(f)}finally{Ae.active=!1,Ae.disabled=!1,i.zoomToLocation=null,u&&(i.location=c)}}async function io(i){const{selectedFeature:e,view:t}=i;if((t==null?void 0:t.type)!=="2d"){const o=new L("zoomToCluster:invalid-view","View must be 2d MapView.",{view:t});throw lt.error(o),o}if(!e||!Me(e)){const o=new L("zoomToCluster:invalid-selectedFeature","Selected feature must represent an aggregate/cluster graphic.",{selectedFeature:e});throw lt.error(o),o}const[s,n]=await Gt(t,e);Oe.active=!0,Oe.disabled=!0;const{extent:r}=await s.queryExtent(n);await i.zoomTo({target:r}),Oe.active=!1,Oe.disabled=!1}async function so(i){const{view:e,selectedFeature:t}=i;if(!e||!t)return;const[s,n]=await Gt(e,t),{extent:r}=await s.queryExtent(n);i.selectedClusterBoundaryFeature.geometry=r,e.graphics.add(i.selectedClusterBoundaryFeature)}async function no(i){const{selectedFeature:e,view:t}=i;if(!t||!e)return;const[s,n]=await Gt(t,e);ge.active=!0,ge.disabled=!0;const{features:r}=await s.queryFeatures(n);ge.active=!1,ge.disabled=!1,ge.value=!0,i==null||i.open({features:[e].concat(r),featureMenuOpen:!0})}async function Gt(i,e){const t=await i.whenLayerView(e.sourceLayer),s=t.createQuery(),n=e.getObjectId();return s.aggregateIds=n!=null?[n]:[],[t,s]}function ro(i){ge.value=!1;const e=i.features.filter(t=>Me(t));e.length&&(i.features=e)}function ps(i){var e;if(i==null)return null;switch(i.type){case"point":return i;case"extent":return i.center;case"polygon":return i.centroid;case"multipoint":case"polyline":return(e=i.extent)==null?void 0:e.center;default:return null}}const oo=()=>[Ae.clone()],ao=()=>[Oe.clone(),ge.clone()];let F=class extends Gs(ds){constructor(e){super(e),this._pendingPromises=new Gr,this._fetchFeaturesController=null,this._highlightSelectedFeaturePromise=null,this._highlightActiveFeaturePromise=null,this._selectedClusterFeature=null,this.actions=new Ce,this.activeFeature=null,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new De({symbol:new Xs({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null}initialize(){this.addHandles([this.on("view-change",()=>this._autoClose()),_(()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view],()=>this._highlightSelectedFeature()),_(()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view],()=>this._highlightActiveFeature()),_(()=>{var e,t;return(t=(e=this.view)==null?void 0:e.animation)==null?void 0:t.state},e=>this._animationStateChange(e)),_(()=>this.location,e=>this._locationChange(e)),_(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),_(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),_(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels],()=>this._setGraphicOnFeatureViewModels()),_(()=>this.featureViewModels,()=>this._featureViewModelsChange()),this.on("trigger-action",e=>Jr({event:e,viewModel:this,view:this.view})),nt(()=>!this.waitingForResult,()=>this._waitingForResultChange(),Ys),_(()=>{var e,t;return[this.features,(e=this.view)==null?void 0:e.map,(t=this.view)==null?void 0:t.spatialReference]},()=>this._updateFeatureVMs()),_(()=>{var e;return(e=this.view)==null?void 0:e.scale},()=>this._viewScaleChange()),nt(()=>!this.visible,()=>this.browseClusterEnabled=!1),_(()=>this.browseClusterEnabled,e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing())])}destroy(){this._cancelFetchingFeatures(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new Ce;e.removeAll();const{actions:t,defaultActions:s,defaultPopupTemplateEnabled:n,includeDefaultActions:r,selectedFeature:o}=this,d=r?s.concat(t):t,c=o&&(typeof o.getEffectivePopupTemplate=="function"&&o.getEffectivePopupTemplate(n)||o.popupTemplate),u=c==null?void 0:c.actions,p=c!=null&&c.overwriteActions?u:(u==null?void 0:u.concat(d))??d;return p==null||p.filter(Boolean).forEach(m=>e.add(m)),e}get defaultActions(){const e=this._get("defaultActions")||new Ce;return e.removeAll(),e.addMany(Me(this.selectedFeature)?ao():oo()),e}get featureCount(){return this.features.length}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:s,promiseCount:n,selectedFeatureIndex:r}=this,o=n&&t.length;o&&s&&r===-1?this.selectedFeatureIndex=0:o&&r!==-1||(this.selectedFeatureIndex=t.length?0:-1)}set location(e){var r,o,d;let t=e;const s=(o=(r=this.view)==null?void 0:r.spatialReference)==null?void 0:o.isWebMercator;((d=e==null?void 0:e.spatialReference)==null?void 0:d.isWGS84)&&s&&(t=Ks(e)),this._set("location",t)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice(0)).forEach(t=>{this._pendingPromises.add(t);const s=r=>{this._pendingPromises.has(t)&&this._updateFeatures(r),this._updatePendingPromises(t)},n=()=>this._updatePendingPromises(t);t.then(s,n)})):this._set("promises",[])}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;return t===-1?null:e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return typeof e=="number"?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){var e;return(e=this.view)!=null&&e.ready?"ready":"disabled"}get waitingForContents(){return this.featureViewModels.some(e=>e.waitingForContent)}get waitingForResult(){return!(!(this._fetchFeaturesController||this.pendingPromisesCount>0)||this.featureCount!==0)}centerAtLocation(){const{view:e}=this,t=hs(this);return t&&e?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new L("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:s}=this;if(!s||!e)throw new L("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:s});return s.fetchPopupFeatures(e,{event:t==null?void 0:t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t==null?void 0:t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:s}=t;delete t.fetchFeatures,s&&this._setFetchFeaturesPromises(t.location);const n=["actionsMenuOpen","collapsed"];for(const r of n)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex++,this}previous(){return this.selectedFeatureIndex--,this}disableClusterBrowsing(){ro(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;(e==null?void 0:e.type)==="2d"?Me(t)?(await so(this),await no(this)):X.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):X.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}handleViewClick(e){this.autoOpenEnabled&&this._fetchFeaturesAndOpen(e)}_animationStateChange(e){this.zoomToLocation||(Ae.disabled=e==="waiting-for-target")}_clearBrowsedClusterGraphics(){var t,s;const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(dt);(s=(t=this.view)==null?void 0:t.graphics)==null||s.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(Me(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:s}=this;s&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:s,featuresPerPage:n,featureViewModels:r}=this;if(s===null)return;const o=((s-1)*n+t)%t,d=o+n;r.slice(o,d).forEach((c,u)=>{c&&(c.graphic??(c.graphic=e[o+u]))})}async _selectedFeatureChange(e){var r;const{location:t,updateLocationEnabled:s,view:n}=this;if(e&&n){if(this.browseClusterEnabled)return this._selectedClusterFeature&&(n.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),Me(e)?void 0:(e.symbol=await Yr(e),this._selectedClusterFeature=e,void n.graphics.add(this._selectedClusterFeature));if(!s&&t||!e.geometry){if(s&&!e.geometry){await this.centerAtLocation();const o=(r=n.center)==null?void 0:r.clone();o&&(this.location=o)}}else this.location=ps(e.geometry)}}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{clientOnlyGraphics:t,promisesPerLayerView:s}=await this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)),n=Promise.resolve(t),r=s.map(o=>o.promise);this.promises=[n,...r]}_destroyFeatureVMs(){this.featureViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:s,view:n}=this;if(Me(e)||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!(t!=null&&t.length))return;const r=s.slice(0),o=[];t.forEach((d,c)=>{if(!d)return;let u=null;if(r.some((p,m)=>(p&&p.graphic===d&&(u=p,r.splice(m,1)),!!u)),u)o[c]=u;else{const p=new Qt({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:n==null?void 0:n.spatialReference,graphic:d===e?d:null,map:n==null?void 0:n.map,view:n});o[c]=p}}),r.forEach(d=>d&&!d.destroyed&&d.destroy()),this._set("featureViewModels",o)}_getScreenPoint(e){const{view:t}=this;return t&&e&&typeof t.toScreen=="function"?t.toScreen(e):null}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const s=new AbortController,{signal:n}=s;this._fetchFeaturesController=s;const r=this.fetchFeatures(e,{signal:n,event:t});return r.catch(()=>{}).then(()=>{this._fetchFeaturesController=null}),r}async _fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:s}=e,{view:n}=this,{clientOnlyGraphics:r,promisesPerLayerView:o,location:d}=await this._fetchFeaturesWithController(t,e),c=[Promise.resolve(r),...o.map(u=>u.promise)];n!=null&&n.popup&&"open"in n.popup&&n.popup.open({location:d||s,promises:c})}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&this._pendingPromises.delete(e)}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:s}=e;return s&&"layer"in s&&s.layer?s.layer:(s==null?void 0:s.type)==="map-notes"||(s==null?void 0:s.type)==="subtype-group"?s:t}_getHighlightTarget(e,t){const s=t.type==="imagery"?void 0:"objectIdField"in t?t.objectIdField||Xr:null,n=e.attributes;return n&&s&&n[s]||e}_mapIncludesLayer(e){var t,s,n;return!!((n=(s=(t=this.view)==null?void 0:t.map)==null?void 0:s.allLayers)!=null&&n.includes(e))}async _highlightActiveFeature(){const e="highlight-active-feature";this.removeHandles(e);const{highlightEnabled:t,view:s,activeFeature:n,visible:r}=this;if(!(n&&s&&t&&r))return;const o=this._getHighlightLayer(n);if(!(o&&o instanceof si&&this._mapIncludesLayer(o)))return;const d=this._getLayerView(s,o);this._highlightActiveFeaturePromise=d;const c=await d;if(!(c&&Ei(c)&&this._highlightActiveFeaturePromise===d&&this.activeFeature&&this.highlightEnabled))return;const u=c.highlight(this._getHighlightTarget(n,o));this.addHandles(u,e)}async _highlightSelectedFeature(){const e="highlight-selected-feature";this.removeHandles(e);const{selectedFeature:t,highlightEnabled:s,view:n,visible:r}=this;if(!(t&&n&&s&&r))return;const o=this._getHighlightLayer(t);if(!(o&&o instanceof si&&this._mapIncludesLayer(o)))return;const d=this._getLayerView(n,o);this._highlightSelectedFeaturePromise=d;const c=await d;if(!(c&&Ei(c)&&this._highlightSelectedFeaturePromise===d&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const u=c.highlight(this._getHighlightTarget(t,o));this.addHandles(u,e)}_updateFeatures(e){const{features:t}=this;if(!(e!=null&&e.length))return;if(!t.length)return void(this.features=e);const s=e.filter(n=>!t.includes(n));this.features=t.concat(s)}};a([l()],F.prototype,"_fetchFeaturesController",void 0),a([l({type:Ce})],F.prototype,"actions",void 0),a([l({readOnly:!0})],F.prototype,"active",null),a([l()],F.prototype,"activeFeature",void 0),a([l({readOnly:!0})],F.prototype,"allActions",null),a([l()],F.prototype,"autoCloseEnabled",void 0),a([l()],F.prototype,"autoOpenEnabled",void 0),a([l()],F.prototype,"browseClusterEnabled",void 0),a([l()],F.prototype,"content",void 0),a([l({type:Ce,readOnly:!0})],F.prototype,"defaultActions",null),a([l({type:Boolean})],F.prototype,"defaultPopupTemplateEnabled",void 0),a([l({readOnly:!0})],F.prototype,"featureCount",null),a([l()],F.prototype,"featurePage",void 0),a([l({value:[]})],F.prototype,"features",null),a([l()],F.prototype,"featuresPerPage",void 0),a([l()],F.prototype,"featureMenuOpen",void 0),a([l()],F.prototype,"featureViewModelAbilities",void 0),a([l({readOnly:!0})],F.prototype,"featureViewModels",void 0),a([l()],F.prototype,"highlightEnabled",void 0),a([l()],F.prototype,"includeDefaultActions",void 0),a([l({type:Js})],F.prototype,"location",null),a([l({readOnly:!0})],F.prototype,"pendingPromisesCount",null),a([l({readOnly:!0})],F.prototype,"promiseCount",null),a([l()],F.prototype,"promises",null),a([l({readOnly:!0})],F.prototype,"selectedClusterBoundaryFeature",void 0),a([l({value:null,readOnly:!0})],F.prototype,"selectedFeature",null),a([l({value:-1})],F.prototype,"selectedFeatureIndex",null),a([l({readOnly:!0})],F.prototype,"selectedFeatureViewModel",null),a([l({readOnly:!0})],F.prototype,"state",null),a([l()],F.prototype,"title",void 0),a([l()],F.prototype,"updateLocationEnabled",void 0),a([l()],F.prototype,"view",void 0),a([l()],F.prototype,"visible",void 0),a([l({readOnly:!0})],F.prototype,"waitingForContents",null),a([l({readOnly:!0})],F.prototype,"waitingForResult",null),a([l()],F.prototype,"zoomFactor",void 0),a([l()],F.prototype,"zoomToLocation",void 0),a([l()],F.prototype,"centerAtLocation",null),F=a([P("esri.widgets.Features.FeaturesViewModel")],F);const Xt=F;let ue=class extends pe{constructor(){super(...arguments),this.actionBar=!0,this.closeButton=!0,this.collapseButton=!1,this.featureNavigation=!0,this.heading=!0,this.spinner=!0}};a([l({type:Boolean,nonNullable:!0})],ue.prototype,"actionBar",void 0),a([l({type:Boolean,nonNullable:!0})],ue.prototype,"closeButton",void 0),a([l({type:Boolean,nonNullable:!0})],ue.prototype,"collapseButton",void 0),a([l({type:Boolean,nonNullable:!0})],ue.prototype,"featureNavigation",void 0),a([l({type:Boolean,nonNullable:!0})],ue.prototype,"heading",void 0),a([l({type:Boolean,nonNullable:!0})],ue.prototype,"spinner",void 0),ue=a([P("esri.widgets.Features.FeaturesVisibleElements")],ue);const ms=ue,Ti="selected-index",lo=0,ki="features-spinner",co=50;let k=class extends ls(te){constructor(i,e){super(i,e),this._featureMenuIntersectionObserverCallback=([t])=>{t!=null&&t.isIntersecting&&this.viewModel.featurePage!=null&&this.viewModel.featurePage++},this._featureMenuIntersectionObserver=new IntersectionObserver(this._featureMenuIntersectionObserverCallback,{root:window.document}),this._featureMenuIntersectionObserverNode=null,this._focusOn=null,this._spinner=null,this._feature=null,this._relatedRecordsFlowItems=new Se,this._relatedRecordsWidget=new Qr({flowItems:this._relatedRecordsFlowItems}),this._rootFlowItemNode=null,this._featureMenuViewportNode=null,this.collapsed=!1,this.icon=null,this.featureNavigationTop=!1,this.headerActions=new Ce,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.responsiveActionsEnabled=!1,this.viewModel=new Xt,this.visibleElements=new ms,this._renderAction=(t,s)=>{const n=this._getActionTitle(t),{type:r,active:o,uid:d,disabled:c,indicator:u}=t;return t.visible?h("calcite-action",{active:r==="toggle"&&t.value,appearance:"solid",bind:this,"data-action-uid":d,disabled:c,icon:this._getActionIcon(t),indicator:u,key:`action-${s}`,loading:o,onclick:this._triggerAction,scale:"s",text:n,title:this._hideActionText?n:void 0},this._getFallbackIcon(t)):null},this._openFeatureMenu=()=>{this.featureMenuOpen=!0},this._previousFeature=()=>{this.viewModel.selectedFeatureIndex--},this._nextFeature=()=>{this.viewModel.selectedFeatureIndex++},this._handleFeatureMenuBack=()=>{this.featureMenuOpen&&(this._focusOn="root-flow-item",this.featureMenuOpen=!1)},this._focusFlowItemNode=t=>{this._focusOn===t&&requestAnimationFrame(async()=>{var s,n;switch(t){case"menu-flow-item":await((s=this._featureMenuViewportNode)==null?void 0:s.setFocus());break;case"root-flow-item":await((n=this._rootFlowItemNode)==null?void 0:n.setFocus())}this._focusOn=null})},this._focusFlowItemNodeThrottled=rt(this._focusFlowItemNode,co),this._displaySpinnerThrottled=rt(()=>this._displaySpinner(),lo),this._addSelectedFeatureIndexHandle(),this.addHandles([this._displaySpinnerThrottled,this._focusFlowItemNodeThrottled,_(()=>{var t;return(t=this.viewModel)==null?void 0:t.active},()=>this._toggleScreenLocationEnabled()),_(()=>{var t;return(t=this.viewModel)==null?void 0:t.active},t=>this._relatedRecordsWidget.closed=!t),_(()=>{var t;return(t=this.visibleElements)==null?void 0:t.closeButton},t=>this._relatedRecordsWidget.closable=t),_(()=>{var t;return(t=this.visibleElements)==null?void 0:t.spinner},t=>this._spinnerEnabledChange(t)),_(()=>{var t;return(t=this.viewModel)==null?void 0:t.view},(t,s)=>this._viewChange(t,s)),_(()=>{var t,s;return(s=(t=this.viewModel)==null?void 0:t.view)==null?void 0:s.ready},(t,s)=>this._viewReadyChange(t??!1,s??!1)),_(()=>{var t,s;return[(t=this.viewModel)==null?void 0:t.waitingForResult,(s=this.viewModel)==null?void 0:s.location]},()=>{this._hideSpinner(),this._displaySpinnerThrottled()}),_(()=>this.selectedFeatureWidget,()=>this._destroyRelatedRecordsFlowItemWidgets()),_(()=>{var s;const t=(s=this.selectedFeatureWidget)==null?void 0:s.viewModel;return[t==null?void 0:t.title,t==null?void 0:t.state]},()=>this._setTitleFromFeatureWidget()),_(()=>{var s;const t=(s=this.selectedFeatureWidget)==null?void 0:s.viewModel;return[t==null?void 0:t.content,t==null?void 0:t.state]},()=>this._setContentFromFeatureWidget()),_(()=>{var t;return(t=this.viewModel)==null?void 0:t.featureViewModels},()=>this._featureMenuViewportScrollTop()),this._relatedRecordsWidget.on("close",()=>this.close()),this._relatedRecordsWidget.on("exit",()=>this._destroyRelatedRecordsFlowItemWidgets()),this._relatedRecordsWidget.on("open-related-feature",({feature:t})=>this._openRelatedFeature(t))])}loadDependencies(){return Be({action:()=>$(()=>import("./calcite-action-45454cb2.js"),["assets/calcite-action-45454cb2.js","assets/action-a6ed46b3.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/loader-f61cd56d.js","assets/interactive-3caa9409.js","assets/loadable-3ebcbea1.js","assets/t9n-0922c59a.js","assets/observers-c5d3b3aa.js","assets/icon-8ad9147a.js"]),"action-bar":()=>$(()=>import("./calcite-action-bar-a52fec01.js"),["assets/calcite-action-bar-a52fec01.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/conditionalSlot-1b98233e.js","assets/observers-c5d3b3aa.js","assets/loadable-3ebcbea1.js","assets/t9n-0922c59a.js","assets/action-group-1c5c01bd.js","assets/action-menu-a578494d.js","assets/loader-f61cd56d.js","assets/action-a6ed46b3.js","assets/interactive-3caa9409.js","assets/icon-8ad9147a.js","assets/debounce-49101817.js","assets/openCloseComponent-cdeb3156.js"]),"action-group":()=>$(()=>import("./calcite-action-group-f77b474d.js"),["assets/calcite-action-group-f77b474d.js","assets/action-group-1c5c01bd.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/conditionalSlot-1b98233e.js","assets/observers-c5d3b3aa.js","assets/loadable-3ebcbea1.js","assets/t9n-0922c59a.js","assets/action-menu-a578494d.js","assets/loader-f61cd56d.js","assets/action-a6ed46b3.js","assets/interactive-3caa9409.js","assets/icon-8ad9147a.js","assets/debounce-49101817.js","assets/openCloseComponent-cdeb3156.js"]),button:()=>$(()=>import("./calcite-button-506be1aa.js"),["assets/calcite-button-506be1aa.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/label2-60192bf8.js","assets/interactive-3caa9409.js","assets/loadable-3ebcbea1.js","assets/t9n-0922c59a.js","assets/observers-c5d3b3aa.js","assets/icon-8ad9147a.js","assets/loader-f61cd56d.js"]),flow:()=>$(()=>import("./calcite-flow-b3a9254e.js"),["assets/calcite-flow-b3a9254e.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/observers-c5d3b3aa.js","assets/loadable-3ebcbea1.js"]),"flow-item":()=>$(()=>import("./calcite-flow-item-227e2828.js"),["assets/calcite-flow-item-227e2828.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/interactive-3caa9409.js","assets/loadable-3ebcbea1.js","assets/t9n-0922c59a.js","assets/observers-c5d3b3aa.js","assets/action-menu-a578494d.js","assets/loader-f61cd56d.js","assets/action-a6ed46b3.js","assets/icon-8ad9147a.js","assets/debounce-49101817.js","assets/openCloseComponent-cdeb3156.js","assets/scrim-f377044b.js"]),list:()=>$(()=>import("./calcite-list-eca0cd56.js"),["assets/calcite-list-eca0cd56.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/interactive-3caa9409.js","assets/observers-c5d3b3aa.js","assets/utils3-7b57e505.js","assets/loadable-3ebcbea1.js","assets/debounce-49101817.js","assets/t9n-0922c59a.js","assets/icon-8ad9147a.js","assets/label2-60192bf8.js","assets/loader-f61cd56d.js","assets/scrim-f377044b.js"]),"list-item":()=>$(()=>import("./calcite-list-item-98e2d895.js"),["assets/calcite-list-item-98e2d895.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/interactive-3caa9409.js","assets/utils3-7b57e505.js","assets/t9n-0922c59a.js","assets/observers-c5d3b3aa.js","assets/loadable-3ebcbea1.js","assets/action-a6ed46b3.js","assets/loader-f61cd56d.js","assets/icon-8ad9147a.js"]),"list-item-group":()=>$(()=>import("./calcite-list-item-group-6f0aa638.js"),["assets/calcite-list-item-group-6f0aa638.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/interactive-3caa9409.js","assets/utils3-7b57e505.js"]),loader:()=>$(()=>import("./calcite-loader-3edc0104.js"),["assets/calcite-loader-3edc0104.js","assets/loader-f61cd56d.js","assets/index-b5c8f851.js","assets/index-86716609.css"])})}destroy(){var i,e;this._destroyRelatedRecordsFlowItemWidgets(),this._destroySelectedFeatureWidget(),this._destroySpinner(),this._unobserveFeatureMenuObserver(),(i=this._featureMenuIntersectionObserver)==null||i.disconnect(),(e=this._relatedRecordsWidget)==null||e.destroy()}get _hideActionText(){var e;if(!this.responsiveActionsEnabled)return!1;const i=(e=this.view)==null?void 0:e.widthBreakpoint;return i==="xsmall"||i==="small"||i==="medium"}get _featureNavigationVisible(){return this.viewModel.active&&this.viewModel.featureCount>1&&this.visibleElements.featureNavigation}get _isCollapsed(){return this._collapseEnabled&&this.collapsed}get _collapseEnabled(){return this.visibleElements.collapseButton&&!!this.title&&!!this.content}get content(){return this.viewModel.content}set content(i){this.viewModel.content=i}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(i){this.viewModel.featureMenuOpen=i}get features(){return this.viewModel.features}set features(i){this.viewModel.features=i}get location(){return this.viewModel.location}set location(i){this.viewModel.location=i}get label(){var i;return((i=this.messages)==null?void 0:i.widgetLabel)??""}set label(i){this._overrideIfSome("label",i)}get promises(){return this.viewModel.promises}set promises(i){this.viewModel.promises=i}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(i){this.viewModel.selectedFeatureIndex=i}get selectedFeatureWidget(){const{_feature:i,headingLevel:e,_relatedRecordsFlowItems:t}=this,{selectedFeatureViewModel:s}=this.viewModel,n={title:!1};return s?(i?(i.viewModel=s,i.visibleElements=n):this._feature=new jr({flowItems:t,headingLevel:e+1,viewModel:s,visibleElements:n}),this._feature):null}get title(){return this.viewModel.title}set title(i){this.viewModel.title=i}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(i){this.viewModel.updateLocationEnabled=i}get view(){return this.viewModel.view}set view(i){this.viewModel.view=i}get visible(){return this.viewModel.visible}set visible(i){this.viewModel.visible=i}blur(){var e;const{active:i}=this.viewModel;i?(e=this._rootFlowItemNode)==null||e.blur():X.getLogger(this).warn("Features can only be blurred when currently active.")}clear(){return this.viewModel.clear()}close(){this.viewModel.visible=!1}fetchFeatures(i,e){return this.viewModel.fetchFeatures(i,e)}focus(){const{active:i}=this.viewModel;i?this._setFocusOn():X.getLogger(this).warn("Features can only be focused when currently active.")}next(){return this.viewModel.next()}open(i){this.removeHandles(Ti);const e={collapsed:(i==null?void 0:i.collapsed)??!1};this.set(e),this.viewModel.open(i),this.addHandles(nt(()=>!this.viewModel.waitingForResult,()=>this._addSelectedFeatureIndexHandle(),{once:!0}))}previous(){return this.viewModel.previous()}triggerAction(i){return this.viewModel.triggerAction(i)}render(){return h("div",{bind:this,class:this.classes(q.base,I.widget,I.panel),onkeydown:this._onMainKeydown},this._renderHeader(),this._renderContentContainer())}_renderFeatureNavigation(){return[this._renderPagination(),this._renderFeatureMenuButton()]}_renderHeader(){return!this.featureMenuOpen&&this.featureNavigationTop&&this._featureNavigationVisible?h("div",{class:q.header,key:"header-actions"},this._renderFeatureNavigation()):null}_renderFooter(){return this.featureMenuOpen||this.featureNavigationTop||!this._featureNavigationVisible?null:h("div",{class:q.footer,key:"footer-actions",slot:"footer"},this._renderFeatureNavigation())}_renderFeatureMenuButton(){const{messages:i,viewModel:e}=this,{featureCount:t,selectedFeatureIndex:s,pendingPromisesCount:n}=e;return h("calcite-action",{appearance:"solid",bind:this,icon:"list",key:"feature-menu-button",label:i.selectFeature,loading:n>0,onclick:this._openFeatureMenu,scale:"s",text:le(i.pageText,{index:$e(s+1),total:$e(t)}),textEnabled:!0,title:i.selectFeature})}_renderPagination(){const{previous:i,next:e}=this.messagesCommon.pagination;return h("calcite-action-bar",{class:q.paginationActionBar,expandDisabled:!0,key:"pagination-action-bar",layout:"horizontal",overflowActionsDisabled:!0,scale:"s"},h("calcite-action-group",{scale:"s"},h("calcite-action",{appearance:"solid",class:q.paginationPrevious,icon:"chevron-left",iconFlipRtl:!0,label:i,onclick:this._previousFeature,scale:"s",text:i,title:i}),h("calcite-action",{appearance:"solid",icon:"chevron-right",iconFlipRtl:!0,label:e,onclick:this._nextFeature,scale:"s",text:e,title:e})))}_renderFeatureMenuItem(i){const{selectedFeatureViewModel:e,featureViewModels:t}=this.viewModel,s=i===e,n=t.indexOf(i);return h("calcite-list-item",{bind:this,"data-feature-index":n,key:`feature-menu-item-${i.uid}`,onblur:this._removeActiveFeature,onfocus:this._setActiveFeature,onmouseleave:this._removeActiveFeature,onmouseover:this._setActiveFeature,selected:s,onCalciteListItemSelect:this._selectFeature},h("span",{innerHTML:i.title||this.messagesCommon.untitled,slot:"content"}))}_groupResultsByLayer(){const{featureViewModels:i}=this.viewModel,e=new Map;return i.forEach(t=>{const s=t==null?void 0:t.graphic;if(!s)return;const n=s.sourceLayer??s.layer,r=e.get(n)??[];e.set(n,[...r,t])}),e}_renderFeatureMenu(){const{featureViewModels:i}=this.viewModel,e=this._groupResultsByLayer();return i.length?h("calcite-list",{selectionAppearance:"icon",selectionMode:"single"},Array.from(e.keys()).map(t=>{var s;return h("calcite-list-item-group",{heading:(t==null?void 0:t.title)??this.messagesCommon.untitled,key:(t==null?void 0:t.uid)||"untitled"},(s=e.get(t))==null?void 0:s.map(n=>this._renderFeatureMenuItem(n)))})):null}_renderHeaderAction(i,e){return i.visible?h("calcite-action",{active:i.type==="toggle"&&i.value,appearance:"solid",bind:this,"data-action-uid":i.uid,disabled:i.disabled,icon:i.icon||"",indicator:i.indicator,key:`header-action-${e}`,loading:i.active,onclick:this._triggerHeaderAction,scale:"m",slot:"header-actions-end",text:i.title||"",title:i.title||""}):null}_renderHeaderActions(){return this.headerActions.map((i,e)=>this._renderHeaderAction(i,e)).toArray()}_renderContentFeature(){const{headingLevel:i,visibleElements:e,_isCollapsed:t,_collapseEnabled:s,featureNavigationTop:n}=this,{title:r,active:o}=this.viewModel,d=e.heading&&r?r:"";return h("calcite-flow-item",{afterCreate:this._storeRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,class:this.classes({[q.contentFeature]:!0,[q.flowItemCollapsed]:t}),closable:e.closeButton,closed:!o,collapsed:t,collapseDirection:n?"down":"up",collapsible:s,headingLevel:i,key:"root-flow-item",onCalciteFlowItemClose:this.close,onCalciteFlowItemToggle:this._handleCollapseToggle},d?h(jt,{class:this.classes(q.featuresHeading,I.heading),innerHTML:d,key:"header-content",level:this.headingLevel,slot:"header-content"}):null,this._renderHeaderActions(),this._renderActionBar(),t?null:h("div",{class:this.classes(q.container,q.contentContainer)},this._renderContent()),this._renderFooter())}_renderFeatureMenuContainer(){const{viewModel:i,featureMenuOpen:e,messages:t,messagesCommon:s}=this,{active:n,featureViewModels:r,pendingPromisesCount:o}=i;return e?h("calcite-flow-item",{afterCreate:this._storeFeatureMenuFlowItemNode,afterUpdate:this._focusFeatureMenuFlowItemNode,bind:this,closable:!1,closed:!n,description:le(t.total,{total:r.length}),heading:t.selectFeature,key:"feature-menu",loading:i.waitingForContents,onCalciteFlowItemBack:this._handleFeatureMenuBack},o>0?h("calcite-loader",{class:q.loader,inline:!0,key:"feature-menu-loader",label:s.loading,scale:"m",slot:"header-actions-end"}):null,h("div",{class:q.container},this._renderFeatureMenu()),h("div",{afterCreate:this._featureMenuIntersectionObserverCreated,bind:this,class:q.featureMenuObserver}),h("calcite-button",{appearance:"transparent",onclick:this._handleFeatureMenuBack,slot:"footer-actions",width:"full"},s.back)):null}_renderContentContainer(){return h("calcite-flow",{key:"content-container"},this._renderContentFeature(),this._renderFeatureMenuContainer(),this._relatedRecordsWidget.render())}_getIconStyles(i){return{"background-image":i?`url(${i})`:""}}_getActionImage(i){const{selectedFeature:e}=this,t=e==null?void 0:e.attributes,{image:s}=i;return s&&t?le(s,t):s??""}_getFallbackIcon(i){const{className:e,icon:t}=i;if(t)return null;const s=this._getActionImage(i),n={[q.icon]:!!e,[q.actionImage]:!!s};return e&&(n[e]=!0),s||e?h("span",{"aria-hidden":"true",class:this.classes(q.icon,n),key:"icon",styles:s?this._getIconStyles(s):{}}):null}_renderActionBar(){var i;return!this._isCollapsed&&this.visibleElements.actionBar&&((i=this.viewModel.allActions)!=null&&i.length)?h("calcite-action-bar",{expandDisabled:!0,expanded:!this._hideActionText,key:"header-action-bar",scale:"s",slot:"action-bar"},h("calcite-action-group",{overlayPositioning:"fixed",scale:"s"},this._renderActions())):null}_renderActions(){return this.viewModel.allActions.toArray().map(this._renderAction)}_renderContent(){var e;const i=(e=this.viewModel)==null?void 0:e.content;return i?typeof i=="string"?h("div",{class:N.contentNode,innerHTML:i,key:i}):this.renderNodeContent(i):null}_setFocusOn(){this._focusOn=this.featureMenuOpen?"menu-flow-item":"root-flow-item",this.renderNow()}_handleCollapseToggle(){this.collapsed=!this.collapsed}async _openRelatedFeature(i){await i.viewModel.updateGeometry();const e=i.graphic,t=e==null?void 0:e.geometry;if(t==null||e==null)return;this._destroyRelatedRecordsFlowItemWidgets(),await this.viewModel.zoomTo({target:t});const s=ps(t);this.open({features:[e],location:s??void 0})}_focusRootFlowItemNode(){this._focusFlowItemNodeThrottled("root-flow-item")}_focusFeatureMenuFlowItemNode(){this._focusFlowItemNodeThrottled("menu-flow-item")}_storeRootFlowItemNode(i){this._rootFlowItemNode=i,this._focusFlowItemNodeThrottled("root-flow-item")}_storeFeatureMenuFlowItemNode(i){this._featureMenuViewportNode=i,this._focusFlowItemNodeThrottled("menu-flow-item")}_setActiveFeature(i){var s;const{viewModel:e}=this,t=i.currentTarget["data-feature-index"];e.activeFeature=((s=e.features)==null?void 0:s[t])||null}_removeActiveFeature(){this.viewModel.activeFeature=null}_selectFeature(i){const e=i.currentTarget["data-feature-index"];isNaN(e)||(this.viewModel.selectedFeatureIndex=e),this._handleFeatureMenuBack()}_unobserveFeatureMenuObserver(){this._featureMenuIntersectionObserverNode&&this._featureMenuIntersectionObserver.unobserve(this._featureMenuIntersectionObserverNode)}_featureMenuIntersectionObserverCreated(i){this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver.observe(i),this._featureMenuIntersectionObserverNode=i}_getActionIcon(i){return i.icon?i.icon:i.image||i.className?void 0:"question"}_getActionTitle(i){const{messages:e,selectedFeature:t,messagesCommon:s}=this,{id:n}=i,r=t==null?void 0:t.attributes,o=i.title??"",d=n==="zoom-to-feature"?le(o,{messages:e}):n==="remove-selected-feature"?le(o,{messages:s}):n==="zoom-to-clustered-features"||n==="browse-clustered-features"?le(o,{messages:e}):i.title;return d&&r?le(d,r):d??""}_onMainKeydown(i){const e=Si(i);e==="ArrowLeft"&&(i.stopPropagation(),this._handleFeatureMenuBack(),this.previous()),e==="ArrowRight"&&(i.stopPropagation(),this._handleFeatureMenuBack(),this.next())}_featureMenuViewportScrollTop(){this._featureMenuViewportNode&&this._featureMenuViewportNode.scrollContentTo({top:0})}_setContentFromFeatureWidget(){const{selectedFeatureWidget:i}=this;i&&(this.viewModel.content=i)}_setTitleFromFeatureWidget(){const{selectedFeatureWidget:i,messagesCommon:e}=this,t=i==null?void 0:i.viewModel;i&&(this.viewModel.title=(t==null?void 0:t.state)==="error"?e==null?void 0:e.errorMessage:(t==null?void 0:t.title)||"")}_addSelectedFeatureIndexHandle(){const i=_(()=>{var e;return(e=this.viewModel)==null?void 0:e.selectedFeatureIndex},(e,t)=>this._selectedFeatureIndexUpdated(e,t));this.addHandles(i,Ti)}_selectedFeatureIndexUpdated(i,e){const{featureCount:t}=this.viewModel;t&&i!==e&&i!==-1&&(this._destroyRelatedRecordsFlowItemWidgets(),this._rootFlowItemNode&&this._rootFlowItemNode.scrollContentTo({top:0}))}_triggerHeaderAction(i){const e=i.currentTarget;if(e.disabled)return;const t=e.dataset.actionUid,s=this.headerActions.find(({uid:n})=>n===t);s&&!s.disabled&&((s==null?void 0:s.type)==="toggle"&&(s.value=!s.value),this.emit("trigger-header-action",{action:s}))}_triggerAction(i){const e=i.currentTarget;if(e.disabled)return;const t=e.dataset.actionUid,{allActions:s}=this.viewModel,n=s.findIndex(o=>o.uid===t),r=s.at(n);r&&r.type==="toggle"&&(r.value=!r.value),this.viewModel.triggerAction(n)}_createSpinner(i){i&&(this._spinner=new Zr({view:i}),i.ui.add(this._spinner,{key:ki,position:"manual",internal:!0}))}_wireUpView(i){var e;this._destroySpinner(),i&&((e=this.visibleElements)!=null&&e.spinner)&&this._createSpinner(i)}_hideSpinner(){const{_spinner:i}=this;i&&(i.location=null,i.hide())}_viewReadyChange(i,e){var t;i?this._wireUpView((t=this.viewModel)==null?void 0:t.view):e&&this.viewModel.clear()}_viewChange(i,e){i&&e&&this.viewModel.clear()}_destroySelectedFeatureWidget(){const{_feature:i}=this;i&&(i.viewModel=null,!i.destroyed&&i.destroy()),this._feature=null}_destroyRelatedRecordsFlowItemWidgets(){this._relatedRecordsFlowItems.removeAll().forEach(i=>{"showAllEnabled"in i.viewModel&&(i.viewModel.showAllEnabled=!1),i.viewModel=null,i.destroy()})}_toggleScreenLocationEnabled(){const{viewModel:i}=this;i&&(i.screenLocationEnabled=i.active)}_displaySpinner(){const{_spinner:i}=this;if(!i)return;const{location:e,waitingForResult:t}=this.viewModel;t&&e?i.show({location:e}):i.hide()}_destroySpinner(){var t;const{_spinner:i,view:e}=this;i&&((t=e==null?void 0:e.ui)==null||t.remove(i,ki),i.destroy(),this._spinner=null)}_spinnerEnabledChange(i){var e;this._destroySpinner(),i&&this._createSpinner((e=this.viewModel)==null?void 0:e.view)}};a([l()],k.prototype,"_focusOn",void 0),a([l()],k.prototype,"_relatedRecordsFlowItems",void 0),a([l()],k.prototype,"_hideActionText",null),a([l()],k.prototype,"_featureNavigationVisible",null),a([l()],k.prototype,"_isCollapsed",null),a([l()],k.prototype,"_collapseEnabled",null),a([l()],k.prototype,"collapsed",void 0),a([l()],k.prototype,"content",null),a([l()],k.prototype,"icon",void 0),a([l()],k.prototype,"featureMenuOpen",null),a([l()],k.prototype,"featureNavigationTop",void 0),a([l()],k.prototype,"features",null),a([l({type:Ce})],k.prototype,"headerActions",void 0),a([l()],k.prototype,"headingLevel",void 0),a([l()],k.prototype,"location",null),a([l()],k.prototype,"label",null),a([l(),Y("esri/widgets/Features/t9n/Features")],k.prototype,"messages",void 0),a([l(),Y("esri/t9n/common")],k.prototype,"messagesCommon",void 0),a([l()],k.prototype,"promises",null),a([l()],k.prototype,"responsiveActionsEnabled",void 0),a([l({readOnly:!0})],k.prototype,"selectedFeature",null),a([l()],k.prototype,"selectedFeatureIndex",null),a([l({readOnly:!0})],k.prototype,"selectedFeatureWidget",null),a([l()],k.prototype,"title",null),a([l()],k.prototype,"updateLocationEnabled",null),a([l()],k.prototype,"view",null),a([l({type:Xt}),Hi(["triggerAction","trigger-action"])],k.prototype,"viewModel",void 0),a([l({type:ms,nonNullable:!0})],k.prototype,"visibleElements",void 0),a([l()],k.prototype,"visible",null),k=a([P("esri.widgets.Features")],k);const uo=k,se="esri-popup",ye=`${se}--is-docked`,V={base:se,main:`${se}__main-container`,shadow:`${se}--shadow`,isDocked:ye,isDockedTopLeft:`${ye}-top-left`,isDockedTopCenter:`${ye}-top-center`,isDockedTopRight:`${ye}-top-right`,isDockedBottomLeft:`${ye}-bottom-left`,isDockedBottomCenter:`${ye}-bottom-center`,isDockedBottomRight:`${ye}-bottom-right`,alignTopCenter:`${se}--aligned-top-center`,alignBottomCenter:`${se}--aligned-bottom-center`,alignTopLeft:`${se}--aligned-top-left`,alignBottomLeft:`${se}--aligned-bottom-left`,alignTopRight:`${se}--aligned-top-right`,alignBottomRight:`${se}--aligned-bottom-right`,pointer:`${se}__pointer`,pointerDirection:`${se}__pointer-direction`};let Nt=class extends Xt{constructor(i){super(i)}};Nt=a([P("esri.widgets.Popup.PopupViewModel")],Nt);const fs=Nt;let Ue=class extends pe{constructor(){super(...arguments),this.closeButton=!0,this.featureNavigation=!0}};a([l({type:Boolean,nonNullable:!0})],Ue.prototype,"closeButton",void 0),a([l({type:Boolean,nonNullable:!0})],Ue.prototype,"featureNavigation",void 0),Ue=a([P("esri.widgets.Features.PopupVisibleElements")],Ue);const gs=Ue,Li={buttonEnabled:!0,position:"auto",breakpoint:{width:544}};let C=class extends te{constructor(i,e){super(i,e),this._dockAction=new Qe({id:"popup-dock-action"}),this._featuresWidget=new uo({responsiveActionsEnabled:!0}),this._containerNode=null,this._mainContainerNode=null,this._pointerOffsetInPx=16,this.alignment="auto",this.collapsed=!1,this.collapseEnabled=!0,this.dockEnabled=!1,this.headingLevel=2,this.maxInlineActions=3,this.messages=null,this.spinnerEnabled=!0,this.viewModel=new fs,this.visibleElements=new gs}initialize(){this.addHandles([_(()=>{var i,e;return[(e=(i=this.viewModel)==null?void 0:i.view)==null?void 0:e.widthBreakpoint,this.dockEnabled]},()=>this._handleDockIcon(),{initial:!0}),_(()=>{var i,e;return[this.dockEnabled,(i=this.messages)==null?void 0:i.undock,(e=this.messages)==null?void 0:e.dock]},()=>this._handleDockEnabled(),{initial:!0}),_(()=>this.dockOptions,i=>{const{_dockAction:e}=this,t=this._featuresWidget.headerActions;t.remove(e),i.buttonEnabled&&t.add(e)},{initial:!0}),_(()=>{var i;return(i=this.viewModel)==null?void 0:i.screenLocation},()=>this._positionContainer()),_(()=>{var i;return[(i=this.viewModel)==null?void 0:i.active,this.dockEnabled]},()=>this._toggleScreenLocationEnabled()),_(()=>{var i,e,t,s,n,r,o;return[(i=this.viewModel)==null?void 0:i.screenLocation,(t=(e=this.viewModel)==null?void 0:e.view)==null?void 0:t.padding,(n=(s=this.viewModel)==null?void 0:s.view)==null?void 0:n.size,(r=this.viewModel)==null?void 0:r.active,(o=this.viewModel)==null?void 0:o.location,this.alignment]},()=>this.reposition()),_(()=>{var i,e;return(e=(i=this.viewModel)==null?void 0:i.view)==null?void 0:e.size},(i,e)=>this._updateDockEnabledForViewSize(i,e)),_(()=>{var i;return(i=this.viewModel)==null?void 0:i.view},(i,e)=>this._viewChange(i,e)),_(()=>{var i,e;return(e=(i=this.viewModel)==null?void 0:i.view)==null?void 0:e.ready},(i,e)=>this._viewReadyChange(i??!1,e??!1)),_(()=>this.viewModel,()=>this._featuresWidget.viewModel=this.viewModel,{initial:!0}),_(()=>this._featureNavigationTop,i=>this._featuresWidget.featureNavigationTop=i,{initial:!0}),_(()=>this.headingLevel,i=>this._featuresWidget.headingLevel=i,{initial:!0}),_(()=>this.collapseEnabled,i=>this._featuresWidget.visibleElements.collapseButton=i,{initial:!0}),_(()=>this.collapsed,i=>this._featuresWidget.collapsed=i,{initial:!0}),_(()=>this.visibleElements.closeButton,i=>this._featuresWidget.visibleElements.closeButton=!!i,{initial:!0}),_(()=>this.spinnerEnabled,i=>this._featuresWidget.visibleElements.spinner=i,{initial:!0}),_(()=>this.visibleElements.featureNavigation,i=>this._featuresWidget.visibleElements.featureNavigation=!!i,{initial:!0}),Ee(()=>this._featuresWidget,"trigger-header-action",i=>{i.action===this._dockAction&&(this.dockEnabled=!this.dockEnabled)})])}destroy(){var i;this._dockAction.destroy(),(i=this._featuresWidget)==null||i.destroy()}get _featureNavigationTop(){const{currentAlignment:i,currentDockPosition:e}=this;return i==="bottom-left"||i==="bottom-center"||i==="bottom-right"||e==="top-left"||e==="top-center"||e==="top-right"}get actions(){return this.viewModel.actions}set actions(i){this.viewModel.actions=i}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(i){this.viewModel.autoCloseEnabled=i}get autoOpenEnabled(){return ni(X.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled}set autoOpenEnabled(i){ni(X.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled=i}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(i){this.viewModel.defaultPopupTemplateEnabled=i}get content(){return this.viewModel.content}set content(i){this.viewModel.content=i}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||Li}set dockOptions(i){var d,c;const e={...Li},t=(c=(d=this.viewModel)==null?void 0:d.view)==null?void 0:c.breakpoints,s={};t&&(s.width=t.xsmall,s.height=t.xsmall);const n={...e,...i},r={...e.breakpoint,...s},{breakpoint:o}=n;typeof o=="object"?n.breakpoint={...r,...o}:o&&(n.breakpoint=r),this._set("dockOptions",n),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(i){this.viewModel.featureMenuOpen=i}get features(){return this.viewModel.features}set features(i){this.viewModel.features=i}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(i){this.viewModel.goToOverride=i}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(i){this.viewModel.highlightEnabled=i}get location(){return this.viewModel.location}set location(i){this.viewModel.location=i}get label(){var i;return((i=this.messages)==null?void 0:i.widgetLabel)??""}set label(i){this._overrideIfSome("label",i)}get promises(){return this.viewModel.promises}set promises(i){this.viewModel.promises=i}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(i){this.viewModel.selectedFeatureIndex=i}get selectedFeatureWidget(){return this._featuresWidget.selectedFeatureWidget}get title(){return this.viewModel.title}set title(i){this.viewModel.title=i}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(i){this.viewModel.updateLocationEnabled=i}get view(){return this.viewModel.view}set view(i){this.viewModel.view=i}get visible(){return this.viewModel.visible}set visible(i){this.viewModel.visible=i}blur(){const{active:i}=this.viewModel;i||X.getLogger(this).warn("Popup can only be blurred when currently active."),this._featuresWidget.blur()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(i,e){return this.viewModel.fetchFeatures(i,e)}focus(){const{active:i}=this.viewModel;i||X.getLogger(this).warn("Popup can only be focused when currently active."),this.renderNow(),this._featuresWidget.focus()}next(){return this.viewModel.next()}open(i){const e=!!i&&!!i.featureMenuOpen,t={collapsed:!!i&&!!i.collapsed,featureMenuOpen:e};this.set(t),this.viewModel.open(i),this._shouldFocus(i)}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(i){return this.viewModel.triggerAction(i)}render(){var u,p,m,f;const{dockEnabled:i,currentAlignment:e,currentDockPosition:t}=this,{active:s}=this.viewModel,n=s&&i,r=s&&!i,o=(p=(u=this.selectedFeature)==null?void 0:u.layer)==null?void 0:p.title,d=(f=(m=this.selectedFeature)==null?void 0:m.layer)==null?void 0:f.id,c={[V.alignTopCenter]:e==="top-center",[V.alignBottomCenter]:e==="bottom-center",[V.alignTopLeft]:e==="top-left",[V.alignBottomLeft]:e==="bottom-left",[V.alignTopRight]:e==="top-right",[V.alignBottomRight]:e==="bottom-right",[V.isDocked]:n,[V.shadow]:r,[V.isDockedTopLeft]:t==="top-left",[V.isDockedTopCenter]:t==="top-center",[V.isDockedTopRight]:t==="top-right",[V.isDockedBottomLeft]:t==="bottom-left",[V.isDockedBottomCenter]:t==="bottom-center",[V.isDockedBottomRight]:t==="bottom-right"};return h("div",{afterCreate:this._positionContainer,afterUpdate:this._positionContainer,bind:this,class:this.classes(V.base,c),"data-layer-id":d,"data-layer-title":o,role:"presentation"},s?[this._renderMainContainer(),this._renderPointer()]:null)}_renderPointer(){return this.dockEnabled?null:h("div",{class:V.pointer,key:"popup-pointer",role:"presentation"},h("div",{class:this.classes(V.pointerDirection,V.shadow)}))}_renderMainContainer(){const{dockEnabled:i}=this,e={[V.shadow]:i};return h("div",{afterCreate:this._setMainContainerNode,afterUpdate:this._setMainContainerNode,bind:this,class:this.classes(V.main,I.widget,e)},this._featuresWidget.render())}async _shouldFocus(i){i!=null&&i.shouldFocus&&(await en(()=>{var e;return((e=this.viewModel)==null?void 0:e.active)===!0}),this.focus())}_isOutsideView(i){const{popupHeight:e,popupWidth:t,screenLocation:s,side:n,view:r}=i;if(isNaN(t)||isNaN(e)||!r||!s)return!1;const o=r.padding;return n==="right"&&s.x+t/2>r.width-o.right||n==="left"&&s.x-t/2<o.left||n==="top"&&s.y-e<o.top||n==="bottom"&&s.y+e>r.height-o.bottom}_calculateAutoAlignment(i){if(i!=="auto")return i;const{_pointerOffsetInPx:e,_containerNode:t,_mainContainerNode:s,viewModel:n}=this,{screenLocation:r,view:o}=n;if(r==null||!o||!t)return"top-center";function d(R){return parseInt(R.replaceAll(/[^-\d\.]/g,""),10)}const c=s?window.getComputedStyle(s,null):null,u=c?d(c.getPropertyValue("max-height")):0,p=c?d(c.getPropertyValue("height")):0,{height:m,width:f}=t.getBoundingClientRect(),g=f+e,y=Math.max(m,u,p)+e,v=this._isOutsideView({popupHeight:y,popupWidth:g,screenLocation:r,side:"right",view:o}),A=this._isOutsideView({popupHeight:y,popupWidth:g,screenLocation:r,side:"left",view:o}),b=this._isOutsideView({popupHeight:y,popupWidth:g,screenLocation:r,side:"top",view:o}),E=this._isOutsideView({popupHeight:y,popupWidth:g,screenLocation:r,side:"bottom",view:o});return A?b?"bottom-right":"top-right":v?b?"bottom-left":"top-left":b?E?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(i){return typeof i=="function"?i.call(this):i}_getCurrentAlignment(){const{alignment:i,dockEnabled:e}=this;return e||!this.viewModel.active?null:this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(i)))}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(i){const e=["left","right"];return xe(this.container)&&e.reverse(),i==null?void 0:i.replace(/leading/gi,e[0]).replaceAll(/trailing/gi,e[1])}_callDockPosition(i){return typeof i=="function"?i.call(this):i}_getDockPosition(){var i;return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition((i=this.dockOptions)==null?void 0:i.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_calculateAutoDockPosition(i){var o;if(i!=="auto")return i;const e=(o=this.viewModel)==null?void 0:o.view,t=xe(this.container)?"top-left":"top-right";if(!e)return t;const s=e.padding||{left:0,right:0,top:0,bottom:0},n=e.width-s.left-s.right,{breakpoints:r}=e;return r&&n<=r.xsmall?"bottom-center":t}_getDockIcon(){const i=this._getDockPosition();if(this.dockEnabled)return"minimize";switch(i){case"top-left":case"bottom-left":return"dock-left";case"top-center":return"maximize";case"bottom-center":return"dock-bottom";default:return"dock-right"}}_handleDockIcon(){this._dockAction.icon=this._getDockIcon()}_handleDockEnabled(){var i,e;this._dockAction.title=this.dockEnabled?(i=this.messages)==null?void 0:i.undock:(e=this.messages)==null?void 0:e.dock}_setMainContainerNode(i){this._mainContainerNode=i}_positionContainer(i=this._containerNode){if(i&&(this._containerNode=i),!this._containerNode)return;const{screenLocation:e}=this.viewModel,{width:t}=this._containerNode.getBoundingClientRect(),s=this._calculatePositionStyle(e,t);s&&Object.assign(this._containerNode.style,s)}_calculateFullWidth(i){const{currentAlignment:e,_pointerOffsetInPx:t}=this;return e==="top-left"||e==="bottom-left"||e==="top-right"||e==="bottom-right"?i+t:i}_calculateAlignmentPosition(i,e,t,s){const{currentAlignment:n,_pointerOffsetInPx:r}=this;if(!t)return;const{padding:o}=t,d=s/2,c=t.height-e,u=t.width-i;return n==="bottom-center"?{top:e+r-o.top,left:i-d-o.left}:n==="top-left"?{bottom:c+r-o.bottom,right:u+r-o.right}:n==="bottom-left"?{top:e+r-o.top,right:u+r-o.right}:n==="top-right"?{bottom:c+r-o.bottom,left:i+r-o.left}:n==="bottom-right"?{top:e+r-o.top,left:i+r-o.left}:n==="top-center"?{bottom:c+r-o.bottom,left:i-d-o.left}:void 0}_calculatePositionStyle(i,e){const{dockEnabled:t,view:s}=this;if(!s)return;if(t)return{left:"",top:"",right:"",bottom:""};if(i==null||!e)return;const n=this._calculateFullWidth(e),r=this._calculateAlignmentPosition(i.x,i.y,s,n);return r?{top:r.top!==void 0?`${r.top}px`:"auto",left:r.left!==void 0?`${r.left}px`:"auto",bottom:r.bottom!==void 0?`${r.bottom}px`:"auto",right:r.right!==void 0?`${r.right}px`:"auto"}:void 0}_viewChange(i,e){i&&e&&(this.close(),this.clear())}_viewReadyChange(i,e){i?this._wireUpView():e&&(this.close(),this.clear())}_wireUpView(){this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(i,e,t){const[s,n]=i,[r,o]=e,{width:d=0,height:c=0}=t??{};return s<=d&&r>d||s>d&&r<=d||n<=c&&o>c||n>c&&o<=c}_updateDockEnabledForViewSize(i,e){var u,p;if(!i||!e)return;const t=((p=(u=this.viewModel)==null?void 0:u.view)==null?void 0:p.padding)||{left:0,right:0,top:0,bottom:0},s=t.left+t.right,n=t.top+t.bottom,r=[],o=[];r[0]=i[0]-s,r[1]=i[1]-n,o[0]=e[0]-s,o[1]=e[1]-n;const{dockOptions:d}=this,c=d.breakpoint;this._dockingThresholdCrossed(r,o,c)&&this._setDockEnabledForViewSize(d),this._setCurrentDockPosition()}_toggleScreenLocationEnabled(){const{dockEnabled:i,viewModel:e}=this;if(!e)return;const t=e.active&&!i;e.screenLocationEnabled=t}_shouldDockAtCurrentViewSize(i){var d,c;const e=i.breakpoint,t=(c=(d=this.viewModel)==null?void 0:d.view)==null?void 0:c.ui;if(!t)return!1;const{width:s,height:n}=t;if(isNaN(s)||isNaN(n)||!e)return!1;const r=e.hasOwnProperty("width")&&s<=(e.width??0),o=e.hasOwnProperty("height")&&n<=(e.height??0);return r||o}_setDockEnabledForViewSize(i){i.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(i))}};a([l({readOnly:!0})],C.prototype,"_featureNavigationTop",null),a([l()],C.prototype,"actions",null),a([l()],C.prototype,"alignment",void 0),a([l()],C.prototype,"autoCloseEnabled",null),a([l()],C.prototype,"autoOpenEnabled",null),a([l()],C.prototype,"defaultPopupTemplateEnabled",null),a([l()],C.prototype,"content",null),a([l()],C.prototype,"collapsed",void 0),a([l()],C.prototype,"collapseEnabled",void 0),a([l({readOnly:!0})],C.prototype,"currentAlignment",null),a([l({readOnly:!0})],C.prototype,"currentDockPosition",null),a([l()],C.prototype,"dockOptions",null),a([l()],C.prototype,"dockEnabled",void 0),a([l({readOnly:!0})],C.prototype,"featureCount",null),a([l()],C.prototype,"featureMenuOpen",null),a([l()],C.prototype,"features",null),a([l()],C.prototype,"goToOverride",null),a([l()],C.prototype,"headingLevel",void 0),a([l()],C.prototype,"highlightEnabled",null),a([l()],C.prototype,"location",null),a([l()],C.prototype,"label",null),a([l()],C.prototype,"maxInlineActions",void 0),a([l(),Y("esri/widgets/Popup/t9n/Popup")],C.prototype,"messages",void 0),a([l()],C.prototype,"promises",null),a([l({readOnly:!0})],C.prototype,"selectedFeature",null),a([l()],C.prototype,"selectedFeatureIndex",null),a([l({readOnly:!0})],C.prototype,"selectedFeatureWidget",null),a([l()],C.prototype,"spinnerEnabled",void 0),a([l()],C.prototype,"title",null),a([l()],C.prototype,"updateLocationEnabled",null),a([l()],C.prototype,"view",null),a([l({type:fs}),Hi(["triggerAction","trigger-action"])],C.prototype,"viewModel",void 0),a([l()],C.prototype,"visible",null),a([l({type:gs,nonNullable:!0})],C.prototype,"visibleElements",void 0),C=a([P("esri.widgets.Popup")],C);const Xo=C;export{Xo as default};